diff --git a/make/data/characterdata/CharacterData00.java.template b/make/data/characterdata/CharacterData00.java.template index 6183fb5eaad..7628ab834b6 100644 --- a/make/data/characterdata/CharacterData00.java.template +++ b/make/data/characterdata/CharacterData00.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -139,6 +139,12 @@ class CharacterData00 extends CharacterData { case 0x0130: mapChar = 0x0069; break; case 0x023A: mapChar = 0x2C65; break; case 0x023E: mapChar = 0x2C66; break; + case 0x0412: mapChar = 0x1C80; break; + case 0x0414: mapChar = 0x1C81; break; + case 0x041E: mapChar = 0x1C82; break; + case 0x0421: mapChar = 0x1C83; break; + case 0x042A: mapChar = 0x1C86; break; + case 0x0462: mapChar = 0x1C87; break; case 0x10A0: mapChar = 0x2D00; break; case 0x10A1: mapChar = 0x2D01; break; case 0x10A2: mapChar = 0x2D02; break; @@ -299,12 +305,14 @@ class CharacterData00 extends CharacterData { case 0x2C70: mapChar = 0x0252; break; case 0x2C7E: mapChar = 0x023F; break; case 0x2C7F: mapChar = 0x0240; break; + case 0xA64A: mapChar = 0x1C88; break; case 0xA77D: mapChar = 0x1D79; break; case 0xA78D: mapChar = 0x0265; break; case 0xA7AA: mapChar = 0x0266; break; case 0xA7AB: mapChar = 0x025C; break; case 0xA7AC: mapChar = 0x0261; break; case 0xA7AD: mapChar = 0x026C; break; + case 0xA7AE: mapChar = 0x026A; break; case 0xA7B0: mapChar = 0x029E; break; case 0xA7B1: mapChar = 0x0287; break; case 0xA7B2: mapChar = 0x029D; break; @@ -339,6 +347,7 @@ class CharacterData00 extends CharacterData { case 0x0261: mapChar = 0xA7AC; break; case 0x0265: mapChar = 0xA78D; break; case 0x0266: mapChar = 0xA7AA; break; + case 0x026A: mapChar = 0xA7AE; break; case 0x026B: mapChar = 0x2C62; break; case 0x026C: mapChar = 0xA7AD; break; case 0x0271: mapChar = 0x2C6E; break; @@ -346,6 +355,15 @@ class CharacterData00 extends CharacterData { case 0x0287: mapChar = 0xA7B1; break; case 0x029D: mapChar = 0xA7B2; break; case 0x029E: mapChar = 0xA7B0; break; + case 0x1C80: mapChar = 0x0412; break; + case 0x1C81: mapChar = 0x0414; break; + case 0x1C82: mapChar = 0x041E; break; + case 0x1C83: mapChar = 0x0421; break; + case 0x1C84: mapChar = 0x0422; break; + case 0x1C85: mapChar = 0x0422; break; + case 0x1C86: mapChar = 0x042A; break; + case 0x1C87: mapChar = 0x0462; break; + case 0x1C88: mapChar = 0xA64A; break; case 0x1D79: mapChar = 0xA77D; break; case 0x1D7D: mapChar = 0x2C63; break; case 0x1F80: mapChar = 0x1F88; break; @@ -715,6 +733,7 @@ class CharacterData00 extends CharacterData { case 0x0261: mapChar = 0xA7AC; break; case 0x0265: mapChar = 0xA78D; break; case 0x0266: mapChar = 0xA7AA; break; + case 0x026A: mapChar = 0xA7AE; break; case 0x026B: mapChar = 0x2C62; break; case 0x026C: mapChar = 0xA7AD; break; case 0x0271: mapChar = 0x2C6E; break; @@ -722,6 +741,15 @@ class CharacterData00 extends CharacterData { case 0x0287: mapChar = 0xA7B1; break; case 0x029D: mapChar = 0xA7B2; break; case 0x029E: mapChar = 0xA7B0; break; + case 0x1C80: mapChar = 0x0412; break; + case 0x1C81: mapChar = 0x0414; break; + case 0x1C82: mapChar = 0x041E; break; + case 0x1C83: mapChar = 0x0421; break; + case 0x1C84: mapChar = 0x0422; break; + case 0x1C85: mapChar = 0x0422; break; + case 0x1C86: mapChar = 0x042A; break; + case 0x1C87: mapChar = 0x0462; break; + case 0x1C88: mapChar = 0xA64A; break; case 0x1D79: mapChar = 0xA77D; break; case 0x1D7D: mapChar = 0x2C63; break; case 0x1FBE: mapChar = 0x0399; break; diff --git a/make/data/characterdata/CharacterData01.java.template b/make/data/characterdata/CharacterData01.java.template index 8441de74815..f2a701dff69 100644 --- a/make/data/characterdata/CharacterData01.java.template +++ b/make/data/characterdata/CharacterData01.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -372,6 +372,13 @@ class CharacterData01 extends CharacterData { case 0x11063: retval = 90; break; // BRAHMI NUMBER NINETY case 0x11064: retval = 100; break; // BRAHMI NUMBER ONE HUNDRED case 0x11065: retval = 1000; break; // BRAHMI NUMBER ONE THOUSAND + case 0x11C66: retval = 40; break; // BHAIKSUKI NUMBER FORTY + case 0x11C67: retval = 50; break; // BHAIKSUKI NUMBER FIFTY + case 0x11C68: retval = 60; break; // BHAIKSUKI NUMBER SIXTY + case 0x11C69: retval = 70; break; // BHAIKSUKI NUMBER SEVENTY + case 0x11C6A: retval = 80; break; // BHAIKSUKI NUMBER EIGHTY + case 0x11C6B: retval = 90; break; // BHAIKSUKI NUMBER NINETY + case 0x11C6C: retval = 100; break; // BHAIKSUKI HUNDREDS UNIT MARK case 0x111ED: retval = 40; break; // SINHALA ARCHAIC NUMBER FORTY case 0x111EE: retval = 50; break; // SINHALA ARCHAIC NUMBER FIFTY case 0x111EF: retval = 60; break; // SINHALA ARCHAIC NUMBER SIXTY diff --git a/make/data/symbols/java.activation-A.sym.txt b/make/data/symbols/java.activation-A.sym.txt new file mode 100644 index 00000000000..23788457096 --- /dev/null +++ b/make/data/symbols/java.activation-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.activation +header exports javax/activation requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;java.datatransfer\u0020;flags\u0020;20 target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/java.base-A.sym.txt b/make/data/symbols/java.base-A.sym.txt new file mode 100644 index 00000000000..26413c778c1 --- /dev/null +++ b/make/data/symbols/java.base-A.sym.txt @@ -0,0 +1,310 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.base +header exports java/io,java/lang,java/lang/annotation,java/lang/invoke,java/lang/module,java/lang/ref,java/lang/reflect,java/math,java/net,java/net/spi,java/nio,java/nio/channels,java/nio/channels/spi,java/nio/charset,java/nio/charset/spi,java/nio/file,java/nio/file/attribute,java/nio/file/spi,java/security,java/security/acl,java/security/cert,java/security/interfaces,java/security/spec,java/text,java/text/spi,java/time,java/time/chrono,java/time/format,java/time/temporal,java/time/zone,java/util,java/util/concurrent,java/util/concurrent/atomic,java/util/concurrent/locks,java/util/function,java/util/jar,java/util/regex,java/util/spi,java/util/stream,java/util/zip,javax/crypto,javax/crypto/interfaces,javax/crypto/spec,javax/net,javax/net/ssl,javax/security/auth,javax/security/auth/callback,javax/security/auth/login,javax/security/auth/spi,javax/security/auth/x500,javax/security/cert uses java/lang/System$LoggerFinder,java/net/ContentHandlerFactory,java/net/spi/URLStreamHandlerProvider,java/nio/channels/spi/AsynchronousChannelProvider,java/nio/channels/spi/SelectorProvider,java/nio/charset/spi/CharsetProvider,java/nio/file/spi/FileSystemProvider,java/nio/file/spi/FileTypeDetector,java/security/Provider,java/text/spi/BreakIteratorProvider,java/text/spi/CollatorProvider,java/text/spi/DateFormatProvider,java/text/spi/DateFormatSymbolsProvider,java/text/spi/DecimalFormatSymbolsProvider,java/text/spi/NumberFormatProvider,java/time/chrono/AbstractChronology,java/time/chrono/Chronology,java/time/zone/ZoneRulesProvider,java/util/spi/CalendarDataProvider,java/util/spi/CalendarNameProvider,java/util/spi/CurrencyNameProvider,java/util/spi/LocaleNameProvider,java/util/spi/ResourceBundleControlProvider,java/util/spi/ResourceBundleProvider,java/util/spi/TimeZoneNameProvider,java/util/spi/ToolProvider,javax/security/auth/spi/LoginModule,jdk/internal/logger/DefaultLoggerFinder,sun/security/ssl/ClientKeyExchangeService,sun/text/spi/JavaTimeDateTimePatternProvider,sun/util/locale/provider/LocaleDataMetaInfo,sun/util/resources/LocaleData$CommonResourceBundleProvider,sun/util/resources/LocaleData$SupplementaryResourceBundleProvider,sun/util/spi/CalendarProvider provides interface\u0020;java/nio/file/spi/FileSystemProvider\u0020;impls\u0020;jdk/internal/jrtfs/JrtFileSystemProvider target linux-amd64 flags 8000 + +class name java/io/ByteArrayOutputStream +method name toString descriptor (Ljava/nio/charset/Charset;)Ljava/lang/String; flags 21 + +class name java/io/FileInputStream +-method name finalize descriptor ()V +method name finalize descriptor ()V thrownTypes java/io/IOException flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/io/FileOutputStream +-method name finalize descriptor ()V +method name finalize descriptor ()V thrownTypes java/io/IOException flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/io/ObjectStreamClass +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/io/PrintStream +method name descriptor (Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V flags 1 +method name descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljava/io/File;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 + +class name java/io/PrintWriter +method name descriptor (Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V flags 1 +method name descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljava/io/File;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 + +class name java/io/Reader +method name transferTo descriptor (Ljava/io/Writer;)J thrownTypes java/io/IOException flags 1 + +class name java/lang/Math +-method name multiplyHigh descriptor (JJ)J +method name multiplyHigh descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; + +class name java/lang/Module +header extends java/lang/Object implements java/lang/reflect/AnnotatedElement flags 31 +innerclass innerClass java/lang/module/ModuleDescriptor$Version outerClass java/lang/module/ModuleDescriptor innerClassName Version flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports outerClass java/lang/module/ModuleDescriptor innerClassName Exports flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens outerClass java/lang/module/ModuleDescriptor innerClassName Opens flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/Runtime +-method name getLocalizedInputStream descriptor (Ljava/io/InputStream;)Ljava/io/InputStream; +-method name getLocalizedOutputStream descriptor (Ljava/io/OutputStream;)Ljava/io/OutputStream; + +class name java/lang/Runtime$Version +-method name major descriptor ()I +-method name minor descriptor ()I +-method name security descriptor ()I +method name feature descriptor ()I flags 1 +method name interim descriptor ()I flags 1 +method name update descriptor ()I flags 1 +method name patch descriptor ()I flags 1 +method name major descriptor ()I flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="10") +method name minor descriptor ()I flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="10") +method name security descriptor ()I flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="10") + +class name java/lang/SecurityManager +-field name inCheck descriptor Z +-method name getInCheck descriptor ()Z +-method name currentClassLoader descriptor ()Ljava/lang/ClassLoader; +-method name currentLoadedClass descriptor ()Ljava/lang/Class; +-method name classDepth descriptor (Ljava/lang/String;)I +-method name classLoaderDepth descriptor ()I +-method name inClass descriptor (Ljava/lang/String;)Z +-method name inClassLoader descriptor ()Z +-method name checkMemberAccess descriptor (Ljava/lang/Class;I)V +method name checkMemberAccess descriptor (Ljava/lang/Class;I)V flags 1 deprecated true signature (Ljava/lang/Class<*>;I)V runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.8") + +class name java/lang/StackWalker$StackFrame +method name getMethodType descriptor ()Ljava/lang/invoke/MethodType; flags 1 +method name getDescriptor descriptor ()Ljava/lang/String; flags 1 + +class name java/lang/invoke/MethodType +method name lastParameterType descriptor ()Ljava/lang/Class; flags 1 signature ()Ljava/lang/Class<*>; + +class name java/lang/reflect/MalformedParameterizedTypeException +method name descriptor (Ljava/lang/String;)V flags 1 + +class name java/net/URLDecoder +method name decode descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;)Ljava/lang/String; flags 9 + +class name java/net/URLEncoder +method name encode descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;)Ljava/lang/String; flags 9 + +class name java/nio/channels/Channels +method name newReader descriptor (Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)Ljava/io/Reader; flags 9 +method name newWriter descriptor (Ljava/nio/channels/WritableByteChannel;Ljava/nio/charset/Charset;)Ljava/io/Writer; flags 9 + +class name java/nio/file/FileStore +method name getBlockSize descriptor ()J thrownTypes java/io/IOException flags 1 + +class name java/security/Certificate +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") + +class name java/security/Identity +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") + +class name java/security/IdentityScope +header extends java/security/Identity flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") + +class name java/security/Signer +header extends java/security/Identity flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") + +class name java/security/acl/Acl +header extends java/lang/Object implements java/security/acl/Owner flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/AclEntry +header extends java/lang/Object implements java/lang/Cloneable flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/AclNotFoundException +header extends java/lang/Exception flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/Group +header extends java/lang/Object implements java/security/Principal flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/LastOwnerException +header extends java/lang/Exception flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/NotOwnerException +header extends java/lang/Exception flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/Owner +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/security/acl/Permission +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/time/chrono/AbstractChronology +header extends java/lang/Object implements java/time/chrono/Chronology flags 421 classAnnotations @Ljdk/Profile+Annotation;(value=I1) + +class name java/time/chrono/ChronoLocalDate +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/chrono/ChronoLocalDateTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;>; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/chrono/ChronoZonedDateTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/lang/Comparable;>; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/chrono/HijrahEra +method name getDisplayName descriptor (Ljava/time/format/TextStyle;Ljava/util/Locale;)Ljava/lang/String; flags 1 + +class name java/time/chrono/MinguoEra +method name getDisplayName descriptor (Ljava/time/format/TextStyle;Ljava/util/Locale;)Ljava/lang/String; flags 1 + +class name java/time/chrono/ThaiBuddhistEra +method name getDisplayName descriptor (Ljava/time/format/TextStyle;Ljava/util/Locale;)Ljava/lang/String; flags 1 + +class name java/time/format/DateTimeFormatter +method name localizedBy descriptor (Ljava/util/Locale;)Ljava/time/format/DateTimeFormatter; flags 1 + +class name java/util/Calendar +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable,java/lang/Comparable flags 421 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Cloneable;Ljava/lang/Comparable; +innerclass innerClass java/util/Calendar$Builder outerClass java/util/Calendar innerClassName Builder flags 9 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/DoubleSummaryStatistics +header extends java/lang/Object implements java/util/function/DoubleConsumer flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name descriptor (JDDD)V thrownTypes java/lang/IllegalArgumentException flags 1 + +class name java/util/Formatter +method name descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;Ljava/util/Locale;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljava/io/File;Ljava/nio/charset/Charset;Ljava/util/Locale;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljava/io/OutputStream;Ljava/nio/charset/Charset;Ljava/util/Locale;)V flags 1 + +class name java/util/HashSet +header extends java/util/AbstractSet implements java/util/Set,java/lang/Cloneable,java/io/Serializable flags 21 signature Ljava/util/AbstractSet;Ljava/util/Set;Ljava/lang/Cloneable;Ljava/io/Serializable; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/util/IntSummaryStatistics +method name descriptor (JIIJ)V thrownTypes java/lang/IllegalArgumentException flags 1 + +class name java/util/List +method name copyOf descriptor (Ljava/util/Collection;)Ljava/util/List; flags 9 signature (Ljava/util/Collection<+TE;>;)Ljava/util/List; + +class name java/util/Locale +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable flags 31 +innerclass innerClass java/util/Locale$LanguageRange outerClass java/util/Locale innerClassName LanguageRange flags 19 +innerclass innerClass java/util/Locale$FilteringMode outerClass java/util/Locale innerClassName FilteringMode flags 4019 +innerclass innerClass java/util/Locale$Builder outerClass java/util/Locale innerClassName Builder flags 19 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/util/Locale$IsoCountryCode outerClass java/util/Locale innerClassName IsoCountryCode flags 4409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/LongSummaryStatistics +method name descriptor (JJJJ)V thrownTypes java/lang/IllegalArgumentException flags 1 + +class name java/util/Map +method name copyOf descriptor (Ljava/util/Map;)Ljava/util/Map; flags 9 signature (Ljava/util/Map<+TK;+TV;>;)Ljava/util/Map; + +class name java/util/Optional +method name orElseThrow descriptor ()Ljava/lang/Object; flags 1 signature ()TT; + +class name java/util/OptionalDouble +method name orElseThrow descriptor ()D flags 1 + +class name java/util/OptionalInt +method name orElseThrow descriptor ()I flags 1 + +class name java/util/OptionalLong +method name orElseThrow descriptor ()J flags 1 + +class name java/util/Properties +method name descriptor (I)V flags 1 +method name storeToXML descriptor (Ljava/io/OutputStream;Ljava/lang/String;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 + +class name java/util/Scanner +method name descriptor (Ljava/io/InputStream;Ljava/nio/charset/Charset;)V flags 1 +method name descriptor (Ljava/io/File;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljava/nio/file/Path;Ljava/nio/charset/Charset;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)V flags 1 + +class name java/util/Set +method name copyOf descriptor (Ljava/util/Collection;)Ljava/util/Set; flags 9 signature (Ljava/util/Collection<+TE;>;)Ljava/util/Set; + +class name java/util/SimpleTimeZone +-method name hashCode descriptor ()I +method name hashCode descriptor ()I flags 1 + +class name java/util/SplittableRandom +method name nextBytes descriptor ([B)V flags 1 + +class name java/util/concurrent/ConcurrentSkipListMap +header extends java/util/AbstractMap implements java/util/concurrent/ConcurrentNavigableMap,java/lang/Cloneable,java/io/Serializable flags 21 signature Ljava/util/AbstractMap;Ljava/util/concurrent/ConcurrentNavigableMap;Ljava/lang/Cloneable;Ljava/io/Serializable; +innerclass innerClass java/util/AbstractMap$SimpleImmutableEntry outerClass java/util/AbstractMap innerClassName SimpleImmutableEntry flags 9 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/FutureTask +method name toString descriptor ()Ljava/lang/String; flags 1 + +class name java/util/concurrent/locks/StampedLock +method name isWriteLockStamp descriptor (J)Z flags 9 +method name isReadLockStamp descriptor (J)Z flags 9 +method name isLockStamp descriptor (J)Z flags 9 +method name isOptimisticReadStamp descriptor (J)Z flags 9 + +class name java/util/jar/JarEntry +method name getRealName descriptor ()Ljava/lang/String; flags 1 + +class name java/util/jar/JarFile +header extends java/util/zip/ZipFile flags 21 +innerclass innerClass java/lang/Runtime$Version outerClass java/lang/Runtime innerClassName Version flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name versionedStream descriptor ()Ljava/util/stream/Stream; flags 1 signature ()Ljava/util/stream/Stream; + +class name java/util/spi/LocaleNameProvider +method name getDisplayUnicodeExtensionKey descriptor (Ljava/lang/String;Ljava/util/Locale;)Ljava/lang/String; flags 1 +method name getDisplayUnicodeExtensionType descriptor (Ljava/lang/String;Ljava/lang/String;Ljava/util/Locale;)Ljava/lang/String; flags 1 + +class name java/util/stream/Collectors +method name toUnmodifiableList descriptor ()Ljava/util/stream/Collector; flags 9 signature ()Ljava/util/stream/Collector;>; +method name toUnmodifiableSet descriptor ()Ljava/util/stream/Collector; flags 9 signature ()Ljava/util/stream/Collector;>; +method name toUnmodifiableMap descriptor (Ljava/util/function/Function;Ljava/util/function/Function;)Ljava/util/stream/Collector; flags 9 signature (Ljava/util/function/Function<-TT;+TK;>;Ljava/util/function/Function<-TT;+TU;>;)Ljava/util/stream/Collector;>; +method name toUnmodifiableMap descriptor (Ljava/util/function/Function;Ljava/util/function/Function;Ljava/util/function/BinaryOperator;)Ljava/util/stream/Collector; flags 9 signature (Ljava/util/function/Function<-TT;+TK;>;Ljava/util/function/Function<-TT;+TU;>;Ljava/util/function/BinaryOperator;)Ljava/util/stream/Collector;>; + +class name java/util/zip/Deflater +-method name finalize descriptor ()V +method name finalize descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/util/zip/Inflater +-method name finalize descriptor ()V +method name finalize descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/util/zip/ZipFile +header extends java/lang/Object implements java/util/zip/ZipConstants,java/io/Closeable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name finalize descriptor ()V +method name finalize descriptor ()V thrownTypes java/io/IOException flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/auth/Policy +header extends java/lang/Object flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.4") + diff --git a/make/data/symbols/java.compiler-A.sym.txt b/make/data/symbols/java.compiler-A.sym.txt new file mode 100644 index 00000000000..2568f48ed3e --- /dev/null +++ b/make/data/symbols/java.compiler-A.sym.txt @@ -0,0 +1,115 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.compiler +header exports javax/annotation/processing,javax/lang/model,javax/lang/model/element,javax/lang/model/type,javax/lang/model/util,javax/tools requires name\u0020;java.base\u0020;flags\u0020;8000 uses javax/tools/DocumentationTool,javax/tools/JavaCompiler target linux-amd64 flags 8000 + +class name javax/lang/model/SourceVersion +field name RELEASE_10 descriptor Ljavax/lang/model/SourceVersion; flags 4019 + +class name javax/lang/model/util/AbstractAnnotationValueVisitor6 +-method name descriptor ()V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/AbstractAnnotationValueVisitor9 +header extends javax/lang/model/util/AbstractAnnotationValueVisitor8 flags 421 signature Ljavax/lang/model/util/AbstractAnnotationValueVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/AbstractElementVisitor6 +-method name descriptor ()V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/AbstractElementVisitor9 +header extends javax/lang/model/util/AbstractElementVisitor8 flags 421 signature Ljavax/lang/model/util/AbstractElementVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/AbstractTypeVisitor6 +-method name descriptor ()V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/AbstractTypeVisitor9 +header extends javax/lang/model/util/AbstractTypeVisitor8 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/ElementKindVisitor6 +-method name descriptor ()V +-method name descriptor (Ljava/lang/Object;)V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name descriptor (Ljava/lang/Object;)V flags 4 deprecated true signature (TR;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/ElementKindVisitor9 +header extends javax/lang/model/util/ElementKindVisitor8 flags 21 signature Ljavax/lang/model/util/ElementKindVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/ElementScanner6 +-method name descriptor ()V +-method name descriptor (Ljava/lang/Object;)V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name descriptor (Ljava/lang/Object;)V flags 4 deprecated true signature (TR;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/ElementScanner9 +header extends javax/lang/model/util/ElementScanner8 flags 21 signature Ljavax/lang/model/util/ElementScanner8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/SimpleAnnotationValueVisitor6 +-method name descriptor ()V +-method name descriptor (Ljava/lang/Object;)V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name descriptor (Ljava/lang/Object;)V flags 4 deprecated true signature (TR;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/SimpleAnnotationValueVisitor9 +header extends javax/lang/model/util/SimpleAnnotationValueVisitor8 flags 21 signature Ljavax/lang/model/util/SimpleAnnotationValueVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/SimpleElementVisitor6 +-method name descriptor ()V +-method name descriptor (Ljava/lang/Object;)V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name descriptor (Ljava/lang/Object;)V flags 4 deprecated true signature (TR;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/SimpleElementVisitor9 +header extends javax/lang/model/util/SimpleElementVisitor8 flags 21 signature Ljavax/lang/model/util/SimpleElementVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/SimpleTypeVisitor6 +-method name descriptor ()V +-method name descriptor (Ljava/lang/Object;)V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name descriptor (Ljava/lang/Object;)V flags 4 deprecated true signature (TR;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name javax/lang/model/util/SimpleTypeVisitor9 +header extends javax/lang/model/util/SimpleTypeVisitor8 flags 21 signature Ljavax/lang/model/util/SimpleTypeVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) + +class name javax/lang/model/util/TypeKindVisitor6 +-method name descriptor ()V +-method name descriptor (Ljava/lang/Object;)V +method name descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name descriptor (Ljava/lang/Object;)V flags 4 deprecated true signature (TR;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +method name visitNoTypeAsModule descriptor (Ljavax/lang/model/type/NoType;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Ljavax/lang/model/type/NoType;TP;)TR; + +class name javax/lang/model/util/TypeKindVisitor9 +header extends javax/lang/model/util/TypeKindVisitor8 flags 21 signature Ljavax/lang/model/util/TypeKindVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_10;) +method name visitNoTypeAsModule descriptor (Ljavax/lang/model/type/NoType;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Ljavax/lang/model/type/NoType;TP;)TR; + +class name javax/tools/ToolProvider +-method name getSystemToolClassLoader descriptor ()Ljava/lang/ClassLoader; +method name getSystemToolClassLoader descriptor ()Ljava/lang/ClassLoader; flags 9 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + diff --git a/make/data/symbols/java.corba-A.sym.txt b/make/data/symbols/java.corba-A.sym.txt new file mode 100644 index 00000000000..017d65008cd --- /dev/null +++ b/make/data/symbols/java.corba-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.corba +header exports javax/activity,javax/rmi,javax/rmi/CORBA,org/omg/CORBA,org/omg/CORBA/DynAnyPackage,org/omg/CORBA/ORBPackage,org/omg/CORBA/TypeCodePackage,org/omg/CORBA/portable,org/omg/CORBA_2_3,org/omg/CORBA_2_3/portable,org/omg/CosNaming,org/omg/CosNaming/NamingContextExtPackage,org/omg/CosNaming/NamingContextPackage,org/omg/Dynamic,org/omg/DynamicAny,org/omg/DynamicAny/DynAnyFactoryPackage,org/omg/DynamicAny/DynAnyPackage,org/omg/IOP,org/omg/IOP/CodecFactoryPackage,org/omg/IOP/CodecPackage,org/omg/Messaging,org/omg/PortableInterceptor,org/omg/PortableInterceptor/ORBInitInfoPackage,org/omg/PortableServer,org/omg/PortableServer/CurrentPackage,org/omg/PortableServer/POAManagerPackage,org/omg/PortableServer/POAPackage,org/omg/PortableServer/ServantLocatorPackage,org/omg/PortableServer/portable,org/omg/SendingContext,org/omg/stub/java/rmi requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;java.naming\u0020;flags\u0020;0,name\u0020;java.transaction\u0020;flags\u0020;0,name\u0020;jdk.unsupported\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;20,name\u0020;java.rmi\u0020;flags\u0020;20 target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/java.datatransfer-A.sym.txt b/make/data/symbols/java.datatransfer-A.sym.txt new file mode 100644 index 00000000000..4e4a80ab79e --- /dev/null +++ b/make/data/symbols/java.datatransfer-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.datatransfer +header exports java/awt/datatransfer requires name\u0020;java.base\u0020;flags\u0020;8000 uses sun/datatransfer/DesktopDatatransferService target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.desktop-A.sym.txt b/make/data/symbols/java.desktop-A.sym.txt new file mode 100644 index 00000000000..f3ddc92fb82 --- /dev/null +++ b/make/data/symbols/java.desktop-A.sym.txt @@ -0,0 +1,87 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.desktop +header exports java/applet,java/awt,java/awt/color,java/awt/desktop,java/awt/dnd,java/awt/event,java/awt/font,java/awt/geom,java/awt/im,java/awt/im/spi,java/awt/image,java/awt/image/renderable,java/awt/print,java/beans,java/beans/beancontext,javax/accessibility,javax/imageio,javax/imageio/event,javax/imageio/metadata,javax/imageio/plugins/bmp,javax/imageio/plugins/jpeg,javax/imageio/plugins/tiff,javax/imageio/spi,javax/imageio/stream,javax/print,javax/print/attribute,javax/print/attribute/standard,javax/print/event,javax/sound/midi,javax/sound/midi/spi,javax/sound/sampled,javax/sound/sampled/spi,javax/swing,javax/swing/border,javax/swing/colorchooser,javax/swing/event,javax/swing/filechooser,javax/swing/plaf,javax/swing/plaf/basic,javax/swing/plaf/metal,javax/swing/plaf/multi,javax/swing/plaf/nimbus,javax/swing/plaf/synth,javax/swing/table,javax/swing/text,javax/swing/text/html,javax/swing/text/html/parser,javax/swing/text/rtf,javax/swing/tree,javax/swing/undo requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.prefs\u0020;flags\u0020;0,name\u0020;java.datatransfer\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20 uses java/awt/im/spi/InputMethodDescriptor,javax/accessibility/AccessibilityProvider,javax/imageio/spi/ImageInputStreamSpi,javax/imageio/spi/ImageOutputStreamSpi,javax/imageio/spi/ImageReaderSpi,javax/imageio/spi/ImageTranscoderSpi,javax/imageio/spi/ImageWriterSpi,javax/print/PrintServiceLookup,javax/print/StreamPrintServiceFactory,javax/sound/midi/spi/MidiDeviceProvider,javax/sound/midi/spi/MidiFileReader,javax/sound/midi/spi/MidiFileWriter,javax/sound/midi/spi/SoundbankReader,javax/sound/sampled/spi/AudioFileReader,javax/sound/sampled/spi/AudioFileWriter,javax/sound/sampled/spi/FormatConversionProvider,javax/sound/sampled/spi/MixerProvider provides interface\u0020;sun/datatransfer/DesktopDatatransferService\u0020;impls\u0020;sun/awt/datatransfer/DesktopDatatransferServiceImpl,interface\u0020;java/net/ContentHandlerFactory\u0020;impls\u0020;sun/awt/www/content/MultimediaContentHandlers,interface\u0020;javax/print/PrintServiceLookup\u0020;impls\u0020;sun/print/PrintServiceLookupProvider,interface\u0020;javax/print/StreamPrintServiceFactory\u0020;impls\u0020;sun/print/PSStreamPrinterFactory,interface\u0020;javax/sound/midi/spi/MidiDeviceProvider\u0020;impls\u0020;com/sun/media/sound/MidiInDeviceProvider\u005C;u002C;com/sun/media/sound/MidiOutDeviceProvider\u005C;u002C;com/sun/media/sound/RealTimeSequencerProvider\u005C;u002C;com/sun/media/sound/SoftProvider,interface\u0020;javax/sound/midi/spi/MidiFileReader\u0020;impls\u0020;com/sun/media/sound/StandardMidiFileReader,interface\u0020;javax/sound/midi/spi/MidiFileWriter\u0020;impls\u0020;com/sun/media/sound/StandardMidiFileWriter,interface\u0020;javax/sound/midi/spi/SoundbankReader\u0020;impls\u0020;com/sun/media/sound/AudioFileSoundbankReader\u005C;u002C;com/sun/media/sound/DLSSoundbankReader\u005C;u002C;com/sun/media/sound/JARSoundbankReader\u005C;u002C;com/sun/media/sound/SF2SoundbankReader,interface\u0020;javax/sound/sampled/spi/AudioFileReader\u0020;impls\u0020;com/sun/media/sound/AiffFileReader\u005C;u002C;com/sun/media/sound/AuFileReader\u005C;u002C;com/sun/media/sound/SoftMidiAudioFileReader\u005C;u002C;com/sun/media/sound/WaveFileReader\u005C;u002C;com/sun/media/sound/WaveFloatFileReader\u005C;u002C;com/sun/media/sound/WaveExtensibleFileReader,interface\u0020;javax/sound/sampled/spi/AudioFileWriter\u0020;impls\u0020;com/sun/media/sound/AiffFileWriter\u005C;u002C;com/sun/media/sound/AuFileWriter\u005C;u002C;com/sun/media/sound/WaveFileWriter\u005C;u002C;com/sun/media/sound/WaveFloatFileWriter,interface\u0020;javax/sound/sampled/spi/FormatConversionProvider\u0020;impls\u0020;com/sun/media/sound/AlawCodec\u005C;u002C;com/sun/media/sound/AudioFloatFormatConverter\u005C;u002C;com/sun/media/sound/PCMtoPCMCodec\u005C;u002C;com/sun/media/sound/UlawCodec,interface\u0020;javax/sound/sampled/spi/MixerProvider\u0020;impls\u0020;com/sun/media/sound/DirectAudioDeviceProvider\u005C;u002C;com/sun/media/sound/PortMixerProvider target linux-amd64 flags 8000 + +class name java/awt/GraphicsEnvironment +-method name getLocalGraphicsEnvironment descriptor ()Ljava/awt/GraphicsEnvironment; +method name getLocalGraphicsEnvironment descriptor ()Ljava/awt/GraphicsEnvironment; flags 9 + +class name java/awt/Toolkit +-method name getMenuShortcutKeyMask descriptor ()I +method name getMenuShortcutKeyMask descriptor ()I thrownTypes java/awt/HeadlessException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="10") +method name getMenuShortcutKeyMaskEx descriptor ()I thrownTypes java/awt/HeadlessException flags 1 + +class name java/awt/geom/Path2D +method name trimToSize descriptor ()V flags 401 + +class name java/awt/geom/Path2D$Double +method name trimToSize descriptor ()V flags 11 + +class name java/awt/geom/Path2D$Float +method name trimToSize descriptor ()V flags 11 + +class name java/awt/image/BufferedImage +-method name setRGB descriptor (III)V +method name setRGB descriptor (III)V flags 1 + +class name java/awt/image/FilteredImageSource +-method name startProduction descriptor (Ljava/awt/image/ImageConsumer;)V +-method name requestTopDownLeftRightResend descriptor (Ljava/awt/image/ImageConsumer;)V +method name startProduction descriptor (Ljava/awt/image/ImageConsumer;)V flags 21 +method name requestTopDownLeftRightResend descriptor (Ljava/awt/image/ImageConsumer;)V flags 21 + +class name javax/swing/ButtonModel +method name getGroup descriptor ()Ljavax/swing/ButtonGroup; flags 1 + +class name javax/swing/LayoutFocusTraversalPolicy +header extends javax/swing/SortingFocusTraversalPolicy implements java/io/Serializable flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I4) + +class name javax/swing/event/EventListenerList +-field name listenerList descriptor [Ljava/lang/Object; +field name listenerList descriptor [Ljava/lang/Object; flags c4 + +class name javax/swing/filechooser/FileSystemView +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/ref/Cleaner$Cleanable outerClass java/lang/ref/Cleaner innerClassName Cleanable flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicMenuUI +method name getMinimumSize descriptor (Ljavax/swing/JComponent;)Ljava/awt/Dimension; flags 1 + +class name javax/swing/text/DefaultCaret +header extends java/awt/Rectangle implements javax/swing/text/Caret,java/awt/event/FocusListener,java/awt/event/MouseListener,java/awt/event/MouseMotionListener flags 21 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/text/NavigationFilter$FilterBypass outerClass javax/swing/text/NavigationFilter innerClassName FilterBypass flags 409 +innerclass innerClass javax/swing/text/Highlighter$HighlightPainter outerClass javax/swing/text/Highlighter innerClassName HighlightPainter flags 609 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/text/LayeredHighlighter$LayerPainter outerClass javax/swing/text/LayeredHighlighter innerClassName LayerPainter flags 409 +innerclass innerClass java/awt/event/FocusEvent$Cause outerClass java/awt/event/FocusEvent innerClassName Cause flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.instrument-A.sym.txt b/make/data/symbols/java.instrument-A.sym.txt new file mode 100644 index 00000000000..d4632bf97b1 --- /dev/null +++ b/make/data/symbols/java.instrument-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.instrument +header exports java/lang/instrument requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.logging-A.sym.txt b/make/data/symbols/java.logging-A.sym.txt new file mode 100644 index 00000000000..4630412f2ab --- /dev/null +++ b/make/data/symbols/java.logging-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.logging +header exports java/util/logging requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;jdk/internal/logger/DefaultLoggerFinder\u0020;impls\u0020;sun/util/logging/internal/LoggingProviderImpl target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.management-A.sym.txt b/make/data/symbols/java.management-A.sym.txt new file mode 100644 index 00000000000..98553208154 --- /dev/null +++ b/make/data/symbols/java.management-A.sym.txt @@ -0,0 +1,40 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.management +header exports java/lang/management,javax/management,javax/management/loading,javax/management/modelmbean,javax/management/monitor,javax/management/openmbean,javax/management/relation,javax/management/remote,javax/management/timer requires name\u0020;java.base\u0020;flags\u0020;8000 uses javax/management/remote/JMXConnectorProvider,javax/management/remote/JMXConnectorServerProvider,sun/management/spi/PlatformMBeanProvider provides interface\u0020;javax/security/auth/spi/LoginModule\u0020;impls\u0020;com/sun/jmx/remote/security/FileLoginModule target linux-amd64 flags 8000 + +class name java/lang/management/RuntimeMXBean +header extends java/lang/Object implements java/lang/management/PlatformManagedObject flags 601 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name getPid descriptor ()J flags 1 + +class name java/lang/management/ThreadMXBean +method name getThreadInfo descriptor ([JZZI)[Ljava/lang/management/ThreadInfo; flags 1 +method name dumpAllThreads descriptor (ZZI)[Ljava/lang/management/ThreadInfo; flags 1 + diff --git a/make/data/symbols/java.management.rmi-A.sym.txt b/make/data/symbols/java.management.rmi-A.sym.txt new file mode 100644 index 00000000000..934360d4682 --- /dev/null +++ b/make/data/symbols/java.management.rmi-A.sym.txt @@ -0,0 +1,44 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.management.rmi +header exports javax/management/remote/rmi requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.naming\u0020;flags\u0020;0,name\u0020;java.management\u0020;flags\u0020;20,name\u0020;java.rmi\u0020;flags\u0020;20 provides interface\u0020;javax/management/remote/JMXConnectorProvider\u0020;impls\u0020;com/sun/jmx/remote/protocol/rmi/ClientProvider,interface\u0020;javax/management/remote/JMXConnectorServerProvider\u0020;impls\u0020;com/sun/jmx/remote/protocol/rmi/ServerProvider target linux-amd64 flags 8000 + +class name javax/management/remote/rmi/RMIConnectorServer +-field name CREDENTIAL_TYPES descriptor Ljava/lang/String; +field name CREDENTIAL_TYPES descriptor Ljava/lang/String; constantValue jmx.remote.rmi.server.credential.types flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="10") +field name CREDENTIALS_FILTER_PATTERN descriptor Ljava/lang/String; constantValue jmx.remote.rmi.server.credentials.filter.pattern flags 19 +field name SERIAL_FILTER_PATTERN descriptor Ljava/lang/String; constantValue jmx.remote.rmi.server.serial.filter.pattern flags 19 + +class name javax/management/remote/rmi/RMIJRMPServerImpl +header extends javax/management/remote/rmi/RMIServerImpl flags 21 +innerclass innerClass java/io/ObjectInputFilter$FilterInfo outerClass java/io/ObjectInputFilter innerClassName FilterInfo flags 609 +innerclass innerClass java/io/ObjectInputFilter$Status outerClass java/io/ObjectInputFilter innerClassName Status flags 4019 +innerclass innerClass java/io/ObjectInputFilter$Config outerClass java/io/ObjectInputFilter innerClassName Config flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.naming-A.sym.txt b/make/data/symbols/java.naming-A.sym.txt new file mode 100644 index 00000000000..3d9b497bf39 --- /dev/null +++ b/make/data/symbols/java.naming-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.naming +header exports javax/naming,javax/naming/directory,javax/naming/event,javax/naming/ldap,javax/naming/spi requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.security.sasl\u0020;flags\u0020;0 uses javax/naming/ldap/StartTlsResponse,javax/naming/spi/InitialContextFactory provides interface\u0020;java/security/Provider\u0020;impls\u0020;sun/security/provider/certpath/ldap/JdkLDAP target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.prefs-A.sym.txt b/make/data/symbols/java.prefs-A.sym.txt new file mode 100644 index 00000000000..1458a51bdc8 --- /dev/null +++ b/make/data/symbols/java.prefs-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.prefs +header exports java/util/prefs requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.xml\u0020;flags\u0020;0 uses java/util/prefs/PreferencesFactory target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.rmi-A.sym.txt b/make/data/symbols/java.rmi-A.sym.txt new file mode 100644 index 00000000000..020d49ad22b --- /dev/null +++ b/make/data/symbols/java.rmi-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.rmi +header exports java/rmi,java/rmi/activation,java/rmi/dgc,java/rmi/registry,java/rmi/server,javax/rmi/ssl requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0 uses java/rmi/server/RMIClassLoaderSpi target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.scripting-A.sym.txt b/make/data/symbols/java.scripting-A.sym.txt new file mode 100644 index 00000000000..ab88ff08528 --- /dev/null +++ b/make/data/symbols/java.scripting-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.scripting +header exports javax/script requires name\u0020;java.base\u0020;flags\u0020;8000 uses javax/script/ScriptEngineFactory target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.se-A.sym.txt b/make/data/symbols/java.se-A.sym.txt new file mode 100644 index 00000000000..b1d66e24133 --- /dev/null +++ b/make/data/symbols/java.se-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.se +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.compiler\u0020;flags\u0020;20,name\u0020;java.datatransfer\u0020;flags\u0020;20,name\u0020;java.desktop\u0020;flags\u0020;20,name\u0020;java.instrument\u0020;flags\u0020;20,name\u0020;java.logging\u0020;flags\u0020;20,name\u0020;java.management\u0020;flags\u0020;20,name\u0020;java.management.rmi\u0020;flags\u0020;20,name\u0020;java.naming\u0020;flags\u0020;20,name\u0020;java.prefs\u0020;flags\u0020;20,name\u0020;java.rmi\u0020;flags\u0020;20,name\u0020;java.scripting\u0020;flags\u0020;20,name\u0020;java.security.jgss\u0020;flags\u0020;20,name\u0020;java.security.sasl\u0020;flags\u0020;20,name\u0020;java.sql\u0020;flags\u0020;20,name\u0020;java.sql.rowset\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20,name\u0020;java.xml.crypto\u0020;flags\u0020;20 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.se.ee-A.sym.txt b/make/data/symbols/java.se.ee-A.sym.txt new file mode 100644 index 00000000000..d254af95f74 --- /dev/null +++ b/make/data/symbols/java.se.ee-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.se.ee +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.se\u0020;flags\u0020;20,name\u0020;java.activation\u0020;flags\u0020;20,name\u0020;java.corba\u0020;flags\u0020;20,name\u0020;java.transaction\u0020;flags\u0020;20,name\u0020;java.xml.bind\u0020;flags\u0020;20,name\u0020;java.xml.ws\u0020;flags\u0020;20,name\u0020;java.xml.ws.annotation\u0020;flags\u0020;20 target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/java.security.jgss-A.sym.txt b/make/data/symbols/java.security.jgss-A.sym.txt new file mode 100644 index 00000000000..0f98da5f237 --- /dev/null +++ b/make/data/symbols/java.security.jgss-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.security.jgss +header exports javax/security/auth/kerberos,org/ietf/jgss requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.naming\u0020;flags\u0020;0 provides interface\u0020;java/security/Provider\u0020;impls\u0020;sun/security/jgss/SunProvider,interface\u0020;sun/security/ssl/ClientKeyExchangeService\u0020;impls\u0020;sun/security/krb5/internal/ssl/Krb5KeyExchangeService target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.security.sasl-A.sym.txt b/make/data/symbols/java.security.sasl-A.sym.txt new file mode 100644 index 00000000000..3f0104ef545 --- /dev/null +++ b/make/data/symbols/java.security.sasl-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.security.sasl +header exports javax/security/sasl requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0 provides interface\u0020;java/security/Provider\u0020;impls\u0020;com/sun/security/sasl/Provider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.smartcardio-A.sym.txt b/make/data/symbols/java.smartcardio-A.sym.txt new file mode 100644 index 00000000000..f874525553c --- /dev/null +++ b/make/data/symbols/java.smartcardio-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.smartcardio +header exports javax/smartcardio requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;java/security/Provider\u0020;impls\u0020;sun/security/smartcardio/SunPCSC target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.sql-A.sym.txt b/make/data/symbols/java.sql-A.sym.txt new file mode 100644 index 00000000000..e86c26be5ba --- /dev/null +++ b/make/data/symbols/java.sql-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.sql +header exports java/sql,javax/sql,javax/transaction/xa requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20 uses java/sql/Driver target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.sql.rowset-A.sym.txt b/make/data/symbols/java.sql.rowset-A.sym.txt new file mode 100644 index 00000000000..1f2eaefafab --- /dev/null +++ b/make/data/symbols/java.sql.rowset-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.sql.rowset +header exports javax/sql/rowset,javax/sql/rowset/serial,javax/sql/rowset/spi requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;20,name\u0020;java.naming\u0020;flags\u0020;20,name\u0020;java.sql\u0020;flags\u0020;20 uses javax/sql/rowset/RowSetFactory target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.transaction-A.sym.txt b/make/data/symbols/java.transaction-A.sym.txt new file mode 100644 index 00000000000..eb5cfa6337c --- /dev/null +++ b/make/data/symbols/java.transaction-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.transaction +header exports javax/transaction requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.rmi\u0020;flags\u0020;20 target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/java.xml-A.sym.txt b/make/data/symbols/java.xml-A.sym.txt new file mode 100644 index 00000000000..2f37f86e9a7 --- /dev/null +++ b/make/data/symbols/java.xml-A.sym.txt @@ -0,0 +1,57 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.xml +header exports javax/xml,javax/xml/catalog,javax/xml/datatype,javax/xml/namespace,javax/xml/parsers,javax/xml/stream,javax/xml/stream/events,javax/xml/stream/util,javax/xml/transform,javax/xml/transform/dom,javax/xml/transform/sax,javax/xml/transform/stax,javax/xml/transform/stream,javax/xml/validation,javax/xml/xpath,org/w3c/dom,org/w3c/dom/bootstrap,org/w3c/dom/events,org/w3c/dom/ls,org/w3c/dom/ranges,org/w3c/dom/traversal,org/w3c/dom/views,org/xml/sax,org/xml/sax/ext,org/xml/sax/helpers requires name\u0020;java.base\u0020;flags\u0020;8000 uses javax/xml/datatype/DatatypeFactory,javax/xml/parsers/DocumentBuilderFactory,javax/xml/parsers/SAXParserFactory,javax/xml/stream/XMLEventFactory,javax/xml/stream/XMLInputFactory,javax/xml/stream/XMLOutputFactory,javax/xml/transform/TransformerFactory,javax/xml/validation/SchemaFactory,javax/xml/xpath/XPathFactory,org/xml/sax/XMLReader target linux-amd64 flags 8000 + +class name javax/xml/namespace/NamespaceContext +-method name getPrefixes descriptor (Ljava/lang/String;)Ljava/util/Iterator; +method name getPrefixes descriptor (Ljava/lang/String;)Ljava/util/Iterator; flags 401 signature (Ljava/lang/String;)Ljava/util/Iterator; + +class name javax/xml/stream/XMLInputFactory +method name newFactory descriptor ()Ljavax/xml/stream/XMLInputFactory; thrownTypes javax/xml/stream/FactoryConfigurationError flags 9 +-method name newFactory descriptor ()Ljavax/xml/stream/XMLInputFactory; + +class name javax/xml/xpath/XPathFunction +-method name evaluate descriptor (Ljava/util/List;)Ljava/lang/Object; +method name evaluate descriptor (Ljava/util/List;)Ljava/lang/Object; thrownTypes javax/xml/xpath/XPathFunctionException flags 401 signature (Ljava/util/List<*>;)Ljava/lang/Object; + +class name org/xml/sax/HandlerBase +header extends java/lang/Object implements org/xml/sax/EntityResolver,org/xml/sax/DTDHandler,org/xml/sax/DocumentHandler,org/xml/sax/ErrorHandler flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/helpers/AttributeListImpl +header extends java/lang/Object implements org/xml/sax/AttributeList flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/helpers/NamespaceSupport +-method name getPrefixes descriptor ()Ljava/util/Enumeration; +-method name getPrefixes descriptor (Ljava/lang/String;)Ljava/util/Enumeration; +-method name getDeclaredPrefixes descriptor ()Ljava/util/Enumeration; +method name getPrefixes descriptor ()Ljava/util/Enumeration; flags 1 signature ()Ljava/util/Enumeration; +method name getPrefixes descriptor (Ljava/lang/String;)Ljava/util/Enumeration; flags 1 signature (Ljava/lang/String;)Ljava/util/Enumeration; +method name getDeclaredPrefixes descriptor ()Ljava/util/Enumeration; flags 1 signature ()Ljava/util/Enumeration; + diff --git a/make/data/symbols/java.xml.bind-A.sym.txt b/make/data/symbols/java.xml.bind-A.sym.txt new file mode 100644 index 00000000000..4c63a0f0988 --- /dev/null +++ b/make/data/symbols/java.xml.bind-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.xml.bind +header exports javax/xml/bind,javax/xml/bind/annotation,javax/xml/bind/annotation/adapters,javax/xml/bind/attachment,javax/xml/bind/helpers,javax/xml/bind/util requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.compiler\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;0,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;jdk.unsupported\u0020;flags\u0020;0,name\u0020;java.activation\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20 uses javax/xml/bind/JAXBContextFactory target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/java.xml.crypto-A.sym.txt b/make/data/symbols/java.xml.crypto-A.sym.txt new file mode 100644 index 00000000000..c72735a2545 --- /dev/null +++ b/make/data/symbols/java.xml.crypto-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.xml.crypto +header exports javax/xml/crypto,javax/xml/crypto/dom,javax/xml/crypto/dsig,javax/xml/crypto/dsig/dom,javax/xml/crypto/dsig/keyinfo,javax/xml/crypto/dsig/spec requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;java.xml\u0020;flags\u0020;20 provides interface\u0020;java/security/Provider\u0020;impls\u0020;org/jcp/xml/dsig/internal/dom/XMLDSigRI target linux-amd64 flags 8000 + diff --git a/make/data/symbols/java.xml.ws-A.sym.txt b/make/data/symbols/java.xml.ws-A.sym.txt new file mode 100644 index 00000000000..3aa58588dbb --- /dev/null +++ b/make/data/symbols/java.xml.ws-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.xml.ws +header exports javax/jws,javax/jws/soap,javax/xml/soap,javax/xml/ws,javax/xml/ws/handler,javax/xml/ws/handler/soap,javax/xml/ws/http,javax/xml/ws/soap,javax/xml/ws/spi,javax/xml/ws/spi/http,javax/xml/ws/wsaddressing requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.desktop\u0020;flags\u0020;0,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;java.management\u0020;flags\u0020;0,name\u0020;java.xml.ws.annotation\u0020;flags\u0020;0,name\u0020;jdk.httpserver\u0020;flags\u0020;0,name\u0020;jdk.unsupported\u0020;flags\u0020;0,name\u0020;java.activation\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20,name\u0020;java.xml.bind\u0020;flags\u0020;20 uses javax/xml/ws/spi/Provider,javax/xml/soap/MessageFactory,javax/xml/soap/SAAJMetaFactory,javax/xml/soap/SOAPConnectionFactory,javax/xml/soap/SOAPFactory target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/java.xml.ws.annotation-A.sym.txt b/make/data/symbols/java.xml.ws.annotation-A.sym.txt new file mode 100644 index 00000000000..ecd8247822b --- /dev/null +++ b/make/data/symbols/java.xml.ws.annotation-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.xml.ws.annotation +header exports javax/annotation requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff --git a/make/data/symbols/jdk.accessibility-A.sym.txt b/make/data/symbols/jdk.accessibility-A.sym.txt new file mode 100644 index 00000000000..4cc17606819 --- /dev/null +++ b/make/data/symbols/jdk.accessibility-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.accessibility +header exports com/sun/java/accessibility/util requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.desktop\u0020;flags\u0020;20 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.attach-A.sym.txt b/make/data/symbols/jdk.attach-A.sym.txt new file mode 100644 index 00000000000..a05c4a71095 --- /dev/null +++ b/make/data/symbols/jdk.attach-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.attach +header exports com/sun/tools/attach,com/sun/tools/attach/spi requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.jvmstat\u0020;flags\u0020;0 uses com/sun/tools/attach/spi/AttachProvider provides interface\u0020;com/sun/tools/attach/spi/AttachProvider\u0020;impls\u0020;sun/tools/attach/AttachProviderImpl target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.charsets-A.sym.txt b/make/data/symbols/jdk.charsets-A.sym.txt new file mode 100644 index 00000000000..4c5ddb1bc1e --- /dev/null +++ b/make/data/symbols/jdk.charsets-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.charsets +header requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;java/nio/charset/spi/CharsetProvider\u0020;impls\u0020;sun/nio/cs/ext/ExtendedCharsets target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.compiler-A.sym.txt b/make/data/symbols/jdk.compiler-A.sym.txt new file mode 100644 index 00000000000..718fbc2384e --- /dev/null +++ b/make/data/symbols/jdk.compiler-A.sym.txt @@ -0,0 +1,72 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.compiler +header exports com/sun/source/doctree,com/sun/source/tree,com/sun/source/util,com/sun/tools/javac requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.compiler\u0020;flags\u0020;20 uses javax/annotation/processing/Processor,com/sun/source/util/Plugin,com/sun/tools/javac/platform/PlatformProvider provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;com/sun/tools/javac/main/JavacToolProvider,interface\u0020;com/sun/tools/javac/platform/PlatformProvider\u0020;impls\u0020;com/sun/tools/javac/platform/JDKPlatformProvider,interface\u0020;javax/tools/JavaCompiler\u0020;impls\u0020;com/sun/tools/javac/api/JavacTool,interface\u0020;javax/tools/Tool\u0020;impls\u0020;com/sun/tools/javac/api/JavacTool target linux-amd64 flags 8000 + +class name com/sun/source/doctree/DocCommentTree +method name getPreamble descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>; +method name getPostamble descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>; + +class name com/sun/source/doctree/DocTree$Kind +field name DOC_TYPE descriptor Lcom/sun/source/doctree/DocTree$Kind; flags 4019 +field name SUMMARY descriptor Lcom/sun/source/doctree/DocTree$Kind; flags 4019 + +class name com/sun/source/doctree/DocTreeVisitor +-method name visitHidden descriptor (Lcom/sun/source/doctree/HiddenTree;Ljava/lang/Object;)Ljava/lang/Object; +-method name visitIndex descriptor (Lcom/sun/source/doctree/IndexTree;Ljava/lang/Object;)Ljava/lang/Object; +-method name visitProvides descriptor (Lcom/sun/source/doctree/ProvidesTree;Ljava/lang/Object;)Ljava/lang/Object; +-method name visitUses descriptor (Lcom/sun/source/doctree/UsesTree;Ljava/lang/Object;)Ljava/lang/Object; +method name visitDocType descriptor (Lcom/sun/source/doctree/DocTypeTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/DocTypeTree;TP;)TR; +method name visitHidden descriptor (Lcom/sun/source/doctree/HiddenTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/HiddenTree;TP;)TR; +method name visitIndex descriptor (Lcom/sun/source/doctree/IndexTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/IndexTree;TP;)TR; +method name visitProvides descriptor (Lcom/sun/source/doctree/ProvidesTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/ProvidesTree;TP;)TR; +method name visitSummary descriptor (Lcom/sun/source/doctree/SummaryTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/SummaryTree;TP;)TR; +method name visitUses descriptor (Lcom/sun/source/doctree/UsesTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/UsesTree;TP;)TR; + +class name com/sun/source/doctree/DocTypeTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 +method name getText descriptor ()Ljava/lang/String; flags 401 + +class name com/sun/source/doctree/SummaryTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 +method name getSummary descriptor ()Ljava/util/List; flags 401 signature ()Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>; + +class name com/sun/source/util/DocTreeFactory +method name newDocCommentTree descriptor (Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;)Lcom/sun/source/doctree/DocCommentTree; flags 401 signature (Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>;Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>;Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>;Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>;)Lcom/sun/source/doctree/DocCommentTree; +method name newDocTypeTree descriptor (Ljava/lang/String;)Lcom/sun/source/doctree/DocTypeTree; flags 401 +method name newSummaryTree descriptor (Ljava/util/List;)Lcom/sun/source/doctree/SummaryTree; flags 1 signature (Ljava/util/List<+Lcom/sun/source/doctree/DocTree;>;)Lcom/sun/source/doctree/SummaryTree; + +class name com/sun/source/util/DocTreeScanner +method name visitDocType descriptor (Lcom/sun/source/doctree/DocTypeTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/DocTypeTree;TP;)TR; +method name visitSummary descriptor (Lcom/sun/source/doctree/SummaryTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/SummaryTree;TP;)TR; + +class name com/sun/source/util/SimpleDocTreeVisitor +method name visitDocType descriptor (Lcom/sun/source/doctree/DocTypeTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/DocTypeTree;TP;)TR; +method name visitSummary descriptor (Lcom/sun/source/doctree/SummaryTree;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Lcom/sun/source/doctree/SummaryTree;TP;)TR; + diff --git a/make/data/symbols/jdk.crypto.cryptoki-A.sym.txt b/make/data/symbols/jdk.crypto.cryptoki-A.sym.txt new file mode 100644 index 00000000000..c0f4206d660 --- /dev/null +++ b/make/data/symbols/jdk.crypto.cryptoki-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.crypto.cryptoki +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.crypto.ec\u0020;flags\u0020;0 provides interface\u0020;java/security/Provider\u0020;impls\u0020;sun/security/pkcs11/SunPKCS11 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.crypto.ec-A.sym.txt b/make/data/symbols/jdk.crypto.ec-A.sym.txt new file mode 100644 index 00000000000..2cc8a1b3219 --- /dev/null +++ b/make/data/symbols/jdk.crypto.ec-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.crypto.ec +header requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;java/security/Provider\u0020;impls\u0020;sun/security/ec/SunEC target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.dynalink-A.sym.txt b/make/data/symbols/jdk.dynalink-A.sym.txt new file mode 100644 index 00000000000..4c00e6c3b38 --- /dev/null +++ b/make/data/symbols/jdk.dynalink-A.sym.txt @@ -0,0 +1,34 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.dynalink +header exports jdk/dynalink,jdk/dynalink/beans,jdk/dynalink/linker,jdk/dynalink/linker/support,jdk/dynalink/support requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0 uses jdk/dynalink/linker/GuardingDynamicLinkerExporter target linux-amd64 flags 8000 + +class name jdk/dynalink/StandardOperation +field name REMOVE descriptor Ljdk/dynalink/StandardOperation; flags 4019 + diff --git a/make/data/symbols/jdk.editpad-A.sym.txt b/make/data/symbols/jdk.editpad-A.sym.txt new file mode 100644 index 00000000000..ebad01694f4 --- /dev/null +++ b/make/data/symbols/jdk.editpad-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.editpad +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.desktop\u0020;flags\u0020;0,name\u0020;jdk.internal.ed\u0020;flags\u0020;0 provides interface\u0020;jdk/internal/editor/spi/BuildInEditorProvider\u0020;impls\u0020;jdk/editpad/EditPadProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.hotspot.agent-A.sym.txt b/make/data/symbols/jdk.hotspot.agent-A.sym.txt new file mode 100644 index 00000000000..6831c83bad0 --- /dev/null +++ b/make/data/symbols/jdk.hotspot.agent-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.hotspot.agent +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.datatransfer\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;0,name\u0020;java.rmi\u0020;flags\u0020;0,name\u0020;java.scripting\u0020;flags\u0020;0 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.httpserver-A.sym.txt b/make/data/symbols/jdk.httpserver-A.sym.txt new file mode 100644 index 00000000000..e4c90d63b03 --- /dev/null +++ b/make/data/symbols/jdk.httpserver-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.httpserver +header exports com/sun/net/httpserver,com/sun/net/httpserver/spi requires name\u0020;java.base\u0020;flags\u0020;8000 uses com/sun/net/httpserver/spi/HttpServerProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.incubator.httpclient-A.sym.txt b/make/data/symbols/jdk.incubator.httpclient-A.sym.txt new file mode 100644 index 00000000000..40c2b23e6fa --- /dev/null +++ b/make/data/symbols/jdk.incubator.httpclient-A.sym.txt @@ -0,0 +1,187 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.incubator.httpclient +header exports jdk/incubator/http requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 resolution 9 flags 8000 + +class name jdk/incubator/http/HttpClient +header extends java/lang/Object flags 421 +innerclass innerClass jdk/incubator/http/HttpClient$Redirect outerClass jdk/incubator/http/HttpClient innerClassName Redirect flags 4019 +innerclass innerClass jdk/incubator/http/HttpClient$Version outerClass jdk/incubator/http/HttpClient innerClassName Version flags 4019 +innerclass innerClass jdk/incubator/http/HttpClient$Builder outerClass jdk/incubator/http/HttpClient innerClassName Builder flags 409 +innerclass innerClass jdk/incubator/http/HttpResponse$BodyHandler outerClass jdk/incubator/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass jdk/incubator/http/HttpResponse$MultiSubscriber outerClass jdk/incubator/http/HttpResponse innerClassName MultiSubscriber flags 609 +innerclass innerClass jdk/incubator/http/WebSocket$Builder outerClass jdk/incubator/http/WebSocket innerClassName Builder flags 609 +-method name cookieManager descriptor ()Ljava/util/Optional; +-method name sslParameters descriptor ()Ljava/util/Optional; +-method name executor descriptor ()Ljava/util/concurrent/Executor; +-method name sendAsync descriptor (Ljdk/incubator/http/HttpRequest;Ljdk/incubator/http/HttpResponse$MultiProcessor;)Ljava/util/concurrent/CompletableFuture; +-method name newWebSocketBuilder descriptor (Ljava/net/URI;Ljdk/incubator/http/WebSocket$Listener;)Ljdk/incubator/http/WebSocket$Builder; +method name cookieHandler descriptor ()Ljava/util/Optional; flags 401 signature ()Ljava/util/Optional; +method name sslParameters descriptor ()Ljavax/net/ssl/SSLParameters; flags 401 +method name executor descriptor ()Ljava/util/Optional; flags 401 signature ()Ljava/util/Optional; +method name sendAsync descriptor (Ljdk/incubator/http/HttpRequest;Ljdk/incubator/http/HttpResponse$MultiSubscriber;)Ljava/util/concurrent/CompletableFuture; flags 401 signature (Ljdk/incubator/http/HttpRequest;Ljdk/incubator/http/HttpResponse$MultiSubscriber;)Ljava/util/concurrent/CompletableFuture; +method name newWebSocketBuilder descriptor ()Ljdk/incubator/http/WebSocket$Builder; flags 1 + +class name jdk/incubator/http/HttpClient$Builder +field name NO_PROXY descriptor Ljava/net/ProxySelector; flags 19 +-method name cookieManager descriptor (Ljava/net/CookieManager;)Ljdk/incubator/http/HttpClient$Builder; +method name cookieHandler descriptor (Ljava/net/CookieHandler;)Ljdk/incubator/http/HttpClient$Builder; flags 401 + +class name jdk/incubator/http/HttpHeaders +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name firstValue descriptor (Ljava/lang/String;)Ljava/util/Optional; +-method name firstValueAsLong descriptor (Ljava/lang/String;)Ljava/util/OptionalLong; +-method name allValues descriptor (Ljava/lang/String;)Ljava/util/List; +method name descriptor ()V flags 4 +method name firstValue descriptor (Ljava/lang/String;)Ljava/util/Optional; flags 1 signature (Ljava/lang/String;)Ljava/util/Optional; +method name firstValueAsLong descriptor (Ljava/lang/String;)Ljava/util/OptionalLong; flags 1 +method name allValues descriptor (Ljava/lang/String;)Ljava/util/List; flags 1 signature (Ljava/lang/String;)Ljava/util/List; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name hashCode descriptor ()I flags 11 +method name toString descriptor ()Ljava/lang/String; flags 1 + +class name jdk/incubator/http/HttpRequest +header extends java/lang/Object flags 421 +innerclass innerClass jdk/incubator/http/HttpRequest$BodyPublisher outerClass jdk/incubator/http/HttpRequest innerClassName BodyPublisher flags 609 +innerclass innerClass jdk/incubator/http/HttpRequest$Builder outerClass jdk/incubator/http/HttpRequest innerClassName Builder flags 409 +innerclass innerClass jdk/incubator/http/HttpClient$Version outerClass jdk/incubator/http/HttpClient innerClassName Version flags 4019 +-method name bodyProcessor descriptor ()Ljava/util/Optional; +-method name duration descriptor ()Ljava/time/Duration; +-method name noBody descriptor ()Ljdk/incubator/http/HttpRequest$BodyProcessor; +method name bodyPublisher descriptor ()Ljava/util/Optional; flags 401 signature ()Ljava/util/Optional; +method name timeout descriptor ()Ljava/util/Optional; flags 401 signature ()Ljava/util/Optional; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name hashCode descriptor ()I flags 11 + +-class name jdk/incubator/http/HttpRequest$BodyProcessor + +class name jdk/incubator/http/HttpRequest$BodyPublisher +header extends java/lang/Object implements java/util/concurrent/Flow$Publisher flags 601 signature Ljava/lang/Object;Ljava/util/concurrent/Flow$Publisher; +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 +innerclass innerClass jdk/incubator/http/HttpRequest$BodyPublisher outerClass jdk/incubator/http/HttpRequest innerClassName BodyPublisher flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name fromPublisher descriptor (Ljava/util/concurrent/Flow$Publisher;)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 signature (Ljava/util/concurrent/Flow$Publisher<+Ljava/nio/ByteBuffer;>;)Ljdk/incubator/http/HttpRequest$BodyPublisher; +method name fromPublisher descriptor (Ljava/util/concurrent/Flow$Publisher;J)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 signature (Ljava/util/concurrent/Flow$Publisher<+Ljava/nio/ByteBuffer;>;J)Ljdk/incubator/http/HttpRequest$BodyPublisher; +method name fromString descriptor (Ljava/lang/String;)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 +method name fromString descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 +method name fromInputStream descriptor (Ljava/util/function/Supplier;)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 signature (Ljava/util/function/Supplier<+Ljava/io/InputStream;>;)Ljdk/incubator/http/HttpRequest$BodyPublisher; +method name fromByteArray descriptor ([B)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 +method name fromByteArray descriptor ([BII)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 +method name fromFile descriptor (Ljava/nio/file/Path;)Ljdk/incubator/http/HttpRequest$BodyPublisher; thrownTypes java/io/FileNotFoundException flags 9 +method name fromByteArrays descriptor (Ljava/lang/Iterable;)Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 signature (Ljava/lang/Iterable<[B>;)Ljdk/incubator/http/HttpRequest$BodyPublisher; +method name noBody descriptor ()Ljdk/incubator/http/HttpRequest$BodyPublisher; flags 9 +method name contentLength descriptor ()J flags 401 + +class name jdk/incubator/http/HttpRequest$Builder +header extends java/lang/Object flags 421 +innerclass innerClass jdk/incubator/http/HttpRequest$Builder outerClass jdk/incubator/http/HttpRequest innerClassName Builder flags 409 +innerclass innerClass jdk/incubator/http/HttpClient$Version outerClass jdk/incubator/http/HttpClient innerClassName Version flags 4019 +innerclass innerClass jdk/incubator/http/HttpRequest$BodyPublisher outerClass jdk/incubator/http/HttpRequest innerClassName BodyPublisher flags 609 +-method name POST descriptor (Ljdk/incubator/http/HttpRequest$BodyProcessor;)Ljdk/incubator/http/HttpRequest$Builder; +-method name PUT descriptor (Ljdk/incubator/http/HttpRequest$BodyProcessor;)Ljdk/incubator/http/HttpRequest$Builder; +-method name DELETE descriptor (Ljdk/incubator/http/HttpRequest$BodyProcessor;)Ljdk/incubator/http/HttpRequest$Builder; +-method name method descriptor (Ljava/lang/String;Ljdk/incubator/http/HttpRequest$BodyProcessor;)Ljdk/incubator/http/HttpRequest$Builder; +method name POST descriptor (Ljdk/incubator/http/HttpRequest$BodyPublisher;)Ljdk/incubator/http/HttpRequest$Builder; flags 401 +method name PUT descriptor (Ljdk/incubator/http/HttpRequest$BodyPublisher;)Ljdk/incubator/http/HttpRequest$Builder; flags 401 +method name DELETE descriptor (Ljdk/incubator/http/HttpRequest$BodyPublisher;)Ljdk/incubator/http/HttpRequest$Builder; flags 401 +method name method descriptor (Ljava/lang/String;Ljdk/incubator/http/HttpRequest$BodyPublisher;)Ljdk/incubator/http/HttpRequest$Builder; flags 401 + +class name jdk/incubator/http/HttpResponse +header extends java/lang/Object flags 421 signature Ljava/lang/Object; +innerclass innerClass jdk/incubator/http/HttpResponse$MultiSubscriber outerClass jdk/incubator/http/HttpResponse innerClassName MultiSubscriber flags 609 +innerclass innerClass jdk/incubator/http/HttpResponse$BodySubscriber outerClass jdk/incubator/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass jdk/incubator/http/HttpResponse$BodyHandler outerClass jdk/incubator/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass jdk/incubator/http/HttpClient$Version outerClass jdk/incubator/http/HttpClient innerClassName Version flags 4019 +-method name finalRequest descriptor ()Ljdk/incubator/http/HttpRequest; +-method name trailers descriptor ()Ljava/util/concurrent/CompletableFuture; +method name previousResponse descriptor ()Ljava/util/Optional; flags 401 signature ()Ljava/util/Optional;>; + +class name jdk/incubator/http/HttpResponse$BodyHandler +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass jdk/incubator/http/HttpResponse$BodySubscriber outerClass jdk/incubator/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 +innerclass innerClass jdk/incubator/http/HttpResponse$BodyHandler outerClass jdk/incubator/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name apply descriptor (ILjdk/incubator/http/HttpHeaders;)Ljdk/incubator/http/HttpResponse$BodyProcessor; +method name apply descriptor (ILjdk/incubator/http/HttpHeaders;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 401 signature (ILjdk/incubator/http/HttpHeaders;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name fromSubscriber descriptor (Ljava/util/concurrent/Flow$Subscriber;)Ljdk/incubator/http/HttpResponse$BodyHandler; flags 9 signature (Ljava/util/concurrent/Flow$Subscriber<-Ljava/util/List;>;)Ljdk/incubator/http/HttpResponse$BodyHandler; +method name fromSubscriber descriptor (Ljava/util/concurrent/Flow$Subscriber;Ljava/util/function/Function;)Ljdk/incubator/http/HttpResponse$BodyHandler; flags 9 signature ;>;T:Ljava/lang/Object;>(TS;Ljava/util/function/Function;)Ljdk/incubator/http/HttpResponse$BodyHandler; +method name asInputStream descriptor ()Ljdk/incubator/http/HttpResponse$BodyHandler; flags 9 signature ()Ljdk/incubator/http/HttpResponse$BodyHandler; +method name buffering descriptor (Ljdk/incubator/http/HttpResponse$BodyHandler;I)Ljdk/incubator/http/HttpResponse$BodyHandler; flags 9 signature (Ljdk/incubator/http/HttpResponse$BodyHandler;I)Ljdk/incubator/http/HttpResponse$BodyHandler; + +-class name jdk/incubator/http/HttpResponse$BodyProcessor + +class name jdk/incubator/http/HttpResponse$BodySubscriber +header extends java/lang/Object implements java/util/concurrent/Flow$Subscriber flags 601 signature Ljava/lang/Object;Ljava/util/concurrent/Flow$Subscriber;>; +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 +innerclass innerClass jdk/incubator/http/HttpResponse$BodySubscriber outerClass jdk/incubator/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name getBody descriptor ()Ljava/util/concurrent/CompletionStage; flags 401 signature ()Ljava/util/concurrent/CompletionStage; +method name fromSubscriber descriptor (Ljava/util/concurrent/Flow$Subscriber;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature ;>;>(TS;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name fromSubscriber descriptor (Ljava/util/concurrent/Flow$Subscriber;Ljava/util/function/Function;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature ;>;T:Ljava/lang/Object;>(TS;Ljava/util/function/Function;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name asString descriptor (Ljava/nio/charset/Charset;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature (Ljava/nio/charset/Charset;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name asByteArray descriptor ()Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature ()Ljdk/incubator/http/HttpResponse$BodySubscriber<[B>; +method name asFile descriptor (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 89 signature (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name asFile descriptor (Ljava/nio/file/Path;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature (Ljava/nio/file/Path;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name asByteArrayConsumer descriptor (Ljava/util/function/Consumer;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature (Ljava/util/function/Consumer;>;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name asInputStream descriptor ()Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature ()Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name discard descriptor (Ljava/lang/Object;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature (TU;)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name buffering descriptor (Ljdk/incubator/http/HttpResponse$BodySubscriber;I)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 9 signature (Ljdk/incubator/http/HttpResponse$BodySubscriber;I)Ljdk/incubator/http/HttpResponse$BodySubscriber; +method name access$000 descriptor (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljdk/incubator/http/HttpResponse$BodySubscriber; flags 1009 + +-class name jdk/incubator/http/HttpResponse$MultiProcessor + +class name jdk/incubator/http/HttpResponse$MultiSubscriber +header extends java/lang/Object flags 601 signature Ljava/lang/Object; +innerclass innerClass jdk/incubator/http/HttpResponse$BodyHandler outerClass jdk/incubator/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass jdk/incubator/http/HttpResponse$MultiSubscriber outerClass jdk/incubator/http/HttpResponse innerClassName MultiSubscriber flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name onRequest descriptor (Ljdk/incubator/http/HttpRequest;)Ljdk/incubator/http/HttpResponse$BodyHandler; flags 401 signature (Ljdk/incubator/http/HttpRequest;)Ljdk/incubator/http/HttpResponse$BodyHandler; +method name onPushPromise descriptor (Ljdk/incubator/http/HttpRequest;)Ljava/util/Optional; flags 401 signature (Ljdk/incubator/http/HttpRequest;)Ljava/util/Optional;>; +method name onResponse descriptor (Ljdk/incubator/http/HttpResponse;)V flags 401 signature (Ljdk/incubator/http/HttpResponse;)V +method name onError descriptor (Ljdk/incubator/http/HttpRequest;Ljava/lang/Throwable;)V flags 401 +method name completion descriptor (Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;)Ljava/util/concurrent/CompletableFuture; flags 401 signature (Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;)Ljava/util/concurrent/CompletableFuture; +method name asMap descriptor (Ljava/util/function/Function;Z)Ljdk/incubator/http/HttpResponse$MultiSubscriber; flags 9 signature (Ljava/util/function/Function;>;>;Z)Ljdk/incubator/http/HttpResponse$MultiSubscriber;TV;>; +method name asMap descriptor (Ljava/util/function/Function;)Ljdk/incubator/http/HttpResponse$MultiSubscriber; flags 9 signature (Ljava/util/function/Function;>;>;)Ljdk/incubator/http/HttpResponse$MultiSubscriber;TV;>; + +class name jdk/incubator/http/WebSocket +-method name isClosed descriptor ()Z +-method name abort descriptor ()V +method name isOutputClosed descriptor ()Z flags 401 +method name isInputClosed descriptor ()Z flags 401 +method name abort descriptor ()V flags 401 + +class name jdk/incubator/http/WebSocket$Builder +header extends java/lang/Object flags 601 +innerclass innerClass jdk/incubator/http/WebSocket$Builder outerClass jdk/incubator/http/WebSocket innerClassName Builder flags 609 +innerclass innerClass jdk/incubator/http/WebSocket$Listener outerClass jdk/incubator/http/WebSocket innerClassName Listener flags 609 +-method name buildAsync descriptor ()Ljava/util/concurrent/CompletableFuture; +method name buildAsync descriptor (Ljava/net/URI;Ljdk/incubator/http/WebSocket$Listener;)Ljava/util/concurrent/CompletableFuture; flags 401 signature (Ljava/net/URI;Ljdk/incubator/http/WebSocket$Listener;)Ljava/util/concurrent/CompletableFuture; + diff --git a/make/data/symbols/jdk.jartool-A.sym.txt b/make/data/symbols/jdk.jartool-A.sym.txt new file mode 100644 index 00000000000..0356ab54305 --- /dev/null +++ b/make/data/symbols/jdk.jartool-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jartool +header exports com/sun/jarsigner,jdk/security/jarsigner requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;sun/tools/jar/JarToolProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.javadoc-A.sym.txt b/make/data/symbols/jdk.javadoc-A.sym.txt new file mode 100644 index 00000000000..c8b12e6eadd --- /dev/null +++ b/make/data/symbols/jdk.javadoc-A.sym.txt @@ -0,0 +1,35 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.javadoc +header exports com/sun/javadoc,com/sun/tools/javadoc,jdk/javadoc/doclet requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.xml\u0020;flags\u0020;0,name\u0020;java.compiler\u0020;flags\u0020;20,name\u0020;jdk.compiler\u0020;flags\u0020;20 provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/javadoc/internal/tool/JavadocToolProvider,interface\u0020;javax/tools/DocumentationTool\u0020;impls\u0020;jdk/javadoc/internal/api/JavadocTool,interface\u0020;javax/tools/Tool\u0020;impls\u0020;jdk/javadoc/internal/api/JavadocTool target linux-amd64 flags 8000 + +-class name com/sun/tools/doclets/Taglet + +-class name com/sun/tools/doclets/standard/Standard + diff --git a/make/data/symbols/jdk.jcmd-A.sym.txt b/make/data/symbols/jdk.jcmd-A.sym.txt new file mode 100644 index 00000000000..12e06f241b8 --- /dev/null +++ b/make/data/symbols/jdk.jcmd-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jcmd +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.attach\u0020;flags\u0020;0,name\u0020;jdk.internal.jvmstat\u0020;flags\u0020;0 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jconsole-A.sym.txt b/make/data/symbols/jdk.jconsole-A.sym.txt new file mode 100644 index 00000000000..bb10c002082 --- /dev/null +++ b/make/data/symbols/jdk.jconsole-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jconsole +header exports com/sun/tools/jconsole requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.management.rmi\u0020;flags\u0020;0,name\u0020;java.rmi\u0020;flags\u0020;0,name\u0020;jdk.attach\u0020;flags\u0020;0,name\u0020;jdk.internal.jvmstat\u0020;flags\u0020;0,name\u0020;jdk.management\u0020;flags\u0020;0,name\u0020;jdk.management.agent\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;20,name\u0020;java.management\u0020;flags\u0020;20 uses com/sun/tools/jconsole/JConsolePlugin target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jdeps-A.sym.txt b/make/data/symbols/jdk.jdeps-A.sym.txt new file mode 100644 index 00000000000..56ecbd4036c --- /dev/null +++ b/make/data/symbols/jdk.jdeps-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jdeps +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.compiler\u0020;flags\u0020;0,name\u0020;jdk.compiler\u0020;flags\u0020;0 provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;com/sun/tools/javap/Main$JavapToolProvider\u005C;u002C;com/sun/tools/jdeps/Main$JDepsToolProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jdi-A.sym.txt b/make/data/symbols/jdk.jdi-A.sym.txt new file mode 100644 index 00000000000..086b27d5ce2 --- /dev/null +++ b/make/data/symbols/jdk.jdi-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jdi +header exports com/sun/jdi,com/sun/jdi/connect,com/sun/jdi/connect/spi,com/sun/jdi/event,com/sun/jdi/request requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.attach\u0020;flags\u0020;0,name\u0020;jdk.jdwp.agent\u0020;flags\u0020;0 uses com/sun/jdi/connect/Connector,com/sun/jdi/connect/spi/TransportService provides interface\u0020;com/sun/jdi/connect/Connector\u0020;impls\u0020;com/sun/tools/jdi/ProcessAttachingConnector\u005C;u002C;com/sun/tools/jdi/RawCommandLineLauncher\u005C;u002C;com/sun/tools/jdi/SocketAttachingConnector\u005C;u002C;com/sun/tools/jdi/SocketListeningConnector\u005C;u002C;com/sun/tools/jdi/SunCommandLineLauncher target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jdwp.agent-A.sym.txt b/make/data/symbols/jdk.jdwp.agent-A.sym.txt new file mode 100644 index 00000000000..1cffb4867f0 --- /dev/null +++ b/make/data/symbols/jdk.jdwp.agent-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jdwp.agent +header requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jlink-A.sym.txt b/make/data/symbols/jdk.jlink-A.sym.txt new file mode 100644 index 00000000000..c97a1c17ff6 --- /dev/null +++ b/make/data/symbols/jdk.jlink-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jlink +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;jdk.jdeps\u0020;flags\u0020;0 uses jdk/tools/jlink/plugin/Plugin provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/tools/jmod/Main$JmodToolProvider\u005C;u002C;jdk/tools/jlink/internal/Main$JlinkToolProvider,interface\u0020;jdk/tools/jlink/plugin/Plugin\u0020;impls\u0020;jdk/tools/jlink/internal/plugins/StripDebugPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludePlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeJmodSectionPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/SystemModulesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/OrderResourcesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/DefaultCompressPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeVMPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ClassForNamePlugin target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jshell-A.sym.txt b/make/data/symbols/jdk.jshell-A.sym.txt new file mode 100644 index 00000000000..21524d824ea --- /dev/null +++ b/make/data/symbols/jdk.jshell-A.sym.txt @@ -0,0 +1,37 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jshell +header exports jdk/jshell,jdk/jshell/execution,jdk/jshell/spi,jdk/jshell/tool requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;jdk.compiler\u0020;flags\u0020;0,name\u0020;jdk.internal.ed\u0020;flags\u0020;0,name\u0020;jdk.internal.le\u0020;flags\u0020;0,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;java.compiler\u0020;flags\u0020;20,name\u0020;java.prefs\u0020;flags\u0020;20,name\u0020;jdk.jdi\u0020;flags\u0020;20 uses jdk/jshell/spi/ExecutionControlProvider,jdk/internal/editor/spi/BuildInEditorProvider provides interface\u0020;javax/tools/Tool\u0020;impls\u0020;jdk/internal/jshell/tool/JShellToolProvider,interface\u0020;jdk/jshell/spi/ExecutionControlProvider\u0020;impls\u0020;jdk/jshell/execution/JdiExecutionControlProvider\u005C;u002C;jdk/jshell/execution/LocalExecutionControlProvider\u005C;u002C;jdk/jshell/execution/FailOverExecutionControlProvider target linux-amd64 flags 8000 + +class name jdk/jshell/SourceCodeAnalysis +method name sourceToSnippets descriptor (Ljava/lang/String;)Ljava/util/List; flags 401 signature (Ljava/lang/String;)Ljava/util/List; + +class name jdk/jshell/tool/JavaShellToolBuilder +method name start descriptor ([Ljava/lang/String;)I thrownTypes java/lang/Exception flags 81 + diff --git a/make/data/symbols/jdk.jsobject-A.sym.txt b/make/data/symbols/jdk.jsobject-A.sym.txt new file mode 100644 index 00000000000..9148b865908 --- /dev/null +++ b/make/data/symbols/jdk.jsobject-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jsobject +header exports netscape/javascript requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.desktop\u0020;flags\u0020;0 uses jdk/internal/netscape/javascript/spi/JSObjectProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jstatd-A.sym.txt b/make/data/symbols/jdk.jstatd-A.sym.txt new file mode 100644 index 00000000000..bee957301b9 --- /dev/null +++ b/make/data/symbols/jdk.jstatd-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jstatd +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.rmi\u0020;flags\u0020;0,name\u0020;jdk.internal.jvmstat\u0020;flags\u0020;0 provides interface\u0020;sun/jvmstat/monitor/MonitoredHostService\u0020;impls\u0020;sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.localedata-A.sym.txt b/make/data/symbols/jdk.localedata-A.sym.txt new file mode 100644 index 00000000000..fc06e8ed64b --- /dev/null +++ b/make/data/symbols/jdk.localedata-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.localedata +header requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;sun/util/locale/provider/LocaleDataMetaInfo\u0020;impls\u0020;sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo\u005C;u002C;sun/util/resources/provider/NonBaseLocaleDataMetaInfo,interface\u0020;sun/util/resources/LocaleData$CommonResourceBundleProvider\u0020;impls\u0020;sun/util/resources/provider/LocaleDataProvider,interface\u0020;sun/util/resources/LocaleData$SupplementaryResourceBundleProvider\u0020;impls\u0020;sun/util/resources/provider/SupplementaryLocaleDataProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.management-A.sym.txt b/make/data/symbols/jdk.management-A.sym.txt new file mode 100644 index 00000000000..90ab3d4b962 --- /dev/null +++ b/make/data/symbols/jdk.management-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.management +header exports com/sun/management requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.management\u0020;flags\u0020;20 provides interface\u0020;sun/management/spi/PlatformMBeanProvider\u0020;impls\u0020;com/sun/management/internal/PlatformMBeanProviderImpl target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.management.agent-A.sym.txt b/make/data/symbols/jdk.management.agent-A.sym.txt new file mode 100644 index 00000000000..4e02f609f26 --- /dev/null +++ b/make/data/symbols/jdk.management.agent-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.management.agent +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.management\u0020;flags\u0020;0,name\u0020;java.management.rmi\u0020;flags\u0020;0 uses jdk/internal/agent/spi/AgentProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.naming.dns-A.sym.txt b/make/data/symbols/jdk.naming.dns-A.sym.txt new file mode 100644 index 00000000000..701d26e8dba --- /dev/null +++ b/make/data/symbols/jdk.naming.dns-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.naming.dns +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.naming\u0020;flags\u0020;0 provides interface\u0020;javax/naming/spi/InitialContextFactory\u0020;impls\u0020;com/sun/jndi/dns/DnsContextFactory target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.naming.rmi-A.sym.txt b/make/data/symbols/jdk.naming.rmi-A.sym.txt new file mode 100644 index 00000000000..b72ef1b5295 --- /dev/null +++ b/make/data/symbols/jdk.naming.rmi-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.naming.rmi +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.naming\u0020;flags\u0020;0,name\u0020;java.rmi\u0020;flags\u0020;0 provides interface\u0020;javax/naming/spi/InitialContextFactory\u0020;impls\u0020;com/sun/jndi/rmi/registry/RegistryContextFactory target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.net-A.sym.txt b/make/data/symbols/jdk.net-A.sym.txt new file mode 100644 index 00000000000..5227388a1fe --- /dev/null +++ b/make/data/symbols/jdk.net-A.sym.txt @@ -0,0 +1,34 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.net +header exports jdk/net requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 + +class name jdk/net/ExtendedSocketOptions +field name TCP_QUICKACK descriptor Ljava/net/SocketOption; flags 19 signature Ljava/net/SocketOption; + diff --git a/make/data/symbols/jdk.pack-A.sym.txt b/make/data/symbols/jdk.pack-A.sym.txt new file mode 100644 index 00000000000..593f50e78ab --- /dev/null +++ b/make/data/symbols/jdk.pack-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.pack +header requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.policytool-A.sym.txt b/make/data/symbols/jdk.policytool-A.sym.txt new file mode 100644 index 00000000000..af5e3549692 --- /dev/null +++ b/make/data/symbols/jdk.policytool-A.sym.txt @@ -0,0 +1,30 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +-module name jdk.policytool + diff --git a/make/data/symbols/jdk.rmic-A.sym.txt b/make/data/symbols/jdk.rmic-A.sym.txt new file mode 100644 index 00000000000..c66f19abbfa --- /dev/null +++ b/make/data/symbols/jdk.rmic-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.rmic +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.corba\u0020;flags\u0020;0,name\u0020;jdk.compiler\u0020;flags\u0020;0,name\u0020;jdk.javadoc\u0020;flags\u0020;0 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.scripting.nashorn-A.sym.txt b/make/data/symbols/jdk.scripting.nashorn-A.sym.txt new file mode 100644 index 00000000000..66afc4999cc --- /dev/null +++ b/make/data/symbols/jdk.scripting.nashorn-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.scripting.nashorn +header exports jdk/nashorn/api/scripting,jdk/nashorn/api/tree requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;jdk.dynalink\u0020;flags\u0020;0,name\u0020;java.scripting\u0020;flags\u0020;20 provides interface\u0020;javax/script/ScriptEngineFactory\u0020;impls\u0020;jdk/nashorn/api/scripting/NashornScriptEngineFactory,interface\u0020;jdk/dynalink/linker/GuardingDynamicLinkerExporter\u0020;impls\u0020;jdk/nashorn/api/linker/NashornLinkerExporter target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.sctp-A.sym.txt b/make/data/symbols/jdk.sctp-A.sym.txt new file mode 100644 index 00000000000..6aef6f45561 --- /dev/null +++ b/make/data/symbols/jdk.sctp-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.sctp +header exports com/sun/nio/sctp requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.security.auth-A.sym.txt b/make/data/symbols/jdk.security.auth-A.sym.txt new file mode 100644 index 00000000000..3b4add6bc63 --- /dev/null +++ b/make/data/symbols/jdk.security.auth-A.sym.txt @@ -0,0 +1,45 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.security.auth +header exports com/sun/security/auth,com/sun/security/auth/callback,com/sun/security/auth/login,com/sun/security/auth/module requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.security.jgss\u0020;flags\u0020;0,name\u0020;java.naming\u0020;flags\u0020;20 provides interface\u0020;javax/security/auth/spi/LoginModule\u0020;impls\u0020;com/sun/security/auth/module/Krb5LoginModule\u005C;u002C;com/sun/security/auth/module/UnixLoginModule\u005C;u002C;com/sun/security/auth/module/JndiLoginModule\u005C;u002C;com/sun/security/auth/module/KeyStoreLoginModule\u005C;u002C;com/sun/security/auth/module/LdapLoginModule\u005C;u002C;com/sun/security/auth/module/NTLoginModule target linux-amd64 flags 8000 + +-class name com/sun/security/auth/PolicyFile + +-class name com/sun/security/auth/SolarisNumericGroupPrincipal + +-class name com/sun/security/auth/SolarisNumericUserPrincipal + +-class name com/sun/security/auth/SolarisPrincipal + +-class name com/sun/security/auth/X500Principal + +-class name com/sun/security/auth/module/SolarisLoginModule + +-class name com/sun/security/auth/module/SolarisSystem + diff --git a/make/data/symbols/jdk.security.jgss-A.sym.txt b/make/data/symbols/jdk.security.jgss-A.sym.txt new file mode 100644 index 00000000000..6765899d41c --- /dev/null +++ b/make/data/symbols/jdk.security.jgss-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.security.jgss +header exports com/sun/security/jgss requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;java.security.sasl\u0020;flags\u0020;0,name\u0020;java.security.jgss\u0020;flags\u0020;20 provides interface\u0020;java/security/Provider\u0020;impls\u0020;com/sun/security/sasl/gsskerb/JdkSASL target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.unsupported-A.sym.txt b/make/data/symbols/jdk.unsupported-A.sym.txt new file mode 100644 index 00000000000..1119e81fabd --- /dev/null +++ b/make/data/symbols/jdk.unsupported-A.sym.txt @@ -0,0 +1,39 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.unsupported +header exports com/sun/nio/file,sun/misc,sun/reflect requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 flags 8000 + +class name com/sun/nio/file/ExtendedOpenOption +field name DIRECT descriptor Lcom/sun/nio/file/ExtendedOpenOption; flags 4019 + +class name sun/reflect/ReflectionFactory +header extends java/lang/Object flags 21 classAnnotations @Lsun/Proprietary+Annotation; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name newInstanceForSerialization descriptor (Ljava/lang/reflect/Constructor;[Ljava/security/ProtectionDomain;)Ljava/lang/Object; thrownTypes java/lang/InstantiationException,java/lang/reflect/InvocationTargetException,java/lang/IllegalAccessException flags 11 signature (Ljava/lang/reflect/Constructor<*>;[Ljava/security/ProtectionDomain;)Ljava/lang/Object; + diff --git a/make/data/symbols/jdk.xml.dom-A.sym.txt b/make/data/symbols/jdk.xml.dom-A.sym.txt new file mode 100644 index 00000000000..2342beace35 --- /dev/null +++ b/make/data/symbols/jdk.xml.dom-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.xml.dom +header exports org/w3c/dom/css,org/w3c/dom/html,org/w3c/dom/stylesheets,org/w3c/dom/xpath requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.xml\u0020;flags\u0020;20 target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.zipfs-A.sym.txt b/make/data/symbols/jdk.zipfs-A.sym.txt new file mode 100644 index 00000000000..56609610d44 --- /dev/null +++ b/make/data/symbols/jdk.zipfs-A.sym.txt @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.zipfs +header requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;java/nio/file/spi/FileSystemProvider\u0020;impls\u0020;jdk/nio/zipfs/ZipFileSystemProvider target linux-amd64 flags 8000 + diff --git a/make/data/symbols/symbols b/make/data/symbols/symbols index 21c1504c4f7..ca0a74f5217 100644 --- a/make/data/symbols/symbols +++ b/make/data/symbols/symbols @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 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 @@ -27,10 +27,11 @@ # ########################################################## # #command used to generate this file: -#build.tools.symbolgenerator.CreateSymbols build-description new-symbols symbols/include.list 8 JDK8.classes 7 JDK7.classes 8 6 JDK6u4.classes 7 9 JDK9.classes 8 +#build.tools.symbolgenerator.CreateSymbols build-description-incremental symbols include.list # -generate platforms 6:7:8:9 +generate platforms 6:7:8:9:A platform version 8 files java.activation-8.sym.txt:java.base-8.sym.txt:java.compiler-8.sym.txt:java.corba-8.sym.txt:java.datatransfer-8.sym.txt:java.desktop-8.sym.txt:java.instrument-8.sym.txt:java.logging-8.sym.txt:java.management-8.sym.txt:java.management.rmi-8.sym.txt:java.naming-8.sym.txt:java.prefs-8.sym.txt:java.rmi-8.sym.txt:java.scripting-8.sym.txt:java.security.jgss-8.sym.txt:java.security.sasl-8.sym.txt:java.sql-8.sym.txt:java.sql.rowset-8.sym.txt:java.transaction-8.sym.txt:java.xml-8.sym.txt:java.xml.bind-8.sym.txt:java.xml.crypto-8.sym.txt:java.xml.ws-8.sym.txt:java.xml.ws.annotation-8.sym.txt:jdk.httpserver-8.sym.txt:jdk.management-8.sym.txt:jdk.scripting.nashorn-8.sym.txt:jdk.sctp-8.sym.txt:jdk.security.auth-8.sym.txt:jdk.security.jgss-8.sym.txt platform version 7 base 8 files java.base-7.sym.txt:java.compiler-7.sym.txt:java.datatransfer-7.sym.txt:java.desktop-7.sym.txt:java.logging-7.sym.txt:java.management-7.sym.txt:java.naming-7.sym.txt:java.prefs-7.sym.txt:java.rmi-7.sym.txt:java.scripting-7.sym.txt:java.security.jgss-7.sym.txt:java.security.sasl-7.sym.txt:java.sql-7.sym.txt:java.sql.rowset-7.sym.txt:java.xml-7.sym.txt:java.xml.bind-7.sym.txt:java.xml.ws.annotation-7.sym.txt:jdk.httpserver-7.sym.txt:jdk.management-7.sym.txt:jdk.scripting.nashorn-7.sym.txt:jdk.sctp-7.sym.txt:jdk.security.auth-7.sym.txt:jdk.security.jgss-7.sym.txt platform version 6 base 7 files java.base-6.sym.txt:java.compiler-6.sym.txt:java.desktop-6.sym.txt:java.logging-6.sym.txt:java.management-6.sym.txt:java.rmi-6.sym.txt:java.security.jgss-6.sym.txt:java.sql-6.sym.txt:java.sql.rowset-6.sym.txt:java.xml-6.sym.txt:java.xml.bind-6.sym.txt:java.xml.ws-6.sym.txt:java.xml.ws.annotation-6.sym.txt:jdk.management-6.sym.txt:jdk.sctp-6.sym.txt:jdk.security.jgss-6.sym.txt platform version 9 base 8 files java.activation-9.sym.txt:java.base-9.sym.txt:java.compiler-9.sym.txt:java.corba-9.sym.txt:java.datatransfer-9.sym.txt:java.desktop-9.sym.txt:java.instrument-9.sym.txt:java.logging-9.sym.txt:java.management-9.sym.txt:java.management.rmi-9.sym.txt:java.naming-9.sym.txt:java.prefs-9.sym.txt:java.rmi-9.sym.txt:java.scripting-9.sym.txt:java.se-9.sym.txt:java.se.ee-9.sym.txt:java.security.jgss-9.sym.txt:java.security.sasl-9.sym.txt:java.smartcardio-9.sym.txt:java.sql-9.sym.txt:java.sql.rowset-9.sym.txt:java.transaction-9.sym.txt:java.xml-9.sym.txt:java.xml.bind-9.sym.txt:java.xml.crypto-9.sym.txt:java.xml.ws-9.sym.txt:java.xml.ws.annotation-9.sym.txt:jdk.accessibility-9.sym.txt:jdk.attach-9.sym.txt:jdk.charsets-9.sym.txt:jdk.compiler-9.sym.txt:jdk.crypto.cryptoki-9.sym.txt:jdk.crypto.ec-9.sym.txt:jdk.dynalink-9.sym.txt:jdk.editpad-9.sym.txt:jdk.hotspot.agent-9.sym.txt:jdk.httpserver-9.sym.txt:jdk.incubator.httpclient-9.sym.txt:jdk.jartool-9.sym.txt:jdk.javadoc-9.sym.txt:jdk.jcmd-9.sym.txt:jdk.jconsole-9.sym.txt:jdk.jdeps-9.sym.txt:jdk.jdi-9.sym.txt:jdk.jdwp.agent-9.sym.txt:jdk.jlink-9.sym.txt:jdk.jshell-9.sym.txt:jdk.jsobject-9.sym.txt:jdk.jstatd-9.sym.txt:jdk.localedata-9.sym.txt:jdk.management-9.sym.txt:jdk.management.agent-9.sym.txt:jdk.naming.dns-9.sym.txt:jdk.naming.rmi-9.sym.txt:jdk.net-9.sym.txt:jdk.pack-9.sym.txt:jdk.policytool-9.sym.txt:jdk.rmic-9.sym.txt:jdk.scripting.nashorn-9.sym.txt:jdk.sctp-9.sym.txt:jdk.security.auth-9.sym.txt:jdk.security.jgss-9.sym.txt:jdk.unsupported-9.sym.txt:jdk.xml.dom-9.sym.txt:jdk.zipfs-9.sym.txt +platform version A base 9 files java.activation-A.sym.txt:java.base-A.sym.txt:java.compiler-A.sym.txt:java.corba-A.sym.txt:java.datatransfer-A.sym.txt:java.desktop-A.sym.txt:java.instrument-A.sym.txt:java.logging-A.sym.txt:java.management-A.sym.txt:java.management.rmi-A.sym.txt:java.naming-A.sym.txt:java.prefs-A.sym.txt:java.rmi-A.sym.txt:java.scripting-A.sym.txt:java.se-A.sym.txt:java.se.ee-A.sym.txt:java.security.jgss-A.sym.txt:java.security.sasl-A.sym.txt:java.smartcardio-A.sym.txt:java.sql-A.sym.txt:java.sql.rowset-A.sym.txt:java.transaction-A.sym.txt:java.xml-A.sym.txt:java.xml.bind-A.sym.txt:java.xml.crypto-A.sym.txt:java.xml.ws-A.sym.txt:java.xml.ws.annotation-A.sym.txt:jdk.accessibility-A.sym.txt:jdk.attach-A.sym.txt:jdk.charsets-A.sym.txt:jdk.compiler-A.sym.txt:jdk.crypto.cryptoki-A.sym.txt:jdk.crypto.ec-A.sym.txt:jdk.dynalink-A.sym.txt:jdk.editpad-A.sym.txt:jdk.hotspot.agent-A.sym.txt:jdk.httpserver-A.sym.txt:jdk.incubator.httpclient-A.sym.txt:jdk.jartool-A.sym.txt:jdk.javadoc-A.sym.txt:jdk.jcmd-A.sym.txt:jdk.jconsole-A.sym.txt:jdk.jdeps-A.sym.txt:jdk.jdi-A.sym.txt:jdk.jdwp.agent-A.sym.txt:jdk.jlink-A.sym.txt:jdk.jshell-A.sym.txt:jdk.jsobject-A.sym.txt:jdk.jstatd-A.sym.txt:jdk.localedata-A.sym.txt:jdk.management-A.sym.txt:jdk.management.agent-A.sym.txt:jdk.naming.dns-A.sym.txt:jdk.naming.rmi-A.sym.txt:jdk.net-A.sym.txt:jdk.pack-A.sym.txt:jdk.policytool-A.sym.txt:jdk.rmic-A.sym.txt:jdk.scripting.nashorn-A.sym.txt:jdk.sctp-A.sym.txt:jdk.security.auth-A.sym.txt:jdk.security.jgss-A.sym.txt:jdk.unsupported-A.sym.txt:jdk.xml.dom-A.sym.txt:jdk.zipfs-A.sym.txt diff --git a/make/data/unicodedata/PropList.txt b/make/data/unicodedata/PropList.txt index 2eb2926e072..6df0b646fde 100644 --- a/make/data/unicodedata/PropList.txt +++ b/make/data/unicodedata/PropList.txt @@ -1,10 +1,11 @@ -# PropList-8.0.0.txt -# Date: 2015-05-16, 17:50:38 GMT [MD] +# PropList-10.0.0.txt +# Date: 2017-03-10, 08:25:30 GMT +# Copyright (c) 2017 Unicode, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see http://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2015 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# For documentation, see http://www.unicode.org/reports/tr44/ +# For documentation, see http://www.unicode.org/reports/tr44/ # ================================================ @@ -192,10 +193,17 @@ FF64 ; Terminal_Punctuation # Po HALFWIDTH IDEOGRAPHIC COMMA 111DE..111DF ; Terminal_Punctuation # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2 11238..1123C ; Terminal_Punctuation # Po [5] KHOJKI DANDA..KHOJKI DOUBLE SECTION MARK 112A9 ; Terminal_Punctuation # Po MULTANI SECTION MARK +1144B..1144D ; Terminal_Punctuation # Po [3] NEWA DANDA..NEWA COMMA +1145B ; Terminal_Punctuation # Po NEWA PLACEHOLDER MARK 115C2..115C5 ; Terminal_Punctuation # Po [4] SIDDHAM DANDA..SIDDHAM SEPARATOR BAR 115C9..115D7 ; Terminal_Punctuation # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES 11641..11642 ; Terminal_Punctuation # Po [2] MODI DANDA..MODI DOUBLE DANDA 1173C..1173E ; Terminal_Punctuation # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI +11A42..11A43 ; Terminal_Punctuation # Po [2] ZANABAZAR SQUARE MARK SHAD..ZANABAZAR SQUARE MARK DOUBLE SHAD +11A9B..11A9C ; Terminal_Punctuation # Po [2] SOYOMBO MARK SHAD..SOYOMBO MARK DOUBLE SHAD +11AA1..11AA2 ; Terminal_Punctuation # Po [2] SOYOMBO TERMINAL MARK-1..SOYOMBO TERMINAL MARK-2 +11C41..11C43 ; Terminal_Punctuation # Po [3] BHAIKSUKI DANDA..BHAIKSUKI WORD SEPARATOR +11C71 ; Terminal_Punctuation # Po MARCHEN MARK SHAD 12470..12474 ; Terminal_Punctuation # Po [5] CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER..CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON 16A6E..16A6F ; Terminal_Punctuation # Po [2] MRO DANDA..MRO DOUBLE DANDA 16AF5 ; Terminal_Punctuation # Po BASSA VAH FULL STOP @@ -204,7 +212,7 @@ FF64 ; Terminal_Punctuation # Po HALFWIDTH IDEOGRAPHIC COMMA 1BC9F ; Terminal_Punctuation # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP 1DA87..1DA8A ; Terminal_Punctuation # Po [4] SIGNWRITING COMMA..SIGNWRITING COLON -# Total code points: 238 +# Total code points: 252 # ================================================ @@ -429,6 +437,7 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L 081B..0823 ; Other_Alphabetic # Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A 0825..0827 ; Other_Alphabetic # Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U 0829..082C ; Other_Alphabetic # Mn [4] SAMARITAN VOWEL SIGN LONG I..SAMARITAN VOWEL SIGN SUKUN +08D4..08DF ; Other_Alphabetic # Mn [12] ARABIC SMALL HIGH WORD AR-RUB..ARABIC SMALL HIGH WORD WAQFA 08E3..08E9 ; Other_Alphabetic # Mn [7] ARABIC TURNED DAMMA BELOW..ARABIC CURLY KASRATAN 08F0..0902 ; Other_Alphabetic # Mn [19] ARABIC OPEN FATHATAN..DEVANAGARI SIGN ANUSVARA 0903 ; Other_Alphabetic # Mc DEVANAGARI SIGN VISARGA @@ -465,6 +474,7 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L 0AC9 ; Other_Alphabetic # Mc GUJARATI VOWEL SIGN CANDRA O 0ACB..0ACC ; Other_Alphabetic # Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU 0AE2..0AE3 ; Other_Alphabetic # Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL +0AFA..0AFC ; Other_Alphabetic # Mn [3] GUJARATI SIGN SUKUN..GUJARATI SIGN MADDAH 0B01 ; Other_Alphabetic # Mn ORIYA SIGN CANDRABINDU 0B02..0B03 ; Other_Alphabetic # Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA 0B3E ; Other_Alphabetic # Mc ORIYA VOWEL SIGN AA @@ -502,7 +512,7 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L 0CCC ; Other_Alphabetic # Mn KANNADA VOWEL SIGN AU 0CD5..0CD6 ; Other_Alphabetic # Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK 0CE2..0CE3 ; Other_Alphabetic # Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL -0D01 ; Other_Alphabetic # Mn MALAYALAM SIGN CANDRABINDU +0D00..0D01 ; Other_Alphabetic # Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU 0D02..0D03 ; Other_Alphabetic # Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA 0D3E..0D40 ; Other_Alphabetic # Mc [3] MALAYALAM VOWEL SIGN AA..MALAYALAM VOWEL SIGN II 0D41..0D44 ; Other_Alphabetic # Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR @@ -556,6 +566,7 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L 17BE..17C5 ; Other_Alphabetic # Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU 17C6 ; Other_Alphabetic # Mn KHMER SIGN NIKAHIT 17C7..17C8 ; Other_Alphabetic # Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU +1885..1886 ; Other_Alphabetic # Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA 18A9 ; Other_Alphabetic # Mn MONGOLIAN LETTER ALI GALI DAGALGA 1920..1922 ; Other_Alphabetic # Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U 1923..1926 ; Other_Alphabetic # Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU @@ -613,6 +624,7 @@ A825..A826 ; Other_Alphabetic # Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NA A827 ; Other_Alphabetic # Mc SYLOTI NAGRI VOWEL SIGN OO A880..A881 ; Other_Alphabetic # Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA A8B4..A8C3 ; Other_Alphabetic # Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU +A8C5 ; Other_Alphabetic # Mn SAURASHTRA SIGN CANDRABINDU A926..A92A ; Other_Alphabetic # Mn [5] KAYAH LI VOWEL UE..KAYAH LI VOWEL O A947..A951 ; Other_Alphabetic # Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R A952 ; Other_Alphabetic # Mc REJANG CONSONANT SIGN H @@ -671,6 +683,7 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA 11232..11233 ; Other_Alphabetic # Mc [2] KHOJKI VOWEL SIGN O..KHOJKI VOWEL SIGN AU 11234 ; Other_Alphabetic # Mn KHOJKI SIGN ANUSVARA 11237 ; Other_Alphabetic # Mn KHOJKI SIGN SHADDA +1123E ; Other_Alphabetic # Mn KHOJKI SIGN SUKUN 112DF ; Other_Alphabetic # Mn KHUDAWADI SIGN ANUSVARA 112E0..112E2 ; Other_Alphabetic # Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II 112E3..112E8 ; Other_Alphabetic # Mn [6] KHUDAWADI VOWEL SIGN U..KHUDAWADI VOWEL SIGN AU @@ -683,6 +696,11 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA 1134B..1134C ; Other_Alphabetic # Mc [2] GRANTHA VOWEL SIGN OO..GRANTHA VOWEL SIGN AU 11357 ; Other_Alphabetic # Mc GRANTHA AU LENGTH MARK 11362..11363 ; Other_Alphabetic # Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL +11435..11437 ; Other_Alphabetic # Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II +11438..1143F ; Other_Alphabetic # Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI +11440..11441 ; Other_Alphabetic # Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU +11443..11444 ; Other_Alphabetic # Mn [2] NEWA SIGN CANDRABINDU..NEWA SIGN ANUSVARA +11445 ; Other_Alphabetic # Mc NEWA SIGN VISARGA 114B0..114B2 ; Other_Alphabetic # Mc [3] TIRHUTA VOWEL SIGN AA..TIRHUTA VOWEL SIGN II 114B3..114B8 ; Other_Alphabetic # Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA VOWEL SIGN VOCALIC LL 114B9 ; Other_Alphabetic # Mc TIRHUTA VOWEL SIGN E @@ -712,14 +730,48 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA 11722..11725 ; Other_Alphabetic # Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU 11726 ; Other_Alphabetic # Mc AHOM VOWEL SIGN E 11727..1172A ; Other_Alphabetic # Mn [4] AHOM VOWEL SIGN AW..AHOM VOWEL SIGN AM +11A01..11A06 ; Other_Alphabetic # Mn [6] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL SIGN O +11A07..11A08 ; Other_Alphabetic # Mc [2] ZANABAZAR SQUARE VOWEL SIGN AI..ZANABAZAR SQUARE VOWEL SIGN AU +11A09..11A0A ; Other_Alphabetic # Mn [2] ZANABAZAR SQUARE VOWEL SIGN REVERSED I..ZANABAZAR SQUARE VOWEL LENGTH MARK +11A35..11A38 ; Other_Alphabetic # Mn [4] ZANABAZAR SQUARE SIGN CANDRABINDU..ZANABAZAR SQUARE SIGN ANUSVARA +11A39 ; Other_Alphabetic # Mc ZANABAZAR SQUARE SIGN VISARGA +11A3B..11A3E ; Other_Alphabetic # Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA +11A51..11A56 ; Other_Alphabetic # Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE +11A57..11A58 ; Other_Alphabetic # Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU +11A59..11A5B ; Other_Alphabetic # Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK +11A8A..11A96 ; Other_Alphabetic # Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA +11A97 ; Other_Alphabetic # Mc SOYOMBO SIGN VISARGA +11C2F ; Other_Alphabetic # Mc BHAIKSUKI VOWEL SIGN AA +11C30..11C36 ; Other_Alphabetic # Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L +11C38..11C3D ; Other_Alphabetic # Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA +11C3E ; Other_Alphabetic # Mc BHAIKSUKI SIGN VISARGA +11C92..11CA7 ; Other_Alphabetic # Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA +11CA9 ; Other_Alphabetic # Mc MARCHEN SUBJOINED LETTER YA +11CAA..11CB0 ; Other_Alphabetic # Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA +11CB1 ; Other_Alphabetic # Mc MARCHEN VOWEL SIGN I +11CB2..11CB3 ; Other_Alphabetic # Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E +11CB4 ; Other_Alphabetic # Mc MARCHEN VOWEL SIGN O +11CB5..11CB6 ; Other_Alphabetic # Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU +11D31..11D36 ; Other_Alphabetic # Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R +11D3A ; Other_Alphabetic # Mn MASARAM GONDI VOWEL SIGN E +11D3C..11D3D ; Other_Alphabetic # Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O +11D3F..11D41 ; Other_Alphabetic # Mn [3] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI SIGN VISARGA +11D43 ; Other_Alphabetic # Mn MASARAM GONDI SIGN CANDRA +11D47 ; Other_Alphabetic # Mn MASARAM GONDI RA-KARA 16B30..16B36 ; Other_Alphabetic # Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM 16F51..16F7E ; Other_Alphabetic # Mc [46] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN NG 1BC9E ; Other_Alphabetic # Mn DUPLOYAN DOUBLE MARK +1E000..1E006 ; Other_Alphabetic # Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE +1E008..1E018 ; Other_Alphabetic # Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU +1E01B..1E021 ; Other_Alphabetic # Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI +1E023..1E024 ; Other_Alphabetic # Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS +1E026..1E02A ; Other_Alphabetic # Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA +1E947 ; Other_Alphabetic # Mn ADLAM HAMZA 1F130..1F149 ; Other_Alphabetic # So [26] SQUARED LATIN CAPITAL LETTER A..SQUARED LATIN CAPITAL LETTER Z 1F150..1F169 ; Other_Alphabetic # So [26] NEGATIVE CIRCLED LATIN CAPITAL LETTER A..NEGATIVE CIRCLED LATIN CAPITAL LETTER Z 1F170..1F189 ; Other_Alphabetic # So [26] NEGATIVE SQUARED LATIN CAPITAL LETTER A..NEGATIVE SQUARED LATIN CAPITAL LETTER Z -# Total code points: 1116 +# Total code points: 1300 # ================================================ @@ -728,16 +780,20 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA 3021..3029 ; Ideographic # Nl [9] HANGZHOU NUMERAL ONE..HANGZHOU NUMERAL NINE 3038..303A ; Ideographic # Nl [3] HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY 3400..4DB5 ; Ideographic # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5 -4E00..9FD5 ; Ideographic # Lo [20950] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FD5 +4E00..9FEA ; Ideographic # Lo [20971] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FEA F900..FA6D ; Ideographic # Lo [366] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA6D FA70..FAD9 ; Ideographic # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9 +17000..187EC ; Ideographic # Lo [6125] TANGUT IDEOGRAPH-17000..TANGUT IDEOGRAPH-187EC +18800..18AF2 ; Ideographic # Lo [755] TANGUT COMPONENT-001..TANGUT COMPONENT-755 +1B170..1B2FB ; Ideographic # Lo [396] NUSHU CHARACTER-1B170..NUSHU CHARACTER-1B2FB 20000..2A6D6 ; Ideographic # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6 2A700..2B734 ; Ideographic # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734 2B740..2B81D ; Ideographic # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D 2B820..2CEA1 ; Ideographic # Lo [5762] CJK UNIFIED IDEOGRAPH-2B820..CJK UNIFIED IDEOGRAPH-2CEA1 +2CEB0..2EBE0 ; Ideographic # Lo [7473] CJK UNIFIED IDEOGRAPH-2CEB0..CJK UNIFIED IDEOGRAPH-2EBE0 2F800..2FA1D ; Ideographic # Lo [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D -# Total code points: 81404 +# Total code points: 96174 # ================================================ @@ -793,12 +849,14 @@ FA70..FAD9 ; Ideographic # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COM 0A4D ; Diacritic # Mn GURMUKHI SIGN VIRAMA 0ABC ; Diacritic # Mn GUJARATI SIGN NUKTA 0ACD ; Diacritic # Mn GUJARATI SIGN VIRAMA +0AFD..0AFF ; Diacritic # Mn [3] GUJARATI SIGN THREE-DOT NUKTA ABOVE..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE 0B3C ; Diacritic # Mn ORIYA SIGN NUKTA 0B4D ; Diacritic # Mn ORIYA SIGN VIRAMA 0BCD ; Diacritic # Mn TAMIL SIGN VIRAMA 0C4D ; Diacritic # Mn TELUGU SIGN VIRAMA 0CBC ; Diacritic # Mn KANNADA SIGN NUKTA 0CCD ; Diacritic # Mn KANNADA SIGN VIRAMA +0D3B..0D3C ; Diacritic # Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA 0D4D ; Diacritic # Mn MALAYALAM SIGN VIRAMA 0DCA ; Diacritic # Mn SINHALA SIGN AL-LAKUNA 0E47..0E4C ; Diacritic # Mn [6] THAI CHARACTER MAITAIKHU..THAI CHARACTER THANTHAKHAT @@ -838,10 +896,11 @@ FA70..FAD9 ; Ideographic # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COM 1CE2..1CE8 ; Diacritic # Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL 1CED ; Diacritic # Mn VEDIC SIGN TIRYAK 1CF4 ; Diacritic # Mn VEDIC TONE CANDRA ABOVE +1CF7 ; Diacritic # Mc VEDIC SIGN ATIKRAMA 1CF8..1CF9 ; Diacritic # Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE 1D2C..1D6A ; Diacritic # Lm [63] MODIFIER LETTER CAPITAL A..GREEK SUBSCRIPT SMALL LETTER CHI 1DC4..1DCF ; Diacritic # Mn [12] COMBINING MACRON-ACUTE..COMBINING ZIGZAG BELOW -1DF5 ; Diacritic # Mn COMBINING UP TACK ABOVE +1DF5..1DF9 ; Diacritic # Mn [5] COMBINING UP TACK ABOVE..COMBINING WIDE INVERTED BRIDGE BELOW 1DFD..1DFF ; Diacritic # Mn [3] COMBINING ALMOST EQUAL TO BELOW..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW 1FBD ; Diacritic # Sk GREEK KORONIS 1FBF..1FC1 ; Diacritic # Sk [3] GREEK PSILI..GREEK DIALYTIKA AND PERISPOMENI @@ -906,12 +965,20 @@ FFE3 ; Diacritic # Sk FULLWIDTH MACRON 1134D ; Diacritic # Mc GRANTHA SIGN VIRAMA 11366..1136C ; Diacritic # Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX 11370..11374 ; Diacritic # Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA +11442 ; Diacritic # Mn NEWA SIGN VIRAMA +11446 ; Diacritic # Mn NEWA SIGN NUKTA 114C2..114C3 ; Diacritic # Mn [2] TIRHUTA SIGN VIRAMA..TIRHUTA SIGN NUKTA 115BF..115C0 ; Diacritic # Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA 1163F ; Diacritic # Mn MODI SIGN VIRAMA 116B6 ; Diacritic # Mc TAKRI SIGN VIRAMA 116B7 ; Diacritic # Mn TAKRI SIGN NUKTA 1172B ; Diacritic # Mn AHOM SIGN KILLER +11A34 ; Diacritic # Mn ZANABAZAR SQUARE SIGN VIRAMA +11A47 ; Diacritic # Mn ZANABAZAR SQUARE SUBJOINER +11A99 ; Diacritic # Mn SOYOMBO SUBJOINER +11C3F ; Diacritic # Mn BHAIKSUKI SIGN VIRAMA +11D42 ; Diacritic # Mn MASARAM GONDI SIGN NUKTA +11D44..11D45 ; Diacritic # Mn [2] MASARAM GONDI SIGN HALANTA..MASARAM GONDI VIRAMA 16AF0..16AF4 ; Diacritic # Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE 16F8F..16F92 ; Diacritic # Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW 16F93..16F9F ; Diacritic # Lm [13] MIAO LETTER TONE-2..MIAO LETTER REFORMED TONE-8 @@ -921,8 +988,10 @@ FFE3 ; Diacritic # Sk FULLWIDTH MACRON 1D185..1D18B ; Diacritic # Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE 1D1AA..1D1AD ; Diacritic # Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO 1E8D0..1E8D6 ; Diacritic # Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS +1E944..1E946 ; Diacritic # Mn [3] ADLAM ALIF LENGTHENER..ADLAM GEMINATION MARK +1E948..1E94A ; Diacritic # Mn [3] ADLAM CONSONANT MODIFIER..ADLAM NUKTA -# Total code points: 773 +# Total code points: 798 # ================================================ @@ -951,9 +1020,12 @@ AAF3..AAF4 ; Extender # Lm [2] MEETEI MAYEK SYLLABLE REPETITION MARK..MEETE FF70 ; Extender # Lm HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK 1135D ; Extender # Lo GRANTHA SIGN PLUTA 115C6..115C8 ; Extender # Po [3] SIDDHAM REPETITION MARK-1..SIDDHAM REPETITION MARK-3 +11A98 ; Extender # Mn SOYOMBO GEMINATION MARK 16B42..16B43 ; Extender # Lm [2] PAHAWH HMONG SIGN VOS NRUA..PAHAWH HMONG SIGN IB YAM +16FE0..16FE1 ; Extender # Lm [2] TANGUT ITERATION MARK..NUSHU ITERATION MARK +1E944..1E946 ; Extender # Mn [3] ADLAM ALIF LENGTHENER..ADLAM GEMINATION MARK -# Total code points: 38 +# Total code points: 44 # ================================================ @@ -1027,7 +1099,7 @@ FFFFE..FFFFF ; Noncharacter_Code_Point # Cn [2] ... 2329 ; Deprecated # Ps LEFT-POINTING ANGLE BRACKET 232A ; Deprecated # Pe RIGHT-POINTING ANGLE BRACKET E0001 ; Deprecated # Cf LANGUAGE TAG -E007F ; Deprecated # Cf CANCEL TAG -# Total code points: 16 +# Total code points: 15 # ================================================ @@ -1160,11 +1233,12 @@ AABB..AABC ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL AUE..TAI VIET # ================================================ +1885..1886 ; Other_ID_Start # Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA 2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P 212E ; Other_ID_Start # So ESTIMATED SYMBOL 309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK -# Total code points: 4 +# Total code points: 6 # ================================================ @@ -1177,72 +1251,76 @@ AABB..AABC ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL AUE..TAI VIET # ================================================ -0021 ; STerm # Po EXCLAMATION MARK -002E ; STerm # Po FULL STOP -003F ; STerm # Po QUESTION MARK -0589 ; STerm # Po ARMENIAN FULL STOP -061F ; STerm # Po ARABIC QUESTION MARK -06D4 ; STerm # Po ARABIC FULL STOP -0700..0702 ; STerm # Po [3] SYRIAC END OF PARAGRAPH..SYRIAC SUBLINEAR FULL STOP -07F9 ; STerm # Po NKO EXCLAMATION MARK -0964..0965 ; STerm # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA -104A..104B ; STerm # Po [2] MYANMAR SIGN LITTLE SECTION..MYANMAR SIGN SECTION -1362 ; STerm # Po ETHIOPIC FULL STOP -1367..1368 ; STerm # Po [2] ETHIOPIC QUESTION MARK..ETHIOPIC PARAGRAPH SEPARATOR -166E ; STerm # Po CANADIAN SYLLABICS FULL STOP -1735..1736 ; STerm # Po [2] PHILIPPINE SINGLE PUNCTUATION..PHILIPPINE DOUBLE PUNCTUATION -1803 ; STerm # Po MONGOLIAN FULL STOP -1809 ; STerm # Po MONGOLIAN MANCHU FULL STOP -1944..1945 ; STerm # Po [2] LIMBU EXCLAMATION MARK..LIMBU QUESTION MARK -1AA8..1AAB ; STerm # Po [4] TAI THAM SIGN KAAN..TAI THAM SIGN SATKAANKUU -1B5A..1B5B ; STerm # Po [2] BALINESE PANTI..BALINESE PAMADA -1B5E..1B5F ; STerm # Po [2] BALINESE CARIK SIKI..BALINESE CARIK PAREREN -1C3B..1C3C ; STerm # Po [2] LEPCHA PUNCTUATION TA-ROL..LEPCHA PUNCTUATION NYET THYOOM TA-ROL -1C7E..1C7F ; STerm # Po [2] OL CHIKI PUNCTUATION MUCAAD..OL CHIKI PUNCTUATION DOUBLE MUCAAD -203C..203D ; STerm # Po [2] DOUBLE EXCLAMATION MARK..INTERROBANG -2047..2049 ; STerm # Po [3] DOUBLE QUESTION MARK..EXCLAMATION QUESTION MARK -2E2E ; STerm # Po REVERSED QUESTION MARK -2E3C ; STerm # Po STENOGRAPHIC FULL STOP -3002 ; STerm # Po IDEOGRAPHIC FULL STOP -A4FF ; STerm # Po LISU PUNCTUATION FULL STOP -A60E..A60F ; STerm # Po [2] VAI FULL STOP..VAI QUESTION MARK -A6F3 ; STerm # Po BAMUM FULL STOP -A6F7 ; STerm # Po BAMUM QUESTION MARK -A876..A877 ; STerm # Po [2] PHAGS-PA MARK SHAD..PHAGS-PA MARK DOUBLE SHAD -A8CE..A8CF ; STerm # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA -A92F ; STerm # Po KAYAH LI SIGN SHYA -A9C8..A9C9 ; STerm # Po [2] JAVANESE PADA LINGSA..JAVANESE PADA LUNGSI -AA5D..AA5F ; STerm # Po [3] CHAM PUNCTUATION DANDA..CHAM PUNCTUATION TRIPLE DANDA -AAF0..AAF1 ; STerm # Po [2] MEETEI MAYEK CHEIKHAN..MEETEI MAYEK AHANG KHUDAM -ABEB ; STerm # Po MEETEI MAYEK CHEIKHEI -FE52 ; STerm # Po SMALL FULL STOP -FE56..FE57 ; STerm # Po [2] SMALL QUESTION MARK..SMALL EXCLAMATION MARK -FF01 ; STerm # Po FULLWIDTH EXCLAMATION MARK -FF0E ; STerm # Po FULLWIDTH FULL STOP -FF1F ; STerm # Po FULLWIDTH QUESTION MARK -FF61 ; STerm # Po HALFWIDTH IDEOGRAPHIC FULL STOP -10A56..10A57 ; STerm # Po [2] KHAROSHTHI PUNCTUATION DANDA..KHAROSHTHI PUNCTUATION DOUBLE DANDA -11047..11048 ; STerm # Po [2] BRAHMI DANDA..BRAHMI DOUBLE DANDA -110BE..110C1 ; STerm # Po [4] KAITHI SECTION MARK..KAITHI DOUBLE DANDA -11141..11143 ; STerm # Po [3] CHAKMA DANDA..CHAKMA QUESTION MARK -111C5..111C6 ; STerm # Po [2] SHARADA DANDA..SHARADA DOUBLE DANDA -111CD ; STerm # Po SHARADA SUTRA MARK -111DE..111DF ; STerm # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2 -11238..11239 ; STerm # Po [2] KHOJKI DANDA..KHOJKI DOUBLE DANDA -1123B..1123C ; STerm # Po [2] KHOJKI SECTION MARK..KHOJKI DOUBLE SECTION MARK -112A9 ; STerm # Po MULTANI SECTION MARK -115C2..115C3 ; STerm # Po [2] SIDDHAM DANDA..SIDDHAM DOUBLE DANDA -115C9..115D7 ; STerm # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES -11641..11642 ; STerm # Po [2] MODI DANDA..MODI DOUBLE DANDA -1173C..1173E ; STerm # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI -16A6E..16A6F ; STerm # Po [2] MRO DANDA..MRO DOUBLE DANDA -16AF5 ; STerm # Po BASSA VAH FULL STOP -16B37..16B38 ; STerm # Po [2] PAHAWH HMONG SIGN VOS THOM..PAHAWH HMONG SIGN VOS TSHAB CEEB -16B44 ; STerm # Po PAHAWH HMONG SIGN XAUS -1BC9F ; STerm # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP -1DA88 ; STerm # Po SIGNWRITING FULL STOP +0021 ; Sentence_Terminal # Po EXCLAMATION MARK +002E ; Sentence_Terminal # Po FULL STOP +003F ; Sentence_Terminal # Po QUESTION MARK +0589 ; Sentence_Terminal # Po ARMENIAN FULL STOP +061F ; Sentence_Terminal # Po ARABIC QUESTION MARK +06D4 ; Sentence_Terminal # Po ARABIC FULL STOP +0700..0702 ; Sentence_Terminal # Po [3] SYRIAC END OF PARAGRAPH..SYRIAC SUBLINEAR FULL STOP +07F9 ; Sentence_Terminal # Po NKO EXCLAMATION MARK +0964..0965 ; Sentence_Terminal # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA +104A..104B ; Sentence_Terminal # Po [2] MYANMAR SIGN LITTLE SECTION..MYANMAR SIGN SECTION +1362 ; Sentence_Terminal # Po ETHIOPIC FULL STOP +1367..1368 ; Sentence_Terminal # Po [2] ETHIOPIC QUESTION MARK..ETHIOPIC PARAGRAPH SEPARATOR +166E ; Sentence_Terminal # Po CANADIAN SYLLABICS FULL STOP +1735..1736 ; Sentence_Terminal # Po [2] PHILIPPINE SINGLE PUNCTUATION..PHILIPPINE DOUBLE PUNCTUATION +1803 ; Sentence_Terminal # Po MONGOLIAN FULL STOP +1809 ; Sentence_Terminal # Po MONGOLIAN MANCHU FULL STOP +1944..1945 ; Sentence_Terminal # Po [2] LIMBU EXCLAMATION MARK..LIMBU QUESTION MARK +1AA8..1AAB ; Sentence_Terminal # Po [4] TAI THAM SIGN KAAN..TAI THAM SIGN SATKAANKUU +1B5A..1B5B ; Sentence_Terminal # Po [2] BALINESE PANTI..BALINESE PAMADA +1B5E..1B5F ; Sentence_Terminal # Po [2] BALINESE CARIK SIKI..BALINESE CARIK PAREREN +1C3B..1C3C ; Sentence_Terminal # Po [2] LEPCHA PUNCTUATION TA-ROL..LEPCHA PUNCTUATION NYET THYOOM TA-ROL +1C7E..1C7F ; Sentence_Terminal # Po [2] OL CHIKI PUNCTUATION MUCAAD..OL CHIKI PUNCTUATION DOUBLE MUCAAD +203C..203D ; Sentence_Terminal # Po [2] DOUBLE EXCLAMATION MARK..INTERROBANG +2047..2049 ; Sentence_Terminal # Po [3] DOUBLE QUESTION MARK..EXCLAMATION QUESTION MARK +2E2E ; Sentence_Terminal # Po REVERSED QUESTION MARK +2E3C ; Sentence_Terminal # Po STENOGRAPHIC FULL STOP +3002 ; Sentence_Terminal # Po IDEOGRAPHIC FULL STOP +A4FF ; Sentence_Terminal # Po LISU PUNCTUATION FULL STOP +A60E..A60F ; Sentence_Terminal # Po [2] VAI FULL STOP..VAI QUESTION MARK +A6F3 ; Sentence_Terminal # Po BAMUM FULL STOP +A6F7 ; Sentence_Terminal # Po BAMUM QUESTION MARK +A876..A877 ; Sentence_Terminal # Po [2] PHAGS-PA MARK SHAD..PHAGS-PA MARK DOUBLE SHAD +A8CE..A8CF ; Sentence_Terminal # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA +A92F ; Sentence_Terminal # Po KAYAH LI SIGN SHYA +A9C8..A9C9 ; Sentence_Terminal # Po [2] JAVANESE PADA LINGSA..JAVANESE PADA LUNGSI +AA5D..AA5F ; Sentence_Terminal # Po [3] CHAM PUNCTUATION DANDA..CHAM PUNCTUATION TRIPLE DANDA +AAF0..AAF1 ; Sentence_Terminal # Po [2] MEETEI MAYEK CHEIKHAN..MEETEI MAYEK AHANG KHUDAM +ABEB ; Sentence_Terminal # Po MEETEI MAYEK CHEIKHEI +FE52 ; Sentence_Terminal # Po SMALL FULL STOP +FE56..FE57 ; Sentence_Terminal # Po [2] SMALL QUESTION MARK..SMALL EXCLAMATION MARK +FF01 ; Sentence_Terminal # Po FULLWIDTH EXCLAMATION MARK +FF0E ; Sentence_Terminal # Po FULLWIDTH FULL STOP +FF1F ; Sentence_Terminal # Po FULLWIDTH QUESTION MARK +FF61 ; Sentence_Terminal # Po HALFWIDTH IDEOGRAPHIC FULL STOP +10A56..10A57 ; Sentence_Terminal # Po [2] KHAROSHTHI PUNCTUATION DANDA..KHAROSHTHI PUNCTUATION DOUBLE DANDA +11047..11048 ; Sentence_Terminal # Po [2] BRAHMI DANDA..BRAHMI DOUBLE DANDA +110BE..110C1 ; Sentence_Terminal # Po [4] KAITHI SECTION MARK..KAITHI DOUBLE DANDA +11141..11143 ; Sentence_Terminal # Po [3] CHAKMA DANDA..CHAKMA QUESTION MARK +111C5..111C6 ; Sentence_Terminal # Po [2] SHARADA DANDA..SHARADA DOUBLE DANDA +111CD ; Sentence_Terminal # Po SHARADA SUTRA MARK +111DE..111DF ; Sentence_Terminal # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2 +11238..11239 ; Sentence_Terminal # Po [2] KHOJKI DANDA..KHOJKI DOUBLE DANDA +1123B..1123C ; Sentence_Terminal # Po [2] KHOJKI SECTION MARK..KHOJKI DOUBLE SECTION MARK +112A9 ; Sentence_Terminal # Po MULTANI SECTION MARK +1144B..1144C ; Sentence_Terminal # Po [2] NEWA DANDA..NEWA DOUBLE DANDA +115C2..115C3 ; Sentence_Terminal # Po [2] SIDDHAM DANDA..SIDDHAM DOUBLE DANDA +115C9..115D7 ; Sentence_Terminal # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES +11641..11642 ; Sentence_Terminal # Po [2] MODI DANDA..MODI DOUBLE DANDA +1173C..1173E ; Sentence_Terminal # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI +11A42..11A43 ; Sentence_Terminal # Po [2] ZANABAZAR SQUARE MARK SHAD..ZANABAZAR SQUARE MARK DOUBLE SHAD +11A9B..11A9C ; Sentence_Terminal # Po [2] SOYOMBO MARK SHAD..SOYOMBO MARK DOUBLE SHAD +11C41..11C42 ; Sentence_Terminal # Po [2] BHAIKSUKI DANDA..BHAIKSUKI DOUBLE DANDA +16A6E..16A6F ; Sentence_Terminal # Po [2] MRO DANDA..MRO DOUBLE DANDA +16AF5 ; Sentence_Terminal # Po BASSA VAH FULL STOP +16B37..16B38 ; Sentence_Terminal # Po [2] PAHAWH HMONG SIGN VOS THOM..PAHAWH HMONG SIGN VOS TSHAB CEEB +16B44 ; Sentence_Terminal # Po PAHAWH HMONG SIGN XAUS +1BC9F ; Sentence_Terminal # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP +1DA88 ; Sentence_Terminal # Po SIGNWRITING FULL STOP -# Total code points: 120 +# Total code points: 128 # ================================================ @@ -1359,9 +1437,7 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S 239B..23B3 ; Pattern_Syntax # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23DB ; Pattern_Syntax # So [40] TOP SQUARE BRACKET..FUSE 23DC..23E1 ; Pattern_Syntax # Sm [6] TOP PARENTHESIS..BOTTOM TORTOISE SHELL BRACKET -23E2..23FA ; Pattern_Syntax # So [25] WHITE TRAPEZIUM..BLACK CIRCLE FOR RECORD -23FB..23FF ; Pattern_Syntax # Cn [5] .. -2400..2426 ; Pattern_Syntax # So [39] SYMBOL FOR NULL..SYMBOL FOR SUBSTITUTE FORM TWO +23E2..2426 ; Pattern_Syntax # So [69] WHITE TRAPEZIUM..SYMBOL FOR SUBSTITUTE FORM TWO 2427..243F ; Pattern_Syntax # Cn [25] .. 2440..244A ; Pattern_Syntax # So [11] OCR HOOK..OCR DOUBLE BACKSLASH 244B..245F ; Pattern_Syntax # Cn [21] .. @@ -1449,8 +1525,8 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S 2BBA..2BBC ; Pattern_Syntax # Cn [3] .. 2BBD..2BC8 ; Pattern_Syntax # So [12] BALLOT BOX WITH LIGHT X..BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED 2BC9 ; Pattern_Syntax # Cn -2BCA..2BD1 ; Pattern_Syntax # So [8] TOP HALF BLACK CIRCLE..UNCERTAINTY SIGN -2BD2..2BEB ; Pattern_Syntax # Cn [26] .. +2BCA..2BD2 ; Pattern_Syntax # So [9] TOP HALF BLACK CIRCLE..GROUP MARK +2BD3..2BEB ; Pattern_Syntax # Cn [25] .. 2BEC..2BEF ; Pattern_Syntax # So [4] LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS..DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS 2BF0..2BFF ; Pattern_Syntax # Cn [16] .. 2E00..2E01 ; Pattern_Syntax # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER @@ -1490,7 +1566,8 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S 2E40 ; Pattern_Syntax # Pd DOUBLE HYPHEN 2E41 ; Pattern_Syntax # Po REVERSED COMMA 2E42 ; Pattern_Syntax # Ps DOUBLE LOW-REVERSED-9 QUOTATION MARK -2E43..2E7F ; Pattern_Syntax # Cn [61] .. +2E43..2E49 ; Pattern_Syntax # Po [7] DASH WITH LEFT UPTURN..DOUBLE STACKED COMMA +2E4A..2E7F ; Pattern_Syntax # Cn [54] .. 3001..3003 ; Pattern_Syntax # Po [3] IDEOGRAPHIC COMMA..DITTO MARK 3008 ; Pattern_Syntax # Ps LEFT ANGLE BRACKET 3009 ; Pattern_Syntax # Pe RIGHT ANGLE BRACKET @@ -1522,4 +1599,20 @@ FE45..FE46 ; Pattern_Syntax # Po [2] SESAME DOT..WHITE SESAME DOT # Total code points: 2760 +# ================================================ + +0600..0605 ; Prepended_Concatenation_Mark # Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE +06DD ; Prepended_Concatenation_Mark # Cf ARABIC END OF AYAH +070F ; Prepended_Concatenation_Mark # Cf SYRIAC ABBREVIATION MARK +08E2 ; Prepended_Concatenation_Mark # Cf ARABIC DISPUTED END OF AYAH +110BD ; Prepended_Concatenation_Mark # Cf KAITHI NUMBER SIGN + +# Total code points: 10 + +# ================================================ + +1F1E6..1F1FF ; Regional_Indicator # So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z + +# Total code points: 26 + # EOF diff --git a/make/data/unicodedata/Scripts.txt b/make/data/unicodedata/Scripts.txt index 7e42740407c..80430b32a8f 100644 --- a/make/data/unicodedata/Scripts.txt +++ b/make/data/unicodedata/Scripts.txt @@ -1,10 +1,11 @@ -# Scripts-8.0.0.txt -# Date: 2015-03-11, 22:29:42 GMT [MD] +# Scripts-10.0.0.txt +# Date: 2017-03-11, 06:40:37 GMT +# Copyright (c) 2017 Unicode, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see http://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2015 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# For documentation, see http://www.unicode.org/reports/tr44/ +# For documentation, see http://www.unicode.org/reports/tr44/ # For more information, see: # UAX #24, Unicode Script Property: http://www.unicode.org/reports/tr24/ # Especially the sections: @@ -92,10 +93,10 @@ 0605 ; Common # Cf ARABIC NUMBER MARK ABOVE 060C ; Common # Po ARABIC COMMA 061B ; Common # Po ARABIC SEMICOLON -061C ; Common # Cf ARABIC LETTER MARK 061F ; Common # Po ARABIC QUESTION MARK 0640 ; Common # Lm ARABIC TATWEEL 06DD ; Common # Cf ARABIC END OF AYAH +08E2 ; Common # Cf ARABIC DISPUTED END OF AYAH 0964..0965 ; Common # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA 0E3F ; Common # Sc THAI CURRENCY SYMBOL BAHT 0FD5..0FD8 ; Common # So [4] RIGHT-FACING SVASTI SIGN..LEFT-FACING SVASTI SIGN WITH DOTS @@ -110,6 +111,7 @@ 1CEE..1CF1 ; Common # Lo [4] VEDIC SIGN HEXIFORM LONG ANUSVARA..VEDIC SIGN ANUSVARA UBHAYATO MUKHA 1CF2..1CF3 ; Common # Mc [2] VEDIC SIGN ARDHAVISARGA..VEDIC SIGN ROTATED ARDHAVISARGA 1CF5..1CF6 ; Common # Lo [2] VEDIC SIGN JIHVAMULIYA..VEDIC SIGN UPADHMANIYA +1CF7 ; Common # Mc VEDIC SIGN ATIKRAMA 2000..200A ; Common # Zs [11] EN QUAD..HAIR SPACE 200B ; Common # Cf ZERO WIDTH SPACE 200E..200F ; Common # Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK @@ -153,7 +155,7 @@ 208A..208C ; Common # Sm [3] SUBSCRIPT PLUS SIGN..SUBSCRIPT EQUALS SIGN 208D ; Common # Ps SUBSCRIPT LEFT PARENTHESIS 208E ; Common # Pe SUBSCRIPT RIGHT PARENTHESIS -20A0..20BE ; Common # Sc [31] EURO-CURRENCY SIGN..LARI SIGN +20A0..20BF ; Common # Sc [32] EURO-CURRENCY SIGN..BITCOIN SIGN 2100..2101 ; Common # So [2] ACCOUNT OF..ADDRESSED TO THE SUBJECT 2102 ; Common # L& DOUBLE-STRUCK CAPITAL C 2103..2106 ; Common # So [4] DEGREE CELSIUS..CADA UNA @@ -223,8 +225,7 @@ 239B..23B3 ; Common # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23DB ; Common # So [40] TOP SQUARE BRACKET..FUSE 23DC..23E1 ; Common # Sm [6] TOP PARENTHESIS..BOTTOM TORTOISE SHELL BRACKET -23E2..23FA ; Common # So [25] WHITE TRAPEZIUM..BLACK CIRCLE FOR RECORD -2400..2426 ; Common # So [39] SYMBOL FOR NULL..SYMBOL FOR SUBSTITUTE FORM TWO +23E2..2426 ; Common # So [69] WHITE TRAPEZIUM..SYMBOL FOR SUBSTITUTE FORM TWO 2440..244A ; Common # So [11] OCR HOOK..OCR DOUBLE BACKSLASH 2460..249B ; Common # No [60] CIRCLED DIGIT ONE..NUMBER TWENTY FULL STOP 249C..24E9 ; Common # So [78] PARENTHESIZED LATIN SMALL LETTER A..CIRCLED LATIN SMALL LETTER Z @@ -309,7 +310,7 @@ 2B76..2B95 ; Common # So [32] NORTH WEST TRIANGLE-HEADED ARROW TO BAR..RIGHTWARDS BLACK ARROW 2B98..2BB9 ; Common # So [34] THREE-D TOP-LIGHTED LEFTWARDS EQUILATERAL ARROWHEAD..UP ARROWHEAD IN A RECTANGLE BOX 2BBD..2BC8 ; Common # So [12] BALLOT BOX WITH LIGHT X..BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED -2BCA..2BD1 ; Common # So [8] TOP HALF BLACK CIRCLE..UNCERTAINTY SIGN +2BCA..2BD2 ; Common # So [9] TOP HALF BLACK CIRCLE..GROUP MARK 2BEC..2BEF ; Common # So [4] LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS..DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS 2E00..2E01 ; Common # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER 2E02 ; Common # Pi LEFT SUBSTITUTION BRACKET @@ -348,6 +349,7 @@ 2E40 ; Common # Pd DOUBLE HYPHEN 2E41 ; Common # Po REVERSED COMMA 2E42 ; Common # Ps DOUBLE LOW-REVERSED-9 QUOTATION MARK +2E43..2E49 ; Common # Po [7] DASH WITH LEFT UPTURN..DOUBLE STACKED COMMA 2FF0..2FFB ; Common # So [12] IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT..IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID 3000 ; Common # Zs IDEOGRAPHIC SPACE 3001..3003 ; Common # Po [3] IDEOGRAPHIC COMMA..DITTO MARK @@ -572,19 +574,18 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR 1F100..1F10C ; Common # No [13] DIGIT ZERO FULL STOP..DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ZERO 1F110..1F12E ; Common # So [31] PARENTHESIZED LATIN CAPITAL LETTER A..CIRCLED WZ 1F130..1F16B ; Common # So [60] SQUARED LATIN CAPITAL LETTER A..RAISED MD SIGN -1F170..1F19A ; Common # So [43] NEGATIVE SQUARED LATIN CAPITAL LETTER A..SQUARED VS +1F170..1F1AC ; Common # So [61] NEGATIVE SQUARED LATIN CAPITAL LETTER A..SQUARED VOD 1F1E6..1F1FF ; Common # So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z 1F201..1F202 ; Common # So [2] SQUARED KATAKANA KOKO..SQUARED KATAKANA SA -1F210..1F23A ; Common # So [43] SQUARED CJK UNIFIED IDEOGRAPH-624B..SQUARED CJK UNIFIED IDEOGRAPH-55B6 +1F210..1F23B ; Common # So [44] SQUARED CJK UNIFIED IDEOGRAPH-624B..SQUARED CJK UNIFIED IDEOGRAPH-914D 1F240..1F248 ; Common # So [9] TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-672C..TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557 1F250..1F251 ; Common # So [2] CIRCLED IDEOGRAPH ADVANTAGE..CIRCLED IDEOGRAPH ACCEPT +1F260..1F265 ; Common # So [6] ROUNDED SYMBOL FOR FU..ROUNDED SYMBOL FOR CAI 1F300..1F3FA ; Common # So [251] CYCLONE..AMPHORA 1F3FB..1F3FF ; Common # Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6 -1F400..1F579 ; Common # So [378] RAT..JOYSTICK -1F57B..1F5A3 ; Common # So [41] LEFT HAND TELEPHONE RECEIVER..BLACK DOWN POINTING BACKHAND INDEX -1F5A5..1F6D0 ; Common # So [300] DESKTOP COMPUTER..PLACE OF WORSHIP +1F400..1F6D4 ; Common # So [725] RAT..PAGODA 1F6E0..1F6EC ; Common # So [13] HAMMER AND WRENCH..AIRPLANE ARRIVING -1F6F0..1F6F3 ; Common # So [4] SATELLITE..PASSENGER SHIP +1F6F0..1F6F8 ; Common # So [9] SATELLITE..FLYING SAUCER 1F700..1F773 ; Common # So [116] ALCHEMICAL SYMBOL FOR QUINTESSENCE..ALCHEMICAL SYMBOL FOR HALF OUNCE 1F780..1F7D4 ; Common # So [85] BLACK LEFT-POINTING ISOSCELES RIGHT TRIANGLE..HEAVY TWELVE POINTED PINWHEEL STAR 1F800..1F80B ; Common # So [12] LEFTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD..DOWNWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD @@ -592,13 +593,17 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR 1F850..1F859 ; Common # So [10] LEFTWARDS SANS-SERIF ARROW..UP DOWN SANS-SERIF ARROW 1F860..1F887 ; Common # So [40] WIDE-HEADED LEFTWARDS LIGHT BARB ARROW..WIDE-HEADED SOUTH WEST VERY HEAVY BARB ARROW 1F890..1F8AD ; Common # So [30] LEFTWARDS TRIANGLE ARROWHEAD..WHITE ARROW SHAFT WIDTH TWO THIRDS -1F910..1F918 ; Common # So [9] ZIPPER-MOUTH FACE..SIGN OF THE HORNS -1F980..1F984 ; Common # So [5] CRAB..UNICORN FACE +1F900..1F90B ; Common # So [12] CIRCLED CROSS FORMEE WITH FOUR DOTS..DOWNWARD FACING NOTCHED HOOK WITH DOT +1F910..1F93E ; Common # So [47] ZIPPER-MOUTH FACE..HANDBALL +1F940..1F94C ; Common # So [13] WILTED FLOWER..CURLING STONE +1F950..1F96B ; Common # So [28] CROISSANT..CANNED FOOD +1F980..1F997 ; Common # So [24] CRAB..CRICKET 1F9C0 ; Common # So CHEESE WEDGE +1F9D0..1F9E6 ; Common # So [23] FACE WITH MONOCLE..SOCKS E0001 ; Common # Cf LANGUAGE TAG E0020..E007F ; Common # Cf [96] TAG SPACE..CANCEL TAG -# Total code points: 7179 +# Total code points: 7363 # ================================================ @@ -641,7 +646,7 @@ A770 ; Latin # Lm MODIFIER LETTER US A771..A787 ; Latin # L& [23] LATIN SMALL LETTER DUM..LATIN SMALL LETTER INSULAR T A78B..A78E ; Latin # L& [4] LATIN CAPITAL LETTER SALTILLO..LATIN SMALL LETTER L WITH RETROFLEX HOOK AND BELT A78F ; Latin # Lo LATIN LETTER SINOLOGICAL DOT -A790..A7AD ; Latin # L& [30] LATIN CAPITAL LETTER N WITH DESCENDER..LATIN CAPITAL LETTER L WITH BELT +A790..A7AE ; Latin # L& [31] LATIN CAPITAL LETTER N WITH DESCENDER..LATIN CAPITAL LETTER SMALL CAPITAL I A7B0..A7B7 ; Latin # L& [8] LATIN CAPITAL LETTER TURNED K..LATIN SMALL LETTER OMEGA A7F7 ; Latin # Lo LATIN EPIGRAPHIC LETTER SIDEWAYS I A7F8..A7F9 ; Latin # Lm [2] MODIFIER LETTER CAPITAL H WITH STROKE..MODIFIER LETTER SMALL LIGATURE OE @@ -654,7 +659,7 @@ FB00..FB06 ; Latin # L& [7] LATIN SMALL LIGATURE FF..LATIN SMALL LIGATURE S FF21..FF3A ; Latin # L& [26] FULLWIDTH LATIN CAPITAL LETTER A..FULLWIDTH LATIN CAPITAL LETTER Z FF41..FF5A ; Latin # L& [26] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH LATIN SMALL LETTER Z -# Total code points: 1349 +# Total code points: 1350 # ================================================ @@ -708,13 +713,13 @@ AB65 ; Greek # L& GREEK LETTER SMALL CAPITAL OMEGA 10175..10178 ; Greek # No [4] GREEK ONE HALF SIGN..GREEK THREE QUARTERS SIGN 10179..10189 ; Greek # So [17] GREEK YEAR SIGN..GREEK TRYBLION BASE SIGN 1018A..1018B ; Greek # No [2] GREEK ZERO SIGN..GREEK ONE QUARTER SIGN -1018C ; Greek # So GREEK SINUSOID SIGN +1018C..1018E ; Greek # So [3] GREEK SINUSOID SIGN..NOMISMA SIGN 101A0 ; Greek # So GREEK SYMBOL TAU RHO 1D200..1D241 ; Greek # So [66] GREEK VOCAL NOTATION SYMBOL-1..GREEK INSTRUMENTAL NOTATION SYMBOL-54 1D242..1D244 ; Greek # Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME 1D245 ; Greek # So GREEK MUSICAL LEIMMA -# Total code points: 516 +# Total code points: 518 # ================================================ @@ -724,6 +729,7 @@ AB65 ; Greek # L& GREEK LETTER SMALL CAPITAL OMEGA 0487 ; Cyrillic # Mn COMBINING CYRILLIC POKRYTIE 0488..0489 ; Cyrillic # Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN 048A..052F ; Cyrillic # L& [166] CYRILLIC CAPITAL LETTER SHORT I WITH TAIL..CYRILLIC SMALL LETTER EL WITH DESCENDER +1C80..1C88 ; Cyrillic # L& [9] CYRILLIC SMALL LETTER ROUNDED VE..CYRILLIC SMALL LETTER UNBLENDED UK 1D2B ; Cyrillic # L& CYRILLIC LETTER SMALL CAPITAL EL 1D78 ; Cyrillic # Lm MODIFIER LETTER CYRILLIC EN 2DE0..2DFF ; Cyrillic # Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS @@ -740,7 +746,7 @@ A69C..A69D ; Cyrillic # Lm [2] MODIFIER LETTER CYRILLIC HARD SIGN..MODIFIER A69E..A69F ; Cyrillic # Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E FE2E..FE2F ; Cyrillic # Mn [2] COMBINING CYRILLIC TITLO LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF -# Total code points: 434 +# Total code points: 443 # ================================================ @@ -791,6 +797,7 @@ FB46..FB4F ; Hebrew # Lo [10] HEBREW LETTER TSADI WITH DAGESH..HEBREW LIGATU 060D ; Arabic # Po ARABIC DATE SEPARATOR 060E..060F ; Arabic # So [2] ARABIC POETIC VERSE SIGN..ARABIC SIGN MISRA 0610..061A ; Arabic # Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA +061C ; Arabic # Cf ARABIC LETTER MARK 061E ; Arabic # Po ARABIC TRIPLE DOT PUNCTUATION MARK 0620..063F ; Arabic # Lo [32] ARABIC LETTER KASHMIRI YEH..ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE 0641..064A ; Arabic # Lo [10] ARABIC LETTER FEH..ARABIC LETTER YEH @@ -815,6 +822,8 @@ FB46..FB4F ; Hebrew # Lo [10] HEBREW LETTER TSADI WITH DAGESH..HEBREW LIGATU 06FF ; Arabic # Lo ARABIC LETTER HEH WITH INVERTED V 0750..077F ; Arabic # Lo [48] ARABIC LETTER BEH WITH THREE DOTS HORIZONTALLY BELOW..ARABIC LETTER KAF WITH TWO DOTS ABOVE 08A0..08B4 ; Arabic # Lo [21] ARABIC LETTER BEH WITH SMALL V BELOW..ARABIC LETTER KAF WITH DOT BELOW +08B6..08BD ; Arabic # Lo [8] ARABIC LETTER BEH WITH SMALL MEEM ABOVE..ARABIC LETTER AFRICAN NOON +08D4..08E1 ; Arabic # Mn [14] ARABIC SMALL HIGH WORD AR-RUB..ARABIC SMALL HIGH SIGN SAFHA 08E3..08FF ; Arabic # Mn [29] ARABIC TURNED DAMMA BELOW..ARABIC MARK SIDEWAYS NOON GHUNNA FB50..FBB1 ; Arabic # Lo [98] ARABIC LETTER ALEF WASLA ISOLATED FORM..ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM FBB2..FBC1 ; Arabic # Sk [16] ARABIC SYMBOL DOT ABOVE..ARABIC SYMBOL SMALL TAH BELOW @@ -862,7 +871,7 @@ FE76..FEFC ; Arabic # Lo [135] ARABIC FATHA ISOLATED FORM..ARABIC LIGATURE LA 1EEAB..1EEBB ; Arabic # Lo [17] ARABIC MATHEMATICAL DOUBLE-STRUCK LAM..ARABIC MATHEMATICAL DOUBLE-STRUCK GHAIN 1EEF0..1EEF1 ; Arabic # Sm [2] ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL..ARABIC MATHEMATICAL OPERATOR HAH WITH DAL -# Total code points: 1257 +# Total code points: 1280 # ================================================ @@ -873,8 +882,9 @@ FE76..FEFC ; Arabic # Lo [135] ARABIC FATHA ISOLATED FORM..ARABIC LIGATURE LA 0712..072F ; Syriac # Lo [30] SYRIAC LETTER BETH..SYRIAC LETTER PERSIAN DHALATH 0730..074A ; Syriac # Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH 074D..074F ; Syriac # Lo [3] SYRIAC LETTER SOGDIAN ZHAIN..SYRIAC LETTER SOGDIAN FE +0860..086A ; Syriac # Lo [11] SYRIAC LETTER MALAYALAM NGA..SYRIAC LETTER MALAYALAM SSA -# Total code points: 77 +# Total code points: 88 # ================================================ @@ -944,8 +954,10 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 09F4..09F9 ; Bengali # No [6] BENGALI CURRENCY NUMERATOR ONE..BENGALI CURRENCY DENOMINATOR SIXTEEN 09FA ; Bengali # So BENGALI ISSHAR 09FB ; Bengali # Sc BENGALI GANDA MARK +09FC ; Bengali # Lo BENGALI LETTER VEDIC ANUSVARA +09FD ; Bengali # Po BENGALI ABBREVIATION SIGN -# Total code points: 93 +# Total code points: 95 # ================================================ @@ -998,8 +1010,9 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 0AF0 ; Gujarati # Po GUJARATI ABBREVIATION SIGN 0AF1 ; Gujarati # Sc GUJARATI RUPEE SIGN 0AF9 ; Gujarati # Lo GUJARATI LETTER ZHA +0AFA..0AFF ; Gujarati # Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE -# Total code points: 85 +# Total code points: 91 # ================================================ @@ -1086,6 +1099,7 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM # ================================================ +0C80 ; Kannada # Lo KANNADA SIGN SPACING CANDRABINDU 0C81 ; Kannada # Mn KANNADA SIGN CANDRABINDU 0C82..0C83 ; Kannada # Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA 0C85..0C8C ; Kannada # Lo [8] KANNADA LETTER A..KANNADA LETTER VOCALIC L @@ -1109,15 +1123,16 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 0CE6..0CEF ; Kannada # Nd [10] KANNADA DIGIT ZERO..KANNADA DIGIT NINE 0CF1..0CF2 ; Kannada # Lo [2] KANNADA SIGN JIHVAMULIYA..KANNADA SIGN UPADHMANIYA -# Total code points: 87 +# Total code points: 88 # ================================================ -0D01 ; Malayalam # Mn MALAYALAM SIGN CANDRABINDU +0D00..0D01 ; Malayalam # Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU 0D02..0D03 ; Malayalam # Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA 0D05..0D0C ; Malayalam # Lo [8] MALAYALAM LETTER A..MALAYALAM LETTER VOCALIC L 0D0E..0D10 ; Malayalam # Lo [3] MALAYALAM LETTER E..MALAYALAM LETTER AI 0D12..0D3A ; Malayalam # Lo [41] MALAYALAM LETTER O..MALAYALAM LETTER TTTA +0D3B..0D3C ; Malayalam # Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA 0D3D ; Malayalam # Lo MALAYALAM SIGN AVAGRAHA 0D3E..0D40 ; Malayalam # Mc [3] MALAYALAM VOWEL SIGN AA..MALAYALAM VOWEL SIGN II 0D41..0D44 ; Malayalam # Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR @@ -1125,15 +1140,18 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 0D4A..0D4C ; Malayalam # Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU 0D4D ; Malayalam # Mn MALAYALAM SIGN VIRAMA 0D4E ; Malayalam # Lo MALAYALAM LETTER DOT REPH +0D4F ; Malayalam # So MALAYALAM SIGN PARA +0D54..0D56 ; Malayalam # Lo [3] MALAYALAM LETTER CHILLU M..MALAYALAM LETTER CHILLU LLL 0D57 ; Malayalam # Mc MALAYALAM AU LENGTH MARK +0D58..0D5E ; Malayalam # No [7] MALAYALAM FRACTION ONE ONE-HUNDRED-AND-SIXTIETH..MALAYALAM FRACTION ONE FIFTH 0D5F..0D61 ; Malayalam # Lo [3] MALAYALAM LETTER ARCHAIC II..MALAYALAM LETTER VOCALIC LL 0D62..0D63 ; Malayalam # Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL 0D66..0D6F ; Malayalam # Nd [10] MALAYALAM DIGIT ZERO..MALAYALAM DIGIT NINE -0D70..0D75 ; Malayalam # No [6] MALAYALAM NUMBER TEN..MALAYALAM FRACTION THREE QUARTERS +0D70..0D78 ; Malayalam # No [9] MALAYALAM NUMBER TEN..MALAYALAM FRACTION THREE SIXTEENTHS 0D79 ; Malayalam # So MALAYALAM DATE MARK 0D7A..0D7F ; Malayalam # Lo [6] MALAYALAM LETTER CHILLU NN..MALAYALAM LETTER CHILLU K -# Total code points: 100 +# Total code points: 117 # ================================================ @@ -1436,21 +1454,24 @@ AB70..ABBF ; Cherokee # L& [80] CHEROKEE SMALL LETTER A..CHEROKEE SMALL LETT 1820..1842 ; Mongolian # Lo [35] MONGOLIAN LETTER A..MONGOLIAN LETTER CHI 1843 ; Mongolian # Lm MONGOLIAN LETTER TODO LONG VOWEL SIGN 1844..1877 ; Mongolian # Lo [52] MONGOLIAN LETTER TODO E..MONGOLIAN LETTER MANCHU ZHA -1880..18A8 ; Mongolian # Lo [41] MONGOLIAN LETTER ALI GALI ANUSVARA ONE..MONGOLIAN LETTER MANCHU ALI GALI BHA +1880..1884 ; Mongolian # Lo [5] MONGOLIAN LETTER ALI GALI ANUSVARA ONE..MONGOLIAN LETTER ALI GALI INVERTED UBADAMA +1885..1886 ; Mongolian # Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA +1887..18A8 ; Mongolian # Lo [34] MONGOLIAN LETTER ALI GALI A..MONGOLIAN LETTER MANCHU ALI GALI BHA 18A9 ; Mongolian # Mn MONGOLIAN LETTER ALI GALI DAGALGA 18AA ; Mongolian # Lo MONGOLIAN LETTER MANCHU ALI GALI LHA +11660..1166C ; Mongolian # Po [13] MONGOLIAN BIRGA WITH ORNAMENT..MONGOLIAN TURNED SWIRL BIRGA WITH DOUBLE ORNAMENT -# Total code points: 153 +# Total code points: 166 # ================================================ 3041..3096 ; Hiragana # Lo [86] HIRAGANA LETTER SMALL A..HIRAGANA LETTER SMALL KE 309D..309E ; Hiragana # Lm [2] HIRAGANA ITERATION MARK..HIRAGANA VOICED ITERATION MARK 309F ; Hiragana # Lo HIRAGANA DIGRAPH YORI -1B001 ; Hiragana # Lo HIRAGANA LETTER ARCHAIC YE +1B001..1B11E ; Hiragana # Lo [286] HIRAGANA LETTER ARCHAIC YE..HENTAIGANA LETTER N-MU-MO-2 1F200 ; Hiragana # So SQUARE HIRAGANA HOKA -# Total code points: 91 +# Total code points: 376 # ================================================ @@ -1469,10 +1490,10 @@ FF71..FF9D ; Katakana # Lo [45] HALFWIDTH KATAKANA LETTER A..HALFWIDTH KATAK # ================================================ 02EA..02EB ; Bopomofo # Sk [2] MODIFIER LETTER YIN DEPARTING TONE MARK..MODIFIER LETTER YANG DEPARTING TONE MARK -3105..312D ; Bopomofo # Lo [41] BOPOMOFO LETTER B..BOPOMOFO LETTER IH +3105..312E ; Bopomofo # Lo [42] BOPOMOFO LETTER B..BOPOMOFO LETTER O WITH DOT ABOVE 31A0..31BA ; Bopomofo # Lo [27] BOPOMOFO LETTER BU..BOPOMOFO LETTER ZY -# Total code points: 70 +# Total code points: 71 # ================================================ @@ -1485,16 +1506,17 @@ FF71..FF9D ; Katakana # Lo [45] HALFWIDTH KATAKANA LETTER A..HALFWIDTH KATAK 3038..303A ; Han # Nl [3] HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY 303B ; Han # Lm VERTICAL IDEOGRAPHIC ITERATION MARK 3400..4DB5 ; Han # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5 -4E00..9FD5 ; Han # Lo [20950] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FD5 +4E00..9FEA ; Han # Lo [20971] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FEA F900..FA6D ; Han # Lo [366] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA6D FA70..FAD9 ; Han # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9 20000..2A6D6 ; Han # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6 2A700..2B734 ; Han # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734 2B740..2B81D ; Han # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D 2B820..2CEA1 ; Han # Lo [5762] CJK UNIFIED IDEOGRAPH-2B820..CJK UNIFIED IDEOGRAPH-2CEA1 +2CEB0..2EBE0 ; Han # Lo [7473] CJK UNIFIED IDEOGRAPH-2CEB0..CJK UNIFIED IDEOGRAPH-2EBE0 2F800..2FA1D ; Han # Lo [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D -# Total code points: 81734 +# Total code points: 89228 # ================================================ @@ -1509,8 +1531,9 @@ A490..A4C6 ; Yi # So [55] YI RADICAL QOT..YI RADICAL KE 10300..1031F ; Old_Italic # Lo [32] OLD ITALIC LETTER A..OLD ITALIC LETTER ESS 10320..10323 ; Old_Italic # No [4] OLD ITALIC NUMERAL ONE..OLD ITALIC NUMERAL FIFTY +1032D..1032F ; Old_Italic # Lo [3] OLD ITALIC LETTER YE..OLD ITALIC LETTER SOUTHERN TSE -# Total code points: 36 +# Total code points: 39 # ================================================ @@ -1542,8 +1565,8 @@ A490..A4C6 ; Yi # So [55] YI RADICAL QOT..YI RADICAL KE 1CED ; Inherited # Mn VEDIC SIGN TIRYAK 1CF4 ; Inherited # Mn VEDIC TONE CANDRA ABOVE 1CF8..1CF9 ; Inherited # Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE -1DC0..1DF5 ; Inherited # Mn [54] COMBINING DOTTED GRAVE ACCENT..COMBINING UP TACK ABOVE -1DFC..1DFF ; Inherited # Mn [4] COMBINING DOUBLE INVERTED BREVE BELOW..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW +1DC0..1DF9 ; Inherited # Mn [58] COMBINING DOTTED GRAVE ACCENT..COMBINING WIDE INVERTED BRIDGE BELOW +1DFB..1DFF ; Inherited # Mn [5] COMBINING DELETION MARK..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW 200C..200D ; Inherited # Cf [2] ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER 20D0..20DC ; Inherited # Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE 20DD..20E0 ; Inherited # Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH @@ -1562,7 +1585,7 @@ FE20..FE2D ; Inherited # Mn [14] COMBINING LIGATURE LEFT HALF..COMBINING CON 1D1AA..1D1AD ; Inherited # Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO E0100..E01EF ; Inherited # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 -# Total code points: 563 +# Total code points: 568 # ================================================ @@ -1705,8 +1728,13 @@ E0100..E01EF ; Inherited # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-2 2C00..2C2E ; Glagolitic # L& [47] GLAGOLITIC CAPITAL LETTER AZU..GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE 2C30..2C5E ; Glagolitic # L& [47] GLAGOLITIC SMALL LETTER AZU..GLAGOLITIC SMALL LETTER LATINATE MYSLITE +1E000..1E006 ; Glagolitic # Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE +1E008..1E018 ; Glagolitic # Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU +1E01B..1E021 ; Glagolitic # Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI +1E023..1E024 ; Glagolitic # Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS +1E026..1E02A ; Glagolitic # Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA -# Total code points: 94 +# Total code points: 132 # ================================================ @@ -1872,11 +1900,11 @@ A62A..A62B ; Vai # Lo [2] VAI SYLLABLE NDOLE MA..VAI SYLLABLE NDOLE DO A880..A881 ; Saurashtra # Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA A882..A8B3 ; Saurashtra # Lo [50] SAURASHTRA LETTER A..SAURASHTRA LETTER LLA A8B4..A8C3 ; Saurashtra # Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU -A8C4 ; Saurashtra # Mn SAURASHTRA SIGN VIRAMA +A8C4..A8C5 ; Saurashtra # Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU A8CE..A8CF ; Saurashtra # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA A8D0..A8D9 ; Saurashtra # Nd [10] SAURASHTRA DIGIT ZERO..SAURASHTRA DIGIT NINE -# Total code points: 81 +# Total code points: 82 # ================================================ @@ -2314,8 +2342,9 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI 11235 ; Khojki # Mc KHOJKI SIGN VIRAMA 11236..11237 ; Khojki # Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA 11238..1123D ; Khojki # Po [6] KHOJKI DANDA..KHOJKI ABBREVIATION SIGN +1123E ; Khojki # Mn KHOJKI SIGN SUKUN -# Total code points: 61 +# Total code points: 62 # ================================================ @@ -2536,4 +2565,129 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI # Total code points: 672 +# ================================================ + +1E900..1E943 ; Adlam # L& [68] ADLAM CAPITAL LETTER ALIF..ADLAM SMALL LETTER SHA +1E944..1E94A ; Adlam # Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA +1E950..1E959 ; Adlam # Nd [10] ADLAM DIGIT ZERO..ADLAM DIGIT NINE +1E95E..1E95F ; Adlam # Po [2] ADLAM INITIAL EXCLAMATION MARK..ADLAM INITIAL QUESTION MARK + +# Total code points: 87 + +# ================================================ + +11C00..11C08 ; Bhaiksuki # Lo [9] BHAIKSUKI LETTER A..BHAIKSUKI LETTER VOCALIC L +11C0A..11C2E ; Bhaiksuki # Lo [37] BHAIKSUKI LETTER E..BHAIKSUKI LETTER HA +11C2F ; Bhaiksuki # Mc BHAIKSUKI VOWEL SIGN AA +11C30..11C36 ; Bhaiksuki # Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L +11C38..11C3D ; Bhaiksuki # Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA +11C3E ; Bhaiksuki # Mc BHAIKSUKI SIGN VISARGA +11C3F ; Bhaiksuki # Mn BHAIKSUKI SIGN VIRAMA +11C40 ; Bhaiksuki # Lo BHAIKSUKI SIGN AVAGRAHA +11C41..11C45 ; Bhaiksuki # Po [5] BHAIKSUKI DANDA..BHAIKSUKI GAP FILLER-2 +11C50..11C59 ; Bhaiksuki # Nd [10] BHAIKSUKI DIGIT ZERO..BHAIKSUKI DIGIT NINE +11C5A..11C6C ; Bhaiksuki # No [19] BHAIKSUKI NUMBER ONE..BHAIKSUKI HUNDREDS UNIT MARK + +# Total code points: 97 + +# ================================================ + +11C70..11C71 ; Marchen # Po [2] MARCHEN HEAD MARK..MARCHEN MARK SHAD +11C72..11C8F ; Marchen # Lo [30] MARCHEN LETTER KA..MARCHEN LETTER A +11C92..11CA7 ; Marchen # Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA +11CA9 ; Marchen # Mc MARCHEN SUBJOINED LETTER YA +11CAA..11CB0 ; Marchen # Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA +11CB1 ; Marchen # Mc MARCHEN VOWEL SIGN I +11CB2..11CB3 ; Marchen # Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E +11CB4 ; Marchen # Mc MARCHEN VOWEL SIGN O +11CB5..11CB6 ; Marchen # Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU + +# Total code points: 68 + +# ================================================ + +11400..11434 ; Newa # Lo [53] NEWA LETTER A..NEWA LETTER HA +11435..11437 ; Newa # Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II +11438..1143F ; Newa # Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI +11440..11441 ; Newa # Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU +11442..11444 ; Newa # Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA +11445 ; Newa # Mc NEWA SIGN VISARGA +11446 ; Newa # Mn NEWA SIGN NUKTA +11447..1144A ; Newa # Lo [4] NEWA SIGN AVAGRAHA..NEWA SIDDHI +1144B..1144F ; Newa # Po [5] NEWA DANDA..NEWA ABBREVIATION SIGN +11450..11459 ; Newa # Nd [10] NEWA DIGIT ZERO..NEWA DIGIT NINE +1145B ; Newa # Po NEWA PLACEHOLDER MARK +1145D ; Newa # Po NEWA INSERTION SIGN + +# Total code points: 92 + +# ================================================ + +104B0..104D3 ; Osage # L& [36] OSAGE CAPITAL LETTER A..OSAGE CAPITAL LETTER ZHA +104D8..104FB ; Osage # L& [36] OSAGE SMALL LETTER A..OSAGE SMALL LETTER ZHA + +# Total code points: 72 + +# ================================================ + +16FE0 ; Tangut # Lm TANGUT ITERATION MARK +17000..187EC ; Tangut # Lo [6125] TANGUT IDEOGRAPH-17000..TANGUT IDEOGRAPH-187EC +18800..18AF2 ; Tangut # Lo [755] TANGUT COMPONENT-001..TANGUT COMPONENT-755 + +# Total code points: 6881 + +# ================================================ + +11D00..11D06 ; Masaram_Gondi # Lo [7] MASARAM GONDI LETTER A..MASARAM GONDI LETTER E +11D08..11D09 ; Masaram_Gondi # Lo [2] MASARAM GONDI LETTER AI..MASARAM GONDI LETTER O +11D0B..11D30 ; Masaram_Gondi # Lo [38] MASARAM GONDI LETTER AU..MASARAM GONDI LETTER TRA +11D31..11D36 ; Masaram_Gondi # Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R +11D3A ; Masaram_Gondi # Mn MASARAM GONDI VOWEL SIGN E +11D3C..11D3D ; Masaram_Gondi # Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O +11D3F..11D45 ; Masaram_Gondi # Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA +11D46 ; Masaram_Gondi # Lo MASARAM GONDI REPHA +11D47 ; Masaram_Gondi # Mn MASARAM GONDI RA-KARA +11D50..11D59 ; Masaram_Gondi # Nd [10] MASARAM GONDI DIGIT ZERO..MASARAM GONDI DIGIT NINE + +# Total code points: 75 + +# ================================================ + +16FE1 ; Nushu # Lm NUSHU ITERATION MARK +1B170..1B2FB ; Nushu # Lo [396] NUSHU CHARACTER-1B170..NUSHU CHARACTER-1B2FB + +# Total code points: 397 + +# ================================================ + +11A50 ; Soyombo # Lo SOYOMBO LETTER A +11A51..11A56 ; Soyombo # Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE +11A57..11A58 ; Soyombo # Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU +11A59..11A5B ; Soyombo # Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK +11A5C..11A83 ; Soyombo # Lo [40] SOYOMBO LETTER KA..SOYOMBO LETTER KSSA +11A86..11A89 ; Soyombo # Lo [4] SOYOMBO CLUSTER-INITIAL LETTER RA..SOYOMBO CLUSTER-INITIAL LETTER SA +11A8A..11A96 ; Soyombo # Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA +11A97 ; Soyombo # Mc SOYOMBO SIGN VISARGA +11A98..11A99 ; Soyombo # Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER +11A9A..11A9C ; Soyombo # Po [3] SOYOMBO MARK TSHEG..SOYOMBO MARK DOUBLE SHAD +11A9E..11AA2 ; Soyombo # Po [5] SOYOMBO HEAD MARK WITH MOON AND SUN AND TRIPLE FLAME..SOYOMBO TERMINAL MARK-2 + +# Total code points: 80 + +# ================================================ + +11A00 ; Zanabazar_Square # Lo ZANABAZAR SQUARE LETTER A +11A01..11A06 ; Zanabazar_Square # Mn [6] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL SIGN O +11A07..11A08 ; Zanabazar_Square # Mc [2] ZANABAZAR SQUARE VOWEL SIGN AI..ZANABAZAR SQUARE VOWEL SIGN AU +11A09..11A0A ; Zanabazar_Square # Mn [2] ZANABAZAR SQUARE VOWEL SIGN REVERSED I..ZANABAZAR SQUARE VOWEL LENGTH MARK +11A0B..11A32 ; Zanabazar_Square # Lo [40] ZANABAZAR SQUARE LETTER KA..ZANABAZAR SQUARE LETTER KSSA +11A33..11A38 ; Zanabazar_Square # Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA +11A39 ; Zanabazar_Square # Mc ZANABAZAR SQUARE SIGN VISARGA +11A3A ; Zanabazar_Square # Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA +11A3B..11A3E ; Zanabazar_Square # Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA +11A3F..11A46 ; Zanabazar_Square # Po [8] ZANABAZAR SQUARE INITIAL HEAD MARK..ZANABAZAR SQUARE CLOSING DOUBLE-LINED HEAD MARK +11A47 ; Zanabazar_Square # Mn ZANABAZAR SQUARE SUBJOINER + +# Total code points: 72 + # EOF diff --git a/make/data/unicodedata/SpecialCasing.txt b/make/data/unicodedata/SpecialCasing.txt index 8de6462f18c..26c7ecd6ae1 100644 --- a/make/data/unicodedata/SpecialCasing.txt +++ b/make/data/unicodedata/SpecialCasing.txt @@ -1,10 +1,11 @@ -# SpecialCasing-8.0.0.txt -# Date: 2014-12-16, 23:08:04 GMT [MD] +# SpecialCasing-10.0.0.txt +# Date: 2017-04-14, 05:40:43 GMT +# Copyright (c) 2017 Unicode, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see http://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2014 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# For documentation, see http://www.unicode.org/reports/tr44/ +# For documentation, see http://www.unicode.org/reports/tr44/ # # Special Casing # @@ -196,7 +197,7 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH # ================================================================================ # Conditional Mappings -# The remainder of this file provides conditional casing data used to produce +# The remainder of this file provides conditional casing data used to produce # full case mappings. # ================================================================================ # Language-Insensitive Mappings diff --git a/make/data/unicodedata/UnicodeData.txt b/make/data/unicodedata/UnicodeData.txt index aa0e914f843..d89c64f526a 100644 --- a/make/data/unicodedata/UnicodeData.txt +++ b/make/data/unicodedata/UnicodeData.txt @@ -616,7 +616,7 @@ 0267;LATIN SMALL LETTER HENG WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER HENG HOOK;;;; 0268;LATIN SMALL LETTER I WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED I;;0197;;0197 0269;LATIN SMALL LETTER IOTA;Ll;0;L;;;;;N;;;0196;;0196 -026A;LATIN LETTER SMALL CAPITAL I;Ll;0;L;;;;;N;;;;; +026A;LATIN LETTER SMALL CAPITAL I;Ll;0;L;;;;;N;;;A7AE;;A7AE 026B;LATIN SMALL LETTER L WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;2C62;;2C62 026C;LATIN SMALL LETTER L WITH BELT;Ll;0;L;;;;;N;LATIN SMALL LETTER L BELT;;A7AD;;A7AD 026D;LATIN SMALL LETTER L WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER L RETROFLEX HOOK;;;; @@ -2072,6 +2072,17 @@ 085A;MANDAIC VOCALIZATION MARK;Mn;220;NSM;;;;;N;;;;; 085B;MANDAIC GEMINATION MARK;Mn;220;NSM;;;;;N;;;;; 085E;MANDAIC PUNCTUATION;Po;0;R;;;;;N;;;;; +0860;SYRIAC LETTER MALAYALAM NGA;Lo;0;AL;;;;;N;;;;; +0861;SYRIAC LETTER MALAYALAM JA;Lo;0;AL;;;;;N;;;;; +0862;SYRIAC LETTER MALAYALAM NYA;Lo;0;AL;;;;;N;;;;; +0863;SYRIAC LETTER MALAYALAM TTA;Lo;0;AL;;;;;N;;;;; +0864;SYRIAC LETTER MALAYALAM NNA;Lo;0;AL;;;;;N;;;;; +0865;SYRIAC LETTER MALAYALAM NNNA;Lo;0;AL;;;;;N;;;;; +0866;SYRIAC LETTER MALAYALAM BHA;Lo;0;AL;;;;;N;;;;; +0867;SYRIAC LETTER MALAYALAM RA;Lo;0;AL;;;;;N;;;;; +0868;SYRIAC LETTER MALAYALAM LLA;Lo;0;AL;;;;;N;;;;; +0869;SYRIAC LETTER MALAYALAM LLLA;Lo;0;AL;;;;;N;;;;; +086A;SYRIAC LETTER MALAYALAM SSA;Lo;0;AL;;;;;N;;;;; 08A0;ARABIC LETTER BEH WITH SMALL V BELOW;Lo;0;AL;;;;;N;;;;; 08A1;ARABIC LETTER BEH WITH HAMZA ABOVE;Lo;0;AL;;;;;N;;;;; 08A2;ARABIC LETTER JEEM WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; @@ -2093,6 +2104,29 @@ 08B2;ARABIC LETTER ZAIN WITH INVERTED V ABOVE;Lo;0;AL;;;;;N;;;;; 08B3;ARABIC LETTER AIN WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; 08B4;ARABIC LETTER KAF WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +08B6;ARABIC LETTER BEH WITH SMALL MEEM ABOVE;Lo;0;AL;;;;;N;;;;; +08B7;ARABIC LETTER PEH WITH SMALL MEEM ABOVE;Lo;0;AL;;;;;N;;;;; +08B8;ARABIC LETTER TEH WITH SMALL TEH ABOVE;Lo;0;AL;;;;;N;;;;; +08B9;ARABIC LETTER REH WITH SMALL NOON ABOVE;Lo;0;AL;;;;;N;;;;; +08BA;ARABIC LETTER YEH WITH TWO DOTS BELOW AND SMALL NOON ABOVE;Lo;0;AL;;;;;N;;;;; +08BB;ARABIC LETTER AFRICAN FEH;Lo;0;AL;;;;;N;;;;; +08BC;ARABIC LETTER AFRICAN QAF;Lo;0;AL;;;;;N;;;;; +08BD;ARABIC LETTER AFRICAN NOON;Lo;0;AL;;;;;N;;;;; +08D4;ARABIC SMALL HIGH WORD AR-RUB;Mn;230;NSM;;;;;N;;;;; +08D5;ARABIC SMALL HIGH SAD;Mn;230;NSM;;;;;N;;;;; +08D6;ARABIC SMALL HIGH AIN;Mn;230;NSM;;;;;N;;;;; +08D7;ARABIC SMALL HIGH QAF;Mn;230;NSM;;;;;N;;;;; +08D8;ARABIC SMALL HIGH NOON WITH KASRA;Mn;230;NSM;;;;;N;;;;; +08D9;ARABIC SMALL LOW NOON WITH KASRA;Mn;230;NSM;;;;;N;;;;; +08DA;ARABIC SMALL HIGH WORD ATH-THALATHA;Mn;230;NSM;;;;;N;;;;; +08DB;ARABIC SMALL HIGH WORD AS-SAJDA;Mn;230;NSM;;;;;N;;;;; +08DC;ARABIC SMALL HIGH WORD AN-NISF;Mn;230;NSM;;;;;N;;;;; +08DD;ARABIC SMALL HIGH WORD SAKTA;Mn;230;NSM;;;;;N;;;;; +08DE;ARABIC SMALL HIGH WORD QIF;Mn;230;NSM;;;;;N;;;;; +08DF;ARABIC SMALL HIGH WORD WAQFA;Mn;230;NSM;;;;;N;;;;; +08E0;ARABIC SMALL HIGH FOOTNOTE MARKER;Mn;230;NSM;;;;;N;;;;; +08E1;ARABIC SMALL HIGH SIGN SAFHA;Mn;230;NSM;;;;;N;;;;; +08E2;ARABIC DISPUTED END OF AYAH;Cf;0;AN;;;;;N;;;;; 08E3;ARABIC TURNED DAMMA BELOW;Mn;220;NSM;;;;;N;;;;; 08E4;ARABIC CURLY FATHA;Mn;230;NSM;;;;;N;;;;; 08E5;ARABIC CURLY DAMMA;Mn;230;NSM;;;;;N;;;;; @@ -2343,6 +2377,8 @@ 09F9;BENGALI CURRENCY DENOMINATOR SIXTEEN;No;0;L;;;;16;N;;;;; 09FA;BENGALI ISSHAR;So;0;L;;;;;N;;;;; 09FB;BENGALI GANDA MARK;Sc;0;ET;;;;;N;;;;; +09FC;BENGALI LETTER VEDIC ANUSVARA;Lo;0;L;;;;;N;;;;; +09FD;BENGALI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; 0A01;GURMUKHI SIGN ADAK BINDI;Mn;0;NSM;;;;;N;;;;; 0A02;GURMUKHI SIGN BINDI;Mn;0;NSM;;;;;N;;;;; 0A03;GURMUKHI SIGN VISARGA;Mc;0;L;;;;;N;;;;; @@ -2507,6 +2543,12 @@ 0AF0;GUJARATI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; 0AF1;GUJARATI RUPEE SIGN;Sc;0;ET;;;;;N;;;;; 0AF9;GUJARATI LETTER ZHA;Lo;0;L;;;;;N;;;;; +0AFA;GUJARATI SIGN SUKUN;Mn;0;NSM;;;;;N;;;;; +0AFB;GUJARATI SIGN SHADDA;Mn;0;NSM;;;;;N;;;;; +0AFC;GUJARATI SIGN MADDAH;Mn;0;NSM;;;;;N;;;;; +0AFD;GUJARATI SIGN THREE-DOT NUKTA ABOVE;Mn;0;NSM;;;;;N;;;;; +0AFE;GUJARATI SIGN CIRCLE NUKTA ABOVE;Mn;0;NSM;;;;;N;;;;; +0AFF;GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE;Mn;0;NSM;;;;;N;;;;; 0B01;ORIYA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; 0B02;ORIYA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; 0B03;ORIYA SIGN VISARGA;Mc;0;L;;;;;N;;;;; @@ -2765,6 +2807,7 @@ 0C7D;TELUGU FRACTION DIGIT TWO FOR EVEN POWERS OF FOUR;No;0;ON;;;;2;N;;;;; 0C7E;TELUGU FRACTION DIGIT THREE FOR EVEN POWERS OF FOUR;No;0;ON;;;;3;N;;;;; 0C7F;TELUGU SIGN TUUMU;So;0;L;;;;;N;;;;; +0C80;KANNADA SIGN SPACING CANDRABINDU;Lo;0;L;;;;;N;;;;; 0C81;KANNADA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; 0C82;KANNADA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; 0C83;KANNADA SIGN VISARGA;Mc;0;L;;;;;N;;;;; @@ -2852,6 +2895,7 @@ 0CEF;KANNADA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; 0CF1;KANNADA SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;; 0CF2;KANNADA SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;; +0D00;MALAYALAM SIGN COMBINING ANUSVARA ABOVE;Mn;0;NSM;;;;;N;;;;; 0D01;MALAYALAM SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; 0D02;MALAYALAM SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; 0D03;MALAYALAM SIGN VISARGA;Mc;0;L;;;;;N;;;;; @@ -2907,6 +2951,8 @@ 0D38;MALAYALAM LETTER SA;Lo;0;L;;;;;N;;;;; 0D39;MALAYALAM LETTER HA;Lo;0;L;;;;;N;;;;; 0D3A;MALAYALAM LETTER TTTA;Lo;0;L;;;;;N;;;;; +0D3B;MALAYALAM SIGN VERTICAL BAR VIRAMA;Mn;9;NSM;;;;;N;;;;; +0D3C;MALAYALAM SIGN CIRCULAR VIRAMA;Mn;9;NSM;;;;;N;;;;; 0D3D;MALAYALAM SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; 0D3E;MALAYALAM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; 0D3F;MALAYALAM VOWEL SIGN I;Mc;0;L;;;;;N;;;;; @@ -2923,7 +2969,18 @@ 0D4C;MALAYALAM VOWEL SIGN AU;Mc;0;L;0D46 0D57;;;;N;;;;; 0D4D;MALAYALAM SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; 0D4E;MALAYALAM LETTER DOT REPH;Lo;0;L;;;;;N;;;;; +0D4F;MALAYALAM SIGN PARA;So;0;L;;;;;N;;;;; +0D54;MALAYALAM LETTER CHILLU M;Lo;0;L;;;;;N;;;;; +0D55;MALAYALAM LETTER CHILLU Y;Lo;0;L;;;;;N;;;;; +0D56;MALAYALAM LETTER CHILLU LLL;Lo;0;L;;;;;N;;;;; 0D57;MALAYALAM AU LENGTH MARK;Mc;0;L;;;;;N;;;;; +0D58;MALAYALAM FRACTION ONE ONE-HUNDRED-AND-SIXTIETH;No;0;L;;;;1/160;N;;;;; +0D59;MALAYALAM FRACTION ONE FORTIETH;No;0;L;;;;1/40;N;;;;; +0D5A;MALAYALAM FRACTION THREE EIGHTIETHS;No;0;L;;;;3/80;N;;;;; +0D5B;MALAYALAM FRACTION ONE TWENTIETH;No;0;L;;;;1/20;N;;;;; +0D5C;MALAYALAM FRACTION ONE TENTH;No;0;L;;;;1/10;N;;;;; +0D5D;MALAYALAM FRACTION THREE TWENTIETHS;No;0;L;;;;3/20;N;;;;; +0D5E;MALAYALAM FRACTION ONE FIFTH;No;0;L;;;;1/5;N;;;;; 0D5F;MALAYALAM LETTER ARCHAIC II;Lo;0;L;;;;;N;;;;; 0D60;MALAYALAM LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; 0D61;MALAYALAM LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; @@ -2945,6 +3002,9 @@ 0D73;MALAYALAM FRACTION ONE QUARTER;No;0;L;;;;1/4;N;;;;; 0D74;MALAYALAM FRACTION ONE HALF;No;0;L;;;;1/2;N;;;;; 0D75;MALAYALAM FRACTION THREE QUARTERS;No;0;L;;;;3/4;N;;;;; +0D76;MALAYALAM FRACTION ONE SIXTEENTH;No;0;L;;;;1/16;N;;;;; +0D77;MALAYALAM FRACTION ONE EIGHTH;No;0;L;;;;1/8;N;;;;; +0D78;MALAYALAM FRACTION THREE SIXTEENTHS;No;0;L;;;;3/16;N;;;;; 0D79;MALAYALAM DATE MARK;So;0;L;;;;;N;;;;; 0D7A;MALAYALAM LETTER CHILLU NN;Lo;0;L;;;;;N;;;;; 0D7B;MALAYALAM LETTER CHILLU N;Lo;0;L;;;;;N;;;;; @@ -5458,8 +5518,8 @@ 1882;MONGOLIAN LETTER ALI GALI DAMARU;Lo;0;L;;;;;N;;;;; 1883;MONGOLIAN LETTER ALI GALI UBADAMA;Lo;0;L;;;;;N;;;;; 1884;MONGOLIAN LETTER ALI GALI INVERTED UBADAMA;Lo;0;L;;;;;N;;;;; -1885;MONGOLIAN LETTER ALI GALI BALUDA;Lo;0;L;;;;;N;;;;; -1886;MONGOLIAN LETTER ALI GALI THREE BALUDA;Lo;0;L;;;;;N;;;;; +1885;MONGOLIAN LETTER ALI GALI BALUDA;Mn;0;NSM;;;;;N;;;;; +1886;MONGOLIAN LETTER ALI GALI THREE BALUDA;Mn;0;NSM;;;;;N;;;;; 1887;MONGOLIAN LETTER ALI GALI A;Lo;0;L;;;;;N;;;;; 1888;MONGOLIAN LETTER ALI GALI I;Lo;0;L;;;;;N;;;;; 1889;MONGOLIAN LETTER ALI GALI KA;Lo;0;L;;;;;N;;;;; @@ -6319,6 +6379,15 @@ 1C7D;OL CHIKI AHAD;Lm;0;L;;;;;N;;;;; 1C7E;OL CHIKI PUNCTUATION MUCAAD;Po;0;L;;;;;N;;;;; 1C7F;OL CHIKI PUNCTUATION DOUBLE MUCAAD;Po;0;L;;;;;N;;;;; +1C80;CYRILLIC SMALL LETTER ROUNDED VE;Ll;0;L;;;;;N;;;0412;;0412 +1C81;CYRILLIC SMALL LETTER LONG-LEGGED DE;Ll;0;L;;;;;N;;;0414;;0414 +1C82;CYRILLIC SMALL LETTER NARROW O;Ll;0;L;;;;;N;;;041E;;041E +1C83;CYRILLIC SMALL LETTER WIDE ES;Ll;0;L;;;;;N;;;0421;;0421 +1C84;CYRILLIC SMALL LETTER TALL TE;Ll;0;L;;;;;N;;;0422;;0422 +1C85;CYRILLIC SMALL LETTER THREE-LEGGED TE;Ll;0;L;;;;;N;;;0422;;0422 +1C86;CYRILLIC SMALL LETTER TALL HARD SIGN;Ll;0;L;;;;;N;;;042A;;042A +1C87;CYRILLIC SMALL LETTER TALL YAT;Ll;0;L;;;;;N;;;0462;;0462 +1C88;CYRILLIC SMALL LETTER UNBLENDED UK;Ll;0;L;;;;;N;;;A64A;;A64A 1CC0;SUNDANESE PUNCTUATION BINDU SURYA;Po;0;L;;;;;N;;;;; 1CC1;SUNDANESE PUNCTUATION BINDU PANGLONG;Po;0;L;;;;;N;;;;; 1CC2;SUNDANESE PUNCTUATION BINDU PURNAMA;Po;0;L;;;;;N;;;;; @@ -6366,6 +6435,7 @@ 1CF4;VEDIC TONE CANDRA ABOVE;Mn;230;NSM;;;;;N;;;;; 1CF5;VEDIC SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;; 1CF6;VEDIC SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;; +1CF7;VEDIC SIGN ATIKRAMA;Mc;0;L;;;;;N;;;;; 1CF8;VEDIC TONE RING ABOVE;Mn;230;NSM;;;;;N;;;;; 1CF9;VEDIC TONE DOUBLE RING ABOVE;Mn;230;NSM;;;;;N;;;;; 1D00;LATIN LETTER SMALL CAPITAL A;Ll;0;L;;;;;N;;;;; @@ -6614,6 +6684,11 @@ 1DF3;COMBINING LATIN SMALL LETTER O WITH DIAERESIS;Mn;230;NSM;;;;;N;;;;; 1DF4;COMBINING LATIN SMALL LETTER U WITH DIAERESIS;Mn;230;NSM;;;;;N;;;;; 1DF5;COMBINING UP TACK ABOVE;Mn;230;NSM;;;;;N;;;;; +1DF6;COMBINING KAVYKA ABOVE RIGHT;Mn;232;NSM;;;;;N;;;;; +1DF7;COMBINING KAVYKA ABOVE LEFT;Mn;228;NSM;;;;;N;;;;; +1DF8;COMBINING DOT ABOVE LEFT;Mn;228;NSM;;;;;N;;;;; +1DF9;COMBINING WIDE INVERTED BRIDGE BELOW;Mn;220;NSM;;;;;N;;;;; +1DFB;COMBINING DELETION MARK;Mn;230;NSM;;;;;N;;;;; 1DFC;COMBINING DOUBLE INVERTED BREVE BELOW;Mn;233;NSM;;;;;N;;;;; 1DFD;COMBINING ALMOST EQUAL TO BELOW;Mn;220;NSM;;;;;N;;;;; 1DFE;COMBINING LEFT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;; @@ -7291,6 +7366,7 @@ 20BC;MANAT SIGN;Sc;0;ET;;;;;N;;;;; 20BD;RUBLE SIGN;Sc;0;ET;;;;;N;;;;; 20BE;LARI SIGN;Sc;0;ET;;;;;N;;;;; +20BF;BITCOIN SIGN;Sc;0;ET;;;;;N;;;;; 20D0;COMBINING LEFT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT HARPOON ABOVE;;;; 20D1;COMBINING RIGHT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT HARPOON ABOVE;;;; 20D2;COMBINING LONG VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG VERTICAL BAR OVERLAY;;;; @@ -8083,6 +8159,11 @@ 23F8;DOUBLE VERTICAL BAR;So;0;ON;;;;;N;;;;; 23F9;BLACK SQUARE FOR STOP;So;0;ON;;;;;N;;;;; 23FA;BLACK CIRCLE FOR RECORD;So;0;ON;;;;;N;;;;; +23FB;POWER SYMBOL;So;0;ON;;;;;N;;;;; +23FC;POWER ON-OFF SYMBOL;So;0;ON;;;;;N;;;;; +23FD;POWER ON SYMBOL;So;0;ON;;;;;N;;;;; +23FE;POWER SLEEP SYMBOL;So;0;ON;;;;;N;;;;; +23FF;OBSERVER EYE SYMBOL;So;0;ON;;;;;N;;;;; 2400;SYMBOL FOR NULL;So;0;ON;;;;;N;GRAPHIC FOR NULL;;;; 2401;SYMBOL FOR START OF HEADING;So;0;ON;;;;;N;GRAPHIC FOR START OF HEADING;;;; 2402;SYMBOL FOR START OF TEXT;So;0;ON;;;;;N;GRAPHIC FOR START OF TEXT;;;; @@ -10031,6 +10112,7 @@ 2BCF;ROTATED WHITE FOUR POINTED CUSP;So;0;ON;;;;;N;;;;; 2BD0;SQUARE POSITION INDICATOR;So;0;ON;;;;;N;;;;; 2BD1;UNCERTAINTY SIGN;So;0;ON;;;;;N;;;;; +2BD2;GROUP MARK;So;0;ON;;;;;N;;;;; 2BEC;LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; 2BED;UPWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; 2BEE;RIGHTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; @@ -10561,6 +10643,13 @@ 2E40;DOUBLE HYPHEN;Pd;0;ON;;;;;N;;;;; 2E41;REVERSED COMMA;Po;0;ON;;;;;N;;;;; 2E42;DOUBLE LOW-REVERSED-9 QUOTATION MARK;Ps;0;ON;;;;;N;;;;; +2E43;DASH WITH LEFT UPTURN;Po;0;ON;;;;;N;;;;; +2E44;DOUBLE SUSPENSION MARK;Po;0;ON;;;;;N;;;;; +2E45;INVERTED LOW KAVYKA;Po;0;ON;;;;;N;;;;; +2E46;INVERTED LOW KAVYKA WITH KAVYKA ABOVE;Po;0;ON;;;;;N;;;;; +2E47;LOW KAVYKA;Po;0;ON;;;;;N;;;;; +2E48;LOW KAVYKA WITH DOT;Po;0;ON;;;;;N;;;;; +2E49;DOUBLE STACKED COMMA;Po;0;ON;;;;;N;;;;; 2E80;CJK RADICAL REPEAT;So;0;ON;;;;;N;;;;; 2E81;CJK RADICAL CLIFF;So;0;ON;;;;;N;;;;; 2E82;CJK RADICAL SECOND ONE;So;0;ON;;;;;N;;;;; @@ -11196,6 +11285,7 @@ 312B;BOPOMOFO LETTER NG;Lo;0;L;;;;;N;;;;; 312C;BOPOMOFO LETTER GN;Lo;0;L;;;;;N;;;;; 312D;BOPOMOFO LETTER IH;Lo;0;L;;;;;N;;;;; +312E;BOPOMOFO LETTER O WITH DOT ABOVE;Lo;0;L;;;;;N;;;;; 3131;HANGUL LETTER KIYEOK;Lo;0;L; 1100;;;;N;HANGUL LETTER GIYEOG;;;; 3132;HANGUL LETTER SSANGKIYEOK;Lo;0;L; 1101;;;;N;HANGUL LETTER SSANG GIYEOG;;;; 3133;HANGUL LETTER KIYEOK-SIOS;Lo;0;L; 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;; @@ -11962,7 +12052,7 @@ 4DFE;HEXAGRAM FOR AFTER COMPLETION;So;0;ON;;;;;N;;;;; 4DFF;HEXAGRAM FOR BEFORE COMPLETION;So;0;ON;;;;;N;;;;; 4E00;;Lo;0;L;;;;;N;;;;; -9FD5;;Lo;0;L;;;;;N;;;;; +9FEA;;Lo;0;L;;;;;N;;;;; A000;YI SYLLABLE IT;Lo;0;L;;;;;N;;;;; A001;YI SYLLABLE IX;Lo;0;L;;;;;N;;;;; A002;YI SYLLABLE I;Lo;0;L;;;;;N;;;;; @@ -13889,6 +13979,7 @@ A7AA;LATIN CAPITAL LETTER H WITH HOOK;Lu;0;L;;;;;N;;;;0266; A7AB;LATIN CAPITAL LETTER REVERSED OPEN E;Lu;0;L;;;;;N;;;;025C; A7AC;LATIN CAPITAL LETTER SCRIPT G;Lu;0;L;;;;;N;;;;0261; A7AD;LATIN CAPITAL LETTER L WITH BELT;Lu;0;L;;;;;N;;;;026C; +A7AE;LATIN CAPITAL LETTER SMALL CAPITAL I;Lu;0;L;;;;;N;;;;026A; A7B0;LATIN CAPITAL LETTER TURNED K;Lu;0;L;;;;;N;;;;029E; A7B1;LATIN CAPITAL LETTER TURNED T;Lu;0;L;;;;;N;;;;0287; A7B2;LATIN CAPITAL LETTER J WITH CROSSED-TAIL;Lu;0;L;;;;;N;;;;029D; @@ -14085,6 +14176,7 @@ A8C1;SAURASHTRA VOWEL SIGN O;Mc;0;L;;;;;N;;;;; A8C2;SAURASHTRA VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; A8C3;SAURASHTRA VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; A8C4;SAURASHTRA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +A8C5;SAURASHTRA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; A8CE;SAURASHTRA DANDA;Po;0;L;;;;;N;;;;; A8CF;SAURASHTRA DOUBLE DANDA;Po;0;L;;;;;N;;;;; A8D0;SAURASHTRA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; @@ -16834,6 +16926,8 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1018A;GREEK ZERO SIGN;No;0;ON;;;;0;N;;;;; 1018B;GREEK ONE QUARTER SIGN;No;0;ON;;;;1/4;N;;;;; 1018C;GREEK SINUSOID SIGN;So;0;ON;;;;;N;;;;; +1018D;GREEK INDICTION SIGN;So;0;L;;;;;N;;;;; +1018E;NOMISMA SIGN;So;0;L;;;;;N;;;;; 10190;ROMAN SEXTANS SIGN;So;0;ON;;;;;N;;;;; 10191;ROMAN UNCIA SIGN;So;0;ON;;;;;N;;;;; 10192;ROMAN SEMUNCIA SIGN;So;0;ON;;;;;N;;;;; @@ -17035,6 +17129,9 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 10321;OLD ITALIC NUMERAL FIVE;No;0;L;;;;5;N;;;;; 10322;OLD ITALIC NUMERAL TEN;No;0;L;;;;10;N;;;;; 10323;OLD ITALIC NUMERAL FIFTY;No;0;L;;;;50;N;;;;; +1032D;OLD ITALIC LETTER YE;Lo;0;L;;;;;N;;;;; +1032E;OLD ITALIC LETTER NORTHERN TSE;Lo;0;L;;;;;N;;;;; +1032F;OLD ITALIC LETTER SOUTHERN TSE;Lo;0;L;;;;;N;;;;; 10330;GOTHIC LETTER AHSA;Lo;0;L;;;;;N;;;;; 10331;GOTHIC LETTER BAIRKAN;Lo;0;L;;;;;N;;;;; 10332;GOTHIC LETTER GIBA;Lo;0;L;;;;;N;;;;; @@ -17354,6 +17451,78 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 104A7;OSMANYA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; 104A8;OSMANYA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; 104A9;OSMANYA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +104B0;OSAGE CAPITAL LETTER A;Lu;0;L;;;;;N;;;;104D8; +104B1;OSAGE CAPITAL LETTER AI;Lu;0;L;;;;;N;;;;104D9; +104B2;OSAGE CAPITAL LETTER AIN;Lu;0;L;;;;;N;;;;104DA; +104B3;OSAGE CAPITAL LETTER AH;Lu;0;L;;;;;N;;;;104DB; +104B4;OSAGE CAPITAL LETTER BRA;Lu;0;L;;;;;N;;;;104DC; +104B5;OSAGE CAPITAL LETTER CHA;Lu;0;L;;;;;N;;;;104DD; +104B6;OSAGE CAPITAL LETTER EHCHA;Lu;0;L;;;;;N;;;;104DE; +104B7;OSAGE CAPITAL LETTER E;Lu;0;L;;;;;N;;;;104DF; +104B8;OSAGE CAPITAL LETTER EIN;Lu;0;L;;;;;N;;;;104E0; +104B9;OSAGE CAPITAL LETTER HA;Lu;0;L;;;;;N;;;;104E1; +104BA;OSAGE CAPITAL LETTER HYA;Lu;0;L;;;;;N;;;;104E2; +104BB;OSAGE CAPITAL LETTER I;Lu;0;L;;;;;N;;;;104E3; +104BC;OSAGE CAPITAL LETTER KA;Lu;0;L;;;;;N;;;;104E4; +104BD;OSAGE CAPITAL LETTER EHKA;Lu;0;L;;;;;N;;;;104E5; +104BE;OSAGE CAPITAL LETTER KYA;Lu;0;L;;;;;N;;;;104E6; +104BF;OSAGE CAPITAL LETTER LA;Lu;0;L;;;;;N;;;;104E7; +104C0;OSAGE CAPITAL LETTER MA;Lu;0;L;;;;;N;;;;104E8; +104C1;OSAGE CAPITAL LETTER NA;Lu;0;L;;;;;N;;;;104E9; +104C2;OSAGE CAPITAL LETTER O;Lu;0;L;;;;;N;;;;104EA; +104C3;OSAGE CAPITAL LETTER OIN;Lu;0;L;;;;;N;;;;104EB; +104C4;OSAGE CAPITAL LETTER PA;Lu;0;L;;;;;N;;;;104EC; +104C5;OSAGE CAPITAL LETTER EHPA;Lu;0;L;;;;;N;;;;104ED; +104C6;OSAGE CAPITAL LETTER SA;Lu;0;L;;;;;N;;;;104EE; +104C7;OSAGE CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;104EF; +104C8;OSAGE CAPITAL LETTER TA;Lu;0;L;;;;;N;;;;104F0; +104C9;OSAGE CAPITAL LETTER EHTA;Lu;0;L;;;;;N;;;;104F1; +104CA;OSAGE CAPITAL LETTER TSA;Lu;0;L;;;;;N;;;;104F2; +104CB;OSAGE CAPITAL LETTER EHTSA;Lu;0;L;;;;;N;;;;104F3; +104CC;OSAGE CAPITAL LETTER TSHA;Lu;0;L;;;;;N;;;;104F4; +104CD;OSAGE CAPITAL LETTER DHA;Lu;0;L;;;;;N;;;;104F5; +104CE;OSAGE CAPITAL LETTER U;Lu;0;L;;;;;N;;;;104F6; +104CF;OSAGE CAPITAL LETTER WA;Lu;0;L;;;;;N;;;;104F7; +104D0;OSAGE CAPITAL LETTER KHA;Lu;0;L;;;;;N;;;;104F8; +104D1;OSAGE CAPITAL LETTER GHA;Lu;0;L;;;;;N;;;;104F9; +104D2;OSAGE CAPITAL LETTER ZA;Lu;0;L;;;;;N;;;;104FA; +104D3;OSAGE CAPITAL LETTER ZHA;Lu;0;L;;;;;N;;;;104FB; +104D8;OSAGE SMALL LETTER A;Ll;0;L;;;;;N;;;104B0;;104B0 +104D9;OSAGE SMALL LETTER AI;Ll;0;L;;;;;N;;;104B1;;104B1 +104DA;OSAGE SMALL LETTER AIN;Ll;0;L;;;;;N;;;104B2;;104B2 +104DB;OSAGE SMALL LETTER AH;Ll;0;L;;;;;N;;;104B3;;104B3 +104DC;OSAGE SMALL LETTER BRA;Ll;0;L;;;;;N;;;104B4;;104B4 +104DD;OSAGE SMALL LETTER CHA;Ll;0;L;;;;;N;;;104B5;;104B5 +104DE;OSAGE SMALL LETTER EHCHA;Ll;0;L;;;;;N;;;104B6;;104B6 +104DF;OSAGE SMALL LETTER E;Ll;0;L;;;;;N;;;104B7;;104B7 +104E0;OSAGE SMALL LETTER EIN;Ll;0;L;;;;;N;;;104B8;;104B8 +104E1;OSAGE SMALL LETTER HA;Ll;0;L;;;;;N;;;104B9;;104B9 +104E2;OSAGE SMALL LETTER HYA;Ll;0;L;;;;;N;;;104BA;;104BA +104E3;OSAGE SMALL LETTER I;Ll;0;L;;;;;N;;;104BB;;104BB +104E4;OSAGE SMALL LETTER KA;Ll;0;L;;;;;N;;;104BC;;104BC +104E5;OSAGE SMALL LETTER EHKA;Ll;0;L;;;;;N;;;104BD;;104BD +104E6;OSAGE SMALL LETTER KYA;Ll;0;L;;;;;N;;;104BE;;104BE +104E7;OSAGE SMALL LETTER LA;Ll;0;L;;;;;N;;;104BF;;104BF +104E8;OSAGE SMALL LETTER MA;Ll;0;L;;;;;N;;;104C0;;104C0 +104E9;OSAGE SMALL LETTER NA;Ll;0;L;;;;;N;;;104C1;;104C1 +104EA;OSAGE SMALL LETTER O;Ll;0;L;;;;;N;;;104C2;;104C2 +104EB;OSAGE SMALL LETTER OIN;Ll;0;L;;;;;N;;;104C3;;104C3 +104EC;OSAGE SMALL LETTER PA;Ll;0;L;;;;;N;;;104C4;;104C4 +104ED;OSAGE SMALL LETTER EHPA;Ll;0;L;;;;;N;;;104C5;;104C5 +104EE;OSAGE SMALL LETTER SA;Ll;0;L;;;;;N;;;104C6;;104C6 +104EF;OSAGE SMALL LETTER SHA;Ll;0;L;;;;;N;;;104C7;;104C7 +104F0;OSAGE SMALL LETTER TA;Ll;0;L;;;;;N;;;104C8;;104C8 +104F1;OSAGE SMALL LETTER EHTA;Ll;0;L;;;;;N;;;104C9;;104C9 +104F2;OSAGE SMALL LETTER TSA;Ll;0;L;;;;;N;;;104CA;;104CA +104F3;OSAGE SMALL LETTER EHTSA;Ll;0;L;;;;;N;;;104CB;;104CB +104F4;OSAGE SMALL LETTER TSHA;Ll;0;L;;;;;N;;;104CC;;104CC +104F5;OSAGE SMALL LETTER DHA;Ll;0;L;;;;;N;;;104CD;;104CD +104F6;OSAGE SMALL LETTER U;Ll;0;L;;;;;N;;;104CE;;104CE +104F7;OSAGE SMALL LETTER WA;Ll;0;L;;;;;N;;;104CF;;104CF +104F8;OSAGE SMALL LETTER KHA;Ll;0;L;;;;;N;;;104D0;;104D0 +104F9;OSAGE SMALL LETTER GHA;Ll;0;L;;;;;N;;;104D1;;104D1 +104FA;OSAGE SMALL LETTER ZA;Ll;0;L;;;;;N;;;104D2;;104D2 +104FB;OSAGE SMALL LETTER ZHA;Ll;0;L;;;;;N;;;104D3;;104D3 10500;ELBASAN LETTER A;Lo;0;L;;;;;N;;;;; 10501;ELBASAN LETTER BE;Lo;0;L;;;;;N;;;;; 10502;ELBASAN LETTER CE;Lo;0;L;;;;;N;;;;; @@ -19180,6 +19349,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1123B;KHOJKI SECTION MARK;Po;0;L;;;;;N;;;;; 1123C;KHOJKI DOUBLE SECTION MARK;Po;0;L;;;;;N;;;;; 1123D;KHOJKI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +1123E;KHOJKI SIGN SUKUN;Mn;0;NSM;;;;;N;;;;; 11280;MULTANI LETTER A;Lo;0;L;;;;;N;;;;; 11281;MULTANI LETTER I;Lo;0;L;;;;;N;;;;; 11282;MULTANI LETTER U;Lo;0;L;;;;;N;;;;; @@ -19372,6 +19542,98 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 11372;COMBINING GRANTHA LETTER NA;Mn;230;NSM;;;;;N;;;;; 11373;COMBINING GRANTHA LETTER VI;Mn;230;NSM;;;;;N;;;;; 11374;COMBINING GRANTHA LETTER PA;Mn;230;NSM;;;;;N;;;;; +11400;NEWA LETTER A;Lo;0;L;;;;;N;;;;; +11401;NEWA LETTER AA;Lo;0;L;;;;;N;;;;; +11402;NEWA LETTER I;Lo;0;L;;;;;N;;;;; +11403;NEWA LETTER II;Lo;0;L;;;;;N;;;;; +11404;NEWA LETTER U;Lo;0;L;;;;;N;;;;; +11405;NEWA LETTER UU;Lo;0;L;;;;;N;;;;; +11406;NEWA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11407;NEWA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11408;NEWA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +11409;NEWA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1140A;NEWA LETTER E;Lo;0;L;;;;;N;;;;; +1140B;NEWA LETTER AI;Lo;0;L;;;;;N;;;;; +1140C;NEWA LETTER O;Lo;0;L;;;;;N;;;;; +1140D;NEWA LETTER AU;Lo;0;L;;;;;N;;;;; +1140E;NEWA LETTER KA;Lo;0;L;;;;;N;;;;; +1140F;NEWA LETTER KHA;Lo;0;L;;;;;N;;;;; +11410;NEWA LETTER GA;Lo;0;L;;;;;N;;;;; +11411;NEWA LETTER GHA;Lo;0;L;;;;;N;;;;; +11412;NEWA LETTER NGA;Lo;0;L;;;;;N;;;;; +11413;NEWA LETTER NGHA;Lo;0;L;;;;;N;;;;; +11414;NEWA LETTER CA;Lo;0;L;;;;;N;;;;; +11415;NEWA LETTER CHA;Lo;0;L;;;;;N;;;;; +11416;NEWA LETTER JA;Lo;0;L;;;;;N;;;;; +11417;NEWA LETTER JHA;Lo;0;L;;;;;N;;;;; +11418;NEWA LETTER NYA;Lo;0;L;;;;;N;;;;; +11419;NEWA LETTER NYHA;Lo;0;L;;;;;N;;;;; +1141A;NEWA LETTER TTA;Lo;0;L;;;;;N;;;;; +1141B;NEWA LETTER TTHA;Lo;0;L;;;;;N;;;;; +1141C;NEWA LETTER DDA;Lo;0;L;;;;;N;;;;; +1141D;NEWA LETTER DDHA;Lo;0;L;;;;;N;;;;; +1141E;NEWA LETTER NNA;Lo;0;L;;;;;N;;;;; +1141F;NEWA LETTER TA;Lo;0;L;;;;;N;;;;; +11420;NEWA LETTER THA;Lo;0;L;;;;;N;;;;; +11421;NEWA LETTER DA;Lo;0;L;;;;;N;;;;; +11422;NEWA LETTER DHA;Lo;0;L;;;;;N;;;;; +11423;NEWA LETTER NA;Lo;0;L;;;;;N;;;;; +11424;NEWA LETTER NHA;Lo;0;L;;;;;N;;;;; +11425;NEWA LETTER PA;Lo;0;L;;;;;N;;;;; +11426;NEWA LETTER PHA;Lo;0;L;;;;;N;;;;; +11427;NEWA LETTER BA;Lo;0;L;;;;;N;;;;; +11428;NEWA LETTER BHA;Lo;0;L;;;;;N;;;;; +11429;NEWA LETTER MA;Lo;0;L;;;;;N;;;;; +1142A;NEWA LETTER MHA;Lo;0;L;;;;;N;;;;; +1142B;NEWA LETTER YA;Lo;0;L;;;;;N;;;;; +1142C;NEWA LETTER RA;Lo;0;L;;;;;N;;;;; +1142D;NEWA LETTER RHA;Lo;0;L;;;;;N;;;;; +1142E;NEWA LETTER LA;Lo;0;L;;;;;N;;;;; +1142F;NEWA LETTER LHA;Lo;0;L;;;;;N;;;;; +11430;NEWA LETTER WA;Lo;0;L;;;;;N;;;;; +11431;NEWA LETTER SHA;Lo;0;L;;;;;N;;;;; +11432;NEWA LETTER SSA;Lo;0;L;;;;;N;;;;; +11433;NEWA LETTER SA;Lo;0;L;;;;;N;;;;; +11434;NEWA LETTER HA;Lo;0;L;;;;;N;;;;; +11435;NEWA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +11436;NEWA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +11437;NEWA VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +11438;NEWA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11439;NEWA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +1143A;NEWA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +1143B;NEWA VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +1143C;NEWA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +1143D;NEWA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +1143E;NEWA VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +1143F;NEWA VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11440;NEWA VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +11441;NEWA VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11442;NEWA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +11443;NEWA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11444;NEWA SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11445;NEWA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11446;NEWA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +11447;NEWA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +11448;NEWA SIGN FINAL ANUSVARA;Lo;0;L;;;;;N;;;;; +11449;NEWA OM;Lo;0;L;;;;;N;;;;; +1144A;NEWA SIDDHI;Lo;0;L;;;;;N;;;;; +1144B;NEWA DANDA;Po;0;L;;;;;N;;;;; +1144C;NEWA DOUBLE DANDA;Po;0;L;;;;;N;;;;; +1144D;NEWA COMMA;Po;0;L;;;;;N;;;;; +1144E;NEWA GAP FILLER;Po;0;L;;;;;N;;;;; +1144F;NEWA ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +11450;NEWA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11451;NEWA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11452;NEWA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11453;NEWA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11454;NEWA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11455;NEWA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11456;NEWA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11457;NEWA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11458;NEWA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11459;NEWA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1145B;NEWA PLACEHOLDER MARK;Po;0;L;;;;;N;;;;; +1145D;NEWA INSERTION SIGN;Po;0;L;;;;;N;;;;; 11480;TIRHUTA ANJI;Lo;0;L;;;;;N;;;;; 11481;TIRHUTA LETTER A;Lo;0;L;;;;;N;;;;; 11482;TIRHUTA LETTER AA;Lo;0;L;;;;;N;;;;; @@ -19625,6 +19887,19 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 11657;MODI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; 11658;MODI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; 11659;MODI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11660;MONGOLIAN BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11661;MONGOLIAN ROTATED BIRGA;Po;0;ON;;;;;N;;;;; +11662;MONGOLIAN DOUBLE BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11663;MONGOLIAN TRIPLE BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11664;MONGOLIAN BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11665;MONGOLIAN ROTATED BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11666;MONGOLIAN ROTATED BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11667;MONGOLIAN INVERTED BIRGA;Po;0;ON;;;;;N;;;;; +11668;MONGOLIAN INVERTED BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11669;MONGOLIAN SWIRL BIRGA;Po;0;ON;;;;;N;;;;; +1166A;MONGOLIAN SWIRL BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +1166B;MONGOLIAN SWIRL BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +1166C;MONGOLIAN TURNED SWIRL BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; 11680;TAKRI LETTER A;Lo;0;L;;;;;N;;;;; 11681;TAKRI LETTER AA;Lo;0;L;;;;;N;;;;; 11682;TAKRI LETTER I;Lo;0;L;;;;;N;;;;; @@ -19832,6 +20107,158 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 118F1;WARANG CITI NUMBER EIGHTY;No;0;L;;;;80;N;;;;; 118F2;WARANG CITI NUMBER NINETY;No;0;L;;;;90;N;;;;; 118FF;WARANG CITI OM;Lo;0;L;;;;;N;;;;; +11A00;ZANABAZAR SQUARE LETTER A;Lo;0;L;;;;;N;;;;; +11A01;ZANABAZAR SQUARE VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11A02;ZANABAZAR SQUARE VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +11A03;ZANABAZAR SQUARE VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11A04;ZANABAZAR SQUARE VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11A05;ZANABAZAR SQUARE VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;; +11A06;ZANABAZAR SQUARE VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11A07;ZANABAZAR SQUARE VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +11A08;ZANABAZAR SQUARE VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11A09;ZANABAZAR SQUARE VOWEL SIGN REVERSED I;Mn;0;NSM;;;;;N;;;;; +11A0A;ZANABAZAR SQUARE VOWEL LENGTH MARK;Mn;0;NSM;;;;;N;;;;; +11A0B;ZANABAZAR SQUARE LETTER KA;Lo;0;L;;;;;N;;;;; +11A0C;ZANABAZAR SQUARE LETTER KHA;Lo;0;L;;;;;N;;;;; +11A0D;ZANABAZAR SQUARE LETTER GA;Lo;0;L;;;;;N;;;;; +11A0E;ZANABAZAR SQUARE LETTER GHA;Lo;0;L;;;;;N;;;;; +11A0F;ZANABAZAR SQUARE LETTER NGA;Lo;0;L;;;;;N;;;;; +11A10;ZANABAZAR SQUARE LETTER CA;Lo;0;L;;;;;N;;;;; +11A11;ZANABAZAR SQUARE LETTER CHA;Lo;0;L;;;;;N;;;;; +11A12;ZANABAZAR SQUARE LETTER JA;Lo;0;L;;;;;N;;;;; +11A13;ZANABAZAR SQUARE LETTER NYA;Lo;0;L;;;;;N;;;;; +11A14;ZANABAZAR SQUARE LETTER TTA;Lo;0;L;;;;;N;;;;; +11A15;ZANABAZAR SQUARE LETTER TTHA;Lo;0;L;;;;;N;;;;; +11A16;ZANABAZAR SQUARE LETTER DDA;Lo;0;L;;;;;N;;;;; +11A17;ZANABAZAR SQUARE LETTER DDHA;Lo;0;L;;;;;N;;;;; +11A18;ZANABAZAR SQUARE LETTER NNA;Lo;0;L;;;;;N;;;;; +11A19;ZANABAZAR SQUARE LETTER TA;Lo;0;L;;;;;N;;;;; +11A1A;ZANABAZAR SQUARE LETTER THA;Lo;0;L;;;;;N;;;;; +11A1B;ZANABAZAR SQUARE LETTER DA;Lo;0;L;;;;;N;;;;; +11A1C;ZANABAZAR SQUARE LETTER DHA;Lo;0;L;;;;;N;;;;; +11A1D;ZANABAZAR SQUARE LETTER NA;Lo;0;L;;;;;N;;;;; +11A1E;ZANABAZAR SQUARE LETTER PA;Lo;0;L;;;;;N;;;;; +11A1F;ZANABAZAR SQUARE LETTER PHA;Lo;0;L;;;;;N;;;;; +11A20;ZANABAZAR SQUARE LETTER BA;Lo;0;L;;;;;N;;;;; +11A21;ZANABAZAR SQUARE LETTER BHA;Lo;0;L;;;;;N;;;;; +11A22;ZANABAZAR SQUARE LETTER MA;Lo;0;L;;;;;N;;;;; +11A23;ZANABAZAR SQUARE LETTER TSA;Lo;0;L;;;;;N;;;;; +11A24;ZANABAZAR SQUARE LETTER TSHA;Lo;0;L;;;;;N;;;;; +11A25;ZANABAZAR SQUARE LETTER DZA;Lo;0;L;;;;;N;;;;; +11A26;ZANABAZAR SQUARE LETTER DZHA;Lo;0;L;;;;;N;;;;; +11A27;ZANABAZAR SQUARE LETTER ZHA;Lo;0;L;;;;;N;;;;; +11A28;ZANABAZAR SQUARE LETTER ZA;Lo;0;L;;;;;N;;;;; +11A29;ZANABAZAR SQUARE LETTER -A;Lo;0;L;;;;;N;;;;; +11A2A;ZANABAZAR SQUARE LETTER YA;Lo;0;L;;;;;N;;;;; +11A2B;ZANABAZAR SQUARE LETTER RA;Lo;0;L;;;;;N;;;;; +11A2C;ZANABAZAR SQUARE LETTER LA;Lo;0;L;;;;;N;;;;; +11A2D;ZANABAZAR SQUARE LETTER VA;Lo;0;L;;;;;N;;;;; +11A2E;ZANABAZAR SQUARE LETTER SHA;Lo;0;L;;;;;N;;;;; +11A2F;ZANABAZAR SQUARE LETTER SSA;Lo;0;L;;;;;N;;;;; +11A30;ZANABAZAR SQUARE LETTER SA;Lo;0;L;;;;;N;;;;; +11A31;ZANABAZAR SQUARE LETTER HA;Lo;0;L;;;;;N;;;;; +11A32;ZANABAZAR SQUARE LETTER KSSA;Lo;0;L;;;;;N;;;;; +11A33;ZANABAZAR SQUARE FINAL CONSONANT MARK;Mn;0;NSM;;;;;N;;;;; +11A34;ZANABAZAR SQUARE SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +11A35;ZANABAZAR SQUARE SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11A36;ZANABAZAR SQUARE SIGN CANDRABINDU WITH ORNAMENT;Mn;0;NSM;;;;;N;;;;; +11A37;ZANABAZAR SQUARE SIGN CANDRA WITH ORNAMENT;Mn;0;NSM;;;;;N;;;;; +11A38;ZANABAZAR SQUARE SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11A39;ZANABAZAR SQUARE SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11A3A;ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA;Lo;0;L;;;;;N;;;;; +11A3B;ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA;Mn;0;NSM;;;;;N;;;;; +11A3C;ZANABAZAR SQUARE CLUSTER-FINAL LETTER RA;Mn;0;NSM;;;;;N;;;;; +11A3D;ZANABAZAR SQUARE CLUSTER-FINAL LETTER LA;Mn;0;NSM;;;;;N;;;;; +11A3E;ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA;Mn;0;NSM;;;;;N;;;;; +11A3F;ZANABAZAR SQUARE INITIAL HEAD MARK;Po;0;L;;;;;N;;;;; +11A40;ZANABAZAR SQUARE CLOSING HEAD MARK;Po;0;L;;;;;N;;;;; +11A41;ZANABAZAR SQUARE MARK TSHEG;Po;0;L;;;;;N;;;;; +11A42;ZANABAZAR SQUARE MARK SHAD;Po;0;L;;;;;N;;;;; +11A43;ZANABAZAR SQUARE MARK DOUBLE SHAD;Po;0;L;;;;;N;;;;; +11A44;ZANABAZAR SQUARE MARK LONG TSHEG;Po;0;L;;;;;N;;;;; +11A45;ZANABAZAR SQUARE INITIAL DOUBLE-LINED HEAD MARK;Po;0;L;;;;;N;;;;; +11A46;ZANABAZAR SQUARE CLOSING DOUBLE-LINED HEAD MARK;Po;0;L;;;;;N;;;;; +11A47;ZANABAZAR SQUARE SUBJOINER;Mn;9;NSM;;;;;N;;;;; +11A50;SOYOMBO LETTER A;Lo;0;L;;;;;N;;;;; +11A51;SOYOMBO VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11A52;SOYOMBO VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +11A53;SOYOMBO VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11A54;SOYOMBO VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11A55;SOYOMBO VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11A56;SOYOMBO VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;; +11A57;SOYOMBO VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +11A58;SOYOMBO VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11A59;SOYOMBO VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11A5A;SOYOMBO VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +11A5B;SOYOMBO VOWEL LENGTH MARK;Mn;0;NSM;;;;;N;;;;; +11A5C;SOYOMBO LETTER KA;Lo;0;L;;;;;N;;;;; +11A5D;SOYOMBO LETTER KHA;Lo;0;L;;;;;N;;;;; +11A5E;SOYOMBO LETTER GA;Lo;0;L;;;;;N;;;;; +11A5F;SOYOMBO LETTER GHA;Lo;0;L;;;;;N;;;;; +11A60;SOYOMBO LETTER NGA;Lo;0;L;;;;;N;;;;; +11A61;SOYOMBO LETTER CA;Lo;0;L;;;;;N;;;;; +11A62;SOYOMBO LETTER CHA;Lo;0;L;;;;;N;;;;; +11A63;SOYOMBO LETTER JA;Lo;0;L;;;;;N;;;;; +11A64;SOYOMBO LETTER JHA;Lo;0;L;;;;;N;;;;; +11A65;SOYOMBO LETTER NYA;Lo;0;L;;;;;N;;;;; +11A66;SOYOMBO LETTER TTA;Lo;0;L;;;;;N;;;;; +11A67;SOYOMBO LETTER TTHA;Lo;0;L;;;;;N;;;;; +11A68;SOYOMBO LETTER DDA;Lo;0;L;;;;;N;;;;; +11A69;SOYOMBO LETTER DDHA;Lo;0;L;;;;;N;;;;; +11A6A;SOYOMBO LETTER NNA;Lo;0;L;;;;;N;;;;; +11A6B;SOYOMBO LETTER TA;Lo;0;L;;;;;N;;;;; +11A6C;SOYOMBO LETTER THA;Lo;0;L;;;;;N;;;;; +11A6D;SOYOMBO LETTER DA;Lo;0;L;;;;;N;;;;; +11A6E;SOYOMBO LETTER DHA;Lo;0;L;;;;;N;;;;; +11A6F;SOYOMBO LETTER NA;Lo;0;L;;;;;N;;;;; +11A70;SOYOMBO LETTER PA;Lo;0;L;;;;;N;;;;; +11A71;SOYOMBO LETTER PHA;Lo;0;L;;;;;N;;;;; +11A72;SOYOMBO LETTER BA;Lo;0;L;;;;;N;;;;; +11A73;SOYOMBO LETTER BHA;Lo;0;L;;;;;N;;;;; +11A74;SOYOMBO LETTER MA;Lo;0;L;;;;;N;;;;; +11A75;SOYOMBO LETTER TSA;Lo;0;L;;;;;N;;;;; +11A76;SOYOMBO LETTER TSHA;Lo;0;L;;;;;N;;;;; +11A77;SOYOMBO LETTER DZA;Lo;0;L;;;;;N;;;;; +11A78;SOYOMBO LETTER ZHA;Lo;0;L;;;;;N;;;;; +11A79;SOYOMBO LETTER ZA;Lo;0;L;;;;;N;;;;; +11A7A;SOYOMBO LETTER -A;Lo;0;L;;;;;N;;;;; +11A7B;SOYOMBO LETTER YA;Lo;0;L;;;;;N;;;;; +11A7C;SOYOMBO LETTER RA;Lo;0;L;;;;;N;;;;; +11A7D;SOYOMBO LETTER LA;Lo;0;L;;;;;N;;;;; +11A7E;SOYOMBO LETTER VA;Lo;0;L;;;;;N;;;;; +11A7F;SOYOMBO LETTER SHA;Lo;0;L;;;;;N;;;;; +11A80;SOYOMBO LETTER SSA;Lo;0;L;;;;;N;;;;; +11A81;SOYOMBO LETTER SA;Lo;0;L;;;;;N;;;;; +11A82;SOYOMBO LETTER HA;Lo;0;L;;;;;N;;;;; +11A83;SOYOMBO LETTER KSSA;Lo;0;L;;;;;N;;;;; +11A86;SOYOMBO CLUSTER-INITIAL LETTER RA;Lo;0;L;;;;;N;;;;; +11A87;SOYOMBO CLUSTER-INITIAL LETTER LA;Lo;0;L;;;;;N;;;;; +11A88;SOYOMBO CLUSTER-INITIAL LETTER SHA;Lo;0;L;;;;;N;;;;; +11A89;SOYOMBO CLUSTER-INITIAL LETTER SA;Lo;0;L;;;;;N;;;;; +11A8A;SOYOMBO FINAL CONSONANT SIGN G;Mn;0;NSM;;;;;N;;;;; +11A8B;SOYOMBO FINAL CONSONANT SIGN K;Mn;0;NSM;;;;;N;;;;; +11A8C;SOYOMBO FINAL CONSONANT SIGN NG;Mn;0;NSM;;;;;N;;;;; +11A8D;SOYOMBO FINAL CONSONANT SIGN D;Mn;0;NSM;;;;;N;;;;; +11A8E;SOYOMBO FINAL CONSONANT SIGN N;Mn;0;NSM;;;;;N;;;;; +11A8F;SOYOMBO FINAL CONSONANT SIGN B;Mn;0;NSM;;;;;N;;;;; +11A90;SOYOMBO FINAL CONSONANT SIGN M;Mn;0;NSM;;;;;N;;;;; +11A91;SOYOMBO FINAL CONSONANT SIGN R;Mn;0;NSM;;;;;N;;;;; +11A92;SOYOMBO FINAL CONSONANT SIGN L;Mn;0;NSM;;;;;N;;;;; +11A93;SOYOMBO FINAL CONSONANT SIGN SH;Mn;0;NSM;;;;;N;;;;; +11A94;SOYOMBO FINAL CONSONANT SIGN S;Mn;0;NSM;;;;;N;;;;; +11A95;SOYOMBO FINAL CONSONANT SIGN -A;Mn;0;NSM;;;;;N;;;;; +11A96;SOYOMBO SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11A97;SOYOMBO SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11A98;SOYOMBO GEMINATION MARK;Mn;0;NSM;;;;;N;;;;; +11A99;SOYOMBO SUBJOINER;Mn;9;NSM;;;;;N;;;;; +11A9A;SOYOMBO MARK TSHEG;Po;0;L;;;;;N;;;;; +11A9B;SOYOMBO MARK SHAD;Po;0;L;;;;;N;;;;; +11A9C;SOYOMBO MARK DOUBLE SHAD;Po;0;L;;;;;N;;;;; +11A9E;SOYOMBO HEAD MARK WITH MOON AND SUN AND TRIPLE FLAME;Po;0;L;;;;;N;;;;; +11A9F;SOYOMBO HEAD MARK WITH MOON AND SUN AND FLAME;Po;0;L;;;;;N;;;;; +11AA0;SOYOMBO HEAD MARK WITH MOON AND SUN;Po;0;L;;;;;N;;;;; +11AA1;SOYOMBO TERMINAL MARK-1;Po;0;L;;;;;N;;;;; +11AA2;SOYOMBO TERMINAL MARK-2;Po;0;L;;;;;N;;;;; 11AC0;PAU CIN HAU LETTER PA;Lo;0;L;;;;;N;;;;; 11AC1;PAU CIN HAU LETTER KA;Lo;0;L;;;;;N;;;;; 11AC2;PAU CIN HAU LETTER LA;Lo;0;L;;;;;N;;;;; @@ -19889,6 +20316,246 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 11AF6;PAU CIN HAU LOW-FALLING TONE LONG FINAL;Lo;0;L;;;;;N;;;;; 11AF7;PAU CIN HAU LOW-FALLING TONE FINAL;Lo;0;L;;;;;N;;;;; 11AF8;PAU CIN HAU GLOTTAL STOP FINAL;Lo;0;L;;;;;N;;;;; +11C00;BHAIKSUKI LETTER A;Lo;0;L;;;;;N;;;;; +11C01;BHAIKSUKI LETTER AA;Lo;0;L;;;;;N;;;;; +11C02;BHAIKSUKI LETTER I;Lo;0;L;;;;;N;;;;; +11C03;BHAIKSUKI LETTER II;Lo;0;L;;;;;N;;;;; +11C04;BHAIKSUKI LETTER U;Lo;0;L;;;;;N;;;;; +11C05;BHAIKSUKI LETTER UU;Lo;0;L;;;;;N;;;;; +11C06;BHAIKSUKI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11C07;BHAIKSUKI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11C08;BHAIKSUKI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +11C0A;BHAIKSUKI LETTER E;Lo;0;L;;;;;N;;;;; +11C0B;BHAIKSUKI LETTER AI;Lo;0;L;;;;;N;;;;; +11C0C;BHAIKSUKI LETTER O;Lo;0;L;;;;;N;;;;; +11C0D;BHAIKSUKI LETTER AU;Lo;0;L;;;;;N;;;;; +11C0E;BHAIKSUKI LETTER KA;Lo;0;L;;;;;N;;;;; +11C0F;BHAIKSUKI LETTER KHA;Lo;0;L;;;;;N;;;;; +11C10;BHAIKSUKI LETTER GA;Lo;0;L;;;;;N;;;;; +11C11;BHAIKSUKI LETTER GHA;Lo;0;L;;;;;N;;;;; +11C12;BHAIKSUKI LETTER NGA;Lo;0;L;;;;;N;;;;; +11C13;BHAIKSUKI LETTER CA;Lo;0;L;;;;;N;;;;; +11C14;BHAIKSUKI LETTER CHA;Lo;0;L;;;;;N;;;;; +11C15;BHAIKSUKI LETTER JA;Lo;0;L;;;;;N;;;;; +11C16;BHAIKSUKI LETTER JHA;Lo;0;L;;;;;N;;;;; +11C17;BHAIKSUKI LETTER NYA;Lo;0;L;;;;;N;;;;; +11C18;BHAIKSUKI LETTER TTA;Lo;0;L;;;;;N;;;;; +11C19;BHAIKSUKI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11C1A;BHAIKSUKI LETTER DDA;Lo;0;L;;;;;N;;;;; +11C1B;BHAIKSUKI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11C1C;BHAIKSUKI LETTER NNA;Lo;0;L;;;;;N;;;;; +11C1D;BHAIKSUKI LETTER TA;Lo;0;L;;;;;N;;;;; +11C1E;BHAIKSUKI LETTER THA;Lo;0;L;;;;;N;;;;; +11C1F;BHAIKSUKI LETTER DA;Lo;0;L;;;;;N;;;;; +11C20;BHAIKSUKI LETTER DHA;Lo;0;L;;;;;N;;;;; +11C21;BHAIKSUKI LETTER NA;Lo;0;L;;;;;N;;;;; +11C22;BHAIKSUKI LETTER PA;Lo;0;L;;;;;N;;;;; +11C23;BHAIKSUKI LETTER PHA;Lo;0;L;;;;;N;;;;; +11C24;BHAIKSUKI LETTER BA;Lo;0;L;;;;;N;;;;; +11C25;BHAIKSUKI LETTER BHA;Lo;0;L;;;;;N;;;;; +11C26;BHAIKSUKI LETTER MA;Lo;0;L;;;;;N;;;;; +11C27;BHAIKSUKI LETTER YA;Lo;0;L;;;;;N;;;;; +11C28;BHAIKSUKI LETTER RA;Lo;0;L;;;;;N;;;;; +11C29;BHAIKSUKI LETTER LA;Lo;0;L;;;;;N;;;;; +11C2A;BHAIKSUKI LETTER VA;Lo;0;L;;;;;N;;;;; +11C2B;BHAIKSUKI LETTER SHA;Lo;0;L;;;;;N;;;;; +11C2C;BHAIKSUKI LETTER SSA;Lo;0;L;;;;;N;;;;; +11C2D;BHAIKSUKI LETTER SA;Lo;0;L;;;;;N;;;;; +11C2E;BHAIKSUKI LETTER HA;Lo;0;L;;;;;N;;;;; +11C2F;BHAIKSUKI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +11C30;BHAIKSUKI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11C31;BHAIKSUKI VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +11C32;BHAIKSUKI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11C33;BHAIKSUKI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +11C34;BHAIKSUKI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11C35;BHAIKSUKI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +11C36;BHAIKSUKI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +11C38;BHAIKSUKI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11C39;BHAIKSUKI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11C3A;BHAIKSUKI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11C3B;BHAIKSUKI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +11C3C;BHAIKSUKI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11C3D;BHAIKSUKI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11C3E;BHAIKSUKI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11C3F;BHAIKSUKI SIGN VIRAMA;Mn;9;L;;;;;N;;;;; +11C40;BHAIKSUKI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +11C41;BHAIKSUKI DANDA;Po;0;L;;;;;N;;;;; +11C42;BHAIKSUKI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +11C43;BHAIKSUKI WORD SEPARATOR;Po;0;L;;;;;N;;;;; +11C44;BHAIKSUKI GAP FILLER-1;Po;0;L;;;;;N;;;;; +11C45;BHAIKSUKI GAP FILLER-2;Po;0;L;;;;;N;;;;; +11C50;BHAIKSUKI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11C51;BHAIKSUKI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11C52;BHAIKSUKI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11C53;BHAIKSUKI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11C54;BHAIKSUKI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11C55;BHAIKSUKI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11C56;BHAIKSUKI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11C57;BHAIKSUKI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11C58;BHAIKSUKI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11C59;BHAIKSUKI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11C5A;BHAIKSUKI NUMBER ONE;No;0;L;;;;1;N;;;;; +11C5B;BHAIKSUKI NUMBER TWO;No;0;L;;;;2;N;;;;; +11C5C;BHAIKSUKI NUMBER THREE;No;0;L;;;;3;N;;;;; +11C5D;BHAIKSUKI NUMBER FOUR;No;0;L;;;;4;N;;;;; +11C5E;BHAIKSUKI NUMBER FIVE;No;0;L;;;;5;N;;;;; +11C5F;BHAIKSUKI NUMBER SIX;No;0;L;;;;6;N;;;;; +11C60;BHAIKSUKI NUMBER SEVEN;No;0;L;;;;7;N;;;;; +11C61;BHAIKSUKI NUMBER EIGHT;No;0;L;;;;8;N;;;;; +11C62;BHAIKSUKI NUMBER NINE;No;0;L;;;;9;N;;;;; +11C63;BHAIKSUKI NUMBER TEN;No;0;L;;;;10;N;;;;; +11C64;BHAIKSUKI NUMBER TWENTY;No;0;L;;;;20;N;;;;; +11C65;BHAIKSUKI NUMBER THIRTY;No;0;L;;;;30;N;;;;; +11C66;BHAIKSUKI NUMBER FORTY;No;0;L;;;;40;N;;;;; +11C67;BHAIKSUKI NUMBER FIFTY;No;0;L;;;;50;N;;;;; +11C68;BHAIKSUKI NUMBER SIXTY;No;0;L;;;;60;N;;;;; +11C69;BHAIKSUKI NUMBER SEVENTY;No;0;L;;;;70;N;;;;; +11C6A;BHAIKSUKI NUMBER EIGHTY;No;0;L;;;;80;N;;;;; +11C6B;BHAIKSUKI NUMBER NINETY;No;0;L;;;;90;N;;;;; +11C6C;BHAIKSUKI HUNDREDS UNIT MARK;No;0;L;;;;100;N;;;;; +11C70;MARCHEN HEAD MARK;Po;0;L;;;;;N;;;;; +11C71;MARCHEN MARK SHAD;Po;0;L;;;;;N;;;;; +11C72;MARCHEN LETTER KA;Lo;0;L;;;;;N;;;;; +11C73;MARCHEN LETTER KHA;Lo;0;L;;;;;N;;;;; +11C74;MARCHEN LETTER GA;Lo;0;L;;;;;N;;;;; +11C75;MARCHEN LETTER NGA;Lo;0;L;;;;;N;;;;; +11C76;MARCHEN LETTER CA;Lo;0;L;;;;;N;;;;; +11C77;MARCHEN LETTER CHA;Lo;0;L;;;;;N;;;;; +11C78;MARCHEN LETTER JA;Lo;0;L;;;;;N;;;;; +11C79;MARCHEN LETTER NYA;Lo;0;L;;;;;N;;;;; +11C7A;MARCHEN LETTER TA;Lo;0;L;;;;;N;;;;; +11C7B;MARCHEN LETTER THA;Lo;0;L;;;;;N;;;;; +11C7C;MARCHEN LETTER DA;Lo;0;L;;;;;N;;;;; +11C7D;MARCHEN LETTER NA;Lo;0;L;;;;;N;;;;; +11C7E;MARCHEN LETTER PA;Lo;0;L;;;;;N;;;;; +11C7F;MARCHEN LETTER PHA;Lo;0;L;;;;;N;;;;; +11C80;MARCHEN LETTER BA;Lo;0;L;;;;;N;;;;; +11C81;MARCHEN LETTER MA;Lo;0;L;;;;;N;;;;; +11C82;MARCHEN LETTER TSA;Lo;0;L;;;;;N;;;;; +11C83;MARCHEN LETTER TSHA;Lo;0;L;;;;;N;;;;; +11C84;MARCHEN LETTER DZA;Lo;0;L;;;;;N;;;;; +11C85;MARCHEN LETTER WA;Lo;0;L;;;;;N;;;;; +11C86;MARCHEN LETTER ZHA;Lo;0;L;;;;;N;;;;; +11C87;MARCHEN LETTER ZA;Lo;0;L;;;;;N;;;;; +11C88;MARCHEN LETTER -A;Lo;0;L;;;;;N;;;;; +11C89;MARCHEN LETTER YA;Lo;0;L;;;;;N;;;;; +11C8A;MARCHEN LETTER RA;Lo;0;L;;;;;N;;;;; +11C8B;MARCHEN LETTER LA;Lo;0;L;;;;;N;;;;; +11C8C;MARCHEN LETTER SHA;Lo;0;L;;;;;N;;;;; +11C8D;MARCHEN LETTER SA;Lo;0;L;;;;;N;;;;; +11C8E;MARCHEN LETTER HA;Lo;0;L;;;;;N;;;;; +11C8F;MARCHEN LETTER A;Lo;0;L;;;;;N;;;;; +11C92;MARCHEN SUBJOINED LETTER KA;Mn;0;NSM;;;;;N;;;;; +11C93;MARCHEN SUBJOINED LETTER KHA;Mn;0;NSM;;;;;N;;;;; +11C94;MARCHEN SUBJOINED LETTER GA;Mn;0;NSM;;;;;N;;;;; +11C95;MARCHEN SUBJOINED LETTER NGA;Mn;0;NSM;;;;;N;;;;; +11C96;MARCHEN SUBJOINED LETTER CA;Mn;0;NSM;;;;;N;;;;; +11C97;MARCHEN SUBJOINED LETTER CHA;Mn;0;NSM;;;;;N;;;;; +11C98;MARCHEN SUBJOINED LETTER JA;Mn;0;NSM;;;;;N;;;;; +11C99;MARCHEN SUBJOINED LETTER NYA;Mn;0;NSM;;;;;N;;;;; +11C9A;MARCHEN SUBJOINED LETTER TA;Mn;0;NSM;;;;;N;;;;; +11C9B;MARCHEN SUBJOINED LETTER THA;Mn;0;NSM;;;;;N;;;;; +11C9C;MARCHEN SUBJOINED LETTER DA;Mn;0;NSM;;;;;N;;;;; +11C9D;MARCHEN SUBJOINED LETTER NA;Mn;0;NSM;;;;;N;;;;; +11C9E;MARCHEN SUBJOINED LETTER PA;Mn;0;NSM;;;;;N;;;;; +11C9F;MARCHEN SUBJOINED LETTER PHA;Mn;0;NSM;;;;;N;;;;; +11CA0;MARCHEN SUBJOINED LETTER BA;Mn;0;NSM;;;;;N;;;;; +11CA1;MARCHEN SUBJOINED LETTER MA;Mn;0;NSM;;;;;N;;;;; +11CA2;MARCHEN SUBJOINED LETTER TSA;Mn;0;NSM;;;;;N;;;;; +11CA3;MARCHEN SUBJOINED LETTER TSHA;Mn;0;NSM;;;;;N;;;;; +11CA4;MARCHEN SUBJOINED LETTER DZA;Mn;0;NSM;;;;;N;;;;; +11CA5;MARCHEN SUBJOINED LETTER WA;Mn;0;NSM;;;;;N;;;;; +11CA6;MARCHEN SUBJOINED LETTER ZHA;Mn;0;NSM;;;;;N;;;;; +11CA7;MARCHEN SUBJOINED LETTER ZA;Mn;0;NSM;;;;;N;;;;; +11CA9;MARCHEN SUBJOINED LETTER YA;Mc;0;L;;;;;N;;;;; +11CAA;MARCHEN SUBJOINED LETTER RA;Mn;0;NSM;;;;;N;;;;; +11CAB;MARCHEN SUBJOINED LETTER LA;Mn;0;NSM;;;;;N;;;;; +11CAC;MARCHEN SUBJOINED LETTER SHA;Mn;0;NSM;;;;;N;;;;; +11CAD;MARCHEN SUBJOINED LETTER SA;Mn;0;NSM;;;;;N;;;;; +11CAE;MARCHEN SUBJOINED LETTER HA;Mn;0;NSM;;;;;N;;;;; +11CAF;MARCHEN SUBJOINED LETTER A;Mn;0;NSM;;;;;N;;;;; +11CB0;MARCHEN VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +11CB1;MARCHEN VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +11CB2;MARCHEN VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11CB3;MARCHEN VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11CB4;MARCHEN VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +11CB5;MARCHEN SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11CB6;MARCHEN SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11D00;MASARAM GONDI LETTER A;Lo;0;L;;;;;N;;;;; +11D01;MASARAM GONDI LETTER AA;Lo;0;L;;;;;N;;;;; +11D02;MASARAM GONDI LETTER I;Lo;0;L;;;;;N;;;;; +11D03;MASARAM GONDI LETTER II;Lo;0;L;;;;;N;;;;; +11D04;MASARAM GONDI LETTER U;Lo;0;L;;;;;N;;;;; +11D05;MASARAM GONDI LETTER UU;Lo;0;L;;;;;N;;;;; +11D06;MASARAM GONDI LETTER E;Lo;0;L;;;;;N;;;;; +11D08;MASARAM GONDI LETTER AI;Lo;0;L;;;;;N;;;;; +11D09;MASARAM GONDI LETTER O;Lo;0;L;;;;;N;;;;; +11D0B;MASARAM GONDI LETTER AU;Lo;0;L;;;;;N;;;;; +11D0C;MASARAM GONDI LETTER KA;Lo;0;L;;;;;N;;;;; +11D0D;MASARAM GONDI LETTER KHA;Lo;0;L;;;;;N;;;;; +11D0E;MASARAM GONDI LETTER GA;Lo;0;L;;;;;N;;;;; +11D0F;MASARAM GONDI LETTER GHA;Lo;0;L;;;;;N;;;;; +11D10;MASARAM GONDI LETTER NGA;Lo;0;L;;;;;N;;;;; +11D11;MASARAM GONDI LETTER CA;Lo;0;L;;;;;N;;;;; +11D12;MASARAM GONDI LETTER CHA;Lo;0;L;;;;;N;;;;; +11D13;MASARAM GONDI LETTER JA;Lo;0;L;;;;;N;;;;; +11D14;MASARAM GONDI LETTER JHA;Lo;0;L;;;;;N;;;;; +11D15;MASARAM GONDI LETTER NYA;Lo;0;L;;;;;N;;;;; +11D16;MASARAM GONDI LETTER TTA;Lo;0;L;;;;;N;;;;; +11D17;MASARAM GONDI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11D18;MASARAM GONDI LETTER DDA;Lo;0;L;;;;;N;;;;; +11D19;MASARAM GONDI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11D1A;MASARAM GONDI LETTER NNA;Lo;0;L;;;;;N;;;;; +11D1B;MASARAM GONDI LETTER TA;Lo;0;L;;;;;N;;;;; +11D1C;MASARAM GONDI LETTER THA;Lo;0;L;;;;;N;;;;; +11D1D;MASARAM GONDI LETTER DA;Lo;0;L;;;;;N;;;;; +11D1E;MASARAM GONDI LETTER DHA;Lo;0;L;;;;;N;;;;; +11D1F;MASARAM GONDI LETTER NA;Lo;0;L;;;;;N;;;;; +11D20;MASARAM GONDI LETTER PA;Lo;0;L;;;;;N;;;;; +11D21;MASARAM GONDI LETTER PHA;Lo;0;L;;;;;N;;;;; +11D22;MASARAM GONDI LETTER BA;Lo;0;L;;;;;N;;;;; +11D23;MASARAM GONDI LETTER BHA;Lo;0;L;;;;;N;;;;; +11D24;MASARAM GONDI LETTER MA;Lo;0;L;;;;;N;;;;; +11D25;MASARAM GONDI LETTER YA;Lo;0;L;;;;;N;;;;; +11D26;MASARAM GONDI LETTER RA;Lo;0;L;;;;;N;;;;; +11D27;MASARAM GONDI LETTER LA;Lo;0;L;;;;;N;;;;; +11D28;MASARAM GONDI LETTER VA;Lo;0;L;;;;;N;;;;; +11D29;MASARAM GONDI LETTER SHA;Lo;0;L;;;;;N;;;;; +11D2A;MASARAM GONDI LETTER SSA;Lo;0;L;;;;;N;;;;; +11D2B;MASARAM GONDI LETTER SA;Lo;0;L;;;;;N;;;;; +11D2C;MASARAM GONDI LETTER HA;Lo;0;L;;;;;N;;;;; +11D2D;MASARAM GONDI LETTER LLA;Lo;0;L;;;;;N;;;;; +11D2E;MASARAM GONDI LETTER KSSA;Lo;0;L;;;;;N;;;;; +11D2F;MASARAM GONDI LETTER JNYA;Lo;0;L;;;;;N;;;;; +11D30;MASARAM GONDI LETTER TRA;Lo;0;L;;;;;N;;;;; +11D31;MASARAM GONDI VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +11D32;MASARAM GONDI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11D33;MASARAM GONDI VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +11D34;MASARAM GONDI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11D35;MASARAM GONDI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +11D36;MASARAM GONDI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11D3A;MASARAM GONDI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11D3C;MASARAM GONDI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11D3D;MASARAM GONDI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11D3F;MASARAM GONDI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +11D40;MASARAM GONDI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11D41;MASARAM GONDI SIGN VISARGA;Mn;0;NSM;;;;;N;;;;; +11D42;MASARAM GONDI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +11D43;MASARAM GONDI SIGN CANDRA;Mn;0;NSM;;;;;N;;;;; +11D44;MASARAM GONDI SIGN HALANTA;Mn;9;NSM;;;;;N;;;;; +11D45;MASARAM GONDI VIRAMA;Mn;9;NSM;;;;;N;;;;; +11D46;MASARAM GONDI REPHA;Lo;0;L;;;;;N;;;;; +11D47;MASARAM GONDI RA-KARA;Mn;0;NSM;;;;;N;;;;; +11D50;MASARAM GONDI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11D51;MASARAM GONDI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11D52;MASARAM GONDI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11D53;MASARAM GONDI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11D54;MASARAM GONDI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11D55;MASARAM GONDI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11D56;MASARAM GONDI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11D57;MASARAM GONDI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11D58;MASARAM GONDI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11D59;MASARAM GONDI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; 12000;CUNEIFORM SIGN A;Lo;0;L;;;;;N;;;;; 12001;CUNEIFORM SIGN A TIMES A;Lo;0;L;;;;;N;;;;; 12002;CUNEIFORM SIGN A TIMES BAD;Lo;0;L;;;;;N;;;;; @@ -23685,8 +24352,1448 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 16F9D;MIAO LETTER REFORMED TONE-5;Lm;0;L;;;;;N;;;;; 16F9E;MIAO LETTER REFORMED TONE-6;Lm;0;L;;;;;N;;;;; 16F9F;MIAO LETTER REFORMED TONE-8;Lm;0;L;;;;;N;;;;; +16FE0;TANGUT ITERATION MARK;Lm;0;L;;;;;N;;;;; +16FE1;NUSHU ITERATION MARK;Lm;0;L;;;;;N;;;;; +17000;;Lo;0;L;;;;;N;;;;; +187EC;;Lo;0;L;;;;;N;;;;; +18800;TANGUT COMPONENT-001;Lo;0;L;;;;;N;;;;; +18801;TANGUT COMPONENT-002;Lo;0;L;;;;;N;;;;; +18802;TANGUT COMPONENT-003;Lo;0;L;;;;;N;;;;; +18803;TANGUT COMPONENT-004;Lo;0;L;;;;;N;;;;; +18804;TANGUT COMPONENT-005;Lo;0;L;;;;;N;;;;; +18805;TANGUT COMPONENT-006;Lo;0;L;;;;;N;;;;; +18806;TANGUT COMPONENT-007;Lo;0;L;;;;;N;;;;; +18807;TANGUT COMPONENT-008;Lo;0;L;;;;;N;;;;; +18808;TANGUT COMPONENT-009;Lo;0;L;;;;;N;;;;; +18809;TANGUT COMPONENT-010;Lo;0;L;;;;;N;;;;; +1880A;TANGUT COMPONENT-011;Lo;0;L;;;;;N;;;;; +1880B;TANGUT COMPONENT-012;Lo;0;L;;;;;N;;;;; +1880C;TANGUT COMPONENT-013;Lo;0;L;;;;;N;;;;; +1880D;TANGUT COMPONENT-014;Lo;0;L;;;;;N;;;;; +1880E;TANGUT COMPONENT-015;Lo;0;L;;;;;N;;;;; +1880F;TANGUT COMPONENT-016;Lo;0;L;;;;;N;;;;; +18810;TANGUT COMPONENT-017;Lo;0;L;;;;;N;;;;; +18811;TANGUT COMPONENT-018;Lo;0;L;;;;;N;;;;; +18812;TANGUT COMPONENT-019;Lo;0;L;;;;;N;;;;; +18813;TANGUT COMPONENT-020;Lo;0;L;;;;;N;;;;; +18814;TANGUT COMPONENT-021;Lo;0;L;;;;;N;;;;; +18815;TANGUT COMPONENT-022;Lo;0;L;;;;;N;;;;; +18816;TANGUT COMPONENT-023;Lo;0;L;;;;;N;;;;; +18817;TANGUT COMPONENT-024;Lo;0;L;;;;;N;;;;; +18818;TANGUT COMPONENT-025;Lo;0;L;;;;;N;;;;; +18819;TANGUT COMPONENT-026;Lo;0;L;;;;;N;;;;; +1881A;TANGUT COMPONENT-027;Lo;0;L;;;;;N;;;;; +1881B;TANGUT COMPONENT-028;Lo;0;L;;;;;N;;;;; +1881C;TANGUT COMPONENT-029;Lo;0;L;;;;;N;;;;; +1881D;TANGUT COMPONENT-030;Lo;0;L;;;;;N;;;;; +1881E;TANGUT COMPONENT-031;Lo;0;L;;;;;N;;;;; +1881F;TANGUT COMPONENT-032;Lo;0;L;;;;;N;;;;; +18820;TANGUT COMPONENT-033;Lo;0;L;;;;;N;;;;; +18821;TANGUT COMPONENT-034;Lo;0;L;;;;;N;;;;; +18822;TANGUT COMPONENT-035;Lo;0;L;;;;;N;;;;; +18823;TANGUT COMPONENT-036;Lo;0;L;;;;;N;;;;; +18824;TANGUT COMPONENT-037;Lo;0;L;;;;;N;;;;; +18825;TANGUT COMPONENT-038;Lo;0;L;;;;;N;;;;; +18826;TANGUT COMPONENT-039;Lo;0;L;;;;;N;;;;; +18827;TANGUT COMPONENT-040;Lo;0;L;;;;;N;;;;; +18828;TANGUT COMPONENT-041;Lo;0;L;;;;;N;;;;; +18829;TANGUT COMPONENT-042;Lo;0;L;;;;;N;;;;; +1882A;TANGUT COMPONENT-043;Lo;0;L;;;;;N;;;;; +1882B;TANGUT COMPONENT-044;Lo;0;L;;;;;N;;;;; +1882C;TANGUT COMPONENT-045;Lo;0;L;;;;;N;;;;; +1882D;TANGUT COMPONENT-046;Lo;0;L;;;;;N;;;;; +1882E;TANGUT COMPONENT-047;Lo;0;L;;;;;N;;;;; +1882F;TANGUT COMPONENT-048;Lo;0;L;;;;;N;;;;; +18830;TANGUT COMPONENT-049;Lo;0;L;;;;;N;;;;; +18831;TANGUT COMPONENT-050;Lo;0;L;;;;;N;;;;; +18832;TANGUT COMPONENT-051;Lo;0;L;;;;;N;;;;; +18833;TANGUT COMPONENT-052;Lo;0;L;;;;;N;;;;; +18834;TANGUT COMPONENT-053;Lo;0;L;;;;;N;;;;; +18835;TANGUT COMPONENT-054;Lo;0;L;;;;;N;;;;; +18836;TANGUT COMPONENT-055;Lo;0;L;;;;;N;;;;; +18837;TANGUT COMPONENT-056;Lo;0;L;;;;;N;;;;; +18838;TANGUT COMPONENT-057;Lo;0;L;;;;;N;;;;; +18839;TANGUT COMPONENT-058;Lo;0;L;;;;;N;;;;; +1883A;TANGUT COMPONENT-059;Lo;0;L;;;;;N;;;;; +1883B;TANGUT COMPONENT-060;Lo;0;L;;;;;N;;;;; +1883C;TANGUT COMPONENT-061;Lo;0;L;;;;;N;;;;; +1883D;TANGUT COMPONENT-062;Lo;0;L;;;;;N;;;;; +1883E;TANGUT COMPONENT-063;Lo;0;L;;;;;N;;;;; +1883F;TANGUT COMPONENT-064;Lo;0;L;;;;;N;;;;; +18840;TANGUT COMPONENT-065;Lo;0;L;;;;;N;;;;; +18841;TANGUT COMPONENT-066;Lo;0;L;;;;;N;;;;; +18842;TANGUT COMPONENT-067;Lo;0;L;;;;;N;;;;; +18843;TANGUT COMPONENT-068;Lo;0;L;;;;;N;;;;; +18844;TANGUT COMPONENT-069;Lo;0;L;;;;;N;;;;; +18845;TANGUT COMPONENT-070;Lo;0;L;;;;;N;;;;; +18846;TANGUT COMPONENT-071;Lo;0;L;;;;;N;;;;; +18847;TANGUT COMPONENT-072;Lo;0;L;;;;;N;;;;; +18848;TANGUT COMPONENT-073;Lo;0;L;;;;;N;;;;; +18849;TANGUT COMPONENT-074;Lo;0;L;;;;;N;;;;; +1884A;TANGUT COMPONENT-075;Lo;0;L;;;;;N;;;;; +1884B;TANGUT COMPONENT-076;Lo;0;L;;;;;N;;;;; +1884C;TANGUT COMPONENT-077;Lo;0;L;;;;;N;;;;; +1884D;TANGUT COMPONENT-078;Lo;0;L;;;;;N;;;;; +1884E;TANGUT COMPONENT-079;Lo;0;L;;;;;N;;;;; +1884F;TANGUT COMPONENT-080;Lo;0;L;;;;;N;;;;; +18850;TANGUT COMPONENT-081;Lo;0;L;;;;;N;;;;; +18851;TANGUT COMPONENT-082;Lo;0;L;;;;;N;;;;; +18852;TANGUT COMPONENT-083;Lo;0;L;;;;;N;;;;; +18853;TANGUT COMPONENT-084;Lo;0;L;;;;;N;;;;; +18854;TANGUT COMPONENT-085;Lo;0;L;;;;;N;;;;; +18855;TANGUT COMPONENT-086;Lo;0;L;;;;;N;;;;; +18856;TANGUT COMPONENT-087;Lo;0;L;;;;;N;;;;; +18857;TANGUT COMPONENT-088;Lo;0;L;;;;;N;;;;; +18858;TANGUT COMPONENT-089;Lo;0;L;;;;;N;;;;; +18859;TANGUT COMPONENT-090;Lo;0;L;;;;;N;;;;; +1885A;TANGUT COMPONENT-091;Lo;0;L;;;;;N;;;;; +1885B;TANGUT COMPONENT-092;Lo;0;L;;;;;N;;;;; +1885C;TANGUT COMPONENT-093;Lo;0;L;;;;;N;;;;; +1885D;TANGUT COMPONENT-094;Lo;0;L;;;;;N;;;;; +1885E;TANGUT COMPONENT-095;Lo;0;L;;;;;N;;;;; +1885F;TANGUT COMPONENT-096;Lo;0;L;;;;;N;;;;; +18860;TANGUT COMPONENT-097;Lo;0;L;;;;;N;;;;; +18861;TANGUT COMPONENT-098;Lo;0;L;;;;;N;;;;; +18862;TANGUT COMPONENT-099;Lo;0;L;;;;;N;;;;; +18863;TANGUT COMPONENT-100;Lo;0;L;;;;;N;;;;; +18864;TANGUT COMPONENT-101;Lo;0;L;;;;;N;;;;; +18865;TANGUT COMPONENT-102;Lo;0;L;;;;;N;;;;; +18866;TANGUT COMPONENT-103;Lo;0;L;;;;;N;;;;; +18867;TANGUT COMPONENT-104;Lo;0;L;;;;;N;;;;; +18868;TANGUT COMPONENT-105;Lo;0;L;;;;;N;;;;; +18869;TANGUT COMPONENT-106;Lo;0;L;;;;;N;;;;; +1886A;TANGUT COMPONENT-107;Lo;0;L;;;;;N;;;;; +1886B;TANGUT COMPONENT-108;Lo;0;L;;;;;N;;;;; +1886C;TANGUT COMPONENT-109;Lo;0;L;;;;;N;;;;; +1886D;TANGUT COMPONENT-110;Lo;0;L;;;;;N;;;;; +1886E;TANGUT COMPONENT-111;Lo;0;L;;;;;N;;;;; +1886F;TANGUT COMPONENT-112;Lo;0;L;;;;;N;;;;; +18870;TANGUT COMPONENT-113;Lo;0;L;;;;;N;;;;; +18871;TANGUT COMPONENT-114;Lo;0;L;;;;;N;;;;; +18872;TANGUT COMPONENT-115;Lo;0;L;;;;;N;;;;; +18873;TANGUT COMPONENT-116;Lo;0;L;;;;;N;;;;; +18874;TANGUT COMPONENT-117;Lo;0;L;;;;;N;;;;; +18875;TANGUT COMPONENT-118;Lo;0;L;;;;;N;;;;; +18876;TANGUT COMPONENT-119;Lo;0;L;;;;;N;;;;; +18877;TANGUT COMPONENT-120;Lo;0;L;;;;;N;;;;; +18878;TANGUT COMPONENT-121;Lo;0;L;;;;;N;;;;; +18879;TANGUT COMPONENT-122;Lo;0;L;;;;;N;;;;; +1887A;TANGUT COMPONENT-123;Lo;0;L;;;;;N;;;;; +1887B;TANGUT COMPONENT-124;Lo;0;L;;;;;N;;;;; +1887C;TANGUT COMPONENT-125;Lo;0;L;;;;;N;;;;; +1887D;TANGUT COMPONENT-126;Lo;0;L;;;;;N;;;;; +1887E;TANGUT COMPONENT-127;Lo;0;L;;;;;N;;;;; +1887F;TANGUT COMPONENT-128;Lo;0;L;;;;;N;;;;; +18880;TANGUT COMPONENT-129;Lo;0;L;;;;;N;;;;; +18881;TANGUT COMPONENT-130;Lo;0;L;;;;;N;;;;; +18882;TANGUT COMPONENT-131;Lo;0;L;;;;;N;;;;; +18883;TANGUT COMPONENT-132;Lo;0;L;;;;;N;;;;; +18884;TANGUT COMPONENT-133;Lo;0;L;;;;;N;;;;; +18885;TANGUT COMPONENT-134;Lo;0;L;;;;;N;;;;; +18886;TANGUT COMPONENT-135;Lo;0;L;;;;;N;;;;; +18887;TANGUT COMPONENT-136;Lo;0;L;;;;;N;;;;; +18888;TANGUT COMPONENT-137;Lo;0;L;;;;;N;;;;; +18889;TANGUT COMPONENT-138;Lo;0;L;;;;;N;;;;; +1888A;TANGUT COMPONENT-139;Lo;0;L;;;;;N;;;;; +1888B;TANGUT COMPONENT-140;Lo;0;L;;;;;N;;;;; +1888C;TANGUT COMPONENT-141;Lo;0;L;;;;;N;;;;; +1888D;TANGUT COMPONENT-142;Lo;0;L;;;;;N;;;;; +1888E;TANGUT COMPONENT-143;Lo;0;L;;;;;N;;;;; +1888F;TANGUT COMPONENT-144;Lo;0;L;;;;;N;;;;; +18890;TANGUT COMPONENT-145;Lo;0;L;;;;;N;;;;; +18891;TANGUT COMPONENT-146;Lo;0;L;;;;;N;;;;; +18892;TANGUT COMPONENT-147;Lo;0;L;;;;;N;;;;; +18893;TANGUT COMPONENT-148;Lo;0;L;;;;;N;;;;; +18894;TANGUT COMPONENT-149;Lo;0;L;;;;;N;;;;; +18895;TANGUT COMPONENT-150;Lo;0;L;;;;;N;;;;; +18896;TANGUT COMPONENT-151;Lo;0;L;;;;;N;;;;; +18897;TANGUT COMPONENT-152;Lo;0;L;;;;;N;;;;; +18898;TANGUT COMPONENT-153;Lo;0;L;;;;;N;;;;; +18899;TANGUT COMPONENT-154;Lo;0;L;;;;;N;;;;; +1889A;TANGUT COMPONENT-155;Lo;0;L;;;;;N;;;;; +1889B;TANGUT COMPONENT-156;Lo;0;L;;;;;N;;;;; +1889C;TANGUT COMPONENT-157;Lo;0;L;;;;;N;;;;; +1889D;TANGUT COMPONENT-158;Lo;0;L;;;;;N;;;;; +1889E;TANGUT COMPONENT-159;Lo;0;L;;;;;N;;;;; +1889F;TANGUT COMPONENT-160;Lo;0;L;;;;;N;;;;; +188A0;TANGUT COMPONENT-161;Lo;0;L;;;;;N;;;;; +188A1;TANGUT COMPONENT-162;Lo;0;L;;;;;N;;;;; +188A2;TANGUT COMPONENT-163;Lo;0;L;;;;;N;;;;; +188A3;TANGUT COMPONENT-164;Lo;0;L;;;;;N;;;;; +188A4;TANGUT COMPONENT-165;Lo;0;L;;;;;N;;;;; +188A5;TANGUT COMPONENT-166;Lo;0;L;;;;;N;;;;; +188A6;TANGUT COMPONENT-167;Lo;0;L;;;;;N;;;;; +188A7;TANGUT COMPONENT-168;Lo;0;L;;;;;N;;;;; +188A8;TANGUT COMPONENT-169;Lo;0;L;;;;;N;;;;; +188A9;TANGUT COMPONENT-170;Lo;0;L;;;;;N;;;;; +188AA;TANGUT COMPONENT-171;Lo;0;L;;;;;N;;;;; +188AB;TANGUT COMPONENT-172;Lo;0;L;;;;;N;;;;; +188AC;TANGUT COMPONENT-173;Lo;0;L;;;;;N;;;;; +188AD;TANGUT COMPONENT-174;Lo;0;L;;;;;N;;;;; +188AE;TANGUT COMPONENT-175;Lo;0;L;;;;;N;;;;; +188AF;TANGUT COMPONENT-176;Lo;0;L;;;;;N;;;;; +188B0;TANGUT COMPONENT-177;Lo;0;L;;;;;N;;;;; +188B1;TANGUT COMPONENT-178;Lo;0;L;;;;;N;;;;; +188B2;TANGUT COMPONENT-179;Lo;0;L;;;;;N;;;;; +188B3;TANGUT COMPONENT-180;Lo;0;L;;;;;N;;;;; +188B4;TANGUT COMPONENT-181;Lo;0;L;;;;;N;;;;; +188B5;TANGUT COMPONENT-182;Lo;0;L;;;;;N;;;;; +188B6;TANGUT COMPONENT-183;Lo;0;L;;;;;N;;;;; +188B7;TANGUT COMPONENT-184;Lo;0;L;;;;;N;;;;; +188B8;TANGUT COMPONENT-185;Lo;0;L;;;;;N;;;;; +188B9;TANGUT COMPONENT-186;Lo;0;L;;;;;N;;;;; +188BA;TANGUT COMPONENT-187;Lo;0;L;;;;;N;;;;; +188BB;TANGUT COMPONENT-188;Lo;0;L;;;;;N;;;;; +188BC;TANGUT COMPONENT-189;Lo;0;L;;;;;N;;;;; +188BD;TANGUT COMPONENT-190;Lo;0;L;;;;;N;;;;; +188BE;TANGUT COMPONENT-191;Lo;0;L;;;;;N;;;;; +188BF;TANGUT COMPONENT-192;Lo;0;L;;;;;N;;;;; +188C0;TANGUT COMPONENT-193;Lo;0;L;;;;;N;;;;; +188C1;TANGUT COMPONENT-194;Lo;0;L;;;;;N;;;;; +188C2;TANGUT COMPONENT-195;Lo;0;L;;;;;N;;;;; +188C3;TANGUT COMPONENT-196;Lo;0;L;;;;;N;;;;; +188C4;TANGUT COMPONENT-197;Lo;0;L;;;;;N;;;;; +188C5;TANGUT COMPONENT-198;Lo;0;L;;;;;N;;;;; +188C6;TANGUT COMPONENT-199;Lo;0;L;;;;;N;;;;; +188C7;TANGUT COMPONENT-200;Lo;0;L;;;;;N;;;;; +188C8;TANGUT COMPONENT-201;Lo;0;L;;;;;N;;;;; +188C9;TANGUT COMPONENT-202;Lo;0;L;;;;;N;;;;; +188CA;TANGUT COMPONENT-203;Lo;0;L;;;;;N;;;;; +188CB;TANGUT COMPONENT-204;Lo;0;L;;;;;N;;;;; +188CC;TANGUT COMPONENT-205;Lo;0;L;;;;;N;;;;; +188CD;TANGUT COMPONENT-206;Lo;0;L;;;;;N;;;;; +188CE;TANGUT COMPONENT-207;Lo;0;L;;;;;N;;;;; +188CF;TANGUT COMPONENT-208;Lo;0;L;;;;;N;;;;; +188D0;TANGUT COMPONENT-209;Lo;0;L;;;;;N;;;;; +188D1;TANGUT COMPONENT-210;Lo;0;L;;;;;N;;;;; +188D2;TANGUT COMPONENT-211;Lo;0;L;;;;;N;;;;; +188D3;TANGUT COMPONENT-212;Lo;0;L;;;;;N;;;;; +188D4;TANGUT COMPONENT-213;Lo;0;L;;;;;N;;;;; +188D5;TANGUT COMPONENT-214;Lo;0;L;;;;;N;;;;; +188D6;TANGUT COMPONENT-215;Lo;0;L;;;;;N;;;;; +188D7;TANGUT COMPONENT-216;Lo;0;L;;;;;N;;;;; +188D8;TANGUT COMPONENT-217;Lo;0;L;;;;;N;;;;; +188D9;TANGUT COMPONENT-218;Lo;0;L;;;;;N;;;;; +188DA;TANGUT COMPONENT-219;Lo;0;L;;;;;N;;;;; +188DB;TANGUT COMPONENT-220;Lo;0;L;;;;;N;;;;; +188DC;TANGUT COMPONENT-221;Lo;0;L;;;;;N;;;;; +188DD;TANGUT COMPONENT-222;Lo;0;L;;;;;N;;;;; +188DE;TANGUT COMPONENT-223;Lo;0;L;;;;;N;;;;; +188DF;TANGUT COMPONENT-224;Lo;0;L;;;;;N;;;;; +188E0;TANGUT COMPONENT-225;Lo;0;L;;;;;N;;;;; +188E1;TANGUT COMPONENT-226;Lo;0;L;;;;;N;;;;; +188E2;TANGUT COMPONENT-227;Lo;0;L;;;;;N;;;;; +188E3;TANGUT COMPONENT-228;Lo;0;L;;;;;N;;;;; +188E4;TANGUT COMPONENT-229;Lo;0;L;;;;;N;;;;; +188E5;TANGUT COMPONENT-230;Lo;0;L;;;;;N;;;;; +188E6;TANGUT COMPONENT-231;Lo;0;L;;;;;N;;;;; +188E7;TANGUT COMPONENT-232;Lo;0;L;;;;;N;;;;; +188E8;TANGUT COMPONENT-233;Lo;0;L;;;;;N;;;;; +188E9;TANGUT COMPONENT-234;Lo;0;L;;;;;N;;;;; +188EA;TANGUT COMPONENT-235;Lo;0;L;;;;;N;;;;; +188EB;TANGUT COMPONENT-236;Lo;0;L;;;;;N;;;;; +188EC;TANGUT COMPONENT-237;Lo;0;L;;;;;N;;;;; +188ED;TANGUT COMPONENT-238;Lo;0;L;;;;;N;;;;; +188EE;TANGUT COMPONENT-239;Lo;0;L;;;;;N;;;;; +188EF;TANGUT COMPONENT-240;Lo;0;L;;;;;N;;;;; +188F0;TANGUT COMPONENT-241;Lo;0;L;;;;;N;;;;; +188F1;TANGUT COMPONENT-242;Lo;0;L;;;;;N;;;;; +188F2;TANGUT COMPONENT-243;Lo;0;L;;;;;N;;;;; +188F3;TANGUT COMPONENT-244;Lo;0;L;;;;;N;;;;; +188F4;TANGUT COMPONENT-245;Lo;0;L;;;;;N;;;;; +188F5;TANGUT COMPONENT-246;Lo;0;L;;;;;N;;;;; +188F6;TANGUT COMPONENT-247;Lo;0;L;;;;;N;;;;; +188F7;TANGUT COMPONENT-248;Lo;0;L;;;;;N;;;;; +188F8;TANGUT COMPONENT-249;Lo;0;L;;;;;N;;;;; +188F9;TANGUT COMPONENT-250;Lo;0;L;;;;;N;;;;; +188FA;TANGUT COMPONENT-251;Lo;0;L;;;;;N;;;;; +188FB;TANGUT COMPONENT-252;Lo;0;L;;;;;N;;;;; +188FC;TANGUT COMPONENT-253;Lo;0;L;;;;;N;;;;; +188FD;TANGUT COMPONENT-254;Lo;0;L;;;;;N;;;;; +188FE;TANGUT COMPONENT-255;Lo;0;L;;;;;N;;;;; +188FF;TANGUT COMPONENT-256;Lo;0;L;;;;;N;;;;; +18900;TANGUT COMPONENT-257;Lo;0;L;;;;;N;;;;; +18901;TANGUT COMPONENT-258;Lo;0;L;;;;;N;;;;; +18902;TANGUT COMPONENT-259;Lo;0;L;;;;;N;;;;; +18903;TANGUT COMPONENT-260;Lo;0;L;;;;;N;;;;; +18904;TANGUT COMPONENT-261;Lo;0;L;;;;;N;;;;; +18905;TANGUT COMPONENT-262;Lo;0;L;;;;;N;;;;; +18906;TANGUT COMPONENT-263;Lo;0;L;;;;;N;;;;; +18907;TANGUT COMPONENT-264;Lo;0;L;;;;;N;;;;; +18908;TANGUT COMPONENT-265;Lo;0;L;;;;;N;;;;; +18909;TANGUT COMPONENT-266;Lo;0;L;;;;;N;;;;; +1890A;TANGUT COMPONENT-267;Lo;0;L;;;;;N;;;;; +1890B;TANGUT COMPONENT-268;Lo;0;L;;;;;N;;;;; +1890C;TANGUT COMPONENT-269;Lo;0;L;;;;;N;;;;; +1890D;TANGUT COMPONENT-270;Lo;0;L;;;;;N;;;;; +1890E;TANGUT COMPONENT-271;Lo;0;L;;;;;N;;;;; +1890F;TANGUT COMPONENT-272;Lo;0;L;;;;;N;;;;; +18910;TANGUT COMPONENT-273;Lo;0;L;;;;;N;;;;; +18911;TANGUT COMPONENT-274;Lo;0;L;;;;;N;;;;; +18912;TANGUT COMPONENT-275;Lo;0;L;;;;;N;;;;; +18913;TANGUT COMPONENT-276;Lo;0;L;;;;;N;;;;; +18914;TANGUT COMPONENT-277;Lo;0;L;;;;;N;;;;; +18915;TANGUT COMPONENT-278;Lo;0;L;;;;;N;;;;; +18916;TANGUT COMPONENT-279;Lo;0;L;;;;;N;;;;; +18917;TANGUT COMPONENT-280;Lo;0;L;;;;;N;;;;; +18918;TANGUT COMPONENT-281;Lo;0;L;;;;;N;;;;; +18919;TANGUT COMPONENT-282;Lo;0;L;;;;;N;;;;; +1891A;TANGUT COMPONENT-283;Lo;0;L;;;;;N;;;;; +1891B;TANGUT COMPONENT-284;Lo;0;L;;;;;N;;;;; +1891C;TANGUT COMPONENT-285;Lo;0;L;;;;;N;;;;; +1891D;TANGUT COMPONENT-286;Lo;0;L;;;;;N;;;;; +1891E;TANGUT COMPONENT-287;Lo;0;L;;;;;N;;;;; +1891F;TANGUT COMPONENT-288;Lo;0;L;;;;;N;;;;; +18920;TANGUT COMPONENT-289;Lo;0;L;;;;;N;;;;; +18921;TANGUT COMPONENT-290;Lo;0;L;;;;;N;;;;; +18922;TANGUT COMPONENT-291;Lo;0;L;;;;;N;;;;; +18923;TANGUT COMPONENT-292;Lo;0;L;;;;;N;;;;; +18924;TANGUT COMPONENT-293;Lo;0;L;;;;;N;;;;; +18925;TANGUT COMPONENT-294;Lo;0;L;;;;;N;;;;; +18926;TANGUT COMPONENT-295;Lo;0;L;;;;;N;;;;; +18927;TANGUT COMPONENT-296;Lo;0;L;;;;;N;;;;; +18928;TANGUT COMPONENT-297;Lo;0;L;;;;;N;;;;; +18929;TANGUT COMPONENT-298;Lo;0;L;;;;;N;;;;; +1892A;TANGUT COMPONENT-299;Lo;0;L;;;;;N;;;;; +1892B;TANGUT COMPONENT-300;Lo;0;L;;;;;N;;;;; +1892C;TANGUT COMPONENT-301;Lo;0;L;;;;;N;;;;; +1892D;TANGUT COMPONENT-302;Lo;0;L;;;;;N;;;;; +1892E;TANGUT COMPONENT-303;Lo;0;L;;;;;N;;;;; +1892F;TANGUT COMPONENT-304;Lo;0;L;;;;;N;;;;; +18930;TANGUT COMPONENT-305;Lo;0;L;;;;;N;;;;; +18931;TANGUT COMPONENT-306;Lo;0;L;;;;;N;;;;; +18932;TANGUT COMPONENT-307;Lo;0;L;;;;;N;;;;; +18933;TANGUT COMPONENT-308;Lo;0;L;;;;;N;;;;; +18934;TANGUT COMPONENT-309;Lo;0;L;;;;;N;;;;; +18935;TANGUT COMPONENT-310;Lo;0;L;;;;;N;;;;; +18936;TANGUT COMPONENT-311;Lo;0;L;;;;;N;;;;; +18937;TANGUT COMPONENT-312;Lo;0;L;;;;;N;;;;; +18938;TANGUT COMPONENT-313;Lo;0;L;;;;;N;;;;; +18939;TANGUT COMPONENT-314;Lo;0;L;;;;;N;;;;; +1893A;TANGUT COMPONENT-315;Lo;0;L;;;;;N;;;;; +1893B;TANGUT COMPONENT-316;Lo;0;L;;;;;N;;;;; +1893C;TANGUT COMPONENT-317;Lo;0;L;;;;;N;;;;; +1893D;TANGUT COMPONENT-318;Lo;0;L;;;;;N;;;;; +1893E;TANGUT COMPONENT-319;Lo;0;L;;;;;N;;;;; +1893F;TANGUT COMPONENT-320;Lo;0;L;;;;;N;;;;; +18940;TANGUT COMPONENT-321;Lo;0;L;;;;;N;;;;; +18941;TANGUT COMPONENT-322;Lo;0;L;;;;;N;;;;; +18942;TANGUT COMPONENT-323;Lo;0;L;;;;;N;;;;; +18943;TANGUT COMPONENT-324;Lo;0;L;;;;;N;;;;; +18944;TANGUT COMPONENT-325;Lo;0;L;;;;;N;;;;; +18945;TANGUT COMPONENT-326;Lo;0;L;;;;;N;;;;; +18946;TANGUT COMPONENT-327;Lo;0;L;;;;;N;;;;; +18947;TANGUT COMPONENT-328;Lo;0;L;;;;;N;;;;; +18948;TANGUT COMPONENT-329;Lo;0;L;;;;;N;;;;; +18949;TANGUT COMPONENT-330;Lo;0;L;;;;;N;;;;; +1894A;TANGUT COMPONENT-331;Lo;0;L;;;;;N;;;;; +1894B;TANGUT COMPONENT-332;Lo;0;L;;;;;N;;;;; +1894C;TANGUT COMPONENT-333;Lo;0;L;;;;;N;;;;; +1894D;TANGUT COMPONENT-334;Lo;0;L;;;;;N;;;;; +1894E;TANGUT COMPONENT-335;Lo;0;L;;;;;N;;;;; +1894F;TANGUT COMPONENT-336;Lo;0;L;;;;;N;;;;; +18950;TANGUT COMPONENT-337;Lo;0;L;;;;;N;;;;; +18951;TANGUT COMPONENT-338;Lo;0;L;;;;;N;;;;; +18952;TANGUT COMPONENT-339;Lo;0;L;;;;;N;;;;; +18953;TANGUT COMPONENT-340;Lo;0;L;;;;;N;;;;; +18954;TANGUT COMPONENT-341;Lo;0;L;;;;;N;;;;; +18955;TANGUT COMPONENT-342;Lo;0;L;;;;;N;;;;; +18956;TANGUT COMPONENT-343;Lo;0;L;;;;;N;;;;; +18957;TANGUT COMPONENT-344;Lo;0;L;;;;;N;;;;; +18958;TANGUT COMPONENT-345;Lo;0;L;;;;;N;;;;; +18959;TANGUT COMPONENT-346;Lo;0;L;;;;;N;;;;; +1895A;TANGUT COMPONENT-347;Lo;0;L;;;;;N;;;;; +1895B;TANGUT COMPONENT-348;Lo;0;L;;;;;N;;;;; +1895C;TANGUT COMPONENT-349;Lo;0;L;;;;;N;;;;; +1895D;TANGUT COMPONENT-350;Lo;0;L;;;;;N;;;;; +1895E;TANGUT COMPONENT-351;Lo;0;L;;;;;N;;;;; +1895F;TANGUT COMPONENT-352;Lo;0;L;;;;;N;;;;; +18960;TANGUT COMPONENT-353;Lo;0;L;;;;;N;;;;; +18961;TANGUT COMPONENT-354;Lo;0;L;;;;;N;;;;; +18962;TANGUT COMPONENT-355;Lo;0;L;;;;;N;;;;; +18963;TANGUT COMPONENT-356;Lo;0;L;;;;;N;;;;; +18964;TANGUT COMPONENT-357;Lo;0;L;;;;;N;;;;; +18965;TANGUT COMPONENT-358;Lo;0;L;;;;;N;;;;; +18966;TANGUT COMPONENT-359;Lo;0;L;;;;;N;;;;; +18967;TANGUT COMPONENT-360;Lo;0;L;;;;;N;;;;; +18968;TANGUT COMPONENT-361;Lo;0;L;;;;;N;;;;; +18969;TANGUT COMPONENT-362;Lo;0;L;;;;;N;;;;; +1896A;TANGUT COMPONENT-363;Lo;0;L;;;;;N;;;;; +1896B;TANGUT COMPONENT-364;Lo;0;L;;;;;N;;;;; +1896C;TANGUT COMPONENT-365;Lo;0;L;;;;;N;;;;; +1896D;TANGUT COMPONENT-366;Lo;0;L;;;;;N;;;;; +1896E;TANGUT COMPONENT-367;Lo;0;L;;;;;N;;;;; +1896F;TANGUT COMPONENT-368;Lo;0;L;;;;;N;;;;; +18970;TANGUT COMPONENT-369;Lo;0;L;;;;;N;;;;; +18971;TANGUT COMPONENT-370;Lo;0;L;;;;;N;;;;; +18972;TANGUT COMPONENT-371;Lo;0;L;;;;;N;;;;; +18973;TANGUT COMPONENT-372;Lo;0;L;;;;;N;;;;; +18974;TANGUT COMPONENT-373;Lo;0;L;;;;;N;;;;; +18975;TANGUT COMPONENT-374;Lo;0;L;;;;;N;;;;; +18976;TANGUT COMPONENT-375;Lo;0;L;;;;;N;;;;; +18977;TANGUT COMPONENT-376;Lo;0;L;;;;;N;;;;; +18978;TANGUT COMPONENT-377;Lo;0;L;;;;;N;;;;; +18979;TANGUT COMPONENT-378;Lo;0;L;;;;;N;;;;; +1897A;TANGUT COMPONENT-379;Lo;0;L;;;;;N;;;;; +1897B;TANGUT COMPONENT-380;Lo;0;L;;;;;N;;;;; +1897C;TANGUT COMPONENT-381;Lo;0;L;;;;;N;;;;; +1897D;TANGUT COMPONENT-382;Lo;0;L;;;;;N;;;;; +1897E;TANGUT COMPONENT-383;Lo;0;L;;;;;N;;;;; +1897F;TANGUT COMPONENT-384;Lo;0;L;;;;;N;;;;; +18980;TANGUT COMPONENT-385;Lo;0;L;;;;;N;;;;; +18981;TANGUT COMPONENT-386;Lo;0;L;;;;;N;;;;; +18982;TANGUT COMPONENT-387;Lo;0;L;;;;;N;;;;; +18983;TANGUT COMPONENT-388;Lo;0;L;;;;;N;;;;; +18984;TANGUT COMPONENT-389;Lo;0;L;;;;;N;;;;; +18985;TANGUT COMPONENT-390;Lo;0;L;;;;;N;;;;; +18986;TANGUT COMPONENT-391;Lo;0;L;;;;;N;;;;; +18987;TANGUT COMPONENT-392;Lo;0;L;;;;;N;;;;; +18988;TANGUT COMPONENT-393;Lo;0;L;;;;;N;;;;; +18989;TANGUT COMPONENT-394;Lo;0;L;;;;;N;;;;; +1898A;TANGUT COMPONENT-395;Lo;0;L;;;;;N;;;;; +1898B;TANGUT COMPONENT-396;Lo;0;L;;;;;N;;;;; +1898C;TANGUT COMPONENT-397;Lo;0;L;;;;;N;;;;; +1898D;TANGUT COMPONENT-398;Lo;0;L;;;;;N;;;;; +1898E;TANGUT COMPONENT-399;Lo;0;L;;;;;N;;;;; +1898F;TANGUT COMPONENT-400;Lo;0;L;;;;;N;;;;; +18990;TANGUT COMPONENT-401;Lo;0;L;;;;;N;;;;; +18991;TANGUT COMPONENT-402;Lo;0;L;;;;;N;;;;; +18992;TANGUT COMPONENT-403;Lo;0;L;;;;;N;;;;; +18993;TANGUT COMPONENT-404;Lo;0;L;;;;;N;;;;; +18994;TANGUT COMPONENT-405;Lo;0;L;;;;;N;;;;; +18995;TANGUT COMPONENT-406;Lo;0;L;;;;;N;;;;; +18996;TANGUT COMPONENT-407;Lo;0;L;;;;;N;;;;; +18997;TANGUT COMPONENT-408;Lo;0;L;;;;;N;;;;; +18998;TANGUT COMPONENT-409;Lo;0;L;;;;;N;;;;; +18999;TANGUT COMPONENT-410;Lo;0;L;;;;;N;;;;; +1899A;TANGUT COMPONENT-411;Lo;0;L;;;;;N;;;;; +1899B;TANGUT COMPONENT-412;Lo;0;L;;;;;N;;;;; +1899C;TANGUT COMPONENT-413;Lo;0;L;;;;;N;;;;; +1899D;TANGUT COMPONENT-414;Lo;0;L;;;;;N;;;;; +1899E;TANGUT COMPONENT-415;Lo;0;L;;;;;N;;;;; +1899F;TANGUT COMPONENT-416;Lo;0;L;;;;;N;;;;; +189A0;TANGUT COMPONENT-417;Lo;0;L;;;;;N;;;;; +189A1;TANGUT COMPONENT-418;Lo;0;L;;;;;N;;;;; +189A2;TANGUT COMPONENT-419;Lo;0;L;;;;;N;;;;; +189A3;TANGUT COMPONENT-420;Lo;0;L;;;;;N;;;;; +189A4;TANGUT COMPONENT-421;Lo;0;L;;;;;N;;;;; +189A5;TANGUT COMPONENT-422;Lo;0;L;;;;;N;;;;; +189A6;TANGUT COMPONENT-423;Lo;0;L;;;;;N;;;;; +189A7;TANGUT COMPONENT-424;Lo;0;L;;;;;N;;;;; +189A8;TANGUT COMPONENT-425;Lo;0;L;;;;;N;;;;; +189A9;TANGUT COMPONENT-426;Lo;0;L;;;;;N;;;;; +189AA;TANGUT COMPONENT-427;Lo;0;L;;;;;N;;;;; +189AB;TANGUT COMPONENT-428;Lo;0;L;;;;;N;;;;; +189AC;TANGUT COMPONENT-429;Lo;0;L;;;;;N;;;;; +189AD;TANGUT COMPONENT-430;Lo;0;L;;;;;N;;;;; +189AE;TANGUT COMPONENT-431;Lo;0;L;;;;;N;;;;; +189AF;TANGUT COMPONENT-432;Lo;0;L;;;;;N;;;;; +189B0;TANGUT COMPONENT-433;Lo;0;L;;;;;N;;;;; +189B1;TANGUT COMPONENT-434;Lo;0;L;;;;;N;;;;; +189B2;TANGUT COMPONENT-435;Lo;0;L;;;;;N;;;;; +189B3;TANGUT COMPONENT-436;Lo;0;L;;;;;N;;;;; +189B4;TANGUT COMPONENT-437;Lo;0;L;;;;;N;;;;; +189B5;TANGUT COMPONENT-438;Lo;0;L;;;;;N;;;;; +189B6;TANGUT COMPONENT-439;Lo;0;L;;;;;N;;;;; +189B7;TANGUT COMPONENT-440;Lo;0;L;;;;;N;;;;; +189B8;TANGUT COMPONENT-441;Lo;0;L;;;;;N;;;;; +189B9;TANGUT COMPONENT-442;Lo;0;L;;;;;N;;;;; +189BA;TANGUT COMPONENT-443;Lo;0;L;;;;;N;;;;; +189BB;TANGUT COMPONENT-444;Lo;0;L;;;;;N;;;;; +189BC;TANGUT COMPONENT-445;Lo;0;L;;;;;N;;;;; +189BD;TANGUT COMPONENT-446;Lo;0;L;;;;;N;;;;; +189BE;TANGUT COMPONENT-447;Lo;0;L;;;;;N;;;;; +189BF;TANGUT COMPONENT-448;Lo;0;L;;;;;N;;;;; +189C0;TANGUT COMPONENT-449;Lo;0;L;;;;;N;;;;; +189C1;TANGUT COMPONENT-450;Lo;0;L;;;;;N;;;;; +189C2;TANGUT COMPONENT-451;Lo;0;L;;;;;N;;;;; +189C3;TANGUT COMPONENT-452;Lo;0;L;;;;;N;;;;; +189C4;TANGUT COMPONENT-453;Lo;0;L;;;;;N;;;;; +189C5;TANGUT COMPONENT-454;Lo;0;L;;;;;N;;;;; +189C6;TANGUT COMPONENT-455;Lo;0;L;;;;;N;;;;; +189C7;TANGUT COMPONENT-456;Lo;0;L;;;;;N;;;;; +189C8;TANGUT COMPONENT-457;Lo;0;L;;;;;N;;;;; +189C9;TANGUT COMPONENT-458;Lo;0;L;;;;;N;;;;; +189CA;TANGUT COMPONENT-459;Lo;0;L;;;;;N;;;;; +189CB;TANGUT COMPONENT-460;Lo;0;L;;;;;N;;;;; +189CC;TANGUT COMPONENT-461;Lo;0;L;;;;;N;;;;; +189CD;TANGUT COMPONENT-462;Lo;0;L;;;;;N;;;;; +189CE;TANGUT COMPONENT-463;Lo;0;L;;;;;N;;;;; +189CF;TANGUT COMPONENT-464;Lo;0;L;;;;;N;;;;; +189D0;TANGUT COMPONENT-465;Lo;0;L;;;;;N;;;;; +189D1;TANGUT COMPONENT-466;Lo;0;L;;;;;N;;;;; +189D2;TANGUT COMPONENT-467;Lo;0;L;;;;;N;;;;; +189D3;TANGUT COMPONENT-468;Lo;0;L;;;;;N;;;;; +189D4;TANGUT COMPONENT-469;Lo;0;L;;;;;N;;;;; +189D5;TANGUT COMPONENT-470;Lo;0;L;;;;;N;;;;; +189D6;TANGUT COMPONENT-471;Lo;0;L;;;;;N;;;;; +189D7;TANGUT COMPONENT-472;Lo;0;L;;;;;N;;;;; +189D8;TANGUT COMPONENT-473;Lo;0;L;;;;;N;;;;; +189D9;TANGUT COMPONENT-474;Lo;0;L;;;;;N;;;;; +189DA;TANGUT COMPONENT-475;Lo;0;L;;;;;N;;;;; +189DB;TANGUT COMPONENT-476;Lo;0;L;;;;;N;;;;; +189DC;TANGUT COMPONENT-477;Lo;0;L;;;;;N;;;;; +189DD;TANGUT COMPONENT-478;Lo;0;L;;;;;N;;;;; +189DE;TANGUT COMPONENT-479;Lo;0;L;;;;;N;;;;; +189DF;TANGUT COMPONENT-480;Lo;0;L;;;;;N;;;;; +189E0;TANGUT COMPONENT-481;Lo;0;L;;;;;N;;;;; +189E1;TANGUT COMPONENT-482;Lo;0;L;;;;;N;;;;; +189E2;TANGUT COMPONENT-483;Lo;0;L;;;;;N;;;;; +189E3;TANGUT COMPONENT-484;Lo;0;L;;;;;N;;;;; +189E4;TANGUT COMPONENT-485;Lo;0;L;;;;;N;;;;; +189E5;TANGUT COMPONENT-486;Lo;0;L;;;;;N;;;;; +189E6;TANGUT COMPONENT-487;Lo;0;L;;;;;N;;;;; +189E7;TANGUT COMPONENT-488;Lo;0;L;;;;;N;;;;; +189E8;TANGUT COMPONENT-489;Lo;0;L;;;;;N;;;;; +189E9;TANGUT COMPONENT-490;Lo;0;L;;;;;N;;;;; +189EA;TANGUT COMPONENT-491;Lo;0;L;;;;;N;;;;; +189EB;TANGUT COMPONENT-492;Lo;0;L;;;;;N;;;;; +189EC;TANGUT COMPONENT-493;Lo;0;L;;;;;N;;;;; +189ED;TANGUT COMPONENT-494;Lo;0;L;;;;;N;;;;; +189EE;TANGUT COMPONENT-495;Lo;0;L;;;;;N;;;;; +189EF;TANGUT COMPONENT-496;Lo;0;L;;;;;N;;;;; +189F0;TANGUT COMPONENT-497;Lo;0;L;;;;;N;;;;; +189F1;TANGUT COMPONENT-498;Lo;0;L;;;;;N;;;;; +189F2;TANGUT COMPONENT-499;Lo;0;L;;;;;N;;;;; +189F3;TANGUT COMPONENT-500;Lo;0;L;;;;;N;;;;; +189F4;TANGUT COMPONENT-501;Lo;0;L;;;;;N;;;;; +189F5;TANGUT COMPONENT-502;Lo;0;L;;;;;N;;;;; +189F6;TANGUT COMPONENT-503;Lo;0;L;;;;;N;;;;; +189F7;TANGUT COMPONENT-504;Lo;0;L;;;;;N;;;;; +189F8;TANGUT COMPONENT-505;Lo;0;L;;;;;N;;;;; +189F9;TANGUT COMPONENT-506;Lo;0;L;;;;;N;;;;; +189FA;TANGUT COMPONENT-507;Lo;0;L;;;;;N;;;;; +189FB;TANGUT COMPONENT-508;Lo;0;L;;;;;N;;;;; +189FC;TANGUT COMPONENT-509;Lo;0;L;;;;;N;;;;; +189FD;TANGUT COMPONENT-510;Lo;0;L;;;;;N;;;;; +189FE;TANGUT COMPONENT-511;Lo;0;L;;;;;N;;;;; +189FF;TANGUT COMPONENT-512;Lo;0;L;;;;;N;;;;; +18A00;TANGUT COMPONENT-513;Lo;0;L;;;;;N;;;;; +18A01;TANGUT COMPONENT-514;Lo;0;L;;;;;N;;;;; +18A02;TANGUT COMPONENT-515;Lo;0;L;;;;;N;;;;; +18A03;TANGUT COMPONENT-516;Lo;0;L;;;;;N;;;;; +18A04;TANGUT COMPONENT-517;Lo;0;L;;;;;N;;;;; +18A05;TANGUT COMPONENT-518;Lo;0;L;;;;;N;;;;; +18A06;TANGUT COMPONENT-519;Lo;0;L;;;;;N;;;;; +18A07;TANGUT COMPONENT-520;Lo;0;L;;;;;N;;;;; +18A08;TANGUT COMPONENT-521;Lo;0;L;;;;;N;;;;; +18A09;TANGUT COMPONENT-522;Lo;0;L;;;;;N;;;;; +18A0A;TANGUT COMPONENT-523;Lo;0;L;;;;;N;;;;; +18A0B;TANGUT COMPONENT-524;Lo;0;L;;;;;N;;;;; +18A0C;TANGUT COMPONENT-525;Lo;0;L;;;;;N;;;;; +18A0D;TANGUT COMPONENT-526;Lo;0;L;;;;;N;;;;; +18A0E;TANGUT COMPONENT-527;Lo;0;L;;;;;N;;;;; +18A0F;TANGUT COMPONENT-528;Lo;0;L;;;;;N;;;;; +18A10;TANGUT COMPONENT-529;Lo;0;L;;;;;N;;;;; +18A11;TANGUT COMPONENT-530;Lo;0;L;;;;;N;;;;; +18A12;TANGUT COMPONENT-531;Lo;0;L;;;;;N;;;;; +18A13;TANGUT COMPONENT-532;Lo;0;L;;;;;N;;;;; +18A14;TANGUT COMPONENT-533;Lo;0;L;;;;;N;;;;; +18A15;TANGUT COMPONENT-534;Lo;0;L;;;;;N;;;;; +18A16;TANGUT COMPONENT-535;Lo;0;L;;;;;N;;;;; +18A17;TANGUT COMPONENT-536;Lo;0;L;;;;;N;;;;; +18A18;TANGUT COMPONENT-537;Lo;0;L;;;;;N;;;;; +18A19;TANGUT COMPONENT-538;Lo;0;L;;;;;N;;;;; +18A1A;TANGUT COMPONENT-539;Lo;0;L;;;;;N;;;;; +18A1B;TANGUT COMPONENT-540;Lo;0;L;;;;;N;;;;; +18A1C;TANGUT COMPONENT-541;Lo;0;L;;;;;N;;;;; +18A1D;TANGUT COMPONENT-542;Lo;0;L;;;;;N;;;;; +18A1E;TANGUT COMPONENT-543;Lo;0;L;;;;;N;;;;; +18A1F;TANGUT COMPONENT-544;Lo;0;L;;;;;N;;;;; +18A20;TANGUT COMPONENT-545;Lo;0;L;;;;;N;;;;; +18A21;TANGUT COMPONENT-546;Lo;0;L;;;;;N;;;;; +18A22;TANGUT COMPONENT-547;Lo;0;L;;;;;N;;;;; +18A23;TANGUT COMPONENT-548;Lo;0;L;;;;;N;;;;; +18A24;TANGUT COMPONENT-549;Lo;0;L;;;;;N;;;;; +18A25;TANGUT COMPONENT-550;Lo;0;L;;;;;N;;;;; +18A26;TANGUT COMPONENT-551;Lo;0;L;;;;;N;;;;; +18A27;TANGUT COMPONENT-552;Lo;0;L;;;;;N;;;;; +18A28;TANGUT COMPONENT-553;Lo;0;L;;;;;N;;;;; +18A29;TANGUT COMPONENT-554;Lo;0;L;;;;;N;;;;; +18A2A;TANGUT COMPONENT-555;Lo;0;L;;;;;N;;;;; +18A2B;TANGUT COMPONENT-556;Lo;0;L;;;;;N;;;;; +18A2C;TANGUT COMPONENT-557;Lo;0;L;;;;;N;;;;; +18A2D;TANGUT COMPONENT-558;Lo;0;L;;;;;N;;;;; +18A2E;TANGUT COMPONENT-559;Lo;0;L;;;;;N;;;;; +18A2F;TANGUT COMPONENT-560;Lo;0;L;;;;;N;;;;; +18A30;TANGUT COMPONENT-561;Lo;0;L;;;;;N;;;;; +18A31;TANGUT COMPONENT-562;Lo;0;L;;;;;N;;;;; +18A32;TANGUT COMPONENT-563;Lo;0;L;;;;;N;;;;; +18A33;TANGUT COMPONENT-564;Lo;0;L;;;;;N;;;;; +18A34;TANGUT COMPONENT-565;Lo;0;L;;;;;N;;;;; +18A35;TANGUT COMPONENT-566;Lo;0;L;;;;;N;;;;; +18A36;TANGUT COMPONENT-567;Lo;0;L;;;;;N;;;;; +18A37;TANGUT COMPONENT-568;Lo;0;L;;;;;N;;;;; +18A38;TANGUT COMPONENT-569;Lo;0;L;;;;;N;;;;; +18A39;TANGUT COMPONENT-570;Lo;0;L;;;;;N;;;;; +18A3A;TANGUT COMPONENT-571;Lo;0;L;;;;;N;;;;; +18A3B;TANGUT COMPONENT-572;Lo;0;L;;;;;N;;;;; +18A3C;TANGUT COMPONENT-573;Lo;0;L;;;;;N;;;;; +18A3D;TANGUT COMPONENT-574;Lo;0;L;;;;;N;;;;; +18A3E;TANGUT COMPONENT-575;Lo;0;L;;;;;N;;;;; +18A3F;TANGUT COMPONENT-576;Lo;0;L;;;;;N;;;;; +18A40;TANGUT COMPONENT-577;Lo;0;L;;;;;N;;;;; +18A41;TANGUT COMPONENT-578;Lo;0;L;;;;;N;;;;; +18A42;TANGUT COMPONENT-579;Lo;0;L;;;;;N;;;;; +18A43;TANGUT COMPONENT-580;Lo;0;L;;;;;N;;;;; +18A44;TANGUT COMPONENT-581;Lo;0;L;;;;;N;;;;; +18A45;TANGUT COMPONENT-582;Lo;0;L;;;;;N;;;;; +18A46;TANGUT COMPONENT-583;Lo;0;L;;;;;N;;;;; +18A47;TANGUT COMPONENT-584;Lo;0;L;;;;;N;;;;; +18A48;TANGUT COMPONENT-585;Lo;0;L;;;;;N;;;;; +18A49;TANGUT COMPONENT-586;Lo;0;L;;;;;N;;;;; +18A4A;TANGUT COMPONENT-587;Lo;0;L;;;;;N;;;;; +18A4B;TANGUT COMPONENT-588;Lo;0;L;;;;;N;;;;; +18A4C;TANGUT COMPONENT-589;Lo;0;L;;;;;N;;;;; +18A4D;TANGUT COMPONENT-590;Lo;0;L;;;;;N;;;;; +18A4E;TANGUT COMPONENT-591;Lo;0;L;;;;;N;;;;; +18A4F;TANGUT COMPONENT-592;Lo;0;L;;;;;N;;;;; +18A50;TANGUT COMPONENT-593;Lo;0;L;;;;;N;;;;; +18A51;TANGUT COMPONENT-594;Lo;0;L;;;;;N;;;;; +18A52;TANGUT COMPONENT-595;Lo;0;L;;;;;N;;;;; +18A53;TANGUT COMPONENT-596;Lo;0;L;;;;;N;;;;; +18A54;TANGUT COMPONENT-597;Lo;0;L;;;;;N;;;;; +18A55;TANGUT COMPONENT-598;Lo;0;L;;;;;N;;;;; +18A56;TANGUT COMPONENT-599;Lo;0;L;;;;;N;;;;; +18A57;TANGUT COMPONENT-600;Lo;0;L;;;;;N;;;;; +18A58;TANGUT COMPONENT-601;Lo;0;L;;;;;N;;;;; +18A59;TANGUT COMPONENT-602;Lo;0;L;;;;;N;;;;; +18A5A;TANGUT COMPONENT-603;Lo;0;L;;;;;N;;;;; +18A5B;TANGUT COMPONENT-604;Lo;0;L;;;;;N;;;;; +18A5C;TANGUT COMPONENT-605;Lo;0;L;;;;;N;;;;; +18A5D;TANGUT COMPONENT-606;Lo;0;L;;;;;N;;;;; +18A5E;TANGUT COMPONENT-607;Lo;0;L;;;;;N;;;;; +18A5F;TANGUT COMPONENT-608;Lo;0;L;;;;;N;;;;; +18A60;TANGUT COMPONENT-609;Lo;0;L;;;;;N;;;;; +18A61;TANGUT COMPONENT-610;Lo;0;L;;;;;N;;;;; +18A62;TANGUT COMPONENT-611;Lo;0;L;;;;;N;;;;; +18A63;TANGUT COMPONENT-612;Lo;0;L;;;;;N;;;;; +18A64;TANGUT COMPONENT-613;Lo;0;L;;;;;N;;;;; +18A65;TANGUT COMPONENT-614;Lo;0;L;;;;;N;;;;; +18A66;TANGUT COMPONENT-615;Lo;0;L;;;;;N;;;;; +18A67;TANGUT COMPONENT-616;Lo;0;L;;;;;N;;;;; +18A68;TANGUT COMPONENT-617;Lo;0;L;;;;;N;;;;; +18A69;TANGUT COMPONENT-618;Lo;0;L;;;;;N;;;;; +18A6A;TANGUT COMPONENT-619;Lo;0;L;;;;;N;;;;; +18A6B;TANGUT COMPONENT-620;Lo;0;L;;;;;N;;;;; +18A6C;TANGUT COMPONENT-621;Lo;0;L;;;;;N;;;;; +18A6D;TANGUT COMPONENT-622;Lo;0;L;;;;;N;;;;; +18A6E;TANGUT COMPONENT-623;Lo;0;L;;;;;N;;;;; +18A6F;TANGUT COMPONENT-624;Lo;0;L;;;;;N;;;;; +18A70;TANGUT COMPONENT-625;Lo;0;L;;;;;N;;;;; +18A71;TANGUT COMPONENT-626;Lo;0;L;;;;;N;;;;; +18A72;TANGUT COMPONENT-627;Lo;0;L;;;;;N;;;;; +18A73;TANGUT COMPONENT-628;Lo;0;L;;;;;N;;;;; +18A74;TANGUT COMPONENT-629;Lo;0;L;;;;;N;;;;; +18A75;TANGUT COMPONENT-630;Lo;0;L;;;;;N;;;;; +18A76;TANGUT COMPONENT-631;Lo;0;L;;;;;N;;;;; +18A77;TANGUT COMPONENT-632;Lo;0;L;;;;;N;;;;; +18A78;TANGUT COMPONENT-633;Lo;0;L;;;;;N;;;;; +18A79;TANGUT COMPONENT-634;Lo;0;L;;;;;N;;;;; +18A7A;TANGUT COMPONENT-635;Lo;0;L;;;;;N;;;;; +18A7B;TANGUT COMPONENT-636;Lo;0;L;;;;;N;;;;; +18A7C;TANGUT COMPONENT-637;Lo;0;L;;;;;N;;;;; +18A7D;TANGUT COMPONENT-638;Lo;0;L;;;;;N;;;;; +18A7E;TANGUT COMPONENT-639;Lo;0;L;;;;;N;;;;; +18A7F;TANGUT COMPONENT-640;Lo;0;L;;;;;N;;;;; +18A80;TANGUT COMPONENT-641;Lo;0;L;;;;;N;;;;; +18A81;TANGUT COMPONENT-642;Lo;0;L;;;;;N;;;;; +18A82;TANGUT COMPONENT-643;Lo;0;L;;;;;N;;;;; +18A83;TANGUT COMPONENT-644;Lo;0;L;;;;;N;;;;; +18A84;TANGUT COMPONENT-645;Lo;0;L;;;;;N;;;;; +18A85;TANGUT COMPONENT-646;Lo;0;L;;;;;N;;;;; +18A86;TANGUT COMPONENT-647;Lo;0;L;;;;;N;;;;; +18A87;TANGUT COMPONENT-648;Lo;0;L;;;;;N;;;;; +18A88;TANGUT COMPONENT-649;Lo;0;L;;;;;N;;;;; +18A89;TANGUT COMPONENT-650;Lo;0;L;;;;;N;;;;; +18A8A;TANGUT COMPONENT-651;Lo;0;L;;;;;N;;;;; +18A8B;TANGUT COMPONENT-652;Lo;0;L;;;;;N;;;;; +18A8C;TANGUT COMPONENT-653;Lo;0;L;;;;;N;;;;; +18A8D;TANGUT COMPONENT-654;Lo;0;L;;;;;N;;;;; +18A8E;TANGUT COMPONENT-655;Lo;0;L;;;;;N;;;;; +18A8F;TANGUT COMPONENT-656;Lo;0;L;;;;;N;;;;; +18A90;TANGUT COMPONENT-657;Lo;0;L;;;;;N;;;;; +18A91;TANGUT COMPONENT-658;Lo;0;L;;;;;N;;;;; +18A92;TANGUT COMPONENT-659;Lo;0;L;;;;;N;;;;; +18A93;TANGUT COMPONENT-660;Lo;0;L;;;;;N;;;;; +18A94;TANGUT COMPONENT-661;Lo;0;L;;;;;N;;;;; +18A95;TANGUT COMPONENT-662;Lo;0;L;;;;;N;;;;; +18A96;TANGUT COMPONENT-663;Lo;0;L;;;;;N;;;;; +18A97;TANGUT COMPONENT-664;Lo;0;L;;;;;N;;;;; +18A98;TANGUT COMPONENT-665;Lo;0;L;;;;;N;;;;; +18A99;TANGUT COMPONENT-666;Lo;0;L;;;;;N;;;;; +18A9A;TANGUT COMPONENT-667;Lo;0;L;;;;;N;;;;; +18A9B;TANGUT COMPONENT-668;Lo;0;L;;;;;N;;;;; +18A9C;TANGUT COMPONENT-669;Lo;0;L;;;;;N;;;;; +18A9D;TANGUT COMPONENT-670;Lo;0;L;;;;;N;;;;; +18A9E;TANGUT COMPONENT-671;Lo;0;L;;;;;N;;;;; +18A9F;TANGUT COMPONENT-672;Lo;0;L;;;;;N;;;;; +18AA0;TANGUT COMPONENT-673;Lo;0;L;;;;;N;;;;; +18AA1;TANGUT COMPONENT-674;Lo;0;L;;;;;N;;;;; +18AA2;TANGUT COMPONENT-675;Lo;0;L;;;;;N;;;;; +18AA3;TANGUT COMPONENT-676;Lo;0;L;;;;;N;;;;; +18AA4;TANGUT COMPONENT-677;Lo;0;L;;;;;N;;;;; +18AA5;TANGUT COMPONENT-678;Lo;0;L;;;;;N;;;;; +18AA6;TANGUT COMPONENT-679;Lo;0;L;;;;;N;;;;; +18AA7;TANGUT COMPONENT-680;Lo;0;L;;;;;N;;;;; +18AA8;TANGUT COMPONENT-681;Lo;0;L;;;;;N;;;;; +18AA9;TANGUT COMPONENT-682;Lo;0;L;;;;;N;;;;; +18AAA;TANGUT COMPONENT-683;Lo;0;L;;;;;N;;;;; +18AAB;TANGUT COMPONENT-684;Lo;0;L;;;;;N;;;;; +18AAC;TANGUT COMPONENT-685;Lo;0;L;;;;;N;;;;; +18AAD;TANGUT COMPONENT-686;Lo;0;L;;;;;N;;;;; +18AAE;TANGUT COMPONENT-687;Lo;0;L;;;;;N;;;;; +18AAF;TANGUT COMPONENT-688;Lo;0;L;;;;;N;;;;; +18AB0;TANGUT COMPONENT-689;Lo;0;L;;;;;N;;;;; +18AB1;TANGUT COMPONENT-690;Lo;0;L;;;;;N;;;;; +18AB2;TANGUT COMPONENT-691;Lo;0;L;;;;;N;;;;; +18AB3;TANGUT COMPONENT-692;Lo;0;L;;;;;N;;;;; +18AB4;TANGUT COMPONENT-693;Lo;0;L;;;;;N;;;;; +18AB5;TANGUT COMPONENT-694;Lo;0;L;;;;;N;;;;; +18AB6;TANGUT COMPONENT-695;Lo;0;L;;;;;N;;;;; +18AB7;TANGUT COMPONENT-696;Lo;0;L;;;;;N;;;;; +18AB8;TANGUT COMPONENT-697;Lo;0;L;;;;;N;;;;; +18AB9;TANGUT COMPONENT-698;Lo;0;L;;;;;N;;;;; +18ABA;TANGUT COMPONENT-699;Lo;0;L;;;;;N;;;;; +18ABB;TANGUT COMPONENT-700;Lo;0;L;;;;;N;;;;; +18ABC;TANGUT COMPONENT-701;Lo;0;L;;;;;N;;;;; +18ABD;TANGUT COMPONENT-702;Lo;0;L;;;;;N;;;;; +18ABE;TANGUT COMPONENT-703;Lo;0;L;;;;;N;;;;; +18ABF;TANGUT COMPONENT-704;Lo;0;L;;;;;N;;;;; +18AC0;TANGUT COMPONENT-705;Lo;0;L;;;;;N;;;;; +18AC1;TANGUT COMPONENT-706;Lo;0;L;;;;;N;;;;; +18AC2;TANGUT COMPONENT-707;Lo;0;L;;;;;N;;;;; +18AC3;TANGUT COMPONENT-708;Lo;0;L;;;;;N;;;;; +18AC4;TANGUT COMPONENT-709;Lo;0;L;;;;;N;;;;; +18AC5;TANGUT COMPONENT-710;Lo;0;L;;;;;N;;;;; +18AC6;TANGUT COMPONENT-711;Lo;0;L;;;;;N;;;;; +18AC7;TANGUT COMPONENT-712;Lo;0;L;;;;;N;;;;; +18AC8;TANGUT COMPONENT-713;Lo;0;L;;;;;N;;;;; +18AC9;TANGUT COMPONENT-714;Lo;0;L;;;;;N;;;;; +18ACA;TANGUT COMPONENT-715;Lo;0;L;;;;;N;;;;; +18ACB;TANGUT COMPONENT-716;Lo;0;L;;;;;N;;;;; +18ACC;TANGUT COMPONENT-717;Lo;0;L;;;;;N;;;;; +18ACD;TANGUT COMPONENT-718;Lo;0;L;;;;;N;;;;; +18ACE;TANGUT COMPONENT-719;Lo;0;L;;;;;N;;;;; +18ACF;TANGUT COMPONENT-720;Lo;0;L;;;;;N;;;;; +18AD0;TANGUT COMPONENT-721;Lo;0;L;;;;;N;;;;; +18AD1;TANGUT COMPONENT-722;Lo;0;L;;;;;N;;;;; +18AD2;TANGUT COMPONENT-723;Lo;0;L;;;;;N;;;;; +18AD3;TANGUT COMPONENT-724;Lo;0;L;;;;;N;;;;; +18AD4;TANGUT COMPONENT-725;Lo;0;L;;;;;N;;;;; +18AD5;TANGUT COMPONENT-726;Lo;0;L;;;;;N;;;;; +18AD6;TANGUT COMPONENT-727;Lo;0;L;;;;;N;;;;; +18AD7;TANGUT COMPONENT-728;Lo;0;L;;;;;N;;;;; +18AD8;TANGUT COMPONENT-729;Lo;0;L;;;;;N;;;;; +18AD9;TANGUT COMPONENT-730;Lo;0;L;;;;;N;;;;; +18ADA;TANGUT COMPONENT-731;Lo;0;L;;;;;N;;;;; +18ADB;TANGUT COMPONENT-732;Lo;0;L;;;;;N;;;;; +18ADC;TANGUT COMPONENT-733;Lo;0;L;;;;;N;;;;; +18ADD;TANGUT COMPONENT-734;Lo;0;L;;;;;N;;;;; +18ADE;TANGUT COMPONENT-735;Lo;0;L;;;;;N;;;;; +18ADF;TANGUT COMPONENT-736;Lo;0;L;;;;;N;;;;; +18AE0;TANGUT COMPONENT-737;Lo;0;L;;;;;N;;;;; +18AE1;TANGUT COMPONENT-738;Lo;0;L;;;;;N;;;;; +18AE2;TANGUT COMPONENT-739;Lo;0;L;;;;;N;;;;; +18AE3;TANGUT COMPONENT-740;Lo;0;L;;;;;N;;;;; +18AE4;TANGUT COMPONENT-741;Lo;0;L;;;;;N;;;;; +18AE5;TANGUT COMPONENT-742;Lo;0;L;;;;;N;;;;; +18AE6;TANGUT COMPONENT-743;Lo;0;L;;;;;N;;;;; +18AE7;TANGUT COMPONENT-744;Lo;0;L;;;;;N;;;;; +18AE8;TANGUT COMPONENT-745;Lo;0;L;;;;;N;;;;; +18AE9;TANGUT COMPONENT-746;Lo;0;L;;;;;N;;;;; +18AEA;TANGUT COMPONENT-747;Lo;0;L;;;;;N;;;;; +18AEB;TANGUT COMPONENT-748;Lo;0;L;;;;;N;;;;; +18AEC;TANGUT COMPONENT-749;Lo;0;L;;;;;N;;;;; +18AED;TANGUT COMPONENT-750;Lo;0;L;;;;;N;;;;; +18AEE;TANGUT COMPONENT-751;Lo;0;L;;;;;N;;;;; +18AEF;TANGUT COMPONENT-752;Lo;0;L;;;;;N;;;;; +18AF0;TANGUT COMPONENT-753;Lo;0;L;;;;;N;;;;; +18AF1;TANGUT COMPONENT-754;Lo;0;L;;;;;N;;;;; +18AF2;TANGUT COMPONENT-755;Lo;0;L;;;;;N;;;;; 1B000;KATAKANA LETTER ARCHAIC E;Lo;0;L;;;;;N;;;;; 1B001;HIRAGANA LETTER ARCHAIC YE;Lo;0;L;;;;;N;;;;; +1B002;HENTAIGANA LETTER A-1;Lo;0;L;;;;;N;;;;; +1B003;HENTAIGANA LETTER A-2;Lo;0;L;;;;;N;;;;; +1B004;HENTAIGANA LETTER A-3;Lo;0;L;;;;;N;;;;; +1B005;HENTAIGANA LETTER A-WO;Lo;0;L;;;;;N;;;;; +1B006;HENTAIGANA LETTER I-1;Lo;0;L;;;;;N;;;;; +1B007;HENTAIGANA LETTER I-2;Lo;0;L;;;;;N;;;;; +1B008;HENTAIGANA LETTER I-3;Lo;0;L;;;;;N;;;;; +1B009;HENTAIGANA LETTER I-4;Lo;0;L;;;;;N;;;;; +1B00A;HENTAIGANA LETTER U-1;Lo;0;L;;;;;N;;;;; +1B00B;HENTAIGANA LETTER U-2;Lo;0;L;;;;;N;;;;; +1B00C;HENTAIGANA LETTER U-3;Lo;0;L;;;;;N;;;;; +1B00D;HENTAIGANA LETTER U-4;Lo;0;L;;;;;N;;;;; +1B00E;HENTAIGANA LETTER U-5;Lo;0;L;;;;;N;;;;; +1B00F;HENTAIGANA LETTER E-2;Lo;0;L;;;;;N;;;;; +1B010;HENTAIGANA LETTER E-3;Lo;0;L;;;;;N;;;;; +1B011;HENTAIGANA LETTER E-4;Lo;0;L;;;;;N;;;;; +1B012;HENTAIGANA LETTER E-5;Lo;0;L;;;;;N;;;;; +1B013;HENTAIGANA LETTER E-6;Lo;0;L;;;;;N;;;;; +1B014;HENTAIGANA LETTER O-1;Lo;0;L;;;;;N;;;;; +1B015;HENTAIGANA LETTER O-2;Lo;0;L;;;;;N;;;;; +1B016;HENTAIGANA LETTER O-3;Lo;0;L;;;;;N;;;;; +1B017;HENTAIGANA LETTER KA-1;Lo;0;L;;;;;N;;;;; +1B018;HENTAIGANA LETTER KA-2;Lo;0;L;;;;;N;;;;; +1B019;HENTAIGANA LETTER KA-3;Lo;0;L;;;;;N;;;;; +1B01A;HENTAIGANA LETTER KA-4;Lo;0;L;;;;;N;;;;; +1B01B;HENTAIGANA LETTER KA-5;Lo;0;L;;;;;N;;;;; +1B01C;HENTAIGANA LETTER KA-6;Lo;0;L;;;;;N;;;;; +1B01D;HENTAIGANA LETTER KA-7;Lo;0;L;;;;;N;;;;; +1B01E;HENTAIGANA LETTER KA-8;Lo;0;L;;;;;N;;;;; +1B01F;HENTAIGANA LETTER KA-9;Lo;0;L;;;;;N;;;;; +1B020;HENTAIGANA LETTER KA-10;Lo;0;L;;;;;N;;;;; +1B021;HENTAIGANA LETTER KA-11;Lo;0;L;;;;;N;;;;; +1B022;HENTAIGANA LETTER KA-KE;Lo;0;L;;;;;N;;;;; +1B023;HENTAIGANA LETTER KI-1;Lo;0;L;;;;;N;;;;; +1B024;HENTAIGANA LETTER KI-2;Lo;0;L;;;;;N;;;;; +1B025;HENTAIGANA LETTER KI-3;Lo;0;L;;;;;N;;;;; +1B026;HENTAIGANA LETTER KI-4;Lo;0;L;;;;;N;;;;; +1B027;HENTAIGANA LETTER KI-5;Lo;0;L;;;;;N;;;;; +1B028;HENTAIGANA LETTER KI-6;Lo;0;L;;;;;N;;;;; +1B029;HENTAIGANA LETTER KI-7;Lo;0;L;;;;;N;;;;; +1B02A;HENTAIGANA LETTER KI-8;Lo;0;L;;;;;N;;;;; +1B02B;HENTAIGANA LETTER KU-1;Lo;0;L;;;;;N;;;;; +1B02C;HENTAIGANA LETTER KU-2;Lo;0;L;;;;;N;;;;; +1B02D;HENTAIGANA LETTER KU-3;Lo;0;L;;;;;N;;;;; +1B02E;HENTAIGANA LETTER KU-4;Lo;0;L;;;;;N;;;;; +1B02F;HENTAIGANA LETTER KU-5;Lo;0;L;;;;;N;;;;; +1B030;HENTAIGANA LETTER KU-6;Lo;0;L;;;;;N;;;;; +1B031;HENTAIGANA LETTER KU-7;Lo;0;L;;;;;N;;;;; +1B032;HENTAIGANA LETTER KE-1;Lo;0;L;;;;;N;;;;; +1B033;HENTAIGANA LETTER KE-2;Lo;0;L;;;;;N;;;;; +1B034;HENTAIGANA LETTER KE-3;Lo;0;L;;;;;N;;;;; +1B035;HENTAIGANA LETTER KE-4;Lo;0;L;;;;;N;;;;; +1B036;HENTAIGANA LETTER KE-5;Lo;0;L;;;;;N;;;;; +1B037;HENTAIGANA LETTER KE-6;Lo;0;L;;;;;N;;;;; +1B038;HENTAIGANA LETTER KO-1;Lo;0;L;;;;;N;;;;; +1B039;HENTAIGANA LETTER KO-2;Lo;0;L;;;;;N;;;;; +1B03A;HENTAIGANA LETTER KO-3;Lo;0;L;;;;;N;;;;; +1B03B;HENTAIGANA LETTER KO-KI;Lo;0;L;;;;;N;;;;; +1B03C;HENTAIGANA LETTER SA-1;Lo;0;L;;;;;N;;;;; +1B03D;HENTAIGANA LETTER SA-2;Lo;0;L;;;;;N;;;;; +1B03E;HENTAIGANA LETTER SA-3;Lo;0;L;;;;;N;;;;; +1B03F;HENTAIGANA LETTER SA-4;Lo;0;L;;;;;N;;;;; +1B040;HENTAIGANA LETTER SA-5;Lo;0;L;;;;;N;;;;; +1B041;HENTAIGANA LETTER SA-6;Lo;0;L;;;;;N;;;;; +1B042;HENTAIGANA LETTER SA-7;Lo;0;L;;;;;N;;;;; +1B043;HENTAIGANA LETTER SA-8;Lo;0;L;;;;;N;;;;; +1B044;HENTAIGANA LETTER SI-1;Lo;0;L;;;;;N;;;;; +1B045;HENTAIGANA LETTER SI-2;Lo;0;L;;;;;N;;;;; +1B046;HENTAIGANA LETTER SI-3;Lo;0;L;;;;;N;;;;; +1B047;HENTAIGANA LETTER SI-4;Lo;0;L;;;;;N;;;;; +1B048;HENTAIGANA LETTER SI-5;Lo;0;L;;;;;N;;;;; +1B049;HENTAIGANA LETTER SI-6;Lo;0;L;;;;;N;;;;; +1B04A;HENTAIGANA LETTER SU-1;Lo;0;L;;;;;N;;;;; +1B04B;HENTAIGANA LETTER SU-2;Lo;0;L;;;;;N;;;;; +1B04C;HENTAIGANA LETTER SU-3;Lo;0;L;;;;;N;;;;; +1B04D;HENTAIGANA LETTER SU-4;Lo;0;L;;;;;N;;;;; +1B04E;HENTAIGANA LETTER SU-5;Lo;0;L;;;;;N;;;;; +1B04F;HENTAIGANA LETTER SU-6;Lo;0;L;;;;;N;;;;; +1B050;HENTAIGANA LETTER SU-7;Lo;0;L;;;;;N;;;;; +1B051;HENTAIGANA LETTER SU-8;Lo;0;L;;;;;N;;;;; +1B052;HENTAIGANA LETTER SE-1;Lo;0;L;;;;;N;;;;; +1B053;HENTAIGANA LETTER SE-2;Lo;0;L;;;;;N;;;;; +1B054;HENTAIGANA LETTER SE-3;Lo;0;L;;;;;N;;;;; +1B055;HENTAIGANA LETTER SE-4;Lo;0;L;;;;;N;;;;; +1B056;HENTAIGANA LETTER SE-5;Lo;0;L;;;;;N;;;;; +1B057;HENTAIGANA LETTER SO-1;Lo;0;L;;;;;N;;;;; +1B058;HENTAIGANA LETTER SO-2;Lo;0;L;;;;;N;;;;; +1B059;HENTAIGANA LETTER SO-3;Lo;0;L;;;;;N;;;;; +1B05A;HENTAIGANA LETTER SO-4;Lo;0;L;;;;;N;;;;; +1B05B;HENTAIGANA LETTER SO-5;Lo;0;L;;;;;N;;;;; +1B05C;HENTAIGANA LETTER SO-6;Lo;0;L;;;;;N;;;;; +1B05D;HENTAIGANA LETTER SO-7;Lo;0;L;;;;;N;;;;; +1B05E;HENTAIGANA LETTER TA-1;Lo;0;L;;;;;N;;;;; +1B05F;HENTAIGANA LETTER TA-2;Lo;0;L;;;;;N;;;;; +1B060;HENTAIGANA LETTER TA-3;Lo;0;L;;;;;N;;;;; +1B061;HENTAIGANA LETTER TA-4;Lo;0;L;;;;;N;;;;; +1B062;HENTAIGANA LETTER TI-1;Lo;0;L;;;;;N;;;;; +1B063;HENTAIGANA LETTER TI-2;Lo;0;L;;;;;N;;;;; +1B064;HENTAIGANA LETTER TI-3;Lo;0;L;;;;;N;;;;; +1B065;HENTAIGANA LETTER TI-4;Lo;0;L;;;;;N;;;;; +1B066;HENTAIGANA LETTER TI-5;Lo;0;L;;;;;N;;;;; +1B067;HENTAIGANA LETTER TI-6;Lo;0;L;;;;;N;;;;; +1B068;HENTAIGANA LETTER TI-7;Lo;0;L;;;;;N;;;;; +1B069;HENTAIGANA LETTER TU-1;Lo;0;L;;;;;N;;;;; +1B06A;HENTAIGANA LETTER TU-2;Lo;0;L;;;;;N;;;;; +1B06B;HENTAIGANA LETTER TU-3;Lo;0;L;;;;;N;;;;; +1B06C;HENTAIGANA LETTER TU-4;Lo;0;L;;;;;N;;;;; +1B06D;HENTAIGANA LETTER TU-TO;Lo;0;L;;;;;N;;;;; +1B06E;HENTAIGANA LETTER TE-1;Lo;0;L;;;;;N;;;;; +1B06F;HENTAIGANA LETTER TE-2;Lo;0;L;;;;;N;;;;; +1B070;HENTAIGANA LETTER TE-3;Lo;0;L;;;;;N;;;;; +1B071;HENTAIGANA LETTER TE-4;Lo;0;L;;;;;N;;;;; +1B072;HENTAIGANA LETTER TE-5;Lo;0;L;;;;;N;;;;; +1B073;HENTAIGANA LETTER TE-6;Lo;0;L;;;;;N;;;;; +1B074;HENTAIGANA LETTER TE-7;Lo;0;L;;;;;N;;;;; +1B075;HENTAIGANA LETTER TE-8;Lo;0;L;;;;;N;;;;; +1B076;HENTAIGANA LETTER TE-9;Lo;0;L;;;;;N;;;;; +1B077;HENTAIGANA LETTER TO-1;Lo;0;L;;;;;N;;;;; +1B078;HENTAIGANA LETTER TO-2;Lo;0;L;;;;;N;;;;; +1B079;HENTAIGANA LETTER TO-3;Lo;0;L;;;;;N;;;;; +1B07A;HENTAIGANA LETTER TO-4;Lo;0;L;;;;;N;;;;; +1B07B;HENTAIGANA LETTER TO-5;Lo;0;L;;;;;N;;;;; +1B07C;HENTAIGANA LETTER TO-6;Lo;0;L;;;;;N;;;;; +1B07D;HENTAIGANA LETTER TO-RA;Lo;0;L;;;;;N;;;;; +1B07E;HENTAIGANA LETTER NA-1;Lo;0;L;;;;;N;;;;; +1B07F;HENTAIGANA LETTER NA-2;Lo;0;L;;;;;N;;;;; +1B080;HENTAIGANA LETTER NA-3;Lo;0;L;;;;;N;;;;; +1B081;HENTAIGANA LETTER NA-4;Lo;0;L;;;;;N;;;;; +1B082;HENTAIGANA LETTER NA-5;Lo;0;L;;;;;N;;;;; +1B083;HENTAIGANA LETTER NA-6;Lo;0;L;;;;;N;;;;; +1B084;HENTAIGANA LETTER NA-7;Lo;0;L;;;;;N;;;;; +1B085;HENTAIGANA LETTER NA-8;Lo;0;L;;;;;N;;;;; +1B086;HENTAIGANA LETTER NA-9;Lo;0;L;;;;;N;;;;; +1B087;HENTAIGANA LETTER NI-1;Lo;0;L;;;;;N;;;;; +1B088;HENTAIGANA LETTER NI-2;Lo;0;L;;;;;N;;;;; +1B089;HENTAIGANA LETTER NI-3;Lo;0;L;;;;;N;;;;; +1B08A;HENTAIGANA LETTER NI-4;Lo;0;L;;;;;N;;;;; +1B08B;HENTAIGANA LETTER NI-5;Lo;0;L;;;;;N;;;;; +1B08C;HENTAIGANA LETTER NI-6;Lo;0;L;;;;;N;;;;; +1B08D;HENTAIGANA LETTER NI-7;Lo;0;L;;;;;N;;;;; +1B08E;HENTAIGANA LETTER NI-TE;Lo;0;L;;;;;N;;;;; +1B08F;HENTAIGANA LETTER NU-1;Lo;0;L;;;;;N;;;;; +1B090;HENTAIGANA LETTER NU-2;Lo;0;L;;;;;N;;;;; +1B091;HENTAIGANA LETTER NU-3;Lo;0;L;;;;;N;;;;; +1B092;HENTAIGANA LETTER NE-1;Lo;0;L;;;;;N;;;;; +1B093;HENTAIGANA LETTER NE-2;Lo;0;L;;;;;N;;;;; +1B094;HENTAIGANA LETTER NE-3;Lo;0;L;;;;;N;;;;; +1B095;HENTAIGANA LETTER NE-4;Lo;0;L;;;;;N;;;;; +1B096;HENTAIGANA LETTER NE-5;Lo;0;L;;;;;N;;;;; +1B097;HENTAIGANA LETTER NE-6;Lo;0;L;;;;;N;;;;; +1B098;HENTAIGANA LETTER NE-KO;Lo;0;L;;;;;N;;;;; +1B099;HENTAIGANA LETTER NO-1;Lo;0;L;;;;;N;;;;; +1B09A;HENTAIGANA LETTER NO-2;Lo;0;L;;;;;N;;;;; +1B09B;HENTAIGANA LETTER NO-3;Lo;0;L;;;;;N;;;;; +1B09C;HENTAIGANA LETTER NO-4;Lo;0;L;;;;;N;;;;; +1B09D;HENTAIGANA LETTER NO-5;Lo;0;L;;;;;N;;;;; +1B09E;HENTAIGANA LETTER HA-1;Lo;0;L;;;;;N;;;;; +1B09F;HENTAIGANA LETTER HA-2;Lo;0;L;;;;;N;;;;; +1B0A0;HENTAIGANA LETTER HA-3;Lo;0;L;;;;;N;;;;; +1B0A1;HENTAIGANA LETTER HA-4;Lo;0;L;;;;;N;;;;; +1B0A2;HENTAIGANA LETTER HA-5;Lo;0;L;;;;;N;;;;; +1B0A3;HENTAIGANA LETTER HA-6;Lo;0;L;;;;;N;;;;; +1B0A4;HENTAIGANA LETTER HA-7;Lo;0;L;;;;;N;;;;; +1B0A5;HENTAIGANA LETTER HA-8;Lo;0;L;;;;;N;;;;; +1B0A6;HENTAIGANA LETTER HA-9;Lo;0;L;;;;;N;;;;; +1B0A7;HENTAIGANA LETTER HA-10;Lo;0;L;;;;;N;;;;; +1B0A8;HENTAIGANA LETTER HA-11;Lo;0;L;;;;;N;;;;; +1B0A9;HENTAIGANA LETTER HI-1;Lo;0;L;;;;;N;;;;; +1B0AA;HENTAIGANA LETTER HI-2;Lo;0;L;;;;;N;;;;; +1B0AB;HENTAIGANA LETTER HI-3;Lo;0;L;;;;;N;;;;; +1B0AC;HENTAIGANA LETTER HI-4;Lo;0;L;;;;;N;;;;; +1B0AD;HENTAIGANA LETTER HI-5;Lo;0;L;;;;;N;;;;; +1B0AE;HENTAIGANA LETTER HI-6;Lo;0;L;;;;;N;;;;; +1B0AF;HENTAIGANA LETTER HI-7;Lo;0;L;;;;;N;;;;; +1B0B0;HENTAIGANA LETTER HU-1;Lo;0;L;;;;;N;;;;; +1B0B1;HENTAIGANA LETTER HU-2;Lo;0;L;;;;;N;;;;; +1B0B2;HENTAIGANA LETTER HU-3;Lo;0;L;;;;;N;;;;; +1B0B3;HENTAIGANA LETTER HE-1;Lo;0;L;;;;;N;;;;; +1B0B4;HENTAIGANA LETTER HE-2;Lo;0;L;;;;;N;;;;; +1B0B5;HENTAIGANA LETTER HE-3;Lo;0;L;;;;;N;;;;; +1B0B6;HENTAIGANA LETTER HE-4;Lo;0;L;;;;;N;;;;; +1B0B7;HENTAIGANA LETTER HE-5;Lo;0;L;;;;;N;;;;; +1B0B8;HENTAIGANA LETTER HE-6;Lo;0;L;;;;;N;;;;; +1B0B9;HENTAIGANA LETTER HE-7;Lo;0;L;;;;;N;;;;; +1B0BA;HENTAIGANA LETTER HO-1;Lo;0;L;;;;;N;;;;; +1B0BB;HENTAIGANA LETTER HO-2;Lo;0;L;;;;;N;;;;; +1B0BC;HENTAIGANA LETTER HO-3;Lo;0;L;;;;;N;;;;; +1B0BD;HENTAIGANA LETTER HO-4;Lo;0;L;;;;;N;;;;; +1B0BE;HENTAIGANA LETTER HO-5;Lo;0;L;;;;;N;;;;; +1B0BF;HENTAIGANA LETTER HO-6;Lo;0;L;;;;;N;;;;; +1B0C0;HENTAIGANA LETTER HO-7;Lo;0;L;;;;;N;;;;; +1B0C1;HENTAIGANA LETTER HO-8;Lo;0;L;;;;;N;;;;; +1B0C2;HENTAIGANA LETTER MA-1;Lo;0;L;;;;;N;;;;; +1B0C3;HENTAIGANA LETTER MA-2;Lo;0;L;;;;;N;;;;; +1B0C4;HENTAIGANA LETTER MA-3;Lo;0;L;;;;;N;;;;; +1B0C5;HENTAIGANA LETTER MA-4;Lo;0;L;;;;;N;;;;; +1B0C6;HENTAIGANA LETTER MA-5;Lo;0;L;;;;;N;;;;; +1B0C7;HENTAIGANA LETTER MA-6;Lo;0;L;;;;;N;;;;; +1B0C8;HENTAIGANA LETTER MA-7;Lo;0;L;;;;;N;;;;; +1B0C9;HENTAIGANA LETTER MI-1;Lo;0;L;;;;;N;;;;; +1B0CA;HENTAIGANA LETTER MI-2;Lo;0;L;;;;;N;;;;; +1B0CB;HENTAIGANA LETTER MI-3;Lo;0;L;;;;;N;;;;; +1B0CC;HENTAIGANA LETTER MI-4;Lo;0;L;;;;;N;;;;; +1B0CD;HENTAIGANA LETTER MI-5;Lo;0;L;;;;;N;;;;; +1B0CE;HENTAIGANA LETTER MI-6;Lo;0;L;;;;;N;;;;; +1B0CF;HENTAIGANA LETTER MI-7;Lo;0;L;;;;;N;;;;; +1B0D0;HENTAIGANA LETTER MU-1;Lo;0;L;;;;;N;;;;; +1B0D1;HENTAIGANA LETTER MU-2;Lo;0;L;;;;;N;;;;; +1B0D2;HENTAIGANA LETTER MU-3;Lo;0;L;;;;;N;;;;; +1B0D3;HENTAIGANA LETTER MU-4;Lo;0;L;;;;;N;;;;; +1B0D4;HENTAIGANA LETTER ME-1;Lo;0;L;;;;;N;;;;; +1B0D5;HENTAIGANA LETTER ME-2;Lo;0;L;;;;;N;;;;; +1B0D6;HENTAIGANA LETTER ME-MA;Lo;0;L;;;;;N;;;;; +1B0D7;HENTAIGANA LETTER MO-1;Lo;0;L;;;;;N;;;;; +1B0D8;HENTAIGANA LETTER MO-2;Lo;0;L;;;;;N;;;;; +1B0D9;HENTAIGANA LETTER MO-3;Lo;0;L;;;;;N;;;;; +1B0DA;HENTAIGANA LETTER MO-4;Lo;0;L;;;;;N;;;;; +1B0DB;HENTAIGANA LETTER MO-5;Lo;0;L;;;;;N;;;;; +1B0DC;HENTAIGANA LETTER MO-6;Lo;0;L;;;;;N;;;;; +1B0DD;HENTAIGANA LETTER YA-1;Lo;0;L;;;;;N;;;;; +1B0DE;HENTAIGANA LETTER YA-2;Lo;0;L;;;;;N;;;;; +1B0DF;HENTAIGANA LETTER YA-3;Lo;0;L;;;;;N;;;;; +1B0E0;HENTAIGANA LETTER YA-4;Lo;0;L;;;;;N;;;;; +1B0E1;HENTAIGANA LETTER YA-5;Lo;0;L;;;;;N;;;;; +1B0E2;HENTAIGANA LETTER YA-YO;Lo;0;L;;;;;N;;;;; +1B0E3;HENTAIGANA LETTER YU-1;Lo;0;L;;;;;N;;;;; +1B0E4;HENTAIGANA LETTER YU-2;Lo;0;L;;;;;N;;;;; +1B0E5;HENTAIGANA LETTER YU-3;Lo;0;L;;;;;N;;;;; +1B0E6;HENTAIGANA LETTER YU-4;Lo;0;L;;;;;N;;;;; +1B0E7;HENTAIGANA LETTER YO-1;Lo;0;L;;;;;N;;;;; +1B0E8;HENTAIGANA LETTER YO-2;Lo;0;L;;;;;N;;;;; +1B0E9;HENTAIGANA LETTER YO-3;Lo;0;L;;;;;N;;;;; +1B0EA;HENTAIGANA LETTER YO-4;Lo;0;L;;;;;N;;;;; +1B0EB;HENTAIGANA LETTER YO-5;Lo;0;L;;;;;N;;;;; +1B0EC;HENTAIGANA LETTER YO-6;Lo;0;L;;;;;N;;;;; +1B0ED;HENTAIGANA LETTER RA-1;Lo;0;L;;;;;N;;;;; +1B0EE;HENTAIGANA LETTER RA-2;Lo;0;L;;;;;N;;;;; +1B0EF;HENTAIGANA LETTER RA-3;Lo;0;L;;;;;N;;;;; +1B0F0;HENTAIGANA LETTER RA-4;Lo;0;L;;;;;N;;;;; +1B0F1;HENTAIGANA LETTER RI-1;Lo;0;L;;;;;N;;;;; +1B0F2;HENTAIGANA LETTER RI-2;Lo;0;L;;;;;N;;;;; +1B0F3;HENTAIGANA LETTER RI-3;Lo;0;L;;;;;N;;;;; +1B0F4;HENTAIGANA LETTER RI-4;Lo;0;L;;;;;N;;;;; +1B0F5;HENTAIGANA LETTER RI-5;Lo;0;L;;;;;N;;;;; +1B0F6;HENTAIGANA LETTER RI-6;Lo;0;L;;;;;N;;;;; +1B0F7;HENTAIGANA LETTER RI-7;Lo;0;L;;;;;N;;;;; +1B0F8;HENTAIGANA LETTER RU-1;Lo;0;L;;;;;N;;;;; +1B0F9;HENTAIGANA LETTER RU-2;Lo;0;L;;;;;N;;;;; +1B0FA;HENTAIGANA LETTER RU-3;Lo;0;L;;;;;N;;;;; +1B0FB;HENTAIGANA LETTER RU-4;Lo;0;L;;;;;N;;;;; +1B0FC;HENTAIGANA LETTER RU-5;Lo;0;L;;;;;N;;;;; +1B0FD;HENTAIGANA LETTER RU-6;Lo;0;L;;;;;N;;;;; +1B0FE;HENTAIGANA LETTER RE-1;Lo;0;L;;;;;N;;;;; +1B0FF;HENTAIGANA LETTER RE-2;Lo;0;L;;;;;N;;;;; +1B100;HENTAIGANA LETTER RE-3;Lo;0;L;;;;;N;;;;; +1B101;HENTAIGANA LETTER RE-4;Lo;0;L;;;;;N;;;;; +1B102;HENTAIGANA LETTER RO-1;Lo;0;L;;;;;N;;;;; +1B103;HENTAIGANA LETTER RO-2;Lo;0;L;;;;;N;;;;; +1B104;HENTAIGANA LETTER RO-3;Lo;0;L;;;;;N;;;;; +1B105;HENTAIGANA LETTER RO-4;Lo;0;L;;;;;N;;;;; +1B106;HENTAIGANA LETTER RO-5;Lo;0;L;;;;;N;;;;; +1B107;HENTAIGANA LETTER RO-6;Lo;0;L;;;;;N;;;;; +1B108;HENTAIGANA LETTER WA-1;Lo;0;L;;;;;N;;;;; +1B109;HENTAIGANA LETTER WA-2;Lo;0;L;;;;;N;;;;; +1B10A;HENTAIGANA LETTER WA-3;Lo;0;L;;;;;N;;;;; +1B10B;HENTAIGANA LETTER WA-4;Lo;0;L;;;;;N;;;;; +1B10C;HENTAIGANA LETTER WA-5;Lo;0;L;;;;;N;;;;; +1B10D;HENTAIGANA LETTER WI-1;Lo;0;L;;;;;N;;;;; +1B10E;HENTAIGANA LETTER WI-2;Lo;0;L;;;;;N;;;;; +1B10F;HENTAIGANA LETTER WI-3;Lo;0;L;;;;;N;;;;; +1B110;HENTAIGANA LETTER WI-4;Lo;0;L;;;;;N;;;;; +1B111;HENTAIGANA LETTER WI-5;Lo;0;L;;;;;N;;;;; +1B112;HENTAIGANA LETTER WE-1;Lo;0;L;;;;;N;;;;; +1B113;HENTAIGANA LETTER WE-2;Lo;0;L;;;;;N;;;;; +1B114;HENTAIGANA LETTER WE-3;Lo;0;L;;;;;N;;;;; +1B115;HENTAIGANA LETTER WE-4;Lo;0;L;;;;;N;;;;; +1B116;HENTAIGANA LETTER WO-1;Lo;0;L;;;;;N;;;;; +1B117;HENTAIGANA LETTER WO-2;Lo;0;L;;;;;N;;;;; +1B118;HENTAIGANA LETTER WO-3;Lo;0;L;;;;;N;;;;; +1B119;HENTAIGANA LETTER WO-4;Lo;0;L;;;;;N;;;;; +1B11A;HENTAIGANA LETTER WO-5;Lo;0;L;;;;;N;;;;; +1B11B;HENTAIGANA LETTER WO-6;Lo;0;L;;;;;N;;;;; +1B11C;HENTAIGANA LETTER WO-7;Lo;0;L;;;;;N;;;;; +1B11D;HENTAIGANA LETTER N-MU-MO-1;Lo;0;L;;;;;N;;;;; +1B11E;HENTAIGANA LETTER N-MU-MO-2;Lo;0;L;;;;;N;;;;; +1B170;NUSHU CHARACTER-1B170;Lo;0;L;;;;;N;;;;; +1B171;NUSHU CHARACTER-1B171;Lo;0;L;;;;;N;;;;; +1B172;NUSHU CHARACTER-1B172;Lo;0;L;;;;;N;;;;; +1B173;NUSHU CHARACTER-1B173;Lo;0;L;;;;;N;;;;; +1B174;NUSHU CHARACTER-1B174;Lo;0;L;;;;;N;;;;; +1B175;NUSHU CHARACTER-1B175;Lo;0;L;;;;;N;;;;; +1B176;NUSHU CHARACTER-1B176;Lo;0;L;;;;;N;;;;; +1B177;NUSHU CHARACTER-1B177;Lo;0;L;;;;;N;;;;; +1B178;NUSHU CHARACTER-1B178;Lo;0;L;;;;;N;;;;; +1B179;NUSHU CHARACTER-1B179;Lo;0;L;;;;;N;;;;; +1B17A;NUSHU CHARACTER-1B17A;Lo;0;L;;;;;N;;;;; +1B17B;NUSHU CHARACTER-1B17B;Lo;0;L;;;;;N;;;;; +1B17C;NUSHU CHARACTER-1B17C;Lo;0;L;;;;;N;;;;; +1B17D;NUSHU CHARACTER-1B17D;Lo;0;L;;;;;N;;;;; +1B17E;NUSHU CHARACTER-1B17E;Lo;0;L;;;;;N;;;;; +1B17F;NUSHU CHARACTER-1B17F;Lo;0;L;;;;;N;;;;; +1B180;NUSHU CHARACTER-1B180;Lo;0;L;;;;;N;;;;; +1B181;NUSHU CHARACTER-1B181;Lo;0;L;;;;;N;;;;; +1B182;NUSHU CHARACTER-1B182;Lo;0;L;;;;;N;;;;; +1B183;NUSHU CHARACTER-1B183;Lo;0;L;;;;;N;;;;; +1B184;NUSHU CHARACTER-1B184;Lo;0;L;;;;;N;;;;; +1B185;NUSHU CHARACTER-1B185;Lo;0;L;;;;;N;;;;; +1B186;NUSHU CHARACTER-1B186;Lo;0;L;;;;;N;;;;; +1B187;NUSHU CHARACTER-1B187;Lo;0;L;;;;;N;;;;; +1B188;NUSHU CHARACTER-1B188;Lo;0;L;;;;;N;;;;; +1B189;NUSHU CHARACTER-1B189;Lo;0;L;;;;;N;;;;; +1B18A;NUSHU CHARACTER-1B18A;Lo;0;L;;;;;N;;;;; +1B18B;NUSHU CHARACTER-1B18B;Lo;0;L;;;;;N;;;;; +1B18C;NUSHU CHARACTER-1B18C;Lo;0;L;;;;;N;;;;; +1B18D;NUSHU CHARACTER-1B18D;Lo;0;L;;;;;N;;;;; +1B18E;NUSHU CHARACTER-1B18E;Lo;0;L;;;;;N;;;;; +1B18F;NUSHU CHARACTER-1B18F;Lo;0;L;;;;;N;;;;; +1B190;NUSHU CHARACTER-1B190;Lo;0;L;;;;;N;;;;; +1B191;NUSHU CHARACTER-1B191;Lo;0;L;;;;;N;;;;; +1B192;NUSHU CHARACTER-1B192;Lo;0;L;;;;;N;;;;; +1B193;NUSHU CHARACTER-1B193;Lo;0;L;;;;;N;;;;; +1B194;NUSHU CHARACTER-1B194;Lo;0;L;;;;;N;;;;; +1B195;NUSHU CHARACTER-1B195;Lo;0;L;;;;;N;;;;; +1B196;NUSHU CHARACTER-1B196;Lo;0;L;;;;;N;;;;; +1B197;NUSHU CHARACTER-1B197;Lo;0;L;;;;;N;;;;; +1B198;NUSHU CHARACTER-1B198;Lo;0;L;;;;;N;;;;; +1B199;NUSHU CHARACTER-1B199;Lo;0;L;;;;;N;;;;; +1B19A;NUSHU CHARACTER-1B19A;Lo;0;L;;;;;N;;;;; +1B19B;NUSHU CHARACTER-1B19B;Lo;0;L;;;;;N;;;;; +1B19C;NUSHU CHARACTER-1B19C;Lo;0;L;;;;;N;;;;; +1B19D;NUSHU CHARACTER-1B19D;Lo;0;L;;;;;N;;;;; +1B19E;NUSHU CHARACTER-1B19E;Lo;0;L;;;;;N;;;;; +1B19F;NUSHU CHARACTER-1B19F;Lo;0;L;;;;;N;;;;; +1B1A0;NUSHU CHARACTER-1B1A0;Lo;0;L;;;;;N;;;;; +1B1A1;NUSHU CHARACTER-1B1A1;Lo;0;L;;;;;N;;;;; +1B1A2;NUSHU CHARACTER-1B1A2;Lo;0;L;;;;;N;;;;; +1B1A3;NUSHU CHARACTER-1B1A3;Lo;0;L;;;;;N;;;;; +1B1A4;NUSHU CHARACTER-1B1A4;Lo;0;L;;;;;N;;;;; +1B1A5;NUSHU CHARACTER-1B1A5;Lo;0;L;;;;;N;;;;; +1B1A6;NUSHU CHARACTER-1B1A6;Lo;0;L;;;;;N;;;;; +1B1A7;NUSHU CHARACTER-1B1A7;Lo;0;L;;;;;N;;;;; +1B1A8;NUSHU CHARACTER-1B1A8;Lo;0;L;;;;;N;;;;; +1B1A9;NUSHU CHARACTER-1B1A9;Lo;0;L;;;;;N;;;;; +1B1AA;NUSHU CHARACTER-1B1AA;Lo;0;L;;;;;N;;;;; +1B1AB;NUSHU CHARACTER-1B1AB;Lo;0;L;;;;;N;;;;; +1B1AC;NUSHU CHARACTER-1B1AC;Lo;0;L;;;;;N;;;;; +1B1AD;NUSHU CHARACTER-1B1AD;Lo;0;L;;;;;N;;;;; +1B1AE;NUSHU CHARACTER-1B1AE;Lo;0;L;;;;;N;;;;; +1B1AF;NUSHU CHARACTER-1B1AF;Lo;0;L;;;;;N;;;;; +1B1B0;NUSHU CHARACTER-1B1B0;Lo;0;L;;;;;N;;;;; +1B1B1;NUSHU CHARACTER-1B1B1;Lo;0;L;;;;;N;;;;; +1B1B2;NUSHU CHARACTER-1B1B2;Lo;0;L;;;;;N;;;;; +1B1B3;NUSHU CHARACTER-1B1B3;Lo;0;L;;;;;N;;;;; +1B1B4;NUSHU CHARACTER-1B1B4;Lo;0;L;;;;;N;;;;; +1B1B5;NUSHU CHARACTER-1B1B5;Lo;0;L;;;;;N;;;;; +1B1B6;NUSHU CHARACTER-1B1B6;Lo;0;L;;;;;N;;;;; +1B1B7;NUSHU CHARACTER-1B1B7;Lo;0;L;;;;;N;;;;; +1B1B8;NUSHU CHARACTER-1B1B8;Lo;0;L;;;;;N;;;;; +1B1B9;NUSHU CHARACTER-1B1B9;Lo;0;L;;;;;N;;;;; +1B1BA;NUSHU CHARACTER-1B1BA;Lo;0;L;;;;;N;;;;; +1B1BB;NUSHU CHARACTER-1B1BB;Lo;0;L;;;;;N;;;;; +1B1BC;NUSHU CHARACTER-1B1BC;Lo;0;L;;;;;N;;;;; +1B1BD;NUSHU CHARACTER-1B1BD;Lo;0;L;;;;;N;;;;; +1B1BE;NUSHU CHARACTER-1B1BE;Lo;0;L;;;;;N;;;;; +1B1BF;NUSHU CHARACTER-1B1BF;Lo;0;L;;;;;N;;;;; +1B1C0;NUSHU CHARACTER-1B1C0;Lo;0;L;;;;;N;;;;; +1B1C1;NUSHU CHARACTER-1B1C1;Lo;0;L;;;;;N;;;;; +1B1C2;NUSHU CHARACTER-1B1C2;Lo;0;L;;;;;N;;;;; +1B1C3;NUSHU CHARACTER-1B1C3;Lo;0;L;;;;;N;;;;; +1B1C4;NUSHU CHARACTER-1B1C4;Lo;0;L;;;;;N;;;;; +1B1C5;NUSHU CHARACTER-1B1C5;Lo;0;L;;;;;N;;;;; +1B1C6;NUSHU CHARACTER-1B1C6;Lo;0;L;;;;;N;;;;; +1B1C7;NUSHU CHARACTER-1B1C7;Lo;0;L;;;;;N;;;;; +1B1C8;NUSHU CHARACTER-1B1C8;Lo;0;L;;;;;N;;;;; +1B1C9;NUSHU CHARACTER-1B1C9;Lo;0;L;;;;;N;;;;; +1B1CA;NUSHU CHARACTER-1B1CA;Lo;0;L;;;;;N;;;;; +1B1CB;NUSHU CHARACTER-1B1CB;Lo;0;L;;;;;N;;;;; +1B1CC;NUSHU CHARACTER-1B1CC;Lo;0;L;;;;;N;;;;; +1B1CD;NUSHU CHARACTER-1B1CD;Lo;0;L;;;;;N;;;;; +1B1CE;NUSHU CHARACTER-1B1CE;Lo;0;L;;;;;N;;;;; +1B1CF;NUSHU CHARACTER-1B1CF;Lo;0;L;;;;;N;;;;; +1B1D0;NUSHU CHARACTER-1B1D0;Lo;0;L;;;;;N;;;;; +1B1D1;NUSHU CHARACTER-1B1D1;Lo;0;L;;;;;N;;;;; +1B1D2;NUSHU CHARACTER-1B1D2;Lo;0;L;;;;;N;;;;; +1B1D3;NUSHU CHARACTER-1B1D3;Lo;0;L;;;;;N;;;;; +1B1D4;NUSHU CHARACTER-1B1D4;Lo;0;L;;;;;N;;;;; +1B1D5;NUSHU CHARACTER-1B1D5;Lo;0;L;;;;;N;;;;; +1B1D6;NUSHU CHARACTER-1B1D6;Lo;0;L;;;;;N;;;;; +1B1D7;NUSHU CHARACTER-1B1D7;Lo;0;L;;;;;N;;;;; +1B1D8;NUSHU CHARACTER-1B1D8;Lo;0;L;;;;;N;;;;; +1B1D9;NUSHU CHARACTER-1B1D9;Lo;0;L;;;;;N;;;;; +1B1DA;NUSHU CHARACTER-1B1DA;Lo;0;L;;;;;N;;;;; +1B1DB;NUSHU CHARACTER-1B1DB;Lo;0;L;;;;;N;;;;; +1B1DC;NUSHU CHARACTER-1B1DC;Lo;0;L;;;;;N;;;;; +1B1DD;NUSHU CHARACTER-1B1DD;Lo;0;L;;;;;N;;;;; +1B1DE;NUSHU CHARACTER-1B1DE;Lo;0;L;;;;;N;;;;; +1B1DF;NUSHU CHARACTER-1B1DF;Lo;0;L;;;;;N;;;;; +1B1E0;NUSHU CHARACTER-1B1E0;Lo;0;L;;;;;N;;;;; +1B1E1;NUSHU CHARACTER-1B1E1;Lo;0;L;;;;;N;;;;; +1B1E2;NUSHU CHARACTER-1B1E2;Lo;0;L;;;;;N;;;;; +1B1E3;NUSHU CHARACTER-1B1E3;Lo;0;L;;;;;N;;;;; +1B1E4;NUSHU CHARACTER-1B1E4;Lo;0;L;;;;;N;;;;; +1B1E5;NUSHU CHARACTER-1B1E5;Lo;0;L;;;;;N;;;;; +1B1E6;NUSHU CHARACTER-1B1E6;Lo;0;L;;;;;N;;;;; +1B1E7;NUSHU CHARACTER-1B1E7;Lo;0;L;;;;;N;;;;; +1B1E8;NUSHU CHARACTER-1B1E8;Lo;0;L;;;;;N;;;;; +1B1E9;NUSHU CHARACTER-1B1E9;Lo;0;L;;;;;N;;;;; +1B1EA;NUSHU CHARACTER-1B1EA;Lo;0;L;;;;;N;;;;; +1B1EB;NUSHU CHARACTER-1B1EB;Lo;0;L;;;;;N;;;;; +1B1EC;NUSHU CHARACTER-1B1EC;Lo;0;L;;;;;N;;;;; +1B1ED;NUSHU CHARACTER-1B1ED;Lo;0;L;;;;;N;;;;; +1B1EE;NUSHU CHARACTER-1B1EE;Lo;0;L;;;;;N;;;;; +1B1EF;NUSHU CHARACTER-1B1EF;Lo;0;L;;;;;N;;;;; +1B1F0;NUSHU CHARACTER-1B1F0;Lo;0;L;;;;;N;;;;; +1B1F1;NUSHU CHARACTER-1B1F1;Lo;0;L;;;;;N;;;;; +1B1F2;NUSHU CHARACTER-1B1F2;Lo;0;L;;;;;N;;;;; +1B1F3;NUSHU CHARACTER-1B1F3;Lo;0;L;;;;;N;;;;; +1B1F4;NUSHU CHARACTER-1B1F4;Lo;0;L;;;;;N;;;;; +1B1F5;NUSHU CHARACTER-1B1F5;Lo;0;L;;;;;N;;;;; +1B1F6;NUSHU CHARACTER-1B1F6;Lo;0;L;;;;;N;;;;; +1B1F7;NUSHU CHARACTER-1B1F7;Lo;0;L;;;;;N;;;;; +1B1F8;NUSHU CHARACTER-1B1F8;Lo;0;L;;;;;N;;;;; +1B1F9;NUSHU CHARACTER-1B1F9;Lo;0;L;;;;;N;;;;; +1B1FA;NUSHU CHARACTER-1B1FA;Lo;0;L;;;;;N;;;;; +1B1FB;NUSHU CHARACTER-1B1FB;Lo;0;L;;;;;N;;;;; +1B1FC;NUSHU CHARACTER-1B1FC;Lo;0;L;;;;;N;;;;; +1B1FD;NUSHU CHARACTER-1B1FD;Lo;0;L;;;;;N;;;;; +1B1FE;NUSHU CHARACTER-1B1FE;Lo;0;L;;;;;N;;;;; +1B1FF;NUSHU CHARACTER-1B1FF;Lo;0;L;;;;;N;;;;; +1B200;NUSHU CHARACTER-1B200;Lo;0;L;;;;;N;;;;; +1B201;NUSHU CHARACTER-1B201;Lo;0;L;;;;;N;;;;; +1B202;NUSHU CHARACTER-1B202;Lo;0;L;;;;;N;;;;; +1B203;NUSHU CHARACTER-1B203;Lo;0;L;;;;;N;;;;; +1B204;NUSHU CHARACTER-1B204;Lo;0;L;;;;;N;;;;; +1B205;NUSHU CHARACTER-1B205;Lo;0;L;;;;;N;;;;; +1B206;NUSHU CHARACTER-1B206;Lo;0;L;;;;;N;;;;; +1B207;NUSHU CHARACTER-1B207;Lo;0;L;;;;;N;;;;; +1B208;NUSHU CHARACTER-1B208;Lo;0;L;;;;;N;;;;; +1B209;NUSHU CHARACTER-1B209;Lo;0;L;;;;;N;;;;; +1B20A;NUSHU CHARACTER-1B20A;Lo;0;L;;;;;N;;;;; +1B20B;NUSHU CHARACTER-1B20B;Lo;0;L;;;;;N;;;;; +1B20C;NUSHU CHARACTER-1B20C;Lo;0;L;;;;;N;;;;; +1B20D;NUSHU CHARACTER-1B20D;Lo;0;L;;;;;N;;;;; +1B20E;NUSHU CHARACTER-1B20E;Lo;0;L;;;;;N;;;;; +1B20F;NUSHU CHARACTER-1B20F;Lo;0;L;;;;;N;;;;; +1B210;NUSHU CHARACTER-1B210;Lo;0;L;;;;;N;;;;; +1B211;NUSHU CHARACTER-1B211;Lo;0;L;;;;;N;;;;; +1B212;NUSHU CHARACTER-1B212;Lo;0;L;;;;;N;;;;; +1B213;NUSHU CHARACTER-1B213;Lo;0;L;;;;;N;;;;; +1B214;NUSHU CHARACTER-1B214;Lo;0;L;;;;;N;;;;; +1B215;NUSHU CHARACTER-1B215;Lo;0;L;;;;;N;;;;; +1B216;NUSHU CHARACTER-1B216;Lo;0;L;;;;;N;;;;; +1B217;NUSHU CHARACTER-1B217;Lo;0;L;;;;;N;;;;; +1B218;NUSHU CHARACTER-1B218;Lo;0;L;;;;;N;;;;; +1B219;NUSHU CHARACTER-1B219;Lo;0;L;;;;;N;;;;; +1B21A;NUSHU CHARACTER-1B21A;Lo;0;L;;;;;N;;;;; +1B21B;NUSHU CHARACTER-1B21B;Lo;0;L;;;;;N;;;;; +1B21C;NUSHU CHARACTER-1B21C;Lo;0;L;;;;;N;;;;; +1B21D;NUSHU CHARACTER-1B21D;Lo;0;L;;;;;N;;;;; +1B21E;NUSHU CHARACTER-1B21E;Lo;0;L;;;;;N;;;;; +1B21F;NUSHU CHARACTER-1B21F;Lo;0;L;;;;;N;;;;; +1B220;NUSHU CHARACTER-1B220;Lo;0;L;;;;;N;;;;; +1B221;NUSHU CHARACTER-1B221;Lo;0;L;;;;;N;;;;; +1B222;NUSHU CHARACTER-1B222;Lo;0;L;;;;;N;;;;; +1B223;NUSHU CHARACTER-1B223;Lo;0;L;;;;;N;;;;; +1B224;NUSHU CHARACTER-1B224;Lo;0;L;;;;;N;;;;; +1B225;NUSHU CHARACTER-1B225;Lo;0;L;;;;;N;;;;; +1B226;NUSHU CHARACTER-1B226;Lo;0;L;;;;;N;;;;; +1B227;NUSHU CHARACTER-1B227;Lo;0;L;;;;;N;;;;; +1B228;NUSHU CHARACTER-1B228;Lo;0;L;;;;;N;;;;; +1B229;NUSHU CHARACTER-1B229;Lo;0;L;;;;;N;;;;; +1B22A;NUSHU CHARACTER-1B22A;Lo;0;L;;;;;N;;;;; +1B22B;NUSHU CHARACTER-1B22B;Lo;0;L;;;;;N;;;;; +1B22C;NUSHU CHARACTER-1B22C;Lo;0;L;;;;;N;;;;; +1B22D;NUSHU CHARACTER-1B22D;Lo;0;L;;;;;N;;;;; +1B22E;NUSHU CHARACTER-1B22E;Lo;0;L;;;;;N;;;;; +1B22F;NUSHU CHARACTER-1B22F;Lo;0;L;;;;;N;;;;; +1B230;NUSHU CHARACTER-1B230;Lo;0;L;;;;;N;;;;; +1B231;NUSHU CHARACTER-1B231;Lo;0;L;;;;;N;;;;; +1B232;NUSHU CHARACTER-1B232;Lo;0;L;;;;;N;;;;; +1B233;NUSHU CHARACTER-1B233;Lo;0;L;;;;;N;;;;; +1B234;NUSHU CHARACTER-1B234;Lo;0;L;;;;;N;;;;; +1B235;NUSHU CHARACTER-1B235;Lo;0;L;;;;;N;;;;; +1B236;NUSHU CHARACTER-1B236;Lo;0;L;;;;;N;;;;; +1B237;NUSHU CHARACTER-1B237;Lo;0;L;;;;;N;;;;; +1B238;NUSHU CHARACTER-1B238;Lo;0;L;;;;;N;;;;; +1B239;NUSHU CHARACTER-1B239;Lo;0;L;;;;;N;;;;; +1B23A;NUSHU CHARACTER-1B23A;Lo;0;L;;;;;N;;;;; +1B23B;NUSHU CHARACTER-1B23B;Lo;0;L;;;;;N;;;;; +1B23C;NUSHU CHARACTER-1B23C;Lo;0;L;;;;;N;;;;; +1B23D;NUSHU CHARACTER-1B23D;Lo;0;L;;;;;N;;;;; +1B23E;NUSHU CHARACTER-1B23E;Lo;0;L;;;;;N;;;;; +1B23F;NUSHU CHARACTER-1B23F;Lo;0;L;;;;;N;;;;; +1B240;NUSHU CHARACTER-1B240;Lo;0;L;;;;;N;;;;; +1B241;NUSHU CHARACTER-1B241;Lo;0;L;;;;;N;;;;; +1B242;NUSHU CHARACTER-1B242;Lo;0;L;;;;;N;;;;; +1B243;NUSHU CHARACTER-1B243;Lo;0;L;;;;;N;;;;; +1B244;NUSHU CHARACTER-1B244;Lo;0;L;;;;;N;;;;; +1B245;NUSHU CHARACTER-1B245;Lo;0;L;;;;;N;;;;; +1B246;NUSHU CHARACTER-1B246;Lo;0;L;;;;;N;;;;; +1B247;NUSHU CHARACTER-1B247;Lo;0;L;;;;;N;;;;; +1B248;NUSHU CHARACTER-1B248;Lo;0;L;;;;;N;;;;; +1B249;NUSHU CHARACTER-1B249;Lo;0;L;;;;;N;;;;; +1B24A;NUSHU CHARACTER-1B24A;Lo;0;L;;;;;N;;;;; +1B24B;NUSHU CHARACTER-1B24B;Lo;0;L;;;;;N;;;;; +1B24C;NUSHU CHARACTER-1B24C;Lo;0;L;;;;;N;;;;; +1B24D;NUSHU CHARACTER-1B24D;Lo;0;L;;;;;N;;;;; +1B24E;NUSHU CHARACTER-1B24E;Lo;0;L;;;;;N;;;;; +1B24F;NUSHU CHARACTER-1B24F;Lo;0;L;;;;;N;;;;; +1B250;NUSHU CHARACTER-1B250;Lo;0;L;;;;;N;;;;; +1B251;NUSHU CHARACTER-1B251;Lo;0;L;;;;;N;;;;; +1B252;NUSHU CHARACTER-1B252;Lo;0;L;;;;;N;;;;; +1B253;NUSHU CHARACTER-1B253;Lo;0;L;;;;;N;;;;; +1B254;NUSHU CHARACTER-1B254;Lo;0;L;;;;;N;;;;; +1B255;NUSHU CHARACTER-1B255;Lo;0;L;;;;;N;;;;; +1B256;NUSHU CHARACTER-1B256;Lo;0;L;;;;;N;;;;; +1B257;NUSHU CHARACTER-1B257;Lo;0;L;;;;;N;;;;; +1B258;NUSHU CHARACTER-1B258;Lo;0;L;;;;;N;;;;; +1B259;NUSHU CHARACTER-1B259;Lo;0;L;;;;;N;;;;; +1B25A;NUSHU CHARACTER-1B25A;Lo;0;L;;;;;N;;;;; +1B25B;NUSHU CHARACTER-1B25B;Lo;0;L;;;;;N;;;;; +1B25C;NUSHU CHARACTER-1B25C;Lo;0;L;;;;;N;;;;; +1B25D;NUSHU CHARACTER-1B25D;Lo;0;L;;;;;N;;;;; +1B25E;NUSHU CHARACTER-1B25E;Lo;0;L;;;;;N;;;;; +1B25F;NUSHU CHARACTER-1B25F;Lo;0;L;;;;;N;;;;; +1B260;NUSHU CHARACTER-1B260;Lo;0;L;;;;;N;;;;; +1B261;NUSHU CHARACTER-1B261;Lo;0;L;;;;;N;;;;; +1B262;NUSHU CHARACTER-1B262;Lo;0;L;;;;;N;;;;; +1B263;NUSHU CHARACTER-1B263;Lo;0;L;;;;;N;;;;; +1B264;NUSHU CHARACTER-1B264;Lo;0;L;;;;;N;;;;; +1B265;NUSHU CHARACTER-1B265;Lo;0;L;;;;;N;;;;; +1B266;NUSHU CHARACTER-1B266;Lo;0;L;;;;;N;;;;; +1B267;NUSHU CHARACTER-1B267;Lo;0;L;;;;;N;;;;; +1B268;NUSHU CHARACTER-1B268;Lo;0;L;;;;;N;;;;; +1B269;NUSHU CHARACTER-1B269;Lo;0;L;;;;;N;;;;; +1B26A;NUSHU CHARACTER-1B26A;Lo;0;L;;;;;N;;;;; +1B26B;NUSHU CHARACTER-1B26B;Lo;0;L;;;;;N;;;;; +1B26C;NUSHU CHARACTER-1B26C;Lo;0;L;;;;;N;;;;; +1B26D;NUSHU CHARACTER-1B26D;Lo;0;L;;;;;N;;;;; +1B26E;NUSHU CHARACTER-1B26E;Lo;0;L;;;;;N;;;;; +1B26F;NUSHU CHARACTER-1B26F;Lo;0;L;;;;;N;;;;; +1B270;NUSHU CHARACTER-1B270;Lo;0;L;;;;;N;;;;; +1B271;NUSHU CHARACTER-1B271;Lo;0;L;;;;;N;;;;; +1B272;NUSHU CHARACTER-1B272;Lo;0;L;;;;;N;;;;; +1B273;NUSHU CHARACTER-1B273;Lo;0;L;;;;;N;;;;; +1B274;NUSHU CHARACTER-1B274;Lo;0;L;;;;;N;;;;; +1B275;NUSHU CHARACTER-1B275;Lo;0;L;;;;;N;;;;; +1B276;NUSHU CHARACTER-1B276;Lo;0;L;;;;;N;;;;; +1B277;NUSHU CHARACTER-1B277;Lo;0;L;;;;;N;;;;; +1B278;NUSHU CHARACTER-1B278;Lo;0;L;;;;;N;;;;; +1B279;NUSHU CHARACTER-1B279;Lo;0;L;;;;;N;;;;; +1B27A;NUSHU CHARACTER-1B27A;Lo;0;L;;;;;N;;;;; +1B27B;NUSHU CHARACTER-1B27B;Lo;0;L;;;;;N;;;;; +1B27C;NUSHU CHARACTER-1B27C;Lo;0;L;;;;;N;;;;; +1B27D;NUSHU CHARACTER-1B27D;Lo;0;L;;;;;N;;;;; +1B27E;NUSHU CHARACTER-1B27E;Lo;0;L;;;;;N;;;;; +1B27F;NUSHU CHARACTER-1B27F;Lo;0;L;;;;;N;;;;; +1B280;NUSHU CHARACTER-1B280;Lo;0;L;;;;;N;;;;; +1B281;NUSHU CHARACTER-1B281;Lo;0;L;;;;;N;;;;; +1B282;NUSHU CHARACTER-1B282;Lo;0;L;;;;;N;;;;; +1B283;NUSHU CHARACTER-1B283;Lo;0;L;;;;;N;;;;; +1B284;NUSHU CHARACTER-1B284;Lo;0;L;;;;;N;;;;; +1B285;NUSHU CHARACTER-1B285;Lo;0;L;;;;;N;;;;; +1B286;NUSHU CHARACTER-1B286;Lo;0;L;;;;;N;;;;; +1B287;NUSHU CHARACTER-1B287;Lo;0;L;;;;;N;;;;; +1B288;NUSHU CHARACTER-1B288;Lo;0;L;;;;;N;;;;; +1B289;NUSHU CHARACTER-1B289;Lo;0;L;;;;;N;;;;; +1B28A;NUSHU CHARACTER-1B28A;Lo;0;L;;;;;N;;;;; +1B28B;NUSHU CHARACTER-1B28B;Lo;0;L;;;;;N;;;;; +1B28C;NUSHU CHARACTER-1B28C;Lo;0;L;;;;;N;;;;; +1B28D;NUSHU CHARACTER-1B28D;Lo;0;L;;;;;N;;;;; +1B28E;NUSHU CHARACTER-1B28E;Lo;0;L;;;;;N;;;;; +1B28F;NUSHU CHARACTER-1B28F;Lo;0;L;;;;;N;;;;; +1B290;NUSHU CHARACTER-1B290;Lo;0;L;;;;;N;;;;; +1B291;NUSHU CHARACTER-1B291;Lo;0;L;;;;;N;;;;; +1B292;NUSHU CHARACTER-1B292;Lo;0;L;;;;;N;;;;; +1B293;NUSHU CHARACTER-1B293;Lo;0;L;;;;;N;;;;; +1B294;NUSHU CHARACTER-1B294;Lo;0;L;;;;;N;;;;; +1B295;NUSHU CHARACTER-1B295;Lo;0;L;;;;;N;;;;; +1B296;NUSHU CHARACTER-1B296;Lo;0;L;;;;;N;;;;; +1B297;NUSHU CHARACTER-1B297;Lo;0;L;;;;;N;;;;; +1B298;NUSHU CHARACTER-1B298;Lo;0;L;;;;;N;;;;; +1B299;NUSHU CHARACTER-1B299;Lo;0;L;;;;;N;;;;; +1B29A;NUSHU CHARACTER-1B29A;Lo;0;L;;;;;N;;;;; +1B29B;NUSHU CHARACTER-1B29B;Lo;0;L;;;;;N;;;;; +1B29C;NUSHU CHARACTER-1B29C;Lo;0;L;;;;;N;;;;; +1B29D;NUSHU CHARACTER-1B29D;Lo;0;L;;;;;N;;;;; +1B29E;NUSHU CHARACTER-1B29E;Lo;0;L;;;;;N;;;;; +1B29F;NUSHU CHARACTER-1B29F;Lo;0;L;;;;;N;;;;; +1B2A0;NUSHU CHARACTER-1B2A0;Lo;0;L;;;;;N;;;;; +1B2A1;NUSHU CHARACTER-1B2A1;Lo;0;L;;;;;N;;;;; +1B2A2;NUSHU CHARACTER-1B2A2;Lo;0;L;;;;;N;;;;; +1B2A3;NUSHU CHARACTER-1B2A3;Lo;0;L;;;;;N;;;;; +1B2A4;NUSHU CHARACTER-1B2A4;Lo;0;L;;;;;N;;;;; +1B2A5;NUSHU CHARACTER-1B2A5;Lo;0;L;;;;;N;;;;; +1B2A6;NUSHU CHARACTER-1B2A6;Lo;0;L;;;;;N;;;;; +1B2A7;NUSHU CHARACTER-1B2A7;Lo;0;L;;;;;N;;;;; +1B2A8;NUSHU CHARACTER-1B2A8;Lo;0;L;;;;;N;;;;; +1B2A9;NUSHU CHARACTER-1B2A9;Lo;0;L;;;;;N;;;;; +1B2AA;NUSHU CHARACTER-1B2AA;Lo;0;L;;;;;N;;;;; +1B2AB;NUSHU CHARACTER-1B2AB;Lo;0;L;;;;;N;;;;; +1B2AC;NUSHU CHARACTER-1B2AC;Lo;0;L;;;;;N;;;;; +1B2AD;NUSHU CHARACTER-1B2AD;Lo;0;L;;;;;N;;;;; +1B2AE;NUSHU CHARACTER-1B2AE;Lo;0;L;;;;;N;;;;; +1B2AF;NUSHU CHARACTER-1B2AF;Lo;0;L;;;;;N;;;;; +1B2B0;NUSHU CHARACTER-1B2B0;Lo;0;L;;;;;N;;;;; +1B2B1;NUSHU CHARACTER-1B2B1;Lo;0;L;;;;;N;;;;; +1B2B2;NUSHU CHARACTER-1B2B2;Lo;0;L;;;;;N;;;;; +1B2B3;NUSHU CHARACTER-1B2B3;Lo;0;L;;;;;N;;;;; +1B2B4;NUSHU CHARACTER-1B2B4;Lo;0;L;;;;;N;;;;; +1B2B5;NUSHU CHARACTER-1B2B5;Lo;0;L;;;;;N;;;;; +1B2B6;NUSHU CHARACTER-1B2B6;Lo;0;L;;;;;N;;;;; +1B2B7;NUSHU CHARACTER-1B2B7;Lo;0;L;;;;;N;;;;; +1B2B8;NUSHU CHARACTER-1B2B8;Lo;0;L;;;;;N;;;;; +1B2B9;NUSHU CHARACTER-1B2B9;Lo;0;L;;;;;N;;;;; +1B2BA;NUSHU CHARACTER-1B2BA;Lo;0;L;;;;;N;;;;; +1B2BB;NUSHU CHARACTER-1B2BB;Lo;0;L;;;;;N;;;;; +1B2BC;NUSHU CHARACTER-1B2BC;Lo;0;L;;;;;N;;;;; +1B2BD;NUSHU CHARACTER-1B2BD;Lo;0;L;;;;;N;;;;; +1B2BE;NUSHU CHARACTER-1B2BE;Lo;0;L;;;;;N;;;;; +1B2BF;NUSHU CHARACTER-1B2BF;Lo;0;L;;;;;N;;;;; +1B2C0;NUSHU CHARACTER-1B2C0;Lo;0;L;;;;;N;;;;; +1B2C1;NUSHU CHARACTER-1B2C1;Lo;0;L;;;;;N;;;;; +1B2C2;NUSHU CHARACTER-1B2C2;Lo;0;L;;;;;N;;;;; +1B2C3;NUSHU CHARACTER-1B2C3;Lo;0;L;;;;;N;;;;; +1B2C4;NUSHU CHARACTER-1B2C4;Lo;0;L;;;;;N;;;;; +1B2C5;NUSHU CHARACTER-1B2C5;Lo;0;L;;;;;N;;;;; +1B2C6;NUSHU CHARACTER-1B2C6;Lo;0;L;;;;;N;;;;; +1B2C7;NUSHU CHARACTER-1B2C7;Lo;0;L;;;;;N;;;;; +1B2C8;NUSHU CHARACTER-1B2C8;Lo;0;L;;;;;N;;;;; +1B2C9;NUSHU CHARACTER-1B2C9;Lo;0;L;;;;;N;;;;; +1B2CA;NUSHU CHARACTER-1B2CA;Lo;0;L;;;;;N;;;;; +1B2CB;NUSHU CHARACTER-1B2CB;Lo;0;L;;;;;N;;;;; +1B2CC;NUSHU CHARACTER-1B2CC;Lo;0;L;;;;;N;;;;; +1B2CD;NUSHU CHARACTER-1B2CD;Lo;0;L;;;;;N;;;;; +1B2CE;NUSHU CHARACTER-1B2CE;Lo;0;L;;;;;N;;;;; +1B2CF;NUSHU CHARACTER-1B2CF;Lo;0;L;;;;;N;;;;; +1B2D0;NUSHU CHARACTER-1B2D0;Lo;0;L;;;;;N;;;;; +1B2D1;NUSHU CHARACTER-1B2D1;Lo;0;L;;;;;N;;;;; +1B2D2;NUSHU CHARACTER-1B2D2;Lo;0;L;;;;;N;;;;; +1B2D3;NUSHU CHARACTER-1B2D3;Lo;0;L;;;;;N;;;;; +1B2D4;NUSHU CHARACTER-1B2D4;Lo;0;L;;;;;N;;;;; +1B2D5;NUSHU CHARACTER-1B2D5;Lo;0;L;;;;;N;;;;; +1B2D6;NUSHU CHARACTER-1B2D6;Lo;0;L;;;;;N;;;;; +1B2D7;NUSHU CHARACTER-1B2D7;Lo;0;L;;;;;N;;;;; +1B2D8;NUSHU CHARACTER-1B2D8;Lo;0;L;;;;;N;;;;; +1B2D9;NUSHU CHARACTER-1B2D9;Lo;0;L;;;;;N;;;;; +1B2DA;NUSHU CHARACTER-1B2DA;Lo;0;L;;;;;N;;;;; +1B2DB;NUSHU CHARACTER-1B2DB;Lo;0;L;;;;;N;;;;; +1B2DC;NUSHU CHARACTER-1B2DC;Lo;0;L;;;;;N;;;;; +1B2DD;NUSHU CHARACTER-1B2DD;Lo;0;L;;;;;N;;;;; +1B2DE;NUSHU CHARACTER-1B2DE;Lo;0;L;;;;;N;;;;; +1B2DF;NUSHU CHARACTER-1B2DF;Lo;0;L;;;;;N;;;;; +1B2E0;NUSHU CHARACTER-1B2E0;Lo;0;L;;;;;N;;;;; +1B2E1;NUSHU CHARACTER-1B2E1;Lo;0;L;;;;;N;;;;; +1B2E2;NUSHU CHARACTER-1B2E2;Lo;0;L;;;;;N;;;;; +1B2E3;NUSHU CHARACTER-1B2E3;Lo;0;L;;;;;N;;;;; +1B2E4;NUSHU CHARACTER-1B2E4;Lo;0;L;;;;;N;;;;; +1B2E5;NUSHU CHARACTER-1B2E5;Lo;0;L;;;;;N;;;;; +1B2E6;NUSHU CHARACTER-1B2E6;Lo;0;L;;;;;N;;;;; +1B2E7;NUSHU CHARACTER-1B2E7;Lo;0;L;;;;;N;;;;; +1B2E8;NUSHU CHARACTER-1B2E8;Lo;0;L;;;;;N;;;;; +1B2E9;NUSHU CHARACTER-1B2E9;Lo;0;L;;;;;N;;;;; +1B2EA;NUSHU CHARACTER-1B2EA;Lo;0;L;;;;;N;;;;; +1B2EB;NUSHU CHARACTER-1B2EB;Lo;0;L;;;;;N;;;;; +1B2EC;NUSHU CHARACTER-1B2EC;Lo;0;L;;;;;N;;;;; +1B2ED;NUSHU CHARACTER-1B2ED;Lo;0;L;;;;;N;;;;; +1B2EE;NUSHU CHARACTER-1B2EE;Lo;0;L;;;;;N;;;;; +1B2EF;NUSHU CHARACTER-1B2EF;Lo;0;L;;;;;N;;;;; +1B2F0;NUSHU CHARACTER-1B2F0;Lo;0;L;;;;;N;;;;; +1B2F1;NUSHU CHARACTER-1B2F1;Lo;0;L;;;;;N;;;;; +1B2F2;NUSHU CHARACTER-1B2F2;Lo;0;L;;;;;N;;;;; +1B2F3;NUSHU CHARACTER-1B2F3;Lo;0;L;;;;;N;;;;; +1B2F4;NUSHU CHARACTER-1B2F4;Lo;0;L;;;;;N;;;;; +1B2F5;NUSHU CHARACTER-1B2F5;Lo;0;L;;;;;N;;;;; +1B2F6;NUSHU CHARACTER-1B2F6;Lo;0;L;;;;;N;;;;; +1B2F7;NUSHU CHARACTER-1B2F7;Lo;0;L;;;;;N;;;;; +1B2F8;NUSHU CHARACTER-1B2F8;Lo;0;L;;;;;N;;;;; +1B2F9;NUSHU CHARACTER-1B2F9;Lo;0;L;;;;;N;;;;; +1B2FA;NUSHU CHARACTER-1B2FA;Lo;0;L;;;;;N;;;;; +1B2FB;NUSHU CHARACTER-1B2FB;Lo;0;L;;;;;N;;;;; 1BC00;DUPLOYAN LETTER H;Lo;0;L;;;;;N;;;;; 1BC01;DUPLOYAN LETTER X;Lo;0;L;;;;;N;;;;; 1BC02;DUPLOYAN LETTER P;Lo;0;L;;;;;N;;;;; @@ -26154,6 +28261,44 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1DAAD;SIGNWRITING ROTATION MODIFIER-14;Mn;0;NSM;;;;;N;;;;; 1DAAE;SIGNWRITING ROTATION MODIFIER-15;Mn;0;NSM;;;;;N;;;;; 1DAAF;SIGNWRITING ROTATION MODIFIER-16;Mn;0;NSM;;;;;N;;;;; +1E000;COMBINING GLAGOLITIC LETTER AZU;Mn;230;NSM;;;;;N;;;;; +1E001;COMBINING GLAGOLITIC LETTER BUKY;Mn;230;NSM;;;;;N;;;;; +1E002;COMBINING GLAGOLITIC LETTER VEDE;Mn;230;NSM;;;;;N;;;;; +1E003;COMBINING GLAGOLITIC LETTER GLAGOLI;Mn;230;NSM;;;;;N;;;;; +1E004;COMBINING GLAGOLITIC LETTER DOBRO;Mn;230;NSM;;;;;N;;;;; +1E005;COMBINING GLAGOLITIC LETTER YESTU;Mn;230;NSM;;;;;N;;;;; +1E006;COMBINING GLAGOLITIC LETTER ZHIVETE;Mn;230;NSM;;;;;N;;;;; +1E008;COMBINING GLAGOLITIC LETTER ZEMLJA;Mn;230;NSM;;;;;N;;;;; +1E009;COMBINING GLAGOLITIC LETTER IZHE;Mn;230;NSM;;;;;N;;;;; +1E00A;COMBINING GLAGOLITIC LETTER INITIAL IZHE;Mn;230;NSM;;;;;N;;;;; +1E00B;COMBINING GLAGOLITIC LETTER I;Mn;230;NSM;;;;;N;;;;; +1E00C;COMBINING GLAGOLITIC LETTER DJERVI;Mn;230;NSM;;;;;N;;;;; +1E00D;COMBINING GLAGOLITIC LETTER KAKO;Mn;230;NSM;;;;;N;;;;; +1E00E;COMBINING GLAGOLITIC LETTER LJUDIJE;Mn;230;NSM;;;;;N;;;;; +1E00F;COMBINING GLAGOLITIC LETTER MYSLITE;Mn;230;NSM;;;;;N;;;;; +1E010;COMBINING GLAGOLITIC LETTER NASHI;Mn;230;NSM;;;;;N;;;;; +1E011;COMBINING GLAGOLITIC LETTER ONU;Mn;230;NSM;;;;;N;;;;; +1E012;COMBINING GLAGOLITIC LETTER POKOJI;Mn;230;NSM;;;;;N;;;;; +1E013;COMBINING GLAGOLITIC LETTER RITSI;Mn;230;NSM;;;;;N;;;;; +1E014;COMBINING GLAGOLITIC LETTER SLOVO;Mn;230;NSM;;;;;N;;;;; +1E015;COMBINING GLAGOLITIC LETTER TVRIDO;Mn;230;NSM;;;;;N;;;;; +1E016;COMBINING GLAGOLITIC LETTER UKU;Mn;230;NSM;;;;;N;;;;; +1E017;COMBINING GLAGOLITIC LETTER FRITU;Mn;230;NSM;;;;;N;;;;; +1E018;COMBINING GLAGOLITIC LETTER HERU;Mn;230;NSM;;;;;N;;;;; +1E01B;COMBINING GLAGOLITIC LETTER SHTA;Mn;230;NSM;;;;;N;;;;; +1E01C;COMBINING GLAGOLITIC LETTER TSI;Mn;230;NSM;;;;;N;;;;; +1E01D;COMBINING GLAGOLITIC LETTER CHRIVI;Mn;230;NSM;;;;;N;;;;; +1E01E;COMBINING GLAGOLITIC LETTER SHA;Mn;230;NSM;;;;;N;;;;; +1E01F;COMBINING GLAGOLITIC LETTER YERU;Mn;230;NSM;;;;;N;;;;; +1E020;COMBINING GLAGOLITIC LETTER YERI;Mn;230;NSM;;;;;N;;;;; +1E021;COMBINING GLAGOLITIC LETTER YATI;Mn;230;NSM;;;;;N;;;;; +1E023;COMBINING GLAGOLITIC LETTER YU;Mn;230;NSM;;;;;N;;;;; +1E024;COMBINING GLAGOLITIC LETTER SMALL YUS;Mn;230;NSM;;;;;N;;;;; +1E026;COMBINING GLAGOLITIC LETTER YO;Mn;230;NSM;;;;;N;;;;; +1E027;COMBINING GLAGOLITIC LETTER IOTATED SMALL YUS;Mn;230;NSM;;;;;N;;;;; +1E028;COMBINING GLAGOLITIC LETTER BIG YUS;Mn;230;NSM;;;;;N;;;;; +1E029;COMBINING GLAGOLITIC LETTER IOTATED BIG YUS;Mn;230;NSM;;;;;N;;;;; +1E02A;COMBINING GLAGOLITIC LETTER FITA;Mn;230;NSM;;;;;N;;;;; 1E800;MENDE KIKAKUI SYLLABLE M001 KI;Lo;0;R;;;;;N;;;;; 1E801;MENDE KIKAKUI SYLLABLE M002 KA;Lo;0;R;;;;;N;;;;; 1E802;MENDE KIKAKUI SYLLABLE M003 KU;Lo;0;R;;;;;N;;;;; @@ -26367,6 +28512,93 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1E8D4;MENDE KIKAKUI COMBINING NUMBER TEN THOUSANDS;Mn;220;NSM;;;;;N;;;;; 1E8D5;MENDE KIKAKUI COMBINING NUMBER HUNDRED THOUSANDS;Mn;220;NSM;;;;;N;;;;; 1E8D6;MENDE KIKAKUI COMBINING NUMBER MILLIONS;Mn;220;NSM;;;;;N;;;;; +1E900;ADLAM CAPITAL LETTER ALIF;Lu;0;R;;;;;N;;;;1E922; +1E901;ADLAM CAPITAL LETTER DAALI;Lu;0;R;;;;;N;;;;1E923; +1E902;ADLAM CAPITAL LETTER LAAM;Lu;0;R;;;;;N;;;;1E924; +1E903;ADLAM CAPITAL LETTER MIIM;Lu;0;R;;;;;N;;;;1E925; +1E904;ADLAM CAPITAL LETTER BA;Lu;0;R;;;;;N;;;;1E926; +1E905;ADLAM CAPITAL LETTER SINNYIIYHE;Lu;0;R;;;;;N;;;;1E927; +1E906;ADLAM CAPITAL LETTER PE;Lu;0;R;;;;;N;;;;1E928; +1E907;ADLAM CAPITAL LETTER BHE;Lu;0;R;;;;;N;;;;1E929; +1E908;ADLAM CAPITAL LETTER RA;Lu;0;R;;;;;N;;;;1E92A; +1E909;ADLAM CAPITAL LETTER E;Lu;0;R;;;;;N;;;;1E92B; +1E90A;ADLAM CAPITAL LETTER FA;Lu;0;R;;;;;N;;;;1E92C; +1E90B;ADLAM CAPITAL LETTER I;Lu;0;R;;;;;N;;;;1E92D; +1E90C;ADLAM CAPITAL LETTER O;Lu;0;R;;;;;N;;;;1E92E; +1E90D;ADLAM CAPITAL LETTER DHA;Lu;0;R;;;;;N;;;;1E92F; +1E90E;ADLAM CAPITAL LETTER YHE;Lu;0;R;;;;;N;;;;1E930; +1E90F;ADLAM CAPITAL LETTER WAW;Lu;0;R;;;;;N;;;;1E931; +1E910;ADLAM CAPITAL LETTER NUN;Lu;0;R;;;;;N;;;;1E932; +1E911;ADLAM CAPITAL LETTER KAF;Lu;0;R;;;;;N;;;;1E933; +1E912;ADLAM CAPITAL LETTER YA;Lu;0;R;;;;;N;;;;1E934; +1E913;ADLAM CAPITAL LETTER U;Lu;0;R;;;;;N;;;;1E935; +1E914;ADLAM CAPITAL LETTER JIIM;Lu;0;R;;;;;N;;;;1E936; +1E915;ADLAM CAPITAL LETTER CHI;Lu;0;R;;;;;N;;;;1E937; +1E916;ADLAM CAPITAL LETTER HA;Lu;0;R;;;;;N;;;;1E938; +1E917;ADLAM CAPITAL LETTER QAAF;Lu;0;R;;;;;N;;;;1E939; +1E918;ADLAM CAPITAL LETTER GA;Lu;0;R;;;;;N;;;;1E93A; +1E919;ADLAM CAPITAL LETTER NYA;Lu;0;R;;;;;N;;;;1E93B; +1E91A;ADLAM CAPITAL LETTER TU;Lu;0;R;;;;;N;;;;1E93C; +1E91B;ADLAM CAPITAL LETTER NHA;Lu;0;R;;;;;N;;;;1E93D; +1E91C;ADLAM CAPITAL LETTER VA;Lu;0;R;;;;;N;;;;1E93E; +1E91D;ADLAM CAPITAL LETTER KHA;Lu;0;R;;;;;N;;;;1E93F; +1E91E;ADLAM CAPITAL LETTER GBE;Lu;0;R;;;;;N;;;;1E940; +1E91F;ADLAM CAPITAL LETTER ZAL;Lu;0;R;;;;;N;;;;1E941; +1E920;ADLAM CAPITAL LETTER KPO;Lu;0;R;;;;;N;;;;1E942; +1E921;ADLAM CAPITAL LETTER SHA;Lu;0;R;;;;;N;;;;1E943; +1E922;ADLAM SMALL LETTER ALIF;Ll;0;R;;;;;N;;;1E900;;1E900 +1E923;ADLAM SMALL LETTER DAALI;Ll;0;R;;;;;N;;;1E901;;1E901 +1E924;ADLAM SMALL LETTER LAAM;Ll;0;R;;;;;N;;;1E902;;1E902 +1E925;ADLAM SMALL LETTER MIIM;Ll;0;R;;;;;N;;;1E903;;1E903 +1E926;ADLAM SMALL LETTER BA;Ll;0;R;;;;;N;;;1E904;;1E904 +1E927;ADLAM SMALL LETTER SINNYIIYHE;Ll;0;R;;;;;N;;;1E905;;1E905 +1E928;ADLAM SMALL LETTER PE;Ll;0;R;;;;;N;;;1E906;;1E906 +1E929;ADLAM SMALL LETTER BHE;Ll;0;R;;;;;N;;;1E907;;1E907 +1E92A;ADLAM SMALL LETTER RA;Ll;0;R;;;;;N;;;1E908;;1E908 +1E92B;ADLAM SMALL LETTER E;Ll;0;R;;;;;N;;;1E909;;1E909 +1E92C;ADLAM SMALL LETTER FA;Ll;0;R;;;;;N;;;1E90A;;1E90A +1E92D;ADLAM SMALL LETTER I;Ll;0;R;;;;;N;;;1E90B;;1E90B +1E92E;ADLAM SMALL LETTER O;Ll;0;R;;;;;N;;;1E90C;;1E90C +1E92F;ADLAM SMALL LETTER DHA;Ll;0;R;;;;;N;;;1E90D;;1E90D +1E930;ADLAM SMALL LETTER YHE;Ll;0;R;;;;;N;;;1E90E;;1E90E +1E931;ADLAM SMALL LETTER WAW;Ll;0;R;;;;;N;;;1E90F;;1E90F +1E932;ADLAM SMALL LETTER NUN;Ll;0;R;;;;;N;;;1E910;;1E910 +1E933;ADLAM SMALL LETTER KAF;Ll;0;R;;;;;N;;;1E911;;1E911 +1E934;ADLAM SMALL LETTER YA;Ll;0;R;;;;;N;;;1E912;;1E912 +1E935;ADLAM SMALL LETTER U;Ll;0;R;;;;;N;;;1E913;;1E913 +1E936;ADLAM SMALL LETTER JIIM;Ll;0;R;;;;;N;;;1E914;;1E914 +1E937;ADLAM SMALL LETTER CHI;Ll;0;R;;;;;N;;;1E915;;1E915 +1E938;ADLAM SMALL LETTER HA;Ll;0;R;;;;;N;;;1E916;;1E916 +1E939;ADLAM SMALL LETTER QAAF;Ll;0;R;;;;;N;;;1E917;;1E917 +1E93A;ADLAM SMALL LETTER GA;Ll;0;R;;;;;N;;;1E918;;1E918 +1E93B;ADLAM SMALL LETTER NYA;Ll;0;R;;;;;N;;;1E919;;1E919 +1E93C;ADLAM SMALL LETTER TU;Ll;0;R;;;;;N;;;1E91A;;1E91A +1E93D;ADLAM SMALL LETTER NHA;Ll;0;R;;;;;N;;;1E91B;;1E91B +1E93E;ADLAM SMALL LETTER VA;Ll;0;R;;;;;N;;;1E91C;;1E91C +1E93F;ADLAM SMALL LETTER KHA;Ll;0;R;;;;;N;;;1E91D;;1E91D +1E940;ADLAM SMALL LETTER GBE;Ll;0;R;;;;;N;;;1E91E;;1E91E +1E941;ADLAM SMALL LETTER ZAL;Ll;0;R;;;;;N;;;1E91F;;1E91F +1E942;ADLAM SMALL LETTER KPO;Ll;0;R;;;;;N;;;1E920;;1E920 +1E943;ADLAM SMALL LETTER SHA;Ll;0;R;;;;;N;;;1E921;;1E921 +1E944;ADLAM ALIF LENGTHENER;Mn;230;NSM;;;;;N;;;;; +1E945;ADLAM VOWEL LENGTHENER;Mn;230;NSM;;;;;N;;;;; +1E946;ADLAM GEMINATION MARK;Mn;230;NSM;;;;;N;;;;; +1E947;ADLAM HAMZA;Mn;230;NSM;;;;;N;;;;; +1E948;ADLAM CONSONANT MODIFIER;Mn;230;NSM;;;;;N;;;;; +1E949;ADLAM GEMINATE CONSONANT MODIFIER;Mn;230;NSM;;;;;N;;;;; +1E94A;ADLAM NUKTA;Mn;7;NSM;;;;;N;;;;; +1E950;ADLAM DIGIT ZERO;Nd;0;R;;0;0;0;N;;;;; +1E951;ADLAM DIGIT ONE;Nd;0;R;;1;1;1;N;;;;; +1E952;ADLAM DIGIT TWO;Nd;0;R;;2;2;2;N;;;;; +1E953;ADLAM DIGIT THREE;Nd;0;R;;3;3;3;N;;;;; +1E954;ADLAM DIGIT FOUR;Nd;0;R;;4;4;4;N;;;;; +1E955;ADLAM DIGIT FIVE;Nd;0;R;;5;5;5;N;;;;; +1E956;ADLAM DIGIT SIX;Nd;0;R;;6;6;6;N;;;;; +1E957;ADLAM DIGIT SEVEN;Nd;0;R;;7;7;7;N;;;;; +1E958;ADLAM DIGIT EIGHT;Nd;0;R;;8;8;8;N;;;;; +1E959;ADLAM DIGIT NINE;Nd;0;R;;9;9;9;N;;;;; +1E95E;ADLAM INITIAL EXCLAMATION MARK;Po;0;R;;;;;N;;;;; +1E95F;ADLAM INITIAL QUESTION MARK;Po;0;R;;;;;N;;;;; 1EE00;ARABIC MATHEMATICAL ALEF;Lo;0;AL; 0627;;;;N;;;;; 1EE01;ARABIC MATHEMATICAL BEH;Lo;0;AL; 0628;;;;N;;;;; 1EE02;ARABIC MATHEMATICAL JEEM;Lo;0;AL; 062C;;;;N;;;;; @@ -26883,6 +29115,24 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F198;SQUARED SOS;So;0;L;;;;;N;;;;; 1F199;SQUARED UP WITH EXCLAMATION MARK;So;0;L;;;;;N;;;;; 1F19A;SQUARED VS;So;0;L;;;;;N;;;;; +1F19B;SQUARED THREE D;So;0;L;;;;;N;;;;; +1F19C;SQUARED SECOND SCREEN;So;0;L;;;;;N;;;;; +1F19D;SQUARED TWO K;So;0;L;;;;;N;;;;; +1F19E;SQUARED FOUR K;So;0;L;;;;;N;;;;; +1F19F;SQUARED EIGHT K;So;0;L;;;;;N;;;;; +1F1A0;SQUARED FIVE POINT ONE;So;0;L;;;;;N;;;;; +1F1A1;SQUARED SEVEN POINT ONE;So;0;L;;;;;N;;;;; +1F1A2;SQUARED TWENTY-TWO POINT TWO;So;0;L;;;;;N;;;;; +1F1A3;SQUARED SIXTY P;So;0;L;;;;;N;;;;; +1F1A4;SQUARED ONE HUNDRED TWENTY P;So;0;L;;;;;N;;;;; +1F1A5;SQUARED LATIN SMALL LETTER D;So;0;L;;;;;N;;;;; +1F1A6;SQUARED HC;So;0;L;;;;;N;;;;; +1F1A7;SQUARED HDR;So;0;L;;;;;N;;;;; +1F1A8;SQUARED HI-RES;So;0;L;;;;;N;;;;; +1F1A9;SQUARED LOSSLESS;So;0;L;;;;;N;;;;; +1F1AA;SQUARED SHV;So;0;L;;;;;N;;;;; +1F1AB;SQUARED UHD;So;0;L;;;;;N;;;;; +1F1AC;SQUARED VOD;So;0;L;;;;;N;;;;; 1F1E6;REGIONAL INDICATOR SYMBOL LETTER A;So;0;L;;;;;N;;;;; 1F1E7;REGIONAL INDICATOR SYMBOL LETTER B;So;0;L;;;;;N;;;;; 1F1E8;REGIONAL INDICATOR SYMBOL LETTER C;So;0;L;;;;;N;;;;; @@ -26955,6 +29205,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F238;SQUARED CJK UNIFIED IDEOGRAPH-7533;So;0;L; 7533;;;;N;;;;; 1F239;SQUARED CJK UNIFIED IDEOGRAPH-5272;So;0;L; 5272;;;;N;;;;; 1F23A;SQUARED CJK UNIFIED IDEOGRAPH-55B6;So;0;L; 55B6;;;;N;;;;; +1F23B;SQUARED CJK UNIFIED IDEOGRAPH-914D;So;0;L; 914D;;;;N;;;;; 1F240;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-672C;So;0;L; 3014 672C 3015;;;;N;;;;; 1F241;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-4E09;So;0;L; 3014 4E09 3015;;;;N;;;;; 1F242;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-4E8C;So;0;L; 3014 4E8C 3015;;;;N;;;;; @@ -26966,6 +29217,12 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F248;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557;So;0;L; 3014 6557 3015;;;;N;;;;; 1F250;CIRCLED IDEOGRAPH ADVANTAGE;So;0;L; 5F97;;;;N;;;;; 1F251;CIRCLED IDEOGRAPH ACCEPT;So;0;L; 53EF;;;;N;;;;; +1F260;ROUNDED SYMBOL FOR FU;So;0;ON;;;;;N;;;;; +1F261;ROUNDED SYMBOL FOR LU;So;0;ON;;;;;N;;;;; +1F262;ROUNDED SYMBOL FOR SHOU;So;0;ON;;;;;N;;;;; +1F263;ROUNDED SYMBOL FOR XI;So;0;ON;;;;;N;;;;; +1F264;ROUNDED SYMBOL FOR SHUANGXI;So;0;ON;;;;;N;;;;; +1F265;ROUNDED SYMBOL FOR CAI;So;0;ON;;;;;N;;;;; 1F300;CYCLONE;So;0;ON;;;;;N;;;;; 1F301;FOGGY;So;0;ON;;;;;N;;;;; 1F302;CLOSED UMBRELLA;So;0;ON;;;;;N;;;;; @@ -27600,6 +29857,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F577;SPIDER;So;0;ON;;;;;N;;;;; 1F578;SPIDER WEB;So;0;ON;;;;;N;;;;; 1F579;JOYSTICK;So;0;ON;;;;;N;;;;; +1F57A;MAN DANCING;So;0;ON;;;;;N;;;;; 1F57B;LEFT HAND TELEPHONE RECEIVER;So;0;ON;;;;;N;;;;; 1F57C;TELEPHONE RECEIVER WITH PAGE;So;0;ON;;;;;N;;;;; 1F57D;RIGHT HAND TELEPHONE RECEIVER;So;0;ON;;;;;N;;;;; @@ -27641,6 +29899,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F5A1;SIDEWAYS BLACK DOWN POINTING INDEX;So;0;ON;;;;;N;;;;; 1F5A2;BLACK UP POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; 1F5A3;BLACK DOWN POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F5A4;BLACK HEART;So;0;ON;;;;;N;;;;; 1F5A5;DESKTOP COMPUTER;So;0;ON;;;;;N;;;;; 1F5A6;KEYBOARD AND MOUSE;So;0;ON;;;;;N;;;;; 1F5A7;THREE NETWORKED COMPUTERS;So;0;ON;;;;;N;;;;; @@ -27941,6 +30200,10 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F6CE;BELLHOP BELL;So;0;ON;;;;;N;;;;; 1F6CF;BED;So;0;ON;;;;;N;;;;; 1F6D0;PLACE OF WORSHIP;So;0;ON;;;;;N;;;;; +1F6D1;OCTAGONAL SIGN;So;0;ON;;;;;N;;;;; +1F6D2;SHOPPING TROLLEY;So;0;ON;;;;;N;;;;; +1F6D3;STUPA;So;0;ON;;;;;N;;;;; +1F6D4;PAGODA;So;0;ON;;;;;N;;;;; 1F6E0;HAMMER AND WRENCH;So;0;ON;;;;;N;;;;; 1F6E1;SHIELD;So;0;ON;;;;;N;;;;; 1F6E2;OIL DRUM;So;0;ON;;;;;N;;;;; @@ -27958,6 +30221,11 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F6F1;ONCOMING FIRE ENGINE;So;0;ON;;;;;N;;;;; 1F6F2;DIESEL LOCOMOTIVE;So;0;ON;;;;;N;;;;; 1F6F3;PASSENGER SHIP;So;0;ON;;;;;N;;;;; +1F6F4;SCOOTER;So;0;ON;;;;;N;;;;; +1F6F5;MOTOR SCOOTER;So;0;ON;;;;;N;;;;; +1F6F6;CANOE;So;0;ON;;;;;N;;;;; +1F6F7;SLED;So;0;ON;;;;;N;;;;; +1F6F8;FLYING SAUCER;So;0;ON;;;;;N;;;;; 1F700;ALCHEMICAL SYMBOL FOR QUINTESSENCE;So;0;ON;;;;;N;;;;; 1F701;ALCHEMICAL SYMBOL FOR AIR;So;0;ON;;;;;N;;;;; 1F702;ALCHEMICAL SYMBOL FOR FIRE;So;0;ON;;;;;N;;;;; @@ -28307,6 +30575,18 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F8AB;RIGHTWARDS FRONT-TILTED SHADOWED WHITE ARROW;So;0;ON;;;;;N;;;;; 1F8AC;WHITE ARROW SHAFT WIDTH ONE;So;0;ON;;;;;N;;;;; 1F8AD;WHITE ARROW SHAFT WIDTH TWO THIRDS;So;0;ON;;;;;N;;;;; +1F900;CIRCLED CROSS FORMEE WITH FOUR DOTS;So;0;ON;;;;;N;;;;; +1F901;CIRCLED CROSS FORMEE WITH TWO DOTS;So;0;ON;;;;;N;;;;; +1F902;CIRCLED CROSS FORMEE;So;0;ON;;;;;N;;;;; +1F903;LEFT HALF CIRCLE WITH FOUR DOTS;So;0;ON;;;;;N;;;;; +1F904;LEFT HALF CIRCLE WITH THREE DOTS;So;0;ON;;;;;N;;;;; +1F905;LEFT HALF CIRCLE WITH TWO DOTS;So;0;ON;;;;;N;;;;; +1F906;LEFT HALF CIRCLE WITH DOT;So;0;ON;;;;;N;;;;; +1F907;LEFT HALF CIRCLE;So;0;ON;;;;;N;;;;; +1F908;DOWNWARD FACING HOOK;So;0;ON;;;;;N;;;;; +1F909;DOWNWARD FACING NOTCHED HOOK;So;0;ON;;;;;N;;;;; +1F90A;DOWNWARD FACING HOOK WITH DOT;So;0;ON;;;;;N;;;;; +1F90B;DOWNWARD FACING NOTCHED HOOK WITH DOT;So;0;ON;;;;;N;;;;; 1F910;ZIPPER-MOUTH FACE;So;0;ON;;;;;N;;;;; 1F911;MONEY-MOUTH FACE;So;0;ON;;;;;N;;;;; 1F912;FACE WITH THERMOMETER;So;0;ON;;;;;N;;;;; @@ -28316,12 +30596,133 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 1F916;ROBOT FACE;So;0;ON;;;;;N;;;;; 1F917;HUGGING FACE;So;0;ON;;;;;N;;;;; 1F918;SIGN OF THE HORNS;So;0;ON;;;;;N;;;;; +1F919;CALL ME HAND;So;0;ON;;;;;N;;;;; +1F91A;RAISED BACK OF HAND;So;0;ON;;;;;N;;;;; +1F91B;LEFT-FACING FIST;So;0;ON;;;;;N;;;;; +1F91C;RIGHT-FACING FIST;So;0;ON;;;;;N;;;;; +1F91D;HANDSHAKE;So;0;ON;;;;;N;;;;; +1F91E;HAND WITH INDEX AND MIDDLE FINGERS CROSSED;So;0;ON;;;;;N;;;;; +1F91F;I LOVE YOU HAND SIGN;So;0;ON;;;;;N;;;;; +1F920;FACE WITH COWBOY HAT;So;0;ON;;;;;N;;;;; +1F921;CLOWN FACE;So;0;ON;;;;;N;;;;; +1F922;NAUSEATED FACE;So;0;ON;;;;;N;;;;; +1F923;ROLLING ON THE FLOOR LAUGHING;So;0;ON;;;;;N;;;;; +1F924;DROOLING FACE;So;0;ON;;;;;N;;;;; +1F925;LYING FACE;So;0;ON;;;;;N;;;;; +1F926;FACE PALM;So;0;ON;;;;;N;;;;; +1F927;SNEEZING FACE;So;0;ON;;;;;N;;;;; +1F928;FACE WITH ONE EYEBROW RAISED;So;0;ON;;;;;N;;;;; +1F929;GRINNING FACE WITH STAR EYES;So;0;ON;;;;;N;;;;; +1F92A;GRINNING FACE WITH ONE LARGE AND ONE SMALL EYE;So;0;ON;;;;;N;;;;; +1F92B;FACE WITH FINGER COVERING CLOSED LIPS;So;0;ON;;;;;N;;;;; +1F92C;SERIOUS FACE WITH SYMBOLS COVERING MOUTH;So;0;ON;;;;;N;;;;; +1F92D;SMILING FACE WITH SMILING EYES AND HAND COVERING MOUTH;So;0;ON;;;;;N;;;;; +1F92E;FACE WITH OPEN MOUTH VOMITING;So;0;ON;;;;;N;;;;; +1F92F;SHOCKED FACE WITH EXPLODING HEAD;So;0;ON;;;;;N;;;;; +1F930;PREGNANT WOMAN;So;0;ON;;;;;N;;;;; +1F931;BREAST-FEEDING;So;0;ON;;;;;N;;;;; +1F932;PALMS UP TOGETHER;So;0;ON;;;;;N;;;;; +1F933;SELFIE;So;0;ON;;;;;N;;;;; +1F934;PRINCE;So;0;ON;;;;;N;;;;; +1F935;MAN IN TUXEDO;So;0;ON;;;;;N;;;;; +1F936;MOTHER CHRISTMAS;So;0;ON;;;;;N;;;;; +1F937;SHRUG;So;0;ON;;;;;N;;;;; +1F938;PERSON DOING CARTWHEEL;So;0;ON;;;;;N;;;;; +1F939;JUGGLING;So;0;ON;;;;;N;;;;; +1F93A;FENCER;So;0;ON;;;;;N;;;;; +1F93B;MODERN PENTATHLON;So;0;ON;;;;;N;;;;; +1F93C;WRESTLERS;So;0;ON;;;;;N;;;;; +1F93D;WATER POLO;So;0;ON;;;;;N;;;;; +1F93E;HANDBALL;So;0;ON;;;;;N;;;;; +1F940;WILTED FLOWER;So;0;ON;;;;;N;;;;; +1F941;DRUM WITH DRUMSTICKS;So;0;ON;;;;;N;;;;; +1F942;CLINKING GLASSES;So;0;ON;;;;;N;;;;; +1F943;TUMBLER GLASS;So;0;ON;;;;;N;;;;; +1F944;SPOON;So;0;ON;;;;;N;;;;; +1F945;GOAL NET;So;0;ON;;;;;N;;;;; +1F946;RIFLE;So;0;ON;;;;;N;;;;; +1F947;FIRST PLACE MEDAL;So;0;ON;;;;;N;;;;; +1F948;SECOND PLACE MEDAL;So;0;ON;;;;;N;;;;; +1F949;THIRD PLACE MEDAL;So;0;ON;;;;;N;;;;; +1F94A;BOXING GLOVE;So;0;ON;;;;;N;;;;; +1F94B;MARTIAL ARTS UNIFORM;So;0;ON;;;;;N;;;;; +1F94C;CURLING STONE;So;0;ON;;;;;N;;;;; +1F950;CROISSANT;So;0;ON;;;;;N;;;;; +1F951;AVOCADO;So;0;ON;;;;;N;;;;; +1F952;CUCUMBER;So;0;ON;;;;;N;;;;; +1F953;BACON;So;0;ON;;;;;N;;;;; +1F954;POTATO;So;0;ON;;;;;N;;;;; +1F955;CARROT;So;0;ON;;;;;N;;;;; +1F956;BAGUETTE BREAD;So;0;ON;;;;;N;;;;; +1F957;GREEN SALAD;So;0;ON;;;;;N;;;;; +1F958;SHALLOW PAN OF FOOD;So;0;ON;;;;;N;;;;; +1F959;STUFFED FLATBREAD;So;0;ON;;;;;N;;;;; +1F95A;EGG;So;0;ON;;;;;N;;;;; +1F95B;GLASS OF MILK;So;0;ON;;;;;N;;;;; +1F95C;PEANUTS;So;0;ON;;;;;N;;;;; +1F95D;KIWIFRUIT;So;0;ON;;;;;N;;;;; +1F95E;PANCAKES;So;0;ON;;;;;N;;;;; +1F95F;DUMPLING;So;0;ON;;;;;N;;;;; +1F960;FORTUNE COOKIE;So;0;ON;;;;;N;;;;; +1F961;TAKEOUT BOX;So;0;ON;;;;;N;;;;; +1F962;CHOPSTICKS;So;0;ON;;;;;N;;;;; +1F963;BOWL WITH SPOON;So;0;ON;;;;;N;;;;; +1F964;CUP WITH STRAW;So;0;ON;;;;;N;;;;; +1F965;COCONUT;So;0;ON;;;;;N;;;;; +1F966;BROCCOLI;So;0;ON;;;;;N;;;;; +1F967;PIE;So;0;ON;;;;;N;;;;; +1F968;PRETZEL;So;0;ON;;;;;N;;;;; +1F969;CUT OF MEAT;So;0;ON;;;;;N;;;;; +1F96A;SANDWICH;So;0;ON;;;;;N;;;;; +1F96B;CANNED FOOD;So;0;ON;;;;;N;;;;; 1F980;CRAB;So;0;ON;;;;;N;;;;; 1F981;LION FACE;So;0;ON;;;;;N;;;;; 1F982;SCORPION;So;0;ON;;;;;N;;;;; 1F983;TURKEY;So;0;ON;;;;;N;;;;; 1F984;UNICORN FACE;So;0;ON;;;;;N;;;;; +1F985;EAGLE;So;0;ON;;;;;N;;;;; +1F986;DUCK;So;0;ON;;;;;N;;;;; +1F987;BAT;So;0;ON;;;;;N;;;;; +1F988;SHARK;So;0;ON;;;;;N;;;;; +1F989;OWL;So;0;ON;;;;;N;;;;; +1F98A;FOX FACE;So;0;ON;;;;;N;;;;; +1F98B;BUTTERFLY;So;0;ON;;;;;N;;;;; +1F98C;DEER;So;0;ON;;;;;N;;;;; +1F98D;GORILLA;So;0;ON;;;;;N;;;;; +1F98E;LIZARD;So;0;ON;;;;;N;;;;; +1F98F;RHINOCEROS;So;0;ON;;;;;N;;;;; +1F990;SHRIMP;So;0;ON;;;;;N;;;;; +1F991;SQUID;So;0;ON;;;;;N;;;;; +1F992;GIRAFFE FACE;So;0;ON;;;;;N;;;;; +1F993;ZEBRA FACE;So;0;ON;;;;;N;;;;; +1F994;HEDGEHOG;So;0;ON;;;;;N;;;;; +1F995;SAUROPOD;So;0;ON;;;;;N;;;;; +1F996;T-REX;So;0;ON;;;;;N;;;;; +1F997;CRICKET;So;0;ON;;;;;N;;;;; 1F9C0;CHEESE WEDGE;So;0;ON;;;;;N;;;;; +1F9D0;FACE WITH MONOCLE;So;0;ON;;;;;N;;;;; +1F9D1;ADULT;So;0;ON;;;;;N;;;;; +1F9D2;CHILD;So;0;ON;;;;;N;;;;; +1F9D3;OLDER ADULT;So;0;ON;;;;;N;;;;; +1F9D4;BEARDED PERSON;So;0;ON;;;;;N;;;;; +1F9D5;PERSON WITH HEADSCARF;So;0;ON;;;;;N;;;;; +1F9D6;PERSON IN STEAMY ROOM;So;0;ON;;;;;N;;;;; +1F9D7;PERSON CLIMBING;So;0;ON;;;;;N;;;;; +1F9D8;PERSON IN LOTUS POSITION;So;0;ON;;;;;N;;;;; +1F9D9;MAGE;So;0;ON;;;;;N;;;;; +1F9DA;FAIRY;So;0;ON;;;;;N;;;;; +1F9DB;VAMPIRE;So;0;ON;;;;;N;;;;; +1F9DC;MERPERSON;So;0;ON;;;;;N;;;;; +1F9DD;ELF;So;0;ON;;;;;N;;;;; +1F9DE;GENIE;So;0;ON;;;;;N;;;;; +1F9DF;ZOMBIE;So;0;ON;;;;;N;;;;; +1F9E0;BRAIN;So;0;ON;;;;;N;;;;; +1F9E1;ORANGE HEART;So;0;ON;;;;;N;;;;; +1F9E2;BILLED CAP;So;0;ON;;;;;N;;;;; +1F9E3;SCARF;So;0;ON;;;;;N;;;;; +1F9E4;GLOVES;So;0;ON;;;;;N;;;;; +1F9E5;COAT;So;0;ON;;;;;N;;;;; +1F9E6;SOCKS;So;0;ON;;;;;N;;;;; 20000;;Lo;0;L;;;;;N;;;;; 2A6D6;;Lo;0;L;;;;;N;;;;; 2A700;;Lo;0;L;;;;;N;;;;; @@ -28330,6 +30731,8 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; 2B81D;;Lo;0;L;;;;;N;;;;; 2B820;;Lo;0;L;;;;;N;;;;; 2CEA1;;Lo;0;L;;;;;N;;;;; +2CEB0;;Lo;0;L;;;;;N;;;;; +2EBE0;;Lo;0;L;;;;;N;;;;; 2F800;CJK COMPATIBILITY IDEOGRAPH-2F800;Lo;0;L;4E3D;;;;N;;;;; 2F801;CJK COMPATIBILITY IDEOGRAPH-2F801;Lo;0;L;4E38;;;;N;;;;; 2F802;CJK COMPATIBILITY IDEOGRAPH-2F802;Lo;0;L;4E41;;;;N;;;;; diff --git a/make/data/unicodedata/VERSION b/make/data/unicodedata/VERSION index ae9a76b9249..a13e7b9c87e 100644 --- a/make/data/unicodedata/VERSION +++ b/make/data/unicodedata/VERSION @@ -1 +1 @@ -8.0.0 +10.0.0 diff --git a/make/gendata/Gendata-jdk.compiler.gmk b/make/gendata/Gendata-jdk.compiler.gmk index 7a7f5c6647e..1d034828598 100644 --- a/make/gendata/Gendata-jdk.compiler.gmk +++ b/make/gendata/Gendata-jdk.compiler.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 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 @@ -75,14 +75,13 @@ $(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files/_the.symbols: \ build-ctsym \ $(CT_DATA_DESCRIPTION) \ $(@D) - $(MKDIR) $(@D)/A $(JAVA_SMALL) $(INTERIM_LANGTOOLS_ARGS) \ $(COMPILECREATESYMBOLS_ADD_EXPORTS) \ -classpath $(BUILDTOOLS_OUTPUTDIR)/create_symbols \ build.tools.symbolgenerator.TransitiveDependencies \ + $(@D) \ $(CT_MODULESOURCEPATH) \ - $(CT_MODULES) \ - >$(@D)/A/system-modules + $(CT_MODULES) $(TOUCH) $@ # Can't generate ct.sym directly into modules libs as the SetupJarArchive macro diff --git a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java index 9511a3f15b4..03f84fa8565 100644 --- a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java +++ b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -31,6 +31,7 @@ import build.tools.symbolgenerator.CreateSymbols import build.tools.symbolgenerator.CreateSymbols .ModuleHeaderDescription .RequiresDescription; +import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -38,8 +39,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.StringWriter; import java.io.Writer; -import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; @@ -49,23 +50,34 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.stream.Stream; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.Set; +import java.util.TimeZone; import java.util.function.Function; import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import javax.tools.JavaFileManager; +import javax.tools.JavaFileManager.Location; +import javax.tools.JavaFileObject; +import javax.tools.JavaFileObject.Kind; +import javax.tools.StandardLocation; + +import com.sun.source.util.JavacTask; import com.sun.tools.classfile.AccessFlags; import com.sun.tools.classfile.Annotation; import com.sun.tools.classfile.Annotation.Annotation_element_value; @@ -115,18 +127,20 @@ import com.sun.tools.classfile.RuntimeParameterAnnotations_attribute; import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute; import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute; import com.sun.tools.classfile.Signature_attribute; +import com.sun.tools.javac.api.JavacTool; import com.sun.tools.javac.jvm.Target; import com.sun.tools.javac.util.Assert; +import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Pair; -import java.io.StringWriter; /** * A tool for processing the .sym.txt files. It allows to: * * convert the .sym.txt into class/sig files for ct.sym * * in cooperation with the adjacent history Probe, construct .sym.txt files for previous platforms + * * enhance existing .sym.txt files with a a new set .sym.txt for the current platform * * To convert the .sym.txt files to class/sig files from ct.sym, run: - * java build.tool.symbolgenerator.CreateSymbols build-ctsym [JOINED_VERSIONS|SEPARATE] + * java build.tool.symbolgenerator.CreateSymbols build-ctsym * * The is a file of this format: * generate platforms @@ -166,11 +180,15 @@ import java.io.StringWriter; * To generate the .sym.txt files for OpenJDK 7 and 8: * /bin/java build.tools.symbolgenerator.Probe OpenJDK7.classes * /bin/java build.tools.symbolgenerator.Probe OpenJDK8.classes - * java build.tools.symbolgenerator.CreateSymbols build-description langtools/make/data/symbols $TOPDIR langtools/make/data/symbols/include.list + * java build.tools.symbolgenerator.CreateSymbols build-description make/data/symbols $TOPDIR make/data/symbols/include.list * 8 OpenJDK8.classes '' * 7 OpenJDK7.classes 8 * * Note: the versions are expected to be a single character. + * + * To enhance existing historical data with data for JDK N, run: + * /bin/java build.tools.symbolgenerator.CreateSymbols build-description-incremental make/data/symbols/symbols make/data/symbols/include.list + * */ public class CreateSymbols { @@ -180,11 +198,11 @@ public class CreateSymbols { */ @SuppressWarnings("unchecked") public void createSymbols(String ctDescriptionFile, String ctSymLocation, CtSymKind ctSymKind) throws IOException { - Pair> data = load(Paths.get(ctDescriptionFile)); + LoadDescriptions data = load(Paths.get(ctDescriptionFile), null); - splitHeaders(data.fst); + splitHeaders(data.classes); - for (ModuleDescription md : data.snd) { + for (ModuleDescription md : data.modules.values()) { for (ModuleHeaderDescription mhd : md.header) { List versionsList = Collections.singletonList(mhd.versions); @@ -195,7 +213,7 @@ public class CreateSymbols { } } - for (ClassDescription classDescription : data.fst) { + for (ClassDescription classDescription : data.classes) { for (ClassHeaderDescription header : classDescription.header) { switch (ctSymKind) { case JOINED_VERSIONS: @@ -219,7 +237,7 @@ public class CreateSymbols { public static String EXTENSION = ".sig"; - Pair> load(Path ctDescription) throws IOException { + LoadDescriptions load(Path ctDescription, String deletePlatform) throws IOException { List platforms = new ArrayList<>(); Set generatePlatforms = null; @@ -228,11 +246,14 @@ public class CreateSymbols { switch (reader.lineKey) { case "generate": String[] platformsAttr = reader.attributes.get("platforms").split(":"); - generatePlatforms = new HashSet<>(Arrays.asList(platformsAttr)); + generatePlatforms = new HashSet<>(List.of(platformsAttr)); + generatePlatforms.remove(deletePlatform); reader.moveNext(); break; case "platform": - platforms.add(PlatformInput.load(reader)); + PlatformInput platform = PlatformInput.load(reader); + if (!platform.version.equals(deletePlatform)) + platforms.add(platform); reader.moveNext(); break; default: @@ -250,7 +271,9 @@ public class CreateSymbols { addNewVersion(cd.fields, platform.basePlatform, platform.version); addNewVersion(cd.methods, platform.basePlatform, platform.version); } - //XXX: enhance module versions + for (ModuleDescription md : modules.values()) { + addNewVersion(md.header, platform.basePlatform, platform.version); + } for (String input : platform.files) { Path inputFile = ctDescription.getParent().resolve(input); try (LineBasedReader reader = new LineBasedReader(inputFile)) { @@ -270,13 +293,23 @@ public class CreateSymbols { cd.read(reader, platform.basePlatform, platform.version); break; - case "module": + case "module": { ModuleDescription md = modules.computeIfAbsent(nameAttr, n -> new ModuleDescription()); md.read(reader, platform.basePlatform, platform.version); break; + } + case "-module": { + ModuleDescription md = + modules.computeIfAbsent(nameAttr, + n -> new ModuleDescription()); + removeVersion(md.header, h -> true, + platform.version); + reader.moveNext(); + break; + } } } } @@ -323,7 +356,7 @@ public class CreateSymbols { result.add(desc); } - List moduleList = new ArrayList<>(); + Map moduleList = new HashMap<>(); for (ModuleDescription desc : modules.values()) { Iterator mhdIt = desc.header.iterator(); @@ -340,10 +373,25 @@ public class CreateSymbols { continue; } - moduleList.add(desc); + moduleList.put(desc.name, desc); + } + + return new LoadDescriptions(result, moduleList, platforms); + } + + static final class LoadDescriptions { + public final ClassList classes; + public final Map modules; + public final List versions; + + public LoadDescriptions(ClassList classes, + Map modules, + List versions) { + this.classes = classes; + this.modules = modules; + this.versions = versions; } - return Pair.of(result, moduleList); } static final class LineBasedReader implements AutoCloseable { @@ -423,7 +471,7 @@ public class CreateSymbols { public static PlatformInput load(LineBasedReader in) throws IOException { return new PlatformInput(in.attributes.get("version"), in.attributes.get("base"), - Arrays.asList(in.attributes.get("files").split(":"))); + List.of(in.attributes.get("files").split(":"))); } } @@ -792,7 +840,7 @@ public class CreateSymbols { private void addAttributes(MethodDescription desc, List constantPool, Map attributes) { addGenericAttributes(desc, constantPool, attributes); - if (desc.thrownTypes != null && !desc.thrownTypes.isEmpty()) { + if (desc.thrownTypes != null) { int[] exceptions = new int[desc.thrownTypes.size()]; int i = 0; for (String exc : desc.thrownTypes) { @@ -1081,175 +1129,228 @@ public class CreateSymbols { Map modules = new HashMap<>(); for (VersionDescription desc : versions) { - Map currentVersionModules = - new HashMap<>(); + List classFileData = new ArrayList<>(); + try (BufferedReader descIn = Files.newBufferedReader(Paths.get(desc.classes))) { - String classFileData; - - while ((classFileData = descIn.readLine()) != null) { + String line; + while ((line = descIn.readLine()) != null) { ByteArrayOutputStream data = new ByteArrayOutputStream(); - for (int i = 0; i < classFileData.length(); i += 2) { - String hex = classFileData.substring(i, i + 2); + for (int i = 0; i < line.length(); i += 2) { + String hex = line.substring(i, i + 2); data.write(Integer.parseInt(hex, 16)); } - try (InputStream in = - new ByteArrayInputStream(data.toByteArray())) { - inspectModuleInfoClassFile(in, - currentVersionModules, desc.version); - } catch (IOException | ConstantPoolException ex) { - throw new IllegalStateException(ex); - } + classFileData.add(data.toByteArray()); } + } catch (IOException ex) { + throw new IllegalStateException(ex); } - ExcludeIncludeList currentEIList = excludesIncludes; + loadVersionClasses(classes, modules, classFileData, excludesIncludes, desc.version); + } - if (!currentVersionModules.isEmpty()) { - Set includes = new HashSet<>(); + List platforms = + versions.stream() + .map(desc -> new PlatformInput(desc.version, + desc.primaryBaseline, + null)) + .collect(Collectors.toList()); - for (ModuleDescription md : currentVersionModules.values()) { - md.header.get(0).exports.stream().map(e -> e + '/') - .forEach(includes::add); - } + dumpDescriptions(classes, modules, platforms, descDest.resolve("symbols"), args); + } + //where: + private static final String DO_NO_MODIFY = + "#\n" + + "# Copyright (c) {YEAR}, Oracle and/or its affiliates. All rights reserved.\n" + + "# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" + + "#\n" + + "# This code is free software; you can redistribute it and/or modify it\n" + + "# under the terms of the GNU General Public License version 2 only, as\n" + + "# published by the Free Software Foundation. Oracle designates this\n" + + "# particular file as subject to the \"Classpath\" exception as provided\n" + + "# by Oracle in the LICENSE file that accompanied this code.\n" + + "#\n" + + "# This code is distributed in the hope that it will be useful, but WITHOUT\n" + + "# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" + + "# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" + + "# version 2 for more details (a copy is included in the LICENSE file that\n" + + "# accompanied this code).\n" + + "#\n" + + "# You should have received a copy of the GNU General Public License version\n" + + "# 2 along with this work; if not, write to the Free Software Foundation,\n" + + "# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" + + "#\n" + + "# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" + + "# or visit www.oracle.com if you need additional information or have any\n" + + "# questions.\n" + + "#\n" + + "# ##########################################################\n" + + "# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ###\n" + + "# ##########################################################\n" + + "#\n"; - currentEIList = new ExcludeIncludeList(includes, - Collections.emptySet()); + private void loadVersionClasses(ClassList classes, + Map modules, + Iterable classData, + ExcludeIncludeList excludesIncludes, + String version) { + Map currentVersionModules = + new HashMap<>(); + + for (byte[] classFileData : classData) { + try (InputStream in = new ByteArrayInputStream(classFileData)) { + inspectModuleInfoClassFile(in, + currentVersionModules, version); + } catch (IOException | ConstantPoolException ex) { + throw new IllegalStateException(ex); + } + } + + ExcludeIncludeList currentEIList = excludesIncludes; + + if (!currentVersionModules.isEmpty()) { + Set includes = new HashSet<>(); + + for (ModuleDescription md : currentVersionModules.values()) { + md.header.get(0).exports.stream().map(e -> e + '/') + .forEach(includes::add); } - ClassList currentVersionClasses = new ClassList(); - try (BufferedReader descIn = - Files.newBufferedReader(Paths.get(desc.classes))) { - String classFileData; + currentEIList = new ExcludeIncludeList(includes, + Collections.emptySet()); + } - while ((classFileData = descIn.readLine()) != null) { - ByteArrayOutputStream data = new ByteArrayOutputStream(); - for (int i = 0; i < classFileData.length(); i += 2) { - String hex = classFileData.substring(i, i + 2); - data.write(Integer.parseInt(hex, 16)); - } - try (InputStream in = - new ByteArrayInputStream(data.toByteArray())) { - inspectClassFile(in, currentVersionClasses, - currentEIList, desc.version); - } catch (IOException | ConstantPoolException ex) { - throw new IllegalStateException(ex); - } - } + ClassList currentVersionClasses = new ClassList(); + + for (byte[] classFileData : classData) { + try (InputStream in = new ByteArrayInputStream(classFileData)) { + inspectClassFile(in, currentVersionClasses, + currentEIList, version); + } catch (IOException | ConstantPoolException ex) { + throw new IllegalStateException(ex); } + } - ModuleDescription unsupported = - currentVersionModules.get("jdk.unsupported"); + ModuleDescription unsupported = + currentVersionModules.get("jdk.unsupported"); - if (unsupported != null) { - for (ClassDescription cd : currentVersionClasses.classes) { - if (unsupported.header - .get(0) - .exports - .contains(cd.packge().replace('.', '/'))) { - ClassHeaderDescription ch = cd.header.get(0); - if (ch.classAnnotations == null) { - ch.classAnnotations = new ArrayList<>(); - } - AnnotationDescription ad; - ad = new AnnotationDescription(PROPERITARY_ANNOTATION, - Collections.emptyMap()); - ch.classAnnotations.add(ad); + if (unsupported != null) { + for (ClassDescription cd : currentVersionClasses.classes) { + if (unsupported.header + .get(0) + .exports + .contains(cd.packge().replace('.', '/'))) { + ClassHeaderDescription ch = cd.header.get(0); + if (ch.classAnnotations == null) { + ch.classAnnotations = new ArrayList<>(); } - } - } - - Set includedClasses = new HashSet<>(); - boolean modified; - - do { - modified = false; - - for (ClassDescription clazz : currentVersionClasses) { - ClassHeaderDescription header = clazz.header.get(0); - - if (includeEffectiveAccess(currentVersionClasses, clazz)) { - modified |= include(includedClasses, currentVersionClasses, clazz.name); - } - - if (includedClasses.contains(clazz.name)) { - modified |= include(includedClasses, currentVersionClasses, header.extendsAttr); - for (String i : header.implementsAttr) { - modified |= include(includedClasses, currentVersionClasses, i); - } - - modified |= includeOutputType(Collections.singleton(header), - h -> "", - includedClasses, - currentVersionClasses); - modified |= includeOutputType(clazz.fields, - f -> f.descriptor, - includedClasses, - currentVersionClasses); - modified |= includeOutputType(clazz.methods, - m -> m.descriptor, - includedClasses, - currentVersionClasses); - } - } - } while (modified); - - for (ClassDescription clazz : currentVersionClasses) { - if (!includedClasses.contains(clazz.name)) { - continue; - } - - ClassHeaderDescription header = clazz.header.get(0); - - if (header.innerClasses != null) { - Iterator innerClassIt = header.innerClasses.iterator(); - - while(innerClassIt.hasNext()) { - InnerClassInfo ici = innerClassIt.next(); - if (!includedClasses.contains(ici.innerClass)) - innerClassIt.remove(); - } - } - - ClassDescription existing = classes.find(clazz.name, true); - - if (existing != null) { - addClassHeader(existing, header, desc.version); - for (MethodDescription currentMethod : clazz.methods) { - addMethod(existing, currentMethod, desc.version); - } - for (FieldDescription currentField : clazz.fields) { - addField(existing, currentField, desc.version); - } - } else { - classes.add(clazz); - } - } - - for (ModuleDescription module : currentVersionModules.values()) { - ModuleHeaderDescription header = module.header.get(0); - - if (header.innerClasses != null) { - Iterator innerClassIt = - header.innerClasses.iterator(); - - while(innerClassIt.hasNext()) { - InnerClassInfo ici = innerClassIt.next(); - if (!includedClasses.contains(ici.innerClass)) - innerClassIt.remove(); - } - } - - ModuleDescription existing = modules.get(module.name); - - if (existing != null) { - addModuleHeader(existing, header, desc.version); - } else { - modules.put(module.name, module); + AnnotationDescription ad; + ad = new AnnotationDescription(PROPERITARY_ANNOTATION, + Collections.emptyMap()); + ch.classAnnotations.add(ad); } } } + Set includedClasses = new HashSet<>(); + boolean modified; + + do { + modified = false; + + for (ClassDescription clazz : currentVersionClasses) { + ClassHeaderDescription header = clazz.header.get(0); + + if (includeEffectiveAccess(currentVersionClasses, clazz)) { + modified |= include(includedClasses, currentVersionClasses, clazz.name); + } + + if (includedClasses.contains(clazz.name)) { + modified |= include(includedClasses, currentVersionClasses, header.extendsAttr); + for (String i : header.implementsAttr) { + modified |= include(includedClasses, currentVersionClasses, i); + } + + modified |= includeOutputType(Collections.singleton(header), + h -> "", + includedClasses, + currentVersionClasses); + modified |= includeOutputType(clazz.fields, + f -> f.descriptor, + includedClasses, + currentVersionClasses); + modified |= includeOutputType(clazz.methods, + m -> m.descriptor, + includedClasses, + currentVersionClasses); + } + } + } while (modified); + + for (ClassDescription clazz : currentVersionClasses) { + if (!includedClasses.contains(clazz.name)) { + continue; + } + + ClassHeaderDescription header = clazz.header.get(0); + + if (header.innerClasses != null) { + Iterator innerClassIt = header.innerClasses.iterator(); + + while(innerClassIt.hasNext()) { + InnerClassInfo ici = innerClassIt.next(); + if (!includedClasses.contains(ici.innerClass)) + innerClassIt.remove(); + } + } + + ClassDescription existing = classes.find(clazz.name, true); + + if (existing != null) { + addClassHeader(existing, header, version); + for (MethodDescription currentMethod : clazz.methods) { + addMethod(existing, currentMethod, version); + } + for (FieldDescription currentField : clazz.fields) { + addField(existing, currentField, version); + } + } else { + classes.add(clazz); + } + } + + for (ModuleDescription module : currentVersionModules.values()) { + ModuleHeaderDescription header = module.header.get(0); + + if (header.innerClasses != null) { + Iterator innerClassIt = + header.innerClasses.iterator(); + + while(innerClassIt.hasNext()) { + InnerClassInfo ici = innerClassIt.next(); + if (!includedClasses.contains(ici.innerClass)) + innerClassIt.remove(); + } + } + + ModuleDescription existing = modules.get(module.name); + + if (existing != null) { + addModuleHeader(existing, header, version); + } else { + modules.put(module.name, module); + } + } + } + //where: + private static final String PROPERITARY_ANNOTATION = + "Lsun/Proprietary+Annotation;"; + + private void dumpDescriptions(ClassList classes, + Map modules, + List versions, + Path ctDescriptionFile, + String[] args) throws IOException { classes.sort(); Map package2Modules = new HashMap<>(); @@ -1298,46 +1399,52 @@ public class CreateSymbols { .filter(m -> !module2Classes.containsKey(m)) .forEach(m -> module2Classes.put(m, Collections.emptyList())); - Path symbolsFile = descDest.resolve("symbols"); + Files.createDirectories(ctDescriptionFile.getParent()); - Files.createDirectories(symbolsFile.getParent()); + int year = Calendar.getInstance(TimeZone.getTimeZone("UTF"), Locale.ROOT) + .get(Calendar.YEAR); - try (Writer symbolsOut = Files.newBufferedWriter(symbolsFile)) { - Map> outputFiles = new LinkedHashMap<>(); + try (Writer symbolsOut = Files.newBufferedWriter(ctDescriptionFile)) { + Map> outputFiles = new LinkedHashMap<>(); - for (Entry> e : module2Classes.entrySet()) { - for (VersionDescription desc : versions) { - StringWriter data = new StringWriter(); - ModuleDescription module = modules.get(e.getKey()); + for (PlatformInput desc : versions) { + List files = desc.files; - module.write(data, desc.primaryBaseline, desc.version); + if (files == null) { + files = new ArrayList<>(); + for (Entry> e : module2Classes.entrySet()) { + StringWriter data = new StringWriter(); + ModuleDescription module = modules.get(e.getKey()); - for (ClassDescription clazz : e.getValue()) { - clazz.write(data, desc.primaryBaseline, desc.version); - } + module.write(data, desc.basePlatform, desc.version); - Path f = descDest.resolve(e.getKey() + "-" + desc.version + ".sym.txt"); - - String dataString = data.toString(); - - if (!dataString.isEmpty()) { - try (Writer out = Files.newBufferedWriter(f)) { - out.append(DO_NO_MODIFY); - out.write(dataString); + for (ClassDescription clazz : e.getValue()) { + clazz.write(data, desc.basePlatform, desc.version); } - outputFiles.computeIfAbsent(desc, d -> new ArrayList<>()) - .add(f); + String fileName = e.getKey() + "-" + desc.version + ".sym.txt"; + Path f = ctDescriptionFile.getParent().resolve(fileName); + + String dataString = data.toString(); + + if (!dataString.isEmpty()) { + try (Writer out = Files.newBufferedWriter(f)) { + out.append(DO_NO_MODIFY.replace("{YEAR}", String.valueOf(year))); + out.write(dataString); + } + files.add(f.getFileName().toString()); + } } } + + outputFiles.put(desc, files); } - symbolsOut.append(DO_NO_MODIFY); + symbolsOut.append(DO_NO_MODIFY.replace("{YEAR}", "2015, " + year)); symbolsOut.append("#command used to generate this file:\n"); symbolsOut.append("#") .append(CreateSymbols.class.getName()) .append(" ") - .append(Arrays.asList(args) - .stream() + .append(Arrays.stream(args) .collect(Collectors.joining(" "))) .append("\n"); symbolsOut.append("#\n"); @@ -1347,31 +1454,102 @@ public class CreateSymbols { .sorted() .collect(Collectors.joining(":"))) .append("\n"); - for (Entry> versionFileEntry : outputFiles.entrySet()) { + for (Entry> versionFileEntry : outputFiles.entrySet()) { symbolsOut.append("platform version ") .append(versionFileEntry.getKey().version); - if (versionFileEntry.getKey().primaryBaseline != null) { + if (versionFileEntry.getKey().basePlatform != null) { symbolsOut.append(" base ") - .append(versionFileEntry.getKey().primaryBaseline); + .append(versionFileEntry.getKey().basePlatform); } symbolsOut.append(" files ") .append(versionFileEntry.getValue() .stream() - .map(p -> p.getFileName().toString()) + .map(p -> p) .sorted() .collect(Collectors.joining(":"))) .append("\n"); } } } + + public void createIncrementalBaseLine(String ctDescriptionFile, + String excludeFile, + String[] args) throws IOException { + String specVersion = System.getProperty("java.specification.version"); + String currentVersion = + Integer.toString(Integer.parseInt(specVersion), Character.MAX_RADIX); + currentVersion = currentVersion.toUpperCase(Locale.ROOT); + Path ctDescriptionPath = Paths.get(ctDescriptionFile).toAbsolutePath(); + LoadDescriptions data = load(ctDescriptionPath, currentVersion); + + ClassList classes = data.classes; + Map modules = data.modules; + List versions = data.versions; + + ExcludeIncludeList excludeList = + ExcludeIncludeList.create(excludeFile); + + Iterable classBytes = dumpCurrentClasses(); + loadVersionClasses(classes, modules, classBytes, excludeList, currentVersion); + + String baseline; + + if (versions.isEmpty()) { + baseline = null; + } else { + baseline = versions.stream() + .sorted((v1, v2) -> v2.version.compareTo(v1.version)) + .findFirst() + .get() + .version; + } + + versions.add(new PlatformInput(currentVersion, baseline, null)); + dumpDescriptions(classes, modules, versions, ctDescriptionPath, args); + } + + private List dumpCurrentClasses() throws IOException { + JavacTool tool = JavacTool.create(); + Context ctx = new Context(); + String version = System.getProperty("java.specification.version"); + JavacTask task = tool.getTask(null, null, null, + List.of("--release", version), + null, null, ctx); + task.getElements().getTypeElement("java.lang.Object"); + JavaFileManager fm = ctx.get(JavaFileManager.class); + + List data = new ArrayList<>(); + for (Location modLoc : LOCATIONS) { + for (Set module : + fm.listLocationsForModules(modLoc)) { + for (JavaFileManager.Location loc : module) { + Iterable files = + fm.list(loc, + "", + EnumSet.of(Kind.CLASS), + true); + + for (JavaFileObject jfo : files) { + try (InputStream is = jfo.openInputStream(); + InputStream in = + new BufferedInputStream(is)) { + ByteArrayOutputStream baos = + new ByteArrayOutputStream(); + + in.transferTo(baos); + data.add(baos.toByteArray()); + } + } + } + } + } + + return data; + } //where: - private static final String DO_NO_MODIFY = - "# ##########################################################\n" + - "# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ###\n" + - "# ##########################################################\n" + - "#\n"; - private static final String PROPERITARY_ANNOTATION = - "Lsun/Proprietary+Annotation;"; + private static final List LOCATIONS = + List.of(StandardLocation.SYSTEM_MODULES, + StandardLocation.UPGRADE_MODULE_PATH); // //non-final for tests: @@ -2006,11 +2184,11 @@ public class CreateSymbols { signature = reader.attributes.get("signature"); String inClassAnnotations = reader.attributes.get("classAnnotations"); if (inClassAnnotations != null) { - classAnnotations = parseAnnotations(unquote(inClassAnnotations), new int[1]); + classAnnotations = parseAnnotations(inClassAnnotations, new int[1]); } String inRuntimeAnnotations = reader.attributes.get("runtimeAnnotations"); if (inRuntimeAnnotations != null) { - runtimeAnnotations = parseAnnotations(unquote(inRuntimeAnnotations), new int[1]); + runtimeAnnotations = parseAnnotations(inRuntimeAnnotations, new int[1]); } } @@ -2115,6 +2293,7 @@ public class CreateSymbols { ModuleHeaderDescription mhd = new ModuleHeaderDescription(); mhd.read(reader); + mhd.name = name; mhd.versions = version; header.add(mhd); break; @@ -2695,7 +2874,11 @@ public class CreateSymbols { name = reader.attributes.get("name"); descriptor = reader.attributes.get("descriptor"); - thrownTypes = deserializeList(reader.attributes.get("thrownTypes")); + String thrownTypesValue = reader.attributes.get("thrownTypes"); + + if (thrownTypesValue != null) { + thrownTypes = deserializeList(thrownTypesValue); + } String inAnnotationDefaultValue = reader.attributes.get("annotationDefaultValue"); @@ -2803,9 +2986,9 @@ public class CreateSymbols { if (inConstantValue != null) { switch (descriptor) { case "Z": constantValue = "true".equals(inConstantValue); break; - case "B": constantValue = Byte.parseByte(inConstantValue); break; + case "B": constantValue = Integer.parseInt(inConstantValue); break; case "C": constantValue = inConstantValue.charAt(0); break; - case "S": constantValue = Short.parseShort(inConstantValue); break; + case "S": constantValue = Integer.parseInt(inConstantValue); break; case "I": constantValue = Integer.parseInt(inConstantValue); break; case "J": constantValue = Long.parseLong(inConstantValue); break; case "F": constantValue = Float.parseFloat(inConstantValue); break; @@ -3141,7 +3324,7 @@ public class CreateSymbols { serialized = unquote ? unquote(serialized) : serialized; if (serialized == null) return new ArrayList<>(); - return new ArrayList<>(Arrays.asList(serialized.split(","))); + return new ArrayList<>(List.of(serialized.split(","))); } private static String quote(String value, boolean quoteQuotes) { @@ -3291,7 +3474,7 @@ public class CreateSymbols { } switch (args[0]) { - case "build-description": + case "build-description": { if (args.length < 3) { help(); return ; @@ -3332,6 +3515,16 @@ public class CreateSymbols { descDest, args); break; + } + case "build-description-incremental": { + if (args.length != 3) { + help(); + return ; + } + + new CreateSymbols().createIncrementalBaseLine(args[1], args[2], args); + break; + } case "build-ctsym": if (args.length != 3) { help(); diff --git a/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java b/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java index 3734204d7b9..e197bea7fc9 100644 --- a/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java +++ b/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -26,56 +26,67 @@ package build.tools.symbolgenerator; import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayDeque; import java.util.Arrays; +import java.util.Deque; import java.util.HashSet; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.stream.Collectors; import javax.lang.model.element.ModuleElement.RequiresDirective; import javax.lang.model.util.Elements; import javax.tools.JavaCompiler; -import javax.tools.ToolProvider; import com.sun.tools.javac.api.JavacTaskImpl; import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Symbol.ModuleSymbol; +import com.sun.tools.javac.jvm.Target; /** - * Print reflexive transitive closure of the given modules along their requires transitive edges. + * Write reflexive transitive closure of the given modules along their requires transitive edges into + * file /system-modules in the specified directory. */ public class TransitiveDependencies { private static void help() { - System.err.println("java TransitiveDependencies "); + System.err.println("java TransitiveDependencies "); } public static void main(String... args) throws IOException { - if (args.length < 1) { + if (args.length < 2) { help(); return ; } JavaCompiler compiler = JavacTool.create(); - List options = Arrays.asList("-source", "10", - "-target", "10", - "-proc:only", - "--system", "none", - "--module-source-path", args[0], - "--add-modules", Arrays.stream(args) - .skip(1) - .collect(Collectors.joining(","))); - List jlObjectList = Arrays.asList("java.lang.Object"); + List options = List.of("-source", Source.DEFAULT.name, + "-target", Target.DEFAULT.name, + "-proc:only", + "--system", "none", + "--module-source-path", args[1], + "--add-modules", Arrays.stream(args) + .skip(2) + .collect(Collectors.joining(","))); + List jlObjectList = List.of("java.lang.Object"); JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, options, jlObjectList, null); task.enter(); Elements elements = task.getElements(); - List todo = new LinkedList<>(); - Arrays.stream(args).skip(1).forEach(todo::add); + Deque todo = new ArrayDeque<>(); + Arrays.stream(args).skip(2).forEach(todo::add); Set allModules = new HashSet<>(); while (!todo.isEmpty()) { - String current = todo.remove(0); + String current = todo.removeFirst(); if (!allModules.add(current)) continue; @@ -89,7 +100,7 @@ public class TransitiveDependencies { //use the internal structure to avoid unnecesarily completing the symbol using the UsesProvidesVisitor: for (RequiresDirective rd : mod.requires) { if (rd.isTransitive()) { - todo.add(rd.getDependency().getQualifiedName().toString()); + todo.offerLast(rd.getDependency().getQualifiedName().toString()); } } } @@ -97,9 +108,20 @@ public class TransitiveDependencies { allModules.add("java.base"); allModules.add("jdk.unsupported"); - allModules.stream() - .sorted() - .forEach(System.out::println); + String version = + Integer.toString(Integer.parseInt(Source.DEFAULT.name), Character.MAX_RADIX); + version = version.toUpperCase(Locale.ROOT); + + Path targetFile = Paths.get(args[0]).resolve(version).resolve("system-modules"); + + Files.createDirectories(targetFile.getParent()); + + try (Writer w = Files.newBufferedWriter(targetFile); + PrintWriter out = new PrintWriter(w)) { + allModules.stream() + .sorted() + .forEach(out::println); + } } } diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk index 1c4150f7d70..62cca6a433c 100644 --- a/make/test/JtregNativeHotspot.gmk +++ b/make/test/JtregNativeHotspot.gmk @@ -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 diff --git a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp index 21ec91db4e5..38ca8938fc4 100644 --- a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp @@ -259,6 +259,8 @@ void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorator bool on_reference = on_weak || on_phantom; ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread); if (on_oop && on_reference) { + // LR is live. It must be saved around calls. + __ enter(); // barrier may call runtime // Generate the G1 pre-barrier code to log the value of // the referent field in an SATB buffer. g1_write_barrier_pre(masm /* masm */, @@ -268,6 +270,7 @@ void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorator tmp1 /* tmp */, true /* tosca_live */, true /* expand_call */); + __ leave(); } } diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp index 007f5250828..22fcc655571 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp @@ -30,6 +30,9 @@ void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register dst, Address src, Register tmp1, Register tmp_thread) { + + // LR is live. It must be saved around calls. + bool on_heap = (decorators & IN_HEAP) != 0; bool on_root = (decorators & IN_ROOT) != 0; switch (type) { diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index ca594d3db54..cb382edbf85 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -918,6 +918,8 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) { // rmethod: Method* // r13: senderSP must preserve for slow path, set SP to it on fast path + // LR is live. It must be saved around calls. + address entry = __ pc(); const int referent_offset = java_lang_ref_Reference::referent_offset; diff --git a/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp b/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp index 57bc7be205d..917b19cf009 100644 --- a/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp +++ b/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp @@ -236,12 +236,12 @@ void C1_MacroAssembler::restore_live_registers(bool restore_fpu_registers) { #define __ sasm-> static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = true) { - sasm->save_live_registers_no_oop_map(save_fpu_registers); + __ save_live_registers_no_oop_map(save_fpu_registers); return generate_oop_map(sasm, save_fpu_registers); } static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) { - sasm->restore_live_registers(restore_fpu_registers); + __ restore_live_registers(restore_fpu_registers); } diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp index 98bfe88491b..e3254b456fb 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp @@ -123,7 +123,8 @@ void load_parameter(int offset_in_words, Register reg); - void save_live_registers_no_oop_map(int num_rt_args, bool save_fpu_registers); + void save_live_registers_no_oop_map(bool save_fpu_registers); + void restore_live_registers_except_rax(bool restore_fpu_registers); void restore_live_registers(bool restore_fpu_registers); #endif // CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp index 9740ef99ffd..e9c6bcdd58f 100644 --- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp +++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp @@ -411,7 +411,7 @@ static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args, #define __ this-> -void C1_MacroAssembler::save_live_registers_no_oop_map(int num_rt_args, bool save_fpu_registers) { +void C1_MacroAssembler::save_live_registers_no_oop_map(bool save_fpu_registers) { __ block_comment("save_live_registers"); __ pusha(); // integer registers @@ -551,23 +551,11 @@ void C1_MacroAssembler::restore_live_registers(bool restore_fpu_registers) { __ popa(); } -#undef __ -#define __ sasm-> -static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args, - bool save_fpu_registers = true) { - sasm->save_live_registers_no_oop_map(num_rt_args, save_fpu_registers); - return generate_oop_map(sasm, num_rt_args, save_fpu_registers); -} - -static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) { - sasm->restore_live_registers(restore_fpu_registers); -} - -static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_fpu_registers = true) { +void C1_MacroAssembler::restore_live_registers_except_rax(bool restore_fpu_registers) { __ block_comment("restore_live_registers_except_rax"); - restore_fpu(sasm, restore_fpu_registers); + restore_fpu(this, restore_fpu_registers); #ifdef _LP64 __ movptr(r15, Address(rsp, 0)); @@ -600,6 +588,23 @@ static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_ #endif // _LP64 } +#undef __ +#define __ sasm-> + +static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args, + bool save_fpu_registers = true) { + __ save_live_registers_no_oop_map(save_fpu_registers); + return generate_oop_map(sasm, num_rt_args, save_fpu_registers); +} + +static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) { + __ restore_live_registers(restore_fpu_registers); +} + +static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_fpu_registers = true) { + sasm->restore_live_registers_except_rax(restore_fpu_registers); +} + void Runtime1::initialize_pd() { // nothing to do diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index 1d63e8ec0f8..f4082dbc6d8 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -496,7 +496,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* __ bind(runtime); - __ save_live_registers_no_oop_map(3, true); + __ save_live_registers_no_oop_map(true); // load the pre-value __ load_parameter(0, rcx); @@ -575,7 +575,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* __ bind(runtime); - __ save_live_registers_no_oop_map(3, true); + __ save_live_registers_no_oop_map(true); __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index a922568bc31..1f9d43761a6 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1459,6 +1459,7 @@ void os::print_memory_info(outputStream* st) { const char* const aixthread_guardpages = ::getenv("AIXTHREAD_GUARDPAGES"); st->print_cr(" AIXTHREAD_GUARDPAGES=%s.", aixthread_guardpages ? aixthread_guardpages : ""); + st->cr(); os::Aix::meminfo_t mi; if (os::Aix::get_meminfo(&mi)) { @@ -1481,6 +1482,16 @@ void os::print_memory_info(outputStream* st) { } st->cr(); + // Print program break. + st->print_cr("Program break at VM startup: " PTR_FORMAT ".", p2i(g_brk_at_startup)); + address brk_now = (address)::sbrk(0); + if (brk_now != (address)-1) { + st->print_cr("Program break now : " PTR_FORMAT " (distance: " SIZE_FORMAT "k).", + p2i(brk_now), (size_t)((brk_now - g_brk_at_startup) / K)); + } + st->print_cr("MaxExpectedDataSegmentSize : " SIZE_FORMAT "k.", MaxExpectedDataSegmentSize / K); + st->cr(); + // Print segments allocated with os::reserve_memory. st->print_cr("internal virtual memory regions used by vm:"); vmembk_print_on(st); diff --git a/src/hotspot/os_cpu/aix_ppc/atomic_aix_ppc.hpp b/src/hotspot/os_cpu/aix_ppc/atomic_aix_ppc.hpp index ec124e8e2a6..a5afdd2b689 100644 --- a/src/hotspot/os_cpu/aix_ppc/atomic_aix_ppc.hpp +++ b/src/hotspot/os_cpu/aix_ppc/atomic_aix_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 SAP SE. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ #ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP #define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP -#ifndef _LP64 -#error "Atomic currently only impleneted for PPC64" +#ifndef PPC64 +#error "Atomic currently only implemented for PPC64" #endif #include "utilities/debug.hpp" @@ -35,39 +35,39 @@ // Implementation of class atomic // -// machine barrier instructions: +// machine barrier instructions: // -// - ppc_sync two-way memory barrier, aka fence -// - ppc_lwsync orders Store|Store, -// Load|Store, -// Load|Load, -// but not Store|Load -// - ppc_eieio orders memory accesses for device memory (only) -// - ppc_isync invalidates speculatively executed instructions -// From the POWER ISA 2.06 documentation: -// "[...] an isync instruction prevents the execution of -// instructions following the isync until instructions -// preceding the isync have completed, [...]" -// From IBM's AIX assembler reference: -// "The isync [...] instructions causes the processor to -// refetch any instructions that might have been fetched -// prior to the isync instruction. The instruction isync -// causes the processor to wait for all previous instructions -// to complete. Then any instructions already fetched are -// discarded and instruction processing continues in the -// environment established by the previous instructions." +// - sync two-way memory barrier, aka fence +// - lwsync orders Store|Store, +// Load|Store, +// Load|Load, +// but not Store|Load +// - eieio orders memory accesses for device memory (only) +// - isync invalidates speculatively executed instructions +// From the POWER ISA 2.06 documentation: +// "[...] an isync instruction prevents the execution of +// instructions following the isync until instructions +// preceding the isync have completed, [...]" +// From IBM's AIX assembler reference: +// "The isync [...] instructions causes the processor to +// refetch any instructions that might have been fetched +// prior to the isync instruction. The instruction isync +// causes the processor to wait for all previous instructions +// to complete. Then any instructions already fetched are +// discarded and instruction processing continues in the +// environment established by the previous instructions." // -// semantic barrier instructions: -// (as defined in orderAccess.hpp) +// semantic barrier instructions: +// (as defined in orderAccess.hpp) // -// - ppc_release orders Store|Store, (maps to ppc_lwsync) -// Load|Store -// - ppc_acquire orders Load|Store, (maps to ppc_lwsync) -// Load|Load -// - ppc_fence orders Store|Store, (maps to ppc_sync) -// Load|Store, -// Load|Load, -// Store|Load +// - release orders Store|Store, (maps to lwsync) +// Load|Store +// - acquire orders Load|Store, (maps to lwsync) +// Load|Load +// - fence orders Store|Store, (maps to sync) +// Load|Store, +// Load|Load, +// Store|Load // #define strasm_sync "\n sync \n" @@ -79,80 +79,105 @@ #define strasm_nobarrier "" #define strasm_nobarrier_clobber_memory "" +inline void pre_membar(atomic_memory_order order) { + switch (order) { + case memory_order_relaxed: + case memory_order_acquire: break; + case memory_order_release: + case memory_order_acq_rel: __asm__ __volatile__ (strasm_lwsync); break; + default /*conservative*/ : __asm__ __volatile__ (strasm_sync); break; + } +} + +inline void post_membar(atomic_memory_order order) { + switch (order) { + case memory_order_relaxed: + case memory_order_release: break; + case memory_order_acquire: + case memory_order_acq_rel: __asm__ __volatile__ (strasm_isync); break; + default /*conservative*/ : __asm__ __volatile__ (strasm_sync); break; + } +} + + template struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); D result; + pre_membar(order); + __asm__ __volatile__ ( - strasm_lwsync "1: lwarx %0, 0, %2 \n" " add %0, %0, %1 \n" " stwcx. %0, 0, %2 \n" " bne- 1b \n" - strasm_isync : /*%0*/"=&r" (result) : /*%1*/"r" (add_value), /*%2*/"r" (dest) : "cc", "memory" ); + post_membar(order); + return result; } template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); D result; + pre_membar(order); + __asm__ __volatile__ ( - strasm_lwsync "1: ldarx %0, 0, %2 \n" " add %0, %0, %1 \n" " stdcx. %0, 0, %2 \n" " bne- 1b \n" - strasm_isync : /*%0*/"=&r" (result) : /*%1*/"r" (add_value), /*%2*/"r" (dest) : "cc", "memory" ); + post_membar(order); + return result; } template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { - STATIC_ASSERT(4 == sizeof(T)); + T volatile* dest, + atomic_memory_order order) const { // Note that xchg doesn't necessarily do an acquire // (see synchronizer.cpp). T old_value; const uint64_t zero = 0; + pre_membar(order); + __asm__ __volatile__ ( - /* lwsync */ - strasm_lwsync /* atomic loop */ "1: \n" " lwarx %[old_value], %[dest], %[zero] \n" " stwcx. %[exchange_value], %[dest], %[zero] \n" " bne- 1b \n" - /* isync */ - strasm_sync /* exit */ "2: \n" /* out */ @@ -168,13 +193,16 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, "memory" ); + post_membar(order); + return old_value; } template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); // Note that xchg doesn't necessarily do an acquire // (see synchronizer.cpp). @@ -182,16 +210,14 @@ inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, T old_value; const uint64_t zero = 0; + pre_membar(order); + __asm__ __volatile__ ( - /* lwsync */ - strasm_lwsync /* atomic loop */ "1: \n" " ldarx %[old_value], %[dest], %[zero] \n" " stdcx. %[exchange_value], %[dest], %[zero] \n" " bne- 1b \n" - /* isync */ - strasm_sync /* exit */ "2: \n" /* out */ @@ -207,33 +233,17 @@ inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, "memory" ); + post_membar(order); + return old_value; } -inline void cmpxchg_pre_membar(cmpxchg_memory_order order) { - if (order != memory_order_relaxed) { - __asm__ __volatile__ ( - /* fence */ - strasm_sync - ); - } -} - -inline void cmpxchg_post_membar(cmpxchg_memory_order order) { - if (order != memory_order_relaxed) { - __asm__ __volatile__ ( - /* fence */ - strasm_sync - ); - } -} - template<> template inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(1 == sizeof(T)); // Note that cmpxchg guarantees a two-way memory barrier across @@ -254,7 +264,7 @@ inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, unsigned int old_value, value32; - cmpxchg_pre_membar(order); + pre_membar(order); __asm__ __volatile__ ( /* simple guard */ @@ -293,7 +303,7 @@ inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, "memory" ); - cmpxchg_post_membar(order); + post_membar(order); return PrimitiveConversions::cast((unsigned char)old_value); } @@ -303,7 +313,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); // Note that cmpxchg guarantees a two-way memory barrier across @@ -313,7 +323,7 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T old_value; const uint64_t zero = 0; - cmpxchg_pre_membar(order); + pre_membar(order); __asm__ __volatile__ ( /* simple guard */ @@ -343,7 +353,7 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, "memory" ); - cmpxchg_post_membar(order); + post_membar(order); return old_value; } @@ -353,7 +363,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); // Note that cmpxchg guarantees a two-way memory barrier across @@ -363,7 +373,7 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T old_value; const uint64_t zero = 0; - cmpxchg_pre_membar(order); + pre_membar(order); __asm__ __volatile__ ( /* simple guard */ @@ -393,7 +403,7 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, "memory" ); - cmpxchg_post_membar(order); + post_membar(order); return old_value; } diff --git a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp index 40021fa9a65..9e8302b9f2d 100644 --- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp +++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -32,12 +32,13 @@ struct Atomic::PlatformAdd : Atomic::FetchAndAdd > { template - D fetch_and_add(I add_value, D volatile* dest) const; + D fetch_and_add(I add_value, D volatile* dest, atomic_memory_order /* order */) const; }; template<> template -inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest, + atomic_memory_order /* order */) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); D old_value; @@ -51,7 +52,8 @@ inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order /* order */) const { STATIC_ASSERT(4 == sizeof(T)); __asm__ volatile ( "xchgl (%2),%0" : "=r" (exchange_value) @@ -65,7 +67,7 @@ template inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order /* order */) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(1 == sizeof(T)); __asm__ volatile ( "lock cmpxchgb %1,(%3)" : "=a" (exchange_value) @@ -79,7 +81,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order /* order */) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(4 == sizeof(T)); __asm__ volatile ( "lock cmpxchgl %1,(%3)" : "=a" (exchange_value) @@ -91,7 +93,8 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, #ifdef AMD64 template<> template -inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest, + atomic_memory_order /* order */) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); D old_value; @@ -105,7 +108,8 @@ inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order /* order */) const { STATIC_ASSERT(8 == sizeof(T)); __asm__ __volatile__ ("xchgq (%2),%0" : "=r" (exchange_value) @@ -119,7 +123,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order /* order */) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(8 == sizeof(T)); __asm__ __volatile__ ( "lock cmpxchgq %1,(%3)" : "=a" (exchange_value) @@ -141,7 +145,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(8 == sizeof(T)); return cmpxchg_using_helper(_Atomic_cmpxchg_long, exchange_value, dest, compare_value); } diff --git a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp index 82027fa3188..c699918f2f8 100644 --- a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp +++ b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -164,12 +164,13 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); @@ -186,7 +187,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); @@ -196,7 +198,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM return xchg_using_helper(arm_lock_test_and_set, exchange_value, dest); @@ -222,7 +225,8 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T result = __sync_lock_test_and_set (dest, exchange_value); __sync_synchronize(); @@ -238,7 +242,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM return cmpxchg_using_helper(arm_compare_and_swap, exchange_value, dest, compare_value); @@ -256,7 +260,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return __sync_val_compare_and_swap(dest, compare_value, exchange_value); } diff --git a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp index e4076609924..e1f59bb43e5 100644 --- a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp +++ b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,7 +39,7 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const { + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const { return __sync_add_and_fetch(dest, add_value); } }; @@ -47,7 +47,8 @@ struct Atomic::PlatformAdd template template inline T Atomic::PlatformXchg::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(byte_size == sizeof(T)); T res = __sync_lock_test_and_set(dest, exchange_value); FULL_MEM_BARRIER; @@ -59,7 +60,7 @@ template inline T Atomic::PlatformCmpxchg::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(byte_size == sizeof(T)); if (order == memory_order_relaxed) { T value = compare_value; diff --git a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp index 0e675007c0f..90441901327 100644 --- a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp +++ b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,12 +81,13 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); #ifdef AARCH64 @@ -110,7 +111,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co #ifdef AARCH64 template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); D val; @@ -131,7 +133,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef AARCH64 T old_val; @@ -154,7 +157,8 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T old_val; int tmp; @@ -200,7 +204,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef AARCH64 T rv; @@ -230,7 +234,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); #ifdef AARCH64 T rv; diff --git a/src/hotspot/os_cpu/linux_ppc/atomic_linux_ppc.hpp b/src/hotspot/os_cpu/linux_ppc/atomic_linux_ppc.hpp index 764243960cc..2d008a1ff6d 100644 --- a/src/hotspot/os_cpu/linux_ppc/atomic_linux_ppc.hpp +++ b/src/hotspot/os_cpu/linux_ppc/atomic_linux_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 SAP SE. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018 SAP SE. 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 @@ -77,79 +77,105 @@ #define strasm_nobarrier "" #define strasm_nobarrier_clobber_memory "" +inline void pre_membar(atomic_memory_order order) { + switch (order) { + case memory_order_relaxed: + case memory_order_acquire: break; + case memory_order_release: + case memory_order_acq_rel: __asm__ __volatile__ (strasm_lwsync); break; + default /*conservative*/ : __asm__ __volatile__ (strasm_sync); break; + } +} + +inline void post_membar(atomic_memory_order order) { + switch (order) { + case memory_order_relaxed: + case memory_order_release: break; + case memory_order_acquire: + case memory_order_acq_rel: __asm__ __volatile__ (strasm_isync); break; + default /*conservative*/ : __asm__ __volatile__ (strasm_sync); break; + } +} + + template struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); D result; + pre_membar(order); + __asm__ __volatile__ ( - strasm_lwsync "1: lwarx %0, 0, %2 \n" " add %0, %0, %1 \n" " stwcx. %0, 0, %2 \n" " bne- 1b \n" - strasm_isync : /*%0*/"=&r" (result) : /*%1*/"r" (add_value), /*%2*/"r" (dest) : "cc", "memory" ); + post_membar(order); + return result; } template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); D result; + pre_membar(order); + __asm__ __volatile__ ( - strasm_lwsync "1: ldarx %0, 0, %2 \n" " add %0, %0, %1 \n" " stdcx. %0, 0, %2 \n" " bne- 1b \n" - strasm_isync : /*%0*/"=&r" (result) : /*%1*/"r" (add_value), /*%2*/"r" (dest) : "cc", "memory" ); + post_membar(order); + return result; } template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { // Note that xchg doesn't necessarily do an acquire // (see synchronizer.cpp). T old_value; const uint64_t zero = 0; + pre_membar(order); + __asm__ __volatile__ ( - /* lwsync */ - strasm_lwsync /* atomic loop */ "1: \n" " lwarx %[old_value], %[dest], %[zero] \n" " stwcx. %[exchange_value], %[dest], %[zero] \n" " bne- 1b \n" - /* isync */ - strasm_sync /* exit */ "2: \n" /* out */ @@ -165,13 +191,16 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, "memory" ); + post_membar(order); + return old_value; } template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); // Note that xchg doesn't necessarily do an acquire // (see synchronizer.cpp). @@ -179,16 +208,14 @@ inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, T old_value; const uint64_t zero = 0; + pre_membar(order); + __asm__ __volatile__ ( - /* lwsync */ - strasm_lwsync /* atomic loop */ "1: \n" " ldarx %[old_value], %[dest], %[zero] \n" " stdcx. %[exchange_value], %[dest], %[zero] \n" " bne- 1b \n" - /* isync */ - strasm_sync /* exit */ "2: \n" /* out */ @@ -204,33 +231,17 @@ inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, "memory" ); + post_membar(order); + return old_value; } -inline void cmpxchg_pre_membar(cmpxchg_memory_order order) { - if (order != memory_order_relaxed) { - __asm__ __volatile__ ( - /* fence */ - strasm_sync - ); - } -} - -inline void cmpxchg_post_membar(cmpxchg_memory_order order) { - if (order != memory_order_relaxed) { - __asm__ __volatile__ ( - /* fence */ - strasm_sync - ); - } -} - template<> template inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(1 == sizeof(T)); // Note that cmpxchg guarantees a two-way memory barrier across @@ -251,7 +262,7 @@ inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, unsigned int old_value, value32; - cmpxchg_pre_membar(order); + pre_membar(order); __asm__ __volatile__ ( /* simple guard */ @@ -290,7 +301,7 @@ inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, "memory" ); - cmpxchg_post_membar(order); + post_membar(order); return PrimitiveConversions::cast((unsigned char)old_value); } @@ -300,7 +311,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); // Note that cmpxchg guarantees a two-way memory barrier across @@ -310,7 +321,7 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T old_value; const uint64_t zero = 0; - cmpxchg_pre_membar(order); + pre_membar(order); __asm__ __volatile__ ( /* simple guard */ @@ -340,7 +351,7 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, "memory" ); - cmpxchg_post_membar(order); + post_membar(order); return old_value; } @@ -350,7 +361,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); // Note that cmpxchg guarantees a two-way memory barrier across @@ -360,7 +371,7 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T old_value; const uint64_t zero = 0; - cmpxchg_pre_membar(order); + pre_membar(order); __asm__ __volatile__ ( /* simple guard */ @@ -390,7 +401,7 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, "memory" ); - cmpxchg_post_membar(order); + post_membar(order); return old_value; } diff --git a/src/hotspot/os_cpu/linux_s390/atomic_linux_s390.hpp b/src/hotspot/os_cpu/linux_s390/atomic_linux_s390.hpp index 5821bb018c3..8462f4b6da0 100644 --- a/src/hotspot/os_cpu/linux_s390/atomic_linux_s390.hpp +++ b/src/hotspot/os_cpu/linux_s390/atomic_linux_s390.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018 SAP SE. 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 @@ -68,23 +68,31 @@ // The return value of the method is the value that was successfully stored. At the // time the caller receives back control, the value in memory may have changed already. +// New atomic operations only include specific-operand-serialization, not full +// memory barriers. We can use the Fast-BCR-Serialization Facility for them. +inline void z196_fast_sync() { + __asm__ __volatile__ ("bcr 14, 0" : : : "memory"); +} + template struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I inc, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I inc, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); D old, upd; if (VM_Version::has_LoadAndALUAtomicV1()) { + if (order == memory_order_conservative) { z196_fast_sync(); } __asm__ __volatile__ ( " LGFR 0,%[inc] \n\t" // save increment " LA 3,%[mem] \n\t" // force data address into ARG2 @@ -106,6 +114,7 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I inc, D volatile* dest) const { //---< clobbered >--- : "cc", "r0", "r2", "r3", "memory" ); + if (order == memory_order_conservative) { z196_fast_sync(); } } else { __asm__ __volatile__ ( " LLGF %[old],%[mem] \n\t" // get old value @@ -129,13 +138,15 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I inc, D volatile* dest) const { template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I inc, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I inc, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); D old, upd; if (VM_Version::has_LoadAndALUAtomicV1()) { + if (order == memory_order_conservative) { z196_fast_sync(); } __asm__ __volatile__ ( " LGR 0,%[inc] \n\t" // save increment " LA 3,%[mem] \n\t" // force data address into ARG2 @@ -157,6 +168,7 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I inc, D volatile* dest) const { //---< clobbered >--- : "cc", "r0", "r2", "r3", "memory" ); + if (order == memory_order_conservative) { z196_fast_sync(); } } else { __asm__ __volatile__ ( " LG %[old],%[mem] \n\t" // get old value @@ -197,7 +209,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I inc, D volatile* dest) const { template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order unused) const { STATIC_ASSERT(4 == sizeof(T)); T old; @@ -220,7 +233,8 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order unused) const { STATIC_ASSERT(8 == sizeof(T)); T old; @@ -278,7 +292,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T xchg_val, T volatile* dest, T cmp_val, - cmpxchg_memory_order unused) const { + atomic_memory_order unused) const { STATIC_ASSERT(4 == sizeof(T)); T old; @@ -302,7 +316,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T xchg_val, T volatile* dest, T cmp_val, - cmpxchg_memory_order unused) const { + atomic_memory_order unused) const { STATIC_ASSERT(8 == sizeof(T)); T old; diff --git a/src/hotspot/os_cpu/linux_sparc/atomic_linux_sparc.hpp b/src/hotspot/os_cpu/linux_sparc/atomic_linux_sparc.hpp index 46a1268347a..f572d1b10a2 100644 --- a/src/hotspot/os_cpu/linux_sparc/atomic_linux_sparc.hpp +++ b/src/hotspot/os_cpu/linux_sparc/atomic_linux_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -32,12 +32,13 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); @@ -59,7 +60,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); @@ -82,7 +84,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); T rv = exchange_value; __asm__ volatile( @@ -96,7 +99,8 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T rv = exchange_value; __asm__ volatile( @@ -123,7 +127,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); T rv; __asm__ volatile( @@ -139,7 +143,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T rv; __asm__ volatile( diff --git a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp index 882ec3a5a9e..f4f8d9898c1 100644 --- a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp +++ b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -32,12 +32,13 @@ struct Atomic::PlatformAdd : Atomic::FetchAndAdd > { template - D fetch_and_add(I add_value, D volatile* dest) const; + D fetch_and_add(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); D old_value; @@ -51,7 +52,8 @@ inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); __asm__ volatile ( "xchgl (%2),%0" : "=r" (exchange_value) @@ -65,7 +67,7 @@ template inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order /* order */) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(1 == sizeof(T)); __asm__ volatile ("lock cmpxchgb %1,(%3)" : "=a" (exchange_value) @@ -79,7 +81,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order /* order */) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(4 == sizeof(T)); __asm__ volatile ("lock cmpxchgl %1,(%3)" : "=a" (exchange_value) @@ -92,7 +94,8 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, template<> template -inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); D old_value; @@ -105,8 +108,8 @@ inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest) co template<> template -inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { +inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); __asm__ __volatile__ ("xchgq (%2),%0" : "=r" (exchange_value) @@ -120,7 +123,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order /* order */) const { + atomic_memory_order /* order */) const { STATIC_ASSERT(8 == sizeof(T)); __asm__ __volatile__ ("lock cmpxchgq %1,(%3)" : "=a" (exchange_value) @@ -142,7 +145,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return cmpxchg_using_helper(_Atomic_cmpxchg_long, exchange_value, dest, compare_value); } diff --git a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp index 8a088d6444e..2ab748c9785 100644 --- a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp +++ b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,12 +35,13 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); @@ -49,7 +50,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); return __sync_add_and_fetch(dest, add_value); @@ -58,7 +60,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); // __sync_lock_test_and_set is a bizarrely named atomic exchange // operation. Note that some platforms only support this with the @@ -76,7 +79,8 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T result = __sync_lock_test_and_set (dest, exchange_value); __sync_synchronize(); @@ -92,7 +96,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); return __sync_val_compare_and_swap(dest, compare_value, exchange_value); } @@ -102,7 +106,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return __sync_val_compare_and_swap(dest, compare_value, exchange_value); } diff --git a/src/hotspot/os_cpu/solaris_sparc/atomic_solaris_sparc.hpp b/src/hotspot/os_cpu/solaris_sparc/atomic_solaris_sparc.hpp index 6a96abe835f..0ca8811771a 100644 --- a/src/hotspot/os_cpu/solaris_sparc/atomic_solaris_sparc.hpp +++ b/src/hotspot/os_cpu/solaris_sparc/atomic_solaris_sparc.hpp @@ -31,7 +31,7 @@ template struct Atomic::PlatformAdd { template - inline D operator()(I add_value, D volatile* dest) const { + inline D operator()(I add_value, D volatile* dest, atomic_memory_order order) const { D old_value = *dest; while (true) { D new_value = old_value + add_value; @@ -46,7 +46,8 @@ struct Atomic::PlatformAdd { template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); __asm__ volatile ( "swap [%2],%0" : "=r" (exchange_value) @@ -58,7 +59,8 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T old_value = *dest; while (true) { @@ -78,7 +80,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); T rv; __asm__ volatile( @@ -94,7 +96,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T rv; __asm__ volatile( diff --git a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp index 7844a146a32..ebb0d8325cc 100644 --- a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp +++ b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -45,13 +45,14 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; // Not using add_using_helper; see comment for cmpxchg. template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); return PrimitiveConversions::cast( @@ -62,7 +63,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co // Not using add_using_helper; see comment for cmpxchg. template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); return PrimitiveConversions::cast( @@ -73,7 +75,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); return PrimitiveConversions::cast( _Atomic_xchg(PrimitiveConversions::cast(exchange_value), @@ -85,7 +88,8 @@ extern "C" int64_t _Atomic_xchg_long(int64_t exchange_value, volatile int64_t* d template<> template inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return PrimitiveConversions::cast( _Atomic_xchg_long(PrimitiveConversions::cast(exchange_value), @@ -103,7 +107,7 @@ template inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(1 == sizeof(T)); return PrimitiveConversions::cast( _Atomic_cmpxchg_byte(PrimitiveConversions::cast(exchange_value), @@ -116,7 +120,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); return PrimitiveConversions::cast( _Atomic_cmpxchg(PrimitiveConversions::cast(exchange_value), @@ -129,7 +133,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return PrimitiveConversions::cast( _Atomic_cmpxchg_long(PrimitiveConversions::cast(exchange_value), diff --git a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp index 293e051ffcf..7872c9b6fd4 100644 --- a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -47,19 +47,21 @@ struct Atomic::PlatformAdd : Atomic::AddAndFetch > { template - D add_and_fetch(I add_value, D volatile* dest) const; + D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; #ifdef AMD64 template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { return add_using_helper(os::atomic_add_func, add_value, dest); } template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { return add_using_helper(os::atomic_add_long_func, add_value, dest); } @@ -67,7 +69,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co template<> \ template \ inline T Atomic::PlatformXchg::operator()(T exchange_value, \ - T volatile* dest) const { \ + T volatile* dest, \ + atomic_memory_order order) const { \ STATIC_ASSERT(ByteSize == sizeof(T)); \ return xchg_using_helper(StubName, exchange_value, dest); \ } @@ -83,7 +86,7 @@ DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func) inline T Atomic::PlatformCmpxchg::operator()(T exchange_value, \ T volatile* dest, \ T compare_value, \ - cmpxchg_memory_order order) const { \ + atomic_memory_order order) const { \ STATIC_ASSERT(ByteSize == sizeof(T)); \ return cmpxchg_using_helper(StubName, exchange_value, dest, compare_value); \ } @@ -98,7 +101,8 @@ DEFINE_STUB_CMPXCHG(8, int64_t, os::atomic_cmpxchg_long_func) template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); __asm { @@ -113,7 +117,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co template<> template inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, - T volatile* dest) const { + T volatile* dest, + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); // alternative for InterlockedExchange __asm { @@ -128,7 +133,7 @@ template inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(1 == sizeof(T)); // alternative for InterlockedCompareExchange __asm { @@ -144,7 +149,7 @@ template inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); // alternative for InterlockedCompareExchange __asm { @@ -160,7 +165,7 @@ template inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); int32_t ex_lo = (int32_t)exchange_value; int32_t ex_hi = *( ((int32_t*)&exchange_value) + 1 ); diff --git a/src/hotspot/share/c1/c1_Canonicalizer.cpp b/src/hotspot/share/c1/c1_Canonicalizer.cpp index 78cf3f4e59c..267d2101386 100644 --- a/src/hotspot/share/c1/c1_Canonicalizer.cpp +++ b/src/hotspot/share/c1/c1_Canonicalizer.cpp @@ -648,13 +648,21 @@ void Canonicalizer::do_NewTypeArray (NewTypeArray* x) {} void Canonicalizer::do_NewObjectArray (NewObjectArray* x) {} void Canonicalizer::do_NewMultiArray (NewMultiArray* x) {} void Canonicalizer::do_CheckCast (CheckCast* x) { - if (x->klass()->is_loaded() && !x->is_invokespecial_receiver_check()) { + if (x->klass()->is_loaded()) { Value obj = x->obj(); ciType* klass = obj->exact_type(); - if (klass == NULL) klass = obj->declared_type(); - if (klass != NULL && klass->is_loaded() && klass->is_subtype_of(x->klass())) { - set_canonical(obj); - return; + if (klass == NULL) { + klass = obj->declared_type(); + } + if (klass != NULL && klass->is_loaded()) { + bool is_interface = klass->is_instance_klass() && + klass->as_instance_klass()->is_interface(); + // Interface casts can't be statically optimized away since verifier doesn't + // enforce interface types in bytecode. + if (!is_interface && klass->is_subtype_of(x->klass())) { + set_canonical(obj); + return; + } } // checkcast of null returns null if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) { diff --git a/src/hotspot/share/c1/c1_LIR.cpp b/src/hotspot/share/c1/c1_LIR.cpp index 924ac78c1c4..3a41eb87f10 100644 --- a/src/hotspot/share/c1/c1_LIR.cpp +++ b/src/hotspot/share/c1/c1_LIR.cpp @@ -917,10 +917,13 @@ void LIR_OpVisitState::visit(LIR_Op* op) { break; } default: - ShouldNotReachHere(); + op->visit(this); } } +void LIR_Op::visit(LIR_OpVisitState* state) { + ShouldNotReachHere(); +} void LIR_OpVisitState::do_stub(CodeStub* stub) { if (stub != NULL) { diff --git a/src/hotspot/share/c1/c1_LIR.hpp b/src/hotspot/share/c1/c1_LIR.hpp index 980cd4d07dc..ed50932392c 100644 --- a/src/hotspot/share/c1/c1_LIR.hpp +++ b/src/hotspot/share/c1/c1_LIR.hpp @@ -1096,6 +1096,7 @@ class LIR_Op: public CompilationResourceObj { #endif virtual const char * name() const PRODUCT_RETURN0; + virtual void visit(LIR_OpVisitState* state); int id() const { return _id; } void set_id(int id) { _id = id; } @@ -1983,6 +1984,7 @@ class LIR_List: public CompilationResourceObj { int _line; #endif + public: void append(LIR_Op* op) { if (op->source() == NULL) op->set_source(_compilation->current_instruction()); @@ -2003,7 +2005,6 @@ class LIR_List: public CompilationResourceObj { #endif } - public: LIR_List(Compilation* compilation, BlockBegin* block = NULL); #ifdef ASSERT diff --git a/src/hotspot/share/classfile/classListParser.cpp b/src/hotspot/share/classfile/classListParser.cpp index 43107ee426e..dd21405df70 100644 --- a/src/hotspot/share/classfile/classListParser.cpp +++ b/src/hotspot/share/classfile/classListParser.cpp @@ -27,7 +27,6 @@ #include "jimage.hpp" #include "classfile/classListParser.hpp" #include "classfile/classLoaderExt.hpp" -#include "classfile/sharedClassUtil.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/systemDictionaryShared.hpp" diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 82a51fb982f..4bc7480d02e 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -72,7 +72,6 @@ #include "utilities/hashtable.inline.hpp" #include "utilities/macros.hpp" #if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" #include "classfile/sharedPathsMiscInfo.hpp" #endif @@ -660,7 +659,7 @@ void* ClassLoader::get_shared_paths_misc_info() { } bool ClassLoader::check_shared_paths_misc_info(void *buf, int size) { - SharedPathsMiscInfo* checker = SharedClassUtil::allocate_shared_paths_misc_info((char*)buf, size); + SharedPathsMiscInfo* checker = new SharedPathsMiscInfo((char*)buf, size); bool result = checker->check(); delete checker; return result; @@ -1406,8 +1405,6 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR name->utf8_length()); assert(file_name != NULL, "invariant"); - ClassLoaderExt::Context context(class_name, file_name, THREAD); - // Lookup stream for parsing .class file ClassFileStream* stream = NULL; s2 classpath_index = 0; @@ -1480,7 +1477,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR return NULL; } - stream->set_verify(context.should_verify(classpath_index)); + stream->set_verify(ClassLoaderExt::should_verify(classpath_index)); ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); Handle protection_domain; @@ -1628,8 +1625,7 @@ void ClassLoader::record_result(InstanceKlass* ik, const ClassFileStream* stream ik->name()->utf8_length()); assert(file_name != NULL, "invariant"); - ClassLoaderExt::Context context(class_name, file_name, CATCH); - context.record_result(ik->name(), classpath_index, ik, THREAD); + ClassLoaderExt::record_result(classpath_index, ik, THREAD); } #endif // INCLUDE_CDS @@ -1699,7 +1695,7 @@ void ClassLoader::initialize() { #if INCLUDE_CDS // initialize search path if (DumpSharedSpaces) { - _shared_paths_misc_info = SharedClassUtil::allocate_shared_paths_misc_info(); + _shared_paths_misc_info = new SharedPathsMiscInfo(); } #endif setup_bootstrap_search_path(); diff --git a/src/hotspot/share/classfile/classLoader.hpp b/src/hotspot/share/classfile/classLoader.hpp index ac6ca416f96..b9eb2405035 100644 --- a/src/hotspot/share/classfile/classLoader.hpp +++ b/src/hotspot/share/classfile/classLoader.hpp @@ -426,8 +426,6 @@ class ClassLoader: AllStatic { static int get_shared_paths_misc_info_size(); static void* get_shared_paths_misc_info(); static bool check_shared_paths_misc_info(void* info, int size); - static int get_module_paths_misc_info_size(); - static void* get_module_paths_misc_info(); static void exit_with_path_failure(const char* error, const char* message); static char* skip_uri_protocol(char* source); static void record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS); diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp index b182e6e5d86..3b0c9237677 100644 --- a/src/hotspot/share/classfile/classLoaderExt.cpp +++ b/src/hotspot/share/classfile/classLoaderExt.cpp @@ -31,7 +31,6 @@ #include "classfile/classLoaderData.inline.hpp" #include "classfile/klassFactory.hpp" #include "classfile/modules.hpp" -#include "classfile/sharedClassUtil.hpp" #include "classfile/sharedPathsMiscInfo.hpp" #include "classfile/systemDictionaryShared.hpp" #include "classfile/vmSymbols.hpp" @@ -57,8 +56,7 @@ bool ClassLoaderExt::_has_platform_classes = false; void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) { #if INCLUDE_CDS warning("Sharing is only supported for boot loader classes because bootstrap classpath has been appended"); - FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header(); - header->set_has_platform_or_app_classes(false); + FileMapInfo::current_info()->header()->set_has_platform_or_app_classes(false); #endif ClassLoader::add_to_boot_append_entries(new_entry); } @@ -228,11 +226,7 @@ void ClassLoaderExt::setup_search_paths() { ClassLoaderExt::setup_app_search_path(); } -Thread* ClassLoaderExt::Context::_dump_thread = NULL; - -void ClassLoaderExt::record_result(ClassLoaderExt::Context *context, - Symbol* class_name, - const s2 classpath_index, +void ClassLoaderExt::record_result(const s2 classpath_index, InstanceKlass* result, TRAPS) { assert(DumpSharedSpaces, "Sanity"); diff --git a/src/hotspot/share/classfile/classLoaderExt.hpp b/src/hotspot/share/classfile/classLoaderExt.hpp index a452acc4ed0..6863a69a177 100644 --- a/src/hotspot/share/classfile/classLoaderExt.hpp +++ b/src/hotspot/share/classfile/classLoaderExt.hpp @@ -29,74 +29,21 @@ #include "classfile/moduleEntry.hpp" #include "utilities/macros.hpp" -CDS_ONLY(class SharedPathsMiscInfoExt;) -CDS_ONLY(class ClassListParser;) +class ClassListParser; class ClassLoaderExt: public ClassLoader { // AllStatic public: enum SomeConstants { max_classpath_index = 0x7fff }; - // ClassLoaderExt::Context -- - // - // This is used by DumpSharedSpaces only - it enforces the same classloader - // delegation model as would be in run-time. I.e., - // + classes defined by the NULL class loader cannot load classes in the PLATFORM or APP paths. - // + classes defined by the PLATFORM class loader cannot load classes in the APP paths. - class Context { - static Thread* _dump_thread; - const char* _class_name; - const char* _file_name; - public: - const char* class_name() { - return _class_name; - } - const char* file_name() { - return _file_name; - } - - Context(const char* class_name, const char* file_name, TRAPS) { - _class_name = class_name; - _file_name = file_name; -#if INCLUDE_CDS - if (!DumpSharedSpaces && !UseSharedSpaces) { - // Must not modify _app_class_paths_start_index if we're not using CDS. - assert(_app_class_paths_start_index == ClassLoaderExt::max_classpath_index, "must be"); - } -#endif - } - - bool should_verify(int classpath_index) { - CDS_ONLY(return (classpath_index >= _app_class_paths_start_index);) - NOT_CDS(return false;) - } - - void record_result(Symbol* class_name, - const s2 classpath_index, - InstanceKlass* result, - TRAPS) { -#if INCLUDE_CDS - ClassLoaderExt::record_result(this, class_name, classpath_index, result, THREAD); -#endif - } - - ~Context() { -#if INCLUDE_CDS - if (!DumpSharedSpaces && !UseSharedSpaces) { - // Must not modify app_class_paths_start_index if we're not using CDS. - assert(_app_class_paths_start_index == ClassLoaderExt::max_classpath_index, "must be"); - } -#endif - } - }; // end ClassLoaderExt::Context private: #if INCLUDE_CDS static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size); static void setup_app_search_path(); // Only when -Xshare:dump static void process_module_table(ModuleEntryTable* met, TRAPS); - static SharedPathsMiscInfoExt* shared_paths_misc_info() { - return (SharedPathsMiscInfoExt*)_shared_paths_misc_info; + static SharedPathsMiscInfo* shared_paths_misc_info() { + return (SharedPathsMiscInfo*)_shared_paths_misc_info; } // index of first app JAR in shared classpath entry table static jshort _app_class_paths_start_index; @@ -110,6 +57,10 @@ private: public: CDS_ONLY(static void process_jar_manifest(ClassPathEntry* entry, bool check_for_duplicates);) + static bool should_verify(int classpath_index) { + CDS_ONLY(return (classpath_index >= _app_class_paths_start_index);) + NOT_CDS(return false;) + } // Called by JVMTI code to add boot classpath static void append_boot_classpath(ClassPathEntry* new_entry); @@ -156,9 +107,7 @@ public: return _has_app_classes || _has_platform_classes; } - static void record_result(class ClassLoaderExt::Context *context, - Symbol* class_name, - const s2 classpath_index, + static void record_result(const s2 classpath_index, InstanceKlass* result, TRAPS); static InstanceKlass* load_class(Symbol* h_name, const char* path, TRAPS); static Klass* load_one_class(ClassListParser* parser, TRAPS); diff --git a/src/hotspot/share/classfile/dictionary.cpp b/src/hotspot/share/classfile/dictionary.cpp index e6cab6a0ada..db35510398d 100644 --- a/src/hotspot/share/classfile/dictionary.cpp +++ b/src/hotspot/share/classfile/dictionary.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" -#include "classfile/sharedClassUtil.hpp" #include "classfile/dictionary.inline.hpp" #include "classfile/protectionDomainCache.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index a6d3c8b3c13..29b6f7c05e6 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -4134,6 +4134,48 @@ oop java_lang_ClassLoader::unnamedModule(oop loader) { return loader->obj_field(unnamedModule_offset); } +// Caller needs ResourceMark. +const char* java_lang_ClassLoader::describe_external(const oop loader) { + if (loader == NULL) { + return ""; + } + + bool well_known_loader = SystemDictionary::is_system_class_loader(loader) || + SystemDictionary::is_platform_class_loader(loader); + + const char* name = NULL; + oop nameOop = java_lang_ClassLoader::name(loader); + if (nameOop != NULL) { + name = java_lang_String::as_utf8_string(nameOop); + } + if (name == NULL) { + // Use placeholder for missing name to have fixed message format. + name = ""; + } + + stringStream ss; + ss.print("\"%s\" (instance of %s", name, loader->klass()->external_name()); + if (!well_known_loader) { + const char* parentName = NULL; + oop pl = java_lang_ClassLoader::parent(loader); + if (pl != NULL) { + oop parentNameOop = java_lang_ClassLoader::name(pl); + if (parentNameOop != NULL) { + parentName = java_lang_String::as_utf8_string(parentNameOop); + if (parentName == NULL) { + parentName = ""; + } + } + ss.print(", child of \"%s\" %s", parentName, pl->klass()->external_name()); + } else { + ss.print(", child of "); + } + } + ss.print(")"); + + return ss.as_string(); +} + // Support for java_lang_System // #define SYSTEM_FIELDS_DO(macro) \ diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp index 79c2db13800..83a80cc3a39 100644 --- a/src/hotspot/share/classfile/javaClasses.hpp +++ b/src/hotspot/share/classfile/javaClasses.hpp @@ -1321,6 +1321,12 @@ class java_lang_ClassLoader : AllStatic { // Debugging friend class JavaClasses; friend class ClassFileParser; // access to number_of_fake_fields + + // Describe ClassLoader for exceptions, tracing ... + // Prints "" (instance of , child of "" ). + // If a classloader has no name, it prints instead. The output + // for well known loaders (system/platform) is abbreviated. + static const char* describe_external(const oop loader); }; diff --git a/src/hotspot/share/classfile/klassFactory.cpp b/src/hotspot/share/classfile/klassFactory.cpp index 8e52c787260..474d7f8c66a 100644 --- a/src/hotspot/share/classfile/klassFactory.cpp +++ b/src/hotspot/share/classfile/klassFactory.cpp @@ -29,7 +29,7 @@ #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/klassFactory.hpp" -#include "classfile/sharedClassUtil.hpp" +#include "memory/filemap.hpp" #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiEnvBase.hpp" diff --git a/src/hotspot/share/classfile/sharedClassUtil.cpp b/src/hotspot/share/classfile/sharedClassUtil.cpp deleted file mode 100644 index 0e215cbb353..00000000000 --- a/src/hotspot/share/classfile/sharedClassUtil.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2014, 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. - * - */ - -#include "precompiled.hpp" -#include "classfile/classLoader.hpp" -#include "classfile/classLoaderExt.hpp" -#include "classfile/dictionary.hpp" -#include "classfile/javaClasses.hpp" -#include "classfile/sharedClassUtil.hpp" -#include "classfile/stringTable.hpp" -#include "classfile/symbolTable.hpp" -#include "classfile/systemDictionary.hpp" -#include "classfile/systemDictionaryShared.hpp" -#include "memory/filemap.hpp" -#include "memory/metadataFactory.hpp" -#include "memory/resourceArea.hpp" -#include "oops/instanceKlass.hpp" -#include "runtime/arguments.hpp" -#include "runtime/java.hpp" -#include "runtime/os.inline.hpp" - -class ManifestStream: public ResourceObj { - private: - u1* _buffer_start; // Buffer bottom - u1* _buffer_end; // Buffer top (one past last element) - u1* _current; // Current buffer position - - public: - // Constructor - ManifestStream(u1* buffer, int length) : _buffer_start(buffer), - _current(buffer) { - _buffer_end = buffer + length; - } - - static bool is_attr(u1* attr, const char* name) { - return strncmp((const char*)attr, name, strlen(name)) == 0; - } - - static char* copy_attr(u1* value, size_t len) { - char* buf = NEW_RESOURCE_ARRAY(char, len + 1); - strncpy(buf, (char*)value, len); - buf[len] = 0; - return buf; - } - - // The return value indicates if the JAR is signed or not - bool check_is_signed() { - u1* attr = _current; - bool isSigned = false; - while (_current < _buffer_end) { - if (*_current == '\n') { - *_current = '\0'; - u1* value = (u1*)strchr((char*)attr, ':'); - if (value != NULL) { - assert(*(value+1) == ' ', "Unrecognized format" ); - if (strstr((char*)attr, "-Digest") != NULL) { - isSigned = true; - break; - } - } - *_current = '\n'; // restore - attr = _current + 1; - } - _current ++; - } - return isSigned; - } -}; - -void SharedPathsMiscInfoExt::print_path(outputStream* out, int type, const char* path) { - switch(type) { - case APP: - ClassLoader::trace_class_path("Expecting -Djava.class.path=", path); - break; - case MODULE: - ClassLoader::trace_class_path("Checking module path: ", path); - break; - default: - SharedPathsMiscInfo::print_path(out, type, path); - } -} - -bool SharedPathsMiscInfoExt::check(jint type, const char* path) { - - switch (type) { - case APP: - { - // Prefix is OK: E.g., dump with -cp foo.jar, but run with -cp foo.jar:bar.jar - size_t len = strlen(path); - const char *appcp = Arguments::get_appclasspath(); - assert(appcp != NULL, "NULL app classpath"); - size_t appcp_len = strlen(appcp); - if (appcp_len < len) { - return fail("Run time APP classpath is shorter than the one at dump time: ", appcp); - } - ResourceMark rm; - char* tmp_path; - if (len == appcp_len) { - tmp_path = (char*)appcp; - } else { - tmp_path = NEW_RESOURCE_ARRAY(char, len + 1); - strncpy(tmp_path, appcp, len); - tmp_path[len] = 0; - } - if (os::file_name_strcmp(path, tmp_path) != 0) { - return fail("[APP classpath mismatch, actual: -Djava.class.path=", appcp); - } - if (appcp[len] != '\0' && appcp[len] != os::path_separator()[0]) { - return fail("Dump time APP classpath is not a proper prefix of run time APP classpath: ", appcp); - } - } - break; - default: - return SharedPathsMiscInfo::check(type, path); - } - - return true; -} - -void SharedClassUtil::update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* e, TRAPS) { - ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); - SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*)e; - ResourceMark rm(THREAD); - jint manifest_size; - bool isSigned; - - if (cpe->is_jar_file()) { - char* manifest = ClassLoaderExt::read_manifest(cpe, &manifest_size, CHECK); - if (manifest != NULL) { - ManifestStream* stream = new ManifestStream((u1*)manifest, - manifest_size); - isSigned = stream->check_is_signed(); - if (isSigned) { - ent->_is_signed = true; - } else { - // Copy the manifest into the shared archive - manifest = ClassLoaderExt::read_raw_manifest(cpe, &manifest_size, CHECK); - Array* buf = MetadataFactory::new_array(loader_data, - manifest_size, - THREAD); - char* p = (char*)(buf->data()); - memcpy(p, manifest, manifest_size); - ent->set_manifest(buf); - ent->_is_signed = false; - } - } - } -} - -void SharedClassUtil::initialize(TRAPS) { - if (UseSharedSpaces) { - int size = FileMapInfo::get_number_of_shared_paths(); - if (size > 0) { - SystemDictionaryShared::allocate_shared_data_arrays(size, THREAD); - FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header(); - ClassLoaderExt::init_paths_start_index(header->_app_class_paths_start_index); - ClassLoaderExt::init_app_module_paths_start_index(header->_app_module_paths_start_index); - } - } - - if (DumpSharedSpaces) { - if (SharedArchiveConfigFile) { - read_extra_data(SharedArchiveConfigFile, THREAD); - } - } -} - -void SharedClassUtil::read_extra_data(const char* filename, TRAPS) { - HashtableTextDump reader(filename); - reader.check_version("VERSION: 1.0"); - - while (reader.remain() > 0) { - int utf8_length; - int prefix_type = reader.scan_prefix(&utf8_length); - ResourceMark rm(THREAD); - char* utf8_buffer = NEW_RESOURCE_ARRAY(char, utf8_length); - reader.get_utf8(utf8_buffer, utf8_length); - - if (prefix_type == HashtableTextDump::SymbolPrefix) { - SymbolTable::new_symbol(utf8_buffer, utf8_length, THREAD); - } else{ - assert(prefix_type == HashtableTextDump::StringPrefix, "Sanity"); - utf8_buffer[utf8_length] = '\0'; - oop s = StringTable::intern(utf8_buffer, THREAD); - } - } -} - -bool SharedClassUtil::is_classpath_entry_signed(int classpath_index) { - assert(classpath_index >= 0, "Sanity"); - SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*) - FileMapInfo::shared_path(classpath_index); - return ent->_is_signed; -} - -void FileMapHeaderExt::populate(FileMapInfo* mapinfo, size_t alignment) { - FileMapInfo::FileMapHeader::populate(mapinfo, alignment); - - ClassLoaderExt::finalize_shared_paths_misc_info(); - _app_class_paths_start_index = ClassLoaderExt::app_class_paths_start_index(); - _app_module_paths_start_index = ClassLoaderExt::app_module_paths_start_index(); - - _verify_local = BytecodeVerificationLocal; - _verify_remote = BytecodeVerificationRemote; - _has_platform_or_app_classes = ClassLoaderExt::has_platform_or_app_classes(); -} - -bool FileMapHeaderExt::validate() { - if (!FileMapInfo::FileMapHeader::validate()) { - return false; - } - - // This must be done after header validation because it might change the - // header data - const char* prop = Arguments::get_property("java.system.class.loader"); - if (prop != NULL) { - warning("Archived non-system classes are disabled because the " - "java.system.class.loader property is specified (value = \"%s\"). " - "To use archived non-system classes, this property must be not be set", prop); - _has_platform_or_app_classes = false; - } - - // For backwards compatibility, we don't check the verification setting - // if the archive only contains system classes. - if (_has_platform_or_app_classes && - ((!_verify_local && BytecodeVerificationLocal) || - (!_verify_remote && BytecodeVerificationRemote))) { - FileMapInfo::fail_continue("The shared archive file was created with less restrictive " - "verification setting than the current setting."); - return false; - } - - return true; -} diff --git a/src/hotspot/share/classfile/sharedClassUtil.hpp b/src/hotspot/share/classfile/sharedClassUtil.hpp deleted file mode 100644 index caccfce9deb..00000000000 --- a/src/hotspot/share/classfile/sharedClassUtil.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2014, 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. - * - */ - -#ifndef SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP -#define SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP - -#include "classfile/sharedPathsMiscInfo.hpp" -#include "memory/filemap.hpp" -#include "classfile/classLoaderExt.hpp" -#include "classfile/dictionary.hpp" -#include "classfile/systemDictionaryShared.hpp" -#include "oops/klass.hpp" - -class FileMapHeaderExt: public FileMapInfo::FileMapHeader { -public: - jshort _app_class_paths_start_index; // Index of first app classpath entry - jshort _app_module_paths_start_index; // Index of first module path entry - bool _verify_local; // BytecodeVerificationLocal setting - bool _verify_remote; // BytecodeVerificationRemote setting - bool _has_platform_or_app_classes; // Archive contains app classes - - FileMapHeaderExt() { - _has_platform_or_app_classes = true; - } - void set_has_platform_or_app_classes(bool v) { - _has_platform_or_app_classes = v; - } - bool has_platform_or_app_classes() { return _has_platform_or_app_classes; } - virtual void populate(FileMapInfo* mapinfo, size_t alignment); - virtual bool validate(); -}; - -// In addition to SharedPathsMiscInfo, the following information is also stored -// -// -// + The value of Arguments::get_appclasspath() used during dumping. -// -class SharedPathsMiscInfoExt : public SharedPathsMiscInfo { -private: - int _app_offset; -public: - enum { - APP = 5, - MODULE = 6 - }; - - virtual const char* type_name(int type) { - switch (type) { - case APP: return "APP"; - case MODULE: return "MODULE"; - default: return SharedPathsMiscInfo::type_name(type); - } - } - - virtual void print_path(outputStream* out, int type, const char* path); - - SharedPathsMiscInfoExt() : SharedPathsMiscInfo() { - _app_offset = 0; - } - SharedPathsMiscInfoExt(char* buf, int size) : SharedPathsMiscInfo(buf, size) { - _app_offset = 0; - } - - virtual bool check(jint type, const char* path); - - void add_app_classpath(const char* path) { - add_path(path, APP); - } - - void record_app_offset() { - _app_offset = get_used_bytes(); - } - void pop_app() { - _cur_ptr = _buf_start + _app_offset; - write_jint(0); - } -}; - -class SharedClassPathEntryExt: public SharedClassPathEntry { -public: - //Maniest attributes - bool _is_signed; - void set_manifest(Array* manifest) { - _manifest = manifest; - } -}; - -class SharedClassUtil : AllStatic { -public: - static SharedPathsMiscInfo* allocate_shared_paths_misc_info() { - return new SharedPathsMiscInfoExt(); - } - - static SharedPathsMiscInfo* allocate_shared_paths_misc_info(char* buf, int size) { - return new SharedPathsMiscInfoExt(buf, size); - } - - static FileMapInfo::FileMapHeader* allocate_file_map_header() { - return new FileMapHeaderExt(); - } - - static size_t file_map_header_size() { - return sizeof(FileMapHeaderExt); - } - - static size_t shared_class_path_entry_size() { - return sizeof(SharedClassPathEntryExt); - } - - static void update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS); - static void initialize(TRAPS); - -private: - static void read_extra_data(const char* filename, TRAPS); - -public: - static bool is_classpath_entry_signed(int classpath_index); -}; - -#endif // SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP diff --git a/src/hotspot/share/classfile/sharedPathsMiscInfo.cpp b/src/hotspot/share/classfile/sharedPathsMiscInfo.cpp index 5cb57e40559..f8d1ba59b76 100644 --- a/src/hotspot/share/classfile/sharedPathsMiscInfo.cpp +++ b/src/hotspot/share/classfile/sharedPathsMiscInfo.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" -#include "classfile/classLoaderData.inline.hpp" #include "classfile/sharedPathsMiscInfo.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" @@ -36,6 +35,7 @@ #include "utilities/ostream.hpp" SharedPathsMiscInfo::SharedPathsMiscInfo() { + _app_offset = 0; _buf_size = INITIAL_BUF_SIZE; _cur_ptr = _buf_start = NEW_C_HEAP_ARRAY(char, _buf_size, mtClass); _allocated = true; @@ -89,12 +89,15 @@ bool SharedPathsMiscInfo::fail(const char* msg, const char* name) { void SharedPathsMiscInfo::print_path(outputStream* out, int type, const char* path) { switch (type) { - case BOOT: + case BOOT_PATH: out->print("Expecting BOOT path=%s", path); break; case NON_EXIST: out->print("Expecting that %s does not exist", path); break; + case APP_PATH: + ClassLoader::trace_class_path("Expecting -Djava.class.path=", path); + break; default: ShouldNotReachHere(); } @@ -139,7 +142,7 @@ bool SharedPathsMiscInfo::check() { bool SharedPathsMiscInfo::check(jint type, const char* path) { switch (type) { - case BOOT: + case BOOT_PATH: // In the future we should perform the check based on the content of the mapped archive. if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) { return fail("[BOOT classpath mismatch, actual =", Arguments::get_sysclasspath()); @@ -155,6 +158,33 @@ bool SharedPathsMiscInfo::check(jint type, const char* path) { } } break; + case APP_PATH: + { + // Prefix is OK: E.g., dump with -cp foo.jar, but run with -cp foo.jar:bar.jar + size_t len = strlen(path); + const char *appcp = Arguments::get_appclasspath(); + assert(appcp != NULL, "NULL app classpath"); + size_t appcp_len = strlen(appcp); + if (appcp_len < len) { + return fail("Run time APP classpath is shorter than the one at dump time: ", appcp); + } + ResourceMark rm; + char* tmp_path; + if (len == appcp_len) { + tmp_path = (char*)appcp; + } else { + tmp_path = NEW_RESOURCE_ARRAY(char, len + 1); + strncpy(tmp_path, appcp, len); + tmp_path[len] = 0; + } + if (os::file_name_strcmp(path, tmp_path) != 0) { + return fail("[APP classpath mismatch, actual: -Djava.class.path=", appcp); + } + if (appcp[len] != '\0' && appcp[len] != os::path_separator()[0]) { + return fail("Dump time APP classpath is not a proper prefix of run time APP classpath: ", appcp); + } + } + break; default: return fail("Corrupted archive file header"); } diff --git a/src/hotspot/share/classfile/sharedPathsMiscInfo.hpp b/src/hotspot/share/classfile/sharedPathsMiscInfo.hpp index e5576156e67..6c4b0b84e9f 100644 --- a/src/hotspot/share/classfile/sharedPathsMiscInfo.hpp +++ b/src/hotspot/share/classfile/sharedPathsMiscInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -35,8 +35,6 @@ class outputStream; // // + The values of Arguments::get_sysclasspath() used during dumping. // -// + The meta-index file(s) used during dumping (incl modification time and size) -// // + The class path elements specified during dumping but did not exist -- // these elements must also be specified at run time, and they also must not // exist at run time. @@ -53,6 +51,8 @@ class outputStream; // two situations. See below. class SharedPathsMiscInfo : public CHeapObj { +private: + int _app_offset; protected: char* _buf_start; char* _cur_ptr; @@ -67,7 +67,7 @@ protected: protected: static bool fail(const char* msg, const char* name = NULL); - virtual bool check(jint type, const char* path); + bool check(jint type, const char* path); public: enum { @@ -77,6 +77,7 @@ public: SharedPathsMiscInfo(); // This constructor is used when validating the misc info (during run time) SharedPathsMiscInfo(char *buff, int size) { + _app_offset = 0; _cur_ptr = _buf_start = buff; _end_ptr = _buf_start + size; _buf_size = size; @@ -100,8 +101,20 @@ public: // The path must exist, and must contain exactly files/dirs void add_boot_classpath(const char* path) { - add_path(path, BOOT); + add_path(path, BOOT_PATH); } + + void add_app_classpath(const char* path) { + add_path(path, APP_PATH); + } + void record_app_offset() { + _app_offset = get_used_bytes(); + } + void pop_app() { + _cur_ptr = _buf_start + _app_offset; + write_jint(0); + } + int write_jint(jint num) { write(&num, sizeof(num)); return 0; @@ -120,22 +133,24 @@ public: // reading -- +private: enum { - BOOT = 1, - NON_EXIST = 2 + BOOT_PATH = 1, + APP_PATH = 2, + NON_EXIST = 3 }; - virtual const char* type_name(int type) { + const char* type_name(int type) { switch (type) { - case BOOT: return "BOOT"; - case NON_EXIST: return "NON_EXIST"; - default: ShouldNotReachHere(); return "?"; + case BOOT_PATH: return "BOOT"; + case APP_PATH: return "APP"; + case NON_EXIST: return "NON_EXIST"; + default: ShouldNotReachHere(); return "?"; } } - virtual void print_path(outputStream* os, int type, const char* path); + void print_path(outputStream* os, int type, const char* path); - bool check(); bool read_jint(jint *ptr) { return read(ptr, sizeof(jint)); } @@ -145,6 +160,9 @@ public: bool read_time(time_t *ptr) { return read(ptr, sizeof(time_t)); } + +public: + bool check(); }; #endif // SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index 8035981b52c..dd72849caa2 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -84,7 +84,6 @@ #include "trace/tracing.hpp" #include "utilities/macros.hpp" #if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" #include "classfile/systemDictionaryShared.hpp" #endif #if INCLUDE_JVMCI @@ -2124,10 +2123,19 @@ BasicType SystemDictionary::box_klass_type(Klass* k) { void SystemDictionary::check_constraints(unsigned int d_hash, InstanceKlass* k, - Handle class_loader, bool defining, + Handle class_loader, + bool defining, TRAPS) { + ResourceMark rm(THREAD); + stringStream ss; + bool throwException = false; + const char *linkage_error1 = NULL; const char *linkage_error2 = NULL; + const char *linkage_error3 = ""; + // Remember the loader of the similar class that is already loaded. + const char *existing_klass_loader_name = ""; + { Symbol* name = k->name(); ClassLoaderData *loader_data = class_loader_data(class_loader); @@ -2136,16 +2144,18 @@ void SystemDictionary::check_constraints(unsigned int d_hash, InstanceKlass* check = find_class(d_hash, name, loader_data->dictionary()); if (check != NULL) { - // if different InstanceKlass - duplicate class definition, - // else - ok, class loaded by a different thread in parallel, - // we should only have found it if it was done loading and ok to use - // dictionary only holds instance classes, placeholders - // also holds array classes + // If different InstanceKlass - duplicate class definition, + // else - ok, class loaded by a different thread in parallel. + // We should only have found it if it was done loading and ok to use. + // The dictionary only holds instance classes, placeholders + // also hold array classes. assert(check->is_instance_klass(), "noninstance in systemdictionary"); if ((defining == true) || (k != check)) { - linkage_error1 = "loader (instance of "; - linkage_error2 = "): attempted duplicate class definition for name: \""; + throwException = true; + ss.print("loader %s", java_lang_ClassLoader::describe_external(class_loader())); + ss.print(" attempted duplicate %s definition for %s.", + k->external_kind(), k->external_name()); } else { return; } @@ -2156,30 +2166,30 @@ void SystemDictionary::check_constraints(unsigned int d_hash, assert(ph_check == NULL || ph_check == name, "invalid symbol"); #endif - if (linkage_error1 == NULL) { + if (throwException == false) { if (constraints()->check_or_update(k, class_loader, name) == false) { - linkage_error1 = "loader constraint violation: loader (instance of "; - linkage_error2 = ") previously initiated loading for a different type with name \""; + throwException = true; + ss.print("loader constraint violation: loader %s", + java_lang_ClassLoader::describe_external(class_loader())); + ss.print(" wants to load %s %s.", + k->external_kind(), k->external_name()); + Klass *existing_klass = constraints()->find_constrained_klass(name, class_loader); + if (existing_klass->class_loader() != class_loader()) { + ss.print(" A different %s with the same name was previously loaded by %s.", + existing_klass->external_kind(), + java_lang_ClassLoader::describe_external(existing_klass->class_loader())); + } } } } // Throw error now if needed (cannot throw while holding // SystemDictionary_lock because of rank ordering) - - if (linkage_error1) { - ResourceMark rm(THREAD); - const char* class_loader_name = loader_name(class_loader()); - char* type_name = k->name()->as_C_string(); - size_t buflen = strlen(linkage_error1) + strlen(class_loader_name) + - strlen(linkage_error2) + strlen(type_name) + 2; // +2 for '"' and null byte. - char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); - jio_snprintf(buf, buflen, "%s%s%s%s\"", linkage_error1, class_loader_name, linkage_error2, type_name); - THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); + if (throwException == true) { + THROW_MSG(vmSymbols::java_lang_LinkageError(), ss.as_string()); } } - // Update class loader data dictionary - done after check_constraint and add_to_hierachy // have been called. void SystemDictionary::update_dictionary(unsigned int d_hash, diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp index dad6e754c24..3b53125ed66 100644 --- a/src/hotspot/share/classfile/systemDictionary.hpp +++ b/src/hotspot/share/classfile/systemDictionary.hpp @@ -26,7 +26,6 @@ #define SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP #include "classfile/classLoader.hpp" -#include "classfile/systemDictionary_ext.hpp" #include "jvmci/systemDictionary_jvmci.hpp" #include "oops/objArrayOop.hpp" #include "oops/symbol.hpp" @@ -186,6 +185,7 @@ class OopStorage; do_klass(File_klass, java_io_File, Pre ) \ do_klass(URL_klass, java_net_URL, Pre ) \ do_klass(Jar_Manifest_klass, java_util_jar_Manifest, Pre ) \ + do_klass(jdk_internal_loader_ClassLoaders_klass, jdk_internal_loader_ClassLoaders, Pre ) \ do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass, jdk_internal_loader_ClassLoaders_AppClassLoader, Pre ) \ do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader, Pre ) \ do_klass(CodeSource_klass, java_security_CodeSource, Pre ) \ @@ -212,8 +212,6 @@ class OopStorage; do_klass(Integer_klass, java_lang_Integer, Pre ) \ do_klass(Long_klass, java_lang_Long, Pre ) \ \ - /* Extensions */ \ - WK_KLASSES_DO_EXT(do_klass) \ /* JVMCI classes. These are loaded on-demand. */ \ JVMCI_WK_KLASSES_DO(do_klass) \ \ @@ -223,7 +221,6 @@ class OopStorage; class SystemDictionary : AllStatic { friend class VMStructs; friend class SystemDictionaryHandles; - friend class SharedClassUtil; public: enum WKID { diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 84cb861e1ce..97562662beb 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -31,7 +31,6 @@ #include "classfile/compactHashtable.inline.hpp" #include "classfile/dictionary.hpp" #include "classfile/javaClasses.hpp" -#include "classfile/sharedClassUtil.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/systemDictionaryShared.hpp" @@ -92,7 +91,7 @@ Handle SystemDictionaryShared::get_shared_jar_manifest(int shared_path_index, TR Handle empty; Handle manifest ; if (shared_jar_manifest(shared_path_index) == NULL) { - SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*)FileMapInfo::shared_path(shared_path_index); + SharedClassPathEntry* ent = FileMapInfo::shared_path(shared_path_index); long size = ent->manifest_size(); if (size <= 0) { return empty; // No manifest - return NULL handle @@ -303,8 +302,7 @@ Handle SystemDictionaryShared::init_security_info(Handle class_loader, InstanceK if (ik != NULL) { int index = ik->shared_classpath_index(); assert(index >= 0, "Sanity"); - SharedClassPathEntryExt* ent = - (SharedClassPathEntryExt*)FileMapInfo::shared_path(index); + SharedClassPathEntry* ent = FileMapInfo::shared_path(index); Symbol* class_name = ik->name(); if (ent->is_modules_image()) { @@ -476,41 +474,38 @@ bool SystemDictionaryShared::is_shared_class_visible_for_classloader( // [1] JVM_FindLoadedClass // [2] java.lang.ClassLoader.findLoadedClass0() // [3] java.lang.ClassLoader.findLoadedClass() -// [4] java.lang.ClassLoader.loadClass() -// [5] jdk.internal.loader.ClassLoaders$AppClassLoader_klass.loadClass() +// [4] jdk.internal.loader.BuiltinClassLoader.loadClassOrNull() +// [5] jdk.internal.loader.BuiltinClassLoader.loadClass() +// [6] jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(), or +// jdk.internal.loader.ClassLoaders$PlatformClassLoader.loadClass() // -// Because AppCDS supports only the PlatformClassLoader and AppClassLoader, we make the following -// assumptions (based on the JDK 8.0 source code): +// AppCDS supports fast class loading for these 2 built-in class loaders: +// jdk.internal.loader.ClassLoaders$PlatformClassLoader +// jdk.internal.loader.ClassLoaders$AppClassLoader +// with the following assumptions (based on the JDK core library source code): // -// [a] these two loaders use the default implementation of -// ClassLoader.loadClass(String name, boolean resolve), which -// [b] calls findLoadedClass(name), immediately followed by parent.loadClass(), -// immediately followed by findClass(name). -// [c] If the requested class is a shared class of the current class loader, parent.loadClass() -// always returns null, and -// [d] if AppCDS is not enabled, the class would be loaded by findClass() by decoding it from a -// JAR file and then parsed. +// [a] these two loaders use the BuiltinClassLoader.loadClassOrNull() to +// load the named class. +// [b] BuiltinClassLoader.loadClassOrNull() first calls findLoadedClass(name). +// [c] At this point, if we can find the named class inside the +// shared_dictionary, we can perform further checks (see +// is_shared_class_visible_for_classloader() to ensure that this class +// was loaded by the same class loader during dump time. // // Given these assumptions, we intercept the findLoadedClass() call to invoke // SystemDictionaryShared::find_or_load_shared_class() to load the shared class from -// the archive. The reasons are: -// -// + Because AppCDS is a commercial feature, we want to hide the implementation. There -// is currently no easy way to hide Java code, so we did it with native code. -// + Start-up is improved because we avoid decoding the JAR file, and avoid delegating -// to the parent (since we know the parent will not find this class). +// the archive for the 2 built-in class loaders. This way, +// we can improve start-up because we avoid decoding the classfile, +// and avoid delegating to the parent loader. // // NOTE: there's a lot of assumption about the Java code. If any of that change, this // needs to be redesigned. -// -// An alternative is to modify the Java code of AppClassLoader.loadClass(). -// + InstanceKlass* SystemDictionaryShared::find_or_load_shared_class( Symbol* name, Handle class_loader, TRAPS) { InstanceKlass* k = NULL; if (UseSharedSpaces) { - FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header(); - if (!header->has_platform_or_app_classes()) { + if (!FileMapInfo::current_info()->header()->has_platform_or_app_classes()) { return NULL; } diff --git a/src/hotspot/share/gc/cms/cmsHeap.cpp b/src/hotspot/share/gc/cms/cmsHeap.cpp index 4671eaed023..408775114b0 100644 --- a/src/hotspot/share/gc/cms/cmsHeap.cpp +++ b/src/hotspot/share/gc/cms/cmsHeap.cpp @@ -100,7 +100,7 @@ void CMSHeap::initialize_serviceability() { _young_manager = new GCMemoryManager("ParNew", "end of minor GC"); _old_manager = new GCMemoryManager("ConcurrentMarkSweep", "end of major GC"); - ParNewGeneration* young = (ParNewGeneration*) young_gen(); + ParNewGeneration* young = young_gen(); _eden_pool = new ContiguousSpacePool(young->eden(), "Par Eden Space", young->max_eden_size(), @@ -128,18 +128,11 @@ void CMSHeap::initialize_serviceability() { } -void CMSHeap::check_gen_kinds() { - assert(young_gen()->kind() == Generation::ParNew, - "Wrong youngest generation type"); - assert(old_gen()->kind() == Generation::ConcurrentMarkSweep, - "Wrong generation kind"); -} - CMSHeap* CMSHeap::heap() { CollectedHeap* heap = Universe::heap(); assert(heap != NULL, "Uninitialized access to CMSHeap::heap()"); assert(heap->kind() == CollectedHeap::CMS, "Invalid name"); - return (CMSHeap*) heap; + return static_cast(heap); } void CMSHeap::gc_threads_do(ThreadClosure* tc) const { diff --git a/src/hotspot/share/gc/cms/cmsHeap.hpp b/src/hotspot/share/gc/cms/cmsHeap.hpp index ad0dab072e5..ee800fff7f8 100644 --- a/src/hotspot/share/gc/cms/cmsHeap.hpp +++ b/src/hotspot/share/gc/cms/cmsHeap.hpp @@ -26,6 +26,7 @@ #define SHARE_VM_GC_CMS_CMSHEAP_HPP #include "gc/cms/concurrentMarkSweepGeneration.hpp" +#include "gc/cms/parNewGeneration.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shared/genCollectedHeap.hpp" @@ -42,10 +43,6 @@ class ThreadClosure; class WorkGang; class CMSHeap : public GenCollectedHeap { - -protected: - virtual void check_gen_kinds(); - public: CMSHeap(GenCollectorPolicy *policy); @@ -97,6 +94,24 @@ public: GCMemoryManager* old_manager() const { return _old_manager; } + ParNewGeneration* young_gen() const { + assert(_young_gen->kind() == Generation::ParNew, "Wrong generation type"); + return static_cast(_young_gen); + } + + ConcurrentMarkSweepGeneration* old_gen() const { + assert(_old_gen->kind() == Generation::ConcurrentMarkSweep, "Wrong generation kind"); + return static_cast(_old_gen); + } + + // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects + // allocated since the last call to save_marks in the young generation. + // The "cur" closure is applied to references in the younger generation + // at "level", and the "older" closure to older generations. + template + void oop_since_save_marks_iterate(OopClosureType1* cur, + OopClosureType2* older); + private: WorkGang* _workers; MemoryPool* _eden_pool; diff --git a/src/hotspot/share/gc/cms/cmsHeap.inline.hpp b/src/hotspot/share/gc/cms/cmsHeap.inline.hpp new file mode 100644 index 00000000000..be7f0c9750b --- /dev/null +++ b/src/hotspot/share/gc/cms/cmsHeap.inline.hpp @@ -0,0 +1,39 @@ +/* + * 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. + * + */ + +#ifndef SHARE_GC_CMS_CMSHEAP_INLINE_HPP +#define SHARE_GC_CMS_CMSHEAP_INLINE_HPP + +#include "gc/cms/cmsHeap.hpp" +#include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" +#include "gc/serial/defNewGeneration.inline.hpp" + +template +void CMSHeap::oop_since_save_marks_iterate(OopClosureType1* cur, + OopClosureType2* older) { + young_gen()->oop_since_save_marks_iterate(cur); + old_gen()->oop_since_save_marks_iterate(older); +} + +#endif // SHARE_GC_CMS_CMSHEAP_INLINE_HPP diff --git a/src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp b/src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp index eddc06d4702..5a3d88c8f37 100644 --- a/src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp +++ b/src/hotspot/share/gc/cms/cms_specialized_oop_closures.hpp @@ -60,14 +60,4 @@ class CMSInnerParMarkAndPushClosure; f(CMSKeepAliveClosure,_nv) \ f(CMSInnerParMarkAndPushClosure,_nv) -#define SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f) \ - f(MarkRefsIntoAndScanClosure,_nv) \ - f(PushAndMarkClosure,_nv) \ - f(ParMarkRefsIntoAndScanClosure,_nv) \ - f(ParPushAndMarkClosure,_nv) - -#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) \ - f(ParScanWithBarrierClosure,_nv) \ - f(ParScanWithoutBarrierClosure,_nv) - #endif // SHARE_GC_CMS_CMS_SPECIALIZED_OOP_CLOSURES_HPP diff --git a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp index 0123a9bd0ac..53b54cd3476 100644 --- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp +++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp @@ -2103,22 +2103,6 @@ bool CompactibleFreeListSpace::no_allocs_since_save_marks() { return _promoInfo.noPromotions(); } -#define CFLS_OOP_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix) \ - \ -void CompactibleFreeListSpace:: \ -oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \ - _promoInfo.promoted_oops_iterate##nv_suffix(blk); \ - /* \ - * This also restores any displaced headers and removes the elements from \ - * the iteration set as they are processed, so that we have a clean slate \ - * at the end of the iteration. Note, thus, that if new objects are \ - * promoted as a result of the iteration they are iterated over as well. \ - */ \ - assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); \ -} - -ALL_SINCE_SAVE_MARKS_CLOSURES(CFLS_OOP_SINCE_SAVE_MARKS_DEFN) - bool CompactibleFreeListSpace::linearAllocationWouldFail() const { return _smallLinearAllocBlock._word_size == 0; } diff --git a/src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp b/src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp index 1120e866d2d..12b555fa19e 100644 --- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp +++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp @@ -501,10 +501,8 @@ class CompactibleFreeListSpace: public CompactibleSpace { // Fields in objects allocated by applications of the closure // *are* included in the iteration. Thus, when the iteration completes // there should be no further such objects remaining. - #define CFLS_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ - void oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk); - ALL_SINCE_SAVE_MARKS_CLOSURES(CFLS_OOP_SINCE_SAVE_MARKS_DECL) - #undef CFLS_OOP_SINCE_SAVE_MARKS_DECL + template + void oop_since_save_marks_iterate(OopClosureType* blk); // Allocation support HeapWord* allocate(size_t size); diff --git a/src/hotspot/share/gc/cms/compactibleFreeListSpace.inline.hpp b/src/hotspot/share/gc/cms/compactibleFreeListSpace.inline.hpp new file mode 100644 index 00000000000..8b265c853b4 --- /dev/null +++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.inline.hpp @@ -0,0 +1,42 @@ +/* + * 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. + * + */ + +#ifndef SHARE_GC_CMS_COMPACTIBLEFREELISTSPACE_INLINE_HPP +#define SHARE_GC_CMS_COMPACTIBLEFREELISTSPACE_INLINE_HPP + +#include "gc/cms/compactibleFreeListSpace.hpp" +#include "gc/cms/promotionInfo.inline.hpp" + +template +void CompactibleFreeListSpace::oop_since_save_marks_iterate(OopClosureType* blk) { + _promoInfo.promoted_oops_iterate(blk); + + // This also restores any displaced headers and removes the elements from + // the iteration set as they are processed, so that we have a clean slate + // at the end of the iteration. Note, thus, that if new objects are + // promoted as a result of the iteration they are iterated over as well. + assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); +} + +#endif // SHARE_GC_CMS_COMPACTIBLEFREELISTSPACE_INLINE_HPP diff --git a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp index 7492c96b81a..3812f861c7b 100644 --- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp @@ -36,6 +36,7 @@ #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" #include "gc/cms/concurrentMarkSweepThread.hpp" #include "gc/cms/parNewGeneration.hpp" +#include "gc/cms/promotionInfo.inline.hpp" #include "gc/cms/vmCMSOperations.hpp" #include "gc/serial/genMarkSweep.hpp" #include "gc/serial/tenuredGeneration.hpp" @@ -54,6 +55,7 @@ #include "gc/shared/genOopClosures.inline.hpp" #include "gc/shared/isGCActiveMark.hpp" #include "gc/shared/referencePolicy.hpp" +#include "gc/shared/space.inline.hpp" #include "gc/shared/strongRootsScope.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "gc/shared/weakProcessor.hpp" @@ -602,8 +604,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, // Support for parallelizing young gen rescan CMSHeap* heap = CMSHeap::heap(); - assert(heap->young_gen()->kind() == Generation::ParNew, "CMS can only be used with ParNew"); - _young_gen = (ParNewGeneration*)heap->young_gen(); + _young_gen = heap->young_gen(); if (heap->supports_inline_contig_alloc()) { _top_addr = heap->top_addr(); _end_addr = heap->end_addr(); @@ -770,7 +771,6 @@ void ConcurrentMarkSweepGeneration::compute_new_size_free_list() { log.trace(" Capacity " SIZE_FORMAT, capacity() / 1000); log.trace(" Desired capacity " SIZE_FORMAT, desired_capacity / 1000); CMSHeap* heap = CMSHeap::heap(); - assert(heap->is_old_gen(this), "The CMS generation should always be the old generation"); size_t young_size = heap->young_gen()->capacity(); log.trace(" Young gen size " SIZE_FORMAT, young_size / 1000); log.trace(" unsafe_max_alloc_nogc " SIZE_FORMAT, unsafe_max_alloc_nogc() / 1000); @@ -1101,7 +1101,7 @@ ConcurrentMarkSweepGeneration:: par_oop_since_save_marks_iterate_done(int thread_num) { CMSParGCThreadState* ps = _par_gc_thread_states[thread_num]; ParScanWithoutBarrierClosure* dummy_cl = NULL; - ps->promo.promoted_oops_iterate_nv(dummy_cl); + ps->promo.promoted_oops_iterate(dummy_cl); // Because card-scanning has been completed, subsequent phases // (e.g., reference processing) will not need to recognize which @@ -2463,18 +2463,6 @@ bool ConcurrentMarkSweepGeneration::no_allocs_since_save_marks() { return cmsSpace()->no_allocs_since_save_marks(); } -#define CMS_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix) \ - \ -void ConcurrentMarkSweepGeneration:: \ -oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) { \ - cl->set_generation(this); \ - cmsSpace()->oop_since_save_marks_iterate##nv_suffix(cl); \ - cl->reset_generation(); \ - save_marks(); \ -} - -ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DEFN) - void ConcurrentMarkSweepGeneration::oop_iterate(ExtendedOopClosure* cl) { if (freelistLock()->owned_by_self()) { @@ -5266,16 +5254,7 @@ void CMSCollector::refProcessingWork() { restore_preserved_marks_if_any(); // done single-threaded for now rp->set_enqueuing_is_done(true); - if (rp->processing_is_mt()) { - rp->balance_all_queues(); - CMSRefProcTaskExecutor task_executor(*this); - rp->enqueue_discovered_references(&task_executor, &pt); - } else { - rp->enqueue_discovered_references(NULL, &pt); - } rp->verify_no_references_recorded(); - pt.print_enqueue_phase(); - assert(!rp->discovery_enabled(), "should have been disabled"); } #ifndef PRODUCT diff --git a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp index 961600ec20b..37d011aa762 100644 --- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp +++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp @@ -1195,12 +1195,8 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { virtual void safe_object_iterate(ObjectClosure* cl); virtual void object_iterate(ObjectClosure* cl); - // Need to declare the full complement of closures, whether we'll - // override them or not, or get message from the compiler: - // oop_since_save_marks_iterate_nv hides virtual function... - #define CMS_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ - void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl); - ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DECL) + template + void oop_since_save_marks_iterate(OopClosureType* cl); // Smart allocation XXX -- move to CFLSpace? void setNearLargestChunk(); diff --git a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.inline.hpp b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.inline.hpp index ff04458a439..a8c711b4c9c 100644 --- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.inline.hpp +++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.inline.hpp @@ -27,7 +27,7 @@ #include "gc/cms/cmsHeap.hpp" #include "gc/cms/cmsLockVerifier.hpp" -#include "gc/cms/compactibleFreeListSpace.hpp" +#include "gc/cms/compactibleFreeListSpace.inline.hpp" #include "gc/cms/concurrentMarkSweepGeneration.hpp" #include "gc/cms/concurrentMarkSweepThread.hpp" #include "gc/cms/parNewGeneration.hpp" @@ -375,6 +375,14 @@ inline MemRegion ConcurrentMarkSweepGeneration::used_region_at_save_marks() cons return _cmsSpace->used_region_at_save_marks(); } +template +void ConcurrentMarkSweepGeneration::oop_since_save_marks_iterate(OopClosureType* cl) { + cl->set_generation(this); + cmsSpace()->oop_since_save_marks_iterate(cl); + cl->reset_generation(); + save_marks(); +} + inline void MarkFromRootsClosure::do_yield_check() { if (ConcurrentMarkSweepThread::should_yield() && !_collector->foregroundGCIsActive() && diff --git a/src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp b/src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp index 777ed6ce13d..bb3282634ce 100644 --- a/src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp +++ b/src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp @@ -126,7 +126,7 @@ JVMFlag::Error CMSOldPLABMaxConstraintFunc(size_t value, bool verbose) { static JVMFlag::Error CMSReservedAreaConstraintFunc(const char* name, size_t value, bool verbose) { if (UseConcMarkSweepGC) { - ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*)GenCollectedHeap::heap()->old_gen(); + ConcurrentMarkSweepGeneration* cms = CMSHeap::heap()->old_gen(); const size_t ergo_max = cms->cmsSpace()->max_flag_size_for_task_size(); if (value > ergo_max) { CommandLineError::print(verbose, @@ -189,7 +189,7 @@ JVMFlag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) { JVMFlag::Error CMSSamplingGrainConstraintFunc(uintx value, bool verbose) { if (UseConcMarkSweepGC) { - size_t max_capacity = GenCollectedHeap::heap()->young_gen()->max_capacity(); + size_t max_capacity = CMSHeap::heap()->young_gen()->max_capacity(); if (value > max_uintx - max_capacity) { CommandLineError::print(verbose, "CMSSamplingGrain (" UINTX_FORMAT ") must be " @@ -212,7 +212,7 @@ JVMFlag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose) { // Skip for current default value. if (UseConcMarkSweepGC && FLAG_IS_CMDLINE(CMSBitMapYieldQuantum)) { // CMSBitMapYieldQuantum should be compared with mark bitmap size. - ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*)GenCollectedHeap::heap()->old_gen(); + ConcurrentMarkSweepGeneration* cms = CMSHeap::heap()->old_gen(); size_t bitmap_size = cms->collector()->markBitMap()->sizeInWords(); if (value > bitmap_size) { diff --git a/src/hotspot/share/gc/cms/parNewGeneration.cpp b/src/hotspot/share/gc/cms/parNewGeneration.cpp index cfde8aa51de..0e9232095f7 100644 --- a/src/hotspot/share/gc/cms/parNewGeneration.cpp +++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "gc/cms/cmsHeap.hpp" +#include "gc/cms/cmsHeap.inline.hpp" #include "gc/cms/compactibleFreeListSpace.hpp" #include "gc/cms/concurrentMarkSweepGeneration.hpp" #include "gc/cms/parNewGeneration.inline.hpp" @@ -36,7 +36,6 @@ #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" -#include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/genOopClosures.inline.hpp" #include "gc/shared/generation.hpp" #include "gc/shared/plab.inline.hpp" @@ -836,20 +835,19 @@ ScanClosureWithParBarrier(ParNewGeneration* g, bool gc_barrier) : ScanClosure(g, gc_barrier) { } -EvacuateFollowersClosureGeneral:: +template +EvacuateFollowersClosureGeneral:: EvacuateFollowersClosureGeneral(CMSHeap* heap, - OopsInGenClosure* cur, - OopsInGenClosure* older) : + OopClosureType1* cur, + OopClosureType2* older) : _heap(heap), _scan_cur_or_nonheap(cur), _scan_older(older) { } -void EvacuateFollowersClosureGeneral::do_void() { +template +void EvacuateFollowersClosureGeneral::do_void() { do { - // Beware: this call will lead to closure applications via virtual - // calls. - _heap->oop_since_save_marks_iterate(GenCollectedHeap::YoungGen, - _scan_cur_or_nonheap, + _heap->oop_since_save_marks_iterate(_scan_cur_or_nonheap, _scan_older); } while (!_heap->no_allocs_since_save_marks()); } @@ -977,8 +975,8 @@ void ParNewGeneration::collect(bool full, ScanClosure scan_without_gc_barrier(this, false); ScanClosureWithParBarrier scan_with_gc_barrier(this, true); set_promo_failure_scan_stack_closure(&scan_without_gc_barrier); - EvacuateFollowersClosureGeneral evacuate_followers(gch, - &scan_without_gc_barrier, &scan_with_gc_barrier); + EvacuateFollowersClosureGeneral evacuate_followers( + gch, &scan_without_gc_barrier, &scan_with_gc_barrier); rp->setup_policy(clear_all_soft_refs); // Can the mt_degree be set later (at run_task() time would be best)? rp->set_active_mt_degree(active_workers); @@ -1056,18 +1054,10 @@ void ParNewGeneration::collect(bool full, update_time_of_last_gc(now); rp->set_enqueuing_is_done(true); - if (rp->processing_is_mt()) { - ParNewRefProcTaskExecutor task_executor(*this, *_old_gen, thread_state_set); - rp->enqueue_discovered_references(&task_executor, &pt); - } else { - rp->enqueue_discovered_references(NULL, &pt); - } rp->verify_no_references_recorded(); gch->trace_heap_after_gc(gc_tracer()); - pt.print_enqueue_phase(); - _gc_timer->register_gc_end(); _gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions()); diff --git a/src/hotspot/share/gc/cms/parNewGeneration.hpp b/src/hotspot/share/gc/cms/parNewGeneration.hpp index a27c7c36c43..04439d45099 100644 --- a/src/hotspot/share/gc/cms/parNewGeneration.hpp +++ b/src/hotspot/share/gc/cms/parNewGeneration.hpp @@ -258,15 +258,16 @@ class KeepAliveClosure: public DefNewGeneration::KeepAliveClosure { virtual void do_oop(narrowOop* p); }; +template class EvacuateFollowersClosureGeneral: public VoidClosure { private: CMSHeap* _heap; - OopsInGenClosure* _scan_cur_or_nonheap; - OopsInGenClosure* _scan_older; + OopClosureType1* _scan_cur_or_nonheap; + OopClosureType2* _scan_older; public: EvacuateFollowersClosureGeneral(CMSHeap* heap, - OopsInGenClosure* cur, - OopsInGenClosure* older); + OopClosureType1* cur, + OopClosureType2* older); virtual void do_void(); }; diff --git a/src/hotspot/share/gc/cms/promotionInfo.cpp b/src/hotspot/share/gc/cms/promotionInfo.cpp index f6979bc72dd..971368c121d 100644 --- a/src/hotspot/share/gc/cms/promotionInfo.cpp +++ b/src/hotspot/share/gc/cms/promotionInfo.cpp @@ -60,60 +60,6 @@ inline void PromotedObject::setNext(PromotedObject* x) { assert(!((FreeChunk*)this)->is_free(), "Error"); } -////////////////////////////////////////////////////////////////////////////// -// We go over the list of promoted objects, removing each from the list, -// and applying the closure (this may, in turn, add more elements to -// the tail of the promoted list, and these newly added objects will -// also be processed) until the list is empty. -// To aid verification and debugging, in the non-product builds -// we actually forward _promoHead each time we process a promoted oop. -// Note that this is not necessary in general (i.e. when we don't need to -// call PromotionInfo::verify()) because oop_iterate can only add to the -// end of _promoTail, and never needs to look at _promoHead. - -#define PROMOTED_OOPS_ITERATE_DEFN(OopClosureType, nv_suffix) \ - \ -void PromotionInfo::promoted_oops_iterate##nv_suffix(OopClosureType* cl) { \ - NOT_PRODUCT(verify()); \ - PromotedObject *curObj, *nextObj; \ - for (curObj = _promoHead; curObj != NULL; curObj = nextObj) { \ - if ((nextObj = curObj->next()) == NULL) { \ - /* protect ourselves against additions due to closure application \ - below by resetting the list. */ \ - assert(_promoTail == curObj, "Should have been the tail"); \ - _promoHead = _promoTail = NULL; \ - } \ - if (curObj->hasDisplacedMark()) { \ - /* restore displaced header */ \ - oop(curObj)->set_mark_raw(nextDisplacedHeader()); \ - } else { \ - /* restore prototypical header */ \ - oop(curObj)->init_mark_raw(); \ - } \ - /* The "promoted_mark" should now not be set */ \ - assert(!curObj->hasPromotedMark(), \ - "Should have been cleared by restoring displaced mark-word"); \ - NOT_PRODUCT(_promoHead = nextObj); \ - if (cl != NULL) oop(curObj)->oop_iterate(cl); \ - if (nextObj == NULL) { /* start at head of list reset above */ \ - nextObj = _promoHead; \ - } \ - } \ - assert(noPromotions(), "post-condition violation"); \ - assert(_promoHead == NULL && _promoTail == NULL, "emptied promoted list");\ - assert(_spoolHead == _spoolTail, "emptied spooling buffers"); \ - assert(_firstIndex == _nextIndex, "empty buffer"); \ -} - -// This should have been ALL_SINCE_...() just like the others, -// but, because the body of the method above is somehwat longer, -// the MSVC compiler cannot cope; as a workaround, we split the -// macro into its 3 constituent parts below (see original macro -// definition in specializedOopClosures.hpp). -SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(PROMOTED_OOPS_ITERATE_DEFN) -PROMOTED_OOPS_ITERATE_DEFN(OopsInGenClosure,_v) - - // Return the next displaced header, incrementing the pointer and // recycling spool area as necessary. markOop PromotionInfo::nextDisplacedHeader() { diff --git a/src/hotspot/share/gc/cms/promotionInfo.hpp b/src/hotspot/share/gc/cms/promotionInfo.hpp index 821eb2b5d66..aa2de84b77b 100644 --- a/src/hotspot/share/gc/cms/promotionInfo.hpp +++ b/src/hotspot/share/gc/cms/promotionInfo.hpp @@ -165,13 +165,10 @@ class PromotionInfo { bool ensure_spooling_space() { return has_spooling_space() || ensure_spooling_space_work(); } - #define PROMOTED_OOPS_ITERATE_DECL(OopClosureType, nv_suffix) \ - void promoted_oops_iterate##nv_suffix(OopClosureType* cl); - ALL_SINCE_SAVE_MARKS_CLOSURES(PROMOTED_OOPS_ITERATE_DECL) - #undef PROMOTED_OOPS_ITERATE_DECL - void promoted_oops_iterate(OopsInGenClosure* cl) { - promoted_oops_iterate_v(cl); - } + + template + void promoted_oops_iterate(OopClosureType* cl); + void verify() const; void reset() { _promoHead = NULL; diff --git a/src/hotspot/share/gc/cms/promotionInfo.inline.hpp b/src/hotspot/share/gc/cms/promotionInfo.inline.hpp new file mode 100644 index 00000000000..97a71ede522 --- /dev/null +++ b/src/hotspot/share/gc/cms/promotionInfo.inline.hpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2010, 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. + * + */ + +#ifndef SHARE_GC_CMS_PROMOTIONINFO_INLINE_HPP +#define SHARE_GC_CMS_PROMOTIONINFO_INLINE_HPP + +#include "gc/cms/promotionInfo.hpp" +#include "oops/oop.inline.hpp" +#include "utilities/debug.hpp" +#include "utilities/macros.hpp" + +////////////////////////////////////////////////////////////////////////////// +// We go over the list of promoted objects, removing each from the list, +// and applying the closure (this may, in turn, add more elements to +// the tail of the promoted list, and these newly added objects will +// also be processed) until the list is empty. +// To aid verification and debugging, in the non-product builds +// we actually forward _promoHead each time we process a promoted oop. +// Note that this is not necessary in general (i.e. when we don't need to +// call PromotionInfo::verify()) because oop_iterate can only add to the +// end of _promoTail, and never needs to look at _promoHead. + +template +void PromotionInfo::promoted_oops_iterate(OopClosureType* cl) { + NOT_PRODUCT(verify()); + PromotedObject *curObj, *nextObj; + for (curObj = _promoHead; curObj != NULL; curObj = nextObj) { + if ((nextObj = curObj->next()) == NULL) { + /* protect ourselves against additions due to closure application + below by resetting the list. */ + assert(_promoTail == curObj, "Should have been the tail"); + _promoHead = _promoTail = NULL; + } + if (curObj->hasDisplacedMark()) { + /* restore displaced header */ + oop(curObj)->set_mark_raw(nextDisplacedHeader()); + } else { + /* restore prototypical header */ + oop(curObj)->init_mark_raw(); + } + /* The "promoted_mark" should now not be set */ + assert(!curObj->hasPromotedMark(), + "Should have been cleared by restoring displaced mark-word"); + NOT_PRODUCT(_promoHead = nextObj); + if (cl != NULL) oop(curObj)->oop_iterate(cl); + if (nextObj == NULL) { /* start at head of list reset above */ + nextObj = _promoHead; + } + } + assert(noPromotions(), "post-condition violation"); + assert(_promoHead == NULL && _promoTail == NULL, "emptied promoted list"); + assert(_spoolHead == _spoolTail, "emptied spooling buffers"); + assert(_firstIndex == _nextIndex, "empty buffer"); +} + +#endif // SHARE_GC_CMS_PROMOTIONINFO_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 4151ae46d95..63fabf97ae9 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -3879,7 +3879,6 @@ void G1STWRefProcTaskExecutor::execute(EnqueueTask& enq_task) { // End of weak reference support closures -// Weak Reference processing during an evacuation pause (part 1). void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) { double ref_proc_start = os::elapsedTime(); @@ -3939,42 +3938,15 @@ void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per // We have completed copying any necessary live referent objects. assert(pss->queue_is_empty(), "both queue and overflow should be empty"); + make_pending_list_reachable(); + + rp->verify_no_references_recorded(); + double ref_proc_time = os::elapsedTime() - ref_proc_start; g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0); } -// Weak Reference processing during an evacuation pause (part 2). -void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states) { - double ref_enq_start = os::elapsedTime(); - - ReferenceProcessor* rp = _ref_processor_stw; - assert(!rp->discovery_enabled(), "should have been disabled as part of processing"); - - ReferenceProcessorPhaseTimes* pt = g1_policy()->phase_times()->ref_phase_times(); - - // Now enqueue any remaining on the discovered lists on to - // the pending list. - if (!rp->processing_is_mt()) { - // Serial reference processing... - rp->enqueue_discovered_references(NULL, pt); - } else { - // Parallel reference enqueueing - - uint n_workers = workers()->active_workers(); - - assert(n_workers <= rp->max_num_queues(), - "Mismatch between the number of GC workers %u and the maximum number of Reference process queues %u", - n_workers, rp->max_num_queues()); - - G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, n_workers); - rp->enqueue_discovered_references(&par_task_executor, pt); - } - - rp->verify_no_references_recorded(); - assert(!rp->discovery_enabled(), "should have been disabled"); - - // If during an initial mark pause we install a pending list head which is not otherwise reachable - // ensure that it is marked in the bitmap for concurrent marking to discover. +void G1CollectedHeap::make_pending_list_reachable() { if (collector_state()->in_initial_mark_gc()) { oop pll_head = Universe::reference_pending_list(); if (pll_head != NULL) { @@ -3982,14 +3954,6 @@ void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadStateSet* per _cm->mark_in_next_bitmap(0 /* worker_id */, pll_head); } } - - // FIXME - // CM's reference processing also cleans up the string and symbol tables. - // Should we do that here also? We could, but it is a serial operation - // and could significantly increase the pause time. - - double ref_enq_time = os::elapsedTime() - ref_enq_start; - g1_policy()->phase_times()->record_ref_enq_time(ref_enq_time * 1000.0); } void G1CollectedHeap::merge_per_thread_state_info(G1ParScanThreadStateSet* per_thread_states) { @@ -4069,7 +4033,11 @@ void G1CollectedHeap::post_evacuate_collection_set(EvacuationInfo& evacuation_in // objects (and their reachable sub-graphs) that were // not copied during the pause. process_discovered_references(per_thread_states); - enqueue_discovered_references(per_thread_states); + + // FIXME + // CM's reference processing also cleans up the string and symbol tables. + // Should we do that here also? We could, but it is a serial operation + // and could significantly increase the pause time. G1STWIsAliveClosure is_alive(this); G1KeepAliveClosure keep_alive(this); diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 69d8658ab55..dd964635447 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -513,13 +513,13 @@ private: // allocated block, or else "NULL". HeapWord* expand_and_allocate(size_t word_size); - // Process any reference objects discovered during - // an incremental evacuation pause. + // Process any reference objects discovered. void process_discovered_references(G1ParScanThreadStateSet* per_thread_states); - // Enqueue any remaining discovered references - // after processing. - void enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states); + // If during an initial mark pause we may install a pending list head which is not + // otherwise reachable ensure that it is marked in the bitmap for concurrent marking + // to discover. + void make_pending_list_reachable(); // Merges the information gathered on a per-thread basis for all worker threads // during GC into global variables. diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 6bd23048332..35d4cb26620 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -1677,12 +1677,7 @@ void G1ConcurrentMark::weak_refs_work(bool clear_all_soft_refs) { assert(rp->num_queues() == active_workers, "why not"); - rp->enqueue_discovered_references(executor, &pt); - rp->verify_no_references_recorded(); - - pt.print_enqueue_phase(); - assert(!rp->discovery_enabled(), "Post condition"); } diff --git a/src/hotspot/share/gc/g1/g1FullGCReferenceProcessorExecutor.cpp b/src/hotspot/share/gc/g1/g1FullGCReferenceProcessorExecutor.cpp index f54458f052f..1b5da52b9a7 100644 --- a/src/hotspot/share/gc/g1/g1FullGCReferenceProcessorExecutor.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCReferenceProcessorExecutor.cpp @@ -108,8 +108,4 @@ void G1FullGCReferenceProcessingExecutor::execute(STWGCTimer* timer, G1FullGCTra pt.print_all_references(); assert(marker->oop_stack()->is_empty(), "Should be no oops on the stack"); - - // Now enqueue the references. - _reference_processor->enqueue_discovered_references(executor, &pt); - pt.print_enqueue_phase(); } diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp index c2f1d850396..50662f273a5 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp @@ -129,7 +129,6 @@ void G1GCPhaseTimes::reset() { _cur_clear_ct_time_ms = 0.0; _cur_expand_heap_time_ms = 0.0; _cur_ref_proc_time_ms = 0.0; - _cur_ref_enq_time_ms = 0.0; _cur_weak_ref_proc_time_ms = 0.0; _cur_collection_start_sec = 0.0; _root_region_scan_wait_time_ms = 0.0; @@ -383,7 +382,6 @@ double G1GCPhaseTimes::print_post_evacuate_collection_set() const { _recorded_preserve_cm_referents_time_ms + _cur_ref_proc_time_ms + _cur_weak_ref_proc_time_ms + - _cur_ref_enq_time_ms + _cur_clear_ct_time_ms + _recorded_merge_pss_time_ms + _cur_strong_code_root_purge_time_ms + @@ -416,9 +414,6 @@ double G1GCPhaseTimes::print_post_evacuate_collection_set() const { trace_time("Remove Self Forwards",_cur_evac_fail_remove_self_forwards); } - debug_time_for_reference("Reference Enqueuing", _cur_ref_enq_time_ms); - _ref_phase_times.print_enqueue_phase(2, false); - debug_time("Merge Per-Thread State", _recorded_merge_pss_time_ms); debug_time("Code Roots Purge", _cur_strong_code_root_purge_time_ms); diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp index b2a9a906249..d5ec33400c0 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp @@ -261,10 +261,6 @@ class G1GCPhaseTimes : public CHeapObj { _cur_weak_ref_proc_time_ms = ms; } - void record_ref_enq_time(double ms) { - _cur_ref_enq_time_ms = ms; - } - void record_root_region_scan_wait_time(double time_ms) { _root_region_scan_wait_time_ms = time_ms; } diff --git a/src/hotspot/share/gc/parallel/psMarkSweep.cpp b/src/hotspot/share/gc/parallel/psMarkSweep.cpp index 61afff6269a..e793ddfad71 100644 --- a/src/hotspot/share/gc/parallel/psMarkSweep.cpp +++ b/src/hotspot/share/gc/parallel/psMarkSweep.cpp @@ -260,11 +260,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { DerivedPointerTable::update_pointers(); #endif - ReferenceProcessorPhaseTimes pt(_gc_timer, ref_processor()->num_queues()); - - ref_processor()->enqueue_discovered_references(NULL, &pt); - - pt.print_enqueue_phase(); + assert(!ref_processor()->discovery_enabled(), "Should have been disabled earlier"); // Update time of last GC reset_millis_since_last_gc(); diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index bca79105c9b..ae5851a906a 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -1038,12 +1038,6 @@ void PSParallelCompact::post_compact() DerivedPointerTable::update_pointers(); #endif - ReferenceProcessorPhaseTimes pt(&_gc_timer, ref_processor()->num_queues()); - - ref_processor()->enqueue_discovered_references(NULL, &pt); - - pt.print_enqueue_phase(); - if (ZapUnusedHeapArea) { heap->gen_mangle_unused_area(); } diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp index c6f043ba110..64ff0b8a38b 100644 --- a/src/hotspot/share/gc/parallel/psScavenge.cpp +++ b/src/hotspot/share/gc/parallel/psScavenge.cpp @@ -430,16 +430,6 @@ bool PSScavenge::invoke_no_policy() { _gc_tracer.report_gc_reference_stats(stats); pt.print_all_references(); - - // Enqueue reference objects discovered during scavenge. - if (reference_processor()->processing_is_mt()) { - PSRefProcTaskExecutor task_executor; - reference_processor()->enqueue_discovered_references(&task_executor, &pt); - } else { - reference_processor()->enqueue_discovered_references(NULL, &pt); - } - - pt.print_enqueue_phase(); } assert(promotion_manager->stacks_empty(),"stacks should be empty at this point"); diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 51bf6c0f226..0413e9c71ac 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -24,6 +24,8 @@ #include "precompiled.hpp" #include "gc/serial/defNewGeneration.inline.hpp" +#include "gc/serial/serialHeap.inline.hpp" +#include "gc/serial/tenuredGeneration.hpp" #include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/ageTable.inline.hpp" #include "gc/shared/cardTableRS.hpp" @@ -34,7 +36,6 @@ #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" -#include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/genOopClosures.inline.hpp" #include "gc/shared/generationSpec.hpp" #include "gc/shared/preservedMarks.inline.hpp" @@ -56,9 +57,6 @@ #include "utilities/copy.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/stack.inline.hpp" -#if INCLUDE_CMSGC -#include "gc/cms/parOopClosures.hpp" -#endif // // DefNewGeneration functions. @@ -92,34 +90,19 @@ FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl) : void DefNewGeneration::FastKeepAliveClosure::do_oop(oop* p) { DefNewGeneration::FastKeepAliveClosure::do_oop_work(p); } void DefNewGeneration::FastKeepAliveClosure::do_oop(narrowOop* p) { DefNewGeneration::FastKeepAliveClosure::do_oop_work(p); } -DefNewGeneration::EvacuateFollowersClosure:: -EvacuateFollowersClosure(GenCollectedHeap* gch, - ScanClosure* cur, - ScanClosure* older) : - _gch(gch), _scan_cur_or_nonheap(cur), _scan_older(older) -{} - -void DefNewGeneration::EvacuateFollowersClosure::do_void() { - do { - _gch->oop_since_save_marks_iterate(GenCollectedHeap::YoungGen, _scan_cur_or_nonheap, _scan_older); - } while (!_gch->no_allocs_since_save_marks()); -} - DefNewGeneration::FastEvacuateFollowersClosure:: -FastEvacuateFollowersClosure(GenCollectedHeap* gch, +FastEvacuateFollowersClosure(SerialHeap* heap, FastScanClosure* cur, FastScanClosure* older) : - _gch(gch), _scan_cur_or_nonheap(cur), _scan_older(older) + _heap(heap), _scan_cur_or_nonheap(cur), _scan_older(older) { - assert(_gch->young_gen()->kind() == Generation::DefNew, "Generation should be DefNew"); - _young_gen = (DefNewGeneration*)_gch->young_gen(); } void DefNewGeneration::FastEvacuateFollowersClosure::do_void() { do { - _gch->oop_since_save_marks_iterate(GenCollectedHeap::YoungGen, _scan_cur_or_nonheap, _scan_older); - } while (!_gch->no_allocs_since_save_marks()); - guarantee(_young_gen->promo_failure_scan_is_complete(), "Failed to finish scan"); + _heap->oop_since_save_marks_iterate(_scan_cur_or_nonheap, _scan_older); + } while (!_heap->no_allocs_since_save_marks()); + guarantee(_heap->young_gen()->promo_failure_scan_is_complete(), "Failed to finish scan"); } ScanClosure::ScanClosure(DefNewGeneration* g, bool gc_barrier) : @@ -576,29 +559,29 @@ void DefNewGeneration::collect(bool full, bool is_tlab) { assert(full || size > 0, "otherwise we don't want to collect"); - GenCollectedHeap* gch = GenCollectedHeap::heap(); + SerialHeap* heap = SerialHeap::heap(); _gc_timer->register_gc_start(); DefNewTracer gc_tracer; - gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start()); + gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer->gc_start()); - _old_gen = gch->old_gen(); + _old_gen = heap->old_gen(); // If the next generation is too full to accommodate promotion // from this generation, pass on collection; let the next generation // do it. if (!collection_attempt_is_safe()) { log_trace(gc)(":: Collection attempt not safe ::"); - gch->set_incremental_collection_failed(); // Slight lie: we did not even attempt one + heap->set_incremental_collection_failed(); // Slight lie: we did not even attempt one return; } assert(to()->is_empty(), "Else not collection_attempt_is_safe"); init_assuming_no_promotion_failure(); - GCTraceTime(Trace, gc, phases) tm("DefNew", NULL, gch->gc_cause()); + GCTraceTime(Trace, gc, phases) tm("DefNew", NULL, heap->gc_cause()); - gch->trace_heap_before_gc(&gc_tracer); + heap->trace_heap_before_gc(&gc_tracer); // These can be shared for all code paths IsAliveClosure is_alive(this); @@ -609,23 +592,23 @@ void DefNewGeneration::collect(bool full, // The preserved marks should be empty at the start of the GC. _preserved_marks_set.init(1); - gch->rem_set()->prepare_for_younger_refs_iterate(false); + heap->rem_set()->prepare_for_younger_refs_iterate(false); - assert(gch->no_allocs_since_save_marks(), + assert(heap->no_allocs_since_save_marks(), "save marks have not been newly set."); FastScanClosure fsc_with_no_gc_barrier(this, false); FastScanClosure fsc_with_gc_barrier(this, true); CLDScanClosure cld_scan_closure(&fsc_with_no_gc_barrier, - gch->rem_set()->cld_rem_set()->accumulate_modified_oops()); + heap->rem_set()->cld_rem_set()->accumulate_modified_oops()); set_promo_failure_scan_stack_closure(&fsc_with_no_gc_barrier); - FastEvacuateFollowersClosure evacuate_followers(gch, + FastEvacuateFollowersClosure evacuate_followers(heap, &fsc_with_no_gc_barrier, &fsc_with_gc_barrier); - assert(gch->no_allocs_since_save_marks(), + assert(heap->no_allocs_since_save_marks(), "save marks have not been newly set."); { @@ -634,10 +617,10 @@ void DefNewGeneration::collect(bool full, // See: CardTableRS::non_clean_card_iterate_possibly_parallel. StrongRootsScope srs(0); - gch->young_process_roots(&srs, - &fsc_with_no_gc_barrier, - &fsc_with_gc_barrier, - &cld_scan_closure); + heap->young_process_roots(&srs, + &fsc_with_no_gc_barrier, + &fsc_with_gc_barrier, + &cld_scan_closure); } // "evacuate followers". @@ -654,12 +637,12 @@ void DefNewGeneration::collect(bool full, gc_tracer.report_tenuring_threshold(tenuring_threshold()); pt.print_all_references(); - assert(gch->no_allocs_since_save_marks(), "save marks have not been newly set."); + assert(heap->no_allocs_since_save_marks(), "save marks have not been newly set."); WeakProcessor::weak_oops_do(&is_alive, &keep_alive); // Verify that the usage of keep_alive didn't copy any objects. - assert(gch->no_allocs_since_save_marks(), "save marks have not been newly set."); + assert(heap->no_allocs_since_save_marks(), "save marks have not been newly set."); if (!_promotion_failed) { // Swap the survivor spaces. @@ -683,9 +666,9 @@ void DefNewGeneration::collect(bool full, // A successful scavenge should restart the GC time limit count which is // for full GC's. - AdaptiveSizePolicy* size_policy = gch->size_policy(); + AdaptiveSizePolicy* size_policy = heap->size_policy(); size_policy->reset_gc_overhead_limit_count(); - assert(!gch->incremental_collection_failed(), "Should be clear"); + assert(!heap->incremental_collection_failed(), "Should be clear"); } else { assert(_promo_failure_scan_stack.is_empty(), "post condition"); _promo_failure_scan_stack.clear(true); // Clear cached segments. @@ -699,14 +682,14 @@ void DefNewGeneration::collect(bool full, // and from-space. swap_spaces(); // For uniformity wrt ParNewGeneration. from()->set_next_compaction_space(to()); - gch->set_incremental_collection_failed(); + heap->set_incremental_collection_failed(); // Inform the next generation that a promotion failure occurred. _old_gen->promotion_failure_occurred(); gc_tracer.report_promotion_failed(_promotion_failed_info); // Reset the PromotionFailureALot counters. - NOT_PRODUCT(gch->reset_promotion_should_fail();) + NOT_PRODUCT(heap->reset_promotion_should_fail();) } // We should have processed and cleared all the preserved marks. _preserved_marks_set.reclaim(); @@ -720,7 +703,7 @@ void DefNewGeneration::collect(bool full, jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; update_time_of_last_gc(now); - gch->trace_heap_after_gc(&gc_tracer); + heap->trace_heap_after_gc(&gc_tracer); _gc_timer->register_gc_end(); @@ -828,22 +811,6 @@ bool DefNewGeneration::no_allocs_since_save_marks() { return to()->saved_mark_at_top(); } -#define DefNew_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix) \ - \ -void DefNewGeneration:: \ -oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) { \ - cl->set_generation(this); \ - eden()->oop_since_save_marks_iterate##nv_suffix(cl); \ - to()->oop_since_save_marks_iterate##nv_suffix(cl); \ - from()->oop_since_save_marks_iterate##nv_suffix(cl); \ - cl->reset_generation(); \ - save_marks(); \ -} - -ALL_SINCE_SAVE_MARKS_CLOSURES(DefNew_SINCE_SAVE_MARKS_DEFN) - -#undef DefNew_SINCE_SAVE_MARKS_DEFN - void DefNewGeneration::contribute_scratch(ScratchBlock*& list, Generation* requestor, size_t max_alloc_words) { if (requestor == this || _promotion_failed) { @@ -1006,11 +973,9 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, bool is_tlab) { // have to use it here, as well. HeapWord* result = eden()->par_allocate(word_size); if (result != NULL) { -#if INCLUDE_CMSGC - if (CMSEdenChunksRecordAlways && _old_gen != NULL) { + if (_old_gen != NULL) { _old_gen->sample_eden_chunk(); } -#endif } else { // If the eden is full and the last collection bailed out, we are running // out of heap space, and we try to allocate the from-space, too. @@ -1024,11 +989,9 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, bool is_tlab) { HeapWord* DefNewGeneration::par_allocate(size_t word_size, bool is_tlab) { HeapWord* res = eden()->par_allocate(word_size); -#if INCLUDE_CMSGC - if (CMSEdenChunksRecordAlways && _old_gen != NULL) { + if (_old_gen != NULL) { _old_gen->sample_eden_chunk(); } -#endif return res; } diff --git a/src/hotspot/share/gc/serial/defNewGeneration.hpp b/src/hotspot/share/gc/serial/defNewGeneration.hpp index 19ca2ac4707..2263d85ff44 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp @@ -39,6 +39,7 @@ class ScanClosure; class STWGCTimer; class CSpaceCounters; class ScanWeakRefClosure; +class SerialHeap; // DefNewGeneration is a young generation containing eden, from- and // to-space. @@ -178,23 +179,12 @@ protected: virtual void do_oop(narrowOop* p); }; - class EvacuateFollowersClosure: public VoidClosure { - GenCollectedHeap* _gch; - ScanClosure* _scan_cur_or_nonheap; - ScanClosure* _scan_older; - public: - EvacuateFollowersClosure(GenCollectedHeap* gch, - ScanClosure* cur, ScanClosure* older); - void do_void(); - }; - class FastEvacuateFollowersClosure: public VoidClosure { - GenCollectedHeap* _gch; - DefNewGeneration* _young_gen; + SerialHeap* _heap; FastScanClosure* _scan_cur_or_nonheap; FastScanClosure* _scan_older; public: - FastEvacuateFollowersClosure(GenCollectedHeap* gch, + FastEvacuateFollowersClosure(SerialHeap* heap, FastScanClosure* cur, FastScanClosure* older); void do_void(); @@ -290,12 +280,8 @@ protected: // Need to declare the full complement of closures, whether we'll // override them or not, or get message from the compiler: // oop_since_save_marks_iterate_nv hides virtual function... -#define DefNew_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ - void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl); - - ALL_SINCE_SAVE_MARKS_CLOSURES(DefNew_SINCE_SAVE_MARKS_DECL) - -#undef DefNew_SINCE_SAVE_MARKS_DECL + template + void oop_since_save_marks_iterate(OopClosureType* cl); // For non-youngest collection, the DefNewGeneration can contribute // "to-space". diff --git a/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp b/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp index 49e86dfb47e..84a25410f14 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp @@ -29,7 +29,7 @@ #include "gc/shared/cardTableRS.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/genOopClosures.inline.hpp" -#include "gc/shared/space.hpp" +#include "gc/shared/space.inline.hpp" #include "oops/access.inline.hpp" // Methods of protected closure types @@ -88,4 +88,14 @@ inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) { } } +template +void DefNewGeneration::oop_since_save_marks_iterate(OopClosureType* cl) { + cl->set_generation(this); + eden()->oop_since_save_marks_iterate(cl); + to()->oop_since_save_marks_iterate(cl); + from()->oop_since_save_marks_iterate(cl); + cl->reset_generation(); + save_marks(); +} + #endif // SHARE_VM_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index 9e413a063da..c06252c614d 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -23,11 +23,19 @@ */ #include "precompiled.hpp" -#include "gc/serial/defNewGeneration.hpp" +#include "gc/serial/defNewGeneration.inline.hpp" #include "gc/serial/serialHeap.hpp" +#include "gc/serial/tenuredGeneration.inline.hpp" #include "gc/shared/genMemoryPools.hpp" #include "services/memoryManager.hpp" +SerialHeap* SerialHeap::heap() { + CollectedHeap* heap = Universe::heap(); + assert(heap != NULL, "Uninitialized access to SerialHeap::heap()"); + assert(heap->kind() == CollectedHeap::Serial, "Invalid name"); + return static_cast(heap); +} + SerialHeap::SerialHeap(GenCollectorPolicy* policy) : GenCollectedHeap(policy, Generation::DefNew, @@ -42,7 +50,7 @@ SerialHeap::SerialHeap(GenCollectorPolicy* policy) : void SerialHeap::initialize_serviceability() { - DefNewGeneration* young = (DefNewGeneration*) young_gen(); + DefNewGeneration* young = young_gen(); // Add a memory pool for each space and young gen doesn't // support low memory detection as it is expected to get filled up. @@ -54,7 +62,7 @@ void SerialHeap::initialize_serviceability() { "Survivor Space", young->max_survivor_size(), false /* support_usage_threshold */); - Generation* old = old_gen(); + TenuredGeneration* old = old_gen(); _old_pool = new GenerationPool(old, "Tenured Gen", true); _young_manager->add_pool(_eden_pool); @@ -68,13 +76,6 @@ void SerialHeap::initialize_serviceability() { } -void SerialHeap::check_gen_kinds() { - assert(young_gen()->kind() == Generation::DefNew, - "Wrong youngest generation type"); - assert(old_gen()->kind() == Generation::MarkSweepCompact, - "Wrong generation kind"); -} - GrowableArray SerialHeap::memory_managers() { GrowableArray memory_managers(2); memory_managers.append(_young_manager); diff --git a/src/hotspot/share/gc/serial/serialHeap.hpp b/src/hotspot/share/gc/serial/serialHeap.hpp index e4e5018b4c9..820e00adc71 100644 --- a/src/hotspot/share/gc/serial/serialHeap.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.hpp @@ -25,12 +25,15 @@ #ifndef SHARE_VM_GC_SERIAL_SERIALHEAP_HPP #define SHARE_VM_GC_SERIAL_SERIALHEAP_HPP +#include "gc/serial/defNewGeneration.hpp" +#include "gc/serial/tenuredGeneration.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "utilities/growableArray.hpp" class GenCollectorPolicy; class GCMemoryManager; class MemoryPool; +class TenuredGeneration; class SerialHeap : public GenCollectedHeap { private: @@ -40,10 +43,9 @@ private: virtual void initialize_serviceability(); -protected: - virtual void check_gen_kinds(); - public: + static SerialHeap* heap(); + SerialHeap(GenCollectorPolicy* policy); virtual Name kind() const { @@ -61,6 +63,24 @@ public: virtual bool is_in_closed_subset(const void* p) const { return is_in(p); } + + DefNewGeneration* young_gen() const { + assert(_young_gen->kind() == Generation::DefNew, "Wrong generation type"); + return static_cast(_young_gen); + } + + TenuredGeneration* old_gen() const { + assert(_old_gen->kind() == Generation::MarkSweepCompact, "Wrong generation type"); + return static_cast(_old_gen); + } + + // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects + // allocated since the last call to save_marks in the young generation. + // The "cur" closure is applied to references in the younger generation + // at "level", and the "older" closure to older generations. + template + void oop_since_save_marks_iterate(OopClosureType1* cur, + OopClosureType2* older); }; #endif // SHARE_VM_GC_CMS_CMSHEAP_HPP diff --git a/src/hotspot/share/gc/serial/serialHeap.inline.hpp b/src/hotspot/share/gc/serial/serialHeap.inline.hpp new file mode 100644 index 00000000000..68dd7236633 --- /dev/null +++ b/src/hotspot/share/gc/serial/serialHeap.inline.hpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017, 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. + * + */ + +#ifndef SHARE_GC_SERIAL_SERIALHEAP_INLINE_HPP +#define SHARE_GC_SERIAL_SERIALHEAP_INLINE_HPP + +#include "gc/serial/defNewGeneration.inline.hpp" +#include "gc/serial/serialHeap.hpp" +#include "gc/serial/tenuredGeneration.inline.hpp" + +template +void SerialHeap::oop_since_save_marks_iterate(OopClosureType1* cur, + OopClosureType2* older) { + young_gen()->oop_since_save_marks_iterate(cur); + old_gen()->oop_since_save_marks_iterate(older); +} + +#endif // SHARE_GC_SERIAL_SERIALHEAP_INLINE_HPP diff --git a/src/hotspot/share/gc/serial/serial_specialized_oop_closures.hpp b/src/hotspot/share/gc/serial/serial_specialized_oop_closures.hpp index bb73afcfed3..1d83aa48599 100644 --- a/src/hotspot/share/gc/serial/serial_specialized_oop_closures.hpp +++ b/src/hotspot/share/gc/serial/serial_specialized_oop_closures.hpp @@ -50,8 +50,4 @@ class AdjustPointerClosure; f(MarkAndPushClosure,_nv) \ f(AdjustPointerClosure,_nv) -#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \ - f(ScanClosure,_nv) \ - f(FastScanClosure,_nv) - #endif // SHARE_GC_SERIAL_SERIAL_SPECIALIZED_OOP_CLOSURES_HPP diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index 3396715957a..e59a1700580 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -256,20 +256,6 @@ bool TenuredGeneration::no_allocs_since_save_marks() { return _the_space->saved_mark_at_top(); } -#define TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \ - \ -void TenuredGeneration:: \ -oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \ - blk->set_generation(this); \ - _the_space->oop_since_save_marks_iterate##nv_suffix(blk); \ - blk->reset_generation(); \ - save_marks(); \ -} - -ALL_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN) - -#undef TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN - void TenuredGeneration::gc_epilogue(bool full) { // update the generation and space performance counters update_counters(); diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index 03b9e3daae1..9bd0890c707 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -75,10 +75,8 @@ class TenuredGeneration: public CardGeneration { virtual inline HeapWord* allocate(size_t word_size, bool is_tlab); virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab); -#define TenuredGen_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ - void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl); - TenuredGen_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v) - SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_DECL) + template + void oop_since_save_marks_iterate(OopClosureType* cl); void save_marks(); void reset_saved_marks(); diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp index 490f0abaa48..0e144820ece 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp @@ -26,7 +26,7 @@ #define SHARE_VM_GC_SERIAL_TENUREDGENERATION_INLINE_HPP #include "gc/serial/tenuredGeneration.hpp" -#include "gc/shared/space.hpp" +#include "gc/shared/space.inline.hpp" HeapWord* TenuredGeneration::allocate(size_t word_size, bool is_tlab) { @@ -53,4 +53,12 @@ bool TenuredGeneration::block_is_obj(const HeapWord* addr) const { return addr < _the_space ->top(); } +template +void TenuredGeneration::oop_since_save_marks_iterate(OopClosureType* blk) { + blk->set_generation(this); + _the_space->oop_since_save_marks_iterate(blk); + blk->reset_generation(); + save_marks(); +} + #endif // SHARE_VM_GC_SERIAL_TENUREDGENERATION_INLINE_HPP diff --git a/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp b/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp index 3eb94314f9c..8db1c70d5ce 100644 --- a/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp +++ b/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp @@ -87,6 +87,9 @@ LIR_Opr ModRefBarrierSetC1::resolve_address(LIRAccess& access, bool resolve_in_r DecoratorSet decorators = access.decorators(); bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0; bool is_write = (decorators & C1_WRITE_ACCESS) != 0; - resolve_in_register |= !needs_patching && is_write && access.is_oop(); + bool on_array = (decorators & IN_HEAP_ARRAY) != 0; + bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0; + bool precise = on_array || on_anonymous; + resolve_in_register |= !needs_patching && is_write && access.is_oop() && precise; return BarrierSetC1::resolve_address(access, resolve_in_register); } diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.inline.hpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.inline.hpp index abdc7e9368b..b0eb89bd342 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.inline.hpp @@ -32,9 +32,8 @@ template inline void CardTableBarrierSet::write_ref_field_post(T* field, oop newVal) { volatile jbyte* byte = _card_table->byte_for(field); - if (UseConcMarkSweepGC) { - // Perform a releasing store if using CMS so that it may - // scan and clear the cards concurrently during pre-cleaning. + if (_card_table->scanned_concurrently()) { + // Perform a releasing store if the card table is scanned concurrently OrderAccess::release_store(byte, CardTable::dirty_card_val()); } else { *byte = CardTable::dirty_card_val(); diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.cpp b/src/hotspot/share/gc/shared/genCollectedHeap.cpp index 14c29b1afc3..3062e44c5dc 100644 --- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp +++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp @@ -176,7 +176,7 @@ char* GenCollectedHeap::allocate(size_t alignment, void GenCollectedHeap::post_initialize() { CollectedHeap::post_initialize(); ref_processing_init(); - check_gen_kinds(); + DefNewGeneration* def_new_gen = (DefNewGeneration*)_young_gen; initialize_size_policy(def_new_gen->eden()->capacity(), @@ -249,7 +249,7 @@ unsigned int GenCollectedHeap::update_full_collections_completed(unsigned int co // was a full collection because a partial collection (would // have) failed and is likely to fail again bool GenCollectedHeap::should_try_older_generation_allocation(size_t word_size) const { - size_t young_capacity = young_gen()->capacity_before_gc(); + size_t young_capacity = _young_gen->capacity_before_gc(); return (word_size > heap_word_size(young_capacity)) || GCLocker::is_active_and_needs_gc() || incremental_collection_failed(); @@ -257,12 +257,12 @@ bool GenCollectedHeap::should_try_older_generation_allocation(size_t word_size) HeapWord* GenCollectedHeap::expand_heap_and_allocate(size_t size, bool is_tlab) { HeapWord* result = NULL; - if (old_gen()->should_allocate(size, is_tlab)) { - result = old_gen()->expand_and_allocate(size, is_tlab); + if (_old_gen->should_allocate(size, is_tlab)) { + result = _old_gen->expand_and_allocate(size, is_tlab); } if (result == NULL) { - if (young_gen()->should_allocate(size, is_tlab)) { - result = young_gen()->expand_and_allocate(size, is_tlab); + if (_young_gen->should_allocate(size, is_tlab)) { + result = _young_gen->expand_and_allocate(size, is_tlab); } } assert(result == NULL || is_in_reserved(result), "result not in heap"); @@ -287,7 +287,7 @@ HeapWord* GenCollectedHeap::mem_allocate_work(size_t size, HandleMark hm; // Discard any handles allocated in each iteration. // First allocation attempt is lock-free. - Generation *young = young_gen(); + Generation *young = _young_gen; assert(young->supports_inline_contig_alloc(), "Otherwise, must do alloc within heap lock"); if (young->should_allocate(size, is_tlab)) { @@ -517,9 +517,7 @@ void GenCollectedHeap::collect_generation(Generation* gen, bool full, size_t siz } gen->collect(full, clear_soft_refs, size, is_tlab); if (!rp->enqueuing_is_done()) { - ReferenceProcessorPhaseTimes pt(NULL, rp->num_queues()); - rp->enqueue_discovered_references(NULL, &pt); - pt.print_enqueue_phase(); + rp->disable_discovery(); } else { rp->set_enqueuing_is_done(false); } @@ -913,23 +911,6 @@ void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) { _old_gen->ref_processor()->weak_oops_do(root_closure); } -#define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \ -void GenCollectedHeap:: \ -oop_since_save_marks_iterate(GenerationType gen, \ - OopClosureType* cur, \ - OopClosureType* older) { \ - if (gen == YoungGen) { \ - _young_gen->oop_since_save_marks_iterate##nv_suffix(cur); \ - _old_gen->oop_since_save_marks_iterate##nv_suffix(older); \ - } else { \ - _old_gen->oop_since_save_marks_iterate##nv_suffix(cur); \ - } \ -} - -ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DEFN) - -#undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN - bool GenCollectedHeap::no_allocs_since_save_marks() { return _young_gen->no_allocs_since_save_marks() && _old_gen->no_allocs_since_save_marks(); diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.hpp b/src/hotspot/share/gc/shared/genCollectedHeap.hpp index 34008d69579..a8b4dd704f9 100644 --- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp +++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp @@ -63,10 +63,11 @@ public: OldGen }; -private: +protected: Generation* _young_gen; Generation* _old_gen; +private: GenerationSpec* _young_gen_spec; GenerationSpec* _old_gen_spec; @@ -161,8 +162,6 @@ protected: Generation::Name old, const char* policy_counters_name); - virtual void check_gen_kinds() = 0; - public: // Returns JNI_OK on success @@ -436,20 +435,6 @@ public: // in other generations, it should call this method. void save_marks(); - // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects - // allocated since the last call to save_marks in generations at or above - // "level". The "cur" closure is - // applied to references in the generation at "level", and the "older" - // closure to older generations. -#define GCH_SINCE_SAVE_MARKS_ITERATE_DECL(OopClosureType, nv_suffix) \ - void oop_since_save_marks_iterate(GenerationType start_gen, \ - OopClosureType* cur, \ - OopClosureType* older); - - ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DECL) - -#undef GCH_SINCE_SAVE_MARKS_ITERATE_DECL - // Returns "true" iff no allocations have occurred since the last // call to "save_marks". bool no_allocs_since_save_marks(); diff --git a/src/hotspot/share/gc/shared/generation.hpp b/src/hotspot/share/gc/shared/generation.hpp index b9f66799165..dc74e119833 100644 --- a/src/hotspot/share/gc/shared/generation.hpp +++ b/src/hotspot/share/gc/shared/generation.hpp @@ -442,25 +442,6 @@ class Generation: public CHeapObj { // generation since the last call to "save_marks". virtual bool no_allocs_since_save_marks() = 0; - // Apply "cl->apply" to (the addresses of) all reference fields in objects - // allocated in the current generation since the last call to "save_marks". - // If more objects are allocated in this generation as a result of applying - // the closure, iterates over reference fields in those objects as well. - // Calls "save_marks" at the end of the iteration. - // General signature... - virtual void oop_since_save_marks_iterate_v(OopsInGenClosure* cl) = 0; - // ...and specializations for de-virtualization. (The general - // implementation of the _nv versions call the virtual version. - // Note that the _nv suffix is not really semantically necessary, - // but it avoids some not-so-useful warnings on Solaris.) -#define Generation_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ - virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) { \ - oop_since_save_marks_iterate_v((OopsInGenClosure*)cl); \ - } - SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(Generation_SINCE_SAVE_MARKS_DECL) - -#undef Generation_SINCE_SAVE_MARKS_DECL - // The "requestor" generation is performing some garbage collection // action for which it would be useful to have scratch space. If // the target is not the requestor, no gc actions will be required diff --git a/src/hotspot/share/gc/shared/referenceProcessor.cpp b/src/hotspot/share/gc/shared/referenceProcessor.cpp index 96ecab83d8a..e84682afc49 100644 --- a/src/hotspot/share/gc/shared/referenceProcessor.cpp +++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp @@ -257,113 +257,6 @@ ReferenceProcessorStats ReferenceProcessor::process_discovered_references( return stats; } -void ReferenceProcessor::enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor, - ReferenceProcessorPhaseTimes* phase_times) { - // Enqueue references that are not made active again, and - // clear the decks for the next collection (cycle). - enqueue_discovered_reflists(task_executor, phase_times); - - // Stop treating discovered references specially. - disable_discovery(); -} - -void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list) { - // Given a list of refs linked through the "discovered" field - // (java.lang.ref.Reference.discovered), self-loop their "next" field - // thus distinguishing them from active References, then - // prepend them to the pending list. - // - // The Java threads will see the Reference objects linked together through - // the discovered field. Instead of trying to do the write barrier updates - // in all places in the reference processor where we manipulate the discovered - // field we make sure to do the barrier here where we anyway iterate through - // all linked Reference objects. Note that it is important to not dirty any - // cards during reference processing since this will cause card table - // verification to fail for G1. - log_develop_trace(gc, ref)("ReferenceProcessor::enqueue_discovered_reflist list " INTPTR_FORMAT, p2i(&refs_list)); - - oop obj = NULL; - oop next_discovered = refs_list.head(); - // Walk down the list, self-looping the next field - // so that the References are not considered active. - while (obj != next_discovered) { - obj = next_discovered; - assert(obj->is_instance(), "should be an instance object"); - assert(InstanceKlass::cast(obj->klass())->is_reference_instance_klass(), "should be reference object"); - next_discovered = java_lang_ref_Reference::discovered(obj); - log_develop_trace(gc, ref)(" obj " INTPTR_FORMAT "/next_discovered " INTPTR_FORMAT, p2i(obj), p2i(next_discovered)); - assert(java_lang_ref_Reference::next(obj) == NULL, - "Reference not active; should not be discovered"); - // Self-loop next, so as to make Ref not active. - java_lang_ref_Reference::set_next_raw(obj, obj); - if (next_discovered != obj) { - HeapAccess::oop_store_at(obj, java_lang_ref_Reference::discovered_offset, next_discovered); - } else { - // This is the last object. - // Swap refs_list into pending list and set obj's - // discovered to what we read from the pending list. - oop old = Universe::swap_reference_pending_list(refs_list.head()); - HeapAccess::oop_store_at(obj, java_lang_ref_Reference::discovered_offset, old); - } - } -} - -// Parallel enqueue task -class RefProcEnqueueTask: public AbstractRefProcTaskExecutor::EnqueueTask { -public: - RefProcEnqueueTask(ReferenceProcessor& ref_processor, - DiscoveredList discovered_refs[], - int n_queues, - ReferenceProcessorPhaseTimes* phase_times) - : EnqueueTask(ref_processor, discovered_refs, n_queues, phase_times) - { } - - virtual void work(unsigned int work_id) { - RefProcWorkerTimeTracker tt(ReferenceProcessorPhaseTimes::RefEnqueue, _phase_times, work_id); - - assert(work_id < (unsigned int)_ref_processor.max_num_queues(), "Index out-of-bounds"); - // Simplest first cut: static partitioning. - int index = work_id; - // The increment on "index" must correspond to the maximum number of queues - // (n_queues) with which that ReferenceProcessor was created. That - // is because of the "clever" way the discovered references lists were - // allocated and are indexed into. - assert(_n_queues == (int) _ref_processor.max_num_queues(), "Different number not expected"); - for (int j = 0; - j < ReferenceProcessor::number_of_subclasses_of_ref(); - j++, index += _n_queues) { - _ref_processor.enqueue_discovered_reflist(_refs_lists[index]); - _refs_lists[index].set_head(NULL); - _refs_lists[index].set_length(0); - } - } -}; - -// Enqueue references that are not made active again -void ReferenceProcessor::enqueue_discovered_reflists(AbstractRefProcTaskExecutor* task_executor, - ReferenceProcessorPhaseTimes* phase_times) { - - ReferenceProcessorStats stats(total_count(_discoveredSoftRefs), - total_count(_discoveredWeakRefs), - total_count(_discoveredFinalRefs), - total_count(_discoveredPhantomRefs)); - - RefProcEnqueueTimeTracker tt(phase_times, stats); - - if (_processing_is_mt && task_executor != NULL) { - // Parallel code - RefProcEnqueueTask tsk(*this, _discovered_refs, _max_num_queues, phase_times); - task_executor->execute(tsk); - } else { - // Serial code: call the parent class's implementation - for (uint i = 0; i < _max_num_queues * number_of_subclasses_of_ref(); i++) { - enqueue_discovered_reflist(_discovered_refs[i]); - _discovered_refs[i].set_head(NULL); - _discovered_refs[i].set_length(0); - } - } -} - void DiscoveredListIterator::load_ptrs(DEBUG_ONLY(bool allow_null_referent)) { _current_discovered_addr = java_lang_ref_Reference::discovered_addr_raw(_current_discovered); oop discovered = java_lang_ref_Reference::discovered(_current_discovered); @@ -409,6 +302,25 @@ void DiscoveredListIterator::clear_referent() { RawAccess<>::oop_store(_referent_addr, oop(NULL)); } +void DiscoveredListIterator::enqueue() { + // Self-loop next, so as to make Ref not active. + java_lang_ref_Reference::set_next_raw(_current_discovered, _current_discovered); + + HeapAccess::oop_store_at(_current_discovered, + java_lang_ref_Reference::discovered_offset, + _next_discovered); +} + +void DiscoveredListIterator::complete_enqueue() { + if (_prev_discovered != NULL) { + // This is the last object. + // Swap refs_list into pending list and set obj's + // discovered to what we read from the pending list. + oop old = Universe::swap_reference_pending_list(_refs_list.head()); + HeapAccess::oop_store_at(_prev_discovered, java_lang_ref_Reference::discovered_offset, old); + } +} + // NOTE: process_phase*() are largely similar, and at a high level // merely iterate over the extant list applying a predicate to // each of its elements and possibly removing that element from the @@ -556,13 +468,18 @@ void ReferenceProcessor::process_phase3(DiscoveredList& refs_list, // keep the referent around iter.make_referent_alive(); } + iter.enqueue(); log_develop_trace(gc, ref)("Adding %sreference (" INTPTR_FORMAT ": %s) as pending", clear_referent ? "cleared " : "", p2i(iter.obj()), iter.obj()->klass()->internal_name()); assert(oopDesc::is_oop(iter.obj(), UseConcMarkSweepGC), "Adding a bad reference"); iter.next(); } + iter.complete_enqueue(); // Close the reachable set complete_gc->do_void(); + // Clear the list. + refs_list.set_head(NULL); + refs_list.set_length(0); } void @@ -785,13 +702,6 @@ void ReferenceProcessor::balance_queues(DiscoveredList ref_lists[]) #endif } -void ReferenceProcessor::balance_all_queues() { - balance_queues(_discoveredSoftRefs); - balance_queues(_discoveredWeakRefs); - balance_queues(_discoveredFinalRefs); - balance_queues(_discoveredPhantomRefs); -} - void ReferenceProcessor::process_discovered_reflist( DiscoveredList refs_lists[], ReferencePolicy* policy, diff --git a/src/hotspot/share/gc/shared/referenceProcessor.hpp b/src/hotspot/share/gc/shared/referenceProcessor.hpp index 0e1683f2bd6..715ec32f5ed 100644 --- a/src/hotspot/share/gc/shared/referenceProcessor.hpp +++ b/src/hotspot/share/gc/shared/referenceProcessor.hpp @@ -143,6 +143,12 @@ public: } } + // Do enqueuing work, i.e. notifying the GC about the changed discovered pointers. + void enqueue(); + + // Move enqueued references to the reference pending list. + void complete_enqueue(); + // NULL out referent pointer. void clear_referent(); @@ -273,9 +279,6 @@ class ReferenceProcessor : public ReferenceDiscoverer { OopClosure* keep_alive, VoidClosure* complete_gc); - // Enqueue references with a certain reachability level - void enqueue_discovered_reflist(DiscoveredList& refs_list); - // "Preclean" all the discovered reference lists // by removing references with strongly reachable referents. // The first argument is a predicate on an oop that indicates @@ -295,9 +298,6 @@ class ReferenceProcessor : public ReferenceDiscoverer { // occupying the i / _num_queues slot. const char* list_name(uint i); - void enqueue_discovered_reflists(AbstractRefProcTaskExecutor* task_executor, - ReferenceProcessorPhaseTimes* phase_times); - // "Preclean" the given discovered reference list // by removing references with strongly reachable referents. // Currently used in support of CMS only. @@ -387,8 +387,6 @@ public: // iterate over oops void weak_oops_do(OopClosure* f); // weak roots - // Balance each of the discovered lists. - void balance_all_queues(); void verify_list(DiscoveredList& ref_list); // Discover a Reference object, using appropriate discovery criteria @@ -405,10 +403,6 @@ public: AbstractRefProcTaskExecutor* task_executor, ReferenceProcessorPhaseTimes* phase_times); - // Enqueue references at end of GC (called by the garbage collector) - void enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor, - ReferenceProcessorPhaseTimes* phase_times); - // If a discovery is in process that is being superceded, abandon it: all // the discovered lists will be empty, and all the objects on them will // have NULL discovered fields. Must be called only at a safepoint. diff --git a/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp b/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp index 211749095e4..d4a48134aea 100644 --- a/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp +++ b/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp @@ -78,8 +78,6 @@ static const char* phase_enum_2_phase_string(ReferenceProcessorPhaseTimes::RefPr case ReferenceProcessorPhaseTimes::FinalRefPhase3: case ReferenceProcessorPhaseTimes::PhantomRefPhase3: return "Phase3"; - case ReferenceProcessorPhaseTimes::RefEnqueue: - return "Reference Enqueuing"; default: ShouldNotReachHere(); return NULL; @@ -191,21 +189,6 @@ RefProcPhaseTimesTracker::~RefProcPhaseTimesTracker() { times->set_ref_cleared(ref_type, discovered - after_count); } -RefProcEnqueueTimeTracker::RefProcEnqueueTimeTracker(ReferenceProcessorPhaseTimes* phase_times, - ReferenceProcessorStats& stats) : - RefProcPhaseTimeBaseTracker("Reference Enqueuing", phase_times) { - phase_times->set_ref_enqueued(REF_SOFT, stats.soft_count()); - phase_times->set_ref_enqueued(REF_WEAK, stats.weak_count()); - phase_times->set_ref_enqueued(REF_FINAL, stats.final_count()); - phase_times->set_ref_enqueued(REF_PHANTOM, stats.phantom_count()); -} - -RefProcEnqueueTimeTracker::~RefProcEnqueueTimeTracker() { - double elapsed = elapsed_time(); - - phase_times()->set_par_phase_time_ms(ReferenceProcessorPhaseTimes::RefEnqueue, elapsed); -} - ReferenceProcessorPhaseTimes::ReferenceProcessorPhaseTimes(GCTimer* gc_timer, uint max_gc_threads) : _gc_timer(gc_timer), _processing_is_mt(false) { @@ -369,17 +352,6 @@ ReferenceProcessorPhaseTimes::par_phase(RefProcPhaseNumbers phase_number) const return (RefProcParPhases)result; } -void ReferenceProcessorPhaseTimes::print_enqueue_phase(uint base_indent, bool print_total) const { - if (print_total) { - print_phase(RefEnqueue, base_indent); - } - - log_debug(gc, phases, ref)("%sReference Counts: Soft: " SIZE_FORMAT " Weak: " SIZE_FORMAT - " Final: " SIZE_FORMAT " Phantom: " SIZE_FORMAT , - Indents[base_indent + 1], ref_enqueued(REF_SOFT), ref_enqueued(REF_WEAK), - ref_enqueued(REF_FINAL), ref_enqueued(REF_PHANTOM)); -} - #define TIME_FORMAT "%.1lfms" void ReferenceProcessorPhaseTimes::print_all_references(uint base_indent, bool print_total) const { diff --git a/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.hpp b/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.hpp index 92e1231709c..8c85138aa1b 100644 --- a/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.hpp +++ b/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.hpp @@ -46,7 +46,6 @@ public: FinalRefPhase3, PhantomRefPhase2, PhantomRefPhase3, - RefEnqueue, RefParPhaseMax }; @@ -133,7 +132,6 @@ public: // Reset all fields. If not reset at next cycle, an assertion will fail. void reset(); - void print_enqueue_phase(uint base_indent = 0, bool print_total = true) const; void print_all_references(uint base_indent = 0, bool print_total = true) const; }; @@ -203,13 +201,4 @@ public: ~RefProcPhaseTimesTracker(); }; -// Updates enqueue time related information. -// - Enqueueing time, enqueued reference count and stats for each working thread if MT processed. -class RefProcEnqueueTimeTracker : public RefProcPhaseTimeBaseTracker { -public: - RefProcEnqueueTimeTracker(ReferenceProcessorPhaseTimes* phase_times, - ReferenceProcessorStats& stats); - ~RefProcEnqueueTimeTracker(); -}; - #endif // SHARE_VM_GC_SHARED_REFERENCEPROCESSORPHASETIMES_HPP diff --git a/src/hotspot/share/gc/shared/space.cpp b/src/hotspot/share/gc/shared/space.cpp index 82b62dd3e24..5fa1ec8cae1 100644 --- a/src/hotspot/share/gc/shared/space.cpp +++ b/src/hotspot/share/gc/shared/space.cpp @@ -490,23 +490,6 @@ bool Space::obj_is_alive(const HeapWord* p) const { return true; } -#if INCLUDE_CMSGC -#define ContigSpace_PAR_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ - \ - void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\ - HeapWord* obj_addr = mr.start(); \ - HeapWord* t = mr.end(); \ - while (obj_addr < t) { \ - assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop"); \ - obj_addr += oop(obj_addr)->oop_iterate_size(blk); \ - } \ - } - - ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN) - -#undef ContigSpace_PAR_OOP_ITERATE_DEFN -#endif // INCLUDE_CMSGC - void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) { if (is_empty()) return; HeapWord* obj_addr = bottom(); @@ -550,32 +533,6 @@ ContiguousSpace::object_iterate_careful(ObjectClosureCareful* blk) { return NULL; // all done } -#define ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix) \ - \ -void ContiguousSpace:: \ -oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \ - HeapWord* t; \ - HeapWord* p = saved_mark_word(); \ - assert(p != NULL, "expected saved mark"); \ - \ - const intx interval = PrefetchScanIntervalInBytes; \ - do { \ - t = top(); \ - while (p < t) { \ - Prefetch::write(p, interval); \ - debug_only(HeapWord* prev = p); \ - oop m = oop(p); \ - p += m->oop_iterate_size(blk); \ - } \ - } while (t < top()); \ - \ - set_saved_mark_word(p); \ -} - -ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN) - -#undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN - // Very general, slow implementation. HeapWord* ContiguousSpace::block_start_const(const void* p) const { assert(MemRegion(bottom(), end()).contains(p), diff --git a/src/hotspot/share/gc/shared/space.hpp b/src/hotspot/share/gc/shared/space.hpp index f7e44ced8d5..5073e2e1b4b 100644 --- a/src/hotspot/share/gc/shared/space.hpp +++ b/src/hotspot/share/gc/shared/space.hpp @@ -608,15 +608,9 @@ class ContiguousSpace: public CompactibleSpace { _concurrent_iteration_safe_limit = new_limit; } - -#if INCLUDE_CMSGC // In support of parallel oop_iterate. - #define ContigSpace_PAR_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ - void par_oop_iterate(MemRegion mr, OopClosureType* blk); - - ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DECL) - #undef ContigSpace_PAR_OOP_ITERATE_DECL -#endif // INCLUDE_CMSGC + template + void par_oop_iterate(MemRegion mr, OopClosureType* blk); // Compaction support virtual void reset_after_compaction() { @@ -639,11 +633,8 @@ class ContiguousSpace: public CompactibleSpace { // *are* included in the iteration. // Updates _saved_mark_word to point to just after the last object // iterated over. -#define ContigSpace_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ - void oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk); - - ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DECL) -#undef ContigSpace_OOP_SINCE_SAVE_MARKS_DECL + template + void oop_since_save_marks_iterate(OopClosureType* blk); // Same as object_iterate, but starting from "mark", which is required // to denote the start of an object. Objects allocated by diff --git a/src/hotspot/share/gc/shared/space.inline.hpp b/src/hotspot/share/gc/shared/space.inline.hpp index 24345b0be8e..672118930cd 100644 --- a/src/hotspot/share/gc/shared/space.inline.hpp +++ b/src/hotspot/share/gc/shared/space.inline.hpp @@ -357,4 +357,34 @@ size_t ContiguousSpace::scanned_block_size(const HeapWord* addr) const { return oop(addr)->size(); } +template +void ContiguousSpace::oop_since_save_marks_iterate(OopClosureType* blk) { + HeapWord* t; + HeapWord* p = saved_mark_word(); + assert(p != NULL, "expected saved mark"); + + const intx interval = PrefetchScanIntervalInBytes; + do { + t = top(); + while (p < t) { + Prefetch::write(p, interval); + debug_only(HeapWord* prev = p); + oop m = oop(p); + p += m->oop_iterate_size(blk); + } + } while (t < top()); + + set_saved_mark_word(p); +} + +template +void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) { + HeapWord* obj_addr = mr.start(); + HeapWord* limit = mr.end(); + while (obj_addr < limit) { + assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop"); + obj_addr += oop(obj_addr)->oop_iterate_size(blk); + } +} + #endif // SHARE_VM_GC_SHARED_SPACE_INLINE_HPP diff --git a/src/hotspot/share/gc/shared/specialized_oop_closures.hpp b/src/hotspot/share/gc/shared/specialized_oop_closures.hpp index 66c5fa85abb..af2ab821563 100644 --- a/src/hotspot/share/gc/shared/specialized_oop_closures.hpp +++ b/src/hotspot/share/gc/shared/specialized_oop_closures.hpp @@ -80,36 +80,4 @@ class OopsInGenClosure; #define ALL_OOP_OOP_ITERATE_CLOSURES_2(f) \ SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) -// This macro applies an argument macro to all OopClosures for which we -// want specialized bodies of a family of methods related to -// "par_oop_iterate". The arguments to f are the same as above. -// The "root_class" is the most general class to define; this may be -// "OopClosure" in some applications and "OopsInGenClosure" in others. - - -#define ALL_PAR_OOP_ITERATE_CLOSURES(f) \ - f(ExtendedOopClosure,_v) \ - CMSGC_ONLY(SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f)) - -// This macro applies an argument macro to all OopClosures for which we -// want specialized bodies of a family of methods related to -// "oops_since_save_marks_do". The arguments to f are the same as above. -// The "root_class" is the most general class to define; this may be -// "OopClosure" in some applications and "OopsInGenClosure" in others. - -#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(f) \ - SERIALGC_ONLY(SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f)) \ - CMSGC_ONLY(SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f)) - -#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) \ - SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(f) - -// We separate these out, because sometime the general one has -// a different definition from the specialized ones, and sometimes it -// doesn't. - -#define ALL_SINCE_SAVE_MARKS_CLOSURES(f) \ - f(OopsInGenClosure,_v) \ - SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) - #endif // SHARE_VM_GC_SHARED_SPECIALIZED_OOP_CLOSURES_HPP diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp index 4763897adac..029e29cb2b8 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -655,13 +655,13 @@ void LinkResolver::check_method_loader_constraints(const LinkInfo& link_info, resolved_loader, true, CHECK); if (failed_type_symbol != NULL) { const char* msg = "loader constraint violation: when resolving %s" - " \"%s\" the class loader (instance of %s) of the current class, %s," - " and the class loader (instance of %s) for the method's defining class, %s, have" + " \"%s\" the class loader %s of the current class, %s," + " and the class loader %s for the method's defining class, %s, have" " different Class objects for the type %s used in the signature"; char* sig = link_info.method_string(); - const char* loader1_name = SystemDictionary::loader_name(current_loader()); + const char* loader1_name = java_lang_ClassLoader::describe_external(current_loader()); char* current = link_info.current_klass()->name()->as_C_string(); - const char* loader2_name = SystemDictionary::loader_name(resolved_loader()); + const char* loader2_name = java_lang_ClassLoader::describe_external(resolved_loader()); char* target = resolved_method->method_holder()->name()->as_C_string(); char* failed_type_name = failed_type_symbol->as_C_string(); size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1_name) + @@ -688,13 +688,13 @@ void LinkResolver::check_field_loader_constraints(Symbol* field, Symbol* sig, CHECK); if (failed_type_symbol != NULL) { const char* msg = "loader constraint violation: when resolving field" - " \"%s\" the class loader (instance of %s) of the referring class, " - "%s, and the class loader (instance of %s) for the field's resolved " + " \"%s\" the class loader %s of the referring class, " + "%s, and the class loader %s for the field's resolved " "type, %s, have different Class objects for that type"; char* field_name = field->as_C_string(); - const char* loader1_name = SystemDictionary::loader_name(ref_loader()); + const char* loader1_name = java_lang_ClassLoader::describe_external(ref_loader()); char* sel = sel_klass->name()->as_C_string(); - const char* loader2_name = SystemDictionary::loader_name(sel_loader()); + const char* loader2_name = java_lang_ClassLoader::describe_external(sel_loader()); char* failed_type_name = failed_type_symbol->as_C_string(); size_t buflen = strlen(msg) + strlen(field_name) + strlen(loader1_name) + strlen(sel) + strlen(loader2_name) + strlen(failed_type_name) + 1; diff --git a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp index 5af98f8833f..11ff652688d 100644 --- a/src/hotspot/share/memory/filemap.cpp +++ b/src/hotspot/share/memory/filemap.cpp @@ -25,8 +25,8 @@ #include "precompiled.hpp" #include "jvm.h" #include "classfile/classLoader.inline.hpp" +#include "classfile/classLoaderExt.hpp" #include "classfile/compactHashtable.inline.hpp" -#include "classfile/sharedClassUtil.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionaryShared.hpp" @@ -159,8 +159,9 @@ FileMapInfo::FileMapInfo() { memset((void*)this, 0, sizeof(FileMapInfo)); _file_offset = 0; _file_open = false; - _header = SharedClassUtil::allocate_file_map_header(); + _header = new FileMapHeader(); _header->_version = _invalid_version; + _header->_has_platform_or_app_classes = true; } FileMapInfo::~FileMapInfo() { @@ -172,10 +173,6 @@ void FileMapInfo::populate_header(size_t alignment) { _header->populate(this, alignment); } -size_t FileMapInfo::FileMapHeader::data_size() { - return SharedClassUtil::file_map_header_size() - sizeof(FileMapInfo::FileMapHeaderBase); -} - void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) { _magic = 0xf00baba2; _version = _current_version; @@ -198,6 +195,14 @@ void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment // JVM version string ... changes on each build. get_header_version(_jvm_ident); + + ClassLoaderExt::finalize_shared_paths_misc_info(); + _app_class_paths_start_index = ClassLoaderExt::app_class_paths_start_index(); + _app_module_paths_start_index = ClassLoaderExt::app_module_paths_start_index(); + + _verify_local = BytecodeVerificationLocal; + _verify_remote = BytecodeVerificationRemote; + _has_platform_or_app_classes = ClassLoaderExt::has_platform_or_app_classes(); } void SharedClassPathEntry::init(const char* name, TRAPS) { @@ -278,7 +283,7 @@ void FileMapInfo::allocate_shared_path_table() { assert(jrt != NULL, "No modular java runtime image present when allocating the CDS classpath entry table"); - size_t entry_size = SharedClassUtil::shared_class_path_entry_size(); // assert ( should be 8 byte aligned??) + size_t entry_size = sizeof(SharedClassPathEntry); // assert ( should be 8 byte aligned??) int num_boot_classpath_entries = ClassLoader::num_boot_classpath_entries(); int num_app_classpath_entries = ClassLoader::num_app_classpath_entries(); int num_module_path_entries = ClassLoader::num_module_path_entries(); @@ -299,7 +304,7 @@ void FileMapInfo::allocate_shared_path_table() { ent->init(cpe->name(), THREAD); if (cpe != jrt) { // No need to do jimage. EXCEPTION_MARK; // The following call should never throw, but would exit VM on error. - SharedClassUtil::update_shared_classpath(cpe, ent, THREAD); + update_shared_classpath(cpe, ent, THREAD); } cpe = ClassLoader::get_next_boot_classpath_entry(cpe); i++; @@ -314,7 +319,7 @@ void FileMapInfo::allocate_shared_path_table() { SharedClassPathEntry* ent = shared_path(i); ent->init(acpe->name(), THREAD); EXCEPTION_MARK; - SharedClassUtil::update_shared_classpath(acpe, ent, THREAD); + update_shared_classpath(acpe, ent, THREAD); acpe = acpe->next(); i++; } @@ -326,7 +331,7 @@ void FileMapInfo::allocate_shared_path_table() { SharedClassPathEntry* ent = shared_path(i); ent->init(mpe->name(), THREAD); EXCEPTION_MARK; - SharedClassUtil::update_shared_classpath(mpe, ent, THREAD); + update_shared_classpath(mpe, ent, THREAD); mpe = mpe->next(); i++; } @@ -360,6 +365,84 @@ void FileMapInfo::check_nonempty_dir_in_shared_path_table() { } } +class ManifestStream: public ResourceObj { + private: + u1* _buffer_start; // Buffer bottom + u1* _buffer_end; // Buffer top (one past last element) + u1* _current; // Current buffer position + + public: + // Constructor + ManifestStream(u1* buffer, int length) : _buffer_start(buffer), + _current(buffer) { + _buffer_end = buffer + length; + } + + static bool is_attr(u1* attr, const char* name) { + return strncmp((const char*)attr, name, strlen(name)) == 0; + } + + static char* copy_attr(u1* value, size_t len) { + char* buf = NEW_RESOURCE_ARRAY(char, len + 1); + strncpy(buf, (char*)value, len); + buf[len] = 0; + return buf; + } + + // The return value indicates if the JAR is signed or not + bool check_is_signed() { + u1* attr = _current; + bool isSigned = false; + while (_current < _buffer_end) { + if (*_current == '\n') { + *_current = '\0'; + u1* value = (u1*)strchr((char*)attr, ':'); + if (value != NULL) { + assert(*(value+1) == ' ', "Unrecognized format" ); + if (strstr((char*)attr, "-Digest") != NULL) { + isSigned = true; + break; + } + } + *_current = '\n'; // restore + attr = _current + 1; + } + _current ++; + } + return isSigned; + } +}; + +void FileMapInfo::update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS) { + ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); + ResourceMark rm(THREAD); + jint manifest_size; + bool isSigned; + + if (cpe->is_jar_file()) { + char* manifest = ClassLoaderExt::read_manifest(cpe, &manifest_size, CHECK); + if (manifest != NULL) { + ManifestStream* stream = new ManifestStream((u1*)manifest, + manifest_size); + isSigned = stream->check_is_signed(); + if (isSigned) { + ent->set_is_signed(true); + } else { + // Copy the manifest into the shared archive + manifest = ClassLoaderExt::read_raw_manifest(cpe, &manifest_size, CHECK); + Array* buf = MetadataFactory::new_array(loader_data, + manifest_size, + THREAD); + char* p = (char*)(buf->data()); + memcpy(p, manifest, manifest_size); + ent->set_manifest(buf); + ent->set_is_signed(false); + } + } + } +} + + bool FileMapInfo::validate_shared_path_table() { assert(UseSharedSpaces, "runtime only"); @@ -368,14 +451,13 @@ bool FileMapInfo::validate_shared_path_table() { _shared_path_entry_size = _header->_shared_path_entry_size; _shared_path_table_size = _header->_shared_path_table_size; - FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header(); - int module_paths_start_index = header->_app_module_paths_start_index; + int module_paths_start_index = _header->_app_module_paths_start_index; // If the shared archive contain app or platform classes, validate all entries // in the shared path table. Otherwise, only validate the boot path entries (with // entry index < _app_class_paths_start_index). - int count = header->has_platform_or_app_classes() ? - _shared_path_table_size : header->_app_class_paths_start_index; + int count = _header->has_platform_or_app_classes() ? + _shared_path_table_size : _header->_app_class_paths_start_index; for (int i=0; i* _name; Array* _manifest; + bool _is_signed; public: void init(const char* name, TRAPS); @@ -70,6 +71,15 @@ public: int manifest_size() const { return (_manifest == NULL) ? 0 : _manifest->length(); } + void set_manifest(Array* manifest) { + _manifest = manifest; + } + void set_is_signed(bool s) { + _is_signed = s; + } + bool is_signed() { + return _is_signed; + } }; class FileMapInfo : public CHeapObj { @@ -97,13 +107,16 @@ private: public: struct FileMapHeaderBase : public CHeapObj { - virtual bool validate() = 0; - virtual void populate(FileMapInfo* info, size_t alignment) = 0; + // Need to put something here. Otherwise, in product build, because CHeapObj has no virtual + // methods, we would get sizeof(FileMapHeaderBase) == 1 with gcc. + intx _dummy; }; struct FileMapHeader : FileMapHeaderBase { // Use data() and data_size() to memcopy to/from the FileMapHeader. We need to // avoid read/writing the C++ vtable pointer. - static size_t data_size(); + static size_t data_size() { + return sizeof(FileMapHeader) - sizeof(FileMapInfo::FileMapHeaderBase); + } char* data() { return ((char*)this) + sizeof(FileMapHeaderBase); } @@ -146,7 +159,7 @@ public: // The _paths_misc_info is a variable-size structure that records "miscellaneous" // information during dumping. It is generated and validated by the - // SharedPathsMiscInfo class. See SharedPathsMiscInfo.hpp and sharedClassUtil.hpp for + // SharedPathsMiscInfo class. See SharedPathsMiscInfo.hpp for // detailed description. // // The _paths_misc_info data is stored as a byte array in the archive file header, @@ -172,10 +185,21 @@ public: size_t _shared_path_entry_size; Array* _shared_path_table; + jshort _app_class_paths_start_index; // Index of first app classpath entry + jshort _app_module_paths_start_index; // Index of first module path entry + bool _verify_local; // BytecodeVerificationLocal setting + bool _verify_remote; // BytecodeVerificationRemote setting + bool _has_platform_or_app_classes; // Archive contains app classes + + void set_has_platform_or_app_classes(bool v) { + _has_platform_or_app_classes = v; + } + bool has_platform_or_app_classes() { return _has_platform_or_app_classes; } + char* region_addr(int idx); - virtual bool validate(); - virtual void populate(FileMapInfo* info, size_t alignment); + bool validate(); + void populate(FileMapInfo* info, size_t alignment); int compute_crc(); }; @@ -274,6 +298,7 @@ public: static void allocate_shared_path_table(); static void check_nonempty_dir_in_shared_path_table(); bool validate_shared_path_table(); + static void update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS); static SharedClassPathEntry* shared_path(int index) { if (index < 0) { diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index 1a685b4b807..3a489f3d5ad 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -245,7 +245,6 @@ class ChunkManager : public CHeapObj { locked_verify_free_chunks_count(); } } - void verify_free_chunks_count(); // Given a pointer to a chunk, attempts to merge it with neighboring // free chunks to form a bigger chunk. Returns true if successful. @@ -368,13 +367,10 @@ class ChunkManager : public CHeapObj { locked_verify(); } } - void verify_free_chunks_total(); void locked_print_free_chunks(outputStream* st); void locked_print_sum_free_chunks(outputStream* st); - void print_on(outputStream* st) const; - // Fill in current statistic values to the given statistics object. void collect_statistics(ChunkManagerStatistics* out) const; @@ -1705,7 +1701,6 @@ Metachunk* VirtualSpaceNode::take_from_committed(size_t chunk_word_size) { ls.print("VirtualSpaceNode::take_from_committed() not available " SIZE_FORMAT " words ", chunk_word_size); // Dump some information about the virtual space that is nearly full print_on(&ls); - ls.cr(); // ~LogStream does not autoflush. } return NULL; } @@ -2221,7 +2216,6 @@ void VirtualSpaceList::link_vs(VirtualSpaceNode* new_entry) { VirtualSpaceNode* vsl = current_virtual_space(); ResourceMark rm; vsl->print_on(&ls); - ls.cr(); // ~LogStream does not autoflush. } } @@ -2710,12 +2704,6 @@ void ChunkManager::locked_verify_free_chunks_total() { sum_free_chunks()); } -void ChunkManager::verify_free_chunks_total() { - MutexLockerEx cl(MetaspaceExpand_lock, - Mutex::_no_safepoint_check_flag); - locked_verify_free_chunks_total(); -} - void ChunkManager::locked_verify_free_chunks_count() { assert_lock_strong(MetaspaceExpand_lock); assert(sum_free_chunks_count() == _free_chunks_count, @@ -2724,14 +2712,6 @@ void ChunkManager::locked_verify_free_chunks_count() { sum_free_chunks_count()); } -void ChunkManager::verify_free_chunks_count() { -#ifdef ASSERT - MutexLockerEx cl(MetaspaceExpand_lock, - Mutex::_no_safepoint_check_flag); - locked_verify_free_chunks_count(); -#endif -} - void ChunkManager::verify() { MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag); @@ -3041,7 +3021,6 @@ Metachunk* ChunkManager::chunk_freelist_allocate(size_t word_size) { p2i(this), p2i(chunk), chunk->word_size(), list_count); ResourceMark rm; locked_print_free_chunks(&ls); - ls.cr(); // ~LogStream does not autoflush. } return chunk; @@ -3132,10 +3111,6 @@ void ChunkManager::return_chunk_list(ChunkIndex index, Metachunk* chunks) { } } -void ChunkManager::print_on(outputStream* out) const { - _humongous_dictionary.report_statistics(out); -} - void ChunkManager::collect_statistics(ChunkManagerStatistics* out) const { MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag); for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) { @@ -3220,7 +3195,6 @@ void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const { } chunk_manager()->locked_print_free_chunks(st); - chunk_manager()->locked_print_sum_free_chunks(st); } size_t SpaceManager::calc_chunk_size(size_t word_size) { @@ -3418,7 +3392,6 @@ SpaceManager::~SpaceManager() { if (block_freelists() != NULL) { block_freelists()->print_on(&ls); } - ls.cr(); // ~LogStream does not autoflush. } // Add all the chunks in use by this space manager @@ -3487,7 +3460,6 @@ void SpaceManager::add_chunk(Metachunk* new_chunk, bool make_current) { LogStream ls(log.trace()); new_chunk->print_on(&ls); chunk_manager()->locked_print_free_chunks(&ls); - ls.cr(); // ~LogStream does not autoflush. } } @@ -4131,7 +4103,7 @@ void MetaspaceUtils::print_report(outputStream* out, size_t scale, int flags) { cl._stats_total.class_sm_stats().free_blocks_cap_words(); out->print("Deallocated from chunks in use: "); print_scaled_words_and_percentage(out, free_blocks_cap_words, committed_words, scale, 6); - out->print(" ("UINTX_FORMAT " blocks)", free_blocks_num); + out->print(" (" UINTX_FORMAT " blocks)", free_blocks_num); out->cr(); // Print total waste. @@ -4441,7 +4413,6 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a ResourceMark rm; LogStream ls(lt); print_compressed_class_space(&ls, requested_addr); - ls.cr(); // ~LogStream does not autoflush. } } @@ -4663,13 +4634,11 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s if (loader_data->metaspace_or_null() != NULL) { LogStream ls(log.debug()); loader_data->print_value_on(&ls); - ls.cr(); // ~LogStream does not autoflush. } } LogStream ls(log.info()); // In case of an OOM, log out a short but still useful report. MetaspaceUtils::print_basic_report(&ls, 0); - ls.cr(); // ~LogStream does not autoflush. } bool out_of_compressed_class_space = false; diff --git a/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp b/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp index babe350e40e..ac556519e4b 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp @@ -70,7 +70,7 @@ void MetaspaceDCmd::execute(DCmdSource source, TRAPS) { if (strcasecmp("dynamic", scale_value) == 0) { scale = 0; } else { - scale = NMTUtil::scale_from_name(scale_value); + scale = NMT_ONLY(NMTUtil::scale_from_name(scale_value)) NOT_NMT(0); if (scale == 0) { output()->print_cr("Invalid scale: \"%s\". Will use dynamic scaling.", scale_value); } diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp index 21893ce8cca..1c5106dd228 100644 --- a/src/hotspot/share/memory/metaspaceShared.cpp +++ b/src/hotspot/share/memory/metaspaceShared.cpp @@ -29,7 +29,6 @@ #include "classfile/dictionary.hpp" #include "classfile/loaderConstraints.hpp" #include "classfile/placeholders.hpp" -#include "classfile/sharedClassUtil.hpp" #include "classfile/symbolTable.hpp" #include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" @@ -323,6 +322,46 @@ void MetaspaceShared::initialize_dumptime_shared_and_meta_spaces() { _shared_rs.size(), p2i(_shared_rs.base())); } +// Called by universe_post_init() +void MetaspaceShared::post_initialize(TRAPS) { + if (UseSharedSpaces) { + int size = FileMapInfo::get_number_of_shared_paths(); + if (size > 0) { + SystemDictionaryShared::allocate_shared_data_arrays(size, THREAD); + FileMapInfo::FileMapHeader* header = FileMapInfo::current_info()->header(); + ClassLoaderExt::init_paths_start_index(header->_app_class_paths_start_index); + ClassLoaderExt::init_app_module_paths_start_index(header->_app_module_paths_start_index); + } + } + + if (DumpSharedSpaces) { + if (SharedArchiveConfigFile) { + read_extra_data(SharedArchiveConfigFile, THREAD); + } + } +} + +void MetaspaceShared::read_extra_data(const char* filename, TRAPS) { + HashtableTextDump reader(filename); + reader.check_version("VERSION: 1.0"); + + while (reader.remain() > 0) { + int utf8_length; + int prefix_type = reader.scan_prefix(&utf8_length); + ResourceMark rm(THREAD); + char* utf8_buffer = NEW_RESOURCE_ARRAY(char, utf8_length); + reader.get_utf8(utf8_buffer, utf8_length); + + if (prefix_type == HashtableTextDump::SymbolPrefix) { + SymbolTable::new_symbol(utf8_buffer, utf8_length, THREAD); + } else{ + assert(prefix_type == HashtableTextDump::StringPrefix, "Sanity"); + utf8_buffer[utf8_length] = '\0'; + oop s = StringTable::intern(utf8_buffer, THREAD); + } + } +} + void MetaspaceShared::commit_shared_space_to(char* newtop) { assert(DumpSharedSpaces, "dump-time only"); char* base = _shared_rs.base(); diff --git a/src/hotspot/share/memory/metaspaceShared.hpp b/src/hotspot/share/memory/metaspaceShared.hpp index 1c851397478..2f28cb096d6 100644 --- a/src/hotspot/share/memory/metaspaceShared.hpp +++ b/src/hotspot/share/memory/metaspaceShared.hpp @@ -147,6 +147,7 @@ class MetaspaceShared : AllStatic { } static void initialize_dumptime_shared_and_meta_spaces() NOT_CDS_RETURN; static void initialize_runtime_shared_and_meta_spaces() NOT_CDS_RETURN; + static void post_initialize(TRAPS) NOT_CDS_RETURN; // Delta of this object from the bottom of the archive. static uintx object_delta(void* obj) { @@ -250,5 +251,8 @@ class MetaspaceShared : AllStatic { static void relocate_klass_ptr(oop o); static Klass* get_relocated_klass(Klass *k); + +private: + static void read_extra_data(const char* filename, TRAPS) NOT_CDS_RETURN; }; #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index 8c0956df1d5..7deb13b8cf2 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -81,9 +81,6 @@ #include "utilities/macros.hpp" #include "utilities/ostream.hpp" #include "utilities/preserveException.hpp" -#if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" -#endif // Known objects Klass* Universe::_boolArrayKlassObj = NULL; @@ -1094,7 +1091,7 @@ bool universe_post_init() { MemoryService::set_universe_heap(Universe::heap()); #if INCLUDE_CDS - SharedClassUtil::initialize(CHECK_false); + MetaspaceShared::post_initialize(CHECK_false); #endif return true; } diff --git a/src/hotspot/share/oops/klass.hpp b/src/hotspot/share/oops/klass.hpp index 9136314fef7..e9af35aa69e 100644 --- a/src/hotspot/share/oops/klass.hpp +++ b/src/hotspot/share/oops/klass.hpp @@ -168,7 +168,6 @@ private: // in the open archive heap region when archiving java object is supported. CDS_JAVA_HEAP_ONLY(narrowOop _archived_mirror;) - friend class SharedClassUtil; protected: // Constructor diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index a6bcef24b85..afa37adb9a5 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "jvm.h" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "interpreter/linkResolver.hpp" @@ -506,21 +507,21 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, const methodHand CHECK_(false)); if (failed_type_symbol != NULL) { const char* msg = "loader constraint violation for class %s: when selecting " - "overriding method \"%s\" the class loader (instance of %s) of the " - "selected method's type %s, and the class loader (instance of %s) for its super " + "overriding method %s the class loader %s of the " + "selected method's type %s, and the class loader %s for its super " "type %s have different Class objects for the type %s used in the signature"; - char* curr_class = klass->name()->as_C_string(); - char* sig = target_method()->name_and_sig_as_C_string(); - const char* loader1 = SystemDictionary::loader_name(target_loader()); - char* sel_class = target_klass->name()->as_C_string(); - const char* loader2 = SystemDictionary::loader_name(super_loader()); - char* super_class = super_klass->name()->as_C_string(); - char* failed_type_name = failed_type_symbol->as_C_string(); - size_t buflen = strlen(msg) + strlen(curr_class) + strlen(sig) + + const char* curr_class = klass->external_name(); + const char* method = target_method()->name_and_sig_as_C_string(); + const char* loader1 = java_lang_ClassLoader::describe_external(target_loader()); + const char* sel_class = target_klass->external_name(); + const char* loader2 = java_lang_ClassLoader::describe_external(super_loader()); + const char* super_class = super_klass->external_name(); + const char* failed_type_name = failed_type_symbol->as_klass_external_name(); + size_t buflen = strlen(msg) + strlen(curr_class) + strlen(method) + strlen(loader1) + strlen(sel_class) + strlen(loader2) + strlen(super_class) + strlen(failed_type_name); char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); - jio_snprintf(buf, buflen, msg, curr_class, sig, loader1, sel_class, loader2, + jio_snprintf(buf, buflen, msg, curr_class, method, loader1, sel_class, loader2, super_class, failed_type_name); THROW_MSG_(vmSymbols::java_lang_LinkageError(), buf, false); } @@ -1236,17 +1237,17 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass true, CHECK); if (failed_type_symbol != NULL) { const char* msg = "loader constraint violation in interface itable" - " initialization for class %s: when selecting method \"%s\" the" - " class loader (instance of %s) for super interface %s, and the class" - " loader (instance of %s) of the selected method's type, %s have" + " initialization for class %s: when selecting method %s the" + " class loader %s for super interface %s, and the class" + " loader %s of the selected method's type, %s have" " different Class objects for the type %s used in the signature"; - char* current = _klass->name()->as_C_string(); - char* sig = m->name_and_sig_as_C_string(); - const char* loader1 = SystemDictionary::loader_name(interface_loader()); - char* iface = InstanceKlass::cast(interf)->name()->as_C_string(); - const char* loader2 = SystemDictionary::loader_name(method_holder_loader()); - char* mclass = target()->method_holder()->name()->as_C_string(); - char* failed_type_name = failed_type_symbol->as_C_string(); + const char* current = _klass->external_name(); + const char* sig = m->name_and_sig_as_C_string(); + const char* loader1 = java_lang_ClassLoader::describe_external(interface_loader()); + const char* iface = InstanceKlass::cast(interf)->external_name(); + const char* loader2 = java_lang_ClassLoader::describe_external(method_holder_loader()); + const char* mclass = target()->method_holder()->external_name(); + const char* failed_type_name = failed_type_symbol->as_klass_external_name(); size_t buflen = strlen(msg) + strlen(current) + strlen(sig) + strlen(loader1) + strlen(iface) + strlen(loader2) + strlen(mclass) + strlen(failed_type_name); diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 9eb7c9c2816..0b085493628 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -84,7 +84,6 @@ #include "utilities/macros.hpp" #include "utilities/utf8.hpp" #if INCLUDE_CDS -#include "classfile/sharedClassUtil.hpp" #include "classfile/systemDictionaryShared.hpp" #endif diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 808fb8f9152..87b46e7f67e 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -518,6 +518,7 @@ static SpecialFlag const special_jvm_flags[] = { { "PrintSafepointStatisticsTimeout", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) }, { "PrintSafepointStatisticsCount",JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) }, { "AggressiveOpts", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) }, + { "AllowNonVirtualCalls", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) }, // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, @@ -526,9 +527,6 @@ static SpecialFlag const special_jvm_flags[] = { { "UnsyncloadClass", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, // -------------- Obsolete Flags - sorted by expired_in -------------- - { "ConvertSleepToYield", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, - { "ConvertYieldToSleep", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, - { "MinSleepInterval", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) }, { "CheckAssertionStatusDirectives",JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) }, { "PrintMallocFree", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) }, { "PrintMalloc", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) }, diff --git a/src/hotspot/share/runtime/atomic.hpp b/src/hotspot/share/runtime/atomic.hpp index 9fa19346749..89d4433be4a 100644 --- a/src/hotspot/share/runtime/atomic.hpp +++ b/src/hotspot/share/runtime/atomic.hpp @@ -37,9 +37,14 @@ #include "utilities/align.hpp" #include "utilities/macros.hpp" -enum cmpxchg_memory_order { - memory_order_relaxed, - // Use value which doesn't interfere with C++2011. We need to be more conservative. +enum atomic_memory_order { + // The modes that align with C++11 are intended to + // follow the same semantics. + memory_order_relaxed = 0, + memory_order_acquire = 2, + memory_order_release = 3, + memory_order_acq_rel = 4, + // Strong two-way memory barrier. memory_order_conservative = 8 }; @@ -80,10 +85,12 @@ public: // add-value-to-dest template - inline static D add(I add_value, D volatile* dest); + inline static D add(I add_value, D volatile* dest, + atomic_memory_order order = memory_order_conservative); template - inline static D sub(I sub_value, D volatile* dest); + inline static D sub(I sub_value, D volatile* dest, + atomic_memory_order order = memory_order_conservative); // Atomically increment location. inc() provide: // increment-dest @@ -91,7 +98,8 @@ public: // type. If it is a pointer type, then the increment is // scaled to the size of the type pointed to by the pointer. template - inline static void inc(D volatile* dest); + inline static void inc(D volatile* dest, + atomic_memory_order order = memory_order_conservative); // Atomically decrement a location. dec() provide: // decrement-dest @@ -99,7 +107,8 @@ public: // type. If it is a pointer type, then the decrement is // scaled to the size of the type pointed to by the pointer. template - inline static void dec(D volatile* dest); + inline static void dec(D volatile* dest, + atomic_memory_order order = memory_order_conservative); // Performs atomic exchange of *dest with exchange_value. Returns old // prior value of *dest. xchg*() provide: @@ -108,7 +117,8 @@ public: // to D, an integral/enum type equal to D, or a type equal to D that // is primitive convertible using PrimitiveConversions. template - inline static D xchg(T exchange_value, volatile D* dest); + inline static D xchg(T exchange_value, volatile D* dest, + atomic_memory_order order = memory_order_conservative); // Performs atomic compare of *dest and compare_value, and exchanges // *dest with exchange_value if the comparison succeeded. Returns prior @@ -119,7 +129,7 @@ public: inline static D cmpxchg(T exchange_value, D volatile* dest, U compare_value, - cmpxchg_memory_order order = memory_order_conservative); + atomic_memory_order order = memory_order_conservative); // Performs atomic compare of *dest and NULL, and replaces *dest // with exchange_value if the comparison succeeded. Returns true if @@ -128,7 +138,7 @@ public: // alternative to the Double-Checked Locking Pattern. template inline static bool replace_if_null(T* value, D* volatile* dest, - cmpxchg_memory_order order = memory_order_conservative); + atomic_memory_order order = memory_order_conservative); private: WINDOWS_ONLY(public:) // VS2017 warns (C2027) use of undefined type if IsPointerConvertible is declared private @@ -272,7 +282,7 @@ private: // // - dest is of type T*. // - exchange_value and compare_value are of type T. - // - order is of type cmpxchg_memory_order. + // - order is of type atomic_memory_order. // - platform_cmpxchg is an object of type PlatformCmpxchg. // // Then @@ -280,7 +290,7 @@ private: // must be a valid expression, returning a result convertible to T. // // A default definition is provided, which declares a function template - // T operator()(T, T volatile*, T, cmpxchg_memory_order) const + // T operator()(T, T volatile*, T, atomic_memory_order) const // // For each required size, a platform must either provide an // appropriate definition of that function, or must entirely @@ -327,7 +337,7 @@ private: // must be a valid expression, returning a result convertible to T. // // A default definition is provided, which declares a function template - // T operator()(T, T volatile*, T, cmpxchg_memory_order) const + // T operator()(T, T volatile*, T, atomic_memory_order) const // // For each required size, a platform must either provide an // appropriate definition of that function, or must entirely @@ -488,33 +498,33 @@ struct Atomic::PlatformStore { template struct Atomic::FetchAndAdd { template - D operator()(I add_value, D volatile* dest) const; + D operator()(I add_value, D volatile* dest, atomic_memory_order order) const; }; template struct Atomic::AddAndFetch { template - D operator()(I add_value, D volatile* dest) const; + D operator()(I add_value, D volatile* dest, atomic_memory_order order) const; }; template -inline void Atomic::inc(D volatile* dest) { +inline void Atomic::inc(D volatile* dest, atomic_memory_order order) { STATIC_ASSERT(IsPointer::value || IsIntegral::value); typedef typename Conditional::value, ptrdiff_t, D>::type I; - Atomic::add(I(1), dest); + Atomic::add(I(1), dest, order); } template -inline void Atomic::dec(D volatile* dest) { +inline void Atomic::dec(D volatile* dest, atomic_memory_order order) { STATIC_ASSERT(IsPointer::value || IsIntegral::value); typedef typename Conditional::value, ptrdiff_t, D>::type I; // Assumes two's complement integer representation. #pragma warning(suppress: 4146) - Atomic::add(I(-1), dest); + Atomic::add(I(-1), dest, order); } template -inline D Atomic::sub(I sub_value, D volatile* dest) { +inline D Atomic::sub(I sub_value, D volatile* dest, atomic_memory_order order) { STATIC_ASSERT(IsPointer::value || IsIntegral::value); STATIC_ASSERT(IsIntegral::value); // If D is a pointer type, use [u]intptr_t as the addend type, @@ -527,7 +537,7 @@ inline D Atomic::sub(I sub_value, D volatile* dest) { AddendType addend = sub_value; // Assumes two's complement integer representation. #pragma warning(suppress: 4146) // In case AddendType is not signed. - return Atomic::add(-addend, dest); + return Atomic::add(-addend, dest, order); } // Define the class before including platform file, which may specialize @@ -541,7 +551,7 @@ struct Atomic::PlatformCmpxchg { T operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const; + atomic_memory_order order) const; }; // Define the class before including platform file, which may use this @@ -552,7 +562,7 @@ struct Atomic::CmpxchgByteUsingInt { T operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const; + atomic_memory_order order) const; }; // Define the class before including platform file, which may specialize @@ -564,7 +574,8 @@ template struct Atomic::PlatformXchg { template T operator()(T exchange_value, - T volatile* dest) const; + T volatile* dest, + atomic_memory_order order) const; }; // platform specific in-line definitions - must come before shared definitions @@ -589,8 +600,9 @@ inline void Atomic::store(T store_value, volatile D* dest) { } template -inline D Atomic::add(I add_value, D volatile* dest) { - return AddImpl()(add_value, dest); +inline D Atomic::add(I add_value, D volatile* dest, + atomic_memory_order order) { + return AddImpl()(add_value, dest, order); } template @@ -601,9 +613,9 @@ struct Atomic::AddImpl< (sizeof(I) <= sizeof(D)) && (IsSigned::value == IsSigned::value)>::type> { - D operator()(I add_value, D volatile* dest) const { + D operator()(I add_value, D volatile* dest, atomic_memory_order order) const { D addend = add_value; - return PlatformAdd()(addend, dest); + return PlatformAdd()(addend, dest, order); } }; @@ -612,14 +624,14 @@ struct Atomic::AddImpl< I, P*, typename EnableIf::value && (sizeof(I) <= sizeof(P*))>::type> { - P* operator()(I add_value, P* volatile* dest) const { + P* operator()(I add_value, P* volatile* dest, atomic_memory_order order) const { STATIC_ASSERT(sizeof(intptr_t) == sizeof(P*)); STATIC_ASSERT(sizeof(uintptr_t) == sizeof(P*)); typedef typename Conditional::value, intptr_t, uintptr_t>::type CI; CI addend = add_value; - return PlatformAdd()(addend, dest); + return PlatformAdd()(addend, dest, order); } }; @@ -634,13 +646,13 @@ struct Atomic::AddImpl< // Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment. template<> struct Atomic::AddImpl { - short operator()(short add_value, short volatile* dest) const { + short operator()(short add_value, short volatile* dest, atomic_memory_order order) const { #ifdef VM_LITTLE_ENDIAN assert((intx(dest) & 0x03) == 0x02, "wrong alignment"); - int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1)); + int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1), order); #else assert((intx(dest) & 0x03) == 0x00, "wrong alignment"); - int new_value = Atomic::add(add_value << 16, (volatile int*)(dest)); + int new_value = Atomic::add(add_value << 16, (volatile int*)(dest), order); #endif return (short)(new_value >> 16); // preserves sign } @@ -648,24 +660,26 @@ struct Atomic::AddImpl { template template -inline D Atomic::FetchAndAdd::operator()(I add_value, D volatile* dest) const { +inline D Atomic::FetchAndAdd::operator()(I add_value, D volatile* dest, + atomic_memory_order order) const { I addend = add_value; // If D is a pointer type P*, scale by sizeof(P). if (IsPointer::value) { addend *= sizeof(typename RemovePointer::type); } - D old = static_cast(this)->fetch_and_add(addend, dest); + D old = static_cast(this)->fetch_and_add(addend, dest, order); return old + add_value; } template template -inline D Atomic::AddAndFetch::operator()(I add_value, D volatile* dest) const { +inline D Atomic::AddAndFetch::operator()(I add_value, D volatile* dest, + atomic_memory_order order) const { // If D is a pointer type P*, scale by sizeof(P). if (IsPointer::value) { add_value *= sizeof(typename RemovePointer::type); } - return static_cast(this)->add_and_fetch(add_value, dest); + return static_cast(this)->add_and_fetch(add_value, dest, order); } template @@ -679,13 +693,13 @@ template inline D Atomic::cmpxchg(T exchange_value, D volatile* dest, U compare_value, - cmpxchg_memory_order order) { + atomic_memory_order order) { return CmpxchgImpl()(exchange_value, dest, compare_value, order); } template inline bool Atomic::replace_if_null(T* value, D* volatile* dest, - cmpxchg_memory_order order) { + atomic_memory_order order) { // Presently using a trivial implementation in terms of cmpxchg. // Consider adding platform support, to permit the use of compiler // intrinsics like gcc's __sync_bool_compare_and_swap. @@ -702,7 +716,7 @@ struct Atomic::CmpxchgImpl< typename EnableIf::value || IsRegisteredEnum::value>::type> { T operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { // Forward to the platform handler for the size of T. return PlatformCmpxchg()(exchange_value, dest, @@ -728,7 +742,7 @@ struct Atomic::CmpxchgImpl< typename RemoveCV::type>::value>::type> { D* operator()(T* exchange_value, D* volatile* dest, U* compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { // Allow derived to base conversion, and adding cv-qualifiers. D* new_value = exchange_value; // Don't care what the CV qualifiers for compare_value are, @@ -751,7 +765,7 @@ struct Atomic::CmpxchgImpl< typename EnableIf::value>::type> { T operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { typedef PrimitiveConversions::Translate Translator; typedef typename Translator::Decayed Decayed; STATIC_ASSERT(sizeof(T) == sizeof(Decayed)); @@ -779,7 +793,7 @@ template inline T Atomic::CmpxchgByteUsingInt::operator()(T exchange_value, T volatile* dest, T compare_value, - cmpxchg_memory_order order) const { + atomic_memory_order order) const { STATIC_ASSERT(sizeof(T) == sizeof(uint8_t)); uint8_t canon_exchange_value = exchange_value; uint8_t canon_compare_value = compare_value; @@ -821,9 +835,9 @@ struct Atomic::XchgImpl< T, T, typename EnableIf::value || IsRegisteredEnum::value>::type> { - T operator()(T exchange_value, T volatile* dest) const { + T operator()(T exchange_value, T volatile* dest, atomic_memory_order order) const { // Forward to the platform handler for the size of T. - return PlatformXchg()(exchange_value, dest); + return PlatformXchg()(exchange_value, dest, order); } }; @@ -837,10 +851,10 @@ struct Atomic::XchgImpl< T*, D*, typename EnableIf::value>::type> { - D* operator()(T* exchange_value, D* volatile* dest) const { + D* operator()(T* exchange_value, D* volatile* dest, atomic_memory_order order) const { // Allow derived to base conversion, and adding cv-qualifiers. D* new_value = exchange_value; - return PlatformXchg()(new_value, dest); + return PlatformXchg()(new_value, dest, order); } }; @@ -856,13 +870,14 @@ struct Atomic::XchgImpl< T, T, typename EnableIf::value>::type> { - T operator()(T exchange_value, T volatile* dest) const { + T operator()(T exchange_value, T volatile* dest, atomic_memory_order order) const { typedef PrimitiveConversions::Translate Translator; typedef typename Translator::Decayed Decayed; STATIC_ASSERT(sizeof(T) == sizeof(Decayed)); return Translator::recover( xchg(Translator::decay(exchange_value), - reinterpret_cast(dest))); + reinterpret_cast(dest), + order)); } }; @@ -877,8 +892,8 @@ inline T Atomic::xchg_using_helper(Fn fn, } template -inline D Atomic::xchg(T exchange_value, volatile D* dest) { - return XchgImpl()(exchange_value, dest); +inline D Atomic::xchg(T exchange_value, volatile D* dest, atomic_memory_order order) { + return XchgImpl()(exchange_value, dest, order); } #endif // SHARE_VM_RUNTIME_ATOMIC_HPP diff --git a/src/hotspot/share/runtime/frame.cpp b/src/hotspot/share/runtime/frame.cpp index 7a806670f46..6f15e42253b 100644 --- a/src/hotspot/share/runtime/frame.cpp +++ b/src/hotspot/share/runtime/frame.cpp @@ -1103,6 +1103,9 @@ void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) { void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) { #ifndef PRODUCT +#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5140 +#pragma error_messages(off, SEC_NULL_PTR_DEREF) +#endif // simulate GC crash here to dump java thread in error report if (CrashGCForDumpingJavaThread) { char *t = NULL; diff --git a/src/hotspot/share/utilities/globalCounter.cpp b/src/hotspot/share/utilities/globalCounter.cpp index db481f0fcf7..75a4439dc63 100644 --- a/src/hotspot/share/utilities/globalCounter.cpp +++ b/src/hotspot/share/utilities/globalCounter.cpp @@ -59,7 +59,8 @@ class GlobalCounter::CounterThreadCheck : public ThreadClosure { void GlobalCounter::write_synchronize() { assert((*Thread::current()->get_rcu_counter() & COUNTER_ACTIVE) == 0x0, "must be outside a critcal section"); // Atomic::add must provide fence since we have storeload dependency. - volatile uintx gbl_cnt = Atomic::add((uintx)COUNTER_INCREMENT, &_global_counter._counter); + volatile uintx gbl_cnt = Atomic::add((uintx)COUNTER_INCREMENT, &_global_counter._counter, + memory_order_conservative); // Do all RCU threads. CounterThreadCheck ctc(gbl_cnt); for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { diff --git a/src/hotspot/share/utilities/macros.hpp b/src/hotspot/share/utilities/macros.hpp index 00e0d511a8f..0d8635a4e1b 100644 --- a/src/hotspot/share/utilities/macros.hpp +++ b/src/hotspot/share/utilities/macros.hpp @@ -218,9 +218,13 @@ #if INCLUDE_NMT #define NOT_NMT_RETURN /* next token must be ; */ #define NOT_NMT_RETURN_(code) /* next token must be ; */ +#define NMT_ONLY(x) x +#define NOT_NMT(x) #else #define NOT_NMT_RETURN {} #define NOT_NMT_RETURN_(code) { return code; } +#define NMT_ONLY(x) +#define NOT_NMT(x) x #endif // INCLUDE_NMT #ifndef INCLUDE_TRACE diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index ab65ef91431..7a7d240c280 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1620,6 +1620,9 @@ bool VMError::check_timeout() { } #ifndef PRODUCT +#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5140 +#pragma error_messages(off, SEC_NULL_PTR_DEREF) +#endif typedef void (*voidfun_t)(); // Crash with an authentic sigfpe static void crash_with_sigfpe() { diff --git a/src/java.base/share/classes/java/lang/Character.java b/src/java.base/share/classes/java/lang/Character.java index d782c7dfcb4..f1b3772cd23 100644 --- a/src/java.base/share/classes/java/lang/Character.java +++ b/src/java.base/share/classes/java/lang/Character.java @@ -42,7 +42,7 @@ import jdk.internal.HotSpotIntrinsicCandidate; * a character's category (lowercase letter, digit, etc.) and for converting * characters from uppercase to lowercase and vice versa. *

- * Character information is based on the Unicode Standard, version 8.0.0. + * Character information is based on the Unicode Standard, version 10.0.0. *

* The methods and data of class {@code Character} are defined by * the information in the UnicodeData file that is part of the @@ -672,11 +672,11 @@ class Character implements java.io.Serializable, Comparable { */ public static final class UnicodeBlock extends Subset { /** - * 510 - the expected number of entities + * 638 - the expected number of entities * 0.75 - the default load factor of HashMap */ private static Map map = - new HashMap<>((int)(510 / 0.75f + 1.0f)); + new HashMap<>((int)(638 / 0.75f + 1.0f)); /** * Creates a UnicodeBlock with the given identifier name. @@ -2936,6 +2936,167 @@ class Character implements java.io.Serializable, Comparable { "CJK UNIFIED IDEOGRAPHS EXTENSION E", "CJKUNIFIEDIDEOGRAPHSEXTENSIONE"); + /** + * Constant for the "Syriac Supplement" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock SYRIAC_SUPPLEMENT = + new UnicodeBlock("SYRIAC_SUPPLEMENT", + "SYRIAC SUPPLEMENT", + "SYRIACSUPPLEMENT"); + + /** + * Constant for the "Cyrillic Extended-C" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock CYRILLIC_EXTENDED_C = + new UnicodeBlock("CYRILLIC_EXTENDED_C", + "CYRILLIC EXTENDED-C", + "CYRILLICEXTENDED-C"); + + /** + * Constant for the "Osage" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock OSAGE = + new UnicodeBlock("OSAGE"); + + /** + * Constant for the "Newa" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock NEWA = + new UnicodeBlock("NEWA"); + + /** + * Constant for the "Mongolian Supplement" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock MONGOLIAN_SUPPLEMENT = + new UnicodeBlock("MONGOLIAN_SUPPLEMENT", + "MONGOLIAN SUPPLEMENT", + "MONGOLIANSUPPLEMENT"); + + /** + * Constant for the "Marchen" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock MARCHEN = + new UnicodeBlock("MARCHEN"); + + /** + * Constant for the "Ideographic Symbols and Punctuation" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION = + new UnicodeBlock("IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION", + "IDEOGRAPHIC SYMBOLS AND PUNCTUATION", + "IDEOGRAPHICSYMBOLSANDPUNCTUATION"); + + /** + * Constant for the "Tangut" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock TANGUT = + new UnicodeBlock("TANGUT"); + + /** + * Constant for the "Tangut Components" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock TANGUT_COMPONENTS = + new UnicodeBlock("TANGUT_COMPONENTS", + "TANGUT COMPONENTS", + "TANGUTCOMPONENTS"); + + /** + * Constant for the "Kana Extended-A" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock KANA_EXTENDED_A = + new UnicodeBlock("KANA_EXTENDED_A", + "KANA EXTENDED-A", + "KANAEXTENDED-A"); + /** + * Constant for the "Glagolitic Supplement" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock GLAGOLITIC_SUPPLEMENT = + new UnicodeBlock("GLAGOLITIC_SUPPLEMENT", + "GLAGOLITIC SUPPLEMENT", + "GLAGOLITICSUPPLEMENT"); + /** + * Constant for the "Adlam" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock ADLAM = + new UnicodeBlock("ADLAM"); + + /** + * Constant for the "Masaram Gondi" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock MASARAM_GONDI = + new UnicodeBlock("MASARAM_GONDI", + "MASARAM GONDI", + "MASARAMGONDI"); + + /** + * Constant for the "Zanabazar Square" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock ZANABAZAR_SQUARE = + new UnicodeBlock("ZANABAZAR_SQUARE", + "ZANABAZAR SQUARE", + "ZANABAZARSQUARE"); + + /** + * Constant for the "Nushu" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock NUSHU = + new UnicodeBlock("NUSHU"); + + /** + * Constant for the "Soyombo" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock SOYOMBO = + new UnicodeBlock("SOYOMBO"); + + /** + * Constant for the "Bhaiksuki" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock BHAIKSUKI = + new UnicodeBlock("BHAIKSUKI"); + + /** + * Constant for the "CJK Unified Ideographs Extension F" Unicode + * character block. + * @since 11 + */ + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = + new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F", + "CJK UNIFIED IDEOGRAPHS EXTENSION F", + "CJKUNIFIEDIDEOGRAPHSEXTENSIONF"); private static final int blockStarts[] = { 0x0000, // 0000..007F; Basic Latin @@ -2957,7 +3118,8 @@ class Character implements java.io.Serializable, Comparable { 0x07C0, // 07C0..07FF; NKo 0x0800, // 0800..083F; Samaritan 0x0840, // 0840..085F; Mandaic - 0x0860, // unassigned + 0x0860, // 0860..086F; Syriac Supplement + 0x0870, // unassigned 0x08A0, // 08A0..08FF; Arabic Extended-A 0x0900, // 0900..097F; Devanagari 0x0980, // 0980..09FF; Bengali @@ -3000,7 +3162,8 @@ class Character implements java.io.Serializable, Comparable { 0x1BC0, // 1BC0..1BFF; Batak 0x1C00, // 1C00..1C4F; Lepcha 0x1C50, // 1C50..1C7F; Ol Chiki - 0x1C80, // unassigned + 0x1C80, // 1C80..1C8F; Cyrillic Extended-C + 0x1C90, // unassigned 0x1CC0, // 1CC0..1CCF; Sundanese Supplement 0x1CD0, // 1CD0..1CFF; Vedic Extensions 0x1D00, // 1D00..1D7F; Phonetic Extensions @@ -3120,7 +3283,7 @@ class Character implements java.io.Serializable, Comparable { 0x10400, // 10400..1044F; Deseret 0x10450, // 10450..1047F; Shavian 0x10480, // 10480..104AF; Osmanya - 0x104B0, // unassigned + 0x104B0, // 104B0..104FF; Osage 0x10500, // 10500..1052F; Elbasan 0x10530, // 10530..1056F; Caucasian Albanian 0x10570, // unassigned @@ -3166,19 +3329,28 @@ class Character implements java.io.Serializable, Comparable { 0x112B0, // 112B0..112FF; Khudawadi 0x11300, // 11300..1137F; Grantha 0x11380, // unassigned + 0x11400, // 11400..1147F; Newa 0x11480, // 11480..114DF; Tirhuta 0x114E0, // unassigned 0x11580, // 11580..115FF; Siddham 0x11600, // 11600..1165F; Modi - 0x11660, // unassigned + 0x11660, // 11660..1167F; Mongolian Supplement 0x11680, // 11680..116CF; Takri 0x116D0, // unassigned 0x11700, // 11700..1173F; Ahom 0x11740, // unassigned 0x118A0, // 118A0..118FF; Warang Citi 0x11900, // unassigned + 0x11A00, // 11A00..11A4F; Zanabazar Square + 0x11A50, // 11A50..11AAF; Soyombo + 0x11AB0, // unassigned 0x11AC0, // 11AC0..11AFF; Pau Cin Hau 0x11B00, // unassigned + 0x11C00, // 11C00..11C6F; Bhaiksuki + 0x11C70, // 11C70..11CBF; Marchen + 0x11CC0, // unassigned + 0x11D00, // 11D00..11D5F; Masaram Gondi + 0x11D60, // unassigned 0x12000, // 12000..123FF; Cuneiform 0x12400, // 12400..1247F; Cuneiform Numbers and Punctuation 0x12480, // 12480..1254F; Early Dynastic Cuneiform @@ -3195,8 +3367,15 @@ class Character implements java.io.Serializable, Comparable { 0x16B90, // unassigned 0x16F00, // 16F00..16F9F; Miao 0x16FA0, // unassigned + 0x16FE0, // 16FE0..16FFF; Ideographic Symbols and Punctuation + 0x17000, // 17000..187FF; Tangut + 0x18800, // 18800..18AFF; Tangut Components + 0x18B00, // unassigned 0x1B000, // 1B000..1B0FF; Kana Supplement - 0x1B100, // unassigned + 0x1B100, // 1B100..1B12F; Kana Extended-A + 0x1B130, // unassigned + 0x1B170, // 1B170..1B2FF; Nushu + 0x1B300, // unassigned 0x1BC00, // 1BC00..1BC9F; Duployan 0x1BCA0, // 1BCA0..1BCAF; Shorthand Format Controls 0x1BCB0, // unassigned @@ -3210,8 +3389,12 @@ class Character implements java.io.Serializable, Comparable { 0x1D400, // 1D400..1D7FF; Mathematical Alphanumeric Symbols 0x1D800, // 1D800..1DAAF; Sutton SignWriting 0x1DAB0, // unassigned + 0x1E000, // 1E000..1E02F; Glagolitic Supplement + 0x1E030, // unassigned 0x1E800, // 1E800..1E8DF; Mende Kikakui 0x1E8E0, // unassigned + 0x1E900, // 1E900..1E95F; Adlam + 0x1E960, // unassigned 0x1EE00, // 1EE00..1EEFF; Arabic Mathematical Alphabetic Symbols 0x1EF00, // unassigned 0x1F000, // 1F000..1F02F; Mahjong Tiles @@ -3233,7 +3416,8 @@ class Character implements java.io.Serializable, Comparable { 0x2A700, // 2A700..2B73F; CJK Unified Ideographs Extension C 0x2B740, // 2B740..2B81F; CJK Unified Ideographs Extension D 0x2B820, // 2B820..2CEAF; CJK Unified Ideographs Extension E - 0x2CEB0, // unassigned + 0x2CEB0, // 2CEB0..2EBEF; CJK Unified Ideographs Extension F + 0x2EBF0, // unassigned 0x2F800, // 2F800..2FA1F; CJK Compatibility Ideographs Supplement 0x2FA20, // unassigned 0xE0000, // E0000..E007F; Tags @@ -3264,6 +3448,7 @@ class Character implements java.io.Serializable, Comparable { NKO, SAMARITAN, MANDAIC, + SYRIAC_SUPPLEMENT, null, ARABIC_EXTENDED_A, DEVANAGARI, @@ -3307,6 +3492,7 @@ class Character implements java.io.Serializable, Comparable { BATAK, LEPCHA, OL_CHIKI, + CYRILLIC_EXTENDED_C, null, SUNDANESE_SUPPLEMENT, VEDIC_EXTENSIONS, @@ -3427,7 +3613,7 @@ class Character implements java.io.Serializable, Comparable { DESERET, SHAVIAN, OSMANYA, - null, + OSAGE, ELBASAN, CAUCASIAN_ALBANIAN, null, @@ -3473,19 +3659,28 @@ class Character implements java.io.Serializable, Comparable { KHUDAWADI, GRANTHA, null, + NEWA, TIRHUTA, null, SIDDHAM, MODI, - null, + MONGOLIAN_SUPPLEMENT, TAKRI, null, AHOM, null, WARANG_CITI, null, + ZANABAZAR_SQUARE, + SOYOMBO, + null, PAU_CIN_HAU, null, + BHAIKSUKI, + MARCHEN, + null, + MASARAM_GONDI, + null, CUNEIFORM, CUNEIFORM_NUMBERS_AND_PUNCTUATION, EARLY_DYNASTIC_CUNEIFORM, @@ -3502,7 +3697,14 @@ class Character implements java.io.Serializable, Comparable { null, MIAO, null, + IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION, + TANGUT, + TANGUT_COMPONENTS, + null, KANA_SUPPLEMENT, + KANA_EXTENDED_A, + null, + NUSHU, null, DUPLOYAN, SHORTHAND_FORMAT_CONTROLS, @@ -3517,8 +3719,12 @@ class Character implements java.io.Serializable, Comparable { MATHEMATICAL_ALPHANUMERIC_SYMBOLS, SUTTON_SIGNWRITING, null, + GLAGOLITIC_SUPPLEMENT, + null, MENDE_KIKAKUI, null, + ADLAM, + null, ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS, null, MAHJONG_TILES, @@ -3540,6 +3746,7 @@ class Character implements java.io.Serializable, Comparable { CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E, + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F, null, CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT, null, @@ -4363,6 +4570,66 @@ class Character implements java.io.Serializable, Comparable { */ SIGNWRITING, + /** + * Unicode script "Adlam". + * @since 11 + */ + ADLAM, + + /** + * Unicode script "Bhaiksuki". + * @since 11 + */ + BHAIKSUKI, + + /** + * Unicode script "Marchen". + * @since 11 + */ + MARCHEN, + + /** + * Unicode script "Newa". + * @since 11 + */ + NEWA, + + /** + * Unicode script "Osage". + * @since 11 + */ + OSAGE, + + /** + * Unicode script "Tangut". + * @since 11 + */ + TANGUT, + + /** + * Unicode script "Masaram Gondi". + * @since 11 + */ + MASARAM_GONDI, + + /** + * Unicode script "Nushu". + * @since 11 + */ + NUSHU, + + /** + * Unicode script "Soyombo". + * @since 11 + */ + SOYOMBO, + + /** + * Unicode script "Zanabazar Square". + * @since 11 + */ + ZANABAZAR_SQUARE, + /** * Unicode script "Unknown". */ @@ -4436,7 +4703,8 @@ class Character implements java.io.Serializable, Comparable { 0x0606, // 0606..060B; ARABIC 0x060C, // 060C ; COMMON 0x060D, // 060D..061A; ARABIC - 0x061B, // 061B..061C; COMMON + 0x061B, // 061B ; COMMON + 0x061C, // 061C ; ARABIC 0x061D, // 061D ; UNKNOWN 0x061E, // 061E ; ARABIC 0x061F, // 061F ; COMMON @@ -4466,9 +4734,15 @@ class Character implements java.io.Serializable, Comparable { 0x0840, // 0840..085B; MANDAIC 0x085C, // 085C..085D; UNKNOWN 0x085E, // 085E ; MANDAIC - 0x085F, // 085F..089F; UNKNOWN + 0x085F, // 085F ; UNKNOWN + 0x0860, // 0860..086A; SYRIAC + 0x086B, // 086B..089F; UNKNOWN 0x08A0, // 08A0..08B4; ARABIC - 0x08B5, // 08B5..08E2; UNKNOWN + 0x08B5, // 08B5 ; UNKNOWN + 0x08B6, // 08B6..08BD; ARABIC + 0x08BE, // 08BE..08D3; UNKNOWN + 0x08D4, // 08D4..08E1; ARABIC + 0x08E2, // 08E2 ; COMMON 0x08E3, // 08E3..08FF; ARABIC 0x0900, // 0900..0950; DEVANAGARI 0x0951, // 0951..0952; INHERITED @@ -4501,8 +4775,8 @@ class Character implements java.io.Serializable, Comparable { 0x09DE, // 09DE ; UNKNOWN 0x09DF, // 09DF..09E3; BENGALI 0x09E4, // 09E4..09E5; UNKNOWN - 0x09E6, // 09E6..09FB; BENGALI - 0x09FC, // 09FC..0A00; UNKNOWN + 0x09E6, // 09E6..09FD; BENGALI + 0x09FE, // 09FE..0A00; UNKNOWN 0x0A01, // 0A01..0A03; GURMUKHI 0x0A04, // 0A04 ; UNKNOWN 0x0A05, // 0A05..0A0A; GURMUKHI @@ -4561,8 +4835,8 @@ class Character implements java.io.Serializable, Comparable { 0x0AE4, // 0AE4..0AE5; UNKNOWN 0x0AE6, // 0AE6..0AF1; GUJARATI 0x0AF2, // 0AF2..0AF8; UNKNOWN - 0x0AF9, // 0AF9 ; GUJARATI - 0x0AFA, // 0AFA..0B00; UNKNOWN + 0x0AF9, // 0AF9..0AFF; GUJARATI + 0x0B00, // 0B00 ; UNKNOWN 0x0B01, // 0B01..0B03; ORIYA 0x0B04, // 0B04 ; UNKNOWN 0x0B05, // 0B05..0B0C; ORIYA @@ -4648,8 +4922,7 @@ class Character implements java.io.Serializable, Comparable { 0x0C66, // 0C66..0C6F; TELUGU 0x0C70, // 0C70..0C77; UNKNOWN 0x0C78, // 0C78..0C7F; TELUGU - 0x0C80, // 0C80 ; UNKNOWN - 0x0C81, // 0C81..0C83; KANNADA + 0x0C80, // 0C80..0C83; KANNADA 0x0C84, // 0C84 ; UNKNOWN 0x0C85, // 0C85..0C8C; KANNADA 0x0C8D, // 0C8D ; UNKNOWN @@ -4676,28 +4949,22 @@ class Character implements java.io.Serializable, Comparable { 0x0CE6, // 0CE6..0CEF; KANNADA 0x0CF0, // 0CF0 ; UNKNOWN 0x0CF1, // 0CF1..0CF2; KANNADA - 0x0CF3, // 0CF3..0D00; UNKNOWN - 0x0D01, // 0D01..0D03; MALAYALAM + 0x0CF3, // 0CF3..0CFF; UNKNOWN + 0x0D00, // 0D00..0D03; MALAYALAM 0x0D04, // 0D04 ; UNKNOWN 0x0D05, // 0D05..0D0C; MALAYALAM 0x0D0D, // 0D0D ; UNKNOWN 0x0D0E, // 0D0E..0D10; MALAYALAM 0x0D11, // 0D11 ; UNKNOWN - 0x0D12, // 0D12..0D3A; MALAYALAM - 0x0D3B, // 0D3B..0D3C; UNKNOWN - 0x0D3D, // 0D3D..0D44; MALAYALAM + 0x0D12, // 0D12..0D44; MALAYALAM 0x0D45, // 0D45 ; UNKNOWN 0x0D46, // 0D46..0D48; MALAYALAM 0x0D49, // 0D49 ; UNKNOWN - 0x0D4A, // 0D4A..0D4E; MALAYALAM - 0x0D4F, // 0D4F..0D56; UNKNOWN - 0x0D57, // 0D57 ; MALAYALAM - 0x0D58, // 0D58..0D5E; UNKNOWN - 0x0D5F, // 0D5F..0D63; MALAYALAM + 0x0D4A, // 0D4A..0D4F; MALAYALAM + 0x0D50, // 0D50..0D53; UNKNOWN + 0x0D54, // 0D54..0D63; MALAYALAM 0x0D64, // 0D64..0D65; UNKNOWN - 0x0D66, // 0D66..0D75; MALAYALAM - 0x0D76, // 0D76..0D78; UNKNOWN - 0x0D79, // 0D79..0D7F; MALAYALAM + 0x0D66, // 0D66..0D7F; MALAYALAM 0x0D80, // 0D80..0D81; UNKNOWN 0x0D82, // 0D82..0D83; SINHALA 0x0D84, // 0D84 ; UNKNOWN @@ -4921,7 +5188,8 @@ class Character implements java.io.Serializable, Comparable { 0x1C4A, // 1C4A..1C4C; UNKNOWN 0x1C4D, // 1C4D..1C4F; LEPCHA 0x1C50, // 1C50..1C7F; OL_CHIKI - 0x1C80, // 1C80..1CBF; UNKNOWN + 0x1C80, // 1C80..1C88; CYRILLIC + 0x1C89, // 1C89..1CBF; UNKNOWN 0x1CC0, // 1CC0..1CC7; SUNDANESE 0x1CC8, // 1CC8..1CCF; UNKNOWN 0x1CD0, // 1CD0..1CD2; INHERITED @@ -4933,8 +5201,7 @@ class Character implements java.io.Serializable, Comparable { 0x1CED, // 1CED ; INHERITED 0x1CEE, // 1CEE..1CF3; COMMON 0x1CF4, // 1CF4 ; INHERITED - 0x1CF5, // 1CF5..1CF6; COMMON - 0x1CF7, // 1CF7 ; UNKNOWN + 0x1CF5, // 1CF5..1CF7; COMMON 0x1CF8, // 1CF8..1CF9; INHERITED 0x1CFA, // 1CFA..1CFF; UNKNOWN 0x1D00, // 1D00..1D25; LATIN @@ -4948,9 +5215,9 @@ class Character implements java.io.Serializable, Comparable { 0x1D78, // 1D78 ; CYRILLIC 0x1D79, // 1D79..1DBE; LATIN 0x1DBF, // 1DBF ; GREEK - 0x1DC0, // 1DC0..1DF5; INHERITED - 0x1DF6, // 1DF6..1DFB; UNKNOWN - 0x1DFC, // 1DFC..1DFF; INHERITED + 0x1DC0, // 1DC0..1DF9; INHERITED + 0x1DFA, // 1DFA ; UNKNOWN + 0x1DFB, // 1DFB..1DFF; INHERITED 0x1E00, // 1E00..1EFF; LATIN 0x1F00, // 1F00..1F15; GREEK 0x1F16, // 1F16..1F17; UNKNOWN @@ -4997,8 +5264,8 @@ class Character implements java.io.Serializable, Comparable { 0x208F, // 208F ; UNKNOWN 0x2090, // 2090..209C; LATIN 0x209D, // 209D..209F; UNKNOWN - 0x20A0, // 20A0..20BE; COMMON - 0x20BF, // 20BF..20CF; UNKNOWN + 0x20A0, // 20A0..20BF; COMMON + 0x20C0, // 20C0..20CF; UNKNOWN 0x20D0, // 20D0..20F0; INHERITED 0x20F1, // 20F1..20FF; UNKNOWN 0x2100, // 2100..2125; COMMON @@ -5013,9 +5280,7 @@ class Character implements java.io.Serializable, Comparable { 0x2160, // 2160..2188; LATIN 0x2189, // 2189..218B; COMMON 0x218C, // 218C..218F; UNKNOWN - 0x2190, // 2190..23FA; COMMON - 0x23FB, // 23FB..23FF; UNKNOWN - 0x2400, // 2400..2426; COMMON + 0x2190, // 2190..2426; COMMON 0x2427, // 2427..243F; UNKNOWN 0x2440, // 2440..244A; COMMON 0x244B, // 244B..245F; UNKNOWN @@ -5029,8 +5294,8 @@ class Character implements java.io.Serializable, Comparable { 0x2BBA, // 2BBA..2BBC; UNKNOWN 0x2BBD, // 2BBD..2BC8; COMMON 0x2BC9, // 2BC9 ; UNKNOWN - 0x2BCA, // 2BCA..2BD1; COMMON - 0x2BD2, // 2BD2..2BEB; UNKNOWN + 0x2BCA, // 2BCA..2BD2; COMMON + 0x2BD3, // 2BD3..2BEB; UNKNOWN 0x2BEC, // 2BEC..2BEF; COMMON 0x2BF0, // 2BF0..2BFF; UNKNOWN 0x2C00, // 2C00..2C2E; GLAGOLITIC @@ -5071,8 +5336,8 @@ class Character implements java.io.Serializable, Comparable { 0x2DD8, // 2DD8..2DDE; ETHIOPIC 0x2DDF, // 2DDF ; UNKNOWN 0x2DE0, // 2DE0..2DFF; CYRILLIC - 0x2E00, // 2E00..2E42; COMMON - 0x2E43, // 2E43..2E7F; UNKNOWN + 0x2E00, // 2E00..2E49; COMMON + 0x2E50, // 2E50..2E7F; UNKNOWN 0x2E80, // 2E80..2E99; HAN 0x2E9A, // 2E9A ; UNKNOWN 0x2E9B, // 2E9B..2EF3; HAN @@ -5103,8 +5368,8 @@ class Character implements java.io.Serializable, Comparable { 0x30FB, // 30FB..30FC; COMMON 0x30FD, // 30FD..30FF; KATAKANA 0x3100, // 3100..3104; UNKNOWN - 0x3105, // 3105..312D; BOPOMOFO - 0x312E, // 312E..3130; UNKNOWN + 0x3105, // 3105..312E; BOPOMOFO + 0x312F, // 312F..3130; UNKNOWN 0x3131, // 3131..318E; HANGUL 0x318F, // 318F ; UNKNOWN 0x3190, // 3190..319F; COMMON @@ -5125,8 +5390,8 @@ class Character implements java.io.Serializable, Comparable { 0x3400, // 3400..4DB5; HAN 0x4DB6, // 4DB6..4DBF; UNKNOWN 0x4DC0, // 4DC0..4DFF; COMMON - 0x4E00, // 4E00..9FD5; HAN - 0x9FD6, // 9FD6..9FFF; UNKNOWN + 0x4E00, // 4E00..9FEA; HAN + 0x9FEB, // 9FEB..9FFF; UNKNOWN 0xA000, // A000..A48C; YI 0xA48D, // A48D..A48F; UNKNOWN 0xA490, // A490..A4C6; YI @@ -5140,8 +5405,8 @@ class Character implements java.io.Serializable, Comparable { 0xA700, // A700..A721; COMMON 0xA722, // A722..A787; LATIN 0xA788, // A788..A78A; COMMON - 0xA78B, // A78B..A7AD; LATIN - 0xA7AE, // A7AE..A7AF; UNKNOWN + 0xA78B, // A78B..A7AE; LATIN + 0xA7AF, // A7AF ; UNKNOWN 0xA7B0, // A7B0..A7B7; LATIN 0xA7B8, // A7B8..A7F6; UNKNOWN 0xA7F7, // A7F7..A7FF; LATIN @@ -5151,8 +5416,8 @@ class Character implements java.io.Serializable, Comparable { 0xA83A, // A83A..A83F; UNKNOWN 0xA840, // A840..A877; PHAGS_PA 0xA878, // A878..A87F; UNKNOWN - 0xA880, // A880..A8C4; SAURASHTRA - 0xA8C5, // A8C5..A8CD; UNKNOWN + 0xA880, // A880..A8C5; SAURASHTRA + 0xA8C6, // A8C6..A8CD; UNKNOWN 0xA8CE, // A8CE..A8D9; SAURASHTRA 0xA8DA, // A8DA..A8DF; UNKNOWN 0xA8E0, // A8E0..A8FD; DEVANAGARI @@ -5303,8 +5568,8 @@ class Character implements java.io.Serializable, Comparable { 0x10107, // 10107..10133; COMMON 0x10134, // 10134..10136; UNKNOWN 0x10137, // 10137..1013F; COMMON - 0x10140, // 10140..1018C; GREEK - 0x1018D, // 1018D..1018F; UNKNOWN + 0x10140, // 10140..1018E; GREEK + 0x1018F, // 1018F ; UNKNOWN 0x10190, // 10190..1019B; COMMON 0x1019C, // 1019C..1019F; UNKNOWN 0x101A0, // 101A0 ; GREEK @@ -5320,7 +5585,8 @@ class Character implements java.io.Serializable, Comparable { 0x102E1, // 102E1..102FB; COMMON 0x102FC, // 102FC..102FF; UNKNOWN 0x10300, // 10300..10323; OLD_ITALIC - 0x10324, // 10324..1032F; UNKNOWN + 0x10324, // 10324..1032C; UNKNOWN + 0x1032D, // 1032D..1032F; OLD_ITALIC 0x10330, // 10330..1034A; GOTHIC 0x1034B, // 1034B..1034F; UNKNOWN 0x10350, // 10350..1037A; OLD_PERMIC @@ -5337,7 +5603,11 @@ class Character implements java.io.Serializable, Comparable { 0x10480, // 10480..1049D; OSMANYA 0x1049E, // 1049E..1049F; UNKNOWN 0x104A0, // 104A0..104A9; OSMANYA - 0x104AA, // 104AA..104FF; UNKNOWN + 0x104AA, // 104AA..104AF; UNKNOWN + 0x104B0, // 104B0..104D3; OSAGE + 0x104D4, // 104D4..104D7; UNKNOWN + 0x104D8, // 104D8..104FB; OSAGE + 0x104FC, // 104FC..104FF; UNKNOWN 0x10500, // 10500..10527; ELBASAN 0x10528, // 10528..1052F; UNKNOWN 0x10530, // 10530..10563; CAUCASIAN_ALBANIAN @@ -5460,8 +5730,8 @@ class Character implements java.io.Serializable, Comparable { 0x111F5, // 111F5..111FF; UNKNOWN 0x11200, // 11200..11211; KHOJKI 0x11212, // 11212 ; UNKNOWN - 0x11213, // 11213..1123D; KHOJKI - 0x1123E, // 1123E..1127F; UNKNOWN + 0x11213, // 11213..1123E; KHOJKI + 0x1123F, // 1123F..1127F; UNKNOWN 0x11280, // 11280..11286; MULTANI 0x11287, // 11287 ; UNKNOWN 0x11288, // 11288 ; MULTANI @@ -5505,7 +5775,13 @@ class Character implements java.io.Serializable, Comparable { 0x11366, // 11366..1136C; GRANTHA 0x1136D, // 1136D..1136F; UNKNOWN 0x11370, // 11370..11374; GRANTHA - 0x11375, // 11375..1147F; UNKNOWN + 0x11375, // 11375..113FF; UNKNOWN + 0x11400, // 11400..11459; NEWA + 0x1145A, // 1145A ; UNKNOWN + 0x1145B, // 1145B ; NEWA + 0x1145C, // 1145C ; UNKNOWN + 0x1145D, // 1145D ; NEWA + 0x1145E, // 1145E..1147F; UNKNOWN 0x11480, // 11480..114C7; TIRHUTA 0x114C8, // 114C8..114CF; UNKNOWN 0x114D0, // 114D0..114D9; TIRHUTA @@ -5517,7 +5793,9 @@ class Character implements java.io.Serializable, Comparable { 0x11600, // 11600..11644; MODI 0x11645, // 11645..1164F; UNKNOWN 0x11650, // 11650..11659; MODI - 0x1165A, // 1165A..1167F; UNKNOWN + 0x1165A, // 1165A..1165F; UNKNOWN + 0x11660, // 11660..1166C; MONGOLIAN + 0X1166D, // 1166D..1167F; UNKNOWN 0x11680, // 11680..116B7; TAKRI 0x116B8, // 116B8..116BF; UNKNOWN 0x116C0, // 116C0..116C9; TAKRI @@ -5531,9 +5809,45 @@ class Character implements java.io.Serializable, Comparable { 0x118A0, // 118A0..118F2; WARANG_CITI 0x118F3, // 118F3..118FE; UNKNOWN 0x118FF, // 118FF ; WARANG_CITI - 0x11900, // 11900..11ABF; UNKNOWN + 0x11900, // 11900..119FF; UNKNOWN + 0x11A00, // 11A00..11A47; ZANABAZAR_SQUARE + 0X11A48, // 11A48..11A4F; UNKNOWN + 0x11A50, // 11A50..11A83; SOYOMBO + 0x11A84, // 11A84..11A85; UNKNOWN + 0x11A86, // 11A86..11A9C; SOYOMBO + 0x11A9D, // 11A9D ; UNKNOWN + 0x11A9E, // 11A9E..11AA2; SOYOMBO + 0x11AA3, // 11AA3..11ABF; UNKNOWN 0x11AC0, // 11AC0..11AF8; PAU_CIN_HAU - 0x11AF9, // 11AF9..11FFF; UNKNOWN + 0x11AF9, // 11AF9..11BFF; UNKNOWN + 0x11C00, // 11C00..11C08; BHAIKSUKI + 0x11C09, // 11C09 ; UNKNOWN + 0x11C0A, // 11C0A..11C36; BHAIKSUKI + 0x11C37, // 11C37 ; UNKNOWN + 0x11C38, // 11C38..11C45; BHAIKSUKI + 0x11C46, // 11C46..11C49; UNKNOWN + 0x11C50, // 11C50..11C6C; BHAIKSUKI + 0x11C6D, // 11C6D..11C6F; UNKNOWN + 0x11C70, // 11C70..11C8F; MARCHEN + 0x11C90, // 11C90..11C91; UNKNOWN + 0x11C92, // 11C92..11CA7; MARCHEN + 0x11CA8, // 11CA8 ; UNKNOWN + 0x11CA9, // 11CA9..11CB6; MARCHEN + 0x11CB7, // 11CB7..11CFF; UNKNOWN + 0x11D00, // 11D00..11D06; MASARAM_GONDI + 0x11D07, // 11D07 ; UNKNOWN + 0x11D08, // 11D08..11D09; MASARAM_GONDI + 0x11D0A, // 11D0A ; UNKNOWN + 0x11D0B, // 11D0B..11D36; MASARAM_GONDI + 0x11D37, // 11D37..11D39; UNKNOWN + 0x11D3A, // 11D3A ; MASARAM_GONDI + 0x11D3B, // 11D3B ; UNKNOWN + 0x11D3C, // 11D3C..11D3D; MASARAM_GONDI + 0x11D3E, // 11D3E ; UNKNOWN + 0x11D3F, // 11D3F..11D47; MASARAM_GONDI + 0x11D48, // 11D48..11D49, UNKNOWN + 0x11D50, // 11D50..11D59; MASARAM_GONDI + 0x11D5A, // 11D5A..1AFFF; UNKNOWN 0x12000, // 12000..12399; CUNEIFORM 0x1239A, // 1239A..123FF; UNKNOWN 0x12400, // 12400..1246E; CUNEIFORM @@ -5573,10 +5887,19 @@ class Character implements java.io.Serializable, Comparable { 0x16F50, // 16F50..16F7E; MIAO 0x16F7F, // 16F7F..16F8E; UNKNOWN 0x16F8F, // 16F8F..16F9F; MIAO - 0x16FA0, // 16FA0..1AFFF; UNKNOWN + 0x16FA0, // 16FA0..16FDF; UNKNOWN + 0x16FE0, // 16FE0 ; TANGUT + 0x16FE1, // 16FE1 ; NUSHU + 0x16FE2, // 16FE2..16FFF; UNKNOWN + 0x17000, // 17000..187EC; TANGUT + 0x187ED, // 187ED..187FF; UNKNOWN + 0x18800, // 18800..18AF2; TANGUT + 0x18AF3, // 18AF3..1AFFF; UNKNOWN 0x1B000, // 1B000 ; KATAKANA - 0x1B001, // 1B001 ; HIRAGANA - 0x1B002, // 1B002..1BBFF; UNKNOWN + 0x1B001, // 1B001..1B11E; HIRAGANA + 0x1B11F, // 1B11F..1B16F; UNKNOWN + 0x1B170, // 1B170..1B2FB; NUSHU + 0x1B2FC, // 1B2FC..1BBFF; UNKNOWN 0x1BC00, // 1BC00..1BC6A; DUPLOYAN 0x1BC6B, // 1BC6B..1BC6F; UNKNOWN 0x1BC70, // 1BC70..1BC7C; DUPLOYAN @@ -5654,11 +5977,27 @@ class Character implements java.io.Serializable, Comparable { 0x1DA9B, // 1DA9B..1DA9F; SIGNWRITING 0x1DAA0, // 1DAA0 ; UNKNOWN 0x1DAA1, // 1DAA1..1DAAF; SIGNWRITING - 0x1DAB0, // 1DAB0..1E7FF; UNKNOWN + 0x1DAB0, // 1DAB0..1DFFF; UNKNOWN + 0x1E000, // 1E000..1E006; GLAGOLITIC + 0x1E007, // 1E007 ; UNKNOWN + 0x1E008, // 1E008..1E018; GLAGOLITIC + 0x1E019, // 1E019..1E01A; UNKNOWN + 0x1E01B, // 1E01B..1E021; GLAGOLITIC + 0x1E022, // 1E022 ; UNKNOWN + 0x1E023, // 1E023..1E024; GLAGOLITIC + 0x1E025, // 1E025 ; UNKNOWN + 0x1E026, // 1E026..1E02A; GLAGOLITIC + 0x1E02B, // 1E02B..1E7FF; UNKNOWN 0x1E800, // 1E800..1E8C4; MENDE_KIKAKUI 0x1E8C5, // 1E8C5..1E8C6; UNKNOWN 0x1E8C7, // 1E8C7..1E8D6; MENDE_KIKAKUI - 0x1E8D7, // 1E8D7..1EDFF; UNKNOWN + 0x1E8D7, // 1E8D7..1E8FF; UNKNOWN + 0x1E900, // 1E900..1E94A; ADLAM + 0x1E94B, // 1E94B..1E94F; UNKNOWN + 0x1E950, // 1E950..1E959; ADLAM + 0x1E95A, // 1E95A..1E95D; UNKNOWN + 0x1E95E, // 1E95E..1E95F; ADLAM + 0x1E960, // 1E960..1EDFF; UNKNOWN 0x1EE00, // 1EE00..1EE03; ARABIC 0x1EE04, // 1EE04 ; UNKNOWN 0x1EE05, // 1EE05..1EE1F; ARABIC @@ -5745,28 +6084,26 @@ class Character implements java.io.Serializable, Comparable { 0x1F12F, // 1F12F ; UNKNOWN 0x1F130, // 1F130..1F16B; COMMON 0x1F16C, // 1F16C..1F16F; UNKNOWN - 0x1F170, // 1F170..1F19A; COMMON - 0x1F19B, // 1F19B..1F1E5; UNKNOWN + 0x1F170, // 1F170..1F1AC; COMMON + 0x1F1AD, // 1F1AD..1F1E5; UNKNOWN 0x1F1E6, // 1F1E6..1F1FF; COMMON 0x1F200, // 1F200 ; HIRAGANA 0x1F201, // 1F201..1F202; COMMON 0x1F203, // 1F203..1F20F; UNKNOWN - 0x1F210, // 1F210..1F23A; COMMON - 0x1F23B, // 1F23B..1F23F; UNKNOWN + 0x1F210, // 1F210..1F23B; COMMON + 0x1F23C, // 1F23C..1F23F; UNKNOWN 0x1F240, // 1F240..1F248; COMMON 0x1F249, // 1F249..1F24F; UNKNOWN 0x1F250, // 1F250..1F251; COMMON - 0x1F252, // 1F252..1F2FF; UNKNOWN - 0x1F300, // 1F300..1F579; COMMON - 0x1F57A, // 1F57A ; UNKNOWN - 0x1F57B, // 1F57B..1F5A3; COMMON - 0x1F5A4, // 1F5A4 ; UNKNOWN - 0x1F5A5, // 1F5A5..1F6D0; COMMON - 0x1F6D1, // 1F6D1..1F6DF; UNKNOWN + 0x1F252, // 1F252..1F25F; UNKNOWN + 0x1F260, // 1F260..1F265; COMMON + 0x1F266, // 1F266..1F2FF; UNKNOWN + 0x1F300, // 1F300..1F6D4; COMMON + 0x1F6D5, // 1F6D5..1F6DF; UNKNOWN 0x1F6E0, // 1F6E0..1F6EC; COMMON 0x1F6ED, // 1F6ED..1F6EF; UNKNOWN - 0x1F6F0, // 1F6F0..1F6F3; COMMON - 0x1F6F4, // 1F6F4..1F6FF; UNKNOWN + 0x1F6F0, // 1F6F0..1F6F8; COMMON + 0x1F6F9, // 1F6F9..1F6FF; UNKNOWN 0x1F700, // 1F700..1F773; COMMON 0x1F774, // 1F774..1F77F; UNKNOWN 0x1F780, // 1F780..1F7D4; COMMON @@ -5780,13 +6117,21 @@ class Character implements java.io.Serializable, Comparable { 0x1F860, // 1F860..1F887; COMMON 0x1F888, // 1F888..1F88F; UNKNOWN 0x1F890, // 1F890..1F8AD; COMMON - 0x1F8AE, // 1F8AE..1F90F; UNKNOWN - 0x1F910, // 1F910..1F918; COMMON - 0x1F919, // 1F919..1F97F; UNKNOWN - 0x1F980, // 1F980..1F984; COMMON - 0x1F985, // 1F985..1F9BF; UNKNOWN + 0x1F8AE, // 1F8AE..1F8FF; UNKNOWN + 0x1F900, // 1F900..1F90B; COMMON + 0x1F90C, // 1F90C..1F90F; UNKNOWN + 0x1F910, // 1F910..1F93E; COMMON + 0x1F93F, // 1F93F ; UNKNOWN + 0x1F940, // 1F940..1F94C; COMMON + 0x1F94D, // 1F94D..1F94F; UNKNOWN + 0x1F950, // 1F950..1F96B; COMMON + 0x1F96C, // 1F96C..1F97F; UNKNOWN + 0x1F980, // 1F980..1F997; COMMON + 0x1F998, // 1F998..1F9BF; UNKNOWN 0x1F9C0, // 1F9C0 ; COMMON - 0x1F9C1, // 1F9C1..1FFFF; UNKNOWN + 0x1F9C1, // 1F9C1..1F9CF; UNKNOWN + 0x1F9D0, // 1F9D0..1F9E6; COMMON + 0x1F9E7, // 1F9E7..1FFFF; UNKNOWN 0x20000, // 20000..2A6D6; HAN 0x2A6D7, // 2A6D7..2A6FF; UNKNOWN 0x2A700, // 2A700..2B734; HAN @@ -5794,7 +6139,9 @@ class Character implements java.io.Serializable, Comparable { 0x2B740, // 2B740..2B81D; HAN 0x2B81E, // 2B81E..2B81F; UNKNOWN 0x2B820, // 2B820..2CEA1; HAN - 0x2CEA2, // 2CEA2..2F7FF; UNKNOWN + 0x2CEA2, // 2CEA2..2CEAF; UNKNOWN + 0x2CEB0, // 2CEB0..2EBE0; HAN + 0x2EBE1, // 2EBE1..2F7FF; UNKNOWN 0x2F800, // 2F800..2FA1D; HAN 0x2FA1E, // 2FA1E..E0000; UNKNOWN 0xE0001, // E0001 ; COMMON @@ -5873,7 +6220,8 @@ class Character implements java.io.Serializable, Comparable { ARABIC, // 0606..060B COMMON, // 060C ARABIC, // 060D..061A - COMMON, // 061B..061C + COMMON, // 061B + ARABIC, // 061C UNKNOWN, // 061D ARABIC, // 061E COMMON, // 061F @@ -5903,9 +6251,15 @@ class Character implements java.io.Serializable, Comparable { MANDAIC, // 0840..085B UNKNOWN, // 085C..085D MANDAIC, // 085E - UNKNOWN, // 085F..089F + UNKNOWN, // 085F + SYRIAC, // 0860..086A + UNKNOWN, // 086B..089F ARABIC, // 08A0..08B4 - UNKNOWN, // 08B5..08E2 + UNKNOWN, // 08B5 + ARABIC, // 08B6..08BD + UNKNOWN, // 08BE..08D3 + ARABIC, // 08D4..08E1 + COMMON, // 08E2 ARABIC, // 08E3..08FF DEVANAGARI, // 0900..0950 INHERITED, // 0951..0952 @@ -5938,8 +6292,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 09DE BENGALI, // 09DF..09E3 UNKNOWN, // 09E4..09E5 - BENGALI, // 09E6..09FB - UNKNOWN, // 09FC..0A00 + BENGALI, // 09E6..09FD + UNKNOWN, // 09FE..0A00 GURMUKHI, // 0A01..0A03 UNKNOWN, // 0A04 GURMUKHI, // 0A05..0A0A @@ -5998,8 +6352,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 0AE4..0AE5 GUJARATI, // 0AE6..0AF1 UNKNOWN, // 0AF2..0AF8 - GUJARATI, // 0AF9 - UNKNOWN, // 0AFA..0B00 + GUJARATI, // 0AF9..0AFF + UNKNOWN, // 0B00 ORIYA, // 0B01..0B03 UNKNOWN, // 0B04 ORIYA, // 0B05..0B0C @@ -6085,8 +6439,7 @@ class Character implements java.io.Serializable, Comparable { TELUGU, // 0C66..0C6F UNKNOWN, // 0C70..0C77 TELUGU, // 0C78..0C7F - UNKNOWN, // 0C80 - KANNADA, // 0C81..0C83 + KANNADA, // 0C80..0C83 UNKNOWN, // 0C84 KANNADA, // 0C85..0C8C UNKNOWN, // 0C8D @@ -6113,28 +6466,22 @@ class Character implements java.io.Serializable, Comparable { KANNADA, // 0CE6..0CEF UNKNOWN, // 0CF0 KANNADA, // 0CF1..0CF2 - UNKNOWN, // 0CF3..0D00 - MALAYALAM, // 0D01..0D03 + UNKNOWN, // 0CF3..0CFF + MALAYALAM, // 0D00..0D03 UNKNOWN, // 0D04 MALAYALAM, // 0D05..0D0C UNKNOWN, // 0D0D MALAYALAM, // 0D0E..0D10 UNKNOWN, // 0D11 - MALAYALAM, // 0D12..0D3A - UNKNOWN, // 0D3B..0D3C - MALAYALAM, // 0D3D..0D44 + MALAYALAM, // 0D12..0D44 UNKNOWN, // 0D45 MALAYALAM, // 0D46..0D48 UNKNOWN, // 0D49 - MALAYALAM, // 0D4A..0D4E - UNKNOWN, // 0D4F..0D56 - MALAYALAM, // 0D57 - UNKNOWN, // 0D58..0D5E - MALAYALAM, // 0D5F..0D63 + MALAYALAM, // 0D4A..0D4F + UNKNOWN, // 0D50..0D53 + MALAYALAM, // 0D54..0D63 UNKNOWN, // 0D64..0D65 - MALAYALAM, // 0D66..0D75 - UNKNOWN, // 0D76..0D78 - MALAYALAM, // 0D79..0D7F + MALAYALAM, // 0D66..0D7F UNKNOWN, // 0D80..0D81 SINHALA, // 0D82..0D83 UNKNOWN, // 0D84 @@ -6358,7 +6705,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 1C4A..1C4C LEPCHA, // 1C4D..1C4F OL_CHIKI, // 1C50..1C7F - UNKNOWN, // 1C80..1CBF + CYRILLIC, // 1C80..1C88 + UNKNOWN, // 1C89..1CBF SUNDANESE, // 1CC0..1CC7 UNKNOWN, // 1CC8..1CCF INHERITED, // 1CD0..1CD2 @@ -6370,8 +6718,7 @@ class Character implements java.io.Serializable, Comparable { INHERITED, // 1CED COMMON, // 1CEE..1CF3 INHERITED, // 1CF4 - COMMON, // 1CF5..1CF6 - UNKNOWN, // 1CF7 + COMMON, // 1CF5..1CF7 INHERITED, // 1CF8..1CF9 UNKNOWN, // 1CFA..1CFF LATIN, // 1D00..1D25 @@ -6385,9 +6732,9 @@ class Character implements java.io.Serializable, Comparable { CYRILLIC, // 1D78 LATIN, // 1D79..1DBE GREEK, // 1DBF - INHERITED, // 1DC0..1DF5 - UNKNOWN, // 1DF6..1DFB - INHERITED, // 1DFC..1DFF + INHERITED, // 1DC0..1DF9 + UNKNOWN, // 1DFA + INHERITED, // 1DFB..1DFF LATIN, // 1E00..1EFF GREEK, // 1F00..1F15 UNKNOWN, // 1F16..1F17 @@ -6434,8 +6781,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 208F LATIN, // 2090..209C UNKNOWN, // 209D..209F - COMMON, // 20A0..20BE - UNKNOWN, // 20BF..20CF + COMMON, // 20A0..20BF + UNKNOWN, // 20C0..20CF INHERITED, // 20D0..20F0 UNKNOWN, // 20F1..20FF COMMON, // 2100..2125 @@ -6450,9 +6797,7 @@ class Character implements java.io.Serializable, Comparable { LATIN, // 2160..2188 COMMON, // 2189..218B UNKNOWN, // 218C..218F - COMMON, // 2190..23FA - UNKNOWN, // 23FB..23FF - COMMON, // 2400..2426 + COMMON, // 2190..2426 UNKNOWN, // 2427..243F COMMON, // 2440..244A UNKNOWN, // 244B..245F @@ -6466,8 +6811,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 2BBA..2BBC COMMON, // 2BBD..2BC8 UNKNOWN, // 2BC9 - COMMON, // 2BCA..2BD1 - UNKNOWN, // 2BD2..2BEB + COMMON, // 2BCA..2BD2 + UNKNOWN, // 2BD3..2BEB COMMON, // 2BEC..2BEF UNKNOWN, // 2BF0..2BFF GLAGOLITIC, // 2C00..2C2E @@ -6508,8 +6853,8 @@ class Character implements java.io.Serializable, Comparable { ETHIOPIC, // 2DD8..2DDE UNKNOWN, // 2DDF CYRILLIC, // 2DE0..2DFF - COMMON, // 2E00..2E42 - UNKNOWN, // 2E43..2E7F + COMMON, // 2E00..2E49 + UNKNOWN, // 2E50..2E7F HAN, // 2E80..2E99 UNKNOWN, // 2E9A HAN, // 2E9B..2EF3 @@ -6540,8 +6885,8 @@ class Character implements java.io.Serializable, Comparable { COMMON, // 30FB..30FC KATAKANA, // 30FD..30FF UNKNOWN, // 3100..3104 - BOPOMOFO, // 3105..312D - UNKNOWN, // 312E..3130 + BOPOMOFO, // 3105..312E + UNKNOWN, // 312F..3130 HANGUL, // 3131..318E UNKNOWN, // 318F COMMON, // 3190..319F @@ -6562,8 +6907,8 @@ class Character implements java.io.Serializable, Comparable { HAN, // 3400..4DB5 UNKNOWN, // 4DB6..4DBF COMMON, // 4DC0..4DFF - HAN, // 4E00..9FD5 - UNKNOWN, // 9FD6..9FFF + HAN, // 4E00..9FEA + UNKNOWN, // 9FEB..9FFF YI, // A000..A48C UNKNOWN, // A48D..A48F YI, // A490..A4C6 @@ -6577,8 +6922,8 @@ class Character implements java.io.Serializable, Comparable { COMMON, // A700..A721 LATIN, // A722..A787 COMMON, // A788..A78A - LATIN, // A78B..A7AD - UNKNOWN, // A7AE..A7AF + LATIN, // A78B..A7AE + UNKNOWN, // A7AF LATIN, // A7B0..A7B7 UNKNOWN, // A7B8..A7F6 LATIN, // A7F7..A7FF @@ -6588,8 +6933,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // A83A..A83F PHAGS_PA, // A840..A877 UNKNOWN, // A878..A87F - SAURASHTRA, // A880..A8C4 - UNKNOWN, // A8C5..A8CD + SAURASHTRA, // A880..A8C5 + UNKNOWN, // A8C6..A8CD SAURASHTRA, // A8CE..A8D9 UNKNOWN, // A8DA..A8DF DEVANAGARI, // A8E0..A8FD @@ -6740,8 +7085,8 @@ class Character implements java.io.Serializable, Comparable { COMMON, // 10107..10133 UNKNOWN, // 10134..10136 COMMON, // 10137..1013F - GREEK, // 10140..1018C - UNKNOWN, // 1018D..1018F + GREEK, // 10140..1018E + UNKNOWN, // 1018F COMMON, // 10190..1019B UNKNOWN, // 1019C..1019F GREEK, // 101A0 @@ -6757,7 +7102,8 @@ class Character implements java.io.Serializable, Comparable { COMMON, // 102E1..102FB UNKNOWN, // 102FC..102FF OLD_ITALIC, // 10300..10323 - UNKNOWN, // 10324..1032F + UNKNOWN, // 10324..1032C + OLD_ITALIC, // 1032D..1032F GOTHIC, // 10330..1034A UNKNOWN, // 1034B..1034F OLD_PERMIC, // 10350..1037A @@ -6774,7 +7120,11 @@ class Character implements java.io.Serializable, Comparable { OSMANYA, // 10480..1049D UNKNOWN, // 1049E..1049F OSMANYA, // 104A0..104A9 - UNKNOWN, // 104AA..104FF + UNKNOWN, // 104AA..104AF + OSAGE, // 104B0..104D3; + UNKNOWN, // 104D4..104D7; + OSAGE, // 104D8..104FB; + UNKNOWN, // 104FC..104FF; ELBASAN, // 10500..10527 UNKNOWN, // 10528..1052F CAUCASIAN_ALBANIAN, // 10530..10563 @@ -6897,8 +7247,8 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 111F5..111FF KHOJKI, // 11200..11211 UNKNOWN, // 11212 - KHOJKI, // 11213..1123D - UNKNOWN, // 1123E..1127F + KHOJKI, // 11213..1123E + UNKNOWN, // 1123F..1127F MULTANI, // 11280..11286 UNKNOWN, // 11287 MULTANI, // 11288 @@ -6942,7 +7292,13 @@ class Character implements java.io.Serializable, Comparable { GRANTHA, // 11366..1136C UNKNOWN, // 1136D..1136F GRANTHA, // 11370..11374 - UNKNOWN, // 11375..1147F + UNKNOWN, // 11375..113FF + NEWA, // 11400..11459 + UNKNOWN, // 1145A + NEWA, // 1145B + UNKNOWN, // 1145C + NEWA, // 1145D + UNKNOWN, // 1145E..1147F TIRHUTA, // 11480..114C7 UNKNOWN, // 114C8..114CF TIRHUTA, // 114D0..114D9 @@ -6954,7 +7310,9 @@ class Character implements java.io.Serializable, Comparable { MODI, // 11600..11644 UNKNOWN, // 11645..1164F MODI, // 11650..11659 - UNKNOWN, // 1165A..1167F + UNKNOWN, // 1165A..1165F + MONGOLIAN, // 11660..1166C + UNKNOWN, // 1166D..1167F TAKRI, // 11680..116B7 UNKNOWN, // 116B8..116BF TAKRI, // 116C0..116C9 @@ -6968,9 +7326,45 @@ class Character implements java.io.Serializable, Comparable { WARANG_CITI, // 118A0..118F2 UNKNOWN, // 118F3..118FE WARANG_CITI, // 118FF - UNKNOWN, // 11900..11ABF + UNKNOWN, // 11900..119FF + ZANABAZAR_SQUARE, // 11A00..11A47 + UNKNOWN, // 11A48..11A4F + SOYOMBO, // 11A50..11A83 + UNKNOWN, // 11A84..11A85 + SOYOMBO, // 11A86..11A9C + UNKNOWN, // 11A9D + SOYOMBO, // 11A9E..11AA2 + UNKNOWN, // 11AA3..11ABF PAU_CIN_HAU, // 11AC0..11AF8 - UNKNOWN, // 11AF9..11FFF + UNKNOWN, // 11AF9..11BFF + BHAIKSUKI, // 11C00..11C08 + UNKNOWN, // 11C09 + BHAIKSUKI, // 11C0A..11C36 + UNKNOWN, // 11C37 + BHAIKSUKI, // 11C38..11C45 + UNKNOWN, // 11C46..11C49 + BHAIKSUKI, // 11C50..11C6C + UNKNOWN, // 11C6D..11C6F + MARCHEN, // 11C70..11C8F + UNKNOWN, // 11C90..11C91 + MARCHEN, // 11C92..11CA7 + UNKNOWN, // 11CA8 + MARCHEN, // 11CA9..11CB6 + UNKNOWN, // 11CB7..11CFF + MASARAM_GONDI, // 11D00..11D06 + UNKNOWN, // 11D07 + MASARAM_GONDI, // 11D08..11D09 + UNKNOWN, // 11D0A + MASARAM_GONDI, // 11D0B..11D36 + UNKNOWN, // 11D37..11D39 + MASARAM_GONDI, // 11D3A + UNKNOWN, // 11D3B + MASARAM_GONDI, // 11D3C..11D3D + UNKNOWN, // 11D3E + MASARAM_GONDI, // 11D3F..11D47 + UNKNOWN, // 11D48..11D49 + MASARAM_GONDI, // 11D50..11D59 + UNKNOWN, // 11D5A..1AFFF; CUNEIFORM, // 12000..12399 UNKNOWN, // 1239A..123FF CUNEIFORM, // 12400..1246E @@ -7010,10 +7404,19 @@ class Character implements java.io.Serializable, Comparable { MIAO, // 16F50..16F7E UNKNOWN, // 16F7F..16F8E MIAO, // 16F8F..16F9F - UNKNOWN, // 16FA0..1AFFF + UNKNOWN, // 16FA0..16FDF + TANGUT, // 16FE0 + NUSHU, // 16FE1 + UNKNOWN, // 16FE2..16FFF + TANGUT, // 17000..187EC + UNKNOWN, // 187ED..187FF + TANGUT, // 18800..18AF2 + UNKNOWN, // 18AF3..1AFFF KATAKANA, // 1B000 - HIRAGANA, // 1B001 - UNKNOWN, // 1B002..1BBFF + HIRAGANA, // 1B001..1B11E + UNKNOWN, // 1B11F..1B16F + NUSHU, // 1B170..1B2FB + UNKNOWN, // 1B2FC..1BBFF DUPLOYAN, // 1BC00..1BC6A UNKNOWN, // 1BC6B..1BC6F DUPLOYAN, // 1BC70..1BC7C @@ -7091,11 +7494,27 @@ class Character implements java.io.Serializable, Comparable { SIGNWRITING, // 1DA9B..1DA9F UNKNOWN, // 1DAA0 SIGNWRITING, // 1DAA1..1DAAF - UNKNOWN, // 1DAB0..1E7FF + UNKNOWN, // 1DAB0..1DFFF + GLAGOLITIC, // 1E000..1E006 + UNKNOWN, // 1E007 + GLAGOLITIC, // 1E008..1E018 + UNKNOWN, // 1E019..1E01A + GLAGOLITIC, // 1E01B..1E021 + UNKNOWN, // 1E022 + GLAGOLITIC, // 1E023..1E024 + UNKNOWN, // 1E025 + GLAGOLITIC, // 1E026..1E02A + UNKNOWN, // 1E02B..1E7FF MENDE_KIKAKUI, // 1E800..1E8C4 UNKNOWN, // 1E8C5..1E8C6 MENDE_KIKAKUI, // 1E8C7..1E8D6 - UNKNOWN, // 1E8D7..1EDFF + UNKNOWN, // 1E8D7..1E8FF + ADLAM, // 1E900..1E94A + UNKNOWN, // 1E94B..1E94F + ADLAM, // 1E950..1E959 + UNKNOWN, // 1E95A..1E95D + ADLAM, // 1E95E..1E95F + UNKNOWN, // 1E960..1EDFF ARABIC, // 1EE00..1EE03 UNKNOWN, // 1EE04 ARABIC, // 1EE05..1EE1F @@ -7182,28 +7601,26 @@ class Character implements java.io.Serializable, Comparable { UNKNOWN, // 1F12F COMMON, // 1F130..1F16B UNKNOWN, // 1F16C..1F16F - COMMON, // 1F170..1F19A - UNKNOWN, // 1F19B..1F1E5 + COMMON, // 1F170..1F1AC + UNKNOWN, // 1F1AD..1F1E5 COMMON, // 1F1E6..1F1FF HIRAGANA, // 1F200 COMMON, // 1F201..1F202 UNKNOWN, // 1F203..1F20F - COMMON, // 1F210..1F23A - UNKNOWN, // 1F23B..1F23F + COMMON, // 1F210..1F23B + UNKNOWN, // 1F23C..1F23F COMMON, // 1F240..1F248 UNKNOWN, // 1F249..1F24F COMMON, // 1F250..1F251 - UNKNOWN, // 1F252..1F2FF - COMMON, // 1F300..1F579 - UNKNOWN, // 1F57A - COMMON, // 1F57B..1F5A3 - UNKNOWN, // 1F5A4 - COMMON, // 1F5A5..1F6D0 - UNKNOWN, // 1F6D1..1F6DF + UNKNOWN, // 1F252..1F25F + COMMON, // 1F260..1F265 + UNKNOWN, // 1F266..1F2FF + COMMON, // 1F300..1F6D4 + UNKNOWN, // 1F6D5..1F6DF COMMON, // 1F6E0..1F6EC UNKNOWN, // 1F6ED..1F6EF - COMMON, // 1F6F0..1F6F3 - UNKNOWN, // 1F6F4..1F6FF + COMMON, // 1F6F0..1F6F8 + UNKNOWN, // 1F6F9..1F6FF COMMON, // 1F700..1F773 UNKNOWN, // 1F774..1F77F COMMON, // 1F780..1F7D4 @@ -7217,13 +7634,21 @@ class Character implements java.io.Serializable, Comparable { COMMON, // 1F860..1F887 UNKNOWN, // 1F888..1F88F COMMON, // 1F890..1F8AD - UNKNOWN, // 1F8AE..1F90F - COMMON, // 1F910..1F918 - UNKNOWN, // 1F919..1F97F - COMMON, // 1F980..1F984 - UNKNOWN, // 1F985..1F9BF + UNKNOWN, // 1F8AE..1F8FF + COMMON, // 1F900..1F90B + UNKNOWN, // 1F90C..1F90F + COMMON, // 1F910..1F93E + UNKNOWN, // 1F93F + COMMON, // 1F940..1F94C + UNKNOWN, // 1F94D..1F94F + COMMON, // 1F950..1F96B + UNKNOWN, // 1F96C..1F97F + COMMON, // 1F980..1F997 + UNKNOWN, // 1F998..1F9BF COMMON, // 1F9C0 - UNKNOWN, // 1F9C1..1FFFF + UNKNOWN, // 1F9C1..1F9CF + COMMON, // 1F9D0..1F9E6 + UNKNOWN, // 1F9E7..1FFFF HAN, // 20000..2A6D6 UNKNOWN, // 2A6D7..2A6FF HAN, // 2A700..2B734 @@ -7231,7 +7656,9 @@ class Character implements java.io.Serializable, Comparable { HAN, // 2B740..2B81D UNKNOWN, // 2B81E..2B81F HAN, // 2B820..2CEA1 - UNKNOWN, // 2CEA2..2F7FF + UNKNOWN, // 2CEA2..2CEAF + HAN, // 2CEB0..2EBE0 + UNKNOWN, // 2EBE1..2F7FF HAN, // 2F800..2FA1D UNKNOWN, // 2FA1E..E0000 COMMON, // E0001 @@ -7244,7 +7671,8 @@ class Character implements java.io.Serializable, Comparable { private static HashMap aliases; static { - aliases = new HashMap<>(134); + aliases = new HashMap<>((int)(142 / 0.75f + 1.0f)); + aliases.put("ADLM", ADLAM); aliases.put("AGHB", CAUCASIAN_ALBANIAN); aliases.put("AHOM", AHOM); aliases.put("ARAB", ARABIC); @@ -7256,6 +7684,7 @@ class Character implements java.io.Serializable, Comparable { aliases.put("BASS", BASSA_VAH); aliases.put("BATK", BATAK); aliases.put("BENG", BENGALI); + aliases.put("BHKS", BHAIKSUKI); aliases.put("BOPO", BOPOMOFO); aliases.put("BRAH", BRAHMI); aliases.put("BRAI", BRAILLE); @@ -7277,6 +7706,7 @@ class Character implements java.io.Serializable, Comparable { aliases.put("ETHI", ETHIOPIC); aliases.put("GEOR", GEORGIAN); aliases.put("GLAG", GLAGOLITIC); + aliases.put("GONM", MASARAM_GONDI); aliases.put("GOTH", GOTHIC); aliases.put("GRAN", GRANTHA); aliases.put("GREK", GREEK); @@ -7313,6 +7743,7 @@ class Character implements java.io.Serializable, Comparable { aliases.put("LYCI", LYCIAN); aliases.put("LYDI", LYDIAN); aliases.put("MAHJ", MAHAJANI); + aliases.put("MARC", MARCHEN); aliases.put("MAND", MANDAIC); aliases.put("MANI", MANICHAEAN); aliases.put("MEND", MENDE_KIKAKUI); @@ -7327,11 +7758,14 @@ class Character implements java.io.Serializable, Comparable { aliases.put("MYMR", MYANMAR); aliases.put("NARB", OLD_NORTH_ARABIAN); aliases.put("NBAT", NABATAEAN); + aliases.put("NEWA", NEWA); aliases.put("NKOO", NKO); + aliases.put("NSHU", NUSHU); aliases.put("OGAM", OGHAM); aliases.put("OLCK", OL_CHIKI); aliases.put("ORKH", OLD_TURKIC); aliases.put("ORYA", ORIYA); + aliases.put("OSGE", OSAGE); aliases.put("OSMA", OSMANYA); aliases.put("PALM", PALMYRENE); aliases.put("PAUC", PAU_CIN_HAU); @@ -7354,6 +7788,7 @@ class Character implements java.io.Serializable, Comparable { aliases.put("SIND", KHUDAWADI); aliases.put("SINH", SINHALA); aliases.put("SORA", SORA_SOMPENG); + aliases.put("SOYO", SOYOMBO); aliases.put("SUND", SUNDANESE); aliases.put("SYLO", SYLOTI_NAGRI); aliases.put("SYRC", SYRIAC); @@ -7362,6 +7797,7 @@ class Character implements java.io.Serializable, Comparable { aliases.put("TALE", TAI_LE); aliases.put("TALU", NEW_TAI_LUE); aliases.put("TAML", TAMIL); + aliases.put("TANG", TANGUT); aliases.put("TAVT", TAI_VIET); aliases.put("TELU", TELUGU); aliases.put("TFNG", TIFINAGH); @@ -7376,6 +7812,7 @@ class Character implements java.io.Serializable, Comparable { aliases.put("XPEO", OLD_PERSIAN); aliases.put("XSUX", CUNEIFORM); aliases.put("YIII", YI); + aliases.put("ZANB", ZANABAZAR_SQUARE); aliases.put("ZINH", INHERITED); aliases.put("ZYYY", COMMON); aliases.put("ZZZZ", UNKNOWN); diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java index 81f057b9a87..add9c6ad2a4 100644 --- a/src/java.base/share/classes/java/lang/String.java +++ b/src/java.base/share/classes/java/lang/String.java @@ -2599,35 +2599,36 @@ public final class String } /** - * Returns a string whose value is this string, with any leading and trailing - * whitespace removed. + * Returns a string whose value is this string, with all leading + * and trailing space removed, where space is defined + * as any character whose codepoint is less than or equal to + * {@code '\u005Cu0020'} (the space character). *

* If this {@code String} object represents an empty character * sequence, or the first and last characters of character sequence * represented by this {@code String} object both have codes - * greater than {@code '\u005Cu0020'} (the space character), then a + * that are not space (as defined above), then a * reference to this {@code String} object is returned. *

- * Otherwise, if there is no character with a code greater than - * {@code '\u005Cu0020'} in the string, then a - * {@code String} object representing an empty string is - * returned. + * Otherwise, if all characters in this string are space (as + * defined above), then a {@code String} object representing an + * empty string is returned. *

* Otherwise, let k be the index of the first character in the - * string whose code is greater than {@code '\u005Cu0020'}, and let + * string whose code is not a space (as defined above) and let * m be the index of the last character in the string whose code - * is greater than {@code '\u005Cu0020'}. A {@code String} + * is not a space (as defined above). A {@code String} * object is returned, representing the substring of this string that * begins with the character at index k and ends with the * character at index m-that is, the result of * {@code this.substring(k, m + 1)}. *

- * This method may be used to trim whitespace (as defined above) from + * This method may be used to trim space (as defined above) from * the beginning and end of a string. * - * @return A string whose value is this string, with any leading and trailing white - * space removed, or this string if it has no leading or - * trailing white space. + * @return a string whose value is this string, with all leading + * and trailing space removed, or this string if it + * has no leading or trailing space. */ public String trim() { String ret = isLatin1() ? StringLatin1.trim(value) diff --git a/src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java b/src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java index c20d691e6aa..9ee60001ae7 100644 --- a/src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java +++ b/src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java @@ -68,7 +68,7 @@ abstract class ClassSpecializer.SpeciesDat private final List transformMethods; private final MethodType baseConstructorType; private final S topSpecies; - private final ConcurrentHashMap cache = new ConcurrentHashMap<>(); + private final ConcurrentHashMap cache = new ConcurrentHashMap<>(); private final Factory factory; private @Stable boolean topClassIsSuper; @@ -151,14 +151,20 @@ abstract class ClassSpecializer.SpeciesDat return new IllegalArgumentException(message, cause); } + private static final Function CREATE_RESERVATION = new Function<>() { + @Override + public Object apply(Object key) { + return new Object(); + } + }; + public final S findSpecies(K key) { // Note: Species instantiation may throw VirtualMachineError because of // code cache overflow. If this happens the species bytecode may be // loaded but not linked to its species metadata (with MH's etc). - // That will cause a throw out of CHM.computeIfAbsent, - // which will shut down the caller thread. + // That will cause a throw out of Factory.loadSpecies. // - // In a latter attempt to get the same species, the already-loaded + // In a later attempt to get the same species, the already-loaded // class will be present in the system dictionary, causing an // error when the species generator tries to reload it. // We try to detect this case and link the pre-existing code. @@ -168,25 +174,20 @@ abstract class ClassSpecializer.SpeciesDat // (As an alternative, we might spin a new class with a new name, // or use the anonymous class mechanism.) // - // In the end, as long as everybody goes through the same CHM, - // CHM.computeIfAbsent will ensure only one SpeciesData will be set - // successfully on a concrete class if ever. + // In the end, as long as everybody goes through this findSpecies method, + // it will ensure only one SpeciesData will be set successfully on a + // concrete class if ever. // The concrete class is published via SpeciesData instance // returned here only after the class and species data are linked together. - S speciesData = cache.computeIfAbsent(key, new Function<>() { - @Override - public S apply(K key1) { - return newSpeciesData(key1); - } - }); + Object speciesDataOrReservation = cache.computeIfAbsent(key, CREATE_RESERVATION); // Separating the creation of a placeholder SpeciesData instance above // from the loading and linking a real one below ensures we can never - // accidentally call computeIfAbsent recursively. Replacing rather than - // updating the placeholder is done to ensure safe publication. - if (!speciesData.isResolved()) { - synchronized (speciesData) { - S existingSpeciesData = cache.get(key); - if (existingSpeciesData == speciesData) { // won the race + // accidentally call computeIfAbsent recursively. + S speciesData; + if (speciesDataOrReservation.getClass() == Object.class) { + synchronized (speciesDataOrReservation) { + Object existingSpeciesData = cache.get(key); + if (existingSpeciesData == speciesDataOrReservation) { // won the race // create a new SpeciesData... speciesData = newSpeciesData(key); // load and link it... @@ -195,9 +196,11 @@ abstract class ClassSpecializer.SpeciesDat throw newInternalError("Concurrent loadSpecies"); } } else { // lost the race; the retrieved existingSpeciesData is the final - speciesData = existingSpeciesData; + speciesData = metaType.cast(existingSpeciesData); } } + } else { + speciesData = metaType.cast(speciesDataOrReservation); } assert(speciesData != null && speciesData.isResolved()); return speciesData; diff --git a/src/java.base/share/classes/java/security/interfaces/XECKey.java b/src/java.base/share/classes/java/security/interfaces/XECKey.java new file mode 100644 index 00000000000..7412daabd07 --- /dev/null +++ b/src/java.base/share/classes/java/security/interfaces/XECKey.java @@ -0,0 +1,47 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.security.interfaces; + +import java.security.spec.AlgorithmParameterSpec; + +/** + * An interface for an elliptic curve public/private key as defined by + * RFC 7748. These keys are distinct from the keys represented by + * {@code ECKey}, and they are intended for use with algorithms based on RFC + * 7748 such as the XDH {@code KeyAgreement} algorithm. This interface allows + * access to the algorithm parameters associated with the key. + * + * @since 11 + */ +public interface XECKey { + /** + * Returns the algorithm parameters associated + * with the key. + * + * @return the associated algorithm parameters + */ + AlgorithmParameterSpec getParams(); +} + diff --git a/src/java.base/share/classes/java/security/interfaces/XECPrivateKey.java b/src/java.base/share/classes/java/security/interfaces/XECPrivateKey.java new file mode 100644 index 00000000000..547677786ae --- /dev/null +++ b/src/java.base/share/classes/java/security/interfaces/XECPrivateKey.java @@ -0,0 +1,57 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.security.interfaces; + +import java.security.PrivateKey; +import java.util.Optional; + +/** + * An interface for an elliptic curve private key as defined by RFC 7748. + * These keys are distinct from the keys represented by {@code ECPrivateKey}, + * and they are intended for use with algorithms based on RFC 7748 such as the + * XDH {@code KeyAgreement} algorithm. + * + * An XEC private key is an encoded scalar value as described in RFC 7748. + * The decoding procedure defined in this RFC includes an operation that forces + * certain bits of the key to either 1 or 0. This operation is known as + * "pruning" or "clamping" the private key. Arrays returned by this interface + * are unpruned, and implementations will need to prune the array before + * using it in any numerical operations. + * + * @since 11 + */ +public interface XECPrivateKey extends XECKey, PrivateKey { + + /** + * Get the scalar value encoded as an unpruned byte array. A new copy of + * the array is returned each time this method is called. + * + * @return the unpruned encoded scalar value, or an empty Optional if the + * scalar cannot be extracted (e.g. if the provider is a hardware token + * and the private key is not allowed to leave the crypto boundary). + */ + Optional getScalar(); +} + diff --git a/src/java.base/share/classes/java/security/interfaces/XECPublicKey.java b/src/java.base/share/classes/java/security/interfaces/XECPublicKey.java new file mode 100644 index 00000000000..6ec200beeb9 --- /dev/null +++ b/src/java.base/share/classes/java/security/interfaces/XECPublicKey.java @@ -0,0 +1,56 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.security.interfaces; + +import java.math.BigInteger; +import java.security.PublicKey; + +/** + * An interface for an elliptic curve public key as defined by RFC 7748. + * These keys are distinct from the keys represented by {@code ECPublicKey}, + * and they are intended for use with algorithms based on RFC 7748 such as the + * XDH {@code KeyAgreement} algorithm. + * + * An XEC public key is a particular point on the curve, which is represented + * using only its u-coordinate as described in RFC 7748. A u-coordinate is an + * element of the field of integers modulo some value that is determined by + * the algorithm parameters. This field element is represented by a BigInteger + * which may hold any value. That is, the BigInteger is not restricted to the + * range of canonical field elements. + * + * @since 11 + */ +public interface XECPublicKey extends XECKey, PublicKey { + + /** + * Get the u coordinate of the point. + * + * @return the u-coordinate, represented using a BigInteger which may hold + * any value + */ + BigInteger getU(); + +} + diff --git a/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java b/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java index 4f3f63b873a..2186a816fbf 100644 --- a/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java +++ b/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -34,9 +34,7 @@ package java.security.spec; * * @since 1.5 */ -public class ECGenParameterSpec implements AlgorithmParameterSpec { - - private String name; +public class ECGenParameterSpec extends NamedParameterSpec { /** * Creates a parameter specification for EC parameter @@ -44,25 +42,15 @@ public class ECGenParameterSpec implements AlgorithmParameterSpec { * {@code stdName} in order to generate the corresponding * (precomputed) elliptic curve domain parameters. For the * list of supported names, please consult the documentation - * of provider whose implementation will be used. + * of the provider whose implementation will be used. + * * @param stdName the standard name of the to-be-generated EC - * domain parameters. - * @exception NullPointerException if {@code stdName} - * is null. + * domain parameters. + * @throws NullPointerException if {@code stdName} + * is null. */ public ECGenParameterSpec(String stdName) { - if (stdName == null) { - throw new NullPointerException("stdName is null"); - } - this.name = stdName; - } - - /** - * Returns the standard or predefined name of the - * to-be-generated EC domain parameters. - * @return the standard or predefined name. - */ - public String getName() { - return name; + super(stdName); } } + diff --git a/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java b/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java new file mode 100644 index 00000000000..4e61065eb35 --- /dev/null +++ b/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java @@ -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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.security.spec; + +import java.util.Objects; + +/** + * This class is used to specify any algorithm parameters that are determined + * by a standard name. This class also holds constants for standard parameter + * set names. The names of these constants exactly match the corresponding + * parameter set name. For example, NamedParameterSpec.X25519 represents the + * parameter set identified by the string "X25519". These strings are defined + * in the + * Java Security Standard Algorithm Names Specification. + * + * @since 11 + * + */ +public class NamedParameterSpec implements AlgorithmParameterSpec { + + /** + * The X25519 parameters + */ + public static final NamedParameterSpec X25519 + = new NamedParameterSpec("X25519"); + /** + * The X448 parameters + */ + public static final NamedParameterSpec X448 + = new NamedParameterSpec("X448"); + + private String name; + + /** + * Creates a parameter specification using a standard (or predefined) + * name {@code stdName}. For the + * list of supported names, please consult the documentation + * of the provider whose implementation will be used. + * + * @param stdName the standard name of the algorithm parameters + * + * @throws NullPointerException if {@code stdName} + * is null. + */ + public NamedParameterSpec(String stdName) { + Objects.requireNonNull(stdName, "stdName must not be null"); + + this.name = stdName; + } + + /** + * Returns the standard name that determines the algorithm parameters. + * @return the standard name. + */ + public String getName() { + return name; + } +} diff --git a/src/java.base/share/classes/java/security/spec/XECPrivateKeySpec.java b/src/java.base/share/classes/java/security/spec/XECPrivateKeySpec.java new file mode 100644 index 00000000000..02687b50a0e --- /dev/null +++ b/src/java.base/share/classes/java/security/spec/XECPrivateKeySpec.java @@ -0,0 +1,82 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.security.spec; + +import java.util.Objects; + +/** + * A class representing elliptic curve private keys as defined in RFC 7748, + * including the curve and other algorithm parameters. The private key is + * represented as an encoded scalar value. The decoding procedure defined in + * the RFC includes an operation that forces certain bits of the key to either + * 1 or 0. This operation is known as "pruning" or "clamping" the private key. + * All arrays in this spec are unpruned, and implementations will need to prune + * the array before using it in any numerical operations. + * + * @since 11 + */ +public class XECPrivateKeySpec implements KeySpec { + + private final AlgorithmParameterSpec params; + private final byte[] scalar; + + /** + * Construct a private key spec using the supplied parameters and + * encoded scalar value. + * + * @param params the algorithm parameters + * @param scalar the unpruned encoded scalar value. This array is copied + * to protect against subsequent modification. + * + * @throws NullPointerException if {@code params} or {@code scalar} + * is null. + */ + public XECPrivateKeySpec(AlgorithmParameterSpec params, byte[] scalar) { + Objects.requireNonNull(params, "params must not be null"); + Objects.requireNonNull(scalar, "scalar must not be null"); + + this.params = params; + this.scalar = scalar.clone(); + } + + /** + * Get the algorithm parameters that define the curve and other settings. + * + * @return the algorithm parameters + */ + public AlgorithmParameterSpec getParams() { + return params; + } + + /** + * Get the scalar value encoded as an unpruned byte array. A new copy of + * the array is returned each time this method is called. + * + * @return the unpruned encoded scalar value + */ + public byte[] getScalar() { + return scalar.clone(); + } +} diff --git a/src/java.base/share/classes/java/security/spec/XECPublicKeySpec.java b/src/java.base/share/classes/java/security/spec/XECPublicKeySpec.java new file mode 100644 index 00000000000..162cf10e9eb --- /dev/null +++ b/src/java.base/share/classes/java/security/spec/XECPublicKeySpec.java @@ -0,0 +1,83 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.security.spec; + +import java.math.BigInteger; +import java.util.Objects; + +/** + * A class representing elliptic curve public keys as defined in RFC 7748, + * including the curve and other algorithm parameters. The public key is a + * particular point on the curve, which is represented using only its + * u-coordinate. A u-coordinate is an element of the field of integers modulo + * some value that is determined by the algorithm parameters. This field + * element is represented by a BigInteger which may hold any value. That is, + * the BigInteger is not restricted to the range of canonical field elements. + * + * @since 11 + */ +public class XECPublicKeySpec implements KeySpec { + + private final AlgorithmParameterSpec params; + private final BigInteger u; + + /** + * Construct a public key spec using the supplied parameters and + * u coordinate. + * + * @param params the algorithm parameters + * @param u the u-coordinate of the point, represented using a BigInteger + * which may hold any value + * + * @throws NullPointerException if {@code params} or {@code u} + * is null. + */ + public XECPublicKeySpec(AlgorithmParameterSpec params, BigInteger u) { + Objects.requireNonNull(params, "params must not be null"); + Objects.requireNonNull(u, "u must not be null"); + + this.params = params; + this.u = u; + } + + /** + * Get the algorithm parameters that define the curve and other settings. + * + * @return the parameters + */ + public AlgorithmParameterSpec getParams() { + return params; + } + + /** + * Get the u coordinate of the point. + * + * @return the u-coordinate, represented using a BigInteger which may hold + * any value + */ + public BigInteger getU() { + return u; + } +} diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index c4e20f357e0..ec7fdf0f06a 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -42,6 +42,7 @@ import java.security.CodeSigner; import java.security.CodeSource; import java.security.cert.Certificate; import java.util.ArrayList; +import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.Locale; @@ -1095,16 +1096,7 @@ class JarFile extends ZipFile { if (includeUnsigned) { return unsignedEntryNames(); } else { - return new Enumeration<>() { - - public boolean hasMoreElements() { - return false; - } - - public String nextElement() { - throw new NoSuchElementException(); - } - }; + return Collections.emptyEnumeration(); } } diff --git a/src/java.base/share/classes/java/util/jar/JarVerifier.java b/src/java.base/share/classes/java/util/jar/JarVerifier.java index 49b21e215d4..205d6e93872 100644 --- a/src/java.base/share/classes/java/util/jar/JarVerifier.java +++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java @@ -684,7 +684,7 @@ class JarVerifier { } final List signersReq = req; - final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration; + final Enumeration enum2 = matchUnsigned ? unsignedEntryNames(jar) : Collections.emptyEnumeration(); return new Enumeration<>() { @@ -769,16 +769,6 @@ class JarVerifier { } }; } - private Enumeration emptyEnumeration = new Enumeration() { - - public boolean hasMoreElements() { - return false; - } - - public String nextElement() { - throw new NoSuchElementException(); - } - }; // true if file is part of the signature mechanism itself static boolean isSigningRelated(String name) { diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index a32e332efc7..e93cc4adcf9 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -289,6 +289,10 @@ module java.base { jdk.jartool, jdk.security.auth, jdk.security.jgss; + exports sun.security.util.math to + jdk.crypto.ec + exports sun.security.util.math.intpoly to + jdk.crypto.ec exports sun.security.x509 to jdk.crypto.ec, jdk.crypto.cryptoki, diff --git a/src/java.base/share/classes/sun/security/util/math/ImmutableIntegerModuloP.java b/src/java.base/share/classes/sun/security/util/math/ImmutableIntegerModuloP.java new file mode 100644 index 00000000000..d921dde4e46 --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/ImmutableIntegerModuloP.java @@ -0,0 +1,34 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math; + +/** + * An interface for immutable integers modulo a prime value. + */ + +public interface ImmutableIntegerModuloP extends IntegerModuloP { +} + diff --git a/src/java.base/share/classes/sun/security/util/math/IntegerFieldModuloP.java b/src/java.base/share/classes/sun/security/util/math/IntegerFieldModuloP.java new file mode 100644 index 00000000000..57464ee2c23 --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/IntegerFieldModuloP.java @@ -0,0 +1,115 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math; + +import java.math.BigInteger; + +/** + * An interface for the field of integers modulo a prime number. An + * implementation of this interface can be used to get properties of the + * field and to produce field elements of type ImmutableIntegerModuloP from + * other objects and representations of field elements. + */ + +public interface IntegerFieldModuloP { + + /** + * Get the size of the field as a BigInteger. This size is equal to the + * prime modulus used to construct the field. + * + * @return the size of the field. + */ + BigInteger getSize(); + + /** + * Get the additive identity element 0 + * + * @return the additive identity element + */ + ImmutableIntegerModuloP get0(); + + /** + * Get the multiplicative identity element 1 + * + * @return the multiplicative identity element + */ + ImmutableIntegerModuloP get1(); + + /** + * Get the field element equivalent to the supplied BigInteger value. The + * supplied value may be negative or larger than the modulus that defines + * the field. + * + * @param v a BigInteger value + * @return the field element corresponding to v + */ + ImmutableIntegerModuloP getElement(BigInteger v); + + /** + * Get a "small" value according to this implementation. This value may + * be used in optimized forms of some operations to avoid unnecessary + * calculations. For example, multiplication is much faster when it is + * known that one of the numbers fits within a single limb. + * + * The definition of "small", and the range of accepted values, is + * implementation-specific. + * + * @param v the small integer value + * @throws IllegalArgumentException when the value is not small + */ + SmallValue getSmallValue(int v); + + /** + * Get a field element from a little-endian unsigned integer stored in an + * array. The entire array will be used, and the supplied value may be + * larger than the modulus that defines the field. The array will not be + * modified. + * + * @param v an array containing a little-endian unsigned integer + * @return the field element corresponding to v + */ + default ImmutableIntegerModuloP getElement(byte[] v) { + return getElement(v, 0, v.length, (byte) 0); + } + + /** + * Get a field element from a little-endian unsigned integer stored at the + * specified position in an array. The supplied value may be + * larger than the modulus that defines the field. This method also takes + * a byte which is interpreted as an additional high-order byte of the + * number. The array will not be modified. + * + * @param v an array containing a little-endian unsigned integer + * @param offset the starting position of the integer + * @param length the number of bytes to read + * @param highByte the high-order byte of the number + * @return the field element corresponding to the bytes at the specified + * position + */ + ImmutableIntegerModuloP getElement(byte[] v, int offset, int length, + byte highByte); +} + diff --git a/src/java.base/share/classes/sun/security/util/math/IntegerModuloP.java b/src/java.base/share/classes/sun/security/util/math/IntegerModuloP.java new file mode 100644 index 00000000000..262175b837e --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/IntegerModuloP.java @@ -0,0 +1,205 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math; + +import java.math.BigInteger; + +/** + * The base interface for integers modulo a prime value. Objects of this + * type may be either mutable or immutable, and subinterfaces can be used + * to specify that an object is mutable or immutable. This type should never + * be used to declare local/member variables, but it may be used for + * formal parameters of a method. None of the methods in this interface + * modify the value of arguments or this. + * + * The behavior of this interface depends on the particular implementation. + * For example, some implementations only support a limited number of add + * operations before each multiply operation. See the documentation of the + * implementation for details. + * + * @see ImmutableIntegerModuloP + * @see MutableIntegerModuloP + */ +public interface IntegerModuloP { + + /** + * Get the field associated with this element. + * + * @return the field + */ + IntegerFieldModuloP getField(); + + /** + * Get the canonical value of this element as a BigInteger. This value + * will always be in the range [0, p), where p is the prime that defines + * the field. This method performs reduction and other computation to + * produce the result. + * + * @return the value as a BigInteger + */ + BigInteger asBigInteger(); + + /** + * Return this value as a fixed (immutable) element. This method will + * copy the underlying representation if the object is mutable. + * + * @return a fixed element with the same value + */ + ImmutableIntegerModuloP fixed(); + + /** + * Return this value as a mutable element. This method will always copy + * the underlying representation. + * + * @return a mutable element with the same value + */ + MutableIntegerModuloP mutable(); + + /** + * Add this field element with the supplied element and return the result. + * + * @param b the sumand + * @return this + b + */ + ImmutableIntegerModuloP add(IntegerModuloP b); + + /** + * Compute the additive inverse of the field element + * @return the addditiveInverse (0 - this) + */ + ImmutableIntegerModuloP additiveInverse(); + + /** + * Multiply this field element with the supplied element and return the + * result. + * + * @param b the multiplicand + * @return this * b + */ + ImmutableIntegerModuloP multiply(IntegerModuloP b); + + /** + * Perform an addition modulo a power of two and return the little-endian + * encoding of the result. The value is (this' + b') % 2^(8 * len), + * where this' and b' are the canonical integer values equivalent to + * this and b. + * + * @param b the sumand + * @param len the length of the desired array + * @return a byte array of length len containing the result + */ + default byte[] addModPowerTwo(IntegerModuloP b, int len) { + byte[] result = new byte[len]; + addModPowerTwo(b, result); + return result; + } + + /** + * Perform an addition modulo a power of two and store the little-endian + * encoding of the result in the supplied array. The value is + * (this' + b') % 2^(8 * result.length), where this' and b' are the + * canonical integer values equivalent to this and b. + * + * @param b the sumand + * @param result an array which stores the result upon return + */ + void addModPowerTwo(IntegerModuloP b, byte[] result); + + /** + * Returns the little-endian encoding of this' % 2^(8 * len), where this' + * is the canonical integer value equivalent to this. + * + * @param len the length of the desired array + * @return a byte array of length len containing the result + */ + default byte[] asByteArray(int len) { + byte[] result = new byte[len]; + asByteArray(result); + return result; + } + + /** + * Places the little-endian encoding of this' % 2^(8 * result.length) + * into the supplied array, where this' is the canonical integer value + * equivalent to this. + * + * @param result an array which stores the result upon return + */ + void asByteArray(byte[] result); + + /** + * Compute the multiplicative inverse of this field element. + * + * @return the multiplicative inverse (1 / this) + */ + default ImmutableIntegerModuloP multiplicativeInverse() { + return pow(getField().getSize().subtract(BigInteger.valueOf(2))); + } + + /** + * Subtract the supplied element from this one and return the result. + * @param b the subtrahend + * + * @return the difference (this - b) + */ + default ImmutableIntegerModuloP subtract(IntegerModuloP b) { + return add(b.additiveInverse()); + } + + /** + * Calculate the square of this element and return the result. This method + * should be used instead of a.multiply(a) because implementations may + * include optimizations that only apply to squaring. + * + * @return the product (this * this) + */ + default ImmutableIntegerModuloP square() { + return multiply(this); + } + + /** + * Calculate the power this^b and return the result. + * + * @param b the exponent + * @return the value of this^b + */ + default ImmutableIntegerModuloP pow(BigInteger b) { + //Default implementation is square and multiply + MutableIntegerModuloP y = getField().get1().mutable(); + MutableIntegerModuloP x = mutable(); + int bitLength = b.bitLength(); + for (int bit = 0; bit < bitLength; bit++) { + if (b.testBit(bit)) { + // odd + y.setProduct(x); + } + x.setSquare(); + } + return y.fixed(); + } + +} + diff --git a/src/java.base/share/classes/sun/security/util/math/MutableIntegerModuloP.java b/src/java.base/share/classes/sun/security/util/math/MutableIntegerModuloP.java new file mode 100644 index 00000000000..c3c57d68daf --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/MutableIntegerModuloP.java @@ -0,0 +1,135 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math; + +import java.nio.ByteBuffer; + +/** + * An interface for mutable integers modulo a prime value. This interface + * should be used to improve performance and avoid the allocation of a large + * number of temporary objects. + * + * Methods in this interface that modify the value also return the modified + * element. This structure enables fluent expressions like: + * a.setSum(b).setProduct(c).setDifference(d).setSquare() + * + */ + +public interface MutableIntegerModuloP extends IntegerModuloP { + + /** + * Swap the value of this with the value of b when swap has the value 1. + * No change is made to either element when swap has the value 0. The + * result is undefined when swap has a value other than 0 or 1. The swap + * parameter is an int (rather than boolean) to allow the implementation + * to perform the swap using branch-free integer arithmetic. + * + * @param b the element to conditionally swap with + * @param swap an int that determines whether to swap + */ + void conditionalSwapWith(MutableIntegerModuloP b, int swap); + + /** + * Set the value of this element equal to the value of the supplied + * element. The argument is not modified. + * + * @param v the element whose value should be copied to this + * @return this + */ + MutableIntegerModuloP setValue(IntegerModuloP v); + + /** + * Set the value equal to the little-endian unsigned integer stored at the + * specified position in an array. The range of accepted values is + * implementation-specific. This method also takes a byte which is + * interpreted as an additional high-order byte of the number. + * + * @param v an array containing a little-endian unsigned integer + * @param offset the starting position of the integer + * @param length the number of bytes to read + * @param highByte the high-order byte of the number + * @return this + */ + MutableIntegerModuloP setValue(byte[] v, int offset, int length, + byte highByte); + + /** + * Set the value equal to the little-endian unsigned integer stored in a + * buffer. The range of accepted values is implementation-specific. + * This method also takes a byte which is interpreted as an additional + * high-order byte of the number. + * + * @param buf a buffer containing a little-endian unsigned integer + * @param length the number of bytes to read + * @param highByte the high-order byte of the number + * @return this + */ + MutableIntegerModuloP setValue(ByteBuffer buf, int length, byte highByte); + + /** + * Set the value of this element equal to this * this. + * + * @return this + */ + MutableIntegerModuloP setSquare(); + + /** + * Set the value of this element equal to this + b. The argument is + * not modified. + * + * @param b the sumand + * @return this + */ + MutableIntegerModuloP setSum(IntegerModuloP b); + + /** + * Set the value of this element equal to this - b. The argument is + * not modified. + * + * @param b the subtrahend + * @return this + */ + MutableIntegerModuloP setDifference(IntegerModuloP b); + + /** + * Set the value of this element equal to this * b. The argument is + * not modified. + * + * @param b the multiplicand + * @return this + */ + MutableIntegerModuloP setProduct(IntegerModuloP b); + + /** + * Set the value of this element equal to this * v. The argument is + * not modified. + * + * @param v the small multiplicand + * @return this + */ + MutableIntegerModuloP setProduct(SmallValue v); +} + diff --git a/src/java.base/share/classes/sun/security/util/math/SmallValue.java b/src/java.base/share/classes/sun/security/util/math/SmallValue.java new file mode 100644 index 00000000000..4c24594b7cd --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/SmallValue.java @@ -0,0 +1,38 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math; + +/** + * A "small" value that can be used with the field arithmetic library. This + * interface enables optimizations based on the fact that certain values are + * known to be small, where the definition of small is specific to the the + * arithmetic implementation. + */ + +public interface SmallValue { +} + + diff --git a/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial.java b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial.java new file mode 100644 index 00000000000..88fb2b3a9f2 --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial.java @@ -0,0 +1,576 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math.intpoly; + +import sun.security.util.math.*; + +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.Arrays; + +/** + * A large number polynomial representation using sparse limbs of signed + * long (64-bit) values. Limb values will always fit within a long, so inputs + * to multiplication must be less than 32 bits. All IntegerPolynomial + * implementations allow at most one addition before multiplication. Additions + * after that will result in an ArithmeticException. + * + * The following element operations are branch-free for all subclasses: + * + * fixed + * mutable + * add + * additiveInverse + * multiply + * square + * subtract + * conditionalSwapWith + * setValue (may branch on high-order byte parameter only) + * setSum + * setDifference + * setProduct + * setSquare + * + * All other operations may branch in some subclasses. + * + */ + +public abstract class IntegerPolynomial implements IntegerFieldModuloP { + + protected static final BigInteger TWO = BigInteger.valueOf(2); + + protected final int numLimbs; + private final BigInteger modulus; + protected final int bitsPerLimb; + + // must work when a==r + protected abstract void multByInt(long[] a, long b, long[] r); + + // must work when a==r + protected abstract void mult(long[] a, long[] b, long[] r); + + // must work when a==r + protected abstract void square(long[] a, long[] r); + + IntegerPolynomial(int bitsPerLimb, + int numLimbs, + BigInteger modulus) { + + + this.numLimbs = numLimbs; + this.modulus = modulus; + this.bitsPerLimb = bitsPerLimb; + } + + protected int getNumLimbs() { + return numLimbs; + } + + @Override + public BigInteger getSize() { + return modulus; + } + + @Override + public ImmutableElement get0() { + return new ImmutableElement(false); + } + + @Override + public ImmutableElement get1() { + return new ImmutableElement(true); + } + + @Override + public ImmutableElement getElement(BigInteger v) { + return new ImmutableElement(v); + } + + @Override + public SmallValue getSmallValue(int value) { + int maxMag = 1 << (bitsPerLimb - 1); + if (Math.abs(value) >= maxMag) { + throw new IllegalArgumentException( + "max magnitude is " + maxMag); + } + return new Limb(value); + } + + /** + * This version of encode takes a ByteBuffer that is properly ordered, and + * may extract larger values (e.g. long) from the ByteBuffer for better + * performance. The implementation below only extracts bytes from the + * buffer, but this method may be overridden in field-specific + * implementations. + */ + protected void encode(ByteBuffer buf, int length, byte highByte, + long[] result) { + int numHighBits = 32 - Integer.numberOfLeadingZeros(highByte); + int numBits = 8 * length + numHighBits; + int maxBits = bitsPerLimb * result.length; + if (numBits > maxBits) { + throw new ArithmeticException("Value is too large."); + } + + int limbIndex = 0; + long curLimbValue = 0; + int bitPos = 0; + for (int i = 0; i < length; i++) { + long curV = buf.get() & 0xFF; + + if (bitPos + 8 >= bitsPerLimb) { + int bitsThisLimb = bitsPerLimb - bitPos; + curLimbValue += (curV & (0xFF >> (8 - bitsThisLimb))) << bitPos; + result[limbIndex++] = curLimbValue; + curLimbValue = curV >> bitsThisLimb; + bitPos = 8 - bitsThisLimb; + } + else { + curLimbValue += curV << bitPos; + bitPos += 8; + } + } + + // one more for the high byte + if (highByte != 0) { + long curV = highByte & 0xFF; + if (bitPos + 8 >= bitsPerLimb) { + int bitsThisLimb = bitsPerLimb - bitPos; + curLimbValue += (curV & (0xFF >> (8 - bitsThisLimb))) << bitPos; + result[limbIndex++] = curLimbValue; + curLimbValue = curV >> bitsThisLimb; + } + else { + curLimbValue += curV << bitPos; + } + } + + if (limbIndex < numLimbs) { + result[limbIndex++] = curLimbValue; + } + Arrays.fill(result, limbIndex, numLimbs, 0); + + postEncodeCarry(result); + } + + protected void encode(byte[] v, int offset, int length, byte highByte, + long[] result) { + + ByteBuffer buf = ByteBuffer.wrap(v, offset, length); + buf.order(ByteOrder.LITTLE_ENDIAN); + encode(buf, length, highByte, result); + } + + protected void postEncodeCarry(long[] v) { + carry(v); + } + + public ImmutableElement getElement(byte[] v, int offset, int length, + byte highByte) { + + long[] result = new long[numLimbs]; + + encode(v, offset, length, highByte, result); + + return new ImmutableElement(result, true); + } + + protected BigInteger evaluate(long[] limbs) { + BigInteger result = BigInteger.ZERO; + for (int i = limbs.length - 1; i >= 0; i--) { + result = result.shiftLeft(bitsPerLimb) + .add(BigInteger.valueOf(limbs[i])); + } + return result.mod(modulus); + } + + protected long carryValue(long x) { + // compressing carry operation + // if large positive number, carry one more to make it negative + // if large negative number (closer to zero), carry one fewer + return (x + (1 << (bitsPerLimb - 1))) >> bitsPerLimb; + } + + protected void carry(long[] limbs, int start, int end) { + + for (int i = start; i < end; i++) { + + long carry = carryOut(limbs, i); + limbs[i + 1] += carry; + } + } + + protected void carry(long[] limbs) { + + carry(limbs, 0, limbs.length - 1); + } + + // carry out of the specified position and return the carry value + protected long carryOut(long[] limbs, int index) { + long carry = carryValue(limbs[index]); + limbs[index] -= (carry << bitsPerLimb); + return carry; + } + + private void setLimbsValue(BigInteger v, long[] limbs) { + // set all limbs positive, and then carry + setLimbsValuePositive(v, limbs); + carry(limbs); + } + + protected void setLimbsValuePositive(BigInteger v, long[] limbs) { + BigInteger mod = BigInteger.valueOf(1 << bitsPerLimb); + for (int i = 0; i < limbs.length; i++) { + limbs[i] = v.mod(mod).longValue(); + v = v.shiftRight(bitsPerLimb); + } + } + + // v must be final reduced. I.e. all limbs in [0, bitsPerLimb) + // and value in [0, modulus) + protected void decode(long[] v, byte[] dst, int offset, int length) { + + int nextLimbIndex = 0; + long curLimbValue = v[nextLimbIndex++]; + int bitPos = 0; + for (int i = 0; i < length; i++) { + + int dstIndex = i + offset; + if (bitPos + 8 >= bitsPerLimb) { + dst[dstIndex] = (byte) curLimbValue; + curLimbValue = v[nextLimbIndex++]; + int bitsAdded = bitsPerLimb - bitPos; + int bitsLeft = 8 - bitsAdded; + + dst[dstIndex] += (curLimbValue & (0xFF >> bitsAdded)) + << bitsAdded; + curLimbValue >>= bitsLeft; + bitPos = bitsLeft; + } else { + dst[dstIndex] = (byte) curLimbValue; + curLimbValue >>= 8; + bitPos += 8; + } + } + } + + protected void addLimbs(long[] a, long[] b, long[] dst) { + for (int i = 0; i < dst.length; i++) { + dst[i] = a[i] + b[i]; + } + } + + protected static void conditionalSwap(int swap, long[] a, long[] b) { + int maskValue = 0 - swap; + for (int i = 0; i < a.length; i++) { + long dummyLimbs = maskValue & (a[i] ^ b[i]); + a[i] = dummyLimbs ^ a[i]; + b[i] = dummyLimbs ^ b[i]; + } + } + + private void bigIntToByteArray(BigInteger bi, byte[] result) { + byte[] biBytes = bi.toByteArray(); + // biBytes is backwards and possibly too big + // Copy the low-order bytes into result in reverse + int sourceIndex = biBytes.length - 1; + for (int i = 0; i < result.length; i++) { + if (sourceIndex >= 0) { + result[i] = biBytes[sourceIndex--]; + } + else { + result[i] = 0; + } + } + } + + protected void limbsToByteArray(long[] limbs, byte[] result) { + + bigIntToByteArray(evaluate(limbs), result); + } + + protected void addLimbsModPowerTwo(long[] limbs, long[] other, + byte[] result) { + + BigInteger bi1 = evaluate(limbs); + BigInteger bi2 = evaluate(other); + BigInteger biResult = bi1.add(bi2); + bigIntToByteArray(biResult, result); + } + + private abstract class Element implements IntegerModuloP { + + protected long[] limbs; + protected boolean summand = false; + + public Element(BigInteger v) { + limbs = new long[numLimbs]; + setValue(v); + } + + public Element(boolean v) { + limbs = new long[numLimbs]; + limbs[0] = v ? 1l : 0l; + summand = true; + } + + private Element(long[] limbs, boolean summand) { + this.limbs = limbs; + this.summand = summand; + } + + private void setValue(BigInteger v) { + setLimbsValue(v, limbs); + summand = true; + } + + @Override + public IntegerFieldModuloP getField() { + return IntegerPolynomial.this; + } + + @Override + public BigInteger asBigInteger() { + return evaluate(limbs); + } + + @Override + public MutableElement mutable() { + return new MutableElement(limbs.clone(), summand); + } + + @Override + public ImmutableElement add(IntegerModuloP genB) { + + Element b = (Element) genB; + if (!(summand && b.summand)) { + throw new ArithmeticException("Not a valid summand"); + } + + long[] newLimbs = new long[limbs.length]; + for (int i = 0; i < limbs.length; i++) { + newLimbs[i] = limbs[i] + b.limbs[i]; + } + + return new ImmutableElement(newLimbs, false); + } + + @Override + public ImmutableElement additiveInverse() { + + long[] newLimbs = new long[limbs.length]; + for (int i = 0; i < limbs.length; i++) { + newLimbs[i] = -limbs[i]; + } + + ImmutableElement result = new ImmutableElement(newLimbs, summand); + return result; + } + + protected long[] cloneLow(long[] limbs) { + long[] newLimbs = new long[numLimbs]; + copyLow(limbs, newLimbs); + return newLimbs; + } + protected void copyLow(long[] limbs, long[] out) { + System.arraycopy(limbs, 0, out, 0, out.length); + } + + @Override + public ImmutableElement multiply(IntegerModuloP genB) { + + Element b = (Element) genB; + + long[] newLimbs = new long[limbs.length]; + mult(limbs, b.limbs, newLimbs); + return new ImmutableElement(newLimbs, true); + } + + @Override + public ImmutableElement square() { + long[] newLimbs = new long[limbs.length]; + IntegerPolynomial.this.square(limbs, newLimbs); + return new ImmutableElement(newLimbs, true); + } + + public void addModPowerTwo(IntegerModuloP arg, byte[] result) { + if (!summand) { + throw new ArithmeticException("Not a valid summand"); + } + + Element other = (Element) arg; + addLimbsModPowerTwo(limbs, other.limbs, result); + } + + public void asByteArray(byte[] result) { + if (!summand) { + throw new ArithmeticException("Not a valid summand"); + } + limbsToByteArray(limbs, result); + } + } + + private class MutableElement extends Element + implements MutableIntegerModuloP { + + protected MutableElement(long[] limbs, boolean summand) { + super(limbs, summand); + } + + @Override + public ImmutableElement fixed() { + return new ImmutableElement(limbs.clone(), summand); + } + + @Override + public void conditionalSwapWith(MutableIntegerModuloP b, int swap) { + + MutableElement other = (MutableElement) b; + + conditionalSwap(swap, limbs, other.limbs); + boolean summandTemp = summand; + summand = other.summand; + other.summand = summandTemp; + } + + + @Override + public MutableElement setValue(IntegerModuloP v) { + Element other = (Element) v; + + System.arraycopy(other.limbs, 0, limbs, 0, other.limbs.length); + summand = other.summand; + return this; + } + + @Override + public MutableElement setValue(byte[] arr, int offset, + int length, byte highByte) { + + encode(arr, offset, length, highByte, limbs); + summand = true; + + return this; + } + + @Override + public MutableElement setValue(ByteBuffer buf, int length, + byte highByte) { + + encode(buf, length, highByte, limbs); + summand = true; + + return this; + } + + @Override + public MutableElement setProduct(IntegerModuloP genB) { + Element b = (Element) genB; + mult(limbs, b.limbs, limbs); + summand = true; + return this; + } + + @Override + public MutableElement setProduct(SmallValue v) { + int value = ((Limb) v).value; + multByInt(limbs, value, limbs); + summand = true; + return this; + } + + @Override + public MutableElement setSum(IntegerModuloP genB) { + + Element b = (Element) genB; + if (!(summand && b.summand)) { + throw new ArithmeticException("Not a valid summand"); + } + + for (int i = 0; i < limbs.length; i++) { + limbs[i] = limbs[i] + b.limbs[i]; + } + + summand = false; + return this; + } + + @Override + public MutableElement setDifference(IntegerModuloP genB) { + + Element b = (Element) genB; + if (!(summand && b.summand)) { + throw new ArithmeticException("Not a valid summand"); + } + + for (int i = 0; i < limbs.length; i++) { + limbs[i] = limbs[i] - b.limbs[i]; + } + + return this; + } + + @Override + public MutableElement setSquare() { + IntegerPolynomial.this.square(limbs, limbs); + summand = true; + return this; + } + + } + + class ImmutableElement extends Element implements ImmutableIntegerModuloP { + + protected ImmutableElement(BigInteger v) { + super(v); + } + + protected ImmutableElement(boolean v) { + super(v); + } + + protected ImmutableElement(long[] limbs, boolean summand) { + super(limbs, summand); + } + + @Override + public ImmutableElement fixed() { + return this; + } + + } + + class Limb implements SmallValue { + int value; + + Limb(int value) { + this.value = value; + } + } + + +} diff --git a/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial1305.java b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial1305.java new file mode 100644 index 00000000000..5bdadc4c0a0 --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial1305.java @@ -0,0 +1,301 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math.intpoly; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.math.BigInteger; +import java.nio.*; + +/** + * An IntegerFieldModuloP designed for use with the Poly1305 authenticator. + * The representation uses 5 signed long values. + * + * In addition to the branch-free operations specified in the parent class, + * the following operations are branch-free: + * + * addModPowerTwo + * asByteArray + * + */ + +public class IntegerPolynomial1305 extends IntegerPolynomial { + + protected static final int SUBTRAHEND = 5; + protected static final int NUM_LIMBS = 5; + private static final int POWER = 130; + private static final int BITS_PER_LIMB = 26; + private static final BigInteger MODULUS + = TWO.pow(POWER).subtract(BigInteger.valueOf(SUBTRAHEND)); + + private final long[] posModLimbs; + + private long[] setPosModLimbs() { + long[] result = new long[NUM_LIMBS]; + setLimbsValuePositive(MODULUS, result); + return result; + } + + public IntegerPolynomial1305() { + super(BITS_PER_LIMB, NUM_LIMBS, MODULUS); + posModLimbs = setPosModLimbs(); + } + + protected void mult(long[] a, long[] b, long[] r) { + + // Use grade-school multiplication into primitives to avoid the + // temporary array allocation. This is equivalent to the following + // code: + // long[] c = new long[2 * NUM_LIMBS - 1]; + // for(int i = 0; i < NUM_LIMBS; i++) { + // for(int j - 0; j < NUM_LIMBS; j++) { + // c[i + j] += a[i] * b[j] + // } + // } + + long c0 = (a[0] * b[0]); + long c1 = (a[0] * b[1]) + (a[1] * b[0]); + long c2 = (a[0] * b[2]) + (a[1] * b[1]) + (a[2] * b[0]); + long c3 = (a[0] * b[3]) + (a[1] * b[2]) + (a[2] * b[1]) + (a[3] * b[0]); + long c4 = (a[0] * b[4]) + (a[1] * b[3]) + (a[2] * b[2]) + (a[3] * b[1]) + (a[4] * b[0]); + long c5 = (a[1] * b[4]) + (a[2] * b[3]) + (a[3] * b[2]) + (a[4] * b[1]); + long c6 = (a[2] * b[4]) + (a[3] * b[3]) + (a[4] * b[2]); + long c7 = (a[3] * b[4]) + (a[4] * b[3]); + long c8 = (a[4] * b[4]); + + carryReduce(r, c0, c1, c2, c3, c4, c5, c6, c7, c8); + } + + private void carryReduce(long[] r, long c0, long c1, long c2, long c3, + long c4, long c5, long c6, long c7, long c8) { + //reduce(2, 2) + r[2] = c2 + (c7 * SUBTRAHEND); + c3 += (c8 * SUBTRAHEND); + + // carry(3, 2) + long carry3 = carryValue(c3); + r[3] = c3 - (carry3 << BITS_PER_LIMB); + c4 += carry3; + + long carry4 = carryValue(c4); + r[4] = c4 - (carry4 << BITS_PER_LIMB); + c5 += carry4; + + // reduce(0, 2) + r[0] = c0 + (c5 * SUBTRAHEND); + r[1] = c1 + (c6 * SUBTRAHEND); + + // carry(0, 4) + carry(r); + } + + protected void multByInt(long[] a, long b, long[] r) { + + for (int i = 0; i < a.length; i++) { + r[i] = a[i] * b; + } + + reduce(r); + } + + @Override + protected void square(long[] a, long[] r) { + // Use grade-school multiplication with a simple squaring optimization. + // Multiply into primitives to avoid the temporary array allocation. + // This is equivalent to the following code: + // long[] c = new long[2 * NUM_LIMBS - 1]; + // for(int i = 0; i < NUM_LIMBS; i++) { + // c[2 * i] = a[i] * a[i]; + // for(int j = i + 1; j < NUM_LIMBS; j++) { + // c[i + j] += 2 * a[i] * a[j] + // } + // } + + long c0 = (a[0] * a[0]); + long c1 = 2 * (a[0] * a[1]); + long c2 = 2 * (a[0] * a[2]) + (a[1] * a[1]); + long c3 = 2 * (a[0] * a[3] + a[1] * a[2]); + long c4 = 2 * (a[0] * a[4] + a[1] * a[3]) + (a[2] * a[2]); + long c5 = 2 * (a[1] * a[4] + a[2] * a[3]); + long c6 = 2 * (a[2] * a[4]) + (a[3] * a[3]); + long c7 = 2 * (a[3] * a[4]); + long c8 = (a[4] * a[4]); + + carryReduce(r, c0, c1, c2, c3, c4, c5, c6, c7, c8); + } + + @Override + protected void encode(ByteBuffer buf, int length, byte highByte, + long[] result) { + if (length == 16) { + long low = buf.getLong(); + long high = buf.getLong(); + encode(high, low, highByte, result); + } else { + super.encode(buf, length, highByte, result); + } + } + + protected void encode(long high, long low, byte highByte, long[] result) { + result[0] = low & 0x3FFFFFFL; + result[1] = (low >>> 26) & 0x3FFFFFFL; + result[2] = (low >>> 52) + ((high & 0x3FFFL) << 12); + result[3] = (high >>> 14) & 0x3FFFFFFL; + result[4] = (high >>> 40) + (highByte << 24L); + } + + private static final VarHandle AS_LONG_LE = MethodHandles + .byteArrayViewVarHandle(long[].class, ByteOrder.LITTLE_ENDIAN); + + protected void encode(byte[] v, int offset, int length, byte highByte, + long[] result) { + if (length == 16) { + long low = (long) AS_LONG_LE.get(v, offset); + long high = (long) AS_LONG_LE.get(v, offset + 8); + encode(high, low, highByte, result); + } else { + super.encode(v, offset, length, highByte, result); + } + } + + protected void modReduceIn(long[] limbs, int index, long x) { + // this only works when BITS_PER_LIMB * NUM_LIMBS = POWER exactly + long reducedValue = (x * SUBTRAHEND); + limbs[index - NUM_LIMBS] += reducedValue; + } + + protected final void modReduce(long[] limbs, int start, int end) { + + for (int i = start; i < end; i++) { + modReduceIn(limbs, i, limbs[i]); + limbs[i] = 0; + } + } + + protected void modReduce(long[] limbs) { + + modReduce(limbs, NUM_LIMBS, NUM_LIMBS - 1); + } + + @Override + protected long carryValue(long x) { + // This representation has plenty of extra space, so we can afford to + // do a simplified carry operation that is more time-efficient. + + return x >> BITS_PER_LIMB; + } + + + protected void reduce(long[] limbs) { + long carry3 = carryOut(limbs, 3); + long new4 = carry3 + limbs[4]; + + long carry4 = carryValue(new4); + limbs[4] = new4 - (carry4 << BITS_PER_LIMB); + + modReduceIn(limbs, 5, carry4); + carry(limbs); + } + + // Convert reduced limbs into a number between 0 and MODULUS-1 + private void finalReduce(long[] limbs) { + + addLimbs(limbs, posModLimbs, limbs); + // now all values are positive, so remaining operations will be unsigned + + // unsigned carry out of last position and reduce in to first position + long carry = limbs[NUM_LIMBS - 1] >> BITS_PER_LIMB; + limbs[NUM_LIMBS - 1] -= carry << BITS_PER_LIMB; + modReduceIn(limbs, NUM_LIMBS, carry); + + // unsigned carry on all positions + carry = 0; + for (int i = 0; i < NUM_LIMBS; i++) { + limbs[i] += carry; + carry = limbs[i] >> BITS_PER_LIMB; + limbs[i] -= carry << BITS_PER_LIMB; + } + // reduce final carry value back in + modReduceIn(limbs, NUM_LIMBS, carry); + // we only reduce back in a nonzero value if some value was carried out + // of the previous loop. So at least one remaining value is small. + + // One more carry is all that is necessary. Nothing will be carried out + // at the end + carry = 0; + for (int i = 0; i < NUM_LIMBS; i++) { + limbs[i] += carry; + carry = limbs[i] >> BITS_PER_LIMB; + limbs[i] -= carry << BITS_PER_LIMB; + } + + // limbs are positive and all less than 2^BITS_PER_LIMB + // but the value may be greater than the MODULUS. + // Subtract the max limb values only if all limbs end up non-negative + int smallerNonNegative = 1; + long[] smaller = new long[NUM_LIMBS]; + for (int i = NUM_LIMBS - 1; i >= 0; i--) { + smaller[i] = limbs[i] - posModLimbs[i]; + // expression on right is 1 if smaller[i] is nonnegative, + // 0 otherwise + smallerNonNegative *= (int) (smaller[i] >> 63) + 1; + } + conditionalSwap(smallerNonNegative, limbs, smaller); + + } + + @Override + protected void limbsToByteArray(long[] limbs, byte[] result) { + + long[] reducedLimbs = limbs.clone(); + finalReduce(reducedLimbs); + + decode(reducedLimbs, result, 0, result.length); + } + + @Override + protected void addLimbsModPowerTwo(long[] limbs, long[] other, + byte[] result) { + + long[] reducedOther = other.clone(); + long[] reducedLimbs = limbs.clone(); + finalReduce(reducedLimbs); + + addLimbs(reducedLimbs, reducedOther, reducedLimbs); + + // may carry out a value which can be ignored + long carry = 0; + for (int i = 0; i < NUM_LIMBS; i++) { + reducedLimbs[i] += carry; + carry = reducedLimbs[i] >> BITS_PER_LIMB; + reducedLimbs[i] -= carry << BITS_PER_LIMB; + } + + decode(reducedLimbs, result, 0, result.length); + } + +} + diff --git a/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial25519.java b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial25519.java new file mode 100644 index 00000000000..837581c47b2 --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial25519.java @@ -0,0 +1,204 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math.intpoly; + +import java.math.BigInteger; + +public class IntegerPolynomial25519 extends IntegerPolynomial { + + private static final int POWER = 255; + private static final int SUBTRAHEND = 19; + private static final int NUM_LIMBS = 10; + private static final int BITS_PER_LIMB = 26; + public static final BigInteger MODULUS + = TWO.pow(POWER).subtract(BigInteger.valueOf(SUBTRAHEND)); + + // BITS_PER_LIMB does not divide POWER, so reduction is a bit complicated + // The constants below help split up values during reduction + private static final int BIT_OFFSET = NUM_LIMBS * BITS_PER_LIMB - POWER; + private static final int LIMB_MASK = -1 >>> (64 - BITS_PER_LIMB); + private static final int RIGHT_BIT_OFFSET = BITS_PER_LIMB - BIT_OFFSET; + + public IntegerPolynomial25519() { + super(BITS_PER_LIMB, NUM_LIMBS, MODULUS); + } + + @Override + protected void mult(long[] a, long[] b, long[] r) { + + // Use grade-school multiplication into primitives to avoid the + // temporary array allocation. This is equivalent to the following + // code: + // long[] c = new long[2 * NUM_LIMBS - 1]; + // for(int i = 0; i < NUM_LIMBS; i++) { + // for(int j - 0; j < NUM_LIMBS; j++) { + // c[i + j] += a[i] * b[j] + // } + // } + + long c0 = (a[0] * b[0]); + long c1 = (a[0] * b[1]) + (a[1] * b[0]); + long c2 = (a[0] * b[2]) + (a[1] * b[1]) + (a[2] * b[0]); + long c3 = (a[0] * b[3]) + (a[1] * b[2]) + (a[2] * b[1]) + (a[3] * b[0]); + long c4 = (a[0] * b[4]) + (a[1] * b[3]) + (a[2] * b[2]) + (a[3] * b[1]) + (a[4] * b[0]); + long c5 = (a[0] * b[5]) + (a[1] * b[4]) + (a[2] * b[3]) + (a[3] * b[2]) + (a[4] * b[1]) + (a[5] * b[0]); + long c6 = (a[0] * b[6]) + (a[1] * b[5]) + (a[2] * b[4]) + (a[3] * b[3]) + (a[4] * b[2]) + (a[5] * b[1]) + (a[6] * b[0]); + long c7 = (a[0] * b[7]) + (a[1] * b[6]) + (a[2] * b[5]) + (a[3] * b[4]) + (a[4] * b[3]) + (a[5] * b[2]) + (a[6] * b[1]) + (a[7] * b[0]); + long c8 = (a[0] * b[8]) + (a[1] * b[7]) + (a[2] * b[6]) + (a[3] * b[5]) + (a[4] * b[4]) + (a[5] * b[3]) + (a[6] * b[2]) + (a[7] * b[1]) + (a[8] * b[0]); + long c9 = (a[0] * b[9]) + (a[1] * b[8]) + (a[2] * b[7]) + (a[3] * b[6]) + (a[4] * b[5]) + (a[5] * b[4]) + (a[6] * b[3]) + (a[7] * b[2]) + (a[8] * b[1]) + (a[9] * b[0]); + long c10 = (a[1] * b[9]) + (a[2] * b[8]) + (a[3] * b[7]) + (a[4] * b[6]) + (a[5] * b[5]) + (a[6] * b[4]) + (a[7] * b[3]) + (a[8] * b[2]) + (a[9] * b[1]); + long c11 = (a[2] * b[9]) + (a[3] * b[8]) + (a[4] * b[7]) + (a[5] * b[6]) + (a[6] * b[5]) + (a[7] * b[4]) + (a[8] * b[3]) + (a[9] * b[2]); + long c12 = (a[3] * b[9]) + (a[4] * b[8]) + (a[5] * b[7]) + (a[6] * b[6]) + (a[7] * b[5]) + (a[8] * b[4]) + (a[9] * b[3]); + long c13 = (a[4] * b[9]) + (a[5] * b[8]) + (a[6] * b[7]) + (a[7] * b[6]) + (a[8] * b[5]) + (a[9] * b[4]); + long c14 = (a[5] * b[9]) + (a[6] * b[8]) + (a[7] * b[7]) + (a[8] * b[6]) + (a[9] * b[5]); + long c15 = (a[6] * b[9]) + (a[7] * b[8]) + (a[8] * b[7]) + (a[9] * b[6]); + long c16 = (a[7] * b[9]) + (a[8] * b[8]) + (a[9] * b[7]); + long c17 = (a[8] * b[9]) + (a[9] * b[8]); + long c18 = a[9] * b[9]; + + carryReduce(r, c0, c1, c2, c3, c4, c5, c6, c7, c8, + c9, c10, c11, c12, c13, c14, c15, c16, c17, c18); + + } + + private void carryReduce(long[] r, long c0, long c1, long c2, + long c3, long c4, long c5, long c6, + long c7, long c8, long c9, long c10, + long c11, long c12, long c13, long c14, + long c15, long c16, long c17, long c18) { + // reduce(7,2) + long reducedValue17 = (c17 * SUBTRAHEND); + c7 += (reducedValue17 << BIT_OFFSET) & LIMB_MASK; + c8 += reducedValue17 >> RIGHT_BIT_OFFSET; + + long reducedValue18 = (c18 * SUBTRAHEND); + c8 += (reducedValue18 << BIT_OFFSET) & LIMB_MASK; + c9 += reducedValue18 >> RIGHT_BIT_OFFSET; + + // carry(8,2) + long carry8 = carryValue(c8); + r[8] = c8 - (carry8 << BITS_PER_LIMB); + c9 += carry8; + + long carry9 = carryValue(c9); + r[9] = c9 - (carry9 << BITS_PER_LIMB); + c10 += carry9; + + // reduce(0,7) + long reducedValue10 = (c10 * SUBTRAHEND); + r[0] = c0 + ((reducedValue10 << BIT_OFFSET) & LIMB_MASK); + c1 += reducedValue10 >> RIGHT_BIT_OFFSET; + + long reducedValue11 = (c11 * SUBTRAHEND); + r[1] = c1 + ((reducedValue11 << BIT_OFFSET) & LIMB_MASK); + c2 += reducedValue11 >> RIGHT_BIT_OFFSET; + + long reducedValue12 = (c12 * SUBTRAHEND); + r[2] = c2 + ((reducedValue12 << BIT_OFFSET) & LIMB_MASK); + c3 += reducedValue12 >> RIGHT_BIT_OFFSET; + + long reducedValue13 = (c13 * SUBTRAHEND); + r[3] = c3 + ((reducedValue13 << BIT_OFFSET) & LIMB_MASK); + c4 += reducedValue13 >> RIGHT_BIT_OFFSET; + + long reducedValue14 = (c14 * SUBTRAHEND); + r[4] = c4 + ((reducedValue14 << BIT_OFFSET) & LIMB_MASK); + c5 += reducedValue14 >> RIGHT_BIT_OFFSET; + + long reducedValue15 = (c15 * SUBTRAHEND); + r[5] = c5 + ((reducedValue15 << BIT_OFFSET) & LIMB_MASK); + c6 += reducedValue15 >> RIGHT_BIT_OFFSET; + + long reducedValue16 = (c16 * SUBTRAHEND); + r[6] = c6 + ((reducedValue16 << BIT_OFFSET) & LIMB_MASK); + r[7] = c7 + (reducedValue16 >> RIGHT_BIT_OFFSET); + + // carry(0,9) + carry(r, 0, 9); + } + + protected void multByInt(long[] a, long b, long[] r) { + for (int i = 0; i < a.length; i++) { + r[i] = a[i] * b; + } + + // carry(8, 2) + long carry8 = carryValue(r[8]); + r[8] -= (carry8 << BITS_PER_LIMB); + r[9] += carry8; + + long carry9 = carryValue(r[9]); + r[9] -= (carry9 << BITS_PER_LIMB); + + // reduce(0, 1) + long reducedValue10 = (carry9 * SUBTRAHEND); + r[0] += ((reducedValue10 << BIT_OFFSET) & LIMB_MASK); + r[1] += reducedValue10 >> RIGHT_BIT_OFFSET; + + // carry(0, 9) + carry(r, 0, 9); + } + + @Override + protected void square(long[] a, long[] r) { + + // Use grade-school multiplication with a simple squaring optimization. + // Multiply into primitives to avoid the temporary array allocation. + // This is equivalent to the following code: + // long[] c = new long[2 * NUM_LIMBS - 1]; + // for(int i = 0; i < NUM_LIMBS; i++) { + // c[2 * i] = a[i] * a[i]; + // for(int j = i + 1; j < NUM_LIMBS; j++) { + // c[i + j] += 2 * a[i] * a[j] + // } + // } + + long c0 = a[0] * a[0]; + long c1 = 2 * a[0] * a[1]; + long c2 = a[1] * a[1] + 2 * a[0] * a[2]; + long c3 = 2 * (a[0] * a[3] + a[1] * a[2]); + long c4 = a[2] * a[2] + 2 * (a[0] * a[4] + a[1] * a[3]); + long c5 = 2 * (a[0] * a[5] + a[1] * a[4] + a[2] * a[3]); + long c6 = a[3] * a[3] + 2 * (a[0] * a[6] + a[1] * a[5] + a[2] * a[4]); + long c7 = 2 * (a[0] * a[7] + a[1] * a[6] + a[2] * a[5] + a[3] * a[4]); + long c8 = a[4] * a[4] + 2 * (a[0] * a[8] + a[1] * a[7] + a[2] * a[6] + a[3] * a[5]); + long c9 = 2 * (a[0] * a[9] + a[1] * a[8] + a[2] * a[7] + a[3] * a[6] + a[4] * a[5]); + long c10 = a[5] * a[5] + 2 * (a[1] * a[9] + a[2] * a[8] + a[3] * a[7] + a[4] * a[6]); + long c11 = 2 * (a[2] * a[9] + a[3] * a[8] + a[4] * a[7] + a[5] * a[6]); + long c12 = a[6] * a[6] + 2 * (a[3] * a[9] + a[4] * a[8] + a[5] * a[7]); + long c13 = 2 * (a[4] * a[9] + a[5] * a[8] + a[6] * a[7]); + long c14 = a[7] * a[7] + 2 * (a[5] * a[9] + a[6] * a[8]); + long c15 = 2 * (a[6] * a[9] + a[7] * a[8]); + long c16 = a[8] * a[8] + 2 * a[7] * a[9]; + long c17 = 2 * a[8] * a[9]; + long c18 = a[9] * a[9]; + + carryReduce(r, c0, c1, c2, c3, c4, c5, c6, c7, c8, + c9, c10, c11, c12, c13, c14, c15, c16, c17, c18); + } + + +} diff --git a/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial448.java b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial448.java new file mode 100644 index 00000000000..da2fcf7c758 --- /dev/null +++ b/src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial448.java @@ -0,0 +1,236 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.util.math.intpoly; + +import java.math.BigInteger; + +public class IntegerPolynomial448 extends IntegerPolynomial { + + private static final int POWER = 448; + private static final int NUM_LIMBS = 16; + private static final int BITS_PER_LIMB = 28; + public static final BigInteger MODULUS + = TWO.pow(POWER).subtract(TWO.pow(POWER / 2)) + .subtract(BigInteger.valueOf(1)); + + public IntegerPolynomial448() { + super(BITS_PER_LIMB, NUM_LIMBS, MODULUS); + } + + @Override + protected void mult(long[] a, long[] b, long[] r) { + + // Use grade-school multiplication into primitives to avoid the + // temporary array allocation. This is equivalent to the following + // code: + // long[] c = new long[2 * NUM_LIMBS - 1]; + // for(int i = 0; i < NUM_LIMBS; i++) { + // for(int j - 0; j < NUM_LIMBS; j++) { + // c[i + j] += a[i] * b[j] + // } + // } + + long c0 = (a[0] * b[0]); + long c1 = (a[0] * b[1]) + (a[1] * b[0]); + long c2 = (a[0] * b[2]) + (a[1] * b[1]) + (a[2] * b[0]); + long c3 = (a[0] * b[3]) + (a[1] * b[2]) + (a[2] * b[1]) + (a[3] * b[0]); + long c4 = (a[0] * b[4]) + (a[1] * b[3]) + (a[2] * b[2]) + (a[3] * b[1]) + (a[4] * b[0]); + long c5 = (a[0] * b[5]) + (a[1] * b[4]) + (a[2] * b[3]) + (a[3] * b[2]) + (a[4] * b[1]) + (a[5] * b[0]); + long c6 = (a[0] * b[6]) + (a[1] * b[5]) + (a[2] * b[4]) + (a[3] * b[3]) + (a[4] * b[2]) + (a[5] * b[1]) + (a[6] * b[0]); + long c7 = (a[0] * b[7]) + (a[1] * b[6]) + (a[2] * b[5]) + (a[3] * b[4]) + (a[4] * b[3]) + (a[5] * b[2]) + (a[6] * b[1]) + (a[7] * b[0]); + long c8 = (a[0] * b[8]) + (a[1] * b[7]) + (a[2] * b[6]) + (a[3] * b[5]) + (a[4] * b[4]) + (a[5] * b[3]) + (a[6] * b[2]) + (a[7] * b[1]) + (a[8] * b[0]); + long c9 = (a[0] * b[9]) + (a[1] * b[8]) + (a[2] * b[7]) + (a[3] * b[6]) + (a[4] * b[5]) + (a[5] * b[4]) + (a[6] * b[3]) + (a[7] * b[2]) + (a[8] * b[1]) + (a[9] * b[0]); + long c10 = (a[0] * b[10]) + (a[1] * b[9]) + (a[2] * b[8]) + (a[3] * b[7]) + (a[4] * b[6]) + (a[5] * b[5]) + (a[6] * b[4]) + (a[7] * b[3]) + (a[8] * b[2]) + (a[9] * b[1]) + (a[10] * b[0]); + long c11 = (a[0] * b[11]) + (a[1] * b[10]) + (a[2] * b[9]) + (a[3] * b[8]) + (a[4] * b[7]) + (a[5] * b[6]) + (a[6] * b[5]) + (a[7] * b[4]) + (a[8] * b[3]) + (a[9] * b[2]) + (a[10] * b[1]) + (a[11] * b[0]); + long c12 = (a[0] * b[12]) + (a[1] * b[11]) + (a[2] * b[10]) + (a[3] * b[9]) + (a[4] * b[8]) + (a[5] * b[7]) + (a[6] * b[6]) + (a[7] * b[5]) + (a[8] * b[4]) + (a[9] * b[3]) + (a[10] * b[2]) + (a[11] * b[1]) + (a[12] * b[0]); + long c13 = (a[0] * b[13]) + (a[1] * b[12]) + (a[2] * b[11]) + (a[3] * b[10]) + (a[4] * b[9]) + (a[5] * b[8]) + (a[6] * b[7]) + (a[7] * b[6]) + (a[8] * b[5]) + (a[9] * b[4]) + (a[10] * b[3]) + (a[11] * b[2]) + (a[12] * b[1]) + (a[13] * b[0]); + long c14 = (a[0] * b[14]) + (a[1] * b[13]) + (a[2] * b[12]) + (a[3] * b[11]) + (a[4] * b[10]) + (a[5] * b[9]) + (a[6] * b[8]) + (a[7] * b[7]) + (a[8] * b[6]) + (a[9] * b[5]) + (a[10] * b[4]) + (a[11] * b[3]) + (a[12] * b[2]) + (a[13] * b[1]) + (a[14] * b[0]); + long c15 = (a[0] * b[15]) + (a[1] * b[14]) + (a[2] * b[13]) + (a[3] * b[12]) + (a[4] * b[11]) + (a[5] * b[10]) + (a[6] * b[9]) + (a[7] * b[8]) + (a[8] * b[7]) + (a[9] * b[6]) + (a[10] * b[5]) + (a[11] * b[4]) + (a[12] * b[3]) + (a[13] * b[2]) + (a[14] * b[1]) + (a[15] * b[0]); + long c16 = (a[1] * b[15]) + (a[2] * b[14]) + (a[3] * b[13]) + (a[4] * b[12]) + (a[5] * b[11]) + (a[6] * b[10]) + (a[7] * b[9]) + (a[8] * b[8]) + (a[9] * b[7]) + (a[10] * b[6]) + (a[11] * b[5]) + (a[12] * b[4]) + (a[13] * b[3]) + (a[14] * b[2]) + (a[15] * b[1]); + long c17 = (a[2] * b[15]) + (a[3] * b[14]) + (a[4] * b[13]) + (a[5] * b[12]) + (a[6] * b[11]) + (a[7] * b[10]) + (a[8] * b[9]) + (a[9] * b[8]) + (a[10] * b[7]) + (a[11] * b[6]) + (a[12] * b[5]) + (a[13] * b[4]) + (a[14] * b[3]) + (a[15] * b[2]); + long c18 = (a[3] * b[15]) + (a[4] * b[14]) + (a[5] * b[13]) + (a[6] * b[12]) + (a[7] * b[11]) + (a[8] * b[10]) + (a[9] * b[9]) + (a[10] * b[8]) + (a[11] * b[7]) + (a[12] * b[6]) + (a[13] * b[5]) + (a[14] * b[4]) + (a[15] * b[3]); + long c19 = (a[4] * b[15]) + (a[5] * b[14]) + (a[6] * b[13]) + (a[7] * b[12]) + (a[8] * b[11]) + (a[9] * b[10]) + (a[10] * b[9]) + (a[11] * b[8]) + (a[12] * b[7]) + (a[13] * b[6]) + (a[14] * b[5]) + (a[15] * b[4]); + long c20 = (a[5] * b[15]) + (a[6] * b[14]) + (a[7] * b[13]) + (a[8] * b[12]) + (a[9] * b[11]) + (a[10] * b[10]) + (a[11] * b[9]) + (a[12] * b[8]) + (a[13] * b[7]) + (a[14] * b[6]) + (a[15] * b[5]); + long c21 = (a[6] * b[15]) + (a[7] * b[14]) + (a[8] * b[13]) + (a[9] * b[12]) + (a[10] * b[11]) + (a[11] * b[10]) + (a[12] * b[9]) + (a[13] * b[8]) + (a[14] * b[7]) + (a[15] * b[6]); + long c22 = (a[7] * b[15]) + (a[8] * b[14]) + (a[9] * b[13]) + (a[10] * b[12]) + (a[11] * b[11]) + (a[12] * b[10]) + (a[13] * b[9]) + (a[14] * b[8]) + (a[15] * b[7]); + long c23 = (a[8] * b[15]) + (a[9] * b[14]) + (a[10] * b[13]) + (a[11] * b[12]) + (a[12] * b[11]) + (a[13] * b[10]) + (a[14] * b[9]) + (a[15] * b[8]); + long c24 = (a[9] * b[15]) + (a[10] * b[14]) + (a[11] * b[13]) + (a[12] * b[12]) + (a[13] * b[11]) + (a[14] * b[10]) + (a[15] * b[9]); + long c25 = (a[10] * b[15]) + (a[11] * b[14]) + (a[12] * b[13]) + (a[13] * b[12]) + (a[14] * b[11]) + (a[15] * b[10]); + long c26 = (a[11] * b[15]) + (a[12] * b[14]) + (a[13] * b[13]) + (a[14] * b[12]) + (a[15] * b[11]); + long c27 = (a[12] * b[15]) + (a[13] * b[14]) + (a[14] * b[13]) + (a[15] * b[12]); + long c28 = (a[13] * b[15]) + (a[14] * b[14]) + (a[15] * b[13]); + long c29 = (a[14] * b[15]) + (a[15] * b[14]); + long c30 = (a[15] * b[15]); + + carryReduce(r, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, + c26, c27, c28, c29, c30); + } + + private void carryReduce(long[] r, long c0, long c1, long c2, long c3, + long c4, long c5, long c6, long c7, long c8, + long c9, long c10, long c11, long c12, long c13, + long c14, long c15, long c16, long c17, long c18, + long c19, long c20, long c21, long c22, long c23, + long c24, long c25, long c26, long c27, long c28, + long c29, long c30) { + + // reduce(8, 7) + c8 += c24; + c16 += c24; + + c9 += c25; + c17 += c25; + + c10 += c26; + c18 += c26; + + c11 += c27; + c19 += c27; + + c12 += c28; + c20 += c28; + + c13 += c29; + c21 += c29; + + c14 += c30; + c22 += c30; + + // reduce(4, 4) + r[4] = c4 + c20; + r[12] = c12 + c20; + + r[5] = c5 + c21; + r[13] = c13 + c21; + + r[6] = c6 + c22; + c14 += c22; + + r[7] = c7 + c23; + c15 += c23; + + //carry(14, 2) + long carry14 = carryValue(c14); + r[14] = c14 - (carry14 << BITS_PER_LIMB); + c15 += carry14; + + long carry15 = carryValue(c15); + r[15] = c15 - (carry15 << BITS_PER_LIMB); + c16 += carry15; + + // reduce(0, 4) + r[0] = c0 + c16; + r[8] = c8 + c16; + + r[1] = c1 + c17; + r[9] = c9 + c17; + + r[2] = c2 + c18; + r[10] = c10 + c18; + + r[3] = c3 + c19; + r[11] = c11 + c19; + + // carry(0, 15) + carry(r, 0, 15); + } + + protected void multByInt(long[] a, long b, long[] r) { + for (int i = 0; i < a.length; i++) { + r[i] = a[i] * b; + } + + // carry(14, 2) + long carry14 = carryValue(r[14]); + r[14] -= (carry14 << BITS_PER_LIMB); + r[15] += carry14; + + long carry15 = carryValue(r[15]); + r[15] -= (carry15 << BITS_PER_LIMB); + + // reduce(0, 1) + r[0] += carry15; + r[8] += carry15; + + // carry(0, 15) + carry(r, 0, 15); + } + + @Override + protected void square(long[] a, long[] r) { + + // Use grade-school multiplication with a simple squaring optimization. + // Multiply into primitives to avoid the temporary array allocation. + // This is equivalent to the following code: + // long[] c = new long[2 * NUM_LIMBS - 1]; + // for(int i = 0; i < NUM_LIMBS; i++) { + // c[2 * i] = a[i] * a[i]; + // for(int j = i + 1; j < NUM_LIMBS; j++) { + // c[i + j] += 2 * a[i] * a[j] + // } + // } + + long c0 = a[0] * a[0]; + long c1 = 2 * a[0] * a[1]; + long c2 = a[1] * a[1] + 2 * a[0] * a[2]; + long c3 = 2 * (a[0] * a[3] + a[1] * a[2]); + long c4 = a[2] * a[2] + 2 * (a[0] * a[4] + a[1] * a[3]); + long c5 = 2 * (a[0] * a[5] + a[1] * a[4] + a[2] * a[3]); + long c6 = a[3] * a[3] + 2 * (a[0] * a[6] + a[1] * a[5] + a[2] * a[4]); + long c7 = 2 * (a[0] * a[7] + a[1] * a[6] + a[2] * a[5] + a[3] * a[4]); + long c8 = a[4] * a[4] + 2 * (a[0] * a[8] + a[1] * a[7] + a[2] * a[6] + a[3] * a[5]); + long c9 = 2 * (a[0] * a[9] + a[1] * a[8] + a[2] * a[7] + a[3] * a[6] + a[4] * a[5]); + long c10 = a[5] * a[5] + 2 * (a[0] * a[10] + a[1] * a[9] + a[2] * a[8] + a[3] * a[7] + a[4] * a[6]); + long c11 = 2 * (a[0] * a[11] + a[1] * a[10] + a[2] * a[9] + a[3] * a[8] + a[4] * a[7] + a[5] * a[6]); + long c12 = a[6] * a[6] + 2 * (a[0] * a[12] + a[1] * a[11] + a[2] * a[10] + a[3] * a[9] + a[4] * a[8] + a[5] * a[7]); + long c13 = 2 * (a[0] * a[13] + a[1] * a[12] + a[2] * a[11] + a[3] * a[10] + a[4] * a[9] + a[5] * a[8] + a[6] * a[7]); + long c14 = a[7] * a[7] + 2 * (a[0] * a[14] + a[1] * a[13] + a[2] * a[12] + a[3] * a[11] + a[4] * a[10] + a[5] * a[9] + a[6] * a[8]); + long c15 = 2 * (a[0] * a[15] + a[1] * a[14] + a[2] * a[13] + a[3] * a[12] + a[4] * a[11] + a[5] * a[10] + a[6] * a[9] + a[7] * a[8]); + long c16 = a[8] * a[8] + 2 * (a[1] * a[15] + a[2] * a[14] + a[3] * a[13] + a[4] * a[12] + a[5] * a[11] + a[6] * a[10] + a[7] * a[9]); + long c17 = 2 * (a[2] * a[15] + a[3] * a[14] + a[4] * a[13] + a[5] * a[12] + a[6] * a[11] + a[7] * a[10] + a[8] * a[9]); + long c18 = a[9] * a[9] + 2 * (a[3] * a[15] + a[4] * a[14] + a[5] * a[13] + a[6] * a[12] + a[7] * a[11] + a[8] * a[10]); + long c19 = 2 * (a[4] * a[15] + a[5] * a[14] + a[6] * a[13] + a[7] * a[12] + a[8] * a[11] + a[9] * a[10]); + long c20 = a[10] * a[10] + 2 * (a[5] * a[15] + a[6] * a[14] + a[7] * a[13] + a[8] * a[12] + a[9] * a[11]); + long c21 = 2 * (a[6] * a[15] + a[7] * a[14] + a[8] * a[13] + a[9] * a[12] + a[10] * a[11]); + long c22 = a[11] * a[11] + 2 * (a[7] * a[15] + a[8] * a[14] + a[9] * a[13] + a[10] * a[12]); + long c23 = 2 * (a[8] * a[15] + a[9] * a[14] + a[10] * a[13] + a[11] * a[12]); + long c24 = a[12] * a[12] + 2 * (a[9] * a[15] + a[10] * a[14] + a[11] * a[13]); + long c25 = 2 * (a[10] * a[15] + a[11] * a[14] + a[12] * a[13]); + long c26 = a[13] * a[13] + 2 * (a[11] * a[15] + a[12] * a[14]); + long c27 = 2 * (a[12] * a[15] + a[13] * a[14]); + long c28 = a[14] * a[14] + 2 * a[13] * a[15]; + long c29 = 2 * a[14] * a[15]; + long c30 = a[15] * a[15]; + + carryReduce(r, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, + c26, c27, c28, c29, c30); + + } + + +} diff --git a/src/java.base/share/classes/sun/text/normalizer/ICUBinary.java b/src/java.base/share/classes/sun/text/normalizer/ICUBinary.java index 9ba029c5d41..b9650bd7cba 100644 --- a/src/java.base/share/classes/sun/text/normalizer/ICUBinary.java +++ b/src/java.base/share/classes/sun/text/normalizer/ICUBinary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -34,16 +34,11 @@ package sun.text.normalizer; import java.io.BufferedInputStream; import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; import java.io.InputStream; import java.io.IOException; import java.io.UncheckedIOException; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.nio.channels.FileChannel; -import java.nio.file.FileSystems; import java.util.Arrays; import java.security.AccessController; import java.security.PrivilegedAction; @@ -51,7 +46,7 @@ import java.security.PrivilegedAction; public final class ICUBinary { private static final class IsAcceptable implements Authenticate { - // @Override when we switch to Java 6 + @Override public boolean isDataVersionAcceptable(byte version[]) { return version[0] == 1; } @@ -93,7 +88,7 @@ public final class ICUBinary { BufferedInputStream b=new BufferedInputStream(is, 4096 /* data buffer size */); DataInputStream inputStream = new DataInputStream(b); - byte[] bb = new byte[120000]; + byte[] bb = new byte[130000]; int n = inputStream.read(bb); ByteBuffer bytes = ByteBuffer.wrap(bb, 0, n); return bytes; diff --git a/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java b/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java index 5f64fb2c8f3..407a1a2a1a9 100644 --- a/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java +++ b/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -194,7 +194,7 @@ final class Norm2AllModes { } @Override - public boolean hasBoundaryBefore(int c) { return impl.hasDecompBoundary(c, true); } + public boolean hasBoundaryBefore(int c) { return impl.hasDecompBoundaryBefore(c); } } public static final class ComposeNormalizer2 extends Normalizer2WithImpl { diff --git a/src/java.base/share/classes/sun/text/normalizer/Normalizer2.java b/src/java.base/share/classes/sun/text/normalizer/Normalizer2.java index f2f31d73d19..56e474976e6 100644 --- a/src/java.base/share/classes/sun/text/normalizer/Normalizer2.java +++ b/src/java.base/share/classes/sun/text/normalizer/Normalizer2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -135,8 +135,10 @@ abstract class Normalizer2 { if(spanLength==src.length()) { return (String)src; } - StringBuilder sb=new StringBuilder(src.length()).append(src, 0, spanLength); - return normalizeSecondAndAppend(sb, src.subSequence(spanLength, src.length())).toString(); + if (spanLength != 0) { + StringBuilder sb=new StringBuilder(src.length()).append(src, 0, spanLength); + return normalizeSecondAndAppend(sb, src.subSequence(spanLength, src.length())).toString(); + } } return normalize(src, new StringBuilder(src.length())).toString(); } diff --git a/src/java.base/share/classes/sun/text/normalizer/NormalizerImpl.java b/src/java.base/share/classes/sun/text/normalizer/NormalizerImpl.java index e00a7f9af5f..294f83a1e78 100644 --- a/src/java.base/share/classes/sun/text/normalizer/NormalizerImpl.java +++ b/src/java.base/share/classes/sun/text/normalizer/NormalizerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -29,7 +29,6 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* */ - package sun.text.normalizer; import java.io.IOException; @@ -38,7 +37,6 @@ import java.text.Normalizer; // Original filename in ICU4J: Normalizer2Impl.java public final class NormalizerImpl { - public static final class Hangul { /* Korean Hangul and Jamo constants */ public static final int JAMO_L_BASE=0x1100; /* "lead" jamo */ @@ -58,13 +56,12 @@ public final class NormalizerImpl { public static boolean isHangul(int c) { return HANGUL_BASE<=c && c>DELTA_SHIFT)-MAX_DELTA-1; // Read the normTrie. int offset=inIndexes[IX_NORM_TRIE_OFFSET]; @@ -407,7 +390,7 @@ public final class NormalizerImpl { normTrie=Trie2_16.createFromSerialized(bytes); int trieLength=normTrie.getSerializedLength(); if(trieLength>(nextOffset-offset)) { - throw new IOException("Normalizer2 data: not enough bytes for normTrie"); + throw new InternalError("Normalizer2 data: not enough bytes for normTrie"); } ICUBinary.skipBytes(bytes, (nextOffset-offset)-trieLength); // skip padding after trie bytes @@ -422,61 +405,47 @@ public final class NormalizerImpl { chars[i]=bytes.getChar(); } maybeYesCompositions=new String(chars); - extraData=maybeYesCompositions.substring(MIN_NORMAL_MAYBE_YES-minMaybeYes); + extraData=maybeYesCompositions.substring((MIN_NORMAL_MAYBE_YES-minMaybeYes)>>OFFSET_SHIFT); } // smallFCD: new in formatVersion 2 offset=nextOffset; smallFCD=new byte[0x100]; - for(int i=0; i<0x100; ++i) { - smallFCD[i]=bytes.get(); - } - - // Build tccc180[]. - // gennorm2 enforces lccc=0 for c>=1) { - if((c&0xff)==0) { - bits=smallFCD[c>>8]; // one byte per 0x100 code points - } - if((bits&1)!=0) { - for(int i=0; i<0x20; ++i, ++c) { - tccc180[c]=getFCD16FromNormData(c)&0xff; - } - } else { - c+=0x20; - } - } + bytes.get(smallFCD); return this; } catch(IOException e) { throw new InternalError(e); } } - public NormalizerImpl load(String name) { return load(ICUBinary.getRequiredData(name)); } - public int getNorm16(int c) { - return normTrie.get(c); - } + public int getNorm16(int c) { return normTrie.get(c); } + public boolean isAlgorithmicNoNo(int norm16) { return limitNoNo<=norm16 && norm16=MIN_NORMAL_MAYBE_YES) { - return norm16&0xff; + return getCCFromNormalYesOrMaybe(norm16); } if(norm16> OFFSET_SHIFT) & 0xff; + } public static int getCCFromYesOrMaybe(int norm16) { - return norm16>=MIN_NORMAL_MAYBE_YES ? norm16&0xff : 0; + return norm16>=MIN_NORMAL_MAYBE_YES ? getCCFromNormalYesOrMaybe(norm16) : 0; + } + public int getCCFromYesOrMaybeCP(int c) { + if (c < minCompNoMaybeCP) { return 0; } + return getCCFromYesOrMaybe(getNorm16(c)); } /** @@ -485,18 +454,13 @@ public final class NormalizerImpl { * @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0. */ public int getFCD16(int c) { - if(c<0) { + if(c=MIN_NORMAL_MAYBE_YES) { + int norm16=getNorm16(c); + if (norm16 >= limitNoNo) { + if(norm16>=MIN_NORMAL_MAYBE_YES) { // combining mark - norm16&=0xff; + norm16=getCCFromNormalYesOrMaybe(norm16); return norm16|(norm16<<8); } else if(norm16>=minMaybeYes) { return 0; - } else if(isDecompNoAlgorithmic(norm16)) { - c=mapAlgorithmic(c, norm16); - } else { - // c decomposes, get everything from the variable-length extra data - int firstUnit=extraData.charAt(norm16); - if((firstUnit&MAPPING_LENGTH_MASK)==0) { - // A character that is deleted (maps to an empty string) must - // get the worst-case lccc and tccc values because arbitrary - // characters on both sides will become adjacent. - return 0x1ff; - } else { - int fcd16=firstUnit>>8; // tccc - if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0) { - fcd16|=extraData.charAt(norm16-1)&0xff00; // lccc - } - return fcd16; + } else { // isDecompNoAlgorithmic(norm16) + int deltaTrailCC = norm16 & DELTA_TCCC_MASK; + if (deltaTrailCC <= DELTA_TCCC_1) { + return deltaTrailCC >> OFFSET_SHIFT; } + // Maps to an isCompYesAndZeroCC. + c=mapAlgorithmic(c, norm16); + norm16=getNorm16(c); } } + if(norm16<=minYesNo || isHangulLVT(norm16)) { + // no decomposition or Hangul syllable, all zeros + return 0; + } + // c decomposes, get everything from the variable-length extra data + int mapping=norm16>>OFFSET_SHIFT; + int firstUnit=extraData.charAt(mapping); + int fcd16=firstUnit>>8; // tccc + if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0) { + fcd16|=extraData.charAt(mapping-1)&0xff00; // lccc + } + return fcd16; } /** @@ -546,59 +509,92 @@ public final class NormalizerImpl { * @return c's decomposition, if it has one; returns null if it does not have a decomposition */ public String getDecomposition(int c) { - int decomp=-1; int norm16; - for(;;) { - if(c>OFFSET_SHIFT; + int length=extraData.charAt(mapping++)&MAPPING_LENGTH_MASK; + return extraData.substring(mapping, mapping+length); } - public static final int MIN_CCC_LCCC_CP=0x300; + // Fixed norm16 values. + public static final int MIN_YES_YES_WITH_CC=0xfe02; + public static final int JAMO_VT=0xfe00; + public static final int MIN_NORMAL_MAYBE_YES=0xfc00; + public static final int JAMO_L=2; // offset=1 hasCompBoundaryAfter=FALSE + public static final int INERT=1; // offset=0 hasCompBoundaryAfter=TRUE + + // norm16 bit 0 is comp-boundary-after. + public static final int HAS_COMP_BOUNDARY_AFTER=1; + public static final int OFFSET_SHIFT=1; + + // For algorithmic one-way mappings, norm16 bits 2..1 indicate the + // tccc (0, 1, >1) for quick FCC boundary-after tests. + public static final int DELTA_TCCC_0=0; + public static final int DELTA_TCCC_1=2; + public static final int DELTA_TCCC_GT_1=4; + public static final int DELTA_TCCC_MASK=6; + public static final int DELTA_SHIFT=3; - public static final int MIN_YES_YES_WITH_CC=0xff01; - public static final int JAMO_VT=0xff00; - public static final int MIN_NORMAL_MAYBE_YES=0xfe00; public static final int MAX_DELTA=0x40; // Byte offsets from the start of the data, after the generic header. public static final int IX_NORM_TRIE_OFFSET=0; public static final int IX_EXTRA_DATA_OFFSET=1; public static final int IX_SMALL_FCD_OFFSET=2; - + public static final int IX_RESERVED3_OFFSET=3; + public static final int IX_TOTAL_SIZE=7; + public static final int MIN_CCC_LCCC_CP=0x300; // Code point thresholds for quick check codes. public static final int IX_MIN_DECOMP_NO_CP=8; public static final int IX_MIN_COMP_NO_MAYBE_CP=9; // Norm16 value thresholds for quick check combinations and types of extra data. - // Mappings & compositions in [minYesNo..minYesNoMappingsOnly[. + + /** Mappings & compositions in [minYesNo..minYesNoMappingsOnly[. */ public static final int IX_MIN_YES_NO=10; + /** Mappings are comp-normalized. */ public static final int IX_MIN_NO_NO=11; public static final int IX_LIMIT_NO_NO=12; public static final int IX_MIN_MAYBE_YES=13; - // Mappings only in [minYesNoMappingsOnly..minNoNo[. + /** Mappings only in [minYesNoMappingsOnly..minNoNo[. */ public static final int IX_MIN_YES_NO_MAPPINGS_ONLY=14; + /** Mappings are not comp-normalized but have a comp boundary before. */ + public static final int IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE=15; + /** Mappings do not have a comp boundary before. */ + public static final int IX_MIN_NO_NO_COMP_NO_MAYBE_CC=16; + /** Mappings to the empty string. */ + public static final int IX_MIN_NO_NO_EMPTY=17; + + public static final int IX_MIN_LCCC_CP=18; + public static final int IX_COUNT=20; public static final int MAPPING_HAS_CCC_LCCC_WORD=0x80; + public static final int MAPPING_HAS_RAW_MAPPING=0x40; + // unused bit 0x20; public static final int MAPPING_LENGTH_MASK=0x1f; public static final int COMP_1_LAST_TUPLE=0x8000; @@ -702,7 +698,6 @@ public final class NormalizerImpl { } return src; } - public void decomposeAndAppend(CharSequence s, boolean doDecompose, ReorderingBuffer buffer) { int limit=s.length(); if(limit==0) { @@ -737,240 +732,238 @@ public final class NormalizerImpl { boolean onlyContiguous, boolean doCompose, ReorderingBuffer buffer) { + int prevBoundary=src; int minNoMaybeCP=minCompNoMaybeCP; - /* - * prevBoundary points to the last character before the current one - * that has a composition boundary before it with ccc==0 and quick check "yes". - * Keeping track of prevBoundary saves us looking for a composition boundary - * when we find a "no" or "maybe". - * - * When we back out from prevSrc back to prevBoundary, - * then we also remove those same characters (which had been simply copied - * or canonically-order-inserted) from the ReorderingBuffer. - * Therefore, at all times, the [prevBoundary..prevSrc[ source units - * must correspond 1:1 to destination units at the end of the destination buffer. - */ - int prevBoundary=src; - int prevSrc; - int c=0; - int norm16=0; - - // only for isNormalized - int prevCC=0; - - for(;;) { - // count code units below the minimum or with irrelevant data for the quick check - for(prevSrc=src; src!=limit;) { + for (;;) { + // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point, + // or with (compYes && ccc==0) properties. + int prevSrc; + int c = 0; + int norm16 = 0; + for (;;) { + if (src == limit) { + if (prevBoundary != limit && doCompose) { + buffer.append(s, prevBoundary, limit); + } + return true; + } if( (c=s.charAt(src))=minNoNo. + // The current character is either a "noNo" (has a mapping) + // or a "maybeYes" (combines backward) + // or a "yesYes" with ccc!=0. + // It is not a Hangul syllable or Jamo L because those have "yes" properties. - src+=Character.charCount(c); - /* - * isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo. - * c is either a "noNo" (has a mapping) or a "maybeYes" (combines backward) - * or has ccc!=0. - * Check for Jamo V/T, then for regular characters. - * c is not a Hangul syllable or Jamo L because those have "yes" properties. - */ - if(isJamoVT(norm16) && prevBoundary!=prevSrc) { + // Medium-fast path: Handle cases that do not require full decomposition and recomposition. + if (!isMaybeOrNonZeroCC(norm16)) { // minNoNo <= norm16 < minMaybeYes + if (!doCompose) { + return false; + } + // Fast path for mapping a character that is immediately surrounded by boundaries. + // In this case, we need not decompose around the current character. + if (isDecompNoAlgorithmic(norm16)) { + // Maps to a single isCompYesAndZeroCC character + // which also implies hasCompBoundaryBefore. + if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) || + hasCompBoundaryBefore(s, src, limit)) { + if (prevBoundary != prevSrc) { + buffer.append(s, prevBoundary, prevSrc); + } + buffer.append(mapAlgorithmic(c, norm16), 0); + prevBoundary = src; + continue; + } + } else if (norm16 < minNoNoCompBoundaryBefore) { + // The mapping is comp-normalized which also implies hasCompBoundaryBefore. + if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) || + hasCompBoundaryBefore(s, src, limit)) { + if (prevBoundary != prevSrc) { + buffer.append(s, prevBoundary, prevSrc); + } + int mapping = norm16 >> OFFSET_SHIFT; + int length = extraData.charAt(mapping++) & MAPPING_LENGTH_MASK; + buffer.append(extraData, mapping, mapping + length); + prevBoundary = src; + continue; + } + } else if (norm16 >= minNoNoEmpty) { + // The current character maps to nothing. + // Simply omit it from the output if there is a boundary before _or_ after it. + // The character itself implies no boundaries. + if (hasCompBoundaryBefore(s, src, limit) || + hasCompBoundaryAfter(s, prevBoundary, prevSrc, onlyContiguous)) { + if (prevBoundary != prevSrc) { + buffer.append(s, prevBoundary, prevSrc); + } + prevBoundary = src; + continue; + } + } + // Other "noNo" type, or need to examine more text around this character: + // Fall through to the slow path. + } else if (isJamoVT(norm16) && prevBoundary != prevSrc) { char prev=s.charAt(prevSrc-1); - boolean needToDecompose=false; if(c= 0) { + int syllable = Hangul.HANGUL_BASE + + (l*Hangul.JAMO_V_COUNT + (c-Hangul.JAMO_V_BASE)) * + Hangul.JAMO_T_COUNT + t; + --prevSrc; // Replace the Jamo L as well. + if (prevBoundary != prevSrc) { + buffer.append(s, prevBoundary, prevSrc); + } + buffer.append((char)syllable); + prevBoundary = src; continue; } // If we see L+V+x where x!=T then we drop to the slow path, // decompose and recompose. // This is to deal with NFKC finding normal L and V but a - // compatibility variant of a T. We need to either fully compose that - // combination here (which would complicate the code and may not work - // with strange custom data) or use the slow path -- or else our replacing - // two input characters (L+V) with one output character (LV syllable) - // would violate the invariant that [prevBoundary..prevSrc[ has the same - // length as what we appended to the buffer since prevBoundary. - needToDecompose=true; + // compatibility variant of a T. + // We need to either fully compose that combination here + // (which would complicate the code and may not work with strange custom data) + // or use the slow path. } - } else if(Hangul.isHangulWithoutJamoT(prev)) { - // c is a Jamo Trailing consonant, + } else if (Hangul.isHangulLV(prev)) { + // The current character is a Jamo Trailing consonant, // compose with previous Hangul LV that does not contain a Jamo T. - if(!doCompose) { + if (!doCompose) { return false; } - buffer.setLastChar((char)(prev+c-Hangul.JAMO_T_BASE)); - prevBoundary=src; - continue; - } - if(!needToDecompose) { - // The Jamo V/T did not compose into a Hangul syllable. - if(doCompose) { - buffer.append((char)c); - } else { - prevCC=0; + int syllable = prev + c - Hangul.JAMO_T_BASE; + --prevSrc; // Replace the Hangul LV as well. + if (prevBoundary != prevSrc) { + buffer.append(s, prevBoundary, prevSrc); } + buffer.append((char)syllable); + prevBoundary = src; continue; } - } - /* - * Source buffer pointers: - * - * all done quick check current char not yet - * "yes" but (c) processed - * may combine - * forward - * [-------------[-------------[-------------[-------------[ - * | | | | | - * orig. src prevBoundary prevSrc src limit - * - * - * Destination buffer pointers inside the ReorderingBuffer: - * - * all done might take not filled yet - * characters for - * reordering - * [-------------[-------------[-------------[ - * | | | | - * start reorderStart limit | - * +remainingCap.+ - */ - if(norm16>=MIN_YES_YES_WITH_CC) { - int cc=norm16&0xff; // cc!=0 - if( onlyContiguous && // FCC - (doCompose ? buffer.getLastCC() : prevCC)==0 && - prevBoundarycc - ) { + // No matching context, or may need to decompose surrounding text first: + // Fall through to the slow path. + } else if (norm16 > JAMO_VT) { // norm16 >= MIN_YES_YES_WITH_CC + // One or more combining marks that do not combine-back: + // Check for canonical order, copy unchanged if ok and + // if followed by a character with a boundary-before. + int cc = getCCFromNormalYesOrMaybe(norm16); // cc!=0 + if (onlyContiguous /* FCC */ && getPreviousTrailCC(s, prevBoundary, prevSrc) > cc) { // Fails FCD test, need to decompose and contiguously recompose. - if(!doCompose) { + if (!doCompose) { return false; } - } else if(doCompose) { - buffer.append(c, cc); - continue; - } else if(prevCC<=cc) { - prevCC=cc; - continue; } else { - return false; + // If !onlyContiguous (not FCC), then we ignore the tccc of + // the previous character which passed the quick check "yes && ccc==0" test. + int n16; + for (;;) { + if (src == limit) { + if (doCompose) { + buffer.append(s, prevBoundary, limit); + } + return true; + } + int prevCC = cc; + c = Character.codePointAt(s, src); + n16 = normTrie.get(c); + if (n16 >= MIN_YES_YES_WITH_CC) { + cc = getCCFromNormalYesOrMaybe(n16); + if (prevCC > cc) { + if (!doCompose) { + return false; + } + break; + } + } else { + break; + } + src += Character.charCount(c); + } + // p is after the last in-order combining mark. + // If there is a boundary here, then we continue with no change. + if (norm16HasCompBoundaryBefore(n16)) { + if (isCompYesAndZeroCC(n16)) { + src += Character.charCount(c); + } + continue; + } + // Use the slow path. There is no boundary in [prevSrc, src[. } - } else if(!doCompose && !isMaybeOrNonZeroCC(norm16)) { - return false; } - /* - * Find appropriate boundaries around this character, - * decompose the source text from between the boundaries, - * and recompose it. - * - * We may need to remove the last few characters from the ReorderingBuffer - * to account for source text that was copied or appended - * but needs to take part in the recomposition. - */ - - /* - * Find the last composition boundary in [prevBoundary..src[. - * It is either the decomposition of the current character (at prevSrc), - * or prevBoundary. - */ - if(hasCompBoundaryBefore(c, norm16)) { - prevBoundary=prevSrc; - } else if(doCompose) { - buffer.removeSuffix(prevSrc-prevBoundary); + // Slow path: Find the nearest boundaries around the current character, + // decompose and recompose. + if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) { + c = Character.codePointBefore(s, prevSrc); + norm16 = normTrie.get(c); + if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) { + prevSrc -= Character.charCount(c); + } + } + if (doCompose && prevBoundary != prevSrc) { + buffer.append(s, prevBoundary, prevSrc); } - - // Find the next composition boundary in [src..limit[ - - // modifies src to point to the next starter. - src=findNextCompBoundary(s, src, limit); - - // Decompose [prevBoundary..src[ into the buffer and then recompose that part of it. int recomposeStartIndex=buffer.length(); - decomposeShort(s, prevBoundary, src, buffer); + // We know there is not a boundary here. + decomposeShort(s, prevSrc, src, false /* !stopAtCompBoundary */, onlyContiguous, + buffer); + // Decompose until the next boundary. + src = decomposeShort(s, src, limit, true /* stopAtCompBoundary */, onlyContiguous, + buffer); recompose(buffer, recomposeStartIndex, onlyContiguous); if(!doCompose) { - if(!buffer.equals(s, prevBoundary, src)) { + if(!buffer.equals(s, prevSrc, src)) { return false; } buffer.remove(); - prevCC=0; } - - // Move to the next starter. We never need to look back before this point again. prevBoundary=src; } - return true; } /** @@ -984,21 +977,16 @@ public final class NormalizerImpl { public int composeQuickCheck(CharSequence s, int src, int limit, boolean onlyContiguous, boolean doSpan) { int qcResult=0; + int prevBoundary=src; int minNoMaybeCP=minCompNoMaybeCP; - /* - * prevBoundary points to the last character before the current one - * that has a composition boundary before it with ccc==0 and quick check "yes". - */ - int prevBoundary=src; - int prevSrc; - int c=0; - int norm16=0; - int prevCC=0; - for(;;) { - // count code units below the minimum or with irrelevant data for the quick check - for(prevSrc=src;;) { + // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point, + // or with (compYes && ccc==0) properties. + int prevSrc; + int c = 0; + int norm16 = 0; + for (;;) { if(src==limit) { return (src<<1)|qcResult; // "yes" or "maybe" } @@ -1006,88 +994,103 @@ public final class NormalizerImpl { isCompYesAndZeroCC(norm16=normTrie.getFromU16SingleLead((char)c)) ) { ++src; - } else if(!UTF16.isSurrogate((char)c)) { - break; } else { - char c2; - if(UTF16Plus.isSurrogateLead(c)) { - if((src+1)!=limit && Character.isLowSurrogate(c2=s.charAt(src+1))) { - c=Character.toCodePoint((char)c, c2); - } - } else /* trail surrogate */ { - if(prevSrc=minNoNo. + // The current character is either a "noNo" (has a mapping) + // or a "maybeYes" (combines backward) + // or a "yesYes" with ccc!=0. + // It is not a Hangul syllable or Jamo L because those have "yes" properties. + + int prevNorm16 = INERT; + if (prevBoundary != prevSrc) { + prevBoundary = prevSrc; + if (!norm16HasCompBoundaryBefore(norm16)) { + c = Character.codePointBefore(s, prevSrc); + int n16 = getNorm16(c); + if (!norm16HasCompBoundaryAfter(n16, onlyContiguous)) { + prevBoundary -= Character.charCount(c); + prevNorm16 = n16; + } } - prevCC=0; - // The start of the current character (c). - prevSrc=src; } - src+=Character.charCount(c); - /* - * isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo. - * c is either a "noNo" (has a mapping) or a "maybeYes" (combines backward) - * or has ccc!=0. - */ if(isMaybeOrNonZeroCC(norm16)) { int cc=getCCFromYesOrMaybe(norm16); - if( onlyContiguous && // FCC - cc!=0 && - prevCC==0 && - prevBoundarycc - ) { - // Fails FCD test. - } else if(prevCC<=cc || cc==0) { - prevCC=cc; - if(norm16 cc) { + // The [prevBoundary..prevSrc[ character + // passed the quick check "yes && ccc==0" test + // but is out of canonical order with the current combining mark. + } else { + // If !onlyContiguous (not FCC), then we ignore the tccc of + // the previous character which passed the quick check "yes && ccc==0" test. + for (;;) { + if (norm16 < MIN_YES_YES_WITH_CC) { + if (!doSpan) { + qcResult = 1; + } else { + return prevBoundary << 1; // spanYes does not care to know it's "maybe" + } } + if (src == limit) { + return (src<<1) | qcResult; // "yes" or "maybe" + } + int prevCC = cc; + c = Character.codePointAt(s, src); + norm16 = getNorm16(c); + if (isMaybeOrNonZeroCC(norm16)) { + cc = getCCFromYesOrMaybe(norm16); + if (!(prevCC <= cc || cc == 0)) { + break; + } + } else { + break; + } + src += Character.charCount(c); + } + // src is after the last in-order combining mark. + if (isCompYesAndZeroCC(norm16)) { + prevBoundary = src; + src += Character.charCount(c); + continue; } - continue; } } return prevBoundary<<1; // "no" } } - public void composeAndAppend(CharSequence s, boolean doCompose, boolean onlyContiguous, ReorderingBuffer buffer) { int src=0, limit=s.length(); if(!buffer.isEmpty()) { - int firstStarterInSrc=findNextCompBoundary(s, 0, limit); + int firstStarterInSrc=findNextCompBoundary(s, 0, limit, onlyContiguous); if(0!=firstStarterInSrc) { int lastStarterInDest=findPreviousCompBoundary(buffer.getStringBuilder(), - buffer.length()); + buffer.length(), onlyContiguous); StringBuilder middle=new StringBuilder((buffer.length()-lastStarterInDest)+ firstStarterInSrc+16); middle.append(buffer.getStringBuilder(), lastStarterInDest, buffer.length()); @@ -1103,7 +1106,6 @@ public final class NormalizerImpl { buffer.append(s, src, limit); } } - // Dual functionality: // buffer!=NULL: normalize // buffer==NULL: isNormalized/quickCheck/spanQuickCheckYes @@ -1125,7 +1127,7 @@ public final class NormalizerImpl { for(;;) { // count code units with lccc==0 for(prevSrc=src; src!=limit;) { - if((c=s.charAt(src))1) { - --prevBoundary; + if(prev1) { + --prevBoundary; + } } } else { int p=src-1; @@ -1228,7 +1234,7 @@ public final class NormalizerImpl { * The source text does not fulfill the conditions for FCD. * Decompose and reorder a limited piece of the text. */ - decomposeShort(s, prevBoundary, src, buffer); + decomposeShort(s, prevBoundary, src, false, false, buffer); prevBoundary=src; prevFCD16=0; } @@ -1236,54 +1242,77 @@ public final class NormalizerImpl { return src; } - // Note: hasDecompBoundary() could be implemented as aliases to - // hasFCDBoundaryBefore() and hasFCDBoundaryAfter() - // at the cost of building the FCD trie for a decomposition normalizer. - public boolean hasDecompBoundary(int c, boolean before) { - for(;;) { - if(cMIN_NORMAL_MAYBE_YES) { - return false; // ccc!=0 - } else if(isDecompNoAlgorithmic(norm16)) { - c=mapAlgorithmic(c, norm16); - } else { - // c decomposes, get everything from the variable-length extra data - int firstUnit=extraData.charAt(norm16); - if((firstUnit&MAPPING_LENGTH_MASK)==0) { - return false; - } - if(!before) { - // decomp after-boundary: same as hasFCDBoundaryAfter(), - // fcd16<=1 || trailCC==0 - if(firstUnit>0x1ff) { - return false; // trailCC>1 - } - if(firstUnit<=0xff) { - return true; // trailCC==0 - } - // if(trailCC==1) test leadCC==0, same as checking for before-boundary - } - // true if leadCC==0 (hasFCDBoundaryBefore()) - return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (extraData.charAt(norm16-1)&0xff00)==0; - } - } + public boolean hasDecompBoundaryBefore(int c) { + return c < minLcccCP || (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) || + norm16HasDecompBoundaryBefore(getNorm16(c)); } + public boolean norm16HasDecompBoundaryBefore(int norm16) { + if (norm16 < minNoNoCompNoMaybeCC) { + return true; + } + if (norm16 >= limitNoNo) { + return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT; + } + // c decomposes, get everything from the variable-length extra data + int mapping=norm16>>OFFSET_SHIFT; + int firstUnit=extraData.charAt(mapping); + // true if leadCC==0 (hasFCDBoundaryBefore()) + return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (extraData.charAt(mapping-1)&0xff00)==0; + } + public boolean hasDecompBoundaryAfter(int c) { + if (c < minDecompNoCP) { + return true; + } + if (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) { + return true; + } + return norm16HasDecompBoundaryAfter(getNorm16(c)); + } + public boolean norm16HasDecompBoundaryAfter(int norm16) { + if(norm16 <= minYesNo || isHangulLVT(norm16)) { + return true; + } + if (norm16 >= limitNoNo) { + if (isMaybeOrNonZeroCC(norm16)) { + return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT; + } + // Maps to an isCompYesAndZeroCC. + return (norm16 & DELTA_TCCC_MASK) <= DELTA_TCCC_1; + } + // c decomposes, get everything from the variable-length extra data + int mapping=norm16>>OFFSET_SHIFT; + int firstUnit=extraData.charAt(mapping); + // decomp after-boundary: same as hasFCDBoundaryAfter(), + // fcd16<=1 || trailCC==0 + if(firstUnit>0x1ff) { + return false; // trailCC>1 + } + if(firstUnit<=0xff) { + return true; // trailCC==0 + } + // if(trailCC==1) test leadCC==0, same as checking for before-boundary + // true if leadCC==0 (hasFCDBoundaryBefore()) + return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (extraData.charAt(mapping-1)&0xff00)==0; + } + public boolean isDecompInert(int c) { return isDecompYesAndZeroCC(getNorm16(c)); } public boolean hasCompBoundaryBefore(int c) { - return c=minMaybeYes; } + private static boolean isInert(int norm16) { return norm16==INERT; } private static boolean isJamoVT(int norm16) { return norm16==JAMO_VT; } - private boolean isHangul(int norm16) { return norm16==minYesNo; } + private int hangulLVT() { return minYesNoMappingsOnly|HAS_COMP_BOUNDARY_AFTER; } + private boolean isHangulLV(int norm16) { return norm16==minYesNo; } + private boolean isHangulLVT(int norm16) { + return norm16==hangulLVT(); + } private boolean isCompYesAndZeroCC(int norm16) { return norm16=MIN_YES_YES_WITH_CC || norm16=limitNoNo; } // For use with isCompYes(). // Perhaps the compiler can combine the two tests for MIN_YES_YES_WITH_CC. // static uint8_t getCCFromYes(uint16_t norm16) { - // return norm16>=MIN_YES_YES_WITH_CC ? (uint8_t)norm16 : 0; + // return norm16>=MIN_YES_YES_WITH_CC ? getCCFromNormalYesOrMaybe(norm16) : 0; // } private int getCCFromNoNo(int norm16) { - if((extraData.charAt(norm16)&MAPPING_HAS_CCC_LCCC_WORD)!=0) { - return extraData.charAt(norm16-1)&0xff; + int mapping=norm16>>OFFSET_SHIFT; + if((extraData.charAt(mapping)&MAPPING_HAS_CCC_LCCC_WORD)!=0) { + return extraData.charAt(mapping-1)&0xff; } else { return 0; } } - - // requires that the [cpStart..cpLimit[ character passes isCompYesAndZeroCC() - int getTrailCCFromCompYesAndZeroCC(CharSequence s, int cpStart, int cpLimit) { - int c; - if(cpStart==(cpLimit-1)) { - c=s.charAt(cpStart); + int getTrailCCFromCompYesAndZeroCC(int norm16) { + if(norm16<=minYesNo) { + return 0; // yesYes and Hangul LV have ccc=tccc=0 } else { - c=Character.codePointAt(s, cpStart); - } - int prevNorm16=getNorm16(c); - if(prevNorm16<=minYesNo) { - return 0; // yesYes and Hangul LV/LVT have ccc=tccc=0 - } else { - return extraData.charAt(prevNorm16)>>8; // tccc from yesNo + // For Hangul LVT we harmlessly fetch a firstUnit with tccc=0 here. + return extraData.charAt(norm16>>OFFSET_SHIFT)>>8; // tccc from yesNo } } // Requires algorithmic-NoNo. private int mapAlgorithmic(int c, int norm16) { - return c+norm16-(minMaybeYes-MAX_DELTA-1); + return c+(norm16>>DELTA_SHIFT)-centerNoNoDelta; } // Requires minYesNo>OFFSET_SHIFT); } /** * @return index into maybeYesCompositions, or -1 */ private int getCompositionsListForDecompYes(int norm16) { - if(norm16==0 || MIN_NORMAL_MAYBE_YES<=norm16) { + if(norm16>OFFSET_SHIFT; } } - /** * @return index into maybeYesCompositions */ private int getCompositionsListForComposite(int norm16) { - // composite has both mapping & compositions list - int firstUnit=extraData.charAt(norm16); - return (MIN_NORMAL_MAYBE_YES-minMaybeYes)+norm16+ // mapping in maybeYesCompositions - 1+ // +1 to skip the first unit with the mapping lenth + // A composite has both mapping & compositions list. + int list=((MIN_NORMAL_MAYBE_YES-minMaybeYes)+norm16)>>OFFSET_SHIFT; + int firstUnit=maybeYesCompositions.charAt(list); + return list+ // mapping in maybeYesCompositions + 1+ // +1 to skip the first unit with the mapping length (firstUnit&MAPPING_LENGTH_MASK); // + mapping length } @@ -1380,45 +1400,58 @@ public final class NormalizerImpl { // is unlikely to be amortized. // Called by the compose() and makeFCD() implementations. // Public in Java for collation implementation code. - public void decomposeShort(CharSequence s, int src, int limit, - ReorderingBuffer buffer) { + private int decomposeShort( + CharSequence s, int src, int limit, + boolean stopAtCompBoundary, boolean onlyContiguous, + ReorderingBuffer buffer) { while(src>8; - if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0) { - leadCC=extraData.charAt(norm16-1)>>8; - } else { - leadCC=0; - } - ++norm16; // skip over the firstUnit - buffer.append(extraData, norm16, norm16+length, leadCC, trailCC); + if (stopAtCompBoundary && c < minCompNoMaybeCP) { + return src; } - return; + int norm16 = getNorm16(c); + if (stopAtCompBoundary && norm16HasCompBoundaryBefore(norm16)) { + return src; + } + src+=Character.charCount(c); + decompose(c, norm16, buffer); + if (stopAtCompBoundary && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) { + return src; + } + } + return src; + } + private void decompose(int c, int norm16, ReorderingBuffer buffer) { + // get the decomposition and the lead and trail cc's + if (norm16 >= limitNoNo) { + if (isMaybeOrNonZeroCC(norm16)) { + buffer.append(c, getCCFromYesOrMaybe(norm16)); + return; + } + // Maps to an isCompYesAndZeroCC. + c=mapAlgorithmic(c, norm16); + norm16=getNorm16(c); + } + if (norm16 < minYesNo) { + // c does not decompose + buffer.append(c, 0); + } else if(isHangulLV(norm16) || isHangulLVT(norm16)) { + // Hangul syllable: decompose algorithmically + Hangul.decompose(c, buffer); + } else { + // c decomposes, get everything from the variable-length extra data + int mapping=norm16>>OFFSET_SHIFT; + int firstUnit=extraData.charAt(mapping); + int length=firstUnit&MAPPING_LENGTH_MASK; + int leadCC, trailCC; + trailCC=firstUnit>>8; + if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0) { + leadCC=extraData.charAt(mapping-1)>>8; + } else { + leadCC=0; + } + ++mapping; // skip over the firstUnit + buffer.append(extraData, mapping, mapping+length, leadCC, trailCC); } } @@ -1457,7 +1490,7 @@ public final class NormalizerImpl { } if(key1==(firstUnit&COMP_1_TRAIL_MASK)) { if((firstUnit&COMP_1_TRIPLE)!=0) { - return ((int)compositions.charAt(list+1)<<16)|compositions.charAt(list+2); + return (compositions.charAt(list+1)<<16)|compositions.charAt(list+2); } else { return compositions.charAt(list+1); } @@ -1533,7 +1566,8 @@ public final class NormalizerImpl { // we have seen a starter that combines forward and compositionsList>=0 && // the backward-combining character is not blocked - (prevCC> OFFSET_SHIFT) <= 0x1ff); } - private int findPreviousCompBoundary(CharSequence s, int p) { + private int findPreviousCompBoundary(CharSequence s, int p, boolean onlyContiguous) { while(p>0) { int c=Character.codePointBefore(s, p); - p-=Character.charCount(c); - if(hasCompBoundaryBefore(c)) { + int norm16 = getNorm16(c); + if (norm16HasCompBoundaryAfter(norm16, onlyContiguous)) { + break; + } + p-=Character.charCount(c); + if(hasCompBoundaryBefore(c, norm16)) { break; } - // We could also test hasCompBoundaryAfter() and return iter.codePointLimit, - // but that's probably not worth the extra cost. } return p; } - - private int findNextCompBoundary(CharSequence s, int p, int limit) { + private int findNextCompBoundary(CharSequence s, int p, int limit, boolean onlyContiguous) { while(p ATTRS = new HashMap<>(1); + ATTRS.put("ImplementedIn", "Software"); + + /* XDH does not require native implementation */ + putService(new ProviderService(this, "KeyFactory", + "XDH", "sun.security.ec.XDHKeyFactory", null, ATTRS)); + putService(new ProviderService(this, "KeyFactory", + "X25519", "sun.security.ec.XDHKeyFactory.X25519", + new String[]{"1.3.101.110", "OID.1.3.101.110"}, ATTRS)); + putService(new ProviderService(this, "KeyFactory", + "X448", "sun.security.ec.XDHKeyFactory.X448", + new String[]{"1.3.101.111", "OID.1.3.101.111"}, ATTRS)); + + putService(new ProviderService(this, "KeyPairGenerator", + "XDH", "sun.security.ec.XDHKeyPairGenerator", null, ATTRS)); + putService(new ProviderService(this, "KeyPairGenerator", + "X25519", "sun.security.ec.XDHKeyPairGenerator.X25519", + new String[]{"1.3.101.110", "OID.1.3.101.110"}, ATTRS)); + putService(new ProviderService(this, "KeyPairGenerator", + "X448", "sun.security.ec.XDHKeyPairGenerator.X448", + new String[]{"1.3.101.111", "OID.1.3.101.111"}, ATTRS)); + + putService(new ProviderService(this, "KeyAgreement", + "XDH", "sun.security.ec.XDHKeyAgreement", null, ATTRS)); + putService(new ProviderService(this, "KeyAgreement", + "X25519", "sun.security.ec.XDHKeyAgreement.X25519", + new String[]{"1.3.101.110", "OID.1.3.101.110"}, ATTRS)); + putService(new ProviderService(this, "KeyAgreement", + "X448", "sun.security.ec.XDHKeyAgreement.X448", + new String[]{"1.3.101.111", "OID.1.3.101.111"}, ATTRS)); + + } } diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java new file mode 100644 index 00000000000..43da079e961 --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java @@ -0,0 +1,216 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Key; +import java.security.SecureRandom; +import java.security.ProviderException; +import java.security.interfaces.XECPrivateKey; +import java.security.interfaces.XECPublicKey; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; +import javax.crypto.KeyAgreementSpi; +import javax.crypto.SecretKey; +import javax.crypto.ShortBufferException; +import java.util.function.Function; + +public class XDHKeyAgreement extends KeyAgreementSpi { + + private byte[] privateKey; + private byte[] secret; + private XECOperations ops; + private XECParameters lockedParams = null; + + XDHKeyAgreement() { + // do nothing + } + + XDHKeyAgreement(AlgorithmParameterSpec paramSpec) { + lockedParams = XECParameters.get(ProviderException::new, paramSpec); + } + + @Override + protected void engineInit(Key key, SecureRandom random) + throws InvalidKeyException { + + initImpl(key); + } + + @Override + protected void engineInit(Key key, final AlgorithmParameterSpec params, + SecureRandom random) throws InvalidKeyException, + InvalidAlgorithmParameterException { + + initImpl(key); + + // the private key parameters must match params + XECParameters xecParams = XECParameters.get( + InvalidAlgorithmParameterException::new, params); + if (!xecParams.oidEquals(this.ops.getParameters())) { + throw new InvalidKeyException( + "Incorrect private key parameters" + ); + } + } + + private + + void checkLockedParams(Function exception, + XECParameters params) throws T { + + if (lockedParams != null && lockedParams != params) { + throw exception.apply("Parameters must be " + + lockedParams.getName()); + } + } + + private void initImpl(Key key) throws InvalidKeyException { + + if (!(key instanceof XECPrivateKey)) { + throw new InvalidKeyException + ("Unsupported key type"); + } + XECPrivateKey privateKey = (XECPrivateKey) key; + XECParameters xecParams = XECParameters.get( + InvalidKeyException::new, privateKey.getParams()); + checkLockedParams(InvalidKeyException::new, xecParams); + + this.ops = new XECOperations(xecParams); + this.privateKey = privateKey.getScalar().orElseThrow( + () -> new InvalidKeyException("No private key value") + ); + secret = null; + } + + @Override + protected Key engineDoPhase(Key key, boolean lastPhase) + throws InvalidKeyException, IllegalStateException { + + if (this.privateKey == null) { + throw new IllegalStateException("Not initialized"); + } + if (this.secret != null) { + throw new IllegalStateException("Phase already executed"); + } + if (!lastPhase) { + throw new IllegalStateException + ("Only two party agreement supported, lastPhase must be true"); + } + if (!(key instanceof XECPublicKey)) { + throw new InvalidKeyException + ("Unsupported key type"); + } + + XECPublicKey publicKey = (XECPublicKey) key; + + // Ensure public key parameters are compatible with private key + XECParameters xecParams = XECParameters.get(InvalidKeyException::new, + publicKey.getParams()); + if (!ops.getParameters().oidEquals(xecParams)) { + throw new InvalidKeyException( + "Public key parameters are not compatible with private key."); + } + + // The privateKey may be modified to a value that is equivalent for + // the purposes of this algorithm. + byte[] computedSecret = ops.encodedPointMultiply( + this.privateKey, + publicKey.getU()); + + // test for contributory behavior + if (allZero(computedSecret)) { + throw new InvalidKeyException("Point has small order"); + } + + this.secret = computedSecret; + + return null; + } + + /* + * Constant-time check for an all-zero array + */ + private boolean allZero(byte[] arr) { + byte orValue = (byte) 0; + for (int i = 0; i < arr.length; i++) { + orValue |= arr[i]; + } + + return orValue == (byte) 0; + } + + @Override + protected byte[] engineGenerateSecret() throws IllegalStateException { + if (secret == null) { + throw new IllegalStateException("Not initialized correctly"); + } + + return secret.clone(); + } + + @Override + protected int engineGenerateSecret(byte[] sharedSecret, int offset) + throws IllegalStateException, ShortBufferException { + + if (secret == null) { + throw new IllegalStateException("Not initialized correctly"); + } + int secretLen = this.secret.length; + if (offset + secretLen > sharedSecret.length) { + throw new ShortBufferException("Need " + secretLen + + " bytes, only " + (sharedSecret.length - offset) + + " available"); + } + + System.arraycopy(this.secret, 0, sharedSecret, offset, secretLen); + return secret.length; + } + + @Override + protected SecretKey engineGenerateSecret(String algorithm) + throws IllegalStateException, NoSuchAlgorithmException, + InvalidKeyException { + + throw new NoSuchAlgorithmException("Not supported"); + } + + static class X25519 extends XDHKeyAgreement { + + public X25519() { + super(NamedParameterSpec.X25519); + } + } + + static class X448 extends XDHKeyAgreement { + + public X448() { + super(NamedParameterSpec.X448); + } + } +} diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyFactory.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyFactory.java new file mode 100644 index 00000000000..e327b9b46f0 --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyFactory.java @@ -0,0 +1,243 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import java.security.KeyFactorySpi; +import java.security.Key; +import java.security.PublicKey; +import java.security.PrivateKey; +import java.security.InvalidKeyException; +import java.security.ProviderException; +import java.security.interfaces.XECKey; +import java.security.interfaces.XECPrivateKey; +import java.security.interfaces.XECPublicKey; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; +import java.security.spec.KeySpec; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.security.spec.XECPublicKeySpec; +import java.security.spec.XECPrivateKeySpec; +import java.util.function.Function; + +public class XDHKeyFactory extends KeyFactorySpi { + + private XECParameters lockedParams = null; + + XDHKeyFactory() { + // do nothing + } + + protected XDHKeyFactory(AlgorithmParameterSpec paramSpec) { + lockedParams = XECParameters.get(ProviderException::new, paramSpec); + } + + @Override + protected Key engineTranslateKey(Key key) throws InvalidKeyException { + + if (key == null) { + throw new InvalidKeyException("Key must not be null"); + } + + if (key instanceof XECKey) { + XECKey xecKey = (XECKey) key; + XECParameters params = XECParameters.get(InvalidKeyException::new, + xecKey.getParams()); + checkLockedParams(InvalidKeyException::new, params); + + if (xecKey instanceof XECPublicKey) { + XECPublicKey publicKey = (XECPublicKey) xecKey; + return new XDHPublicKeyImpl(params, publicKey.getU()); + } else if (xecKey instanceof XECPrivateKey) { + XECPrivateKey privateKey = (XECPrivateKey) xecKey; + byte[] scalar = privateKey.getScalar().orElseThrow( + () -> new InvalidKeyException("No private key data")); + return new XDHPrivateKeyImpl(params, scalar); + } else { + throw new InvalidKeyException("Unsupported XECKey subclass"); + } + } else if (key instanceof PublicKey && + key.getFormat().equals("X.509")) { + XDHPublicKeyImpl result = new XDHPublicKeyImpl(key.getEncoded()); + checkLockedParams(InvalidKeyException::new, result.getParams()); + return result; + } else if (key instanceof PrivateKey && + key.getFormat().equals("PKCS#8")) { + XDHPrivateKeyImpl result = new XDHPrivateKeyImpl(key.getEncoded()); + checkLockedParams(InvalidKeyException::new, result.getParams()); + return result; + } else { + throw new InvalidKeyException("Unsupported key type or format"); + } + } + + private + + void checkLockedParams(Function exception, + AlgorithmParameterSpec spec) throws T { + + XECParameters params = XECParameters.get(exception, spec); + checkLockedParams(exception, params); + } + + private + + void checkLockedParams(Function exception, + XECParameters params) throws T { + + if (lockedParams != null && lockedParams != params) { + throw exception.apply("Parameters must be " + + lockedParams.getName()); + } + } + + @Override + protected PublicKey engineGeneratePublic(KeySpec keySpec) + throws InvalidKeySpecException { + + try { + return generatePublicImpl(keySpec); + } catch (InvalidKeyException ex) { + throw new InvalidKeySpecException(ex); + } + } + + @Override + protected PrivateKey engineGeneratePrivate(KeySpec keySpec) + throws InvalidKeySpecException { + + try { + return generatePrivateImpl(keySpec); + } catch (InvalidKeyException ex) { + throw new InvalidKeySpecException(ex); + } + } + + + private PublicKey generatePublicImpl(KeySpec keySpec) + throws InvalidKeyException, InvalidKeySpecException { + + if (keySpec instanceof X509EncodedKeySpec) { + X509EncodedKeySpec x509Spec = (X509EncodedKeySpec) keySpec; + XDHPublicKeyImpl result = + new XDHPublicKeyImpl(x509Spec.getEncoded()); + checkLockedParams(InvalidKeySpecException::new, + result.getParams()); + return result; + } else if (keySpec instanceof XECPublicKeySpec) { + XECPublicKeySpec publicKeySpec = (XECPublicKeySpec) keySpec; + XECParameters params = XECParameters.get( + InvalidKeySpecException::new, publicKeySpec.getParams()); + checkLockedParams(InvalidKeySpecException::new, params); + return new XDHPublicKeyImpl(params, publicKeySpec.getU()); + } else { + throw new InvalidKeySpecException( + "Only X509EncodedKeySpec and XECPublicKeySpec are supported"); + } + } + + private PrivateKey generatePrivateImpl(KeySpec keySpec) + throws InvalidKeyException, InvalidKeySpecException { + + if (keySpec instanceof PKCS8EncodedKeySpec) { + PKCS8EncodedKeySpec pkcsSpec = (PKCS8EncodedKeySpec) keySpec; + XDHPrivateKeyImpl result = + new XDHPrivateKeyImpl(pkcsSpec.getEncoded()); + checkLockedParams(InvalidKeySpecException::new, + result.getParams()); + return result; + } else if (keySpec instanceof XECPrivateKeySpec) { + XECPrivateKeySpec privateKeySpec = (XECPrivateKeySpec) keySpec; + XECParameters params = XECParameters.get( + InvalidKeySpecException::new, privateKeySpec.getParams()); + checkLockedParams(InvalidKeySpecException::new, params); + return new XDHPrivateKeyImpl(params, privateKeySpec.getScalar()); + } else { + throw new InvalidKeySpecException( + "Only PKCS8EncodedKeySpec and XECPrivateKeySpec supported"); + } + } + + protected T engineGetKeySpec(Key key, Class keySpec) + throws InvalidKeySpecException { + + if (key instanceof XECPublicKey) { + checkLockedParams(InvalidKeySpecException::new, + ((XECPublicKey) key).getParams()); + + if (X509EncodedKeySpec.class.isAssignableFrom(keySpec)) { + if (!key.getFormat().equals("X.509")) { + throw new InvalidKeySpecException("Format is not X.509"); + } + return keySpec.cast(new X509EncodedKeySpec(key.getEncoded())); + } else if (XECPublicKeySpec.class.isAssignableFrom(keySpec)) { + XECPublicKey xecKey = (XECPublicKey) key; + return keySpec.cast( + new XECPublicKeySpec(xecKey.getParams(), xecKey.getU())); + } else { + throw new InvalidKeySpecException( + "KeySpec must be X509EncodedKeySpec or XECPublicKeySpec"); + } + } else if (key instanceof XECPrivateKey) { + checkLockedParams(InvalidKeySpecException::new, + ((XECPrivateKey) key).getParams()); + + if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) { + if (!key.getFormat().equals("PKCS#8")) { + throw new InvalidKeySpecException("Format is not PKCS#8"); + } + return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded())); + } else if (XECPrivateKeySpec.class.isAssignableFrom(keySpec)) { + XECPrivateKey xecKey = (XECPrivateKey) key; + byte[] scalar = xecKey.getScalar().orElseThrow( + () -> new InvalidKeySpecException("No private key value") + ); + return keySpec.cast( + new XECPrivateKeySpec(xecKey.getParams(), scalar)); + } else { + throw new InvalidKeySpecException + ("KeySpec must be PKCS8EncodedKeySpec or XECPrivateKeySpec"); + } + } else { + throw new InvalidKeySpecException("Unsupported key type"); + } + } + + static class X25519 extends XDHKeyFactory { + + public X25519() { + super(NamedParameterSpec.X25519); + } + } + + static class X448 extends XDHKeyFactory { + + public X448() { + super(NamedParameterSpec.X448); + } + } +} diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyPairGenerator.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyPairGenerator.java new file mode 100644 index 00000000000..b2d20b52559 --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyPairGenerator.java @@ -0,0 +1,132 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import java.math.BigInteger; +import java.security.KeyPairGeneratorSpi; +import java.security.InvalidKeyException; +import java.security.InvalidParameterException; +import java.security.InvalidAlgorithmParameterException; +import java.security.KeyPair; +import java.security.ProviderException; +import java.security.SecureRandom; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; + +import sun.security.jca.JCAUtil; + +/** + * Key pair generator for the XDH key agreement algorithm. + */ +public class XDHKeyPairGenerator extends KeyPairGeneratorSpi { + + private static final NamedParameterSpec DEFAULT_PARAM_SPEC + = NamedParameterSpec.X25519; + + private SecureRandom random = null; + private XECOperations ops = null; + private XECParameters lockedParams = null; + + XDHKeyPairGenerator() { + tryInitialize(DEFAULT_PARAM_SPEC); + } + + private XDHKeyPairGenerator(NamedParameterSpec paramSpec) { + tryInitialize(paramSpec); + lockedParams = ops.getParameters(); + } + + private void tryInitialize(NamedParameterSpec paramSpec) { + try { + initialize(paramSpec, null); + } catch (InvalidAlgorithmParameterException ex) { + String name = paramSpec.getName(); + throw new ProviderException(name + " not supported"); + } + } + + @Override + public void initialize(int keySize, SecureRandom random) { + + XECParameters params = XECParameters.getBySize( + InvalidParameterException::new, keySize); + + initializeImpl(params, random); + } + + @Override + public void initialize(AlgorithmParameterSpec params, SecureRandom random) + throws InvalidAlgorithmParameterException { + + XECParameters xecParams = XECParameters.get( + InvalidAlgorithmParameterException::new, params); + + initializeImpl(xecParams, random); + } + + private void initializeImpl(XECParameters params, SecureRandom random) { + + if (lockedParams != null && lockedParams != params) { + throw new InvalidParameterException("Parameters must be " + + lockedParams.getName()); + } + + this.ops = new XECOperations(params); + this.random = random == null ? JCAUtil.getSecureRandom() : random; + } + + + @Override + public KeyPair generateKeyPair() { + + byte[] privateKey = ops.generatePrivate(random); + // computePublic may modify the private key, so clone it first + BigInteger publicKey = ops.computePublic(privateKey.clone()); + + try { + return new KeyPair( + new XDHPublicKeyImpl(ops.getParameters(), publicKey), + new XDHPrivateKeyImpl(ops.getParameters(), privateKey) + ); + } catch (InvalidKeyException ex) { + throw new ProviderException(ex); + } + } + + static class X25519 extends XDHKeyPairGenerator { + + public X25519() { + super(NamedParameterSpec.X25519); + } + } + + static class X448 extends XDHKeyPairGenerator { + + public X448() { + super(NamedParameterSpec.X448); + } + } +} diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPrivateKeyImpl.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPrivateKeyImpl.java new file mode 100644 index 00000000000..2b93cfd17c7 --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPrivateKeyImpl.java @@ -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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import java.security.interfaces.XECPrivateKey; +import java.util.Optional; +import java.security.InvalidKeyException; +import java.security.PrivateKey; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; + +import sun.security.pkcs.PKCS8Key; +import sun.security.x509.AlgorithmId; + +public final class XDHPrivateKeyImpl extends PKCS8Key implements XECPrivateKey { + + private static final long serialVersionUID = 1L; + + private AlgorithmParameterSpec paramSpec; + + XDHPrivateKeyImpl(XECParameters params, byte[] k) + throws InvalidKeyException { + + this.paramSpec = new NamedParameterSpec(params.getName()); + this.algid = new AlgorithmId(params.getOid()); + this.key = k.clone(); + + checkLength(params); + } + + XDHPrivateKeyImpl(byte[] encoded) throws InvalidKeyException { + + decode(encoded); + XECParameters params = XECParameters.get( + InvalidKeyException::new, algid); + paramSpec = new NamedParameterSpec(params.getName()); + + checkLength(params); + } + + void checkLength(XECParameters params) throws InvalidKeyException { + + if (params.getBytes() != this.key.length) { + throw new InvalidKeyException( + "key length must be " + params.getBytes()); + } + } + + public byte[] getK() { + return key.clone(); + } + + @Override + public String getAlgorithm() { + return "XDH"; + } + + @Override + public AlgorithmParameterSpec getParams() { + return paramSpec; + } + + @Override + public Optional getScalar() { + return Optional.of(getK()); + } +} + diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPublicKeyImpl.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPublicKeyImpl.java new file mode 100644 index 00000000000..0b9b6d93c04 --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHPublicKeyImpl.java @@ -0,0 +1,134 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import java.math.BigInteger; +import java.security.InvalidKeyException; +import java.security.KeyRep; +import java.security.PublicKey; +import java.security.interfaces.XECPublicKey; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; +import java.util.Arrays; + +import sun.security.util.BitArray; +import sun.security.x509.AlgorithmId; +import sun.security.x509.X509Key; + +public final class XDHPublicKeyImpl extends X509Key implements XECPublicKey { + + private static final long serialVersionUID = 1L; + + private final BigInteger u; + private final NamedParameterSpec paramSpec; + + XDHPublicKeyImpl(XECParameters params, BigInteger u) + throws InvalidKeyException { + + this.paramSpec = new NamedParameterSpec(params.getName()); + this.algid = new AlgorithmId(params.getOid()); + this.u = u.mod(params.getP()); + + byte[] u_arr = this.u.toByteArray(); + reverse(u_arr); + // u_arr may be too large or too small, depending on the value of u + u_arr = Arrays.copyOf(u_arr, params.getBytes()); + + setKey(new BitArray(u_arr.length * 8, u_arr)); + + checkLength(params); + } + + XDHPublicKeyImpl(byte[] encoded) throws InvalidKeyException { + decode(encoded); + + XECParameters params = + XECParameters.get(InvalidKeyException::new, algid); + this.paramSpec = new NamedParameterSpec(params.getName()); + // construct the BigInteger representation + byte[] u_arr = getKey().toByteArray(); + reverse(u_arr); + + // clear the extra bits + int bitsMod8 = params.getBits() % 8; + if (bitsMod8 != 0) { + int mask = (1 << bitsMod8) - 1; + u_arr[0] &= mask; + } + + this.u = new BigInteger(1, u_arr); + + checkLength(params); + } + + void checkLength(XECParameters params) throws InvalidKeyException { + + if (params.getBytes() * 8 != getKey().length()) { + throw new InvalidKeyException( + "key length must be " + params.getBytes()); + } + } + + @Override + public BigInteger getU() { + return u; + } + + @Override + public AlgorithmParameterSpec getParams() { + return paramSpec; + } + + @Override + public String getAlgorithm() { + return "XDH"; + } + + protected Object writeReplace() throws java.io.ObjectStreamException { + return new KeyRep(KeyRep.Type.PUBLIC, + getAlgorithm(), + getFormat(), + getEncoded()); + } + + private static void swap(byte[] arr, int i, int j) { + byte tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } + + private static void reverse(byte [] arr) { + int i = 0; + int j = arr.length - 1; + + while (i < j) { + swap(arr, i, j); + i++; + j--; + } + } +} + diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XECOperations.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XECOperations.java new file mode 100644 index 00000000000..d26ec634b7a --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XECOperations.java @@ -0,0 +1,271 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import sun.security.util.math.IntegerFieldModuloP; +import sun.security.util.math.ImmutableIntegerModuloP; +import sun.security.util.math.IntegerModuloP; +import sun.security.util.math.MutableIntegerModuloP; +import sun.security.util.math.SmallValue; +import sun.security.util.math.intpoly.IntegerPolynomial25519; +import sun.security.util.math.intpoly.IntegerPolynomial448; + +import java.math.BigInteger; +import java.security.ProviderException; +import java.security.SecureRandom; + +public class XECOperations { + + private final XECParameters params; + private final IntegerFieldModuloP field; + private final ImmutableIntegerModuloP zero; + private final ImmutableIntegerModuloP one; + private final SmallValue a24; + private final ImmutableIntegerModuloP basePoint; + + public XECOperations(XECParameters c) { + this.params = c; + + BigInteger p = params.getP(); + this.field = getIntegerFieldModulo(p); + this.zero = field.getElement(BigInteger.ZERO).fixed(); + this.one = field.get1().fixed(); + this.a24 = field.getSmallValue(params.getA24()); + this.basePoint = field.getElement( + BigInteger.valueOf(c.getBasePoint())); + } + + public XECParameters getParameters() { + return params; + } + + public byte[] generatePrivate(SecureRandom random) { + byte[] result = new byte[this.params.getBytes()]; + random.nextBytes(result); + return result; + } + + /** + * Compute a public key from an encoded private key. This method will + * modify the supplied array in order to prune it. + */ + public BigInteger computePublic(byte[] k) { + pruneK(k); + return pointMultiply(k, this.basePoint).asBigInteger(); + } + + /** + * + * Multiply an encoded scalar with a point as a BigInteger and return an + * encoded point. The array k holding the scalar will be pruned by + * modifying it in place. + * + * @param k an encoded scalar + * @param u the u-coordinate of a point as a BigInteger + * @return the encoded product + */ + public byte[] encodedPointMultiply(byte[] k, BigInteger u) { + pruneK(k); + ImmutableIntegerModuloP elemU = field.getElement(u); + return pointMultiply(k, elemU).asByteArray(params.getBytes()); + } + + /** + * + * Multiply an encoded scalar with an encoded point and return an encoded + * point. The array k holding the scalar will be pruned by + * modifying it in place. + * + * @param k an encoded scalar + * @param u an encoded point + * @return the encoded product + */ + public byte[] encodedPointMultiply(byte[] k, byte[] u) { + pruneK(k); + ImmutableIntegerModuloP elemU = decodeU(u); + return pointMultiply(k, elemU).asByteArray(params.getBytes()); + } + + /** + * Return the field element corresponding to an encoded u-coordinate. + * This method prunes u by modifying it in place. + * + * @param u + * @param bits + * @return + */ + private ImmutableIntegerModuloP decodeU(byte[] u, int bits) { + + maskHighOrder(u, bits); + + return field.getElement(u); + } + + /** + * Mask off the high order bits of an encoded integer in an array. The + * array is modified in place. + * + * @param arr an array containing an encoded integer + * @param bits the number of bits to keep + * @return the number, in range [1,8], of bits kept in the highest byte + */ + private static byte maskHighOrder(byte[] arr, int bits) { + + int lastByteIndex = arr.length - 1; + byte bitsMod8 = (byte) (bits % 8); + byte highBits = bitsMod8 == 0 ? 8 : bitsMod8; + byte msbMaskOff = (byte) ((1 << highBits) - 1); + arr[lastByteIndex] &= msbMaskOff; + + return highBits; + } + + /** + * Prune an encoded scalar value by modifying it in place. The extra + * high-order bits are masked off, the highest valid bit it set, and the + * number is rounded down to a multiple of the cofactor. + * + * @param k an encoded scalar value + * @param bits the number of bits in the scalar + * @param logCofactor the base-2 logarithm of the cofactor + */ + private static void pruneK(byte[] k, int bits, int logCofactor) { + + int lastByteIndex = k.length - 1; + + // mask off unused high-order bits + byte highBits = maskHighOrder(k, bits); + + // set the highest bit + byte msbMaskOn = (byte) (1 << (highBits - 1)); + k[lastByteIndex] |= msbMaskOn; + + // round down to a multiple of the cofactor + byte lsbMaskOff = (byte) (0xFF << logCofactor); + k[0] &= lsbMaskOff; + } + + private void pruneK(byte[] k) { + pruneK(k, params.getBits(), params.getLogCofactor()); + } + + private ImmutableIntegerModuloP decodeU(byte [] u) { + return decodeU(u, params.getBits()); + } + + // Constant-time conditional swap + private static void cswap(int swap, MutableIntegerModuloP x1, + MutableIntegerModuloP x2) { + + x1.conditionalSwapWith(x2, swap); + } + + private static IntegerFieldModuloP getIntegerFieldModulo(BigInteger p) { + + if (p.equals(IntegerPolynomial25519.MODULUS)) { + return new IntegerPolynomial25519(); + } + else if (p.equals(IntegerPolynomial448.MODULUS)) { + return new IntegerPolynomial448(); + } + + throw new ProviderException("Unsupported prime: " + p.toString()); + } + + private int bitAt(byte[] arr, int index) { + int byteIndex = index / 8; + int bitIndex = index % 8; + return (arr[byteIndex] & (1 << bitIndex)) >> bitIndex; + } + + /* + * Constant-time Montgomery ladder that computes k*u and returns the + * result as a field element. + */ + private IntegerModuloP pointMultiply(byte[] k, + ImmutableIntegerModuloP u) { + + ImmutableIntegerModuloP x_1 = u; + MutableIntegerModuloP x_2 = this.one.mutable(); + MutableIntegerModuloP z_2 = this.zero.mutable(); + MutableIntegerModuloP x_3 = u.mutable(); + MutableIntegerModuloP z_3 = this.one.mutable(); + int swap = 0; + + // Variables below are reused to avoid unnecessary allocation + // They will be assigned in the loop, so initial value doesn't matter + MutableIntegerModuloP m1 = this.zero.mutable(); + MutableIntegerModuloP DA = this.zero.mutable(); + MutableIntegerModuloP E = this.zero.mutable(); + MutableIntegerModuloP a24_times_E = this.zero.mutable(); + + // Comments describe the equivalent operations from RFC 7748 + // In comments, A(m1) means the variable m1 holds the value A + for (int t = params.getBits() - 1; t >= 0; t--) { + int k_t = bitAt(k, t); + swap = swap ^ k_t; + cswap(swap, x_2, x_3); + cswap(swap, z_2, z_3); + swap = k_t; + + // A(m1) = x_2 + z_2 + m1.setValue(x_2).setSum(z_2); + // D = x_3 - z_3 + // DA = D * A(m1) + DA.setValue(x_3).setDifference(z_3).setProduct(m1); + // AA(m1) = A(m1)^2 + m1.setSquare(); + // B(x_2) = x_2 - z_2 + x_2.setDifference(z_2); + // C = x_3 + z_3 + // CB(x_3) = C * B(x_2) + x_3.setSum(z_3).setProduct(x_2); + // BB(x_2) = B^2 + x_2.setSquare(); + // E = AA(m1) - BB(x_2) + E.setValue(m1).setDifference(x_2); + // compute a24 * E using SmallValue + a24_times_E.setValue(E); + a24_times_E.setProduct(this.a24); + + // assign results to x_3, z_3, x_2, z_2 + // x_2 = AA(m1) * BB + x_2.setProduct(m1); + // z_2 = E * (AA(m1) + a24 * E) + z_2.setValue(m1).setSum(a24_times_E).setProduct(E); + // z_3 = x_1*(DA - CB(x_3))^2 + z_3.setValue(DA).setDifference(x_3).setSquare().setProduct(x_1); + // x_3 = (CB(x_3) + DA)^2 + x_3.setSum(DA).setSquare(); + } + + cswap(swap, x_2, x_3); + cswap(swap, z_2, z_3); + + // return (x_2 * z_2^(p - 2)) + return x_2.setProduct(z_2.multiplicativeInverse()); + } +} diff --git a/src/jdk.crypto.ec/share/classes/sun/security/ec/XECParameters.java b/src/jdk.crypto.ec/share/classes/sun/security/ec/XECParameters.java new file mode 100644 index 00000000000..a00b2af5ae0 --- /dev/null +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XECParameters.java @@ -0,0 +1,263 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ec; + +import java.io.IOException; +import java.math.BigInteger; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; +import java.util.Collections; +import java.util.Map; +import java.util.HashMap; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Supplier; + +import sun.security.util.ObjectIdentifier; +import sun.security.x509.AlgorithmId; + +public class XECParameters { + + // Naming/identification parameters + private final ObjectIdentifier oid; + private final String name; + + // Curve/field parameters + private final int bits; + private final BigInteger p; + private final int logCofactor; + private final int a24; + private final byte basePoint; + + /** + * + * Construct an object holding the supplied parameters. No parameters are + * checked, so this method always succeeds. This method supports + * Montgomery curves of the form y^2 = x^3 + ax^2 + x. + * + * @param bits The number of relevant bits in a public/private key. + * @param p The prime that defines the finite field. + * @param a24 The value of (a - 2) / 4, where a is the second-degree curve + * coefficient. + * @param basePoint The point that generates the desired group + * @param logCofactor The base-2 logarithm of the cofactor of the curve + * @param oid + * @param name + */ + public XECParameters(int bits, BigInteger p, int a24, + byte basePoint, int logCofactor, + ObjectIdentifier oid, String name) { + + this.bits = bits; + this.logCofactor = logCofactor; + this.p = p; + this.a24 = a24; + this.basePoint = basePoint; + this.oid = oid; + this.name = name; + + } + + public int getBits() { + return bits; + } + public int getBytes() { + return (bits + 7) / 8; + } + public int getLogCofactor() { + return logCofactor; + } + public BigInteger getP() { + return p; + } + public int getA24() { + return a24; + } + public byte getBasePoint() { + return basePoint; + } + public ObjectIdentifier getOid() { + return oid; + } + public String getName() { + return name; + } + + private static final Map SIZE_MAP; + private static final Map OID_MAP; + private static final Map NAME_MAP; + + static { + final BigInteger TWO = BigInteger.valueOf(2); + + Map bySize = new HashMap<>(); + Map byOid = new HashMap<>(); + Map byName = new HashMap<>(); + + // set up X25519 + try { + BigInteger p = TWO.pow(255).subtract(BigInteger.valueOf(19)); + addParameters(255, p, 121665, (byte) 0x09, 3, + new int[]{1, 3, 101, 110}, NamedParameterSpec.X25519.getName(), + bySize, byOid, byName); + + } catch (IOException ex) { + // Unable to set X25519 parameters---it will be disabled + } + + // set up X448 + try { + BigInteger p = TWO.pow(448).subtract(TWO.pow(224)) + .subtract(BigInteger.ONE); + addParameters(448, p, 39081, (byte) 0x05, 2, + new int[]{1, 3, 101, 111}, NamedParameterSpec.X448.getName(), + bySize, byOid, byName); + + } catch (IOException ex) { + // Unable to set X448 parameters---it will be disabled + } + + SIZE_MAP = Collections.unmodifiableMap(bySize); + OID_MAP = Collections.unmodifiableMap(byOid); + NAME_MAP = Collections.unmodifiableMap(byName); + } + + private static void addParameters(int bits, BigInteger p, int a24, + byte basePoint, int logCofactor, int[] oidBytes, String name, + Map bySize, + Map byOid, + Map byName) throws IOException { + + ObjectIdentifier oid = new ObjectIdentifier(oidBytes); + XECParameters params = + new XECParameters(bits, p, a24, basePoint, logCofactor, oid, name); + bySize.put(bits, params); + byOid.put(oid, params); + byName.put(name, params); + } + + public static Optional getByOid(ObjectIdentifier id) { + return Optional.ofNullable(OID_MAP.get(id)); + } + public static Optional getBySize(int size) { + return Optional.ofNullable(SIZE_MAP.get(size)); + } + public static Optional getByName(String name) { + return Optional.ofNullable(NAME_MAP.get(name)); + } + + boolean oidEquals(XECParameters other) { + return oid.equals(other.getOid()); + } + + // Utility method that is used by the methods below to handle exception + // suppliers + private static + Supplier apply(final Function func, final A a) { + return new Supplier() { + @Override + public B get() { + return func.apply(a); + } + }; + } + + /** + * Get parameters by key size, or throw an exception if no parameters are + * defined for the specified key size. This method is used in several + * contexts that should throw different exceptions when the parameters + * are not found. The first argument is a function that produces the + * desired exception. + * + * @param exception a function that produces an exception from a string + * @param size the desired key size + * @param the type of exception that is thrown + * @return the parameters for the specified key size + * @throws T when suitable parameters do not exist + */ + public static + + XECParameters getBySize(Function exception, + int size) throws T { + + Optional xecParams = getBySize(size); + return xecParams.orElseThrow( + apply(exception, "Unsupported size: " + size)); + } + + /** + * Get parameters by algorithm ID, or throw an exception if no + * parameters are defined for the specified ID. This method is used in + * several contexts that should throw different exceptions when the + * parameters are not found. The first argument is a function that produces + * the desired exception. + * + * @param exception a function that produces an exception from a string + * @param algId the algorithm ID + * @param the type of exception that is thrown + * @return the parameters for the specified algorithm ID + * @throws T when suitable parameters do not exist + */ + public static + + XECParameters get(Function exception, + AlgorithmId algId) throws T { + + Optional xecParams = getByOid(algId.getOID()); + return xecParams.orElseThrow( + apply(exception, "Unsupported OID: " + algId.getOID())); + } + + /** + * Get parameters by algorithm parameter spec, or throw an exception if no + * parameters are defined for the spec. This method is used in + * several contexts that should throw different exceptions when the + * parameters are not found. The first argument is a function that produces + * the desired exception. + * + * @param exception a function that produces an exception from a string + * @param params the algorithm parameters spec + * @param the type of exception that is thrown + * @return the parameters for the spec + * @throws T when suitable parameters do not exist + */ + public static + + XECParameters get(Function exception, + AlgorithmParameterSpec params) throws T { + + if (params instanceof NamedParameterSpec) { + NamedParameterSpec namedParams = (NamedParameterSpec) params; + Optional xecParams = + getByName(namedParams.getName()); + return xecParams.orElseThrow( + apply(exception, "Unsupported name: " + namedParams.getName())); + } else { + throw exception.apply("Only NamedParameterSpec is supported."); + } + } +} + diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index 55f62e6b771..84cfb6e00c1 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -1337,6 +1337,16 @@ public class Utils { } } + /** + * Returns a locale independent upper cased String. That is, it + * always uses US locale, this is a clone of the one in StringUtils. + * @param s to convert + * @return converted String + */ + public static String toUpperCase(String s) { + return s.toUpperCase(Locale.US); + } + /** * Returns a locale independent lower cased String. That is, it * always uses US locale, this is a clone of the one in StringUtils. @@ -2869,7 +2879,7 @@ public class Utils { case "throws": case "exception": case "version": - kind = DocTree.Kind.valueOf(tagName.toUpperCase()); + kind = DocTree.Kind.valueOf(toUpperCase(tagName)); return getBlockTags(element, kind); case "serialData": kind = SERIAL_DATA; diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ClassForNamePlugin.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ClassForNamePlugin.java deleted file mode 100644 index ca59c404420..00000000000 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ClassForNamePlugin.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.tools.jlink.internal.plugins; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import jdk.tools.jlink.plugin.ResourcePool; -import jdk.tools.jlink.plugin.ResourcePoolBuilder; -import jdk.tools.jlink.plugin.Plugin.Category; -import jdk.internal.org.objectweb.asm.ClassReader; -import static jdk.internal.org.objectweb.asm.ClassReader.*; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.Type; -import jdk.internal.org.objectweb.asm.tree.AbstractInsnNode; -import jdk.internal.org.objectweb.asm.tree.ClassNode; -import jdk.internal.org.objectweb.asm.tree.InsnList; -import jdk.internal.org.objectweb.asm.tree.LabelNode; -import jdk.internal.org.objectweb.asm.tree.LdcInsnNode; -import jdk.internal.org.objectweb.asm.tree.LineNumberNode; -import jdk.internal.org.objectweb.asm.tree.MethodInsnNode; -import jdk.internal.org.objectweb.asm.tree.MethodNode; -import jdk.tools.jlink.plugin.ResourcePoolEntry; -import jdk.tools.jlink.plugin.Plugin; - -public final class ClassForNamePlugin implements Plugin { - public static final String NAME = "class-for-name"; - - private static String binaryClassName(String path) { - return path.substring(path.indexOf('/', 1) + 1, - path.length() - ".class".length()); - } - - private static int getAccess(ResourcePoolEntry resource) { - ClassReader cr = new ClassReader(resource.contentBytes()); - - return cr.getAccess(); - } - - private static String getPackage(String binaryName) { - int index = binaryName.lastIndexOf("/"); - - return index == -1 ? "" : binaryName.substring(0, index); - } - - private ResourcePoolEntry transform(ResourcePoolEntry resource, ResourcePool pool) { - byte[] inBytes = resource.contentBytes(); - ClassReader cr = new ClassReader(inBytes); - ClassNode cn = new ClassNode(); - cr.accept(cn, EXPAND_FRAMES); - List ms = cn.methods; - boolean modified = false; - LdcInsnNode ldc = null; - - String thisPackage = getPackage(binaryClassName(resource.path())); - - for (MethodNode mn : ms) { - InsnList il = mn.instructions; - Iterator it = il.iterator(); - - while (it.hasNext()) { - AbstractInsnNode insn = it.next(); - - if (insn instanceof LdcInsnNode) { - ldc = (LdcInsnNode)insn; - } else if (insn instanceof MethodInsnNode && ldc != null) { - MethodInsnNode min = (MethodInsnNode)insn; - - if (min.getOpcode() == Opcodes.INVOKESTATIC && - min.name.equals("forName") && - min.owner.equals("java/lang/Class") && - min.desc.equals("(Ljava/lang/String;)Ljava/lang/Class;")) { - String ldcClassName = ldc.cst.toString(); - String thatClassName = ldcClassName.replaceAll("\\.", "/"); - Optional thatClass = - pool.findEntryInContext(thatClassName + ".class", resource); - - if (thatClass.isPresent()) { - int thatAccess = getAccess(thatClass.get()); - String thatPackage = getPackage(thatClassName); - - if ((thatAccess & Opcodes.ACC_PRIVATE) != Opcodes.ACC_PRIVATE && - ((thatAccess & Opcodes.ACC_PUBLIC) == Opcodes.ACC_PUBLIC || - thisPackage.equals(thatPackage))) { - Type type = Type.getObjectType(thatClassName); - il.remove(ldc); - il.set(min, new LdcInsnNode(type)); - modified = true; - } - } - } - - ldc = null; - } else if (!(insn instanceof LabelNode) && - !(insn instanceof LineNumberNode)) { - ldc = null; - } - - } - } - - if (modified) { - ClassWriter cw = new ClassWriter(cr, 0); - cn.accept(cw); - byte[] outBytes = cw.toByteArray(); - - return resource.copyWithContent(outBytes); - } - - return resource; - } - - @Override - public String getName() { - return NAME; - } - - @Override - public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) { - Objects.requireNonNull(in); - Objects.requireNonNull(out); - - in.entries() - .forEach(resource -> { - String path = resource.path(); - - if (path.endsWith(".class") && !path.endsWith("/module-info.class")) { - out.add(transform(resource, in)); - } else { - out.add(resource); - } - }); - return out.build(); - } - - @Override - public Category getType() { - return Category.TRANSFORMER; - } - - @Override - public boolean hasArguments() { - return false; - } - - @Override - public String getDescription() { - return PluginsResourceBundle.getDescription(NAME); - } - - @Override - public String getArgumentsDescription() { - return PluginsResourceBundle.getArgument(NAME); - } - - @Override - public void configure(Map config) { - - } -} diff --git a/src/jdk.jlink/share/classes/module-info.java b/src/jdk.jlink/share/classes/module-info.java index 915edd2856d..e4fac05cfad 100644 --- a/src/jdk.jlink/share/classes/module-info.java +++ b/src/jdk.jlink/share/classes/module-info.java @@ -75,6 +75,5 @@ module jdk.jlink { jdk.tools.jlink.internal.plugins.ExcludeVMPlugin, jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin, jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin, - jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin, - jdk.tools.jlink.internal.plugins.ClassForNamePlugin; + jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin; } diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java index 79e56566a93..9ccb4e8880e 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java @@ -40,6 +40,10 @@ import java.io.StringReader; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.charset.Charset; import java.nio.file.FileSystems; import java.nio.file.Files; @@ -2997,15 +3001,39 @@ public class JShellTool implements MessageHandler { regenerateOnDeath = false; scanner = new Scanner(cmdin); } else { - Path path = toPathResolvingUserHome(filename); + Path path = null; + URL url = null; String resource; - scanner = new Scanner( - (!Files.exists(path) && (resource = getResource(filename)) != null) - ? new StringReader(resource) // Not found as file, but found as resource - : new FileReader(path.toString()) - ); + try { + path = toPathResolvingUserHome(filename); + } catch (InvalidPathException ipe) { + try { + url = new URL(filename); + if (url.getProtocol().equalsIgnoreCase("file")) { + path = Paths.get(url.toURI()); + } + } catch (MalformedURLException | URISyntaxException e) { + throw new FileNotFoundException(filename); + } + } + if (path != null && Files.exists(path)) { + scanner = new Scanner(new FileReader(path.toString())); + } else if ((resource = getResource(filename)) != null) { + scanner = new Scanner(new StringReader(resource)); + } else { + if (url == null) { + try { + url = new URL(filename); + } catch (MalformedURLException mue) { + throw new FileNotFoundException(filename); + } + } + scanner = new Scanner(url.openStream()); + } + } + try (var scannerIOContext = new ScannerIOContext(scanner)) { + run(scannerIOContext); } - run(new ScannerIOContext(scanner)); return true; } catch (FileNotFoundException e) { errormsg("jshell.err.file.not.found", context, filename, e.getMessage()); diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java index 72d144f5e20..718d82b6033 100644 --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java @@ -66,6 +66,7 @@ import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.arrays.ArrayData; +import jdk.nashorn.internal.runtime.arrays.ArrayIndex; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; import jdk.nashorn.internal.runtime.linker.NashornBeansLinker; @@ -613,8 +614,13 @@ public final class NativeObject { final Object obj = Global.toObject(self); if (obj instanceof ScriptObject) { - final jdk.nashorn.internal.runtime.Property property = ((ScriptObject)obj).getMap().findProperty(str); - return property != null && property.isEnumerable(); + final ScriptObject sobj = (ScriptObject) obj; + final Property property = sobj.getProperty(str); + if (property != null) { + return property.isEnumerable(); + } else { + return (sobj.getArray().has(ArrayIndex.getArrayIndex(v))); + } } return false; diff --git a/test/failure_handler/src/share/conf/mac.properties b/test/failure_handler/src/share/conf/mac.properties index de14390fcb1..2371f2777c6 100644 --- a/test/failure_handler/src/share/conf/mac.properties +++ b/test/failure_handler/src/share/conf/mac.properties @@ -76,7 +76,9 @@ environment=\ system.dmesg system.sysctl \ process.ps process.top \ memory.vmstat \ - netstat.av netstat.aL netstat.m netstat.s + netstat.av netstat.aL netstat.m netstat.s \ + ifconfig \ + scutil.nwi scutil.proxy ################################################################################ users.current.app=id users.current.args=-a @@ -107,4 +109,11 @@ netstat.av.args=-av netstat.aL.args=-aL netstat.m.args=-m netstat.s.args=-s + +ifconfig.app=ifconfig +ifconfig.args=-a + +scutil.app=scutil +scutil.nwi.args=--nwi +scutil.proxy.args=--proxy ################################################################################ diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index ef9e6e11abc..dd4bdf3bd51 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -26,6 +26,8 @@ // Included early because the NMT flags don't include it. #include "utilities/macros.hpp" +#if INCLUDE_NMT + #include "runtime/thread.hpp" #include "services/memTracker.hpp" #include "services/virtualMemoryTracker.hpp" @@ -208,3 +210,5 @@ TEST_VM(CommittedVirtualMemoryTracker, test_committed_virtualmemory_region) { CommittedVirtualMemoryTest::test_committed_region(); CommittedVirtualMemoryTest::test_partial_region(); } + +#endif // INCLUDE_NMT diff --git a/test/hotspot/jtreg/ProblemList-graal.txt b/test/hotspot/jtreg/ProblemList-graal.txt index 6b4700d91f2..bdd9846e286 100644 --- a/test/hotspot/jtreg/ProblemList-graal.txt +++ b/test/hotspot/jtreg/ProblemList-graal.txt @@ -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 + diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 9de4220fd01..2f550390570 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -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 + ############################################################################# diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index d6ff348014c..42835663663 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -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 diff --git a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java index 24f1a7622da..a10053fab01 100644 --- a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java +++ b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java @@ -141,7 +141,6 @@ public class TestGCLogMessages { new LogMessageWithLevel("Resize TLABs", Level.DEBUG), // Reference Processing new LogMessageWithLevel("Reference Processing", Level.DEBUG), - new LogMessageWithLevel("Reference Enqueuing", Level.DEBUG), // VM internal reference processing new LogMessageWithLevel("Weak Processing", Level.DEBUG), diff --git a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java index 18b89617ce9..35c780669fb 100644 --- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java +++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java @@ -93,9 +93,6 @@ public class TestPrintReferences { gcLogTimeRegex + indent(8) + "Discovered: " + countRegex + "\n" + gcLogTimeRegex + indent(8) + "Cleared: " + countRegex + "\n"; String softRefDetailRegex = gcLogTimeRegex + indent(8) + phase1 + ": " + timeRegex + "\n" + refDetailRegex; - String enqueueRegex = gcLogTimeRegex + indent(4) + "Reference Enqueuing: " + timeRegex + "\n"; - String enqueueDetailRegex = gcLogTimeRegex + indent(6) + "Reference Counts: Soft: " + countRegex + - " Weak: " + countRegex + " Final: " + countRegex + " Phantom: " + countRegex + "\n"; output.shouldMatch(/* Total Reference processing time */ totalRegex + @@ -106,11 +103,7 @@ public class TestPrintReferences { /* FinalReference processing */ finalRefRegex + balanceRegex + refDetailRegex + /* PhantomReference processing */ - phantomRefRegex + balanceRegex + refDetailRegex + - /* Total Enqueuing time */ - enqueueRegex + - /* Enqueued Stats */ - enqueueDetailRegex + phantomRefRegex + balanceRegex + refDetailRegex ); } diff --git a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java index 59d245548a5..f5a0077270f 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java +++ b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8060449 8073989 + * @bug 8060449 8073989 8202744 * @summary Newly obsolete command line options should still give useful error messages when used improperly. * @modules java.base/jdk.internal.misc * @library /test/lib @@ -37,18 +37,18 @@ public class ObsoleteFlagErrorMessage { // Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449) ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-XX:ConvertSleepToYieldPlusJunk", "-version"); + "-XX:SafepointSpinBeforeYieldPlusJunk", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Unrecognized VM option 'ConvertSleepToYieldPlusJunk'"); // Must identify bad option. + output.shouldContain("Unrecognized VM option 'SafepointSpinBeforeYieldPlusJunk'"); // Must identify bad option. output.shouldHaveExitValue(1); // Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989) ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder( - "-XX:+ConvertSleepToYield", "-version"); + "-XX:+SafepointSpinBeforeYield", "-version"); OutputAnalyzer output2 = new OutputAnalyzer(pb2.start()); output2.shouldContain("Ignoring option").shouldContain("support was removed"); - output2.shouldContain("ConvertSleepToYield"); + output2.shouldContain("SafepointSpinBeforeYield"); } } diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java index c49996d4914..17900fbe0df 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java @@ -52,6 +52,7 @@ public class VMDeprecatedOptions { {"PrintSafepointStatisticsCount", "3"}, {"PrintSafepointStatisticsTimeout", "3"}, {"AggressiveOpts", "true"}, + {"AllowNonVirtualCalls", "true"}, // deprecated alias flags (see also aliased_jvm_flags): {"DefaultMaxRAMFraction", "4"}, diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/common/C.jasm b/test/hotspot/jtreg/runtime/LoaderConstraints/common/C.jasm index a7d3f94dffd..d308cf8a6f2 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/common/C.jasm +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/common/C.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -26,6 +26,8 @@ // class C inherits unrelated defaults for m() from types I and J // C is not abstract and does not override abstract method m() in I +package test; + super public class C implements I, J version 52:0 { public Method "":"()V" stack 1 locals 1 { diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/common/Foo.java b/test/hotspot/jtreg/runtime/LoaderConstraints/common/Foo.java index 1a82277ad34..e8a2319b0af 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/common/Foo.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/common/Foo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,4 +21,6 @@ * questions. */ +package test; + public class Foo {} diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/common/J.java b/test/hotspot/jtreg/runtime/LoaderConstraints/common/J.java index e9f58ca2777..81266f35f85 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/common/J.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/common/J.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public interface J { public default Foo m() { return null; } } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/common/PreemptingClassLoader.java b/test/hotspot/jtreg/runtime/LoaderConstraints/common/PreemptingClassLoader.java index 2cc8db0b3ec..29f2c2f01d3 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/common/PreemptingClassLoader.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/common/PreemptingClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -27,14 +27,26 @@ import java.io.*; public class PreemptingClassLoader extends ClassLoader { private final Set names = new HashSet<>(); + boolean checkLoaded = true; public PreemptingClassLoader(String... names) { for (String n : names) this.names.add(n); } + public PreemptingClassLoader(String name, String[] names) { + super(name, ClassLoader.getSystemClassLoader()); + for (String n : names) this.names.add(n); + } + + public PreemptingClassLoader(String name, String[] names, boolean cL) { + super(name, ClassLoader.getSystemClassLoader()); + for (String n : names) this.names.add(n); + checkLoaded = cL; + } + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { if (!names.contains(name)) return super.loadClass(name, resolve); - Class result = findLoadedClass(name); + Class result = checkLoaded ? findLoadedClass(name) : null; if (result == null) { String filename = name.replace('.', '/') + ".class"; try (InputStream data = getResourceAsStream(filename)) { diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/D_ambgs.jasm b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/D_ambgs.jasm new file mode 100644 index 00000000000..6a63a380f04 --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/D_ambgs.jasm @@ -0,0 +1,67 @@ +/* + * 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. + * + */ + +package test; + +// A simple class to extend an abstract class and get loaded with different +// loaders. This class is loaded via Loader2. A similar named class will +// be loaded via the bootstrap loader. +// +// The following code is implemented as java assembler to avoid checks +// of javac. +// +// public class D_ambgs extends bug_21227 { +// +// D_ambgs() { +// System.out.println("Gonna hack this thing"); +// } +// +// public D_ambgs[] make(A iface) { +// throw new Error("do not call me"); +// } +// } + +class D_ambgs extends C { + + Method D_ambgs:"()V" + stack 2 locals 1 + { + aload_0; + invokespecial Method test/C."":"()V"; + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + ldc String "Gonna hack this thing"; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; + } + + public Method make:"(Ltest/A;)[Ltest/D_ambgs;" + stack 3 locals 2 + { + new class java/lang/Error; + dup; + ldc String "do not call me"; + invokespecial Method java/lang/Error."":"(Ljava/lang/String;)V"; + athrow; + } +} diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/Test.java new file mode 100644 index 00000000000..85c573919ff --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/Test.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 SAP SE. 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 + * @bug 8199852 + * @summary Test exception messages of LinkageError. Two class loaders load + * two different versions of a class. Should trigger exception in + * SystemDictionary::check_constraints(). + * @library /test/lib + * @compile D_ambgs.jasm + * @run driver ClassFileInstaller test.D_ambgs + * @compile ../common/PreemptingClassLoader.java + * test/D_ambgs.java Test.java test/B.java + * @run driver ClassFileInstaller test.B + * @run main/othervm Test + */ + +import test.*; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class Test { + + // Force LinkageError. + // + // Derived from test runtime/6626217. + // + // Uses the specialized class loader PreemptingClassLoader. + // PreemptingClassLoader only loads files with names passed to it in its + // constructor. If it does not find it, it delegates to the super class loader. + // + // A // interface + // | + // B // Compiled to the current working directory so that it is found by our + // // special class loader. B uses D, so that loading B triggers loading D. + // + // C // An abstract class. + // | + // D // Class with two different implementations D1 and D2. D2 is + // // compiled to the current working directory so that it is found by our + // // special class loader. + // + // First, the bootstrap loader will load D1. It already has loaded interface A. + // Then, the second class loader PreemptingClassLoader will load B. Recursive, + // it tries to load interface A. As it does not find it (there is no A.impl2), + // it asks the super classloader for A. + // Then it loads the D2 variant of D from the current working directory and it's + // superclass C. This fails as D1 is already loaded with the same superclass. + + static String expectedErrorMessage = + "loader constraint violation: loader \"\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) wants to load " + + "class test.D_ambgs. A different class with the same name was previously loaded " + + "by \"app\" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader)."; + + public static void test_access() throws Exception { + try { + // Make a Class 'D_ambgs' under the default loader. + // This uses the implementation from the .java file. + C c_1 = new D_ambgs(); + + // Some classes under a new Loader, loader2, including, indirectly, + // another version of 'D_ambgs' + String[] classNames = {"test.B", "test.D_ambgs"}; + + ClassLoader loader2 = new PreemptingClassLoader(null, classNames, false); + Class class2 = loader2.loadClass("test.B"); + A iface = (A)class2.newInstance(); + + // Call D1.make() loaded by bootstrap loader with B loaded by Loader2. + D_ambgs[] x2 = c_1.make(iface); + + throw new RuntimeException("Expected LinkageError was not thrown."); + } catch (LinkageError jle) { + String errorMsg = jle.getMessage(); + if (!errorMsg.equals(expectedErrorMessage)) { + System.out.println("Expected: " + expectedErrorMessage + "\n" + + "but got: " + errorMsg); + throw new RuntimeException("Wrong error message of LinkageError."); + } else { + System.out.println("Passed with message: " + errorMsg); + } + } + } + + public static void main(String[] args) throws Exception { + test_access(); + } +} + diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/A.java b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/A.java new file mode 100644 index 00000000000..ca94e35562b --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/A.java @@ -0,0 +1,32 @@ +/* + * 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. + * + */ + +package test; + +// A simple interface, to allow an unknown foreign call from a class +// loaded with the bootstrap loader to a class loaded with Loader2. +public interface A { + public D_ambgs[] gen(); +} + diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/B.java b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/B.java new file mode 100644 index 00000000000..e21377ad2fb --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/B.java @@ -0,0 +1,35 @@ +/* + * 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. + * + */ + +package test; + +// This class is loaded via Loader2. Using D_ambgs here will trigger +// loading it's second version with Loader2. +public class B implements A { + public D_ambgs[] gen() { + D_ambgs[] x = new D_ambgs[1]; + x[0] = new D_ambgs(); + return x; + } +} diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/C.java b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/C.java new file mode 100644 index 00000000000..fa55213041f --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/C.java @@ -0,0 +1,29 @@ +/* + * 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. + * + */ + +package test; + +abstract public class C { + public abstract D_ambgs[] make(A iface); // abstract factory +} diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/D_ambgs.java b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/D_ambgs.java new file mode 100644 index 00000000000..d078eb4afaf --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/differentLE/test/D_ambgs.java @@ -0,0 +1,43 @@ +/* + * 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. + * + */ + +package test; + +// A simple class to extend an abstract class and get loaded with different +// loaders. This class is loaded via the bootstrap loader. A similar named class will +// be loaded via Loader2. +public class D_ambgs extends C { + + // We are loaded by the bootstrap loader. iface is an object of a class + // loaded by Loader2. As it references D_ambgs, Loader2 will trigger + // loading the version known to it, which differs from this one. + public D_ambgs[] make(A iface) { + // This function needs to return a value known to be loaded from Loader2. + // Since I need to use a yet different loader, I need to make an unknown + // foreign call. In this case I'll be using an interface to make the + // unknown call, with but a single implementor so the compiler can do the + // upcast statically. + return iface == null ? null : iface.gen(); + } +} diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateLE/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateLE/Test.java new file mode 100644 index 00000000000..e520379bfa1 --- /dev/null +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateLE/Test.java @@ -0,0 +1,90 @@ +/* + * 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 + * @bug 8199852 + * @summary Test exception messages of LinkageError. A class loader loads + * twice the same class. Should trigger exception in + * SystemDictionary::check_constraints(). + * @compile ../common/Foo.java + * @compile ../common/J.java + * ../common/PreemptingClassLoader.java + * @run main/othervm Test + */ + +public class Test { + + // Check that all names have external formatting ('.' and not '/' in package names). + // Check for parent of class loader. + static String expectedErrorMessage1 = + "loader \"\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "attempted duplicate class definition for test.Foo."; + + // Check that all names have external formatting ('.' and not '/' in package names). + // Check for name and parent of class loader. + static String expectedErrorMessage2 = + "loader \"DuplicateLE_Test_Loader\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "attempted duplicate class definition for test.Foo."; + + // Check that all names have external formatting ('.' and not '/' in package names). + // Check for name and parent of class loader. Type should be mentioned as 'interface'. + static String expectedErrorMessage3 = + "loader \"DuplicateLE_Test_Loader_IF\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "attempted duplicate interface definition for test.J."; + + // Test that the error message is correct when a loader constraint error is + // detected during vtable creation. + // + // In this test, during vtable creation for class Task, method "Task.m()LFoo;" + // overrides "J.m()LFoo;". But, Task's class Foo and super type J's class Foo + // are different. So, a LinkageError exception should be thrown because the + // loader constraint check will fail. + public static void test(String loaderName, String expectedErrorMessage, String testType) throws Exception { + String[] classNames = {testType}; + ClassLoader l = new PreemptingClassLoader(loaderName, classNames, false); + l.loadClass(testType); + try { + l.loadClass(testType).newInstance(); + throw new RuntimeException("Expected LinkageError exception not thrown"); + } catch (LinkageError e) { + String errorMsg = e.getMessage(); + if (!errorMsg.equals(expectedErrorMessage)) { + System.out.println("Expected: " + expectedErrorMessage + "\n" + + "but got: " + errorMsg); + throw new RuntimeException("Wrong LinkageError exception thrown: " + errorMsg); + } + System.out.println("Passed with message: " + errorMsg); + } + } + + public static void main(String args[]) throws Exception { + test(null, expectedErrorMessage1, "test.Foo"); + test("DuplicateLE_Test_Loader", expectedErrorMessage2, "test.Foo"); + test("DuplicateLE_Test_Loader_IF", expectedErrorMessage3, "test.J"); + } +} + diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/I.java b/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/I.java index 25a6c63acfc..360bb2c8a2a 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/I.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/I.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public interface I { public default Foo m() { return null; } } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Task.java b/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Task.java index 144d8514010..b2dce5c580c 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Task.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Task.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public class Task implements Runnable { public void run() { diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Test.java index 3cc83b2351b..8855ecf0f70 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Test.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/itableICCE/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -44,14 +44,14 @@ public class Test { // ICCE). So, no LinkageError exception should be thrown because the loader // constraint check that would cause the LinkageError should not be done. public static void main(String... args) throws Exception { - Class c = Foo.class; // forces standard class loader to load Foo - ClassLoader l = new PreemptingClassLoader("Task", "Foo", "C", "I"); - Runnable r = (Runnable) l.loadClass("Task").newInstance(); + Class c = test.Foo.class; // forces standard class loader to load Foo + ClassLoader l = new PreemptingClassLoader("test.Task", "test.Foo", "test.C", "test.I"); + Runnable r = (Runnable) l.loadClass("test.Task").newInstance(); try { r.run(); // Cause an ICCE because both I and J define m()LFoo; throw new RuntimeException("Expected ICCE exception not thrown"); } catch (IncompatibleClassChangeError e) { - if (!e.getMessage().contains("Conflicting default methods: I.m J.m")) { + if (!e.getMessage().contains("Conflicting default methods: test/I.m test/J.m")) { throw new RuntimeException("Wrong ICCE exception thrown: " + e.getMessage()); } } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/I.java b/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/I.java index 97fdaa8830b..59a2906b69a 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/I.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/I.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public interface I { public Foo m(); } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Task.java b/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Task.java index 6d409023eec..1157c3b2685 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Task.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Task.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public class Task implements Runnable { public void run() { diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Test.java index 3f2793934c7..7c10d020542 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Test.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/itableLdrConstraint/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8186092 + * @bug 8186092 8199852 * @compile ../common/Foo.java * ../common/J.java * I.java @@ -35,6 +35,26 @@ public class Test { + static String expectedErrorMessage1 = + "loader constraint violation in interface itable initialization for class test.C: " + + "when selecting method test.I.m()Ltest/Foo; " + + "the class loader \"\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "for super interface test.I, and the class loader \"app\" " + + "(instance of jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "of the selected method's type, test.J have different Class objects " + + "for the type test.Foo used in the signature"; + + static String expectedErrorMessage2 = + "loader constraint violation in interface itable initialization for class test.C: " + + "when selecting method test.I.m()Ltest/Foo; " + + "the class loader \"ItableLdrCnstrnt_Test_Loader\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "for super interface test.I, and the class loader \"app\" " + + "(instance of jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "of the selected method's type, test.J have different Class objects " + + "for the type test.Foo used in the signature"; + // Test that the error message is correct when a loader constraint error is // detected during itable creation. // @@ -43,18 +63,27 @@ public class Test { // type super interface J. The selected method is not an overpass method nor // otherwise excluded from loader constraint checking. So, a LinkageError // exception should be thrown because the loader constraint check will fail. - public static void main(String... args) throws Exception { - Class c = Foo.class; // forces standard class loader to load Foo - ClassLoader l = new PreemptingClassLoader("Task", "Foo", "C", "I"); - Runnable r = (Runnable) l.loadClass("Task").newInstance(); + public static void test(String loaderName, String expectedErrorMessage) throws Exception { + Class c = test.Foo.class; // Forces standard class loader to load Foo. + String[] classNames = {"test.Task", "test.Foo", "test.C", "test.I"}; + ClassLoader l = new PreemptingClassLoader(loaderName, classNames); + Runnable r = (Runnable) l.loadClass("test.Task").newInstance(); try { r.run(); throw new RuntimeException("Expected LinkageError exception not thrown"); } catch (LinkageError e) { - if (!e.getMessage().contains( - "loader constraint violation in interface itable initialization for class C:")) { - throw new RuntimeException("Wrong LinkageError exception thrown: " + e.getMessage()); + String errorMsg = e.getMessage(); + if (!errorMsg.equals(expectedErrorMessage)) { + System.out.println("Expected: " + expectedErrorMessage + "\n" + + "but got: " + errorMsg); + throw new RuntimeException("Wrong LinkageError exception thrown: " + errorMsg); } + System.out.println("Passed with message: " + errorMsg); } } + + public static void main(String... args) throws Exception { + test(null, expectedErrorMessage1); + test("ItableLdrCnstrnt_Test_Loader", expectedErrorMessage2); + } } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/I.java b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/I.java index f6e47464837..c51ba06a868 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/I.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/I.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public interface I extends J { public Foo m(); } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Task.java b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Task.java index ffc2acd8223..e27fff31a6e 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Task.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Task.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,4 +21,6 @@ * questions. */ +package test; + public class Task extends C { } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Test.java index 83a5a7f01e7..7957704bdd5 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Test.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -48,16 +48,16 @@ public class Test { // because the loader constraint check that would cause the LinkageError // should not be done. public static void main(String args[]) throws Exception { - Class c = Foo.class; // forces standard class loader to load Foo - ClassLoader l = new PreemptingClassLoader("Task", "Foo", "I", "J"); - l.loadClass("Foo"); - l.loadClass("Task").newInstance(); - Task t = new Task(); + Class c = test.Foo.class; // forces standard class loader to load Foo + ClassLoader l = new PreemptingClassLoader("test.Task", "test.Foo", "test.I", "test.J"); + l.loadClass("test.Foo"); + l.loadClass("test.Task").newInstance(); + test.Task t = new test.Task(); try { t.m(); // Should get AME throw new RuntimeException("Missing AbstractMethodError exception"); } catch (AbstractMethodError e) { - if (!e.getMessage().contains("Method Task.m()LFoo; is abstract")) { + if (!e.getMessage().contains("Method test/Task.m()Ltest/Foo; is abstract")) { throw new RuntimeException("Wrong AME exception thrown: " + e.getMessage()); } } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/I.java b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/I.java index f6db30fe83b..ceac6cd8e28 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/I.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/I.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,5 +21,7 @@ * questions. */ +package test; + public interface I extends J { } diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Task.java b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Task.java index d59a7a4fc76..dd4e697ff1c 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Task.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Task.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,6 +21,8 @@ * questions. */ +package test; + public class Task extends C { public Foo m() { diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Test.java index e474c1ee16d..81e0c88a2cd 100644 --- a/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Test.java +++ b/test/hotspot/jtreg/runtime/LoaderConstraints/vtableLdrConstraint/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8186092 + * @bug 8186092 8199852 * @compile ../common/Foo.java * ../common/J.java * I.java @@ -35,6 +35,26 @@ public class Test { + static String expectedErrorMessage1 = + "loader constraint violation for class test.Task: " + + "when selecting overriding method test.Task.m()Ltest/Foo; " + + "the class loader \"\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "of the selected method's type test.Task, " + + "and the class loader \"app\" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "for its super type test.J " + + "have different Class objects for the type test.Foo used in the signature"; + + static String expectedErrorMessage2 = + "loader constraint violation for class test.Task: " + + "when selecting overriding method test.Task.m()Ltest/Foo; " + + "the class loader \"VtableLdrCnstrnt_Test_Loader\" (instance of PreemptingClassLoader, " + + "child of \"app\" jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "of the selected method's type test.Task, " + + "and the class loader \"app\" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) " + + "for its super type test.J " + + "have different Class objects for the type test.Foo used in the signature"; + // Test that the error message is correct when a loader constraint error is // detected during vtable creation. // @@ -42,22 +62,28 @@ public class Test { // overrides "J.m()LFoo;". But, Task's class Foo and super type J's class Foo // are different. So, a LinkageError exception should be thrown because the // loader constraint check will fail. - public static void main(String args[]) throws Exception { - Class c = Foo.class; // forces standard class loader to load Foo - ClassLoader l = new PreemptingClassLoader("Task", "Foo", "I"); - l.loadClass("Foo"); + public static void test(String loaderName, String expectedErrorMessage) throws Exception { + Class c = test.Foo.class; // Forces standard class loader to load Foo. + String[] classNames = {"test.Task", "test.Foo", "test.I"}; + ClassLoader l = new PreemptingClassLoader(loaderName, classNames); + l.loadClass("test.Foo"); try { - l.loadClass("Task").newInstance(); + l.loadClass("test.Task").newInstance(); throw new RuntimeException("Expected LinkageError exception not thrown"); } catch (LinkageError e) { - if (!e.getMessage().contains( - "loader constraint violation for class Task: when selecting overriding method") || - !e.getMessage().contains( - "for its super type J have different Class objects for the type Foo")) { - throw new RuntimeException("Wrong LinkageError exception thrown: " + e.getMessage()); + String errorMsg = e.getMessage(); + if (!errorMsg.equals(expectedErrorMessage)) { + System.out.println("Expected: " + expectedErrorMessage + "\n" + + "but got: " + errorMsg); + throw new RuntimeException("Wrong LinkageError exception thrown: " + errorMsg); } + System.out.println("Passed with message: " + errorMsg); } } + public static void main(String args[]) throws Exception { + test(null, expectedErrorMessage1); + test("VtableLdrCnstrnt_Test_Loader", expectedErrorMessage2); + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AccessWatchpointEvent/_itself_/awevent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AccessWatchpointEvent/_itself_/awevent001.java new file mode 100644 index 00000000000..8ff5df69af0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AccessWatchpointEvent/_itself_/awevent001.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 + * com.sun.jdi.request.AccessWatchpointEvent.createAccessWatchpointRequest() + * properly creates new disabled watchpoints which watch accesses to + * the fields of different types. + * A debugger part of the test checks that: + *

  • all created watchpoint requests are disabled + *
  • 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; iisPackagePrivate() + * of the JDI interface Accessible works fine with + * the ArrayType 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 run(args,out), 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 run(args,out) + * 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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001/TestDescription.java new file mode 100644 index 00000000000..ad21279e756 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001a.java new file mode 100644 index 00000000000..e8eea9f20c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001a.java @@ -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 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002.java new file mode 100644 index 00000000000..e24055f5b55 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002/TestDescription.java new file mode 100644 index 00000000000..03da587e75d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002a.java new file mode 100644 index 00000000000..5485a4d7d17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002a.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001.java new file mode 100644 index 00000000000..9e4ba59010e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001.java @@ -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 isPrivate() + * of the JDI interface Accessible 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 run(args,out), 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 run(args,out) + */ + 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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001/TestDescription.java new file mode 100644 index 00000000000..d480ebfb416 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001a.java new file mode 100644 index 00000000000..294937f7d58 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001a.java @@ -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 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 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002.java new file mode 100644 index 00000000000..87ca6dedb27 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002/TestDescription.java new file mode 100644 index 00000000000..36018424375 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002a.java new file mode 100644 index 00000000000..87ed43c82cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002a.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001.java new file mode 100644 index 00000000000..12e81ca0577 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001.java @@ -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 isProtected() + * of the JDI interface Accessible 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 run(args,out), 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 run(args,out) + */ + 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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001/TestDescription.java new file mode 100644 index 00000000000..48f5d730d3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001a.java new file mode 100644 index 00000000000..9d66c7c6f76 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isProtected001a.java @@ -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 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 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002.java new file mode 100644 index 00000000000..1f1cd5944fa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002/TestDescription.java new file mode 100644 index 00000000000..23a2dc24e6f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002a.java new file mode 100644 index 00000000000..3a7ff10102f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002a.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001.java new file mode 100644 index 00000000000..d4d51966cbb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001.java @@ -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 isPublic() + * of the JDI interface Accessible 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 run(args,out), 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 run(args,out) + */ + 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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001/TestDescription.java new file mode 100644 index 00000000000..2b016ac3706 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001a.java new file mode 100644 index 00000000000..916795c29e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001a.java @@ -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 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 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002.java new file mode 100644 index 00000000000..9495f939a2d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002/TestDescription.java new file mode 100644 index 00000000000..de1afa5e086 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002a.java new file mode 100644 index 00000000000..3eccc381c0c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002a.java @@ -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(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003.java new file mode 100644 index 00000000000..c1adf733fb3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003/TestDescription.java new file mode 100644 index 00000000000..73c327c151e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003a.java new file mode 100644 index 00000000000..0e67ef54d5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003a.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001.java new file mode 100644 index 00000000000..63840b2f428 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001.java @@ -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 modifiers() + * of the JDI interface Accessible 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", "", "class"}, + {package_prefix + "abstract_class", "abstract", "class"}, + {package_prefix + "final_class", "final", "class"}, + {package_prefix + "interf", "abstract, interface", "interface"} + }; + + /** + * Re-call to run(args,out), 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 run(args,out) + */ + 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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001/TestDescription.java new file mode 100644 index 00000000000..15b8e981051 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001a.java new file mode 100644 index 00000000000..f9583200353 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001a.java @@ -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 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 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002.java new file mode 100644 index 00000000000..137841869c8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002/TestDescription.java new file mode 100644 index 00000000000..3aa294f2c26 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002a.java new file mode 100644 index 00000000000..338b8dd7c99 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002a.java @@ -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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001.java new file mode 100644 index 00000000000..7b4f492cef0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001/TestDescription.java new file mode 100644 index 00000000000..13160956c41 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/description/description001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid001.java new file mode 100644 index 00000000000..78c1b998641 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid001.java @@ -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
    + * Connector.Argument.
    + *
    + * The test checks up that results 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 .
    + *
    + * In case of a wrong boolean value returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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()\n" + + "error: returned value == true\n"); + } + + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid001/TestDescription.java new file mode 100644 index 00000000000..df6ff6f3fad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid002.java new file mode 100644 index 00000000000..9b751b240f4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid002.java @@ -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
    + * Connector.Argument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.Argument.isValid()
    + * complies with its specification.
    + * The case for testing includes throwing NullPointerException
    + * if a parameter is a null-string.
    + *
    + */ + + +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid002/TestDescription.java new file mode 100644 index 00000000000..dc4a629ff74 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid003.java new file mode 100644 index 00000000000..5ac66a4bc73 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid003.java @@ -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
    + * Connector.Argument.
    + *
    + * The test checks up that results 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.
    + *
    + * In case of a wrong boolean value returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid003/TestDescription.java new file mode 100644 index 00000000000..07730666b65 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid003/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid004.java new file mode 100644 index 00000000000..b6c8d79ce8f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid004.java @@ -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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results 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 IntegerArgument
    + * and its parameter is a string representing one of min(), max(),
    + * min()-1, min()+1, max()+1.
    + *
    + * In case of a wrong result returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid004/TestDescription.java new file mode 100644 index 00000000000..369fcd148c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid004/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid005.java new file mode 100644 index 00000000000..1add4e1ca37 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid005.java @@ -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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results 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 IntegerArgument
    + * and its parameter is one of the following: "a", "", null, null-string.

    + *
    + * In case of a wrong result returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid005/TestDescription.java new file mode 100644 index 00000000000..3b10d1d5e0a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/isValid/isvalid005/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001.java new file mode 100644 index 00000000000..8d09663ffcc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001/TestDescription.java new file mode 100644 index 00000000000..cb8575d435d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/label/label001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001.java new file mode 100644 index 00000000000..dadbad24efb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001.java @@ -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
    + * Connector_Argument.
    + *
    + * The test checks up that the method
    + * com.sun.jdi.connect.Connector.Argument.mustSpecify()
    + * complies with its specification.
    + *
    + * In case of Connector has no Argument needed to be specified,
    + * the test prints warning message.
    + * The test is always passed and produces
    + * the return value 95.
    + */ + +// +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001/TestDescription.java new file mode 100644 index 00000000000..fd06ac9bc3c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001.java new file mode 100644 index 00000000000..572d8047f57 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001/TestDescription.java new file mode 100644 index 00000000000..1cce6196e22 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue001.java new file mode 100644 index 00000000000..873b26b8133 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue001.java @@ -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
    + * Connector.Argument.
    + * + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.Argument.setValue()
    + * complies with its specification.
    + * The case for testing includes throwing NullPointerException
    + * if a parameter is null-string.
    + *
    + */ + + +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue001/TestDescription.java new file mode 100644 index 00000000000..659576419bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue002.java new file mode 100644 index 00000000000..fef74f3db37 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue002.java @@ -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
    + * Connector.Argument.
    + * + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.Argument.setValue()
    + * complies with its specification, when a string value to be set
    + * is the empty or non-empty string.
    + *
    + * In case of the method Arguemnt.value() returns the value,
    + * not equal to one has been set,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue002/TestDescription.java new file mode 100644 index 00000000000..53f5aead6e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/setValue/setvalue002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value001.java new file mode 100644 index 00000000000..6629c3efd26 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value001.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value001/TestDescription.java new file mode 100644 index 00000000000..974fb15c143 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value002.java new file mode 100644 index 00000000000..6a7c8a585a0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value002.java @@ -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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value002/TestDescription.java new file mode 100644 index 00000000000..19d5136871b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003.java new file mode 100644 index 00000000000..e845a809a01 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003.java @@ -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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003/TestDescription.java new file mode 100644 index 00000000000..1572e15a409 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003a.java new file mode 100644 index 00000000000..e5268e0d693 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value003a.java @@ -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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004.java new file mode 100644 index 00000000000..f8e0e222692 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004.java @@ -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 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004/TestDescription.java new file mode 100644 index 00000000000..6a354665260 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004a.java new file mode 100644 index 00000000000..9431068645d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004a.java @@ -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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001.java new file mode 100644 index 00000000000..3c4c6da441c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001/TestDescription.java new file mode 100644 index 00000000000..a591d37bfa5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001a.java new file mode 100644 index 00000000000..c815efdef8b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue001a.java @@ -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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002.java new file mode 100644 index 00000000000..f74d25ceae2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002/TestDescription.java new file mode 100644 index 00000000000..b4f57ad04b0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002a.java new file mode 100644 index 00000000000..84671463029 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue002a.java @@ -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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003.java new file mode 100644 index 00000000000..aacff00cae4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003.java @@ -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; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003/TestDescription.java new file mode 100644 index 00000000000..46db4cbe221 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003/TestDescription.java @@ -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 + 1, Integer.MAX_VALUE and Integer.MAX_VALUE + 1. + * IndexOutOfBoundsException is expected or, when array have no initalization, + * 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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003a.java new file mode 100644 index 00000000000..7ecd02fa1bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValue/getvalue003a.java @@ -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; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001.java new file mode 100644 index 00000000000..0d721b15599 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001/TestDescription.java new file mode 100644 index 00000000000..a299fc158af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001a.java new file mode 100644 index 00000000000..0fcbee7cd35 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues001a.java @@ -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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002.java new file mode 100644 index 00000000000..c8d1d291d91 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002/TestDescription.java new file mode 100644 index 00000000000..34b586309af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002a.java new file mode 100644 index 00000000000..5e24cdc74c8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues002a.java @@ -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[] = {}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003.java new file mode 100644 index 00000000000..10a6cdf9f66 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003.java @@ -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; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003/TestDescription.java new file mode 100644 index 00000000000..895c54b5440 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003a.java new file mode 100644 index 00000000000..c95c01f9d11 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues/getvalues003a.java @@ -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]; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001.java new file mode 100644 index 00000000000..b7052f73007 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001/TestDescription.java new file mode 100644 index 00000000000..e38c4bbf1ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001a.java new file mode 100644 index 00000000000..39e1ba05658 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii001a.java @@ -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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002.java new file mode 100644 index 00000000000..7ca97a15833 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002/TestDescription.java new file mode 100644 index 00000000000..d885d97fc93 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002a.java new file mode 100644 index 00000000000..6a0bcf0563a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii002a.java @@ -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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003.java new file mode 100644 index 00000000000..60c83e998b3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003/TestDescription.java new file mode 100644 index 00000000000..579d2eeea27 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003/TestDescription.java @@ -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}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003a.java new file mode 100644 index 00000000000..0c9d4da7e5a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii003a.java @@ -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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004.java new file mode 100644 index 00000000000..b24ffddbf08 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004.java @@ -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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004/TestDescription.java new file mode 100644 index 00000000000..2edc4fee5af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004/TestDescription.java @@ -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/getvaluesii004. + * 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/getvaluesii004 checks assertion: + * public Value getValues(int index, int length) + * 1. IndexOutOfBoundsException is thrown, if the length is negative (except + * -1) or too large. Component type of array in debuggee is primitive. + * 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(0, i) that gets i elements form index i. Length is from + * MIN_LENGTH to -2 (-1 is legal) and from arrayRef.length() to MAX_LENGTH. + * IndexOutOfBoundsException is always expected. + * 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. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.getValues_ii.getvaluesii004 + * nsk.jdi.ArrayReference.getValues_ii.getvaluesii004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.getValues_ii.getvaluesii004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004a.java new file mode 100644 index 00000000000..c07b0ae7519 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii004a.java @@ -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 getvaluesii004a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + getvaluesii004aClassToCheck classToCheck = new getvaluesii004aClassToCheck(); + + 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 getvaluesii004aClassToCheck { + 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.MIN_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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005.java new file mode 100644 index 00000000000..b0dd52a77a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005.java @@ -0,0 +1,342 @@ +/* + * 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_ii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +/** The test cases include static and instance fields of int and Object types, + * which are one- and two- dimensional arrays (non-initialized arrays are + * considered as well). Values of the method parameter are presented as static + * two-dimensional array onto debuger, which includes the combinations of + * Integer.MAX_VALUE + 1, -1, 0, + * 1, Integer.MAX_VALUE.
    + * + * Expected results:
    + * - when index is 0 and length is -1, + * size of returned list has to be array length;
    + * - when index is 0 and length is 0, + * size if returned list has to be zero;
    + * - otherwise, IndexOutOfBoundsException is expected.
    + */ +public class getvaluesii005 { + + // 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; + + // parameters array to call com.sum.jdi.ArrayReference.getValues(int, int) + private static long[][] PARAM_ARRS = { + /* index */ /* length */ + {Integer.MAX_VALUE + 1, Integer.MAX_VALUE + 1}, + {Integer.MAX_VALUE + 1, -1}, + {Integer.MAX_VALUE + 1, 0}, + {Integer.MAX_VALUE + 1, 1}, + {Integer.MAX_VALUE + 1, Integer.MAX_VALUE}, + {-1, Integer.MAX_VALUE + 1}, + {-1, -1}, + {-1, 0}, + {-1, Integer.MAX_VALUE}, + {0, Integer.MAX_VALUE + 1}, + {0, -1}, + {0, 0}, + {0, Integer.MAX_VALUE}, + {Integer.MAX_VALUE, Integer.MAX_VALUE + 1}, + {Integer.MAX_VALUE, -1}, + {Integer.MAX_VALUE, 0}, + {Integer.MAX_VALUE, 1}, + {Integer.MAX_VALUE, Integer.MAX_VALUE} + }; + + private final static String prefix = "nsk.jdi.ArrayReference.getValues_ii."; + private final static String className = "getvaluesii005"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + + private int exitStatus; + private Log log; + private Debugee debugee; + private IOPipe pipe; + + public static void main(String argv[]) { + System.exit(JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + getvaluesii005 tstObj = new getvaluesii005(); + + 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(log,""); + 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 received."); + 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(objectToCheck); + if ( field == null ) { + complain("eventHandler:: Field '" + objectToCheck + "' not found."); + return false; + } + + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("eventHandler:: Field '" + objectToCheck + + "' not initialized."); + return false; + } + + return checkObjectFields(objectValue); + } + + public boolean checkObjectFields(Value objectValue) { + List fieldList; + if ( ! (objectValue instanceof ObjectReference) ) + return false; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + // Check all array fields from debugee + display("checkObjectFields:: Tests starts >>>"); + boolean res = true; + for (int i = 0; i < fieldList.size(); i++) { + res = checkFieldValue((ObjectReference )objectValue, + (Field )fieldList.get(i)) && res; + } + + exitStatus = res ? TEST_PASSED : TEST_FAILED; + return res; + } + + private boolean checkFieldValue(ObjectReference object, Field field) { + Value fieldValue; + ArrayReference arrayRef; + String fieldName = field.name(); + log.display(""); + display("checkObjectFields:: <" + fieldName + "> field is being " + + " checked."); + try { + fieldValue = object.getValue(field); + } catch (IllegalArgumentException e) { + complain("checkFieldValue:: can not get value for field " + fieldName); + complain("checkFieldValue:: " + e); + return false; + } + + display("checkFieldValue:: ***" + fieldName + " = " + fieldValue); + + // Tested object doesn't have non-initialized fields! + if ( fieldValue == null ) { + complain("checkFieldValue:: unexpected field value <" + + fieldValue + ">"); + return false; + } + + display("checkFieldValue:: *** type of " + fieldName + " = " + fieldValue.type()); + + // Checking up of value type. + // Tested object doesn't have other fields than be ArrayType + if ( ! (fieldValue.type() instanceof ArrayType) ) { + display("checkFieldValue:: type of value is not ArrayType."); + return false; + } + + boolean res = true; + + // Checking up of test cases. + for ( int i = 0; i < PARAM_ARRS.length; i++ ) { + res = checkValue(0, fieldName, (ArrayReference )fieldValue, + PARAM_ARRS[i][0], PARAM_ARRS[i][1]) && res; + } + return res; + } + + /** The metod returns the first item of the given ArrayReference + * as an array Value; or returns null if that item is + * not an array. + */ + private Value getFirstItemAsArray(ArrayReference arrayRef) { + Value itemValue = null; + try { + itemValue = arrayRef.getValue(0); + if ((itemValue != null) && !(itemValue.type() instanceof ArrayType)) + itemValue = null; + + } catch (IndexOutOfBoundsException e) { + } + return itemValue; + } + + private boolean checkValue(int depth, String name, ArrayReference arrayRef, + long index, long length) { + Value itemValue; + List list; + String il2Str = "for index=" + index + ", length=" + length; + int arrayLength = arrayRef.length(); + + itemValue = getFirstItemAsArray(arrayRef); + + if ( itemValue != null ) { + + // itemValue has array type, check it by the same way + long k = (arrayLength + 1 != index) ? index : + ((ArrayReference )itemValue).length() + 1; + if ( !checkValue(depth + 1, name, (ArrayReference )itemValue, k, length) ) + return false; + } + + try { + list = arrayRef.getValues((int )index, (int )length); + + if ( length == 0 ) { + + // expected list with zero-size + if ( list.size() != 0 ) + complain("checkValue[" + depth + "]:: List size is " + + list.size() + ", but list with zero-size " + + "expected " + il2Str); + else { + display("checkValue[" + depth + "]:: expected list zero-size " + + il2Str); + return true; + } + } else if ( length == -1 && index == 0 ) { + + // expected list size to be equal array length + if ( list.size() != arrayLength ) + complain("checkValue[" + depth + "]:: unexpected list size(" + + list.size() + ") != array length(" + + arrayLength + ") " + il2Str); + else { + display("checkValue[" + depth + "]:: expected list size(" + + list.size() + ") = array length(" + + arrayLength + ") " + il2Str); + return true; + } + } + + // ERR: IndexOutOfBoundsException was expected + complain("checkValue[" + depth + "]:: IndexOutOfBoundsException " + + "expected " + il2Str); + return false; + + } catch (IndexOutOfBoundsException e) { + + // checking specification conditions + if ( (index < 0 || index > arrayLength) || + ( (length != -1) && (length < 0 || index + length > arrayLength) ) ) { + display("checkValue[" + depth + "]:: expected IndexOutOfBoundsException " + + il2Str); + } else { + complain("checkValue[" + depth + "]:: unexpected IndexOutOfBoundsException " + + il2Str); + return false; + } + + } catch (Exception e) { + + complain("checkValue[" + depth + "]:: Unexpected exception: " + e); + return false; + } + return true; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005/TestDescription.java new file mode 100644 index 00000000000..30da601f592 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/getvaluesii005. + * 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.getValues(int, int) + * correctly works for the boundary value of parameter and complies with its + * 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. When there are no elements in the specified + * range (e.g. length is zero) an empty list is returned + * Throws: + * IndexOutOfBoundsException - if the range specified with index and + * length is not within the range of the array, that is, if either + * of the following are true: + * index < 0 + * index > length() + * or if length != -1 and either of the following are true: + * length < 0 + * index + length > length() + * The test cases include static and instance fields of int and Object types, + * which are one- and two- dimensional arrays (non-initialized arrays are + * considered too). Values of the method parameter are presented as static + * two-dimensional array into debuger, which includes the combinations of + * Integer.MAX_VALUE + 1, -1, 0, 1, Integer.MAX_VALUE. + * Expected results: + * - when index is 0 and length is -1, size of returned list has to be array + * length; + * - when index is 0 and length is 0, size if returned list has to be zero; + * - otherwise, IndexOutOfBoundsException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayReference.getValues_ii.getvaluesii005; + * the debuggee program - nsk.jdi.ArrayReference.getValues_ii.getvaluesii005a. + * 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 get a range of arry items 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_ii.getvaluesii005 + * nsk.jdi.ArrayReference.getValues_ii.getvaluesii005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.getValues_ii.getvaluesii005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005a.java new file mode 100644 index 00000000000..8eed353ca5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/getValues_ii/getvaluesii005a.java @@ -0,0 +1,110 @@ +/* + * 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_ii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class getvaluesii005a { + + static getvaluesii005aClassToCheck testedObj = new getvaluesii005aClassToCheck(); + + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(getvaluesii005.TEST_PASSED + getvaluesii005.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(getvaluesii005.TEST_FAILED + getvaluesii005.JCK_STATUS_BASE); + } +} + +class getvaluesii005aClassToCheck { + 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[][] staticIntArr0 = {{},{},{},{},{},{},{}}; + + public int[] publicIntArr0; + protected int[] protecIntArr0; + private int[] privatIntArr0; + + public int[] publicIntArrC; + protected int[] protecIntArrC; + private int[] privatIntArrC; + + public Object[] publicObjArr0; + protected Object[] protecObjArr0; + private Object[] privatObjArr0; + + public Object[] publicObjArrC; + protected Object[] protecObjArrC; + private Object[] privatObjArrC; + + public getvaluesii005aClassToCheck() { + publicIntArr0 = createIntArray(0); + protecIntArr0 = createIntArray(0); + privatIntArr0 = createIntArray(0); + + publicIntArrC = createIntArray(10); + protecIntArrC = createIntArray(10); + privatIntArrC = createIntArray(10); + + publicObjArr0 = createObjArray(0); + protecObjArr0 = createObjArray(0); + privatObjArr0 = createObjArray(0); + + publicObjArrC = createObjArray(10); + protecObjArrC = createObjArray(10); + privatObjArrC = createObjArray(10); + } + + static private int[] createIntArray(int length) { + int[] array = new int[length]; + for ( int i = 0; i < length; i++ ) array[i] = i; + return array; + } + + static private Object[] createObjArray(int length) { + Object[] array = new Object[length]; + return array; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001.java new file mode 100644 index 00000000000..bd714acb6a6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001.java @@ -0,0 +1,227 @@ +/* + * 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.length; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class length001 { + final static String FIELD_NAME[][] = { + {"z1", "0"}, + {"z2", "7"}, + {"b1", "1"}, + {"b2", "6"}, + {"c1", "2"}, + {"c2", "5"}, + {"d1", "3"}, + {"d2", "4"}, + {"f1", "4"}, + {"f2", "3"}, + {"i1", "5"}, + {"i2", "2"}, + {"l1", "6"}, + {"l2", "1"}, + {"r1", "7"}, + {"r2", "0"}, + + {"lF1", "3"}, + {"lP1", "3"}, + {"lU1", "2"}, + {"lR1", "2"}, + {"lT1", "1"}, + {"lV1", "1"}, + + {"E1", "0"}, + {"E2", "2"}, + {"X1", "1"}, + {"X2", "1"}, + {"O1", "2"}, + {"O2", "0"}, + + {"LF1", "3"}, + {"LP1", "3"}, + {"LU1", "2"}, + {"LR1", "2"}, + {"LT1", "1"}, + {"LV1", "1"}, + + {"EF1", "0"}, + {"EP1", "1"}, + {"EU1", "1"}, + {"ER1", "1"}, + {"ET1", "1"}, + {"EV1", "1"}, + }; + + private static Log log; + private final static String prefix = "nsk.jdi.ArrayReference.length."; + private final static String className = "length001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "ClassToCheck"; + + 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 realLength = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + int length; + String lengthStr; + + // 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 length of ArrayReference object + try { + length = arrayRef.length(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 4> Cannot get length for array " + + name); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field length is " + length); + lengthStr = realLength.valueOf(length); + + // Check array's length + if (!realLength.equals(lengthStr)) { + log.complain("debuger FAILURE 5> Length of array " + name + + " is " + length + ", but expected " + realLength); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001/TestDescription.java new file mode 100644 index 00000000000..b807c2ffe0d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001/TestDescription.java @@ -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/length/length001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the length() method of ArrayReference interface of + * com.sun.jdi package. + * The method spec: + * public int length() + * Returns the number of components in this array. + * Returns: the integer count of components in this array. + * Throws: ObjectCollectedException - if this object has been garbage + * collected. + * nsk/jdi/ArrayReference/length/length001 checks assertion: + * public int length() + * 1. Returns the number of components in this array. + * Debuggee defines a number of array fields with component types: + * - primitive types, + * - interface type, + * - classes, + * - array of primitive types, + * - array of component types, + * - array of classes. + * Debugger gets each field from debuggee by name, gets field's value and + * casts it to ArrayReference. Then the test gets length of this object + * invoking the method length(). Debugger already knows the length of the + * array (FIELD_NAME defines it) and compares returned and expected lengths + * of the array. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.length.length001 + * nsk.jdi.ArrayReference.length.length001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.length.length001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001a.java new file mode 100644 index 00000000000..c7cb2f8a570 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/length/length001a.java @@ -0,0 +1,103 @@ +/* + * 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.length; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class length001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + ClassToCheck classToCheck = new ClassToCheck(); + + 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 ClassToCheck { + // User class and interface + static class Class {} + static interface Inter {} + + static boolean z1[]={}; + static boolean z2[][]={z1, z1, z1, z1, z1, z1, z1}; + static byte b1[]={0}; + static byte b2[][]={b1, b1, b1, b1, b1, b1}; + static char c1[]={'\u00ff', '\u0f0f'}; + static char c2[][]={c1, c1, c1, c1, c1}; + static double d1[]={0, 1, -2}; + static double d2[][]={d1, d1, d1, d1}; + static float f1[]={0, 1, -2, 3}; + static float f2[][]={f1, f1, f1}; + static int i1[]={0, 1, -2, 3, -4}; + static int i2[][]={i1, i1}; + static long l1[]={0, 1, -2, 3, -4, 5}; + static long l2[][]={l1}; + static short r1[]={0, 1, -2, 3, -4, 5, -6}; + static short r2[][]={}; + + static final long lF1[]={1, -2, 3}; + static private long lP1[][]={{1}, {-2}, {3}}; + static public long lU1[][][]={{{1}}, {{-2}}}; + static protected long lR1[][][][]={{{{1}}}, {{{-2}}}}; + static transient long lT1[][][][][]={{{{{1}}}}}; + static volatile long lV1[][][][][][]={{{{{{1}}}}}}; + + static Inter E1[]={}; + static Inter E2[][]={E1, E1}; + static Class X1[]={new Class()}; + static Class X2[][]={X1}; + static Object O1[]={new Object(), new Object()}; + static Object O2[][]={}; + + static final Long LF1[]={new Long(1), new Long(-2), new Long(3)}; + static private Long LP1[][]={{new Long(1)}, {new Long(2)}, {new Long(3)}}; + static public Long LU1[][][]={{{new Long(1)}}, {{new Long(-2)}}}; + static protected Long LR1[][][][]={{{{new Long(1)}}}, {{{new Long(-2)}}}}; + static transient Long LT1[][][][][]={{{{{new Long(1)}}}}}; + static volatile Long LV1[][][][][][]={{{{{{new Long(1)}}}}}}; + + static final Inter EF1[]={}; + static private Inter EP1[][]={{}}; + static public Inter EU1[][][]={{{}}}; + static protected Inter ER1[][][][]={{{{}}}}; + static transient Inter ET1[][][][][]={{{{{}}}}}; + static volatile Inter EV1[][][][][][]={{{{{{}}}}}}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001.java new file mode 100644 index 00000000000..dac39a77154 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001.java @@ -0,0 +1,589 @@ +/* + * 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.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class setvalue001 { + final static int HALF = 9; + 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.setValue."; + private final static String className = "setvalue001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvalue001aClassToCheck"; + + 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; + } + + for (int j = 0; j < HALF; j++) { + int indexSample = j + HALF; + Value sample; + Value valueNew; + + // Get Value from sample-area (9..17 elements) + try { + sample = arrayRef.getValue(indexSample); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 4> Cannot get " + indexSample + + " value from field " + name); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 4> Cannot get " + indexSample + + " value from field " + name); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: sample from index " + + indexSample + " is " + sample); + + // Set the Sample to the correspondent index + // Any exception means that the test fails + try { + arrayRef.setValue(j, sample); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set value " + sample + + " to " + j + " index of field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 5> Cannot set value " + sample + + " to " + j + " index of field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set value " + sample + + " to " + j + " index of field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set value " + sample + + " to " + j + " index of field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set value " + sample + + " to " + j + " index of field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: sample " + sample + + " has been set to index " + j); + + + // Get the Value from the correspondent index + try { + valueNew = arrayRef.getValue(j); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 6> Cannot get " + j + " value" + + " from field " + name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 6> Cannot get " + j + " value" + + " from field " + name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: element from index " + j + + " is " + valueNew); + + // Check the Value that has been read with the sample + if (realType.equals("boolean")) { + + ///////////////////// Check boolean[] ///////////////////// + BooleanValue boolValue; + boolean boolSample; + boolean boolNew; + + // Cast sample and read Value to primitive type + try { + boolValue = (BooleanValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE Z1> Cannot cast to " + + "boolean sample."); + log.complain("debuger FAILURE Z1> Exception: " + e); + testFailed = true; + continue; + } + boolSample = boolValue.value(); + try { + boolValue = (BooleanValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE Z2> Cannot cast to " + + "boolean read value."); + log.complain("debuger FAILURE Z2> Exception: " + e); + testFailed = true; + continue; + } + boolNew = boolValue.value(); + + // Check two primitive values + if (boolNew != boolSample) { + log.complain("debuger FAILURE Z3> " + j + " element " + + "of array " + name + " was expected " + + boolSample + ", but returned " + boolNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + boolSample + ", primitive " + + " read value is " + boolNew); + } + } else if (realType.equals("byte")) { + + ///////////////////// Check byte[] ///////////////////// + ByteValue byteValue; + byte byteSample; + byte byteNew; + + // Cast sample and read Value to primitive type + try { + byteValue = (ByteValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE B1> Cannot cast to " + + "byte sample."); + log.complain("debuger FAILURE B1> Exception: " + e); + testFailed = true; + continue; + } + byteSample = byteValue.value(); + try { + byteValue = (ByteValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE B2> Cannot cast to " + + "byte read value."); + log.complain("debuger FAILURE B2> Exception: " + e); + testFailed = true; + continue; + } + byteNew = byteValue.value(); + + // Check two primitive values + if (byteNew != byteSample) { + log.complain("debuger FAILURE B3> " + j + " element " + + "of array " + name + " was expected " + + byteSample + ", but returned " + byteNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + byteSample + ", primitive " + + "read value is " + byteNew); + } + } else if (realType.equals("char")) { + + ///////////////////// Check char[] ///////////////////// + CharValue charValue; + char charSample; + char charNew; + + // Cast sample and read Value to primitive type + try { + charValue = (CharValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE C1> Cannot cast to " + + "char sample."); + log.complain("debuger FAILURE C1> Exception: " + e); + testFailed = true; + continue; + } + charSample = charValue.value(); + try { + charValue = (CharValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE C2> Cannot cast to " + + "char read value."); + log.complain("debuger FAILURE C2> Exception: " + e); + testFailed = true; + continue; + } + charNew = charValue.value(); + + // Check two primitive values + if (charNew != charSample) { + log.complain("debuger FAILURE C3> " + j + " element " + + "of array " + name + " was expected " + + charSample + ", but returned " + charNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + charSample + ", primitive " + + "read value is " + charNew); + } + } else if (realType.equals("int")) { + + ///////////////////// Check int[] ///////////////////// + IntegerValue intValue; + int intSample; + int intNew; + + // Cast sample and read Value to primitive type + try { + intValue = (IntegerValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE I1> Cannot cast to " + + "int sample."); + log.complain("debuger FAILURE I1> Exception: " + e); + testFailed = true; + continue; + } + intSample = intValue.value(); + try { + intValue = (IntegerValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE I2> Cannot cast to " + + "int read value."); + log.complain("debuger FAILURE I2> Exception: " + e); + testFailed = true; + continue; + } + intNew = intValue.value(); + + // Check two primitive values + if (intNew != intSample) { + log.complain("debuger FAILURE I3> " + j + " element " + + "of array " + name + " was expected " + + intSample + ", but returned " + intNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + intSample + ", primitive " + + "read value is " + intNew); + } + } else if (realType.equals("long")) { + + ///////////////////// Check long[] ///////////////////// + LongValue longValue; + long longSample; + long longNew; + + // Cast sample and read Value to primitive type + try { + longValue = (LongValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE L1> Cannot cast to " + + "long sample."); + log.complain("debuger FAILURE L1> Exception: " + e); + testFailed = true; + continue; + } + longSample = longValue.value(); + try { + longValue = (LongValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE L2> Cannot cast to " + + "long read value."); + log.complain("debuger FAILURE L2> Exception: " + e); + testFailed = true; + continue; + } + longNew = longValue.value(); + + // Check two primitive values + if (longNew != longSample) { + log.complain("debuger FAILURE L3> " + j + " element " + + "of array " + name + " was expected " + + longSample + ", but returned " + longNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + longSample + ", primitive " + + "read value is " + longNew); + } + } else if (realType.equals("short")) { + + ///////////////////// Check short[] ///////////////////// + ShortValue shortValue; + short shortSample; + short shortNew; + + // Cast sample and read Value to primitive type + try { + shortValue = (ShortValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE R1> Cannot cast to " + + "short sample."); + log.complain("debuger FAILURE R1> Exception: " + e); + testFailed = true; + continue; + } + shortSample = shortValue.value(); + try { + shortValue = (ShortValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE R2> Cannot cast to " + + "short read value."); + log.complain("debuger FAILURE R2> Exception: " + e); + testFailed = true; + continue; + } + shortNew = shortValue.value(); + + // Check two primitive values + if (shortNew != shortSample) { + log.complain("debuger FAILURE R3> " + j + " element " + + "of array " + name + " was expected " + + shortSample + ", but returned " + + shortNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + shortSample + ", primitive " + + "read value is " + shortNew); + } + } else if (realType.equals("double")) { + + ///////////////////// Check double[] ///////////////////// + DoubleValue dblValue; + Double dblSample; + Double dblNew; + + // Cast sample and read Value to primitive type + try { + dblValue = (DoubleValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE D1> Cannot cast to " + + "double sample."); + log.complain("debuger FAILURE D1> Exception: " + e); + testFailed = true; + continue; + } + dblSample = new Double(dblValue.value()); + try { + dblValue = (DoubleValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE D2> Cannot cast to " + + "double read value."); + log.complain("debuger FAILURE D2> Exception: " + e); + testFailed = true; + continue; + } + dblNew = new Double(dblValue.value()); + + // Check two primitive values + if (!dblNew.equals(dblSample)) { + log.complain("debuger FAILURE D3> " + j + " element " + + "of array " + name + " was expected " + + dblSample + ", but returned " + dblNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + dblSample + ", primitive " + + "read value is " + dblNew); + } + } else if (realType.equals("float")) { + + ///////////////////// Check float[] ///////////////////// + FloatValue fltValue; + Float fltSample; + Float fltNew; + + // Cast sample and read Value to primitive type + try { + fltValue = (FloatValue)sample; + } catch (ClassCastException e) { + log.complain("debuger FAILURE F1> Cannot cast to " + + "float sample."); + log.complain("debuger FAILURE F1> Exception: " + e); + testFailed = true; + continue; + } + fltSample = new Float(fltValue.value()); + try { + fltValue = (FloatValue)valueNew; + } catch (ClassCastException e) { + log.complain("debuger FAILURE F2> Cannot cast to " + + "float read value."); + log.complain("debuger FAILURE F2> Exception: " + e); + testFailed = true; + continue; + } + fltNew = new Float(fltValue.value()); + + // Check two primitive values + if (!fltNew.equals(fltSample)) { + log.complain("debuger FAILURE F3> " + j + " element " + + "of array " + name + " was expected " + + fltSample + ", but returned " + fltNew); + testFailed = true; + } else { + log.display("debuger> " + i + " field: primitive " + + "sample is " + fltSample + ", primitive " + + "read value is " + fltNew); + } + } 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001/TestDescription.java new file mode 100644 index 00000000000..4628f356f84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001/TestDescription.java @@ -0,0 +1,86 @@ +/* + * 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/setValue/setvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValue(int, Value) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValue(int index, Value value) throws InvalidTypeException, + * ClassNotLoadedException + * Replaces an array component with another value. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: value - the new value + * index - the index of the component to set + * Throws: java.lang.IndexOutOfBoundsException - if index is beyond the end of + * this array. + * InvalidTypeException - if the type value is not compatible with the + * declared type of array components. + * ClassNotLoadedException - if the array component type has not yet + * been loaded through the appropriate class loader. + * ObjectCollectedException - if this object or the new value has been + * garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValue/setvalue001 checks assertion: + * public void setValue(int index, Value value) + * 1. Replaces an array component with another value. Array has components of + * primitive types only, index is in array bounds. + * Debuggee defines a number of array fields which component type is primitive + * type only. Each array has 18 components. + * Debugger gets each field from debuggee by name, gets its value and casts it + * to ArrayReference. Then debugger for each field does the following. + * The test gets elements from indexes 8, 9, 10, ..., 17 and sets them to + * 0, 1, 2, ..., 7 indexes of the same ArrayReference. And then checks values + * in the array (0, ..., 7). Debugger gets tested elements from the array, + * casts it to correspondent PrimitiveType and 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.setValue.setvalue001 + * nsk.jdi.ArrayReference.setValue.setvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValue.setvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001a.java new file mode 100644 index 00000000000..2869f6b04e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue001a.java @@ -0,0 +1,109 @@ +/* + * 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.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvalue001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvalue001aClassToCheck classToCheck = new setvalue001aClassToCheck(); + + 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 setvalue001aClassToCheck { + + // Each array has 18 components + // 0..8 are to set and get values, 9..17 are to get sample Value in + // debugger + static boolean z1[] = {false, true, false, true, true, true, false, + false, true, + true, false, true, false, false, false, true, + true, false}; + static byte b1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE + 1, -4, 4, Byte.MAX_VALUE - 1}; + static char c1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Character.MIN_VALUE, '\u00ff', '\uff00', + Character.MAX_VALUE, Character.MIN_VALUE + 1, + '\u1234', '\u4321', '\u8888', + Character.MAX_VALUE - 1}; + static double d1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0, + 0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY, + Double.NaN}; + static float f1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, + 0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY, + Float.NaN}; + static int i1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, + Integer.MIN_VALUE + 1, -2, 2, Integer.MAX_VALUE - 1}; + static long l1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + Long.MIN_VALUE + 1, -2, 2, Long.MAX_VALUE - 1}; + static short r1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE + 1, -3, 3, Short.MAX_VALUE - 1}; + + static final long lF1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + 1, 2, 3, 4, 5, 6, 7, 8, 9}; + static private long lP1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + 100, 101, 102, 103, 104, 105, 106, 107, 108}; + static public long lU1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + -1, -2, -3, -4, -5, -6, -7, -8, -9}; + static protected long lR1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Long.MIN_VALUE, Long.MIN_VALUE + 1, + Long.MIN_VALUE + 2, Long.MIN_VALUE + 3, + Long.MIN_VALUE + 4, Long.MIN_VALUE + 5, + Long.MIN_VALUE + 6, Long.MIN_VALUE + 7, + Long.MIN_VALUE + 8}; + static transient long lT1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + Long.MAX_VALUE, Long.MAX_VALUE - 1, + Long.MAX_VALUE - 2, Long.MAX_VALUE - 3, + Long.MAX_VALUE - 4, Long.MAX_VALUE - 5, + Long.MAX_VALUE - 6, Long.MAX_VALUE - 7, + Long.MAX_VALUE - 8}; + static volatile long lV1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, + 1, -1, 1, 0, -1, 1, 0, -1, 1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002.java new file mode 100644 index 00000000000..66ace08d1c8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002.java @@ -0,0 +1,362 @@ +/* + * 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.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class setvalue002 { + final static int MIN_INDEX = -50; + final static int MAX_INDEX = 51; + final static String FIELD_NAME[][] = { + {"z1", "5", "boolean"}, + {"b1", "5", "byte"}, + {"c1", "6", "char"}, + {"d1", "1", "double"}, + {"f1", "1", "float"}, + {"i1", "10", "int"}, + {"l1", "2", "long"}, + {"r1", "5", "short"}, + + {"lF1", "0", "long"}, + {"lP1", "2", "long"}, + {"lU1", "3", "long"}, + {"lR1", "4", "long"}, + {"lT1", "5", "long"}, + {"lV1", "6", "long"} + }; + + private static Log log; + private final static String prefix = "nsk.jdi.ArrayReference.setValue."; + private final static String className = "setvalue002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvalue002aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + Value valueBoolean = null; + Value valueByte = null; + Value valueChar = null; + Value valueDouble = null; + Value valueFloat = null; + Value valueInt = null; + Value valueLong = null; + Value valueShort = null; + + // 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"); + + // Get all samples of primitive types Values to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z"); + fieldByte = refType.fieldByName("b"); + fieldChar = refType.fieldByName("c"); + fieldDouble = refType.fieldByName("d"); + fieldFloat = refType.fieldByName("f"); + fieldInt = refType.fieldByName("i"); + fieldLong = refType.fieldByName("l"); + fieldShort = refType.fieldByName("r"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + valueBoolean = refType.getValue(fieldBoolean); + valueByte = refType.getValue(fieldByte); + valueChar = refType.getValue(fieldChar); + valueDouble = refType.getValue(fieldDouble); + valueFloat = refType.getValue(fieldFloat); + valueInt = refType.getValue(fieldInt); + valueLong = refType.getValue(fieldLong); + valueShort = refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample values for primitive types."); + log.display("debuger> boolean is " + valueBoolean); + log.display("debuger> byte is " + valueByte); + log.display("debuger> char is " + valueChar); + log.display("debuger> double is " + valueDouble); + log.display("debuger> float is " + valueFloat); + log.display("debuger> int is " + valueInt); + log.display("debuger> long is " + valueLong); + log.display("debuger> short is " + valueShort + "\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]); + String type = FIELD_NAME[i][2]; + int lastElementIndex = totalElements.intValue() - 1; + Value value; + ArrayReference arrayRef; + Value valueToSet; + + // 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; + } + + // Prepare Value to set + if (type.equals("boolean")) { + valueToSet = (Value)valueBoolean; + } else if (type.equals("byte")) { + valueToSet = (Value)valueByte; + } else if (type.equals("char")) { + valueToSet = (Value)valueChar; + } else if (type.equals("double")) { + valueToSet = (Value)valueDouble; + } else if (type.equals("float")) { + valueToSet = (Value)valueFloat; + } else if (type.equals("int")) { + valueToSet = (Value)valueInt; + } else if (type.equals("long")) { + valueToSet = (Value)valueLong; + } else if (type.equals("short")) { + valueToSet = (Value)valueShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Try to set 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) ) { + + // Set the Value, IndexOutOfBoundsException is expected + try { + arrayRef.setValue(j, valueToSet); + log.complain("debuger FAILURE 5> IndexOutOfBoundsException" + + "is not thrown. "); + testFailed = true; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set value " + + valueToSet + " to " + j + " index of " + + "field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + } catch (IndexOutOfBoundsException e) { + log.display("debuger> " + i + " field: cannot set " + + "value " + valueToSet + " with index " + + j + ". Expected exception: " + e); + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set value " + + valueToSet + " to " + j + " index of " + + "field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set value " + + valueToSet + " to " + j + " index of " + + "field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set value " + + valueToSet + " to " + j + " index of " + + "field " + name); + log.complain("debuger FAILURE 5> 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002/TestDescription.java new file mode 100644 index 00000000000..72913a5f525 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/setValue/setvalue002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValue(int, Value) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValue(int index, Value value) throws InvalidTypeException, + * ClassNotLoadedException + * Replaces an array component with another value. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: value - the new value + * index - the index of the component to set + * Throws: java.lang.IndexOutOfBoundsException - if index is beyond the end of + * this array. + * InvalidTypeException - if the type value is not compatible with the + * declared type of array components. + * ClassNotLoadedException - if the array component type has not yet + * been loaded through the appropriate class loader. + * ObjectCollectedException - if this object or the new value has been + * garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValue/setvalue002 checks assertion: + * public void setValue(int index, Value value) + * 1. IndexOutOfBoundsException is thrown if index is out of bounds of this + * array. Array has components of primitive types only. + * Debuggee defines eight sample fields of primitive types. Also it defines + * a number of tested array fields which component type is primitive type only. + * Those arrays have different lengths. + * Debugger gets each sample field from debuggee by name and gets its + * PrimitiveValue. After that the test gets tested array fields by name, gets + * their values, casts to ArrayReference types. And then sets sample values + * to the correspondent tested arrays invoking the method + * setValues(int, Value). Index is from MIN_INDEX to -1 and from + * arrayRef.length() to MAX_INDEX, so IndexOutOfBoundsException is expected. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.setValue.setvalue002 + * nsk.jdi.ArrayReference.setValue.setvalue002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValue.setvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002a.java new file mode 100644 index 00000000000..8caf2f4db64 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue002a.java @@ -0,0 +1,83 @@ +/* + * 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.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvalue002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvalue002aClassToCheck classToCheck = new setvalue002aClassToCheck(); + + 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 setvalue002aClassToCheck { + + // Samples + static boolean z = true; + static byte b = (byte)1; + static char c = '\uff00'; + static double d = -1; + static float f = 2; + static int i = -3; + static long l = 4; + static short r = -5; + + // Arrays + 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}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003.java new file mode 100644 index 00000000000..e9a22291b24 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003.java @@ -0,0 +1,331 @@ +/* + * 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.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvalue003 { + + // 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; + + // parameters arrays to call com.sum.jdi.ArrayReference.setValue(int, Value) + private static long[] INDEX_PARAM = { Integer.MAX_VALUE + 1, + -1, + 0, + Integer.MAX_VALUE + }; + private final static String BYTE_VALUES_FIELD = "BYTE_VALUE_PARAM"; + private final static String CHAR_VALUES_FIELD = "CHAR_VALUE_PARAM"; + private final static String DBL_VALUES_FIELD = "DBL_VALUE_PARAM"; + private final static String FLT_VALUES_FIELD = "FLT_VALUE_PARAM"; + private final static String INT_VALUES_FIELD = "INT_VALUE_PARAM"; + private final static String LNG_VALUES_FIELD = "LNG_VALUE_PARAM"; + private final static String SHORT_VALUES_FIELD= "SHORT_VALUE_PARAM"; + + private final static String prefix = "nsk.jdi.ArrayReference.setValue."; + private final static String className = "setvalue003"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + + private int exitStatus; + private Log log; + private Debugee debugee; + private IOPipe pipe; + private ReferenceType refType; + + public static void main(String argv[]) { + System.exit(JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + setvalue003 tstObj = new setvalue003(); + + 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 received."); + 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; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("eventHandler:: Class '" + debugeeName + "' not found."); + return false; + } + + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("eventHandler:: Field '" + objectToCheck + "' not found."); + return false; + } + + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("eventHandler:: Field '" + objectToCheck + + "' not initialized."); + return false; + } + + return checkObjectFields(objectValue); + } + + public boolean checkObjectFields(Value objectValue) { + List fieldList; + if ( ! (objectValue instanceof ObjectReference) ) + return false; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + // Check all array fields from debugee + display("checkObjectFields:: Tests starts >>>"); + boolean res = true; + for (int i = 0; i < fieldList.size(); i++) { + res = checkFieldValue((ObjectReference )objectValue, + (Field )fieldList.get(i)) && res; + } + + exitStatus = res ? TEST_PASSED : TEST_FAILED; + return res; + } + + private boolean checkFieldValue(ObjectReference object, Field field) { + Value fieldValue; + ArrayReference arrayRef; + String fieldName = field.name(); + log.display(""); + display("<" + fieldName + "> field is being checked."); + try { + fieldValue = object.getValue(field); + } catch (IllegalArgumentException e) { + complain("checkFieldValue:: can not get value for field " + fieldName); + complain("checkFieldValue:: " + e); + return false; + } + + display("***" + fieldName + " = " + fieldValue); + + // Tested object doesn't have non-initialized fields! + if ( fieldValue == null ) { + complain("unexpected field value <" + + fieldValue + ">"); + return false; + } + + display("*** type of " + fieldName + " = " + fieldValue.type()); + + // Checking up of value type. + // Tested object doesn't have other fields than be ArrayType + if ( ! (fieldValue.type() instanceof ArrayType) ) { + display("type of value is not ArrayType."); + return false; + } + + boolean res = true; + + Type itemType; + try { + itemType = ((ArrayType )fieldValue.type()).componentType(); + } catch(Exception e) { + complain("Unexpected " + e.getClass().getName() ); + return false; + } + + // getting value to set from debugee with defined type + Field fieldOfValues = null; + if ( itemType instanceof ByteType ) { + fieldOfValues = refType.fieldByName(BYTE_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + BYTE_VALUES_FIELD + "' not found."); + return false; + } + } else if ( itemType instanceof CharType ) { + fieldOfValues = refType.fieldByName(CHAR_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + CHAR_VALUES_FIELD + "' not found."); + return false; + } + } else if ( itemType instanceof DoubleType ) { + fieldOfValues = refType.fieldByName(DBL_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + DBL_VALUES_FIELD + "' not found."); + return false; + } + } else if ( itemType instanceof FloatType ) { + fieldOfValues = refType.fieldByName(FLT_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + FLT_VALUES_FIELD + "' not found."); + return false; + } + } else if ( itemType instanceof IntegerType ) { + fieldOfValues = refType.fieldByName(INT_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + INT_VALUES_FIELD + "' not found."); + return false; + } + } else if ( itemType instanceof LongType ) { + fieldOfValues = refType.fieldByName(LNG_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + LNG_VALUES_FIELD + "' not found."); + return false; + } + } else if ( itemType instanceof ShortType ) { + fieldOfValues = refType.fieldByName(SHORT_VALUES_FIELD); + if ( fieldOfValues == null ) { + complain("Field '" + SHORT_VALUES_FIELD + "' not found."); + return false; + } + } + + ArrayReference values = (ArrayReference )refType.getValue(fieldOfValues); + + // Checking up of test cases. + for ( int i = 0; i < INDEX_PARAM.length; i++ ) { + for ( int j = 0; j < values.length(); j++ ) { + res = checkValueUpdating(fieldName, + (ArrayReference )fieldValue, INDEX_PARAM[i], + values.getValue(j)) && res; + } + } + return res; + } + + private boolean checkValueUpdating(String name, + ArrayReference arrayRef, long index, Value value) { + Value itemValue; + List list; + String il2Str = "for index=" + index + " value=" + value; + int arrayLength = arrayRef.length(); + + try { + arrayRef.setValue((int )index, value); + Value v1 = arrayRef.getValue((int )index); + + if ( !value.equals(v1) ) { + complain("not correct value " + v1 + + " " + il2Str); + return false; + } + + if ( index < 0 || index >= arrayLength ) { + complain("IndexOutOfBoundsException is expected " + il2Str); + return false; + } else { + display("Value " + v1 + " is set " + il2Str); + } + + } catch (IndexOutOfBoundsException e) { + + // checking specification conditions + if ( index < 0 || index >= arrayLength ) { + display("expected IndexOutOfBoundsException " + + il2Str); + } else { + complain("unexpected IndexOutOfBoundsException " + + il2Str); + return false; + } + + } catch (Exception e) { + complain("Unexpected exception: " + + e + " " + il2Str); + return false; + } + return true; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003/TestDescription.java new file mode 100644 index 00000000000..50fb25695b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003/TestDescription.java @@ -0,0 +1,96 @@ +/* + * 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/setValue/setvalue003. + * 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.setValue(int, Value) + * correctly works for the boundary value of parameter and complies with its + * spec: + * public void setValue(int index, Value value) + * throws InvalidTypeException, + * ClassNotLoadedException + * Replaces an array component with another value. + * Object values must be assignment compatible with the component type + * (This implies that the component type must be loaded through the + * declaring class's class loader). Primitive values must be either + * assignment compatible with the component type or must be + * convertible to the component type without loss of information. See + * JLS section 5.2 for more information on assignment compatibility. + * Parameters: + * value - the new value + * index - the index of the component to set + * Throws: + * IndexOutOfBoundsException - if index is outside the range of this + * array, that is, if either of the following are true: + * index < 0 + * index >= length() + * InvalidTypeException - if the type of value is not compatible with + * the declared type of array components. + * ClassNotLoadedException - if the array component type has not yet + * been loaded through the appropriate class loader. + * The test cases include instance fields of the primitive types, which are + * one-dimensional arrays. Possible values of parameter of the method + * are presented as static array at the debugee part for each primitive types. + * These values include boundary values of each primitive types. Possible + * values of parameter are presented as static array at the debuger + * part. + * Expected results: + * for every values of parameter the method has to work without any + * errors, except of cases when either index < 0 or index >= length(). + * The test works as follows: + * The debugger program - nsk.jdi.ArrayReference.setValue.setvalue003; + * the debuggee program - nsk.jdi.ArrayReference.setValue.setvalue003a. + * 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 set a value of arry items 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.setValue.setvalue003 + * nsk.jdi.ArrayReference.setValue.setvalue003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValue.setvalue003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003a.java new file mode 100644 index 00000000000..66d83816ade --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValue/setvalue003a.java @@ -0,0 +1,117 @@ +/* + * 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.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvalue003a { + + static setvalue003aClassToCheck testedObj = new setvalue003aClassToCheck(); + + // Value parameter's array for debugee's int-arrays + public static byte[] BYTE_VALUE_PARAM = { Byte.MIN_VALUE, + Byte.MAX_VALUE + }; + + public static char[] CHAR_VALUE_PARAM = { Character.MIN_VALUE, + Character.MAX_VALUE + }; + + public static double[] DBL_VALUE_PARAM = { Double.MIN_VALUE, + Double.MAX_VALUE, + Double.NEGATIVE_INFINITY, + Double.POSITIVE_INFINITY + }; + + public static float[] FLT_VALUE_PARAM = { Float.MIN_VALUE, + Float.MAX_VALUE, + Float.NEGATIVE_INFINITY, + Float.POSITIVE_INFINITY + }; + + public static int[] INT_VALUE_PARAM = { Integer.MIN_VALUE, + Integer.MAX_VALUE + }; + + public static long[] LNG_VALUE_PARAM = { Long.MIN_VALUE, + Long.MAX_VALUE + }; + + public static short[] SHORT_VALUE_PARAM = { Short.MIN_VALUE, + Short.MAX_VALUE + }; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(setvalue003.TEST_PASSED + setvalue003.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(setvalue003.TEST_FAILED + setvalue003.JCK_STATUS_BASE); + } +} + +class setvalue003aClassToCheck { + public byte[] publicByteArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected byte[] protecByteArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private byte[] privatByteArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public char[] publicCharArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + protected char[] protecCharArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + private char[] privatCharArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + + public double[] publicDoubleArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected double[] protecDoubleArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private double[] privatDoubleArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public float[] publicFloatArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected float[] protecFloatArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private float[] privatFloatArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public int[] publicIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected int[] protecIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private int[] privatIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public long[] publicLongArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected long[] protecLongArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private long[] privatLongArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public short[] publicShortArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected short[] protecShortArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private short[] privatShortArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001.java new file mode 100644 index 00000000000..bd3d891451b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001.java @@ -0,0 +1,874 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesilii001 { + final static int LENGTH = 14; + final static String FIELD_NAME[][] = { + {"d1", "double"}, + {"f1", "float"}, + {"b1", "byte"}, + {"i1", "int"}, + {"l1", "long"}, + {"r1", "short"}, + {"c1", "char"}, + {"z1", "boolean"}, + + {"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, true, true, true, true, + false, false, false, false, false, false, + false}; + final static byte BYTE[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1, + 13, 14}; + + final static char CHAR[] = {Character.MIN_VALUE, '\u00ff', '\uff00', + '\u1234', '\u4321', '\ufedc', '\ucdef', + Character.MAX_VALUE, + 9, 10, 11, 12, 13, 14}; + final 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, -1}; + final static float FLOAT[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, + -1, -0, 0, 1, Float.MAX_VALUE, + Float.POSITIVE_INFINITY, Float.NaN, + Float.NaN, -0, 1, -1, + 14}; + final static int INT[] = {Integer.MIN_VALUE, -1, 0, 1, + Integer.MAX_VALUE, Integer.MIN_VALUE, -1, 0, + 1, Integer.MAX_VALUE, -1, + 12, 13, 14}; + final static long LONG[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + 11, 12, 13, 14}; + final static short SHORT[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0, 1, + 10, 11, 12, 13, 14}; + final static long LONGF[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + Long.MIN_VALUE, + 7, 8, 9, 10, 11, 12, 13, 14}; + final static long LONGP[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + 6, 7, 8, 9, 10, 11, 12, 13, 14}; + final static long LONGU[] = {Long.MIN_VALUE, -1, 0, 1, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + final static long LONGR[] = {Long.MIN_VALUE, -1, 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + final static long LONGT[] = {Long.MIN_VALUE, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + final static long LONGV[] = {Long.MIN_VALUE, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + + private static Log log; + private final static String prefix + = "nsk.jdi.ArrayReference.setValues_ilii."; + private final static String className = "setvaluesilii001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesilii001aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long") || + type.equals("long_final") || + type.equals("long_private") || + type.equals("long_public") || + type.equals("long_protected") || + type.equals("long_transient") || + type.equals("long_volatile") ) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(0, listToSet, 0, LENGTH - i); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: sublist of values set " + + listToSet.subList(0, LENGTH - i) + " from index 0."); + + // Get the list of Values and check them + try { + listRead = arrayRef.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 6> Cannot get values from field " + + name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: list of values read " + + listRead); + + for (int j = 0; j < listRead.size(); j++) { + if (type.equals("boolean")) { + + ///////////////////// Check boolean[] ///////////////////// + BooleanValue boolValue; + boolean element; + + try { + boolValue = (BooleanValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE Z1> Cannot cast to " + + "boolean " + j + " value of list " + + listRead); + 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 (type.equals("byte")) { + + ///////////////////// Check byte[] ///////////////////// + ByteValue byteValue; + byte element; + + try { + byteValue = (ByteValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE B1> Cannot cast to " + + "byte " + j + " value of list " + + listRead); + 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 (type.equals("char")) { + + ///////////////////// Check char[] ///////////////////// + CharValue charValue; + char element; + + try { + charValue = (CharValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE C1> Cannot cast to " + + "char " + j + " value of list " + + listRead); + 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 (type.equals("int")) { + + ///////////////////// Check int[] ///////////////////// + IntegerValue intValue; + int element; + + try { + intValue = (IntegerValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE I1> Cannot cast to " + + "int " + j + " value of list " + + listRead); + 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 (type.equals("long")) { + + ///////////////////// Check long[] ///////////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE L1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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 (type.equals("long_final")) { + + ///////////////////// Check final long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LF1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LF2> " + j + " element " + + "of array " + name + " was expected " + + LONGF[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_private")) { + + ///////////////////// Check private long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LP1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LP2> " + j + " element " + + "of array " + name + " was expected " + + LONGP[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_public")) { + + ///////////////////// Check public long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LU1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LU2> " + j + " element " + + "of array " + name + " was expected " + + LONGU[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_protected")) { + + ///////////////////// Check protected long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LR1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LR2> " + j + " element " + + "of array " + name + " was expected " + + LONGR[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_transient")) { + + ///////////////////// Check transient long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LT1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LT2> " + j + " element " + + "of array " + name + " was expected " + + LONGT[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_volatile")) { + + ///////////////////// Check volatile long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LV1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LV2> " + j + " element " + + "of array " + name + " was expected " + + LONGV[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("short")) { + + ///////////////////// Check short[] ///////////////////// + ShortValue shortValue; + short element; + + try { + shortValue = (ShortValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE R1> Cannot cast to " + + "short " + j + " value of list " + + listRead); + 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 if (type.equals("double")) { + + ///////////////////// Check double[] ///////////////////// + DoubleValue doubleValue; + Double element; + + try { + doubleValue = (DoubleValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE D1> Cannot cast to " + + "double " + j + " value of list " + + listRead); + log.complain("debuger FAILURE D1> 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 (type.equals("float")) { + + ///////////////////// Check float[] ///////////////////// + FloatValue floatValue; + Float element; + + try { + floatValue = (FloatValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE F1> Cannot cast to " + + "float " + j + " value of list " + + listRead); + log.complain("debuger FAILURE F1> 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 { + log.complain("debuger FAILURE 6> Unexpected type: " + type); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001/TestDescription.java new file mode 100644 index 00000000000..1a69531b533 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/setValues_ilii/setvaluesilii001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(int, List, int, int) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValues(int index, List values, int srcIndex, int length) + * throws InvalidTypeException, ClassNotLoadedException + * Replaces a range of array components with other values. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: index - the index of the first component to set. + * values - a list of Value objects to be placed in this array. + * srcIndex - the index of the first source value to to use. + * length - the number of components to set, or -1 to set all + * components to the end of this array. + * Throws: InvalidTypeException - if any element of values is not compatible + * with the declared type of array components. + * java.lang.IndexOutOfBoundsException - if srcIndex + length is beyond + * the end of this array or if values is smaller inside than the + * given range. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001 checks assertion: + * public void setValues(int index, List values, int srcIndex, int length) + * 1. Replaces a range of array components with other values. Array has + * components of primitive types only. Index and srcIndex are in array's + * bounds. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields. All arrays have 14 elements. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types. For i field the method + * setValues(0, List, 0, LENGTH - i) is invoked to set LENGTH - i elements of + * sample array from index 0 to ArrayReference from index 0. + * After that the test gets all Values of the array and checks them. 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.setValues_ilii.setvaluesilii001 + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001a.java new file mode 100644 index 00000000000..e67bf80e4ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii001a.java @@ -0,0 +1,104 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesilii001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesilii001aClassToCheck classToCheck = new setvaluesilii001aClassToCheck(); + + 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 setvaluesilii001aClassToCheck { + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0, + 0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY, + Double.NaN, Double.NaN, -0, 0, 1, -1}; + static float f1S[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, 0, + 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY, + Float.NaN, Float.NaN, -0, 1, -1, + 14}; + static byte b1S[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1, + 13, 14}; + static int i1S[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, + Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, -1, + 12, 13, 14}; + static long l1S[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + 11, 12, 13, 14}; + static short r1S[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0, 1, + 10, 11, 12, 13, 14}; + static char c1S[] = {Character.MIN_VALUE, '\u00ff', '\uff00', '\u1234', + '\u4321', '\ufedc', '\ucdef', Character.MAX_VALUE, + 9, 10, 11, 12, 13, 14}; + static boolean z1S[] = {true, false, false, true, true, true, true, + false, true, + false, false, false, false, false, false, false}; + + static boolean z1[] = {false, false, false, false, false, false, false, + false, false, false, false, false, false, false}; + static byte b1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static char c1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static double d1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static float f1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static int i1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static long l1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static short r1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + + static final long lF1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static private long lP1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static public long lU1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static protected long lR1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static transient long lT1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static volatile long lV1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002.java new file mode 100644 index 00000000000..4e44a7de091 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002.java @@ -0,0 +1,879 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesilii002 { + final static String FIELD_NAME[][] = { + {"d1", "double"}, + {"f1", "float"}, + {"b1", "byte"}, + {"i1", "int"}, + {"l1", "long"}, + {"r1", "short"}, + {"c1", "char"}, + {"z1", "boolean"}, + + {"lF1", "long_final"}, + {"lP1", "long_private"}, + {"lU1", "long_public"}, + {"lR1", "long_protected"}, + {"lT1", "long_transient"}, + {"lV1", "long_volatile"} + }; + + final static boolean BOOL[] = {false, false, false, false, false, false, + false, true, false, false, true, true, + true, true, false, true}; + final static byte BYTE[] = {1, 2, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1}; + + final static char CHAR[] = {1, 2, 3, 4, 5, 6, + Character.MIN_VALUE, '\u00ff', '\uff00', + '\u1234', '\u4321', '\ufedc', '\ucdef', + 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, + Double.NaN, -0, 0, 1, -1}; + final static float FLOAT[] = {1, + Float.NEGATIVE_INFINITY, Float.MIN_VALUE, + -1, -0, 0, 1, Float.MAX_VALUE, + Float.POSITIVE_INFINITY, Float.NaN, + Float.NaN, -0, 1, -1}; + final static int INT[] = {1, 2, 3, + Integer.MIN_VALUE, -1, 0, 1, + Integer.MAX_VALUE, Integer.MIN_VALUE, -1, 0, + 1, Integer.MAX_VALUE, -1}; + final static long LONG[] = {1, 2, 3, 4, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE}; + final static short SHORT[] = {1, 2, 3, 4, 5, + Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0, 1}; + final static long LONGF[] = {1, 2, 3, 4, 5, 6, 7, 8, + Long.MAX_VALUE, Long.MIN_VALUE, -1, 0, 1, + Long.MAX_VALUE}; + final static long LONGP[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE}; + final static long LONGU[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + -1, 0, 1, Long.MAX_VALUE}; + final static long LONGR[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 0, 1, Long.MAX_VALUE}; + final static long LONGT[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 1, Long.MAX_VALUE}; + final static long LONGV[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + Long.MAX_VALUE}; + + private static Log log; + private final static String prefix + = "nsk.jdi.ArrayReference.setValues_ilii."; + private final static String className = "setvaluesilii002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesilii002aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long") || + type.equals("long_final") || + type.equals("long_private") || + type.equals("long_public") || + type.equals("long_protected") || + type.equals("long_transient") || + type.equals("long_volatile") ) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(i, listToSet, i, -1); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: sublist of values set " + + listToSet.subList(i, listToSet.size() - 1) + + " from index " + i); + + // Get the list of Values and check them + try { + listRead = arrayRef.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 6> Cannot get values from field " + + name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: list of values read " + + listRead); + + for (int j = 0; j < listRead.size(); j++) { + if (type.equals("boolean")) { + + ///////////////////// Check boolean[] ///////////////////// + BooleanValue boolValue; + boolean element; + + try { + boolValue = (BooleanValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE Z1> Cannot cast to " + + "boolean " + j + " value of list " + + listRead); + 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 (type.equals("byte")) { + + ///////////////////// Check byte[] ///////////////////// + ByteValue byteValue; + byte element; + + try { + byteValue = (ByteValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE B1> Cannot cast to " + + "byte " + j + " value of list " + + listRead); + 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 (type.equals("char")) { + + ///////////////////// Check char[] ///////////////////// + CharValue charValue; + char element; + + try { + charValue = (CharValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE C1> Cannot cast to " + + "char " + j + " value of list " + + listRead); + 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 (type.equals("int")) { + + ///////////////////// Check int[] ///////////////////// + IntegerValue intValue; + int element; + + try { + intValue = (IntegerValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE I1> Cannot cast to " + + "int " + j + " value of list " + + listRead); + 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 (type.equals("long")) { + + ///////////////////// Check long[] ///////////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE L1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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 (type.equals("long_final")) { + + ///////////////////// Check final long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LF1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LF2> " + j + " element " + + "of array " + name + " was expected " + + LONGF[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_private")) { + + ///////////////////// Check private long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LP1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LP2> " + j + " element " + + "of array " + name + " was expected " + + LONGP[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_public")) { + + ///////////////////// Check public long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LU1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LU2> " + j + " element " + + "of array " + name + " was expected " + + LONGU[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_protected")) { + + ///////////////////// Check protected long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LR1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LR2> " + j + " element " + + "of array " + name + " was expected " + + LONGR[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_transient")) { + + ///////////////////// Check transient long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LT1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LT2> " + j + " element " + + "of array " + name + " was expected " + + LONGT[j] + ", but returned " + element); + testFailed = true; + continue; + } + } else if (type.equals("long_volatile")) { + + ///////////////////// Check volatile long[] //////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE LV1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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]) { + log.complain("debuger FAILURE LV2> " + j + " element " + + "of array " + name + " was expected " + + LONGV[j] + ", but returned " + element); + testFailed = true; + continue; + } + + + + + + } else if (type.equals("short")) { + + ///////////////////// Check short[] ///////////////////// + ShortValue shortValue; + short element; + + try { + shortValue = (ShortValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE R1> Cannot cast to " + + "short " + j + " value of list " + + listRead); + 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 if (type.equals("double")) { + + ///////////////////// Check double[] ///////////////////// + DoubleValue doubleValue; + Double element; + + try { + doubleValue = (DoubleValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE D1> Cannot cast to " + + "double " + j + " value of list " + + listRead); + log.complain("debuger FAILURE D1> 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 (type.equals("float")) { + + ///////////////////// Check float[] ///////////////////// + FloatValue floatValue; + Float element; + + try { + floatValue = (FloatValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE F1> Cannot cast to " + + "float " + j + " value of list " + + listRead); + log.complain("debuger FAILURE F1> 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 { + log.complain("debuger FAILURE 6> Unexpected type: " + type); + testFailed = true; + break; + } + } + log.display("debuger> " + i + " field checked.\n"); + } + + pipe.println("quit"); + debugee.waitFor(); + int status = debugee.getStatus(); + if (testFailed) { + log.display("debuger FAILURE> TEST FAILED"); + return 0; + } 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002/TestDescription.java new file mode 100644 index 00000000000..23eb5c93894 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002/TestDescription.java @@ -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/ArrayReference/setValues_ilii/setvaluesilii002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(int, List, int, int) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValues(int index, List values, int srcIndex, int length) + * throws InvalidTypeException, ClassNotLoadedException + * Replaces a range of array components with other values. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: index - the index of the first component to set. + * values - a list of Value objects to be placed in this array. + * srcIndex - the index of the first source value to to use. + * length - the number of components to set, or -1 to set all + * components to the end of this array. + * Throws: InvalidTypeException - if any element of values is not compatible + * with the declared type of array components. + * java.lang.IndexOutOfBoundsException - if srcIndex + length is beyond + * the end of this array or if values is smaller inside than the + * given range. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002 checks assertion: + * public void setValues(int index, List values, int srcIndex, int length) + * 1. Replaces all components to the end of this array with other values. Array + * has components of primitive types only. Index and srcIndex are in array's + * bounds. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields. All arrays have 14 elements. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types. For i field the method setValues(0, List, 0, -1) is + * invoked to set all elements of sample array from index 0 to ArrayReference + * from index 0. + * After that the test gets all Values of the array and checks them. 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 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii002 + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002a.java new file mode 100644 index 00000000000..bfa5e0ecc18 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii002a.java @@ -0,0 +1,104 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesilii002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesilii002aClassToCheck classToCheck = new setvaluesilii002aClassToCheck(); + + 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 setvaluesilii002aClassToCheck { + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0, + 0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY, + Double.NaN, Double.NaN, -0, 0, 1, -1}; + static float f1S[] = {0, + Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, 0, + 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY, + Float.NaN, Float.NaN, -0, 1, -1}; + static byte b1S[] = {0, 1, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, + Byte.MIN_VALUE, -1}; + static int i1S[] = {0, 1, 2, + Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, + Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, -1}; + static long l1S[] = {0, 1, 2, 3, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, + Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE}; + static short r1S[] = {0, 1, 2, 3, 4, + Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0, 1}; + static char c1S[] = {0, 1, 2, 3, 4, 5, + Character.MIN_VALUE, '\u00ff', '\uff00', '\u1234', + '\u4321', '\ufedc', '\ucdef', Character.MAX_VALUE}; + static boolean z1S[] = {false, false, false, false, false, false, false, + true, false, false, true, true, true, true, + false, true}; + + static boolean z1[] = {false, false, false, false, false, false, false, + false, false, false, false, false, false, false}; + static byte b1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static char c1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static double d1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static float f1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static int i1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static long l1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + static short r1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + + static final long lF1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static private long lP1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static public long lU1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static protected long lR1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static transient long lT1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; + static volatile long lV1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003.java new file mode 100644 index 00000000000..7077c381c1d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003.java @@ -0,0 +1,415 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesilii003 { + 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.setValues_ilii."; + private final static String className = "setvaluesilii003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesilii003aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + log.display("debuger> " + i + " field has length " + + arrayRef.length()); + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long") ) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(0, listToSet, 0, listToSet.size() + 1 ); + log.complain("debuger FAILURE 5> IndexOutOfBoundsException is " + + "not thrown."); + log.complain("debuger FAILURE 5> " + i + " field: list of " + + "values " + listToSet + " with length " + + listToSet.size() + " set from index 0."); + testFailed = true; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + // List of values is smaller inside than the given range, so + // IndexOutOfBoundsException is expected + log.display("debuger> Cannot set list of values " + listToSet + + " to the field " + name); + log.display("debuger> Exception: " + e); + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003/TestDescription.java new file mode 100644 index 00000000000..a2b97262909 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003/TestDescription.java @@ -0,0 +1,98 @@ +/* + * 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/setValues_ilii/setvaluesilii003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(int, List, int, int) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValues(int index, List values, int srcIndex, int length) + * throws InvalidTypeException, ClassNotLoadedException + * Replaces a range of array components with other values. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: index - the index of the first component to set. + * values - a list of Value objects to be placed in this array. + * srcIndex - the index of the first source value to to use. + * length - the number of components to set, or -1 to set all + * components to the end of this array. + * Throws: InvalidTypeException - if any element of values is not compatible + * with the declared type of array components. + * java.lang.IndexOutOfBoundsException - if srcIndex + length is beyond + * the end of this array or if values is smaller inside than the + * given range. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003 checks assertion: + * public void setValues(int index, List values, int srcIndex, int length) + * 1. IndexOutOfBoundsException is thrown if the list is smaller then the + * array. Array has components of primitive types only. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields. For each primitive type a sample + * array has at least one element less then correspondent tested array. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types. For i field the method + * setValues(0, List, 0, List.size()) is invoked to set all elements of sample + * array from index 0 to ArrayReference from index 0. Since sample array has + * at least one element less tested array, IndexOutOfBoundsException is + * expected. + * COMMENTS + * The tests shows the bug + * 4448721: ArrayReference.setValues(int, List, int, int) doesn't throw + * IndexOutOfBoundsException + * =========================== + * To fix the bug 4491099, + * the string + * arrayRef.setValues(0, listToSet, 0, listToSet.size()); + * is replaced with + * arrayRef.setValues(0, listToSet, 0, listToSet.size() + 1 ); + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii003 + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003a.java new file mode 100644 index 00000000000..37e472c1ed6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii003a.java @@ -0,0 +1,92 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesilii003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesilii003aClassToCheck classToCheck = new setvaluesilii003aClassToCheck(); + + 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 setvaluesilii003aClassToCheck { + + // For each primitive type a sample array has at least one element less + // then correspondent tested array + static boolean z1[] = {false, false}; + static boolean z1S[] = {true}; + + static byte b1[] = {1, 2, 3}; + static byte b1S[] = {Byte.MIN_VALUE, Byte.MAX_VALUE}; + + static char c1[] = {1, 2, 3, 4}; + static char c1S[] = {Character.MIN_VALUE, '\u00ff', Character.MAX_VALUE}; + + static double d1[] = {1, 2, 3, 4, 5}; + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0}; + + static float f1[] = {1, 2, 3, 4, 5, 6}; + static float f1S[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, + Float.NaN}; + + static int i1[] = {1, 2, 3, 4, 5, 6, 7}; + static int i1S[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, -1}; + + static long l1[] = {1, 2, 3, 4, 5, 6, 7, 8}; + static long l1S[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + + static short r1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + static short r1S[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0}; + + static final long lF1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + static private long lP1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + static public long lU1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + static protected long lR1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; + static transient long lT1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14}; + static volatile long lV1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004.java new file mode 100644 index 00000000000..ca447ac0d47 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004.java @@ -0,0 +1,415 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesilii004 { + 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.setValues_ilii."; + private final static String className = "setvaluesilii004"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesilii004aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + log.display("debuger> " + i + " field has length " + + arrayRef.length()); + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long") ) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(0, listToSet, 1, listToSet.size()); + log.complain("debuger FAILURE 5> IndexOutOfBoundsException is " + + "not thrown."); + log.complain("debuger FAILURE 5> " + i + " field: list of " + + "values " + listToSet + " with length " + + listToSet.size() + " set from index 1."); + testFailed = true; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + // srcIndex + length is out of the range, so + // IndexOutOfBoundsException is expected + log.display("debuger> Cannot set list of values " + listToSet + + " to the field " + name); + log.display("debuger> Exception: " + e); + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004/TestDescription.java new file mode 100644 index 00000000000..6d67705d4cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/setValues_ilii/setvaluesilii004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(int, List, int, int) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValues(int index, List values, int srcIndex, int length) + * throws InvalidTypeException, ClassNotLoadedException + * Replaces a range of array components with other values. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: index - the index of the first component to set. + * values - a list of Value objects to be placed in this array. + * srcIndex - the index of the first source value to to use. + * length - the number of components to set, or -1 to set all + * components to the end of this array. + * Throws: InvalidTypeException - if any element of values is not compatible + * with the declared type of array components. + * java.lang.IndexOutOfBoundsException - if srcIndex + length is beyond + * the end of this array or if values is smaller inside than the + * given range. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004 checks assertion: + * public void setValues(int index, List values, int srcIndex, int length) + * 1. IndexOutOfBoundsException is thrown if srcIndex + length is beyond the + * end of this array. Array has components of primitive types only. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields. Sample and correspondent tested + * arrays have the same lengths. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types. For i field the method + * setValues(0, List, 1, List.size()) is invoked to set all elements of sample + * array from index 0 to ArrayReference from index 1. Since srcIndex + length + * is beyond the end of this array, IndexOutOfBoundsException should be thrown. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii004 + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004a.java new file mode 100644 index 00000000000..19d60cfe25b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii004a.java @@ -0,0 +1,90 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesilii004a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesilii004aClassToCheck classToCheck = new setvaluesilii004aClassToCheck(); + + 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 setvaluesilii004aClassToCheck { + + // For each primitive type a sample array has the same length as + // correspondent tested array + static boolean z1[] = {false}; + static boolean z1S[] = {true}; + + static byte b1[] = {1, 2}; + static byte b1S[] = {Byte.MIN_VALUE, Byte.MAX_VALUE}; + + static char c1[] = {1, 2, 3}; + static char c1S[] = {Character.MIN_VALUE, '\u00ff', Character.MAX_VALUE}; + + static double d1[] = {1, 2, 3, 4}; + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0}; + + static float f1[] = {1, 2, 3, 4, 5}; + static float f1S[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, + Float.NaN}; + + static int i1[] = {1, 2, 3, 4, 5, 6}; + static int i1S[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, -1}; + + static long l1[] = {1, 2, 3, 4, 5, 6, 7}; + static long l1S[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + + static short r1[] = {1, 2, 3, 4, 5, 6, 7, 8}; + static short r1S[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0}; + + static final long lF1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static private long lP1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static public long lU1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static protected long lR1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static transient long lT1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static volatile long lV1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005.java new file mode 100644 index 00000000000..5422f9deb11 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005.java @@ -0,0 +1,416 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesilii005 { + 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.setValues_ilii."; + private final static String className = "setvaluesilii005"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesilii005aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + log.display("debuger> " + i + " field has length " + + arrayRef.length()); + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long") ) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(0, listToSet, 0, listToSet.size() + 1); + log.complain("debuger FAILURE 5> IndexOutOfBoundsException is " + + "not thrown."); + log.complain("debuger FAILURE 5> " + i + " field: list of " + + "values " + listToSet + " with length " + + (listToSet.size() + 1) + " set from index 1."); + testFailed = true; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + // srcIndex + length is out of the range, so + // IndexOutOfBoundsException is expected + log.display("debuger> Cannot set list of values " + listToSet + + " with length " + (listToSet.size() + 1) + + " to the field " + name); + log.display("debuger> Exception: " + e); + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005/TestDescription.java new file mode 100644 index 00000000000..15acaa8bcb0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/setValues_ilii/setvaluesilii005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(int, List, int, int) method of ArrayReference + * interface of com.sun.jdi package. + * The method spec: + * public void setValues(int index, List values, int srcIndex, int length) + * throws InvalidTypeException, ClassNotLoadedException + * Replaces a range of array components with other values. + * Object values must be assignment compatible with the component type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: index - the index of the first component to set. + * values - a list of Value objects to be placed in this array. + * srcIndex - the index of the first source value to to use. + * length - the number of components to set, or -1 to set all + * components to the end of this array. + * Throws: InvalidTypeException - if any element of values is not compatible + * with the declared type of array components. + * java.lang.IndexOutOfBoundsException - if srcIndex + length is beyond + * the end of this array or if values is smaller inside than the + * given range. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005 checks assertion: + * public void setValues(int index, List values, int srcIndex, int length) + * 1. IndexOutOfBoundsException is thrown if srcIndex + length is beyond the + * end of this array. Array has components of primitive types only. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields. Sample and correspondent tested + * arrays have the same lengths. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types. For i field the method + * setValues(0, List, 1, List.size() + 1) is invoked to set all elements of + * sample array from index 0 to ArrayReference from index 1. Since + * srcIndex + length is beyond the end of this array, IndexOutOfBoundsException + * should be thrown. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii005 + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_ilii.setvaluesilii005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005a.java new file mode 100644 index 00000000000..5ebfccebe5c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_ilii/setvaluesilii005a.java @@ -0,0 +1,90 @@ +/* + * 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.setValues_ilii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesilii005a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesilii005aClassToCheck classToCheck = new setvaluesilii005aClassToCheck(); + + 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 setvaluesilii005aClassToCheck { + + // For each primitive type a sample array has the same length as + // correspondent tested array + static boolean z1[] = {false}; + static boolean z1S[] = {true}; + + static byte b1[] = {1, 2}; + static byte b1S[] = {Byte.MIN_VALUE, Byte.MAX_VALUE}; + + static char c1[] = {1, 2, 3}; + static char c1S[] = {Character.MIN_VALUE, '\u00ff', Character.MAX_VALUE}; + + static double d1[] = {1, 2, 3, 4}; + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0}; + + static float f1[] = {1, 2, 3, 4, 5}; + static float f1S[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, + Float.NaN}; + + static int i1[] = {1, 2, 3, 4, 5, 6}; + static int i1S[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, -1}; + + static long l1[] = {1, 2, 3, 4, 5, 6, 7}; + static long l1S[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + + static short r1[] = {1, 2, 3, 4, 5, 6, 7, 8}; + static short r1S[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, + Short.MIN_VALUE, -1, 0}; + + static final long lF1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static private long lP1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static public long lU1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static protected long lR1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static transient long lT1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; + static volatile long lV1[] = {-2, -1, 0, 1, Long.MAX_VALUE, 0, 1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001.java new file mode 100644 index 00000000000..323b8b06677 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001.java @@ -0,0 +1,669 @@ +/* + * 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.setValues_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesl001 { + 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"} + }; + + 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, Integer.MIN_VALUE + 1}; + 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}; + + private static Log log; + private final static String prefix = "nsk.jdi.ArrayReference.setValues_l."; + private final static String className = "setvaluesl001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesl001aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long")) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(listToSet); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: list of values set " + + listToSet); + + // Get the list of Values and check them + try { + listRead = arrayRef.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 6> Cannot get values from field " + + name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: list of values read " + + listRead); + + for (int j = 0; j < listRead.size(); j++) { + if (type.equals("boolean")) { + + ///////////////////// Check boolean[] ///////////////////// + BooleanValue boolValue; + boolean element; + + try { + boolValue = (BooleanValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE Z1> Cannot cast to " + + "boolean " + j + " value of list " + + listRead); + 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 (type.equals("byte")) { + + ///////////////////// Check byte[] ///////////////////// + ByteValue byteValue; + byte element; + + try { + byteValue = (ByteValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE B1> Cannot cast to " + + "byte " + j + " value of list " + + listRead); + 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 (type.equals("char")) { + + ///////////////////// Check char[] ///////////////////// + CharValue charValue; + char element; + + try { + charValue = (CharValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE C1> Cannot cast to " + + "char " + j + " value of list " + + listRead); + 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 (type.equals("int")) { + + ///////////////////// Check int[] ///////////////////// + IntegerValue intValue; + int element; + + try { + intValue = (IntegerValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE I1> Cannot cast to " + + "int " + j + " value of list " + + listRead); + 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 (type.equals("long")) { + + ///////////////////// Check long[] ///////////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE L1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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 (type.equals("short")) { + + ///////////////////// Check short[] ///////////////////// + ShortValue shortValue; + short element; + + try { + shortValue = (ShortValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE R1> Cannot cast to " + + "short " + j + " value of list " + + listRead); + 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 if (type.equals("double")) { + + ///////////////////// Check double[] ///////////////////// + DoubleValue doubleValue; + Double element; + + try { + doubleValue = (DoubleValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE D1> Cannot cast to " + + "double " + j + " value of list " + + listRead); + log.complain("debuger FAILURE D1> 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 (type.equals("float")) { + + ///////////////////// Check float[] ///////////////////// + FloatValue floatValue; + Float element; + + try { + floatValue = (FloatValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE F1> Cannot cast to " + + "float " + j + " value of list " + + listRead); + log.complain("debuger FAILURE F1> 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 { + log.complain("debuger FAILURE 6> Unexpected type: " + type); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001/TestDescription.java new file mode 100644 index 00000000000..c2ccf452b28 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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/setValues_l/setvaluesl001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(List) method of ArrayReference interface of + * com.sun.jdi package. + * The method spec: + * public void setValues(List values) throws InvalidTypeException, + * ClassNotLoadedException + * Replaces all array components with other values. If the given list is + * larger is size than the array, the values at the end of the list are + * ignored. + * Object values must be assignment compatible with the element type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: values - a list of Value objects to be placed in this array + * Throws: InvalidTypeException - if any of the values is not compatible with + * the declared type of array components. + * java.lang.IndexOutOfBoundsException - if the size of values is + * larger than the length of this array. + * ClassNotLoadedException - if the array component type has not yet + * been loaded through the appropriate class loader. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValue_l/setvaluesl001 checks assertion: + * public Vvoid setValues(List values) + * 1. Replaces all array components with other values. Array has components of + * primitive types only. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields, that have the same length as + * correspondent sample field. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types and invoke the method setValues(List) to set the + * sample list to that ArrayReference. + * After that the test gets all Values of the array and checks them. 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.setValues_l.setvaluesl001 + * nsk.jdi.ArrayReference.setValues_l.setvaluesl001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_l.setvaluesl001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001a.java new file mode 100644 index 00000000000..6aa2b1db051 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl001a.java @@ -0,0 +1,91 @@ +/* + * 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.setValues_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesl001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesl001aClassToCheck classToCheck = new setvaluesl001aClassToCheck(); + + 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 setvaluesl001aClassToCheck { + static boolean z1[] = {false, true}; + static boolean z1S[] = {true, false}; + + static byte b1[] = {0, 1, 2, 3, 4}; + static byte b1S[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE}; + + static char c1[] = {0, 1, 2, 3}; + static char c1S[] = {Character.MIN_VALUE, '\u00ff', '\uff00', + Character.MAX_VALUE}; + + static double d1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0, + 0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY, + Double.NaN}; + + static float f1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + static float f1S[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, + 0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY, + Float.NaN}; + + static int i1[] = {0, 1, 2, 3, 4, 5}; + static int i1S[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, + Integer.MIN_VALUE + 1}; + + static long l1[] = {0, 1, 2, 3, 4}; + static long l1S[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE}; + + static short r1[] = {0, 1, 2, 3, 4}; + static short r1S[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE}; + + static final long lF1[] = {0, 1, 2, 3, 4}; + static private long lP1[] = {0, 1, 2, 3, 4}; + static public long lU1[] = {0, 1, 2, 3, 4}; + static protected long lR1[] = {0, 1, 2, 3, 4}; + static transient long lT1[] = {0, 1, 2, 3, 4}; + static volatile long lV1[] = {0, 1, 2, 3, 4}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002.java new file mode 100644 index 00000000000..d4f7f631581 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002.java @@ -0,0 +1,669 @@ +/* + * 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.setValues_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesl002 { + 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"} + }; + + 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, Integer.MIN_VALUE + 1}; + 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}; + + private static Log log; + private final static String prefix = "nsk.jdi.ArrayReference.setValues_l."; + private final static String className = "setvaluesl002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "setvaluesl002aClassToCheck"; + + 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; + Field fieldBoolean = null; + Field fieldByte = null; + Field fieldChar = null; + Field fieldDouble = null; + Field fieldFloat = null; + Field fieldInt = null; + Field fieldLong = null; + Field fieldShort = null; + ArrayReference arrayBoolean = null; + ArrayReference arrayByte = null; + ArrayReference arrayChar = null; + ArrayReference arrayDouble = null; + ArrayReference arrayFloat = null; + ArrayReference arrayInt = null; + ArrayReference arrayLong = null; + ArrayReference arrayShort = null; + List listBoolean = null; + List listByte = null; + List listChar = null; + List listDouble = null; + List listFloat = null; + List listInt = null; + List listLong = null; + List listShort = null; + + // 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"); + + // Get all array samples of primitive types to set it to the + // ArrayReference + try { + fieldBoolean = refType.fieldByName("z1S"); + fieldByte = refType.fieldByName("b1S"); + fieldChar = refType.fieldByName("c1S"); + fieldDouble = refType.fieldByName("d1S"); + fieldFloat = refType.fieldByName("f1S"); + fieldInt = refType.fieldByName("i1S"); + fieldLong = refType.fieldByName("l1S"); + fieldShort = refType.fieldByName("r1S"); + } catch (ClassNotPreparedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get field by name."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + fieldBoolean); + log.complain("debuger FAILURE> byte is " + fieldByte); + log.complain("debuger FAILURE> char is " + fieldChar); + log.complain("debuger FAILURE> double is " + fieldDouble); + log.complain("debuger FAILURE> float is " + fieldFloat); + log.complain("debuger FAILURE> int is " + fieldInt); + log.complain("debuger FAILURE> long is " + fieldLong); + log.complain("debuger FAILURE> short is " + fieldShort); + return 2; + } + log.display("debuger> Got sample fields for primitive types."); + log.display("debuger> boolean is " + fieldBoolean); + log.display("debuger> byte is " + fieldByte); + log.display("debuger> char is " + fieldChar); + log.display("debuger> double is " + fieldDouble); + log.display("debuger> float is " + fieldFloat); + log.display("debuger> int is " + fieldInt); + log.display("debuger> long is " + fieldLong); + log.display("debuger> short is " + fieldShort + "\n"); + + if ((fieldBoolean == null) || (fieldByte == null) || + (fieldChar == null) || (fieldDouble == null) || + (fieldFloat == null) || (fieldInt == null) || + (fieldLong == null) || (fieldShort == null)) { + log.complain("debuger FAILURE> Cannot find field in debuggee."); + return 2; + } + + try { + arrayBoolean = (ArrayReference)refType.getValue(fieldBoolean); + arrayByte = (ArrayReference)refType.getValue(fieldByte); + arrayChar = (ArrayReference)refType.getValue(fieldChar); + arrayDouble = (ArrayReference)refType.getValue(fieldDouble); + arrayFloat = (ArrayReference)refType.getValue(fieldFloat); + arrayInt = (ArrayReference)refType.getValue(fieldInt); + arrayLong = (ArrayReference)refType.getValue(fieldLong); + arrayShort = (ArrayReference)refType.getValue(fieldShort); + } catch (IllegalArgumentException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get values for fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } catch (ClassCastException e) { + log.complain("debuger FAILURE> Cannot get array reference for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + arrayBoolean); + log.complain("debuger FAILURE> byte is " + arrayByte); + log.complain("debuger FAILURE> char is " + arrayChar); + log.complain("debuger FAILURE> double is " + arrayDouble); + log.complain("debuger FAILURE> float is " + arrayFloat); + log.complain("debuger FAILURE> int is " + arrayInt); + log.complain("debuger FAILURE> long is " + arrayLong); + log.complain("debuger FAILURE> short is " + arrayShort); + return 2; + } + log.display("debuger> Got sample array references for primitive " + + "types."); + log.display("debuger> boolean is " + arrayBoolean); + log.display("debuger> byte is " + arrayByte); + log.display("debuger> char is " + arrayChar); + log.display("debuger> double is " + arrayDouble); + log.display("debuger> float is " + arrayFloat); + log.display("debuger> int is " + arrayInt); + log.display("debuger> long is " + arrayLong); + log.display("debuger> short is " + arrayShort + "\n"); + + try { + listBoolean = arrayBoolean.getValues(); + listByte = arrayByte.getValues(); + listChar = arrayChar.getValues(); + listDouble = arrayDouble.getValues(); + listFloat = arrayFloat.getValues(); + listInt = arrayInt.getValues(); + listLong = arrayLong.getValues(); + listShort = arrayShort.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get list of values for " + + "fields."); + log.complain("debuger FAILURE> Exception: " + e); + log.complain("debuger FAILURE> boolean is " + listBoolean); + log.complain("debuger FAILURE> byte is " + listByte); + log.complain("debuger FAILURE> char is " + listChar); + log.complain("debuger FAILURE> double is " + listDouble); + log.complain("debuger FAILURE> float is " + listFloat); + log.complain("debuger FAILURE> int is " + listInt); + log.complain("debuger FAILURE> long is " + listLong); + log.complain("debuger FAILURE> short is " + listShort); + return 2; + } + log.display("debuger> Got list of values for primitive types."); + log.display("debuger> boolean is " + listBoolean); + log.display("debuger> byte is " + listByte); + log.display("debuger> char is " + listChar); + log.display("debuger> double is " + listDouble); + log.display("debuger> float is " + listFloat); + log.display("debuger> int is " + listInt); + log.display("debuger> long is " + listLong); + log.display("debuger> short is " + listShort + "\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 type = FIELD_NAME[i][1]; + Value value; + ArrayReference arrayRef; + List listToSet; + List listRead; + + // 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; + } + + // Prepare list to set + if (type.equals("boolean")) { + listToSet = listBoolean; + } else if (type.equals("byte")) { + listToSet = listByte; + } else if (type.equals("char")) { + listToSet = listChar; + } else if (type.equals("double")) { + listToSet = listDouble; + } else if (type.equals("float")) { + listToSet = listFloat; + } else if (type.equals("int")) { + listToSet = listInt; + } else if (type.equals("long")) { + listToSet = listLong; + } else if (type.equals("short")) { + listToSet = listShort; + } else { + log.complain("debuger FAILURE 4> Unexpected type: " + type); + testFailed = true; + continue; + } + + // Set the sample list of values + try { + arrayRef.setValues(listToSet); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (IndexOutOfBoundsException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (InvalidTypeException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } catch (VMMismatchException e) { + log.complain("debuger FAILURE 5> Cannot set list of values " + + listToSet + " to the field " + name); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: list of values set " + + listToSet); + + // Get the list of Values and check them + try { + listRead = arrayRef.getValues(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 6> Cannot get values from field " + + name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field: list of values read " + + listRead); + + for (int j = 0; j < listRead.size(); j++) { + if (type.equals("boolean")) { + + ///////////////////// Check boolean[] ///////////////////// + BooleanValue boolValue; + boolean element; + + try { + boolValue = (BooleanValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE Z1> Cannot cast to " + + "boolean " + j + " value of list " + + listRead); + 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 (type.equals("byte")) { + + ///////////////////// Check byte[] ///////////////////// + ByteValue byteValue; + byte element; + + try { + byteValue = (ByteValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE B1> Cannot cast to " + + "byte " + j + " value of list " + + listRead); + 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 (type.equals("char")) { + + ///////////////////// Check char[] ///////////////////// + CharValue charValue; + char element; + + try { + charValue = (CharValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE C1> Cannot cast to " + + "char " + j + " value of list " + + listRead); + 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 (type.equals("int")) { + + ///////////////////// Check int[] ///////////////////// + IntegerValue intValue; + int element; + + try { + intValue = (IntegerValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE I1> Cannot cast to " + + "int " + j + " value of list " + + listRead); + 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 (type.equals("long")) { + + ///////////////////// Check long[] ///////////////////// + LongValue longValue; + long element; + + try { + longValue = (LongValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE L1> Cannot cast to " + + "long " + j + " value of list " + + listRead); + 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 (type.equals("short")) { + + ///////////////////// Check short[] ///////////////////// + ShortValue shortValue; + short element; + + try { + shortValue = (ShortValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE R1> Cannot cast to " + + "short " + j + " value of list " + + listRead); + 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 if (type.equals("double")) { + + ///////////////////// Check double[] ///////////////////// + DoubleValue doubleValue; + Double element; + + try { + doubleValue = (DoubleValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE D1> Cannot cast to " + + "double " + j + " value of list " + + listRead); + log.complain("debuger FAILURE D1> 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 (type.equals("float")) { + + ///////////////////// Check float[] ///////////////////// + FloatValue floatValue; + Float element; + + try { + floatValue = (FloatValue)listRead.get(j); + } catch (ClassCastException e) { + log.complain("debuger FAILURE F1> Cannot cast to " + + "float " + j + " value of list " + + listRead); + log.complain("debuger FAILURE F1> 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 { + log.complain("debuger FAILURE 6> Unexpected type: " + type); + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002/TestDescription.java new file mode 100644 index 00000000000..8ba9379c161 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002/TestDescription.java @@ -0,0 +1,97 @@ +/* + * 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/setValues_l/setvaluesl002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the setValues(List) method of ArrayReference interface of + * com.sun.jdi package. + * The method spec: + * public void setValues(List values) throws InvalidTypeException, + * ClassNotLoadedException + * Replaces all array components with other values. If the given list is + * larger is size than the array, the values at the end of the list are + * ignored. + * Object values must be assignment compatible with the element type (This + * implies that the component type must be loaded through the enclosing class's + * class loader). Primitive values must be either assignment compatible with + * the component type or must be convertible to the component type without loss + * of information. See JLS section 5.2 for more information on assignment + * compatibility. + * Parameters: values - a list of Value objects to be placed in this array + * Throws: InvalidTypeException - if any of the values is not compatible with + * the declared type of array components. + * java.lang.IndexOutOfBoundsException - if the size of values is + * larger than the length of this array. + * ClassNotLoadedException - if the array component type has not yet + * been loaded through the appropriate class loader. + * ObjectCollectedException - if this object or any of the new values + * has been garbage collected. + * VMMismatchException - if a Mirror argument and this object do not + * belong to the same VirtualMachine. + * nsk/jdi/ArrayReference/setValue_l/setvaluesl002 checks assertion: + * public void setValues(List values) + * 1. Replaces all array components with other values. Array has components of + * primitive types only. The list is larger than the array, so the values + * at the end of the list is ignored. + * Debuggee defines eight sample array fields. One for each primitive type. + * Also, it defines tested array fields, that have at least one more element + * then correspondent sample field. + * Debugger gets each sample field from debuggee by name and gets its + * Value, casts it to ArrayReference and gets list of its Values. After that + * the test gets tested array fields by name, gets their values, casts to + * ArrayReference types and invoke the method setValues(List) to set the + * sample list to that ArrayReference. The read list of tested array is larger + * than the array, so the values at the end of the list should be ignored. + * After that the test gets all Values of the array and checks them. 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 + * 4448603: JDI spec: ArrayReference.setValues(List) has discrepancy + * Evaluation: + * There is indeed an inconsistency. The safer of the two options should be + * choosen: ignore tail elements in Lists that are too long. This is also what + * the reference implementation does. + * 4419982: JDI: two StackFrame methods return incorrect values for double + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ArrayReference.setValues_l.setvaluesl002 + * nsk.jdi.ArrayReference.setValues_l.setvaluesl002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_l.setvaluesl002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002a.java new file mode 100644 index 00000000000..053c12755c0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl002a.java @@ -0,0 +1,92 @@ +/* + * 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.setValues_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesl002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + setvaluesl002aClassToCheck classToCheck = new setvaluesl002aClassToCheck(); + + 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 setvaluesl002aClassToCheck { + + static boolean z1[] = {false, true}; + static boolean z1S[] = {true, false, true}; + + static byte b1[] = {0, 1, 2, 3, 4}; + static byte b1S[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE, 0}; + + static char c1[] = {0, 1, 2, 3}; + static char c1S[] = {Character.MIN_VALUE, '\u00ff', '\uff00', + Character.MAX_VALUE, Character.MAX_VALUE}; + + static double d1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + static double d1S[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0, + 0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY, + Double.NaN, -0}; + + static float f1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + static float f1S[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0, + 0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY, + Float.NaN, -0}; + + static int i1[] = {0, 1, 2, 3, 4, 5}; + static int i1S[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE, + Integer.MIN_VALUE + 1, 0}; + + static long l1[] = {0, 1, 2, 3, 4}; + static long l1S[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, 0}; + + static short r1[] = {0, 1, 2, 3, 4}; + static short r1S[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, 0}; + + static final long lF1[] = {0, 1, 2, 3, 4}; + static private long lP1[] = {0, 1, 2, 3, 4}; + static public long lU1[] = {0, 1, 2, 3, 4}; + static protected long lR1[] = {0, 1, 2, 3, 4}; + static transient long lT1[] = {0, 1, 2, 3, 4}; + static volatile long lV1[] = {0, 1, 2, 3, 4}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003.java new file mode 100644 index 00000000000..ce3dfd9412b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003.java @@ -0,0 +1,364 @@ +/* + * 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.setValues_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class setvaluesl003 { + + private int[] failedTypes; + + private final static String prefix = "nsk.jdi.ArrayReference.setValues_l."; + private final static String className = "setvaluesl003"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + + private static Log log; + + private int exitStatus; + private Debugee debugee; + private IOPipe pipe; + private ReferenceType refType; + private ObjectReference testedObject; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + setvaluesl003 tstObj = new setvaluesl003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + tstObj.debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + tstObj.execTest(); + tstObj.debugee.quit(); + + return tstObj.exitStatus; + } + + 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 = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("eventHandler:: Class '" + debugeeName + "' not found."); + return false; + } + + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("eventHandler:: Field '" + objectToCheck + "' not found."); + return false; + } + + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("eventHandler:: Field '" + objectToCheck + + "' not initialized."); + return false; + } + + boolean res = checkObjectFields(objectValue); + exitStatus = res ? Consts.TEST_PASSED : Consts.TEST_FAILED; + + if ( exitStatus == Consts.TEST_FAILED ) + complain("run:: TEST FAILED"); + else + display("run:: TEST PASSED"); + + return res; + } + + public boolean checkObjectFields(Value objectValue) { + List fieldList; + if ( ! (objectValue instanceof ObjectReference) ) + return false; + + testedObject = (ObjectReference )objectValue; + fieldList = ((ClassType )testedObject.type()).allFields(); + + // Check all array fields from debugee + display("checkObjectFields:: Tests starts >>>"); + boolean res = true; + failedTypes = new int[7]; + for ( int i = 0; i < fieldList.size(); i++) { + res = checkFieldValue((Field )fieldList.get(i)) && res; + } + + return res; + } + + private boolean checkFieldValue(Field field) { + Value fieldValue; + ArrayReference arrayRef; + String fieldName = field.name(); + log.display(""); +// log.display("<" + fieldName + "> field is being checked."); + try { + fieldValue = testedObject.getValue(field); + } catch (IllegalArgumentException e) { + log.complain("checkFieldValue:: can not get value for field " + fieldName); + log.complain("checkFieldValue:: " + e); + return false; + } + + log.display("***<" + fieldName + "> = " + fieldValue); + log.display("-----------------------------------------------------"); + + // Checking up of value type. + // Tested object doesn't have other fields than be ArrayType + if ( ! (fieldValue.type() instanceof ArrayType) ) { + log.display("type of value is not ArrayType."); + return false; + } + + boolean res = true; + + Type itemType; + try { + itemType = ((ArrayType )fieldValue.type()).componentType(); + } catch(Exception e) { + log.complain("Unexpected " + e.getClass().getName() ); + return false; + } + + // Checking up of test cases. + + for ( int i = 0; i < failedTypes.length; i++ ) failedTypes[i] = i; + + List valuesList; + // for every type + for ( int i = 0; i < failedTypes.length; i++) { + valuesList = generateValuesList(i); + if ( valuesList == null ) { + log.complain("no values list for <" + fieldName + "> " + + setvaluesl003a.COMBINE[i]); + res = false; + continue; + } + res = checkValueUpdating(fieldName, (ArrayReference )fieldValue, + valuesList, i) && res; + } + + // for all passed types + valuesList = generateValuesList(-1); + if ( valuesList == null ) { + log.complain("no values list for <" + fieldName + "> "); + return false; + } + res = checkValueUpdating(fieldName, (ArrayReference )fieldValue, + valuesList, -1) && res; + res = checkValueUpdating(fieldName, (ArrayReference )fieldValue, + null, -1) && res; + log.display(""); + return res; + } + + // when index >= failedTypes.length(), all passed types are added into generated list + private List generateValuesList(int index) { + ArrayReference values; + Field fieldOfValues = null; + if ( index < setvaluesl003a.COMBINE.length && index >= 0 ) { + fieldOfValues = refType.fieldByName(setvaluesl003a.COMBINE[index]); + try { + if ( fieldOfValues == null || + !(fieldOfValues.type() instanceof ArrayType) ) { + log.complain("fieldOfValues " + fieldOfValues + " " + + setvaluesl003a.COMBINE[index]); + return null; + } + } catch (ClassNotLoadedException e) { + log.complain("unexpected exception " + e); + return null; + } + values = (ArrayReference )refType.getValue(fieldOfValues); + return values.getValues(); + } + + List valuesList = new Vector(); + for ( int i = 0; i < failedTypes.length; i++) { + if ( failedTypes[i] < 0 ) continue; + fieldOfValues = refType.fieldByName(setvaluesl003a.COMBINE[i]); + try { + if ( fieldOfValues == null || + !(fieldOfValues.type() instanceof ArrayType) ) { + log.complain("fieldOfValues " + fieldOfValues + " " + + setvaluesl003a.COMBINE[i]); + return null; + } + } catch (ClassNotLoadedException e) { + log.complain("unexpected exception " + e); + return null; + } + values = (ArrayReference )refType.getValue(fieldOfValues); + for ( int j = 0; j < values.length(); j++ ) { + valuesList.add(values.getValue(j)); + } + } + if ( valuesList.size() == 0 ) valuesList = null; + + return valuesList; + } + + private boolean checkValueUpdating(String name, ArrayReference arrayRef, + List values, int index) { + Value itemValue; + List list; + + boolean validConversion = true; + + String valuesStr = ""; + if ( values != null ) { + for ( int i = 0; i < values.size(); i++ ) { + valuesStr = valuesStr + (Value )values.get(i) + "; "; + validConversion = validConversion && + isValidConversion((ArrayType )arrayRef.type(), + ((Value )values.get(i)).type()); + } + } + + if ( index < 0 ) + log.display("values list: (mixed)" + valuesStr); + else + log.display("values list: (" + ((Value )values.get(0)).type() + ")" + valuesStr); + + try { + arrayRef.setValues(values); + + if ( !validConversion ) { + log.complain(" InvalidTypeException is expected"); + log.display("\n"); + return false; + } + + if ( values == null ) { + log.complain(" NullPointerException is expected"); + log.display("\n"); + return false; + } + log.display(" expected NullPointerException"); + + if ( !checkValues(arrayRef, values) ) { + log.complain(" Wrong result of setting"); + log.display("\n"); + return false; + } + + log.display(" Values were correctly set"); + + } catch (InvalidTypeException e) { + + if ( index >= 0 ) failedTypes[index] = -1; + + if ( validConversion ) { + log.complain(" unexpected InvalidTypeException"); + log.display("\n"); + return false; + } + log.display(" expected InvalidTypeException"); + + } catch (ClassNotLoadedException e) { + + log.complain(" unexpected ClassNotLoadedException"); + log.display("\n"); + return false; + } catch (NullPointerException e) { + + if ( values != null ) { + log.complain(" Unexpected NullPointerException"); + return false; + } + log.display(" expected NullPointerException"); + } catch (Exception e) { + log.complain(" Unexpected exception: " + e); + log.display("\n"); + return false; + } + return true; + } + + private boolean isValidConversion(ArrayType arrType, Type valueType) { + String typeSignature = "BCDFIJS"; + Type type = null; + try { + type = arrType.componentType(); + } catch(ClassNotLoadedException e) { + return true; // have to be true always + } + int i = typeSignature.indexOf(type.signature()); + return -1 != setvaluesl003a.VALID_CONVERSIONS[i].indexOf(valueType.signature()); + } + + private boolean checkValues(ArrayReference array, List list) { + if ( list == null ) return true; + int length = array.length() < list.size() ? array.length() + : list.size(); + PrimitiveValue val1, val2; + for ( int i = 0; i < length; i++ ) { + val1 = (PrimitiveValue )array.getValue(i); + val2 = (PrimitiveValue )list.get(i); + if ( !val1.equals(val2) ) { + Type type = val1.type(); + if ( type instanceof ByteType ) + return val1.byteValue() == val2.byteValue(); + else if ( type instanceof CharType ) + return val1.charValue() == val2.charValue(); + else if ( type instanceof DoubleType ) + return val1.doubleValue() == val2.doubleValue(); + else if ( type instanceof FloatType ) + return val1.floatValue() == val2.floatValue(); + else if ( type instanceof IntegerType ) + return val1.intValue() == val2.intValue(); + else if ( type instanceof LongType ) + return val1.longValue() == val2.longValue(); + else if ( type instanceof ShortType ) + return val1.shortValue() == val2.shortValue(); + else + return false; + } + } + return true; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003/TestDescription.java new file mode 100644 index 00000000000..3e881aaad95 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003/TestDescription.java @@ -0,0 +1,99 @@ +/* + * 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/setValues_l/setvaluesl003. + * 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.setValue(int, Value) + * correctly works for the boundary value of parameter and complies with its + * spec: + * public void setValues(List values) + * throws InvalidTypeException, + * ClassNotLoadedException + * Replaces all array components with other values. If the given list is + * larger in size than the array, the values at the end of the list are + * ignored. + * Object values must be assignment compatible with the element type + * (This implies that the component type must be loaded through the + * enclosing class's class loader). Primitive values must be either + * assignment compatible with the component type or must be convertible + * to the component type without loss of information. See JLS section 5.2 + * for more information on assignment compatibility. + * Parameters: + * values - a list of Value objects to be placed in this array. + * If values.size() is less that the length of the array, the first + * values.size() elements are set. + * Throws: + * InvalidTypeException - if any of the new values is not compatible + * with the declared type of array components. + * ClassNotLoadedException - if the array component type has not yet + * been loaded through the appropriate class loader. + * The test cases include instance fields of the primitive types, which are + * one-dimensional arrays. Possible values of parameter of the method + * are generated from debugee's arrays, which contains boundary values of + * every primitive type. + * Every tested array of primitive type is checked in several steps: + * 1. List parameter consists of values of the same primitive types. + * InvalidTypeException is expected, when primitive values are neither + * assignment compatible with the component type nor are convertible + * to the component type without loss of information. + * 2. List is generated from primitive values passed in first step. + * In this case no exceptions are expected. + * 3. List has null value. In this case NullPointerException is + * excpected. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayReference.setValue.setvalue003; + * the debuggee program - nsk.jdi.ArrayReference.setValue.setvalue003a. + * 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 set a value of arry items 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.setValues_l.setvaluesl003 + * nsk.jdi.ArrayReference.setValues_l.setvaluesl003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayReference.setValues_l.setvaluesl003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003a.java new file mode 100644 index 00000000000..af7258a5f77 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayReference/setValues_l/setvaluesl003a.java @@ -0,0 +1,168 @@ +/* + * 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.setValues_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class setvaluesl003a { + + static setvaluesl003aClassToCheck testedObj = new setvaluesl003aClassToCheck(); + + + public static final String[] VALID_CONVERSIONS = { + "B", // primitive types to byte + "C", // primitive types to char + "BCDFIJS", // primitive types to double + "BCFIJS", // primitive types to float + "BCIS", // primitive types to int + "BCIJS", // primitive types to long + "BS" // primitive types to short + }; + + + public final static String[] COMBINE = { + "BYTE_VALUES", + "CHAR_VALUES", + "DBL_VALUES", + "FLT_VALUES", + "INT_VALUES", + "LNG_VALUES", + "SHORT_VALUES" + }; + + // Value parameter's array for debugee's arrays + public static byte[] BYTE_VALUES = { + Byte.MIN_VALUE, + -1, + 0, + 1, + Byte.MAX_VALUE + }; + + public static char[] CHAR_VALUES = { + Character.MIN_VALUE, + 'a', + 'z', + 'A', + 'Z', + Character.MAX_VALUE + }; + + public static double[] DBL_VALUES = { + Double.NEGATIVE_INFINITY, + Double.MIN_VALUE, + -1, + 0, + 1, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY + }; + + public static float[] FLT_VALUES = { + Float.NEGATIVE_INFINITY, + Float.MIN_VALUE, + -1, + 0, + 1, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY + }; + + public static int[] INT_VALUES = { + Integer.MIN_VALUE, + -1, + 0, + 1, + Integer.MAX_VALUE + }; + + public static long[] LNG_VALUES = { + Long.MIN_VALUE, + -1, + 0, + 1, + Long.MAX_VALUE + }; + + public static short[] SHORT_VALUES = { + Short.MIN_VALUE, + -1, + 0, + 1, + Short.MAX_VALUE + }; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class setvaluesl003aClassToCheck { + public byte[] publicByteArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected byte[] protecByteArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private byte[] privatByteArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public char[] publicCharArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + protected char[] protecCharArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + private char[] privatCharArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + + public double[] publicDoubleArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected double[] protecDoubleArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private double[] privatDoubleArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public float[] publicFloatArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected float[] protecFloatArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private float[] privatFloatArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public int[] publicIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected int[] protecIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private int[] privatIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public long[] publicLongArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected long[] protecLongArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private long[] privatLongArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + public short[] publicShortArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + protected short[] protecShortArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + private short[] privatShortArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001.java new file mode 100644 index 00000000000..1ae6a0796b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001.java @@ -0,0 +1,316 @@ +/* + * 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.ArrayType.componentSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.componentSignature()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee executes the following :
    + * static boolean bl[] = {true, false};
    + * static byte bt[] = {0, 1};
    + * static char ch[] = {0, 1};
    + * static double db[] = {0.0d, 1.0d};
    + * static float fl[] = {0.0f, 1.0f};
    + * static int in[] = {0, 1};
    + * static long ln[] = {0, 1};
    + * static short sh[] = {0, 1};
    + *
    + * for all of the above primitive type variables,
    + * a debugger forms their corresponding Type objects
    + * from which it forms text representations of
    + * signatures in String variables
    + * named blSignature, btSignature, and etc.
    + *
    + * Then the debugger checks up that
    + * each of the following is true :
    + *
    + * blSignature.equals("Z")
    + * btSignature.equals("B")
    + * chSignature.equals("C")
    + * dbSignature.equals("D")
    + * flSignature.equals("F")
    + * inSignature.equals("I")
    + * lnSignature.equals("J")
    + * shSignature.equals("S")
    + */ + +public class componentsignature001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/componentSignature/componentsignature001", + sHeader2 = "--> componentsignature001: ", + sHeader3 = "##> componentsignature001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new componentsignature001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.componentSignature.componentsignature001a"; + + //String mName = "nsk.jdi.ArrayType.componentSignature"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("componentsignature001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl = execClass.fieldByName("bl"); + Field fsbt = execClass.fieldByName("bt"); + Field fsch = execClass.fieldByName("ch"); + Field fsdb = execClass.fieldByName("db"); + Field fsfl = execClass.fieldByName("fl"); + Field fsin = execClass.fieldByName("in"); + Field fsln = execClass.fieldByName("ln"); + Field fssh = execClass.fieldByName("sh"); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean[] + String blSignature = + ((ArrayType) execClass.getValue(fsbl).type()).componentSignature(); + if (!blSignature.equals("Z")) { + expresult = 1; + log3("ERROR: !blSignature.equals('[Z') " + blSignature); + } + break; + + case 1: // byte[] + String btSignature = + ((ArrayType) execClass.getValue(fsbt).type()).componentSignature(); + if (!btSignature.equals("B")) { + expresult = 1; + log3("ERROR: !btSignature.equals('B')"); + } + break; + + case 2: // char[] + String chSignature = + ((ArrayType) execClass.getValue(fsch).type()).componentSignature(); + if (!chSignature.equals("C")) { + expresult = 1; + log3("ERROR: !chSignature.equals('C')"); + } + break; + + case 3: // double[] + String dbSignature = + ((ArrayType) execClass.getValue(fsdb).type()).componentSignature(); + if (!dbSignature.equals("D")) { + expresult = 1; + log3("ERROR: !dbSignature.equals('D')"); + } + break; + + case 4: // float[] + String flSignature = + ((ArrayType) execClass.getValue(fsfl).type()).componentSignature(); + if (!flSignature.equals("F")) { + expresult = 1; + log3("ERROR: !flSignature.equals('F')"); + } + break; + + case 5: // int[] + String inSignature = + ((ArrayType) execClass.getValue(fsin).type()).componentSignature(); + if (!inSignature.equals("I")) { + expresult = 1; + log3("ERROR: !inSignature.equals('I')"); + } + break; + + case 6: // long[] + String lnSignature = + ((ArrayType) execClass.getValue(fsln).type()).componentSignature(); + if (!lnSignature.equals("J")) { + expresult = 1; + log3("ERROR: !lnSignature.equals('J')"); + } + break; + + case 7: // short[] + String shSignature = + ((ArrayType) execClass.getValue(fssh).type()).componentSignature(); + if (!shSignature.equals("S")) { + expresult = 1; + log3("ERROR: !shSignature.equals('S')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001/TestDescription.java new file mode 100644 index 00000000000..b1e703883eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001/TestDescription.java @@ -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/ArrayType/componentSignature/componentsignature001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.componentSignature() + * complies with its spec: + * public java.lang.String componentSignature() + * Gets the JNI signature of the components of this array class. + * The signature describes the declared type of the components. + * If the components are objects, their actual type in + * a particular run-time context may be a subclass of the declared class. + * Returns: a string containing the JNI signature of array components. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when the type is one of the primitive types. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.componentSignature.componentsignature001; + * the debuggee program - nsk.jdi.ArrayType.componentSignature.componentsignature001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.componentSignature.componentsignature001 + * nsk.jdi.ArrayType.componentSignature.componentsignature001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.componentSignature.componentsignature001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001a.java new file mode 100644 index 00000000000..5ea82095a36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature001a.java @@ -0,0 +1,122 @@ +/* + * 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.ArrayType.componentSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the componentsignature001 JDI test. + */ + +public class componentsignature001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> componentsignature001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> componentsignature001a: " + message); + } + + //====================================================== test program + + static boolean bl[] = {true, false}; + static byte bt[] = {0, 1}; + static char ch[] = {0, 1}; + static double db[] = {0.0d, 1.0d}; + static float fl[] = {0.0f, 1.0f}; + static int in[] = {0, 1}; + static long ln[] = {0, 1}; + static short sh[] = {0, 1}; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.componentSignature()
    + * complies with its spec when a type is one of ReferenceType(s).
    + *
    + * The test checks up that the component signatures of
    + * ArrayType objects, corresponding in a debugger to
    + * the following in a debuggee:
    + *
    + * a class type array - "ClassForCheck_2 class3[]" field,
    + * an interface type array - "InterfaceForCheck iface[]" field,
    + *
    + * are as follows:
    + * "Lnsk/jdi/ArrayType/componentSignature/ClassForCheck_2;"
    + * "Lnsk/jdi/ArrayType/componentSignature/InterfaceForCheck;"
    + *
    + */ + +public class componentsignature002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/componentSignature/componentsignature002", + sHeader2 = "--> componentsignature002: ", + sHeader3 = "##> componentsignature002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new componentsignature002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.componentSignature.componentsignature002a"; + + String mName = "nsk.jdi.ArrayType.componentSignature"; + String signaturePrefix = "nsk/jdi/ArrayType/componentSignature"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("componentsignature002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = null; + ReferenceType reftypeObj = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0 : // ClassType array + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + log3("ERROR: for ClassType listOfDebuggeeClasses.size() != 1"); + expresult = 1; + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field classField = reftypeObj.fieldByName("class3"); + + Type classfieldType = null; + try { + classfieldType = classField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: classfieldType = classField.type();"); + expresult =1; + break ; + } + + String classtypeComponentSignature = + ((ArrayType) classfieldType).componentSignature(); + if (!classtypeComponentSignature.equals( + "L" + signaturePrefix + "/ClassForCheck_2;")) { + log3("ERROR: !classtypeComponentSignature.equals(namePrefix + " + + "'.ClassForCheck_2')" + " " + classtypeComponentSignature ); + expresult = 1; + break; + } + break; + + case 1 : // InterfaceType array + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + log3("ERROR: for InterfaceType listOfDebuggeeClasses.size() != 1"); + expresult = 1; + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field ifaceField = reftypeObj.fieldByName("iface"); + + Type ifacefieldType = null; + try { + ifacefieldType = ifaceField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ifacefieldType = ifaceField.type();"); + expresult =1; + break ; + } + + String interfacetypeComponentSignature = + ((ArrayType) ifacefieldType).componentSignature(); + if (!interfacetypeComponentSignature.equals( + "L" + signaturePrefix + "/InterfaceForCheck;")) { + log3("ERROR: !interfacetypeComponentSignature.equals(namePrefix + " + + "/InterfaceForCheck')" + " " + interfacetypeComponentSignature ); + expresult = 1; + break; + } + break; +/* + case 2 : // PrimitiveType array !!!!! throws ClassNotLoadedException + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ArrayType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field arrayField = reftypeObj.fieldByName("bl"); + + Type arrayfieldType = null; + try { + arrayfieldType = arrayField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: arrayfieldType = arrayField.type();"); + expresult =1; + break ; + } + + String arrayTypecomponentSignature = + ((ArrayType) arrayfieldType).componentSignature(); + if (!arrayTypecomponentSignature.equals( + "L" + signaturePrefix + "/ClassForCheck_2;")) { + log3("ERROR: !arrayfieldTypeSignature.equals(namePrefix +" + + "'.ClassForCheck_2[]')" + " " + arrayTypecomponentSignature ); + expresult = 1; + break; + } + break; +*/ + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature002/TestDescription.java new file mode 100644 index 00000000000..0efa294bda1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature002/TestDescription.java @@ -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/ArrayType/componentSignature/componentsignature002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.componentSignature() + * complies with its spec: + * public java.lang.String componentSignature() + * Gets the JNI signature of the components of this array class. + * The signature describes the declared type of the components. + * If the components are objects, their actual type in + * a particular run-time context may be a subclass of the declared class. + * Returns: a string containing the JNI signature of array components. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when the type is one of the ReferenceType(s). + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.componentSignature.componentsignature002; + * the debuggee program - nsk.jdi.ArrayType.componentSignature.componentsignature002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.componentSignature.componentsignature002 + * nsk.jdi.ArrayType.componentSignature.componentsignature002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.componentSignature.componentsignature002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature002a.java new file mode 100644 index 00000000000..45a71a1e1fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentSignature/componentsignature002a.java @@ -0,0 +1,168 @@ +/* + * 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.ArrayType.componentSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the componentsignature002 JDI test. + */ + +public class componentsignature002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> componentsignature002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> componentsignature002a: " + message); + } + + //====================================================== test program + + static ClassForCheck class1 = new ClassForCheck(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.componentType()
    + * complies with its spec when a type is one of ReferenceType(s).
    + *
    + * The test checks up that the component types of
    + * ReferenceType objects, corresponding in a debugger to
    + * the following in a debuggee:
    + *
    + * a class type array - "ClassForCheck_2 class3[]" field,
    + * an interface type array - "InterfaceForCheck iface[]" field,
    + *
    + * are ClassType and InterfaceType accordinly.
    + *
    + */ + +public class componenttype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/componentType/componenttype001", + sHeader2 = "--> componenttype001: ", + sHeader3 = "##> componenttype001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new componenttype001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.componentType.componenttype001a"; + + String mName = "nsk.jdi.ArrayType.componentType"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("componenttype001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = null; + ReferenceType reftypeObj = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0 : // ClassType array + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ClassType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field classField = reftypeObj.fieldByName("class3"); + + try { + ClassType obj = + (ClassType) ( (ArrayType) classField.type() ).componentType(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: (ClassType) ((ArrayType) classFieldType.type).componentType();"); + expresult =1; + break ; + } catch ( ClassCastException e ) { + log3("ERROR: (ClassType) ((ArrayType) classFieldType.type).componentType();"); + expresult =1; + break ; + } + + break; + + + case 1 : // InterfaceType array + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for InterfaceType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field ifaceField = reftypeObj.fieldByName("iface"); + + try { + InterfaceType obj = + (InterfaceType) ( (ArrayType) ifaceField.type() ).componentType(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: (InterfaceType) ( (ArrayType) ifaceField.type() ).componentType();"); + expresult =1; + break ; + } catch ( ClassCastException e ) { + log3("ERROR: (InterfaceType) ( (ArrayType) ifaceField.type() ).componentType();"); + expresult =1; + break ; + } + + break; + +/* + + case 2 : // PrimitiveType array !!!!! throws ClassNotLoadedException + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ArrayType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field arrayField = reftypeObj.fieldByName("bl"); + + try { + ArrayType obj = + (ArrayType) ( (ArrayType) arrayField.type() ).componentType(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: CNLE (ArrayType) ( (ArrayType) arrayField.type() ).componentType();"); + expresult =1; + break ; + } catch ( ClassCastException e ) { + log3("ERROR: CCE (ArrayType) ( (ArrayType) arrayField.type() ).componentType();"); + expresult =1; + break ; + } + + break; +*/ + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentType/componenttype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentType/componenttype001/TestDescription.java new file mode 100644 index 00000000000..3901203b96b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentType/componenttype001/TestDescription.java @@ -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/ArrayType/componentType/componenttype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.componentType() + * complies with its spec: + * public Type componentType() + * throws ClassNotLoadedException + * Returns the type of the array components. + * For primitive arrays, an appropriate PrimitiveType is always returned. + * For object arrays, the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's class loader. + * Returns: the Type of the array's components. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when the type is one of the ReferenceType(s). + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.componentType.componenttype001; + * the debuggee program - nsk.jdi.ArrayType.componentType.componenttype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.componentType.componenttype001 + * nsk.jdi.ArrayType.componentType.componenttype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.componentType.componenttype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentType/componenttype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentType/componenttype001a.java new file mode 100644 index 00000000000..08674770539 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentType/componenttype001a.java @@ -0,0 +1,169 @@ +/* + * 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.ArrayType.componentType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the componenttype001 JDI test. + */ + +public class componenttype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> componenttype001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> componenttype001a: " + message); + } + + //====================================================== test program + + static ClassForCheck class1 = new ClassForCheck(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.componentTypeName()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee executes the following :
    + * static boolean bl[] = {true, false};
    + * static byte bt[] = {0, 1};
    + * static char ch[] = {0, 1};
    + * static double db[] = {0.0d, 1.0d};
    + * static float fl[] = {0.0f, 1.0f};
    + * static int in[] = {0, 1};
    + * static long ln[] = {0, 1};
    + * static short sh[] = {0, 1};
    + *
    + * for all of the above primitive type variables,
    + * a debugger forms their corresponding Type objects
    + * from which it forms text representations of
    + * type names in String variables
    + * named blName, btName, and etc.
    + *
    + * Then the debugger checks up that
    + * each of the following is true :
    + *
    + * blName.equals("boolean")
    + * btName.equals("byte")
    + * chName.equals("char")
    + * dbName.equals("double")
    + * flName.equals("float")
    + * inName.equals("int")
    + * lnName.equals("long")
    + * shName.equals("short")
    + */ + +public class componenttypename001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/componentTypeName/componenttypename001", + sHeader2 = "--> componenttypename001: ", + sHeader3 = "##> componenttypename001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new componenttypename001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.componentTypeName.componenttypename001a"; + + //String mName = "nsk.jdi.ArrayType.componentTypeName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("componenttypename001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl = execClass.fieldByName("bl"); + Field fsbt = execClass.fieldByName("bt"); + Field fsch = execClass.fieldByName("ch"); + Field fsdb = execClass.fieldByName("db"); + Field fsfl = execClass.fieldByName("fl"); + Field fsin = execClass.fieldByName("in"); + Field fsln = execClass.fieldByName("ln"); + Field fssh = execClass.fieldByName("sh"); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean[] + String blName = + ((ArrayType) execClass.getValue(fsbl).type()).componentTypeName(); + if (!blName.equals("boolean")) { + expresult = 1; + log3("ERROR: !blName.equals('boolean') " + blName); + } + break; + + case 1: // byte[] + String btName = + ((ArrayType) execClass.getValue(fsbt).type()).componentTypeName(); + if (!btName.equals("byte")) { + expresult = 1; + log3("ERROR: !btName.equals('byte')"); + } + break; + + case 2: // char[] + String chName = + ((ArrayType) execClass.getValue(fsch).type()).componentTypeName(); + if (!chName.equals("char")) { + expresult = 1; + log3("ERROR: !chName.equals('char')"); + } + break; + + case 3: // double[] + String dbName = + ((ArrayType) execClass.getValue(fsdb).type()).componentTypeName(); + if (!dbName.equals("double")) { + expresult = 1; + log3("ERROR: !dbName.equals('double')"); + } + break; + + case 4: // float[] + String flName = + ((ArrayType) execClass.getValue(fsfl).type()).componentTypeName(); + if (!flName.equals("float")) { + expresult = 1; + log3("ERROR: !flName.equals('float')"); + } + break; + + case 5: // int[] + String inName = + ((ArrayType) execClass.getValue(fsin).type()).componentTypeName(); + if (!inName.equals("int")) { + expresult = 1; + log3("ERROR: !inName.equals('int')"); + } + break; + + case 6: // long[] + String lnName = + ((ArrayType) execClass.getValue(fsln).type()).componentTypeName(); + if (!lnName.equals("long")) { + expresult = 1; + log3("ERROR: !lnName.equals('long')"); + } + break; + + case 7: // short[] + String shName = + ((ArrayType) execClass.getValue(fssh).type()).componentTypeName(); + if (!shName.equals("short")) { + expresult = 1; + log3("ERROR: !shName.equals('short')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename001/TestDescription.java new file mode 100644 index 00000000000..b5a06bf3e55 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/ArrayType/componentTypeName/componenttypename001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.componentTypeName() + * complies with its spec: + * public java.lang.String componentTypeName() + * Returns: a text representation of the component type. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.componentTypeName001; + * the debuggee program - nsk.jdi.ArrayType.componentTypeName001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.componentTypeName.componenttypename001 + * nsk.jdi.ArrayType.componentTypeName.componenttypename001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.componentTypeName.componenttypename001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename001a.java new file mode 100644 index 00000000000..959026a271a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename001a.java @@ -0,0 +1,122 @@ +/* + * 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.ArrayType.componentTypeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the componenttypename001 JDI test. + */ + +public class componenttypename001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> componenttypename001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> componenttypename001a: " + message); + } + + //====================================================== test program + + static boolean bl[] = {true, false}; + static byte bt[] = {0, 1}; + static char ch[] = {0, 1}; + static double db[] = {0.0d, 1.0d}; + static float fl[] = {0.0f, 1.0f}; + static int in[] = {0, 1}; + static long ln[] = {0, 1}; + static short sh[] = {0, 1}; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.componentTypeName()
    + * complies with its spec when a type is one of ReferenceType(s).
    + *
    + * The test checks up that the component type names of
    + * ArrayType objects, corresponding in a debugger to
    + * the following in a debuggee:
    + *
    + * a class type array - "ClassForCheck_2 class3[]" field,
    + * an interface type array - "InterfaceForCheck iface[]" field,
    + *
    + * are "nsk.jdi.ArrayType.componentTypeName.ClassForCheck_2" and
    + * "nsk.jdi.ArrayType.componentTypeName.InterfaceForCheck"
    + *
    + */ + +public class componenttypename002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/componentTypeName/componenttypename002", + sHeader2 = "--> componenttypename002: ", + sHeader3 = "##> componenttypename002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new componenttypename002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.componentTypeName.componenttypename002a"; + + String mName = "nsk.jdi.ArrayType.componentTypeName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("componenttypename002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = null; + ReferenceType reftypeObj = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0 : // ClassType array + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ClassType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field classField = reftypeObj.fieldByName("class3"); + + Type classfieldType = null; + try { + classfieldType = classField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: classfieldType = classField.type();"); + expresult =1; + break ; + } + + String classtypeComponentTypeName = + ((ArrayType) classfieldType).componentTypeName(); + if (!classtypeComponentTypeName.equals(mName + ".ClassForCheck_2")) { + expresult = 1; + log3("ERROR: !classtypeComponentSignature.equals(namePrefix + " + + "'.ClassForCheck_2')" + " " + classtypeComponentTypeName ); + } + break; + + case 1 : // InterfaceType array + + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for InterfaceType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field ifaceField = reftypeObj.fieldByName("iface"); + + Type ifacefieldType = null; + try { + ifacefieldType = ifaceField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ifacefieldType = ifaceField.type();"); + expresult =1; + break ; + } + + String interfacetypeComponentTypeName = + ((ArrayType) ifacefieldType).componentTypeName(); + if (!interfacetypeComponentTypeName.equals(mName + ".InterfaceForCheck")) { + expresult = 1; + log3("ERROR: !interfacetypeComponentSignature.equals(namePrefix + " + + "/InterfaceForCheck')" + " " + interfacetypeComponentTypeName ); + } + break; + +/* + case 2 : // PrimitiveType array !!!!! throws ClassNotLoadedException + listOfDebuggeeClasses = + vm.classesByName(mName + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ArrayType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field arrayField = reftypeObj.fieldByName("bl"); + + Type arrayfieldType = null; + try { + arrayfieldType = arrayField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: arrayfieldType = arrayField.type();"); + expresult =1; + break ; + } + + String arrayTypecomponentTypeName = + ((ArrayType) arrayfieldType).componentTypeName(); + if (!arrayTypecomponentTypeName.equals(mName + "boolean[]")) { + expresult = 1; + log3("ERROR: !arrayfieldTypeSignature.equals(namePrefix +" + + "'.ClassForCheck_2[]')" + " " + arrayTypecomponentTypeName ); + } + break; +*/ + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename002/TestDescription.java new file mode 100644 index 00000000000..55df3bfb1b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename002/TestDescription.java @@ -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/ArrayType/componentTypeName/componenttypename002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.componentTypeName() + * complies with its spec: + * public java.lang.String componentTypeName() + * Returns: a text representation of the component type. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when the type is one of the ReferenceType(s). + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.componentTypeName.componenttypename002; + * the debuggee program - nsk.jdi.ArrayType.componentTypeName.componenttypename002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.componentTypeName.componenttypename002 + * nsk.jdi.ArrayType.componentTypeName.componenttypename002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.componentTypeName.componenttypename002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename002a.java new file mode 100644 index 00000000000..62e3c830c41 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/componentTypeName/componenttypename002a.java @@ -0,0 +1,169 @@ +/* + * 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.ArrayType.componentTypeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the componenttypename002 JDI test. + */ + +public class componenttypename002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> componenttypename002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> componenttypename002a: " + message); + } + + //====================================================== test program + + static ClassForCheck class1 = new ClassForCheck(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.newInstance()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee executes the following :
    + * static boolean bl[] = {true};
    + * static byte bt[] = {1};
    + * static char ch[] = {1};
    + * static double db[] = {1.0d};
    + * static float fl[] = {1.0f};
    + * static int in[] = {1};
    + * static long ln[] = {1};
    + * static short sh[] = {1};
    + *
    + * for all of the above primitive type variables,
    + * a debugger creates new instances of
    + * corresponding ReferenceArray objects and checks up
    + * that (1) length of newly created arrays is equal to
    + * a method invocation parameter and (2) initial values
    + * of arrays components are as they are defined in
    + * JLS, section 4.5.5.
    + */ + +public class newinstance001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/newInstance/newinstance001", + sHeader2 = "--> newinstance001: ", + sHeader3 = "##> newinstance001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new newinstance001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.newInstance.newinstance001a"; + + //String mName = "nsk.jdi.ArrayType.newInstance"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("newinstance001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl = execClass.fieldByName("bl"); + Field fsbt = execClass.fieldByName("bt"); + Field fsch = execClass.fieldByName("ch"); + Field fsdb = execClass.fieldByName("db"); + Field fsfl = execClass.fieldByName("fl"); + Field fsin = execClass.fieldByName("in"); + Field fsln = execClass.fieldByName("ln"); + Field fssh = execClass.fieldByName("sh"); + + final int arraylength = 2; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean[] + ArrayType blArray = + (ArrayType) execClass.getValue(fsbl).type(); + ArrayReference newBlArray = blArray.newInstance(arraylength); + + if (newBlArray.length() != arraylength) { + log3("ERROR : newBlArray.length() != arraylength " + newBlArray.length()); + expresult = 1; + break; + } + if ( ((BooleanValue) newBlArray.getValue(0)).value() != false || + ((BooleanValue) newBlArray.getValue(1)).value() != false ) { + log3("ERROR : newBlArray components != false"); + expresult = 1; + break; + } + + break; + + case 1: // byte[] + ArrayType btArray = + (ArrayType) execClass.getValue(fsbt).type(); + ArrayReference newBtArray = btArray.newInstance(arraylength); + + if (newBtArray.length() != arraylength) { + log3("ERROR : newBtArray.length() != arraylength " + newBtArray.length()); + expresult = 1; + break; + } + if ( ((ByteValue) newBtArray.getValue(0)).value() != (byte) 0 || + ((ByteValue) newBtArray.getValue(1)).value() != (byte) 0 ) { + log3("ERROR : newBtArray components != (byte) 0"); + expresult = 1; + break; + } + break; + + case 2: // char[] + ArrayType chArray = + (ArrayType) execClass.getValue(fsch).type(); + ArrayReference newChArray = chArray.newInstance(arraylength); + + if (newChArray.length() != arraylength) { + log3("ERROR : newChArray.length() != arraylength " + newChArray.length()); + expresult = 1; + break; + } + if ( ((CharValue) newChArray.getValue(0)).value() != '\u0000' || + ((CharValue) newChArray.getValue(1)).value() != '\u0000' ) { + log3("ERROR : newChArray components != '\u0000' "); + expresult = 1; + break; + } + break; + + case 3: // double[] + ArrayType dbArray = + (ArrayType) execClass.getValue(fsdb).type(); + ArrayReference newDbArray = dbArray.newInstance(arraylength); + + if (newDbArray.length() != arraylength) { + log3("ERROR : newDBArray.length() != arraylength " + newDbArray.length()); + expresult = 1; + break; + } + if ( ((DoubleValue) newDbArray.getValue(0)).value() != 0.0d || + ((DoubleValue) newDbArray.getValue(1)).value() != 0.0d ) { + log3("ERROR : newDbArray components != 0.0d"); + expresult = 1; + break; + } + break; + + case 4: // float[] + ArrayType flArray = + (ArrayType) execClass.getValue(fsfl).type(); + ArrayReference newFlArray = flArray.newInstance(arraylength); + + if (newFlArray.length() != arraylength) { + log3("ERROR : newFlArray.length() != arraylength " + newFlArray.length()); + expresult = 1; + break; + } + if ( ((FloatValue) newFlArray.getValue(0)).value() != 0.0f || + ((FloatValue) newFlArray.getValue(1)).value() != 0.0f ) { + log3("ERROR : newFlArray components != 0.0f"); + expresult = 1; + break; + } + break; + + case 5: // int[] + ArrayType inArray = + (ArrayType) execClass.getValue(fsin).type(); + ArrayReference newInArray = inArray.newInstance(arraylength); + + if (newInArray.length() != arraylength) { + log3("ERROR : newInArray.length() != arraylength " + newInArray.length()); + expresult = 1; + break; + } + if ( ((IntegerValue) newInArray.getValue(0)).value() != 0 || + ((IntegerValue) newInArray.getValue(1)).value() != 0 ) { + log3("ERROR : newInArray components != 0"); + expresult = 1; + break; + } + break; + + case 6: // long[] + ArrayType lnArray = + (ArrayType) execClass.getValue(fsln).type(); + ArrayReference newLnArray = lnArray.newInstance(arraylength); + + if (newLnArray.length() != arraylength) { + log3("ERROR : newLnArray.length() != arraylength " + newLnArray.length()); + expresult = 1; + break; + } + if ( ((LongValue) newLnArray.getValue(0)).value() != 0L || + ((LongValue) newLnArray.getValue(1)).value() != 0L) { + log3("ERROR : newLnArray components != 0L"); + expresult = 1; + break; + } + break; + + case 7: // short[] + ArrayType shArray = + (ArrayType) execClass.getValue(fssh).type(); + ArrayReference newShArray = shArray.newInstance(arraylength); + + if (newShArray.length() != arraylength) { + log3("ERROR : newShArray.length() != arraylength " + newShArray.length()); + expresult = 1; + break; + } + if ( ((ShortValue) newShArray.getValue(0)).value() != (short) 0 || + ((ShortValue) newShArray.getValue(1)).value() != (short) 0 ) { + log3("ERROR : newShArray components != (short) 0"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001/TestDescription.java new file mode 100644 index 00000000000..b4e8722862b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001/TestDescription.java @@ -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/ArrayType/newInstance/newinstance001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.newInstance() + * complies with its spec: + * public ArrayReference newInstance(int length) + * Creates a new instance of this array class in the target VM. + * The array is created with the given length and + * each component is initialized to is standard default value. + * Parameters: length - the number of components in the new array + * Returns: the newly created ArrayReference mirroring + * the new object in the target VM. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when a type of this array class is one of primitive types. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.newInstance.newinstance001; + * the debuggee program - nsk.jdi.ArrayType.newInstance.newinstance001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.newInstance.newinstance001 + * nsk.jdi.ArrayType.newInstance.newinstance001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.newInstance.newinstance001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001a.java new file mode 100644 index 00000000000..6cfb9979b43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001a.java @@ -0,0 +1,122 @@ +/* + * 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.ArrayType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the newinstance001 JDI test. + */ + +public class newinstance001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> newinstance001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> newinstance001a: " + message); + } + + //====================================================== test program + + static boolean bl[] = {true}; + static byte bt[] = { 1}; + static char ch[] = { 1}; + static double db[] = { 1.0d}; + static float fl[] = { 1.0f}; + static int in[] = { 1}; + static long ln[] = { 1}; + static short sh[] = { 1}; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.newInstance()
    + * complies with its spec when componentType of an ArrayType
    + * object used as original for newInstance() is also ArrayType
    + * whose components are primitive type values.
    + * The test works as follows.
    + *
    + * For given debuggee's array whose components are
    + * a primitive (boolean in this particular case) arrays,
    + * a debugger forms corresponding ArrayType object
    + * to which it applies newInstance() method in order to get
    + * an ArrayReference object, newarray.
    + * Then the debugger checks up that:
    + * - newInstance() method's returned value != null;
    + * - length of newly created array is equal to 'arg' in
    + * newInstance(int arg) method invocation;
    + * - newarray.type().name().equals(array.componentType().name());
    + * - all components of new array are nulls
    + * as its default values at the moment of the array creation.
    + *
    + */ + +public class newinstance002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/newInstance/newinstance002", + sHeader2 = "--> newinstance002: ", + sHeader3 = "##> newinstance002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new newinstance002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.newInstance.newinstance002a"; + + String mName = "nsk.jdi.ArrayType.newInstance"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("newinstance002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOftestedClasses = vm.classesByName(mName + ".newinstance002aTestClass"); + if (listOftestedClasses.size() != 1) { + log3("ERROR: listOftestedClasses.size() != 1"); + testExitCode = FAILED; + continue; + } + ReferenceType testedClass = + (ReferenceType) listOftestedClasses.get(0); + + Field fieldArray = testedClass.fieldByName("a2"); + if (fieldArray == null) { + log3("ERROR: fieldArray == null"); + testExitCode = FAILED; + continue; + } + + final int arraylength = 2; + + log2("1111111111"); + + ArrayType arrayArray = + (ArrayType) testedClass.getValue(fieldArray).type(); + + log2("2222222222"); + + ArrayReference newarrayArray = arrayArray.newInstance(arraylength); + if (newarrayArray == null) { + log3("ERROR: newarrayArray == null"); + testExitCode = FAILED; + continue; + } + log2("3333333333"); + + try { + if ( newarrayArray.type().name().equals(arrayArray.componentType().name()) ) { + log3("ERROR : types are not equal :\n" + + "newarrayArray.type().name() =" + newarrayArray.type().name() + "\n" + + "arrayArray.componentType().name()=" + arrayArray.componentType().name() ); + testExitCode = FAILED; + continue; + } + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ClassNotLoadedException for newarrayArray.type().name().equals(.."); + testExitCode = FAILED; + continue; + } + log2("4444444444"); + + if (newarrayArray.length() != arraylength) { + log3("ERROR : newarrayArray.length() != arraylength " + newarrayArray.length()); + testExitCode = FAILED; + continue; + } + log2("5555555555"); + + if (newarrayArray.getValue(0) != null || + newarrayArray.getValue(1) != null) { + log3("ERROR: newarrayArray.getValue() != null "); + testExitCode = FAILED; + continue; + } + + log2("6666666666"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002/TestDescription.java new file mode 100644 index 00000000000..edf2d9d650c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002/TestDescription.java @@ -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/ArrayType/newInstance/newinstance002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.newInstance() + * complies with its spec: + * public ArrayReference newInstance(int length) + * Creates a new instance of this array class in the target VM. + * The array is created with the given length and + * each component is initialized to is standard default value. + * Parameters: length - the number of components in the new array + * Returns: the newly created ArrayReference mirroring + * the new object in the target VM. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when components of this array class are arrays of primitive type values. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.newInstance.newinstance002; + * the debuggee program - nsk.jdi.ArrayType.newInstance.newinstance002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.newInstance.newinstance002 + * nsk.jdi.ArrayType.newInstance.newinstance002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.newInstance.newinstance002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002a.java new file mode 100644 index 00000000000..a1a68c91102 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002a.java @@ -0,0 +1,123 @@ +/* + * 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.ArrayType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the newinstance002 JDI test. + */ + +public class newinstance002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> newinstance002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> newinstance002a: " + message); + } + + //====================================================== test program + + static newinstance002aTestClass obj = new newinstance002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.newInstance()
    + * complies with its spec when componentType of an ArrayType
    + * object used as original for newInstance() is InterfeaceType.
    + * The test works as follows.
    + *
    + * For given debuggee's array whose components
    + * are objects of a class type implementing the interface,
    + * a debugger forms corresponding ArrayType object
    + * to which it applies newInstance() method in order to get
    + * an ArrayReference object, newarray.
    + * Then the debugger checks up that:
    + * - newInstance() method's returned value != null;
    + * - length of newly created array is equal to 'arg' in
    + * newInstance(int arg) method invocation;
    + * - newarray.type().name().equals(array.componentType().name());
    + * - all components of new array are nulls
    + * as its default values at the moment of the array creation.
    + *
    + */ + +public class newinstance003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/newInstance/newinstance003 ", + sHeader2 = "--> newinstance003: ", + sHeader3 = "##> newinstance003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new newinstance003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.newInstance.newinstance003a"; + + String mName = "nsk.jdi.ArrayType.newInstance"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("newinstance003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOftestedClasses = vm.classesByName(mName + ".newinstance003aTestClass"); + if (listOftestedClasses.size() != 1) { + log3("ERROR: listOftestedClasses.size() != 1"); + testExitCode = FAILED; + continue; + } + ReferenceType testedClass = + (ReferenceType) listOftestedClasses.get(0); + + Field fieldArray = testedClass.fieldByName("iface"); + if (fieldArray == null) { + log3("ERROR: fieldArray == null"); + testExitCode = FAILED; + continue; + } + + final int arraylength = 2; + + ArrayType ifaceArray = + (ArrayType) testedClass.getValue(fieldArray).type(); + + ArrayReference newifaceArray = null; + try { + newifaceArray = ifaceArray.newInstance(arraylength); + } catch ( Throwable e ) { + log3 ("ERROR: Exception: " + e); + testExitCode = FAILED; + continue; + } + if (newifaceArray == null) { + log3("ERROR: newifaceArray == null"); + testExitCode = FAILED; + continue; + } + + try { + if ( newifaceArray.type().name().equals(ifaceArray.componentType().name()) ) { + log3("ERROR : types are not equal :\n" + + "newifaceArray.type().name() =" + newifaceArray.type().name() + "\n" + + "ifaceArray.componentType().name()=" + ifaceArray.componentType().name() ); + testExitCode = FAILED; + continue; + } + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ClassNotLoadedException for newifaceArray.type().name().equals(.."); + testExitCode = FAILED; + continue; + } + + if (newifaceArray.length() != arraylength) { + log3("ERROR : newifaceArray.length() != arraylength " + newifaceArray.length()); + testExitCode = FAILED; + continue; + } + + if (newifaceArray.getValue(0) != null || + newifaceArray.getValue(1) != null) { + log3("ERROR: newifaceArray.getValue() != null "); + testExitCode = FAILED; + continue; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003/TestDescription.java new file mode 100644 index 00000000000..cd9844c15cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003/TestDescription.java @@ -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/ArrayType/newInstance/newinstance003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.newInstance() + * complies with its spec: + * public ArrayReference newInstance(int length) + * Creates a new instance of this array class in the target VM. + * The array is created with the given length and + * each component is initialized to is standard default value. + * Parameters: length - the number of components in the new array + * Returns: the newly created ArrayReference mirroring + * the new object in the target VM. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when components of this array class are interface type values. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.newInstance.newinstance003; + * the debuggee program - nsk.jdi.ArrayType.newInstance.newinstance003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.newInstance.newinstance003 + * nsk.jdi.ArrayType.newInstance.newinstance003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.newInstance.newinstance003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003a.java new file mode 100644 index 00000000000..0e4e16d9f8f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003a.java @@ -0,0 +1,137 @@ +/* + * 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.ArrayType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the newinstance003 JDI test. + */ + +public class newinstance003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> newinstance003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> newinstance003a: " + message); + } + + //====================================================== test program + + static newinstance003aTestClass obj = new newinstance003aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ArrayType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ArrayType.newInstance()
    + * complies with its spec when componentType of an ArrayType
    + * object used as original for newInstance() is ClassType.
    + * The test works as follows.
    + *
    + * For given debuggee's array whose components
    + * are objects of a class type,
    + * a debugger forms corresponding ArrayType object
    + * to which it applies newInstance() method in order to get
    + * an ArrayReference object, newarray.
    + * Then the debugger checks up that:
    + * - newInstance() method's returned value != null;
    + * - length of newly created array is equal to 'arg' in
    + * newInstance(int arg) method invocation;
    + * - newarray.type().name().equals(array.componentType().name());
    + * - all components of new array are nulls
    + * as its default values at the moment of the array creation.
    + *
    + */ + +public class newinstance004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ArrayType/newInstance/newinstance004 ", + sHeader2 = "--> newinstance004: ", + sHeader3 = "##> newinstance004: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new newinstance004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ArrayType.newInstance.newinstance004a"; + + String mName = "nsk.jdi.ArrayType.newInstance"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("newinstance004a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOftestedClasses = vm.classesByName(mName + ".newinstance004aTestClass"); + if (listOftestedClasses.size() != 1) { + log3("ERROR: listOftestedClasses.size() != 1"); + testExitCode = FAILED; + continue; + } + ReferenceType testedClass = + (ReferenceType) listOftestedClasses.get(0); + + Field fieldArray = testedClass.fieldByName("cfc"); + if (fieldArray == null) { + log3("ERROR: fieldArray == null"); + testExitCode = FAILED; + continue; + } + + final int arraylength = 2; + + ArrayType classArray = + (ArrayType) testedClass.getValue(fieldArray).type(); + + + ArrayReference newclassArray = null; + try { + newclassArray = classArray.newInstance(arraylength); + } catch ( Throwable e ) { + log3 ("ERROR: Exception: " + e); + testExitCode = FAILED; + continue; + } + if (newclassArray == null) { + log3("ERROR: newclassArray == null"); + testExitCode = FAILED; + continue; + } + + try { + if ( newclassArray.type().name().equals(classArray.componentType().name()) ) { + log3("ERROR : types are not equal :\n" + + "newclassArray.type().name() =" + newclassArray.type().name() + "\n" + + "classArray.componentType().name()=" + classArray.componentType().name() ); + testExitCode = FAILED; + continue; + } + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ClassNotLoadedException for newclassArray.type().name().equals(.."); + testExitCode = FAILED; + continue; + } + + if (newclassArray.length() != arraylength) { + log3("ERROR : newclassArray.length() != arraylength " + newclassArray.length()); + testExitCode = FAILED; + continue; + } + + if (newclassArray.getValue(0) != null || + newclassArray.getValue(1) != null) { + log3("ERROR: newclassArray.getValue() != null "); + testExitCode = FAILED; + continue; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004/TestDescription.java new file mode 100644 index 00000000000..ef350a7189e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004/TestDescription.java @@ -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/ArrayType/newInstance/newinstance004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ArrayType. + * The test checks up that a result of the method + * com.sun.jdi.ArrayType.newInstance() + * complies with its spec: + * public ArrayReference newInstance(int length) + * Creates a new instance of this array class in the target VM. + * The array is created with the given length and + * each component is initialized to is standard default value. + * Parameters: length - the number of components in the new array + * Returns: the newly created ArrayReference mirroring + * the new object in the target VM. + * Throws: ObjectCollectedException - + * if this array type has been unloaded and garbage collected. + * when components of this array class are class type values. + * The test works as follows: + * The debugger program - nsk.jdi.ArrayType.newInstance.newinstance004; + * the debuggee program - nsk.jdi.ArrayType.newInstance.newinstance004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ArrayType.newInstance.newinstance004 + * nsk.jdi.ArrayType.newInstance.newinstance004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ArrayType.newInstance.newinstance004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004a.java new file mode 100644 index 00000000000..0902f867053 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004a.java @@ -0,0 +1,146 @@ +/* + * 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.ArrayType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the newinstance004 JDI test. + */ + +public class newinstance004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> newinstance004a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> newinstance004a: " + message); + } + + //====================================================== test program + + static newinstance004aTestClass obj = new newinstance004aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.SocketAttach connector. + */ +public class attach001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = + "nsk.jdi.AttachingConnector.attach.attach001t"; + + private Log log; + + private VirtualMachine vm; + + private int attempts; // attempts to connect to the debugee VM + private int delay = 4000; // delay between connection attempts + + IORedirector outRedirector; + IORedirector errRedirector; + + 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 attach001().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String port; + String listenPort; + Process proc; + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if "com.sun.jdi.SocketAttach" is not implemented +// on this platform + if (argHandler.shouldPass("com.sun.jdi.SocketAttach")) + return PASSED; + + log = new Log(out, argHandler); + + String args[] = argHandler.getArguments(); + + // treat second positional argument as delay between connection attempts + try { + delay = Integer.parseInt(args[1]); + } catch (NumberFormatException e) { + log.complain("Incorrect test parameter: timeout value must be an integer"); + return FAILED; + } catch (ArrayIndexOutOfBoundsException e) { + // ignore: default delay will be used if no second argument present + } + // calculate number of connection attempts to not exceed WAITTIME + long timeout = argHandler.getWaitTime() * 60 * 1000; + attempts = (int)(timeout / delay); + + port = argHandler.getTransportPort(); + listenPort = argHandler.getTransportPort(); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=" + + listenPort + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + log.display("command: " + cmd); + Debugee debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + + if ((vm = attachTarget(argHandler.getTestHost(), port)) == null) { + log.complain("TEST: Unable to attach the debugee VM"); + debugee.close(); + return FAILED; + } + + log.display("debugee VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + debugee.setupVM(vm); + debugee.waitForVMInit(timeout); + + log.display("\nresuming debugee VM"); + debugee.resume(); + + log.display("\nwaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("debugee VM: exit code=" + code); + return PASSED; + } + + private VirtualMachine attachTarget(String host, String port) { + Connector.Argument arg; + + if (port == null) { + log.complain("TEST: port number is required!"); + return null; + } + + AttachingConnector connector = + (AttachingConnector) findConnector("com.sun.jdi.SocketAttach"); + + Map cArgs = connector.defaultArguments(); + Iterator cArgsValIter = cArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) cArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + connector.name()); + } + if (arg.name().equals("hostname") && host != null) + arg.setValue(host); + if (arg.name().equals("port")) + arg.setValue(port); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue="+argVal); + else log.display("\t\tvalue=NULL"); + } + + // make several attemts to connect to the debugee VM until WAITTIME exceeds + for (int i = 0; i < attempts; i++) { + try { + return connector.attach(cArgs); + } catch (IOException e) { + // could not connect; sleep a few and make new attempt + log.display("Connection attempt #" + i + " failed: " + e); + try { + Thread.currentThread().sleep(delay); + } catch (InterruptedException ie) { + log.complain("TEST INCOMPLETE: interrupted sleep: " + ie); + } + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return null; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return null; + } + } + // return null after all attempts failed + log.complain("FAILURE: all attempts to connect to the debugee VM failed"); + return null; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach001/TestDescription.java new file mode 100644 index 00000000000..3c8f78ecdd3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach001/TestDescription.java @@ -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/AttachingConnector/attach/attach001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.SocketAttach connector. + * COMMENT + * Test fixed due to bug: + * 4463674 TEST_BUG: some JDI tests are timing dependent + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * Test was fixed to provide early redirecting of debugee output. + * See bug: + * 4905551 shmemBase_listen failed: Cannot create a file when that file already exists + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attach.attach001 + * nsk.jdi.AttachingConnector.attach.attach001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach001t.java new file mode 100644 index 00000000000..2180fd002ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach001t.java @@ -0,0 +1,32 @@ +/* + * 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.AttachingConnector.attach; + +import java.io.IOException; + +public class attach001t { + public static void main(String args[]) { + System.exit(attach001.JCK_STATUS_BASE + attach001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002.java new file mode 100644 index 00000000000..d4092f95bea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002.java @@ -0,0 +1,208 @@ +/* + * 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.AttachingConnector.attach; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.ReferenceType; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.SharedMemoryAttach connector.
    + * The test also analyzes exit code of debugee's process. + */ +public class attach002 extends Log { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = + "nsk.jdi.AttachingConnector.attach.attach002t"; + + private Log log; + + private VirtualMachine vm; + + private int attempts; // attempts to connect to the debugee VM + private int delay = 4000; // delay between connection attempts + + IORedirector outRedirector; + IORedirector errRedirector; + + 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 attach002().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String name; + Process proc; + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if "com.sun.jdi.SharedMemoryAttach" is not implemented +// on this platform + if (argHandler.shouldPass("com.sun.jdi.SharedMemoryAttach")) + return PASSED; + + log = new Log(out, argHandler); + + String args[] = argHandler.getArguments(); + + // treat second positional argument as delay between connection attempts + try { + delay = Integer.parseInt(args[1]); + } catch (NumberFormatException e) { + log.complain("Incorrect test parameter: timeout value must be an integer"); + return FAILED; + } catch (ArrayIndexOutOfBoundsException e) { + // ignore: default delay will be used if no second argument present + } + + // calculate number of connection attempts to not exceed WAITTIME + long timeout = argHandler.getWaitTime() * 60 * 1000; + attempts = (int)(timeout / delay); + + name = argHandler.getTransportSharedName(); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_shmem,server=y,address=" + + name + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + log.display("command: " + cmd); + Debugee debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + + if ((vm = attachTarget(name)) == null) { + log.complain("TEST: Unable to attach the debugee VM"); + debugee.close(); + return FAILED; + } + + log.display("target VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + debugee.setupVM(vm); + debugee.waitForVMInit(timeout); + + log.display("\nResuming debugee VM"); + debugee.resume(); + + log.display("\nWaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + code); + return FAILED; + } + log.display("Debugee VM: exit code=" + code); + return PASSED; + } + + private VirtualMachine attachTarget(String name) { + Connector.Argument arg; + + if (name == null) { + log.complain("TEST: shared memory name is required!"); + return null; + } + + AttachingConnector connector = + (AttachingConnector) findConnector("com.sun.jdi.SharedMemoryAttach"); + + Map cArgs = connector.defaultArguments(); + Iterator cArgsValIter = cArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) cArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + connector.name()); + } + if (arg.name().equals("name")) + arg.setValue(name); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue="+argVal); + else log.display("\t\tvalue=NULL"); + } + + // make several attemts to connect to the debugee VM until WAITTIME exceeds + for (int i = 0; i < attempts; i++) { + try { + return connector.attach(cArgs); + } catch (IOException e) { + // could not connect; sleep a few and make new attempt + log.display("Connection attempt #" + i + " failed: " + e); + try { + Thread.currentThread().sleep(delay); + } catch (InterruptedException ie) { + log.complain("TEST INCOMPLETE: interrupted sleep: " + ie); + } + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return null; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return null; + } + } + // return null after all attempts failed + log.complain("FAILURE: all attempts to connect to the debugee VM failed"); + return null; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002/TestDescription.java new file mode 100644 index 00000000000..b945c4a49eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/AttachingConnector/attach/attach002. + * VM Testbase keywords: [quick, jpda, jdi, quarantine] + * VM Testbase comments: JDK-8054463 + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.SharedMemoryAttach connector. + * The test also analyzes exit code of debugee's process. + * COMMENT + * Test fixed due to bug: + * 4463674 TEST_BUG: some JDI tests are timing dependent + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * Test was fixed to provide early redirecting of debugee output. + * See bug: + * 4905551 shmemBase_listen failed: Cannot create a file when that file already exists + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attach.attach002 + * nsk.jdi.AttachingConnector.attach.attach002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002t.java new file mode 100644 index 00000000000..7837d3d47be --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach002t.java @@ -0,0 +1,32 @@ +/* + * 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.AttachingConnector.attach; + +import java.io.IOException; + +public class attach002t { + public static void main(String args[]) { + System.exit(attach002.JCK_STATUS_BASE + attach002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach003.java new file mode 100644 index 00000000000..a7b52e9f6b8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach003.java @@ -0,0 +1,144 @@ +/* + * 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.AttachingConnector.attach; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + + +/** + * The test check up two cases:
    + * 1. Parameter has null value. In this case NullPointerException
    + * is expected.
    + * 2. Parameter has wrong arguments. In this case
    + * IllegalConnectorArgumentsException is expected.
    + * Checking of the each case is executed by performStep method.
    + * Note, this test establishes no connections with debugee, just checks performing of
    + * attach with wrong parameters.
    + */ +public class attach003 { + + private final static String[][] ARGS = { + {"first_key", "first_value"}, + {"second_key","second_value"}, + {"third_key", "third_value"} + }; + + private static Log log; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + return execTest(argv, out); + } + + // this method does bad things + @SuppressWarnings("unchecked") + private static int execTest(String argv[], PrintStream out) { + + int exitCode = Consts.TEST_PASSED; + + log = new Log(out, new ArgumentHandler(argv)); + + List connectors = Bootstrap.virtualMachineManager().attachingConnectors(); + log.display("Getting of " + connectors.size() + " connectors."); + log.display("-----------------------------------------------"); + + Map arguments = null; + log.display("Checking of parameter."); + if (!performStep(connectors, arguments)) + exitCode = Consts.TEST_FAILED; + + log.display("-----------------------------------------------"); + log.display("Checking of parameter with wrong arguments:"); + Attributes amap = new Attributes(); + arguments = (Map)(Map)amap; + + for (int i =0 ; i < ARGS.length; i++) { + log.display(i + ". " + ARGS[i][0] + " , " + ARGS[i][1] ); + amap.putValue(ARGS[i][0], ARGS[i][1]); + } + log.display(""); + if (!performStep(connectors, arguments)) + exitCode = Consts.TEST_FAILED; + + return exitCode; + } + + private static boolean performStep(List connectors, Map arguments) { + boolean res = true; + VirtualMachine vm; + AttachingConnector connector; + for (int i = 0; i < connectors.size(); i++) { + connector = (AttachingConnector )connectors.get(i); + if (connector == null) { + log.complain("Wrong connector " + connector + ": index=" + i + + " size of connectors list=" + + connectors.size()); + res = false; + continue; + } + try { + log.display("Connector " + connector.name() + ":"); + vm = connector.attach(arguments); + if (arguments == null) { + log.complain("\tNullPointerException is not thrown.\n"); + res = false; + } else { + log.complain("\tIllegalConnectorArgumentsException " + + "is not thrown.\n"); + res = false; + } + } catch (NullPointerException e) { + if (arguments != null) { + log.complain("\tunexpected NullPointerException.\n"); + res = false; + continue; + } + log.display("\texpected NullPointerException.\n"); + } catch (IllegalConnectorArgumentsException e) { + if (arguments == null) { + log.complain("\tunexpected IllegalConnectorArgumentsException.\n"); + res = false; + continue; + } + log.display("\texpected IllegalConnectorArgumentsException.\n"); + } catch (Exception e) { + log.complain("\tunexpected " + e ); + res = false; + } + } + return res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach003/TestDescription.java new file mode 100644 index 00000000000..d41a835ada3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach003/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/AttachingConnector/attach/attach003. + * VM Testbase keywords: [quick, 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.connect.AttachingConnector.attach(Map) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public VirtualMachine attach(Map arguments) + * throws IOException, + * IllegalConnectorArgumentsException + * Attaches to a running application and and returns a mirror of its VM. + * The connector uses the given argument map in attaching the application. + * These arguments will include addressing information that identifies + * the VM. The argument map associates argument name strings to instances + * of Connector.Argument. The default argument map for a connector can be + * obtained through Connector.defaultArguments(). Argument map values can + * be changed, but map entries should not be added or deleted. + * Parameters: + * arguments - the argument map to be used in launching the VM. + * Returns: + * the VirtualMachine mirror of the target VM. + * Throws: + * IOException - when unable to attach. Specific exceptions are + * dependent on the Connector implementation in use. + * IllegalConnectorArgumentsException - when one of the connector + * arguments is invalid. + * The test check up two cases: + * 1. Parameter has value. In this case NullPointerException + * is expected. + * 2. Parameter has wrong arguments. In this case + * IllegalConnectorArgumentsException is expected. + * 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.AttachingConnector.attach.attach003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDescription.java new file mode 100644 index 00000000000..11d59a2020b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDescription.java @@ -0,0 +1,46 @@ +/* + * 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/AttachingConnector/attach/attach004. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.ProcessAttach connector. + * Target VM is started with option "suspend=y" (VM is to be suspended immediately before the main class is loaded). + * Test uses socket transport for communication between a debugger and the target VM. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * @run driver PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * ${os.family}-${os.simpleArch} dt_socket y + * -waitVMStartEvent + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDriver.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDriver.java new file mode 100644 index 00000000000..7cc94acbf83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDriver.java @@ -0,0 +1,183 @@ +/* + * 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. + */ + +package nsk.jdi.AttachingConnector.attach.attach004; + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Utils; +import nsk.share.jdi.ArgumentHandler; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class TestDriver { + public static void main(String[] args) throws InterruptedException { + String arch = args[0]; + String transport = args[1]; + String jdiTransport; + // Need convert transport argument to string recognizable by nsk.share.jdi.ArgumentHandler + switch (transport) { + case "dt_socket": + jdiTransport = "socket"; + break; + case "dt_shmem": + jdiTransport = "shmem"; + break; + default: + throw new Error("Unexpected transport " + args[0] + + ", expected is dt_socket or dt_shmem"); + } + String[] jdiArgs = new String[]{ + "-connector=attaching", + "-transport=" + jdiTransport, + "-verbose", + "-waittime=5", + "-debugee.vmkind=java", + "-transport.address=dynamic", + "-arch=" + arch + }; + + if (isTransportSupported(jdiArgs)) { + System.out.println("Transport is supported on this platform, execute test"); + String suspend = args[2]; + Process debuggee = startDebuggee(jdiArgs, transport, suspend); + Process debugger = startDebugger(jdiArgs, Arrays.copyOfRange(args, 3, args.length), debuggee.pid()); + + int debuggerExit = debugger.waitFor(); + if (debuggerExit != 95) { + throw new Error("debugger exit code is " + debuggerExit); + } + + int debuggeeExit = debuggee.waitFor(); + if (debuggeeExit != 95) { + throw new Error("debuggee exit code is " + debuggeeExit); + } + } else { + System.out.println("SKIPPED: Transport isn't supported on this platform, treat test as passed"); + } + } + + + private static Process startDebuggee(String[] jdiArgs, String transport, String suspend) { + List cmd = new ArrayList<>(); + Class debuggeeClass = attach004t.class; + cmd.add(JDKToolFinder.getJDKTool("java")); + Collections.addAll(cmd, Utils.addTestJavaOpts( + "-cp", + Utils.TEST_CLASS_PATH, + "-Xdebug", + "-agentlib:jdwp=transport=" + transport + ",server=y,suspend=" + suspend, + "-Dmy.little.cookie=" + ProcessHandle.current().pid(), + debuggeeClass.getName())); + Collections.addAll(cmd, jdiArgs); + cmd.add("-testWorkDir"); + cmd.add("."); + + System.out.println("Starting debuggee [" + String.join(",", cmd) + "]"); + Process p; + try { + p = new ProcessBuilder(cmd).redirectErrorStream(true).start(); + } catch (IOException e) { + throw new Error("can't start debuggee"); + } + + Thread t = new Thread(() -> dumpStream("debuggee>> ", p.getInputStream())); + t.setDaemon(true); + t.start(); + + return p; + } + + private static Process startDebugger(String[] jdiArgs, String[] debuggerArgs, long debuggeePid) { + List cmd = new ArrayList<>(); + Class debuggerClass = attach004.class; + cmd.add(JDKToolFinder.getJDKTool("java")); + Collections.addAll(cmd, Utils.addTestJavaOpts( + "-cp", + Utils.TEST_CLASS_PATH, + debuggerClass.getName(), + "-debuggeePID", + "" + debuggeePid)); + Collections.addAll(cmd, debuggerArgs); + Collections.addAll(cmd, jdiArgs); + cmd.add("-testWorkDir"); + cmd.add("."); + + System.out.println("Starting debugger [" + String.join(",", cmd) + "]"); + Process p; + try { + p = new ProcessBuilder(cmd).redirectErrorStream(true).start(); + } catch (IOException e) { + throw new Error("can't start debugger"); + } + + Thread t = new Thread(() -> dumpStream("debugger>> ", p.getInputStream())); + t.setDaemon(true); + t.start(); + + return p; + } + + private static void dumpStream(String prefix, InputStream is) { + + byte[] buffer = new byte[1024]; + int n; + try (BufferedReader r = new BufferedReader(new InputStreamReader(is))) { + String line; + while ((line = r.readLine()) != null) { + System.out.println(prefix + line); + System.out.flush(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static boolean isTransportSupported(String[] jdiArgs) { + ArgumentHandler argHandler = new ArgumentHandler(jdiArgs); + + boolean result; + + if (argHandler.isShmemTransport()) { + result = !argHandler.shouldPass("dt_shmem"); + } else { + result = !argHandler.shouldPass("dt_socket"); + } + + if (result) { + System.out.println("Transport " + argHandler.getTransportType() + + " is result at " + argHandler.getArch()); + } else { + System.out.println("Transport " + argHandler.getTransportType() + + " isn't result at " + argHandler.getArch()); + } + + return result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/attach004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/attach004.java new file mode 100644 index 00000000000..e7346f124c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/attach004.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2007, 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.AttachingConnector.attach.attach004; + +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import nsk.share.*; +import nsk.share.ArgumentParser.BadOption; +import nsk.share.jdi.*; +import nsk.share.jdi.ConnectorTest.ArgHandler; +import nsk.share.jpda.SocketIOPipe; + +/* + * The test checks that debugger may establish connection with + * a target VM via 'com.sun.jdi.ProcessAttach' connector. + * + * Test receives target VM PID as parameter and tries to attach + * to target VM using ProcessAttach connector. + * + * To make test reliable following algorithm is used: + * - debugger attaches to the debuggee using ProcessAttach connector + * - debugger creates server socket using free port, saves this port number to the file 'portNumber.txt' and waits + * connection from debuggee process + * - when debuggee is started it waits when file 'portNumber.txt' is created, reads port number from this file and + * sends message to debugger that debuggee is ready to finish execution + * - debugger receives message from debuggee and sends another message which permits debuggee finish execution + */ +public class attach004 extends ConnectorTest { + + static String messageOK = "OK"; + + static String messageQuit = "QUIT"; + + static final String tempFileName = "portNumber.txt"; + + protected String getConnectorName() { + return "com.sun.jdi.ProcessAttach"; + } + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new attach004().runIt(argv, out); + } + + protected String getDebuggeeClass() { + return attach004t.class.getName(); + } + + static public class ArgHandler extends ConnectorTest.ArgHandler { + public ArgHandler(String[] args) { + super(args); + + } + + protected boolean checkOption(String option, String value) { + if (super.checkOption(option, value)) + return true; + + if (option.equals("debuggeePID")) { + return true; + } + + return false; + } + + protected void checkOptions() { + super.checkOptions(); + + if (!options.containsKey("testWorkDir")) { + throw new TestBug("testWorkDir wasn't specified"); + } + + if (!options.containsKey("debuggeePID")) { + throw new TestBug("debuggeePID wasn't specified"); + } + } + + public String getDebuggeePID() { + return options.getProperty("debuggeePID"); + } + } + + protected ArgHandler createArgumentHandler(String[] args) { + return new ArgHandler(args); + } + + protected void doTest() { + AttachingConnector connector = (AttachingConnector)findConnector(getConnectorName()); + + Map cArgs = connector.defaultArguments(); + + setConnectorArg(cArgs, "pid", ((ArgHandler)argHandler).getDebuggeePID()); + + if ((vm = tryAttach(connector, cArgs)) == null) { + testFailed(); + log.complain("Unable to attach the debugee VM"); + } + + log.display("debugee VM: name=" + vm.name() + " JRE version=" + vm.version() + "\n\tdescription=" + vm.description()); + + if (argHandler.waitVMStartEvent()) { + log.display("\nwaiting for VMStartEvent"); + waitForVMInit(vm); + log.display("\nresuming debugee VM"); + vm.resume(); + } + + SocketIOPipe pipe = null; + + try { + // create server socket on free port + pipe = SocketIOPipe.createServerIOPipe(log, 0, 0); + + // save port number in file + int port = pipe.getPort(); + savePortNumber(port); + + String message = pipe.readln(); + log.display("Received from debuggee: " + message); + + if (!message.equals(messageOK)) { + throw new TestBug("Unexpected debuggee message: " + message); + } + + log.display("Send message to debuggee: " + messageQuit); + pipe.println(messageQuit); + } finally { + if (pipe != null) + pipe.close(); + } + } + + private void savePortNumber(int portNumber) { + try { + File file = new File(argHandler.getTestWorkDir() + File.separator + tempFileName); + file.createNewFile(); + file.deleteOnExit(); + + PrintStream stream = null; + try { + stream = new PrintStream(new FileOutputStream(file)); + // conver portNumber to string + stream.println("" + portNumber); + } finally { + if (stream != null) + stream.close(); + } + + } catch (IOException e) { + log.complain("Unexpected IOException: " + e); + e.printStackTrace(log.getOutStream()); + throw new Failure("Unexpected IOException: " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/attach004t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/attach004t.java new file mode 100644 index 00000000000..342c90c2c72 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/attach004t.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2007, 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.AttachingConnector.attach.attach004; + +import java.io.*; +import java.util.*; +import nsk.share.*; +import nsk.share.jdi.ArgumentHandler; +import nsk.share.jpda.SocketIOPipe; + +public class attach004t { + + static String testWorkDir; + + static String[] parseArgs(String[] args) { + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testWorkDir") && (i < args.length - 1)) { + testWorkDir = args[i + 1]; + + if (testWorkDir.endsWith(File.separator)) { + testWorkDir = testWorkDir.substring(0, testWorkDir.length() - 1); + } + + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + static int readPortNumber(Log log) { + try { + String fileName = testWorkDir + File.separator + attach004.tempFileName; + File file = new File(fileName); + + while (!file.exists()) { + log.display("File '" + file + "' doesn't exists, sleep some"); + Thread.sleep(1000); + } + + LineNumberReader reader = null; + + try { + FileInputStream fileInputStream = new FileInputStream(file); + while (fileInputStream.available() == 0) { + log.display("File '" + file + "' is empty, sleep some"); + Thread.sleep(1000); + } + + reader = new LineNumberReader(new InputStreamReader(fileInputStream)); + String portString = reader.readLine(); + + log.display("Port number was read: " + portString); + + return Integer.parseInt(portString); + } finally { + if (reader != null) + reader.close(); + } + + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + throw new Failure("Unexpected exception: " + e); + } + } + + public static void main(String args[]) throws InterruptedException { + ArgumentHandler argHandler = new ArgumentHandler(parseArgs(args)); + + if (testWorkDir == null) { + throw new TestBug("'testWorkDir' parameter wasn't specified"); + } + + Log log = argHandler.createDebugeeLog(); + + log.display("attach004t was started"); + + SocketIOPipe pipe = null; + try { + int portNumber = readPortNumber(log); + pipe = SocketIOPipe.createClientIOPipe(log, "localhost", portNumber, 0); + log.display("Send message to debugger: " + attach004.messageOK); + pipe.println(attach004.messageOK); + + String message = pipe.readln(); + log.display("Received from debugger: " + message); + if (!message.equals(attach004.messageQuit)) { + throw new TestBug("Unexpected debugger message: " + message); + } + + final long sleepTime = 10000; + + log.display("Sleep for " + sleepTime + "ms"); + try { + // debugee VM should wait here, otherwise test script doesn't have time to obtain debuggee exit code + Thread.sleep(sleepTime); + } catch (InterruptedException e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + throw new Failure("Unexpected exception: " + e); + } + + log.display("attach004t finished execution"); + } finally { + if (pipe != null) + pipe.close(); + } + + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach005/TestDescription.java new file mode 100644 index 00000000000..9136df49351 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach005/TestDescription.java @@ -0,0 +1,46 @@ +/* + * 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/AttachingConnector/attach/attach005. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.ProcessAttach connector. + * Target VM is started with option "suspend=y" (VM is to be suspended immediately before the main class is loaded). + * Test uses shared memory for communication between a debugger and the target VM. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * @run driver PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * ${os.family}-${os.simpleArch} dt_shmem y + * -waitVMStartEvent + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001.java new file mode 100644 index 00000000000..a3c5a27178a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2007, 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.AttachingConnector.attachnosuspend; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.ReferenceType; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.SocketAttach connector. + */ +public class attachnosuspend001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = + "nsk.jdi.AttachingConnector.attachnosuspend.attachnosuspend001t"; + + private Log log; + + private VirtualMachine vm; + + private int attempts; // attempts to connect to the debugee VM + private int delay = 4000; // delay between connection attempts + + IORedirector outRedirector; + IORedirector errRedirector; + + 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 attachnosuspend001().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String port; + String listenPort; + Process proc; + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if "com.sun.jdi.SocketAttach" is not implemented +// on this platform + if (argHandler.shouldPass("com.sun.jdi.SocketAttach")) + return PASSED; + + log = new Log(out, argHandler); + + String args[] = argHandler.getArguments(); + + // treat second positional argument as delay between connection attempts + try { + delay = Integer.parseInt(args[1]); + } catch (NumberFormatException e) { + log.complain("Incorrect test parameter: timeout value must be an integer"); + return FAILED; + } catch (ArrayIndexOutOfBoundsException e) { + // ignore: default delay will be used if no second argument present + } + // calculate number of connection attempts to not exceed WAITTIME + long timeout = argHandler.getWaitTime() * 60 * 1000; + attempts = (int)(timeout / delay); + + port = argHandler.getTransportPort(); + listenPort = argHandler.getTransportPort(); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + String cmd = java + + " -Xdebug -Xnoagent -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=" + + listenPort + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + log.display("command: " + cmd); + Debugee debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + + if ((vm = attachTarget(argHandler.getTestHost(), port)) == null) { + log.complain("TEST: Unable to attach the debugee VM"); + debugee.close(); + return FAILED; + } + + log.display("debugee VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + debugee.setupVM(vm); + //debugee.waitForVMInit(timeout); + + //log.display("\nresuming debugee VM"); + //debugee.resume(); + + log.display("\nwaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("debugee VM: exit code=" + code); + return PASSED; + } + + private VirtualMachine attachTarget(String host, String port) { + Connector.Argument arg; + + if (port == null) { + log.complain("TEST: port number is required!"); + return null; + } + + AttachingConnector connector = + (AttachingConnector) findConnector("com.sun.jdi.SocketAttach"); + + Map cArgs = connector.defaultArguments(); + Iterator cArgsValIter = cArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) cArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + connector.name()); + } + if (arg.name().equals("hostname") && host != null) + arg.setValue(host); + if (arg.name().equals("port")) + arg.setValue(port); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue="+argVal); + else log.display("\t\tvalue=NULL"); + } + + // make several attemts to connect to the debugee VM until WAITTIME exceeds + for (int i = 0; i < attempts; i++) { + try { + return connector.attach(cArgs); + } catch (IOException e) { + // could not connect; sleep a few and make new attempt + log.display("Connection attempt #" + i + " failed: " + e); + try { + Thread.currentThread().sleep(delay); + } catch (InterruptedException ie) { + log.complain("TEST INCOMPLETE: interrupted sleep: " + ie); + } + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return null; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return null; + } + } + // return null after all attempts failed + log.complain("FAILURE: all attempts to connect to the debugee VM failed"); + return null; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001/TestDescription.java new file mode 100644 index 00000000000..3b04b420e8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001/TestDescription.java @@ -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/AttachingConnector/attachnosuspend/attachnosuspend001. + * VM Testbase keywords: [quarantine] + * VM Testbase comments: JDK-8153613 + * VM Testbase readme: + * DESCRIPTION + * This test exactly as attach001 except using options: + * -agentlib:jdwb + * suspend=n + * Unfortunately, there is no way to handle VMStartEvent, + * because connection may happens later then event occured. + * COMMENT + * RFE 4920165 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attachnosuspend.attachnosuspend001 + * nsk.jdi.AttachingConnector.attachnosuspend.attachnosuspend001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attachnosuspend.attachnosuspend001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001t.java new file mode 100644 index 00000000000..cc552a09e00 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001t.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2007, 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.AttachingConnector.attachnosuspend; + +import java.io.IOException; + +public class attachnosuspend001t { + public static void main(String args[]) { + try { + Thread.sleep(60000); + } catch (Throwable e) + { + e.printStackTrace(); + System.exit(attachnosuspend001.JCK_STATUS_BASE + attachnosuspend001.FAILED); + } + System.exit(attachnosuspend001.JCK_STATUS_BASE + attachnosuspend001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend002/TestDescription.java new file mode 100644 index 00000000000..df9650ad812 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend002/TestDescription.java @@ -0,0 +1,44 @@ +/* + * 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/AttachingConnector/attachnosuspend/attachnosuspend002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.ProcessAttach connector. + * Test uses socket transport for communication between a debugger and the target VM. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * @run driver PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * ${os.family}-${os.simpleArch} dt_socket n + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend003/TestDescription.java new file mode 100644 index 00000000000..53507ad3bd9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend003/TestDescription.java @@ -0,0 +1,44 @@ +/* + * 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/AttachingConnector/attachnosuspend/attachnosuspend003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a target VM via com.sun.jdi.ProcessAttach connector. + * Test uses shared memory transport for communication between a debugger and the target VM. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * @run driver PropertyResolvingWrapper + * nsk.jdi.AttachingConnector.attach.attach004.TestDriver + * ${os.family}-${os.simpleArch} dt_shmem n + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001.java new file mode 100644 index 00000000000..6aac8fbc989 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001.java @@ -0,0 +1,284 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC1 + * Description: After point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as next line after point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Resume + * X. Prints out "foo" after printing the + * numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 37th line (method code>method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into ethod_A and resumes debugee. It is expected + * the added line will be not actual after the redefining according to + * redefineClasses spec: + * "The redefined method will be used on new invokes. If resetting these + * frames is desired, use ThreadReference.popFrames() with + * Method.isObsolete()." + */ + +public class tc01x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc01x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 5; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc01x001 thisTest = new tc01x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + int eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc01x001a.brkpMethodName, + tc01x001a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + display("redefining..."); + redefineDebugee(); + + createMethodExitRequest(debugeeClass); + debugee.resume(); + eventCount++; + + } else if (event instanceof MethodExitEvent) { + display("\n event ===>>> " + event); + Method mthd = ((MethodExitEvent )event).method(); + eventCount++; + display("exiting from \"" + mthd.name() + "\" method"); + if (mthd.isObsolete()) { + Field fld = debugeeClass.fieldByName(tc01x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() == tc01x001a.CHANGED_VALUE) { + complain("Unexpected: new code is actual " + + "without resetting frames"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: new code is not actual " + + "without resetting frames!!!"); + } + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/TestDescription.java new file mode 100644 index 00000000000..d5fcc116edf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/BScenarios/hotswap/tc01x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC1 + * Description: After point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as next line after point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Resume + * X. Prints out "foo" after printing the + * numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 37th line (method "method_A"). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into "method_A" and resumes debugee. It is expected the + * new code will be NOT actual after the redefining (see COMMENTS) + * COMMENTS: + * Step 5 of Borland's scenario is wrong due to redefineClasses spec says: + * "The redefined method will be used on new invokes. If resetting these + * frames is desired, use ThreadReference.popFrames() with + * Method.isObsolete()." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc01x001 + * nsk.jdi.BScenarios.hotswap.tc01x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc01x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/newclass/tc01x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/newclass/tc01x001a.java new file mode 100644 index 00000000000..14269be58d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/newclass/tc01x001a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x001a is deugee's part of the tc01x001. + */ +public class tc01x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 56; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc01x001a obj = new tc01x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber + method_B(); + fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001a.java new file mode 100644 index 00000000000..dee625307a6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x001a is deugee's part of the tc01x001. + */ +public class tc01x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc01x001a obj = new tc01x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber +// fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002.java new file mode 100644 index 00000000000..48a6411dfe4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002.java @@ -0,0 +1,295 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC1 + * Description: After point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as next line after point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Resume + * X. Prints out "foo" after printing the + * numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 37th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, pops current frame and resumes debugee. + * It is expected the new code will be actual after the redefining + * + * Step 5 of Borland's scenario is wrong due to redefineClasses spec says: + * "The redefined method will be used on new invokes. If resetting these + * frames is desired, use ThreadReference.popFrames() with + * Method.isObsolete()." + */ + +public class tc01x002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc01x002"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 5; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc01x002 thisTest = new tc01x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + int eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc01x002a.brkpMethodName, + tc01x002a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + + createMethodExitRequest(debugeeClass); + debugee.resume(); + eventCount++; + + } else if (event instanceof MethodExitEvent) { + display("\n event ===>>> " + event); + Method mthd = ((MethodExitEvent )event).method(); + eventCount++; + display("exiting from \"" + mthd.name() + "\" method"); + if (mthd.name().compareTo(tc01x002a.brkpMethodName) == 0) { + Field fld = debugeeClass.fieldByName(tc01x002a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc01x002a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual " + + "after resetting frames"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: new code is actual " + + "after resetting frames!!!"); + } + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private void popFrames(ThreadReference thread) { + try { + StackFrame frame = thread.frame(0); + thread.popFrames(frame); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/TestDescription.java new file mode 100644 index 00000000000..519ea3b2c3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/BScenarios/hotswap/tc01x002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC1 + * Description: After point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as next line after point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Resume + * X. Prints out "foo" after printing the + * numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 37th line (method "method_A"). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into "method_A", pops current frame and resumes debugee. + * It is expected the new code will be actual after the redefining + * (see COMMENTS). + * COMMENTS: + * Step 5 of Borland's scenario is wrong due to redefineClasses spec says: + * "The redefined method will be used on new invokes. If resetting these + * frames is desired, use ThreadReference.popFrames() with + * Method.isObsolete()." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc01x002 + * nsk.jdi.BScenarios.hotswap.tc01x002a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc01x002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/newclass/tc01x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/newclass/tc01x002a.java new file mode 100644 index 00000000000..d2447dc10a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/newclass/tc01x002a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x002a is deugee's part of the tc01x002. + */ +public class tc01x002a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 56; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc01x002a obj = new tc01x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber + method_B(); + fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002a.java new file mode 100644 index 00000000000..b52cdd45bd1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x002a is deugee's part of the tc01x002. + */ +public class tc01x002a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc01x002a obj = new tc01x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber +// fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001.java new file mode 100644 index 00000000000..aba42b2ce3c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001.java @@ -0,0 +1,339 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC2 + * Description: Before point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as line before point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * on line 24 + * 7.Resume + * X. Prints numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger:
    + * - redefines debugee adding a new line into "method_A",
    + * - pops current frame
    + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it doesn't hit breakpoint according to JVMDI Redefine Classes spec : + * "...All breakpoints in the class are cleared." + */ + +public class tc02x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc02x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 5; + private int eventCount = 0; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc02x001 thisTest = new tc02x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc02x001a.brkpMethodName, + tc02x001a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + switch (eventCount) { + case 1: + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + createMethodExitRequest(debugeeClass); + + break; + + default: + complain("Unexpected breakpoint event"); + exitStatus = Consts.TEST_FAILED; + } + eventCount++; + hitBreakpoint((BreakpointEvent )event); + debugee.resume(); + + } else if (event instanceof MethodExitEvent) { + display("\n event ===>>> " + event); + hitMethodExit((MethodExitEvent)event); + eventCount++; + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private void popFrames(ThreadReference thread) { + try { + StackFrame frame = thread.frame(0); + thread.popFrames(frame); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc02x001a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc02x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitMethodExit(MethodExitEvent event) { + + locationInfo(event); + + Method mthd = ((MethodExitEvent )event).method(); + if (mthd.name().compareTo(tc02x001a.brkpMethodName) == 0) { + Field fld = debugeeClass.fieldByName(tc02x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc02x001a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual " + + "after resetting frames"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: new code is actual " + + "after resetting frames!!!"); + } + } + display(""); + } + + private void locationInfo(LocatableEvent event) { + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/TestDescription.java new file mode 100644 index 00000000000..3cf356a3ce4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/TestDescription.java @@ -0,0 +1,93 @@ +/* + * 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/BScenarios/hotswap/tc02x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC2 + * Description: Before point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as line before point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * on line 24 + * 7.Resume + * X. Prints numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method "method_A"). + * After the breakpoint is reached, debugger: + * - redefines debugee adding a new line into "method_A", + * - pops current frame + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it doesn't hit breakpoint (see COMMENTS). + * COMMENTS: + * In step 6 waiting breakpoint is wrong due to JVMDI Redefine + * Classes spec says:"...All breakpoints in the class are cleared." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc02x001 + * nsk.jdi.BScenarios.hotswap.tc02x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc02x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/newclass/tc02x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/newclass/tc02x001a.java new file mode 100644 index 00000000000..922b09247e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/newclass/tc02x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x001a is deugee's part of the tc02x001. + */ +public class tc02x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static int checkLastLine = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc02x001a obj = new tc02x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber // checkLastLine + method_B(); + fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001a.java new file mode 100644 index 00000000000..4c4c2288c5d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x001a is deugee's part of the tc02x001. + */ +public class tc02x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 58; + public final static int checkLastLine = 58; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc02x001a obj = new tc02x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber // checkLastLine +// fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002.java new file mode 100644 index 00000000000..eaeb7cbdc5d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002.java @@ -0,0 +1,347 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC2 + * Description: Before point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as line before point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * on line 24 + * 7.Resume + * X. Prints numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger:
    + * - redefines debugee adding a new line into "method_A",
    + * - pops current frame,
    + * - sets breakpoint at the 38th line again
    + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it doesn't hit breakpoint according to JVMDI Redefine Classes spec : + * "...All breakpoints in the class are cleared." + */ + +public class tc02x002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc02x002"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 6; + private int eventCount = 0; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc02x002 thisTest = new tc02x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc02x002a.brkpMethodName, + tc02x002a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + switch (eventCount) { + case 1: + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + + debugee.setBreakpoint(debugeeClass, + tc02x002a.brkpMethodName, + tc02x002a.brkpLineNumber); + break; + + case 2: + display("!!!Expected second breakpoint event!!!"); + createMethodExitRequest(debugeeClass); + break; + + default: + complain("Unexpected breakpoint event"); + exitStatus = Consts.TEST_FAILED; + } + eventCount++; + hitBreakpoint((BreakpointEvent )event); + debugee.resume(); + + } else if (event instanceof MethodExitEvent) { + display("\n event ===>>> " + event); + hitMethodExit((MethodExitEvent)event); + eventCount++; + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private void popFrames(ThreadReference thread) { + try { + StackFrame frame = thread.frame(0); + thread.popFrames(frame); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc02x002a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc02x002a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitMethodExit(MethodExitEvent event) { + + locationInfo(event); + + Method mthd = ((MethodExitEvent )event).method(); + if (mthd.name().compareTo(tc02x002a.brkpMethodName) == 0) { + Field fld = debugeeClass.fieldByName(tc02x002a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc02x002a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual " + + "after resetting frames"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: new code is actual " + + "after resetting frames!!!"); + } + } + display(""); + } + + private void locationInfo(LocatableEvent event) { + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/TestDescription.java new file mode 100644 index 00000000000..ac19172c5c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/BScenarios/hotswap/tc02x002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC2 + * Description: Before point of execution, same method + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as line before point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * on line 24 + * 7.Resume + * X. Prints numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method "method_A"). + * After the breakpoint is reached, debugger: + * - redefines debugee adding a new line into "method_A", + * - pops current frame, + * - sets breakpoint at the 38th line again + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it hits breakpoint. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc02x002 + * nsk.jdi.BScenarios.hotswap.tc02x002a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc02x002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/newclass/tc02x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/newclass/tc02x002a.java new file mode 100644 index 00000000000..738f400eaef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/newclass/tc02x002a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x002a is deugee's part of the tc02x002. + */ +public class tc02x002a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static int checkLastLine = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc02x002a obj = new tc02x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber // checkLastLine + method_B(); + fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002a.java new file mode 100644 index 00000000000..06258a33ff4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x002a is deugee's part of the tc02x002. + */ +public class tc02x002a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 58; + public final static int checkLastLine = 58; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc02x002a obj = new tc02x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber // checkLastLine +// fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001.java new file mode 100644 index 00000000000..16644e8f6e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001.java @@ -0,0 +1,282 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC3 + * Description: After point of execution, different method + * Steps: 1.Set breakpoint at line 24 (call from a() + * to b()) + * 2.Debug Main + * 3.Insert as first line in b(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Resume + * X. Prints out "foo" before printing the + * numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 37th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * first line into method_B and resumes debugee. It is expected the + * new code will be actual before calling method_C + */ + +public class tc03x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc03x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 4; + private static final String methodNameToCheck = "method_C"; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc03x001 thisTest = new tc03x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + int eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc03x001a.brkpMethodName, + tc03x001a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + display("redefining..."); + redefineDebugee(); + + createMethodEntryRequest(debugeeClass); + debugee.resume(); + eventCount++; + + } else if (event instanceof MethodEntryEvent) { + display("\n event ===>>> " + event); + Method mthd = ((MethodEntryEvent )event).method(); + eventCount++; + display("exiting from \"" + mthd.name() + "\" method"); + if (mthd.name().compareTo(methodNameToCheck) == 0) { + Field fld = debugeeClass.fieldByName(tc03x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() == tc03x001a.CHANGED_VALUE) { + display("!!!Expected: new code is actual " + + "before calling " + methodNameToCheck + + "!!!"); + } else { + complain("Unexpected: new code is not actual " + + "before calling " + methodNameToCheck); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodEntryRequest createMethodEntryRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodEntryRequest request = evm.createMethodEntryRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/TestDescription.java new file mode 100644 index 00000000000..34aebb7ca07 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/TestDescription.java @@ -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/BScenarios/hotswap/tc03x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC3 + * Description: After point of execution, different method + * Steps: 1.Set breakpoint at line 24 (call from a() + * to b()) + * 2.Debug Main + * 3.Insert as first line in b(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Resume + * X. Prints out "foo" before printing the + * numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 37th line (method "method_A"). + * After the breakpoint is reached, debugger redefines debugee adding + * first line into "method_B" and resumes debugee. It is expected the + * new code will be actual before calling "method_C" + * COMMENTS: + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc03x001 + * nsk.jdi.BScenarios.hotswap.tc03x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc03x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/newclass/tc03x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/newclass/tc03x001a.java new file mode 100644 index 00000000000..0fc784038fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/newclass/tc03x001a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc03x001a is deugee's part of the tc03x001. + */ +public class tc03x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 56; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc03x001a obj = new tc03x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber + method_B(); + } + + public void method_B() { + fieldToCheck = CHANGED_VALUE; + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001a.java new file mode 100644 index 00000000000..42665742895 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc03x001a is deugee's part of the tc03x001. + */ +public class tc03x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc03x001a obj = new tc03x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber + } + + public void method_B() { +// fieldToCheck = CHANGED_VALUE; + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001.java new file mode 100644 index 00000000000..1cc69d32311 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001.java @@ -0,0 +1,346 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC4 + * Description: Before point of execution, different method + * Steps: 1.Set breakpoint at line 30 (call to c() + * from b()) + * 2.Debug Main + * 3.Insert as first line in a(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * at line 30 + * 7.Resume + * X. Print numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 43th line (method method_B). + * After the breakpoint is reached, debugger: + * - redefines debugee adding a new line into method_A, + * - pops frames at beginning of method_A + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it doesn't hit breakpoint. + */ + +public class tc04x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc04x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 5; + private int eventCount = 0; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc04x001 thisTest = new tc04x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc04x001a.brkpMethodName, + tc04x001a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + switch (eventCount) { + case 1: + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + createMethodExitRequest(debugeeClass); + + break; + + default: + complain("Unexpected breakpoint hitting"); + exitStatus = Consts.TEST_FAILED; + } + eventCount++; + hitBreakpoint((BreakpointEvent )event); + debugee.resume(); + + } else if (event instanceof MethodExitEvent) { + display("\n event ===>>> " + event); + hitMethodExit((MethodExitEvent)event); + eventCount++; + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private void popFrames(ThreadReference thread) { + display("\npop frames..."); + try { + StackFrame frame = thread.frame(0); + Method mthd = frame.location().method(); + do { + thread.popFrames(frame); + display(mthd.name() + " is resetted"); + frame = thread.frame(0); + mthd = frame.location().method(); + } while (mthd.isObsolete()); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + display(""); + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc04x001a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc04x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitMethodExit(MethodExitEvent event) { + + locationInfo(event); + + Method mthd = ((MethodExitEvent )event).method(); + if (mthd.name().compareTo(tc04x001a.brkpMethodName) == 0) { + Field fld = debugeeClass.fieldByName(tc04x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc04x001a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual " + + "after resetting frames"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: new code is actual " + + "after resetting frames!!!"); + } + } + display(""); + } + + private void locationInfo(LocatableEvent event) { + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/TestDescription.java new file mode 100644 index 00000000000..706b5d761c5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/TestDescription.java @@ -0,0 +1,93 @@ +/* + * 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/BScenarios/hotswap/tc04x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC4 + * Description: Before point of execution, different method + * Steps: 1.Set breakpoint at line 30 (call to c() + * from b()) + * 2.Debug Main + * 3.Insert as first line in a(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * at line 30 + * 7.Resume + * X. Print numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 43th line (method "method_B"). + * After the breakpoint is reached, debugger: + * - redefines debugee adding a new line into "method_A", + * - pops frames at beginning of "method_A" + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it doesn't hit breakpoint (see COMMENTS). + * COMMENTS: + * In step 6 waiting breakpoint is wrong due to JVMDI Redefine + * Classes spec says:"...All breakpoints in the class are cleared." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc04x001 + * nsk.jdi.BScenarios.hotswap.tc04x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc04x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/newclass/tc04x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/newclass/tc04x001a.java new file mode 100644 index 00000000000..6f123c9e495 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/newclass/tc04x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc04x001a is deugee's part of the tc04x001. + */ +public class tc04x001a { + + public final static String brkpMethodName = "method_B"; + public final static int brkpLineNumber = 62; + public final static int checkLastLine = 62; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc04x001a obj = new tc04x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + fieldToCheck = CHANGED_VALUE; + method_B(); + } + + public void method_B() { // brkpLineNumber // checkLastLine + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001a.java new file mode 100644 index 00000000000..8e4d16dffa6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc04x001a is deugee's part of the tc04x001. + */ +public class tc04x001a { + + public final static String brkpMethodName = "method_B"; + public final static int brkpLineNumber = 63; + public final static int checkLastLine = 63; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc04x001a obj = new tc04x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { +// fieldToCheck = CHANGED_VALUE; + method_B(); + } + + public void method_B() { + method_C(); // checkLastLine // checkLastLine + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002.java new file mode 100644 index 00000000000..467af1742fe --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002.java @@ -0,0 +1,354 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC4 + * Description: Before point of execution, different method + * Steps: 1.Set breakpoint at line 30 (call to c() + * from b()) + * 2.Debug Main + * 3.Insert as first line in a(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * at line 30 + * 7.Resume + * X. Print numbers + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 43th line (method method_B). + * After the breakpoint is reached, debugger: + * - redefines debugee adding a new line into method_A, + * - pops frames at beginning of method_A + * - sets breakpoint at the 43th line again + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it hits breakpoint. + */ + +public class tc04x002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc04x002"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 6; + private int eventCount = 0; + + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc04x002 thisTest = new tc04x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc04x002a.brkpMethodName, + tc04x002a.brkpLineNumber); + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + switch (eventCount) { + case 1: + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + + debugee.setBreakpoint(debugeeClass, + tc04x002a.brkpMethodName, + tc04x002a.brkpLineNumber); + break; + + case 2: + display("!!!Expected second breakpoint event!!!"); + createMethodExitRequest(debugeeClass); + break; + + default: + complain("Unexpected breakpoint event"); + exitStatus = Consts.TEST_FAILED; + } + eventCount++; + hitBreakpoint((BreakpointEvent )event); + debugee.resume(); + + } else if (event instanceof MethodExitEvent) { + display("\n event ===>>> " + event); + hitMethodExit((MethodExitEvent)event); + eventCount++; + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private void popFrames(ThreadReference thread) { + display("\npop frames..."); + try { + StackFrame frame = thread.frame(0); + Method mthd = frame.location().method(); + do { + thread.popFrames(frame); + display(mthd.name() + " is resetted"); + frame = thread.frame(0); + mthd = frame.location().method(); + } while (mthd.isObsolete()); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + display(""); + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc04x002a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc04x002a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitMethodExit(MethodExitEvent event) { + + locationInfo(event); + + Method mthd = ((MethodExitEvent )event).method(); + if (mthd.name().compareTo(tc04x002a.brkpMethodName) == 0) { + Field fld = debugeeClass.fieldByName(tc04x002a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc04x002a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual " + + "after resetting frames"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: new code is actual " + + "after resetting frames!!!"); + } + } + display(""); + } + + private void locationInfo(LocatableEvent event) { + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/TestDescription.java new file mode 100644 index 00000000000..640730ed4cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/BScenarios/hotswap/tc04x002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC4 + * Description: Before point of execution, different method + * Steps: 1.Set breakpoint at line 30 (call to c() + * from b()) + * 2.Debug Main + * 3.Insert as first line in a(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.Resume + * X. Prints out "foo" and hits breakpoint + * at line 30 + * 7.Resume + * X. Print numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 43th line (method "method_B"). + * After the breakpoint is reached, debugger: + * - redefines debugee adding a new line into "method_A", + * - pops frames at beginning of "method_A" + * - sets breakpoint at the 43th line again + * and resumes debugee. + * It is expected the new code will be actual after the redefining and + * it hits breakpoint. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc04x002 + * nsk.jdi.BScenarios.hotswap.tc04x002a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc04x002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/newclass/tc04x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/newclass/tc04x002a.java new file mode 100644 index 00000000000..43d0bc0c1ca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/newclass/tc04x002a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc04x002a is deugee's part of the tc04x002. + */ +public class tc04x002a { + + public final static String brkpMethodName = "method_B"; + public final static int brkpLineNumber = 62; + public final static int checkLastLine = 62; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc04x002a obj = new tc04x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + fieldToCheck = CHANGED_VALUE; + method_B(); + } + + public void method_B() { // brkpLineNumber // checkLastLine + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002a.java new file mode 100644 index 00000000000..13632df3ef9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc04x002a is deugee's part of the tc04x002. + */ +public class tc04x002a { + + public final static String brkpMethodName = "method_B"; + public final static int brkpLineNumber = 63; + public final static int checkLastLine = 63; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc04x002a obj = new tc04x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { +// fieldToCheck = CHANGED_VALUE; + method_B(); + } + + public void method_B() { + method_C(); // brkpLineNumber // checkLastLine + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001.java new file mode 100644 index 00000000000..47a49b89bf4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001.java @@ -0,0 +1,277 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC5
    + * Description: After point of execution, same method - stepping
    + * Steps: 1.Set breakpoint at line 24 (call to b()
    + * from a())
    + * 2.Debug Main
    + * 3.Insert as next line after point of
    + * execution: System.err.println("foo");
    + * 4.Smart Swap
    + * 5.F7 to step into
    + * X. Steps into method b()
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, creates StepRequest and + * resumes debugee. When the location of the current StepEvent is + * in method_B, created StepRequest is disabled. + * Working of debugger and debugee is synchronized via IOPipe channel. + */ + +public class tc05x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc05x001"; + private final static String debugeeName = debuggerName + "a"; + + public final static String PERFORM_SGL = "perform"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + + private static final String firstMethodName = "method_B"; + + private int eventCount; + private int expectedEventCount = 2; + private ClassType debugeeClass; + StepRequest stepRequest = null; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc05x001 thisTest = new tc05x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + + display("Tested class\t:" + debugeeClass.name()); + + BreakpointRequest brkp = debugee.setBreakpoint(debugeeClass, + tc05x001a.brkpMethodName, + tc05x001a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal(PERFORM_SGL); + + BreakpointEvent brkpEvent = waitBreakpointEvent(brkp, waitTime); + + display("\nredefining..."); + redefineDebugee(); + + ThreadReference thread = brkpEvent.thread(); + + EventRequestManager evm = debugee.getEventRequestManager(); + + display("creating step request INTO..."); + stepRequest = evm.createStepRequest(thread, StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + stepRequest.addClassFilter(debugeeClass); + stepRequest.enable(); + debugee.resume(); + + boolean cmp = false; + StepEvent stepEvent; + Event event; + for (int i = 0; i < 3; i++) { + // waiting the breakpoint event + display("waiting step event..."); + try { + event = debugee.waitingEvent(stepRequest, waitTime); + } catch (Exception e) { + stepRequest.disable(); + throw new Failure(UNEXPECTED_STRING + e); + } + if (!(event instanceof StepEvent )) { + stepRequest.disable(); + throw new Failure("StepEvent didn't arrive"); + } + if (hitStep((StepEvent )event)) { + break; + } + debugee.resume(); + } + evm.deleteEventRequest(stepRequest); + debugee.resume(); + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(testDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new Failure("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } + + private boolean hitStep(StepEvent event) { + locationInfo(event); + String methodName = event.location().method().name(); + boolean ret = methodName.compareTo(firstMethodName) != 0; + if (ret) { + if (!event.location().method().isObsolete()) { + complain("Unexpected event" + event); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected event location at \"" + methodName + "\""); + } + } else { + display("!!!Expected event location at \"" + methodName + "\""); + stepRequest.disable(); + } + display(""); + return !ret; + } + + private void locationInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } catch (AbsentInformationException e) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001/TestDescription.java new file mode 100644 index 00000000000..c253b81c916 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/BScenarios/hotswap/tc05x001. + * VM Testbase keywords: [jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC5 + * Description: After point of execution, same method - stepping + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as next line after point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.F7 to step into + * X. Steps into method b() + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, creates StepRequest and resumes debugee. + * When the location of the current StepEvent is in method_B, created + * StepRequest is disabled. + * Working of debugger and debugee is synchronized via IOPipe channel. + * COMMENTS: + * The scenario mentions debugee crashes on 1.4.0-b91. + * The test differs from tc05x002 by that it works via IOPipe + * channel and the crash is reproduced. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc05x001 + * nsk.jdi.BScenarios.hotswap.tc05x001a + * + * @comment make sure tc05x001a is compiled with full debug info + * @clean nsk.jdi.BScenarios.hotswap.tc05x001a + * @compile -g:lines,source,vars ../tc05x001a.java + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc05x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001/newclass/tc05x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001/newclass/tc05x001a.java new file mode 100644 index 00000000000..7219ade28d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001/newclass/tc05x001a.java @@ -0,0 +1,85 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc05x001a is deugee's part of the tc05x001. + */ +public class tc05x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 69; + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + runIt(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void runIt() { + tc05x001a obj = new tc05x001a(); + obj.method_A(); + } + + public void method_A() { // brkpLineNumber + method_B(); + log.display("new line"); +// ^^^^^^^^^^^^^^^^^^^^^^^^ inserted line + } + + public void method_B() { + method_C(); + } + + public void method_C() { + log.display("method_C:: line 1"); + log.display("method_C:: line 2"); + log.display("method_C:: line 3"); + log.display("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001a.java new file mode 100644 index 00000000000..ca4638fff32 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x001a.java @@ -0,0 +1,86 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc05x001a is deugee's part of the tc05x001. + */ +public class tc05x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 71; + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + runIt(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void runIt() { + tc05x001a obj = new tc05x001a(); + obj.method_A(); + } + + public void method_A() { + method_B(); // brkpLineNumber +// log.display("new line"); +// try inserting code here + } + + public void method_B() { + method_C(); + } + + public void method_C() { + log.display("method_C:: line 1"); + log.display("method_C:: line 2"); + log.display("method_C:: line 3"); + log.display("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002.java new file mode 100644 index 00000000000..8523866c886 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002.java @@ -0,0 +1,317 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC5
    + * Description: After point of execution, same method - stepping
    + * Steps: 1.Set breakpoint at line 24 (call to b()
    + * from a())
    + * 2.Debug Main
    + * 3.Insert as next line after point of
    + * execution: System.err.println("foo");
    + * 4.Smart Swap
    + * 5.F7 to step into
    + * X. Steps into method b()
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, creates StepRequest and + * resumes debugee. When the location of the current StepEvent is + * in method_B, created StepRequest is disabled. + */ + +public class tc05x002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc05x002"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private static final String firstMethodName = "method_B"; + + private int eventCount; + private int expectedEventCount = 2; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc05x002 thisTest = new tc05x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc05x002a.brkpMethodName, + tc05x002a.brkpLineNumber); + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + display("redefining..."); + redefineDebugee(); + createStepRequest(((LocatableEvent )event).thread()); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display("\n event ===>>> " + event); + hitStep((StepEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private StepRequest createStepRequest(ThreadReference thread) { + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest request = evm.createStepRequest(thread, + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc05x002a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc05x002a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitStep(StepEvent event) { + locationInfo(event); + String methodName = event.location().method().name(); + StepRequest request = (StepRequest )event.request(); + if (methodName.compareTo(firstMethodName) != 0) { + if (!event.location().method().isObsolete()) { + complain("Unexpected event" + event); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected step event!!!"); + } + } else { + display("!!!Expected step event!!!"); + request.disable(); + } + display(""); + } + + private void locationInfo(LocatableEvent event) { + if (!event.location().method().isObsolete()) { + eventCount++; + } + String methodName = "<>"; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + try { + methodName = event.location().method().name(); + display("\tsource\t- " + event.location().sourceName()); + display("\tmethod\t- " + methodName); + display("\tline\t- " + event.location().lineNumber()); + } catch (AbsentInformationException e) { + } + if (event.location().method().isObsolete()) { + display(methodName + " method is skipped"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/TestDescription.java new file mode 100644 index 00000000000..e894c9f7aa7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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/BScenarios/hotswap/tc05x002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC5 + * Description: After point of execution, same method - stepping + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as next line after point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.F7 to step into + * X. Steps into method b() + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, creates StepRequest and resumes debugee. + * When the location of the current StepEvent is in method_B, created + * StepRequest is disabled. + * COMMENTS: + * The scenario mentions debugee crashes on 1.4.0-b91. + * The test differs from tc05x001 by that it works without IOPipe + * channel and instead of the crash unexpected IllegalArgumentException + * is thrown. + * After redefining location of the first step event is expected at the + * redefined method according to #4756474. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc05x002 + * nsk.jdi.BScenarios.hotswap.tc05x002a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc05x002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/newclass/tc05x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/newclass/tc05x002a.java new file mode 100644 index 00000000000..f4481405830 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/newclass/tc05x002a.java @@ -0,0 +1,73 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc05x002a is deugee's part of the tc05x002. + */ +public class tc05x002a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static int checkLastLine = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc05x002a obj = new tc05x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber // checkLastLine + method_B(); + fieldToCheck = CHANGED_VALUE; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inserted line + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002a.java new file mode 100644 index 00000000000..bb6c13feab7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc05x002a is deugee's part of the tc05x002. + */ +public class tc05x002a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 58; + public final static int checkLastLine = 58; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc05x002a obj = new tc05x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber // checkLastLine +// fieldToCheck = CHANGED_VALUE; + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001.java new file mode 100644 index 00000000000..8bb869b9ed7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001.java @@ -0,0 +1,361 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC6
    + * Description: Before point of execution, same method - stepping
    + * Steps: 1.Set breakpoint at line 24 (call to b()
    + * from a())
    + * 2.Debug Main
    + * 3.Insert as line before point of
    + * execution: System.err.println("foo");
    + * 4.Smart Swap
    + * 5.Set Smart PopFrame to beginging of
    + * method a()
    + * 6.F7 to step into
    + * X. Stops on println
    + * 7.F7
    + * X. Prints "foo" and stops on call to b()
    + * 8.F7
    + * X. Steps into b()
    + * 9.Resume
    + * X. Prints numbers
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 39th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, pops frames,creates StepRequest + * and resumes debugee. + * When the location of the current StepEvent is in method_B, + * created StepRequest is disabled. The test checks up location of every + * step event and that new code becomes actual. + */ + +public class tc06x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc06x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private static final String firstMethodName = "method_A"; + private static final String lastMethodName = "method_B"; + + private int eventCount; + private int expectedEventCount = 4; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc06x001 thisTest = new tc06x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc06x001a.brkpMethodName, + tc06x001a.brkpLineNumber); + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + createStepRequest(((LocatableEvent )event).thread()); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display("\n event ===>>> " + event); + hitStep((StepEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private void popFrames(ThreadReference thread) { + display("\npop frames..."); + try { + StackFrame frame = thread.frame(0); + Method mthd = frame.location().method(); + do { + thread.popFrames(frame); + display(mthd.name() + " is resetted"); + frame = thread.frame(0); + mthd = frame.location().method(); + } while (mthd.isObsolete()); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + display(""); + } + + private StepRequest createStepRequest(ThreadReference thread) { + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest request = evm.createStepRequest(thread, + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc06x001a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc06x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitStep(StepEvent event) { + locationInfo(event); + String methodName = event.location().method().name(); + StepRequest request = (StepRequest )event.request(); + + switch (eventCount) { + case 2: + checkLocMethod(methodName, firstMethodName); + break; + case 3: + Field fld = debugeeClass.fieldByName(tc06x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc06x001a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: Inserted line has worked"); + } + break; + case 4: + checkLocMethod(methodName, lastMethodName); + request.disable(); + break; + default: + complain("Unexpected event" + event); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void checkLocMethod(String currentMethodName, String expectedMethodName) { + if (currentMethodName.compareTo(expectedMethodName) != 0) { + complain("Unexpected event location at \"" + currentMethodName + "\""); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected event location at \"" + currentMethodName + "\""); + } + } + + private void locationInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } catch (AbsentInformationException e) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/TestDescription.java new file mode 100644 index 00000000000..4c5dd5a114a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/BScenarios/hotswap/tc06x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC6 + * Description: Before point of execution, same method - stepping + * Steps: 1.Set breakpoint at line 24 (call to b() + * from a()) + * 2.Debug Main + * 3.Insert as line before point of + * execution: System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.F7 to step into + * X. Stops on println + * 7.F7 + * X. Prints "foo" and stops on call to b() + * 8.F7 + * X. Steps into b() + * 9.Resume + * X. Prints numbers + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 39th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, pops frames, creates StepRequest and + * resumes debugee. + * When the location of the current StepEvent is in method_B, created + * StepRequest is disabled. + * The test checks up location of every step event and that new code + * becomes actual. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc06x001 + * nsk.jdi.BScenarios.hotswap.tc06x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc06x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/newclass/tc06x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/newclass/tc06x001a.java new file mode 100644 index 00000000000..95303de89b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/newclass/tc06x001a.java @@ -0,0 +1,73 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc06x001a is deugee's part of the tc06x001. + */ +public class tc06x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 58; + public final static int checkLastLine = 58; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc06x001a obj = new tc06x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + fieldToCheck = CHANGED_VALUE; // brkpLineNumber // checkLastLine +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inserted line + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001a.java new file mode 100644 index 00000000000..0b73833bd4d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc06x001a is deugee's part of the tc06x001. + */ +public class tc06x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 59; + public final static int checkLastLine = 59; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc06x001a obj = new tc06x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { +// fieldToCheck = CHANGED_VALUE; + method_B(); // brkpLineNumber // checkLastLine + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001.java new file mode 100644 index 00000000000..d8bfa5ab6b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001.java @@ -0,0 +1,342 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC7
    + * Description: After point of execution, different method - stepping
    + * Steps: 1.Set breakpoint at line 24 (call from a()
    + * to b())
    + * 2.Debug Main
    + * 3.Insert as first line in b():
    + * System.err.println("foo");
    + * 4.Smart Swap
    + * 5.F7 to step into
    + * X. Steps into b()
    + * 6.F7 to step into
    + * X. Prints "foo"
    + * 7.F7 to step into
    + * X. Steps on to line that prints "1"
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at the 38th + * line (method method_A). After the breakpoint is reached, + * debugger redefines debugee inserting first line into method_B, creates + * StepRequest and resumes debugee. When the location of the + * current StepEvent is in method_C, created + * StepRequest is disabled. + * The test checks up location of every step event and that new code + * becomes actual. + */ + +public class tc07x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc07x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private static final String firstMethodName = "method_B"; + private static final String lastMethodName = "method_C"; + + private int eventCount; + private int expectedEventCount = 4; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc07x001 thisTest = new tc07x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc07x001a.brkpMethodName, + tc07x001a.brkpLineNumber); + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + display("redefining..."); + redefineDebugee(); + createStepRequest(((LocatableEvent )event).thread()); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display("\n event ===>>> " + event); + hitStep((StepEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private StepRequest createStepRequest(ThreadReference thread) { + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest request = evm.createStepRequest(thread, + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc07x001a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc07x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitStep(StepEvent event) { + locationInfo(event); + String methodName = event.location().method().name(); + StepRequest request = (StepRequest )event.request(); + if (methodName.compareTo(lastMethodName) == 0) { + request.disable(); + } + switch (eventCount) { + case 2: + checkLocMethod(methodName, firstMethodName); + break; + case 3: + checkLocMethod(methodName, firstMethodName); + Field fld = debugeeClass.fieldByName(tc07x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc07x001a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: Inserted line has worked"); + } + break; + case 4: + checkLocMethod(methodName, lastMethodName); + break; + default: + complain("Unexpected event" + event); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void checkLocMethod(String currentMethodName, String expectedMethodName) { + if (currentMethodName.compareTo(expectedMethodName) != 0) { + complain("Unexpected event location at \"" + currentMethodName + "\""); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected event location at \"" + currentMethodName + "\""); + } + } + + private void locationInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } catch (AbsentInformationException e) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/TestDescription.java new file mode 100644 index 00000000000..39dd08175c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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/BScenarios/hotswap/tc07x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC7 + * Description: After point of execution, different method - stepping + * Steps: 1.Set breakpoint at line 24 (call from a() + * to b()) + * 2.Debug Main + * 3.Insert as first line in b(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.F7 to step into + * X. Steps into b() + * 6.F7 to step into + * X. Prints "foo" + * 7.F7 to step into + * X. Steps on to line that prints "1" + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee inserting + * first line into method_B, creates StepRequest and resumes debugee. + * When the location of the current StepEvent is in method_C, created + * StepRequest is disabled. + * The test checks up location of every step event and that new code + * becomes actual. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc07x001 + * nsk.jdi.BScenarios.hotswap.tc07x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc07x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/newclass/tc07x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/newclass/tc07x001a.java new file mode 100644 index 00000000000..0db7cda6633 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/newclass/tc07x001a.java @@ -0,0 +1,73 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc07x001a is deugee's part of the tc07x001. + */ +public class tc07x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 57; + public final static int checkLastLine = 57; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc07x001a obj = new tc07x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { // brkpLineNumber // checkLastLine + method_B(); + } + + public void method_B() { + fieldToCheck = CHANGED_VALUE; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inserted line + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001a.java new file mode 100644 index 00000000000..9a5f1ca78be --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc07x001a is deugee's part of the tc07x001. + */ +public class tc07x001a { + + public final static String brkpMethodName = "method_A"; + public final static int brkpLineNumber = 58; + public final static int checkLastLine = 58; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc07x001a obj = new tc07x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); // brkpLineNumber // checkLastLine + } + + public void method_B() { +// fieldToCheck = CHANGED_VALUE; + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001.java new file mode 100644 index 00000000000..9cbd96a4de2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001.java @@ -0,0 +1,353 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC8
    + * Description: Before point of execution, different method - stepping
    + * Steps: 1.Set breakpoint at line 30 (call to c()
    + * from b())
    + * 2.Debug Main
    + * 3.Insert as first line in a():
    + * System.err.println("foo");
    + * 4.Smart Swap
    + * 5.Set Smart PopFrame to beginging of
    + * method a()
    + * 6.F7 to step into
    + * X. Steps into a()
    + * 7.F7 to step into
    + * X. Prints "foo"
    + *
    + * The description was drown up according to steps under JBuilder.
    + *
    + * Of course, the test has own line numbers and method/class names and
    + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, pops frame, creates StepRequest + * and resumes debugee. When the second StepEvent is reached, created + * StepRequest is disabled. + */ + +public class tc08x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc08x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private static final String firstMethodName = "method_A"; + + private int eventCount; + private int expectedEventCount = 3; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc08x001 thisTest = new tc08x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + debugee.setBreakpoint(debugeeClass, + tc08x001a.brkpMethodName, + tc08x001a.brkpLineNumber); + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + display("redefining..."); + redefineDebugee(); + popFrames(((BreakpointEvent )event).thread()); + createStepRequest(((LocatableEvent )event).thread()); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display("\n event ===>>> " + event); + hitStep((StepEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private void popFrames(ThreadReference thread) { + display("\npop frames..."); + try { + StackFrame frame = thread.frame(0); + Method mthd = frame.location().method(); + do { + thread.popFrames(frame); + display(mthd.name() + " is resetted"); + frame = thread.frame(0); + mthd = frame.location().method(); + } while (mthd.isObsolete()); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + display(""); + } + + private StepRequest createStepRequest(ThreadReference thread) { + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest request = evm.createStepRequest(thread, + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + request.enable(); + return request; + } + + private void hitBreakpoint(BreakpointEvent event) { + locationInfo(event); + if (event.location().lineNumber() != tc08x001a.checkLastLine) { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc08x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } + display(""); + } + + private void hitStep(StepEvent event) { + locationInfo(event); + String methodName = event.location().method().name(); + StepRequest request = (StepRequest )event.request(); + + switch (eventCount) { + case 2: + checkLocMethod(methodName, firstMethodName); + break; + case 3: + checkLocMethod(methodName, firstMethodName); + Field fld = debugeeClass.fieldByName(tc08x001a.fieldToCheckName); + Value val = debugeeClass.getValue(fld); + if (((IntegerValue )val).value() != tc08x001a.CHANGED_VALUE) { + complain("Unexpected: new code is not actual"); + complain("Unexpected value of checked field: " + + val); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected: Inserted line has worked"); + } + request.disable(); + break; + default: + complain("Unexpected event" + event); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void checkLocMethod(String currentMethodName, String expectedMethodName) { + if (currentMethodName.compareTo(expectedMethodName) != 0) { + complain("Unexpected event location at \"" + currentMethodName + "\""); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected event location at \"" + currentMethodName + "\""); + } + } + + private void locationInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + } catch (AbsentInformationException e) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/TestDescription.java new file mode 100644 index 00000000000..2b4c06804f8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/BScenarios/hotswap/tc08x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC8 + * Description: Before point of execution, different method - stepping + * Steps: 1.Set breakpoint at line 30 (call to c() + * from b()) + * 2.Debug Main + * 3.Insert as first line in a(): + * System.err.println("foo"); + * 4.Smart Swap + * 5.Set Smart PopFrame to beginging of + * method a() + * 6.F7 to step into + * X. Steps into a() + * 7.F7 to step into + * X. Prints "foo" + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 38th line (method method_A). + * After the breakpoint is reached, debugger redefines debugee adding + * a new line into method_A, pops frame, creates StepRequest and + * resumes debugee. When the second StepEvent is reached, created + * StepRequest is disabled. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc08x001 + * nsk.jdi.BScenarios.hotswap.tc08x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc08x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/newclass/tc08x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/newclass/tc08x001a.java new file mode 100644 index 00000000000..abe27f4f7d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/newclass/tc08x001a.java @@ -0,0 +1,73 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc08x001a is deugee's part of the tc08x001. + */ +public class tc08x001a { + + public final static String brkpMethodName = "method_B"; + public final static int brkpLineNumber = 62; + public final static int checkLastLine = 62; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc08x001a obj = new tc08x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + fieldToCheck = CHANGED_VALUE; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inserted line + method_B(); + } + // brkpLineNumber // checkLastLine + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001a.java new file mode 100644 index 00000000000..285f0812a84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc08x001a is deugee's part of the tc08x001. + */ +public class tc08x001a { + + public final static String brkpMethodName = "method_B"; + public final static int brkpLineNumber = 63; + public final static int checkLastLine = 63; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc08x001a obj = new tc08x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { +// fieldToCheck = CHANGED_VALUE; + method_B(); + } + + public void method_B() { + method_C(); // brkpLineNumber // checkLastLine + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001.java new file mode 100644 index 00000000000..283d50bcce4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001.java @@ -0,0 +1,302 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC9
    + * Description: Breakpoints updated correctly
    + * Steps: 1.Set breakpoint at lines 36 and 39
    + * (printing 1 and 4)
    + * 2.Debug Main
    + * X. Stops on line 36
    + * 3.Delete line 37
    + * 4.Smart Swap
    + * X. Breakpoints still set and valid at 36
    + * and 38
    + * 5.Resume
    + * X. Stops on line 38
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoints at + * the 47th and 49th line (method method_C). + * After the first breakpoint is reached, debugger redefines debugee + * deleting 48th line and resumes debugee. No breakpoints are + * expected anymore. + */ + +public class tc09x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc09x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int eventCount; + private int expectedEventCount = 1; + private ReferenceType debugeeClass; + private BreakpointRequest brkpRequest1 = null, + brkpRequest2 = null; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc09x001 thisTest = new tc09x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + + brkpRequest1 = debugee.setBreakpoint(debugeeClass, + tc09x001a.brkpMethodName, + tc09x001a.brkpLineNumber1); + + brkpRequest2 = debugee.setBreakpoint(debugeeClass, + tc09x001a.brkpMethodName, + tc09x001a.brkpLineNumber2); + + breakpointInfo(brkpRequest1); + breakpointInfo(brkpRequest2); + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + if (eventCount == 1) { + display("redefining..."); + redefineDebugee(); + breakpointInfo(brkpRequest1); + breakpointInfo(brkpRequest2); + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private void hitBreakpoint(BreakpointEvent event) { + eventInfo(event); + if (event.location().lineNumber() == tc09x001a.checkLastLine && + eventCount == 1) { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } else { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc09x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void eventInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + locationInfo(event); + } + + private void breakpointInfo(BreakpointRequest request) { + display("breakpoint info: "); + display("\tis enabled - " + request.isEnabled()); + locationInfo(request); + } + + private void locationInfo(Locatable loc) { + try { + display("\tsource\t- " + loc.location().sourceName()); + display("\tmethod\t- " + loc.location().method().name()); + display("\tline\t- " + loc.location().lineNumber()); + } catch (AbsentInformationException e) { + display("***information is not available***"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/TestDescription.java new file mode 100644 index 00000000000..98b85f82b92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/BScenarios/hotswap/tc09x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC9 + * Description: Breakpoints updated correctly + * Steps: 1.Set breakpoint at lines 36 and 39 + * (printing 1 and 4) + * 2.Debug Main + * X. Stops on line 36 + * 3.Delete line 37 + * 4.Smart Swap + * X. Breakpoints still set and valid at 36 + * and 38 + * 5.Resume + * X. Stops on line 38 + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoints at + * the 47th and 49th line (method method_C). + * After the first breakpoint is reached, debugger redefines debugee + * deleting 48th line and resumes debugee. No breakpoints are + * expected anymore. + * COMMENTS: + * Last step from scenarion description (stopping on line 38) is wrong + * of because JVMDI spec (Redefine Classes ) says:"...All breakpoints + * in the class are cleared." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc09x001 + * nsk.jdi.BScenarios.hotswap.tc09x001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc09x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/newclass/tc09x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/newclass/tc09x001a.java new file mode 100644 index 00000000000..84094a7d107 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/newclass/tc09x001a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc09x001a is deugee's part of the tc09x001. + */ +public class tc09x001a { + + public final static String brkpMethodName = "method_C"; + public final static int brkpLineNumber1 = 66; + public final static int brkpLineNumber2 = 69; + public final static int checkLastLine = 66; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc09x001a obj = new tc09x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { // brkpLineNumber1 // checkLastLine + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); // brkpLineNumber2 + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001a.java new file mode 100644 index 00000000000..9611a07a0cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc09x001a is deugee's part of the tc09x001. + */ +public class tc09x001a { + + public final static String brkpMethodName = "method_C"; + public final static int brkpLineNumber1 = 67; + public final static int brkpLineNumber2 = 70; + public final static int checkLastLine = 67; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc09x001a obj = new tc09x001a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); // brkpLineNumber1 // checkLastLine + System.err.println("method_C:: line 2"); // this line will be removed + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); // brkpLineNumber2 + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002.java new file mode 100644 index 00000000000..5c6308c4a69 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002.java @@ -0,0 +1,326 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC9
    + * Description: Breakpoints updated correctly
    + * Steps: 1.Set breakpoint at lines 36 and 39
    + * (printing 1 and 4)
    + * 2.Debug Main
    + * X. Stops on line 36
    + * 3.Delete line 37
    + * 4.Smart Swap
    + * X. Breakpoints still set and valid at 36
    + * and 38
    + * 5.Resume
    + * X. Stops on line 38
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoints at + * the 47th and 49th line (method method_C). + * After the first breakpoint is reached, debugger redefines debugee + * deleting 48th line and attempts to set another breakpoint at 49th line. + * Because line number info is not available after redefining, it is + * expected IndexOutOfBoundsException will be thrown. + */ + +public class tc09x002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc09x002"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int eventCount; + private int expectedEventCount = 1; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc09x002 thisTest = new tc09x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + BreakpointRequest brkpRequest1, brkpRequest2; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + + brkpRequest1 = debugee.setBreakpoint(debugeeClass, + tc09x002a.brkpMethodName, + tc09x002a.brkpLineNumber1); + + brkpRequest2 = debugee.setBreakpoint(debugeeClass, + tc09x002a.brkpMethodName, + tc09x002a.brkpLineNumber2); + + breakpointInfo(brkpRequest1); + breakpointInfo(brkpRequest2); + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + + if (eventCount == 1) { + display("redefining..."); + redefineDebugee(); + Method method = null; + try { + method = ((BreakpointEvent )event).thread().frame(0).location().method(); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + display("\nsetting breakpoint at the redefined method..."); + try { + Location location = debugee.getLineLocation(method, tc09x002a.brkpLineNumber2); + if (location != null) { + brkpRequest2 = evm.createBreakpointRequest(location); + if (method.isObsolete()) { + complain("Locations of the redefined method " + + "should be not available: " + location); + complain("BreakpointRequest for not available location " + + "should be created: " + brkpRequest2); + exitStatus = Consts.TEST_FAILED; + } else { + display("No location found for unavailable line after class redefinition"); + } + } + } catch (Exception e) { + display("Unspecified exception caught while setting breakpoint " + + "to unavailable line after class redefinition:\n\t" + e); + exitStatus = Consts.TEST_FAILED; + } + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private void hitBreakpoint(BreakpointEvent event) { + eventInfo(event); + if (event.location().lineNumber() == tc09x002a.checkLastLine && + eventCount == 1) { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } else { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc09x002a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void eventInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + locationInfo(event); + } + + private void breakpointInfo(BreakpointRequest request) { + display("breakpoint info: "); + display("\tis enabled - " + request.isEnabled()); + locationInfo(request); + } + + private void locationInfo(Locatable loc) { + try { + display("\tsource\t- " + loc.location().sourceName()); + display("\tmethod\t- " + loc.location().method().name()); + display("\tline\t- " + loc.location().lineNumber()); + } catch (AbsentInformationException e) { + display("***information is not available***"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/TestDescription.java new file mode 100644 index 00000000000..b4e5cd8e7ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/BScenarios/hotswap/tc09x002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC9 + * Description: Breakpoints updated correctly + * Steps: 1.Set breakpoint at lines 36 and 39 + * (printing 1 and 4) + * 2.Debug Main + * X. Stops on line 36 + * 3.Delete line 37 + * 4.Smart Swap + * X. Breakpoints still set and valid at 36 + * and 38 + * 5.Resume + * X. Stops on line 38 + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoints at + * the 47th and 49th line (method method_C). + * After the first breakpoint is reached, debugger redefines debugee + * deleting 48th line and attempts to set another breakpoint at 49th line. + * Because line number info is not available after redefining, it is + * expected IndexOutOfBoundsException will be thrown. + * COMMENTS: + * Last step from scenarion description (stopping on line 38) is wrong + * of because JVMDI spec (Redefine Classes ) says:"...All breakpoints + * in the class are cleared." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc09x002 + * nsk.jdi.BScenarios.hotswap.tc09x002a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc09x002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/newclass/tc09x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/newclass/tc09x002a.java new file mode 100644 index 00000000000..ee1c6576a02 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/newclass/tc09x002a.java @@ -0,0 +1,71 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc09x002a is deugee's part of the tc09x002. + */ +public class tc09x002a { + + public final static String brkpMethodName = "method_C"; + public final static int brkpLineNumber1 = 66; + public final static int brkpLineNumber2 = 69; + public final static int checkLastLine = 66; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc09x002a obj = new tc09x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { // brkpLineNumber1 // checkLastLine + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); // brkpLineNumber2 + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002a.java new file mode 100644 index 00000000000..3da0e071f83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002a.java @@ -0,0 +1,72 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc09x002a is deugee's part of the tc09x002. + */ +public class tc09x002a { + + public final static String brkpMethodName = "method_C"; + public final static int brkpLineNumber1 = 67; + public final static int brkpLineNumber2 = 70; + public final static int checkLastLine = 67; + public final static String fieldToCheckName = "fieldToCheck"; + public final static int INITIAL_VALUE = 0; + public final static int CHANGED_VALUE = 1; + + private static Log log; + private static int fieldToCheck = INITIAL_VALUE; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc09x002a obj = new tc09x002a(); + obj.method_A(); + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); // brkpLineNumber1 // checkLastLine + System.err.println("method_C:: line 2"); // this line will be removed + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); // brkpLineNumber2 + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001.java new file mode 100644 index 00000000000..43f4b07719d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001.java @@ -0,0 +1,305 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC10
    + * Description: Changing data type
    + * Steps: 1.Set breakpoint on line 20
    + * 2.Debug Main
    + * X. Stops on line 20
    + * 3.Change line 16 to boolean i = true;
    + * 4.Smart Swap
    + * 5.Resume
    + * X. Prints "true" as last line of output
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 35th line (method main). + * After the breakpoint is reached, debugger redefines debugee changing + * type of local variable and resumes debugee. + * After resuming debugee sends value of the variable via IOPipe channel, + * debugger reads this value and compares it with expected the one. + * In this case expected value is the value before redefinition. + */ + +public class tc10x001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc10x001"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int eventCount; + private int expectedEventCount = 1; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc10x001 thisTest = new tc10x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + BreakpointRequest brkpRequest; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + + brkpRequest = debugee.setBreakpoint(debugeeClass, + tc10x001a.brkpMethodName, + tc10x001a.brkpLineNumber); + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + + display("redefining..."); + redefineDebugee(); + + Receiver recv = new Receiver(); + recv.start(); + + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private void hitBreakpoint(BreakpointEvent event) { + eventInfo(event); + if (event.location().lineNumber() == tc10x001a.checkLastLine && + eventCount == 1) { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } else { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc10x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void eventInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + locationInfo(event); + } + + private void locationInfo(Locatable loc) { + try { + display("\tsource\t- " + loc.location().sourceName()); + display("\tmethod\t- " + loc.location().method().name()); + display("\tline\t- " + loc.location().lineNumber()); + } catch (AbsentInformationException e) { + display("***information is not available***"); + } + } + + class Receiver extends Thread { + public void run() { + try { + String tmp = debugee.receiveSignal(); + display("received value:\t" + tmp); + int actualValue = Integer.parseInt(tmp.substring(1)); + if (actualValue != tc10x001a.INITIAL_INT_VALUE) { + complain("Unexpected value of local variable - " + actualValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("!!!Expected value of local variable - " + actualValue); + } + } catch (Throwable e) { + complain(UNEXPECTED_STRING + e); + exitStatus = Consts.TEST_FAILED; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java new file mode 100644 index 00000000000..dfe0d342586 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java @@ -0,0 +1,93 @@ +/* + * 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/BScenarios/hotswap/tc10x001. + * VM Testbase keywords: [quick, jpda, jdi, redefine, quarantine] + * VM Testbase comments: JDK-8013728 + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC10 + * Description: Changing data type + * Steps: 1.Set breakpoint on line 20 + * 2.Debug Main + * X. Stops on line 20 + * 3.Change line 16 to boolean i = true; + * 4.Smart Swap + * 5.Resume + * X. Prints "true" as last line of output + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 35th line (method main). + * After the breakpoint is reached, debugger redefines debugee changing + * type of local variable and resumes debugee. + * After resuming debugee sends value of the variable via IOPipe channel, + * debugger reads this value and compares it with expected the one. + * In this case expected value is the value before redefinition. + * COMMENTS: + * Step 5 of Borland's scenario is wrong due to redefineClasses spec says: + * "The redefined method will be used on new invokes. If resetting these + * frames is desired, use ThreadReference.popFrames() with + * Method.isObsolete()." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc10x001 + * nsk.jdi.BScenarios.hotswap.tc10x001a + * + * @comment make sure tc10x001a is compiled with full debug info + * @clean nsk.jdi.BScenarios.hotswap.tc10x001a + * @compile -g:lines,source,vars ../tc10x001a.java + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc10x001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/newclass/tc10x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/newclass/tc10x001a.java new file mode 100644 index 00000000000..ad2dabd468a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/newclass/tc10x001a.java @@ -0,0 +1,73 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc10x001a is deugee's part of the tc10x001. + */ +public class tc10x001a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 54; + public final static int checkLastLine = 54; + public final static int INITIAL_INT_VALUE = 42; + public final static boolean INITIAL_BOOL_VALUE = true; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + boolean i = INITIAL_BOOL_VALUE; +// ^^^^^^^ has been changed + tc10x001a obj = new tc10x001a(); + obj.method_A(); + // brkpLineNumber // checkLastLine + System.err.println("i = " + i); + pipe.println("@" + i); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001a.java new file mode 100644 index 00000000000..e5fe3e4e571 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001a.java @@ -0,0 +1,74 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc10x001a is deugee's part of the tc10x001. + */ +public class tc10x001a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 55; + public final static int checkLastLine = 55; + public final static int INITIAL_INT_VALUE = 42; + public final static boolean INITIAL_BOOL_VALUE = true; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + int i = INITIAL_INT_VALUE; +// ^^^ will be changed + tc10x001a obj = new tc10x001a(); + obj.method_A(); + + System.err.println("i = " + i); // brkpLineNumber // checkLastLine + pipe.println("@" + i); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002.java new file mode 100644 index 00000000000..252d8404fe1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002.java @@ -0,0 +1,347 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 3 - Hot Swap
    + * Test case: TC10
    + * Description: Changing data type
    + * Steps: 1.Set breakpoint on line 20
    + * 2.Debug Main
    + * X. Stops on line 20
    + * 3.Change line 16 to boolean i = true;
    + * 4.Smart Swap
    + * 5.Resume
    + * X. Prints "true" as last line of output
    + *
    + * The description was drown up according to steps under JBuilder. + * + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 40th line (method runIt). + * Note: the runIt method was added into the test, to allow invoking + * ThreadReference.popFrame(). Current frame can not be reset because of + * there is no previous frame. + * After the breakpoint is reached, debugger redefines debugee changing type of + * local variable, pops current frame, sets a new breakpoint at 37th line and + * resumes debugee. + * When the second breakpoint hits, debugger requests value of the local + * variable i and compares got value with expected value. + * In this case expected value is the new value after redefinition. + */ + +public class tc10x002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.BScenarios.hotswap."; + private final static String debuggerName = prefix + "tc10x002"; + private final static String debugeeName = debuggerName + "a"; + + private final static String newClassFile = "newclass" + File.separator + + debugeeName.replace('.',File.separatorChar) + + ".class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int eventCount; + private int expectedEventCount = 2; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc10x002 thisTest = new tc10x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + BreakpointRequest brkpRequest; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\n event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\n event ===>>> " + event); + debugeeClass = ((ClassPrepareEvent )event).referenceType(); + display("Tested class\t:" + debugeeClass.name()); + + brkpRequest = debugee.setBreakpoint(debugeeClass, + tc10x002a.brkpMethodName, + tc10x002a.brkpLineNumber1); + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\n event ===>>> " + event); + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + switch (eventCount) { + case 0: + hitBreakpoint(brkpEvent, tc10x002a.checkLastLine1); + display("redefining..."); + redefineDebugee(); + + popFrames(brkpEvent.thread()); + + brkpRequest = debugee.setBreakpoint(debugeeClass, + tc10x002a.brkpMethodName, + tc10x002a.brkpLineNumber2); + break; + case 1: + Value val = null; + hitBreakpoint(brkpEvent, tc10x002a.checkLastLine2); + try { + StackFrame frame = brkpEvent.thread().frame(0); + LocalVariable var = frame.visibleVariableByName("i"); + display("local variable:\t" + var); + val = frame.getValue(var); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + display("\nValue of local variable:\t" + val); + if (((PrimitiveValue)val).booleanValue() == + tc10x002a.INITIAL_BOOL_VALUE) { + display("!!!Expected value of local variable!!!\n"); + } else { + complain("Unexpected value of local variable.\n"); + exitStatus = Consts.TEST_FAILED; + } + break; + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount != expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private void popFrames(ThreadReference thread) { + display("\npop frames..."); + try { + StackFrame frame = thread.frame(0); + Method mthd = frame.location().method(); + do { + thread.popFrames(frame); + display(mthd.name() + " is resetted"); + frame = thread.frame(0); + mthd = frame.location().method(); + } while (mthd.isObsolete()); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + display(""); + } + + private void hitBreakpoint(BreakpointEvent event, int expLine) { + eventInfo(event); + if (event.location().lineNumber() == expLine) { + display("!!!BreakpointEvent steps to the expected line " + + event.location().lineNumber() + "!!!"); + } else { + complain("BreakpointEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + expLine); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private void eventInfo(LocatableEvent event) { + eventCount++; + display("event info: #" + eventCount); + display("\tthread\t- " + event.thread().name()); + locationInfo(event); + } + + private void breakpointInfo(BreakpointRequest request) { + display("breakpoint info: "); + display("\tis enabled - " + request.isEnabled()); + locationInfo(request); + } + + private void locationInfo(Locatable loc) { + try { + display("\tsource\t- " + loc.location().sourceName()); + display("\tmethod\t- " + loc.location().method().name()); + display("\tline\t- " + loc.location().lineNumber()); + } catch (AbsentInformationException e) { + display("***information is not available***"); + } + } + + private MethodExitRequest createMethodExitRequest(ReferenceType refType) { + EventRequestManager evm = debugee.getEventRequestManager(); + MethodExitRequest request = evm.createMethodExitRequest(); + request.addClassFilter(refType); + request.enable(); + return request; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/TestDescription.java new file mode 100644 index 00000000000..77b32746b3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/TestDescription.java @@ -0,0 +1,96 @@ +/* + * 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/BScenarios/hotswap/tc10x002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 3 - Hot Swap + * Test case: TC10 + * Description: Changing data type + * Steps: 1.Set breakpoint on line 20 + * 2.Debug Main + * X. Stops on line 20 + * 3.Change line 16 to boolean i = true; + * 4.Smart Swap + * 5.Resume + * X. Prints "true" as last line of output + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 40th line (method runIt). + * Note: the runIt method was added into the test, to allow invoking + * ThreadReference.popFrame(). Current frame can not be reset because of + * there is no previous frame. + * After the breakpoint is reached, debugger redefines debugee changing + * type of local variable, pops current frame, sets a new breakpoint at + * 37th line and resumes debugee. + * When the second breakpoint hits, debugger requests value of the local + * variable "i" and compares got value with expected value. + * In this case expected value is the new value after redefinition. + * COMMENTS: + * Step 5 of Borland's scenario is wrong due to redefineClasses spec says: + * "The redefined method will be used on new invokes. If resetting these + * frames is desired, use ThreadReference.popFrames() with + * Method.isObsolete()." + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.hotswap.tc10x002 + * nsk.jdi.BScenarios.hotswap.tc10x002a + * + * @comment make sure tc10x002a is compiled with full debug info + * @clean nsk.jdi.BScenarios.hotswap.tc10x002a + * @compile -g:lines,source,vars ../tc10x002a.java + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.hotswap.tc10x002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/newclass/tc10x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/newclass/tc10x002a.java new file mode 100644 index 00000000000..a36162bbc4b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/newclass/tc10x002a.java @@ -0,0 +1,78 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc10x002a is deugee's part of the tc10x002. + */ +public class tc10x002a { + + public final static String brkpMethodName = "runIt"; + public final static int brkpLineNumber1 = 60; + public final static int brkpLineNumber2 = 57; + public final static int checkLastLine1 = 60; + public final static int checkLastLine2 = 57; + public final static int INITIAL_INT_VALUE = 42; + public final static boolean INITIAL_BOOL_VALUE = true; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + runIt(); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void runIt() { + boolean i = INITIAL_BOOL_VALUE; +// ^^^^^^^ ^^^^^^^^^^^^^^^^^^ redefined line // brkpLineNumber2 // checkLastLine2 + tc10x002a obj = new tc10x002a(); + obj.method_A(); + // brkpLineNumber1 // checkLastLine1 + System.err.println("i = " + i); + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002a.java new file mode 100644 index 00000000000..0827661474f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002a.java @@ -0,0 +1,78 @@ +/* + * 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.BScenarios.hotswap; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc10x002a is deugee's part of the tc10x002. + */ +public class tc10x002a { + + public final static String brkpMethodName = "runIt"; + public final static int brkpLineNumber1 = 61; + public final static int brkpLineNumber2 = 58; + public final static int checkLastLine1 = 61; + public final static int checkLastLine2 = 58; + public final static int INITIAL_INT_VALUE = 42; + public final static boolean INITIAL_BOOL_VALUE = true; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + runIt(); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void runIt() { + int i = INITIAL_INT_VALUE; +// ^^^ ^^^^^^^^^^^^^^^^^ will be redefined + tc10x002a obj = new tc10x002a(); // brkpLineNumber2 // checkLastLine2 + obj.method_A(); + + System.err.println("i = " + i); // brkpLineNumber1 // checkLastLine1 + } + + public void method_A() { + method_B(); + } + + public void method_B() { + method_C(); + } + + public void method_C() { + System.err.println("method_C:: line 1"); + System.err.println("method_C:: line 2"); + System.err.println("method_C:: line 3"); + System.err.println("method_C:: line 4"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001.java new file mode 100644 index 00000000000..ec720d829ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001.java @@ -0,0 +1,253 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * TC1
    + * Description: Line breakpoint & step
    + * Steps: 1.Set breakpoint on line 32
    + * 2.Debug Main
    + * X. Stops on line 32
    + * 3.Run | Step over
    + * X. Steps to line 33
    + * + * When the test is starting debugee, debugger sets breakpoint at the 69th + * line (method "foo"). After the breakpoint is reached, debugger creates + * "step over" request and resumes debugee. For every hit event debugger + * checks line number of one's location. It should be 69th line for Breakpoint + * or 70th line for Step. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc01x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc01x001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int brkpEventCount = 0; + private static int stepEventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc01x001 thisTest = new tc01x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + display("Tested class\t:" + debugeeClass.name()); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + debugee.setBreakpoint(debugeeClass, + tc01x001a.brkpMethodName, + tc01x001a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display(" event ===>>> " + event); + + if (event instanceof BreakpointEvent) { + display(" event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display(" event ===>>> " + event); + hitStepOver((StepEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + exit = exit || (brkpEventCount == tc01x001a.threadCount && + stepEventCount == tc01x001a.threadCount); + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (brkpEventCount < tc01x001a.threadCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + tc01x001a.threadCount + + " MethodBreakpoint events, but " + + brkpEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitBreakpoint(BreakpointEvent event) { + EventRequestManager evm = debugee.getEventRequestManager(); + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() != tc01x001a.checkBrkpLine) { + complain("BreakpointEvent stops on line " + event.location().lineNumber() + + ", expected line number is " + tc01x001a.checkBrkpLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("BreakpointEvent stops on the expected line " + + event.location().lineNumber()); + } + + display(""); + StepRequest step = evm.createStepRequest(thrd, StepRequest.STEP_LINE, + StepRequest.STEP_OVER); + brkpEventCount++; + step.enable(); + } + + private void hitStepOver(StepEvent event) { + EventRequestManager evm = debugee.getEventRequestManager(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() != tc01x001a.checkStepLine) { + complain("StepEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + tc01x001a.checkStepLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("StepEvent steps to the expected line " + + event.location().lineNumber()); + } + display(""); + + evm.deleteEventRequest(event.request()); + stepEventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001/TestDescription.java new file mode 100644 index 00000000000..366232f1517 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/BScenarios/multithrd/tc01x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC1 + * Description: Line breakpoint & step + * Steps: 1.Set breakpoint on line 32 + * 2.Debug Main + * X. Stops on line 32 + * 3.Run | Step over + * X. Steps to line 33 + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 69th line (method "foo"). + * After the breakpoint is reached, debugger creates "step over" request + * and resumes debugee. For every hit event debugger checks line number + * of one's location. It should be 69th line for Breakpoint or 70th line + * for Step. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * The testcase intermittently hangs under RightCross. It looks like a + * JBuilder bug. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc01x001 + * nsk.jdi.BScenarios.multithrd.tc01x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc01x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001a.java new file mode 100644 index 00000000000..154656c263e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001a.java @@ -0,0 +1,103 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x001a is deugee's part of the tc01x001. + */ +public class tc01x001a { + + public final static String brkpMethodName = "bar"; + public final static int brkpLineNumber = 89; + + public final static int checkBrkpLine = 89; + public final static int checkStepLine = 90; + public final static int threadCount = 3; + private static Log log; + + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc01x001.SGL_READY); + + tc01x001a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc01x001.SGL_PERFORM)) { + obj = new tc01x001a(); + } else if (instr.equals(tc01x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + try { + for (int i = 0; i < obj.thrds.length; i++ ) { + obj.thrds[i].join(); + } + } catch (InterruptedException e) { + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc01x001a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + public static void foo(String caller) { + log.display(caller + "::foo is called"); + } + + public static void bar(String caller) { + log.display(caller + "::bar is called"); // brkpLineNumber // checkBrkpLine + log.display(caller + "::bar_step"); // checkStepLine + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + tc01x001a.foo(getName()); + tc01x001a.bar(getName()); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001.java new file mode 100644 index 00000000000..6803fd51629 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001.java @@ -0,0 +1,219 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc02x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc02x001"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int brkpEventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc02x001 thisTest = new tc02x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + debugeeClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + MethodEntryRequest mthdReq = evm.createMethodEntryRequest(); + mthdReq.addClassFilter(testedClassName); + mthdReq.enable(); + + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + + if (event instanceof MethodEntryEvent) { + hitClassBreakpoint((MethodEntryEvent )event); + display(" event ===>>> " + (brkpEventCount+1) + " MethodEntryEvent arrived"); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + exit = exit || (brkpEventCount == tc02x001a.threadCount); + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (brkpEventCount < tc02x001a.threadCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + tc02x001a.threadCount + + " MethodBreakpoint events, but " + + brkpEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitClassBreakpoint(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() == tc02x001a.checkClassBrkpLine) { + display("ClassBreakpoint stops on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("ClassBreakpoint stops on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line number is " + + tc02x001a.checkClassBrkpLine); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + brkpEventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001/TestDescription.java new file mode 100644 index 00000000000..ff0175af276 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/BScenarios/multithrd/tc02x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * The test synchronizes debugger and debugee executing via IOPipe channel. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc02x001 + * nsk.jdi.BScenarios.multithrd.tc02x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc02x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001a.java new file mode 100644 index 00000000000..91a8cb1f08b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001a.java @@ -0,0 +1,97 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x001a is deugee's part of the tc02x001. + */ +public class tc02x001a { + + public final static int threadCount = 3; + static Log log; + + public final static int checkClassBrkpLine = 93; + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc02x001.SGL_READY); + + tc02x001a obj = null; + String instr; + do { + instr = pipe.readln(); + log.display("instr \"" + instr + "\""); + if (instr.equals(tc02x001.SGL_PERFORM)) { + obj = new tc02x001a(); + } else if (instr.equals(tc02x001.SGL_QUIT)) { + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + try { + for (int i = 0; i < obj.thrds.length; i++ ) { + obj.thrds[i].join(); + } + } catch (InterruptedException e) { + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc02x001a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + log.display(getName() + ":: creating tc02x001aClass1"); + new tc02x001aClass1(getName()); + } + } +} + +class tc02x001aClass1 { + public tc02x001aClass1(String thrdName) { // checkClassBrkpLine + tc02x001a.log.display("tc02x001aClass1::constructor is called from" + + thrdName); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002.java new file mode 100644 index 00000000000..960ef8ed2ca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002.java @@ -0,0 +1,237 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 80th or 82th lines, that are static initializer and + * constructor of tc02x001aClass1 class. Every thread must generate + * MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc02x002 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_LOAD = "load"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc02x002"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int eventCount = 0; + + private EventRequestManager evm = null; + private MethodEntryRequest mthdReq = null; + private volatile boolean exit = false; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + tc02x002 thisTest = new tc02x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + IOPipe pipe = debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest crq = evm.createClassPrepareRequest(); + crq.addClassFilter(testedClassName); + crq.enable(); + + // event handling thread + Thread eventHandler = new Thread() { + public void run() { + EventQueue eventQueue = debugee.VM().eventQueue(); + EventSet eventSet = null; + while (!exit) { + try { + eventSet = eventQueue.remove(1000); + } catch (InterruptedException e) { + new Failure("Event handling thread interrupted:\n\t" + e); + } + if (eventSet == null) { + continue; + } + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + if (event instanceof ClassPrepareEvent) { + display(" event ===>>> " + event); + mthdReq = evm.createMethodEntryRequest(); + mthdReq.addClassFilter(testedClassName); + mthdReq.enable(); + debugee.resume(); + + } else if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + (eventCount+1) + " MethodEntryEvent arrived"); + hitEvent((MethodEntryEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } else { + throw new Failure("Unexpected event:\n\t" + event); + } // if + exit = exit || (eventCount >= tc02x002a.threadCount + 1); + } // while + } // while + } // run() + }; // eventHadler + + display("Starting handling event"); + eventHandler.start(); + + debugee.resume(); + debugee.receiveExpectedSignal(SGL_READY); + + display("\nTEST BEGINS"); + display("==========="); + debugee.sendSignal(SGL_LOAD); + + display("Waiting for all events received"); + try { + eventHandler.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Main thread interrupted while waiting for eventHandler:\n\t" + + e); + } finally { + crq.disable(); + mthdReq.disable(); + exit = true; + if (eventHandler.isAlive()) { + display("Interrupting event handling thread"); + eventHandler.interrupt(); + } + } + + if (eventCount < tc02x002a.threadCount) { + complain("expecting " + tc02x002a.threadCount + + " breakpoint events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + debugee.sendSignal(SGL_QUIT); + } + + private void hitEvent(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + if (event.location().lineNumber() == tc02x002a.checkClassBrkpLine1 || + event.location().lineNumber() == tc02x002a.checkClassBrkpLine2) { + display("MethodEntryEvent occurs on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("MethodEntryEvent occurs on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line numbers are " + + tc02x002a.checkClassBrkpLine1 + ", " + + tc02x002a.checkClassBrkpLine2); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + eventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002/TestDescription.java new file mode 100644 index 00000000000..800fa741b18 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002/TestDescription.java @@ -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/BScenarios/multithrd/tc02x002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates ClassPrepareRequest + * MethodEntryRequest with adding filter via class name. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 80th or 82th lines, that are static initializer + * and constructor of tc02x001aClass1 class. Every thread must generate + * MethodEntryEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests + * - launching debuggee by prepareDebugee() replaced with bindToDebugee() + * to exclude first IOPipe communication + * - making ClassPrepareRequest moved to begin (right after debuggee started) + * - making MethodEntryRequest moved to handling ClassPrepareEvent + * - handling events moved to a separate thread + * - removed extra IOPipe communication points to make algorithm more clear + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc02x002 + * nsk.jdi.BScenarios.multithrd.tc02x002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc02x002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002a.java new file mode 100644 index 00000000000..a0bf559387d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002a.java @@ -0,0 +1,102 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x002a is deugee's part of the tc02x002. + */ +public class tc02x002a { + + public final static int threadCount = 3; + static Log log; + + public final static int checkClassBrkpLine1 = 96; + public final static int checkClassBrkpLine2 = 98; + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc02x002.SGL_READY); + + tc02x002a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc02x002.SGL_LOAD)) { + tc02x002aClass1.loadThis = true; + obj = new tc02x002a(); + } else if (instr.equals(tc02x002.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + try { + for (int i = 0; i < obj.thrds.length; i++ ) { + obj.thrds[i].join(); + } + } catch (InterruptedException e) { + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc02x002a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + log.display(getName() + ":: creating tc02x002aClass1"); + new tc02x002aClass1(getName()); + } + } +} + +class tc02x002aClass1 { + + static boolean loadThis = false; // checkClassBrkpLine1 + + public tc02x002aClass1(String thrdName) { // checkClassBrkpLine2 + tc02x002a.log.display("tc02x002aClass1::constructor is called from" + + thrdName); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java new file mode 100644 index 00000000000..4fd48e21ff0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003.java @@ -0,0 +1,248 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 80th or 82th lines, that are static initializer and + * constructor of tc02x001aClass1 class. Every thread must generate + * MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc02x003 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_LOAD = "load"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc02x003"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int eventCount = 0; + + private EventRequestManager evm = null; + private MethodEntryRequest mthdReq = null; + private volatile boolean exit = false; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + tc02x003 thisTest = new tc02x003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + IOPipe pipe = debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest crq = evm.createClassPrepareRequest(); + crq.addClassFilter(testedClassName); + crq.enable(); + + // event handling thread + Thread eventHandler = new Thread() { + public void run() { + EventQueue eventQueue = debugee.VM().eventQueue(); + EventSet eventSet = null; + while (!exit) { + try { + eventSet = eventQueue.remove(1000); + } catch (InterruptedException e) { + new Failure("Event handling thread interrupted:\n\t" + e); + } + if (eventSet == null) { + continue; + } + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + if (event instanceof ClassPrepareEvent) { + display(" event ===>>> " + event); + ClassPrepareEvent clsEvent = (ClassPrepareEvent )event; + hitEvent(clsEvent); + + mthdReq = evm.createMethodEntryRequest(); + ReferenceType testedClass = clsEvent.referenceType();; + mthdReq.addClassFilter(testedClass); + mthdReq.enable(); + + debugee.resume(); + + } else if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + event); + hitEvent((MethodEntryEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } else { + throw new Failure("Unexpected event:\n\t" + event); + } // if + exit = exit || (eventCount >= tc02x003a.threadCount + 2); + } // while + } // while + } // run() + }; // eventHadler + + display("Starting handling event"); + eventHandler.start(); + + debugee.resume(); + debugee.receiveExpectedSignal(SGL_READY); + + display("\nTEST BEGINS"); + display("==========="); + debugee.sendSignal(SGL_LOAD); + + display("Waiting for all events received"); + try { + eventHandler.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Main thread interrupted while waiting for eventHandler:\n\t" + + e); + } finally { + crq.disable(); + mthdReq.disable(); + exit = true; + if (eventHandler.isAlive()) { + display("Interrupting event handling thread"); + eventHandler.interrupt(); + } + } + + if (eventCount < tc02x003a.threadCount) { + complain("expecting " + tc02x003a.threadCount + + " MethodBreakpoint events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + debugee.sendSignal(SGL_QUIT); + } + + private void hitEvent(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() == tc02x003a.checkClassBrkpLine1 || + event.location().lineNumber() == tc02x003a.checkClassBrkpLine2) { + display("MethodEntryEvent occurs on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("MethodEntryEventOccurs on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line numbers are " + + tc02x003a.checkClassBrkpLine1 + ", " + + tc02x003a.checkClassBrkpLine2); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + eventCount++; + } + + private void hitEvent(ClassPrepareEvent event) { + display("ClassPrepareEvent occursn"); + eventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003/TestDescription.java new file mode 100644 index 00000000000..226c0c2130d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003/TestDescription.java @@ -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/BScenarios/multithrd/tc02x003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates ClassPrepareRequest + * MethodEntryRequest with adding filter via reference type. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 80th or 82th lines, that are static initializer + * and constructor of tc02x001aClass1 class. Every thread must generate + * MethodEntryEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests + * - launching debuggee by prepareDebugee() replaced with bindToDebugee() + * to exclude first IOPipe communication + * - making ClassPrepareRequest moved to begin (right after debuggee started) + * - making MethodEntryRequest moved to handling ClassPrepareEvent + * - handling events moved to a separate thread + * - removed extra IOPipe communication points to make algorithm more clear + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc02x003 + * nsk.jdi.BScenarios.multithrd.tc02x003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc02x003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003a.java new file mode 100644 index 00000000000..2f4957d1fa4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003a.java @@ -0,0 +1,102 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x003a is deugee's part of the tc02x003. + */ +public class tc02x003a { + + public final static int threadCount = 3; + static Log log; + + public final static int checkClassBrkpLine1 = 96; + public final static int checkClassBrkpLine2 = 98; + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc02x003.SGL_READY); + + tc02x003a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc02x003.SGL_LOAD)) { + tc02x003aClass1.loadThis = true; + obj = new tc02x003a(); + } else if (instr.equals(tc02x003.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + try { + for (int i = 0; i < obj.thrds.length; i++ ) { + obj.thrds[i].join(); + } + } catch (InterruptedException e) { + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc02x003a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + log.display(getName() + ":: creating tc02x003aClass1"); + new tc02x003aClass1(getName()); + } + } +} + +class tc02x003aClass1 { + + static boolean loadThis = false; // checkClassBrkpLine1 + + public tc02x003aClass1(String thrdName) { // checkClassBrkpLine2 + tc02x003a.log.display("tc02x003aClass1::constructor is called from" + + thrdName); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java new file mode 100644 index 00000000000..9806d30f4da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java @@ -0,0 +1,227 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x004aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc02x004 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc02x004"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int brkpEventCount = 0; + MethodEntryRequest mthdReq; + EventRequestManager evm; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc02x004 thisTest = new tc02x004(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectStderr(log.getOutStream()); + thisTest.evm = debugee.getEventRequestManager(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + thisTest.evm.deleteEventRequest(thisTest.mthdReq); + } finally { + debugee.resume(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + display("\nTEST BEGINS"); + display("==========="); + debugee.resume(); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + mthdReq = evm.createMethodEntryRequest(); + mthdReq.addClassFilter(testedClassName); + mthdReq.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + + if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + (brkpEventCount+1) + " MethodEntryEvent arrived"); + hitClassBreakpoint((MethodEntryEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + exit = exit || (brkpEventCount == tc02x004a.threadCount); + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (brkpEventCount < tc02x004a.threadCount) { + complain("expecting " + tc02x004a.threadCount + + " breakpoint events, but " + + brkpEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitClassBreakpoint(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + display("thread:\t" + event.thread().name()); + try { + display("source:\t" + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("method:\t" + event.location().method().name()); + display("line:\t" + event.location().lineNumber()); + if (event.location().lineNumber() == tc02x004a.checkClassBrkpLine) { + display("ClassBreakpoint stops on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("ClassBreakpoint stops on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line number is " + + tc02x004a.checkClassBrkpLine); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + brkpEventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004/TestDescription.java new file mode 100644 index 00000000000..b72c30c7952 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/BScenarios/multithrd/tc02x004. + * VM Testbase keywords: [quick, jpda, jdi, quarantine] + * VM Testbase comments: JDK-4751860 + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 59th line, that is constructor of tc02x004aClass1 + * class. Every thread must generate MethodEntryEvent. + * The test looks like tc002x001 except that synchronizing debugger and + * debugee is performed without IOPipe channel. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc02x004 + * nsk.jdi.BScenarios.multithrd.tc02x004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc02x004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004a.java new file mode 100644 index 00000000000..f41aed76609 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004a.java @@ -0,0 +1,83 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x004a is deugee's part of the tc02x004. + */ +public class tc02x004a { + + public final static int threadCount = 3; + static Log log; + + public final static int checkClassBrkpLine = 79; + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + tc02x004a obj = new tc02x004a(); + + try { + for (int i = 0; i < obj.thrds.length; i++ ) { + obj.thrds[i].join(); + } + } catch (InterruptedException e) { + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc02x004a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + log.display(getName() + ":: creating tc02x004aClass1"); + new tc02x004aClass1(getName()); + } + } +} + +class tc02x004aClass1 { + public tc02x004aClass1(String thrdName) { // checkClassBrkpLine + tc02x004a.log.display("tc02x004aClass1::constructor is called from" + + thrdName); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001.java new file mode 100644 index 00000000000..986f5549ad2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001.java @@ -0,0 +1,233 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC3 + * Description: Exception breakpoint + * Steps: 1.Set caught exception breakpoint on class + * javax.sound.midi.MidiUnavailableException + * 2.Debug Main + * X. Stops on line 42 in Main.java + * + * When the test is starting debugee, debugger creates ExceptionRequest. + * After ExceptionEvent arrived, debugger checks line number of one's + * location. It should be 74th line, that is throwing tc03x001aException. + * Every thread must generate ExceptionEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc03x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_LOAD = "load"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc03x001"; + private final static String debugeeName = debuggerName + "a"; + private final static String exceptionName = debugeeName + "Exception"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int eventCount = 0; + + private EventRequestManager evm = null; + private ExceptionRequest exReq = null; + private volatile boolean exit = false; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + tc03x001 thisTest = new tc03x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + IOPipe pipe = debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest crq = evm.createClassPrepareRequest(); + crq.addClassFilter(exceptionName); + crq.enable(); + + // event handling thread + Thread eventHandler = new Thread() { + public void run() { + EventQueue eventQueue = debugee.VM().eventQueue(); + EventSet eventSet = null; + while (!exit) { + try { + eventSet = eventQueue.remove(1000); + } catch (InterruptedException e) { + new Failure("Event handling thread interrupted:\n\t" + e); + } + if (eventSet == null) { + continue; + } + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + if (event instanceof ClassPrepareEvent) { + exReq = evm.createExceptionRequest( + ((ClassPrepareEvent )event).referenceType(), + true, false); + exReq.enable(); + debugee.resume(); + + } else if (event instanceof ExceptionEvent) { + hitEvent((ExceptionEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } else { + throw new Failure("Unexpected event:\n\t" + event); + } // if + exit = exit || (eventCount >= tc03x001a.threadCount); + } // while + } // while + } // run() + }; // eventHadler + + display("Starting handling event"); + eventHandler.start(); + + debugee.resume(); + debugee.receiveExpectedSignal(SGL_READY); + + display("\nTEST BEGINS"); + display("==========="); + debugee.sendSignal(SGL_LOAD); + + display("Waiting for all events received"); + try { + eventHandler.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Main thread interrupted while waiting for eventHandler:\n\t" + + e); + } finally { + crq.disable(); + exReq.disable(); + exit = true; + if (eventHandler.isAlive()) { + display("Interrupting event handling thread"); + eventHandler.interrupt(); + } + } + + if (eventCount < tc03x001a.threadCount) { + complain("expecting " + tc03x001a.threadCount + + " ExceptionEvents, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + display("============="); + display("TEST FINISHES\n"); + debugee.sendSignal(SGL_QUIT); + } + + private void hitEvent(ExceptionEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() == tc03x001a.checkExBrkpLine) { + display("ExceptionEvent occurs on the expected line " + + event.location().lineNumber() + " in method " + + event.location().method().name()); + } else { + complain("ExceptionEvent occurs stops on line " + event.location().lineNumber() + + " in method " + event.location().method().name() + + ", expected line number is " + + tc03x001a.checkExBrkpLine); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + eventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001/TestDescription.java new file mode 100644 index 00000000000..0b7eedb0560 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001/TestDescription.java @@ -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/BScenarios/multithrd/tc03x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC3 + * Description: Exception breakpoint + * Steps: 1.Set caught exception breakpoint on class + * javax.sound.midi.MidiUnavailableException + * 2.Debug Main + * X. Stops on line 42 in Main.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates ExceptionRequest. + * After ExceptionEvent arrived, debugger checks line number of one's + * location. It should be 74th line, that is throwing tc03x001aException. + * Every thread must generate ExceptionEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests + * - launching debuggee by prepareDebugee() replaced with bindToDebugee() + * to exclude first IOPipe communication + * - making ClassPrepareRequest moved to begin (right after debuggee started) + * - making ExceptionRequest moved to handling ClassPrepareEvent + * - handling events moved to a separate thread + * - removed extra IOPipe communication points to make algorithm more clear + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc03x001 + * nsk.jdi.BScenarios.multithrd.tc03x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc03x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001a.java new file mode 100644 index 00000000000..7fffcb24064 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001a.java @@ -0,0 +1,100 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc03x001a is deugee's part of the tc03x001. + */ +public class tc03x001a { + + public final static int threadCount = 3; + static Log log; + + public final static int checkExBrkpLine = 90; + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc03x001.SGL_READY); + + tc03x001a obj = null; + String instr; + do { + instr = pipe.readln(); + + if (instr.equals(tc03x001.SGL_LOAD)) { + tc03x001aException.loadThis = true; + obj = new tc03x001a(); + } else if (instr.equals(tc03x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + try { + for (int i = 0; i < obj.thrds.length; i++ ) { + obj.thrds[i].join(); + } + } catch (InterruptedException e) { + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc03x001a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + log.display(getName() + ":: throwing tc03x001aException"); + try { + throw new tc03x001aException(); // checkExBrkpLine + } catch (tc03x001aException e) { + } + } + } +} + +class tc03x001aException extends RuntimeException { + + static boolean loadThis = false; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java new file mode 100644 index 00000000000..c72ef73a416 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java @@ -0,0 +1,225 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC4 + * Description: Exception breakpoint + * Steps: 1.Set method breakpoint on Main.foo() + * 2.Debug Main + * 3.Stops on line 27 in Main.java + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks method name and if + * the one corresponds to specified name, it checks line number of the + * event location. It should be 64th line, that is method tc04x001a.foo. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc04x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_LOAD = "load"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.multithrd."; + private final static String debuggerName = prefix + "tc04x001"; + private final static String debugeeName = debuggerName + "a"; + private final static String methodName = "foo"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int brkpEventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc04x001 thisTest = new tc04x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventRequestManager evm = debugee.getEventRequestManager(); + MethodEntryRequest mthdReq = evm.createMethodEntryRequest(); + display("MethodEntryRequest created, expecting events " + + "from method \"" + methodName + "\""); + display("---------------------------------------------" + + "-----------"); + mthdReq.addClassFilter(debugeeName); + mthdReq.enable(); + + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + + if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + " MethodEntryEvent arrived"); + hitMethodBreakpoint((MethodEntryEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (brkpEventCount < tc04x001a.threadCount) { + complain("expecting " + tc04x001a.threadCount + + " MethodBreakpoint events, but " + + brkpEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitMethodBreakpoint(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (!event.method().name().equals(methodName)) { + display("the event skipped, method - " + event.method().name() + "\n"); + return; + } + + if (event.location().lineNumber() == tc04x001a.checkMethodBrkpLine) { + display("!!!MethodBreakpoint stops on the expected line " + + event.location().lineNumber() + " in method " + + "\"" + event.method().name() + "\"!!!"); + } else { + complain("MethodBreakpoint stops on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line number is " + + tc04x001a.checkMethodBrkpLine); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + brkpEventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001/TestDescription.java new file mode 100644 index 00000000000..e196970bf18 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001/TestDescription.java @@ -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/BScenarios/multithrd/tc04x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC4 + * Description: Exception breakpoint + * Steps: 1.Set method breakpoint on Main.foo() + * 2.Debug Main + * 3.Stops on line 27 in Main.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks method name and if + * the one corresponds to specified name, it checks line number of the + * event location. It should be 64th line, that is method tc04x001a.foo. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.multithrd.tc04x001 + * nsk.jdi.BScenarios.multithrd.tc04x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.multithrd.tc04x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java new file mode 100644 index 00000000000..b7a68c487ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java @@ -0,0 +1,91 @@ +/* + * 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.BScenarios.multithrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc04x001a is deugee's part of the tc04x001. + */ +public class tc04x001a { + + public final static int threadCount = 3; + static Log log; + + public final static int checkMethodBrkpLine = 74; + Thready [] thrds = new Thready [threadCount]; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + + tc04x001a obj = new tc04x001a(); + + for (int i = 0; i < obj.thrds.length; i++ ) { + try { + obj.thrds[i].join(argHandler.getWaitTime() * 60000);//obj.thrds[i].join(); + if (!obj.thrds[i].isAlive()) { + log.display(obj.thrds[i].getName() + " finished"); + } else { + log.display(obj.thrds[i].getName() + " not finished"); + } + } catch (InterruptedException e) { + log.complain("DEBUGEE> " + obj.thrds[i].getName() + " didn't die."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + tc04x001a() { + for (int i = 0; i < thrds.length; i++ ) { + thrds[i] = new Thready("Thread-" + (i+1)); + thrds[i].start(); + } + } + + public static void foo(String caller) { + log.display(caller + "::foo is called"); // checkMethodBrkpLine + } + + public static void bar(String caller) { + log.display(caller + "::bar is called"); + } + + static class Thready extends Thread { + Thready(String name) { + super(name); + } + + public void run() { + tc04x001a.foo(getName()); + tc04x001a.bar(getName()); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001.java new file mode 100644 index 00000000000..337e3654c0f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001.java @@ -0,0 +1,240 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 1 - Breakpoints (single threads) + * Test case: TC1 + * Description: Line breakpoint & step into + * Steps: 1.Set breakpoint on line 19 + * 2.Debug Main + * X. Stops on line 19 + * 3.Run | Step into three times + * X. Steps into Class1 constructor + * + * When the test is starting debugee, debugger sets breakpoint at + * the 48th line (method performTest). + * After the breakpoint is reached, debugger creates "step into" request + * and resumes debugee. StepRequest is created with specified + * addClassFilter. For the third StepEvent debugger + * checks line number of one's location. It should be 56th line. + * + * In case, when line number of event is wrong, test fails. + */ + +public class tc01x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc01x001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private final static int expectedStepEventCount = 3; + private static int stepEventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc01x001 thisTest = new tc01x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + display("Tested class\t:" + debugeeClass.name()); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest step = null; + + debugee.setBreakpoint(debugeeClass, + tc01x001a.brkpMethodName, + tc01x001a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display(" event ===>>> " + event); + + if (event instanceof BreakpointEvent) { + display(" event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + step = evm.createStepRequest(((BreakpointEvent )event).thread(), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + step.addClassFilter(prefix + "*"); + step.enable(); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display(" event ===>>> " + event); + hitStepInto((StepEvent )event); + if (stepEventCount >= expectedStepEventCount) { + evm.deleteEventRequest(step); + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + exit = exit || (stepEventCount == expectedStepEventCount); + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (stepEventCount < expectedStepEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedStepEventCount + + " step events, but " + + stepEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitBreakpoint(BreakpointEvent event) { + display("BreakpointEvent arrived. Location - " + + event.location().lineNumber() + " line"); + display(""); + } + + private void hitStepInto(StepEvent event) { + stepEventCount++; + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (stepEventCount == expectedStepEventCount) { + if (event.location().lineNumber() != tc01x001a.checkLastLine) { + complain("StepEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc01x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("StepEvent steps to the expected line " + + event.location().lineNumber()); + } + } + display(""); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001/TestDescription.java new file mode 100644 index 00000000000..57d1b678427 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/BScenarios/singlethrd/tc01x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 1 - Breakpoints (single threads) + * Test case: TC1 + * Description: Line breakpoint & step into + * Steps: 1.Set breakpoint on line 19 + * 2.Debug Main + * X. Stops on line 19 + * 3.Run | Step into three times + * X. Steps into Class1 constructor + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 48th line (method "performTest"). + * After the breakpoint is reached, debugger creates "step into" request + * and resumes debugee. StepRequest is created with specified addClassFilter. + * For the third StepEvent debugger checks line number of one's location. + * It should be 56th line. + * In case, when line number of event is wrong, test fails. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc01x001 + * nsk.jdi.BScenarios.singlethrd.tc01x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc01x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001a.java new file mode 100644 index 00000000000..79932cc1d46 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001a.java @@ -0,0 +1,79 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x001a is deugee's part of the tc01x001. + */ +public class tc01x001a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 69; + + public final static int checkLastLine = 76; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc01x001.SGL_READY); + + tc01x001a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc01x001.SGL_PERFORM)) { + performTest(); + } else if (instr.equals(tc01x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::line 0"); + log.display("performTest::breakpoint line"); // brkpLineNumber + log.display("performTest::creating tc01x001aClass1 object"); + new tc01x001aClass1(); + } +} + +class tc01x001aClass1 { + tc01x001aClass1() { // checkLastLine + tc01x001a.log.display("tc01x001aClass1::constructor is called"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002.java new file mode 100644 index 00000000000..b5ac0a1590c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002.java @@ -0,0 +1,246 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 1 - Breakpoints (single threads) + * Test case: TC1 + * Description: Line breakpoint & step into + * Steps: 1.Set breakpoint on line 19 + * 2.Debug Main + * X. Stops on line 19 + * 3.Run | Step into three times + * X. Steps into Class1 constructor + * + * When the test is starting debugee, debugger sets breakpoint at + * the 49th line (method performTest). + * After the breakpoint is reached, debugger creates "step into" request + * and resumes debugee. StepRequest is created with specified + * addClassExclusionFilter. For the third StepEvent + * debugger checks line number of one's location. It should be 56th line. + * + * In case, when line number of event is wrong, test fails. + */ + +public class tc01x002 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc01x002"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private final static int expectedStepEventCount = 3; + private static int stepEventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc01x002 thisTest = new tc01x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + display("Tested class\t:" + debugeeClass.name()); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest step = null; + + debugee.setBreakpoint(debugeeClass, + tc01x002a.brkpMethodName, + tc01x002a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display(" event ===>>> " + event); + + if (event instanceof BreakpointEvent) { + display(" event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + step = evm.createStepRequest(((BreakpointEvent )event).thread(), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + step.addClassExclusionFilter("nsk.share.*"); + step.addClassExclusionFilter("java.*"); + step.addClassExclusionFilter("sun.*"); + step.addClassExclusionFilter("oracle.*"); + step.addClassExclusionFilter("jdk.jfr.*"); + step.addClassExclusionFilter("com.oracle.*"); + step.addClassExclusionFilter("jdk.internal.*"); + step.enable(); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display(" event ===>>> " + event); + hitStepInto((StepEvent )event); + if (stepEventCount >= expectedStepEventCount) { + evm.deleteEventRequest(step); + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + exit = exit || (stepEventCount == expectedStepEventCount); + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (stepEventCount < expectedStepEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedStepEventCount + + " step events, but " + + stepEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitBreakpoint(BreakpointEvent event) { + display("BreakpointEvent arrived. Location - " + + event.location().lineNumber() + " line"); + display(""); + } + + private void hitStepInto(StepEvent event) { + stepEventCount++; + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (stepEventCount == expectedStepEventCount) { + if (event.location().lineNumber() != tc01x002a.checkLastLine) { + complain("StepEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc01x002a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("StepEvent steps to the expected line " + + event.location().lineNumber()); + } + } + display(""); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002/TestDescription.java new file mode 100644 index 00000000000..830fa9006db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002/TestDescription.java @@ -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/BScenarios/singlethrd/tc01x002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 1 - Breakpoints (single threads) + * Test case: TC1 + * Description: Line breakpoint & step into + * Steps: 1.Set breakpoint on line 19 + * 2.Debug Main + * X. Stops on line 19 + * 3.Run | Step into three times + * X. Steps into Class1 constructor + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 49th line (method "performTest"). + * After the breakpoint is reached, debugger creates "step into" request + * and resumes debugee. StepRequest is created with specified + * addClassExclusionFilter. For the third StepEvent debugger checks line + * number of one's location. It should be 56th line. + * In case, when line number of event is wrong, test fails. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc01x002 + * nsk.jdi.BScenarios.singlethrd.tc01x002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc01x002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002a.java new file mode 100644 index 00000000000..6fb97d2d52d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002a.java @@ -0,0 +1,79 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc01x002a is deugee's part of the tc01x002. + */ +public class tc01x002a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 69; + + public final static int checkLastLine = 76; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc01x002.SGL_READY); + + tc01x002a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc01x002.SGL_PERFORM)) { + performTest(); + } else if (instr.equals(tc01x002.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::line 0"); + log.display("performTest::breakpoint line"); // brkpLineNumber + log.display("performTest::creating tc01x002aClass1 object"); + new tc01x002aClass1(); + } +} + +class tc01x002aClass1 { + tc01x002aClass1() { // checkLastLine + tc01x002a.log.display("tc01x002aClass1::constructor is called"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001.java new file mode 100644 index 00000000000..80e3b1df992 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001.java @@ -0,0 +1,238 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 1 - Breakpoints (single threads) + * Test case: TC2 + * Description: Line breakpoint & step over + * Steps: 1.Set breakpoint on line 19 + * 2.Debug Main + * X. Stops on line 19 + * 3.Run | Step over three times + * X. Stops on line 22 in Main.java + * + * When the test is starting debugee, debugger sets breakpoint at + * the 49th line (method "performTest"). + * After the breakpoint is reached, debugger creates "step over" request + * and resumes debugee. For the third StepEvent debugger checks line + * number of one's location. It should be 52th line. + * + * In case, when line number of event is wrong, test fails. + */ + +public class tc02x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc02x001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private final static int expectedStepEventCount = 3; + private static int stepEventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc02x001 thisTest = new tc02x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + display("Tested class\t:" + debugeeClass.name()); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest step = null; + + debugee.setBreakpoint(debugeeClass, + tc02x001a.brkpMethodName, + tc02x001a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display(" event ===>>> " + event); + + if (event instanceof BreakpointEvent) { + display(" event ===>>> " + event); + hitBreakpoint((BreakpointEvent )event); + step = evm.createStepRequest(((BreakpointEvent )event).thread(), + StepRequest.STEP_LINE, + StepRequest.STEP_OVER); + step.enable(); + debugee.resume(); + + } else if (event instanceof StepEvent) { + display(" event ===>>> " + event); + hitStepOver((StepEvent )event); + if (stepEventCount >= expectedStepEventCount) { + evm.deleteEventRequest(step); + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + exit = exit || (stepEventCount == expectedStepEventCount); + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (stepEventCount < expectedStepEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedStepEventCount + + " step events, but " + + stepEventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitBreakpoint(BreakpointEvent event) { + display("BreakpointEvent arrived. Location - " + + event.location().lineNumber() + " line"); + display(""); + } + + private void hitStepOver(StepEvent event) { + stepEventCount++; + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (stepEventCount == expectedStepEventCount) { + if (event.location().lineNumber() != tc02x001a.checkLastLine) { + complain("StepEvent steps to line " + event.location().lineNumber() + + ", expected line number is " + + tc02x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } else { + display("StepEvent steps to the expected line " + + event.location().lineNumber()); + } + } + display(""); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001/TestDescription.java new file mode 100644 index 00000000000..f791e5192e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001/TestDescription.java @@ -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/BScenarios/singlethrd/tc02x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 1 - Breakpoints (single threads) + * Test case: TC2 + * Description: Line breakpoint & step over + * Steps: 1.Set breakpoint on line 19 + * 2.Debug Main + * X. Stops on line 19 + * 3.Run | Step over three times + * X. Stops on line 22 in Main.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger sets breakpoint at + * the 49th line (method "performTest"). + * After the breakpoint is reached, debugger creates "step over" request + * and resumes debugee. For the third StepEvent debugger checks line + * number of one's location. It should be 52th line. + * In case, when line number of event is wrong, test fails. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc02x001 + * nsk.jdi.BScenarios.singlethrd.tc02x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc02x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001a.java new file mode 100644 index 00000000000..6b95d216fd6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001a.java @@ -0,0 +1,80 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc02x001a is deugee's part of the tc02x001. + */ +public class tc02x001a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 68; + + public final static int checkLastLine = 71; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc02x001.SGL_READY); + + tc02x001a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc02x001.SGL_PERFORM)) { + performTest(); + } else if (instr.equals(tc02x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::line 0"); // brkpLineNumber + log.display("performTest::breakpoint line"); + log.display("performTest::creating tc02x001aClass1 object"); + new tc02x001aClass1(); // checkLastLine + log.display("performTest::tc02x001aClass1 object is created"); + } +} + +class tc02x001aClass1 { + tc02x001aClass1() { + tc02x001a.log.display("tc02x001aClass1::constructor is called"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001.java new file mode 100644 index 00000000000..fe2fec7036c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001.java @@ -0,0 +1,222 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc03x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc03x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc03x001"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private final static int expectedEventCount = 1; + private static int eventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc03x001 thisTest = new tc03x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + debugeeClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + MethodEntryRequest mthdReq = evm.createMethodEntryRequest(); + mthdReq.addClassFilter(testedClassName); + mthdReq.enable(); + + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display(" event ===>>> " + event); + + if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + event); + hitClassBreakpoint((MethodEntryEvent )event); + debugee.resume(); + exit = true; + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (eventCount < expectedEventCount) { + if (totalTime <= 0) { + complain("out of wait time..."); + } + complain("expecting " + expectedEventCount + + " breakpoint events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitClassBreakpoint(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() == tc03x001a.checkLastLine) { + display("ClassBreakpoint stops on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("ClassBreakpoint stops on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line number is " + + tc03x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } + + eventCount++; + + display(""); + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001/TestDescription.java new file mode 100644 index 00000000000..1d7ea063201 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001/TestDescription.java @@ -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/BScenarios/singlethrd/tc03x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc03x001 + * nsk.jdi.BScenarios.singlethrd.tc03x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc03x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001a.java new file mode 100644 index 00000000000..1469638c84d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001a.java @@ -0,0 +1,80 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc03x001a is deugee's part of the tc02x001. + */ +public class tc03x001a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 1; + + public final static int checkLastLine = 77; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc03x001.SGL_READY); + + tc03x001a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc03x001.SGL_PERFORM)) { + performTest(); + } else if (instr.equals(tc03x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::line 0"); + log.display("performTest::breakpoint line"); + log.display("performTest::creating tc03x001aClass1 object"); + new tc03x001aClass1(); + log.display("performTest::tc03x001aClass1 object is created"); + } +} + +class tc03x001aClass1 { + tc03x001aClass1() { // checkLastLine + tc03x001a.log.display("tc03x001aClass1::constructor is called"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002.java new file mode 100644 index 00000000000..245d923a4ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002.java @@ -0,0 +1,237 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc03x002aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc03x002 { + + public final static String SGL_READY = "ready"; + public final static String SGL_LOAD = "load"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc03x002"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int eventCount = 0; + private final static int expectedEventCount = 2; + + private EventRequestManager evm = null; + private MethodEntryRequest mthdReq = null; + private volatile boolean exit = false; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + tc03x002 thisTest = new tc03x002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + IOPipe pipe = debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest crq = evm.createClassPrepareRequest(); + crq.addClassFilter(testedClassName); + crq.enable(); + + // event handling thread + Thread eventHandler = new Thread() { + public void run() { + EventQueue eventQueue = debugee.VM().eventQueue(); + EventSet eventSet = null; + while (!exit) { + try { + eventSet = eventQueue.remove(1000); + } catch (InterruptedException e) { + new Failure("Event handling thread interrupted:\n\t" + e); + } + if (eventSet == null) { + continue; + } + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + if (event instanceof ClassPrepareEvent) { + display(" event ===>>> " + event); + mthdReq = evm.createMethodEntryRequest(); + mthdReq.addClassFilter(testedClassName); + mthdReq.enable(); + debugee.resume(); + + } else if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + event); + hitEvent((MethodEntryEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } else { + throw new Failure("Unexpected event:\n\t" + event); + } // if + exit = exit || (eventCount >= expectedEventCount); + } // while + } // while + } // run() + }; // eventHadler + + display("Starting handling event"); + eventHandler.start(); + + debugee.resume(); + debugee.receiveExpectedSignal(SGL_READY); + + display("\nTEST BEGINS"); + display("==========="); + debugee.sendSignal(SGL_LOAD); + + display("Waiting for all events received"); + try { + eventHandler.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Main thread interrupted while waiting for eventHandler:\n\t" + + e); + } finally { + crq.disable(); + mthdReq.disable(); + exit = true; + if (eventHandler.isAlive()) { + display("Interrupting event handling thread"); + eventHandler.interrupt(); + } + } + + if (eventCount < expectedEventCount) { + complain("Expecting " + expectedEventCount + + " MethodEntryEvents, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + debugee.sendSignal(SGL_QUIT); + } + + private void hitEvent(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + eventCount++; + if (event.location().lineNumber() == tc03x002a.checkLastLine1 || + event.location().lineNumber() == tc03x002a.checkLastLine2) { + display("MethodEntryEvent occurs on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("MethodEntryEvent occurs on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line numbers are " + + tc03x002a.checkLastLine1 + " or " + + tc03x002a.checkLastLine2); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002/TestDescription.java new file mode 100644 index 00000000000..6cfc53b6c17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/BScenarios/singlethrd/tc03x002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests + * - launching debuggee by prepareDebugee() replaced with bindToDebugee() + * to exclude first IOPipe communication + * - making ClassPrepareRequest moved to begin (right after debuggee started) + * - making MethodEntryRequest moved to handling ClassPrepareEvent + * - handling events moved to a separate thread + * - removed extra IOPipe communication points to make algorithm more clear + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc03x002 + * nsk.jdi.BScenarios.singlethrd.tc03x002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc03x002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002a.java new file mode 100644 index 00000000000..c66b256bd5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002a.java @@ -0,0 +1,81 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc03x002a is deugee's part of the tc02x001. + */ +public class tc03x002a { + + public final static int checkLastLine1 = 76; + public final static int checkLastLine2 = 78; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc03x002.SGL_READY); + + tc03x002a obj = null; + String instr; + do { + instr = pipe.readln(); + log.display("instruction \"" + instr +"\""); + if (instr.equals(tc03x002.SGL_LOAD)) { + tc03x002aClass1.loadThis = true; + performTest(); + } else if (instr.equals(tc03x002.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::creating tc03x002aClass1 object"); + new tc03x002aClass1(); + log.display("performTest::tc03x002aClass1 object is created"); + } +} + +class tc03x002aClass1 { + + static boolean loadThis = false; // checkLastLine1 + + tc03x002aClass1() { // checkLastLine2 + tc03x002a.log.display("tc03x002aClass1::constructor is called"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003.java new file mode 100644 index 00000000000..7687f8fdd36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003.java @@ -0,0 +1,248 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc03x003aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc03x003 { + + public final static String SGL_READY = "ready"; + public final static String SGL_LOAD = "load"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc03x003"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static int eventCount = 0; + private final static int expectedEventCount = 3; + + private EventRequestManager evm = null; + private MethodEntryRequest mthdReq = null; + private volatile boolean exit = false; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + tc03x003 thisTest = new tc03x003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + IOPipe pipe = debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest crq = evm.createClassPrepareRequest(); + crq.addClassFilter(testedClassName); + crq.enable(); + + // separate thread to handle event + Thread eventHandler = new Thread() { + public void run() { + EventQueue eventQueue = debugee.VM().eventQueue(); + while (!exit) { + EventSet eventSet = null; + try { + eventSet = eventQueue.remove(1000); + } catch (InterruptedException e) { + new Failure("Event handling thread interrupted:\n\t" + e); + } + if (eventSet == null) { + continue; + } + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + if (event instanceof ClassPrepareEvent) { + display(" event ===>>> " + event); + ClassPrepareEvent clsEvent = (ClassPrepareEvent)event; + hitEvent(clsEvent); + + mthdReq = evm.createMethodEntryRequest(); + ReferenceType testedClass = clsEvent.referenceType(); + mthdReq.addClassFilter(testedClass); + mthdReq.enable(); + + debugee.resume(); + + } else if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + event); + hitEvent((MethodEntryEvent )event); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } else { + throw new Failure("Unexpected event received:\n\t" + event); + } // if + exit = exit || (eventCount >= expectedEventCount); + } // while + } // while + } // run() + }; // eventHandler + + display("Starting handling event"); + eventHandler.start(); + + debugee.resume(); + debugee.receiveExpectedSignal(SGL_READY); + + display("\nTEST BEGINS"); + display("==========="); + debugee.sendSignal(SGL_LOAD); + + display("Waiting for all events received"); + try { + eventHandler.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Main thread interrupted while waiting for eventHandler:\n\t" + + e); + } finally { + crq.disable(); + mthdReq.disable(); + exit = true; + if (eventHandler.isAlive()) { + display("Interrupting event handling thread"); + eventHandler.interrupt(); + } + } + + if (eventCount < expectedEventCount) { + complain("Expecting " + expectedEventCount + + " BreakpointEvents, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + debugee.sendSignal(SGL_QUIT); + } + + private void hitEvent(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + eventCount++; + if (event.location().lineNumber() == tc03x003a.checkLastLine1 || + event.location().lineNumber() == tc03x003a.checkLastLine2) { + display("MethodEntryEvent occurs stops on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("MewthodEntryEvent occurs on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line numbers are " + + tc03x003a.checkLastLine1 + " or " + + tc03x003a.checkLastLine2); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + + } + + private void hitEvent(ClassPrepareEvent event) { + display("ClassPrepareEvent occurs\n"); + eventCount++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003/TestDescription.java new file mode 100644 index 00000000000..7a9f9b16736 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/BScenarios/singlethrd/tc03x003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests + * - launching debuggee by prepareDebugee() replaced with bindToDebugee() + * to exclude first IOPipe communication + * - making ClassPrepareRequest moved to begin (right after debuggee started) + * - making MethodEntryRequest moved to handling ClassPrepareEvent + * - handling events moved to a separate thread + * - removed extra IOPipe communication points to make algorithm more clear + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc03x003 + * nsk.jdi.BScenarios.singlethrd.tc03x003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc03x003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003a.java new file mode 100644 index 00000000000..acc5a484c17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003a.java @@ -0,0 +1,81 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc03x003a is deugee's part of the tc02x001. + */ +public class tc03x003a { + + public final static int checkLastLine1 = 76; + public final static int checkLastLine2 = 78; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc03x003.SGL_READY); + + tc03x003a obj = null; + String instr; + do { + instr = pipe.readln(); + log.display("instruction \"" + instr +"\""); + if (instr.equals(tc03x003.SGL_LOAD)) { + tc03x003aClass1.loadThis = true; + performTest(); + } else if (instr.equals(tc03x003.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::creating tc03x003aClass1 object"); + new tc03x003aClass1(); + log.display("performTest::tc03x003aClass1 object is created"); + } +} + +class tc03x003aClass1 { + + static boolean loadThis = false; // checkLastLine1 + + tc03x003aClass1() { // checkLastLine2 + tc03x003a.log.display("tc03x003aClass1::constructor is called"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001.java new file mode 100644 index 00000000000..4297b956a52 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001.java @@ -0,0 +1,238 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc04x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc04x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_LOAD = "load"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc04x001"; + private final static String debugeeName = debuggerName + "a"; + private final static String exceptionName = debugeeName + "Exception"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private final static int expectedEventCount = 1; + private static int eventCount = 0; + + private EventRequestManager evm = null; + private ExceptionRequest exReq = null; + private volatile boolean exit = false; + + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + tc04x001 thisTest = new tc04x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + IOPipe pipe = debugee.createIOPipe(); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest crq = evm.createClassPrepareRequest(); + crq.addClassFilter(exceptionName); + crq.enable(); + + // separate thread to handle event + Thread eventHandler = new Thread() { + public void run() { + EventQueue eventQueue = debugee.VM().eventQueue(); + while (!exit) { + EventSet eventSet = null; + try { + eventSet = eventQueue.remove(1000); + } catch (InterruptedException e) { + new Failure("Event handling thread interrupted:\n\t" + e); + } + if (eventSet == null) { + continue; + } + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + if (event instanceof ClassPrepareEvent) { + display(" event ===>>> " + event); + exReq = evm.createExceptionRequest( + ((ClassPrepareEvent )event).referenceType(), + true, false); + exReq.enable(); + debugee.resume(); + + } else if (event instanceof ExceptionEvent) { + display(" event ===>>> " + event); + hitEvent((ExceptionEvent )event); + exReq.disable(); + debugee.resume(); + exit = true; + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } else { + throw new Failure("Unexpected event received:\n\t" + event); + } // if + } // while + } // while + } // run() + }; // eventHandler + + display("Starting handling event"); + eventHandler.start(); + + debugee.resume(); + debugee.receiveExpectedSignal(SGL_READY); + + display("\nTEST BEGINS"); + display("==========="); + debugee.sendSignal(SGL_LOAD); + + display("Waiting for all events received"); + try { + eventHandler.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Main thread interrupted while waiting for eventHandler:\n\t" + + e); + } finally { + crq.disable(); + exReq.disable(); + exit = true; + if (eventHandler.isAlive()) { + display("Interrupting event handling thread"); + eventHandler.interrupt(); + } + } + + if (eventCount < expectedEventCount) { + complain("expecting " + expectedEventCount + + " breakpoint events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + debugee.sendSignal(SGL_QUIT); + } + + private void hitEvent(ExceptionEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (event.location().lineNumber() == tc04x001a.checkExBrkpLine) { + display("ExceptionEvent occurs on the expected line " + + event.location().lineNumber() + " in method " + + event.location().method().name()); + } else { + complain("ExceptionEvent occurs on line " + event.location().lineNumber() + + " in method " + event.location().method().name() + + ", expected line number is " + + tc04x001a.checkExBrkpLine); + exitStatus = Consts.TEST_FAILED; + } + + eventCount++; + display(""); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001/TestDescription.java new file mode 100644 index 00000000000..7aafe7a7560 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001/TestDescription.java @@ -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/BScenarios/singlethrd/tc04x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC3 + * Description: Exception breakpoint + * Steps: 1.Set caught exception breakpoint on class + * javax.sound.midi.MidiUnavailableException + * 2.Debug Main + * X. Stops on line 42 in Main.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates ExceptionRequest. + * After ExceptionEvent arrived, debugger checks line number of one's + * location. It should be 74th line, that is throwing tc03x001aException. + * Every thread must generate ExceptionEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests + * - launching debuggee by prepareDebugee() replaced with bindToDebugee() + * to exclude first IOPipe communication + * - making ClassPrepareRequest moved to begin (right after debuggee started) + * - making ExceptionRequest moved to handling ClassPrepareEvent + * - handling events moved to a separate thread + * - removed extra IOPipe communication points to make algorithm more clear + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc04x001 + * nsk.jdi.BScenarios.singlethrd.tc04x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc04x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001a.java new file mode 100644 index 00000000000..5f0ba801666 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001a.java @@ -0,0 +1,77 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc04x001a is deugee's part of the tc02x001. + */ +public class tc04x001a { + + public final static int checkExBrkpLine = 69; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc04x001.SGL_READY); + + tc04x001a obj = null; + String instr; + do { + instr = pipe.readln(); + log.display("instruction \"" + instr +"\""); + if (instr.equals(tc04x001.SGL_LOAD)) { + tc04x001aException.loadThis = true; + performTest(); + } else if (instr.equals(tc04x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest:: throwing tc04x001aException"); + try { + throw new tc04x001aException(); // checkExBrkpLine + } catch (tc04x001aException e) { + } + } +} + +class tc04x001aException extends RuntimeException { + static boolean loadThis = false; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001.java new file mode 100644 index 00000000000..8a71e950723 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001.java @@ -0,0 +1,230 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test is from the group of so-called Borland's scenarios and + * implements the following test case:
    + * Suite 2 - Breakpoints (multiple threads)
    + * Test case: TC2
    + * Description: Class breakpoint
    + * Steps: 1.Add class breakpoint: singlethread.Class1
    + * 2.Debug Main
    + * X. Stops on line 13 in Class1.java
    + * + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc05x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + */ + +public class tc05x001 { + + public final static String SGL_READY = "ready"; + public final static String SGL_PERFORM = "perform"; + public final static String SGL_QUIT = "quit"; + + private final static String prefix = "nsk.jdi.BScenarios.singlethrd."; + private final static String debuggerName = prefix + "tc05x001"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debugeeName + "Class1"; + private final static String methodName = "bar"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private final static int expectedEventCount = 1; + private static int eventCount = 0; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + tc05x001 thisTest = new tc05x001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Throwable e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + debugeeClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventRequestManager evm = debugee.getEventRequestManager(); + MethodEntryRequest mthdReq = null; + + mthdReq = evm.createMethodEntryRequest(); + mthdReq.addClassFilter(testedClassName); + mthdReq.enable(); + + debugee.resume(); + debugee.sendSignal(SGL_PERFORM); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display(" event ===>>> " + event); + + if (event instanceof MethodEntryEvent) { + display(" event ===>>> " + event); + hitMethodBreakpoint((MethodEntryEvent )event); + if (eventCount > 0) { + exit = true; + evm.deleteEventRequest(mthdReq); + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0 && !exit) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount < expectedEventCount) { + complain("expecting " + expectedEventCount + + " breakpoint events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitMethodBreakpoint(MethodEntryEvent event) { + ThreadReference thrd = event.thread(); + + display("event info:"); + display("\tthread\t- " + event.thread().name()); + try { + display("\tsource\t- " + event.location().sourceName()); + } catch (AbsentInformationException e) { + } + display("\tmethod\t- " + event.location().method().name()); + display("\tline\t- " + event.location().lineNumber()); + + if (!event.method().name().equals(methodName)) { + display("the event skipped, method - " + event.method().name()); + } else { + if (event.location().lineNumber() == tc05x001a.checkLastLine) { + display("MethodBreakpoint stops on the expected line " + + event.location().lineNumber() + " in method " + + event.method().name()); + } else { + complain("MethodBreakpoint stops on line " + event.location().lineNumber() + + " in method " + event.method().name() + + ", expected line number is " + + tc05x001a.checkLastLine); + exitStatus = Consts.TEST_FAILED; + } + eventCount++; + } + display(""); + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001/TestDescription.java new file mode 100644 index 00000000000..d3eec2e4013 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001/TestDescription.java @@ -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/BScenarios/singlethrd/tc05x001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * This test is from the group of so-called Borland's scenarios and + * implements the following test case: + * Suite 2 - Breakpoints (multiple threads) + * Test case: TC2 + * Description: Class breakpoint + * Steps: 1.Add class breakpoint: singlethread.Class1 + * 2.Debug Main + * X. Stops on line 13 in Class1.java + * The description was drown up according to steps under JBuilder. + * Of course, the test has own line numbers and method/class names and + * works as follow: + * When the test is starting debugee, debugger creates MethodEntryRequest. + * After MethodEntryEvent arrived, debugger checks line number of one's + * location. It should be 73th line, that is constructor of tc02x001aClass1 + * class. Every thread must generate MethodEntryEvent. + * In case, when at least one event doesn't arrive during waittime + * interval or line number of event is wrong, test fails. + * COMMENTS: + * There are a doublness of the "class breakpoint" understanding. + * Here is that JBuilder help says: + * 1. "A class breakpoint causes the debugger to stop when any method + * from the specified class is called or when the specified class + * is instantiated." + * So, a class breakpoint is MethodEntryRequest with filtering + * the specified class. + * 2. "A class breakpoint causes the debugger to stop at the location + * when the specified class is loaded or when any method from the + * specified class is called." + * In this case, a class breakpoint is MethodEntryRequest and + * ClassPrepareRequest with filtering the specified class. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BScenarios.singlethrd.tc05x001 + * nsk.jdi.BScenarios.singlethrd.tc05x001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BScenarios.singlethrd.tc05x001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001a.java new file mode 100644 index 00000000000..534618176a5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001a.java @@ -0,0 +1,85 @@ +/* + * 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.BScenarios.singlethrd; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * tc05x001a is deugee's part of the tc02x001. + */ +public class tc05x001a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 1; + + public final static int checkLastLine = 82; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(tc05x001.SGL_READY); + + tc05x001a obj = null; + String instr; + do { + instr = pipe.readln(); + if (instr.equals(tc05x001.SGL_PERFORM)) { + performTest(); + } else if (instr.equals(tc05x001.SGL_QUIT)) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + public static void performTest() { + log.display("performTest::creating tc05x001aClass1 object"); + tc05x001aClass1 obj = new tc05x001aClass1(); + log.display("performTest::invoking tc05x001aClass1.bar()"); + obj.bar(); + } +} + +class tc05x001aClass1 { + + tc05x001aClass1() { + tc05x001a.log.display("tc05x001aClass1::constructor is called"); + } + + public void bar() { + tc05x001a.log.display("tc05x001aClass1.bar::" // checkLastLine + + "method breakpoint should stop here"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001.java new file mode 100644 index 00000000000..abf880997ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001.java @@ -0,0 +1,200 @@ +/* + * 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.BooleanArgument.booleanValue; + +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; +import com.sun.jdi.connect.LaunchingConnector; + + +/** + * The test for the implementation of an object of the type
    + * Connector.BooleanArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.BooleanValue()
    + * complies with its specification in the following cases: + * - a value of the argument is set as a string and read as a boolean;
    + * - a value of the argument is set as a boolean and read as a string.
    + *
    + * In case of the method booleanValue() returns a wrong value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class booleanvalue001 { + + 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.BooleanArgument.booleanValue\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.booleanValue\n" ; + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connecter with needed Argument found\n"); + return exitCode0; + } + } + + + argument.setValue(true); + argument.setValue("true"); + if (!argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'true' -> true = true \n" + + "result: booleanValue() != true \n"); + } + + argument.setValue(true); + argument.setValue("false"); + if (argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'false' -> true = false \n" + + "result: booleanValue() != false \n"); + } + + argument.setValue(false); + argument.setValue("true"); + if (!argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'true' -> false = true \n" + + "result: booleanValue() != true \n"); + } + + argument.setValue(false); + argument.setValue("false"); + if (argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'false' -> false = false \n" + + "result: booleanValue() != false \n"); + } + + argument.setValue("true"); + argument.setValue(true); + if (!argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: true -> 'true' = true \n" + + "result: booleanValue() != true \n"); + } + + argument.setValue("true"); + argument.setValue(false); + if (argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: false -> 'true' = false \n" + + "result: booleanValue() != false \n"); + } + + argument.setValue("false"); + argument.setValue(true); + if (!argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: true -> 'false' = true \n" + + "result: booleanValue() != true \n"); + } + + argument.setValue("false"); + argument.setValue(false); + if (argument.booleanValue()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: false -> 'false' = false \n" + + "result: booleanValue() != false \n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001/TestDescription.java new file mode 100644 index 00000000000..26ca8dbfc88 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/BooleanArgument/booleanValue/booleanvalue001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.BooleanArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.BooleanArgument.booleanValue() + * complies with its specification. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.BooleanArgument object is searched among + * 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: + * setValue(true); setValue("true"); + * IF !argument.booleanValue(); + * THEN an error detected + * ELSE the check passed + * setValue(true); setValue("false"); + * IF argument.booleanValue(); + * THEN an error detected + * ELSE the check passed + * setValue(false); setValue("true"); + * IF !argument.booleanValue(); + * THEN an error detected + * ELSE the check passed + * setValue(false); setValue("false"); + * IF argument.booleanValue(); + * THEN an error detected + * ELSE the check passed + * setValue("true"); setValue(true); + * IF !argument.booleanValue() + * THEN an error detected + * ELSE the check passed + * setValue("true"); setValue(false); + * IF argument.booleanValue() + * THEN an error detected + * ELSE the check passed + * setValue("false"); setValue(true); + * IF !argument.booleanValue() + * THEN an error detected + * ELSE the check passed + * setValue("false"); setValue(false); + * IF argument.booleanValue() + * 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.BooleanArgument.booleanValue.booleanvalue001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.booleanValue.booleanvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002.java new file mode 100644 index 00000000000..e74db7c1390 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002.java @@ -0,0 +1,211 @@ +/* + * 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.BooleanArgument.booleanValue; + +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; +import com.sun.jdi.connect.LaunchingConnector; + + +/** + * The test for the implementation of an object of the type
    + * Connector.BooleanArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.BooleanValue()
    + * complies with its specification in the following cases:
    +
    +
    + *
    + * In case of the method booleanValue() returns a wrong value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class booleanvalue002 { + + 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.BooleanArgument.booleanValue\n" ; +// + String sErr2 = "INFO:\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.booleanValue\n" ; + + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connecter with needed BooleanArgument found\n"); + return exitCode0; + } + } + + boolean b; + + argument.setValue(true); + argument.setValue(""); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: '' -> true = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue(true); + argument.setValue("tru"); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'tru' -> true = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue(false); + argument.setValue(""); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: '' -> false = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue(false); + argument.setValue("fals"); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: '' -> false = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue("true"); + argument.setValue(""); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: '' -> 'true' = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue("true"); + argument.setValue("tru"); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'tru' -> 'true' = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue("false"); + argument.setValue(""); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: '' -> 'false' = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + argument.setValue("false"); + argument.setValue("fals"); + b = argument.booleanValue(); + if (b) { + exitCode = exitCode2; + out.println(sErr2 + + "check: 'fals' -> 'false' = ? \n" + + "result: booleanValue() == " + b + "\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002/TestDescription.java new file mode 100644 index 00000000000..15dce51fdb6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/BooleanArgument/booleanValue/booleanvalue002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.BooleanArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.BooleanArgument.booleanValue() + * complies with its specification. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.BooleanArgument object is searched among + * Connectors. + * If no the argument is found out the test exits + * with the return value = 95 and a warning message. + * - After the following assignments: + * 1) argument.setValue(true); + * argument.setValue("tru"); + * 2) argument.setValue(true); + * argument.setValue(""); + * 3) argument.setValue(false); + * argument.setValue(""); + * 4) argument.setValue(false); + * argument.setValue("fals"); + * 5) argument.setValue("true"); + * argument.setValue("tru"); + * 6) argument.setValue("true"); + * argument.setValue(""); + * 7) argument.setValue("false"); + * argument.setValue(""); + * 8) argument.setValue("false"); + * argument.setValue("fals"); + * the check is performed: + * IF argument.booleanValue(); + * 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.BooleanArgument.booleanValue.booleanvalue002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.booleanValue.booleanvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001.java new file mode 100644 index 00000000000..b2bae31a334 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001.java @@ -0,0 +1,155 @@ +/* + * 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.BooleanArgument.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.LaunchingConnector; + + +/** + * The test for the implementation of an object of the type
    + * Connector.BooleanArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.isValid()
    + * complies with its specification, that is, returns
    + * true for the String values "true" and "false", and
    + * false for another String value which, however, is not null, and
    + * for the empty string.
    + *
    + * In case of a wrong boolean value returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.BooleanArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.isValue()\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connecter with needed Argument 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()\n" + + "error: returned value == true\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001/TestDescription.java new file mode 100644 index 00000000000..9d224ea009f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001/TestDescription.java @@ -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/BooleanArgument/isValid/isvalid001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.BooleanArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.BooleanArgument.isValid() + * complies with its specification, that is, returns + * true for the String values "true" and "false", and + * false for another String value which, however, is not null, and + * for the empty string. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.BooleanArgument object is searched among + * 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.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.BooleanArgument.isValid.isvalid001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.isValid.isvalid001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002.java new file mode 100644 index 00000000000..0b0f883aba4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002.java @@ -0,0 +1,130 @@ +/* + * 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.BooleanArgument.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.LaunchingConnector; + + +/** + * The test for the implementation of an object of the type
    + * Connector.BooleanArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.isValid()
    + * complies with its specification when its parameter is null-string.
    + *
    + * The case for testing includes throwing NullPointerException as
    + * correct reaction to the null-parameter.
    + */ + + +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.BooleanArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connecter with BooleanArgument found\n"); + return exitCode0; + } + } + + try { + argument.isValid(null); + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(null)\n" + + "error: no NullPointerException thrown \n"); + } catch (NullPointerException e) { + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002/TestDescription.java new file mode 100644 index 00000000000..e2012bb7be2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/BooleanArgument/isValid/isvalid002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.BooleanArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.BooleanArgument.isValid() + * complies with its specification when its parameter is null-string. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.BooleanArgument object is searched among + * Connectors. + * If no the argument is found out the test exits + * with the return value = 95 and a warning message. + * - The following check is applied: + * IF argument.isValid(null) + * 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.BooleanArgument.isValid.isvalid002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.isValid.isvalid002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001.java new file mode 100644 index 00000000000..4850009bc09 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001.java @@ -0,0 +1,186 @@ +/* + * 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.BooleanArgument.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.Connector.BooleanArgument; + + +/** + * The test for the implementation of a BooleanArgument object.
    + * + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.setValue()
    + * complies with specification.
    + * The test works as follows: + *
    + * - Virtual Machine Manager is invoked. + * - First BooleanArgument is searched among Connectors.
    + * If no a BooleanArgument is found out the test exits with
    + * the return value = 95 and a warning message.
    + * - Under the assumption that the method
    + * BooleanArgument.booleanValue() works correctly,
    + * to the value of the BooleanArgument founded,
    + * which may not have been set or may have an invalid value,
    + * the sequence of 5 following checks is applied:
    + *
    + * 1) setValue(true); booleanValue() must return true;
    + * 2) setValue(false); booleanValue() must return false;
    + * 3) setValue(false); booleanValue() must return false;
    + * 4) setValue(true); booleanValue() must return true;
    + * 5) setValue(true); booleanValue() must return true;
    + *
    + * In case of any check results in a wrong value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.BooleanArgument.setValue\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.setValue\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connecter with BooleanArgument found\n"); + return exitCode0; + } + } + + // 1) initial -> true + argument.setValue(true); + if (argument.booleanValue() != true) { + exitCode = 2; + out.println(sErr2 + + "case: unknown -> true\n" + + "error: a returned value != true"); + } + + // 2) true -> false + argument.setValue(false); + if (argument.booleanValue() != false) { + exitCode = 2; + out.println(sErr2 + + "case: true -> false\n" + + "error: a returned value != false\n"); + } + + // 3) false -> false + argument.setValue(false); + if (argument.booleanValue() != false) { + exitCode = 2; + out.println(sErr2 + + "case: false -> false\n" + + "error: a returned value != false"); + } + + // 4) false -> true + argument.setValue(true); + if (argument.booleanValue() != true) { + exitCode = 2; + out.println(sErr2 + + "case: false -> true\n" + + "error: a returned value != true\n"); + } + + // 5) true -> true + argument.setValue(true); + if (argument.booleanValue() != true) { + exitCode = 2; + out.println(sErr2 + + "case: true -> true\n" + + "error: a returned value != true\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001/TestDescription.java new file mode 100644 index 00000000000..99a3d642157 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001/TestDescription.java @@ -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/BooleanArgument/setValue/setvalue001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of a BooleanArgument object. + * The test checks up that results of the method + * com.sun.jdi.connect.Connector.BooleanArgument.setValue() + * complies with specification. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First BooleanArgument is searched among Connectors. + * If no a BooleanArgument is found out the test exits with + * the return value = 95 and a warning message. + * - Under assumption that method booleanValue() works correctly (!!), + * to the value of the BooleanArgument founded, + * which may not have been set or may have an invalid value, + * the sequence of 5 following checks is applied: + * 1) setValue(true); booleanValue() must return true + * 2) setValue(false); booleanValue() must return false + * 3) setValue(false); booleanValue() must return false + * 4) setValue(true); booleanValue() must return true + * 5) setValue(true); booleanValue() must return true + * In case of any check results in a wrong value, + * the test produces the return value 97 and + * a corresponding error message. + * 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.BooleanArgument.setValue.setvalue001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.setValue.setvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002.java new file mode 100644 index 00000000000..f1bd14421e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002.java @@ -0,0 +1,146 @@ +/* + * 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.BooleanArgument.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.Connector.BooleanArgument; + + +/** + * The second test for the implementation of a BooleanArgument object.
    + * + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.setValue()
    + * complies with specification.
    + * The test works as follows:
    + *
    + * - Virtual Machine Manager is invoked.
    + * - First BooleanArgument is searched among Connectors.
    + * If no BooleanArgument is found out the test exits with
    + * the return value = 95 and a warning message.
    + * - Under the assumption that the method
    + * BooleanArgument.booleanValue() works correctly (!!),
    + * to the value of the BooleanArgument founded,
    + * which may not have been set or may have an invalid value,
    + * the following check is applied:
    + *
    + * setValue(true); booleanValue() must return true;
    + *
    + * In case of the check results in a wrong value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.BooleanArgument.setValue\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.setValue\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with BooleanArgument found\n"); + return exitCode0; + } + } + + // initial -> false + argument.setValue(false); + if (argument.booleanValue() != false) { + exitCode = 2; + out.println(sErr2 + + "case: initial -> false\n" + + "error: a returned value != false"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002/TestDescription.java new file mode 100644 index 00000000000..960ac3f5917 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/BooleanArgument/setValue/setvalue002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The second test for the implementation of + * a BooleanArgument object. + * The test checks up that results of the method + * com.sun.jdi.connect.Connector.BooleanArgument.setValue() + * complies with specification. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First BooleanArgument is searched among Connectors. + * If no a BooleanArgument is found out the test exits with + * the return value = 95 and a warning message. + * - Under assumption that method booleanValue() works correctly (!!), + * to the value of the BooleanArgument founded, + * which may not have been set or may have an invalid value, + * the check is applied: + * setValue(false); booleanValue() must return false + * In case of the check results in a wrong value, + * the test produces the return value 97 and + * a corresponding error message. + * 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.BooleanArgument.setValue.setvalue002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.setValue.setvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001.java new file mode 100644 index 00000000000..853b677db1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001.java @@ -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.BooleanArgument.stringValueOf; + +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
    + * Connector.BooleanArgument.
    + *
    + * The test checks up that results of the method
    + * Connector.BooleanArgument.stringValueOf(boolean value)
    + * in the package com.sun.jdi.connect
    + * complies with the following statement in its specification:
    + * "Return the string representation of the value parameter."
    + *
    + * In case of the check results in a wrong value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class stringvalueof001 { + 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.BooleanArgument.stringValueOf\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.stringValueof\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with BooleanArgument found\n"); + return exitCode0; + } + } + + String sTrue = argument.stringValueOf(true); + String sFalse = argument.stringValueOf(false); + + if (sTrue.equalsIgnoreCase(sFalse)) { + exitCode = 2; + out.println(sErr2 + + "check: stringValueOf(true) != stringValueOf(false)\n" + + "error: strings are equal\n"); + } + + if (sTrue == null) { + exitCode = 2; + out.println(sErr2 + + "check: stringValueOf(true) = 'true'\n" + + "error: a returned value = null\n"); + } + + if (sFalse == null) { + exitCode = 2; + out.println(sErr2 + + "check: stringValueOf(false) = 'false'\n" + + "error: a returned value = null\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001/TestDescription.java new file mode 100644 index 00000000000..3f48a3b7ad8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001/TestDescription.java @@ -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/BooleanArgument/stringValueOf/stringvalueof001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.BooleanArgument. + * The test checks up that results of the method + * Connector.BooleanArgument.stringValueOf(boolean value) + * of the interface com.sun.jdi.connect + * complies with the following statement in its specification: + * "Return the string representation of the value parameter." + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector's argument of the type Connector.BooleanArgument + * is searched among Connectors. + * If no the argument is found out the test exits + * with the return value = 95 and a warning message. + * - Two String objects are assigned the following values: + * sTrue = argument.stringValueOf(true); + * sFalse = argument.stringValueOf(false); + * - Then the following checks are applied: + * IF sTrue.equalsIgnoreCase(sFalse) + * THEN an error detected + * ELSE the check passed + * IF sTrue == null + * THEN an error detected + * ELSE the check passed + * IF sFalse == null + * THEN an error detected + * ELSE the check passed + * In case of an error the test produces the return value 97 and + * a corresponding error message. + * 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.BooleanArgument.stringValueOf.stringvalueof001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.stringValueOf.stringvalueof001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002.java new file mode 100644 index 00000000000..8ff262ea8ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002.java @@ -0,0 +1,167 @@ +/* + * 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.BooleanArgument.stringValueOf; + +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
    + * Connector.BooleanArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.BooleanArgument.stringValueOf()
    + * complies with the following statement in its specification:
    + * "Does not set the value of the argument."
    + *
    + * In case of the method does set the value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class stringvalueof002 { + + 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.BooleanArgument.stringValueOf\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.BooleanArgument.stringValueOf\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.BooleanArgument 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.BooleanArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with BooleanArgument found\n"); + return exitCode0; + } + } + + String argumentValue; + // 1) + argument.setValue(true); + argumentValue = argument.stringValueOf(true); + if (argument.booleanValue() != true) { + exitCode = 2; + out.println(sErr2 + + "case: stringValueOf(true) doesn't change value true\n" + + "error: argument's value != true\n"); + } + + // 2) + argument.setValue(true); + argumentValue = argument.stringValueOf(false); + if (argument.booleanValue() != true) { + exitCode = 2; + out.println(sErr2 + + "case: stringValueOf(false) doesn't change value true\n" + + "error: argument's value != true\n"); + } + + // 3) + argument.setValue(false); + argumentValue = argument.stringValueOf(true); + if (argument.booleanValue() != false) { + exitCode = 2; + out.println(sErr2 + + "case: stringValueOf(true) doesn't change value false\n" + + "error: a returned value != false\n"); + } + + // 4) + argument.setValue(false); + argumentValue = argument.stringValueOf(false); + if (argument.booleanValue() != false) { + exitCode = 2; + out.println(sErr2 + + "case: stringValueOf(false) doesn't change value false\n" + + "error: a returned value != false\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002/TestDescription.java new file mode 100644 index 00000000000..db7baac54b3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/BooleanArgument/stringValueOf/stringvalueof002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.BooleanArgument. + * The test checks up that results of the method + * com.sun.jdi.connect. + * Connector.BooleanArgument.stringValueOf(int value) + * complies with the following statement in its specification: + * "Does not set the value of the argument." + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector's argument of the type Connector.BooleanArgument + * is searched among 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: + * 1) + * argument.setValue(true); + * argument.stringValueOf(true); + * IF (argument.booleanValue() != true) + * THEN an error detected + * ELSE the check passed + * 2) + * argument.setValue(true); + * argument.stringValueOf(false); + * IF (argument.booleanValue() != true) + * THEN an error detected + * ELSE the check passed + * 3) + * argument.setValue(false); + * argument.stringValueOf(false); + * IF (argument.booleanValue() != false) + * THEN an error detected + * ELSE the check passed + * 4) + * argument.setValue(false); + * argument.stringValueOf(true); + * IF (argument.booleanValue() != false) + * THEN an error detected + * ELSE the check passed + * In case of any 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.BooleanArgument.stringValueOf.stringvalueof002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanArgument.stringValueOf.stringvalueof002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001.java new file mode 100644 index 00000000000..9bedcc54989 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001.java @@ -0,0 +1,455 @@ +/* + * 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.BooleanType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BooleanType.
    + *
    + * The test checks that for a mirror of a boolean value the casts
    + * from Type to BooleanType and from PrimitiveType to BooleanType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a boolean field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class booleantype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BooleanType/_itself_/booleantype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new booleantype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BooleanType._itself_.booleantype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'bl';"); + String name = "bl"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + BooleanType booleanType = null; + try { + log2(" checking up on cast: BooleanType booleanType = (BooleanType) type;"); + booleanType = (BooleanType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: BooleanType booleanType = (BooleanType) primitiveType;"); + booleanType = (BooleanType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001/TestDescription.java new file mode 100644 index 00000000000..2101fb0aa85 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001/TestDescription.java @@ -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/BooleanType/_itself_/booleantype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BooleanType. + * The test checks that for a mirror of boolean value the casts + * from Type to BooleanType and from PrimitiveType to BooleanType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.BooleanType._itself_.booleantype001; + * the debuggee program - nsk.jdi.BooleanType._itself_.booleantype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.BooleanType._itself_.booleantype001 + * nsk.jdi.BooleanType._itself_.booleantype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanType._itself_.booleantype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001a.java new file mode 100644 index 00000000000..cd2e2fb681e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanType/_itself_/booleantype001a.java @@ -0,0 +1,113 @@ +/* + * 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.BooleanType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the booleantype001 JDI test. + */ + +public class booleantype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static boolean bl = false; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001.java new file mode 100644 index 00000000000..75f31d07082 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001.java @@ -0,0 +1,265 @@ +/* + * 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.BooleanValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BooleanValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.BooleanValue.equals()
    + * complies with its spec.
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static boolean bTrue1 = true;
    + * public static boolean bTrue2 = true;
    + * public static boolean bFalse1 = false;
    + * public static boolean bFalse2 = false;
    + *
    + * which a debugger mirros as :
    + *
    + * BooleanValue bvTrue1;
    + * BooleanValue bvTrue2;
    + * BooleanValue bvFalse1;
    + * BooleanValue bvFalse2;
    + *
    + * the following is true:
    + *
    + * bvTrue1.equals(bvTrue2)
    + * !bvTrue1.equals(bvFalse1)
    + * bvFalse1.equals(bvFalse2)
    + * !bvFalse1.equals(bvTrue1)
    + *
    + * !bvTrue1.equals(IntegerValue i0)
    + * !bvFalse1.equals(IntegerValue i1)
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BooleanValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BooleanValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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(debuggeeName + " -vbs"); // *** tp + } else { + debugee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("equals001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fTrue1 = execClass.fieldByName("bTrue1"); + Field fTrue2 = execClass.fieldByName("bTrue2"); + Field fFalse1 = execClass.fieldByName("bFalse1"); + Field fFalse2 = execClass.fieldByName("bFalse2"); + + BooleanValue bvTrue1 = (BooleanValue) execClass.getValue(fTrue1); + BooleanValue bvTrue2 = (BooleanValue) execClass.getValue(fTrue2); + BooleanValue bvFalse1 = (BooleanValue) execClass.getValue(fFalse1); + BooleanValue bvFalse2 = (BooleanValue) execClass.getValue(fFalse2); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!bvTrue1.equals(bvTrue2)) + expresult = 1; + break; + + case 1: if (bvTrue1.equals(bvFalse1)) + expresult = 1; + break; + + case 2: if (!bvFalse1.equals(bvFalse2)) + expresult = 1; + break; + + case 3: if (bvFalse1.equals(bvTrue1)) + expresult = 1; + break; + + case 4: IntegerValue i0 = vm.mirrorOf(0); + if (bvTrue1.equals(i0)) + expresult = 1; + break; + + case 5: IntegerValue i1 = vm.mirrorOf(1); + if (bvFalse1.equals(i1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != 1; check # = " + i2); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..e8bb10d5aa9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/BooleanValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BooleanValue. + * The test checks up that a result of the method + * com.sun.jdi.BooleanValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this BooleanValue + * for equality. + * Returns: + * true if the Object is a BooleanValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.BooleanValue.equals.equals001; + * a debuggee program - nsk.jdi.BooleanValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.BooleanValue.equals.equals001 + * nsk.jdi.BooleanValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001a.java new file mode 100644 index 00000000000..807d6ab82b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals001a.java @@ -0,0 +1,119 @@ +/* + * 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.BooleanValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static boolean bTrue1 = true; + public static boolean bTrue2 = true; + public static boolean bFalse1 = false; + public static boolean bFalse2 = false; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.BooleanValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + BooleanValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof BooleanValue) ) { + msg += " is not BooleanValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (BooleanValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(BooleanValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof BooleanValue ) { + if ( value.value() == ((PrimitiveValue )object).booleanValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof BooleanValue ) { + if ( value.value() != ((PrimitiveValue )object).booleanValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..25d22e5df5c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals002/TestDescription.java @@ -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/BooleanValue/equals/equals002. + * 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.BooleanValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this BooleanValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a BooleanValue and if applying "==" to the + * two mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.BooleanValue.equals.equals002 + * nsk.jdi.BooleanValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals002a.java new file mode 100644 index 00000000000..a579ac6aa81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/equals/equals002a.java @@ -0,0 +1,102 @@ +/* + * 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.BooleanValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloatMIN", + "cmpIntMAX", + "cmpIntMIN", + "cmpLongMAX", + "cmpLongMIN", + "cmpShortMAX", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public boolean boolTRUE = true; + public boolean boolFALSE = false; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..380c40a30c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001.java @@ -0,0 +1,257 @@ +/* + * 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.BooleanValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BooleanValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.BooleanValue.hashCode()
    + * complies with its spec.
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static boolean bTrue1 = true;
    + * public static boolean bTrue2 = true;
    + * public static boolean bFalse1 = false;
    + * public static boolean bFalse2 = false;
    + *
    + * which a debugger mirros as :
    + *
    + * BooleanValue bvTrue1;
    + * BooleanValue bvTrue2;
    + * BooleanValue bvFalse1;
    + * BooleanValue bvFalse2;
    + *
    + * the following is true:
    + *
    + * bvTrue1.hashCode() == bvTrue1.hashCode()
    + * bvFalse1.hashCode() == bvFalse1.hashCode()
    + * bvTrue1.hashCode() == bvTrue2.hashCode()
    + * bvFalse1.hashCode() == bvFalse2.hashCode()
    + * bvTrue1.hashCode() != bvFalse1.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BooleanValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BooleanValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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(debuggeeName + " -vbs"); // *** tp + } else { + debugee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("hashcode001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fTrue1 = execClass.fieldByName("bTrue1"); + Field fTrue2 = execClass.fieldByName("bTrue2"); + Field fFalse1 = execClass.fieldByName("bFalse1"); + Field fFalse2 = execClass.fieldByName("bFalse2"); + + BooleanValue bvTrue1 = (BooleanValue) execClass.getValue(fTrue1); + BooleanValue bvTrue2 = (BooleanValue) execClass.getValue(fTrue2); + BooleanValue bvFalse1 = (BooleanValue) execClass.getValue(fFalse1); + BooleanValue bvFalse2 = (BooleanValue) execClass.getValue(fFalse2); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (bvTrue1.hashCode() != bvTrue1.hashCode()) + expresult = 1; + break; + + case 1: if (bvFalse1.hashCode() != bvFalse1.hashCode()) + expresult = 1; + break; + + case 2: if (bvTrue1.hashCode() != bvTrue2.hashCode()) + expresult = 1; + break; + + case 3: if (bvFalse1.hashCode() != bvFalse2.hashCode()) + expresult = 1; + break; + + case 4: if (bvTrue1.hashCode() == bvFalse1.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != 1; check # = " + i2); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..e7af7f96e69 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001/TestDescription.java @@ -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/BooleanValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BooleanValue. + * The test checks up that a result of the method + * com.sun.jdi.BooleanValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this BooleanValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.BooleanValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.BooleanValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.BooleanValue.hashCode.hashcode001 + * nsk.jdi.BooleanValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..bf126736629 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/hashCode/hashcode001a.java @@ -0,0 +1,119 @@ +/* + * 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.BooleanValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static boolean bTrue1 = true; + public static boolean bTrue2 = true; + public static boolean bFalse1 = false; + public static boolean bFalse2 = false; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * BooleanValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.BooleanValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static boolean bTrue1 = true;
    + * public static boolean bFalse1 = false;
    + *
    + * which a debugger mirros as :
    + *
    + * BooleanValue bvTrue1;
    + * BooleanValue bvFalse1;
    + *
    + * the following is true:
    + *
    + * BooleanValue bvTrue.value() == true
    + * BooleanValue bvFalse.value() == false
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BooleanValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BooleanValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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(debuggeeName + " -vbs"); // *** tp + } else { + debugee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("value001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fTrue1 = execClass.fieldByName("bTrue1"); +// Field fTrue2 = execClass.fieldByName("bTrue2"); + Field fFalse1 = execClass.fieldByName("bFalse1"); +// Field fFalse2 = execClass.fieldByName("bFalse2"); + + BooleanValue bvTrue1 = (BooleanValue) execClass.getValue(fTrue1); +// BooleanValue bvTrue2 = (BooleanValue) execClass.getValue(fTrue2); + BooleanValue bvFalse1 = (BooleanValue) execClass.getValue(fFalse1); +// BooleanValue bvFalse2 = (BooleanValue) execClass.getValue(fFalse2); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (bvTrue1.value() != true) + expresult = 1; + break; + + case 1: if (bvFalse1.value() != false) + expresult = 1; + break; + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != 1; check # = " + i2); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..8c2f27c68b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001/TestDescription.java @@ -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/BooleanValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BooleanValue. + * The test checks up that a result of the method + * com.sun.jdi.BooleanValue.value() + * complies with its spec: + * public boolean value() + * Returns this BooleanValue as a boolean. + * Returns: the boolean mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.BooleanValue.value.value001; + * a debuggee program - nsk.jdi.BooleanValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.BooleanValue.value.value001 + * nsk.jdi.BooleanValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BooleanValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001a.java new file mode 100644 index 00000000000..e23791558af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001a.java @@ -0,0 +1,122 @@ +/* + * 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.BooleanValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + + //................................................... globals for a debugger + + public static boolean bTrue1 = true; + public static boolean bTrue2 = true; + public static boolean bFalse1 = false; + public static boolean bFalse2 = false; + + //.................................................... + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + debuggee.resume(); + + try { + + // waiting for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // find checked location and create StepEventrequest + EventRequestManager eventRManager = vm.eventRequestManager(); + + log.display("Getting loaded class in debuggee"); + List classes = vm.classesByName(DEBUGGEE_NAME); + checkedClass = (ReferenceType) classes.get(0); + + log.display("Getting reference to main thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + log.display("Getting reference to method "); + List allMethods = checkedClass.methodsByName("foo"); + try { + checkedMethod = (Method) allMethods.get(0); + } catch (IndexOutOfBoundsException e) { + throw new Failure("No method foo() found for the checked class: " + e); + } + + if (checkedMethod == null) { + throw new Failure("Null reference returned for method foo() of the checked class"); + } + + log.display("Getting reference to field "); + checkedField = checkedClass.fieldByName("counter"); + if (checkedField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + log.display("Getting all locations"); + List allLineLocations; + try { + allLineLocations = checkedMethod.allLineLocations(); + } catch ( AbsentInformationException e) { + throw new Failure("TEST BUG: caught AbsentInformationException " + e); + } + + log.display("Getting checked location"); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == breakpoint001a.breakpointLineNumber) { + if (checkedLocation != null) { + throw new Failure("TEST BUG: multiple locations on breakpoint line"); + } else { + checkedLocation = curLocation; + } + } + } + if (checkedLocation == null) { + throw new Failure("TEST BUG: incorrect line number of the location in method"); + } + + log.display("Creating BreakpointRequest for the location"); + if ((checkedRequest = eventRManager.createBreakpointRequest(checkedLocation)) == null) { + throw new Failure("TEST BUG: unable to create BreakpointRequest"); + } + + checkedRequest.addThreadFilter(checkedThread); + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + switch (checkedRequest.suspendPolicy()) { + case EventRequest.SUSPEND_ALL: + log.display("suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display("suspend policy is SUSPEND_EVENT_THREAD"); + break; + case EventRequest.SUSPEND_NONE: + log.display("suspend policy is SUSPEND_NONE"); + break; + default: + log.complain("TEST BUG: Unknown suspend policy!"); + } + + log.display("BreakpointRequest is created for location " + checkedLocation.lineNumber()); + + // define separate thread for handling received events + class EventHandler extends Thread { + public void run() { + // handle events until method invoking completes and all expected events received + while (!methodCompleted || eventsReceived < EXPECTED_EVENTS_COUNT) { + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + log.complain("Unexpected InterruptedException while receiving event: " + e); + break; + } + + if (eventSet == null) { + continue; + } + + // handle each event of the event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + // handle BreakPointEvent + if (event instanceof BreakpointEvent) { + BreakpointEvent castedEvent = (BreakpointEvent) event; + log.display("Received event is BreakpointEvent:\n " + event); + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 2: eventRequest is not equal to checked request"); + testFailed = true; + } else { + eventsReceived++; + log.display("Expected BreakpointEvent received: " + eventsReceived + " times"); + } + + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 4: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + Location eventLocation = castedEvent.location(); + log.display("BreakpointEvent received for location: " + eventLocation.lineNumber()); + + if (!(checkedLocation.equals(eventLocation))) { + log.complain("FAILURE 5: eventLocation is not equal to checked location"); + testFailed = true; + } + + try { + int counterValue = ((IntegerValue)checkedClass.getValue(checkedField)).value(); + log.display("Counter == " + counterValue); + if ( counterValue > oldValue) { + if (!eventThread.isSuspended()) { + log.complain("FAILURE 6: eventThread is not suspended"); + } else { + log.complain("FAILURE 7: BreakpointEvent is generated after code execution"); + + } + testFailed = true; + } + oldValue++; // modify for next event + + } catch (ClassCastException e) { + log.complain("TEST BUG: cannot get value of field"); + testFailed = true; + } + + } + + // ignore each other event + } + + log.display("Resuming event set"); + eventSet.resume(); + } + log.display("eventHandler completed"); + } + } + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + log.display("Enabling breakpoint request"); + checkedRequest.enable(); + + // force debuggee to invoke method and generate BreakpouintEvents + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee finished invoking method + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + methodCompleted = true; + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // Check if all expected BreakpointEvents are received + if (eventsReceived < EXPECTED_EVENTS_COUNT) { + log.display("Too few BreakpointEvents are received: " + eventsReceived); + testFailed = true; + } else if (eventsReceived > EXPECTED_EVENTS_COUNT) { + log.display("Too many BreakpointEvents are received: " + eventsReceived); + testFailed = true; + } else { + log.display("All expected BreakpointEvents are received"); + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + // disable event request to prevent appearance of further events + if (checkedRequest != null && checkedRequest.isEnabled()) { + log.display("Disabling BreakpointEvent request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointEvent/_itself_/breakpoint001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointEvent/_itself_/breakpoint001/TestDescription.java new file mode 100644 index 00000000000..15bc1127b72 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointEvent/_itself_/breakpoint001/TestDescription.java @@ -0,0 +1,93 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/BreakpointEvent/_itself_/breakpoint001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.BreakpointEvent interface. + * The test checks the following assertions: + * - BreakpointEvent is received by debugger for requested + * location if this location is reached by some executing thread + * in debugged VM; + * - received BreakpointEvent has proper references to: + * debugged VM, + * executed thread, + * related BreakpointRequest, + * checked location. + * - BreakpointEvent is generated before the code at its location + * is executed. + * A debugger class - nsk.jdi.BreakpointEvent._itself_.breakpoint001 ; + * a debuggee class - nsk.jdi.BreakpointEvent._itself_.breakpoint001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger launches and connects to debuggee using the default launching + * connector. Afer command is received from debugge, the debugger + * creates BreakpointRequest on location in method of + * class where field is modified. + * The debugger cleans EventQueue, starts separate thread + * for listening events, enables breakpoint request, sends debuggee command + * and waits for in reply. + * Upon receiving command from debugger, the debuggee invokes + * method. This method updates field of class. + * For each BreakpointEvent received by , all refencies of this + * event ( , , , ) are compared + * with expected values. The current value of field reference + * is compared with expected value. + * After command received from debuggee, debugger notifies + * that method is invoked and waits for + * receives all expected events. If not all events received for + * WAITTIME interval, debugger interrupts thread and + * complains about an error. + * Finally, debugger disables checked request, sends debuggee command from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + // invoke checked method to generate BreakpointEvents + foo(); + + // notify debugger that checked method invoked + pipe.println(COMMAND_DONE); + + // wait for command from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + // checked method + static void foo() { + while (counter < LIMIT) { + counter++; // breakpointLineNumber + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointEvent/_itself_/breakpoint002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointEvent/_itself_/breakpoint002.java new file mode 100644 index 00000000000..b7d3487f83d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointEvent/_itself_/breakpoint002.java @@ -0,0 +1,404 @@ +/* + * 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.BreakpointEvent._itself_; + +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ObjectCollectedException; +import com.sun.jdi.Location; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; +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 up on the JDI interface + * com.sun.jdi.event.BreakpointEvent. + * A debugger + * part of the test creates several BreakpointRequests, + * and then it verifies that appropriate events are generated by + * the target VM. After that the debugger removes the requests by + * deleteAllBreakpoints() call. Finally, the test checks + * that the events corresponding to the deleted requests, are not + * generated by the target VM any more. + */ +public class breakpoint002 { + 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.BreakpointEvent._itself_.breakpoint002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int BPS_NUM = 4; + static final String COMMAND_RUN[] = { + "run1", "run2", "run3", "run4" + }; + static final int DEBUGGEE_LNS[] = { + 76, 79, 82, 85 + }; + private volatile int eventCount[] = { + 0, 0, 0, 0 + }; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile BreakpointRequest bpRequest[]; + private volatile int tot_res = PASSED; + +// 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 breakpoint002().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; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "breakpoint002t.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(); + } + +// Create testing requests + if ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILED: Method Debugee.classByName() returned null"); + tot_res = FAILED; + return quitDebuggee(); + } + if (createRequests(erManager, 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 all requested BreakpointEvents + for (int i=0; i 0) { + log.complain("TEST FAILED: got more than one breakpoint event for bp "+i); + return FAILED; + } + } + log.display("\nTEST PASSED: no events corresponding to the deleted BreakpointRequests"); + + } + +// Finish the test + return tot_res; + } + + private int createRequests(EventRequestManager erManager, + ReferenceType rType) { + List loctns; + + bpRequest = + new BreakpointRequest[BPS_NUM]; + for (int i=0; i + * - addThreadFilter,
    + * - addInstanceFilter
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +public class filters001 { + + private final static String prefix = "nsk.jdi.BreakpointRequest._bounds_."; + private final static String debuggerName = prefix + "filters001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String classToCheck = prefix + filters001a.classToCheck; + private static String indent = " : "; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType debugeeRef = debugee.classByName(debugeeName); + ReferenceType checkedClsRef = debugee.classByName(classToCheck); + + display(""); + display(">>>" + filters001a.objName); + display("----------------------"); + Field field = debugeeRef.fieldByName(filters001a.objName); + Value val = debugeeRef.getValue(field); + + BreakpointRequest request = debugee.setBreakpoint(checkedClsRef, + filters001a.brkptMethodName, + filters001a.brkptLineNumber); + + display(""); + addThreadFilter(request, (ThreadReference )val); + display(""); + addInstanceFilter(request, (ObjectReference )val); + + display(""); + debugee.quit(); + } + + private void addThreadFilter(BreakpointRequest request, ThreadReference thread) { + + display("addThreadFilter :ThreadReference> null"); + try { + request.addThreadFilter(thread); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addInstanceFilter(BreakpointRequest request, + ObjectReference instance) { + + display("addInstanceFilter :ObjectReference> null"); + + try { + request.addInstanceFilter(instance); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..cee61e10abf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/_bounds_/filters001/TestDescription.java @@ -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/BreakpointRequest/_bounds_/filters001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.BreakpointRequest.addThreadFilter(ThreadReference) + * com.sun.jdi.request.BreakpointRequest.addInstanceFilter(ObjectReference) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up this methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BreakpointRequest._bounds_.filters001 + * nsk.jdi.BreakpointRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..ee4300cfbe7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/_bounds_/filters001a.java @@ -0,0 +1,80 @@ +/* + * 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.BreakpointRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + static String classToCheck = "filters001b"; + static String objName = "testedObjNULL"; + static filters001b testedObjNULL = null; + + static final String brkptMethodName = "run"; + static final int brkptLineNumber = 75; + + public static void main (String argv[]) { + + // create temporary object to load class + filters001b tmp = new filters001b("tmp"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + pipe.println("ready"); + + String instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class filters001b extends Thread { + + static Log log; + filters001b(String nameObj) { + setName(nameObj); + } + + public void run() { + synchronized (log) { // brkptLineNumber + log.display(getName() + "::Breakpoint is reached"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001.java new file mode 100644 index 00000000000..4038829a430 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001.java @@ -0,0 +1,204 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * BreakpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.BreakpointRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a BreakpointRequest + * within the method in the class TestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordinly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the breakpoint event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001a"; + return new instancefilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001aTestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "BreakpointRequest1"; + String property2 = "BreakpointRequest2"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2BreakpointRequest (thread1, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance); + + eventRequest2 = setting2BreakpointRequest (thread2, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property2); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + + ((BreakpointRequest) eventRequest2).addInstanceFilter(instance); + + display("......waiting for BreakpointEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof BreakpointEvent)) { + setFailedStatus("ERROR: new event is not BreakpointEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new BreakpointEvent with propety 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) { + try { + display("......setting up a breakpoint:"); + display(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + display(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001/TestDescription.java new file mode 100644 index 00000000000..f580dae4b92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/BreakpointRequest/addInstanceFilter/instancefilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001 + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001a.java new file mode 100644 index 00000000000..3569a345786 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter001a.java @@ -0,0 +1,196 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter001 JDI test. + */ + +public class instancefilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter001a thread1 = null; + static Threadinstancefilter001a thread2 = null; + + static instancefilter001aTestClass objTC[] = { new instancefilter001aTestClass(), new instancefilter001aTestClass(), new instancefilter001aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter001a("thread1"); + thread2 = new Threadinstancefilter001a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter001a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter001a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002.java new file mode 100644 index 00000000000..cbc2b30f939 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002.java @@ -0,0 +1,559 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BreakpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.BreakpointRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a BreakpointRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter002a"; + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "BreakpointRequest1"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002/TestDescription.java new file mode 100644 index 00000000000..bc68e5d40a0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/BreakpointRequest/addInstanceFilter/instancefilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter002; + * the debuggee program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.BreakpointRequest.addInstanceFilter.instancefilter002 + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002a.java new file mode 100644 index 00000000000..4cdd50a131b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter002a.java @@ -0,0 +1,183 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter002 JDI test. + */ + +public class instancefilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter002a thread1 = null; + + static instancefilter002aTestClass objTC[] = { new instancefilter002aTestClass(), new instancefilter002aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter002a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter002a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter002aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003.java new file mode 100644 index 00000000000..b7863ebe6e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003.java @@ -0,0 +1,526 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BreakpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.BreakpointRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException - if the target
    + * virtual machine does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * a BreakpointRequest and if addInstanceFilter() is not supported,
    + * invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter003a"; + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "BreakpointRequest1"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003/TestDescription.java new file mode 100644 index 00000000000..da42c200065 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/BreakpointRequest/addInstanceFilter/instancefilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter003; + * the debuggee program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.BreakpointRequest.addInstanceFilter.instancefilter003 + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003a.java new file mode 100644 index 00000000000..9039c7bb08e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter003a.java @@ -0,0 +1,183 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter003 JDI test. + */ + +public class instancefilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter003a thread1 = null; + + static instancefilter003aTestClass objTC[] = { new instancefilter003aTestClass(), new instancefilter003aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter003a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter003a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter003a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter003aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004.java new file mode 100644 index 00000000000..922371eeff0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004.java @@ -0,0 +1,210 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * BreakpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.BreakpointRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same BreakpointRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For BreakpointRequest2, both invocations are with different + * ObjectReferences restricting one Breakpoint event to two objects. + * The test expects no Breakpoint event will be received. + * (2) For BreakpointRequest1, both invocations are with the same + * ObjectReference restricting one Breakpoint event to one object. + * The test expects this Breakpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, + * an array with three instances of the TestClass containing a method + * calling by both threads, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up BreakpointRequests 1&2 within the method + * in the class TestClass which will be calling by both threads, + * - restricts the BreakpointRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the BreakpointRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004a"; + return new instancefilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004aTestClass"; + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "BreakpointRequest1"; + String property2 = "BreakpointRequest2"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2BreakpointRequest (thread1, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2BreakpointRequest (thread2, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance1); + ((BreakpointRequest) eventRequest1).addInstanceFilter(instance1); + ((BreakpointRequest) eventRequest2).addInstanceFilter(instance1); + ((BreakpointRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for BreakpointEvent in expected thread"); + BreakpointEvent newEvent = (BreakpointEvent)eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + EventRequest newEventRequest = newEvent.request(); + if ( newEventRequest.equals(eventRequest1) ) { + display(" received expected event: " + newEvent); + + ThreadReference newEventThread = newEvent.thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) { + try { + display("......setting up a breakpoint:"); + display(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + display(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up BreakpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004/TestDescription.java new file mode 100644 index 00000000000..30615643833 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/BreakpointRequest/addInstanceFilter/instancefilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same BreakpointRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For BreakpointRequest2, both invocations are with different + * ObjectReferences restricting one Breakpoint event to two objects. + * The test expects no Breakpoint event will be received. + * (2) For BreakpointRequest1, both invocations are with the same + * ObjectReference restricting one Breakpoint event to one object. + * The test expects this Breakpoint event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004; + * the debuggee program - nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004 + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addInstanceFilter.instancefilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004a.java new file mode 100644 index 00000000000..b30041b0ac1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addInstanceFilter/instancefilter004a.java @@ -0,0 +1,196 @@ +/* + * 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.BreakpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter004 JDI test. + */ + +public class instancefilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter004a thread1 = null; + static Threadinstancefilter004a thread2 = null; + + static instancefilter004aTestClass objTC[] = { new instancefilter004aTestClass(), new instancefilter004aTestClass(), new instancefilter004aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter004a("thread1"); + thread2 = new Threadinstancefilter004a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter004aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001.java new file mode 100644 index 00000000000..7205550f17c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001.java @@ -0,0 +1,166 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * BreakpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.BreakpointRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * + * The test works as follows. + * + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a BreakpointRequest within the method + * in the class TestClass which will be calling by both threads, + * - restricts the breakpoint event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001a"; + return new threadfilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String property1 = "BreakpointRequest1"; + String methodName = "method"; + String bpLineName = "breakpointLine"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2BreakpointRequest (thread1, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for BreakpointEvent in tested thread"); + + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + if ( !(newEvent instanceof BreakpointEvent)) { + setFailedStatus("ERROR: new event is not BreakpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new BreakpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ThreadReference thr = ((BreakpointEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The BreakpointEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) { + try { + display("......setting up a breakpoint:"); + display(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + display(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001/TestDescription.java new file mode 100644 index 00000000000..54348cd43fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001/TestDescription.java @@ -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/BreakpointRequest/addThreadFilter/threadfilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001; + * the debuggee program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001 + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001a.java new file mode 100644 index 00000000000..81625b6b02f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter001a.java @@ -0,0 +1,195 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter001 JDI test. + */ + +public class threadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadthreadfilter001a thread1 = null; + static Threadthreadfilter001a thread2 = null; + + static threadfilter001aTestClass objTC = new threadfilter001aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadthreadfilter001a("thread1"); + thread2 = new Threadthreadfilter001a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadthreadfilter001a extends Thread { + + String tName = null; + int tNumber; + + public Threadthreadfilter001a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002.java new file mode 100644 index 00000000000..79ccc79dd38 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002.java @@ -0,0 +1,545 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BreakpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.BreakpointRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a BreakpointRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter002a"; + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "BreakpointRequest1"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property1); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((BreakpointRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((BreakpointRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((BreakpointRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002/TestDescription.java new file mode 100644 index 00000000000..2bc4574d36c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002/TestDescription.java @@ -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/BreakpointRequest/addThreadFilter/threadfilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter002; + * the debuggee program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.BreakpointRequest.addThreadFilter.threadfilter002 + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002a.java new file mode 100644 index 00000000000..ed85733431a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter002a.java @@ -0,0 +1,185 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter002 JDI test. + */ + +public class threadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadthreadfilter002a thread1 = null; + + static threadfilter002aTestClass objTC = new threadfilter002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadthreadfilter002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadthreadfilter002a extends Thread { + + String tName = null; + int tNumber; + + public Threadthreadfilter002a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter002aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003.java new file mode 100644 index 00000000000..6ea1964f821 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003.java @@ -0,0 +1,554 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BreakpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.BreakpointRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a BreakpointRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates a BreakpointRequest2, starts the thread2, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates a BreakpointRequest3, waits the thread2 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter003a"; + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "BreakpointRequest1"; + String property2 = "BreakpointRequest2"; + String property3 = "BreakpointRequest3"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property1); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((BreakpointRequest)eventRequest1).addThreadFilter(thread1); + log2(" no Exception"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + + break; + + case 1: + eventRequest2 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property2); + + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((BreakpointRequest)eventRequest2).addThreadFilter(thread1); + log2(" no Exception"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property3); + + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((BreakpointRequest)eventRequest3).addThreadFilter(thread1); + log2(" no Exception"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003/TestDescription.java new file mode 100644 index 00000000000..4a44c724144 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/BreakpointRequest/addThreadFilter/threadfilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter003; + * the debuggee program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.BreakpointRequest.addThreadFilter.threadfilter003 + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003a.java new file mode 100644 index 00000000000..5246ec81122 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter003a.java @@ -0,0 +1,188 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter003 JDI test. + */ + +public class threadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadthreadfilter003a thread1 = null; + + static threadfilter003aTestClass objTC = new threadfilter003aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadthreadfilter003a("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class Threadthreadfilter003a extends Thread { + + public Threadthreadfilter003a(String threadName) { + super(threadName); + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class threadfilter003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004.java new file mode 100644 index 00000000000..e4db04d0eb8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004.java @@ -0,0 +1,196 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * BreakpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.BreakpointRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same BreakpointRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For BreakpointRequest2, both invocations are with different + * ThreadReferences restricting one Breakpoint event to two threads. + * The test expects no Breakpoint event will be received. + * (2) For BreakpointRequest1, both invocations are with the same + * ThreadReference restricting one Breakpoint event to one thread. + * The test expects this Breakpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up BreakpointRequests 1&2 within the method + * in the class TestClass which will be calling by both threads, + * - restricts the BreakpointRequest1 only to thread1, + * - restricts the BreakpointRequest2 to both thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004a"; + return new threadfilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "BreakpointRequest1"; + String property2 = "BreakpointRequest2"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2BreakpointRequest (thread1, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2BreakpointRequest (thread1, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_ALL, property2); + + ((BreakpointRequest) eventRequest1).addThreadFilter(thread1); + ((BreakpointRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for BreakpointEvent in tested thread1"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof BreakpointEvent)) { + setFailedStatus("ERROR: new event is not BreakpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new BreakpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + EventRequest newEventRequest = newEvent.request(); + if (!newEventRequest.equals(eventRequest1) ) { + setFailedStatus("The BreakpointEvent occured not for eventRequest1"); + } + + ThreadReference thr = ((BreakpointEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The BreakpointEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) { + try { + display("......setting up a breakpoint:"); + display(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + display(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up BreakpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004/TestDescription.java new file mode 100644 index 00000000000..bab4f929e32 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/BreakpointRequest/addThreadFilter/threadfilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same BreakpointRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For BreakpointRequest2, both invocations are with different + * ThreadReferences restricting one Breakpoint event to two threads. + * The test expects no Breakpoint event will be received. + * (2) For BreakpointRequest1, both invocations are with the same + * ThreadReference restricting one Breakpoint event to one thread. + * The test expects this Breakpoint event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004; + * the debuggee program - nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004 + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.addThreadFilter.threadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004a.java new file mode 100644 index 00000000000..eee1d5a5cf4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/addThreadFilter/threadfilter004a.java @@ -0,0 +1,199 @@ +/* + * 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.BreakpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter004 JDI test. + */ + +public class threadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadthreadfilter004a thread1 = null; + static Threadthreadfilter004a thread2 = null; + + static threadfilter004aTestClass objTC = new threadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadthreadfilter004a("thread1"); + thread2 = new Threadthreadfilter004a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadthreadfilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadthreadfilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001.java new file mode 100644 index 00000000000..df1281910d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001.java @@ -0,0 +1,519 @@ +/* + * 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.BreakpointRequest.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * BreakpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.BreakpointRequest.location()
    + * complies with its spec.
    + *
    + * The test checks if a Location object, an argument of the method
    + * EventRequestManager.createBreakpointRequest(Location),
    + * is equal to one returned by the method BreakpointRequest.location()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a BreakpointRequest and gets Location object location1,
    + * - gets Location object location2 with the method
    + * BreakpointRequest.location(),
    + * - compares the Location objects.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class location001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/BreakpointRequest/location/location001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new location001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.BreakpointRequest.location.location001a"; + + private String testedClassName = + "nsk.jdi.BreakpointRequest.location.TestClass"; + + Location location1 = null; + Location location2 = null; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "BreakpointRequest1"; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + log2(".....setting up BreakpointRequest and getting Location object location1"); + eventRequest1 = setting2BreakpointRequest (null, + testClassReference, methodName, bpLineName, + EventRequest.SUSPEND_NONE, property1); + + log2("......getting: location2 = ((BreakpointRequest) eventRequest1).location();"); + location2 = ((BreakpointRequest) eventRequest1).location(); + + log2(" checking up on equality of location1 and location2"); + if ( !location1.equals(location2) ) { + testExitCode = FAILED; + log3("ERROR: Location objects are not equal"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest setting2BreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + location1 = loc; + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + if (thread != null) + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001/TestDescription.java new file mode 100644 index 00000000000..267eaff0b83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001/TestDescription.java @@ -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/BreakpointRequest/location/location001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * BreakpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.BreakpointRequest.location() + * complies with its spec: + * public Location location() + * Returns the location of the requested breakpoint. + * Specified by: location in interface Locatable + * Returns: the Location where this breakpoint has been set. + * The test checks if a Location object, + * an argument of the method EventRequestManager.createBreakpointRequest(Location), + * is equal to one returned by the method BreakpointRequest.location() + * The test works as follows: + * The debugger program - nsk.jdi.BreakpointRequest.location.location001; + * the debuggee program - nsk.jdi.BreakpointRequest.location.location001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.BreakpointRequest.location.location001 + * nsk.jdi.BreakpointRequest.location.location001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.BreakpointRequest.location.location001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001a.java new file mode 100644 index 00000000000..e65ddad3066 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BreakpointRequest/location/location001a.java @@ -0,0 +1,185 @@ +/* + * 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.BreakpointRequest.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the location001 JDI test. + */ + +public class location001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadlocation001a thread1 = null; + + static TestClass objTC = new TestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadlocation001a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadlocation001a extends Thread { + + String tName = null; + int tNumber; + + public Threadlocation001a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001.java new file mode 100644 index 00000000000..d1a51c118c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001.java @@ -0,0 +1,456 @@ +/* + * 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.ByteType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ByteType.
    + *
    + * The test checks that for a mirror of a byte value the casts
    + * from Type to ByteType and from PrimitiveType to ByteType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a byte field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class bytetype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ByteType/_itself_/bytetype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new bytetype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ByteType._itself_.bytetype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'bt';"); + String name = "bt"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + ByteType byteType = null; + try { + log2(" checking up on cast: ByteType booleanType = (ByteType) type;"); + byteType = (ByteType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: ByteType byteType = (ByteType) primitiveType;"); + byteType = (ByteType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001/TestDescription.java new file mode 100644 index 00000000000..8b45ef22042 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001/TestDescription.java @@ -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/ByteType/_itself_/bytetype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ByteType. + * The test checks that for a mirror of byte value the casts + * from Type to ByteType and from PrimitiveType to ByteType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.ByteType._itself_.bytetype001; + * the debuggee program - nsk.jdi.ByteType._itself_.bytetype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ByteType._itself_.bytetype001 + * nsk.jdi.ByteType._itself_.bytetype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ByteType._itself_.bytetype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001a.java new file mode 100644 index 00000000000..5ec3c1613eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteType/_itself_/bytetype001a.java @@ -0,0 +1,113 @@ +/* + * 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.ByteType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the bytetype001 JDI test. + */ + +public class bytetype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static byte bt = 0; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001.java new file mode 100644 index 00000000000..8c897a85cdd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.ByteValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.ByteValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + ByteValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof ByteValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (ByteValue )v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for ByteValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(ByteValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof ByteValue) { + ByteValue byteObject = (ByteValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(byteObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(byteObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is ByteValue: " + value + " and 'y' is ByteValue : " + byteObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(byteObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(byteObject) == 0) && (byteObject.compareTo(value) != 0)) || + ((value.compareTo(byteObject) != 0) && (byteObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is ByteValue: " + value + " and 'y' is ByteValue : " + byteObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(byteObject) + "\n\t" + + "result of (y.compareTo(x)): " + byteObject.compareTo(value) ); + result = false; + } + if (value.compareTo(byteObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(byteObject) != -(byteObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is ByteValue: " + value + " and 'y' is ByteValue : " + byteObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(byteObject) + "\n\t" + + "result of (y.compareTo(x)): " + byteObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(byteObject) > 0) { + ByteValue lessValue = FindLessByteValue(byteObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is ByteValue: " + value + " , 'y' is ByteValue : " + byteObject + " , 'z' is ByteValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(byteObject) + "\n\t" + + "result of (y.compareTo(z)): " + byteObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "ByteValue: " + value + " and ByteValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "ByteValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "ByteValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((ByteValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "ByteValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "ByteValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another ByteValue field which is less then method's argument via + * compareTo method. + */ + + private static ByteValue FindLessByteValue (ByteValue currentValue) { + ByteValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + ByteValue newValue = (ByteValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..6a04b76379f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001/TestDescription.java @@ -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/ByteValue/compareTo/compareto001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.ByteValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of ByteValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote ByteValue object. + * The debugger program - nsk.jdi.ByteValue.compareto.compareto001; + * the debuggee program - nsk.jdi.ByteValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of byte fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of ByteValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.ByteValue.compareTo.compareto001 + * nsk.jdi.ByteValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ByteValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..83a4a36b51b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/compareTo/compareto001a.java @@ -0,0 +1,175 @@ +/* + * 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.ByteValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public byte byteMAX = Byte.MAX_VALUE; + public byte byte1 = 1; + public byte byte0 = 0; + public byte byte_1 = -1; + public byte byteMIN = Byte.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001.java new file mode 100644 index 00000000000..fcdd191261c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001.java @@ -0,0 +1,247 @@ +/* + * 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.ByteValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ByteValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ByteValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static byte plus1_1 = +1;
    + * public static byte plus1_2 = +1;
    + * public static byte minus1 = -1;
    + * public static short shortplus1 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * ByteValue bvplus1_1;
    + * ByteValue bvplus1_2;
    + * ByteValue bvminus1;
    + * ShortValue svplus1;
    + *
    + * the following is true:
    + *
    + * bvplus1_1 == bvplus1_2
    + * bvplus1_1 != bvminus1
    + * bvplus1_1 != svplus1
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ByteValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ByteValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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(debuggeeName + " -vbs"); // *** tp + } else { + debugee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("equals001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fbplus1_1 = execClass.fieldByName("plus1_1"); + Field fbplus1_2 = execClass.fieldByName("plus1_2"); + Field fbminus1 = execClass.fieldByName("minus1"); + Field fsplus1 = execClass.fieldByName("shortplus1"); + + ByteValue bvplus1_1 = (ByteValue) execClass.getValue(fbplus1_1); + ByteValue bvplus1_2 = (ByteValue) execClass.getValue(fbplus1_2); + ByteValue bvminus1 = (ByteValue) execClass.getValue(fbminus1); + ShortValue svplus1 = (ShortValue) execClass.getValue(fsplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!bvplus1_1.equals(bvplus1_2)) + expresult = 1; + break; + + case 1: if (bvplus1_1.equals(bvminus1)) + expresult = 1; + break; + + case 2: if (bvplus1_1.equals(svplus1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..a24924e809c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001/TestDescription.java @@ -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/ByteValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ByteValue. + * The test checks up that a result of the method + * com.sun.jdi.ByteValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this ByteValue for equality. + * Returns: true if the Object is a ByteValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.ByteValue.equals.equals001; + * a debuggee program - nsk.jdi.ByteValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.ByteValue.equals.equals001 + * nsk.jdi.ByteValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ByteValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001a.java new file mode 100644 index 00000000000..668c59a5faa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals001a.java @@ -0,0 +1,126 @@ +/* + * 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.ByteValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static byte smallest = Byte.MIN_VALUE; +// public static byte zero = 0; +// public static byte largest = Byte.MAX_VALUE; + + public static byte plus1_1 = +1; + public static byte plus1_2 = +1; + public static byte minus1 = -1; + + public static short shortplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.ByteValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + ByteValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof ByteValue) ) { + msg += " is not ByteValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (ByteValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(ByteValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof ByteValue ) { + if ( value.value() == ((PrimitiveValue )object).byteValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof ByteValue ) { + if ( value.value() != ((PrimitiveValue )object).byteValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..79b8d8eaf09 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals002/TestDescription.java @@ -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/ByteValue/equals/equals002. + * 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.ByteValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this ByteValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a ByteValue and if applying "==" to the + * two mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.ByteValue.equals.equals002 + * nsk.jdi.ByteValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ByteValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals002a.java new file mode 100644 index 00000000000..76d08d8aead --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/equals/equals002a.java @@ -0,0 +1,142 @@ +/* + * 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.ByteValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public byte byteMAX = Byte.MAX_VALUE; + public byte byte1 = 1; + public byte byte0 = 0; + public byte byte_1 = -1; + public byte byteMIN = Byte.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..5bc3013eb0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001.java @@ -0,0 +1,238 @@ +/* + * 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.ByteValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ByteValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ByteValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static byte plus1_1 = +1;
    + * public static byte plus1_2 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * ByteValue bvplus1_1;
    + * ByteValue bvplus1_2;
    + *
    + * the following is true:
    + *
    + * bvplus1_1.hashCode() == bvplus1_1.hashCode()
    + * bvplus1_1.hashCode() == bvplus1_2.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ByteValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ByteValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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(debuggeeName + " -vbs"); // *** tp + } else { + debugee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("hashcode001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fbplus1_1 = execClass.fieldByName("plus1_1"); + Field fbplus1_2 = execClass.fieldByName("plus1_2"); +// Field fbminus1 = execClass.fieldByName("minus1"); +// Field fsplus1 = execClass.fieldByName("shortplus1"); + + ByteValue bvplus1_1 = (ByteValue) execClass.getValue(fbplus1_1); + ByteValue bvplus1_2 = (ByteValue) execClass.getValue(fbplus1_2); +// ByteValue bvminus1 = (ByteValue) execClass.getValue(fbminus1); +// ShortValue svplus1 = (ShortValue) execClass.getValue(fsplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (bvplus1_1.hashCode() != bvplus1_1.hashCode()) + expresult = 1; + break; + + case 1: if (bvplus1_1.hashCode() != bvplus1_2.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..b984a70b85f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001/TestDescription.java @@ -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/ByteValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ByteValue. + * The test checks up that a result of the method + * com.sun.jdi.ByteValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this BooleanValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.ByteValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.ByteValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.ByteValue.hashCode.hashcode001 + * nsk.jdi.ByteValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ByteValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..09ede4f5572 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001a.java @@ -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.ByteValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static byte smallest = Byte.MIN_VALUE; +// public static byte zero = 0; +// public static byte largest = Byte.MAX_VALUE; + + public static byte plus1_1 = +1; + public static byte plus1_2 = +1; +// public static byte minus1 = -1; + +// public static short shortplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ByteValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ByteValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static byte smallest = Byte.MIN_VALUE;
    + * public static byte zero = 0;
    + * public static byte largest = Byte.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * ByteValue bvsmallest;
    + * ByteValue bvzero;
    + * ByteValue bvlargest;
    + *
    + * the following is true:
    + *
    + * bvsmallest.value() == Byte.MIN_VALUE
    + * bvzero.value() == 0
    + * bvlargest.value() == Byte.MAX_VALUE
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ByteValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ByteValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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(debuggeeName + " -vbs"); // *** tp + } else { + debugee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("value001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fbsmallest = execClass.fieldByName("smallest"); + Field fbzero = execClass.fieldByName("zero"); + Field fblargest = execClass.fieldByName("largest"); + + ByteValue bvsmallest = (ByteValue) execClass.getValue(fbsmallest); + ByteValue bvzero = (ByteValue) execClass.getValue(fbzero); + ByteValue bvlargest = (ByteValue) execClass.getValue(fblargest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (bvsmallest.value() != Byte.MIN_VALUE) + expresult = 1; + break; + + case 1: if (bvzero.value() != 0) + expresult = 1; + break; + + case 2: if (bvlargest.value() != Byte.MAX_VALUE) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..3159c31cb55 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/value/value001/TestDescription.java @@ -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/ByteValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ByteValue. + * The test checks up that a result of the method + * com.sun.jdi.ByteValue.value() + * complies with its spec: + * public byte value() + * Returns this ByteValue as a boolean. + * Returns: the byte mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.ByteValue.value.value001; + * a debuggee program - nsk.jdi.ByteValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.ByteValue.value.value001 + * nsk.jdi.ByteValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ByteValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/value/value001a.java new file mode 100644 index 00000000000..746ab944934 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/value/value001a.java @@ -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.ByteValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static byte smallest = Byte.MIN_VALUE; + public static byte zero = 0; + public static byte largest = Byte.MAX_VALUE; + +// public static byte plus1_1 = +1; +// public static byte plus1_2 = +1; +// public static byte minus1 = -1; + +// public static short shortplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * CharType.
    + *
    + * The test checks that for a mirror of a char value the casts
    + * from Type to CharType and from PrimitiveType to CharType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a char field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class chartype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/CharType/_itself_/chartype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new chartype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.CharType._itself_.chartype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'ch';"); + String name = "ch"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + CharType charType = null; + try { + log2(" checking up on cast: CharType charType = (CharType) type;"); + charType = (CharType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: CharType charType = (CharType) primitiveType;"); + charType = (CharType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharType/_itself_/chartype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharType/_itself_/chartype001/TestDescription.java new file mode 100644 index 00000000000..8940efe6df8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharType/_itself_/chartype001/TestDescription.java @@ -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/CharType/_itself_/chartype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * CharType. + * The test checks that for a mirror of char value the casts + * from Type to CharType and from PrimitiveType to CharType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.CharType._itself_.chartype001; + * the debuggee program - nsk.jdi.CharType._itself_.chartype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.CharType._itself_.chartype001 + * nsk.jdi.CharType._itself_.chartype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.CharType._itself_.chartype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharType/_itself_/chartype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharType/_itself_/chartype001a.java new file mode 100644 index 00000000000..fee21d2c652 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharType/_itself_/chartype001a.java @@ -0,0 +1,113 @@ +/* + * 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.CharType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the chartype001 JDI test. + */ + +public class chartype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static char ch = 0; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001.java new file mode 100644 index 00000000000..f78a2b79af8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.CharValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.CharValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + CharValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof CharValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (CharValue)v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for CharValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference)arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(CharValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof CharValue) { + CharValue charObject = (CharValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(charObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(charObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is CharValue: " + value + " and 'y' is CharValue : " + charObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(charObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(charObject) == 0) && (charObject.compareTo(value) != 0)) || + ((value.compareTo(charObject) != 0) && (charObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is CharValue: " + value + " and 'y' is CharValue : " + charObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(charObject) + "\n\t" + + "result of (y.compareTo(x)): " + charObject.compareTo(value) ); + result = false; + } + if (value.compareTo(charObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(charObject) != -(charObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is CharValue: " + value + " and 'y' is CharValue : " + charObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(charObject) + "\n\t" + + "result of (y.compareTo(x)): " + charObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(charObject) > 0) { + CharValue lessValue = FindLessCharValue(charObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is CharValue: " + value + " , 'y' is CharValue : " + charObject + " , 'z' is CharValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(charObject) + "\n\t" + + "result of (y.compareTo(z)): " + charObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "CharValue: " + value + " and CharValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "CharValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "CharValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((CharValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "CharValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "CharValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another CharValue field which is less then method's argument via + * compareTo method. + */ + + private static CharValue FindLessCharValue (CharValue currentValue) { + CharValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + CharValue newValue = (CharValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..0d8a1c093c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001/TestDescription.java @@ -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/CharValue/compareTo/compareto001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.CharValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of CharValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote CharValue object. + * The debugger program - nsk.jdi.CharValue.compareto.compareto001; + * the debuggee program - nsk.jdi.CharValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of char fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of CharValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.CharValue.compareTo.compareto001 + * nsk.jdi.CharValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.CharValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..5134b53fb4b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/compareTo/compareto001a.java @@ -0,0 +1,178 @@ +/* + * 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.CharValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpChar0 = 'a'; + static char cmpChar1 = '%'; + static char cmpChar2 = '\t'; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public char charMAX = Character.MAX_VALUE; + public char char0 = 'a'; + public char char1 = '%'; + public char char2 = '\t'; + public char charMIN = Character.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001.java new file mode 100644 index 00000000000..6ce2363cd02 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001.java @@ -0,0 +1,248 @@ +/* + * 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.CharValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * CharValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.CharValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static char char_a_1 = 'a';
    + * public static char char_a_2 = 'a';
    + * public static char char_b = 'b';
    + * public static short shortchar_a_3 = (short) 'a';
    + *
    + * which a debugger mirros as :
    + *
    + * CharValue cvchar_a_1;
    + * CharValue cvchar_a_2;
    + * CharValue cvchar_b;
    + * ShortValue svchar_a_3;
    + *
    + * the following is true:
    + *
    + * cvchar_a_1 == cvchar_a_2
    + * cvchar_a_1 != cvchar_b
    + * cvchar_a_1 != svchar_a_3
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/CharValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.CharValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fcchar_a_1 = execClass.fieldByName("char_a_1"); + Field fcchar_a_2 = execClass.fieldByName("char_a_2"); + Field fcchar_b = execClass.fieldByName("char_b"); + Field fschar_a_3 = execClass.fieldByName("shortchar_a_3"); + + CharValue cvchar_a_1 = (CharValue) execClass.getValue(fcchar_a_1); + CharValue cvchar_a_2 = (CharValue) execClass.getValue(fcchar_a_2); + CharValue cvchar_b = (CharValue) execClass.getValue(fcchar_b); + ShortValue svchar_a_3 = (ShortValue) execClass.getValue(fschar_a_3); + + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!cvchar_a_1.equals(cvchar_a_2)) + expresult = 1; + break; + + case 1: if (cvchar_a_1.equals(cvchar_b)) + expresult = 1; + break; + + case 2: if (cvchar_a_1.equals(svchar_a_3)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..1fb9507dc3c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001/TestDescription.java @@ -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/CharValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * CharValue. + * The test checks up that a result of the method + * com.sun.jdi.CharValue.equals() + * complies with its specification: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this CharValue for equality. + * Returns: true if the Object is a CharValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.CharValue.equals.equals001; + * a debuggee program - nsk.jdi.CharValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.CharValue.equals.equals001 + * nsk.jdi.CharValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.CharValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001a.java new file mode 100644 index 00000000000..7a6c1d501f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals001a.java @@ -0,0 +1,123 @@ +/* + * 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.CharValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static char smallest = Character.MIN_VALUE; +// public static char largest = Character.MAX_VALUE; + + public static char char_a_1 = 'a'; + public static char char_a_2 = 'a'; + public static char char_b = 'b'; + public static short shortchar_a_3 = (short) 'a'; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.CharValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + CharValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof CharValue) ) { + msg += " is not CharValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (CharValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(CharValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof CharValue ) { + if ( value.value() == ((PrimitiveValue )object).charValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof CharValue ) { + if ( value.value() != ((PrimitiveValue )object).charValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..7ede6f98428 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals002/TestDescription.java @@ -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/CharValue/equals/equals002. + * 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.CharValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this CharValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a CharValue and if applying "==" to the two + * mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.CharValue.equals.equals002 + * nsk.jdi.CharValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.CharValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals002a.java new file mode 100644 index 00000000000..91e8a63522c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/equals/equals002a.java @@ -0,0 +1,139 @@ +/* + * 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.CharValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public char charMAX = Character.MAX_VALUE; + public char charMIN = Character.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..94de260db43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001.java @@ -0,0 +1,238 @@ +/* + * 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.CharValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * CharValue.
    + *
    + * The test checks up that results of the method
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static char char_a_1 = 'a';
    + * public static char char_a_2 = 'a';
    + * public static char char_smallest = Character.MIN_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * CharValue cvchar_a_1;
    + * CharValue cvchar_a_2;
    + * CharValue cvchar_smallest;
    + *
    + * the following is true:
    + *
    + * cvchar_smallest == cvchar_smallest
    + * cvchar_a_1 == cvchar_a_2
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/CharValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.CharValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fcchar_smallest = execClass.fieldByName("smallest"); + Field fcchar_a_1 = execClass.fieldByName("char_a_1"); + Field fcchar_a_2 = execClass.fieldByName("char_a_2"); + + CharValue cvchar_smallest = (CharValue) execClass.getValue(fcchar_smallest); + CharValue cvchar_a_1 = (CharValue) execClass.getValue(fcchar_a_1); + CharValue cvchar_a_2 = (CharValue) execClass.getValue(fcchar_a_2); + + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!cvchar_smallest.equals(cvchar_smallest)) + expresult = 1; + break; + + case 1: if (!cvchar_a_1.equals(cvchar_a_2)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..132dcaefcb0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001/TestDescription.java @@ -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/CharValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * CharValue. + * The test checks up that a result of the method + * com.sun.jdi.CharValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this CharValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.CharValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.CharValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.CharValue.hashCode.hashcode001 + * nsk.jdi.CharValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.CharValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..a31d47bd7df --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/hashCode/hashcode001a.java @@ -0,0 +1,123 @@ +/* + * 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.CharValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static char smallest = Character.MIN_VALUE; +// public static char largest = Character.MAX_VALUE; + + public static char char_a_1 = 'a'; + public static char char_a_2 = 'a'; +// public static char char_b = 'b'; +// public static short shortchar_a_3 = (short) 'a'; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * CharValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.CharValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static char smallest = Character.MIN_VALUE;
    + * public static char largest = Character.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * CharValue cvchar_smallest;
    + * CharValue cvchar_largest;
    + *
    + * the following is true:
    + *
    + * cvchar_smallest.value() == Character.MIN_VALUE
    + * cvchar_largest.value() == Character.MAX_VALUE
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/CharValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.CharValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fcchar_smallest = execClass.fieldByName("smallest"); + Field fcchar_largest = execClass.fieldByName("largest"); + + CharValue cvchar_smallest = + (CharValue) execClass.getValue(fcchar_smallest); + CharValue cvchar_largest = + (CharValue) execClass.getValue(fcchar_largest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (cvchar_smallest.value() != Character.MIN_VALUE) + expresult = 1; + break; + + case 1: if (cvchar_largest.value() != Character.MAX_VALUE) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..de6d8a7a2c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/value/value001/TestDescription.java @@ -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/CharValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * CharValue. + * The test checks up that a result of the method + * com.sun.jdi.CharValue.value() + * complies with its specification: + * public char value() + * Returns this CharValue as a char. + * Returns: the char mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.CharValue.value.value001; + * a debuggee program - nsk.jdi.CharValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.CharValue.value.value001 + * nsk.jdi.CharValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.CharValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/value/value001a.java new file mode 100644 index 00000000000..fb386ef3903 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/CharValue/value/value001a.java @@ -0,0 +1,123 @@ +/* + * 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.CharValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static char smallest = Character.MIN_VALUE; + public static char largest = Character.MAX_VALUE; + +// public static char char_a_1 = 'a'; +// public static char char_a_2 = 'a'; +// public static char char_b = 'b'; +// public static short shortchar_a_3 = (short) 'a'; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ClassLoader.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassLoader.definedClasses()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * The list has length 0 if no types have been defined by
    + * this classloader.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a ClassLoader object and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class definedclasses001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new definedclasses001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassLoaderReference.definedClasses.definedclasses001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String ClassLoaderObjName = "classLoader"; + + log2("......getting: Value val = debuggeeClass.getValue(debuggeeClass.fieldByName(ClassLoaderObjName));"); + Value val = debuggeeClass.getValue(debuggeeClass.fieldByName(ClassLoaderObjName)); + + log2("......getting: ClassLoaderReference clRef = (ClassLoaderReference) val;"); + ClassLoaderReference clRef = (ClassLoaderReference) val; + + log2("......getting: List definedClasses = clRef.definedClasses();"); + List definedClasses = clRef.definedClasses(); + log2("......checking up on definedClasses.size() : 0 is expected"); + if (definedClasses.size() != 0) { + log3("ERROR: definedClasses.size() != 0"); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001/TestDescription.java new file mode 100644 index 00000000000..520e7e5f233 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001/TestDescription.java @@ -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/ClassLoaderReference/definedClasses/definedclasses001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassLoader. + * The test checks up that a result of the method + * com.sun.jdi.ClassLoaderReference.definedClasses() + * complies with its spec: + * public List definedClasses() + * Returns a list of all loaded classes that were defined by this class loader. + * No ordering of this list guaranteed. + * The returned list will include reference types loaded at least to + * the point of preparation and types (like array) for which preparation is not defined. + * Returns: + * a List of ReferenceType objects mirroring types loaded by this class loader. + * The list has length 0 if no types have been defined by this classloader. + * The test checks up on the assertion: + * The list has length 0 if no types have been defined by this classloader. + * The test works as follows: + * The debugger program - nsk.jdi.ClassLoaderReference.definedClasses.definedclasses001; + * the debuggee program - nsk.jdi.ClassLoaderReference.definedClasses.definedclasses001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test fixed due to test RFE: + * 4842009 TEST_RFE: Incorrect package name in two JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.definedClasses.definedclasses001 + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001a.java new file mode 100644 index 00000000000..371b489b832 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001a.java @@ -0,0 +1,125 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.net.URLClassLoader; +import java.net.URL; + +/** + * This class is used as debuggee application for the definedclasses001 JDI test. + */ + +public class definedclasses001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static ClassLoader classLoader = null; + + static String urlString = "http://download.java.net/java/jdk10/docs/api/overview-summary.html"; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + try { + URL[] url = { new URL(urlString) } ; + classLoader = new URLClassLoader(url); + } catch ( Exception e ) { + log1("Exception : " + e); + } + + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002.java new file mode 100644 index 00000000000..87d32c47765 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002.java @@ -0,0 +1,161 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class definedclasses002 { + + //------------------------------------------------------- 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.ClassLoaderReference.definedClasses."; + private final static String className = "definedclasses002"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + display("Getting ClassLoaderReference of debuggee's class."); + ClassLoaderReference classLoader = debuggeeClass.classLoader(); + if (classLoader == null) { + complain("classLoader() method returned null for debuggee's ReferenceType."); + exitStatus = Consts.TEST_FAILED; + } else { + display("Getting definedClasses list."); + Iterator definedClasses = classLoader.definedClasses().iterator(); + boolean found0 = false; + boolean found1 = false; + boolean found2 = false; + display("Searching for debuggee's ReferenceType in the list..."); + while (definedClasses.hasNext()) { + ReferenceType refType = (ReferenceType)definedClasses.next(); + if (refType.equals(debuggeeClass)) { + display("definedclasses002a ClassType is found in definedClasses() list of ClassLoaderReference mirror."); + found0 = true; + } else if (refType instanceof ArrayType) { + Type compType; + try { + compType = ((ArrayType)refType).componentType(); + if (compType instanceof ClassType && ((ReferenceType)compType).equals(debuggeeClass)) { + display("definedclasses002a[] ArrayType is found in definedClasses() list of ClassLoaderReference mirror."); + found1 = true; + } else if (compType instanceof ArrayType) { + compType = ((ArrayType)compType).componentType(); + if (compType instanceof ClassType && ((ReferenceType)compType).equals(debuggeeClass)) { + display("definedclasses002a[][] ArrayType is found in definedClasses() list of ClassLoaderReference mirror."); + found2 = true; + } + } + } catch (ClassNotLoadedException e) { + throw new Failure("Unexpected ClassNotLoadedException while getting componentType() of : " + refType); + } + + } + } + if (!found0) { + complain("definedclasses002a ReferenceType is NOT found in definedClasses() list of ClassLoaderReference mirror."); + exitStatus = Consts.TEST_FAILED; + } + if (!found1) { + complain("definedclasses002a[] ArrayType is NOT found in definedClasses() list of ClassLoaderReference mirror."); + exitStatus = Consts.TEST_FAILED; + } + if (!found2) { + complain("definedclasses002a[][] ArrayType is NOT found in definedClasses() list of ClassLoaderReference mirror."); + exitStatus = Consts.TEST_FAILED; + } + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002/TestDescription.java new file mode 100644 index 00000000000..3e7fd78aef0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002/TestDescription.java @@ -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/ClassLoaderReference/definedClasses/definedclasses002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that an implementation of the + * com.sun.jdi.ClassLoaderReference.definedClasses method conforms + * with its spec. + * The test verifies an assertion: + * public List definedClasses() + * Returns a list of all loaded classes that were defined by this class + * loader. No ordering of this list guaranteed. + * The returned list will include reference types loaded at least to the + * point of preparation and types (like array) for which preparation is + * not defined. + * The test consists of: + * debugger - nsk.jdi.ClassLoaderReference.definedClasses.definedclasses002 + * debuggee - nsk.jdi.ClassLoaderReference.definedClasses.definedclasses002a + * The main method of debuggee class defines local variables of single- and + * two-dimensional array of 'definedclasses002a' type. The debugger gets + * a ClassLoaderReference of debuggee class loader. The tests fails if + * either debuggee class reference or array type references are not found + * in the list returned by definedClasses() method. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.definedClasses.definedclasses002 + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002a.java new file mode 100644 index 00000000000..3adf36a44f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002a.java @@ -0,0 +1,93 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged applcation of the test. + */ +public class definedclasses002a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + definedclasses002a[] arr1 = {}; + definedclasses002a[][] arr2 = {arr1}; + + try { + pipe.println(definedclasses002.SIGNAL_READY); + + receiveSignal(definedclasses002.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(exitStatus + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003.java new file mode 100644 index 00000000000..f9ba74ac466 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003.java @@ -0,0 +1,174 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class definedclasses003 { + + //------------------------------------------------------- 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.ClassLoaderReference.definedClasses."; + private final static String className = "definedclasses003"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String classLoaderName = prefix + "fields002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + while (true) { + Field classField = debuggeeClass.fieldByName(classFieldName); + if ( classField == null) { + complain("Checked field is not found in the debuggee: " + classFieldName); + exitStatus = Consts.TEST_FAILED; + break; + } + + Value classValue = debuggeeClass.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + complain("Unexpected exception while getting ClassObjectReference : " + e.getMessage()); + exitStatus = Consts.TEST_FAILED; + break; + } + + ReferenceType refType1 = classObjRef.reflectedType(); + if (!refType1.isPrepared()) { + complain("isPrepared() returned false for " + refType1); + exitStatus = Consts.TEST_FAILED; + break; + } else { + display("isPrepared() returned true for " + refType1); + } + + display("Getting ClassLoaderReference of ReferenceType: " + refType1 ); + ClassLoaderReference classLoader = refType1.classLoader(); + if (classLoader == null) { + complain("classLoader() method returned null for ReferenceType: " + refType1); + exitStatus = Consts.TEST_FAILED; + break; + } + + display("Getting definedClasses list."); + Iterator definedClasses = classLoader.definedClasses().iterator(); + boolean found = false; + display("Searching in the list for ReferenceType : " + refType1); + while (definedClasses.hasNext()) { + ReferenceType refType = (ReferenceType)definedClasses.next(); + if (refType.equals(refType1)) { + found = true; + } else { + complain("Unexpected ReferenceType : " + refType + "\n\t is found in definedClasses() list of " + classLoaderName + " mirror."); + exitStatus = Consts.TEST_FAILED; + } + } + + if (found) { + display("ReferenceType : " + refType1 + "\n\t is found in definedClasses() list of " + classLoaderName + " mirror."); + } else { + complain("ReferenceType : " + refType1 + "\n\t is NOT found in definedClasses() list of " + classLoaderName + " mirror."); + exitStatus = Consts.TEST_FAILED; + } + + break; + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/TestDescription.java new file mode 100644 index 00000000000..370e9b29fe5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/TestDescription.java @@ -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/ClassLoaderReference/definedClasses/definedclasses003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * COMMENTS: + * The test checks up that an implementation of the + * com.sun.jdi.ClassLoaderReference.definedClasses method conforms + * with its spec. + * The test verifies an assertion: + * public List definedClasses() + * Returns a list of all loaded classes that were defined by this class + * loader. No ordering of this list guaranteed. + * The returned list will include reference types loaded at least to the + * point of preparation and types (like array) for which preparation is + * not defined. + * The test consists of: + * debugger application - definedclasses003, + * debuggee application - definedclasses003a, + * custom-loaded class in the debuggee - definedclasses003b. + * All classes belong to 'nsk.jdi.ClassLoaderReference.definedClasses' package. + * The 'definedclasses003b' class is loaded in debuggee by custom + * 'definedclasses003aClassLoader' loader via invocation of Class.forName method. + * The debugger gets ClassLoaderReference of custom class loader. The test fails if + * reference for 'definedclasses003b' class is not found in list returned by + * definedClasses() method or there is reference to another class in the list. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.definedClasses.definedclasses003 + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/loadclass/definedclasses003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/loadclass/definedclasses003b.java new file mode 100644 index 00000000000..58a33a4af3c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/loadclass/definedclasses003b.java @@ -0,0 +1,29 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +/** + * This class is loaded by definedclasses003aClassLoader . + */ +class definedclasses003b { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/loadclass/definedclasses003c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/loadclass/definedclasses003c.java new file mode 100644 index 00000000000..9b471749433 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/loadclass/definedclasses003c.java @@ -0,0 +1,29 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +/** + * This class should not be loaded by definedclasses003aClassLoader . + */ +class definedclasses003c { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003a.java new file mode 100644 index 00000000000..5fd16fd24a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003a.java @@ -0,0 +1,156 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * The debugged applcation of the test. + */ +public class definedclasses003a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + private final static String prefix = "nsk.jdi.ClassLoaderReference.definedClasses."; + private final static String checkedClassName = prefix + "definedclasses003b"; + static definedclasses003aClassLoader customClassLoader; + static Class loadedClass; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) throws ClassNotFoundException { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + String checkedClassDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + customClassLoader = new definedclasses003aClassLoader(checkedClassDir); + + loadedClass = Class.forName(checkedClassName, true, customClassLoader); + + // ensure that class was loaded by custom class loader + if (!(loadedClass.getClassLoader() instanceof definedclasses003aClassLoader)) { + throw new Failure("Default system loader was used to load class " + checkedClassName); + } + + display ("Checked class loaded: " + checkedClassName); + + pipe.println(definedclasses003.SIGNAL_READY); + + receiveSignal(definedclasses003.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +/** + * Custom class loader. + */ +class definedclasses003aClassLoader extends ClassLoader { + + private String classPath; + + public definedclasses003aClassLoader(String classPath) { + super(definedclasses003aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + protected synchronized Class findClass(String name) throws ClassNotFoundException { + String classFileName = classPath + "/" + name.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(name, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004.java new file mode 100644 index 00000000000..00b41dc9e51 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004.java @@ -0,0 +1,134 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class definedclasses004 { + + //------------------------------------------------------- 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.ClassLoaderReference.definedClasses."; + private final static String className = "definedclasses004"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + display("Getting ClassLoaderReference of class : " + debuggeeName); + ClassLoaderReference classLoader = debuggeeClass.classLoader(); + if (classLoader == null) { + complain("classLoader() method returned null for ReferenceType mirror of : " + debuggeeName); + exitStatus = Consts.TEST_FAILED; + } else { + display("Getting definedClasses() list of : " + classLoader ); + Iterator definedClasses = classLoader.definedClasses().iterator(); + display("Checking isPrepared() result for ReferenceType's in the list..."); + int count = 0; + while (definedClasses.hasNext()) { + ReferenceType refType = (ReferenceType)definedClasses.next(); + count++; + if (!(refType instanceof ArrayType)) { + if (!refType.isPrepared()) { + complain("isPrepared() returned false for : " + refType); + exitStatus = Consts.TEST_FAILED; + } + } + } + display("Total number of items in definedClasses() list : " + count); + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004/TestDescription.java new file mode 100644 index 00000000000..b0717970a36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004/TestDescription.java @@ -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/ClassLoaderReference/definedClasses/definedclasses004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that an implementation of the + * com.sun.jdi.ClassLoaderReference.definedClasses method conforms + * with its spec. + * The test verifies an assertion: + * public List definedClasses() + * Returns a list of all loaded classes that were defined by this class + * loader. No ordering of this list guaranteed. + * The returned list will include reference types loaded at least to the + * point of preparation and types (like array) for which preparation is + * not defined. + * The test consists of: + * debugger application - definedclasses004, + * debuggee application - definedclasses004a, + * custom-loaded class in the debuggee - definedclasses004b. + * All classes belong to 'nsk.jdi.ClassLoaderReference.definedClasses' package. + * The debugger gets ClassLoaderReference of debuggee class loader. + * The test fails if isPrepared() method returns false for any + * ReferenceType item in the list returned by definedClasses() method. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.definedClasses.definedclasses004 + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004a.java new file mode 100644 index 00000000000..cd34e80b536 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004a.java @@ -0,0 +1,90 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged applcation of the test. + */ +public class definedclasses004a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(definedclasses004.SIGNAL_READY); + + receiveSignal(definedclasses004.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(exitStatus + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005.java new file mode 100644 index 00000000000..f7f9f84536b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005.java @@ -0,0 +1,164 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class definedclasses005 { + + //------------------------------------------------------- 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.ClassLoaderReference.definedClasses."; + private final static String className = "definedclasses005"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String classLoaderName = prefix + "fields002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + while (true) { + Field classField = debuggeeClass.fieldByName(classFieldName); + if ( classField == null) { + complain("Checked field is not found in the debuggee: " + classFieldName); + exitStatus = Consts.TEST_FAILED; + break; + } + + Value classValue = debuggeeClass.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + complain("Unexpected exception while getting ClassObjectReference : " + e.getMessage()); + exitStatus = Consts.TEST_FAILED; + break; + } + + ReferenceType refType1 = classObjRef.reflectedType(); + display("isPrepared() returned " + refType1.isPrepared() + " for " + refType1); + + display("Getting ClassLoaderReference of ReferenceType: " + refType1 ); + ClassLoaderReference classLoader = refType1.classLoader(); + if (classLoader == null) { + complain("classLoader() method returned null for ReferenceType: " + refType1); + exitStatus = Consts.TEST_FAILED; + break; + } + + display("Getting definedClasses list."); + Iterator definedClasses = classLoader.definedClasses().iterator(); + display("Checking returned list..."); + while (definedClasses.hasNext()) { + ReferenceType refType = (ReferenceType)definedClasses.next(); + if (refType.equals(refType1)) { + if (refType.isPrepared()) { + display("isPrepared() returned true for " + refType); + } else { + complain("Not-prepared ReferenceType : " + refType + "\n\t is found in definedClasses() list of " + classLoaderName + " mirror."); + exitStatus = Consts.TEST_FAILED; + } + } else { + complain("Unexpected ReferenceType : " + refType + "\n\t is found in definedClasses() list of " + classLoaderName + " mirror."); + exitStatus = Consts.TEST_FAILED; + } + } + break; + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/TestDescription.java new file mode 100644 index 00000000000..825ae938354 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/TestDescription.java @@ -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/ClassLoaderReference/definedClasses/definedclasses005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that an implementation of the + * com.sun.jdi.ClassLoaderReference.definedClasses method conforms + * with its spec. + * The test verifies an assertion: + * public List definedClasses() + * Returns a list of all loaded classes that were defined by this class + * loader. No ordering of this list guaranteed. + * The returned list will include reference types loaded at least to the + * point of preparation and types (like array) for which preparation is + * not defined. + * The test consists of: + * debugger application - definedclasses005, + * debuggee application - definedclasses005a, + * custom-loaded class in the debuggee - definedclasses005b. + * All classes belong to 'nsk.jdi.ClassLoaderReference.definedClasses' package. + * The 'definedclasses005b' class is loaded in debuggee by custom + * 'definedclasses005aClassLoader' loader until a preparation point. + * The debugger gets ClassLoaderReference of custom class loader. The test fails + * if reference for 'definedclasses005b' class is found in list returned by + * definedClasses() method. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.definedClasses.definedclasses005 + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses005a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.definedClasses.definedclasses005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/loadclass/definedclasses005b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/loadclass/definedclasses005b.java new file mode 100644 index 00000000000..04ed757e9db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/loadclass/definedclasses005b.java @@ -0,0 +1,29 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +/** + * This class is loaded by definedclasses005aClassLoader until preparation. + */ +class definedclasses005b { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005a.java new file mode 100644 index 00000000000..65dbc756f1b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005a.java @@ -0,0 +1,160 @@ +/* + * 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.ClassLoaderReference.definedClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * The debugged applcation of the test. + */ +public class definedclasses005a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + private final static String prefix = "nsk.jdi.ClassLoaderReference.definedClasses."; + private final static String checkedClassName = prefix + "definedclasses005b"; + static definedclasses005aClassLoader customClassLoader; + static Class loadedClass; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) throws ClassNotFoundException { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + String checkedClassDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + customClassLoader = new definedclasses005aClassLoader(checkedClassDir); + + loadedClass = customClassLoader.preloadClass(checkedClassName); + + // ensure that class was loaded by custom class loader + if (!(loadedClass.getClassLoader() instanceof definedclasses005aClassLoader)) { + throw new Failure("Default system loader was used to load class " + checkedClassName); + } + + display ("Checked class loaded but not prepared: " + checkedClassName); + + pipe.println(definedclasses005.SIGNAL_READY); + + receiveSignal(definedclasses005.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +/** + * Custom class loader. + */ +class definedclasses005aClassLoader extends ClassLoader { + + private String classPath; + + public definedclasses005aClassLoader(String classPath) { + super(definedclasses005aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public Class preloadClass (String className) throws ClassNotFoundException { + return findClass(className); + } + + protected synchronized Class findClass(String name) throws ClassNotFoundException { + String classFileName = classPath + "/" + name.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(name, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001.java new file mode 100644 index 00000000000..9670dba51e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001.java @@ -0,0 +1,499 @@ +/* + * 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.ClassLoaderReference.visibleClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassLoader.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassLoader.visibleClasses()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Returns a list of all classes for which this class loader
    + * has been recorded as the initiating loader in the target VM.
    + * The list contains ReferenceTypes defined directly by
    + * this loader (as returned by definedClasses()) and
    + * any types for which loading was delegated by
    + * this class loader to another class loader.
    + *
    + * The case to check includes a class loader with no
    + * delegated types, that is, the expected returned value should
    + * be equal to one returned by ClassLoader.definedClasses(),
    + * except primitive arrays defined by bootstrap class loader
    + * and visible.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a ClassLoader object and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class visibleclasses001 { + + //----------------------------------------------------- template section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- template parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new visibleclasses001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + static List primitiveArraysNamesPatterns = Arrays.asList(new String[] { + "^boolean(\\[\\])+", "^byte(\\[\\])+", "^char(\\[\\])+", "^int(\\[\\])+", + "^short(\\[\\])+", "^long(\\[\\])+", "^float(\\[\\])+", "^double(\\[\\])+"}); + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # 0"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......getting: List classes = vm.allClasses();"); + List classes = vm.allClasses(); + log2(" classes.size() == " + classes.size()); + + vm.resume(); + breakpointForCommunication(); + + log1(":::::: case: # 1"); + + String ClassLoaderObjName = "classLoader"; + + log2("......getting: Value val = debuggeeClass.getValue(debuggeeClass.fieldByName(ClassLoaderObjName));"); + Value val = debuggeeClass.getValue(debuggeeClass.fieldByName(ClassLoaderObjName)); + + log2("......getting: ClassLoaderReference clRef = (ClassLoaderReference) val;"); + ClassLoaderReference clRef = (ClassLoaderReference) val; + + log2("......getting: List definedClasses = clRef.definedClasses();"); + List definedClasses = clRef.definedClasses(); + + log2("......getting: List visibleClasses = clRef.visibleClasses();"); + List visibleClasses = clRef.visibleClasses(); + + log2("......checking up on: visibleClasses.size() == definedClasses.size()"); + + if (visibleClasses.size() != definedClasses.size()) { + log2(" : visibleClasses.size() != definedClasses.size()"); + log2(" : definedClasses.size() == " + definedClasses.size()); + log2(" : visibleClasses.size() == " + visibleClasses.size()); + + for (ReferenceType vcl : visibleClasses) { + + int vclIndex = visibleClasses.indexOf(vcl); + String vclName = vcl.name(); + + if (primitiveArraysNamesPatterns.stream().anyMatch(vcl.name()::matches)) { + log2(" : visibleClasses[" + vclIndex + "].name() == " + vclName + + " Correct - primitive arrays are visible for class loader"); + } else { + log3(" : visibleClasses[" + vclIndex + "].name() == " + vclName); + + classes.stream().filter(cl -> cl.name().equals(vclName)) + .forEach(cl -> log3(" : List classes contains an object with the name: " + cl.name())); + + testExitCode = FAILED; + } + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001/TestDescription.java new file mode 100644 index 00000000000..6379024e7ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001/TestDescription.java @@ -0,0 +1,100 @@ +/* + * 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/ClassLoaderReference/visibleClasses/visibleclasses001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassLoader. + * The test checks up that a result of the method + * com.sun.jdi.ClassLoaderReference.visibleClasses() + * complies with its spec: + * public List visibleClasses() + * Returns a list of all classes for which this class loader has been recorded + * as the initiating loader in the target VM. The list contains + * ReferenceTypes defined directly by this loader + * (as returned by definedClasses()) and any types for which loading was + * delegated by this class loader to another class loader. + * The visible class list has useful properties with respect to + * the type namespace. A particular type name will occur at most once in + * the list. Each field or variable declared with that type name in + * a class defined by this class loader must be resolved to that single type. + * No ordering of the returned list is guaranteed. + * See the revised Java Virtual Machine Specification section 5.3 + * Creation and Loading for more information on the initiating classloader. + * Note that unlike definedClasses() and VirtualMachine.allClasses(), + * some of the returned reference types may not be prepared. + * Attempts to perform some operations on unprepared reference types + * (e.g. fields()) will throw a ClassNotPreparedException. + * Use ReferenceType.isPrepared() to determine if a reference type is prepared. + * Returns: + * a List of ReferenceType objects mirroring classes initiated by + * this class loader. The list has length 0 if no classes are + * visible to this classloader. + * The test checks up on the following assertion: + * Returns a list of all classes for which this class loader + * has been recorded as the initiating loader in the target VM. + * The list contains ReferenceTypes defined directly by + * this loader (as returned by definedClasses()) and + * any types for which loading was delegated by + * this class loader to another class loader. + * The case to check includes a class loader with no + * delegated types, that is, the expected returned value should + * be equal to one returned by ClassLoaderReference.definedClasses(). + * The test works as follows: + * The debugger program - nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses001; + * the debuggee program - nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test fixed due to test RFE: + * 4842009 TEST_RFE: Incorrect package name in two JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses001 + * nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001a.java new file mode 100644 index 00000000000..3e8c282b9e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001a.java @@ -0,0 +1,128 @@ +/* + * 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.ClassLoaderReference.visibleClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.net.URLClassLoader; +import java.net.URL; + +/** + * This class is used as debuggee application for the visibleclasses001 JDI test. + */ + +public class visibleclasses001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static ClassLoader classLoader = null; + + static String urlString = "http://x.y.z/"; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + case 1: + try { + URL[] url = { new URL(urlString) } ; + classLoader = new URLClassLoader(url); + } catch ( Exception e ) { + log1("Exception : " + e); + } + + methodForCommunication(); + break ; + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002.java new file mode 100644 index 00000000000..836b3c1ae5f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002.java @@ -0,0 +1,161 @@ +/* + * 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.ClassLoaderReference.visibleClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class visibleclasses002 { + + //------------------------------------------------------- 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.ClassLoaderReference.visibleClasses."; + private final static String className = "visibleclasses002"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + display("Getting ClassLoaderReference of debuggee's class."); + ClassLoaderReference classLoader = debuggeeClass.classLoader(); + if (classLoader == null) { + complain("classLoader() method returned null for debuggee's ReferenceType."); + exitStatus = Consts.TEST_FAILED; + } else { + display("Getting visibleClasses list."); + Iterator visibleClasses = classLoader.visibleClasses().iterator(); + boolean found0 = false; + boolean found1 = false; + boolean found2 = false; + display("Searching for debuggee's ReferenceType in the list..."); + while (visibleClasses.hasNext()) { + ReferenceType refType = (ReferenceType)visibleClasses.next(); + if (refType.equals(debuggeeClass)) { + display("visibleclasses002a ClassType is found in visibleClasses() list of ClassLoaderReference mirror."); + found0 = true; + } else if (refType instanceof ArrayType) { + Type compType; + try { + compType = ((ArrayType)refType).componentType(); + if (compType instanceof ClassType && ((ReferenceType)compType).equals(debuggeeClass)) { + display("visibleclasses002a[] ArrayType is found in visibleClasses() list of ClassLoaderReference mirror."); + found1 = true; + } else if (compType instanceof ArrayType) { + compType = ((ArrayType)compType).componentType(); + if (compType instanceof ClassType && ((ReferenceType)compType).equals(debuggeeClass)) { + display("visibleclasses002a[][] ArrayType is found in visibleClasses() list of ClassLoaderReference mirror."); + found2 = true; + } + } + } catch (ClassNotLoadedException e) { + throw new Failure("Unexpected ClassNotLoadedException while getting componentType() of : " + refType); + } + + } + } + if (!found0) { + complain("visibleclasses002a ReferenceType is NOT found in visibleClasses() list of ClassLoaderReference mirror."); + exitStatus = Consts.TEST_FAILED; + } + if (!found1) { + complain("visibleclasses002a[] ArrayType is NOT found in visibleClasses() list of ClassLoaderReference mirror."); + exitStatus = Consts.TEST_FAILED; + } + if (!found2) { + complain("visibleclasses002a[][] ArrayType is NOT found in visibleClasses() list of ClassLoaderReference mirror."); + exitStatus = Consts.TEST_FAILED; + } + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002/TestDescription.java new file mode 100644 index 00000000000..a3bdb1ebe20 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002/TestDescription.java @@ -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/ClassLoaderReference/visibleClasses/visibleclasses002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * COMMENTS: + * The test checks up that an implementation of the + * com.sun.jdi.ClassLoaderReference.visibleClasses method conforms + * with its spec. + * The test verifies an assertion: + * public List visibleClasses() + * Returns a list of all classes for which this class loader has been + * recorded as the initiating loader in the target VM. The list contains + * ReferenceTypes defined directly by this loader (as returned by + * definedClasses()) and any types for which loading was delegated by this + * class loader to another class loader. + * The test consists of: + * debugger - nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses002 + * debuggee - nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses002a + * The main method of debuggee class defines local variables of single- and + * two-dimensional array of 'visibleclasses002a' type. The debugger gets + * a ClassLoaderReference of debuggee class loader. The tests fails if + * either debuggee class reference or array type references are not found + * in the list returned by visibleClasses() method. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses002 + * nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassLoaderReference.visibleClasses.visibleclasses002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002a.java new file mode 100644 index 00000000000..fd8a58e9a63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002a.java @@ -0,0 +1,93 @@ +/* + * 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.ClassLoaderReference.visibleClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged applcation of the test. + */ +public class visibleclasses002a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + visibleclasses002a[] arr1 = {}; + visibleclasses002a[][] arr2 = {arr1}; + + try { + pipe.println(visibleclasses002.SIGNAL_READY); + + receiveSignal(visibleclasses002.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(exitStatus + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001.java new file mode 100644 index 00000000000..e807eaa15e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001.java @@ -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.ClassObjectReference.reflectedType; + +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 reflectedType() + * of the JDI interface ClassObjectReference of com.sun.jdi package + */ + +public class reflectype001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ClassObjectReference.reflectedType.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "reflectype001", + debugeeName = thisClassName + "a"; + + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + + {"boolean", "primitive_type", "class"}, + {"byte" , "primitive_type", "class"}, + {"char" , "primitive_type", "class"}, + {"double" , "primitive_type", "class"}, + {"float" , "primitive_type", "class"}, + {"int" , "primitive_type", "class"}, + {"long" , "primitive_type", "class"}, + + {"java.lang.Boolean" , "reference_type", "class"}, + {"java.lang.Byte" , "reference_type", "class"}, + {"java.lang.Character", "reference_type", "class"}, + {"java.lang.Double" , "reference_type", "class"}, + {"java.lang.Float" , "reference_type", "class"}, + {"java.lang.Integer" , "reference_type", "class"}, + {"java.lang.Long" , "reference_type", "class"}, + {"java.lang.String" , "reference_type", "class"}, + {"java.lang.Object" , "reference_type", "class"}, + + {debugeeName+"$s_class", "reference_type", "class"}, // static class + {debugeeName+"$s_interf", "reference_type", "interface"}, // static interface + + {package_prefix + "package_class", "reference_type", "class"}, // class + {package_prefix + "package_interf", "reference_type", "interface"} // interface + + }; + + /** + * Re-call to run(args,out), 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 reflectype001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ClassObjectReference/reflectedType/reflectype001 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ClassObjectReference/reflectedType/reflectype001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + 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/ClassObjectReference/reflectedType/reflectype001 test LOG:"); + logHandler.display("==> test checks reflectedType() method of ClassObjectReference interface "); + logHandler.display(" of the com.sun.jdi package for ArraType, ClassType, InterfaceType\n"); + + + debugee.redirectStderr(out); + print_log_on_verbose("--> reflectype001: reflectype001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + logHandler.complain + ("##> reflectype001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + logHandler.complain + ("##> reflectype001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> reflectype001: debugee's \"ready\" signal recieved!"); + } + + logHandler.display + ("--> reflectype001: check ClassObjectReference.reflectedType() method for debugee's classes..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int classObject_method_errors = 0; + for (int i=0; i reflectype001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String s_type = classes_for_check[i][2]; + if ( array_measure != 0 ) { // array type + s_type = "class"; + } + ClassObjectReference class_obj_ref = refType.classObject(); + ReferenceType reflected_refType = class_obj_ref.reflectedType(); + if ( ! refType.equals(reflected_refType) ) { + logHandler.complain + ("##> reflectype001: FAILED: source ReferenceType object is NOT equal to reflected object"); + logHandler.complain + ("##> for " + s_type + ": " + className); + classObject_method_errors++; + } + else { + print_log_on_verbose + ("--> reflectype001: PASSED: source ReferenceType object is equal to reflected object"); + print_log_on_verbose + ("--> for " + s_type + ": " + className); + } + } + } + logHandler.display("--> reflectype001: check completed!"); + logHandler.display("--> reflectype001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + logHandler.complain("##> reflectype001: \"class not found ERRORS\" counter = " + + class_not_found_errors); + } + logHandler.display("##> reflectype001: classObject() method ERRORS counter = " + + classObject_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + classObject_method_errors > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> reflectype001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + logHandler.complain + ("##> reflectype001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> reflectype001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001/TestDescription.java new file mode 100644 index 00000000000..4d107efecb2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ClassObjectReference/reflectedType/reflectype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ClassObjectReference/reflectedType/reflectype001 test + * checks the reflectedType() method of ClassObjectReference interface + * of the com.sun.jdi package for ArraType, ClassType, InterfaceType: + * The ClassObjectReference.reflectedType() method is checked for debugee's classes + * by comparing source ReferenceType object with reflected ReferenceType object + * returned by ClassObjectReference.reflectedType() method. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * --------- + * To use new share classes, the file reflectype001.java is updated as follows: + * - two lines, 33 and 34, with argsHandler and logHandler are added + * - statements with definitions, lines 105-118, 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.ClassObjectReference.reflectedType.reflectype001 + * nsk.jdi.ClassObjectReference.reflectedType.reflectype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassObjectReference.reflectedType.reflectype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001a.java new file mode 100644 index 00000000000..6281bfc52af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype001a.java @@ -0,0 +1,117 @@ +/* + * 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.ClassObjectReference.reflectedType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the reflectype001 JDI test. + */ + +public class reflectype001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + 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}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static class s_class {} + static interface s_interf {} + protected static class s_interf_impl implements s_interf {} + s_interf_impl sii0 = new s_interf_impl(); + + s_class s_class0 = new s_class(), s_class1[]={s_class0}, + s_class2[][]={s_class1}; + s_interf s_interf0, s_interf1[]={s_interf0}, s_interf2[][]={s_interf1}; + + package_class package_class0 = new package_class(), + package_class1[]={package_class0}, + package_class2[][]={package_class1}; + class package_interf_impl implements package_interf {} + package_interf_impl pii0 = new package_interf_impl(); + package_interf package_interf0, package_interf1[]={package_interf0}, + package_interf2[][]={package_interf1}; + 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 reflectype001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + reflectype001a reflectype001a_obj = new reflectype001a(); + + print_log_on_verbose("**> reflectype001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> reflectype001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> reflectype001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> reflectype001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> reflectype001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** simple class */ +class package_class {} + +/** simple interface */ +interface package_interf {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java new file mode 100644 index 00000000000..da528cee5b3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002.java @@ -0,0 +1,258 @@ +/* + * 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.ClassObjectReference.reflectedType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +/** + * This test checks the method reflectedType() + * of the JDI interface ClassObjectReference of com.sun.jdi package + */ + +public class reflectype002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ClassObjectReference.reflectedType.", + thisClassName = package_prefix + "reflectype002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "reflectype002b"; + + + /** + * Re-call to run(args,out), 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 reflectype002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ClassObjectReference/reflectedType/reflectype002 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdiClassObjectReference/reflectedType/reflectype002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ClassObjectReference/reflectedType/reflectype002 test LOG:"); + out_stream.println("--> test checks reflectedType() method of ClassObjectReference interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> reflectype002: reflectype002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> reflectype002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> reflectype002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> reflectype002: debugee's \"ready0\" signal recieved!"); + } + + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> reflectype002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> reflectype002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> reflectype002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean reflectedType_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> reflectype002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> reflectype002: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> reflectype002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> reflectype002: checked class FOUND: " + checked_class); + } + + print_log_on_verbose + ("--> reflectype002: getting ClassObjectReference object for loaded checked class..."); + ClassObjectReference class_obj_ref = refType.classObject();; + print_log_on_verbose("--> reflectype002: getting ClassObjectReference object - DONE!"); + + print_log_on_verbose + ("--> reflectype002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> reflectype002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> reflectype002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ClassObjectReference.reflectedType() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> reflectype002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> reflectype002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> reflectype002: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> reflectype002: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> reflectype002: check that checked class has been unloaded realy..."); + out_stream.println + ("--> reflectype002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ClassObjectReference.reflectedType() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> reflectype002: check ClassObjectReference.reflectedType() method for unloaded class..."); + try { + refType2 = class_obj_ref.reflectedType(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> reflectype002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> reflectype002: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + reflectedType_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || reflectedType_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> reflectype002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> reflectype002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> reflectype002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of reflectype002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TestDescription.java new file mode 100644 index 00000000000..ab1416ed8d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TestDescription.java @@ -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/ClassObjectReference/reflectedType/reflectype002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ClassObjectReference/reflectedType/reflectype002 test + * checks the reflectedType() method of ClassObjectReference interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then gets a ClassObjectReference instance, then enforces + * the class to be unloaded and calls the reflectedType() method - + * the com.sun.jdi.ObjectCollectedException should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme to have separate +* directory for precompiled classes: + * - reflectype002b class was moved in 'loadclass' subdirectory; + * - package name was added in reflectype002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for reflectype002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassObjectReference.reflectedType.reflectype002 + * nsk.jdi.ClassObjectReference.reflectedType.reflectype002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassObjectReference.reflectedType.reflectype002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/loadclass/reflectype002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/loadclass/reflectype002b.java new file mode 100644 index 00000000000..4df4167218d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/loadclass/reflectype002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the reflectedType() method of ClassObjectReference interface for UNLOADED class + +package nsk.jdi.ClassObjectReference.reflectedType; + +class reflectype002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002a.java new file mode 100644 index 00000000000..0f5cda75751 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002a.java @@ -0,0 +1,118 @@ +/* + * 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.ClassObjectReference.reflectedType; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the reflectype002 JDI test. + */ + +public class reflectype002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ClassObjectReference.reflectedType."; + private final static String checked_class_name = package_prefix + "reflectype002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> reflectype002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + pipe.println("ready0"); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + print_log_on_verbose("**> reflectype002a: waiting for \"checked class dir\" info..."); + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> reflectype002a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> reflectype002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> reflectype002a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> reflectype002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> reflectype002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> reflectype002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("##> reflectype002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("##> reflectype002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> reflectype002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> reflectype002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> reflectype002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> reflectype002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> reflectype002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> reflectype002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> reflectype002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> reflectype002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> reflectype002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of reflectype002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001.java new file mode 100644 index 00000000000..0f66d1e01bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001.java @@ -0,0 +1,190 @@ +/* + * 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.ClassObjectReference.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class tostring001 { + + //------------------------------------------------------- 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.ClassObjectReference.toString."; + private final static String className = "tostring001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + /** debuggee's methods for check **/ + private final static String checkedClasses[] = { + "java.lang.Boolean" , + "java.lang.Byte" , + "java.lang.Character", + "java.lang.Double" , + "java.lang.Float" , + "java.lang.Integer" , + "java.lang.Long" , + "java.lang.Short" , + "java.lang.String" , + "java.lang.Object" , + + debuggeeName + "$innerClass", + debuggeeName + "$innerInterf", + prefix + "tostring001aClass", + prefix + "tostring001aInterf" + }; + + //------------------------------------------------------- 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + tostring001a.brkpMethodName, + tostring001a.brkpLineNumber); + debuggee.resume(); + + debuggee.sendSignal(SIGNAL_GO); + Event event = null; + + // waiting the breakpoint event + try { + event = debuggee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (!(event instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + ThreadReference thread = ((BreakpointEvent)event).thread(); + List params = new Vector(); + ClassType testedClass = (ClassType)debuggeeClass; + + display("Checking toString() method for ClassObjectReferences of debuggee's fields..."); + String brackets[] = {"", "[]", "[][]"}; + + for (int i=0; i < checkedClasses.length; i++) { + + String basicName = checkedClasses[i]; + + for (int dim = 0; dim<3; dim++) { + + String className = basicName + brackets[dim]; + ReferenceType refType = debuggee.classByName(className); + if (refType == null) { + complain("Could NOT FIND class: " + className); + exitStatus = Consts.TEST_FAILED; + continue; + } + + try { + ClassObjectReference classObjRef = refType.classObject(); + String str = classObjRef.toString(); + if (str == null) { + complain("toString() returns null for ClassObjectReferences of debugges's field: " + className); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for ClassObjectReferences of debugges's field: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() method returns for " + className + " : " + str); + } + } catch(Exception e) { + complain("unexpected " + e + " while taking ClassObjectReferences of debugges's field: " + className); + exitStatus = Consts.TEST_FAILED; + } + } + } + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..f2ad8f6687c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ClassObjectReference/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.ClassObjectReference interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * for a ClassObjectReference object of a debuggee class's field. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for ClassObjectReference + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassObjectReference.toString.tostring001 + * nsk.jdi.ClassObjectReference.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassObjectReference.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001a.java new file mode 100644 index 00000000000..7764bff0268 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001a.java @@ -0,0 +1,136 @@ +/* + * 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.ClassObjectReference.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged applcation of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 121; + + // 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}; + Short H0 = new Short((short)-1), H1[]={H0}, H2[][]={H1}; + String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1}; + Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static class innerClass {} + static interface innerInterf {} + protected static class innerInterfImpl implements innerInterf {} + innerInterfImpl sii0 = new innerInterfImpl(); + + innerClass innerClass0 = new innerClass(); + innerClass innerClass1[] = {innerClass0}; + innerClass innerClass2[][] = {innerClass1}; + + innerInterf innerInterf0; + innerInterf innerInterf1[] = {innerInterf0}; + innerInterf innerInterf2[][] = {innerInterf1}; + + tostring001aClass tostring001aClass0 = new tostring001aClass(); + tostring001aClass tostring001aClass1[] = {tostring001aClass0}; + tostring001aClass tostring001aClass2[][] = {tostring001aClass1}; + + class tostring001aInterfImpl implements tostring001aInterf {} + tostring001aInterfImpl pii0 = new tostring001aInterfImpl(); + tostring001aInterf tostring001aInterf0; + tostring001aInterf tostring001aInterf1[] = {tostring001aInterf0}; + tostring001aInterf tostring001aInterf2[][] = {tostring001aInterf1}; + + //------------------------------------------------------ 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); + + tostring001a dummy = new tostring001a(); + + try { + pipe.println(tostring001.SIGNAL_READY); + receiveSignal(tostring001.SIGNAL_GO); + log.display("breakpoint line"); // brkpLineNumber + receiveSignal(tostring001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods +} + +//--------------------------------------------------------- test specific classes +class tostring001aClass {} +interface tostring001aInterf {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/referenceType/refType001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/referenceType/refType001.java new file mode 100644 index 00000000000..e576e58be4c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/referenceType/refType001.java @@ -0,0 +1,324 @@ +/* + * 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.ClassPrepareEvent.referenceType; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class refType001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_DONE = "done"; + static final String COMMAND_ERROR = "error"; + + static final String PACKAGE_NAME = "nsk.jdi.ClassPrepareEvent.referenceType"; + static final String DEBUGEE_NAME = PACKAGE_NAME + ".refType001a"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + + static private ClassPrepareRequest checkedRequest; + static private ThreadReference debuggeeThread; + static private volatile String checkedTypes[][] = { + {"main", "refType001a", "0"}, + {"main", "AnotherThread", "0"}, + {"AnotherThread", "ClassForAnotherThread", "0"}, + {"AnotherThread", "Inter", "0"} + }; + + static private volatile boolean testFailed, eventsReceived, threadsStarted; + static private int eventTimeout; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + String command; + + testFailed = false; + eventsReceived = false; + threadsStarted = false; + + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debugee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGEE_NAME); + debuggee.redirectStderr(log, "refType001a >"); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // create request and wait for expected events + try { + + // create request for ClassPrepareEvent + log.display("Creating request for ClassPrepareEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + if ((checkedRequest = erManager.createClassPrepareRequest()) == null) { + throw new Failure("TEST FAILED: unable to create ClassPrepareRequest"); + } + log.display("ClassPrepareRequest is created"); + + // define separate thread to handle received events + class EventHandler extends Thread { + + public void run() { + + // handle events until all threads started and all expected events received + while (!(threadsStarted && eventsReceived)) { + EventSet eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while receiving events: " + e); + } + + if (eventSet == null) { + continue; + } + + // handle each event + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); +// log.display("\nEvent received:\n " + event); + + // handle ClassPrepareEvent + if (event instanceof ClassPrepareEvent) { + ClassPrepareEvent castedEvent = (ClassPrepareEvent)event; + log.display("\nClassPrepareEvent received:\n " + event); + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + debuggeeThread = castedEvent.thread(); + String threadName = debuggeeThread.name(); + + // test ClassPrepareEvent.referenceType() method + ReferenceType refType = castedEvent.referenceType(); + if (refType == null) { + log.complain("FAILURE 3: ClassPrepareEvent.referenceType() returns null"); + testFailed = true; + } else { + + String refName = refType.name(); + if ((refName == null) || (refName.equals(""))) { + log.complain("FAILURE 4: Reference has invalid empty name"); + testFailed = true; + } else { + if ( refName.startsWith(PACKAGE_NAME)) { + log.display("Reference " + refName + " prepared in thread " + threadName); + + // Check that all expected debuggee's thread create ClassPrepareEvent only once + for (int i = 0; i < checkedTypes.length; i++) { + if (threadName.equals(checkedTypes[i][0]) && refName.endsWith(checkedTypes[i][1])) { + if (checkedTypes[i][2] == "0") { + checkedTypes[i][2] = "1"; + } else { + log.complain("FAILURE 5: ClassPrepareEvent for " + threadName + " is received more that once"); + testFailed = true; + } + } + } + + // Check that all static fields in reference type are initialized + Iterator fieldsList; + try { + fieldsList = refType.fields().iterator(); + } catch (ClassNotPreparedException e) { + log.complain( "FAILURE 6: " + refName + " is not prepared"); + testFailed = true; + throw new Failure("ClassNotPrepared exception caught: " + e); + } + while (fieldsList.hasNext()) { + Field refField = (Field)fieldsList.next(); + if (refField.isStatic()) { + if (refField.equals(null)) { + log.complain( "FAILURE 7: " + refField.name() + " of " + refName + " is not initialized"); + testFailed = true; + } + } + } + + // Check that all expected ClassPrepareEvent are received + eventsReceived = true; + for (int i = 0; i < checkedTypes.length; i++) { + if (checkedTypes[i][2] == "0") + eventsReceived = false; + } + } + } + + if (!refType.isPrepared()) { + log.complain("FAILURE 8: Reference " + refName + " is not prepared" ); + testFailed = true; + } + } + } + + // ignore each oter event + + } // event handled + +// log.display("Resuming event set"); + eventSet.resume(); + + } // event set handled + + log.display("eventHandler completed"); + + } // for run() + + } // for EventHandler + + // start EventHandler thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // enable event request and resume debugee + log.display("Enabling ClassPrepareEvent request"); + checkedRequest.enable(); + + log.display("Resuming debuggee"); + debuggee.resume(); + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // force debugee to start another thread + log.display("Sending a command: " + COMMAND_RUN); + pipe.println(COMMAND_RUN); + + // wait for debugee started requested thread + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + log.complain("TEST BUG: unexpected debuggee's command: " + command); + testFailed = true; + } + + // notify EventHandler that all threads started + threadsStarted = true; + + // wait for all expected events received or timeout exceeds + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check that all expected debuggee's threads created ClassPrepareEvent + for (int i = 0; i < checkedTypes.length; i++) { + if (checkedTypes[i][2].equals("0")) { + log.complain("FAILURE 9: ClassPrepareEvent for " + checkedTypes[i][1] + + " in thread " + checkedTypes[i][0] + " is not received"); + testFailed = true; + } + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + // disable event requests to prevent appearance of further events + if (checkedRequest != null && checkedRequest.isEnabled()) { + log.display("Disabling StepEvent request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/referenceType/refType001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/referenceType/refType001/TestDescription.java new file mode 100644 index 00000000000..11ea84cec54 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/referenceType/refType001/TestDescription.java @@ -0,0 +1,94 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareEvent/referenceType/refType001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.lassPrepareEvent.referenceType() method. + * The test checks the following assertions: + * - ClassPrepareEvent is always received by debugger + * for all prepared classes and interfaces in target VM, + * - ClassPrepareEvent is received only once for each checked + * class or interface + * - method ClassPrepareEvent.referenceType returns valid + * Reference Type in target VM, + * - all static fields and constants are initialized for checked + * prepared class or interface. + * A debugger class - nsk.jdi.ClassPrepareEvent.referenceType.refType001 ; + * a debuggee class - nsk.jdi.ClassPrepareEvent.referenceType.refType001a . + * The test uses supporting nsk/share/jdi classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates ClassPrepareRequest and starts special thread + * for listening events delivered from debuggee. + * The debuger enables ClassPrepareRequest, resumes debuggee and + * waits for command from it. Next, debuugger sends debuggee + * command to force it to start another thread, and waits + * for confirmation . + * The debuggee starts special thread in which instance of + * with a number of static fields, + * waits for thread started and sends debugger command . + * Each event received by debuger is handled by . + * When event is of ClassPrepareEvent and is for checked threads, + * all assertions are verifieded for this event. + * After debuggee received command from debuggee, if notifies + * that all thread have been started in debuggee, + * and waits for all expected events received and finishes. + * If not all expected events has been received for WAITTIME period, + * debugger complains an error and interrupts . + * Finally, debugger disables event request, sends debuggee command "); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // create request and wait for expected events + try { + + // create request for ClassPrepareEvent + log.display("Creating request for ClassPrepareEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + if ((checkedRequest = erManager.createClassPrepareRequest()) == null) { + throw new Failure("TEST FAILED: unable to create ClassPrepareRequest"); + } + log.display("ClassPrepareRequest is created"); + + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); +// checkedRequest.enable(); + + switch (checkedRequest.suspendPolicy()) { + case EventRequest.SUSPEND_NONE: + log.display("Suspend policy is SUSPEND_NONE"); + break; + case EventRequest.SUSPEND_ALL: + log.display("Suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display("Suspend policy is SUSPEND_EVENT_THREAD"); + break; + default: + throw new Failure("TEST BUG: Unknown suspend policy: " + checkedRequest.suspendPolicy()); + } + + // define separate thread to handle received events + class EventHandler extends Thread { + + public void run() { + + // handle events until all threads started and all expected events received + while (!(threadsStarted && eventsReceived)) { + EventSet eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while receiving events: " + e); + } + + if (eventSet == null) { + continue; + } + + // handle each event + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); +// log.display("\nEvent received:\n " + event); + + // handle ClassPrepareEvent + if (event instanceof ClassPrepareEvent) { + ClassPrepareEvent castedEvent = (ClassPrepareEvent)event; + log.display("\nClassPrepareEvent received:\n " + event); + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + // test method ClassPrepareEvent.thread() + eventThread = castedEvent.thread(); + String threadName = eventThread.name(); + if (eventThread == null) { + log.complain("FAILURE 3: ClassPrepareEvent.thread() returns null"); + testFailed = true; + } else if ((threadName == null) || (threadName.equals(""))) { + log.complain("FAILURE 4: thread reference has invalid empty name"); + testFailed = true; + } + + ReferenceType refType = castedEvent.referenceType(); + if (refType == null) { + log.complain("FAILURE 5: ClassPrepareEvent.referenceType() returns null"); + testFailed = true; + } else { + + String className = refType.name(); + if ( className.startsWith(PACKAGE_NAME)) { + + log.display("Class " + className + " prepared in thread " + threadName); + + // Check that thread is in VirtualMachine.allThreads() list + boolean found = false; + Iterator threadsList = vm.allThreads().iterator(); + while (!found && threadsList.hasNext()) { + found = eventThread.equals((ThreadReference)threadsList.next()); + } + if (!found) { + log.complain("FAILURE 6: " + threadName + " is not in debuggee's allThreads() list"); + testFailed = true; + } + + // Check that all expected debuggee's thread create ClassPrepareEvent only once + for (int i = 0; i < checkedThreads.length; i++) { + if (threadName.equals(checkedThreads[i][0]) && className.endsWith(checkedThreads[i][1])) { + if (checkedThreads[i][2] == "0") { + checkedThreads[i][2] = "1"; + } else { + log.complain("FAILURE 7: ClassPrepareEvent for " + threadName + " is received more that once"); + testFailed = true; + } + } + } + + // check that thread is correctly suspended + if (checkedRequest.suspendPolicy() == EventRequest.SUSPEND_ALL || + checkedRequest.suspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD) { + + if (eventThread.isSuspended()) { + log.display("Thread " + threadName + " is correctly suspended"); + } else { + log.complain("FAILURE 7: Thread " + threadName + " is not suspended"); + testFailed = true; + } + } + + // Check that all expected ClassPrepareEvent are received + eventsReceived = true; + for (int i = 0; i < checkedThreads.length; i++) { + if (checkedThreads[i][2] == "0") { + eventsReceived = false; + } + } + } + } + } + + // ignore each oter event + + } // event handled + +// log.display("Resuming event set"); + eventSet.resume(); + + } // event set handled + + log.display("eventHandler completed"); + + } // for run() + + } // for EventHandler + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // enable event request and resume debugee + log.display("Enabling ClassPrepareEvent request"); + checkedRequest.enable(); + + log.display("Resuming debuggee"); + debuggee.resume(); + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // force debugee to start another thread + log.display("Sending a command: " + COMMAND_RUN); + pipe.println(COMMAND_RUN); + + // wait for debugee started requested thread + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + log.complain("TEST BUG: unexpected debuggee's command: " + command); + testFailed = true; + } + + // notify EventHandler that all threads started + threadsStarted = true; + + // wait for all expected events received or timeout exceeds + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check that all expected debuggee's threads created ClassPrepareEvent + for (int i = 0; i < checkedThreads.length; i++) { + if (checkedThreads[i][2].equals("0")) { + log.complain("FAILURE 9: ClassPrepareEvent for " + checkedThreads[i][1] + + " in thread " + checkedThreads[i][0] + " is not received"); + testFailed = true; + } + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + + // disable event requests to prevent appearance of further events + if (checkedRequest != null && checkedRequest.isEnabled()) { + log.display("Disabling StepEvent request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..609d193db0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareEvent/thread/thread001/TestDescription.java @@ -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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareEvent/thread/thread001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.ClassPrepareEvent.thread() method. + * The test checks the following assertions: + * - ClassPrepareEvent is always received by debugger + * for expected classe in proper threads in target VM, + * - ClassPrepareEvent.thread() returns valid ThreadReference + * to checked thread in target VM, + * - ClassPrepareEvent is received only once for each expected class. + * A debugger class - nsk.jdi.ClassPrepareEvent.thread.thread001 ; + * a debuggee class - nsk.jdi.ClassPrepareEvent.thread.thread001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates ClassPrepareRequest and starts special thread + * for listening events delivered from debuggee. + * The debuger enables ClassPrepareRequest, resumes debuggee and + * waits for command from it. Next, debuugger sends debuggee + * command to force it to start another threads, and waits + * for confirmation . + * The debuggee starts inner and outer threads in which instances of + * and created, + * waits for threads started and sends debugger command . + * Each event received by debuger is handled by . + * When event is of ClassPrepareEvent and is for checked threads, + * all assertions are verifieded for this event. + * After debuggee received command from debuggee, if notifies + * that all thread have been started in debuggee, + * and waits for all expected events received and finishes. + * If not all expected events has been received for WAITTIME period, + * debugger complains an error and interrupts . + * Finally, debugger disables event request, sends debuggee command + * - addClassFilter(ReferenceType),
    + * - addClassFilter(String),
    + * - addClassExclusionFilter(String)
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +public class filters001 { + + final static String prefix = "nsk.jdi.ClassPrepareRequest._bounds_."; + private final static String className = "filters001"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType debugeeRef = debugee.classByName(debugeeName); + + display(""); + display(">>>creating ClassPrepareRequest"); + ClassPrepareRequest request = + debugee.getEventRequestManager().createClassPrepareRequest(); + + display(""); + addClassFilter(request, (ReferenceType )null); + display(""); + addClassFilter(request, (String )null); + display(""); + addClassExclusionFilter(request, (String )null); + + display(""); + debugee.quit(); + } + + private void addClassFilter(ClassPrepareRequest request, ReferenceType refType) { + + display("addClassFilter :ReferenceType> null"); + try { + request.addClassFilter(refType); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(ClassPrepareRequest request, String classPattern) { + + display("addClassFilter :classPattern> null"); + try { + request.addClassFilter(classPattern); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(ClassPrepareRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> null"); + try { + request.addClassExclusionFilter(classPattern); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..f165155c808 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/_bounds_/filters001/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ClassPrepareRequest/_bounds_/filters001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.ClassPrepareRequest.addClassFilter(ReferenceType) + * com.sun.jdi.request.ClassPrepareRequest.addClassFilter(String) + * com.sun.jdi.request.ClassPrepareRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up these methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest._bounds_.filters001 + * nsk.jdi.ClassPrepareRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..dfb6d7a4379 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/_bounds_/filters001a.java @@ -0,0 +1,54 @@ +/* + * 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.ClassPrepareRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001.java new file mode 100644 index 00000000000..d684989d4e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001.java @@ -0,0 +1,149 @@ +/* + * 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.ClassPrepareRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * + * The test checks that results of the method + * com.sun.jdi.ClassPrepareRequest.addClassExclusionFilter(String) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The case to check includes a pattern that begins with '*'. + * + * The test works as follows. + * - The debugger + * - sets up a ClassPrepareRequest, + * - using a string pattern, restricts it with addClassExclusionFilter, + * - resumes the debuggee, and waits for ClassPrepareEvents. + * - The debuggee creates and starts a thread1, + * whose 'run' method creates objects of ClassTypes needed + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs the checks required. + */ + +public class filter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter001a"; + return new filter001().runThis(argv, out); + } + + private String classExclFilter1 = "*TestClass11"; + private String classExclName1 = "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.Thread1filter001a.TestClass11"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + String property1 = "ClassPrepareRequest1"; + ThreadReference thread1 = null; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest1 = setting23ClassPrepareRequest(classExclFilter1, + EventRequest.SUSPEND_NONE, + property1); + eventRequest1.enable(); + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof ClassPrepareEvent) { + String str = ((ClassPrepareEvent)event).referenceType().name(); + if (str.endsWith(classExclName1)) { + setFailedStatus("Received unexpected ClassPrepareEvent for excluded class:" + str); + } else { + display("Received expected ClassPrepareEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting for ClassPrepareEvent"); + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ClassPrepareRequest setting23ClassPrepareRequest ( String classExclFilter, + int suspendPolicy, + String property ) + throws Failure { + try { + display("......setting up ClassPrepareRequest:"); + display(" class exclude filter: " + classExclFilter + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.setSuspendPolicy(suspendPolicy); + + cpr.addClassExclusionFilter(classExclFilter); + + display(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ClassPrepareRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..9919c145b81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns that + * begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to test include a pattern that begins with '*'. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter001; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter001 + * nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001a.java new file mode 100644 index 00000000000..e504ba0131e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter001a.java @@ -0,0 +1,168 @@ +/* + * 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.ClassPrepareRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter001 JDI test. + */ + +public class filter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter001a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter001a("thread1"); + log1("run1(thread1);"); + run1(thread1); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class Thread1filter001a extends Thread { + + class TestClass10{ + int var10 = 0; + } + class TestClass11 extends TestClass10{ + int var11 = 0; + } + + String tName = null; + + public Thread1filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + TestClass11 obj1 = new TestClass11(); + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002.java new file mode 100644 index 00000000000..7c0bdb383cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002.java @@ -0,0 +1,149 @@ +/* + * 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.ClassPrepareRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * + * The test checks that results of the method + * com.sun.jdi.ClassPrepareRequest.addClassExclusionFilter(String) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The case to check includes a pattern that ends with '*'. + * + * The test works as follows. + * - The debugger + * - sets up a ClassPrepareRequest, + * - using a string pattern, restricts it with addClassExclusionFilter, + * - resumes the debuggee, and waits for ClassPrepareEvents. + * - The debuggee creates and starts a thread1 + * whose 'run' method creates objects of ClassTypes needed + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs the checks required. + */ + +public class filter002 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter002a"; + return new filter002().runThis(argv, out); + } + + private String classExclFilter1 = "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.Thread1filter002a.TestClass11*"; + private String classExclName1 = "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.Thread1filter002a.TestClass11"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + String property1 = "ClassPrepareRequest1"; + ThreadReference thread1 = null; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest1 = setting23ClassPrepareRequest(classExclFilter1, + EventRequest.SUSPEND_NONE, + property1); + eventRequest1.enable(); + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof ClassPrepareEvent) { + String str = ((ClassPrepareEvent)event).referenceType().name(); + if (str.endsWith(classExclName1)) { + setFailedStatus("Received ClassPrepareEvent for excluded class:" + str); + } else { + display("Received expected ClassPrepareEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting for ClassPrepareEvent"); + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ClassPrepareRequest setting23ClassPrepareRequest ( String classExclFilter, + int suspendPolicy, + String property ) + throws Failure { + try { + display("......setting up ClassPrepareRequest:"); + display(" class exclude filter: " + classExclFilter + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.setSuspendPolicy(suspendPolicy); + + cpr.addClassExclusionFilter(classExclFilter); + + display(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ClassPrepareRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..332ac00462f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns that + * begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to test include a pattern that ends with '*'. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter002; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter002 + * nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002a.java new file mode 100644 index 00000000000..b09f2db5490 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter002a.java @@ -0,0 +1,168 @@ +/* + * 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.ClassPrepareRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter002 JDI test. + */ + +public class filter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter002a("thread1"); + log1("run1(thread1);"); + run1(thread1); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class Thread1filter002a extends Thread { + + class TestClass10{ + int var10 = 0; + } + class TestClass11 extends TestClass10{ + int var11 = 0; + } + + String tName = null; + + public Thread1filter002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter002a.log1(" 'run': enter :: threadName == " + tName); + TestClass11 obj1 = new TestClass11(); + filter002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003.java new file mode 100644 index 00000000000..e852f747349 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003.java @@ -0,0 +1,532 @@ +/* + * 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.ClassPrepareRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassPrepareRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ClassPrepareRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger
    + * - creates an ClassPrepareRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter003a"; + + private String testedClassName1 = + "nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "ClassPrepareRequest1"; + + eventRequest1 = setting22ClassPrepareRequest(testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + + for (int i = 0; ; i++) { + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ClassPrepareRequest setting22ClassPrepareRequest ( String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ClassPrepareRequest:"); + log2(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.setSuspendPolicy(suspendPolicy); + + log2(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingClassPrepareRequest() : " + e); + log3(" ClassPreparenRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003/TestDescription.java new file mode 100644 index 00000000000..64c0a41a9c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassExclusionFilter(String) + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class whose name does not match this restricted regular expression. + * Regular expressions are limited to exact matches and patterns that + * begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter003; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ClassPrepareRequest.addClassExclusionFilter.filter003 + * nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassExclusionFilter.filter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003a.java new file mode 100644 index 00000000000..2eed72a2ecf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassExclusionFilter/filter003a.java @@ -0,0 +1,170 @@ +/* + * 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.ClassPrepareRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter003 JDI test. + */ + +public class filter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + +// static Thread1filter003a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// thread1 = new Thread1filter003a("thread1"); +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ + +} + +/* +class Thread1filter003a extends Thread { + + class TestClass10{ + int var10 = 0; + } + class TestClass11 extends TestClass10{ + int var11 = 0; + } + + + String tName = null; + + public Thread1filter003a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter003a.log1(" 'run': enter :: threadName == " + tName); + TestClass11 obj1 = new TestClass11(); + filter003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} +*/ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001.java new file mode 100644 index 00000000000..03075ec0cec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001.java @@ -0,0 +1,149 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * + * The test checks that results of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter_rt() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to be + * the preparation of the given reference type and any subtypes. + * An event will be generated for any prepared reference type + * that can be safely cast to the given reference type. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a class filter object, to load the Class to + * filter, and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceType for the Class to filter, + * - sets up a ClassPrepareRequest and, using the ReferenceType, + * restricts it to sub-classes of the Class to filter, + * thus restricting the ClassPrepare event only to the thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee creates and starts two threads, thread1 and thread2, + * first of them will create an object of sub-Class to be filtered, + * whereas second will create an object to be not filtered. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class filter_rt001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001a"; + return new filter_rt001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001aTestClass10"; + + + protected void testRun() { + EventRequest eventRequest1 = null; + String property1 = "ClassPrepareRequest1"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = setting21ClassPrepareRequest(testClassReference, + EventRequest.SUSPEND_NONE, property1); + + display("......waiting for ClassPrepareEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ClassPrepareEvent)) { + setFailedStatus("ERROR: new event is not ClassPrepareEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ClassPrepareEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ClassPrepareRequest setting21ClassPrepareRequest ( ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ClassPrepareRequest:"); + display(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + display(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001/TestDescription.java new file mode 100644 index 00000000000..dc823fdde8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001/TestDescription.java @@ -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/ClassPrepareRequest/addClassFilter_rt/filter_rt001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter_rt() + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to be the preparation + * of the given reference type and any subtypes. + * An event will be generated for any prepared reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to be the preparation + * of the given reference type and any subtypes. + * An event will be generated for any prepared reference type + * that can be safely cast to the given reference type. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001 + * nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001a.java new file mode 100644 index 00000000000..80f3c2d6232 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt001a.java @@ -0,0 +1,196 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt001 JDI test. + */ + +public class filter_rt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + filter_rt001aTestClass10 obj = new filter_rt001aTestClass10(); + break; + + + case 1: + filter_rt001aThread1 thread1 = new filter_rt001aThread1("thread1"); + filter_rt001aThread2 thread2 = new filter_rt001aThread2("thread2"); + + log1("new filter_rt001a().run1(thread1);"); + new filter_rt001a().run1(thread1); + + log1("new filter_rt001a().run1(thread2);"); + new filter_rt001a().run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class filter_rt001aTestClass10{ + static int var10 = 0; +} +class filter_rt001aTestClass11 extends filter_rt001aTestClass10{ + static int var11 = 0; +} +class filter_rt001aThread1 extends Thread { + + String tName = null; + + public filter_rt001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + filter_rt001aTestClass11 obj1 = new filter_rt001aTestClass11(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt001aTestClass20 { + static int var20 = 0; +} +class filter_rt001aTestClass21 { + static int var21 = 0; +} +class filter_rt001aThread2 extends Thread { + + String tName = null; + + public filter_rt001aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + filter_rt001aTestClass21 obj2 = new filter_rt001aTestClass21(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002.java new file mode 100644 index 00000000000..49960940b05 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002.java @@ -0,0 +1,540 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassPrepareRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ClassPrepareRequest.addClassFilter_rt()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a class filter object, to load the Class to
    + * filter, and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ClassPrepareRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt002a"; + + private String testedClassName = + "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "ClassPrepareRequest1"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = setting21ClassPrepareRequest(testClassReference, + EventRequest.SUSPEND_NONE, property1); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" no InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ClassPrepareRequest setting21ClassPrepareRequest ( ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ClassPrepareRequest:"); + log2(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); +// cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + log2(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingClassPrepareRequest() : " + e); + log3(" ClassPreparenRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002/TestDescription.java new file mode 100644 index 00000000000..8fbba6c4e12 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter_rt() + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to be the preparation + * of the given reference type and any subtypes. + * An event will be generated for any prepared reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt002; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ClassPrepareRequest.addClassFilter_rt.filter_rt002 + * nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002a.java new file mode 100644 index 00000000000..9641f81ec95 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt002a.java @@ -0,0 +1,167 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt002 JDI test. + */ + +public class filter_rt002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt002aThread1 thread1 = null; + + static filter_rt002aTestClass10 obj = new filter_rt002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_rt002aThread1("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class filter_rt002aTestClass10{ + static int var10 = 0; +} +class filter_rt002aTestClass11 extends filter_rt002aTestClass10{ + static int var11 = 0; +} +class filter_rt002aThread1 extends Thread { + + String tName = null; + + public filter_rt002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + filter_rt002aTestClass11 obj1 = new filter_rt002aTestClass11(); + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003.java new file mode 100644 index 00000000000..9836e5928bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003.java @@ -0,0 +1,170 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * + * The test checks that results of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter_rt() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to be + * the preparation of the given reference type and any subtypes. + * The cases to test include re-invocations of the method + * addClassFilter() on the same ClassPrepareRequest object. + * There are two ClassPrepareRequests to check as follows: + * (1) For ClassPrepareRequest2, both invocations are with different + * ReferenceTypes restricting one ClassPrepare event to two classes. + * The test expects no ClassPrepare event will be received. + * (2) For ClassPrepareRequest1, both invocations are with the same + * ReferenceType restricting one ClassPrepare event to one class. + * The test expects this ClassPrepare event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates class filter objects, to load the Classes to + * filter, and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two ClassPrepareRequests 1&2, + * - double restricts ClassPrepareRequest1 to the RefTypes 1 and 1, + * - double restricts ClassPrepareRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee creates and starts two threads, thread1 and thread2, + * first of them will create an object of sub-Class to be filtered, + * whereas second will create an object to be not filtered. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class filter_rt003 extends TestDebuggerType1 { + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003a"; + return new filter_rt003().runThis(argv, out); + } + + private String testedClassName10 = + "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003aTestClass10"; + + private String testedClassName20 = + "nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003aTestClass20"; + + + protected void testRun() { + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ClassPrepareRequest1"; + String property2 = "ClassPrepareRequest2"; + + ReferenceType testClassReference10 = null; + ReferenceType testClassReference20 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + switch (i) { + + case 0: + testClassReference10 = (ReferenceType) vm.classesByName(testedClassName10).get(0); + testClassReference20 = (ReferenceType) vm.classesByName(testedClassName20).get(0); + + eventRequest1 = setting21ClassPrepareRequest(testClassReference10, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21ClassPrepareRequest(testClassReference10, + EventRequest.SUSPEND_ALL, property2); + + ((ClassPrepareRequest) eventRequest1).addClassFilter(testClassReference10); + ((ClassPrepareRequest) eventRequest2).addClassFilter(testClassReference20); + + display("......waiting for ClassPrepareEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ClassPrepareEvent)) { + setFailedStatus("ERROR: new event is not ClassPrepareEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ClassPrepareEvent with propety 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ClassPrepareRequest setting21ClassPrepareRequest ( ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ClassPrepareRequest:"); + display(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + display(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003/TestDescription.java new file mode 100644 index 00000000000..e6812a43e44 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/ClassPrepareRequest/addClassFilter_rt/filter_rt003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter_rt() + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to be the preparation + * of the given reference type and any subtypes. + * An event will be generated for any prepared reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to be the preparation + * of the given reference type and any subtypes. + * The cases to test include re-invocations of the method + * addClassFilter() on the same ClassPrepareRequest object. + * There are two ClassPrepareRequests to check as follows: + * (1) For ClassPrepareRequest2, both invocations are with different + * ReferenceTypes restricting one ClassPrepare event to two classes. + * The test expects no ClassPrepare event will be received. + * (2) For ClassPrepareRequest1, both invocations are with the same + * ReferenceType restricting one ClassPrepare event to one class. + * The test expects this ClassPrepare event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003 + * nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassFilter_rt.filter_rt003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003a.java new file mode 100644 index 00000000000..291d0a9f075 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_rt/filter_rt003a.java @@ -0,0 +1,197 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt003 JDI test. + */ + +public class filter_rt003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + filter_rt003aTestClass10 obj1 = new filter_rt003aTestClass10(); + filter_rt003aTestClass20 obj2 = new filter_rt003aTestClass20(); + break; + + + case 1: + filter_rt003aThread1 thread1 = new filter_rt003aThread1("thread1"); + filter_rt003aThread2 thread2 = new filter_rt003aThread2("thread2"); + + log1("new filter_rt003a().run1(thread1);"); + new filter_rt003a().run1(thread1); + + log1("new filter_rt003a().run1(thread2);"); + new filter_rt003a().run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class filter_rt003aTestClass10{ + static int var10 = 0; +} +class filter_rt003aTestClass11 extends filter_rt003aTestClass10{ + static int var11 = 0; +} +class filter_rt003aThread1 extends Thread { + + String tName = null; + + public filter_rt003aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + filter_rt003aTestClass11 obj1 = new filter_rt003aTestClass11(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt003aTestClass20 { + static int var20 = 0; +} +class filter_rt003aTestClass21 { + static int var21 = 0; +} +class filter_rt003aThread2 extends Thread { + + String tName = null; + + public filter_rt003aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + filter_rt003aTestClass21 obj2 = new filter_rt003aTestClass21(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001.java new file mode 100644 index 00000000000..937a5ea2531 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001.java @@ -0,0 +1,189 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * + * The test checks that results of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter(String) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to check include both a pattern that begin with '*' + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - creates two class filter objects, + * first one using a pattern that begin with '*', and + * second one using a pattern that end with '*' + * to filter ClassPrepareEvents in two debuggee's tested threads, + * - sets up two ClassPrepareRequests, + * - resumes the debuggee, and + * - waits for expected ClassPrepareEvents. + * - The debuggee creates and starts two threads + * whose 'run' methods create objects of ClassTypes needed + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs the checks required. + */ + +public class filter_s001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s001a"; + return new filter_s001().runThis(argv, out); + } + + private String testedClassName1 = "*TestClass11"; + private String testedClassName2 = + "nsk.jdi.ClassPrepareRequest.addClassFilter_s.Thread2filter_s001a*"; + + private String className1 = "TestClass11"; + private String className2 = + "nsk.jdi.ClassPrepareRequest.addClassFilter_s.Thread2filter_s001a"; + + protected void testRun() { + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ClassPrepareRequest1"; + String property2 = "ClassPrepareRequest2"; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest1 = setting22ClassPrepareRequest(testedClassName1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for ClassPrepareEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ClassPrepareEvent)) { + setFailedStatus("ERROR: new event is not ClassPrepareEvent"); + } else { + String str = ((ClassPrepareEvent)newEvent).referenceType().name(); + if (!str.endsWith(className1)) { + setFailedStatus("Received ClassPrepareEvent for unexpected class: \n\t" + str); + } else { + display("Received ClassPrepareEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ClassPrepareEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + + vm.resume(); + break; + + case 1: + eventRequest2 = setting22ClassPrepareRequest(testedClassName2, + EventRequest.SUSPEND_ALL, property2); + + display("......waiting for ClassPrepareEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ClassPrepareEvent)) { + setFailedStatus("ERROR: new event is not ClassPrepareEvent"); + } else { + + String str = ((ClassPrepareEvent)newEvent).referenceType().name(); + if (!str.endsWith(className2)) { + setFailedStatus("Received ClassPrepareEvent for unexpected class: \n\t" + str); + } else { + display("Received ClassPrepareEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ClassPrepareEvent with property 'number' == " + property); + + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ClassPrepareRequest setting22ClassPrepareRequest ( String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ClassPrepareRequest:"); + display(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + display(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001/TestDescription.java new file mode 100644 index 00000000000..c4a052e8bd9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ClassPrepareRequest/addClassFilter_s/filter_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter_s() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns that + * begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s001; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was modified to fix the bug: + * 4627990 JDI testcase filter_s001 failing + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s001 + * nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001a.java new file mode 100644 index 00000000000..f96143acfb6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s001a.java @@ -0,0 +1,192 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s001 JDI test. + */ + +public class filter_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 2; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + Thread1filter_s001a thread1 = new Thread1filter_s001a("thread1"); + log1("new filter_s001a().run1(thread1);"); + new filter_s001a().run1(thread1); + break; + + case 1: + Thread2filter_s001a thread2 = new Thread2filter_s001a("thread2"); + log1("new filter_s001a().run1(thread2);"); + new filter_s001a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class Thread1filter_s001a extends Thread { + + class TestClass10{ + int var10 = 0; + } + class TestClass11 extends TestClass10{ + int var11 = 0; + } + + String tName = null; + + public Thread1filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + TestClass11 obj1 = new TestClass11(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter_s001a extends Thread { + + String tName = null; + + public Thread2filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + filter_s001aTestClass21 obj2 = new filter_s001aTestClass21(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_s001aTestClass21 { + int var21 = 0; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002.java new file mode 100644 index 00000000000..68649fb18e9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002.java @@ -0,0 +1,537 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassPrepareRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ClassPrepareRequest.addClassFilter_s()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a class filter object,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ClassPrepareRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s002a"; + + private String testedClassName1 = + "nsk.jdi.ClassPrepareRequest.addClassFilter_s.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "ClassPrepareRequest1"; + + eventRequest1 = setting22ClassPrepareRequest(testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ClassPrepareRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ClassPrepareRequest setting22ClassPrepareRequest ( String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ClassPrepareRequest:"); + log2(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); +// cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + log2(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingClassPrepareRequest() : " + e); + log3(" ClassPreparenRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002/TestDescription.java new file mode 100644 index 00000000000..d131b3de9e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassPrepareRequest. + * The test checks up that a result of the method + * com.sun.jdi.ClassPrepareRequest.addClassFilter(String) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns that + * begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s002; + * the debuggee program - nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ClassPrepareRequest.addClassFilter_s.filter_s002 + * nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addClassFilter_s.filter_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002a.java new file mode 100644 index 00000000000..0395c7fc789 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addClassFilter_s/filter_s002a.java @@ -0,0 +1,168 @@ +/* + * 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.ClassPrepareRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s002 JDI test. + */ + +public class filter_s002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + + +class Thread1filter_s002a extends Thread { + + class TestClass10{ + int var10 = 0; + } + class TestClass11 extends TestClass10{ + int var11 = 0; + } + + + String tName = null; + + public Thread1filter_s002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s002a.log1(" 'run': enter :: threadName == " + tName); + TestClass11 obj1 = new TestClass11(); + filter_s002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/TestClass2.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/TestClass2.java new file mode 100644 index 00000000000..756e8d96fb4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/TestClass2.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter001; + +/* + * Dummy class used for ClassPrepareRequest testing + */ +public class TestClass2 { + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/addSourceNameFilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/addSourceNameFilter001.java new file mode 100644 index 00000000000..65f66e07d97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/addSourceNameFilter001.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.ClassPrepareRequest.addSourceNameFilter(String sourceNamePattern) + * complies with its spec: + * "Restricts the events generated by this request to the preparation of reference types for which the + * restricted regular expression 'sourceNamePattern' matches one of the 'sourceNames' for the reference type + * being prepared." + * Test scenario: + * Debugger VM create ClassPrepareEventRequest, add source name filter and force debuggee load class. When debuggee + * finish class loading debugger checks is ClassPrepareEvent was correct filtered or not. + * Following source name filters are used: + * - exact source name + * - invalid source name (don't expect events with this filter) + * - pattern starting with '*' + * - pattern ending with '*' + * + * @library /vmTestbase + * /test/lib + * + * @build nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter001.addSourceNameFilter001 + * nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter001.TestClass2 + * nsk.share.jdi.TestClass1 + * @run driver jdk.test.lib.FileInstaller . . + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter001.addSourceNameFilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + */ + +package nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter001; + +import java.io.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.*; +import nsk.share.jpda.AbstractDebuggeeTest; +import java.util.*; + +public class addSourceNameFilter001 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new addSourceNameFilter001().runIt(argv, out); + } + + protected boolean canRunTest() { + if (!vm.canUseSourceNameFilters()) { + log.display("TEST CANCELLED due to: vm.canUseSourceNameFilters() = false"); + return false; + } else + return true; + } + + protected String debuggeeClassName() { + if (classpath == null) + throw new TestBug("Debugger requires 'testClassPath' parameter"); + + return AbstractJDIDebuggee.class.getName() + " -testClassPath " + classpath; + } + + // listener counting ClassPrepareEvent + public class ClassPrepareEventListener extends EventHandler.EventListener { + + private boolean eventReceived; + + private String expectedClassName; + + ClassPrepareEventListener(String expectedClassName) { + this.expectedClassName = expectedClassName; + } + + public boolean eventReceived(Event event) { + if (event instanceof ClassPrepareEvent) { + ClassPrepareEvent classPrepareEvent = (ClassPrepareEvent) event; + log.display("Received ClassPrepareEvent: '" + event + "'. Event for class: " + classPrepareEvent.referenceType().name()); + + if (eventReceived) { + setSuccess(false); + log.complain("Only 1 ClassPrepareEvent is expected for tested request"); + } else { + if (!classPrepareEvent.referenceType().name().equals(expectedClassName)) { + setSuccess(false); + log.complain("Received event for wrong class, expected class is " + expectedClassName); + } + eventReceived = true; + } + + vm.resume(); + return true; + } + + return false; + } + } + + private EventHandler eventHandler; + + // force debuggee load class and check is ClassPrepareEvent was generated + private void testSourceFilter(String expectedClassName, + List classesToLoad, + String sourceName, + boolean expectEvent) { + ClassPrepareRequest request; + + // create request with filter + request = debuggee.getEventRequestManager().createClassPrepareRequest(); + request.setSuspendPolicy(EventRequest.SUSPEND_ALL); + request.addSourceNameFilter(sourceName); + request.enable(); + + // this listener waits for ClassPrepareEvent + ClassPrepareEventListener listener = new ClassPrepareEventListener(expectedClassName); + eventHandler.addListener(listener); + + for (String className : classesToLoad) { + log.display("Loading class: " + className + ", using following source filter: " + sourceName); + + // force debuggee load class + pipe.println(AbstractDebuggeeTest.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + } + + request.disable(); + + eventHandler.removeListener(listener); + + // check is event was correctly filtered or not + if (expectEvent) { + if (!listener.eventReceived) { + setSuccess(false); + log.complain("Expected ClassPrepareEvent was not received"); + } + } else { + if (listener.eventReceived) { + setSuccess(false); + log.complain("Unexpected ClassPrepareEvent was received"); + } + } + } + + public void doTest() { + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + String className = "nsk.share.jdi.TestClass1"; + String sourceName = "TestClass1.java"; + + List classesToLoad = new ArrayList(); + classesToLoad.add(className); + // don't expect events for TestClass2 + classesToLoad.add(TestClass2.class.getName()); + + // set invalid source name, don't expect events + testSourceFilter(className, classesToLoad, sourceName + "_InvalidSourceName", false); + + // set valid source name + testSourceFilter(className, classesToLoad, sourceName, true); + + sourceName = "TestClass1.*"; + // use pattern filter ending with '*' + testSourceFilter(className, classesToLoad, sourceName, true); + + sourceName = "*Class1.java"; + // use pattern filter starting with '*' + testSourceFilter(className, classesToLoad, sourceName, true); + + eventHandler.stopEventHandler(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter002/addSourceNameFilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter002/addSourceNameFilter002.java new file mode 100644 index 00000000000..c9b7616c6cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter002/addSourceNameFilter002.java @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.ClassPrepareRequest.addSourceNameFilter(String sourceNamePattern) + * complies with its spec: + * "Restricts the events generated by this request to the preparation of reference types for which the + * restricted regular expression 'sourceNamePattern' matches one of the 'sourceNames' for the reference type + * being prepared." + * Test scenario: + * Debugger create following class file: + * - class file containing multiple strata + * - SourceDebugExtension's source map refers to multiple sources + * Debugger VM create ClassPrepareEventRequest, add source name filter(use names of all sources which was added to class + * file) and force debuggee load class from generated class file. When debuggee finish class loading debugger check is + * ClassPrepareEvent was correct filtered or not. + * Following source name filters are used: + * - exact source name + * - invalid source name (don't expect events with this filter) + * - pattern starting with '*' + * - pattern ending with '*' + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter002.addSourceNameFilter002 + * nsk.share.jdi.TestClass1 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter002.addSourceNameFilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -sourceCount 2 + */ + +package nsk.jdi.ClassPrepareRequest.addSourceNameFilter.addSourceNameFilter002; + +import java.io.*; +import java.util.ArrayList; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.*; +import nsk.share.jdi.sde.*; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class addSourceNameFilter002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new addSourceNameFilter002().runIt(argv, out); + } + + protected boolean canRunTest() { + if (!vm.canUseSourceNameFilters()) { + log.display("TEST CANCELLED due to: vm.canUseSourceNameFilters() = false"); + return false; + } else + return true; + } + + private int sourceCount; + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-sourceCount") && (i < args.length - 1)) { + sourceCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + if (sourceCount == 0) { + throw new TestBug("Debugger requires 'sourceCount' parameter"); + } + + return standardArgs.toArray(new String[] {}); + } + + protected String debuggeeClassName() { + // debugee should load classes from test work directory + return AbstractJDIDebuggee.class.getName() + " -testClassPath " + testWorkDir; + } + + // listener counting ClassPrepareEvent + public class ClassPrepareEventListener extends EventHandler.EventListener { + public int eventReceived; + + public boolean eventReceived(Event event) { + if (event instanceof ClassPrepareEvent) { + ClassPrepareEvent classPrepareEvent = (ClassPrepareEvent) event; + eventReceived++; + + log.display("Event received: " + event + " Class: " + classPrepareEvent.referenceType().name()); + + vm.resume(); + + return true; + } + + return false; + } + } + + private EventHandler eventHandler; + + private void testSourceFilter(String className, String sourceName, boolean expectEvent) { + ClassPrepareRequest request; + + // create request with filter + request = debuggee.getEventRequestManager().createClassPrepareRequest(); + request.setSuspendPolicy(EventRequest.SUSPEND_ALL); + request.addSourceNameFilter(sourceName); + request.enable(); + + // this listener wait ClassPrepareEvent + ClassPrepareEventListener listener = new ClassPrepareEventListener(); + eventHandler.addListener(listener); + + log.display("Load class: " + className + ", use follows source filter: " + sourceName); + + // force debuggee load class + pipe.println(AbstractDebuggeeTest.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + request.disable(); + + eventHandler.removeListener(listener); + + // check is event was correct filtered or not + if (expectEvent) { + if (listener.eventReceived == 0) { + setSuccess(false); + log.complain("Expected ClassPrepareEvent was not received"); + } + } else { + if (listener.eventReceived > 0) { + setSuccess(false); + log.complain("Unexpected ClassPrepareEvent was received"); + } + } + } + + // create class file with multiple strata + private void preparePathcedClassFile(String className, String testStratumSourceNames[]) { + String smapFileName = "TestSMAP.smap"; + + SmapGenerator smapGenerator = new SmapGenerator(); + + SmapStratum smapStratum = new SmapStratum("TestStratum"); + + for (String testStratumSourceName : testStratumSourceNames) { + smapStratum.addFile(testStratumSourceName); + // add dummy line data + smapStratum.addLineData(1, testStratumSourceName, 1, 1, 1); + smapGenerator.addStratum(smapStratum, true); + } + + savePathcedClassFile(className, smapGenerator, smapFileName); + } + + public void doTest() { + String className = "nsk.share.jdi.TestClass1"; + String sourceName = "TestClass1.java"; + + String testStratumSourceNames[] = new String[sourceCount]; + // {"TestStratum1_Source.tss1", "TestStratum2_Source.tss2"}; + + for (int i = 0; i < testStratumSourceNames.length; i++) + testStratumSourceNames[i] = "TestStratum" + i + "_Source.tss" + i; + + // create class file with multiple strata + preparePathcedClassFile(className, testStratumSourceNames); + + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + // set valid source name + testSourceFilter(className, sourceName, true); + for (int i = 0; i < testStratumSourceNames.length; i++) { + testSourceFilter(className, testStratumSourceNames[i], true); + } + + // set invalid source name, don't expect events + testSourceFilter(className, sourceName + "_InvalidSourceName", false); + for (int i = 0; i < testStratumSourceNames.length; i++) { + testSourceFilter(className, testStratumSourceNames[i] + "_InvalidSourceName", false); + } + + // use pattern filter + testSourceFilter(className, "TestClass1*", true); + + for (int i = 0; i < testStratumSourceNames.length; i++) + testSourceFilter(className, "TestStratum" + i + "*", true); + + testSourceFilter(className, "*.java", true); + + for (int i = 0; i < testStratumSourceNames.length; i++) + testSourceFilter(className, "*.tss" + i, true); + + eventHandler.stopEventHandler(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001.java new file mode 100644 index 00000000000..8ecef8ec440 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001.java @@ -0,0 +1,366 @@ +/* + * 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.ClassType.allInterfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.allInterfaces()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Class0ForCheck doesn't implement interface
    + * 2) Class1ForCheck implements one direct and
    + * one indirect interface
    + * 3) Class2ForCheck implements one direct and
    + * two indirect interfaces
    + * 4) Class3ForCheck extends Class2ForCheck,
    + * hence implements one direct and
    + * two indirect interfaces
    + *
    + */ + +public class allinterfaces001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/allInterfaces/allinterfaces001", + sHeader2 = "--> allinterfaces001: ", + sHeader3 = "##> allinterfaces001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new allinterfaces001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.allInterfaces.allinterfaces001a"; + + String mName = "nsk.jdi.ClassType.allInterfaces"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("allinterfaces001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + ReferenceType reftype = null; + List l = null; + Method m = null; + String name = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Class0ForCheck - 0 interfaces + + List list0 = vm.classesByName(mName + ".Class0ForCheck"); + + classRefType = (ReferenceType) list0.get(0); + + List iface0list = + ((ClassType) classRefType).allInterfaces(); + + if (iface0list.size() != 0) { + log3("ERROR : iface0list.size() != 0 in case: Class0ForCheck"); + expresult = 1; + break; + } + + break ; + + case 1: // Class1forCheck - 1 direct and 1 indirect interfaces + + List list1 = vm.classesByName(mName + ".Class1ForCheck"); + + classRefType = (ReferenceType) list1.get(0); + + List iface1list = + ((ClassType) classRefType).allInterfaces(); + + if (iface1list.size() != 2) { + log3("ERROR : iface1list.size() != 2 in case: Class1forCheck :" + iface1list.size()); + expresult = 1; + break; + } + + reftype = (ReferenceType) iface1list.get(0); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface2') in Class1forCheck"); + expresult = 1; + break; + } + } + reftype = (ReferenceType) iface1list.get(1); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + log3("ERROR :name2: !name.equals('.Iface1' or '.Iface2') in Class1forCheck"); + expresult = 1; + break; + } + } + break; + + case 2: // Class2ForCheck - 1 direct and 2 indirect interfaces + + List list2 = vm.classesByName(mName + ".Class2ForCheck"); + + classRefType = (ReferenceType) list2.get(0); + + List iface2list = + ((ClassType) classRefType).allInterfaces(); + + if (iface2list.size() != 3) { + log3("ERROR : iface2list.size() != 3 in case: Class2forCheck"); + expresult = 1; + break; + } + + reftype = (ReferenceType) iface2list.get(0); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3' or 'Iface3) in Class2forCheck"); + expresult = 1; + break; + } + } + } + reftype = (ReferenceType) iface2list.get(1); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3' or 'Iface3) in Class2forCheck"); + expresult = 1; + break; + } + } + } + reftype = (ReferenceType) iface2list.get(2); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3' or 'Iface3) in Class2forCheck"); + expresult = 1; + break; + } + } + } + break; + + case 3: // Class3ForCheck - 1 direct and 2 indirect interfaces + + List list3 = vm.classesByName(mName + ".Class3ForCheck"); + + classRefType = (ReferenceType) list3.get(0); + + List iface3list = + ((ClassType) classRefType).allInterfaces(); + + if (iface3list.size() != 3) { + log3("ERROR : iface3list.size() != 3 in case: Class3forCheck"); + expresult = 1; + break; + } + + reftype = (ReferenceType) iface3list.get(0); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3' or 'Iface3) in Class3forCheck"); + expresult = 1; + break; + } + } + } + reftype = (ReferenceType) iface3list.get(1); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3' or 'Iface3) in Class3forCheck"); + expresult = 1; + break; + } + } + } + reftype = (ReferenceType) iface3list.get(2); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3' or 'Iface3) in Class3forCheck"); + expresult = 1; + break; + } + } + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001/TestDescription.java new file mode 100644 index 00000000000..18f8870a2cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001/TestDescription.java @@ -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/ClassType/allInterfaces/allinterfaces001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.allInterfaces() + * complies with its spec: + * public java.util.List allInterfaces() + * Gets the interfaces directly and indirectly implemented by this class. + * Interfaces returned by interfaces() are returned as well all superinterfaces. + * Returns: a List of InterfaceType objects each mirroring an interface of + * this ClassType in the target VM. + * If none exist, returns a zero length List. + * Throws: ClassNotPreparedException - + * if this class not yet been prepared. + * ObjectCollectedException - + * if this class has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.allInterfaces.allinterfaces001; + * the debuggee program - nsk.jdi.ClassType.allInterfaces.allinterfaces001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.allInterfaces.allinterfaces001 + * nsk.jdi.ClassType.allInterfaces.allinterfaces001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.allInterfaces.allinterfaces001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001a.java new file mode 100644 index 00000000000..87de013a474 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces001a.java @@ -0,0 +1,265 @@ +/* + * 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.ClassType.allInterfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the allinterfaces001 JDI test. + */ + +public class allinterfaces001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> allinterfaces001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> allinterfaces001a: " + message); + } + + //====================================================== test program + + static Class0ForCheck class0 = null; + static Class1ForCheck class1 = null; + static Class2ForCheck class2 = null; + static Class3ForCheck class3 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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 < 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(); + + // check implemented interfaces + boolean isComparable = false; + boolean isSerializable = false; + boolean isCloneable = false; + boolean is_allinterfaces002i = false; + + Iterator it = checkedClass.allInterfaces().iterator(); + while (it.hasNext()) { + InterfaceType i = it.next(); + if (i.name().equals("java.lang.Comparable")) { + isComparable = true; + } else if (i.name().equals("java.io.Serializable")) { + isSerializable = true; + } else if (i.name().equals("java.lang.Cloneable")) { + isCloneable = false; + } else if (i.name().equals("nsk.jdi.ClassType.allInterfaces.allinterfaces002i")) { + is_allinterfaces002i = true; + } + + } + + if (isComparable) { + display("CHECK1 PASSED: " + className + " implements Comparable"); + } else { + complain("CHECK1 FAILED: " + className + " does not implement Comparable"); + exitStatus = Consts.TEST_FAILED; + } + + if (isSerializable) { + display("CHECK2 PASSED: " + className + " implements Serializable"); + } else { + complain("CHECK2 FAILED: " + className + " does not implement Serializable"); + exitStatus = Consts.TEST_FAILED; + } + + if (!isCloneable) { + display("CHECK3 PASSED: " + className + " does not implement Cloneable"); + } else { + complain("CHECK3 FAILED: " + className + " implements Cloneable"); + exitStatus = Consts.TEST_FAILED; + } + + if (fieldName.equals("f3") || fieldName.equals("f7")) { + if (is_allinterfaces002i) { + display("CHECK4 PASSED: " + className + " implements allinterfaces002i"); + } else { + complain("CHECK4 FAILED: " + className + " does not implement allinterfaces002i"); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002/TestDescription.java new file mode 100644 index 00000000000..eb5be2f7601 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002/TestDescription.java @@ -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/ClassType/allInterfaces/allinterfaces002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for allInterfaces() method of ClassType interface. + * The test checks if the method: + * - returns Comparable and Serializable interfaces implemented + * by java.lang.Enum, + * - does not return Cloneable interfaces + * for any mirrored enum type. + * Besides this, the test checks if the method returns expected + * nsk.jdi.ClassType.allInterfaces.allinterfaces002i interface + * for any enum type which implements this interface + * The test consists of a debugger program (allinterfaces002.java) + * and debuggee application (allinterfaces002a.java). + * Package name is nsk.jdi.ClassType.allInterfaces . + * 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 allInterfaces() method for each field + * of enum type declared in allinterfaces002a class. + * The test fails if any of expected interfaces has not been + * returned or Cloneable interface has been returned in the result + * list. + * 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.ClassType.allInterfaces.allinterfaces002 + * nsk.jdi.ClassType.allInterfaces.allinterfaces002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.allInterfaces.allinterfaces002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002a.java new file mode 100644 index 00000000000..7934282ca64 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002a.java @@ -0,0 +1,167 @@ +/* + * 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.ClassType.allInterfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class allinterfaces002a { + + //------------------------------------------------------- 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; + static Enum4.Enum4_ f4 = Enum4.Enum4_.e1; + static allinterfaces002Enum5 f5 = allinterfaces002Enum5.e2; + static allinterfaces002Enum6 f6 = allinterfaces002Enum6.e1; + static allinterfaces002Enum7 f7 = allinterfaces002Enum7.e2; + static allinterfaces002Enum8.Enum8_ f8 = allinterfaces002Enum8.Enum8_.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(allinterfaces002.SIGNAL_READY); + + + //pipe.println(allinterfaces002.SIGNAL_GO); + receiveSignal(allinterfaces002.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + + enum Enum1 { + e1, e2; + } + + enum Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); + } + + enum Enum3 implements allinterfaces002i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); + } + + enum Enum4 { + e1, e2; + + enum Enum4_ { + e1, e2; + } + } + +} + +//--------------------------------------------------------- test specific classes + +enum allinterfaces002Enum5 { + e1, e2; +} + +enum allinterfaces002Enum6 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum allinterfaces002Enum7 implements allinterfaces002i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +enum allinterfaces002Enum8 { + e1, e2; + enum Enum8_ { + e1, e2; + } +} + +interface allinterfaces002i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001.java new file mode 100644 index 00000000000..0b2d8565017 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001.java @@ -0,0 +1,291 @@ +/* + * 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.ClassType.concreteMethodByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.concreteMethodByName()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) 8 methods with return types of
    + * all primitive types (cases 0-7 below)
    + * 2) 1 method with the void type (case 8)
    + * 3) 3 methods with return types of
    + * all reference types (cases 9-11)
    + *
    + */ + +public class method001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/concreteMethodByName/method001", + sHeader2 = "--> method001: ", + sHeader3 = "##> method001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new method001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.concreteMethodByName.method001a"; + + String mName = "nsk.jdi.ClassType.concreteMethodByName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("method001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + + Method m = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Class1 without abstract methods + + List list1 = vm.classesByName(mName + ".Class1ForCheck"); + + ClassType classType1 = + (ClassType) (ReferenceType) list1.get(0); + if (classType1 == null) { + log3("ERROR : classType1 == null in case: Class1"); + expresult = 1; + break; + } + + int i3; + boolean endFlag = false; + + for (i3 = 0; ; i3++) { + switch (i3) { + + case 0 : m = classType1.concreteMethodByName + ("blValue", "()Z"); + break ; + + case 1 : m = classType1.concreteMethodByName + ("btValue", "()B"); + break ; + + case 2 : m = classType1.concreteMethodByName + ("chValue", "()C"); + break ; + + case 3 : m = classType1.concreteMethodByName + ("dbValue", "()D"); + break ; + + case 4 : m = classType1.concreteMethodByName + ("flValue", "()F"); + break ; + + case 5 : m = classType1.concreteMethodByName + ("inValue", "()I"); + break ; + + case 6 : m = classType1.concreteMethodByName + ("lnValue", "()J"); + break ; + + case 7 : m = classType1.concreteMethodByName + ("shValue", "()S"); + break ; + + + case 8 : m = classType1.concreteMethodByName + ("vdValue", "()V"); + break ; + + + case 9 : m = classType1.concreteMethodByName + ("inArray", "()[I"); + break ; + + case 10 : m = classType1.concreteMethodByName + ("classMethod", "()Lnsk/jdi/ClassType/concreteMethodByName/Class2ForCheck;"); + break ; + + case 11 : m = classType1.concreteMethodByName + ("ifaceMethod", "()Lnsk/jdi/ClassType/concreteMethodByName/IfaceForCheck;"); + break ; + + + default: endFlag = true; + break ; + } + + if (m == null) { + expresult = 1; + log3("ERROR : no methods returned : " + i3); + } + if (endFlag) break ; + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001/TestDescription.java new file mode 100644 index 00000000000..62f9d0053f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001/TestDescription.java @@ -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/ClassType/concreteMethodByName/method001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.concreteMethodByName() + * complies with the following requirements: + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.concreteMethodByName.method001; + * the debuggee program - nsk.jdi.ClassType.concreteMethodByName.method001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.concreteMethodByName.method001 + * nsk.jdi.ClassType.concreteMethodByName.method001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.concreteMethodByName.method001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001a.java new file mode 100644 index 00000000000..0e5c9fb6f57 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method001a.java @@ -0,0 +1,238 @@ +/* + * 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.ClassType.concreteMethodByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the method001 JDI test. + */ + +public class method001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> method001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> method001a: " + message); + } + + //====================================================== test program + + static Class1ForCheck class1 = null; + static Class2ForCheck class2 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.ClassType.concreteMethodByName(String, String)
    + * for boundary value of parameters.
    + * + * In any cases it is expected, this method will return either the Method + * that matches the given name and signature or null if there is + * no match. No exception is expected. + * All variants of argument values are placed in parameters array. + * Also, this array contains an expected return value for every pair of + * arguments values:
    + * null - return value of concreteMethodByName()
    is + * null + * "T" - return value of concreteMethodByName()
    is not + * null + */ + +public class method002 { + + private final static String prefix = "nsk.jdi.ClassType.concreteMethodByName."; + private final static String debuggerName = prefix + "method002"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private ClassType testedClass; + + private String [][] parameters = { +// methodName signature result + {"justMethod", "(I)I", "T"}, + {"justMethod", null, null}, + {null, "(I)I", null}, + {null, null, null}, + {"", "", null} + }; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + method002 thisTest = new method002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + testedClass = (ClassType )debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + Method method; + for (int i = 0; i < parameters.length; i ++) { + display("invoking concreteMethodByName(\"" + parameters[i][0] + + "\",\"" + parameters[i][1] + "\")"); + try { + method = testedClass.concreteMethodByName(parameters[i][0], + parameters[i][1]); + if (parameters[i][2] != null) { + if (method == null) { + complain("Method : " + method); + exitStatus = Consts.TEST_FAILED; + } else { + display("Method : " + method); + } + } else { + if (method == null) { + display("Method : " + method); + } else { + complain("Method : " + method); + exitStatus = Consts.TEST_FAILED; + } + } + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + display(""); + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method002/TestDescription.java new file mode 100644 index 00000000000..88a7b0f333d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method002/TestDescription.java @@ -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/ClassType/concreteMethodByName/method002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method + * com.sun.jdi.ClassType.concreteMethodByName(String, String) + * for boundary value of parameters. + * In any cases it is expected, this method will return either the method + * that matches the given name and signature or null if there is no match. + * No exception is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.concreteMethodByName.method002 + * nsk.jdi.ClassType.concreteMethodByName.method002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.concreteMethodByName.method002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method002a.java new file mode 100644 index 00000000000..b1af468bd5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/concreteMethodByName/method002a.java @@ -0,0 +1,54 @@ +/* + * 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.ClassType.concreteMethodByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * method002a is deugee's part of the method002. + */ +public class method002a { + + 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(method002.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(method002.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static int justMethod(int val) { + return val; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001.java new file mode 100644 index 00000000000..429556ceffe --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001.java @@ -0,0 +1,287 @@ +/* + * 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.ClassType.interfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.interfaces()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Class0ForCheck doesn't implement interfaces
    + * 2) Class1ForCheck implements one interface
    + * 2) Class2ForCheck implements two interfaces
    + *
    + */ + +public class interfaces001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/interfaces/interfaces001", + sHeader2 = "--> interfaces001: ", + sHeader3 = "##> interfaces001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new interfaces001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.interfaces.interfaces001a"; + + String mName = "nsk.jdi.ClassType.interfaces"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("interfaces001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + ReferenceType reftype = null; + List l = null; + Method m = null; + String name = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Class0ForCheck - 0 interfaces + + List list0 = vm.classesByName(mName + ".Class0ForCheck"); + + classRefType = (ReferenceType) list0.get(0); + + List iface0list = + ((ClassType) classRefType).interfaces(); + + if (iface0list.size() != 0) { + log3("ERROR : iface0list.size() != 0 in case: Class0ForCheck"); + expresult = 1; + break; + } + + break; + + case 1: // Class1forCheck - 1 interface + + List list1 = vm.classesByName(mName + ".Class1ForCheck"); + + classRefType = (ReferenceType) list1.get(0); + + List iface1list = + ((ClassType) classRefType).interfaces(); + + if (iface1list.size() != 1) { + log3("ERROR : iface1list.size() != 1 in case: Class1forCheck"); + expresult = 1; + break; + } + + reftype = (ReferenceType) iface1list.get(0); + name = reftype.name(); + if (!name.equals(mName + ".Iface1")) { + log3("ERROR : !name.equals(mName + '.Iface1') in Class1forCheck"); + expresult = 1; + break; + } + + break; + + case 2: // Class2ForCheck - 2 interfaces + + List list2 = vm.classesByName(mName + ".Class2ForCheck"); + + classRefType = (ReferenceType) list2.get(0); + + List iface2list = + ((ClassType) classRefType).interfaces(); + + if (iface2list.size() != 2) { + log3("ERROR : iface1list.size() != 2 in case: Class2forCheck"); + expresult = 1; + break; + } + + reftype = (ReferenceType) iface2list.get(0); + name = reftype.name(); + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3') in Class2forCheck"); + expresult = 1; + break; + } + } + reftype = (ReferenceType) iface2list.get(1); + name = reftype.name(); + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface3")) { + log3("ERROR :name2: !name.equals('.Iface1' or '.Iface3') in Class2forCheck"); + expresult = 1; + break; + } + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001/TestDescription.java new file mode 100644 index 00000000000..177f1e2ed8b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ClassType/interfaces/interfaces001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.interfaces() + * complies with its spec: + * public java.util.List interfaces() + * Gets the interfaces directly implemented by this class. + * Only the interfaces that are declared with the "implements" keyword + * in this class are included. + * Returns: a List of InterfaceType objects each mirroring a direct interface + * this ClassType in the target VM. + * If none exist, returns a zero length List. + * Throws: ClassNotPreparedException - + * if this class not yet been prepared. + * ObjectCollectedException - + * if this class has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.interfacesinterfaces001; + * the debuggee program - nsk.jdi.ClassType.interfaces.interfaces001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.interfaces.interfaces001 + * nsk.jdi.ClassType.interfaces.interfaces001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.interfaces.interfaces001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001a.java new file mode 100644 index 00000000000..dc959a474ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001a.java @@ -0,0 +1,231 @@ +/* + * 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.ClassType.interfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the interfaces001 JDI test. + */ + +public class interfaces001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> interfaces001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> interfaces001a: " + message); + } + + //====================================================== test program + + static Class0ForCheck class0 = null; + static Class1ForCheck class1 = null; + static Class2ForCheck class2 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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(); + + List interfaces = checkedClass.interfaces(); + if (interfaces.size() != 1) { + complain("ClassType.interfaces() returned for " + className + " a list of unexpected size:" + interfaces.size()); + complain("\t Expected size: 1"); + exitStatus = Consts.TEST_FAILED; + Iterator it = interfaces.iterator(); + while (it.hasNext()) { + InterfaceType i = it.next(); + complain("\t Interface returned in the list : " + i.name()); + } + } else if (interfaces.get(0).name().equals("nsk.jdi.ClassType.interfaces.interfaces002i")) { + display(className + " implements interfaces002i"); + } else { + complain(className + " does not implement interfaces002i"); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002/TestDescription.java new file mode 100644 index 00000000000..61f9ece0714 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ClassType/interfaces/interfaces002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for interfaces() method of ClassType interface. + * The test checks if the method returns expected + * nsk.jdi.ClassType.interfaces.interfaces002i interface + * for any enum type which implements this interface + * The test consists of a debugger program (interfaces002.java) + * and debuggee application (interfaces002a.java). + * Package name is nsk.jdi.ClassType.interfaces . + * 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 interfaces() method for each field + * of enum type declared in interfaces002a class. + * The test fails if the expected interface has not been + * returned in the result list. + * 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.ClassType.interfaces.interfaces002 + * nsk.jdi.ClassType.interfaces.interfaces002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.interfaces.interfaces002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002a.java new file mode 100644 index 00000000000..66d547ce0f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002a.java @@ -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.ClassType.interfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class interfaces002a { + + //------------------------------------------------------- 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 interfaces002Enum1 f1 = interfaces002Enum1.e2; + static interfaces002Enum2 f2 = interfaces002Enum2.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(interfaces002.SIGNAL_READY); + receiveSignal(interfaces002.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum interfaces002Enum1 implements interfaces002i { + e1, e2; +} + +enum interfaces002Enum2 implements interfaces002i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +interface interfaces002i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java new file mode 100644 index 00000000000..4b5023c92b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java @@ -0,0 +1,577 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.invokeMethod()
    + * complies with its spec when invoked methods are of
    + * all primitive types and the void type.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger invokes debuggee's methods:
    + * boolean blValue();
    + * byte btValue();
    + * char chValue();
    + * double dbValue();
    + * float flValue();
    + * int inValue();
    + * long lnValue();
    + * short shValue();
    + * void vdValue();
    + * and checks up that returned Value objects are
    + * corresponding PrimitiveValue objects and
    + * a VoidValue object.
    + *
    + */ + +public class invokemethod001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/invokeMethod/invokemethod001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new invokemethod001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.invokeMethod.invokemethod001a"; + + private String testedClassName = + "nsk.jdi.ClassType.invokeMethod.Threadinvokemethod001a"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + // BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + ClassType classType = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + classType = (ClassType) testedclass; + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + Value returnValue = null; + + String methodNamnes[] = {"blValue" , "btValue" , + "chValue" , "dbValue" , + "flValue" , "inValue" , + "lnValue" , "shValue" , + "vdValue" }; + + String types[] = { "BooleanValue", "ByteValue", "CharValue", + "DoubleValue", "FloatValue", "IntegerValue", + "LongValue", "ShortValue", "VoidValue" }; + + log2(" beginning of invoking methods"); + label: { + for (int i3 = 0; i3 <= 8; i3++) { + + log2(" checking up " + types[i3] + " method"); + + List invokeMethods = + testedclass.methodsByName(methodNamnes[i3]); + Method invokeMethod = (Method) invokeMethods.get(0); + + List argumentList = Collections.emptyList(); +// List argumentList = +// invokeMethods; +// argumentList.clear(); + + try { + returnValue = + classType.invokeMethod(thread2, + invokeMethod, argumentList, 0); + } catch ( Exception t ) { + log3("ERROR: Exception for classType.invokeMethod :" + t); + expresult = returnCode1; + continue; + } + + try { + switch (i3) { + + case 0: + BooleanValue blValue = (BooleanValue) returnValue; + break; + + case 1: + ByteValue btValue = (ByteValue) returnValue; + break; + + case 2: + CharValue chValue = (CharValue) returnValue; + break; + + case 3: + DoubleValue dbValue = (DoubleValue) returnValue; + break; + + case 4: + FloatValue flValue = (FloatValue) returnValue; + break; + + + case 5: + IntegerValue inValue = (IntegerValue) returnValue; + break; + + case 6: + LongValue lnValue = (LongValue) returnValue; + break; + + case 7: + ShortValue shValue = (ShortValue) returnValue; + break; + + case 8: + VoidValue vdValue = (VoidValue) returnValue; + break; + + default: log3("ERROR : switch (i3) executes 'default:'"); + expresult = returnCode1; + break label; + } + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException for: " + types[i3] + " 'returnValue'"); + expresult = returnCode1; + break label; + } // try + } // for + } // label: + + log2(" end of checks"); + log2(" resuming VirtualMachine"); + vm.resume(); + + } + vm.resume(); // for case if thread2 was not resumed because of error in a check + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001/TestDescription.java new file mode 100644 index 00000000000..f1fbcfbd131 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001/TestDescription.java @@ -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/ClassType/invokeMethod/invokemethod001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.invokeMethod() + * complies with the following requirements in its spec: + * "If the invoked method has a return type other than void, + * a mirror of the return value is returned by this method; + * otherwise, null is returned." + * when an invoked method is one of primitive types or void. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.invokeMethod.invokemethod001; + * the debuggee program - nsk.jdi.ClassType.invokeMethod.invokemethod001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * For a void method return value is the VoidValue. + * fixing #4737294 testbug: + * For a void method return value should be null. + * 4773425 TEST_BUG: invokemethod001 test failing on all platforms + * Previous changes of 4737294 bug fix are deleted. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod001 + * nsk.jdi.ClassType.invokeMethod.invokemethod001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java new file mode 100644 index 00000000000..ce6c285fa07 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java @@ -0,0 +1,276 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the invokemethod001 JDI test. + */ + +public class invokemethod001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + // String mName = //!!!!!!!!!!!!!!!!!!!!!! + // "nsk.jdi.ClassType.invokeMethod"; + + //------------------------------------------------------ common section + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * The debugger compares the argument value and the return value and + * it is expected, these values must be equal. + */ + +public class invokemethod002 { + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod."; + private final static String debuggerName = prefix + "invokemethod002"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + public final static String [] methods2Invoke = { + "methodBOOLParam", + "methodBYTEParam", + "methodCHARParam", + "methodDOUBLEParam", + "methodFLOATParam", + "methodINTParam", + "methodLONGParam", + "methodSHORTParam", + "methodOBJParam" + }; + + private static boolean [] boolParamValues = + {true, false}; + private static byte [] byteParamValues = + {Byte.MIN_VALUE,-1,0,1,Byte.MAX_VALUE}; + private static char [] charParamValues = + {Character.MIN_VALUE,Character.MAX_VALUE}; + private static double [] doubleParamValues = + {Double.NEGATIVE_INFINITY, Double.MIN_VALUE,-1.D, + 0.D,1.D,Double.MAX_VALUE,Double.POSITIVE_INFINITY}; + private static float [] floatParamValues = + {Float.NEGATIVE_INFINITY,Float.MIN_VALUE,-1.F, + 0.F,1.F,Float.MAX_VALUE,Float.POSITIVE_INFINITY}; + private static int [] intParamValues = + {Integer.MIN_VALUE,-1,0,1,Integer.MAX_VALUE}; + private static long [] longParamValues = + {Long.MIN_VALUE,-1L,0L,1L,Long.MAX_VALUE}; + private static short [] shortParamValues = + {Short.MIN_VALUE,-1,0,1,Short.MAX_VALUE}; + private static String [] objParamValues = + {"Hello world"}; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + invokemethod002 thisTest = new invokemethod002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + try { + prepareTestCase(); + } catch(InterruptedException e) { + complain("InterruptedException occurs"); + exitStatus = Consts.TEST_FAILED; + return; + } catch(TestRuntimeException e) { + complain(" " + e); + for (int i = 0; i < e.getStackTrace().length; i++) { + display("\t" + e.getStackTrace()[i]); + } + if ( debugee.getIOPipe() == null ) { + debugee.createIOPipe(); + } + debugee.receiveExpectedSignal(SGNL_READY); + debugee.quit(); + exitStatus = Consts.TEST_FAILED; + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + + Value retValue, value = null; + Vector params = new Vector(); + + Method method; + Object arr = null; + for (int j = 0; j < methods2Invoke.length; j++) { + method = debugee.methodByName(testedClass, methods2Invoke[j]); + display(""); + switch (j) { + case 0: + arr = boolParamValues; + display("boolean values"); + break; + case 1: + arr = byteParamValues; + display("byte values"); + break; + case 2: + arr = charParamValues; + display("char values"); + break; + case 3: + arr = doubleParamValues; + display("double values"); + break; + case 4: + arr = floatParamValues; + display("float values"); + break; + case 5: + arr = intParamValues; + display("integer values"); + break; + case 6: + arr = longParamValues; + display("long values"); + break; + case 7: + arr = shortParamValues; + display("short values"); + break; + case 8: + arr = objParamValues; + display("String values"); + break; + default: + complain("***TEST CASE ERROR***"); + exitStatus = Consts.TEST_FAILED; + continue; + } + display("--------------"); + for (int i = 0; i < Array.getLength(arr); i++) { + params.clear(); + if (arr instanceof boolean[]) { + value = debugee.VM().mirrorOf(Array.getBoolean(arr,i)); + } else if (arr instanceof byte[]) { + value = debugee.VM().mirrorOf(Array.getByte(arr,i)); + } else if (arr instanceof char[]) { + value = debugee.VM().mirrorOf(Array.getChar(arr,i)); + } else if (arr instanceof double[]) { + value = debugee.VM().mirrorOf(Array.getDouble(arr,i)); + } else if (arr instanceof float[]) { + value = debugee.VM().mirrorOf(Array.getFloat(arr,i)); + } else if (arr instanceof int[]) { + value = debugee.VM().mirrorOf(Array.getInt(arr,i)); + } else if (arr instanceof long[]) { + value = debugee.VM().mirrorOf(Array.getLong(arr,i)); + } else if (arr instanceof short[]) { + value = debugee.VM().mirrorOf(Array.getShort(arr,i)); + } else if (arr instanceof String[]) { + value = debugee.VM().mirrorOf((String )Array.get(arr,i)); + } else { + complain("***TEST CASE ERROR***"); + exitStatus = Consts.TEST_FAILED; + } + params.add(value); + retValue = invokeMethod(thread, method, params, value); + } + } + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private void prepareTestCase() throws InterruptedException { + Event event = null; + + ClassPrepareRequest cprep + = debugee.getEventRequestManager().createClassPrepareRequest(); + cprep.addClassFilter(debugeeName); + cprep.enable(); + + debugee.resume(); + + // waiting ClassPrepareEvent for debugeeName + event = debugee.waitingEvent(cprep, waitTime); + if (!(event instanceof ClassPrepareEvent)) { + debugee.resume(); + throw new TestRuntimeException("ClassPrepareEvent didn't arrive"); + } + + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + invokemethod002a.brkpMethodName, + invokemethod002a.brkpLineNumber); + debugee.resume(); + + debugee.createIOPipe(); + debugee.redirectStdout(log,""); + debugee.redirectStderr(log,""); + debugee.receiveExpectedSignal(SGNL_READY); + + // waiting the breakpoint event + event = debugee.waitingEvent(brkp, waitTime); + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + if (brkpEvent == null) { + debugee.resume(); + throw new TestRuntimeException("No breakpoint events"); + } + + thread = brkpEvent.thread(); + } + + private Value invokeMethod(ThreadReference thread, Method method, List params, + Value expectedValue) { + Value returnedValue = null, + param; + try { + display("Method : " + method); + for (int i = 0; i < params.size(); i++) { + param = (Value )params.get(i); + display("Parameters : " + param + "(" + param.type() + ")"); + } + returnedValue = testedClass.invokeMethod(thread, method, params, + ClassType.INVOKE_SINGLE_THREADED); + } catch(InvalidTypeException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(ClassNotLoadedException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(IncompatibleThreadStateException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(InvocationException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } + + String retType = returnedValue != null ? returnedValue.type().toString() + : ""; + display("Return value: " + returnedValue + "(" + retType + ")"); + + if (!returnedValue.equals(expectedValue)) { + String expType = expectedValue.type().toString() ; + complain("***wrong the return value***"); + complain("expected value : " + expectedValue + "(" + + expType + ")"); + exitStatus = Consts.TEST_FAILED; + } + display(""); + return returnedValue; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod002/TestDescription.java new file mode 100644 index 00000000000..1faa2722e43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ClassType/invokeMethod/invokemethod002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that a result of the method + * com.sun.jdi.ClassType.invokeMethod() + * correctly works for the boundary parameter of the invoked method. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.invokeMethod.invokemethod002; + * The debuggee program - nsk.jdi.ClassType.invokeMethod.invokemethod002a. + * For every primitive value there is the simplest method on the debugee + * side, which has alone argument of this primitive value and returns + * the same value as argument. Such methods are invoked for boundary + * values of the primitive type. + * The debugger compares the argument value and the return value and, + * it is expected, these values must be equal. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod002 + * nsk.jdi.ClassType.invokeMethod.invokemethod002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod002a.java new file mode 100644 index 00000000000..9c6bc1fc217 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod002a.java @@ -0,0 +1,91 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * invokemethod002a is deugee's part of the invokemethod002. + */ +public class invokemethod002a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 45; + + 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(invokemethod002.SGNL_READY); + String instr = pipe.readln(); // brkpLineNumber + if (instr.equals(invokemethod002.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + // methods is invoked by debugger + private static boolean methodBOOLParam(boolean value) { + return value; + } + + private static byte methodBYTEParam(byte value) { + return value; + } + + private static char methodCHARParam(char value) { + return value; + } + + private static double methodDOUBLEParam(double value) { + return value; + } + + private static float methodFLOATParam(float value) { + return value; + } + + private static int methodINTParam(int value) { + return value; + } + + private static long methodLONGParam(long value) { + return value; + } + + private static short methodSHORTParam(short value) { + return value; + } + + private static String methodOBJParam(String value) { + return value; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003.java new file mode 100644 index 00000000000..d51b969e985 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003.java @@ -0,0 +1,307 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up the following assertions:
    + * 1. The specified method can be defined in this class, or in + * a superclass.
    + * 2. IllegalArgumentException is thrown if
    + * - the method is not a member of this class or a superclass;
    + * - the size of the argument list does not match the number of declared + * arguemnts for the method.
    + * The first case considers the invokations for the private, + * protected and public methods. In this case + * no exceptions are expected.
    + */ + +public class invokemethod003 { + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod."; + private final static String debuggerName = prefix + "invokemethod003"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ReferenceType anotherClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + public final static String [] methods2Invoke = { + "publicFromParent", + "protectFromParent", + "privateFromParent", + "fromChild" + }; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + invokemethod003 thisTest = new invokemethod003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + try { + prepareTestCase(); + } catch(InterruptedException e) { + complain("InterruptedException occurs"); + exitStatus = Consts.TEST_FAILED; + return; + } catch(TestRuntimeException e) { + complain(" " + e); + for (int i = 0; i < e.getStackTrace().length; i++) { + display("\t" + e.getStackTrace()[i]); + } + if ( debugee.getIOPipe() == null ) { + debugee.createIOPipe(); + } + debugee.receiveExpectedSignal(SGNL_READY); + debugee.quit(); + exitStatus = Consts.TEST_FAILED; + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue, value = null, + expectedValue = debugee.VM().mirrorOf(6L); + List params = createParams(3), + params4 = createParams(4); + + Method method; + + // checking up IllegalArgumentException, when the method is not a member + // of this class or a superclass + display("\nthe method is not a member of this class or a superclass"); + display("--------------------------------------------------------"); + method = debugee.methodByName(anotherClass, "run"); + try { + retValue = invokeMethod(thread, method, params, expectedValue); + complain("***IllegalArgumentException is not thrown***"); + exitStatus = Consts.TEST_FAILED; + } catch(IllegalArgumentException e) { + display(">expected " + e); + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + // checking up for public, protected, private methods of the superclass + display("\npublic, protected, private methods of the superclass"); + display("----------------------------------------------------"); + for (int j = 0; j < methods2Invoke.length; j++) { + method = debugee.methodByName(testedClass, methods2Invoke[j]); + try { + retValue = invokeMethod(thread, method, params, expectedValue); + } catch(Exception e) { + complain("***unexpected " + e + "***"); + exitStatus = Consts.TEST_FAILED; + } + } + display(""); + + // checking up IllegalArgumentException, wrong size of the argument list + display("wrong size of the argument list: " + params4.size() + + "(it should be 3)"); + display("--------------------------------------------------"); + method = debugee.methodByName(testedClass, methods2Invoke[0]); + try { + retValue = invokeMethod(thread, method, params4, expectedValue); + complain("***IllegalArgumentException is not thrown***"); + exitStatus = Consts.TEST_FAILED; + } catch(IllegalArgumentException e) { + display(">expected " + e); + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private void prepareTestCase() throws InterruptedException { + Event event = null; + + ClassPrepareRequest cprep + = debugee.getEventRequestManager().createClassPrepareRequest(); + cprep.addClassFilter(prefix + invokemethod003a.class2Check); + cprep.enable(); + + debugee.resume(); + + // waiting ClassPrepareEvent for debugeeName + event = debugee.waitingEvent(cprep, waitTime); + if (!(event instanceof ClassPrepareEvent)) { + debugee.resume(); + throw new TestRuntimeException("ClassPrepareEvent didn't arrive"); + } + + + testedClass = (ClassType )debugee.classByName(prefix + + invokemethod003a.class2Check); + + ReferenceType debugeeClass = debugee.classByName(debugeeName); + BreakpointRequest brkp = debugee.setBreakpoint(debugeeClass, + invokemethod003a.brkpMethodName, + invokemethod003a.brkpLineNumber); + + debugee.resume(); + + debugee.createIOPipe(); + debugee.redirectStdout(log,""); + debugee.redirectStderr(log,""); + debugee.receiveExpectedSignal(SGNL_READY); + + anotherClass = debugee.classByName(prefix + + invokemethod003a.anotherClassName); + if (anotherClass == null) { + debugee.resume(); + throw new TestRuntimeException(prefix + + invokemethod003a.anotherClassName + + " has not been loaded yet"); + } + + + // waiting the breakpoint event + event = debugee.waitingEvent(brkp, waitTime); + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + if (brkpEvent == null) { + debugee.resume(); + throw new TestRuntimeException("No breakpoint events"); + } + + thread = brkpEvent.thread(); + } + + private Value invokeMethod(ThreadReference thread, Method method, List params, + Value expectedValue) { + Value returnedValue = null, + param; + try { + display("Method : " + method); + for (int i = 0; i < params.size(); i++) { + param = params.get(i); + display("Parameters : " + param + "(" + param.type() + ")"); + } + returnedValue = testedClass.invokeMethod(thread, method, params, + ClassType.INVOKE_SINGLE_THREADED); + } catch(InvalidTypeException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(ClassNotLoadedException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(IncompatibleThreadStateException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(InvocationException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } + + String retType = returnedValue != null ? returnedValue.type().toString() + : ""; + display("Return value: " + returnedValue + "(" + retType + ")"); + + if (!returnedValue.equals(expectedValue)) { + String expType = expectedValue.type().toString() ; + complain("***wrong the return value***"); + complain("expected value : " + expectedValue + "(" + + expType + ")"); + exitStatus = Consts.TEST_FAILED; + } + display(""); + return returnedValue; + } + + private List createParams(int size) { + Vector params = new Vector(); + for (int i = 0; i < size; i++) { + params.add(debugee.VM().mirrorOf(i + 1)); + } + return params; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003/TestDescription.java new file mode 100644 index 00000000000..6d517174467 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ClassType/invokeMethod/invokemethod003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that a result of the method + * com.sun.jdi.ClassType.invokeMethod() + * throws IllegalArgumentException according to spec. + * Test checks up the following assertions: + * 1. The specified method can be defined in this class, or in + * a superclass. + * 2. IllegalArgumentException is thrown if + * - the method is not a member of this class or a superclass, + * - the size of the argument list does not match the number of declared + * arguemnts for the method + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod003 + * nsk.jdi.ClassType.invokeMethod.invokemethod003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003a.java new file mode 100644 index 00000000000..1cbab27ab14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003a.java @@ -0,0 +1,86 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * invokemethod003a is deugee's part of the invokemethod003. + */ +public class invokemethod003a { + + public final static String anotherClassName = "invokemethod003b"; + public final static String class2Check = "invokemethod003Child"; + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 50; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + invokemethod003Child child = new invokemethod003Child(); + invokemethod003b imb = new invokemethod003b(); + pipe.println(invokemethod003.SGNL_READY); + + String instr = pipe.readln(); // brkpLineNumber + if (instr.equals(invokemethod003.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static long publicFromParent(int one, int two, int three) { + return one + two + three; + } + + protected static long protectFromParent(int one, int two, int three) { + return one + two + three; + } + + private static long privateFromParent(int one, int two, int three) { + return one + two + three; + } +} + +class invokemethod003Child extends invokemethod003a { + invokemethod003Child() { + } + + public static long fromChild(int one, int two, int three) { + return one + two + three; + } +} + +class invokemethod003b { + public void run() { + int i = 1; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004.java new file mode 100644 index 00000000000..a2bfcffd5aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004.java @@ -0,0 +1,280 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up the following assertion:
    + * If the invoked method throws an exception, this method will throw + * an InvocationException which contains a mirror to the exception object thrown. + * It is checked for two cases: + * 1. when the invoked method throws uncought NullPointerExection.
    + * For this case, InvocationException is expected, the one
    + * contains a mirror to the NullPointerException object.
    + * 2. when invoked method throws cought exection
    + * For this case, no exceptions are expected
    + */ + +public class invokemethod004 { + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod."; + private final static String debuggerName = prefix + "invokemethod004"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + public final static String [] methods2Invoke = { + "throwNPE", + "throwCaughtNPE" + }; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + invokemethod004 thisTest = new invokemethod004(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + invokemethod004a.brkpMethodName, + invokemethod004a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + thread = brkpEvent.thread(); + + ReferenceType exceptionRefType = + debugee.classByName(invokemethod004a.testException); + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue; + List params = createParams(0); + + Method method; + + display("\nuncought NullPointerException"); + display("-----------------------------"); + + // uncought NullPointerException + method = debugee.methodByName(testedClass, methods2Invoke[0]); + try { + retValue = invokeMethod(thread, method, params); + complain("InvocationException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(InvocationException e) { + display("!!!expected InvocationException"); + + // cheking of the excpetion type + if (e.exception().referenceType().equals(exceptionRefType)) { + display("!!!expected the exception mirror " + e.exception()); + } else { + complain("Unexpected the exception mirror " + + e.exception().referenceType()); + complain("We are expecting " + exceptionRefType); + exitStatus = Consts.TEST_FAILED; + } + } + display(""); + + display("\ncought NullPointerException"); + display("-----------------------------"); + // cought NullPointerException + method = debugee.methodByName(testedClass, methods2Invoke[1]); + try { + retValue = invokeMethod(thread, method, params); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private void prepareTestCase() throws InterruptedException { + Event event = null; + + // waiting VMStartEvent + event = debugee.waitingEvent(null, waitTime); + if (!(event instanceof VMStartEvent)) { + debugee.resume(); + throw new TestRuntimeException("VMStartEvent didn't arrive"); + } + + ClassPrepareRequest cprep + = debugee.getEventRequestManager().createClassPrepareRequest(); + cprep.addClassFilter(debugeeName); + cprep.enable(); + + debugee.resume(); + + // waiting ClassPrepareEvent for debugeeName + event = debugee.waitingEvent(cprep, waitTime); + if (!(event instanceof ClassPrepareEvent)) { + debugee.resume(); + throw new TestRuntimeException("ClassPrepareEvent didn't arrive"); + } + + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + invokemethod004a.brkpMethodName, + invokemethod004a.brkpLineNumber); + debugee.resume(); + + debugee.createIOPipe(); + debugee.redirectStdout(log,""); + debugee.redirectStderr(log,""); + debugee.receiveExpectedSignal(SGNL_READY); + + // waiting the breakpoint event + event = debugee.waitingEvent(brkp, waitTime); + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + if (brkpEvent == null) { + debugee.resume(); + throw new TestRuntimeException("No breakpoint events"); + } + + thread = brkpEvent.thread(); + } + + private Value invokeMethod(ThreadReference thread, Method method, List params) + throws InvocationException { + Value returnedValue = null, + param; + try { + display("Method : " + method); + for (int i = 0; i < params.size(); i++) { + param = (Value )params.get(i); + display("Parameters : " + param + "(" + param.type() + ")"); + } + returnedValue = testedClass.invokeMethod(thread, method, params, + ClassType.INVOKE_SINGLE_THREADED); + } catch(InvalidTypeException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(ClassNotLoadedException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } catch(IncompatibleThreadStateException e) { + complain("exception: " + e); + exitStatus = Consts.TEST_FAILED; + } + + String retType = returnedValue != null ? returnedValue.type().toString() + : ""; + display("Return value: " + returnedValue + "(" + retType + ")"); + + display(""); + return returnedValue; + } + + private List createParams(int size) { + Vector params = new Vector(); + for (int i = 0; i < size; i++) { + params.add(debugee.VM().mirrorOf(i + 1)); + } + return params; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004/TestDescription.java new file mode 100644 index 00000000000..0016c9c870f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/ClassType/invokeMethod/invokemethod004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that a result of the method + * com.sun.jdi.ClassType.invokeMethod() + * throws InvocationException according to spec. + * Test checks up the following assertion: + * If the invoked method throws an exception, this method will throw + * an InvocationException which contains a mirror to the exception object + * thrown. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod004 + * nsk.jdi.ClassType.invokeMethod.invokemethod004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004a.java new file mode 100644 index 00000000000..a245829b59c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod004a.java @@ -0,0 +1,71 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * invokemethod004a is deugee's part of the invokemethod004. + */ +public class invokemethod004a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + public final static String testException = "java.lang.NullPointerException"; + + + 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(invokemethod004.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(invokemethod004.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static void throwNPE() { + Object obj = null; + String tmp = obj.toString(); + } + + protected static void throwCaughtNPE() { + Object obj = null; + try { + String tmp = obj.toString(); + } catch (NullPointerException e) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005.java new file mode 100644 index 00000000000..bedc446ec84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005.java @@ -0,0 +1,258 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import java.util.*; +import java.io.*; +import java.lang.reflect.Array; + +/** + * Test checks up the following assertion: + * Primitive arguments must be either assignment compatible with + * the argument type or must be convertible to the argument type + * without loss of information. + * for every primitive type + */ + +public class invokemethod005 extends ValueConversionDebugger { + + private static class TestedMethodData { + public String methodName; + public ValueType methodType; + + public TestedMethodData(String methodName, ValueType methodType) { + this.methodName = methodName; + this.methodType = methodType; + } + } + + private ClassType testedClass; + + private ThreadReference thread; + + private final static TestedMethodData [] methods2Invoke = { + new TestedMethodData("methodBYTEParam", BYTE), + new TestedMethodData("methodCHARParam", CHAR), + new TestedMethodData("methodDOUBLEParam", DOUBLE), + new TestedMethodData("methodFLOATParam", FLOAT), + new TestedMethodData("methodINTParam", INT), + new TestedMethodData("methodLONGParam", LONG), + new TestedMethodData("methodSHORTParam", SHORT) + }; + + private static byte [] byteParamValues = + {Byte.MIN_VALUE, + -1, + 0, + 1, + Byte.MAX_VALUE}; + private static char [] charParamValues = + {Character.MIN_VALUE, + Character.MAX_VALUE}; + private static double [] doubleParamValues = + {Double.NEGATIVE_INFINITY, + -1.5D, + -1.0D, + -0.0D, + +0.0D, + Double.MIN_VALUE, + 1.0D, + 1.5D, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY}; + private static float [] floatParamValues = + {Float.NEGATIVE_INFINITY, + -1.5F, + -1.0F, + -0.0F, + +0.0F, + Float.MIN_VALUE, + 1.0F, + 1.5F, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY}; + private static int [] intParamValues = + {Integer.MIN_VALUE, + -1, + 0, + 1, + 1234567890, + Integer.MAX_VALUE}; + private static long [] longParamValues = + {Long.MIN_VALUE, + -1L, + 0L, + 1L, + 1234567890123456789L, + Long.MAX_VALUE}; + private static short [] shortParamValues = + {Short.MIN_VALUE, + -1, + 0, + 1, + Short.MAX_VALUE}; + + protected String debuggeeClassName() { + return invokemethod005a.class.getName(); + } + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod005().runIt(argv, out); + } + + protected void doTest() { + initDefaultBreakpoint(); + + BreakpointEvent brkpEvent = forceBreakpoint(); + + testedClass = (ClassType )debuggee.classByName(debuggeeClassNameWithoutArgs()); + + thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + PrimitiveValue value = null; + List params = new ArrayList(); + Method method; + Object arr = null; + boolean validConversion; + + for (TestedMethodData methodData : methods2Invoke) { + method = debuggee.methodByName(testedClass, methodData.methodName); + display(""); + display("Method : " + method); + display("============="); + for (ValueType type : ValueType.values()) { + switch (type) { + case BYTE: + arr = byteParamValues; + display("\tbyte values"); + break; + case CHAR: + arr = charParamValues; + display("\tchar values"); + break; + case DOUBLE: + arr = doubleParamValues; + display("\tdouble values"); + break; + case FLOAT: + arr = floatParamValues; + display("\tfloat values"); + break; + case INT: + arr = intParamValues; + display("\tinteger values"); + break; + case LONG: + arr = longParamValues; + display("\tlong values"); + break; + case SHORT: + arr = shortParamValues; + display("\tshort values"); + break; + default: + complain("\t***TEST CASE ERROR***"); + setSuccess(false); + continue; + } + display("\t--------------"); + for (int i = 0; i < Array.getLength(arr); i++) { + params.clear(); + value = createValue(arr, i); + params.add(value); + validConversion = isValidConversion(methodData.methodType, value); + try { + invokeMethod(thread, method, params, value); + if (!validConversion) { + complain(lastConversion); + complain("***InvalidTypeException is not thrown***"); + setSuccess(false); + } + } catch(InvalidTypeException e) { + if (validConversion) { + complain(lastConversion); + complain("*** unexpected InvalidTypeException***"); + setSuccess(false); + } else { + display(lastConversion); + display("!!!expected InvalidTypeException"); + } + } + display(""); + } + } + } + + display("============="); + display("TEST FINISHES\n"); + + removeDefaultBreakpoint(); + + debuggee.resume(); + } + + private void invokeMethod(ThreadReference thread, Method method, List params, + PrimitiveValue expectedValue) throws InvalidTypeException { + PrimitiveValue returnedValue = null; + PrimitiveValue param; + try { + for (int i = 0; i < params.size(); i++) { + param = (PrimitiveValue )params.get(i); + if (param instanceof CharValue) { + display("\tParameters : " + Integer.toHexString(param.charValue()) + "(" + param.type() + ")"); + } else { + display("\tParameters : " + param + "(" + param.type() + ")"); + } + } + returnedValue = (PrimitiveValue)testedClass.invokeMethod(thread, method, params, + ClassType.INVOKE_SINGLE_THREADED); + } catch(ClassNotLoadedException e) { + complain("exception: " + e); + setSuccess(false); + } catch(IncompatibleThreadStateException e) { + complain("exception: " + e); + setSuccess(false); + } catch(InvocationException e) { + complain("exception: " + e); + setSuccess(false); + } + + String retType = returnedValue != null ? returnedValue.type().toString() + : ""; + display("\tReturn value: " + returnedValue + "(" + retType + ")"); + + checkValueConversion(expectedValue, returnedValue); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005/TestDescription.java new file mode 100644 index 00000000000..763e75b3a8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005/TestDescription.java @@ -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/ClassType/invokeMethod/invokemethod005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.invokeMethod() + * Test checks up the following assertion: + * Primitive arguments must be either assignment compatible with + * the argument type or must be convertible to the argument type + * without loss of information. + * for every primitive type. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod005 + * nsk.jdi.ClassType.invokeMethod.invokemethod005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005a.java new file mode 100644 index 00000000000..5ca8fc19ec1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod005a.java @@ -0,0 +1,75 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * invokemethod005a is deugee's part of the invokemethod005. + */ +public class invokemethod005a extends AbstractJDIDebuggee { + + public static void main (String args[]) { + new invokemethod005a().doTest(args); + } + + // methods is invoked by debugger + private static boolean methodBOOLParam(boolean value) { + return value; + } + + private static byte methodBYTEParam(byte value) { + return value; + } + + private static char methodCHARParam(char value) { + return value; + } + + private static double methodDOUBLEParam(double value) { + return value; + } + + private static float methodFLOATParam(float value) { + return value; + } + + private static int methodINTParam(int value) { + return value; + } + + private static long methodLONGParam(long value) { + return value; + } + + private static short methodSHORTParam(short value) { + return value; + } + + private static String methodOBJParam(String value) { + return value; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006.java new file mode 100644 index 00000000000..494f54f9de9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006.java @@ -0,0 +1,233 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up that NullPointerException will be thrown in + * the following cases:
    + * - invokeMethod(null, method, params,ClassType.INVOKE_SINGLE_THREADED)
    + * - invokeMethod(thread, null, params,ClassType.INVOKE_SINGLE_THREADED)
    + * - invokeMethod(thread, method, null,ClassType.INVOKE_SINGLE_THREADED)
    + * In case
    + * invokeMethod(thread, method, params,Integer.MAX_VALUE)
    + * no exception is expected. + */ + +public class invokemethod006 { + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod."; + private final static String debuggerName = prefix + "invokemethod006"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + public final static String method2Invoke = "justMethod"; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + invokemethod006 thisTest = new invokemethod006(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + invokemethod006a.brkpMethodName, + invokemethod006a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue; + List params = createParams(1); + + Method method = debugee.methodByName(testedClass, method2Invoke); + display("Method : " + method); + + display("invokeMethod(null, method, params," + + "ClassType.INVOKE_SINGLE_THREADED)"); + try { + retValue = testedClass.invokeMethod(null, method, params, + ClassType.INVOKE_SINGLE_THREADED); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, null, params," + + "ClassType.INVOKE_SINGLE_THREADED)"); + try { + retValue = testedClass.invokeMethod(thread, null, params, + ClassType.INVOKE_SINGLE_THREADED); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, method, null," + + "ClassType.INVOKE_SINGLE_THREADED)"); + try { + retValue = testedClass.invokeMethod(thread, method, null, + ClassType.INVOKE_SINGLE_THREADED); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, method, params," + + "Integer.MAX_VALUE)"); + try { + retValue = testedClass.invokeMethod(thread, method, params, + Integer.MAX_VALUE); + if (((PrimitiveValue)retValue).intValue() != 1) { + complain("Wrong returned value " + retValue.toString()); + exitStatus = Consts.TEST_FAILED; + } else { + display("returned value is " + retValue.toString()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, method, params," + + "Integer.MIN_VALUE)"); + try { + retValue = testedClass.invokeMethod(thread, method, params, + Integer.MIN_VALUE); + if (((PrimitiveValue)retValue).intValue() != 1) { + complain("Wrong returned value " + retValue.toString()); + exitStatus = Consts.TEST_FAILED; + } else { + display("returned value is " + retValue.toString()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private List createParams(int size) { + Vector params = new Vector(); + for (int i = 0; i < size; i++) { + params.add(debugee.VM().mirrorOf(i + 1)); + } + return params; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006/TestDescription.java new file mode 100644 index 00000000000..e065ec36ca8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ClassType/invokeMethod/invokemethod006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.invokeMethod() + * Test checks up that NullPointerException will be thrown in + * the following cases: + * - invokeMethod(null, method, params,ClassType.INVOKE_SINGLE_THREADED) + * - invokeMethod(thread, null, params,ClassType.INVOKE_SINGLE_THREADED) + * - invokeMethod(thread, method, null,ClassType.INVOKE_SINGLE_THREADED) + * In case + * invokeMethod(thread, method, params,Integer.MAX_VALUE) + * no exception is expected. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod006 + * nsk.jdi.ClassType.invokeMethod.invokemethod006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006a.java new file mode 100644 index 00000000000..a0dfd85898d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod006a.java @@ -0,0 +1,61 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * invokemethod006a is deugee's part of the invokemethod006. + */ +public class invokemethod006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 46; + + 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(invokemethod006.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(invokemethod006.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static int justMethod(int val) { + return val; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007.java new file mode 100644 index 00000000000..5df33317b94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007.java @@ -0,0 +1,222 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * + * The test checks up the method com.sun.jdi.ClassType.invokeMethod() + * + * Test checks up the following assertion: + * ...all threads in the target VM are resumed while the method is + * being invoked if they were previously suspended by an event or by + * VirtualMachine.suspend() or ThreadReference.suspend(). + * + * This checking is implemented for three cases: + * - when the tested thread is suspended by ThreadReference.suspend(); + * - when the tested thread is suspended by VirtualMachine.suspend(); + * - when the tested thread is suspended by an event. + */ + +public class invokemethod007 { + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod."; + private final static String debuggerName = prefix + "invokemethod007"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + public final static String SGNL_STRTHRD = "start_thread"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + public final static String method2Invoke = "invokedMethod"; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + invokemethod007 thisTest = new invokemethod007(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.makeBreakpoint(testedClass, + invokemethod007a.brkpMethodName, + invokemethod007a.brkpLineNumber); + brkp.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + brkp.enable(); + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue; + List params = new Vector(); + ThreadReference suspendedThread; + BreakpointEvent brkpEvent; + + Method method = debugee.methodByName(testedClass, method2Invoke); + display("Method : " + method); + + for (int i = 0; i < 3; i++) { + display(""); + switch (i) { + case 0: + display("\nCASE#0 : Thread is suspended by ThreadReference.suspend()"); + break; + case 1: + display("\nCASE#1 : Thread is suspended by VirtualMachine.suspend()"); + break; + case 2: + display("\nCASE#2 : Thread is suspended by BreakPointRequest"); + brkp.disable(); + brkp.setSuspendPolicy(EventRequest.SUSPEND_ALL); + brkp.enable(); + } + + // starting thread + display("sending signal " + SGNL_STRTHRD); + debugee.sendSignal(SGNL_STRTHRD); + debugee.resume(); + display("waiting for signal " + SGNL_READY); + debugee.receiveExpectedSignal(SGNL_READY); + + brkpEvent = waitForBreakpoint(brkp); + + thread = brkpEvent.thread(); + + suspendedThread = debugee.threadByName(invokemethod007a.testedThread); + switch (i) { + case 0: + suspendedThread.suspend(); + break; + case 1: + debugee.VM().suspend(); + break; + } + + if ( !suspendedThread.isSuspended() ) { + complain(suspendedThread.name() + " is not suspended"); + exitStatus = Consts.TEST_FAILED; + } else { + display(suspendedThread.name() + " is suspended"); + } + try { + if (i == 1) { + // for VirtualMachine.suspended() only! + // resume thread for invokedMethod to have suspend count equal to 1. + thread.resume(); + } + display("invoking the method"); + retValue = testedClass.invokeMethod(thread, method, params, 0); + + long resultTime = ((PrimitiveValue)retValue).longValue(); + if ( resultTime >= waitTime) { + complain("CASE #" + i + " FAILED." + + "\n\tTimeout occured while invocation of debugee's method"); + exitStatus = Consts.TEST_FAILED; + } else { + display("CASE #" + i + " PASSED"); + } + } catch(Exception e) { + complain("Unexpected exception while invocation of debugee's method: " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private BreakpointEvent waitForBreakpoint(BreakpointRequest brkp) { + Event event = null; + BreakpointEvent brkpEvent; + + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + brkpEvent = (BreakpointEvent )event; + return brkpEvent; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007/TestDescription.java new file mode 100644 index 00000000000..8628f5f5b89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007/TestDescription.java @@ -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/ClassType/invokeMethod/invokemethod007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.invokeMethod() + * Test checks up the following assertion: + * ...all threads in the target VM are resumed while the method is + * being invoked if they were previously suspended by an event or by + * VirtualMachine.suspend() or ThreadReference.suspend(). + * This checking is implemented for three cases: + * - when the tested thread is suspended by ThreadReference.suspend(); + * - when the tested thread is suspended by VirtualMachine.suspend(); + * - when the tested thread is suspended by an event. + * COMMENTS: + * 4786806 TEST_BUG: debugee does not relinquishes lock after notifying + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod007 + * nsk.jdi.ClassType.invokeMethod.invokemethod007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007a.java new file mode 100644 index 00000000000..ac5b4f39394 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007a.java @@ -0,0 +1,154 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * invokemethod007a is deugee's part of the invokemethod007. + */ +public class invokemethod007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 70; + public final static String testedThread = "im007aThread01"; + + public static Log log; + public static long waitTime; + private static IOPipe pipe; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + pipe = argHandler.createDebugeeIOPipe(log); + im007aThread01 thread = null; + pipe.println(invokemethod007.SGNL_READY); + + String instr = pipe.readln(); + while (!instr.equals(invokemethod007.SGNL_QUIT)) { + + // create new thread and start it + if (instr.equals(invokemethod007.SGNL_STRTHRD)) { + thread = new im007aThread01("im007aThread01"); + synchronized(im007aThread01.waitStarting) { + thread.start(); + try { + im007aThread01.waitStarting.wait(waitTime); + log.display("checked thread started"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for checked thread start."); + } + } + } + log.display("sending ready signal..."); + pipe.println(invokemethod007.SGNL_READY); + log.display("waiting signal from debugger..."); // brkpLineNumber + instr = pipe.readln(); // this is a line for breakpoint + + if (thread.isAlive()) { + log.display("waiting for join of : " + thread.getName()); + try { + thread.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + try { + thread.interrupt(); + } catch (SecurityException e) { + throw new Failure("Cannot interrupt checked thread."); + } + } + } + } + + if (instr.equals(invokemethod007.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static long invokedMethod() { + log.display("invokedMethod> starting..."); + try { + synchronized(im007aThread01.waitFinishing) { + synchronized(im007aThread01.waitInvoking) { + log.display("invokedMethod> notifying to thread..."); + im007aThread01.waitInvoking.notifyAll(); + } + + log.display("invokedMethod> waiting for thread's response..."); + long startTime = System.currentTimeMillis(); + im007aThread01.waitFinishing.wait(waitTime); + return System.currentTimeMillis() - startTime; + } + } catch (InterruptedException e) { + log.display("invokedMethod> it was interrupted."); + } + return waitTime + 1; + } +} + +class im007aThread01 extends Thread { + public static Object waitInvoking = new Object(); + public static Object waitStarting = new Object(); + public static Object waitFinishing = new Object(); + + im007aThread01(String threadName) { + super(threadName); + } + + public void run() { + synchronized(waitInvoking) { + synchronized(waitStarting) { + waitStarting.notifyAll(); + } + + invokemethod007a.log.display(getName() + "> waiting for the invoked method..."); + try { + long startTime = System.currentTimeMillis(); + waitInvoking.wait(invokemethod007a.waitTime); + if ((System.currentTimeMillis() - startTime) < invokemethod007a.waitTime) { + invokemethod007a.log.display(getName() + "> got a response from the invoked method"); + } else { + invokemethod007a.log.display(getName() + "*** no response from invoked method"); + } + } catch (Exception e) { + invokemethod007a.log.display(getName() + e); + } + } + synchronized(waitFinishing) { + invokemethod007a.log.display(getName() + "> notifying the invoked method..."); + waitFinishing.notifyAll(); + } + invokemethod007a.log.display(getName() + "> thread finished"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008.java new file mode 100644 index 00000000000..b1125293910 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008.java @@ -0,0 +1,243 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * + * The test checks up the method com.sun.jdi.ClassType.invokeMethod() + * + * Test checks up the following assertion: + * If the target VM is disconnected during the invoke (for example, + * through VirtualMachine.dispose()) the method invocation continues. + */ + +public class invokemethod008 { + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod."; + private final static String debuggerName = prefix + "invokemethod008"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + public final static String SGNL_FINISH = "finish"; + public final static String SGNL_ABORT = "abort"; + + public static int exitStatus; + public static Log log; + public static Debugee debugee; + public static long waitTime; + private static boolean isAborted = false; + + private ClassType testedClass; + public final static String method2Invoke = "justMethod"; + + public static void display(String msg) { + log.display(msg); + } + + public static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + invokemethod008 thisTest = new invokemethod008(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Failure e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + if (!isAborted) { + debugee.resume(); + debugee.quit(); + } + } + + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure{ + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + InvokingThread invokeThrd = new InvokingThread(); + invokeThrd.start(); + + // waiting READY signal from invoked method + display("\nwaiting for signal \"" + + SGNL_READY + + "\" from the invoked method"); + debugee.receiveExpectedSignal(SGNL_READY); + + display("\n" + method2Invoke + " has been invoked. Trying to dispose debugee's VM"); + + AbortingThread abortingThrd = new AbortingThread(); + abortingThrd.start(); + + debugee.VM().dispose(); + invokeThrd.waitVMDisconnect(); + + try { + invokeThrd.join(); + } catch(InterruptedException e) { + throw new Failure("unexpected " + e); + } + + if (isAborted) { + complain("Debugee's VM disposing hung. Invoking was aborted!!!"); + exitStatus = Consts.TEST_FAILED; + } else { + display("\nVirtual machine has been disposed"); + display("sending signal \"" + SGNL_FINISH + "\" to the invoked method"); + debugee.sendSignal(SGNL_FINISH); + } + + display("\n============="); + display("TEST FINISHES\n"); + } + + private BreakpointEvent waitForBreakpoint(BreakpointRequest brkp) { + Event event = null; + BreakpointEvent brkpEvent; + + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected " + e); + } + + if (!(event instanceof BreakpointEvent )) { + throw new Failure("BreakpointEvent didn't arrive"); + } + + brkpEvent = (BreakpointEvent )event; + return brkpEvent; + } + + + class InvokingThread extends Thread { + volatile boolean isNotified = false; + + public void run() { + display(""); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + invokemethod008a.brkpMethodName, + invokemethod008a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + + BreakpointEvent brkpEvent = waitForBreakpoint(brkp); + ThreadReference thread = brkpEvent.thread(); + + Value retValue; + List params = new Vector(); + + Method method = debugee.methodByName(testedClass, method2Invoke); + display("\nInvoking debugee's method : " + method); + + try { + retValue = testedClass.invokeMethod(thread, method, params, 0); + if ( ((PrimitiveValue )retValue).intValue() == Consts.TEST_FAILED ) { + complain("VMDisconnectException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch(VMDisconnectedException e) { + display("!!!expected VMDisconnectException"); + notifyVMDisconnect(); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + debugee.resume(); + } + + synchronized void notifyVMDisconnect() { + isNotified = true; + notify(); + } + + synchronized void waitVMDisconnect() { + try { + if (!isNotified) { + display("\nwaiting VMDisconnectedException"); + wait(waitTime); + } + } catch (InterruptedException e) { + throw new Failure("unexpected " + e); + } + } + } + + class AbortingThread extends Thread { + + public void run() { + try { + sleep(waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected " + e); + } + + display("\n!!!out of wait time!!!"); + display("sending signal \"" + SGNL_ABORT + "\" to the invoked method"); + isAborted = true; + debugee.sendSignal(SGNL_ABORT); + debugee.resume(); + debugee.quit(); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008/TestDescription.java new file mode 100644 index 00000000000..2df43027be9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ClassType/invokeMethod/invokemethod008. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.invokeMethod() + * Test checks up the following assertion: + * If the target VM is disconnected during the invoke (for example, + * through VirtualMachine.dispose()) the method invocation continues. + * COMMENTS: + * The test was updated to avoid hanging of debugee's VM + * after invoking VirtualMachine.dispose(). + * (see 4471237 VirtualMachine.dispose() hangs on Windows) + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod008 + * nsk.jdi.ClassType.invokeMethod.invokemethod008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008a.java new file mode 100644 index 00000000000..9038940e7c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod008a.java @@ -0,0 +1,78 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * invokemethod008a is deugee's part of the invokemethod008. + */ +public class invokemethod008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 51; + private static Log log; + private static IOPipe pipe; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(invokemethod008.SGNL_READY); + + String instr = pipe.readln(); + // the below line is a breakpoint. + // Debugger will invoke justMethod(). + instr = pipe.readln(); // brkpLineNumber + if (instr.equals(invokemethod008.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static int justMethod() { + try { + pipe.println(invokemethod008.SGNL_READY); + log.display("invoked_method:: waiting response from debugger..."); + String instr = pipe.readln(); + if (instr.equals(invokemethod008.SGNL_FINISH)) { + log.display("invoked_method:: completed succesfully."); + return Consts.TEST_PASSED; + } else if (instr.equals(invokemethod008.SGNL_ABORT)) { + log.display("invoked_method:: aborted."); + } + } catch(Exception e) { + log.display("unexpected exception " + e); + } + return Consts.TEST_FAILED; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009.java new file mode 100644 index 00000000000..802bf810a3e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009.java @@ -0,0 +1,303 @@ +/* + * 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.ClassType.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ClassType.invokeMethod() + * properly throws ClassNotLoadedException - if any argument type + * has not yet been loaded through the appropriate class loader.

    + * + * The test works as follows. Debugger part of the test invokes + * debuggee methods dummyMeth, finDummyMeth with arguments of + * non-loaded reference types DummyType, FinDummyType. + * The test makes sure that class has not been loaded by the debuggee + * VM through the JDI method VirtualMachine.classesByName() + * which should return list of loaded classes only. + */ +public class invokemethod009 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.invokeMethod.invokemethod009t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod009tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 57; + + // tested debuggee methods, fields and reference types + static final int METH_NUM = 2; + static final String DEBUGGEE_METHODS[][] = { + {"dummyMeth", "nsk.jdi.ClassType.invokeMethod.invokemethod009tDummyType", + "Lnsk/jdi/ClassType/invokeMethod/invokemethod009tDummyType;" }, + {"finDummyMeth", "nsk.jdi.ClassType.invokeMethod.invokemethod009tFinDummyType", + "Lnsk/jdi/ClassType/invokeMethod/invokemethod009tFinDummyType;"} + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod009().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod009t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + +// Check the tested assersion + try { + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + ClassType clsType = (ClassType) rType; + + for (int i=0; i methList = rType.methodsByName(DEBUGGEE_METHODS[i][0]); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHODS[i][0] + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + continue; + } + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(MockReferenceType.createObjectReference(clsType.virtualMachine(), + DEBUGGEE_METHODS[i][2], DEBUGGEE_METHODS[i][1])); + + try { + log.display("\n" + (i+1) + ") Trying to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + + clsType + "\" ..."); + + clsType.invokeMethod(thrRef, meth, argList, 0); + + // Make sure that the reference type is not loaded by the debuggee VM + if ((debuggee.classByName(DEBUGGEE_METHODS[i][1])) != null) { + log.display("Skipping the check: the tested reference type\n\t\"" + + DEBUGGEE_METHODS[i][1] + + "\"\n\twas loaded by the debuggee VM, unable to test an assertion"); + continue; + } + else { + log.complain("TEST FAILED: expected ClassNotLoadedException was not thrown" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + + clsType + "\""); + tot_res = Consts.TEST_FAILED; + } + } catch (ClassNotLoadedException ce) { + log.display("CHECK PASSED: caught expected " + ce + + "\n\t" + ce.className()); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ClassType.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected ClassNotLoadedException" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + + clsType + "\""); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009/TestDescription.java new file mode 100644 index 00000000000..f3a07bac098 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ClassType/invokeMethod/invokemethod009. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-4698670 + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ClassType.invokeMethod() + * properly throws ClassNotLoadedException - if any argument type + * has not yet been loaded through the appropriate class loader. + * The test works as follows. Debugger part of the test invokes + * debuggee methods "dummyMeth", "finDummyMeth" with arguments of + * non-loaded reference types "DummyType", "FinDummyType". + * The test makes sure that class has not been loaded by the debuggee + * VM through the JDI method VirtualMachine.classesByName() which + * should return list of loaded classes only. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod009 + * nsk.jdi.ClassType.invokeMethod.invokemethod009t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009t.java new file mode 100644 index 00000000000..9198633a83c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009t.java @@ -0,0 +1,83 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class invokemethod009t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod009t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Thread.currentThread().setName(invokemethod009.DEBUGGEE_THRNAME); + + pipe.println(invokemethod009.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod009.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod009.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod009.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } + + // dummy static methods used to provoke ClassNotLoadedException + static void dummyMeth(invokemethod009tDummyType dummyT) { + System.err.println("the method \"dummyMeth\" was invoked!"); + } + + static long finDummyMeth(invokemethod009tFinDummyType finDummyT) { + System.err.println("the method \"finDummyMeth\" was invoked!"); + return 9223372036854775807L; + } +} + +// Dummy reference types used to provoke ClassNotLoadedException +// in the debugger +class invokemethod009tDummyType {} +final class invokemethod009tFinDummyType {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010.java new file mode 100644 index 00000000000..5280d9da008 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010.java @@ -0,0 +1,214 @@ +/* + * 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.ClassType.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ClassType.invokeMethod() + * properly throws IncompatibleThreadStateException - if the + * specified thread has not been suspended by an event.

    + * + * The test works as follows. Debugger part of the test attempts + * to invoke several debuggee methods using main debuggee thread + * invokemethod010tThr has been suspended by the JDI method + * ThreadReference.suspend() instead of by an event. + */ +public class invokemethod010 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.invokeMethod.invokemethod010t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod010tThr"; + + // tested debuggee methods and type reference numbers + static final int METH_NUM = 10; + static final String DEBUGGEE_METHODS[] = { + "byteMeth", + "shortMeth", + "intMeth", + "longMeth", + "floatMeth", + "doubleMeth", + "charMeth", + "booleanMeth", + "strMeth", + "voidMeth" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int ATTEMPTS = 5; + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod010().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod010t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: unable to suspend debuggee thread"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee thread suspension ..."); + try { + Thread.currentThread().sleep(TIMEOUT_DELTA); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + ClassType clsType = (ClassType) rType; + + for (int i=0; iemptyList(), 0); + + log.complain("TEST FAILED: expected IncompatibleThreadStateException was not thrown" + + "\n\twhen attempted to invoke the static method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + clsType + + "\" and the thread reference which has not been suspended by an event."); + tot_res = Consts.TEST_FAILED; + } catch (IncompatibleThreadStateException is) { + log.display("CHECK PASSED: caught expected " + is); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ClassType.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected IncompatibleThreadStateException" + + "\n\twhen attempted to invoke the static method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + clsType + + "\" and the thread reference which has not been suspended by an event."); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private int quitDebuggee() { + log.display("\nFinal resumption of the debuggee thread"); + if (thrRef != null) { + if (thrRef.isSuspended()) + thrRef.resume(); + } + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010/TestDescription.java new file mode 100644 index 00000000000..ddec2742aef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/ClassType/invokeMethod/invokemethod010. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ClassType.invokeMethod() properly throws + * IncompatibleThreadStateException - if the specified thread has + * not been suspended by an event. + * The test works as follows. Debugger part of the test attempts + * to invoke several debuggee methods using main debuggee thread + * "invokemethod010tThr" suspended by the JDI method + * ThreadReference.suspend() instead of by an event. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod010 + * nsk.jdi.ClassType.invokeMethod.invokemethod010t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod010 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010t.java new file mode 100644 index 00000000000..585c5711664 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010t.java @@ -0,0 +1,97 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is debuggee class. + */ +public class invokemethod010t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod010t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Thread.currentThread().setName(invokemethod010.DEBUGGEE_THRNAME); + + pipe.println(invokemethod010.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(invokemethod010.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } + + // dummy static methods used to provoke IncompatibleThreadStateException + // in the debugger + static byte byteMeth() { + return 127; + } + + static short shortMeth() { + return -32768; + } + + static int intMeth() { + return 2147483647; + } + + static long longMeth() { + return 9223372036854775807L; + } + + static float floatMeth() { + return 5.1F; + } + + static double doubleMeth() { + return 6.2D; + } + + static char charMeth() { + return 'a'; + } + + static boolean booleanMeth() { + return false; + } + + static String strMeth() { + return "string method"; + } + + static void voidMeth() {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java new file mode 100644 index 00000000000..c72e6bd1dfb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java @@ -0,0 +1,460 @@ +/* + * 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.ClassType.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that invocation with all threads resumption + * and the single threaded one will be performed properly through + * the JDI method
    + * com.sun.jdi.ClassType.invokeMethod(). + * The following assertions are verified: + *

  • by default, all threads in the target VM are resumed while + * the method is being invoked + *
  • when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation + *
  • only the specified thread will be resumed with the flag + * INVOKE_SINGLE_THREADED + *
  • upon completion of a single threaded invoke, the invoking + * thread will be suspended once again.

    + * + * A debuggee part of the test starts several threads. Then debugger + * calls the JDI method without and with the flag INVOKE_SINGLE_THREADED + * sequentially. During the invocations and after them the threads state + * is expected to be as described above. + */ +public class invokemethod011 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.invokeMethod.invokemethod011t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 66; + + // debuggee thread names to be check + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRNAMES[] = { + "invokemethod011tMainThr", "invokemethod011tThr1", "invokemethod011tThr2", + "invokemethod011tThr3", "invokemethod011tThr4", "invokemethod011tThr5", + "invokemethod011tThr6", "invokemethod011tThr7", "invokemethod011tThr8", + "invokemethod011tThr9", "invokemethod011tThr10", "invokemethod011tThr11" + }; + + // tested debuggee method + static final String DEBUGGEE_METHOD = + "dummyMeth"; + + // debuggee fields used to operate on an invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int ATTEMPTS = 10; + static final int DELAY = 1000; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod011().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod011t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i methList = rType.methodsByName(DEBUGGEE_METHOD); + + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHOD + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + InvokingThread invThr = null; + Wicket invThrWicket = null; + BooleanValue val = null; + + // Check the tested assersion + for (int i=1; i<=2; i++) + { + invThrWicket = new Wicket(); + + switch(i) { + case 1: // invocation with all threads resumption + invThr = new InvokingThread(clsType, thrRef[0], meth, + argList, 0, invThrWicket); + break; + case 2: // the single threaded invocation + invThr = new InvokingThread(clsType, thrRef[0], meth, + argList, ClassType.INVOKE_SINGLE_THREADED, invThrWicket); + break; + } + invThr.setDaemon(true); + invThr.start(); + + // wait for invThr to be started + log.display("Waiting for invThr thread to be started ..."); + invThrWicket.waitFor(); + + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + do { + if (tryOns > ATTEMPTS) + throw new Failure("unable to continue testing after " + + ATTEMPTS + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + clsType.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during method invocation + checkThreads(thrRef, i); + + clsType.setValue(fldToExit, vm.mirrorOf(true)); + + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after method invocation + checkThreads(thrRef, 0); + } + + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (clsType != null && fldToExit != null) { + try { + clsType.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + switch (state) { + case 0: + log.display("\n\nVerifying threads status after method invocation:"); + break; + case 1: + log.display("\n\nVerifying invocation with all threads resumption:"); + break; + case 2: + log.display("\n\nVerifying the single threaded invocation (INVOKE_SINGLE_THREADED):"); + break; + } + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i argList; + int bitOpts; + Wicket wicket; + + InvokingThread(ClassType clsRef, ThreadReference thrRef, Method meth, + LinkedList argList, int bitOpts, Wicket wicket) { + this.clsRef = clsRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + this.wicket = wicket; + super.setName("InvokingThread"); + } + + public void run() { + wicket.unlock(); + + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tand " + + new String((bitOpts==ClassType.INVOKE_SINGLE_THREADED)? "with" : "without") + + " the flag INVOKE_SINGLE_THREADED\n\tusing the debuggee class \"" + + clsRef + "\" ..."); + + LongValue retVal = (LongValue) + clsRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011/TestDescription.java new file mode 100644 index 00000000000..f31eba22b76 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011/TestDescription.java @@ -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/ClassType/invokeMethod/invokemethod011. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that invocation with all threads resumption + * and the single threaded one will be performed properly through + * the JDI method: + * com.sun.jdi.ClassType.invokeMethod(). + * The following assertions are verified: + * - by default, all threads in the target VM are resumed while + * the method is being invoked; + * - when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation; + * - only the specified thread will be resumed with the flag + * INVOKE_SINGLE_THREADED; + * - upon completion of a single threaded invoke, the invoking + * thread will be suspended once again. + * A debuggee part of the test starts several threads. Then debugger + * calls the JDI method without and with the flag INVOKE_SINGLE_THREADED + * sequentially. During the invocations and after them the threads state + * is expected to be as described above. + * COMMENTS + * Fixed TEST_BUG 6358778. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod011 + * nsk.jdi.ClassType.invokeMethod.invokemethod011t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod011 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java new file mode 100644 index 00000000000..48651dd30f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java @@ -0,0 +1,187 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is debuggee class. + */ +public class invokemethod011t { + static Log log; + private invokemethod011Thr thrs[] = + new invokemethod011Thr[invokemethod011.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod011t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + pipe = argHandler.createDebugeeIOPipe(); + log = argHandler.createDebugeeLog(); + Thread.currentThread().setName(invokemethod011.DEBUGGEE_THRNAMES[0]); + // start several dummy threads with given names + startThreads(); + + pipe.println(invokemethod011.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod011.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod011.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + killThreads(argHandler.getWaitTime()*60000); + if (!cmd.equals(invokemethod011.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + return Consts.TEST_PASSED; + } + + /* + * Dummy fields and method used to check the flag INVOKE_SINGLE_THREADED + * in the debugger. + */ + // used by the debugger to let the invoked method exit + static volatile boolean doExit = false; + // indicator of the method invocation + static volatile boolean isInvoked = false; + + static long dummyMeth(long l) throws InterruptedException { + invokemethod011t.log.display("dummyMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod011t.log.display("dummyMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i + * com.sun.jdi.ClassType.invokeMethod(). + * The following assertions are verified: + *

  • only the specified thread will be resumed with the flag + * INVOKE_SINGLE_THREADED + *
  • upon completion of a single threaded invoke, the invoking + * thread will be suspended once again; any threads started during + * the single threaded invocation will not be suspended when the + * invocation completes.

    + * + * A debuggee part of the test starts several threads. The debugger + * calls the JDI method with the flag ClassType.INVOKE_SINGLE_THREADED. + * Then, during the invocation the debugger resumes some threads. + * Upon completing the invocation, these resumed threads are checked + * to be not suspended again. + */ +public class invokemethod012 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.invokeMethod.invokemethod012t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 68; + + // debuggee fields used to operate on an invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + // debuggee threads to be check + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRDS[][] = { + {"invokemethod012tMainThr", "no"}, + {"invokemethod012tThr1", "no"}, + {"invokemethod012tThr2", "resume"}, + {"invokemethod012tThr3", "resume"}, + {"invokemethod012tThr4", "no"}, + {"invokemethod012tThr5", "no"}, + {"invokemethod012tThr6", "no"}, + {"invokemethod012tThr7", "no"}, + {"invokemethod012tThr8", "resume"}, + {"invokemethod012tThr9", "no"}, + {"invokemethod012tThr10", "no"}, + {"invokemethod012tThr11", "resume"} + }; + + // debuggee method to be invoke + static final String DEBUGGEE_METHOD = + "dummyMeth"; + + static final int ATTEMPTS = 10; + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod012().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod012t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + Wicket invThrWicket = new Wicket(); + + // the single threaded invocation + InvokingThread invThr = new InvokingThread(clsType, thrRef[0], meth, + argList, ClassType.INVOKE_SINGLE_THREADED, invThrWicket); + + invThr.setDaemon(true); + invThr.start(); + + // wait for invThr to be started + log.display("Waiting for invThr thread to be started ..."); + invThrWicket.waitFor(); + + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + BooleanValue val = null; + do { + if (tryOns > ATTEMPTS) + throw new Failure("unable to continue testing after " + + ATTEMPTS + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + clsType.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during the method invocation + checkThreads(thrRef, 1); + + // resume some threads during the method invocation + resumeSomeThreads(thrRef); + + clsType.setValue(fldToExit, vm.mirrorOf(true)); + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after the method invocation + checkThreads(thrRef, 0); + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (clsType != null && fldToExit != null) { + try { + clsType.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + switch (state) { + case 0: + log.display("\nVerifying threads status when the invocation completes:"); + break; + case 1: + log.display("\nVerifying the single threaded invocation:"); + break; + } + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after the invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i ATTEMPTS) + throw new Failure("unable to continue testing after " + + ATTEMPTS + + " attempts: debuggee thread " + + thrRef[i] + " is not resumed yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + tryOns++; + } while (thrRef[i].isSuspended()); + log.display("The thread " + thrRef[i] + + "\n\tis resumed"); + } + } + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("\nFinal resumption of the debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + + /** + * A separate thread class used in debuggee method invocation because + * it is synchronous. + */ + class InvokingThread extends Thread { + ClassType clsRef; + ThreadReference thrRef; + Method meth; + LinkedList argList; + int bitOpts; + Wicket wicket; + + InvokingThread(ClassType clsRef, ThreadReference thrRef, Method meth, + LinkedList argList, int bitOpts, Wicket wicket) { + this.clsRef = clsRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + this.wicket = wicket; + super.setName("InvokingThread"); + } + + public void run() { + wicket.unlock(); + + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tand " + + new String((bitOpts==ClassType.INVOKE_SINGLE_THREADED)? "with" : "without") + + " the flag INVOKE_SINGLE_THREADED\n\tusing the debuggee class \"" + + clsRef + "\" ..."); + + LongValue retVal = (LongValue) + clsRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012/TestDescription.java new file mode 100644 index 00000000000..2e1d646a829 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ClassType/invokeMethod/invokemethod012. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the single threaded invocation will be + * performed properly through the JDI method: + * com.sun.jdi.ClassType.invokeMethod(). + * The following assertions are verified: + * - only the specified thread will be resumed with the flag + * INVOKE_SINGLE_THREADED; + * - upon completion of a single threaded invoke, the invoking + * thread will be suspended once again; any threads started + * during the single threaded invocation will not be suspended + * when the invocation completes. + * A debuggee part of the test starts several threads. The debugger + * calls the JDI method with the flag ClassType.INVOKE_SINGLE_THREADED. + * Then, during the invocation the debugger resumes some threads. + * Upon completing the invocation, these resumed threads are checked + * to be not suspended again. + * COMMENTS + * Fixed TEST_BUG 6358778. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod012 + * nsk.jdi.ClassType.invokeMethod.invokemethod012t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod012 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java new file mode 100644 index 00000000000..9a93c682f0b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java @@ -0,0 +1,189 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is main debuggee class. + */ +public class invokemethod012t { + static Log log; + private invokemethod012Thr thrs[] = + new invokemethod012Thr[invokemethod012.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod012t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(invokemethod012.DEBUGGEE_THRDS[0][0]); + // Start several dummy threads with given names + startThreads(); + + // Now the debuggee is ready for testing + pipe.println(invokemethod012.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod012.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod012.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + killThreads(argHandler.getWaitTime()*60000); + if (!cmd.equals(invokemethod012.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + return Consts.TEST_PASSED; + } + + /* + * Dummy fields and method used to check the flag INVOKE_SINGLE_THREADED + * in the debugger. + */ + // used by the debugger to let the invoked method exit + static volatile boolean doExit = false; + // indicator of the method invocation + static volatile boolean isInvoked = false; + + static long dummyMeth(long l) throws InterruptedException { + invokemethod012t.log.display("dummyMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod012t.log.display("dummyMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i < invokemethod012.THRDS_NUM-1; i++) { + thrs[i] = new invokemethod012Thr(readyObj, + invokemethod012.DEBUGGEE_THRDS[i+1][0]); + thrs[i].setDaemon(true); + log.display("Debuggee: starting thread #" + + i + " \"" + thrs[i].getName() + "\" ..."); + synchronized(readyObj) { + thrs[i].start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + thrs[i].toString() + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread #" + + i + " \"" + thrs[i].getName() + "\" started"); + } + } + + private void killThreads(int waitTime) { + for (int i=0; i < invokemethod012.THRDS_NUM-1 ; i++) { + thrs[i].doExit = true; + try { + thrs[i].join(waitTime); + log.display("Debuggee: thread #" + + i + " \"" + thrs[i].getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread #" + + i + " \"" + thrs[i].getName() + "\": caught " + e); + } + } + } + + /** + * This is an auxiliary thread class used to check the flag + * INVOKE_SINGLE_THREADED in the debugger. + */ + class invokemethod012Thr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + invokemethod012Thr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + Thread thr = Thread.currentThread(); + Object waitObj = new Object(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(waitObj) { + try { + waitObj.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java new file mode 100644 index 00000000000..68600892b59 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java @@ -0,0 +1,493 @@ +/* + * 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.ClassType.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that debuggee method invocation will be + * performed properly through the JDI method
    + * com.sun.jdi.ClassType.invokeMethod().

    + * + * The following assertions are verified: + *

  • all threads in the target VM are resumed while the method is + * being invoked. If the thread's suspend count is greater than 1, + * it will remain in a suspended state during the invocation. + *
  • when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation.

    + * + * A debuggee part of the test starts several threads. The debugger + * suspends all threads by a breakpoint event and then, some + * of them one more time. After that, it calls the JDI method. The + * threads are checked to be resumed or remain suspended during the + * invocation (depending on the suspend count), and, upon completing + * the invocation, to be suspended again. + */ +public class invokemethod013 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.invokeMethod.invokemethod013t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 68; + + // debuggee fields used to operate on invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + // debuggee threads to be check and their suspend count + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRDS[][] = { + {"invokemethod013tThr", "single-suspension"}, + {"invokemethod013tThr1", "single-suspension"}, + {"invokemethod013tThr2", "single-suspension"}, + {"invokemethod013tThr3", "single-suspension"}, + {"invokemethod013tThr4", "double-suspension"}, + {"invokemethod013tThr5", "single-suspension"}, + {"invokemethod013tThr6", "single-suspension"}, + {"invokemethod013tThr7", "single-suspension"}, + {"invokemethod013tThr8", "double-suspension"}, + {"invokemethod013tThr9", "double-suspension"}, + {"invokemethod013tThr10", "single-suspension"}, + {"invokemethod013tThr11", "double-suspension"} + }; + + // debuggee method to be invoke + static final String DEBUGGEE_METHOD = + "dummyMeth"; + + static final int ATTEMPTS = 10; + static final int DELAY = 400; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod013().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod013t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i methList = rType.methodsByName(DEBUGGEE_METHOD); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHOD + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + Wicket invThrWicket = new Wicket(); + InvokingThread invThr = new InvokingThread(clsRef, thrRef[0], + meth, argList, 0, invThrWicket); + + invThr.setDaemon(true); + + // suspend some threads one more time before the method + // invocation to make the thread's suspend count greater than 1 + suspendSomeThreads(thrRef); + + // perform the invocation + invThr.start(); + + // wait for invThr to be started + log.display("Waiting for invThr thread to be started ..."); + invThrWicket.waitFor(); + + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + BooleanValue val = null; + do { + if (tryOns > ATTEMPTS) + throw new Failure("unable to continue testing after " + + ATTEMPTS + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + clsRef.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during the method invocation + checkThreads(thrRef, 1); + + // finish the invocation + clsRef.setValue(fldToExit, vm.mirrorOf(true)); + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after the method invocation + checkThreads(thrRef, 0); + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (clsRef != null && fldToExit != null) { + try { + clsRef.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + log.display("\nVerifying threads status " + + new String((state==0)? "after" : "during") + + " the invocation:"); + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after the invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i ATTEMPTS) + throw new Failure("unable to continue testing after " + + ATTEMPTS + + " attempts: debuggee thread " + + thrRef[i] + " is not suspended yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + tryOns++; + } while (thrRef[i].suspendCount() != 2); + log.display("The thread " + thrRef[i] + + "\n\tis suspended one more time: the number of pending suspends = " + + thrRef[i].suspendCount()); + } + } + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Resuming debuggee VM twice ..."); + vm.resume(); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + + /** + * A separate thread class used in the debuggee method invocation because + * it is synchronous. + */ + class InvokingThread extends Thread { + ClassType clsRef; + ThreadReference thrRef; + Method meth; + LinkedList argList; + int bitOpts; + Wicket wicket; + + InvokingThread(ClassType clsRef, ThreadReference thrRef, Method meth, + LinkedList argList, int bitOpts, Wicket wicket) { + this.clsRef = clsRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + this.wicket = wicket; + super.setName("InvokingThread"); + } + + public void run() { + wicket.unlock(); + + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tusing the debuggee class \"" + + clsRef + "\" ..."); + + LongValue retVal = (LongValue) + clsRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013/TestDescription.java new file mode 100644 index 00000000000..0842b206ad8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ClassType/invokeMethod/invokemethod013. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that debuggee method invocation will be + * performed properly through the JDI method: + * com.sun.jdi.ClassType.invokeMethod(). + * The following assertions are verified: + * - all threads in the target VM are resumed while the method is + * being invoked. If the thread's suspend count is greater than 1, + * it will remain in a suspended state during the invocation. + * - when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation. + * A debuggee part of the test starts several threads. The debugger + * suspends all threads by a breakpoint event and then, some + * of them one more time. After that, it calls the JDI method. The + * threads are checked to be resumed or remain suspended during the + * invocation (depending on the suspend count), and, upon completing + * the invocation, to be suspended again. + * COMMENTS + * Fixed TEST_BUG 6358778. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod013 + * nsk.jdi.ClassType.invokeMethod.invokemethod013t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod013 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java new file mode 100644 index 00000000000..8224f26e657 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java @@ -0,0 +1,189 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is main debuggee class. + */ +public class invokemethod013t { + static Log log; + private invokemethod013Thr thrs[] = + new invokemethod013Thr[invokemethod013.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod013t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(invokemethod013.DEBUGGEE_THRDS[0][0]); + // Start several dummy threads with given names + startThreads(); + + // Now the debuggee is ready for testing + pipe.println(invokemethod013.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod013.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod013.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + killThreads(argHandler.getWaitTime()*60000); + if (!cmd.equals(invokemethod013.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + return Consts.TEST_PASSED; + } + + /* + * Dummy fields and method used to check method invocation in the debugger. + */ + // used by the debugger to let the invoked method exit + static volatile boolean doExit = false; + // indicator of the method invocation + static volatile boolean isInvoked = false; + + static long dummyMeth(long l) throws InterruptedException { + invokemethod013t.log.display("dummyMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod013t.log.display("dummyMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i < invokemethod013.THRDS_NUM-1; i++) { + thrs[i] = new invokemethod013Thr(readyObj, + invokemethod013.DEBUGGEE_THRDS[i+1][0]); + thrs[i].setDaemon(true); + + log.display("Debuggee: starting thread #" + + i + " \"" + thrs[i].getName() + "\" ..."); + synchronized(readyObj) { + thrs[i].start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + thrs[i].toString() + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread #" + + i + " \"" + thrs[i].getName() + "\" started"); + } + } + + private void killThreads(int waitTime) { + for (int i=0; i < invokemethod013.THRDS_NUM-1 ; i++) { + thrs[i].doExit = true; + try { + thrs[i].join(waitTime); + log.display("Debuggee: thread #" + + i + " \"" + thrs[i].getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread #" + + i + " \"" + thrs[i].getName() + "\": caught " + e); + } + } + } + + /** + * This is an auxiliary thread class used to check method + * invocation in the debugger. + */ + class invokemethod013Thr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + invokemethod013Thr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + Thread thr = Thread.currentThread(); + Object waitObj = new Object(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(waitObj) { + try { + waitObj.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014.java new file mode 100644 index 00000000000..ab5c0ae798f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014.java @@ -0,0 +1,292 @@ +/* + * 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.ClassType.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ClassType.invokeMethod() + * properly throws IllegalArgumentException when + * debugger part of the test attempts to invoke several + * debuggee methods: + *

  • which are constructors or static intializers + *
  • which are instance ones. + */ +public class invokemethod014 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.invokeMethod.invokemethod014t"; + + // tested instance debuggee methods + static final int METH_NUM = 12; + static final String DEBUGGEE_METHODS[] = { + "", + "", + "byteMeth", + "shortMeth", + "intMeth", + "longMeth", + "floatMeth", + "doubleMeth", + "charMeth", + "booleanMeth", + "strMeth", + "voidMeth" + }; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod014tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 61; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod014().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod014t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + ClassType clsType = (ClassType) rType; + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; iemptyList(), 0); + + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to invoke instance method/initializer \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + clsType + "\""); + tot_res = Consts.TEST_FAILED; + } catch (IllegalArgumentException is) { + log.display("CHECK PASSED: caught expected " + is); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ClassType.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected IllegalArgumentException" + + "\n\twhen attempted to invoke instance method/initializer \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee class \"" + clsType + "\""); + tot_res = Consts.TEST_FAILED; + } + + } + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Final resuming debuggee VM ..."); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014/TestDescription.java new file mode 100644 index 00000000000..bf89fb63c35 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014/TestDescription.java @@ -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/ClassType/invokeMethod/invokemethod014. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ClassType.invokeMethod() + * properly throws IllegalArgumentException when debugger part + * of the test attempts to invoke several debuggee methods: + * - which are constructors or static intializers; + * - which are instance ones. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod014 + * nsk.jdi.ClassType.invokeMethod.invokemethod014t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod014 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014t.java new file mode 100644 index 00000000000..f482c4c396d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014t.java @@ -0,0 +1,111 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is debuggee class. + */ +public class invokemethod014t { + static {} // force javac to produce method + + invokemethod014t() {} // force javac to produce method + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod014t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Thread.currentThread().setName(invokemethod014.DEBUGGEE_THRNAME); + + pipe.println(invokemethod014.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod014.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod014.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod014.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } + + // Dummy instance methods used to provoke IllegalArgumentException in the debugger + byte byteMeth() { + return 127; + } + + short shortMeth() { + return -32768; + } + + int intMeth() { + return 2147483647; + } + + long longMeth() { + return 9223372036854775807L; + } + + float floatMeth() { + return 5.1F; + } + + double doubleMeth() { + return 6.2D; + } + + char charMeth() { + return 'a'; + } + + boolean booleanMeth() { + return false; + } + + String strMeth() { + return "string method"; + } + + void voidMeth() {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015.java new file mode 100644 index 00000000000..b96cfe74d68 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015.java @@ -0,0 +1,381 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.io.*; +import java.util.*; + +/** + */ +public class invokemethod015 { + + //----------------------------------------------------- immutable common fields + + private int waitTime; + private static int exitStatus = Consts.TEST_PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.ClassType.invokeMethod"; + private final static String className = ".invokemethod015"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 54; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + //------------------------------------------------------ test specific fields + + private static final String fieldName = "f1"; + private static final String methodName = "values"; +// private static final String methodSignature = "()[Lnsk/jdi/ClassType/invokeMethod/invokemethod015aEnum"; + private static final String[] expectedEnumFieldsNames = { "e1", "e2" }; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new invokemethod015().runThis(argv, out); + return exitStatus; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (Consts.TEST_PASSED + Consts.JCK_STATUS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitStatus = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitStatus = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitStatus; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + display("Wait for initial brakepoint event..."); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + ThreadReference thread = bpEvent.thread(); + + display("TESTING BEGINS"); + try { + ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type(); + String className = checkedClass.name(); + + List l = checkedClass.methods(); + Method checkedMethod = null; + if (l.isEmpty()) { + complain("\t ReferenceType.methods() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + Iterator it = l.iterator(); + while (it.hasNext()) { + Method m = it.next(); + if (methodName.equals(m.name())) + checkedMethod = m; + } + if (checkedMethod != null) { + ArrayReference values = (ArrayReference)checkedClass.invokeMethod(thread, checkedMethod , Collections.emptyList(), 0); + if (values.length() == 2) { + List constants = values.getValues(); + Iterator it1 = constants.iterator(); + while (it1.hasNext()) { + ObjectReference checkedField = (ObjectReference)it1.next(); + if (checkedField.type().equals(checkedClass)) { + display("Invoked method " + methodName + " returned expected object " + checkedField.toString()); + } else { + display("Invoked method " + methodName + " returned unexpected object " + checkedField.toString()); + exitStatus = Consts.TEST_FAILED; + } + } + } else { + complain("Invoked method " + methodName + " returned list of unexpected size: " + values.length()); + exitStatus = Consts.TEST_FAILED; + } + } else { + complain("Cannot find in " + className + " the checked method " + methodName); + exitStatus = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + complain("Unexpected exception while checking of " + className + ": " + e); + e.printStackTrace(System.out); + exitStatus = Consts.TEST_FAILED; + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015/TestDescription.java new file mode 100644 index 00000000000..e15d0cf8b15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015/TestDescription.java @@ -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/ClassType/invokeMethod/invokemethod015. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for invokeMethod method of ClassType interface. + * The test checks if static values() method returns mirrors of enum + * constants when it was invoked via checked method for any mirrored + * enum type. The values() method is automatically implemented in any + * enum type. + * The debugger class - nsk.jdi.ClassType.invokeMethod.ivokemethod015; + * the debuggee class - nsk.jdi.ClassType.invokeMethod.ivokemethod015a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This breakpoint allows the + * debugger to obtain ThreadReference mirror of debuggee's main thread; + * - after getting the BreakpointEvent, the debugger finds mirrors of + * invokemethod015aEnum enum type and of values() method; + * - then the debugger calls invokeMethod with found mirrors as parameters + * and check if returned list is of correct size and contains ObjectRefences + * for every declared enum constant. + * In case of error the test produces the exit code 97 and a corresponding + * error message(s). Otherwise, the test is passed with exit code 95. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.invokeMethod.invokemethod015 + * nsk.jdi.ClassType.invokeMethod.invokemethod015a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.invokeMethod.invokemethod015 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015a.java new file mode 100644 index 00000000000..fe2050c68a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015a.java @@ -0,0 +1,84 @@ +/* + * 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.ClassType.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class invokemethod015a { + + //----------------------------------------------------- immutable common fields + + static int exitCode = Consts.TEST_PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = 1; // invokemethod015.lineForBreak + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static invokemethod015aEnum f1 = invokemethod015aEnum.e1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + display("debuggee started!"); + + methodForCommunication(); + + display("debuggee exits"); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific methodss +} + +//--------------------------------------------------------- test specific classes + +enum invokemethod015aEnum { + e1, e2; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001.java new file mode 100644 index 00000000000..52b9a92241b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001.java @@ -0,0 +1,134 @@ +/* + * 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.ClassType.isEnum; + +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 isenum001 { + + //------------------------------------------------------- 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.ClassType.isEnum."; + private final static String className = "isenum001"; + 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", "f5", "f6", "f7", "f8"}; + + //------------------------------------------------------- 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 < 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.isEnum()) { + display("CHECK PASSED: ClassType.isEnum() returned expected true for type: " + className); + } else { + complain("ClassType.isEnum() returned unexpected false 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001/TestDescription.java new file mode 100644 index 00000000000..00948ebc9cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ClassType/isEnum/isenum001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isEnum() method of ClassType interface. + * The test checks if the method returns true for any + * mirrored enum type + * The test consists of a debugger program (isenum001.java) + * and debuggee application (isenum001a.java). + * Package name is nsk.jdi.ClassType.isEnum . + * 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 isEnum() method for each field + * of enum type declared in isenum001a class. + * The test fails if the method returned false once or more. + * 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.ClassType.isEnum.isenum001 + * nsk.jdi.ClassType.isEnum.isenum001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.isEnum.isenum001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001a.java new file mode 100644 index 00000000000..96639ad0d5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/isEnum/isenum001a.java @@ -0,0 +1,167 @@ +/* + * 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.ClassType.isEnum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isenum001a { + + //------------------------------------------------------- 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; + static Enum4.Enum4_ f4 = Enum4.Enum4_.e1; + static isenum001Enum5 f5 = isenum001Enum5.e2; + static isenum001Enum6 f6 = isenum001Enum6.e1; + static isenum001Enum7 f7 = isenum001Enum7.e2; + static isenum001Enum8.Enum8_ f8 = isenum001Enum8.Enum8_.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(isenum001.SIGNAL_READY); + + + //pipe.println(isenum001.SIGNAL_GO); + receiveSignal(isenum001.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + + enum Enum1 { + e1, e2; + } + + enum Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); + } + + enum Enum3 implements isenum001i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); + } + + enum Enum4 { + e1, e2; + + enum Enum4_ { + e1, e2; + } + } + +} + +//--------------------------------------------------------- test specific classes + +enum isenum001Enum5 { + e1, e2; +} + +enum isenum001Enum6 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum isenum001Enum7 implements isenum001i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +enum isenum001Enum8 { + e1, e2; + enum Enum8_ { + e1, e2; + } +} + +interface isenum001i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java new file mode 100644 index 00000000000..7121131fb20 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java @@ -0,0 +1,561 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.newInstance()
    + * complies with its specification.
    + * The case for testing includes invoking the method to create
    + * new instance of the class TestClass
    + * which is global to a class implementing debuggee's thread
    + * in which instance creation is performed.
    + * No exception is expected to be thrown in response to call
    + * to the method.
    + *
    + * The test works as follows.
    + * A debugger launchs a debuggee which creates new thread, thread2.
    + * The tested class TestClass is specified outside of the class
    + * Threadnewinstance002a extends Thread
    + * After getting thread2 running but locked at a monitor
    + * the debugger informs the debugger of the thread2 creation
    + * and waits for an instruction from it.
    + * Upon receiving the message from the debuggee, the debugger
    + * sets up a breakpoint for the thread2 and instructs the
    + * debuggee to unlock the thread2 and after getting it suspended
    + * at the breakpoint, prepares arguments and invokes the method.
    + * After the method completes, the debugger checks up on
    + * a returned ObjectReference value;
    + * the following is expected to be true:
    + * objRef.referenceType().equals(classType)
    + * where
    + * ObjectReference objRef - is returned value
    + * ClassType classType - is a mirror of the tested class.
    + */ + +public class newinstance001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/newInstance/newinstance001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new newinstance001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.newInstance.newinstance001a"; + + private String testedClassName = + "nsk.jdi.ClassType.newInstance.TestClass"; + + private String threadName = "testedThread"; + + private String threadClassName = + "nsk.jdi.ClassType.newInstance.Threadnewinstance001a"; + + //String mName = "nsk.jdi.ClassType.newInstance"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedClass = null; + + ReferenceType threadClass = null; + + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String breakpointMethod1 = "runt1"; + + String bpLine1 = "breakpointLineNumber1"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + + ClassType classType = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(threadClassName); + threadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + log2("......getting Thread thread2 - 1-st argument"); + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2("......getting ClassType classType - an object to apply newInstance()"); + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + classType = (ClassType) testedClass; + + List invokeMethods = testedClass.methods(); + ListIterator li = invokeMethods.listIterator(); + + Method invokeMethod = null; + + log2("......getting Method invokeMethod - a constructor to invoke; 2-nd argument"); + try { + for (;;) { + invokeMethod = (Method) li.next(); + if (!invokeMethod.isConstructor()) + continue; + if (invokeMethod.arguments().size() == 0) + break; + } + } catch ( AbsentInformationException e1 ) { + log2(" AbsentInformationException "); + break label1; + } catch ( NoSuchElementException e2 ) { + log3("ERROR: NoSuchElementException "); + expresult = returnCode2; + break label1; + } + + + // this is only to get an empty List with JDI methods but not with API List methods + log2("......forming an empty List argumentList for 3-d argument"); + log2(" List argumentList = testedClass.methodsByName('m');"); + List argumentListm = testedClass.methodsByName("m"); + log2(" argumentList.clear();"); + argumentListm.clear(); + List argumentList = Collections.emptyList(); + + ObjectReference objRef = null; + + log2("......ObjectReference objRef = classType.newInstance(thread2, invokeMethod, argumentList, 0);"); + log2(" No Exception is expected"); + try { + objRef = classType.newInstance(thread2, + invokeMethod, argumentList, 0); + if (objRef == null) + log2(" objRe == null"); + + + log2(" ReferenceType refType = objRef.referenceType();"); + ReferenceType refType = objRef.referenceType(); + + log2(" ClassType cType = (ClassType) refType;"); + ClassType cType = (ClassType) refType; + + log2("......checking up on: cType.equals(classType); "); + if (!cType.equals(classType)) { + log3("ERROR: !cType.equals(classType)"); + expresult = returnCode1; + } + + } catch ( Exception e ) { + log3("ERROR: Exception for classType.newInstance() :" + e); + expresult = returnCode1; + } + } + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { +// Method method = (Method) testedclass.methodsByName(methodName).get(0); + Method method = (Method) threadClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = +// ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + ( (IntegerValue) threadClass.getValue(threadClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001/TestDescription.java new file mode 100644 index 00000000000..333a7acf131 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001/TestDescription.java @@ -0,0 +1,149 @@ +/* + * 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/ClassType/newInstance/newinstance001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.newInstance() + * complies with its spec: + * public ObjectReference newInstance(ThreadReference thread, + * Method method, + * List arguments, + * int options) + * throws InvalidTypeException, + * ClassNotLoadedException, + * IncompatibleThreadStateException, + * InvocationException + * Constructs a new instance of this type, using the given constructor Method + * in the target VM. The specified constructor must be defined in the this class. + * Instance creation will occur in the specified thread. + * Instance creation can occur only if the specified thread has + * been suspended by an event which occurred in that thread. + * Instance creation is not supported when the target + * VM has been suspended through VirtualMachine.suspend() or + * when the specified thread is suspended through ThreadReference.suspend(). + * The specified constructor is invoked with the arguments in the specified + * argument list. The invocation is synchronous; this method does not return + * until the constructor returns in the target VM. If the invoked method + * throws an exception, this method will throw an InvocationException which + * contains a mirror to the exception object thrown. + * Object arguments must be assignment compatible with the argument type + * (This implies that the argument type must be loaded through the enclosing + * class's class loader). Primitive arguments must be either assignment + * compatible with the argument type or must be convertible to the argument type + * without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * By default, all threads in the target VM are resumed while the method is being + * invoked if they were previously suspended by an event or by + * VirtualMachine.suspend() or ThreadReference.suspend(). + * This is done to prevent the deadlocks that will occur if any of the threads own + * monitors that will be needed by the invoked method. + * It is possible that breakpoints or other events might occur during + * the invocation. Note, however, that this implicit resume acts exactly like + * ThreadReference.resume(), so if the thread's suspend count is greater than 1, + * it will remain in a suspended state during the invocation. + * By default, when the invocation completes, + * all threads in the target VM are suspended, + * regardless their state before the invocation. + * The resumption of other threads during the invocation can be prevented by + * specifying the INVOKE_SINGLE_THREADED bit flag in the options argument; + * however, there is no protection against or recovery from the deadlocks + * described above, so this option should be used with great caution. + * Only the specified thread will be resumed (as described for all threads above). + * Upon completion of a single threaded invoke, the invoking thread will be + * suspended once again. Note that any threads started during the single threaded + * invocation will not be suspended when the invocation completes. + * If the target VM is disconnected during the invoke + * (for example, through VirtualMachine.dispose()) + * the method invocation continues. + * Parameters: + * thread - the thread in which to invoke. + * method - the constructor Method to invoke. + * arguments - the list of Value arguments bound to the invoked constructor. + * Values from the list are assigned to arguments in + * the order they appear in the constructor signature. + * options - the integer bit flag options. + * Returns: + * an ObjectReference mirror of the newly created object. + * Throws: + * IllegalArgumentException - + * if the method is not a member of this class, if the size of the + * argument list does not match the number of declared arguments for + * the constructor, or if the method is not a constructor. + * {link - InvalidTypeException} if any argument in the argument list is not + * assignable to the corresponding method argument type. + * ClassNotLoadedException - + * if any argument type has not yet been loaded through the appropriate class loader. + * IncompatibleThreadStateException - + * if the specified thread has not been suspended by an event. + * InvocationException - + * if the method invocation resulted in an exception in the target VM. + * ObjectCollectedException - + * if the given thread or any object argument has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to the same VirtualMachine. + * The case for testing includes invoking the method on the class TestClass + * which is global to a class implementing debuggee's thread in which + * instance creation is performed. + * No exception is expected to be thrown in response to call to the method. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.newInstance.newinstance001; + * the debuggee program - nsk.jdi.ClassType.newInstance.newinstance001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.newInstance.newinstance001 + * nsk.jdi.ClassType.newInstance.newinstance001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java new file mode 100644 index 00000000000..73f81f2b285 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java @@ -0,0 +1,236 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the newinstance001 JDI test. + */ + +public class newinstance001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.newInstance()
    + * complies with its specification.
    + * The case for testing includes invoking the method to create
    + * new instance of an inner class of ClassType extending Thread class.
    + * No exception is expected to be thrown in response to call
    + * to the method.
    + *
    + * The test works as follows.
    + * A debugger launchs a debuggee which creates new thread, thread2
    + * a tested class TestClass1 is specified within a class
    + * Threadnewinstance002a extends Thread
    + * After getting thread2 running but locked at a monitor
    + * the debugger informs the debugger of the thread2 creation
    + * and waits for an instruction from it.
    + * Upon receiving the message from the debuggee, the debugger
    + * sets up a breakpoint for the thread2 and instructs the
    + * debuggee to unlock the thread2 and after getting it suspended
    + * at the breakpoint, prepares arguments and invokes the method.
    + * After the method completes, the debugger checks up on
    + * a returned ObjectReference value; the following is expected
    + * to be true:
    + * objRef.referenceType().equals(classType)
    + * where
    + * ObjectReference objRef - is returned value
    + * ClassType classType - is a mirror of the tested class.
    + */ + +public class newinstance002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/newInstance/newinstance002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new newinstance002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.newInstance.newinstance002a"; + + private String testedClassName = + "nsk.jdi.ClassType.newInstance.Threadnewinstance002a$TestClass1"; + + private String threadName = "testedThread"; + + private String threadClassName = + "nsk.jdi.ClassType.newInstance.Threadnewinstance002a"; + + //String mName = "nsk.jdi.ClassType.newInstance"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedClass = null; + + ReferenceType threadClass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String breakpointMethod1 = "runt1"; + + String bpLine1 = "breakpointLineNumber1"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + + ClassType classType = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(threadClassName); + threadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2("......getting ClassType classType - an object to apply newInstance()"); + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + classType = (ClassType) testedClass; + + List invokeMethods = testedClass.methods(); + ListIterator li = invokeMethods.listIterator(); + + Method invokeMethod = null; + + log2("......getting Method invokeMethod - a constructor to invoke; 2-nd argument"); + try { + for (;;) { + invokeMethod = (Method) li.next(); + if (!invokeMethod.isConstructor()) + continue; + if (invokeMethod.arguments().size() == 0) + break; + } + } catch ( AbsentInformationException e1 ) { + log2(" AbsentInformationException "); + break label1; + } catch ( NoSuchElementException e2 ) { + log3("ERROR: NoSuchElementException "); + expresult = returnCode2; + break label1; + } + + + ObjectReference objRef = null; + + log2("......ObjectReference objRef = classType.newInstance(thread2, invokeMethod, Arrays.asList(thread2), 0);"); + log2(" No Exception is expected"); + try { + objRef = classType.newInstance(thread2, + invokeMethod, Arrays.asList(thread2), 0); + if (objRef == null) + log2(" objRe == null"); + + + log2(" ReferenceType refType = objRef.referenceType();"); + ReferenceType refType = objRef.referenceType(); + + log2(" ClassType cType = (ClassType) refType;"); + ClassType cType = (ClassType) refType; + + log2("......checking up on: cType.equals(classType); "); + if (!cType.equals(classType)) { + log3("ERROR: !cType.equals(classType)"); + expresult = returnCode1; + } + + } catch ( Exception e ) { + log3("ERROR: Exception for classType.newInstance() :" + e); + expresult = returnCode1; + } + + } + vm.resume(); // for case if thread2 was not resumed because of error in a check + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { +// Method method = (Method) testedclass.methodsByName(methodName).get(0); + Method method = (Method) threadClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = +// ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + ( (IntegerValue) threadClass.getValue(threadClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002/TestDescription.java new file mode 100644 index 00000000000..947582c18e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002/TestDescription.java @@ -0,0 +1,154 @@ +/* + * 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/ClassType/newInstance/newinstance002. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-4462897 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.newInstance() + * complies with its spec: + * public ObjectReference newInstance(ThreadReference thread, + * Method method, + * List arguments, + * int options) + * throws InvalidTypeException, + * ClassNotLoadedException, + * IncompatibleThreadStateException, + * InvocationException + * Constructs a new instance of this type, using the given constructor Method + * in the target VM. The specified constructor must be defined in the this class. + * Instance creation will occur in the specified thread. + * Instance creation can occur only if the specified thread has + * been suspended by an event which occurred in that thread. + * Instance creation is not supported when the target + * VM has been suspended through VirtualMachine.suspend() or + * when the specified thread is suspended through ThreadReference.suspend(). + * The specified constructor is invoked with the arguments in the specified + * argument list. The invocation is synchronous; this method does not return + * until the constructor returns in the target VM. If the invoked method + * throws an exception, this method will throw an InvocationException which + * contains a mirror to the exception object thrown. + * Object arguments must be assignment compatible with the argument type + * (This implies that the argument type must be loaded through the enclosing + * class's class loader). Primitive arguments must be either assignment + * compatible with the argument type or must be convertible to the argument type + * without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * By default, all threads in the target VM are resumed while the method is being + * invoked if they were previously suspended by an event or by + * VirtualMachine.suspend() or ThreadReference.suspend(). + * This is done to prevent the deadlocks that will occur if any of the threads own + * monitors that will be needed by the invoked method. + * It is possible that breakpoints or other events might occur during + * the invocation. Note, however, that this implicit resume acts exactly like + * ThreadReference.resume(), so if the thread's suspend count is greater than 1, + * it will remain in a suspended state during the invocation. + * By default, when the invocation completes, + * all threads in the target VM are suspended, + * regardless their state before the invocation. + * The resumption of other threads during the invocation can be prevented by + * specifying the INVOKE_SINGLE_THREADED bit flag in the options argument; + * however, there is no protection against or recovery from the deadlocks + * described above, so this option should be used with great caution. + * Only the specified thread will be resumed (as described for all threads above). + * Upon completion of a single threaded invoke, the invoking thread will be + * suspended once again. Note that any threads started during the single threaded + * invocation will not be suspended when the invocation completes. + * If the target VM is disconnected during the invoke + * (for example, through VirtualMachine.dispose()) + * the method invocation continues. + * Parameters: + * thread - the thread in which to invoke. + * method - the constructor Method to invoke. + * arguments - the list of Value arguments bound to the invoked constructor. + * Values from the list are assigned to arguments in + * the order they appear in the constructor signature. + * options - the integer bit flag options. + * Returns: + * an ObjectReference mirror of the newly created object. + * Throws: + * IllegalArgumentException - + * if the method is not a member of this class, if the size of the + * argument list does not match the number of declared arguments for + * the constructor, or if the method is not a constructor. + * {link - InvalidTypeException} if any argument in the argument list is not + * assignable to the corresponding method argument type. + * ClassNotLoadedException - + * if any argument type has not yet been loaded through the appropriate class loader. + * IncompatibleThreadStateException - + * if the specified thread has not been suspended by an event. + * InvocationException - + * if the method invocation resulted in an exception in the target VM. + * ObjectCollectedException - + * if the given thread or any object argument has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to the same VirtualMachine. + * The case for testing includes invoking the method on an inner class of + * ClassType extending Thread class. + * No exception is expected to be thrown in response to call to the method. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.newInstance.newinstance002; + * the debuggee program - nsk.jdi.ClassType.newInstance.newinstance002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.newInstance.newinstance002 + * nsk.jdi.ClassType.newInstance.newinstance002a + * + * @comment make sure newinstance002a is compiled with full debug info + * @clean nsk.jdi.ClassType.newInstance.newinstance002a + * @compile -g:lines,source,vars ../newinstance002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java new file mode 100644 index 00000000000..4ae343397bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java @@ -0,0 +1,236 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the newinstance002 JDI test. + */ + +public class newinstance002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + +// static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * 1. he specified constructor must be defined in this class

    + * 2. IllegalArgumentException is thrown if
    + * - the method is not a member of this class;
    + * - the size of the argument list does not match the number
    + * of declared arguemnts for the constructor, or if the
    + * method is not a constructor.
    + */ + +public class newinstance003 { + + private final static String prefix = "nsk.jdi.ClassType.newInstance."; + private final static String debuggerName = prefix + "newinstance003"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ClassType class2Check; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + newinstance003 thisTest = new newinstance003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + class2Check = (ClassType )debugee.classByName(prefix + + newinstance003a.class2Check); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.makeBreakpoint(testedClass, + newinstance003a.brkpMethodName, + newinstance003a.brkpLineNumber); + brkp.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + brkp.enable(); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + ObjectReference obj = null; + Value retValue, value = null, + expectedValue = debugee.VM().mirrorOf(6L); + List params = new Vector(); + + // 1 case--------------------------------------------------------------- + // checking up IllegalArgumentException, the size of the argument list + // does not match the number of declared arguments for the constructor + display("\nthe size of the argument list does not match the number " + + "of declared arguments"); + display("----------------------------------------------------------" + + "-------------------"); + Method method = getConstructor(class2Check); + display("method>" + method); + try { + obj = class2Check.newInstance(thread, method, params, 0); + complain("***IllegalArgumentException is not thrown***"); + exitStatus = Consts.TEST_FAILED; + } catch(IllegalArgumentException e) { + display(">expected " + e); + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + // 2 case--------------------------------------------------------------- + // checking up IllegalArgumentException, the method is not a constructor + display("\nthe method is not a constructor"); + display("-------------------------------"); + method = debugee.methodByName(class2Check, newinstance003a.method); + display("method>" + method); + try { + obj = class2Check.newInstance(thread, method, params, 0); + complain("***IllegalArgumentException is not thrown***"); + exitStatus = Consts.TEST_FAILED; + } catch(IllegalArgumentException e) { + display(">expected " + e); + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + // 3 case--------------------------------------------------------------- + // checking up IllegalArgumentException, when constructor is a member + // of superclass + params.add(debugee.VM().mirrorOf(1)); + display("\nconstructor is a member of superclass"); + display("-------------------------------------"); + method = getConstructor(testedClass); + display("method>" + method); + ReferenceType refType; + Field field; + try { + obj = class2Check.newInstance(thread, method, params, 0); + complain("***IllegalArgumentException is not thrown***"); + exitStatus = Consts.TEST_FAILED; + } catch(IllegalArgumentException e) { + display(">expected " + e); + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + // 4 case--------------------------------------------------------------- + // when constructor is a member of this class + display("\nconstructor is a member of this class"); + display("-------------------------------------"); + method = getConstructor(class2Check); + display("method>" + method); + try { + obj = class2Check.newInstance(thread, method, params, 0); + refType = obj.referenceType(); + field = refType.fieldByName("sum"); + retValue = obj.getValue(field); + if (((PrimitiveValue )retValue).intValue() != 1) { + complain("unexpected value of field: " + retValue); + exitStatus = Consts.TEST_FAILED; + } else { + display(">created instance :" + obj); + } + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private Method getConstructor(ReferenceType classType) { + List methodList = classType.methods(); + Method method; + for (int i = 0; i < methodList.size(); i++) { + method = (Method )methodList.get(i); + if (method.isConstructor()) { + return method; + } + } + return null; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance003/TestDescription.java new file mode 100644 index 00000000000..b384a01392a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance003/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ClassType/newInstance/newinstance003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that a result of the method + * com.sun.jdi.ClassType.newInstance() + * throws IllegalArgumentException according to spec. + * Test checks up the following assertions: + * 1. The specified constructor must be defined in this class. + * 2. IllegalArgumentException is thrown if + * - the method is not a member of this class, + * - the size of the argument list does not match the number of declared + * arguments for the constructor, or if the method is not + * a constructor. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method for setting breakpoint + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance003 + * nsk.jdi.ClassType.newInstance.newinstance003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance003a.java new file mode 100644 index 00000000000..55f2467cc2b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance003a.java @@ -0,0 +1,74 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * newinstance003a is deugee's part of the newinstance003. + */ +public class newinstance003a { + + public final static String anotherClassName = "newinstance003b"; + public final static String class2Check = "newinstance003Child"; + public final static String method = "insteadOfConstructor"; + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + newinstance003Child child = new newinstance003Child(1); + pipe.println(newinstance003.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(newinstance003.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + + } + + protected static long sum; + newinstance003a(int one) { + sum = one; + } +} + +class newinstance003Child extends newinstance003a { + newinstance003Child(int one) { + super(one); + } + + public static void insteadOfConstructor() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004.java new file mode 100644 index 00000000000..76eb4253c02 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004.java @@ -0,0 +1,203 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up the following assertion:
    + * If the invoked method throws an exception, this method will throw + * an InvocationException which contains a mirror to the exception object thrown. + * It is checked for two cases: + * 1. when the invoked method throws uncaught NullPointerExection.
    + * For this case, InvocationException is expected, the one
    + * contains a mirror to the NullPointerException object.
    + * 2. when invoked method throws caught exection
    + * For this case, no exceptions are expected
    + */ + +public class newinstance004 { + + private final static String prefix = "nsk.jdi.ClassType.newInstance."; + private final static String debuggerName = prefix + "newinstance004"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + newinstance004 thisTest = new newinstance004(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + newinstance004a.brkpMethodName, + newinstance004a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + thread = brkpEvent.thread(); + + ReferenceType exceptionRefType = + debugee.classByName(newinstance004a.testException); + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue; + ObjectReference obj = null; + List params = new Vector(); + + display("\nuncaught NullPointerException"); + display("-----------------------------"); + Method method = getConstructor(testedClass); + display("method>" + method); + params.add(debugee.VM().mirrorOf(false)); + try { + obj = testedClass.newInstance(thread, method, params, 0); + complain("***InvocationException is not thrown***"); + exitStatus = Consts.TEST_FAILED; + } catch(InvocationException e) { + display("!!!expected " + e); + if (e.exception().referenceType().equals(exceptionRefType)) { + display("!!!expected the exception mirror " + e.exception()); + } else { + complain("Unexpected the exception mirror " + + e.exception().referenceType()); + complain("We are expecting " + exceptionRefType); + exitStatus = Consts.TEST_FAILED; + } + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + // caught NullPointerException + display("\ncaught NullPointerException"); + display("-----------------------------"); + method = getConstructor(testedClass); + params.clear(); + params.add(debugee.VM().mirrorOf(true)); + display("method>" + method); + try { + obj = testedClass.newInstance(thread, method, params, 0); + if (!obj.referenceType().equals(testedClass)) { + complain("wrong object type:" + obj.referenceType()); + exitStatus = Consts.TEST_FAILED; + } + } catch(Exception e) { + complain(" unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private Method getConstructor(ReferenceType classType) { + List methodList = classType.methods(); + Method method; + for (int i = 0; i < methodList.size(); i++) { + method = (Method )methodList.get(i); + if (method.isConstructor()) { + return method; + } + } + return null; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004/TestDescription.java new file mode 100644 index 00000000000..155fb60b865 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/ClassType/newInstance/newinstance004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that a result of the method + * com.sun.jdi.ClassType.newInstance() + * throws InvocationException according to spec. + * Test checks up the following assertion: + * If the invoked method throws an exception, this method will throw + * an InvocationException which contains a mirror to the exception object + * thrown. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance004 + * nsk.jdi.ClassType.newInstance.newinstance004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004a.java new file mode 100644 index 00000000000..cd55ab1c30a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance004a.java @@ -0,0 +1,71 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * newinstance004a is deugee's part of the newinstance004. + */ +public class newinstance004a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + public final static String testException = "java.lang.NullPointerException"; + + + 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(newinstance004.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(newinstance004.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + newinstance004a(boolean caughtException) { + Object obj = null; + String tmp; + if (caughtException) { + try { + tmp = obj.toString(); + } catch (NullPointerException e) { + } + } else { + tmp = obj.toString(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005.java new file mode 100644 index 00000000000..e67364e684c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005.java @@ -0,0 +1,274 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import java.util.*; +import java.io.*; +import java.lang.reflect.Array; + +/** + * Test checks up the following assertion: + * Primitive arguments must be either assignment compatible with + * the argument type or must be convertible to the argument type + * without loss of information. + * for every primitive type + */ + +public class newinstance005 extends ValueConversionDebugger { + + private ClassType testedClass; + private ThreadReference thread; + + static class TestedConstructorData { + String signature; + String fieldName; + ValueType type; + + TestedConstructorData(String signature, String fieldName, ValueType type) { + this.signature = signature; + this.fieldName = fieldName; + this.type = type; + } + } + + private static final TestedConstructorData [] testedConstructors = { + new TestedConstructorData("(B)V", "byteValue", BYTE), + new TestedConstructorData("(C)V", "charValue", CHAR), + new TestedConstructorData("(D)V", "doubleValue", DOUBLE), + new TestedConstructorData("(F)V", "floatValue", FLOAT), + new TestedConstructorData("(I)V", "intValue", INT), + new TestedConstructorData("(J)V", "longValue", LONG), + new TestedConstructorData("(S)V", "shortValue", SHORT) + }; + + + private Field field; + + private static byte [] byteParamValues = + {Byte.MIN_VALUE, + -1, + 0, + 1, + Byte.MAX_VALUE}; + private static char [] charParamValues = + {Character.MIN_VALUE, + Character.MAX_VALUE}; + private static double [] doubleParamValues = + {Double.NEGATIVE_INFINITY, + -1.5D, + -1.0D, + -0.0D, + +0.0D, + Double.MIN_VALUE, + 1.0D, + 1.5D, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY}; + private static float [] floatParamValues = + {Float.NEGATIVE_INFINITY, + -1.5F, + -1.0F, + -0.0F, + +0.0F, + Float.MIN_VALUE, + 1.0F, + 1.5F, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY}; + private static int [] intParamValues = + {Integer.MIN_VALUE, + -1, + 0, + 1, + 1234567890, + Integer.MAX_VALUE}; + private static long [] longParamValues = + {Long.MIN_VALUE, + -1L, + 0L, + 1L, + 1234567890123456789L, + Long.MAX_VALUE}; + private static short [] shortParamValues = + {Short.MIN_VALUE, + -1, + 0, + 1, + Short.MAX_VALUE}; + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new newinstance005().runIt(argv, out); + } + + protected String debuggeeClassName() { + return newinstance005a.class.getName(); + } + + protected void doTest() { + initDefaultBreakpoint(); + + BreakpointEvent brkpEvent = forceBreakpoint(); + + testedClass = (ClassType )debuggee.classByName(debuggeeClassNameWithoutArgs()); + + thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + + PrimitiveValue value = null; + List params = new ArrayList(); + + Method method; + Object arr = null; + // Type type = null; + boolean validConversion; + for (TestedConstructorData testedConstructor : testedConstructors) { + method = testedClass.concreteMethodByName("", testedConstructor.signature); + if (method == null) { + complain("method :" + testedConstructor.signature + " not found"); + setSuccess(false); + continue; + } + display(""); + field = testedClass.fieldByName(testedConstructor.fieldName); + display("Method : " + method); + display("Field : " + field); + display("============="); + for (ValueType type : ValueType.values()) { + switch (type) { + case BYTE: + arr = byteParamValues; + display("\tbyte values"); + break; + case CHAR: + arr = charParamValues; + display("\tchar values"); + break; + case DOUBLE: + arr = doubleParamValues; + display("\tdouble values"); + break; + case FLOAT: + arr = floatParamValues; + display("\tfloat values"); + break; + case INT: + arr = intParamValues; + display("\tinteger values"); + break; + case LONG: + arr = longParamValues; + display("\tlong values"); + break; + case SHORT: + arr = shortParamValues; + display("\tshort values"); + break; + default: + complain("\t***TEST CASE ERROR***"); + setSuccess(false); + continue; + } + + display("\t--------------"); + for (int i = 0; i < Array.getLength(arr); i++) { + params.clear(); + value = createValue(arr, i); + params.add(value); + validConversion = isValidConversion(testedConstructor.type, value); + try { + newInstance(thread, method, params, value); + if (!validConversion) { + complain(lastConversion); + complain("***InvalidTypeException is not thrown***"); + setSuccess(false); + } + } catch(InvalidTypeException e) { + if (validConversion) { + complain(lastConversion); + complain("*** unexpected InvalidTypeException***"); + setSuccess(false); + } else { + display(lastConversion); + display("!!!expected InvalidTypeException"); + } + } + display(""); + } + } + } + + display("============="); + display("TEST FINISHES\n"); + + removeDefaultBreakpoint(); + + debuggee.resume(); + } + + private void newInstance(ThreadReference thread, Method method, List params, + PrimitiveValue expectedValue) throws InvalidTypeException { + ObjectReference objRef = null; + PrimitiveValue param; + try { + for (int i = 0; i < params.size(); i++) { + param = (PrimitiveValue )params.get(i); + if (param instanceof CharValue) { + display("\tParameters : " + Integer.toHexString(param.charValue()) + "(" + param.type() + ")"); + } else { + display("\tParameters : " + param + "(" + param.type() + ")"); + } + } + objRef = testedClass.newInstance(thread, method, params, + ClassType.INVOKE_SINGLE_THREADED); + } catch(ClassNotLoadedException e) { + complain("exception: " + e); + setSuccess(false); + } catch(IncompatibleThreadStateException e) { + complain("exception: " + e); + setSuccess(false); + } catch(InvocationException e) { + complain("exception: " + e); + setSuccess(false); + } + + PrimitiveValue returnedValue = (PrimitiveValue)objRef.getValue(field); + + String retType = returnedValue != null ? returnedValue.type().toString() + : ""; + display("\tReturn value: " + returnedValue + "(" + retType + ")"); + + checkValueConversion(expectedValue, returnedValue); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005/TestDescription.java new file mode 100644 index 00000000000..2eb275bfed2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005/TestDescription.java @@ -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/ClassType/newInstance/newinstance005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.newInstance() + * Test checks up the following assertion: + * Primitive arguments must be either assignment compatible with + * the argument type or must be convertible to the argument type + * without loss of information. + * for every primitive type. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance005 + * nsk.jdi.ClassType.newInstance.newinstance005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005a.java new file mode 100644 index 00000000000..3d4430556ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance005a.java @@ -0,0 +1,79 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * newinstance005a is deugee's part of the newinstance005. + */ +public class newinstance005a extends AbstractJDIDebuggee { + + private static byte byteValue; + private static char charValue; + private static double doubleValue; + private static float floatValue; + private static int intValue; + private static long longValue; + private static short shortValue; + + public static void main (String args[]) { + new newinstance005a().doTest(args); + } + + newinstance005a() { + + } + + newinstance005a(byte value) { + byteValue = value; + } + + newinstance005a(char value) { + charValue = value; + } + + newinstance005a(double value) { + doubleValue = value; + } + + newinstance005a(float value) { + floatValue = value; + } + + newinstance005a(int value) { + intValue = value; + } + + newinstance005a(long value) { + longValue = value; + } + + newinstance005a(short value) { + shortValue = value; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006.java new file mode 100644 index 00000000000..80eb364a686 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006.java @@ -0,0 +1,246 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up that NullPointerException will be thrown in + * the following cases:
    + * - newInstance(null, method, params,ClassType.INVOKE_SINGLE_THREADED)
    + * - newInstance(thread, null, params,ClassType.INVOKE_SINGLE_THREADED)
    + * - newInstance(thread, method, null,ClassType.INVOKE_SINGLE_THREADED)
    + * In case
    + * newInstance(thread, method, params,Integer.MAX_VALUE)
    + * no exception is expected. + */ + +public class newinstance006 { + + private final static String prefix = "nsk.jdi.ClassType.newInstance."; + private final static String debuggerName = prefix + "newinstance006"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + public final static String method2Invoke = "justMethod"; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + newinstance006 thisTest = new newinstance006(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + newinstance006a.brkpMethodName, + newinstance006a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + ObjectReference objRef; + List params = createParams(1); + + Method method = getConstructor(testedClass); + display("Method : " + method); + + display("newInstance(null, method, params," + + "ClassType.INVOKE_SINGLE_THREADED)"); + try { + objRef = testedClass.newInstance(null, method, params, + ClassType.INVOKE_SINGLE_THREADED); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("newInstance(thread, null, params," + + "ClassType.INVOKE_SINGLE_THREADED)"); + try { + objRef = testedClass.newInstance(thread, null, params, + ClassType.INVOKE_SINGLE_THREADED); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("newInstance(thread, method, null," + + "ClassType.INVOKE_SINGLE_THREADED)"); + try { + objRef = testedClass.newInstance(thread, method, null, + ClassType.INVOKE_SINGLE_THREADED); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("newInstance(thread, method, params," + + "Integer.MAX_VALUE)"); + try { + objRef = testedClass.newInstance(thread, method, params, + Integer.MAX_VALUE); + if (!objRef.referenceType().equals(testedClass)) { + complain("Wrong returned value " + objRef.toString()); + exitStatus = Consts.TEST_FAILED; + } else { + display("returned value is " + objRef.toString()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("newInstance(thread, method, params," + + "Integer.MIN_VALUE)"); + try { + objRef = testedClass.newInstance(thread, method, params, + Integer.MIN_VALUE); + if (!objRef.referenceType().equals(testedClass)) { + complain("Wrong returned value " + objRef.toString()); + exitStatus = Consts.TEST_FAILED; + } else { + display("returned value is " + objRef.toString()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private List createParams(int size) { + Vector params = new Vector(); + for (int i = 0; i < size; i++) { + params.add(debugee.VM().mirrorOf(i + 1)); + } + return params; + } + + private Method getConstructor(ReferenceType classType) { + List methodList = classType.methods(); + Method method; + for (int i = 0; i < methodList.size(); i++) { + method = (Method )methodList.get(i); + if (method.isConstructor()) { + return method; + } + } + return null; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006/TestDescription.java new file mode 100644 index 00000000000..16663125ece --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ClassType/newInstance/newinstance006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.newInstance() + * Test checks up that NullPointerException will be thrown in + * the following cases: + * - newInstance(null, method, params,ClassType.INVOKE_SINGLE_THREADED) + * - newInstance(thread, null, params,ClassType.INVOKE_SINGLE_THREADED) + * - newInstance(thread, method, null,ClassType.INVOKE_SINGLE_THREADED) + * In case + * newInstance(thread, method, params,Integer.MAX_VALUE) + * no exception is expected. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance006 + * nsk.jdi.ClassType.newInstance.newinstance006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006a.java new file mode 100644 index 00000000000..98ca9a8c85d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance006a.java @@ -0,0 +1,61 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * newinstance006a is deugee's part of the newinstance006. + */ +public class newinstance006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 47; + + 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(newinstance006.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(newinstance006.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + newinstance006a(int val) { + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007.java new file mode 100644 index 00000000000..a7421d1d3d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007.java @@ -0,0 +1,233 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * + * The test checks up the method com.sun.jdi.ClassType.newInstance() + * + * Test checks up the following assertion: + * ...all threads in the target VM are resumed while the method is + * being invoked if they were previously suspended by an event or by + * VirtualMachine.suspend() or ThreadReference.suspend(). + * + * This checking is implemented for three cases: + * - when the tested thread is suspended by ThreadReference.suspend(); + * - when the tested thread is suspended by VirtualMachine.suspend(); + * - when the tested thread is suspended by an event. + */ + +public class newinstance007 { + + private final static String prefix = "nsk.jdi.ClassType.newInstance."; + private final static String debuggerName = prefix + "newinstance007"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + public final static String SGNL_STRTHRD = "start_thread"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ClassType testedClass; + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + newinstance007 thisTest = new newinstance007(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.makeBreakpoint(testedClass, + newinstance007a.brkpMethodName, + newinstance007a.brkpLineNumber); + brkp.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + brkp.enable(); + + display("\nTEST BEGINS"); + display("==========="); + + ObjectReference objRef = null; + Field field = testedClass.fieldByName("invokingTime"); + List params = new Vector(); + ThreadReference suspendedThread; + BreakpointEvent brkpEvent; + + Method method = getConstructor(testedClass); + display("Method : " + method); + + for (int i = 0; i < 3; i++) { + display(""); + switch (i) { + case 0: + display("\nCASE#0 : Thread is suspended by ThreadReference.suspend()"); + break; + case 1: + display("\nCASE#1 : Thread is suspended by VirtualMachine.suspend()"); + break; + case 2: + display("\nCASE#2 : Thread is suspended by BreakPointRequest"); + brkp.disable(); + brkp.setSuspendPolicy(EventRequest.SUSPEND_ALL); + brkp.enable(); + } + + // starting thread + display("sending signal " + SGNL_STRTHRD); + debugee.sendSignal(SGNL_STRTHRD); + debugee.resume(); + display("waiting for signal " + SGNL_READY); + debugee.receiveExpectedSignal(SGNL_READY); + + brkpEvent = waitForBreakpoint(brkp); + + thread = brkpEvent.thread(); + + suspendedThread = debugee.threadByName(newinstance007a.testedThread); + switch (i) { + case 0: + suspendedThread.suspend(); + break; + case 1: + debugee.VM().suspend(); + break; + } + + if ( !suspendedThread.isSuspended() ) { + complain(suspendedThread.name() + " is not suspended"); + exitStatus = Consts.TEST_FAILED; + } else { + display(suspendedThread.name() + " is suspended"); + } + try { + if (i == 1) { + // for VirtualMachine.suspended() only! + // resume thread for invokedMethod + thread.resume(); + } + display("invoking the constructor"); + objRef = testedClass.newInstance(thread, method, params, 0); + Value retValue = objRef.getValue(field); + suspendedThread = debugee.threadByName("im007aThread01"); + if (((PrimitiveValue)retValue).longValue() >= waitTime) { + complain("CASE #" + i + " FAILED." + + "\n\tTimeout occured while invocation of debugee's constructor"); + exitStatus = Consts.TEST_FAILED; + } else { + display("CASE #" + i + " PASSED"); + } + } catch(Exception e) { + complain("Unexpected exception while invocation of debugee's constructor: " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private BreakpointEvent waitForBreakpoint(BreakpointRequest brkp) { + Event event = null; + BreakpointEvent brkpEvent; + + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + brkpEvent = (BreakpointEvent )event; + return brkpEvent; + } + + private Method getConstructor(ReferenceType classType) { + List methodList = classType.methods(); + Method method; + for (int i = 0; i < methodList.size(); i++) { + method = (Method )methodList.get(i); + if (method.isConstructor()) { + return method; + } + } + return null; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007/TestDescription.java new file mode 100644 index 00000000000..3075d7eacba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007/TestDescription.java @@ -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/ClassType/newInstance/newinstance007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.newInstance() + * Test checks up the following assertion: + * ...all threads in the target VM are resumed while the method is + * being invoked if they were previously suspended by an event or by + * VirtualMachine.suspend() or ThreadReference.suspend(). + * This checking is implemented for three cases: + * - when the tested thread is suspended by ThreadReference.suspend(); + * - when the tested thread is suspended by VirtualMachine.suspend(); + * - when the tested thread is suspended by an event. + * COMMENTS: + * 4786806 TEST_BUG: debugee does not relinquishes lock after notifying + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance007 + * nsk.jdi.ClassType.newInstance.newinstance007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007a.java new file mode 100644 index 00000000000..56b29efa380 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007a.java @@ -0,0 +1,157 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * newinstance007a is deugee's part of the newinstance007. + */ +public class newinstance007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 70; + public final static String testedThread = "im007aThread01"; + + public static Log log; + public static long waitTime; + private static IOPipe pipe; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + pipe = argHandler.createDebugeeIOPipe(log); + im007aThread01 thread = null; + pipe.println(newinstance007.SGNL_READY); + + String instr = pipe.readln(); + while (!instr.equals(newinstance007.SGNL_QUIT)) { + + // create new thread and start it + if (instr.equals(newinstance007.SGNL_STRTHRD)) { + thread = new im007aThread01("im007aThread01"); + synchronized(im007aThread01.waitStarting) { + thread.start(); + try { + im007aThread01.waitStarting.wait(waitTime); + log.display("checked thread started"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for checked thread start."); + } + } + } + log.display("sending ready signal..."); + pipe.println(newinstance007.SGNL_READY); + log.display("waiting signal from debugger..."); // brkpLineNumber + instr = pipe.readln(); // this is a line for breakpoint + + if (thread.isAlive()) { + log.display("waiting for join of : " + thread.getName()); + try { + thread.join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + try { + thread.interrupt(); + } catch (SecurityException e) { + throw new Failure("Cannot interrupt checked thread."); + } + } + } + } + + if (instr.equals(newinstance007.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private static long invokingTime; + newinstance007a() { + log.display("constructor> starting..."); + invokingTime = 0; + try { + synchronized(im007aThread01.waitFinishing) { + synchronized(im007aThread01.waitInvoking) { + log.display("constructor> notifying to thread..."); + im007aThread01.waitInvoking.notify(); + } + + log.display("constructor> waiting for thread's response..."); + long startTime = System.currentTimeMillis(); + im007aThread01.waitFinishing.wait(waitTime); + invokingTime = System.currentTimeMillis() - startTime; + return; + } + } catch (InterruptedException e) { + log.display("constructor> it was interrupted."); + } + invokingTime = waitTime + 1; + } +} + +class im007aThread01 extends Thread { + public static Object waitInvoking = new Object(); + public static Object waitStarting = new Object(); + public static Object waitFinishing = new Object(); + + im007aThread01(String threadName) { + super(threadName); + } + + public void run() { + synchronized(waitInvoking) { + synchronized(waitStarting) { + waitStarting.notifyAll(); + } + + newinstance007a.log.display(getName() + "> waiting for the invoked method..."); + try { + long startTime = System.currentTimeMillis(); + waitInvoking.wait(newinstance007a.waitTime); + if ((System.currentTimeMillis() - startTime) < newinstance007a.waitTime) { + newinstance007a.log.display(getName() + "> got a response from the invoked method"); + } else { + newinstance007a.log.display(getName() + "*** no response from invoked method"); + } + } catch (Exception e) { + newinstance007a.log.display(getName() + e); + } + } + synchronized(waitFinishing) { + newinstance007a.log.display(getName() + "> notifying to invoked method..."); + waitFinishing.notify(); + } + newinstance007a.log.display(getName() + "> thread finished"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008.java new file mode 100644 index 00000000000..e0a990e7ca4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008.java @@ -0,0 +1,294 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * + * The test checks up the method com.sun.jdi.ClassType.newInstance() + * + * Test checks up the following assertion: + * If the target VM is disconnected during the invoke (for example, + * through VirtualMachine.dispose()) the method invocation continues. + */ + +public class newinstance008 { + + private final static String prefix = "nsk.jdi.ClassType.newInstance."; + private final static String debuggerName = prefix + "newinstance008"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + public final static String SGNL_FINISH = "finish"; + public final static String SGNL_ABORT = "abort"; + + public static int exitStatus; + public static Log log; + public static Debugee debugee; + public static long waitTime; + private static boolean isAborted = false; + + private ClassType testedClass; + + public static void display(String msg) { + log.display(msg); + } + + public static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + newinstance008 thisTest = new newinstance008(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Failure e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + if (!isAborted) { + debugee.resume(); + debugee.quit(); + } + } + + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure{ + + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + InvokingThread invokeThrd = new InvokingThread(); + invokeThrd.start(); + + // waiting READY signal from invoked constructor + display("\nwaiting for signal \"" + + SGNL_READY + + "\" from the invoked constructor"); + debugee.receiveExpectedSignal(SGNL_READY); + + display("\nConstructor has been invoked. Trying to dispose debugee's VM"); + + AbortingThread abortingThrd = new AbortingThread(); + abortingThrd.start(); + + debugee.VM().dispose(); + invokeThrd.waitVMDisconnect(); + + try { + invokeThrd.join(); + } catch(InterruptedException e) { + throw new Failure("unexpected " + e); + } + + if (isAborted) { + complain("Debugee's VM disposing hung. Invoking was aborted!!!"); + exitStatus = Consts.TEST_FAILED; + } else { + display("\nVirtual machine has been disposed"); + display("sending signal \"" + SGNL_FINISH + "\" to the invoked constructor"); + debugee.sendSignal(SGNL_FINISH); + } + + display("\n============="); + display("TEST FINISHES\n"); + } + + private BreakpointEvent waitForBreakpoint(BreakpointRequest brkp) { + Event event = null; + BreakpointEvent brkpEvent; + + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected " + e); + } + + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + brkpEvent = (BreakpointEvent )event; + return brkpEvent; + } + + private Method getConstructor(ReferenceType classType) { + List methodList = classType.methods(); + Method method; + for (int i = 0; i < methodList.size(); i++) { + method = (Method )methodList.get(i); + if (method.isConstructor()) { + return method; + } + } + return null; + } + + class InvokingThread extends Thread { + volatile boolean isNotified = false; + + public void run() { + display(""); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + newinstance008a.brkpMethodName, + newinstance008a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + + BreakpointEvent brkpEvent = waitForBreakpoint(brkp); + ThreadReference thread = brkpEvent.thread(); + + Value retValue; + List params = new Vector(); + + Method method = getConstructor(testedClass); + display("\nInvoking debugee's constructor : " + method); + + try { + retValue = testedClass.newInstance(thread, method, params, 0); + if ( ((PrimitiveValue )retValue).intValue() == Consts.TEST_FAILED ) { + complain("VMDisconnectException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch(VMDisconnectedException e) { + display("!!!expected VMDisconnectException"); + notifyVMDisconnect(); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + debugee.resume(); + } + + synchronized void notifyVMDisconnect() { + isNotified = true; + notify(); + } + + synchronized void waitVMDisconnect() { + try { + if (!isNotified) { + display("\nwaiting VMDisconnectedException"); + wait(waitTime); + } + } catch (InterruptedException e) { + throw new Failure("unexpected " + e); + } + } + } + + class AbortingThread extends Thread { + + public void run() { + try { + sleep(waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected " + e); + } + + display("\n!!!out of wait time!!!"); + display("sending signal \"" + SGNL_ABORT + "\" to the invoked method"); + isAborted = true; + debugee.sendSignal(SGNL_ABORT); + debugee.resume(); + debugee.quit(); + } + } +} + +class im008ListeningThread extends Thread { + public static Object waitDisconnecting = new Object(); + public volatile static boolean isNotified = false; + public void run() { + newinstance008.display(""); + newinstance008.display("waiting for signal \"" + + newinstance008.SGNL_READY + + "\" from the constructor"); + newinstance008.debugee.receiveExpectedSignal(newinstance008.SGNL_READY); + + newinstance008.display(""); + newinstance008.display("Virtual machine is disposed"); + newinstance008.debugee.VM().dispose(); + + try { + long startTime = System.currentTimeMillis(); + synchronized (waitDisconnecting) { + if (!isNotified) { + newinstance008.display(""); + newinstance008.display("waiting VMDisconnectedException"); + waitDisconnecting.wait(newinstance008.waitTime); + } else { + newinstance008.display("It doesn't wait VMDisconnectedException"); + } + } + if (System.currentTimeMillis() - startTime >= newinstance008.waitTime) { + newinstance008.complain("VMDisconnectedException is not thrown"); + newinstance008.exitStatus = Consts.TEST_FAILED; + } + } catch (InterruptedException e) { + newinstance008.complain("Unexpected InterruptedException"); + newinstance008.exitStatus = Consts.TEST_FAILED; + } + + newinstance008.display(""); + newinstance008.display("sending signal \"" + newinstance008.SGNL_QUIT + + "\" to the constructor"); + newinstance008.debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008/TestDescription.java new file mode 100644 index 00000000000..e4f5d6a48ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ClassType/newInstance/newinstance008. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ClassType.newInstance() + * Test checks up the following assertion: + * If the target VM is disconnected during the invoke (for example, + * through VirtualMachine.dispose()) the method invocation continues. + * COMMENTS: + * The test was updated to avoid hanging of debugee's VM + * after invoking VirtualMachine.dispose(). + * (see 4471237 VirtualMachine.dispose() hangs on Windows) + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance008 + * nsk.jdi.ClassType.newInstance.newinstance008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008a.java new file mode 100644 index 00000000000..cf547790dc0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance008a.java @@ -0,0 +1,76 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * newinstance008a is deugee's part of the newinstance008. + */ +public class newinstance008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 51; + private static Log log; + private static IOPipe pipe; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(newinstance008.SGNL_READY); + + String instr = pipe.readln(); + // the below line is a breakpoint. + // Debugger will invoke constructor newinstance008a(). + instr = pipe.readln(); // brkpLineNumber + if (instr.equals(newinstance008.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + newinstance008a() { + try { + pipe.println(newinstance008.SGNL_READY); + log.display("constructor:: waiting response from debugger..."); + String instr = pipe.readln(); + if (instr.equals(newinstance008.SGNL_FINISH)) { + log.display("constructor:: completed succesfully."); + } else if (instr.equals(newinstance008.SGNL_ABORT)) { + log.display("constructor:: aborted."); + } + } catch(Exception e) { + log.display("unexpected exception " + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009.java new file mode 100644 index 00000000000..36f24f05fed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009.java @@ -0,0 +1,201 @@ +/* + * 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.ClassType.newInstance; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ClassType.newInstance() + * properly throws IncompatibleThreadStateException - if the + * specified thread has not been suspended by an event.

    + * + * The test works as follows. Debugger part of the test attempts + * to construct a new instance of main debuggee class newinstance009t + * using thread newinstance009tThr being previously suspended + * by the JDI method ThreadReference.suspend() instead of by + * an event. The exception is expected to be thrown. + */ +public class newinstance009 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.newInstance.newinstance009t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "newinstance009tThr"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int ATTEMPTS = 5; + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new newinstance009().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); + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "newinstance009t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: unable to suspend debuggee thread"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee thread suspension ..."); + try { + Thread.currentThread().sleep(DELAY); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + ClassType clsType = (ClassType) rType; + + List methList = rType.methodsByName(""); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected constructor " + + " not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + Method meth = (Method) methList.get(0); + if (!meth.isConstructor()) { + log.complain("TEST FAILURE: found method \"" + + meth.name() + " " + meth.signature() + + "\" is not a constructor: Method.isConstructor()=" + + meth.isConstructor()); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + // Check the tested assersion + try { + log.display("\n Trying to construct a new instance of debuggee class \"" + + clsType + "\"\n\tusing constructor \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\" and thread which has not been suspended by an event ..."); + + clsType.newInstance(thrRef, meth, Collections.emptyList(), 0); + + log.complain("TEST FAILED: expected IncompatibleThreadStateException was not thrown" + + "\n\twhen attempted to construct a new instance of debuggee class \"" + + clsType + "\"\n\tusing constructor \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\" and thread which has not been suspended by an event"); + tot_res = Consts.TEST_FAILED; + } catch (IncompatibleThreadStateException is) { + log.display("CHECK PASSED: caught expected " + is); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ClassType.newInstance(): caught unexpected " + + ee + "\n\tinstead of expected IncompatibleThreadStateException" + + "\n\twhen attempted to construct a new instance of debuggee class \"" + + clsType + "\"\n\tusing constructor \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\" and thread which has not been suspended by an event"); + tot_res = Consts.TEST_FAILED; + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private int quitDebuggee() { + log.display("\nFinal resumption of the debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009/TestDescription.java new file mode 100644 index 00000000000..1822de400b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ClassType/newInstance/newinstance009. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ClassType.newInstance() + * properly throws IncompatibleThreadStateException - if the + * specified thread has not been suspended by an event. + * The test works as follows. Debugger part of the test attempts + * to construct a new instance of main debuggee class "newinstance009t" + * using thread "newinstance009tThr" being previously suspended + * by the JDI method "ThreadReference.suspend()" instead of by + * an event. The exception is expected to be thrown. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.newInstance.newinstance009 + * nsk.jdi.ClassType.newInstance.newinstance009t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.newInstance.newinstance009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009t.java new file mode 100644 index 00000000000..4169ef62e41 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009t.java @@ -0,0 +1,63 @@ +/* + * 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.ClassType.newInstance; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is debuggee class. + */ +public class newinstance009t { + // constructor used only to check IncompatibleThreadStateException throwing + // in the debugger + newinstance009t() { + System.err.println("Debuggee: constructor of \"newinstance009t\" was invoked!"); + } + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new newinstance009t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Thread.currentThread().setName(newinstance009.DEBUGGEE_THRNAME); + + pipe.println(newinstance009.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(newinstance009.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java new file mode 100644 index 00000000000..50b922da99a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java @@ -0,0 +1,450 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.setValue()
    + * complies with its spec.
    + *
    + * The cases for testing include only the primitive types.
    + * After being started up,
    + * a debuggee creates a TestClass object containing fields of each of
    + * the primitive types, and informs a debugger of the object creation.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following for each of the primitive types:
    + * - gets corresponding Value objects using the method
    + * ReferenceType.getValue(Field field2),
    + * - sets corresponding Value objects using the method
    + * ReferenceType.getValue(Field field1),
    + * - gets corresponding Value objects using the method
    + * ReferenceType.getValue(Field field1),
    + * - checks up that field1 holds new value.
    + *
    + */ + +public class setvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/setValue/setvalue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.setValue.setvalue001a"; + + String mName = "nsk.jdi.ClassType.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".setvalue001aTestClass"; + + ReferenceType testedclass = null; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for setvalue001aTestClass"); + testedclass = (ReferenceType) classes.get(0); + + ClassType tClass = (ClassType) testedclass; + + + String bl1 = "bl1", bl2 = "bl2"; + String bt1 = "bt1", bt2 = "bt2"; + String ch1 = "ch1", ch2 = "ch2"; + String db1 = "db1", db2 = "db2"; + String fl1 = "fl1", fl2 = "fl2"; + String in1 = "in1", in2 = "in2"; + String ln1 = "ln1", ln2 = "ln2"; + String sh1 = "sh1", sh2 = "sh2"; + + Field field1 = null; + Field field2 = null; + + log2(" loop of testing all primitive types"); + for (int i3 = 0; i3 < 8; i3++) { + + try { + + switch (i3) { + + case 0: + log2("...... boolean values"); + BooleanValue blv1 = null; + BooleanValue blv2 = null; + + field1 = testedclass.fieldByName(bl1); + field2 = testedclass.fieldByName(bl2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Boolean"); + testExitCode = FAILED; + break; + } + + blv2 = (BooleanValue) testedclass.getValue(field2); + tClass.setValue(field1, blv2); + blv1 = (BooleanValue) testedclass.getValue(field1); + if (blv1.value() != false) { + log3("ERROR: blv1 != false : " + blv1.value() ); + testExitCode = FAILED; + } + + break; + + + case 1: + log2("...... byte values"); + ByteValue btv1 = null; + ByteValue btv2 = null; + + field1 = testedclass.fieldByName(bt1); + field2 = testedclass.fieldByName(bt2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Byte"); + testExitCode = FAILED; + break; + } + + btv2 = (ByteValue) testedclass.getValue(field2); + tClass.setValue(field1, btv2); + btv1 = (ByteValue) testedclass.getValue(field1); + if (btv1.value() != 1) { + log3("ERROR: btv1 != 1 : " + btv1.value() ); + testExitCode = FAILED; + } + + break; + + + case 2: + log2("...... char values"); + CharValue chv1 = null; + CharValue chv2 = null; + + field1 = testedclass.fieldByName(ch1); + field2 = testedclass.fieldByName(ch2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Char"); + testExitCode = FAILED; + break; + } + + chv2 = (CharValue) testedclass.getValue(field2); + tClass.setValue(field1, chv2); + chv1 = (CharValue) testedclass.getValue(field1); + if (chv1.value() != 1) { + log3("ERROR: chv1 != 1 : " + chv1.value() ); + testExitCode = FAILED; + } + + break; + + + case 3: + log2("...... double values"); + DoubleValue dbv1 = null; + DoubleValue dbv2 = null; + + field1 = testedclass.fieldByName(db1); + field2 = testedclass.fieldByName(db2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Double"); + testExitCode = FAILED; + break; + } + + dbv2 = (DoubleValue) testedclass.getValue(field2); +// log2("1 : dbv2 = " + Double.doubleToRawLongBits(dbv2.value()) ); + tClass.setValue(field1, dbv2); + dbv1 = (DoubleValue) testedclass.getValue(field1); +// log2("2 : dbv1 = " + Double.doubleToRawLongBits(dbv1.value()) ); + if (dbv1.value() != 1111111111.0d) { + log3("ERROR: dbv1 != 1111111111.0d : " + dbv1.value() ); + testExitCode = FAILED; + } + + break; + + + case 4: + log2("...... float values"); + FloatValue flv1 = null; + FloatValue flv2 = null; + + field1 = testedclass.fieldByName(fl1); + field2 = testedclass.fieldByName(fl2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Float"); + testExitCode = FAILED; + break; + } + + flv2 = (FloatValue) testedclass.getValue(field2); + tClass.setValue(field1, flv2); + flv1 = (FloatValue) testedclass.getValue(field1); + if (flv1.value() != 1111111111.0f) { + log3("ERROR: flv1 != 1111111111.0f : " + flv1.value() ); + testExitCode = FAILED; + } + + break; + + case 5: + log2("...... int values"); + IntegerValue inv1 = null; + IntegerValue inv2 = null; + + field1 = testedclass.fieldByName(in1); + field2 = testedclass.fieldByName(in2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Integer"); + testExitCode = FAILED; + break; + } + + inv2 = (IntegerValue) testedclass.getValue(field2); + tClass.setValue(field1, inv2); + inv1 = (IntegerValue) testedclass.getValue(field1); + if (inv1.value() != 1) { + log3("ERROR: inv1 != 1 : " + inv1.value() ); + testExitCode = FAILED; + } + + break; + + + case 6: + log2("...... long values"); + LongValue lnv1 = null; + LongValue lnv2 = null; + + field1 = testedclass.fieldByName(ln1); + field2 = testedclass.fieldByName(ln2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Long"); + testExitCode = FAILED; + break; + } + + lnv2 = (LongValue) testedclass.getValue(field2); + lnv1 = (LongValue) testedclass.getValue(field1); + tClass.setValue(field1, lnv2); + lnv1 = (LongValue) testedclass.getValue(field1); + if (lnv1.value() != 0x1234567890abcdefL) { + log3("ERROR: lnv1 != 0x1234567890abcdefL : " + + Long.toHexString(lnv1.value()) ); + testExitCode = FAILED; + } + + break; + + + case 7: + log2("...... short values"); + ShortValue shv1 = null; + ShortValue shv2 = null; + + field1 = testedclass.fieldByName(sh1); + field2 = testedclass.fieldByName(sh2); + if (field1 == null || field2 == null) { + log3("ERROR: 'field1 == null || field2 == null' for Short"); + testExitCode = FAILED; + break; + } + + shv2 = (ShortValue) testedclass.getValue(field2); + tClass.setValue(field1, shv2); + shv1 = (ShortValue) testedclass.getValue(field1); + if (shv1.value() != 1) { + log3("ERROR: shv1 != 1 : " + shv1.value() ); + testExitCode = FAILED; + } + + break; + + + default : log3("ERROR: TEST ERROR: case: default:"); + testExitCode = FAILED; + break; + + } // end of switch + + } catch ( Exception e ) { + log3("ERROR: unexpected Exception: " + e); + testExitCode = FAILED; + } // end of try + + } // end of for + + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001/TestDescription.java new file mode 100644 index 00000000000..c3b3a52186a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001/TestDescription.java @@ -0,0 +1,100 @@ +/* + * 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/ClassType/setValue/setvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.setValue() + * complies with its spec: + * public void setValue(Field field, Value value) + * throws InvalidTypeException, + * ClassNotLoadedException + * Assigns a value to a static field. + * The Field must be valid for this ObjectReference; that is, there must be + * a widening reference conversion from this object to the field's type. + * The field must not be final. + * Object values must be assignment compatible with the field type + * (This implies that the field type must be loaded through + * the enclosing class's class loader). + * Primitive values must be either assignment compatible with the field type + * or must be convertible to the field type without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * Parameters: field - the field to set. + * value - the value to be assigned. + * Throws: IllegalArgumentException - + * if the field is not static, the field is final, or + * the field does not exist in this class. + * ClassNotLoadedException - + * if the field type has not yet been loaded through + * the appropriate class loader. + * InvalidTypeException - + * if the value's type does not match the field's declared type. + * ObjectCollectedException - + * if the given Value is an mirrors an object + * which has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include only the primitive types + * when non of the Exceptions is expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.setValue.setvalue001; + * the debuggee program - nsk.jdi.ClassType.setValue.setvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.setValue.setvalue001 + * nsk.jdi.ClassType.setValue.setvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.setValue.setvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001a.java new file mode 100644 index 00000000000..16720a55973 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001a.java @@ -0,0 +1,128 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue001 JDI test. + */ + +public class setvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static setvalue001aTestClass obj = new setvalue001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.setValue()
    + * complies with its spec.
    + * The test checks up on throwing IllegalArgumentException and
    + * InvalidTypeException.
    + *
    + * The cases for testing include the primitive types and the array type.
    + * After being started up,
    + * a debuggee creates a TestClass object containing fields of each of
    + * the primitive types and the array type,
    + * and informs a debugger of the object creation.
    + * Upon the receiption a message from the debuggee, the debugger
    + * gets the mirror of the object, ClassType tClass,
    + * and performs the following checks:
    + * - invoking the method
    + * tClass.setValue(Field field1, BooleanValue blv2)
    + * with non-static field1 throws IllegalArgumentException;

    + * - invoking the method
    + * tClass.setValue(Field field1, ByteValue btv2)
    + * with final field1 throws IllegalArgumentException;
    + * - invoking the method
    + * tClass.setValue(Field field1, IntegerValue inv2)
    + * with field1 mirroring an static field within another debuggee's
    + * class throws IllegalArgumentException;
    + * - invoking the method
    + * tClass.setValue(Field field1, ByteValue btv2)
    + * with field1 mirroring not a primitive but an array type
    + * throws InvalidTypeException.
    + *
    + */ + +public class setvalue002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/setValue/setvalue002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.setValue.setvalue002a"; + + String mName = "nsk.jdi.ClassType.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + String testedclassName = mName + ".setvalue002aTestClass"; + + ReferenceType testedclass = null; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for setvalue002aTestClass"); + testedclass = (ReferenceType) classes.get(0); + + ClassType tClass = (ClassType) testedclass; + + + ReferenceType debuggeeclass = null; + + log2(" getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + debuggeeclass = (ReferenceType) classes.get(0); + + ClassType dClass = (ClassType) debuggeeclass; + + + + + String bl1 = "bl1", bl2 = "bl2"; + String bt1 = "bt1", bt2 = "bt2"; + String ch1 = "ch1", ch2 = "ch2"; + String db1 = "db1", db2 = "db2"; + String fl1 = "fl1", fl2 = "fl2"; + String in1 = "in1", in2 = "in2"; + String ln1 = "ln1", ln2 = "ln2"; + String sh1 = "sh1", sh2 = "sh2"; + + Field field1 = null; + Field field2 = null; + + + + log2("...... checking up: not static field; IllegalArgumentException is expected"); + try { + BooleanValue blv1 = null; + BooleanValue blv2 = null; + + field1 = testedclass.fieldByName(bl1); + field2 = testedclass.fieldByName(bl2); + if (field1 == null || field2 == null) { + log3("ERROR: field1 == null || field2 == null"); + testExitCode = FAILED; + } else { + blv2 = (BooleanValue) testedclass.getValue(field2); + tClass.setValue(field1, blv2); + log3("ERROR: no IllegalArgumentException"); + testExitCode = FAILED; + } + } catch ( IllegalArgumentException e1 ) { + log2(" IllegalArgumentException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception: " + e2); + testExitCode = FAILED; + } + + log2("...... checking up: final field; IllegalArgumentException is expected"); + try { + ByteValue btv1 = null; + ByteValue btv2 = null; + + field1 = testedclass.fieldByName(bt1); + field2 = testedclass.fieldByName(bt2); + if (field1 == null || field2 == null) { + log3("ERROR: field1 == null || field2 == null"); + testExitCode = FAILED; + } else { + btv2 = (ByteValue) testedclass.getValue(field2); + tClass.setValue(field1, btv2); + log3("ERROR: no IllegalArgumentException"); + testExitCode = FAILED; + } + } catch ( IllegalArgumentException e1 ) { + log2(" IllegalArgumentException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception: " + e2); + testExitCode = FAILED; + } + + + log2("...... checking up: field doesn't exist in this class; IllegalArgumentException is expected"); + try { + IntegerValue inv1 = null; + IntegerValue inv2 = null; + + field1 = debuggeeclass.fieldByName(in1); + field2 = testedclass.fieldByName(in2); + if (field1 == null || field2 == null) { + log3("ERROR: field1 == null || field2 == null"); + testExitCode = FAILED; + } else { + inv2 = (IntegerValue) testedclass.getValue(field2); + tClass.setValue(field1, inv2); + log3("ERROR: no IllegalArgumentException"); + testExitCode = FAILED; + } + } catch ( IllegalArgumentException e1 ) { + log2(" IllegalArgumentException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception: " + e2); + testExitCode = FAILED; + } + + + log2("...... checking up: no match the field's declared type; InvalidTypeException is expected"); + try { + ByteValue btv2 = null; + String bta = "bta"; + + field1 = testedclass.fieldByName(bta); + field2 = testedclass.fieldByName(bt2); + if (field1 == null || field2 == null) { + log3("ERROR: field1 == null || field2 == null"); + testExitCode = FAILED; + } else { + btv2 = (ByteValue) testedclass.getValue(field2); + tClass.setValue(field1, btv2); + log3("ERROR: no InvalidTypeException"); + testExitCode = FAILED; + } + } catch ( InvalidTypeException e1 ) { + log2(" InvalidTypeException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception: " + e2); + testExitCode = FAILED; + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002/TestDescription.java new file mode 100644 index 00000000000..43e213d08ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002/TestDescription.java @@ -0,0 +1,100 @@ +/* + * 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/ClassType/setValue/setvalue002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.setValue() + * complies with its spec: + * public void setValue(Field field, Value value) + * throws InvalidTypeException, + * ClassNotLoadedException + * Assigns a value to a static field. + * The Field must be valid for this ObjectReference; that is, there must be + * a widening reference conversion from this object to the field's type. + * The field must not be final. + * Object values must be assignment compatible with the field type + * (This implies that the field type must be loaded through + * the enclosing class's class loader). + * Primitive values must be either assignment compatible with the field type + * or must be convertible to the field type without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * Parameters: field - the field to set. + * value - the value to be assigned. + * Throws: IllegalArgumentException - + * if the field is not static, the field is final, or + * the field does not exist in this class. + * ClassNotLoadedException - + * if the field type has not yet been loaded through + * the appropriate class loader. + * InvalidTypeException - + * if the value's type does not match the field's declared type. + * ObjectCollectedException - + * if the given Value is an mirrors an object + * which has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include throwing both IllegalArgumentException and + * InvalidTypeException. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.setValue.setvalue002; + * the debuggee program - nsk.jdi.ClassType.setValue.setvalue002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.setValue.setvalue002 + * nsk.jdi.ClassType.setValue.setvalue002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.setValue.setvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002a.java new file mode 100644 index 00000000000..2955ab331bf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002a.java @@ -0,0 +1,130 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue002 JDI test. + */ + +public class setvalue002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static setvalue002aTestClass obj = new setvalue002aTestClass(); + + static int in1; + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.setValue()
    + * complies with its spec in case when
    + * no Exception is expected to be thrown.
    + * The test makes checking up on ReferenceTypes only.
    + *
    + * After being started up, a debuggee creates ReferenceType objects for
    + * testing and informs a debugger of the creation.
    + * Upon the receiption a message from the debuggee, the debugger
    + * gets ReferenceType debuggeeclass and ClassType dClass objects and
    + * checks up that for Fields field1 and field2 the following sequence
    + * Value val1 = debuggeeclass.getValue(field1);
    + * dClass.setValue(field2, val1);
    + * Value val2 = debuggeeclass.getValue(field2);
    + * results in: val1.equals(val2)
    + * for the following tested ReferenceType objects
    + * ClassType
    + * InterfaceType
    + * ClassArray
    + * InterfaceArray
    + * PrimitiveArray
    + *
    + */ + +public class setvalue003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/setValue/setvalue003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.setValue.setvalue003a"; + + String mName = "nsk.jdi.ClassType.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + List classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeclass = (ReferenceType) classes.get(0); + + ClassType dClass = (ClassType) debuggeeclass; + + + String names[][] = { { "class1", "class2" }, + { "class3", "class4" }, + { "iface1", "iface2" }, + { "iface3", "iface4" }, + { "array1", "array2" } }; + + Field field1 = null; + Field field2 = null; + + log2(" checking up variables of ReferenceTypes"); + + for (int i2 = 0; i2 < 5; i2++) { + try { + field1 = debuggeeclass.fieldByName(names[i2][0]); + field2 = debuggeeclass.fieldByName(names[i2][1]); + log2(" : tested type: " + field1.typeName()); + log2(" : tested variables: " + names[i2][0] + " " + names[i2][1]); + if (field1 != null && field2 != null) { + Value val1 = debuggeeclass.getValue(field1); + dClass.setValue(field2, val1); + Value val2 = debuggeeclass.getValue(field2); + if ( !val1.equals(val2)) { + log3("ERROR: !val1.equals(val2)"); + testExitCode = FAILED; + } + } else { + log3("ERROR: field1 != null && field2 != null"); + testExitCode = FAILED; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003/TestDescription.java new file mode 100644 index 00000000000..b6c0fdb4ed5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003/TestDescription.java @@ -0,0 +1,99 @@ +/* + * 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/ClassType/setValue/setvalue003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.setValue() + * complies with its spec: + * public void setValue(Field field, Value value) + * throws InvalidTypeException, + * ClassNotLoadedException + * Assigns a value to a static field. + * The Field must be valid for this ObjectReference; that is, there must be + * a widening reference conversion from this object to the field's type. + * The field must not be final. + * Object values must be assignment compatible with the field type + * (This implies that the field type must be loaded through + * the enclosing class's class loader). + * Primitive values must be either assignment compatible with the field type + * or must be convertible to the field type without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * Parameters: field - the field to set. + * value - the value to be assigned. + * Throws: IllegalArgumentException - + * if the field is not static, the field is final, or + * the field does not exist in this class. + * ClassNotLoadedException - + * if the field type has not yet been loaded through + * the appropriate class loader. + * InvalidTypeException - + * if the value's type does not match the field's declared type. + * ObjectCollectedException - + * if the given Value is an mirrors an object + * which has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include ReferenceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.setValue.setvalue003; + * the debuggee program - nsk.jdi.ClassType.setValue.setvalue003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.setValue.setvalue003 + * nsk.jdi.ClassType.setValue.setvalue003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.setValue.setvalue003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003a.java new file mode 100644 index 00000000000..d92d3eaab2f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003a.java @@ -0,0 +1,146 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue003 JDI test. + */ + +public class setvalue003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + // case 0 + static setvalue003aClassForCheck_2 class1[] = { new setvalue003aClassForCheck_2() }; + static setvalue003aClassForCheck_2 class2[] = null; + static setvalue003aInterfaceForCheck iface1[] = {new setvalue003aClassForCheck_2()}; + static setvalue003aInterfaceForCheck iface2[] = null; + + // case 1 + static setvalue003aClassForCheck_2 class3 = new setvalue003aClassForCheck_2(); + static setvalue003aClassForCheck_2 class4 = null; + static setvalue003aInterfaceForCheck iface3 = new setvalue003aClassForCheck_2(); + static setvalue003aInterfaceForCheck iface4 = null; + + // case 2 + static boolean array1[][] = {{true,false}, {false,true} }; + static boolean array2[][] = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.setValue()
    + * complies with its spec.
    + * The test checks up throwing InvalidTypeException
    + *
    + * After being started up, a debuggee creates all the primitive type
    + * objects and one of the Object type,
    + * and informs a debugger of the creation.
    + * Upon the receiption a message from the debuggee, the debugger
    + * checks up that for each in primitive types
    + * (1) setValue(primitivetype variable, null) does throw whereas
    + * (2) setValue(Object variable, null); does not throw
    + * InvalidTypeException
    + *
    + */ + +public class setvalue004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/setValue/setvalue004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.display(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.setValue.setvalue004a"; + + String mName = "nsk.jdi.ClassType.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + List classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeclass = (ReferenceType) classes.get(0); + + ClassType dClass = (ClassType) debuggeeclass; + + Field field1 = null; + Field field2 = null; + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1" }; + + log2(" checking up on exception for: setValue(primitivetype variable, null);"); + for ( int i2 = 0; i2 < 8; i2++ ) { + + try { + field1 = debuggeeclass.fieldByName(names[i2]); + log2(" checking up on exception for: Field of " + field1.typeName() + " type"); + dClass.setValue(field1, null); + log3("ERROR: no Exception"); + testExitCode = FAILED; + } catch ( java.lang.IllegalArgumentException e1 ) { + log3("ERROR: java.lang.IllegalArgumentException "); + testExitCode = FAILED; + } catch ( InvalidTypeException e2 ) { + log2(" : InvalidTypeException "); + } catch ( ClassNotLoadedException e3 ) { + log3("ERROR: ClassNotLoadedException "); + testExitCode = FAILED; + } catch ( VMMismatchException e4 ) { + log3("ERROR: VMMismatchException "); + testExitCode = FAILED; + } catch ( ObjectCollectedException e5 ) { + log3("ERROR: ObjectCollectedException "); + testExitCode = FAILED; + } catch ( Exception e6 ) { + log3("ERROR: UNSPECIFIED EXCEPTION: " + e6); + testExitCode = FAILED; + } + } + + + String name = "testObj"; + + log2(" checking up on exception for: setValue(Object variable, null);"); + try { + field1 = debuggeeclass.fieldByName(name); + if (field1 != null) { + dClass.setValue(field1, null); + log2(" : no Exception"); + } else { + log3("ERROR: field1 == null after: field1 = debuggeeclass.fieldByName(name);"); + testExitCode = FAILED; + } + } catch ( java.lang.IllegalArgumentException e1 ) { + log3("ERROR: java.lang.IllegalArgumentException "); + testExitCode = FAILED; + } catch ( InvalidTypeException e2 ) { + log3("ERROR: InvalidTypeException "); + testExitCode = FAILED; + } catch ( ClassNotLoadedException e3 ) { + log3("ERROR: ClassNotLoadedException "); + testExitCode = FAILED; + } catch ( ObjectCollectedException e4 ) { + log3("ERROR: ObjectCollectedException "); + testExitCode = FAILED; + } catch ( VMMismatchException e5 ) { + log3("ERROR: VMMismatchException "); + testExitCode = FAILED; + } catch ( Exception e6 ) { + log3("ERROR: UNSPECIFIED EXCEPTION: " + e6); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004/TestDescription.java new file mode 100644 index 00000000000..88f6692fb89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004/TestDescription.java @@ -0,0 +1,100 @@ +/* + * 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/ClassType/setValue/setvalue004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.setValue() + * complies with its spec: + * public void setValue(Field field, Value value) + * throws InvalidTypeException, + * ClassNotLoadedException + * Assigns a value to a static field. + * The Field must be valid for this ObjectReference; that is, there must be + * a widening reference conversion from this object to the field's type. + * The field must not be final. + * Object values must be assignment compatible with the field type + * (This implies that the field type must be loaded through + * the enclosing class's class loader). + * Primitive values must be either assignment compatible with the field type + * or must be convertible to the field type without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * Parameters: field - the field to set. + * value - the value to be assigned. + * Throws: IllegalArgumentException - + * if the field is not static, the field is final, or + * the field does not exist in this class. + * ClassNotLoadedException - + * if the field type has not yet been loaded through + * the appropriate class loader. + * InvalidTypeException - + * if the value's type does not match the field's declared type. + * ObjectCollectedException - + * if the given Value is an mirrors an object + * which has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The case for testing includes checking up on assigning null to + * both PrimitiveType and ReferenceType obects. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.setValue.setvalue004; + * the debuggee program - nsk.jdi.ClassType.setValue.setvalue004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.setValue.setvalue004 + * nsk.jdi.ClassType.setValue.setvalue004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.setValue.setvalue004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004a.java new file mode 100644 index 00000000000..f8d09cf2b5a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004a.java @@ -0,0 +1,124 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue004 JDI test. + */ + +public class setvalue004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static Object testObj = new Object(); + + static boolean bl1 = true, bl2 = false; + static byte bt1 = 0, bt2 = 1; + static char ch1 = 0, ch2 = 1; + static double db1 = 0.0d, db2 = 1.0d; + static float fl1 = 0.0f, fl2 = 1.0f; + static int in1 = 0, in2 = 1; + static long ln1 = 0, ln2 = 1; + static short sh1 = 0, sh2 = 1; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.setValue()
    + * complies with its spec.
    + * The test checks up on throwing IllegalArgumentException
    + * for the method invocation setValue(null, Value value);
    + *
    + * After being started up, a debuggee creates an value used in the test
    + * and informs a debugger of the creation.
    + * Upon the receiption a message from the debuggee, the debugger
    + * checks up that the call setValue.(null, ByteValue byteValue);
    + * throws IllegalArgumentException.
    + *
    + */ + +public class setvalue005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/setValue/setvalue005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue005().runThis(argv, out); + } + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.display(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.setValue.setvalue005a"; + + String mName = "nsk.jdi.ClassType.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + List classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeclass = (ReferenceType) classes.get(0); + + ClassType dClass = (ClassType) debuggeeclass; + + Field field1 = null; + Field field2 = null; + + String bt1 = "bt1"; + + + label1: { + try { + field1 = dClass.fieldByName(bt1); + if (field1 == null) { + log3("ERROR: field1 == null after: field1 = dClass.fieldByName('bt1');"); + testExitCode = FAILED; + break label1; + } + ByteValue byteValue = (ByteValue) debuggeeclass.getValue(field1); + if (byteValue == null) { + log3("ERROR: byteValue == null after: byteValue = (ByteValue) debuggeeclass.getValue(field1);"); + testExitCode = FAILED; + break label1; + } + + log2("......call: dClass.setValue(null, byteValue); IllegalArgumentException expected"); + dClass.setValue(null, byteValue); + log2("ERROR: no any Exception "); + testExitCode = FAILED; + } catch ( IllegalArgumentException e1 ) { + log2(" : IllegalArgumentException "); + } catch ( InvalidTypeException e2 ) { + log3("ERROR: InvalidTypeException "); + testExitCode = FAILED; + } catch ( ClassNotLoadedException e3 ) { + log3("ERROR: ClassNotLoadedException "); + testExitCode = FAILED; + } catch ( ObjectCollectedException e4 ) { + log3("ERROR: ObjectCollectedException "); + testExitCode = FAILED; + } catch ( VMMismatchException e5 ) { + log3("ERROR: VMMismatchException "); + testExitCode = FAILED; + } catch ( Exception e6 ) { + log3("ERROR: UNSPECIFIED EXCEPTION: " + e6); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005/TestDescription.java new file mode 100644 index 00000000000..0ab6555cdc6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005/TestDescription.java @@ -0,0 +1,98 @@ +/* + * 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/ClassType/setValue/setvalue005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.setValue() + * complies with its spec: + * public void setValue(Field field, Value value) + * throws InvalidTypeException, + * ClassNotLoadedException + * Assigns a value to a static field. + * The Field must be valid for this ObjectReference; that is, there must be + * a widening reference conversion from this object to the field's type. + * The field must not be final. + * Object values must be assignment compatible with the field type + * (This implies that the field type must be loaded through + * the enclosing class's class loader). + * Primitive values must be either assignment compatible with the field type + * or must be convertible to the field type without loss of information. + * See JLS section 5.2 for more information on assignment compatibility. + * Parameters: field - the field to set. + * value - the value to be assigned. + * Throws: IllegalArgumentException - + * if the field is not static, the field is final, or + * the field does not exist in this class. + * ClassNotLoadedException - + * if the field type has not yet been loaded through + * the appropriate class loader. + * InvalidTypeException - + * if the value's type does not match the field's declared type. + * ObjectCollectedException - + * if the given Value is an mirrors an object + * which has been garbage collected. + * Also thrown if this class has been unloaded and garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.setValue.setvalue005; + * the debuggee program - nsk.jdi.ClassType.setValue.setvalue005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.setValue.setvalue005 + * nsk.jdi.ClassType.setValue.setvalue005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.setValue.setvalue005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005a.java new file mode 100644 index 00000000000..29ac1330d49 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005a.java @@ -0,0 +1,123 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue005 JDI test. + */ + +public class setvalue005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + Object testObj = new Object(); + boolean bl1 = true, bl2 = false; + byte bt1 = 0, bt2 = 1; + char ch1 = 0, ch2 = 1; + double db1 = 0.0d, db2 = 1.0d; + float fl1 = 0.0f, fl2 = 1.0f; + int in1 = 0, in2 = 1; + long ln1 = 0, ln2 = 1; + short sh1 = 0, sh2 = 1; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.ClassType.setValue()
    + * does not throw ClassNotLoadedException - when a debugger + * part of the test attempts to set null value to the debuggee field + * which field type has not yet been loaded through the appropriate + * class loader.

    + * + * The test works as follows. The debuggee part has two static + * fields: dummySFld of non-loaded type setvalue006tDummyType and + * finDummySFld of non-loaded type setvalue006tFinDummyType. + * Debugger part tries to provoke the exception by setting null values to + * these fields. The test makes sure that appropriate class has not + * been loaded by the debuggee VM through the JDI method + * VirtualMachine.classesByName() which should return matching + * list of loaded classes only. + */ +public class setvalue006 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.setValue.setvalue006t"; + + // tested static fields in debuggee class and theirs types + static final int FLD_NUM = 2; + static final String DEBUGGEE_FLDS[][] = { + {"dummySFld", "nsk.jdi.ClassType.setValue.setvalue006tDummyType"}, + {"finDummySFld", "nsk.jdi.ClassType.setValue.setvalue006tFinDummyType"} + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue006().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "setvalue006t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + ClassType clsType = (ClassType) rType; + + for (int i=0; i + * com.sun.jdi.ClassType.setValue()
    + * properly throws InvalidTypeException - if + * the value's type does not match type of the specified field.

    + * + * Debugger part of the test tries to provoke the exception by setting + * values of static fields of different primitive types and own setvalue007tDummyType + * which are not assignment compatible with the field type, and not + * convertible without loss of information as well. + */ +public class setvalue007 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ClassType.setValue.setvalue007t"; + + static final int FLD_NUM = 30; + static final String DEBUGGEE_FLDS[][] = { + // list of debuggee static fields used to set values and ones + // used to get their wrong non-conversionable values, + // see section "5.1.2 Widening Primitive Conversion" in the JLS + {"dummySFld", "doubleSFld"}, + {"byteSFld", "strSFld"}, + {"byteSFld", "shortSFld"}, + {"byteSFld", "intSFld"}, + {"byteSFld", "longSFld"}, + {"byteSFld", "floatSFld"}, + {"byteSFld", "doubleSFld"}, + {"shortSFld", "intSFld"}, + {"shortSFld", "longSFld"}, + {"shortSFld", "floatSFld"}, + {"shortSFld", "doubleSFld"}, + {"intSFld", "longSFld"}, + {"intSFld", "floatSFld"}, + {"intSFld", "doubleSFld"}, + {"longSFld", "floatSFld"}, + {"longSFld", "doubleSFld"}, + {"floatSFld", "doubleSFld"}, + {"doubleSFld", "dummySFld"}, + {"charSFld", "strSFld"}, + {"booleanSFld", "byteSFld"}, + {"strSFld", "charSFld"}, + // see section "5.1.1 Identity Conversions" in the JLS: + // "the only permitted conversion that involves the type boolean is + // the identity conversion from boolean to boolean" + {"byteSFld", "booleanSFld"}, + {"shortSFld", "booleanSFld"}, + {"intSFld", "booleanSFld"}, + {"longSFld", "booleanSFld"}, + {"floatSFld", "booleanSFld"}, + {"doubleSFld", "booleanSFld"}, + {"charSFld", "booleanSFld"}, + {"strSFld", "booleanSFld"}, + {"dummySFld", "booleanSFld"} + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue007().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "setvalue007t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + ClassType clsType = (ClassType) rType; + + for (int i=0; i " + 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() { + check(); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static void check () { + try { + ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(expectedFieldName).type(); + String className = checkedClass.name(); + for (int i = 0; i < expectedEnumFieldsNames.length; i++) { + Field foundField = checkedClass.fieldByName(expectedEnumFieldsNames[i]); + try { + checkedClass.setValue(foundField, null); + complain("Expected IllegalArgumentException was not thrown while trying to set null value for " + foundField.name()); + exitStatus = Consts.TEST_FAILED; + } catch (Exception e) { + if (e instanceof IllegalArgumentException) { + display("Expected IllegalArgumentException was thrown while trying to set null value for " + foundField.name()); + } else { + complain("Unexpected exception while trying to set null value for " + foundField.name() + ": " + e); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue008/TestDescription.java new file mode 100644 index 00000000000..ef1c89f1dc4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue008/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ClassType/setValue/setvalue008. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for setValue() method of ClassType interface. + * The test checks if the method throws IllegalArgumentException + * if trying to set new value for anym enum constant field of enum + * type because the field is implicitly final. + * The test consists of a debugger program (setvalue008.java) + * and debuggee application (setvalue008a.java). + * Package name is nsk.jdi.ClassType.setValue . + * 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 finds mirrors enum type and its enum constant fields. + * Then the debugger to set value of these fields to null and + * expects the IllegalArgumentException to be thrown. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassType.setValue.setvalue008 + * nsk.jdi.ClassType.setValue.setvalue008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.setValue.setvalue008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue008a.java new file mode 100644 index 00000000000..db9e6f7b20c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue008a.java @@ -0,0 +1,93 @@ +/* + * 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.ClassType.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class setvalue008a { + + //------------------------------------------------------- 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 setvalue008Enum1 f1 = setvalue008Enum1.e2; + + //------------------------------------------------------ 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(setvalue008.SIGNAL_READY); + + + //pipe.println(setvalue008.SIGNAL_GO); + receiveSignal(setvalue008.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum setvalue008Enum1 { + e1, e2; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001.java new file mode 100644 index 00000000000..6533880fec6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001.java @@ -0,0 +1,280 @@ +/* + * 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.ClassType.subclasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.subclasses()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Class2 extends Class1
    + * hence Class1 has only one subclass
    + * 2) Class3 and Class4 extend Class2
    + * hence Class2 has two subclasses
    + * 3) Class3 has no subclasses
    + *
    + */ + +public class subclasses001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/subclasses/subclasses001", + sHeader2 = "--> subclasses001: ", + sHeader3 = "##> subclasses001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new subclasses001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.subclasses.subclasses001a"; + + String mName = "nsk.jdi.ClassType.subclasses"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("subclasses001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + List l = null; + String name = null; + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Class2 extends Class1 + + List list1 = vm.classesByName(mName + ".Class1ForCheck"); + classRefType = (ReferenceType) list1.get(0); + List subClass1list = ((ClassType) classRefType).subclasses(); + + if (subClass1list.size() != 1) { + log3("ERROR : subClass1list.size() != 1 in case: Class2 extends Class1"); + expresult = 1; + break; + } + + ClassType classType2 = + (ClassType) (ReferenceType) subClass1list.get(0); + name = classType2.name(); + if (!name.equals(mName + ".Class2ForCheck")) { + log3("ERROR : !name.equals('.Class2..' in Class2 extends Class1"); + expresult = 1; + break; + } + + break; + + case 1: // Class3, Class4 extend Class2 + + List list2 = vm.classesByName(mName + ".Class2ForCheck"); + classRefType = (ReferenceType) list2.get(0); + List subClass2list = ((ClassType) classRefType).subclasses(); + + if (subClass2list.size() != 2) { + log3("ERROR : subClass2list.size() != 2 in case: Classes 3,4 extend Class2"); + expresult = 1; + break; + } + + ClassType classType3 = + (ClassType) (ReferenceType) subClass2list.get(0); + name = classType3.name(); + if (!name.equals(mName + ".Class3ForCheck")) { + if (!name.equals(mName + ".Class4ForCheck")) { + log3("ERROR : !name.equals('.Class3..' or '.Class4..' in Class3,4 extends Class2"); + expresult = 1; + break; + } + } + classType3 = + (ClassType) (ReferenceType) subClass2list.get(1); + name = classType3.name(); + if (!name.equals(mName + ".Class4ForCheck")) { + if (!name.equals(mName + ".Class3ForCheck")) { + log3("ERROR : !name.equals('.Class4..' or '.Class3..' in Class3,4 extends Class2"); + expresult = 1; + break; + } + } + + break; + + case 2: // Class3 + + List list3 = vm.classesByName(mName + ".Class3ForCheck"); + classRefType = (ReferenceType) list3.get(0); + List subClass3list = ((ClassType) classRefType).subclasses(); + + if (subClass3list.size() != 0) { + log3("ERROR : subClass1list.size() != 0 in case: Class3"); + expresult = 1; + break; + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001/TestDescription.java new file mode 100644 index 00000000000..b362cbe3e31 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001/TestDescription.java @@ -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/ClassType/subclasses/subclasses001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.subclasses() + * complies with its spec: + * public java.util.List subclasses() + * Gets the currently loaded, direct subclasses of this class. + * No ordering of this list is guaranteed. + * Returns: a List of ClassType objects each mirroring a loaded subclass + * of this class in the target VM. If no such classes exist, + * this method returns a zero-length list. + * Throws: ObjectCollectedException - + * if this class has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.subclasses.subclasses001; + * the debuggee program - nsk.jdi.ClassType.subclasses.subclasses001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.subclasses.subclasses001 + * nsk.jdi.ClassType.subclasses.subclasses001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.subclasses.subclasses001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001a.java new file mode 100644 index 00000000000..d5851b34a24 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses001a.java @@ -0,0 +1,250 @@ +/* + * 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.ClassType.subclasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the subclasses001 JDI test. + */ + +public class subclasses001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> subclasses001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> subclasses001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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(); + List subclasses = checkedClass.subclasses(); + if (subclasses.size() != 2) { + complain("Size of the list returned by ClassType.subclasses() for " + className + " is not equal 2"); + exitStatus = Consts.TEST_FAILED; + } + Iterator it = checkedClass.subclasses().iterator(); + while (it.hasNext()) { + String subclName = it.next().name(); + if (subclName.indexOf(className) >= 0) { + display(className + " has expected subclass " + subclName); + } else { + complain(className + " has unexpected subclass " + subclName); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002/TestDescription.java new file mode 100644 index 00000000000..bc7383824c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002/TestDescription.java @@ -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/ClassType/subclasses/subclasses002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for subclasses() method of ClassType interface. + * The test checks if the method returns correct list of subclasses + * for any mirrored enum type if it has declared enum constant's + * specific class bodies. + * The test consists of a debugger program (subclasses002.java) + * and debuggee application (subclasses002a.java). + * Package name is nsk.jdi.ClassType.subclasses . + * 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 subclasses() method for two fields + * of enum type declared in fields006a class. + * Each othis enum types has declared enum constant's specific class + * bodies. The test fails if the method returned list of wrong size + * or if any member of the list is not inner class of corresponded + * enum type. + * 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.ClassType.subclasses.subclasses002 + * nsk.jdi.ClassType.subclasses.subclasses002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.subclasses.subclasses002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002a.java new file mode 100644 index 00000000000..a1fe8bf103e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002a.java @@ -0,0 +1,113 @@ +/* + * 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.ClassType.subclasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class subclasses002a { + + //------------------------------------------------------- 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 subclasses002Enum1 f1 = subclasses002Enum1.e1; + static subclasses002Enum2 f2 = subclasses002Enum2.e2; + + //------------------------------------------------------ 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(subclasses002.SIGNAL_READY); + receiveSignal(subclasses002.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum subclasses002Enum1 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum subclasses002Enum2 implements subclasses002i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +interface subclasses002i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001.java new file mode 100644 index 00000000000..d94f8d387a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001.java @@ -0,0 +1,280 @@ +/* + * 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.ClassType.superclass; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ClassType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ClassType.superclass()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Class2 extends Class1
    + * hence Class1 is superclass of Class2
    + * 2) Class2 extends Class1
    + * Class3 extends Class2
    + * hence Class2 is superclass of Class3
    + * 3) Class1
    + * hence Object is superclass of Class1
    + *
    + */ + +public class superclass001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ClassType/superclass/superclass001", + sHeader2 = "--> superclass001: ", + sHeader3 = "##> superclass001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new superclass001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ClassType.superclass.superclass001a"; + + String mName = "nsk.jdi.ClassType.superclass"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("superclass001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List list1 = vm.classesByName(mName + ".Class1ForCheck"); + List list2 = vm.classesByName(mName + ".Class2ForCheck"); + List list3 = vm.classesByName(mName + ".Class3ForCheck"); + + ClassType superclass0 = null; + ClassType superclass1 = null; + ClassType superclass2 = null; + + ReferenceType classRefType = null; + + String name = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Class2 extends Class1 + + classRefType = (ReferenceType) list2.get(0); + superclass1 = ((ClassType) classRefType).superclass(); + + if (superclass1 == null) { + log3("ERROR : superclass1 == null in case: Class2 extends Class1"); + expresult = 1; + break; + } + + name = superclass1.name(); + if (!name.equals(mName + ".Class1ForCheck")) { + log3("ERROR : name != 'Class1ForCheck' in Class2 extends Class1"); + expresult = 1; + break; + } + + break; + + case 1: // Class3 extends Class2 + + classRefType = (ReferenceType) list3.get(0); + superclass2 = ((ClassType) classRefType).superclass(); + + if (superclass2 == null) { + log3("ERROR : superclass2 == null in case: Class3 extends Class2"); + expresult = 1; + break; + } + + name = superclass2.name(); + if (!name.equals(mName + ".Class2ForCheck")) { + log3("ERROR : name != 'Class2ForCheck' in Class3 extends Class2"); + expresult = 1; + break; + } + + break; + + case 2: // Class1 + + classRefType = (ReferenceType) list1.get(0); + + superclass0 = ((ClassType) classRefType).superclass(); + + if (superclass0 == null) { + log3("ERROR : superclass2 == null in case: Class1"); + expresult = 1; + break; + } + + name = superclass0.name(); + if (!name.equals("java.lang.Object")) { + log3("ERROR : name != 'java.lang.Object' in Class1"); + expresult = 1; + break; + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001/TestDescription.java new file mode 100644 index 00000000000..03a2f8db689 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/ClassType/superclass/superclass001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ClassType. + * The test checks up that a result of the method + * com.sun.jdi.ClassType.superclass() + * complies with its scec: + * public ClassType superclass() + * Gets the superclass of this class. + * Returns: a ClassType that mirrors the superclass of this class in + * the target VM. If no such class exists, returns null + * Throws: ObjectCollectedException - + * if this class has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ClassType.superclass001; + * the debuggee program - nsk.jdi.ClassType.superclass001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ClassType.superclass.superclass001 + * nsk.jdi.ClassType.superclass.superclass001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.superclass.superclass001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001a.java new file mode 100644 index 00000000000..7b3008028e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass001a.java @@ -0,0 +1,215 @@ +/* + * 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.ClassType.superclass; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the superclass001 JDI test. + */ + +public class superclass001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> superclass001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> superclass001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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 < 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.superclass().name().equals("java.lang.Enum")) { + display("ClassType.superclass() returned expected java.lang.Enum for type: " + className); + } else { + complain("ClassType.superclass() returned unexpected type: " + checkedClass.superclass().name()); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass002/TestDescription.java new file mode 100644 index 00000000000..85427089149 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass002/TestDescription.java @@ -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/ClassType/superclass/superclass002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for superclass() method of ClassType interface. + * The test checks if the method returns java.lang.Enum reference + * for any mirrored enum type + * The test consists of a debugger program (superclass002.java) + * and debuggee application (superclass002a.java). + * Package name is nsk.jdi.ClassType.superclass . + * 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 superclass() method for each field + * of enum type declared in fields006a class. + * The test fails if the method returned type name other + * than "java.lang.Enum". + * 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.ClassType.superclass.superclass002 + * nsk.jdi.ClassType.superclass.superclass002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassType.superclass.superclass002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass002a.java new file mode 100644 index 00000000000..efa69e88911 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/superclass/superclass002a.java @@ -0,0 +1,167 @@ +/* + * 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.ClassType.superclass; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class superclass002a { + + //------------------------------------------------------- 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; + static Enum4.Enum4_ f4 = Enum4.Enum4_.e1; + static superclass002Enum5 f5 = superclass002Enum5.e2; + static superclass002Enum6 f6 = superclass002Enum6.e1; + static superclass002Enum7 f7 = superclass002Enum7.e2; + static superclass002Enum8.Enum8_ f8 = superclass002Enum8.Enum8_.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(superclass002.SIGNAL_READY); + + + //pipe.println(superclass002.SIGNAL_GO); + receiveSignal(superclass002.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + + enum Enum1 { + e1, e2; + } + + enum Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); + } + + enum Enum3 implements superclass002i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); + } + + enum Enum4 { + e1, e2; + + enum Enum4_ { + e1, e2; + } + } + +} + +//--------------------------------------------------------- test specific classes + +enum superclass002Enum5 { + e1, e2; +} + +enum superclass002Enum6 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum superclass002Enum7 implements superclass002i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +enum superclass002Enum8 { + e1, e2; + enum Enum8_ { + e1, e2; + } +} + +interface superclass002i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001.java new file mode 100644 index 00000000000..77ef71d304f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001.java @@ -0,0 +1,325 @@ +/* + * 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.ClassUnloadEvent.className; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger application in the test + +public class classname001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_LOAD = "load"; + static final String COMMAND_LOADED = "loaded"; + static final String COMMAND_UNLOAD = "unload"; + static final String COMMAND_UNLOADED = "unloaded"; + + static final String PREFIX = "nsk.jdi.ClassUnloadEvent.className"; + static final String DEBUGGEE_NAME = PREFIX + ".classname001a"; + static final String CHECKED_CLASS = PREFIX + ".classname001b"; + static final String KLASSLOADER = ClassUnloader.INTERNAL_CLASS_LOADER_NAME; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ClassUnloadRequest checkedRequest; + + static private long eventTimeout; + static private boolean testFailed; + static private boolean eventReceived; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debugee + + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "classname001a >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // create request and wait for ClassUnloadEvent + + try { + + // resume debugee and wait for it becomes ready + log.display("Resuming debuggee"); + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (command == null || !command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirror of debugee class + ReferenceType rType; + if ((rType = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find debuggee's class " + DEBUGGEE_NAME); + } + + // send command to load checked class and waits for a confirmation + pipe.println(COMMAND_LOAD); + log.display("Waiting for checked class is loaded"); + command = pipe.readln(); + + if (command == null || !command.equals(COMMAND_LOADED)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // checked class has been loaded! + log.display("Checked class has been loaded in debuggee!"); + + // check that checked class is loaded in debugee + log.display("Finding checked class in debuggee"); + if ((rType = debuggee.classByName(CHECKED_CLASS)) == null) { + throw new Failure("TEST BUG: cannot find checked class loaded: " + CHECKED_CLASS); + } + rType = null; + + // check that user-defined classloader is also loaded in debuggee + log.display("Finding user-defined class loader in debuggee"); + if ((rType = debuggee.classByName(KLASSLOADER)) == null) { + throw new Failure("TEST BUG: cannot find user-defined classloader loaded: " + KLASSLOADER); + } + rType = null; + + // create request for class unload event + log.display("Creating request for ClassUnloadEvent"); + EventRequestManager erManager = vm.eventRequestManager(); + if ((checkedRequest = erManager.createClassUnloadRequest()) == null) { + throw new Failure("TEST BUG: unable to create ClassUnloadRequest"); + } else { + log.display("ClassUnloadRequest created"); + } +// checkedRequest.addClassFilter("nsk.jdi.ClassUnloadEvent.className.*"); + + // enable event request + log.display("Enabling event request"); + checkedRequest.enable(); + + // turn off pipe pinging + pipe.setPingTimeout(0); + + // force checked class to be unloaded from debuggee + log.display("Waiting for checked class is unloaded"); + pipe.println(COMMAND_UNLOAD); + command = pipe.readln(); + + // end the test if checked class has not been actually unloaded or error occurs + if (command != null && command.equals(COMMAND_LOADED)) { + throw new Warning("TEST INCOMPLETE: unable to unload class"); + } + + if (command == null || !command.equals(COMMAND_UNLOADED)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // checked class has been unloaded + log.display("Checked class forced to be unloaded from debuggee!"); + + // waiting for event until timeout exceeds + log.display("Waiting for ClassUnloadEvent for checked class"); + long timeToFinish = System.currentTimeMillis() + eventTimeout; + while (!eventReceived && System.currentTimeMillis() < timeToFinish) { + + // get next event set + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (Exception e) { + throw new Failure("TEST INCOMPLETE: Unexpected exception while getting event: " + e); + } + if (eventSet == null) + continue; + + // handle each event from the event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + // handle ClassUnloadEvent + if (event instanceof ClassUnloadEvent) { + + ClassUnloadEvent castedEvent = (ClassUnloadEvent)event; + log.display("Received event is ClassUnloadEvent:\n " + castedEvent); + + // check that received event is for checked request + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + + // check that received event is for checked VM + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + // test the method ClassUnloadEvent.className() + String refName = castedEvent.className(); + + // check that received event is for checked class + log.display("ClassUnloadEvent is received for " + refName); + if ((refName == null) || (refName.equals(""))) { + log.complain("FAILURE 3: ClassUnloadEvent.className() returns null or empty string"); + testFailed = true; + } else if (refName.equals(CHECKED_CLASS)) { + + // mark that ClassUnloadEvent for checked class received + eventReceived = true; + log.display("Expected ClassUnloadEvent for checked class received!"); + +/* + // check that checked class is not included in debuggee's list of loaded classes + List loadedClasses = vm.classesByName(CHECKED_CLASS); + if (loadedClasses != null) { + log.complain("FAILURE 4: ClassUnloadEvent is received for class to be unloaded\n" + + " but class still presents in the list of all debuggee classes"); + testFailed = true; + } +*/ + + } else { + + // ClassUnloadEvent for another class received; just display it + List loadedClasses = vm.classesByName(refName); + if (loadedClasses != null) { + log.display("ClassUnloadEvent was received for loaded class " + refName); + } + } + } + + // ignore all other events + } + + log.display("Resuming event set"); + eventSet.resume(); + } + + log.display(""); + + // check that expected event has been received + log.display("Searching checked class in debuggee"); + rType = debuggee.classByName(CHECKED_CLASS); + if (rType != null) { + if (eventReceived) { + log.complain("FAILURE 4: ClassUnloadEvent is received for class to be unloaded\n" + + " but class still presents in the list of all debuggee classes"); + testFailed = true; + } else { + log.display("WARNING: Unable to test ClassUnloadEvent because checked class\n" + + " was not actually unloaded"); + } + } else { + if (!eventReceived) { + log.complain("FAILURE 6: ClassUnloadEvent was not received for class to be unloaded\n" + + " but class no longe presents in the list of all debuggee classes "); + testFailed = true; + } + } + + } catch (Warning e) { + log.display("WARNING: " + e.getMessage()); + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + // disable event request to prevent appearance of further events + if (checkedRequest != null) { + log.display("Disabling event request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + return PASSED; + } + + static class Warning extends Failure { + Warning(String msg) { + super(msg); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TestDescription.java new file mode 100644 index 00000000000..ab7cf2bfb83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TestDescription.java @@ -0,0 +1,97 @@ +/* + * 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/ClassUnloadEvent/className/classname001. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * The test exercises JDI method ClassUnloadEvent.className() . + * The test checks the following assertions: + * - ClassUnloadEvent is always received by debugger + * for unloaded class in target VM, + * - the string returned by className() is not empty. + * A debugger class - nsk.jdi.ClassUnloadEvent.className.classname001 ; + * a debuggee class - nsk.jdi.ClassUnloadEvent.className.classname001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger forces debuggee to load checked class, creates and + * enables ClassUnloadRequest. Next, debugger forces debuggee to + * unload class, using memory stressing techique, and waits for + * ClassUnloadEvent. + * If expected ClassUnloadEvent occurs, debugger tests method + * ClassUnloadEvent.className() and verifies that this event + * is for checked class. + * If no expected ClassUnloadEvent received for WAITTIME period + * but class not found in debuggee, or ClassUnloadEvent received + * but class still in class list, debugger reports an error. + * Test pass even if class leave loaded in debuggee but no + * ClassUnloadEvent received, + * Finally, debugger disables event request to prevent further + * appearing of events, sends debuggee command to quit, clears + * event queue, wait for debugge terminated, and exits. + * The test fails if any of the checks failed. + * PARAMETERS + * 1: String - current test directory. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4463674: TEST_BUG: some JDI tests are timing dependent + * Test fixed due to bug: + * 4419078 HS1.4: class isn't unloaded when its classloader is being finalized + * Test fixed due to bug: + * 4642444 TEST_BUG: tests against ClassUnloadEvent fail due to internal ping timeout + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - classname003b class was moved in 'loadclass' subdirectory; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for classname003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadEvent.className.classname001 + * nsk.jdi.ClassUnloadEvent.className.classname001a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassUnloadEvent.className.classname001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/loadclass/classname001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/loadclass/classname001b.java new file mode 100644 index 00000000000..9dc56c62681 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/loadclass/classname001b.java @@ -0,0 +1,28 @@ +/* + * 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. + */ + +// This class will be loaded and then unloaded + +package nsk.jdi.ClassUnloadEvent.className; + +class classname001b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001a.java new file mode 100644 index 00000000000..1415f30a3d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001a.java @@ -0,0 +1,104 @@ +/* + * 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.ClassUnloadEvent.className; + +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class classname001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String PREFIX = "nsk.jdi.ClassUnloadEvent.className"; + static final String CHECKED_CLASS = PREFIX + ".classname001b"; + + public static void main(String args[]) { + classname001a _classname001a = new classname001a(); + System.exit(JCK_STATUS_BASE + _classname001a.run(args)); + } + + int run (String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // define directory to class files + String loadClassDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + // notify debugger that debugee is ready + pipe.println(classname001.COMMAND_READY); + + // wait for a command to load checked class + String command = pipe.readln(); + if (!command.equals(classname001.COMMAND_LOAD)) { + System.err.println("TEST BUG: unexpected command: " + command); + return FAILED; + } + + // load class for further unloading + ClassUnloader classUnloader = new ClassUnloader(); + try { + classUnloader.loadClass(CHECKED_CLASS, loadClassDir); + } catch (Exception ex) { + System.err.println("Unexpected exception while loading classname001b:"); + System.err.println(ex); + return FAILED; + } + + // notify debugger that checked class is loaded + pipe.println(classname001.COMMAND_LOADED); + + // turn off pipe pinging + pipe.setPingTimeout(0); + + // wait for a command to unload checked class + command = pipe.readln(); + if (!command.equals(classname001.COMMAND_UNLOAD)) { + System.err.println("TEST BUG: unexpected command: " + command); + return FAILED; + } + + // try to unload checked class + boolean unloaded = classUnloader.unloadClass(); + + if (!unloaded) { + pipe.println(classname001.COMMAND_LOADED); + } else { + pipe.println(classname001.COMMAND_UNLOADED); + } + + // wait for a command to exit + command = pipe.readln(); + if (!command.equals(classname001.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001.java new file mode 100644 index 00000000000..e3afb2185b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001.java @@ -0,0 +1,383 @@ +/* + * 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.ClassUnloadEvent.classSignature; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +// NOTE: Test does not check array class because of difficulty of +// providing reliable technique for unloading such class. +// So all these testcases are commented in the test. + +public class signature001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_LOAD = "load"; + static final String COMMAND_LOADED = "loaded"; + static final String COMMAND_UNLOAD = "unload"; + static final String COMMAND_UNLOADED = "unloaded"; + + static final String PREFIX = "nsk.jdi.ClassUnloadEvent.classSignature"; + static final String DEBUGGEE_NAME = PREFIX + ".signature001a"; + static final String CHECKED_CLASS = PREFIX + ".signature001c"; + static final String CHECKED_INTERFACE = PREFIX + ".signature001b"; + static final String CHECKED_ARRAY = PREFIX + ".signature001c[]"; + static final String KLASSLOADER = ClassUnloader.INTERNAL_CLASS_LOADER_NAME; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ClassUnloadRequest checkedRequest; + + static private long eventTimeout; + static private boolean testFailed; + static private boolean eventsReceived; + static private boolean eventForClass, eventForInterface, eventForArray; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventsReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debugee + + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "signature001a >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // create request and wait for ClassUnloadEvent + + try { + + // resume debugee and wait for it becomes ready + + log.display("Resuming debuggee"); + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (command == null || !command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirror of debugee class + + ReferenceType rType; + if ((rType = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find debuggee's class " + DEBUGGEE_NAME); + } + + // send command to load checked class and waits for a confirmation + + pipe.println(COMMAND_LOAD); + log.display("Waiting for checked class is loaded"); + command = pipe.readln(); + + if (command == null || !command.equals(COMMAND_LOADED)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // checked class has been loaded! + log.display("Checked classes have been loaded in debuggee!"); + + // create request for class unload event + + log.display("Creating request for ClassUnloadEvent"); + EventRequestManager erManager = vm.eventRequestManager(); + if ((checkedRequest = erManager.createClassUnloadRequest()) == null) { + throw new Failure("TEST BUG: unable to create ClassUnloadRequest"); + } else { + log.display("ClassUnloadRequest created"); + } +// checkedRequest.addClassFilter("nsk.jdi.ClassUnloadEvent.classSignature.*"); + + log.display("Enabling event request"); + checkedRequest.enable(); + + List unloadRequests = vm.eventRequestManager().classUnloadRequests(); + if (unloadRequests == null) { + throw new Failure("TEST_BUG: ClassUnloadRequest is not created"); + } + + // force checked classes to be unloaded from debuggee + + // turn off pipe pinging + pipe.setPingTimeout(0); + + log.display("Waiting for checked class is unloaded"); + pipe.println(COMMAND_UNLOAD); + command = pipe.readln(); + + // end test if checked classes have not been actually unloaded or error occurs + + if (command != null && command.equals(COMMAND_LOADED)) { +// throw new Failure("TEST INCOMPLETE: unable to unload classes"); + throw new Warning("TEST INCOMPLETE: unable to unload classes"); + } + + if (command == null || !command.equals(COMMAND_UNLOADED)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // checked classes have been unloaded + log.display("Checked classes forced to be unloaded from debuggee!"); + + // waiting for event untill timeout exceeds + log.display("Waiting for ClassUnloadEvent for checked class"); + long timeToFinish = System.currentTimeMillis() + eventTimeout; + while (!eventsReceived && System.currentTimeMillis() < timeToFinish) { + + // get next event set + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (Exception e) { + throw new Failure("TEST INCOMPLETE: Unexpected exception while getting event: " + e); + } + if (eventSet == null) + continue; + + // handle each event from the event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + // handle ClassUnloadEvent + if (event instanceof ClassUnloadEvent) { + + ClassUnloadEvent castedEvent = (ClassUnloadEvent)event; + log.display("Received event is ClassUnloadEvent:\n" + castedEvent); + + // check that received event is for checked request + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + + // check that received event is for checked VM + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + // test method ClassUnloadEvent. + String refSignature = castedEvent.classSignature(); + log.display("ClassUnloadEvent is received for " + refSignature); + + // check that received event is for checked class + if ((refSignature == null) || (refSignature.equals(""))) { + + log.complain("FAILURE 3: ClassUnloadEvent.classSignature() returns null or empty string"); + testFailed = true; + + } else if (refSignature.equals("L" + CHECKED_CLASS.replace('.','/') + ";")) { + + // mark that ClassUnloadEvent for checked class received + eventForClass = true; + log.display("Expected ClassUnloadEvent for checked class received!"); + +/* + // check that checked class is not included in debuggee's list of loaded classes + List loadedClasses = vm.classesByName(CHECKED_CLASS); + if (loadedClasses != null) { + log.complain("FAILURE 4: Class " + CHECKED_CLASS + + " is not unloaded while ClassUnloadEvent is received"); + testFailed = true; + } +*/ + + } else if (refSignature.equals("L" + CHECKED_INTERFACE.replace('.','/') + ";")) { + + // mark that ClassUnloadEvent for checked interface received + eventForInterface = true; + log.display("Expected ClassUnloadEvent for checked class received!"); + +/* + // check that checked interface is not included in debuggee's list of loaded classes + List loadedClasses = vm.classesByName(CHECKED_INTERFACE); + if (loadedClasses != null) { + log.complain("FAILURE 4: Class " + CHECKED_INTERFACE + + " is not unloaded while ClassUnloadEvent is received"); + testFailed = true; + } +*/ + +/* + } else if (refSignature.equals("L" + CHECKED_ARRAY.replace('.','/') + ";")) { + + // mark that ClassUnloadEvent for checked array class received + eventForArray = true; + log.display("Expected ClassUnloadEvent for checked array class received!"); + + // check that checked array class is not included in debuggee's list of loaded classes + List loadedClasses = vm.classesByName(CHECKED_ARRAY); + if (loadedClasses != null) { + log.complain("FAILURE 4: Class " + CHECKED_ARRAY + + " is not unloaded while ClassUnloadEvent is received"); + testFailed = true; + } + +*/ + } else { + + // ClassUnloadEvent for another class received; just display it + log.display("ClassUnloadEvent was received for loaded class " + refSignature); + } + } + + // ignore all other events + } + + eventSet.resume(); + eventsReceived = eventForClass && eventForInterface /* && eventForArray */; + } + + log.display(""); + + // check that expected event has been received for checked class + log.display("Searching checked class in debuggee"); + rType = debuggee.classByName(CHECKED_CLASS); + if (rType != null) { + if (eventForClass) { + log.complain("FAILURE 4: ClassUnloadEvent is received for class to be unloaded\n" + + " but class still presents in the list of all debuggee classes"); + testFailed = true; + } else { + log.display("WARNING: Unable to test ClassUnloadEvent because checked class\n" + + " was not actually unloaded"); + } + } else { + if (!eventForClass) { + log.complain("FAILURE 5: ClassUnloadEvent was not received for class to be unloaded\n" + + " but class no longe presents in the list of all debuggee classes "); + testFailed = true; + } + } + + // check that expected event has been received for checked interface + log.display("Searching checked interface in debuggee"); + rType = debuggee.classByName(CHECKED_INTERFACE); + if (rType != null) { + if (eventForInterface) { + log.complain("FAILURE 6: ClassUnloadEvent is received for interface to be unloaded\n" + + " but class still presents in the list of all debuggee classes"); + testFailed = true; + } else { + log.display("WARNING: Unable to test ClassUnloadEvent because checked interface\n" + + " was not actually unloaded"); + } + } else { + if (!eventForInterface) { + log.complain("FAILURE 7: ClassUnloadEvent was not received for interface to be unloaded\n" + + " but class no longe presents in the list of all debuggee classes "); + testFailed = true; + } + } + + } catch (Warning e) { + log.display("WARNING: " + e.getMessage()); + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + // disable event request to prevent appearance of further events + if (checkedRequest != null) { + log.display("Disabling event request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debugee terminates and check its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + return PASSED; + } + + static class Warning extends Failure { + Warning(String msg) { + super(msg); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/TestDescription.java new file mode 100644 index 00000000000..7a8699a2b98 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/TestDescription.java @@ -0,0 +1,103 @@ +/* + * 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/ClassUnloadEvent/classSignature/signature001. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.ClassUnloadEvent.classSignature() method. + * The test checks the following assertions: + * - ClassUnloadEvent is always received by debugger + * for unloaded class, interface and array type in target VM, + * - the string returned by classSignature() is not empty and comply + * to JNI-style signature. + * A debugger class - nsk.jdi.ClassUnloadEvent.classSignature.signature001 ; + * a debuggee class - nsk.jdi.ClassUnloadEvent.classSignature.signature001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger forces debugge to load checked classes, creates and + * enables ClassUnloadRequest. Next, debugger forces debuggee to + * unload classes, using memory stressing techique, and waits for + * ClassUnloadEvent. + * If each expected ClassUnloadEvent occurs, debugger tests method + * ClassUnloadEvent.classSignature() and verifies that this event + * is for checked class or interface. + * If no expected ClassUnloadEvent received for WAITTIME period + * but class not found in debuggee, or ClassUnloadEvent received + * but class still in class list, debugger reports an error. + * Test pass even if class leave loaded in debuggee but no + * ClassUnloadEvent received, + * Finally, debugger disables event request to prevent further + * appearing of events, sends debuggee command to quit, clears + * event queue, wait for debugge terminated, and exits. + * The test fails if any of the checks failed. + * PARAMETERS + * 1: String - current test directory. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4463674: TEST_BUG: some JDI tests are timing dependent + * NOTE: testcase for array class is excluded from the test (commented out) + * because of difficulty to provide reliable techique to unload + * such a class. + * Test fixed due to bug: + * 4419078 HS1.4: class isn't unloaded when its classloader is being finalized + * Test fixed due to bug: + * 4642444 TEST_BUG: tests against ClassUnloadEvent fail due to internal ping timeout + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - signature003b and signature003c classes were moved in + * 'loadclass' subdirectory; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for classes to load in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadEvent.classSignature.signature001 + * nsk.jdi.ClassUnloadEvent.classSignature.signature001a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassUnloadEvent.classSignature.signature001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/loadclass/signature001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/loadclass/signature001b.java new file mode 100644 index 00000000000..1535929e1ba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/loadclass/signature001b.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +// this interface will be loaded and then unloaded +package nsk.jdi.ClassUnloadEvent.classSignature; + +public interface signature001b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/loadclass/signature001c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/loadclass/signature001c.java new file mode 100644 index 00000000000..a2642fc406b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001/loadclass/signature001c.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +// this class will be loaded and then unloaded +package nsk.jdi.ClassUnloadEvent.classSignature; + +public class signature001c { + private signature001c[] signature001r; + public void initArray() { + signature001r = new signature001c[] {new signature001c()}; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001a.java new file mode 100644 index 00000000000..bb4f8ec10a5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/classSignature/signature001a.java @@ -0,0 +1,152 @@ +/* + * 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.ClassUnloadEvent.classSignature; + +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.lang.reflect.Method; + +// This class is the debugged application in the test + +// NOTE: Test does not check array class because of difficulty of +// providing reliable technique for unloading such class. +// So all these testcases are commented in the test. + +class signature001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String PREFIX = "nsk.jdi.ClassUnloadEvent.classSignature"; + static final String CHECKED_CLASS = PREFIX + ".signature001c"; + static final String CHECKED_INTFACE = PREFIX + ".signature001b"; + static final String CHECKED_ARRAY = PREFIX + ".signature001c[]"; + + public static void main(String args[]) { + signature001a _signature001a = new signature001a(); + System.exit(JCK_STATUS_BASE + _signature001a.run(args)); + } + + int run (String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // define directory to load class files + String loadClassDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + // notify debugger that debugee is ready + pipe.println(signature001.COMMAND_READY); + + // wait for a command to load checked class + String command = pipe.readln(); + if (!command.equals(signature001.COMMAND_LOAD)) { + System.err.println("TEST BUG: unexpected command: " + command); + return FAILED; + } + + // load checked class for further unloading + ClassUnloader checkedClassUnloader = new ClassUnloader(); + try { + checkedClassUnloader.loadClass(CHECKED_CLASS, loadClassDir); + } catch (Exception ex) { + System.err.println("Unexpected exception while loading " + CHECKED_CLASS + ":"); + System.err.println(ex); + return FAILED; + } + + // load checked interface for further unloading + ClassUnloader checkedInterfaceUnloader = new ClassUnloader(); + try { + checkedInterfaceUnloader.loadClass(CHECKED_INTFACE, loadClassDir); + } catch (Exception ex) { + System.err.println("Unexpected exception while loading " + CHECKED_INTFACE + ":"); + System.err.println(ex); + return FAILED; + } + +/* + // to load array type + Object object1; + try { + object1 = class1.newInstance(); + } catch (Throwable e) { + System.err.println("Cannot create instance of " + CHECKED_CLASS); + System.err.println("Exception/error: " + e.getMessage()); + return FAILED; + } + Method method1; + try { + method1 = class1.getMethod("initArray", null); + method1.invoke(object1, null); + System.out.println("method initArray is invoked"); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + try { + if (!(Class.forName(CHECKED_ARRAY).getClassLoader() instanceof KlassLoader)) { + System.err.println("TEST BUG: Incorrect loader of type" + CHECKED_ARRAY); + return FAILED; + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } +*/ + + // notify debugger that checked class is loaded + pipe.println(signature001.COMMAND_LOADED); + + // turn off pipe pinging + pipe.setPingTimeout(0); + + // wait for a command to unload checked class + command = pipe.readln(); + if (!command.equals(signature001.COMMAND_UNLOAD)) { + System.err.println("TEST BUG: unexpected command: " + command); + return FAILED; + } + + // try to unload checked class + boolean classes_unloaded = checkedClassUnloader.unloadClass() + && checkedInterfaceUnloader.unloadClass(); + + if (!classes_unloaded) { + pipe.println(signature001.COMMAND_LOADED); + } else { + pipe.println(signature001.COMMAND_UNLOADED); + } + + // wait for a command to exit + pipe.println(signature001.COMMAND_UNLOAD); + + command = pipe.readln(); + if (!command.equals(signature001.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001.java new file mode 100644 index 00000000000..d95bf7fa8de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001.java @@ -0,0 +1,129 @@ +/* + * 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.ClassUnloadRequest._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; + +/** + * The test checks up the
    + * - addClassFilter(ReferenceType),
    + * - addClassFilter(String),
    + * - addClassExclusionFilter(String)
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +public class filters001 { + + final static String prefix = "nsk.jdi.ClassUnloadRequest._bounds_."; + private final static String className = "filters001"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType debugeeRef = debugee.classByName(debugeeName); + + display(""); + display(">>>creating ClassUnloadRequest"); + ClassUnloadRequest request = + debugee.getEventRequestManager().createClassUnloadRequest(); + + display(""); + addClassFilter(request, (String )null); + display(""); + addClassExclusionFilter(request, (String )null); + + display(""); + debugee.quit(); + } + + private void addClassFilter(ClassUnloadRequest request, String classPattern) { + + display("addClassFilter :classPattern> null"); + try { + request.addClassFilter(classPattern); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(ClassUnloadRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> null"); + try { + request.addClassExclusionFilter(classPattern); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..c0974086adf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/ClassUnloadRequest/_bounds_/filters001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.ClassUnloadRequest.addClassFilter(String) + * com.sun.jdi.request.ClassUnloadRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up these methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadRequest._bounds_.filters001 + * nsk.jdi.ClassUnloadRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassUnloadRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..50857a06189 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/_bounds_/filters001a.java @@ -0,0 +1,54 @@ +/* + * 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.ClassUnloadRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001.java new file mode 100644 index 00000000000..71e1878e3b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001.java @@ -0,0 +1,239 @@ +/* + * 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.ClassUnloadRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.io.*; +import java.util.*; + +/** + * Debugger requests ClassUnloadEvent and sets class filter by calling + * addClassExclusionFilter with pattern that begins with '*' and ends + * with '*'. + * + *

    + * To excite a class loading/unloading onto debugee, debugeer uses + * nsk.share.ClassUnloader and performs it twice :
    + * 1. for pattern that ends with '*'
    + * 2. for pattern that begins with '*'
    + * It is expected:
    + * - in case no events occured, test is considered as passed
    + * - in case classunload event occurs, debugger checks class name to do not match to + * pattern. + */ +public class exclfilter001 { + + final static String prefix = "nsk.jdi.ClassUnloadRequest.addClassExclusionFilter."; + private final static String className = "exclfilter001"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + // signals to control working of debugee + public final static String SGNL_LOAD = "load"; + public final static String SGNL_UNLOAD = "unload"; + public final static String SGNL_BREAK = "break"; + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static int eventWaitTime; + + String[] patterns = { + prefix + "Sub*", + "*.Superexclfilter002b" + }; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exclfilter001 tstObj = new exclfilter001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + eventWaitTime = argHandler.getWaitTime() * 60000; + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + tstObj.execTest(); + + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ClassUnloadRequest request; + + // when there are no class unload events, test should be considered as PASSED + exitStatus = Consts.TEST_PASSED; + + for (int i = 0; i < patterns.length; i++) { + // loading of tested classes + display("sending " + SGNL_LOAD); + debugee.sendSignal(SGNL_LOAD); + debugee.receiveExpectedSignal(SGNL_READY); + + // unloading of tested classes + display("------------------------------------------------"); + request = requestClassUnload(patterns[i]); + display("================================================"); + + display("sending " + SGNL_UNLOAD); + debugee.sendSignal(SGNL_UNLOAD); + debugee.receiveExpectedSignal(SGNL_READY); + + receiveEvents(eventWaitTime, patterns[i]); + + display(""); + debugee.getEventRequestManager().deleteEventRequest(request); + } + + display("sending " + SGNL_BREAK); + debugee.sendSignal(SGNL_BREAK); + debugee.quit(); + + } + + private ClassUnloadRequest requestClassUnload(String filter) { + display(">>>creating ClassUnloadRequest"); + ClassUnloadRequest request = + debugee.getEventRequestManager().createClassUnloadRequest(); + display("adding exclusion filter :"); + display(" <" + filter + ">"); + + request.addClassExclusionFilter(filter); + request.enable(); + + return request; + } + + private void receiveEvents(int waitTime, String pattern) { + EventSet eventSet = null; + Event event; + int totalTime = waitTime; + long begin, delta; + int count = 0; + boolean exit = false; + + try { + begin = System.currentTimeMillis(); + eventSet = debugee.VM().eventQueue().remove(totalTime); + delta = System.currentTimeMillis() - begin; + totalTime -= delta; + while (eventSet != null) { + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + if (event instanceof ClassUnloadEvent) { + if (!analyzeEvents((ClassUnloadEvent )event, pattern)) { + display("exiting..."); + exit = true; + break; + } + count++; + } else if (event instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received"); + } + } + if (totalTime <= 0 || exit) { + break; + } + debugee.resume(); + begin = System.currentTimeMillis(); + eventSet = debugee.VM().eventQueue().remove(totalTime); + delta = System.currentTimeMillis() - begin; + totalTime -= delta; + } + } catch(InterruptedException e) { + throw new Failure(e); + } catch(VMDisconnectedException e) { + throw new Failure(e); + } + + if (count==0) { + display(""); + display("WARNING: No events were arrived"); + display(""); + } + + debugee.resume(); + } + + private boolean analyzeEvents(ClassUnloadEvent event, String pattern) { + String className; + + className = event.className(); + + if (checkMatching(className, pattern)) { + complain("***class was excluded***\n " + className); + display(""); + exitStatus = Consts.TEST_FAILED; + return false; + } + + display("OK--> " + className); + + return true; + } + + private boolean checkMatching(String className, String pattern) { + + String tmp; + int length = pattern.length(); + + // pattern ends with '*' + if (pattern.charAt(length - 1) == '*') { + tmp = pattern.substring(0, length -1); + return className.indexOf(tmp) == 0; + + // pattern begins with '*' + } else if (pattern.charAt(0) == '*') { + tmp = pattern.substring(1); + return className.endsWith(tmp); + + // unsupported pattern + } else new TestBug("Wrong pattern <" + pattern + ">"); + + return false; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/TestDescription.java new file mode 100644 index 00000000000..9cfba1c6dc0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ClassUnloadRequest/addClassExclusionFilter/exclfilter001. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method + * com.sun.jdi.ClassUnloadRequest.addClassExclusionFilter(String) + * on the following assertion: + * Restricts the events generated by this request to the unloading + * of reference types whose name does not match a restricted regular + * expression. + * The cases to test include a pattern that begins with '*' and ends with '*'. + * The test works as follows: + * The debugger program - + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter001; + * the debuggee program - + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter001a. + * Using nsk.jdi.share classes, the debugger gets the debuggee running on + * another JavaVM and controls the classes loading/unloading on debugee. + * Each event is checked class name, which generates this event, to do not + * match to defined filter. + * When class name matches to defined filter, the test fails and produces + * a corresponding error message(s). + * Note: In case no events occured, test is considered as passed. + * COMMENTS: + * Fixed due to the bug 4677256 + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - all classes to be loaded by ClassUnloader were separated and + * moved into 'loadclass' subdirectory; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for classes to load class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - throwing Failure exception on VMDisconnect is used in event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter001 + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter001a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm/timeout=420 PropertyResolvingWrapper + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/loadclass/Superexclfilter001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/loadclass/Superexclfilter001b.java new file mode 100644 index 00000000000..dc4b986fb14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001/loadclass/Superexclfilter001b.java @@ -0,0 +1,66 @@ +/* + * 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.ClassUnloadRequest.addClassExclusionFilter; + +// These classes will be loaded by ClassUnloader + +class Superexclfilter001b { + static String name = "Superexclfilter001b"; + +} + +class Subexclfilter0011 extends Superexclfilter001b { + static String name = "Subexclfilter0011"; + +} + +class Subexclfilter0021 extends Superexclfilter001b { + static String name = "Subexclfilter0021"; + +} + +class Subexclfilter0031 extends Superexclfilter001b { + static String name = "Subexclfilter0031"; + +} + +class Superexclfilter002b { + static String name = "Superexclfilter002b"; + +} + +class Subexclfilter0012 extends Superexclfilter002b { + static String name = "Subexclfilter0012"; + +} + +class Subexclfilter0022 extends Superexclfilter002b { + static String name = "Subexclfilter0022"; + +} + +class Subexclfilter0032 extends Superexclfilter002b { + static String name = "Subexclfilter0032"; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001a.java new file mode 100644 index 00000000000..77c2ce35969 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter001a.java @@ -0,0 +1,119 @@ +/* + * 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.ClassUnloadRequest.addClassExclusionFilter; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * exclfilter001a is deugee's part of the test. + * It contains the descriptions classes, which are used by debugger's part of the test. + */ +public class exclfilter001a { + + static public String[] testedClasses = { + "Superexclfilter001b", + "Subexclfilter0011", + "Subexclfilter0021", + "Subexclfilter0031", + "Superexclfilter002b", + "Subexclfilter0012", + "Subexclfilter0022", + "Subexclfilter0032" + }; + + static public Log log = null; + static public IOPipe pipe = null; + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + pipe.println(exclfilter001.SGNL_READY); + + // define directory to class files + String classDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader unloader = null; + String instr = pipe.readln(); + + while (!instr.equals(exclfilter001.SGNL_BREAK)) { + + log.display("<" + instr + ">" + " arrived"); + if (instr==null) { + break; + } + + // loading of tested classes + if (instr.equals(exclfilter001.SGNL_LOAD)) { + unloader = loadClasses(classDir); + + // unloading of tested classes + } else if (instr.equals(exclfilter001.SGNL_UNLOAD)) { + + unloadClasses(unloader); + } + pipe.println(exclfilter001.SGNL_READY); + + instr = pipe.readln(); + } + + instr = pipe.readln(); + log.display("<" + instr + ">" + " arrived"); + + if (instr != null) { + if (instr.equals(exclfilter001.SGNL_QUIT)) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private static ClassUnloader loadClasses(String classDir) { + ClassUnloader unloader = new ClassUnloader(); + for (int i = 0; i < testedClasses.length; i++) { + try { + unloader.loadClass(exclfilter001.prefix + testedClasses[i], classDir); + } catch(ClassNotFoundException e) { + log.complain("DEBUGEE> class " + testedClasses[i] + " not found"); + log.complain(" " + e); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + return unloader; + } + + private static void unloadClasses(ClassUnloader unloader) { + unloader.unloadClass(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002.java new file mode 100644 index 00000000000..e4246e271a3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002.java @@ -0,0 +1,122 @@ +/* + * 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.ClassUnloadRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.io.*; + +/** + * Debugger checks up assertion:
    + * InvalidRequestStateException - if this request is currently + * enabled or has been deleted.
    + * Debugger performs the following steps:
    + * - creates a ClassUnloadRequests and enables it;
    + * - invokes the method addClassExclusionFilter().
    + * It is expected, InvalidRequestStateException will be thrown;
    + * - deletes this request and invokes the method addClassExclusionFilter()
    + * Once again it is expected, InvalidRequestStateException will be thrown;
    + */ +public class exclfilter002 { + + final static String prefix = "nsk.jdi.ClassUnloadRequest.addClassExclusionFilter."; + private final static String className = "exclfilter002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static String pattern = prefix + "Sub*"; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exclfilter002 tstObj = new exclfilter002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + tstObj.execTest(); + + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + exitStatus = Consts.TEST_PASSED; + + EventRequestManager evm = debugee.getEventRequestManager(); + + display(">>>creating ClassUnloadRequest"); + ClassUnloadRequest request = evm.createClassUnloadRequest(); + + display("enabled request--------------------"); + display(">>>enabling of the created request"); + request.enable(); + addExclusionFilter(request); + + display("deleted request--------------------"); + display(">>>disabling of the created request"); + request.disable(); + display(">>>deleting of the created request"); + evm.deleteEventRequest(request); + addExclusionFilter(request); + + debugee.quit(); + } + + private void addExclusionFilter(ClassUnloadRequest request) { + display(">>>adding an exclusion class filter"); + display(""); + try { + request.addClassExclusionFilter(pattern); + } catch(InvalidRequestStateException e) { + display(">>>>>EXPECTED InvalidRequestStateException"); + } catch(Exception e) { + complain("******UNEXPECTED " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002/TestDescription.java new file mode 100644 index 00000000000..5411f62f904 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002/TestDescription.java @@ -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/ClassUnloadRequest/addClassExclusionFilter/exclfilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method + * com.sun.jdi.ClassUnloadRequest.addClassExclusionFilter(String) + * on the following assertion: + * This method throws InvalidRequestStateException - if this request + * is currently enabled or has been deleted. + * The test works as follows: + * The debugger program - + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter002; + * the debuggee program - + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter002a. + * Using nsk.jdi.share classes, the debugger gets the debuggee running on + * another JavaVM and attempts to add filter for: + * 1. the disabled request; + * 2. the deleted request. + * When InvalidRequestStateException is not thorwn, the test fails. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter002 + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002a.java new file mode 100644 index 00000000000..c49eaf27a5c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassExclusionFilter/exclfilter002a.java @@ -0,0 +1,56 @@ +/* + * 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.ClassUnloadRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * exclfilter002a is deugee's part of the test. + */ +public class exclfilter002a { + + static public Log log = null; + static public IOPipe pipe = null; + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001.java new file mode 100644 index 00000000000..8da9a0ecb14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001.java @@ -0,0 +1,238 @@ +/* + * 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.ClassUnloadRequest.addClassFilter; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.io.*; +import java.util.*; + +/** + * Debugger requests ClassUnloadEvent and sets class filter by calling + * addClassFilter with pattern that begins with '*' and ends with '*'. + * + *

    + * To excite a class loading/unloading onto debugee, debugeer uses + * nsk.share.ClassUnloader and performs it twice :
    + * 1. for pattern that ends with '*'
    + * 2. for pattern that begins with '*'
    + * It is expected:
    + * - in case no events occured, test is considered as passed
    + * - in case classunload event occurs, debugger checks class name to match to + * pattern. + */ +public class filter001 { + + final static String prefix = "nsk.jdi.ClassUnloadRequest.addClassFilter."; + private final static String className = "filter001"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + // signals to control working of debugee + public final static String SGNL_LOAD = "load"; + public final static String SGNL_UNLOAD = "unload"; + public final static String SGNL_BREAK = "break"; + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static int eventWaitTime; + + String[] patterns = { + prefix + "Sub*", + "*.Superfilter002b" + }; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + filter001 tstObj = new filter001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + eventWaitTime = argHandler.getWaitTime() * 60000; + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + tstObj.execTest(); + + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ClassUnloadRequest request; + + // when there are no class unload events, test should be considered as PASSED + exitStatus = Consts.TEST_PASSED; + + for (int i = 0; i < patterns.length; i++) { + // loading of tested classes + display("sending " + SGNL_LOAD); + debugee.sendSignal(SGNL_LOAD); + debugee.receiveExpectedSignal(SGNL_READY); + + // unloading of tested classes + display("------------------------------------------------"); + request = requestClassUnload(patterns[i]); + display("================================================"); + + display("sending " + SGNL_UNLOAD); + debugee.sendSignal(SGNL_UNLOAD); + debugee.receiveExpectedSignal(SGNL_READY); + + receiveEvents(eventWaitTime, patterns[i]); + + display(""); + debugee.getEventRequestManager().deleteEventRequest(request); + } + + display("sending " + SGNL_BREAK); + debugee.sendSignal(SGNL_BREAK); + debugee.quit(); + + } + + private ClassUnloadRequest requestClassUnload(String filter) { + display(">>>creating ClassUnloadRequest"); + ClassUnloadRequest request = + debugee.getEventRequestManager().createClassUnloadRequest(); + display("adding filter :"); + display(" <" + filter + ">"); + + request.addClassFilter(filter); + request.enable(); + + return request; + } + + private void receiveEvents(int waitTime, String pattern) { + EventSet eventSet = null; + Event event; + int totalTime = waitTime; + long begin, delta; + int count = 0; + boolean exit = false; + + try { + begin = System.currentTimeMillis(); + eventSet = debugee.VM().eventQueue().remove(totalTime); + delta = System.currentTimeMillis() - begin; + totalTime -= delta; + while (eventSet != null) { + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + if (event instanceof ClassUnloadEvent) { + if (!analyzeEvents((ClassUnloadEvent )event, pattern)) { + display("exiting..."); + exit = true; + break; + } + count++; + } else if (event instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received"); + } + } + if (totalTime <= 0 || exit) { + break; + } + debugee.resume(); + begin = System.currentTimeMillis(); + eventSet = debugee.VM().eventQueue().remove(totalTime); + delta = System.currentTimeMillis() - begin; + totalTime -= delta; + } + } catch(InterruptedException e) { + throw new Failure(e); + } catch(VMDisconnectedException e) { + throw new Failure(e); + } + + if (count==0) { + display(""); + display("WARNING: No events were arrived"); + display(""); + } + + debugee.resume(); + } + + private boolean analyzeEvents(ClassUnloadEvent event, String pattern) { + String className; + + className = event.className(); + + if (!checkMatching(className, pattern)) { + complain("***no matching***\n " + className); + display(""); + exitStatus = Consts.TEST_FAILED; + return false; + } + + display("OK--> " + className); + + return true; + } + + private boolean checkMatching(String className, String pattern) { + + String tmp; + int length = pattern.length(); + + // pattern ends with '*' + if (pattern.charAt(length - 1) == '*') { + tmp = pattern.substring(0, length -1); + return className.indexOf(tmp) == 0; + + // pattern begins with '*' + } else if (pattern.charAt(0) == '*') { + tmp = pattern.substring(1); + return className.endsWith(tmp); + + // unsupported pattern + } else new TestBug("Wrong pattern <" + pattern + ">"); + + return false; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..eebba3094bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/TestDescription.java @@ -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/ClassUnloadRequest/addClassFilter/filter001. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method + * com.sun.jdi.ClassUnloadRequest.addClassFilter(String) + * on the following assertion: + * Restricts the events generated by this request to the unloading + * of reference types whose name does not match a restricted regular + * expression. + * The cases to test include a pattern that begins with '*' and ends with '*'. + * The test works as follows: + * The debugger program - nsk.jdi.ClassUnloadRequest.addClassFilter.filter001; + * the debuggee program - nsk.jdi.ClassUnloadRequest.addClassFilter.filter001a. + * Using nsk.jdi.share classes, the debugger gets the debuggee running on + * another JavaVM and controls the classes loading/unloading on debugee. + * Each event is checked class name, which generates this event, to do + * match to defined filter. + * When class name does not match to defined filter, the test fails and + * produces a corresponding error message(s). + * Note: In case no events occured, test is considered as passed. + * COMMENTS: + * Fixed due to the bug 4677256 + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - all classes to be loaded by ClassUnloader were separated and + * moved into 'loadclass' subdirectory; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for classes to load class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - throwing Failure exception on VMDisconnect is used in event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadRequest.addClassFilter.filter001 + * nsk.jdi.ClassUnloadRequest.addClassFilter.filter001a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm/timeout=420 PropertyResolvingWrapper + * nsk.jdi.ClassUnloadRequest.addClassFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/loadclass/Superfilter001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/loadclass/Superfilter001b.java new file mode 100644 index 00000000000..9f6c574cf26 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001/loadclass/Superfilter001b.java @@ -0,0 +1,66 @@ +/* + * 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.ClassUnloadRequest.addClassFilter; + +// These classes will be loaded by ClassUnloader + +class Superfilter001b { + static String name = "Superfilter001b"; + +} + +class Subfilter0011 extends Superfilter001b { + static String name = "Subfilter0011"; + +} + +class Subfilter0021 extends Superfilter001b { + static String name = "Subfilter0021"; + +} + +class Subfilter0031 extends Superfilter001b { + static String name = "Subfilter0031"; + +} + +class Superfilter002b { + static String name = "Superfilter002b"; + +} + +class Subfilter0012 extends Superfilter002b { + static String name = "Subfilter0012"; + +} + +class Subfilter0022 extends Superfilter002b { + static String name = "Subfilter0022"; + +} + +class Subfilter0032 extends Superfilter002b { + static String name = "Subfilter0032"; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001a.java new file mode 100644 index 00000000000..c79bb96c48c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter001a.java @@ -0,0 +1,119 @@ +/* + * 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.ClassUnloadRequest.addClassFilter; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filter001a is deugee's part of the test. + * It contains the descriptions classes, which are used by debugger's part of the test. + */ +public class filter001a { + + static public String[] testedClasses = { + "Superfilter001b", + "Subfilter0011", + "Subfilter0021", + "Subfilter0031", + "Superfilter002b", + "Subfilter0012", + "Subfilter0022", + "Subfilter0032" + }; + + static public Log log = null; + static public IOPipe pipe = null; + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + pipe.println(filter001.SGNL_READY); + + // define directory to load class files + String classDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader unloader = null; + String instr = pipe.readln(); + + while (!instr.equals(filter001.SGNL_BREAK)) { + + log.display("<" + instr + ">" + " arrived"); + if (instr==null) { + break; + } + + // loading of tested classes + if (instr.equals(filter001.SGNL_LOAD)) { + unloader = loadClasses(classDir); + + // unloading of tested classes + } else if (instr.equals(filter001.SGNL_UNLOAD)) { + + unloadClasses(unloader); + } + pipe.println(filter001.SGNL_READY); + + instr = pipe.readln(); + } + + instr = pipe.readln(); + log.display("<" + instr + ">" + " arrived"); + + if (instr != null) { + if (instr.equals(filter001.SGNL_QUIT)) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private static ClassUnloader loadClasses(String classDir) { + ClassUnloader unloader = new ClassUnloader(); + for (int i = 0; i < testedClasses.length; i++) { + try { + unloader.loadClass(filter001.prefix + testedClasses[i], classDir); + } catch(ClassNotFoundException e) { + log.complain("DEBUGEE> class " + testedClasses[i] + " not found"); + log.complain(" " + e); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + return unloader; + } + + private static void unloadClasses(ClassUnloader unloader) { + unloader.unloadClass(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002.java new file mode 100644 index 00000000000..1373239735c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002.java @@ -0,0 +1,121 @@ +/* + * 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.ClassUnloadRequest.addClassFilter; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.io.*; + +/** + * Debugger checks up assertion:
    + * InvalidRequestStateException - if this request is currently + * enabled or has been deleted.
    + * Debugger performs the following steps:
    + * - creates a ClassUnloadRequests and enables it;
    + * - invokes the method addClassFilter().
    + * It is expected, InvalidRequestStateException will be thrown;
    + * - deletes this request and invokes the method addClassFilter()
    + * Once again it is expected, InvalidRequestStateException will be thrown;
    + */ +public class filter002 { + + final static String prefix = "nsk.jdi.ClassUnloadRequest.addClassFilter."; + private final static String className = "filter002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static String pattern = prefix + "Sub*"; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + filter002 tstObj = new filter002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + tstObj.execTest(); + + display("execTest finished. exitStatus = " + exitStatus); + + return tstObj.exitStatus; + } + + private void execTest() { + + exitStatus = Consts.TEST_PASSED; + + EventRequestManager evm = debugee.getEventRequestManager(); + + display(">>>creating ClassUnloadRequest"); + ClassUnloadRequest request = evm.createClassUnloadRequest(); + + display("enabled request--------------------"); + display(">>>enabling of the created request"); + request.enable(); + addClassFilter(request); + + display("deleted request--------------------"); + display(">>>disabling of the created request"); + request.disable(); + display(">>>deleting of the created request"); + evm.deleteEventRequest(request); + addClassFilter(request); + + debugee.quit(); + } + + private void addClassFilter(ClassUnloadRequest request) { + display(">>>adding a class filter"); + display(""); + try { + request.addClassFilter(pattern); + } catch(InvalidRequestStateException e) { + display(">>>>>EXPECTED InvalidRequestStateException"); + } catch(Exception e) { + complain("******UNEXPECTED " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..570d11c0c7e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002/TestDescription.java @@ -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/ClassUnloadRequest/addClassFilter/filter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method + * com.sun.jdi.ClassUnloadRequest.addClassFilter(String) + * on the following assertion: + * This method throws InvalidRequestStateException - if this request + * is currently enabled or has been deleted. + * The test works as follows: + * The debugger program - + * nsk.jdi.ClassUnloadRequest.addClassFilter.filter002; + * the debuggee program - + * nsk.jdi.ClassUnloadRequest.addClassFilter.filter002a. + * Using nsk.jdi.share classes, the debugger gets the debuggee running on + * another JavaVM and attempts to add filter for: + * 1. the disabled request; + * 2. the deleted request. + * When InvalidRequestStateException is not thorwn, the test fails. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ClassUnloadRequest.addClassFilter.filter002 + * nsk.jdi.ClassUnloadRequest.addClassFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ClassUnloadRequest.addClassFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002a.java new file mode 100644 index 00000000000..9194ad224f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadRequest/addClassFilter/filter002a.java @@ -0,0 +1,56 @@ +/* + * 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.ClassUnloadRequest.addClassFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filter002a is deugee's part of the test. + */ +public class filter002a { + + static public Log log = null; + static public IOPipe pipe = null; + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001.java new file mode 100644 index 00000000000..f44a4e7fd51 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001.java @@ -0,0 +1,175 @@ +/* + * 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.Connector._bounds_; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; + +import java.io.*; +import java.util.*; + +import nsk.share.*; +import nsk.share.jdi.*; + + +/** + * The test checks up the methods:
    + * 1. com.sun.jdi.connect.AttachingConnector.attach(Map)
    + * 2. com.sun.jdi.connect.LaunchingConnector.launch(Map)
    + * 3. com.sun.jdi.connect.ListeningConnector.startListening(Map)
    + * 4. com.sun.jdi.connect.ListeningConnector.stopListening(Map)
    + * 5. com.sun.jdi.connect.ListeningConnector.accept(Map)
    + * to throw NullPointerException for null value of arguments.
    + */ +public class bounds001 { + + public static int exitStatus; + private static Log log; + + public static void display(String msg) { + log.display(msg); + } + + public static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String args[]) { + System.exit(run(args,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[], PrintStream out) { + return new bounds001(args,out).run(); + } + + private bounds001(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + } + + private int run() { + + exitStatus = Consts.TEST_PASSED; + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List attachConnectors; + List launchConnectors; + List listConnectors; + AttachingConnector attachc; + LaunchingConnector launchc; + ListeningConnector listc; + Map arg = null; + for (int j = 0; j < 2; j++) { + if (j == 1 ) { + arg = new HashMap(); + display("arguments - Map of "); + display("-------------------------"); + } else { + display("arguments - "); + display("------------------"); + } + + display("Attaching connectors:"); + attachConnectors = vmm.attachingConnectors(); + for (int i = 0; i < attachConnectors.size(); i++) { + attachc = (AttachingConnector )attachConnectors.get(i); + display("\t" + attachc.name() + ": invoking attach(null)"); + try { + attachc.attach(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("\tExpected " + e); + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + } + + // launching connector + display("Launching connectors:"); + launchConnectors = vmm.launchingConnectors(); + for (int i = 0; i < launchConnectors.size(); i++) { + launchc = (LaunchingConnector )launchConnectors.get(i); + display("\t" + launchc.name() + ": invoking launch(null)"); + try { + launchc.launch(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("\tExpected " + e); + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + } + + display("Listening connectors:"); + listConnectors = vmm.listeningConnectors(); + for (int i = 0; i < listConnectors.size(); i++) { + listc = (ListeningConnector )listConnectors.get(i); + display("\t" + listc.name() + ": invoking startListening(null)"); + try { + listc.startListening(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("\tExpected " + e); + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("\t" + listc.name() + ": invoking stopListening(null)"); + try { + listc.stopListening(null); + } catch (NullPointerException e) { + display("\tExpected " + e); + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("\t" + listc.name() + ": invoking accept(null)"); + try { + listc.accept(null); + } catch (NullPointerException e) { + display("\tExpected " + e); + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + } + + return exitStatus; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001/TestDescription.java new file mode 100644 index 00000000000..468a4d3f10e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001/TestDescription.java @@ -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/Connector/_bounds_/bounds001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods: + * 1. com.sun.jdi.connect.AttachingConnector.attach(Map) + * 2. com.sun.jdi.connect.LaunchingConnector.launch(Map) + * 3. com.sun.jdi.connect.ListeningConnector.startListening(Map) + * 4. com.sun.jdi.connect.ListeningConnector.stopListening(Map) + * 5. com.sun.jdi.connect.ListeningConnector.accept(Map) + * to throw NullPointerException for value of arguments. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector._bounds_.bounds001 + * nsk.jdi.Connector._bounds_.bounds001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector._bounds_.bounds001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001a.java new file mode 100644 index 00000000000..749b598c6ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/_bounds_/bounds001a.java @@ -0,0 +1,32 @@ +/* + * 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.Connector._bounds_; + +import nsk.share.*; + +public class bounds001a { + public static void main(String args[]) { + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001.java new file mode 100644 index 00000000000..d2fc7a93870 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001.java @@ -0,0 +1,80 @@ +/* + * 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.Connector.defaultArguments; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.Connector; +import java.io.PrintStream; +import java.util.*; + +/** + * Test for the control of + * + * Interface: com.sun.jdi.connect.Connector + * Method: public java.util.Map defaultArguments() + * Assertion: "Returns the arguments accepted by this Connector + * and their default values." + */ + +public class defaultArguments001 { + 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(); + if (cdfltArgmnts == null) { + log.complain("FAILURE: connector with empty default " + + "arguments map is found!:"); + log.complain(" Name: " + c.name()); + return 2; + } + log.display("Next (" + i + ") connector's arguments is: " + + cdfltArgmnts); + }; + log.display("Test PASSED!"); + return 0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001/TestDescription.java new file mode 100644 index 00000000000..20cf04d4237 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001/TestDescription.java @@ -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/Connector/defaultArguments/defaultArguments001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * ================================================ + * DESCRIPTION: + * The test is aimed on the control of: + * Interface: com.sun.jdi.connect.Connector + * Method: public java.util.Map defaultArguments() + * Assertion: "Returns the arguments accepted by this Connector + * and their default values." + * ================================================ + * COMMENTS: + * ================================================ + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.defaultArguments.defaultArguments001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.defaultArguments.defaultArguments001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002.java new file mode 100644 index 00000000000..1724dc9caa5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002.java @@ -0,0 +1,113 @@ +/* + * 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.Connector.defaultArguments; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.Connector; +import java.io.PrintStream; +import java.util.*; + +/** + * Test for the control of + * + * Interface: com.sun.jdi.connect.Connector + * Method: public java.util.Map defaultArguments() + * Assertion: "The keys of the returned map are string + * argument names." + */ + +public class defaultArguments002 { + + 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(); + if (cdfltArgmnts.size() < 1) { + log.complain("FAILURE: connector with empty list of " + + "default arguments is found!:"); + log.complain(" Name: " + c.name()); + return 2; + } + + Set ks = cdfltArgmnts.keySet(); + if (ks.isEmpty()) { + log.complain("FAILURE: empty argument name set is found " + + "for " + c.name() + " connector!"); + return 2; + } + + log.display(c.name() + "connector arguments: "); + + Iterator argi = ks.iterator(); + for (int j = 1; argi.hasNext(); j++) { + Object ob = argi.next(); + if (!(ob instanceof String)) { + log.complain("FAILURE: " + j + "-argument key must be " + + "of String type!"); + return 2; + } + String argkey = (String) ob; + + if (argkey == null) { + log.complain("FAILURE: argument name is null " + + "for " + c.name() + " connector."); + return 2; + } + + if (argkey.length() == 0) { + log.complain("FAILURE: empty argument name is found " + + "for " + c.name() + " connector!"); + return 2; + } + + log.display("Next (" + j + ") argument's name is: " + argkey); + }; + }; + log.display("Test PASSED!"); + return 0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002/TestDescription.java new file mode 100644 index 00000000000..74b5446acc0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002/TestDescription.java @@ -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/Connector/defaultArguments/defaultArguments002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * ================================================ + * DESCRIPTION: + * The test is aimed on the control of: + * Interface: com.sun.jdi.connect.Connector + * Method: public java.util.Map defaultArguments() + * Assertion: "The keys of the returned map are string + * argument names." + * ================================================ + * COMMENTS: + * ================================================ + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.defaultArguments.defaultArguments002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.defaultArguments.defaultArguments002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003.java new file mode 100644 index 00000000000..5710f9b5eb6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003.java @@ -0,0 +1,112 @@ +/* + * 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.Connector.defaultArguments; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.Connector; +import java.io.PrintStream; +import java.util.*; + +/** + * Test for the control of + * + * Interface: com.sun.jdi.connect.Connector + * Method: public java.util.Map defaultArguments() + * Assertion: "The values are Connector.Argument containing information + * about the argument and its default value." + */ + +public class defaultArguments003 { + 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() < 1) { + 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(); + if (cdfltArgmnts.size() < 1) { + log.complain("FAILURE: connector with empty list of " + + "default arguments is found!:"); + log.complain(" Name: " + c.name()); + return 2; + } + + Set ks = cdfltArgmnts.keySet(); + if (ks.isEmpty()) { + log.complain("FAILURE: empty argument name set is found " + + "for " + c.name() + " connector!"); + return 2; + } + + log.display(c.name() + "connector arguments values: "); + + Iterator argi = ks.iterator(); + for (int j = 1; argi.hasNext(); j++) { + String argkey = (String) argi.next(); + Object ob = cdfltArgmnts.get((Object) argkey); + if (!(ob instanceof Connector.Argument)) { + log.complain("FAILURE: " + j + "-argument value " + + "must be of Connector.Argument type!"); + return 2; + } + Connector.Argument argval = + (Connector.Argument)cdfltArgmnts.get((Object) argkey); + if (argval == null) { + log.complain("FAILURE: empty argument value is " + + "found for " + c.name() + " connector!"); + return 2; + } + + if (argval == null) { + log.complain("FAILURE: empty argument value is " + + "found for " + c.name() + " connector!"); + return 2; + } + + log.display("Next (" + j + ") argument's value is: " + + argval); + }; + }; + log.display("Test PASSED!"); + return 0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003/TestDescription.java new file mode 100644 index 00000000000..63696019e44 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003/TestDescription.java @@ -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/Connector/defaultArguments/defaultArguments003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * ================================================ + * DESCRIPTION: + * The test is aimed on the control of: + * Interface: com.sun.jdi.connect.Connector + * Method: public java.util.Map defaultArguments() + * Assertion: "The keys of the returned map are string + * argument names." + * ================================================ + * COMMENTS: + * ================================================ + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.defaultArguments.defaultArguments003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.defaultArguments.defaultArguments003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/description/description001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/description/description001.java new file mode 100644 index 00000000000..21da4644607 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/description/description001.java @@ -0,0 +1,89 @@ +/* + * 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.Connector.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.PrintStream; +import java.util.*; + +/** + * Test for the control of + * + * Interface: com.sun.jdi.connect.Connector + * Method: public java.lang.String description() + * Assertion: "Returns a human-readable description of this + * connector of this connector 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(); + String cdsc = c.description(); + + if (cdsc == null) { + log.complain("FAILURE: connector description is null."); + log.complain(" Name: " + c.name()); + log.complain(" Transport: " + c.transport().name()); + return 2; + } + + if (cdsc.length() == 0) { + log.complain("FAILURE: connector with empty-description " + + "is found."); + log.complain(" Name: " + c.name()); + log.complain(" Transport: " + c.transport().name()); + return 2; + } + log.display("Next (" + i + ") connector's description is: " + + cdsc); + }; + log.display("Test PASSED!"); + return 0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/description/description001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/description/description001/TestDescription.java new file mode 100644 index 00000000000..a9ac5306dc8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/description/description001/TestDescription.java @@ -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/Connector/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 + * Method: public java.lang.String description() + * Assertion: "Returns a human-readable description of this + * connector of this connector and its purpose." + * ================================================ + * COMMENTS: + * ================================================ + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.description.description001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.description.description001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001.java new file mode 100644 index 00000000000..a8e3cfb8576 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001.java @@ -0,0 +1,86 @@ +/* + * 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.Connector.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.PrintStream; +import java.util.*; + +/** + * Test for control of + * + * Interface: com.sun.jdi.connect.Connector + * Method: public java.lang.String name() + * Assertion: "Returns a short identifier for the connector." + */ + +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(); + String cnm = c.name(); + if (cnm == null) { + log.complain("FAILURE: connector name is null."); + log.complain(" Description: " + c.description()); + log.complain(" Transport: " + c.transport().name()); + return 2; + } + + if (cnm.length() == 0) { + log.complain("FAILURE: connector with empty-name is found."); + log.complain(" Description: " + c.description()); + log.complain(" Transport: " + c.transport().name()); + return 2; + } + + log.display("Next (" + i + ") connector's name is: " + cnm); + }; + log.display("Test PASSED!"); + return 0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001/TestDescription.java new file mode 100644 index 00000000000..5115c40dfe4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/name/name001/TestDescription.java @@ -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/Connector/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * ================================================ + * DESCRIPTION: + * The test is aimed on control of: + * Interface: com.sun.jdi.connect.Connector + * Method: public java.lang.String name() + * Assertion: "Returns a short identifier for the connector." + * ================================================ + * COMMENTS: + * ================================================ + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.name.name001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/toString/tostring001.java new file mode 100644 index 00000000000..a1aa360f1e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/toString/tostring001.java @@ -0,0 +1,112 @@ +/* + * 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.Connector.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class tostring001 { + + //------------------------------------------------------- immutable common fields + + private static int exitStatus; + private static ArgumentHandler argHandler; + private static Log log; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.dummy.dummy"; + private final static String className = "tostring001"; + private final static String debuggerName = prefix + className; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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); + } + + + //------------------------------------------------------ mutable common method + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + List acl = vmm.allConnectors(); + if (acl.size() > 0) { + display("Number of all known JDI connectors: " + acl.size()); + } else { + complain("No JDI connectors found!"); + return Consts.TEST_FAILED; + } + + Iterator aci = acl.iterator(); + for (int i = 1; aci.hasNext(); i++) { + Connector c = (Connector) aci.next(); + String cnm = c.toString(); + if (cnm == null) { + complain("toString() method returns null for Connector #" + i + " : "); + complain(" Description: " + c.description()); + complain(" Transport: " + c.transport().name()); + exitStatus = Consts.TEST_FAILED; + } else if (cnm.length() == 0) { + complain("toString() method returns empty string for Connector #" + i + " : "); + complain(" Description: " + c.description()); + complain(" Transport: " + c.transport().name()); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() method returns for Connector #" + i + " : " + cnm); + } + }; + + return exitStatus; + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..573afc87cfb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/toString/tostring001/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/Connector/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.Connector interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for every + * connector returned in the VirtualMachineManager.allConnectors() list. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for Connector + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.toString.tostring001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/transport/transport001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/transport/transport001.java new file mode 100644 index 00000000000..49386ec9d92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/transport/transport001.java @@ -0,0 +1,80 @@ +/* + * 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.Connector.transport; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.PrintStream; +import java.util.*; + +/** + * Test for the control of + * + * Interface: com.sun.jdi.connect.Connector + * Method: public Transport transport() + * Assertion: "Returns the transport mechanism used by this + * connector to establish connections with a target VM." + */ + +public class transport001 { + 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(); + Transport ctrnsprt = c.transport(); + if (ctrnsprt == null) { + log.complain("FAILURE: connector with empty-transport " + + "is found!:"); + log.complain(" Name: " + c.name()); + return 2; + } + log.display("Next (" + i + ") connector's transport is: " + + ctrnsprt); + }; + log.display("Test PASSED!"); + return 0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/transport/transport001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/transport/transport001/TestDescription.java new file mode 100644 index 00000000000..3393737f7cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Connector/transport/transport001/TestDescription.java @@ -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/Connector/transport/transport001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * ================================================ + * DESCRIPTION: + * The test is aimed on the control of: + * Interface: com.sun.jdi.connect.Connector + * Method: public Transport transport() + * Assertion: "Returns the transport mechanism used by this + * connector to establish connections with a target VM." + * ================================================ + * COMMENTS: + * ================================================ + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Connector.transport.transport001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Connector.transport.transport001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConnectorsJarBuilder.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConnectorsJarBuilder.java new file mode 100644 index 00000000000..d4bd9f1a9bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConnectorsJarBuilder.java @@ -0,0 +1,116 @@ +/* + * 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. + */ + +package nsk.jdi; + +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Utils; +import jdk.test.lib.process.ProcessTools; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.stream.Stream; + +public class ConnectorsJarBuilder { + public static void main(String[] args) { + Path src = Paths.get(Utils.TEST_SRC) + .resolve("connectors") + .toAbsolutePath(); + if (Files.notExists(src)) { + throw new Error("connectors dir [" + src + "] doesn't exist"); + } + Path classes = Paths.get("connectors","classes") + .toAbsolutePath(); + try { + Files.createDirectories(classes); + } catch (IOException e) { + throw new Error("can't create dir " + classes, e); + } + compile(src, classes); + Path target = Paths.get("jars", "connectors.jar") + .toAbsolutePath(); + buildJar(classes, target); + addMetaInf(src, target); + } + + private static void compile(Path src, Path classes) { + JDKToolLauncher javac = JDKToolLauncher.create("javac") + .addToolArg("-d") + .addToolArg(classes.toString()) + .addToolArg("-cp") + .addToolArg(Utils.TEST_CLASS_PATH); + try (Stream stream = Files.walk(src)) { + stream.map(Path::toAbsolutePath) + .map(Path::toString) + .filter(s -> s.endsWith(".java")) + .forEach(javac::addToolArg); + } catch (IOException e) { + throw new Error("traverse dir " + src, e); + } + + executeTool(javac); + } + + private static void buildJar(Path classes, Path target) { + try { + Files.createDirectories(target.getParent()); + } catch (IOException e) { + throw new Error("can't create dir " + target.getParent(), e); + } + JDKToolLauncher jar = JDKToolLauncher.create("jar") + .addToolArg("cf") + .addToolArg(target.toString()) + .addToolArg("-C") + .addToolArg(classes.toString()) + .addToolArg("."); + executeTool(jar); + } + + private static void addMetaInf(Path src, Path jarFile) { + Path metaInf = src.resolve("META-INF"); + if (Files.exists(metaInf)) { + JDKToolLauncher jar = JDKToolLauncher.create("jar") + .addToolArg("uf") + .addToolArg(jarFile.toString()) + .addToolArg("-C") + .addToolArg(src.toString()) + .addToolArg("META-INF"); + executeTool(jar); + } + } + + private static void executeTool(JDKToolLauncher tool) { + String[] command = tool.getCommand(); + try { + ProcessTools.executeCommand(command) + .shouldHaveExitValue(0); + } catch (Error | RuntimeException e) { + throw e; + } catch (Throwable e) { + throw new Error("execution of " + Arrays.toString(command) + " failed", e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConstantField/values001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConstantField/values001.java new file mode 100644 index 00000000000..7710337fa9e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConstantField/values001.java @@ -0,0 +1,220 @@ +/* + * 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.ConstantField; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.*; + +/** + * Test checks up static fields of JDI interfaces according to specification + */ +public class values001 { + + private static int exitStatus; + private static Log log; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + execTest(); + + log.display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private static void execTest() { + exitStatus = Consts.TEST_PASSED; + + if (ClassType.INVOKE_SINGLE_THREADED != 1) { + log.complain("***wrong value*** : ClassType.INVOKE_SINGLE_THREADED = " + + ClassType.INVOKE_SINGLE_THREADED); + exitStatus = Consts.TEST_FAILED; + } + + if (ObjectReference.INVOKE_NONVIRTUAL != 2) { + log.complain("***wrong value*** : ObjectReference.INVOKE_NONVIRTUAL = " + + ObjectReference.INVOKE_NONVIRTUAL); + exitStatus = Consts.TEST_FAILED; + } + + if (ObjectReference.INVOKE_SINGLE_THREADED != 1) { + log.complain("***wrong value*** : ObjectReference.INVOKE_SINGLE_THREADED = " + + ObjectReference.INVOKE_SINGLE_THREADED); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_MONITOR != 3) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_MONITOR = " + + ThreadReference.THREAD_STATUS_MONITOR); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_NOT_STARTED != 5) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_NOT_STARTED = " + + ThreadReference.THREAD_STATUS_NOT_STARTED); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_RUNNING != 1) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_RUNNING = " + + ThreadReference.THREAD_STATUS_RUNNING); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_SLEEPING != 2) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_SLEEPING = " + + ThreadReference.THREAD_STATUS_SLEEPING); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_UNKNOWN != -1) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_UNKNOWN = " + + ThreadReference.THREAD_STATUS_UNKNOWN); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_WAIT != 4) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_WAIT = " + + ThreadReference.THREAD_STATUS_WAIT); + exitStatus = Consts.TEST_FAILED; + } + + if (ThreadReference.THREAD_STATUS_ZOMBIE != 0) { + log.complain("***wrong value*** : ThreadReference.THREAD_STATUS_ZOMBIE = " + + ThreadReference.THREAD_STATUS_ZOMBIE); + exitStatus = Consts.TEST_FAILED; + } + + + // VirtualMachine + if (VirtualMachine.TRACE_ALL != 16777215) { + log.complain("***wrong value*** : VirtualMachine.TRACE_ALL = " + + VirtualMachine.TRACE_ALL); + exitStatus = Consts.TEST_FAILED; + } + + if (VirtualMachine.TRACE_EVENTS != 4) { + log.complain("***wrong value*** : VirtualMachine.TRACE_EVENTS = " + + VirtualMachine.TRACE_EVENTS); + exitStatus = Consts.TEST_FAILED; + } + + if (VirtualMachine.TRACE_NONE != 0) { + log.complain("***wrong value*** : VirtualMachine.TRACE_NONE = " + + VirtualMachine.TRACE_NONE); + exitStatus = Consts.TEST_FAILED; + } + + if (VirtualMachine.TRACE_OBJREFS != 16) { + log.complain("***wrong value*** : VirtualMachine.TRACE_OBJREFS = " + + VirtualMachine.TRACE_OBJREFS); + exitStatus = Consts.TEST_FAILED; + } + + if (VirtualMachine.TRACE_RECEIVES != 2) { + log.complain("***wrong value*** : VirtualMachine.TRACE_RECEIVES = " + + VirtualMachine.TRACE_RECEIVES); + exitStatus = Consts.TEST_FAILED; + } + + if (VirtualMachine.TRACE_REFTYPES != 8) { + log.complain("***wrong value*** : VirtualMachine.TRACE_REFTYPES = " + + VirtualMachine.TRACE_REFTYPES); + exitStatus = Consts.TEST_FAILED; + } + + if (VirtualMachine.TRACE_SENDS != 1) { + log.complain("***wrong value*** : VirtualMachine.TRACE_SENDS = " + + VirtualMachine.TRACE_SENDS); + exitStatus = Consts.TEST_FAILED; + } + + + if (EventRequest.SUSPEND_ALL != 2) { + log.complain("***wrong value*** : EventRequest.SUSPEND_ALL = " + + EventRequest.SUSPEND_ALL); + exitStatus = Consts.TEST_FAILED; + } + + if (EventRequest.SUSPEND_EVENT_THREAD != 1) { + log.complain("***wrong value*** : EventRequest.SUSPEND_EVENT_THREAD = " + + EventRequest.SUSPEND_EVENT_THREAD); + exitStatus = Consts.TEST_FAILED; + } + + if (EventRequest.SUSPEND_NONE != 0) { + log.complain("***wrong value*** : EventRequest.SUSPEND_NONE = " + + EventRequest.SUSPEND_NONE); + exitStatus = Consts.TEST_FAILED; + } + + + if (StepRequest.STEP_INTO != 1) { + log.complain("***wrong value*** : StepRequest.STEP_INTO = " + + StepRequest.STEP_INTO); + exitStatus = Consts.TEST_FAILED; + } + + if (StepRequest.STEP_LINE != -2) { + log.complain("***wrong value*** : StepRequest.STEP_LINE = " + + StepRequest.STEP_LINE); + exitStatus = Consts.TEST_FAILED; + } + + if (StepRequest.STEP_MIN != -1) { + log.complain("***wrong value*** : StepRequest.STEP_MIN = " + + StepRequest.STEP_MIN); + exitStatus = Consts.TEST_FAILED; + } + + if (StepRequest.STEP_OUT != 3) { + log.complain("***wrong value*** : StepRequest.STEP_OUT = " + + StepRequest.STEP_OUT); + exitStatus = Consts.TEST_FAILED; + } + + if (StepRequest.STEP_OVER != 2) { + log.complain("***wrong value*** : StepRequest.STEP_OVER = " + + StepRequest.STEP_OVER); + exitStatus = Consts.TEST_FAILED; + } + log.display(""); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConstantField/values001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConstantField/values001/TestDescription.java new file mode 100644 index 00000000000..5308a9564a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ConstantField/values001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/ConstantField/values001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * Test checks up static fields of JDI interfaces according to + * specification of them: + * com.sun.jdi.ClassType + * INVOKE_SINGLE_THREADED = 1 + * com.sun.jdi.ObjectReference + * INVOKE_NONVIRTUAL = 2 + * INVOKE_SINGLE_THREADED = 1 + * com.sun.jdi.ThreadReference + * THREAD_STATUS_MONITOR = 3 + * THREAD_STATUS_NOT_STARTED = 5 + * THREAD_STATUS_RUNNING = 1 + * THREAD_STATUS_SLEEPING = 2 + * THREAD_STATUS_UNKNOWN = -1 + * THREAD_STATUS_WAIT = 4 + * THREAD_STATUS_ZOMBIE = 0 + * com.sun.jdi.VirtualMachine + * TRACE_ALL = 16777215 + * TRACE_EVENTS = 4 + * TRACE_NONE = 0 + * TRACE_OBJREFS = 16 + * TRACE_RECEIVES = 2 + * TRACE_REFTYPES = 8 + * TRACE_SENDS = 1 + * com.sun.jdi.request.EventRequest + * SUSPEND_ALL = 2 + * SUSPEND_EVENT_THREAD = 1 + * SUSPEND_NONE = 0 + * com.sun.jdi.request.StepRequest + * STEP_INTO = 1 + * STEP_LINE = -2 + * STEP_MIN = -1 + * STEP_OUT = 3 + * STEP_OVER = 2 + * COMMENTS: + * This test is valid for jdk 1.4.1 or higher because of that + * there was no specifications for earlier versions. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @run main/othervm nsk.jdi.ConstantField.values001 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001.java new file mode 100644 index 00000000000..71917626d10 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001.java @@ -0,0 +1,460 @@ +/* + * 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.DoubleType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * DoubleType.
    + *
    + * The test checks that for a mirror of a double value, the casts
    + * from Type to DoubleType and from PrimitiveType to DoubleType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a double field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class doubletype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/DoubleType/_itself_/doubletype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new doubletype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.DoubleType._itself_.doubletype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'db';"); + String name = "db"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + DoubleType doubleType = null; + try { + log2(" checking up on cast: DoubleType doubleType = (DoubleType) type;"); + doubleType = (DoubleType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: DoubleType doubleType = (DoubleType) primitiveType;"); + doubleType = (DoubleType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001/TestDescription.java new file mode 100644 index 00000000000..6d204c5a952 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001/TestDescription.java @@ -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/DoubleType/_itself_/doubletype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * DoubleType. + * The test checks that for a mirror of a double value the casts + * from Type to DoubleType and from PrimitiveType to DoubleType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.DoubleType._itself_.doubletype001; + * the debuggee program - nsk.jdi.DoubleType._itself_.doubletype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.DoubleType._itself_.doubletype001 + * nsk.jdi.DoubleType._itself_.doubletype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.DoubleType._itself_.doubletype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001a.java new file mode 100644 index 00000000000..773f8664a4f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleType/_itself_/doubletype001a.java @@ -0,0 +1,113 @@ +/* + * 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.DoubleType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the doubletype001 JDI test. + */ + +public class doubletype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static double db = 0.0d; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001.java new file mode 100644 index 00000000000..a9e67577690 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.DoubleValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.DoubleValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + DoubleValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof DoubleValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (DoubleValue )v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for DoubleValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(DoubleValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof DoubleValue) { + DoubleValue doubleObject = (DoubleValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(doubleObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(doubleObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is DoubleValue: " + value + " and 'y' is DoubleValue : " + doubleObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(doubleObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(doubleObject) == 0) && (doubleObject.compareTo(value) != 0)) || + ((value.compareTo(doubleObject) != 0) && (doubleObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is DoubleValue: " + value + " and 'y' is DoubleValue : " + doubleObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(doubleObject) + "\n\t" + + "result of (y.compareTo(x)): " + doubleObject.compareTo(value) ); + result = false; + } + if (value.compareTo(doubleObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(doubleObject) != -(doubleObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is DoubleValue: " + value + " and 'y' is DoubleValue : " + doubleObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(doubleObject) + "\n\t" + + "result of (y.compareTo(x)): " + doubleObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(doubleObject) > 0) { + DoubleValue lessValue = FindLessDoubleValue(doubleObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is DoubleValue: " + value + " , 'y' is DoubleValue : " + doubleObject + " , 'z' is DoubleValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(doubleObject) + "\n\t" + + "result of (y.compareTo(z)): " + doubleObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "DoubleValue: " + value + " and DoubleValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "DoubleValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "DoubleValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((DoubleValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "DoubleValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "DoubleValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another DoubleValue field which is less then method's argument via + * compareTo method. + */ + + private static DoubleValue FindLessDoubleValue (DoubleValue currentValue) { + DoubleValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + DoubleValue newValue = (DoubleValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..02c0eb19d81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001/TestDescription.java @@ -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/DoubleValue/compareTo/compareto001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.DoubleValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of DoubleValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote DoubleValue object. + * The debugger program - nsk.jdi.DoubleValue.compareto.compareto001; + * the debuggee program - nsk.jdi.DoubleValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of double fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of DoubleValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.DoubleValue.compareTo.compareto001 + * nsk.jdi.DoubleValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.DoubleValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..7a01a515e4d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/compareTo/compareto001a.java @@ -0,0 +1,175 @@ +/* + * 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.DoubleValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public double doubleMAX = Double.MAX_VALUE; + public double double1 = 1; + public double double0 = 0; + public double double_1 = -1; + public double doubleMIN = Double.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001.java new file mode 100644 index 00000000000..4451d9905d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001.java @@ -0,0 +1,247 @@ +/* + * 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.DoubleValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * DoubleValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.DoubleValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static double plus1_1 = +1d;
    + * public static double plus1_2 = +1d;
    + * public static double minus1 = -1d;
    + * public static float float_plus1 = +1f;
    + *
    + * which a debugger mirros as :
    + *
    + * DoubleValue dvplus1_1;
    + * DoubleValue dvplus1_2;
    + * DoubleValue dvminus1;
    + * FloatValue fvplus1;
    + *
    + * the following is true:
    + *
    + * dvplus1_1 == dvplus1_2
    + * dvplus1_1 != dvminus1
    + * dvplus1_1 != fvplus1
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/DoubleValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.DoubleValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fdplus1_1 = execClass.fieldByName("plus1_1"); + Field fdplus1_2 = execClass.fieldByName("plus1_2"); + Field fdminus1 = execClass.fieldByName("minus1"); + Field ffplus1 = execClass.fieldByName("float_plus1"); + + DoubleValue dvplus1_1 = (DoubleValue) execClass.getValue(fdplus1_1); + DoubleValue dvplus1_2 = (DoubleValue) execClass.getValue(fdplus1_2); + DoubleValue dvminus1 = (DoubleValue) execClass.getValue(fdminus1); + FloatValue fvplus1 = (FloatValue) execClass.getValue(ffplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!dvplus1_1.equals(dvplus1_2)) + expresult = 1; + break; + + case 1: if (dvplus1_1.equals(dvminus1)) + expresult = 1; + break; + + case 2: if (dvplus1_1.equals(fvplus1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..f61f7d89965 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001/TestDescription.java @@ -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/DoubleValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * DoubleValue. + * The test checks up that a result of the method + * com.sun.jdi.DoubleValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this DoubleValue for equality. + * Returns: true if the Object is a DoubleValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.DoubleValue.equals.equals001; + * a debuggee program - nsk.jdi.DoubleValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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. + * 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.DoubleValue.equals.equals001 + * nsk.jdi.DoubleValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.DoubleValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001a.java new file mode 100644 index 00000000000..360d1e57c78 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001a.java @@ -0,0 +1,134 @@ +/* + * 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.DoubleValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001a JDI test. + + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static double pos_inf = Double.POSITIVE_INFINITY; +// public static double pos_zero = 0.0d; +// public static double neg_zero = -0.0d; +// public static double neg_inf = Double.NEGATIVE_INFINITY; + +// public static double pos_largest = Double.MAX_VALUE; +// public static double pos_smallest = Double.MIN_VALUE; +// public static double neg_largest = -Double.MAX_VALUE; +// public static double neg_smallest = -Double.MIN_VALUE; + +// public static double double_nan = Double.NaN; + + public static double plus1_1 = +1.0d; + public static double plus1_2 = +1.0d; + public static double minus1 = -1.0d; + + public static float float_plus1 = +1.0f; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.DoubleValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + DoubleValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof DoubleValue) ) { + msg += " is not DoubleValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (DoubleValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(DoubleValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof DoubleValue ) { + if ( value.value() == ((PrimitiveValue )object).doubleValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof DoubleValue ) { + if ( value.value() != ((PrimitiveValue )object).doubleValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..c3c549f1d70 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals002/TestDescription.java @@ -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/DoubleValue/equals/equals002. + * 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.DoubleValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this DoubleValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a DoubleValue and if applying "==" to the + * two mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.DoubleValue.equals.equals002 + * nsk.jdi.DoubleValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.DoubleValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals002a.java new file mode 100644 index 00000000000..b8103b175fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals002a.java @@ -0,0 +1,142 @@ +/* + * 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.DoubleValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public double doubleMAX = Double.MAX_VALUE; + public double double1 = 1; + public double double0 = 0; + public double double_1 = -1; + public double doubleMIN = Double.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..9b4074dd72f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001.java @@ -0,0 +1,239 @@ +/* + * 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.DoubleValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * DoubleValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.DoubleValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static double plus1_1 = +1d;
    + * public static double plus1_2 = +1d;
    + * public static double pos_largest = Double.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * DoubleValue dvplus1_1;
    + * DoubleValue dvplus1_2;
    + * DoubleValue dvpos_largest;
    + *
    + * the following is true:
    + *
    + * dvpos_largest.hashCode() == dvpos_largest.hashCode()
    + * dvplus1_1.hashCode() == dvplus1_2.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/DoubleValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.DoubleValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fdplus1_1 = execClass.fieldByName("plus1_1"); + Field fdplus1_2 = execClass.fieldByName("plus1_2"); + Field fdpos_largest = execClass.fieldByName("pos_largest"); + + DoubleValue dvplus1_1 = (DoubleValue) execClass.getValue(fdplus1_1); + DoubleValue dvplus1_2 = (DoubleValue) execClass.getValue(fdplus1_2); + DoubleValue dvpos_largest = + (DoubleValue) execClass.getValue(fdpos_largest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (dvpos_largest.hashCode() != dvpos_largest.hashCode()) + expresult = 1; + break; + + case 1: if (dvplus1_1.hashCode() != dvplus1_2.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..231fbfc3227 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/DoubleValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * DoubleValue. + * The test checks up that a result of the method + * com.sun.jdi.DoubleValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this DoubleValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.DoubleValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.DoubleValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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. + * 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.DoubleValue.hashCode.hashcode001 + * nsk.jdi.DoubleValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.DoubleValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..c4994543ad0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/hashCode/hashcode001a.java @@ -0,0 +1,133 @@ +/* + * 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.DoubleValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static double pos_inf = Double.POSITIVE_INFINITY; +// public static double pos_zero = 0.0d; +// public static double neg_zero = -0.0d; +// public static double neg_inf = Double.NEGATIVE_INFINITY; + + public static double pos_largest = Double.MAX_VALUE; +// public static double pos_smallest = Double.MIN_VALUE; +// public static double neg_largest = -Double.MAX_VALUE; +// public static double neg_smallest = -Double.MIN_VALUE; + +// public static double double_nan = Double.NaN; + + public static double plus1_1 = +1.0d; + public static double plus1_2 = +1.0d; +// public static double minus1 = -1.0d; + +// public static float float_plus1 = +1.0f; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * DoubleValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.DoubleValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static double pos_inf = Double.POSITIVE_INFINITY;
    + * public static double pos_zero = 0.0d;
    + * public static double neg_zero = -0.0d;
    + * public static double neg_inf = Double.NEGATIVE_INFINITY;
    + * public static double pos_largest = Double.MAX_VALUE;
    + * public static double pos_smallest = Double.MIN_VALUE;
    + * public static double neg_largest = -Double.MAX_VALUE;
    + * public static double neg_smallest = -Double.MIN_VALUE;
    + * public static double double_nan = Double.NaN;
    + *
    + * which a debugger mirros as :
    + *
    + * DoubleValue dvpos_inf;
    + * DoubleValue dvpos_zero;
    + * DoubleValue dvneg_zero;
    + * DoubleValue dvneg_inf;
    + * DoubleValue dvpos_largest;
    + * DoubleValue dvpos_smallest;
    + * DoubleValue dvneg_largest;
    + * DoubleValue dvneg_smallest;
    + * DoubleValue dvdouble_nan;
    + *
    + * the following is true:
    + *
    + * dvneg_inf.value() == Double.NEGATIVE_INFINITY
    + * dvneg_largest.value() == -Double.MAX_VALUE
    + * dvneg_smallest.value() == -Double.MIN_VALUE
    + * dvneg_zero.value() == -0.0d
    + * dvpos_zero.value() == 0.0d
    + * dvpos_smallest.value() == Double.MIN_VALUE
    + * dvpos_largest.value() == Double.MAX_VALUE
    + * dvpos_inf.value() == Double.POSITIVE_INFINITY
    + * dvdouble_nan.value() != dvdouble_nan.value()
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/DoubleValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.DoubleValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fdneg_inf = execClass.fieldByName("neg_inf"); + Field fdneg_largest = execClass.fieldByName("neg_largest"); + Field fdneg_smallest = execClass.fieldByName("neg_smallest"); + Field fdneg_zero = execClass.fieldByName("neg_zero"); + Field fdpos_zero = execClass.fieldByName("pos_zero"); + Field fdpos_smallest = execClass.fieldByName("pos_smallest"); + Field fdpos_largest = execClass.fieldByName("pos_largest"); + Field fdpos_inf = execClass.fieldByName("pos_inf"); + Field fddouble_nan = execClass.fieldByName("double_nan"); + + DoubleValue dvneg_inf = (DoubleValue) execClass.getValue(fdneg_inf); + DoubleValue dvneg_largest = (DoubleValue) execClass.getValue(fdneg_largest); + DoubleValue dvneg_smallest = (DoubleValue) execClass.getValue(fdneg_smallest); + DoubleValue dvneg_zero = (DoubleValue) execClass.getValue(fdneg_zero); + DoubleValue dvpos_zero = (DoubleValue) execClass.getValue(fdpos_zero); + DoubleValue dvpos_smallest = (DoubleValue) execClass.getValue(fdpos_smallest); + DoubleValue dvpos_largest = (DoubleValue) execClass.getValue(fdpos_largest); + DoubleValue dvpos_inf = (DoubleValue) execClass.getValue(fdpos_inf); + DoubleValue dvdouble_nan = (DoubleValue) execClass.getValue(fddouble_nan); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (dvneg_inf.value() != Double.NEGATIVE_INFINITY) + expresult = 1; + break; + + case 1: if (dvneg_largest.value() != -Double.MAX_VALUE) + expresult = 1; + break; + + case 2: if (dvneg_smallest.value() != -Double.MIN_VALUE) + expresult = 1; + break; + + case 3: if (dvneg_zero.value() != -0.0d) + expresult = 1; + break; + + case 4: if (dvpos_zero.value() != 0.0d) + expresult = 1; + break; + + case 5: if (dvpos_smallest.value() != Double.MIN_VALUE) + expresult = 1; + break; + + case 6: if (dvpos_largest.value() != Double.MAX_VALUE) + expresult = 1; + break; + + case 7: if (dvpos_inf.value() != Double.POSITIVE_INFINITY) + expresult = 1; + break; + + case 8: if ( !(dvdouble_nan.value() != dvdouble_nan.value()) ) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..4081400d13f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/DoubleValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * DoubleValue. + * The test checks up that a result of the method + * com.sun.jdi.DoubleValue.value() + * complies with its spec: + * public double value() + * Returns this DoubleValue as a double. + * Returns: the double mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.DoubleValue.value.value001; + * a debuggee program - nsk.jdi.DoubleValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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. + * 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.DoubleValue.value.value001 + * nsk.jdi.DoubleValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.DoubleValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001a.java new file mode 100644 index 00000000000..4e436a9e231 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001a.java @@ -0,0 +1,133 @@ +/* + * 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.DoubleValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static double pos_inf = Double.POSITIVE_INFINITY; + public static double pos_zero = 0.0d; + public static double neg_zero = -0.0d; + public static double neg_inf = Double.NEGATIVE_INFINITY; + + public static double pos_largest = Double.MAX_VALUE; + public static double pos_smallest = Double.MIN_VALUE; + public static double neg_largest = -Double.MAX_VALUE; + public static double neg_smallest = -Double.MIN_VALUE; + + public static double double_nan = Double.NaN; + +// public static double plus1_1 = +1.0d; +// public static double plus1_2 = +1.0d; +// public static double minus1 = -1.0d; + +// public static float float_plus1 = +1.0f; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.event.Event.
    + * A debugger part of + * the test creates several AccessWatchpointRequests, and + * verifies that all appropriate events have been generated by a target + * VM. Then, the debugger removes one request via + * deleteEventRequest() call. Finally, the test checks + * that the event corresponding to the deleted request, are not generated. + */ +public class event001 { + 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.Event._itself_.event001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int FLDS_NUM = 3; + static final String COMMAND_RUN[] = { + "run1", "run2", "run3" + }; + static final String DEBUGGEE_FLDS[][] = { + {"byte", "byteFld"}, + {"short", "shortFld"}, + {"int", "intFld"} + }; + private volatile int accFCount[] = { + 0, 0, 0 + }; + private int DEL_NUM = 1; // deleted request number + + 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; + +// 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 event001().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, "event001t.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: " + e); + tot_res = FAILED; + return quitDebuggee(); + } + if (createRequests(erManager, fields) == 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 all requested AccessWatchpointRequest events + for (int i=0; icom.sun.jdi.event.Event.
    + * A debugger part + * of the test creates several AccessWatchpointRequests, and + * then it verifies that appropriate events will be generated by a target + * VM. After that, the debugger removes the list of the event requests via + * deleteEventRequests() call. Finally, the test checks + * that the events which corresponding requests have been deleted, are + * not generated by the target VM. + */ +public class event002 { + 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.Event._itself_.event002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int FLDS_NUM = 9; // number of debuggee's fields + static final int DEL_REQS = 5; // number of requests to delete + static final String COMMAND_RUN[] = { + "run1", "run2", "run3", "run4", + "run5", "run6", "run7", "run8", "run9" + }; + static final String DEBUGGEE_FLDS[][] = { + {"byte", "byteFld", "DELETE"}, + {"short", "shortFld", "NO"}, + {"int", "intFld", "DELETE"}, + {"long", "longFld", "NO"}, + {"float", "floatFld", "DELETE"}, + {"double", "doubleFld", "DELETE"}, + {"char", "charFld", "NO"}, + {"boolean", "booleanFld", "NO"}, + {"java.lang.String", "strFld", "DELETE"} + }; + 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 List delRequests; // list of requests to delete + private volatile int tot_res = PASSED; + +// 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 event002().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, "event002t.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 + delRequests = new ArrayList(); + 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) == 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 all requested AccessWatchpointRequest events + for (int i=0; i 0 && DEBUGGEE_FLDS[i][2].equals("DELETE")) { + log.complain("TEST FAILED: got AccessWatchpointEvent for disabled field " + + DEBUGGEE_FLDS[i][0]); + return FAILED; + } + } + log.display("TEST PASSED: Got no AccessWatchpointEvents for disabled fields"); + + } + return tot_res; + } + + private int createRequests(EventRequestManager erManager, + List fields) { + Field fld = null; + int i = 0; + + awpRequest = + new AccessWatchpointRequest[FLDS_NUM]; + for (i=0; i " + 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 ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } + + execTest(); + + int status = debuggee.endDebugee(); + if ( status != Consts.JCK_STATUS_BASE ) { + throw new Failure("UNEXPECTED Debugee's exit status : " + status); + } + display("expected Debugee's exit status : " + status); + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + EventRequestManager eventRequestManager = debuggee.VM().eventRequestManager(); + EventRequest eventRequest; + + ReferenceType testedClass = debuggee.classByName(threadClassName); + if ( testedClass == null ) { + throw new Failure("Class '" + threadClassName + "' not found."); + } + + for (int i = 0; i < 11; i++) { + eventRequest = null; + switch (i) { + + case 0: + ThreadReference thread = debuggee.threadByName(threadName); + + display("setting up StepRequest"); + eventRequest = eventRequestManager.createStepRequest + (thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + display("setting up AccessWatchpointRequest"); + eventRequest = eventRequestManager.createAccessWatchpointRequest + (testedClass.fieldByName(fieldName)); + break; + + case 2: + display("setting up ModificationWatchpointRequest"); + eventRequest = eventRequestManager.createModificationWatchpointRequest + (testedClass.fieldByName(fieldName)); + break; + + case 3: + display("setting up ClassPrepareRequest"); + eventRequest = eventRequestManager.createClassPrepareRequest(); + break; + + case 4: + display("setting up ClassUnloadRequest"); + eventRequest = eventRequestManager.createClassUnloadRequest(); + break; + + case 5: + display("setting up MethodEntryRequest"); + eventRequest = eventRequestManager.createMethodEntryRequest(); + break; + + case 6: + display("setting up MethodExitRequest"); + eventRequest = eventRequestManager.createMethodExitRequest(); + break; + + case 7: + display("setting up ThreadDeathRequest"); + eventRequest = eventRequestManager.createThreadDeathRequest(); + break; + + case 8: + display("setting up ThreadStartRequest"); + eventRequest = eventRequestManager.createThreadStartRequest(); + break; + + case 9: + display("setting up ExceptionRequest"); + eventRequest = eventRequestManager.createExceptionRequest( null, true, true ); + break; + + case 10: + display("setting up BreakpointRequest"); + Method method = methodByName(testedClass, methodName); + List locs = null; + try { + locs = method.allLineLocations(); + } catch(AbsentInformationException e) { + throw new Failure("Unexpected AbsentInformationException while getting "); + } + Location location = (Location)locs.get(0); + eventRequest = eventRequestManager.createBreakpointRequest(location); + break; + + default: + throw new Failure("Wrong test case : " + i); + } + + if (eventRequest == null) { + throw new Failure("Cannot create request case : " + i); + } + eventRequest.addCountFilter(1); + eventRequest.enable(); + } + + debuggee.sendSignal(SIGNAL_GO); + + boolean exit = false; + boolean connected = true; + + Event oldEvent = null; + + while (!exit) { + EventSet eventSet = getEventSet(); + EventIterator eventIterator = eventSet.eventIterator(); + + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + + display("Checking equals() method for Event object : " + event); + + if (!event.equals(event)) { + complain("equals method is not reflexive. x.equals(x) returns false for Event object : " + event); + exitStatus = Consts.TEST_FAILED; + } + + if (event != null && event.equals(null)) { + complain("equals(null) returns true for Event object " + event); + exitStatus = Consts.TEST_FAILED; + } + + if (oldEvent != null) { + boolean eq1 = event.equals(oldEvent); + boolean eq2 = oldEvent.equals(event); + if ((!eq1 && eq2) || (eq1 && !eq2)) { + complain("equals() is not symmetric for Event object : " + event + + "\n\t and another one : " + oldEvent); + + exitStatus = Consts.TEST_FAILED; + } + + eq1 = event.equals(oldEvent); + eq2 = event.equals(oldEvent); + if ((!eq1 && eq2) || (eq1 && !eq2)) { + complain("equals() is not consistent for Event object : " + event + + "\n\t and another one : " + oldEvent); + + exitStatus = Consts.TEST_FAILED; + } + } + + if (event instanceof VMDeathEvent) { + connected = true; + } else if (event instanceof VMDisconnectEvent) { + connected = true; + exit = true; + } + oldEvent = event; + } + if (connected) { + eventSet.resume(); + } + } + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static Method methodByName(ReferenceType refType, String methodName) { + List methodList = refType.methodsByName(methodName); + if (methodList == null) return null; + + Method method = (Method) methodList.get(0); + return method; + } + + private static EventSet getEventSet() { + EventSet eventSet; + try { + eventSet = debuggee.VM().eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for event"); + } + } catch ( Exception e ) { + throw new Failure("Unexpected exception while waiting for event " + e); + } + return eventSet; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..a73cc845a84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/equals/equals001/TestDescription.java @@ -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/Event/equals/equals001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public equals() method of an implementing class of + * com.sun.jdi.event.Event interface. + * The test checks an assertion cited from spec for equals() method of + * java.lang.Object class: + * The equals method implements an equivalence relation: + * - It is reflexive: for any reference value x, x.equals(x) should return true. + * - It is symmetric: for any reference values x and y, x.equals(y) should return + * true if and only if y.equals(x) returns true. + * - It is consistent: for any reference values x and y, multiple invocations + * of x.equals(y) consistently return true or consistently return false, + * provided no information used in equals comparisons on the object is modified. + * - For any non-null reference value x, x.equals(null) should return false. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for Event + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume for these events is skipped in event handling loop + * - method Debugee.endDebugee() is used instead of Debugee.waitFor() + * Test fixed according to test bug: + * 4854711 TEST_BUG: race condition in threads synchronization + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Event.equals.equals001 + * nsk.jdi.Event.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Event.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/equals/equals001a.java new file mode 100644 index 00000000000..23813795186 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/equals/equals001a.java @@ -0,0 +1,153 @@ +/* + * 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.Event.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class equals001a { + + //------------------------------------------------------- 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 Object lock = new Object(); + static Object wait = new Object(); + + //------------------------------------------------------ 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); + try { + Thread thread1 = new equals001aThread("thread1"); + + synchronized (lock) { + synchronized(wait) { + thread1.start(); + try { + wait.wait(); + pipe.println(equals001.SIGNAL_READY); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for notification"); + } + } + receiveSignal(equals001.SIGNAL_GO); + } + try { + thread1.join(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for thread1 join"); + } + +// receiveSignal(equals001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class equals001aThread extends Thread { + + String name; + + public equals001aThread (String name) { + super(name); + this.name = name; + } + + public void run() { + synchronized (equals001a.wait) { + equals001a.wait.notifyAll(); + } + synchronized (equals001a.lock) { + } + + foo(); + + equals001aThread1 thread2 = new equals001aThread1(); + thread2.start(); + + try { + throw new Exception(); + } catch (Exception e) { + } + + try { + thread2.join(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for thread2 join"); + } + } + + void foo () { + name = "afterFoo"; + equals001a.display("thread1's name == " + name); + } +} + +class equals001aThread1 extends Thread { + public void run() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001.java new file mode 100644 index 00000000000..06d0ed11f20 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001.java @@ -0,0 +1,266 @@ +/* + * 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.Event.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class hashcode001 { + + //------------------------------------------------------- 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.Event.hashCode."; + private final static String className = "hashcode001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String threadClassName = prefix + "hashcode001aThread"; + private final static String threadName = "thread1"; + private final static String methodName = "foo"; + private final static String fieldName = "name"; + private final static int brkpLineNumber = 145; + + //------------------------------------------------------- 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 ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } + + execTest(); + + int status = debuggee.endDebugee(); + if ( status != Consts.JCK_STATUS_BASE ) { + throw new Failure("UNEXPECTED Debugee's exit status : " + status); + } + display("expected Debugee's exit status : " + status); + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + EventRequestManager eventRequestManager = debuggee.VM().eventRequestManager(); + EventRequest eventRequest; + + ReferenceType testedClass = debuggee.classByName(threadClassName); + if ( testedClass == null ) { + throw new Failure("Class '" + threadClassName + "' not found."); + } + + for (int i = 0; i < 11; i++) { + eventRequest = null; + switch (i) { + + case 0: + ThreadReference thread = debuggee.threadByName(threadName); + + display(".....setting up StepRequest"); + eventRequest = eventRequestManager.createStepRequest + (thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + display(".....setting up AccessWatchpointRequest"); + eventRequest = eventRequestManager.createAccessWatchpointRequest + (testedClass.fieldByName(fieldName)); + break; + + case 2: + display(".....setting up ModificationWatchpointRequest"); + eventRequest = eventRequestManager.createModificationWatchpointRequest + (testedClass.fieldByName(fieldName)); + break; + + case 3: + display(".....setting up ClassPrepareRequest"); + eventRequest = eventRequestManager.createClassPrepareRequest(); + break; + + case 4: + display(".....setting up ClassUnloadRequest"); + eventRequest = eventRequestManager.createClassUnloadRequest(); + break; + + case 5: + display(".....setting up MethodEntryRequest"); + eventRequest = eventRequestManager.createMethodEntryRequest(); + break; + + case 6: + display(".....setting up MethodExitRequest"); + eventRequest = eventRequestManager.createMethodExitRequest(); + break; + + case 7: + display(".....setting up ThreadDeathRequest"); + eventRequest = eventRequestManager.createThreadDeathRequest(); + break; + + case 8: + display(".....setting up ThreadStartRequest"); + eventRequest = eventRequestManager.createThreadStartRequest(); + break; + + case 9: + display(".....setting up ExceptionRequest"); + eventRequest = eventRequestManager.createExceptionRequest( null, true, true ); + break; + + case 10: + display(".....setting up BreakpointRequest"); + eventRequest = debuggee.makeBreakpoint(testedClass, methodName, brkpLineNumber); + break; + + default: + throw new Failure("Wrong test case : " + i); + } + + if (eventRequest == null) { + throw new Failure("Cannot create request case : " + i); + } + eventRequest.addCountFilter(1); + eventRequest.enable(); + } + + debuggee.sendSignal(SIGNAL_GO); + + display("Checking hashCode() method for Event objects"); + + boolean exit = false; + boolean connected = true; + while (!exit) { + EventSet eventSet = getEventSet(); + EventIterator eventIterator = eventSet.eventIterator(); + + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + String eventName = null; + + if (event instanceof VMDeathEvent) { + eventName = "VMDeathEvent"; + connected = false; + } else if (event instanceof VMDisconnectEvent) { + eventName = "VMDisconnectEvent"; + connected = false; + exit = true; + } else { + eventName = "" + event; + } + + try { + int hCode = event.hashCode(); + display("hashCode() returns " + hCode + " for Event object : " + eventName); + + if (hCode == 0) { + complain("hashCode() returns 0 for Event object " + eventName); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = event.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for Event object " + eventName + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + } catch (VMDisconnectedException e) { + // skip error message if already disconnected + if (connected) { + throw new Failure("Caught unexpected VMDisconnectedException:\n\t" + e); + } + } + } + if (connected) { + eventSet.resume(); + } + } + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static EventSet getEventSet() { + EventSet eventSet; + try { + eventSet = debuggee.VM().eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for event"); + } + } catch ( Exception e ) { + throw new Failure("Unexpected exception while waiting for event " + e); + } + return eventSet; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..26a214d859a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/Event/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.event.Event interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during + * an execution of a Java application, the hashCode method must + * consistently return the same integer, provided no information used + * in equals comparisons on the object is modified. + * ... + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for Event + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume for these events is skipped in event handling loop + * - method Debugee.endDebugee() is used instead of Debugee.waitFor() + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * Test fixed according to test bug: + * 4783196 TEST_BUG: hashcode001 incorrectly handles VMDisconnectEvent + * - eliminating printing VMDeathEvent and VMDisconnectEvent + * - ignoring VMDisconnectedException if thrown for these events + * while testinging hashcode() method + * Test fixed according to test bug: + * 4854711 TEST_BUG: race condition in threads synchronization + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Event.hashCode.hashcode001 + * nsk.jdi.Event.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Event.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001a.java new file mode 100644 index 00000000000..4e04d991048 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001a.java @@ -0,0 +1,153 @@ +/* + * 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.Event.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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 Object lock = new Object(); + static Object wait = new Object(); + + //------------------------------------------------------ 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); + try { + Thread thread1 = new hashcode001aThread("thread1"); + + synchronized (lock) { + synchronized(wait) { + thread1.start(); + try { + wait.wait(); + pipe.println(hashcode001.SIGNAL_READY); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for notification"); + } + } + receiveSignal(hashcode001.SIGNAL_GO); + } + try { + thread1.join(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for thread1 join"); + } + +// receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class hashcode001aThread extends Thread { + + String name; + + public hashcode001aThread (String name) { + super(name); + this.name = name; + } + + public void run() { + synchronized (hashcode001a.wait) { + hashcode001a.wait.notifyAll(); + } + synchronized (hashcode001a.lock) { + } + + foo(); + + hashcode001aThread1 thread2 = new hashcode001aThread1(); + thread2.start(); + + try { + throw new Exception(); + } catch (Exception e) { + } + + try { + thread2.join(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for thread2 join"); + } + } + + void foo () { + name = "afterFoo"; // hashcode001.brkpLineNumber + hashcode001a.display("thread1's name == " + name); + } +} + +class hashcode001aThread1 extends Thread { + public void run() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001.java new file mode 100644 index 00000000000..dd484351ccf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001.java @@ -0,0 +1,963 @@ +/* + * 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.Event.request; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Event.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.Event.request()
    + * complies with its spec.
    + *
    + * The test checks that for all Event objects,
    + * except for ClassUnloadEvent, the method returns
    + * either the EventRequest that requested this event
    + * or null if event does not have a corresponding request.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it saves its EventSet into
    + * a special array and makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger saves its EVENTSet into the array and
    + * sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase the debugger and the debuggee perform the following.
    + * - The debugger creates ThreadStartRequest, ThreadDeathRequest, and
    + * an extra VMDeathRequest, resumes the debuggee, and
    + * waits for corresponding ThreadStartEvent and ThreadDeathEvent.
    + * - The debuggee creates new thread, named "thread2",
    + * whose running creates the above events.
    + * - Upon getting the events, the debugger saves their sets in the array,
    + * resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a number of threads, one for each
    + * following event: AccessWatchpoint, ModificationWatchpoint,
    + * MethodEntry, MethodExit, Step, Exception, and Breakpoint,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointForCommunication, the debugger
    + * gets ThreadReferences mirroring all tested threads in the debuggee,
    + * sets up Requests within them to get EventSETS to check up on,
    + * resumes the debuggee, waits for events, and upon getting them,
    + * saves its EventSets into the array.
    + *
    + * In third phase,at the end
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and ends.
    + * The debugger waits for VMDeathEvents and VMDisconnectEvents, and
    + * upon getting them, saves their EventSets into the array.
    + * Finally, the debugger, using the array of EventSets,
    + * compares Requests from Events to ones set up.
    + * If any mismatch, the test FAILED.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class request001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Event/request/request001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new request001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Event.request.request001a"; + + private String testedClassName = + "nsk.jdi.Event.request.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + + // Event #: + // 0-6 : AccessWatchpoint, ModificationWatchpoint, Breakpoint, Exception, + // MethodEntry, MethodExit, Step + // 7-8 : ClassPrepare, ClassUnload + // 9-10 : ThreadDeath, ThreadStart + // 11-13 : VMDeath, VMDisconnect, VMStart + + EventSet eventSets[] = new EventSet [14]; + EventRequest eRequests[] = new EventRequest[14]; + + int eventFlags[] = { 0,0,0,0, 0,0,0,0, 3,0,0,0, 1,1 }; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugeeNoWait(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugeeNoWait(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + log2("waiting for VMStartEvent"); + getEventSet(); +// + eventSets[13] = eventSet; + if (eventIterator.nextEvent() instanceof VMStartEvent) { + log2("VMStartEvent received; test begins"); + + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + eventSets[11] = eventSet; + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); +// + eventSets[12] = eventSet; + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + check(); + return 0; + } else { + log3("ERROR: first event is not the VMStartEvent"); + return 1; + } + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + log2("......setting up ClassPrepareRequest"); + eRequests[7] = cpRequest; + + cpRequest.enable(); + vm.resume(); + + getEventSet(); + eventSets[7] = eventSet; + + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + { + log2("...... setting up VMDeathRequest"); + if (vm.canRequestVMDeathEvent()) { + VMDeathRequest vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", "VMDeathRequest"); + vmdr.setSuspendPolicy(EventRequest.SUSPEND_NONE); + vmdr.enable(); + eRequests[11] = vmdr; + } else { + eventFlags[11] = 2; + } + + log2("......setting up ThreadStartRequest"); + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr.putProperty("number", "ThreadStartRequest"); + tsr.enable(); + + eRequests[10] = tsr; + + log2("......setting up ThreadDeathRequest"); + ThreadDeathRequest tdr = eventRManager.createThreadDeathRequest(); + tdr.addCountFilter(1); + tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr.putProperty("number", "ThreadDeathRequest"); + tdr.enable(); + + eRequests[9] = tdr; + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ThreadStartEvent"); + getEventSet(); + eventSets[10] = eventSet; + + Event receivedEvent = eventIterator.nextEvent(); + if ( !(receivedEvent instanceof ThreadStartEvent) ) { + testExitCode = FAILED; + log3("ERROR: new event is not ThreadStartEvent: " + receivedEvent); + return; + } + tsr.disable(); + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ThreadDeathEvent"); + getEventSet(); + eventSets[9] = eventSet; + receivedEvent = eventIterator.nextEvent(); + if ( !(receivedEvent instanceof ThreadDeathEvent) ) { + testExitCode = FAILED; + log3("ERROR: new event is not ThreadDeathEvent: " + receivedEvent); + return; + } + tdr.disable(); + } + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String bpLineName = "breakpointLine"; + String bpMethodName = "method"; + String awFieldName = "awFieldName"; + String mwFieldName = "mwFieldName"; + + String namesArray = "threadNames"; + + String threadNames[] = { + "awThread" , + "mwThread" , + "bpThread" , + "excThread" , + "menThread" , + "mexThread" , + "stThread" + }; + + int flags = 0; + + ThreadReference eventThreads[] = new ThreadReference[threadNames.length]; + + + List allThreads = vm.allThreads(); + + log2("......getting: ArrayReference namesRef = (ArrayReference) debuggeeClass.getValue(debuggeeClass.fieldByName(namesArray));"); + ArrayReference namesRef = (ArrayReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(namesArray)); + log2(" namesRef.length() == " + namesRef.length()); + + log2("......getting and checking up on debuggee threads' names"); + for (int n1 = 0; n1 < namesRef.length(); n1++) { + + log2(" String name = ((StringReference) namesRef.getValue(n1)).value();"); + String name = ((StringReference) namesRef.getValue(n1)).value(); + + label0: { + for (int n2 = 0; n2 < threadNames.length; n2++) { + + if (name.equals(threadNames[n2])) { + ListIterator li = allThreads.listIterator(); + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) { + eventThreads[n1] = thread; + break; + } + } + break label0; + } + } + testExitCode = FAILED; + log3("ERROR: no thread found in the debuggee : " + name); + } + } + if (testExitCode == FAILED) + break; + + + log2("......ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0);"); + ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0); + + log2("......setting up Requests"); + for ( int n3 = 0; n3 < namesRef.length(); n3++) { + switch (n3) { + case 0: + if (vm.canWatchFieldAccess()) { + String awName = ( (StringReference) testClass.getValue( + testClass.fieldByName(awFieldName))).value(); + eRequests[n3] = settingAccessWatchpoint(eventThreads[n3], + testClass, awName, threadNames[n3]); + eRequests[n3].enable(); + flags |= 1; + } + break; + + case 1: + if (vm.canWatchFieldModification() ) { + String mwName = ( (StringReference) testClass.getValue( + testClass.fieldByName(mwFieldName))).value(); + eRequests[n3] = settingModificationWatchpoint(eventThreads[n3], + testClass, mwName, threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<1; + } + break; + + case 2: + eRequests[n3] = settingBreakpoint(eventThreads[n3], testClass, + bpMethodName, bpLineName, threadNames[n3]); + eRequests[n3].setSuspendPolicy( EventRequest.SUSPEND_NONE); + eRequests[n3].enable(); + flags |= 1<<2; + break; + + case 3: + eRequests[n3] = settingException(eventThreads[n3], debuggeeClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<3; + break; + + case 4: + eRequests[n3] = settingMethodEntry(eventThreads[n3], testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<4; + break; + + case 5: + eRequests[n3] = settingMethodExit(eventThreads[n3], testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<5; + break; + + case 6: + eRequests[n3] = settingStep(eventThreads[n3], threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<6; + break; + + default: + throw new JDITestRuntimeException("** default case while prepareing requests**"); + } + } + + log2(":::::::::vm.resume();"); + vm.resume(); + + Event event1 = null; + int flagsCopy = flags; + String eName = null; + int index = 0; + + log2("......getting and checking up on Events"); + for (int n4 = 0; n4 < namesRef.length(); n4++) { + int flag; + + getEventSet(); + event1 = eventIterator.nextEvent(); + + if (event1 instanceof AccessWatchpointEvent) { + index = 0; + } else if (event1 instanceof ModificationWatchpointEvent ) { + index = 1; + } else if (event1 instanceof BreakpointEvent ) { + index = 2; + } else if (event1 instanceof ExceptionEvent ) { + index = 3; + } else if (event1 instanceof MethodEntryEvent ) { + index = 4; + } else if (event1 instanceof MethodExitEvent ) { + index = 5; + } else if (event1 instanceof StepEvent ) { + index = 6; + } else { + log3("ERROR: else clause in detecting type of event1"); + testExitCode = FAILED; + } + + flag = 1 << index; + if ((flagsCopy & flag) == 0) { + log3("ERROR: event duplication: " + eName); + testExitCode = FAILED; + } else { + flagsCopy ^= flag; + flags |= flag; + } + + eventSets[index] = eventSet; + } + + if (testExitCode == FAILED) + break; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest settingAccessWatchpoint ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property) + throws JDITestRuntimeException { + + log2("......setting up AccessWatchpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; fieldName: " + fieldName); + + AccessWatchpointRequest awRequest = null; + try { + Field field = testedClass.fieldByName(fieldName); + awRequest = eventRManager.createAccessWatchpointRequest(field); + awRequest.putProperty("number", property); + awRequest.addThreadFilter(thread); + awRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpoint() : " + e); + log3(" AN ACCESSWATCHPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up an AccessWatchpoint **"); + } + + log2(" an AccessWatchpoint has been set up"); + return awRequest; + } + + private ModificationWatchpointRequest settingModificationWatchpoint ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property) + throws JDITestRuntimeException { + + log2("......setting up ModificationWatchpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; fieldName: " + fieldName); + + ModificationWatchpointRequest mwRequest = null; + try { + Field field = testedClass.fieldByName(fieldName); + mwRequest = eventRManager.createModificationWatchpointRequest(field); + mwRequest.putProperty("number", property); + mwRequest.addThreadFilter(thread); + mwRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpoint() : " + e); + log3(" AN ModificationWATCHPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up an AccessWatchpoint **"); + } + + log2(" a ModificationWatchpoint has been set up"); + return mwRequest; + } + + private MethodEntryRequest settingMethodEntry ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up MethodEntry:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + MethodEntryRequest menRequest = null; + try { + menRequest = eventRManager.createMethodEntryRequest(); + menRequest.putProperty("number", property); + menRequest.addThreadFilter(thread); + menRequest.addClassFilter(testedClass); + menRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntry() : " + e); + log3(" A MethodEntry HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a MethodEntry **"); + } + + log2(" a MethodEntry has been set up"); + return menRequest; + } + + private MethodExitRequest settingMethodExit ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up MethodExit:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + MethodExitRequest mexRequest = null; + try { + mexRequest = eventRManager.createMethodExitRequest(); + mexRequest.putProperty("number", property); + mexRequest.addThreadFilter(thread); + mexRequest.addClassFilter(testedClass); + mexRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExit() : " + e); + log3(" A MethodExit HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a MethodExit **"); + } + + log2(" a MethodExit has been set up"); + return mexRequest; + } + + private StepRequest settingStep ( ThreadReference thread, String property) + throws JDITestRuntimeException { + + log2("......setting up Step:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest stRequest = null; + try { + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + stRequest.putProperty("number", property); + stRequest.addCountFilter(1); + stRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStep() : " + e); + log3(" A Step HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a Step **"); + } + + log2(" a Step has been set up"); + return stRequest; + } + + + private ExceptionRequest settingException ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up Exception:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + ExceptionRequest excRequest = null; + try { + excRequest = eventRManager.createExceptionRequest(null, true, true); + excRequest.putProperty("number", property); + excRequest.addThreadFilter(thread); + excRequest.addClassFilter(testedClass); + excRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingException() : " + e); + log3(" A Exception HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a Exception **"); + } + + log2(" a Exception has been set up"); + return excRequest; + } + + private void check() { + + EventSet evSet = null; + EventIterator evI = null; + EventRequest eR = null; + + log2("......performing the check;"); + for (int k = 0; k < eventFlags.length; k++) { + + switch (eventFlags[k]) { + + case 0: + evSet = eventSets[k]; + evI = evSet.eventIterator(); + if (eRequests[k].equals(evI.nextEvent().request())) + break; + testExitCode = FAILED; + log3("ERROR: eventRequest is not equal to event.request() : k == " + k); + break; + + + case 1: + evSet = eventSets[k]; + evI = evSet.eventIterator(); + if (evI.nextEvent().request() == null) + break; + testExitCode = FAILED; + log3("ERROR: event.request() != null : k == " + k); + break; + + case 2: + evSet = eventSets[k]; + evI = evSet.eventIterator(); + try { + eR = evI.nextEvent().request(); + if (eR == null) { + if ( !eRequests[k].equals(evI.nextEvent().request()) ) { + testExitCode = FAILED; + log3("ERROR: eventRequest is not equal to event.request() : k == " + k); + } + } else { + if ( !eRequests[k].equals(eR) ) { + testExitCode = FAILED; + log3("ERROR: eventRequest is not equal to event.request() : k == " + k); + } else if (evI.nextEvent().request() != null) { + testExitCode = FAILED; + log3("ERROR: eventRequest != null : k == " + k); + } + } + } catch ( Exception e ) { + log3("ERROR: Unexpected Exception : " + e + " :: k == " + k); + testExitCode = FAILED; + } + break; + + case 3: + break; + + default: + log3("ERROR: unexpected default case"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** FAILURE within check() **"); + } + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001/TestDescription.java new file mode 100644 index 00000000000..d584f6f72ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001/TestDescription.java @@ -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/Event/request/request001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Event. + * The test checks up that a result of the method + * com.sun.jdi.Event.request() + * complies with its spec: + * public EventRequest request() + * Returns: The EventRequest that requested this event. + * Some events (eg. VMDeathEvent) may not have a corresponding + * request and thus will return null. + * Cases to check don't include only ClassUnloadEvent. + * The test works as follows: + * The debugger program - nsk.jdi.Event.request.request001; + * the debuggee program - nsk.jdi.Event.request.request001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Fixed due to the bug 4528893. + * Test fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - binder.bindToDebugeeNoWait() is used to prevent Binder from + * handling VMStartEvent + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Event.request.request001 + * nsk.jdi.Event.request.request001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Event.request.request001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001a.java new file mode 100644 index 00000000000..ee7ebdac432 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/request/request001a.java @@ -0,0 +1,297 @@ +/* + * 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.Event.request; + +import nsk.share.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the request001 JDI test. + */ + +public class request001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass tcObject = new TestClass(); + + static String threadNames[] = { + "awThread", "mwThread", "bpThread", "excThread", + "menThread", "mexThread", "stThread" + }; + + static int threadsN = threadNames.length; + + static Thread threads[] = new Thread[threadsN]; + + static Thread thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread2 = new Thread3request001a("thread2"); + threadStart(thread2); + try { + // we should wait here for thread2 completion (see 6671428) + thread2.join(); + } catch (InterruptedException e) { + logErr("ERROR: unexpected exception: " + e); + exitCode = FAILED; + break ; + } + + for (int n1 = 0; n1 < threadsN; n1++) { + if (n1 < threadsN-1) + threads[n1] = new Thread1request001a(threadNames[n1]); + else + threads[n1] = new Thread2request001a(threadNames[n1]); + } + log1(" threads has been created"); + + synchronized (lockingObject2) { + log1(" loop: threadStart(threads[n2])"); + for (int n2 = 0; n2 < threadsN; n2++) + if ( threadStart(threads[n2]) != PASSED ) + break label0; + + log1(" methodForCommunication();"); + methodForCommunication(); + } + + for (int n2 = 0; n2 < threadsN; n2++) { + synchronized (locks[n2]) { + log1(" synchronized (locks[n2]) : n2 == " + n2); + } + } + + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + public static void nullMethod() { + throw new NullPointerException("test"); + } + + static Object lockingObject2 = new Object(); + static Object locks[] = new Object[threadsN]; + + static volatile int n = 0; + + static class Thread1request001a extends Thread { + + int threadIndex; + + public Thread1request001a(String threadName) { + super(threadName); + threadIndex = n; + locks[threadIndex] = new Object(); + n++; + } + + public void run() { + log3(" 'run': enter :: threadIndex == " + threadIndex); + + synchronized (locks[threadIndex]) { + log3("enter synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + TestClass.method(); + } + log3("exit synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + } + return; + } + + } + + static class Thread2request001a extends Thread { + + int threadIndex; + + public Thread2request001a(String threadName) { + super(threadName); + threadIndex = n; + locks[threadIndex] = new Object(); + n++; + } + + public void run() { + log3(" 'run': enter :: threadIndex == " + threadIndex); + + synchronized (locks[threadIndex]) { + log3("enter synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + m1(); + log3("exit synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + } + return; + } + + private void m1() { + synchronized (lockingObject2) { + log3(" 'm1': enter"); + + log3(" 'm1': exit"); + } + } + + } + + static class Thread3request001a extends Thread { + + String tName = null; + + public Thread3request001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log3(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit :: threadName == " + tName); + } + } + + + public static void log3(String str) { + log1(Thread.currentThread().getName() + " : " + str); + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 += 1; + var3 += 1; + var2 = var3; + try { + request001a.nullMethod(); + } catch ( NullPointerException e ) { + request001a.log3(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001.java new file mode 100644 index 00000000000..d82d4037c56 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001.java @@ -0,0 +1,938 @@ +/* + * 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.EventIterator.nextEvent; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventIterator.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventIterator.nextEvent()
    + * complies with its spec.
    + *
    + * For each type of Events except for ClassUnloadEvent,
    + * the cases to check are as follows:
    + * - the method returns Event object if there is an Event to return;
    + * - NoSuchElementException is thrown if no more events to return;
    + * - doesn't throw other Exceptions.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it saves its EventSet into
    + * a special array and makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger saves its EventSet into the array and
    + * sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase the debugger and the debuggee perform the following.
    + * - The debugger creates ThreadStartRequest and ThreadDeathRequest,
    + * resumes the debuggee, and
    + * waits for corresponding ThreadStartEvent and ThreadDeathEvent.
    + * - The debuggee creates new thread, named "thread2",
    + * whose running creates the above events.
    + * - Upon getting the events, the debugger saves their sets in the array,
    + * resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a number of threads, one for each
    + * following event: AccessWatchpoint, ModificationWatchpoint,
    + * MethodEntry, MethodExit, Step, Exception, and Breakpoint,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointForCommunication, the debugger
    + * gets ThreadReferences mirroring all tested threads in the debuggee,
    + * sets up Requests within them to get EventSets to check up on,
    + * resumes the debuggee, waits for events, and upon getting them,
    + * saves its EventSets into the array.
    + *
    + * In third phase,at the end
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and ends.
    + * The debugger waits for VMDeathEvent and VMDisconnectEvent, and
    + * upon getting them, saves their EventSets into the array.
    + * Finally, the debugger, using the array of EventSets,
    + * checks up on their EventIterators.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class nextevent001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventIterator/nextEvent/nextevent001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new nextevent001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventIterator.nextEvent.nextevent001a"; + + private String testedClassName = + "nsk.jdi.EventIterator.nextEvent.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + // Event #: + // 0-6 : AccessWatchpoint, ModificationWatchpoint, Breakpoint, Exception, + // MethodEntry, MethodExit, Step + // 7-8 : ClassPrepare, ClassUnload + // 9-10 : ThreadDeath, ThreadStart + // 11-13 : VMDeath, VMDisconnect, VMStart + + EventSet eventSets[] = new EventSet [14]; + EventRequest eRequests[] = new EventRequest[14]; + + int eventFlags[] = { 0,0,0,0, 0,0,0,0, 3,0,0,0, 1,1 }; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugeeNoWait(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugeeNoWait(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + log2("waiting for VMStartEvent"); + getEventSet(); +// + eventSets[13] = eventSet; + if (eventIterator.nextEvent() instanceof VMStartEvent) { + log2("VMStartEvent received; test begins"); + + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + eventSets[11] = eventSet; + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); +// + eventSets[12] = eventSet; + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + check(); + return 0; + } else { + log3("ERROR: first event is not the VMStartEvent"); + return 1; + } + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + log2("......setting up ClassPrepareRequest"); + eRequests[7] = cpRequest; + + cpRequest.enable(); + vm.resume(); + + getEventSet(); + eventSets[7] = eventSet; + + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + { + log2("......setting up ThreadStartRequest"); + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr.putProperty("number", "ThreadStartRequest"); + tsr.enable(); + + eRequests[10] = tsr; + + log2("......setting up ThreadDeathRequest"); + ThreadDeathRequest tdr = eventRManager.createThreadDeathRequest(); + tdr.addCountFilter(1); + tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr.putProperty("number", "ThreadDeathRequest"); + tdr.enable(); + + eRequests[9] = tdr; + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ThreadStartEvent"); + getEventSet(); + eventSets[10] = eventSet; + + Event receivedEvent = eventIterator.nextEvent(); + if ( !(receivedEvent instanceof ThreadStartEvent) ) { + testExitCode = FAILED; + log3("ERROR: new event is not ThreadStartEvent: " + receivedEvent); + return; + } + tsr.disable(); + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ThreadDeathEvent"); + getEventSet(); + eventSets[9] = eventSet; + receivedEvent = eventIterator.nextEvent(); + if ( !(receivedEvent instanceof ThreadDeathEvent) ) { + testExitCode = FAILED; + log3("ERROR: new event is not ThreadDeathEvent: " + receivedEvent); + return; + } + tdr.disable(); + } + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String bpLineName = "breakpointLine"; + String bpMethodName = "method"; + String awFieldName = "awFieldName"; + String mwFieldName = "mwFieldName"; + + String namesArray = "threadNames"; + + String threadNames[] = { + "awThread" , + "mwThread" , + "bpThread" , + "excThread" , + "menThread" , + "mexThread" , + "stThread" + }; + + int flags = 0; + + ThreadReference eventThreads[] = new ThreadReference[threadNames.length]; + + + List allThreads = vm.allThreads(); + + log2("......getting: ArrayReference namesRef = (ArrayReference) debuggeeClass.getValue(debuggeeClass.fieldByName(namesArray));"); + ArrayReference namesRef = (ArrayReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(namesArray)); + log2(" namesRef.length() == " + namesRef.length()); + + log2("......getting and chcking up on debuggee threads' names"); + for (int n1 = 0; n1 < namesRef.length(); n1++) { + + log2(" String name = ((StringReference) namesRef.getValue(n1)).value();"); + String name = ((StringReference) namesRef.getValue(n1)).value(); + + label0: { + for (int n2 = 0; n2 < threadNames.length; n2++) { + + if (name.equals(threadNames[n2])) { + ListIterator li = allThreads.listIterator(); + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) { + eventThreads[n1] = thread; + break; + } + } + break label0; + } + } + testExitCode = FAILED; + log3("ERROR: no thread found in the debuggee : " + name); + } + } + if (testExitCode == FAILED) + break; + + + log2("......ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0);"); + ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0); + + log2("......setting up Requests"); + for ( int n3 = 0; n3 < namesRef.length(); n3++) { + switch (n3) { + case 0: + if (vm.canWatchFieldAccess()) { + String awName = ( (StringReference) testClass.getValue( + testClass.fieldByName(awFieldName))).value(); + eRequests[n3] = settingAccessWatchpoint(eventThreads[n3], + testClass, awName, threadNames[n3]); + eRequests[n3].enable(); + flags |= 1; + } + break; + + case 1: + if (vm.canWatchFieldModification() ) { + String mwName = ( (StringReference) testClass.getValue( + testClass.fieldByName(mwFieldName))).value(); + eRequests[n3] = settingModificationWatchpoint(eventThreads[n3], + testClass, mwName, threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<1; + } + break; + + case 2: + eRequests[n3] = settingBreakpoint(eventThreads[n3], testClass, + bpMethodName, bpLineName, threadNames[n3]); + eRequests[n3].setSuspendPolicy( EventRequest.SUSPEND_NONE); + eRequests[n3].enable(); + flags |= 1<<2; + break; + + case 3: + eRequests[n3] = settingException(eventThreads[n3], debuggeeClass, //testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<3; + break; + + case 4: + eRequests[n3] = settingMethodEntry(eventThreads[n3], testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<4; + break; + + case 5: + eRequests[n3] = settingMethodExit(eventThreads[n3], testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<5; + break; + + case 6: + eRequests[n3] = settingStep(eventThreads[n3], threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<6; + break; + + default: + throw new JDITestRuntimeException("** default case while prepareing requests**"); + } + } + + log2(":::::::::vm.resume();"); + vm.resume(); + + Event event1 = null; + int flagsCopy = flags; + String eName = null; + int index = 0; + + log2("......getting and checking up on Events"); + for (int n4 = 0; n4 < namesRef.length(); n4++) { + int flag; + + getEventSet(); + event1 = eventIterator.nextEvent(); + + if (event1 instanceof AccessWatchpointEvent) { + index = 0; + } else if (event1 instanceof ModificationWatchpointEvent ) { + index = 1; + } else if (event1 instanceof BreakpointEvent ) { + index = 2; + } else if (event1 instanceof ExceptionEvent ) { + index = 3; + } else if (event1 instanceof MethodEntryEvent ) { + index = 4; + } else if (event1 instanceof MethodExitEvent ) { + index = 5; + } else if (event1 instanceof StepEvent ) { + index = 6; + } else { + log3("ERROR: else clause in detecting type of event1"); + testExitCode = FAILED; + } + + flag = 1 << index; + if ((flagsCopy & flag) == 0) { + log3("ERROR: event duplication: " + eName); + testExitCode = FAILED; + } else { + flagsCopy ^= flag; + flags |= flag; + } + + eventSets[index] = eventSet; + } + + if (testExitCode == FAILED) + break; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest settingAccessWatchpoint ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property) + throws JDITestRuntimeException { + + log2("......setting up AccessWatchpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; fieldName: " + fieldName); + + AccessWatchpointRequest awRequest = null; + try { + Field field = testedClass.fieldByName(fieldName); + awRequest = eventRManager.createAccessWatchpointRequest(field); + awRequest.putProperty("number", property); + awRequest.addThreadFilter(thread); + awRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpoint() : " + e); + log3(" AN ACCESSWATCHPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up an AccessWatchpoint **"); + } + + log2(" an AccessWatchpoint has been set up"); + return awRequest; + } + + private ModificationWatchpointRequest settingModificationWatchpoint ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property) + throws JDITestRuntimeException { + + log2("......setting up ModificationWatchpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; fieldName: " + fieldName); + + ModificationWatchpointRequest mwRequest = null; + try { + Field field = testedClass.fieldByName(fieldName); + mwRequest = eventRManager.createModificationWatchpointRequest(field); + mwRequest.putProperty("number", property); + mwRequest.addThreadFilter(thread); + mwRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpoint() : " + e); + log3(" AN ModificationWATCHPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up an AccessWatchpoint **"); + } + + log2(" a ModificationWatchpoint has been set up"); + return mwRequest; + } + + private MethodEntryRequest settingMethodEntry ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up MethodEntry:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + MethodEntryRequest menRequest = null; + try { + menRequest = eventRManager.createMethodEntryRequest(); + menRequest.putProperty("number", property); + menRequest.addThreadFilter(thread); + menRequest.addClassFilter(testedClass); + menRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntry() : " + e); + log3(" A MethodEntry HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a MethodEntry **"); + } + + log2(" a MethodEntry has been set up"); + return menRequest; + } + + private MethodExitRequest settingMethodExit ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up MethodExit:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + MethodExitRequest mexRequest = null; + try { + mexRequest = eventRManager.createMethodExitRequest(); + mexRequest.putProperty("number", property); + mexRequest.addThreadFilter(thread); + mexRequest.addClassFilter(testedClass); + mexRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExit() : " + e); + log3(" A MethodExit HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a MethodExit **"); + } + + log2(" a MethodExit has been set up"); + return mexRequest; + } + + private StepRequest settingStep ( ThreadReference thread, String property) + throws JDITestRuntimeException { + + log2("......setting up Step:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest stRequest = null; + try { + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + stRequest.putProperty("number", property); + stRequest.addCountFilter(1); + stRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStep() : " + e); + log3(" A Step HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a Step **"); + } + + log2(" a Step has been set up"); + return stRequest; + } + + + private ExceptionRequest settingException ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up Exception:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + ExceptionRequest excRequest = null; + try { + excRequest = eventRManager.createExceptionRequest(null, true, true); + excRequest.putProperty("number", property); + excRequest.addThreadFilter(thread); + excRequest.addClassFilter(testedClass); + excRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingException() : " + e); + log3(" A Exception HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a Exception **"); + } + + log2(" a Exception has been set up"); + return excRequest; + } + + private void checkingEventIterator(EventIterator eIterator) { + + log2("......checking up on eIterator.nextEvent()"); + + try { + log2("......first time: Event testedEvent = eIterator.nextEvent();"); + log2(" no Exception to be thrown is expected"); + Event testedEvent = eIterator.nextEvent(); + } catch (Exception e) { + log3("ERROR: Exception while: testedEvent = eIterator.nextEvent(); :: " + e); + testExitCode = FAILED; + } + try { + log2("......second time: Event testedEvent = eIterator.nextEvent();"); + log2(" NoSuchElementException is expected"); + Event testedEvent = eIterator.nextEvent(); + log3("ERROR: no NoSuchElementException while: testedEvent = eIterator.nextEvent();"); + testExitCode = FAILED; + } catch (NoSuchElementException e) { + log2(" NoSuchElementException"); + } catch (Exception e) { + log3("ERROR: unexpected Exception :: " + e); + testExitCode = FAILED; + } + } + + private void check() { + + log2("......performing the check;"); + for (int k = 0; k < eventFlags.length; k++) { + + log2("......new check case :: k == " + k); + switch (eventFlags[k]) { + + case 0: + case 1: + case 2: + checkingEventIterator(eventSets[k].eventIterator()); + break; + + case 3: + break; + + default: + log3("ERROR: unexpected default case"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** FAILURE within check() **"); + } + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001/TestDescription.java new file mode 100644 index 00000000000..88d9134e0c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001/TestDescription.java @@ -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/EventIterator/nextEvent/nextevent001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventIterator. + * The test checks up that a result of the method + * com.sun.jdi.EventIterator.nextEvent() + * complies with its spec: + * public Event nextEvent() + * Returns: + * The next Event in an EventSet. + * The cases to check include normal return and + * throwing no Exceptions but NoSuchElementException. + * The test works as follows: + * The debugger program - nsk.jdi.EventIterator.nextEvent.nextevent001; + * the debuggee program - nsk.jdi.EventIterator.nextEvent.nextevent001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Fixed due to the bug 4528893. + * Test fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - binder.bindToDebugeeNoWait() is used to prevent Binder from + * handling VMStartEvent + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventIterator.nextEvent.nextevent001 + * nsk.jdi.EventIterator.nextEvent.nextevent001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventIterator.nextEvent.nextevent001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001a.java new file mode 100644 index 00000000000..a1bab604101 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventIterator/nextEvent/nextevent001a.java @@ -0,0 +1,297 @@ +/* + * 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.EventIterator.nextEvent; + +import nsk.share.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the nextevent001 JDI test. + */ + +public class nextevent001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass tcObject = new TestClass(); + + static String threadNames[] = { + "awThread", "mwThread", "bpThread", "excThread", + "menThread", "mexThread", "stThread" + }; + + static int threadsN = threadNames.length; + + static Thread threads[] = new Thread[threadsN]; + + static Thread thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread2 = new Thread3nextevent001a("thread2"); + threadStart(thread2); + try { + // we should wait here for thread2 completion (see 6671428) + thread2.join(); + } catch (InterruptedException e) { + logErr("ERROR: unexpected exception: " + e); + exitCode = FAILED; + break ; + } + + for (int n1 = 0; n1 < threadsN; n1++) { + if (n1 < threadsN-1) + threads[n1] = new Thread1nextevent001a(threadNames[n1]); + else + threads[n1] = new Thread2nextevent001a(threadNames[n1]); + } + log1(" threads has been created"); + + synchronized (lockingObject2) { + log1(" loop: threadStart(threads[n2])"); + for (int n2 = 0; n2 < threadsN; n2++) + if ( threadStart(threads[n2]) != PASSED ) + break label0; + + log1(" methodForCommunication();"); + methodForCommunication(); + } + + for (int n2 = 0; n2 < threadsN; n2++) { + synchronized (locks[n2]) { + log1(" synchronized (locks[n2]) : n2 == " + n2); + } + } + + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + public static void nullMethod() { + throw new NullPointerException("test"); + } + + static Object lockingObject2 = new Object(); + static Object locks[] = new Object[threadsN]; + + static volatile int n = 0; + + static class Thread1nextevent001a extends Thread { + + int threadIndex; + + public Thread1nextevent001a(String threadName) { + super(threadName); + threadIndex = n; + locks[threadIndex] = new Object(); + n++; + } + + public void run() { + log3(" 'run': enter :: threadIndex == " + threadIndex); + + synchronized (locks[threadIndex]) { + log3("enter synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + TestClass.method(); + } + log3("exit synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + } + return; + } + + } + + static class Thread2nextevent001a extends Thread { + + int threadIndex; + + public Thread2nextevent001a(String threadName) { + super(threadName); + threadIndex = n; + locks[threadIndex] = new Object(); + n++; + } + + public void run() { + log3(" 'run': enter :: threadIndex == " + threadIndex); + + synchronized (locks[threadIndex]) { + log3("enter synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + m1(); + log3("exit synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + } + return; + } + + private void m1() { + synchronized (lockingObject2) { + log3(" 'm1': enter"); + + log3(" 'm1': exit"); + } + } + + } + + static class Thread3nextevent001a extends Thread { + + String tName = null; + + public Thread3nextevent001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log3(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit :: threadName == " + tName); + return; + } + } + + + public static void log3(String str) { + log1(Thread.currentThread().getName() + " : " + str); + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 += 1; + var3 += 1; + var2 = var3; + try { + nextevent001a.nullMethod(); + } catch ( NullPointerException e ) { + nextevent001a.log3(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001.java new file mode 100644 index 00000000000..9e066b30998 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001.java @@ -0,0 +1,139 @@ +/* + * 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.EventQueue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class hashcode001 { + + //------------------------------------------------------- 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.EventQueue.hashCode."; + private final static String className = "hashcode001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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() { + + display("Checking hashCode() method for EventQueue object"); + + EventQueue eventQueue = debuggee.VM().eventQueue(); + int hCode = eventQueue.hashCode(); + + if (hCode == 0) { + complain("hashCode() returns 0 for EventQueue object"); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = eventQueue.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for EventQueue object" + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + // get new reference to the same EventQueue and get hash code. + hCode1 = debuggee.VM().eventQueue().hashCode(); + if (hCode != hCode1) { + complain("hashCode() does not return same value for equal EventQueue object " + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns for EventQueue object : " + hCode); + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..ca9c1a7722b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/EventQueue/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.event.EventQueue interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during + * an execution of a Java application, the hashCode method must + * consistently return the same integer, provided no information used + * in equals comparisons on the object is modified. + * ... + * - If two objects are equal according to the equals(Object) method, + * then calling the hashCode method on each of the two objects must + * produce the same integer result. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for EventQueue + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.hashCode.hashcode001 + * nsk.jdi.EventQueue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..f5511cfba25 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001a.java @@ -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.EventQueue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ 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); + try { + pipe.println(hashcode001.SIGNAL_READY); + receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001.java new file mode 100644 index 00000000000..182b4723143 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001.java @@ -0,0 +1,138 @@ +/* + * 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.EventQueue.remove; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove() + * will always be preceded by a VMDisconnectEvent + * when a debuggee part of the test normally exits. + */ +public class remove001 { + 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.EventQueue.remove.remove001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private int tot_res = FAILED; + + 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 remove001().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + debuggee.redirectStderr(log, "remove001t.err> "); +// dummy IOPipe: just to avoid: +// "Pipe server socket listening error: java.net.SocketException" + IOPipe pipe = debuggee.createIOPipe(); + +// Getting JDI events + checkEvents(debuggee.VM().eventQueue()); + + 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; + } + + private void checkEvents(EventQueue eventQ) { + boolean gotVMDisconnect = false; // VMDisconnectEvent is received + boolean gotVMDeath = false; // VMDeathEvent is received + EventSet eventSet = null; + + debuggee.resume(); + while (true) { + try { + eventSet = eventQ.remove(); + EventIterator eventIter = eventSet.eventIterator(); + while (eventIter.hasNext()) { + Event event = eventIter.nextEvent(); + if (event instanceof VMDisconnectEvent) { + gotVMDisconnect = true; + log.display("Got expected VMDisconnectEvent"); + break; + } else if (event instanceof VMStartEvent) { + log.display("Got VMStartEvent"); + } else if (event instanceof VMDeathEvent) { + gotVMDeath = true; + log.display("Got VMDeathEvent"); + } + if (!gotVMDisconnect && !gotVMDeath && + eventSet.suspendPolicy() != + EventRequest.SUSPEND_NONE) { + log.display("Calling EventSet.resume() ..."); + eventSet.resume(); + } + } + } catch(InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + tot_res = FAILED; + } catch(VMDisconnectedException e) { + if (gotVMDisconnect) { + log.display("\nCHECK PASSED: caught VMDisconnectedException preceded by a VMDisconnectEvent\n"); + tot_res = PASSED; + } else { + log.complain("\nTEST FAILED: caught VMDisconnectedException without preceding VMDisconnectEvent\n"); + e.printStackTrace(); + tot_res = FAILED; + } + break; + } + } + log.display("Stopped JDI events processing"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001/TestDescription.java new file mode 100644 index 00000000000..ed423ccf0c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001/TestDescription.java @@ -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/EventQueue/remove/remove001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove() + * will always be preceded by a VMDisconnectEvent when + * a debuggee part of the test normally exits. + * COMMENTS + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume for VMDeathEvent is skipped in event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove.remove001 + * nsk.jdi.EventQueue.remove.remove001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove.remove001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001t.java new file mode 100644 index 00000000000..38d821ea301 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove001t.java @@ -0,0 +1,45 @@ +/* + * 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.EventQueue.remove; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee part of the test. + */ +public class remove001t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = argHandler.createDebugeeLog(); +// dummy IOPipe: just to avoid: +// "Pipe server socket listening error: java.net.SocketException" + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + log.display("Debuggee: exiting"); + System.exit(remove001.JCK_STATUS_BASE + + remove001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002.java new file mode 100644 index 00000000000..7ebe2fb8b5d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002.java @@ -0,0 +1,179 @@ +/* + * 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.EventQueue.remove; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove() + * will be preceded by a VMDisconnectEvent + * after com.sun.jdi.VirtualMachine.dispose() call. + */ +public class remove002 { + 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.EventQueue.remove.remove002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private CheckEvents chkEvents; + private EventQueue eventQ; + private volatile int tot_res = FAILED; + + 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 remove002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + debuggee.redirectStderr(log, "remove002t.err> "); + pipe = debuggee.createIOPipe(); + VirtualMachine vm = debuggee.VM(); + + eventQ = vm.eventQueue(); + chkEvents = new CheckEvents(); + chkEvents.setDaemon(true); + chkEvents.start(); + + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = FAILED; + return quitDebuggee(FAILED); + } + + log.display("Invoking VirtualMachine.dispose() ..."); + vm.dispose(); + + return quitDebuggee(PASSED); + } + + class CheckEvents extends Thread { + public void run() { + boolean gotVMDisconnect = false; // VMDisconnectEvent is received + boolean gotVMDeath = false; // VMDeathEvent is received + EventSet eventSet = null; + + log.display("CheckEvents: starts JDI events processing"); + while (true) { + try { + eventSet = eventQ.remove(); + EventIterator eventIter = eventSet.eventIterator(); + while (eventIter.hasNext()) { + Event event = eventIter.nextEvent(); + if (event instanceof VMDisconnectEvent) { + gotVMDisconnect = true; + log.display("CheckEvents: got expected VMDisconnectEvent"); + break; + } else if (event instanceof VMStartEvent) { + log.display("CheckEvents: got VMStartEvent"); + } else if (event instanceof VMDeathEvent) { + gotVMDeath = true; + log.display("CheckEvents: got VMDeathEvent"); + } + if (!gotVMDisconnect && !gotVMDeath && + eventSet.suspendPolicy() != + EventRequest.SUSPEND_NONE) { + log.display("CheckEvents: calling EventSet.resume() ..."); + eventSet.resume(); + } + } + } catch(InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + tot_res = FAILED; + } catch(VMDisconnectedException e) { + if (gotVMDisconnect) { + log.display("\nCHECK PASSED: caught expected VMDisconnectedException preceded by a VMDisconnectEvent\n"); + tot_res = PASSED; + } else { + log.complain("\nTEST FAILED: caught VMDisconnectedException without preceding VMDisconnectEvent\n"); + e.printStackTrace(); + tot_res = FAILED; + } + break; + } + } + log.display("CheckEvents: stopped JDI events processing"); + } + } + + private int quitDebuggee(int stat) { + if (chkEvents != null) { + try { + if (chkEvents.isAlive()) + chkEvents.join(argHandler.getWaitTime()*60000); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + + e); + tot_res = FAILED; + } + if (chkEvents.isAlive()) { + if (stat == PASSED) { + log.complain("TEST FAILED: CheckEvents thread is still alive,\n" + + "\tbut it should stop JDI events processing and exit"); + chkEvents.interrupt(); + 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002/TestDescription.java new file mode 100644 index 00000000000..78d4f7b1454 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002/TestDescription.java @@ -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/EventQueue/remove/remove002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove() + * will be preceded by a VMDisconnectEvent after + * com.sun.jdi.VirtualMachine.dispose() call. + * COMMENTS + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume for VMDeathEvent is skipped in event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove.remove002 + * nsk.jdi.EventQueue.remove.remove002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove.remove002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002t.java new file mode 100644 index 00000000000..5d5e50c080c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove002t.java @@ -0,0 +1,52 @@ +/* + * 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.EventQueue.remove; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee part of the test. + */ +public class remove002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + log.display("Debuggee: ready"); + pipe.println(remove002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(remove002.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd + "\nDebuggee: exiting"); + System.exit(remove002.JCK_STATUS_BASE + + remove002.FAILED); + } + log.display("Debuggee: exiting"); + System.exit(remove002.JCK_STATUS_BASE + + remove002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003.java new file mode 100644 index 00000000000..31fe659acad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003.java @@ -0,0 +1,179 @@ +/* + * 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.EventQueue.remove; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove() + * will be preceded by a VMDisconnectEvent + * after com.sun.jdi.VirtualMachine.exit() call. + */ +public class remove003 { + 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.EventQueue.remove.remove003t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private CheckEvents chkEvents; + private EventQueue eventQ; + private volatile int tot_res = FAILED; + + 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 remove003().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + debuggee.redirectStderr(log, "remove003t.err> "); + pipe = debuggee.createIOPipe(); + VirtualMachine vm = debuggee.VM(); + + eventQ = vm.eventQueue(); + chkEvents = new CheckEvents(); + chkEvents.setDaemon(true); + chkEvents.start(); + + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = FAILED; + return quitDebuggee(FAILED); + } + + log.display("Invoking VirtualMachine.exit() ..."); + vm.exit(JCK_STATUS_BASE + PASSED); + + return quitDebuggee(PASSED); + } + + class CheckEvents extends Thread { + public void run() { + boolean gotVMDisconnect = false; // VMDisconnectEvent is received + boolean gotVMDeath = false; // VMDeathEvent is received + EventSet eventSet = null; + + log.display("CheckEvents: starts JDI events processing"); + while (true) { + try { + eventSet = eventQ.remove(); + EventIterator eventIter = eventSet.eventIterator(); + while (eventIter.hasNext()) { + Event event = eventIter.nextEvent(); + if (event instanceof VMDisconnectEvent) { + gotVMDisconnect = true; + log.display("CheckEvents: got expected VMDisconnectEvent"); + break; + } else if (event instanceof VMStartEvent) { + log.display("CheckEvents: got VMStartEvent"); + } else if (event instanceof VMDeathEvent) { + gotVMDeath = true; + log.display("CheckEvents: got VMDeathEvent"); + } + if (!gotVMDisconnect && !gotVMDeath && + eventSet.suspendPolicy() != + EventRequest.SUSPEND_NONE) { + log.display("CheckEvents: calling EventSet.resume() ..."); + eventSet.resume(); + } + } + } catch(InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + tot_res = FAILED; + } catch(VMDisconnectedException e) { + if (gotVMDisconnect) { + log.display("\nCHECK PASSED: caught expected VMDisconnectedException preceded by a VMDisconnectEvent\n"); + tot_res = PASSED; + } else { + log.complain("\nTEST FAILED: caught VMDisconnectedException without preceding VMDisconnectEvent\n"); + e.printStackTrace(); + tot_res = FAILED; + } + break; + } + } + log.display("CheckEvents: stopped JDI events processing"); + } + } + + private int quitDebuggee(int stat) { + if (chkEvents != null) { + try { + if (chkEvents.isAlive()) + chkEvents.join(argHandler.getWaitTime()*60000); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + + e); + tot_res = FAILED; + } + if (chkEvents.isAlive()) { + if (stat == PASSED) { + log.complain("TEST FAILED: CheckEvents thread is still alive,\n" + + "\tbut it should stop JDI events processing and exit"); + chkEvents.interrupt(); + 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003/TestDescription.java new file mode 100644 index 00000000000..5ca2acd9784 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/EventQueue/remove/remove003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove() + * will be preceded by a VMDisconnectEvent after + * com.sun.jdi.VirtualMachine.exit() call. + * COMMENTS + * To fix the bug 4504397, + * the line 148 in the file remove003.java has been commented away. + * --------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume on VMDeathEvent is skipped in events handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove.remove003 + * nsk.jdi.EventQueue.remove.remove003t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove.remove003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003t.java new file mode 100644 index 00000000000..daf3f1b645a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove003t.java @@ -0,0 +1,52 @@ +/* + * 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.EventQueue.remove; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee part of the test. + */ +public class remove003t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + log.display("Debuggee: ready"); + pipe.println(remove003.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(remove003.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd + "\nDebuggee: exiting"); + System.exit(remove003.JCK_STATUS_BASE + + remove003.FAILED); + } + log.display("Debuggee: exiting"); + System.exit(remove003.JCK_STATUS_BASE + + remove003.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004.java new file mode 100644 index 00000000000..7f58fde7e14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004.java @@ -0,0 +1,522 @@ +/* + * 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.EventQueue.remove; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventQueue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.EventQueue.remove()
    + * complies with its spec.
    + *
    + * Since method's assertion is
    + * "Waits forever for the next available event."
    + * in the condition of a limited time for testing,
    + * the test case limits time for waiting for the next event
    + * to the standard value of WAITTIME set up in the testbase_nsk.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + * The check includes two steps.
    + * In first one, second thread waits for any incoming event from the
    + * debugger which is sleeping for "WAITTIME*90 seconds"; hence,
    + * no events are expected to be received at the debugger end.
    + * In second, second thread is interrupted, and the debugger waits for
    + * a breakpoint event after the debuggee finishes sleeping.
    + */ + +public class remove004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventQueue/remove/remove004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new remove004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventQueue.remove.remove004a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + vm.resume(); + + Threadremove004 thread2 = new Threadremove004("thread2"); + log2(" thread2 is created"); + + synchronized (lockingObject) { + synchronized (waitnotifyObj) { + log2(" before: thread2.start()"); + thread2.start(); + + try { + log2(" before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); + } catch ( Exception e) { + log3("ERROR: Exception : " + e ); + testExitCode = FAILED; + throw new JDITestRuntimeException("** Exception while waiting: notify() **"); + } + } + } + log2("mainThread is out of: synchronized (lockingObject)"); + + Object waitObj = new Object(); + + synchronized (waitObj) { + waitObj.wait(waitTime); + if (!thread2.isAlive()) { + log3("ERROR: thread2 is not alive"); + testExitCode = FAILED; + break; + } + + thread2.interrupt(); + + for (int i2 = 0; i2 < waitTime; ) { + waitObj.wait(10000); + if (!thread2.isAlive()) { + break; + } + i2 += 10000; + } + if (thread2.isAlive()) { + log3("ERROR: thread2 is still alive"); + testExitCode = FAILED; + break; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + + public static Object waitnotifyObj = new Object(); + public static Object lockingObject = new Object(); + + class Threadremove004 extends Thread { + + public Threadremove004(String threadName) { + super(threadName); + } + + public void run() { + log2("-----t2: method 'run' enter"); + synchronized (waitnotifyObj) { + log2("-----t2: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log2("-----t2: exited from block: synchronized (waitnotifyObj)"); + synchronized (lockingObject) { + log2("-----t2: entered into block: synchronized (lockingObject)"); + } + log2("-----t2: exited from block: synchronized (lockingObject)"); + + try { + log2("-----t2: eventSet = eventQueue.remove(); expects: InterruptedException"); + eventSet = eventQueue.remove(); + throw new JDITestRuntimeException("** return from eventQueue.remove(); **"); + } catch ( InterruptedException e1) { + log2("-----t2: InterruptedException"); + } catch ( Exception e ) { + log3("ERROR: -----t2: Exception : " + e); + testExitCode = FAILED; + } + + log2("-----t2: method 'run' exit"); + return; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004/TestDescription.java new file mode 100644 index 00000000000..e72bbd8b4ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004/TestDescription.java @@ -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/EventQueue/remove/remove004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventQueue. + * The test checks up that a result of the method + * com.sun.jdi.EventQueue.remove() + * complies with its spec: + * public EventSet remove() + * throws java.lang.InterruptedException + * Waits forever for the next available event. + * Returns: the next EventSet. + * Throws: java.lang.InterruptedException - + * if another thread has interrupted this thread. + * VMDisconnectedException - + * if the connection to the target VM is no longer available. + * Note this will always be preceded by a VMDisconnectEvent. + * The test checks the assertion + * "Waits forever for the next available event." + * in the condition of a limited time for testing. + * The test works as follows: + * The debugger program - nsk.jdi.EventQueue.remove.remove004; + * the debuggee program - nsk.jdi.EventQueue.remove.remove004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventQueue.remove.remove004 + * nsk.jdi.EventQueue.remove.remove004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove.remove004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004a.java new file mode 100644 index 00000000000..1d5c3d2f1c9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004a.java @@ -0,0 +1,118 @@ +/* + * 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.EventQueue.remove; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the remove004 JDI test. + */ + +public class remove004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + log1("before: methodForCommunication();"); + methodForCommunication(); + log1("before: Thread.sleep"); + try { + Thread.sleep(argHandler.getWaitTime()*90000); + } catch (InterruptedException e) { + } + log1("after: Thread.sleep"); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001.java new file mode 100644 index 00000000000..9a919ccfb1e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001.java @@ -0,0 +1,142 @@ +/* + * 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.EventQueue.remove_l; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove(long) + * will always be preceded by a VMDisconnectEvent + * when a debuggee part of the test normally exits. + */ +public class remove_l001 { + 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.EventQueue.remove_l.remove_l001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private int tot_res = FAILED; + + 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 remove_l001().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + debuggee.redirectStderr(log, "remove_l001t.err> "); +// dummy IOPipe: just to avoid: +// "Pipe server socket listening error: java.net.SocketException" + IOPipe pipe = debuggee.createIOPipe(); + +// Getting JDI events + checkEvents(debuggee.VM().eventQueue()); + + 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; + } + + private void checkEvents(EventQueue eventQ) { + boolean gotVMDisconnect = false; // VMDisconnectEvent is received + boolean gotVMDeath = false; // VMDeathEvent is received + EventSet eventSet = null; + + debuggee.resume(); + while (true) { + try { + eventSet = eventQ.remove(argHandler.getWaitTime()*60000); + if (eventSet == null) { + log.display("Specified time for the next available event has elapsed"); + continue; + } + EventIterator eventIter = eventSet.eventIterator(); + while (eventIter.hasNext()) { + Event event = eventIter.nextEvent(); + if (event instanceof VMDisconnectEvent) { + gotVMDisconnect = true; + log.display("Got expected VMDisconnectEvent"); + break; + } else if (event instanceof VMStartEvent) { + log.display("Got VMStartEvent"); + } else if (event instanceof VMDeathEvent) { + gotVMDeath = true; + log.display("Got VMDeathEvent"); + } + if (!gotVMDisconnect && !gotVMDeath && + eventSet.suspendPolicy() != + EventRequest.SUSPEND_NONE) { + log.display("Calling EventSet.resume() ..."); + eventSet.resume(); + } + } + } catch(InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + tot_res = FAILED; + } catch(VMDisconnectedException e) { + if (gotVMDisconnect) { + log.display("\nCHECK PASSED: caught VMDisconnectedException preceded by a VMDisconnectEvent\n"); + tot_res = PASSED; + } else { + log.complain("\nTEST FAILED: caught VMDisconnectedException without preceding VMDisconnectEvent\n"); + e.printStackTrace(); + tot_res = FAILED; + } + break; + } + } + log.display("Stopped JDI events processing"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001/TestDescription.java new file mode 100644 index 00000000000..304443ee49a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/EventQueue/remove_l/remove_l001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove(long) + * will always be preceded by a VMDisconnectEvent when + * a debuggee part of the test normally exits. + * COMMENTS + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume for VMDeathEvent is skipped in event handling loop + * Fixed misprint in package name according to test bug: + * 4782469 TEST_RFE: incorrect package name in some JPDA tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove_l.remove_l001 + * nsk.jdi.EventQueue.remove_l.remove_l001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove_l.remove_l001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001t.java new file mode 100644 index 00000000000..7daa68ce2ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l001t.java @@ -0,0 +1,45 @@ +/* + * 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.EventQueue.remove_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee part of the test. + */ +public class remove_l001t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = argHandler.createDebugeeLog(); +// dummy IOPipe: just to avoid: +// "Pipe server socket listening error: java.net.SocketException" + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + log.display("Debuggee: exiting"); + System.exit(remove_l001.JCK_STATUS_BASE + + remove_l001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002.java new file mode 100644 index 00000000000..bacc33886d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002.java @@ -0,0 +1,183 @@ +/* + * 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.EventQueue.remove_l; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove(long) + * will be preceded by a VMDisconnectEvent + * after com.sun.jdi.VirtualMachine.dispose() call. + */ +public class remove_l002 { + 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.EventQueue.remove_l.remove_l002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private CheckEvents chkEvents; + private EventQueue eventQ; + private volatile int tot_res = FAILED; + + 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 remove_l002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + debuggee.redirectStderr(log, "remove_l002t.err> "); + pipe = debuggee.createIOPipe(); + VirtualMachine vm = debuggee.VM(); + + eventQ = vm.eventQueue(); + chkEvents = new CheckEvents(); + chkEvents.setDaemon(true); + chkEvents.start(); + + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = FAILED; + return quitDebuggee(FAILED); + } + + log.display("Invoking VirtualMachine.dispose() ..."); + vm.dispose(); + + return quitDebuggee(PASSED); + } + + class CheckEvents extends Thread { + public void run() { + boolean gotVMDisconnect = false; // VMDisconnectEvent is received + boolean gotVMDeath = false; // VMDeathEvent is received + EventSet eventSet = null; + + log.display("CheckEvents: starts JDI events processing"); + while (true) { + try { + eventSet = eventQ.remove(argHandler.getWaitTime()*30000); + if (eventSet == null) { + log.display("CheckEvents: specified time for the next available event has elapsed"); + continue; + } + EventIterator eventIter = eventSet.eventIterator(); + while (eventIter.hasNext()) { + Event event = eventIter.nextEvent(); + if (event instanceof VMDisconnectEvent) { + gotVMDisconnect = true; + log.display("CheckEvents: got expected VMDisconnectEvent"); + break; + } else if (event instanceof VMStartEvent) { + log.display("CheckEvents: got VMStartEvent"); + } else if (event instanceof VMDeathEvent) { + log.display("CheckEvents: got VMDeathEvent"); + gotVMDeath = true; + } + if (!gotVMDisconnect && !gotVMDeath && + eventSet.suspendPolicy() != + EventRequest.SUSPEND_NONE) { + log.display("CheckEvents: calling EventSet.resume() ..."); + eventSet.resume(); + } + } + } catch(InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + tot_res = FAILED; + } catch(VMDisconnectedException e) { + if (gotVMDisconnect) { + log.display("\nCHECK PASSED: caught expected VMDisconnectedException preceded by a VMDisconnectEvent\n"); + tot_res = PASSED; + } else { + log.complain("\nTEST FAILED: caught VMDisconnectedException without preceding VMDisconnectEvent\n"); + e.printStackTrace(); + tot_res = FAILED; + } + break; + } + } + log.display("CheckEvents: stopped JDI events processing"); + } + } + + private int quitDebuggee(int stat) { + if (chkEvents != null) { + try { + if (chkEvents.isAlive()) + chkEvents.join(argHandler.getWaitTime()*60000); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + + e); + tot_res = FAILED; + } + if (chkEvents.isAlive()) { + if (stat == PASSED) { + log.complain("TEST FAILED: CheckEvents thread is still alive,\n" + + "\tbut it should stop JDI events processing and exit"); + chkEvents.interrupt(); + 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002/TestDescription.java new file mode 100644 index 00000000000..18204682e31 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/EventQueue/remove_l/remove_l002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove(long) + * will be preceded by a VMDisconnectEvent after + * com.sun.jdi.VirtualMachine.dispose() call. + * COMMENTS + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume on VMDeathEvent is skipped in events handling loop + * Fixed misprint in package name according to test bug: + * 4782469 TEST_RFE: incorrect package name in some JPDA tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove_l.remove_l002 + * nsk.jdi.EventQueue.remove_l.remove_l002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove_l.remove_l002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002t.java new file mode 100644 index 00000000000..976b29e5ac8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l002t.java @@ -0,0 +1,52 @@ +/* + * 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.EventQueue.remove_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee part of the test. + */ +public class remove_l002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + log.display("Debuggee: ready"); + pipe.println(remove_l002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(remove_l002.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd + "\nDebuggee: exiting"); + System.exit(remove_l002.JCK_STATUS_BASE + + remove_l002.FAILED); + } + log.display("Debuggee: exiting"); + System.exit(remove_l002.JCK_STATUS_BASE + + remove_l002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003.java new file mode 100644 index 00000000000..04d77fe829e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003.java @@ -0,0 +1,183 @@ +/* + * 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.EventQueue.remove_l; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove(int) + * will be preceded by a VMDisconnectEvent + * after com.sun.jdi.VirtualMachine.exit() call. + */ +public class remove_l003 { + 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.EventQueue.remove_l.remove_l003t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private CheckEvents chkEvents; + private EventQueue eventQ; + private volatile int tot_res = FAILED; + + 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 remove_l003().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + debuggee.redirectStderr(log, "remove_l003t.err> "); + pipe = debuggee.createIOPipe(); + VirtualMachine vm = debuggee.VM(); + + eventQ = vm.eventQueue(); + chkEvents = new CheckEvents(); + chkEvents.setDaemon(true); + chkEvents.start(); + + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = FAILED; + return quitDebuggee(FAILED); + } + + log.display("Invoking VirtualMachine.exit() ..."); + vm.exit(JCK_STATUS_BASE + PASSED); + + return quitDebuggee(PASSED); + } + + class CheckEvents extends Thread { + public void run() { + boolean gotVMDisconnect = false; // VMDisconnectEvent is received + boolean gotVMDeath = false; // VMDeathEvent is received + EventSet eventSet = null; + + log.display("CheckEvents: starts JDI events processing"); + while (true) { + try { + eventSet = eventQ.remove(argHandler.getWaitTime()*30000); + if (eventSet == null) { + log.display("CheckEvents: specified time for the next available event has elapsed"); + continue; + } + EventIterator eventIter = eventSet.eventIterator(); + while (eventIter.hasNext()) { + Event event = eventIter.nextEvent(); + if (event instanceof VMDisconnectEvent) { + gotVMDisconnect = true; + log.display("CheckEvents: got expected VMDisconnectEvent"); + break; + } else if (event instanceof VMStartEvent) { + log.display("CheckEvents: got VMStartEvent"); + } else if (event instanceof VMDeathEvent) { + gotVMDeath = true; + log.display("CheckEvents: got VMDeathEvent"); + } + if (!gotVMDisconnect && !gotVMDeath && + eventSet.suspendPolicy() != + EventRequest.SUSPEND_NONE) { + log.display("CheckEvents: calling EventSet.resume() ..."); + eventSet.resume(); + } + } + } catch(InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + tot_res = FAILED; + } catch(VMDisconnectedException e) { + if (gotVMDisconnect) { + log.display("\nCHECK PASSED: caught expected VMDisconnectedException preceded by a VMDisconnectEvent\n"); + tot_res = PASSED; + } else { + log.complain("\nTEST FAILED: caught VMDisconnectedException without preceding VMDisconnectEvent\n"); + e.printStackTrace(); + tot_res = FAILED; + } + break; + } + } + log.display("CheckEvents: stopped JDI events processing"); + } + } + + private int quitDebuggee(int stat) { + if (chkEvents != null) { + try { + if (chkEvents.isAlive()) + chkEvents.join(argHandler.getWaitTime()*60000); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + + e); + tot_res = FAILED; + } + if (chkEvents.isAlive()) { + if (stat == PASSED) { + log.complain("TEST FAILED: CheckEvents thread is still alive,\n" + + "\tbut it should stop JDI events processing and exit"); + chkEvents.interrupt(); + 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003/TestDescription.java new file mode 100644 index 00000000000..9be5d7ca6ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/EventQueue/remove_l/remove_l003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that a VMDisconnectedException thrown by + * the JDI method com.sun.jdi.request.EventQueue.remove(long) + * will be preceded by a VMDisconnectEvent after + * com.sun.jdi.VirtualMachine.exit() call. + * COMMENTS + * 1) + * To fix the bug 4504397, + * the line 152 in the file remove003.java has been commented away. + * 2) + * To put the name of the package in correspondence with the tesbase_nsk rules, + * EventQueue.remove is replaced with EventQueue.remove_l in the following files: + * - remove_l003.java, lines 5, 32; + * - remove_l003t.java, line 5; + * - remove_l003.cfg, line 4. + * --------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - resume on VMDeathEvent is skipped in events handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove_l.remove_l003 + * nsk.jdi.EventQueue.remove_l.remove_l003t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove_l.remove_l003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003t.java new file mode 100644 index 00000000000..caf8392767c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l003t.java @@ -0,0 +1,52 @@ +/* + * 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.EventQueue.remove_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee part of the test. + */ +public class remove_l003t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + log.display("Debuggee: ready"); + pipe.println(remove_l003.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(remove_l003.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd + "\nDebuggee: exiting"); + System.exit(remove_l003.JCK_STATUS_BASE + + remove_l003.FAILED); + } + log.display("Debuggee: exiting"); + System.exit(remove_l003.JCK_STATUS_BASE + + remove_l003.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004.java new file mode 100644 index 00000000000..d924cfe5cb7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004.java @@ -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.EventQueue.remove_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventQueue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.EventQueue.remove(int)
    + * complies with its spec.
    + *
    + * The test checks two assertions:
    + * - Returns: null if there is a timeout.
    + * - Returns: the next EventSet if no timeout.
    + * It uses the WAITTINE value which is the standard parameter for
    + * time intervals in the testbase_nsk.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee firstly invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * The case for testing consists of of two steps.
    + * In the first one the first assertion is checked up on as follows:
    + * the debugger sleeps for "WAITTIME * 90 sec";
    + * hence, no event is expected in the debugger within WAITTINE, and
    + * debugger's method breakpointForCommunication() should get null.
    + * After WAITTIME, the debugger just expects to get normal breakpoint event.
    + */ + +public class remove_l004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventQueue/remove_l/remove_l004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new remove_l004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventQueue.remove_l.remove_l004a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction != 1) { + testExitCode = FAILED; + throw new JDITestRuntimeException("** unexpected instruction **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + vm.resume(); + try { + log2("......invoking: getEventSet();"); + getEventSet(); + } catch ( JDITestRuntimeException e ) { + String str = e.getMessage(); + log2(" JDITestRuntimeException : " + str); + if (str.lastIndexOf("TIMEOUT") <0) { + log3("ERROR: no TIMEOUT"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** unexpected Exception **"); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log2("...... waiting for breakpoint event"); + + breakpointForCommunication(); + + instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction != 0) { + testExitCode = FAILED; + throw new JDITestRuntimeException("** unexpected instruction **"); + } + vm.resume(); + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004/TestDescription.java new file mode 100644 index 00000000000..710059e8351 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/EventQueue/remove_l/remove_l004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventQueue. + * The test checks up that a result of the method + * com.sun.jdi.EventQueue.remove_l() + * complies with its spec: + * public EventSet remove(long timeout) + * throws java.lang.InterruptedException + * Waits a specified time for the next available event. + * Parameters: timeout - Time in milliseconds to wait for the next event + * Returns: the next EventSet, or null if there is a timeout. + * Throws: java.lang.InterruptedException - + * if another thread has interrupted this thread. + * VMDisconnectedException - + * if the connection to the target VM is no longer available. + * Note this will always be preceded by a VMDisconnectEvent. + * The test checks two assertions: + * - Returns: null if there is a timeout. + * - Returns: the next EventSet if no timeout. + * The test works as follows: + * The debugger program - nsk.jdi.EventQueue.remove_l.remove_l004; + * the debuggee program - nsk.jdi.EventQueue.remove_l.remove_l004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventQueue.remove_l.remove_l004 + * nsk.jdi.EventQueue.remove_l.remove_l004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove_l.remove_l004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004a.java new file mode 100644 index 00000000000..8c0e2c3f032 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004a.java @@ -0,0 +1,118 @@ +/* + * 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.EventQueue.remove_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the remove_l004 JDI test. + */ + +public class remove_l004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + log1("before: methodForCommunication();"); + methodForCommunication(); + log1("before: Thread.sleep"); + try { + Thread.sleep(argHandler.getWaitTime()*90000); + } catch (InterruptedException e) { + } + log1("after: Thread.sleep"); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005.java new file mode 100644 index 00000000000..2d0ddbfc45d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005.java @@ -0,0 +1,163 @@ +/* + * 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.EventQueue.remove_l; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * Test check up this method for the following values: + * Long.MIN_VALUE, -1 and Long.MAX_VALUE. + * IllegalArgumentException is expected for negative values. + */ +public class remove_l005 { + private final static String prefix = "nsk.jdi.EventQueue.remove_l."; + private final static String debuggerName = prefix + "remove_l005"; + private final static String debugeeName = debuggerName + "a"; + + private final static String brkpMethodName = "run"; + private final static int brkpLineNumber = 61; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + public final static String SGNL_GO = "go"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static long waitTimes[] = { + Long.MIN_VALUE, + -1, + Long.MAX_VALUE + }; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + remove_l005 thisTest = new remove_l005(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType refType = debugee.classByName(debugeeName); + BreakpointRequest brkpReq = debugee.setBreakpoint(refType, brkpMethodName, brkpLineNumber); + + display("\nTEST BEGINS"); + display("==========="); + + Event event = null; + EventSet eventSet = null; + EventIterator eventIterator = null; + + debugee.sendSignal(SGNL_GO); + + for (int i = 0; i < waitTimes.length; i++) { + try { + display("invoking EventQueue.remove(" + waitTimes[i] + ")"); + eventSet = debugee.VM().eventQueue().remove(waitTimes[i]); + if (waitTimes[i] < 0) { + complain("No exception was thrown for negative argument: " + waitTimes[i]); + exitStatus = Consts.TEST_FAILED; + } else { + display("No exception was thrown for not-negative argument: " + waitTimes[i]); + } + if (eventSet != null) { + if (checkBrkpEvent(eventSet, brkpReq)) { + eventSet.resume(); + debugee.sendSignal(SGNL_GO); + } else { + eventSet.resume(); + } + } + } catch (IllegalArgumentException e1) { + if (waitTimes[i] < 0) { + display("Expected IllegalArgumentException was thrown for negative argument: " + waitTimes[i]); + } else { + complain("Unexpected IllegalArgumentException was thrown for not-negative argument: " + waitTimes[i]); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected exception was thrown for argument: " + waitTimes[i] + " :\n\t" + e ); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + display(""); + display("============="); + display("TEST FINISHES\n"); + + brkpReq.disable(); + debugee.resume(); + debugee.quit(); + } + + private boolean checkBrkpEvent(EventSet eventSet, BreakpointRequest brkpReq) { + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) { + EventRequest eventRequest = event.request(); + if (brkpReq.equals(eventRequest)) { + log.display("Got expected BreakpointEvent:\n\t" + event); + return true; + } + } + log.display("Ignore unexpected event:\n\t" + event); + } + return false; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005/TestDescription.java new file mode 100644 index 00000000000..6197ad3a371 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005/TestDescription.java @@ -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/EventQueue/remove_l/remove_l005. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-8068225 + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method + * com.sun.jdi.event.EventQueue.remove(long) + * for boundary value of parameters. + * Test check up this method for the following arguments: + * Long.MIN_VALUE, -1 and Long.MAX_VALUE. + * IllegalArgumentException is expected for negative arguments. + * COMMENTS: + * 4777928 TEST_BUG: two jdi tests should expect IllegalArgumentException + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - implicit handling VMStartEvent was removed from the debugger part of the test + * - BreakpointEvent is used instead for testing EventQueue.remove() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventQueue.remove_l.remove_l005 + * nsk.jdi.EventQueue.remove_l.remove_l005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventQueue.remove_l.remove_l005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005a.java new file mode 100644 index 00000000000..d149c74e430 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005a.java @@ -0,0 +1,64 @@ +/* + * 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.EventQueue.remove_l; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * remove_l005a is deugee's part of the remove_l005. + */ +public class remove_l005a { + private static Log log; + private static IOPipe pipe; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(remove_l005.SGNL_READY); + int status = run(); + System.exit(status + Consts.JCK_STATUS_BASE); + } + + public static int run() { + for (int i = 0; ; i++) { + String instr = pipe.readln(); + if (instr.equals(remove_l005.SGNL_GO)) { + log.display("Go for iteration #" + i); + } else if (instr.equals(remove_l005.SGNL_QUIT)) { + log.display("Quit iterations"); + return Consts.TEST_PASSED; + } else { + log.complain("Unexpected signal received: " + instr); + return Consts.TEST_FAILED; + } + + // next line is for breakpoint + log.display("Breakpoint line reached"); // remove_l005.brkpLineNumber + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001.java new file mode 100644 index 00000000000..4191640334f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001.java @@ -0,0 +1,172 @@ +/* + * 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.EventRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * + * The test checks up the methods of com.sun.jdi.EventRequest:
    + * 1. putProperty(Object, Object)
    + * 2. getProperty(Object)
    + * 3. setSuspendPolicy(int)
    + * to correctly work for boundary values of argument.
    + * + * The test performs the next testcases:
    + * 1. putProperty(null, String) - in this case it is + * expected property null with value of + * String will be created.
    + * No exception must be thrown. + * 2. getProperty(null) - value of String from + * the previous case is expected as return value. No exception must + * be thrown.
    + * 3. setSuspendPolicy(int) is checked for the next + * parameters: Integer.MIN_VALUE, -1, + * Integer.MAX_VALUE. IllegalArgumentException is expected.
    + */ + +public class eventrequest001 { + + private final static String prefix = "nsk.jdi.EventRequest._bounds_."; + private final static String debuggerName = prefix + "eventrequest001"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + public static int exitStatus; + public static Log log; + public static Debugee debugee; + + private static String propertyValue = "something"; + private static int policies[] = { + Integer.MIN_VALUE, + -1, + Integer.MAX_VALUE + }; + +//---------------------------------------------------- + + public static void display(String msg) { + log.display(msg); + } + + public static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + eventrequest001 thisTest = new eventrequest001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + ReferenceType testedClass = debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + eventrequest001a.brkpMethodName, + eventrequest001a.brkpLineNumber); + + display("\nTEST BEGINS"); + display("==========="); + + try { + display("setting property : value <" + propertyValue + ">"); + brkp.putProperty(null, propertyValue); + } catch (Exception e) { + complain("Unexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + Object obj = null; + try { + display("reading property :"); + obj = brkp.getProperty(null); + display("\t\t value : <" + obj + ">"); + } catch (Exception e) { + complain("Unexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + if (!obj.equals(propertyValue)) { + complain("Unexpected property value: " + obj); + exitStatus = Consts.TEST_FAILED; + } + + display(""); + for (int i = 0; i < policies.length; i++) { + display("invoking brkp.setSuspendPolicy(" + policies[i] + ")"); + brkp.disable(); + try { + brkp.setSuspendPolicy(policies[i]); + + complain("No exception was thrown for argument: " + policies[i]); + exitStatus = Consts.TEST_FAILED; + } catch (IllegalArgumentException e1) { + display("Expected IllegalArgumentException was thrown for argument: " + policies[i]); + } catch (Exception e) { + complain("Unexpected exception was thrown for argument: " + policies[i] + " :\n\t" + e ); + exitStatus = Consts.TEST_FAILED; + } + brkp.enable(); + display(""); + } + + // breakpoint should be disabled before test finishing + brkp.disable(); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001/TestDescription.java new file mode 100644 index 00000000000..929c94b2846 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001/TestDescription.java @@ -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/EventRequest/_bounds_/eventrequest001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods of com.sun.jdi.EventRequest: + * 1. putProperty(Object, Object) + * 2. getProperty(Object) + * 3. setSuspendPolicy(int) + * to correctly work for boundary values of argument. + * The test performs the next testcases: + * 1. putProperty(null, String) - in this case it is expected + * property with value of will be created. + * No exception must be thrown. + * 2. getProperty(null) - value of from the previous + * case is expected as return value. No exception must be thrown. + * 3. setSuspendPolicy(int) is checked for the next parameters: + * Integer.MIN_VALUE, -1, Integer.MAX_VALUE. IllegalArgumentException + * is expected. + * COMMENTS: + * 4777928 TEST_BUG: two jdi tests should expect IllegalArgumentException + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * Test fixed according to test bug: + * 4862601 TEST_BUG: JDI: Unexpected exception was thrown for argument: -2147483648 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest._bounds_.eventrequest001 + * nsk.jdi.EventRequest._bounds_.eventrequest001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest._bounds_.eventrequest001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001a.java new file mode 100644 index 00000000000..e672d6b21e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/_bounds_/eventrequest001a.java @@ -0,0 +1,56 @@ +/* + * 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.EventRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * eventrequest001a is deugee's part of the eventrequest001. + */ +public class eventrequest001a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 47; + private static Log log; + private static IOPipe pipe; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(eventrequest001.SGNL_READY); + String instr = pipe.readln(); // brkpLineNumber + if (instr.equals(eventrequest001.SGNL_QUIT)) { + log.display("constructor> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("constructor> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java new file mode 100644 index 00000000000..7ae39143415 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java @@ -0,0 +1,590 @@ +/* + * 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.EventRequest.addCountFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.addCountFilter()
    + * complies with its spec.
    + *
    + * The test checks up on following assertions:
    + * - Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * - Throws: IllegalArgumentException - if count is less than one.
    + * The cases to check include Requests of all sub-types.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class addcountfilter001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/addCountFilter/addcountfilter001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addcountfilter001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.addCountFilter.addcountfilter001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.addCountFilter.TestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + String propertyName = "name"; + String propertyValue1 = "value1"; + String propertyValue2 = "value2"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + try { + log2("......eventRequest1.addCountFilter(-1); IllegalArgumentException is expected"); + eventRequest1.addCountFilter(-1); + testExitCode = FAILED; + log3("ERROR: NO IllegalArgumentException"); + } catch ( IllegalArgumentException e ) { + log2(" IllegalArgumentException"); + } + + try { + log2("......eventRequest1.addCountFilter(0); IllegalArgumentException is expected"); + eventRequest1.addCountFilter(0); + testExitCode = FAILED; + log3("ERROR: NO IllegalArgumentException"); + } catch ( IllegalArgumentException e ) { + log2(" IllegalArgumentException"); + } + + try { + log2("......eventRequest1.addCountFilter(1); no IllegalArgumentException is expected"); + eventRequest1.addCountFilter(1); + log2(" no IllegalArgumentException"); + } catch ( IllegalArgumentException e ) { + testExitCode = FAILED; + log3("ERROR: IllegalArgumentException"); + } + + try { + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + log2(" eventRequest1.addCountFilter(1); InvalidRequestStateException is expected"); + eventRequest1.addCountFilter(1); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + try { + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + log2(" eventRequest1.addCountFilter(1); InvalidRequestStateException is expected"); + eventRequest1.addCountFilter(1); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001/TestDescription.java new file mode 100644 index 00000000000..25705171bf2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/EventRequest/addCountFilter/addcountfilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.addCountFilter() + * complies with its spec: + * public void addCountFilter(int count) + * Limit the requested event to be reported at most once + * after a given number of occurrences. + * The event is not reported the first count - 1 times this filter is reached. + * To request a one-off event, call this method with a count of 1. + * Once the count reaches 0, + * any subsequent filters in this request are applied. + * If none of those filters cause the event to be suppressed, + * the event is reported. Otherwise, the event is not reported. + * In either case subsequent events are never reported for this request. + * Parameters: count - the number of ocurrences before generating an event. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * IllegalArgumentException - if count is less than one. + * The test checks up on following assertions: + * - Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * - Throws: IllegalArgumentException - if count is less than one. + * The cases to check include Requests of all sub-types. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.addCountFilter.addcountfilter001; + * the debuggee program - nsk.jdi.EventRequest.addCountFilter.addcountfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.addCountFilter.addcountfilter001 + * nsk.jdi.EventRequest.addCountFilter.addcountfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.addCountFilter.addcountfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001a.java new file mode 100644 index 00000000000..ae0ff12fffe --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.addCountFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addcountfilter001 JDI test. + */ + +public class addcountfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1addcountfilter001a thread1 = null; + + static TestClass11 obj = new TestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1addcountfilter001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + addcountfilter001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class TestClass11 extends TestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + addcountfilter001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1addcountfilter001a extends Thread { + + String tName = null; + + public Thread1addcountfilter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + addcountfilter001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(addcountfilter001a.waitnotifyObj) { + addcountfilter001a.waitnotifyObj.notify(); + } + synchronized(addcountfilter001a.lockObj) { + TestClass11.method11(); + } + addcountfilter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java new file mode 100644 index 00000000000..d14abb8477e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java @@ -0,0 +1,548 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.disable()
    + * complies with its spec.
    + *
    + * The test checks up on if a value returned by the method
    + * EventRequest.isEnabled() matchs a value set up with
    + * the method EventRequest.disable().
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class disable001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/disable/disable001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new disable001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.disable.disable001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.disable.disable001aTestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.setEnabled(true);"); + eventRequest1.setEnabled(true); + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: EventRequest is still enabled"); + } + eventRequest1.setEnabled(false); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001/TestDescription.java new file mode 100644 index 00000000000..37e77793b6a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequest/disable/disable001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.disable() + * complies with its spec: + * public void disable() + * Same as setEnabled(false). + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * The test checks up on if a value returned by the method EventRequest.isEnabled() + * matchs a value set up with the method EventRequest.disable(), that is, false. + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.disable.disable001; + * the debuggee program - nsk.jdi.EventRequest.disable.disable001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.disable.disable001 + * nsk.jdi.EventRequest.disable.disable001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.disable.disable001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001a.java new file mode 100644 index 00000000000..d73f0332b86 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the disable001 JDI test. + */ + +public class disable001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static disable001aThread1 thread1 = null; + + static disable001aTestClass11 obj = new disable001aTestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new disable001aThread1("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class disable001aTestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + disable001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class disable001aTestClass11 extends disable001aTestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + disable001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class disable001aThread1 extends Thread { + + String tName = null; + + public disable001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + disable001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(disable001a.waitnotifyObj) { + disable001a.waitnotifyObj.notify(); + } + synchronized(disable001a.lockObj) { + disable001aTestClass11.method11(); + } + disable001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java new file mode 100644 index 00000000000..d407d9b45f4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java @@ -0,0 +1,546 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.disable()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request has been deleted.
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class disable002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/disable/disable002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new disable002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.disable.disable002a"; + + private String testedClassName = + "nsk.jdi.EventRequest.disable.disable002aTestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.enable(); InvalidRequestStateException is expected"); + eventRequest1.disable(); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002/TestDescription.java new file mode 100644 index 00000000000..eab65bc40d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002/TestDescription.java @@ -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/EventRequest/disable/disable002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.disable() + * complies with its spec: + * public void disable() + * Same as setEnabled(false). + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.disable.disable002; + * the debuggee program - nsk.jdi.EventRequest.disable.disable002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.disable.disable002 + * nsk.jdi.EventRequest.disable.disable002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.disable.disable002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002a.java new file mode 100644 index 00000000000..9f5fa78e44e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the disable002 JDI test. + */ + +public class disable002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static disable002aThread1 thread1 = null; + + static disable002aTestClass11 obj = new disable002aTestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new disable002aThread1("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----1"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class disable002aTestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + disable002a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class disable002aTestClass11 extends disable002aTestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + disable002a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class disable002aThread1 extends Thread { + + String tName = null; + + public disable002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + disable002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(disable002a.waitnotifyObj) { + disable002a.waitnotifyObj.notify(); + } + synchronized(disable002a.lockObj) { + disable002aTestClass11.method11(); + } + disable002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003.java new file mode 100644 index 00000000000..c33b23918bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003.java @@ -0,0 +1,260 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up com.sun.jdi.EventRequest.disable() after + * class file redefinition. + * + * The test performs as follow: + * Debuggee has two classes. Debugger creates a BreakpointRequest + * at the first class and waits a corresponding event. After getting + * BreakpointEvent, debugger redefines the second class, tries to + * disable the set breakpoint and checks status of the BreakpointRequest + * to be disabled. + */ + +public class disable003 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.EventRequest.disable."; + private final static String debuggerName = prefix + "disable003"; + public final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String classFileName = "disable003b.class"; + private final static String newClassFile = "newclass" + File.separator + + prefix.replace('.',File.separatorChar) + + classFileName; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + public final static int expectedEventCount = 1; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + disable003 thisTest = new disable003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectOutput(log); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + int eventCount = 0; + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\nevent ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\nevent ===>>> " + event); + prepareTestCases(); + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\nevent ===>>> " + event); + ClassType testedClass; + testedClass = (ClassType )debugee.classByName(testedClassName); + + display("\nredefinition of the \"" + + testedClassName + "\" class"); + redefineDebugee(testedClass, newClassFile); + + eventCount++; + boolean isBrkpEnabled = event.request().isEnabled(); + if (!isBrkpEnabled) { + complain("breakpoint was disabled after " + + "the redefinition of an other class"); + exitStatus = Consts.TEST_FAILED; + } else { + display("\nis breakpoint enabled?\t" + isBrkpEnabled); + display("\ndisabling the breakpoint request..."); + event.request().disable(); + if (event.request().isEnabled()) { + complain("breakpoint is not disabled"); + exitStatus = Consts.TEST_FAILED; + } + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount != expectedEventCount) { + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee(ReferenceType refType, String classFileName) { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(refType, classFileName); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(ReferenceType refType, String fileName) { + display("a new class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(refType, arrayToRedefine); + return mapForClass; + } + + private void prepareTestCases() { + debugeeClass = debugee.classByName(debugeeName); + display("debugeeClass\t\t:" + debugeeClass.name()); + display("setting breakpoint..."); + debugee.setBreakpoint(debugeeClass, + disable003a.brkpMethodName, + disable003a.brkpLineNumber); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003/TestDescription.java new file mode 100644 index 00000000000..6039b23acf5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003/TestDescription.java @@ -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/EventRequest/disable/disable003. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.EventRequest.disable() after + * class file redefinition. + * The test performs as follow: + * Debuggee has two classes (A and B). Debugger creates a BreakpointRequest + * at the first class A and waits a corresponding event. After getting + * BreakpointEvent, debugger redefines the second class B, tries to disable + * the set breakpoint and checks status of the BreakpointRequest to be + * disabled. + * COMMENTS + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.disable.disable003 + * nsk.jdi.EventRequest.disable.disable003a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.disable.disable003 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003/newclass/disable003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003/newclass/disable003b.java new file mode 100644 index 00000000000..ee99f7ea9f7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003/newclass/disable003b.java @@ -0,0 +1,50 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * disable003b is deugee's part of the disable003. + */ + +public class disable003b { + public final static int INITIAL_VALUE = 0; + public final static int BEFORE_REDEFINITION = 1; + public final static int AFTER_REDEFINITION = 2; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public static void runIt(boolean doWait) { + + flag = AFTER_REDEFINITION; +// ^^^^^^^^^^^^^^^^^^^ it will be redefined + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003a.java new file mode 100644 index 00000000000..072ed63d857 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003a.java @@ -0,0 +1,52 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * disable003a is deugee's part of the disable003. + */ +public class disable003a { + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log = null; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + + disable003b.loadClass = true; + + log.display("completed succesfully."); // brkpLineNumber + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003b.java new file mode 100644 index 00000000000..4025db6174c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable003b.java @@ -0,0 +1,50 @@ +/* + * 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.EventRequest.disable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * disable003b is deugee's part of the disable003. + */ + +public class disable003b { + public final static int INITIAL_VALUE = 0; + public final static int BEFORE_REDEFINITION = 1; + public final static int AFTER_REDEFINITION = 2; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public static void runIt(boolean doWait) { + + flag = BEFORE_REDEFINITION; +// ^^^^^^^^^^^^^^^^^^^ it will be redefined + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java new file mode 100644 index 00000000000..96c6ef3200c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java @@ -0,0 +1,544 @@ +/* + * 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.EventRequest.enable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.enable()
    + * complies with its spec.
    + *
    + * The test checks up on if a value returned by the method
    + * EventRequest.isEnabled() matchs a value set up with
    + * the method EventRequest.enable().
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class enable001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/enable/enable001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new enable001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.enable.enable001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.enable.enable001aTestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + log2(" checking up on eventRequest1"); + if ( !eventRequest1.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: EventRequest is not enabled"); + } + eventRequest1.disable(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001/TestDescription.java new file mode 100644 index 00000000000..28b756943be --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001/TestDescription.java @@ -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/EventRequest/enable/enable001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.enable() + * complies with its spec: + * public void enable() + * Same as setEnabled(true). + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * IllegalThreadStateException - + * if this is a StepRequest and the thread named in the request has died. + * The test checks up on if a value returned by the method EventRequest.isEnabled() + * matchs a value set up with the method EventRequest.enable(), that is, true. + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.enable.enable001; + * the debuggee program - nsk.jdi.EventRequest.enable.enable001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.enable.enable001 + * nsk.jdi.EventRequest.enable.enable001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.enable.enable001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001a.java new file mode 100644 index 00000000000..d979bf28129 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.enable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the enable001 JDI test. + */ + +public class enable001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static enable001aThread1 thread1 = null; + + static enable001aTestClass11 obj = new enable001aTestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new enable001aThread1("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class enable001aTestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + enable001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class enable001aTestClass11 extends enable001aTestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + enable001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class enable001aThread1 extends Thread { + + String tName = null; + + public enable001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + enable001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(enable001a.waitnotifyObj) { + enable001a.waitnotifyObj.notify(); + } + synchronized(enable001a.lockObj) { + enable001aTestClass11.method11(); + } + enable001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java new file mode 100644 index 00000000000..fb70ef42655 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java @@ -0,0 +1,562 @@ +/* + * 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.EventRequest.enable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.enable()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request has been deleted.
    + * IllegalThreadStateException -
    + * if this is a StepRequest and
    + * the thread named in the request has died.
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class enable002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/enable/enable002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new enable002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.enable.enable002a"; + + private String testedClassName = + "nsk.jdi.EventRequest.enable.enable002aTestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + vm.resume(); + breakpointForCommunication(); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + if (eventRequest1 instanceof StepRequest) { + try { + log2("......eventRequest1.enable(); IllegalThreadStateException is expected"); + eventRequest1.enable(); + testExitCode = FAILED; + log3("ERROR: NO IllegalThreadStateException for StepRequest"); + } catch ( IllegalThreadStateException e ) { + log2(" IllegalThreadStateException"); + } + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.enable(); InvalidRequestStateException is expected"); + eventRequest1.enable(); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002/TestDescription.java new file mode 100644 index 00000000000..1b172607dac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002/TestDescription.java @@ -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/EventRequest/enable/enable002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.enable() + * complies with its spec: + * public void enable() + * Same as setEnabled(true). + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * IllegalThreadStateException - + * if this is a StepRequest and the thread named in the request has died. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * IllegalThreadStateException - + * if this is a StepRequest and the thread named in the request has died. + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.enable.enable002; + * the debuggee program - nsk.jdi.EventRequest.enable.enable002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.enable.enable002 + * nsk.jdi.EventRequest.enable.enable002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.enable.enable002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002a.java new file mode 100644 index 00000000000..1035cad5c5a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002a.java @@ -0,0 +1,231 @@ +/* + * 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.EventRequest.enable; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the enable002 JDI test. + */ + +public class enable002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static enable002aThread1 thread1 = null; + + static enable002aTestClass11 obj = new enable002aTestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new enable002aThread1("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----1"); + methodForCommunication(); + } + try { + thread1.join(); + log1("methodForCommunication();----2"); + methodForCommunication(); + } catch ( InterruptedException e ) { + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class enable002aTestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + enable002a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class enable002aTestClass11 extends enable002aTestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + enable002a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class enable002aThread1 extends Thread { + + String tName = null; + + public enable002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + enable002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(enable002a.waitnotifyObj) { + enable002a.waitnotifyObj.notify(); + } + synchronized(enable002a.lockObj) { + enable002aTestClass11.method11(); + } + enable002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java new file mode 100644 index 00000000000..c2901199e37 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java @@ -0,0 +1,558 @@ +/* + * 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.EventRequest.getProperty; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.getProperty()
    + * complies with its spec.
    + *
    + * The test checks up on following assertions:
    + * - a value of property is equal to one assigned with method
    + * putProperty(key, value); + * - the value of the property which is not assign with method
    + * putProperty(key, value), is the null.
    + * The cases to check include Requests of all sub-types.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class getproperty001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/getProperty/getproperty001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new getproperty001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.getProperty.getproperty001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.getProperty.TestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + String propertyName1 = "name1"; + String propertyName2 = "name2"; + String propertyValue1 = "value1"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.putProperty(propertyName1, propertyValue1);"); + eventRequest1.putProperty(propertyName1, propertyValue1); + + log2(" checking up on property1"); + if ( !eventRequest1.getProperty(propertyName1).equals(propertyValue1) ) { + testExitCode = FAILED; + log3("ERROR: property is not expected"); + }; + + log2(" checking up on property2"); + if ( eventRequest1.getProperty(propertyName2)!= null ) { + testExitCode = FAILED; + log3("ERROR: property is not the null"); + } + + eventRequest1.setEnabled(false); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001/TestDescription.java new file mode 100644 index 00000000000..3ab89f7b38a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001/TestDescription.java @@ -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/EventRequest/getProperty/getproperty001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.getProperty() + * complies with its spec: + * public Object getProperty(Object key) + * Returns the value of the property with the specified key. + * Only properties added with putProperty(java.lang.Object, java.lang.Object) + * will return a non-null value. + * Returns: the value of this property or null + * The test checks up on following assertions: + * - a value of property is equal to one assigned with method putProperty(key, value); + * - the value of the property which is not assign with method putProperty(key, value), + * is the null. + * The cases to check include Requests of all sub-types. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.getProperty.getproperty001; + * the debuggee program - nsk.jdi.EventRequest.getProperty.getproperty001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.getProperty.getproperty001 + * nsk.jdi.EventRequest.getProperty.getproperty001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.getProperty.getproperty001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001a.java new file mode 100644 index 00000000000..d8c30f9ba73 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.getProperty; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getproperty001 JDI test. + */ + +public class getproperty001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1getproperty001a thread1 = null; + + static TestClass11 obj = new TestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1getproperty001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + getproperty001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class TestClass11 extends TestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + getproperty001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1getproperty001a extends Thread { + + String tName = null; + + public Thread1getproperty001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + getproperty001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(getproperty001a.waitnotifyObj) { + getproperty001a.waitnotifyObj.notify(); + } + synchronized(getproperty001a.lockObj) { + TestClass11.method11(); + } + getproperty001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001.java new file mode 100644 index 00000000000..9b033475cb2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001.java @@ -0,0 +1,241 @@ +/* + * 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.EventRequest.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class hashcode001 { + + //------------------------------------------------------- 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.EventRequest.hashCode."; + private final static String className = "hashcode001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String methodName = "main"; + private final static String fieldName = "exitStatus"; + + //------------------------------------------------------- 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() { + + EventRequestManager eventRequestManager = debuggee.VM().eventRequestManager(); + EventRequest eventRequest; + + display("Checking hashCode() method for EventRequest objects"); + + for (int i = 0; i < 12; i++) { + + switch (i) { + + case 0: + ThreadReference thread = threadByName(methodName); + + display(".....setting up StepRequest"); + eventRequest = eventRequestManager.createStepRequest + (thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + display(".....setting up AccessWatchpointRequest"); + eventRequest = eventRequestManager.createAccessWatchpointRequest + (debuggeeClass.fieldByName(fieldName)); + break; + + case 2: + display(".....setting up ModificationWatchpointRequest"); + eventRequest = eventRequestManager.createModificationWatchpointRequest + (debuggeeClass.fieldByName(fieldName)); + break; + + case 3: + display(".....setting up ClassPrepareRequest"); + eventRequest = eventRequestManager.createClassPrepareRequest(); + break; + + case 4: + display(".....setting up ClassUnloadRequest"); + eventRequest = eventRequestManager.createClassUnloadRequest(); + break; + + case 5: + display(".....setting up MethodEntryRequest"); + eventRequest = eventRequestManager.createMethodEntryRequest(); + break; + + case 6: + display(".....setting up MethodExitRequest"); + eventRequest = eventRequestManager.createMethodExitRequest(); + break; + + case 7: + display(".....setting up ThreadDeathRequest"); + eventRequest = eventRequestManager.createThreadDeathRequest(); + break; + + case 8: + display(".....setting up ThreadStartRequest"); + eventRequest = eventRequestManager.createThreadStartRequest(); + break; + + case 9: + display(".....setting up VMDeathRequest"); + eventRequest = eventRequestManager.createVMDeathRequest(); + break; + + case 10: + display(".....setting up ExceptionRequest"); + eventRequest = eventRequestManager.createExceptionRequest( null, true, true ); + break; + + case 11: + display(".....setting up BreakpointRequest"); + Method method = methodByName(debuggeeClass, methodName); + List locs = null; + try { + locs = method.allLineLocations(); + } catch(AbsentInformationException e) { + throw new Failure("Unexpected AbsentInformationException while getting "); + } + Location location = (Location)locs.get(0); + eventRequest = eventRequestManager.createBreakpointRequest(location); + break; + + default: + throw new Failure("Wrong test case : " + i); + } + + int hCode = eventRequest.hashCode(); + + if (hCode == 0) { + complain("hashCode() returns 0 for EventRequest object " + eventRequest); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = eventRequest.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for EventRequest object " + eventRequest + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns " + hCode + " for EventRequest object : " + eventRequest); + eventRequestManager.deleteEventRequest(eventRequest); + } + + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + + private static Method methodByName(ReferenceType refType, String methodName) { + List methodList = refType.methodsByName(methodName); + if (methodList == null) return null; + + Method method = (Method) methodList.get(0); + return method; + } + + static private ThreadReference threadByName(String name) { + + List all = debuggee.VM().allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread IS NOT found : " + name); + } + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..d745485ff9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001/TestDescription.java @@ -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/EventRequest/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.request.EventRequest interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during + * an execution of a Java application, the hashCode method must + * consistently return the same integer, provided no information used + * in equals comparisons on the object is modified. + * ... + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for EventRequest + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.hashCode.hashcode001 + * nsk.jdi.EventRequest.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001a.java new file mode 100644 index 00000000000..a50e56ef161 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001a.java @@ -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.EventRequest.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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 + + //------------------------------------------------------ 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); + try { + pipe.println(hashcode001.SIGNAL_READY); + receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java new file mode 100644 index 00000000000..d6dbbba2bec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java @@ -0,0 +1,552 @@ +/* + * 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.EventRequest.isEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.isEnabled()
    + * complies with its spec.
    + *
    + * The test checks up on if a value returned by the method
    + * EventRequest.isEnabled() matchs a value set up with
    + * the method EventRequest.setEnabled().
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class isenabled001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/isEnabled/isenabled001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new isenabled001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.isEnabled.isenabled001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.isEnabled.TestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.setEnabled(true);"); + eventRequest1.setEnabled(true); + log2(" checking up on eventRequest1"); + if ( !eventRequest1.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: EventRequest is not enabled"); + } + + log2("......eventRequest1.setEnabled(false);"); + eventRequest1.setEnabled(false); + log2(" checking up on eventRequest1"); + if ( eventRequest1.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: EventRequest is enabled"); + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001/TestDescription.java new file mode 100644 index 00000000000..c5e57b9a9dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/EventRequest/isEnabled/isenabled001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.isEnabled() + * complies with its spec: + * public boolean isEnabled() + * Determines if this event request is currently enabled. + * Returns: true if enabled; false otherwise. + * The test checks up on if a value returned by the method EventRequest.isEnabled() + * matchs a value set up with the method EventRequest.setEnabled(). + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.isEnabled.isenabled001; + * the debuggee program - nsk.jdi.EventRequest.isEnabled.isenabled001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.isEnabled.isenabled001 + * nsk.jdi.EventRequest.isEnabled.isenabled001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.isEnabled.isenabled001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001a.java new file mode 100644 index 00000000000..f366b25140c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.isEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the isenabled001 JDI test. + */ + +public class isenabled001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1isenabled001a thread1 = null; + + static TestClass11 obj = new TestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1isenabled001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + isenabled001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class TestClass11 extends TestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + isenabled001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1isenabled001a extends Thread { + + String tName = null; + + public Thread1isenabled001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + isenabled001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(isenabled001a.waitnotifyObj) { + isenabled001a.waitnotifyObj.notify(); + } + synchronized(isenabled001a.lockObj) { + TestClass11.method11(); + } + isenabled001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java new file mode 100644 index 00000000000..2f498c2e457 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java @@ -0,0 +1,563 @@ +/* + * 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.EventRequest.putProperty; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.putProperty()
    + * complies with its spec.
    + *
    + * The test checks up on following assertions:
    + * - a value of property is equal to one assigned by
    + * last method putProperty(key, value);
    + * - after calling putProperty(key, null)
    + * the value of the property 'key' is also null.
    + * The cases to check include Requests of all sub-types.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class putproperty001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/putProperty/putproperty001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new putproperty001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.putProperty.putproperty001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.putProperty.TestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + String propertyName = "name"; + String propertyValue1 = "value1"; + String propertyValue2 = "value2"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.putProperty(propertyName, propertyValue1);"); + eventRequest1.putProperty(propertyName, propertyValue1); + log2(" eventRequest1.putProperty(propertyName, propertyValue2);"); + eventRequest1.putProperty(propertyName, propertyValue2); + + log2(" checking up on eventRequest1"); + if ( !eventRequest1.getProperty(propertyName).equals(propertyValue2) ) { + testExitCode = FAILED; + log3("ERROR: property is not expected"); + } + + log2("......eventRequest1.putProperty(propertyName, null);"); + eventRequest1.putProperty(propertyName, null); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.getProperty(propertyName)!= null ) { + testExitCode = FAILED; + log3("ERROR: property is not the null"); + } + + eventRequest1.setEnabled(false); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001/TestDescription.java new file mode 100644 index 00000000000..bdf1970cd11 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001/TestDescription.java @@ -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/EventRequest/putProperty/putproperty001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.putProperty() + * complies with its spec: + * public void putProperty(Object key, Object value) + * Add an arbitrary key/value "property" to this request. + * The property can be used by a client of the JDI + * to associate application information with the request; + * These client-set properties are not used internally by the JDI. + * The get/putProperty methods provide access to a small per-instance map. + * This is not to be confused with Properties. + * If value is null this method will remove the property. + * The test checks up on following assertions: + * - a value of property is equal to one assigned by last method putProperty(key, value); + * - after calling putProperty(key, null) the value of the property 'key' is also null. + * The cases to check include Requests of all sub-types. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.putProperty.putproperty001; + * the debuggee program - nsk.jdi.EventRequest.putProperty.putproperty001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.putProperty.putproperty001 + * nsk.jdi.EventRequest.putProperty.putproperty001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.putProperty.putproperty001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001a.java new file mode 100644 index 00000000000..6e5b815919a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.putProperty; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the putproperty001 JDI test. + */ + +public class putproperty001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1putproperty001a thread1 = null; + + static TestClass11 obj = new TestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1putproperty001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + putproperty001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class TestClass11 extends TestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + putproperty001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1putproperty001a extends Thread { + + String tName = null; + + public Thread1putproperty001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + putproperty001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(putproperty001a.waitnotifyObj) { + putproperty001a.waitnotifyObj.notify(); + } + synchronized(putproperty001a.lockObj) { + TestClass11.method11(); + } + putproperty001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java new file mode 100644 index 00000000000..26571b466bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java @@ -0,0 +1,551 @@ +/* + * 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.EventRequest.setEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.setEnabled()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Enables or disables this event request.
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class setenabled001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/setEnabled/setenabled001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new setenabled001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.setEnabled.setenabled001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.setEnabled.setenabled001aTestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.setEnable(true);"); + eventRequest1.setEnabled(true); + log2(" checking up on eventRequest1"); + if ( !eventRequest1.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: EventRequest is not enabled"); + } + + log2("......eventRequest1.setEnable(false);"); + eventRequest1.setEnabled(false); + log2(" checking up on eventRequest1"); + if ( eventRequest1.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: EventRequest is enabled"); + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001/TestDescription.java new file mode 100644 index 00000000000..cd28429b8d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventRequest/setEnabled/setenabled001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.setEnabled() + * complies with its spec: + * public void setEnabled(boolean val) + * Enables or disables this event request. + * While this event request is disabled, the event request will be ignored and + * the target VM will not be stopped if any of its threads reaches the event request. + * Disabled event requests still exist, and are included in event request lists + * such as EventRequestManager.breakpointRequests(). + * Parameters: val - true if the event request is to be enabled; false otherwise. + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * IllegalThreadStateException - + * if this is a StepRequest, val is true, and + * the thread named in the request has died. + * The test checks up on the following assertion: + * Enables or disables this event request. + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.setEnabled.setenabled001; + * the debuggee program - nsk.jdi.EventRequest.setEnabled.setenabled001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.setEnabled.setenabled001 + * nsk.jdi.EventRequest.setEnabled.setenabled001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.setEnabled.setenabled001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001a.java new file mode 100644 index 00000000000..fb1efae4e4f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.setEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setenabled001 JDI test. + */ + +public class setenabled001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static setenabled001aThread1 thread1 = null; + + static setenabled001aTestClass11 obj = new setenabled001aTestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new setenabled001aThread1("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class setenabled001aTestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + setenabled001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class setenabled001aTestClass11 extends setenabled001aTestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + setenabled001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class setenabled001aThread1 extends Thread { + + String tName = null; + + public setenabled001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + setenabled001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(setenabled001a.waitnotifyObj) { + setenabled001a.waitnotifyObj.notify(); + } + synchronized(setenabled001a.lockObj) { + setenabled001aTestClass11.method11(); + } + setenabled001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java new file mode 100644 index 00000000000..f46aaa16f89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java @@ -0,0 +1,578 @@ +/* + * 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.EventRequest.setEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.setEnabled()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - IllegalThreadStateException -
    + * if this is a StepRequest, val is true, and
    + * the thread named in the request has died.
    + * - InvalidRequestStateException -
    + * if this request has been deleted.
    + * The cases to test include all sub-types of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class setenabled002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/setEnabled/setenabled002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new setenabled002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.setEnabled.setenabled002a"; + + private String testedClassName = + "nsk.jdi.EventRequest.setEnabled.setenabled002aTestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + vm.resume(); + breakpointForCommunication(); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + if (eventRequest1 instanceof StepRequest) { + try { + log2("......eventRequest1.setEnabled(true); IllegalThreadStateException is expected"); + eventRequest1.setEnabled(true); + testExitCode = FAILED; + log3("ERROR: NO IllegalThreadStateException for StepRequest"); + } catch ( IllegalThreadStateException e ) { + log2(" IllegalThreadStateException"); + } + try { + log2("......eventRequest1.setEnabled(false); IllegalThreadStateException is not expected"); + eventRequest1.setEnabled(false); + log2(" no IllegalThreadStateException for StepRequest"); + } catch ( IllegalThreadStateException e ) { + testExitCode = FAILED; + log3("ERROR: IllegalThreadStateException"); + } + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.setEnabled(true); InvalidRequestStateException is expected"); + eventRequest1.setEnabled(true); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + try { + log2("......eventRequest1.setEnabled(false); InvalidRequestStateException is expected"); + eventRequest1.setEnabled(false); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002/TestDescription.java new file mode 100644 index 00000000000..7d5d2be4ab8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventRequest/setEnabled/setenabled002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.setEnabled() + * complies with its spec: + * public void setEnabled(boolean val) + * Enables or disables this event request. + * While this event request is disabled, the event request will be ignored and + * the target VM will not be stopped if any of its threads reaches the event request. + * Disabled event requests still exist, and are included in event request lists + * such as EventRequestManager.breakpointRequests(). + * Parameters: val - true if the event request is to be enabled; false otherwise. + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * IllegalThreadStateException - + * if this is a StepRequest, val is true, and + * the thread named in the request has died. + * The test checks up on the following assertions: + * - IllegalThreadStateException - if this is a StepRequest, val is true, and + * the thread named in the request has died. + * - InvalidRequestStateException - if this request has been deleted. + * The cases to test include all sub-types of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.setEnabled.setenabled002; + * the debuggee program - nsk.jdi.EventRequest.setEnabled.setenabled002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequest.setEnabled.setenabled002 + * nsk.jdi.EventRequest.setEnabled.setenabled002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.setEnabled.setenabled002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002a.java new file mode 100644 index 00000000000..73d7954614f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002a.java @@ -0,0 +1,231 @@ +/* + * 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.EventRequest.setEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setenabled002 JDI test. + */ + +public class setenabled002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static setenabled002aThread1 thread1 = null; + + static setenabled002aTestClass11 obj = new setenabled002aTestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new setenabled002aThread1("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + try { + thread1.join(); + log1("methodForCommunication();----2"); + methodForCommunication(); + } catch ( InterruptedException e ) { + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class setenabled002aTestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + setenabled002a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class setenabled002aTestClass11 extends setenabled002aTestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + setenabled002a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class setenabled002aThread1 extends Thread { + + String tName = null; + + public setenabled002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + setenabled002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(setenabled002a.waitnotifyObj) { + setenabled002a.waitnotifyObj.notify(); + } + synchronized(setenabled002a.lockObj) { + setenabled002aTestClass11.method11(); + } + setenabled002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003.java new file mode 100644 index 00000000000..e20a786d1c9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003.java @@ -0,0 +1,527 @@ +/* + * 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.EventRequest.setEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.setEnabled()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - IllegalThreadStateException -
    + * if this is a StepRequest, val is true, and
    + * the thread named in the request has died.
    + * The cases to test include three states of
    + * the thread named in the request: not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class setenabled003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/setEnabled/setenabled003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new setenabled003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.setEnabled.setenabled003a"; + + private String testedClassName = + "nsk.jdi.EventRequest.setEnabled.Thread1setenabled003a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = (ThreadReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(threadName1)); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + + try { + log2("......eventRequest1.setEnabled(true); IllegalThreadStateException is expected"); + eventRequest1.setEnabled(true); + log3("ERROR: case 0 : no IllegalThreadStateException"); + testExitCode = FAILED; + } catch ( IllegalThreadStateException e ) { + log2(" not started thread"); + log2(" : IllegalThreadStateException when setEnabled(true)"); + } + try { + log2("......eventRequest1.setEnabled(false); IllegalThreadStateException is not expected"); + eventRequest1.setEnabled(false); + log2(" no IllegalThreadStateException"); + } catch ( IllegalThreadStateException e ) { + testExitCode = FAILED; + log3("ERROR: case 0 : not started thread"); + log3(" : IllegalThreadStateException when setEnabled(false)"); + } + break; + + case 1: + try { + log2("......eventRequest1.setEnabled(true); IllegalThreadStateException is not expected"); + eventRequest1.setEnabled(true); + log2(" no IllegalThreadStateException"); + } catch ( IllegalThreadStateException e ) { + testExitCode = FAILED; + log3("ERROR: case 1 : running thread"); + log3(" : IllegalThreadStateException when setEnabled(true)"); + } + try { + log2("......eventRequest1.setEnabled(false); IllegalThreadStateException is not expected"); + eventRequest1.setEnabled(false); + log2(" no IllegalThreadStateException"); + } catch ( IllegalThreadStateException e ) { + testExitCode = FAILED; + log3("ERROR: case 1 : running thread"); + log3(" : IllegalThreadStateException when setEnabled(false)"); + } + break; + + case 2: + try { + log2("......eventRequest1.setEnabled(true); IllegalThreadStateException is expected"); + eventRequest1.setEnabled(true); + testExitCode = FAILED; + log3("ERROR: case 2 : dead thread"); + log3(" : NO IllegalThreadStateException when setEnabled(true)"); + } catch ( IllegalThreadStateException e ) { + log2(" IllegalThreadStateException"); + } + try { + log2("......eventRequest1.setEnabled(false); IllegalThreadStateException is not expected"); + eventRequest1.setEnabled(false); + log2(" no IllegalThreadStateException"); + } catch ( IllegalThreadStateException e ) { + testExitCode = FAILED; + log3("ERROR: case 2 : dead thread"); + log3(" : IllegalThreadStateException when setEnabled(false)"); + } + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003/TestDescription.java new file mode 100644 index 00000000000..691e7fd51b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/EventRequest/setEnabled/setenabled003. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-8066993 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.setEnabled() + * complies with its spec: + * public void setEnabled(boolean val) + * Enables or disables this event request. + * While this event request is disabled, the event request will be ignored and + * the target VM will not be stopped if any of its threads reaches the event request. + * Disabled event requests still exist, and are included in event request lists + * such as EventRequestManager.breakpointRequests(). + * Parameters: val - true if the event request is to be enabled; false otherwise. + * Throws: InvalidRequestStateException - + * if this request has been deleted. + * IllegalThreadStateException - + * if this is a StepRequest, val is true, and + * the thread named in the request has died. + * The test checks up on the following assertion: + * - IllegalThreadStateException - if this is a StepRequest, val is true, and + * the thread named in the request has died. + * The cases to test include three states of the thread named in the request: + * not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.setEnabled.setenabled003; + * the debuggee program - nsk.jdi.EventRequest.setEnabled.setenabled003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequest.setEnabled.setenabled003 + * nsk.jdi.EventRequest.setEnabled.setenabled003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.setEnabled.setenabled003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003a.java new file mode 100644 index 00000000000..bc22fdd2846 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003a.java @@ -0,0 +1,180 @@ +/* + * 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.EventRequest.setEnabled; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setenabled003 JDI test. + */ + +public class setenabled003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1setenabled003a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1setenabled003a("thread1"); + Thread1setenabled003a.method(); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } +// case 2: + try { + thread1.join(); + log1("methodForCommunication();----2"); + methodForCommunication(); + } catch ( InterruptedException e ) { + } + i++; + + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class Thread1setenabled003a extends Thread { + + String tName = null; + + public Thread1setenabled003a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + setenabled003a.log1(" 'run': enter :: threadName == " + tName); + synchronized(setenabled003a.waitnotifyObj) { + setenabled003a.waitnotifyObj.notify(); + } + + synchronized(setenabled003a.lockObj) { + setenabled003a.log1(" 'run': exit :: threadName == " + tName); + } + return; + } + + static void method() { + setenabled003a.log1(" enetred: method"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java new file mode 100644 index 00000000000..c95834f1f19 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java @@ -0,0 +1,594 @@ +/* + * 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.EventRequest.setSuspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.setSuspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks up on following assertions:
    + * - a value of policy is equal to one assigned by last method
    + * setSuspendPolicy(int);
    + * - InvalidRequestStateException is thrown
    + * if this request is currently enabled;
    + * - InvalidRequestStateException is thrown
    + * if this request has been deleted.
    + * The cases to check include Requests of all sub-types.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class setsuspendpolicy001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new setsuspendpolicy001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.setSuspendPolicy.setsuspendpolicy001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.setSuspendPolicy.TestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + String propertyName = "name"; + String propertyValue1 = "value1"; + String propertyValue2 = "value2"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE);"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE); + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_ALL);"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.suspendPolicy() != EventRequest.SUSPEND_ALL) { + testExitCode = FAILED; + log3("ERROR: suspendPolicy() != EventRequest.SUSPEND_ALL"); + } + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD );"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD ); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.suspendPolicy() != EventRequest.SUSPEND_EVENT_THREAD ) { + testExitCode = FAILED; + log3("ERROR: suspendPolicy() != EventRequest.SUSPEND_EVENT_THREAD "); + } + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE);"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.suspendPolicy() != EventRequest.SUSPEND_NONE) { + testExitCode = FAILED; + log3("ERROR: suspendPolicy() != EventRequest.SUSPEND_NONE"); + } + + log2("......eventRequest1.setEnabled(true);"); + eventRequest1.setEnabled(true); + try { + log2(" checking up on eventRequest1; InvalidRequestStateException is expected"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2(" checking up on eventRequest1; InvalidRequestStateException is expected"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001/TestDescription.java new file mode 100644 index 00000000000..5bc44da0f0c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/EventRequest/setSuspendPolicy/setsuspendpolicy001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.setSuspendPolicy() + * complies with its spec: + * public void setSuspendPolicy(int policy) + * Determines the threads to suspend when the requested event occurs in + * the target VM. + * Use SUSPEND_ALL to suspend all threads in the target VM (the default). + * Use SUSPEND_EVENT_THREAD to suspend only the thread which generated the event. + * Use SUSPEND_NONE to suspend no threads. + * Thread suspensions through events have the same functionality as + * explicitly requested suspensions. + * See ThreadReference.suspend() and VirtualMachine.suspend() for details. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Suspend policy may only be set in disabled requests. + * The test checks up on following assertions: + * - a value of policy is equal to one assigned by last method setSuspendPolicy(int); + * - InvalidRequestStateException is thrown if this request is currently enabled; + * - InvalidRequestStateException is thrown if this request has been deleted. + * The cases to check include Requests of all sub-types. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.setSuspendPolicy.setsuspendpolicy001; + * the debuggee program - nsk.jdi.EventRequest.setSuspendPolicy.setsuspendpolicy001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.setSuspendPolicy.setsuspendpolicy001 + * nsk.jdi.EventRequest.setSuspendPolicy.setsuspendpolicy001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.setSuspendPolicy.setsuspendpolicy001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001a.java new file mode 100644 index 00000000000..56466e106c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.setSuspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setsuspendpolicy001 JDI test. + */ + +public class setsuspendpolicy001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1setsuspendpolicy001a thread1 = null; + + static TestClass11 obj = new TestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1setsuspendpolicy001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + setsuspendpolicy001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class TestClass11 extends TestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + setsuspendpolicy001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1setsuspendpolicy001a extends Thread { + + String tName = null; + + public Thread1setsuspendpolicy001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + setsuspendpolicy001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(setsuspendpolicy001a.waitnotifyObj) { + setsuspendpolicy001a.waitnotifyObj.notify(); + } + synchronized(setsuspendpolicy001a.lockObj) { + TestClass11.method11(); + } + setsuspendpolicy001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java new file mode 100644 index 00000000000..3a47f86d3e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java @@ -0,0 +1,567 @@ +/* + * 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.EventRequest.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequest.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks up on following assertions:
    + * - Returns: the current suspend mode for this request
    + * The cases to check include Requests of all sub-types.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_ALL
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case (as if) and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class suspendpolicy001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequest.suspendPolicy.suspendpolicy001a"; + + private String testedClassName = + "nsk.jdi.EventRequest.suspendPolicy.TestClass11"; + + Location location = null; // !!!!!!!!!!!!! see settingBreakpoint + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + + EventRequest eventRequest1 = null; + + String fieldName1 = "var101"; + String fieldName2 = "excObj"; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ReferenceType testClassReference = null; + + String propertyName = "name"; + String propertyValue1 = "value1"; + String propertyValue2 = "value2"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest"); + eventRequest1 = eventRManager.createStepRequest + (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + break; + + case 1: + testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); + + log2("......setting up AccessWatchpointRequest"); + eventRequest1 = eventRManager.createAccessWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 2: + log2(".....setting up ModificationWatchpointRequest"); + eventRequest1 = eventRManager.createModificationWatchpointRequest + (testClassReference.fieldByName(fieldName1)); + break; + + case 3: + log2(".....setting up ClassPrepareRequest"); + eventRequest1 = eventRManager.createClassPrepareRequest(); + break; + + case 4: + log2(".....setting up ClassUnloadRequest"); + eventRequest1 = eventRManager.createClassUnloadRequest(); + break; + + case 5: + log2(".....setting up MethodEntryRequest"); + eventRequest1 = eventRManager.createMethodEntryRequest(); + break; + + case 6: + log2(".....setting up MethodExitRequest"); + eventRequest1 = eventRManager.createMethodExitRequest(); + break; + + case 7: + log2(".....setting up ThreadDeathRequest"); + eventRequest1 = eventRManager.createThreadDeathRequest(); + break; + + case 8: + log2(".....setting up ThreadStartRequest"); + eventRequest1 = eventRManager.createThreadStartRequest(); + break; + + case 9: + log2(".....setting up VMDeathRequest"); + eventRequest1 = eventRManager.createVMDeathRequest(); + break; + + case 10: + log2(".....setting up ExceptionRequest"); + eventRequest1 = eventRManager.createExceptionRequest( + (ReferenceType) + (debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2))).type(), + true, true ); + break; + + case 11: + log2(".....setting up BreakpointRequest"); + eventRequest1 = eventRManager.createBreakpointRequest(location); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_ALL);"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.suspendPolicy() != EventRequest.SUSPEND_ALL) { + testExitCode = FAILED; + log3("ERROR: suspendPolicy() != EventRequest.SUSPEND_ALL"); + } + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD );"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD ); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.suspendPolicy() != EventRequest.SUSPEND_EVENT_THREAD ) { + testExitCode = FAILED; + log3("ERROR: suspendPolicy() != EventRequest.SUSPEND_EVENT_THREAD "); + } + + log2("......eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE);"); + eventRequest1.setSuspendPolicy(EventRequest.SUSPEND_NONE); + + log2(" checking up on eventRequest1"); + if ( eventRequest1.suspendPolicy() != EventRequest.SUSPEND_NONE) { + testExitCode = FAILED; + log3("ERROR: suspendPolicy() != EventRequest.SUSPEND_NONE"); + } + + eventRManager.deleteEventRequest(eventRequest1); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + +// this is only for this test to get Location object +location = lineLocation; + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_ALL); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001/TestDescription.java new file mode 100644 index 00000000000..d3b189e744e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001/TestDescription.java @@ -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/EventRequest/suspendPolicy/suspendpolicy001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequest. + * The test checks up that a result of the method + * com.sun.jdi.EventRequest.suspendPolicy() + * complies with its spec: + * public void suspendPolicy() + * Returns a value which describes the threads to suspend when + * the requested event occurs in the target VM. + * The returned value is SUSPEND_ALL, SUSPEND_EVENT_THREAD, or SUSPEND_NONE. + * Returns: the current suspend mode for this request + * The test checks up on following assertions: + * - Returns: the current suspend mode for this request + * The cases to check include Requests of all sub-types. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequest.suspendPolicy.suspendpolicy001; + * the debuggee program - nsk.jdi.EventRequest.suspendPolicy.suspendpolicy001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Modified due to fix of the bug: + * 4915497 TEST_BUG: wrong synchronization in several JDI tests + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequest.suspendPolicy.suspendpolicy001 + * nsk.jdi.EventRequest.suspendPolicy.suspendpolicy001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequest.suspendPolicy.suspendpolicy001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001a.java new file mode 100644 index 00000000000..62735c77ef8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001a.java @@ -0,0 +1,225 @@ +/* + * 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.EventRequest.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy001 JDI test. + */ + +public class suspendpolicy001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1suspendpolicy001a thread1 = null; + + static TestClass11 obj = new TestClass11(); + + static NullPointerException excObj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1suspendpolicy001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + i++; + + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + break; + case 7: + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method10 () { + suspendpolicy001a.log1("entered: method10"); + var101 = 1; + var103 = var101; + var102 = var103; + + } +} +class TestClass11 extends TestClass10{ + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method11 () { + suspendpolicy001a.log1("entered: method11"); + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1suspendpolicy001a extends Thread { + + String tName = null; + + public Thread1suspendpolicy001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + suspendpolicy001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(suspendpolicy001a.waitnotifyObj) { + suspendpolicy001a.waitnotifyObj.notify(); + } + synchronized(suspendpolicy001a.lockObj) { + TestClass11.method11(); + } + suspendpolicy001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001.java new file mode 100644 index 00000000000..355ab547747 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001.java @@ -0,0 +1,213 @@ +/* + * 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.EventRequestManager._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.*; + +/** + * The test checks up the
    + * a) createStepRequest(ThreadReference, int, int)
    + * this method is invoked 3 times with different arguments:
    + * 1. (null, StepRequest.STEP_LINE, StepRequest.STEP_OVER)
    + * in this case NullPointerException is expected
    + * 2. (thread, Integer.MAX_VALUE, StepRequest.STEP_OVER)
    + * 3. (null, StepRequest.STEP_LINE, Integer.MAX_VALUE)
    + * in 2, 3 cases no exceptions are expected
    + * b) createBreakpointRequest(Location)
    + * c) createAccessWatchpointRequest(Field)
    + * d) createModificationWatchpointRequest(Field)
    + * f) deleteEventRequest(EventRequest)
    + * g) deleteEventRequests(List)
    + * In b)-g) cases NullPointerException is expected. + */ +public class requests001 { + + final static String prefix = "nsk.jdi.EventRequestManager._bounds_."; + private final static String className = "requests001"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + requests001 thisTest = new requests001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + EventRequest request; + EventRequestManager evm = debugee.getEventRequestManager(); + ThreadReference thread = debugee.threadByName("main"); + + display(""); + display("...calling createStepRequest(null, StepRequest.STEP_LINE, " + + "StepRequest.STEP_OVER)"); + display(" ^^^^"); + try { + request = evm.createStepRequest(null, StepRequest.STEP_LINE, + StepRequest.STEP_OVER); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + display("...calling createStepRequest(thread, Integer.MAX_VALUE, " + + "StepRequest.STEP_OVER)"); + display(" ^^^^^^^^^^^^^^^^^"); + try { + request = evm.createStepRequest(thread, Integer.MAX_VALUE, + StepRequest.STEP_OVER); + exitStatus = Consts.TEST_FAILED; + complain("IllegalArgumentException is not throw"); + } catch(IllegalArgumentException e) { + display("!!!expected IllegalArgumentException"); + } catch(Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("***unexpected " + e); + } + + display(""); + display("...calling createStepRequest(null, StepRequest.STEP_LINE, " + + "Integer.MAX_VALUE)"); + display(" " + + "^^^^^^^^^^^^^^^^^"); + try { + request = evm.createStepRequest(thread, StepRequest.STEP_LINE, + Integer.MAX_VALUE); + exitStatus = Consts.TEST_FAILED; + complain("IllegalArgumentException is not throw"); + } catch(IllegalArgumentException e) { + display("!!!expected IllegalArgumentException"); + } catch(Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("***unexpected " + e); + } + + display(""); + display("...calling createBreakpointRequest(null)"); + try { + request = evm.createBreakpointRequest(null); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + display("...calling createAccessWatchpointRequest(null)"); + try { + request = evm.createAccessWatchpointRequest(null); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + display("...calling createModificationWatchpointRequest(null)"); + try { + request = evm.createModificationWatchpointRequest(null); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + display("...calling deleteEventRequest(null)"); + try { + evm.deleteEventRequest(null); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + display("...calling deleteEventRequests(null)"); + try { + evm.deleteEventRequests(null); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + display("...calling deleteEventRequests(list of values)"); + Vector list = new Vector(); + list.add(null); + list.add(null); + list.add(null); + list.add(null); + list.add(null); + list.add(null); + try { + evm.deleteEventRequests(list); + exitStatus = Consts.TEST_FAILED; + complain("NullPointerException is not throw"); + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } + + display(""); + debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001/TestDescription.java new file mode 100644 index 00000000000..0fd582a24e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001/TestDescription.java @@ -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/EventRequestManager/_bounds_/requests001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up the methods + * a) createStepRequest(ThreadReference, int, int) + * this method is invoked 3 times with different arguments: + * 1. (null, StepRequest.STEP_LINE, StepRequest.STEP_OVER) + * in this case NullPointerException is expected + * 2. (thread, Integer.MAX_VALUE, StepRequest.STEP_OVER) + * 3. (null, StepRequest.STEP_LINE, Integer.MAX_VALUE) + * in 2, 3 cases no exceptions are expected + * b) createBreakpointRequest(Location) + * c) createAccessWatchpointRequest(Field) + * d) createModificationWatchpointRequest(Field) + * f) deleteEventRequest(EventRequest) + * g) deleteEventRequests(List) + * In b)-g) cases NullPointerException is expected. + * COMMENTS: + * 10.21.2002 fix for #4764615 + * When calling + * createStepRequest(thread, Integer.MAX_VALUE,StepRequest.STEP_OVER) or + * createStepRequest(null, StepRequest.STEP_LINE,Integer.MAX_VALUE), + * throwing of IllegalArgumentException is expected. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager._bounds_.requests001 + * nsk.jdi.EventRequestManager._bounds_.requests001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager._bounds_.requests001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001a.java new file mode 100644 index 00000000000..66ec7addfb1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001a.java @@ -0,0 +1,54 @@ +/* + * 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.EventRequestManager._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * requests001a is deugee's part of the test. + */ +public class requests001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq001.java new file mode 100644 index 00000000000..85d5762e750 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq001.java @@ -0,0 +1,278 @@ +/* + * 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.EventRequestManager.accessWatchpointRequests; + +import com.sun.jdi.Field; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.request.AccessWatchpointRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.VMDisconnectedException; +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 + * com.sun.jdi.request.EventRequestManager.accessWatchpointRequests() + * properly returns all AccessWatchpointRequest objects when: + *

  • event requests are disabled + *
  • event requests are enabled
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the debugged VM from potential hangup. + */ +public class accwtchpreq001 { + 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.EventRequestManager.accessWatchpointRequests.accwtchpreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int FLDS_NUM = 16; + 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"}, + {"short", "sFld"}, + {"byte", "prFld"}, + {"float", "pubFld"}, + {"double", "protFld"}, + {"int", "tFld"}, + {"long", "vFld"}, + {"char", "fFld"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 accwtchpreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType rType; + List fields; + AccessWatchpointRequest awpRequest[] = + new AccessWatchpointRequest[FLDS_NUM]; + String cmd; + int i = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "accwtchpreq001t.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(); + } + + 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: " + e); + tot_res = FAILED; + return quitDebuggee(); + } + Iterator iter = fields.iterator(); + while (iter.hasNext()) { + Field fld = (Field) iter.next(); + log.display("Creating AccessWatchpointRequest for the field " + + fld.typeName() + " " + fld.name()); + try { + awpRequest[i++] = erManager.createAccessWatchpointRequest(fld); + } catch (Exception e) { + log.complain("TEST FAILURE: createAccessWatchpointRequest: " + e); + tot_res = FAILED; + return quitDebuggee(); + } + } + elThread = new EventListener(); + elThread.start(); + +// Check AccessWatchpoint requests when event requests are disabled + log.display("\n1) Getting AccessWatchpointRequest objects with disabled event requests..."); + checkRequests(erManager, 1); + +// Check AccessWatchpoint requests when event requests are enabled + for (i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.accessWatchpointRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled access watchpoint requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class accwtchpreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new accwtchpreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.accessWatchpointRequests.accwtchpreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + Field field = null; + + List requests = null; + ListIterator li = null; + + AccessWatchpointRequest request = null; + AccessWatchpointRequest awRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + field = debuggeeClass.fieldByName(fieldName); + + log2("......creating AccessWatchpointRequests"); + for (int i1 = 0; i1 < awRequests.length; i1++) { + awRequests[i1] = eventRManager.createAccessWatchpointRequest(field); + awRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new AccessWatchpointRequest"); + requests = eventRManager.accessWatchpointRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (AccessWatchpointRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created AccessWatchpointRequest"); + awRequests[i1].enable(); + requests = eventRManager.accessWatchpointRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (AccessWatchpointRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting AccessWatchpointRequests"); + for (int i2 = awRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(awRequests[i2]); + requests = eventRManager.accessWatchpointRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002/TestDescription.java new file mode 100644 index 00000000000..ac38ae5af07 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/accessWatchpointRequests/accwtchpreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.accessWatchpointRequests() + * complies with its spec: + * public List accessWatchpointRequests() + * Return an unmodifiable list of the enabled and disabled access watchpoint + * requests. This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all AccessWatchpointRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled access watchpoint requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.accessWatchpointRequests.accwtchpreq002; + * the debuggee program - nsk.jdi.EventRequestManager.accessWatchpointRequests.accwtchpreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.accessWatchpointRequests.accwtchpreq002 + * nsk.jdi.EventRequestManager.accessWatchpointRequests.accwtchpreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.accessWatchpointRequests.accwtchpreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002a.java new file mode 100644 index 00000000000..a7c39fc63b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/accessWatchpointRequests/accwtchpreq002a.java @@ -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.EventRequestManager.accessWatchpointRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the accwtchpreq002 JDI test. + */ + +public class accwtchpreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq001.java new file mode 100644 index 00000000000..c22163dbf73 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq001.java @@ -0,0 +1,316 @@ +/* + * 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.EventRequestManager.breakpointRequests; + +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ObjectCollectedException; +//import com.sun.jdi.InvalidLineNumberException; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.Location; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.BreakpointRequest; +import com.sun.jdi.request.EventRequestManager; +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 + * com.sun.jdi.request.EventRequestManager.breakpointRequests() + * properly returns all previously created BreakpointRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class breakpreq001 { + 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.EventRequestManager.breakpointRequests.breakpreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int BPS_NUM = 10; + static final String DEBUGGEE_BPS[][] = { + {"main", "void", "breakpreq001t.java"}, + {"byteMeth", "byte", "breakpreq001t.java"}, + {"shortMeth", "short", "breakpreq001t.java"}, + {"prMeth", "int", "breakpreq001t.java"}, + {"protMeth", "long", "breakpreq001t.java"}, + {"floatMeth", "float", "breakpreq001t.java"}, + {"doubleMeth", "double", "breakpreq001t.java"}, + {"charMeth", "char", "breakpreq001t.java"}, + {"boolMeth", "boolean", "breakpreq001t.java"}, + {"pubMeth", "java.lang.String", "breakpreq001t.java"} + }; + static final int DEBUGGEE_LNS[] = { + 37, 54, 57, 60, 63, 66, 69, 72, 75, 78 + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 breakpreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType rType; + List loctns; + BreakpointRequest bpRequest[] = new BreakpointRequest[BPS_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "breakpreq001t.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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null"); + tot_res = FAILED; + return quitDebuggee(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.breakpointRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled breakpoint requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class breakpreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new breakpreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.breakpointRequests.breakpreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + Location breakpLocation = null; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + BreakpointRequest request = null; + BreakpointRequest bpRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating BreakpointRequests"); + for (int i1 = 0; i1 < bpRequests.length; i1++) { + bpRequests[i1] = eventRManager.createBreakpointRequest(breakpLocation); + bpRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new BreakpointRequest"); + requests = eventRManager.breakpointRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 2) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 2)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (BreakpointRequest) li.next(); + if ( request.getProperty("number").equals("zero") ) + continue; + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created BreakpointRequest"); + bpRequests[i1].enable(); + requests = eventRManager.breakpointRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 2) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 2)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (BreakpointRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting BreakpointRequests"); + for (int i2 = bpRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(bpRequests[i2]); + requests = eventRManager.breakpointRequests(); + listSize = requests.size(); + if ( listSize != (i2 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i2 + 1)); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); +breakpLocation = lineLocation; + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002/TestDescription.java new file mode 100644 index 00000000000..8c8b238219b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/breakpointRequests/breakpreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.breakpointRequests() + * complies with its spec: + * public List breakpointRequests() + * Return an unmodifiable list of the enabled and disabled breakpoint requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all BreakpointRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled breakpoint requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.breakpointRequests.breakpreq002; + * the debuggee program - nsk.jdi.EventRequestManager.breakpointRequests.breakpreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.breakpointRequests.breakpreq002 + * nsk.jdi.EventRequestManager.breakpointRequests.breakpreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.breakpointRequests.breakpreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002a.java new file mode 100644 index 00000000000..55295438568 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/breakpointRequests/breakpreq002a.java @@ -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.EventRequestManager.breakpointRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the breakpreq002 JDI test. + */ + +public class breakpreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq001.java new file mode 100644 index 00000000000..888b2f5ee87 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq001.java @@ -0,0 +1,254 @@ +/* + * 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.EventRequestManager.classPrepareRequests; + +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.ClassPrepareRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.event.*; + +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 + * com.sun.jdi.request.EventRequestManager.classPrepareRequests() + * properly returns all previously created ClassPrepareRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled.
    + * ClassPrepareRequest objects are distinguished by the different + * EventRequest's properties.
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class clsprepreq001 { + 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.EventRequestManager.classPrepareRequests.clsprepreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int CLSP_NUM = 7; + static final String PROPS[][] = { + {"first", "a quick"}, + {"second", "brown"}, + {"third", "fox"}, + {"fourth", "jumps"}, + {"fifth", "over"}, + {"sixth", "the lazy"}, + {"seventh", "dog"} + }; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 clsprepreq001().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); + ClassPrepareRequest clpRequest[] = new ClassPrepareRequest[CLSP_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "clsprepreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.classPrepareRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled class prepare requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class clsprepreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new clsprepreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.classPrepareRequests.clsprepreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + ClassPrepareRequest request = null; + ClassPrepareRequest cpRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + cpRequest.putProperty("number", "zero"); + cpRequest.enable(); + + log2("......creating ClassPrepareRequests"); + for (int i1 = 0; i1 < cpRequests.length; i1++) { + cpRequests[i1] = eventRManager.createClassPrepareRequest(); + cpRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new ClassPrepareRequest"); + requests = eventRManager.classPrepareRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 2) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 2)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (ClassPrepareRequest) li.next(); + if ( request.getProperty("number").equals("zero") ) + continue; + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created ClassPrepareRequest"); + cpRequests[i1].enable(); + requests = eventRManager.classPrepareRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 2) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 2)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (ClassPrepareRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting ClassPrepareRequests"); + for (int i2 = cpRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(cpRequests[i2]); + requests = eventRManager.classPrepareRequests(); + listSize = requests.size(); + if ( listSize != (i2 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i2 + 1)); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002/TestDescription.java new file mode 100644 index 00000000000..ba92c849d4c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.classPrepareRequests() + * complies with its spec: + * public List classPrepareRequests() + * Return an unmodifiable list of the enabled and disabled class prepare requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all ClassPrepareRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled class prepare requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.classPrepareRequests.clsprepreq002; + * the debuggee program - nsk.jdi.EventRequestManager.classPrepareRequests.clsprepreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.classPrepareRequests.clsprepreq002 + * nsk.jdi.EventRequestManager.classPrepareRequests.clsprepreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.classPrepareRequests.clsprepreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002a.java new file mode 100644 index 00000000000..0496a644c5a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classPrepareRequests/clsprepreq002a.java @@ -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.EventRequestManager.classPrepareRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the clsprepreq002 JDI test. + */ + +public class clsprepreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq001.java new file mode 100644 index 00000000000..7b72ea4a74c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq001.java @@ -0,0 +1,261 @@ +/* + * 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.EventRequestManager.classUnloadRequests; + +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.ClassUnloadRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.event.*; + +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 + * com.sun.jdi.request.EventRequestManager.classUnloadRequests() + * properly returns all previously created ClassUnloadRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled.
    + * ClassUnloadRequest objects are distinguished by the different + * EventRequest's properties.
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class clsunlreq001 { + 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.EventRequestManager.classUnloadRequests.clsunlreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int CLSUNL_NUM = 7; + static final String PROPS[][] = { + {"first", "a quick"}, + {"second", "brown"}, + {"third", "fox"}, + {"fourth", "jumps"}, + {"fifth", "over"}, + {"sixth", "the lazy"}, + {"seventh", "dog"} + }; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 clsunlreq001().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); + ClassUnloadRequest clunlRequest[] = new ClassUnloadRequest[CLSUNL_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "clsunlreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.classUnloadRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled class unload requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class clsunlreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new clsunlreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.classUnloadRequests.clsunlreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + ClassUnloadRequest request = null; + ClassUnloadRequest cuRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating ClassUnloadRequests"); + for (int i1 = 0; i1 < cuRequests.length; i1++) { + cuRequests[i1] = eventRManager.createClassUnloadRequest(); + cuRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new ClassUnloadRequest"); + requests = eventRManager.classUnloadRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (ClassUnloadRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created ClassUnloadRequest"); + cuRequests[i1].enable(); + requests = eventRManager.classUnloadRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (ClassUnloadRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting ClassUnloadRequests"); + for (int i2 = cuRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(cuRequests[i2]); + requests = eventRManager.classUnloadRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002/TestDescription.java new file mode 100644 index 00000000000..678fd978c2d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/classUnloadRequests/clsunlreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.classUnloadRequests() + * complies with its spec: + * public List classUnloadRequests() + * Return an unmodifiable list of the enabled and disabled class unload requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all ClassUnloadRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled class unload requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.classUnloadRequests.clsunlreq002; + * the debuggee program - nsk.jdi.EventRequestManager.classUnloadRequests.clsunlreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.classUnloadRequests.clsunlreq002 + * nsk.jdi.EventRequestManager.classUnloadRequests.clsunlreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.classUnloadRequests.clsunlreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002a.java new file mode 100644 index 00000000000..f6e7aab65bf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/classUnloadRequests/clsunlreq002a.java @@ -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.EventRequestManager.classUnloadRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the clsunlreq002 JDI test. + */ + +public class clsunlreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002.java new file mode 100644 index 00000000000..47df213bf33 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002.java @@ -0,0 +1,117 @@ +/* + * 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.EventRequestManager.createAccessWatchpointRequest; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.Field; +import com.sun.jdi.request.AccessWatchpointRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VMMismatchException; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.request.EventRequestManager.createAccessWatchpointRequest() + * properly throws NullPointerException - if field is null. + */ +public class craccwtchpreq002 { + 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.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + + 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 craccwtchpreq002().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); + AccessWatchpointRequest awpRequest; + String cmd; + Field fld = null; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "craccwtchpreq002t.err> "); + VirtualMachine 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); + return quitDebuggee(FAILED); + } + + if ( !vm.canWatchFieldAccess() ) { + log.display(" TEST CANCELLED due to: vm.canWatchFieldAccess() == false"); + return quitDebuggee(PASSED); + } + +// Trying to create AccessWatchpointRequest for null Field parameter + try { + awpRequest = + erManager.createAccessWatchpointRequest(fld); + } catch (NullPointerException e) { + log.display("TEST PASSED: EventRequestManager.createAccessWatchpointRequest() throws expected " + + e); + return quitDebuggee(PASSED); + } catch(VMMismatchException e) { + log.complain("TEST FAILED: EventRequestManager.createAccessWatchpointRequest() throws unexpected " + + e + "\n\tbut it should throw NullPointerException for a null field"); + return quitDebuggee(FAILED); + } catch(UnsupportedOperationException e) { // specified only in jdk1.4 + log.complain("WARNING: test has no result. EventRequestManager.createAccessWatchpointRequest() throws " + + e); + return quitDebuggee(PASSED); + } + log.complain("TEST FAILED: EventRequestManager.createAccessWatchpointRequest successfully done,\n\t" + + "but it should throw NullPointerException for a null field"); + return quitDebuggee(FAILED); + } + + private int quitDebuggee(int stat) { + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return stat; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002/TestDescription.java new file mode 100644 index 00000000000..4f1c1f0917c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002/TestDescription.java @@ -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/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that the JDI method + * com.sun.jdi.request.EventRequestManager.createAccessWatchpointRequest() + * properly throws NullPointerException - if field is null. + * COMMENTS + * To fix the bug 4509034, + * the check if + * vm.canWatchFieldAccess() == true + * is added to the beginning of the test. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq002 + * nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002t.java new file mode 100644 index 00000000000..c9c84578ab8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq002t.java @@ -0,0 +1,52 @@ +/* + * 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.EventRequestManager.createAccessWatchpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee class. + */ +public class craccwtchpreq002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Log log = argHandler.createDebugeeLog(); + + log.display("Debuggee: sending the command: " + + craccwtchpreq002.COMMAND_READY); + pipe.println(craccwtchpreq002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(craccwtchpreq002.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(craccwtchpreq002.JCK_STATUS_BASE + + craccwtchpreq002.FAILED); + } + System.exit(craccwtchpreq002.JCK_STATUS_BASE + + craccwtchpreq002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003.java new file mode 100644 index 00000000000..667958795e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003.java @@ -0,0 +1,489 @@ +/* + * 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.EventRequestManager.createAccessWatchpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createAccessWatchpointRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Multiple watchpoints on the same field are permitted.
    + * - Creates a new disabled watchpoint.
    + * - The watchpoint watches accesses to the specified field.
    + * - Throws: UnsupportedOperationException -
    + * if the target virtual machine does not support
    + * this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares testcase and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class craccwtchpreq003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new craccwtchpreq003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq003a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + Field field = null; + + List requests = null; + ListIterator li = null; + + AccessWatchpointRequest awRequest1 = null; + AccessWatchpointRequest awRequest2 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + field = debuggeeClass.fieldByName(fieldName); + + if ( vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == true"); + log2(" creating two AccessWatchpointRequests for 'field': awRequest1 & awRequest2"); + + awRequest1 = eventRManager.createAccessWatchpointRequest(field); + awRequest2 = eventRManager.createAccessWatchpointRequest(field); + + log2(" checking up on: requests are disabled"); + if (awRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: awRequest1 is enabled"); + } + if (awRequest2.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: awRequest2 is enabled"); + } + log2(" compareing field equality"); + if ( !awRequest1.field().equals(field) ) { + testExitCode = FAILED; + log3("ERROR: !awRequest1.field().equals(field)"); + } + if ( !awRequest2.field().equals(field) ) { + testExitCode = FAILED; + log3("ERROR: !awRequest2.field().equals(field)"); + } + + } else { + log2("......vm.canWatchFieldAccess == false"); + log2(" UnsupportedOperationException is expected"); + try { + awRequest1 = eventRManager.createAccessWatchpointRequest(field); + testExitCode = FAILED; + log3("ERROR: NO UnsupportedOperationException"); + } catch ( UnsupportedOperationException e ) { + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003/TestDescription.java new file mode 100644 index 00000000000..b40fc8a8b3d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createAccessWatchpointRequest() + * complies with its spec: + * public AccessWatchpointRequest createAccessWatchpointRequest(Field field) + * Creates a new disabled watchpoint which watches accesses to the specified field. + * The new watchpoint is added to the list managed by this EventRequestManager. + * Multiple watchpoints on the same field are permitted. + * Use EventRequest.enable() to activate this event request. + * Not all target virtual machines support this operation. + * Use VirtualMachine.canWatchFieldAccess() to determine + * if the operation is supported. + * Parameters: field - the field to watch + * Returns: the created watchpoint + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test checks up on the following assertions: + * - Multiple watchpoints on the same field are permitted. + * - Creates a new disabled watchpoint. + * - The watchpoint watches accesses to the specified field. + * - Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq003; + * the debuggee program - nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq003 + * nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createAccessWatchpointRequest.craccwtchpreq003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003a.java new file mode 100644 index 00000000000..4648ccbcf3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createAccessWatchpointRequest/craccwtchpreq003a.java @@ -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.EventRequestManager.createAccessWatchpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the craccwtchpreq003 JDI test. + */ + +public class craccwtchpreq003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002.java new file mode 100644 index 00000000000..98dacc92e17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002.java @@ -0,0 +1,112 @@ +/* + * 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.EventRequestManager.createBreakpointRequest; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.Location; +import com.sun.jdi.request.BreakpointRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VMMismatchException; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.request.EventRequestManager.createBreakpointRequest() + * properly throws NullPointerException - if location is null. + */ +public class crbreakpreq002 { + 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.EventRequestManager.createBreakpointRequest.crbreakpreq002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + + 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 crbreakpreq002().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); + BreakpointRequest bpRequest; + String cmd; + Location loc = null; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "crbreakpreq002t.err> "); + VirtualMachine 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); + return quitDebuggee(FAILED); + } + +// Trying to create BreakpointRequest for a null Location parameter + try { + bpRequest = + erManager.createBreakpointRequest(loc); + } catch (NullPointerException e) { + log.display("TEST PASSED: EventRequestManager.createBreakpointRequest() throws expected " + + e); + return quitDebuggee(PASSED); + } catch(VMMismatchException e) { + log.complain("TEST FAILED: EventRequestManager.createBreakpointRequest() throws unexpected " + + e + "\n\tbut it should throw NullPointerException for a null location"); + return quitDebuggee(FAILED); + } catch(UnsupportedOperationException e) { // specified only in jdk1.4 + log.complain("WARNING: test has no result. EventRequestManager.createBreakpointRequest() throws " + + e); + return quitDebuggee(PASSED); + } + log.complain("TEST FAILED: EventRequestManager.createBreakpointRequest() successfully done,\n\t" + + "but it should throw NullPointerException for a null location"); + return quitDebuggee(FAILED); + } + + private int quitDebuggee(int stat) { + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return stat; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002/TestDescription.java new file mode 100644 index 00000000000..47e6cc2f696 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002/TestDescription.java @@ -0,0 +1,50 @@ +/* + * 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/EventRequestManager/createBreakpointRequest/crbreakpreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that the JDI method + * com.sun.jdi.request.EventRequestManager.createBreakpointRequest() + * properly throws NullPointerException - if location is null. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq002 + * nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002t.java new file mode 100644 index 00000000000..07a98ae25e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq002t.java @@ -0,0 +1,52 @@ +/* + * 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.EventRequestManager.createBreakpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee class. + */ +public class crbreakpreq002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Log log = argHandler.createDebugeeLog(); + + log.display("Debuggee: sending the command: " + + crbreakpreq002.COMMAND_READY); + pipe.println(crbreakpreq002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(crbreakpreq002.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(crbreakpreq002.JCK_STATUS_BASE + + crbreakpreq002.FAILED); + } + System.exit(crbreakpreq002.JCK_STATUS_BASE + + crbreakpreq002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003.java new file mode 100644 index 00000000000..421eb141e56 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003.java @@ -0,0 +1,471 @@ +/* + * 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.EventRequestManager.createBreakpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createBreakpointRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Multiple breakpoints at the same location are permitted.
    + * - Creates a new disabled BreakpointRequest.
    + * - The BreakpointRequest is at the specified location.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares testcase and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class crbreakpreq003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new crbreakpreq003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq003a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + Location breakpLocation = null; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + BreakpointRequest bpRequest1 = null; + BreakpointRequest bpRequest2 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" creating two BreakpointRequests for 'breakpLocation': bpRequest1 & bpRequest2"); + + bpRequest1 = eventRManager.createBreakpointRequest(breakpLocation); + bpRequest2 = eventRManager.createBreakpointRequest(breakpLocation); + + log2(" checking up on: requests are disabled"); + if (bpRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: bpRequest1 is enabled"); + } + if (bpRequest2.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: bpRequest2 is enabled"); + } + log2(" compareing locations equality"); + if ( !bpRequest1.location().equals(breakpLocation) ) { + testExitCode = FAILED; + log3("ERROR: !bpRequest1.location().equals(breakpLocation)"); + } + if ( !bpRequest2.location().equals(breakpLocation) ) { + testExitCode = FAILED; + log3("ERROR: !bpRequest2.location().equals(breakpLocation)"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); +breakpLocation = lineLocation; + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003/TestDescription.java new file mode 100644 index 00000000000..c5f1db123f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/EventRequestManager/createBreakpointRequest/crbreakpreq003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createBreakpointRequest() + * complies with its spec: + * public BreakpointRequest createBreakpointRequest(Location location) + * Creates a new disabled BreakpointRequest. + * The given Location must have a valid (that is, non-negative) code index. + * The new breakpoint is added to the list managed by this EventRequestManager. + * Multiple breakpoints at the same location are permitted. + * Use EventRequest.enable() to activate this event request. + * Parameters: location - the location of the new breakpoint. + * Returns: the created BreakpointRequest + * Throws: NativeMethodException - if location is within a native method. + * The test checks up on the following assertions: + * - Multiple breakpoints at the same location are permitted. + * - Creates a new disabled BreakpointRequest. + * - The BreakpointRequest is at the specified location. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq003; + * the debuggee program - nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createBreakpointRequest.crbreakpreq003 + * nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createBreakpointRequest.crbreakpreq003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003a.java new file mode 100644 index 00000000000..841eafc3f7b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createBreakpointRequest/crbreakpreq003a.java @@ -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.EventRequestManager.createBreakpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the crbreakpreq003 JDI test. + */ + +public class crbreakpreq003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001.java new file mode 100644 index 00000000000..6293bd2d897 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001.java @@ -0,0 +1,444 @@ +/* + * 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.EventRequestManager.createClassPrepareRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createClassPrepareRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled ClassPrepareRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class cpreg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new cpreg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createClassPrepareRequest.cpreg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + ClassPrepareRequest cpRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating: cpRequest1 = eventRManager.createClassPrepareRequest();"); + cpRequest1 = eventRManager.createClassPrepareRequest(); + log2(" checking up on if request is disabled"); + if (cpRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001/TestDescription.java new file mode 100644 index 00000000000..64e78f14f69 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001/TestDescription.java @@ -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/EventRequestManager/createClassPrepareRequest/cpreg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createClassPrepareRequest() + * complies with its spec: + * public ClassPrepareRequest createClassPrepareRequest() + * Creates a new disabled ClassPrepareRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Returns: the created ClassPrepareRequest + * The test checks up on the following assertions: + * - Creates a new disabled ClassPrepareRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createClassPrepareRequest.cpreg001; + * the debuggee program - nsk.jdi.EventRequestManager.createClassPrepareRequest.cpreg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createClassPrepareRequest.cpreg001 + * nsk.jdi.EventRequestManager.createClassPrepareRequest.cpreg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createClassPrepareRequest.cpreg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001a.java new file mode 100644 index 00000000000..4263edf664a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassPrepareRequest/cpreg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createClassPrepareRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the cpreg001 JDI test. + */ + +public class cpreg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001.java new file mode 100644 index 00000000000..a8a8d3eb9f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001.java @@ -0,0 +1,445 @@ +/* + * 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.EventRequestManager.createClassUnloadRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createClassUnloadRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled ClassUnloadRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class cureg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new cureg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createClassUnloadRequest.cureg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + ClassUnloadRequest cuRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating: cuRequest1 = eventRManager.createClassUnloadRequest();"); + cuRequest1 = eventRManager.createClassUnloadRequest(); + log2(" checking up on if request is disabled"); + if (cuRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001/TestDescription.java new file mode 100644 index 00000000000..7f191547278 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001/TestDescription.java @@ -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/EventRequestManager/createClassUnloadRequest/cureg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createClassUnloadRequest() + * complies with its spec: + * public ClassUnloadRequest createClassUnloadRequest() + * Creates a new disabled ClassUnloadRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Returns: the created ClassUnloadRequest + * The test checks up on the following assertions: + * - Creates a new disabled ClassUnloadRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createClassUnloadRequest.cureg001; + * the debuggee program - nsk.jdi.EventRequestManager.createClassUnloadRequest.cureg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createClassUnloadRequest.cureg001 + * nsk.jdi.EventRequestManager.createClassUnloadRequest.cureg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createClassUnloadRequest.cureg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001a.java new file mode 100644 index 00000000000..368daa92a93 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createClassUnloadRequest/cureg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createClassUnloadRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the cureg001 JDI test. + */ + +public class cureg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009.java new file mode 100644 index 00000000000..b3a61e6a92e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009.java @@ -0,0 +1,469 @@ +/* + * 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.EventRequestManager.createExceptionRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createExceptionRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled ExceptionRequest.
    + * - A specific exception type and its subclasses
    + * can be selected for exception events.
    + * - Caught exceptions, uncaught exceptions, or both can be selected.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new testcase and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class crexreq009 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new crexreq009().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createExceptionRequest.crexreq009a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + ExceptionRequest exRequest = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType refType = (ReferenceType) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)).type(); + + log2("......creating: exRequest = eventRManager.createExceptionRequest(refType, false, true);"); + exRequest = eventRManager.createExceptionRequest(refType, false, true); + log2(" check on if request is disabled"); + if (exRequest.isEnabled()) { + log3("ERROR: request is enabled"); + testExitCode = FAILED; + } + + log2("......creating: exRequest = eventRManager.createExceptionRequest(null, true, false);"); + exRequest = eventRManager.createExceptionRequest(null, true, false); + log2(" check on if request is disabled"); + if (exRequest.isEnabled()) { + log3("ERROR: request is enabled"); + testExitCode = FAILED; + } + + log2("......creating: exRequest = eventRManager.createExceptionRequest(null, true, true);"); + exRequest = eventRManager.createExceptionRequest(null, true, true); + log2(" check on if request is disabled"); + if (exRequest.isEnabled()) { + log3("ERROR: request is enabled"); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009/TestDescription.java new file mode 100644 index 00000000000..1cab2ba5bac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/EventRequestManager/createExceptionRequest/crexreq009. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createExceptionRequest() + * complies with its spec: + * public ExceptionRequest createExceptionRequest(ReferenceType refType, + * boolean notifyCaught, + * boolean notifyUncaught) + * Creates a new disabled ExceptionRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * A specific exception type and its subclasses can be selected for exception events. + * Caught exceptions, uncaught exceptions, or both can be selected. + * Note, however, that at the time an exception is thrown, + * it is not always possible to determine whether it is truly caught. + * See ExceptionEvent.catchLocation() for details. + * Parameters: refType - If non-null, specifies that exceptions + * which are instances of refType will be reported. + * Note: this will include instances of sub-types. + * If null, all instances will be reported + * notifyCaught - If true, caught exceptions will be reported. + * notifyUncaught - If true, uncaught exceptions will be reported. + * Returns: the created ExceptionRequest + * The test checks up on the following assertions: + * - Creates a new disabled ExceptionRequest. + * - A specific exception type and its subclasses can be selected for exception events. + * - Caught exceptions, uncaught exceptions, or both can be selected. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createExceptionRequest.crexreq009; + * the debuggee program - nsk.jdi.EventRequestManager.createExceptionRequest.crexreq009a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createExceptionRequest.crexreq009 + * nsk.jdi.EventRequestManager.createExceptionRequest.crexreq009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createExceptionRequest.crexreq009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009a.java new file mode 100644 index 00000000000..78d9fe5cc49 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq009a.java @@ -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.EventRequestManager.createExceptionRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the crexreq009 JDI test. + */ + +public class crexreq009a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static NullPointerException testField = new NullPointerException("test"); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010.java new file mode 100644 index 00000000000..baab21ecd73 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010.java @@ -0,0 +1,460 @@ +/* + * 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.EventRequestManager.createExceptionRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createExceptionRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - If neither caught exception nor uncaught exception is selected,
    + * that is, both notifyCaught and notifyUncaught arguments are false,
    + * returned value is null.
    + * Note. In condition of no Exception for such testcase is defined in
    + * the spec, null is the only reasonable returned value.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a testcase and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class crexreq010 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new crexreq010().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createExceptionRequest.crexreq010a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + ExceptionRequest exRequest = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType refType = (ReferenceType) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)).type(); + + + try { + log2("......creating: exRequest = eventRManager.createExceptionRequest(refType, false, false);"); + exRequest = eventRManager.createExceptionRequest(refType, false, false); + log2(" check on if returned value is null"); + if (exRequest == null) { + log3("ERROR: returned value is null!"); + testExitCode = FAILED; + } + } catch (Exception e) { + log3("ERROR: exception caught: " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010/TestDescription.java new file mode 100644 index 00000000000..f3db992045a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010/TestDescription.java @@ -0,0 +1,94 @@ +/* + * 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/EventRequestManager/createExceptionRequest/crexreq010. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createExceptionRequest() + * complies with its spec: + * public ExceptionRequest createExceptionRequest(ReferenceType refType, + * boolean notifyCaught, + * boolean notifyUncaught) + * Creates a new disabled ExceptionRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * A specific exception type and its subclasses can be selected for exception events. + * Caught exceptions, uncaught exceptions, or both can be selected. + * Note, however, that at the time an exception is thrown, + * it is not always possible to determine whether it is truly caught. + * See ExceptionEvent.catchLocation() for details. + * Parameters: refType - If non-null, specifies that exceptions + * which are instances of refType will be reported. + * Note: this will include instances of sub-types. + * If null, all instances will be reported + * notifyCaught - If true, caught exceptions will be reported. + * notifyUncaught - If true, uncaught exceptions will be reported. + * Returns: the created ExceptionRequest + * The test checks up on the following assertion: + * - If neither caught exception nor uncaught exception is selected, + * that is, both notifyCaught and notifyUncaught arguments are false, + * returned value is null. + * Note. In condition of no Exception for such testcase is defined in the spec, + * null is the only reasonable returned value. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createExceptionRequest.crexreq010; + * the debuggee program - nsk.jdi.EventRequestManager.createExceptionRequest.crexreq010a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test fixed according to test bug: + * 4615030 crexreq010: method createExceptionRequest() doesn't return expected + * - test now checks that createExceptionRequest() returns non-null object + * and no unspecified exception is thrown + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createExceptionRequest.crexreq010 + * nsk.jdi.EventRequestManager.createExceptionRequest.crexreq010a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createExceptionRequest.crexreq010 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010a.java new file mode 100644 index 00000000000..40db2c30b7e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createExceptionRequest/crexreq010a.java @@ -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.EventRequestManager.createExceptionRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the crexreq010 JDI test. + */ + +public class crexreq010a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static NullPointerException testField = new NullPointerException("test"); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001.java new file mode 100644 index 00000000000..ea0e995c3f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001.java @@ -0,0 +1,445 @@ +/* + * 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.EventRequestManager.createMethodEntryRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createMethodEntryRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled MethodEntryRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class menreg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new menreg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createMethodEntryRequest.menreg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + MethodEntryRequest menRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating: menRequest1 = eventRManager.createMethodEntryRequest();"); + menRequest1 = eventRManager.createMethodEntryRequest(); + log2(" checking up on if request is disabled"); + if (menRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001/TestDescription.java new file mode 100644 index 00000000000..904b229cb94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001/TestDescription.java @@ -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/EventRequestManager/createMethodEntryRequest/menreg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createMethodEntryRequest() + * complies with its spec: + * public MethodEntryRequest createMethodEntryRequest() + * Creates a new disabled MethodEntryRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Returns: the created MethodEntryRequest + * The test checks up on the following assertions: + * - Creates a new disabled MethodEntryRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createMethodEntryRequest.menreg001; + * the debuggee program - nsk.jdi.EventRequestManager.createMethodEntryRequest.menreg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createMethodEntryRequest.menreg001 + * nsk.jdi.EventRequestManager.createMethodEntryRequest.menreg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createMethodEntryRequest.menreg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001a.java new file mode 100644 index 00000000000..3e45e493dc0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodEntryRequest/menreg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createMethodEntryRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the menreg001 JDI test. + */ + +public class menreg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001.java new file mode 100644 index 00000000000..1745d3c968f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001.java @@ -0,0 +1,445 @@ +/* + * 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.EventRequestManager.createMethodExitRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createMethodExitRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled MethodExitRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class mexreg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new mexreg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createMethodExitRequest.mexreg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + MethodExitRequest mexRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating: mexRequest1 = eventRManager.createMethodExitRequest();"); + mexRequest1 = eventRManager.createMethodExitRequest(); + log2(" checking up on if request is disabled"); + if (mexRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001/TestDescription.java new file mode 100644 index 00000000000..593628da2ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001/TestDescription.java @@ -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/EventRequestManager/createMethodExitRequest/mexreg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createMethodExitRequest() + * complies with its spec: + * public MethodExitRequest createMethodExitRequest() + * Creates a new disabled MethodExitRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Returns: the created MethodExitRequest + * The test checks up on the following assertions: + * - Creates a new disabled MethodExitRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createMethodExitRequest.mexreg001; + * the debuggee program - nsk.jdi.EventRequestManager.createMethodExitRequest.mexreg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createMethodExitRequest.mexreg001 + * nsk.jdi.EventRequestManager.createMethodExitRequest.mexreg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createMethodExitRequest.mexreg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001a.java new file mode 100644 index 00000000000..19a781f61a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createMethodExitRequest/mexreg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createMethodExitRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the mexreg001 JDI test. + */ + +public class mexreg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002.java new file mode 100644 index 00000000000..2a0c4899701 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002.java @@ -0,0 +1,117 @@ +/* + * 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.EventRequestManager.createModificationWatchpointRequest; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.Field; +import com.sun.jdi.request.ModificationWatchpointRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VMMismatchException; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.request.EventRequestManager.createModificationWatchpointRequest() + * properly throws NullPointerException - if field is null. + */ +public class crmodwtchpreq002 { + 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.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq002t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + + 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 crmodwtchpreq002().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); + ModificationWatchpointRequest awpRequest; + String cmd; + Field fld = null; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "crmodwtchpreq002t.err> "); + VirtualMachine 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); + return quitDebuggee(FAILED); + } + + if ( !vm.canWatchFieldModification() ) { + log.display(" TEST CANCELLED due to: vm.canWatchFieldModification() == false"); + return quitDebuggee(PASSED); + } + +// Trying to create ModificationWatchpointRequest for a null Field parameter + try { + awpRequest = + erManager.createModificationWatchpointRequest(fld); + } catch (NullPointerException e) { + log.display("TEST PASSED: EventRequestManager.createModificationWatchpointRequest() throws expected " + + e); + return quitDebuggee(PASSED); + } catch(VMMismatchException e) { + log.complain("TEST FAILED: EventRequestManager.createModificationWatchpointRequest() throws unexpected " + + e + "\n\tbut it should throw NullPointerException for a null field"); + return quitDebuggee(FAILED); + } catch(UnsupportedOperationException e) { // specified only in jdk1.4 + log.complain("WARNING: test has no result. EventRequestManager.createModificationWatchpointRequest() throws " + + e); + return quitDebuggee(PASSED); + } + log.complain("TEST FAILED: EventRequestManager.createModificationWatchpointRequest() successfully done,\n\t" + + "but it should throw NullPointerException for a null field"); + return quitDebuggee(FAILED); + } + + private int quitDebuggee(int stat) { + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return stat; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002/TestDescription.java new file mode 100644 index 00000000000..23c91c41492 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002/TestDescription.java @@ -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/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that the JDI method + * com.sun.jdi.request.EventRequestManager.createModificationWatchpointRequest() + * properly throws NullPointerException - if field is null. + * COMMENTS + * To fix the bug 4509034, + * the check if + * vm.canWatchFieldModification() == true + * is added to the beginning of the test. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq002 + * nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002t.java new file mode 100644 index 00000000000..795db253ad1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq002t.java @@ -0,0 +1,52 @@ +/* + * 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.EventRequestManager.createModificationWatchpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee class. + */ +public class crmodwtchpreq002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Log log = argHandler.createDebugeeLog(); + + log.display("Debuggee: sending the command: " + + crmodwtchpreq002.COMMAND_READY); + pipe.println(crmodwtchpreq002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(crmodwtchpreq002.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(crmodwtchpreq002.JCK_STATUS_BASE + + crmodwtchpreq002.FAILED); + } + System.exit(crmodwtchpreq002.JCK_STATUS_BASE + + crmodwtchpreq002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003.java new file mode 100644 index 00000000000..3a074620e87 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003.java @@ -0,0 +1,488 @@ +/* + * 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.EventRequestManager.createModificationWatchpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createModificationWatchpointRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Multiple watchpoints on the same field are permitted.
    + * - Creates a new disabled watchpoint.
    + * - The watchpoint watches modification of the specified field.
    + * - Throws: UnsupportedOperationException -
    + * if the target virtual machine does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares testcase and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class crmodwtchpreq003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new crmodwtchpreq003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq003a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + Field field = null; + + List requests = null; + ListIterator li = null; + + ModificationWatchpointRequest mwRequest1 = null; + ModificationWatchpointRequest mwRequest2 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + field = debuggeeClass.fieldByName(fieldName); + + if ( vm.canWatchFieldModification() ) { + log2("......vm.canWatchFieldModification == true"); + log2(" creating two ModificationWatchpointRequests for 'field': mwRequest1 & mwRequest2"); + + mwRequest1 = eventRManager.createModificationWatchpointRequest(field); + mwRequest2 = eventRManager.createModificationWatchpointRequest(field); + + log2(" checking up on: requests are disabled"); + if (mwRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: mwRequest1 is enabled"); + } + if (mwRequest2.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: mwRequest2 is enabled"); + } + log2(" compareing field equality"); + if ( !mwRequest1.field().equals(field) ) { + testExitCode = FAILED; + log3("ERROR: !mwRequest1.field().equals(field)"); + } + if ( !mwRequest2.field().equals(field) ) { + testExitCode = FAILED; + log3("ERROR: !mwRequest2.field().equals(field)"); + } + + } else { + log2("......vm.canWatchFieldModification == false"); + log2(" UnsupportedOperationException is expected"); + try { + mwRequest1 = eventRManager.createModificationWatchpointRequest(field); + testExitCode = FAILED; + log3("ERROR: NO UnsupportedOperationException"); + } catch ( UnsupportedOperationException e ) { + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003/TestDescription.java new file mode 100644 index 00000000000..36377d73a12 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createModificationWatchpointRequest() + * complies with its spec: + * public ModificationWatchpointRequest createModificationWatchpointRequest(Field field) + * Creates a new disabled watchpoint which watches accesses to the specified field. + * The new watchpoint is added to the list managed by this EventRequestManager. + * Multiple watchpoints on the same field are permitted. + * Use EventRequest.enable() to activate this event request. + * Not all target virtual machines support this operation. + * Use VirtualMachine.canWatchFieldModification() to determine + * if the operation is supported. + * Parameters: field - the field to watch + * Returns: the created watchpoint + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test checks up on the following assertions: + * - Multiple watchpoints on the same field are permitted. + * - Creates a new disabled watchpoint. + * - The watchpoint watches accesses to the specified field. + * - Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq003; + * the debuggee program - nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq003 + * nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createModificationWatchpointRequest.crmodwtchpreq003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003a.java new file mode 100644 index 00000000000..1771ab415c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createModificationWatchpointRequest/crmodwtchpreq003a.java @@ -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.EventRequestManager.createModificationWatchpointRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the crmodwtchpreq003 JDI test. + */ + +public class crmodwtchpreq003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001.java new file mode 100644 index 00000000000..0e0e1b64ebf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001.java @@ -0,0 +1,178 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import com.sun.jdi.ThreadReference; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.StepRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.DuplicateRequestException; +import com.sun.jdi.ObjectCollectedException; +import com.sun.jdi.VMMismatchException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that only one pending JDI step request is + * allowed per thread, i.e. the JDI method + * com.sun.jdi.request.EventRequestManager.createStepRequest() + * properly throws a DuplicateRequestException if there + * is already a pending step request for the specified thread. + */ +public class crstepreq001 { + 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.EventRequestManager.createStepRequest.crstepreq001t"; + static final String DEBUGGEE_THRD = "debuggee_thr"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int RSTS_NUM = 6; + static final int RESTRICTIONS[][] = { + {StepRequest.STEP_MIN, StepRequest.STEP_INTO}, + {StepRequest.STEP_MIN, StepRequest.STEP_OVER}, + {StepRequest.STEP_MIN, StepRequest.STEP_OUT}, + {StepRequest.STEP_LINE, StepRequest.STEP_INTO}, + {StepRequest.STEP_LINE, StepRequest.STEP_OVER}, + {StepRequest.STEP_LINE, StepRequest.STEP_OUT} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private int tot_res = PASSED; + + 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 crstepreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ThreadReference thR = null; + List threads; + List enabledStepRequests = new LinkedList<>(); + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "crstepreq001t.err> "); + VirtualMachine 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); + return quitDebuggee(FAILED); + } + + try { + threads = vm.allThreads(); + } catch (Exception e) { + log.complain("TEST FAILURE: allThreads: " + e); + return quitDebuggee(FAILED); + } + Iterator iter = threads.iterator(); + while (iter.hasNext()) { + thR = (ThreadReference) iter.next(); + if (thR.name().equals(DEBUGGEE_THRD)) { + log.display("\nCreating StepRequest for the debuggee's thread \"" + + thR.name() + "\""); + try { + StepRequest sReq = erManager.createStepRequest(thR, + RESTRICTIONS[0][0],RESTRICTIONS[0][1]); + sReq.enable(); + enabledStepRequests.add(sReq); + } catch (DuplicateRequestException e) { + log.complain("TEST FAILURE: createStepRequest: caught " + e); + return quitDebuggee(FAILED); + } catch (ObjectCollectedException e) { + log.complain("TEST FAILURE: createStepRequest: caught " + e); + return quitDebuggee(FAILED); + } catch (VMMismatchException e) { + log.complain("TEST FAILURE: createStepRequest: caught " + e); + return quitDebuggee(FAILED); + } + break; + } + } + +// Check that createStepRequest() throws DuplicateRequestException +// to indicate a duplicate event request per thread + for(int i=0; i erManager.deleteEventRequest(s)); + + return quitDebuggee(tot_res); + } + + private int quitDebuggee(int stat) { + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return stat; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001/TestDescription.java new file mode 100644 index 00000000000..7d48ae61e15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001/TestDescription.java @@ -0,0 +1,53 @@ +/* + * 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/EventRequestManager/createStepRequest/crstepreq001. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-4447344 + * VM Testbase readme: + * DESCRIPTION + * This test checks that only one pending JDI step request is + * allowed per thread, i.e. the JDI method + * com.sun.jdi.request.EventRequestManager.createStepRequest() + * properly throws a DuplicateRequestException if there + * is already a pending step request for the specified thread. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq001 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001t.java new file mode 100644 index 00000000000..ec910b298a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq001t.java @@ -0,0 +1,52 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This is a debuggee class. + */ +public class crstepreq001t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Thread thr = Thread.currentThread(); + + thr.setName(crstepreq001.DEBUGGEE_THRD); + pipe.println(crstepreq001.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(crstepreq001.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(crstepreq001.JCK_STATUS_BASE + + crstepreq001.FAILED); + } + System.exit(crstepreq001.JCK_STATUS_BASE + + crstepreq001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java new file mode 100644 index 00000000000..2571289065d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java @@ -0,0 +1,556 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createStepRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled StepRequest.
    + * - STEP_MIN, STEP_LINE, STEP_INTO, STEP_OVER, STEP_OUT are valid
    + * arguments, that is, they don't throw IllegalArgumentException.
    + * - Values larger and lesser corresponding above are invalid arguments,
    + * that is, they do throw IllegalArgumentException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertions,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new testcase and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class crstepreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createStepRequest/crstepreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new crstepreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createStepRequest.crstepreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + ThreadReference thread = null; + String threadName = "thread1"; + + StepRequest stRequest = null; + + int minDepth, maxDepth; + int minSize, maxSize; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + thread = threadByName(threadName); + + if (StepRequest.STEP_MIN > StepRequest.STEP_LINE) { + maxSize = StepRequest.STEP_MIN; + minSize = StepRequest.STEP_LINE; + } else { + minSize = StepRequest.STEP_MIN; + maxSize = StepRequest.STEP_LINE; + } + + if ( (StepRequest.STEP_INTO > StepRequest.STEP_OVER) && + (StepRequest.STEP_INTO > StepRequest.STEP_OUT) ) + maxDepth = StepRequest.STEP_INTO; + + if ( (StepRequest.STEP_OVER > StepRequest.STEP_INTO) && + (StepRequest.STEP_OVER > StepRequest.STEP_OUT) ) + maxDepth = StepRequest.STEP_OVER; + + if ( (StepRequest.STEP_OUT > StepRequest.STEP_OVER) && + (StepRequest.STEP_OUT > StepRequest.STEP_INTO) ) + maxDepth = StepRequest.STEP_OUT; + + if ( (StepRequest.STEP_INTO < StepRequest.STEP_OVER) && + (StepRequest.STEP_INTO < StepRequest.STEP_OUT) ) + minDepth = StepRequest.STEP_INTO; + + if ( (StepRequest.STEP_OVER < StepRequest.STEP_INTO) && + (StepRequest.STEP_OVER < StepRequest.STEP_OUT) ) + minDepth = StepRequest.STEP_OVER; + + if ( (StepRequest.STEP_OUT < StepRequest.STEP_OVER) && + (StepRequest.STEP_OUT < StepRequest.STEP_INTO) ) + minDepth = StepRequest.STEP_OUT; + + try { + log2("......creating: eventRManager.createStepRequest(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO);"); + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO); + log2(" checking up on if request is disabled"); + if (stRequest.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is enabled"); + } + } catch ( IllegalArgumentException e ) { + testExitCode = FAILED; + log3("ERROR: IllegalArgumentException for STEP_MIN - STEP_INTO"); + } + eventRManager.deleteEventRequest(stRequest); + try { + log2("......creating: eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);"); + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + log2(" checking up on if request is disabled"); + if (stRequest.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is enabled"); + } + } catch ( IllegalArgumentException e ) { + testExitCode = FAILED; + log3("ERROR: IllegalArgumentException for STEP_LINE - STEP_OVER"); + } + eventRManager.deleteEventRequest(stRequest); + try { + log2("......creating: eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT);"); + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT); + log2(" checking up on if request is disabled"); + if (stRequest.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is enabled"); + } + } catch ( IllegalArgumentException e ) { + testExitCode = FAILED; + log3("ERROR: IllegalArgumentException for STEP_LINE - STEP_OUT"); + } + eventRManager.deleteEventRequest(stRequest); + log2("......creating: eventRManager.createStepRequest(thread, minSize -1, StepRequest.STEP_OUT);"); + log2(" IllegalArgumentException is expected"); + try { + stRequest = eventRManager.createStepRequest(thread, minSize -1, StepRequest.STEP_OUT); + testExitCode = FAILED; + log3("ERROR: no IllegalArgumentException thrown"); + } catch ( IllegalArgumentException e ) { + } + eventRManager.deleteEventRequest(stRequest); + log2("......creating: eventRManager.createStepRequest(thread, maxSize +1, StepRequest.STEP_OUT);"); + log2(" IllegalArgumentException is expected"); + try { + stRequest = eventRManager.createStepRequest(thread, maxSize +1, StepRequest.STEP_OUT); + testExitCode = FAILED; + log3("ERROR: no IllegalArgumentException thrown"); + } catch ( IllegalArgumentException e ) { + } + eventRManager.deleteEventRequest(stRequest); + log2("......creating: eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, minDepth -1);"); + log2(" IllegalArgumentException is expected"); + try { + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, minDepth -1); + testExitCode = FAILED; + log3("ERROR: no IllegalArgumentException thrown"); + } catch ( IllegalArgumentException e ) { + } + eventRManager.deleteEventRequest(stRequest); + log2("......creating: eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, maxDepth +1);"); + log2(" IllegalArgumentException is expected"); + try { + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, maxDepth +1); + testExitCode = FAILED; + log3("ERROR: no IllegalArgumentException thrown"); + } catch ( IllegalArgumentException e ) { + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002/TestDescription.java new file mode 100644 index 00000000000..3b52b200119 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/EventRequestManager/createStepRequest/crstepreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createStepRequest() + * complies with its spec: + * public StepRequest createStepRequest(ThreadReference thread, int size, int depth) + * Creates a new disabled StepRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * The returned request will control stepping only in the specified thread; + * all other threads will be unaffected. + * A sizevalue of StepRequest.STEP_MIN will generate a step event each time the code index changes. + * It represents the smallest step size available and often maps to the instruction level. + * A size value of StepRequest.STEP_LINE will generate a step event each time the source line changes. + * A depth value of StepRequest.STEP_INTO will generate step events in any called methods. + * A depth value of StepRequest.STEP_OVER restricts step events to the current frame or caller frames. + * A depth value of StepRequest.STEP_OUT restricts step events to caller frames only. + * All depth restrictions are relative to the call stack immediately before the step takes place. + * Only one pending step request is allowed per thread. + * Parameters: thread - the thread in which to step + * depth - the step depth + * size - the step size + * Returns: the created StepRequest + * Throws: DuplicateRequestException - + * if there is already a pending step request for the specified thread. + * The test checks up on the following assertions: + * - Creates a new disabled StepRequest. + * - STEP_MIN, STEP_LINE, STEP_INTO, STEP_OVER, STEP_OUT are valid arguments, + * that is, they don't throw IllegalArgumentException. + * - Values larger and lesser corresponding above are invalid arguments, that is, + * they do throw IllegalArgumentException. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createStepRequest.crstepreq002; + * the debuggee program - nsk.jdi.EventRequestManager.createStepRequest.crstepreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createStepRequest.crstepreq002 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002a.java new file mode 100644 index 00000000000..150e41fbd36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002a.java @@ -0,0 +1,172 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the crstepreq002 JDI test. + */ + +public class crstepreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1crstepreq002a thread1 = null; + + static TestClass10 obj = new TestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1crstepreq002a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + static void m10() { + crstepreq002a.log1("entered: m10"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + crstepreq002a.log1("entered: m11"); + TestClass10.m10(); + } +} + +class Thread1crstepreq002a extends Thread { + + String tName = null; + + public Thread1crstepreq002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + crstepreq002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(crstepreq002a.waitnotifyObj) { + crstepreq002a.waitnotifyObj.notify(); + } + synchronized(crstepreq002a.lockObj) { + TestClass11.m11(); + } + crstepreq002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java new file mode 100644 index 00000000000..72ad344cad6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java @@ -0,0 +1,474 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq003 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq003"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int lineForBreakInThread = 137; + static final int[] checkedLines = { 138, 138, 178 }; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq003().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStdout(log, "debuggee stdout> "); + debuggee.redirectStderr(log, "debuggee stderr> "); + debuggee.createIOPipe(); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + ThreadReference mainThread = threadByName("main"); +/* + BreakpointRequest bpRequest = setBreakpoint( mainThread, + debuggeeClass, + "methodForCommunication", + 2, + "breakpointForCommunication"); +*/ + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "breakInThread", + lineForBreakInThread, + "breakInThread"); + bpRequest.enable(); + + display("TESTING BEGINS"); + + label0: + for (int testCase = 0; instruction != quit; testCase++) { + +// waitForEvent(bpRequest); + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: case: # " + testCase); + + switch (testCase) { + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test case section + case 0: + display("Step request will be created with size == StepRequest.STEP_LINE, depth == StepRequest.STEP_INTO"); + setAndCheckStepEvent ( bpRequest, + "StepRequest0", + "thread0", + checkedLines[testCase], + StepRequest.STEP_INTO); + break; + + case 1: + display("Step request will be created with size == StepRequest.STEP_LINE, depth == StepRequest.STEP_OVER"); + setAndCheckStepEvent ( bpRequest, + "StepRequest1", + "thread1", + checkedLines[testCase], + StepRequest.STEP_OVER); + break; + case 2: + display("Step request will be created with size == StepRequest.STEP_LINE, depth == StepRequest.STEP_OUT"); + setAndCheckStepEvent ( bpRequest, + "StepRequest2", + "thread2", + checkedLines[testCase], + StepRequest.STEP_OUT); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of section + default: + instruction = quit; + setInstruction("quit"); + } + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methodss + + private StepRequest setStepRequest ( ThreadReference thread, int size, int depth, String property ) { + display("Setting a step request in thread: " + thread); + StepRequest stepRequest = null; + + try { + stepRequest = eventRManager.createStepRequest(thread, size, depth); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + throw new Failure("setStep(): A StepRequest has not been set up."); + } + + display("setStepRequest(): A StepRequest has been set up."); + return stepRequest; + } + + private void setAndCheckStepEvent ( BreakpointRequest bpRequest, + String caseProperty, + String threadName, + int lineOfStepEvent, + int stepDepth ) { + display("Wait for brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreakInThread) { + complain("Wrong line number of BreakpointEvent for " + threadName); + complain("\texpected value : " + lineForBreakInThread + "; got one : " + lineOfEvent); + exitCode = FAILED; + } + + ThreadReference thread = threadByName(threadName); + StepRequest stepRequest = setStepRequest( thread, + StepRequest.STEP_LINE, + stepDepth, + caseProperty); + stepRequest.enable(); + + display("waiting for StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + if (newEvent instanceof StepEvent) { + String property = (String) newEvent.request().getProperty("number"); + display("got new StepEvent with property 'number' == " + property); + + if ( !property.equals(caseProperty) ) { + complain("property is not : " + caseProperty); + exitCode = FAILED; + } + // check location of step event + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != lineOfStepEvent) { + switch (stepDepth) { + case StepRequest.STEP_INTO: + complain("Wrong line number of StepEvent for request with depth == StepRequest.STEP_INTO:" ); + break; + case StepRequest.STEP_OVER: + complain("Wrong line number of StepEvent for request with depth == StepRequest.STEP_OVER:" ); + break; + case StepRequest.STEP_OUT: + complain("Wrong line number of StepEvent for request with depth == StepRequest.STEP_OUT:" ); + break; + } + complain("\texpected value : " + lineOfStepEvent + "; got one : " + lineOfEvent); + exitCode = FAILED; + } + + } else if (newEvent instanceof BreakpointEvent) { + vm.resume(); + exitCode = FAILED; + complain("got unexpected BreakpointEvent, but StepEvent is not received"); + } else if (newEvent instanceof VMDeathEvent) { + exitCode = FAILED; + throw new Failure("got unexpected VMDeathtEvent, but StepEvent is not received"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003/TestDescription.java new file mode 100644 index 00000000000..1529e5b8cef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/EventRequestManager/createStepRequest/crstepreq003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A size value of StepRequest.STEP_LINE will generate a step event each time + * the source line changes. A depth value of StepRequest.STEP_INTO will generate + * step events in any called methods. A depth value of StepRequest.STEP_OVER + * restricts step events to the current frame or caller frames. A depth value + * of StepRequest.STEP_OUT restricts step events to caller frames only. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq003; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq003a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's breakInThread() method at the beginning of synchronized block; + * - the debuggee starts additional thread with 'thread1' name and it gets + * suspended at breakpoint; + * - After getting BreakpointEvent, the debugger sets StepRequest for thread1 and + * resumes debuggee; + * - after getting StepEvent, the debugger checks its location by comparing with + * expected line number value. + * There are three cases in the test: + * - step request is created with STEP_LINE size and STEP_INTO depth, + * - step request is created with STEP_LINE size and STEP_OVER depth, + * - step request is created with STEP_LINE size and STEP_OUT depth. + * 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: + * This test is developed basing on analysis of 4628003 bug. The test is aimed + * to check to the case when debuggee's thread in step request does not wait + * for lock in syncronized block. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq003 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java new file mode 100644 index 00000000000..e00752db4fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java @@ -0,0 +1,180 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq003a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + private static IOPipe pipe; + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static Object waitnotifyObj = new Object(); + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + display("debuggee started!"); + + label0: + for (int testCase = 0; instruction != quit; testCase++) { + + switch (testCase) { + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test case section + case 0: + + Thread thread0 = new Thread0crstepreq003a("thread0"); + threadStart(thread0); + threadJoin (thread0, "0"); + break; + + case 1: + + Thread thread1 = new Thread0crstepreq003a("thread1"); + threadStart(thread1); + threadJoin (thread1, "1"); + break; + + case 2: + + Thread thread2 = new Thread0crstepreq003a("thread2"); + threadStart(thread2); + threadJoin (thread2, "2"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of section + + default: + instruction = quit; + break; + } + +// display("call methodForCommunication() #0"); +// methodForCommunication(); + if (instruction == quit) + break; + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, String number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + + static void breakInThread() { + Object dummy = new Object(); + synchronized(dummy) { // crstepreq003.lineForBreakInThread + int i = 1; // This is line of step event's location for STEP_OVER and STEP_INTO -- crstepreq003.checkedLines[0-1] + } + } + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + private static void methodForCommunication() { + int i = instruction; + int curInstruction = i; + } +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq003a extends Thread { + public Thread0crstepreq003a (String name) { + super(name); + } + + public void run() { + crstepreq003a.display("enter thread " + getName()); + + synchronized(crstepreq003a.waitnotifyObj) { + crstepreq003a.waitnotifyObj.notifyAll(); + } + + crstepreq003a.display("call breakInThread()"); + crstepreq003a.breakInThread(); + + crstepreq003a.display("exit thread " + getName()); // This is line of step event's location for STEP_OUT -- crstepreq003.checkedLines[2] + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java new file mode 100644 index 00000000000..f2dba0bdd1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java @@ -0,0 +1,471 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq004 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq004"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int lineForBreakInThread = 146; + static final int[] checkedLines = { 160, 160, 193 }; + static final int[] checkedLinesAlt = { 161, 161, 193 }; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq004().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStdout(log, "debuggee stdout> "); + debuggee.redirectStderr(log, "debuggee stderr> "); + debuggee.createIOPipe(); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = setBreakpoint( mainThread, + debuggeeClass, + "methodForCommunication", + lineForBreakInThread, + "breakpointForCommunication"); + bpRequest.enable(); + + display("TESTING BEGINS"); + + label0: + for (int testCase = 0; instruction != quit; testCase++) { + +// waitForEvent(bpRequest); + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: case: # " + testCase); + + switch (testCase) { + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test case section + case 0: + display("Step request will be created with size == StepRequest.STEP_LINE, depth == StepRequest.STEP_INTO"); + setAndCheckStepEvent ( bpRequest, + "StepRequest0", + "thread2", + testCase, + StepRequest.STEP_INTO); + break; + + case 1: + display("Step request will be created with size == StepRequest.STEP_LINE, depth == StepRequest.STEP_OVER"); + setAndCheckStepEvent ( bpRequest, + "StepRequest1", + "thread2", + testCase, + StepRequest.STEP_OVER); + break; + case 2: + display("Step request will be created with size == StepRequest.STEP_LINE, depth == StepRequest.STEP_OUT"); + setAndCheckStepEvent ( bpRequest, + "StepRequest2", + "thread2", + testCase, + StepRequest.STEP_OUT); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of section + default: + instruction = quit; + setInstruction("quit"); + } + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methodss + + private StepRequest setStepRequest ( ThreadReference thread, int size, int depth, String property ) { + display("Setting a step request in thread: " + thread); + StepRequest stepRequest = null; + + try { + stepRequest = eventRManager.createStepRequest(thread, size, depth); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + throw new Failure("setStep(): A StepRequest has not been set up."); + } + + display("setStepRequest(): A StepRequest has been set up."); + return stepRequest; + } + + private void setAndCheckStepEvent ( BreakpointRequest bpRequest, + String caseProperty, + String threadName, + int testCaseIndex, + int stepDepth) { + display("Wait for brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreakInThread) { + complain("Wrong line number of BreakpointEvent for " + threadName); + complain("\texpected value : " + lineForBreakInThread + "; got one : " + lineOfEvent); + exitCode = FAILED; + } + + ThreadReference thread = threadByName(threadName); + StepRequest stepRequest = setStepRequest( thread, + StepRequest.STEP_LINE, + stepDepth, + caseProperty); + stepRequest.enable(); + + display("waiting for StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + if (newEvent instanceof StepEvent) { + String property = (String) newEvent.request().getProperty("number"); + display("got new StepEvent with property 'number' == " + property); + + if ( !property.equals(caseProperty) ) { + complain("property is not : " + caseProperty); + exitCode = FAILED; + } + // check location of step event + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + boolean isCorrectLine = lineOfEvent == checkedLines[testCaseIndex] || lineOfEvent == checkedLinesAlt[testCaseIndex]; + if (!isCorrectLine) { + switch (stepDepth) { + case StepRequest.STEP_INTO: + complain("Wrong line number of StepEvent for request with depth == StepRequest.STEP_INTO:" ); + break; + case StepRequest.STEP_OVER: + complain("Wrong line number of StepEvent for request with depth == StepRequest.STEP_OVER:" ); + break; + case StepRequest.STEP_OUT: + complain("Wrong line number of StepEvent for request with depth == StepRequest.STEP_OUT:" ); + break; + } + String msg = "\texpected line %d or %d; got %d"; + complain(String.format(msg, checkedLines[testCaseIndex], checkedLinesAlt[testCaseIndex], lineOfEvent)); + exitCode = FAILED; + } + + } else if (newEvent instanceof BreakpointEvent) { + vm.resume(); + exitCode = FAILED; + complain("got unexpected BreakpointEvent, but StepEvent is not received"); + } else if (newEvent instanceof VMDeathEvent) { + exitCode = FAILED; + throw new Failure("got unexpected VMDeathtEvent, but StepEvent is not received"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004/TestDescription.java new file mode 100644 index 00000000000..c09187b7687 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/EventRequestManager/createStepRequest/crstepreq004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A size value of StepRequest.STEP_LINE will generate a step event each time + * the source line changes. A depth value of StepRequest.STEP_INTO will generate + * step events in any called methods. A depth value of StepRequest.STEP_OVER + * restricts step events to the current frame or caller frames. A depth value + * of StepRequest.STEP_OUT restricts step events to caller frames only. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq004; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq004a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method; + * - the debuggee starts two threads, thread1 and thread2. Each of them must hold + * the lock of lockObj1 object inside its run() method.Thread1 is first one who + * captures the lock, thread2 waits at beginning of synchronized block. + * The debuggee's main thread invokes methodForCommunication() method at this moment; + * - After getting BreakpointEvent, the debugger sets StepRequest for thread2 and + * resumes debuggee; + * - after getting StepEvent, the debugger checks its location by comparing with + * expected line number value. + * There are three cases in the test: + * - step request is created with STEP_LINE size and STEP_INTO depth, + * - step request is created with STEP_LINE size and STEP_OVER depth, + * - step request is created with STEP_LINE size and STEP_OUT depth. + * 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: + * This test is developed basing on analysis of 4628003 bug. The test is aimed + * to check to the case when debuggee's thread in step request is waiting for + * lock release in syncronized block which is held by another thread. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq004 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java new file mode 100644 index 00000000000..2f760c4dad2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java @@ -0,0 +1,195 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq004a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + private static IOPipe pipe; + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static Object lockObj = new Object(); + static Object lockObj1 = new Object(); + private static volatile boolean isFirstThreadReady = false; + private static volatile boolean isSecondThreadReady = false; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + display("debuggee started!"); + + label0: + for (int testCase = 0; instruction != quit; testCase++) { + + switch (testCase) { + case 0: + case 1: + case 2: + runTestCase(testCase); + break; + default: + instruction = quit; + break; + } + + if (instruction == quit) + break; + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + private static void runTestCase(int testCaseId) { + isFirstThreadReady = false; + isSecondThreadReady = false; + Thread thread1 = new Thread1crstepreq004a("thread1"); + Thread thread2 = new Thread2crstepreq004a("thread2"); + synchronized (lockObj) { + thread1.start(); + while (!isFirstThreadReady) { + shortSleep(); + } + thread2.start(); + while (!isSecondThreadReady) { + shortSleep(); + } + + display("call methodForCommunication() #" + testCaseId); + methodForCommunication(); + } + threadJoin(thread1, "1"); + threadJoin(thread2, "2"); + } + + static void threadJoin (Thread t, String number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + //---------------------------------------------------------- immutable common methods + + static void shortSleep() { + try { + Thread.currentThread().sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + private static void methodForCommunication() { + int i = instruction; + int curInstruction = i; // crstepreq004.lineForBreakInThread + } + + static void lockAndNotify1() { + synchronized(lockObj1) { + isFirstThreadReady = true; + synchronized(lockObj) { + } + } + } + + static void lockAndNotify2() { + isSecondThreadReady = true; + synchronized(lockObj1) { // thread is waiting here the lock when step request is created. + int i = 1; // This is line of step event for STEP_INTO and STEP_OVER -- crstepreq004.checkedLines[0-1] + } // crstepreq004.checkedLinesAlt[0-1] + } +} + +//--------------------------------------------------------- test specific classes + +/** + * First thread which owns and locks the crstepreq004a.lockObj1 monitor . + */ +class Thread1crstepreq004a extends Thread { + public Thread1crstepreq004a (String name) { + super(name); + } + + public void run() { + crstepreq004a.display("enter thread " + getName()); + crstepreq004a.lockAndNotify1(); + crstepreq004a.display("exit thread " + getName()); + } +} + +/** + * Second thread which who owns the crstepreq004a.lockObj1 monitor . + */ +class Thread2crstepreq004a extends Thread { + public Thread2crstepreq004a (String name) { + super(name); + } + + public void run() { + crstepreq004a.display("enter thread " + getName()); + crstepreq004a.lockAndNotify2(); + crstepreq004a.display("exit thread " + getName()); // This is line of step event for STEP_OUT -- crstepreq004.checkedLines[2] checkedLinesAlt[2]. + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005.java new file mode 100644 index 00000000000..c8dc5397924 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005.java @@ -0,0 +1,494 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq005 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq005"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 62; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int maxCase = 4; + static final String[] brakeMethods = { + "caseRun", + "m00", + "m02", + "m02" + }; + static final int[][] checkedLines = { + { 152, 153, 154}, + { 174, 178, 157}, + { 182, 183, 168}, + { 183, 168, 169} + }; + + static final String debuggeeThreadName = prefix + ".Thread0crstepreq005a"; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq005().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + StepRequest stepRequest = null; + + display("TESTING BEGINS"); + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: CASE # " + testCase); + stepRequest = setStepRequest( bpRequest, + "thread" + testCase, + testCase, + "stepRequest" + testCase ); + + checkStepEvent( stepRequest, + "thread" + testCase, + testCase ); + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + private StepRequest setStepRequest ( BreakpointRequest bpRequest, + String threadName, + int testCase, + String property ) { + StepRequest stepRequest = null; + for (;;) { + display("Wait for initial brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreak) { + complain("Wrong line number of initial brakepoint event for " + threadName); + complain("\texpected value : " + lineForBreak + "; got one : " + lineOfEvent); + break; + } + + display("Getting mirror of thread: " + threadName); + ThreadReference thread = threadByName(threadName); + + display("Getting ReferenceType of thread: " + threadName); + ReferenceType debuggeeThread = debuggee.classByName(debuggeeThreadName); + + // set second breakpoint to suspend checked thread at the right location before + // setting step request + BreakpointRequest bpRequest1 = setBreakpoint( thread, + debuggeeThread, + brakeMethods[testCase], + checkedLines[testCase][0], + ""); + bpRequest1.addCountFilter(1); + bpRequest1.enable(); + + display("Wait for additional brakepoint event in " + threadName); + bpEvent = (BreakpointEvent)waitForEvent(bpRequest1); + + // check location of breakpoint event + lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][0]) { + complain("Wrong line number of additional brakepoint event for " + threadName); + complain("\texpected value : " + checkedLines[testCase][0] + "; got one : " + lineOfEvent); + break; + } + + display("Setting a step request in thread: " + thread); + try { + stepRequest = eventRManager.createStepRequest ( thread, + StepRequest.STEP_LINE, + StepRequest.STEP_OVER ); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + break; + } + break; + } + if (stepRequest == null) { + throw new Failure("setStepRequest(): StepRequest has not been set up."); + } + display("setStepRequest(): StepRequest has been set up."); + return stepRequest; + } + + private void checkStepEvent ( StepRequest stepRequest, + String threadName, + int testCase ) { + stepRequest.enable(); + + display("waiting for first StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + display("got first StepEvent"); + + display("CHECK1 for line location of first StepEvent."); + int lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][1]) { + complain("CHECK1 for line location of first StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][1] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK1 PASSED"); + } + + display("waiting for second StepEvent in " + threadName); + newEvent = waitForEvent(stepRequest); + display("got second StepEvent"); + + display("CHECK2 for line location of second StepEvent."); + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][2]) { + complain("CHECK2 for line location of second StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][2] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK2 PASSED"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005/TestDescription.java new file mode 100644 index 00000000000..ae522252d81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005/TestDescription.java @@ -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/EventRequestManager/createStepRequest/crstepreq005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A size value of StepRequest.STEP_LINE will generate a step event each time + * the source line changes... + * A depth value of StepRequest.STEP_OVER restricts step events to the current + * frame or caller frames. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq005; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq005a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This method is invoked in + * additional 'thread1' started in debuggee. First breakpoint allows the debugger + * to obtain ThreadReference mirror of debuggee's 'thread1'; + * - after getting first BreakpointEvent, the debugger sets second BreakpointRequest + * to suspend 'thread1 at the right location before setting step request; + * - after getting second BreakpointEvent, the debugger sets StepRequest + * with STEP_LINE size and STEP_OVER depth, resumes the debuggee and + * waits for two consecutive StepEvents; + * - upon getting StepEvents, the debugger checks their locations by comparing with + * expected line number values. + * 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: + * 4767945 TEST_BUG: crstepreq005 test fails in Mantis + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq005 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005a.java new file mode 100644 index 00000000000..10edb3d96a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq005a.java @@ -0,0 +1,193 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq005a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = instruction; // crstepreq005.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static final int maxCase = 4; + static Object waitnotifyObj = new Object(); + static Thread thread1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + thread1 = new Thread0crstepreq005a(testCase); + threadStart(thread1); + threadJoin (thread1, testCase); + + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, int number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq005a extends Thread { + int testCase; + + public Thread0crstepreq005a (int testCase) { + super("thread" + testCase); + this.testCase = testCase; + } + + public void run() { + crstepreq005a.display("enter thread " + getName()); + synchronized(crstepreq005a.waitnotifyObj) { + crstepreq005a.waitnotifyObj.notifyAll(); + } + + crstepreq005a.methodForCommunication(); + caseRun(); + crstepreq005a.display("exit thread " + getName()); + } + + void caseRun() { + int i; + try { + switch (testCase) { + case 0: + i = m00(1); // crstepreq005.checkedLines[0][1] + i = m00(2); i = m00(3); // crstepreq005.checkedLines[0][2] + break; // crstepreq005.checkedLines[0][3] + + case 1: + i = m01(1); i = m01(2); // crstepreq005.checkedLines[1][2] + break; + + case 2: + i = m02(-1); + break; + + case 3: + i = m03(-1); + break; + } + } catch (DummyException e) { // crstepreq005.checkedLines[2][2] // crstepreq005.checkedLines[3][1] + crstepreq005a.display("DummyException was caught for testCase # " + testCase); // crstepreq005.checkedLines[3][2] + } + } + + int m00 (int arg) { + return arg++; // crstepreq005.checkedLines[1][0] + } + + int m01 (int arg) { + return m00(arg); // crstepreq005.checkedLines[1][1] + } + + int m02 (int arg) throws DummyException { + if (arg < 0) { // crstepreq005.checkedLines[2][0] + throw new DummyException(); // crstepreq005.checkedLines[2][1] // crstepreq005.checkedLines[3][0] + } + return arg++; + } + + int m03 (int arg) throws DummyException { + return m02(arg); + } + + class DummyException extends Exception {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006.java new file mode 100644 index 00000000000..2fdd39ab107 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006.java @@ -0,0 +1,492 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq006 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq006"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 62; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int maxCase = 3; + static final String[] brakeMethods = { + "m00", + "m00", + "m00" + }; + static final int[][] checkedLines = { + { 167, 171, 151}, + { 167, 175, 156}, + { 167, 178, 187} + }; + + static final String debuggeeThreadName = prefix + ".Thread0crstepreq006a"; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq006().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + StepRequest stepRequest = null; + + display("TESTING BEGINS"); + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: CASE # " + testCase); + stepRequest = setStepRequest( bpRequest, + "thread" + testCase, + testCase, + "stepRequest" + testCase ); + + checkStepEvent( stepRequest, + "thread" + testCase, + testCase ); + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + private StepRequest setStepRequest ( BreakpointRequest bpRequest, + String threadName, + int testCase, + String property ) { + StepRequest stepRequest = null; + for (;;) { + display("Wait for initial brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreak) { + complain("Wrong line number of initial brakepoint event for " + threadName); + complain("\texpected value : " + lineForBreak + "; got one : " + lineOfEvent); + break; + } + + display("Getting mirror of thread: " + threadName); + ThreadReference thread = threadByName(threadName); + + display("Getting ReferenceType of thread: " + threadName); + ReferenceType debuggeeThread = debuggee.classByName(debuggeeThreadName); + + // set second breakpoint to suspend checked thread at the right location before + // setting step request + BreakpointRequest bpRequest1 = setBreakpoint( thread, + debuggeeThread, + brakeMethods[testCase], + checkedLines[testCase][0], + ""); + bpRequest1.addCountFilter(1); + bpRequest1.enable(); + + display("Wait for additional brakepoint event in " + threadName); + bpEvent = (BreakpointEvent)waitForEvent(bpRequest1); + + // check location of breakpoint event + lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][0]) { + complain("Wrong line number of additional brakepoint event for " + threadName); + complain("\texpected value : " + checkedLines[testCase][0] + "; got one : " + lineOfEvent); + break; + } + + display("Setting a step request in thread: " + thread); + try { + stepRequest = eventRManager.createStepRequest ( thread, + StepRequest.STEP_LINE, + StepRequest.STEP_OUT ); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + break; + } + break; + } + if (stepRequest == null) { + throw new Failure("setStepRequest(): StepRequest has not been set up."); + } + display("setStepRequest(): StepRequest has been set up."); + return stepRequest; + } + + private void checkStepEvent ( StepRequest stepRequest, + String threadName, + int testCase ) { + stepRequest.enable(); + + display("waiting for first StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + display("got first StepEvent"); + + display("CHECK1 for line location of first StepEvent."); + int lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][1]) { + complain("CHECK1 for line location of first StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][1] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK1 PASSED"); + } + + display("waiting for second StepEvent in " + threadName); + newEvent = waitForEvent(stepRequest); + display("got second StepEvent"); + + display("CHECK2 for line location of second StepEvent."); + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][2]) { + complain("CHECK2 for line location of second StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][2] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK2 PASSED"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006/TestDescription.java new file mode 100644 index 00000000000..a238e9cdf63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006/TestDescription.java @@ -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/EventRequestManager/createStepRequest/crstepreq006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A size value of StepRequest.STEP_LINE will generate a step event each time + * the source line changes... + * A depth value of StepRequest.STEP_OUT restricts step events to caller frames + * only. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq006; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq006a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This method is invoked in + * additional 'thread1' started in debuggee. First breakpoint allows the debugger + * to obtain ThreadReference mirror of debuggee's 'thread1'; + * - after getting first BreakpointEvent, the debugger sets second BreakpointRequest + * to suspend 'thread1 at the right location before setting step request; + * - after getting second BreakpointEvent, the debugger sets StepRequest + * with STEP_LINE size and STEP_OUT depth, resumes the debuggee and + * waits for two consecutive StepEvents; + * - upon getting StepEvents, the debugger checks their locations by comparing with + * expected line number values. + * 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: + * 4767945 TEST_BUG: crstepreq005 test fails in Mantis + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq006 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006a.java new file mode 100644 index 00000000000..26f0681064f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq006a.java @@ -0,0 +1,193 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq006a { + + //------------------------------------------------------ immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //----------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = instruction; // crstepreq006.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static final int maxCase = 3; + static Object waitnotifyObj = new Object(); + static Thread thread1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + thread1 = new Thread0crstepreq006a(testCase); + threadStart(thread1); + threadJoin (thread1, testCase); + + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, int number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq006a extends Thread { + int testCase; + + public Thread0crstepreq006a (int testCase) { + super("thread" + testCase); + this.testCase = testCase; + } + + public void run() { + crstepreq006a.display("enter thread " + getName()); + synchronized(crstepreq006a.waitnotifyObj) { + crstepreq006a.waitnotifyObj.notifyAll(); + } + + crstepreq006a.methodForCommunication(); + caseRun(); + crstepreq006a.display("exit thread " + getName()); + } + + void caseRun() { + int i; + switch (testCase) { + case 0: + i = m01(1); // crstepreq006.checkedLines[0][2] + i = m01(2); + break; + + case 1: + i = m02(1); // crstepreq006.checkedLines[1][2] + break; + + case 2: + i = m04(-2); + break; + + } + } + + int m00 (int arg) { + return arg++; // crstepreq006.checkedLines[0-2][0] + } + + int m01 (int arg) { + return m00(arg); // crstepreq006.checkedLines[0][1] + } + + int m02 (int arg) { + int j = m00(arg); return m00(arg); } // crstepreq006.checkedLines[1][1] + + int m03 (int arg) throws DummyException { + arg = m00(arg); if (arg < 0) { throw new DummyException(); }; // crstepreq006.checkedLines[2][1] + return arg++; + } + + int m04 (int arg) { + int j = 0; + try { + j = m03(arg) + 1; + } catch (DummyException e) { + crstepreq006a.display("DummyException was caught for testCase # " + testCase); // // crstepreq006.checkedLines[2][2] + } + return j; + } + + class DummyException extends Exception {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007.java new file mode 100644 index 00000000000..7927dccddef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007.java @@ -0,0 +1,494 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq007 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq007"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 62; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int maxCase = 4; + static final String[] brakeMethods = { + "caseRun", + "m00", + "caseRun", + "caseRun" + }; + static final int[][] checkedLines = { + { 152, 174, 152}, + { 174, 157, 178}, + { 161, 178, 174}, + { 165, 182, 185} + }; + + static final String debuggeeThreadName = prefix + ".Thread0crstepreq007a"; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq007().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + StepRequest stepRequest = null; + + display("TESTING BEGINS"); + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: CASE # " + testCase); + stepRequest = setStepRequest( bpRequest, + "thread" + testCase, + testCase, + "stepRequest" + testCase ); + + checkStepEvent( stepRequest, + "thread" + testCase, + testCase ); + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + private StepRequest setStepRequest ( BreakpointRequest bpRequest, + String threadName, + int testCase, + String property ) { + StepRequest stepRequest = null; + for (;;) { + display("Wait for initial brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreak) { + complain("Wrong line number of initial brakepoint event for " + threadName); + complain("\texpected value : " + lineForBreak + "; got one : " + lineOfEvent); + break; + } + + display("Getting mirror of thread: " + threadName); + ThreadReference thread = threadByName(threadName); + + display("Getting ReferenceType of thread: " + threadName); + ReferenceType debuggeeThread = debuggee.classByName(debuggeeThreadName); + + // set second breakpoint to suspend checked thread at the right location before + // setting step request + BreakpointRequest bpRequest1 = setBreakpoint( thread, + debuggeeThread, + brakeMethods[testCase], + checkedLines[testCase][0], + ""); + bpRequest1.addCountFilter(1); + bpRequest1.enable(); + + display("Wait for additional brakepoint event in " + threadName); + bpEvent = (BreakpointEvent)waitForEvent(bpRequest1); + + // check location of breakpoint event + lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][0]) { + complain("Wrong line number of additional brakepoint event for " + threadName); + complain("\texpected value : " + checkedLines[testCase][0] + "; got one : " + lineOfEvent); + break; + } + + display("Setting a step request in thread: " + thread); + try { + stepRequest = eventRManager.createStepRequest ( thread, + StepRequest.STEP_LINE, + StepRequest.STEP_INTO ); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + break; + } + break; + } + if (stepRequest == null) { + throw new Failure("setStepRequest(): StepRequest has not been set up."); + } + display("setStepRequest(): StepRequest has been set up."); + return stepRequest; + } + + private void checkStepEvent ( StepRequest stepRequest, + String threadName, + int testCase ) { + stepRequest.enable(); + + display("waiting for first StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + display("got first StepEvent"); + + display("CHECK1 for line location of first StepEvent."); + int lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][1]) { + complain("CHECK1 for line location of first StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][1] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK1 PASSED"); + } + + display("waiting for second StepEvent in " + threadName); + newEvent = waitForEvent(stepRequest); + display("got second StepEvent"); + + display("CHECK2 for line location of second StepEvent."); + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][2]) { + complain("CHECK2 for line location of second StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][2] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK2 PASSED"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007/TestDescription.java new file mode 100644 index 00000000000..8455ca2c852 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/EventRequestManager/createStepRequest/crstepreq007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A size value of StepRequest.STEP_LINE will generate a step event each time + * the source line changes. A depth value of StepRequest.STEP_INTO will generate + * step events in any called methods. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq007; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq007a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This method is invoked in + * additional 'thread1' started in debuggee. First breakpoint allows the debugger + * to obtain ThreadReference mirror of debuggee's 'thread1'; + * - after getting first BreakpointEvent, the debugger sets second BreakpointRequest + * to suspend 'thread1 at the right location before setting step request; + * - after getting second BreakpointEvent, the debugger sets StepRequest + * with STEP_LINE size and STEP_INTO depth, resumes the debuggee and + * waits for two consecutive StepEvents; + * - upon getting StepEvents, the debugger checks their locations by comparing with + * expected line number values. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq007 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007a.java new file mode 100644 index 00000000000..5000cf0c7e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq007a.java @@ -0,0 +1,193 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq007a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = instruction; // crstepreq007.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static final int maxCase = 4; + static Object waitnotifyObj = new Object(); + static Thread thread1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + thread1 = new Thread0crstepreq007a(testCase); + threadStart(thread1); + threadJoin (thread1, testCase); + + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, int number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq007a extends Thread { + int testCase; + + public Thread0crstepreq007a (int testCase) { + super("thread" + testCase); + this.testCase = testCase; + } + + public void run() { + crstepreq007a.display("enter thread " + getName()); + synchronized(crstepreq007a.waitnotifyObj) { + crstepreq007a.waitnotifyObj.notifyAll(); + } + + crstepreq007a.methodForCommunication(); + caseRun(); + crstepreq007a.display("exit thread " + getName()); + } + + void caseRun() { + int i; + try { + switch (testCase) { + case 0: + i = m00(1); // crstepreq007.checkedLines[0][0,2] + i = m00(2); + break; + + case 1: + i = m00(1); i = m01(2); // crstepreq007.checkedLines[1][1] + break; + + case 2: + i = m01(1); // crstepreq007.checkedLines[2][0] + break; + + case 3: + i = m02(1); // crstepreq007.checkedLines[3][0] + break; + } + } catch (DummyException e) { + crstepreq007a.display("DummyException was caught for testCase # " + testCase); + } + } + + int m00 (int arg) { + return arg++; // crstepreq007.checkedLines[0][1] // crstepreq007.checkedLines[1][0] // crstepreq007.checkedLines[2][2] + } + + int m01 (int arg) { + return m00(arg); // crstepreq007.checkedLines[1][2] // crstepreq007.checkedLines[2][1] + } + + int m02 (int arg) throws DummyException { + if (arg < 0) { // crstepreq007.checkedLines[2][1] + throw new DummyException(); + } + return arg++; // crstepreq007.checkedLines[2][2] + } + + int m03 (int arg) throws DummyException { + return m02(arg); + } + + class DummyException extends Exception {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008.java new file mode 100644 index 00000000000..317027a846d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008.java @@ -0,0 +1,494 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq008 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq008"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 62; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int maxCase = 4; + static final String[] brakeMethods = { + "caseRun", + "m00", + "m02", + "m02" + }; + static final int[][] checkedLines = { + { 152, 152, 152}, + { 174, 174, 174}, + { 182, 182, 183}, + { 183, 183, 183} + }; + + static final String debuggeeThreadName = prefix + ".Thread0crstepreq008a"; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq008().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + StepRequest stepRequest = null; + + display("TESTING BEGINS"); + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: CASE # " + testCase); + stepRequest = setStepRequest( bpRequest, + "thread" + testCase, + testCase, + "stepRequest" + testCase ); + + checkStepEvent( stepRequest, + "thread" + testCase, + testCase ); + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + private StepRequest setStepRequest ( BreakpointRequest bpRequest, + String threadName, + int testCase, + String property ) { + StepRequest stepRequest = null; + for (;;) { + display("Wait for initial brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreak) { + complain("Wrong line number of initial brakepoint event for " + threadName); + complain("\texpected value : " + lineForBreak + "; got one : " + lineOfEvent); + break; + } + + display("Getting mirror of thread: " + threadName); + ThreadReference thread = threadByName(threadName); + + display("Getting ReferenceType of thread: " + threadName); + ReferenceType debuggeeThread = debuggee.classByName(debuggeeThreadName); + + // set second breakpoint to suspend checked thread at the right location before + // setting step request + BreakpointRequest bpRequest1 = setBreakpoint( thread, + debuggeeThread, + brakeMethods[testCase], + checkedLines[testCase][0], + ""); + bpRequest1.addCountFilter(1); + bpRequest1.enable(); + + display("Wait for additional brakepoint event in " + threadName); + bpEvent = (BreakpointEvent)waitForEvent(bpRequest1); + + // check location of breakpoint event + lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][0]) { + complain("Wrong line number of additional brakepoint event for " + threadName); + complain("\texpected value : " + checkedLines[testCase][0] + "; got one : " + lineOfEvent); + break; + } + + display("Setting a step request in thread: " + thread); + try { + stepRequest = eventRManager.createStepRequest ( thread, + StepRequest.STEP_MIN, + StepRequest.STEP_OVER ); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + break; + } + break; + } + if (stepRequest == null) { + throw new Failure("setStepRequest(): StepRequest has not been set up."); + } + display("setStepRequest(): StepRequest has been set up."); + return stepRequest; + } + + private void checkStepEvent ( StepRequest stepRequest, + String threadName, + int testCase ) { + stepRequest.enable(); + + display("waiting for first StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + display("got first StepEvent"); + + display("CHECK1 for line location of first StepEvent."); + int lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][1]) { + complain("CHECK1 for line location of first StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][1] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK1 PASSED"); + } + + display("waiting for second StepEvent in " + threadName); + newEvent = waitForEvent(stepRequest); + display("got second StepEvent"); + + display("CHECK2 for line location of second StepEvent."); + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][2]) { + complain("CHECK2 for line location of second StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][2] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK2 PASSED"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008/TestDescription.java new file mode 100644 index 00000000000..f509a823b66 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008/TestDescription.java @@ -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/EventRequestManager/createStepRequest/crstepreq008. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A sizevalue of StepRequest.STEP_MIN will generate a step event each time + * the code index changes. It represents the smallest step size available and + * often maps to the instruction level.... + * A depth value of StepRequest.STEP_OVER restricts step events to the current + * frame or caller frames. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq008; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq008a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This method is invoked in + * additional 'thread1' started in debuggee. First breakpoint allows the debugger + * to obtain ThreadReference mirror of debuggee's 'thread1'; + * - after getting first BreakpointEvent, the debugger sets second BreakpointRequest + * to suspend 'thread1 at the right location before setting step request; + * - after getting second BreakpointEvent, the debugger sets StepRequest + * with STEP_MIN size and STEP_OVER depth, resumes the debuggee and + * waits for two consecutive StepEvents; + * - upon getting StepEvents, the debugger checks their locations by comparing with + * expected line number values. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq008 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008a.java new file mode 100644 index 00000000000..64f20c1fe26 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq008a.java @@ -0,0 +1,193 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq008a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = instruction; // crstepreq008.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static final int maxCase = 4; + static Object waitnotifyObj = new Object(); + static Thread thread1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + thread1 = new Thread0crstepreq008a(testCase); + threadStart(thread1); + threadJoin (thread1, testCase); + + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, int number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq008a extends Thread { + int testCase; + + public Thread0crstepreq008a (int testCase) { + super("thread" + testCase); + this.testCase = testCase; + } + + public void run() { + crstepreq008a.display("enter thread " + getName()); + synchronized(crstepreq008a.waitnotifyObj) { + crstepreq008a.waitnotifyObj.notifyAll(); + } + + crstepreq008a.methodForCommunication(); + caseRun(); + crstepreq008a.display("exit thread " + getName()); + } + + void caseRun() { + int i; + try { + switch (testCase) { + case 0: + i = m00(1); // crstepreq008.checkedLines[0][0-2] + i = m00(2); i = m00(3); + break; + + case 1: + i = m01(1); i = m01(2); + break; + + case 2: + i = m02(-1); + break; + + case 3: + i = m03(-1); + break; + } + } catch (DummyException e) { + crstepreq008a.display("DummyException was caught for testCase # " + testCase); + } + } + + int m00 (int arg) { + return arg++; // crstepreq008.checkedLines[1][0-2] + } + + int m01 (int arg) { + return m00(arg); + } + + int m02 (int arg) throws DummyException { + if (arg < 0) { // crstepreq008.checkedLines[2][0-1] + throw new DummyException(); // crstepreq008.checkedLines[2][2]// crstepreq008.checkedLines[3][0-2] + } + return arg++; + } + + int m03 (int arg) throws DummyException { + return m02(arg); + } + + class DummyException extends Exception {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009.java new file mode 100644 index 00000000000..fb89b818947 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009.java @@ -0,0 +1,492 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq009 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq009"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 62; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int maxCase = 3; + static final String[] brakeMethods = { + "m00", + "m00", + "m00" + }; + static final int[][] checkedLines = { + { 167, 171, 151}, + { 167, 175, 175}, + { 167, 178, 178} + }; + + static final String debuggeeThreadName = prefix + ".Thread0crstepreq009a"; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq009().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + StepRequest stepRequest = null; + + display("TESTING BEGINS"); + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: CASE # " + testCase); + stepRequest = setStepRequest( bpRequest, + "thread" + testCase, + testCase, + "stepRequest" + testCase ); + + checkStepEvent( stepRequest, + "thread" + testCase, + testCase ); + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + private StepRequest setStepRequest ( BreakpointRequest bpRequest, + String threadName, + int testCase, + String property ) { + StepRequest stepRequest = null; + for (;;) { + display("Wait for initial brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreak) { + complain("Wrong line number of initial brakepoint event for " + threadName); + complain("\texpected value : " + lineForBreak + "; got one : " + lineOfEvent); + break; + } + + display("Getting mirror of thread: " + threadName); + ThreadReference thread = threadByName(threadName); + + display("Getting ReferenceType of thread: " + threadName); + ReferenceType debuggeeThread = debuggee.classByName(debuggeeThreadName); + + // set second breakpoint to suspend checked thread at the right location before + // setting step request + BreakpointRequest bpRequest1 = setBreakpoint( thread, + debuggeeThread, + brakeMethods[testCase], + checkedLines[testCase][0], + ""); + bpRequest1.addCountFilter(1); + bpRequest1.enable(); + + display("Wait for additional brakepoint event in " + threadName); + bpEvent = (BreakpointEvent)waitForEvent(bpRequest1); + + // check location of breakpoint event + lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][0]) { + complain("Wrong line number of additional brakepoint event for " + threadName); + complain("\texpected value : " + checkedLines[testCase][0] + "; got one : " + lineOfEvent); + break; + } + + display("Setting a step request in thread: " + thread); + try { + stepRequest = eventRManager.createStepRequest ( thread, + StepRequest.STEP_MIN, + StepRequest.STEP_OUT ); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + break; + } + break; + } + if (stepRequest == null) { + throw new Failure("setStepRequest(): StepRequest has not been set up."); + } + display("setStepRequest(): StepRequest has been set up."); + return stepRequest; + } + + private void checkStepEvent ( StepRequest stepRequest, + String threadName, + int testCase ) { + stepRequest.enable(); + + display("waiting for first StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + display("got first StepEvent"); + + display("CHECK1 for line location of first StepEvent."); + int lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][1]) { + complain("CHECK1 for line location of first StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][1] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK1 PASSED"); + } + + display("waiting for second StepEvent in " + threadName); + newEvent = waitForEvent(stepRequest); + display("got second StepEvent"); + + display("CHECK2 for line location of second StepEvent."); + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][2]) { + complain("CHECK2 for line location of second StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][2] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK2 PASSED"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009/TestDescription.java new file mode 100644 index 00000000000..35049f97640 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009/TestDescription.java @@ -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/EventRequestManager/createStepRequest/crstepreq009. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A sizevalue of StepRequest.STEP_MIN will generate a step event each time the code + * index changes. It represents the smallest step size available and often maps to + * the instruction level.... + * A depth value of StepRequest.STEP_OUT restricts step events to caller frames + * only. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq009; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq009a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This method is invoked in + * additional 'thread1' started in debuggee. First breakpoint allows the debugger + * to obtain ThreadReference mirror of debuggee's 'thread1'; + * - after getting first BreakpointEvent, the debugger sets second BreakpointRequest + * to suspend 'thread1 at the right location before setting step request; + * - after getting second BreakpointEvent, the debugger sets StepRequest + * with STEP_MIN size and STEP_OUT depth, resumes the debuggee and + * waits for two consecutive StepEvents; + * - upon getting StepEvents, the debugger checks their locations by comparing with + * expected line number values. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq009 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009a.java new file mode 100644 index 00000000000..8df51baa8b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq009a.java @@ -0,0 +1,193 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq009a { + + //------------------------------------------------------ immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //----------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = instruction; // crstepreq009.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static final int maxCase = 3; + static Object waitnotifyObj = new Object(); + static Thread thread1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + thread1 = new Thread0crstepreq009a(testCase); + threadStart(thread1); + threadJoin (thread1, testCase); + + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, int number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq009a extends Thread { + int testCase; + + public Thread0crstepreq009a (int testCase) { + super("thread" + testCase); + this.testCase = testCase; + } + + public void run() { + crstepreq009a.display("enter thread " + getName()); + synchronized(crstepreq009a.waitnotifyObj) { + crstepreq009a.waitnotifyObj.notifyAll(); + } + + crstepreq009a.methodForCommunication(); + caseRun(); + crstepreq009a.display("exit thread " + getName()); + } + + void caseRun() { + int i; + switch (testCase) { + case 0: + i = m01(1); // crstepreq009.checkedLines[0][2] + i = m01(2); + break; + + case 1: + i = m02(1); + break; + + case 2: + i = m04(-2); + break; + + } + } + + int m00 (int arg) { + return arg++; // crstepreq009.checkedLines[0-2][0] + } + + int m01 (int arg) { + return m00(arg); // crstepreq009.checkedLines[0][1] + } + + int m02 (int arg) { + int j = m00(arg); return m00(arg); } // crstepreq009.checkedLines[1][1-2] + + int m03 (int arg) throws DummyException { + arg = m00(arg); if (arg < 0) { throw new DummyException(); }; // crstepreq009.checkedLines[2][1-2] + return arg++; + } + + int m04 (int arg) { + int j = 0; + try { + j = m03(arg) + 1; + } catch (DummyException e) { + crstepreq009a.display("DummyException was caught for testCase # " + testCase); + } + return j; + } + + class DummyException extends Exception {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010.java new file mode 100644 index 00000000000..c615b430a2c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010.java @@ -0,0 +1,496 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class crstepreq010 { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + private int instruction = 1; + private int waitTime; + private static int exitCode = PASSED; + + private ArgumentHandler argHandler; + private Log log; + private Debugee debuggee; + private VirtualMachine vm; + private ReferenceType debuggeeClass; + + private EventRequestManager eventRManager; + private EventSet eventSet; + private EventIterator eventIterator; + + //------------------------------------------------------ mutable common fields + + private final static String prefix = "nsk.jdi.EventRequestManager.createStepRequest"; + private final static String className = ".crstepreq010"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + static final int lineForBreak = 62; + + //------------------------------------------------------ immutable common methods + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + PASS_BASE); + } + + //------------------------------------------------------ test specific fields + + static final int maxCase = 5; + static final String[] brakeMethods = { + "caseRun", + "m01", + "m02", + "m03", + "caseRun" + }; + static final int[][] checkedLines = { + { 152, 152, 152}, + { 182, 182, 182}, + { 187, 187, 187}, + { 193, 193, 193}, + { 169, 169, 196} + }; + + static final String debuggeeThreadName = prefix + ".Thread0crstepreq010a"; + + //------------------------------------------------------ mutable common methods + + public static int run (String argv[], PrintStream out) { + + int exitStatus = new crstepreq010().runThis(argv, out); + System.out.println (exitStatus == PASSED ? "TEST PASSED" : "TEST FAILED"); + return exitCode; + } + + private int runThis(String argv[], PrintStream out) { + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + waitTime = argHandler.getWaitTime() * 60000; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, ""); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + debuggeeClass = waitForDebuggeeClassPrepared(); + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (PASSED + PASS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitCode = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } catch (VMDisconnectedException e) { + exitCode = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitCode = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(PASSED + PASS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitCode; + } + + //--------------------------------------------------------- mutable common methods + + private void execTest() { + BreakpointRequest bpRequest = setBreakpoint( null, + debuggeeClass, + "methodForCommunication", + lineForBreak, + "breakForCommunication"); + bpRequest.enable(); + + StepRequest stepRequest = null; + + display("TESTING BEGINS"); + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + instruction = getInstruction(); + if (instruction == quit) { + vm.resume(); + break; + } + + display(":: CASE # " + testCase); + stepRequest = setStepRequest( bpRequest, + "thread" + testCase, + testCase, + "stepRequest" + testCase ); + + checkStepEvent( stepRequest, + "thread" + testCase, + testCase ); + } + display("TESTING ENDS"); + } + + //--------------------------------------------------------- test specific methods + + private StepRequest setStepRequest ( BreakpointRequest bpRequest, + String threadName, + int testCase, + String property ) { + StepRequest stepRequest = null; + for (;;) { + display("Wait for initial brakepoint event in " + threadName); + BreakpointEvent bpEvent = (BreakpointEvent)waitForEvent(bpRequest); + + // check location of breakpoint event + int lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != lineForBreak) { + complain("Wrong line number of initial brakepoint event for " + threadName); + complain("\texpected value : " + lineForBreak + "; got one : " + lineOfEvent); + break; + } + + display("Getting mirror of thread: " + threadName); + ThreadReference thread = threadByName(threadName); + + display("Getting ReferenceType of thread: " + threadName); + ReferenceType debuggeeThread = debuggee.classByName(debuggeeThreadName); + + // set second breakpoint to suspend checked thread at the right location before + // setting step request + BreakpointRequest bpRequest1 = setBreakpoint( thread, + debuggeeThread, + brakeMethods[testCase], + checkedLines[testCase][0], + ""); + bpRequest1.addCountFilter(1); + bpRequest1.enable(); + + display("Wait for additional brakepoint event in " + threadName); + bpEvent = (BreakpointEvent)waitForEvent(bpRequest1); + + // check location of breakpoint event + lineOfEvent = ((LocatableEvent)bpEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][0]) { + complain("Wrong line number of additional brakepoint event for " + threadName); + complain("\texpected value : " + checkedLines[testCase][0] + "; got one : " + lineOfEvent); + break; + } + + display("Setting a step request in thread: " + thread); + try { + stepRequest = eventRManager.createStepRequest ( thread, + StepRequest.STEP_MIN, + StepRequest.STEP_INTO ); + stepRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setStepRequest(): unexpected Exception while creating StepRequest: " + e1); + break; + } + break; + } + if (stepRequest == null) { + throw new Failure("setStepRequest(): StepRequest has not been set up."); + } + display("setStepRequest(): StepRequest has been set up."); + return stepRequest; + } + + private void checkStepEvent ( StepRequest stepRequest, + String threadName, + int testCase ) { + stepRequest.enable(); + + display("waiting for first StepEvent in " + threadName); + Event newEvent = waitForEvent(stepRequest); + display("got first StepEvent"); + + display("CHECK1 for line location of first StepEvent."); + int lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][1]) { + complain("CHECK1 for line location of first StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][1] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK1 PASSED"); + } + + display("waiting for second StepEvent in " + threadName); + newEvent = waitForEvent(stepRequest); + display("got second StepEvent"); + + display("CHECK2 for line location of second StepEvent."); + lineOfEvent = ((LocatableEvent)newEvent).location().lineNumber(); + if (lineOfEvent != checkedLines[testCase][2]) { + complain("CHECK2 for line location of second StepEvent FAILED for CASE # " + testCase); + complain("\texpected value : " + checkedLines[testCase][2] + "; got one : " + lineOfEvent); + exitCode = FAILED; + } else { + display("CHECK2 PASSED"); + } + + stepRequest.disable(); + eventRManager.deleteEventRequest(stepRequest); + stepRequest = null; + display("request for StepEvent in " + threadName + " is deleted"); + } + + //--------------------------------------------------------- immutable common methods + + void display(String msg) { + log.display("debugger > " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Returns a BreakpointRequest object in case of success, otherwise throws Failure. + */ + private BreakpointRequest setBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + int bpLine, + String property) { + + display("Setting a breakpoint in :"); + display(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine + "; property: " + property); + + List allLineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + allLineLocations = method.allLineLocations(); + + display("Getting location for breakpoint..."); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == bpLine) { + lineLocation = curLocation; + break; + } + } + if (lineLocation == null) { + throw new TestBug("Incorrect line number of methods' location"); + } + + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + if (thread != null) { + breakpRequest.addThreadFilter(thread); + } + breakpRequest.putProperty("number", property); + } catch ( Exception e1 ) { + complain("setBreakpoint(): unexpected Exception while creating BreakpointRequest: " + e1); + breakpRequest = null; + } + } catch ( Exception e2 ) { + complain("setBreakpoint(): unexpected Exception while getting locations: " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + throw new Failure("setBreakpoint(): A breakpoint has not been set up."); + } + + display("setBreakpoint(): A breakpoint has been set up."); + return breakpRequest; + } + + private Event waitForEvent (EventRequest eventRequest) { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private Event waitForEvent () { + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + resultEvent = eventIterator.nextEvent(); + if (resultEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ThreadReference threadByName(String name) throws Failure{ + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + while (li.hasNext()) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new Failure("Thread with searching for name is not found: " + name); + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010/TestDescription.java new file mode 100644 index 00000000000..a2cddfd5d2c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010/TestDescription.java @@ -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/EventRequestManager/createStepRequest/crstepreq010. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks whether an implementation of + * EventRequestManager.createStepRequest (ThreadReference thread, int size, int depth) + * method complies with its spec. + * The test checks the following assertions: + * A sizevalue of StepRequest.STEP_MIN will generate a step event each time the code + * index changes. It represents the smallest step size available and often maps to + * the instruction level... + * A depth value of StepRequest.STEP_INTO will generate step events in any called methods. + * The debugger class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq010; + * the debuggee class - nsk.jdi.EventRequestManager.createStepRequest.crstepreq010a; + * The test works as follows. At first, preliminary phase: + * - the debugger connects to the debuggee using nsk.jdi.share classes; + * - the debugger waits for the VMStartEvent and requested ClassPrepareEvent for + * debuggee class. + * At second, test specific phase, each action is performed for every test case: + * - the debugger waits for requested BreakpointEvent which is set on a line + * of debuggee's methodForCommunication() method. This method is invoked in + * additional 'thread1' started in debuggee. First breakpoint allows the debugger + * to obtain ThreadReference mirror of debuggee's 'thread1'; + * - after getting first BreakpointEvent, the debugger sets second BreakpointRequest + * to suspend 'thread1 at the right location before setting step request; + * - after getting second BreakpointEvent, the debugger sets StepRequest + * with STEP_MIN size and STEP_INTO depth, resumes the debuggee and + * waits for two consecutive StepEvents; + * - upon getting StepEvents, the debugger checks their locations by comparing with + * expected line number values. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.createStepRequest.crstepreq010 + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq010a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createStepRequest.crstepreq010 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010a.java new file mode 100644 index 00000000000..2b9d71c0d69 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq010a.java @@ -0,0 +1,199 @@ +/* + * 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.EventRequestManager.createStepRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class crstepreq010a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + static void methodForCommunication() { + int i = instruction; // crstepreq010.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static final int maxCase = 5; + static Object waitnotifyObj = new Object(); + static Thread thread1; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; testCase < maxCase && instruction != quit; testCase++) { + + thread1 = new Thread0crstepreq010a(testCase); + threadStart(thread1); + threadJoin (thread1, testCase); + + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + + static void threadJoin (Thread t, int number) { + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + complain("Case #" + number + ": caught unexpected InterruptedException while waiting for thread finish" ); + } + } + + static int threadStart (Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + exitCode = FAILED; + complain("Caught unexpected InterruptedException while waiting for thread start" ); + return FAILED; + } + } + return PASSED; + } + +} + +//--------------------------------------------------------- test specific classes + +/** + * This thread will be suspended on breakpoint. No locks are used. + */ +class Thread0crstepreq010a extends Thread { + int testCase; + + public Thread0crstepreq010a (int testCase) { + super("thread" + testCase); + this.testCase = testCase; + } + + public void run() { + crstepreq010a.display("enter thread " + getName()); + synchronized(crstepreq010a.waitnotifyObj) { + crstepreq010a.waitnotifyObj.notifyAll(); + } + + crstepreq010a.methodForCommunication(); + caseRun(); + crstepreq010a.display("exit thread " + getName()); + } + + void caseRun() { + int i; + try { + switch (testCase) { + case 0: + i = m00(1); // crstepreq010.checkedLines[0][0-2] + i = m00(2); + break; + + case 1: + i = m00(1); i = m01(2); + break; + + case 2: + i = m02(-1); + break; + + case 3: + i = m03(1); + break; + + case 4: + m04(); // crstepreq010.checkedLines[4][0-2] + break; + } + } catch (DummyException e) { + crstepreq010a.display("DummyException was caught for testCase # " + testCase); + } + } + + int m00 (int arg) { + return arg++; + } + + int m01 (int arg) { + return m00(arg); // crstepreq010.checkedLines[1][0-2] + } + + int m02 (int arg) throws DummyException { + if (arg < 0) { + throw new DummyException(); // crstepreq010.checkedLines[2][0-2] + } + return arg++; + } + + int m03 (int arg) throws DummyException { + return m02(arg); // crstepreq010.checkedLines[3][0-2] + } + + void m04 () {} // crstepreq010.checkedLines[4][2] + + class DummyException extends Exception {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001.java new file mode 100644 index 00000000000..4ce208821dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001.java @@ -0,0 +1,445 @@ +/* + * 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.EventRequestManager.createThreadDeathRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createThreadDeathRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled ThreadDeathRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class tdreg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new tdreg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createThreadDeathRequest.tdreg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + ThreadDeathRequest tdRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating: tdRequest1 = eventRManager.createThreadDeathRequest();"); + tdRequest1 = eventRManager.createThreadDeathRequest(); + log2(" checking up on if request is disabled"); + if (tdRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001/TestDescription.java new file mode 100644 index 00000000000..b48ea188dc9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001/TestDescription.java @@ -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/EventRequestManager/createThreadDeathRequest/tdreg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createThreadDeathRequest() + * complies with its spec: + * public ThreadDeathRequest createThreadDeathRequest() + * Creates a new disabled ThreadDeathRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Returns: the created ThreadDeathRequest + * The test checks up on the following assertions: + * - Creates a new disabled ThreadDeathRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createThreadDeathRequest.tdreg001; + * the debuggee program - nsk.jdi.EventRequestManager.createThreadDeathRequest.tdreg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createThreadDeathRequest.tdreg001 + * nsk.jdi.EventRequestManager.createThreadDeathRequest.tdreg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createThreadDeathRequest.tdreg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001a.java new file mode 100644 index 00000000000..716a1a6ef89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadDeathRequest/tdreg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createThreadDeathRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the tdreg001 JDI test. + */ + +public class tdreg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001.java new file mode 100644 index 00000000000..8c081f2bb22 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001.java @@ -0,0 +1,445 @@ +/* + * 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.EventRequestManager.createThreadStartRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createThreadStartRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - Creates a new disabled ThreadDeathRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class tsreg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new tsreg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createThreadStartRequest.tsreg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + ThreadStartRequest tsRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating: tsRequest1 = eventRManager.createThreadStartRequest();"); + tsRequest1 = eventRManager.createThreadStartRequest(); + log2(" checking up on if request is disabled"); + if (tsRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001/TestDescription.java new file mode 100644 index 00000000000..ea419899416 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001/TestDescription.java @@ -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/EventRequestManager/createThreadStartRequest/tsreg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createThreadStartRequest() + * complies with its spec: + * public ThreadDeathRequest createThreadStartRequest() + * Creates a new disabled ThreadDeathRequest. + * The new event request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Returns: the created ThreadDeathRequest + * The test checks up on the following assertions: + * - Creates a new disabled ThreadDeathRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createThreadStartRequest.tsreg001; + * the debuggee program - nsk.jdi.EventRequestManager.createThreadStartRequest.tsreg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createThreadStartRequest.tsreg001 + * nsk.jdi.EventRequestManager.createThreadStartRequest.tsreg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createThreadStartRequest.tsreg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001a.java new file mode 100644 index 00000000000..86892712abd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createThreadStartRequest/tsreg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createThreadStartRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the tsreg001 JDI test. + */ + +public class tsreg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001.java new file mode 100644 index 00000000000..1885e595acb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001.java @@ -0,0 +1,457 @@ +/* + * 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.EventRequestManager.createVMDeathRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.createVMDeathRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertions:
    + * - Creates a new disabled VMDeathRequest.
    + * - Throws: UnsupportedOperationException -
    + * if the target VM does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class vmdreg001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new vmdreg001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.createVMDeathRequest.vmdreg001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + VMDeathRequest vmdRequest1 = null; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + if (vm.canRequestVMDeathEvent()) { + log2("......creating: vmdRequest1 = eventRManager.createVMDeathRequest();"); + vmdRequest1 = eventRManager.createVMDeathRequest(); + log2(" checking up on if request is disabled"); + if (vmdRequest1.isEnabled()) { + testExitCode = FAILED; + log3("ERROR: request is not disabled"); + } + } else { + try { + log2("......creating: vmdRequest1 = eventRManager.createVMDeathRequest();"); + vmdRequest1 = eventRManager.createVMDeathRequest(); + testExitCode = FAILED; + log3("ERROR: no UnsupportedOperationException thrown"); + } catch ( UnsupportedOperationException e ) { + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001/TestDescription.java new file mode 100644 index 00000000000..1361d306f7c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001/TestDescription.java @@ -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/EventRequestManager/createVMDeathRequest/vmdreg001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.createVMDeathRequest() + * complies with its spec: + * public VMDeathRequest createVMDeathRequest() + * Creates a new disabled VMDeathRequest. + * The new request is added to the list managed by this EventRequestManager. + * Use EventRequest.enable() to activate this event request. + * Not all target virtual machines support this operation. + * Use VirtualMachine.canRequestVMDeathEvent() to determine + * if the operation is supported. + * Returns: the created request + * Throws: UnsupportedOperationException - + * if the target VM does not support this operation. + * The test checks up on the following assertions: + * - Creates a new disabled VMDeathRequest. + * - Throws: UnsupportedOperationException - + * if the target VM does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.createVMDeathRequest.vmdreg001; + * the debuggee program - nsk.jdi.EventRequestManager.createVMDeathRequest.vmdreg001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.createVMDeathRequest.vmdreg001 + * nsk.jdi.EventRequestManager.createVMDeathRequest.vmdreg001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.createVMDeathRequest.vmdreg001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001a.java new file mode 100644 index 00000000000..303fe67dd3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createVMDeathRequest/vmdreg001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.createVMDeathRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the vmdreg001 JDI test. + */ + +public class vmdreg001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002.java new file mode 100644 index 00000000000..5c9275617d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002.java @@ -0,0 +1,457 @@ +/* + * 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.EventRequestManager.deleteAllBreakpoints; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.deleteAllBreakpoints()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - All breakpoints are deleted, that is, following call to
    + * EventRequestManager.breakpointRequests()
    + * returns empty list.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debugger resumes
    + * the debuggee, and both end.
    + *
    + */ + +public class delallbreakp002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new delallbreakp002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.deleteAllBreakpoints.delallbreakp002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + Location breakpLocation = null; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + BreakpointRequest request = null; + BreakpointRequest bpRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + vm.resume(); + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating BreakpointRequests"); + for (int i1 = 0; i1 < bpRequests.length; i1++) { + bpRequests[i1] = eventRManager.createBreakpointRequest(breakpLocation); + bpRequests[i1].putProperty("number", String.valueOf(i1)); + } + + log2("......deleting all BreakpointRequests"); + eventRManager.deleteAllBreakpoints(); + log2("...... getting new list of BreakpointRequests"); + requests = eventRManager.breakpointRequests(); + + log2("...... checking up on size of the list; 0 is expected"); + listSize = requests.size(); + if ( listSize != 0 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected 0 "); + } + + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); +breakpLocation = lineLocation; + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002/TestDescription.java new file mode 100644 index 00000000000..b6ba0f21783 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/EventRequestManager/deleteAllBreakpoints/delallbreakp002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.deleteAllBreakpoints() + * complies with its spec: + * public void deleteAllBreakpoints() + * Remove all breakpoints managed by this EventRequestManager. + * The test checks up on the following assertion: + * - All breakpoints are deleted, that is, following call to + * EventRequestManager.breakpointRequests() + * returns empty list. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.deleteAllBreakpoints.delallbreakp002; + * the debuggee program - nsk.jdi.EventRequestManager.deleteAllBreakpoints.delallbreakp002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.deleteAllBreakpoints.delallbreakp002 + * nsk.jdi.EventRequestManager.deleteAllBreakpoints.delallbreakp002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.deleteAllBreakpoints.delallbreakp002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002a.java new file mode 100644 index 00000000000..77a0aa35a8b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteAllBreakpoints/delallbreakp002a.java @@ -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.EventRequestManager.deleteAllBreakpoints; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the delallbreakp002 JDI test. + */ + +public class delallbreakp002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested +/* + case 0: + methodForCommunication(); + break ; + */ + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002.java new file mode 100644 index 00000000000..fdd49ac9c3b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002.java @@ -0,0 +1,542 @@ +/* + * 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.EventRequestManager.deleteEventRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.deleteEventRequest()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Once the eventRequest is deleted, no operations
    + * (for example, EventRequest.setEnabled(boolean)) are permitted -
    + * attempts to do so will generally cause
    + * an InvalidRequestStateException.
    + * Note: only operations specified to throw InvalidRequestStateException
    + * are not permitted.
    + * Testcases unclude all 12 subclasses of EventRequest created by
    + * EventRequestManager.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares testcases and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class delevtreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new delevtreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + Location breakpLocation = null; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + EventRequest requestArray[] = new EventRequest[12]; + + String fieldName1 = "testField1"; + String fieldName2 = "testField2"; + String fieldName3 = "testField3"; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + Field field1 = debuggeeClass.fieldByName(fieldName1); + + ReferenceType refType = (ReferenceType) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2)).type(); + + ThreadReference threadRef = (ThreadReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName3)); + + String requests[] = { "AccessWatchpoint", "ModificationWatchpoint", + "Breakpoint", "ClassPrepare", + "ClassUnload", "Exception", + "MethodEntry", "MethodExit", + "Step", "ThreadDeath", + "ThreadStart", "VMDeath" }; + + requestArray[0] = eventRManager.createAccessWatchpointRequest(field1); + requestArray[1] = eventRManager.createModificationWatchpointRequest(field1); + requestArray[2] = eventRManager.createBreakpointRequest(breakpLocation); + requestArray[3] = eventRManager.createClassPrepareRequest(); + requestArray[4] = eventRManager.createClassUnloadRequest(); + requestArray[5] = eventRManager.createExceptionRequest(refType, false, false); + requestArray[6] = eventRManager.createMethodEntryRequest(); + requestArray[7] = eventRManager.createMethodExitRequest(); + requestArray[8] = eventRManager.createStepRequest(threadRef, StepRequest.STEP_MIN, StepRequest.STEP_OUT); + requestArray[9] = eventRManager.createThreadDeathRequest(); + requestArray[10] = eventRManager.createThreadStartRequest(); + requestArray[11] = eventRManager.createVMDeathRequest(); + + for (int i1 = 0; i1 < requestArray.length; i1++) { + + log2("......eventRManager.deleteEventRequest(requestArray[i1]); :: " + requests[i1]); + eventRManager.deleteEventRequest(requestArray[i1]); + + try { + requestArray[i1].addCountFilter(1); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException for addCountFilter(1);"); + } catch ( InvalidRequestStateException e ) { + } + try { + requestArray[i1].disable(); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException for disable();"); + } catch ( InvalidRequestStateException e ) { + } + try { + requestArray[i1].enable(); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException for enable();"); + } catch ( InvalidRequestStateException e ) { + } + try { + requestArray[i1].getProperty("number"); + } catch ( InvalidRequestStateException e ) { + testExitCode = FAILED; + log3("ERROR: InvalidRequestStateException for getProperty('number');"); + } + try { + requestArray[i1].isEnabled(); + } catch ( InvalidRequestStateException e ) { + testExitCode = FAILED; + log3("ERROR: InvalidRequestStateException for isEnabled();"); + } + try { + requestArray[i1].putProperty("number", "request" + i1); + } catch ( InvalidRequestStateException e ) { + testExitCode = FAILED; + log3("ERROR: InvalidRequestStateException for putProperty('number', 'request' + i1);"); + } + try { + requestArray[i1].setEnabled(true); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException for setEnabled(true);"); + } catch ( InvalidRequestStateException e ) { + } + try { + requestArray[i1].setSuspendPolicy(EventRequest.SUSPEND_NONE); + testExitCode = FAILED; + log3("ERROR: NO InvalidRequestStateException for setSuspendPolicy(EventRequest.SUSPEND_NONE);"); + } catch ( InvalidRequestStateException e ) { + } + try { + requestArray[i1].suspendPolicy(); + } catch ( InvalidRequestStateException e ) { + testExitCode = FAILED; + log3("ERROR: InvalidRequestStateException for suspendPolicy();"); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); +breakpLocation = lineLocation; + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002/TestDescription.java new file mode 100644 index 00000000000..4391085dbe1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/EventRequestManager/deleteEventRequest/delevtreq002. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-4613913 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.deleteEventRequest() + * complies with its spec: + * public void deleteEventRequest(EventRequest eventRequest) + * Removes an eventRequest. The eventRequest is disabled and the removed from the + * requests managed by this EventRequestManager. + * Once the eventRequest is deleted, no operations + * (for example, EventRequest.setEnabled(boolean)) are permitted - + * attempts to do so will generally cause an InvalidRequestStateException. + * No other eventRequests are effected. + * Because this method changes the underlying lists of event requests, + * attempting to directly delete from a list returned by a request accessor + * (e.g. below): + * Iterator iter = requestManager.stepRequests().iterator(); + * while (iter.hasNext()) { + * requestManager.deleteEventRequest(iter.next()); + * } + * may cause a ConcurrentModificationException. + * Instead use deleteEventRequests(List) or copy the list before iterating. + * Parameters: eventRequest - the eventRequest to remove + * The test checks up on the following assertion: + * Once the eventRequest is deleted, no operations + * (for example, EventRequest.setEnabled(boolean)) are permitted - + * attempts to do so will generally cause an InvalidRequestStateException. + * Testcases unclude all 12 sublcasses of EventRequest created by EventRequestManager. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq002; + * the debuggee program - nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.deleteEventRequest.delevtreq002 + * nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002a.java new file mode 100644 index 00000000000..519654834df --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq002a.java @@ -0,0 +1,158 @@ +/* + * 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.EventRequestManager.deleteEventRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the delevtreq002 JDI test. + */ + +public class delevtreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int testField1 = 0; + static NullPointerException testField2 = new NullPointerException("test"); + static Thread1delevtreq002a testField3 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + synchronized (lockObj1) { + testField3 = new Thread1delevtreq002a("thread1"); + threadStart(testField3); + methodForCommunication(); + } + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj1 = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class Thread1delevtreq002a extends Thread { + + String tName = null; + + public Thread1delevtreq002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + delevtreq002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(delevtreq002a.waitnotifyObj) { + delevtreq002a.waitnotifyObj.notify(); + } + synchronized(delevtreq002a.lockObj1) { + delevtreq002a.log1(" 'run': exit :: threadName == " + tName); + } + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003.java new file mode 100644 index 00000000000..ec150daeada --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003.java @@ -0,0 +1,252 @@ +/* + * 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.EventRequestManager.deleteEventRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up com.sun.jdi.EventRequestManager.deleteEventRequest() + * after class file redefinition. + * + * The test performs as follow: + * Debuggee has two classes. Debugger creates a BreakpointRequest at the + * first class and waits a corresponding event. After getting BreakpointEvent, + * debugger redefines the second class and tries to delete BreakpointRequest. + */ + +public class delevtreq003 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.EventRequestManager.deleteEventRequest."; + private final static String debuggerName = prefix + "delevtreq003"; + public final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String classFileName = "delevtreq003b.class"; + private final static String newClassFile = "newclass" + File.separator + + prefix.replace('.',File.separatorChar) + + classFileName; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + public final static int expectedEventCount = 1; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + delevtreq003 thisTest = new delevtreq003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectOutput(log); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + int eventCount = 0; + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\nevent ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\nevent ===>>> " + event); + prepareTestCases(); + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\nevent ===>>> " + event); + ClassType testedClass; + testedClass = (ClassType )debugee.classByName(testedClassName); + + display("\nredefining..."); + redefineDebugee(testedClass, newClassFile); + + eventCount++; + boolean isBrkpEnabled = event.request().isEnabled(); + if (!isBrkpEnabled) { + complain("breakpoint was disabled after " + + "the redefinition of an other class"); + exitStatus = Consts.TEST_FAILED; + } else { + display("\nis breakpoint enabled?\t" + isBrkpEnabled); + display("\ndeleting the breakpoint request..."); + evm.deleteEventRequest(event.request()); + } + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount != expectedEventCount) { + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee(ReferenceType refType, String classFileName) { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(refType, classFileName); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(ReferenceType refType, String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(classDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(refType, arrayToRedefine); + return mapForClass; + } + + private void prepareTestCases() { + debugeeClass = debugee.classByName(debugeeName); + display("debugeeClass\t\t:" + debugeeClass.name()); + display("setting breakpoint..."); + debugee.setBreakpoint(debugeeClass, + delevtreq003a.brkpMethodName, + delevtreq003a.brkpLineNumber); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/TestDescription.java new file mode 100644 index 00000000000..6468af3e6f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/TestDescription.java @@ -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/EventRequestManager/deleteEventRequest/delevtreq003. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.EventRequestManager.deleteEventRequest() + * after class file redefinition. + * The test performs as follow: + * Debuggee has two classes (A and B). Debugger creates a BreakpointRequest + * at the first class A and waits a corresponding event. After getting + * BreakpointEvent, debugger redefines the second class B and tries to + * delete BreakpointRequest. + * COMMENTS + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq003 + * nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq003a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.deleteEventRequest.delevtreq003 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/newclass/delevtreq003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/newclass/delevtreq003b.java new file mode 100644 index 00000000000..6decdcb6475 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/newclass/delevtreq003b.java @@ -0,0 +1,50 @@ +/* + * 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.EventRequestManager.deleteEventRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * delevtreq003b is deugee's part of the delevtreq003. + */ + +public class delevtreq003b { + public final static int INITIAL_VALUE = 0; + public final static int BEFORE_REDEFINITION = 1; + public final static int AFTER_REDEFINITION = 2; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public static void runIt(boolean doWait) { + + flag = AFTER_REDEFINITION; +// ^^^^^^^^^^^^^^^^^^^ it will be redefined + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003a.java new file mode 100644 index 00000000000..7c474a87b83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003a.java @@ -0,0 +1,52 @@ +/* + * 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.EventRequestManager.deleteEventRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * delevtreq003a is deugee's part of the delevtreq003. + */ +public class delevtreq003a { + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 50; + + private static Log log = null; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + + delevtreq003b.loadClass = true; + + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003b.java new file mode 100644 index 00000000000..a14ba1a9acc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003b.java @@ -0,0 +1,50 @@ +/* + * 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.EventRequestManager.deleteEventRequest; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * delevtreq003b is deugee's part of the delevtreq003. + */ + +public class delevtreq003b { + public final static int INITIAL_VALUE = 0; + public final static int BEFORE_REDEFINITION = 1; + public final static int AFTER_REDEFINITION = 2; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public static void runIt(boolean doWait) { + + flag = BEFORE_REDEFINITION; +// ^^^^^^^^^^^^^^^^^^^ it will be redefined + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002.java new file mode 100644 index 00000000000..43e423d399e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002.java @@ -0,0 +1,611 @@ +/* + * 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.EventRequestManager.deleteEventRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.deleteEventRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * After invoking the tested method,
    + * the methods returning Lists of requests,
    + * such as EventRequestManager.accessWatchpointRequests(),
    + * return a List containing no eventRequests
    + * deleted by the tested method.
    + * Testcases include all subclasses of EventRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares testcases and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class delevtreqs002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new delevtreqs002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.deleteEventRequests.delevtreqs002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + Location breakpLocation = null; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + final int length1 = 10; + final int length2 = 12; + EventRequest requestArray[][] = new EventRequest[length1][length2]; + + String fieldName1 = "testField1"; + String fieldName2 = "testField2"; + String fieldName3 = "testField3"; + + List requests = null; + ListIterator li = null; + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + Field field1 = debuggeeClass.fieldByName(fieldName1); + + ReferenceType refType = (ReferenceType) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName2)).type(); + + + log2("......creating EventRequests"); + for (int i1 = 0; i1 < length1; i1++) { + + ThreadReference threadRef = (ThreadReference) + ( (ArrayReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName3)) + ).getValue(i1); + + requestArray[i1][0] = eventRManager.createAccessWatchpointRequest(field1); + requestArray[i1][1] = eventRManager.createModificationWatchpointRequest(field1); + requestArray[i1][2] = eventRManager.createBreakpointRequest(breakpLocation); + requestArray[i1][3] = eventRManager.createClassPrepareRequest(); + requestArray[i1][4] = eventRManager.createClassUnloadRequest(); + requestArray[i1][5] = eventRManager.createExceptionRequest(refType, false, false); + requestArray[i1][6] = eventRManager.createMethodEntryRequest(); + requestArray[i1][7] = eventRManager.createMethodExitRequest(); + requestArray[i1][8] = eventRManager.createStepRequest(threadRef, StepRequest.STEP_MIN, StepRequest.STEP_OUT); + requestArray[i1][9] = eventRManager.createThreadDeathRequest(); + requestArray[i1][10] = eventRManager.createThreadStartRequest(); + requestArray[i1][11] = eventRManager.createVMDeathRequest(); + } + for ( int ii1 = 0; ii1 < length1; ii1++) { + for ( int ii2 = 0; ii2 < length2; ii2++) { + requestArray[ii1][ii2].putProperty("number", "request " + ii1 + " " + ii2); + } + } + + + log2("......deleting Requests and checking up on Lists"); + for (int i2 = 0; i2 < length1; i2++) { + + EventRequest awRequest = requestArray[i2][0]; + EventRequest mwRequest = requestArray[i2][1]; + EventRequest bp1Request = requestArray[i2][2]; + EventRequest cp1Request = requestArray[i2][3]; + EventRequest cuRequest = requestArray[i2][4]; + EventRequest exRequest = requestArray[i2][5]; + EventRequest menRequest = requestArray[i2][6]; + EventRequest mexRequest = requestArray[i2][7]; + EventRequest stRequest = requestArray[i2][8]; + EventRequest tdRequest = requestArray[i2][9]; + EventRequest tsRequest = requestArray[i2][10]; + EventRequest vmdRequest = requestArray[i2][11]; + + requests = new LinkedList(); + + try { + requests.add(awRequest); + requests.add(mwRequest); + requests.add(bp1Request); + requests.add(cp1Request); + requests.add(cuRequest); + requests.add(exRequest); + requests.add(menRequest); + requests.add(mexRequest); + requests.add(stRequest); + requests.add(tdRequest); + requests.add(tsRequest); + requests.add(vmdRequest); + } catch ( UnsupportedOperationException e ) { + testExitCode = FAILED; + log3("ERROR: unexpected UnsupportedOperationException"); + break; + } + + eventRManager.deleteEventRequests(requests); + + for (EventRequest er : eventRManager.accessWatchpointRequests()) { + if ( er.equals(awRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted AccessWatchpointRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.modificationWatchpointRequests()) { + if ( er.equals(mwRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted ModificationWatchpointRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.breakpointRequests()) { + if ( er.equals(bp1Request) ) { + testExitCode = FAILED; + log3("ERROR: deleted BreakpointRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.classPrepareRequests()) { + if ( er.equals(cp1Request) ) { + testExitCode = FAILED; + log3("ERROR: deleted ClassPrepareRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.classUnloadRequests()) { + if ( er.equals(cuRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted ClassUnloadRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.exceptionRequests()) { + if ( er.equals(exRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted ExceptionRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.methodEntryRequests()) { + if ( er.equals(menRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted MethodEntryRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.methodExitRequests()) { + if ( er.equals(mexRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted MethodExitRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.stepRequests()) { + if ( er.equals(stRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted StepRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.threadDeathRequests()) { + if ( er.equals(tdRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted ThreadDeathRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.threadStartRequests()) { + if ( er.equals(tsRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted ThreadStartRequest is in the List :: " + er.getProperty("number") ); + } + } + + for (EventRequest er : eventRManager.vmDeathRequests()) { + if ( er.equals(vmdRequest) ) { + testExitCode = FAILED; + log3("ERROR: deleted VMDeathRequest is in the List :: " + er.getProperty("number") ); + } + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); +breakpLocation = lineLocation; + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002/TestDescription.java new file mode 100644 index 00000000000..c77afc1e606 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/deleteEventRequests/delevtreqs002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.deleteEventRequests() + * complies with its spec: + * public void deleteEventRequests(List eventRequests) + * Removes a list of EventRequests. + * Parameters: eventRequests - the list of eventRequests to remove + * The test checks up on the following assertion: + * After invoking the tested method, + * the methods returning Lists of requests, + * such as EventRequestManager.accessWatchpointRequests(), + * return a List containing no eventRequests deleted by the tested method. + * Testcases include all subclasses of EventRequest. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.deleteEventRequests.delevtreqs002; + * the debuggee program - nsk.jdi.EventRequestManager.deleteEventRequests.delevtreqs002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.deleteEventRequests.delevtreqs002 + * nsk.jdi.EventRequestManager.deleteEventRequests.delevtreqs002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.deleteEventRequests.delevtreqs002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002a.java new file mode 100644 index 00000000000..7ade8be26c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequests/delevtreqs002a.java @@ -0,0 +1,160 @@ +/* + * 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.EventRequestManager.deleteEventRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the delevtreqs002 JDI test. + */ + +public class delevtreqs002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int testField1 = 0; + static NullPointerException testField2 = new NullPointerException("test"); + static Thread1delevtreqs002a testField3[] = new Thread1delevtreqs002a[10]; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + synchronized (lockObj1) { + for (int ii = 0; ii < 10; ii++) { + testField3[ii] = new Thread1delevtreqs002a("thread" + ii); + threadStart(testField3[ii]); + } + methodForCommunication(); + } + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + static Object lockObj1 = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + +} + +class Thread1delevtreqs002a extends Thread { + + String tName = null; + + public Thread1delevtreqs002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + delevtreqs002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(delevtreqs002a.waitnotifyObj) { + delevtreqs002a.waitnotifyObj.notify(); + } + synchronized(delevtreqs002a.lockObj1) { + delevtreqs002a.log1(" 'run': exit :: threadName == " + tName); + } + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq001.java new file mode 100644 index 00000000000..c0916034e80 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq001.java @@ -0,0 +1,291 @@ +/* + * 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.EventRequestManager.exceptionRequests; + +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ObjectCollectedException; + +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 + * com.sun.jdi.request.EventRequestManager.exceptionRequests() + * properly returns all previously created ExceptionRequest objects for the + * different kinds of methods in two debuggee's classes when: + *
  • event requests are disabled + *
  • event requests are enabled
    + * The debuggee loads several dummy classes which ReferenceType + * objects are obtained by the debugger for exercising + * the exceptionRequests().
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class excreq001 { + public static final int PASSED = 0; + public static final int FAILED = 2; + public static final int JCK_STATUS_BASE = 95; + static final String PACK = + "nsk.jdi.EventRequestManager.exceptionRequests"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int EXC_NUM = 4; +// list of debuggee's loaded classes + static final String DEBUGGEE_CLS[][] = { + {PACK + ".excreq001t", "excreq001t.java"}, + {PACK + ".excreq001a", "excreq001a.java"}, + {PACK + ".excreq001b", "excreq001b.java"}, + {PACK + ".excreq001c", "excreq001c.java"}, + }; +// caught/uncaught exception notifications + static final boolean DEBUGGEE_NTFS[][] = { + {true, true}, + {true, false}, + {false, false}, + {false, true} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 excreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType rType; + ExceptionRequest excRequest[] = new ExceptionRequest[EXC_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLS[0][0]); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "excreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.exceptionRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled exception requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class excreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/exceptionRequests/excreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new excreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.exceptionRequests.excreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + List requests = null; + ListIterator li = null; + + ExceptionRequest request = null; + ExceptionRequest cuRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType refType = (ReferenceType) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)).type(); + + log2("......creating ExceptionRequests"); + for (int i1 = 0; i1 < cuRequests.length; i1++) { + cuRequests[i1] = eventRManager.createExceptionRequest(refType, false, false); + cuRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new ExceptionRequest"); + requests = eventRManager.exceptionRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (ExceptionRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created ExceptionRequest"); + cuRequests[i1].enable(); + requests = eventRManager.exceptionRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (ExceptionRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting ExceptionRequests"); + for (int i2 = cuRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(cuRequests[i2]); + requests = eventRManager.exceptionRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq002/TestDescription.java new file mode 100644 index 00000000000..d504c67f653 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/exceptionRequests/excreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.exceptionRequests() + * complies with its spec: + * public List exceptionRequests() + * Return an unmodifiable list of the enabled and disabled exception requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all ExceptionRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled exception requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.exceptionRequests.excreq002; + * the debuggee program - nsk.jdi.EventRequestManager.exceptionRequests.excreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.exceptionRequests.excreq002 + * nsk.jdi.EventRequestManager.exceptionRequests.excreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.exceptionRequests.excreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq002a.java new file mode 100644 index 00000000000..c7a3ed9c802 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/exceptionRequests/excreq002a.java @@ -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.EventRequestManager.exceptionRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the excreq002 JDI test. + */ + +public class excreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static NullPointerException testField = new NullPointerException("test"); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001.java new file mode 100644 index 00000000000..dbbb475b031 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001.java @@ -0,0 +1,139 @@ +/* + * 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.EventRequestManager.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class hashcode001 { + + //------------------------------------------------------- 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.EventRequestManager.hashCode."; + private final static String className = "hashcode001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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() { + + display("Checking hashCode() method for EventRequestManager object"); + + EventRequestManager eventRequestManager = debuggee.VM().eventRequestManager(); + int hCode = eventRequestManager.hashCode(); + + if (hCode == 0) { + complain("hashCode() returns 0 for EventRequestManager object"); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = eventRequestManager.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for EventRequestManager object" + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + // get new reference to the same EventRequestManager and get hash code. + hCode1 = debuggee.VM().eventRequestManager().hashCode(); + if (hCode != hCode1) { + complain("hashCode() does not return same value for equal EventRequestManager object " + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns for EventRequestManager object : " + hCode); + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..46a617824f4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/EventRequestManager/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.request.EventRequestManager interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during + * an execution of a Java application, the hashCode method must + * consistently return the same integer, provided no information used + * in equals comparisons on the object is modified. + * ... + * - If two objects are equal according to the equals(Object) method, + * then calling the hashCode method on each of the two objects must + * produce the same integer result. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for EventRequestManager + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventRequestManager.hashCode.hashcode001 + * nsk.jdi.EventRequestManager.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001a.java new file mode 100644 index 00000000000..dc8c10753d8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001a.java @@ -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.EventRequestManager.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ 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); + try { + pipe.println(hashcode001.SIGNAL_READY); + receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq001.java new file mode 100644 index 00000000000..ca8c0e1fbe7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq001.java @@ -0,0 +1,252 @@ +/* + * 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.EventRequestManager.methodEntryRequests; + +import com.sun.jdi.request.MethodEntryRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +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 + * com.sun.jdi.request.EventRequestManager.methodEntryRequests() + * properly returns all MethodEntryRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled.
    + * The MethodEntryRequest objects are distinguished by the different + * EventRequest's properties.
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class methentreq001 { + public static final int PASSED = 0; + public static final int FAILED = 2; + public static final int JCK_STATUS_BASE = 95; + static final int TIMEOUT_DELTA = 1000; // in milliseconds + static final String DEBUGGEE_CLASS = + "nsk.jdi.EventRequestManager.methodEntryRequests.methentreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int MENTRS_NUM = 7; + static final String PROPS[][] = { + {"first", "a quick"}, + {"second", "brown"}, + {"third", "fox"}, + {"fourth", "jumps"}, + {"fifth", "over"}, + {"sixth", "the lazy"}, + {"seventh", "dog"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 methentreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + MethodEntryRequest mentrRequest[] = new MethodEntryRequest[MENTRS_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "methentreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.methodEntryRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled method entry requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class methentreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new methentreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.methodEntryRequests.methentreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + MethodEntryRequest request = null; + MethodEntryRequest meRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating MethodEntryRequests"); + for (int i1 = 0; i1 < meRequests.length; i1++) { + meRequests[i1] = eventRManager.createMethodEntryRequest(); + meRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new MethodEntryRequest"); + requests = eventRManager.methodEntryRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (MethodEntryRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created MethodEntryRequest"); + meRequests[i1].enable(); + requests = eventRManager.methodEntryRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (MethodEntryRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting MethodEntryRequests"); + for (int i2 = meRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(meRequests[i2]); + requests = eventRManager.methodEntryRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002/TestDescription.java new file mode 100644 index 00000000000..ba80356ead5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.methodEntryRequests() + * complies with its spec: + * public List methodEntryRequests() + * Return an unmodifiable list of the enabled and disabled method entry requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all MethodEntryRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled method entry requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.methodEntryRequests.methentreq002; + * the debuggee program - nsk.jdi.EventRequestManager.methodEntryRequests.methentreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.methodEntryRequests.methentreq002 + * nsk.jdi.EventRequestManager.methodEntryRequests.methentreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.methodEntryRequests.methentreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002a.java new file mode 100644 index 00000000000..9f55b029901 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodEntryRequests/methentreq002a.java @@ -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.EventRequestManager.methodEntryRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the methentreq002 JDI test. + */ + +public class methentreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq001.java new file mode 100644 index 00000000000..d6852a0b5cb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq001.java @@ -0,0 +1,252 @@ +/* + * 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.EventRequestManager.methodExitRequests; + +import com.sun.jdi.request.MethodExitRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.event.*; + +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 + * com.sun.jdi.request.EventRequestManager.methodExitRequests() + * properly returns all MethodExitRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled.
    + * The MethodExitRequest objects are distinguished by the different + * EventRequest's properties.
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class methexitreq001 { + public static final int PASSED = 0; + public static final int FAILED = 2; + public static final int JCK_STATUS_BASE = 95; + static final int TIMEOUT_DELTA = 1000; // in milliseconds + static final String DEBUGGEE_CLASS = + "nsk.jdi.EventRequestManager.methodExitRequests.methexitreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int MEXIT_NUM = 7; + static final String PROPS[][] = { + {"first", "a quick"}, + {"second", "brown"}, + {"third", "fox"}, + {"fourth", "jumps"}, + {"fifth", "over"}, + {"sixth", "the lazy"}, + {"seventh", "dog"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 methexitreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + MethodExitRequest mentrRequest[] = new MethodExitRequest[MEXIT_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "methexitreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.methodExitRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled method exit requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class methexitreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new methexitreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.methodExitRequests.methexitreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + MethodExitRequest request = null; + MethodExitRequest meRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating MethodExitRequests"); + for (int i1 = 0; i1 < meRequests.length; i1++) { + meRequests[i1] = eventRManager.createMethodExitRequest(); + meRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new MethodExitRequest"); + requests = eventRManager.methodExitRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (MethodExitRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created MethodExitRequest"); + meRequests[i1].enable(); + requests = eventRManager.methodExitRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (MethodExitRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting MethodExitRequests"); + for (int i2 = meRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(meRequests[i2]); + requests = eventRManager.methodExitRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002/TestDescription.java new file mode 100644 index 00000000000..fde5f6dc7dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.methodExitRequests() + * complies with its spec: + * public List methodExitRequests() + * Return an unmodifiable list of the enabled and disabled method exit requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all MethodExitRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled method exit requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.methodExitRequests.methexitreq002; + * the debuggee program - nsk.jdi.EventRequestManager.methodExitRequests.methexitreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.methodExitRequests.methexitreq002 + * nsk.jdi.EventRequestManager.methodExitRequests.methexitreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.methodExitRequests.methexitreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002a.java new file mode 100644 index 00000000000..4c1b902c477 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002a.java @@ -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.EventRequestManager.methodExitRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the methexitreq002 JDI test. + */ + +public class methexitreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq001.java new file mode 100644 index 00000000000..0fe9d65972e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq001.java @@ -0,0 +1,284 @@ +/* + * 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.EventRequestManager.modificationWatchpointRequests; + +import com.sun.jdi.Field; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.request.ModificationWatchpointRequest; +import com.sun.jdi.request.EventRequestManager; +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 + * com.sun.jdi.request.EventRequestManager.modificationWatchpointRequests() + * properly returns all ModificationWatchpointRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class modwtchpreq001 { + 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.EventRequestManager.modificationWatchpointRequests.modwtchpreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int FLDS_NUM = 16; + static final String DEBUGGEE_FLDS[][] = { + {"byte", "byteFld", "B"}, + {"short", "shortFld", "S"}, + {"int", "intFld", "I"}, + {"long", "longFld", "J"}, + {"float", "floatFld", "F"}, + {"double", "doubleFld", "D"}, + {"char", "charFld", "C"}, + {"boolean", "booleanFld", "Z"}, + {"java.lang.String", "strFld", "Ljava/lang/String;"}, + {"short", "sFld", "S"}, + {"byte", "prFld", "B"}, + {"float", "pubFld", "F"}, + {"double", "protFld", "D"}, + {"int", "tFld", "I"}, + {"long", "vFld", "J"}, + {"char", "fFld", "C"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 modwtchpreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType rType; + List fields; + ModificationWatchpointRequest mwpRequest[] = + new ModificationWatchpointRequest[FLDS_NUM]; + String cmd; + int i = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "modwtchpreq001t.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.canWatchFieldModification() ) { + log.display(" TEST CANCELLED due to: vm.canWatchFieldModification() == false"); + return quitDebuggee(); + } + + 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: " + e); + tot_res = FAILED; + return quitDebuggee(); + } + Iterator iter = fields.iterator(); + while (iter.hasNext()) { + Field fld = (Field) iter.next(); + log.display("\nCreating ModificationWatchpointRequest for the field:\n\t" + + fld.typeName() + " " + fld.name() + + " type_signature=" + fld.signature()); + try { + mwpRequest[i++] = erManager.createModificationWatchpointRequest(fld); + } catch (Exception e) { + log.complain("TEST FAILURE: createModificationWatchpointRequest: " + e); + tot_res = FAILED; + return quitDebuggee(); + } + } + elThread = new EventListener(); + elThread.start(); + +// Check ModificationWatchpoint requests when event requests are disabled + log.display("\n1) Getting ModificationWatchpointRequest objects with disabled event requests..."); + checkRequests(erManager, 1); + +// Check ModificationWatchpoint requests when event requests are enabled + for (i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.modificationWatchpointRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled access watchpoint requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checks up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class modwtchpreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new modwtchpreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.modificationWatchpointRequests.modwtchpreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + Field field = null; + + List requests = null; + ListIterator li = null; + + ModificationWatchpointRequest request = null; + ModificationWatchpointRequest awRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + field = debuggeeClass.fieldByName(fieldName); + + log2("......creating ModificationWatchpointRequests"); + for (int i1 = 0; i1 < awRequests.length; i1++) { + awRequests[i1] = eventRManager.createModificationWatchpointRequest(field); + awRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new ModificationWatchpointRequest"); + requests = eventRManager.modificationWatchpointRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (ModificationWatchpointRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created ModificationWatchpointRequest"); + awRequests[i1].enable(); + requests = eventRManager.modificationWatchpointRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (ModificationWatchpointRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting ModificationWatchpointRequests"); + for (int i2 = awRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(awRequests[i2]); + requests = eventRManager.modificationWatchpointRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002/TestDescription.java new file mode 100644 index 00000000000..b0039c4a072 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/modificationWatchpointRequests/modwtchpreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.modificationWatchpointRequests() + * complies with its spec: + * public List modificationWatchpointRequests() + * Return an unmodifiable list of the enabled and disabled modificaton watchpoint + * requests. This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all ModificationWatchpointRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled modification watchpoint requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.modificationWatchpointRequests.modwtchpreq002; + * the debuggee program - nsk.jdi.EventRequestManager.modificationWatchpointRequests.modwtchpreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.modificationWatchpointRequests.modwtchpreq002 + * nsk.jdi.EventRequestManager.modificationWatchpointRequests.modwtchpreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.modificationWatchpointRequests.modwtchpreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002a.java new file mode 100644 index 00000000000..833f2a61eed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/modificationWatchpointRequests/modwtchpreq002a.java @@ -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.EventRequestManager.modificationWatchpointRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the modwtchpreq002 JDI test. + */ + +public class modwtchpreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq001.java new file mode 100644 index 00000000000..d7993362074 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq001.java @@ -0,0 +1,309 @@ +/* + * 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.EventRequestManager.stepRequests; + +import com.sun.jdi.ThreadReference; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.StepRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.DuplicateRequestException; +import com.sun.jdi.ObjectCollectedException; +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 + * com.sun.jdi.request.EventRequestManager.stepRequests() + * properly returns all StepRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled
    + * A debuggee part of the test creates several dummy user and daemon + * threads with own names.
    + * EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class stepreq001 { + 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.EventRequestManager.stepRequests.stepreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int THRDS_NUM = 8; + static final String DEBUGGEE_THRDS[] = { + "main_thr", "thr1", "thr2", "thr3", + "thr4", "thr5", "thr6", "thr7" + }; + static final boolean DAEMON_THRDS[] = { + false, true, false, true, + true, false, true, false + }; + static final int RESTRICTIONS[][] = { + {StepRequest.STEP_MIN, StepRequest.STEP_INTO}, + {StepRequest.STEP_LINE, StepRequest.STEP_OVER}, + {StepRequest.STEP_MIN, StepRequest.STEP_OUT}, + {StepRequest.STEP_LINE, StepRequest.STEP_INTO}, + {StepRequest.STEP_LINE, StepRequest.STEP_INTO}, + {StepRequest.STEP_MIN, StepRequest.STEP_OUT}, + {StepRequest.STEP_LINE, StepRequest.STEP_INTO}, + {StepRequest.STEP_MIN, StepRequest.STEP_OUT} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 stepreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ThreadReference thR; + List threads; + StepRequest sRequest[] = new StepRequest[THRDS_NUM]; + String cmd; + int i = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "stepreq001t.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(); + } + + try { + threads = vm.allThreads(); + } catch (Exception e) { + log.complain("TEST FAILURE: allThreads: " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + Iterator iter = threads.iterator(); + while (iter.hasNext()) { + thR = (ThreadReference) iter.next(); + for (int j=0; j + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.stepRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled step requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class stepreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/stepRequests/stepreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new stepreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.stepRequests.stepreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + String fieldName = "testField"; + + List requests = null; + ListIterator li = null; + + StepRequest request = null; + StepRequest stRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ArrayReference threads = (ArrayReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + + + log2("......creating StepRequests"); + for (int i1 = 0; i1 < stRequests.length; i1++) { + stRequests[i1] = eventRManager.createStepRequest( (ThreadReference) threads.getValue(i1), + StepRequest.STEP_MIN, StepRequest.STEP_OUT); + stRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new StepRequest"); + requests = eventRManager.stepRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (StepRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created StepRequest"); + stRequests[i1].enable(); + requests = eventRManager.stepRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (StepRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting StepRequests"); + for (int i2 = stRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(stRequests[i2]); + requests = eventRManager.stepRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq002/TestDescription.java new file mode 100644 index 00000000000..0d4ad10738f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/stepRequests/stepreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.stepRequests() + * complies with its spec: + * public List stepRequests() + * Return an unmodifiable list of the enabled and disabled step requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all StepRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled step requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.stepRequests.stepreq002; + * the debuggee program - nsk.jdi.EventRequestManager.stepRequests.stepreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.stepRequests.stepreq002 + * nsk.jdi.EventRequestManager.stepRequests.stepreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.stepRequests.stepreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq002a.java new file mode 100644 index 00000000000..d0ade995f6f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq002a.java @@ -0,0 +1,159 @@ +/* + * 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.EventRequestManager.stepRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the stepreq002 JDI test. + */ + +public class stepreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1stepreq002a testField[] = new Thread1stepreq002a[10]; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + synchronized (lockObj1) { + for (int ii = 0; ii < 10; ii++) { + testField[ii] = new Thread1stepreq002a("thread" + ii); + threadStart(testField[ii]); + } + methodForCommunication(); + } + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj1 = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + +} + +class Thread1stepreq002a extends Thread { + + String tName = null; + + public Thread1stepreq002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + stepreq002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(stepreq002a.waitnotifyObj) { + stepreq002a.waitnotifyObj.notify(); + } + synchronized(stepreq002a.lockObj1) { + stepreq002a.log1(" 'run': exit :: threadName == " + tName); + } + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq001.java new file mode 100644 index 00000000000..7b0c0095b03 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq001.java @@ -0,0 +1,238 @@ +/* + * 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.EventRequestManager.threadDeathRequests; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.request.ThreadDeathRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.event.*; + +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 + * com.sun.jdi.request.EventRequestManager.threadDeathRequests() + * properly returns all ThreadDeathRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled.
    + * ThreadDeathRequest objects are distinguished by the different + * EventRequest's properties.
    + * JDI EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class thrdeathreq001 { + 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.EventRequestManager.threadDeathRequests.thrdeathreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int THR_NUM = 7; + static final String PROPS[][] = { + {"first", "a quick"}, + {"second", "brown"}, + {"third", "fox"}, + {"fourth", "jumps"}, + {"fifth", "over"}, + {"sixth", "the lazy"}, + {"seventh", "dog"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 thrdeathreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ThreadDeathRequest thrdeathRequest[] = + new ThreadDeathRequest[THR_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "thrdeathreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.threadDeathRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled thread death requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class thrdeathreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new thrdeathreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.threadDeathRequests.thrdeathreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + ThreadDeathRequest request = null; + ThreadDeathRequest tdRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating ThreadDeathRequests"); + for (int i1 = 0; i1 < tdRequests.length; i1++) { + tdRequests[i1] = eventRManager.createThreadDeathRequest(); + tdRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new ThreadDeathRequest"); + requests = eventRManager.threadDeathRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (ThreadDeathRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created ThreadDeathRequest"); + tdRequests[i1].enable(); + requests = eventRManager.threadDeathRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (ThreadDeathRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting ThreadDeathRequests"); + for (int i2 = tdRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(tdRequests[i2]); + requests = eventRManager.threadDeathRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002/TestDescription.java new file mode 100644 index 00000000000..708b07cfe0d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/threadDeathRequests/thrdeathreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.threadDeathRequests() + * complies with its spec: + * public List threadDeathRequests() + * Return an unmodifiable list of the enabled and disabled thread death requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all ThreadDeathRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled thread death requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.threadDeathRequests.thrdeathreq002; + * the debuggee program - nsk.jdi.EventRequestManager.threadDeathRequests.thrdeathreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.threadDeathRequests.thrdeathreq002 + * nsk.jdi.EventRequestManager.threadDeathRequests.thrdeathreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.threadDeathRequests.thrdeathreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002a.java new file mode 100644 index 00000000000..c6cb2d0455a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadDeathRequests/thrdeathreq002a.java @@ -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.EventRequestManager.threadDeathRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the thrdeathreq002 JDI test. + */ + +public class thrdeathreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq001.java new file mode 100644 index 00000000000..c76b805bea9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq001.java @@ -0,0 +1,237 @@ +/* + * 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.EventRequestManager.threadStartRequests; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.request.ThreadStartRequest; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.event.*; + +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 + * com.sun.jdi.request.EventRequestManager.threadStartRequests() + * properly returns all ThreadStartRequest objects when: + *
  • event requests are disabled + *
  • event requests are enabled.
    + * ThreadStartRequest objects are distinguished by the different + * EventRequest's properties.
    + * JDI EventHandler was added as workaround for the bug 4430096. + * This prevents the target VM from potential hangup. + */ +public class thrstartreq001 { + 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.EventRequestManager.threadStartRequests.thrstartreq001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int THR_NUM = 7; + static final String PROPS[][] = { + {"first", "a quick"}, + {"second", "brown"}, + {"third", "fox"}, + {"fourth", "jumps"}, + {"fifth", "over"}, + {"sixth", "the lazy"}, + {"seventh", "dog"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private EventListener elThread; + private volatile int tot_res = PASSED; + + 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 thrstartreq001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ThreadStartRequest thrstartRequest[] = new ThreadStartRequest[THR_NUM]; + String cmd; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "thrstartreq001t.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(); + } + + for (int i=0; i + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.threadStartRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled thread start requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class thrstartreq002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new thrstartreq002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.threadStartRequests.thrstartreq002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + ThreadStartRequest request = null; + ThreadStartRequest tsRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating ThreadStartRequests"); + for (int i1 = 0; i1 < tsRequests.length; i1++) { + tsRequests[i1] = eventRManager.createThreadStartRequest(); + tsRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new ThreadStartRequest"); + requests = eventRManager.threadStartRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (ThreadStartRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created ThreadStartRequest"); + tsRequests[i1].enable(); + requests = eventRManager.threadStartRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (ThreadStartRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting ThreadStartRequests"); + for (int i2 = tsRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(tsRequests[i2]); + requests = eventRManager.threadStartRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002/TestDescription.java new file mode 100644 index 00000000000..48631305820 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventRequestManager/threadStartRequests/thrstartreq002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.threadStartRequests() + * complies with its spec: + * public List threadStartRequests() + * Return an unmodifiable list of the enabled and disabled thread start requests. + * This list is a live view of these requests and thus changes + * as requests are added and deleted. + * Returns: the all ThreadStartRequest objects. + * The test checks up on the following assertions: + * - The list is unmodifiable. + * - The list of the enabled and disabled thread start requests. + * - This list is changes as requests are added and deleted. + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.threadStartRequests.thrstartreq002; + * the debuggee program - nsk.jdi.EventRequestManager.threadStartRequests.thrstartreq002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.threadStartRequests.thrstartreq002 + * nsk.jdi.EventRequestManager.threadStartRequests.thrstartreq002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.threadStartRequests.thrstartreq002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002a.java new file mode 100644 index 00000000000..13a115c53fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/threadStartRequests/thrstartreq002a.java @@ -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.EventRequestManager.threadStartRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the thrstartreq002 JDI test. + */ + +public class thrstartreq002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //static int testField = 0; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001.java new file mode 100644 index 00000000000..b6fce04d6ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001.java @@ -0,0 +1,527 @@ +/* + * 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.EventRequestManager.vmDeathRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventRequestManager.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventRequestManager.vmDeathRequests()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * - The list is unmodifiable.
    + * - The list of the enabled and disabled VM death requests.
    + * - This list is changes as requests are added and deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger checking up on assertions.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class vmdeathreq001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new vmdeathreq001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventRequestManager.vmDeathRequests.vmdeathreq001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + List requests = null; + ListIterator li = null; + + VMDeathRequest request = null; + VMDeathRequest vmRequests[] = { null, null, null, null, null, + null, null, null, null, null }; + int listSize; + int flag; + + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......creating VMDeathRequests"); + for (int i1 = 0; i1 < vmRequests.length; i1++) { + vmRequests[i1] = eventRManager.createVMDeathRequest(); + vmRequests[i1].putProperty("number", String.valueOf(i1)); + + log2("......checking up on returned List after creating new VMDeathRequest"); + requests = eventRManager.vmDeathRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + flag = 0; + li = requests.listIterator(); + while (li.hasNext()) { + request = (VMDeathRequest) li.next(); + if ( !request.isEnabled() ) { + flag++; + if (flag > 1) { + testExitCode = FAILED; + log3("ERROR: # of disabled requests > 1 : " + flag); + } + if ( !request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, disabled is request expected to be enabled : # == " + i1); + } + } else { + if ( request.getProperty("number").equals(String.valueOf(i1)) ) { + testExitCode = FAILED; + log3("ERROR: in the List, enabled is newly created disabled request : # == " + i1); + } + } + } + + log2(" enabling created VMDeathRequest"); + vmRequests[i1].enable(); + requests = eventRManager.vmDeathRequests(); + listSize = requests.size(); + if ( listSize != (i1 + 1) ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + (i1 + 1)); + } + + li = requests.listIterator(); + while (li.hasNext()) { + request = (VMDeathRequest) li.next(); + if ( !request.isEnabled() ) { + testExitCode = FAILED; + log3("ERROR: returned List contains disabled request : " + request); + } + } + + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i1); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + log2("......deleting VMDeathRequests"); + for (int i2 = vmRequests.length -1; i2 >= 0; i2--) { + eventRManager.deleteEventRequest(vmRequests[i2]); + requests = eventRManager.vmDeathRequests(); + listSize = requests.size(); + if ( listSize != i2 ) { + testExitCode = FAILED; + log3("ERROR: size of returned List is not equal to expected : " + listSize + " != " + i2); + } + log2(" removing item from the List; UnsupportedOperationException is expected"); + try { + requests.remove(i2); + testExitCode = FAILED; + log3("ERROR: NO exception"); + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException "); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001/TestDescription.java new file mode 100644 index 00000000000..74b16c92364 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001/TestDescription.java @@ -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/EventRequestManager/vmDeathRequests/vmdeathreq001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventRequestManager. + * The test checks up that a result of the method + * com.sun.jdi.EventRequestManager.vmDeathRequests() + * complies with its spec: + * The test works as follows: + * The debugger program - nsk.jdi.EventRequestManager.vmDeathRequests.vmdeathreq001; + * the debuggee program - nsk.jdi.EventRequestManager.vmDeathRequests.vmdeathreq001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventRequestManager.vmDeathRequests.vmdeathreq001 + * nsk.jdi.EventRequestManager.vmDeathRequests.vmdeathreq001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventRequestManager.vmDeathRequests.vmdeathreq001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001a.java new file mode 100644 index 00000000000..7095403ef4b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/vmDeathRequests/vmdeathreq001a.java @@ -0,0 +1,111 @@ +/* + * 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.EventRequestManager.vmDeathRequests; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the vmdeathreq001 JDI test. + */ + +public class vmdeathreq001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001.java new file mode 100644 index 00000000000..a336bf093b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001.java @@ -0,0 +1,499 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.eventIterator()
    + * complies with its spec.
    + *
    + * The test checks that for ClassPrepareEvent set
    + * - the method returns a non-null object, and
    + * - object's class is the subclass of class Iterator.
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent,
    + * the debugger sets up two requests, both with SUSPEND_EVENT_THREAD,
    + * one for debuggee's ClassPrepareEvent,
    + * another one for a special TestClass, resumes the VM,
    + * and waits for the events within the predefined time interval.
    + * If no the events received, the test is FAILED.
    + * Upon getting the debuggeeClass's ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + * Upon getting TestClass's ClassPrepareEvent,
    + * the debugger performs the check.
    + *
    + * At the end the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both ends.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class eventiterator001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/eventIterator/eventiterator001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new eventiterator001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.eventIterator.eventiterator001a"; + + private String testedClassName = + "nsk.jdi.EventSet.eventIterator.eventiterator001aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.putProperty("number", "debuggeeClass"); + cpRequest.enable(); + + ClassPrepareRequest tcRequest = settingClassPrepareRequest(testedClassName, + EventRequest.SUSPEND_EVENT_THREAD, + "TestClassPrepareRequest"); + tcRequest.enable(); + + int nn1 = 0; + int nn2 = 0; + for (int nn = 0; nn < 2; nn++) { + + vm.resume(); + getEventSet(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + + log2("String property = (String) event.request().getProperty('number');"); + String property = (String) event.request().getProperty("number"); + + if (property.equals("debuggeeClass")) { + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + nn1++; + if (nn1 > 1) + throw new JDITestRuntimeException("** 2-nd event for debuggeeClass **"); + + cpRequest.disable(); + debuggeeClass = event.referenceType(); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + } else if (property.equals("TestClassPrepareRequest")) { + nn2++; + if (nn2 > 1) + throw new JDITestRuntimeException("** 2-nd event for TestClass **"); + + if (eventIterator == null) { + testExitCode = FAILED; + log3("ERROR: eventIterator == null"); + } + if ( !(eventIterator instanceof Iterator) ) { + testExitCode = FAILED; + log3("ERROR: eventIterator is NOT instanceof Iterator"); + } + } else { + log3("ERROR: unexpected Event : property == " + property); + throw new JDITestRuntimeException("** UNEXPECTED Event **"); + } + } + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction != 0) { + throw new JDITestRuntimeException("** instruction != 0 **"); + } + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ClassPrepareRequest settingClassPrepareRequest ( String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ClassPrepareRequest:"); + log2(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + log2(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingClassPrepareRequest() : " + e); + log3(" ClassPreparenRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ClassPrepareRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001/TestDescription.java new file mode 100644 index 00000000000..c86c1fc924a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001/TestDescription.java @@ -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/EventSet/eventIterator/eventiterator001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.eventIterator() + * complies with its spec: + * public EventIterator eventIterator() + * Return an iterator specific to Event objects. + * The test checks that for ClassPrepareEvent set + * - the method returns a non-null object, and + * - object's class is the subclass of class Iterator. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.eventIterator.eventiterator001; + * the debuggee program - nsk.jdi.EventSet.eventIterator.eventiterator001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.eventIterator.eventiterator001 + * nsk.jdi.EventSet.eventIterator.eventiterator001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.eventIterator.eventiterator001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001a.java new file mode 100644 index 00000000000..eb54181d51d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator001a.java @@ -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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the eventiterator001 JDI test. + */ + +public class eventiterator001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + eventiterator001aTestClass tcObject = new eventiterator001aTestClass(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} + +class eventiterator001aTestClass { + static int var1 = 0; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002.java new file mode 100644 index 00000000000..1a4c36be045 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002.java @@ -0,0 +1,710 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.eventIterator()
    + * complies with its spec.
    + *
    + * The test checks that for each type of the following Events:
    + * AccessWatchpoint, ModificationWatchpoint, Breakpoint,
    + * Exception, MethodEntry, MethodExit, and Step,
    + * - the method returns non-null object, and
    + * - object's class is subclass of class Iterator.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase the debugger and debuggee perform the following loop.
    + * - The debugger creates new Request, resumes the debuggee, and
    + * waits for corresponding Event.
    + * - The debuggee performes an action resulting in Event required.
    + * - Upon getting the Event, the debugger checks up on EventSet.
    + *
    + * In third phase, at the end
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class eventiterator002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/eventIterator/eventiterator002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new eventiterator002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.eventIterator.eventiterator002a"; + + private String testedClassName = + "nsk.jdi.EventSet.eventIterator.eventiterator002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + String accWatchpointName = "var1"; + String modWatchpointName = "var2"; + String bpLineName = "breakpointLine"; + String bpMethodName = "method"; + String awFieldName = "awFieldName"; + String mwFieldName = "mwFieldName"; + String excName = "method"; + String menName = "method"; + String mexName = "method"; + + EventRequest eRequest = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0);"); + ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0); + + switch (i) { + + case 0: + eRequest = null; + if (vm.canWatchFieldAccess()) { + String awName = ( (StringReference) testClass.getValue( + testClass.fieldByName(awFieldName))).value(); + eRequest = settingAccessWatchpointRequest(mainThread, + testClass, awName, "AccessWatchpointRequest"); + eRequest.enable(); + } + break; + + case 1: + eRequest = null; + if (vm.canWatchFieldModification() ) { + String mwName = ( (StringReference) testClass.getValue( + testClass.fieldByName(mwFieldName))).value(); + eRequest = settingModificationWatchpointRequest(mainThread, + testClass, mwName, "ModificationWatchpointRequest"); + eRequest.enable(); + } + break; + + case 2: + eRequest = settingBreakpointRequest(mainThread, testClass, + bpMethodName, bpLineName, + EventRequest.SUSPEND_EVENT_THREAD, "BreakpointRequest"); + eRequest.enable(); + break; + + case 3: + eRequest = settingExceptionRequest(mainThread, testClass, + "ExceptionRequest"); + eRequest.enable(); + break; + + case 4: + eRequest = settingMethodEntryRequest(mainThread, testClass, + "MethodEntryRequest"); + eRequest.enable(); + break; + + case 5: + eRequest = settingMethodExitRequest(mainThread, testClass, + "MethodExitRequest"); + eRequest.enable(); + break; + + case 6: + eRequest = settingStepRequest(mainThread, "StepRequest"); + eRequest.enable(); + break; + } + + // see setting up Acceess&Modification requests above + if (eRequest == null) + continue; + + log2("......getting new Event and checking up on EventIterator"); + vm.resume(); + getEventSet(); + eRequest.disable(); + + if (eventIterator == null) { + testExitCode = FAILED; + log3("ERROR: eventIterator == null"); + } + if ( !(eventIterator instanceof Iterator) ) { + testExitCode = FAILED; + log3("ERROR: eventIterator is NOT instanceof Iterator"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest settingAccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + awr.addThreadFilter(thread); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + + private ModificationWatchpointRequest settingModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + mwr = eventRManager.createModificationWatchpointRequest(field); + mwr.putProperty("number", property); + mwr.addThreadFilter(thread); + + log2(" ModificationWatchpointRequest has been set up"); + return mwr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + + private BreakpointRequest settingBreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + + private MethodEntryRequest settingMethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + + private MethodExitRequest settingMethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + mexr = eventRManager.createMethodExitRequest(); + mexr.putProperty("number", property); + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + + log2(" MethodExitRequest has been set up"); + return mexr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + + private StepRequest settingStepRequest ( ThreadReference thread, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + str.putProperty("number", property); + str.addCountFilter(1); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + + private ExceptionRequest settingExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002/TestDescription.java new file mode 100644 index 00000000000..f314b65fd2c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002/TestDescription.java @@ -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/EventSet/eventIterator/eventiterator002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.eventIterator() + * complies with its spec: + * public EventIterator eventIterator() + * Return an iterator specific to Event objects. + * The test checks that for each type of the following Events: + * AccessWatchpoint, ModificationWatchpoint, Breakpoint, + * Exception, MethodEntry, MethodExit, and Step, + * - the method returns non-null object, and + * - object's class is subclass of class Iterator. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.eventIterator.eventiterator002; + * the debuggee program - nsk.jdi.EventSet.eventIterator.eventiterator002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.eventIterator.eventiterator002 + * nsk.jdi.EventSet.eventIterator.eventiterator002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.eventIterator.eventiterator002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002a.java new file mode 100644 index 00000000000..e1879b5b621 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator002a.java @@ -0,0 +1,170 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the eventiterator002 JDI test. + */ + +public class eventiterator002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static eventiterator002aTestClass tcObject = new eventiterator002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); // TestClass is already prepared + + eventiterator002aTestClass.method(); + methodForCommunication(); + break; + + case 1: + eventiterator002aTestClass.method(); + methodForCommunication(); + break; + + case 2: + eventiterator002aTestClass.method(); + methodForCommunication(); + break; + + case 3: + eventiterator002aTestClass.method(); + methodForCommunication(); + break; + + case 4: + eventiterator002aTestClass.method(); + methodForCommunication(); + break; + + case 5: + eventiterator002aTestClass.method(); + methodForCommunication(); + break; + + case 6: + eventiterator002aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits!"); + System.exit(exitCode + PASS_BASE); + } +} + +class eventiterator002aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void nullMethod() { + throw new NullPointerException("++ nullMethod ++"); + } + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + nullMethod(); + } catch ( NullPointerException e ) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003.java new file mode 100644 index 00000000000..7dd013c5bb1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003.java @@ -0,0 +1,521 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.eventIterator()
    + * complies with its spec.
    + *
    + * The test checks that for ThreadStartEvent and
    + * ThreadDeathEvent sets:
    + * - the method returns non-null object;
    + * - object's class is subclass of class Iterator.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase the debugger and the debuggee perform the following.
    + * - The debugger creates ThreadStartRequest,resumes the debuggee, and
    + * waits for corresponding ThreadStartEvent.
    + * - The debuggee starts new thread, named "thread2",
    + * whose running creates the needed events.
    + * - Upon getting the ThreadStartEvent, the debugger checks up on it,
    + * creates ThreadDeathRequest, resumes the debuggee, and
    + * waits for corresponding ThreadDeathEvent.
    + * Upon getting the ThreadDeathEvent, the debugger checks up on it.
    + *
    + * In third phase, the debugger and the debuggee end.
    + *
    + */ + +public class eventiterator003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String sHeader1 = "\n==> nsk/jdi/EventSet/eventIterator/eventiterator003 ", + sHeader2 = "--> debugger: ", sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main(String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run(String argv[], PrintStream out) { + + int exitCode = new eventiterator003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = "nsk.jdi.EventSet.eventIterator.eventiterator003a"; + + private String testedClassName = "nsk.jdi.EventSet.eventIterator.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager = null; + + static EventQueue eventQueue = null; + + static EventSet eventSet = null; + + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis(String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch (Exception e) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0: + log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + status + " == PASS_BASE"); + } + break; + + default: + log3("ERROR: runTest() returned unexpected value"); + + case 1: + log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch (Exception e) { + log3("ERROR: Exception : e"); + } + break; + + case 2: + log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch (Exception e) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + + if (!(eventIterator.nextEvent() instanceof VMDeathEvent)) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + + if (!(eventIterator.nextEvent() instanceof VMDisconnectEvent)) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch (VMDisconnectedException e) { + log3("ERROR: VMDisconnectedException : " + e); + e.printStackTrace(logHandler.getOutStream()); + return 2; + } catch (Exception e) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, debuggeeClass, bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + String thread2Name = "thread2"; + + EventRequest eRequest = null; + + label0: { + + vm.resume(); + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ThreadReference tr = (ThreadReference) debuggeeClass.getValue(debuggeeClass.fieldByName(thread2Name)); + + log2("......setting up ThreadStartRequest"); + eRequest = settingThreadStartRequest(tr, EventRequest.SUSPEND_EVENT_THREAD, "ThreadStartRequest"); + eRequest.enable(); + vm.resume(); + log2("......getting EventSet"); + getEventSet(); + eRequest.disable(); + + String str = (String) eventIterator.nextEvent().request().getProperty("number"); + if (!str.equals("ThreadStartRequest")) { + testExitCode = FAILED; + log3("ERROR: new event doesn't corresponds to ThreadStartRequest required"); + break label0; + } + + log2("......checking up on EventIterator"); + if (eventIterator == null) { + testExitCode = FAILED; + log3("ERROR: eventIterator == null"); + } + if (!(eventIterator instanceof Iterator)) { + testExitCode = FAILED; + log3("ERROR: eventIterator is NOT instanceof Iterator"); + } + + log2("......setting up ThreadDeathRequest"); + // suspend policy 'SUSPEND_ALL' should be used for ThreadDeathRequest (see 6609499) + eRequest = settingThreadDeathRequest(tr, EventRequest.SUSPEND_ALL, "ThreadDeathRequest"); + eRequest.enable(); + eventSet.resume(); + log2("......getting EventSet"); + getEventSet(); + eRequest.disable(); + + str = (String) eventIterator.nextEvent().request().getProperty("number"); + if (!str.equals("ThreadDeathRequest")) { + testExitCode = FAILED; + log3("ERROR: new event doesn't corresponds to ThreadDeathRequest required"); + break label0; + } + + log2("......checking up on EventIterator"); + if (eventIterator == null) { + testExitCode = FAILED; + log3("ERROR: eventIterator == null"); + } + if (!(eventIterator instanceof Iterator)) { + testExitCode = FAILED; + log3("ERROR: eventIterator is NOT instanceof Iterator"); + } + + eventSet.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext();) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint(ThreadReference thread, ReferenceType testedClass, String methodName, + String bpLine, String property) throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = ((IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine))).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + } catch (Exception e1) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch (Exception e2) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + private void getEventSet() throws JDITestRuntimeException { + try { + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + private void breakpointForCommunication() throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadStartRequest settingThreadStartRequest(ThreadReference thread, int suspendPolicy, String property) + throws JDITestRuntimeException { + try { + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + tsr.addThreadFilter(thread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch (Exception e) { + log3("ERROR: ATTENTION: Exception within settingThreadStartRequest() : " + e); + log3(" ThreadStartRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadStartRequest **"); + } + } + + private ThreadDeathRequest settingThreadDeathRequest(ThreadReference thread, int suspendPolicy, String property) + throws JDITestRuntimeException { + try { + ThreadDeathRequest tdr = eventRManager.createThreadDeathRequest(); + tdr.addThreadFilter(thread); + tdr.addCountFilter(1); + tdr.setSuspendPolicy(suspendPolicy); + tdr.putProperty("number", property); + return tdr; + } catch (Exception e) { + log3("ERROR: ATTENTION: Exception within settingThreadDeathRequest() : " + e); + log3(" ThreadDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadDeathRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003/TestDescription.java new file mode 100644 index 00000000000..36747b69c1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003/TestDescription.java @@ -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/EventSet/eventIterator/eventiterator003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.eventIterator() + * complies with its spec: + * public EventIterator eventIterator() + * Return an iterator specific to Event objects. + * The test checks that for ThreadStartEvent and ThreadDeathEvent sets: + * - the method returns non-null object, and + * - object's class is subclass of class Iterator. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.eventIterator.eventiterator003; + * the debuggee program - nsk.jdi.EventSet.eventIterator.eventiterator003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.eventIterator.eventiterator003 + * nsk.jdi.EventSet.eventIterator.eventiterator003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.eventIterator.eventiterator003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003a.java new file mode 100644 index 00000000000..5dbdfb5e23c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator003a.java @@ -0,0 +1,129 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the eventiterator003 JDI test. + */ + +public class eventiterator003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + + static int end = 0; + + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + + //---------------------------------------------------- main method + + public static void main(String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + thread2 = new Thread2eventiterator003a("thread2"); + methodForCommunication(); + + threadStart(thread2); + try { + thread2.join(); + } catch (InterruptedException e) { + } + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch (Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e); + return FAILED; + } + } + return PASSED; + } + + static class Thread2eventiterator003a extends Thread { + + public Thread2eventiterator003a(String threadName) { + super(threadName); + } + + public void run() { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004.java new file mode 100644 index 00000000000..ac9476da7c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004.java @@ -0,0 +1,486 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.eventIterator()
    + * complies with its spec.
    + *
    + * The test checks that for VMStart, VMDeath, and
    + * VMDisconnect Events:
    + * - the method returns non-null object, and
    + * - object's class is subclass of class Iterator.
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it checks up on the method and
    + * sets up the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + *
    + * The debugger then resumes the debuggee which will normally end
    + * that will result in VMDeathEvent and waits for the event.
    + * Upon getting the VMDeathEvent, it checks up on the method and
    + * waits for VMDisconnectEvent, and upon getting it, checks up on this.
    + *
    + */ + +public class eventiterator004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/eventIterator/eventiterator004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new eventiterator004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.eventIterator.eventiterator004a"; + + private String testedClassName = + "nsk.jdi.EventSet.eventIterator.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + // Event #: + // 0-6 : AccessWatchpoint, ModificationWatchpoint, Breakpoint, Exception, + // MethodEntry, MethodExit, Step + // 7-8 : ClassPrepare, ClassUnload + // 9-10 : ThreadDeath, ThreadStart + // 11-13 : VMDeath, VMDisconnect, VMStart + + EventSet eventSets[] = new EventSet [14]; + EventRequest eRequests[] = new EventRequest[14]; + + int eventFlags[] = { 0,0,0,0, 0,0,0,0, 3,0,0,0, 1,1 }; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugeeNoWait(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugeeNoWait(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + log2("waiting for VMStartEvent"); + getEventSet(); + check(); + + + if (eventIterator.nextEvent() instanceof VMStartEvent) { + log2("VMStartEvent received; test begins"); + + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + check(); + + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + check(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + } else { + log3("ERROR: first event is not the VMStartEvent"); + return 1; + } + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + log2("......setting up ClassPrepareRequest"); + eRequests[7] = cpRequest; + + cpRequest.enable(); + vm.resume(); + + getEventSet(); + eventSets[7] = eventSet; + + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private void check() { + + log2("......checking up on EventIterator"); + if (eventIterator == null) { + testExitCode = FAILED; + log3("ERROR: eventIterator == null"); + } + if ( !(eventIterator instanceof Iterator) ) { + testExitCode = FAILED; + log3("ERROR: eventIterator is NOT instanceof Iterator"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004/TestDescription.java new file mode 100644 index 00000000000..ed73879b4ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/eventIterator/eventiterator004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.eventIterator() + * complies with its spec: + * public EventIterator eventIterator() + * Return an iterator specific to Event objects. + * The test checks that for VMStart, VMDeath, and VMDisconnect Events: + * - the method returns non-null object, and + * - object's class is subclass of class Iterator. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.eventIterator.eventiterator004; + * the debuggee program - nsk.jdi.EventSet.eventIterator.eventiterator004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - binder.bindToDebugeeNoWait() is used to prevent Binder from + * handling VMStartEvent + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.eventIterator.eventiterator004 + * nsk.jdi.EventSet.eventIterator.eventiterator004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.eventIterator.eventiterator004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004a.java new file mode 100644 index 00000000000..e6646966593 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/eventIterator/eventiterator004a.java @@ -0,0 +1,106 @@ +/* + * 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.EventSet.eventIterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the eventiterator004 JDI test. + */ + +public class eventiterator004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java new file mode 100644 index 00000000000..45cad0aaef4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java @@ -0,0 +1,265 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import static nsk.share.Consts.TEST_FAILED; + +/** + * The test for the implementation of an object of the type + * EventSet. + * + * The test checks that results of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec. + * + * Test cases include all three possible suspensions, NONE, + * EVENT_THREAD, and ALL, for ClassPrepareEvent sets. + * + * To check up on the method, a debugger, + * upon getting new set for ClassPrepareEvent, + * suspends VM with the method VirtualMachine.suspend(), + * gets the List of geduggee's threads calling VM.allThreads(), + * invokes the method EventSet.resume(), and + * gets another List of geduggee's threads. + * The debugger then compares values of + * each thread's suspendCount from first and second Lists. + * + * The test works as follows. + * - The debugger resumes the debuggee and + * waits for the ClassPrepareEvents. + * - The debuggee creates three threads, running one by one and + * making special clases loaded and prepared to create the Events + * - Upon getting the Events, + * the debugger performs the check required. + */ + +public class resume001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.EventSet.resume.resume001a"; + return new resume001().runThis(argv, out); + } + + protected void testRun() { + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + String classNames[] = { + "nsk.jdi.EventSet.resume.TestClass2", + "nsk.jdi.EventSet.resume.TestClass3", + "nsk.jdi.EventSet.resume.TestClass4", + }; + + EventRequest eventRequest; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest = settingClassPrepareRequest(classNames[0], + SUSPEND_NONE, "ClassPrepareRequest0"); + break; + + case 1: + eventRequest = settingClassPrepareRequest(classNames[1], + SUSPEND_THREAD, "ClassPrepareRequest1"); + break; + + case 2: + eventRequest = settingClassPrepareRequest(classNames[2], + SUSPEND_ALL, "ClassPrepareRequest2"); + break; + + + default: + throw new Failure("** default case 2 **"); + } + + display("......waiting for new ClassPrepareEvent : " + i); + EventSet eventSet = eventHandler.waitForRequestedEventSet(new EventRequest[]{eventRequest}, waitTime, true); + + EventIterator eventIterator = eventSet.eventIterator(); + Event newEvent = eventIterator.nextEvent(); + + if ( !(newEvent instanceof ClassPrepareEvent)) { + setFailedStatus("ERROR: new event is not ClassPreparedEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ClassPrepareEvent with propety 'number' == " + property); + + display("......checking up on EventSet.resume()"); + display("......--> vm.suspend();"); + vm.suspend(); + + display(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + display(suspendsCounts1.toString()); + + display(" eventSet.resume;"); + eventSet.resume(); + + display(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + display(suspendsCounts2.toString()); + + display(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + display(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + display(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_THREAD : + display(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((ClassPrepareEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_ALL : + + display(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + + if (!newEvent.request().equals(eventRequest)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + default: throw new Failure("** default case 1 **"); + } + } + + display("......--> vm.resume()"); + vm.resume(); + } + return; + } + + private ClassPrepareRequest settingClassPrepareRequest ( String testedClass, + int suspendPolicy, + String property ) + throws Failure { + try { + display("......setting up ClassPrepareRequest:"); + display(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + display(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001/TestDescription.java new file mode 100644 index 00000000000..15c2750af4b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001/TestDescription.java @@ -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/EventSet/resume/resume001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three ClassPrepareEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume001; + * the debuggee program - nsk.jdi.EventSet.resume.resume001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.resume.resume001 + * nsk.jdi.EventSet.resume.resume001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java new file mode 100644 index 00000000000..da96c913ec3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java @@ -0,0 +1,134 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume001 JDI test. + */ + +public class resume001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + TestClass2 obj2 = new TestClass2(); + break; + + case 1: + TestClass3 obj3 = new TestClass3(); + break; + + case 2: + TestClass4 obj4 = new TestClass4(); +//------------------------------------------------- standard end section + + default: + instruction = end; + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class TestClass2 { + static int var1 = 0; +} + +class TestClass3 { + static int var1 = 0; +} + +class TestClass4 { + static int var1 = 0; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java new file mode 100644 index 00000000000..fe456247eca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java @@ -0,0 +1,646 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for AccessWatchpointEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a AccessWatchpointRequest, resumes
    + * the debuggee, and waits for the AccessWatchpointEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume002a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "AccessWatchpointRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "AccessWatchpointRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "AccessWatchpointRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new AccessWatchpointEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof AccessWatchpointEvent)) { + log3("ERROR: new event is not AccessWatchpointEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new AccessWatchpointEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD : + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((AccessWatchpointEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL : + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + default: throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest settingAccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002/TestDescription.java new file mode 100644 index 00000000000..08e73ba6c9a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/resume/resume002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three AccessWatchpointEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume002; + * the debuggee program - nsk.jdi.EventSet.resume.resume002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume002 + * nsk.jdi.EventSet.resume.resume002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java new file mode 100644 index 00000000000..fe219b453a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java @@ -0,0 +1,138 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume002 JDI test. + */ + +public class resume002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume002aTestClass tcObject = new resume002aTestClass(); + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume002aTestClass.method(); + break; + + case 1: resume002aTestClass.method(); + break; + + case 2: resume002aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class resume002aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java new file mode 100644 index 00000000000..0b985421c6f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java @@ -0,0 +1,646 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for ModificationWatchpointEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a ModificationWatchpointRequest, resumes
    + * the debuggee, and waits for the ModificationWatchpointEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume003a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldModification() ) { + log2("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "ModificationWatchpointRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "ModificationWatchpointRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "ModificationWatchpointRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new ModificationWatchpointEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + log3("ERROR: new event is not ModificationWatchpointEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new ModificationWatchpointEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD : + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((ModificationWatchpointEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL : + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + default: throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest settingModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003/TestDescription.java new file mode 100644 index 00000000000..b5b7404cedb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/resume/resume003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three ModificationWatchpointEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume003; + * the debuggee program - nsk.jdi.EventSet.resume.resume003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume003 + * nsk.jdi.EventSet.resume.resume003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java new file mode 100644 index 00000000000..2bb0df34fc1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java @@ -0,0 +1,138 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume003 JDI test. + */ + +public class resume003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume003aTestClass tcObject = new resume003aTestClass(); + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume003aTestClass.method(); + break; + + case 1: resume003aTestClass.method(); + break; + + case 2: resume003aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class resume003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java new file mode 100644 index 00000000000..3f185107ea7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java @@ -0,0 +1,642 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for BreakpointEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a BreakpointRequest, resumes
    + * the debuggee, and waits for the BreakpointEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume004a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume004aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_NONE, "BreakpointRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_THREAD, "BreakpointRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_ALL, "BreakpointRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new BreakpointEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof BreakpointEvent)) { + log3("ERROR: new event is not BreakpointEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new BreakpointEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD : + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((BreakpointEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL : + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + default: throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest settingBreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004/TestDescription.java new file mode 100644 index 00000000000..f0dba7f7836 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/resume/resume004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three BreakpointEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume004; + * the debuggee program - nsk.jdi.EventSet.resume.resume004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume004 + * nsk.jdi.EventSet.resume.resume004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java new file mode 100644 index 00000000000..56712b489b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java @@ -0,0 +1,138 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume004 JDI test. + */ + +public class resume004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume004aTestClass tcObject = new resume004aTestClass(); + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume004aTestClass.method(); + break; + + case 1: resume004aTestClass.method(); + break; + + case 2: resume004aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class resume004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java new file mode 100644 index 00000000000..0705c3929ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java @@ -0,0 +1,638 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for ExceptionEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a ExceptionRequest, resumes
    + * the debuggee, and waits for the ExceptionEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume005a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume005aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingExceptionRequest (mainThread, + debuggeeClass, // testClassReference, + SUSPEND_NONE, "ExceptionRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingExceptionRequest (mainThread, + debuggeeClass, // testClassReference, + SUSPEND_THREAD, "ExceptionRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingExceptionRequest (mainThread, + debuggeeClass, // testClassReference, + SUSPEND_ALL, "ExceptionRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new ExceptionEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof ExceptionEvent)) { + log3("ERROR: new event is not ExceptionEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new ExceptionEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD : + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((ExceptionEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL : + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + default: throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest settingExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005/TestDescription.java new file mode 100644 index 00000000000..fb4c682b8a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005/TestDescription.java @@ -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/EventSet/resume/resume005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three ExceptionEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume005; + * the debuggee program - nsk.jdi.EventSet.resume.resume005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Fixed due to the bug 4528893. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.resume.resume005 + * nsk.jdi.EventSet.resume.resume005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java new file mode 100644 index 00000000000..bdd8b54d1b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java @@ -0,0 +1,148 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume005 JDI test. + */ + +public class resume005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume005aTestClass tcObject = new resume005aTestClass(); + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume005aTestClass.method(); + break; + + case 1: resume005aTestClass.method(); + break; + + case 2: resume005aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class resume005aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + resume005a.nullMethod(); + } catch ( NullPointerException e ) { +// suspendpolicy005a.log3(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java new file mode 100644 index 00000000000..ba2b22abaa0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java @@ -0,0 +1,636 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for MethodEntryEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a MethodEntryRequest, resumes
    + * the debuggee, and waits for the MethodEntryEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume006 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume006 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume006().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume006a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume006aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodEntryRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodEntryRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodEntryRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new MethodEntryEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof MethodEntryEvent)) { + log3("ERROR: new event is not MethodEntryEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new MethodEntryEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD : + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = event.thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL : + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + + default: throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest settingMethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006/TestDescription.java new file mode 100644 index 00000000000..c6e5bdbb365 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/resume/resume006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three MethodEntryEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume006; + * the debuggee program - nsk.jdi.EventSet.resume.resume006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume006 + * nsk.jdi.EventSet.resume.resume006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java new file mode 100644 index 00000000000..ab7677e13fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java @@ -0,0 +1,139 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume006 JDI test. + */ + +public class resume006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume006aTestClass tcObject = new resume006aTestClass(); + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume006aTestClass.method(); + break; + + case 1: resume006aTestClass.method(); + break; + + case 2: resume006aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + +} + +class resume006aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java new file mode 100644 index 00000000000..ced07a24a09 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java @@ -0,0 +1,635 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for MethodExitEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a MethodExitRequest, resumes
    + * the debuggee, and waits for the MethodExitEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume007 { + + //----------------------------------------------------- templete section + static final int PASSED = Consts.TEST_PASSED; + static final int FAILED = Consts.TEST_FAILED; + static final int PASS_BASE = Consts.JCK_STATUS_BASE; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume007 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume007().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume007a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume007aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodExitRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodExitRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodExitRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new MethodExitEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof MethodExitEvent)) { + log3("ERROR: new event is not MethodExitEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new MethodExitEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD : + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = event.thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL : + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + default: throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest settingMethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + mexr = eventRManager.createMethodExitRequest(); + mexr.putProperty("number", property); + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + mexr.setSuspendPolicy(suspendPolicy); + + log2(" MethodExitRequest has been set up"); + return mexr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007/TestDescription.java new file mode 100644 index 00000000000..793b1a457c0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/resume/resume007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three MethodExitEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume007; + * the debuggee program - nsk.jdi.EventSet.resume.resume007a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume007 + * nsk.jdi.EventSet.resume.resume007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java new file mode 100644 index 00000000000..a70a4e80246 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java @@ -0,0 +1,139 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume007 JDI test. + */ + +public class resume007a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume007aTestClass tcObject = new resume007aTestClass(); + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume007aTestClass.method(); + break; + + case 1: resume007aTestClass.method(); + break; + + case 2: resume007aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + +} + +class resume007aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java new file mode 100644 index 00000000000..c011dcd7974 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java @@ -0,0 +1,258 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import static nsk.share.Consts.TEST_FAILED; + +/** + * The test for the implementation of an object of the type + * EventSet. + * + * The test checks that results of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec. + * + * Test cases include all three possible suspensions, NONE, + * EVENT_THREAD, and ALL, for ThreadStartEvent sets. + * + * To check up on the method, a debugger, + * upon getting new set for the EventSet, + * suspends VM with the method VirtualMachine.suspend(), + * gets the List of geduggee's threads calling VM.allThreads(), + * invokes the method EventSet.resume(), and + * gets another List of geduggee's threads. + * The debugger then compares values of + * each thread's suspendCount from first and second Lists. + * + * The test works as follows. + * - The debugger sets up a ThreadStartRequest, resumes + * the debuggee, and waits for the ThreadStartEvent. + * - The debuggee creates and starts new thread + * to be resulting in the event. + * - Upon getting new event, the debugger + * performs the check corresponding to the event. + */ + +public class resume008 extends TestDebuggerType1 { + + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.EventSet.resume.resume008a"; + return new resume008().runThis(argv, out); + } + + private String testedClassName = "nsk.jdi.EventSet.resume.TestClass"; + + + protected void testRun() { + + EventRequest eventRequest = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest = settingThreadStartRequest ( + SUSPEND_NONE, "ThreadStartRequest1"); + break; + + case 1: + eventRequest = settingThreadStartRequest ( + SUSPEND_THREAD, "ThreadStartRequest2"); + break; + + case 2: + eventRequest = settingThreadStartRequest ( + SUSPEND_ALL, "ThreadStartRequest3"); + break; + + + default: + throw new Failure("** default case 2 **"); + } + + display("......waiting for new ThreadStartEvent : " + i); + EventSet eventSet = eventHandler.waitForRequestedEventSet(new EventRequest[]{eventRequest}, waitTime, true); + + EventIterator eventIterator = eventSet.eventIterator(); + Event newEvent = eventIterator.nextEvent(); + + if ( !(newEvent instanceof ThreadStartEvent)) { + setFailedStatus("ERROR: new event is not ThreadStartEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ThreadStartEvent with propety 'number' == " + property); + + display("......checking up on EventSet.resume()"); + display("......--> vm.suspend();"); + vm.suspend(); + + display(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + display(suspendsCounts1.toString()); + + display(" eventSet.resume;"); + eventSet.resume(); + + display(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + display(suspendsCounts2.toString()); + + display(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE : + display(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + display(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_THREAD : + display(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((ThreadStartEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_ALL : + + display(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + + if (!newEvent.request().equals(eventRequest)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + default: throw new Failure("** default case 1 **"); + } + } + + display("......--> vm.resume()"); + vm.resume(); + } + return; + } + + private ThreadStartRequest settingThreadStartRequest(int suspendPolicy, + String property) { + try { + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ThreadStartRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008/TestDescription.java new file mode 100644 index 00000000000..91cde13bbb2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008/TestDescription.java @@ -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/EventSet/resume/resume008. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three ThreadStartEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume008; + * the debuggee program - nsk.jdi.EventSet.resume.resume008a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.resume.resume008 + * nsk.jdi.EventSet.resume.resume008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java new file mode 100644 index 00000000000..8f0790dfef7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java @@ -0,0 +1,168 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume008 JDI test. + */ + +public class resume008a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadresume008a thread0 = null; + static Threadresume008a thread1 = null; + static Threadresume008a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread0 = new Threadresume008a("thread0"); + methodForCommunication(); + + threadStart(thread0); + + thread1 = new Threadresume008a("thread1"); + methodForCommunication(); + break; + + case 1: + threadStart(thread1); + + thread2 = new Threadresume008a("thread2"); + methodForCommunication(); + break; + + case 2: + threadStart(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class Threadresume008a extends Thread { + + String tName = null; + + public Threadresume008a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java new file mode 100644 index 00000000000..5fbee4c1a35 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java @@ -0,0 +1,257 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import static nsk.share.Consts.TEST_FAILED; + +/** + * The test for the implementation of an object of the type + * EventSet. + * + * The test checks that results of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec. + * + * Test cases include all three possible suspensions, NONE, + * EVENT_THREAD, and ALL, for ThreadDeathEvent sets. + * + * To check up on the method, a debugger, + * upon getting new set for the EventSet, + * suspends VM with the method VirtualMachine.suspend(), + * gets the List of geduggee's threads calling VM.allThreads(), + * invokes the method EventSet.resume(), and + * gets another List of geduggee's threads. + * The debugger then compares values of + * each thread's suspendCount from first and second Lists. + * + * The test works as follows. + * - The debugger sets up a ThreadDeathRequest, resumes + * the debuggee, and waits for the ThreadDeathEvent. + * - The debuggee creates and starts new thread + * to be resulting in the event. + * - Upon getting new event, the debugger + * performs the check corresponding to the event. + */ + +public class resume009 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.EventSet.resume.resume009a"; + return new resume009().runThis(argv, out); + } + + private String testedClassName = "nsk.jdi.EventSet.resume.TestClass"; + + + protected void testRun() { + + EventRequest eventRequest = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest = settingThreadDeathRequest ( + SUSPEND_NONE, "ThreadDeathRequest1"); + break; + + case 1: + eventRequest = settingThreadDeathRequest ( + SUSPEND_THREAD, "ThreadDeathRequest2"); + break; + + case 2: + eventRequest = settingThreadDeathRequest ( + SUSPEND_ALL, "ThreadDeathRequest3"); + break; + + + default: + throw new Failure("** default case 2 **"); + } + + display("......waiting for new ThreadDeathEvent : " + i); + EventSet eventSet = eventHandler.waitForRequestedEventSet(new EventRequest[]{eventRequest}, waitTime, true); + + EventIterator eventIterator = eventSet.eventIterator(); + Event newEvent = eventIterator.nextEvent(); + + if ( !(newEvent instanceof ThreadDeathEvent)) { + setFailedStatus("ERROR: new event is not ThreadDeathEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ThreadDeathEvent with propety 'number' == " + property); + + display("......checking up on EventSet.resume()"); + display("......--> vm.suspend();"); + vm.suspend(); + + display(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + display(suspendsCounts1.toString()); + + display(" eventSet.resume;"); + eventSet.resume(); + + display(" getting : Map suspendsCounts2"); + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + display(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + display(suspendsCounts2.toString()); + + switch (policy) { + + case SUSPEND_NONE : + display(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + display(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_THREAD : + display(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((ThreadDeathEvent)newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_ALL : + + display(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + + if (!newEvent.request().equals(eventRequest)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + complain("ERROR: suspendCounts don't match for : " + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + default: throw new Failure("** default case 1 **"); + } + } + + display("......--> vm.resume()"); + vm.resume(); + } + return; + } + + private ThreadDeathRequest settingThreadDeathRequest(int suspendPolicy, + String property) { + try { + ThreadDeathRequest tsr = eventRManager.createThreadDeathRequest(); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ThreadDeathRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009/TestDescription.java new file mode 100644 index 00000000000..3fd35380f9e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009/TestDescription.java @@ -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/EventSet/resume/resume009. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three ThreadDeathEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume009; + * the debuggee program - nsk.jdi.EventSet.resume.resume009a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.resume.resume009 + * nsk.jdi.EventSet.resume.resume009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java new file mode 100644 index 00000000000..8b93e8a079f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java @@ -0,0 +1,175 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume009 JDI test. + */ + +public class resume009a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadresume009a thread0 = null; + static Threadresume009a thread1 = null; + static Threadresume009a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread0 = new Threadresume009a("thread0"); + methodForCommunication(); + + threadRun(thread0); + + thread1 = new Threadresume009a("thread1"); + methodForCommunication(); + break; + + case 1: + threadRun(thread1); + + thread2 = new Threadresume009a("thread2"); + methodForCommunication(); + break; + + case 2: + threadRun(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadRun(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr("Exception in threadRun : " + e ); + return FAILED; + } + } + try { + t.join(); + } catch ( InterruptedException e ) { + exitCode = FAILED; + logErr("InterruptedException in threadRun : " + e ); + return FAILED; + } + return PASSED; + } + + static class Threadresume009a extends Thread { + + String tName = null; + + public Threadresume009a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java new file mode 100644 index 00000000000..5940e5e9a4e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java @@ -0,0 +1,631 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test cases include all three possible suspensions, NONE,
    + * EVENT_THREAD, and ALL, for StepEvent sets.
    + *
    + * To check up on the method, a debugger,
    + * upon getting new set for the EventSet,
    + * suspends VM with the method VirtualMachine.suspend(),
    + * gets the List of geduggee's threads calling VM.allThreads(),
    + * invokes the method EventSet.resume(), and
    + * gets another List of geduggee's threads.
    + * The debugger then compares values of
    + * each thread's suspendCount from first and second Lists.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a StepRequest, resumes
    + * the debuggee, and waits for the StepEvent.
    + * - The debuggee invokes the special method
    + * to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class resume010 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume010 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume010().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume010a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.resume010aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = settingStepRequest (mainThread, + SUSPEND_NONE, "StepRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingStepRequest (mainThread, + SUSPEND_THREAD, "StepRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingStepRequest (mainThread, + + SUSPEND_ALL, "StepRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new StepEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + if ( !(newEvent instanceof StepEvent)) { + log3("ERROR: new event is not StepEvent"); + testExitCode = FAILED; + } else { + + String property = (String) newEvent.request().getProperty("number"); + log2(" got new StepEvent with propety 'number' == " + property); + + log2("......checking up on EventSet.resume()"); + log2("......--> vm.suspend();"); + vm.suspend(); + + log2(" getting : Map suspendsCounts1"); + + Map suspendsCounts1 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(" eventSet.resume;"); + eventSet.resume(); + + log2(" getting : Map suspendsCounts2"); + + Map suspendsCounts2 = new HashMap(); + for (ThreadReference threadReference : vm.allThreads()) { + suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + } + + log2(suspendsCounts1.toString()); + log2(suspendsCounts2.toString()); + + log2(" getting : int policy = eventSet.suspendPolicy();"); + int policy = eventSet.suspendPolicy(); + + switch (policy) { + + case SUSPEND_NONE: + + log2(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + log2(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest1.disable(); + break; + + case SUSPEND_THREAD: + + log2(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((StepEvent) newEvent).thread().name(); + int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest2.disable(); + break; + + case SUSPEND_ALL: + + log2(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + log2("checking " + threadName); + if (!event.request().equals(eventRequest3)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + log3("ERROR: couldn't get ThreadReference for " + threadName); + testExitCode = FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + log3("ERROR: suspendCounts don't match for : " + threadName); + log3("before resuming : " + count1); + log3("after resuming : " + count2); + testExitCode = FAILED; + break; + } + } + eventRequest3.disable(); + break; + + default: + throw new JDITestRuntimeException("** default case 1 **"); + } + } + + log2("......--> vm.resume()"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest settingStepRequest ( ThreadReference thread, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + str.putProperty("number", property); + str.addCountFilter(1); + str.setSuspendPolicy(suspendPolicy); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010/TestDescription.java new file mode 100644 index 00000000000..0d8894fd02b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/EventSet/resume/resume010. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on three StepEvent sets with suspendPolicy() + * NONE, EVENT_THREAD, and ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume010; + * the debuggee program - nsk.jdi.EventSet.resume.resume010a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume010 + * nsk.jdi.EventSet.resume.resume010a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume010 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java new file mode 100644 index 00000000000..d3a6a084fee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java @@ -0,0 +1,137 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume010 JDI test. + */ + +public class resume010a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static resume010aTestClass tcObject = new resume010aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: resume010aTestClass.method(); + break; + + case 1: resume010aTestClass.method(); + break; + + case 2: resume010aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class resume010aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011.java new file mode 100644 index 00000000000..4bbee554d30 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011.java @@ -0,0 +1,485 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test case includes SUSPEND_NONE for a VMDeathEvent set.
    + *
    + * The test has three phases and works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * Then to check the above,
    + * the debugger and the debuggee perform the following.
    + * - The debugger sets up a VMDeathRequest, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the VMDeathEvent.
    + * - Upon getting the event, the debugger performs the check.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class resume011 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume011 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume011().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume011a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; +// EventRequest eventRequest2 = null; +// EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest1 = settingVMDeathRequest ( SUSPEND_NONE, "VMDeathRequest1"); + eventRequest1.enable(); + + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.resume()"); + try { + log2(" eventSet.resume(); :: no Exception expected"); + eventSet.resume(); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011/TestDescription.java new file mode 100644 index 00000000000..7d8c1cbd122 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/EventSet/resume/resume011. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on VMDeathEvent set with suspendPolicy() NONE. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume011; + * the debuggee program - nsk.jdi.EventSet.resume.resume011a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume011 + * nsk.jdi.EventSet.resume.resume011a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume011 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011a.java new file mode 100644 index 00000000000..9cff7f41054 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume011a.java @@ -0,0 +1,106 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume011 JDI test. + */ + +public class resume011a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012.java new file mode 100644 index 00000000000..01aa01ccf23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012.java @@ -0,0 +1,489 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test case includes SUSPEND_THREAD for a VMDeathEvent set.
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * Then to check the above,
    + * the debugger and the debuggee perform the following.
    + * - The debugger sets up a VMDeathRequest, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the VMDeathEvent.
    + * - Upon getting the event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class resume012 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume012 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume012().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume012a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + +// EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; +// EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest2 = settingVMDeathRequest ( SUSPEND_THREAD, "VMDeathRequest2"); + eventRequest2.enable(); + + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + + log2("......checking up on EventSet.resume()"); + try { + log2(" eventSet.resume(); :: Exception expected: com.sun.jdi.InternalException: Inconsistent suspend policy"); + eventSet.resume(); + testExitCode = FAILED; + } catch ( Exception e ) { + log3("Expected exception : " + e); + log2(" vm.resume;"); + vm.resume(); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012/TestDescription.java new file mode 100644 index 00000000000..cedc665813b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/EventSet/resume/resume012. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on VMDeathEvent set with suspendPolicy() EVENT_THREAD. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume012; + * the debuggee program - nsk.jdi.EventSet.resume.resume012a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * nsk/jdi/EventSet/resume/resume012 fails intermittently on all platforms + * In case of this test when we force VMDeathEvent with suspend policy set to EVENT_THREAD + * eventSet.resume() produces an exception (com.sun.jdi.InternalException: Inconsistent suspend policy) + * while trying to resume some thread associated with this event. But VMDeathEvent doesn't have any + * associated thread. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.resume.resume012 + * nsk.jdi.EventSet.resume.resume012a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume012 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012a.java new file mode 100644 index 00000000000..93a23d8d659 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume012a.java @@ -0,0 +1,106 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume012 JDI test. + */ + +public class resume012a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013.java new file mode 100644 index 00000000000..502b9da8cf5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013.java @@ -0,0 +1,488 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.resume()
    + * complies with its spec.
    + *
    + * Test case includes SUSPEND_ALL for VMDeathEvent set.
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * Then to check the above,
    + * the debugger and the debuggee perform the following.
    + * - The debugger sets up a VMDeathRequest, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the VMDeathEvent.
    + * - Upon getting the event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + */ + +public class resume013 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume013 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new resume013().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.resume.resume013a"; + + private String testedClassName = + "nsk.jdi.EventSet.resume.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + +// EventRequest eventRequest1 = null; +// EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest3 = settingVMDeathRequest ( SUSPEND_ALL, "VMDeathRequest3"); + eventRequest3.enable(); + + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + + log2("......checking up on EventSet.resume()"); + try { + log2(" eventSet.resume(); :: no Exception expected"); + eventSet.resume(); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + log2(" vm.resume;"); + vm.resume(); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013/TestDescription.java new file mode 100644 index 00000000000..ef01c8c15a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/EventSet/resume/resume013. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.resume() + * complies with its spec: + * public void resume() + * Resumes threads suspended by this event set. + * If the suspendPolicy() is EventRequest.SUSPEND_ALL, + * a call to this method is equivalent to VirtualMachine.resume(). + * If the suspend policy is EventRequest.SUSPEND_EVENT_THREAD, + * a call to this method is equivalent to ThreadReference.resume() + * for the event thread. Otherwise, a call to this method is a no-op. + * The test checks up on VMDeathEvent set with suspendPolicy() ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.resume.resume013; + * the debuggee program - nsk.jdi.EventSet.resume.resume013a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.resume.resume013 + * nsk.jdi.EventSet.resume.resume013a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.resume.resume013 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013a.java new file mode 100644 index 00000000000..478e33f639c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume013a.java @@ -0,0 +1,106 @@ +/* + * 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.EventSet.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the resume013 JDI test. + */ + +public class resume013a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001.java new file mode 100644 index 00000000000..0d075163fd1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001.java @@ -0,0 +1,625 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a ClassPrepareEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + * The debugger then prepares an array containing sets of
    + * enabled requests for each combination to check.
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for ClassPrepareEvents.
    + * - The debuggee makes new checked classes prepared and invokes then
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the ClassPrepareEvents,
    + * the debugger performs the check required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + int classFlags = 0; + + String classNames[] = { + "nsk.jdi.EventSet.suspendPolicy.TestClass0", + "nsk.jdi.EventSet.suspendPolicy.TestClass1", + "nsk.jdi.EventSet.suspendPolicy.TestClass2", + "nsk.jdi.EventSet.suspendPolicy.TestClass3", + "nsk.jdi.EventSet.suspendPolicy.TestClass4", + "nsk.jdi.EventSet.suspendPolicy.TestClass5", + "nsk.jdi.EventSet.suspendPolicy.TestClass6" + }; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + EventRequest eventRequests[][] = new EventRequest[classNames.length][3]; + + for ( int nr = 0; nr < eventRequests.length; nr++) { + log2("......setting up ClassPrepareRequest for TestClass" + nr); + switch (nr) { + + case 0: + eventRequests[nr][0] = settingClassPrepareRequest(classNames[nr], + SUSPEND_NONE, "ClassPrepareRequest" + nr); + eventRequests[nr][0].enable(); + break; + + case 1: + eventRequests[nr][1] = settingClassPrepareRequest(classNames[nr], + SUSPEND_THREAD, "ClassPrepareRequest" + nr); + eventRequests[nr][1].enable(); + break; + + case 2: + eventRequests[nr][2] = settingClassPrepareRequest(classNames[nr], + SUSPEND_ALL, "ClassPrepareRequest" + nr); + eventRequests[nr][2].enable(); + break; + + case 3: + eventRequests[nr][0] = settingClassPrepareRequest(classNames[nr], + SUSPEND_NONE, "ClassPrepareRequest" + nr); + eventRequests[nr][0].enable(); + eventRequests[nr][1] = settingClassPrepareRequest(classNames[nr], + SUSPEND_THREAD, "ClassPrepareRequest" + nr); + eventRequests[nr][1].enable(); + break; + + case 4: + eventRequests[nr][0] = settingClassPrepareRequest(classNames[nr], + SUSPEND_NONE, "ClassPrepareRequest" + nr); + eventRequests[nr][0].enable(); + eventRequests[nr][2] = settingClassPrepareRequest(classNames[nr], + SUSPEND_ALL, "ClassPrepareRequest" + nr); + eventRequests[nr][2].enable(); + break; + + case 5: + eventRequests[nr][1] = settingClassPrepareRequest(classNames[nr], + SUSPEND_THREAD, "ClassPrepareRequest" + nr); + eventRequests[nr][1].enable(); + eventRequests[nr][2] = settingClassPrepareRequest(classNames[nr], + SUSPEND_ALL, "ClassPrepareRequest" + nr); + eventRequests[nr][2].enable(); + break; + + case 6: + eventRequests[nr][0] = settingClassPrepareRequest(classNames[nr], + SUSPEND_NONE, "ClassPrepareRequest" + nr); + eventRequests[nr][0].enable(); + eventRequests[nr][1] = settingClassPrepareRequest(classNames[nr], + SUSPEND_THREAD, "ClassPrepareRequest" + nr); + eventRequests[nr][1].enable(); + eventRequests[nr][2] = settingClassPrepareRequest(classNames[nr], + SUSPEND_ALL, "ClassPrepareRequest" + nr); + eventRequests[nr][2].enable(); + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + classFlags |= 1 << nr; + } + + log2("......checking up on eventSets"); + + vm.resume(); + + for (int ne = 0; ne < eventRequests.length; ne++) { + + getEventSet(); + + Event ev = eventIterator.nextEvent(); + if ( !( ev instanceof ClassPrepareEvent)) { + log3("ERROR: new event is not ClassPrepareEvent"); + testExitCode = FAILED; + break; + } + + String property = (String) ev.request().getProperty("number"); + + int np = 0; + for (; np < eventRequests.length; np++) { + if (property.equals("ClassPrepareRequest" + np)) + break; + } + + policy = eventSet.suspendPolicy(); + + if (policy != policyExpected[np]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[np]); + testExitCode = FAILED; + } + + switch (np) { + case 0: eventRequests[np][0].disable(); break; + case 1: eventRequests[np][1].disable(); break; + case 2: eventRequests[np][2].disable(); break; + case 3: eventRequests[np][0].disable(); eventRequests[np][1].disable(); break; + case 4: eventRequests[np][0].disable(); eventRequests[np][2].disable(); break; + case 5: eventRequests[np][1].disable(); eventRequests[np][2].disable(); break; + case 6: eventRequests[np][0].disable(); eventRequests[np][1].disable(); + eventRequests[np][2].disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 1 **"); + } + classFlags &= 1 << ne; + } + if (classFlags != 0) { + log3("ERROR: not all events received : " + classFlags); + testExitCode = FAILED; + } + + for (int i = 0; ; i++) { + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ClassPrepareRequest settingClassPrepareRequest ( String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ClassPrepareRequest:"); + log2(" class: " + testedClass + "; property: " + property); + + ClassPrepareRequest + cpr = eventRManager.createClassPrepareRequest(); + cpr.putProperty("number", property); + cpr.addClassFilter(testedClass); + cpr.setSuspendPolicy(suspendPolicy); + + log2(" ClassPrepareRequest has been set up"); + return cpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingClassPrepareRequest() : " + e); + log3(" ClassPreparenRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ClassPrepareRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001/TestDescription.java new file mode 100644 index 00000000000..5b87848d7d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a ClassPrepareEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy001; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy001 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001a.java new file mode 100644 index 00000000000..df038132104 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001a.java @@ -0,0 +1,167 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy001 JDI test. + */ + +public class suspendpolicy001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + +// Below, there is no the loop of interaction with the debugger for each Event +// because JVMS doesn't guaranties ordering ClassPrepareEvents. +// Therefore the debugger doesn't rely on the event order. + + case 0: + TestClass0 tcObject0 = new TestClass0(); +// methodForCommunication(); +// break; + + case 1: + TestClass1 tcObject1 = new TestClass1(); +// methodForCommunication(); +// break; + case 2: + TestClass2 tcObject2 = new TestClass2(); +// methodForCommunication(); +// break; + + case 3: + TestClass3 tcObject3 = new TestClass3(); +// methodForCommunication(); +// break; + + case 4: + TestClass4 tcObject4 = new TestClass4(); +// methodForCommunication(); +// break; + + case 5: + TestClass5 tcObject5 = new TestClass5(); +// methodForCommunication(); +// break; + + case 6: + TestClass6 tcObject6 = new TestClass6(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class TestClass0 { + static int var1 = 0; +} +class TestClass1 { + static int var1 = 0; +} +class TestClass2 { + static int var1 = 0; +} +class TestClass3 { + static int var1 = 0; +} +class TestClass4 { + static int var1 = 0; +} +class TestClass5 { + static int var1 = 0; +} +class TestClass6 { + static int var1 = 0; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002.java new file mode 100644 index 00000000000..cdff2ce99db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002.java @@ -0,0 +1,624 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for an AccessWatchpointEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a AccessWatchpointRequest, resumes
    + * the debuggee, and waits for the AccessWatchpointEvent.
    + * - The debuggee invokes the special method which makes access to
    + * a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy002a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + ReferenceType testClassReference = null; + + String fieldName = "var1"; + + + for (int i = 0; ; i++) { + + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "AccessWatchpointRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "AccessWatchpointRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "AccessWatchpointRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "AccessWatchpointRequest4"); + eventRequest1.enable(); + eventRequest2 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "AccessWatchpointRequest5"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "AccessWatchpointRequest6"); + eventRequest1.enable(); + eventRequest3 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "AccessWatchpointRequest7"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "AccessWatchpointRequest8"); + eventRequest2.enable(); + eventRequest3 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "AccessWatchpointRequest9"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "AccessWatchpointRequest10"); + eventRequest1.enable(); + eventRequest2 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "AccessWatchpointRequest11"); + eventRequest2.enable(); + eventRequest3 = settingAccessWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "AccessWatchpointRequest12"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new AccessWatchpointEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + log2(" got new Event with propety 'number' == " + newEvent.request().getProperty("number")); + if ( !( newEvent instanceof AccessWatchpointEvent)) { + log3("ERROR: new event is not AccessWatchpointEvent"); + testExitCode = FAILED; + } else { + log2(" Event is instanceof AccessWatchpointEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest settingAccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002/TestDescription.java new file mode 100644 index 00000000000..bafe08662d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for an AccessWatchpointEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy002; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy002 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002a.java new file mode 100644 index 00000000000..e8a9a0088cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy002a.java @@ -0,0 +1,152 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy002 JDI test. + */ + +public class suspendpolicy002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy002aTestClass tcObject = new suspendpolicy002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: suspendpolicy002aTestClass.method(); + break; + + case 1: suspendpolicy002aTestClass.method(); + break; + + case 2: suspendpolicy002aTestClass.method(); + break; + + case 3: suspendpolicy002aTestClass.method(); + break; + + case 4: suspendpolicy002aTestClass.method(); + break; + + case 5: suspendpolicy002aTestClass.method(); + break; + + case 6: suspendpolicy002aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class suspendpolicy002aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003.java new file mode 100644 index 00000000000..6988f530043 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003.java @@ -0,0 +1,631 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a ModificationWatchpointEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a ModificationWatchpointRequest, resumes
    + * the debuggee, and waits for the ModificationWatchpointEvent.
    + * - The debuggee invokes the special method which makes modification
    + * of a predefined variable to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy003a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldModification() ) { + log2("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + ReferenceType testClassReference = null; + + String fieldName = "var2"; + + + for (int i = 0; ; i++) { + + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "ModificationWatchpointRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "ModificationWatchpointRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "ModificationWatchpointRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "ModificationWatchpointRequest4"); + eventRequest1.enable(); + eventRequest2 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "ModificationWatchpointRequest5"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "ModificationWatchpointRequest6"); + eventRequest1.enable(); + eventRequest3 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "ModificationWatchpointRequest7"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "ModificationWatchpointRequest8"); + eventRequest2.enable(); + eventRequest3 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "ModificationWatchpointRequest9"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_NONE, "ModificationWatchpointRequest10"); + eventRequest1.enable(); + eventRequest2 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_THREAD, "ModificationWatchpointRequest11"); + eventRequest2.enable(); + eventRequest3 = settingModificationWatchpointRequest (mainThread, + testClassReference, fieldName, + SUSPEND_ALL, "ModificationWatchpointRequest12"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new AccessWatchpointEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + log2(" got new Event with propety 'number' == " + newEvent.request().getProperty("number")); + if ( !( newEvent instanceof ModificationWatchpointEvent)) { + log3("ERROR: new event is not ModificationWatchpointEvent"); + testExitCode = FAILED; + } else { + log2(" Event is instanceof ModificationWatchpointEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest settingModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003/TestDescription.java new file mode 100644 index 00000000000..c01a28bdf50 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a ModificationWatchpointEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy003; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy003 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003a.java new file mode 100644 index 00000000000..08cdc4b885f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy003a.java @@ -0,0 +1,152 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy003 JDI test. + */ + +public class suspendpolicy003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy003aTestClass tcObject = new suspendpolicy003aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: suspendpolicy003aTestClass.method(); + break; + + case 1: suspendpolicy003aTestClass.method(); + break; + + case 2: suspendpolicy003aTestClass.method(); + break; + + case 3: suspendpolicy003aTestClass.method(); + break; + + case 4: suspendpolicy003aTestClass.method(); + break; + + case 5: suspendpolicy003aTestClass.method(); + break; + + case 6: suspendpolicy003aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class suspendpolicy003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004.java new file mode 100644 index 00000000000..56719aeac70 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004.java @@ -0,0 +1,628 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a BreakpointEvent set,
    + * the method returns a value corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a BreakpointRequest,
    + * resumes the debuggee, and waits for the BreakpointEvent.
    + * - The debuggee invokes the special method in which control passes
    + * through a predefined line to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy004a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy004aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + ReferenceType testClassReference = null; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + + for (int i = 0; ; i++) { + + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_NONE, "BreakpointRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_THREAD, "BreakpointRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_ALL, "BreakpointRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_NONE, "BreakpointRequest4"); + eventRequest1.enable(); + eventRequest2 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_THREAD, "BreakpointRequest5"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_NONE, "BreakpointRequest6"); + eventRequest1.enable(); + eventRequest3 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_ALL, "BreakpointRequest7"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_THREAD, "BreakpointRequest8"); + eventRequest2.enable(); + eventRequest3 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_ALL, "BreakpointRequest9"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_NONE, "BreakpointRequest10"); + eventRequest1.enable(); + eventRequest2 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_THREAD, "BreakpointRequest11"); + eventRequest2.enable(); + eventRequest3 = settingBreakpointRequest (mainThread, + testClassReference, methodName, bpLineName, + SUSPEND_ALL, "BreakpointRequest12"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new BreakpointEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + log2(" got new Event with propety 'number' == " + newEvent.request().getProperty("number")); + if ( !( newEvent instanceof BreakpointEvent)) { + log3("ERROR: new event is not BreakpointEvent"); + testExitCode = FAILED; + } else { + log2(" Event is instanceof BreakpointEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private BreakpointRequest settingBreakpointRequest ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + "; method: " + methodName + "; line: " + bpLine); + + int n = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + Location loc = (Location) ((Method) testedClass.methodsByName(methodName).get(0)).allLineLocations().get(n); + + BreakpointRequest + bpr = eventRManager.createBreakpointRequest(loc); + bpr.putProperty("number", property); + bpr.addThreadFilter(thread); + bpr.setSuspendPolicy(suspendPolicy); + + log2(" a breakpoint has been set up"); + return bpr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingBreakpointRequest() : " + e); + log3(" BreakpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004/TestDescription.java new file mode 100644 index 00000000000..286ff0c817b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a BreakpointEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy004; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy004 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004a.java new file mode 100644 index 00000000000..8621fb0c9e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy004a.java @@ -0,0 +1,152 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy004 JDI test. + */ + +public class suspendpolicy004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy004aTestClass tcObject = new suspendpolicy004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: suspendpolicy004aTestClass.method(); + break; + + case 1: suspendpolicy004aTestClass.method(); + break; + + case 2: suspendpolicy004aTestClass.method(); + break; + + case 3: suspendpolicy004aTestClass.method(); + break; + + case 4: suspendpolicy004aTestClass.method(); + break; + + case 5: suspendpolicy004aTestClass.method(); + break; + + case 6: suspendpolicy004aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class suspendpolicy004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005.java new file mode 100644 index 00000000000..9009f7402ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005.java @@ -0,0 +1,624 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for an ExceptionEvent set,
    + * the method returns a value corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a ExceptionRequest,
    + * resumes the debuggee, and waits for the ExceptionEvent.
    + * - The debuggee invokes the special method in which
    + * NullPointerException is thrown to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy005a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy005aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + ReferenceType testClassReference = null; + + String methodName = "method"; + String bpLineName = "breakpointLine"; + + + for (int i = 0; ; i++) { + + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_NONE, "ExceptionRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_THREAD, "ExceptionRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_ALL, "ExceptionRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingExceptionRequest (mainThread, + debuggeeClass, // testClassReference, + SUSPEND_NONE, "ExceptionRequest4"); + eventRequest1.enable(); + eventRequest2 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_THREAD, "ExceptionRequest5"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_NONE, "ExceptionRequest6"); + eventRequest1.enable(); + eventRequest3 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_ALL, "ExceptionRequest7"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_THREAD, "ExceptionRequest8"); + eventRequest2.enable(); + eventRequest3 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_ALL, "ExceptionRequest9"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_NONE, "ExceptionRequest10"); + eventRequest1.enable(); + eventRequest2 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_THREAD, "ExceptionRequest11"); + eventRequest2.enable(); + eventRequest3 = settingExceptionRequest (mainThread, + debuggeeClass, //testClassReference, + SUSPEND_ALL, "ExceptionRequest12"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new ExceptionEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + log2(" got new Event with propety 'number' == " + newEvent.request().getProperty("number")); + if ( !( newEvent instanceof ExceptionEvent)) { + log3("ERROR: new event is not ExceptionEvent"); + testExitCode = FAILED; + } else { + log2(" Event is instanceof ExceptionEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest settingExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005/TestDescription.java new file mode 100644 index 00000000000..8ef7e8ee156 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for an ExceptionEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy005; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Fixed due to the bug 4528893. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.suspendPolicy.suspendpolicy005 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005a.java new file mode 100644 index 00000000000..685202cf1e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy005a.java @@ -0,0 +1,162 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy005 JDI test. + */ + +public class suspendpolicy005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy005aTestClass tcObject = new suspendpolicy005aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: suspendpolicy005aTestClass.method(); + break; + + case 1: suspendpolicy005aTestClass.method(); + break; + + case 2: suspendpolicy005aTestClass.method(); + break; + + case 3: suspendpolicy005aTestClass.method(); + break; + + case 4: suspendpolicy005aTestClass.method(); + break; + + case 5: suspendpolicy005aTestClass.method(); + break; + + case 6: suspendpolicy005aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class suspendpolicy005aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 += 1; + var3 += 1; + var2 = var3; + try { + suspendpolicy005a.nullMethod(); + } catch ( NullPointerException e ) { +// suspendpolicy005a.log3(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006.java new file mode 100644 index 00000000000..6d9a450317b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006.java @@ -0,0 +1,622 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a MethodEntryEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a MethodEntryRequest, resumes
    + * the debuggee, and waits for the MethodEntryEvent.
    + * - The debuggee invokes the special method to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy006 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy006 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy006().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy006a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy006aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + ReferenceType testClassReference = null; + + String fieldName = "var1"; + + + for (int i = 0; ; i++) { + + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodEntryRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodEntryRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodEntryRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodEntryRequest4"); + eventRequest1.enable(); + eventRequest2 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodEntryRequest5"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodEntryRequest6"); + eventRequest1.enable(); + eventRequest3 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodEntryRequest7"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodEntryRequest8"); + eventRequest2.enable(); + eventRequest3 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodEntryRequest9"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodEntryRequest10"); + eventRequest1.enable(); + eventRequest2 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodEntryRequest11"); + eventRequest2.enable(); + eventRequest3 = settingMethodEntryRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodEntryRequest12"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new MethodEntryEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + log2(" got new Event with propety 'number' == " + newEvent.request().getProperty("number")); + if ( !( newEvent instanceof MethodEntryEvent)) { + log3("ERROR: new event is not MethodEntryEvent"); + testExitCode = FAILED; + } else { + log2(" Event is instanceof MethodEntryEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest settingMethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006/TestDescription.java new file mode 100644 index 00000000000..bfdd2e4ef8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a MethodEntryEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy006; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy006 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006a.java new file mode 100644 index 00000000000..ed90bbdef5c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy006a.java @@ -0,0 +1,152 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy006 JDI test. + */ + +public class suspendpolicy006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy006aTestClass tcObject = new suspendpolicy006aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: suspendpolicy006aTestClass.method(); + break; + + case 1: suspendpolicy006aTestClass.method(); + break; + + case 2: suspendpolicy006aTestClass.method(); + break; + + case 3: suspendpolicy006aTestClass.method(); + break; + + case 4: suspendpolicy006aTestClass.method(); + break; + + case 5: suspendpolicy006aTestClass.method(); + break; + + case 6: suspendpolicy006aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class suspendpolicy006aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007.java new file mode 100644 index 00000000000..da114123eac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007.java @@ -0,0 +1,621 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a MethodExitEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a MethodExitRequest, resumes
    + * the debuggee, and waits for the MethodExitEvent.
    + * - The debuggee invokes the special method to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy007 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy007 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy007().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy007a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy007aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + ReferenceType testClassReference = null; + + String fieldName = "var1"; + + + for (int i = 0; ; i++) { + + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodExitRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodExitRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodExitRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodExitRequest4"); + eventRequest1.enable(); + eventRequest2 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodExitRequest5"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodExitRequest6"); + eventRequest1.enable(); + eventRequest3 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodExitRequest7"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodExitRequest8"); + eventRequest2.enable(); + eventRequest3 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodExitRequest9"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_NONE, "MethodExitRequest10"); + eventRequest1.enable(); + eventRequest2 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_THREAD, "MethodExitRequest11"); + eventRequest2.enable(); + eventRequest3 = settingMethodExitRequest (mainThread, + testClassReference, + SUSPEND_ALL, "MethodExitRequest12"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + log2("......waiting for new MethodExitEvent : " + i); + mainThread.resume(); + getEventSet(); + + Event newEvent = eventIterator.nextEvent(); + log2(" got new Event with propety 'number' == " + newEvent.request().getProperty("number")); + if ( !( newEvent instanceof MethodExitEvent)) { + log3("ERROR: new event is not MethodExitEvent"); + testExitCode = FAILED; + } else { + log2(" Event is instanceof MethodExitEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest settingMethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + mexr = eventRManager.createMethodExitRequest(); + mexr.putProperty("number", property); + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + mexr.setSuspendPolicy(suspendPolicy); + + log2(" MethodExitRequest has been set up"); + return mexr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007/TestDescription.java new file mode 100644 index 00000000000..17299d99526 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a MethodExitEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy007; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy007a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy007 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007a.java new file mode 100644 index 00000000000..af03cedceb4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy007a.java @@ -0,0 +1,152 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy007 JDI test. + */ + +public class suspendpolicy007a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy007aTestClass tcObject = new suspendpolicy007aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + log1("methodForCommunication(); : " + i); + methodForCommunication(); + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: suspendpolicy007aTestClass.method(); + break; + + case 1: suspendpolicy007aTestClass.method(); + break; + + case 2: suspendpolicy007aTestClass.method(); + break; + + case 3: suspendpolicy007aTestClass.method(); + break; + + case 4: suspendpolicy007aTestClass.method(); + break; + + case 5: suspendpolicy007aTestClass.method(); + break; + + case 6: suspendpolicy007aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class suspendpolicy007aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008.java new file mode 100644 index 00000000000..8c3788b4d3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008.java @@ -0,0 +1,590 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a ThreadStartEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up one to three new ThreadStartRequests,
    + * resumes the debuggee, and waits for the ThreadStartEvents.
    + * - The debuggee starts new thread to be resulting in the events.
    + * - Upon getting new ThreadStartEvent,
    + * the debugger performs the check corresponding to the EventSet.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy008 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy008 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy008().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy008a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = settingThreadStartRequest ( + SUSPEND_NONE, "ThreadStartRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingThreadStartRequest ( + SUSPEND_THREAD, "ThreadStartRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingThreadStartRequest ( + SUSPEND_ALL, "ThreadStartRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingThreadStartRequest ( + SUSPEND_NONE, "ThreadStartRequest1"); + eventRequest1.enable(); + eventRequest2 = settingThreadStartRequest ( + SUSPEND_THREAD, "ThreadStartRequest2"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingThreadStartRequest ( + SUSPEND_NONE, "ThreadStartRequest1"); + eventRequest1.enable(); + eventRequest3 = settingThreadStartRequest ( + SUSPEND_ALL, "ThreadStartRequest3"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingThreadStartRequest ( + SUSPEND_THREAD, "ThreadStartRequest2"); + eventRequest2.enable(); + eventRequest3 = settingThreadStartRequest ( + SUSPEND_ALL, "ThreadStartRequest3"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingThreadStartRequest ( + SUSPEND_NONE, "ThreadStartRequest1"); + eventRequest1.enable(); + eventRequest2 = settingThreadStartRequest ( + SUSPEND_THREAD, "ThreadStartRequest2"); + eventRequest2.enable(); + eventRequest3 = settingThreadStartRequest ( + SUSPEND_ALL, "ThreadStartRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + mainThread.resume(); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof ThreadStartEvent)) { + log3("ERROR: new event is not ThreadStartEvent"); + testExitCode = FAILED; + } else { + log2("......got : instanceof ThreadStartEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : vm.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadStartRequest settingThreadStartRequest(int suspendPolicy, + String property) + throws JDITestRuntimeException { + try { + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); +// tsr.addThreadFilter(mainThread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingThreadStartRequest() : " + e); + log3(" ThreadStartRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadStartRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008/TestDescription.java new file mode 100644 index 00000000000..f71380e33f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy008. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a ThreadStartEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy008; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy008a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy008 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008a.java new file mode 100644 index 00000000000..9906cc3aaa4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy008a.java @@ -0,0 +1,202 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy008 JDI test. + */ + +public class suspendpolicy008a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadsuspendpolicy008a thread0 = null; + static Threadsuspendpolicy008a thread1 = null; + static Threadsuspendpolicy008a thread2 = null; + static Threadsuspendpolicy008a thread3 = null; + static Threadsuspendpolicy008a thread4 = null; + static Threadsuspendpolicy008a thread5 = null; + static Threadsuspendpolicy008a thread6 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread0 = new Threadsuspendpolicy008a("thread0"); + methodForCommunication(); + + threadStart(thread0); + + thread1 = new Threadsuspendpolicy008a("thread1"); + methodForCommunication(); + break; + + case 1: + threadStart(thread1); + + thread2 = new Threadsuspendpolicy008a("thread2"); + methodForCommunication(); + break; + + case 2: + threadStart(thread2); + + thread3 = new Threadsuspendpolicy008a("thread3"); + methodForCommunication(); + break; + + case 3: + threadStart(thread3); + + thread4 = new Threadsuspendpolicy008a("thread4"); + methodForCommunication(); + break; + + case 4: + threadStart(thread4); + + thread5 = new Threadsuspendpolicy008a("thread5"); + methodForCommunication(); + break; + + case 5: + threadStart(thread5); + + thread6 = new Threadsuspendpolicy008a("thread6"); + methodForCommunication(); + break; + + case 6: + threadStart(thread6); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class Threadsuspendpolicy008a extends Thread { + + String tName = null; + + public Threadsuspendpolicy008a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009.java new file mode 100644 index 00000000000..878c35b9563 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009.java @@ -0,0 +1,590 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a ThreadDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one to three threads with all possible combinations:
    + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL,
    + * THREAD+ALL, NONE+THREAD+ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up one to three new ThreadDeathRequests,
    + * resumes the debuggee, and waits for the ThreadDeathEvents.
    + * - The debuggee starts new thread to be resulting in the events.
    + * - Upon getting new ThreadDeathEvent,
    + * the debugger performs the check corresponding to the EventSet.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy009 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy009 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy009().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy009a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = settingThreadDeathRequest ( + SUSPEND_NONE, "ThreadDeathRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingThreadDeathRequest ( + SUSPEND_THREAD, "ThreadDeathRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingThreadDeathRequest ( + SUSPEND_ALL, "ThreadDeathRequest3"); + eventRequest3.enable(); + break; + + case 3: + eventRequest1 = settingThreadDeathRequest ( + SUSPEND_NONE, "ThreadDeathRequest1"); + eventRequest1.enable(); + eventRequest2 = settingThreadDeathRequest ( + SUSPEND_THREAD, "ThreadDeathRequest2"); + eventRequest2.enable(); + break; + + case 4: + eventRequest1 = settingThreadDeathRequest ( + SUSPEND_NONE, "ThreadDeathRequest1"); + eventRequest1.enable(); + eventRequest3 = settingThreadDeathRequest ( + SUSPEND_ALL, "ThreadDeathRequest3"); + eventRequest3.enable(); + break; + + case 5: + eventRequest2 = settingThreadDeathRequest ( + SUSPEND_THREAD, "ThreadDeathRequest2"); + eventRequest2.enable(); + eventRequest3 = settingThreadDeathRequest ( + SUSPEND_ALL, "ThreadDeathRequest3"); + eventRequest3.enable(); + break; + + case 6: + eventRequest1 = settingThreadDeathRequest ( + SUSPEND_NONE, "ThreadDeathRequest1"); + eventRequest1.enable(); + eventRequest2 = settingThreadDeathRequest ( + SUSPEND_THREAD, "ThreadDeathRequest2"); + eventRequest2.enable(); + eventRequest3 = settingThreadDeathRequest ( + SUSPEND_ALL, "ThreadDeathRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + mainThread.resume(); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof ThreadDeathEvent)) { + log3("ERROR: new event is not ThreadDeathEvent"); + testExitCode = FAILED; + } else { + log2("......got : instanceof ThreadDeathEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + case 3: eventRequest1.disable(); eventRequest2.disable(); break; + case 4: eventRequest1.disable(); eventRequest3.disable(); break; + case 5: eventRequest2.disable(); eventRequest3.disable(); break; + case 6: eventRequest1.disable(); eventRequest2.disable(); + eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : vm.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadDeathRequest settingThreadDeathRequest(int suspendPolicy, + String property) + throws JDITestRuntimeException { + try { + ThreadDeathRequest tsr = eventRManager.createThreadDeathRequest(); +// tsr.addThreadFilter(mainThread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingThreadDeathRequest() : " + e); + log3(" ThreadDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadDeathRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009/TestDescription.java new file mode 100644 index 00000000000..216d181e0e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy009. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a ThreadDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one to three threads + * with all possible combinations: + * NONE, THREAD, ALL, NONE+THREAD, NONE+ALL, THREAD+ALL, NONE+THREAD+ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy009; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy009a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy009 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009a.java new file mode 100644 index 00000000000..10e7464620d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy009a.java @@ -0,0 +1,223 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy009 JDI test. + */ + +public class suspendpolicy009a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadsuspendpolicy009a thread0 = null; + static Threadsuspendpolicy009a thread1 = null; + static Threadsuspendpolicy009a thread2 = null; + static Threadsuspendpolicy009a thread3 = null; + static Threadsuspendpolicy009a thread4 = null; + static Threadsuspendpolicy009a thread5 = null; + static Threadsuspendpolicy009a thread6 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread0 = new Threadsuspendpolicy009a("thread0"); + methodForCommunication(); + + threadStart(thread0); + try { + thread0.join(); + } catch (InterruptedException e) { + } + thread1 = new Threadsuspendpolicy009a("thread1"); + methodForCommunication(); + break; + + case 1: + threadStart(thread1); + try { + thread1.join(); + } catch (InterruptedException e) { + } + thread2 = new Threadsuspendpolicy009a("thread2"); + methodForCommunication(); + break; + + case 2: + threadStart(thread2); + try { + thread2.join(); + } catch (InterruptedException e) { + } + thread3 = new Threadsuspendpolicy009a("thread3"); + methodForCommunication(); + break; + + case 3: + threadStart(thread3); + try { + thread3.join(); + } catch (InterruptedException e) { + } + thread4 = new Threadsuspendpolicy009a("thread4"); + methodForCommunication(); + break; + + case 4: + threadStart(thread4); + try { + thread4.join(); + } catch (InterruptedException e) { + } + thread5 = new Threadsuspendpolicy009a("thread5"); + methodForCommunication(); + break; + + case 5: + threadStart(thread5); + try { + thread5.join(); + } catch (InterruptedException e) { + } + thread6 = new Threadsuspendpolicy009a("thread6"); + methodForCommunication(); + break; + + case 6: + threadStart(thread6); + try { + thread6.join(); + } catch (InterruptedException e) { + } + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class Threadsuspendpolicy009a extends Thread { + + String tName = null; + + public Threadsuspendpolicy009a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010.java new file mode 100644 index 00000000000..ee733d43817 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010.java @@ -0,0 +1,551 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a StepEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event sets containing
    + * one thread with all possible combinations:
    + * NONE, THREAD, ALL
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a StepRequest, resumes
    + * the debuggee, and waits for the StepEvent.
    + * - The debuggee invokes the special method to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy010 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy010 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy010().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy010a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy010aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = settingStepRequest (mainThread, + SUSPEND_NONE, "StepRequest1"); + eventRequest1.enable(); + break; + + case 1: + eventRequest2 = settingStepRequest (mainThread, + SUSPEND_THREAD, "StepRequest2"); + eventRequest2.enable(); + break; + + case 2: + eventRequest3 = settingStepRequest (mainThread, + + SUSPEND_ALL, "StepRequest3"); + eventRequest3.enable(); + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + mainThread.resume(); + getEventSet(); + + if ( !(eventIterator.nextEvent() instanceof StepEvent)) { + log3("ERROR: new event is not StepEvent"); + testExitCode = FAILED; + } else { + log2("......got : instanceof StepEvent"); + policy = eventSet.suspendPolicy(); + if (policy != policyExpected[i]) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyExpected[i]); + testExitCode = FAILED; + } + } + + switch (i) { + case 0: eventRequest1.disable(); break; + case 1: eventRequest2.disable(); break; + case 2: eventRequest3.disable(); break; + } + + switch (policy) { + case SUSPEND_NONE : break; + case SUSPEND_THREAD : mainThread.resume(); break; + case SUSPEND_ALL : vm.resume(); break; + default: throw new JDITestRuntimeException("** default case 3 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest settingStepRequest ( ThreadReference thread, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + str.putProperty("number", property); + str.addCountFilter(1); + str.setSuspendPolicy(suspendPolicy); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010/TestDescription.java new file mode 100644 index 00000000000..132179cb198 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy010. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a StepEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event sets containing one thread + * with all possible combinations: NONE, THREAD, ALL + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy010; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy010a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy010 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy010a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy010 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010a.java new file mode 100644 index 00000000000..b21776ff955 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy010a.java @@ -0,0 +1,144 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy010 JDI test. + */ + +public class suspendpolicy010a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static suspendpolicy010aTestClass tcObject = new suspendpolicy010aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); // suspendpolicy010aTestClass is already prepared + + suspendpolicy010aTestClass.method(); + methodForCommunication(); + break; + + case 1: + suspendpolicy010aTestClass.method(); + methodForCommunication(); + break; + + case 2: + suspendpolicy010aTestClass.method(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} +class suspendpolicy010aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011.java new file mode 100644 index 00000000000..a6e48edc65a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011.java @@ -0,0 +1,507 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing
    + * one more VMDeathRequest with suspendPolicy SUSPEND_NONE.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a VMDeathRequest, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy011 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy011 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy011().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy011a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest1 = settingVMDeathRequest ( SUSPEND_NONE, "VMDeathRequest1"); + eventRequest1.enable(); + + policyToCheck = policyExpected[0]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011/TestDescription.java new file mode 100644 index 00000000000..b15f5dd942c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy011. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing + * one more VMDeathRequest with suspendPolicy SUSPEND_NONE. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy011; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy011a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy011 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy011a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy011 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011a.java new file mode 100644 index 00000000000..ec23ecf49f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy011a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy011 JDI test. + */ + +public class suspendpolicy011a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012.java new file mode 100644 index 00000000000..18e34f6ece8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012.java @@ -0,0 +1,507 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing one more
    + * VMDeathRequest with suspendPolicy SUSPEND_EVENT_THREAD.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a VMDeathRequest, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy012 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy012 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy012().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy012a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest2 = settingVMDeathRequest ( SUSPEND_THREAD, "VMDeathRequest2"); + eventRequest2.enable(); + + policyToCheck = policyExpected[1]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012/TestDescription.java new file mode 100644 index 00000000000..d4638896ad5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy012. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing + * one more VMDeathRequest with suspendPolicy SUSPEND_EVENT_THREAD. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy012; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy012a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy012 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy012a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy012 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012a.java new file mode 100644 index 00000000000..a9489971213 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy012a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy012 JDI test. + */ + +public class suspendpolicy012a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013.java new file mode 100644 index 00000000000..33dfb24e9e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013.java @@ -0,0 +1,507 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing one more
    + * VMDeathRequest with suspendPolicy SUSPEND_ALL.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up a VMDeathRequest, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy013 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy013 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy013().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy013a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest3 = settingVMDeathRequest ( SUSPEND_ALL, "VMDeathRequest3"); + eventRequest3.enable(); + + policyToCheck = policyExpected[2]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013/TestDescription.java new file mode 100644 index 00000000000..46517636bb9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy013. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing + * one more VMDeathRequest with suspendPolicy SUSPEND_ALL. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy013; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy013a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy013 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy013a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy013 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013a.java new file mode 100644 index 00000000000..a0494e2b066 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy013a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy013 JDI test. + */ + +public class suspendpolicy013a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014.java new file mode 100644 index 00000000000..716d3c21c0d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014.java @@ -0,0 +1,510 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing two more
    + * VMDeathRequests with suspendPolicies
    + * SUSPEND_EVENT_THREAD and SUSPEND_NONE.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up VMDeathRequests, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy014 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy014 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy014().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy014a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest1 = settingVMDeathRequest (SUSPEND_NONE, "VMDeathRequest1"); + eventRequest1.enable(); + eventRequest2 = settingVMDeathRequest (SUSPEND_THREAD, "VMDeathRequest2"); + eventRequest2.enable(); + + policyToCheck = policyExpected[3]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014/TestDescription.java new file mode 100644 index 00000000000..c7984a61b8d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy014. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing two more VMDeathRequests + * with suspendPolicies SUSPEND_EVENT_THREAD and SUSPEND_NONE. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy014; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy014a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy014 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy014a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy014 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014a.java new file mode 100644 index 00000000000..dfdb560e1d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy014a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy014 JDI test. + */ + +public class suspendpolicy014a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015.java new file mode 100644 index 00000000000..e3cafdf6357 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015.java @@ -0,0 +1,510 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing two more
    + * VMDeathRequests with suspendPolicies
    + * SUSPEND_ALL and SUSPEND_NONE.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up VMDeathRequests, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy015 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy015 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy015().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy015a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest1 = settingVMDeathRequest (SUSPEND_NONE, "VMDeathRequest1"); + eventRequest1.enable(); + eventRequest3 = settingVMDeathRequest (SUSPEND_ALL, "VMDeathRequest3"); + eventRequest3.enable(); + + policyToCheck = policyExpected[4]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015/TestDescription.java new file mode 100644 index 00000000000..9f485777109 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy015. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing two more VMDeathRequests + * with suspendPolicies SUSPEND_ALL and SUSPEND_NONE. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy015; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy015a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy015 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy015a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy015 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015a.java new file mode 100644 index 00000000000..7209c6b160c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy015a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy015 JDI test. + */ + +public class suspendpolicy015a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016.java new file mode 100644 index 00000000000..e8f7c03581a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016.java @@ -0,0 +1,510 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing two more
    + * VMDeathRequests with suspendPolicies
    + * SUSPEND_ALL and SUSPEND_EVENT_THREAD.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up VMDeathRequests, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy016 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy016 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy016().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy016a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest2 = settingVMDeathRequest (SUSPEND_THREAD, "VMDeathRequest2"); + eventRequest2.enable(); + eventRequest3 = settingVMDeathRequest (SUSPEND_ALL, "VMDeathRequest3"); + eventRequest3.enable(); + + policyToCheck = policyExpected[5]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016/TestDescription.java new file mode 100644 index 00000000000..97a5ddd9063 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy016. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing two more VMDeathRequests + * with suspendPolicies SUSPEND_ALL and SUSPEND_EVENT_THREAD. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy016; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy016a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy016 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy016a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy016 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016a.java new file mode 100644 index 00000000000..32e6b43748b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy016a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy016 JDI test. + */ + +public class suspendpolicy016a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017.java new file mode 100644 index 00000000000..c2bf7bfae31 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017.java @@ -0,0 +1,512 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for a VMDeathEvent set,
    + * the method returns values corresponding to one
    + * which suspends the most threads.
    + * The cases to check include event set containing three more
    + * VMDeathRequests with suspendPolicies
    + * SUSPEND_ALL, SUSPEND_NONE, and SUSPEND_EVENT_THREAD.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the above,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger sets up VMDeathRequests, resumes
    + * the debuggee, and waits for the VMDeathEvent.
    + * - The debuggee ends to be resulting in the event.
    + * - Upon getting new event, the debugger
    + * performs the check corresponding to the event.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + * In third phase, at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class suspendpolicy017 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy017 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy017().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy017a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + check(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + + return 0; + + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canRequestVMDeathEvent() ) { + log2("......vm.canRequestVMDeathEvent == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + log2("......setting up ClassPrepareEvent for breakpointForCommunication"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = threadByName("main"); + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + final int SUSPEND_POLICY = EventRequest.SUSPEND_NONE; + final int SUSPEND_NONE = EventRequest.SUSPEND_NONE; + final int SUSPEND_THREAD = EventRequest.SUSPEND_EVENT_THREAD; + final int SUSPEND_ALL = EventRequest.SUSPEND_ALL; + + int policyExpected[] = { SUSPEND_NONE, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_THREAD, + SUSPEND_ALL, + SUSPEND_ALL, + SUSPEND_ALL }; + int policy = 0; + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRequest1 = settingVMDeathRequest (SUSPEND_NONE, "VMDeathRequest1"); + eventRequest1.enable(); + eventRequest2 = settingVMDeathRequest (SUSPEND_THREAD, "VMDeathRequest2"); + eventRequest2.enable(); + eventRequest3 = settingVMDeathRequest (SUSPEND_ALL, "VMDeathRequest3"); + eventRequest3.enable(); + + policyToCheck = policyExpected[6]; + mainThread.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private VMDeathRequest settingVMDeathRequest( int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up VMDeathRequest:"); + log2(" suspendPolicy: " + suspendPolicy + "; property: " + property); + + VMDeathRequest + vmdr = eventRManager.createVMDeathRequest(); + vmdr.putProperty("number", property); + vmdr.setSuspendPolicy(suspendPolicy); + + return vmdr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingVMDeathRequest() : " + e); + log3(" VMDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a VMDeathRequest **"); + } + } + + void check() { + log2("......checking up on eventSet.suspendPolicy()"); + int policy = eventSet.suspendPolicy(); + if (policy != policyToCheck) { + log3("ERROR: eventSet.suspendPolicy() != policyExpected"); + log3(" eventSet.suspendPolicy() == " + policy); + log3(" policyExpected == " + policyToCheck); + testExitCode = FAILED; + } + vm.resume(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017/TestDescription.java new file mode 100644 index 00000000000..8a211ce5d3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/EventSet/suspendPolicy/suspendpolicy017. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for a VMDeathEvent set, + * the method returns values corresponding to one which suspends the most threads. + * The cases to check include event set containing three more VMDeathRequests + * with suspendPoliy SUSPEND_ALL, SUSPEND_NONE, and SUSPEND_EVENT_THREAD. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy017; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy017a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy017 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy017a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy017 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017a.java new file mode 100644 index 00000000000..7632c1f2b86 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy017a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy017 JDI test. + */ + +public class suspendpolicy017a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018.java new file mode 100644 index 00000000000..e2d4d7da79a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018.java @@ -0,0 +1,341 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * EventSet.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.EventSet.suspendPolicy()
    + * complies with its spec.
    + *
    + * The test checks that for Event sets,
    + * corresponding to VMStart, VMDeath, and VMDisconnect Events,
    + * the method returns
    + * SUSPEND_ALL, SUSPEND_NONE, and SUSPEND_NONE.
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent,
    + * it checks up on the value returned by the method suspendPolicy(),
    + * resumes the VM, and waits for VMDeathEvent within
    + * the predefined time interval.
    + * If no the event received, the test is FAILED.
    + * Upon getting the VMDeathEvent, the debugger
    + * checks up on the value returned by the method suspendPolicy() and
    + * waits for VMDisconnectEvent within the predefined time interval.
    + * If no the event received, the test is FAILED.
    + * Upon getting the VMDisconnectEvent, the debugger
    + * checks up on the value returned by the method suspendPolicy().
    + *
    + */ + +public class suspendpolicy018 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/EventSet/suspendPolicy/suspendpolicy018 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new suspendpolicy018().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.EventSet.suspendPolicy.suspendpolicy018a"; + + private String testedClassName = + "nsk.jdi.EventSet.suspendPolicy.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + int policyToCheck = 0; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugeeNoWait(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugeeNoWait(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + log2("waiting for VMStartEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMStartEvent) { + log2("VMStartEvent received; test begins"); + int sp1 = eventSet.suspendPolicy(); + if (sp1 != EventRequest.SUSPEND_ALL) { + log3("ERROR: eventSet.suspendPolicy() != EventRequest.SUSPEND_ALL but : " + sp1); + testExitCode = FAILED; + } + + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDeathEvent) ) { + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } + sp1 = eventSet.suspendPolicy(); + if (sp1 != EventRequest.SUSPEND_NONE) { + log3("ERROR: eventSet.suspendPolicy() != EventRequest.SUSPEND_NONE but : " + sp1); + testExitCode = FAILED; + } + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + if ( !(eventIterator.nextEvent() instanceof VMDisconnectEvent) ) { + log3("ERROR: last event is not the VMDisconnectEvent"); + return 1; + } + sp1 = eventSet.suspendPolicy(); + if (sp1 != EventRequest.SUSPEND_NONE) { + log3("ERROR: eventSet.suspendPolicy() != EventRequest.SUSPEND_NONE but : " + sp1); + testExitCode = FAILED; + } + + return 0; + } else { + log3("ERROR: first event is not the VMStartEvent"); + return 1; + } + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + log2("......getting ClassPrepareEvent for debuggee's class"); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + log2(" received: ClassPrepareEvent for debuggeeClass"); + + vm.resume(); + + log1(" TESTING ENDS"); + return; + } + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018/TestDescription.java new file mode 100644 index 00000000000..14e47c1a3ba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018/TestDescription.java @@ -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/EventSet/suspendPolicy/suspendpolicy018. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * EventSet. + * The test checks up that a result of the method + * com.sun.jdi.EventSet.suspendPolicy() + * complies with its spec: + * public int suspendPolicy() + * Returns the policy used to suspend threads in the target VM for this event set. + * This policy is selected from the suspend policies for each event's request; + * the target VM chooses the policy which suspends the most threads. + * The target VM suspends threads according to that policy and + * that policy is returned here. + * See EventRequest for the possible policy values. + * In rare cases, the suspend policy may differ from the requested value if + * a ClassPrepareEvent has occurred in a debugger system thread. + * See ClassPrepareEvent.thread() for details. + * Returns: the suspendPolicy which is either SUSPEND_ALL, + * SUSPEND_EVENT_THREAD or SUSPEND_NONE. + * The test checks that for Event sets, + * corresponding to VMStart, VMDeath, and VMDisconnect Events, + * the method returns SUSPEND_ALL, SUSPEND_NONE, and SUSPEND_NONE. + * The test works as follows: + * The debugger program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy018; + * the debuggee program - nsk.jdi.EventSet.suspendPolicy.suspendpolicy018a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.EventSet.suspendPolicy.suspendpolicy018 + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy018a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.suspendPolicy.suspendpolicy018 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018a.java new file mode 100644 index 00000000000..6f7404205ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy018a.java @@ -0,0 +1,109 @@ +/* + * 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.EventSet.suspendPolicy; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspendpolicy018 JDI test. + */ + +public class suspendpolicy018a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001.java new file mode 100644 index 00000000000..f5a56217b9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001.java @@ -0,0 +1,198 @@ +/* + * 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.EventSet.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class tostring001 { + + //------------------------------------------------------- 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.EventSet.toString."; + private final static String className = "tostring001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + tostring001a.brkpMethodName, + tostring001a.brkpLineNumber); + debuggee.resume(); + + debuggee.sendSignal(SIGNAL_GO); + EventSet eventSet = null; + +/* + // waiting for VMStartEvent event + try { + eventSet = waitEventSet(null, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for VMStartEvent event"); + } + + display("Checking toString() method for eventSet of VMStartEvent event"); + checkToString (eventSet); +*/ + + // waiting the breakpoint event + try { + eventSet = waitEventSet(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (!(eventSet.eventIterator().nextEvent() instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + display("Checking toString() method for eventSet of Breakpoint event"); + checkToString (eventSet); + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + + private static EventSet waitEventSet(EventRequest request, long timeout) + throws InterruptedException { + Event event; + long totalTime = timeout; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventIterator eventIterator = null; + EventSet eventSet = null; + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + eventSet = debuggee.VM().eventQueue().remove(totalTime); + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + display(" event ===>>> " + event); + if (event.request() != null && event.request().equals(request)) { + return eventSet; + } else if (request == null && event instanceof VMStartEvent) { + return eventSet; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + return null; + } + + private static void checkToString (EventSet eventSet) { + String str = eventSet.toString(); + if (str == null) { + complain("toString() returns null for event set"); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for event set"); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() returns for event set : " + str); + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..172c46fc1d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/EventSet/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.EventSet interface. This method is inherited from + * com.sun.jdi.Mirror interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * a given EventSet. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for EventSet + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers for setting breakpoints + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.toString.tostring001 + * nsk.jdi.EventSet.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001a.java new file mode 100644 index 00000000000..63d8e4114d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/toString/tostring001a.java @@ -0,0 +1,95 @@ +/* + * 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.EventSet.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "breakHere"; + public final static int brkpLineNumber = 91; + + //------------------------------------------------------ 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); + try { + pipe.println(tostring001.SIGNAL_READY); + breakHere(); + receiveSignal(tostring001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + public static void breakHere () { + receiveSignal(tostring001.SIGNAL_GO); + log.display("breakpoint line"); // brkpLineNumber + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001.java new file mode 100644 index 00000000000..3b60be91ee9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001.java @@ -0,0 +1,189 @@ +/* + * 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.EventSet.virtualMachine; + +import nsk.share.*; +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; + +/** + * The debugger application of the test. + */ +public class virtualmachine001 { + + //------------------------------------------------------- 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.EventSet.virtualMachine."; + private final static String className = "virtualmachine001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private static VirtualMachine vm; + + //------------------------------------------------------- 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + virtualmachine001a.brkpMethodName, + virtualmachine001a.brkpLineNumber); + debuggee.resume(); + + // get expected reference for comparison. + vm = debuggee.VM(); + + debuggee.sendSignal(SIGNAL_GO); + EventSet eventSet = null; + + // waiting the breakpoint event + try { + eventSet = waitEventSet(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (eventSet == null) + throw new Failure("Expected EventSet didn't arrive"); + + if (!(eventSet.eventIterator().nextEvent() instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + display("Checking virtualMachine() method for eventSet of Breakpoint event"); + checkVM (eventSet); + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + + private static EventSet waitEventSet(EventRequest request, long timeout) + throws InterruptedException { + Event event; + long totalTime = timeout; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + EventIterator eventIterator = null; + EventSet eventSet = null; + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + eventSet = debuggee.VM().eventQueue().remove(totalTime); + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + display(" event ===>>> " + event); + if (event.request() != null && event.request().equals(request)) { + return eventSet; + } else if (request == null && event instanceof VMStartEvent) { + return eventSet; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + return null; + } + + private static void checkVM (EventSet eventSet) { + VirtualMachine vm1 = eventSet.virtualMachine(); + if (vm1 == null) { + complain("virtualMachine() returns null for event set"); + exitStatus = Consts.TEST_FAILED; + } else if (vm1 != vm) { + complain("virtualMachine() returns different VirtualMachine object"); + exitStatus = Consts.TEST_FAILED; + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001/TestDescription.java new file mode 100644 index 00000000000..4982a4fe940 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/EventSet/virtualMachine/virtualmachine001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public virtualMachine() method of an implementing class of + * com.sun.jdi.EventSet interface. This method is inherited from + * com.sun.jdi.Mirror interface. + * The test checks an assertion : + * public VirtualMachine virtualMachine() + * Gets the VirtualMachine to which this Mirror belongs. + * A Mirror must be associated with a VirtualMachine to have any meaning. + * Returns: + * the VirtualMachine for which this mirror is a proxy. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for EventSet + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers for setting breakpoints + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.EventSet.virtualMachine.virtualmachine001 + * nsk.jdi.EventSet.virtualMachine.virtualmachine001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.EventSet.virtualMachine.virtualmachine001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001a.java new file mode 100644 index 00000000000..47b03191535 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001a.java @@ -0,0 +1,96 @@ +/* + * 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.EventSet.virtualMachine; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class virtualmachine001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "breakHere"; + public final static int brkpLineNumber = 92; + + //------------------------------------------------------ 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); + try { + pipe.println(virtualmachine001.SIGNAL_READY); + breakHere(); + receiveSignal(virtualmachine001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + public static void breakHere () { + receiveSignal(virtualmachine001.SIGNAL_GO); + log.display("breakpoint line"); // brkpLineNumber + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001.java new file mode 100644 index 00000000000..80e261b45c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001.java @@ -0,0 +1,328 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that caught exception events are properly reported + * or not reported by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with two combinations of boolean parameter notifyCaught. + * The debuggee part of the test raises three caught exceptions: + *
  • own exevent001tException + *
  • IllegalMonitorStateException + *
  • NumberFormatException in another class + */ +public class exevent001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = + "nsk.jdi.ExceptionEvent._itself_.exevent001t"; + static final String DEBUGGEE_EXCEPTION1 = DEBUGGEE_CLASS + "Exception"; + static final String DEBUGGEE_EXCEPTION2 = "java.lang.IllegalMonitorStateException"; + static final String DEBUGGEE_EXCEPTION3 = "java.lang.NumberFormatException"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_TEST1 = "test1"; + static final String COMMAND_TEST2 = "test2"; + static final String COMMAND_TEST3 = "test3"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private EventRequestManager erManager; + private VirtualMachine vm; + private ReferenceType rType; + private volatile ExceptionRequest eRequest; + private volatile int t_case = 0; // testing debuggee's exception + private volatile int exc1Count = 0; + private volatile int exc2Count = 0; + private volatile int exc3Count = 0; + private volatile int totalRes = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "exevent001t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + debuggee.resume(); + String token = pipe.readln(); + + if (!token.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + token); + return quitDebuggee(FAILED); + } + + if ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST BUG: cannot find class " + + DEBUGGEE_CLASS); + return quitDebuggee(FAILED); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + +/* Create a new ExceptionRequest with false notifyCaught parameter + so caught exceptions should not be reported. */ + log.display("\nCreating ExceptionEvent request that not reports caught events"); + if ((eRequest = createExReq(false, false)) == null) + return FAILED; + + if (runTestCase(1, COMMAND_TEST1) == FAILED) + return quitDebuggee(FAILED); + + if (runTestCase(2, COMMAND_TEST2) == FAILED) + return quitDebuggee(FAILED); + + if (runTestCase(3, COMMAND_TEST3) == FAILED) + return quitDebuggee(FAILED); + + eRequest.disable(); + +// check results for caught exceptions + if (exc1Count != 0) { + log.complain("TEST FAILED: caught exception " + + DEBUGGEE_EXCEPTION1 + + " was reported by the debugger"); + totalRes = FAILED; + } + exc1Count = 0; + if (exc2Count != 0) { + log.complain("TEST FAILED: caught exception " + + DEBUGGEE_EXCEPTION2 + + " was reported by the debugger"); + totalRes = FAILED; + } + exc2Count = 0; + if (exc3Count != 0) { + log.complain("TEST FAILED: caught exception " + + DEBUGGEE_EXCEPTION3 + + " was reported by the debugger"); + totalRes = FAILED; + } + exc3Count = 0; + +/* Create a new ExceptionRequest with true notifyCaught parameter + so caught exceptions should be reported. */ + log.display("\nCreating ExceptionEvent request that reports caught events"); + if ((eRequest = createExReq(true, false)) == null) + return FAILED; + + if (runTestCase(1, COMMAND_TEST1) == FAILED) + return quitDebuggee(FAILED); + + if (runTestCase(2, COMMAND_TEST2) == FAILED) + return quitDebuggee(FAILED); + + if (runTestCase(3, COMMAND_TEST3) == FAILED) + return quitDebuggee(FAILED); + + eRequest.disable(); + +// check results for caught exceptions + if (exc1Count == 0) { + log.complain("TEST FAILED: caught exception " + + DEBUGGEE_EXCEPTION1 + + " was not reported by the debugger"); + totalRes = FAILED; + } + if (exc2Count == 0) { + log.complain("TEST FAILED: caught exception " + + DEBUGGEE_EXCEPTION2 + + " was not reported by the debugger"); + totalRes = FAILED; + } + if (exc3Count == 0) { + log.complain("TEST FAILED: caught exception " + + DEBUGGEE_EXCEPTION3 + + " was not reported by the debugger"); + totalRes = FAILED; + } + + return quitDebuggee(totalRes); + } + + private int runTestCase(int tNum, String command) { + t_case = tNum; + pipe.println(command); + String token = pipe.readln(); + if (token == null || !token.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + token); + return FAILED; + } + return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(null, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee(int stat) { + if (eRequest != null) { + eRequest.disable(); + } + + if (elThread != null) { + elThread.isConnected = false; + try { + if (elThread.isAlive()) + elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught " + e); + stat = FAILED; + } + } + + pipe.println(COMMAND_QUIT); + + int debStat = debuggee.endDebugee(); + if (debStat != (JCK_STATUS_BASE + PASSED)) { + log.complain("TEST FAILED: debuggee's process finished with status: " + debStat); + stat = FAILED; + } else + log.display("Debuggee's process finished with status: " + debStat); + + return stat; + } + + class EventListener extends Thread { + public volatile boolean isConnected = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent); + + if (eRequest.equals(event.request())) { + switch (t_case) { + case 1: + if (exEvent.exception().referenceType().name().equals( + DEBUGGEE_EXCEPTION1)) { + log.display(">> Exception event equals to expected " + + exEvent.exception().referenceType().name()); + exc1Count += 1; + } + break; + case 2: + if (exEvent.exception().referenceType().name().equals( + DEBUGGEE_EXCEPTION2)) { + log.display(">> Exception event equals to expected " + + exEvent.exception().referenceType().name()); + exc2Count += 1; + } + break; + case 3: + if (exEvent.exception().referenceType().name().equals( + DEBUGGEE_EXCEPTION3)) { + log.display(">> Exception event equals to expected " + + exEvent.exception().referenceType().name()); + exc3Count += 1; + } + break; + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event); + } + } + if (isConnected) { + eventSet.resume(); + } + } + } while (isConnected); + } catch (InterruptedException e) { + totalRes = FAILED; + log.complain("FAILURE in EventListener: caught unexpected " + + e); + } catch (VMDisconnectedException e) { + totalRes = FAILED; + log.complain("FAILURE in EventListener: caught unexpected " + + e); + e.printStackTrace(); + } + log.display("EventListener: exiting"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001/TestDescription.java new file mode 100644 index 00000000000..3590fd21bf5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001/TestDescription.java @@ -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/ExceptionEvent/_itself_/exevent001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that caught exception events are properly reported + * or not reported by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with two combinations of boolean parameter notifyCaught. + * The debuggee part of the test raises three caught exceptions: + * - own exevent001tException; + * - IllegalMonitorStateException; + * - NumberFormatException in another class + * COMMENTS + * See also a product bug 4323439. The test was fixed due to + * the bug 4434819. + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent001 + * nsk.jdi.ExceptionEvent._itself_.exevent001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001t.java new file mode 100644 index 00000000000..895dd5a46e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent001t.java @@ -0,0 +1,96 @@ +/* + * 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.ExceptionEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent001t { + static ArgumentHandler argHandler; + + public static void main(String args[]) { + exevent001t _exevent001t = new exevent001t(); + System.exit(exevent001.JCK_STATUS_BASE + + _exevent001t.communication(args)); + } + + private static void raiseEx() throws exevent001tException { + throw new exevent001tException(); + } + + static void raiseException(int testCase) { + switch(testCase) { + case 1: // raise own Exception then catch it + try { + raiseEx(); + } catch (exevent001tException e) {} + break; + case 2: // raise IllegalMonitorStateException then catch it + Object obj = new Object(); + try { + obj.notify(); + } catch (IllegalMonitorStateException e) {} + break; + case 3: // raise NumberFormatException in another class + new exevent001tNFException("oops!"); + break; + } + } + + int communication(String args[]) { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + do { + pipe.println(exevent001.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent001.COMMAND_TEST1)) { + raiseException(1); + } else if (command.equals(exevent001.COMMAND_TEST2)) { + raiseException(2); + } else if (command.equals(exevent001.COMMAND_TEST3)) { + raiseException(3); + } else if (command.equals(exevent001.COMMAND_QUIT)) { + break; + } else { + System.err.println("TEST BUG: Debuggee: unknown command: " + + command); + return exevent001.FAILED; + } + } while(true); + return exevent001.PASSED; + } +} + +class exevent001tException extends Exception {} + +class exevent001tNFException { + exevent001tNFException(String arg) { + try { + int i = Integer.parseInt(arg); + } catch (NumberFormatException e) {} + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002.java new file mode 100644 index 00000000000..add38110b0c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002.java @@ -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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that uncaught exception event is properly reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true value of boolean parameter notifyUncaught. + * The debuggee part of the test raises own uncaught exevent002tException. + */ + +public class exevent002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent002t"; + static final String DEBUGGEE_EXCEPTION = DEBUGGEE_CLASS + "Exception"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private static EventRequestManager erManager; + private ExceptionRequest eRequest; + private static ReferenceType rType, rTypeEx; + private int counter = 0; + private String cmd; + private volatile int totalRes = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent002().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "exevent002t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + debuggee.resume(); + cmd = pipe.readln(); + + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + return quitDebuggee(FAILED); + } + if ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + return quitDebuggee(FAILED); + } + if ((rTypeEx = debuggee.classByName(DEBUGGEE_EXCEPTION)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_EXCEPTION); + return quitDebuggee(FAILED); + } + +/* Create a new ExceptionRequest with true notifyUncaught parameter + so uncaught exceptions should be reported. */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(false, true)) == null) { + return quitDebuggee(FAILED); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate uncaught exception"); + counter = 0; + pipe.println(COMMAND_RUN); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + return quitDebuggee(FAILED); + } + + if (counter == 0) { + log.complain("TEST FAILED: uncaught exception " + rTypeEx.name() + + " was not reported by the debugger"); + return FAILED; + } + return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(rTypeEx, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee(int stat) { + if (eRequest != null) { + eRequest.disable(); + } + + pipe.println(COMMAND_QUIT); + + if (elThread != null) { + elThread.isConnected = false; + try { + if (elThread.isAlive()) + elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + + e); + stat = FAILED; + } + } + + int debStat = debuggee.endDebugee(); + if (debStat != (JCK_STATUS_BASE + PASSED)) { + log.complain("TEST FAILED: debuggee's process finished with status: " + + debStat); + stat = FAILED; + } else + log.display("Debuggee's process finished with status: " + + debStat); + + return stat; + } + class EventListener extends Thread { + public volatile boolean isConnected = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().equals(rTypeEx)) { + log.display("Exception event equals to expected \n\t" + + exEvent.exception().referenceType().name()); + counter++; + log.display("\t" + "counter = " + counter); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event); + } + } + if (isConnected) { + eventSet.resume(); + } + } + } while (isConnected); + } catch (InterruptedException e) { + totalRes = FAILED; + log.complain("FAILURE in EventListener: caught unexpected " + + e); + } catch (VMDisconnectedException e) { + totalRes = FAILED; + log.complain("FAILURE in EventListener: caught unexpected " + + e); + e.printStackTrace(); + } + log.display("EventListener: exiting"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002/TestDescription.java new file mode 100644 index 00000000000..1276093c2cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ExceptionEvent/_itself_/exevent002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that uncaught exception event is properly reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true value of boolean parameter notifyUncaught. + * The debugee part of the test raises own uncaught crexreq002tException. + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent002 + * nsk.jdi.ExceptionEvent._itself_.exevent002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002t.java new file mode 100644 index 00000000000..6b8be28361e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent002t.java @@ -0,0 +1,52 @@ +/* + * 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.ExceptionEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent002t { + public static void main(String args[]) throws exevent002tException { + exevent002t _exevent002t = new exevent002t(); + System.exit(exevent002.JCK_STATUS_BASE + _exevent002t.communication(args)); + } + + int communication(String args[]) throws exevent002tException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + exevent002tException userException = new exevent002tException(); + + pipe.println(exevent002.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent002.COMMAND_RUN)) + throw userException; + else + return exevent002.FAILED; + } +} + +class exevent002tException extends Exception {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003.java new file mode 100644 index 00000000000..cc38cd69580 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003.java @@ -0,0 +1,251 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that uncaught exception event is not reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with false value of boolean parameter notifyUncaught. + * The debugee part of the test raises own uncaught exevent003tException. + */ + +public class exevent003 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent003t"; + static final String DEBUGGEE_EXCEPTION = DEBUGGEE_CLASS + "Exception"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private static EventRequestManager erManager; + private ExceptionRequest eRequest; + private static ReferenceType rType, rTypeEx; + private int counter = 0; + private String cmd; + private volatile int tot_res = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent003().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "exevent003t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + 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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + tot_res = FAILED; + return quitDebuggee(); + } + if ((rTypeEx = debuggee.classByName(DEBUGGEE_EXCEPTION)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_EXCEPTION); + tot_res = FAILED; + return quitDebuggee(); + } + +/* Create a new ExceptionRequest with false notifyUncaught parameter + so uncaught exceptions should not be reported. */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(false, false)) == null) { + tot_res = FAILED; + return quitDebuggee(); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate uncaught exception"); + counter = 0; + pipe.println(COMMAND_RUN); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + if (counter != 0) { + log. complain("TEST FAILED: uncaught exception " + rTypeEx.name() + + " was reported by the debugger"); + return FAILED; + } + else return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(rType, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee() { + if (eRequest != null) { + eRequest.disable(); + } + + pipe.println(COMMAND_QUIT); + + 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; + } + } + + int debStat = debuggee.endDebugee(); + 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(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent.toString()); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().equals(rTypeEx)) { + log.display("Exception event equals to expected \n\t" + + exEvent.exception().referenceType().name()); + counter++; + log.display("\t" + "counter = " + counter); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event.toString()); + } + } + 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"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003/TestDescription.java new file mode 100644 index 00000000000..af76f1ee1f7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ExceptionEvent/_itself_/exevent003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that uncaught exception event is not reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with false value of boolean parameter notifyUncaught. + * The debugee part of the test raises own uncaught crexreq003tException. + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent003 + * nsk.jdi.ExceptionEvent._itself_.exevent003t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003t.java new file mode 100644 index 00000000000..6ede86d2cfa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent003t.java @@ -0,0 +1,52 @@ +/* + * 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.ExceptionEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent003t { + public static void main(String args[]) throws exevent003tException { + exevent003t _exevent003t = new exevent003t(); + System.exit(exevent003.JCK_STATUS_BASE + _exevent003t.communication(args)); + } + + int communication(String args[]) throws exevent003tException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + exevent003tException userException = new exevent003tException(); + + pipe.println(exevent003.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent003.COMMAND_RUN)) + throw userException; + else + return exevent003.FAILED; + } +} + +class exevent003tException extends Exception {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004.java new file mode 100644 index 00000000000..85d0e31982d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004.java @@ -0,0 +1,248 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that uncaught exception event is properly reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true value of boolean parameter notifyUncaught. + * The debugee part of the test raises uncaught StackOverflowException by + * recursion calls of the same method. + */ + +public class exevent004 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent004t"; + static final String DEBUGGEE_EXCEPTION = "java.lang.ArithmeticException"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private EventRequestManager erManager; + private ExceptionRequest eRequest; + private ReferenceType rType; + private int counter = 0; + private String cmd; + private volatile int tot_res = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent004().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "exevent004t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + 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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + tot_res = FAILED; + return quitDebuggee(); + } + +/* Create a new ExceptionRequest with true notifyUncaught parameter + so uncaught exceptions should be reported. */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(false, true)) == null) { + tot_res = FAILED; + return quitDebuggee(); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate uncaught exception"); + counter = 0; + pipe.println(COMMAND_RUN); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + if (counter == 0) { + log.complain("TEST FAILED: uncaught exception " + DEBUGGEE_EXCEPTION + + " was not reported by the debugger"); + return FAILED; + } + else return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(null, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee() { + if (eRequest != null) { + eRequest.disable(); + } + + 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); + + int debStat = debuggee.endDebugee(); + 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(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent.toString()); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().name().equals(DEBUGGEE_EXCEPTION)) { + log.display("Exception event equals to expected \n\t" + + exEvent.exception().referenceType().name()); + counter++; + log.display("\t" + "counter = " + counter); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event.toString()); + } + } + 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"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004/TestDescription.java new file mode 100644 index 00000000000..56bd168d280 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ExceptionEvent/_itself_/exevent004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that uncaught exception event is properly reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true value of boolean parameter notifyUncaught. + * The debugee part of the test rai7~ses uncaught ArithmeticException by + * deviding integer by zero + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent004 + * nsk.jdi.ExceptionEvent._itself_.exevent004t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004t.java new file mode 100644 index 00000000000..d6901be9191 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent004t.java @@ -0,0 +1,55 @@ +/* + * 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.ExceptionEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent004t { + public static void main(String args[]) { + exevent004t _exevent004t = new exevent004t(); + System.exit(exevent004.JCK_STATUS_BASE + _exevent004t.communication(args)); + } + + private static void raiseArithmeticException() { + int foo = 10; + foo = foo / 0; + } + + int communication(String args[]) throws ArithmeticException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(exevent004.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent004.COMMAND_RUN)) { + raiseArithmeticException(); + return exevent004.PASSED; + } else + return exevent004.FAILED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005.java new file mode 100644 index 00000000000..12087f79495 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005.java @@ -0,0 +1,247 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that uncaught exception event is not reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with false value of boolean parameter notifyUncaught. + * The debugee part of the test raises uncaught StackOverflowException + * by recursion calls of the same method. + */ + +public class exevent005 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent005t"; + static final String DEBUGGEE_EXCEPTION = "java.lang.ArithmeticException"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private EventRequestManager erManager; + private ExceptionRequest eRequest; + private ReferenceType rType; + private int counter = 0; + private String cmd; + private volatile int tot_res = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent005().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "exevent005t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + 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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + tot_res = FAILED; + return quitDebuggee(); + } + +/* Create a new ExceptionRequest with false notifyUncaught parameter + so uncaught exceptions should not be reported. */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(false, false)) == null) { + tot_res = FAILED; + return quitDebuggee(); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate uncaught exception"); + counter = 0; + pipe.println(COMMAND_RUN); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + if (counter != 0) { + log.complain("TEST FAILED: uncaught exception " + DEBUGGEE_EXCEPTION + + " was reported by the debugger"); + return FAILED; + } + else return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(null, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee() { + if (eRequest != null) { + eRequest.disable(); + } + + 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); + + int debStat = debuggee.endDebugee(); + 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(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent.toString()); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().name().equals(DEBUGGEE_EXCEPTION)) { + log.display("Exception event equals to expected \n\t" + + exEvent.exception().referenceType().name()); + counter++; + log.display("\t" + "counter = " + counter); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event.toString()); + } + } + 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"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005/TestDescription.java new file mode 100644 index 00000000000..85bcc6d6091 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ExceptionEvent/_itself_/exevent005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that uncaught exception event is not reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with false value of boolean parameter notifyUncaught. + * The debugee part of the test rai7~ses uncaught ArithmeticException by + * deviding integer by zero + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent005 + * nsk.jdi.ExceptionEvent._itself_.exevent005t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005t.java new file mode 100644 index 00000000000..2360b1dd963 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent005t.java @@ -0,0 +1,55 @@ +/* + * 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.ExceptionEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent005t { + public static void main(String args[]) { + exevent005t _exevent005t = new exevent005t(); + System.exit(exevent005.JCK_STATUS_BASE + _exevent005t.communication(args)); + } + + private static void raiseArithmeticException() { + int foo = 10; + foo = foo / 0; + } + + int communication(String args[]) throws ArithmeticException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(exevent005.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent005.COMMAND_RUN)) { + raiseArithmeticException(); + return exevent005.PASSED; + } else + return exevent005.FAILED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006.java new file mode 100644 index 00000000000..9ead1af3517 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006.java @@ -0,0 +1,249 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that uncaught exception event is properly reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true value of boolean parameter notifyUncaught. + * The debugee part of the test raises uncaught NumberFormatException + * in another class. + */ + +public class exevent006 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent006t"; +// static final String DEBUGGEE_EXCEPTION = "java.lang.NumberFormatException"; + static final String DEBUGGEE_EXCEPTION = "java.lang.reflect.InvocationTargetException"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private EventRequestManager erManager; + private ExceptionRequest eRequest; + private ReferenceType rType; + private int counter = 0; + private String cmd; + private volatile int tot_res = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent006().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "exevent006t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + 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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + tot_res = FAILED; + return quitDebuggee(); + } + +/* Create a new ExceptionRequest with true notifyUncaught parameter + so uncaught exceptions should be reported. */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(false, true)) == null) { + tot_res = FAILED; + return quitDebuggee(); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate uncaught exception"); + counter = 0; + pipe.println(COMMAND_RUN); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + if (counter == 0) { + log.complain("TEST FAILED: uncaught exception " + DEBUGGEE_EXCEPTION + + " was not reported by the debugger"); + return FAILED; + } + else return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(null, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee() { + if (eRequest != null) { + eRequest.disable(); + } + + 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); + + int debStat = debuggee.endDebugee(); + 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(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent.toString()); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().name().equals(DEBUGGEE_EXCEPTION)) { + log.display("Exception event equals to expected \n\t" + + exEvent.exception().referenceType().name()); + counter++; + log.display("\t" + "counter = " + counter); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event.toString()); + } + } + 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"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006/TestDescription.java new file mode 100644 index 00000000000..40365a0bed6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006/TestDescription.java @@ -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/ExceptionEvent/_itself_/exevent006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that uncaught exception event is properly reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true value of boolean parameter notifyUncaught. + * The debugee part of the test raises NumberFormatException in + * another class, which is caught by Method.invoke() and enveloped + * into uncaught InvokationTargetException. + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent006 + * nsk.jdi.ExceptionEvent._itself_.exevent006t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006t.java new file mode 100644 index 00000000000..ca08aa0fe3e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent006t.java @@ -0,0 +1,73 @@ +/* + * 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.ExceptionEvent._itself_; + +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent006t { + public static void main(String args[]) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + exevent006t _exevent006t = new exevent006t(); + System.exit(exevent006.JCK_STATUS_BASE + _exevent006t.communication(args)); + } + + int communication(String args[]) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(exevent006.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent006.COMMAND_RUN)) { + Class testClass = Class.forName(exevent006.DEBUGGEE_CLASS+"Exception"); + Class methodArgs[] = { String.class }; + Method testMeth = testClass.getMethod("exevent006traiseEx", methodArgs); + Object testInstance = testClass.newInstance(); + Object parameters[] = { "oops!" }; + Object result = testMeth.invoke(testInstance, parameters); + + return exevent006.PASSED; + } else + return exevent006.FAILED; + } +} + +class exevent006tException { + public void exevent006traiseEx(String arg) { + int i = Integer.parseInt(arg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007.java new file mode 100644 index 00000000000..06f2b698e7d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007.java @@ -0,0 +1,248 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that uncaught exception event is not reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with false value of boolean parameter notifyUncaught. + * The debugee part of the test raises uncaught NumberFormatException + * in another class. + */ + +public class exevent007 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent007t"; +// static final String DEBUGGEE_EXCEPTION = "java.lang.NumberFormatException"; + static final String DEBUGGEE_EXCEPTION = "java.lang.reflect.InvocationTargetException"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_RUN = "run"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private EventRequestManager erManager; + private ExceptionRequest eRequest; + private ReferenceType rType; + private int counter = 0; + private String cmd; + private volatile int tot_res = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent007().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "crexreq006t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + 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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + tot_res = FAILED; + return quitDebuggee(); + } + +/* Create a new ExceptionRequest with false notifyUncaught parameter + so uncaught exceptions should not be reported. */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(false, false)) == null) { + tot_res = FAILED; + return quitDebuggee(); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate uncaught exception"); + counter = 0; + pipe.println(COMMAND_RUN); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + if (counter != 0) { + log.complain("TEST FAILED: uncaught exception " + DEBUGGEE_EXCEPTION + + " was reported by the debugger"); + return FAILED; + } + else return PASSED; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(null, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee() { + if (eRequest != null) { + eRequest.disable(); + } + + 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); + + int debStat = debuggee.endDebugee(); + 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(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent.toString()); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().name().equals(DEBUGGEE_EXCEPTION)) { + log.display("Exception event equals to expected \n\t" + + exEvent.exception().referenceType().name()); + counter++; + log.display("\t" + "counter = " + counter); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event.toString()); + } + } + 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"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007/TestDescription.java new file mode 100644 index 00000000000..64c33265734 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007/TestDescription.java @@ -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/ExceptionEvent/_itself_/exevent007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that uncaught exception event is not reported + * by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with false value of boolean parameter notifyUncaught. + * The debugee part of the test raises NumberFormatException in + * another class, which is caught by Method.invoke() and enveloped + * into uncaught InvokationTargetException. + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent007 + * nsk.jdi.ExceptionEvent._itself_.exevent007t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007t.java new file mode 100644 index 00000000000..1978c74e054 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent007t.java @@ -0,0 +1,73 @@ +/* + * 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.ExceptionEvent._itself_; + +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent007t { + public static void main(String args[]) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + exevent007t _exevent007t = new exevent007t(); + System.exit(exevent007.JCK_STATUS_BASE + _exevent007t.communication(args)); + } + + int communication(String args[]) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(exevent007.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent007.COMMAND_RUN)) { + Class testClass = Class.forName(exevent007.DEBUGGEE_CLASS+"Exception"); + Class methodArgs[] = { String.class }; + Method testMeth = testClass.getMethod("exevent007traiseEx", methodArgs); + Object testInstance = testClass.newInstance(); + Object parameters[] = { "oops!" }; + Object result = testMeth.invoke(testInstance, parameters); + + return exevent007.PASSED; + } else + return exevent007.FAILED; + } +} + +class exevent007tException { + public void exevent007traiseEx(String arg) { + int i = Integer.parseInt(arg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008.java new file mode 100644 index 00000000000..51ea853676a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008.java @@ -0,0 +1,275 @@ +/* + * 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.ExceptionEvent._itself_; + +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.request.EventRequestManager; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.ExceptionRequest; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.EventSet; +import com.sun.jdi.event.EventIterator; +import com.sun.jdi.event.ExceptionEvent; +import com.sun.jdi.event.VMDisconnectEvent; +import com.sun.jdi.event.VMDeathEvent; +import com.sun.jdi.VMDisconnectedException; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that both caught and uncaught exception events + * are properly reported by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true values of boolean parameters notifyCaught + * and notifyUncaught. + * The debugee part of the test raises two exceptions: + *
  • own caught exevent008tException + *
  • uncaught NumberFormatException in another class + */ + +public class exevent008 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; //milliseconds + + static final String DEBUGGEE_CLASS = "nsk.jdi.ExceptionEvent._itself_.exevent008t"; + static final String DEBUGGEE_EXCEPTION1 = DEBUGGEE_CLASS + "Exception"; +// static final String DEBUGGEE_EXCEPTION2 = "java.lang.NumberFormatException"; + static final String DEBUGGEE_EXCEPTION2 = "java.lang.reflect.InvocationTargetException"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_TEST1 = "test1"; + static final String COMMAND_TEST2 = "test2"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private EventListener elThread; + private VirtualMachine vm; + private EventRequestManager erManager; + private ExceptionRequest eRequest; + private ReferenceType rType, rTypeEx; + private String cmd; + private int counter1 = 0, counter2 = 0; + private volatile int tot_res = PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + JCK_STATUS_BASE); // JCK-style exit status. + } + + public static int run(String argv[], PrintStream out) { + return new exevent008().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "crexreq006t.err> "); + vm = debuggee.VM(); + erManager = vm.eventRequestManager(); + + log.display("Resuming debuggee"); + 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 ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + DEBUGGEE_CLASS); + tot_res = FAILED; + return quitDebuggee(); + } + +/* Create a new ExceptionRequest with true notifyCaught and notifyUncaught + parameters so all exceptions should be reported */ + log.display("Creating ExceptionEvent request"); + if ((eRequest = createExReq(true, true)) == null) { + tot_res = FAILED; + return quitDebuggee(); + } + + log.display("Starting events listener"); + EventListener elThread = new EventListener(); + elThread.start(); + + log.display("Forcing debuggee to generate caught exception"); + counter1 = 0; + pipe.println(COMMAND_TEST1); + + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = FAILED; + return quitDebuggee(); + } + log.display("Exception caught"); + + log.display("Forcing debuggee to generate uncaught exception"); + counter1 = 0; + pipe.println(COMMAND_TEST2); + + log.display("Waiting for debuggee exits due to uncaught exception"); + debuggee.waitFor(); + log.display("Debuggee exited"); + + log.display("Waiting for all events recieved"); + try { + if (elThread.isAlive()) elThread.join(); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException " + e); + tot_res = FAILED; + return quitDebuggee(); + } + + if (counter1 == 0) { + log.complain("TEST FAILED: caught exception " + DEBUGGEE_EXCEPTION1 + + " was not reported by the debugger"); + tot_res = FAILED; + } + if (counter2 == 0) { + log.complain("TEST FAILED: uncaught exception " + DEBUGGEE_EXCEPTION2 + + " was not reported by the debugger"); + tot_res = FAILED; + } + + return tot_res; + } + + private ExceptionRequest createExReq(boolean notifyC, boolean notifyUnc) { + ExceptionRequest eRequest; + try { + eRequest = erManager.createExceptionRequest(null, notifyC, notifyUnc); + } catch (Exception e) { + log.complain("createExceptionRequest: " + e); + return null; + } + eRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + eRequest.enable(); + return eRequest; + } + + private int quitDebuggee() { + if (eRequest != null) { + eRequest.disable(); + } + + 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); + + int debStat = debuggee.endDebugee(); + 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(TIMEOUT_DELTA); + if (eventSet != null) { // there is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDeathEvent) { + isConnected = false; + } else if (event instanceof VMDisconnectEvent) { + isConnected = false; + } else if (event instanceof ExceptionEvent) { + ExceptionEvent exEvent = (ExceptionEvent) event; + log.display("EventListener: following ExceptionEvent occured: \n\t" + + exEvent.toString()); + + if (eRequest.equals(event.request())) { + if (exEvent.exception().referenceType().name().equals(DEBUGGEE_EXCEPTION1)) { + log.display("CException event equals to expected for caught exception\n\t" + + exEvent.exception().referenceType().name()); + counter1++; + log.display("\t" + "counter1 = " + counter1); + } else if (exEvent.exception().referenceType().name().equals(DEBUGGEE_EXCEPTION2)) { + log.display("Exception event equals to expected for uncaught exception\n\t" + + exEvent.exception().referenceType().name()); + counter2++; + log.display("\t" + "counter2 = " + counter2); + } + } + } else { + log.display("EventListener: following JDI event occured: \n\t" + + event.toString()); + } + } + 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"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008/TestDescription.java new file mode 100644 index 00000000000..d47cecc3e18 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008/TestDescription.java @@ -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/ExceptionEvent/_itself_/exevent008. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that both caught and uncaught exception events + * are properly reported by the debugger. It calls + * com.sun.jdi.request.EventRequestManager.createExceptionRequest() + * method with true values of boolean parameters notifyCaught and + * notifyUncaught. + * The debugee part of the test raises two exceptions: + * - caught own exevent008tException; + * - uncaught InvokationTargetException with enveloped NumberFormatException + * in another class + * COMMENTS + * See also bug 4323439 + * -------------------------------- + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * -------------------------------- + * To fix 4615225, + * the test suite was moved here. + * -------------------------------- + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - quit on VMDeathEvent is added to event handling loop + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent._itself_.exevent008 + * nsk.jdi.ExceptionEvent._itself_.exevent008t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent._itself_.exevent008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008t.java new file mode 100644 index 00000000000..72b3bbcf129 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008t.java @@ -0,0 +1,104 @@ +/* + * 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.ExceptionEvent._itself_; + +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class exevent008t { + public static void main(String args[]) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + exevent008t _exevent008t = new exevent008t(); + System.exit(exevent008.JCK_STATUS_BASE + _exevent008t.communication(args)); + } + + private static void raiseEx() throws exevent008tException { + throw new exevent008tException(); + } + + static void raiseException(int testCase) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + switch(testCase) { + case 1: // raise own Exception then catch it + try { + raiseEx(); + } catch (exevent008tException e) {} + break; + case 2: // raise uncaught InvokationTargerexception with enveloped + // NumberFormatException in another class + Class testClass = Class.forName(exevent008.DEBUGGEE_CLASS+"NFException"); + Class args[] = { String.class }; + Method testMeth = testClass.getMethod("exevent008traiseEx", args); + Object testInstance = testClass.newInstance(); + Object parameters[] = { "oops!" }; + Object result = testMeth.invoke(testInstance, parameters); + break; + } + } + + int communication(String args[]) throws ClassNotFoundException, + NoSuchMethodException, + InstantiationException, + IllegalAccessException, + InvocationTargetException { + String command; + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + do { + pipe.println(exevent008.COMMAND_READY); + command = pipe.readln(); + if (command.equals(exevent008.COMMAND_TEST1)) { + raiseException(1); + } else if (command.equals(exevent008.COMMAND_TEST2)) { + raiseException(2); + } else if (command.equals(exevent008.COMMAND_QUIT)) { + break; + } else { + System.err.println("TEST BUG: Debugee: unknown command: " + + command); + return exevent008.FAILED; + } + } while(true); + return exevent008.PASSED; + } +} + +class exevent008tException extends Exception {} + +class exevent008tNFException { + public void exevent008traiseEx(String arg) { + int i = Integer.parseInt(arg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location001.java new file mode 100644 index 00000000000..1d18901dcda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location001.java @@ -0,0 +1,428 @@ +/* + * 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.ExceptionEvent.catchLocation; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class location001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // time interval to wait for events + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + static final String COMMAND_ERROR = "error"; + + // checked classes names + static final String DEBUGGEE_NAME = "nsk.jdi.ExceptionEvent.catchLocation.location001a"; + + static final String USER_EXCEPTION = DEBUGGEE_NAME + "Exception"; + static final String USER_ERROR = DEBUGGEE_NAME + "Error"; + static final String USER_THROWABLE = DEBUGGEE_NAME + "Throwable"; + static final String JAVA_EXCEPTION = "java.lang.NumberFormatException"; + static final String JAVA_ERROR = "java.lang.StackOverflowError"; + + // scaffold objects + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // timeout for waiting events + static private long eventTimeout; + + // mirrors for checked classes and threads in debuggee + static private ExceptionRequest checkedRequest; + static private ReferenceType checkedClass; + static private ThreadReference checkedThread; + + static private ReferenceType userException; + static private ReferenceType userError; + static private ReferenceType userThrowable; + + + // results of receiving particular events + static private boolean userExceptionReceived; + static private boolean userErrorReceived; + static private boolean userThrowableReceived; + static private boolean javaExceptionReceived; + static private boolean javaErrorReceived; + + // results of test execution + static private boolean eventsReceived; + static private boolean testFailed; + + // flag for EventHandler thread + static private volatile boolean exceptionsThrown; + + // execute test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // execute test from JCK-compatible harness + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + userExceptionReceived = false; + userErrorReceived = false; + userThrowableReceived = false; + javaExceptionReceived = false; + javaErrorReceived = false; + eventsReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "location001a >"); + + // create synchronization channel with debuggee + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + EventRequestManager erManager = vm.eventRequestManager(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // catch exceptions while testing and finally quit debuggee + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors of checked classes in debuggee + log.display("Getting loaded classes in debuggee"); + if ((checkedClass = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + DEBUGGEE_NAME); + } + + if ((userException = debuggee.classByName(USER_EXCEPTION)) == null) { + throw new Failure("TEST BUG: cannot find " + USER_EXCEPTION); + } + + if ((userError = debuggee.classByName(USER_ERROR)) == null) { + throw new Failure("TEST BUG: cannot find " + USER_ERROR); + } + + if ((userThrowable = debuggee.classByName(USER_THROWABLE)) == null) { + throw new Failure("TEST BUG: cannot find " + USER_THROWABLE); + } + + // get mirror of main thread in debuggee + log.display("Getting reference to main thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + // create ExceptionRequest for all throwable classes (initially disabled) + log.display("Creating ExceptionRequest"); + boolean notifyCaught = true; + boolean notifyUncaught = true; + if ((checkedRequest = erManager.createExceptionRequest(null, notifyCaught, notifyUncaught)) == null) { + throw new Failure("TEST BUG: unable to create ExceptionRequest"); + } + + // define separate thread for handling received events + class EventHandler extends Thread { + public void run() { + // handle events until all exceptions thrown and + // all expected events received + while (!(exceptionsThrown && eventsReceived)) { + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + log.complain("Unexpected InterruptedException while receiving event: " + e); + break; + } + + if (eventSet == null) { + continue; + } + + // handle each event from event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + if (EventFilters.filtered(event)) + continue; + + // handle ExceptionEvent + if (event instanceof ExceptionEvent) { + + ExceptionEvent castedEvent = (ExceptionEvent)event; + ReferenceType eventRefType = castedEvent.exception().referenceType(); + Location eventLocation = castedEvent.location(); + Location eventCatchLocation = castedEvent.catchLocation(); + + if (eventRefType.equals(userException)) { + log.display("ExceptionEvent for " + USER_EXCEPTION + " is received"); + userExceptionReceived = true; + if (eventLocation.lineNumber() != location001a.userExceptionLocation) { + log.complain("FAILURE 1: incorrect location for " + USER_EXCEPTION + + "\nexpected: " + location001a.userExceptionLocation + ", got: " + eventLocation.lineNumber()); + testFailed = true; + } + if (eventCatchLocation.lineNumber() != location001a.userExceptionCatchLocation) { + log.complain("FAILURE 1: incorrect catchLocation for " + USER_EXCEPTION + + "\nexpected: " + location001a.userExceptionCatchLocation + ", got: " + eventCatchLocation.lineNumber()); + testFailed = true; + } + if (!(eventLocation.declaringType().equals(checkedClass))) { + log.complain("FAILURE 2: catchLocation.declaringType() does not equal to debuggee class:"); + testFailed = true; + log.complain(eventLocation.declaringType().name()); + } + + } else if (eventRefType.equals(userError)) { + log.display("ExceptionEvent for " + USER_ERROR + " is received"); + userErrorReceived = true; + if (eventLocation.lineNumber() != location001a.userErrorLocation) { + log.complain("FAILURE 3: incorrect location for " + USER_ERROR + + "\nexpected: " + location001a.userErrorLocation + ", got: " + eventLocation.lineNumber()); + testFailed = true; + } + if (eventCatchLocation.lineNumber() != location001a.userErrorCatchLocation) { + log.complain("FAILURE 3: incorrect catchLocation for " + USER_ERROR + + "\nexpected: " + location001a.userErrorCatchLocation + ", got: " + eventCatchLocation.lineNumber()); + testFailed = true; + } + if (!(eventLocation.declaringType().equals(checkedClass))) { + log.complain("FAILURE 4: catchLocation.declaringType() does not equal to debuggee class:"); + testFailed = true; + log.complain(eventLocation.declaringType().name()); + } + + } else if (eventRefType.equals(userThrowable)) { + log.display("ExceptionEvent for " + USER_THROWABLE + " is received"); + userThrowableReceived = true; + if (eventLocation.lineNumber() != location001a.userThrowableLocation) { + log.complain("FAILURE 5: incorrect location for " + USER_THROWABLE + + "\nexpected: " + location001a.userThrowableLocation + ", got: " + eventLocation.lineNumber()); + testFailed = true; + } + if (eventCatchLocation.lineNumber() != location001a.userThrowableCatchLocation) { + log.complain("FAILURE 5: incorrect catchLocation for " + USER_THROWABLE + + "\nexpected: " + location001a.userThrowableCatchLocation + ", got: " + eventCatchLocation.lineNumber()); + testFailed = true; + } + if (!(eventLocation.declaringType().equals(checkedClass))) { + log.complain("FAILURE 6: catchLocation.declaringType() does not equal to debuggee class:"); + testFailed = true; + log.complain(eventLocation.declaringType().name()); + } + } else { + String eventTypeName = eventRefType.name(); + if (eventTypeName.equals(JAVA_EXCEPTION)) { + log.display("ExceptionEvent for " + JAVA_EXCEPTION + " is received"); + javaExceptionReceived = true; + if (eventCatchLocation.lineNumber() != location001a.javaExceptionCatchLocation) { + log.complain("FAILURE 7: incorrect catchLocation for " + JAVA_EXCEPTION + + "\nexpected: " + location001a.javaExceptionCatchLocation + ", got: " + eventCatchLocation.lineNumber()); + testFailed = true; + } + + } else if (eventTypeName.equals(JAVA_ERROR)) { + log.display("ExceptionEvent for " + JAVA_ERROR + " is received"); + javaErrorReceived = true; + if (eventCatchLocation.lineNumber() != location001a.javaErrorCatchLocation) { + log.complain("FAILURE 8: incorrect catchLocation for " + JAVA_ERROR + + "\nexpected: " + location001a.javaErrorCatchLocation + ", got: " + eventCatchLocation.lineNumber()); + testFailed = true; + } + } + } + } + + // ignore each other events + + } // end of event handling loop + + log.display("Resuming event set"); + eventSet.resume(); + + // check if all expected events received + eventsReceived = userExceptionReceived && userErrorReceived + && userThrowableReceived && javaExceptionReceived + && javaErrorReceived; + + } // end of event set handling loop + + log.display("eventHandler completed"); + + } // end of run() + + } // end of EventHandler + + // start EventHandler thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // enable event request + log.display("Enabling ExceptionRequest"); + checkedRequest.enable(); + + // force debuggee to throw exceptions and generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // wait for debuggee completed test case + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command.equals(COMMAND_ERROR)) { + throw new Failure("TEST BUG: Unable to thrown all exceptions in debuggee"); + } + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // notify EventHandler that all checked exceptions thrown in debuggee + exceptionsThrown = true; + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // complain if not all expected events received + if (!userExceptionReceived) { + log.complain("FAILURE 9: " + USER_EXCEPTION + " was not received received"); + testFailed= true; + } + if (!userErrorReceived) { + log.complain("FAILURE 10: " + USER_ERROR + " was not received received"); + testFailed= true; + } + if (!userThrowableReceived) { + log.complain("FAILURE 11: " + USER_THROWABLE + " was not received received"); + testFailed= true; + } + if (!javaExceptionReceived) { + log.complain("FAILURE 12: " + JAVA_EXCEPTION + " was not received received"); + testFailed= true; + } + if (!javaErrorReceived) { + log.complain("FAILURE 13: " + JAVA_ERROR + " was not received received"); + testFailed= true; + } + + // end testing + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // disable event request to prevent appearance of further events + if (checkedRequest != null && checkedRequest.isEnabled()) { + log.display("Disabling event request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location001/TestDescription.java new file mode 100644 index 00000000000..2335be6dd6f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location001/TestDescription.java @@ -0,0 +1,86 @@ +/* + * 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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ExceptionEvent/catchLocation/location001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.ExceptionEvent.catchLocation() method. + * The test checks the following assertion: + * - method ExceptionEvent.catchLocation() returns for the caught + * Throwable object a correct Location reference to the first code + * index in the appropriate catch clause of enclosing try statement. + * A debugger class - nsk.jdi.ExceptionEvent.catchLocation.location001 ; + * a debuggee class - nsk.jdi.ExceptionEvent.catchLocation.location001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger launches and connects to debuggee, waits for it started, and + * creates the ExceptionRequest with true and + * parameters, which is disabled by default. + * The debugger defines separate thread for listening received + * events, cleans EventQueue, starts , enables ExceptionRequest, + * sends debuggee command to force it to throw exception, and waits for + * notification that all exceptions are thrown. + * Upon receiving command from debugger, the debuggee raises several + * exceptions and errors. All these exceptions and errors are enclosed in + * separate try-catch blocks. Debuggee verifies that all exceptions are + * really thrown and notifies debugger by sending command or . + * Each received event is handled by separate thread. + * For each ExceptionEvent assertions of the test are verified. + * After command received from debuggee, debugger notifies + * that all checked exceptions have been thrown and waits for + * receives all expected events. If not all events received for WAITIME interval, + * debugger interrupts thread and complains about an error. + * Finally, debugger disables event request, sends debuggee command from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: unknown command: " + command); + return FAILED; + } + + // throw checked exceptions + try { + try { + throw new location001aException(); // userExceptionLocation + } catch (location001aException e) { // <= expected catch location due to evaluation of 4740123. // userExceptionLocation + log.display("location001aException is thrown"); + userExceptionThrown = true; + } + + try { + throw new location001aError(); // userErrorLocation + } catch (location001aError e) { // <= expected catch location due to evaluation of 4740123. // userErrorCatchLocation + log.display("location001aError is thrown"); + userErrorThrown = true; + } + + try { + throw new location001aThrowable(); // userThrowableLocation + } catch (location001aThrowable e) { // <= expected catch location due to evaluation of 4740123. // userThrowableCatchLocation + log.display("location001aThrowable is thrown"); + userThrowableThrown = true; + } + + try { + int i = Integer.parseInt("foo"); + } catch (NumberFormatException e) { // <= expected catch location due to evaluation of 4740123. // userThrowableCatchLocation + log.display("NumberFormatException is thrown"); + javaExceptionThrown = true; + } + + try { + raiseStackOverflow(); + } catch (StackOverflowError e) { // <= expected catch location due to evaluation of 4740123. // javaErrorCatchLocation + log.display("StackOverflowError is thrown"); + javaErrorThrown = true; + } + + } catch (Throwable e) { + log.complain("Unexpected Throwable: " + e.getMessage()); + e.printStackTrace(); + if (e instanceof ThreadDeath) { + throw e; + } + } + + // check that all exceptions are thrown + boolean thrown = true; + if (!userExceptionThrown) { + log.complain("TEST BUG: user exception NOT thrown"); + thrown = false; + } + if (!userErrorThrown) { + log.complain("TEST BUG: user error NOT thrown"); + thrown = false; + } + if (!userThrowableThrown) { + log.complain("TEST BUG: user Throwable NOT thrown"); + thrown = false; + } + if (!javaExceptionThrown) { + log.complain("TEST BUG: java exception NOT thrown"); + thrown = false; + } + if (!javaErrorThrown) { + log.complain("TEST BUG: java error NOT thrown"); + thrown = false; + } + + // notify debugger whether all exceptions thrown or not + if (thrown) { + pipe.println(COMMAND_DONE); + } else { + pipe.println(COMMAND_ERROR); + } + + // wait for command from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + log.complain("TEST BUG: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + private void raiseStackOverflow () { + raiseStackOverflow(); + } +} + +class location001aException extends Exception {} + +class location001aError extends Error {} + +class location001aThrowable extends Throwable {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002.java new file mode 100644 index 00000000000..e73874989bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002.java @@ -0,0 +1,276 @@ +/* + * 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.ExceptionEvent.catchLocation; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class location002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // time interval to wait for events + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + static final String COMMAND_ERROR = "error"; + + // checked classes names + static final String DEBUGGEE_NAME = "nsk.jdi.ExceptionEvent.catchLocation.location002a"; + static final String JAVA_EXCEPTION = "java.lang.NumberFormatException"; + + // scaffold objects + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // timeout for waiting events + static private long eventTimeout; + + // mirrors for checked classes and threads in debuggee + static private ExceptionRequest checkedRequest; + static private ReferenceType checkedClass; + static private ThreadReference checkedThread; + + // results of test execution + static private boolean eventsReceived; + static private boolean testFailed; + + // execute test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // execute test from JCK-compatible harness + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "location001a >"); + + // create synchronization channel with debuggee + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + EventRequestManager erManager = vm.eventRequestManager(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // catch exceptions while testing and finally quit debuggee + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors of checked classes in debuggee + log.display("Getting loaded classes in debuggee"); + if ((checkedClass = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + DEBUGGEE_NAME); + } + + // get mirror of main thread in debuggee + log.display("Getting reference to main thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + // create ExceptionRequest for all throwable classes (initially disabled) + log.display("Creating ExceptionRequest"); + boolean notifyCaught = true; + boolean notifyUncaught = true; + if ((checkedRequest = erManager.createExceptionRequest(null, notifyCaught, notifyUncaught)) == null) { + throw new Failure("TEST BUG: unable to create ExceptionRequest"); + } + + // define separate thread for handling received events + class EventHandler extends Thread { + public void run() { + // handle events until expected event received + eventHandlingLoop: + while (!eventsReceived) { + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + log.complain("Unexpected InterruptedException while receiving event: " + e); + break; + } + + if (eventSet == null) { + continue; + } + + // handle each event from event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); +// log.display("Event received:\n " + event); + + // break event handling loop if VMDisconnectEvent received + if (event instanceof VMDisconnectEvent) { + log.display("VMDisconnectEvent received"); + break eventHandlingLoop; + } + + // handle ExceptionEvent + if (event instanceof ExceptionEvent) { + log.display("ExceptionEvent received"); + + ExceptionEvent castedEvent = (ExceptionEvent)event; + ReferenceType eventRefType = castedEvent.exception().referenceType(); + + String eventTypeName = eventRefType.name(); + if (eventTypeName.equals(JAVA_EXCEPTION)) { + log.display("Expected ExceptionEvent for " + JAVA_EXCEPTION + " is received"); + eventsReceived = true; + + Location catchLocation = castedEvent.catchLocation(); + if (catchLocation != null) { + log.complain("FAILURE 1: catchLocation for uncaught " + JAVA_EXCEPTION + + " is not null :"); + log.complain("declaring type: " + catchLocation.declaringType().name()); + log.complain("line number : " + catchLocation.lineNumber()); + } + + } + } + + // ignore each other events + + } // end of event handling loop + +// log.display("Resuming event set"); + eventSet.resume(); + + } // end of event set handling loop + + log.display("eventHandler completed"); + + } // end of run() + + } // end of EventHandler + + // start EventHandler thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // enable event request + log.display("Enabling ExceptionRequest"); + checkedRequest.enable(); + + // force debuggee to throw exceptions and generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // complain if not all expected events received + if (!eventsReceived) { + log.complain("FAILURE 2: " + JAVA_EXCEPTION + " was not received"); + testFailed= true; + } + + // end testing + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + log.display("Debuggee terminated with exit code: " + debuggeeStatus); + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002/TestDescription.java new file mode 100644 index 00000000000..14111b15adf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002/TestDescription.java @@ -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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ExceptionEvent/catchLocation/location002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.ExceptionEvent.catchLocation() method. + * The test checks the following assertion: + * - method ExceptionEvent.catchLocation() returns null for + * uncaught exception. + * A debugger class - nsk.jdi.ExceptionEvent.catchLocation.location002 ; + * a debuggee class - nsk.jdi.ExceptionEvent.catchLocation.location002a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates and enables the ExceptionRequest with true + * and parameters. + * The debugger starts thread for listening events delivered + * from the debuggee. + * Upon receiving command from debugger, the debuggee raises uncaught + * NumberFormatException. + * The debugger switches to to listen the event during the + * time specified by parameter. If debugger receives + * ExceptionEvent, it checks the assertion of the test. The test fails + * if this check fails or no expected ExceptionEvent received. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionEvent.catchLocation.location002 + * nsk.jdi.ExceptionEvent.catchLocation.location002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionEvent.catchLocation.location002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002a.java new file mode 100644 index 00000000000..a0c21394079 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002a.java @@ -0,0 +1,76 @@ +/* + * 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.ExceptionEvent.catchLocation; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; +import java.lang.Integer.*; + +// This class is the debugged application in the test + +class location002a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + static final String COMMAND_ERROR = "error"; + + // start debuggee + public static void main(String args[]) throws Throwable { + location002a _location002a = new location002a(); + System.exit(JCK_STATUS_BASE + _location002a.runIt(args, System.err)); + } + + // perform debugee execution + int runIt(String args[], PrintStream out) throws Throwable { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Log log = new Log(out, argHandler); + + // notify debuggeer that debuggee started + pipe.println(COMMAND_READY); + + // wait for command from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: unknown command: " + command); + return FAILED; + } + + // throw uncaught exception, which should terminate debuggee + System.err.println("Raising NumberFormatException"); + int i = Integer.parseInt("foo"); + + // return FAILED if not terminated by uncaught exception + return FAILED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/exception/exception001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/exception/exception001.java new file mode 100644 index 00000000000..f2730bdac18 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/exception/exception001.java @@ -0,0 +1,701 @@ +/* + * 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.ExceptionEvent.exception; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class exception001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // time interval to wait for events + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + static final String COMMAND_ERROR = "error"; + + // checked classes names + static final String DEBUGGEE_NAME = "nsk.jdi.ExceptionEvent.exception.exception001a"; + + static final String USER_EXCEPTION = DEBUGGEE_NAME + "Exception"; + static final String USER_ERROR = DEBUGGEE_NAME + "Error"; + static final String USER_THROWABLE = DEBUGGEE_NAME + "Throwable"; + static final String JAVA_EXCEPTION = "java.lang.NumberFormatException"; + static final String JAVA_ERROR = "java.lang.StackOverflowError"; + + // scaffold objects + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // timeout for waiting events + static private long eventTimeout; + + // mirrors for checked classes and threads in debuggee + static private ExceptionRequest checkedRequest; + static private ReferenceType checkedClass; + static private ThreadReference checkedThread; + + static private ReferenceType userException; + static private ReferenceType userError; + static private ReferenceType userThrowable; + + + // results of receiving particular events + static private boolean userExceptionReceived; + static private boolean userErrorReceived; + static private boolean userThrowableReceived; + static private boolean javaExceptionReceived; + static private boolean javaErrorReceived; + + // results of test execution + static private boolean eventsReceived; + static private boolean testFailed; + + // flag for EventHandler thread + static private volatile boolean exceptionsThrown; + + // execute test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // execute test from JCK-compatible harness + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + userExceptionReceived = false; + userErrorReceived = false; + userThrowableReceived = false; + javaExceptionReceived = false; + javaErrorReceived = false; + eventsReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "exception001a >"); + + // create synchronization channel with debuggee + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + EventRequestManager erManager = vm.eventRequestManager(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // catch exceptions while testing and finally quit debuggee + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors of checked classes in debuggee + log.display("Getting loaded classes in debuggee"); + if ((checkedClass = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + DEBUGGEE_NAME); + } + + if ((userException = debuggee.classByName(USER_EXCEPTION)) == null) { + throw new Failure("TEST BUG: cannot find " + USER_EXCEPTION); + } + + if ((userError = debuggee.classByName(USER_ERROR)) == null) { + throw new Failure("TEST BUG: cannot find " + USER_ERROR); + } + + if ((userThrowable = debuggee.classByName(USER_THROWABLE)) == null) { + throw new Failure("TEST BUG: cannot find " + USER_THROWABLE); + } + + // get mirror of main thread in debuggee + log.display("Getting reference to main thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + // create ExceptionRequest for all throwable classes (initially disabled) + log.display("Creating ExceptionRequest"); + boolean notifyCaught = true; + boolean notifyUncaught = true; + if ((checkedRequest = erManager.createExceptionRequest(null, notifyCaught, notifyUncaught)) == null) { + throw new Failure("TEST BUG: unable to create ExceptionRequest"); + } + + // define separate thread for handling received events + class EventHandler extends Thread { + public void run() { + // handle events until all exceptions thrown and + // all expected events received + while (!(exceptionsThrown && eventsReceived)) { + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + log.complain("Unexpected InterruptedException while receiving event: " + e); + break; + } + + if (eventSet == null) { + continue; + } + + // handle each event from event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + if (EventFilters.filtered(event)) + continue; + + // handle ExceptionEvent + if (event instanceof ExceptionEvent) { + + ExceptionEvent castedEvent = (ExceptionEvent)event; + + ObjectReference eventThrowable = castedEvent.exception(); + if (eventThrowable == null) { + log.complain("FAILURE 1: ExceptionEvent.exception() returns null"); + testFailed = true; + } else { + ReferenceType eventRefType = castedEvent.exception().referenceType(); + if (eventRefType.equals(userException)) { + log.display("ExceptionEvent for " + USER_EXCEPTION + " is received"); + userExceptionReceived = true; + + Location eventLocation = castedEvent.location(); + if (!(eventLocation.declaringType().name().equals(DEBUGGEE_NAME))) { + log.complain("FAILURE 2: eventLocation.declaringType() does not equal to debuggee class"); + testFailed = true; + } + + } else if (eventRefType.equals(userError)) { + log.display("ExceptionEvent for " + USER_ERROR + " is received"); + userErrorReceived = true; + + Location eventLocation = castedEvent.location(); + if (!(eventLocation.declaringType().name().equals(DEBUGGEE_NAME))) { + log.complain("FAILURE 2: eventLocation.declaringType() does not equal to debuggee class"); + testFailed = true; + } + + } else if (eventRefType.equals(userThrowable)) { + log.display("ExceptionEvent for " + USER_THROWABLE + " is received"); + userThrowableReceived = true; + + Location eventLocation = castedEvent.location(); + if (!(eventLocation.declaringType().name().equals(DEBUGGEE_NAME))) { + log.complain("FAILURE 2: eventLocation.declaringType() does not equal to debuggee class"); + testFailed = true; + } + + } else { + String eventTypeName = eventRefType.name(); + if (eventTypeName.equals(JAVA_EXCEPTION)) { + log.display("ExceptionEvent for " + JAVA_EXCEPTION + " is received"); + javaExceptionReceived = true; + } else if (eventTypeName.equals(JAVA_ERROR)) { + log.display("ExceptionEvent for " + JAVA_ERROR + " is received"); + javaErrorReceived = true; + } + } + } + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 4: eventRequest does not equal to checked request"); + testFailed = true; + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 5: eventThread does not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 6: eventVirtualMachine does not equal to checked vm"); + testFailed = true; + } + } + + // ignore each other events + + } // end of event handling loop + + log.display("Resuming event set"); + eventSet.resume(); + + // check if all expected events received + eventsReceived = userExceptionReceived && userErrorReceived + && userThrowableReceived && javaExceptionReceived + && javaErrorReceived; + + } // end of event set handling loop + + log.display("eventHandler completed"); + + } // end of run() + + } // end of EventHandler + + // start EventHandler thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // enable event request + log.display("Enabling ExceptionRequest"); + checkedRequest.enable(); + + // force debuggee to throw exceptions and generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // wait for debuggee completed test case + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command.equals(COMMAND_ERROR)) { + throw new Failure("TEST BUG: Unable to thrown all exceptions in debuggee"); + } + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // notify EventHandler that all checked exceptions thrown in debuggee + exceptionsThrown = true; + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // complain if not all expected events received + if (!userExceptionReceived) { + log.complain("FAILURE 9: " + USER_EXCEPTION + " was not received received"); + testFailed= true; + } + if (!userErrorReceived) { + log.complain("FAILURE 10: " + USER_ERROR + " was not received received"); + testFailed= true; + } + if (!userThrowableReceived) { + log.complain("FAILURE 11: " + USER_THROWABLE + " was not received received"); + testFailed= true; + } + if (!javaExceptionReceived) { + log.complain("FAILURE 12: " + JAVA_EXCEPTION + " was not received received"); + testFailed= true; + } + if (!javaErrorReceived) { + log.complain("FAILURE 13: " + JAVA_ERROR + " was not received received"); + testFailed= true; + } + + // end testing + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // disable event request to prevent appearance of further events + if (checkedRequest != null && checkedRequest.isEnabled()) { + log.display("Disabling event request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} + + +/* +// This class is the debugger in the test + +public class exception001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String DEBUGGEE_NAME = "nsk.jdi.ExceptionEvent.exception.exception001a"; + static final String USER_EXCEPTION = DEBUGGEE_NAME + "Exception"; + static final String USER_ERROR = DEBUGGEE_NAME + "Error"; + static final String USER_THROWABLE = DEBUGGEE_NAME + "Throwable"; + static final String JAVA_EXCEPTION = "java.lang.NumberFormatException"; + static final String JAVA_ERROR = "java.lang.StackOverflowError"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ExceptionRequest checkedRequest; + static private ReferenceType checkedClass; + static private ThreadReference checkedThread; + + static private ReferenceType userException; + static private ReferenceType userError; + static private ReferenceType userThrowable; + static private boolean userExceptionReceived; + static private boolean userErrorReceived; + static private boolean userThrowableReceived; + static private boolean javaExceptionReceived; + static private boolean javaErrorReceived; + + static private boolean testFailed; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + userExceptionReceived = false; + userErrorReceived = false; + userThrowableReceived = false; + javaExceptionReceived = false; + javaErrorReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "exception001a >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + + log.display("Resuming debuggee"); + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + + while (true) { + + if (!command.equals(COMMAND_READY)) { + log.complain("TEST BUG: unexpected debuggee's command: " + command); + testFailed = true; + break; + } + + log.display("Getting loaded classes in debuggee"); + if ((checkedClass = debuggee.classByName(DEBUGGEE_NAME)) == null) { + log.complain("TEST BUG: cannot find " + DEBUGGEE_NAME); + testFailed = true; + break; + } + + if ((userException = debuggee.classByName(USER_EXCEPTION)) == null) { + log.complain("TEST BUG: cannot find " + USER_EXCEPTION); + testFailed = true; + break; + } + + if ((userError = debuggee.classByName(USER_ERROR)) == null) { + log.complain("TEST BUG: cannot find " + USER_ERROR); + testFailed = true; + break; + } + + if ((userThrowable = debuggee.classByName(USER_THROWABLE)) == null) { + log.complain("TEST BUG: cannot find " + USER_THROWABLE); + testFailed = true; + break; + } + + log.display("Getting reference to main thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + log.complain("TEST BUG: unable to find reference to main thread"); + testFailed = true; + break; + } + + log.display("Creating ExceptionRequest"); + boolean notifyCaught = true; + boolean notifyUncaught = true; + if ((checkedRequest = erManager.createExceptionRequest(null, notifyCaught, notifyUncaught)) == null) { + log.complain("TEST BUG: unable to create ExceptionRequest"); + testFailed = true; + break; + } + + //checkedRequest.addClassFilter(checkedClass); + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + checkedRequest.enable(); + log.display("ExceptionRequest is created"); + + break; + } + if (testFailed) { + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + log.display("Waiting for debuggee terminating"); + debuggee.waitFor(); + return FAILED; + } + + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + isConnected: + while (true) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + if (event instanceof VMDisconnectEvent) { + break isConnected; + } + + if (event instanceof ExceptionEvent) { + + ExceptionEvent castedEvent = (ExceptionEvent)event; + + ObjectReference eventThrowable = castedEvent.exception(); + if (eventThrowable == null) { + log.complain("FAILURE 1: ExceptionEvent.exception() returns null"); + testFailed = true; + } else { + ReferenceType eventRefType = castedEvent.exception().referenceType(); + if (eventRefType.equals(userException)) { + log.display("ExceptionEvent for " + USER_EXCEPTION + " is received"); + userExceptionReceived = true; + + Location eventLocation = castedEvent.location(); + if (!(eventLocation.declaringType().name().equals(DEBUGGEE_NAME))) { + log.complain("FAILURE 2: eventLocation.declaringType() does not equal to debuggee class"); + testFailed = true; + } + + } else if (eventRefType.equals(userError)) { + log.display("ExceptionEvent for " + USER_ERROR + " is received"); + userErrorReceived = true; + + Location eventLocation = castedEvent.location(); + if (!(eventLocation.declaringType().name().equals(DEBUGGEE_NAME))) { + log.complain("FAILURE 2: eventLocation.declaringType() does not equal to debuggee class"); + testFailed = true; + } + + } else if (eventRefType.equals(userThrowable)) { + log.display("ExceptionEvent for " + USER_THROWABLE + " is received"); + userThrowableReceived = true; + + Location eventLocation = castedEvent.location(); + if (!(eventLocation.declaringType().name().equals(DEBUGGEE_NAME))) { + log.complain("FAILURE 2: eventLocation.declaringType() does not equal to debuggee class"); + testFailed = true; + } + + } else { + String eventTypeName = eventRefType.name(); + if (eventTypeName.equals(JAVA_EXCEPTION)) { + log.display("ExceptionEvent for " + JAVA_EXCEPTION + " is received"); + javaExceptionReceived = true; + } else if (eventTypeName.equals(JAVA_ERROR)) { + log.display("ExceptionEvent for " + JAVA_ERROR + " is received"); + javaErrorReceived = true; + } + } + } + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 4: eventRequest does not equal to checked request"); + testFailed = true; + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 5: eventThread does not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 6: eventVirtualMachine does not equal to checked vm"); + testFailed = true; + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + log.display("Waiting for debuggee terminating"); + debuggee.waitFor(); + + if (!userExceptionReceived) { + log.complain("FAILURE 7: " + USER_EXCEPTION + " was not received received"); + testFailed= true; + } + if (!userErrorReceived) { + log.complain("FAILURE 8: " + USER_ERROR + " was not received received"); + testFailed= true; + } + if (!userThrowableReceived) { + log.complain("FAILURE 9: " + USER_THROWABLE + " was not received received"); + testFailed= true; + } + if (!javaExceptionReceived) { + log.complain("FAILURE 10: " + JAVA_EXCEPTION + " was not received received"); + testFailed= true; + } + if (!javaErrorReceived) { + log.complain("FAILURE 11: " + JAVA_ERROR + " was not received received"); + testFailed= true; + } + + if (testFailed) return FAILED; + return PASSED; + } + +} + +*/ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/exception/exception001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/exception/exception001/TestDescription.java new file mode 100644 index 00000000000..8cf5ac3621b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/exception/exception001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ExceptionEvent/exception/exception001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.ExceptionEvent.exception() method. + * The test checks the following assertion: + * - the ExceptionEvent is received by the debugger for every runtime + * exception or error occured in the debuggee if debugger creates + * and enables the ExceptionRequest; + * - the received ExceptionEvent has proper references to: + * debugged VM, + * executed thread, + * related ExceptionRequest, + * checked location. + * - method ExceptionEvent.exception() returns correct ObjectReference + * to objects of Throwable class or its subclasses. + * A debugger class - nsk.jdi.ExceptionEvent.exception.exception001 ; + * a debuggee class - nsk.jdi.ExceptionEvent.exception.exception001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger launches and connects to debuggee, waits for it started, and + * creates the ExceptionRequest with true and + * parameters, which is disabled by default. + * The debugger defines separate thread for listening received + * events, cleans EventQueue, starts , enables ExceptionRequest, + * sends debuggee command to force it to throw exception, and waits for + * notification that all exceptions are thrown. + * Upon receiving command from debugger, the debuggee raises several + * exception and errors. All these exceptions and errors are enclosed in + * separate try-catch blocks. The debuggee verifies that all exceptions + * are actually thrown and notifies debugger by command or . + * Each received event is handled by separate thread. + * For each ExceptionEvent assertions of the test are verified. + * After command received from debuggee, debugger notifies + * that all checked exceptions have been thrown and waits for + * receives all expected events. If not all events received for WAITIME interval, + * debugger interrupts thread and complains about an error. + * Finally, debugger disables event request, sends debuggee command from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: unknown command: " + command); + return FAILED; + } + + // throw checked exceptions + try { + try { + throw new exception001aException(); + } catch (exception001aException e) { + log.display("exception001aException is thrown"); + userExceptionThrown = true; + } + + try { + throw new exception001aError(); + } catch (exception001aError e) { + log.display("exception001aError is thrown"); + userErrorThrown = true; + } + + try { + throw new exception001aThrowable(); + } catch (exception001aThrowable e) { + log.display("exception001aThrowable is thrown"); + userThrowableThrown = true; + } + + try { + int i = Integer.parseInt("foo"); + } catch (NumberFormatException e) { + log.display("NumberFormatException is thrown"); + javaExceptionThrown = true; + } + + try { + raiseStackOverflow(); + } catch (StackOverflowError e) { + log.display("StackOverflowError is thrown"); + javaErrorThrown = true; + } + + } catch (Throwable e) { + log.complain("Unexpected Throwable: " + e.getMessage()); + e.printStackTrace(); + if (e instanceof ThreadDeath) { + throw e; + } + } + + // check that all exceptions are thrown + boolean thrown = true; + if (!userExceptionThrown) { + log.complain("TEST BUG: user exception NOT thrown"); + thrown = false; + } + if (!userErrorThrown) { + log.complain("TEST BUG: user error NOT thrown"); + thrown = false; + } + if (!userThrowableThrown) { + log.complain("TEST BUG: user Throwable NOT thrown"); + thrown = false; + } + if (!javaExceptionThrown) { + log.complain("TEST BUG: java exception NOT thrown"); + thrown = false; + } + if (!javaErrorThrown) { + log.complain("TEST BUG: java error NOT thrown"); + thrown = false; + } + + // notify debugger whether all exceptions thrown or not + if (thrown) { + pipe.println(COMMAND_DONE); + } else { + pipe.println(COMMAND_ERROR); + } + + // wait for command from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + log.complain("TEST BUG: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + private void raiseStackOverflow () { + raiseStackOverflow(); + } +} + +class exception001aException extends Exception {} + +class exception001aError extends Error {} + +class exception001aThrowable extends Throwable {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001.java new file mode 100644 index 00000000000..e1dfd61b3d8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001.java @@ -0,0 +1,214 @@ +/* + * 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.ExceptionRequest._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; + +/** + * The test checks up the
    + * - addThreadFilter(ThreadReference)
    + * - addInstanceFilter(ObjectReference)
    + * - addClassFilter(ReferenceType)
    + * - addClassFilter(String)
    + * - addClassExclusionFilter(String)
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +/** + com.sun.jdi.request.ExceptionRequest.addThreadFilter(ThreadReference) + com.sun.jdi.request.ExceptionRequest.addInstanceFilter(ObjectReference) + com.sun.jdi.request.ExceptionRequest.addClassFilter(ReferenceType) + com.sun.jdi.request.ExceptionRequest.addClassFilter(String) + com.sun.jdi.request.ExceptionRequest.addClassExclusionFilter(String) + */ +public class filters001 { + + private final static String prefix = "nsk.jdi.ExceptionRequest._bounds_."; + private final static String debuggerName = prefix + "filters001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + display(""); + display(">>>creating ExceptionRequest"); + + ExceptionRequest request = + debugee.getEventRequestManager().createExceptionRequest(null, true, true); + + display(""); + addThreadFilter(request, null); + + display(""); + addInstanceFilter(request, null); + + display(""); + addClassFilter(request, (ReferenceType )null); + + display(""); + addClassFilter(request, (String )null); + + display(""); + addClassExclusionFilter(request, (String )null); + + display(""); + debugee.quit(); + } + + private void addThreadFilter(ExceptionRequest request, ThreadReference thread) { + String tmp = "addThreadFilter :thread name> "; + tmp += (thread == null) ? "" : thread.name(); + display("----------------------"); + display(tmp); + + try { + request.addThreadFilter(thread); + if (thread==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (thread == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addInstanceFilter(ExceptionRequest request, + ObjectReference instance) { + String tmp = "addInstanceFilter :object value> "; + tmp += (instance == null) ? "" : instance.toString(); + display("----------------------"); + display(tmp); + + try { + request.addInstanceFilter(instance); + if (instance==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (instance == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(ExceptionRequest request, ReferenceType refType) { + + display("addClassFilter :ReferenceType> null"); + + try { + request.addClassFilter(refType); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(ExceptionRequest request, String classPattern) { + + display("addClassFilter :classPattern> null"); + try { + request.addClassFilter(classPattern); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(ExceptionRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> null"); + try { + request.addClassExclusionFilter(classPattern); + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch (NullPointerException e) { + display("!!!Expected " + e); + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..3e0649c7a08 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ExceptionRequest/_bounds_/filters001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.ExceptionRequest.addThreadFilter(ThreadReference) + * com.sun.jdi.request.ExceptionRequest.addInstanceFilter(ObjectReference) + * com.sun.jdi.request.ExceptionRequest.addClassFilter(ReferenceType) + * com.sun.jdi.request.ExceptionRequest.addClassFilter(String) + * com.sun.jdi.request.ExceptionRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up this methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest._bounds_.filters001 + * nsk.jdi.ExceptionRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..ed85865b83a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/_bounds_/filters001a.java @@ -0,0 +1,54 @@ +/* + * 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.ExceptionRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001.java new file mode 100644 index 00000000000..37de70bd64c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001.java @@ -0,0 +1,180 @@ +/* + * 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.ExceptionRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addClassExclusionFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class whose name does not match a + * restricted regular expression. + * The cases to check include both a pattern that begins with '*' and + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - sets up two ExceptionRequests, + * - restricts the Requests using patterns that begins with '*' and + * ends with *, so that, events will be filtered only from thread1, + * - resumes the debuggee, and + * - waits for expected ExceptionEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, throw NullPointerExceptions used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter001a"; + return new filter001().runThis(argv, out); + } + + private String testedClassName1 = "TestClass11"; + private String testedClassName2 = "nsk.jdi.ExceptionRequest.addClassExclusionFilter.Thread2filter001a"; + + protected void testRun() { + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + final EventRequest eventRequest1 = setting23ExceptionRequest( null, + "*" + testedClassName1, + EventRequest.SUSPEND_NONE, + property1); + eventRequest1.enable(); + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof ExceptionEvent && event.request().equals(eventRequest1)) { + String str = ((ExceptionEvent)event).location().declaringType().name(); + if (str.endsWith(testedClassName1)) { + setFailedStatus("eventRequest1: Received unexpected ExceptionEvent for excluded class:" + str); + } else { + display("eventRequest1: Received expected ExceptionEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting1 for ExceptionEvent in expected thread"); + vm.resume(); + break; + + case 1: + final EventRequest eventRequest2 = setting23ExceptionRequest( null, + testedClassName2 + "*", + EventRequest.SUSPEND_NONE, + property2); + eventRequest2.enable(); + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof ExceptionEvent && event.request().equals(eventRequest2)) { + String str = ((ExceptionEvent)event).location().declaringType().name(); + if (str.endsWith(testedClassName2)) { + setFailedStatus("eventRequest2: Received ExceptionEvent for excluded class:" + str); + } else { + display("eventRequest2: Received expected ExceptionEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting for ExceptionEvent in expected thread"); + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ExceptionRequest setting23ExceptionRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class exclude filter: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassExclusionFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..2c3fb042c28 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter001; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter001 + * nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001a.java new file mode 100644 index 00000000000..e0e4ad50eea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter001a.java @@ -0,0 +1,222 @@ +/* + * 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.ExceptionRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter001 JDI test. + */ + +public class filter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter001a thread1 = null; + static Thread2filter001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 2; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter001a("thread1"); + log1("new filter001a().run1(thread1);"); + new filter001a().run1(thread1); + break; + + case 1: + thread2 = new Thread2filter001a("thread2"); + log1("new filter001a().run1(thread2);"); + new filter001a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class Thread1filter001a extends Thread { + + class TestClass10{ + void m10() { + throw new NullPointerException("m10"); + } + } + class TestClass11 extends TestClass10{ + void m11() { + + try { + (new TestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + + String tName = null; + + public Thread1filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new TestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter001a extends Thread { + + class TestClass20{ + void m20() { + throw new NullPointerException("m20"); + } + } + class TestClass21 extends TestClass20{ + void m21() { + + try { + (new TestClass20()).m20(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + String tName = null; + + public Thread2filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new TestClass21()).m21(); + } catch ( NullPointerException e) { + } + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002.java new file mode 100644 index 00000000000..42f24fb625f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002.java @@ -0,0 +1,528 @@ +/* + * 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.ExceptionRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ExceptionRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter002a"; + + private String testedClassName1 = + "nsk.jdi.ExceptionRequest.addClassExclusionFilter.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "ExceptionRequest1"; + + + + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = setting23ExceptionRequest(null, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting23ExceptionRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassExclusionFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..c7a8b7f9e9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002/TestDescription.java @@ -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/ExceptionRequest/addClassExclusionFilter/filter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter002; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addClassExclusionFilter.filter002 + * nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassExclusionFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002a.java new file mode 100644 index 00000000000..6ff25e86501 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassExclusionFilter/filter002a.java @@ -0,0 +1,145 @@ +/* + * 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.ExceptionRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter002 JDI test. + */ + +public class filter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + +// static Thread1filter002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// thread1 = new Thread1filter002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001.java new file mode 100644 index 00000000000..74d658008e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001.java @@ -0,0 +1,151 @@ +/* + * 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.ExceptionRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or + * any of its subtypes. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2 + * (thread1 will invoke methods throwing NullPointerException in + * the super-class TestClass10 and its sub-class TestClass11), + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes to use to filter ExceptionEvents, + * - sets up ExceptionRequest for the events, + * - restricts the events to those in thread1, + * - and resumes the debuggee and waits for the events. + * - The debuggee starts threads. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001a"; + return new filter_rt001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001aTestClass11"; + + protected void testRun() { + EventRequest eventRequest1 = null; + String property1 = "ExceptionRequest1"; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + final ReferenceType testClassReference = (ReferenceType)debuggee.classByName(testedClassName); + + eventRequest1 = setting21ExceptionRequest( null, testClassReference, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for ExceptionEvent in expected class"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("New event is not ExceptionEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property1) ) + setFailedStatus("Received ExceptionEvent with unexpected property: " + property1); + + ReferenceType eventDeclType = ((ExceptionEvent)newEvent).location().declaringType(); + if (!eventDeclType.equals(testClassReference)) { + setFailedStatus("Received unexpected ExceptionEvent for class:" + eventDeclType.name()); + } else { + display("Received expected ExceptionEvent for " + eventDeclType.name()); + } + } + + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ExceptionRequest setting21ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001/TestDescription.java new file mode 100644 index 00000000000..07a9697475a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ExceptionRequest/addClassFilter_rt/filter_rt001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001 + * nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001a.java new file mode 100644 index 00000000000..4c9ec6cb049 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt001a.java @@ -0,0 +1,219 @@ +/* + * 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.ExceptionRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt001 JDI test. + */ + +public class filter_rt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt001aThread1 thread1 = new filter_rt001aThread1("thread1"); + static filter_rt001aThread2 thread2 = new filter_rt001aThread2("thread2"); + + static filter_rt001aTestClass11 obj = new filter_rt001aTestClass11(); + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + log1("new filter_rt001a().run1(thread1);"); + new filter_rt001a().run1(thread1); + + log1("new filter_rt001a().run1(thread2);"); + new filter_rt001a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt001aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_rt001aTestClass11 extends filter_rt001aTestClass10{ + void m11() { + + try { + (new filter_rt001aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_rt001aThread1 extends Thread { + + String tName = null; + + public filter_rt001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt001aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt001aThread2 extends Thread { + + class filter_rt001aTestClass20{ + void m20() { + throw new NullPointerException("m20"); + } + } + class filter_rt001aTestClass21 extends filter_rt001aTestClass20{ + void m21() { + + try { + (new filter_rt001aTestClass20()).m20(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + String tName = null; + + public filter_rt001aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt001aTestClass21()).m21(); + } catch ( NullPointerException e) { + } + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002.java new file mode 100644 index 00000000000..ad90bc53d25 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002.java @@ -0,0 +1,530 @@ +/* + * 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.ExceptionRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addClassFilter(ReferenceType)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a TestClass10 object, to use as filter,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ExceptionRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt002a"; + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "ExceptionRequest1"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = setting21ExceptionRequest(null, testClassReference, + EventRequest.SUSPEND_NONE, property1); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" no InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting21ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002/TestDescription.java new file mode 100644 index 00000000000..a7811270711 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ExceptionRequest/addClassFilter_rt/filter_rt002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt002; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addClassFilter_rt.filter_rt002 + * nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002a.java new file mode 100644 index 00000000000..2917317648b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt002a.java @@ -0,0 +1,183 @@ +/* + * 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.ExceptionRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt002 JDI test. + */ + +public class filter_rt002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt002aThread1 thread1 = null; + + static filter_rt002aTestClass10 obj = new filter_rt002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_rt002aThread1("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt002aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_rt002aTestClass11 extends filter_rt002aTestClass10{ + void m11() { + try { + (new filter_rt002aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_rt002aThread1 extends Thread { + + String tName = null; + + public filter_rt002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt002aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003.java new file mode 100644 index 00000000000..7d2966f93fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003.java @@ -0,0 +1,182 @@ +/* + * 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.ExceptionRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to be + * the preparation of the given reference type and any subtypes. + * The cases to test include re-invocations of the method + * addClassFilter() on the same ExceptionRequest object. + * There are two ExceptionRequests to check as follows: + * (1) For ExceptionRequest2, both invocations are with different + * ReferenceTypes restricting one Exception event to two classes. + * The test expects no Exception event will be received. + * (2) For ExceptionRequest1, both invocations are with the same + * ReferenceType restricting one Exception event to one class. + * The test expects this Exception event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2 + * (thread1 will invoke methods throwing NullPointerException in + * the super-class TestClass10 and its sub-class TestClass11), + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two ExceptionRequests 1&2, + * - double restricts ExceptionRequest1 to the RefTypes 1 and 1, + * - double restricts ExceptionRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee starts thread1 and thread2, one by one, + * to generate the events to be filtered. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt003 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003a"; + return new filter_rt003().runThis(argv, out); + } + + private String testedClassName11 = + "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003aTestClass11"; + private String testedClassName21 = + "nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003aTestClass21"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + + ReferenceType testClassReference11 = null; + ReferenceType testClassReference21 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference11 = (ReferenceType)debuggee.classByName(testedClassName11); + testClassReference21 = (ReferenceType)debuggee.classByName(testedClassName21); + + eventRequest1 = setting21ExceptionRequest(null, testClassReference11, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21ExceptionRequest(null, testClassReference11, + EventRequest.SUSPEND_ALL, property2); + + ((ExceptionRequest) eventRequest1).addClassFilter(testClassReference11); + ((ExceptionRequest) eventRequest2).addClassFilter(testClassReference21); + display("......waiting for MethodEntryEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, false); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("ERROR: new event is not ExceptionEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ExceptionEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((ExceptionEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference11)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference11.name()); + } + } + vm.resume(); + break; + + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + + private ExceptionRequest setting21ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003/TestDescription.java new file mode 100644 index 00000000000..76123cbc4fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ExceptionRequest/addClassFilter_rt/filter_rt003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003 + * nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassFilter_rt.filter_rt003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003a.java new file mode 100644 index 00000000000..810185d1d2c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_rt/filter_rt003a.java @@ -0,0 +1,225 @@ +/* + * 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.ExceptionRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt003 JDI test. + */ + +public class filter_rt003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt003aThread1 thread1 = null; + static filter_rt003aThread2 thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + filter_rt003aTestClass11 obj1 = new filter_rt003aTestClass11(); + filter_rt003aTestClass21 obj2 = new filter_rt003aTestClass21(); + + thread1 = new filter_rt003aThread1("thread1"); + thread2 = new filter_rt003aThread2("thread2"); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + log1("new filter_rt003a().run1(thread1);"); + new filter_rt003a().run1(thread1); + + log1("new filter_rt003a().run1(thread2);"); + new filter_rt003a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt003aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_rt003aTestClass11 extends filter_rt003aTestClass10{ + void m11() { + + try { + (new filter_rt003aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_rt003aThread1 extends Thread { + + String tName = null; + + public filter_rt003aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt003aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + + +class filter_rt003aTestClass20{ + void m20() { + throw new NullPointerException("m20"); + } +} +class filter_rt003aTestClass21 extends filter_rt003aTestClass20{ + void m21() { + + try { + (new filter_rt003aTestClass20()).m20(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_rt003aThread2 extends Thread { + + String tName = null; + + public filter_rt003aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt003aTestClass21()).m21(); + } catch ( NullPointerException e) { + } + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001.java new file mode 100644 index 00000000000..e3c48517983 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001.java @@ -0,0 +1,187 @@ +/* + * 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.ExceptionRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(String) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to check include both a pattern that begin with '*' + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - creates two class filter objects, + * first one using a pattern that begin with '*', and + * second one using a pattern that end with '*' + * to filter ExceptionEvents in two debuggee's tested threads, + * - sets up two ExceptionRequests, + * - resumes the debuggee, and + * - waits for expected ExceptionEvents. + * - The debuggee creates and starts two threads + * whose 'run' methods create objects of ClassTypes needed + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_s001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001a"; + return new filter_s001().runThis(argv, out); + } + + private String testedClassName1 = "*TestClass11"; + private String testedClassName2 = + "nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001aThread2$filter_s001aTestClass20*"; + + private String className1 = "TestClass11"; + private String className2 = + "nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001aThread2$filter_s001aTestClass20"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + eventRequest1 = setting22ExceptionRequest(null, testedClassName1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for ExceptionEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("ERROR: new event is not ExceptionEvent"); + } else { + String str = ((ExceptionEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(className1)) { + setFailedStatus("Received ExceptionEvent for unexpected class: \n\t" + str); + } else { + display("Received ExceptionEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property1) ) { + setFailedStatus("event has unexpected property: " + property1); + } + } + + vm.resume(); + break; + + case 1: + eventRequest2 = setting22ExceptionRequest(null, testedClassName2, + EventRequest.SUSPEND_ALL, property2); + + display("......waiting for ExceptionEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("ERROR: new event is not ExceptionEvent"); + } else { + String str = ((ExceptionEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(className2)) { + setFailedStatus("Received ExceptionEvent for unexpected class: \n\t" + str); + } else { + display("Received ExceptionEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property2) ) { + setFailedStatus("event has unexpected property: " + property2); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ExceptionRequest setting22ExceptionRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001/TestDescription.java new file mode 100644 index 00000000000..4c89daedbe3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001/TestDescription.java @@ -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/ExceptionRequest/addClassFilter_s/filter_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(String classPattern) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001 + * nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001a.java new file mode 100644 index 00000000000..f4196029e28 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s001a.java @@ -0,0 +1,223 @@ +/* + * 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.ExceptionRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s001 JDI test. + */ + +public class filter_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_s001aThread1 thread1 = null; + static filter_s001aThread2 thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_s001aThread1("thread1"); + log1("new filter_s001a().run1(thread1);"); + new filter_s001a().run1(thread1); + + break; + + case 1: + thread2 = new filter_s001aThread2("thread2"); + log1("new filter_s001a().run1(thread2);"); + new filter_s001a().run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_s001aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_s001aTestClass11 extends filter_s001aTestClass10{ + void m11() { + + try { + (new filter_s001aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_s001aThread1 extends Thread { + + String tName = null; + + public filter_s001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_s001aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_s001aThread2 extends Thread { + + class filter_s001aTestClass20{ + void m20() { + throw new NullPointerException("m20"); + } + } + class filter_s001aTestClass21 extends filter_s001aTestClass20{ + void m21() { + + try { + (new filter_s001aTestClass20()).m20(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + String tName = null; + + public filter_s001aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_s001aTestClass21()).m21(); + } catch ( NullPointerException e) { + } + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002.java new file mode 100644 index 00000000000..bf5a544fa43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002.java @@ -0,0 +1,529 @@ +/* + * 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.ExceptionRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addClassFilter(String)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a TestClass10 object, to use as filter,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ExceptionRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s002a"; + + private String testedClassName1 = + "nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "ExceptionRequest1"; + + + + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = setting22ExceptionRequest(null, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting22ExceptionRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002/TestDescription.java new file mode 100644 index 00000000000..d0450dbf8d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002/TestDescription.java @@ -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/ExceptionRequest/addClassFilter_s/filter_s002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addClassFilter(String classPattern) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s002; + * the debuggee program - nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addClassFilter_s.filter_s002 + * nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addClassFilter_s.filter_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002a.java new file mode 100644 index 00000000000..4945fa054d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addClassFilter_s/filter_s002a.java @@ -0,0 +1,182 @@ +/* + * 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.ExceptionRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s002 JDI test. + */ + +public class filter_s002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_s002aThread1 thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_s002aThread1("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_s002aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_s002aTestClass11 extends filter_s002aTestClass10{ + void m11() { + + try { + (new filter_s002aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_s002aThread1 extends Thread { + + String tName = null; + + public filter_s002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s002a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_s002aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_s002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001.java new file mode 100644 index 00000000000..6f0f3b08d3b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001.java @@ -0,0 +1,191 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * + * The test has works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a BreakpointRequest + * within the method in the class TestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordinly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the breakpoint event only to thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001a"; + return new instancefilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001aTestClass"; + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + eventRequest1 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance); + + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + eventRequest2 = setting2ExceptionRequest (thread2, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + ((ExceptionRequest) eventRequest2).addInstanceFilter(instance); + + display("......waiting for ExceptionEvent in expected thread"); + + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("ERROR: new event is not ExceptionEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new ExceptionEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001/TestDescription.java new file mode 100644 index 00000000000..90de625a39d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/ExceptionRequest/addInstanceFilter/instancefilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001 + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001a.java new file mode 100644 index 00000000000..2641d513521 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter001a.java @@ -0,0 +1,214 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter001 JDI test. + */ + +public class instancefilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter001aThread thread1 = null; + static instancefilter001aThread thread2 = null; + + static instancefilter001aTestClass objTC[] = { new instancefilter001aTestClass(), new instancefilter001aTestClass(), new instancefilter001aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + + case 0: + thread1 = new instancefilter001aThread("thread1"); + thread2 = new instancefilter001aThread("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter001aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter001aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } +/* + public static void nullMethod() { + throw new NullPointerException("test"); + } +*/ +} + +class instancefilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void nullMethod() { + throw new NullPointerException("test"); + } + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + instancefilter001a.log1("instancefilter001aTestClass.method() : " + Thread.currentThread().getName()); +// instancefilter001a.nullMethod(); + nullMethod(); + } catch ( NullPointerException e ) { +// instancefilter001a.log1(" NullPointerException : " + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002.java new file mode 100644 index 00000000000..2dc18e5cb47 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002.java @@ -0,0 +1,551 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ExceptionRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter002a"; + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ExceptionRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_NONE, "ExceptionRequest1"); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002/TestDescription.java new file mode 100644 index 00000000000..532b566aa5d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ExceptionRequest/addInstanceFilter/instancefilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter002; + * the debuggee program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addInstanceFilter.instancefilter002 + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002a.java new file mode 100644 index 00000000000..015677438aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter002a.java @@ -0,0 +1,195 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter002 JDI test. + */ + +public class instancefilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter002aThread thread1 = null; + + static instancefilter002aTestClass objTC[] = { new instancefilter002aTestClass(), new instancefilter002aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + + case 0: + thread1 = new instancefilter002aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter002aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter002aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class instancefilter002aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + instancefilter002a.nullMethod(); + } catch ( NullPointerException e ) { +// instancefilter002a.log(" NullPointerException : " + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003.java new file mode 100644 index 00000000000..66dd7161aa3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003.java @@ -0,0 +1,518 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException - if the target
    + * virtual machine does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * an ExceptionRequest and if addInstanceFilter() is not supported,
    + * invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter003a"; + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ExceptionRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_NONE, "ExceptionRequest1"); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003/TestDescription.java new file mode 100644 index 00000000000..3b08aef51d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ExceptionRequest/addInstanceFilter/instancefilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter003; + * the debuggee program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addInstanceFilter.instancefilter003 + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003a.java new file mode 100644 index 00000000000..54365c3e44b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter003a.java @@ -0,0 +1,195 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter003 JDI test. + */ + +public class instancefilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter003aThread thread1 = null; + + static instancefilter003aTestClass objTC[] = { new instancefilter003aTestClass(), new instancefilter003aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + + case 0: + thread1 = new instancefilter003aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter003aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter003aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class instancefilter003aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + instancefilter003a.nullMethod(); + } catch ( NullPointerException e ) { +// instancefilter003a.log(" NullPointerException : " + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004.java new file mode 100644 index 00000000000..c8d5e44b26b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004.java @@ -0,0 +1,201 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same ExceptionRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For ExceptionRequest2, both invocations are with different + * ObjectReferences restricting one Exception event to two objects. + * The test expects no Exception event will be received. + * (2) For ExceptionRequest1, both invocations are with the same + * ObjectReference restricting one Exception event to one object. + * The test expects this Exception event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up ExceptionRequests 1&2 within the method + * in the class TestClass which will be calling by both threads, + * - restricts the ExceptionRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the ExceptionRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004a"; + return new instancefilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004aTestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2ExceptionRequest (thread2, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance1); + ((ExceptionRequest) eventRequest1).addInstanceFilter(instance1); + ((ExceptionRequest) eventRequest2).addInstanceFilter(instance1); + ((ExceptionRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for ExceptionEvent in expected thread"); + ExceptionEvent newEvent = (ExceptionEvent)eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + EventRequest newEventRequest = newEvent.request(); + if ( newEventRequest.equals(eventRequest1) ) { + display(" received expected event: " + newEvent); + + ThreadReference newEventThread = newEvent.thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004/TestDescription.java new file mode 100644 index 00000000000..56ca45d14f8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/ExceptionRequest/addInstanceFilter/instancefilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same ExceptionRequest object. + * There are two ExceptionRequests to check as follows: + * (1) For ExceptionRequest2, both invocations are with different + * ObjectReferences restricting one Exception event to two objects. + * The test expects no Exception event will be received. + * (2) For ExceptiontRequest1, both invocations are with the same + * ObjectReference restricting one Exception event to one object. + * The test expects this Exception event will be received + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004; + * the debuggee program - nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004 + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addInstanceFilter.instancefilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004a.java new file mode 100644 index 00000000000..54397f99636 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addInstanceFilter/instancefilter004a.java @@ -0,0 +1,206 @@ +/* + * 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.ExceptionRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter004 JDI test. + */ + +public class instancefilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter004aThread thread1 = null; + static instancefilter004aThread thread2 = null; + + static instancefilter004aTestClass objTC[] = { new instancefilter004aTestClass(), new instancefilter004aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new instancefilter004aThread("thread1"); + thread2 = new instancefilter004aThread("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter004aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter004aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter004aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + nullMethod(); + } catch ( NullPointerException e ) { +// instancefilter004a.log(" NullPointerException : " + e); + } + } + + void nullMethod() { + throw new NullPointerException("test"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001.java new file mode 100644 index 00000000000..36fa79961a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001.java @@ -0,0 +1,157 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up an ExceptionRequest within the method + * in the class TestClass which will be calling by both threads, + * - restricts the exception event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter001 extends TestDebuggerType1 { + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001a"; + return new threadfilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String property1 = "ExceptionRequest1"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, "ExceptionRequest1"); + + display("......waiting for ExceptionEvent in tested thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("ERROR: new event is not ExceptionEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ExceptionEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ThreadReference thr = ((ExceptionEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The ExceptionEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001/TestDescription.java new file mode 100644 index 00000000000..47a1eff09d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001/TestDescription.java @@ -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/ExceptionRequest/addThreadFilter/threadfilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001; + * the debuggee program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001 + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001a.java new file mode 100644 index 00000000000..dfbb7c71b9c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter001a.java @@ -0,0 +1,205 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter001 JDI test. + */ + +public class threadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter001aThread thread1 = null; + static threadfilter001aThread thread2 = null; + + static threadfilter001aTestClass objTC = new threadfilter001aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter001aThread("thread1"); + thread2 = new threadfilter001aThread("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter001aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter001aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class threadfilter001aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + threadfilter001a.nullMethod(); + } catch ( NullPointerException e ) { +// threadfilter001a.log(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002.java new file mode 100644 index 00000000000..eb710144d51 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002.java @@ -0,0 +1,538 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ExceptionRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter002a"; + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ExceptionRequest1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ExceptionRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ExceptionRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002/TestDescription.java new file mode 100644 index 00000000000..63f455d63e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002/TestDescription.java @@ -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/ExceptionRequest/addThreadFilter/threadfilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter002; + * the debuggee program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addThreadFilter.threadfilter002 + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002a.java new file mode 100644 index 00000000000..83e96c629ba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter002a.java @@ -0,0 +1,193 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter002 JDI test. + */ + +public class threadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter002aThread thread1 = null; + + static threadfilter002aTestClass objTC = new threadfilter002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter002aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter002aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter002aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class threadfilter002aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + threadfilter002a.nullMethod(); + } catch ( NullPointerException e ) { +// threadfilter002a.log(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003.java new file mode 100644 index 00000000000..4f1e046660d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003.java @@ -0,0 +1,543 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates ExceptionRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates ExceptiontRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates ExceptiontRequest3, waits the thread1 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter003a"; + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + String property3 = "ExceptionRequest3"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ExceptionRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ExceptionRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception :: " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2ExceptionRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property2); + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ExceptionRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception :: " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2ExceptionRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property3); + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ExceptionRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception :: " + e); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.addClassFilter(testedClass); + excr.setSuspendPolicy(suspendPolicy); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003/TestDescription.java new file mode 100644 index 00000000000..2409613aeef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ExceptionRequest/addThreadFilter/threadfilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter003; + * the debuggee program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.addThreadFilter.threadfilter003 + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003a.java new file mode 100644 index 00000000000..0e77c0c03b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter003a.java @@ -0,0 +1,188 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter003 JDI test. + */ + +public class threadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter003aThread thread1 = null; + + static threadfilter003aTestClass objTC = new threadfilter003aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter003aThread("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class threadfilter003aThread extends Thread { + + public threadfilter003aThread(String threadName) { + super(threadName); + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class threadfilter003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004.java new file mode 100644 index 00000000000..3b84c265867 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004.java @@ -0,0 +1,189 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ExceptionRequest. + * + * The test checks that results of the method + * com.sun.jdi.ExceptionRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same ExceptionRequest object. + * There are two ExceptionRequests to check as follows: + * (1) For ExceptionRequest2, both invocations are with different + * ThreadReferences restricting one Exception event to two threads. + * The test expects no Exception event will be received. + * (2) For ExceptionRequest1, both invocations are with the same + * ThreadReference restricting one Exception event to one thread. + * The test expects this Exception event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up ExceptionRequests 1&2 within the method + * in the class TestClass which will be calling by both threads, + * - restricts the ExceptionRequest1 only to thread1, + * - restricts the ExceptionRequest2 to both thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004a"; + return new threadfilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ExceptionRequest1"; + String property2 = "ExceptionRequest2"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2ExceptionRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + + ((ExceptionRequest) eventRequest1).addThreadFilter(thread1); + ((ExceptionRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for ExceptionEvent in tested thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ExceptionEvent)) { + setFailedStatus("ERROR: new event is not ExceptionEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ExceptionEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + EventRequest newEventRequest = newEvent.request(); + if (!newEventRequest.equals(eventRequest1) ) { + setFailedStatus("The ExceptionEvent occured not for eventRequest1"); + } + + ThreadReference thr = ((ExceptionEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The ExceptionEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + + private ExceptionRequest setting2ExceptionRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up ExceptionRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, true, true); + excr.putProperty("number", property); + if (thread != null) + excr.addThreadFilter(thread); + excr.setSuspendPolicy(suspendPolicy); + + display(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ExceptionRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004/TestDescription.java new file mode 100644 index 00000000000..282c3f4ec1f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/ExceptionRequest/addThreadFilter/threadfilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same ExceptionRequest object. + * There are two ExceptionRequests to check as follows: + * (1) For ExceptionRequest2, both invocations are with different + * ThreadReferences restricting one Exception event to two threads. + * The test expects no Exception event will be received. + * (2) For ExceptionRequest1, both invocations are with the same + * ThreadReference restricting one Exception event to one thread. + * The test expects this Exception event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004; + * the debuggee program - nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004 + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.addThreadFilter.threadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004a.java new file mode 100644 index 00000000000..59850277e3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/addThreadFilter/threadfilter004a.java @@ -0,0 +1,208 @@ +/* + * 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.ExceptionRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter004 JDI test. + */ + +public class threadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter004aThread thread1 = null; + static threadfilter004aThread thread2 = null; + + static threadfilter004aTestClass objTC = new threadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter004aThread("thread1"); + thread2 = new threadfilter004aThread("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter004aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter004aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class threadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + try { + threadfilter004a.nullMethod(); + } catch ( NullPointerException e ) { +// threadfilter004a.log(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001.java new file mode 100644 index 00000000000..72a4e40d243 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001.java @@ -0,0 +1,509 @@ +/* + * 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.ExceptionRequest.exception; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.exception()
    + * complies with its spec.
    + *
    + * The test checks if a boolean value, an argument of the method
    + * EventRequestManager.createExceptionRequest(),
    + * is equal to one returned by the method
    + * ExceptionRequest.exception()
    + * The cases to test include a ReferenceType
    + * mirroring NullPointerException, and null.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger
    + * - gets ReferenceType value mirroring NullPointerException,
    + * - sets up two ExceptionRequests with the ReferenceType and null
    + * values of the exception arguments,
    + * - gets the values of the Request with the method
    + * StepRequest.exception(), and
    + * - compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class exception001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/exception/exception001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new exception001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.exception.exception001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + vm.resume(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String fieldName = "obj"; + Value value = null; + + ReferenceType refObject = null; + ReferenceType exception = null; + + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + log2("......vm.resume();"); + vm.resume(); + + log2("......getting: refObject = debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName));"); + value = debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + log2(" getting: refObject = (ReferenceType) value.type();"); + refObject = (ReferenceType) value.type(); + + log2("......setting up: eventRequest1 = setting25ExceptionRequest(refObject);"); + eventRequest1 = setting25ExceptionRequest(refObject); + + log2("......getting: exception = ((ExceptionRequest) eventRequest1).exception();"); + exception = ((ExceptionRequest) eventRequest1).exception(); + + log2(" comparing ReferenceType objects"); + if ( !exception.equals(refObject) ) { + testExitCode = FAILED; + log3("ERROR: objects are not equal : " + exception); + } + + log2("......setting up: eventRequest2 = setting25ExceptionRequest(null);"); + eventRequest2 = setting25ExceptionRequest(null); + + log2("......getting: exception = ((ExceptionRequest) eventRequest2).exception();"); + exception = ((ExceptionRequest) eventRequest2).exception(); + + log2(" comparing to null"); + if ( exception != null ) { + testExitCode = FAILED; + log3("ERROR: exception is not the null : " + exception); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting25ExceptionRequest ( ReferenceType refType ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(refType, true, true); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001/TestDescription.java new file mode 100644 index 00000000000..58f006cebe4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001/TestDescription.java @@ -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/ExceptionRequest/exception/exception001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.exception() + * complies with its spec: + * public ReferenceType exception() + * Returns exception type for which exception events are requested. + * Returns: The exception (and its subclasses) requested with + * EventRequestManager.createExceptionRequest(com.sun.jdi.ReferenceType, + * boolean, boolean), or null if, as by default, + * all exceptions are requested. + * The test checks if a ReferenceType object, + * an argument of the method EventRequestManager.createExceptionRequest(), + * is equal to one returned by the method ExceptionRequest.exception() + * The cases to test include ReferenceType mirroring NullPointerException + * and null. + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.exception.exception001; + * the debuggee program - nsk.jdi.ExceptionRequest.exception.exception001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test was fixed due to bug: + * 4637824 TEST_BUG: race condition in exception001 + * Test was fixed due to bug: + * 4915479 TEST_BUG: race in nsk/jdi/ExceptionRequest/exception/exception001 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ExceptionRequest.exception.exception001 + * nsk.jdi.ExceptionRequest.exception.exception001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.exception.exception001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001a.java new file mode 100644 index 00000000000..4344bbd24dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/exception/exception001a.java @@ -0,0 +1,118 @@ +/* + * 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.ExceptionRequest.exception; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the exception001 JDI test. + */ + +public class exception001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static NullPointerException obj = new NullPointerException(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + // continue + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001.java new file mode 100644 index 00000000000..da7c5022533 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001.java @@ -0,0 +1,499 @@ +/* + * 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.ExceptionRequest.notifyCaught; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.notifyCaught()
    + * complies with its spec.
    + *
    + * The test checks if a boolean value, an argument of the method
    + * EventRequestManager.createExceptionRequest(),
    + * is equal to one returned by the method
    + * ExceptionRequest.notifyCaught()
    + * The cases to check include both true and false.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger
    + * - sets up two ExceptionRequests with true and false values of
    + * the notifyCaught argument,
    + * - gets the values of the Request with the method
    + * StepRequest.notifyCaught(), and
    + * - compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class notifycaught001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new notifycaught001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.notifyCaught.notifycaught001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + boolean bool; + + + for (int i = 0; ; i++) { + + vm.resume(); + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + + + log2("......setting up: eventRequest1 = setting24ExceptionRequest(true, true);"); + eventRequest1 = setting24ExceptionRequest(true, true); + + log2("......getting: bool = ((ExceptionRequest) eventRequest1).notifyCaught();"); + bool = ((ExceptionRequest) eventRequest1).notifyCaught(); + + log2(" compareing boolean values"); + if (bool != true) { + testExitCode = FAILED; + log3("ERROR: values are not equal : true and false"); + } + + log2("......setting up: eventRequest2 = setting24ExceptionRequest(false, true);"); + eventRequest2 = setting24ExceptionRequest(false, true); + + log2("......getting: bool = ((ExceptionRequest) eventRequest2).notifyCaught();"); + bool = ((ExceptionRequest) eventRequest2).notifyCaught(); + + log2(" compareing boolean values"); + if (bool != false) { + testExitCode = FAILED; + log3("ERROR: values are not equal : true and false"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting24ExceptionRequest ( boolean notifyCaught, + boolean notifyUnaught ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, notifyCaught, notifyUnaught); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001/TestDescription.java new file mode 100644 index 00000000000..be9faadbfe6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001/TestDescription.java @@ -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/ExceptionRequest/notifyCaught/notifycaught001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.notifyCaught() + * complies with its spec: + * public boolean notifyCaught() + * Returns whether caught exceptions of the requested type + * will generate events when they are thrown. + * Note that at the time an exception is thrown, + * it is not always possible to determine whether it is truly caught. + * See ExceptionEvent.catchLocation() for details. + * Returns: boolean true if caught exceptions will be reported, false otherwise. + * The test checks if a boolean value, + * an argument of the method EventRequestManager.createExceptionRequest(), + * is equal to one returned by the method ExceptionRequest.notifyCaught() + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.notifyCaught.notifycaught001; + * the debuggee program - nsk.jdi.ExceptionRequest.notifyCaught.notifycaught001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.notifyCaught.notifycaught001 + * nsk.jdi.ExceptionRequest.notifyCaught.notifycaught001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.notifyCaught.notifycaught001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001a.java new file mode 100644 index 00000000000..351804d6ef1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyCaught/notifycaught001a.java @@ -0,0 +1,181 @@ +/* + * 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.ExceptionRequest.notifyCaught; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the notifycaught001 JDI test. + */ + +public class notifycaught001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1notifycaught001a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1notifycaught001a("thread1"); + log1("new notifycaught001a().run1(thread1);"); + new notifycaught001a().run1(thread1); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class TestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class TestClass11 extends TestClass10{ + void m11() { + + try { + (new TestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class Thread1notifycaught001a extends Thread { + + String tName = null; + + public Thread1notifycaught001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + notifycaught001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new TestClass11()).m11(); + } catch ( NullPointerException e) { + } + notifycaught001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001.java new file mode 100644 index 00000000000..8f02f3fa4dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001.java @@ -0,0 +1,499 @@ +/* + * 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.ExceptionRequest.notifyUncaught; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ExceptionRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ExceptionRequest.notifyUncaught()
    + * complies with its spec.
    + *
    + * The test checks if a boolean value, an argument of the method
    + * EventRequestManager.createExceptionRequest(),
    + * is equal to one returned by the method
    + * ExceptionRequest.notifyUncaught()
    + * The cases to check include both true and false.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger
    + * - sets up two ExceptionRequests with true and false values of
    + * the notifyUncaught argument,
    + * - gets the values of the Request with the method
    + * StepRequest.notifyUncaught(), and
    + * - compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class notifyuncaught001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new notifyuncaught001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ExceptionRequest.notifyUncaught.notifyuncaught001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + boolean bool; + + + for (int i = 0; ; i++) { + + vm.resume(); + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + + + log2("......setting up: eventRequest1 = setting24ExceptionRequest(true, true);"); + eventRequest1 = setting24ExceptionRequest(true, true); + + log2("......getting: bool = ((ExceptionRequest) eventRequest1).notifyUncaught();"); + bool = ((ExceptionRequest) eventRequest1).notifyUncaught(); + + log2(" compareing boolean values"); + if (bool != true) { + testExitCode = FAILED; + log3("ERROR: values are not equal : false and true"); + } + + log2("......setting up: eventRequest2 = setting24ExceptionRequest(true, false);"); + eventRequest2 = setting24ExceptionRequest(true, false); + + log2("......getting: bool = ((ExceptionRequest) eventRequest2).notifyUncaught();"); + bool = ((ExceptionRequest) eventRequest2).notifyUncaught(); + + log2(" compareing boolean values"); + if (bool != false) { + testExitCode = FAILED; + log3("ERROR: values are not equal : true and false"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ExceptionRequest setting24ExceptionRequest ( boolean notifyCaught, + boolean notifyUnaught ) + throws JDITestRuntimeException { + try { + log2("......setting up ExceptionRequest:"); + + ExceptionRequest + excr = eventRManager.createExceptionRequest(null, notifyCaught, notifyUnaught); + + log2(" ExceptionRequest has been set up"); + return excr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingExceptionRequest() : " + e); + log3(" ExceptionRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001/TestDescription.java new file mode 100644 index 00000000000..1a26cbb5b0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001/TestDescription.java @@ -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/ExceptionRequest/notifyUncaught/notifyuncaught001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ExceptionRequest. + * The test checks up that a result of the method + * com.sun.jdi.ExceptionRequest.notifyUncaught() + * complies with its spec: + * public boolean notifyUncaught() + * Returns whether uncaught exceptions of the requested type + * will generate events when they are thrown. + * Note that at the time an exception is thrown, + * it is not always possible to determine whether it is truly caught. + * See ExceptionEvent.catchLocation() for details. + * Returns: boolean true if uncaught exceptions will be reported, false otherwise. + * The test checks if a boolean value, + * an argument of the method EventRequestManager.createExceptionRequest(), + * is equal to one returned by the method ExceptionRequest.notifyUncaught() + * The test works as follows: + * The debugger program - nsk.jdi.ExceptionRequest.notifyUncaught.notifyuncaught001; + * the debuggee program - nsk.jdi.ExceptionRequest.notifyUncaught.notifyuncaught001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ExceptionRequest.notifyUncaught.notifyuncaught001 + * nsk.jdi.ExceptionRequest.notifyUncaught.notifyuncaught001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ExceptionRequest.notifyUncaught.notifyuncaught001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001a.java new file mode 100644 index 00000000000..99100baf3af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001a.java @@ -0,0 +1,181 @@ +/* + * 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.ExceptionRequest.notifyUncaught; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the notifyuncaught001 JDI test. + */ + +public class notifyuncaught001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1notifyuncaught001a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1notifyuncaught001a("thread1"); + log1("new notifyuncaught001a().run1(thread1);"); + new notifyuncaught001a().run1(thread1); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class TestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class TestClass11 extends TestClass10{ + void m11() { + + try { + (new TestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class Thread1notifyuncaught001a extends Thread { + + String tName = null; + + public Thread1notifyuncaught001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + notifyuncaught001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new TestClass11()).m11(); + } catch ( NullPointerException e) { + } + notifyuncaught001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExtraClassesInstaller.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExtraClassesInstaller.java new file mode 100644 index 00000000000..f4f98043547 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExtraClassesInstaller.java @@ -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. + */ + +package nsk.jdi; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class ExtraClassesInstaller { + public static void main(String[] args) { + Path target = Paths.get("bin") + .resolve(args[0]); + ClassLoader cl = ExtraClassesInstaller.class.getClassLoader(); + for (int i = 1; i < args.length; ++i) { + + String pathName = args[i]; + try { + try (InputStream is = cl.getResourceAsStream(pathName)) { + if (is == null) { + throw new Error("can't find " + pathName); + } + Path file = target.resolve(pathName); + Path dir = file.getParent(); + try { + Files.createDirectories(dir); + } catch (IOException e) { + throw new Error("can't create dir " + dir, e); + } + try { + Files.copy(is, file); + } catch (IOException e) { + throw new Error("can't write to " + file, e); + } + } + } catch (IOException e) { + throw new Error("IOE on closing " + pathName + " resource stream", e); + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001.java new file mode 100644 index 00000000000..3622fc90743 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001.java @@ -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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class equals001 { + private static Log log; + private final static String prefix = "nsk.jdi.Field.equals."; + private final static String className = "equals001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "ClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fieldsDebugee; + List methods; + Iterator methodsIterator; + java.lang.reflect.Field[] fieldsDebuger; + ClassOfFields classOfFields = new ClassOfFields(); + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(classToCheckName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + classToCheckName + + " not found."); + return 2; + } + try { + fieldsDebugee = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fieldsDebugee.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + + // Compare each Field and Method from debugee + try { + methods = refType.allMethods(); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get methods from class"); + log.complain("debuger FAILURE 1> Exception: " + e); + return 2; + } + log.display("debuger> Total methods found: " + methods.size()); + Iterator fieldsIterator = fieldsDebugee.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field fieldDebugee = (Field)fieldsIterator.next(); + String name = fieldDebugee.name(); + methodsIterator = methods.iterator(); + + for (int j = 0; methodsIterator.hasNext(); j++) { + Method method = (Method)methodsIterator.next(); + String methodName = method.name(); + + log.display("debuger> Field " + name + " and method " + + methodName + " read from debugee."); + if (fieldDebugee.equals(method)) { + // Field is not equal to any Object which type is not Field + log.complain("debuger FAILURE 2> Field " + name + + " and method " + methodName + " are equal. " + + "Expected result: not equal."); + testFailed = true; + continue; + } + } + } + + // Compare Field (com.sun.jdi.Field) from debugee and Field + // from debuger (java.lang.reflect.Field) + Class classDebuger = classOfFields.getClass(); + try { + fieldsDebuger = classDebuger.getDeclaredFields(); + } catch (SecurityException e) { + log.complain("debuger FAILURE 3> Can't get fields from debuger's" + + " class"); + log.complain("debuger FAILURE 3> Exception: " + e); + return 2; + } + int totalDebugerFields = fieldsDebuger.length; + log.display("debuger> Total fields in debuger found: " + + totalDebugerFields); + fieldsIterator = fieldsDebugee.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field fieldDebugee = (Field)fieldsIterator.next(); + String name = fieldDebugee.name(); + + for (int j = 1; j < totalDebugerFields; j++) { + java.lang.reflect.Field fieldDebuger = fieldsDebuger[j]; + String nameDebuger = fieldDebuger.getName(); + + log.display("debuger> Field from debugee " + name + " and " + + "field from debuger " + nameDebuger + " read."); + if (fieldDebugee.equals(fieldDebuger)) { + // Field is not equal to any Object which type + // is not not com.sun.jdi.Field + log.complain("debuger FAILURE 4> Field from debugee " + + name + " and field from debuger " + + nameDebuger + " are equal. Expected " + + "result: not equal."); + testFailed = true; + continue; + } + } + } + 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; + } + } + } +} + +class ClassOfFields { + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..2b946ea6750 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/Field/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the equals() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/equals001 checks assertion: + * public boolean equals(java.lang.Object obj) + * 1. Returns false if the Object is not a Field. + * Each method from debugee is not a Field, so equals() returns + * false if to compare fields and methods from debugee. + * Each Object from debuger (any field of type java.lang.reflect.Field) + * is not a Field, so equals() returns false if to compare fields from + * debugee and debuger. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.equals.equals001 + * nsk.jdi.Field.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001a.java new file mode 100644 index 00000000000..8b16e12fa67 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals001a.java @@ -0,0 +1,111 @@ +/* + * 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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class equals001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + ClassToCheck check = new ClassToCheck(); + + 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 ClassToCheck { + // Fields + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + // Methods + void v_m() {} + boolean z_m() { return true; } + byte b_m() { return (byte)1; } + char c_m() { return (char)1; } + double d_m() { return (double)1; } + float f_m() { return (float)1; } + int i_m() { return (int)1; } + long l_m() { return (long)1; } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002.java new file mode 100644 index 00000000000..0979c7db846 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002.java @@ -0,0 +1,279 @@ +/* + * 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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class equals002 { + final static int TOTAL_FIELDS = 117; + final static String FIELDS_TYPE_NAME[][] = { + {"boolean", "z0"}, + {"boolean", "z1"}, + {"boolean", "z2"}, + {"byte", "b0"}, + {"byte", "b1"}, + {"byte", "b2"}, + {"char", "c0"}, + {"char", "c1"}, + {"char", "c2"}, + {"double", "d0"}, + {"double", "d1"}, + {"double", "d2"}, + {"float", "f0"}, + {"float", "f1"}, + {"float", "f2"}, + {"int", "i0"}, + {"int", "i1"}, + {"int", "i2"}, + {"long", "l0"}, + {"long", "l1"}, + {"long", "l2"}, + + {"long", "lS0"}, + {"long", "lS1"}, + {"long", "lS2"}, + {"long", "lP0"}, + {"long", "lP1"}, + {"long", "lP2"}, + {"long", "lU0"}, + {"long", "lU1"}, + {"long", "lU2"}, + {"long", "lR0"}, + {"long", "lR1"}, + {"long", "lR2"}, + {"long", "lT0"}, + {"long", "lT1"}, + {"long", "lT2"}, + {"long", "lV0"}, + {"long", "lV1"}, + {"long", "lV2"}, + {"long", "lF0"}, + {"long", "lF1"}, + {"long", "lF2"}, + + {"Class", "X0"}, + {"Class", "X1"}, + {"Class", "X2"}, + {"Boolean", "Z0"}, + {"Boolean", "Z1"}, + {"Boolean", "Z2"}, + {"Byte", "B0"}, + {"Byte", "B1"}, + {"Byte", "B2"}, + {"Char", "C0"}, + {"Char", "C1"}, + {"Char", "C2"}, + {"Double", "D0"}, + {"Double", "D1"}, + {"Double", "D2"}, + {"Float", "F0"}, + {"Float", "F1"}, + {"Float", "F2"}, + {"Int", "I0"}, + {"Int", "I1"}, + {"Int", "I2"}, + {"Long", "L0"}, + {"Long", "L1"}, + {"Long", "L2"}, + {"String", "S0"}, + {"String", "S1"}, + {"String", "S2"}, + {"Object", "O0"}, + {"Object", "O1"}, + {"Object", "O2"}, + + {"Long", "LS0"}, + {"Long", "LS1"}, + {"Long", "LS2"}, + {"Long", "LP0"}, + {"Long", "LP1"}, + {"Long", "LP2"}, + {"Long", "LU0"}, + {"Long", "LU1"}, + {"Long", "LU2"}, + {"Long", "LR0"}, + {"Long", "LR1"}, + {"Long", "LR2"}, + {"Long", "LT0"}, + {"Long", "LT1"}, + {"Long", "LT2"}, + {"Long", "LV0"}, + {"Long", "LV1"}, + {"Long", "LV2"}, + {"Long", "LF0"}, + {"Long", "LF1"}, + {"Long", "LF2"}, + + {"Inter", "E0"}, + {"Inter", "E1"}, + {"Inter", "E2"}, + {"Inter", "ES0"}, + {"Inter", "ES1"}, + {"Inter", "ES2"}, + {"Inter", "EP0"}, + {"Inter", "EP1"}, + {"Inter", "EP2"}, + {"Inter", "EU0"}, + {"Inter", "EU1"}, + {"Inter", "EU2"}, + {"Inter", "ER0"}, + {"Inter", "ER1"}, + {"Inter", "ER2"}, + {"Inter", "ET0"}, + {"Inter", "ET1"}, + {"Inter", "ET2"}, + {"Inter", "EV0"}, + {"Inter", "EV1"}, + {"Inter", "EV2"}, + {"Inter", "EF0"}, + {"Inter", "EF1"}, + {"Inter", "EF2"} + }; + private static Log log; + private final static String prefix = "nsk.jdi.Field.equals."; + private final static String className = "equals002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields + ", should be " + TOTAL_FIELDS); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field srcField = (Field)fieldsIterator.next(); + String name = srcField.name(); + + // Compare all fields with each other but srcField + if (name == null) { + log.complain("debuger FAILURE 1> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + for (int j = 0; j < TOTAL_FIELDS; j++) { + String checkFieldName = FIELDS_TYPE_NAME[j][1]; + Field checkField; + + if (!name.equals(checkFieldName)) { + try { + checkField = refType.fieldByName(checkFieldName); + } catch (Exception e) { + log.complain("debuger FAILURE 2> Can't get field " + + "by name " + checkFieldName); + log.complain("debuger FAILURE 2> Exception: " + e); + testFailed = true; + continue; + } + + // Compare two different Fields, result should be false + boolean fieldsEqual = srcField.equals(checkField); + log.display("debuger> Compared fields " + name + " and " + + checkFieldName + ", result is " + fieldsEqual); + if (fieldsEqual) { + // Fields in the same class that mirror different + // fields are not equal + log.complain("debuger FAILURE 3> Different fields " + + "(" + name + " and " + checkFieldName + ")" + + " are equal. Expected result: not equal."); + testFailed = true; + continue; + } + } + } + } + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..67f3051e3b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002/TestDescription.java @@ -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/Field/equals/equals002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the equals() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/equals002 checks assertion: + * public boolean equals(java.lang.Object obj) + * 1. Returns false if the Object and Field are in the same class but + * mirror different fields. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.equals.equals002 + * nsk.jdi.Field.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002a.java new file mode 100644 index 00000000000..1c17943fa6b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals002a.java @@ -0,0 +1,97 @@ +/* + * 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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class equals002a { + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + 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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003.java new file mode 100644 index 00000000000..fe1bbd5bd76 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003.java @@ -0,0 +1,231 @@ +/* + * 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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class equals003 { + private static Log log; + private final static String prefix = "nsk.jdi.Field.equals."; + private final static String className = "equals003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String mainClassName = prefix + "MainClass"; + private final static String sameClass1Name = prefix + "SameClass1"; + private final static String sameClass2Name = prefix + "SameClass2"; + private final static String overridenClassName = prefix + "OverridenClass"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List mainFields; + Field mainField; + Field same1Field; + Field same2Field; + Field overridenField; + + // 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."); + } + + // Get all fields from all classes + ReferenceType mainClassRefType = debugee.classByName(mainClassName); + if (mainClassRefType == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + ReferenceType sameClass1RefType = debugee.classByName(sameClass1Name); + if (sameClass1RefType == null) { + log.complain("debuger FAILURE> Class " + sameClass1Name + " not " + + "found."); + return 2; + } + ReferenceType sameClass2RefType = debugee.classByName(sameClass2Name); + if (sameClass2RefType == null) { + log.complain("debuger FAILURE> Class " + sameClass2Name + " not " + + "found."); + return 2; + } + ReferenceType overridenClassRefType = + debugee.classByName(overridenClassName); + if (overridenClassRefType == null) { + log.complain("debuger FAILURE> Class " + overridenClassName + + " not found."); + return 2; + } + + try { + mainFields = mainClassRefType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class " + + mainClassName); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = mainFields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields in class " + + mainClassName + " read: " + totalFields); + return 2; + } + log.display("debuger> Total number of fields in class " + + mainClassName + " read: " + totalFields); + Iterator fieldsIterator = mainFields.iterator(); + + // Check each field of MainClass with fields from classes + // SameClass1, SameClass2, OverridenClass + for (int i = 0; fieldsIterator.hasNext(); i++) { + mainField = (Field)fieldsIterator.next(); + String name = mainField.name(); + + if (name == null) { + log.complain("debuger FAILURE 1> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " from class " + + mainClassName + " read."); + + // Compare fields from classes MainClass and SameClass1 + log.display("debuger> Compare classes " + mainClassName + " and " + + sameClass1Name); + try { + same1Field = sameClass1RefType.fieldByName(name); + } catch (Exception e) { + log.complain("debuger FAILURE 2> Can't get field by name " + + name + " in class " + sameClass1Name); + log.complain("debuger FAILURE 2> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> Field " + name + " from class " + + sameClass1Name + " read."); + // Fields in different classes but defined in same class are equal + if (! mainField.equals(same1Field)) { + log.complain("debuger FAILURE 3> Fields " + name + " from " + + "classes " + mainClassName + " and " + + sameClass1Name + " are not equal. Expected " + + "result: equal."); + testFailed = true; + continue; + } + + // Compare fields from classes MainClass and OverridenClass + log.display("debuger> Compare classes " + mainClassName + + " and " + overridenClassName); + try { + overridenField = overridenClassRefType.fieldByName(name); + } catch (Exception e) { + log.complain("debuger FAILURE 4> Can't get field by name " + + name + " in class " + overridenClassName); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> Field " + name + " from class " + + overridenClassName + " read."); + // Fields in different classes are not equal + if (mainField.equals(overridenField)) { + log.complain("debuger FAILURE 5> Fields " + name + + " from classes " + mainClassName + " and " + + overridenClassName + " are equal. Expected " + + "result: not equal."); + testFailed = true; + continue; + } + + // Compare fields from classes SameClass1 and SameClass2 + log.display("debuger> Compare classes " + sameClass1Name + + " and " + sameClass2Name); + try { + same2Field = sameClass2RefType.fieldByName(name); + } catch (Exception e) { + log.complain("debuger FAILURE 6> Can't get field by name " + + name + " in class " + sameClass2Name); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + log.display("debuger> Field " + name + " from class " + + sameClass2Name + " read."); + // Fields in different classes but defined in same class are equal + if (!same1Field.equals(same2Field)) { + log.complain("debuger FAILURE 7> Fields " + name + + " from classes " + sameClass1Name + " and " + + sameClass2Name + " are not equal. Expected " + + "result: equal."); + testFailed = true; + continue; + } + } + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003/TestDescription.java new file mode 100644 index 00000000000..aa08dbd8616 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003/TestDescription.java @@ -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/Field/equals/equals003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the equals() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/equals003 checks assertion: + * public boolean equals(java.lang.Object obj) + * 1. Returns false if the Object and Field are in different classes + * but mirror the same field. + * There are MainClass, two classes (SameClass1, SameClass2) that extends + * it and do not override fields from super class, OverridenClass that + * extends MainClass and overrides all fields. Three comparisons are made: + * - Two fields from MainClass and SameClass1, that mirror the same field + * are compared. Expected result - true. + * - Two fields from MainClass and OverridenClass, that mirror the same field + * are compared. Expected result - false. + * - Two fields from SameClass1 and SameClass2, that mirror the same field + * are compared. Expected result - true. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.equals.equals003 + * nsk.jdi.Field.equals.equals003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.equals.equals003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003a.java new file mode 100644 index 00000000000..289fc8a03d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals003a.java @@ -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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class equals003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + SameClass1 sc1 = new SameClass1(); + SameClass2 sc2 = new SameClass2(); + OverridenClass rc = new OverridenClass(); + + 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 SameClass1 extends MainClass { + // All fields are the same as in MainClass +} + +class SameClass2 extends MainClass { + // All fields are the same as in MainClass +} + +class OverridenClass extends MainClass { + // All fields are redefined + + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; +} + +class MainClass { + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005.java new file mode 100644 index 00000000000..f2f92335ca5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005.java @@ -0,0 +1,145 @@ +/* + * 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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class equals005 { + private static Log log; + private final static String prefix = "nsk.jdi.Field.equals."; + private final static String className = "equals005"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field srcField = (Field)fieldsIterator.next(); + String name = srcField.name(); + Field checkField; + boolean fieldsEqual; + + if (name == null) { + log.complain("debuger FAILURE 1> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + try { + checkField = refType.fieldByName(name); + } catch (Exception e) { + log.complain("debuger FAILURE 2> Can't create field to check " + + "for field " + name); + testFailed = true; + continue; + } + fieldsEqual = srcField.equals(checkField); + log.display("debuger> Fields " + name + " and " + checkField.name() + + " compared, result " + fieldsEqual); + if (!fieldsEqual) { + // Fields declared in the same class and mirror the same + // fields are equal + log.complain("debuger FAILURE 3> Same fields with name " + name + + " are not equal. Expected result: equal."); + testFailed = true; + continue; + } + } + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005/TestDescription.java new file mode 100644 index 00000000000..88a837e492b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005/TestDescription.java @@ -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/Field/equals/equals005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the equals() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/equals005 checks assertion: + * public boolean equals(java.lang.Object obj) + * 1. Returns true if the Object and Field are declared in the same class + * or interface, in the same VM. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.equals.equals005 + * nsk.jdi.Field.equals.equals005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.equals.equals005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005a.java new file mode 100644 index 00000000000..9758af546f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/equals/equals005a.java @@ -0,0 +1,97 @@ +/* + * 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.Field.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class equals005a { + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + 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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001.java new file mode 100644 index 00000000000..3f5d99ddaa9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001.java @@ -0,0 +1,130 @@ +/* + * 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.Field.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class hashcode001 { + private static Log log; + private final static String prefix = "nsk.jdi.Field.hashCode."; + private final static String className = "hashcode001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields); + return 2; + } + log.display("debuger> Total fields found: " + fields.size()); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + int hash1 = field.hashCode(); + int hash2 = field.hashCode(); + // hashCode() returns int value and always should be the same + // for one field + log.display("debuger> " + i + " field " + field.name() + + "(" + field.typeName() + ") has hashCode = " + hash1); + if (hash1 != hash2) { + log.complain("debuger FAILURE> Two different hash codes for " + + "field " + field.name() + " (" + field.typeName() + + "): " + hash1 + " and " + hash2 + ". Should be " + + "the same"); + testFailed = true; + } + } + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..3aa7cad3029 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001/TestDescription.java @@ -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/Field/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the hashCode() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/hashcode001 checks assertion: + * public int hashCode() + * Returns: the integer code + * Whenever hashCode() invoked on the same Field more then once during + * an execution, it must consistently return the same integer. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.hashCode.hashcode001 + * nsk.jdi.Field.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001a.java new file mode 100644 index 00000000000..722dcbc1128 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/hashCode/hashcode001a.java @@ -0,0 +1,97 @@ +/* + * 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.Field.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class hashcode001a { + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + + log.display("DEBUGEE> debugee started."); + 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(95); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(97); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001.java new file mode 100644 index 00000000000..9218197eab0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001.java @@ -0,0 +1,142 @@ +/* + * 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.Field.isEnumConstant; + +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 isenumconstant001 { + + //------------------------------------------------------- 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.Field.isEnumConstant."; + private final static String className = "isenumconstant001"; + 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", "f4"}; + 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 checkedField = checkedClass.fieldByName(expectedEnumFieldsNames[i]); + if (checkedField.isEnumConstant()) { + display("Field.isEnumConstant() returned expected true for"); + display("\t" + expectedEnumFieldsNames[i] + " field of enum " + className ); + } else { + display("Field.isEnumConstant() returned unexpected false for"); + display("\t" + expectedEnumFieldsNames[i] + " field of enum " + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001/TestDescription.java new file mode 100644 index 00000000000..c281ea919b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/Field/isEnumConstant/isenumconstant001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isEnumConstant() method of Field interface. + * The test checks if the method returns true for each enum + * constant declared in mirrored enum type. + * The test consists of a debugger program (isenumconstant001.java) + * and debuggee application (isenumconstant001a.java). + * Package name is nsk.jdi.Field.isEnumConstant . + * 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 isEnumConstant() method for each + * expected enum constant field of mirrrored enum types. + * 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.Field.isEnumConstant.isenumconstant001 + * nsk.jdi.Field.isEnumConstant.isenumconstant001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.isEnumConstant.isenumconstant001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001a.java new file mode 100644 index 00000000000..4c4471acca6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001a.java @@ -0,0 +1,121 @@ +/* + * 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.Field.isEnumConstant; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isenumconstant001a { + + //------------------------------------------------------- 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 isenumconstant001Enum1 f1 = isenumconstant001Enum1.e2; + static isenumconstant001Enum2 f2 = isenumconstant001Enum2.e1; + static isenumconstant001Enum3 f3 = isenumconstant001Enum3.e1; + static isenumconstant001Enum1.Enum1_ f4 = isenumconstant001Enum1.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(isenumconstant001.SIGNAL_READY); + + + //pipe.println(isenumconstant001.SIGNAL_GO); + receiveSignal(isenumconstant001.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum isenumconstant001Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum isenumconstant001Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum isenumconstant001Enum3 { + e1(1), e2(2); + + int ii; + + isenumconstant001Enum3 (int i) { + ii = i; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001.java new file mode 100644 index 00000000000..ca1fc0aabd7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001.java @@ -0,0 +1,389 @@ +/* + * 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.Field.isTransient; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class istrans001 { + final static String IS_TRANS = "transient"; + final static String NOT_TRANS = ""; + final static int TOTAL_FIELDS = 216; + final static String FIELDS_TYPE_NAME[][] = { + {"z0", NOT_TRANS}, + {"z1", NOT_TRANS}, + {"z2", NOT_TRANS}, + {"b0", NOT_TRANS}, + {"b1", NOT_TRANS}, + {"b2", NOT_TRANS}, + {"c0", NOT_TRANS}, + {"c1", NOT_TRANS}, + {"c2", NOT_TRANS}, + {"d0", NOT_TRANS}, + {"d1", NOT_TRANS}, + {"d2", NOT_TRANS}, + {"f0", NOT_TRANS}, + {"f1", NOT_TRANS}, + {"f2", NOT_TRANS}, + {"i0", NOT_TRANS}, + {"i1", NOT_TRANS}, + {"i2", NOT_TRANS}, + {"l0", NOT_TRANS}, + {"l1", NOT_TRANS}, + {"l2", NOT_TRANS}, + + {"z0T", IS_TRANS}, + {"z1T", IS_TRANS}, + {"z2T", IS_TRANS}, + {"b0T", IS_TRANS}, + {"b1T", IS_TRANS}, + {"b2T", IS_TRANS}, + {"c0T", IS_TRANS}, + {"c1T", IS_TRANS}, + {"c2T", IS_TRANS}, + {"d0T", IS_TRANS}, + {"d1T", IS_TRANS}, + {"d2T", IS_TRANS}, + {"f0T", IS_TRANS}, + {"f1T", IS_TRANS}, + {"f2T", IS_TRANS}, + {"i0T", IS_TRANS}, + {"i1T", IS_TRANS}, + {"i2T", IS_TRANS}, + {"l0T", IS_TRANS}, + {"l1T", IS_TRANS}, + {"l2T", IS_TRANS}, + + {"lS0", NOT_TRANS}, + {"lS1", NOT_TRANS}, + {"lS2", NOT_TRANS}, + {"lP0", NOT_TRANS}, + {"lP1", NOT_TRANS}, + {"lP2", NOT_TRANS}, + {"lU0", NOT_TRANS}, + {"lU1", NOT_TRANS}, + {"lU2", NOT_TRANS}, + {"lR0", NOT_TRANS}, + {"lR1", NOT_TRANS}, + {"lR2", NOT_TRANS}, + {"lV0", NOT_TRANS}, + {"lV1", NOT_TRANS}, + {"lV2", NOT_TRANS}, + {"lF0", NOT_TRANS}, + {"lF1", NOT_TRANS}, + {"lF2", NOT_TRANS}, + + {"lS0T", IS_TRANS}, + {"lS1T", IS_TRANS}, + {"lS2T", IS_TRANS}, + {"lP0T", IS_TRANS}, + {"lP1T", IS_TRANS}, + {"lP2T", IS_TRANS}, + {"lU0T", IS_TRANS}, + {"lU1T", IS_TRANS}, + {"lU2T", IS_TRANS}, + {"lR0T", IS_TRANS}, + {"lR1T", IS_TRANS}, + {"lR2T", IS_TRANS}, + {"lV0T", IS_TRANS}, + {"lV1T", IS_TRANS}, + {"lV2T", IS_TRANS}, + {"lF0T", IS_TRANS}, + {"lF1T", IS_TRANS}, + {"lF2T", IS_TRANS}, + + {"X0", NOT_TRANS}, + {"X1", NOT_TRANS}, + {"X2", NOT_TRANS}, + {"Z0", NOT_TRANS}, + {"Z1", NOT_TRANS}, + {"Z2", NOT_TRANS}, + {"B0", NOT_TRANS}, + {"B1", NOT_TRANS}, + {"B2", NOT_TRANS}, + {"C0", NOT_TRANS}, + {"C1", NOT_TRANS}, + {"C2", NOT_TRANS}, + {"D0", NOT_TRANS}, + {"D1", NOT_TRANS}, + {"D2", NOT_TRANS}, + {"F0", NOT_TRANS}, + {"F1", NOT_TRANS}, + {"F2", NOT_TRANS}, + {"I0", NOT_TRANS}, + {"I1", NOT_TRANS}, + {"I2", NOT_TRANS}, + {"L0", NOT_TRANS}, + {"L1", NOT_TRANS}, + {"L2", NOT_TRANS}, + {"S0", NOT_TRANS}, + {"S1", NOT_TRANS}, + {"S2", NOT_TRANS}, + {"O0", NOT_TRANS}, + {"O1", NOT_TRANS}, + {"O2", NOT_TRANS}, + + {"X0T", IS_TRANS}, + {"X1T", IS_TRANS}, + {"X2T", IS_TRANS}, + {"Z0T", IS_TRANS}, + {"Z1T", IS_TRANS}, + {"Z2T", IS_TRANS}, + {"B0T", IS_TRANS}, + {"B1T", IS_TRANS}, + {"B2T", IS_TRANS}, + {"C0T", IS_TRANS}, + {"C1T", IS_TRANS}, + {"C2T", IS_TRANS}, + {"D0T", IS_TRANS}, + {"D1T", IS_TRANS}, + {"D2T", IS_TRANS}, + {"F0T", IS_TRANS}, + {"F1T", IS_TRANS}, + {"F2T", IS_TRANS}, + {"I0T", IS_TRANS}, + {"I1T", IS_TRANS}, + {"I2T", IS_TRANS}, + {"L0T", IS_TRANS}, + {"L1T", IS_TRANS}, + {"L2T", IS_TRANS}, + {"S0T", IS_TRANS}, + {"S1T", IS_TRANS}, + {"S2T", IS_TRANS}, + {"O0T", IS_TRANS}, + {"O1T", IS_TRANS}, + {"O2T", IS_TRANS}, + + {"LS0", NOT_TRANS}, + {"LS1", NOT_TRANS}, + {"LS2", NOT_TRANS}, + {"LP0", NOT_TRANS}, + {"LP1", NOT_TRANS}, + {"LP2", NOT_TRANS}, + {"LU0", NOT_TRANS}, + {"LU1", NOT_TRANS}, + {"LU2", NOT_TRANS}, + {"LR0", NOT_TRANS}, + {"LR1", NOT_TRANS}, + {"LR2", NOT_TRANS}, + {"LV0", NOT_TRANS}, + {"LV1", NOT_TRANS}, + {"LV2", NOT_TRANS}, + {"LF0", NOT_TRANS}, + {"LF1", NOT_TRANS}, + {"LF2", NOT_TRANS}, + + {"LS0T", IS_TRANS}, + {"LS1T", IS_TRANS}, + {"LS2T", IS_TRANS}, + {"LP0T", IS_TRANS}, + {"LP1T", IS_TRANS}, + {"LP2T", IS_TRANS}, + {"LU0T", IS_TRANS}, + {"LU1T", IS_TRANS}, + {"LU2T", IS_TRANS}, + {"LR0T", IS_TRANS}, + {"LR1T", IS_TRANS}, + {"LR2T", IS_TRANS}, + {"LV0T", IS_TRANS}, + {"LV1T", IS_TRANS}, + {"LV2T", IS_TRANS}, + {"LF0T", IS_TRANS}, + {"LF1T", IS_TRANS}, + {"LF2T", IS_TRANS}, + + {"E0", NOT_TRANS}, + {"E1", NOT_TRANS}, + {"E2", NOT_TRANS}, + + {"E0T", IS_TRANS}, + {"E1T", IS_TRANS}, + {"E2T", IS_TRANS}, + + {"ES0", NOT_TRANS}, + {"ES1", NOT_TRANS}, + {"ES2", NOT_TRANS}, + {"EP0", NOT_TRANS}, + {"EP1", NOT_TRANS}, + {"EP2", NOT_TRANS}, + {"EU0", NOT_TRANS}, + {"EU1", NOT_TRANS}, + {"EU2", NOT_TRANS}, + {"ER0", NOT_TRANS}, + {"ER1", NOT_TRANS}, + {"ER2", NOT_TRANS}, + {"EV0", NOT_TRANS}, + {"EV1", NOT_TRANS}, + {"EV2", NOT_TRANS}, + {"EF0", NOT_TRANS}, + {"EF1", NOT_TRANS}, + {"EF2", NOT_TRANS}, + + {"ES0T", IS_TRANS}, + {"ES1T", IS_TRANS}, + {"ES2T", IS_TRANS}, + {"EP0T", IS_TRANS}, + {"EP1T", IS_TRANS}, + {"EP2T", IS_TRANS}, + {"EU0T", IS_TRANS}, + {"EU1T", IS_TRANS}, + {"EU2T", IS_TRANS}, + {"ER0T", IS_TRANS}, + {"ER1T", IS_TRANS}, + {"ER2T", IS_TRANS}, + {"EV0T", IS_TRANS}, + {"EV1T", IS_TRANS}, + {"EV2T", IS_TRANS}, + {"EF0T", IS_TRANS}, + {"EF1T", IS_TRANS}, + {"EF2T", IS_TRANS} + }; + private static Log log; + private final static String prefix = "nsk.jdi.Field.isTransient."; + private final static String className = "istrans001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields + ", should be " + TOTAL_FIELDS); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + boolean isTrans = field.isTransient(); + String name = field.name(); + String realIsTrans; + + if (name == null) { + log.complain("debuger FAILURE 1> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field (" + name + "), " + + "isTransient = " + isTrans + " read."); + try { + realIsTrans = getTransByName(name); + } catch (Error e) { + log.complain("debuger FAILURE 2> Unexpected Error " + e); + return 2; + } + // isTransient() returns true if the field is transient, + // returns false if the field is not transient + if ((isTrans && !realIsTrans.equals(IS_TRANS)) || + (!isTrans && realIsTrans.equals(IS_TRANS)) + ) { + log.complain("debuger FAILURE 3> " + i + " field " + name + + ": read field.isTransient() = " + isTrans + + " real isTransient should be " + realIsTrans); + testFailed = true; + } + } + 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; + } + } + } + + private static String getTransByName(String name) + throws Error + { + for (int i = 0; i < TOTAL_FIELDS; i++) { + String fieldName = FIELDS_TYPE_NAME[i][0]; + if (fieldName.equals(name)) { + return FIELDS_TYPE_NAME[i][1]; + } + } + throw new Error("Error in test. Unknown field " + name); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001/TestDescription.java new file mode 100644 index 00000000000..bdbda687c0c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001/TestDescription.java @@ -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/Field/isTransient/istrans001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isTransient() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/istrans001 checks assertions: + * public boolean isTransient() + * 1. Returns true if this field is transient. + * 2. Returns false if this field is not transient. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.isTransient.istrans001 + * nsk.jdi.Field.isTransient.istrans001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.isTransient.istrans001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001a.java new file mode 100644 index 00000000000..225ae95ac25 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001a.java @@ -0,0 +1,137 @@ +/* + * 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.Field.isTransient; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class istrans001a { + 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}; + + transient boolean z0T, z1T[]={z0T}, z2T[][]={z1T}; + transient byte b0T, b1T[]={b0T}, b2T[][]={b1T}; + transient char c0T, c1T[]={c0T}, c2T[][]={c1T}; + transient double d0T, d1T[]={d0T}, d2T[][]={d1T}; + transient float f0T, f1T[]={f0T}, f2T[][]={f1T}; + transient int i0T, i1T[]={i0T}, i2T[][]={i1T}; + transient long l0T, l1T[]={l0T}, l2T[][]={l1T}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + transient static long lS0T, lS1T[]={lS0T}, lS2T[][]={lS1T}; + transient private long lP0T, lP1T[]={lP0T}, lP2T[][]={lP1T}; + transient public long lU0T, lU1T[]={lU0T}, lU2T[][]={lU1T}; + transient protected long lR0T, lR1T[]={lR0T}, lR2T[][]={lR1T}; + transient volatile long lV0T, lV1T[]={lV0T}, lV2T[][]={lV1T}; + transient final long lF0T = 999, lF1T[]={lF0T}, lF2T[][]={lF1T}; + + class Class {} + Class X0 = new Class(), X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + transient Class X0T, X1T[]={X0T}, X2T[][]={X1T}; + transient Boolean Z0T, Z1T[]={Z0T}, Z2T[][]={Z1T}; + transient Byte B0T, B1T[]={B0T}, B2T[][]={B1T}; + transient Character C0T, C1T[]={C0T}, C2T[][]={C1T}; + transient Double D0T, D1T[]={D0T}, D2T[][]={D1T}; + transient Float F0T, F1T[]={F0T}, F2T[][]={F1T}; + transient Integer I0T, I1T[]={I0T}, I2T[][]={I1T}; + transient Long L0T, L1T[]={L0T}, L2T[][]={L1T}; + transient String S0T, S1T[]={S0T}, S2T[][]={S1T}; + transient Object O0T, O1T[]={O0T}, O2T[][]={O1T}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + transient static Long LS0T, LS1T[]={LS0T}, LS2T[][]={LS1T}; + transient private Long LP0T, LP1T[]={LP0T}, LP2T[][]={LP1T}; + transient public Long LU0T, LU1T[]={LU0T}, LU2T[][]={LU1T}; + transient protected Long LR0T, LR1T[]={LR0T}, LR2T[][]={LR1T}; + transient volatile Long LV0T, LV1T[]={LV0T}, LV2T[][]={LV1T}; + transient final Long LF0T = new Long(999), LF1T[]={LF0T}, + LF2T[][]={LF1T}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + transient Inter E0T, E1T[]={E0T}, E2T[][]={E1T}; + + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + transient static Inter ES0T, ES1T[]={ES0T}, ES2T[][]={ES1T}; + transient private Inter EP0T, EP1T[]={EP0T}, EP2T[][]={EP1T}; + transient public Inter EU0T, EU1T[]={EU0T}, EU2T[][]={EU1T}; + transient protected Inter ER0T, ER1T[]={ER0T}, ER2T[][]={ER1T}; + transient volatile Inter EV0T, EV1T[]={EV0T}, EV2T[][]={EV1T}; + transient final Inter EF0T = null, EF1T[]={EF0T}, EF2T[][]={EF1T}; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + 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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001.java new file mode 100644 index 00000000000..10834197c9b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001.java @@ -0,0 +1,379 @@ +/* + * 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.Field.isVolatile; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class isvol001 { + final static String IS_VOL = "volatile"; + final static String NOT_VOL = ""; + final static int TOTAL_FIELDS = 207; + final static String FIELDS_TYPE_NAME[][] = { + {"z0", NOT_VOL}, + {"z1", NOT_VOL}, + {"z2", NOT_VOL}, + {"b0", NOT_VOL}, + {"b1", NOT_VOL}, + {"b2", NOT_VOL}, + {"c0", NOT_VOL}, + {"c1", NOT_VOL}, + {"c2", NOT_VOL}, + {"d0", NOT_VOL}, + {"d1", NOT_VOL}, + {"d2", NOT_VOL}, + {"f0", NOT_VOL}, + {"f1", NOT_VOL}, + {"f2", NOT_VOL}, + {"i0", NOT_VOL}, + {"i1", NOT_VOL}, + {"i2", NOT_VOL}, + {"l0", NOT_VOL}, + {"l1", NOT_VOL}, + {"l2", NOT_VOL}, + + {"z0V", IS_VOL}, + {"z1V", IS_VOL}, + {"z2V", IS_VOL}, + {"b0V", IS_VOL}, + {"b1V", IS_VOL}, + {"b2V", IS_VOL}, + {"c0V", IS_VOL}, + {"c1V", IS_VOL}, + {"c2V", IS_VOL}, + {"d0V", IS_VOL}, + {"d1V", IS_VOL}, + {"d2V", IS_VOL}, + {"f0V", IS_VOL}, + {"f1V", IS_VOL}, + {"f2V", IS_VOL}, + {"i0V", IS_VOL}, + {"i1V", IS_VOL}, + {"i2V", IS_VOL}, + {"l0V", IS_VOL}, + {"l1V", IS_VOL}, + {"l2V", IS_VOL}, + + {"lS0", NOT_VOL}, + {"lS1", NOT_VOL}, + {"lS2", NOT_VOL}, + {"lP0", NOT_VOL}, + {"lP1", NOT_VOL}, + {"lP2", NOT_VOL}, + {"lU0", NOT_VOL}, + {"lU1", NOT_VOL}, + {"lU2", NOT_VOL}, + {"lR0", NOT_VOL}, + {"lR1", NOT_VOL}, + {"lR2", NOT_VOL}, + {"lT0", NOT_VOL}, + {"lT1", NOT_VOL}, + {"lT2", NOT_VOL}, + {"lF0", NOT_VOL}, + {"lF1", NOT_VOL}, + {"lF2", NOT_VOL}, + + {"lS0V", IS_VOL}, + {"lS1V", IS_VOL}, + {"lS2V", IS_VOL}, + {"lP0V", IS_VOL}, + {"lP1V", IS_VOL}, + {"lP2V", IS_VOL}, + {"lU0V", IS_VOL}, + {"lU1V", IS_VOL}, + {"lU2V", IS_VOL}, + {"lR0V", IS_VOL}, + {"lR1V", IS_VOL}, + {"lR2V", IS_VOL}, + {"lT0V", IS_VOL}, + {"lT1V", IS_VOL}, + {"lT2V", IS_VOL}, + + {"X0", NOT_VOL}, + {"X1", NOT_VOL}, + {"X2", NOT_VOL}, + {"Z0", NOT_VOL}, + {"Z1", NOT_VOL}, + {"Z2", NOT_VOL}, + {"B0", NOT_VOL}, + {"B1", NOT_VOL}, + {"B2", NOT_VOL}, + {"C0", NOT_VOL}, + {"C1", NOT_VOL}, + {"C2", NOT_VOL}, + {"D0", NOT_VOL}, + {"D1", NOT_VOL}, + {"D2", NOT_VOL}, + {"F0", NOT_VOL}, + {"F1", NOT_VOL}, + {"F2", NOT_VOL}, + {"I0", NOT_VOL}, + {"I1", NOT_VOL}, + {"I2", NOT_VOL}, + {"L0", NOT_VOL}, + {"L1", NOT_VOL}, + {"L2", NOT_VOL}, + {"S0", NOT_VOL}, + {"S1", NOT_VOL}, + {"S2", NOT_VOL}, + {"O0", NOT_VOL}, + {"O1", NOT_VOL}, + {"O2", NOT_VOL}, + + {"X0V", IS_VOL}, + {"X1V", IS_VOL}, + {"X2V", IS_VOL}, + {"Z0V", IS_VOL}, + {"Z1V", IS_VOL}, + {"Z2V", IS_VOL}, + {"B0V", IS_VOL}, + {"B1V", IS_VOL}, + {"B2V", IS_VOL}, + {"C0V", IS_VOL}, + {"C1V", IS_VOL}, + {"C2V", IS_VOL}, + {"D0V", IS_VOL}, + {"D1V", IS_VOL}, + {"D2V", IS_VOL}, + {"F0V", IS_VOL}, + {"F1V", IS_VOL}, + {"F2V", IS_VOL}, + {"I0V", IS_VOL}, + {"I1V", IS_VOL}, + {"I2V", IS_VOL}, + {"L0V", IS_VOL}, + {"L1V", IS_VOL}, + {"L2V", IS_VOL}, + {"S0V", IS_VOL}, + {"S1V", IS_VOL}, + {"S2V", IS_VOL}, + {"O0V", IS_VOL}, + {"O1V", IS_VOL}, + {"O2V", IS_VOL}, + + {"LS0", NOT_VOL}, + {"LS1", NOT_VOL}, + {"LS2", NOT_VOL}, + {"LP0", NOT_VOL}, + {"LP1", NOT_VOL}, + {"LP2", NOT_VOL}, + {"LU0", NOT_VOL}, + {"LU1", NOT_VOL}, + {"LU2", NOT_VOL}, + {"LR0", NOT_VOL}, + {"LR1", NOT_VOL}, + {"LR2", NOT_VOL}, + {"LT0", NOT_VOL}, + {"LT1", NOT_VOL}, + {"LT2", NOT_VOL}, + {"LF0", NOT_VOL}, + {"LF1", NOT_VOL}, + {"LF2", NOT_VOL}, + + {"LS0V", IS_VOL}, + {"LS1V", IS_VOL}, + {"LS2V", IS_VOL}, + {"LP0V", IS_VOL}, + {"LP1V", IS_VOL}, + {"LP2V", IS_VOL}, + {"LU0V", IS_VOL}, + {"LU1V", IS_VOL}, + {"LU2V", IS_VOL}, + {"LR0V", IS_VOL}, + {"LR1V", IS_VOL}, + {"LR2V", IS_VOL}, + {"LT0V", IS_VOL}, + {"LT1V", IS_VOL}, + {"LT2V", IS_VOL}, + + {"E0", NOT_VOL}, + {"E1", NOT_VOL}, + {"E2", NOT_VOL}, + + {"E0V", IS_VOL}, + {"E1V", IS_VOL}, + {"E2V", IS_VOL}, + + {"ES0", NOT_VOL}, + {"ES1", NOT_VOL}, + {"ES2", NOT_VOL}, + {"EP0", NOT_VOL}, + {"EP1", NOT_VOL}, + {"EP2", NOT_VOL}, + {"EU0", NOT_VOL}, + {"EU1", NOT_VOL}, + {"EU2", NOT_VOL}, + {"ER0", NOT_VOL}, + {"ER1", NOT_VOL}, + {"ER2", NOT_VOL}, + {"ET0", NOT_VOL}, + {"ET1", NOT_VOL}, + {"ET2", NOT_VOL}, + {"EF0", NOT_VOL}, + {"EF1", NOT_VOL}, + {"EF2", NOT_VOL}, + + {"ES0V", IS_VOL}, + {"ES1V", IS_VOL}, + {"ES2V", IS_VOL}, + {"EP0V", IS_VOL}, + {"EP1V", IS_VOL}, + {"EP2V", IS_VOL}, + {"EU0V", IS_VOL}, + {"EU1V", IS_VOL}, + {"EU2V", IS_VOL}, + {"ER0V", IS_VOL}, + {"ER1V", IS_VOL}, + {"ER2V", IS_VOL}, + {"ET0V", IS_VOL}, + {"ET1V", IS_VOL}, + {"ET2V", IS_VOL} + }; + private static Log log; + private final static String prefix = "nsk.jdi.Field.isVolatile."; + private final static String className = "isvol001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields + ", should be " + TOTAL_FIELDS); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + boolean isVol = field.isVolatile(); + String name = field.name(); + String realIsVol; + + if (name == null) { + log.complain("debuger FAILURE 1> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field (" + name + "), " + + "isVolatile = " + isVol + " read."); + try { + realIsVol = getVolByName(name); + } catch (Error e) { + log.complain("debuger FAILURE 2> Unexpected Error " + e); + return 2; + } + // isVolatile() returns true if the field is volatile, + // returns false if the field is not volatile + if ((isVol && !realIsVol.equals(IS_VOL)) || + (!isVol && realIsVol.equals(IS_VOL)) + ) { + log.complain("debuger FAILURE> " + i + " field " + name + + ": read field.isVolatile() = " + isVol + + " real isVolatile should be " + realIsVol); + testFailed = true; + } + } + 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; + } + } + } + + private static String getVolByName(String name) + throws Error + { + for (int i = 0; i < TOTAL_FIELDS; i++) { + String fieldName = FIELDS_TYPE_NAME[i][0]; + if (fieldName.equals(name)) { + return FIELDS_TYPE_NAME[i][1]; + } + } + throw new Error("Error in test. Unknown field " + name); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001/TestDescription.java new file mode 100644 index 00000000000..939938b28dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001/TestDescription.java @@ -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/Field/isVolatile/isvol001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isVolatile() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/isvol001 checks assertions: + * public boolean isVolatile() + * 1. Returns true if this field is volatile. + * 2. Returns false if this field is not volatile. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.isVolatile.isvol001 + * nsk.jdi.Field.isVolatile.isvol001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.isVolatile.isvol001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001a.java new file mode 100644 index 00000000000..1fb0d769f40 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isVolatile/isvol001a.java @@ -0,0 +1,134 @@ +/* + * 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.Field.isVolatile; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isvol001a { + 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}; + + volatile boolean z0V, z1V[]={z0V}, z2V[][]={z1V}; + volatile byte b0V, b1V[]={b0V}, b2V[][]={b1V}; + volatile char c0V, c1V[]={c0V}, c2V[][]={c1V}; + volatile double d0V, d1V[]={d0V}, d2V[][]={d1V}; + volatile float f0V, f1V[]={f0V}, f2V[][]={f1V}; + volatile int i0V, i1V[]={i0V}, i2V[][]={i1V}; + volatile long l0V, l1V[]={l0V}, l2V[][]={l1V}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + volatile static long lS0V, lS1V[]={lS0V}, lS2V[][]={lS1V}; + volatile private long lP0V, lP1V[]={lP0V}, lP2V[][]={lP1V}; + volatile public long lU0V, lU1V[]={lU0V}, lU2V[][]={lU1V}; + volatile protected long lR0V, lR1V[]={lR0V}, lR2V[][]={lR1V}; + volatile transient long lT0V, lT1V[]={lT0V}, lT2V[][]={lT1V}; + + class Class {} + Class X0, X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + volatile Class X0V, X1V[]={X0V}, X2V[][]={X1V}; + volatile Boolean Z0V, Z1V[]={Z0V}, Z2V[][]={Z1V}; + volatile Byte B0V, B1V[]={B0V}, B2V[][]={B1V}; + volatile Character C0V, C1V[]={C0V}, C2V[][]={C1V}; + volatile Double D0V, D1V[]={D0V}, D2V[][]={D1V}; + volatile Float F0V, F1V[]={F0V}, F2V[][]={F1V}; + volatile Integer I0V, I1V[]={I0V}, I2V[][]={I1V}; + volatile Long L0V, L1V[]={L0V}, L2V[][]={L1V}; + volatile String S0V, S1V[]={S0V}, S2V[][]={S1V}; + volatile Object O0V, O1V[]={O0V}, O2V[][]={O1V}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + volatile static Long LS0V, LS1V[]={LS0V}, LS2V[][]={LS1V}; + volatile private Long LP0V, LP1V[]={LP0V}, LP2V[][]={LP1V}; + volatile public Long LU0V, LU1V[]={LU0V}, LU2V[][]={LU1V}; + volatile protected Long LR0V, LR1V[]={LR0V}, LR2V[][]={LR1V}; + volatile transient Long LT0V, LT1V[]={LT0V}, LT2V[][]={LT1V}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + + volatile Inter E0V, E1V[]={E0V}, E2V[][]={E1V}; + + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + volatile static Inter ES0V, ES1V[]={ES0V}, ES2V[][]={ES1V}; + volatile private Inter EP0V, EP1V[]={EP0V}, EP2V[][]={EP1V}; + volatile public Inter EU0V, EU1V[]={EU0V}, EU2V[][]={EU1V}; + volatile protected Inter ER0V, ER1V[]={ER0V}, ER2V[][]={ER1V}; + volatile transient Inter ET0V, ET1V[]={ET0V}, ET2V[][]={ET1V}; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + 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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001.java new file mode 100644 index 00000000000..536289d2a4a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001.java @@ -0,0 +1,227 @@ +/* + * 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.Field.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class type001 { + final static int TOTAL_FIELDS = 15; + final static String FIELDS_TYPE_NAME[][] = { + {"boolean", "z0", "Z"}, + {"byte", "b0", "B"}, + {"char", "c0", "C"}, + {"double", "d0", "D"}, + {"float", "f0", "F"}, + {"int", "i0", "I"}, + {"long", "l0", "J"}, + {"short", "r0", "S"}, + + {"long", "lS0", "J"}, + {"long", "lP0", "J"}, + {"long", "lU0", "J"}, + {"long", "lR0", "J"}, + {"long", "lT0", "J"}, + {"long", "lV0", "J"}, + {"long", "lF0", "J"} + }; + + private static Log log; + private final static String prefix = "nsk.jdi.Field.type."; + private final static String className = "type001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields + ", should be " + TOTAL_FIELDS); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + String name = field.name(); + Type type; + String realType; + + try { + type = field.type(); + } catch (ClassNotLoadedException e) { + log.complain("debuger FAILURE 1> Can't get primitive type of " + + "field " + name); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + if (type == null) { + log.complain("debuger FAILURE 2> Type is null for " + i + + " field " + name); + testFailed = true; + continue; + } + if (name == null) { + log.complain("debuger FAILURE 3> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + try { + realType = getStatByName(name, 2); + } catch (Error e) { + log.complain("debuger FAILURE 4> Unexpected Error " + e); + return 2; + } + String signature = type.signature(); + log.display("debuger> " + i + " field (" + name + ") of type " + + type + " signature " + signature + " read."); + char signJNI = realType.charAt(0); + try { + switch (signJNI) { + case 'Z': + BooleanType typeBoolean = (BooleanType)type; + break; + case 'B': + ByteType typeByte = (ByteType)type; + break; + case 'C': + CharType typeChar = (CharType)type; + break; + case 'D': + DoubleType typeDouble = (DoubleType)type; + break; + case 'F': + FloatType typeFloat = (FloatType)type; + break; + case 'I': + IntegerType typeInteger = (IntegerType)type; + break; + case 'J': + LongType typeLong = (LongType)type; + break; + case 'S': + ShortType typeShort = (ShortType)type; + break; + default: + log.complain("debuger FAILURE 5> Error in test. " + + "Unknown JNI signature " + signJNI); + return 2; + } + } catch (ClassCastException e) { + log.complain("debuger FAILURE 6> Can't convert field " + name + + " to PrimitiveType"); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + } + + if (!realType.equals(signature)) { + log.complain("debuger FAILURE 7> Signature of field " + name + + " is " + signature + ", but should be " + + realType); + testFailed = true; + } + } + 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; + } + } + } + + private static String getStatByName(String name, int field) + throws Error + { + for (int i = 0; i < TOTAL_FIELDS; i++) { + String fieldName = FIELDS_TYPE_NAME[i][1]; + if (fieldName.equals(name)) { + return FIELDS_TYPE_NAME[i][field]; + } + } + throw new Error("Error in test. Unknown field " + name); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001/TestDescription.java new file mode 100644 index 00000000000..e7b90b955e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/Field/type/type001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the type() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/type001 checks assertion: + * public Type type() throws ClassNotLoadedException + * 1. For primitive fields an apropriate PrimitiveType is returned. + * Each field of primitive type of debugee should be casted to apropriate + * PrimitiveType in debuger without exceptions. Also, each signature of + * returned Type of a field should agree with JDI Type Signatures. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.type.type001 + * nsk.jdi.Field.type.type001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.type.type001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001a.java new file mode 100644 index 00000000000..d16f3e49f1a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type001a.java @@ -0,0 +1,68 @@ +/* + * 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.Field.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class type001a { + boolean z0; + byte b0; + char c0; + double d0; + float f0; + int i0; + long l0; + short r0; + + static long lS0; + private long lP0; + public long lU0; + protected long lR0; + transient long lT0; + volatile long lV0; + final long lF0 = 999; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + 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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002.java new file mode 100644 index 00000000000..ae816148f29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002.java @@ -0,0 +1,249 @@ +/* + * 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.Field.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class type002 { + final static int TOTAL_FIELDS = 25; + // final static String ARRAY_TYPE = "A"; + // Not used yet because of bug + // 4404195: JDI: spec: Field.type() is undefined for array fields + final static String CLASS_TYPE = "C"; + final static String INTERFACE_TYPE = "I"; + + final static String FIELDS_TYPE_NAME[][] = { + {"Class", "X0", CLASS_TYPE}, + {"Boolean", "Z0", CLASS_TYPE}, + {"Byte", "B0", CLASS_TYPE}, + {"Character", "C0", CLASS_TYPE}, + {"Double", "D0", CLASS_TYPE}, + {"Float", "F0", CLASS_TYPE}, + {"Integer", "I0", CLASS_TYPE}, + {"Long", "L0", CLASS_TYPE}, + {"String", "S0", CLASS_TYPE}, + {"Object", "O0", CLASS_TYPE}, + + {"Long", "LS0", CLASS_TYPE}, + {"Long", "LP0", CLASS_TYPE}, + {"Long", "LU0", CLASS_TYPE}, + {"Long", "LR0", CLASS_TYPE}, + {"Long", "LT0", CLASS_TYPE}, + {"Long", "LV0", CLASS_TYPE}, + {"Long", "LF0", CLASS_TYPE}, + + {"Inter", "E0", INTERFACE_TYPE}, + {"Inter", "ES0", INTERFACE_TYPE}, + {"Inter", "EP0", INTERFACE_TYPE}, + {"Inter", "EU0", INTERFACE_TYPE}, + {"Inter", "ER0", INTERFACE_TYPE}, + {"Inter", "ET0", INTERFACE_TYPE}, + {"Inter", "EV0", INTERFACE_TYPE}, + {"Inter", "EF0", INTERFACE_TYPE}, + }; + + private static Log log; + private final static String prefix = "nsk.jdi.Field.type."; + private final static String className = "type002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToChekName = prefix + "type002aClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(classToChekName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + classToChekName + + " not found."); + return 2; + } + log.display("debuger> Class loaded with loader " + + refType.classLoader()); + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields + ", should be " + TOTAL_FIELDS); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + String name = field.name(); + String realType; + String realSign; + Type type; + ArrayType typeArray; + ClassType typeClass; + InterfaceType typeInterface; + + try { + type = field.type(); + } catch (ClassNotLoadedException e) { + // All classes are loaded, so ClassNotLoadedException is + // not expected + log.complain("debuger FAILURE 1> Can't get type of field " + + name); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + if (type == null) { + log.complain("debuger FAILURE 2> Type is null for " + i + + " field " + name); + testFailed = true; + continue; + } + if (name == null) { + log.display("debuger FAILURE 3> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + try { + realType = getStatByName(name, 0); + } catch (Error e) { + log.complain("debuger FAILURE 4> Unexpected Error " + e); + return 2; + } + try { + realSign = getStatByName(name, 2); + } catch (Error e) { + log.complain("debuger FAILURE 5> Unexpected Error " + e); + return 2; + } + String signature = type.signature(); + log.display("debuger> " + i + " field (" + name + ") of type " + + type + " signature " + signature + " read."); + + char signJNI = realSign.charAt(0); + try { + switch (signJNI) { +// case 'A': +// typeArray = (ArrayType)type; +// break; +// Not used yet because of bug +// 4404195: JDI: spec: Field.type() is undefined for array fields + case 'C': + typeClass = (ClassType)type; + break; + case 'I': + typeInterface = (InterfaceType)type; + break; + default: + log.complain("debuger FAILURE 6> Error in test. " + + "Unknown JNI signature " + signJNI); + return 2; + } + } catch (ClassCastException e) { + log.complain("debuger FAILURE 7> Can't convert field " + name + + " to ReferenceType"); + log.complain("debuger FAILURE 7> Exception: " + e); + testFailed = true; + } + + if (signature.indexOf(realType) == -1) { + // field.signature() does not exist in realType + log.complain("debuger FAILURE 8> Signature of field " + name + + " is " + signature + ", but " + "should be " + + realType); + testFailed = true; + } + } + 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; + } + } + } + + private static String getStatByName(String name, int field) + throws Error + { + for (int i = 0; i < TOTAL_FIELDS; i++) { + String fieldName = FIELDS_TYPE_NAME[i][1]; + if (fieldName.equals(name)) { + return FIELDS_TYPE_NAME[i][field]; + } + } + throw new Error("Error in test. Unknown field " + name); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002/TestDescription.java new file mode 100644 index 00000000000..2e77d51123a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002/TestDescription.java @@ -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/Field/type/type002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the type() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/type002 checks assertion: + * public Type type() throws ClassNotLoadedException + * 1. For object fields, the appropriate ReferenceType is returned if it + * has been loaded through the enclosing type's class loader. + * Constructor for each class and interface are triggered, so all + * classes are loaded in debugee and ClassNotLoadedException are not + * thrown. Each field of reference type of debugee should be casted + * to apropriate ReferenceType (ArrayType, ClassType, InterfaceType) + * in debuger without exceptions. Also, each component type name should + * exist in signature of the Type. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.type.type002 + * nsk.jdi.Field.type.type002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.type.type002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002a.java new file mode 100644 index 00000000000..f06289d6038 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type002a.java @@ -0,0 +1,87 @@ +/* + * 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.Field.type; + +import com.sun.jdi.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class type002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + type002aClassToCheck check = new type002aClassToCheck(); + + 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 type002aClassToCheck { + // No array fields + class Class {} + Class X0 = new Class(); + Boolean Z0 = new Boolean(true); + Byte B0 = new Byte(Byte.MIN_VALUE); + Character C0 = new Character('\u00ff'); + Double D0 = new Double(1); + Float F0 = new Float(1f); + Integer I0 = new Integer(1); + Long L0 = new Long(1l); + String S0 = new String(); + Object O0 = new Object(); + + static Long LS0 = new Long(1l); + private Long LP0 = new Long(1l); + public Long LU0 = new Long(1l); + protected Long LR0 = new Long(1l); + transient Long LT0 = new Long(1l); + volatile Long LV0 = new Long(1l); + final Long LF0 = new Long(1l); + + interface Inter {} + static class InterClass implements Inter {} + Inter E0 = new InterClass(); + static Inter ES0 = new InterClass(); + private Inter EP0 = new InterClass(); + public Inter EU0 = new InterClass(); + protected Inter ER0 = new InterClass(); + transient Inter ET0 = new InterClass(); + volatile Inter EV0 = new InterClass(); + final Inter EF0 = new InterClass(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003.java new file mode 100644 index 00000000000..bab1315ba61 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003.java @@ -0,0 +1,133 @@ +/* + * 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.Field.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class type003 { + private static Log log; + private final static String prefix = "nsk.jdi.Field.type."; + private final static String className = "type003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToChekName = prefix + "type003aClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(classToChekName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + classToChekName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + String name = field.name(); + Type type; + + // All fields are not initalized in debugee, so all types are not + // loaded. ClassNotLoadedException; should be thrown + try { + type = field.type(); + log.complain("debuger FAILURE 1> Got type for field " + name + + " : " + type + ". Expected Exception " + + "ClassNotLoadedException"); + testFailed = true; + } catch (ClassNotLoadedException e) { + log.display("debuger> Can't get type of field " + name); + log.display("debuger> Exception: " + e); + } + } + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003/TestDescription.java new file mode 100644 index 00000000000..9ce8002fb33 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003/TestDescription.java @@ -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/Field/type/type003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the type() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/type003 checks assertion: + * public Type type() throws ClassNotLoadedException + * 1. Throws ClassNotLoadedException for object fields, if it + * has not been loaded through the enclosing type's class loader. + * Constructor for each class and interface are not triggered, so all + * classes are not loaded in debugee and ClassNotLoadedException should be + * thrown in debuger VM. + * COMMENTS + * To fix the bug 4423695, all previous classes are replaced with only three basic, + * - Class, Interface, and Array, - + * applied to inner and outer class types. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.type.type003 + * nsk.jdi.Field.type.type003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.type.type003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003a.java new file mode 100644 index 00000000000..fb66b3804e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type003a.java @@ -0,0 +1,76 @@ +/* + * 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.Field.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; + +public class type003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + type003aClassToCheck check = new type003aClassToCheck(); + + 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 type003aClassToCheck { + class InnerClass {} + InnerClass ic0; + InnerClass aic0[]; + + interface InnerIface {} + InnerIface ii0; + InnerIface aii0[]; + + type003aTestClass tc; + type003aTestClass tcA[]; + type003aIface iface; + type003aIface ifaceA[]; +} + +interface type003aIface { + static boolean b1 = false; +} + +class type003aTestClass implements type003aIface { + static final boolean b2 = true; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004.java new file mode 100644 index 00000000000..47336bb3b65 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004.java @@ -0,0 +1,143 @@ +/* + * 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.Field.type; + +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 type004 { + + //------------------------------------------------------- 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.Field.type."; + private final static String className = "type004"; + 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() { + 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.type().equals(checkedClass)) { + display("enum " + className + " has field " + expectedEnumFieldsNames[i]); + display("\t of expected type " + className); + } else { + complain("enum " + className + " has field " + expectedEnumFieldsNames[i]); + complain("\t of unexpected type " + foundField.type().name()); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004/TestDescription.java new file mode 100644 index 00000000000..02083132ac4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004/TestDescription.java @@ -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/Field/type/type004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for type() method of Field interface. + * The test checks if the method returns correct result for + * each enum constant field declared in mirrored enum type. + * The test consists of a debugger program (type004.java) + * and debuggee application (type004a.java). + * Package name is nsk.jdi.Field.type . + * 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 finds mirrors of enum types. Every of these + * enum types has the same enum constant fields: e1 and e2. + * The debugger checks if each field is "self-typed", i.e. + * of declaring enum type. + * 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.Field.type.type004 + * nsk.jdi.Field.type.type004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.type.type004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004a.java new file mode 100644 index 00000000000..92d568d7333 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/type/type004a.java @@ -0,0 +1,107 @@ +/* + * 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.Field.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class type004a { + + //------------------------------------------------------- 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 type004Enum1 f1 = type004Enum1.e2; + static type004Enum2 f2 = type004Enum2.e1; + static type004Enum1.Enum1_ f3 = type004Enum1.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(type004.SIGNAL_READY); + receiveSignal(type004.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum type004Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum type004Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001.java new file mode 100644 index 00000000000..32d6f6654f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001.java @@ -0,0 +1,306 @@ +/* + * 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.Field.typeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class typename001 { + final static String PRIM_CODE = "primitive"; + final static String REF_CODE = "reference"; + final static int TOTAL_FIELDS = 117; + final static String FIELDS_TYPE_NAME[][] = { + {"boolean", "z0", PRIM_CODE}, + {"boolean", "z1", REF_CODE}, + {"boolean", "z2", REF_CODE}, + {"byte", "b0", PRIM_CODE}, + {"byte", "b1", REF_CODE}, + {"byte", "b2", REF_CODE}, + {"char", "c0", PRIM_CODE}, + {"char", "c1", REF_CODE}, + {"char", "c2", REF_CODE}, + {"double", "d0", PRIM_CODE}, + {"double", "d1", REF_CODE}, + {"double", "d2", REF_CODE}, + {"float", "f0", PRIM_CODE}, + {"float", "f1", REF_CODE}, + {"float", "f2", REF_CODE}, + {"int", "i0", PRIM_CODE}, + {"int", "i1", REF_CODE}, + {"int", "i2", REF_CODE}, + {"long", "l0", PRIM_CODE}, + {"long", "l1", REF_CODE}, + {"long", "l2", REF_CODE}, + + {"long", "lS0", PRIM_CODE}, + {"long", "lS1", REF_CODE}, + {"long", "lS2", REF_CODE}, + {"long", "lP0", PRIM_CODE}, + {"long", "lP1", REF_CODE}, + {"long", "lP2", REF_CODE}, + {"long", "lU0", PRIM_CODE}, + {"long", "lU1", REF_CODE}, + {"long", "lU2", REF_CODE}, + {"long", "lR0", PRIM_CODE}, + {"long", "lR1", REF_CODE}, + {"long", "lR2", REF_CODE}, + {"long", "lT0", PRIM_CODE}, + {"long", "lT1", REF_CODE}, + {"long", "lT2", REF_CODE}, + {"long", "lV0", PRIM_CODE}, + {"long", "lV1", REF_CODE}, + {"long", "lV2", REF_CODE}, + {"long", "lF0", PRIM_CODE}, + {"long", "lF1", REF_CODE}, + {"long", "lF2", REF_CODE}, + + {"Class", "X0", REF_CODE}, + {"Class", "X1", REF_CODE}, + {"Class", "X2", REF_CODE}, + {"Boolean", "Z0", REF_CODE}, + {"Boolean", "Z1", REF_CODE}, + {"Boolean", "Z2", REF_CODE}, + {"Byte", "B0", REF_CODE}, + {"Byte", "B1", REF_CODE}, + {"Byte", "B2", REF_CODE}, + {"Char", "C0", REF_CODE}, + {"Char", "C1", REF_CODE}, + {"Char", "C2", REF_CODE}, + {"Double", "D0", REF_CODE}, + {"Double", "D1", REF_CODE}, + {"Double", "D2", REF_CODE}, + {"Float", "F0", REF_CODE}, + {"Float", "F1", REF_CODE}, + {"Float", "F2", REF_CODE}, + {"Int", "I0", REF_CODE}, + {"Int", "I1", REF_CODE}, + {"Int", "I2", REF_CODE}, + {"Long", "L0", REF_CODE}, + {"Long", "L1", REF_CODE}, + {"Long", "L2", REF_CODE}, + {"String", "S0", REF_CODE}, + {"String", "S1", REF_CODE}, + {"String", "S2", REF_CODE}, + {"Object", "O0", REF_CODE}, + {"Object", "O1", REF_CODE}, + {"Object", "O2", REF_CODE}, + + {"Long", "LS0", REF_CODE}, + {"Long", "LS1", REF_CODE}, + {"Long", "LS2", REF_CODE}, + {"Long", "LP0", REF_CODE}, + {"Long", "LP1", REF_CODE}, + {"Long", "LP2", REF_CODE}, + {"Long", "LU0", REF_CODE}, + {"Long", "LU1", REF_CODE}, + {"Long", "LU2", REF_CODE}, + {"Long", "LR0", REF_CODE}, + {"Long", "LR1", REF_CODE}, + {"Long", "LR2", REF_CODE}, + {"Long", "LT0", REF_CODE}, + {"Long", "LT1", REF_CODE}, + {"Long", "LT2", REF_CODE}, + {"Long", "LV0", REF_CODE}, + {"Long", "LV1", REF_CODE}, + {"Long", "LV2", REF_CODE}, + {"Long", "LF0", REF_CODE}, + {"Long", "LF1", REF_CODE}, + {"Long", "LF2", REF_CODE}, + + {"Inter", "E0", REF_CODE}, + {"Inter", "E1", REF_CODE}, + {"Inter", "E2", REF_CODE}, + {"Inter", "ES0", REF_CODE}, + {"Inter", "ES1", REF_CODE}, + {"Inter", "ES2", REF_CODE}, + {"Inter", "EP0", REF_CODE}, + {"Inter", "EP1", REF_CODE}, + {"Inter", "EP2", REF_CODE}, + {"Inter", "EU0", REF_CODE}, + {"Inter", "EU1", REF_CODE}, + {"Inter", "EU2", REF_CODE}, + {"Inter", "ER0", REF_CODE}, + {"Inter", "ER1", REF_CODE}, + {"Inter", "ER2", REF_CODE}, + {"Inter", "ET0", REF_CODE}, + {"Inter", "ET1", REF_CODE}, + {"Inter", "ET2", REF_CODE}, + {"Inter", "EV0", REF_CODE}, + {"Inter", "EV1", REF_CODE}, + {"Inter", "EV2", REF_CODE}, + {"Inter", "EF0", REF_CODE}, + {"Inter", "EF1", REF_CODE}, + {"Inter", "EF2", REF_CODE} + }; + private static Log log; + private final static String prefix = "nsk.jdi.Field.typeName."; + private final static String className = "typename001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List fields; + + // 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."); + } + + // Get all fields from debugee + ReferenceType refType = debugee.classByName(debugeeName); + if (refType == null) { + log.complain("debuger FAILURE> Class " + debugeeName + + " not found."); + return 2; + } + try { + fields = refType.allFields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields + ", should be " + TOTAL_FIELDS); + return 2; + } + log.display("debuger> Total fields found: " + totalFields); + Iterator fieldsIterator = fields.iterator(); + for (int i = 0; fieldsIterator.hasNext(); i++) { + Field field = (Field)fieldsIterator.next(); + String typeName = field.typeName(); + String name = field.name(); + String nameStat; + + if (typeName == null) { + log.complain("debuger FAILURE 1> typeName is null for " + + i + " field " + name); + testFailed = true; + continue; + } + if (name == null) { + log.complain("debuger FAILURE 2> Name is null for " + i + + " field"); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field (" + name + ") of " + "type " + + typeName + " read."); + try { + nameStat = getStatByName(name, 2); + } catch (Error e) { + log.complain("debuger FAILURE 3> Unexpected Error " + e); + return 2; + } + if (nameStat.equals(REF_CODE)) { + // ReferenceType - name of the type should exist in + // field.typeName() string + String realTypeName; + try { + realTypeName = getStatByName(name, 0); + } catch (Error e) { + log.complain("debuger FAILURE 4> Unexpected Error " + e); + return 2; + } + log.display("debuger> ReferenceType = " + name + "; " + + "typeName = " + typeName + "; " + + "realTypeName = " + realTypeName); + if (typeName.indexOf(realTypeName) == -1) { + log.complain("debuger FAILURE> Type of field " + name + + " is " + typeName + ", but " + "should be " + + realTypeName); + testFailed = true; + } + } else { + // PrimitiveType - name of the type should not be empty + if (typeName.length() == 0) { + log.complain("debuger FAILURE> Empty typeName for " + i + + " field " + name); + testFailed = true; + } + } + } + + 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; + } + } + } + + private static String getStatByName(String name, int field) + throws Error + { + for (int i = 0; i < TOTAL_FIELDS; i++) { + String fieldName = FIELDS_TYPE_NAME[i][1]; + if (fieldName.equals(name)) { + return FIELDS_TYPE_NAME[i][field]; + } + } + throw new Error("Error in test. Unknown field " + name); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001/TestDescription.java new file mode 100644 index 00000000000..74433feee60 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/Field/typeName/typename001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the typeName() method of Field interface of + * com.sun.jdi package. + * nsk/jdi/Field/typename001 checks assertions: + * public java.lang.String typeName() + * 1. Returns: a string + * 2. Returns: a string containing the type name. + * For PrimitiveTypes typeName() should not be null or empty. + * For ReferenceTypes typeName() should not be null and contain name + * of the type. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Field.typeName.typename001 + * nsk.jdi.Field.typeName.typename001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.typeName.typename001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001a.java new file mode 100644 index 00000000000..3b29fc68206 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename001a.java @@ -0,0 +1,97 @@ +/* + * 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.Field.typeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class typename001a { + 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}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + final long lF0 = 999, lF1[]={lF0}, lF2[][]={lF1}; + + class Class {} + Class X0 = new Class(), X1[]={X0}, X2[][]={X1}; + Boolean Z0, Z1[]={Z0}, Z2[][]={Z1}; + Byte B0, B1[]={B0}, B2[][]={B1}; + Character C0, C1[]={C0}, C2[][]={C1}; + Double D0, D1[]={D0}, D2[][]={D1}; + Float F0, F1[]={F0}, F2[][]={F1}; + Integer I0, I1[]={I0}, I2[][]={I1}; + Long L0, L1[]={L0}, L2[][]={L1}; + String S0, S1[]={S0}, S2[][]={S1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + final Long LF0 = new Long(999), LF1[]={LF0}, LF2[][]={LF1}; + + interface Inter {} + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + 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); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002.java new file mode 100644 index 00000000000..8f3d13b4241 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002.java @@ -0,0 +1,136 @@ +/* + * 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.Field.typeName; + +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 typename002 { + + //------------------------------------------------------- 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.Field.typeName."; + private final static String className = "typename002"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String[] expectedFieldNames = {"f1", "f2"}; + private final static String[] expectedTypeNames = { "nsk.jdi.Field.typeName.typename002Enum1", + "nsk.jdi.Field.typeName.typename002Enum2" }; + + //------------------------------------------------------- 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 < expectedFieldNames.length; i++) { + check(expectedFieldNames[i], expectedTypeNames[i]); + display(""); + } + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static void check (String fieldName, String typeName) { + try { + Field foundField = debuggeeClass.fieldByName(fieldName); + if (foundField != null) { + if (foundField.typeName().equals(typeName)) { + display("Field " + fieldName + " is of expected type " + typeName); + } else { + complain("Field " + fieldName + " is of unexpected type " + foundField.typeName()); + exitStatus = Consts.TEST_FAILED; + } + } else { + complain(" Cannot find field " + fieldName); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected exception while checking of field " + fieldName + ": " + e); + e.printStackTrace(System.out); + exitStatus = Consts.TEST_FAILED; + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002/TestDescription.java new file mode 100644 index 00000000000..c2dd8a5b17b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/Field/typeName/typename002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for typeName() method of Field interface. + * The test checks if the method returns correct type name of enum + * constants declared in mirrored enum type. + * The test consists of a debugger program (typename002.java) + * and debuggee application (typename002a.java). + * Package name is nsk.jdi.Field.typeName . + * 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 typeName() method for each constant field + * in mirrored enum types. The returned name must equal to name of + * declaring enum type. + * 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.Field.typeName.typename002 + * nsk.jdi.Field.typeName.typename002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Field.typeName.typename002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002a.java new file mode 100644 index 00000000000..f7cdeb9e6b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/typeName/typename002a.java @@ -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.Field.typeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class typename002a { + + //------------------------------------------------------- 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 typename002Enum1 f1; + static typename002Enum2 f2; + + //------------------------------------------------------ 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(typename002.SIGNAL_READY); + receiveSignal(typename002.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum typename002Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum typename002Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001.java new file mode 100644 index 00000000000..61a10039052 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001.java @@ -0,0 +1,456 @@ +/* + * 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.FloatType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * FloatType.
    + *
    + * The test checks that for a mirror of a float value the casts
    + * from Type to FloatType and from PrimitiveType to FloatType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a float field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class floattype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/FloatType/_itself_/floattype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new floattype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.FloatType._itself_.floattype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'fl';"); + String name = "fl"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + FloatType floatType = null; + try { + log2(" checking up on cast: FloatType floatType = (FloatType) type;"); + floatType = (FloatType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: FloatType floatType = (FloatType) primitiveType;"); + floatType = (FloatType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001/TestDescription.java new file mode 100644 index 00000000000..fe39c5c4555 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001/TestDescription.java @@ -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/FloatType/_itself_/floattype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * FloatType. + * The test checks that for a mirror of float value, the casts + * from Type to FloatType and from PrimitiveType to FloatType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.FloatType._itself_.floattype001; + * the debuggee program - nsk.jdi.FloatType._itself_.floattype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.FloatType._itself_.floattype001 + * nsk.jdi.FloatType._itself_.floattype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.FloatType._itself_.floattype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001a.java new file mode 100644 index 00000000000..9c6b7c6d5b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatType/_itself_/floattype001a.java @@ -0,0 +1,113 @@ +/* + * 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.FloatType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the floattype001 JDI test. + */ + +public class floattype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static float fl = 0.0f; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001.java new file mode 100644 index 00000000000..7294d37450d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.FloatValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.FloatValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + FloatValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof FloatValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (FloatValue )v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for FloatValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(FloatValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof FloatValue) { + FloatValue floatObject = (FloatValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(floatObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(floatObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is FloatValue: " + value + " and 'y' is FloatValue : " + floatObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(floatObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(floatObject) == 0) && (floatObject.compareTo(value) != 0)) || + ((value.compareTo(floatObject) != 0) && (floatObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is FloatValue: " + value + " and 'y' is FloatValue : " + floatObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(floatObject) + "\n\t" + + "result of (y.compareTo(x)): " + floatObject.compareTo(value) ); + result = false; + } + if (value.compareTo(floatObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(floatObject) != -(floatObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is FloatValue: " + value + " and 'y' is FloatValue : " + floatObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(floatObject) + "\n\t" + + "result of (y.compareTo(x)): " + floatObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(floatObject) > 0) { + FloatValue lessValue = FindLessFloatValue(floatObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is FloatValue: " + value + " , 'y' is FloatValue : " + floatObject + " , 'z' is FloatValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(floatObject) + "\n\t" + + "result of (y.compareTo(z)): " + floatObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "FloatValue: " + value + " and FloatValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "FloatValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "FloatValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((FloatValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "FloatValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "FloatValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another FloatValue field which is less then method's argument via + * compareTo method. + */ + + private static FloatValue FindLessFloatValue (FloatValue currentValue) { + FloatValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + FloatValue newValue = (FloatValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..68975481c20 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001/TestDescription.java @@ -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/FloatValue/compareTo/compareto001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.FloatValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of FloatValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote FloatValue object. + * The debugger program - nsk.jdi.FloatValue.compareto.compareto001; + * the debuggee program - nsk.jdi.FloatValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of float fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of FloatValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.FloatValue.compareTo.compareto001 + * nsk.jdi.FloatValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.FloatValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..113eca3fbf3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001a.java @@ -0,0 +1,175 @@ +/* + * 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.FloatValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public float floatMAX = Float.MAX_VALUE; + public float float1 = 1; + public float float0 = 0; + public float float_1 = -1; + public float floatMIN = Float.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001.java new file mode 100644 index 00000000000..6ed5a5a7569 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001.java @@ -0,0 +1,246 @@ +/* + * 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.FloatValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * FloatValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.FloatValue.equals()
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static float plus1_1 = +1f;
    + * public static float plus1_2 = +1f;
    + * public static float minus1 = -1f;
    + * public static double double_plus1 = +1d;
    + *
    + * which a debugger mirros as :
    + *
    + * FloatValue fvplus1_1;
    + * FloatValue fvplus1_2;
    + * FloatValue fvminus1;
    + * DoubleValue dvplus1;
    + *
    + * the following is true:
    + *
    + * fvplus1_1 == fvplus1_2
    + * fvplus1_1 != fvminus1
    + * fvplus1_1 != dvplus1
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/FloatValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.FloatValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field ffplus1_1 = execClass.fieldByName("plus1_1"); + Field ffplus1_2 = execClass.fieldByName("plus1_2"); + Field ffminus1 = execClass.fieldByName("minus1"); + Field fdplus1 = execClass.fieldByName("double_plus1"); + + FloatValue fvplus1_1 = (FloatValue) execClass.getValue(ffplus1_1); + FloatValue fvplus1_2 = (FloatValue) execClass.getValue(ffplus1_2); + FloatValue fvminus1 = (FloatValue) execClass.getValue(ffminus1); + DoubleValue dvplus1 = (DoubleValue) execClass.getValue(fdplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!fvplus1_1.equals(fvplus1_2)) + expresult = 1; + break; + + case 1: if (fvplus1_1.equals(fvminus1)) + expresult = 1; + break; + + case 2: if (fvplus1_1.equals(dvplus1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..e89f3e4eddd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001/TestDescription.java @@ -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/FloatValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * FloatValue. + * The test checks up that a result of the method + * com.sun.jdi.FloatValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this FloatValue for equality. + * Returns: true if the Object is a FloatValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.FloatValue.equals.equals001; + * a debuggee program - nsk.jdi.FloatValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.FloatValue.equals.equals001 + * nsk.jdi.FloatValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.FloatValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001a.java new file mode 100644 index 00000000000..836c459e50a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals001a.java @@ -0,0 +1,133 @@ +/* + * 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.FloatValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static float pos_inf = Float.POSITIVE_INFINITY; +// public static float pos_zero = 0.0f; +// public static float neg_zero = -0.0f; +// public static float neg_inf = Float.NEGATIVE_INFINITY; + +// public static float pos_largest = Float.MAX_VALUE; +// public static float pos_smallest = Float.MIN_VALUE; +// public static float neg_largest = -Float.MAX_VALUE; +// public static float neg_smallest = -Float.MIN_VALUE; + +// public static float flo_nan = Float.NaN; + + public static float plus1_1 = +1.0f; + public static float plus1_2 = +1.0f; + public static float minus1 = -1.0f; + + public static double double_plus1 = +1.0d; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.FloatValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + FloatValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof FloatValue) ) { + msg += " is not FloatValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (FloatValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(FloatValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof FloatValue ) { + if ( value.value() == ((PrimitiveValue )object).floatValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof FloatValue ) { + if ( value.value() != ((PrimitiveValue )object).floatValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..d70a83a82ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals002/TestDescription.java @@ -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/FloatValue/equals/equals002. + * 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.FloatValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this FloatValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a FloatValue and if applying "==" to the two + * mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.FloatValue.equals.equals002 + * nsk.jdi.FloatValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.FloatValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals002a.java new file mode 100644 index 00000000000..7b1de2a72da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/equals/equals002a.java @@ -0,0 +1,142 @@ +/* + * 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.FloatValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public float floatMAX = Float.MAX_VALUE; + public float float1 = 1; + public float float0 = 0; + public float float_1 = -1; + public float floatMIN = Float.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..846e7168174 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001.java @@ -0,0 +1,239 @@ +/* + * 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.FloatValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * FloatValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.FloatValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static float plus1_1 = +1f;
    + * public static float plus1_2 = +1f;
    + * public static float pos_largest = Float.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * FloatValue fvplus1_1;
    + * FloatValue fvplus1_2;
    + * FloatValue fvpos_largest;
    + *
    + * the following is true:
    + *
    + * fvpos_largest.hashCode() == fvpos_largest.hashCode()
    + * fvplus1_1.hashCode() == fvplus1_2.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/FloatValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.FloatValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field ffplus1_1 = execClass.fieldByName("plus1_1"); + Field ffplus1_2 = execClass.fieldByName("plus1_2"); + Field ffpos_largest = execClass.fieldByName("pos_largest"); + + FloatValue fvplus1_1 = (FloatValue) execClass.getValue(ffplus1_1); + FloatValue fvplus1_2 = (FloatValue) execClass.getValue(ffplus1_2); + FloatValue fvpos_largest = + (FloatValue) execClass.getValue(ffpos_largest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (fvpos_largest.hashCode() != fvpos_largest.hashCode()) + expresult = 1; + break; + + case 1: if (fvplus1_1.hashCode() != fvplus1_2.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..cf130bd54af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001/TestDescription.java @@ -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/FloatValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * FloatValue. + * The test checks up that a result of the method + * com.sun.jdi.FloatValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this FloatValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.FloatValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.FloatValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.FloatValue.hashCode.hashcode001 + * nsk.jdi.FloatValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.FloatValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..5ca688013b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/hashCode/hashcode001a.java @@ -0,0 +1,133 @@ +/* + * 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.FloatValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static float pos_inf = Float.POSITIVE_INFINITY; +// public static float pos_zero = 0.0f; +// public static float neg_zero = -0.0f; +// public static float neg_inf = Float.NEGATIVE_INFINITY; + + public static float pos_largest = Float.MAX_VALUE; +// public static float pos_smallest = Float.MIN_VALUE; +// public static float neg_largest = -Float.MAX_VALUE; +// public static float neg_smallest = -Float.MIN_VALUE; + +// public static float flo_nan = Float.NaN; + + public static float plus1_1 = +1.0f; + public static float plus1_2 = +1.0f; +// public static float minus1 = -1.0f; + +// public static double double_plus1 = +1.0d; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * FloatValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.FloatValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static float pos_inf = Float.POSITIVE_INFINITY;
    + * public static float pos_zero = 0.0d;
    + * public static float neg_zero = -0.0d;
    + * public static float neg_inf = Float.NEGATIVE_INFINITY;
    + * public static float pos_largest = Float.MAX_VALUE;
    + * public static float pos_smallest = Float.MIN_VALUE;
    + * public static float neg_largest = -Float.MAX_VALUE;
    + * public static float neg_smallest = -Float.MIN_VALUE;
    + * public static float float_nan = Float.NaN;
    + *
    + * which a debugger mirros as :
    + *
    + * FloatValue fvpos_inf;
    + * FloatValue fvpos_zero;
    + * FloatValue fvneg_zero;
    + * FloatValue fvneg_inf;
    + * FloatValue fvpos_largest;
    + * FloatValue fvpos_smallest;
    + * FloatValue fvneg_largest;
    + * FloatValue fvneg_smallest;
    + * FloatValue fvdouble_nan;
    + *
    + * the following is true:
    + *
    + * fvneg_inf.value() == Floate.NEGATIVE_INFINITY
    + * fvneg_largest.value() == -Float.MAX_VALUE
    + * fvneg_smallest.value() == -Double.MIN_VALUE
    + * fvneg_zero.value() == -0.0d
    + * fvpos_zero.value() == 0.0d
    + * fvpos_smallest.value() == Float.MIN_VALUE
    + * fvpos_largest.value() == Float.MAX_VALUE
    + * fvpos_inf.value() == Float.POSITIVE_INFINITY
    + * fvfloat_nan.value() != fvfloat_nan.value()
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/FloatValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.FloatValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field ffneg_inf = execClass.fieldByName("neg_inf"); + Field ffneg_largest = execClass.fieldByName("neg_largest"); + Field ffneg_smallest = execClass.fieldByName("neg_smallest"); + Field ffneg_zero = execClass.fieldByName("neg_zero"); + Field ffpos_zero = execClass.fieldByName("pos_zero"); + Field ffpos_smallest = execClass.fieldByName("pos_smallest"); + Field ffpos_largest = execClass.fieldByName("pos_largest"); + Field ffpos_inf = execClass.fieldByName("pos_inf"); + Field ffloat_nan = execClass.fieldByName("float_nan"); + + FloatValue fvneg_inf = (FloatValue) execClass.getValue(ffneg_inf); + FloatValue fvneg_largest = (FloatValue) execClass.getValue(ffneg_largest); + FloatValue fvneg_smallest = (FloatValue) execClass.getValue(ffneg_smallest); + FloatValue fvneg_zero = (FloatValue) execClass.getValue(ffneg_zero); + FloatValue fvpos_zero = (FloatValue) execClass.getValue(ffpos_zero); + FloatValue fvpos_smallest = (FloatValue) execClass.getValue(ffpos_smallest); + FloatValue fvpos_largest = (FloatValue) execClass.getValue(ffpos_largest); + FloatValue fvpos_inf = (FloatValue) execClass.getValue(ffpos_inf); + FloatValue fvfloat_nan = (FloatValue) execClass.getValue(ffloat_nan); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (fvneg_inf.value() != Float.NEGATIVE_INFINITY) + expresult = 1; + break; + + case 1: if (fvneg_largest.value() != -Float.MAX_VALUE) + expresult = 1; + break; + + case 2: if (fvneg_smallest.value() != -Float.MIN_VALUE) + expresult = 1; + break; + + case 3: if (fvneg_zero.value() != -0.0d) + expresult = 1; + break; + + case 4: if (fvpos_zero.value() != 0.0d) + expresult = 1; + break; + + case 5: if (fvpos_smallest.value() != Float.MIN_VALUE) + expresult = 1; + break; + + case 6: if (fvpos_largest.value() != Float.MAX_VALUE) + expresult = 1; + break; + + case 7: if (fvpos_inf.value() != Float.POSITIVE_INFINITY) + expresult = 1; + break; + + case 8: if ( !(fvfloat_nan.value() != fvfloat_nan.value()) ) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..6205b5e39da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/value/value001/TestDescription.java @@ -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/FloatValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * FloatValue. + * The test checks up that a result of the method + * com.sun.jdi.FloatValue.value() + * complies with its spec: + * public float value() + * Returns this FloatValue as a float. + * Returns: the float mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.FloatValue.value.value001; + * a debuggee program - nsk.jdi.FloatValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.FloatValue.value.value001 + * nsk.jdi.FloatValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.FloatValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/value/value001a.java new file mode 100644 index 00000000000..53b7b9f8ab1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/FloatValue/value/value001a.java @@ -0,0 +1,133 @@ +/* + * 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.FloatValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static float pos_inf = Float.POSITIVE_INFINITY; + public static float pos_zero = 0.0f; + public static float neg_zero = -0.0f; + public static float neg_inf = Float.NEGATIVE_INFINITY; + + public static float pos_largest = Float.MAX_VALUE; + public static float pos_smallest = Float.MIN_VALUE; + public static float neg_largest = -Float.MAX_VALUE; + public static float neg_smallest = -Float.MIN_VALUE; + + public static float float_nan = Float.NaN; + +// public static float plus1_1 = +1.0f; +// public static float plus1_2 = +1.0f; +// public static float minus1 = -1.0f; + +// public static double double_plus1 = +1.0d; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.IntegerArgument.intValue()
    + * complies with the following requirements in its specification:
    + * "Returns the value of the argument as a int."
    + * when the value of IntegerArgument is set
    + * with the method setValue(int value);
    + * The checking values are as follows:
    + * min()
    + * max()
    + * min()+1
    + * min()-1
    + * max()+1
    + *
    + * In case of a value set with setValue()
    + * doesn't match a value get with the following intValue(),
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +public class intvalue001 { + + 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.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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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; + int i; + + i = intArgument.min(); + intArgument.setValue(i); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(min()); intValue() == min()\n" + + "result: false\n"); + } + + i = intArgument.max(); + intArgument.setValue(i); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(max()); intValue() == max()\n" + + "result: false\n"); + } + + if (intArgument.min() < intArgument.max()) { + i = intArgument.min() + 1; + intArgument.setValue(i); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(min()+1); intValue() == min()+1\n" + + "result: false\n"); + } + } + + if (intArgument.min() > intI.MIN_VALUE) { + i = intArgument.min() - 1; + intArgument.setValue(i); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(min()-1); intValue() == min()-1\n" + + "result: false\n"); + } + } + + if (intArgument.max() < intI.MAX_VALUE) { + i = intArgument.max() + 1; + intArgument.setValue(i); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(max()+1); intValue() == max()+1\n" + + "result: false\n"); + } + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue001/TestDescription.java new file mode 100644 index 00000000000..7e53758b366 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/IntegerArgument/intValue/intvalue001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * IntegerArgument.intValue() + * complies with the following requirements: + * "Returns the value of the argument as a int." + * when the value of the argument is set + * with the method setValue(int value). + * The cases tested are as follows: + * min() + * max() + * min()+1 + * min()-1> + * max()+1 + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.IntegerArgument object is searched among + * Arguments of Connectors. + * If no the intArgument is found out the test exits + * with the return value = 95 and a warning message. + * - To the above values the following check is applied: + * int value set with intArgument.setValue() + * must be equal to int value get with intArguemnt.intValue() + * In case of inequality of the values + * 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.IntegerArgument.intValue.intvalue001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.intValue.intvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002.java new file mode 100644 index 00000000000..e78982a4463 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002.java @@ -0,0 +1,196 @@ +/* + * 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.IntegerArgument.intValue; + +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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.IntegerArgument.intValue()
    + * complies with the following requirements in its specification:
    + * "Sets the value of the argument."
    + * when the value of the IntegerArgument is set
    + * the super.method setValue(String value).
    + * The checking values are as follows:
    + * min()
    + * max()
    + * min()+1
    + * min()-1
    + * max()+1
    + *
    + * In case of int value i1 set with
    + * setValue(stringValueOf(i1));
    + * doesn't match int value i2 get with
    + * i2 = intValue();
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +public class intvalue002 { + + 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.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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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; + int i; + + i = intArgument.min(); + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(stringValueOf(min()); " + + "intValue() == min()\n" + + "result: false\n"); + } + + i = intArgument.max(); + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(stringValueOf(max)); " + + "intValue() == max()\n" + + "result: false\n"); + } + + if (intArgument.min() < intArgument.max()) { + i = intArgument.min() + 1; + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(stringValueOf(min()+1); " + + "intValue() == min()+1\n" + + "result: false\n"); + } + } + + if (intArgument.min() > intI.MIN_VALUE) { + i = intArgument.min() - 1; + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(stringValueOf(min()-1); " + + "intValue() == min()-1\n" + + "result: false\n"); + } + } + + if (intArgument.max() < intI.MAX_VALUE) { + i = intArgument.max() + 1; + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(stringValueOf(max()+1); " + + "intValue() == max()+1\n" + + "result: false\n"); + } + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002/TestDescription.java new file mode 100644 index 00000000000..f546414576b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002/TestDescription.java @@ -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/IntegerArgument/intValue/intvalue002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * IntegerArgument.intValue(int value) + * complies with the following requirements: + * "Returns the value of the argument as a int." + * when the value of the argument was set + * with the super.method setValue(String value). + * The cases tested are as follows: + * min() + * max() + * min()+1 + * min()-1> + * max()+1 + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.IntegerArgument object is searched among + * Arguments of Connectors. + * If no the intArgument is found out the test exits + * with the return value = 95 and a warning message. + * - To the above values the following check is applied: + * int value i1 set with the super.method + * intArgument.setValue(stringValueOf(i1)); + * must be equal to int value i2 get with + * i2 = intArgument.intValue(); + * In case of inequality of the values + * 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.IntegerArgument.intValue.intvalue002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.intValue.intvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001.java new file mode 100644 index 00000000000..dc108516356 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001.java @@ -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.IntegerArgument.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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * Connector.IntegerArgument.isValid(int value)
    + * complies with the following requirements:
    + * "true if min() <= value <= max()"
    + * when the value is one of the following:
    + * min()
    + * max()
    + * min()+1
    + * min()-1
    + * max()+1
    + *
    + * In case of a wrong result returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +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.IntegerArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.IntegerArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + 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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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 (intArgument.isValid(intArgument.min())) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(min())\n" + + "result: false\n"); + } + + if (intArgument.isValid(intArgument.max())) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(max())\n" + + "result: false\n"); + } + + if (intArgument.min() < intArgument.max()) { + if (intArgument.isValid(intArgument.min() + 1)) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(min()+1)\n" + + "result: false\n"); + } + } + + if (intArgument.min() > intI.MIN_VALUE) { + if (!intArgument.isValid(intArgument.min() - 1)) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(min()-1)\n" + + "result: true\n"); + } + } + + if (intArgument.max() < intI.MAX_VALUE) { + if (!intArgument.isValid(intArgument.max() + 1)) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(max()+1)\n" + + "result: true\n"); + } + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001/TestDescription.java new file mode 100644 index 00000000000..ef5b8a1de3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001/TestDescription.java @@ -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/IntegerArgument/isValid/isvalid001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * IntegerArgument.isValid(int value) + * complies with the following requirements: + * "true if min() <= value <= max()" + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First 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: + * intArgument.isValid(int.Argument.min()) + * expexted result - true + * if (intArgument.min() < intArgument.max()) + * intArgument.isValid(int.Argument.min() + 1) + * expected result - true + * intArgument.isValid(int.Argument.max()) + * expexted result - true + * if (intArgument.min() > INTEGER.MIN_VALUE) + * intArgument.isValid(int.Argument.min() - 1) + * expected result - false + * if (intArgument.max() < INTEGER.MAX_VALUE) + * intArgument.isValid(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.IntegerArgument.isValid.isvalid001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.isValid.isvalid001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002.java new file mode 100644 index 00000000000..7c9669a1da8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002.java @@ -0,0 +1,184 @@ +/* + * 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.IntegerArgument.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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * Connector.IntegerArgument.isValid(String value)
    + * complies with the following requirements:
    + * "true if value represents an int that is
    + * min() <= value <= max()"
    + * when the value is one of the following:
    + * stringValueOf(min())
    + * stringValueOf(max())
    + * stringValueOf(min()+1)
    + * stringValueOf(min()-1)
    + * stringValueOf(max()+1)
    + *
    + * In case of a wrong result returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +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.IntegerArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.IntegerArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + 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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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 (intArgument.isValid(intArgument.stringValueOf(intArgument.min()))) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(stringValueOf(min()))\n" + + "result: false\n"); + } + + if (intArgument.isValid(intArgument.stringValueOf(intArgument.max()))) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(stringValueOf(max()))\n" + + "result: false\n"); + } + + if (intArgument.min() < intArgument.max()) { + if (intArgument.isValid( + intArgument.stringValueOf(intArgument.min() + 1))) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(stringValueOf(min()+1))\n" + + "result: false\n"); + } + } + + if (intArgument.min() > intI.MIN_VALUE) { + if (!intArgument.isValid( + intArgument.stringValueOf(intArgument.min() - 1))) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(stringValueOf(min()-1))\n" + + "result: true\n"); + } + } + + if (intArgument.max() < intI.MAX_VALUE) { + if (!intArgument.isValid( + intArgument.stringValueOf(intArgument.max() + 1))) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(stringValueOf(max()+1))\n" + + "result: true\n"); + } + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002/TestDescription.java new file mode 100644 index 00000000000..13331fa82d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/IntegerArgument/isValid/isvalid002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * IntegerArgument.isValid(String value) + * complies with the following requirements: + * "true if value represents an int that is + * min() <= value <= max()" + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First 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: + * intArgument.isValid( + * intArgurmnt.stringValueOf( + * int.Argument.min())) + * expexted result - true + * if (intArgument.min() < intArgument.max()) + * intArgument.isValid( + * intArgurmnt.stringValueOf( + * int.Argument.min() + 1)) + * expected result - true + * intArgument.isValid( + * intArgurmnt.stringValueOf( + * int.Argument.max()) + * expexted result - true + * if (intArgument.min() > INTEGER.MIN_VALUE) + * intArgument.isValid( + * intArgurmnt.stringValueOf( + * int.Argument.min() - 1) + * expected result - false + * if (intArgument.max() < INTEGER.MAX_VALUE) + * intArgument.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.IntegerArgument.isValid.isvalid002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.isValid.isvalid002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003.java new file mode 100644 index 00000000000..75600cdc3b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003.java @@ -0,0 +1,166 @@ +/* + * 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.IntegerArgument.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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * Connector.IntegerArgument.isValid(String value)
    + * complies with the following requirements:
    + * "true if value represents an int that is
    + * min() <= value <= max()"
    + * when the value is one of the following strings:
    + * "a"
    + * ""
    + * (String) null
    + * a null-string
    + * to which expected results are false.
    + *
    + * In case of a wrong result returned,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +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.IntegerArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.IntegerArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + 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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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 (!intArgument.isValid("")) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid('')\n" + + "result: true\n"); + } + + if (!intArgument.isValid("a")) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid('a')\n" + + "result: true\n"); + } + + if (!intArgument.isValid((String) null)) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid((String) null))\n" + + "result: true\n"); + } + + String s = null; + if (!intArgument.isValid(s)) { + } else { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(String s = null)\n" + + "result: true\n"); + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003/TestDescription.java new file mode 100644 index 00000000000..2e1a1fdd946 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003/TestDescription.java @@ -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/IntegerArgument/isValid/isvalid003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * IntegerArgument.isValid(String value) + * complies with the following requirements: + * "true if value represents an int that is + * min() <= value <= max()" + * in case when parameter is one of "", "a", null, null-string. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First 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: + * !intArgument.isValid("") + * expected result - true + * !intArgument.isValid("a") + * 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.IntegerArgument.isValid.isvalid003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.isValid.isvalid003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/max/max001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/max/max001.java new file mode 100644 index 00000000000..27efbe9e777 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/max/max001.java @@ -0,0 +1,147 @@ +/* + * 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.IntegerArgument.max; + +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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.IntegerArgument.max()
    + * complies with the following requirements:
    + * -2147483648 <= max() <= 2147483647
    + * min() <= max()
    + *
    + * In case of wrong values,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class max001 { + + 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.IntegerArgument.max\n" ; + + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.IntegerArgument 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.IntegerArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with IntegerArgument found\n"); + return exitCode0; + } + } + + int iMax = argument.max(); + + if (iMax < -2147483648) { + exitCode = exitCode2; + out.println(sErr2 + + "check: argument.max() >= -2147483648\n"); + } + + if (iMax > 2147483647) { + exitCode = exitCode2; + out.println(sErr2 + + "check: argument.max <= 2147483647\n"); + } + + if (iMax < argument.min()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: argument.max >= argument.min\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/max/max001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/max/max001/TestDescription.java new file mode 100644 index 00000000000..d500425da46 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/max/max001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/IntegerArgument/max/max001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.IntegerArgument.max() + * complies with the following requirements: + * -2147483648 <= max() <= 2147483647 + * min() <= max() + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.IntegerArgument object is searched among + * Arguments of 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 -2147483648 > argument.max() + * THEN an error detected + * ELSE the check passed + * IF argument.max() > 2147483647 + * THEN an error detected + * ELSE the check passed + * IF argument.max() < argument.min() + * 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.IntegerArgument.max.max001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.max.max001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/min/min001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/min/min001.java new file mode 100644 index 00000000000..aff2f5a73bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/min/min001.java @@ -0,0 +1,139 @@ +/* + * 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.IntegerArgument.min; + +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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.IntegerArgument.min()
    + * complies with the following requirement:
    + * -2147483648 <= min() <= 2147483647
    + *
    + * In case of wrong values,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class min001 { + + 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.min\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.IntegerArgument.min\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.IntegerArgument 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.IntegerArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with IntegerArgument found\n"); + return exitCode0; + } + } + + int iMin = argument.min(); + + if (iMin < -2147483648) { + exitCode = exitCode2; + out.println(sErr2 + + "check: iMin < -2147483648\n"); + } + + if (iMin > 2147483647) { + exitCode = exitCode2; + out.println(sErr2 + + "check: iMin > 2147483647\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/min/min001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/min/min001/TestDescription.java new file mode 100644 index 00000000000..3fc5ffafb1d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/min/min001/TestDescription.java @@ -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/IntegerArgument/min/min001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.IntegerArgument.min() + * complies with the following requirement: + * -2147483648 <= min() <= 2147483647 + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.IntegerArgument object is searched among + * 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 -2147483648 > argument.min() + * THEN an error detected + * ELSE the check passed + * IF argument.min() > 2147483647 + * 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.IntegerArgument.min.min001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.min.min001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001.java new file mode 100644 index 00000000000..39a00aab3bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001.java @@ -0,0 +1,193 @@ +/* + * 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.IntegerArgument.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.IntegerArgument; + + +/** + * The test for the implementation of an object of the type
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.IntegerArgument.setValue()
    + * complies with the following requirements in its specification:
    + * "Sets the value of the argument."
    + *
    + * If after two following one by one methods, in all four possible cases,
    + * setValue(int) and super.setValue(String)
    + * with different values to set, the value returned by intValue()
    + * isn't equal to the second value set
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +public class setvalue001 { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + 95); // JCK-compatible exit status + } + + static int exitCode = 0; + static int exitCode0 = 0; + static int exitCode2 = 2; + +// + static Connector.IntegerArgument intArgument = null; + static int i; + + private static void check(int i1, PrintStream out) { + +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.IntegerArgument.setValue()\n" ; + + + intArgument.setValue(i); + intArgument.setValue(i1); + if (intArgument.intValue() != i1) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(int); setValue(int)\n" + + "result: no equality\n"); + } + + intArgument.setValue(i); + intArgument.setValue(intArgument.stringValueOf(i1)); + if (intArgument.intValue() != i1) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(int); setValue(String)\n" + + "result: no equality\n"); + } + + intArgument.setValue(intArgument.stringValueOf(i)); + intArgument.setValue(i1); + if (intArgument.intValue() != i1) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(String); setValue(int)\n" + + "result: no equality\n"); + } + + intArgument.setValue(intArgument.stringValueOf(i)); + intArgument.setValue(intArgument.stringValueOf(i1)); + if (intArgument.intValue() != i1) { + exitCode = exitCode2; + out.println(sErr2 + + "check: setValue(String); setValue(String)\n" + + "result: no equality\n"); + } + } + + public static int run(String argv[], PrintStream out) { + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + String sErr1 = "WARNING\n" + + "Method tested: " + + "jdi.Connector.IntegerArgument.setValue\n" ; + + Integer intI = 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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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 (intArgument.min() >= 0) { + i = -1; + } else { + i = 1; + } + + check(intArgument.min(), out); + check(intArgument.max(), out); + if (intArgument.min() < intArgument.max()) { + check(intArgument.min() + 1, out); + } + if (intArgument.min() > intI.MIN_VALUE) { + check(intArgument.min() - 1, out); + } + if (intArgument.max() < intI.MAX_VALUE) { + check(intArgument.max() + 1, out); + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001/TestDescription.java new file mode 100644 index 00000000000..8b838932362 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/IntegerArgument/setValue/setvalue001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the methods + * IntegerArgument.setValue(int value) and + * Argument.setValue(String value) + * complies with the following requirements: + * "Sets the value of the argument." + * when Argument is IntegerArgument. + * The testing values are as follows: + * min() + * max() + * min()+1 + * min()-1> + * max()+1 + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.IntegerArgument object is searched among + * Arguments of Connectors. + * If no the intArgument is found out the test exits + * with the return value = 95 and a warning message. + * - To the above values the following check is applied: + * intArgument.setValue(int i); + * intArgument.setValue(int i1); + * intArgument.setValue(int i); + * intArgument.setValue(intArgument.stringValueOf(i1)); + * intArgument.setValue(intArgument.stringValueOf(i)); + * intArgument.setValue(int i1); + * intArgument.setValue(intArgument.stringValueOf(i)); + * intArgument.setValue(intArgument.stringValueOf(i1)); + * In all checks the value returned by followed intArgument.intValue() + * must be equal to int i1. + * In case of inequality of the values + * 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.IntegerArgument.setValue.setvalue001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.setValue.setvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001.java new file mode 100644 index 00000000000..34ba655155d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001.java @@ -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.IntegerArgument.stringValueOf; + +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
    + * Connector_IntegerArgument.
    + *
    + * The test checks up that results of the method
    + * Connector.IntegerArgument.stringValueOf()
    + * complies with the following requirements in its specification:
    + * "Returns the String representation of the value parameter."
    + * The checking values are as follows:
    + * min()
    + * max()
    + * min()+1
    + * min()-1
    + * max()+1
    + *
    + * In case of a value set with setValue(stringValueOf(value))
    + * is not equal to a value returned by the following intValue(),
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + +// +public class stringvalueof001 { + + 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.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 { +// + intArgument = (Connector.IntegerArgument) + defaultArguments.get(argName); + break ; + } 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; + int i; + + i = intArgument.min(); + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: stringValueOf(min())\n" + + "result: inequality\n"); + } + + i = intArgument.max(); + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: stringValueOf(max())\n" + + "result: inequality\n"); + } + + if (intArgument.min() < intArgument.max()) { + i = intArgument.min() + 1; + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: stringValueOf(min()+1)\n" + + "result: inequality\n"); + } + } + + if (intArgument.min() > intI.MIN_VALUE) { + i = intArgument.min() - 1; + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: stringValueOf(min()-1)\n" + + "result: inequality\n"); + } + } + + if (intArgument.max() < intI.MAX_VALUE) { + i = intArgument.max() + 1; + intArgument.setValue(intArgument.stringValueOf(i)); + if (intArgument.intValue() != i) { + exitCode = exitCode2; + out.println(sErr2 + + "check: stringValueOf(max()+1)\n" + + "result: inequality\n"); + } + } + + if (exitCode != exitCode0) { + out.println("TEST FAILED"); + } + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001/TestDescription.java new file mode 100644 index 00000000000..e6c9fb4a3b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/IntegerArgument/stringValueOf/stringvalueof001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.IntegerArgument. + * The test checks up that a result of the method + * IntegerArgument.stringValueOf() + * complies with the following requirements: + * "Returns the String representation of the value parameter." + * The cases tested are as follows: + * min() + * max() + * min()+1 + * min()-1> + * max()+1 + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.IntegerArgument object is searched among + * Arguments of Connectors. + * If no the intArgument is found out the test exits + * with the return value = 95 and a warning message. + * - To the above values the following check is applied: + * int value i used as parameter in + * intArgument.setValue(intArgument.stringValueOf(i)) + * must be equal to int value returned by intArgument.intValue() + * In case of inequality of the values + * 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.IntegerArgument.stringValueOf.stringvalueof001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerArgument.stringValueOf.stringvalueof001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001.java new file mode 100644 index 00000000000..2b7d8255ab0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001.java @@ -0,0 +1,456 @@ +/* + * 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.IntegerType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * IntegerType.
    + *
    + * The test checks that for a mirror of an integer value the casts
    + * from Type to IntegerType and from PrimitiveType to IntegerType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares an integer field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class integertype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/IntegerType/_itself_/integertype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new integertype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.IntegerType._itself_.integertype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'in';"); + String name = "in"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + IntegerType integerType = null; + try { + log2(" checking up on cast: IntegerType integerType = (IntegerType) type;"); + integerType = (IntegerType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: IntegerType integerType = (IntegerType) primitiveType;"); + integerType = (IntegerType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001/TestDescription.java new file mode 100644 index 00000000000..33d94667c8b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001/TestDescription.java @@ -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/IntegerType/_itself_/integertype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * IntegerType. + * The test checks that for a mirror of an integer value the casts + * from Type to IntegerType and from PrimitiveType to IntegerType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.IntegerType._itself_.integertype001; + * the debuggee program - nsk.jdi.IntegerType._itself_.integertype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.IntegerType._itself_.integertype001 + * nsk.jdi.IntegerType._itself_.integertype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerType._itself_.integertype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001a.java new file mode 100644 index 00000000000..8208ff837c8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerType/_itself_/integertype001a.java @@ -0,0 +1,113 @@ +/* + * 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.IntegerType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the integertype001 JDI test. + */ + +public class integertype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static int in = 0; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001.java new file mode 100644 index 00000000000..ae2411b1853 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.IntegerValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.IntegerValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + IntegerValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof IntegerValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (IntegerValue )v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for IntegerValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(IntegerValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof IntegerValue) { + IntegerValue intObject = (IntegerValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(intObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(intObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is IntegerValue: " + value + " and 'y' is IntegerValue : " + intObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(intObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(intObject) == 0) && (intObject.compareTo(value) != 0)) || + ((value.compareTo(intObject) != 0) && (intObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is IntegerValue: " + value + " and 'y' is IntegerValue : " + intObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(intObject) + "\n\t" + + "result of (y.compareTo(x)): " + intObject.compareTo(value) ); + result = false; + } + if (value.compareTo(intObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(intObject) != -(intObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is IntegerValue: " + value + " and 'y' is IntegerValue : " + intObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(intObject) + "\n\t" + + "result of (y.compareTo(x)): " + intObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(intObject) > 0) { + IntegerValue lessValue = FindLessIntegerValue(intObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is IntegerValue: " + value + " , 'y' is IntegerValue : " + intObject + " , 'z' is IntegerValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(intObject) + "\n\t" + + "result of (y.compareTo(z)): " + intObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "IntegerValue: " + value + " and IntegerValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "IntegerValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "IntegerValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((IntegerValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "IntegerValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "IntegerValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another IntegerValue field which is less then method's argument via + * compareTo method. + */ + + private static IntegerValue FindLessIntegerValue (IntegerValue currentValue) { + IntegerValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + IntegerValue newValue = (IntegerValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..af0c4278bca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001/TestDescription.java @@ -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/IntegerValue/compareTo/compareto001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.IntegerValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of IntegerValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote IntegerValue object. + * The debugger program - nsk.jdi.IntegerValue.compareto.compareto001; + * the debuggee program - nsk.jdi.IntegerValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of integer fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of IntegerValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.IntegerValue.compareTo.compareto001 + * nsk.jdi.IntegerValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..6dca61da1c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001a.java @@ -0,0 +1,175 @@ +/* + * 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.IntegerValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public int intMAX = Integer.MAX_VALUE; + public int int1 = 1; + public int int0 = 0; + public int int_1 = -1; + public int intMIN = Integer.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001.java new file mode 100644 index 00000000000..68dea3ff71e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001.java @@ -0,0 +1,247 @@ +/* + * 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.IntegerValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * IntegerValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.IntegerValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static integer plus1_1 = +1;
    + * public static integer plus1_2 = +1;
    + * public static integer minus1 = -1;
    + * public static long longplus1 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * IntegerValue ivplus1_1;
    + * IntegerValue ivplus1_2;
    + * IntegerValue ivminus1;
    + * LongValue lvplus1;
    + *
    + * the following is true:
    + *
    + * ivplus1_1 == ivplus1_2
    + * ivplus1_1 != ivminus1
    + * ivplus1_1 != lvplus1
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/IntegerValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.IntegerValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fiplus1_1 = execClass.fieldByName("plus1_1"); + Field fiplus1_2 = execClass.fieldByName("plus1_2"); + Field fiminus1 = execClass.fieldByName("minus1"); + Field flplus1 = execClass.fieldByName("longplus1"); + + IntegerValue ivplus1_1 = (IntegerValue) execClass.getValue(fiplus1_1); + IntegerValue ivplus1_2 = (IntegerValue) execClass.getValue(fiplus1_2); + IntegerValue ivminus1 = (IntegerValue) execClass.getValue(fiminus1); + LongValue lvplus1 = (LongValue) execClass.getValue(flplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!ivplus1_1.equals(ivplus1_2)) + expresult = 1; + break; + + case 1: if (ivplus1_1.equals(ivminus1)) + expresult = 1; + break; + + case 2: if (ivplus1_1.equals(lvplus1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..22410cfc414 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001/TestDescription.java @@ -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/IntegerValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * IntValue. + * The test checks up that a result of the method + * com.sun.jdi.IntegerValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this IntegerValue for equality. + * Returns: true if the Object is an IntegerValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.IntegerValue.equals.equals001; + * a debuggee program - nsk.jdi.IntegerValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.IntegerValue.equals.equals001 + * nsk.jdi.IntegerValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001a.java new file mode 100644 index 00000000000..75e475ced99 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals001a.java @@ -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.IntegerValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static int smallest = Integer.MIN_VALUE; +// public static int zero = 0; +// public static int largest = Integer.MAX_VALUE; + + public static int plus1_1 = +1; + public static int plus1_2 = +1; + public static int minus1 = -1; + + public static long longplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.IntegerValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + IntegerValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof IntegerValue) ) { + msg += " is not IntegerValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (IntegerValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(IntegerValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof IntegerValue ) { + if ( value.value() == ((PrimitiveValue )object).intValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof IntegerValue ) { + if ( value.value() != ((PrimitiveValue )object).intValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..87763456777 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals002/TestDescription.java @@ -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/IntegerValue/equals/equals002. + * 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.IntegerValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this IntegerValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is an IntegerValue and if applying "==" to the + * two mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.IntegerValue.equals.equals002 + * nsk.jdi.IntegerValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals002a.java new file mode 100644 index 00000000000..93549edbf21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/equals/equals002a.java @@ -0,0 +1,142 @@ +/* + * 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.IntegerValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public int integerMAX = Integer.MAX_VALUE; + public int int1 = 1; + public int int0 = 0; + public int int_1 = -1; + public int integerMIN = Integer.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..5d730e3baf5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001.java @@ -0,0 +1,234 @@ +/* + * 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.IntegerValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * IntegerValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.IntegerValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static integer plus1_1 = +1;
    + * public static integer plus1_2 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * IntegerValue ivplus1_1;
    + * IntegerValue ivplus1_2;
    + *
    + * the following is true:
    + *
    + * ivplus1_1.hashCode() == ivplus1_1.hashCode()
    + * ivplus1_1.hashCode() == ivplus1_2.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/IntegerValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.IntegerValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fiplus1_1 = execClass.fieldByName("plus1_1"); + Field fiplus1_2 = execClass.fieldByName("plus1_2"); + + IntegerValue ivplus1_1 = (IntegerValue) execClass.getValue(fiplus1_1); + IntegerValue ivplus1_2 = (IntegerValue) execClass.getValue(fiplus1_2); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (ivplus1_1.hashCode() != ivplus1_1.hashCode()) + expresult = 1; + break; + + case 1: if (ivplus1_1.hashCode() != ivplus1_2.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..79a9b9a7194 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001/TestDescription.java @@ -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/IntegerValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * IntValue. + * The test checks up that a result of the method + * com.sun.jdi.IntValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this IntegerValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.IntegerValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.IntegerValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.IntegerValue.hashCode.hashcode001 + * nsk.jdi.IntegerValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..2fab00809bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/hashCode/hashcode001a.java @@ -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.IntegerValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static int smallest = Integer.MIN_VALUE; +// public static int zero = 0; +// public static int largest = Integer.MAX_VALUE; + + public static int plus1_1 = +1; + public static int plus1_2 = +1; +// public static int minus1 = -1; + +// public static long longplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * IntegerValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.IntegerValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static integer smallest = Integer.MIN_VALUE;
    + * public static integer zero = 0;
    + * public static integer largest = Integer.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * IntegerValue ivsmallest;
    + * IntegerValue ivzero;
    + * IntegerValue ivlargest;
    + *
    + * the following is true:
    + *
    + * ivsmallest == Integer.MIN_VALUE
    + * ivzero == 0
    + * ivlargest == Integer.MAX_VALUE
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/IntegerValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.IntegerValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fismallest = execClass.fieldByName("smallest"); + Field fizero = execClass.fieldByName("zero"); + Field filargest = execClass.fieldByName("largest"); + + IntegerValue ivsmallest = (IntegerValue) execClass.getValue(fismallest); + IntegerValue ivzero = (IntegerValue) execClass.getValue(fizero); + IntegerValue ivlargest = (IntegerValue) execClass.getValue(filargest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (ivsmallest.value() != Integer.MIN_VALUE) + expresult = 1; + break; + + case 1: if (ivzero.value() != 0) + expresult = 1; + break; + + case 2: if (ivlargest.value() != Integer.MAX_VALUE) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..8b69eb255ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/value/value001/TestDescription.java @@ -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/IntegerValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * IntegerValue. + * The test checks up that a result of the method + * com.sun.jdi.IntegerValue.value() + * complies with its spec: + * public int value() + * Returns this IntegerValue as an int. + * Returns: the int mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.IntegerValue.value.value001; + * a debuggee program - nsk.jdi.IntegerValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.IntegerValue.value.value001 + * nsk.jdi.IntegerValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.IntegerValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/value/value001a.java new file mode 100644 index 00000000000..d9052833c8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/IntegerValue/value/value001a.java @@ -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.IntegerValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static int smallest = Integer.MIN_VALUE; + public static int zero = 0; + public static int largest = Integer.MAX_VALUE; + +// public static int plus1_1 = +1; +// public static int plus1_2 = +1; +// public static int minus1 = -1; + +// public static long longplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * InterfaceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.InterfaceType.implementors()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Iface1 has two implementors, Class0 and Class1
    + * 2) Iface2 has one implementor, Class2
    + * 3) Iface0 has no direct implementors
    + *
    + */ + +public class implementors001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/InterfaceType/implementors/implementors001", + sHeader2 = "--> implementors001: ", + sHeader3 = "##> implementors001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new implementors001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.InterfaceType.implementors.implementors001a"; + + String mName = "nsk.jdi.InterfaceType.implementors"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("implementors001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + ClassType ctype = null; +// ReferenceType reftype = null; + List l = null; + String name = null; + InterfaceType ifaceType = null; + InterfaceType itype = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Iface1 - 2 direct implementors, Class0 and Class1 + + List list0 = vm.classesByName(mName + ".Class1ForCheck"); + + classRefType = (ReferenceType) list0.get(0); + + List iface0list = + ((ClassType) classRefType).interfaces(); + + if (iface0list.size() != 1) { + log3("ERROR : iface0list.size() != 1 in case: Iface1"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface0list.get(0); + l = ifaceType.implementors(); + if (l.size() != 2) { + log3("ERROR : l.size() != 2 in case: Iface1"); + expresult = 1; + break; + } + + ctype = (ClassType) l.get(0); + name = ctype.name(); + if (!name.equals(mName + ".Class0ForCheck")) { + if (!name.equals(mName + ".Class1ForCheck")) { + log3("ERROR : !name.equals('.Class0..' or '.Class1..') in case: Iface1"); + expresult = 1; + break; + } + } + ctype = (ClassType) l.get(1); + name = ctype.name(); + if (!name.equals(mName + ".Class0ForCheck")) { + if (!name.equals(mName + ".Class1ForCheck")) { + log3("ERROR : !name.equals('.Class1..' or '.Class0..') in case: Iface1"); + expresult = 1; + break; + } + } + + break; + + case 1: // Iface2 - 1 direct implementor, Class2 + + List list1 = vm.classesByName(mName + ".Class2ForCheck"); + + classRefType = (ReferenceType) list1.get(0); + + List iface1list = + ((ClassType) classRefType).interfaces(); + + if (iface1list.size() != 1) { + log3("ERROR : iface1list.size() != 1 in case: Iface2"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface1list.get(0); + l = ifaceType.implementors(); + if (l.size() != 1) { + log3("ERROR : l.size() != 1 in case: Iface2"); + expresult = 1; + break; + } + + ctype = (ClassType) l.get(0); + name = ctype.name(); + if (!name.equals(mName + ".Class2ForCheck")) { + log3("ERROR : !name.equals('.Class2..') in case: Iface2"); + expresult = 1; + break; + } + + break; + + case 2: // Iface0 - 0 direct implementors + + List list3 = vm.classesByName(mName + ".Class4ForCheck"); + + classRefType = (ReferenceType) list3.get(0); + + List iface3list = + ((ClassType) classRefType).interfaces(); + + if (iface3list.size() != 1) { + log3("ERROR : iface3list.size() != 1 in case: Iface3"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface3list.get(0); + l = ifaceType.superinterfaces(); + if (l.size() != 1) { + log3("ERROR : ifaceType.superinterfaces().size() != 1 in case: Iface0 " + l.size()); + expresult = 1; + break; + } + itype = (InterfaceType) l.get(0); + l = itype.implementors(); + if (l.size() != 0) { + log3("ERROR : l.get(0).size() != 0 in case: Iface0"); + expresult = 1; + break; + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/implementors/implementors001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/implementors/implementors001/TestDescription.java new file mode 100644 index 00000000000..e9da4aa74d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/implementors/implementors001/TestDescription.java @@ -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/InterfaceType/implementors/implementors001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * InterfaceType. + * The test checks up that a result of the method + * com.sun.jdi.InterfaceType.implementors() + * complies with tits spec: + * public java.util.List implementors() + * Gets the currently prepared classes which directly implement this interface. + * The returned list contains only those classes that declared this interface + * in their "implements" clause. + * Returns: a List of ClassType objects each mirroring a class + * implementing this interface. + * If none exist, returns a zero length List. + * Throws: ObjectCollectedException - + * if this interface has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.InterfaceType.implementors.implementors001; + * the debuggee program - nsk.jdi.InterfaceType.implementors.implementors001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.InterfaceType.implementors.implementors001 + * nsk.jdi.InterfaceType.implementors.implementors001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.InterfaceType.implementors.implementors001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/implementors/implementors001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/implementors/implementors001a.java new file mode 100644 index 00000000000..17d35f74159 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/implementors/implementors001a.java @@ -0,0 +1,307 @@ +/* + * 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.InterfaceType.implementors; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the implementors001 JDI test. + */ + +public class implementors001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> implementors001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> implementors001a: " + message); + } + + //====================================================== test program + + static Class0ForCheck class0 = null; + static Class1ForCheck class1 = null; + static Class2ForCheck class2 = null; + static Class3ForCheck class3 = null; + static Class4ForCheck class4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * InterfaceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.InterfaceType.subinterfaces()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Iface3 has no a subinterface
    + * 2) Iface2 has the subinterface Iface3
    + * 3) Iface1 has the subinterfaces Iface2 and Iface4
    + *
    + */ + +public class subinterfaces001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/InterfaceType/subinterfaces/subinterfaces001", + sHeader2 = "--> subinterfaces001: ", + sHeader3 = "##> subinterfaces001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new subinterfaces001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.InterfaceType.subinterfaces.subinterfaces001a"; + + String mName = "nsk.jdi.InterfaceType.subinterfaces"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("subinterfaces001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + ReferenceType reftype = null; + List l = null; + String name = null; + InterfaceType ifaceType = null; + InterfaceType itype = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Iface3 - 0 subinterfaces + + List list0 = vm.classesByName(mName + ".Class3ForCheck"); + + classRefType = (ReferenceType) list0.get(0); + + List iface0list = + ((ClassType) classRefType).interfaces(); + + if (iface0list.size() != 1) { + log3("ERROR : iface0list.size() != 1 in case: Iface3"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface0list.get(0); + if (ifaceType.subinterfaces().size() != 0) { + log3("ERROR : ifaceType.subinterfaces().size() != 0 in case: Iface3"); + expresult = 1; + break; + } + + break; + + case 1: // Iface2 - 1 subinterfaces + + List list1 = vm.classesByName(mName + ".Class2ForCheck"); + + classRefType = (ReferenceType) list1.get(0); + + List iface1list = + ((ClassType) classRefType).interfaces(); + + if (iface1list.size() != 1) { + log3("ERROR : iface1list.size() != 1 in case: Iface2"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface1list.get(0); + l = ifaceType.subinterfaces(); + if (l.size() != 1) { + log3("ERROR : ifaceType.subinterfaces().size() != 1 in case: Iface2"); + expresult = 1; + break; + } + + itype = (InterfaceType) l.get(0); + name = itype.name(); + if (!name.equals(mName + ".Iface3")) { + log3("ERROR : !name.equals(mName + '.Iface3') in case: Iface2"); + expresult = 1; + break; + } + + break; + + case 2: // Iface1 - 2 subinterfaces + + List list3 = vm.classesByName(mName + ".Class1ForCheck"); + + classRefType = (ReferenceType) list3.get(0); + + List iface3list = + ((ClassType) classRefType).interfaces(); + + if (iface3list.size() != 1) { + log3("ERROR : iface3list.size() != 1 in case: Iface1"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface3list.get(0); + l = ifaceType.subinterfaces(); + if (l.size() != 2) { + log3("ERROR : ifaceType.subinterfaces().size() != 1 in case: Iface1"); + expresult = 1; + break; + } + + itype = (InterfaceType) l.get(0); + name = itype.name(); + if (!name.equals(mName + ".Iface2")) { + if (!name.equals(mName + ".Iface4")) { + log3("ERROR : !name.equals('.Iface2' or '.Iface4') in case: Iface1"); + expresult = 1; + break; + } + } + itype = (InterfaceType) l.get(1); + name = itype.name(); + if (!name.equals(mName + ".Iface4")) { + if (!name.equals(mName + ".Iface2")) { + log3("ERROR : !name.equals('.Iface4' or '.Iface2') in case: Iface1"); + expresult = 1; + break; + } + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001/TestDescription.java new file mode 100644 index 00000000000..7deecd14086 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001/TestDescription.java @@ -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/InterfaceType/subinterfaces/subinterfaces001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * InterfaceType. + * The test checks up that a result of the method + * com.sun.jdi.InterfaceType.subinterfaces() + * complies with tits spec: + * public java.util.List subinterfaces() + * Gets the currently prepared interfaces which directly extend this interface. + * The returned list contains only those interfaces + * that declared this interface in their "extends" clause. + * Returns: a List of InterfaceType objects each mirroring an interface + * extending this interface. + * If none exist, returns a zero length List. + * Throws: ObjectCollectedException - + * if this interface has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.InterfaceType.subinterfaces.subinterfaces001; + * the debuggee program - nsk.jdi.InterfaceType.subinterfaces.subinterfaces001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.InterfaceType.subinterfaces.subinterfaces001 + * nsk.jdi.InterfaceType.subinterfaces.subinterfaces001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.InterfaceType.subinterfaces.subinterfaces001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001a.java new file mode 100644 index 00000000000..ffc07fcdfa3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001a.java @@ -0,0 +1,305 @@ +/* + * 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.InterfaceType.subinterfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the subinterfaces001 JDI test. + */ + +public class subinterfaces001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> subinterfaces001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> subinterfaces001a: " + message); + } + + //====================================================== test program + + static Class1ForCheck class1 = null; + static Class2ForCheck class2 = null; + static Class3ForCheck class3 = null; + static Class4ForCheck class4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * InterfaceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.InterfaceType.superinterfaces()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * 1) Iface1 has no a superinterface
    + * 2) Iface2 has the superinterface Iface1 and
    + * no indirect interfaces
    + * 3) Iface3 has the superinterface Iface2 and
    + * the indirect interface Iface1
    + * 4) Iface4 has the superinterfaces Iface0 and Iface1
    + *
    + */ + +public class superinterfaces001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/InterfaceType/superinterfaces/superinterfaces001", + sHeader2 = "--> superinterfaces001: ", + sHeader3 = "##> superinterfaces001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new superinterfaces001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.InterfaceType.superinterfaces.superinterfaces001a"; + + String mName = "nsk.jdi.InterfaceType.superinterfaces"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("superinterfaces001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType classRefType = null; + ReferenceType reftype = null; + List l = null; + String name = null; + InterfaceType ifaceType = null; + InterfaceType itype = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // Iface1 - 0 superinterfaces + + List list0 = vm.classesByName(mName + ".Class1ForCheck"); + + classRefType = (ReferenceType) list0.get(0); + + List iface0list = + ((ClassType) classRefType).interfaces(); + + if (iface0list.size() != 1) { + log3("ERROR : iface0list.size() != 1 in case: Iface1"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface0list.get(0); + if (ifaceType.superinterfaces().size() != 0) { + log3("ERROR : ifaceType.superinterfaces().size() != 0 in case: Iface1"); + expresult = 1; + break; + } + + break; + + case 1: // Iface2 - 1 superifaces, 0 indirect ifaces + + List list1 = vm.classesByName(mName + ".Class2ForCheck"); + + classRefType = (ReferenceType) list1.get(0); + + List iface1list = + ((ClassType) classRefType).interfaces(); + + if (iface1list.size() != 1) { + log3("ERROR : iface1list.size() != 1 in case: Iface2"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface1list.get(0); + l = ifaceType.superinterfaces(); + if (l.size() != 1) { + log3("ERROR : ifaceType.superinterfaces().size() != 1 in case: Iface2"); + expresult = 1; + break; + } + + itype = (InterfaceType) l.get(0); + name = itype.name(); + if (!name.equals(mName + ".Iface1")) { + log3("ERROR : !name.equals(mName + '.Iface1') in case: Iface2"); + expresult = 1; + break; + } + + break; + + case 2: // Iface3 - 1 superifaces, 1 indirect ifaces + + List list3 = vm.classesByName(mName + ".Class3ForCheck"); + + classRefType = (ReferenceType) list3.get(0); + + List iface3list = + ((ClassType) classRefType).interfaces(); + + if (iface3list.size() != 1) { + log3("ERROR : iface3list.size() != 1 in case: Iface3"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface3list.get(0); + l = ifaceType.superinterfaces(); + if (l.size() != 1) { + log3("ERROR : ifaceType.superinterfaces().size() != 1 in case: Iface3"); + expresult = 1; + break; + } + + break; + + case 3: // Iface4 - 2 superifaces, 0 indirect ifaces + + List list4 = vm.classesByName(mName + ".Class4ForCheck"); + + classRefType = (ReferenceType) list4.get(0); + + List iface4list = + ((ClassType) classRefType).interfaces(); + + if (iface4list.size() != 1) { + log3("ERROR : iface4list.size() != 1 in case: Iface4"); + expresult = 1; + break; + } + + ifaceType = (InterfaceType) iface4list.get(0); + l = ifaceType.superinterfaces(); + if (l.size() != 2) { + log3("ERROR : ifaceType.superinterfaces().size() != 2 in case: Iface4"); + expresult = 1; + break; + } + + itype = (InterfaceType) l.get(0); + name = itype.name(); + if (!name.equals(mName + ".Iface0")) { + if (!name.equals(mName + ".Iface1")) { + log3("ERROR : !name.equals('.Iface0' or '.Iface1') in case: Iface4"); + expresult = 1; + break; + } + } + itype = (InterfaceType) l.get(1); + name = itype.name(); + if (!name.equals(mName + ".Iface0")) { + if (!name.equals(mName + ".Iface1")) { + log3("ERROR : !name.equals('.Iface1' or '.Iface0') in case: Iface4"); + expresult = 1; + break; + } + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/superinterfaces/superinterfaces001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/superinterfaces/superinterfaces001/TestDescription.java new file mode 100644 index 00000000000..10b3f987ac3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/superinterfaces/superinterfaces001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/InterfaceType/superinterfaces/superinterfaces001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * InterfaceType. + * The test checks up that a result of the method + * com.sun.jdi.InterfaceType.superinterfaces() + * complies with tits spec: + * public java.util.List superinterfaces() + * Gets the interfaces directly extended by this interface. + * The returned list contains only those interfaces + * this interface has declared to be extended. + * Returns: a List of InterfaceType objects each mirroring + * an interface extended by this interface. + * If none exist, returns a zero length List. + * Throws: ClassNotPreparedException - + * if this class not yet been prepared. + * ObjectCollectedException - + * if this interface has been unloaded and garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.InterfaceType.superinterfaces.superinterfaces001; + * the debuggee program - nsk.jdi.InterfaceType.superinterfaces.superinterfaces001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.InterfaceType.superinterfaces.superinterfaces001 + * nsk.jdi.InterfaceType.superinterfaces.superinterfaces001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.InterfaceType.superinterfaces.superinterfaces001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/superinterfaces/superinterfaces001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/superinterfaces/superinterfaces001a.java new file mode 100644 index 00000000000..433e005efa3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/superinterfaces/superinterfaces001a.java @@ -0,0 +1,304 @@ +/* + * 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.InterfaceType.superinterfaces; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the superinterfaces001 JDI test. + */ + +public class superinterfaces001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> superinterfaces001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> superinterfaces001a: " + message); + } + + //====================================================== test program + + static Class1ForCheck class1 = null; + static Class2ForCheck class2 = null; + static Class3ForCheck class3 = null; + static Class4ForCheck class4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.CommandLineLaunch + * and dt_socket transport. + * + *

    Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + */ +public class launch001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + private final static String CONNECTOR_NAME = + "com.sun.jdi.CommandLineLaunch"; + private final static String TRANSPORT_NAME = "dt_socket"; + + private final static String DEBUGEE_CLASS = + "nsk.jdi.LaunchingConnector.launch.launch001o"; + + public static void main (String args[]) { + System.exit(run(args,System.out) + JCK_STATUS_BASE); + // JCK-style exit status. + } + + public static int run (String args[], PrintStream out) { + return new launch001(args,out).run(); + } + + private launch001 (String args[], PrintStream out) { + this.out = out; + + argHandler = new ArgumentHandler(args); + log = new Log(this.out, argHandler); + } + + private PrintStream out; + private ArgumentHandler argHandler; + private Log log; + + private int run () { +// pass if CONNECTOR_NAME with TRANSPORT_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME, TRANSPORT_NAME)) + return PASSED; + + LaunchingConnector lc = + getLaunchingConnector(CONNECTOR_NAME, TRANSPORT_NAME); + if (lc == null) { + log.complain("FAILURE: cannot get LaunchingConnector"); + return FAILED; + }; + Map carg = setupConnectorArguments(lc); + + log.display("Starting debugee VM"); + VirtualMachine vm; + try { + vm = lc.launch(carg); + } catch (Exception e) { + log.complain("FAILURE: cannot launch debugee VM: " + + e.getMessage()); + e.printStackTrace(out); + return FAILED; + } + + Binder binder = new Binder(argHandler, log); + Debugee debugee = binder.enwrapDebugee(vm, vm.process()); + + log.display("Resuming debugee VM"); + debugee.resume(); + + log.display("Waiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("FAILURE: debugee VM exitCode=" + code); + return FAILED; + }; + log.display("Debugee VM exitCode=" + code); + return PASSED; + } + + private Map setupConnectorArguments (LaunchingConnector lc) { + Map carg = lc.defaultArguments(); + + log.display("Connector's arguments:"); + Object cava[] = carg.values().toArray(); + for (int i=0; i 0) + log.display("Launching connectors available:"); + + int found = 0; + LaunchingConnector lc = null; + + Iterator lci = lcl.iterator(); + for (int i=1; lci.hasNext(); i++) { + LaunchingConnector c = (LaunchingConnector) lci.next(); + log.display(" Launching connector #" + i + ":"); + log.display(" Name: " + c.name()); + log.display(" Description: " + c.description()); + log.display(" Transport: " + c.transport().name()); + if (!c.name().equals(connectorName)) + continue; + if (c.transport().name().equals(transportName)) { + log.display(" -- This connector is appropriate. --"); + if (lc == null) + lc = c; + found++; + } + }; + + if (lc == null) { + log.complain("FAILURE: no " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + if (found > 1) { + log.complain("TEST_BUG: more than one " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + return lc; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001/TestDescription.java new file mode 100644 index 00000000000..51a5990df62 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001/TestDescription.java @@ -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/LaunchingConnector/launch/launch001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This tiny debugger-like application starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.CommandLineLaunch + * and dt_socket transport. + * Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LaunchingConnector.launch.launch001 + * nsk.jdi.LaunchingConnector.launch.launch001o + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LaunchingConnector.launch.launch001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001o.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001o.java new file mode 100644 index 00000000000..9356dcd32fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001o.java @@ -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.LaunchingConnector.launch; + +/** + * Dummy debugee application used to test JDI connection. + */ +public class launch001o { + public static void main (String args[]) { + System.exit(launch001.JCK_STATUS_BASE + launch001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002.java new file mode 100644 index 00000000000..e2eb8168f2a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002.java @@ -0,0 +1,192 @@ +/* + * 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.LaunchingConnector.launch; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; + +import java.io.*; +import java.util.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This tiny debugger-like application starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.CommandLineLaunch + * and dt_shmem transport. + * + *

    Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + */ +public class launch002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + private final static String CONNECTOR_NAME = + "com.sun.jdi.CommandLineLaunch"; + private final static String TRANSPORT_NAME = "dt_shmem"; + + private final static String DEBUGEE_CLASS = + "nsk.jdi.LaunchingConnector.launch.launch002o"; + + public static void main (String args[]) { + System.exit(run(args,System.out) + JCK_STATUS_BASE); + // JCK-style exit status. + } + + public static int run (String args[], PrintStream out) { + return new launch002(args,out).run(); + } + + private launch002 (String args[], PrintStream out) { + this.out = out; + argHandler = new ArgumentHandler(args); + log = new Log(this.out, argHandler); + } + + private PrintStream out; + private ArgumentHandler argHandler; + private Log log; + + private int run () { +// pass if CONNECTOR_NAME with TRANSPORT_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME, TRANSPORT_NAME)) + return PASSED; + + LaunchingConnector lc = + getLaunchingConnector(CONNECTOR_NAME, TRANSPORT_NAME); + if (lc == null) { + log.complain("FAILURE: cannot get LaunchingConnector"); + return FAILED; + }; + Map carg = setupConnectorArguments(lc); + + log.display("Starting debugee VM"); + VirtualMachine vm; + try { + vm = lc.launch(carg); + } catch (Exception e) { + log.complain("FAILURE: cannot launch debugee VM: " + + e.getMessage()); + e.printStackTrace(out); + return FAILED; + }; + + Binder binder = new Binder(argHandler, log); + Debugee debugee = binder.enwrapDebugee(vm, vm.process()); + + log.display("Resuming debugee VM"); + debugee.resume(); + + log.display("Waiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("FAILURE: debugee VM exitCode=" + code); + return FAILED; + }; + log.display("Debugee VM exitCode=" + code); + log.display("Test PASSED!"); + return PASSED; + } + + private Map setupConnectorArguments(LaunchingConnector lc) { + Map carg = lc.defaultArguments(); + + log.display("Connector's arguments:"); + Object cava[] = carg.values().toArray(); + for (int i=0; i 0) + log.display("Launching connectors available:"); + + int found = 0; + LaunchingConnector lc = null; + + Iterator lci = lcl.iterator(); + for (int i=1; lci.hasNext(); i++) { + LaunchingConnector c = (LaunchingConnector) lci.next(); + log.display(" Launching connector #" + i + ":"); + log.display(" Name: " + c.name()); + log.display(" Description: " + c.description()); + log.display(" Transport: " + c.transport().name()); + if (!c.name().equals(connectorName)) + continue; + if (c.transport().name().equals(transportName)) { + log.display(" -- This connector is appropriate. --"); + if (lc == null) + lc = c; + found++; + } + }; + + if (lc == null) { + log.complain("FAILURE: no " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + if (found > 1) { + log.complain("TEST_BUG: more than one " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + return lc; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002/TestDescription.java new file mode 100644 index 00000000000..4a4afa9c9f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002/TestDescription.java @@ -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/LaunchingConnector/launch/launch002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This tiny debugger-like application starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.CommandLineLaunch + * and dt_shmem transport. + * Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LaunchingConnector.launch.launch002 + * nsk.jdi.LaunchingConnector.launch.launch002o + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LaunchingConnector.launch.launch002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002o.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002o.java new file mode 100644 index 00000000000..2ab2ac9391c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002o.java @@ -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.LaunchingConnector.launch; + +/** + * Dummy debugee application used to test JDI connection. + */ +public class launch002o { + public static void main (String args[]) { + System.exit(launch002.JCK_STATUS_BASE + launch002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003.java new file mode 100644 index 00000000000..05d1dffeadb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003.java @@ -0,0 +1,198 @@ +/* + * 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.LaunchingConnector.launch; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; + +import java.io.*; +import java.util.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This tiny debugger-like application starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.RawCommandLineLaunch + * and dt_socket transport. + * + *

    Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + */ +public class launch003 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + private final static String CONNECTOR_NAME = + "com.sun.jdi.RawCommandLineLaunch"; + private final static String TRANSPORT_NAME = "dt_socket"; + + private final static String DEBUGEE_CLASS = + "nsk.jdi.LaunchingConnector.launch.launch003o"; + + public static void main(String args[]) { + System.exit(run(args,System.out) + JCK_STATUS_BASE); + // JCK-style exit status. + } + + public static int run(String args[], PrintStream out) { + return new launch003(args,out).run(); + } + + private launch003(String args[], PrintStream out) { + this.out = out; + argHandler = new ArgumentHandler(args); + log = new Log(this.out, argHandler); + } + + private PrintStream out; + private ArgumentHandler argHandler; + private Log log; + + private int run() { + +// pass if CONNECTOR_NAME with TRANSPORT_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME, TRANSPORT_NAME)) + return PASSED; + + LaunchingConnector lc = + getLaunchingConnector(CONNECTOR_NAME, TRANSPORT_NAME); + if (lc == null) { + log.complain("FAILURE: cannot get LaunchingConnector"); + return FAILED; + }; + Map carg = + setupConnectorArguments(lc, argHandler.getTestHost(), + argHandler.getTransportPort()); + log.display("Starting debugee VM"); + VirtualMachine vm; + try { + vm = lc.launch(carg); + } catch (Exception e) { + log.complain("FAILURE: cannot launch debugee VM: " + + e.getMessage()); + e.printStackTrace(out); + return FAILED; + }; + + log.display("target VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + Binder binder = new Binder(argHandler, log); + Debugee debugee = binder.enwrapDebugee(vm, vm.process()); + + log.display("Resuming debugee VM"); + debugee.resume(); + + log.display("Waiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("FAILURE: debugee VM exitCode=" + code); + return FAILED; + }; + log.display("Debugee VM exitCode=" + code); + log.display("Test PASSED!"); + return PASSED; + } + + private Map setupConnectorArguments( + LaunchingConnector lc, String host, String port) { + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + Map carg = lc.defaultArguments(); + log.display("Connector's arguments:"); + Object cava[] = carg.values().toArray(); + for (int i=0; i 1) { + log.complain("TEST_BUG: more than one " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + return lc; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003/TestDescription.java new file mode 100644 index 00000000000..1f3f3dcd59a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003/TestDescription.java @@ -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/LaunchingConnector/launch/launch003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This tiny debugger-like application starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.RawCommandLineLaunch + * and dt_socket transport. + * Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LaunchingConnector.launch.launch003 + * nsk.jdi.LaunchingConnector.launch.launch003o + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LaunchingConnector.launch.launch003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003o.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003o.java new file mode 100644 index 00000000000..8d3c8e01aa0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch003o.java @@ -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.LaunchingConnector.launch; + +/** + * Dummy debugee application used to test JDI connection. + */ +public class launch003o { + public static void main (String args[]) { + System.exit(launch003.JCK_STATUS_BASE + launch003.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004.java new file mode 100644 index 00000000000..7822023ac94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004.java @@ -0,0 +1,197 @@ +/* + * 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.LaunchingConnector.launch; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; + +import java.io.*; +import java.util.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This test is debugger-like application. It starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.RawCommandLineLaunch + * and dt_shmem transport. + * + *

    Note that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + */ +public class launch004 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + private final static String CONNECTOR_NAME = + "com.sun.jdi.RawCommandLineLaunch"; + private final static String TRANSPORT_NAME = "dt_shmem"; + + private final static String DEBUGEE_CLASS = + "nsk.jdi.LaunchingConnector.launch.launch004o"; + + public static void main(String args[]) { + System.exit(run(args,System.out) + JCK_STATUS_BASE); + // JCK-style exit status. + } + + public static int run(String args[], PrintStream out) { + return new launch004(args,out).run(); + } + + private launch004(String args[], PrintStream out) { + this.out = out; + argHandler = new ArgumentHandler(args); + log = new Log(this.out, argHandler); + } + + private PrintStream out; + private ArgumentHandler argHandler; + private Log log; + + private int run() { + +// pass if CONNECTOR_NAME with TRANSPORT_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME, TRANSPORT_NAME)) + return PASSED; + + LaunchingConnector lc = + getLaunchingConnector(CONNECTOR_NAME, TRANSPORT_NAME); + if (lc == null) { + log.complain("FAILURE: cannot get LaunchingConnector"); + return FAILED; + }; + Map carg = + setupConnectorArguments(lc, argHandler.getTransportSharedName()); + log.display("Starting debugee VM"); + VirtualMachine vm; + try { + vm = lc.launch(carg); + } catch (Exception e) { + log.complain("FAILURE: cannot launch debugee VM: " + + e.getMessage()); + e.printStackTrace(out); + return FAILED; + }; + + log.display("target VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + Binder binder = new Binder(argHandler, log); + Debugee debugee = binder.enwrapDebugee(vm, vm.process()); + + log.display("Resuming debugee VM"); + debugee.resume(); + + log.display("Waiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("FAILURE: debugee VM exitCode=" + code); + return FAILED; + }; + log.display("Debugee VM exitCode=" + code); + log.display("Test PASSED!"); + return PASSED; + } + + private Map setupConnectorArguments( + LaunchingConnector lc, String name) { + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + Map carg = lc.defaultArguments(); + log.display("Connector's arguments:"); + Object cava[] = carg.values().toArray(); + for (int i=0; i 1) { + log.complain("TEST_BUG: more than one " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + return lc; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004/TestDescription.java new file mode 100644 index 00000000000..20f185eaf34 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004/TestDescription.java @@ -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/LaunchingConnector/launch/launch004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test is debugger-like application. It starts + * debugee VM so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.RawCommandLineLaunch + * and dt_shmem transport. + * Note that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LaunchingConnector.launch.launch004 + * nsk.jdi.LaunchingConnector.launch.launch004o + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LaunchingConnector.launch.launch004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004o.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004o.java new file mode 100644 index 00000000000..5e075d231b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004o.java @@ -0,0 +1,30 @@ +/* + * 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.LaunchingConnector.launch; + +public class launch004o { + public static void main(String args[]) { + System.exit(launch004.JCK_STATUS_BASE + launch004.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001.java new file mode 100644 index 00000000000..9c03396d67f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2007, 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.LaunchingConnector.launchnosuspend; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.event.*; + +import java.io.*; +import java.util.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This tiny debugger-like application starts debugee VM + * so that debugger/debugee connection be correctly + * established via connector com.sun.jdi.CommandLineLaunch + * and dt_socket transport. + * + *

    Note, that unlike most of JDI tests, this test + * will always fail if launching of other JVM is prohibited + * by security restrictions. + */ +public class launchnosuspend001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + private final static String CONNECTOR_NAME = + "com.sun.jdi.RawCommandLineLaunch"; + private final static String TRANSPORT_NAME = "dt_socket"; + + private final static String DEBUGEE_CLASS = + "nsk.jdi.LaunchingConnector.launchnosuspend.launchnosuspend001o"; + + public static void main (String args[]) { + System.exit(run(args,System.out) + JCK_STATUS_BASE); + // JCK-style exit status. + } + + public static int run (String args[], PrintStream out) { + return new launchnosuspend001(args,out).run(); + } + + private launchnosuspend001 (String args[], PrintStream out) { + this.out = out; + + argHandler = new ArgumentHandler(args); + log = new Log(this.out, argHandler); + //log.enableVerbose(true); + } + + private PrintStream out; + private ArgumentHandler argHandler; + private Log log; + + private int run() { + +// pass if CONNECTOR_NAME with TRANSPORT_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME, TRANSPORT_NAME)) + return PASSED; + + LaunchingConnector lc = + getLaunchingConnector(CONNECTOR_NAME, TRANSPORT_NAME); + if (lc == null) { + log.complain("FAILURE: cannot get LaunchingConnector"); + return FAILED; + }; + Map carg = + setupConnectorArguments(lc, argHandler.getTestHost(), + argHandler.getTransportPort()); + log.display("Starting debugee VM"); + VirtualMachine vm; + try { + vm = lc.launch(carg); + } catch (Exception e) { + log.complain("FAILURE: cannot launch debugee VM: " + + e.getMessage()); + e.printStackTrace(out); + return FAILED; + }; + + log.display("target VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + //try {EventSet set = vm.eventQueue().remove(); + //for(Event event : set) + // System.out.println("==DEFSTAN: " + event.toString()); + //} catch (Throwable e) {} + + //vm.setDebugTraceMode(VirtualMachine.TRACE_ALL); + Binder binder = new Binder(argHandler, log); + Debugee debugee = binder.makeLocalDebugee(vm.process()); + debugee.redirectOutput(log); + debugee.setupVM(vm); + //debugee.waitForVMInit(1000); + + //log.display("Resuming debugee VM"); + //debugee.resume(); + + log.display("Waiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("FAILURE: debugee VM exitCode=" + code); + return FAILED; + }; + log.display("Debugee VM exitCode=" + code); + log.display("Test PASSED!"); + return PASSED; + } + + private Map setupConnectorArguments( + LaunchingConnector lc, String host, String port) { + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + Map carg = lc.defaultArguments(); + log.display("Connector's arguments:"); + Object cava[] = carg.values().toArray(); + for (int i=0; i 1) { + log.complain("TEST_BUG: more than one " + + connectorName + " connector found for " + + transportName + " transport!"); + return null; + }; + return lc; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001/TestDescription.java new file mode 100644 index 00000000000..b1bcb4764b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001/TestDescription.java @@ -0,0 +1,52 @@ +/* + * 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/LaunchingConnector/launchnosuspend/launchnosuspend001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exactly as launch003 except using options: + * -agentlib:jdwb + * suspend=n + * COMMENT + * RFE 4920165 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LaunchingConnector.launchnosuspend.launchnosuspend001 + * nsk.jdi.LaunchingConnector.launchnosuspend.launchnosuspend001o + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LaunchingConnector.launchnosuspend.launchnosuspend001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001o.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001o.java new file mode 100644 index 00000000000..5b55267b923 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001o.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 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.LaunchingConnector.launchnosuspend; + +/** + * Dummy debugee application used to test JDI connection. + */ +public class launchnosuspend001o { + public static void main (String args[]) { + try { + Thread.sleep(60000); + } catch (Throwable e) + { + e.printStackTrace(); + System.exit(launchnosuspend001.JCK_STATUS_BASE + launchnosuspend001.FAILED); + } + System.exit(launchnosuspend001.JCK_STATUS_BASE + launchnosuspend001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001.java new file mode 100644 index 00000000000..450ad57f8e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001.java @@ -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.ListeningConnector.accept; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that debugger may establish connection with + * a debugee VM via com.sun.jdi.SocketListen connector. + */ +public class accept001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = "nsk.jdi.ListeningConnector.accept.accept001t"; + + private Log log; + + private VirtualMachine vm; + private ListeningConnector connector; + private Map connArgs; + + IORedirector outRedirector; + IORedirector errRedirector; + + 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 accept001().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if "com.sun.jdi.SocketListen" is not implemented +// on this platform + if (argHandler.shouldPass("com.sun.jdi.SocketListen")) + return PASSED; + + long timeout = argHandler.getWaitTime() * 60 * 1000; + log = new Log(out, argHandler); + + String connAddr = startListen(argHandler.getTransportPortIfNotDynamic()); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,address=" + + connAddr + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + log.display("command: " + cmd); + Debugee debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + + if ((vm = attachTarget()) == null) { + log.complain("TEST: Unable to attach the debugee VM"); + debugee.close(); + return FAILED; + } + + if (!stopListen()) { + log.complain("TEST: Unable to stop listen"); + debugee.close(); + return FAILED; + } + + log.display("Debugee VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + debugee.setupVM(vm); + debugee.waitForVMInit(timeout); + + log.display("\nResuming debugee VM"); + debugee.resume(); + + log.display("\nWaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("Debugee VM: exit code=" + code); + return PASSED; + } + + private VirtualMachine attachTarget() { + try { + return connector.accept(connArgs); + } catch (IOException e) { + log.complain("TEST: caught IOException: " + + e.getMessage()); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return null; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return null; + } + } + + private String startListen(String port) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector("com.sun.jdi.SocketListen"); + + connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("port") && port != null) + arg.setValue(port); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + + try { + return connector.startListening(connArgs); + } catch (IOException e) { + throw new Error("TEST: Unable to start listening to the debugee VM: " + + e.getMessage()); + } catch (IllegalConnectorArgumentsException e) { + throw new Error("TEST: Illegal connector arguments: " + + e.getMessage()); + } catch (Exception e) { + throw new Error("TEST: Internal error: " + e.getMessage()); + } + } + + private boolean stopListen() { + try { + connector.stopListening(connArgs); + } catch (IOException e) { + log.complain("TEST: Unable to stop listening to the debugee VM: " + + e.getMessage()); + return false; + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return false; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001/TestDescription.java new file mode 100644 index 00000000000..26f7949f5cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ListeningConnector/accept/accept001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a debugee VM via com.sun.jdi.SocketListen connector. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * Test was fixed to provide early redirecting of debugee output. + * See bug: + * 4905551 shmemBase_listen failed: Cannot create a file when that file already exists + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.accept.accept001 + * nsk.jdi.ListeningConnector.accept.accept001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.accept.accept001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001t.java new file mode 100644 index 00000000000..c29f7284af4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept001t.java @@ -0,0 +1,32 @@ +/* + * 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.ListeningConnector.accept; + +import java.io.IOException; + +public class accept001t { + public static void main(String args[]) { + System.exit(accept001.JCK_STATUS_BASE + accept001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002.java new file mode 100644 index 00000000000..5eeabb30a97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002.java @@ -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.ListeningConnector.accept; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that debugger may establish connection with + * a debugee VM via com.sun.jdi.SharedMemoryListen connector. + */ +public class accept002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = + "nsk.jdi.ListeningConnector.accept.accept002t"; + + private Log log; + + private VirtualMachine vm; + private ListeningConnector connector; + private Map connArgs; + + IORedirector outRedirector; + IORedirector errRedirector; + + 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 accept002().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if "com.sun.jdi.SharedMemoryListen" is not implemented +// on this platform + if (argHandler.shouldPass("com.sun.jdi.SharedMemoryListen")) + return PASSED; + + long timeout = argHandler.getWaitTime() * 60 * 1000; + log = new Log(out, argHandler); + + String connAddr = startListen(argHandler.getTransportSharedName()); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_shmem,server=n,address=" + + connAddr + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + log.display("command: " + cmd); + Debugee debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + + if ((vm = attachTarget()) == null) { + log.complain("TEST: Unable to attach the debugee VM"); + debugee.close(); + return FAILED; + } + if (!stopListen()) { + log.complain("TEST: Unable to stop listen"); + debugee.close(); + return FAILED; + } + + log.display("Debugee VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + debugee.setupVM(vm); + debugee.waitForVMInit(timeout); + + log.display("\nResuming debugee VM"); + debugee.resume(); + + log.display("\nWaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("Debugee VM: exit code=" + code); + return PASSED; + } + + private VirtualMachine attachTarget() { + try { + return connector.accept(connArgs); + } catch (IOException e) { + log.complain("TEST: caught IOException: " + + e.getMessage()); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return null; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return null; + } + } + + private String startListen(String name) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector("com.sun.jdi.SharedMemoryListen"); + + connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("name") && name != null) + arg.setValue(name); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + + try { + return connector.startListening(connArgs); + } catch (IOException e) { + throw new Error("TEST: Unable to start listening to the debugee VM: " + + e.getMessage()); + } catch (IllegalConnectorArgumentsException e) { + throw new Error("TEST: Illegal connector arguments: " + + e.getMessage()); + } catch (Exception e) { + throw new Error("TEST: Internal error: " + e.getMessage()); + } + } + + private boolean stopListen() { + try { + connector.stopListening(connArgs); + } catch (IOException e) { + log.complain("TEST: Unable to stop listening to the debugee VM: " + + e.getMessage()); + return false; + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return false; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002/TestDescription.java new file mode 100644 index 00000000000..3c0fabf4e24 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ListeningConnector/accept/accept002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that debugger may establish connection with + * a debugee VM via com.sun.jdi.SharedMemoryListen connector. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * Test was fixed to provide early redirecting of debugee output. + * See bug: + * 4905551 shmemBase_listen failed: Cannot create a file when that file already exists + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.accept.accept002 + * nsk.jdi.ListeningConnector.accept.accept002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.accept.accept002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002t.java new file mode 100644 index 00000000000..21ee1e2faf7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/accept/accept002t.java @@ -0,0 +1,32 @@ +/* + * 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.ListeningConnector.accept; + +import java.io.IOException; + +public class accept002t { + public static void main(String args[]) { + System.exit(accept002.JCK_STATUS_BASE + accept002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001.java new file mode 100644 index 00000000000..cff662f9296 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001.java @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2007, 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.ListeningConnector.listennosuspend; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that debugger may establish connection with + * a debugee VM via com.sun.jdi.SocketListen connector. + */ +public class listennosuspend001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = "nsk.jdi.ListeningConnector.listennosuspend.listennosuspend001t"; + + private Log log; + + private VirtualMachine vm; + private ListeningConnector connector; + private Map connArgs; + + IORedirector outRedirector; + IORedirector errRedirector; + + 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 listennosuspend001().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if "com.sun.jdi.SocketListen" is not implemented +// on this platform + if (argHandler.shouldPass("com.sun.jdi.SocketListen")) + return PASSED; + + long timeout = argHandler.getWaitTime() * 60 * 1000; + log = new Log(out, argHandler); + + String connAddr = startListen(argHandler.getTransportPortIfNotDynamic()); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=" + + connAddr + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + log.display("command: " + cmd); + Debugee debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + + if ((vm = attachTarget()) == null) { + log.complain("TEST: Unable to attach the debugee VM"); + debugee.close(); + return FAILED; + } + + if (!stopListen()) { + log.complain("TEST: Unable to stop listen"); + debugee.close(); + return FAILED; + } + + log.display("Debugee VM: name=" + vm.name() + " JRE version=" + + vm.version() + "\n\tdescription=" + vm.description()); + + debugee.setupVM(vm); + //debugee.waitForVMInit(timeout); + + //log.display("\nResuming debugee VM"); + //debugee.resume(); + + log.display("\nWaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("Debugee VM: exit code=" + code); + return PASSED; + } + + private VirtualMachine attachTarget() { + try { + return connector.accept(connArgs); + } catch (IOException e) { + log.complain("TEST: caught IOException: " + + e.getMessage()); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return null; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return null; + } + } + + private String startListen(String port) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector("com.sun.jdi.SocketListen"); + + connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("port") && port != null) + arg.setValue(port); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + + try { + return connector.startListening(connArgs); + } catch (IOException e) { + throw new Error("TEST: Unable to start listening to the debugee VM: " + + e.getMessage()); + } catch (IllegalConnectorArgumentsException e) { + throw new Error("TEST: Illegal connector arguments: " + + e.getMessage()); + } catch (Exception e) { + throw new Error("TEST: Internal error: " + e.getMessage()); + } + } + + private boolean stopListen() { + try { + connector.stopListening(connArgs); + } catch (IOException e) { + log.complain("TEST: Unable to stop listening to the debugee VM: " + + e.getMessage()); + return false; + } catch (IllegalConnectorArgumentsException e) { + log.complain("TEST: Illegal connector arguments: " + + e.getMessage()); + return false; + } catch (Exception e) { + log.complain("TEST: Internal error: " + e.getMessage()); + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001/TestDescription.java new file mode 100644 index 00000000000..8a3c75b2116 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001/TestDescription.java @@ -0,0 +1,52 @@ +/* + * 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/ListeningConnector/listennosuspend/listennosuspend001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exactly as accept001 except using options: + * -agentlib:jdwb + * suspend=n + * COMMENT + * RFE 4920165 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.listennosuspend.listennosuspend001 + * nsk.jdi.ListeningConnector.listennosuspend.listennosuspend001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.listennosuspend.listennosuspend001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001t.java new file mode 100644 index 00000000000..85a025954d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001t.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2007, 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.ListeningConnector.listennosuspend; + +import java.io.IOException; + +public class listennosuspend001t { + public static void main(String args[]) { + try { + Thread.sleep(60000); + } catch (Throwable e) + { + e.printStackTrace(); + System.exit(listennosuspend001.JCK_STATUS_BASE + listennosuspend001.FAILED); + } + System.exit(listennosuspend001.JCK_STATUS_BASE + listennosuspend001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001.java new file mode 100644 index 00000000000..3efc60b46e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001.java @@ -0,0 +1,306 @@ +/* + * 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.ListeningConnector.startListening; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; + +import java.io.*; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test exercises JDI function ListeningConnector.startListening. + * The Socket Listening Connector is using as listening + * connector.
    + * The test cases include: + *

  • checking that listening address returned by + * ListeningConnector.startListening() matches the address + * which was set via connector's arguments; + *
  • checking that address generated by + * ListeningConnector.startListening() is valid i.e. + * debugee VM is accessible via this address. + */ +public class startlis001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String CONNECTOR_NAME = + "com.sun.jdi.SocketListen"; + static final String DEBUGEE_CLASS = + "nsk.jdi.ListeningConnector.startListening.startlis001t"; + + private Log log; + + private VirtualMachine vm; + private ListeningConnector connector; + private Map connArgs; + private PrintStream out; + + IORedirector outRedirector; + IORedirector errRedirector; + + boolean totalRes = true; + + 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 startlis001().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String port; + String addr; + InetAddress inetAddr = null; + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if CONNECTOR_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME)) + return PASSED; + this.out = out; + log = new Log(out, argHandler); + + long timeout = argHandler.getWaitTime() * 60 * 1000; + +/* Check that listening address returned by ListeningConnector.startListening() + matches the address which was set via connector's arguments */ + try { + inetAddr = InetAddress.getLocalHost(); + } catch (UnknownHostException e) { + log.complain("FAILURE: caught UnknownHostException " + + e.getMessage()); + totalRes = false; + } + String hostname = inetAddr.getHostName(); + String ip = inetAddr.getHostAddress(); + port = argHandler.getTransportPortIfNotDynamic(); + + initConnector(port); + if ((addr = startListen()) == null) { + log.complain("Test case #1 FAILED: unable to start listening"); + totalRes = false; + } + else { + log.display("Test case #1: start listening the address " + addr); + log.display("Expected address: "+ hostname + ":" + port + + "\n\tor "+ ip + ":" + port); + if ( (!addr.startsWith(hostname) && !addr.startsWith(ip)) || + (port != null && !addr.endsWith(port)) ) { + log.complain("Test case #1 FAILED: listening address " + addr + + "\ndoes not match expected address:\n" + + hostname + ":" + port + " or " + + ip + ":" + port); + totalRes = false; + } + if (!stopListen()) { + log.complain("TEST: unable to stop listening #1"); + totalRes = false; + } + else + log.display("Test case #1 PASSED: listening address matches expected address"); + } + +/* Check that an address generated by ListeningConnector.startListening() + is valid i.e. debugee VM is accessible via this address */ + initConnector(null); + if ((addr = startListen()) == null) { + log.complain("Test case #2 FAILED: unable to start listening"); + return FAILED; + } + else + log.display("Test case #2: start listening the address " + addr); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,address=" + + addr + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + Debugee debugee = null; + + log.display("command: " + cmd); + try { + debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + } catch (Exception e) { + stopListen(); + throw new Failure(e); + } + + if ((vm = attachTarget()) == null) { + log.complain("Test case #2 FAILED: unable to attach the debugee VM"); + debugee.close(); + stopListen(); + return FAILED; + } + else + log.display("Test case #2 PASSED: successfully attach the debugee VM"); + + if (!stopListen()) { + log.complain("TEST: unable to stop listening #2"); + debugee.close(); + return FAILED; + } + + debugee.setupVM(vm); + debugee.waitForVMInit(timeout); + + log.display("\nResuming debugee VM"); + debugee.resume(); + + log.display("\nWaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("Debugee VM: exit code=" + code); + + if (totalRes) return PASSED; + else return FAILED; + } + + private VirtualMachine attachTarget() { + try { + return connector.accept(connArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } + } + + private void initConnector(String port) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector(CONNECTOR_NAME); + + connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("port") && port != null) + arg.setValue(port); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + } + + private String startListen() { + try { + return connector.startListening(connArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + return null; + } + } + + private boolean stopListen() { + try { + connector.stopListening(connArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return false; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return false; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001/TestDescription.java new file mode 100644 index 00000000000..6257609a4d0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ListeningConnector/startListening/startlis001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises JDI function ListeningConnector.startListening. + * The Socket Listening Connector is using as listening connector. + * The test cases include: + * - checking that listening address returned by + * ListeningConnector.startListening() matches the address + * which was set via connector's arguments; + * - checking that address generated by + * ListeningConnector.startListening() is valid i.e. + * debugee VM is accessible via this address. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * Test was fixed to provide early redirecting of debugee output. + * See bug: + * 4905551 shmemBase_listen failed: Cannot create a file when that file already exists + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.startListening.startlis001 + * nsk.jdi.ListeningConnector.startListening.startlis001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.startListening.startlis001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001t.java new file mode 100644 index 00000000000..bb8d483ba6d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis001t.java @@ -0,0 +1,30 @@ +/* + * 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.ListeningConnector.startListening; + +public class startlis001t { + public static void main(String args[]) { + System.exit(startlis001.JCK_STATUS_BASE + startlis001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002.java new file mode 100644 index 00000000000..0b3eb3656af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002.java @@ -0,0 +1,289 @@ +/* + * 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.ListeningConnector.startListening; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; +import com.sun.jdi.VirtualMachine; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test exercises JDI function ListeningConnector.startListening. + * The Shared Memory Connector is using as listening + * connector.
    + * The test cases include: + *
  • checking that listening address returned by + * ListeningConnector.startListening() matches the address + * which was set via connector's arguments; + *
  • checking that address generated by + * ListeningConnector.startListening() is valid i.e. + * debugee VM is accessible via this address. + */ +public class startlis002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String DEBUGEE_CLASS = + "nsk.jdi.ListeningConnector.startListening.startlis002t"; + static final String CONNECTOR_NAME = + "com.sun.jdi.SharedMemoryListen"; + + private Log log; + + private VirtualMachine vm; + private ListeningConnector connector; + private Map connArgs; + private PrintStream out; + + IORedirector outRedirector; + IORedirector errRedirector; + + boolean totalRes = true; + + 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 startlis002().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String addr; + ArgumentHandler argHandler = new ArgumentHandler(argv); + String shmemName = argHandler.getTransportSharedName(); + +// pass if CONNECTOR_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME)) + return PASSED; + this.out = out; + log = new Log(out, argHandler); + + long timeout = argHandler.getWaitTime() * 60 * 1000; + +/* Check that listening address returned by ListeningConnector.startListening() + matches the address which was set via connector's arguments */ + initConnector(shmemName); + if ((addr = startListen()) == null) { + log.complain("Test case #1 FAILED: unable to start listening"); + totalRes = false; + } + else { + log.display("Test case #1: start listen the address " + addr); + log.display("Expected address: "+ shmemName); + if (!addr.equals(shmemName)) { + log.complain("Test case #1 FAILED: listening address " + + addr + + "\ndoes not match expected address: " + + shmemName); + totalRes = false; + } + if (!stopListen()) { + log.complain("TEST: unable to stop listening #1"); + totalRes = false; + } + else + log.display("Test case #1 PASSED: listening address matches expected address"); + } + +/* Check that an address generated by ListeningConnector.startListening() + is valid i.e. debugee VM is accessible via this address */ + initConnector(null); + if ((addr = startListen()) == null) { + log.complain("Test case #2 FAILED: unable to start listening"); + return FAILED; + } + else + log.display("Test case #2: start listening the address " + addr); + + String java = argHandler.getLaunchExecPath() + + " " + argHandler.getLaunchOptions(); + + String cmd = java + + " -Xdebug -Xnoagent -Xrunjdwp:transport=dt_shmem,server=n,address=" + + addr + " " + DEBUGEE_CLASS; + + Binder binder = new Binder(argHandler, log); + Debugee debugee = null; + + log.display("command: " + cmd); + try { + debugee = binder.startLocalDebugee(cmd); + debugee.redirectOutput(log); + } catch (Exception e) { + stopListen(); + throw new Failure(e); + } + + if ((vm = attachTarget()) == null) { + log.complain("Test case #2 FAILED: unable to attach the debugee VM"); + debugee.close(); + stopListen(); + return FAILED; + } + else + log.display("Test case #2 PASSED: successfully attach the debugee VM"); + + if (!stopListen()) { + log.complain("TEST: unable to stop listening #2"); + debugee.close(); + return FAILED; + } + + debugee.setupVM(vm); + debugee.waitForVMInit(timeout); + + log.display("\nResuming debugee VM"); + debugee.resume(); + + log.display("\nWaiting for debugee VM exit"); + int code = debugee.waitFor(); + if (code != (JCK_STATUS_BASE+PASSED)) { + log.complain("Debugee VM has crashed: exit code=" + + code); + return FAILED; + } + log.display("Debugee VM: exit code=" + code); + + if (totalRes) return PASSED; + else return FAILED; + } + + private VirtualMachine attachTarget() { + try { + return connector.accept(connArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } + } + + private void initConnector(String name) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector(CONNECTOR_NAME); + + connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("name") && name != null) + arg.setValue(name); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + } + + private String startListen() { + try { + return connector.startListening(connArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + return null; + } + } + + private boolean stopListen() { + try { + connector.stopListening(connArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return false; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return false; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002/TestDescription.java new file mode 100644 index 00000000000..767b44bf92f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ListeningConnector/startListening/startlis002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * The test exercises JDI function ListeningConnector.startListening. + * The Shared Memory Listening Connector is using as listening connector. + * The test cases include: + * - checking that listening address returned by + * ListeningConnector.startListening() matches the address + * which was set via connector's arguments; + * - checking that address generated by + * ListeningConnector.startListening() is valid i.e. + * debugee VM is accessible via this address. + * NOTE: this test is tagged "nonconcurrent" because it uses the default + * "javadebug" shmem file, as do some other tests. + * COMMENTS + * Test updated to support launching debuggee VM from another JDK + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - debuggee wrapper is used to handle VMStartEvent + * - output redirectors are incapsulated in the wrapper + * Test was fixed to provide early redirecting of debugee output. + * See bug: + * 4905551 shmemBase_listen failed: Cannot create a file when that file already exists + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.startListening.startlis002 + * nsk.jdi.ListeningConnector.startListening.startlis002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.startListening.startlis002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002t.java new file mode 100644 index 00000000000..06a6d266c99 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/startListening/startlis002t.java @@ -0,0 +1,30 @@ +/* + * 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.ListeningConnector.startListening; + +public class startlis002t { + public static void main(String args[]) { + System.exit(startlis002.JCK_STATUS_BASE + startlis002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001.java new file mode 100644 index 00000000000..340c70a2ad1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001.java @@ -0,0 +1,219 @@ +/* + * 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.ListeningConnector.stopListening; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test exercises JDI function ListeningConnector.stopListening. + * The Socket Connector is using as listening + * connector.
    + * The test cases include: + *
  • checking that ListeningConnector.stopListening throws + * an Exception if it has been invoked with argument map different from + * the one given for a previous ListeningConnector.startListening() + * invocation; + *
  • checking that listening can be successfully stopped if given + * argument map is the same with the one given for the previous + * ListeningConnector.startListening() invocation. + */ +public class stoplis001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String CONNECTOR_NAME = + "com.sun.jdi.SocketListen"; + + private Log log; + + private ListeningConnector connector; + private PrintStream out; + + boolean totalRes = true; + + 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 stoplis001().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String addr; + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if CONNECTOR_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME)) + return PASSED; + this.out = out; + log = new Log(out, argHandler); + + Map cArgs1 = initConnector(argHandler.getTransportPort()); + Map cArgs2 = initConnector(null); + if ((addr = startListen(cArgs2)) == null) { + log.complain("FAILURE: unable to start listening the address " + + addr); + return FAILED; + } + else + log.display("TEST: start listening the address " + addr); + +/* Check that an Exception is thrown if ListeningConnector.stopListening + has been invoked with argument map different from the one given for + a previous ListeningConnector.startListening() invocation */ + if (!stopListen(cArgs1, true)) + log.display("Test case #1 PASSED: unable to stop listening"); + else { + log.complain("Test case #1 FAILED: listening is successfully stopped without starting listening"); + totalRes = false; + } + +/* Check that listening can be successfully stopped if given argument map + is the same with the one given for ListeningConnector.startListening() */ + if (!stopListen(cArgs2, false)) { + log.complain("Test case #2 FAILED: unable to stop listening"); + return FAILED; + } + else + log.display("Test case #2 PASSED: listening is successfully stopped"); + + if (totalRes) return PASSED; + else return FAILED; + } + + private Map initConnector(String port) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector(CONNECTOR_NAME); + Map connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("port") && port != null) + arg.setValue(port); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + + return connArgs; + } + + private String startListen(Map cArgs) { + try { + return connector.startListening(cArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + return null; + } + } + + private boolean stopListen(Map cArgs, boolean negative) { + try { + connector.stopListening(cArgs); + } catch (IOException e) { + if (negative) + log.display("stopListen: caught IOException: " + + e.getMessage()); + else { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + } + return false; + } catch (IllegalConnectorArgumentsException e) { + if (negative) + log.display("stopListen: caught IllegalConnectorArgumentsException: " + + e.getMessage()); + else { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + } + return false; + } catch (Exception e) { + if (negative) + log.display("stopListen: caught Exception: " + + e.getMessage()); + else { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + } + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TestDescription.java new file mode 100644 index 00000000000..568e3e82633 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ListeningConnector/stopListening/stoplis001. + * VM Testbase keywords: [quick, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * The test exercises JDI function ListeningConnector.stopListening. + * The Socket Connector is using as listening connector. + * The test cases include: + * - checking that ListeningConnector.stopListening throws + * an Exception if it has been invoked with argument map different + * from the one given for a previous ListeningConnector.startListening() + * invocation; + * - checking that listening can be successfully stopped if given + * argument map is the same with the one given for the previous + * ListeningConnector.startListening() invocation. + * + * NOTE: this test is tagged "nonconcurrent" because it uses the default + * "javadebug" shmem file, as do some other tests. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.stopListening.stoplis001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.stopListening.stoplis001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002.java new file mode 100644 index 00000000000..68aa0ba92dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002.java @@ -0,0 +1,219 @@ +/* + * 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.ListeningConnector.stopListening; + +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.*; + +import java.io.*; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test exercises JDI function ListeningConnector.stopListening. + * The Shared Memory Connector is using as listening + * connector.
    + * The test cases include: + *
  • checking that ListeningConnector.stopListening throws + * an Exception if it has been invoked with argument map different from + * the one given for a previous ListeningConnector.startListening() + * invocation; + *
  • checking that listening can be successfully stopped if given + * argument map is the same with the one given for the previous + * ListeningConnector.startListening() invocation. + */ +public class stoplis002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String CONNECTOR_NAME = + "com.sun.jdi.SharedMemoryListen"; + + private Log log; + + private ListeningConnector connector; + private PrintStream out; + + boolean totalRes = true; + + 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 stoplis002().runIt(argv, out); + } + + private int runIt(String argv[], PrintStream out) { + String addr; + ArgumentHandler argHandler = new ArgumentHandler(argv); + +// pass if CONNECTOR_NAME is not implemented +// on this platform + if (argHandler.shouldPass(CONNECTOR_NAME)) + return PASSED; + this.out = out; + log = new Log(out, argHandler); + + Map cArgs1 = initConnector(argHandler.getTransportSharedName()); + Map cArgs2 = initConnector(null); + if ((addr = startListen(cArgs2)) == null) { + log.complain("FAILURE: unable to start listening the address " + + addr); + return FAILED; + } + else + log.display("TEST: start listening the address " + addr); + +/* Check that an Exception is thrown if ListeningConnector.stopListening + has been invoked with argument map different from the one given for + a previous ListeningConnector.startListening() invocation */ + if (!stopListen(cArgs1, true)) + log.display("Test case #1 PASSED: unable to stop listening"); + else { + log.complain("Test case #1 FAILED: listening is successfully stopped without starting listening"); + totalRes = false; + } + +/* Check that listening can be successfully stopped if given argument map + is the same with the one given for ListeningConnector.startListening() */ + if (!stopListen(cArgs2, false)) { + log.complain("Test case #2 FAILED: unable to stop listening"); + return FAILED; + } + else + log.display("Test case #2 PASSED: listening is successfully stopped"); + + if (totalRes) return PASSED; + else return FAILED; + } + + private Map initConnector(String name) { + Connector.Argument arg; + + connector = (ListeningConnector) + findConnector(CONNECTOR_NAME); + Map connArgs = connector.defaultArguments(); + Iterator cArgsValIter = connArgs.keySet().iterator(); + while (cArgsValIter.hasNext()) { + String argKey = (String) cArgsValIter.next(); + String argVal = null; + + if ((arg = (Connector.Argument) connArgs.get(argKey)) == null) { + log.complain("Argument " + argKey.toString() + + "is not defined for the connector: " + + connector.name()); + } + if (arg.name().equals("name") && name != null) + arg.setValue(name); + + log.display("\targument name=" + arg.name()); + if ((argVal = arg.value()) != null) + log.display("\t\tvalue=" + argVal); + else log.display("\t\tvalue=NULL"); + } + + return connArgs; + } + + private String startListen(Map cArgs) { + try { + return connector.startListening(cArgs); + } catch (IOException e) { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (IllegalConnectorArgumentsException e) { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + return null; + } catch (Exception e) { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + return null; + } + } + + private boolean stopListen(Map cArgs, boolean negative) { + try { + connector.stopListening(cArgs); + } catch (IOException e) { + if (negative) + log.display("stopListen: caught IOException: " + + e.getMessage()); + else { + log.complain("FAILURE: caught IOException: " + + e.getMessage()); + e.printStackTrace(out); + } + return false; + } catch (IllegalConnectorArgumentsException e) { + if (negative) + log.display("stopListen: caught IllegalConnectorArgumentsException: " + + e.getMessage()); + else { + log.complain("FAILURE: Illegal connector arguments: " + + e.getMessage()); + e.printStackTrace(out); + } + return false; + } catch (Exception e) { + if (negative) + log.display("stopListen: caught Exception: " + + e.getMessage()); + else { + log.complain("FAILURE: Exception: " + e.getMessage()); + e.printStackTrace(out); + } + return false; + } + + return true; + } + + private Connector findConnector(String connectorName) { + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + Iterator iter = connectors.iterator(); + + while (iter.hasNext()) { + Connector connector = (Connector) iter.next(); + if (connector.name().equals(connectorName)) { + log.display("Connector name=" + connector.name() + + "\n\tdescription=" + connector.description() + + "\n\ttransport=" + connector.transport().name()); + return connector; + } + } + throw new Error("No appropriate connector"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002/TestDescription.java new file mode 100644 index 00000000000..eb2dc321764 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis002/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ListeningConnector/stopListening/stoplis002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * The test exercises JDI function ListeningConnector.stopListening. + * The Shared Memory Connector is using as listening connector. + * The test cases include: + * - checking that ListeningConnector.stopListening throws + * an Exception if it has been invoked with argument map different + * from the one given for a previous ListeningConnector.startListening() + * invocation; + * - checking that listening can be successfully stopped if given + * argument map is the same with the one given for the previous + * ListeningConnector.startListening() invocation. + * + * NOTE: this test is tagged "nonconcurrent" because it uses the default + * "javadebug" shmem file, as do some other tests. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ListeningConnector.stopListening.stoplis002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.stopListening.stoplis002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001.java new file mode 100644 index 00000000000..2f668865620 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001.java @@ -0,0 +1,96 @@ +/* + * 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.ListeningConnector.supportsMultipleConnections; + +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.ListeningConnector; + + +/** + * The test for the implementation of an object of the type
    + * ListeningConnector.
    + *
    + * The test checks up that the method
    + * com.sun.jdi.connect.ListeningConnector.supportMultipleConnections()
    + * complies with its specification.
    + *
    + * In case of VMM doesn't have ListeningConnector
    + * supporting multiple connections,
    + * the test prints warning message.
    + * The test is always passed and produces
    + * the return value 95.
    + */ + +// +public class supportsmultipleconnections001 { + + 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 = 1; + int exitCode0 = 0; +// + String sErr1 = "WARNING\n" + + "Method tested: " + + "jdi.ListeningConnector.supportsMultipleConnections()\n" + + "no ListeningConnector supporting multiconnections\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); + + for ( ; ; ) { + try { + ListeningConnector connector = + (ListeningConnector) connectorsListIterator.next(); + if (connector.supportsMultipleConnections()) { + exitCode = exitCode0; + } + } catch ( ClassCastException e) { + } catch ( NoSuchElementException e) { + break ; + } + } + + if (exitCode != exitCode0) { + out.println(sErr1); + } + return exitCode0; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001/TestDescription.java new file mode 100644 index 00000000000..7a29380ff07 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001/TestDescription.java @@ -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/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ListeningConnector.Argument + * The test checks whether VMM has ListeningConnector supporting + * multiple connections. + * If no such ListeningConnector, 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.ListeningConnector.supportsMultipleConnections.supportsmultipleconnections001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ListeningConnector.supportsMultipleConnections.supportsmultipleconnections001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001.java new file mode 100644 index 00000000000..7ab3d6d3b17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001.java @@ -0,0 +1,265 @@ +/* + * 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.LocalVariable.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing two
    + * methods with equal sets of variables and arguments,
    + * a debugger creates following LocalVariable objects:
    + * - two for the same variable in the debuggee;
    + * - for "the same type - different name" variable in
    + * the same method in the debuggee;
    + * - for "same name-type - different methods" variable;
    + *
    + * and applies the method LocalVariable.equals()
    + * to pairs of the above Localvariables to
    + * check up that the method returns the follwing values:
    + * - true if two LocalVariable mirror the same variable
    + * or argument in the same method in the debuggee;
    + * - false otherwise.
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/equals/equals001 ", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.equals.equals001a"; + + String mName = "nsk.jdi.LocalVariable.equals"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".TestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods1 = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod1"); + List methods2 = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod2"); + + Method testMethod1 = (Method) methods1.get(0); + Method testMethod2 = (Method) methods2.get(0); + + String names1[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1", + "class2_1", "iface_1", "cfc_1", "param1" }; + String names2[] = { "bl2", "bt2", "ch2", "db2", + "fl2", "in2", "ln2", "sh2", + "class2_2", "iface_2", "cfc_2", "param2" }; + + int i2; + + for (i2 = 0; i2 < names1.length; i2++) { + + log2("new check: #" + i2); + + List lVars1 = null; + List lVars2 = null; + List lVars3 = null; + List lVars4 = null; + + try { + lVars1 = testMethod1.variablesByName(names1[i2]); + lVars2 = testMethod1.variablesByName(names1[i2]); + lVars3 = testMethod1.variablesByName(names2[i2]); + lVars4 = testMethod2.variablesByName(names1[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod_i.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars1.size() != 1 || lVars2.size() != 1 || + lVars3.size() != 1 || lVars4.size() != 1 ) { + testExitCode = FAILED; + log3("ERROR: lVars-i.size() != 1 for i2= " + i2); + continue; + } + + LocalVariable lVar1 = (LocalVariable) lVars1.get(0); + LocalVariable lVar2 = (LocalVariable) lVars2.get(0); + LocalVariable lVar3 = (LocalVariable) lVars3.get(0); + LocalVariable lVar4 = (LocalVariable) lVars4.get(0); + + + if (!lVar1.equals(lVar2)) { + testExitCode = FAILED; + log3("ERROR: !lVar1.equals(lvar2) for check# " + i2); + } + if (lVar1.equals(lVar3)) { + testExitCode = FAILED; + log3("ERROR: lVar1.equals(lvar3) for check# " + i2); + } + if (lVar1.equals(lVar4)) { + testExitCode = FAILED; + log3("ERROR: lVar1.equals(lvar4) for check# " + i2); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..69d3cef9ebd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/LocalVariable/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this LocalVariable for equality. + * Returns: true if the Object is a LocalVariable, + * if both LocalVariables are contained in the same method + * (as determined by Method.equals(java.lang.Object)), and if both + * LocalVariables mirror the same declaration within that method. + * Overrides: equals in class java.lang.Object + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.equals.equals001; + * the debuggee program - nsk.jdi.LocalVariable.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.equals.equals001 + * nsk.jdi.LocalVariable.equals.equals001a + * + * @comment make sure equals001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.equals.equals001a + * @compile -g:lines,source,vars ../equals001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001a.java new file mode 100644 index 00000000000..ac42451ae65 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/equals/equals001a.java @@ -0,0 +1,206 @@ +/* + * 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.LocalVariable.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001 JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i" + ";"; + + // tested method name constant + static final String TESTED_METHOD_NAME = "testedMethod"; + + private static Debugee debugee; + private static ReferenceType debugeeClass; + + // list of tested variables names and signatures + static final String varsList[][] = { + + // not generic arguments + {"arg11PrimBoolean", null}, + {"arg12PrimInt", null}, + {"arg13Object", null}, + {"arg14String", null}, + {"arg15PrimArrShort", null}, + {"arg16ObjArrObject", null}, + + // generic arguments + {"arg21GenObject", "TT;"}, + {"arg22GenNumber", "TN;"}, + {"arg23GenObjectArr", "[TT;"}, + {"arg24GenNumberArr", "[TN;"}, + {"arg25GenObjectList", "Ljava/util/List;"}, + {"arg26GenNumberList", "Ljava/util/List;"}, + {"arg27GenObjectDerivedList", "Ljava/util/List<+TT;>;"}, + {"arg28GenNumberDerivedList", "Ljava/util/List<+TN;>;"}, + + // not generic variables + {"var11PrimBoolean", null}, + {"var12PrimInt", null}, + {"var13Object", null}, + {"var14String", null}, + {"var15PrimArrShort", null}, + {"var16ObjArrObject", null}, + + // generic variables + {"var21GenObject", "TT;"}, + {"var22GenNumber", "TN;"}, + {"var23GenObjectArr", "[TT;"}, + {"var24GenNumberArr", "[TN;"}, + {"var25GenObjectList", "Ljava/util/List;"}, + {"var26GenNumberList", "Ljava/util/List;"}, + {"var27GenObjectDerivedList", "Ljava/util/List<+TT;>;"}, + {"var28GenNumberDerivedList", "Ljava/util/List<+TN;>;"}, + + + }; + + static ArgumentHandler argHandler; + static Log log; + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new gensignature001().runThis(argv, out); + } + + private int runThis (String argv[], PrintStream out) { + + int testResult = Consts.TEST_PASSED; + + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, DEBUGEE_CLASS_NAME); + + debugeeClass = debugee.classByName(DEBUGEE_CLASS_NAME); + if ( debugeeClass == null ) { + log.complain("Class '" + DEBUGEE_CLASS_NAME + "' not found."); + testResult = Consts.TEST_FAILED; + } + + + log.display("Checking started."); + do { + ReferenceType testedClass = debugee.classByName(TESTED_CLASS_NAME); + log.display("Found tested class: " + testedClass.name()); + + Method testedMethod = debugee.methodByName(testedClass, TESTED_METHOD_NAME); + log.display("Found tested method: " + testedMethod.name()); + + for (int i = 0; i < varsList.length; i++) { + + List localVars = null; + try { + localVars = testedMethod.variablesByName(varsList[i][0]); + } catch (AbsentInformationException e) { + log.complain("Unexpected AbsentInformationException while calling variablesByName() for " + + varsList[i][0]); + testResult = Consts.TEST_FAILED; + continue; + } + if (localVars.size() != 1) { + log.complain("Not unique local variable '" + varsList[i][0] + "' : " + localVars.size()); + testResult = Consts.TEST_FAILED; + continue; + } + log.display("Found local variable: " + varsList[i][0]); + + LocalVariable var = (LocalVariable)localVars.get(0); + String expSignature = varsList[i][1]; + log.display("Getting generic signature for local variable: " + varsList[i][0]); + + String actSignature = ""; + try { + actSignature = var.genericSignature(); + } catch (Exception e) { + log.complain("Unexpected exception while calling genericSignature() for " + + varsList[i][0] + " : " + e.getMessage()); + e.printStackTrace(out); + testResult = Consts.TEST_FAILED; + continue; + } + + if ((expSignature == null && actSignature != null) || + (expSignature != null && !expSignature.equals(actSignature))) { + log.complain("Unexpected generic signature for local variable '" + varsList[i][0] + "': " + + actSignature + "\n\tExpected generic signature: " + expSignature); + testResult = Consts.TEST_FAILED; + } else { + log.display("\tgot expected generic signature: " + actSignature); + } + } + + } while (false); + log.display("All checking completed."); + + debugee.quit(); + return testResult; + } +} // end of gensignature001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001/TestDescription.java new file mode 100644 index 00000000000..703d8ac6397 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001/TestDescription.java @@ -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/LocalVariable/genericSignature/gensignature001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test for genericSignature() method of LocalVariable + * interface. + * The test checks that names and generic signatures of returned + * arguments and local variables are equal to expected ones. + * Test consists of two compoments: + * debugger application: gensignature001 + * debugged application: gensignature001a + * First, the debugger uses nsk.share support classes to launch + * debuggee and obtain Debugee object that represents debugged + * application. Also communication channel (IOPipe) is established + * between debugger and debuggee to exchange with synchronization + * signals. + * Next, the debugger obtains JDI mirrors for the tested class + * and method from the debuggee. + * Then, the debugger gets a mirror of every known local variable + * of the tested method, including arguments; gets its generic + * signature using genericSignature() call and compares returned + * character string with expected one. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.genericSignature.gensignature001 + * nsk.jdi.LocalVariable.genericSignature.gensignature001a + * + * @comment make sure gensignature001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.genericSignature.gensignature001a + * @compile -g:lines,source,vars ../gensignature001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.genericSignature.gensignature001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001a.java new file mode 100644 index 00000000000..fdf6b97fab3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001a.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2004, 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.LocalVariable.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.util.*; +import java.io.*; + +/** + * This class is used as debugee part of the test. + */ + +public class gensignature001a { + + private static ArgumentHandler argsHandler; + 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 + + public static void main(String args[]) { + gensignature001a _gensignature001a = new gensignature001a(); + System.exit(Consts.JCK_STATUS_BASE + _gensignature001a.runThis(args, System.err)); + } + + public int runThis(String args[], PrintStream out) { + + argsHandler = new ArgumentHandler(args); + log = new Log(out, argsHandler); + pipe = argsHandler.createDebugeeIOPipe(log); + + display("Debugee started!"); + + // ensure tested class loaded + display("Creating object of tested class"); + TestedClass foo = new TestedClass(); + + // send debugger signal READY + display("Sending signal to debugger: " + gensignature001.READY); + pipe.println(gensignature001.READY); + + // wait for signal QUIT from debugeer + display("Wait for '" + gensignature001.QUIT + "' signal from debugger..."); + receiveSignal(gensignature001.QUIT); + + display("Debugee PASSED"); + return Consts.TEST_PASSED; + } + + // tested class + public static class TestedClass { + int foo = 0; + + // tested method + public void testedMethod( + // not generic argumments + boolean arg11PrimBoolean, + int arg12PrimInt, + Object arg13Object, + String arg14String, + short[] arg15PrimArrShort, + Object[] arg16ObjArrObject, + + // generic arguments + T arg21GenObject, + N arg22GenNumber, + T[] arg23GenObjectArr, + N[] arg24GenNumberArr, + List arg25GenObjectList, + List arg26GenNumberList, + List arg27GenObjectDerivedList, + List arg28GenNumberDerivedList + ) { + + // not generic variables + boolean var11PrimBoolean = arg11PrimBoolean; + int var12PrimInt = arg12PrimInt; + Object var13Object = arg13Object; + String var14String = arg14String; + short[] var15PrimArrShort = arg15PrimArrShort; + Object[] var16ObjArrObject = arg16ObjArrObject; + + // generic variables + T var21GenObject = arg21GenObject; + N var22GenNumber = arg22GenNumber; + T[] var23GenObjectArr = arg23GenObjectArr; + N[] var24GenNumberArr = arg24GenNumberArr; + List var25GenObjectList = arg25GenObjectList; + List var26GenNumberList = arg26GenNumberList; + List var27GenObjectDerivedList = arg27GenObjectDerivedList; + List var28GenNumberDerivedList = arg28GenNumberDerivedList; + } + } +} // end of gensignature001a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001.java new file mode 100644 index 00000000000..af651f7010a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001.java @@ -0,0 +1,264 @@ +/* + * 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.LocalVariable.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing two
    + * methods with equal sets of variables and arguments,
    + * a debugger creates following LocalVariable objects:
    + * - two for the same variable in the debuggee;
    + * - for "the same type - different name" variable in
    + * the same method in the debuggee;
    + * - for "same name-type - different methods" variable;
    + *
    + * applies the method LocalVariable.hashCode() and
    + * compares pairs of hashCodes to check up that
    + * - hashCodes are equal if two LocalVariable mirror
    + * the same variable or argument
    + * in the same method in the debuggee;
    + * - hashCodes are not equal otherwise.
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/hashCode/hashcode001 ", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.hashCode.hashcode001a"; + + String mName = "nsk.jdi.LocalVariable.hashCode"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".TestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods1 = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod1"); + List methods2 = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod2"); + + Method testMethod1 = (Method) methods1.get(0); + Method testMethod2 = (Method) methods2.get(0); + + String names1[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1", + "class2_1", "iface_1", "cfc_1", "param1" }; + String names2[] = { "bl2", "bt2", "ch2", "db2", + "fl2", "in2", "ln2", "sh2", + "class2_2", "iface_2", "cfc_2", "param2" }; + + int i2; + + for (i2 = 0; i2 < names1.length; i2++) { + + log2("new check: #" + i2); + + List lVars1 = null; + List lVars2 = null; + List lVars3 = null; + List lVars4 = null; + + try { + lVars1 = testMethod1.variablesByName(names1[i2]); + lVars2 = testMethod1.variablesByName(names1[i2]); + lVars3 = testMethod1.variablesByName(names2[i2]); + lVars4 = testMethod2.variablesByName(names1[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod_i.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars1.size() != 1 || lVars2.size() != 1 || + lVars3.size() != 1 || lVars4.size() != 1 ) { + testExitCode = FAILED; + log3("ERROR: lVars-i.size() != 1 for i2= " + i2); + continue; + } + + LocalVariable lVar1 = (LocalVariable) lVars1.get(0); + LocalVariable lVar2 = (LocalVariable) lVars2.get(0); + LocalVariable lVar3 = (LocalVariable) lVars3.get(0); + LocalVariable lVar4 = (LocalVariable) lVars4.get(0); + + + if (lVar1.hashCode() != lVar2.hashCode()) { + testExitCode = FAILED; + log3("ERROR: lVar1.hashCode() != lVar2.hashCode() for check# " + i2); + } + if (lVar1.hashCode() == lVar3.hashCode()) { + testExitCode = FAILED; + log3("ERROR: lVar1.hashCode() == lVar3.hashCode()) for check# " + i2); + } + if (lVar1.hashCode() == lVar4.hashCode()) { + testExitCode = FAILED; + log3("ERROR: lVar1.hashCode() == lVar4.hashCode() for check# " + i2); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..71a54bafc88 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/LocalVariable/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this LocalVariable. + * Returns: the integer hash code + * Overrides: hashCode in class java.lang.Object + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.hashCode.hashcode001; + * the debuggee program - nsk.jdi.LocalVariable.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.hashCode.hashcode001 + * nsk.jdi.LocalVariable.hashCode.hashcode001a + * + * @comment make sure hashcode001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.hashCode.hashcode001a + * @compile -g:lines,source,vars ../hashcode001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001a.java new file mode 100644 index 00000000000..a7978e73619 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/hashCode/hashcode001a.java @@ -0,0 +1,206 @@ +/* + * 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.LocalVariable.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001 JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.isArgument()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * boolean bl1 = false, bl2 = true;
    + * byte bt1 = 0, bt2 = 1;
    + * char ch1 = 0, ch2 = 1;
    + * double db1 = 0.0d, db2 = 1.0d;
    + * float fl1 = 0.0f, fl2 = 1.0f;
    + * int in1 = 0, in2 = 1;
    + * long ln1 = 0, ln2 = 1;
    + * short sh1 = 0, sh2 = 1;
    + * ClassForCheck_2 class2 = new ClassForCheck_2();
    + * InterfaceForCheck iface = class2;
    + * ClassForCheck cfc[] = { new ClassForCheck(),
    + * new ClassForCheck() };
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.isArgument() applied to each of
    + * method variable returns false for all the tested
    + * local variables and true for the argument "param".
    + *
    + */ + +public class isargument001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/isArgument/isargument001 ", + sHeader2 = "--> isargument001: ", + sHeader3 = "##> isargument001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isargument001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.isArgument.isargument001a"; + + String mName = "nsk.jdi.LocalVariable.isArgument"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("isargument001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".TestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1", + "class2", "iface", "cfc", "param" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + switch (i2) { + + case 0: // BooleanType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'bl1'"); + } + break; + + case 1: // ByteType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'bt1'"); + } + break; + + case 2: // CharType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'ch1'"); + } + break; + + case 3: // DoubleType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'db1'"); + } + break; + + case 4: // FloatType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'fl1'"); + } + break; + + case 5: // IntegerType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'in1'"); + } + break; + + case 6: // LongType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'ln1'"); + } + break; + + case 7: // ShortType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'sh1'"); + } + break; + + + case 8: // ClassType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'class2'"); + } + break; + + case 9: // InterfaceType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'iface'"); + } + break; + + case 10: // ArrayType + if (lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: lVar.isArgument for 'cfc'"); + } + break; + + + case 11: // argument + if (!lVar.isArgument()) { + testExitCode = FAILED; + log3("ERROR: !lVar.isArgument for 'param'"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isArgument/isargument001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isArgument/isargument001/TestDescription.java new file mode 100644 index 00000000000..c75177e470c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isArgument/isargument001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/LocalVariable/isArgument/isargument001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.isArgument() + * complies with its spec: + * public boolean isArgument() + * Determines if this variable is an argument to its method. + * Returns: true if this variable is argument; false otherwise. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.isArgument.isargument001; + * the debuggee program - nsk.jdi.LocalVariable.isArgument.isargument001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.isArgument.isargument001 + * nsk.jdi.LocalVariable.isArgument.isargument001a + * + * @comment make sure isargument001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.isArgument.isargument001a + * @compile -g:lines,source,vars ../isargument001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.isArgument.isargument001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isArgument/isargument001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isArgument/isargument001a.java new file mode 100644 index 00000000000..62cc1f2356a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isArgument/isargument001a.java @@ -0,0 +1,188 @@ +/* + * 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.LocalVariable.isArgument; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isargument001 JDI test. + */ + +public class isargument001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> isargument001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> isargument001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.isVisible()
    + * complies with its spec in case when a tested program
    + * is prepared with full information,
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, instructs the debuggee to leave synchronized
    + * block, and after getting the thread2 suspended at breakpoint,
    + * StackFrame.variablesByName() is used to form LocalVariable
    + * objects for the following method variables:
    + * - visible i0 and invisible i2 within the method run
    + * whose StackFrame # = 1;
    + * - visible i2 and invisible i3 within the method runt
    + * whose StackFrame # = 0.
    + * Then a debugger checks up whether the LocalVariable objects
    + * are visible or not for corresponding StackFrames.
    + *
    + */ + +public class isvisible001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/isVisible/isvisible001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isvisible001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.isVisible.isvisible001a"; + + private String testedClassName = + "nsk.jdi.LocalVariable.isVisible.Threadisvisible001a"; + + String mName = "nsk.jdi.LocalVariable.isVisible"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "Thread2"; + + String breakpointMethod1 = "runt1"; + String bpLine1 = "breakpointLineNumber1"; + + BreakpointRequest breakpRequest1 = null; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + StackFrame stackFrame = null; + StackFrame stackFrame1 = null; + + List methods = null; + + Method runmethod = null; + Method runt1method = null; + + List lVars = null; + + LocalVariable l_i0 = null; + LocalVariable l_i1 = null; + LocalVariable l_i2 = null; + LocalVariable l_i3 = null; + + int expresult = returnCode0; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting a breakpoint event"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + stackFrame1 = thread2.frame(1); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + } + + label2: { + + if (expresult != returnCode0) + break label2; + + methods = ((ReferenceType) classes.get(0)).methodsByName("run"); + runmethod = (Method) methods.get(0); + + methods = ((ReferenceType) classes.get(0)).methodsByName("runt1"); + runt1method = (Method) methods.get(0); + + try { + log2(" lVars = runmethod.variablesByName('i0');"); + lVars = runmethod.variablesByName("i0"); + if (lVars.size() != 1) { + log3("ERROR: lVars.size() != 1"); + expresult = returnCode1; + } + l_i0 = (LocalVariable) lVars.get(0); + + log2(" lVars = runmethod.variablesByName('i1');"); + lVars = runmethod.variablesByName("i1"); + if (lVars.size() != 1) { + log3("ERROR: lVars.size() != 1"); + expresult = returnCode1; + } + l_i1 = (LocalVariable) lVars.get(0); + + log2(" lVars = runmethod.variablesByName('i2');"); + lVars = runt1method.variablesByName("i2"); + if (lVars.size() != 1) { + log3("ERROR: lVars.size() != 1"); + expresult = returnCode1; + } + l_i2 = (LocalVariable) lVars.get(0); + + log2(" lVars = runmethod.variablesByName('i3');"); + lVars = runt1method.variablesByName("i3"); + if (lVars.size() != 1) { + log3("ERROR: lVars.size() != 1"); + expresult = returnCode1; + } + l_i3 = (LocalVariable) lVars.get(0); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException"); + expresult = returnCode1; + } + if (expresult != returnCode0) + break label2; + + + log2(" checkin up: l_i0.isVisible(stackFrame1); expected: true"); + try { + if (!l_i0.isVisible(stackFrame1)) { + log3("ERROR: !l_i0.isVisible(stackFrame1)"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException"); + expresult = returnCode1; + } + + log2(" checkin up: l_i1.isVisible(stackFrame1); expected: false"); + try { + if (l_i1.isVisible(stackFrame1)) { + log3("ERROR: l_i1.isVisible(stackFrame1)"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException"); + expresult = returnCode1; + } + + log2(" checkin up: l_i2.isVisible(stackFrame1); expected: IllegalArgumentException"); + try { + if (l_i2.isVisible(stackFrame1)) { + log3("ERROR: no IllegalArgumentException"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log2(" : IllegalArgumentException"); + } + + log2(" checkin up: l_i3.isVisible(stackFrame1); expected: IllegalArgumentException"); + try { + if (l_i3.isVisible(stackFrame1)) { + log3("ERROR: no IllegalArgumentException"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log2(" : IllegalArgumentException"); + } + + log2(" checkin up: l_i1.isVisible(stackFrame); expected: IllegalArgumentException"); + try { + if (l_i1.isVisible(stackFrame)) { + log3("ERROR: no IllegalArgumentException"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log2(" : IllegalArgumentException"); + } + + log2(" checkin up: l_i2.isVisible(stackFrame); expected: true"); + try { + if (!l_i2.isVisible(stackFrame)) { + log3("ERROR: !l_i2.isVisible(stackFrame)"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException for i2 in stackFrame"); + expresult = returnCode1; + } + log2(" checkin up: l_i3.isVisible(stackFrame); expected: false"); + try { + if (l_i3.isVisible(stackFrame)) { + log3("ERROR: l_i3.isVisible(stackFrame)"); + expresult = returnCode1; + } + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException for i3 in stackFrame");; + expresult = returnCode1; + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001/TestDescription.java new file mode 100644 index 00000000000..ab2189a5f3c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/LocalVariable/isVisible/isvisible001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.isVisible() + * complies with its spec: + * public boolean isVisible(StackFrame frame) + * Determines whether this variable can be accessed from the given StackFrame. + * See StackFrame.visibleVariables() for + * a complete description variable visibility in this interface. + * Parameters: frame - the StackFrame querying visibility + * Returns: true if this variable is visible; false otherwise. + * Throws: java.lang.IllegalArgumentException - + * if the stack frame's method does not match this variable's method. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.isVisible.isvisible001; + * the debuggee program - nsk.jdi.LocalVariable.isVisible.isvisible001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.isVisible.isvisible001 + * nsk.jdi.LocalVariable.isVisible.isvisible001a + * + * @comment make sure isvisible001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.isVisible.isvisible001a + * @compile -g:lines,source,vars ../isvisible001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.isVisible.isvisible001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001a.java new file mode 100644 index 00000000000..72253f9d39d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001a.java @@ -0,0 +1,197 @@ +/* + * 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.LocalVariable.isVisible; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isvisible001 JDI test. + */ + +public class isvisible001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.name()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * boolean bl1 = false, bl2 = true;
    + * byte bt1 = 0, bt2 = 1;
    + * char ch1 = 0, ch2 = 1;
    + * double db1 = 0.0d, db2 = 1.0d;
    + * float fl1 = 0.0f, fl2 = 1.0f;
    + * int in1 = 0, in2 = 1;
    + * long ln1 = 0, ln2 = 1;
    + * short sh1 = 0, sh2 = 1;
    + * ClassForCheck_2 class2 = new ClassForCheck_2();
    + * InterfaceForCheck iface = class2;
    + * ClassForCheck cfc[] = { new ClassForCheck(),
    + * new ClassForCheck() };
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.name() applied to each of
    + * method variable returns its name.
    + *
    + */ + +public class name001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/name/name001 ", + sHeader2 = "--> name001: ", + sHeader3 = "##> name001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.name.name001a"; + + String mName = "nsk.jdi.LocalVariable.name"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("name001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".TestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1", + "class2", "iface", "cfc" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + String lVarName = lVar.name(); + + switch (i2) { + + case 0: // BooleanType + if (!lVarName.equals("bl1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('bl1')"); + } + + break; + + case 1: // ByteType + + if (!lVarName.equals("bt1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('bt1')"); + } + break; + + case 2: // CharType + if (!lVarName.equals("ch1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('ch1')"); + } + break; + + case 3: // DoubleType + if (!lVarName.equals("db1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('db1')"); + } + break; + + case 4: // FloatType + if (!lVarName.equals("fl1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('fl1')"); + } + break; + + case 5: // IntegerType + if (!lVarName.equals("in1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('in1')"); + } + break; + + case 6: // LongType + if (!lVarName.equals("ln1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('ln1')"); + } + break; + + case 7: // ShortType + if (!lVarName.equals("sh1")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('sh1')"); + } + break; + + + case 8: // ClassType + if (!lVarName.equals("class2")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('class2')"); + } + break; + + case 9: // InterfaceType + if (!lVarName.equals("iface")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('iface')"); + } + break; + + case 10: // ArrayType + if (!lVarName.equals("cfc")) { + testExitCode = FAILED; + log3("ERROR: !lVarName.equals('cfc')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/name/name001/TestDescription.java new file mode 100644 index 00000000000..f7dbe7d9834 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/name/name001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/LocalVariable/name/name001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.name() + * complies with its spec: + * public java.lang.String name() + * Gets the name of the local variable. + * Returns: a string containing the name. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.name.name001; + * the debuggee program - nsk.jdi.LocalVariable.name.name001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.name.name001 + * nsk.jdi.LocalVariable.name.name001a + * + * @comment make sure name001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.name.name001a + * @compile -g:lines,source,vars ../name001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/name/name001a.java new file mode 100644 index 00000000000..ad73c392175 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/name/name001a.java @@ -0,0 +1,187 @@ +/* + * 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.LocalVariable.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name001 JDI test. + */ + +public class name001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> name001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> name001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.signature()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * boolean bl1 = false, bl2 = true;
    + * byte bt1 = 0, bt2 = 1;
    + * char ch1 = 0, ch2 = 1;
    + * double db1 = 0.0d, db2 = 1.0d;
    + * float fl1 = 0.0f, fl2 = 1.0f;
    + * int in1 = 0, in2 = 1;
    + * long ln1 = 0, ln2 = 1;
    + * short sh1 = 0, sh2 = 1;
    + * ClassForCheck_2 class2 = new ClassForCheck_2();
    + * InterfaceForCheck iface = class2;
    + * ClassForCheck cfc[] = { new ClassForCheck(),
    + * new ClassForCheck() };
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.signature() applied to each of
    + * method variable returns its JNI-style signature.
    + *
    + */ + +public class signature001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/signature/signature001 ", + sHeader2 = "--> signature001: ", + sHeader3 = "##> signature001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new signature001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.signature.signature001a"; + + String mName = "nsk.jdi.LocalVariable.signature"; + + String mSignature = "nsk/jdi/LocalVariable/signature"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("signature001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".TestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1", + "class2", "iface", "cfc" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + String lVarSignature = lVar.signature(); + + switch (i2) { + + case 0: // BooleanType + if (!lVarSignature.equals("Z")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('Z')"); + } + break; + + case 1: // ByteType + + if (!lVarSignature.equals("B")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('B')"); + } + break; + + case 2: // CharType + if (!lVarSignature.equals("C")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('C')"); + } + break; + + case 3: // DoubleType + if (!lVarSignature.equals("D")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('D')"); + } + break; + + case 4: // FloatType + if (!lVarSignature.equals("F")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('F')"); + } + break; + + case 5: // IntegerType + if (!lVarSignature.equals("I")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('I')"); + } + break; + + case 6: // LongType + if (!lVarSignature.equals("J")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('J')"); + } + break; + + case 7: // ShortType + if (!lVarSignature.equals("S")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals('S')"); + } + break; + + + case 8: // ClassType + if (!lVarSignature.equals("L" + mSignature + "/ClassForCheck_2;")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals() : " + lVarSignature); + } + break; + + case 9: // InterfaceType + if (!lVarSignature.equals("L" + mSignature + "/InterfaceForCheck;")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals() : " + lVarSignature); + } + break; + + case 10: // ArrayType + if (!lVarSignature.equals("[L" + mSignature + "/ClassForCheck;")) { + testExitCode = FAILED; + log3("ERROR: !lVarSignature.equals() : " + lVarSignature); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001/TestDescription.java new file mode 100644 index 00000000000..0a236ed5651 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/LocalVariable/signature/signature001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.signature() + * complies with its spec: + * public java.lang.String signature() + * Gets the JNI signature of the local variable. + * Returns: a string containing the signature. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.signature.signature001; + * the debuggee program - nsk.jdi.LocalVariable.signature.signature001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.signature.signature001 + * nsk.jdi.LocalVariable.signature.signature001a + * + * @comment make sure signature001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.signature.signature001a + * @compile -g:lines,source,vars ../signature001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.signature.signature001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001a.java new file mode 100644 index 00000000000..837976672b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001a.java @@ -0,0 +1,188 @@ +/* + * 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.LocalVariable.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the signature001 JDI test. + */ + +public class signature001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> signature001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> signature001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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() { + + // Finding of debuggee's main method + Method mainMethod = methodByName(debuggeeClass, "main"); + + display("Checking toString() method for local variables of debuggee's main method..."); + + // Check all methods from debuggee + for (int i = 0; i < checkedVars.length; i++) { + + LocalVariable localVar = variableByName(mainMethod, checkedVars[i]); + + try { + String str = localVar.toString(); + if (str == null) { + complain("toString() returns null for LocalVariable of debuggee's local variable: " + checkedVars[i]); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for LocalVariable of debuggee's local variable: " + checkedVars[i]); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() returns for debuggee's local variable " + checkedVars[i] + " : " + str); + } + } catch(Exception e) { + complain("Unexpected " + e + " when getting LocalVariable of debuggee's local variable: " + checkedVars[i]); + exitStatus = Consts.TEST_FAILED; + } + + } + + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static Method methodByName(ReferenceType refType, String methodName) { + List methodList = refType.methodsByName(methodName); + if (methodList == null) { + throw new Failure("Can not find method: " + methodName); + } + if (methodList.size() > 1) { + throw new Failure("Found more than one method with name : " + methodName); + } + + Method method = (Method) methodList.get(0); + return method; + } + + private static LocalVariable variableByName(Method method, String varName) { + List varList = null; + try { + varList = method.variablesByName(varName); + } catch (AbsentInformationException e) { + throw new Failure("Unexpected AbsentInformationException while getting variable: " + varName); + } + if (varList == null) { + throw new Failure("Can not find variable: " + varName); + } + if (varList.size() > 1) { + throw new Failure("Found more than one variable with name : " + varName); + } + + LocalVariable var = (LocalVariable) varList.get(0); + return var; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..56c86ce8676 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/toString/tostring001/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/LocalVariable/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.LocalVariable interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * a LocalVariable object of a debuggee's local variable. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for LocalVariable + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.toString.tostring001 + * nsk.jdi.LocalVariable.toString.tostring001a + * + * @comment make sure tostring001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.toString.tostring001a + * @compile -g:lines,source,vars ../tostring001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/toString/tostring001a.java new file mode 100644 index 00000000000..a551705a311 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/toString/tostring001a.java @@ -0,0 +1,115 @@ +/* + * 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.LocalVariable.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ 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); + + // Tested local variables -------------------- + boolean z0 = true, z1[] = {z0}, z2[][] = {z1}; + byte b0 = (byte)-1, b1[] = {b0}, b2[][] = {b1}; + char c0 = '\n', c1[] = {c0}, c2[][] = {c1}; + double d0 = (double)-1, d1[] = {d0}, d2[][] = {d1}; + float f0 = (float)-1, f1[] = {f0}, f2[][] = {f1}; + int i0 = -1, i1[] = {i0}, i2[][] = {i1}; + long l0 = (long)-1, l1[] = {l0}, l2[][] = {l1}; + short r0 = (short)-1, r1[] = {r0}, r2[][] = {r1}; + + Boolean Z0 = new Boolean(false), Z1[] = {Z0}, Z2[][] = {Z1}; + Byte B0 = new Byte((byte)1), B1[] = {B0}, B2[][] = {B1}; + Character C0 = new Character('z'), C1[] = {C0}, C2[][] = {C1}; + Double D0 = new Double((double)1), D1[] = {D0}, D2[][] = {D1}; + Float F0 = new Float((float)1), F1[] = {F0}, F2[][] = {F1}; + Integer I0 = new Integer(1), I1[] = {I0}, I2[][] = {I1}; + Long L0 = new Long((long)1), L1[] = {L0}, L2[][] = {L1}; + Short R0 = new Short((short)1), R1[] = {R0}, R2[][] = {R1}; + + String s0 = "string", s1[] = {s0}, s2[][] = {s1}; + Object o0 = new Object(), o1[] = {o0}, o2[][] = {o1}; + tostring001aP p0 = new tostring001aP(), p1[] = {p0}, p2[][] = {p1}; + tostring001aM m0 = new tostring001aP(), m1[] = {m0}, m2[][] = {m1}; + //-------------------------------------------- + + try { + pipe.println(tostring001.SIGNAL_READY); + + receiveSignal(tostring001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods +} + +//--------------------------------------------------------- test specific classes +class tostring001aP implements tostring001aM {} +interface tostring001aM {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001.java new file mode 100644 index 00000000000..5f215bcbf21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001.java @@ -0,0 +1,333 @@ +/* + * 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.LocalVariable.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.type()
    + * complies with its spec when LocalVariable is one of
    + * primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * boolean bl1 = false, bl2 = true;
    + * byte bt1 = 0, bt2 = 1;
    + * char ch1 = 0, ch2 = 1;
    + * double db1 = 0.0d, db2 = 1.0d;
    + * float fl1 = 0.0f, fl2 = 1.0f;
    + * int in1 = 0, in2 = 1;
    + * long ln1 = 0, ln2 = 1;
    + * short sh1 = 0, sh2 = 1;
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.type() applied to each of primitive
    + * type method variable returns a Type object casted to
    + * a corresponding primitive type.
    + *
    + */ + +public class type001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/type/type001 ", + sHeader2 = "--> type001: ", + sHeader3 = "##> type001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new type001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.type.type001a"; + + String mName = "nsk.jdi.LocalVariable.type"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("type001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".type001aTestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + Type lVarType = null; + try { + lVarType = lVar.type(); + } catch ( ClassNotLoadedException e) { + log3("ERROR : ClassNotLoadedExc for lVarType = lVar.type();"); + testExitCode = FAILED; + continue; + } + + switch (i2) { + + case 0: // BooleanType + try { + BooleanType bl = (BooleanType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: BooleanType blt = (BooleanType) lVarType;"); + } + + break; + + case 1: // ByteType + + try { + ByteType bt = (ByteType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ByteType bt = (ByteType) lVarType;"); + } + break; + + case 2: // CharType + try { + CharType ch = (CharType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: CharType ch = (CharType) lVarType;"); + } + break; + + case 3: // DoubleType + try { + DoubleType db = (DoubleType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: DoubleType db = (DoubleType) lVarType;"); + } + break; + + case 4: // FloatType + try { + FloatType fl = (FloatType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: FloatType fl = (FloatType) lVarType;"); + } + break; + + case 5: // IntegerType + try { + IntegerType in = (IntegerType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: IntegerType in = (IntegerType) lVarType;"); + } + break; + + case 6: // LongType + try { + LongType ln = (LongType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: LongType ln = (LongType) lVarType;"); + } + break; + + case 7: // ShortType + try { + ShortType sh = (ShortType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ShortType sh = (ShortType) lVarType;"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001/TestDescription.java new file mode 100644 index 00000000000..359372ecc81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/LocalVariable/type/type001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.type() + * complies with its spec: + * public Type type() + * throws ClassNotLoadedException + * Returns the type of the this LocalVariable. + * For primitive variables, an appropriate PrimitiveType is always returned. + * For object variables, the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's class loader. + * Returns: the Type of this local variable. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when the type is one of primitive types and + * a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.type.type001; + * the debuggee program - nsk.jdi.LocalVariable.type.type001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.type.type001 + * nsk.jdi.LocalVariable.type.type001a + * + * @comment make sure type001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.type.type001a + * @compile -g:lines,source,vars ../type001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.type.type001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001a.java new file mode 100644 index 00000000000..c4eb836d2c5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type001a.java @@ -0,0 +1,132 @@ +/* + * 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.LocalVariable.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the type001 JDI test. + */ + +public class type001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> type001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> type001a: " + message); + } + + //====================================================== test program + + static type001aTestClass obj = new type001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.type()
    + * complies with its spec when LocalVariable is one of
    + * ReferenceTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * ClassForCheck_2 class2 = new ClassForCheck_2();
    + * InterfaceForCheck iface = class2;
    + * ClassForCheck cfc[] = { new ClassForCheck(),
    + * new ClassForCheck() };
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.type() applied to each of ReferenceType
    + * method variable returns a Type object casted to
    + * a corresponding ReferenceType.
    + *
    + */ + +public class type002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/type/type002 ", + sHeader2 = "--> type002: ", + sHeader3 = "##> type002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new type002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.type.type002a"; + + String mName = "nsk.jdi.LocalVariable.type"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("type002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".type002aTestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "class2", "iface", "cfc" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + Type lVarType = null; + try { + lVarType = lVar.type(); + } catch ( ClassNotLoadedException e) { + log3("ERROR : ClassNotLoadedExc for lVarType = lVar.type();"); + testExitCode = FAILED; + continue; + } + + switch (i2) { + + case 0: // ClassType + try { + ClassType ct = (ClassType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassType ct = (ClassType) lVarType;"); + } + + break; + + case 1: // InterfaceType + + try { + InterfaceType it = (InterfaceType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: InterfaceType it = (InterfaceType) lVarType;"); + } + break; + + case 2: // ArrayType + try { + ArrayType at = (ArrayType) lVarType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ArrayType at = (ArrayType) lVarType;"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type002/TestDescription.java new file mode 100644 index 00000000000..a42450a6b79 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type002/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/LocalVariable/type/type002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.type() + * complies with its spec: + * public Type type() + * throws ClassNotLoadedException + * Returns the type of the this LocalVariable. + * For primitive variables, an appropriate PrimitiveType is always returned. + * For object variables, the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's class loader. + * Returns: the Type of this local variable. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when the type is one of ReferenceTypes and + * a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.typetype002; + * the debuggee program - nsk.jdi.LocalVariable.type.type002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.type.type002 + * nsk.jdi.LocalVariable.type.type002a + * + * @comment make sure type002a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.type.type002a + * @compile -g:lines,source,vars ../type002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.type.type002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type002a.java new file mode 100644 index 00000000000..aea6a4bccca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/type/type002a.java @@ -0,0 +1,174 @@ +/* + * 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.LocalVariable.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the type002 JDI test. + */ + +public class type002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> type002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> type002a: " + message); + } + + //====================================================== test program + + static type002aTestClass obj = new type002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.typeName()
    + * complies with its spec when LocalVariable is one of
    + * primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * boolean bl1 = false, bl2 = true;
    + * byte bt1 = 0, bt2 = 1;
    + * char ch1 = 0, ch2 = 1;
    + * double db1 = 0.0d, db2 = 1.0d;
    + * float fl1 = 0.0f, fl2 = 1.0f;
    + * int in1 = 0, in2 = 1;
    + * long ln1 = 0, ln2 = 1;
    + * short sh1 = 0, sh2 = 1;
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.typeName() applied to each of
    + * primitive type method variable returns a name of
    + * a corresponding primitive type.
    + *
    + */ + +public class typename001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/typeName/typename001 ", + sHeader2 = "--> typename001: ", + sHeader3 = "##> typename001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new typename001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.typeName.typename001a"; + + String mName = "nsk.jdi.LocalVariable.typeName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("typename001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".typename001aTestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + String lVarTypeName = null; + lVarTypeName = lVar.typeName(); + + switch (i2) { + + case 0: // BooleanType + if (!lVarTypeName.equals("boolean")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('boolean')"); + } + + break; + + case 1: // ByteType + + if (!lVarTypeName.equals("byte")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('byte')"); + } + break; + + case 2: // CharType + if (!lVarTypeName.equals("char")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('char')"); + } + break; + + case 3: // DoubleType + if (!lVarTypeName.equals("double")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('double')"); + } + break; + + case 4: // FloatType + if (!lVarTypeName.equals("float")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('float')"); + } + break; + + case 5: // IntegerType + if (!lVarTypeName.equals("int")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('int')"); + } + break; + + case 6: // LongType + if (!lVarTypeName.equals("long")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('long')"); + } + break; + + case 7: // ShortType + if (!lVarTypeName.equals("short")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals('short')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename001/TestDescription.java new file mode 100644 index 00000000000..6bbdeec97b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/LocalVariable/typeName/typename001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.typeName() + * complies with its spec: + * public java.lang.String typeName() + * Returns: a text representation of the declared type of this variable. + * when the declared type is one of primitive types and + * a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.typeName.typename001; + * the debuggee program - nsk.jdi.LocalVariable.typeName.typename001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.typeName.typename001 + * nsk.jdi.LocalVariable.typeName.typename001a + * + * @comment make sure typename001a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.typeName.typename001a + * @compile -g:lines,source,vars ../typename001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.typeName.typename001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename001a.java new file mode 100644 index 00000000000..da4b5d49f64 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename001a.java @@ -0,0 +1,133 @@ +/* + * 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.LocalVariable.typeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the typename001 JDI test. + */ + +public class typename001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> typename001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> typename001a: " + message); + } + + //====================================================== test program + + static typename001aTestClass obj = new typename001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocalVariable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LocalVariable.typeName()
    + * complies with its spec when LocalVariable is one of
    + * ReferenceTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object containing
    + * the following method:
    + * public void testmethod (int param) {
    + * typename002aClassForCheck_2 class2 = new typename002aClassForCheck_2();
    + * typename002atypename002aInterfaceForCheck iface = class2;
    + * typename002aClassForCheck cfc[] = { new typename002aClassForCheck(),
    + * new typename002aClassForCheck() };
    + * return;
    + * }
    + * a debugger checks up that the method
    + * LocalVariable.typeName() applied to each of
    + * ReferenceType method variable returns
    + * a name of a corresponding ReferenecType.
    + *
    + */ + +public class typename002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocalVariable/typeName/typename002 ", + sHeader2 = "--> typename002: ", + sHeader3 = "##> typename002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new typename002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocalVariable.typeName.typename002a"; + + String mName = "nsk.jdi.LocalVariable.typeName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("typename002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".typename002aTestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + List methods = + ((ReferenceType) listOfLoadedClasses.get(0)). + methodsByName("testmethod"); + + Method testMethod = (Method) methods.get(0); + + + String names[] = { "class2", "iface", "cfc" }; + + int i2; + int expresult = 0; + + for (i2 = 0; i2 < names.length; i2++) { + + log2("new check: #" + i2); + + List lVars = null; + try { + lVars = testMethod.variablesByName(names[i2]); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for " + + "lVars = testMethod.variablesByName(names[i2])" ); + testExitCode = FAILED; + continue; + } + if (lVars.size() != 1) { + testExitCode = FAILED; + log3("ERROR: lVars.size() != 1 for i2=" + i2 + " : " + lVars.size()); + continue; + } + + LocalVariable lVar = (LocalVariable) lVars.get(0); + + String lVarTypeName = null; + lVarTypeName = lVar.typeName(); + + switch (i2) { + + case 0: // ClassType + + if (!lVarTypeName.equals(mName + ".typename002aClassForCheck_2")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals(mName + '.typename002aClassForCheck_2') : " + + lVarTypeName); + } + + break; + + case 1: // InterfaceType + + if (!lVarTypeName.equals(mName + ".typename002aInterfaceForCheck")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals(mName + '.typename002aInterfaceForCheck') : " + + lVarTypeName); + } + break; + + case 2: // ArrayType + + if (!lVarTypeName.equals(mName + ".typename002aClassForCheck[]")) { + testExitCode = FAILED; + log3("ERROR: !lVarTypeName.equals(mName + '.typename002aClassForCheck[]') : " + + lVarTypeName); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename002/TestDescription.java new file mode 100644 index 00000000000..5442089ec79 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename002/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/LocalVariable/typeName/typename002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocalVariable. + * The test checks up that a result of the method + * com.sun.jdi.LocalVariable.typeName() + * complies with its spec: + * public java.lang.String typeName() + * Returns: a text representation of the declared type of this variable. + * when the declared type is one of ReferenceTypes and + * a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.LocalVariable.typeName.typename002; + * the debuggee program - nsk.jdi.LocalVariable.typeName.typename002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocalVariable.typeName.typename002 + * nsk.jdi.LocalVariable.typeName.typename002a + * + * @comment make sure typename002a is compiled with full debug info + * @clean nsk.jdi.LocalVariable.typeName.typename002a + * @compile -g:lines,source,vars ../typename002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocalVariable.typeName.typename002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename002a.java new file mode 100644 index 00000000000..dff4bf00c14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/typeName/typename002a.java @@ -0,0 +1,168 @@ +/* + * 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.LocalVariable.typeName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the typename002 JDI test. + */ + +public class typename002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> typename002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> typename002a: " + message); + } + + //====================================================== test program + + static typename002aTestClass obj = new typename002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Locatable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Locatable.location()
    + * complies with its spec when a tested method
    + * is one of PrimitiveTypes, void or native.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class TestClass {
    + * public static boolean bl () { return false; }
    + * public static byte bt () { return 0; }
    + * private static char ch () { return 0; }
    + * protected static double db () { return 0.0d; }
    + * public float fl () { return 0.0f; }
    + * public int in () { return 0; }
    + * private long ln () { return 0; }
    + * protected short sh () { return 0; }
    + * public void vd () { return ; }
    + * }
    + * a debugger checks up that for all of the above methods,
    + * the invocation of the method Locatable.location()
    + * returns non-null values.
    + *
    + */ + +public class location001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Locatable/location/location001 ", + sHeader2 = "--> location001: ", + sHeader3 = "##> location001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Locatable.location.location001a"; + + String mName = "nsk.jdi.Locatable.location"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".location001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + Location mLocation = null; + + String bl = "bl"; + String bt = "bt"; + String ch = "ch"; + String db = "db"; + String fl = "fl"; + String in = "in"; + String ln = "ln"; + String sh = "sh"; + String vd = "vd"; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(bl); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a boolean method"); + expresult = 1; + break; + } + break; + + case 1: // byte method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(bt); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a byte method"); + expresult = 1; + break; + } + break; + + case 2: // char method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(ch); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a char method"); + expresult = 1; + break; + } + break; + + case 3: // double method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(db); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a double method"); + expresult = 1; + break; + } + break; + + case 4: // float method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(fl); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a float method"); + expresult = 1; + break; + } + break; + + case 5: // int method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(in); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for an int method"); + expresult = 1; + break; + } + break; + + case 6: // long method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(ln); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a long method"); + expresult = 1; + break; + } + break; + + case 7: // short method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(sh); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a short method"); + expresult = 1; + break; + } + break; + + case 8: // void method + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(vd); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a void method"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001/TestDescription.java new file mode 100644 index 00000000000..40fe6437b0f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001/TestDescription.java @@ -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/Locatable/location/location001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Locatable. + * The test checks up that a result of the method + * com.sun.jdi.Locatable.location() + * complies with its spec: + * public Location location() + * Returns the Location of this mirror, + * if there is executable Java language code associated with it. + * Returns: the Location of this mirror, or + * null if there is no executable code associated with it. + * For example, abstract and native Methods will return null when + * their location method is called. + * when it is applied to public, private, protected, and static methods + * returning primitive type values, and void methods. + * The test works as follows: + * The debugger program - nsk.jdi.Locatable.location.location001; + * the debuggee program - nsk.jdi.Locatable.location.location001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Locatable.location.location001 + * nsk.jdi.Locatable.location.location001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Locatable.location.location001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001a.java new file mode 100644 index 00000000000..24fb704d5b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001a.java @@ -0,0 +1,130 @@ +/* + * 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.Locatable.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location001 JDI test. + */ + +public class location001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> location001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> location001a: " + message); + } + + //====================================================== test program + + static location001aTestClass obj = new location001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Locatable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Locatable.location()
    + * complies with its spec when a tested method is an abstract.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of TestClass
    + * which contains an instance of class ClassForCheck
    + * implementing, directly and indirectly, two abstract
    + * methods from its super-class and super-interface,
    + * a debugger invokes the method Locatable.location()
    + * with these two abstract methods as arguments and
    + * checks up returned values.
    + *
    + */ + +public class location002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Locatable/location/location002 ", + sHeader2 = "--> location002: ", + sHeader3 = "##> location002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Locatable.location.location002a"; + + String mName = "nsk.jdi.Locatable.location"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = null; + List methods = null; + Method m = null; + Location mLocation = null; + + String testedMethod1 = "abstractMethod1"; + String testedMethod2 = "abstractMethod2"; + + listOfDebuggeeClasses = vm.classesByName(mName + ".location002aInterfaceForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(testedMethod1); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation != null) { + log3("ERROR: mLocation != null for an abstract method in location002aInterfaceForCheck"); + testExitCode = FAILED; + } + + listOfDebuggeeClasses = vm.classesByName(mName + ".location002aClassForCheck2"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(testedMethod2); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation != null) { + log3("ERROR: mLocation != null for an abstract method in location002aClassForCheck2"); + testExitCode = FAILED; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location002/TestDescription.java new file mode 100644 index 00000000000..cfe0c928c94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location002/TestDescription.java @@ -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/Locatable/location/location002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Locatable. + * The test checks up that a result of the method + * com.sun.jdi.Locatable.location() + * complies with its spec: + * public Location location() + * Returns the Location of this mirror, + * if there is executable Java language code associated with it. + * Returns: the Location of this mirror, or + * null if there is no executable code associated with it. + * For example, abstract and native Methods will return null when + * their location method is called. + * in case of the method Locatable.location() is invoked on an abstract method. + * The test works as follows: + * The debugger program - nsk.jdi.Locatable.location.location002; + * the debuggee program - nsk.jdi.Locatable.location.location002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Locatable.location.location002 + * nsk.jdi.Locatable.location.location002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Locatable.location.location002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location002a.java new file mode 100644 index 00000000000..bddfb78bc92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location002a.java @@ -0,0 +1,142 @@ +/* + * 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.Locatable.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location002 JDI test. + */ + +public class location002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> location002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> location002a: " + message); + } + + //====================================================== test program + + static location002aTestClass obj = new location002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Locatable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Locatable.location()
    + * complies with its spec when a tested method
    + * is one of ReferenceTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of the following
    + * class type with methods returning ReferenceType objects:
    + *
    + * class TestClass {
    + * .
    + * .
    + * public ClassForCheck[] arraymethod () {
    + * return cfc;
    + * }
    + * public ClassForCheck classmethod () {
    + * return classFC;
    + * }
    + * public InterfaceForCheck ifacemethod () {
    + * return iface;
    + * }
    + * }
    + * a debugger checks up that for all of the above + * methods returning ReferenceType objects,
    + * the invocation of the method Locatable.location()
    + * returns non-null value.
    + *
    + */ + +public class location003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Locatable/location/location003 ", + sHeader2 = "--> location003: ", + sHeader3 = "##> location003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Locatable.location.location003a"; + + String mName = "nsk.jdi.Locatable.location"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".location003aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + Location mLocation = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // ArrayType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("arraymethod"); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for 'arraymethod'"); + testExitCode = FAILED; + } + break; + + case 1: // ClassType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("classmethod"); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for 'classmethod'"); + testExitCode = FAILED; + } + break; + + case 2: // InterfaceType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ifacemethod"); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for 'ifacemethod'"); + testExitCode = FAILED; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003/TestDescription.java new file mode 100644 index 00000000000..3ad08939522 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003/TestDescription.java @@ -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/Locatable/location/location003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Locatable. + * The test checks up that a result of the method + * com.sun.jdi.Locatable.location() + * complies with its spec: + * public Location location() + * Returns the Location of this mirror, + * if there is executable Java language code associated with it. + * Returns: the Location of this mirror, or + * null if there is no executable code associated with it. + * For example, abstract and native Methods will return null when + * their location method is called. + * when it is applied to methods returning ReferenceType objects. + * The test works as follows: + * The debugger program - nsk.jdi.Locatable.location.location003; + * the debuggee program - nsk.jdi.Locatable.location.location003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Locatable.location.location003 + * nsk.jdi.Locatable.location.location003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Locatable.location.location003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003a.java new file mode 100644 index 00000000000..92e6573baec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003a.java @@ -0,0 +1,181 @@ +/* + * 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.Locatable.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location003 JDI test. + */ + +public class location003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> location003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> location003a: " + message); + } + + //====================================================== test program + + static location003aTestClass obj = new location003aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Locatable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Locatable.location()
    + * complies with its spec when applied to a static method.
    + *
    + * The cases for testing are as follows.
    + * 1) After getting a thread suspended but before to resume it,
    + * StackFrame.location() is invoked and its returned value
    + * must not be null.
    + * Since the thread is not resumed yet,
    + * InvalidStackFrameException must not be throw.
    + * 2) After resuming the thread, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class location004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Locatable/location/location004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Locatable.location.location004a"; + + private String testedClassName = + "nsk.jdi.Locatable.location.Threadlocation004a"; + + String mName = "nsk.jdi.Locatable.location"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "Thread2"; + String breakpointMethod = "runt1"; + String bpLine1 = "breakpointLineNumber1"; + String breakpointMethod1 = "runt1"; + + BreakpointRequest breakpRequest1 = null; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + StackFrame stackFrame = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + + log2(" stackFrame = thread2.frame(0);"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + + Location stackLocation = null; + + log2(" checking up: no InvalidStackFrameException when the thread2 is suspended"); + try { + log2(" before: stackLocation = stackFrame.location();"); + stackLocation = stackFrame.location(); + if (stackLocation == null) { + log3("ERROR: stackLocation == null"); + expresult = returnCode1; + } + } catch ( InvalidStackFrameException e ) { + log2("ERROR: InvalidStackFrameExceprtion"); + } + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult == returnCode1) + break label1; + + log2(" checking up InvalidStackFrameException after resuming the thread2"); + try { + log2(" before: stackLocation = stackFrame.location();"); + stackLocation = stackFrame.location(); + expresult = returnCode1; + log3("ERROR: no InvalidStackFrameExceprtion"); + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameExceprtion"); + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004/TestDescription.java new file mode 100644 index 00000000000..1f966343f70 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004/TestDescription.java @@ -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/Locatable/location/location004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Locatable. + * The test checks up that a result of the method + * com.sun.jdi.Locatable.location() + * complies with its spec: + * public Location location() + * Returns the Location of this mirror, + * if there is executable Java language code associated with it. + * Returns: the Location of this mirror, or + * null if there is no executable code associated with it. + * For example, abstract and native Methods will return null + * when their location method is called. + * when applied to a static method. + * The test works as follows: + * The debugger program - nsk.jdi.Locatable.location.location00; + * the debuggee program - nsk.jdi.Locatable.location.location00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * See: StackFrame.thisObject.thosobject002 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Locatable.location.location004 + * nsk.jdi.Locatable.location.location004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Locatable.location.location004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004a.java new file mode 100644 index 00000000000..69907d62009 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004a.java @@ -0,0 +1,194 @@ +/* + * 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.Locatable.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location004 JDI test. + */ + +public class location004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Locatable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Locatable.location()
    + * complies with its spec when applied to an instance method.
    + *
    + * The cases for testing are as follows.
    + * 1) After getting a thread suspended but before to resume it,
    + * StackFrame.location() is invoked and its returned value
    + * must not be null.
    + * Since the thread is not resumed yet,
    + * InvalidStackFrameException must not be throw.
    + * 2) After resuming the thread, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class location005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Locatable/location/location005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location005().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Locatable.location.location005a"; + + private String testedClassName = + "nsk.jdi.Locatable.location.Threadlocation005a"; + + String mName = "nsk.jdi.Locatable.location"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "Thread2"; + String breakpointMethod = "runt1"; + String bpLine1 = "breakpointLineNumber1"; + String breakpointMethod1 = "runt1"; + + BreakpointRequest breakpRequest1 = null; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + StackFrame stackFrame = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + + log2(" stackFrame = thread2.frame(0);"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + + Location stackLocation = null; + + log2(" checking up: no InvalidStackFrameException when the thread2 is suspended"); + try { + log2(" before: stackLocation = stackFrame.location();"); + stackLocation = stackFrame.location(); + if (stackLocation == null) { + log3("ERROR: stackLocation == null"); + expresult = returnCode1; + } + } catch ( InvalidStackFrameException e ) { + log2("ERROR: InvalidStackFrameExceprtion"); + } + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult == returnCode1) + break label1; + + log2(" checking up InvalidStackFrameException after resuming the thread2"); + try { + log2(" before: stackLocation = stackFrame.location();"); + stackLocation = stackFrame.location(); + expresult = returnCode1; + log3("ERROR: no InvalidStackFrameExceprtion"); + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameExceprtion"); + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005/TestDescription.java new file mode 100644 index 00000000000..adf235f6d14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005/TestDescription.java @@ -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/Locatable/location/location005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Locatable. + * The test checks up that a result of the method + * com.sun.jdi.Locatable.location() + * complies with its spec: + * public Location location() + * Returns the Location of this mirror, + * if there is executable Java language code associated with it. + * Returns: the Location of this mirror, or + * null if there is no executable code associated with it. + * For example, abstract and native Methods will return null + * when their location method is called. + * when applied to an instance method. + * The test works as follows: + * The debugger program - nsk.jdi.Locatable.location.location005; + * the debuggee program - nsk.jdi.Locatable.location.location005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * See StackFrame.thisObject.thisobject001 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Locatable.location.location005 + * nsk.jdi.Locatable.location.location005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Locatable.location.location005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005a.java new file mode 100644 index 00000000000..6e89a20087c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005a.java @@ -0,0 +1,194 @@ +/* + * 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.Locatable.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location005 JDI test. + */ + +public class location005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Locatable.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Locatable.location()
    + * complies with its spec when a tested method is native.
    + *
    + * The case for testing is as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class TestClass {
    + * public native void nativeMethod ();
    + * }
    + * a debugger checks up that the invocation of
    + * the method Locatable.location() on the nativeMethod
    + * returns not the null.
    + *
    + */ + +public class location006 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Locatable/location/location006 ", + sHeader2 = "--> location006: ", + sHeader3 = "##> location006: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location006().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Locatable.location.location006a"; + + String mName = "nsk.jdi.Locatable.location"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location006a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".location006aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + Location mLocation = null; + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("nativeMethod"); + m = (Method) methods.get(0); + mLocation = m.location(); + + if (mLocation == null) { + log3("ERROR: mLocation == null for a native method"); + testExitCode = FAILED; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location006/TestDescription.java new file mode 100644 index 00000000000..d440ff32f31 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location006/TestDescription.java @@ -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/Locatable/location/location006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Locatable. + * The test checks up that a result of the method + * com.sun.jdi.Locatable.location() + * complies with its spec: + * public Location location() + * Returns the Location of this mirror, + * if there is executable Java language code associated with it. + * Returns: the Location of this mirror, or + * null if there is no executable code associated with it. + * For example, abstract and native Methods will return null when + * their location method is called. + * when it is applied to a native method. + * The test works as follows: + * The debugger program - nsk.jdi.Locatable.location.location006; + * the debuggee program - nsk.jdi.Locatable.location.location006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The test is corrected to comply with latest Merlin specification + * which states that for a native method, a returned value is not the null. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Locatable.location.location006 + * nsk.jdi.Locatable.location.location006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Locatable.location.location006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location006a.java new file mode 100644 index 00000000000..57b44e2d9e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location006a.java @@ -0,0 +1,120 @@ +/* + * 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.Locatable.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location006 JDI test. + */ + +public class location006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> location006a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> location006a: " + message); + } + + //====================================================== test program + + static location006aTestClass obj = new location006aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LocatableEvent.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.LocatableEvent.thread()
    + * complies with its spec.
    + *
    + * The cases for testing include all Locatable events.
    + * The test checks that
    + * for each type of LocatableEvent received in a debugger,
    + * a value returned by the method invoked on
    + * a Event object corresponds to a thread
    + * which debuggee's counterpart event was generated in.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check Locatable events,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a number of threads, one for each check case
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * gets ThreadReferences mirroring all tested threads in the debuggee,
    + * sets up Requests within them to get Events to check up on,
    + * resumes the debuggee, waits for events, and upon getting them,
    + * compares ThreadReferences put into Requests to ones from Events;
    + * if any mismatch, the test FAILED.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class thread001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LocatableEvent/thread/thread001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new thread001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LocatableEvent.thread.thread001a"; + + private String testedClassName = + "nsk.jdi.LocatableEvent.thread.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String accWatchpointName = "var1"; + String modWatchpointName = "var2"; + String bpLineName = "breakpointLine"; + String bpMethodName = "method"; + String awFieldName = "awFieldName"; + String mwFieldName = "mwFieldName"; + String excName = "method"; + String menName = "method"; + String mexName = "method"; + + String namesArray = "threadNames"; + + String threadNames[] = { + "awThread" , + "mwThread" , + "bpThread" , + "excThread" , + "menThread" , + "mexThread" , + "stThread" + }; + + + EventRequest eRequests[] = new EventRequest[threadNames.length]; + int flags = 0; + + ThreadReference eventThreads[] = new ThreadReference[threadNames.length]; + + + List allThreads = vm.allThreads(); + + log2("......getting: ArrayReference namesRef = (ArrayReference) debuggeeClass.getValue(debuggeeClass.fieldByName(namesArray));"); + ArrayReference namesRef = (ArrayReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(namesArray)); + log2(" namesRef.length() == " + namesRef.length()); + + log2("......getting and chcking up on debuggee threads' names"); + for (int n1 = 0; n1 < namesRef.length(); n1++) { + + log2(" String name = ((StringReference) namesRef.getValue(n1)).value();"); + String name = ((StringReference) namesRef.getValue(n1)).value(); + + label0: { + for (int n2 = 0; n2 < threadNames.length; n2++) { + + if (name.equals(threadNames[n2])) { + ListIterator li = allThreads.listIterator(); + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) { + eventThreads[n1] = thread; + break; + } + } + break label0; + } + } + testExitCode = FAILED; + log3("ERROR: no thread found in the debuggee : " + name); + } + } + if (testExitCode == FAILED) + break; + + + log2("......ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0);"); + ReferenceType testClass = (ReferenceType) (vm.classesByName(testedClassName)).get(0); + + log2("......setting up Requests"); + for ( int n3 = 0; n3 < namesRef.length(); n3++) { + switch (n3) { + case 0: + if (vm.canWatchFieldAccess()) { + String awName = ( (StringReference) testClass.getValue( + testClass.fieldByName(awFieldName))).value(); + eRequests[n3] = settingAccessWatchpoint(eventThreads[n3], + testClass, awName, threadNames[n3]); + eRequests[n3].enable(); + flags |= 1; + } + break; + + case 1: + if (vm.canWatchFieldModification() ) { + String mwName = ( (StringReference) testClass.getValue( + testClass.fieldByName(mwFieldName))).value(); + eRequests[n3] = settingModificationWatchpoint(eventThreads[n3], + testClass, mwName, threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<1; + } + break; + + case 2: + eRequests[n3] = settingBreakpoint(eventThreads[n3], testClass, + bpMethodName, bpLineName, threadNames[n3]); + eRequests[n3].setSuspendPolicy( EventRequest.SUSPEND_NONE); + eRequests[n3].enable(); + flags |= 1<<2; + break; + + case 3: + eRequests[n3] = settingException(eventThreads[n3], debuggeeClass, //testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<3; + break; + + case 4: + eRequests[n3] = settingMethodEntry(eventThreads[n3], testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<4; + break; + + case 5: + eRequests[n3] = settingMethodExit(eventThreads[n3], testClass, + threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<5; + break; + + case 6: + eRequests[n3] = settingStep(eventThreads[n3], threadNames[n3]); + eRequests[n3].enable(); + flags |= 1<<6; + break; + + default: + throw new JDITestRuntimeException("** default case while prepareing requests**"); + } + } + + log2(":::::::::vm.resume();"); + vm.resume(); + + Event event1 = null; + String threadName = null; + int flagsCopy = flags; + String eName = null; + + log2("......getting and checking up on Events"); + for (int n4 = 0; n4 < namesRef.length(); n4++) { + int flag; + int index; + getEventSet(); + event1 = eventIterator.nextEvent(); + + if (event1 instanceof AccessWatchpointEvent) { + eName = "AccessWatchpointEvent"; + index = 0; + } else if (event1 instanceof ModificationWatchpointEvent ) { + eName = "ModificationWatchpointEvent"; + index = 1; + } else if (event1 instanceof BreakpointEvent ) { + eName = "BreakpointEvent"; + index = 2; + } else if (event1 instanceof ExceptionEvent ) { + eName = "ExceptionEvent"; + index = 3; + } else if (event1 instanceof MethodEntryEvent ) { + eName = "MethodEntryEvent"; + index = 4; + } else if (event1 instanceof MethodExitEvent ) { + eName = "MethodExitEvent"; + index = 5; + } else if (event1 instanceof StepEvent ) { + eName = "StepEvent"; + index = 6; + } else { + log3("ERROR: else clause in detecting type of event1"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** unexpected event **"); + } + log2("--------> got: " + eName); + + ThreadReference threadRef = ((LocatableEvent) event1).thread(); + + label0: { + for (int n5 = 0; n5 < namesRef.length(); n5++) { + if (threadRef.equals(eventThreads[n5])) { + eventThreads[n5] = null; + threadName = threadNames[index]; + break label0; + } + } + testExitCode = FAILED; + log3("ERROR: event's thread is not equal to any tested"); + log3(" thread's name == " + threadRef.name()); + } + + flag = 1 << index; + if ((flagsCopy & flag) == 0) { + log3("ERROR: event duplication: " + eName); + testExitCode = FAILED; + } else { + flagsCopy ^= flag; + flags |= flag; + } + } + + breakpointForCommunication(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest settingAccessWatchpoint ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property) + throws JDITestRuntimeException { + + log2("......setting up AccessWatchpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; fieldName: " + fieldName); + + AccessWatchpointRequest awRequest = null; + try { + Field field = testedClass.fieldByName(fieldName); + awRequest = eventRManager.createAccessWatchpointRequest(field); + awRequest.putProperty("number", property); + awRequest.addThreadFilter(thread); + awRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpoint() : " + e); + log3(" AN ACCESSWATCHPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up an AccessWatchpoint **"); + } + + log2(" an AccessWatchpoint has been set up"); + return awRequest; + } + + private ModificationWatchpointRequest settingModificationWatchpoint ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + String property) + throws JDITestRuntimeException { + + log2("......setting up ModificationWatchpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; fieldName: " + fieldName); + + ModificationWatchpointRequest mwRequest = null; + try { + Field field = testedClass.fieldByName(fieldName); + mwRequest = eventRManager.createModificationWatchpointRequest(field); + mwRequest.putProperty("number", property); + mwRequest.addThreadFilter(thread); + mwRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpoint() : " + e); + log3(" AN ModificationWATCHPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up an AccessWatchpoint **"); + } + + log2(" a ModificationWatchpoint has been set up"); + return mwRequest; + } + + private MethodEntryRequest settingMethodEntry ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up MethodEntry:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + MethodEntryRequest menRequest = null; + try { + menRequest = eventRManager.createMethodEntryRequest(); + menRequest.putProperty("number", property); + menRequest.addThreadFilter(thread); + menRequest.addClassFilter(testedClass); + menRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntry() : " + e); + log3(" A MethodEntry HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a MethodEntry **"); + } + + log2(" a MethodEntry has been set up"); + return menRequest; + } + + private MethodExitRequest settingMethodExit ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up MethodExit:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + MethodExitRequest mexRequest = null; + try { + mexRequest = eventRManager.createMethodExitRequest(); + mexRequest.putProperty("number", property); + mexRequest.addThreadFilter(thread); + mexRequest.addClassFilter(testedClass); + mexRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExit() : " + e); + log3(" A MethodExit HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a MethodExit **"); + } + + log2(" a MethodExit has been set up"); + return mexRequest; + } + + private StepRequest settingStep ( ThreadReference thread, String property) + throws JDITestRuntimeException { + + log2("......setting up Step:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest stRequest = null; + try { + stRequest = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); + stRequest.putProperty("number", property); + stRequest.addCountFilter(1); + stRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStep() : " + e); + log3(" A Step HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a Step **"); + } + + log2(" a Step has been set up"); + return stRequest; + } + + + private ExceptionRequest settingException ( ThreadReference thread, + ReferenceType testedClass, + String property) + throws JDITestRuntimeException { + + log2("......setting up Exception:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; property: " + property); + + ExceptionRequest excRequest = null; + try { + excRequest = eventRManager.createExceptionRequest(null, true, true); + excRequest.putProperty("number", property); + excRequest.addThreadFilter(thread); + excRequest.addClassFilter(testedClass); + excRequest.setSuspendPolicy( EventRequest.SUSPEND_NONE); + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingException() : " + e); + log3(" A Exception HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up a Exception **"); + } + + log2(" a Exception has been set up"); + return excRequest; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocatableEvent/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocatableEvent/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..adef1bd98b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocatableEvent/thread/thread001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/LocatableEvent/thread/thread001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LocatableEvent. + * The test checks up that a result of the method + * com.sun.jdi.LocatableEvent.thread() + * complies with its spec: + * public ThreadReference thread() + * Returns the thread in which this event has occurred. + * Returns: a ThreadReference which mirrors the event's thread in the target VM. + * The cases for testing include all Locatable events. + * The test checks that + * for each type of LocatableEvent received in a debugger, + * a value returned by the method invoked on a Event object + * corresponds to a thread which debuggee's counterpart event was generated in. + * The test works as follows: + * The debugger program - nsk.jdi.LocatableEvent.thread.thread001; + * the debuggee program - nsk.jdi.LocatableEvent.thread.thread001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Fixed due to the bug 4528893. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.LocatableEvent.thread.thread001 + * nsk.jdi.LocatableEvent.thread.thread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LocatableEvent.thread.thread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocatableEvent/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocatableEvent/thread/thread001a.java new file mode 100644 index 00000000000..c32450a147c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocatableEvent/thread/thread001a.java @@ -0,0 +1,270 @@ +/* + * 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.LocatableEvent.thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the thread001 JDI test. + */ + +public class thread001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass tcObject = new TestClass(); + + static String threadNames[] = { + "awThread", "mwThread", "bpThread", "excThread", + "menThread", "mexThread", "stThread" + }; + + static int threadsN = threadNames.length; + + static Thread threads[] = new Thread[threadsN]; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + for (int n1 = 0; n1 < threadsN; n1++) { + if (n1 < threadsN-1) + threads[n1] = new Thread1thread001a(threadNames[n1]); + else + threads[n1] = new Thread2thread001a(threadNames[n1]); + } + log1(" threads has been created"); + + synchronized (lockingObject2) { + log1(" loop: threadStart(threads[n2])"); + for (int n2 = 0; n2 < threadsN; n2++) + if ( threadStart(threads[n2]) != PASSED ) + break label0; + + log1(" methodForCommunication();"); + methodForCommunication(); + } + + for (int n2 = 0; n2 < threadsN; n2++) { + synchronized (locks[n2]) { + log1(" synchronized (locks[n2]) : n2 == " + n2); + } + } + + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { +// log3("threadStart before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); +// log3("threadStart after: waitnotifyObj.wait();"); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + public static void nullMethod() { + throw new NullPointerException("test"); + } + + static Object lockingObject2 = new Object(); + static Object locks[] = new Object[threadsN]; + + static volatile int n = 0; + + static class Thread1thread001a extends Thread { + + int threadIndex; + + public Thread1thread001a(String threadName) { + super(threadName); + threadIndex = n; + locks[threadIndex] = new Object(); + n++; + } + + public void run() { + log3(" 'run': enter :: threadIndex == " + threadIndex); + + synchronized (locks[threadIndex]) { + log3("enter synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + TestClass.method(); + } + log3("exit synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + } + return; + } + + } + + static class Thread2thread001a extends Thread { + + int threadIndex; + + public Thread2thread001a(String threadName) { + super(threadName); + threadIndex = n; + locks[threadIndex] = new Object(); + n++; + } + + public void run() { + log3(" 'run': enter :: threadIndex == " + threadIndex); + + synchronized (locks[threadIndex]) { + log3("enter synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + m1(); + log3("exit synchronized (locks[threadIndex]) :: threadIndex == " + threadIndex); + } + return; + } + + private void m1() { + synchronized (lockingObject2) { + log3(" 'm1': enter"); + + log3(" 'm1': exit"); + } + } + + } + + + public static void log3(String str) { + log1(Thread.currentThread().getName() + " : " + str); + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 += 1; + var3 += 1; + var2 = var3; + try { + thread001a.nullMethod(); + } catch ( NullPointerException e ) { + thread001a.log3(" NullPointerException : " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java new file mode 100644 index 00000000000..45496e2d35e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java @@ -0,0 +1,237 @@ +/* + * 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.Location.codeIndex; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.codeIndex()
    + * complies with its spec.
    + *
    + * The test checks up that a List of allLineLocations in
    + * a ReferenceType object mirroring debuggee's class TestClass
    + * containing no native methods, contains only Location objects
    + * whose codeIndexes are >= 0.
    + */ + +public class codeindex001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/codeIndex/codeindex001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new codeindex001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.codeIndex.codeindex001a"; + + String mName = "nsk.jdi.Location.codeIndex"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + ListIterator li = lineLocations.listIterator(); + + log2("......checking up codeIndexes in all Locations"); + log2(" neither -1 nor <0 are expected"); + for (int ifor = 0; li.hasNext(); ifor++) { + Location loc = (Location) li.next(); + long codei = loc.codeIndex(); + if (codei == -1) { + log3("ERROR: codei == -1 ; index in List : " + ifor); + testExitCode = FAILED; + } else if (codei < 0) { + log3("ERROR: codei <0 : " + codei + "; index in List : " + ifor); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001/TestDescription.java new file mode 100644 index 00000000000..83f0a461dc8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/Location/codeIndex/codeindex001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.codeIndex() + * complies with its spec: + * public long codeIndex() + * Gets the code position within this location's method. + * Returns: the long representing the position within the method or -1 + * if location is within a native method. + * when no native methods are tested. + * The test works as follows: + * The debugger program - nsk.jdi.Location.codeIndex.codeindex 00; + * the debuggee program - nsk.jdi.Location.codeIndex.codeindex 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.codeIndex.codeindex001 + * nsk.jdi.Location.codeIndex.codeindex001a + * + * @comment make sure codeindex001a is compiled with full debug info + * @clean nsk.jdi.Location.codeIndex.codeindex001a + * @compile -g:lines,source,vars ../codeindex001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.codeIndex.codeindex001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001a.java new file mode 100644 index 00000000000..7c71b25e2af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001a.java @@ -0,0 +1,134 @@ +/* + * 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.Location.codeIndex; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the codeindex001 JDI test. + */ + +public class codeindex001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.declaringType()
    + * complie with its specification.
    + *
    + * The case for testing includes two types in a debuggee,
    + * an Interface type and a Class type implementing it.
    + * The Class contains a method, the Interface static initialize.
    + * A debugger gets two ReferenceType objects,
    + * a testedclass and a testediface mirroring the types,
    + * and for each tested type, performs the following:
    + * - gets a List returned by the methods testedclass.allLineLocations();
    + * - perform a loop to check up that for each Location in the List,
    + * call to the method Location.declaringType() returns ReferenceType
    + * object equal to one got at the beginning of the test.
    + */ + +public class declaringtype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/declaringType/declaringtype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new declaringtype001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.declaringType.declaringtype001a"; + + String mName = "nsk.jdi.Location.declaringType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......testing Class ReferenceType"); + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" ReferenceType testedclass = (ReferenceType) classes.get(0)"); + ReferenceType testedclass = (ReferenceType) classes.get(0); + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = testedclass.allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + ListIterator li = lineLocations.listIterator(); + + log2("......checking equality: location.declareingType().equals(testedclass)"); + for (int ifor = 0; li.hasNext(); ifor++) { + Location loc = (Location) li.next(); + + if (!loc.declaringType().equals(testedclass)) { + log3("ERROR: !loc.declareingType().equals(testedclass); index in List : " + ifor); + testExitCode = FAILED; + } + } + + + log2("......testing Interface ReferenceType"); + + String testedifaceName = mName + ".TestIface"; + + log2(" getting: List ifaces = vm.classesByName(testedifaceName); expected size == 1"); + List ifaces = vm.classesByName(testedifaceName); + size = ifaces.size(); + if (size != 1) { + log3("ERROR: ifaces.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" ReferenceType testediface = (ReferenceType) classes.get(0)"); + ReferenceType testediface = (ReferenceType) ifaces.get(0); + + log2(" getting: TestIface.allLineLocations(); no AbsentInformationException expected"); + try { + lineLocations = testediface.allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + li = lineLocations.listIterator(); + + log2("......checking equality: location.declareingType().equals(testediface)"); + for (int ifor = 0; li.hasNext(); ifor++) { + Location loc = (Location) li.next(); + + if (!loc.declaringType().equals(testediface)) { + log3("ERROR: !loc.declareingType().equals(testediface); index in List : " + ifor); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001/TestDescription.java new file mode 100644 index 00000000000..33e2c1005f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/Location/declaringType/declaringtype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.declaringType() + * complies with its spec: + * public ReferenceType declaringType() + * Gets the type to which this Location belongs. + * Normally the declaring type is a ClassType, but executable locations + * also may exist within the static initializer of an InterfaceType. + * Returns: the ReferenceType containing this Location. + * The test works as follows: + * The debugger program - nsk.jdi.Location.declaringType.declaringtype001 + * the debuggee program - nsk.jdi.Location.declaringType.declaringtype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.declaringType.declaringtype001 + * nsk.jdi.Location.declaringType.declaringtype001a + * + * @comment make sure declaringtype001a is compiled with full debug info + * @clean nsk.jdi.Location.declaringType.declaringtype001a + * @compile -g:lines,source,vars ../declaringtype001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.declaringType.declaringtype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001a.java new file mode 100644 index 00000000000..80c4e099637 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001a.java @@ -0,0 +1,133 @@ +/* + * 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.Location.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the declaringtype001 JDI test. + */ + +public class declaringtype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.equals()
    + * complie with its specification.
    + *
    + * The case for testing includes a Class type in a debuggee.
    + * A debugger gets a ReferenceType objects, mirroring tested Class,
    + * then gets a List returned by the methods
    + * testedclass.allLineLocations() and performs a loop in which
    + * for each Location in the List, it checks up that :
    + * - two invocations of the method hashCode() on the same Location
    + * return Objects equal to each other;
    + * - two invocations on different Locations return Objects
    + * not equal to each other.
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/equals/equals001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.equals.equals001a"; + + String mName = "nsk.jdi.Location.equals"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + + log2("......checking up Locations equality"); + + ListIterator li = lineLocations.listIterator(); + Location loc1 = (Location) li.next(); + + for (int ifor = 0; li.hasNext(); ifor++) { + + Location loc2 = (Location) lineLocations.get(ifor); + Location loc3 = (Location) li.next(); + + if (!loc2.equals(loc1)) { + log3("ERROR: !loc2.equals(loc1); ifor : " + ifor); + testExitCode = FAILED; + } + if (loc2.equals(loc3)) { + log3("ERROR: loc2.equals(loc3); ifor : " + ifor); + testExitCode = FAILED; + } + loc1 = loc3; + + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..9e2bffb24be --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/Location/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this Location for equality. + * Returns: true if the Object is a Location and if + * it refers to the same point in the same VM as this Location. + * Overrides: equals in class java.lang.Object + * when only one VM runs a debugged program. + * The test works as follows: + * The debugger program - nsk.jdi.Location.equals.equals001; + * the debuggee program - nsk.jdi.Location.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.equals.equals001 + * nsk.jdi.Location.equals.equals001a + * + * @comment make sure equals001a is compiled with full debug info + * @clean nsk.jdi.Location.equals.equals001a + * @compile -g:lines,source,vars ../equals001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001a.java new file mode 100644 index 00000000000..e342a38ccfc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001a.java @@ -0,0 +1,134 @@ +/* + * 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.Location.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001 JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.hashCode()
    + * complie with its specification.
    + *
    + * The case for testing includes a Class type in a debuggee.
    + * A debugger gets a ReferenceType objects, mirroring tested Class,
    + * then gets a List returned by the methods
    + * testedclass.allLineLocations() and performs a loop in which
    + * for each Location in the List, it checks up that :
    + * - two invocations of the method hashCode() on the same Location
    + * return ints equal to each other;
    + * - two invocations on different Locations return ints
    + * not equal to each other.
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/hashCode/hashcode001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.hashCode.hashcode001a"; + + String mName = "nsk.jdi.Location.hashCode"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + log2("......checking up Location's hashCodes"); + + ListIterator li = lineLocations.listIterator(); + Location loc1 = (Location) li.next(); + + for (int ifor = 0; li.hasNext(); ifor++) { + + Location loc2 = (Location) lineLocations.get(ifor); + Location loc3 = (Location) li.next(); + + int hcode1 = loc1.hashCode(); + int hcode2 = loc2.hashCode(); + int hcode3 = loc3.hashCode(); + + if (hcode1 != hcode2) { + log3("ERROR: loc1.hashCode() != loc2.hashCode() ifor : " + ifor); + testExitCode = FAILED; + } + loc1 = loc3; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..1560c1c1110 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/Location/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this Location. + * Returns: the integer hash code + * Overrides: hashCode in class java.lang.Object + * The test works as follows: + * The debugger program - nsk.jdi.Location.hashCode.hashcode001; + * the debuggee program - nsk.jdi.Location.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.hashCode.hashcode001 + * nsk.jdi.Location.hashCode.hashcode001a + * + * @comment make sure hashcode001a is compiled with full debug info + * @clean nsk.jdi.Location.hashCode.hashcode001a + * @compile -g:lines,source,vars ../hashcode001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001a.java new file mode 100644 index 00000000000..8ed785a7066 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001a.java @@ -0,0 +1,134 @@ +/* + * 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.Location.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001 JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.lineNumber()
    + * complies with its spec.
    + * Case for testing includes only a List of locations returned
    + * by the method ReferenceType.allLineLocations(), hence
    + * no -1 returned by Location.lineNumber() is expected.
    + */ + +public class linenumber001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/lineNumber/linenumber001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new linenumber001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.lineNumber.linenumber001a"; + + String mName = "nsk.jdi.Location.lineNumber"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String className = mName + ".TestClass"; + + log2(" getting: List of loaded 'TestClass' classes; only one element is expected"); + List listOfLoadedClasses = vm.classesByName(className); + + int size = listOfLoadedClasses.size(); + if (size != 1) { + log3("ERROR: listOfLoadedClasses.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + ReferenceType testedClass = (ReferenceType) listOfLoadedClasses.get(0); + + log2(" getting: List of TestClass lineLocations; AbsentInformationException is not expected"); + List lineLocations = null; + try { + lineLocations = testedClass.allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: min and max line numbers of TestClass"); + int minLine; + int maxLine; + try { + minLine = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName("minLine")) ).value(); + maxLine = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName("maxLine")) ).value(); + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + break; + } + + log2(" loop for checking up lineNumbers in each element in lineLocations"); + ListIterator li = lineLocations.listIterator(); + + for (int ifor = 0; li.hasNext(); ifor++) { + int lineNumber = ((Location) li.next()).lineNumber(); + if ( lineNumber < minLine || lineNumber > maxLine ) { + log3("ERROR: lineNumber is out of range minLine-maxLine: "); + log2(" minLine == " + minLine + "; lineNumber == " + lineNumber + "; maxLine == " + maxLine); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001/TestDescription.java new file mode 100644 index 00000000000..e9558102635 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/Location/lineNumber/linenumber001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.lineNumber() + * complies with its spec: + * public int lineNumber() + * The line number of this Location. + * The line number is relative to the source specified by sourceName(). + * Returns: an int specifying the line in the source, + * return -1 if the information is not available. + * when a tested method is not native. + * The test works as follows: + * The debugger program - nsk.jdi.Location.lineNumber.linenumber001; + * the debuggee program - nsk.jdi.Location.lineNumber.linenumber001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * 1) + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * 2) The spec in Merlin: + * public int lineNumber() + * The line number of this Location. + * The line number is relative to the source specified by sourceName(). + * Returns: an int specifying the line in the source, + * returns -1 if the information is not available; + * specifically, always returns -1 for native methods. + * In my opinion the Merlin spec doesn't change the semantic in the Kectrel spec + * but only clarifies one particular case. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.lineNumber.linenumber001 + * nsk.jdi.Location.lineNumber.linenumber001a + * + * @comment make sure linenumber001a is compiled with full debug info + * @clean nsk.jdi.Location.lineNumber.linenumber001a + * @compile -g:lines,source,vars ../linenumber001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.lineNumber.linenumber001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001a.java new file mode 100644 index 00000000000..b0edb5510a6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001a.java @@ -0,0 +1,142 @@ +/* + * 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.Location.lineNumber; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This class is used as debuggee application for the linenumber001 JDI test. + */ + +public class linenumber001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * 9 --> 1000 + * ... ... + * 16 --> 1007 + * sde_testMethod1 + * 20 --> 1100 + * ... ... + * 27 --> 1107 + * sde_testMethod2 + * 31 --> 1200 + * ... ... + * 38 --> 1207 + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that all locations obtained for one the 'TestStratumXXX' returns -1 as line number for all others 'TestStratumXXX'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.lineNumber_s.lineNumber_s002.lineNumber_s002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.lineNumber_s.lineNumber_s002.lineNumber_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.Location.lineNumber_s.lineNumber_s002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class lineNumber_s002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new lineNumber_s002().runIt(argv, out); + } + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type4(className); + /* + * Method 'prepareDefaultPatchedClassFile_Type4' creates class file with + * following line mapping: "Java" "TestStratum1" "TestStratum2" + * "TestStratum3" + * + * + * 9 --> 1000 + * ... + * ... + * 16 --> 1007 + * + * sde_testMethod1 + * 20 --> 1100 + * ... + * ... + * 27 --> 1107 + * + * sde_testMethod2 + * 31 --> 1200 + * ... + * ... + * 38 --> 1207 + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName1 : testStratumData.keySet()) { + log.display("Check locations for stratum: " + stratumName1); + + List allLocations; + + try { + allLocations = referenceType.allLineLocations(stratumName1, null); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + + continue; + } + + for (Location location : allLocations) { + // check that for all stratums other than stratumName1 + // Location.lineNumber() returns -1 + for (String stratumName2 : testStratumData.keySet()) { + if (!stratumName2.equals(stratumName1)) { + log.display("Try get line number for stratum: " + stratumName2); + + int lineNumber = location.lineNumber(stratumName2); + + if (lineNumber != -1) { + setSuccess(false); + log.complain("Location.lineNumber returns unexpected value: " + lineNumber + + ", expected is " + -1); + } + } + } + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java new file mode 100644 index 00000000000..ede865ba146 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java @@ -0,0 +1,243 @@ +/* + * 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.Location.lineNumber_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.lineNumber(String stratum)
    + * complies with its spec.
    + * Case for testing includes only a List of locations returned
    + * by the method ReferenceType.allLineLocations() applied to
    + * a class with the "Java" stratum which is the default one.
    + */ + +public class linenumber_s001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/lineNumber_s/linenumber_s001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new linenumber_s001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.lineNumber_s.linenumber_s001a"; + + String mName = "nsk.jdi.Location.lineNumber_s"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null;; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String className = mName + ".TestClass"; + + log2(" getting: List of loaded 'TestClass' classes; only one element is expected"); + List listOfLoadedClasses = vm.classesByName(className); + + int size = listOfLoadedClasses.size(); + if (size != 1) { + log3("ERROR: listOfLoadedClasses.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + ReferenceType testedClass = (ReferenceType) listOfLoadedClasses.get(0); + + log2(" getting: List of TestClass lineLocations; AbsentInformationException is not expected"); + List lineLocations = null; + try { + lineLocations = testedClass.allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: min and max line numbers of TestClass"); + int minLine; + int maxLine; + try { + minLine = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName("minLine")) ).value(); + maxLine = ( (IntegerValue) testedClass.getValue(testedClass.fieldByName("maxLine")) ).value(); + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + break; + } + + String defaultStratum = vm.getDefaultStratum(); + + log2(" loop for checking up lineNumbers in each element in lineLocations"); + ListIterator li = lineLocations.listIterator(); + + for (int ifor = 0; li.hasNext(); ifor++) { + int lineNumber = ((Location) li.next()).lineNumber(defaultStratum); + if ( lineNumber < minLine || lineNumber > maxLine ) { + log3("ERROR: lineNumber is out of range minLine-maxLine: "); + log2(" minLine == " + minLine + "; lineNumber == " + lineNumber + "; maxLine == " + maxLine); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001/TestDescription.java new file mode 100644 index 00000000000..a7671921a72 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/Location/lineNumber_s/linenumber_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.lineNumber(String) + * complies with its spec: + * Public int lineNumber(String stratum) + * The line number of this Location. + * The line number is relative to the source specified by sourceName(stratum). + * Returned line number is for the specified stratum + * (see the class comment for a description of strata). + * Parameters: stratum - The stratum to retrieve information from or + * null for the declaring type's default stratum. + * Returns: an int specifying the line in the source, + * returns -1 if the information is not available; + * specifically, always returns -1 for native methods. + * The test works as follows: + * The debugger program - nsk.jdi.Location.lineNumber_s.linenumber_s001; + * the debuggee program - nsk.jdi.Location.lineNumber_s.linenumber_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Location.lineNumber_s.linenumber_s001 + * nsk.jdi.Location.lineNumber_s.linenumber_s001a + * + * @comment make sure linenumber_s001a is compiled with full debug info + * @clean nsk.jdi.Location.lineNumber_s.linenumber_s001a + * @compile -g:lines,source,vars ../linenumber_s001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.lineNumber_s.linenumber_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001a.java new file mode 100644 index 00000000000..65203fcc6e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001a.java @@ -0,0 +1,146 @@ +/* + * 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.Location.lineNumber_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This class is used as debuggee application for the linenumber_s001 JDI test. + */ +public class linenumber_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } +/* + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } +*/ + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.method()
    + * complies with its spec.
    + *
    + * The test checks up that method's returned value is Method
    + * for both method and initializer in debuggee's class object.
    + *
    + */ + +public class method001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/method/method001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new method001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.method.method001a"; + + String mName = "nsk.jdi.Location.method"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("method001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + int flag = 0; + + ListIterator li = lineLocations.listIterator(); + + log2("......checking up methods in all Locations"); + log2(" expected methods: Constructor, StaticInitializer, user defined"); + log2(" neither abstract no native expected"); + for (int ifor = 0; li.hasNext(); ifor++) { + Location loc = (Location) li.next(); + Method m = loc.method(); + + if (m.isConstructor()) + flag |= 1; + else if (m.isStaticInitializer()) + flag |= 2; + if (m.isNative()) + flag |= 8; + else if (m.isAbstract()) + flag |= 16; + else + flag |= 4; + + } + if ( (flag & 1) == 0) { + log3("ERROR: no Constructor found"); + testExitCode = FAILED; + } else if ( (flag & 2) == 0) { + log3("ERROR: no StaticInitializer found"); + testExitCode = FAILED; + } else if ( (flag & 4) == 0) { + log3("ERROR: no user defined method found"); + testExitCode = FAILED; + } else if ( (flag & 8) != 0) { + log3("ERROR: native method found"); + testExitCode = FAILED; + } else if ( (flag & 16) != 0) { + log3("ERROR: abstract method found"); + testExitCode = FAILED; + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/method/method001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/method/method001/TestDescription.java new file mode 100644 index 00000000000..44d69a7bef5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/method/method001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/Location/method/method001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.method() + * complies with its spec: + * public Method method() + * Gets the method, if any, containing this Location. + * Returns: the Method if this location is in a method, otherwise null. + * when tested objects are a method and a initializer. + * The test works as follows: + * The debugger program - nsk.jdi.Location.method.method001; + * the debuggee program - nsk.jdi.Location.method.method001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Location.method.method001 + * nsk.jdi.Location.method.method001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.method.method001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/method/method001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/method/method001a.java new file mode 100644 index 00000000000..082bb82489f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/method/method001a.java @@ -0,0 +1,145 @@ +/* + * 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.Location.method; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the method001 JDI test. + */ + +public class method001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> method001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> method001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.sourceName()
    + * complie with its specification.
    + *
    + * The case for testing includes a Class type in a debuggee, and
    + * debuggee's sourcecode file with a predefined name.
    + * A debugger gets aReferenceType objects, mirroring tested Class and
    + * performs the following:
    + * - gets a List returned by the methods testedclass.allLineLocations();
    + * - perform a loop to check up that for each Location in the List,
    + * call to the method Location.sourceName() returns String equal to
    + * the predefined one.
    + */ + +public class sourcename001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/sourceName/sourcename001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new sourcename001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.sourceName.sourcename001a"; + + String mName = "nsk.jdi.Location.sourceName"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + ListIterator li = lineLocations.listIterator(); + + log2("......checking up sourceName strings in all Locations"); + log2(" only 'sourcename001a.java' is expected"); + + label0: + for (int ifor = 0; li.hasNext(); ifor++) { + Location loc = (Location) li.next(); + + try { + String str = loc.sourceName(); + if (!str.equals("sourcename001a.java")) { + log3("ERROR: !str.equals('sourcename001a.java') : " + str); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break label0; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001/TestDescription.java new file mode 100644 index 00000000000..6c042b13f5a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/Location/sourceName/sourcename001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.sourceName() + * complies with its spec: + * public String sourceName() + * throws AbsentInformationException + * Gets an identifing name for the source corresponding to this location. + * Interpretation of this string is the responsibility of + * the source repository mechanism. + * In the reference implementation, the returned string is + * the unqualified name of the source file for this Location. + * Returns: a string specifying the source + * Throws: AbsentInformationException - + * if the source name is not known + * The test works as follows: + * The debugger program - nsk.jdi.Location.sourceName.sourcename001; + * the debuggee program - nsk.jdi.Location.sourceName.sourcename001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.sourceName.sourcename001 + * nsk.jdi.Location.sourceName.sourcename001a + * + * @comment make sure sourcename001a is compiled with full debug info + * @clean nsk.jdi.Location.sourceName.sourcename001a + * @compile -g:lines,source,vars ../sourcename001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.sourceName.sourcename001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001a.java new file mode 100644 index 00000000000..1c2c60d345a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001a.java @@ -0,0 +1,134 @@ +/* + * 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.Location.sourceName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the sourcename001 JDI test. + */ + +public class sourcename001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * 9 --> 1000, source1, path1 + * ... ... + * 16 --> 1007, source1, path1 + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * ... ... + * 27 --> 1107, source1, path1 + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * ... ... + * 38 --> 1207, source1, path1 + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for all locations obtained for one the 'TestStratumXXX' method 'sourceName(String stratum)' throws AbsentInformationException + * when try to get source name for all others 'TestStratumXXX'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.sourceName_s.sourceName_s002.sourceName_s002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.sourceName_s.sourceName_s002.sourceName_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.Location.sourceName_s.sourceName_s002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class sourceName_s002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new sourceName_s002().runIt(argv, out); + } + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type4(className); + /* + * Method 'prepareDefaultPatchedClassFile_Type4' creates class file with + * following line mapping: "Java" "TestStratum1" "TestStratum2" + * "TestStratum3" + * + * + * 9 --> 1000 + * ... + * ... + * 16 --> 1007 + * + * sde_testMethod1 + * 20 --> 1100 + * ... + * ... + * 27 --> 1107 + * + * sde_testMethod2 + * 31 --> 1200 + * ... + * ... + * 38 --> 1207 + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName1 : testStratumData.keySet()) { + log.display("Check locations for stratum: " + stratumName1); + + List allLocations; + + try { + allLocations = referenceType.allLineLocations(stratumName1, null); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + + continue; + } + + for (Location location : allLocations) { + // check that for all stratums other than stratumName1 + // Location.sourceName() throws AbsentInformationException + for (String stratumName2 : testStratumData.keySet()) { + if (!stratumName2.equals(stratumName1)) { + log.display("Try get source name for stratum: " + stratumName2); + + try { + location.sourceName(stratumName2); + setSuccess(false); + log.complain("Expected AbsentInformationException was not thrown"); + } catch (AbsentInformationException e) { + // expected exception + } + } + } + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java new file mode 100644 index 00000000000..0146c1608fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java @@ -0,0 +1,244 @@ +/* + * 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.Location.sourceName_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.sourceName(String stratum)
    + * complies with its specification.
    + *
    + * The case for testing includes a Class type in a debuggee, and
    + * debuggee's sourcecode file with a predefined name.
    + * A debugger gets ReferenceType objects, mirroring tested Class and
    + * performs the following:
    + * - gets a List returned by the method testedClass.allLineLocations();
    + * - perform a loop to check up that for each Location in the List,
    + * the method Location.sourceName(defaultStratum)
    + * returns String equal to the predefined one.
    + */ + +public class sourcename_s001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/sourceName_s/sourcename_s001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new sourcename_s001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.sourceName_s.sourcename_s001a"; + + String mName = "nsk.jdi.Location.sourceName_s"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + String defaultStratum = vm.getDefaultStratum(); + + ListIterator li = lineLocations.listIterator(); + + log2("......checking up on sourceName strings in all Locations"); + log2(" only 'sourcename_s001a.java' is expected"); + + label0: + for (int ifor = 0; li.hasNext(); ifor++) { + Location loc = (Location) li.next(); + + try { + String str = loc.sourceName(defaultStratum); + if (!str.equals("sourcename_s001a.java")) { + log3("ERROR: !str.equals('sourcename_s001a.java') : " + str); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break label0; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001/TestDescription.java new file mode 100644 index 00000000000..047a091f253 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/Location/sourceName_s/sourcename_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.sourceName(String) + * complies with its spec: + * public String sourceName(String stratum) + * throws AbsentInformationException + * Gets an identifing name for the source corresponding to this location. + * Interpretation of this string is the responsibility of the source + * repository mechanism. + * Returned name is for the specified stratum + * (see the class comment for a description of strata). + * The returned string is the unqualified name of the source file for + * this Location. For example, java.lang.Thread would return "Thread.java". + * Parameters: stratum - The stratum to retrieve information from or + * null for the declaring type's default stratum. + * Returns: a string specifying the source + * Throws: AbsentInformationException - + * if the source name is not known + * The test works as follows: + * The debugger program - nsk.jdi.Location.sourceName_s.sourcename_s001; + * the debuggee program - nsk.jdi.Location.sourceName_s.sourcename_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Location.sourceName_s.sourcename_s001 + * nsk.jdi.Location.sourceName_s.sourcename_s001a + * + * @comment make sure sourcename_s001a is compiled with full debug info + * @clean nsk.jdi.Location.sourceName_s.sourcename_s001a + * @compile -g:lines,source,vars ../sourcename_s001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.sourceName_s.sourcename_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001a.java new file mode 100644 index 00000000000..a4c543a2b21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001a.java @@ -0,0 +1,138 @@ +/* + * 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.Location.sourceName_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the sourcename_s001 JDI test. + */ + +public class sourcename_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } +/* + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } +*/ + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.sourcePath()
    + * complies with its specification.
    + *
    + * The test checks that
    + * - invocation of the method doesn't throw
    + * an error or unspecified exception;
    + * - returned value is debuggee's
    + * "unqualified name of the source file for this Location".
    + *
    + */ + +public class sourcepath001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/sourcePath/sourcepath001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new sourcepath001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.sourcePath.sourcepath001a"; + + String mName = "nsk.jdi.Location.sourcePath"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + log2("...... getting : ListIterator li = lineLocations.listIterator();"); + ListIterator li = lineLocations.listIterator(); + + log2("...... getting : Location loc = (Location) li.next();"); + Location loc = (Location) li.next(); + + String sep = System.getProperty("file.separator"); + String debuggeeUnqualifiedSourcePath = "nsk" + sep + "jdi" +sep + "Location" + sep + + "sourcePath" + sep + "sourcepath001a.java"; + + log2("......getting: String str = loc.sourcePath()"); + try { + String str = loc.sourcePath(); + + log2("......compareing: loc.sourcePath() to debuggeeUnqualifiedSourcePath"); + if (!str.equals(debuggeeUnqualifiedSourcePath)) { + log3("ERROR: loc.sourcePath() != debuggeeUnqualifiedSourcePath"); + log2(" loc.sourcePath() == " + str); + log2(" debuggeeUnqualifiedSourcePath == " + debuggeeUnqualifiedSourcePath); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + } catch ( Throwable err ) { + log3("ERROR: Throwable : " + err); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001/TestDescription.java new file mode 100644 index 00000000000..24caea48a74 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/Location/sourcePath/sourcepath001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.sourcePath() + * complies with its spec: + * public String sourcePath() + * throws AbsentInformationException + * Gets the path to the source corresponding to this location. + * This method is equivalent to sourcePath(vm.getDefaultStratum()) - see + * sourcePath(String) for more information. + * Returns: a string specifying the source + * Throws: AbsentInformationException - + * if the source name is not known + * The test checks that + * - invocation of the method doesn't throw an error or unspecified exception;
    + * - returned value is debuggee's + * "unqualified name of the source file for this Location". + * The test works as follows: + * The debugger program - nsk.jdi.Location.sourcePath.sourcepath001; + * the debuggee program - nsk.jdi.Location.sourcePath.sourcepath001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and performes the testing call. + * 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.Location.sourcePath.sourcepath001 + * nsk.jdi.Location.sourcePath.sourcepath001a + * + * @comment make sure sourcepath001a is compiled with full debug info + * @clean nsk.jdi.Location.sourcePath.sourcepath001a + * @compile -g:lines,source,vars ../sourcepath001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.sourcePath.sourcepath001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001a.java new file mode 100644 index 00000000000..6e8f209b719 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001a.java @@ -0,0 +1,133 @@ +/* + * 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.Location.sourcePath; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the sourcepath001 JDI test. + */ + +public class sourcepath001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * 9 --> 1000, source1, path1 + * ... ... + * 16 --> 1007, source1, path1 + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * ... ... + * 27 --> 1107, source1, path1 + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * ... ... + * 38 --> 1207, source1, path1 + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for all locations obtained for one the 'TestStratumXXX' method 'sourcePath(String stratum)' throws AbsentInformationException + * when try to get source path for all others 'TestStratumXXX'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Location.sourcePath_s.sourcePath_s002.sourcePath_s002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.sourcePath_s.sourcePath_s002.sourcePath_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.Location.sourcePath_s.sourcePath_s002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class sourcePath_s002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new sourcePath_s002().runIt(argv, out); + } + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type4(className); + /* + * Method 'prepareDefaultPatchedClassFile_Type4' creates class file with + * following line mapping: "Java" "TestStratum1" "TestStratum2" + * "TestStratum3" + * + * + * 9 --> 1000 + * ... + * ... + * 16 --> 1007 + * + * sde_testMethod1 + * 20 --> 1100 + * ... + * ... + * 27 --> 1107 + * + * sde_testMethod2 + * 31 --> 1200 + * ... + * ... + * 38 --> 1207 + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName1 : testStratumData.keySet()) { + log.display("Check locations for stratum: " + stratumName1); + + List allLocations; + + try { + allLocations = referenceType.allLineLocations(stratumName1, null); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + + continue; + } + + for (Location location : allLocations) { + // check that for all stratums other than stratumName1 + // Location.sourcePath() throws AbsentInformationException + for (String stratumName2 : testStratumData.keySet()) { + if (!stratumName2.equals(stratumName1)) { + log.display("Try get source path for stratum: " + stratumName2); + + try { + location.sourcePath(stratumName2); + setSuccess(false); + log.complain("Expected AbsentInformationException was not thrown"); + } catch (AbsentInformationException e) { + // expected exception + } + } + } + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java new file mode 100644 index 00000000000..c118d88e325 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java @@ -0,0 +1,250 @@ +/* + * 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.Location.sourcePath_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Location.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Location.sourcePath(String stratum)
    + * complies with its specification.
    + *
    + * The test checks that
    + * - invocation of the method doesn't throw
    + * an error or unspecified exception;
    + * - returned value is debuggee's
    + * "unqualified name of the source file for this Location".
    + *
    + */ + +public class sourcepath_s001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Location/sourcePath_s/sourcepath_s001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new sourcepath_s001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Location.sourcePath_s.sourcepath_s001a"; + + String mName = "nsk.jdi.Location.sourcePath_s"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedclassName = mName + ".TestClass"; + + log2(" getting: List classes = vm.classesByName(testedclassName); expected size == 1"); + List classes = vm.classesByName(testedclassName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting: TestClass.allLineLocations(); no AbsentInformationException expected"); + List lineLocations = null; + try { + lineLocations = ((ReferenceType) classes.get(0)).allLineLocations(); + } catch ( AbsentInformationException e) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + break; + } + size = lineLocations.size(); + if (size == 0) { + log3("ERROR: lineLocations.size() == 0"); + testExitCode = FAILED; + break; + } + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + log2("...... getting : ListIterator li = lineLocations.listIterator();"); + ListIterator li = lineLocations.listIterator(); + + log2("...... getting : Location loc = (Location) li.next();"); + Location loc = (Location) li.next(); + + String sep = System.getProperty("file.separator"); + String debuggeeUnqualifiedSourcePath = "nsk" + sep + "jdi" +sep + "Location" + sep + + "sourcePath_s" + sep + "sourcepath_s001a.java"; + + log2("......getting: String str = loc.sourcePath(defaultStratum)"); + try { + String str = loc.sourcePath(defaultStratum); + + log2("......compareing: loc.sourcePath(defaultStratum) to debuggeeUnqualifiedSourcePath"); + if (!str.equals(debuggeeUnqualifiedSourcePath)) { + log3("ERROR: loc.sourcePath(defaultStratum) != debuggeeUnqualifiedSourcePath"); + log2(" loc.sourcePath(defaultStratum) == " + str); + log2(" debuggeeUnqualifiedSourcePath == " + debuggeeUnqualifiedSourcePath); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException"); + testExitCode = FAILED; + } catch ( Throwable err ) { + log3("ERROR: Throwable : " + err); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001/TestDescription.java new file mode 100644 index 00000000000..e5e64859e9c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001/TestDescription.java @@ -0,0 +1,96 @@ +/* + * 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/Location/sourcePath_s/sourcepath_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Location. + * The test checks up that a result of the method + * com.sun.jdi.Location.sourcePath(String) + * complies with its spec: + * public String sourcePath(String stratum) + * throws AbsentInformationException + * Gets the path to the source corresponding to this location. + * Interpretation of this string is the responsibility of + * the source repository mechanism. + * Returned path is for the specified stratum + * (see the class comment for a description of strata). + * In the reference implementation, for strata which do not explicitly specify + * source path (the Java programming language stratum never does), + * the returned string is the package name of declaringType() converted to + * a platform dependent path followed by the unqualified name of + * the source file for this Location (sourceName(stratum)). + * For example, on a Windows platform, + * java.lang.Thread would return "java\lang\Thread.java". + * Parameters: stratum - The stratum to retrieve information from or + * null for the declaring type's default stratum. + * Returns: a string specifying the source + * Throws: AbsentInformationException - + * if the source name is not known + * The test checks that + * - invocation of the method doesn't throw an error or unspecified exception;
    + * - returned value is debuggee's + * "unqualified name of the source file for this Location". + * The test works as follows: + * The debugger program - nsk.jdi.Location.sourcePath_s.sourcepath_s001; + * the debuggee program - nsk.jdi.Location.sourcePath_s.sourcepath_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and performes the testing call. + * 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.Location.sourcePath_s.sourcepath_s001 + * nsk.jdi.Location.sourcePath_s.sourcepath_s001a + * + * @comment make sure sourcepath_s001a is compiled with full debug info + * @clean nsk.jdi.Location.sourcePath_s.sourcepath_s001a + * @compile -g:lines,source,vars ../sourcepath_s001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Location.sourcePath_s.sourcepath_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001a.java new file mode 100644 index 00000000000..26ad8ad3e5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001a.java @@ -0,0 +1,133 @@ +/* + * 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.Location.sourcePath_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the sourcepath_s001 JDI test. + */ + +public class sourcepath_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LongType.
    + *
    + * The test checks that for a mirror of a long value, the casts
    + * from Type to LongType and from PrimitiveType to LongType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a long field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class longtype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LongType/_itself_/longtype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new longtype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LongType._itself_.longtype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'ln';"); + String name = "ln"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + LongType longType = null; + try { + log2(" checking up on cast: LongType longType = (LongType) type;"); + longType = (LongType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: LongType longType = (LongType) primitiveType;"); + longType = (LongType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongType/_itself_/longtype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongType/_itself_/longtype001/TestDescription.java new file mode 100644 index 00000000000..24e7653a3a2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongType/_itself_/longtype001/TestDescription.java @@ -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/LongType/_itself_/longtype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LongType. + * The test checks that for a mirror of a long value the casts + * from Type to LongType and from PrimitiveType to LongType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.LongType._itself_.longtype001; + * the debuggee program - nsk.jdi.LongType._itself_.longtype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.LongType._itself_.longtype001 + * nsk.jdi.LongType._itself_.longtype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LongType._itself_.longtype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongType/_itself_/longtype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongType/_itself_/longtype001a.java new file mode 100644 index 00000000000..cd8417db8a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongType/_itself_/longtype001a.java @@ -0,0 +1,113 @@ +/* + * 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.LongType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the longtype001 JDI test. + */ + +public class longtype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static long ln = 0; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001.java new file mode 100644 index 00000000000..2a1e00012b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.LongValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.LongValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + LongValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof LongValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (LongValue )v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for LongValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(LongValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof LongValue) { + LongValue longObject = (LongValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(longObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(longObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is LongValue: " + value + " and 'y' is LongValue : " + longObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(longObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(longObject) == 0) && (longObject.compareTo(value) != 0)) || + ((value.compareTo(longObject) != 0) && (longObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is LongValue: " + value + " and 'y' is LongValue : " + longObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(longObject) + "\n\t" + + "result of (y.compareTo(x)): " + longObject.compareTo(value) ); + result = false; + } + if (value.compareTo(longObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(longObject) != -(longObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is LongValue: " + value + " and 'y' is LongValue : " + longObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(longObject) + "\n\t" + + "result of (y.compareTo(x)): " + longObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(longObject) > 0) { + LongValue lessValue = FindLessLongValue(longObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is LongValue: " + value + " , 'y' is LongValue : " + longObject + " , 'z' is LongValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(longObject) + "\n\t" + + "result of (y.compareTo(z)): " + longObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "LongValue: " + value + " and LongValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "LongValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "LongValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((LongValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "LongValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "LongValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another LongValue field which is less then method's argument via + * compareTo method. + */ + + private static LongValue FindLessLongValue (LongValue currentValue) { + LongValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + LongValue newValue = (LongValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..919673a8906 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001/TestDescription.java @@ -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/LongValue/compareTo/compareto001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.LongValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of LongValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote LongValue object. + * The debugger program - nsk.jdi.LongValue.compareto.compareto001; + * the debuggee program - nsk.jdi.LongValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of long fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of LongValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.LongValue.compareTo.compareto001 + * nsk.jdi.LongValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LongValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..5ad9da953f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/compareTo/compareto001a.java @@ -0,0 +1,175 @@ +/* + * 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.LongValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public long longMAX = Long.MAX_VALUE; + public long long1 = 1; + public long long0 = 0; + public long long_1 = -1; + public long longMIN = Long.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001.java new file mode 100644 index 00000000000..897b15e3487 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001.java @@ -0,0 +1,247 @@ +/* + * 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.LongValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * LongValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LongValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static long plus1_1 = +1;
    + * public static long plus1_2 = +1;
    + * public static long minus1 = -1;
    + * public static float floatplus1 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * LongValue lvplus1_1;
    + * LongValue lvplus1_2;
    + * LongValue lvminus1;
    + * FloatValue fvplus1;
    + *
    + * the following is true:
    + *
    + * lvplus1_1 == lvplus1_2
    + * lvplus1_1 != lvminus1
    + * lvplus1_1 != fvplus1
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LongValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LongValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field flplus1_1 = execClass.fieldByName("plus1_1"); + Field flplus1_2 = execClass.fieldByName("plus1_2"); + Field flminus1 = execClass.fieldByName("minus1"); + Field ffplus1 = execClass.fieldByName("floatplus1"); + + LongValue lvplus1_1 = (LongValue) execClass.getValue(flplus1_1); + LongValue lvplus1_2 = (LongValue) execClass.getValue(flplus1_2); + LongValue lvminus1 = (LongValue) execClass.getValue(flminus1); + FloatValue fvplus1 = (FloatValue) execClass.getValue(ffplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!lvplus1_1.equals(lvplus1_2)) + expresult = 1; + break; + + case 1: if (lvplus1_1.equals(lvminus1)) + expresult = 1; + break; + + case 2: if (lvplus1_1.equals(fvplus1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..a79d3666841 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001/TestDescription.java @@ -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/LongValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LongValue. + * The test checks up that a result of the method + * com.sun.jdi.LongValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this LongValue for equality. + * Returns: true if the Object is a LongValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.LongValue.equals.equals001; + * a debuggee program - nsk.jdi.LongValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.LongValue.equals.equals001 + * nsk.jdi.LongValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LongValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001a.java new file mode 100644 index 00000000000..8a0e6e46877 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals001a.java @@ -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.LongValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static long smallest = Long.MIN_VALUE; +// public static long zero = 0; +// public static long largest = Long.MAX_VALUE; + + public static long plus1_1 = +1; + public static long plus1_2 = +1; + public static long minus1 = -1; + + public static float floatplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.LongValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + LongValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof LongValue) ) { + msg += " is not LongValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (LongValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(LongValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof LongValue ) { + if ( value.value() == ((PrimitiveValue )object).longValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof LongValue ) { + if ( value.value() != ((PrimitiveValue )object).longValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..301ffc4fdc4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals002/TestDescription.java @@ -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/LongValue/equals/equals002. + * 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.LongValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this LongValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a LongValue and if applying "==" to the + * two mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.LongValue.equals.equals002 + * nsk.jdi.LongValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LongValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals002a.java new file mode 100644 index 00000000000..6883bba8ca6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/equals/equals002a.java @@ -0,0 +1,142 @@ +/* + * 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.LongValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public long longMAX = Long.MAX_VALUE; + public long long1 = 1; + public long long0 = 0; + public long long_1 = -1; + public long longMIN = Long.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..7719789504f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001.java @@ -0,0 +1,234 @@ +/* + * 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.LongValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * LongValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LongValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static long plus1_1 = +1;
    + * public static long plus1_2 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * LongValue lvplus1_1;
    + * LongValue lvplus1_2;
    + *
    + * the following is true:
    + *
    + * lvplus1_1.hashCode() == lvplus1_1.hashCode()
    + * lvplus1_1.hashCode() == lvplus1_2.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LongValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LongValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field flplus1_1 = execClass.fieldByName("plus1_1"); + Field flplus1_2 = execClass.fieldByName("plus1_2"); + + LongValue lvplus1_1 = (LongValue) execClass.getValue(flplus1_1); + LongValue lvplus1_2 = (LongValue) execClass.getValue(flplus1_2); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (lvplus1_1.hashCode() != lvplus1_1.hashCode()) + expresult = 1; + break; + + case 1: if (lvplus1_1.hashCode() != lvplus1_2.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..1db82d67f0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001/TestDescription.java @@ -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/LongValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LongValue. + * The test checks up that a result of the method + * com.sun.jdi.LongValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this LongValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.LongValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.LongValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.LongValue.hashCode.hashcode001 + * nsk.jdi.LongValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LongValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..56fb512d5b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/hashCode/hashcode001a.java @@ -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.LongValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static long smallest = Long.MIN_VALUE; +// public static long zero = 0; +// public static long largest = Long.MAX_VALUE; + + public static long plus1_1 = +1; + public static long plus1_2 = +1; +// public static long minus1 = -1; + +// public static float floatplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * LongValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.LongValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static long smallest = Long.MIN_VALUE;
    + * public static long zero = 0;
    + * public static long largest = Long.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * LongValue lvsmallest;
    + * LongValue lvzero;
    + * LongValue lvlargest;
    + *
    + * the following is true:
    + *
    + * lvsmallest == Long.MIN_VALUE
    + * lvzero == 0
    + * lvlargest == Long.MAX_VALUE
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/LongValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.LongValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field flsmallest = execClass.fieldByName("smallest"); + Field flzero = execClass.fieldByName("zero"); + Field fllargest = execClass.fieldByName("largest"); + + LongValue lvsmallest = (LongValue) execClass.getValue(flsmallest); + LongValue lvzero = (LongValue) execClass.getValue(flzero); + LongValue lvlargest = (LongValue) execClass.getValue(fllargest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (lvsmallest.value() != Long.MIN_VALUE) + expresult = 1; + break; + + case 1: if (lvzero.value() != 0) + expresult = 1; + break; + + case 2: if (lvlargest.value() != Long.MAX_VALUE) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..d8721aab0a5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/value/value001/TestDescription.java @@ -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/LongValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * LongValue. + * The test checks up that a result of the method + * com.sun.jdi.LongValue.value() + * complies with its spec: + * public long value() + * Returns this LongValue as a long. + * Returns: the long mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.LongValue.value.value001; + * a debuggee program - nsk.jdi.LongValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.LongValue.value.value001 + * nsk.jdi.LongValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.LongValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/value/value001a.java new file mode 100644 index 00000000000..1806e42a84c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LongValue/value/value001a.java @@ -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.LongValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static long smallest = Long.MIN_VALUE; + public static long zero = 0; + public static long largest = Long.MAX_VALUE; + +// public static long plus1_1 = +1; +// public static long plus1_2 = +1; +// public static long minus1 = -1; + +// public static float floatplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.Method:
    + * + * - locationsOfLine(int) for boundary values of Integer
    + * + * - locationsOfLine(String, String, int) for boundary values of + * Integer and various combinations of value of String arguments + * such as (null, "", ), where + * means the some names of nonexisting object.
    + * + * - variablesByName(String) for various combinations of value + * of String arguments (see the notes above)
    + * + * - locationOfCodeIndex(long) for boundary values + * of Long
    + * + * - equals(Object) for null value
    + * + * - bytecodes() is checked on length of return array
    + * + * These checking are performed for native and non-native methods. + */ +public class bounds001 { + + private final static String prefix = "nsk.jdi.Method._bounds_."; + private final static String debuggerName = prefix + "bounds001"; + private final static String debugeeName = debuggerName + "a"; + private final static String classWithNativeMethod = "java.lang.System"; + private final static String nativeMethod = "currentTimeMillis"; + + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + public static int exitStatus; + public static Log log; + public static Debugee debugee; + + private static String propertyValue = "something"; + private static int lineNumbers[] = { + Integer.MIN_VALUE, + -1, + Integer.MAX_VALUE + }; + + private static long codeIndexes[] = { + Long.MIN_VALUE, + -1, + Long.MAX_VALUE + }; + + private static String[][] strParams = { + {null, null }, + {null, "" }, + {null, "bounds001_hotchpotch"}, + {"", null }, + {"", "" }, + {"", "bounds001_hotchpotch"}, + {"bounds001_jumble", null }, + {"bounds001_jumble", "" }, + {"bounds001_jumble", "bounds001_hotchpotch"} + }; + +//---------------------------------------------------- + + public static void display(String msg) { + log.display(msg); + } + + public static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds001 thisTest = new bounds001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType testedClass = debugee.classByName(debugeeName); + Method method = methodByName(testedClass, bounds001a.justMethod); + + ReferenceType classNM = debugee.classByName(classWithNativeMethod); + Method nativeM = methodByName(classNM, nativeMethod); + + display("\nTEST BEGINS"); + display("==========="); + + checkMethod(method); + + display("============="); + + checkMethod(nativeM); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private void checkMethod(Method method) { + List list = null; + display(""); + display(">checking method: " + method); + display(">is native? " + method.isNative()); + + display("invoking locationsOfLine(int):"); + display("------------------------------"); + for (int i = 0; i < lineNumbers.length; i++) { + display("\tparameter: " + lineNumbers[i]); + try { + list = method.locationsOfLine(lineNumbers[i]); + display("\tsize of locations list: " + list.size()); + if (list.size() > 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + display("invoking locationsOfLine(String, String, int):"); + display("----------------------------------------------"); + for (int i = 0; i < lineNumbers.length; i++) { + for (int j = 0; j < strParams.length; j++) { + display("\tparameters: \"" + strParams[j][0] + "\", \"" + + strParams[j][1] + "\", " + lineNumbers[i]); + try { + list = method.locationsOfLine(strParams[j][0], strParams[j][1], + lineNumbers[i]); + display("\tsize of locations list: " + list.size()); + if (list.size() > 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + } + + display("invoking variablesByName(String):"); + display("---------------------------------"); + for (int j = 0; j < strParams.length; j++) { + display("\tparameter: \"" + strParams[j][0] + "\""); + try { + list = method.variablesByName(strParams[j][0]); + display("\tsize of variables list: " + list.size()); + if (list.size() > 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + if (method.isNative()) { + display("\tExpected: " + e); + } else { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + j += 2; + } + + + Location loc; + display("invoking locationOfCodeIndex(long):"); + display("-----------------------------------"); + for (int i = 0; i < codeIndexes.length; i++) { + display("\tparameter: " + codeIndexes[i]); + try { + loc = method.locationOfCodeIndex(codeIndexes[i]); + display("\tlocation: " + loc); + if (loc != null) { + complain("\twrong location"); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + display("invoking equals(Object):"); + display("----------------------"); + display("\tparameter: "); + try { + if (!method.equals(null)) { + display("\tis not equal to "); + } else { + complain("\tis equal to "); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + + byte[] bytes; + display("invoking bytecodes():"); + display("---------------------"); + try { + bytes = method.bytecodes(); + display("\tsize of byte codes: " + bytes.length); + if (method.isNative()) { + if (bytes.length > 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } else { + if (bytes.length == 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + private Method methodByName(ReferenceType refType, String methodName) { + List methodList = refType.methodsByName(methodName); + if (methodList == null) return null; + Method method = (Method )methodList.get(0); + return method; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/_bounds_/bounds001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/_bounds_/bounds001/TestDescription.java new file mode 100644 index 00000000000..92a86e9a630 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/_bounds_/bounds001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/Method/_bounds_/bounds001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the following methods of com.sun.jdi.Method: + * - locationsOfLine(int) for boundary values of Integer + * - locationsOfLine(String, String, int) for boundary values of + * Integer and various combinations of value of String arguments + * such as null, "", , where means the some + * names of nonexisting object. + * - variablesByName(String) for various combinations of value of + * String arguments (see the notes above) + * - locationOfCodeIndex(long) for boundary values of Long + * - equals(Object) for null-value + * - bytecodes() is checked on length of return array + * These checking are performed for native and non-native methods. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method._bounds_.bounds001 + * nsk.jdi.Method._bounds_.bounds001a + * + * @comment make sure bounds001a is compiled with full debug info + * @clean nsk.jdi.Method._bounds_.bounds001a + * @compile -g:lines,source,vars ../bounds001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method._bounds_.bounds001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/_bounds_/bounds001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/_bounds_/bounds001a.java new file mode 100644 index 00000000000..1006da9cf48 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/_bounds_/bounds001a.java @@ -0,0 +1,54 @@ +/* + * 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.Method._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * bounds001a is deugee's part of the bounds001. + */ +public class bounds001a { + + public final static String justMethod = "justMethod"; + + 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(bounds001.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(bounds001.SGNL_QUIT)) { + log.display("constructor> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("constructor> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + void justMethod() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java new file mode 100644 index 00000000000..fb414a818c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java @@ -0,0 +1,274 @@ +/* + * 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.Method.allLineLocations; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.allLineLocations()
    + * complies with its spec and returns an empty list
    + * when invoked on abstract and native methods.
    + */ + +public class alllinelocations001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/allLineLocations/alllinelocations001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new alllinelocations001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.allLineLocations.alllinelocations001a"; + + String mName = "nsk.jdi.Method.allLineLocations"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + List methods = null; + Method m = null; + List locations = null; + + + log2("----testing case: abstract method"); + + log2(" List classes = vm.classesByName(mName + '.AClass');"); + classes = vm.classesByName(mName + ".AClass"); + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1 for abstract class"); + break ; + } + log2(" methods = ((ReferenceType) classes.get(0)).methodsByName('atest');"); + methods = ((ReferenceType) classes.get(0)).methodsByName("atest"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 : " + methods.size()); + testExitCode = FAILED; + break; + } + + log2(" Method m = (Method) methods.get(0);"); + m = (Method) methods.get(0); + log2(" if (!m.isAbstract())"); + if (!m.isAbstract()) { + log3("ERROR : method 'atest' is not an abstract as expected"); + testExitCode = FAILED; + break; + } + + log2("......locations = m.allLineLocations(); AbsentInformationException is not expected"); + try { + locations = m.allLineLocations(); + } catch ( AbsentInformationException e ) { + log3("ERROR : AbsentInformationException for abstract method"); + testExitCode = FAILED; + break; + } + if (locations.size() != 0) { + log3("ERROR : locations.size() != 0 for abstract method"); + testExitCode = FAILED; + break; + } + + + log2("----testing case: native method"); + + log2(" List classes = vm.classesByName(mName + '.TestClass1');"); + classes = vm.classesByName(mName + ".TestClass1"); + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1 for native method"); + break ; + } + log2(" List methods = ((ReferenceType) classes.get(0)).methodsByName('test1');"); + methods = ((ReferenceType) classes.get(0)).methodsByName("test1"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test1 :" + methods.size()); + testExitCode = FAILED; + break; + } + log2(" Method m = (Method) methods.get(0);"); + m = (Method) methods.get(0); + log2(" if (!m.isNative())"); + if (!m.isNative()) { + log3("ERROR : 'test1' is not a native method as expected"); + testExitCode = FAILED; + break; + } + + log2("......locations = m.allLineLocations(); AbsentInformationException is not expected"); + try { + locations = m.allLineLocations(); + } catch ( AbsentInformationException e ) { + log3("ERROR : AbsentInformationException for abstract method"); + testExitCode = FAILED; + break; + } + if (locations.size() != 0) { + log3("ERROR : locations.size() != 0 for abstract method"); + testExitCode = FAILED; + break; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001/TestDescription.java new file mode 100644 index 00000000000..2a9cb2abfdb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001/TestDescription.java @@ -0,0 +1,102 @@ +/* + * 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/Method/allLineLocations/alllinelocations001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.allLineLocations() + * complies with its spec: + * public java.util.List allLineLocations() + * throws AbsentInformationException + * Returns the beginning Location objects for each executable source line in + * this method. Each location maps a source line to a range of code indices. + * The beginning of the range can be determined through Location.codeIndex(). + * The returned list is ordered by code index (from low to high). + * The returned list may contain multiple locations for + * a particular line number, if the compiler and/or VM has mapped that line to + * two or more disjoint code index ranges. + * If the method is native or abstract, an empty list is returned. + * Returns: a List of all source line Location objects. + * Throws: AbsentInformationException - + * if there is no line number information for this + * (non-native, non-abstract) method. + * when a tested method is native or abstract and + * when no AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.allLineLocations.alllinelocations001; + * the debuggee program - nsk.jdi.Method.allLineLocations.alllinelocations001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * In general, this test is potentially option depended + * since its spec states: + * Throws: AbsentInformationException - + * if there is no line number information for this + * (non-native, non-abstract) method. + * However, unlike some tests that need to be compiled with the option + * JAVAC_OPTS=-g + * (method.arguments(), method.variables() and method.variablesByName) + * at the date of implementing the test, + * javac prepares full information for the test without the option. + * Nonetheless, the alllinelocations002.cfg file contains the option + * in order to avoid possible failures in future in case of any changes + * in javac. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.allLineLocations.alllinelocations001 + * nsk.jdi.Method.allLineLocations.alllinelocations001a + * + * @comment make sure alllinelocations001a is compiled with full debug info + * @clean nsk.jdi.Method.allLineLocations.alllinelocations001a + * @compile -g:lines,source,vars ../alllinelocations001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.allLineLocations.alllinelocations001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001a.java new file mode 100644 index 00000000000..2fad5ec76e9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001a.java @@ -0,0 +1,140 @@ +/* + * 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.Method.allLineLocations; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the alllinelocations001 JDI test. + */ + +public class alllinelocations001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> alllinelocations001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> alllinelocations001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.allLineLocations()
    + * complies with its spec for non-abstract, non-native method.
    + * The test checks up that a list of locations for the method
    + * - is not empty and
    + * - is ordered in a proper, from low to high, sequence.
    + */ + +public class alllinelocations002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/allLineLocations/alllinelocations002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new alllinelocations002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.display(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.allLineLocations.alllinelocations002a"; + + String mName = "nsk.jdi.Method.allLineLocations"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List methods = null; + Method m = null; + List locations = null; + + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested method object 'm'"); + methods = ((ReferenceType) classes.get(0)).methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + log2("......locations = m.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = m.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + if (locations.size() == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + log2("......checking up element order in the List"); + + ListIterator listIterator = locations.listIterator(); + + Location location1 = null; + Location location2 = null; + + int i2; + + for (i2 = 0; listIterator.hasNext(); i2++) { + + long codeIndex1 = 0l; + long codeIndex2 = 0l; + + try { + location2 = (Location) listIterator.next(); + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + break ; + } + codeIndex2 = location2.codeIndex(); + if (i2 == 0) { + continue; + } + + if (codeIndex2 < codeIndex1) { + testExitCode = FAILED; + log3("ERROR: codeIndex disorder: codeIndex2 < codeIndex1"); + break ; + } + + codeIndex1 = codeIndex2; + } + + log2("......compareing locations.size() to a processed number of elements in the list"); + if (locations.size() != i2) { + testExitCode = FAILED; + log3("ERROR: locations.size() != the processed number"); + break ; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002/TestDescription.java new file mode 100644 index 00000000000..ec92566c07e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002/TestDescription.java @@ -0,0 +1,102 @@ +/* + * 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/Method/allLineLocations/alllinelocations002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.allLineLocations() + * complies with its spec: + * public java.util.List allLineLocations() + * throws AbsentInformationException + * Returns the beginning Location objects for each executable source line in + * this method. Each location maps a source line to a range of code indices. + * The beginning of the range can be determined through Location.codeIndex(). + * The returned list is ordered by code index (from low to high). + * The returned list may contain multiple locations for + * a particular line number, if the compiler and/or VM has mapped that line to + * two or more disjoint code index ranges. + * If the method is native or abstract, an empty list is returned. + * Returns: a List of all source line Location objects. + * Throws: AbsentInformationException - + * if there is no line number information for this + * (non-native, non-abstract) method. + * when a tested method is non-native, non-abstract and + * when no AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.allLineLocations.alllinelocations002; + * the debuggee program - nsk.jdi.Method.allLineLocations.alllinelocations002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * In general, this test is potentially option depended + * since its spec states: + * Throws: AbsentInformationException - + * if there is no line number information for this + * (non-native, non-abstract) method. + * However, unlike some tests that need to be compiled with the option + * JAVAC_OPTS=-g + * (method.arguments(), method.variables() and method.variablesByName) + * at the date of implementing the test, + * javac prepares full information for the test without the option. + * Nonetheless, the alllinelocations002.cfg file contains the option + * in order to avoid possible failures in future in case of any changes + * in javac. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.allLineLocations.alllinelocations002 + * nsk.jdi.Method.allLineLocations.alllinelocations002a + * + * @comment make sure alllinelocations002a is compiled with full debug info + * @clean nsk.jdi.Method.allLineLocations.alllinelocations002a + * @compile -g:lines,source,vars ../alllinelocations002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.allLineLocations.alllinelocations002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002a.java new file mode 100644 index 00000000000..96fdd8ba985 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002a.java @@ -0,0 +1,205 @@ +/* + * 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.Method.allLineLocations; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the alllinelocations002JDI test. + */ + +public class alllinelocations002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> alllinelocations002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> alllinelocations002a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... ... + * 16 --> 1007, source1 + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... ... + * 27 --> 1107, source1 + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... ... + * 38 --> 1207, source1 + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for all methods defined in this class method 'com.sun.jdi.Method.allLineLocations(String stratum, String sourceName)' + * returns only expected locations for all stratums: for 'Java' stratum, and for stratums 'TestStratum1'-'TestStratum3'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.allLineLocations_ss.allLineLocations_ss002.allLineLocations_ss002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.allLineLocations_ss.allLineLocations_ss002.allLineLocations_ss002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.Method.allLineLocations_ss.allLineLocations_ss002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class allLineLocations_ss002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new allLineLocations_ss002().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData; + + testStratumData = prepareDefaultPatchedClassFile_Type1(className, testStratumCount, true); + + /* + * Method 'prepareDefaultPatchedClassFile_Type1' creates class file with + * following line mapping for each TestStratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... + * ... + * 16 --> 1007, source1 + * + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... + * ... + * 27 --> 1107, source1 + * + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... + * ... + * 38 --> 1207, source1 + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + for (Method method : referenceType.methods()) { + List expectedLocations = testStratumData.get(stratumName).allLocations; + + // all locations has the same source + String locationsSource = expectedLocations.get(0).sourceName; + + log.display("Check locations for method '" + method.name() + "': stratum: " + stratumName + ", source " + + locationsSource); + + try { + compareLocations(method.allLineLocations(stratumName, locationsSource), locationsOfMethod( + expectedLocations, + method.name()), stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + log.display("Check locations for method '" + method.name() + "': stratum: " + stratumName + ", source " + + null); + + try { + compareLocations(method.allLineLocations(stratumName, null), locationsOfMethod( + expectedLocations, + method.name()), stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java new file mode 100644 index 00000000000..fc2f4e540bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2007, 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/Method/allLineLocations_ss/allLineLocations_ss003. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.Method.allLineLocations(String stratum, String sourceName)' returns + * correct values for all stratums available for class and if sourceName == null locaitions for all sources are returned. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined (each method has locations in 3 different sources): + * "Java" "TestStratum" + * + * 9 --> 1000, source1, path1 + * 10 --> 1000, source2, path2 + * 11 --> 1000, source3, path3 + * ... ... + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1100, source2, path2 + * 22 --> 1100, source3, path3 + * ... ... + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1200, source2, path2 + * 33 --> 1200, source3, path3 + * ... ... + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for all methods defined in this class method 'com.sun.jdi.Method.allLineLocations(String stratum, String sourceName)' + * returns only expected locations for all stratums(for 'Java' stratum, and for stratums 'TestStratum1'-'TestStratum3') depending on given source name, + * and if source name is null locations for all sources are returned. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.allLineLocations_ss.allLineLocations_ss003.allLineLocations_ss003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.allLineLocations_ss.allLineLocations_ss003.allLineLocations_ss003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.Method.allLineLocations_ss.allLineLocations_ss003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class allLineLocations_ss003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new allLineLocations_ss003().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type2(className, testStratumCount); + /* + * Method 'prepareDefaultPatchedClassFile_Type2' creates class file with + * following line mapping for each test stratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1, path1 + * 10 --> 1001, source2, path2 + * 11 --> 1002, source3, path3 + * ... + * ... + * + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1101, source2, path2 + * 22 --> 1102, source3, path3 + * ... + * ... + * + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1201, source2, path2 + * 33 --> 1207, source3, path3 + * ... + * ... + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + LocationsData locationsData = testStratumData.get(stratumName); + + for (Method method : referenceType.methods()) { + // for all available sources names + for (String sourceName : locationsData.sourceLocations.keySet()) { + List expectedLocations = locationsData.sourceLocations.get(sourceName); + + log.display("Check locations for method '" + method.name() + "': stratum: " + stratumName + + ", source " + sourceName); + + try { + compareLocations(method.allLineLocations(stratumName, sourceName), locationsOfMethod( + expectedLocations, + method.name()), stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } + + // check case when sourceName is null + log.display("Check locations for method '" + method.name() + "': stratum: " + stratumName + ", source " + + null); + + try { + compareLocations(method.allLineLocations(stratumName, null), locationsOfMethod( + locationsData.allLocations, + method.name()), stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java new file mode 100644 index 00000000000..fb1704acf15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java @@ -0,0 +1,272 @@ +/* + * 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.Method.allLineLocations_ss; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.allLineLocations(String,String)
    + * complies with its spec.
    + *
    + * The case for testing includes only non-abstract, non-native
    + * method and defaultStratum.
    + * The test checks up that a list of locations for the method
    + * - is not empty and
    + * - is ordered in a proper, from low to high, sequence.
    + */ + +public class alllinelocations_ss001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new alllinelocations_ss001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001a"; + + String mName = "nsk.jdi.Method.allLineLocations_ss"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List methods = null; + Method m = null; + List locations = null; + + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + + log2(" getting a tested Method object 'm'"); + methods = ((ReferenceType) classes.get(0)).methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + log2("......locations = m.allLineLocations(defaultStratum, null);"); + log2(" no AbsentInformationException is expected"); + try { + locations = m.allLineLocations(defaultStratum, null); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + if (locations.size() == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + log2("......checking up on element order in the List"); + + ListIterator listIterator = locations.listIterator(); + + Location location1 = null; + Location location2 = null; + + int i2; + + for (i2 = 0; listIterator.hasNext(); i2++) { + + long codeIndex1 = 0l; + long codeIndex2 = 0l; + + try { + location2 = (Location) listIterator.next(); + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + break ; + } + codeIndex2 = location2.codeIndex(); + if (i2 == 0) { + continue; + } + + if (codeIndex2 < codeIndex1) { + testExitCode = FAILED; + log3("ERROR: codeIndex disorder: codeIndex2 < codeIndex1"); + break ; + } + + codeIndex1 = codeIndex2; + } + + log2("......compareing locations.size() to a processed number of elements in the list"); + if (locations.size() != i2) { + testExitCode = FAILED; + log3("ERROR: locations.size() != the processed number"); + break ; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001/TestDescription.java new file mode 100644 index 00000000000..84f588dbda8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001/TestDescription.java @@ -0,0 +1,104 @@ +/* + * 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/Method/allLineLocations_ss/alllinelocations_ss001. + * VM Testbase keywords: [jpda, jdi, feature_sde] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.allLineLocations(String,String) + * complies with its spec: + * public List allLineLocations(String stratum, String sourceName) + * throws AbsentInformationException + * Returns a list containing a Location object for + * each executable source line in this method. + * Each location maps a source line to a range of code indices. + * The beginning of the range can be determined through Location.codeIndex(). + * The returned list is ordered by code index (from low to high). + * The returned list may contain multiple locations for + * a particular line number, if the compiler and/or VM has mapped that line + * to two or more disjoint code index ranges. + * If the method is native or abstract, an empty list is returned. + * Returned list is for the specified stratum + * (see Location for a description of strata). + * Parameters: stratum - The stratum to retrieve information from or + * null for the #defaultStratum() + * sourceName - Return locations only within this source file or + * null to return locations. + * Returns: a List of all source line Location objects. + * Throws: AbsentInformationException - + * if there is no line number information for this + * (non-native, non-abstract) method. + * Or if sourceName is non-null and + * source name information is not present. + * The case for testing includes only non-abstract, + * non-native method and defaultStratum. + * The test checks up that a list of locations for the method + * - is not empty and + * - is ordered in a proper, from low to high, sequence. + * The test works as follows: + * The debugger program - nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001; + * the debuggee program - nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The option + * JAVAC_OPTS=-g + * is put in the locationsofline002.cfg file. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001 + * nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001a + * + * @comment make sure alllinelocations_ss001a is compiled with full debug info + * @clean nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001a + * @compile -g:lines,source,vars ../alllinelocations_ss001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.allLineLocations_ss.alllinelocations_ss001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001a.java new file mode 100644 index 00000000000..9d493684186 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001a.java @@ -0,0 +1,146 @@ +/* + * 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.Method.allLineLocations_ss; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the alllinelocations_ss001 JDI test. + */ + +public class alllinelocations_ss001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.argumentTypeNames()
    + * complies with its spec when a type is one of PrimitiveTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class TestClass {
    + * public void primitiveargsmethod (
    + * boolean bl,
    + * byte bt,
    + * char ch,
    + * double db,
    + * float fl,
    + * int in,
    + * long l,
    + * short sh ) {
    + * return ;
    + * }
    + * }
    + * for all of the above primitive type arguments,
    + * a debugger forms text strings with corresponding
    + * types, that is 'boolean', 'byte', 'char', and etc.
    + *
    + */ + +public class argumenttypenames001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/argumentTypeNames/argumenttypenames001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new argumenttypenames001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.argumentTypeNames.argumenttypenames001a"; + + String mName = "nsk.jdi.Method.argumentTypeNames"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("argumenttypenames001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".argumenttypenames001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + + List argTypeNames = null; + + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + argTypeNames = m.argumentTypeNames(); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean arg + + if (!argTypeNames.contains("boolean")) { + log3("ERROR: !argTypes.contains('boolean')"); + expresult = 1; + break; + } + break; + + case 1: // byte arg + + if (!argTypeNames.contains("byte")) { + log3("ERROR: !argTypes.contains('byte')"); + expresult = 1; + break; + } + break; + + case 2: // char arg + + if (!argTypeNames.contains("char")) { + log3("ERROR: !argTypes.contains('char')"); + expresult = 1; + break; + } + break; + + case 3: // double arg + + if (!argTypeNames.contains("double")) { + log3("ERROR: !argTypes.contains('double')"); + expresult = 1; + break; + } + break; + + case 4: // float arg + + if (!argTypeNames.contains("float")) { + log3("ERROR: !argTypes.contains('float')"); + expresult = 1; + break; + } + break; + case 5: // int arg + + if (!argTypeNames.contains("int")) { + log3("ERROR: !argTypes.contains('int')"); + expresult = 1; + break; + } + break; + + case 6: // long arg + + if (!argTypeNames.contains("long")) { + log3("ERROR: !argTypes.contains('long')"); + expresult = 1; + break; + } + break; + + case 7: // short arg + + if (!argTypeNames.contains("short")) { + log3("ERROR: !argTypes.contains('short')"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames001/TestDescription.java new file mode 100644 index 00000000000..20966f2daad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/Method/argumentTypeNames/argumenttypenames001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.argumentTypeNames() + * complies with its spec: + * public java.util.List argumentTypeNames() + * Returns a text representation of all declared argument types of this method. + * This list is always available even if + * argument variables are unavailable due to absent debug information. + * Returns: a List of strings containing the return type name. + * when methods' arguments are of PrimitiveTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.argumentTypeNames.argumenttypenames001; + * the debuggee program - nsk.jdi.Method.argumentTypeNames.argumenttypenames001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.argumentTypeNames.argumenttypenames001 + * nsk.jdi.Method.argumentTypeNames.argumenttypenames001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.argumentTypeNames.argumenttypenames001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames001a.java new file mode 100644 index 00000000000..84ed0043c59 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames001a.java @@ -0,0 +1,198 @@ +/* + * 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.Method.argumentTypeNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the argumenttypenames001 JDI test. + */ + +public class argumenttypenames001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> argumenttypenames001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> argumenttypenames001a: " + message); + } + + //====================================================== test program + + static argumenttypenames001aTestClass obj = new argumenttypenames001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.argumentTypeNames()
    + * complies with its spec when a type is one of PrimitiveTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class TestClass {
    + * .
    + * .
    + * public ClassForCheck[] arrayargmethod (ClassForCheck[] cfc) {
    + * return cfc;
    + * }
    + * public ClassForCheck classargmethod (ClassForCheck classFC) {
    + * return classFC;
    + * }
    + * public InterfaceForCheck ifaceargmethod (InterfaceForCheck iface) {
    + * return iface;
    + * }
    + * }

    + * for all of the above ReferenceType arguments,
    + * a debugger forms text strings with corresponding
    + * types, that is "ClassForCheck[]", "ClassForCheck",
    + * and "InterfaceForCheck".
    + *
    + */ + +public class argumenttypenames002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/argumentTypeNames/argumenttypenames002", + sHeader2 = "--> argumenttypenames002: ", + sHeader3 = "##> argumenttypenames002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new argumenttypenames002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.argumentTypeNames.argumenttypenames002a"; + + String mName = "nsk.jdi.Method.argumentTypeNames"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("argumenttypenames002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".argumenttypenames002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + + List argTypeNames = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // array arg + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("arrayargmethod"); + m = (Method) methods.get(0); + argTypeNames = m.argumentTypeNames(); + + if (!argTypeNames.contains(mName + ".argumenttypenames002aClassForCheck1[]")) { + log3("ERROR: !argTypeNames.contains(mName + '.argumenttypenames002aClassForCheck1[]'"); + expresult = 1; + break; + } + break; + + + case 1: // class arg + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("classargmethod"); + m = (Method) methods.get(0); + argTypeNames = m.argumentTypeNames(); + + if (!argTypeNames.contains(mName + ".argumenttypenames002aClassForCheck1")) { + log3("ERROR: !argTypeNames.contains(mName + '.argumenttypenames002aClassForCheck1'"); + expresult = 1; + break; + } + break; + + case 2: // interface arg + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ifaceargmethod"); + m = (Method) methods.get(0); + argTypeNames = m.argumentTypeNames(); + + if (!argTypeNames.contains(mName + ".argumenttypenames002aIntfForCheck")) { + log3("ERROR: !argTypeNames.contains(mName + '.argumenttypenames002aIntfForCheck'"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames002/TestDescription.java new file mode 100644 index 00000000000..e4b0a9fc161 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames002/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/Method/argumentTypeNames/argumenttypenames002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.argumentTypeNames() + * complies with its spec: + * public java.util.List argumentTypeNames() + * Returns a text representation of all declared argument types of this method. + * This list is always available even if + * argument variables are unavailable due to absent debug information. + * Returns: a List of strings containing the return type name. + * when methods' arguments are of ReferenceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.argumentTypeNames.argumenttypenames002; + * the debuggee program - nsk.jdi.Method.argumentTypeNames.argumenttypenames002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.argumentTypeNames.argumenttypenames002 + * nsk.jdi.Method.argumentTypeNames.argumenttypenames002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.argumentTypeNames.argumenttypenames002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames002a.java new file mode 100644 index 00000000000..8f0ff321da0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames002a.java @@ -0,0 +1,199 @@ +/* + * 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.Method.argumentTypeNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the argumenttypenames002 JDI test. + */ + +public class argumenttypenames002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> argumenttypenames002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> argumenttypenames002a: " + message); + } + + //====================================================== test program + + static argumenttypenames002aTestClass obj = new argumenttypenames002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + private static void failure(String msg) { + complain(msg); + exitStatus = Consts.TEST_FAILED; + } + + public static int run(String argv[], PrintStream out) { + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + failure("Class '" + debuggeeName + "' not found."); + } + + execTest(); + debuggee.quit(); + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + String expMethodName = "foo"; + String[][] expSignatures = { /* signature of method varargs type name */ + {"([I)Ljava/lang/String;", "int[]"}, + {"([Ljava/lang/Integer;)Ljava/lang/String;", "java.lang.Integer[]"}, + {"(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;", "java.lang.String[]"} + }; + + for (int i = 0; i < expSignatures.length; i++) { + List methods = debuggeeClass.methodsByName(expMethodName); + Method method = ((ClassType)debuggeeClass).concreteMethodByName(expMethodName, expSignatures[i][0]); + if (method != null) { + try { + List typeNames = method.argumentTypeNames(); + if (typeNames.contains(expSignatures[i][1])) { + display("Method.argumentTypeNames() returned expected varargs type name " + expSignatures[i][1]); + } else { + failure("Method.argumentTypeNames() did not return expected varargs type name " + expSignatures[i][1]); + } + + } catch (Exception e) { + failure("Unexpected exception: " + e); + e.printStackTrace(System.out); + } + } else { + failure("Cannot find method with signature: " + expSignatures[i][0]); + } + } + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003/TestDescription.java new file mode 100644 index 00000000000..90b895f2f11 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003/TestDescription.java @@ -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/Method/argumentTypeNames/argumenttypenames003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for argumentTypeNames() method of Method interface. + * The test checks if the method returns string representing array + * of the type before the ellipsis for any mirrored method which has + * varargs argument. + * The test consists of a debugger program (argumenttypenames003.java) + * and debuggee application (argumenttypenames003a.java). + * Package name is nsk.jdi.Method.argumentTypeNames . + * 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 finds mirrors of debuggee's methods 'foo' + * which have varargs arguments and calls argumentTypeNames() method + * for each found method mirror. The test checks if returned + * list contains a string representing expected array type + * of vararg argument. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.argumentTypeNames.argumenttypenames003 + * nsk.jdi.Method.argumentTypeNames.argumenttypenames003a + * + * @comment make sure argumenttypenames003a is compiled with full debug info + * @clean nsk.jdi.Method.argumentTypeNames.argumenttypenames003a + * @compile -g:lines,source,vars ../argumenttypenames003a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.argumentTypeNames.argumenttypenames003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003a.java new file mode 100644 index 00000000000..a51fa9b18e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003a.java @@ -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.Method.argumentTypeNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class argumenttypenames003a { + + //------------------------------------------------------- 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 + + //------------------------------------------------------ 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(argumenttypenames003.SIGNAL_READY); + receiveSignal(argumenttypenames003.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific methods + + static String foo (int... args) { + return "1"; + } + + static String foo (Integer... args) { + return "2"; + } + + static String foo (String s, String... args) { + return "3"; + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001.java new file mode 100644 index 00000000000..e9882b87efa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001.java @@ -0,0 +1,433 @@ +/* + * 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.Method.argumentTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.argumentTypes()
    + * complies with its spec when a type is one of PrimitiveTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class argumenttypes001aTestClass {
    + * public void primitiveargsmethod (
    + * boolean bl,
    + * byte bt,
    + * char ch,
    + * double db,
    + * float fl,
    + * int in,
    + * long l,
    + * short sh ) {
    + * return ;
    + * }
    + * }
    + * for all of the above primitive type arguments,
    + * a debugger forms their corresponding Type objects
    + * BooleanType, ByteType, CharType, etc.
    + *
    + */ + +public class argumenttypes001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/argumentTypes/argumenttypes001", + sHeader2 = "--> argumenttypes001: ", + sHeader3 = "##> argumenttypes001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new argumenttypes001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.argumentTypes.argumenttypes001a"; + + String mName = "nsk.jdi.Method.argumentTypes"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("argumenttypes001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".argumenttypes001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + Method m1 = null; + List argTypes = null; + + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + try { + argTypes = m.argumentTypes(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: CNLE: argTypes = m.argumentTypes();"); + testExitCode = FAILED; + break; + } + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean arg + BooleanType blType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("bl"); + m1 = (Method) methods.get(0); + try { + blType = (BooleanType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (BooleanType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (BooleanType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(blType)) { + log3("ERROR: !argTypes.contains(blType)"); + expresult = 1; + break; + } + break; + + case 1: // byte arg + ByteType btType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("bt"); + m1 = (Method) methods.get(0); + try { + btType = (ByteType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ByteType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ByteType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(btType)) { + log3("ERROR: !argTypes.contains(btType)"); + expresult = 1; + break; + } + break; + + case 2: // char arg + CharType chType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ch"); + m1 = (Method) methods.get(0); + try { + chType = (CharType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (CharType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: CharType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(chType)) { + log3("ERROR: !argTypes.contains(chType)"); + expresult = 1; + break; + } + break; + + case 3: // double arg + DoubleType dbType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("db"); + m1 = (Method) methods.get(0); + try { + dbType = (DoubleType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (DoubleType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (DoubleType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(dbType)) { + log3("ERROR: !argTypes.contains(dbType)"); + expresult = 1; + break; + } + break; + + case 4: // float arg + FloatType flType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("fl"); + m1 = (Method) methods.get(0); + try { + flType = (FloatType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (FloatType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (FloatType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(flType)) { + log3("ERROR: !argTypes.contains(flType)"); + expresult = 1; + break; + } + break; + case 5: // int arg + IntegerType inType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("in"); + m1 = (Method) methods.get(0); + try { + inType = (IntegerType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (IntegerType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (IntegerType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(inType)) { + log3("ERROR: !argTypes.contains(inType)"); + expresult = 1; + break; + } + break; + + case 6: // long arg + LongType lnType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ln"); + m1 = (Method) methods.get(0); + try { + lnType = (LongType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (LongType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (LongType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(lnType)) { + log3("ERROR: !argTypes.contains(lnType)"); + expresult = 1; + break; + } + break; + + case 7: // short arg + ShortType shType = null; + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("sh"); + m1 = (Method) methods.get(0); + try { + shType = (ShortType) m1.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ShortType) m1.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ShortType) m1.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(shType)) { + log3("ERROR: !argTypes.contains(shType)"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001/TestDescription.java new file mode 100644 index 00000000000..09ee5295c25 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001/TestDescription.java @@ -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/Method/argumentTypes/argumenttypes001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.argumentTypes() + * complies with its spec: + * public java.util.List argumentTypes() + * throws ClassNotLoadedException + * Returns the list containing the type of each argument. + * For primitive arguments, an appropriate PrimitiveType is always returned. + * For object arguments, the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's + * (that is, the type returned by TypeComponent#enclosingType) class loader. + * Returns: the list of argument types for this method. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when methods' arguments are of PrimitiveTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.argumentTypes.argumenttypes001; + * the debuggee program - nsk.jdi.Method.argumentTypes.argumenttypes001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.argumentTypes.argumenttypes001 + * nsk.jdi.Method.argumentTypes.argumenttypes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.argumentTypes.argumenttypes001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001a.java new file mode 100644 index 00000000000..f56f5285c75 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes001a.java @@ -0,0 +1,202 @@ +/* + * 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.Method.argumentTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the argumenttypes001 JDI test. + */ + +public class argumenttypes001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> argumenttypes001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> argumenttypes001a: " + message); + } + + //====================================================== test program + + static argumenttypes001aTestClass obj = new argumenttypes001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.argumentTypes()
    + * complies with its spec when a type is one of PrimitiveTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class argumenttypes002aTestClass {
    + * .
    + * .
    + * public ClassForCheck[] arrayargmethod (ClassForCheck[] cfc) {
    + * return cfc;
    + * }
    + * public ClassForCheck classargmethod (ClassForCheck classFC) {
    + * return classFC;
    + * }
    + * public InterfaceForCheck ifaceargmethod (InterfaceForCheck iface) {
    + * return iface;
    + * }
    + * }

    + * for all of the above ReferenceType arguments,
    + * a debugger forms their corresponding Type objects:
    + * ClassForCheck[], ClassForCheck, and InterfaceForCheck.
    + *
    + */ + +public class argumenttypes002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/argumentTypes/argumenttypes002", + sHeader2 = "--> argumenttypes002: ", + sHeader3 = "##> argumenttypes002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new argumenttypes002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.argumentTypes.argumenttypes002a"; + + String mName = "nsk.jdi.Method.argumentTypes"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("argumenttypes002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".argumenttypes002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + ReferenceType testClass = (ReferenceType) listOfDebuggeeClasses.get(0); + + List methods = null; + Method m = null; + List argTypes = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // array arg + + methods = testClass.methodsByName("arrayargmethod"); + m = (Method) methods.get(0); + try { + argTypes = m.argumentTypes(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: CNLE: argTypes = m.argumentTypes(); for arrayargmethod"); + testExitCode = FAILED; + break; + } + + ArrayType aType = null; + try { + aType = (ArrayType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ArrayType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ArrayType) m.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(aType)) { + log3("ERROR: !argTypes.contains(aType)"); + expresult = 1; + break; + } + break; + + case 1: // class arg + + methods = testClass.methodsByName("classargmethod"); + m = (Method) methods.get(0); + try { + argTypes = m.argumentTypes(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: CNLE: argTypes = m.argumentTypes(); for classargmethod"); + testExitCode = FAILED; + break; + } + + ClassType cType = null; + try { + cType = (ClassType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ClassType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ClassType) m.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(cType)) { + log3("ERROR: !argTypes.contains(cType)"); + expresult = 1; + break; + } + break; + + + case 2: // interface arg + + methods = testClass.methodsByName("ifaceargmethod"); + m = (Method) methods.get(0); + try { + argTypes = m.argumentTypes(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: CNLE: argTypes = m.argumentTypes(); for ifaceargmethod"); + testExitCode = FAILED; + break; + } + + InterfaceType iType = null; + try { + iType = (InterfaceType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (InterfaceType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (InterfaceType) m.returnType();"); + expresult = 1; + break; + } + + if (!argTypes.contains(iType)) { + log3("ERROR: !argTypes.contains(iType)"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes002/TestDescription.java new file mode 100644 index 00000000000..d9d7a4e54f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes002/TestDescription.java @@ -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/Method/argumentTypes/argumenttypes002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.argumentTypes() + * complies with its spec: + * public java.util.List argumentTypes() + * throws ClassNotLoadedException + * Returns the list containing the type of each argument. + * For primitive arguments, an appropriate PrimitiveType is always returned. + * For object arguments, the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's + * (that is, the type returned by TypeComponent#enclosingType) class loader. + * Returns: the list of argument types for this method. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when methods' arguments are of ReferenceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.argumentTypes.argumenttypes002; + * the debuggee program - nsk.jdi.Method.argumentTypes.argumenttypes002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.argumentTypes.argumenttypes002 + * nsk.jdi.Method.argumentTypes.argumenttypes002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.argumentTypes.argumenttypes002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes002a.java new file mode 100644 index 00000000000..7ef8c8d4d54 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/argumentTypes/argumenttypes002a.java @@ -0,0 +1,204 @@ +/* + * 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.Method.argumentTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the argumenttypes002 JDI test. + */ + +public class argumenttypes002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> argumenttypes002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> argumenttypes002a: " + message); + } + + //====================================================== test program + + static argumenttypes002aTestClass obj = new argumenttypes002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.arguments()
    + * complies with its spec if a debugged program is compiled with
    + * "-g" option, hence no exception AbsentInformationException
    + * is expected.
    + *
    + * Cases for testing are as follows:
    + * - non-native method with arguments
    + * - non-native method without arguments
    + * - native method
    + */ + +public class arguments001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/arguments/arguments001", + sHeader2 = "--> arguments001: ", + sHeader3 = "##> arguments001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new arguments001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.arguments.arguments001a"; + + String mName = "nsk.jdi.Method.arguments"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("arguments001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + + ".arguments001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + List argsList = null; + + + // method with arguments + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + check: { + try { + argsList = m.arguments(); + if (argsList.size() != 8) { + log3("ERROR: for method with arguments: argsList# != 8 :" + + argsList.size() ); + testExitCode = FAILED; + } + try { + for (int i2 = 0; i2 < argsList.size(); i2++) { + LocalVariable lv = (LocalVariable) argsList.get(i2); + int n = 0; + String names[] = { "bl", "bt", "ch", "db", + "fl", "in", "ln", "sh" }; + String name = lv.name(); + + for (int i3 = 0; i3 < 8; i3++) { + if (names[i3].equals(name)) { + if (n == 1) { + log3("ERROR: method with args: multiple arg names " + + name); + testExitCode = FAILED; + } + n++; + } + } + if (n == 0) { + log3("ERROR: method with args: no name in list: " + + name); + testExitCode = FAILED; + } + } + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException for lv = (LocalVariable) arglist.get(0);"); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for method with arguments"); + testExitCode = FAILED; + } + } //check: + + + // method without arguments + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("vd"); + m = (Method) methods.get(0); + + try { + argsList = m.arguments(); + if (argsList.size() != 0) { + log3("ERROR: for method without arguments: argsList# != 0 :" + + argsList.size() ); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for method without arguments"); + testExitCode = FAILED; + } + + + // native method + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("nvd"); + m = (Method) methods.get(0); + + try { + argsList = m.arguments(); + log3("ERROR: no AbsentInformationException for native method"); + testExitCode = FAILED; + } catch ( AbsentInformationException e ) { + log2(" AbsentInformationException for native method"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments001/TestDescription.java new file mode 100644 index 00000000000..b49b15ee4dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments001/TestDescription.java @@ -0,0 +1,98 @@ +/* + * 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/Method/arguments/arguments001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.arguments() + * complies with its spec: + * public java.util.List arguments() + * throws AbsentInformationException + * Returns a list containing each LocalVariable that is declared as + * an argument of this method. + * Returns: the list of LocalVariable arguments. + * If there are no arguments, a zero-length list is returned. + * Throws: AbsentInformationException - + * if there is no variable information for this method. + * NativeMethodException - + * if this operation is attempted for a native method. + * when a debugged program is compiled with the '-g' option, + * hence, no AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.arguments.arguments001; + * the debuggee program - nsk.jdi.Method.arguments.arguments001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * -------------- + * Fixing bug 4453137: + * To comply with the latest Merlin specification + * which differs the Ladybird and early Merlin specifications, + * the test is corrected as follows: + * - for native method, + * the check on throwing AbsentInformationException is performed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.arguments.arguments001 + * nsk.jdi.Method.arguments.arguments001a + * + * @comment make sure arguments001a is compiled with full debug info + * @clean nsk.jdi.Method.arguments.arguments001a + * @compile -g:lines,source,vars ../arguments001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.arguments.arguments001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments001a.java new file mode 100644 index 00000000000..5cffeef950b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments001a.java @@ -0,0 +1,143 @@ +/* + * 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.Method.arguments; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the arguments001 JDI test. + */ + +public class arguments001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> arguments001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> arguments001a: " + message); + } + + //====================================================== test program + + static arguments001aTestClass obj = new arguments001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.arguments()
    + * complies with its spec if a debugged program is compiled
    + * without "-g" option,
    + * hence, the exception AbsentInformationException is expected.

    + *
    + */ + +public class arguments002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/arguments/arguments002", + sHeader2 = "--> arguments002: ", + sHeader3 = "##> arguments002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new arguments002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.arguments.arguments002a"; + + String mName = "nsk.jdi.Method.arguments"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("arguments002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".arguments002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + List argsList = null; + + + // method with arguments + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + try { + argsList = m.arguments(); + log3(" no AbsentInformationException"); + testExitCode = FAILED; + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments002/TestDescription.java new file mode 100644 index 00000000000..7ad9e2014b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments002/TestDescription.java @@ -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/Method/arguments/arguments002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.arguments() + * complies with its spec: + * public java.util.List arguments() + * throws AbsentInformationException + * Returns a list containing each LocalVariable that is declared as + * an argument of this method. + * Returns: the list of LocalVariable arguments. + * If there are no arguments, a zero-length list is returned. + * Throws: AbsentInformationException - + * if there is no variable information for this method. + * NativeMethodException - + * if this operation is attempted for a native method. + * when a debugged program is compiled without the '-g' option, + * hence, AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.arguments.arguments002; + * the debuggee program - nsk.jdi.Method.arguments.arguments002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.arguments.arguments002 + * nsk.jdi.Method.arguments.arguments002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.arguments.arguments002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments002a.java new file mode 100644 index 00000000000..9e246754639 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments002a.java @@ -0,0 +1,143 @@ +/* + * 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.Method.arguments; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the arguments002 JDI test. + */ + +public class arguments002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> arguments002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> arguments002a: " + message); + } + + //====================================================== test program + + static arguments002aTestClass obj = new arguments002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + private static void failure(String msg) { + complain(msg); + exitStatus = Consts.TEST_FAILED; + } + + public static int run(String argv[], PrintStream out) { + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + failure("Class '" + debuggeeName + "' not found."); + } + + execTest(); + debuggee.quit(); + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + String expMethodName = "foo"; + String[][] expSignatures = { /* signature of method varargs type name */ + {"([I)Ljava/lang/String;", "int[]"}, + {"([Ljava/lang/Integer;)Ljava/lang/String;", "java.lang.Integer[]"}, + {"(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;", "java.lang.String[]"} + }; + + for (int i = 0; i < expSignatures.length; i++) { + List methods = debuggeeClass.methodsByName(expMethodName); + Method method = ((ClassType)debuggeeClass).concreteMethodByName(expMethodName, expSignatures[i][0]); + if (method != null) { + try { + Iterator arguments = method.arguments().iterator(); + boolean found = false; + while (arguments.hasNext()) { + LocalVariable argument = arguments.next(); + if (argument.typeName().equals(expSignatures[i][1])) { + found = true; + } + } + if (found) { + display("Method.arguments() returned expected varargs argument of type: " + expSignatures[i][1]); + } else { + failure("Method.arguments() did not return expected varargsvarargs argument of type: " + expSignatures[i][1]); + } + + } catch (Exception e) { + failure("Unexpected exception: " + e); + e.printStackTrace(System.out); + } + } else { + failure("Cannot find method with signature: " + expSignatures[i][0]); + } + } + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments003/TestDescription.java new file mode 100644 index 00000000000..f6bc95093e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments003/TestDescription.java @@ -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/Method/arguments/arguments003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for arguments() method of Method interface. + * The test checks if the method returns list of LocalVariable + * references which contains array type local variable for any + * mirrored method which has varargs argument. + * The test consists of a debugger program (arguments003.java) + * and debuggee application (arguments003a.java). + * Package name is nsk.jdi.Method.arguments . + * 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 finds mirrors of debuggee's methods 'foo' + * which have varargs arguments and calls arguments() method + * for each found method mirror. The test checks if returned + * list contains a LocalVariable reference representing expected + * array type of vararg argument. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.arguments.arguments003 + * nsk.jdi.Method.arguments.arguments003a + * + * @comment make sure arguments003a is compiled with full debug info + * @clean nsk.jdi.Method.arguments.arguments003a + * @compile -g:lines,source,vars ../arguments003a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.arguments.arguments003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments003a.java new file mode 100644 index 00000000000..48911a40f0d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/arguments/arguments003a.java @@ -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.Method.arguments; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class arguments003a { + + //------------------------------------------------------- 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 + + //------------------------------------------------------ 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(arguments003.SIGNAL_READY); + receiveSignal(arguments003.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific methods + + static String foo (int... args) { + return "1"; + } + + static String foo (Integer... args) { + return "2"; + } + + static String foo (String s, String... args) { + return "3"; + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001.java new file mode 100644 index 00000000000..84b0bf465e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001.java @@ -0,0 +1,213 @@ +/* + * 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.Method.bytecodes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.bytecodes()
    + * complies with its spec.
    + *
    + * If VirtualMachine supports this method the test checks up
    + * that the method invokation doesn't throw
    + * UnsupportedOperationException and a returned value is not null.
    + */ + +public class bytecodes001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/bytecodes/bytecodes001", + sHeader2 = "--> bytecodes001: ", + sHeader3 = "##> bytecodes001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new bytecodes001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.bytecodes.bytecodes001a"; + + String mName = "nsk.jdi.Method.bytecodes"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("bytecodes001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + if (!vm.canGetBytecodes()) { + log2(" : !vm.canGetBytecodes()"); + break ; + } + + List listOfDebuggeeClasses = vm.classesByName(mName + + ".TestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + + List argTypeNames = null; + + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + byte[] mBytecode = null; + try { + mBytecode = m.bytecodes(); + } catch ( UnsupportedOperationException e ) { + log3("ERROR: UnsupportedOperationException for vm.canGetBytecodes()"); + testExitCode = FAILED; + break; + } + if (mBytecode == null) { + log3("ERROR: mBytecode == null"); + testExitCode = FAILED; + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001/TestDescription.java new file mode 100644 index 00000000000..92017b7704a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001/TestDescription.java @@ -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/Method/bytecodes/bytecodes001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.bytecodes() + * complies with its spec: + * public byte[] bytecodes() + * Returns an array containing the bytecodes for this method. + * Not all target VMs support this query. + * See VirtualMachine#canGetBytecodes to determine if + * the operation is supported. + * Returns: the array of bytecodes. + * Throws: java.lang.UnsupportedOperationException - + * if the target VM does not support the retrieval of bytecodes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.bytecodes.bytecodes001; + * the debuggee program - nsk.jdi.Method.bytecodes.bytecodes001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.bytecodes.bytecodes001 + * nsk.jdi.Method.bytecodes.bytecodes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.bytecodes.bytecodes001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001a.java new file mode 100644 index 00000000000..13ef8aeef9c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/bytecodes/bytecodes001a.java @@ -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.Method.bytecodes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the bytecodes001 JDI test. + */ + +public class bytecodes001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> bytecodes001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> bytecodes001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows:
    + * two objects mirror the same method on the same VM
    + * two objects mirror different methods on the same VM
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.equals.equals001a"; + + String mName = "nsk.jdi.Method.equals"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggees launched"); + debuggee.resume(); + log2("equals001a debuggees resumed"); + + String line = pipe.readln(); + + if ((line == null) || !line.equals("ready")) { + log3("line: signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("line: 'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + log2("line: 'newcheck' sent"); + + line = pipe.readln(); + if (line.equals("checkend")) { + log2(" : line: returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: line: returned string is not 'checkready'"); + testExitCode = FAILED; +// break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses1 = vm.classesByName(mName + ".TestClass1"); + if (listOfDebuggeeClasses1.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses1.size() != 1"); + break ; + } + List listOfDebuggeeClasses2 = vm.classesByName(mName + ".TestClass2"); + if (listOfDebuggeeClasses2.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses2.size() != 1"); + break ; + } + + List methods = null; + Method m1 = null; + Method m2 = null; + Method m3 = null; + + methods = ((ReferenceType) listOfDebuggeeClasses1.get(0)). + methodsByName("primitiveargsmethod"); + m1 = (Method) methods.get(0); + + methods = ((ReferenceType) listOfDebuggeeClasses1.get(0)). + methodsByName("primitiveargsmethod"); + m2 = (Method) methods.get(0); + + methods = ((ReferenceType) listOfDebuggeeClasses2.get(0)). + methodsByName("arrayargmethod"); + m3 = (Method) methods.get(0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // both m1 and m2 mirror the same method + + if (!m1.equals(m2)) { + log3("ERROR: !m1.equals(m2)"); + expresult = 1; + break; + } + break; + + case 1: // different classes on the same VM + + if (m1.equals(m3)) { + log3("ERROR: m1.equals(m3)"); + expresult = 1; + break; + } + break; + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..fad91b8f4ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/equals/equals001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/Method/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this method for equality. + * Returns: true if the Object is a method and if both mirror the same method + * (declared in the same class or interface, in the same VM). + * Overrides: equals in class java.lang.Object + * The test works as follows: + * The debugger program - nsk.jdi.Method.equals.equals001; + * the debuggee program - nsk.jdi.Method.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * 4791232 TEST_BUG: some JDI tests start two instances of debuggee VM + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.equals.equals001 + * nsk.jdi.Method.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/equals/equals001a.java new file mode 100644 index 00000000000..30df66a081f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/equals/equals001a.java @@ -0,0 +1,257 @@ +/* + * 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.Method.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001 JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + + static TestClass1 obj1 = new TestClass1(); + static TestClass2 obj2 = new TestClass2(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows:
    + * two objects mirror the same method on the same VM
    + * two objects mirror different methods on the same VM
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.hashCode.hashcode001a"; + + String mName = "nsk.jdi.Method.hashCode"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee1; +// Debugee debuggee2; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee1 = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp +// debuggee2 = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee1 = binder.bindToDebugee(debuggeeName); // *** tp +// debuggee2 = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe1 = new IOPipe(debuggee1); +// IOPipe pipe2 = new IOPipe(debuggee2); + + debuggee1.redirectStderr(out); +// debuggee2.redirectStderr(out); + log2("equals001a debuggees launched"); + debuggee1.resume(); +// debuggee2.resume(); +// log2("equals001a debuggees resumed"); + + String line1 = pipe1.readln(); +// String line2 = pipe2.readln(); + + + if ((line1 == null) || !line1.equals("ready")) { + log3("line1: signal received is not 'ready' but: " + line1); + return FAILED; + } else { + log2("line1: 'ready' recieved"); + } +/* + if ((line2 == null) || !line2.equals("ready")) { + log3("line2: signal received is not 'ready' but: " + line2); + return FAILED; + } else { + log2("line2: 'ready' recieved"); + } +*/ + VirtualMachine vm1 = debuggee1.VM(); +// VirtualMachine vm2 = debuggee2.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + +// for (int i = 0; ; i++) { + + check: + { + pipe1.println("newcheck"); + log2("line1: 'newcheck' sent"); + line1 = pipe1.readln(); + +// if (line1.equals("checkend")) { +// log2(" : line1: returned string is 'checkend'"); +// } else { + + if (!line1.equals("checkready")) { + log3("ERROR: line1: returned string is not 'checkready'"); + testExitCode = FAILED; + break check; + } + +/* + pipe2.println("newcheck"); + log2("line2: 'newcheck' sent"); + line2 = pipe2.readln(); + +// if (line2.equals("checkend")) { +// log2(" : line2: returned string is 'checkend'"); +// break ; +// } else { + + if (!line2.equals("checkready")) { + log3("ERROR: line2: returned string is not 'checkready'"); + testExitCode = FAILED; + break check; + } +*/ + + + log1("check begins: "); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses1 = vm1.classesByName(mName + ".TestClass1"); + if (listOfDebuggeeClasses1.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses1.size() != 1"); + break check; + } + List listOfDebuggeeClasses2 = vm1.classesByName(mName + ".TestClass2"); + if (listOfDebuggeeClasses2.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses2.size() != 1"); + break check; + } +/* + List listOfDebuggeeClasses3 = vm2.classesByName(mName + ".TestClass1"); + if (listOfDebuggeeClasses3.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses3.size() != 1"); + break check; + } +*/ + List methods = null; + Method m1 = null; + Method m2 = null; + Method m3 = null; +// Method m4 = null; + + methods = ((ReferenceType) listOfDebuggeeClasses1.get(0)). + methodsByName("primitiveargsmethod"); + m1 = (Method) methods.get(0); + + methods = ((ReferenceType) listOfDebuggeeClasses1.get(0)). + methodsByName("primitiveargsmethod"); + m2 = (Method) methods.get(0); + + methods = ((ReferenceType) listOfDebuggeeClasses2.get(0)). + methodsByName("arrayargmethod"); + m3 = (Method) methods.get(0); + +/* + methods = ((ReferenceType) listOfDebuggeeClasses3.get(0)). + methodsByName("primitiveargsmethod"); + m4 = (Method) methods.get(0); +*/ + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // both m1 and m2 mirror the same method + + if ( m1.hashCode() != m2.hashCode() ) { + log3("ERROR: m1.hashCode() != m2.hashCode()"); + expresult = 1; + break; + } + break; + + case 1: // different classes on the same VM + + if ( m1.hashCode() == m3.hashCode() ) { + log3("ERROR: m1.hashCode() == m3.hashCode()"); + expresult = 1; + break; + } + break; +/* + case 2: // different VMs + + if ( m1.hashCode() != m4.hashCode() ) { + log3("ERROR: m1.hashCode() != m4.hashCode()"); + expresult = 1; + break; + } + break; +*/ + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; " ); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + } // check: + + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (line1.equals("checkready")) { + pipe1.println("quit"); + log2("waiting for the debuggee1 to finish ..."); + debuggee1.waitFor(); + + int status1 = debuggee1.getStatus(); + if (status1 != PASSED + PASS_BASE) { + log3("debuggee1 returned UNEXPECTED exit status: " + + status1 + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee1 returned expected exit status: " + + status1 + " == PASS_BASE"); + } + } +/* + else { + if (line2.equals("checkready")) { + pipe2.println("quit"); + log2("waiting for the debuggee2 to finish ..."); + debuggee2.waitFor(); + + int status2 = debuggee2.getStatus(); + if (status2 != PASSED + PASS_BASE) { + log3("debuggee2 returned UNEXPECTED exit status: " + + status2 + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee2 returned expected exit status: " + + status2 + " == PASS_BASE"); + } + } + } +*/ + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..f9d4e477222 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/Method/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this Method. + * Returns: the integer hash code + * Overrides: hashCode in class java.lang.Object + * when both mirrored Method objects are on the same VM. + * The test works as follows: + * The debugger program - nsk.jdi.Method.hashCode.hashcode001; + * the debuggee program - nsk.jdi.Method.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.hashCode.hashcode001 + * nsk.jdi.Method.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/hashCode/hashcode001a.java new file mode 100644 index 00000000000..a86576b33d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/hashCode/hashcode001a.java @@ -0,0 +1,258 @@ +/* + * 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.Method.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001 JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + + static TestClass1 obj1 = new TestClass1(); + static TestClass2 obj2 = new TestClass2(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isAbstract()
    + * true for a class method declared as abstract and
    + * to false otherwise.
    + */ + +public class isabstract001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isAbstract/isabstract001", + sHeader2 = "--> isabstract001: ", + sHeader3 = "##> isabstract001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isabstract001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isAbstract.isabstract001a"; + + String mName = "nsk.jdi.Method.isAbstract"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("isabstract001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".AClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("atest"); + if (methods.size() <= 0) { + log3("ERROR : methods.size() <= 0 for 'atest' " + methods.size()); + testExitCode = FAILED; + break; + } + + Method testMethod = (Method) methods.get(0); + if (!testMethod.isAbstract()) { + log3("ERROR : method 'atest' is not an abstract"); + testExitCode = FAILED; + break; + } + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test"); + testExitCode = FAILED; + break; + } + testMethod = (Method) methods.get(0); + if (testMethod.isAbstract()) { + log3("ERROR : test is an abstract"); + testExitCode = FAILED; + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isAbstract/isabstract001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isAbstract/isabstract001/TestDescription.java new file mode 100644 index 00000000000..84eaa7f869c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isAbstract/isabstract001/TestDescription.java @@ -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/Method/isAbstract/isabstract001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.isAbstract() + * complies with its spec: + * public boolean isAbstract() + * Determine if this method is abstract. + * Returns: true if the method is declared abstract; false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isAbstract.isabstract001; + * the debuggee program - nsk.jdi.Method.isAbstract.isabstract001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.isAbstract.isabstract001 + * nsk.jdi.Method.isAbstract.isabstract001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isAbstract.isabstract001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isAbstract/isabstract001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isAbstract/isabstract001a.java new file mode 100644 index 00000000000..788af87f4b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isAbstract/isabstract001a.java @@ -0,0 +1,130 @@ +/* + * 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.Method.isAbstract; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isabstract001 JDI test. + */ + +public class isabstract001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> isabstract001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> isabstract001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.Method.isBridge()
    + * It verifies that 'bridge methods' generated during translation of + * generic classes are determinated properly by the method. + * Here are the rules from the spec "Adding Generics to the Java + * Programming Language: Public Draft Specification, Version 2.0" + * followed by the test:
    + *
    + *     6.2 Translation of Methods
    + *     ...
    + *     
  • If C.m is directly overridden by a method D.m in D, and the + * erasure of the return type or argument types of D.m differs from + * the erasure of the corresponding types in C.m, a bridge method + * needs to be generated. + * + *
  • A bridge method also needs to be generated if C.m is not + * directly overridden in D, unless C.m is abstract. + *

  • + * The test works as follows. Debuggee contains several dummy superclasses + * and subclasses. Some of their methods fall under the rules above. + * Debugger verifies that the JDI Method.isBridge() returns true for all + * generated bridge methods and false for the non-bridge ones. + * The list of the class methods is obtained through the JDI + * ReferenceType.methods() which must return each method declared directly + * in this type including any synthetic methods created by the compiler. + */ +public class isbridge001 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.Method.isBridge.isbridge001t"; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final String[][][] methods = { +// nsk.jdi.Method.isBridge.isbridge001aa + {{"", + "()V", + "false", + "0"}, + {"isbridge001aMeth", + "(Ljava/lang/Double;)V", + "false", + "0"}}, + +// nsk.jdi.Method.isBridge.isbridge001bb + {{"", + "()V", + "false", + "0"}, + {"isbridge001bMeth", + "(Ljava/lang/Number;)Ljava/lang/Number;", + "false", + "0"}, + {"isbridge001bMeth2", + "(Ljava/lang/Number;I)V", + "false", + "0"}}, + +// nsk.jdi.Method.isBridge.isbridge001bb2 + {{"", + "()V", + "false", + "0"}, + {"isbridge001bMeth", + "(Ljava/lang/Byte;)Ljava/lang/Byte;", + "false", + "0"}, + {"isbridge001bMeth2", + "(Ljava/lang/Byte;I)V", + "false", + "0"}, + {"isbridge001bMeth", + "(Ljava/lang/Number;)Ljava/lang/Number;", + "true", + "0"}, + {"isbridge001bMeth2", + "(Ljava/lang/Number;I)V", + "true", + "0"}}, + +// nsk.jdi.Method.isBridge.isbridge001dd + {{"", + "()V", + "false", + "0"}}, + +// nsk.jdi.Method.isBridge.isbridge001dd2 + {{"", + "()V", + "false", + "0"}, + {"isbridge001dMeth", + "(Ljava/lang/Boolean;Ljava/lang/Character;)Ljava/lang/String;", + "false", + "0"}, + {"isbridge001dMeth", + "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", + "true", + "0"}} + }; + + static final String[] classes = { + "nsk.jdi.Method.isBridge.isbridge001aa", + "nsk.jdi.Method.isBridge.isbridge001bb", + "nsk.jdi.Method.isBridge.isbridge001bb2", + "nsk.jdi.Method.isBridge.isbridge001dd", + "nsk.jdi.Method.isBridge.isbridge001dd2", + }; + + static final int CLS_NUM = classes.length; + + private IOPipe pipe; + private Log log; + private Debugee debuggee; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new isbridge001().runThis(argv, out); + } + + private int runThis(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "isbridge001t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + tot_res = Consts.TEST_FAILED; + log.complain("TEST BUG: unknown debuggee's command: " + + cmd); + return quitDebuggee(); + } + + for (int i=0; i>>>>> Class " + classes[i]); + if ((rType = debuggee.classByName(classes[i])) == null) { + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILURE: Method Debugee.classByName() returned null for " + + classes[i] + "\n"); + return quitDebuggee(); + } + try { + clsMethods = rType.methods(); + } catch (Exception e) { + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILURE: ReferenceType.methods: caught " + e + + "\n"); + return quitDebuggee(); + } + + Iterator iterator = clsMethods.iterator(); + while(iterator.hasNext()) { + Method meth = (Method) iterator.next(); + log.display("\t--> method " + meth + + "\n\t\tname " + meth.name() + + "\n\t\treturn type " + meth.returnTypeName() + + "\n\t\tsignature " + meth.signature()); + + int idx = findMethod(i, meth.signature()); + if (idx != -1) { + try { + int methCounter = Integer.parseInt(methods[i][idx][3]); + methCounter++; + methods[i][idx][3] = String.valueOf(methCounter); + } catch (NumberFormatException e) { + tot_res = Consts.TEST_FAILED; + log.complain("TEST BUG: Integer.parseInt: caught " + e); + return quitDebuggee(); + } + boolean bridge = new Boolean(methods[i][idx][2]); + if (bridge == meth.isBridge()) + log.display("\tCHECK PASSED: Method.isBridge() returns " + + meth.isBridge() + " as expected\n"); + else { + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: Method.isBridge() returns " + + meth.isBridge() + + "\n\tfor the method: " + meth.name() + + " " + meth.signature() + + "\n\tExpected: "+ methods[i][idx][2] + "\n"); + } + } + } + + log.display("<<<<<<"); + } + + for (int i=0; i { + T isbridge001bMeth(T a) { + return a; + } + + void isbridge001bMeth2(T b, int i) {} +} + +/* Test case 2: no bridge methods: the erasure of the return type/arguments + types of overridding methods are the same with the original ones. */ +class isbridge001bb extends isbridge001b { + Number isbridge001bMeth(Number a) { + return a; + } + + void isbridge001bMeth2(Number b, int i) {} +} + +/* Test case 3: bridge methods: the erasure of the return type/arguments + types of overridding methods are differ from the original ones. */ +class isbridge001bb2 extends isbridge001b { + Byte isbridge001bMeth(Byte a) { + return a; + } + + void isbridge001bMeth2(Byte b, int i) {} +} + +/* Test case 4 and classes isbridge001c/cc were removed. Bug id: 5083386 */ + +abstract class isbridge001d { + abstract C isbridge001dMeth(A a, B b); +} + +/* Test case 5: no bridge methods: non-overridden method of superclass + is abstract. */ +abstract class isbridge001dd extends isbridge001d {} + +/* Test case 6: bridge methods: overridden method of superclass + is abstract. */ +class isbridge001dd2 extends isbridge001d { + String isbridge001dMeth(Boolean a, Character b) { + return (String) "bridge"; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001.java new file mode 100644 index 00000000000..002947a1c4a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001.java @@ -0,0 +1,210 @@ +/* + * 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.Method.isConstructor; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isConstructor()
    + * complies with its spec and its returned value is equal to
    + * true for a Method object returned by methodsByName("");
    + * and to false for other name.
    + */ + +public class isconstructor001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isConstructor/isconstructor001", + sHeader2 = "--> isconstructor001: ", + sHeader3 = "##> isconstructor001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isconstructor001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isConstructor.isconstructor001a"; + + String mName = "nsk.jdi.Method.isConstructor"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("isconstructor001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".TestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(""); + if (methods.size() <= 0) { + log3("ERROR : methods.size() <= 0 for '' " + methods.size()); + testExitCode = FAILED; + break; + } + + Method testMethod = (Method) methods.get(0); + if (!testMethod.isConstructor()) { + log3("ERROR : method is not a constructor"); + testExitCode = FAILED; + break; + } + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test2"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test2"); + testExitCode = FAILED; + break; + } + testMethod = (Method) methods.get(0); + if (testMethod.isConstructor()) { + log3("ERROR : test2 is a constructor"); + testExitCode = FAILED; + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001/TestDescription.java new file mode 100644 index 00000000000..9f010909138 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001/TestDescription.java @@ -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/Method/isConstructor/isconstructor001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.isConstructor() + * complies with its spec: + * public boolean isConstructor() + * Determine if this method is a constructor. + * Returns: true if the method is a constructor; false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isConstructor.isconstructor001; + * the debuggee program - nsk.jdi.Method.isConstructor.isconstructor001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.isConstructor.isconstructor001 + * nsk.jdi.Method.isConstructor.isconstructor001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isConstructor.isconstructor001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001a.java new file mode 100644 index 00000000000..6e17ec9ffda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isConstructor/isconstructor001a.java @@ -0,0 +1,123 @@ +/* + * 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.Method.isConstructor; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isconstructor001 JDI test. + */ + +public class isconstructor001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> isconstructor001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> isconstructor001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isNative()
    + * complies with its spec and its returned value is equal to
    + * true for a class method declared as native and
    + * to false otherwise.
    + */ + +public class isnative001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isNative/isnative001", + sHeader2 = "--> isnative001: ", + sHeader3 = "##> isnative001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isnative001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isNative.isnative001a"; + + String mName = "nsk.jdi.Method.isNative"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("isnative001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".TestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test1"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test1"); + testExitCode = FAILED; + break; + } + Method testMethod = (Method) methods.get(0); + if (!testMethod.isNative()) { + log3("ERROR : test1 is not a native method"); + testExitCode = FAILED; + break; + } + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test2"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test2"); + testExitCode = FAILED; + break; + } + testMethod = (Method) methods.get(0); + if (testMethod.isNative()) { + log3("ERROR : test2 is a native method"); + testExitCode = FAILED; + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isNative/isnative001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isNative/isnative001/TestDescription.java new file mode 100644 index 00000000000..2604ebf0467 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isNative/isnative001/TestDescription.java @@ -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/Method/isNative/isnative001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * isNative. + * The test checks up that a result of the method + * com.sun.jdi.Method.isNative() + * complies with its spec: + * public boolean isNative() + * Determine if this method is native. + * Returns: true if the method is declared native; false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isNative.isnative001; + * the debuggee program - nsk.jdi.Method.isNative.isnative001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.isNative.isnative001 + * nsk.jdi.Method.isNative.isnative001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isNative.isnative001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isNative/isnative001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isNative/isnative001a.java new file mode 100644 index 00000000000..e36d47b2b1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isNative/isnative001a.java @@ -0,0 +1,120 @@ +/* + * 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.Method.isNative; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isnative001 JDI test. + */ + +public class isnative001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> isnative001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> isnative001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isObsolete()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * true if this method has been replaced by a non-equivalent
    + * method using VirtualMachine.redefineClasses(java.util.Map).
    + * The test checks that isObsolete() returns false if
    + * the tested method was redefined with itself
    + * which is certainly equivalent.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following .
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee loads the class to be redefined and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger + * - gets a Method object mirroring a method in the class,
    + * - checks that isObsolete() invoked on the object, returns false;
    + * - redefines the class;
    + * - checks again that isObsolete() invoked on the object,
    + * returns false.
    + *
    + * In third phase the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class isobsolete001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isObsolete/isobsolete001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new isobsolete001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isObsolete.isobsolete001a"; + + private static final int brkpLineNumber = 49; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + + debuggee = binder.bindToDebugee(debuggeeName); + + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + + if ( !vm.canRedefineClasses() ) { + log2("......vm.canRedefineClasses() == false : test is cancelled"); + vm.resume(); + return; + } + + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = debuggee.threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + + String className = "nsk.jdi.Method.isObsolete.isobsolete001b"; + String methodName = "m2"; + + ReferenceType redefClass = null; + + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + + redefClass = debuggee.classByName(className); + Method method = debuggee.methodByName(redefClass, methodName); + boolean isObs = method.isObsolete(); + + if (isObs) { + log3("ERROR: isObsolete() == true for m2 method before redefineClasses() invocation"); + testExitCode = FAILED; + } else + log2(" : isObsolete() == false for m2 method before redefineClasses() invocation "); + + // Create breakpoint request to have isobsolete002b.m2 on the top of the stack. + bpRequest = debuggee.makeBreakpoint(redefClass, methodName, brkpLineNumber); + bpRequest.addThreadFilter(mainThread); + bpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + bpRequest.putProperty("number", "one"); + bpRequest.enable(); + + // resuming after breakpoint for communication + vm.resume(); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) { + log2("......requested BreakpointEvent received;"); + if (mainThread.frame(0).location().method() == method) { + log2("......m2 method is on the top of the main thread stack;"); + } else { + log3("TEST ERROR: m2 method is not on the top of the main thread stack"); + testExitCode = FAILED; + } + } else { + log3("TEST ERROR: expected BreakpointEvent is not receieved"); + testExitCode = FAILED; + } + + try { + log2("......vm.redefineClasses(mapClassToBytes());"); + vm.redefineClasses(mapClassToBytes()); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + testExitCode = FAILED; + throw e; + } catch ( Error e ) { + log3("ERROR: Error: " + e); + testExitCode = FAILED; + throw e; + } + + log2("......getting: method = mainThread.frame(0).location().method();"); + method = mainThread.frame(0).location().method(); + log2("......getting: isObs = method.isObsolete();"); + isObs = method.isObsolete(); + if (isObs) { + log3("ERROR: method.isObsolete() == true for m2 method after redefineClasses() invocation"); + testExitCode = FAILED; + } else + log2(" : method.isObsolete() == false for m2 method after redefineClasses() invocation;"); + + break; + + default: + throw new JDITestRuntimeException ("** default case **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + + vm.resume(); + log1(" TESTING ENDS"); + return; + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + + private Map mapClassToBytes() + throws JDITestRuntimeException { + + byte []arrayToRedefine; + + log2("......getting: String[] args = argsHandler.getArguments();"); + String[] args = argsHandler.getArguments(); + if (args.length <= 0) { + log3("ERROR: args.length <= 0"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** args.length <= 0 **"); + } + String testDir = args[0]; + log2("...... testDir = " + testDir); + + + String filePrefix = File.separator + "nsk" + + File.separator + "jdi" + + File.separator + "Method" + + File.separator + "isObsolete"; + + String fileToRedefineName = testDir + + File.separator + "newclass" + filePrefix + + File.separator + "isobsolete001b.class"; + + log2("...... fileToRedefineName=" + fileToRedefineName); + + try { + log2("......File fileToRedefine = new File(fileToRedefineName);"); + File fileToRedefine = new File(fileToRedefineName); + if (fileToRedefine.exists()) + log2(" fileToRedefine.exists()"); + else { + log3("ERROR: fileToRedefine doesn't exist"); + testExitCode = FAILED; + } + + if (testExitCode == FAILED) + throw new JDITestRuntimeException("** testExitCode == FAILED **"); + + int fileToRedefineLength = (int) fileToRedefine.length(); + log2(" fileToRedefineLength == " + fileToRedefineLength); + + FileInputStream inputFile = new FileInputStream(fileToRedefine); + arrayToRedefine = new byte[fileToRedefineLength]; + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch ( IOException e ) { + log3("ERROR: IOException: " + e); + throw new JDITestRuntimeException("** IOException **"); + } + + String testClassName = "nsk.jdi.Method.isObsolete.isobsolete001b"; + List classes = vm.classesByName(testClassName); + ReferenceType testClass = (ReferenceType) classes.get(0); + + HashMap mapForClass = new HashMap(); + mapForClass.put(testClass, arrayToRedefine); + + return mapForClass; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001/TestDescription.java new file mode 100644 index 00000000000..146d766c4b3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001/TestDescription.java @@ -0,0 +1,94 @@ +/* + * 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/Method/isObsolete/isobsolete001. + * VM Testbase keywords: [jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.isObsolete() + * complies with its spec: + * public boolean isObsolete() + * Determine if this method is obsolete. + * Returns: true if this method has been replaced by + * a non-equivalent method using + * VirtualMachine.redefineClasses(java.util.Map). + * The test checks that isObsolete() returns false if + * the tested method was redefined with itself which is certainly equivalent. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isObsolete.isobsolete001; + * the debuggee program - nsk.jdi.Method.isObsolete.isobsolete001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test suite contains + * the precompiled class file isobsolete001b.klass . + * Its source file is isobsolete001b.java . + * The test was modified die to fix of the bug: + * 4514956 Method.isObsolete() returns false for redefined method + * Test was updated according to rfe: + * 4691123 TEST: some jdi tests contain precompiled .klass files undes SCCS. + * isobsolete001b.java was copied into newclass directory and the precompiled + * class file is created during test base build process. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.isObsolete.isobsolete001 + * nsk.jdi.Method.isObsolete.isobsolete001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isObsolete.isobsolete001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001/newclass/isobsolete001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001/newclass/isobsolete001b.java new file mode 100644 index 00000000000..eeebf5b21ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001/newclass/isobsolete001b.java @@ -0,0 +1,59 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * This is the redefined class for the isobsolete001 JDI test. + */ +public class isobsolete001b { + + static final String prefix = "**> debuggee: "; + static Log log; + + isobsolete001b(Log log) { + this.log = log; + log.display(prefix + " This is the class to be redefined"); + } + + static int i1 = 0; + static int i2 = 0; + + static void m2() { + i1 = 1; + i2 = 1; // isobsolete001.brkpLineNumber + } + + static void m1() { + log.display(prefix + "redefined method: before: m2()"); + m2(); + log.display(prefix + "redefined method: after: m2()"); + log.display(prefix + "redefined method: value of i1 == " + i1); + log.display(prefix + "redefined method: value of i2 == " + i2); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001a.java new file mode 100644 index 00000000000..c2559e7a5d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001a.java @@ -0,0 +1,115 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the isobsolete001 JDI test. + */ + +public class isobsolete001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static isobsolete001b objRF1; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + objRF1 = new isobsolete001b(log); + methodForCommunication(); + objRF1.m1(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001b.java new file mode 100644 index 00000000000..aa1a150abb5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete001b.java @@ -0,0 +1,59 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * This is the redefined class for the isobsolete001 JDI test. + */ +public class isobsolete001b { + + static final String prefix = "**> debuggee: "; + static Log log; + + isobsolete001b(Log log) { + this.log = log; + log.display(prefix + " This is the class to be redefined"); + } + + static int i1 = 0; + static int i2 = 0; + + static void m2() { + i1 = 1; + i2 = 1; // isobsolete001.brkpLineNumber + } + + static void m1() { + log.display(prefix + "redefined method: before: m2()"); + m2(); + log.display(prefix + "redefined method: after: m2()"); + log.display(prefix + "redefined method: value of i1 == " + i1); + log.display(prefix + "redefined method: value of i2 == " + i2); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002.java new file mode 100644 index 00000000000..9ccedf98133 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002.java @@ -0,0 +1,573 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isObsolete()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * true if this method has been replaced by a non-equivalent
    + * method using VirtualMachine.redefineClasses(java.util.Map).
    + * The test checks that isObsolete() returns true if
    + * the body of the tested method was fully replaced.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * the debugger and the debuggee perform the following .
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee loads the class to be redefined and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger + * - gets a Method object mirroring a method in the class,
    + * - checks that isObsolete() invoked on the object, returns false;
    + * - redefines the class;
    + * - checks again that isObsolete() invoked on the object,
    + * returns true.
    + *
    + * In third phase the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class isobsolete002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isObsolete/isobsolete002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new isobsolete002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isObsolete.isobsolete002a"; + + private static final int brkpLineNumber = 49; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + + debuggee = binder.bindToDebugee(debuggeeName); + + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + + if ( !vm.canRedefineClasses() ) { + log2("......vm.canRedefineClasses() == false : test is cancelled"); + vm.resume(); + return; + } + + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + ThreadReference mainThread = debuggee.threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + + String className = "nsk.jdi.Method.isObsolete.isobsolete002b"; + String methodName = "m2"; + + ReferenceType redefClass = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + + log2("......getting: redefClass = debuggee.classByName(className);"); + redefClass = debuggee.classByName(className); + + log2("......getting: Method method = debuggee.methodByName(redefClass, methodName);"); + Method method = debuggee.methodByName(redefClass, methodName); + log2("......getting: boolean isObs = method.isObsolete();"); + boolean isObs = method.isObsolete(); + + if (isObs) { + log3("ERROR: isObsolete() == true for m2 method before redefineClasses() invocation"); + testExitCode = FAILED; + } else + log2(" : isObsolete() == false for m2 method before redefineClasses() invocation"); + + // Create breakpoint request to have isobsolete002b.m2 on the top of the stack. + bpRequest = debuggee.makeBreakpoint(redefClass, methodName, brkpLineNumber); + bpRequest.addThreadFilter(mainThread); + bpRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + bpRequest.putProperty("number", "one"); + bpRequest.enable(); + + // resuming after breakpoint for communication + vm.resume(); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) { + log2("......requested BreakpointEvent received;"); + if (mainThread.frame(0).location().method() == method) { + log2("......m2 method is on the top of the main thread stack;"); + } else { + log3("TEST ERROR: m2 method is not on the top of the main thread stack"); + testExitCode = FAILED; + } + } else { + log3("TEST ERROR: expected BreakpointEvent is not receieved"); + testExitCode = FAILED; + } + + try { + log2("......vm.redefineClasses(mapClassToBytes());"); + vm.redefineClasses(mapClassToBytes()); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + testExitCode = FAILED; + throw e; + } catch ( Error e ) { + log3("ERROR: Error: " + e); + testExitCode = FAILED; + throw e; + } + + log2("......getting: method = mainThread.frame(0).location().method();"); + method = mainThread.frame(0).location().method(); + log2("......getting: isObs = method.isObsolete();"); + isObs = method.isObsolete(); + if (isObs) { + log2(" : isObsolete() == true for m2 method after redefineClasses() invocation;"); + } else { + log3("ERROR: isObsolete() == false for m2 method after redefineClasses() invocation"); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException ("** default case **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + + vm.resume(); + log1(" TESTING ENDS"); + return; + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + + private Map mapClassToBytes() + throws JDITestRuntimeException { + + byte []arrayToRedefine; + + log2("......getting: String[] args = argsHandler.getArguments();"); + String[] args = argsHandler.getArguments(); + if (args.length <= 0) { + log3("ERROR: args.length <= 0"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** args.length <= 0 **"); + } + String testDir = args[0]; + log2("...... testDir = " + testDir); + + + String filePrefix = File.separator + "nsk" + + File.separator + "jdi" + + File.separator + "Method" + + File.separator + "isObsolete"; + + String fileToRedefineName = testDir + + File.separator + "newclass" + filePrefix + + File.separator + "isobsolete002b.class"; + + log2("...... fileToRedefineName=" + fileToRedefineName); + + try { + log2("......File fileToRedefine = new File(fileToRedefineName);"); + File fileToRedefine = new File(fileToRedefineName); + if (fileToRedefine.exists()) + log2(" fileToRedefine.exists(); length == " + fileToRedefine.length()); + else { + log3("ERROR: fileToRedefine doesn't exist"); + testExitCode = FAILED; + } + + if (testExitCode == FAILED) + throw new JDITestRuntimeException("** testExitCode == FAILED **"); + + FileInputStream inputFile = new FileInputStream(fileToRedefine); + arrayToRedefine = new byte[(int) fileToRedefine.length()]; + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch ( IOException e ) { + log3("ERROR: IOException: " + e); + throw new JDITestRuntimeException("** IOException **"); + } + + String testClassName = "nsk.jdi.Method.isObsolete.isobsolete002b"; + List classes = vm.classesByName(testClassName); + ReferenceType testClass = (ReferenceType) classes.get(0); + + HashMap mapForClass = new HashMap(); + mapForClass.put(testClass, arrayToRedefine); + + return mapForClass; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002/TestDescription.java new file mode 100644 index 00000000000..7e9e242e8c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/Method/isObsolete/isobsolete002. + * VM Testbase keywords: [jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.isObsolete() + * complies with its spec: + * public boolean isObsolete() + * Determine if this method is obsolete. + * Returns: true if this method has been replaced by + * a non-equivalent method using + * VirtualMachine.redefineClasses(java.util.Map). + * The test checks that isObsolete() returns true if + * the body of the tested method has been fully replaced. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isObsolete.isobsolete002; + * the debuggee program - nsk.jdi.Method.isObsolete.isobsolete002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test suite contains + * the precompiled class file isobsolete002b.klass . + * Its source file is isobsolete002b.ja . + * The test was modified die to fix of the bug: + * 4514956 Method.isObsolete() returns false for redefined method + * Test was updated according to rfe: + * 4691123 TEST: some jdi tests contain precompiled .klass files undes SCCS. + * isobsolete002b.ja was moved into newclass directory and renamed + * to isobsolete002b.java. + * The precompiled class file is created during test base build process. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.isObsolete.isobsolete002 + * nsk.jdi.Method.isObsolete.isobsolete002a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isObsolete.isobsolete002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002/newclass/isobsolete002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002/newclass/isobsolete002b.java new file mode 100644 index 00000000000..7cb9493d8a3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002/newclass/isobsolete002b.java @@ -0,0 +1,58 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * This is the redefining class for the isobsolete002 JDI test. + */ +public class isobsolete002b { + + static final String prefix = "**> debuggee: "; + static Log log; + + isobsolete002b(Log log) { + this.log = log; + log.display(prefix + " This is the class to redefine"); + } + + static int i1 = 0; + static int i2 = 0; + + static void m2() { + boolean b1 = true; + log.display(prefix + "redefining method: b1 " + b1); // isobsolete001.brkpLineNumber + } + + static void m1() { + log.display(prefix + "method m1: before m2()"); + m2(); + log.display(prefix + "method m1: after m2()"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002a.java new file mode 100644 index 00000000000..753b9911335 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002a.java @@ -0,0 +1,117 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the isobsolete002 JDI test. + */ + +public class isobsolete002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static isobsolete002b objRF1; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + objRF1 = new isobsolete002b(log); + methodForCommunication(); + objRF1.m1(); + break ; + + //------------------------------------------------- standard end section + + default: + log1("Call m1 method again to show that class is redefined."); + objRF1.m1(); + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002b.java new file mode 100644 index 00000000000..f3968ca1fab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete002b.java @@ -0,0 +1,57 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * This is the redefined class for the isobsolete002 JDI test. + */ +public class isobsolete002b { + + static final String prefix = "**> debuggee: "; + static Log log; + + isobsolete002b(Log log) { + this.log = log; + log.display(prefix + " This is the class to be redefined"); + } + + static int i1 = 0; + static int i2 = 0; + + static void m2() { + i1 = 1; + i2 = 1; // isobsolete001.brkpLineNumber + } + + static void m1() { + log.display(prefix + "method m1: before m2()"); + m2(); + log.display(prefix + "method m1: after m2()"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003.java new file mode 100644 index 00000000000..c6328ad8a3d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003.java @@ -0,0 +1,460 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import java.io.*; +import java.util.*; + +/** + */ +public class isobsolete003 { + + private final static String prefix = "nsk.jdi.Method.isObsolete"; + private final static String className = ".isobsolete003"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + private final static int brkpMainLineNumber = 48; + private final static int brkpFooLineNumber = 33; + + private static int waitTime; + private static int exitStatus; + private static ArgumentHandler argHandler; + private static Log log; + private static Debugee debuggee; + private static VirtualMachine vm; + private static ReferenceType debuggeeClass; + + private static EventRequestManager eventRManager; + private static EventSet eventSet; + private static EventIterator eventIterator; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + 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; + + try { + + Binder binder = new Binder(argHandler, log); + debuggee = binder.bindToDebugee(debuggeeName); + debuggee.redirectStderr(log, "debuggee > "); + debuggee.createIOPipe(); + eventRManager = debuggee.getEventRequestManager(); + + vm = debuggee.VM(); + eventRManager = vm.eventRequestManager(); + + waitForDebuggeeClassPrepared(); + + if (vm.canRedefineClasses()) { + + execTest(); + + debuggee.resume(); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) { + display("Waiting for the debuggee's finish..."); + debuggee.waitFor(); + + display("Getting the debuggee's exit status."); + int status = debuggee.getStatus(); + if (status != (Consts.TEST_PASSED + Consts.JCK_STATUS_BASE)) { + complain("Debuggee returned UNEXPECTED exit status: " + status); + exitStatus = Consts.TEST_FAILED; + } + } else { + throw new TestBug("Last event is not the VMDeathEvent"); + } + + } else { + display("vm.canRedefineClasses() == false : test is cancelled"); + vm.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } catch (VMDisconnectedException e) { + exitStatus = Consts.TEST_FAILED; + complain("The test cancelled due to VMDisconnectedException."); + e.printStackTrace(out); + display("Trying: vm.process().destroy();"); + if (vm != null) { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } + + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + complain("The test has not finished normally. Forcing: vm.exit()."); + if (vm != null) { + vm.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + debuggee.resume(); + getEventSet(); + } + + return exitStatus; + } + + + private static void execTest() { + + ThreadReference mainThread = debuggee.threadByName("main"); + + // Set first breakpoint to have isobsolete003b class loaded. + BreakpointRequest bpRequest = debuggee.makeBreakpoint(debuggeeClass, "main", brkpMainLineNumber); + bpRequest.addThreadFilter(mainThread); + bpRequest.addCountFilter(1); + bpRequest.enable(); + + waitForEvent(bpRequest); + bpRequest.disable(); + + // At this point isobsolete003b class should be loaded in debuggee. + String redefName = prefix + ".isobsolete003b"; + + ReferenceType redefClass = debuggee.classByName(redefName); + if (redefClass == null) { + throw new TestBug(redefName + "is not found in debuggee."); + } + + String methodName = "foo"; + Method method = (Method) redefClass.methodsByName(methodName).get(0); + + // save some values for check in future + Method oldMethod = method; + Location oldLocation = method.location(); + long oldCodeIndex = oldLocation.codeIndex(); + String oldRetTypeName = method.returnTypeName(); + int oldHashCode = method.hashCode(); + + // Set new breakpoint to have isobsolete003b.foo() method on stack before redefinition. + bpRequest = debuggee.makeBreakpoint(redefClass, methodName, brkpFooLineNumber); + bpRequest.addThreadFilter(mainThread); + bpRequest.addCountFilter(1); + bpRequest.enable(); + + waitForEvent(bpRequest); + bpRequest.disable(); + + display("requested BreakpointEvent for foo() method received;"); + try { + if (!mainThread.frame(0).location().method().equals(method)) { + throw new TestBug("foo() method is not on the top of the main thread stack"); + } + } catch (IncompatibleThreadStateException e) { + throw new Failure("Unexpected IncompatibleThreadStateException while comparing mainThread.frame(0).location().method(): " + e.getMessage()); + } + + display("Making redefineClasses(mapClassToBytes())."); + vm.redefineClasses(mapClassToBytes()); + + // Check isObsolete after redefinition + try { + method = mainThread.frame(0).location().method(); + } catch (IncompatibleThreadStateException e) { + throw new Failure("Unexpected IncompatibleThreadStateException while getting mainThread.frame(0).location().method(): " + e.getMessage()); + } + if (!method.isObsolete()) { + complain("method.isObsolete() == true for foo() method after redefineClasses()"); + exitStatus = Consts.TEST_FAILED; + } else { + // Do other checks for obsolete method. + + if (method.equals(oldMethod)) { + complain("equals(oldMethod) returned true for obsolete method."); + exitStatus = Consts.TEST_FAILED; + } + + List l = null; + Location loc = null; + try { + l = method.allLineLocations(); + if (l.size() > 0) { + complain("allLineLocations() returned a list with non-zero size for obsolete method." + + "Number of Locations :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + try { + l = method.allLineLocations(vm.getDefaultStratum(), null); + if (l.size() > 0) { + complain("allLineLocations(vm.getDefaultStratum(), null) returned a list with non-zero size for obsolete method." + + "Number of Locations :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + try { + l = method.locationsOfLine(1); + if (l.size() > 0) { + complain("locationsOfLine(1) returned a list with non-zero size for obsolete method." + + "Number of Locations :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + try { + l = method.locationsOfLine(vm.getDefaultStratum(), null, 1); + if (l.size() > 0) { + complain("locationsOfLine(vm.getDefaultStratum(), null, 1) returned a list with non-zero size for obsolete method." + + "Number of Locations :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + try { + l = method.arguments(); + if (l.size() > 0) { + complain("arguments() returned a list with non-zero size for obsolete method." + + "Size of list :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + l = method.argumentTypeNames(); + if (l.size() > 0) { + complain("argumentTypeNames() returned a list with non-zero size for obsolete method." + + "Size of list :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + + try { + l = method.argumentTypes(); + if (l.size() > 0) { + complain("argumentsTypes() returned a list with non-zero size for obsolete method." + + "Size of list :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (ClassNotLoadedException e) { + // it is expected + } + + try { + l = method.variables(); + if (l.size() > 0) { + complain("variables() returned a list with non-zero size for obsolete method." + + "Size of list :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + try { + l = method.variablesByName("dummyInt"); + if (l.size() > 0) { + complain("variablesByName(oldVar.name()) returned a list with non-zero size for obsolete method." + + "Size of list :" + l.size()); + exitStatus = Consts.TEST_FAILED; + } + } catch (AbsentInformationException e) { + // it is expected + } + + byte[] b = method.bytecodes(); + if (b.length > 0) { + complain("bytecodes() returned an array with non-zero length for obsolete method." + + "Number of bytes :" + b.length); + exitStatus = Consts.TEST_FAILED; + } + + loc = method.location(); + if (loc != null && loc == oldLocation) { + complain("location() returned old location for obsolete method."); + exitStatus = Consts.TEST_FAILED; + } + + loc = method.locationOfCodeIndex(oldCodeIndex); + if (loc != null) { + complain("locationOfCodeIndex(oldCodeIndex) returned not-null location for obsolete method."); + exitStatus = Consts.TEST_FAILED; + } + + String rtName = method.returnTypeName(); + if (rtName.equals(oldRetTypeName)) { + complain("returnTypeName() returned an old string for obsolete method: " + rtName); + exitStatus = Consts.TEST_FAILED; + } + + try { + Type rType = method.returnType(); + if (rType != null) { + complain("returnType() returned not-null Type for obsolete method: " + rType.name()); + exitStatus = Consts.TEST_FAILED; + } + } catch (ClassNotLoadedException e) { + // it is expected + } + + int hashCode = method.hashCode(); + if (hashCode == oldHashCode) { + complain("hashCode() returned old value for obsolete method: " + hashCode); + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + /** + * Returns Map object for redefinition. + * + */ + private static Map mapClassToBytes() { + String[] args = argHandler.getArguments(); + if (args.length <= 0) { + throw new Failure("mapClassToBytes(): Test arguments are not found."); + } + + String testDir = args[0]; + display("Test current dir = " + testDir); + + String filePrefix = File.separator + "nsk" + + File.separator + "jdi" + + File.separator + "Method" + + File.separator + "isObsolete"; + + String fileToRedefineName = testDir + + File.separator + "newclass" + filePrefix + + File.separator + "isobsolete003b.class"; + + display("fileToRedefineName : " + fileToRedefineName); + + byte[] arrayToRedefine; + try { + File fileToRedefine = new File(fileToRedefineName); + if (!fileToRedefine.exists()) { + throw new Failure("mapClassToBytes(): fileToRedefine does not exist"); + } + + FileInputStream inputFile = new FileInputStream(fileToRedefine); + arrayToRedefine = new byte [(int) fileToRedefine.length()]; + inputFile.read(arrayToRedefine); + inputFile.close(); + + } catch (IOException e) { + complain("unexpected IOException: " + e); + throw new Failure(e); + } + + String testClassName = prefix + ".isobsolete003b"; + ReferenceType testClass = debuggee.classByName(testClassName); + + HashMap mapForClass = new HashMap(); + mapForClass.put(testClass, arrayToRedefine); + + return mapForClass; + } + + private static Event waitForEvent (EventRequest evRequest) { + + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else if (curEvent.request().equals(evRequest)) { + display("Requested event received."); + resultEvent = curEvent; + break; + } else { + throw new TestBug("Unexpected Event received: " + curEvent.toString()); + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + private static void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + private static void waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + debuggeeClass = event.referenceType(); + if (!debuggeeClass.name().equals(debuggeeName)) + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/TestDescription.java new file mode 100644 index 00000000000..492609bc797 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/TestDescription.java @@ -0,0 +1,108 @@ +/* + * 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/Method/isObsolete/isobsolete003. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks the following assertions: + * if Method object is obsolete, then + * - all method of Method class which are specified to return the List, + * must return zero size list or throw AbsentInformationException, + * - bytecodes() method must return empty array, + * - location() method can not return Location equal to one + * before redefinition, + * - locationOfCodeIndex(long codeIndex) method must return null, + * - returnTypeName() method can not return String equal to one + * before redefinition, + * - returnType() method must return null or throw ClassNotLoadedException, + * - hashCode() method can not return int value equal to one before + * redefinition. + * The debugger program - nsk.jdi.Method.isObsolete.isobsolete003; + * the debuggee program - nsk.jdi.Method.isObsolete.isobsolete003a; + * the class to be redefined - nsk.jdi.Method.isObsolete.isobsolete003b. + * The test contains the precompiled class file isobsolete003b.klass . + * Its source file is isobsolete003b.java.rdf and presents class which + * redefines isobsolete003b class. + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Upon getting the debuggee VM started, the debugger creates the special + * requests for event when isobsolete003a class is prepared and for event + * when isobsolete003b is load into debuggee VM. This actions are needed + * to take return values on some methods for further comparisons. + * Then debugger creates breakpoint request at line of 'isobsolete003b.foo()' + * method and resumes debuggee. After receiving of requested breakpoint event, + * the debuggee's main thread is suspended and 'foo()' method is at its top + * frame.. At this moment, the debugger redefines isobsolete003b class. + * The isobsolete003b.klass which redefines isobsolete003b class, contains + * non-equivalent version of 'foo()' method. Thus, after redefinition, + * new mirror of 'foo()' method is obsolete. After this, the debugger performs + * the checks of assertions listed 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: + * The test is aimed to increase jdi source code coverage and checks + * the method which were not yet covered by previous tests for isObsolete() + * method. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was updated according to rfe: + * 4691123 TEST: some jdi tests contain precompiled .klass files undes SCCS. + * isobsolete003b.java.rdf was moved into newclass directory and renamed + * to isobsolete003b.java. + * The precompiled class file is created during test base build process. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.isObsolete.isobsolete003 + * nsk.jdi.Method.isObsolete.isobsolete003a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isObsolete.isobsolete003 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/newclass/isobsolete003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/newclass/isobsolete003b.java new file mode 100644 index 00000000000..935c873cea3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/newclass/isobsolete003b.java @@ -0,0 +1,39 @@ +/* + * 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.Method.isObsolete; + +/** + * This is the redefining class for isobsolete003 JDI test. + */ +public class isobsolete003b { + + static Integer foo(int i) { + Integer j = null; + try { + j = new Integer(new String(String.valueOf(i))); + } catch (NumberFormatException e) { + } + return j; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003a.java new file mode 100644 index 00000000000..be4a6004411 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003a.java @@ -0,0 +1,60 @@ +/* + * 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.Method.isObsolete; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * The debugged application of the test. + */ +public class isobsolete003a { + + private static int exitStatus; + private static ArgumentHandler argHandler; + private static Log log; + private static IOPipe pipe; + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + isobsolete003b.foo(1); + isobsolete003b.foo(2); // isobsolete003.brkpMainLineNumber + + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003b.java new file mode 100644 index 00000000000..33145ec4c48 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003b.java @@ -0,0 +1,35 @@ +/* + * 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.Method.isObsolete; + +// THIS TEST IS LINE NUMBER SENSITIVE +/** + * This is the class to be redefined for isobsolete003 JDI test. + */ +public class isobsolete003b { + + static Integer foo(int i) { + int dummyInt = i; + return new Integer(i); // isobsolete003.brkpFooLineNumber + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001.java new file mode 100644 index 00000000000..5b062b0f217 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001.java @@ -0,0 +1,210 @@ +/* + * 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.Method.isStaticInitializer; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isStaticInitializer()
    + * complies with its spec and its returned value is equal to
    + * true for a Method object returned by methodsByName("");
    + * and to false for other name.
    + */ + +public class isstinitializer001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isStaticInitializer/isstinitializer001", + sHeader2 = "--> isstinitializer001: ", + sHeader3 = "##> isstinitializer001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isstinitializer001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isStaticInitializer.isstinitializer001a"; + + String mName = "nsk.jdi.Method.isStaticInitializer"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("isstinitializer001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".TestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName(""); + if (methods.size() <= 0) { + log3("ERROR : methods.size() <= 0 for '' " + methods.size()); + testExitCode = FAILED; + break; + } + + Method testMethod = (Method) methods.get(0); + if (!testMethod.isStaticInitializer()) { + log3("ERROR : method is not an initializer"); + testExitCode = FAILED; + break; + } + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test2"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test2"); + testExitCode = FAILED; + break; + } + testMethod = (Method) methods.get(0); + if (testMethod.isStaticInitializer()) { + log3("ERROR : test2 is an initializer"); + testExitCode = FAILED; + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001/TestDescription.java new file mode 100644 index 00000000000..9f275d1ab48 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001/TestDescription.java @@ -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/Method/isStaticInitializer/isstinitializer001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.isStaticInitializer() + * complies with its spec: + * public boolean isStaticInitializer() + * Determine if this method is a static initializer. + * Returns: true if the method is a static initializer; false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isStaticInitializer.isstinitializer001; + * the debuggee program - nsk.jdi.Method.isStaticInitializer.isstinitializer001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.isStaticInitializer.isstinitializer001 + * nsk.jdi.Method.isStaticInitializer.isstinitializer001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isStaticInitializer.isstinitializer001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001a.java new file mode 100644 index 00000000000..6cc5df63ccc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isStaticInitializer/isstinitializer001a.java @@ -0,0 +1,123 @@ +/* + * 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.Method.isStaticInitializer; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isstinitializer001 JDI test. + */ + +public class isstinitializer001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> isstinitializer001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> isstinitializer001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.isSynchronized()
    + * complies with its spec and its returned value is equal to
    + * true for a class method declared as synchronized and to
    + * false otherwise.
    + */ + +public class issynchronized001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/isSynchronized/issynchronized001", + sHeader2 = "--> issynchronized001: ", + sHeader3 = "##> issynchronized001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new issynchronized001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.isSynchronized.issynchronized001a"; + + String mName = "nsk.jdi.Method.isSynchronized"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issynchronized001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".TestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test1"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test1"); + testExitCode = FAILED; + break; + } + Method testMethod = (Method) methods.get(0); + if (!testMethod.isSynchronized()) { + log3("ERROR : test1 is not a synchronized method"); + testExitCode = FAILED; + break; + } + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("test2"); + if (methods.size() != 1) { + log3("ERROR : methods.size() != 1 for test2"); + testExitCode = FAILED; + break; + } + testMethod = (Method) methods.get(0); + if (testMethod.isSynchronized()) { + log3("ERROR : test2 is a synchronized method"); + testExitCode = FAILED; + break; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isSynchronized/issynchronized001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isSynchronized/issynchronized001/TestDescription.java new file mode 100644 index 00000000000..3e8f9d36eb4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isSynchronized/issynchronized001/TestDescription.java @@ -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/Method/isSynchronized/issynchronized001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.isSynchronized() + * complies with its spec: + * public boolean isSynchronized() + * Determine if this method is synchronized. + * Returns: true if the method is declared synchronized; false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.Method.isSynchronized.issynchronized001; + * the debuggee program - nsk.jdi.Method.isSynchronized.issynchronized001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.isSynchronized.issynchronized001 + * nsk.jdi.Method.isSynchronized.issynchronized001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isSynchronized.issynchronized001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isSynchronized/issynchronized001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isSynchronized/issynchronized001a.java new file mode 100644 index 00000000000..83d7ff8f19c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isSynchronized/issynchronized001a.java @@ -0,0 +1,122 @@ +/* + * 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.Method.isSynchronized; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isSynchronized001 JDI test. + */ + +public class issynchronized001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> issynchronized001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> issynchronized001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + private static void failure(String msg) { + complain(msg); + exitStatus = Consts.TEST_FAILED; + } + + public static int run(String argv[], PrintStream out) { + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + failure("Class '" + debuggeeName + "' not found."); + } + + execTest(); + debuggee.quit(); + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + String expMethodName = "foo"; + + List methods = debuggeeClass.methodsByName(expMethodName); + if (methods.size() != 3) { + failure("Found unexpected number of method " + expMethodName + " : " + methods.size()); + } + Iterator it = methods.iterator(); + while (it.hasNext()) { + Method method = it.next(); + if (method.isVarArgs()) { + display("Method.isVarArgs() returned expected true for method " + expMethodName); + display("\t signature:" + method.signature()); + } else { + complain("Method.isVarArgs() returned unexpected false for method " + expMethodName); + complain("\t signature:" + method.signature()); + exitStatus = Consts.TEST_FAILED; + } + } + + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001/TestDescription.java new file mode 100644 index 00000000000..77491f47832 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/Method/isVarArgs/isvarargs001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isVarArgs() method of Method interface. + * The test checks if the method returns true for any + * mirrored method which has varargs argument. + * The test consists of a debugger program (isvarargs001.java) + * and debuggee application (isvarargs001a.java). + * Package name is nsk.jdi.Method.isVarArgs . + * 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 finds mirrors of debuggee's methods 'foo' + * which have varargs argument and calls isVarArgs() method + * for each found method mirror. The test fails if false is + * returned once or more. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.isVarArgs.isvarargs001 + * nsk.jdi.Method.isVarArgs.isvarargs001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.isVarArgs.isvarargs001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001a.java new file mode 100644 index 00000000000..2b43abe0dda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001a.java @@ -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.Method.isVarArgs; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isvarargs001a { + + //------------------------------------------------------- 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 + + //------------------------------------------------------ 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(isvarargs001.SIGNAL_READY); + receiveSignal(isvarargs001.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific methods + + static String foo (int... args) { + return "1"; + } + + static String foo (Integer... args) { + return "2"; + } + + static String foo (String s, String... args) { + return "3"; + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java new file mode 100644 index 00000000000..94a9e7f4c57 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java @@ -0,0 +1,260 @@ +/* + * 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.Method.locationOfCodeIndex; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.locationOfCodeIndex()
    + * complies with its spec for non-abstract, non-native method.
    + * The test works as follows.
    + * In a debuggee, a TestClass contains a "testedmethod".
    + * After getting a mirror of the testedmethod, a debugger gets
    + * a List allLineLocations containing executable lines of
    + * the method, and performs a loop on the List, in which it
    + * each element in the List is equal to a Location object
    + * getting with call to the method locationOfCodeIndex().
    + * Since the method allLineLocations returnes a list of executable
    + * lines the check that the method locationOfCodeIndex()
    + * doesn't return null is also perfomed.
    + */ + +public class locationofcodeindex001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new locationofcodeindex001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001a"; + + private String testedClassName = + "nsk.jdi.Method.locationOfCodeIndex.TestClass"; + + //String mName = "nsk.jdi.Method.locationOfCodeIndex"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testedMethod = "testedmethod"; + + List methods = null; + Method m = null; + List locations = null; + + log2(" getting: List classes = vm.classesByName(testedClassName);"); + List classes = vm.classesByName(testedClassName); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested method object 'm'"); + methods = ((ReferenceType) classes.get(0)).methodsByName(testedMethod); + m = (Method) methods.get(0); + + log2("......locations = m.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = m.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + log2("......checking up on a value of locations.size(); 0 is not expected"); + if (locations.size() == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + log2(" getting: ListIterator li = locations.listIterator();"); + ListIterator li = locations.listIterator(); + + Location loc1 = null; + Location loc2 = null; + long codeIndex; + + log2("......loop of testing elements in allLineLocations"); + for (int ifor = 1; li.hasNext(); ifor++) { + loc1 = (Location) li.next(); + codeIndex = loc1.codeIndex(); + loc2 = m.locationOfCodeIndex(codeIndex); + if (loc2 == null) { + log3("ERROR: a location in allLineLocations == null; element in List: " + ifor); + testExitCode = FAILED; + } else { + if (!loc2.equals(loc1)) { + log3("ERROR: !loc2.equals(loc1); element in List: " + ifor); + testExitCode = FAILED; + } + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001/TestDescription.java new file mode 100644 index 00000000000..369c7017b06 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/Method/locationOfCodeIndex/locationofcodeindex001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.locationOfCodeIndex() + * complies with its spec: + * public Location locationOfCodeIndex(long codeIndex) + * Returns a Location for the given code index. + * Returns: the Location corresponding to the given code index or null if + * the specified code index is not a valid code index for this method + * (native and abstract methods will always return null). + * when a tested method is not a native or abstract. + * The test works as follows: + * The debugger program - nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001; + * the debuggee program - nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * In general, this test is potentially option depended + * since its spec states since it uses the method + * Method.allLineLocations. + * Hence it also needs to be compiled with the option + * JAVAC_OPTS=-g + * in the locationofcodeindex001.cfg file. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001 + * nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001a + * + * @comment make sure locationofcodeindex001a is compiled with full debug info + * @clean nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001a + * @compile -g:lines,source,vars ../locationofcodeindex001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.locationOfCodeIndex.locationofcodeindex001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001a.java new file mode 100644 index 00000000000..c3fa374b746 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001a.java @@ -0,0 +1,133 @@ +/* + * 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.Method.locationOfCodeIndex; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the locationofcodeindex001 JDI test. + */ + +public class locationofcodeindex001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> locationofcodeindex001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> locationofcodeindex001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.locationsOfLine()
    + * complies with its spec for non-abstract, non-native method.
    + * The test checks up that for each line in the List returned
    + * by the method Method.allLineLocations(), call to the method
    + * Method.locationsOfLine(lineNumber) returns
    + * non-empty List object in which
    + * each object is a Location object.
    + * Not throwing AbsentInformationException or
    + * InvalidLineNumberException
    + * is checked up as well.
    + */ + +public class locationsofline001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/locationsOfLine/locationsofline001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new locationsofline001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.locationsOfLine.locationsofline001a"; + + String mName = "nsk.jdi.Method.locationsOfLine"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List methods = null; + Method m = null; + List locations = null; + + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested method object 'm'"); + methods = ((ReferenceType) classes.get(0)).methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + + log2("......locations = m.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = m.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + int size = locations.size(); + if (size == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + ListIterator li1 = locations.listIterator(); + + log2(" the loop of checking locations in the returned list; neither AbsentInformationException no InvalidLineNumberException is expected"); + + label1: + for (int ifor1 = 0; ifor1 < size; ifor1++) { + + int lineNumber = ((Location) li1.next()).lineNumber(); + + try { + log2("......List lineLocations = m.locationsOfLine(" + lineNumber + ");"); + List lineLocations = m.locationsOfLine(lineNumber); + int size1 = lineLocations.size(); + if (size1 == 0) { + testExitCode = FAILED; + log3("ERROR: lineLocations.size() == 0"); + break label1; + } + ListIterator li2 = lineLocations.listIterator(); + try { + for (; li2.hasNext(); ) { + Location loc = (Location) li2.next(); + } + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + break label1; + } + + } catch ( InvalidLineNumberException e1 ) { + testExitCode = FAILED; + log3("ERROR: InvalidLineNumberException"); + break label1; + } catch ( AbsentInformationException e2 ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break label1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001/TestDescription.java new file mode 100644 index 00000000000..1f649e3c15b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001/TestDescription.java @@ -0,0 +1,101 @@ +/* + * 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/Method/locationsOfLine/locationsofline001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.locationsOfLine() + * complies with its spec: + * public java.util.List locationsOfLine(int lineNumber) + * throws AbsentInformationException + * Returns a list containing each Location that maps to the given line. + * The returned list will contain a location for each disjoint range of code + * indices that have been assigned to the given line by the compiler and/or VM. + * Each returned location corresponds to the beginning of this range. + * Parameters: lineNumber - the line number + * Returns: a List of Location objects that map to the given line number. + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * InvalidLineNumberException - + * if there is no executable code in this method associated with + * the given line. + * when a tested method is non-native, non-abstract and + * when neither InvalidLineNumberException + * no AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.locationsOfLine.locationsofline001; + * the debuggee program - nsk.jdi.Method.locationsOfLine.locationsofline001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * In general, this test is potentially option depended + * since its spec states: + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * However, unlike some tests that need to be compiled with the option + * JAVAC_OPTS=-g + * (method.arguments(), method.variables() and method.variablesByName) + * at the date of implementing the test, + * javac prepares full information for the test without the option. + * Nonetheless, the locationsofline002.cfg file contains the option + * in order to avoid possible failures in future in case of any changes + * in javac. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.locationsOfLine.locationsofline001 + * nsk.jdi.Method.locationsOfLine.locationsofline001a + * + * @comment make sure locationsofline001a is compiled with full debug info + * @clean nsk.jdi.Method.locationsOfLine.locationsofline001a + * @compile -g:lines,source,vars ../locationsofline001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.locationsOfLine.locationsofline001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001a.java new file mode 100644 index 00000000000..6402eb1b046 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001a.java @@ -0,0 +1,198 @@ +/* + * 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.Method.locationsOfLine; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the locationsofline001 JDI test. + */ + +public class locationsofline001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> locationsofline001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> locationsofline001a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * 32 --> 1001 + * 32 --> 1002 + * 32 --> 1003 + * 32 --> 1004 + * For this case locationsOfLine('TestStratum', null, 1001) should return single location for java line 32, + * and for lines 1002, 1003, 1004 should return empty list. + * 33 --> 1005 + * 34 --> 1005 + * 35 --> 1005 + * 36 --> 1005 + * For this case locationsOfLine('TestStratum', null, 1005) should return 4 locations for java lines 33 - 36, + * 37 --> 1006 + * 38 --> 1007 + * 39 --> 1008 + * For this case locationsOfLine for lines 1006-1007 should return single corresponding java line. + * Debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for method '' method 'com.sun.jdi.Method.locationsOfLine(String stratum, String sourceName, int lineNumber)' + * returns correct values for 3 cases described above. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.locationsOfLine_ssi.locationsOfLine_ssi002.locationsOfLine_ssi002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.locationsOfLine_ssi.locationsOfLine_ssi002.locationsOfLine_ssi002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.Method.locationsOfLine_ssi.locationsOfLine_ssi002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.sde.*; + +public class locationsOfLine_ssi002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new locationsOfLine_ssi002().runIt(argv, out); + } + + protected void preparePatchedClassFile(String className) { + String smapFileName = "TestSMAP.smap"; + SmapGenerator smapGenerator = new SmapGenerator(); + + SmapStratum smapStratum = new SmapStratum(testStratumName); + smapStratum.addFile(testStratumSourceName, testStratumSourcePath); + + // single output line is mapped to the multiple input lines + // 1001 -> 32 + // 1002 -> 32 + // 1003 -> 32 + // 1004 -> 32 + smapStratum.addLineData(1001, testStratumSourceName, 1, INIT_LINE, 1); + smapStratum.addLineData(1002, testStratumSourceName, 1, INIT_LINE, 1); + smapStratum.addLineData(1003, testStratumSourceName, 1, INIT_LINE, 1); + smapStratum.addLineData(1004, testStratumSourceName, 1, INIT_LINE, 1); + + // multiple output lines are mapped to the single input line + // 1005 -> 33 + // 1005 -> 34 + // 1005 -> 35 + // 1005 -> 36 + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 1, 1); + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 2, 1); + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 3, 1); + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 4, 1); + + // single output line is mapped to the single input line + // 1006 -> 37 + // 1007 -> 38 + // 1008 -> 39 + smapStratum.addLineData(1006, testStratumSourceName, 1, INIT_LINE + 5, 1); + smapStratum.addLineData(1007, testStratumSourceName, 1, INIT_LINE + 6, 1); + smapStratum.addLineData(1008, testStratumSourceName, 1, INIT_LINE + 7, 1); + + smapGenerator.addStratum(smapStratum, false); + + savePathcedClassFile(className, smapGenerator, smapFileName); + } + + public void doTest() { + String className = TestClass1.class.getName(); + + preparePatchedClassFile(className); + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + String methodName = ""; + + Method methodToTest = null; + + for (Method method : debuggee.classByName(className).methods()) { + if (method.name().equals(methodName)) { + methodToTest = method; + break; + } + } + + if (methodToTest == null) { + throw new TestBug("Method with name '' was not found in ReferenceType for class " + className); + } + + List expectedLocations = new ArrayList(); + + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1001, INIT_LINE)); + log.display("Check case when single output line is mapped to the multiple input lines"); + // single output line is mapped to the multiple input lines + // 1001 -> 32 + // 1002 -> 32 + // 1003 -> 32 + // 1004 -> 32 + try { + // locationsOfLine.(testStratum, testStratumSource, 1001) should + // return single java location + compareLocations( + methodToTest.locationsOfLine(testStratumName, testStratumSourceName, 1001), + expectedLocations, + testStratumName); + + // locationsOfLine.(testStratum, testStratumSource, [1002, 1003, + // 1004]) should return empty list + expectedLocations.clear(); + for (int i = 1002; i <= 1004; i++) + compareLocations( + methodToTest.locationsOfLine(testStratumName, testStratumSourceName, i), + expectedLocations, + testStratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 1)); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 2)); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 3)); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 4)); + + log.display("Check case when multiple output lines are mapped to the single input line"); + // multiple output lines are mapped to the single input line + // 1005 -> 33 + // 1005 -> 34 + // 1005 -> 35 + // 1005 -> 36 + try { + // locationsOfLine.(testStratum, testStratumSource, 1005) should + // return 4 java locations + compareLocations( + methodToTest.locationsOfLine(testStratumName, testStratumSourceName, 1005), + expectedLocations, + testStratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + log.display("Check case when single output line is mapped to the single input line"); + // single output line is mapped to the single input line + // 1006 -> 37 + // 1007 -> 38 + // 1008 -> 39 + try { + for (int i = 0; i < 3; i++) { + // locationsOfLine.(testStratum, testStratumSource, line) should + // return 1 java locations + expectedLocations.clear(); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1006 + i, INIT_LINE + 5 + i)); + compareLocations( + methodToTest.locationsOfLine(testStratumName, testStratumSourceName, 1006 + i), + expectedLocations, + testStratumName); + } + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java new file mode 100644 index 00000000000..eed8d4daeb0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2007, 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/Method/locationsOfLine_ssi/locationsOfLine_ssi003. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.Method.locationsOfLine(String stratum, String sourceName, int lineNumber)' returns + * correct values for all stratums available for class and if sourceName == null locaitions for all sources are returned. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined (each method has locations in 3 different sources): + * "Java" "TestStratum" + * + * 9 --> 1000, source1, path1 + * 10 --> 1000, source2, path2 + * 11 --> 1000, source3, path3 + * ... ... + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1100, source2, path2 + * 22 --> 1100, source3, path3 + * ... ... + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1200, source2, path2 + * 33 --> 1200, source3, path3 + * ... ... + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for all methods defined in this class method 'com.sun.jdi.Method.locationsOfLine(String stratum, String sourceName, int lineNumber)' + * for all test stratums('TestStratum1'-'TestStratum3') returns only expected locations depending on given line number and source name, + * and if source name is null locations for all sources are returned. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.locationsOfLine_ssi.locationsOfLine_ssi003.locationsOfLine_ssi003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.locationsOfLine_ssi.locationsOfLine_ssi003.locationsOfLine_ssi003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.Method.locationsOfLine_ssi.locationsOfLine_ssi003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class locationsOfLine_ssi003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new locationsOfLine_ssi003().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type5(className, testStratumCount); + /* + * Method 'prepareDefaultPatchedClassFile_Type5' creates class file with + * following line mapping for each TestStratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1, path1 + * 10 --> 1000, source2, path2 + * 11 --> 1000, source3, path3 ... ... + * + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1100, source2, path2 + * 22 --> 1100, source3, path3 ... ... + * + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1200, source2, path2 + * 33 --> 1200, source3, path3 ... ... + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + log.display("Check stratum: " + stratumName); + + for (Method method : referenceType.methods()) { + log.display("Check method '" + method.name() + "'"); + List locationsOfMethod = locationsOfMethod( + testStratumData.get(stratumName).allLocations, + method.name()); + + log.display("Check locations with specified source name"); + check_Method_locationsOfLine(method, stratumName, false, locationsOfMethod); + + log.display("Check locations for all sources"); + check_Method_locationsOfLine(method, stratumName, true, locationsOfMethod); + } + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java new file mode 100644 index 00000000000..96d54ca02d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java @@ -0,0 +1,274 @@ +/* + * 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.Method.locationsOfLine_ssi; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.locationsOfLine(String, String, int)
    + * complies with its spec.
    + *
    + * The test checks up that for each line in the List returned
    + * by the method Method.allLineLocations(), the method
    + * locationsOfLine(defaultStratum, null, lineNumber) returns
    + * non-empty List object in which
    + * each object is a Location object.
    + * Not throwing AbsentInformationException
    + * is checked up as well.
    + *
    + */ + +public class locationsofline_ssi001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new locationsofline_ssi001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001a"; + + String mName = "nsk.jdi.Method.locationsOfLine_ssi"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List methods = null; + Method m = null; + List locations = null; + + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + log2(" getting a tested method object 'm'"); + methods = ((ReferenceType) classes.get(0)).methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + + log2("......locations = m.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = m.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + int size = locations.size(); + if (size == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + ListIterator li1 = locations.listIterator(); + + log2("......the loop of checking locations in the returned list;"); + log2(" neither AbsentInformationException no InvalidLineNumberException is expected"); + + label1: + for (int ifor1 = 0; ifor1 < size; ifor1++) { + + int lineNumber = ((Location) li1.next()).lineNumber(); + + try { + log2("......List lineLocations = m.locationsOfLine(defaultStratum, null, " + lineNumber + ");"); + List lineLocations = m.locationsOfLine(defaultStratum, null, lineNumber); + int size1 = lineLocations.size(); + if (size1 == 0) { + testExitCode = FAILED; + log3("ERROR: lineLocations.size() == 0"); + break label1; + } + ListIterator li2 = lineLocations.listIterator(); + try { + for (; li2.hasNext(); ) { + Location loc = (Location) li2.next(); + } + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + break label1; + } + } catch ( InvalidLineNumberException e1 ) { + testExitCode = FAILED; + log3("ERROR: InvalidLineNumberException"); + break label1; + } catch ( AbsentInformationException e2 ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break label1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001/TestDescription.java new file mode 100644 index 00000000000..124556bee7e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001/TestDescription.java @@ -0,0 +1,99 @@ +/* + * 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/Method/locationsOfLine_ssi/locationsofline_ssi001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.locationsOfLine(String,String,int) + * complies with its spec: + * public List locationsOfLine(String stratum, String sourceName, int lineNumber) + * throws AbsentInformationException + * Returns a List containing all Location objects that map to + * the given line number and source name. + * Returns a list containing each Location that maps to the given line. + * The returned list will contain a location for each disjoint range of + * code indices that have been assigned to the given line by the compiler + * and/or VM. Each returned location corresponds to the beginning of + * this range. An empty list will be returned if + * there is no executable code at the specified line number; + * specifically, native and abstract methods will always return an empty list. + * Returned list is for the specified stratum + * (see Location for a description of strata). + * Parameters: stratum - the stratum to use for comparing line number and + * source name, or null to use the default stratum + * sourceName - the source name containing the line number, or + * null to match all source names + * lineNumber - the line number + * Returns: a List of Location objects that map to the given line number. + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * Or if sourceName is non-null + * and source name information is not present. + * The test works as follows: + * The debugger program - nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001; + * the debuggee program - nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The option + * JAVAC_OPTS=-g + * is put in the locationsofline002.cfg file. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001 + * nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001a + * + * @comment make sure locationsofline_ssi001a is compiled with full debug info + * @clean nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001a + * @compile -g:lines,source,vars ../locationsofline_ssi001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.locationsOfLine_ssi.locationsofline_ssi001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001a.java new file mode 100644 index 00000000000..24d9ee5ac7f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001a.java @@ -0,0 +1,136 @@ +/* + * 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.Method.locationsOfLine_ssi; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the locationsofline_ssi001 JDI test. + */ + +public class locationsofline_ssi001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.returnType()
    + * complies with its spec when a type is one of PrimitiveTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class returntype001aTestClass {
    + * public boolean bl () { return false; }
    + * public byte bt () { return 0; }
    + * public char ch () { return 0; }
    + * public double db () { return 0.0d; }
    + * public float fl () { return 0.0f; }
    + * public int in () { return 0; }
    + * public long ln () { return 0; }
    + * public short sh () { return 0; }
    + * }
    + *
    + * for all of the above primitive type return methods,
    + * a debugger forms their corresponding Type objects.
    + *
    + */ + +public class returntype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/returnType/returntype001", + sHeader2 = "--> returntype001: ", + sHeader3 = "##> returntype001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new returntype001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.returnType.returntype001a"; + + String mName = "nsk.jdi.Method.returnType"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("returntype001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".returntype001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("bl"); + m = (Method) methods.get(0); + try { + BooleanType blType = (BooleanType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (BooleanType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (BooleanType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 1: // byte + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("bt"); + m = (Method) methods.get(0); + try { + ByteType btType = (ByteType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ByteType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ByteType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 2: // char + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ch"); + m = (Method) methods.get(0); + try { + CharType chType = (CharType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (CharType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (CharType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 3: // double + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("db"); + m = (Method) methods.get(0); + try { + DoubleType dbType = (DoubleType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (DoublerType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (DoubleType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 4: // float + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("fl"); + m = (Method) methods.get(0); + try { + FloatType flType = (FloatType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (FloatType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (FloatType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 5: // int + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("in"); + m = (Method) methods.get(0); + try { + IntegerType inType = (IntegerType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (IntegerType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (IntegerType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 6: // long + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ln"); + m = (Method) methods.get(0); + try { + LongType lnType = (LongType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (LongType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (LongType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 7: // short + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("sh"); + m = (Method) methods.get(0); + try { + ShortType shType = (ShortType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ShortType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ShortType) m.returnType();"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype001/TestDescription.java new file mode 100644 index 00000000000..e768300f117 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/Method/returnType/returntype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.returnType() + * complies with its spec: + * public Type returnType() + * throws ClassNotLoadedException + * Returns the return type of the this Method. + * For methods returning primitive values, + * an appropriate PrimitiveType is always returned. + * For methods returning object values, + * the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's + * (that is, the type returned by TypeComponent#enclosingType) class loader. + * Returns: the return Type of this method. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when methods' returnTypes are PrimitiveTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.returnType.returntype001; + * the debuggee program - nsk.jdi.Method.returnType.returntype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.returnType.returntype001 + * nsk.jdi.Method.returnType.returntype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.returnType.returntype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype001a.java new file mode 100644 index 00000000000..cc60cf3099b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype001a.java @@ -0,0 +1,127 @@ +/* + * 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.Method.returnType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the returntype001 JDI test. + */ + +public class returntype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> returntype001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> returntype001a: " + message); + } + + //====================================================== test program + + static returntype001aTestClass obj = new returntype001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.returnType()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class returntype002aTestClass {
    + * public void vd () { return ; }
    + * }
    + *
    + * for the above void method vd,
    + * a debugger forms its corresponding Type object.
    + *
    + */ + +public class returntype002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/returnType/returntype002", + sHeader2 = "--> returntype002: ", + sHeader3 = "##> returntype002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new returntype002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.returnType.returntype002a"; + + String mName = "nsk.jdi.Method.returnType"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("returntype002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".returntype002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // void + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("vd"); + m = (Method) methods.get(0); + try { + VoidType vdType = (VoidType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (VoidType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (VoidType) m.returnType();"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype002/TestDescription.java new file mode 100644 index 00000000000..a1f0548330b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/Method/returnType/returntype002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.returnType() + * complies with its spec: + * public Type returnType() + * throws ClassNotLoadedException + * Returns the return type of the this Method. + * For methods returning primitive values, + * an appropriate PrimitiveType is always returned. + * For methods returning object values, + * the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's + * (that is, the type returned by TypeComponent#enclosingType) class loader. + * Returns: the return Type of this method. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when method's returnType is VoidType. + * The test works as follows: + * The debugger program - nsk.jdi.Method.returnType.returntype002; + * the debuggee program - nsk.jdi.Method.returnType.returntype002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.returnType.returntype002 + * nsk.jdi.Method.returnType.returntype002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.returnType.returntype002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype002a.java new file mode 100644 index 00000000000..6f5813d1475 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype002a.java @@ -0,0 +1,120 @@ +/* + * 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.Method.returnType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the returntype002 JDI test. + */ + +public class returntype002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> returntype002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> returntype002a: " + message); + } + + //====================================================== test program + + static returntype002aTestClass obj = new returntype002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.returnType()
    + * complies with its spec when a type is one of ReferenceTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of the following
    + * class type with methods of ReferenceType return values:
    + *
    + * class returntype003aTestClass {
    + * .
    + * .
    + * public ClassForCheck[] arraymethod () {
    + * return cfc;
    + * }
    + * public ClassForCheck classmethod () {
    + * return classFC;
    + * }
    + * public InterfaceForCheck ifacemethod () {
    + * return iface;
    + * }
    + * }
    + *
    + * a debugger forms their corresponding Type objects.
    + *
    + */ + +public class returntype003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/returnType/returntype003", + sHeader2 = "--> returntype003: ", + sHeader3 = "##> returntype003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new returntype003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.returnType.returntype003a"; + + String mName = "nsk.jdi.Method.returnType"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("returntype003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".returntype003aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // ArrayType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("arraymethod"); + m = (Method) methods.get(0); + try { + ArrayType aType = (ArrayType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ArrayType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ArrayType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 1: // ClassType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("classmethod"); + m = (Method) methods.get(0); + try { + ClassType cType = (ClassType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (ClassType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (ClassType) m.returnType();"); + expresult = 1; + break; + } + break; + + case 2: // InterfaceType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ifacemethod"); + m = (Method) methods.get(0); + try { + InterfaceType iType = (InterfaceType) m.returnType(); + } catch ( ClassCastException e1 ) { + log3("ERROR: CCE: (InterfaceType) m.returnType();"); + expresult = 1; + break; + } catch ( ClassNotLoadedException e2 ) { + log3("ERROR: CNLE: (InterfaceType) m.returnType();"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype003/TestDescription.java new file mode 100644 index 00000000000..1bf496f6848 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/Method/returnType/returntype003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.returnType() + * complies with its spec: + * public Type returnType() + * throws ClassNotLoadedException + * Returns the return type of the this Method. + * For methods returning primitive values, + * an appropriate PrimitiveType is always returned. + * For methods returning object values, + * the appropriate ReferenceType is returned if + * it has been loaded through the enclosing type's + * (that is, the type returned by TypeComponent#enclosingType) class loader. + * Returns: the return Type of this method. + * Throws: ClassNotLoadedException - + * if the type has not yet been loaded through + * the appropriate class loader. + * when methods' returnTypes are ReferenceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.returnType.returntype003; + * the debuggee program - nsk.jdi.Method.returnType.returntype003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.returnType.returntype003 + * nsk.jdi.Method.returnType.returntype003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.returnType.returntype003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype003a.java new file mode 100644 index 00000000000..217c93c5c85 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnType/returntype003a.java @@ -0,0 +1,173 @@ +/* + * 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.Method.returnType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the returntype003 JDI test. + */ + +public class returntype003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> returntype003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> returntype003a: " + message); + } + + //====================================================== test program + + static returntype003aTestClass obj = new returntype003aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.returnTypeNames()
    + * complies with its spec when a type is one of PrimitiveTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class returntypenames001aTestClass {
    + * public boolean bl () { return false; }
    + * public byte bt () { return 0; }
    + * public char ch () { return 0; }
    + * public double db () { return 0.0d; }
    + * public float fl () { return 0.0f; }
    + * public int in () { return 0; }
    + * public long ln () { return 0; }
    + * public short sh () { return 0; }
    + * }
    + *
    + * for all of the above primitive type return methods,
    + * the debugger forms text representations of their
    + * corresponding types that is boolean, byte, char, and etc.
    + *
    + */ + +public class returntypenames001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/returnTypeNames/returntypenames001", + sHeader2 = "--> returntypenames001: ", + sHeader3 = "##> returntypenames001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new returntypenames001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.returnTypeNames.returntypenames001a"; + + String mName = "nsk.jdi.Method.returnTypeNames"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("returntypenames001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".returntypenames001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + String name = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("bl"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("boolean")) { + log3("ERROR: !name.equals('boolean')"); + expresult = 1; + break; + } + break; + + case 1: // byte + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("bt"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("byte")) { + log3("ERROR: !name.equals('byte')"); + expresult = 1; + break; + } + break; + + case 2: // char + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ch"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("char")) { + log3("ERROR: !name.equals(char')"); + expresult = 1; + break; + } + break; + + case 3: // double + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("db"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("double")) { + log3("ERROR: !name.equals('double')"); + expresult = 1; + break; + } + break; + + case 4: // float + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("fl"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("float")) { + log3("ERROR: !name.equals('float')"); + expresult = 1; + break; + } + break; + + case 5: // int + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("in"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("int")) { + log3("ERROR: !name.equals('int')"); + expresult = 1; + break; + } + break; + + case 6: // long + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ln"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("long")) { + log3("ERROR: !name.equals('long')"); + expresult = 1; + break; + } + break; + + case 7: // short + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("sh"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("short")) { + log3("ERROR: !name.equals('short')"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames001/TestDescription.java new file mode 100644 index 00000000000..37661340741 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/Method/returnTypeNames/returntypenames001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.returnTypeNames() + * complies with its spec: + * public java.lang.String returnTypeName() + * Returns a text representation of the declared return type of this method. + * Returns: a string containing the return type name. + * when methods' returnTypes are PrimitiveTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.returnTypeNames.returntypenames001; + * the debuggee program - nsk.jdi.Method.returnTypeNames.returntypenames001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.returnTypeNames.returntypenames001 + * nsk.jdi.Method.returnTypeNames.returntypenames001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.returnTypeNames.returntypenames001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames001a.java new file mode 100644 index 00000000000..784cef2ccd0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames001a.java @@ -0,0 +1,127 @@ +/* + * 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.Method.returnTypeNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the returntypenames001 JDI test. + */ + +public class returntypenames001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> returntypenames001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> returntypenames001a: " + message); + } + + //====================================================== test program + + static returntypenames001aTestClass obj = new returntypenames001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.returnTypeNames()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of
    + * the following class type:
    + * class returntypenames002aTestClass {
    + * public void vd () { return ; }
    + * }
    + *
    + * for the above void method vd, a debugger forms
    + * text representation of return type as void.
    + *
    + */ + +public class returntypenames002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/returnTypeNames/returntypenames002", + sHeader2 = "--> returntypenames002: ", + sHeader3 = "##> returntypenames002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new returntypenames002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.returnTypeNames.returntypenames002a"; + + String mName = "nsk.jdi.Method.returnTypeNames"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("returntypenames002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".returntypenames002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + String name = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // void + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("vd"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals("void")) { + log3("ERROR: !name.equals('void')"); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames002/TestDescription.java new file mode 100644 index 00000000000..b5d06a4d412 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames002/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/Method/returnTypeNames/returntypenames002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.returnTypeNames() + * complies with its spec: + * public java.lang.String returnTypeName() + * Returns a text representation of the declared return type of this method. + * Returns: a string containing the return type name. + * when method's returnType is VoidType. + * The test works as follows: + * The debugger program - nsk.jdi.Method.returnTypeNames.returntypenames002; + * the debuggee program - nsk.jdi.Method.returnTypeNames.returntypenames002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.returnTypeNames.returntypenames002 + * nsk.jdi.Method.returnTypeNames.returntypenames002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.returnTypeNames.returntypenames002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames002a.java new file mode 100644 index 00000000000..c1519d589a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames002a.java @@ -0,0 +1,121 @@ +/* + * 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.Method.returnTypeNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the returntypenames002 JDI test. + */ + +public class returntypenames002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> returntypenames002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> returntypenames002a: " + message); + } + + //====================================================== test program + + static returntypenames002aTestClass obj = new returntypenames002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.returnTypeNames()
    + * complies with its spec when a type is one of ReferenceTypes.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee creates an object of the following
    + * class type with methods of ReferenceType return values:
    + *
    + * class returntypenames003aTestClass {
    + * .
    + * .
    + * public returntypenames003aClassForCheck1[] arraymethod () {
    + * return cfc;
    + * }
    + * public returntypenames003aClassForCheck1 classmethod () {
    + * return classFC;
    + * }
    + * public returntypenames003aIntfForCheck ifacemethod () {
    + * return iface;
    + * }
    + * }
    + *
    + * a debugger forms text representations of their types
    + * as follows:
    + * nsk.jdi.Method.returnTypeNames.returntypenames003aClassForCheck1[]
    + * nsk.jdi.Method.returnTypeNames.returntypenames003aClassForCheck1
    + * nsk.jdi.Method.returnTypeNames.returntypenames003aIntfForCheck
    + *
    + */ + +public class returntypenames003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/returnTypeNames/returntypenames003", + sHeader2 = "--> returntypenames003: ", + sHeader3 = "##> returntypenames003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new returntypenames003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.returnTypeNames.returntypenames003a"; + + String mName = "nsk.jdi.Method.returnTypeNames"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("returntypenames003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".returntypenames003aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + String name = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // ArrayType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("arraymethod"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals(mName + ".returntypenames003aClassForCheck1[]")) { + log3("ERROR: !name.equals(mName + '.returntypenames003aClassForCheck1[]') " + name); + expresult = 1; + break; + } + break; + + case 1: // ClassType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("classmethod"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals(mName + ".returntypenames003aClassForCheck1")) { + log3("ERROR: !name.equals(mName + '.returntypenames003aClassForCheck1') " + name); + expresult = 1; + break; + } + break; + + case 2: // InterfaceType + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("ifacemethod"); + m = (Method) methods.get(0); + name = m.returnTypeName(); + + if (!name.equals(mName + ".returntypenames003aIntfForCheck")) { + log3("ERROR: !name.equals(mName + '.returntypenames003aIntfForCheck') " + name); + expresult = 1; + break; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames003/TestDescription.java new file mode 100644 index 00000000000..d6292e90679 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames003/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/Method/returnTypeNames/returntypenames003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.returnTypeNames() + * complies with its spec: + * public java.lang.String returnTypeName() + * Returns a text representation of the declared return type of this method. + * Returns: a string containing the return type name. + * when methods' returnTypes are ReferenceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.Method.returnTypeNames.returntypenames003; + * the debuggee program - nsk.jdi.Method.returnTypeNames.returntypenames003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.returnTypeNames.returntypenames003 + * nsk.jdi.Method.returnTypeNames.returntypenames003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.returnTypeNames.returntypenames003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames003a.java new file mode 100644 index 00000000000..34801b9a3d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/returnTypeNames/returntypenames003a.java @@ -0,0 +1,175 @@ +/* + * 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.Method.returnTypeNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the returntypenames003 JDI test. + */ + +public class returntypenames003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> returntypenames003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> returntypenames003a: " + message); + } + + //====================================================== test program + + static returntypenames003aTestClass obj = new returntypenames003aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.variables()
    + * complies with its spec if a debugged program is compiled with
    + * "-g" option, hence, no exception AbsentInformationException
    + * is expected.
    + *
    + * Cases for testing are as follows:
    + * - non-native method with arguments and variables
    + * - non-native method without arguments and variables
    + * - native method
    + */ + +public class variables001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/variables/variables001", + sHeader2 = "--> variables001: ", + sHeader3 = "##> variables001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new variables001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.variables.variables001a"; + + String mName = "nsk.jdi.Method.variables"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("variables001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".variables001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + List argsList = null; + + + // method with arguments and variables + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + check:{ + try { + argsList = m.variables(); + if (argsList.size() != 12) { + log3("ERROR: for method with args and vars: argsList# != 12 :" + + argsList.size() ); + testExitCode = FAILED; + break check; + } + try { + int i1names = 0; + int i2names = 0; + int i3names = 0; + + for (int i2 = 0; i2 < argsList.size(); i2++) { + LocalVariable lv = (LocalVariable) argsList.get(i2); + if (lv.name().equals("i1")) i1names++; + if (lv.name().equals("i2")) i2names++; + if (lv.name().equals("i3")) i3names++; + } + if (i1names != 1) { + log3("ERROR: for method with args and vars: mirrors of 'i1' != 1 :" + + i1names); + testExitCode = FAILED; + } + if (i2names != 2) { + log3("ERROR: for method with args and vars: mirrors of 'i2' != 2 :" + + i2names); + testExitCode = FAILED; + } + if (i3names != 1) { + log3("ERROR: for method with args and vars: mirrors of 'i3' != 1 :" + + i3names); + testExitCode = FAILED; + } + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException for lv = (LocalVariable) arglist.get(0);"); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException for method with arguments"); + testExitCode = FAILED; + } + } // check: + + + // method without arguments and variables + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("vd"); + m = (Method) methods.get(0); + + try { + argsList = m.variables(); + if (argsList.size() != 0) { + log3("ERROR: for method without args and vars: argsList# != 0 :" + + argsList.size() ); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException for method without arguments"); + testExitCode = FAILED; + } + + + // native method + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("nvd"); + m = (Method) methods.get(0); + + try { + log2("......testing native method; AbsentInformationException is expected"); + argsList = m.variables(); + log3("ERROR: no AbsentInformationException"); + testExitCode = FAILED; + } catch ( AbsentInformationException e ) { + log2(" AbsentInformationException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables001/TestDescription.java new file mode 100644 index 00000000000..8e1686881e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables001/TestDescription.java @@ -0,0 +1,103 @@ +/* + * 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/Method/variables/variables001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.variables() + * complies with its spec: + * public java.util.List variables() + * throws AbsentInformationException + * Returns a list containing each LocalVariable declared in this method. + * The list includes any variable declared in any scope within the method. + * It may contain multiple variables of the same name declared within + * disjoint scopes. + * Arguments are considered local variables and will be present in + * the returned list. + * Returns: the list of LocalVariable objects which mirror local variables + * declared in this method in the target VM. + * If there are no local variables, a zero-length list is returned. + * Throws: AbsentInformationException - + * if there is no variable information for this method. + * NativeMethodException - + * if this operation is attempted for a native method. + * when a debugged program is compiled with the '-g' option, + * hence, no AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.variables.variables 00; + * the debuggee program - nsk.jdi.Method.variables.variables 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * -------------- + * Fixing bug 4453137: + * To comply with the latest Merlin specification + * which differs the Ladybird and early Merlin specifications, + * the test is corrected as follows: + * - for native method, + * the check on throwing AbsentInformationException is performed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.variables.variables001 + * nsk.jdi.Method.variables.variables001a + * + * @comment make sure variables001a is compiled with full debug info + * @clean nsk.jdi.Method.variables.variables001a + * @compile -g:lines,source,vars ../variables001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.variables.variables001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables001a.java new file mode 100644 index 00000000000..c0fd6144bab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables001a.java @@ -0,0 +1,153 @@ +/* + * 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.Method.variables; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the variables001 JDI test. + */ + +public class variables001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> variables001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> variables001a: " + message); + } + + //====================================================== test program + + static variables001aTestClass obj = new variables001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.variables()
    + * complies with its spec if a debugged program is compiled
    + * without "-g" option,
    + * hence, the exception AbsentInformationException is expected.

    + *
    + */ + +public class variables002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/variables/variables002", + sHeader2 = "--> variables002: ", + sHeader3 = "##> variables002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new variables002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.variables.variables002a"; + + String mName = "nsk.jdi.Method.variables"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("variables002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".variables002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + List argsList = null; + + + // method with arguments + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + try { + argsList = m.variables(); + log3(" no AbsentInformationException"); + testExitCode = FAILED; + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables002/TestDescription.java new file mode 100644 index 00000000000..34ee0591209 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables002/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/Method/variables/variables002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.variables() + * complies with its spec: + * public java.util.List variables() + * throws AbsentInformationException + * Returns a list containing each LocalVariable declared in this method. + * The list includes any variable declared in any scope within the method. + * It may contain multiple variables of the same name declared within + * disjoint scopes. + * Arguments are considered local variables and will be present in + * the returned list. + * Returns: the list of LocalVariable objects which mirror local variables + * declared in this method in the target VM. + * If there are no local variables, a zero-length list is returned. + * Throws: AbsentInformationException - + * if there is no variable information for this method. + * NativeMethodException - + * if this operation is attempted for a native method. + * when a debugged program is compiled without the '-g' option, + * hence, AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.variables.variables002; + * the debuggee program - nsk.jdi.Method.variables.variables002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.variables.variables002 + * nsk.jdi.Method.variables.variables002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.variables.variables002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables002a.java new file mode 100644 index 00000000000..53973dcb1a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variables/variables002a.java @@ -0,0 +1,143 @@ +/* + * 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.Method.variables; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the variables002 JDI test. + */ + +public class variables002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> variables002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> variables002a: " + message); + } + + //====================================================== test program + + static variables002aTestClass obj = new variables002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.variablesByName()
    + * complies with its spec if a debugged program is compiled with
    + * "-g" option, hence, no exception AbsentInformationException
    + * is expected.
    + *
    + * Cases for testing are as follows:
    + * - non-native method with arguments and variables
    + * - non-native method without arguments and variables
    + * - native method + */ + +public class variablesbyname001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/variablesByName/variablesbyname001", + sHeader2 = "--> variablesbyname001: ", + sHeader3 = "##> variablesbyname001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new variablesbyname001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.variablesByName.variablesbyname001a"; + + String mName = "nsk.jdi.Method.variablesByName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("variablesbyname001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".variablesbyname001aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + List argsList = null; + + + // method with arguments and variables + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + check:{ + try { + argsList = m.variablesByName("in"); + if (argsList.size() != 1) { + log3("ERROR: for method with args and vars: argsList# != 1 for 'in' :" + + argsList.size() ); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException for method with arguments"); + testExitCode = FAILED; + } + + try { + argsList = m.variablesByName("i1"); + if (argsList.size() != 1) { + log3("ERROR: for method with args and vars: argsList# != 1 for 'i1' :" + + argsList.size() ); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException for method with arguments"); + testExitCode = FAILED; + } + + try { + argsList = m.variablesByName("i2"); + if (argsList.size() != 2) { + log3("ERROR: for method with args and vars: argsList# != 2 for 'i2' :" + + argsList.size() ); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException for method with arguments"); + testExitCode = FAILED; + } + } // check: + + + // method without arguments and variables + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("vd"); + m = (Method) methods.get(0); + + try { + argsList = m.variablesByName("in"); + if (argsList.size() != 0) { + log3("ERROR: for method without args and vars: argsList# != 0 :" + + argsList.size() ); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException for method without arguments"); + testExitCode = FAILED; + } + + + // native method + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("nvd"); + m = (Method) methods.get(0); + + try { + log2("......testing native method; AbsentInformationException is expected"); + argsList = m.variablesByName("in"); + log3("ERROR: no AbsentInformationException"); + testExitCode = FAILED; + } catch ( AbsentInformationException e ) { + log2(" AbsentInformationException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname001/TestDescription.java new file mode 100644 index 00000000000..ecc2d2185b0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname001/TestDescription.java @@ -0,0 +1,100 @@ +/* + * 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/Method/variablesByName/variablesbyname001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.variablesByName() + * complies with its spec: + * public java.util.List variablesByName(java.lang.String name) + * throws AbsentInformationException + * Returns a list containing each LocalVariable of a given name in this method. + * Multiple variables can be returned if the same variable name is used + * in disjoint scopes within the method. + * Returns: the list of LocalVariable objects of the given name. + * If there are no matching local variables, + * a zero-length list is returned. + * Throws: AbsentInformationException - + * if there is no variable information for this method. + * NativeMethodException - + * if this operation is attempted for a native method. + * when a debugged program is compiled with the '-g' option, + * hence, no AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.variablesByName.variablesbyname001; + * the debuggee program - nsk.jdi.Method.variablesByName.variablesbyname001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * -------------- + * Fixing bug 4453137: + * To comply with the latest Merlin specification + * which differs the Ladybird and early Merlin specifications, + * the test is corrected as follows: + * - for native method, + * the check on throwing AbsentInformationException is performed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Method.variablesByName.variablesbyname001 + * nsk.jdi.Method.variablesByName.variablesbyname001a + * + * @comment make sure variablesbyname001a is compiled with full debug info + * @clean nsk.jdi.Method.variablesByName.variablesbyname001a + * @compile -g:lines,source,vars ../variablesbyname001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.variablesByName.variablesbyname001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname001a.java new file mode 100644 index 00000000000..d5cbfa56416 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname001a.java @@ -0,0 +1,154 @@ +/* + * 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.Method.variablesByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the variablesbyname001 JDI test. + */ + +public class variablesbyname001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> variablesbyname001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> variablesbyname001a: " + message); + } + + //====================================================== test program + + static variablesbyname001aTestClass obj = new variablesbyname001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Method.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Method.variablesByName()
    + * complies with its spec if a debugged program is compiled
    + * without "-g" option,
    + * hence, the exception AbsentInformationException is expected.

    + *
    + */ + +public class variablesbyname002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Method/variablesByName/variablesbyname002", + sHeader2 = "--> variablesbyname002: ", + sHeader3 = "##> variablesbyname002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new variablesbyname002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Method.variablesByName.variablesbyname002a"; + + String mName = "nsk.jdi.Method.variablesByName"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("variablesbyname002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeClasses = vm.classesByName(mName + ".variablesbyname002aTestClass"); + if (listOfDebuggeeClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeClasses.size() != 1"); + break ; + } + + List methods = null; + Method m = null; + List argsList = null; + + + // method with arguments + + methods = ((ReferenceType) listOfDebuggeeClasses.get(0)). + methodsByName("primitiveargsmethod"); + m = (Method) methods.get(0); + + try { + argsList = m.variablesByName("in2"); + log3(" no AbsentInformationException"); + testExitCode = FAILED; + } catch ( AbsentInformationException e ) { + log3(" AbsentInformationException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname002/TestDescription.java new file mode 100644 index 00000000000..5d8d998499f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/Method/variablesByName/variablesbyname002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Method. + * The test checks up that a result of the method + * com.sun.jdi.Method.variablesByName() + * complies with its spec: + * public java.util.List variablesByName(java.lang.String name) + * throws AbsentInformationException + * Returns a list containing each LocalVariable of a given name in this method. + * Multiple variables can be returned if the same variable name is used + * in disjoint scopes within the method. + * Returns: the list of LocalVariable objects of the given name. + * If there are no matching local variables, + * a zero-length list is returned. + * Throws: AbsentInformationException - + * if there is no variable information for this method. + * NativeMethodException - + * if this operation is attempted for a native method. + * when a debugged program is compiled without the '-g' option, + * hence, AbsentInformationException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.Method.variablesByName.variablesbyname002; + * the debuggee program - nsk.jdi.Method.variablesByName.variablesbyname002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Method.variablesByName.variablesbyname002 + * nsk.jdi.Method.variablesByName.variablesbyname002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Method.variablesByName.variablesbyname002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname002a.java new file mode 100644 index 00000000000..7f9202a9402 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/variablesByName/variablesbyname002a.java @@ -0,0 +1,143 @@ +/* + * 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.Method.variablesByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the variablesbyname002 JDI test. + */ + +public class variablesbyname002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> variablesbyname002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> variablesbyname002a: " + message); + } + + //====================================================== test program + + static variablesbyname002aTestClass obj = new variablesbyname002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i"); + + pipe = debuggee.createIOPipe(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + try { + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // get mirrors for checked class, thread, and method + + vm = debuggee.VM(); + + log.display("Getting loaded class in debuggee"); + checkedClass = debuggee.classByName(DEBUGGEE_NAME); + + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + log.display("Getting reference to method "); + checkedMethod = debuggee.methodByName(checkedClass, "foo"); + if (checkedMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Getting reference to field "); + checkedField = checkedClass.fieldByName("flag"); + if (checkedField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + log.display("Getting reference to field "); + depthField = checkedClass.fieldByName("depth"); + if (depthField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + log.display("Getting value of field "); + try { + depthVal = ((IntegerValue)checkedClass.getValue(depthField)).value(); + log.display("depth == " + depthVal); + } catch (ClassCastException e) { + throw new Failure("TEST BUG: cannot get value of field"); + } + + // create event request (initially disabled) + + EventRequestManager eventRManager = vm.eventRequestManager(); + log.display("Creating MethodEntryRequest"); + if ((checkedRequest = eventRManager.createMethodEntryRequest()) == null) { + throw new Failure("TEST BUG: unable to create MethodEntryRequest"); + } + + checkedRequest.addThreadFilter(checkedThread); + checkedRequest.addClassFilter(checkedClass); + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + switch (checkedRequest.suspendPolicy()) { + case EventRequest.SUSPEND_ALL: + log.display(" suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display(" suspend policy is SUSPEND_EVENT_THREAD"); + break; + case EventRequest.SUSPEND_NONE: + log.display(" suspend policy is SUSPEND_NONE"); + break; + default: + log.complain("TEST BUG: Unknown suspend policy!"); + } + + log.display("MethodEntryRequest is created"); + + // create two auxilary breakpoints + + log.display("Getting reference to method "); + runMethod = debuggee.methodByName(checkedClass, "run"); + if (runMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Creating two auxilary breakpoints into method "); + startingBreakpointRequest = debuggee.setBreakpoint(runMethod, method001a.STARTING_BREAKPOINT_LINE); + endingBreakpointRequest = debuggee.setBreakpoint(runMethod, method001a.ENDING_BREAKPOINT_LINE); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + while (!eventReceived) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // enable or disable checked event request at BreakpointEvent + if (event instanceof BreakpointEvent) { + Location eventLocation = ((BreakpointEvent)event).location(); + int lineNumber = eventLocation.lineNumber(); + log.display("BreakpointEvent received for location " + lineNumber); + if (lineNumber == method001a.STARTING_BREAKPOINT_LINE) { + log.display("Enabling MethodEntryRequest at breakpoint before invoking method"); + checkedRequest.enable(); + } else if (lineNumber == method001a.ENDING_BREAKPOINT_LINE) { + log.display("Disabling MethodEntryRequest at breakpoint after invoking method"); + checkedRequest.disable(); + eventReceived = true; + } else { + testFailed = true; + throw new Failure("TEST BUG: Unknown location of breakpoint event: " + lineNumber); + } + } + + // handle checked MethodEntryEvent + if (event instanceof MethodEntryEvent) { + MethodEntryEvent castedEvent = (MethodEntryEvent) event; + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 2: eventRequest is not equal to checked request"); + testFailed = true; + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 4: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + Method method1 = castedEvent.method(); + Method method2 = castedEvent.method(); + if (!method1.equals(method2)) { + log.complain("FAILURE 7: return of MethodEntryEvent.method() is inconsistent"); + testFailed = true; + } + + if (castedEvent.method().equals(checkedMethod)) { + eventsCounter++; + log.display("MethodEntryEvent is received for method " + checkedMethod.name() + ", counter = " + eventsCounter); + try { + int flagVal = ((IntegerValue)checkedClass.getValue(checkedField)).value(); + log.display("flag == " + flagVal); + if ( flagVal > 0) { + if (!eventThread.isSuspended()) { + log.complain("FAILURE 5: eventThread is not suspended"); + } else { + log.complain("FAILURE 6: MethodEntryEvent is generated after code execution"); + } + testFailed = true; + } + } catch (ClassCastException e) { + log.complain("TEST BUG: cannot get value of field"); + testFailed = true; + } + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to invoke method + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee comfirms method invoked + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check whether all expected events received or not + if (eventsCounter == 0) { + log.complain("FAILURE 1: No any MethodEntryEvent received"); + testFailed = true; + } else if (eventsCounter < depthVal) { + log.complain("FAILURE 1: Some " + (depthVal - eventsCounter) + " MethodEntryEvent NOT received (too few)"); + testFailed = true; + } else if (eventsCounter > depthVal) { + log.complain("FAILURE 1: Extra " + (eventsCounter - depthVal) + " MethodEntryEvent received (too many)"); + testFailed = true; + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debuggee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analyze its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method001/TestDescription.java new file mode 100644 index 00000000000..7247800ee3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method001/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodEntryEvent/method/method001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.MethodEntryEvent.method() method. + * The test checks the following assertions: + * - MethodEntryEvent is received by debugger for requested + * method if this method is invoked by some executing + * thread in debugged VM; + * - received MethodEntryEvent has proper references to: + * method, + * debugged VM, + * executed thread, + * related MethodEntryRequest. + * - MethodEntryEvent is produced before any code of the + * method is executed. + * A debugger class - nsk.jdi.MethodEntryEvent.method.method001 ; + * a debuggee class - nsk.jdi.MethodEntryEvent.method.method001a . + * The test uses supporting nsk/share/jdi classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates MethodEntryRequest filtered to class. + * Also it sets two breakpoint in debuggee before and after invoking + * checked method . + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee recurcively + * invokes method. This method updates field of + * class. + * The debugger switches to to listen the event during the + * time specified by parameter. When BreakpointEvent for the first + * breakpoint is received, MethodEntryRequest becomes enabled. + * checks all received MetodEntryEvents until second breakpoint is reached + * and MethodEntryRequest becomes disabled. + * Each time the debugger receives MethodEntryEvent, it compares all refencies + * of this event ( , , , ) + * with expected values. If the event belongs to method, value + * of field is checked. + * Finally, debugger sends debuggee command QUIT and checks number of recieved + * events. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4433805 EventSet.resume() for VMStartEvent resumes thread suspended by breakpoint request + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryEvent.method.method001 + * nsk.jdi.MethodEntryEvent.method.method001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryEvent.method.method001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method001a.java new file mode 100644 index 00000000000..3a2ec46ebb7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method001a.java @@ -0,0 +1,115 @@ +/* + * 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.MethodEntryEvent.method; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +// This class is the debugged application in the test +public class method001a { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // line numbers for auxilary breakpoints + public static final int STARTING_BREAKPOINT_LINE = 86; + public static final int ENDING_BREAKPOINT_LINE = 91; + + // scaffold objects + static private ArgumentHandler argHandler; + static private Log log; + static private IOPipe pipe; + + // flags and counters + static private int flag; + static private int depth; + static private boolean methodInvoked; + + // start debuggee + public static void main(String args[]) { + method001a _method001a = new method001a(); + System.exit(JCK_STATUS_BASE + _method001a.run(args, System.err)); + } + + // perform the test + int run(String args[], PrintStream out) { + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + pipe = argHandler.createDebugeeIOPipe(); + + depth = 10; + flag = 0; + + // notify debugger that debuggee has been started + pipe.println(COMMAND_READY); + + // wait for GO commnad from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + methodInvoked = false; // STARTING_BREAKPOINT_LINE + + // invoke checked method + foo(); + + methodInvoked = true; // ENDING_BREAKPOINT_LINE + + // notify debugger that checked method has been invoked + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + // checked method + void foo() { + flag++; + if (depth > 1) { + depth--; + flag--; + foo(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002.java new file mode 100644 index 00000000000..2d67b0b95e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002.java @@ -0,0 +1,356 @@ +/* + * 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.MethodEntryEvent.method; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; +import java.lang.Thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test +public class method002 { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // timeout interval for waiting events in a loop + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // class names + static final String TEST_NAME = "nsk.jdi.MethodEntryEvent.method.method002"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + static final String CHILD_NAME = TEST_NAME + "child"; + + // JDI scaffold objects + static private Debugee debuggee; + static private IOPipe pipe; + static private VirtualMachine vm; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // mirrors for tested debuggee entities + static private MethodEntryRequest checkedRequest; + static private ThreadReference checkedThread; + static private Method checkedMethod; + static private Field checkedField; + static private ReferenceType checkedClass; + static private ReferenceType debuggeeClass; + + // auxilary breakpoints + static private BreakpointRequest startingBreakpointRequest; + static private BreakpointRequest endingBreakpointRequest; + static private Method runMethod; + + // flags and counters + static private long eventTimeout; + static private boolean testFailed; + static private boolean eventReceived; + static private int eventsCount; + + // start test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // start test from JCK-compatible environment + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + eventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + try { + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // get mirrors for checked class, thread, and method + + vm = debuggee.VM(); + + log.display("Getting loaded classes in debuggee"); + debuggeeClass = debuggee.classByName(DEBUGGEE_NAME); + checkedClass = debuggee.classByName(CHILD_NAME); + + log.display("Getting
    thread in debuggee"); + checkedThread = debuggee.threadByName("main"); + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + log.display("Getting reference to method "); + checkedMethod = debuggee.methodByName(checkedClass, "foo"); + if (checkedMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + if (checkedMethod.isAbstract()) { + throw new Failure("TEST BUG: found method is abstract"); + } + + log.display("Getting reference to field "); + checkedField = checkedClass.fieldByName("counter"); + if (checkedField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + // create event request (initially disabled) + + log.display("Creating MethodEntryRequest"); + if ((checkedRequest = vm.eventRequestManager().createMethodEntryRequest()) == null) { + throw new Failure("TEST BUG: unable to create MethodEntryRequest"); + } + + checkedRequest.addThreadFilter(checkedThread); + checkedRequest.addClassFilter(checkedClass); + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + switch (checkedRequest.suspendPolicy()) { + case EventRequest.SUSPEND_ALL: + log.display(" suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display(" suspend policy is SUSPEND_EVENT_THREAD"); + break; + case EventRequest.SUSPEND_NONE: + log.display(" suspend policy is SUSPEND_NONE"); + break; + default: + log.complain("TEST BUG: Unknown suspend policy!"); + } + + log.display("MethodEntryRequest is created"); + + // create two auxilary breakpoints + + log.display("Getting reference to method "); + runMethod = debuggee.methodByName(debuggeeClass, "run"); + if (runMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Creating two auxilary breakpoints into method "); + startingBreakpointRequest = debuggee.setBreakpoint(runMethod, method002a.STARTING_BREAKPOINT_LINE); + endingBreakpointRequest = debuggee.setBreakpoint(runMethod, method002a.ENDING_BREAKPOINT_LINE); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + while (!eventReceived) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // enable or disable checked event request at BreakpointEvent + if (event instanceof BreakpointEvent) { + Location eventLocation = ((BreakpointEvent)event).location(); + int lineNumber = eventLocation.lineNumber(); + log.display("BreakpointEvent received for location " + lineNumber); + if (lineNumber == method002a.STARTING_BREAKPOINT_LINE) { + log.display("Enabling MethodEntryRequest at breakpoint before invoking method"); + checkedRequest.enable(); + } else if (lineNumber == method002a.ENDING_BREAKPOINT_LINE) { + log.display("Disabling MethodEntryRequest at breakpoint after invoking method"); + checkedRequest.disable(); + eventReceived = true; + } else { + testFailed = true; + throw new Failure("TEST BUG: Unknown location of breakpoint event: " + lineNumber); + } + } + + // handle checked MethodEntryEvent + if (event instanceof MethodEntryEvent) { + MethodEntryEvent castedEvent = (MethodEntryEvent) event; + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 2: eventRequest is not equal to checked request"); + testFailed = true; + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 4: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + if (castedEvent.method().equals(checkedMethod)) { + eventsCount++; + log.display("MethodEntryEvent is received for method " + checkedMethod.name()); + try { + int counterVal = ((IntegerValue)checkedClass.getValue(checkedField)).value(); + log.display("Counter == " + counterVal); + if ( counterVal > 0) { + if (!eventThread.isSuspended()) { + log.complain("FAILURE 5: eventThread is not suspended"); + } else { + log.complain("FAILURE 6: MethodEntryEvent is generated after code execution"); + } + testFailed = true; + } + } catch (ClassCastException e) { + log.complain("TEST BUG: cannot get value of field"); + testFailed = true; + } + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to invoke method + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee comfirms method invoked + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check whether all expected events received or not + if (eventsCount < 1) { + log.complain("FAILURE 1: No any MethodEntryEvent received: " + eventsCount); + testFailed = true; + } else if (eventsCount > 1) { + log.complain("FAILURE 1: Too many MethodEntryEvent received: " + eventsCount); + testFailed = true; + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debuggee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analyze its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002/TestDescription.java new file mode 100644 index 00000000000..6fcead6f690 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodEntryEvent/method/method002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.MethodEntryEvent.method() method. + * The test checks the following assertions: + * - MethodEntryEvent is received by debugger for requested + * method if this method is invoked by some executing thread + * in debugged VM; + * - received MethodEntryEvent has proper references to: + * method, + * debugged VM, + * executed thread, + * related MethodEntryRequest. + * - MethodEntryEvent is produced before any code of the + * method is executed. + * A debugger class - nsk.jdi.MethodEntryEvent.method.method002 ; + * a debuggee class - nsk.jdi.MethodEntryEvent.method.method002a . + * The test uses supporting nsk/share/jdi classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates MethodEntryRequest filtered to class. + * Also it sets two breakpoint in debuggee before and after invoking + * checked method . + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee creates variable + * of class. This class implements abstract method + * of class. The method is invoked. The + * implementing method updates field of class. + * The debugger switches to to listen the event during the + * time specified by parameter. When BreakpointEvent for the first + * breakpoint is received, MethodEntryRequest becomes enabled. + * checks all received MetodEntryEvents until second breakpoint is reached + * and MethodEntryRequest becomes disabled. + * Each time the debugger receives MethodEntryEvent, it compares all refencies + * of this event ( , , , ) + * with expected values. If the event belongs to method, value + * of field is checked. + * Finally, debugger sends debuggee command QUIT and checks number of recieved + * events. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4433805 EventSet.resume() for VMStartEvent resumes thread suspended by breakpoint request + * Standard method Debugee.endDebugee() is used instead of cleaning event queue on debuggee VM exit. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryEvent.method.method002 + * nsk.jdi.MethodEntryEvent.method.method002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryEvent.method.method002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002a.java new file mode 100644 index 00000000000..16a16e0304d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002a.java @@ -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.MethodEntryEvent.method; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +// This class is the debugged application in the test +public class method002a { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // line numbers for auxilary breakpoints + public static final int STARTING_BREAKPOINT_LINE = 83; + public static final int ENDING_BREAKPOINT_LINE = 88; + + // scaffold objects + static private ArgumentHandler argHandler; + static private Log log; + static private IOPipe pipe; + + // flags and counters + static private boolean methodInvoked; + + // start debuggee + public static void main(String args[]) { + method002a _method002a = new method002a(); + System.exit(JCK_STATUS_BASE + _method002a.run(args, System.err)); + } + + // perform the test + static int run(String args[], PrintStream out) { + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + pipe = argHandler.createDebugeeIOPipe(); + + method002parent a = new method002child(); + + // notify debugger that debuggee has been started + pipe.println(COMMAND_READY); + + // wait for GO commnad from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + methodInvoked = false; // STARTING_BREAKPOINT_LINE + + // invoke checked method + a.foo(); + + methodInvoked = true; // ENDING_BREAKPOINT_LINE + + // notify debugger that checked method has been invoked + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } +} + +abstract class method002parent { + abstract void foo(); +} + +class method002child extends method002parent { + static private int counter = 0; + + void foo() { + counter++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001.java new file mode 100644 index 00000000000..6cdca54c742 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001.java @@ -0,0 +1,226 @@ +/* + * 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.MethodEntryRequest._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; + +/** + * The test checks up the
    + * - addThreadFilter(ThreadReference)
    + * - addInstanceFilter(ObjectReference)
    + * - addClassFilter(ReferenceType)
    + * - addClassFilter(String)
    + * - addClassExclusionFilter(String)
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +public class filters001 { + + private final static String prefix = "nsk.jdi.MethodEntryRequest._bounds_."; + private final static String debuggerName = prefix + "filters001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + display(""); + display(">>>creating MethodEntryRequest"); + + MethodEntryRequest request = + debugee.getEventRequestManager().createMethodEntryRequest(); + + display(""); + addThreadFilter(request, null); + + display(""); + addInstanceFilter(request, null); + + display(""); + addClassFilter(request, (ReferenceType )null); + + display(""); + addClassFilter(request, (String )null); + + display(""); + addClassExclusionFilter(request, (String )null); + + display(""); + debugee.quit(); + } + + private void addThreadFilter(MethodEntryRequest request, ThreadReference thread) { + String tmp = "addThreadFilter :thread name> "; + tmp += (thread == null) ? "" : thread.name(); + display(tmp); + + try { + request.addThreadFilter(thread); + if (thread==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (thread == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addInstanceFilter(MethodEntryRequest request, + ObjectReference instance) { + String tmp = "addInstanceFilter :object value> "; + tmp += (instance == null) ? "" : instance.toString(); + display(tmp); + + try { + request.addInstanceFilter(instance); + if (instance==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (instance == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(MethodEntryRequest request, ReferenceType refType) { + + display("addClassFilter :ReferenceType> <" + refType + ">"); + + try { + request.addClassFilter(refType); + if (refType==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (refType==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(MethodEntryRequest request, String classPattern) { + + display("addClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(MethodEntryRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassExclusionFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..fbcfb57c21b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/MethodEntryRequest/_bounds_/filters001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.MethodEntryRequest.addThreadFilter(ThreadReference) + * com.sun.jdi.request.MethodEntryRequest.addInstanceFilter(ObjectReference) + * com.sun.jdi.request.MethodEntryRequest.addClassFilter(ReferenceType) + * com.sun.jdi.request.MethodEntryRequest.addClassFilter(String) + * com.sun.jdi.request.MethodEntryRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up this methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest._bounds_.filters001 + * nsk.jdi.MethodEntryRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..507a34ff72e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001a.java @@ -0,0 +1,54 @@ +/* + * 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.MethodEntryRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001.java new file mode 100644 index 00000000000..8e87e5049fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001.java @@ -0,0 +1,160 @@ +/* + * 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.MethodEntryRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addClassExclusionFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The case to checks a pattern that ends with '*'. + * + * The test works as follows. + * - The debugger + * - sets up two MethodEntryRequests, + * - restricts the Requests using patterns 'java*' and 'sun*', + * so that events will be filtered only from test classes, + * - resumes the debuggee, and + * - waits for expected MethodEntryEvents. + * - The debuggee creates and starts thread1, which being run, + * invoke methods used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter001a"; + return new filter001().runThis(argv, out); + } + + private String classExclName1 = "java"; + private String classExclName2 = "sun"; + private boolean methodEntryReceived = false; + + protected void testRun() { + + MethodEntryRequest eventRequest1 = null; + String thread1Name = "thread1"; + String property1 = "MethodEntryRequest1"; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + ThreadReference thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting23MethodEntryRequest( thread1, + EventRequest.SUSPEND_NONE, + property1); + + eventRequest1.addClassExclusionFilter(classExclName1 + "*"); + eventRequest1.addClassExclusionFilter(classExclName2 + "*"); + eventRequest1.enable(); + + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof MethodEntryEvent) { + methodEntryReceived = true; + String str = ((MethodEntryEvent)event).location().declaringType().name(); + if (str.indexOf(classExclName1) == 0 || str.indexOf(classExclName2) == 0) { + setFailedStatus("Received unexpected MethodEntryEvent for excluded class:" + str); + } else { + display("Received expected MethodEntryEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting for MethodEntryEvent in expected thread"); + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + if (!methodEntryReceived) { + setFailedStatus("No MethodEntryEvent was received."); + } + return; + } + + private MethodEntryRequest setting23MethodEntryRequest ( ThreadReference thread, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..17d13398f21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001/TestDescription.java @@ -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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodEntry - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter001; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter001 + * nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001a.java new file mode 100644 index 00000000000..1fea7a9a757 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter001a.java @@ -0,0 +1,178 @@ +/* + * 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.MethodEntryRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter001 JDI test. + */ + +public class filter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter001a thread1 = new Thread1filter001a("thread1"); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + log1("new filter001a().run1(thread1);"); + new filter001a().run1(thread1); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class Thread1filter001a extends Thread { + + class TestClass10{ + void m10() { + throw new NullPointerException("m10"); + } + } + class TestClass11 extends TestClass10{ + void m11() { + + try { + (new TestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + + String tName = null; + + public Thread1filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new TestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002.java new file mode 100644 index 00000000000..a75f4873d5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002.java @@ -0,0 +1,538 @@ +/* + * 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.MethodEntryRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodEntryRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter002a"; + + private String testedClassName1 = + "nsk.jdi.MethodEntryRequest.addClassExclusionFilter.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "MethodEntryRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = setting23MethodEntryRequest(null, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting23MethodEntryRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassExclusionFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + menr.addCountFilter(1); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..cc5d535c435 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodEntry - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateMethodEntry - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter002; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addClassExclusionFilter.filter002 + * nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassExclusionFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002a.java new file mode 100644 index 00000000000..74a2b8577bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassExclusionFilter/filter002a.java @@ -0,0 +1,145 @@ +/* + * 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.MethodEntryRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter002 JDI test. + */ + +public class filter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + +// static Thread1filter002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// thread1 = new Thread1filter002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001.java new file mode 100644 index 00000000000..e25b0b202e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001.java @@ -0,0 +1,160 @@ +/* + * 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.MethodEntryRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or + * any of its subtypes. + * The cases to check include entering methods in four types, + * two in super-class filter_rt001aTestClass10 and its sub-class filter_rt001aTestClass11, and + * two in super-class filter_rt001aTestClass20 and its sub-class filter_rt001aTestClass21. + * A filter used restricts events only to methods in first pair. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a thread, thread1, invoking methods + * in the super-class filter_rt001aTestClass10 and its sub-class filter_rt001aTestClass11 and + * in the super-class filter_rt001aTestClass20 and its sub-class filter_rt001aTestClass21 + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes to use to filter MethodEntryEvents, + * - sets up MethodEntryRequest for the events, + * - restricts the events to those in filter_rt001aTestClass11, + * - and resumes the debuggee and waits for the events. + * - The debuggee starts the thread1. + * - Upon getting the events, the debugger performs checks required. + * + * In third phase, at the end of the test, the debuggee changes + * the value of the "instruction" which the debugger and debuggee + * use to inform each other of needed actions, and both end. + */ + +public class filter_rt001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001a"; + return new filter_rt001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001aTestClass11"; + + protected void testRun() { + EventRequest eventRequest1 = null; + String property1 = "MethodEntryRequest1"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = (ReferenceType) debuggee.classByName(testedClassName); + + eventRequest1 = setting21MethodEntryRequest(null, testClassReference, + EventRequest.SUSPEND_NONE, property1); + + display("......waiting for MethodEntryEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, false); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodEntryEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((MethodEntryEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference.name()); + } + } + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodEntryRequest setting21MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001/TestDescription.java new file mode 100644 index 00000000000..f384c53118b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodEntryRequest/addClassFilter_rt/filter_rt001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001 + * nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001a.java new file mode 100644 index 00000000000..5d50bd9363c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt001a.java @@ -0,0 +1,191 @@ +/* + * 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.MethodEntryRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt001 JDI test. + */ + +public class filter_rt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt001aThread1 thread1 = null; + + static filter_rt001aTestClass10 obj10 = new filter_rt001aTestClass10(); + static filter_rt001aTestClass11 obj11 = new filter_rt001aTestClass11(); + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1 = new filter_rt001aThread1("thread1"); + + log1("new filter_rt001a().run1(thread1);"); + new filter_rt001a().run1(thread1); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt001aTestClass10{ + static void m10() { + filter_rt001a.log1("entered: m10()"); + } +} +class filter_rt001aTestClass11 extends filter_rt001aTestClass10{ + static void m11() { + filter_rt001a.log1("entered: m11()"); + filter_rt001aTestClass10.m10(); + } +} + +class filter_rt001aThread1 extends Thread { + + String tName = null; + + public filter_rt001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + filter_rt001aTestClass21.m21(); + filter_rt001aTestClass11.m11(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt001aTestClass20{ + static void m20() { + filter_rt001a.log1("entered: m20()"); + } +} + +class filter_rt001aTestClass21 extends filter_rt001aTestClass20{ + static void m21() { + filter_rt001a.log1("entered: m21()"); + filter_rt001aTestClass20.m20(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002.java new file mode 100644 index 00000000000..9cbb56bc192 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002.java @@ -0,0 +1,530 @@ +/* + * 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.MethodEntryRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addClassFilter(ReferenceType)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a filter_rt002aTestClass10 object, to use as filter,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodEntryRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt002a"; + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "MethodEntryRequest1"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = setting21MethodEntryRequest(null, testClassReference, + EventRequest.SUSPEND_NONE, property1); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" no InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting21MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002/TestDescription.java new file mode 100644 index 00000000000..65759c1d8cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodEntryRequest/addClassFilter_rt/filter_rt002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt002; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addClassFilter_rt.filter_rt002 + * nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002a.java new file mode 100644 index 00000000000..9dc407e5415 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt002a.java @@ -0,0 +1,184 @@ +/* + * 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.MethodEntryRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt002 JDI test. + */ + +public class filter_rt002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt002aThread1 thread1 = null; + + static filter_rt002aTestClass10 obj = new filter_rt002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_rt002aThread1("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt002aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_rt002aTestClass11 extends filter_rt002aTestClass10{ + void m11() { + + try { + (new filter_rt002aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_rt002aThread1 extends Thread { + + String tName = null; + + public filter_rt002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt002aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003.java new file mode 100644 index 00000000000..0b7eee0174f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003.java @@ -0,0 +1,182 @@ +/* + * 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.MethodEntryRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to be + * the preparation of the given reference type and any subtypes. + * The cases to test include re-invocations of the method + * addClassFilter() on the same MethodEntryRequest object. + * There are two MethodEntryRequests to check as follows: + * (1) For MethodEntryRequest2, both invocations are with different + * ReferenceTypes restricting one MethodEntry event to two classes. + * The test expects no MethodEntry event will be received. + * (2) For MethodEntryRequest1, both invocations are with the same + * ReferenceType restricting one MethodEntry event to one class. + * The test expects this MethodEntry event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, + * invoking methods correspondingly + * in the super-class filter_rt003aTestClass10 and its sub-class filter_rt003aTestClass11 and + * in the super-class filter_rt003aTestClass20 and its sub-class filter_rt003aTestClass21, + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two MethodEntryRequests 1&2, + * - double restricts MethodEntryRequest1 to the RefTypes 1 and 1, + * - double restricts MethodEntryRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee creates and starts two threads, thread1 and thread2, + * generating the events to be filtered. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt003 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003a"; + return new filter_rt003().runThis(argv, out); + } + + private String testedClassName11 = + "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003aTestClass11"; + + private String testedClassName21 = + "nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003aTestClass21"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "MethodEntryRequest1"; + String property2 = "MethodEntryRequest2"; + + ReferenceType testClassReference11 = null; + ReferenceType testClassReference21 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference11 = (ReferenceType) debuggee.classByName(testedClassName11); + testClassReference21 = (ReferenceType) debuggee.classByName(testedClassName21); + + eventRequest1 = setting21MethodEntryRequest(null, testClassReference11, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21MethodEntryRequest(null, testClassReference11, + EventRequest.SUSPEND_ALL, property2); + + ((MethodEntryRequest) eventRequest1).addClassFilter(testClassReference11); + ((MethodEntryRequest) eventRequest2).addClassFilter(testClassReference21); + + display("......waiting for MethodEntryEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, false); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodEntryEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((MethodEntryEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference11)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference11.name()); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodEntryRequest setting21MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003/TestDescription.java new file mode 100644 index 00000000000..dfb4f300e3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodEntryRequest/addClassFilter_rt/filter_rt003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003 + * nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassFilter_rt.filter_rt003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003a.java new file mode 100644 index 00000000000..82b3eabfcec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_rt/filter_rt003a.java @@ -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.MethodEntryRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt003 JDI test. + */ + +public class filter_rt003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt003aThread1 thread1 = null; + static filter_rt003aThread2 thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + filter_rt003aTestClass11 obj1 = new filter_rt003aTestClass11(); + filter_rt003aTestClass21 obj2 = new filter_rt003aTestClass21(); + + thread1 = new filter_rt003aThread1("thread1"); + thread2 = new filter_rt003aThread2("thread2"); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + log1("new filter_rt003a().run1(thread1);"); + new filter_rt003a().run1(thread1); + + log1("new filter_rt003a().run1(thread2);"); + new filter_rt003a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt003aTestClass10{ + static void m10() { + filter_rt003a.log1("entered: m10()"); + } +} +class filter_rt003aTestClass11 extends filter_rt003aTestClass10{ + static void m11() { + filter_rt003a.log1("entered: m11()"); + filter_rt003aTestClass10.m10(); + } +} + +class filter_rt003aThread1 extends Thread { + + String tName = null; + + public filter_rt003aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + filter_rt003aTestClass11.m11(); + filter_rt003aTestClass21.m21(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt003aTestClass20{ + static void m20() { + filter_rt003a.log1("entered: m20()"); + } +} +class filter_rt003aTestClass21 extends filter_rt003aTestClass20{ + static void m21() { + filter_rt003a.log1("entered: m21()"); + filter_rt003aTestClass20.m20(); + } +} + +class filter_rt003aThread2 extends Thread { + + String tName = null; + + public filter_rt003aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + filter_rt003aTestClass21.m21(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001.java new file mode 100644 index 00000000000..79032f1e334 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001.java @@ -0,0 +1,183 @@ +/* + * 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.MethodEntryRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - sets up two MethodEntryRequests, + * - restricts the Requests using patterns that begins with '*' and + * ends with *, + * - resumes the debuggee, and + * - waits for expected MethodEntryEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, invoke methods used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_s001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s001a"; + return new filter_s001().runThis(argv, out); + } + + private String testedClassName1 = "TestClass11"; + private String testedClassName2 = + "nsk.jdi.MethodEntryRequest.addClassFilter_s.Thread2filter_s001a"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "MethodEntryRequest1"; + String property2 = "MethodEntryRequest2"; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + + eventRequest1 = setting22MethodEntryRequest(null, "*" + testedClassName1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for MethodEntryEvent in expected class"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + String str = ((MethodEntryEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(testedClassName1)) { + setFailedStatus("Received MethodEntryEvent for unexpected class: \n\t" + str); + } else { + display("Received MethodEntryEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + + vm.resume(); + break; + + case 1: + eventRequest2 = setting22MethodEntryRequest(null, testedClassName2 + "*", + EventRequest.SUSPEND_ALL, property2); + + display("......waiting for MethodEntryEvent in expected class"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + + String str = ((MethodEntryEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(testedClassName2)) { + setFailedStatus("Received MethodEntryEvent for unexpected class: \n\t" + str); + } else { + display("Received MethodEntryEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodEntryRequest setting22MethodEntryRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001/TestDescription.java new file mode 100644 index 00000000000..6b87bfb6a19 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodEntryRequest/addClassFilter_s/filter_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodEntry - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s001; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s001 + * nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001a.java new file mode 100644 index 00000000000..6af8df133e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s001a.java @@ -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.MethodEntryRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s001 JDI test. + */ + +public class filter_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s001a thread1 = null; + static Thread2filter_s001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s001a("thread1"); + log1("new filter_s001a().run1(thread1);"); + new filter_s001a().run1(thread1); + + break; + + case 1: + thread2 = new Thread2filter_s001a("thread2"); + log1("new filter_s001a().run1(thread2);"); + new filter_s001a().run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class TestClass10{ + static void m10() { + filter_s001a.log1(" entered: m10()"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + filter_s001a.log1(" entered: m11()"); + TestClass10.m10(); + } +} + +class Thread1filter_s001a extends Thread { + + String tName = null; + + public Thread1filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + TestClass11.m11(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter_s001a extends Thread { + + String tName = null; + + public Thread2filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + TestClass21.m21(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } + + static class TestClass20{ + static void m20() { + filter_s001a.log1(" entered: m20()"); + } + } + static class TestClass21 extends TestClass20{ + static void m21() { + filter_s001a.log1(" entered: m21()"); + TestClass20.m20(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002.java new file mode 100644 index 00000000000..1d2225b0f3d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002.java @@ -0,0 +1,525 @@ +/* + * 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.MethodEntryRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addClassFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodEntryRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s002a"; + + private String testedClassName1 = + "nsk.jdi.MethodEntryRequest.addClassFilter_s.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "MethodEntryRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = setting22MethodEntryRequest(null, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting22MethodEntryRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002/TestDescription.java new file mode 100644 index 00000000000..d9be1a6e2f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002/TestDescription.java @@ -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/MethodEntryRequest/addClassFilter_s/filter_s002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addClassFilter() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodEntry - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateMethodEntry - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addClassFilter.filter_s002; + * the debuggee program - nsk.jdi.MethodEntryRequest.addClassFilter.filter_s002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addClassFilter_s.filter_s002 + * nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addClassFilter_s.filter_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002a.java new file mode 100644 index 00000000000..e857d52c2cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addClassFilter_s/filter_s002a.java @@ -0,0 +1,145 @@ +/* + * 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.MethodEntryRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s002 JDI test. + */ + +public class filter_s002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + +// static Thread1filter_s002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// thread1 = new Thread1filter_s002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001.java new file mode 100644 index 00000000000..20dd47dc62f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001.java @@ -0,0 +1,190 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a MethodEntryRequest + * within the method in the class instancefilter001aTestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordinly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the MethodEntry event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001a"; + return new instancefilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001aTestClass"; + + protected void testRun() { + + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodEntryRequest1"; + String property2 = "MethodEntryRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) debuggee.classByName(testedClassName); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + eventRequest1 = setting2MethodEntryRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance); + + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + eventRequest2 = setting2MethodEntryRequest (thread2, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + ((MethodEntryRequest) eventRequest2).addInstanceFilter(instance); + + display("......waiting for MethodEntryEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodEntryEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001/TestDescription.java new file mode 100644 index 00000000000..62f41a796cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/MethodEntryRequest/addInstanceFilter/instancefilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001 + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001a.java new file mode 100644 index 00000000000..623f88ac8bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter001a.java @@ -0,0 +1,195 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter001 JDI test. + */ + +public class instancefilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter001aThread thread1 = null; + static instancefilter001aThread thread2 = null; + + static instancefilter001aTestClass objTC[] = { new instancefilter001aTestClass(), new instancefilter001aTestClass(), new instancefilter001aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new instancefilter001aThread("thread1"); + thread2 = new instancefilter001aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter001aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter001aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002.java new file mode 100644 index 00000000000..4a6f4893a1b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002.java @@ -0,0 +1,556 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a MethodEntryRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter002a"; + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodEntryRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodEntryRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002/TestDescription.java new file mode 100644 index 00000000000..87e81c3cedd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/MethodEntryRequest/addInstanceFilter/instancefilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter002; + * the debuggee program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addInstanceFilter.instancefilter002 + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002a.java new file mode 100644 index 00000000000..f2a1c21f988 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter002a.java @@ -0,0 +1,183 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter002 JDI test. + */ + +public class instancefilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter002aThread thread1 = null; + + static instancefilter002aTestClass objTC[] = { new instancefilter002aTestClass(), new instancefilter002aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new instancefilter002aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter002aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter002aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter002aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003.java new file mode 100644 index 00000000000..0a6936b397b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003.java @@ -0,0 +1,523 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException -
    + * if the target virtual machine
    + * does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * a MethodEntryRequest and if addInstanceFilter() is not supported,
    + * invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter003a"; + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodEntryRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodEntryRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003/TestDescription.java new file mode 100644 index 00000000000..116e4fac9a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/MethodEntryRequest/addInstanceFilter/instancefilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter003; + * the debuggee program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addInstanceFilter.instancefilter003 + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003a.java new file mode 100644 index 00000000000..8076232ebaf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter003a.java @@ -0,0 +1,183 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter003 JDI test. + */ + +public class instancefilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter003aThread thread1 = null; + + static instancefilter003aTestClass objTC[] = { new instancefilter003aTestClass(), new instancefilter003aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new instancefilter003aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter003aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter003aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter003aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004.java new file mode 100644 index 00000000000..247e96ea1b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004.java @@ -0,0 +1,202 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same MethodEntryRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For MethodEntryRequest2, both invocations are with different + * ObjectReferences restricting one MethodEntry event to two objects. + * The test expects no MethodEntry event will be received. + * (2) For MethodEntryRequest1, both invocations are with the same + * ObjectReference restricting one MethodEntry event to one object. + * The test expects this MethodEntry event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up MethodEntryRequests 1&2 within the method + * in the class TestClass which will be calling by both threads, + * - restricts the MethodEntryRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the MethodEntryRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004a"; + return new instancefilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004aTestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodEntryRequest1"; + String property2 = "MethodEntryRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2MethodEntryRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2MethodEntryRequest (thread2, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance1); + ((MethodEntryRequest) eventRequest1).addInstanceFilter(instance1); + ((MethodEntryRequest) eventRequest2).addInstanceFilter(instance1); + ((MethodEntryRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for MethodEntryEvent in expected thread"); + MethodEntryEvent newEvent = (MethodEntryEvent)eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + EventRequest newEventRequest = newEvent.request(); + if ( newEventRequest.equals(eventRequest1) ) { + display(" received expected event: " + newEvent); + + ThreadReference newEventThread = newEvent.thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004/TestDescription.java new file mode 100644 index 00000000000..c177ac20b85 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/MethodEntryRequest/addInstanceFilter/instancefilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same MethodEntryRequest object. + * There are two MethodEntryRequests to check as follows: + * (1) For MethodEntryRequest2, both invocations are with different + * ObjectReferences restricting one MethodEntry event to two objects. + * The test expects no MethodEntry event will be received. + * (2) For MethodEntryRequest1, both invocations are with the same + * ObjectReference restricting one MethodEntry event to one object. + * The test expects this MethodEntry event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004; + * the debuggee program - nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004 + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addInstanceFilter.instancefilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004a.java new file mode 100644 index 00000000000..bd03f15a0ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addInstanceFilter/instancefilter004a.java @@ -0,0 +1,194 @@ +/* + * 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.MethodEntryRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter004 JDI test. + */ + +public class instancefilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter004aThread thread1 = null; + static instancefilter004aThread thread2 = null; + + static instancefilter004aTestClass objTC[] = { new instancefilter004aTestClass(), new instancefilter004aTestClass(), new instancefilter004aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new instancefilter004aThread("thread1"); + thread2 = new instancefilter004aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter004aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter004aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter004aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001.java new file mode 100644 index 00000000000..1b98c9ff6bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001.java @@ -0,0 +1,154 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a MethodEntryRequest within the method + * in the class threadfilter001aTestClass which will be calling by both threads, + * - restricts the method entry event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001a"; + return new threadfilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001aTestClass"; + + protected void testRun() { + EventRequest eventRequest1 = null; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String property1 = "MethodEntryRequest1"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodEntryRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for MethodEntryEvent in tested thread"); + + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodEntryEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + + } + return; + } + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001/TestDescription.java new file mode 100644 index 00000000000..c8adc9bf511 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001/TestDescription.java @@ -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/MethodEntryRequest/addThreadFilter/threadfilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001; + * the debuggee program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001 + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001a.java new file mode 100644 index 00000000000..e84543404d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter001a.java @@ -0,0 +1,193 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter001 JDI test. + */ + +public class threadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter001aThread thread1 = null; + static threadfilter001aThread thread2 = null; + + static threadfilter001aTestClass objTC = new threadfilter001aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new threadfilter001aThread("thread1"); + thread2 = new threadfilter001aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter001aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter001aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002.java new file mode 100644 index 00000000000..eafa4730ddf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002.java @@ -0,0 +1,538 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a MethodEntryRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter002a"; + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "MethodEntryRequest1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodEntryRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((MethodEntryRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002/TestDescription.java new file mode 100644 index 00000000000..37f2a05e3ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002/TestDescription.java @@ -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/MethodEntryRequest/addThreadFilter/threadfilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter002; + * the debuggee program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addThreadFilter.threadfilter002 + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002a.java new file mode 100644 index 00000000000..31e19b85360 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter002a.java @@ -0,0 +1,184 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter002 JDI test. + */ + +public class threadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter002aThread thread1 = null; + + static threadfilter002aTestClass objTC = new threadfilter002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter002aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter002aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter002aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter002aTestClass { + + static int breakpointLine = 3; + + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003.java new file mode 100644 index 00000000000..afb5cd8d24a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003.java @@ -0,0 +1,541 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodEntryRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodEntryRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates MethodEntryRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates MethodEntryRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates MethodEntryRequest3, waits the thread1 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter003a"; + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "MethodEntryRequest1"; + String property2 = "MethodEntryRequest2"; + String property3 = "MethodEntryRequest3"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodEntryRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((MethodEntryRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2MethodEntryRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property2); + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((MethodEntryRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2MethodEntryRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property3); + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((MethodEntryRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodEntryRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + menr = eventRManager.createMethodEntryRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodEntryRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodEntryRequest() : " + e); + log3(" MethodEntryRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003/TestDescription.java new file mode 100644 index 00000000000..18b275cdfed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/MethodEntryRequest/addThreadFilter/threadfilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter003; + * the debuggee program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodEntryRequest.addThreadFilter.threadfilter003 + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003a.java new file mode 100644 index 00000000000..574638e1544 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter003a.java @@ -0,0 +1,187 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter003 JDI test. + */ + +public class threadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter003aThread thread1 = null; + + static threadfilter003aTestClass objTC = new threadfilter003aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter003aThread("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class threadfilter003aThread extends Thread { + + public threadfilter003aThread(String threadName) { + super(threadName); + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class threadfilter003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004.java new file mode 100644 index 00000000000..78483dd5219 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004.java @@ -0,0 +1,187 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodEntryRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodEntryRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same MethodEntryRequest object. + * There are two MethodEntryRequests to check as follows: + * (1) For MethodEntryRequest2, both invocations are with different + * ThreadReferences restricting one MethodEntry event to two threads. + * The test expects no MethodEntry event will be received. + * (2) For MethodEntryRequest1, both invocations are with the same + * ThreadReference restricting one MethodEntry event to one thread. + * The test expects this MethodEntry event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up MethodEntryRequests 1&2 within the method + * in the class threadfilter004aTestClass which will be calling by both threads, + * - restricts the MethodEntryRequest1 only to thread1, + * - restricts the MethodEntryRequest2 to both thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004a"; + return new threadfilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodEntryRequest1"; + String property2 = "MethodEntryRequest2"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) debuggee.classByName(testedClassName); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2MethodEntryRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2MethodEntryRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + + ((MethodEntryRequest) eventRequest1).addThreadFilter(thread1); + ((MethodEntryRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for MethodEntryEvent in tested thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof MethodEntryEvent)) { + setFailedStatus("ERROR: new event is not MethodEntryEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodEntryEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + EventRequest newEventRequest = newEvent.request(); + if (!newEventRequest.equals(eventRequest1) ) { + setFailedStatus("The MethodEntryEvent occured not for eventRequest1"); + } + + ThreadReference thr = ((MethodEntryEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The MethodEntryEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodEntryRequest setting2MethodEntryRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodEntryRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodEntryRequest + mexr = eventRManager.createMethodEntryRequest(); + mexr.putProperty("number", property); + if (thread != null) + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + mexr.setSuspendPolicy(suspendPolicy); + + display(" MethodEntryRequest has been set up"); + return mexr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodEntryRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004/TestDescription.java new file mode 100644 index 00000000000..7ffe3d410d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/MethodEntryRequest/addThreadFilter/threadfilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodEntryRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodEntryRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same MethodEntryRequest object. + * There are two MethodEntryRequests to check as follows: + * (1) For MethodEntryRequest2, both invocations are with different + * ThreadReferences restricting one MethodEntry event to two threads. + * The test expects no MethodEntry event will be received. + * (2) For MethodEntryRequest1, both invocations are with the same + * ThreadReference restricting one MethodEntry event to one thread. + * The test expects this MethodEntry event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004; + * the debuggee program - nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004 + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodEntryRequest.addThreadFilter.threadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004a.java new file mode 100644 index 00000000000..46800b5d554 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryRequest/addThreadFilter/threadfilter004a.java @@ -0,0 +1,200 @@ +/* + * 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.MethodEntryRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter004 JDI test. + */ + +public class threadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter004aThread thread1 = null; + static threadfilter004aThread thread2 = null; + + static threadfilter004aTestClass objTC = new threadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new threadfilter004aThread("thread1"); + thread2 = new threadfilter004aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter004aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter004aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + public static void nullMethod() { + throw new NullPointerException("test"); + } + +} + +class threadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001.java new file mode 100644 index 00000000000..874c930d646 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001.java @@ -0,0 +1,286 @@ +/* + * 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.MethodExitEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger application in the test + +public class methodexit001 { + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // timeout interval for waiting events in a loop + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // class names + static final String TEST_NAME = "nsk.jdi.MethodExitEvent._itself_.methodexit001"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + // JDI scaffold objects + static private Debugee debuggee; + static private IOPipe pipe; + static private VirtualMachine vm; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // mirrors for tested debuggee entities + static private MethodExitRequest checkedRequest; + static private Method checkedMethod; + static private ReferenceType checkedClass; + + // auxilary breakpoints + static private BreakpointRequest startingBreakpointRequest; + static private BreakpointRequest endingBreakpointRequest; + static private Method runMethod; + + // flags and counters + static private long eventTimeout; + static private int depthVal, eventsCounter; + static private volatile boolean testFailed, eventReceived; + + // start test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // start test from JCK-compatible environment + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + eventsCounter = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + try { + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // get mirrors for checked class, thread, and method + + vm = debuggee.VM(); + + log.display("Getting loaded class in debuggee"); + checkedClass = debuggee.classByName(DEBUGGEE_NAME); + + log.display("Getting reference to method 'foo'"); + checkedMethod = debuggee.methodByName(checkedClass, "foo"); + + // create event request (initially disabled) + + EventRequestManager eventRManager = vm.eventRequestManager(); + + log.display("Creating MethodExitRequest"); + if ((checkedRequest = eventRManager.createMethodExitRequest()) == null) { + throw new Failure("TEST BUG: unable to create MethodExitRequest"); + } + + checkedRequest.addClassFilter(checkedClass); + log.display("MethodExitRequest is created"); + + // create two auxilary breakpoints + + log.display("Getting reference to method "); + runMethod = debuggee.methodByName(checkedClass, "run"); + if (runMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Creating two auxilary breakpoints into method "); + startingBreakpointRequest = debuggee.setBreakpoint(runMethod, methodexit001a.STARTING_BREAKPOINT_LINE); + endingBreakpointRequest = debuggee.setBreakpoint(runMethod, methodexit001a.ENDING_BREAKPOINT_LINE); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + while (!eventReceived) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // enable or disable checked event request at BreakpointEvent + if (event instanceof BreakpointEvent) { + Location eventLocation = ((BreakpointEvent)event).location(); + int lineNumber = eventLocation.lineNumber(); + log.display("BreakpointEvent received for location " + lineNumber); + if (lineNumber == methodexit001a.STARTING_BREAKPOINT_LINE) { + log.display("Enabling MethodExitRequest at breakpoint before invoking method"); + checkedRequest.enable(); + } else if (lineNumber == methodexit001a.ENDING_BREAKPOINT_LINE) { + log.display("Disabling MethodExitRequest at breakpoint after invoking method"); + checkedRequest.disable(); + eventReceived = true; + } else { + testFailed = true; + throw new Failure("TEST BUG: Unknown location of breakpoint event: " + lineNumber); + } + } + + // handle checked MethodEntryEvent + if (event instanceof MethodExitEvent) { + MethodExitEvent castedEvent = (MethodExitEvent) event; + EventRequest eventRequest = castedEvent.request(); + + if (castedEvent.method().equals(checkedMethod)) { + eventsCounter++; + log.display("FAILURE 1: MethodExitEvent is received for method " + + checkedMethod.name() + " at location " + castedEvent.location().lineNumber()); + testFailed = true; + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to invoke method + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee comfirms method invoked + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check whether all expected events received or not + if (eventsCounter == 0) { + log.display("No any MethodExitEvent received for checked method as expected"); + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debuggee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analyze its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001/TestDescription.java new file mode 100644 index 00000000000..67d08ab7c7b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitEvent/_itself_/methodexit001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.MethodExitEvent.method() method. + * The test checks the following assertions: + * - MethodExitEvent is not received by debugger if the method + * terminated with thrown exception in debugged VM; + * A debugger class - nsk.jdi.MethodExitEvent._itself_.methodexit001 ; + * a debuggee class - nsk.jdi.MethodExitEvent._itself_.methodexit001a . + * The test uses supporting nsk/share/jdi classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates MethodEntryRequest filtered to class. + * Also it sets two breakpoint in debuggee before and after invoking + * checked method . + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee recurcively + * invokes method. This method throws user-defined uncatched exception + * . + * The debugger switches to to listen the event during the + * time specified by parameter. When BreakpointEvent for the first + * breakpoint is received, MethodEntryRequest becomes enabled. + * checks all received MetodEntryEvents until second breakpoint is reached + * and MethodEntryRequest becomes disabled. + * If debugger receives MethodEntryEvent for the checked method it + * complains an error message. + * Finally, debugger sends debuggee command QUIT and checks number of recieved + * events. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4433805 EventSet.resume() for VMStartEvent resumes thread suspended by breakpoint request + * Standard method Debugee.endDebugee() is used instead of cleaning event queue on debuggee VM exit. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent._itself_.methodexit001 + * nsk.jdi.MethodExitEvent._itself_.methodexit001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent._itself_.methodexit001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001a.java new file mode 100644 index 00000000000..681926b4c7e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/_itself_/methodexit001a.java @@ -0,0 +1,112 @@ +/* + * 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.MethodExitEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +// This class is the debugged application in the test +public class methodexit001a { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // line numbers for auxilary breakpoints + public static final int STARTING_BREAKPOINT_LINE = 81; + public static final int ENDING_BREAKPOINT_LINE = 90; + + // scaffold objects + static private ArgumentHandler argHandler; + static private Log log; + static private IOPipe pipe; + + // flags and counters + static private boolean methodInvoked; + + // start debuggee + public static void main(String args[]) { + methodexit001a _methodexit001a = new methodexit001a(); + System.exit(JCK_STATUS_BASE + _methodexit001a.run(args, System.err)); + } + + // perform the test + static int run(String args[], PrintStream out) { + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + pipe = argHandler.createDebugeeIOPipe(); + + // notify debugger that debuggee has been started + pipe.println(COMMAND_READY); + + // wait for GO commnad from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + methodInvoked = false; // STARTING_BREAKPOINT_LINE + + // invoke checked method with exception caught + try { + foo(); + } catch (methodexit001e e) { + // do not invoke any methods here to prevent from generation of events + } + + methodInvoked = true; // ENDING_BREAKPOINT_LINE + + // notify debugger that checked method has been invoked + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + // checked method + static void foo() throws methodexit001e { + throw new methodexit001e(); + } +} + +// checked exception +class methodexit001e extends Exception {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001.java new file mode 100644 index 00000000000..510965ac480 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001.java @@ -0,0 +1,374 @@ +/* + * 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.MethodExitEvent.method; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; +import java.lang.Thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// This class is the debugger application in the test +public class method001 { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // timeout interval for waiting events in a loop + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // class names + static final String TEST_NAME = "nsk.jdi.MethodExitEvent.method.method001"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + // JDI scaffold objects + static private Debugee debuggee; + static private IOPipe pipe; + static private VirtualMachine vm; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // mirrors for tested debuggee entities + static private MethodExitRequest checkedRequest; + static private ThreadReference checkedThread; + static private Method checkedMethod; + static private Field checkedField; + static private ReferenceType checkedClass; + static private Field depthField; + + // auxilary breakpoints + static private BreakpointRequest startingBreakpointRequest; + static private BreakpointRequest endingBreakpointRequest; + static private Method runMethod; + + // flags and counters + static private long eventTimeout; + static private int depthVal, eventsCounter; + static private volatile boolean testFailed, eventReceived; + + // start test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // start test from JCK-compatible environment + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + eventsCounter = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + try { + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // get mirrors for checked class, thread, and method + + vm = debuggee.VM(); + + log.display("Getting loaded class in debuggee"); + checkedClass = debuggee.classByName(DEBUGGEE_NAME); + + log.display("Getting reference to thread
    "); + checkedThread = debuggee.threadByName("main"); + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + log.display("Getting reference to method "); + checkedMethod = debuggee.methodByName(checkedClass, "foo"); + if (checkedMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Getting reference to field "); + checkedField = checkedClass.fieldByName("flag"); + if (checkedField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + log.display("Getting reference to field "); + depthField = checkedClass.fieldByName("depth"); + if (depthField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + log.display("Getting value of field "); + try { + depthVal = ((IntegerValue)checkedClass.getValue(depthField)).value(); + log.display("depth == " + depthVal); + } catch (ClassCastException e) { + throw new Failure("TEST BUG: cannot get value of field"); + } + + // create event request (initially disabled) + + EventRequestManager eventRManager = vm.eventRequestManager(); + log.display("Creating MethodExitRequest"); + if ((checkedRequest = eventRManager.createMethodExitRequest()) == null) { + throw new Failure("TEST BUG: unable to create MethodExitRequest"); + } + + checkedRequest.addThreadFilter(checkedThread); + checkedRequest.addClassFilter(checkedClass); + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + switch (checkedRequest.suspendPolicy()) { + case EventRequest.SUSPEND_ALL: + log.display(" suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display(" suspend policy is SUSPEND_EVENT_THREAD"); + break; + case EventRequest.SUSPEND_NONE: + log.display(" suspend policy is SUSPEND_NONE"); + break; + default: + log.complain("TEST BUG: Unknown suspend policy!"); + } + + log.display("MethodExitRequest is created"); + + // create two auxilary breakpoints + + log.display("Getting reference to method "); + runMethod = debuggee.methodByName(checkedClass, "run"); + if (runMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Creating two auxilary breakpoints into method "); + startingBreakpointRequest = debuggee.setBreakpoint(runMethod, method001a.STARTING_BREAKPOINT_LINE); + endingBreakpointRequest = debuggee.setBreakpoint(runMethod, method001a.ENDING_BREAKPOINT_LINE); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + while (!eventReceived) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // enable or disable checked event request at BreakpointEvent + if (event instanceof BreakpointEvent) { + Location eventLocation = ((BreakpointEvent)event).location(); + int lineNumber = eventLocation.lineNumber(); + log.display("BreakpointEvent received for location " + lineNumber); + if (lineNumber == method001a.STARTING_BREAKPOINT_LINE) { + log.display("Enabling MethodExitRequest at breakpoint before invoking method"); + checkedRequest.enable(); + } else if (lineNumber == method001a.ENDING_BREAKPOINT_LINE) { + log.display("Disabling MethodExitRequest at breakpoint after invoking method"); + checkedRequest.disable(); + eventReceived = true; + } else { + testFailed = true; + throw new Failure("TEST BUG: Unknown location of breakpoint event: " + lineNumber); + } + } + + if (event instanceof MethodExitEvent) { + MethodExitEvent castedEvent = (MethodExitEvent) event; + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 2: eventRequest is not equal to checked request"); + testFailed = true; + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 4: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + Method method1 = castedEvent.method(); + Method method2 = castedEvent.method(); + if (!method1.equals(method2)) { + log.complain("FAILURE 7: return of MethodExitEvent.method() is inconsistent"); + testFailed = true; + } + + if (castedEvent.method().equals(checkedMethod)) { + eventsCounter++; + log.display("MethodExitEvent is received for method " + checkedMethod.name() + ", counter = " + eventsCounter); + try { + int flagVal = ((IntegerValue)checkedClass.getValue(checkedField)).value(); + log.display("flag == " + flagVal); + if ( flagVal != 3) { + if (!eventThread.isSuspended()) { + log.complain("FAILURE 5: eventThread is not suspended"); + } else { + log.complain("FAILURE 6: last execution code of the method is not yet executed"); + } + testFailed = true; + } + } catch (ClassCastException e) { + log.complain("TEST BUG: cannot get value of field"); + testFailed = true; + } + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to invoke method + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee comfirms method invoked + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check whether all expected events received or not + if (eventsCounter == 0) { + log.complain("FAILURE 1: No any MethodExitEvent received"); + testFailed = true; + } else if (eventsCounter < depthVal) { + log.complain("FAILURE 1: Some " + (depthVal - eventsCounter) + " MethodExitEvent NOT received (too few)"); + testFailed = true; + } else if (eventsCounter > depthVal) { + log.complain("FAILURE 1: Extra " + (eventsCounter - depthVal) + " MethodExitEvent received (too many)"); + testFailed = true; + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debuggee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analyze its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001/TestDescription.java new file mode 100644 index 00000000000..0ca6a2d5215 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001/TestDescription.java @@ -0,0 +1,94 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitEvent/method/method001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.MethodExitEvent.method() method. + * The test checks the following assertions: + * - MethodExitEvent is received by debugger for requested + * method if this method is normally exited by some + * executing thread in debugged VM; + * - received MethodExitEvent has proper references to: + * method, + * debugged VM, + * executed thread, + * related MethodExitRequest. + * - MethodExitEvent is emitted after last executed code of the + * method. + * A debugger class - nsk.jdi.MethodExitEvent.method.method001 ; + * a debuggee class - nsk.jdi.MethodExitEvent.method.method001a . + * The test uses supporting nsk/share/jdi classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates MethodEntryRequest filtered to class. + * Also it sets two breakpoint in debuggee before and after invoking + * checked method . + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee recurcively + * invokes method. This method updates field of + * class. + * The debugger switches to to listen the event during the + * time specified by parameter. When BreakpointEvent for the first + * breakpoint is received, MethodExitRequest becomes enabled. + * checks all received MetodExitEvents until second breakpoint is reached + * and MethodExitRequest becomes disabled. + * Each time the debugger receives MethodExitEvent, it compares all refencies + * of this event ( , , , ) + * with expected values. If the event belongs to method, value + * of field is checked. + * Finally, debugger sends debuggee command and checks number of recieved + * events. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4433805 EventSet.resume() for VMStartEvent resumes thread suspended by breakpoint request + * Standard method Debugee.endDebugee() is used instead of cleaning event queue on debuggee VM exit. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent.method.method001 + * nsk.jdi.MethodExitEvent.method.method001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent.method.method001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001a.java new file mode 100644 index 00000000000..0463c80d3a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001a.java @@ -0,0 +1,115 @@ +/* + * 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.MethodExitEvent.method; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +// This class is the debugged application in the test +public class method001a { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // line numbers for auxilary breakpoints + public static final int STARTING_BREAKPOINT_LINE = 86; + public static final int ENDING_BREAKPOINT_LINE = 91; + + // scaffold objects + static private ArgumentHandler argHandler; + static private Log log; + static private IOPipe pipe; + + // flags and counters + static private int flag; + static private int depth; + static private boolean methodInvoked; + + // start debuggee + public static void main(String args[]) { + method001a _method001a = new method001a(); + System.exit(JCK_STATUS_BASE + _method001a.run(args, System.err)); + } + + // perform the test + int run(String args[], PrintStream out) { + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + pipe = argHandler.createDebugeeIOPipe(); + + depth = 10; + flag = 0; + + // notify debugger that debuggee has been started + pipe.println(COMMAND_READY); + + // wait for GO commnad from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + methodInvoked = false; // STARTING_BREAKPOINT_LINE + + // invoke checked method + foo(); + + methodInvoked = true; // ENDING_BREAKPOINT_LINE + + // notify debugger that checked method has been invoked + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + // checked method + void foo() { + flag = 1; + if (depth > 1) { + depth--; + foo(); + } + flag = 3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002.java new file mode 100644 index 00000000000..f6b61c1e872 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002.java @@ -0,0 +1,393 @@ +/* + * 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.MethodExitEvent.method; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; +import java.lang.Thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class method002 { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // timeout interval for waiting events in a loop + static final int TIMEOUT_DELTA = 1000; // milliseconds + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // class names + static final String TEST_NAME = "nsk.jdi.MethodExitEvent.method.method002"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + static final String CHILD_NAME = TEST_NAME + "child"; + + // JDI scaffold objects + static private Debugee debuggee; + static private IOPipe pipe; + static private VirtualMachine vm; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + // mirrors for tested debuggee entities + static private MethodExitRequest checkedRequest; + static private ThreadReference checkedThread; + static private Method checkedMethod; + static private Field checkedField; + static private ReferenceType checkedClass; + static private ReferenceType debuggeeClass; + + // auxilary breakpoints + static private BreakpointRequest startingBreakpointRequest; + static private BreakpointRequest endingBreakpointRequest; + static private Method runMethod; + + // flags and counters + static private long eventTimeout; + static private boolean testFailed; + static private boolean eventReceived; + static private int eventsCount; + + // start test from command line + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + // start test from JCK-compatible environment + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + eventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + try { + + // wait for debugee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // get mirrors for checked class, thread, and method + + vm = debuggee.VM(); + + log.display("Getting loaded classes in debuggee"); + debuggeeClass = debuggee.classByName(DEBUGGEE_NAME); + checkedClass = debuggee.classByName(CHILD_NAME); + + log.display("Getting reference to thread
    "); + checkedThread = debuggee.threadByName("main"); + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + log.display("Getting reference to method "); + checkedMethod = debuggee.methodByName(checkedClass, "foo"); + if (checkedMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + if (checkedMethod.isAbstract()) { + throw new Failure("TEST BUG: found method is abstract"); + } + + log.display("Getting reference to field "); + checkedField = checkedClass.fieldByName("counter"); + if (checkedField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + // create event request (initially disabled) + + log.display("Creating MethodExitRequest"); + if ((checkedRequest = vm.eventRequestManager().createMethodExitRequest()) == null) { + throw new Failure("TEST BUG: unable to create MethodExitRequest"); + } + + checkedRequest.addThreadFilter(checkedThread); + checkedRequest.addClassFilter(checkedClass); + checkedRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + switch (checkedRequest.suspendPolicy()) { + case EventRequest.SUSPEND_ALL: + log.display(" suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display(" suspend policy is SUSPEND_EVENT_THREAD"); + break; + case EventRequest.SUSPEND_NONE: + log.display(" suspend policy is SUSPEND_NONE"); + break; + default: + log.complain("TEST BUG: Unknown suspend policy!"); + } + + log.display("MethodExitRequest is created"); + + // create two auxilary breakpoints + + log.display("Getting reference to method "); + runMethod = debuggee.methodByName(debuggeeClass, "run"); + if (runMethod == null) { + throw new Failure("TEST BUG: returned null reference to method "); + } + + log.display("Creating two auxilary breakpoints into method "); + startingBreakpointRequest = debuggee.setBreakpoint(runMethod, method002a.STARTING_BREAKPOINT_LINE); + endingBreakpointRequest = debuggee.setBreakpoint(runMethod, method002a.ENDING_BREAKPOINT_LINE); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + while (!eventReceived) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // enable or disable checked event request at BreakpointEvent + if (event instanceof BreakpointEvent) { + Location eventLocation = ((BreakpointEvent)event).location(); + int lineNumber = eventLocation.lineNumber(); + log.display("BreakpointEvent received for location " + lineNumber); + if (lineNumber == method002a.STARTING_BREAKPOINT_LINE) { + log.display("Enabling MethodExitRequest at breakpoint before invoking method"); + checkedRequest.enable(); + } else if (lineNumber == method002a.ENDING_BREAKPOINT_LINE) { + log.display("Disabling MethodExitRequest at breakpoint after invoking method"); + checkedRequest.disable(); + eventReceived = true; + } else { + testFailed = true; + throw new Failure("TEST BUG: Unknown location of breakpoint event: " + lineNumber); + } + } + + // handle checked MethodExitEvent + if (event instanceof MethodExitEvent) { + MethodExitEvent castedEvent = (MethodExitEvent) event; + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 2: eventRequest is not equal to checked request"); + testFailed = true; + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 4: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + if (castedEvent.method().equals(checkedMethod)) { + eventsCount++; + log.display("MethodExitEvent is received for method " + checkedMethod.name()); + try { + int counterVal = ((IntegerValue)checkedClass.getValue(checkedField)).value(); + log.display("Counter == " + counterVal); + if ( counterVal != 3) { + if (!eventThread.isSuspended()) { + log.complain("FAILURE 5: eventThread is not suspended"); + } else { + log.complain("FAILURE 6: last execution code of the method is not yet executed"); + } + testFailed = true; + } + } catch (ClassCastException e) { + log.complain("TEST BUG: cannot get value of field"); + testFailed = true; + } + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to invoke method + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee comfirms method invoked + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check whether all expected events received or not + if (eventsCount < 1) { + log.complain("FAILURE 1: No any MethodExitEvent received"); + testFailed = true; + } else if (eventsCount > 1) { + log.complain("FAILURE 1: Too many MethodExitEvent received: " + eventsCount); + testFailed = true; + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debuggee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analyze its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + + } + + // create breakpoint request for given method and line number + private static BreakpointRequest setBreakpoint(Method method, int line) { + + // find location for the given line + List allLineLocations = null; + try { + allLineLocations = method.allLineLocations(); + } catch ( AbsentInformationException e) { + throw new Failure("TEST BUG: caught AbsentInformationException " + e); + } + + Location foundLocation = null; + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location location = (Location)locIterator.next(); + if (location.lineNumber() == line) { + foundLocation = location; + break; + } + } + if (foundLocation == null) { + throw new Failure("TEST BUG: unable to find breakpoint location for line number " + line); + } + + // create and enable breakpoint request + log.display("Setting breakpoint at location: " + foundLocation); + BreakpointRequest breakpointRequest = vm.eventRequestManager().createBreakpointRequest(foundLocation); + if (breakpointRequest == null) { + throw new Failure("TEST BUG: unable to create BreakpointRequest"); + } + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + breakpointRequest.enable(); + + return breakpointRequest; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002/TestDescription.java new file mode 100644 index 00000000000..a424c05e417 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitEvent/method/method002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.MethodExitEvent.method() method. + * The test checks the following assertions: + * - MethodExitEvent is received by debugger for requested + * method if this method is invoked by some executing thread + * in debugged VM; + * - received MethodExitEvent has proper references to: + * method, + * debugged VM, + * executed thread, + * related MethodExitRequest. + * - MethodExitEvent is generated after last executed code of the + * method. + * A debugger class - nsk.jdi.MethodExitEvent.method.method002 ; + * a debuggee class - nsk.jdi.MethodExitEvent.method.method002a . + * The test uses supporting nsk/share/jdi classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates MethodEntryRequest filtered to class. + * Also it sets two breakpoint in debuggee before and after invoking + * checked method . + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee creates variable + * of class. This class implements abstract method + * of class. The method is invoked. The + * implementing method updates field of class. + * The debugger switches to to listen the event during the + * time specified by parameter. When BreakpointEvent for the first + * breakpoint is received, MethodEntryRequest becomes enabled. + * checks all received MetodEntryEvents until second breakpoint is reached + * and MethodEntryRequest becomes disabled. + * Each time the debugger receives MethodEntryEvent, it compares all refencies + * of this event ( , , , ) + * with expected values. If the event belongs to method, value + * of field is checked. + * Finally, debugger sends debuggee command QUIT and checks number of recieved + * events. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4433805 EventSet.resume() for VMStartEvent resumes thread suspended by breakpoint request + * Standard method Debugee.endDebugee() is used instead of cleaning event queue on debuggee VM exit. + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method for setting breapoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent.method.method002 + * nsk.jdi.MethodExitEvent.method.method002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent.method.method002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002a.java new file mode 100644 index 00000000000..5f23f9b3070 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002a.java @@ -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.MethodExitEvent.method; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +// This class is the debugged application in the test +public class method002a { + + // exit status constants + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // synchronization commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // line numbers for auxilary breakpoints + public static final int STARTING_BREAKPOINT_LINE = 83; + public static final int ENDING_BREAKPOINT_LINE = 88; + + // scaffold objects + static private ArgumentHandler argHandler; + static private Log log; + static private IOPipe pipe; + + // flags and counters + static private boolean methodInvoked; + + // start debuggee + public static void main(String args[]) { + method002a _method002a = new method002a(); + System.exit(JCK_STATUS_BASE + _method002a.run(args, System.err)); + } + + // perform the test + static int run(String args[], PrintStream out) { + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + pipe = argHandler.createDebugeeIOPipe(); + + method002parent a = new method002child(); + + // notify debugger that debuggee has been started + pipe.println(COMMAND_READY); + + // wait for GO commnad from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + methodInvoked = false; // STARTING_BREAKPOINT_LINE + + // invoke checked method + a.foo(); + + methodInvoked = true; // ENDING_BREAKPOINT_LINE + + // notify debugger that checked method has been invoked + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } +} + +abstract class method002parent { + abstract void foo(); +} + +class method002child extends method002parent { + static private int counter = 0; + + void foo() { + counter++; counter *= 3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001.java new file mode 100644 index 00000000000..9cc8f688eb2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001.java @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitEvent/returnValue/returnValue001. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that method 'MethodExitEvent.returnValue()' returns the value that the method will return. + * Test generates MethodExitEvents for methods with following return types: + * - void + * - all primitive types + * - array of objects + * - String + * - Thread + * - ThreadGroup + * - Class + * - ClassLoader + * - Object + * - wrappers for all primitive types + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent.returnValue.returnValue001.returnValue001 + * nsk.jdi.MethodExitEvent.returnValue.returnValue001.returnValue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent.returnValue.returnValue001.returnValue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.MethodExitEvent.returnValue.returnValue001; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.*; +import nsk.share.jdi.*; +import nsk.share.jpda.ForceEarlyReturnTestThread; + +/* + * Test checks that method 'MethodExitEvent.returnValue()' returns the value that the method will return. + * For generation MethodExitEvent for methods with different return types class ForceEarlyReturnTestThread is used. + * This test thread executes in loop methods with following return types: + * - void + * - all primitive types + * - array of objects + * - String + * - Thread + * - ThreadGroup + * - Class + * - ClassLoader + * - Object + * - wrappers for all primitive types + * + * Returned values are stored in ForceEarlyReturnTestThread's static fields. Test receives MethodExitEvent, obtains value + * of corresponding static field and compares this value with result of 'MethodExitEvent.returnValue()'. + */ +public class returnValue001 extends TestDebuggerType2 { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new returnValue001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return returnValue001a.class.getName(); + } + + protected boolean canRunTest() { + return vm.canGetMethodReturnValues(); + } + + // event listener handles MethodExitEvents + class EventListener extends EventHandler.EventListener { + private int eventCounter; + + private int expectedEventNumber; + + volatile boolean allEventsWereReceived; + + private List expectedTypes = new ArrayList(); + + public EventListener() { + for (String typeName : ForceEarlyReturnTestThread.testedTypesNames) + expectedTypes.add(typeName); + expectedEventNumber = expectedTypes.size(); + } + + public boolean eventReceived(Event event) { + if (event instanceof MethodExitEvent) { + + /* + * ForceEarlyReturnTestThread has several methods with different return types which are called + * in special manner: "Method", for example BooleanMethod. Return values for this methods + * are stored in ForceEarlyReturnTestThread's static fields which are named "unexpectedValue", + * for example "unexpectedBooleanValue". + * When MethodExitEvent is received EventListener finds method name for received MethodExitEvent and if + * method's name has form "Method" EventListener constructs static field name for corresponding + * type, obtains static field value and compares this value with result of MethodExitEvent.returnValue(). + */ + MethodExitEvent methodExitEvent = (MethodExitEvent) event; + String methodName = methodExitEvent.method().name(); + + int index = methodName.indexOf("Method"); + + if (index > 0) { + + String typeName = methodName.substring(0, index); + + if (expectedTypes.contains(typeName)) { + log.display("Received event for method: " + methodExitEvent.method()); + expectedTypes.remove(typeName); + + Value expectedReturnValue; + + if (typeName.equals("Void")) { + expectedReturnValue = vm.mirrorOfVoid(); + } else { + ReferenceType referenceType = debuggee.classByName(ForceEarlyReturnTestThread.class.getName()); + expectedReturnValue = referenceType.getValue(referenceType.fieldByName("unexpected" + typeName + "Value")); + } + + Value returnValue = methodExitEvent.returnValue(); + + if (!returnValue.equals(expectedReturnValue)) { + setSuccess(false); + log.complain("Unexpected return value: " + returnValue + ", expected is " + expectedReturnValue); + } else { + log.display("Return value for method '" + methodName + "': " + returnValue); + } + + eventCounter++; + + if (eventCounter == expectedEventNumber) { + allEventsWereReceived = true; + log.display("All expected events were received"); + methodExitEvent.request().disable(); + testStopWicket.unlock(); + } + } + } + + methodExitEvent.thread().resume(); + + return true; + } + + return false; + } + } + + private Wicket testStopWicket = new Wicket(); + + public void doTest() { + // create request for MethodExitEvents generated by ForceEarlyReturnTestThread + MethodExitRequest request = debuggee.getEventRequestManager().createMethodExitRequest(); + ReferenceType referenceType = debuggee.classByName(ForceEarlyReturnTestThread.class.getName()); + request.addClassFilter(referenceType); + request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + request.enable(); + + // start event handler + EventHandler eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + // add event listener which handles MethodExit events + EventListener listener = new EventListener(); + eventHandler.addListener(listener); + + // start thread generating MethodExitEvent + pipe.println(returnValue001a.COMMAND_START_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + // EventListener should notify main thread when all event are received + testStopWicket.waitFor(argHandler.getWaitTime() * 60000); + + if (!listener.allEventsWereReceived) { + setSuccess(false); + log.complain("ERROR: not all events were received"); + } + + pipe.println(returnValue001a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + eventHandler.stopEventHandler(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001a.java new file mode 100644 index 00000000000..6ef859c90c9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001a.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 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.MethodExitEvent.returnValue.returnValue001; + +import nsk.share.TestBug; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/* + * Debuggee class, handles commands for starting and stoping ForceEarlyReturnTestThread. + */ +public class returnValue001a extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new returnValue001a().doTest(args); + } + + public static final String COMMAND_START_TEST_THREAD = "COMMAND_START_TEST_THREAD"; + + public static final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + public String[] doInit(String args[]) { + args = super.doInit(args); + + try { + // load ForceEarlyReturnTestThread class to let debugger get instance of ReferenceType for this class + Class.forName(ForceEarlyReturnTestThread.class.getName()); + } catch (Throwable t) { + setSuccess(false); + System.out.println("Unexpected exception during initialization: " + t); + t.printStackTrace(); + throw new TestBug("Unexpected exception during initialization: " + t); + } + + return args; + } + + private ForceEarlyReturnTestThread testThread; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + + if (testThread != null) + throw new TestBug("Thread is already created"); + + testThread = new ForceEarlyReturnTestThread(log, false, 1); + testThread.start(); + testThread.startExecuion(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + + if (testThread == null) + throw new TestBug("Thread isn't created"); + + testThread.stopExecution(); + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + return true; + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002.java new file mode 100644 index 00000000000..c4c48f27541 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitEvent/returnValue/returnValue002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test checks that method 'MethodExitEvent.returnValue()' returns VoidValue when event is generated + * for static initializer, constructor and static method. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent.returnValue.returnValue002.returnValue002 + * nsk.jdi.MethodExitEvent.returnValue.returnValue002.returnValue002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent.returnValue.returnValue002.returnValue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.MethodExitEvent.returnValue.returnValue002; + +import java.io.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.*; +import nsk.share.jdi.*; + +/* + * Test checks that method 'MethodExitEvent.returnValue()' returns VoidValue for static initializer, class constructor + * and static method. + */ +public class returnValue002 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new returnValue002().runIt(argv, out); + } + + protected String debuggeeClassName() { + return returnValue002a.class.getName(); + } + + protected boolean canRunTest() { + return vm.canGetMethodReturnValues(); + } + + class EventListener extends EventHandler.EventListener { + + private volatile boolean allEventsWereReceived; + + private boolean staticInitializerEventReceived; + private boolean constructorEventReceived; + private boolean staticMethodEventReceived; + + public boolean eventReceived(Event event) { + if (event instanceof MethodExitEvent) { + MethodExitEvent methodExitEvent = (MethodExitEvent) event; + + log.display("Received event for method: " + methodExitEvent.method()); + + if (methodExitEvent.method().name().equals("")) { + log.display("Static initializer event received"); + staticInitializerEventReceived = true; + } + + if (methodExitEvent.method().name().equals("")) { + log.display("Constructor event received"); + constructorEventReceived = true; + } + + if (methodExitEvent.method().name().equals("staticMethod")) { + log.display("Static method event received"); + staticMethodEventReceived = true; + } + + if (!methodExitEvent.returnValue().equals(vm.mirrorOfVoid())) { + setSuccess(false); + log.complain("Unexpected return value: " + methodExitEvent.returnValue() + ", expected is " + vm.mirrorOfVoid()); + } + + // expect events for static initializer, constructor, static method + if (staticInitializerEventReceived && constructorEventReceived && staticMethodEventReceived) { + allEventsWereReceived = true; + log.display("All expected events were received"); + methodExitEvent.request().disable(); + testStopWicket.unlock(); + } + + methodExitEvent.thread().resume(); + + return true; + } + + return false; + } + } + + private Wicket testStopWicket = new Wicket(); + + public void doTest() { + // create MethodExitRequest for events generated for returnValue002a.TestClass methods + MethodExitRequest request = debuggee.getEventRequestManager().createMethodExitRequest(); + request.addClassFilter(returnValue002a.TestClass.class.getName()); + request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + request.enable(); + + // start event handler + EventHandler eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + // add event listener which handles MethodExitEvents + EventListener listener = new EventListener(); + eventHandler.addListener(listener); + + pipe.println(returnValue002a.COMMAND_START_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + // EventListener should notify main thread when all event are received + testStopWicket.waitFor(argHandler.getWaitTime() * 60000); + + if (!listener.allEventsWereReceived) { + setSuccess(false); + log.complain("ERROR: not all events were received, possible there is error in test logic"); + } + + pipe.println(returnValue002a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + eventHandler.stopEventHandler(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002a.java new file mode 100644 index 00000000000..35af72be4ea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002a.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2007, 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.MethodExitEvent.returnValue.returnValue002; + +import nsk.share.TestBug; +import nsk.share.jdi.*; + +/* + * Debuggee class, handles command for starting test thread which creates instance + * of returnValue002a.TestClass. + */ +public class returnValue002a extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new returnValue002a().doTest(args); + } + + // test class containig static initializer, constructor and static method + static class TestClass { + static { + System.out.println("TestClass static initializer"); + } + + public TestClass() { + System.out.println("TestClass constructor"); + } + + static void staticMethod() { + System.out.println("TestClass static method"); + } + } + + public static final String COMMAND_START_TEST_THREAD = "COMMAND_START_TEST_THREAD"; + + public static final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + static class TestThread extends Thread { + public void run() { + // static initializer and constructor for class 'TestClass' are called here + new TestClass(); + TestClass.staticMethod(); + } + } + + private TestThread testThread; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + + if (testThread != null) + throw new TestBug("Thread is already created"); + + testThread = new TestThread(); + testThread.start(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + + if (testThread == null) + throw new TestBug("Thread isn't created"); + + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + return true; + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003.java new file mode 100644 index 00000000000..4ea32650b4d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003.java @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2007, 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/MethodExitEvent/returnValue/returnValue003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that method 'MethodExitEvent.returnValue()' returns the value that the method will return. + * Test generates MethodExitEvents for methods with following return types: + * - void + * - all primitive types + * - array of objects + * - String + * - Thread + * - ThreadGroup + * - Class + * - ClassLoader + * - Object + * - wrappers for all primitive types + * Test checks case when MethodExitEvent is generated when method completes because of debugger calls method + * ThreadReference.forceEarlyReturn(). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent.returnValue.returnValue003.returnValue003 + * nsk.jdi.MethodExitEvent.returnValue.returnValue003.returnValue003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent.returnValue.returnValue003.returnValue003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.MethodExitEvent.returnValue.returnValue003; + +import java.io.PrintStream; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.TestDebuggerType2; +import nsk.share.jpda.ForceEarlyReturnTestThread; + +/* + * Test checks that method 'MethodExitEvent.returnValue()' returns the value that the method will return. + * Test checks case when MethodExitEvent is generated when method completes because of debugger calls method + * ThreadReference.forceEarlyReturn(). + * + * For generation MethodExitEvent for methods with different return types class ForceEarlyReturnTestThread is used. + * Values intended to return through ThreadReference.ForceEarlyReturn are stored in ForceEarlyReturnTestThread's static + * fields. + * + * This test thread executes methods with following return types: + * - void + * - all primitive types + * - array of objects + * - String + * - Thread + * - ThreadGroup + * - Class + * - ClassLoader + * - Object + * - wrappers for all primitive types + * + * Debugger sets breakpoints in all this methods and waits while BreakpointEvent occurs. When debuggee's + * test thread stops at breakpoint debugger calls forceEarlyReturn() with corresponding value, creates MethodExitEvent + * for test thread and resumes test thread. When MethodExitEvent is received debugger checks that + * MethodExitEvent.returnValue() returns the same value which was passed to the ThreadReference,forceEarlyReturn(). + */ +public class returnValue003 extends TestDebuggerType2 { + // Data for testing forceEarlyReturn for single method + // Contains following data: + // - tested method's name + // - breakpoint request for location in tested method + // InvalidTypeException is thrown + // - correct value to pass in forceEarlyReturn() + class TestData { + public TestData(ReferenceType referenceType, String methodName, int lineNumber, ThreadReference thread, Value returnValue) { + breakpointRequest = debuggee.makeBreakpoint(referenceType, methodName, lineNumber); + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.addThreadFilter(thread); + breakpointRequest.enable(); + + this.returnValue = returnValue; + this.methodName = methodName; + } + + String methodName; + + BreakpointRequest breakpointRequest; + + Value returnValue; + } + + protected boolean canRunTest() { + return vm.canGetMethodReturnValues(); + } + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new returnValue003().runIt(argv, out); + } + + protected String debuggeeClassName() { + return returnValue003a.class.getName(); + } + + private TestExecutorThread testThread; + + // predefined in TestThread values to pass in forceEarlyReturn() + private Value testValues[]; + + class TestExecutorThread extends Thread { + TestData testData[]; + + private ThreadReference thread; + + public TestExecutorThread(ReferenceType testedThreadReferenceType, String threadName) { + thread = debuggee.threadByName(threadName); + + testData = new TestData[ForceEarlyReturnTestThread.testedTypesNames.length]; + + for (int i = 0; i < testData.length; i++) { + testData[i] = new TestData(testedThreadReferenceType, ForceEarlyReturnTestThread.testedTypesNames[i] + "Method", + ForceEarlyReturnTestThread.breakpointLines[i], thread, testValues[i]); + } + } + + public void run() { + for (int i = 0; i < testData.length; i++) + test(testData[i]); + + log.display("Test executor thread exit"); + } + + public void test(TestData testData) { + BreakpointEvent breakPointEvent = waitForBreakpoint(testData.breakpointRequest); + + try { + log.display("Call forceEarlyReturn with value: " + testData.returnValue); + breakPointEvent.thread().forceEarlyReturn(testData.returnValue); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e + ", method: " + testData.methodName); + e.printStackTrace(System.out); + } + + testMethodExitEvent(thread, testData.methodName, testData.returnValue); + } + } + + protected void testMethodExitEvent(ThreadReference thread, String methodName, Value expectedValue) { + MethodExitRequest methodExitRequest; + methodExitRequest = debuggee.getEventRequestManager().createMethodExitRequest(); + methodExitRequest.addThreadFilter(thread); + methodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + methodExitRequest.enable(); + + EventListenerThread listenerThread = new EventListenerThread(methodExitRequest); + listenerThread.start(); + listenerThread.waitStartListen(); + + thread.resume(); + + Event event = listenerThread.getEvent(); + + if (event == null) { + setSuccess(false); + log.complain("MethodExitEvent was not generated " + ", method: " + methodName); + } else { + MethodExitEvent methodExitEvent = (MethodExitEvent) event; + if (!methodExitEvent.method().name().equals(methodName)) { + setSuccess(false); + log.complain("Invalid MethodExitEvent: expected method - " + methodName + ", actually - " + + methodExitEvent.method().name()); + } else { + Value returnValue = methodExitEvent.returnValue(); + + if (!returnValue.equals(expectedValue)) { + setSuccess(false); + log.complain("Unexpected result of MethodExitEvent.returnValue(): " + returnValue + ", expected is " + expectedValue); + } else { + log.display("Result of MethodExitEvent.returnValue():" + returnValue); + } + } + } + + methodExitRequest.disable(); + + thread.resume(); + } + + // initialize Values objects to pass in forceEarlyReturn() + protected void initTestValues() { + ReferenceType referenceType = debuggee.classByName(ForceEarlyReturnTestThread.class.getName()); + + Value voidValue = createVoidValue(); + + if (voidValue == null) { + setSuccess(false); + log.complain("Can't create void value"); + return; + } + + testValues = new Value[ForceEarlyReturnTestThread.testedTypesNames.length + 1]; + + testValues[0] = voidValue; + + for (int i = 1; i < ForceEarlyReturnTestThread.testedTypesNames.length; i++) + testValues[i] = referenceType.getValue(referenceType.fieldByName("expected" + ForceEarlyReturnTestThread.testedTypesNames[i] + "Value")); + } + + private void startTestThread() { + ReferenceType referenceType = debuggee.classByName(ForceEarlyReturnTestThread.class.getName()); + + testThread = new TestExecutorThread(referenceType, returnValue003a.testThreadName); + testThread.start(); + } + + private void waitTestEnd() { + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + } + + public void doTest() { + initTestValues(); + + // start ForceEarlyReturnThread to let create breakpoints for this thread + pipe.println(returnValue003a.COMMAND_START_AND_SUSPEND_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + startTestThread(); + + pipe.println(returnValue003a.COMMAND_START_TEST_THREAD_EXECUTION); + + if (!isDebuggeeReady()) + return; + + waitTestEnd(); + + pipe.println(returnValue003a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003a.java new file mode 100644 index 00000000000..a37475ecc32 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003a.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2007, 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.MethodExitEvent.returnValue.returnValue003; + +import nsk.share.*; +import nsk.share.jpda.ForceEarlyReturnTestThread; +import nsk.share.jdi.*; + +/* + * Debuggee class, handles commands for starting and stoping ForceEarlyReturnTestThread. + */ +public class returnValue003a extends AbstractJDIDebuggee { + static { + try { + // load thread class to let debugger get ReferenceType for TestThread class + Class.forName(ForceEarlyReturnTestThread.class.getName()); + } catch (ClassNotFoundException e) { + System.out.println("ClassNotFoundException while loading test thread class: " + e); + e.printStackTrace(System.out); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + + public static void main(String args[]) { + new returnValue003a().doTest(args); + } + + // start and suspend test threads to let debugger initialize breakpoints (debugger should obtain ThreadReference) + // command:threadsNumber:iterationsNumber + public static final String COMMAND_START_AND_SUSPEND_TEST_THREAD = "startAndSuspendTestThread"; + + // let test threads continue execution + public static final String COMMAND_START_TEST_THREAD_EXECUTION = "startTestThreadExecution"; + + // stop test threads + public static final String COMMAND_STOP_TEST_THREAD = "stopTestThread"; + + public static final String testThreadName = "returnValue03_TestThread"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_AND_SUSPEND_TEST_THREAD)) { + startTestThread(); + return true; + } else if (command.equals(COMMAND_START_TEST_THREAD_EXECUTION)) { + startTestThreadsExecution(); + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + stopTestThreads(); + return true; + } + + return false; + } + + private ForceEarlyReturnTestThread testThread; + + private void startTestThread() { + testThread = new ForceEarlyReturnTestThread(log, true, 1); + testThread.setName(testThreadName); + testThread.start(); + } + + private void startTestThreadsExecution() { + if (testThread == null) { + throw new TestBug("Test threads wasn't started"); + } + testThread.startExecuion(); + } + + private void stopTestThreads() { + if (testThread == null) { + throw new TestBug("Test threads wasn't started"); + } + + testThread.stopExecution(); + + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + if (!testThread.getSuccess()) + setSuccess(false); + } + + // access to success status for TestThread + public void setSuccess(boolean value) { + super.setSuccess(value); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004.java new file mode 100644 index 00000000000..bda5f045d32 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitEvent/returnValue/returnValue004. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that method 'MethodExitEvent.returnValue()' returns the value that the method will return. + * Test checks case when MethodExitEvent are generated for native methods. + * Test generates MethodExitEvents for native methods with following return types: + * - void + * - all primitive types + * - array of objects + * - String + * - Thread + * - ThreadGroup + * - Class + * - ClassLoader + * - Object + * - wrappers for all primitive types + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitEvent.returnValue.returnValue004.returnValue004 + * nsk.jdi.MethodExitEvent.returnValue.returnValue004.returnValue004a + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.MethodExitEvent.returnValue.returnValue004.returnValue004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.MethodExitEvent.returnValue.returnValue004; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.*; +import nsk.share.jdi.*; +import nsk.share.jpda.NativeMethodsTestThread; + +/* + * Test checks that method 'MethodExitEvent.returnValue()' returns the value that the method will return + * (test checks case when events are generated for native methods). + * + * For generation MethodExitEvent for methods with different return types class NativeMethodsTestThread is used. + * This test thread executes native methods with following return types: + * - void + * - all primitive types + * - array of objects + * - String + * - Thread + * - ThreadGroup + * - Class + * - ClassLoader + * - Object + * - wrappers for all primitive types + * + * Returned values are stored in NativeMethodsTestThread's static fields. Test receives MethodExitEvent, obtains value + * of corresponding static field and compares this value with result of 'MethodExitEvent.returnValue()'. + */ +public class returnValue004 extends TestDebuggerType2 { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new returnValue004().runIt(argv, out); + } + + protected String debuggeeClassName() { + return returnValue004a.class.getName(); + } + + protected boolean canRunTest() { + return vm.canGetMethodReturnValues(); + } + + // event listener handles MethodExitEvents + class EventListener extends EventHandler.EventListener { + private int eventCounter; + + private int expectedEventNumber; + + volatile boolean allEventsWereReceived; + + private List expectedTypes = new ArrayList(); + + public EventListener() { + for (String typeName : NativeMethodsTestThread.testedTypesNames) + expectedTypes.add(typeName); + expectedEventNumber = expectedTypes.size(); + } + + public boolean eventReceived(Event event) { + if (event instanceof MethodExitEvent) { + + /* + * NativeMethodsTestThread has several methods with different return types which are called + * in special manner: "Method", for example BooleanMethod. Return values for this methods + * are stored in NativeMethodsTestThread's static fields which are named "expectedValue", + * for example "expectedBooleanValue". + * When MethodExitEvent is received EventListener finds method name for received MethodExitEvent and if + * method's name has form "Method" EventListener constructs static field name for corresponding + * type, obtains static field value and compares this value with result of MethodExitEvent.returnValue(). + */ + MethodExitEvent methodExitEvent = (MethodExitEvent) event; + String methodName = methodExitEvent.method().name(); + + int index = methodName.indexOf("Method"); + + if (index > 0) { + + String typeName = methodName.substring(0, index); + + if (expectedTypes.contains(typeName)) { + log.display("Received event for method: " + methodExitEvent.method()); + expectedTypes.remove(typeName); + + Value expectedReturnValue; + + if (typeName.equals("Void")) { + expectedReturnValue = vm.mirrorOfVoid(); + } else { + ReferenceType referenceType = debuggee.classByName(NativeMethodsTestThread.class.getName()); + expectedReturnValue = referenceType.getValue(referenceType.fieldByName("expected" + typeName + "Value")); + } + + Value returnValue = methodExitEvent.returnValue(); + + if (!returnValue.equals(expectedReturnValue)) { + setSuccess(false); + log.complain("Unexpected return value: " + returnValue + ", expected is " + expectedReturnValue); + } else { + log.display("Return value for method '" + methodName + "': " + returnValue); + } + + eventCounter++; + + if (eventCounter == expectedEventNumber) { + allEventsWereReceived = true; + log.display("All expected events were received"); + methodExitEvent.request().disable(); + testStopWicket.unlock(); + } + } + } + + methodExitEvent.thread().resume(); + + return true; + } + + return false; + } + } + + private Wicket testStopWicket = new Wicket(); + + public void doTest() { + // create request for MethodExitEvents generated by NativeMethodsTestThread + MethodExitRequest request = debuggee.getEventRequestManager().createMethodExitRequest(); + ReferenceType referenceType = debuggee.classByName(NativeMethodsTestThread.class.getName()); + request.addClassFilter(referenceType); + request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + request.enable(); + + // start event handler + EventHandler eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + // add event listener which handles MethodExit events + EventListener listener = new EventListener(); + eventHandler.addListener(listener); + + // start thread generating MethodExitEvent + pipe.println(returnValue004a.COMMAND_START_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + // EventListener should notify main thread when all event are received + testStopWicket.waitFor(argHandler.getWaitTime() * 60000); + + if (!listener.allEventsWereReceived) { + setSuccess(false); + log.complain("ERROR: not all events were received"); + } + + pipe.println(returnValue004a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + eventHandler.stopEventHandler(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004a.java new file mode 100644 index 00000000000..7f5beb285f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004a.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 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.MethodExitEvent.returnValue.returnValue004; + +import nsk.share.TestBug; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/* + * Debuggee class, handles commands for starting and stoping ForceEarlyReturnTestThread. + */ +public class returnValue004a extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new returnValue004a().doTest(args); + } + + public static final String COMMAND_START_TEST_THREAD = "COMMAND_START_TEST_THREAD"; + + public static final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + public String[] doInit(String args[]) { + args = super.doInit(args); + + try { + // load ForceEarlyReturnTestThread class to let debugger get instance of ReferenceType for this class + Class.forName(NativeMethodsTestThread.class.getName()); + } catch (Throwable t) { + setSuccess(false); + System.out.println("Unexpected exception during initialization: " + t); + t.printStackTrace(); + throw new TestBug("Unexpected exception during initialization: " + t); + } + + return args; + } + + private NativeMethodsTestThread testThread; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + + if (testThread != null) + throw new TestBug("Thread is already created"); + + testThread = new NativeMethodsTestThread(log, false, 1); + testThread.start(); + testThread.startExecuion(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + + if (testThread == null) + throw new TestBug("Thread isn't created"); + + testThread.stopExecution(); + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + return true; + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001.java new file mode 100644 index 00000000000..5a663348ae0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001.java @@ -0,0 +1,226 @@ +/* + * 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.MethodExitRequest._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; + +/** + * The test checks up the
    + * - addThreadFilter(ThreadReference)
    + * - addInstanceFilter(ObjectReference)
    + * - addClassFilter(ReferenceType)
    + * - addClassFilter(String)
    + * - addClassExclusionFilter(String)
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +public class filters001 { + + private final static String prefix = "nsk.jdi.MethodExitRequest._bounds_."; + private final static String debuggerName = prefix + "filters001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + display(""); + display(">>>creating MethodExitRequest"); + + MethodExitRequest request = + debugee.getEventRequestManager().createMethodExitRequest(); + + display(""); + addThreadFilter(request, null); + + display(""); + addInstanceFilter(request, null); + + display(""); + addClassFilter(request, (ReferenceType )null); + + display(""); + addClassFilter(request, (String )null); + + display(""); + addClassExclusionFilter(request, (String )null); + + display(""); + debugee.quit(); + } + + private void addThreadFilter(MethodExitRequest request, ThreadReference thread) { + String tmp = "addThreadFilter :thread name> "; + tmp += (thread == null) ? "" : thread.name(); + display(tmp); + + try { + request.addThreadFilter(thread); + if (thread==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (thread == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addInstanceFilter(MethodExitRequest request, + ObjectReference instance) { + String tmp = "addInstanceFilter :object value> "; + tmp += (instance == null) ? "" : instance.toString(); + display(tmp); + + try { + request.addInstanceFilter(instance); + if (instance==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (instance == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(MethodExitRequest request, ReferenceType refType) { + + display("addClassFilter :ReferenceType> <" + refType + ">"); + + try { + request.addClassFilter(refType); + if (refType==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (refType==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(MethodExitRequest request, String classPattern) { + + display("addClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(MethodExitRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassExclusionFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..d2b20b92321 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/MethodExitRequest/_bounds_/filters001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.MethodExitRequest.addThreadFilter(ThreadReference) + * com.sun.jdi.request.MethodExitRequest.addInstanceFilter(ObjectReference) + * com.sun.jdi.request.MethodExitRequest.addClassFilter(ReferenceType) + * com.sun.jdi.request.MethodExitRequest.addClassFilter(String) + * com.sun.jdi.request.MethodExitRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up this methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest._bounds_.filters001 + * nsk.jdi.MethodExitRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..45dbb03d998 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001a.java @@ -0,0 +1,54 @@ +/* + * 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.MethodExitRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001.java new file mode 100644 index 00000000000..18684b56027 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001.java @@ -0,0 +1,160 @@ +/* + * 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.MethodExitRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addClassExclusionFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The case to checks a pattern that ends with '*'. + * + * The test works as follows. + * - The debugger + * - sets up two MethodExitRequests, + * - restricts the Requests using patterns 'java*' and 'sun*', + * so that events will be filtered only from test classes, + * - resumes the debuggee, and + * - waits for expected MethodExitEvents. + * - The debuggee creates and starts thread1, which being run, + * invoke methods used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter001a"; + return new filter001().runThis(argv, out); + } + + private String classExclName1 = "java"; + private String classExclName2 = "sun"; + private boolean methodExitReceived = false; + + protected void testRun() { + + MethodExitRequest eventRequest1 = null; + String thread1Name = "thread1"; + String property1 = "MethodExitRequest1"; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + ThreadReference thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting23MethodExitRequest( thread1, + EventRequest.SUSPEND_NONE, + property1); + + eventRequest1.addClassExclusionFilter(classExclName1 + "*"); + eventRequest1.addClassExclusionFilter(classExclName2 + "*"); + eventRequest1.enable(); + + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof MethodExitEvent) { + methodExitReceived = true; + String str = ((MethodExitEvent)event).location().declaringType().name(); + if (str.indexOf(classExclName1) == 0 || str.indexOf(classExclName2) == 0) { + setFailedStatus("Received unexpected MethodExitEvent for excluded class:" + str); + } else { + display("Received expected MethodExitEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting for MethodExitEvent in expected thread"); + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + if (!methodExitReceived) { + setFailedStatus("No MethodExitEvent was received."); + } + return; + } + + private MethodExitRequest setting23MethodExitRequest ( ThreadReference thread, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..b4fdf076ebb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodExit - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter001; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter001 + * nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001a.java new file mode 100644 index 00000000000..ced41a717de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter001a.java @@ -0,0 +1,180 @@ +/* + * 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.MethodExitRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter001 JDI test. + */ + +public class filter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter001a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter001a("thread1"); + log1("new filter001a().run1(thread1);"); + new filter001a().run1(thread1); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class Thread1filter001a extends Thread { + + class TestClass10{ + void m10() { + throw new NullPointerException("m10"); + } + } + class TestClass11 extends TestClass10{ + void m11() { + + try { + (new TestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + + String tName = null; + + public Thread1filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + try { + (new TestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002.java new file mode 100644 index 00000000000..aabe8851b6b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002.java @@ -0,0 +1,538 @@ +/* + * 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.MethodExitRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodExitRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter002a"; + + private String testedClassName1 = + "nsk.jdi.MethodExitRequest.addClassExclusionFilter.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "MethodExitRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = setting23MethodExitRequest(null, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + log2("breakpointForCommunication"); + + do { + getEventSet(); + + Event event = eventIterator.nextEvent(); + if (event instanceof BreakpointEvent) + return; + + log2(" received: " + event); + + if (EventFilters.filtered(event)) { + eventSet.resume(); + } + else { + break; + } + } while (true); + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting23MethodExitRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassExclusionFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + menr.addCountFilter(1); + + log2(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..f2a8fc161af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodExit - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateMethodExit - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter002; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addClassExclusionFilter.filter002 + * nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassExclusionFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002a.java new file mode 100644 index 00000000000..4c4d4a8c3f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassExclusionFilter/filter002a.java @@ -0,0 +1,145 @@ +/* + * 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.MethodExitRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter002 JDI test. + */ + +public class filter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + +// static Thread1filter002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// thread1 = new Thread1filter002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001.java new file mode 100644 index 00000000000..59e4f1d2ff7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001.java @@ -0,0 +1,160 @@ +/* + * 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.MethodExitRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or + * any of its subtypes. + * The cases to check include entering methods in four types, + * two in super-class filter_rt001aTestClass10 and its sub-class filter_rt001aTestClass11, and + * two in super-class filter_rt001aTestClass20 and its sub-class filter_rt001aTestClass21. + * A filter used restricts events only to methods in first pair. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a thread, thread1, invoking methods + * in the super-class filter_rt001aTestClass10 and its sub-class filter_rt001aTestClass11 and + * in the super-class filter_rt001aTestClass20 and its sub-class filter_rt001aTestClass21 + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes to use to filter MethodExitEvents, + * - sets up MethodExitRequest for the events, + * - restricts the events to those in filter_rt001aTestClass11, + * - and resumes the debuggee and waits for the events. + * - The debuggee starts the thread1. + * - Upon getting the events, the debugger performs checks required. + * + * In third phase, at the end of the test, the debuggee changes + * the value of the "instruction" which the debugger and debuggee + * use to inform each other of needed actions, and both end. + */ + +public class filter_rt001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001a"; + return new filter_rt001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001aTestClass11"; + + protected void testRun() { + EventRequest eventRequest1 = null; + String property1 = "MethodExitRequest1"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = (ReferenceType) debuggee.classByName(testedClassName); + + eventRequest1 = setting21MethodExitRequest(null, testClassReference, + EventRequest.SUSPEND_NONE, property1); + + display("......waiting for MethodExitEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, false); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodExitEvent with propety 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((MethodExitEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference.name()); + } + } + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodExitRequest setting21MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001/TestDescription.java new file mode 100644 index 00000000000..1c982f9a78f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodExitRequest/addClassFilter_rt/filter_rt001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001 + * nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001a.java new file mode 100644 index 00000000000..5268ec4400a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt001a.java @@ -0,0 +1,192 @@ +/* + * 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.MethodExitRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt001 JDI test. + */ + +public class filter_rt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt001aThread1 thread1 = null; +// static Thread2filter_rt001a thread2 = null; + + static filter_rt001aTestClass10 obj10 = new filter_rt001aTestClass10(); + static filter_rt001aTestClass11 obj11 = new filter_rt001aTestClass11(); + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_rt001aThread1("thread1"); + + log1("new filter_rt001a().run1(thread1);"); + new filter_rt001a().run1(thread1); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt001aTestClass10{ + static void m10() { + filter_rt001a.log1("entered: m10()"); + } +} +class filter_rt001aTestClass11 extends filter_rt001aTestClass10{ + static void m11() { + filter_rt001a.log1("entered: m11()"); + filter_rt001aTestClass10.m10(); + } +} + +class filter_rt001aThread1 extends Thread { + + String tName = null; + + public filter_rt001aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + filter_rt001aTestClass21.m21(); + filter_rt001aTestClass11.m11(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt001aTestClass20{ + static void m20() { + filter_rt001a.log1("entered: m20()"); + } +} + +class filter_rt001aTestClass21 extends filter_rt001aTestClass20{ + static void m21() { + filter_rt001a.log1("entered: m21()"); + filter_rt001aTestClass20.m20(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002.java new file mode 100644 index 00000000000..2d66add566d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002.java @@ -0,0 +1,530 @@ +/* + * 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.MethodExitRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addClassFilter(ReferenceType)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a filter_rt002aTestClass10 object, to use as filter,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodExitRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt002a"; + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "MethodExitRequest1"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + eventRequest1 = setting21MethodExitRequest(null, testClassReference, + EventRequest.SUSPEND_NONE, property1); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" no InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting21MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002/TestDescription.java new file mode 100644 index 00000000000..f306f68a81d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodExitRequest/addClassFilter_rt/filter_rt002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt002; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addClassFilter_rt.filter_rt002 + * nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002a.java new file mode 100644 index 00000000000..8f2de3ca6c5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt002a.java @@ -0,0 +1,184 @@ +/* + * 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.MethodExitRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt002 JDI test. + */ + +public class filter_rt002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt002aThread1 thread1 = null; + + static filter_rt002aTestClass10 obj = new filter_rt002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new filter_rt002aThread1("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt002aTestClass10{ + void m10() { + throw new NullPointerException("m10"); + } +} +class filter_rt002aTestClass11 extends filter_rt002aTestClass10{ + void m11() { + + try { + (new filter_rt002aTestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } +} + +class filter_rt002aThread1 extends Thread { + + String tName = null; + + public filter_rt002aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + try { + (new filter_rt002aTestClass11()).m11(); + } catch ( NullPointerException e) { + } + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003.java new file mode 100644 index 00000000000..c9247f89651 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003.java @@ -0,0 +1,182 @@ +/* + * 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.MethodExitRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to be + * the preparation of the given reference type and any subtypes. + * The cases to test include re-invocations of the method + * addClassFilter() on the same MethodExitRequest object. + * There are two MethodExitRequests to check as follows: + * (1) For MethodExitRequest2, both invocations are with different + * ReferenceTypes restricting one MethodExit event to two classes. + * The test expects no MethodExit event will be received. + * (2) For MethodExitRequest1, both invocations are with the same + * ReferenceType restricting one MethodExit event to one class. + * The test expects this MethodExit event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, + * invoking methods correspondingly + * in the super-class filter_rt003aTestClass10 and its sub-class filter_rt003aTestClass11 and + * in the super-class filter_rt003aTestClass20 and its sub-class filter_rt003aTestClass21, + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two MethodExitRequests 1&2, + * - double restricts MethodExitRequest1 to the RefTypes 1 and 1, + * - double restricts MethodExitRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee creates and starts two threads, thread1 and thread2, + * generating the events to be filtered. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt003 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003a"; + return new filter_rt003().runThis(argv, out); + } + + private String testedClassName11 = + "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003aTestClass11"; + + private String testedClassName21 = + "nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003aTestClass21"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "MethodExitRequest1"; + String property2 = "MethodExitRequest2"; + + ReferenceType testClassReference11 = null; + ReferenceType testClassReference21 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference11 = (ReferenceType) debuggee.classByName(testedClassName11); + testClassReference21 = (ReferenceType) debuggee.classByName(testedClassName21); + + eventRequest1 = setting21MethodExitRequest(null, testClassReference11, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21MethodExitRequest(null, testClassReference11, + EventRequest.SUSPEND_ALL, property2); + + ((MethodExitRequest) eventRequest1).addClassFilter(testClassReference11); + ((MethodExitRequest) eventRequest2).addClassFilter(testClassReference21); + + display("......waiting for MethodExitEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, false); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodExitEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((MethodExitEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference11)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference11.name()); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodExitRequest setting21MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003/TestDescription.java new file mode 100644 index 00000000000..15be6901d6e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodExitRequest/addClassFilter_rt/filter_rt003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003 + * nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassFilter_rt.filter_rt003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003a.java new file mode 100644 index 00000000000..77c8e6fd1ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_rt/filter_rt003a.java @@ -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.MethodExitRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt003 JDI test. + */ + +public class filter_rt003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt003aThread1 thread1 = null; + static filter_rt003aThread2 thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + filter_rt003aTestClass11 obj1 = new filter_rt003aTestClass11(); + filter_rt003aTestClass21 obj2 = new filter_rt003aTestClass21(); + + thread1 = new filter_rt003aThread1("thread1"); + thread2 = new filter_rt003aThread2("thread2"); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + log1("new filter_rt003a().run1(thread1);"); + new filter_rt003a().run1(thread1); + + log1("new filter_rt003a().run1(thread2);"); + new filter_rt003a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + + +class filter_rt003aTestClass10{ + static void m10() { + filter_rt003a.log1("entered: m10()"); + } +} +class filter_rt003aTestClass11 extends filter_rt003aTestClass10{ + static void m11() { + filter_rt003a.log1("entered: m11()"); + filter_rt003aTestClass10.m10(); + } +} + +class filter_rt003aThread1 extends Thread { + + String tName = null; + + public filter_rt003aThread1(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + filter_rt003aTestClass11.m11(); + filter_rt003aTestClass21.m21(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt003aTestClass20{ + static void m20() { + filter_rt003a.log1("entered: m20()"); + } +} +class filter_rt003aTestClass21 extends filter_rt003aTestClass20{ + static void m21() { + filter_rt003a.log1("entered: m21()"); + filter_rt003aTestClass20.m20(); + } +} + +class filter_rt003aThread2 extends Thread { + + String tName = null; + + public filter_rt003aThread2(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + filter_rt003aTestClass21.m21(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001.java new file mode 100644 index 00000000000..a3cee6877eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001.java @@ -0,0 +1,183 @@ +/* + * 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.MethodExitRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addClassFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - sets up two MethodExitRequests, + * - restricts the Requests using patterns that begins with '*' and + * ends with *, + * - resumes the debuggee, and + * - waits for expected MethodExitEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, invoke methods used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_s001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s001a"; + return new filter_s001().runThis(argv, out); + } + + private String testedClassName1 = "TestClass11"; + private String testedClassName2 = + "nsk.jdi.MethodExitRequest.addClassFilter_s.Thread2filter_s001a"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "MethodExitRequest1"; + String property2 = "MethodExitRequest2"; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + + eventRequest1 = setting22MethodExitRequest(null, "*" + testedClassName1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for MethodExitEvent in expected class"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + String str = ((MethodExitEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(testedClassName1)) { + setFailedStatus("Received MethodExitEvent for unexpected class: \n\t" + str); + } else { + display("Received MethodExitEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + + vm.resume(); + break; + + case 1: + eventRequest2 = setting22MethodExitRequest(null, testedClassName2 + "*", + EventRequest.SUSPEND_ALL, property2); + + display("......waiting for MethodExitEvent in expected class"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + + String str = ((MethodExitEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(testedClassName2)) { + setFailedStatus("Received MethodExitEvent for unexpected class: \n\t" + str); + } else { + display("Received MethodExitEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodExitRequest setting22MethodExitRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001/TestDescription.java new file mode 100644 index 00000000000..43fc975b5d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/MethodExitRequest/addClassFilter_s/filter_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassFilter() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodExit - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s001; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s001 + * nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001a.java new file mode 100644 index 00000000000..98064792489 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s001a.java @@ -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.MethodExitRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s001 JDI test. + */ + +public class filter_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s001a thread1 = null; + static Thread2filter_s001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s001a("thread1"); + log1("new filter_s001a().run1(thread1);"); + new filter_s001a().run1(thread1); + + break; + + case 1: + thread2 = new Thread2filter_s001a("thread2"); + log1("new filter_s001a().run1(thread2);"); + new filter_s001a().run1(thread2); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class TestClass10{ + static void m10() { + filter_s001a.log1(" entered: m10()"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + filter_s001a.log1(" entered: m11()"); + TestClass10.m10(); + } +} + +class Thread1filter_s001a extends Thread { + + String tName = null; + + public Thread1filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + TestClass11.m11(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter_s001a extends Thread { + + String tName = null; + + public Thread2filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + TestClass21.m21(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } + + static class TestClass20{ + static void m20() { + filter_s001a.log1(" entered: m20()"); + } + } + static class TestClass21 extends TestClass20{ + static void m21() { + filter_s001a.log1(" entered: m21()"); + TestClass20.m20(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002.java new file mode 100644 index 00000000000..ca18acbdec8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002.java @@ -0,0 +1,525 @@ +/* + * 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.MethodExitRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addClassFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodExitRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s002a"; + + private String testedClassName1 = + "nsk.jdi.MethodExitRequest.addClassFilter_s.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "MethodExitRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + eventRequest1 = setting22MethodExitRequest(null, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting22MethodExitRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002/TestDescription.java new file mode 100644 index 00000000000..6081a9081f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002/TestDescription.java @@ -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/MethodExitRequest/addClassFilter_s/filter_s002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addClassFilter() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateMethodExit - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateMethodExit - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addClassFilter.filter_s002; + * the debuggee program - nsk.jdi.MethodExitRequest.addClassFilter.filter_s002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addClassFilter_s.filter_s002 + * nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addClassFilter_s.filter_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002a.java new file mode 100644 index 00000000000..730ffd2d567 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addClassFilter_s/filter_s002a.java @@ -0,0 +1,145 @@ +/* + * 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.MethodExitRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s002 JDI test. + */ + +public class filter_s002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + +// static Thread1filter_s002a thread1 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// thread1 = new Thread1filter_s002a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001.java new file mode 100644 index 00000000000..6cd7455ec8d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001.java @@ -0,0 +1,190 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a MethodExitRequest + * within the method in the class instancefilter001aTestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordinly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the MethodExit event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001a"; + return new instancefilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001aTestClass"; + + protected void testRun() { + + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodExitRequest1"; + String property2 = "MethodExitRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) debuggee.classByName(testedClassName); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + eventRequest1 = setting2MethodExitRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance); + + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + eventRequest2 = setting2MethodExitRequest (thread2, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + ((MethodExitRequest) eventRequest2).addInstanceFilter(instance); + + display("......waiting for MethodExitEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodExitEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001/TestDescription.java new file mode 100644 index 00000000000..7fce1e89b96 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/MethodExitRequest/addInstanceFilter/instancefilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001 + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001a.java new file mode 100644 index 00000000000..1f6fdb36c6d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter001a.java @@ -0,0 +1,195 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter001 JDI test. + */ + +public class instancefilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter001aThread thread1 = null; + static instancefilter001aThread thread2 = null; + + static instancefilter001aTestClass objTC[] = { new instancefilter001aTestClass(), new instancefilter001aTestClass(), new instancefilter001aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new instancefilter001aThread("thread1"); + thread2 = new instancefilter001aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter001aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter001aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002.java new file mode 100644 index 00000000000..2701981c4fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002.java @@ -0,0 +1,556 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a MethodExitRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter002a"; + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodExitRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodExitRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002/TestDescription.java new file mode 100644 index 00000000000..de290d9c81f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/MethodExitRequest/addInstanceFilter/instancefilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter002; + * the debuggee program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addInstanceFilter.instancefilter002 + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002a.java new file mode 100644 index 00000000000..65e0d85d8d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter002a.java @@ -0,0 +1,183 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter002 JDI test. + */ + +public class instancefilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter002aThread thread1 = null; + + static instancefilter002aTestClass objTC[] = { new instancefilter002aTestClass(), new instancefilter002aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new instancefilter002aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter002aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter002aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter002aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003.java new file mode 100644 index 00000000000..6c2ad1daf54 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003.java @@ -0,0 +1,523 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException -
    + * if the target virtual machine
    + * does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * a MethodExitRequest and if addInstanceFilter() is not supported,
    + * invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter003a"; + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodExitRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodExitRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + log2(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003/TestDescription.java new file mode 100644 index 00000000000..3508c4144db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/MethodExitRequest/addInstanceFilter/instancefilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter003; + * the debuggee program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addInstanceFilter.instancefilter003 + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003a.java new file mode 100644 index 00000000000..bf39e958e0a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter003a.java @@ -0,0 +1,183 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter003 JDI test. + */ + +public class instancefilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter003aThread thread1 = null; + + static instancefilter003aTestClass objTC[] = { new instancefilter003aTestClass(), new instancefilter003aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new instancefilter003aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter003aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter003aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter003aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004.java new file mode 100644 index 00000000000..9c2a497b1e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004.java @@ -0,0 +1,202 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same MethodExitRequest object. + * There are two BreakpointRequests to check as follows: + * (1) For MethodExitRequest2, both invocations are with different + * ObjectReferences restricting one MethodExit event to two objects. + * The test expects no MethodExit event will be received. + * (2) For MethodExitRequest1, both invocations are with the same + * ObjectReference restricting one MethodExit event to one object. + * The test expects this MethodExit event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up MethodExitRequests 1&2 within the method + * in the class TestClass which will be calling by both threads, + * - restricts the MethodExitRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the MethodExitRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004a"; + return new instancefilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004aTestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodExitRequest1"; + String property2 = "MethodExitRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2MethodExitRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2MethodExitRequest (thread2, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance1); + ((MethodExitRequest) eventRequest1).addInstanceFilter(instance1); + ((MethodExitRequest) eventRequest2).addInstanceFilter(instance1); + ((MethodExitRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for MethodExitEvent in expected thread"); + MethodExitEvent newEvent = (MethodExitEvent)eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + EventRequest newEventRequest = newEvent.request(); + if ( newEventRequest.equals(eventRequest1) ) { + display(" received expected event: " + newEvent); + + ThreadReference newEventThread = newEvent.thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004/TestDescription.java new file mode 100644 index 00000000000..31b3a5c5435 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/MethodExitRequest/addInstanceFilter/instancefilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same MethodExitRequest object. + * There are two MethodExitRequests to check as follows: + * (1) For MethodExitRequest2, both invocations are with different + * ObjectReferences restricting one MethodExit event to two objects. + * The test expects no MethodExit event will be received. + * (2) For MethodExitRequest1, both invocations are with the same + * ObjectReference restricting one MethodExit event to one object. + * The test expects this MethodExit event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004; + * the debuggee program - nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004 + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addInstanceFilter.instancefilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004a.java new file mode 100644 index 00000000000..74483c7f4ab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addInstanceFilter/instancefilter004a.java @@ -0,0 +1,194 @@ +/* + * 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.MethodExitRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter004 JDI test. + */ + +public class instancefilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static instancefilter004aThread thread1 = null; + static instancefilter004aThread thread2 = null; + + static instancefilter004aTestClass objTC[] = { new instancefilter004aTestClass(), new instancefilter004aTestClass(), new instancefilter004aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new instancefilter004aThread("thread1"); + thread2 = new instancefilter004aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class instancefilter004aThread extends Thread { + + String tName = null; + int tNumber; + + public instancefilter004aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter004aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001.java new file mode 100644 index 00000000000..84a1fac28d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001.java @@ -0,0 +1,154 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a MethodExitRequest within the method + * in the class threadfilter001aTestClass which will be calling by both threads, + * - restricts the method entry event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001a"; + return new threadfilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001aTestClass"; + + protected void testRun() { + EventRequest eventRequest1 = null; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String property1 = "MethodExitRequest1"; + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodExitRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for MethodExitEvent in tested thread"); + + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodExitEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + + } + return; + } + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + menr = eventRManager.createMethodExitRequest(); + menr.putProperty("number", property); + if (thread != null) + menr.addThreadFilter(thread); + menr.addClassFilter(testedClass); + menr.setSuspendPolicy(suspendPolicy); + + display(" a MethodExitRequest has been set up"); + return menr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001/TestDescription.java new file mode 100644 index 00000000000..9bac1b8193c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001/TestDescription.java @@ -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/MethodExitRequest/addThreadFilter/threadfilter001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001; + * the debuggee program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001 + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001a.java new file mode 100644 index 00000000000..f52c54210b3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter001a.java @@ -0,0 +1,193 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter001 JDI test. + */ + +public class threadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter001aThread thread1 = null; + static threadfilter001aThread thread2 = null; + + static threadfilter001aTestClass objTC = new threadfilter001aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new threadfilter001aThread("thread1"); + thread2 = new threadfilter001aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter001aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter001aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter001aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002.java new file mode 100644 index 00000000000..42ed26ca153 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002.java @@ -0,0 +1,538 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an MethodExitRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter002a"; + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "MethodExitRequest1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodExitRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((MethodExitRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + mexr = eventRManager.createMethodExitRequest(); + mexr.putProperty("number", property); + if (thread != null) + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + mexr.setSuspendPolicy(suspendPolicy); + + log2(" MethodExitRequest has been set up"); + return mexr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002/TestDescription.java new file mode 100644 index 00000000000..f081f9aee4a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002/TestDescription.java @@ -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/MethodExitRequest/addThreadFilter/threadfilter002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter002; + * the debuggee program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addThreadFilter.threadfilter002 + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002a.java new file mode 100644 index 00000000000..d403dc963ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter002a.java @@ -0,0 +1,184 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter002 JDI test. + */ + +public class threadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter002aThread thread1 = null; + + static threadfilter002aTestClass objTC = new threadfilter002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter002aThread("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter002aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter002aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter002aTestClass { + + static int breakpointLine = 3; + + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003.java new file mode 100644 index 00000000000..37b9c31a1eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003.java @@ -0,0 +1,544 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * MethodExitRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.MethodExitRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates MethodExitRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates MethodExitRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates MethodExitRequest3, waits the thread1 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class threadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new threadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter003a"; + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "MethodExitRequest1"; + String property2 = "MethodExitRequest2"; + String property3 = "MethodExitRequest3"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2MethodExitRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property1); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((MethodExitRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2MethodExitRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property2); + + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((MethodExitRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2MethodExitRequest (null, + testClassReference, + EventRequest.SUSPEND_NONE, property3); + + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((MethodExitRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up MethodExitRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + mexr = eventRManager.createMethodExitRequest(); + mexr.putProperty("number", property); + if (thread != null) + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + mexr.setSuspendPolicy(suspendPolicy); + + log2(" MethodExitRequest has been set up"); + return mexr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e); + log3(" MethodExitRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003/TestDescription.java new file mode 100644 index 00000000000..b054bc5b849 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/MethodExitRequest/addThreadFilter/threadfilter003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter003; + * the debuggee program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.MethodExitRequest.addThreadFilter.threadfilter003 + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003a.java new file mode 100644 index 00000000000..33ca73d6690 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter003a.java @@ -0,0 +1,187 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter003 JDI test. + */ + +public class threadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter003aThread thread1 = null; + + static threadfilter003aTestClass objTC = new threadfilter003aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new threadfilter003aThread("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class threadfilter003aThread extends Thread { + + public threadfilter003aThread(String threadName) { + super(threadName); + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class threadfilter003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004.java new file mode 100644 index 00000000000..133470ce684 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004.java @@ -0,0 +1,187 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * MethodExitRequest. + * + * The test checks that results of the method + * com.sun.jdi.MethodExitRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same MethodExitRequest object. + * There are two MethodExitRequests to check as follows: + * (1) For MethodExitRequest2, both invocations are with different + * ThreadReferences restricting one MethodExit event to two threads. + * The test expects no MethodExit event will be received. + * (2) For MethodExitRequest1, both invocations are with the same + * ThreadReference restricting one MethodExit event to one thread. + * The test expects this MethodExit event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up MethodExitRequests 1&2 within the method + * in the class threadfilter004aTestClass which will be calling by both threads, + * - restricts the MethodExitRequest1 only to thread1, + * - restricts the MethodExitRequest2 to both thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class threadfilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004a"; + return new threadfilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "MethodExitRequest1"; + String property2 = "MethodExitRequest2"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) debuggee.classByName(testedClassName); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2MethodExitRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2MethodExitRequest (thread1, + testClassReference, + EventRequest.SUSPEND_ALL, property2); + + ((MethodExitRequest) eventRequest1).addThreadFilter(thread1); + ((MethodExitRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for MethodExitEvent in tested thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof MethodExitEvent)) { + setFailedStatus("ERROR: new event is not MethodExitEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new MethodExitEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + EventRequest newEventRequest = newEvent.request(); + if (!newEventRequest.equals(eventRequest1) ) { + setFailedStatus("The MethodExitEvent occured not for eventRequest1"); + } + + ThreadReference thr = ((MethodExitEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The MethodExitEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private MethodExitRequest setting2MethodExitRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up MethodExitRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; property: " + property); + + MethodExitRequest + mexr = eventRManager.createMethodExitRequest(); + mexr.putProperty("number", property); + if (thread != null) + mexr.addThreadFilter(thread); + mexr.addClassFilter(testedClass); + mexr.setSuspendPolicy(suspendPolicy); + + display(" MethodExitRequest has been set up"); + return mexr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up MethodExitRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004/TestDescription.java new file mode 100644 index 00000000000..761b44f8d28 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/MethodExitRequest/addThreadFilter/threadfilter004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * MethodExitRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same MethodExitRequest object. + * There are two MethodExitRequests to check as follows: + * (1) For MethodExitRequest2, both invocations are with different + * ThreadReferences restricting one MethodExit event to two threads. + * The test expects no MethodExit event will be received. + * (2) For MethodExitRequest1, both invocations are with the same + * ThreadReference restricting one MethodExit event to one thread. + * The test expects this MethodExit event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004; + * the debuggee program - nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004 + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.MethodExitRequest.addThreadFilter.threadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004a.java new file mode 100644 index 00000000000..c5612ccf39d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitRequest/addThreadFilter/threadfilter004a.java @@ -0,0 +1,198 @@ +/* + * 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.MethodExitRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the threadfilter004 JDI test. + */ + +public class threadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static threadfilter004aThread thread1 = null; + static threadfilter004aThread thread2 = null; + + static threadfilter004aTestClass objTC = new threadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1 = new threadfilter004aThread("thread1"); + thread2 = new threadfilter004aThread("thread2"); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class threadfilter004aThread extends Thread { + + String tName = null; + int tNumber; + + public threadfilter004aThread(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class threadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001.java new file mode 100644 index 00000000000..332203964dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001.java @@ -0,0 +1,139 @@ +/* + * 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.Mirror.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class hashcode001 { + + //------------------------------------------------------- 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.Mirror.hashCode."; + private final static String className = "hashcode001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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() { + + display("Checking hashCode() method for Mirror object"); + + Mirror mirror = (Mirror)debuggeeClass; + int hCode = mirror.hashCode(); + + if (hCode == 0) { + complain("hashCode() returns 0 for Mirror object : " + mirror); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = mirror.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for Mirror object" + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + // get new reference to the same Mirror and get hash code. + hCode1 = ((Mirror)debuggee.classByName(debuggeeName)).hashCode(); + if (hCode != hCode1) { + complain("hashCode() does not return same value for equal Mirror object " + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns for Mirror object : " + hCode); + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..2d20b515c2d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/Mirror/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.Mirror interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during + * an execution of a Java application, the hashCode method must + * consistently return the same integer, provided no information used + * in equals comparisons on the object is modified. + * ... + * - If two objects are equal according to the equals(Object) method, + * then calling the hashCode method on each of the two objects must + * produce the same integer result. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for Mirror + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Mirror.hashCode.hashcode001 + * nsk.jdi.Mirror.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Mirror.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001a.java new file mode 100644 index 00000000000..d3589c293c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001a.java @@ -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.Mirror.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + //------------------------------------------------------ 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); + try { + pipe.println(hashcode001.SIGNAL_READY); + receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java new file mode 100644 index 00000000000..d30aa02dcc0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java @@ -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.Mirror.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Mirror.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Mirror.toString()
    + * complies with its specification.
    + *
    + * The test works as follows.
    + * A debugger, using shared classses, creates and launches
    + * a debuggee, establishes a pipe to comminicate with the it,
    + * and upon receiption a message from the debuggee, gets
    + * a ReferenceType object mirroring debuggee's class, and
    + * applies the method Mirror.toString() to the object.
    + * Then the debugger checks up that a value returned by
    + * the method is not a null-string.
    + */ + +public class tostring001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Mirror/toString/tostring001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new tostring001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Mirror.toString.tostring001a"; + + //String mName = "nsk.jdi.Mirror.toString"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" ReferenceType testClass = (ReferenceType) (vm.classesByName(debuggeeName)).get(0);"); + ReferenceType testClass = (ReferenceType) (vm.classesByName(debuggeeName)).get(0); + + log2(" String str = testClass.toString();"); + String str = testClass.toString(); + + log2(" checking up on 'str' value; null is not expected"); + if (str == null) { + log3("ERROR: str == null"); + testExitCode = FAILED; + } else { + int lenght = str.length(); + log2(" str.length() == " + lenght); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..ea492190ca0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/Mirror/toString/tostring001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Mirror. + * The test checks up that a result of the method + * com.sun.jdi.Mirror.toString() + * complies with its spec: + * public java.lang.String toString() + * Returns a String describing this mirror + * Returns: a string describing this mirror. + * Overrides: toString in class java.lang.Object + * The test works as follows: + * The debugger program - nsk.jdi.Mirror.toString.tostring001; + * the debuggee program - nsk.jdi.Mirror.toString.tostring001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Mirror.toString.tostring001 + * nsk.jdi.Mirror.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Mirror.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001a.java new file mode 100644 index 00000000000..e6d42829fd2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001a.java @@ -0,0 +1,112 @@ +/* + * 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.Mirror.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the tostring001 JDI test. + */ + +public class tostring001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> tostring001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> tostring001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Mirror.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Mirror.virtualMachine()
    + * complies with its specification.
    + *
    + * The test works as follows.
    + * A debugger, using shared classses, creates and launches
    + * a debuggee, establishes a pipe to comminicate with the it,
    + * and upon receiption a message from the debuggee, gets
    + * a ReferenceType object mirroring debuggee's class, and
    + * applies the method Mirror.virtualMachine() to the object.
    + * Then the debugger checks up that a value returned by
    + * the method is not a null-string.
    + */ + +public class virtualmachine001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Mirror/virtualMachine/virtualmachine001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new virtualmachine001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Mirror.virtualMachine.virtualmachine001a"; + + //String mName = "nsk.jdi.Mirror.virtualMachine"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" ReferenceType testClass = (ReferenceType) (vm.classesByName(debuggeeName)).get(0);"); + ReferenceType testClass = (ReferenceType) (vm.classesByName(debuggeeName)).get(0); + + log2(" VirtualMachine vm1 = testClass.virtualMachine();"); + VirtualMachine vm1 = testClass.virtualMachine(); + + log2(" checking up on 'vm1' value; null is not expected"); + if (vm1 == null) { + log3("ERROR: vm1 == null"); + testExitCode = FAILED; + } else { + log2(" checking up equality of vm1 and vm; must be equal"); + if (!vm.equals(vm1)) { + log3("ERROR: !vm.equals(vm1)"); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001/TestDescription.java new file mode 100644 index 00000000000..5f61e97c8e9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/Mirror/virtualMachine/virtualmachine001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Mirror. + * The test checks up that a result of the method + * com.sun.jdi.Mirror.virtualMachine() + * complies with its spec: + * public VirtualMachine virtualMachine() + * Gets the VirtualMachine to which this Mirror belongs. + * A Mirror must be associated with a VirtualMachine to have any meaning. + * Returns: the VirtualMachine for which this mirror is a proxy. + * The test works as follows: + * The debugger program - nsk.jdi.Mirror.virtualMachine.virtualmachine001; + * the debuggee program - nsk.jdi.Mirror.virtualMachine.virtualmachine001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Mirror.virtualMachine.virtualmachine001 + * nsk.jdi.Mirror.virtualMachine.virtualmachine001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Mirror.virtualMachine.virtualmachine001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001a.java new file mode 100644 index 00000000000..25003a56967 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001a.java @@ -0,0 +1,112 @@ +/* + * 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.Mirror.virtualMachine; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the virtualmachine001 JDI test. + */ + +public class virtualmachine001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> virtualmachine001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> virtualmachine001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ModificationWatchpointEvent.
    + *
    + * The test checks that results of methods in the interface
    + * com.sun.jdi.ModificationWatchpointEvent
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * The number of ModificationWatchpointEvents received is
    + * equal to the number of ModificationWatchpointRequests
    + * set up by a debugger.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates an object foo of CheckedClass and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger:
    + * - set up enabled ModificationWatchpointRequests for all fields,
    + * - resumes the debuggee, and
    + * - waiting for all expected events to receive.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class mwevent001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new mwevent001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ModificationWatchpointEvent._itself_.mwevent001a"; + + private String testedClassName = + "nsk.jdi.ModificationWatchpointEvent._itself_.CheckedClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldModification() ) { + log2("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + ReferenceType refType = null; + List fields = null; + ListIterator li = null; + Field field = null; + + ModificationWatchpointRequest mwRequest = null; + + int requestsCount = 0; + int mwEventsCount = 0; + + + vm.resume(); // !!!!! + for (int i = 0; ; i++) { + + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + refType = (ReferenceType) vm.classesByName(testedClassName).get(0); + fields = refType.fields(); + li = fields.listIterator(); + + log2("......setting up ModificationWatchpointRequests"); + while (li.hasNext()) { + field = (Field) li.next(); + mwRequest = eventRManager.createModificationWatchpointRequest(field); + mwRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE); + mwRequest.enable(); + requestsCount++; + } + log2(" # mwRequests set up : " + requestsCount); + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ModificationWatchpointEvents"); + while ( mwEventsCount < requestsCount ) { + getEventSet(); + Event newEvent = eventIterator.nextEvent(); + if ( !( newEvent instanceof ModificationWatchpointEvent)) { + testExitCode = FAILED; + log3("ERROR: new event is not ModificationWatchpointEvent"); + break; + } + mwEventsCount++; + } + log2(" # mwEventsCount == " + mwEventsCount); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001/TestDescription.java new file mode 100644 index 00000000000..4e27dd7c028 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001/TestDescription.java @@ -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/ModificationWatchpointEvent/_itself_/mwevent001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ModificationWatchpointEvent. + * The test checks up on the following assertion: + * The number of ModificationWatchpointEvents received is equal to + * the number of ModificationWatchpointRequests set up by a debugger. + * The test works as follows: + * The debugger program - nsk.jdi.ModificationWatchpointEvent._itself_.mwevent001; + * the debuggee program - nsk.jdi.ModificationWatchpointEvent._itself_.mwevent001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * class CheckedClass being used in the debuggee + * has been taken from the test + * nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001 + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ModificationWatchpointEvent._itself_.mwevent001 + * nsk.jdi.ModificationWatchpointEvent._itself_.mwevent001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ModificationWatchpointEvent._itself_.mwevent001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001a.java new file mode 100644 index 00000000000..acd9d43ee0c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/_itself_/mwevent001a.java @@ -0,0 +1,307 @@ +/* + * 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.ModificationWatchpointEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the mwevent001 JDI test. + */ + +public class mwevent001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + CheckedClass foo = new CheckedClass(); + foo.init(); + methodForCommunication(); + foo.run(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +// class for checking +class CheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + class Class implements Inter {} + Class X0, X1[], X2[][]; + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + // initializa fields values + void init() { + z0 = false; + b0 = java.lang.Byte.MIN_VALUE; + c0 = java.lang.Character.MIN_VALUE; + d0 = java.lang.Double.MIN_VALUE; + f0 = java.lang.Float.MIN_VALUE; + i0 = java.lang.Integer.MIN_VALUE; + l0 = java.lang.Long.MIN_VALUE; + s0 = java.lang.Short.MIN_VALUE; + + initFields(); + } + + // change fields values + void run() { + z0 = true; + b0 = java.lang.Byte.MAX_VALUE; + c0 = java.lang.Character.MAX_VALUE; + d0 = java.lang.Double.MAX_VALUE; + f0 = java.lang.Float.MAX_VALUE; + i0 = java.lang.Integer.MAX_VALUE; + l0 = java.lang.Long.MAX_VALUE; + s0 = java.lang.Short.MAX_VALUE; + + initFields(); + } + + // calculate new fields values + void initFields() { + + z1 = new boolean[] {z0}; + z2 = new boolean[][] {z1}; + b1 = new byte[] {b0}; + b2 = new byte[][] {b1}; + c1 = new char[] {c0}; + c2 = new char[][] {c1}; + d1 = new double[] {d0}; + d2 = new double[][] {d1}; + f1 = new float[] {f0}; + f2 = new float[][] {f1}; + i1 = new int[] {i0}; + i2 = new int[][] {i1}; + l1 = new long[] {l0}; + l2 = new long[][] {l1}; + s1 = new short[] {s0}; + s2 = new short[][] {s1}; + + lS0 = l0; + lP0 = l0; + lU0 = l0; + lR0 = l0; + lT0 = l0; + lV0 = l0; + + lS1 = new long[] {lS0}; + lS2 = new long[][] {lS1}; + lP1 = new long[] {lP0}; + lP2 = new long[][] {lP1}; + lU1 = new long[] {lU0}; + lU2 = new long[][] {lU1}; + lR1 = new long[] {lR0}; + lR2 = new long[][] {lR1}; + lT1 = new long[] {lT0}; + lT2 = new long[][] {lT1}; + lV1 = new long[] {lV0}; + lV2 = new long[][] {lV1}; + + X0 = new Class(); + X1 = new Class[] {X0}; + X2 = new Class[][] {X1}; + Z0 = new Boolean(true); + Z1 = new Boolean[] {Z0}; + Z2 = new Boolean[][] {Z1}; + B0 = new Byte(java.lang.Byte.MIN_VALUE); + B1 = new Byte[] {B0}; + B2 = new Byte[][] {B1}; + C0 = new Character(java.lang.Character.MIN_VALUE); + C1 = new Character[] {C0}; + C2 = new Character[][]{C1}; + D0 = new Double(java.lang.Double.MIN_VALUE); + D1 = new Double[] {D0}; + D2 = new Double[][] {D1}; + F0 = new Float(java.lang.Float.MIN_VALUE); + F1 = new Float[] {F0}; + F2 = new Float[][] {F1}; + I0 = new Integer(java.lang.Integer.MIN_VALUE); + I1 = new Integer[] {I0}; + I2 = new Integer[][] {I1}; + L0 = new Long(java.lang.Long.MIN_VALUE); + L1 = new Long[] {L0}; + L2 = new Long[][] {L1}; + S0 = new Short(java.lang.Short.MIN_VALUE); + S1 = new Short[] {S0}; + S2 = new Short[][] {S1}; + W0 = new String(); + W1 = new String[] {W0}; + W2 = new String[][] {W1}; + O0 = new Object(); + O1 = new Object[] {O0}; + O2 = new Object[][] {O1}; + + LS0 = new Long(java.lang.Long.MAX_VALUE); + LS1 = new Long[] {LS0}; + LS2 = new Long[][] {LS1}; + LP0 = new Long(java.lang.Long.MAX_VALUE); + LP1 = new Long[] {LP0}; + LP2 = new Long[][] {LP1}; + LU0 = new Long(java.lang.Long.MAX_VALUE); + LU1 = new Long[] {LU0}; + LU2 = new Long[][] {LU1}; + LR0 = new Long(java.lang.Long.MAX_VALUE); + LR1 = new Long[] {LR0}; + LR2 = new Long[][] {LR1}; + LT0 = new Long(java.lang.Long.MAX_VALUE); + LT1 = new Long[] {LT0}; + LT2 = new Long[][] {LT1}; + LV0 = new Long(java.lang.Long.MAX_VALUE); + LV1 = new Long[] {LV0}; + LV2 = new Long[][] {LV1}; + + E0 = new Class(); + E1 = new Inter[] {E0}; + E2 = new Inter[][] {E1}; + ES0 = new Class(); + ES1 = new Inter[] {ES0}; + ES2 = new Inter[][] {ES1}; + EP0 = new Class(); + EP1 = new Inter[] {EP0}; + EP2 = new Inter[][] {EP1}; + EU0 = new Class(); + EU1 = new Inter[] {EU0}; + EU2 = new Inter[][] {EU1}; + ER0 = new Class(); + ER1 = new Inter[] {ER0}; + ER2 = new Inter[][] {ER1}; + ET0 = new Class(); + ET1 = new Inter[] {ET0}; + ET2 = new Inter[][] {ET1}; + EV0 = new Class(); + EV1 = new Inter[] {EV0}; + EV2 = new Inter[][] {EV1}; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001.java new file mode 100644 index 00000000000..0fe8b7904bf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001.java @@ -0,0 +1,279 @@ +/* + * 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.ModificationWatchpointEvent.valueToBe; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class valuetobe001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String DEBUGEE_NAME = "nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001a"; + static final String CHECKED_CLASS_NAME = "nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001aCheckedClass"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ReferenceType rType; + static private ModificationWatchpointRequest wpRequest; + static private List fieldsList; + + static private volatile boolean testFailed; + static private volatile boolean done; + static private volatile int requestsCount, mwpEventsCount; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + requestsCount = 0; + mwpEventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGEE_NAME); + debuggee.redirectStderr(log, "valuetobe001a >"); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // check for debuggee's capabilities + if (!debuggee.VM().canWatchFieldModification()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field modification"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return PASSED; + } + + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors + if ((rType = debuggee.classByName(CHECKED_CLASS_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + CHECKED_CLASS_NAME); + } + + // create events requests + log.display("Creating requests for WatchpointEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + Iterator fieldsIter; + try { + fieldsList = rType.fields(); + fieldsIter = fieldsList.iterator(); + } catch (ClassNotPreparedException e) { + throw new Failure( "TEST_BUG: " + rType.name() + " is not prepared"); + } + while (fieldsIter.hasNext()) { + Field refField = (Field)fieldsIter.next(); + if ((wpRequest = erManager.createModificationWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create ModificationWatchpointRequest"); + } else { + log.display("ModificationWatchpointRequest for field " + refField.name() + " created"); + wpRequest.enable(); + } + requestsCount++; + } + log.display("Created total " + requestsCount + " ModificationWatchpointRequests"); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + // handle events until all events generated and received + while ( mwpEventsCount != requestsCount ) { + eventSet = null; + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + + if (eventSet == null) + continue; + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // handle ModificationWatchpointEvent + if (event instanceof ModificationWatchpointEvent) { + mwpEventsCount++; + ModificationWatchpointEvent castedEvent = (ModificationWatchpointEvent)event; + Value evValue = castedEvent.valueToBe(); + Field evField = castedEvent.field(); + log.display("ModificationWatchpointEvent received for " + evField.name()); + if (evValue == null) { + log.complain("FAILURE 1: ModificationWatchpointEvent.valueToBe() returns null for " + evField.name()); + testFailed = true; + } else { + int ind = fieldsList.indexOf(evField); + if (ind == -1) { + log.complain("FAILURE 2: ModificationWatchpoint.field() returns unknown field"); + testFailed = true; + } else { + Value valueNew = castedEvent.valueToBe(); + Value valueNew1= castedEvent.valueToBe(); + + if (!valueNew.equals(valueNew1)) { + log.complain("FAILURE 3: method valueToBe() returns inconsistent results for " + + evField.name() + "\nvalueNew: " + valueNew + " ; valueNew1: " + valueNew1); + testFailed = true; + } + + Value valueFld = castedEvent.valueCurrent(); + + if (valueFld.equals(valueNew)) { + log.complain("FAILURE 4: method valueToBe() returns incorrect equal value for " + + evField.name() + "\nvaluetoBe(): " + valueNew + " ; valueCurrent(): " + valueFld); + testFailed = true; + } else { + log.display(evField.name() + " is assigned to " + castedEvent.valueToBe().toString()); + } + } + } + } + } + // resume each handled event set + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for confirmation from debugee + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command == null || !command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // notify EventHandler that all events generated + done = true; + + // wait for all expected events received + log.display("Waiting for all expected events received"); + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001/TestDescription.java new file mode 100644 index 00000000000..389f9c07069 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises the + * com.sun.jdi.event.ModificationWatchpointEvent.valueToBe() method. + * The test checks the following assertion: + * If any field of loaded class of target VM is assigned to new value + * which is not equal to previous value, then Value reference + * returned by ModificationWatchpointEvent.valueToBe() is not equal + * to one returned by Watchpoint.valueCurrent(). + * A debugger class - nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001 ; + * a debuggee class - nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates ModificationWatchpointRequests to the fields defined + * in debuggee class. + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee initializes its + * fields and sends command . + * The debugger switches to to listen the event during the + * time specified by parameter. Then debugger shuts down debuggee + * by command. + * If debugger receives ModificationWatchpointEvent, it compares old and new + * values of field referenced in the event. The test fails if any of this + * these values are equal. + * The test also fails if no ModificationWatchpointEvent was received. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * ---------- + * I. To fix the bug 4505870, the following is done in file valuetobe001a.java: + * - assignments values to the fields lS0, lP0, lU0, lR0, lT0, and lV0 + * are added (new lines 164-169). + * II. Several improvments: + * debugger: + * - line 129: check value is in requestsCount; + * - old line 39 removed; + * - check for all expected events received (lines 233-248) removed. + * debuggee: + * - line 25 removed. + * ---------- + * Standard method Debugee.endDebugee() is used instead of cleaning event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001 + * nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001a.java new file mode 100644 index 00000000000..507bc3ab934 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe001a.java @@ -0,0 +1,279 @@ +/* + * 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.ModificationWatchpointEvent.valueToBe; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class valuetobe001a { + + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + + public static void main(String args[]) { + System.exit(JCK_STATUS_BASE + run(args)); + } + + static int run( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // create instance of checked class + valuetobe001aCheckedClass foo = new valuetobe001aCheckedClass(); + // initialize fields values + foo.init(); + + // notify debugger that debuggee started + pipe.println(COMMAND_READY); + + // wait for command GO from debugger + String command = pipe.readln(); + if (command.equals(COMMAND_QUIT)) { + return PASSED; + } + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + + // perform actions + foo.run(); + + // notify debugger that the command done + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} + +// class for checking +class valuetobe001aCheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + class Class implements Inter {} + Class X0, X1[], X2[][]; + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + // initializa fields values + void init() { + z0 = false; + b0 = java.lang.Byte.MIN_VALUE; + c0 = java.lang.Character.MIN_VALUE; + d0 = java.lang.Double.MIN_VALUE; + f0 = java.lang.Float.MIN_VALUE; + i0 = java.lang.Integer.MIN_VALUE; + l0 = java.lang.Long.MIN_VALUE; + s0 = java.lang.Short.MIN_VALUE; + + initFields(); + } + + // change fields values + void run() { + z0 = true; + b0 = java.lang.Byte.MAX_VALUE; + c0 = java.lang.Character.MAX_VALUE; + d0 = java.lang.Double.MAX_VALUE; + f0 = java.lang.Float.MAX_VALUE; + i0 = java.lang.Integer.MAX_VALUE; + l0 = java.lang.Long.MAX_VALUE; + s0 = java.lang.Short.MAX_VALUE; + + initFields(); + } + + // calculate new fields values + void initFields() { + + z1 = new boolean[] {z0}; + z2 = new boolean[][] {z1}; + b1 = new byte[] {b0}; + b2 = new byte[][] {b1}; + c1 = new char[] {c0}; + c2 = new char[][] {c1}; + d1 = new double[] {d0}; + d2 = new double[][] {d1}; + f1 = new float[] {f0}; + f2 = new float[][] {f1}; + i1 = new int[] {i0}; + i2 = new int[][] {i1}; + l1 = new long[] {l0}; + l2 = new long[][] {l1}; + s1 = new short[] {s0}; + s2 = new short[][] {s1}; + + lS0 = l0; + lP0 = l0; + lU0 = l0; + lR0 = l0; + lT0 = l0; + lV0 = l0; + + lS1 = new long[] {lS0}; + lS2 = new long[][] {lS1}; + lP1 = new long[] {lP0}; + lP2 = new long[][] {lP1}; + lU1 = new long[] {lU0}; + lU2 = new long[][] {lU1}; + lR1 = new long[] {lR0}; + lR2 = new long[][] {lR1}; + lT1 = new long[] {lT0}; + lT2 = new long[][] {lT1}; + lV1 = new long[] {lV0}; + lV2 = new long[][] {lV1}; + + X0 = new Class(); + X1 = new Class[] {X0}; + X2 = new Class[][] {X1}; + Z0 = new Boolean(true); + Z1 = new Boolean[] {Z0}; + Z2 = new Boolean[][] {Z1}; + B0 = new Byte(java.lang.Byte.MIN_VALUE); + B1 = new Byte[] {B0}; + B2 = new Byte[][] {B1}; + C0 = new Character(java.lang.Character.MIN_VALUE); + C1 = new Character[] {C0}; + C2 = new Character[][]{C1}; + D0 = new Double(java.lang.Double.MIN_VALUE); + D1 = new Double[] {D0}; + D2 = new Double[][] {D1}; + F0 = new Float(java.lang.Float.MIN_VALUE); + F1 = new Float[] {F0}; + F2 = new Float[][] {F1}; + I0 = new Integer(java.lang.Integer.MIN_VALUE); + I1 = new Integer[] {I0}; + I2 = new Integer[][] {I1}; + L0 = new Long(java.lang.Long.MIN_VALUE); + L1 = new Long[] {L0}; + L2 = new Long[][] {L1}; + S0 = new Short(java.lang.Short.MIN_VALUE); + S1 = new Short[] {S0}; + S2 = new Short[][] {S1}; + W0 = new String(); + W1 = new String[] {W0}; + W2 = new String[][] {W1}; + O0 = new Object(); + O1 = new Object[] {O0}; + O2 = new Object[][] {O1}; + + LS0 = new Long(java.lang.Long.MAX_VALUE); + LS1 = new Long[] {LS0}; + LS2 = new Long[][] {LS1}; + LP0 = new Long(java.lang.Long.MAX_VALUE); + LP1 = new Long[] {LP0}; + LP2 = new Long[][] {LP1}; + LU0 = new Long(java.lang.Long.MAX_VALUE); + LU1 = new Long[] {LU0}; + LU2 = new Long[][] {LU1}; + LR0 = new Long(java.lang.Long.MAX_VALUE); + LR1 = new Long[] {LR0}; + LR2 = new Long[][] {LR1}; + LT0 = new Long(java.lang.Long.MAX_VALUE); + LT1 = new Long[] {LT0}; + LT2 = new Long[][] {LT1}; + LV0 = new Long(java.lang.Long.MAX_VALUE); + LV1 = new Long[] {LV0}; + LV2 = new Long[][] {LV1}; + + E0 = new Class(); + E1 = new Inter[] {E0}; + E2 = new Inter[][] {E1}; + ES0 = new Class(); + ES1 = new Inter[] {ES0}; + ES2 = new Inter[][] {ES1}; + EP0 = new Class(); + EP1 = new Inter[] {EP0}; + EP2 = new Inter[][] {EP1}; + EU0 = new Class(); + EU1 = new Inter[] {EU0}; + EU2 = new Inter[][] {EU1}; + ER0 = new Class(); + ER1 = new Inter[] {ER0}; + ER2 = new Inter[][] {ER1}; + ET0 = new Class(); + ET1 = new Inter[] {ET0}; + ET2 = new Inter[][] {ET1}; + EV0 = new Class(); + EV1 = new Inter[] {EV0}; + EV2 = new Inter[][] {EV1}; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002.java new file mode 100644 index 00000000000..230277030c5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002.java @@ -0,0 +1,279 @@ +/* + * 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.ModificationWatchpointEvent.valueToBe; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class valuetobe002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String DEBUGEE_NAME = "nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe002a"; + static final String CHECKED_CLASS_NAME = "nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe002aCheckedClass"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ReferenceType rType; + static private ModificationWatchpointRequest wpRequest; + static private List fieldsList; + + static private volatile boolean testFailed; + static private volatile boolean done; + static private volatile int requestsCount, mwpEventsCount; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + requestsCount = 0; + mwpEventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGEE_NAME); + debuggee.redirectStderr(log, "valuetobe001a >"); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // check for debuggee's capabilities + if (!debuggee.VM().canWatchFieldModification()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field modification"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return PASSED; + } + + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors + if ((rType = debuggee.classByName(CHECKED_CLASS_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + CHECKED_CLASS_NAME); + } + + // create events requests + log.display("Creating requests for WatchpointEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + Iterator fieldsIter; + try { + fieldsList = rType.fields(); + fieldsIter = fieldsList.iterator(); + } catch (ClassNotPreparedException e) { + throw new Failure( "TEST_BUG: " + rType.name() + " is not prepared"); + } + while (fieldsIter.hasNext()) { + Field refField = (Field)fieldsIter.next(); + if ((wpRequest = erManager.createModificationWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create ModificationWatchpointRequest"); + } else { + log.display("ModificationWatchpointRequest for field " + refField.name() + " created"); + wpRequest.enable(); + } + requestsCount++; + } + log.display("Created total " + requestsCount + " ModificationWatchpointRequests"); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + // handle events until all events generated and received + while (mwpEventsCount < requestsCount) { + eventSet = null; + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + + if (eventSet == null) + continue; + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // handle ModificationWatchpointEvent + if (event instanceof ModificationWatchpointEvent) { + mwpEventsCount++; + ModificationWatchpointEvent castedEvent = (ModificationWatchpointEvent)event; + Value evValue = castedEvent.valueToBe(); + Field evField = castedEvent.field(); + log.display("ModificationWatchpointEvent received for " + evField.name()); + if (evValue == null) { + log.complain("FAILURE 3: ModificationWatchpointEvent.valueToBe() returns null for " + evField.name()); + testFailed = true; + } else { + int ind = fieldsList.indexOf(evField); + if (ind == -1) { + log.complain("FAILURE 2: ModificationWatchpoint.field() returns unknown field"); + testFailed = true; + } else { + Value valueNew = castedEvent.valueToBe(); + Value valueNew1= castedEvent.valueToBe(); + + if (!valueNew.equals(valueNew1)) { + log.complain("FAILURE 3: method valueToBe() returns inconsistent results for " + + evField.name() + "\nvalueNew: " + valueNew + " ; valueNew1: " + valueNew1); + testFailed = true; + } + + Value valueFld = castedEvent.valueCurrent(); + + if (!valueFld.equals(valueNew)) { + log.complain("FAILURE 4: method valueToBe() returns incorrect equal value for " + + evField.name() + "\nvaluetoBe(): " + valueNew + " ; valueCurrent(): " + valueFld); + testFailed = true; + } else { + log.display(evField.name() + " is assigned to " + castedEvent.valueToBe().toString()); + } + } + } + } + } + // resume each handled event set + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for confirmation from debugee + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command == null || !command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // notify EventHandler that all events generated + done = true; + + // wait for all expected events received + log.display("Waiting for all expected events received"); + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002/TestDescription.java new file mode 100644 index 00000000000..f014d42c4fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.ModificationWatchpointEvent.valueToBe() method. + * The test checks the following assertion: + * If any field of loaded class of target VM is assigned to new value + * which is equal to previous value, then Value reference returned + * by ModificationWatchpointEvent.valueToBe() is equal to one + * returned by Watchpoint.valueCurrent(). + * A debugger class - nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001 ; + * a debuggee class - nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates ModificationWatchpointRequests to the fields defined + * in debuggee class. + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee assignes every field + * to itself (i.e. the old and new values of the field are equal) and sends + * command . + * The debugger switches to to listen the event during the + * time specified by parameter. Then debugger shuts down debuggee + * by command. + * If debugger receives ModificationWatchpointEvent, it compares old and new + * values of field referenced in the event. The test fails if any of this + * these values are not equal. The test also fails if no + * ModificationWatchpointEvent was received. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * ---------- + * I. To fix the bug 4505870, the following is done in file valuetobe001a.java: + * - assignments values to the fields lS0, lP0, lU0, lR0, lT0, and lV0 + * are added (new lines 153-158). + * II. Several improvments: + * debugger: + * - line 129: check value is in requestsCount; + * - old line 37 removed; + * - check for all expected events received (lines 233-248) removed. + * debuggee: + * - line 25 removed. + * ---------- + * Standard method Debugee.endDebugee() is used instead of cleaning event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe002 + * nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ModificationWatchpointEvent.valueToBe.valuetobe002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002a.java new file mode 100644 index 00000000000..78fdd9a550e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ModificationWatchpointEvent/valueToBe/valuetobe002a.java @@ -0,0 +1,268 @@ +/* + * 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.ModificationWatchpointEvent.valueToBe; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class valuetobe002a { + + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + public static void main(String args[]) { + System.exit(JCK_STATUS_BASE + run(args)); + } + + static int run( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // create instance of checked class + valuetobe002aCheckedClass foo = new valuetobe002aCheckedClass(); + // initialize fields values + foo.init(); + + // notify debugger that debuggee started + pipe.println(COMMAND_READY); + + // wait for command GO from debugger + String command = pipe.readln(); + if (command.equals(COMMAND_QUIT)) { + return PASSED; + } + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + + // perform actions + foo.run(); + + // notify debugger that the command done + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} + +// class for checking +class valuetobe002aCheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + class Class implements Inter {} + Class X0, X1[], X2[][]; + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + // initialize fields values + void init() { + initFields(false); + } + + // change fields values + void run() { + initFields(true); + } + + // calculate new fields values + void initFields(boolean flag) { + z0 = true; + b0 = java.lang.Byte.MAX_VALUE; + c0 = java.lang.Character.MAX_VALUE; + d0 = java.lang.Double.MAX_VALUE; + f0 = java.lang.Float.MAX_VALUE; + i0 = java.lang.Integer.MAX_VALUE; + l0 = java.lang.Long.MAX_VALUE; + s0 = java.lang.Short.MAX_VALUE; + + z1 = flag ? z1 : new boolean[] {z0}; + z2 = flag ? z2 : new boolean[][] {z1}; + b1 = flag ? b1 : new byte[] {b0}; + b2 = flag ? b2 : new byte[][] {b1}; + c1 = flag ? c1 : new char[] {c0}; + c2 = flag ? c2 : new char[][] {c1}; + d1 = flag ? d1 : new double[] {d0}; + d2 = flag ? d2 : new double[][] {d1}; + f1 = flag ? f1 : new float[] {f0}; + f2 = flag ? f2 : new float[][] {f1}; + i1 = flag ? i1 : new int[] {i0}; + i2 = flag ? i2 : new int[][] {i1}; + l1 = flag ? l1 : new long[] {l0}; + l2 = flag ? l2 : new long[][] {l1}; + s1 = flag ? s1 : new short[] {s0}; + s2 = flag ? s2 : new short[][] {s1}; + + lS0 = l0; + lP0 = l0; + lU0 = l0; + lR0 = l0; + lT0 = l0; + lV0 = l0; + + lS1 = flag ? lS1 : new long[] {lS0}; + lS2 = flag ? lS2 : new long[][] {lS1}; + lP1 = flag ? lP1 : new long[] {lP0}; + lP2 = flag ? lP2 : new long[][] {lP1}; + lU1 = flag ? lU1 : new long[] {lU0}; + lU2 = flag ? lU2 : new long[][] {lU1}; + lR1 = flag ? lR1 : new long[] {lR0}; + lR2 = flag ? lR2 : new long[][] {lR1}; + lT1 = flag ? lT1 : new long[] {lT0}; + lT2 = flag ? lT2 : new long[][] {lT1}; + lV1 = flag ? lV1 : new long[] {lV0}; + lV2 = flag ? lV2 : new long[][] {lV1}; + + X0 = flag ? X0 : new Class(); + X1 = flag ? X1 : new Class[] {X0}; + X2 = flag ? X2 : new Class[][] {X1}; + Z0 = flag ? Z0 : new Boolean(true); + Z1 = flag ? Z1 : new Boolean[] {Z0}; + Z2 = flag ? Z2 : new Boolean[][] {Z1}; + B0 = flag ? B0 : new Byte(java.lang.Byte.MIN_VALUE); + B1 = flag ? B1 : new Byte[] {B0}; + B2 = flag ? B2 : new Byte[][] {B1}; + C0 = flag ? C0 : new Character(java.lang.Character.MIN_VALUE); + C1 = flag ? C1 : new Character[] {C0}; + C2 = flag ? C2 : new Character[][]{C1}; + D0 = flag ? D0 : new Double(java.lang.Double.MIN_VALUE); + D1 = flag ? D1 : new Double[] {D0}; + D2 = flag ? D2 : new Double[][] {D1}; + F0 = flag ? F0 : new Float(java.lang.Float.MIN_VALUE); + F1 = flag ? F1 : new Float[] {F0}; + F2 = flag ? F2 : new Float[][] {F1}; + I0 = flag ? I0 : new Integer(java.lang.Integer.MIN_VALUE); + I1 = flag ? I1 : new Integer[] {I0}; + I2 = flag ? I2 : new Integer[][] {I1}; + L0 = flag ? L0 : new Long(java.lang.Long.MIN_VALUE); + L1 = flag ? L1 : new Long[] {L0}; + L2 = flag ? L2 : new Long[][] {L1}; + S0 = flag ? S0 : new Short(java.lang.Short.MIN_VALUE); + S1 = flag ? S1 : new Short[] {S0}; + S2 = flag ? S2 : new Short[][] {S1}; + W0 = flag ? W0 : new String(); + W1 = flag ? W1 : new String[] {W0}; + W2 = flag ? W2 : new String[][] {W1}; + O0 = flag ? O0 : new Object(); + O1 = flag ? O1 : new Object[] {O0}; + O2 = flag ? O2 : new Object[][] {O1}; + + LS0 = flag ? LS0 : new Long(java.lang.Long.MAX_VALUE); + LS1 = flag ? LS1 : new Long[] {LS0}; + LS2 = flag ? LS2 : new Long[][] {LS1}; + LP0 = flag ? LP0 : new Long(java.lang.Long.MAX_VALUE); + LP1 = flag ? LP1 : new Long[] {LP0}; + LP2 = flag ? LP2 : new Long[][] {LP1}; + LU0 = flag ? LU0 : new Long(java.lang.Long.MAX_VALUE); + LU1 = flag ? LU1 : new Long[] {LU0}; + LU2 = flag ? LU2 : new Long[][] {LU1}; + LR0 = flag ? LR0 : new Long(java.lang.Long.MAX_VALUE); + LR1 = flag ? LR1 : new Long[] {LR0}; + LR2 = flag ? LR2 : new Long[][] {LR1}; + LT0 = flag ? LT0 : new Long(java.lang.Long.MAX_VALUE); + LT1 = flag ? LT1 : new Long[] {LT0}; + LT2 = flag ? LT2 : new Long[][] {LT1}; + LV0 = flag ? LV0 : new Long(java.lang.Long.MAX_VALUE); + LV1 = flag ? LV1 : new Long[] {LV0}; + LV2 = flag ? LV2 : new Long[][] {LV1}; + + E0 = flag ? E0 : new Class(); + E1 = flag ? E1 : new Inter[] {E0}; + E2 = flag ? E2 : new Inter[][] {E1}; + ES0 = flag ? ES0 : new Class(); + ES1 = flag ? ES1 : new Inter[] {ES0}; + ES2 = flag ? ES2 : new Inter[][] {ES1}; + EP0 = flag ? EP0 : new Class(); + EP1 = flag ? EP1 : new Inter[] {EP0}; + EP2 = flag ? EP2 : new Inter[][] {EP1}; + EU0 = flag ? EU0 : new Class(); + EU1 = flag ? EU1 : new Inter[] {EU0}; + EU2 = flag ? EU2 : new Inter[][] {EU1}; + ER0 = flag ? ER0 : new Class(); + ER1 = flag ? ER1 : new Inter[] {ER0}; + ER2 = flag ? ER2 : new Inter[][] {ER1}; + ET0 = flag ? ET0 : new Class(); + ET1 = flag ? ET1 : new Inter[] {ET0}; + ET2 = flag ? ET2 : new Inter[][] {ET1}; + EV0 = flag ? EV0 : new Class(); + EV1 = flag ? EV1 : new Inter[] {EV0}; + EV2 = flag ? EV2 : new Inter[][] {EV1}; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest001/TestDescription.java new file mode 100644 index 00000000000..cf11d277c63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest001. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorContendedEnterRequest and MonitorContendedEnterEvent, debugger force + * debuggee generate several thousands of MonitorContendedEnteredEvents and check that all events was received and contains + * correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 250 and threadsNumber to 1, but because of framework design each requested event should + * be generated in 3 different way(through synchronized block, synchronized method and JNI MonitorEnter) and + * by 3 different threads, so actual number of generated events is (eventsNumber * 9), and actual number of threads generating + * events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventTypes MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 100 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest002/TestDescription.java new file mode 100644 index 00000000000..4f83a7a988c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/MonitorContendedEnterRequest002. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorContendedEnterRequest and MonitorContendedEnterEvent, debugger force + * debuggee start several threads which simultaneously generate MonitorContendedEnteredEvents and checks that + * all events was received and contain correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 25 and threadsNumber to 3, but because of framework design each requested event should + * be generated in 3 different way(through synchronized block, synchronized method and JNI MonitorEnter) and + * by 3 different threads, so actual number of generated events is (eventsNumber * 9), and actual number of threads generating + * events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventTypes MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 10 + * -threadsNumber 2 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassExclusionFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassExclusionFilter/TestDescription.java new file mode 100644 index 00000000000..869ef79e9de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassExclusionFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/addClassExclusionFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnterRequest.addClassExclusionFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to those whose method is in a class whose name does not match + * this restricted regular expression, e.g. "java.*" or "*.Foo"." + * Test also checks that received com.sun.jdi.MonitorContendedEnterEvent complies with its spec and contains correct data. + * Test uses 3 different class exclusion patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorEnterExecutor_*') + * - class name ('nsk.share.jdi.MonitorEnterExecutor_1Subclass') + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor enter events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventType MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorEnterExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ClassName/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ClassName/TestDescription.java new file mode 100644 index 00000000000..1b4d3f7df73 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ClassName/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ClassName. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnterRequest.addClassFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to the preparation of reference types whose name matches this + * restricted regular expression. Regular expressions are limited to exact matches and patterns that begin + * with '*' or end with '*'; for example, "*.Foo" or "java.*"." + * Test also checks that received com.sun.jdi.MonitorContendedEnterEvent complies with its spec and contains correct data. + * Test uses 3 different class patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorEnterExecutor_*') + * - class name ('nsk.share.jdi.MonitorEnterExecutor_1Subclass') + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor enter events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventType MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorEnterExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ReferenceType/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ReferenceType/TestDescription.java new file mode 100644 index 00000000000..d31fe007efd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ReferenceType/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ReferenceType. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnterRequest.addClassFilter(ReferenceType referenceType) + * complies with its spec: + * "Restricts the events generated by this request to be the preparation of the given reference type and any subtypes. + * An event will be generated for any prepared reference type that can be safely cast to the given reference type." + * Test also checks that received com.sun.jdi.MonitorContendedEnterEvent complies with its spec and contains correct data. + * Test uses 2 event filters: + * - add to request filter for class which has subclass (expect events for class and its subclasses) + * - add to request filter for class without subclasses + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor enter events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventType MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorEnterExecutor_1Subclass:nsk.share.jdi.MonitorEnterExecutor_2Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addInstanceFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addInstanceFilter/TestDescription.java new file mode 100644 index 00000000000..9b30671d1b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addInstanceFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/addInstanceFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnterRequest.addInstanceFilter(ObjectReference instance) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorContendedEnterEvent complies with its spec and contains correct data. + * Test uses following instances filters: + * - add to request filter for single object + * - add to request filter for the same object 2 times, expect behavior such as in previous case + * - add to request filter for 2 different objects, so events shouldn't be received + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor enter events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$InstanceFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventType MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addThreadFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addThreadFilter/TestDescription.java new file mode 100644 index 00000000000..add52592e1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addThreadFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnterRequest/addThreadFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnterRequest.addThreadFilter(ThreadReference thread) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorContendedEnterEvent complies with its spec and contains correct data. + * Test uses following thread filters: + * - add to request filter for single thread + * - add to request filter for the same thread 2 times, expect behavior such as in previous case + * - add to request filter for 2 different threads, so events shouldn't be received + * Test execute class nsk.share.jdi.EventTestTemplates$ThreadFilterTest which use JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor enter events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ThreadFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTER + * -eventType MONITOR_CONTENTED_ENTER + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest001/TestDescription.java new file mode 100644 index 00000000000..48e2c7c9aec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest001. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorContendedEnteredRequest and MonitorContendedEnteredEvent, debugger force + * debuggee generate several thousands of MonitorContendedEnteredEvents and checks that all events was received and contains + * correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 250 and threadsNumber to 1, but because of framework design each requested event should + * be generated in 3 different way(through synchronized block, synchronized method and JNI MonitorEnter) and + * by 3 different threads, so actual number of generated events is (eventsNumber * 9), and actual number of threads generating + * events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventTypes MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 100 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest002/TestDescription.java new file mode 100644 index 00000000000..40f79f602a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest002. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorContendedEnteredRequest and MonitorContendedEnteredEvent, debugger forces + * debuggee start several threads which simultaneously generate MonitorContendedEnteredEvents and checks that + * all events was received and contains correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 25 and threadsNumber to 3, but because of framework design each requested event should + * be generated in 3 different way(through synchronized block, synchronized method and JNI MonitorEnter) and + * by 3 different threads, so actual number of generated events is (eventsNumber * 9), and actual number of threads generating + * events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventTypes MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 10 + * -threadsNumber 2 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassExclusionFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassExclusionFilter/TestDescription.java new file mode 100644 index 00000000000..5ebb02ba864 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassExclusionFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/addClassExclusionFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnteredRequest.addClassExclusionFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to those whose method is in a class whose name does not match + * this restricted regular expression, e.g. "java.*" or "*.Foo"." + * Test also checks that received com.sun.jdi.MonitorContendedEnteredEvent complies with its spec and contains correct data. + * Test uses 3 different class exclusion patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorEnterExecutor_*') + * - class name ('nsk.share.jdi.MonitorEnterExecutor_1Subclass') + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor entered events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventType MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorEnterExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ClassName/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ClassName/TestDescription.java new file mode 100644 index 00000000000..acee5e56f30 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ClassName/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ClassName. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnteredRequest.addClassFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to the preparation of reference types whose name matches this + * restricted regular expression. Regular expressions are limited to exact matches and patterns that begin + * with '*' or end with '*'; for example, "*.Foo" or "java.*"." + * Test also checks that received com.sun.jdi.MonitorContendedEnteredEvent complies with its spec and contains correct data. + * Test uses 3 different class patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorEnterExecutor_*') + * - class name ('nsk.share.jdi.MonitorEnterExecutor_1Subclass') + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor entered events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventType MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorEnterExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ReferenceType/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ReferenceType/TestDescription.java new file mode 100644 index 00000000000..56332be7c90 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ReferenceType/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ReferenceType. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnteredRequest.addClassFilter(ReferenceType referenceType) + * complies with its spec: + * "Restricts the events generated by this request to be the preparation of the given reference type and any subtypes. + * An event will be generated for any prepared reference type that can be safely cast to the given reference type." + * Test also checks that received com.sun.jdi.MonitorContendedEnteredEvent complies with its spec and contains correct data. + * Test uses 2 event filters: + * - add to request filter for class which has subclass (expect events for class and its subclasses) + * - add to request filter for class without subclasses + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor entered events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventType MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorEnterExecutor_1Subclass:nsk.share.jdi.MonitorEnterExecutor_2Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addInstanceFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addInstanceFilter/TestDescription.java new file mode 100644 index 00000000000..eed3043adf1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addInstanceFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/addInstanceFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnteredRequest.addInstanceFilter(ObjectReference instance) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorContendedEnteredEvent complies with its spec and contains correct data. + * Test uses following instances filters: + * - add to request filter for single object + * - add to request filter for the same object 2 times, expect behavior such as in previous case + * - add to request filter for 2 different objects, so events shouldn't be received + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor entered events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$InstanceFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventType MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addThreadFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addThreadFilter/TestDescription.java new file mode 100644 index 00000000000..b9d33103468 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addThreadFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorContendedEnteredRequest/addThreadFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorContendedEnteredRequest.addThreadFilter(ThreadReference thread) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorContendedEnteredEvent complies with its spec and contains correct data. + * Test uses following thread filters: + * - add to request filter for single thread + * - add to request filter for the same thread 2 times, expect behavior such as in previous case + * - add to request filter for 2 different threads, so events shouldn't be received + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Monitor entered events are generated in 3 different ways: + * - through synchronized block + * - through synchronized method + * - through JNI MonitorEnter + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ThreadFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED + * -eventType MONITOR_CONTENTED_ENTERED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/MonitorWaitRequest001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/MonitorWaitRequest001/TestDescription.java new file mode 100644 index 00000000000..d473c5bd759 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/MonitorWaitRequest001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/MonitorWaitRequest001. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorWaitRequest and MonitorWaitEvent, debugger force + * debuggee generate several thousands of MonitorWaitEvents and checks that all events was received and contain + * correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 500 and threadsNumber to 1, but because of framework design generation of MonitorWait + * and MonitorWaited events is performed for 4 cases: thread exits from wait() after timeout, waiting thread is waked up with + * notify() or notifyAll(), or waiting thread is interrupted with interrupt(). + * Also events are generated by 3 different threads, so actual number of generated events is (eventsNumber * 12), + * and actual number of threads generating events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventTypes MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 100 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/MonitorWaitRequest002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/MonitorWaitRequest002/TestDescription.java new file mode 100644 index 00000000000..909ac3d3722 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/MonitorWaitRequest002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/MonitorWaitRequest002. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorWaitRequest and MonitorWaitEvent, debugger force + * debuggee start several threads which simultaneously generate MonitorWaitEvents and checks that + * all events was received and contain correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 25 and threadsNumber to 5, but because of framework design generation of MonitorWait + * and MonitorWaited events is performed for 4 cases: thread exits from wait() after timeout, waiting thread is waked up with + * notify() or notifyAll(), or waiting thread is interrupted with interrupt(). + * Also events are generated by 3 different threads, so actual number of generated events is (eventsNumber * 12), + * and actual number of threads generating events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventTypes MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 10 + * -threadsNumber 2 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassExclusionFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassExclusionFilter/TestDescription.java new file mode 100644 index 00000000000..e4481bc19f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassExclusionFilter/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/addClassExclusionFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitRequest.addClassExclusionFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to those whose method is in a class whose name does not match + * this restricted regular expression, e.g. "java.*" or "*.Foo"." + * Test also checks that received com.sun.jdi.MonitorWaitEvent complies with its spec and contains correct data. + * Test uses 3 different class exclusion patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorWaitExecutor_*') + * - class name ('nsk.share.jdi.MonitorWaitExecutor_1Subclass') + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorWaitExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorWaitExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ClassName/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ClassName/TestDescription.java new file mode 100644 index 00000000000..e842cfc4ac8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ClassName/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/addClassFilter_ClassName. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitRequest.addClassFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to the preparation of reference types whose name matches this + * restricted regular expression. Regular expressions are limited to exact matches and patterns that begin + * with '*' or end with '*'; for example, "*.Foo" or "java.*"." + * Test also checks that received com.sun.jdi.MonitorWaitEvent complies with its spec and containc correct data. + * Test uses 3 different class patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorWaitExecutor_*') + * - class name ('nsk.share.jdi.MonitorWaitExecutor_1Subclass') + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorWaitExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorWaitExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ReferenceType/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ReferenceType/TestDescription.java new file mode 100644 index 00000000000..dba00008f11 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ReferenceType/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/addClassFilter_ReferenceType. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitRequest.addClassFilter(ReferenceType referenceType) + * complies with its spec: + * "Restricts the events generated by this request to be the preparation of the given reference type and any subtypes. + * An event will be generated for any prepared reference type that can be safely cast to the given reference type." + * Test also checks that received com.sun.jdi.MonitorWaitEvent complies with its spec and contains correct data. + * Test uses 2 event filters: + * - add to request filter for class which has subclass (expect events for class and its subclasses) + * - add to request filter for class without subclasses + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorWaitExecutor_1Subclass:nsk.share.jdi.MonitorWaitExecutor_2Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addInstanceFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addInstanceFilter/TestDescription.java new file mode 100644 index 00000000000..f4f563d1664 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addInstanceFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/addInstanceFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitRequest.addInstanceFilter(ObjectReference instance) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorWaitEvent complies with its spec and contains correct data. + * Test use following instances filters: + * - add to request filter for single object + * - add to request filter for the same object 2 times, expect behavior such as in previous case + * - add to request filter for 2 different objects, so events shouldn't be received + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$InstanceFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addThreadFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addThreadFilter/TestDescription.java new file mode 100644 index 00000000000..82ad25df977 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitRequest/addThreadFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitRequest/addThreadFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitRequest.addThreadFilter(ThreadReference thread) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorWaitEvent complies with its spec and contains correct data. + * Test use following thread filters: + * - add to request filter for single thread + * - add to request filter for the same thread 2 times, expect behavior such as in previous case + * - add to request filter for 2 different threads, so events shouldn't be received + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ThreadFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAIT + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest001/TestDescription.java new file mode 100644 index 00000000000..f4e14c8d471 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest001. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorWaitedRequest and MonitorWaitedEvent, debugger forces + * debuggee generate several thousands of MonitorWaitedEvents and checks that all events was received and contains + * correct information. + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 500 and threadsNumber to 1, but because of framework design generation of MonitorWait + * and MonitorWaited events is performed for 4 cases: thread exits from wait() after timeout, waiting thread is waked up with + * notify() or notifyAll(), or waiting thread is interrupted with interrupt(). + * Also events are generated by 3 different threads, so actual number of generated events is (eventsNumber * 12), + * and actual number of threads generating events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventTypes MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 100 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest002/TestDescription.java new file mode 100644 index 00000000000..e82c3404459 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest002/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/MonitorWaitedRequest002. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for MonitorWaitedRequest and MonitorWaitedEvent, debugger forces + * debuggee start several threads which simultaneously generate MonitorWaitedEvents and checks that + * all events was received and contains correct information. + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 25 and threadsNumber to 5, but because of framework design generation of MonitorWait + * and MonitorWaited events is performed for 4 cases: thread exits from wait() after timeout, waiting thread is waked up with + * notify() or notifyAll(), or waiting thread is interrupted with interrupt(). + * Also events are generated by 3 different threads, so actual number of generated events is (eventsNumber * 12), + * and actual number of threads generating events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventTypes MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 10 + * -threadsNumber 2 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassExclusionFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassExclusionFilter/TestDescription.java new file mode 100644 index 00000000000..adcc36367c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassExclusionFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open jdk.jdi/com.sun.tools.jdi:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/addClassExclusionFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitedRequest.addClassExclusionFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to those whose method is in a class whose name does not match + * this restricted regular expression, e.g. "java.*" or "*.Foo"." + * Test also checks that received com.sun.jdi.MonitorWaitedEvent complies with its spec and contain correct data. + * Test uses 3 different class exclusion patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorWaitExecutor_*') + * - class name ('nsk.share.jdi.MonitorWaitExecutor_1Subclass') + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm + * PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorWaitExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorWaitExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ClassName/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ClassName/TestDescription.java new file mode 100644 index 00000000000..887786e8de6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ClassName/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/addClassFilter_ClassName. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitedRequest.addClassFilter(String classPattern) + * complies with its spec: + * "Restricts the events generated by this request to the preparation of reference types whose name matches this + * restricted regular expression. Regular expressions are limited to exact matches and patterns that begin + * with '*' or end with '*'; for example, "*.Foo" or "java.*"." + * Test also checks that received com.sun.jdi.MonitorWaitedEvent complies with its spec and contain correct data. + * Test uses 3 different class patterns: + * - begins with '*' ('*Subclass') + * - ending with '*' ('nsk.share.jdi.MonitorWaitExecutor_*') + * - class name ('nsk.share.jdi.MonitorWaitExecutor_1Subclass') + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorWaitExecutor_'*':'*'Subclass:nsk.share.jdi.MonitorWaitExecutor_1Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ReferenceType/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ReferenceType/TestDescription.java new file mode 100644 index 00000000000..fab801125a3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ReferenceType/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/addClassFilter_ReferenceType. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitedRequest.addClassFilter(ReferenceType referenceType) + * complies with its spec: + * "Restricts the events generated by this request to be the preparation of the given reference type and any subtypes. + * An event will be generated for any prepared reference type that can be safely cast to the given reference type." + * Test also checks that received com.sun.jdi.MonitorWaitedEvent complies with its spec and contain correct data. + * Test uses 2 event filters: + * - add to request filter for class which has subclass (expect events for class and its subclasses) + * - add to request filter for class whiteout subclasses + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -classPatterns nsk.share.jdi.MonitorWaitExecutor_1Subclass:nsk.share.jdi.MonitorWaitExecutor_2Subclass + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addInstanceFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addInstanceFilter/TestDescription.java new file mode 100644 index 00000000000..badd630eab2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addInstanceFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/addInstanceFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitedRequest.addInstanceFilter(ObjectReference instance) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorWaitedEvent complies with its spec and contain correct data. + * Test use following instances filters: + * - add to request filter for single object + * - add to request filter for the same object 2 times, expect behavior such as in previous case + * - add to request filter for 2 different objects, so events shouldn't be received + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$InstanceFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addThreadFilter/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addThreadFilter/TestDescription.java new file mode 100644 index 00000000000..f5f2727a35e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/MonitorWaitedRequest/addThreadFilter/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/MonitorWaitedRequest/addThreadFilter. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that a result of the method com.sun.jdi.MonitorWaitedRequest.addThreadFilter(ThreadReference thread) + * complies with its spec: + * "Restricts the events generated by this request to those in which the currently executing instance ("this") is + * the object specified." + * Test also checks that received com.sun.jdi.MonitorWaitedEvent complies with its spec and contain correct data. + * Test uses following thread filters: + * - add to request filter for single thread + * - add to request filter for the same thread 2 times, expect behavior such as in previous case + * - add to request filter for 2 different threads, so events shouldn't be received + * MonitorWaited events are generated for 4 cases: + * - waiting thread exits from wait() after timeout + * - another thread wakes up waiting thread using notify() method + * - another thread wakes up waiting thread using notifyAll() method + * - another thread interrupts waiting thread using interrupt() method + * Test executes class nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debugge VM to create number of objects which should generate events during test + * - if any event filters are used each generating event object is checked is this object accepted by all filters, + * if object was accepted it should save information about all generated events and this information is available for debugger + * - debuggee performs event generation and stop at breakpoint + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * In addition to the main scenario tests using event filters also check following cases: + * - attempt to add filter to enabled or deleted request throws 'InvalidRequestStateException' + * - corresponding method EventRequestManager.xxxRequests() returns created event request + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$ThreadFilterTest + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -eventType MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001.java new file mode 100644 index 00000000000..595d52e167d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001.java @@ -0,0 +1,235 @@ +/* + * 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.ObjectReference._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up that NullPointerException will be thrown in + * the following cases:
    + * - invokeMethod(null, method, params,ObjectReference.INVOKE_SINGLE_THREADED)
    + * - invokeMethod(thread, null, params,ObjectReference.INVOKE_SINGLE_THREADED)
    + * - invokeMethod(thread, method, null,ObjectReference.INVOKE_SINGLE_THREADED)
    + * In case
    + * invokeMethod(thread, method, params,Integer.MAX_VALUE)
    + * invokeMethod(thread, method, params,Integer.MIN_VALUE)
    + * no exception is expected. + */ + +public class bounds001 { + + private final static String prefix = "nsk.jdi.ObjectReference._bounds_."; + private final static String debuggerName = prefix + "bounds001"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private ThreadReference thread; + + class TestRuntimeException extends RuntimeException { + TestRuntimeException(String msg) { + super("TestRuntimeException: " + msg); + } + } + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds001 thisTest = new bounds001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + ReferenceType debugeeClass = debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(debugeeClass, + bounds001a.brkpMethodName, + bounds001a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + + thread = brkpEvent.thread(); + + Field field = debugeeClass.fieldByName(bounds001a.testedFieldName); + ObjectReference objRef = (ObjectReference )debugeeClass.getValue(field); + ReferenceType testedClass = objRef.referenceType(); + + Method method = debugee.methodByName(testedClass, bounds001a.testedMethod); + + display("\nTEST BEGINS"); + display("==========="); + + List params = createParams(1); + Value retValue; + display("Method : " + method); + + display("invokeMethod(null, method, params," + + "ObjectReference.INVOKE_NONVIRTUAL)"); + try { + retValue = objRef.invokeMethod(null, method, params, + ObjectReference.INVOKE_NONVIRTUAL); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, null, params," + + "ObjectReference.INVOKE_NONVIRTUAL)"); + try { + retValue = objRef.invokeMethod(thread, null, params, + ObjectReference.INVOKE_NONVIRTUAL); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, method, null," + + "ObjectReference.INVOKE_NONVIRTUAL)"); + try { + retValue = objRef.invokeMethod(thread, method, null, + ObjectReference.INVOKE_NONVIRTUAL); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, method, params," + + "Integer.MAX_VALUE)"); + try { + retValue = objRef.invokeMethod(thread, method, params, + Integer.MAX_VALUE); + if (((PrimitiveValue)retValue).intValue() != 1) { + complain("Wrong returned value " + retValue.toString()); + exitStatus = Consts.TEST_FAILED; + } else { + display("returned value is " + retValue.toString()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("invokeMethod(thread, method, params," + + "Integer.MIN_VALUE)"); + try { + retValue = objRef.invokeMethod(thread, method, params, + Integer.MIN_VALUE); + if (((PrimitiveValue)retValue).intValue() != 1) { + complain("Wrong returned value " + retValue.toString()); + exitStatus = Consts.TEST_FAILED; + } else { + display("returned value is " + retValue.toString()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private List createParams(int size) { + Vector params = new Vector(); + for (int i = 0; i < size; i++) { + params.add(debugee.VM().mirrorOf(i + 1)); + } + return params; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001/TestDescription.java new file mode 100644 index 00000000000..33de989cf1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ObjectReference/_bounds_/bounds001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the method com.sun.jdi.ObjectReference.invokeMethod() + * Test checks up that NullPointerException will be thrown in + * the following cases: + * - invokeMethod(null, method, params,ObjectReference.INVOKE_NONVIRTUAL) + * - invokeMethod(thread, null, params,ObjectReference.INVOKE_NONVIRTUAL) + * - invokeMethod(thread, method, null,ObjectReference.INVOKE_NONVIRTUAL) + * In case + * invokeMethod(thread, method, params,Integer.MAX_VALUE) + * invokeMethod(thread, method, params,Integer.MIN_VALUE) + * no exception is expected. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference._bounds_.bounds001 + * nsk.jdi.ObjectReference._bounds_.bounds001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference._bounds_.bounds001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001a.java new file mode 100644 index 00000000000..ba5f0880bab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001a.java @@ -0,0 +1,67 @@ +/* + * 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.ObjectReference._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * bounds001a is deugee's part of the bounds001. + */ +public class bounds001a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 51; + + public final static String testedFieldName = "testedObj"; + public final static String testedMethod = "justMethod"; + + private static bounds001b testedObj = new bounds001b(); + + 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(bounds001.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(bounds001.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class bounds001b { + public static int justMethod(int val) { + return val; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002.java new file mode 100644 index 00000000000..5ea2cb6e3f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002.java @@ -0,0 +1,183 @@ +/* + * 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.ObjectReference._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up ObjectReference methods for the following cases:
    + * - getValue(null)
    + * - getValues(null)
    + * - getValues(list with size = 0)
    + * - setValue(null, null)
    + * - setValue(field, null)
    + * NullPointerException is expected for every test case + * except for the last. + */ + +public class bounds002 { + + private final static String prefix = "nsk.jdi.ObjectReference._bounds_."; + private final static String debuggerName = prefix + "bounds002"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds002 thisTest = new bounds002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType debugeeClass = debugee.classByName(debugeeName); + + Field field = debugeeClass.fieldByName(bounds002a.testedFieldName); + ObjectReference objRef = (ObjectReference )debugeeClass.getValue(field); + ReferenceType testedClass = objRef.referenceType(); + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue; + + display("getValue(null)"); + try { + retValue = objRef.getValue(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("getValues(null)"); + try { + objRef.getValues(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + List lst = null; + display("getValues(list with size = 0)"); + try { + objRef.getValues(lst); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("setValue(null, null)"); + try { + objRef.setValue(null, null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + Field fld = objRef.referenceType().fieldByName(bounds002a.testedFieldName); + display("setValue(field, null)"); + try { + objRef.setValue(fld, null); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("equals(null)"); + try { + if (objRef.equals(null)) { + complain("is equal to "); + exitStatus = Consts.TEST_FAILED; + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002/TestDescription.java new file mode 100644 index 00000000000..da950db3f88 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ObjectReference/_bounds_/bounds002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods com.sun.jdi.ObjectReference + * for the following cases: + * - getValue(null) + * - getValues(null) + * - getValues(list with size = 0) + * - setValue(null, null) + * - setValue(field, null) + * NullPointerException is expected for every test case except for the last. + * In case + * setValue(field, null), where field is mirror of Object + * no exception is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference._bounds_.bounds002 + * nsk.jdi.ObjectReference._bounds_.bounds002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference._bounds_.bounds002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002a.java new file mode 100644 index 00000000000..0dee72712e9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002a.java @@ -0,0 +1,61 @@ +/* + * 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.ObjectReference._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * bounds002a is deugee's part of the bounds002. + */ +public class bounds002a { + + public final static String testedFieldName = "testedObj"; + public final static String testedMethod = "justMethod"; + + private static bounds002b testedObj = new bounds002b(); + + 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(bounds002.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(bounds002.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class bounds002b { + private static Object testedObj; + public static int justMethod(int val) { + return val; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003.java new file mode 100644 index 00000000000..e209ffee69c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003.java @@ -0,0 +1,233 @@ +/* + * 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.ObjectReference._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; + +import java.io.*; +import java.lang.reflect.Array; + +/** + * The test checks up the methods:
    + * com.sun.jdi.ObjectReference.setValue(Field, Object)
    + * com.sun.jdi.ObjectReference.getValue(Field)
    + * for boundary values of primitive types
    + * + * Test checks up the following assertion:
    + * Primitive arguments must be either assignment compatible with
    + * the field type or must be convertible to the field type
    + * without loss of information.
    + * for every primitive type.
    + */ + +public class bounds003 extends ValueConversionDebugger { + + private static class TestedFieldData { + public String fieldName; + public ValueType fieldType; + + public TestedFieldData(String fieldName, ValueType fieldType) { + this.fieldName = fieldName; + this.fieldType = fieldType; + } + } + + private static TestedFieldData[] testedFields = { + new TestedFieldData("byteField", BYTE), + new TestedFieldData("charField", CHAR), + new TestedFieldData("doubleField", DOUBLE), + new TestedFieldData("floatField", FLOAT), + new TestedFieldData("intField", INT), + new TestedFieldData("longField", LONG), + new TestedFieldData("shortField", SHORT) + }; + + private static byte [] byteFieldValues = + {Byte.MIN_VALUE, + -1, + 0, + 1, + Byte.MAX_VALUE}; + private static char [] charFieldValues = + {Character.MIN_VALUE, + Character.MAX_VALUE}; + private static double [] doubleFieldValues = + {Double.NEGATIVE_INFINITY, + -1.5D, + -1.0D, + -0.0D, + +0.0D, + Double.MIN_VALUE, + 1.0D, + 1.5D, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY}; + private static float [] floatFieldValues = + {Float.NEGATIVE_INFINITY, + -1.5F, + -1.0F, + -0.0F, + +0.0F, + Float.MIN_VALUE, + 1.0F, + 1.5F, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY}; + private static int [] intFieldValues = + {Integer.MIN_VALUE, + -1, + 0, + 1, + 1234567890, + Integer.MAX_VALUE}; + private static long [] longFieldValues = + {Long.MIN_VALUE, + -1L, + 0L, + 1L, + 1234567890123456789L, + Long.MAX_VALUE}; + private static short [] shortFieldValues = + {Short.MIN_VALUE, + -1, + 0, + 1, + Short.MAX_VALUE}; + + protected String debuggeeClassName() { + return bounds003a.class.getName(); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + return new bounds003().runIt(argv, out); + } + + protected void doTest() { + debuggee.suspend(); + + ReferenceType debugeeClass = debuggee.classByName(debuggeeClassNameWithoutArgs()); + + Field field = debugeeClass.fieldByName(bounds003a.testedFieldName); + ObjectReference objRef = (ObjectReference )debugeeClass.getValue(field); + ReferenceType testedClass = objRef.referenceType(); + + display("\nTEST BEGINS"); + display("==========="); + + PrimitiveValue retValue, value; + Object arr = null; + boolean validConversion; + + for (TestedFieldData testedField : testedFields) { + field = testedClass.fieldByName(testedField.fieldName); + display("Field : " + field); + display("======================"); + for (ValueType type : ValueType.values()) { + switch (type) { + case BYTE: + arr = byteFieldValues; + display("byte values"); + break; + case CHAR: + arr = charFieldValues; + display("char values"); + break; + case DOUBLE: + arr = doubleFieldValues; + display("double values"); + break; + case FLOAT: + arr = floatFieldValues; + display("float values"); + break; + case INT: + arr = intFieldValues; + display("integer values"); + break; + case LONG: + arr = longFieldValues; + display("long values"); + break; + case SHORT: + arr = shortFieldValues; + display("short values"); + break; + default: + complain("***TEST CASE ERROR***"); + setSuccess(false); + continue; + } + display("-----------------"); + for (int i = 0; i < Array.getLength(arr); i++) { + value = createValue(arr, i); + validConversion = isValidConversion(testedField.fieldType, value); + display(">value = " + value.toString()); + try { + objRef.setValue(field, value); + if (!validConversion) { + complain(lastConversion); + complain("***InvalidTypeException is not thrown***"); + display(""); + setSuccess(false); + continue; + } + + retValue = (PrimitiveValue) objRef.getValue(field); + + checkValueConversion(value, retValue); + + } catch(InvalidTypeException e) { + if (validConversion) { + complain(lastConversion); + complain("*** unexpected InvalidTypeException***"); + display(""); + setSuccess(false); + } else { + display(lastConversion); + display("!!!expected InvalidTypeException"); + display(""); + } + } catch(Exception e) { + complain("unexpected " + e); + display(""); + setSuccess(false); + } + } + display(""); + } + } + + display("============="); + display("TEST FINISHES\n"); + + debuggee.resume(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003/TestDescription.java new file mode 100644 index 00000000000..6cc8a38ac3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ObjectReference/_bounds_/bounds003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods: + * com.sun.jdi.ObjectReference.setValue(Field, Object) + * com.sun.jdi.ObjectReference.getValue(Field) + * for boundry values of primitive types + * Test checks up the following assertion: + * Primitive arguments must be either assignment compatible with + * the field type or must be convertible to the field type + * without loss of information. + * for every primitive type. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference._bounds_.bounds003 + * nsk.jdi.ObjectReference._bounds_.bounds003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference._bounds_.bounds003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003a.java new file mode 100644 index 00000000000..ee7663e9443 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds003a.java @@ -0,0 +1,49 @@ +/* + * 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.ObjectReference._bounds_; + + +import nsk.share.jdi.*; + +/** + * bounds003a is debuggee's part of the bounds003. + */ +public class bounds003a extends AbstractJDIDebuggee { + + public static String testedFieldName = "fieldObj"; + + private byte byteField; + private char charField; + private double doubleField; + private float floatField; + private int intField; + private long longField; + private short shortField; + + static bounds003a fieldObj = new bounds003a(); + + public static void main (String args[]) { + new bounds003a().doTest(args); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java new file mode 100644 index 00000000000..6b39a826dc7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java @@ -0,0 +1,226 @@ +/* + * 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.ObjectReference.disableCollection; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.disableCollection()
    + * complies with its specification.
    + *
    + * The case for testing includes not throwing
    + * ObjectCollectedException
    + * provided a mirrored object is not collected.
    + */ + +public class disablecollection001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/disableCollection/disablecollection001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new disablecollection001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.disableCollection.disablecollection001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.disableCollection.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.disableCollection"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String objName = "testObj"; + + log2("getting testedClass object"); + try { + + testedClass = (ReferenceType) + vm.classesByName(debuggeeName).get(0); + + ObjectReference objRef = (ObjectReference) + testedClass.getValue(testedClass.fieldByName(objName)); + + + log2(".......checking up on not throwing ObjectCollectedException "); + + try { + objRef.disableCollection(); + log2(" ObjectCollectedException is not thrown"); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: ObjectCollectedException"); + testExitCode = FAILED; + } catch ( Exception e2 ) { + testExitCode = FAILED; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001/TestDescription.java new file mode 100644 index 00000000000..76b5636d651 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ObjectReference/disableCollection/disablecollection001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.disableCollection() + * complies with its spec: + * public void disableCollection() + * Prevents garbage collection for this object. + * By default all ObjectReference values returned by JDI may be + * collected at any time the target VM is running. + * A call to this method guarantees that the object will not be collected. + * enableCollection() can be used to allow collection once again. + * Calls to this method are counted. + * Every call to this method requires a corresponding call to + * enableCollection() before garbage collection is re-enabled. + * Note that while the target VM is suspended, + * no garbage collection will occur because all threads are suspended. + * The typical examination of variables, fields, and arrays during + * the suspension is safe without explicitly disabling garbage collection. + * This method should be used sparingly, as + * it alters the pattern of garbage collection in the target VM and, + * consequently, may result in application behavior under the debugger that + * differs from its non-debugged behavior. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.disableCollection.disablecollection001; + * the debuggee program - nsk.jdi.ObjectReference.disableCollection.disablecollection001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.disableCollection.disablecollection001 + * nsk.jdi.ObjectReference.disableCollection.disablecollection001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.disableCollection.disablecollection001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001a.java new file mode 100644 index 00000000000..72b3e794efa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001a.java @@ -0,0 +1,139 @@ +/* + * 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.ObjectReference.disableCollection; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the disablecollection001 JDI test. + */ + +public class disablecollection001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ObjectReference.disableCollection()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Prevents garbage collection for this object.
    + * By default all ObjectReference values returned by JDI
    + * may be collected at any time the target VM is running.
    + * A call to this method guarantees that
    + * the object will not be collected.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new array object "arr1" to be tested on
    + * collection and invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger gets ObjectReference mirroring arr1,
    + * disables collecting "arr1" resumes the debuggee and waits for new
    + * BreakpointEvent.
    + * - The debuggee assigns null to arr1 to make object's memory available
    + * to be collected and pertforms a loop in which it creates new
    + * objects until VM throws OutOfMemoryError. Then it informs the
    + * debugger of the ERROR with new BreakPoint event.
    + * - Upon getting the event,
    + * the debugger gets new ObjectReference mirroring arr1,
    + * resumes the debuggee, and waits for new breakpoint.
    + * - The debuggee invokes a garbage collector and informs the debugger
    + * with new breakpoint event.
    + * - Upon getting the event,
    + * the debugger gets new ObjectReference mirroring arr1 once again.
    + *
    + * If no ObjectCollectedexception is thrown during the above cooperation
    + * the test is PASSED, othewise, FAILED.
    + *
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class disablecollection002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/disableCollection/disablecollection002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new disablecollection002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.disableCollection.disablecollection002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String name = "arr1"; + + ReferenceType arr1RefType = null; + ObjectReference arr1ObjRef = null; + + try { + log2("......getting: arr1ObjRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(name));"); + arr1ObjRef = (ObjectReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(name)); + + log2("...... arr1ObjRef.disableCollection();"); + arr1ObjRef.disableCollection(); + + log2("......vm.resume();"); + vm.resume(); + breakpointForCommunication(); + log2(" after breakpointForCommunication();"); + + log2("......getting: arr1RefType = arr1ObjRef.referenceType();"); + arr1RefType = arr1ObjRef.referenceType(); + + log2("......vm.resume();"); + vm.resume(); + breakpointForCommunication(); + log2(" after breakpointForCommunication();"); + + log2("......after debuggee invoked runTime.gc() :"); + log2(" getting: arr1RefType = arr1ObjRef.referenceType();"); + arr1RefType = arr1ObjRef.referenceType(); + + } catch ( ObjectCollectedException e ) { + log3("ERROR: caught ObjectCollectedException"); + throw new JDITestRuntimeException("** unexpected ObjectCollectedException **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection002/TestDescription.java new file mode 100644 index 00000000000..de92a5943ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection002/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/ObjectReference/disableCollection/disablecollection002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.disableCollection() + * complies with its spec: + * public void disableCollection() + * Prevents garbage collection for this object. + * By default all ObjectReference values returned by JDI may be collected at any + * time the target VM is running. A call to this method guarantees that + * the object will not be collected. + * enableCollection() can be used to allow collection once again. + * Calls to this method are counted. + * Every call to this method requires a corresponding call to enableCollection() + * before garbage collection is re-enabled. + * Note that while the target VM is suspended, no garbage collection will occur + * because all threads are suspended. The typical examination of variables, fields, + * and arrays during the suspension is safe without + * explicitly disabling garbage collection. + * This method should be used sparingly, + * as it alters the pattern of garbage collection in the target VM and, consequently, + * may result in application behavior under the debugger that + * differs from its non-debugged behavior. + * The test checks up on the following assertion: + * Prevents garbage collection for this object. + * By default all ObjectReference values returned by JDI may be collected at + * any time the target VM is running. A call to this method guarantees that + * the object will not be collected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.disableCollection.disablecollection002; + * the debuggee program - nsk.jdi.ObjectReference.disableCollection.disablecollection002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ObjectReference.disableCollection.disablecollection002 + * nsk.jdi.ObjectReference.disableCollection.disablecollection002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.disableCollection.disablecollection002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection002a.java new file mode 100644 index 00000000000..7c45352c7d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection002a.java @@ -0,0 +1,170 @@ +/* + * 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.ObjectReference.disableCollection; + +import nsk.share.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the disablecollection002 JDI test. + */ + +public class disablecollection002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Runtime runTime = Runtime.getRuntime(); + + static array1 arr1 = null; + static array2 arr2[] = null; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + log1("runTime.maxMemory() == " + runTime.maxMemory()); + log1("runTime.totalMemory() == " + runTime.totalMemory()); + log1("runTime.freeMemory() == " + runTime.freeMemory()); + + try { + arr1 = new array1(); + arr2 = new array2[100]; + } catch (OutOfMemoryError e) { + log1("caught: OutOfMemoryError while creating objects"); + instruction = end; + methodForCommunication(); + break label0; + } + + methodForCommunication(); + break ; + + case 1: + log1("arr1 = null;"); + arr1 = null; + try { + for (int k = 0; k < 100; k++) { + log1("> " + k + " runTime.maxMemory() == " + runTime.maxMemory()); + log1(" " + k + " runTime.totalMemory() == " + runTime.totalMemory()); + log1(" " + k + " runTime.freeMemory() == " + runTime.freeMemory()); + arr2[k] = new array2(); + } + } catch (OutOfMemoryError e) { + log1("caught: OutOfMemoryError"); + } + methodForCommunication(); + break ; + + case 2: + log1("runTime.gc();"); + runTime.gc(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static int getArraySize(long longValue) { + int arraySize; + if (longValue > Integer.MAX_VALUE) + arraySize = Integer.MAX_VALUE; + else + arraySize = (int)longValue; + + return arraySize; + } + + static class array1 { + int a1[] = new int[getArraySize(runTime.maxMemory() / 10)]; + } + + static class array2 { + int a2[] = new int[getArraySize(runTime.maxMemory() / 100)]; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/dummyPackage/invokemethod014a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/dummyPackage/invokemethod014a.java new file mode 100644 index 00000000000..a860460713e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/dummyPackage/invokemethod014a.java @@ -0,0 +1,182 @@ +/* + * 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. + */ + +// dummy package +package nsk.jdi.ObjectReference.dummyPackage; + +/** + * This is an auxiliary class outside a main debuggee package. It's + * used to provoke IllegalArgumentException in the debugger: + * non-public methods cannot be accessed from outside the package. + */ +public class invokemethod014a { + // methods with default access are below + byte byteMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"byteMeth\" was invoked from outside package!"); + return 127; + } + + short shortMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"shortMeth\" was invoked from outside not public!"); + return -32768; + } + + int intMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"intMeth\" was invoked from outside not public!"); + return 2147483647; + } + + long longMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"longMeth\" was invoked from outside not public!"); + return 9223372036854775807L; + } + + float floatMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"floatMeth\" was invoked from outside not public!"); + return 5.1F; + } + + double doubleMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"doubleMeth\" was invoked from outside not public!"); + return 6.2D; + } + + char charMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"charMeth\" was invoked from outside not public!"); + return 'a'; + } + + boolean booleanMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"booleanMeth\" was invoked from outside not public!"); + return false; + } + + String strMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"strMeth\" was invoked from outside not public!"); + return "string method"; + } + + void voidMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod14a: non-public method \"voidMeth\" was invoked from outside not public!"); + } + + // protected methods are below + protected byte protByteMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protByteMeth\" was invoked!"); + return 127; + } + + protected short protShortMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protShortMeth\" was invoked!"); + return -32768; + } + + protected int protIntMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protIntMeth\" was invoked!"); + return 2147483647; + } + + protected long protLongMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protLongMeth\" was invoked!"); + return 9223372036854775807L; + } + + protected float protFloatMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protFloatMeth\" was invoked!"); + return 5.1F; + } + + protected double protDoubleMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protDoubleMeth\" was invoked!"); + return 6.2D; + } + + protected char protCharMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protCharMeth\" was invoked!"); + return 'a'; + } + + protected boolean protBooleanMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protBooleanMeth\" was invoked!"); + return false; + } + + protected String protStrMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protStrMeth\" was invoked!"); + return "string method"; + } + + protected void protVoidMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: protected method \"protVoidMeth\" was invoked!"); + } + + // private methods are below + private byte privByteMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privByteMeth\" was invoked!"); + return 127; + } + + private short privShortMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privShortMeth\" was invoked!"); + return -32768; + } + + private int privIntMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privIntMeth\" was invoked!"); + return 2147483647; + } + + private long privLongMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privLongMeth\" was invoked!"); + return 9223372036854775807L; + } + + private float privFloatMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privFloatMeth\" was invoked!"); + return 5.1F; + } + + private double privDoubleMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privDoubleMeth\" was invoked!"); + return 6.2D; + } + + private char privCharMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privCharMeth\" was invoked!"); + return 'a'; + } + + private boolean privBooleanMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privBooleanMeth\" was invoked!"); + return false; + } + + private String privStrMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privStrMeth\" was invoked!"); + return "string method"; + } + + private void privVoidMeth() { + nsk.jdi.ObjectReference.invokeMethod.invokemethod014t.log.complain("invokemethod014a: private method \"privVoidMeth\" was invoked!"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java new file mode 100644 index 00000000000..d0611900c49 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java @@ -0,0 +1,229 @@ +/* + * 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.ObjectReference.entryCount; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.entryCount()
    + * complies with its specification.
    + *
    + * The case for testing includes throwing
    + * UnsupportedOperationException
    + * provided
    + * VirtualMachine.canGetMonitorInfo() == false
    + */ + +public class entrycount001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/entryCount/entrycount001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new entrycount001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.entryCount.entrycount001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.entryCount.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.entryCount"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String objName = "testObj"; + + log2("getting testedClass object"); + try { + + testedClass = (ReferenceType) + vm.classesByName(debuggeeName).get(0); + + ObjectReference objRef = (ObjectReference) + testedClass.getValue(testedClass.fieldByName(objName)); + + if (!vm.canGetMonitorInfo()) { + + log2(".......vm.canGetMonitorInfo() == false"); + log2(".......checking up on throwing UnsupportedOperationException"); + + try { + int count = objRef.entryCount(); + log3("ERROR: UnsupportedOperationException is not thrown"); + testExitCode = FAILED; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException"); + } catch ( Exception e2 ) { + testExitCode = FAILED; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + } + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001/TestDescription.java new file mode 100644 index 00000000000..ec8f33ffbde --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ObjectReference/entryCount/entrycount001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.entryCount() + * complies with its spec: + * public int entryCount() + * throws IncompatibleThreadStateException + * Returns the number times this object's monitor has been entered + * by the current owning thread. See ThreadReference.ownedMonitors() for + * a definition of ownership. + * Not all target VMs support this operation. + * See VirtualMachine#canGetMonitorInfo to determine + * if the operation is supported. + * Returns: the integer count of the number of entries. + * Throws: java.lang.UnsupportedOperationException - + * if the target target VM does not support this operation. + * IncompatibleThreadStateException - + * if the owning thread is not suspended in the target VM + * ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes throwing + * UnsupportedOperationException + * provided + * VirtualMachine.canGetMonitorInfo() == false + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.entryCount.entrycount 00; + * the debuggee program - nsk.jdi.ObjectReference.entryCount.entrycount 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.entryCount.entrycount001 + * nsk.jdi.ObjectReference.entryCount.entrycount001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.entryCount.entrycount001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001a.java new file mode 100644 index 00000000000..b8f1c4bdfd0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001a.java @@ -0,0 +1,139 @@ +/* + * 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.ObjectReference.entryCount; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the entrycount001 JDI test. + */ + +public class entrycount001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + private Event waitForEvent (EventRequest eventRequest) { + + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002/TestDescription.java new file mode 100644 index 00000000000..8af1f3823d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002/TestDescription.java @@ -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/ObjectReference/entryCount/entrycount002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks the following assertion of + * com.sun.jdi.ObjectReference.entryCount method spec: + * Returns the number times this object's monitor has been entered + * by the current owning thread. + * The debugger program - nsk.jdi.ObjectReference.entryCount.entrycount002; + * the debuggee program - nsk.jdi.ObjectReference.entryCount.entrycount002a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * The debuggee invokes syncronized foo method of entrycount002aLock class. + * The foo method is recursive : invokes itself with the argument substracted 1 + * until 0 is reached. The debugger creates MethodEntryRequest filtered + * to class of foo method. Each time the foo is invoked, the debuggee is + * suspended. Upon receiving next MethodEntryEvent, the debugger calls + * entryCount method for the debuggee's field of entrycount002aLock type. + * The returned value must be equal to the expected one - the level of + * recursion. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.entryCount.entrycount002 + * nsk.jdi.ObjectReference.entryCount.entrycount002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.entryCount.entrycount002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002a.java new file mode 100644 index 00000000000..a2fe3a78c3b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002a.java @@ -0,0 +1,125 @@ +/* + * 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.ObjectReference.entryCount; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class entrycount002a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + private static void methodForCommunication() { + int i = instruction; // entrycount002.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static entrycount002aLock lockObj = new entrycount002aLock(); + static int levelMax = 10; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + display("debuggee started!"); + + label0: + for (int testCase = 0; instruction != quit; testCase++) { + + switch (testCase) { + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test case section + case 0: + display("call methodForCommunication() #0"); + methodForCommunication(); + + lockObj.foo(levelMax); + break; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of section + + default: + instruction = quit; + break; + } + + display("call methodForCommunication() #1"); + methodForCommunication(); + if (instruction == quit) + break; + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + +} + +//--------------------------------------------------------- test specific classes + +class entrycount002aLock { + synchronized void foo (int level) { + if (level <= 0) { + return; + } + level--; + entrycount002a.display("Calling foo with level : " + level); + foo(level); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java new file mode 100644 index 00000000000..17114974c6b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java @@ -0,0 +1,263 @@ +/* + * 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.ObjectReference.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.equals()
    + * complies with its specification.
    + * The case for testing incliudes two ObjectReference objects
    + * beloning to the same VM.
    + *
    + * The test works as follows.
    + * Upon launch, a debuggee infroms a debugger of creating
    + * tested objects.
    + * The debuggee gets two ObjectReference objRef1 and objRef2
    + * mirroring the same object in the debuggee, and
    + * ObjectReference objRef3 mirroring another object.
    + * Then it checks up that
    + * - objRef1.equals(objRef2) returns true and
    + * - objRef1.equals(objRef3) returns false.
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/equals/equals001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.equals.equals001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValues.TestClass"; + + private String testedClass1Name = + "nsk.jdi.ObjectReference.getValues.TestClass1"; + + //String mName = "nsk.jdi.ObjectReference.equals"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + + Field field1 = null; + Value val1 = null; + List fields = null; + + String objName = "testObj"; + String obj1Name = "testObj1"; + + ObjectReference objRef1 = null; + ObjectReference objRef2 = null; + ObjectReference objRef3 = null; + + + log2("......getting first mirror of tested TestClass obj : ObjectReference objRef1"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef1 = (ObjectReference) val1; + + + log2("......getting second mirror of tested TestClass obj : ObjectReference objRef2"); + + objRef2 = (ObjectReference) val1; + + + log2("......getting amirror of tested TestClass1 obj : ObjectReference objRef3"); + + field1 = debuggeeClass.fieldByName(obj1Name); + val1 = debuggeeClass.getValue(field1); + objRef3 = (ObjectReference) val1; + + + log2("......testing equality of objRef1 and objRef2"); + if (!objRef1.equals(objRef2)) { + log3("ERROR: objRef1 is not equal to objRef2"); + testExitCode = FAILED; + } + + log2("......testing inequality of objRef1 and objRef3"); + if (objRef1.equals(objRef3)) { + log3("ERROR: objRef1 is equal to objRef3"); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..ddd77b2a1d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001/TestDescription.java @@ -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/ObjectReference/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this ObjectReference for equality. + * Returns: true if the Object is an ObjectReference, + * if the ObjectReferences belong to the same VM, and + * if applying the "==" operator on the mirrored objects in that VM + * evaluates to true. + * Overrides: equals in class java.lang.Object + * The case for testing includes objects beloning to the same VM. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.equals.equals001; + * the debuggee program - nsk.jdi.ObjectReference.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.equals.equals001 + * nsk.jdi.ObjectReference.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001a.java new file mode 100644 index 00000000000..01a6b5a3625 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001a.java @@ -0,0 +1,174 @@ +/* + * 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.ObjectReference.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the equals001 JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + static TestClass1 testObj1 = new TestClass1(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValue()
    + * complies with its specification.
    + *
    + * The cases for testing include
    + * static and instance fields of primitive types created in
    + * debuggee's second thread.
    + *
    + * The test works as follows.
    + * Upon launch, a debuggee creates second thread, thread2 and
    + * informs a debugger of its creation.
    + * The debugger :
    + * gets a mirror of current Stackframe object
    + * gets mirrors of fields to test, and
    + * performs casts from Value to corresponding PrimitiveValue
    + * for each of the tested types.
    + */ + +public class getvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValue/getvalue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValue.getvalue001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValue.Threadgetvalue001a"; + + //String mName = "nsk.jdi.ObjectReference.getValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedClass = null; + + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + String breakpointMethod1 = "runt1"; + String bpLine1 = "breakpointLineNumber1"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + + StackFrame stackFrame = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + ObjectReference thisobj = null; + thisobj = stackFrame.thisObject(); + + String bl1 = "bl1", bl2 = "bl2"; + String bt1 = "bt1", bt2 = "bt2"; + String ch1 = "ch1", ch2 = "ch2"; + String db1 = "db1", db2 = "db2"; + String fl1 = "fl1", fl2 = "fl2"; + String in1 = "in1", in2 = "in2"; + String ln1 = "ln1", ln2 = "ln2"; + String sh1 = "sh1", sh2 = "sh2"; + + Field fsbl1 = testedClass.fieldByName("bl1"); + Field fsbt1 = testedClass.fieldByName("bt1"); + Field fsch1 = testedClass.fieldByName("ch1"); + Field fsdb1 = testedClass.fieldByName("db1"); + Field fsfl1 = testedClass.fieldByName("fl1"); + Field fsin1 = testedClass.fieldByName("in1"); + Field fsln1 = testedClass.fieldByName("ln1"); + Field fssh1 = testedClass.fieldByName("sh1"); + + Field fsbl2 = testedClass.fieldByName("bl2"); + Field fsbt2 = testedClass.fieldByName("bt2"); + Field fsch2 = testedClass.fieldByName("ch2"); + Field fsdb2 = testedClass.fieldByName("db2"); + Field fsfl2 = testedClass.fieldByName("fl2"); + Field fsin2 = testedClass.fieldByName("in2"); + Field fsln2 = testedClass.fieldByName("ln2"); + Field fssh2 = testedClass.fieldByName("sh2"); + + + log2("......loop of checks on each primitive type by performing statements like first one:"); + log2(" BooleanValue blv = (BooleanValue) thisobj.getValue(fsbl1);"); + for ( int i3 = 0; i3 < 8; i3++) { + + try { + + switch (i3) { + + case 0: + log2(" checking up on boolean"); + BooleanValue blv = (BooleanValue) thisobj.getValue(fsbl1); + + blv = (BooleanValue) thisobj.getValue(fsbl2); + break; + + case 1: + log2(" checking up on byte"); + ByteValue btv = (ByteValue) thisobj.getValue(fsbt1); + + btv = (ByteValue) thisobj.getValue(fsbt2); + break; + + case 2: + log2(" checking up on char"); + CharValue chv = (CharValue) thisobj.getValue(fsch1); + + chv = (CharValue) thisobj.getValue(fsch2); + break; + + case 3: + log2(" checking up on double"); + DoubleValue dbv = (DoubleValue) thisobj.getValue(fsdb1); + + dbv = (DoubleValue) thisobj.getValue(fsdb2); + break; + + case 4: + log2(" checking up on float"); + FloatValue flv = (FloatValue) thisobj.getValue(fsfl1); + + flv = (FloatValue) thisobj.getValue(fsfl2); + break; + + case 5: + log2(" checking up on int"); + IntegerValue inv = (IntegerValue) thisobj.getValue(fsin1); + + inv = (IntegerValue) thisobj.getValue(fsin2); + break; + + case 6: + log2(" checking up on long"); + LongValue lnv = (LongValue) thisobj.getValue(fsln1); + + lnv = (LongValue) thisobj.getValue(fsln2); + break; + + case 7: + log2(" checking up on short"); + ShortValue shv = (ShortValue) thisobj.getValue(fssh1); + + shv = (ShortValue) thisobj.getValue(fssh2); + break; + + + default : log3("ERROR: TEST ERROR: case: default:"); + expresult = returnCode1; + break; + + } // end of switch + + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException"); + expresult = returnCode1; + } catch ( ObjectCollectedException e ) { + log3("ERROR: ObjectCollectedException"); + expresult = 1; + } catch ( VMMismatchException e ) { + log3("ERROR: VMMismatchException"); + expresult = 1; + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + } // end of try + + } // end of for + } + + if (thread2 != null) { + thread2.resume(); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { +// Method method = (Method) testedclass.methodsByName(methodName).get(0); + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = +// ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001/TestDescription.java new file mode 100644 index 00000000000..e4872f8f31d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ObjectReference/getValue/getvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValue() + * complies with its spec: + * public Value getValue(Field sig) + * Gets the value of a given instance or static field in this object. + * The Field must be valid for this ObjectReference; + * that is, it must be from the mirrored object's class or + * a superclass of that class. + * Parameters: sig - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include static and instance fields of primitive types + * created in debuggee's second thread. + * No exception is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValue.getvalue001; + * the debuggee program - nsk.jdi.ObjectReference.getValue.getvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * Test fixed according to test bug: + * 4955084 TEST_BUG: JDI test does not resume suspended thread + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.getValue.getvalue001 + * nsk.jdi.ObjectReference.getValue.getvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValue.getvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java new file mode 100644 index 00000000000..53f34af9f49 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java @@ -0,0 +1,208 @@ +/* + * 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.ObjectReference.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue001 JDI test. + */ + +public class getvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValue()
    + * complies with its specification.
    + *
    + * The cases for testing include
    + * static and instance fields of primitive types created in
    + * debuggee's second thread with the method ClassType.newInstance().
    + *
    + * The test works as follows.
    + * Upon launch, a debuggee creates second thread, thread2 and
    + * informs a debugger of its creation.
    + * The debugger :
    + * creates in the thread2
    + * new object with static and instace fields,
    + * gets mirrors of fields to test, and
    + * performs casts from Value to corresponding PrimitiveValue
    + * for each of the tested types.
    + */ + +public class getvalue002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValue/getvalue002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalue002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValue.getvalue002a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValue.getvalue002aTestClass"; + + private String threadName = "testedThread"; + + private String threadClassName = + "nsk.jdi.ObjectReference.getValue.getvalue002aThread"; + + //String mName = "nsk.jdi.ObjectReference.getValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedClass = null; + ReferenceType threadClass = null; + + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String breakpointMethod1 = "runt1"; + + String bpLine1 = "breakpointLineNumber1"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + + ClassType classType = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(threadClassName); + threadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + log2("......getting Thread thread2 - 1-st argument"); + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2("......getting ClassType classType - an object to apply newInstance()"); + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + classType = (ClassType) testedClass; + + List invokeMethods = testedClass.methods(); + ListIterator li = invokeMethods.listIterator(); + + Method invokeMethod = null; + + log2("......getting Method invokeMethod - a constructor to invoke; 2-nd argument"); + try { + for (;;) { + invokeMethod = (Method) li.next(); + if (!invokeMethod.isConstructor()) + continue; + if (invokeMethod.arguments().size() == 0) + break; + } + } catch ( AbsentInformationException e1 ) { + log2(" AbsentInformationException "); + break label1; + } catch ( NoSuchElementException e2 ) { + log3("ERROR: NoSuchElementException "); + expresult = returnCode2; + break label1; + } + + + // this is only to get an empty List with JDI methods but not with API List methods + log2("......forming an empty List argumentList for 3-d argument"); + log2(" List argumentList = testedClass.methodsByName('m');"); + List argumentList = testedClass.methodsByName("m"); + log2(" argumentList.clear();"); + argumentList.clear(); + + + ObjectReference objRef = null; + + log2("......ObjectReference objRef = classType.newInstance(thread2, invokeMethod, argumentList, 0);"); + log2(" No Exception is expected"); + try { + objRef = classType.newInstance(thread2, + invokeMethod, Collections.emptyList(), 0); + if (objRef == null) + log2(" objRe == null"); + + + log2(" ReferenceType refType = objRef.referenceType();"); + ReferenceType refType = objRef.referenceType(); + + log2(" ClassType cType = (ClassType) refType;"); + ClassType cType = (ClassType) refType; + + log2("......checking up on: cType.equals(classType); "); + if (!cType.equals(classType)) { + log3("ERROR: !cType.equals(classType)"); + expresult = returnCode1; + } + + } catch ( Exception e ) { + log3("ERROR: Exception for classType.newInstance() :" + e); + expresult = returnCode1; + } + + ObjectReference thisobj = objRef; + + String bl1 = "bl1", bl2 = "bl2"; + String bt1 = "bt1", bt2 = "bt2"; + String ch1 = "ch1", ch2 = "ch2"; + String db1 = "db1", db2 = "db2"; + String fl1 = "fl1", fl2 = "fl2"; + String in1 = "in1", in2 = "in2"; + String ln1 = "ln1", ln2 = "ln2"; + String sh1 = "sh1", sh2 = "sh2"; + + Field fsbl1 = testedClass.fieldByName("bl1"); + Field fsbt1 = testedClass.fieldByName("bt1"); + Field fsch1 = testedClass.fieldByName("ch1"); + Field fsdb1 = testedClass.fieldByName("db1"); + Field fsfl1 = testedClass.fieldByName("fl1"); + Field fsin1 = testedClass.fieldByName("in1"); + Field fsln1 = testedClass.fieldByName("ln1"); + Field fssh1 = testedClass.fieldByName("sh1"); + + Field fsbl2 = testedClass.fieldByName("bl2"); + Field fsbt2 = testedClass.fieldByName("bt2"); + Field fsch2 = testedClass.fieldByName("ch2"); + Field fsdb2 = testedClass.fieldByName("db2"); + Field fsfl2 = testedClass.fieldByName("fl2"); + Field fsin2 = testedClass.fieldByName("in2"); + Field fsln2 = testedClass.fieldByName("ln2"); + Field fssh2 = testedClass.fieldByName("sh2"); + + + log2("......loop of checks on each primitive type by performing statements like first one:"); + log2(" BooleanValue blv = (BooleanValue) thisobj.getValue(fsbl1);"); + for ( int i3 = 0; i3 < 8; i3++) { + + try { + + switch (i3) { + + case 0: + log2(" checking up on boolean"); + BooleanValue blv = (BooleanValue) thisobj.getValue(fsbl1); + + blv = (BooleanValue) thisobj.getValue(fsbl2); + break; + + case 1: + log2(" checking up on byte"); + ByteValue btv = (ByteValue) thisobj.getValue(fsbt1); + + btv = (ByteValue) thisobj.getValue(fsbt2); + break; + + case 2: + log2(" checking up on char"); + CharValue chv = (CharValue) thisobj.getValue(fsch1); + + chv = (CharValue) thisobj.getValue(fsch2); + break; + + case 3: + log2(" checking up on double"); + DoubleValue dbv = (DoubleValue) thisobj.getValue(fsdb1); + + dbv = (DoubleValue) thisobj.getValue(fsdb2); + break; + + case 4: + log2(" checking up on float"); + FloatValue flv = (FloatValue) thisobj.getValue(fsfl1); + + flv = (FloatValue) thisobj.getValue(fsfl2); + break; + + case 5: + log2(" checking up on int"); + IntegerValue inv = (IntegerValue) thisobj.getValue(fsin1); + + inv = (IntegerValue) thisobj.getValue(fsin2); + break; + + case 6: + log2(" checking up on long"); + LongValue lnv = (LongValue) thisobj.getValue(fsln1); + + lnv = (LongValue) thisobj.getValue(fsln2); + break; + + case 7: + log2(" checking up on short"); + ShortValue shv = (ShortValue) thisobj.getValue(fssh1); + + shv = (ShortValue) thisobj.getValue(fssh2); + break; + + + default : log3("ERROR: TEST ERROR: case: default:"); + expresult = returnCode1; + break; + + } // end of switch + + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException"); + expresult = returnCode1; + } catch ( ObjectCollectedException e ) { + log3("ERROR: ObjectCollectedException"); + expresult = returnCode1; + } catch ( VMMismatchException e ) { + log3("ERROR: VMMismatchException"); + expresult = returnCode1; + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + } // end of try + + } // end of for + + + } + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { +// Method method = (Method) testedclass.methodsByName(methodName).get(0); + Method method = (Method) threadClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = +// ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + ( (IntegerValue) threadClass.getValue(threadClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002/TestDescription.java new file mode 100644 index 00000000000..a67ce38b5a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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/ObjectReference/getValue/getvalue002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValue() + * complies with its spec: + * public Value getValue(Field sig) + * Gets the value of a given instance or static field in this object. + * The Field must be valid for this ObjectReference; + * that is, it must be from the mirrored object's class or + * a superclass of that class. + * Parameters: sig - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include static and instance fields of primitive types + * created in debuggee's second thread with the method ClassType.newInstance(). + * No exception is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValue.getvalue002; + * the debuggee program - nsk.jdi.ObjectReference.getValue.getvalue002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.getValue.getvalue002 + * nsk.jdi.ObjectReference.getValue.getvalue002a + * + * @comment make sure getvalue002a is compiled with full debug info + * @clean nsk.jdi.ObjectReference.getValue.getvalue002a + * @compile -g:lines,source,vars ../getvalue002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValue.getvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java new file mode 100644 index 00000000000..6e47f790924 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java @@ -0,0 +1,223 @@ +/* + * 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.ObjectReference.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue002 JDI test. + */ + +public class getvalue002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static getvalue002aTestClass obj = new getvalue002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValue()
    + * complies with its specification.
    + *
    + * The cases for testing include fields of following ClassTypes:
    + * Class type, Interface type, Class Array type, and
    + * primitive Array type
    + * The test works as follows.
    + * Upon launch, a debuggee informs a debugger of creating
    + * a tested object. The debugger gets mirrors of fields to test
    + * and compares types of returned Value object to expected ones.
    + */ + +public class getvalue003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValue/getvalue003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalue003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValue.getvalue003a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValue.getvalue003aTestClass"; + + //String mName = "nsk.jdi.ObjectReference.getValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + + String objName = "testObj"; + + String tClassObjName = "class2_0"; + String tClassArrayObjName = "cfc_0"; + String tIfaceObjName = "iface_0"; + String tPrimArrayObjName = "bl1"; + + + String className = "nsk.jdi.ObjectReference.getValue.getvalue003aTestClass"; + + String tClassTypeName = "nsk.jdi.ObjectReference.getValue.getvalue003aClassForCheck_2"; + String tClassArrayTypeName = "nsk.jdi.ObjectReference.getValue.getvalue003aClassForCheck[]"; + String tIfaceTypeName = "nsk.jdi.ObjectReference.getValue.getvalue003aClassForCheck_2"; + String tPrimArrayTypeName = "boolean[][][][]"; + + + Field field1 = null; + Field field2 = null; + Value val1 = null; + Value val2 = null; + Type type1 = null; + String str = null; + + ObjectReference objRef = null; + + ReferenceType classRef = null; + + + log2("......getting the mirror of tested getvalue003aTestClass obj : ObjectReference objRef"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef = (ObjectReference) val1; + + log2("......getting the mirror of tested getvalue003aTestClass : ReferenceType classRef"); + + classes = vm.classesByName(testedClassName); + classRef = (ReferenceType) classes.get(0); + + + log2("......checking up on class ClassType Field: getvalue003aClassForCheck_2 class2_0"); + + field2 = classRef.fieldByName(tClassObjName); + val2 = objRef.getValue(field2); + type1 = val2.type(); + str = type1.name(); + + if (!str.equals(tClassTypeName)) { + log3("ERROR: type of Value != nsk.jdi.ObjectReference.getValue.getvalue003aClassForCheck_2"); + log3("ERROR: type of Value == " + str); + testExitCode = FAILED; + } + + + log2("......checking up on class ArrayType Field: getvalue003aClassForCheck[] cfc_0"); + + field2 = classRef.fieldByName(tClassArrayObjName); + val2 = objRef.getValue(field2); + type1 = val2.type(); + str = type1.name(); + + if (!str.equals(tClassArrayTypeName)) { + log3("ERROR: type of Value != nsk.jdi.ObjectReference.getValue.getvalue003aClassForCheck[]"); + log3("ERROR: type of Value == " + str); + testExitCode = FAILED; + } + + + log2("......checking up on class InterfaceType Field: getvalue003aInterfaceForCheck iface_0"); + + field2 = classRef.fieldByName(tIfaceObjName); + val2 = objRef.getValue(field2); + type1 = val2.type(); + str = type1.name(); + + if (!str.equals(tIfaceTypeName)) { + log3("ERROR: type of Value != nsk.jdi.ObjectReference.getValue.getvalue003aClassForCheck_2"); + log3("ERROR: type of Value == " + str); + testExitCode = FAILED; + } + + + log2("......checking up on class PrimitiveArrayType Field: boolean[][][][] bl1"); + + field2 = classRef.fieldByName(tPrimArrayObjName); + val2 = objRef.getValue(field2); + type1 = val2.type(); + str = type1.name(); + + if (!str.equals(tPrimArrayTypeName)) { + log3("ERROR: type of Value != boolean[][][][]"); + log3("ERROR: type of Value == " + str); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003/TestDescription.java new file mode 100644 index 00000000000..54218cd2e57 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/getValue/getvalue003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValue() + * complies with its spec: + * public Value getValue(Field sig) + * Gets the value of a given instance or static field in this object. + * The Field must be valid for this ObjectReference; + * that is, it must be from the mirrored object's class or + * a superclass of that class. + * Parameters: sig - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include Class type, Interface type, Class Array type, + * and primitive Array type objects. + * No exception is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValue.getvalue003; + * the debuggee program - nsk.jdi.ObjectReference.getValue.getvalue003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.getValue.getvalue003 + * nsk.jdi.ObjectReference.getValue.getvalue003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValue.getvalue003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003a.java new file mode 100644 index 00000000000..daa53efc19d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003a.java @@ -0,0 +1,167 @@ +/* + * 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.ObjectReference.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue003 JDI test. + */ + +public class getvalue003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static getvalue003aTestClass testObj = new getvalue003aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValue()
    + * complies with its specification.
    + *
    + * The case for testing includes throwing IllegalArgumentException
    + *
    + * The test works as follows.
    + * Upon launch, a debuggee informs a debugger of creating
    + * a tested object. The debugger gets mirror of a field
    + * in another class type object and uses it as an argument.
    + * The expected result of invoking the method is the Exception.
    + */ + +public class getvalue004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValue/getvalue004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalue004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValue.getvalue004a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValue.getvalue004aTestClass"; + + //String mName = "nsk.jdi.ObjectReference.getValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + String tClassObjName = "class2_0"; + String objName = "testObj"; + String obj1Name = "PASSED"; + + Field field1 = null; + Field field2 = null; + Value val1 = null; + Value val2 = null; + + ObjectReference objRef = null; + + + log2("......getting the mirror of tested getvalue004aTestClass obj : ObjectReference objRef"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef = (ObjectReference) val1; + + log2("......getting the mirror of a field in another class"); + field1 = debuggeeClass.fieldByName(obj1Name); + + log2("......performing the check; IllegalArgumentException is expected"); + try { + val2 = objRef.getValue(field1); + log3("ERROR: no IllegalArgumentException"); + testExitCode = FAILED; + } catch ( IllegalArgumentException e ) { + log2(" IllegalArgumentException"); + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004/TestDescription.java new file mode 100644 index 00000000000..c5762cf87b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/ObjectReference/getValue/getvalue004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValue() + * complies with its spec: + * public Value getValue(Field sig) + * Gets the value of a given instance or static field in this object. + * The Field must be valid for this ObjectReference; + * that is, it must be from the mirrored object's class or + * a superclass of that class. + * Parameters: sig - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The case for testing includes throwing IllegalArgumentException. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValue.getvalue004; + * the debuggee program - nsk.jdi.ObjectReference.getValue.getvalue004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.getValue.getvalue004 + * nsk.jdi.ObjectReference.getValue.getvalue004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValue.getvalue004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004a.java new file mode 100644 index 00000000000..e480ac4c9b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004a.java @@ -0,0 +1,167 @@ +/* + * 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.ObjectReference.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue004 JDI test. + */ + +public class getvalue004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static getvalue004aTestClass testObj = new getvalue004aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValues()
    + * complies with its specification.
    + *

    + * The case for tesing includes fields in the following object:
    + * class getvalues001aTestClass extends getvalues001aTestClass1
    + * when both classes contain class and instance fields of
    + * primitive types.
    + *
    + * The test works as follows:
    + * Upon launch, a debuggee informs a debuggee of creating
    + * the tested object.
    + * The debugger gets a Map of objects and checks up that:
    + * - the Map contains the tested number of elements and
    + * - the Map doesn't contain duplications.
    + */ + +public class getvalues001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValues/getvalues001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalues001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValues.getvalues001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValues.getvalues001aTestClass"; + + //String mName = "nsk.jdi.ObjectReference.getValues"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + + Field field1 = null; + Value val1 = null; + List fields = null; + + String objName = "testObj"; + + ObjectReference objRef = null; + + ReferenceType testedClass = null; + + + log2("......getting the mirror of tested getvalues001aTestClass obj : ObjectReference objRef"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef = (ObjectReference) val1; + + log2("......getting the mirror of tested getvalues001aTestClass : ReferenceType classRef"); + + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + fields = testedClass.visibleFields(); + + + String [] names = { "bl1", "bl2", + "bt1", "bt2", + "ch1", "ch2", + "db1", "db2", + "fl1", "fl2", + "in1", "in2", + "ln1", "ln2", + "sh1", "sh2" }; + + Field [] fArray = { + testedClass.fieldByName(names[ 0]), testedClass.fieldByName(names[ 1]), + testedClass.fieldByName(names[ 2]), testedClass.fieldByName(names[ 3]), + testedClass.fieldByName(names[ 4]), testedClass.fieldByName(names[ 5]), + testedClass.fieldByName(names[ 6]), testedClass.fieldByName(names[ 7]), + testedClass.fieldByName(names[ 8]), testedClass.fieldByName(names[ 9]), + testedClass.fieldByName(names[10]), testedClass.fieldByName(names[11]), + testedClass.fieldByName(names[12]), testedClass.fieldByName(names[13]), + testedClass.fieldByName(names[14]), testedClass.fieldByName(names[15]) }; + + + log2("......getting the Map of tested fields : Map vMap = objRef.getValues(fields);"); + + Map vMap = objRef.getValues(fields); + Set keySet = vMap.keySet(); + Iterator si = keySet.iterator(); + + Field f1 = null; + + int flag = 0; + int controlFlag = 0xFFFF; + + log2("......loop of testing the Map"); + + for (int ifor = 0; si.hasNext(); ifor++) { + + f1 = si.next(); + + int flag1 = 0; + for (int ifor1 = 0; ifor1 < 16; ifor1++) { + + if (f1.equals(fArray[ifor1])) { + if (flag1 == 0) { + flag1++; + flag |= 1 << ifor1; + break; + } else { + log3("ERROR: duplication in the Map; ifor = " + ifor + " ifor1 = " + ifor1); + testExitCode = FAILED; + } + } + } + } + if (flag != controlFlag) { + log3("ERROR: returned Map object doesn't contain all tested fields"); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001/TestDescription.java new file mode 100644 index 00000000000..157e11b5d07 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/getValues/getvalues001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValues() + * complies with its spec: + * public Map getValues(List fields) + * Gets the value of multiple instance and/or static fields in this object. + * The Fields must be valid for this ObjectReference; that is, + * they must be from the mirrored object's class or a superclass of that class. + * Parameters: fields - a list of Field objects containing the requested values. + * Returns: a Map of the requested Field objects with their Value. + * Throws: IllegalArgumentException - + * if any field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The case for tesing includes fields in the following object: + * class TestClass extends TestClass1 + * when both classes contain class and instance fields of primitive types. + * IllegalArgumentException is not expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValues.getvalues001; + * the debuggee program - nsk.jdi.ObjectReference.getValues.getvalues001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.getValues.getvalues001 + * nsk.jdi.ObjectReference.getValues.getvalues001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValues.getvalues001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001a.java new file mode 100644 index 00000000000..730367cde8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001a.java @@ -0,0 +1,141 @@ +/* + * 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.ObjectReference.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalues001 JDI test. + */ + +public class getvalues001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static getvalues001aTestClass testObj = new getvalues001aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValues()
    + * complies with its specification.
    + *

    + * The case for tesing includes fields in the following object:
    + * class getvalues002aTestClass extends getvalues002aTestClass1
    + * when both classes contain class and instance fields of
    + * Class Interface and Array types.
    + *
    + * The test works as follows:
    + * Upon launch, a debuggee informs a debuggee of creating
    + * the tested object.
    + * The debugger gets a Map of objects and checks up that:
    + * - the Map contains the tested number of elements and
    + * - the Map doesn't contain duplications.
    + */ + +public class getvalues002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValues/getvalues002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalues002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValues.getvalues002a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValues.getvalues002aTestClass"; + + //String mName = "nsk.jdi.ObjectReference.getValues"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + + Field field1 = null; + Value val1 = null; + List fields = null; + + String objName = "testObj"; + + ObjectReference objRef = null; + + ReferenceType testedClass = null; + + + log2("......getting the mirror of tested getvalues002aTestClass obj : ObjectReference objRef"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef = (ObjectReference) val1; + + log2("......getting the mirror of tested getvalues002aTestClass : ReferenceType classRef"); + + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + fields = testedClass.visibleFields(); + + + String [] names = { "class2_0", "iface_0", + "cfc_0", "bl0" }; + + Field [] fArray = { + testedClass.fieldByName(names[ 0]), testedClass.fieldByName(names[ 1]), + testedClass.fieldByName(names[ 2]), testedClass.fieldByName(names[ 3]) }; + + + + log2("......getting the Map of tested fields : Map vMap = objRef.getValues(fields);"); + + Map vMap = objRef.getValues(fields); + Set keySet = vMap.keySet(); + Iterator si = keySet.iterator(); + + Field f1 = null; + + int flag = 0; + int controlFlag = 0xF; + + log2("......loop of testing the Map"); + + for (int ifor = 0; si.hasNext(); ifor++) { + + f1 = si.next(); + + int flag1 = 0; + for (int ifor1 = 0; ifor1 < 4; ifor1++) { + + if (f1.equals(fArray[ifor1])) { + if (flag1 == 0) { + flag1++; + flag |= 1 << ifor1; + break; + } else { + log3("ERROR: duplication in the Map; ifor = " + ifor + " ifor1 = " + ifor1); + testExitCode = FAILED; + } + } + } + } + if (flag != controlFlag) { + log3("ERROR: returned Map object doesn't contain all tested fields"); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002/TestDescription.java new file mode 100644 index 00000000000..0a29af3cbcf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002/TestDescription.java @@ -0,0 +1,86 @@ +/* + * 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/ObjectReference/getValues/getvalues002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValues() + * complies with its spec: + * public Map getValues(List fields) + * Gets the value of multiple instance and/or static fields in this object. + * The Fields must be valid for this ObjectReference; that is, + * they must be from the mirrored object's class or a superclass of that class. + * Parameters: fields - a list of Field objects containing the requested values. + * Returns: a Map of the requested Field objects with their Value. + * Throws: IllegalArgumentException - + * if any field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The case for tesing includes fields in the following object: + * class TestClass extends TestClass1 + * when both classes contain class and instance fields of + * Class Interface and Array types. + * IllegalArgumentException is not expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValues.getvalues002; + * the debuggee program - nsk.jdi.ObjectReference.getValues.getvalues002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.getValues.getvalues002 + * nsk.jdi.ObjectReference.getValues.getvalues002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValues.getvalues002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002a.java new file mode 100644 index 00000000000..e57ef7567da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002a.java @@ -0,0 +1,172 @@ +/* + * 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.ObjectReference.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalues002 JDI test. + */ + +public class getvalues002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static getvalues002aTestClass testObj = new getvalues002aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.getValues()
    + * complies with its specification.
    + *

    + * The case for tesing includes fields in two objects of two
    + * different classes: getvalues003aTestClass and getvalues003aTestClass1
    + * As List of arguments contains Fileds defined in another class
    + * throwing IllegalArgumentException is expected.
    + *
    + * The test works as follows:
    + * Upon launch, a debuggee informs a debuggee of creating
    + * the tested object.
    + * The debugger gets a List of fields from the getvalues003aTestClass1 object1
    + * and uses it as the argument for get.Values() invoked on
    + * getvalues003aTestClass object.
    + */ + +public class getvalues003{ + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/getValues/getvalues003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalues003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.getValues.getvalues003a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValues.getvalues003aTestClass"; + + private String testedClass1Name = + "nsk.jdi.ObjectReference.getValues.getvalues003aTestClass1"; + + //String mName = "nsk.jdi.ObjectReference.getValues"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + + Field field1 = null; + Value val1 = null; + List fields = null; + + String objName = "testObj"; + String obj1Name = "testObj1"; + + ObjectReference objRef = null; + + ReferenceType testedClass = null; + + + log2("......getting the mirror of tested getvalues003aTestClass obj : ObjectReference objRef"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef = (ObjectReference) val1; + + log2("......getting the mirror of tested getvalues003aTestClass : ReferenceType classRef"); + + classes = vm.classesByName(testedClass1Name); + testedClass = (ReferenceType) classes.get(0); + fields = testedClass.visibleFields(); + + + log2("......performing the check; IllegalArgumentException is expected"); + try { + Map vMap = objRef.getValues(fields); + log3("ERROR: no IllegalArgumentException"); + testExitCode = FAILED; + } catch ( IllegalArgumentException e ) { + log2(" IllegalArgumentException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003/TestDescription.java new file mode 100644 index 00000000000..30b88917f7d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ObjectReference/getValues/getvalues003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.getValues() + * complies with its spec: + * public Map getValues(List fields) + * Gets the value of multiple instance and/or static fields in this object. + * The Fields must be valid for this ObjectReference; that is, + * they must be from the mirrored object's class or a superclass of that class. + * Parameters: fields - a list of Field objects containing the requested values. + * Returns: a Map of the requested Field objects with their Value. + * Throws: IllegalArgumentException - + * if any field is not valid for this object's class. + * ObjectCollectedException - + * if this object has been garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The case for testing includes throwing IllegalArgumentException . + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.getValues.getvalues003; + * the debuggee program - nsk.jdi.ObjectReference.getValues.getvalues003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.getValues.getvalues003 + * nsk.jdi.ObjectReference.getValues.getvalues003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.getValues.getvalues003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003a.java new file mode 100644 index 00000000000..be643a6e3ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003a.java @@ -0,0 +1,174 @@ +/* + * 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.ObjectReference.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalues003 JDI test. + */ + +public class getvalues003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static getvalues003aTestClass testObj = new getvalues003aTestClass(); + static getvalues003aTestClass1 testObj1 = new getvalues003aTestClass1(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.hashCode()
    + * complies with its specification.
    + * The case for testing incliudes two ObjectReference objects
    + * beloning to the same VM.
    + *
    + * The test works as follows.
    + * Upon launch, a debuggee infroms a debugger of creating
    + * tested objects.
    + * The debuggee gets two ObjectReference objRef1 and objRef2
    + * mirroring the same object in the debuggee, and
    + * ObjectReference objRef3 mirroring another object.
    + * Then it checks up that
    + * - objRef1.hashCode() == objRef2.hashCode()
    + * - objRef1.hashCode() != objRef3.hashCode()
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/hashCode/hashcode001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.hashCode.hashcode001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.getValues.TestClass"; + + private String testedClass1Name = + "nsk.jdi.ObjectReference.getValues.TestClass1"; + + //String mName = "nsk.jdi.ObjectReference.hashCode"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + log2("......getting: List classes = vm.classesByName(debuggeeName); expected size == 1"); + classes = vm.classesByName(debuggeeName); + int size = classes.size(); + if (size != 1) { + log3("ERROR: classes.size() != 1 : " + size); + testExitCode = FAILED; + break ; + } + + log2(" getting ReferenceType and ClassType objects for debuggeeClass"); + ReferenceType debuggeeClass = (ReferenceType) classes.get(0); + + + Field field1 = null; + Value val1 = null; + List fields = null; + + String objName = "testObj"; + String obj1Name = "testObj1"; + + ObjectReference objRef1 = null; + ObjectReference objRef2 = null; + ObjectReference objRef3 = null; + + + log2("......getting first mirror of tested TestClass obj : ObjectReference objRef1"); + + field1 = debuggeeClass.fieldByName(objName); + val1 = debuggeeClass.getValue(field1); + objRef1 = (ObjectReference) val1; + + + log2("......getting second mirror of tested TestClass obj : ObjectReference objRef2"); + + objRef2 = (ObjectReference) val1; + + + log2("......getting amirror of tested TestClass1 obj : ObjectReference objRef3"); + + field1 = debuggeeClass.fieldByName(obj1Name); + val1 = debuggeeClass.getValue(field1); + objRef3 = (ObjectReference) val1; + + + log2("......testing equality of hashCodes of objRef1 and objRef2"); + if (objRef1.hashCode() != objRef2.hashCode()) { + log3("ERROR: objRef1.hashCode() is not equal to objRef2.hashCode()"); + testExitCode = FAILED; + } + + log2("......testing inequality of hashCodes of objRef1 and objRef3"); + if (objRef1.hashCode() == objRef3.hashCode()) { + log3("ERROR: objRef1.hashCode() is equal to objRef3.hashCode()"); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..35b554bfad8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001/TestDescription.java @@ -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/ObjectReference/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this ObjectReference. + * Returns: the integer hash code + * Overrides: hashCode in class java.lang.Object + * The case for testing includes objects beloning to the same VM. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.hashCode.hashcode001; + * the debuggee program - nsk.jdi.ObjectReference.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.hashCode.hashcode001 + * nsk.jdi.ObjectReference.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001a.java new file mode 100644 index 00000000000..302d020ed48 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001a.java @@ -0,0 +1,174 @@ +/* + * 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.ObjectReference.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the hashcode001 JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + static TestClass1 testObj1 = new TestClass1(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.invokeMethod()
    + * complies with its spec when invoked methods are of
    + * all primitive types and the void type.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger invokes debuggee's methods:
    + * boolean blValue();
    + * byte btValue();
    + * char chValue();
    + * double dbValue();
    + * float flValue();
    + * int inValue();
    + * long lnValue();
    + * short shValue();
    + * void vdValue();
    + * and checks up that returned Value objects are
    + * corresponding PrimitiveValue objects and
    + * a VoidValue object.
    + *
    + */ + +public class invokemethod001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/invokeMethod/invokemethod001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new invokemethod001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.invokeMethod.Threadinvokemethod001a"; + + //String mName = "nsk.jdi.ObjectReference.invokeMethod"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + ObjectReference threadObjRef = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + if (thread2 == null) { + log3("ERROR: didn't find thread '" + threadName + "'"); + expresult = returnCode1; + break label0; + } + + threadObjRef = thread2; + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + Value returnValue = null; + + String methodNamnes[] = {"blValue" , "btValue" , + "chValue" , "dbValue" , + "flValue" , "inValue" , + "lnValue" , "shValue" , + "vdValue" }; + + String types[] = { "BooleanValue", "ByteValue", "CharValue", + "DoubleValue", "FloatValue", "IntegerValue", + "LongValue", "ShortValue", "VoidValue" }; + + log2(" beginning of invoking methods"); + label: { + for (int i3 = 0; i3 <= 8; i3++) { + + log2(" checking up " + types[i3] + " method"); + + List invokeMethods = + testedclass.methodsByName(methodNamnes[i3]); + Method invokeMethod = (Method) invokeMethods.get(0); + + List argumentList = invokeMethods; + argumentList.clear(); + + try { + returnValue = + threadObjRef.invokeMethod(thread2, + invokeMethod, Collections.emptyList(), 0); + } catch ( Exception t ) { + log3("ERROR: Exception for classType.invokeMethod :" + t); + expresult = returnCode1; + continue; + } + + try { + switch (i3) { + + case 0: + BooleanValue blValue = (BooleanValue) returnValue; + break; + + case 1: + ByteValue btValue = (ByteValue) returnValue; + break; + + case 2: + CharValue chValue = (CharValue) returnValue; + break; + + case 3: + DoubleValue dbValue = (DoubleValue) returnValue; + break; + + case 4: + FloatValue flValue = (FloatValue) returnValue; + break; + + + case 5: + IntegerValue inValue = (IntegerValue) returnValue; + break; + + case 6: + LongValue lnValue = (LongValue) returnValue; + break; + + case 7: + ShortValue shValue = (ShortValue) returnValue; + break; + + case 8: + VoidValue vdValue = (VoidValue) returnValue; + break; + + default: log3("ERROR : switch (i3) executes 'default:'"); + expresult = returnCode1; + break label; + } + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException for: " + types[i3] + " 'returnValue'"); + expresult = returnCode1; + break label; + } // try + } // for + } // label: + + log2(" end of checks"); + log2(" resuming VirtualMachine"); + vm.resume(); + + } + vm.resume(); // for case if thread2 was not resumed because of error in a check + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001/TestDescription.java new file mode 100644 index 00000000000..590bff95904 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/ObjectReference/invokeMethod/invokemethod001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.invokeMethod() + * complies with its spec: + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.invokeMethod.invokemethod 00; + * the debuggee program - nsk.jdi.ObjectReference.invokeMethod.invokemethod 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * #4737294 testbug: + * For a void method return value should be null. + * 4773425 TEST_BUG: invokemethod001 test failing on all platforms + * Previous changes of 4737294 bug fix are deleted. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod001 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java new file mode 100644 index 00000000000..d0bca2b31d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java @@ -0,0 +1,219 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the invokemethod001 JDI test. + */ + +public class invokemethod001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ObjectReference.invokeMethod() + * properly throws IllegalArgumentException when + * debugger part of the test attempts to invoke several + * debuggee methods: + *
  • which are not members of an object's class + *
  • which are constructors or static intializers + *
  • with the size mismatch of an argument list. + */ +public class invokemethod002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod002t"; + + // tested debuggee methods and type/object reference numbers + static final int METH_NUM = 14; + static final String DEBUGGEE_METHODS[][] = { + {"", "0", "0"}, + {"", "0", "0"}, + {"", "1", "0"}, + {"", "1", "0"}, + {"byteMeth", "1", "0"}, + {"shortMeth", "1", "0"}, + {"intMeth", "1", "0"}, + {"longMeth", "1", "0"}, + {"floatMeth", "1", "0"}, + {"doubleMeth", "1", "0"}, + {"charMeth", "1", "0"}, + {"booleanMeth", "1", "0"}, + {"strMeth", "1", "0"}, + {"voidMeth", "1", "0"} + }; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod002tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 62; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "invokemethod002tdummyCls"; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private ObjectReference[] objRef = new ObjectReference[2]; + private ReferenceType[] rType = new ReferenceType[2]; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod002().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod002t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + rType[0] = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + findObjRef(DEBUGGEE_LOCALVAR); + rType[1] = objRef[1].referenceType(); // debuggee dummy class + + // provoke the IllegalArgumentException with the wrong methods + provokeException(Collections.emptyList(), true); + + // provoke the IllegalArgumentException with the wrong argument list + provokeException( + Collections.singletonList(vm.mirrorOf(9223372036854775807L)), + false); + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void provokeException(List argList, boolean use3rdIndex) { + int objIndex; + + for (int i=0; i method + + invokemethod002t() {} // force javac to produce method + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod002t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + invokemethod002tDummyClass invokemethod002tdummyCls = new invokemethod002tDummyClass(); + + Thread.currentThread().setName(invokemethod002.DEBUGGEE_THRNAME); + + pipe.println(invokemethod002.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod002.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod002.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod002.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy class used to provoke IllegalArgumentException in the debugger +class invokemethod002tDummyClass { + static {} // force javac to produce method + + invokemethod002tDummyClass() {} // force javac to produce method + + byte byteMeth() { + return 127; + } + + short shortMeth() { + return -32768; + } + + int intMeth() { + return 2147483647; + } + + long longMeth() { + return 9223372036854775807L; + } + + float floatMeth() { + return 5.1F; + } + + double doubleMeth() { + return 6.2D; + } + + char charMeth() { + return 'a'; + } + + boolean booleanMeth() { + return false; + } + + String strMeth() { + return "string method"; + } + + void voidMeth() {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003.java new file mode 100644 index 00000000000..366434f5c8d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003.java @@ -0,0 +1,348 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws IllegalArgumentException when + * debugger part of the test attempts to invoke several + * debuggee methods with the flag ObjectReference.INVOKE_NONVIRTUAL + * and these methods: + *
  • belong to an interface + *
  • are abstract ones + */ +public class invokemethod003 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod003t"; + + static final String DEBUGGEE_INTERFACE = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod003tDummyInterface"; + + static final String DEBUGGEE_ABSTRACTCLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod003tDummyAbstractCls"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod003tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 59; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod003tdummyCls"; + + // tested debuggee methods and type reference numbers + static final int METH_NUM = 20; + static final String DEBUGGEE_METHODS[][] = { + {"byteMeth", "1"}, + {"shortMeth", "1"}, + {"intMeth", "1"}, + {"longMeth", "1"}, + {"floatMeth", "1"}, + {"doubleMeth", "1"}, + {"charMeth", "1"}, + {"booleanMeth", "1"}, + {"strMeth", "1"}, + {"voidMeth", "1"}, + {"absByteMeth", "2"}, + {"absShortMeth", "2"}, + {"absIntMeth", "2"}, + {"absLongMeth", "2"}, + {"absFloatMeth", "2"}, + {"absDoubleMeth", "2"}, + {"absCharMeth", "2"}, + {"absBooleanMeth", "2"}, + {"absStrMeth", "2"}, + {"absVoidMeth", "2"} + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod003().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod003t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[3]; + // debuggee main class + rType[0] = debuggee.classByName(DEBUGGEE_CLASS); + // debuggee dummy interface + rType[1] = debuggee.classByName(DEBUGGEE_INTERFACE); + // debuggee dummy abstract class + rType[2] = debuggee.classByName(DEBUGGEE_ABSTRACTCLASS); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + + for (int i=0; iemptyList(), ObjectReference.INVOKE_NONVIRTUAL); + + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" and the flag ObjectReference.INVOKE_NONVIRTUAL"); + tot_res = Consts.TEST_FAILED; + } catch (IllegalArgumentException ia) { + log.display("CHECK PASSED: caught expected " + ia); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected llegalArgumentException" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" and the flag ObjectReference.INVOKE_NONVIRTUAL"); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003/TestDescription.java new file mode 100644 index 00000000000..aa4929a277a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() properly throws + * IllegalArgumentException when debugger part of the test + * attempts to invoke several debuggee methods with the flag + * ObjectReference.INVOKE_NONVIRTUAL and these methods: + * - belong to an interface; + * - are abstract ones. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod003 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod003t + * + * @comment make sure invokemethod003t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod003t + * @compile -g:lines,source,vars ../invokemethod003t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003t.java new file mode 100644 index 00000000000..be465b61070 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003t.java @@ -0,0 +1,194 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class invokemethod003t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod003t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + invokemethod003tDummyClass invokemethod003tdummyCls = new invokemethod003tDummyClass(); + + Thread.currentThread().setName(invokemethod003.DEBUGGEE_THRNAME); + + pipe.println(invokemethod003.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod003.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod003.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod003.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy interface & abstract class used to provoke +// IllegalArgumentException in the debugger +interface invokemethod003tDummyInterface { + byte byteMeth(); + + short shortMeth(); + + int intMeth(); + + long longMeth(); + + float floatMeth(); + + double doubleMeth(); + + char charMeth(); + + boolean booleanMeth(); + + String strMeth(); + + void voidMeth(); +} + +abstract class invokemethod003tDummyAbstractCls { + abstract byte absByteMeth(); + + abstract short absShortMeth(); + + abstract int absIntMeth(); + + abstract long absLongMeth(); + + abstract float absFloatMeth(); + + abstract double absDoubleMeth(); + + abstract char absCharMeth(); + + abstract boolean absBooleanMeth(); + + abstract String absStrMeth(); + + abstract void absVoidMeth(); +} + +class invokemethod003tDummyClass extends invokemethod003tDummyAbstractCls implements invokemethod003tDummyInterface { + public byte byteMeth() { + return 127; + } + + public short shortMeth() { + return -32768; + } + + public int intMeth() { + return 2147483647; + } + + public long longMeth() { + return 9223372036854775807L; + } + + public float floatMeth() { + return 5.1F; + } + + public double doubleMeth() { + return 6.2D; + } + + public char charMeth() { + return 'a'; + } + + public boolean booleanMeth() { + return false; + } + + public String strMeth() { + return "string method"; + } + + public void voidMeth() {} + + byte absByteMeth() { + return 127; + } + + public short absShortMeth() { + return 32767; + } + + public int absIntMeth() { + return 2147483647; + } + + public long absLongMeth() { + return 9223372036854775807L; + } + + public float absFloatMeth() { + return 5.1F; + } + + public double absDoubleMeth() { + return 6.2D; + } + + public char absCharMeth() { + return 'a'; + } + + public boolean absBooleanMeth() { + return true; + } + + public String absStrMeth() { + return "string method"; + } + + public void absVoidMeth() {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004.java new file mode 100644 index 00000000000..0b815182252 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004.java @@ -0,0 +1,239 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws IncompatibleThreadStateException when + * debugger part of the test attempts to invoke several + * debuggee methods when the debuggee thread has been suspended + * by the ThreadReference.suspend() instead of by an event. + */ +public class invokemethod004 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod004t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod004tThr"; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod004tdummyCls"; + + // tested debuggee methods and type reference numbers + static final int METH_NUM = 10; + static final String DEBUGGEE_METHODS[] = { + "byteMeth", + "shortMeth", + "intMeth", + "longMeth", + "floatMeth", + "doubleMeth", + "charMeth", + "booleanMeth", + "strMeth", + "voidMeth" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int ATTEMPTS = 5; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod004().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod004t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: unable to suspend debuggee thread"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee thread suspension ..."); + try { + Thread.currentThread().sleep(1000); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + +// Check the tested assersion + try { + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + ReferenceType rType = objRef.referenceType(); // debuggee dummy class + + for (int i=0; i methList = rType.methodsByName(DEBUGGEE_METHODS[i]); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHODS[i] + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + continue; + } + Method meth = methList.get(0); + + try { + log.display("\nTrying to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" and the thread reference which has not been suspended by an event ..."); + + objRef.invokeMethod(thrRef, meth, Collections.emptyList(), 0); + + log.complain("TEST FAILED: expected IncompatibleThreadStateException was not thrown" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" and the thread reference which has not been suspended by an event."); + tot_res = Consts.TEST_FAILED; + } catch (IncompatibleThreadStateException is) { + log.display("CHECK PASSED: caught expected " + is); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected IncompatibleThreadStateException" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" and the thread reference which has not been suspended by an event."); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private int quitDebuggee() { + if (thrRef != null) { + if (thrRef.isSuspended()) + thrRef.resume(); + } + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004/TestDescription.java new file mode 100644 index 00000000000..174544fcd97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ObjectReference/invokeMethod/invokemethod004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() properly throws + * IncompatibleThreadStateException when debugger part of the test + * attempts to invoke several debuggee methods when the debuggee + * thread has been suspended by the ThreadReference.suspend() + * instead of by an event. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod004 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod004t + * + * @comment make sure invokemethod004t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod004t + * @compile -g:lines,source,vars ../invokemethod004t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004t.java new file mode 100644 index 00000000000..2e90c83caad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004t.java @@ -0,0 +1,99 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee class. + */ +public class invokemethod004t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod004t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + invokemethod004tDummyClass invokemethod004tdummyCls = new invokemethod004tDummyClass(); + Thread.currentThread().setName(invokemethod004.DEBUGGEE_THRNAME); + + pipe.println(invokemethod004.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(invokemethod004.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy class used to provoke IncompatibleThreadStateException in the debugger +class invokemethod004tDummyClass { + byte byteMeth() { + return 127; + } + + short shortMeth() { + return -32768; + } + + int intMeth() { + return 2147483647; + } + + long longMeth() { + return 9223372036854775807L; + } + + float floatMeth() { + return 5.1F; + } + + double doubleMeth() { + return 6.2D; + } + + char charMeth() { + return 'a'; + } + + boolean booleanMeth() { + return false; + } + + String strMeth() { + return "string method"; + } + + void voidMeth() {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005.java new file mode 100644 index 00000000000..c6cb2c1aa88 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005.java @@ -0,0 +1,321 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws InvocationException when + * debugger part of the test invokes several debuggee methods + * which throw runtime ArithmeticException, + * NumberFormatException, IllegalMonitorStateException, + * own "Failure", and finally the Error instance. + */ +public class invokemethod005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod005t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod005tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 58; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod005tdummyCls"; + + // tested debuggee methods and type reference numbers + static final int METH_NUM = 5; + static final String DEBUGGEE_METHODS[] = { + "arithmeticMeth", + "numberFormatMeth", + "illegalMonitorMeth", + "failureMeth", + "errorMeth" + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod005().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod005t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[2]; + // debuggee main class + rType[0] = debuggee.classByName(DEBUGGEE_CLASS); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + rType[1] = objRef.referenceType(); // debuggee dummy class + + for (int i=0; i methList = rType[1].methodsByName(DEBUGGEE_METHODS[i]); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHODS[i] + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + continue; + } + Method meth = methList.get(0); + + try { + log.display("\nTrying to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + objRef.invokeMethod(thrRef, meth, Collections.emptyList(), 0); + + log.complain("TEST FAILED: expected InvocationException was not thrown" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } catch (InvocationException ie) { + log.display("CHECK PASSED: caught expected " + ie + + "\n\t" + ie.exception()); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected InvocationException" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005/TestDescription.java new file mode 100644 index 00000000000..1f5ea6f5b0c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() properly throws + * InvocationException when debugger part of the test + * invokes several debuggee methods which throw runtime + * ArithmeticException, NumberFormatException, + * IllegalMonitorStateException, own "Failure" exception, and + * finally the Error instance. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod005 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod005t + * + * @comment make sure invokemethod005t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod005t + * @compile -g:lines,source,vars ../invokemethod005t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005t.java new file mode 100644 index 00000000000..4e512eaecc5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005t.java @@ -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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class invokemethod005t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod005t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + invokemethod005tDummyClass invokemethod005tdummyCls = new invokemethod005tDummyClass(); + Thread.currentThread().setName(invokemethod005.DEBUGGEE_THRNAME); + + pipe.println(invokemethod005.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod005.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod005.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod005.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy class used to provoke InvocationException in the debugger +class invokemethod005tDummyClass { + // provoke runtime ArithmeticException + boolean arithmeticMeth() { + int i = 10 / Integer.parseInt("0"); + return true; + } + + // provoke runtime NumberFormatException + int numberFormatMeth() { + int i = Integer.parseInt("oops!"); + return 2147483647; + } + + // provoke runtime IllegalMonitorStateException + long illegalMonitorMeth() { + Object obj = new Object(); + obj.notify(); + return 9223372036854775807L; + } + + // throw own runtime exception Failure + void failureMeth() { + throw new Failure("Catch me!"); + } + + // throw error exception + void errorMeth() { + throw new Error("Throw Error!"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006.java new file mode 100644 index 00000000000..90c324a99ea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006.java @@ -0,0 +1,329 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws ClassNotLoadedException when + * a debugger part of the test invokes several debuggee methods + * with arguments which reference types have not been loaded + * through the appropriate class loader. + */ +public class invokemethod006 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod006t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod006tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 58; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod006tdummyCls"; + + // tested debuggee methods, fields and reference types + static final int METH_NUM = 2; + static final String DEBUGGEE_METHODS[][] = { + {"dummyMeth", "nsk.jdi.ObjectReference.invokeMethod.invokemethod006tDummyType", + "Lnsk/jdi/ObjectReference/invokeMethod/invokemethod006tDummyType;"}, + {"finDummyMeth", "nsk.jdi.ObjectReference.invokeMethod.invokemethod006tFinDummyType", + "Lnsk/jdi/ObjectReference/invokeMethod/invokemethod006tFinDummyType;"} + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod006().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod006t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[2]; + // debuggee main class + rType[0] = debuggee.classByName(DEBUGGEE_CLASS); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + rType[1] = objRef.referenceType(); // debuggee dummy class + + for (int i=0; i methList = rType[1].methodsByName(DEBUGGEE_METHODS[i][0]); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHODS[i][0] + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + continue; + } + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(MockReferenceType.createObjectReference(objRef.virtualMachine(), + DEBUGGEE_METHODS[i][2], DEBUGGEE_METHODS[i][1])); + + try { + log.display("\nTrying to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + objRef.invokeMethod(thrRef, meth, argList, 0); + + // Make sure that the reference type is not loaded by the debuggee VM + if ((debuggee.classByName(DEBUGGEE_METHODS[i][2])) != null) { + log.display("Skipping the check: the tested reference type\n\t\"" + + DEBUGGEE_METHODS[i][1] + + "\"\n\twas loaded by the debuggee VM, unable to test an assertion"); + continue; + } + else { + log.complain("TEST FAILED: expected ClassNotLoadedException was not thrown" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } catch (ClassNotLoadedException ce) { + log.display("CHECK PASSED: caught expected " + ce + + "\n\t" + ce.className()); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected ClassNotLoadedException" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006/TestDescription.java new file mode 100644 index 00000000000..a5fab53e40e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod006. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-4698670 + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() properly throws + * ClassNotLoadedException when a debugger part of the test + * invokes several debuggee methods with arguments which + * reference types have not been loaded through the appropriate + * class loader. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod006 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod006t + * + * @comment make sure invokemethod006t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod006t + * @compile -g:lines,source,vars ../invokemethod006t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006t.java new file mode 100644 index 00000000000..625f6ead77c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod006t.java @@ -0,0 +1,88 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class invokemethod006t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod006t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + invokemethod006tDummyClass invokemethod006tdummyCls = new invokemethod006tDummyClass(); + Thread.currentThread().setName(invokemethod006.DEBUGGEE_THRNAME); + + pipe.println(invokemethod006.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod006.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod006.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod006.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy reference types used to provoke ClassNotLoadedException +// in the debugger +class invokemethod006tDummyType {} +final class invokemethod006tFinDummyType {} + +// Dummy class used to provoke ClassNotLoadedException +// in the debugger +class invokemethod006tDummyClass { + + void dummyMeth(invokemethod006tDummyType dummyT) { + System.err.println("the method \"dummyMeth\" was invoked!"); + } + + long finDummyMeth(invokemethod006tFinDummyType finDummyT) { + System.err.println("the method \"finDummyMeth\" was invoked!"); + return 9223372036854775807L; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007.java new file mode 100644 index 00000000000..327c69d82d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007.java @@ -0,0 +1,352 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws InvalidTypeException when + * a debugger part of the test invokes several debuggee methods + * with different kinds of arguments which are not assignment + * compatible with the argument type and not convertible without + * loss of information as well. + */ +public class invokemethod007 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod007t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod007tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 58; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod007tdummyCls"; + + // tested debuggee methods and fields used only to obtian their values + static final int METH_NUM = 19; + static final String DEBUGGEE_METHODS[][] = { + {"byteMeth", "sStrFld"}, + {"shortMeth", "intFld"}, + {"intMeth", "sLongFld"}, + {"longMeth", "floatFld"}, + {"floatMeth", "sDoubleFld"}, + {"doubleMeth", "sBooleanFld"}, + {"charMeth", "sStrFld"}, + {"booleanMeth", "sByteFld"}, + {"strMeth", "sCharFld"}, + {"dummyTMeth", "sByteFld"}, + {"dummyTMeth", "sShortFld"}, + {"dummyTMeth", "intFld"}, + {"dummyTMeth", "sLongFld"}, + {"dummyTMeth", "floatFld"}, + {"dummyTMeth", "sDoubleFld"}, + {"dummyTMeth", "sCharFld"}, + {"dummyTMeth", "sBooleanFld"}, + {"dummyTMeth", "sStrFld"}, + {"dummyTMeth", "wrongDummyType"} + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod007().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod007t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[2]; + // debuggee main class + rType[0] = debuggee.classByName(DEBUGGEE_CLASS); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + rType[1] = objRef.referenceType(); // debuggee dummy class + + for (int i=0; i argList = new LinkedList(); + argList.add(objRef.getValue( + rType[1].fieldByName(DEBUGGEE_METHODS[i][1]))); + + try { + log.display("\nTrying to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\twith the arguments: " + + rType[1].fieldByName(DEBUGGEE_METHODS[i][1]) + " " + argList + + "\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + objRef.invokeMethod(thrRef, meth, argList, 0); + + log.complain("TEST FAILED: expected InvalidTypeException was not thrown" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \""+ rType[1].fieldByName(DEBUGGEE_METHODS[i][1]) + " " + rType[1] + + "\"\n\twith the arguments: " + + rType[1].fieldByName(DEBUGGEE_METHODS[i][1]) + " " + argList + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } catch (InvalidTypeException ie) { + log.display("CHECK PASSED: caught expected " + ie); + } catch (Exception ee) { + // Make sure that the reference type is really loaded by the debuggee VM + if ((debuggee.classByName(DEBUGGEE_METHODS[i][1])) == null) { + log.display("Skipping the check: the tested reference type\n\t\"" + + DEBUGGEE_METHODS[i][2] + + "\"\n\twas not loaded by the debuggee VM, unable to test an assertion"); + continue; + } + else { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected InvalidTypeException" + + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[1] + + "\"\n\twith the arguments: " + + rType[1].fieldByName(DEBUGGEE_METHODS[i][1]) + " " + argList + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007/TestDescription.java new file mode 100644 index 00000000000..e1b96d9b18f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ObjectReference/invokeMethod/invokemethod007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ObjectReference.invokeMethod() properly throws + * InvalidTypeException when a debugger part of the test + * invokes several debuggee methods with different kinds of + * arguments which are not assignment compatible with the argument + * type and not convertible without loss of information as well. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod007 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod007t + * + * @comment make sure invokemethod007t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod007t + * @compile -g:lines,source,vars ../invokemethod007t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007t.java new file mode 100644 index 00000000000..1e249de4083 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007t.java @@ -0,0 +1,140 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class invokemethod007t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod007t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + invokemethod007tDummyClass invokemethod007tdummyCls = new invokemethod007tDummyClass(); + Thread.currentThread().setName(invokemethod007.DEBUGGEE_THRNAME); + + pipe.println(invokemethod007.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod007.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod007.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod007.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy reference types used to provoke InvalidTypeException +// in the debugger +class invokemethod007tDummyType {} +class invokemethod007tWrongDummyType {} + +// Dummy class used to provoke InvalidTypeException +// in the debugger +class invokemethod007tDummyClass { + // dummy fields used to obtain their values for method invocation + static byte sByteFld = 127; + static short sShortFld = -32768; + int intFld = 2147483647; + static long sLongFld = 9223372036854775807L; + float floatFld = 5.1F; + static double sDoubleFld = 6.2D; + static char sCharFld = 'a'; + static boolean sBooleanFld = true; + static String sStrFld = "static field"; + static invokemethod007tDummyType dummyType = new invokemethod007tDummyType(); + static invokemethod007tWrongDummyType wrongDummyType = new invokemethod007tWrongDummyType(); + + byte byteMeth(byte b) { + System.err.println("the method \"byteMeth\" was invoked!"); + return b; + } + + short shortMeth(short sh) { + System.err.println("the method \"shortMeth\" was invoked!"); + return sh; + } + + int intMeth(int i) { + System.err.println("the method \"intMeth\" was invoked!"); + return i; + } + + long longMeth(long l) { + System.err.println("the method \"longMeth\" was invoked!"); + return l; + } + + float floatMeth(float f) { + System.err.println("the method \"floatMeth\" was invoked!"); + return f; + } + + double doubleMeth(double d) { + System.err.println("the method \"doubleMeth\" was invoked!"); + return d; + } + + char charMeth(char c) { + System.err.println("the method \"charMeth\" was invoked!"); + return c; + } + + boolean booleanMeth(boolean bool) { + System.err.println("the method \"booleanMeth\" was invoked!"); + return bool; + } + + String strMeth(String str) { + System.err.println("the method \"strMeth\" was invoked!"); + return str; + } + + void dummyTMeth(invokemethod007tDummyType dummyT) { + System.err.println("the method \"dummyTMeth\" was invoked!"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008.java new file mode 100644 index 00000000000..3e0236c4f56 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008.java @@ -0,0 +1,369 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that virtual and non-virtual method invocation + * will be performed properly through the JDI method + * com.sun.jdi.ObjectReference.invokeMethod().
    + * A debugger part of the test invokes several debuggee methods, + * overriden in an object reference class, but obtained from + * a reference type of its superclass. The debugger calls the + * JDI method without and with the flag ObjectReference.INVOKE_NONVIRTUAL + * sequentially. It is expected, that methods from the object reference + * class instead of from the superclass will be invoked without + * the flag INVOKE_NONVIRTUAL and vise versa otherwise. + */ +public class invokemethod008 { + // debuggee classes + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ObjectReference.invokeMethod.invokemethod008t", + "nsk.jdi.ObjectReference.invokeMethod.invokemethod008tDummySuperClass", + "nsk.jdi.ObjectReference.invokeMethod.invokemethod008tDummySuperSuperClass" + }; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod008tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 69; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod008tdummyCls"; + + // tested debuggee methods to be invoked, reference type numbers + // and expected return values + static final int METH_NUM = 4; + static final String DEBUGGEE_METHODS[][] = { + {"longProtMeth", "1", "9223372036854775806"}, + {"longMeth", "1", "9223372036854775806"}, + {"longProtMeth", "2", "9223372036854775805"}, + {"longMeth", "2", "9223372036854775805"} + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod008().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod008t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[3]; + // reference types of debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + + for (int i=0; i argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + try { + log.display("\n\n1) Trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\twith the arguments: " + argList + + " and without the flag ObjectReference.INVOKE_NONVIRTUAL" + + "\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + LongValue retVal = (LongValue) + objRef.invokeMethod(thrRef, meth, argList, 0); + if (retVal.value() == 9223372036854775807L) { + log.display("CHECK PASSED: the invoked method returns: " + retVal.value() + + " as expected"); + } + else { + log.complain("TEST FAILED: wrong virtual invocation: the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\tinvoked with the arguments: " + argList + + " and without the flag ObjectReference.INVOKE_NONVIRTUAL" + + "\"\n\tusing the debuggee object reference \"" + objRef + + "\" returned: " + retVal.value() + + " instead of 9223372036854775807L as expected"); + tot_res = Consts.TEST_FAILED; + } + + log.display("\n2) Trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\twith the arguments: " + argList + + " and with the flag ObjectReference.INVOKE_NONVIRTUAL" + + "\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + LongValue retVal2 = (LongValue) + objRef.invokeMethod(thrRef, meth, argList, + ObjectReference.INVOKE_NONVIRTUAL); + if (retVal2.value() != expValue) { + log.complain("TEST FAILED: wrong non-virtual invocation: the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\tinvoked with the arguments: " + argList + + " and with the flag ObjectReference.INVOKE_NONVIRTUAL" + + "\"\n\tusing the debuggee object reference \"" + objRef + + "\",\n\treturns: " + retVal2.value() + + " instead of " + expValue + " as expected"); + tot_res = Consts.TEST_FAILED; + } + else + log.display("CHECK PASSED: the method invoked with ObjectReference.INVOKE_NONVIRTUAL returns: " + + retVal2.value() + " as expected"); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\twhen attempted to invoke the method \"" + + meth.name() + " " + meth.signature() + + "\"\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\twith the arguments: " + argList + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008/TestDescription.java new file mode 100644 index 00000000000..3767883a5ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod008. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test checks that virtual and non-virtual method invocation + * will be performed properly through the JDI method: + * com.sun.jdi.ObjectReference.invokeMethod(). + * A debugger part of the test invokes several debuggee methods, + * overriden in an object reference class, but obtained from + * a reference type of its superclass. The debugger calls the + * JDI method without and with the flag ObjectReference.INVOKE_NONVIRTUAL + * sequentially. It is expected, that methods from the object reference + * class instead of from the superclass will be invoked without + * the flag INVOKE_NONVIRTUAL and vise versa otherwise. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod008 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod008t + * + * @comment make sure invokemethod008t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod008t + * @compile -g:lines,source,vars ../invokemethod008t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008t.java new file mode 100644 index 00000000000..9ccff1fa714 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008t.java @@ -0,0 +1,122 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class invokemethod008t { + static Log log; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod008t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + log = argHandler.createDebugeeLog(); + + // force debuggee VM to load dummy classes + invokemethod008tDummyClass invokemethod008tdummyCls = + new invokemethod008tDummyClass(); + invokemethod008tDummySuperClass invokemethod008tdummySCls = + new invokemethod008tDummySuperClass(); + invokemethod008tDummySuperSuperClass invokemethod008tdummySSCls = + new invokemethod008tDummySuperSuperClass(); + + Thread.currentThread().setName(invokemethod008.DEBUGGEE_THRNAME); + + pipe.println(invokemethod008.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod008.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod008.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod008.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy super super class used to check the flag +// ObjectReference.INVOKE_NONVIRTUAL in the debugger +class invokemethod008tDummySuperSuperClass { + protected long longProtMeth(long l) { + invokemethod008t.log.display("invokemethod008tDummySuperSuperClass: longProtMeth invoked"); + return (l - 2); + } + + long longMeth(long l) { + invokemethod008t.log.display("invokemethod008tDummySuperSuperClass: longMeth invoked"); + return (l - 2); + } +} + +// Dummy super class used to check the flag +// ObjectReference.INVOKE_NONVIRTUAL in the debugger +class invokemethod008tDummySuperClass extends invokemethod008tDummySuperSuperClass { + protected long longProtMeth(long l) { + invokemethod008t.log.display("invokemethod008tDummySuperClass: longProtMeth invoked"); + return (l - 1); + } + + long longMeth(long l) { + invokemethod008t.log.display("invokemethod008tDummySuperClass: longMeth invoked"); + return (l - 1); + } +} + +// Dummy class used to check the flag +// ObjectReference.INVOKE_NONVIRTUAL in the debugger +class invokemethod008tDummyClass extends invokemethod008tDummySuperClass { + protected long longProtMeth(long l) { + invokemethod008t.log.display("invokemethod008tDummyClass: longProtMeth invoked"); + return l; + } + + long longMeth(long l) { + invokemethod008t.log.display("invokemethod008tDummyClass: longMeth invoked"); + return l; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod009.java new file mode 100644 index 00000000000..ca4394d3682 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod009.java @@ -0,0 +1,369 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that virtual and non-virtual method invocation + * will be performed properly through the JDI method + * com.sun.jdi.ObjectReference.invokeMethod().
    + * A debugger part of the test invokes several debuggee methods, + * overriden in an object reference class, but obtained from + * a reference type of its superclass. The debugger calls the + * JDI method with and without the flag ObjectReference.INVOKE_NONVIRTUAL + * sequentially. It is expected, that methods from the superclass + * instead of from the object reference class will be invoked with + * the flag and vise versa otherwise. + */ +public class invokemethod009 { + // debuggee classes + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ObjectReference.invokeMethod.invokemethod009t", + "nsk.jdi.ObjectReference.invokeMethod.invokemethod009tDummySuperClass", + "nsk.jdi.ObjectReference.invokeMethod.invokemethod009tDummySuperSuperClass" + }; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod009tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 69; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod009tdummyCls"; + + // tested debuggee methods to be invoked, reference type numbers + // and expected return values + static final int METH_NUM = 4; + static final String DEBUGGEE_METHODS[][] = { + {"longProtMeth", "1", "9223372036854775806"}, + {"longMeth", "1", "9223372036854775806"}, + {"longProtMeth", "2", "9223372036854775805"}, + {"longMeth", "2", "9223372036854775805"} + }; + + static final int TIMEOUT_DELTA = 1000; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private ThreadReference thrRef = null; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod009().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); + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod009t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[3]; + // reference types of debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR); + LinkedList argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + for (int i=0; i + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + *
  • by default, all threads in the target VM are resumed while + * the method is being invoked + *
  • when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation + *
  • only the specified thread will be resumed with the + * INVOKE_SINGLE_THREADED + *
  • upon completion of a single threaded invoke, the invoking + * thread will be suspended once again.
    + * + * A debuggee part of the test starts several threads. Then debugger + * calls the JDI method without and with the flag + * ObjectReference.INVOKE_SINGLE_THREADED sequentially. During + * the invocations and after them the threads state is expected to be as + * described above. + */ +public class invokemethod010 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod010t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 71; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod010tdummyCls"; + + // debuggee fields used to operate on an invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + // debuggee thread names to be check + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRDS[] = { + "invokemethod010tThr", "invokemethod010tThr1", "invokemethod010tThr2", + "invokemethod010tThr3", "invokemethod010tThr4", "invokemethod010tThr5", + "invokemethod010tThr6", "invokemethod010tThr7", "invokemethod010tThr8", + "invokemethod010tThr9", "invokemethod010tThr10", "invokemethod010tThr11" + }; + + // debuggee method to be invoke + static final String DEBUGGEE_METHOD = + "longMeth"; + + static final int DELAY = 400; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod010().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); + String cmd; + ObjectReference objRef = null; + Field fldToExit = null; + BooleanValue val = null; + InvokingThread invThr = null; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod010t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + for (int i=1; i<=2; i++) { + switch(i) { + case 1: // invocation with all threads resumption + invThr = new InvokingThread(objRef, thrRef[0], + meth, argList, 0); + break; + case 2: // the single threaded invocation + invThr = new InvokingThread(objRef, thrRef[0], meth, + argList, ObjectReference.INVOKE_SINGLE_THREADED); + break; + } + invThr.setDaemon(true); + invThr.start(); + + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + int attempts = (argHandler.getWaitTime() * 60000) / DELAY; + + do { + if (tryOns > attempts) + throw new Failure("unable to continue testing after " + + attempts + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + objRef.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during method invocation + checkThreads(thrRef, i); + + objRef.setValue(fldToExit, vm.mirrorOf(true)); + + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after method invocation + checkThreads(thrRef, 0); + } + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (objRef != null && fldToExit != null) { + try { + objRef.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + switch (state) { + case 0: + log.display("\n\nVerifying threads status after method invocation:"); + break; + case 1: + log.display("\n\nVerifying invocation with all threads resumption:"); + break; + case 2: + log.display("\n\nVerifying the single threaded invocation (INVOKE_SINGLE_THREADED):"); + break; + } + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i argList; + int bitOpts; + + InvokingThread(ObjectReference objRef, ThreadReference thrRef, Method meth, LinkedList argList, int bitOpts) { + this.objRef = objRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + super.setName("InvokingThread"); + } + + public void run() { + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tand " + + new String((bitOpts==ObjectReference.INVOKE_SINGLE_THREADED)? "with" : "without") + + " the flag ObjectReference.INVOKE_SINGLE_THREADED\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + LongValue retVal = (LongValue) + objRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010/TestDescription.java new file mode 100644 index 00000000000..6bad2838d67 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod010. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that invocation with all threads resumption + * and the single threaded one will be performed properly through + * the JDI method: + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + * - by default, all threads in the target VM are resumed while + * the method is being invoked; + * - when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation; + * - only the specified thread will be resumed with the + * INVOKE_SINGLE_THREADED; + * - upon completion of a single threaded invoke, the invoking + * thread will be suspended once again. + * A debuggee part of the test starts several threads. Then debugger + * calls the JDI method without and with the flag + * ObjectReference.INVOKE_SINGLE_THREADED sequentially. During + * the invocations and after them the threads state is expected to be as + * described above. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod010 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod010t + * + * @comment make sure invokemethod010t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod010t + * @compile -g:lines,source,vars ../invokemethod010t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod010 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java new file mode 100644 index 00000000000..2dae569f1fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java @@ -0,0 +1,195 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a main debuggee class. + */ +public class invokemethod010t { + static Log log; + private invokemethod010Thr thrs[] = + new invokemethod010Thr[invokemethod010.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod010t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + invokemethod010tDummyClass invokemethod010tdummyCls = + new invokemethod010tDummyClass(); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(invokemethod010.DEBUGGEE_THRDS[0]); + // Start several dummy threads with given names + startThreads(); + + // Now the debuggee is ready for testing + pipe.println(invokemethod010.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod010.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod010.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod010.COMMAND_QUIT)) { + killThreads(argHandler.getWaitTime()*60000); + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i < invokemethod010.THRDS_NUM-1; i++) { + thrs[i] = new invokemethod010Thr(readyObj, + invokemethod010.DEBUGGEE_THRDS[i+1]); + thrs[i].setDaemon(true); + log.display("Debuggee: starting thread #" + + i + " \"" + thrs[i].getName() + "\" ..."); + synchronized(readyObj) { + thrs[i].start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + thrs[i].toString() + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread #" + + i + " \"" + thrs[i].getName() + "\" started"); + } + } + + private void killThreads(int waitTime) { + for (int i=0; i < invokemethod010.THRDS_NUM-1 ; i++) { + thrs[i].doExit = true; + try { + thrs[i].join(waitTime); + log.display("Debuggee: thread #" + + i + " \"" + thrs[i].getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread #" + + i + " \"" + thrs[i].getName() + "\": caught " + e); + } + } + } + + /** + * This is an auxiliary thread class used to check the flag + * ObjectReference.INVOKE_SINGLE_THREADED in the debugger. + */ + class invokemethod010Thr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + invokemethod010Thr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + Thread thr = Thread.currentThread(); + Object waitObj = new Object(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(waitObj) { + try { + waitObj.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} + +/** + * Dummy class used to check the flag ObjectReference.INVOKE_SINGLE_THREADED + * in the debugger. + */ +class invokemethod010tDummyClass { + // used by the debugger to let the invoked method return + volatile boolean doExit = false; + // indicator that the method has been really invoked + volatile boolean isInvoked = false; + + long longMeth(long l) throws InterruptedException { + invokemethod010t.log.display("invokemethod010tDummyClass: longMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod010t.log.display("invokemethod010tDummyClass: longMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java new file mode 100644 index 00000000000..090546a2226 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java @@ -0,0 +1,478 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that invocation with all threads resumption + * and the single threaded one will be performed properly through + * the JDI method
    + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + *
  • by default, all threads in the target VM are resumed while + * the method is being invoked + *
  • when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation + *
  • only the specified thread will be resumed with the + * INVOKE_SINGLE_THREADED + *
  • upon completion of a single threaded invoke, the invoking + * thread will be suspended once again.
    + * + * A debuggee part of the test starts several threads. Then debugger + * calls the JDI method with and without the flag + * ObjectReference.INVOKE_SINGLE_THREADED sequentially. During + * the invocation and after it the threads state is expected to be as + * described above. + */ +public class invokemethod011 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod011t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 71; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod011tdummyCls"; + + // debuggee fields used to operate on an invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + // debuggee thread names to be check + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRDS[] = { + "invokemethod011tThr", "invokemethod011tThr1", "invokemethod011tThr2", + "invokemethod011tThr3", "invokemethod011tThr4", "invokemethod011tThr5", + "invokemethod011tThr6", "invokemethod011tThr7", "invokemethod011tThr8", + "invokemethod011tThr9", "invokemethod011tThr10", "invokemethod011tThr11" + }; + + // debuggee method to be invoke + static final String DEBUGGEE_METHOD = + "longMeth"; + + static final int DELAY = 400; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod011().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); + String cmd; + ObjectReference objRef = null; + Field fldToExit = null; + BooleanValue val = null; + InvokingThread invThr = null; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod011t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i methList = rType[1].methodsByName(DEBUGGEE_METHOD); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHOD + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + for (int i=2; i>=1; i--) { + switch(i) { + case 1: // invocation with all threads resumption + invThr = new InvokingThread(objRef, thrRef[0], + meth, argList, 0); + break; + case 2: // the single threaded invocation + invThr = new InvokingThread(objRef, thrRef[0], meth, + argList, ObjectReference.INVOKE_SINGLE_THREADED); + break; + } + invThr.setDaemon(true); + invThr.start(); + + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + int attempts = (argHandler.getWaitTime() * 60000) / DELAY; + + do { + if (tryOns > attempts) + throw new Failure("unable to continue testing after " + + attempts + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + objRef.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during method invocation + checkThreads(thrRef, i); + + objRef.setValue(fldToExit, vm.mirrorOf(true)); + + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after method invocation + checkThreads(thrRef, 0); + } + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (objRef != null && fldToExit != null) { + try { + objRef.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + switch (state) { + case 0: + log.display("\n\nVerifying threads status after the method invocation:"); + break; + case 1: + log.display("\n\nVerifying invocation with all threads resumption:"); + break; + case 2: + log.display("\n\nVerifying the single threaded invocation (INVOKE_SINGLE_THREADED):"); + break; + } + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after the invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i argList; + int bitOpts; + + InvokingThread(ObjectReference objRef, ThreadReference thrRef, Method meth, LinkedList argList, int bitOpts) { + this.objRef = objRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + super.setName("InvokingThread"); + } + + public void run() { + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tand " + + new String((bitOpts==ObjectReference.INVOKE_SINGLE_THREADED)? "with" : "without") + + " the flag ObjectReference.INVOKE_SINGLE_THREADED\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + LongValue retVal = (LongValue) + objRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011/TestDescription.java new file mode 100644 index 00000000000..1ddc164cbf7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ObjectReference/invokeMethod/invokemethod011. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that invocation with all threads resumption + * and the single threaded one will be performed properly through + * the JDI method: + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + * - by default, all threads in the target VM are resumed while + * the method is being invoked; + * - when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation; + * - only the specified thread will be resumed with the + * INVOKE_SINGLE_THREADED; + * - upon completion of a single threaded invoke, the invoking + * thread will be suspended once again. + * A debuggee part of the test starts several threads. Then debugger + * calls the JDI method with and without the flag + * ObjectReference.INVOKE_SINGLE_THREADED sequentially. During + * the invocation and after it the threads state is expected to be as + * described above. + * COMMENTS + * This test is similar to the following one: + * nsk/jdi/ObjectReference/invokeMethod/invokemethod010 + * except the order of single threaded and non single threaded + * invocations. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod011 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod011t + * + * @comment make sure invokemethod011t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod011t + * @compile -g:lines,source,vars ../invokemethod011t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod011 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java new file mode 100644 index 00000000000..fadc1ab0030 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java @@ -0,0 +1,195 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a main debuggee class. + */ +public class invokemethod011t { + static Log log; + private invokemethod011Thr thrs[] = + new invokemethod011Thr[invokemethod011.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod011t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + invokemethod011tDummyClass invokemethod011tdummyCls = + new invokemethod011tDummyClass(); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(invokemethod011.DEBUGGEE_THRDS[0]); + // Start several dummy threads with given names + startThreads(); + + // Now the debuggee is ready for testing + pipe.println(invokemethod011.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod011.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod011.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod011.COMMAND_QUIT)) { + killThreads(argHandler.getWaitTime()*60000); + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i < invokemethod011.THRDS_NUM-1; i++) { + thrs[i] = new invokemethod011Thr(readyObj, + invokemethod011.DEBUGGEE_THRDS[i+1]); + thrs[i].setDaemon(true); + log.display("Debuggee: starting thread #" + + i + " \"" + thrs[i].getName() + "\" ..."); + synchronized(readyObj) { + thrs[i].start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + thrs[i].toString() + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread #" + + i + " \"" + thrs[i].getName() + "\" started"); + } + } + + private void killThreads(int waitTime) { + for (int i=0; i < invokemethod011.THRDS_NUM-1 ; i++) { + thrs[i].doExit = true; + try { + thrs[i].join(waitTime); + log.display("Debuggee: thread #" + + i + " \"" + thrs[i].getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread #" + + i + " \"" + thrs[i].getName() + "\": caught " + e); + } + } + } + + /** + * This is an auxiliary thread class used to check the flag + * ObjectReference.INVOKE_SINGLE_THREADED in the debugger. + */ + class invokemethod011Thr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + invokemethod011Thr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + Thread thr = Thread.currentThread(); + Object waitObj = new Object(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(waitObj) { + try { + waitObj.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} + +/** + * Dummy class used to check the flag ObjectReference.INVOKE_SINGLE_THREADED + * in the debugger. + */ +class invokemethod011tDummyClass { + // used by the debugger to let the invoked method return + volatile boolean doExit = false; + // indicator that the method has been really invoked + volatile boolean isInvoked = false; + + long longMeth(long l) throws InterruptedException { + invokemethod011t.log.display("invokemethod011tDummyClass: longMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod011t.log.display("invokemethod011tDummyClass: longMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java new file mode 100644 index 00000000000..7e83e5a3fdc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java @@ -0,0 +1,521 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the single threaded invocation will be + * performed properly through the JDI method
    + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + *
  • only the specified thread will be resumed with the + * INVOKE_SINGLE_THREADED + *
  • upon completion of a single threaded invoke, the invoking + * thread will be suspended once again. + *
  • any threads started during the single threaded invocation + * will not be suspended when the invocation completes.

    + * + * A debuggee part of the test starts several threads. The debugger + * calls the JDI method with the flag + * ObjectReference.INVOKE_SINGLE_THREADED. + * Then, during the invocation the debugger resumes some of the + * threads. Finally, these threads are checked to be not suspended + * when the invocation completes. + */ +public class invokemethod012 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod012t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 71; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod012tdummyCls"; + + // debuggee fields used to operate on an invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + // debuggee threads to be check + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRDS[][] = { + {"invokemethod012tThr", "no"}, + {"invokemethod012tThr1", "no"}, + {"invokemethod012tThr2", "resume"}, + {"invokemethod012tThr3", "resume"}, + {"invokemethod012tThr4", "no"}, + {"invokemethod012tThr5", "no"}, + {"invokemethod012tThr6", "no"}, + {"invokemethod012tThr7", "no"}, + {"invokemethod012tThr8", "resume"}, + {"invokemethod012tThr9", "no"}, + {"invokemethod012tThr10", "no"}, + {"invokemethod012tThr11", "resume"} + }; + + // debuggee method to be invoke + static final String DEBUGGEE_METHOD = + "longMeth"; + + static final int DELAY = 400; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod012().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); + String cmd; + ObjectReference objRef = null; + Field fldToExit = null; + BooleanValue val = null; + InvokingThread invThr = null; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod012t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i methList = rType[1].methodsByName(DEBUGGEE_METHOD); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHOD + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + // the single threaded invocation + invThr = new InvokingThread(objRef, thrRef[0], meth, + argList, ObjectReference.INVOKE_SINGLE_THREADED); + invThr.setDaemon(true); + invThr.start(); + + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + int attempts = (argHandler.getWaitTime() * 60000) / DELAY; + + do { + if (tryOns > attempts) + throw new Failure("unable to continue testing after " + + attempts + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + objRef.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during the method invocation + checkThreads(thrRef, 1); + + // resume some threads during the method invocation + resumeSomeThreads(thrRef); + + objRef.setValue(fldToExit, vm.mirrorOf(true)); + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after the method invocation + checkThreads(thrRef, 0); + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (objRef != null && fldToExit != null) { + try { + objRef.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + switch (state) { + case 0: + log.display("\nVerifying threads status when the invocation completes:"); + break; + case 1: + log.display("\nVerifying the single threaded invocation:"); + break; + } + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after the invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i attempts) + throw new Failure("unable to continue testing after " + + attempts + + " attempts: debuggee thread " + + thrRef[i] + " is not resumed yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + tryOns++; + } while (thrRef[i].isSuspended()); + log.display("The thread " + thrRef[i] + + "\n\tis resumed"); + } + } + } + + private ObjectReference findObjRef(ThreadReference thrRef, String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference) + stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + + /** + * A separate thread class used in debuggee method invocation because + * it is synchronous. + */ + class InvokingThread extends Thread { + ObjectReference objRef; + ThreadReference thrRef; + Method meth; + LinkedList argList; + int bitOpts; + + InvokingThread(ObjectReference objRef, ThreadReference thrRef, Method meth, LinkedList argList, int bitOpts) { + this.objRef = objRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + super.setName("InvokingThread"); + } + + public void run() { + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tand " + + new String((bitOpts==ObjectReference.INVOKE_SINGLE_THREADED)? "with" : "without") + + " the flag ObjectReference.INVOKE_SINGLE_THREADED\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + LongValue retVal = (LongValue) + objRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012/TestDescription.java new file mode 100644 index 00000000000..ae25a93fa66 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod012. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the single threaded invocation will be + * performed properly through the JDI method: + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + * - only the specified thread will be resumed with the + * INVOKE_SINGLE_THREADED; + * - upon completion of a single threaded invoke, the invoking + * thread will be suspended once again; + * - any threads started during the single threaded invocation + * will not be suspended when the invocation completes. + * A debuggee part of the test starts several threads. The debugger + * calls the JDI method with the flag ObjectReference.INVOKE_SINGLE_THREADED. + * Then, during the invocation the debugger resumes some of the + * threads. Finally, these threads are checked to be not suspended + * when the invocation completes. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod012 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod012t + * + * @comment make sure invokemethod012t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod012t + * @compile -g:lines,source,vars ../invokemethod012t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod012 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java new file mode 100644 index 00000000000..3f4aab830ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java @@ -0,0 +1,195 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a main debuggee class. + */ +public class invokemethod012t { + static Log log; + private invokemethod012Thr thrs[] = + new invokemethod012Thr[invokemethod012.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod012t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + invokemethod012tDummyClass invokemethod012tdummyCls = + new invokemethod012tDummyClass(); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(invokemethod012.DEBUGGEE_THRDS[0][0]); + // Start several dummy threads with given names + startThreads(); + + // Now the debuggee is ready for testing + pipe.println(invokemethod012.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod012.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod012.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod012.COMMAND_QUIT)) { + killThreads(argHandler.getWaitTime()*60000); + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i < invokemethod012.THRDS_NUM-1; i++) { + thrs[i] = new invokemethod012Thr(readyObj, + invokemethod012.DEBUGGEE_THRDS[i+1][0]); + thrs[i].setDaemon(true); + log.display("Debuggee: starting thread #" + + i + " \"" + thrs[i].getName() + "\" ..."); + synchronized(readyObj) { + thrs[i].start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + thrs[i].toString() + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread #" + + i + " \"" + thrs[i].getName() + "\" started"); + } + } + + private void killThreads(int waitTime) { + for (int i=0; i < invokemethod012.THRDS_NUM-1 ; i++) { + thrs[i].doExit = true; + try { + thrs[i].join(waitTime); + log.display("Debuggee: thread #" + + i + " \"" + thrs[i].getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread #" + + i + " \"" + thrs[i].getName() + "\": caught " + e); + } + } + } + + /** + * This is an auxiliary thread class used to check the flag + * ObjectReference.INVOKE_SINGLE_THREADED in the debugger. + */ + class invokemethod012Thr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + invokemethod012Thr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + Thread thr = Thread.currentThread(); + Object waitObj = new Object(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(waitObj) { + try { + waitObj.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} + +/** + * Dummy class used to check the flag ObjectReference.INVOKE_SINGLE_THREADED + * in the debugger. + */ +class invokemethod012tDummyClass { + // used by the debugger to let the invoked method return + volatile boolean doExit = false; + // indicator that the method has been really invoked + volatile boolean isInvoked = false; + + long longMeth(long l) throws InterruptedException { + invokemethod012t.log.display("invokemethod012tDummyClass: longMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod012t.log.display("invokemethod012tDummyClass: longMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java new file mode 100644 index 00000000000..9685e515eda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java @@ -0,0 +1,524 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that debuggee method invocation will be + * performed properly through the JDI method
    + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + *

  • all threads in the target VM are resumed while the method is + * being invoked. If the thread's suspend count is greater than 1, + * it will remain in a suspended state during the invocation. + *
  • when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation.

    + * + * A debuggee part of the test starts several threads. The debugger + * suspends all of the threads by a breakpoint event and then, some + * of them one more time. After that, it calls the JDI method. + * Then, the threads are checked to be resumed or remain suspended + * during the invocation depending on the suspend count, and finally, + * to be suspended when it completes. + */ +public class invokemethod013 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.invokeMethod.invokemethod013t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 71; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod013tdummyCls"; + + // debuggee fields used to operate on an invoked method + static final String DEBUGGEE_FIELDS[] = { + "doExit", "isInvoked" + }; + + // debuggee threads to be check + static final int THRDS_NUM = 12; + static final String DEBUGGEE_THRDS[][] = { + {"invokemethod013tThr", "no"}, + {"invokemethod013tThr1", "no"}, + {"invokemethod013tThr2", "no"}, + {"invokemethod013tThr3", "no"}, + {"invokemethod013tThr4", "double-suspension"}, + {"invokemethod013tThr5", "no"}, + {"invokemethod013tThr6", "no"}, + {"invokemethod013tThr7", "no"}, + {"invokemethod013tThr8", "double-suspension"}, + {"invokemethod013tThr9", "double-suspension"}, + {"invokemethod013tThr10", "no"}, + {"invokemethod013tThr11", "double-suspension"} + }; + + // debuggee method to be invoke + static final String DEBUGGEE_METHOD = + "longMeth"; + + static final int DELAY = 400; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod013().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); + String cmd; + ObjectReference objRef = null; + Field fldToExit = null; + BooleanValue val = null; + InvokingThread invThr = null; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod013t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[THRDS_NUM]; + for (int i=0; i methList = rType[1].methodsByName(DEBUGGEE_METHOD); + if (methList.isEmpty()) { + log.complain("TEST FAILURE: the expected debuggee method \"" + + DEBUGGEE_METHOD + + "\" not found through the JDI method ReferenceType.methodsByName()"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + Method meth = methList.get(0); + LinkedList argList = new LinkedList(); + argList.add(vm.mirrorOf(9223372036854775807L)); + + invThr = new InvokingThread(objRef, thrRef[0], meth, + argList, 0); + invThr.setDaemon(true); + + // suspend some threads one more time before the method + // invocation in order to make the thread's suspend count + // greater than 1 + suspendSomeThreads(thrRef); + + // perform the invocation + invThr.start(); + log.display("Waiting for debuggee method invocation ..."); + int tryOns = 0; + int attempts = (argHandler.getWaitTime() * 60000) / DELAY; + + do { + if (tryOns > attempts) + throw new Failure("unable to continue testing after " + + attempts + + " attempts: debuggee method is not invoked yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + val = (BooleanValue) + objRef.getValue(fldToCheck); + tryOns++; + } while (!val.value()); + + // check threads during the method invocation + checkThreads(thrRef, 1); + + objRef.setValue(fldToExit, vm.mirrorOf(true)); + invThr.join(argHandler.getWaitTime()*60000); + log.display("Thread \"" + invThr.getName() + "\" done"); + + // check threads status after the method invocation + checkThreads(thrRef, 0); + } catch (Exception e) { + e.printStackTrace(); + // force an method to exit if it has been invoked + if (objRef != null && fldToExit != null) { + try { + objRef.setValue(fldToExit, vm.mirrorOf(true)); + } catch(Exception ee) { + ee.printStackTrace(); + } + } + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private void checkThreads(ThreadReference thrRef[], int state) { + switch (state) { + case 0: + log.display("\nVerifying threads status when the invocation completes:"); + break; + case 1: + log.display("\nVerifying threads status during the invocation:"); + break; + } + + // check an invoking debuggee thread + if (thrRef[0].isSuspended()) { + if (state == 0) { // after invocation + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis suspended again after the invocation as expected"); + } else { + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + "\n\tis still suspended"); + tot_res = Consts.TEST_FAILED; + } + } else { + if (state == 0) { // after invocation + log.complain("TEST FAILED: wrong invocation: " + + "\n\tinvoking debuggee thread " + thrRef[0] + + "\n\tis not suspended again after the invocation"); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: invoking debuggee thread " + thrRef[0] + + "\n\tis resumed as expected"); + } + } + // check other debuggee threads + for (int i=1; i attempts) + throw new Failure("unable to continue testing after " + + attempts + + " attempts: debuggee thread " + + thrRef[i] + " is not suspended yet"); + + // reliable analogue of Thread.yield() + synchronized(this) { + this.wait(DELAY); + } + tryOns++; + } while (thrRef[i].suspendCount() != 2); + log.display("The thread " + thrRef[i] + + "\n\tis suspended one more time: the number of pending suspends = " + + thrRef[i].suspendCount()); + } + } + } + + private ObjectReference findObjRef(ThreadReference thrRef, String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Resuming debuggee twice ..."); + vm.resume(); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } + + /** + * A separate thread class used in the debuggee method invocation because + * it is synchronous. + */ + class InvokingThread extends Thread { + ObjectReference objRef; + ThreadReference thrRef; + Method meth; + LinkedList argList; + int bitOpts; + + InvokingThread(ObjectReference objRef, ThreadReference thrRef, Method meth, LinkedList argList, int bitOpts) { + this.objRef = objRef; + this.thrRef = thrRef; + this.meth = meth; + this.argList = argList; + this.bitOpts = bitOpts; + super.setName("InvokingThread"); + } + + public void run() { + try { + log.display("\nInvokingThread: trying to invoke the method \"" + + meth.name() + " " + meth.signature() + " " + meth + + "\"\n\twith the arguments: " + argList + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\" ..."); + + LongValue retVal = (LongValue) + objRef.invokeMethod(thrRef, meth, argList, bitOpts); + log.display("InvokingThread: the method returned " + retVal); + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + log.display("InvokingThread: exiting"); + } + } +///////////////////////////////////////////////////////////////////////////// +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013/TestDescription.java new file mode 100644 index 00000000000..780316eaaa2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013/TestDescription.java @@ -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/ObjectReference/invokeMethod/invokemethod013. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that debuggee method invocation will be + * performed properly through the JDI method: + * com.sun.jdi.ObjectReference.invokeMethod(). + * The following assertions are verified: + * - all threads in the target VM are resumed while the method is + * being invoked. If the thread's suspend count is greater than 1, + * it will remain in a suspended state during the invocation; + * - when the invocation completes, all threads in the target VM + * are suspended, regardless their state before the invocation. + * A debuggee part of the test starts several threads. The debugger + * suspends all of the threads by a breakpoint event and then, some + * of them one more time. After that, it calls the JDI method. + * Then, the threads are checked to be resumed or remain suspended + * during the invocation depending on the suspend count, and finally, + * to be suspended when it completes. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod013 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod013t + * + * @comment make sure invokemethod013t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod013t + * @compile -g:lines,source,vars ../invokemethod013t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod013 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java new file mode 100644 index 00000000000..7b309f07d19 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java @@ -0,0 +1,194 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a main debuggee class. + */ +public class invokemethod013t { + static Log log; + private invokemethod013Thr thrs[] = + new invokemethod013Thr[invokemethod013.THRDS_NUM-1]; + private IOPipe pipe; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod013t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + invokemethod013tDummyClass invokemethod013tdummyCls = + new invokemethod013tDummyClass(); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(invokemethod013.DEBUGGEE_THRDS[0][0]); + // Start several dummy threads with given names + startThreads(); + + // Now the debuggee is ready for testing + pipe.println(invokemethod013.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod013.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // invokemethod013.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod013.COMMAND_QUIT)) { + killThreads(argHandler.getWaitTime()*60000); + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + + killThreads(argHandler.getWaitTime()*60000); + return Consts.TEST_PASSED; + } + + private void startThreads() { + Object readyObj = new Object(); + + for (int i=0; i < invokemethod013.THRDS_NUM-1; i++) { + thrs[i] = new invokemethod013Thr(readyObj, + invokemethod013.DEBUGGEE_THRDS[i+1][0]); + thrs[i].setDaemon(true); + log.display("Debuggee: starting thread #" + + i + " \"" + thrs[i].getName() + "\" ..."); + synchronized(readyObj) { + thrs[i].start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + thrs[i].toString() + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread #" + + i + " \"" + thrs[i].getName() + "\" started"); + } + } + + private void killThreads(int waitTime) { + for (int i=0; i < invokemethod013.THRDS_NUM-1 ; i++) { + thrs[i].doExit = true; + try { + thrs[i].join(waitTime); + log.display("Debuggee: thread #" + + i + " \"" + thrs[i].getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread #" + + i + " \"" + thrs[i].getName() + "\": caught " + e); + } + } + } + + /** + * This is an auxiliary thread class used to check method + * invocation in the debugger. + */ + class invokemethod013Thr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + invokemethod013Thr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + Thread thr = Thread.currentThread(); + Object waitObj = new Object(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(waitObj) { + try { + waitObj.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} + +/** + * Dummy class used to check method invocation in the debugger. + */ +class invokemethod013tDummyClass { + // used by the debugger to let the invoked method return + volatile boolean doExit = false; + // indicator that the method has been really invoked + volatile boolean isInvoked = false; + + long longMeth(long l) throws InterruptedException { + invokemethod013t.log.display("invokemethod013tDummyClass: longMeth: going to loop"); + isInvoked = true; + while(!doExit) { + l--; l++; + Thread.currentThread().sleep(400); + } + invokemethod013t.log.display("invokemethod013tDummyClass: longMeth: exiting"); + isInvoked = false; + doExit = false; + return l; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014.java new file mode 100644 index 00000000000..01e3fe6f950 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014.java @@ -0,0 +1,356 @@ +/* + * 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.ObjectReference.invokeMethod; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method:
    + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws IllegalArgumentException, when debugger + * part of the test attempts to invoke several debuggee methods + * which are not members of an object's class and: + *

  • declared non-public (access by default) from outside the package + *
  • declared protected from outside the package + *
  • finally, declared private from outside the package. + */ +public class invokemethod014 { + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ObjectReference.invokeMethod.invokemethod014t", + "nsk.jdi.ObjectReference.invokeMethod.invokemethod014tDummySuperClass", + "nsk.jdi.ObjectReference.dummyPackage.invokemethod014a" + }; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "invokemethod014tThr"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 72; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = + "invokemethod014tdummyCls"; + + // tested debuggee methods with different kind of access, + // and their type reference numbers + static final int METH_NUM = 30; + static final String DEBUGGEE_METHODS[][] = { + {"byteMeth", "2", "non-public"}, + {"shortMeth", "2", "non-public"}, + {"intMeth", "2", "non-public"}, + {"longMeth", "2", "non-public"}, + {"floatMeth", "2", "non-public"}, + {"doubleMeth", "2", "non-public"}, + {"charMeth", "2", "non-public"}, + {"booleanMeth", "2", "non-public"}, + {"strMeth", "2", "non-public"}, + {"voidMeth", "2", "non-public"}, + {"protByteMeth", "2", "protected"}, + {"protShortMeth", "2", "protected"}, + {"protIntMeth", "2", "protected"}, + {"protLongMeth", "2", "protected"}, + {"protFloatMeth", "2", "protected"}, + {"protDoubleMeth", "2", "protected"}, + {"protCharMeth", "2", "protected"}, + {"protBooleanMeth", "2", "protected"}, + {"protStrMeth", "2", "protected"}, + {"protVoidMeth", "2", "protected"}, + {"privByteMeth", "2", "private"}, + {"privShortMeth", "2", "private"}, + {"privIntMeth", "2", "private"}, + {"privLongMeth", "2", "private"}, + {"privFloatMeth", "2", "private"}, + {"privDoubleMeth", "2", "private"}, + {"privCharMeth", "2", "private"}, + {"privBooleanMeth", "2", "private"}, + {"privStrMeth", "2", "private"}, + {"privVoidMeth", "2", "private"} + }; + + static final int ATTEMPTS = 5; + static final int DELAY = 400; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new invokemethod014().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); + String cmd; + ObjectReference objRef = null; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "invokemethod014t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + ReferenceType[] rType = new ReferenceType[3]; + // debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]); + +// Check the tested assersion + try { + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + objRef = findObjRef(thrRef, DEBUGGEE_LOCALVAR); + + for (int i=0; iemptyList(), 0); + + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to invoke " + methInfo + + "\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } catch (IllegalArgumentException ia) { + log.display("CHECK PASSED: caught expected " + ia); + } catch (Exception ee) { + ee.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.invokeMethod(): caught unexpected " + + ee + "\n\tinstead of expected llegalArgumentException" + + "\n\twhen attempted to invoke " + methInfo + + "\n\tgot from reference type \"" + rType[typeIndex] + + "\"\n\tusing the debuggee object reference \"" + + objRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private ObjectReference findObjRef(ThreadReference thrRef, String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) continue; + + // dummy debuggee class + return (ObjectReference)stackFr.getValue(locVar); + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Resuming debuggee ..."); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014/TestDescription.java new file mode 100644 index 00000000000..179edd23e71 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ObjectReference/invokeMethod/invokemethod014. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method: + * com.sun.jdi.ObjectReference.invokeMethod() + * properly throws IllegalArgumentException, when debugger + * part of the test attempts to invoke several debuggee methods + * which are not members of an object's class and: + * - declared non-public (access by default) from outside + * the package; + * - declared protected from outside the package; + * - finally, declared private from outside the package. + * COMMENTS + * Modified due to fix of the bug: + * 4716226 JDI: ObjectReference.invokeMethod() allows to invoke private methods + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.invokeMethod.invokemethod014 + * nsk.jdi.ObjectReference.invokeMethod.invokemethod014t + * + * @comment make sure invokemethod014t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.invokeMethod.invokemethod014t + * @compile -g:lines,source,vars ../invokemethod014t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.invokeMethod.invokemethod014 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014t.java new file mode 100644 index 00000000000..2196a976b69 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014t.java @@ -0,0 +1,146 @@ +/* + * 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.ObjectReference.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a main debuggee class. + */ +public class invokemethod014t { + public static Log log; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new invokemethod014t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // force debuggee VM to load dummy classes + invokemethod014tDummyClass invokemethod014tdummyCls = + new invokemethod014tDummyClass(); + invokemethod014tDummySuperClass invokemethod014tdummySCls = + new invokemethod014tDummySuperClass(); + nsk.jdi.ObjectReference.dummyPackage.invokemethod014a + invokemethod014adummyCls = + new nsk.jdi.ObjectReference.dummyPackage.invokemethod014a(); + + log = argHandler.createDebugeeLog(); + + Thread.currentThread().setName(invokemethod014.DEBUGGEE_THRNAME); + + // Now the debuggee is ready for testing + pipe.println(invokemethod014.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(invokemethod014.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0;// invokemethod014.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(invokemethod014.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } + +} + +/** + * Dummy superclass used to provoke IllegalArgumentException + * in the debugger: private methods cannot be accessed from + * other classes. + */ +class invokemethod014tDummySuperClass { + private byte prByteMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prByteMeth\" was invoked!"); + return 127; + } + + private short prShortMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prShortMeth\" was invoked!"); + return -32768; + } + + private int prIntMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prIntMeth\" was invoked!"); + return 2147483647; + } + + private long prLongMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prLongMeth\" was invoked!"); + return 9223372036854775807L; + } + + private float prFloatMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prFloatMeth\" was invoked!"); + return 5.1F; + } + + private double prDoubleMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prDoubleMeth\" was invoked!"); + return 6.2D; + } + + private char prCharMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prCharMeth\" was invoked!"); + return 'a'; + } + + private boolean prBooleanMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prBooleanMeth\" was invoked!"); + return false; + } + + private String prStrMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prStrMeth\" was invoked!"); + return "string method"; + } + + private void prVoidMeth() { + invokemethod014t.log.complain("invokemethod014tDummySuperClass: private method \"prVoidMeth\" was invoked!"); + } +} + +/** + * Dummy subclass used to provoke IllegalArgumentException + * in the debugger. + */ +class invokemethod014tDummyClass extends invokemethod014tDummySuperClass {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java new file mode 100644 index 00000000000..2463fbfa27f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java @@ -0,0 +1,220 @@ +/* + * 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.ObjectReference.isCollected; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.isCollected()
    + * complies with its specification.
    + *
    + * The test checks up that a value returned by the method is
    + * "false" provided a testing object is not garbage collected.
    + */ + +public class iscollected001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/isCollected/iscollected001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new iscollected001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.isCollected.iscollected001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.isCollected.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.isCollected"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String objName = "testObj"; + + log2("......getting ObjectReference objRef object"); + try { + + testedClass = (ReferenceType) + vm.classesByName(debuggeeName).get(0); + + ObjectReference objRef = (ObjectReference) + testedClass.getValue(testedClass.fieldByName(objName)); + + log2("......performing the check : objRef.isCollected();"); + log2(" ERROR if returned value is 'true'"); + if (objRef.isCollected()) { + log3("ERROR: objRef.isCollected() == true"); + testExitCode = FAILED; + } else { + log2(" objRef.isCollected() == false"); + } + + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001/TestDescription.java new file mode 100644 index 00000000000..324c69df88f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001/TestDescription.java @@ -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/ObjectReference/isCollected/iscollected001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.isCollected() + * complies with its spec: + * public boolean isCollected() + * Determines if this object has been garbage collected in the target VM. + * Returns: true if this ObjectReference has been collected; false otherwise. + * The case for testing includes testing an object that + * is not garbage collected, hence, a returned value == false. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.isCollected.iscollected001; + * the debuggee program - nsk.jdi.ObjectReference.isCollected.iscollected001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.isCollected.iscollected001 + * nsk.jdi.ObjectReference.isCollected.iscollected001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.isCollected.iscollected001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001a.java new file mode 100644 index 00000000000..6c96007c1ad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001a.java @@ -0,0 +1,139 @@ +/* + * 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.ObjectReference.isCollected; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the iscollected001 JDI test. + */ + +public class iscollected001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.owningThread()
    + * complies with its specification.
    + *
    + * The case for testing includes throwing
    + * UnsupportedOperationException
    + * provided
    + * VirtualMachine.canGetOwnedMonitorInfo() == false
    + */ + +public class owningthread001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/owningThread/owningthread001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new owningthread001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.owningThread.owningthread001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.owningThread.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.owningThread"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List allThreads = null; + List monitors = null; + ListIterator listIterator = null; + List classes = null; + ObjectReference objRef = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO 'main' thread ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + + label1: { + if (expresult != returnCode0) + break label1; + + + log2(" suspending the main thread"); + mainThread.suspend(); + + objRef = (ObjectReference) testedClass.getValue(testedClass.fieldByName("bl")); + + + if (!vm.canGetOwnedMonitorInfo()) { + + log2(".......vm.canGetOwnedMonitorInfo() == false"); + log2(".......checking up on throwing UnsupportedOperationException"); + try { + ThreadReference tr = objRef.owningThread(); + log3("ERROR: UnsupportedOperationException is not thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException"); + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + } + + log2(" resuming the main thread"); + mainThread.resume(); + } + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001/TestDescription.java new file mode 100644 index 00000000000..1ce3ad1ae90 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/ObjectReference/owningThread/owningthread001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.owningThread() + * complies with its spec: + * public ThreadReference owningThread() + * throws IncompatibleThreadStateException + * Returns an ThreadReference for the thread, if any, + * which currently owns this object's monitor. + * See ThreadReference.ownedMonitors() for a definition of ownership. + * Not all target VMs support this operation. + * See VirtualMachine#canGetMonitorInfo to determine if the operation is supported. + * Returns: the ThreadReference which currently owns the monitor, or + * null if it is unowned. + * Throws: java.lang.UnsupportedOperationException - + * if the target target VM does not support this operation. + * IncompatibleThreadStateException - + * if the owning thread is not suspended in the target VM + * ObjectCollectedException - + * if this object has been garbage collected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.owningThread.owningthread 00; + * the debuggee program - nsk.jdi.ObjectReference.owningThread.owningthread 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.owningThread.owningthread001 + * nsk.jdi.ObjectReference.owningThread.owningthread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.owningThread.owningthread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001a.java new file mode 100644 index 00000000000..82466190ba2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001a.java @@ -0,0 +1,222 @@ +/* + * 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.ObjectReference.owningThread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the owningthread001 JDI test. + */ + +public class owningthread001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + private static Threadowningthread001a thread2 = null; + + static TestClass testObj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + msg); + } + + void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + private Event waitForEvent (EventRequest eventRequest) { + + vm.resume(); + Event resultEvent = null; + try { + eventSet = null; + eventIterator = null; + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event curEvent = eventIterator.nextEvent(); + if (curEvent instanceof VMDisconnectEvent) { + throw new Failure("Unexpected VMDisconnectEvent received."); + } else { + EventRequest evRequest = curEvent.request(); + if (evRequest != null && evRequest.equals(eventRequest)) { + display("Requested event received: " + curEvent.toString() + + "; request property: " + (String) curEvent.request().getProperty("number")); + resultEvent = curEvent; + break; + } else { + throw new Failure("Unexpected event received: " + curEvent.toString()); + } + } + } + } catch (Exception e) { + throw new Failure("Unexpected exception while waiting for an event: " + e); + } + return resultEvent; + } + + + private void getEventSet() { + try { + eventSet = vm.eventQueue().remove(waitTime); + if (eventSet == null) { + throw new Failure("TIMEOUT while waiting for an event"); + } + eventIterator = eventSet.eventIterator(); + } catch (Exception e) { + throw new Failure("getEventSet(): Unexpected exception while waiting for an event: " + e); + } + } + + private ReferenceType waitForDebuggeeClassPrepared () { + display("Creating request for ClassPrepareEvent for debuggee."); + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.addClassFilter(debuggeeName); + cpRequest.addCountFilter(1); + cpRequest.enable(); + + ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest); + cpRequest.disable(); + + if (!event.referenceType().name().equals(debuggeeName)) { + throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name()); + } + return event.referenceType(); + } + + private int getInstruction () { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + return ((IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } + + private void setInstruction (String instructionField) { + if (debuggeeClass == null) { + throw new Failure("getInstruction() :: debuggeeClass reference is null"); + } + Field instrField = debuggeeClass.fieldByName("instruction"); + IntegerValue instrValue = (IntegerValue) (debuggeeClass.getValue(debuggeeClass.fieldByName(instructionField))); + try { + ((ClassType)debuggeeClass).setValue(instrField, instrValue ); + } catch (InvalidTypeException e1) { + throw new Failure("Caught unexpected InvalidTypeException while setting value '" + instructionField + "' for instruction field"); + } catch (ClassNotLoadedException e2) { + throw new Failure("Caught unexpected ClassNotLoadedException while setting value '" + instructionField + "' for instruction field"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002/TestDescription.java new file mode 100644 index 00000000000..118ee585dba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002/TestDescription.java @@ -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/ObjectReference/owningThread/owningthread002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks the following assertion of + * com.sun.jdi.ObjectReference.owningThread method spec: + * Returns an ThreadReference for the thread, if any, + * which currently owns this object's monitor. + * The debugger program - nsk.jdi.ObjectReference.owningThread.owningthread002; + * the debuggee program - nsk.jdi.ObjectReference.owningThread.owningthread002a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * The debuggee's main threads starts a number of auxiliary threads. + * Each of them invokes syncronized foo method of owningthread002aLock class. + * The debugger creates MethodEntryRequest filtered to class of foo method. + * Each time the foo is invoked, the debuggee is suspended. Upon receiving next + * MethodEntryEvent, the debugger calls owningThread method for the debuggee's field + * of owningthread002aLock type. The returned ThreadReference must have expected name + * and be equal to the thread reference returned by thread method of received + * MethodEntryEvent . + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - remove waiting for VMStartEvent after launching debuggee VM + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.makeBreakpoint() method for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.owningThread.owningthread002 + * nsk.jdi.ObjectReference.owningThread.owningthread002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.owningThread.owningthread002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002a.java new file mode 100644 index 00000000000..b3472b24b5c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002a.java @@ -0,0 +1,166 @@ +/* + * 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.ObjectReference.owningThread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class owningthread002a { + + //----------------------------------------------------- immutable common fields + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + static final int quit = -1; + + static int instruction = 1; + static int lineForComm = 2; + static int exitCode = PASSED; + + private static ArgumentHandler argHandler; + private static Log log; + + //---------------------------------------------------------- immutable common methods + + static void display(String msg) { + log.display("debuggee > " + msg); + } + + static void complain(String msg) { + log.complain("debuggee FAILURE > " + msg); + } + + private static void methodForCommunication() { + int i = instruction; // owningthread002.lineForBreak + int curInstruction = i; + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static owningthread002aLock lockObj = new owningthread002aLock(); +// static Object waitnotifyObj = new Object(); + static final int threadCount = 5; + static final String threadNamePrefix = "MyThread-"; + static owningthread002aThread[] threads = new owningthread002aThread[threadCount]; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + long waitTime = argHandler.getWaitTime() * 60000; + + display("debuggee started!"); + + label0: + for (int testCase = 0; instruction != quit; testCase++) { + + switch (testCase) { + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test case section + case 0: + display("call methodForCommunication() #0"); + methodForCommunication(); + + for (int i = 0; i < threadCount; i++) { + threads[i] = new owningthread002aThread(threadNamePrefix + i); + threads[i].start(); +/* + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " start"); + } +*/ + } + + for (int i = 0; i < threadCount; i++) { + if (threads[i].isAlive()) { + try { + threads[i].join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " join"); + } + } + } + + break; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of section + + default: + instruction = quit; + break; + } + + display("call methodForCommunication() #1"); + methodForCommunication(); + if (instruction == quit) + break; + } + + display("debuggee exits"); + System.exit(PASSED + PASS_BASE); + } + + //--------------------------------------------------------- test specific methodss + +} + +//--------------------------------------------------------- test specific classes + +class owningthread002aLock { + synchronized void foo () { + } +} + +class owningthread002aThread extends Thread { + public owningthread002aThread(String threadName) { + super(threadName); + } + + public void run() { +/* + synchronized (owningthread002a.waitnotifyObj) { + display("entered: synchronized (waitnotifyObj)"); + owningthread002a.waitnotifyObj.notifyAll(); + } + display("exited: synchronized (waitnotifyObj)"); +*/ + owningthread002a.lockObj.foo(); + display("exited: synchronized method foo"); + } + + private void display (String str) { + owningthread002a.display(Thread.currentThread().getName() + " : " + str); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java new file mode 100644 index 00000000000..7ce032b664d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java @@ -0,0 +1,291 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is ThreadReference.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.referenceType.Threadreferencetype001a"; + + //String mName = "nsk.jdi.ObjectReference.referenceType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + + List allThreads = null; + ListIterator listIterator = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + + log2("......ReferenceType testedClass = thread2.referenceType();"); + testedClass = thread2.referenceType(); + + log2("...... check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + expresult = returnCode1; + } + + try { + log2(".......check up on cast to ClassType; no Exception expected"); + ClassType ct = (ClassType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ClassType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ClassType ct = (ClassType) testedClass;"); + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + + log2(".......check up on equality ReferenceType thread2.referenceType() to testedClass"); + ReferenceType testedClass1 = thread2.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !thread2.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + expresult = returnCode1; + } + + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001/TestDescription.java new file mode 100644 index 00000000000..5337a88cab2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes ThreadReference object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype001; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype001 + * nsk.jdi.ObjectReference.referenceType.referencetype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java new file mode 100644 index 00000000000..471c13c44e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java @@ -0,0 +1,175 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype001 JDI test. + */ + +public class referencetype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is StringReference.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype002a"; + + private String testedClassName = "java.lang.String"; + + //String mName = "nsk.jdi.ObjectReference.referenceType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + classes = vm.classesByName(debuggeeName); + testedClass = (ReferenceType) classes.get(0); + + StringReference str = (StringReference) testedClass.getValue( + testedClass.fieldByName("str")); + + + log2("......ReferenceType testedClass = str.referenceType();"); + testedClass = str.referenceType(); + + + log2("...... check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + testExitCode = FAILED; + } + + try { + log2(".......check up on cast to ClassType; no Exception expected"); + ClassType ct = (ClassType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ClassType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ClassType ct = (ClassType) testedClass;"); + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + + + log2(".......check up on equality ReferenceType str.referenceType() to testedClass"); + ReferenceType testedClass1 = str.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !str.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + testExitCode = FAILED; + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002/TestDescription.java new file mode 100644 index 00000000000..a99bb0e6c34 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes StringReference object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype002; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype002 + * nsk.jdi.ObjectReference.referenceType.referencetype002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002a.java new file mode 100644 index 00000000000..f3ee2d17204 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002a.java @@ -0,0 +1,115 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype002 JDI test. + */ + +public class referencetype002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static String str = "Hello, world!"; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is ThreadGroupReference.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype003a"; + + private String testedClassName = "java.lang.ThreadGroup"; + + //String mName = "nsk.jdi.ObjectReference.referenceType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + ReferenceType testedClass = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + String mainGroupObj = "mainGroupObj"; + String mainGroupName = "mainthreadGroupName"; + + List classes = null; + + ReferenceType mainThreadClass = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(debuggeeName); + mainThreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + log2(" getting: ThreadGroupReference mainThreadGroup"); + ThreadGroupReference mainThreadGroup = (ThreadGroupReference) + mainThreadClass.getValue(mainThreadClass.fieldByName(mainGroupObj) ); + + log2("......ReferenceType testedClass = mainThreadGroup.referenceType();"); + testedClass = mainThreadGroup.referenceType(); + + + log2("...... check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + expresult = returnCode1; + } + + try { + log2(".......check up on cast to ClassType; no Exception expected"); + ClassType ct = (ClassType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ClassType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ClassType ct = (ClassType) testedClass;"); + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + + log2(".......check up on equality ReferenceType mainThreadGroup.referenceType() to testedClass"); + ReferenceType testedClass1 = mainThreadGroup.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !mainThreadGroup.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + expresult = returnCode1; + } + + + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003/TestDescription.java new file mode 100644 index 00000000000..56ab485830a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes ThreadGroupReference object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype003; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype003 + * nsk.jdi.ObjectReference.referenceType.referencetype003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003a.java new file mode 100644 index 00000000000..3228256c39d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003a.java @@ -0,0 +1,189 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype003 JDI test. + */ + +public class referencetype003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + private static ThreadGroup mainGroupObj = new ThreadGroup("mainthreadGroupName"); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is ClassObjectReference.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype004a"; + + private String className = + "nsk.jdi.ObjectReference.referenceType.referencetype004aTestClass"; + + private String testedClassName = "java.lang.Class"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = null; + + + classes = vm.classesByName(className); + testedClass = (ReferenceType) classes.get(0); + + ClassObjectReference classObjRef = testedClass.classObject(); + + log2("......ReferenceType testedClass = classObjRef.referenceType();"); + testedClass = classObjRef.referenceType(); + + + log2(".......check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + testExitCode = FAILED; + } + + try { + log2(".......check up on cast to ClassType; no Exception expected"); + ClassType ct = (ClassType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ClassType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ClassType ct = (ClassType) testedClass;"); + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + + + log2(".......check up on equality ReferenceType classObjRef.referenceType() to testedClass"); + ReferenceType testedClass1 = classObjRef.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !classObjRef.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004/TestDescription.java new file mode 100644 index 00000000000..7f3bcc418d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes ClassObjectReference object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype004; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype004 + * nsk.jdi.ObjectReference.referenceType.referencetype004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004a.java new file mode 100644 index 00000000000..f0886eac3a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004a.java @@ -0,0 +1,123 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype004 JDI test. + */ + +public class referencetype004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static referencetype004aTestClass obj = new referencetype004aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is ArrayReference
    + * of ClassType.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype005().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype005a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.referenceType.referencetype005aClassForCheck[]"; + + String mName = "nsk.jdi.ObjectReference.referenceType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOftestedClasses = vm.classesByName(mName + ".referencetype005aTestClass"); + if (listOftestedClasses.size() != 1) { + log3("ERROR: listOftestedClasses.size() != 1"); + testExitCode = FAILED; + continue; + } + ReferenceType testedClass = + (ReferenceType) listOftestedClasses.get(0); + + Field fieldArray = testedClass.fieldByName("cfc"); + if (fieldArray == null) { + log3("ERROR: fieldArray == null"); + testExitCode = FAILED; + continue; + } + + ArrayReference arrayRef = (ArrayReference) testedClass.getValue(fieldArray); + + log2("......ReferenceType testedClass = arrayRef.referenceType();"); + testedClass = arrayRef.referenceType(); + + log2("...... check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + testExitCode = FAILED; + } + + try { + log2(".......check up on cast to ArrayType; no Exception expected"); + ArrayType ct = (ArrayType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ArrayType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ArrayType ct = (ArrayType) testedClass;"); + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + + + log2(".......check up on equality ReferenceType arrayRef.referenceType() to testedClass"); + ReferenceType testedClass1 = arrayRef.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !arrayRef.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005/TestDescription.java new file mode 100644 index 00000000000..5f9dbd373d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes Class type Array object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype005; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype005 + * nsk.jdi.ObjectReference.referenceType.referencetype005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005a.java new file mode 100644 index 00000000000..9f017011f75 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005a.java @@ -0,0 +1,150 @@ +/* + * 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. + */ +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! templete parameters !!!! +// ObjectReference InterfaceName ObjectReference +// referenceType MethodName referenceType +// referencetype005 TestName referencetype005a +// ------------------------------------------------------ + +package nsk.jdi.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype005 JDI test. + */ + +public class referencetype005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static referencetype005aTestClass obj = new referencetype005aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is ArrayReference
    + * of InterfaceType.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype006 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype006 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype006().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype006a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.referenceType.referencetype006aInterfaceForCheck[]"; + + String mName = "nsk.jdi.ObjectReference.referenceType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOftestedClasses = vm.classesByName(mName + ".referencetype006aTestClass"); + if (listOftestedClasses.size() != 1) { + log3("ERROR: listOftestedClasses.size() != 1"); + testExitCode = FAILED; + continue; + } + ReferenceType testedClass = + (ReferenceType) listOftestedClasses.get(0); + + Field fieldArray = testedClass.fieldByName("iface"); + if (fieldArray == null) { + log3("ERROR: fieldArray == null"); + testExitCode = FAILED; + continue; + } + + ArrayReference arrayRef = (ArrayReference) testedClass.getValue(fieldArray); + + log2("......ReferenceType testedClass = arrayRef.referenceType();"); + testedClass = arrayRef.referenceType(); + + + log2("...... check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + testExitCode = FAILED; + } + + try { + log2(".......check up on cast to ArrayType; no Exception expected"); + ArrayType ct = (ArrayType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ArrayType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ArrayType ct = (ArrayType) testedClass;"); + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + + + log2(".......check up on equality ReferenceType arrayRef.referenceType() to testedClass"); + ReferenceType testedClass1 = arrayRef.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !arrayRef.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006/TestDescription.java new file mode 100644 index 00000000000..95d1241011a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes Interface type Array object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype006; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype006 + * nsk.jdi.ObjectReference.referenceType.referencetype006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006a.java new file mode 100644 index 00000000000..33225a0bdba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006a.java @@ -0,0 +1,137 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype006 JDI test. + */ + +public class referencetype006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static referencetype006aTestClass obj = new referencetype006aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.referenceType()
    + * complies with its spec when ObjectReference is ArrayReference
    + * of primitive type.
    + *
    + * The test consequently checks up the following assersions:
    + * - the type may be a subclass or implementor of the declared type
    + * of any field or variable which currently holds it;
    + * - the returned ReferenceType will be a ClassType or ArrayType
    + * and never an InterfaceType;
    + * - the type of an object never changes, so this method will
    + * always return the same ReferenceType over the lifetime
    + * of the mirrored object.
    + */ + +public class referencetype007 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/referenceType/referencetype007 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new referencetype007().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.referenceType.referencetype007a"; + + private String testedClassName = "boolean[][]"; + + String mName = "nsk.jdi.ObjectReference.referenceType"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOftestedClasses = vm.classesByName(mName + ".referencetype007aTestClass"); + if (listOftestedClasses.size() != 1) { + log3("ERROR: listOftestedClasses.size() != 1"); + testExitCode = FAILED; + continue; + } + ReferenceType testedClass = + (ReferenceType) listOftestedClasses.get(0); + + Field fieldArray = testedClass.fieldByName("a2"); + if (fieldArray == null) { + log3("ERROR: fieldArray == null"); + testExitCode = FAILED; + continue; + } + + + ArrayReference arrayRef = (ArrayReference) testedClass.getValue(fieldArray); + + log2("......ReferenceType testedClass = arrayRef.referenceType();"); + testedClass = arrayRef.referenceType(); + + log2("...... check up on equality testedClass.name() to String testedClassName"); + if (!testedClass.name().equals(testedClassName)) { + log3("ERROR: check that the type may be a subclass or implementor of the declared type FAILED"); + log3("ERROR: String testedClassName : " + testedClassName); + log3("ERROR: performing statement : !testedClass.name().equals(testedClassName)"); + log3("ERROR: testedClass.name() : " + testedClass.name()); + testExitCode = FAILED; + } + + try { + log2(".......check up on cast to ArrayType; no Exception expected"); + ArrayType ct = (ArrayType) testedClass; + } catch ( Exception e ) { + log3("ERROR: check that ReferenceType will be a ArrayType FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: ArrayType ct = (ArrayType) testedClass;"); + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + + + log2(".......check up on equality ReferenceType arrayRef.referenceType() to testedClass"); + ReferenceType testedClass1 = arrayRef.referenceType(); + if (!testedClass1.equals(testedClass)) { + log3("ERROR: check that the method always return the same RefereneceType object FAILED"); + log3("ERROR: ReferenceType testedClass is of the type : " + testedClass); + log3("ERROR: performing statement: !arrayRef.referenceType().equals(testedClass)"); + log3("ERROR: returned ReferenceType : " + testedClass1); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007/TestDescription.java new file mode 100644 index 00000000000..1f81fde500a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ObjectReference/referenceType/referencetype007. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.referenceType() + * complies with its spec: + * public ReferenceType referenceType() + * Gets the ReferenceType that mirrors the type of this object. + * The type may be a subclass or implementor of the declared type of + * any field or variable which currently holds it. + * For example, right after the following statement. + * Object obj = new String("Hello, world!"); + * The ReferenceType of obj will mirror java.lang.String and + * not java.lang.Object. + * The type of an object never changes, so this method will always return + * the same ReferenceType over the lifetime of the mirrored object. + * The returned ReferenceType will be a ClassType or ArrayType and never + * an InterfaceType. + * Returns: the ReferenceType for this object. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes primitive type Array object, + * and no ObjectCollectedException is expected. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.referenceType.referencetype007; + * the debuggee program - nsk.jdi.ObjectReference.referenceType.referencetype007a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.referenceType.referencetype007 + * nsk.jdi.ObjectReference.referenceType.referencetype007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referenceType.referencetype007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007a.java new file mode 100644 index 00000000000..658247403cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007a.java @@ -0,0 +1,124 @@ +/* + * 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.ObjectReference.referenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the referencetype007 JDI test. + */ + +public class referencetype007a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static referencetype007aTestClass obj = new referencetype007aTestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * do + * - initiate creation of referring objects of type 'refererence_type' + * - check the number of referrers and instances is correct + * - initiate deletion of some referreres(making them unreachable) + * - check the number of referrers and instances is correct + * done + * - Debugger VM + * create references of all possible types to single object, ObjectReference.referringObjects should return only + * referrers with supported type(Strong, PhantomReference, SoftReference, WeakReference) + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects001.referringObjects001 + * nsk.share.jdi.TestClass1 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referringObjects.referringObjects001.referringObjects001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ObjectReference.referringObjects.referringObjects001; + +import java.io.PrintStream; +import java.util.*; + +import nsk.share.*; +import nsk.share.jdi.*; + + +import com.sun.jdi.*; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class referringObjects001 extends HeapwalkingDebugger { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new referringObjects001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return nsk.share.jdi.HeapwalkingDebuggee.class.getName(); + } + + // test given class with all references types + protected void testClass(String className) { + log.display("Test ObjectReference for class: " + className); + + // force GC in debuggee VM to avoid collection of weak references during test execution + forceGC(); + + for (String referrerType : ObjectInstancesManager.allReferenceTypes) { + testReferrerType(referrerType, className); + if (ObjectInstancesManager.isWeak(referrerType)) { + resetStatusIfGC(); + } + } + + int createInstanceCount = 10; + List objectsToFilter = getObjectReferences(className, vm); + + // create instances reachable via all types of references + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_ALL_TYPE_REFERENCES + ":" + className + ":" + createInstanceCount); + + if (!isDebuggeeReady()) + return; + + // ObjectReference.referringObjects should include only supported types of references + checkDebugeeAnswer_instances_referringObjects(objectsToFilter, className, createInstanceCount, true, + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size()); + + for (int i = 0; i < ObjectInstancesManager.allReferenceTypes.size(); i++) { + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_REFERRERS + ":" + className + ":" + 1); + + if (!isDebuggeeReady()) + return; + } + } + + + protected void testReferrerType(String referrerType, String className) { + // can't check number of referrers for objects that was created in debugee VM + // before debugger command (for example primitive type arrays), so we should filter such objects + List objectsToFilter = HeapwalkingDebugger.getObjectReferences(className, vm); + + boolean includedInReferrersCount = HeapwalkingDebuggee.isIncludedIntoReferrersCount(referrerType); + boolean includedInInstancesCount = HeapwalkingDebuggee.isIncludedIntoInstancesCount(referrerType); + + int createInstanceCount = 4; + int referrerCount = 10; + + // create 'createInstanceCount' instances with 'referrerCount' referrers + + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + className + ":" + createInstanceCount + ":" + referrerCount + ":" + + referrerType); + + int expectedInstanceCount; + + if (includedInInstancesCount) + expectedInstanceCount = createInstanceCount; + else + expectedInstanceCount = 0; + + checkDebugeeAnswer_instanceCounts(className, expectedInstanceCount, objectsToFilter); + checkDebugeeAnswer_instances_referringObjects(objectsToFilter, className, expectedInstanceCount, includedInReferrersCount, referrerCount); + + // delete half of referrers + + int deleteCount = referrerCount / 2; + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_REFERRERS + ":" + className + ":" + deleteCount); + + referrerCount -= deleteCount; + + if (includedInInstancesCount) + expectedInstanceCount = createInstanceCount; + else + expectedInstanceCount = 0; + + checkDebugeeAnswer_instanceCounts(className, expectedInstanceCount, objectsToFilter); + checkDebugeeAnswer_instances_referringObjects(objectsToFilter, className, expectedInstanceCount, includedInReferrersCount, referrerCount); + + // delete half of instances + + deleteCount = createInstanceCount / 2; + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + className + ":" + deleteCount); + + createInstanceCount -= deleteCount; + + if (includedInInstancesCount) + expectedInstanceCount = createInstanceCount; + else + expectedInstanceCount = 0; + + checkDebugeeAnswer_instanceCounts(className, expectedInstanceCount, objectsToFilter); + checkDebugeeAnswer_instances_referringObjects(objectsToFilter, className, expectedInstanceCount, includedInReferrersCount, referrerCount); + + // delete all referrers (make object unreachable) + + deleteCount = referrerCount; + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_REFERRERS + ":" + className + ":" + deleteCount); + + referrerCount = 0; + createInstanceCount = 0; + + expectedInstanceCount = 0; + + checkDebugeeAnswer_instanceCounts(className, expectedInstanceCount, objectsToFilter); + checkDebugeeAnswer_instances_referringObjects(objectsToFilter, className, expectedInstanceCount, includedInReferrersCount, referrerCount); + } + + protected void checkDebugeeAnswer_instances_referringObjects(List objectsToFilter, String className, int expectedInstances, + boolean checkReferrers, int expectedReferrers) { + try { + ReferenceType referenceType = debuggee.classByName(className); + + if (checkReferrers) { + List objectReferrences = HeapwalkingDebugger.filterObjectReferrence(objectsToFilter, referenceType.instances(0)); + + // used for non-strict check + int correctObjectsFound = 0; + + for (ObjectReference objectReference : objectReferrences) { + int referrerCount = objectReference.referringObjects(0).size(); + + if (strictCheck(className)) { + if (referrerCount != expectedReferrers) { + setSuccess(false); + log.complain("List with wrong size was returned by ObjectReference.referringObjects: " + referrerCount + ", expected: " + + expectedReferrers); + } + } else { + if (referrerCount == expectedReferrers) { + correctObjectsFound++; + } + } + } + + if (!strictCheck(className)) { + if (correctObjectsFound != expectedInstances) { + setSuccess(false); + log.complain("List with wrong size was returned by ObjectReference.referringObjects, expected: " + expectedReferrers); + } + } + } + } catch (Throwable t) { + log.complain("Unexpected exception:"); + t.printStackTrace(log.getOutStream()); + } + } + + protected void doTest() { + String[] testClassNames = { "java.lang.String", "nsk.share.jdi.TestClass1", "boolean[]", + "float[]" }; + + for (String className : testClassNames) { + testClass(className); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java new file mode 100644 index 00000000000..df9d745d8cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2007, 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/ObjectReference/referringObjects/referringObjects002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test check behaviour of ObjectReference.referringObjects, ObjectReference.disableCollection and + * ObjectReference.enableCollection for ClassObjectReference + * The test scenario is following: + * - Debugger VM + * - initiate in target VM loading of test class: + * - Debugee VM + * - create several instances of loaded class + * - create references of all possible types to loaded class + * - Debugger VM + * - check test class have correct number of referrers + * (class object referrers should include class instances and references with supported types: Strong, PhantomReference, SoftReference, WeakReference) + * - Debugger VM + * - initiate in debuggee removing of class instances and class object references + * - check test class have correct number of referrers + * - Debugger VM + * - prevent collection of class object using ObjectReference.disableCollection + * - initiate test class unloading in debugee VM + * - check class object was not collected + * - enable collection of class object using ObjectReference.enableCollection + * - check class object was collected + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002 + * nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002a + * nsk.share.jdi.TestClass1 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + */ + +package nsk.jdi.ObjectReference.referringObjects.referringObjects002; + +import java.io.PrintStream; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; + +public class referringObjects002 extends HeapwalkingDebugger { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new referringObjects002().runIt(argv, out); + } + + protected String debuggeeClassName() { + if (classpath == null) { + throw new TestBug("Debugger requires 'testClassPath' parameter"); + } + + return nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002a.class.getName() + + " -testClassPath " + classpath; + } + + public void checkClassObjectReferrersCount(ClassObjectReference classObjectReference, int expectedCount) { + int referrersCount = classObjectReference.referringObjects(0).size(); + + if (referrersCount != expectedCount) { + setSuccess(false); + log.complain("Unexpected size of ClassLoaderReference.referringObjects: " + referrersCount + ", expected: " + expectedCount); + } + } + + protected void doTest() { + String className = "nsk.share.jdi.TestClass1"; + + int createInstances = 10; + + pipe.println(HeapwalkingDebuggee.COMMAND_LOAD_CLASS + ":" + className + ":" + createInstances); + + if (!isDebuggeeReady()) + return; + + // each class instances has reference to class object + + // + 'includedIntoReferrersCountTypes.size()' referrers was additionally created + // +1 referrer is classloader + // +1 referrer is debugee class unloader + int expectedReferrersCount = createInstances + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size() + 2; + + ClassObjectReference classObjectReference = debuggee.classByName(className).classObject(); + + checkClassObjectReferrersCount(classObjectReference, expectedReferrersCount); + + pipe.println(referringObjects002a.COMMAND_DELETE_CLASS_OBJECT_REFERRERS); + + if (!isDebuggeeReady()) + return; + + // Only this referrers should left: + // 1 referrer is classloader + // 1 referrer is debugee class unloader + expectedReferrersCount = 2; + + checkClassObjectReferrersCount(classObjectReference, expectedReferrersCount); + + // disable collection and try unload class object + classObjectReference.disableCollection(); + + pipe.println(HeapwalkingDebuggee.COMMAND_UNLOAD_CLASS + ":" + className + ":" + HeapwalkingDebuggee.UNLOAD_RESULT_FALSE); + + if (!isDebuggeeReady()) + return; + + try { + classObjectReference.referringObjects(0); + } catch (ObjectCollectedException e) { + setSuccess(false); + log.complain("Class object was collected after disableCollection"); + return; + } + + // enable collection and try unload class object + classObjectReference.enableCollection(); + + pipe.println(HeapwalkingDebuggee.COMMAND_UNLOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + try { + classObjectReference.referringObjects(0); + } catch (ObjectCollectedException expectedException) { + // expected exception + return; + } + + setSuccess(false); + log.complain("Class object was not collected after enableCollection"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002a.java new file mode 100644 index 00000000000..1e90e159b58 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002a.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2007, 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.ObjectReference.referringObjects.referringObjects002; + +import nsk.share.ClassUnloader; +import nsk.share.ObjectInstancesManager; +import nsk.share.ReferringObject; +import nsk.share.TestBug; +import nsk.share.jdi.HeapwalkingDebuggee; +import java.io.*; +import java.util.*; + +/* + * Class create and save given number of class instances + */ +class Instances { + Instances(Class klass, int instanceCount) { + try { + for (int i = 0; i < instanceCount; i++) + instances.add(klass.newInstance()); + } catch (Throwable t) { + throw new TestBug("Unexpected error during test class instantiation: " + t); + } + } + + private List instances = new ArrayList(); +} + +/* + * Debuggee class handle request for loading classes with custom classloader and creating class instances + */ +public class referringObjects002a extends HeapwalkingDebuggee { + private Map classesInstances = new HashMap(); + + private List classReferrers = new ArrayList(); + + final static public String COMMAND_DELETE_CLASS_OBJECT_REFERRERS = "deleteClassObjectReferrers"; + + public static void main(String args[]) { + new referringObjects002a().doTest(args); + } + + // create references of all possible types to class object + public void createClassObjectReferrers(String className, int instanceCount) { + ClassUnloader unloader = loadedClasses.get(className); + + if (unloader == null) + throw new TestBug("Unloader is null for class: " + className); + + Class klass = unloader.getLoadedClass(); + + if (klass == null) + throw new TestBug("Unloader return null class object, for classname: " + className); + + classesInstances.put(className, new Instances(klass, instanceCount)); + + for (String referenceType : ObjectInstancesManager.allReferenceTypes) + classReferrers.add(new ReferringObject(klass, referenceType)); + } + + // delete all created references to class object + public void deleteClassObjectReferrers() { + classesInstances = null; + + for (ReferringObject referrer : classReferrers) + referrer.delete(); + + classReferrers.clear(); + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) { + // need do some additional actions for COMMAND_LOAD_CLASS + if (!command.startsWith(COMMAND_LOAD_CLASS)) + return true; + } + + try { + StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(command)); + tokenizer.whitespaceChars(':', ':'); + + if (command.startsWith(COMMAND_LOAD_CLASS)) { + tokenizer.nextToken(); + + if (tokenizer.nextToken() != StreamTokenizer.TT_WORD) + throw new IllegalArgumentException("Invalid command format"); + + String className = tokenizer.sval; + + if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) + throw new IllegalArgumentException("Invalid command format"); + + int instanceCount = (int) tokenizer.nval; + + createClassObjectReferrers(className, instanceCount); + + return true; + } else if (command.equals(COMMAND_DELETE_CLASS_OBJECT_REFERRERS)) { + deleteClassObjectReferrers(); + + return true; + } + } catch (IOException e) { + throw new TestBug("Invalid command format: " + command); + } + + return false; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003.java new file mode 100644 index 00000000000..dcced7f9a6d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003.java @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2007, 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/ObjectReference/referringObjects/referringObjects003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test check behaviour of ObjectReference.referringObjects for ThreadReference and ThreadGroupReference + * and ObjectReference.disableCollection/ObjectReference.enableCollection for ThreadGroupReference + * The test scenario is following: + * - Debugger VM + * - initiate in target VM thread execution: + * - Debugee VM + * - start several threads included in thread group + * - create references of all possible types to all started threads and thread group + * - Debugger VM + * - check that threads and thread group have correct number of referrers: + * (thread referrers should include thread group and references with supported types, + * thread group referrers should include group's threads, parent thread group and references with supported types) + * - Debugger VM + * - initiate in target VM thread stop: + * - Debugee VM + * - stop all threads and remove all references to threads and thread group + * - Debugger VM + * - check that thread group have only 1 referrer: parent thread group + * - check that threre are no references to test threads in target VM + * - Debugger VM + * - test ObjectReference.disableCollection, ObjectReference.enableCollection for ThreadGroupReference: + * can't force collection of thread group because of thread group always has 1 referrer - parent thread group, so + * just test disableCollection/enableCollection don't throw any unexpected exceptions + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 + * nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003a + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ObjectReference.referringObjects.referringObjects003; + +import java.io.PrintStream; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class referringObjects003 extends HeapwalkingDebugger { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new referringObjects003().runIt(argv, out); + } + + protected String debuggeeClassName() { + return "nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003a"; + } + + // check ObjectReference type and number of referrers + public void checkThreadGroupReferrersCount(List objectReferences, int expectedCount) { + for (ObjectReference objectReference : objectReferences) { + if (!(objectReference instanceof ThreadGroupReference)) { + setSuccess(false); + log.complain("Unexpected type of ObjectReference: " + objectReference.getClass().getName() + + ", expected ThreadGroupReference"); + } + + int referrerCount = objectReference.referringObjects(0).size(); + + if (referrerCount != expectedCount) { + setSuccess(false); + log + .complain("List with wrong size was returned by ObjectReference.referringObjects(ThreadGroupReference): " + + referrerCount + ", expected: " + expectedCount); + } + } + } + + // check ObjectReference type and number of referrers + public void checkThreadReferrersCount(List objectReferences, int expectedCount) { + for (ObjectReference objectReference : objectReferences) { + if (!(objectReference instanceof ThreadReference)) { + setSuccess(false); + log.complain("Unexpected type of ObjectReference: " + objectReference.getClass().getName() + + ", expected ThreadReference"); + } + + if (((ThreadReference)objectReference).name().contains("Test thread") == false) + continue; + + int referrerCount = objectReference.referringObjects(0).size(); + + if (referrerCount != expectedCount) { + setSuccess(false); + log.complain("List with wrong size was returned by ObjectReference.referringObjects(ThreadReferrence): " + + referrerCount + ", expected: " + expectedCount); + } + } + } + + public void doTest() { + int threadCount = 15; + + // threads and thread groups loaded before debugger command should be + // filtered + List threadGroupsToFilter = HeapwalkingDebugger.getObjectReferences( + "java.lang.ThreadGroup", + vm); + List threadsToFilter = HeapwalkingDebugger.getObjectReferences("java.lang.Thread", vm); + + pipe.println(referringObjects003a.COMMAND_START_THREADS + ":" + threadCount); + + if (!isDebuggeeReady()) + return; + + // check instance count + checkDebugeeAnswer_instances("java.lang.ThreadGroup", threadGroupsToFilter.size() + 1); + checkDebugeeAnswer_instances("java.lang.Thread", threadsToFilter.size() + threadCount); + + List threadGroups = HeapwalkingDebugger.filterObjectReferrence( + threadGroupsToFilter, + HeapwalkingDebugger.getObjectReferences("java.lang.ThreadGroup", vm)); + + // thread group has 'threadCount' referrers + 1 referrer is parent + // thread group + // + 'includedIntoReferrersCountTypes.size()' referrers was additionally + // created + int expectedCount = threadCount + 1 + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size(); + + checkThreadGroupReferrersCount(threadGroups, expectedCount); + + List threads = HeapwalkingDebugger.filterObjectReferrence(threadsToFilter, HeapwalkingDebugger + .getObjectReferences("java.lang.Thread", vm)); + + expectedCount = 2 + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size(); + + // 1 referrer is debugee object + 1 referrer is thread group + // + 'includedIntoReferrersCountTypes.size()' referrers was additionally + // created + checkThreadReferrersCount(threads, expectedCount); + + pipe.println(referringObjects003a.COMMAND_STOP_THREADS); + + if (!isDebuggeeReady()) + return; + + checkDebugeeAnswer_instances("java.lang.ThreadGroup", threadGroupsToFilter.size() + 1); + checkDebugeeAnswer_instances("java.lang.Thread", threadsToFilter.size()); + + threadGroups = HeapwalkingDebugger.filterObjectReferrence(threadGroupsToFilter, HeapwalkingDebugger + .getObjectReferences("java.lang.ThreadGroup", vm)); + + // 1 referrer(parent thread group) is left + checkThreadGroupReferrersCount(threadGroups, 1); + + threads = HeapwalkingDebugger.filterObjectReferrence(threadsToFilter, HeapwalkingDebugger.getObjectReferences( + "java.lang.Thread", + vm)); + + if (threads.size() != 0) { + log.complain("All test threads should be removed"); + log.complain("Unexpected threads:"); + for (ObjectReference objectReference : threads) { + log.complain(objectReference.toString()); + } + } + + checkThreadGroupDisableCollection(threadGroups); + } + + // can't force collection of thread group because of 1 reference is always + // left in parent tread group + public void checkThreadGroupDisableCollection(List objectReferences) { + try { + for (ObjectReference objectReference : objectReferences) + objectReference.disableCollection(); + } catch (Throwable t) { + log.complain("Unexpected exception: " + t); + t.printStackTrace(log.getOutStream()); + } + + forceGC(); + try { + for (ObjectReference objectReference : objectReferences) + objectReference.enableCollection(); + } catch (Throwable t) { + log.complain("Unexpected exception: " + t); + t.printStackTrace(log.getOutStream()); + } + + forceGC(); + try { + for (ObjectReference objectReference : objectReferences) + objectReference.referringObjects(0); + } catch (Throwable t) { + log.complain("Unexpected exception: " + t); + t.printStackTrace(log.getOutStream()); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003a.java new file mode 100644 index 00000000000..694bf62ee4b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003a.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2007, 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.ObjectReference.referringObjects.referringObjects003; + +import java.io.*; +import java.util.*; +import nsk.share.*; +import nsk.share.jdi.HeapwalkingDebuggee; + +/* + * Test class handle request for start/stop test threads(threads are included in special thread group) + */ +public class referringObjects003a extends HeapwalkingDebuggee { + class TestThread implements Runnable { + public void run() { + wicket.waitFor(); + } + } + + private Wicket wicket = new Wicket(); + + private List threads = new ArrayList(); + + private List referrers; + + public static final String COMMAND_START_THREADS = "startThreads"; + + public static final String COMMAND_STOP_THREADS = "stopThreads"; + + public static void main(String args[]) { + new referringObjects003a().doTest(args); + } + + private void addAllTypeReferernces(Object object) { + for (String referenceType : ObjectInstancesManager.allReferenceTypes) + referrers.add(new ReferringObject(object, referenceType)); + } + + public void startThreads(int threadCount) { + referrers = new ArrayList(); + + ThreadGroup threadGroup = new ThreadGroup("Test thread group"); + addAllTypeReferernces(threadGroup); + + for (int i = 0; i < threadCount; i++) { + Thread testThread = new Thread(threadGroup, new TestThread(), "Test thread " + i); + threads.add(testThread); + addAllTypeReferernces(testThread); + testThread.start(); + } + } + + public void stopThreads() { + wicket.unlockAll(); + + for (Thread testThread : threads) { + try { + testThread.join(); + } catch (InterruptedException e) { + log.display("Main thread was unexpected interrupted"); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + + for (ReferringObject referringObject : referrers) + referringObject.delete(); + + threads = null; + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + try { + StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(command)); + tokenizer.whitespaceChars(':', ':'); + + if (command.startsWith(COMMAND_START_THREADS)) { + tokenizer.nextToken(); + + if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) + throw new IllegalArgumentException("Invalid command format"); + + int threadCount = (int) tokenizer.nval; + + startThreads(threadCount); + + return true; + } else if (command.equals(COMMAND_STOP_THREADS)) { + stopThreads(); + + return true; + } + + } catch (IOException e) { + throw new TestBug("Invalid command format: " + command); + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects004/referringObjects004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects004/referringObjects004.java new file mode 100644 index 00000000000..24b4d6e0d35 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects004/referringObjects004.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2007, 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/ObjectReference/referringObjects/referringObjects004. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test checks behavior of ObjectReference.referringObjects() in case when there are + * many (several thousands) referring objects for corresponding ObjectReference. + * Debugger forces debuggee create instance of 'nsk.share.jdi.TestClass1' with 100000 (this value can be changed through parameter -referrerCount) + * referrers, obtains ObjectReference for this instance and checks that ObjectReference.referringObjects() + * returns collection with correct size and returned instances doesn't throw any exception when call following methods: + * referenceType() + * isCollected() + * uniqueID() + * hashCode() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects004.referringObjects004 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ObjectReference.referringObjects.referringObjects004.referringObjects004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ObjectReference.referringObjects.referringObjects004; + +import java.io.PrintStream; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.ObjectInstancesManager; +import nsk.share.ReferringObject; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.jdi.TestClass1; + +public class referringObjects004 extends HeapwalkingDebugger { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new referringObjects004().runIt(argv, out); + } + + protected String debuggeeClassName() { + return HeapwalkingDebuggee.class.getName(); + } + + private int referrerCount = 100000; + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-referrerCount") && (i < args.length - 1)) { + referrerCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + public void doTest() { + String className = TestClass1.class.getName(); + + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + className + ":" + 1 + ":" + referrerCount + + ":" + ObjectInstancesManager.STRONG_REFERENCE); + + if (!isDebuggeeReady()) + return; + + ObjectReference objectReference = findSingleObjectReference(className); + + if (objectReference.referringObjects(0).size() != referrerCount) { + setSuccess(false); + log.complain("List with wrong size was returned by ObjectReference.referringObjects: " + + objectReference.referringObjects(0).size() + ", expected: " + referrerCount); + } + + List referrers = objectReference.referringObjects(0); + + ReferenceType referrerReferenceType = debuggee.classByName(ReferringObject.class.getName()); + + vm.suspend(); + + for (ObjectReference referrer : referrers) { + try { + if (!referrerReferenceType.equals(referrer.referenceType())) { + setSuccess(false); + log.complain("Referrer's ReferenceType " + referrer.referenceType() + " doesn't equal " + + referrerReferenceType); + } + if (referrer.isCollected()) { + setSuccess(false); + log.complain("isCollected() returns 'true' for " + referrer); + } + referrer.uniqueID(); + referrer.hashCode(); + } catch (Throwable t) { + setSuccess(false); + t.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + t); + } + } + + vm.resume(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java new file mode 100644 index 00000000000..a8d975b14b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java @@ -0,0 +1,458 @@ +/* + * 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.ObjectReference.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.setValue()
    + * complies with its specification.
    + * The cases for testing include values of class and instance
    + * variables of primitive types each.
    + * No Exception is expected to be thrown.
    + */ + +public class setvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/setValue/setvalue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.setValue.setvalue001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.setValue.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String testObjName = "obj"; + + ReferenceType testedClass = null; + ReferenceType debuggeeClass = null; + ObjectReference objRef = null; + + List classes = null; + + classes = vm.classesByName(debuggeeName); + debuggeeClass = (ReferenceType) classes.get(0); + + objRef = (ObjectReference) + debuggeeClass.getValue(debuggeeClass.fieldByName(testObjName)); + + classes = vm.classesByName(testedClassName); + testedClass = (ReferenceType) classes.get(0); + + + Field fsbl1 = testedClass.fieldByName("bl1"); + Field fsbt1 = testedClass.fieldByName("bt1"); + Field fsch1 = testedClass.fieldByName("ch1"); + Field fsdb1 = testedClass.fieldByName("db1"); + Field fsfl1 = testedClass.fieldByName("fl1"); + Field fsin1 = testedClass.fieldByName("in1"); + Field fsln1 = testedClass.fieldByName("ln1"); + Field fssh1 = testedClass.fieldByName("sh1"); + + Field fsbl2 = testedClass.fieldByName("bl2"); + Field fsbt2 = testedClass.fieldByName("bt2"); + Field fsch2 = testedClass.fieldByName("ch2"); + Field fsdb2 = testedClass.fieldByName("db2"); + Field fsfl2 = testedClass.fieldByName("fl2"); + Field fsin2 = testedClass.fieldByName("in2"); + Field fsln2 = testedClass.fieldByName("ln2"); + Field fssh2 = testedClass.fieldByName("sh2"); + + + log2("......loop of checks on each primitive type by performing statements like first ones:"); + log2(" BooleanValue blv1 = (BooleanValue) objRef.getValue(fsbl1);"); + log2(" BooleanValue blv2 = (BooleanValue) objRef.getValue(fsbl2);"); + log2(" boolean bl1 = blv1.value();"); + log2(" boolean bl2 = blv2.value();"); + log2(" objRef.setValue(fsbl1, blv2);"); + log2(" objRef.setValue(fsbl2, blv1);"); + log2(" blv1 = (BooleanValue) objRef.getValue(fsbl1);"); + log2(" if (blv1.value() != false) {"); + log2(" log3('ERROR: getValue(fsbl1) != false');"); + log2(" }"); + log2(" blv2 = (BooleanValue) objRef.getValue(fsbl2);"); + log2(" if (blv2.value() != true) {"); + log2(" log3('ERROR: getValue(fsbl2) != true');"); + log2(" }"); + + for ( int i3 = 0; i3 < 8; i3++) { + + try { + + switch (i3) { + + case 0: + log2(" checking up on boolean"); + + BooleanValue blv1 = (BooleanValue) objRef.getValue(fsbl1); + BooleanValue blv2 = (BooleanValue) objRef.getValue(fsbl2); + + boolean bl1 = blv1.value(); + boolean bl2 = blv2.value(); + + objRef.setValue(fsbl1, blv2); + objRef.setValue(fsbl2, blv1); + + blv1 = (BooleanValue) objRef.getValue(fsbl1); + if (blv1.value() != bl2) { + log3("ERROR: getValue(fsbl1) != bl2"); + testExitCode = FAILED; + } + blv2 = (BooleanValue) objRef.getValue(fsbl2); + if (blv2.value() != bl1) { + log3("ERROR: getValue(fsbl2) != bl1"); + testExitCode = FAILED; + } + break; + + case 1: + log2(" checking up on byte"); + + ByteValue btv1 = (ByteValue) objRef.getValue(fsbt1); + ByteValue btv2 = (ByteValue) objRef.getValue(fsbt2); + + byte bt1 = btv1.value(); + byte bt2 = btv2.value(); + + objRef.setValue(fsbt1, btv2); + objRef.setValue(fsbt2, btv1); + + btv1 = (ByteValue) objRef.getValue(fsbt1); + if (btv1.value() != bt2) { + log3("ERROR: getValue(fsbt1) != bt2"); + testExitCode = FAILED; + } + btv2 = (ByteValue) objRef.getValue(fsbt2); + if (btv2.value() != bt1) { + log3("ERROR: getValue(fsbt2) != bt1"); + testExitCode = FAILED; + } + break; + + case 2: + log2(" checking up on char"); + + CharValue chv1 = (CharValue) objRef.getValue(fsch1); + CharValue chv2 = (CharValue) objRef.getValue(fsch2); + + char ch1 = chv1.value(); + char ch2 = chv2.value(); + + objRef.setValue(fsch1, chv2); + objRef.setValue(fsch2, chv1); + + chv1 = (CharValue) objRef.getValue(fsch1); + if (chv1.value() != ch2) { + log3("ERROR: getValue(fsch1) != ch2"); + testExitCode = FAILED; + } + chv2 = (CharValue) objRef.getValue(fsch2); + if (chv2.value() != ch1) { + log3("ERROR: getValue(fsch2) != ch1"); + testExitCode = FAILED; + } + break; + + case 3: + log2(" checking up on double"); + + DoubleValue dbv1 = (DoubleValue) objRef.getValue(fsdb1); + DoubleValue dbv2 = (DoubleValue) objRef.getValue(fsdb2); + + double db1 = dbv1.value(); + double db2 = dbv2.value(); + + objRef.setValue(fsdb1, dbv2); + objRef.setValue(fsdb2, dbv1); + + dbv1 = (DoubleValue) objRef.getValue(fsdb1); + if (dbv1.value() != db2) { + log3("ERROR: getValue(fsdb1) != db2"); + testExitCode = FAILED; + } + dbv2 = (DoubleValue) objRef.getValue(fsdb2); + if (dbv2.value() != db1) { + log3("ERROR: getValue(fsdb2) != db1"); + testExitCode = FAILED; + } + break; + + case 4: + log2(" checking up on float"); + + FloatValue flv1 = (FloatValue) objRef.getValue(fsfl1); + FloatValue flv2 = (FloatValue) objRef.getValue(fsfl2); + + float fl1 = flv1.value(); + float fl2 = flv2.value(); + + objRef.setValue(fsfl1, flv2); + objRef.setValue(fsfl2, flv1); + + flv1 = (FloatValue) objRef.getValue(fsfl1); + if (flv1.value() != fl2) { + log3("ERROR: getValue(fsfl1) != fl2"); + testExitCode = FAILED; + } + flv2 = (FloatValue) objRef.getValue(fsfl2); + if (flv2.value() != fl1) { + log3("ERROR: getValue(fsfl2) != fl1"); + testExitCode = FAILED; + } + break; + + case 5: + log2(" checking up on int"); + + IntegerValue inv1 = (IntegerValue) objRef.getValue(fsin1); + IntegerValue inv2 = (IntegerValue) objRef.getValue(fsin2); + + int in1 = inv1.value(); + int in2 = inv2.value(); + + objRef.setValue(fsin1, inv2); + objRef.setValue(fsin2, inv1); + + inv1 = (IntegerValue) objRef.getValue(fsin1); + if (inv1.value() != in2) { + log3("ERROR: getValue(fsin1) != in2"); + testExitCode = FAILED; + } + inv2 = (IntegerValue) objRef.getValue(fsin2); + if (inv2.value() != in1) { + log3("ERROR: getValue(fsin2) != in1"); + testExitCode = FAILED; + } + break; + + case 6: + log2(" checking up on long"); + + LongValue lnv1 = (LongValue) objRef.getValue(fsln1); + LongValue lnv2 = (LongValue) objRef.getValue(fsln2); + + long ln1 = lnv1.value(); + long ln2 = lnv2.value(); + + objRef.setValue(fsln1, lnv2); + objRef.setValue(fsln2, lnv1); + + lnv1 = (LongValue) objRef.getValue(fsln1); + if (lnv1.value() != ln2) { + log3("ERROR: getValue(fsln1) != ln2"); + testExitCode = FAILED; + } + lnv2 = (LongValue) objRef.getValue(fsln2); + if (lnv2.value() != ln1) { + log3("ERROR: getValue(fsln2) != ln1"); + testExitCode = FAILED; + } + break; + + case 7: + log2(" checking up on short"); + + ShortValue shv1 = (ShortValue) objRef.getValue(fssh1); + ShortValue shv2 = (ShortValue) objRef.getValue(fssh2); + + short sh1 = shv1.value(); + short sh2 = shv2.value(); + + objRef.setValue(fssh1, shv2); + objRef.setValue(fssh2, shv1); + + shv1 = (ShortValue) objRef.getValue(fssh1); + if (shv1.value() != sh2) { + log3("ERROR: getValue(fssh1) != sh2"); + testExitCode = FAILED; + } + shv2 = (ShortValue) objRef.getValue(fssh2); + if (shv2.value() != sh1) { + log3("ERROR: getValue(fssh2) != sh1"); + testExitCode = FAILED; + } + break; + + + default : log3("ERROR: TEST ERROR: case: default:"); + testExitCode = FAILED; + break; + + } // end of switch + + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + testExitCode = FAILED; + } // end of try + + } // end of for + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001/TestDescription.java new file mode 100644 index 00000000000..93d77facee2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001/TestDescription.java @@ -0,0 +1,99 @@ +/* + * 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/ObjectReference/setValue/setvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.setValue() + * complies with its spec: + * public void setValue(Field field, Value value) + * throws InvalidTypeException, ClassNotLoadedException + * Sets the value of a given instance or static field in this object. + * The Field must be valid for this ObjectReference; + * that is, there must be a widening reference conversion from this object + * to the field's type. If static, the field must not be final. + * Object values must be assignment compatible with the field type + * (This implies that the field type must be loaded through + * the enclosing class's class loader). + * Primitive values must be either assignment compatible with the field type or + * must be convertible to the field type without loss of information. + * See the JavaTM Language Specification.section 5.2 for more information on + * assignment compatibility. + * Parameters: field - the field containing the requested value + * value - the new value to assign + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * InvalidTypeException - + * if the value's type does not match the field's type. + * ClassNotLoadedException - + * if the field type has not yet been loaded through + * the appropriate class loader. + * ObjectCollectedException - + * if this object or the new value (if an ObjectReference) has been + * garbage collected. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The cases for testing include values of class and instance + * variables of primitive types each. + * No Exception is expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.setValue.setvalue 00; + * the debuggee program - nsk.jdi.ObjectReference.setValue.setvalue 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.setValue.setvalue001 + * nsk.jdi.ObjectReference.setValue.setvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.setValue.setvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001a.java new file mode 100644 index 00000000000..af98b9b9609 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001a.java @@ -0,0 +1,144 @@ +/* + * 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.ObjectReference.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setvalue001 JDI test. + */ + +public class setvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ObjectReference.setValue() + * properly throws IllegalArgumentException - if the + * field is not valid for this object's class.
    + * The debuggee part of the test contains two classes: the main one + * setvalue002t and the dummy one DummyClass. Each of + * them has the same set of static and instance fields.
    + * The debugger part provokes the IllegalArgumentException trying to + * set value of: + *
  • an object reference to the debuggee's class setvalue002t + * and Field's value from an object reference to the debuggee's class + * DummyClass + *
  • an object reference to the debuggee's class DummyClass + * and Field's value from an object reference to the debuggee's class + * setvalue002t.
    + */ +public class setvalue002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.setValue.setvalue002t"; + + // name of debuggee's main thread + static final String DEBUGGEE_THRNAME = "setvalue002tThr"; + + // debuggee's local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "dummyCls"; + + static final int ATTEMPTS = 5; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private ThreadReference thrRef = null; + private ObjectReference[] objRef = new ObjectReference[2]; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue002().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType[] rType = new ReferenceType[2]; + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "setvalue002t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee's thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: Unable to suspend debuggee's thread"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee's thread suspension ..."); + try { + Thread.currentThread().sleep(1000); + } catch(InterruptedException ie) { + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + +// Check the tested assersion + try { + findObjRefs(DEBUGGEE_LOCALVAR); + rType[0] = objRef[0].referenceType(); + rType[1] = objRef[1].referenceType(); + + // provoke the IllegalArgumentException using an object reference + // to debuggee's main class "setvalue002t" and Field's value from + // an object reference to debuggee's dummy class "DummyClass" + provokeException(objRef[0], rType[0], objRef[1], rType[1]); + + // provoke the IllegalArgumentException using an object reference + // to debuggee's dummy class "DummyClass" and Field's value from + // an object reference to debuggee's main class "setvalue002t" + provokeException(objRef[1], rType[1], objRef[0], rType[0]); + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + +// Finish the test + thrRef.resume(); + return quitDebuggee(); + } + + private void findObjRefs(String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = stackFr.visibleVariableByName(varName); + if (locVar == null) + continue; + // main debuggee class + objRef[0] = stackFr.thisObject(); + // dummy debuggee class + objRef[1] = (ObjectReference)stackFr.getValue(locVar); + return; + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee's stack frame not found"); + } + + private void provokeException(ObjectReference objRef, + ReferenceType refType, + ObjectReference fldObjRef, ReferenceType fldRefType) { + List fields; + + try { + fields = fldRefType.allFields(); + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: allFields for " + + fldObjRef + ": caught: " + e); + tot_res = Consts.TEST_FAILED; + throw new Failure("provokeException: caught unexpected exception"); + } + + Iterator iter = fields.iterator(); + while (iter.hasNext()) { + Field fld = (Field) iter.next(); + try { + log.display("\nTrying to set value for the field \"" + + fld.name() + "\"\n\tfrom the debuggee's object reference \"" + + objRef + + "\"\n\tusing not valid Field's value from the other object reference \"" + + fldObjRef + "\" ..."); + objRef.setValue(fld, objRef.getValue(refType.fieldByName(fld.name()))); + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to set value for the field \"" + + fld.name() + "\"\n\tfrom the debuggee's object reference \"" + + objRef + + "\n\tusing not valid Field's value from the other object reference \"" + + fldObjRef + "\""); + tot_res = Consts.TEST_FAILED; + } catch (IllegalArgumentException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILED: ObjectReference.setValue(): caught unexpected " + + e + "\n\tinstead of expected IllegalArgumentException" + + "\n\twhen attempted to set value for the field \"" + + fld.name() + "\"\n\tfrom the debuggee's object reference \"" + + objRef + + "\n\tusing not valid Field's value from the other object reference \"" + + fldObjRef + "\""); + tot_res = Consts.TEST_FAILED; + } + } + } + + private int quitDebuggee() { + if (thrRef != null) { + if (thrRef.isSuspended()) + thrRef.resume(); + } + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee's process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("Debuggee's process finished with the status: " + + debStat); + + return tot_res; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002/TestDescription.java new file mode 100644 index 00000000000..3769c021718 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002/TestDescription.java @@ -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/ObjectReference/setValue/setvalue002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ObjectReference.setValue() properly throws + * IllegalArgumentException - if the field is not valid for this + * object's class. + * The debuggee part of the test contains two classes: the main one + * "setvalue002t" and the dummy one "DummyClass". Each of them has + * the same set of static and instance fields. + * The debugger part provokes the IllegalArgumentException trying to + * set value of: + * - an object reference to the debuggee's class "setvalue002t" + * and Field's value from an object reference to the debuggee's class + * "DummyClass"; + * - an object reference to the debuggee's class "DummyClass" and + * Field's value from an object reference to the debuggee's class + * "setvalue002t". + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.setValue.setvalue002 + * nsk.jdi.ObjectReference.setValue.setvalue002t + * + * @comment make sure setvalue002t is compiled with full debug info + * @clean nsk.jdi.ObjectReference.setValue.setvalue002t + * @compile -g:lines,source,vars ../setvalue002t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.setValue.setvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002t.java new file mode 100644 index 00000000000..9737c6bcfbc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002t.java @@ -0,0 +1,107 @@ +/* + * 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.ObjectReference.setValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee class. + */ +public class setvalue002t { + // tested static fields + static byte sByteFld = 127; + static short sShortFld = -32768; + static int sIntFld = 2147483647; + static long sLongFld = 9223372036854775807L; + static float sFloatFld = 5.1F; + static double sDoubleFld = 6.2D; + static char sCharFld = 'a'; + static boolean sBooleanFld = false; + static String sStrFld = "instance field"; + + // tested instance fields + byte byteFld = 127; + short shortFld = -32768; + int intFld = 2147483647; + long longFld = 9223372036854775807L; + float floatFld = 5.1F; + double doubleFld = 6.2D; + char charFld = 'a'; + boolean booleanFld = false; + String strFld = "instance field"; + + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new setvalue002t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + setvalue002tDummyClass dummyCls = new setvalue002tDummyClass(); + + Thread.currentThread().setName(setvalue002.DEBUGGEE_THRNAME); + + pipe.println(setvalue002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(setvalue002.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + return Consts.TEST_PASSED; + } +} + +// Dummy class used to provoke IllegalArgumentException in debugger +class setvalue002tDummyClass { + // tested static fields + static byte sByteFld = 127; + static short sShortFld = -32768; + static int sIntFld = 2147483647; + static long sLongFld = 9223372036854775807L; + static float sFloatFld = 5.1F; + static double sDoubleFld = 6.2D; + static char sCharFld = 'a'; + static boolean sBooleanFld = false; + static String sStrFld = "instance field"; + + // tested instance fields + byte byteFld = 127; + short shortFld = -32768; + int intFld = 2147483647; + long longFld = 9223372036854775807L; + float floatFld = 5.1F; + double doubleFld = 6.2D; + char charFld = 'a'; + boolean booleanFld = false; + String strFld = "instance field"; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue003.java new file mode 100644 index 00000000000..e922d6e8466 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue003.java @@ -0,0 +1,264 @@ +/* + * 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.ObjectReference.setValue; + +import com.sun.jdi.*; + +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 + * com.sun.jdi.ObjectReference.setValue() + * properly throws InvalidTypeException - if the Field is valid + * for this ObjectReference, but there is no a widening reference + * conversion from this object to the field's type.
    + * The debuggee part of the test has set of static and instance fields + * of different types. The debugger part provokes the InvalidTypeException + * trying to set value of: + *
  • type not matched with the field's one, and without the widening + * reference conversion as well + *
  • boolean type which can be converted only to boolean.
    + */ +public class setvalue003 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.setValue.setvalue003t"; + + // name of debuggee's main thread + static final String DEBUGGEE_THRNAME = "setvalue003tThr"; + + // debuggee's local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "setvalue003tPipe"; + + static final int ATTEMPTS = 5; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int FLDS_NUM = 34; + // list of debuggee's fields used to set values and ones + // used only to get their wrong non-conversionable values, + // see section "5.1.2 Widening Primitive Conversion" in the JLS + static final String DEBUGGEE_FLDS[][] = { + {"byteFld", "sStrFld"}, + {"shortFld", "intFld"}, + {"intFld", "longFld"}, + {"longFld", "floatFld"}, + {"floatFld", "doubleFld"}, + {"doubleFld", "sBooleanFld"}, + {"charFld", "strFld"}, + {"booleanFld", "byteFld"}, + {"strFld", "sCharFld"}, + {"sByteFld", "sIntFld"}, + {"sShortFld", "doubleFld"}, + {"sIntFld", "sStrFld"}, + {"sLongFld", "sFloatFld"}, + {"sFloatFld", "sDoubleFld"}, + {"sDoubleFld", "strFld"}, + {"sCharFld", "sDoubleFld"}, + {"sBooleanFld", "doubleFld"}, + {"sStrFld", "sDoubleFld"}, + // see section "5.1.1 Identity Conversions" in the JLS: + // "the only permitted conversion that involves the type boolean is + // the identity conversion from boolean to boolean" + {"byteFld", "booleanFld"}, + {"shortFld", "booleanFld"}, + {"intFld", "booleanFld"}, + {"longFld", "booleanFld"}, + {"floatFld", "booleanFld"}, + {"doubleFld", "booleanFld"}, + {"charFld", "booleanFld"}, + {"strFld", "booleanFld"}, + {"sByteFld", "booleanFld"}, + {"sShortFld", "booleanFld"}, + {"sIntFld", "booleanFld"}, + {"sLongFld", "booleanFld"}, + {"sFloatFld", "booleanFld"}, + {"sDoubleFld", "booleanFld"}, + {"sCharFld", "booleanFld"}, + {"sStrFld", "booleanFld"} + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private ThreadReference thrRef = null; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue003().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ObjectReference objRef; + ReferenceType rType; + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "setvalue003t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee's thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: Unable to suspend debuggee's thread"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee's thread suspension ..."); + try { + Thread.sleep(1000); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + +// Check the tested assertion + try { + objRef = findObjRef(DEBUGGEE_LOCALVAR); + rType = objRef.referenceType(); + + // provoke the InvalidTypeException + for (int i=0; icom.sun.jdi.ObjectReference.setValue() + * properly throws IllegalArgumentException when a + * debugger part of the test attempts to set value of + * debuggee's static field which is declared as final.
    + */ +public class setvalue004 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.setValue.setvalue004t"; + + // name of debuggee's main thread + static final String DEBUGGEE_THRNAME = "setvalue004tThr"; + + // debuggee's local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "setvalue004tPipe"; + + static final int ATTEMPTS = 5; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final int FLDS_NUM = 9; + static final String DEBUGGEE_FLDS[] = { + "sByteFld", + "sShortFld", + "sIntFld", + "sLongFld", + "sFloatFld", + "sDoubleFld", + "sCharFld", + "sBooleanFld", + "sStrFld" + }; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private ThreadReference thrRef = null; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue004().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ObjectReference objRef; + ReferenceType rType; + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "setvalue004t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee's thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: Unable to suspend debuggee's thread"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee's thread suspension ..."); + try { + Thread.currentThread().sleep(1000); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + +// Check the tested assersion + try { + objRef = findObjRef(DEBUGGEE_LOCALVAR); + rType = objRef.referenceType(); + + // provoke the IllegalArgumentException + for (int i=0; icom.sun.jdi.ObjectReference.setValue() + * does not throw ClassNotLoadedException when a + * debugger part of the test attempts to set null value of + * a debuggee field of reference type which has not been loaded + * through the appropriate class loader.
    + */ +public class setvalue005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ObjectReference.setValue.setvalue005t"; + + // tested debuggee reference types + static final int REFTYPES_NUM = 3; + static final String DEBUGGEE_REFTYPES[][] = { + {"nsk.jdi.ObjectReference.setValue.setvalue005tDummyType", "dummyType"}, + {"nsk.jdi.ObjectReference.setValue.setvalue005tAbsDummyType", "absDummyType"}, + {"nsk.jdi.ObjectReference.setValue.setvalue005tFinDummyType", "finDummyType"} + }; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "setvalue005tThr"; + + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "setvalue005tPipe"; + + static final int ATTEMPTS = 5; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private ThreadReference thrRef = null; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue005().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ObjectReference objRef; + ReferenceType rType; + String cmd; + int num = 0; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "setvalue005t.err> "); + debuggee.resume(); + cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILED: Unable to suspend debuggee thread after " + + ATTEMPTS + " attempts"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee thread suspension ..."); + try { + Thread.currentThread().sleep(1000); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILED: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + +// Check the tested assersion + try { + objRef = findObjRef(DEBUGGEE_LOCALVAR); + rType = objRef.referenceType(); + + // provoke the ClassNotLoadedException + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.uniqueID()
    + * complies with its specification.
    + *
    + * The test checks up that the method returns a long value.
    + */ + +public class uniqueid001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/uniqueID/uniqueid001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new uniqueid001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.uniqueID.uniqueid001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.uniqueID.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.uniqueID"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String objName = "testObj"; + + log2(".......getting ObjectReference objRef object"); + try { + + testedClass = (ReferenceType) + vm.classesByName(debuggeeName).get(0); + + ObjectReference objRef = (ObjectReference) + testedClass.getValue(testedClass.fieldByName(objName)); + + log2(".......checking up on throwing Exception by objRef.uniqueID()"); + + try { + long id = objRef.uniqueID(); + log2(" uniqueID value == " + id); + } catch ( Exception e2 ) { + testExitCode = FAILED; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001/TestDescription.java new file mode 100644 index 00000000000..91d89ed8013 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001/TestDescription.java @@ -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/ObjectReference/uniqueID/uniqueid001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.uniqueID() + * complies with its spec: + * public long uniqueID() + * Returns a unique identifier for this ObjectReference. + * It is guaranteed to be unique among all ObjectReferences + * from the same VM that have not yet been disposed. + * The guarantee applies as long as this ObjectReference has + * not yet been disposed. + * Returns: a long unique ID + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The test checks up that a returned value is "long". + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.uniqueID.uniqueid 00; + * the debuggee program - nsk.jdi.ObjectReference.uniqueID.uniqueid 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.uniqueID.uniqueid001 + * nsk.jdi.ObjectReference.uniqueID.uniqueid001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.uniqueID.uniqueid001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001a.java new file mode 100644 index 00000000000..d20da8e6290 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001a.java @@ -0,0 +1,139 @@ +/* + * 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.ObjectReference.uniqueID; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the uniqueid001 JDI test. + */ + +public class uniqueid001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ObjectReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ObjectReference.waitingThreads()
    + * complies with its specification.
    + *
    + * The case for testing includes throwing
    + * UnsupportedOperationException
    + * provided
    + * VirtualMachine.canGetMonitorInfo() == false
    + */ + +public class waitingthreads001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ObjectReference/waitingThreads/waitingthreads001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new waitingthreads001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ObjectReference.waitingThreads.waitingthreads001a"; + + private String testedClassName = + "nsk.jdi.ObjectReference.waitingThreads.TestClass"; + + //String mName = "nsk.jdi.ObjectReference.waitingThreads"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String objName = "testObj"; + + log2("getting testedClass object"); + try { + + testedClass = (ReferenceType) + vm.classesByName(debuggeeName).get(0); + + ObjectReference objRef = (ObjectReference) + testedClass.getValue(testedClass.fieldByName(objName)); + + if (!vm.canGetMonitorInfo()) { + + log2(".......vm.canGetMonitorInfo() == false"); + log2(".......checking up on throwing UnsupportedOperationException"); + + try { + List waitingThreads = objRef.waitingThreads(); + log3("ERROR: UnsupportedOperationException is not thrown"); + testExitCode = FAILED; + } catch ( UnsupportedOperationException e1 ) { + log2(" expected UnsupportedOperationException is thrown"); + } catch ( Exception e2 ) { + testExitCode = FAILED; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + } + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads001/TestDescription.java new file mode 100644 index 00000000000..c7af5d87720 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads001/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/ObjectReference/waitingThreads/waitingthreads001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ObjectReference. + * The test checks up that a result of the method + * com.sun.jdi.ObjectReference.waitingThreads() + * complies with its spec: + * public List waitingThreads() + * throws IncompatibleThreadStateException + * Returns a List containing a ThreadReference for each thread + * currently waiting for this object's monitor. + * See ThreadReference.currentContendedMonitor() for information about + * when a thread is considered to be waiting for a monitor. + * Not all target VMs support this operation. + * See VirtualMachine#canGetMonitorInfo to determine if the operation is supported. + * Returns: a List of ThreadReference objects. + * The list has zero length if no threads are waiting for the monitor. + * Throws: UnsupportedOperationException - + * if the target VM does not support this operation. + * IncompatibleThreadStateException - + * if any waiting thread is not suspended in the target VM + * ObjectCollectedException - + * if this object has been garbage collected. + * The case for testing includes throwing + * UnsupportedOperationException + * provided + * VirtualMachine.canGetMonitorInfo() == false + * The test works as follows: + * The debugger program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads 00; + * the debuggee program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads 00a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ObjectReference.waitingThreads.waitingthreads001 + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads001a.java new file mode 100644 index 00000000000..0780d6753ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads001a.java @@ -0,0 +1,139 @@ +/* + * 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.ObjectReference.waitingThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the waitingthreads001 JDI test. + */ + +public class waitingthreads001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass testObj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + debuggee.receiveExpectedSignal(SIGNAL_GO); + + if (debuggee.VM().canGetMonitorInfo()) { + + // Wait up to waitTime until all MyThreads will be blocked on entering in monitor + int waitingCount = 0; + long oldTime = System.currentTimeMillis(); + while ((System.currentTimeMillis() - oldTime) <= waitTime && waitingCount < waitingthreads002a.threadCount) { + Iterator threads = debuggee.VM().allThreads().iterator(); + waitingCount = 0; + while (threads.hasNext()) { + ThreadReference thread = (ThreadReference)threads.next(); + if (thread.name().indexOf(waitingthreads002a.threadNamePrefix) >= 0 && + thread.status() == ThreadReference.THREAD_STATUS_MONITOR ) { + waitingCount++; + } + } + } + + if (waitingCount < waitingthreads002a.threadCount) { + exitStatus = Consts.TEST_FAILED; + complain("After " + waitTime + " ms only " + waitingCount + " of " + waitingthreads002a.threadNamePrefix + "s " + + "\n\t are blocked on entering monitor. Expected count: " + waitingthreads002a.threadCount); + } else { + try { + debuggee.VM().suspend(); + + // check for waitingthreads002a.waitnotifyObj - no waiting threads expected + String fieldName = "waitnotifyObj"; + display("CHECK1 : checking waitingThreads method for ObjectReference of waitingthreads002a." + fieldName); + ObjectReference objRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + try { + List waitingThreads = objRef.waitingThreads(); + if (waitingThreads.size() != 0) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads method returned non-zero size list for " + fieldName); + } else { + display("waitingThreads method returned expected list of zero size for " + fieldName); + } + if (exitStatus == Consts.TEST_PASSED) { + display("CHECK1 PASSED"); + } + } catch (Exception e) { + throw new Failure("Unexpected exception while getting waitingThreads method's result for " + fieldName + " : " + e); + } + + // check for waitingthreads002a.lockingObject - waiting threads expected + fieldName = "lockingObject"; + display("CHECK2: checking waitingThreads method for ObjectReference of waitingthreads002a." + fieldName); + objRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + try { + List waitingThreads = objRef.waitingThreads(); + if (waitingThreads.size() != waitingthreads002a.threadCount) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads method returned list with unexpected size for " + fieldName + + "\n\t expected value : " + waitingthreads002a.threadCount + "; got one : " + waitingThreads.size()); + } else { + // check waitingThreads list + Iterator itr = waitingThreads.iterator(); + while (itr.hasNext()) { + ThreadReference thread = (ThreadReference)itr.next(); + if (thread.name().indexOf(waitingthreads002a.threadNamePrefix) < 0) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads returned list containing ThreadReference with unexpected name: " + thread.name()); + } else { + display("Expected ThreadReference is found in the returned list: " + thread.name()); + } + if (!thread.currentContendedMonitor().equals(objRef)) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads returned list contained ThreadReference with unexpected monitor: " + thread.currentContendedMonitor()); + } + } + } + if (exitStatus == Consts.TEST_PASSED) { + display("CHECK2 PASSED"); + } + } catch (Exception e) { + throw new Failure("Unexpected exception while getting waitingThreads method's result for " + fieldName + " : " + e); + } + } finally { + debuggee.VM().resume(); + } + } + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002/TestDescription.java new file mode 100644 index 00000000000..44b4640640a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/ObjectReference/waitingThreads/waitingthreads002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks an following assertion of + * com.sun.jdi.ObjectReference.waitingThreads method spec: + * Returns a List containing a ThreadReference for each thread currently + * waiting for this object's monitor. + * There are two test cases: + * - An object with no waiting threads. + * A list with zero size is expected to be returned by the method. + * - An object with threads waiting to lock monitor in a synchronized statement. + * The debugger checks with expected results: + * - a size of returned list of ThreadReferences, + * - the names of thread references, + * - whether the thread reference has the same contented monitor object + * as checked one. + * The debugger program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004; + * the debuggee program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004a. + * Communication details between the debugger and the debuggee: + * Using nsk.jdi.share classes, the debugger connects to debuggee program running + * on another VM and establishes a communication pipe with the debuggee. The pipe + * is used in bi-directional way by sending and receiving special commands between + * the debugger and debuggee for synchronization + * In case of error the test produces the exit code 97 and a corresponding error + * message(s). Otherwise, the test is passed and produces the exit code 95 and + * no message. + * COMMENTS: + * 4883502 TEST_BUG: waiting Threads testcases not predictable + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.waitingThreads.waitingthreads002 + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002a.java new file mode 100644 index 00000000000..eb718935f2a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002a.java @@ -0,0 +1,150 @@ +/* + * 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.ObjectReference.waitingThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged applcation of the test. + */ +public class waitingthreads002a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + static final int threadCount = 5; + static final String threadNamePrefix = "MyThread-"; + static waitingthreads002aThread[] threads = new waitingthreads002aThread[threadCount]; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + long waitTime = argHandler.getWaitTime() * 60000; + + pipe.println(waitingthreads002.SIGNAL_READY); + + try { + synchronized (lockingObject) { + display("entered: synchronized (lockingObject) {}"); + synchronized (waitnotifyObj) { + display("entered: synchronized (waitnotifyObj) {}"); + + for (int i = 0; i < threadCount; i++) { + threads[i] = new waitingthreads002aThread(threadNamePrefix + i); + threads[i].start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " start"); + } + } + + pipe.println(waitingthreads002.SIGNAL_GO); + receiveSignal(waitingthreads002.SIGNAL_QUIT); + } + display("exited: synchronized (waitnotifyObj) {}"); + } + display("exited: synchronized (lockingObject) {}"); + + for (int i = 0; i < threadCount; i++) { + if (threads[i].isAlive()) { + try { + threads[i].join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " join"); + } + } + } + +// receiveSignal(waitingthreads002.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(exitStatus + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class waitingthreads002aThread extends Thread { + public waitingthreads002aThread(String threadName) { + super(threadName); + } + + public void run() { + synchronized (waitingthreads002a.waitnotifyObj) { + waitingthreads002a.waitnotifyObj.notifyAll(); + } + + synchronized (waitingthreads002a.lockingObject) { + display("entered: synchronized (lockingObject)"); + } + display("exited: synchronized (lockingObject)"); + } + + private void display (String str) { + waitingthreads002a.display(Thread.currentThread().getName() + " : " + str); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003.java new file mode 100644 index 00000000000..832b3521e95 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003.java @@ -0,0 +1,196 @@ +/* + * 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.ObjectReference.waitingThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class waitingthreads003 { + + //------------------------------------------------------- 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.ObjectReference.waitingThreads."; + private final static String className = "waitingthreads003"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + debuggee.receiveExpectedSignal(SIGNAL_GO); + + if (debuggee.VM().canGetMonitorInfo()) { + + // Wait up to waitTime until all MyThreads will be blocked on entering in monitor + int waitingCount = 0; + long oldTime = System.currentTimeMillis(); + while ((System.currentTimeMillis() - oldTime) <= waitTime && waitingCount < waitingthreads003a.threadCount) { + Iterator threads = debuggee.VM().allThreads().iterator(); + waitingCount = 0; + while (threads.hasNext()) { + ThreadReference thread = (ThreadReference)threads.next(); + if (thread.name().indexOf(waitingthreads003a.threadNamePrefix) >= 0 && + thread.status() == ThreadReference.THREAD_STATUS_MONITOR ) { + waitingCount++; + } + } + } + + if (waitingCount < waitingthreads003a.threadCount) { + exitStatus = Consts.TEST_FAILED; + complain("After " + waitTime + " ms only " + waitingCount + " of " + waitingthreads003a.threadNamePrefix + "s " + + "\n\t are blocked on entering monitor. Expected count: " + waitingthreads003a.threadCount); + } else { + try { + debuggee.VM().suspend(); + + // check for waitingthreads003a.waitnotifyObj - no waiting threads expected + String fieldName = "waitnotifyObj"; + display("CHECK1 : checking waitingThreads method for ObjectReference of waitingthreads003a." + fieldName); + ObjectReference objRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + try { + List waitingThreads = objRef.waitingThreads(); + if (waitingThreads.size() != 0) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads method returned non-zero size list for " + fieldName); + } else { + display("waitingThreads method returned expected list of zero size for " + fieldName); + } + if (exitStatus == Consts.TEST_PASSED) { + display("CHECK1 PASSED"); + } + } catch (Exception e) { + throw new Failure("Unexpected exception while getting waitingThreads method's result for " + fieldName + " : " + e); + } + + // check for waitingthreads003a.lockingObject - waiting threads expected + fieldName = "lockingObject"; + display("CHECK2: checking waitingThreads method for ObjectReference of waitingthreads003a." + fieldName); + objRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + try { + List waitingThreads = objRef.waitingThreads(); + if (waitingThreads.size() != waitingthreads003a.threadCount) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads method returned list with unexpected size for " + fieldName + + "\n\t expected value : " + waitingthreads003a.threadCount + "; got one : " + waitingThreads.size()); + } else { + // check waitingThreads list + Iterator itr = waitingThreads.iterator(); + while (itr.hasNext()) { + ThreadReference thread = (ThreadReference)itr.next(); + if (thread.name().indexOf(waitingthreads003a.threadNamePrefix) < 0) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads returned list containing ThreadReference with unexpected name: " + thread.name()); + } else { + display("Expected ThreadReference is found in the returned list: " + thread.name()); + } + if (!thread.currentContendedMonitor().equals(objRef)) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads returned list contained ThreadReference with unexpected monitor: " + thread.currentContendedMonitor()); + } + } + } + if (exitStatus == Consts.TEST_PASSED) { + display("CHECK2 PASSED"); + } + } catch (Exception e) { + throw new Failure("Unexpected exception while getting waitingThreads method's result for " + fieldName + " : " + e); + } + } finally { + debuggee.VM().resume(); + } + } + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003/TestDescription.java new file mode 100644 index 00000000000..5b370f257de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/ObjectReference/waitingThreads/waitingthreads003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks an following assertion of + * com.sun.jdi.ObjectReference.waitingThreads method spec: + * Returns a List containing a ThreadReference for each thread currently + * waiting for this object's monitor. + * There are two test cases: + * - An object with no waiting threads. + * A list with zero size is expected to be returned by the method. + * - An object with threads waiting to lock monitor in a synchronized method. + * The debugger checks with expected results: + * - a size of returned list of ThreadReferences, + * - the names of thread references, + * - whether the thread reference has the same contented monitor object + * as checked one. + * The debugger program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004; + * the debuggee program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004a. + * Communication details between the debugger and the debuggee: + * Using nsk.jdi.share classes, the debugger connects to debuggee program running + * on another VM and establishes a communication pipe with the debuggee. The pipe + * is used in bi-directional way by sending and receiving special commands between + * the debugger and debuggee for synchronization + * In case of error the test produces the exit code 97 and a corresponding error + * message(s). Otherwise, the test is passed and produces the exit code 95 and + * no message. + * COMMENTS: + * 4883502 TEST_BUG: waiting Threads testcases not predictable + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.waitingThreads.waitingthreads003 + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003a.java new file mode 100644 index 00000000000..5109849e03b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003a.java @@ -0,0 +1,157 @@ +/* + * 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.ObjectReference.waitingThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged applcation of the test. + */ +public class waitingthreads003a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static Object waitnotifyObj = new Object(); + static waitingthreads003aLock lockingObject = new waitingthreads003aLock(); + static final int threadCount = 5; + static final String threadNamePrefix = "MyThread-"; + static waitingthreads003aThread[] threads = new waitingthreads003aThread[threadCount]; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + long waitTime = argHandler.getWaitTime() * 60000; + + pipe.println(waitingthreads003.SIGNAL_READY); + + try { + synchronized (lockingObject) { + display("entered: synchronized (lockingObject) {}"); + synchronized (waitnotifyObj) { + display("entered: synchronized (waitnotifyObj) {}"); + + for (int i = 0; i < threadCount; i++) { + threads[i] = new waitingthreads003aThread(threadNamePrefix + i); + threads[i].start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " start"); + } + } + + pipe.println(waitingthreads003.SIGNAL_GO); + receiveSignal(waitingthreads003.SIGNAL_QUIT); + } + display("exited: synchronized (waitnotifyObj) {}"); + } + display("exited: synchronized (lockingObject) {}"); + + for (int i = 0; i < threadCount; i++) { + if (threads[i].isAlive()) { + try { + threads[i].join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " join"); + } + } + } + +// receiveSignal(waitingthreads003.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(exitStatus + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class waitingthreads003aThread extends Thread { + public waitingthreads003aThread(String threadName) { + super(threadName); + } + + public void run() { + synchronized (waitingthreads003a.waitnotifyObj) { + waitingthreads003a.waitnotifyObj.notifyAll(); + } + waitingthreads003a.lockingObject.foo(); + display("exited: synchronized method foo"); + } + + private void display (String str) { + waitingthreads003a.display(Thread.currentThread().getName() + " : " + str); + } +} + +class waitingthreads003aLock { + synchronized void foo() { + display("entered: synchronized method foo"); + } + + private void display (String str) { + waitingthreads003a.display(Thread.currentThread().getName() + " : " + str); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004.java new file mode 100644 index 00000000000..769a7de625b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004.java @@ -0,0 +1,196 @@ +/* + * 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.ObjectReference.waitingThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class waitingthreads004 { + + //------------------------------------------------------- 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.ObjectReference.waitingThreads."; + private final static String className = "waitingthreads004"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + debuggee.receiveExpectedSignal(SIGNAL_GO); + + if (debuggee.VM().canGetMonitorInfo()) { + + // Wait up to waitTime until all MyThreads will be waiting + int waitingCount = 0; + long oldTime = System.currentTimeMillis(); + while ((System.currentTimeMillis() - oldTime) <= waitTime && waitingCount < waitingthreads004a.threadCount) { + Iterator threads = debuggee.VM().allThreads().iterator(); + waitingCount = 0; + while (threads.hasNext()) { + ThreadReference thread = (ThreadReference)threads.next(); + if (thread.name().indexOf(waitingthreads004a.threadNamePrefix) >= 0 && + thread.status() == ThreadReference.THREAD_STATUS_WAIT ) { + waitingCount++; + } + } + } + + if (waitingCount < waitingthreads004a.threadCount) { + exitStatus = Consts.TEST_FAILED; + complain("After " + waitTime + " ms only " + waitingCount + " of " + waitingthreads004a.threadNamePrefix + "s " + + "\n\t are waiting. Expected count: " + waitingthreads004a.threadCount); + } else { + try { + debuggee.VM().suspend(); + + // check for waitingthreads004a.waitnotifyObj - no waiting threads expected + String fieldName = "waitnotifyObj"; + display("CHECK1 : checking waitingThreads method for ObjectReference of waitingthreads004a." + fieldName); + ObjectReference objRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + try { + List waitingThreads = objRef.waitingThreads(); + if (waitingThreads.size() != 0) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads method returned non-zero size list for " + fieldName); + } else { + display("waitingThreads method returned expected list of zero size for " + fieldName); + } + if (exitStatus == Consts.TEST_PASSED) { + display("CHECK1 PASSED"); + } + } catch (Exception e) { + throw new Failure("Unexpected exception while getting waitingThreads method's result for " + fieldName + " : " + e); + } + + // check for waitingthreads004a.lockingObject - waiting threads expected + fieldName = "lockingObject"; + display("CHECK2: checking waitingThreads method for ObjectReference of waitingthreads004a." + fieldName); + objRef = (ObjectReference) debuggeeClass.getValue(debuggeeClass.fieldByName(fieldName)); + try { + List waitingThreads = objRef.waitingThreads(); + if (waitingThreads.size() != waitingthreads004a.threadCount) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads method returned list with unexpected size for " + fieldName + + "\n\t expected value : " + waitingthreads004a.threadCount + "; got one : " + waitingThreads.size()); + } else { + // check waitingThreads list + Iterator itr = waitingThreads.iterator(); + while (itr.hasNext()) { + ThreadReference thread = (ThreadReference)itr.next(); + if (thread.name().indexOf(waitingthreads004a.threadNamePrefix) < 0) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads returned list containing ThreadReference with unexpected name: " + thread.name()); + } else { + display("Expected ThreadReference is found in the returned list: " + thread.name()); + } + if (!thread.currentContendedMonitor().equals(objRef)) { + exitStatus = Consts.TEST_FAILED; + complain("waitingThreads returned list contained ThreadReference with unexpected monitor: " + thread.currentContendedMonitor()); + } + } + } + if (exitStatus == Consts.TEST_PASSED) { + display("CHECK2 PASSED"); + } + } catch (Exception e) { + throw new Failure("Unexpected exception while getting waitingThreads method's result for " + fieldName + " : " + e); + } + } finally { + debuggee.VM().resume(); + } + } + } + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004/TestDescription.java new file mode 100644 index 00000000000..73d3f0af2fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/ObjectReference/waitingThreads/waitingthreads004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks an following assertion of + * com.sun.jdi.ObjectReference.waitingThreads method spec: + * Returns a List containing a ThreadReference for each thread currently + * waiting for this object's monitor. + * There are two test cases: + * - An object with no waiting threads. + * A list with zero size is expected to be returned by the method. + * - An object with threads waiting in Object.wait(long) method. + * The debugger checks with expected results: + * - a size of returned list of ThreadReferences, + * - the names of thread references, + * - whether the thread reference has the same contented monitor object + * as checked one. + * The debugger program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004; + * the debuggee program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004a. + * Communication details between the debugger and the debuggee: + * Using nsk.jdi.share classes, the debugger connects to debuggee program running + * on another VM and establishes a communication pipe with the debuggee. The pipe + * is used in bi-directional way by sending and receiving special commands between + * the debugger and debuggee for synchronization + * In case of error the test produces the exit code 97 and a corresponding error + * message(s). Otherwise, the test is passed and produces the exit code 95 and + * no message. + * COMMENTS: + * 4883502 TEST_BUG: waiting Threads testcases not predictable + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ObjectReference.waitingThreads.waitingthreads004 + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ObjectReference.waitingThreads.waitingthreads004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004a.java new file mode 100644 index 00000000000..2b2e9a0ffda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004a.java @@ -0,0 +1,159 @@ +/* + * 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.ObjectReference.waitingThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged applcation of the test. + */ +public class waitingthreads004a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + static final int threadCount = 5; + static final String threadNamePrefix = "MyThread-"; + static waitingthreads004aThread[] threads = new waitingthreads004aThread[threadCount]; + static long waitTime; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + waitTime = argHandler.getWaitTime() * 60000; + + pipe.println(waitingthreads004.SIGNAL_READY); + + try { + synchronized (waitnotifyObj) { + display("entered: synchronized (waitnotifyObj) {}"); + + for (int i = 0; i < threadCount; i++) { + threads[i] = new waitingthreads004aThread(threadNamePrefix + i); + threads[i].start(); + try { + waitnotifyObj.wait(); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " start"); + } + } + + pipe.println(waitingthreads004.SIGNAL_GO); + receiveSignal(waitingthreads004.SIGNAL_QUIT); + } + display("exited: synchronized (waitnotifyObj) {}"); + + synchronized (lockingObject) { + display("entered and notifyAll: synchronized (lockingObject) {}"); + lockingObject.notifyAll(); + } + display("exited: synchronized (lockingObject) {}"); + + for (int i = 0; i < threadCount; i++) { + if (threads[i].isAlive()) { + try { + threads[i].join(waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for " + threadNamePrefix + i + " join"); + } + } + } + +// receiveSignal(waitingthreads004.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(exitStatus + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class waitingthreads004aThread extends Thread { + public waitingthreads004aThread(String threadName) { + super(threadName); + } + + public void run() { + synchronized (waitingthreads004a.lockingObject) { + display("entered and waiting: synchronized (lockingObject)"); + + synchronized (waitingthreads004a.waitnotifyObj) { + waitingthreads004a.waitnotifyObj.notifyAll(); + } + + try { + waitingthreads004a.lockingObject.wait(waitingthreads004a.waitTime); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting in " + Thread.currentThread().getName()); + } + } + display("exited: synchronized (lockingObject)"); + } + + private void display (String str) { + waitingthreads004a.display(Thread.currentThread().getName() + " : " + str); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java new file mode 100644 index 00000000000..e9f45a67b32 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java @@ -0,0 +1,206 @@ +/* + * 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.PathSearchingVirtualMachine.baseDirectory; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * PathSearchingVirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PathSearchingVirtualMachine.baseDirectory()
    + * complies with its spec.
    + *
    + * The test checks up that a returned value is not null-string
    + * and no Exception is thrown when the method is invoked.
    + */ + +public class directory001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new directory001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PathSearchingVirtualMachine.baseDirectory.directory001a"; + + //String mName = "nsk.jdi.PathSearchingVirtualMachine.baseDirectory"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + PathSearchingVirtualMachine pvm; + + try { + log2("......getting: pvm = (PathSearchingVirtualMachine) vm;"); + pvm = (PathSearchingVirtualMachine) vm; + + log2("......getting: String baseDirectory = pvm.baseDirectory();"); + String baseDirectory = pvm.baseDirectory(); + log2(" baseDirectory == " + baseDirectory); + + if (baseDirectory == null) { + log3("ERROR: baseDirectory == null"); + testExitCode = FAILED; + } + } catch ( Exception e) { + log3("ERROR: unspecified exception thrown: " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001/TestDescription.java new file mode 100644 index 00000000000..521033c2e63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001/TestDescription.java @@ -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/PathSearchingVirtualMachine/baseDirectory/directory001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PathSearchingVirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.PathSearchingVirtualMachine.baseDirectory() + * complies with its spec: + * public String baseDirectory() + * The test works as follows: + * The debugger program - nsk.jdi.PathSearchingVirtualMachine.baseDirectory.directory001; + * the debuggee program - nsk.jdi.PathSearchingVirtualMachine.baseDirectory.directory001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.PathSearchingVirtualMachine.baseDirectory.directory001 + * nsk.jdi.PathSearchingVirtualMachine.baseDirectory.directory001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PathSearchingVirtualMachine.baseDirectory.directory001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001a.java new file mode 100644 index 00000000000..ee97b4079a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001a.java @@ -0,0 +1,111 @@ +/* + * 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.PathSearchingVirtualMachine.baseDirectory; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the directory001 JDI test. + */ + +public class directory001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PathSearchingVirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PathSearchingVirtualMachine.bootClassPath()
    + * complies with its spec.
    + *
    + * The test checks up that a returned value is not null-List
    + * containing String elements,
    + * and no Exception is thrown when the method is invoked.
    + */ + +public class bootpath001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new bootpath001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PathSearchingVirtualMachine.bootClassPath.bootpath001a"; + + //String mName = "nsk.jdi.PathSearchingVirtualMachine.bootClassPath"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + PathSearchingVirtualMachine pvm; + + try { + log2("......getting: pvm = (PathSearchingVirtualMachine) vm;"); + pvm = (PathSearchingVirtualMachine) vm; + + log2("......getting: List bootClassPath = pvm.bootClassPath();"); + List bootClassPath = pvm.bootClassPath(); + + if (bootClassPath == null) { + log3("ERROR: classPath == null"); + testExitCode = FAILED; + break; + } + + log2("......getting: ListIterator li = bootClassPath.listIterator();"); + ListIterator li = bootClassPath.listIterator(); + + log2("......loop of checking up on ListIterator elements; no Exception is expected"); + String str; + for (; li.hasNext(); ) { + + str = (String) li.next(); + log2(" element == " + str); + } + + } catch ( Exception e) { + log3("ERROR: unspecified exception thrown: " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001/TestDescription.java new file mode 100644 index 00000000000..899557ebe88 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/PathSearchingVirtualMachine/bootClassPath/bootpath001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PathSearchingVirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.PathSearchingVirtualMachine.bootClassPath() + * complies with its spec: + * public List bootClassPath() + * Get the boot class path for this virtual machine. + * Returns: List of components of the boot class path, + * each represented by a String. + * The test checks up that a returned value is not null-List + * containing String elements, + * and no Exception is thrown when the method is invoked. + * The test works as follows: + * The debugger program - nsk.jdi.PathSearchingVirtualMachine.bootClassPath.bootpath001; + * the debuggee program - nsk.jdi.PathSearchingVirtualMachine.bootClassPath.bootpath001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.PathSearchingVirtualMachine.bootClassPath.bootpath001 + * nsk.jdi.PathSearchingVirtualMachine.bootClassPath.bootpath001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PathSearchingVirtualMachine.bootClassPath.bootpath001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001a.java new file mode 100644 index 00000000000..be685a7affd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001a.java @@ -0,0 +1,111 @@ +/* + * 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.PathSearchingVirtualMachine.bootClassPath; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the bootpath001 JDI test. + */ + +public class bootpath001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PathSearchingVirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PathSearchingVirtualMachine.classPath()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * A List returned by the method contains only String elements
    + * and each element is a substring of String returned by
    + * the method System.getProperty("java.class.path")
    + * invoked in a debuggee.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares the check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class classpath001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new classpath001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PathSearchingVirtualMachine.classPath.classpath001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + try { + PathSearchingVirtualMachine pvm; + + String debuggeeClassPathName = "javaClassPath"; + + String debuggeeClassPath = ((StringReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(debuggeeClassPathName)) + ).value(); + + log2("......getting: pvm = (PathSearchingVirtualMachine) vm;"); + pvm = (PathSearchingVirtualMachine) vm; + + log2("......getting: List classPath = pvm.classPath();"); + List classPath = pvm.classPath(); + + if (classPath == null) { + log3("ERROR: classPath == null"); + testExitCode = FAILED; + } + + log2("......getting: ListIterator li = classPath.listIterator();"); + ListIterator li = classPath.listIterator(); + + log2("......loop of checking up on ListIterator elements; no Exception is expected"); + String str; + for (; li.hasNext(); ) { + + str = (String) li.next(); + log2(" : " + str); + + if (debuggeeClassPath.indexOf(str) == -1) { + log3("ERROR: element is not a substring of debuggeeClassPath"); + log2(" element == " + str); + testExitCode = FAILED; + } + } + + } catch ( Exception e) { + log3("ERROR: unspecified exception thrown: " + e); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001/TestDescription.java new file mode 100644 index 00000000000..64c8119953f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001/TestDescription.java @@ -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/PathSearchingVirtualMachine/classPath/classpath001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PathSearchingVirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.PathSearchingVirtualMachine.classPath() + * complies with its spec: + * public List classPath() + * Get the class path for this virtual machine. + * Returns: List of components of the classpath, each represented by a String. + * The test checks that a List returned by the method contains + * only String elements and each element is a substring of String + * returned by the method System.getProperty("java.class.path") . + * The test works as follows: + * The debugger program - nsk.jdi.PathSearchingVirtualMachine.classPath.classpath001; + * the debuggee program - nsk.jdi.PathSearchingVirtualMachine.classPath.classpath001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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 4509548 and + * to eliminate the possibility of the bug 4482592 in the test, + * the test is re-implemented on the base of new interaction mechanism + * for communication between a debugger and debuggee. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PathSearchingVirtualMachine.classPath.classpath001 + * nsk.jdi.PathSearchingVirtualMachine.classPath.classpath001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PathSearchingVirtualMachine.classPath.classpath001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001a.java new file mode 100644 index 00000000000..1d5b8e721ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/classPath/classpath001a.java @@ -0,0 +1,118 @@ +/* + * 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.PathSearchingVirtualMachine.classPath; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the classpath001 JDI test. + */ + +public class classpath001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static String javaClassPath = null; + + //------------------------------------------------------ common section + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + log1("......javaClassPath = System.getProperty('java.class.path');"); + javaClassPath = System.getProperty("java.class.path"); + log1(" java.class.path == " + javaClassPath); + + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..eb20e1bbfa9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001 test +nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect001.connectors.PlugAttachConnector001 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/connectors/PlugAttachConnector001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/connectors/PlugAttachConnector001.java new file mode 100644 index 00000000000..108227ed666 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/connectors/PlugAttachConnector001.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector used by + * nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001 test + */ + +package nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector001 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName = "PlugAttachConnector001_Name"; + static String plugAttachConnectorDescription = "PlugAttachConnector001_Description"; + static Transport plugAttachConnectorTransport = new PlugConnectorsTransport("PlugAttachConnector001_Transport"); + static Map plugAttachConnectorDefaultArguments = new HashMap(); + + + public PlugAttachConnector001() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + plugAttachConnectorDefaultArguments); + } + +} // end of PlugAttachConnector001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/plugAttachConnect001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/plugAttachConnect001.java new file mode 100644 index 00000000000..3c1999d31e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/plugAttachConnect001.java @@ -0,0 +1,243 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the pluggable + * connector named "PlugAttachConnector001_Name" is created on base + * of PlugAttachConnector001 class which implements + * com.sun.jdi.connect.AttachingConnector interface. + * This pluggable connector has to be contained in lists returned + * by VirtualMachineManager.attachingConnectors() and + * by VirtualMachineManager.allConnectors() methods. + * This pluggable connector has to have: + * Connector.description() = "PlugAttachConnector001_Description"; + * Connector.transport().name() = "PlugAttachConnector001_Transport"; + * Connector.defaultArguments() = , i.e without arguments; + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect001.plugAttachConnect001 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect001.plugAttachConnect001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect001; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the pluggable
    + * connector named "PlugAttachConnector001_Name" is created on base
    + * of PlugAttachConnector001 class which implements
    + * com.sun.jdi.connect.AttachingConnector interface.
    + *
    + * This pluggable connector has to be contained in lists returned
    + * by VirtualMachineManager.attachingConnectors() and
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * This pluggable connector has to have:
    + * Connector.description() = "PlugAttachConnector001_Description";
    + * Connector.transport().name() = "PlugAttachConnector001_Transport";
    + * Connector.defaultArguments() = , i.e without arguments;
    + *
    + */ + +public class plugAttachConnect001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugAttachConnect001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugAttachConnect001: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugAttachConnect001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + String expectedPlugAttachConnectorName = "PlugAttachConnector001_Name"; + String expectedPlugAttachConnectorDescription = "PlugAttachConnector001_Description"; + String expectedPlugAttachConnectorTransportName = "PlugAttachConnector001_Transport"; + + logAlways("==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001 test..."); + logOnVerbose + ("==> Test checks that expected pluggable attaching connector is created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector expectedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( expectedPlugAttachConnectorName.equals(attachConnectorName) ) { + expectedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( expectedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + expectedPlugAttachConnectorName + "'"); + return STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = expectedPlugAttachConnector.description(); + if ( ! expectedPlugAttachConnectorDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + expectedPlugAttachConnectorDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected transport name + String actualTransportName = expectedPlugAttachConnector.transport().name(); + if ( ! expectedPlugAttachConnectorTransportName.equals(actualTransportName) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected Transport:"); + logOnError + (errorLogPrefix + "Expected Transport name = '" + expectedPlugAttachConnectorTransportName + "'"); + logOnError(errorLogPrefix + "Actual Transport name = '" + actualTransportName + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has not defaultArguments + Map actualDefaultArguments = expectedPlugAttachConnector.defaultArguments(); + int actualDefaultArgumentsNumber = actualDefaultArguments.size(); + if ( actualDefaultArgumentsNumber != 0 ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected defaultArguments:"); + logOnError(errorLogPrefix + "Expected defaultArguments Map - "); + logOnError(errorLogPrefix + "Actual defaultArguments Map size = " + actualDefaultArgumentsNumber); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean expectedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( expectedPlugAttachConnector.equals(foundAttachingConnector) ) { + expectedPlugAttachConnectorFound = true; + break; + } + } + } + + if ( ! expectedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + expectedPlugAttachConnector); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of plugAttachConnect001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..5a12fcbc8aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002 test +nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect002.connectors.PlugAttachConnector002 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/connectors/PlugAttachConnector002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/connectors/PlugAttachConnector002.java new file mode 100644 index 00000000000..aa7fbac65ca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/connectors/PlugAttachConnector002.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector used by + * nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002 test + */ + +package nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector002 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName = "PlugAttachConnector002_Name"; + static String plugAttachConnectorDescription = "PlugAttachConnector002_Description"; + static Transport plugAttachConnectorTransport = new PlugConnectorsTransport("PlugAttachConnector002_Transport"); + static Map plugAttachConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector002_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector002_StringArgument_Name", + "PlugAttachConnector002_StringArgument_Label", + "PlugAttachConnector002_StringArgument_Description", + "PlugAttachConnector002_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector002_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector002_IntegerArgument_Name", + "PlugAttachConnector002_IntegerArgument_Label", + "PlugAttachConnector002_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector002_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector002_BooleanArgument_Name", + "PlugAttachConnector002_BooleanArgument_Label", + "PlugAttachConnector002_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector002_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector002_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector002_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector002_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector002_SelectedArgument_Name", + "PlugAttachConnector002_SelectedArgument_Label", + "PlugAttachConnector002_SelectedArgument_Description", + "PlugAttachConnector002_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector002() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugAttachConnector002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/plugAttachConnect002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/plugAttachConnect002.java new file mode 100644 index 00000000000..069a12aa7e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/plugAttachConnect002.java @@ -0,0 +1,278 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the pluggable + * connector named "PlugAttachConnector002_Name" is created on base + * of PlugAttachConnector002 class which implements + * com.sun.jdi.connect.AttachingConnector interface. + * This pluggable connector has to be contained in lists returned + * by VirtualMachineManager.attachingConnectors() and + * by VirtualMachineManager.allConnectors() methods. + * This pluggable connector has to have: + * Connector.description() = "PlugAttachConnector002_Description"; + * Connector.transport().name() = "PlugAttachConnector002_Transport"; + * Connector.defaultArguments() = List of 4 Connector.Argument: + * Connector.StringArgument named + * 'PlugAttachConnector002_StringArgument_Name' + * Connector.IntegerArgument named + * 'PlugAttachConnector002_IntegerArgument_Name' + * Connector.BooleanArgument named + * 'PlugAttachConnector002_BooleanArgument_Name' + * Connector.SelectedArgument named + * 'PlugAttachConnector002_SelectedArgument_Name' + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect002.plugAttachConnect002 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect002.plugAttachConnect002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect002; + +import nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect002.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the pluggable
    + * connector named "PlugAttachConnector002_Name" is created on base
    + * of PlugAttachConnector002 class which implements
    + * com.sun.jdi.connect.AttachingConnector interface.
    + *
    + * This pluggable connector has to be contained in lists returned
    + * by VirtualMachineManager.attachingConnectors() and
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * This pluggable connector has to have:
    + * Connector.description() = "PlugAttachConnector002_Description";
    + * Connector.transport().name() = "PlugAttachConnector002_Transport";
    + * Connector.defaultArguments() = List of 4 Connector.Argument:
    + * Connector.StringArgument named
    + * 'PlugAttachConnector002_StringArgument_Name'
    + * Connector.IntegerArgument named
    + * 'PlugAttachConnector002_IntegerArgument_Name'
    + * Connector.BooleanArgument named
    + * 'PlugAttachConnector002_BooleanArgument_Name'
    + * Connector.SelectedArgument named
    + * 'PlugAttachConnector002_SelectedArgument_Name'
    + *
    + */ + +public class plugAttachConnect002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugAttachConnect002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugAttachConnect002: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugAttachConnect002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + String checkedPlugAttachConnectorName = "PlugAttachConnector002_Name"; + String checkedPlugAttachConnectorDescription = "PlugAttachConnector002_Description"; + String checkedPlugAttachConnectorTransportName = "PlugAttachConnector002_Transport"; + + logAlways("==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002 test..."); + logOnVerbose + ("==> Test checks that expected pluggable attaching connector is created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + return STATUS_FAILED; + } + + // check that expected pluggable attaching connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + checkedPlugAttachConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + testResult = STATUS_FAILED; + } + + + AttachingConnector referencePlugAttachConnector = new PlugAttachConnector002(); + + String emptyString = ""; + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugAttachConnector, + checkedPlugAttachConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + // strings below are for info only +// String plugAttachConnectorStringArgumentKey = "PlugAttachConnector002_StringArgument_Key"; +// String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector002_IntegerArgument_Key"; +// String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector002_BooleanArgument_Key"; +// String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector002_SelectedArgument_Key"; + + Map referenceDefaultArguments = referencePlugAttachConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugAttachConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + testResult = STATUS_FAILED; + } + } + + return testResult; + } +} // end of plugAttachConnect002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..7c5e0289f98 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test +nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect003.connectors.PlugAttachConnector003 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/connectors/PlugAttachConnector003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/connectors/PlugAttachConnector003.java new file mode 100644 index 00000000000..7a9d285cc74 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/connectors/PlugAttachConnector003.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector used by + * nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test + */ + +package nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect003.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector003 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName = "PlugAttachConnector003_Name"; + static String plugAttachConnectorDescription = "PlugAttachConnector003_Description"; + static Transport plugAttachConnectorTransport = new PlugConnectorsTransport("PlugAttachConnector003_Transport"); + static Map plugAttachConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector003_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector003_StringArgument_Name", + "PlugAttachConnector003_StringArgument_Label", + "PlugAttachConnector003_StringArgument_Description", + "PlugAttachConnector003_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector003_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector003_IntegerArgument_Name", + "PlugAttachConnector003_IntegerArgument_Label", + "PlugAttachConnector003_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector003_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector003_BooleanArgument_Name", + "PlugAttachConnector003_BooleanArgument_Label", + "PlugAttachConnector003_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector003_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector003_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector003_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector003_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector003_SelectedArgument_Name", + "PlugAttachConnector003_SelectedArgument_Label", + "PlugAttachConnector003_SelectedArgument_Description", + "PlugAttachConnector003_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector003() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugAttachConnector003: This RuntimeException is thrown intentionally by AttachingConnector " + + "constructor to check creating of pluggable connectors on base of such AttachingConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugAttachConnector003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/plugAttachConnect003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/plugAttachConnect003.java new file mode 100644 index 00000000000..86e5db26754 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/plugAttachConnect003.java @@ -0,0 +1,211 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked a pluggable + * connector is NOT created on base of PlugAttachConnector003 class + * which implements com.sun.jdi.connect.AttachingConnector interface, + * but constructor of PlugAttachConnector003 throws Exception. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect003.plugAttachConnect003 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect003.plugAttachConnect003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect003; + +import nsk.jdi.PlugConnectors.AttachConnector.plugAttachConnect003.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked a pluggable
    + * connector is NOT created on base of PlugAttachConnector003 class
    + * which implements com.sun.jdi.connect.AttachingConnector interface,
    + * but constructor of PlugAttachConnector003 throws Exception.
    + *
    + */ + +public class plugAttachConnect003 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugAttachConnect003: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugAttachConnect003: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugAttachConnect003().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003 test..."); + logOnVerbose + ("==> Test checks that pluggable attaching connector is NOT created."); + logOnVerbose + (" for AttachingConnector implementation for which instance can not be created."); + + + VirtualMachineManager virtualMachineManager = null; + try { + virtualMachineManager = Bootstrap.virtualMachineManager(); + } catch (Throwable thrown) { + // OK: Bootstrap.virtualMachineManager() may throw an unspecified error + // if initialization of the VirtualMachineManager fails or if the virtual + // machine manager is unable to locate or create any Connectors. + logOnVerbose + (infoLogPrefixNead + "Bootstrap.virtualMachineManager() throws:\n" + thrown); + return STATUS_PASSED; + } + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that pluggable attaching connector is NOT created on base of AttachingConnector + // implementation (PlugAttachConnector003 class) for which instance can not be created + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + if ( attachingConnector instanceof PlugAttachConnector003 ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created on base of AttachingConnector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in attachingConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnector.name() + "'"); + testResult = STATUS_FAILED; + } + + + // check that pluggable connectors are NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + Connector foundAttachConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ){ + Connector connector = (Connector)allConnectorsList.get(i); + if ( connector instanceof PlugAttachConnector003 ) { + foundAttachConnector = connector; + break; + } + } + + if ( foundAttachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created on base of AttachingConnector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + foundAttachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + foundAttachConnector.name() + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of plugAttachConnect003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..e047eb85641 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001 test +nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect001.connectors.PlugLaunchConnector001 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/connectors/PlugLaunchConnector001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/connectors/PlugLaunchConnector001.java new file mode 100644 index 00000000000..1ecc906747d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/connectors/PlugLaunchConnector001.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector used by + * nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001 test + */ + +package nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector001 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName = "PlugLaunchConnector001_Name"; + static String plugLaunchConnectorDescription = "PlugLaunchConnector001_Description"; + static Transport plugLaunchConnectorTransport = new PlugConnectorsTransport("PlugLaunchConnector001_Transport"); + static Map plugLaunchConnectorDefaultArguments = new HashMap(); + + + public PlugLaunchConnector001() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + plugLaunchConnectorDefaultArguments); + } + +} // end of PlugLaunchConnector001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/plugLaunchConnect001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/plugLaunchConnect001.java new file mode 100644 index 00000000000..6a14a703b51 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/plugLaunchConnect001.java @@ -0,0 +1,245 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the pluggable + * connector named "PlugLaunchConnector001_Name" is created on base + * of PlugLaunchConnector001 class which implements + * com.sun.jdi.connect.LaunchingConnector interface. + * This pluggable connector has to be contained in lists returned + * by VirtualMachineManager.launchingConnectors() and + * by VirtualMachineManager.allConnectors() methods. + * This pluggable connector has to have: + * Connector.description() = "PlugLaunchConnector001_Description"; + * Connector.transport().name() = "PlugLaunchConnector001_Transport"; + * Connector.defaultArguments() = , i.e without arguments; + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect001.plugLaunchConnect001 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect001.plugLaunchConnect001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect001; + +import nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect001.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the pluggable
    + * connector named "PlugLaunchConnector001_Name" is created on base
    + * of PlugLaunchConnector001 class which implements
    + * com.sun.jdi.connect.LaunchingConnector interface.
    + *
    + * This pluggable connector has to be contained in lists returned
    + * by VirtualMachineManager.launchingConnectors() and
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * This pluggable connector has to have:
    + * Connector.description() = "PlugLaunchConnector001_Description";
    + * Connector.transport().name() = "PlugLaunchConnector001_Transport";
    + * Connector.defaultArguments() = , i.e without arguments;
    + *
    + */ + +public class plugLaunchConnect001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugLaunchConnect001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugLaunchConnect001: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugLaunchConnect001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + String expectedPlugLaunchConnectorName = "PlugLaunchConnector001_Name"; + String expectedPlugLaunchConnectorDescription = "PlugLaunchConnector001_Description"; + String expectedPlugLaunchConnectorTransportName = "PlugLaunchConnector001_Transport"; + + logAlways("==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001 test..."); + logOnVerbose + ("==> Test checks that expected pluggable launching connector is created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that expected pluggable launching connector is found out in launchingConnectors() List + List launchingConnectorsList = virtualMachineManager.launchingConnectors(); + int launchingConnectorsNumber = launchingConnectorsList.size(); + LaunchingConnector expectedPlugLaunchConnector = null; + + for (int i=0; i < launchingConnectorsNumber; i++ ) { + LaunchingConnector launchingConnector = (LaunchingConnector)launchingConnectorsList.get(i); + String launchConnectorName = launchingConnector.name(); + if ( expectedPlugLaunchConnectorName.equals(launchConnectorName) ) { + expectedPlugLaunchConnector = launchingConnector; + break; + } + } + + if ( expectedPlugLaunchConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable launching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + expectedPlugLaunchConnectorName + "'"); + return STATUS_FAILED; + } + + // check that expected pluggable launching connector has expected description + String actualDescription = expectedPlugLaunchConnector.description(); + if ( ! expectedPlugLaunchConnectorDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable launching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + expectedPlugLaunchConnectorDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable launching connector has expected transport name + String actualTransportName = expectedPlugLaunchConnector.transport().name(); + if ( ! expectedPlugLaunchConnectorTransportName.equals(actualTransportName) ) { + logOnError(errorLogPrefixHead + "Pluggable launching connector has unexpected Transport:"); + logOnError + (errorLogPrefix + "Expected Transport name = '" + expectedPlugLaunchConnectorTransportName + "'"); + logOnError(errorLogPrefix + "Actual Transport name = '" + actualTransportName + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable launching connector has not defaultArguments + Map actualDefaultArguments = expectedPlugLaunchConnector.defaultArguments(); + int actualDefaultArgumentsNumber = actualDefaultArguments.size(); + if ( actualDefaultArgumentsNumber != 0 ) { + logOnError(errorLogPrefixHead + "Pluggable launching connector has unexpected defaultArguments:"); + logOnError(errorLogPrefix + "Expected defaultArguments Map - "); + logOnError(errorLogPrefix + "Actual defaultArguments Map size = " + actualDefaultArgumentsNumber); + testResult = STATUS_FAILED; + } + + // check that expected pluggable launching connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean expectedPlugLaunchConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof LaunchingConnector ) { + LaunchingConnector foundLaunchingConnector = (LaunchingConnector)foundConnector; + if ( expectedPlugLaunchConnector.equals(foundLaunchingConnector) ) { + expectedPlugLaunchConnectorFound = true; + break; + } + } + } + + if ( ! expectedPlugLaunchConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable launching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + expectedPlugLaunchConnector); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of plugLaunchConnect001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..6a22ad45034 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002 test +nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect002.connectors.PlugLaunchConnector002 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/connectors/PlugLaunchConnector002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/connectors/PlugLaunchConnector002.java new file mode 100644 index 00000000000..e286eaed3cb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/connectors/PlugLaunchConnector002.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector used by + * nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002 test + */ + +package nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector002 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName = "PlugLaunchConnector002_Name"; + static String plugLaunchConnectorDescription = "PlugLaunchConnector002_Description"; + static Transport plugLaunchConnectorTransport = new PlugConnectorsTransport("PlugLaunchConnector002_Transport"); + static Map plugLaunchConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector002_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector002_StringArgument_Name", + "PlugLaunchConnector002_StringArgument_Label", + "PlugLaunchConnector002_StringArgument_Description", + "PlugLaunchConnector002_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector002_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector002_IntegerArgument_Name", + "PlugLaunchConnector002_IntegerArgument_Label", + "PlugLaunchConnector002_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector002_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector002_BooleanArgument_Name", + "PlugLaunchConnector002_BooleanArgument_Label", + "PlugLaunchConnector002_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector002_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector002_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector002_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector002_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector002_SelectedArgument_Name", + "PlugLaunchConnector002_SelectedArgument_Label", + "PlugLaunchConnector002_SelectedArgument_Description", + "PlugLaunchConnector002_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector002() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugLaunchConnector002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/plugLaunchConnect002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/plugLaunchConnect002.java new file mode 100644 index 00000000000..d1857f44d6c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/plugLaunchConnect002.java @@ -0,0 +1,278 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the pluggable + * connector named "PlugLaunchConnector002_Name" is created on base + * of PlugLaunchConnector002 class which implements + * com.sun.jdi.connect.LaunchingConnector interface. + * This pluggable connector has to be contained in lists returned + * by VirtualMachineManager.launchingConnectors() and + * by VirtualMachineManager.allConnectors() methods. + * This pluggable connector has to have: + * Connector.description() = "PlugLaunchConnector002_Description"; + * Connector.transport().name() = "PlugLaunchConnector002_Transport"; + * Connector.defaultArguments() = List of 4 Connector.Argument: + * Connector.StringArgument named + * 'PlugLaunchConnector002_StringArgument_Name' + * Connector.IntegerArgument named + * 'PlugLaunchConnector002_IntegerArgument_Name' + * Connector.BooleanArgument named + * 'PlugLaunchConnector002_BooleanArgument_Name' + * Connector.SelectedArgument named + * 'PlugLaunchConnector002_SelectedArgument_Name' + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect002.plugLaunchConnect002 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect002.plugLaunchConnect002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect002; + +import nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect002.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the pluggable
    + * connector named "PlugLaunchConnector002_Name" is created on base
    + * of PlugLaunchConnector002 class which implements
    + * com.sun.jdi.connect.LaunchingConnector interface.
    + *
    + * This pluggable connector has to be contained in lists returned
    + * by VirtualMachineManager.launchingConnectors() and
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * This pluggable connector has to have:
    + * Connector.description() = "PlugLaunchConnector002_Description";
    + * Connector.transport().name() = "PlugLaunchConnector002_Transport";
    + * Connector.defaultArguments() = List of 4 Connector.Argument:
    + * Connector.StringArgument named
    + * 'PlugLaunchConnector002_StringArgument_Name'
    + * Connector.IntegerArgument named
    + * 'PlugLaunchConnector002_IntegerArgument_Name'
    + * Connector.BooleanArgument named
    + * 'PlugLaunchConnector002_BooleanArgument_Name'
    + * Connector.SelectedArgument named
    + * 'PlugLaunchConnector002_SelectedArgument_Name'
    + *
    + */ + +public class plugLaunchConnect002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugLaunchConnect002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugLaunchConnect002: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugLaunchConnect002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + String checkedPlugLaunchConnectorName = "PlugLaunchConnector002_Name"; + String checkedPlugLaunchConnectorDescription = "PlugLaunchConnector002_Description"; + String checkedPlugLaunchConnectorTransportName = "PlugLaunchConnector002_Transport"; + + logAlways("==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002 test..."); + logOnVerbose + ("==> Test checks that expected pluggable launching connector is created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that expected pluggable launching connector is found out in launchingConnectors() List + List launchingConnectorsList = virtualMachineManager.launchingConnectors(); + int launchingConnectorsNumber = launchingConnectorsList.size(); + LaunchingConnector checkedPlugLaunchConnector = null; + + for (int i=0; i < launchingConnectorsNumber; i++ ) { + LaunchingConnector launchingConnector = (LaunchingConnector)launchingConnectorsList.get(i); + String launchConnectorName = launchingConnector.name(); + if ( checkedPlugLaunchConnectorName.equals(launchConnectorName) ) { + checkedPlugLaunchConnector = launchingConnector; + break; + } + } + + if ( checkedPlugLaunchConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable launching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugLaunchConnectorName + "'"); + return STATUS_FAILED; + } + + // check that expected pluggable launching connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugLaunchConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof LaunchingConnector ) { + LaunchingConnector foundLaunchingConnector = (LaunchingConnector)foundConnector; + if ( checkedPlugLaunchConnector.equals(foundLaunchingConnector) ) { + checkedPlugLaunchConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugLaunchConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable launching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugLaunchConnector); + testResult = STATUS_FAILED; + } + + + LaunchingConnector referencePlugLaunchConnector = new PlugLaunchConnector002(); + + String emptyString = ""; + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugLaunchConnector, + checkedPlugLaunchConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + // strings below are for info only +// String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector002_StringArgument_Key"; +// String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector002_IntegerArgument_Key"; +// String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector002_BooleanArgument_Key"; +// String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector002_SelectedArgument_Key"; + + Map referenceDefaultArguments = referencePlugLaunchConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugLaunchConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + testResult = STATUS_FAILED; + } + } + + return testResult; + } +} // end of plugLaunchConnect002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..9818c34574a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test +nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect003.connectors.PlugLaunchConnector003 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/connectors/PlugLaunchConnector003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/connectors/PlugLaunchConnector003.java new file mode 100644 index 00000000000..972ef8be85a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/connectors/PlugLaunchConnector003.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector used by + * nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test + */ + +package nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect003.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugLaunchConnector003 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName = "PlugLaunchConnector003_Name"; + static String plugLaunchConnectorDescription = "PlugLaunchConnector003_Description"; + static Transport plugLaunchConnectorTransport = new PlugConnectorsTransport("PlugLaunchConnector003_Transport"); + static Map plugLaunchConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector003_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector003_StringArgument_Name", + "PlugLaunchConnector003_StringArgument_Label", + "PlugLaunchConnector003_StringArgument_Description", + "PlugLaunchConnector003_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector003_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector003_IntegerArgument_Name", + "PlugLaunchConnector003_IntegerArgument_Label", + "PlugLaunchConnector003_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector003_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector003_BooleanArgument_Name", + "PlugLaunchConnector003_BooleanArgument_Label", + "PlugLaunchConnector003_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector003_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector003_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector003_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector003_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector003_SelectedArgument_Name", + "PlugLaunchConnector003_SelectedArgument_Label", + "PlugLaunchConnector003_SelectedArgument_Description", + "PlugLaunchConnector003_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector003() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugLaunchConnector003: This RuntimeException is thrown intentionally by LaunchingConnector " + + "constructor to check creating of pluggable connectors on base of such LaunchingConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugLaunchConnector003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/plugLaunchConnect003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/plugLaunchConnect003.java new file mode 100644 index 00000000000..d709b531b70 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/plugLaunchConnect003.java @@ -0,0 +1,211 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked a pluggable + * connector is NOT created on base of PlugLaunchConnector003 class + * which implements com.sun.jdi.connect.LaunchingConnector interface, + * but constructor of PlugLaunchConnector003 throws Exception. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect003.plugLaunchConnect003 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect003.plugLaunchConnect003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect003; + +import nsk.jdi.PlugConnectors.LaunchConnector.plugLaunchConnect003.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked a pluggable
    + * connector is NOT created on base of PlugLaunchConnector003 class
    + * which implements com.sun.jdi.connect.LaunchingConnector interface,
    + * but constructor of PlugLaunchConnector003 throws Exception.
    + *
    + */ + +public class plugLaunchConnect003 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugLaunchConnect003: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugLaunchConnect003: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugLaunchConnect003().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003 test..."); + logOnVerbose + ("==> Test checks that pluggable launching connector is NOT created."); + logOnVerbose + (" for LaunchingConnector implementation for which instance can not be created."); + + + VirtualMachineManager virtualMachineManager = null; + try { + virtualMachineManager = Bootstrap.virtualMachineManager(); + } catch (Throwable thrown) { + // OK: Bootstrap.virtualMachineManager() may throw an unspecified error + // if initialization of the VirtualMachineManager fails or if the virtual + // machine manager is unable to locate or create any Connectors. + logOnVerbose + (infoLogPrefixNead + "Bootstrap.virtualMachineManager() throws:\n" + thrown); + return STATUS_PASSED; + } + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that pluggable launching connector is NOT created on base of LaunchingConnector + // implementation (PlugLaunchConnector003 class) for which instance can not be created + List launchingConnectorsList = virtualMachineManager.launchingConnectors(); + int launchingConnectorsNumber = launchingConnectorsList.size(); + LaunchingConnector checkedPlugLaunchConnector = null; + + for (int i=0; i < launchingConnectorsNumber; i++ ) { + LaunchingConnector launchingConnector = (LaunchingConnector)launchingConnectorsList.get(i); + if ( launchingConnector instanceof PlugLaunchConnector003 ) { + checkedPlugLaunchConnector = launchingConnector; + break; + } + } + + if ( checkedPlugLaunchConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable launching connector is created on base of LaunchingConnector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in launchingConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugLaunchConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugLaunchConnector.name() + "'"); + testResult = STATUS_FAILED; + } + + + // check that pluggable connectors are NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + Connector foundLaunchConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ){ + Connector connector = (Connector)allConnectorsList.get(i); + if ( connector instanceof PlugLaunchConnector003 ) { + foundLaunchConnector = connector; + break; + } + } + + if ( foundLaunchConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable launching connector is created on base of LaunchingConnector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + foundLaunchConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + foundLaunchConnector.name() + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of plugLaunchConnect003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..87c1c464d68 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001 test +nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect001.connectors.PlugListenConnector001 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/connectors/PlugListenConnector001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/connectors/PlugListenConnector001.java new file mode 100644 index 00000000000..7e5b7634306 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/connectors/PlugListenConnector001.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector used by + * nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001 test + */ + +package nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector001 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName = "PlugListenConnector001_Name"; + static String plugListenConnectorDescription = "PlugListenConnector001_Description"; + static Transport plugListenConnectorTransport = new PlugConnectorsTransport("PlugListenConnector001_Transport"); + static Map plugListenConnectorDefaultArguments = new HashMap(); + + + public PlugListenConnector001() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + plugListenConnectorDefaultArguments); + } + +} // end of PlugListenConnector001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/plugListenConnect001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/plugListenConnect001.java new file mode 100644 index 00000000000..8042bf4e752 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/plugListenConnect001.java @@ -0,0 +1,245 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LauWnchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the pluggable + * connector named "PlugListenConnector001_Name" is created on base + * of PlugListenConnector001 class which implements + * com.sun.jdi.connect.ListeningConnector interface. + * This pluggable connector has to be contained in lists returned + * by VirtualMachineManager.listeningConnectors() and + * by VirtualMachineManager.allConnectors() methods. + * This pluggable connector has to have: + * Connector.description() = "PlugListenConnector001_Description"; + * Connector.transport().name() = "PlugListenConnector001_Transport"; + * Connector.defaultArguments() = , i.e without arguments; + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect001.plugListenConnect001 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect001.plugListenConnect001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect001; + +import nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect001.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the pluggable
    + * connector named "PlugListenConnector001_Name" is created on base
    + * of PlugListenConnector001 class which implements
    + * com.sun.jdi.connect.ListeningConnector interface.
    + *
    + * This pluggable connector has to be contained in lists returned
    + * by VirtualMachineManager.listeningConnectors() and
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * This pluggable connector has to have:
    + * Connector.description() = "PlugListenConnector001_Description";
    + * Connector.transport().name() = "PlugListenConnector001_Transport";
    + * Connector.defaultArguments() = , i.e without arguments;
    + *
    + */ + +public class plugListenConnect001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugListenConnect001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugListenConnect001: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugListenConnect001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + String expectedPlugListenConnectorName = "PlugListenConnector001_Name"; + String expectedPlugListenConnectorDescription = "PlugListenConnector001_Description"; + String expectedPlugListenConnectorTransportName = "PlugListenConnector001_Transport"; + + logAlways("==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001 test..."); + logOnVerbose + ("==> Test checks that expected pluggable listening connector is created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector expectedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( expectedPlugListenConnectorName.equals(listenConnectorName) ) { + expectedPlugListenConnector = listeningConnector; + break; + } + } + + if ( expectedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + expectedPlugListenConnectorName + "'"); + return STATUS_FAILED; + } + + // check that expected pluggable listening connector has expected description + String actualDescription = expectedPlugListenConnector.description(); + if ( ! expectedPlugListenConnectorDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + expectedPlugListenConnectorDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has expected transport name + String actualTransportName = expectedPlugListenConnector.transport().name(); + if ( ! expectedPlugListenConnectorTransportName.equals(actualTransportName) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected Transport:"); + logOnError + (errorLogPrefix + "Expected Transport name = '" + expectedPlugListenConnectorTransportName + "'"); + logOnError(errorLogPrefix + "Actual Transport name = '" + actualTransportName + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has not defaultArguments + Map actualDefaultArguments = expectedPlugListenConnector.defaultArguments(); + int actualDefaultArgumentsNumber = actualDefaultArguments.size(); + if ( actualDefaultArgumentsNumber != 0 ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected defaultArguments:"); + logOnError(errorLogPrefix + "Expected defaultArguments Map - "); + logOnError(errorLogPrefix + "Actual defaultArguments Map size = " + actualDefaultArgumentsNumber); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean expectedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( expectedPlugListenConnector.equals(foundListeningConnector) ) { + expectedPlugListenConnectorFound = true; + break; + } + } + } + + if ( ! expectedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + expectedPlugListenConnector); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of plugListenConnect001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..c02f00c5b3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002 test +nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect002.connectors.PlugListenConnector002 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/connectors/PlugListenConnector002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/connectors/PlugListenConnector002.java new file mode 100644 index 00000000000..b4c5cdfde17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/connectors/PlugListenConnector002.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector used by + * nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002 test + */ + +package nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugListenConnector002 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName = "PlugListenConnector002_Name"; + static String plugListenConnectorDescription = "PlugListenConnector002_Description"; + static Transport plugListenConnectorTransport = new PlugConnectorsTransport("PlugListenConnector002_Transport"); + static Map plugListenConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector002_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector002_StringArgument_Name", + "PlugListenConnector002_StringArgument_Label", + "PlugListenConnector002_StringArgument_Description", + "PlugListenConnector002_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector002_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector002_IntegerArgument_Name", + "PlugListenConnector002_IntegerArgument_Label", + "PlugListenConnector002_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector002_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector002_BooleanArgument_Name", + "PlugListenConnector002_BooleanArgument_Label", + "PlugListenConnector002_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector002_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector002_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector002_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector002_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector002_SelectedArgument_Name", + "PlugListenConnector002_SelectedArgument_Label", + "PlugListenConnector002_SelectedArgument_Description", + "PlugListenConnector002_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector002() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugListenConnector002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/plugListenConnect002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/plugListenConnect002.java new file mode 100644 index 00000000000..342fc7e3e74 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/plugListenConnect002.java @@ -0,0 +1,278 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the pluggable + * connector named "PlugListenConnector002_Name" is created on base + * of PlugListenConnector002 class which implements + * com.sun.jdi.connect.ListeningConnector interface. + * This pluggable connector has to be contained in lists returned + * by VirtualMachineManager.listeningConnectors() and + * by VirtualMachineManager.allConnectors() methods. + * This pluggable connector has to have: + * Connector.description() = "PlugListenConnector002_Description"; + * Connector.transport().name() = "PlugListenConnector002_Transport"; + * Connector.defaultArguments() = List of 4 Connector.Argument: + * Connector.StringArgument named + * 'PlugListenConnector002_StringArgument_Name' + * Connector.IntegerArgument named + * 'PlugListenConnector002_IntegerArgument_Name' + * Connector.BooleanArgument named + * 'PlugListenConnector002_BooleanArgument_Name' + * Connector.SelectedArgument named + * 'PlugListenConnector002_SelectedArgument_Name' + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect002.plugListenConnect002 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect002.plugListenConnect002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect002; + +import nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect002.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the pluggable
    + * connector named "PlugListenConnector002_Name" is created on base
    + * of PlugListenConnector002 class which implements
    + * com.sun.jdi.connect.ListeningConnector interface.
    + *
    + * This pluggable connector has to be contained in lists returned
    + * by VirtualMachineManager.listeningConnectors() and
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * This pluggable connector has to have:
    + * Connector.description() = "PlugListenConnector002_Description";
    + * Connector.transport().name() = "PlugListenConnector002_Transport";
    + * Connector.defaultArguments() = List of 4 Connector.Argument:
    + * Connector.StringArgument named
    + * 'PlugListenConnector002_StringArgument_Name'
    + * Connector.IntegerArgument named
    + * 'PlugListenConnector002_IntegerArgument_Name'
    + * Connector.BooleanArgument named
    + * 'PlugListenConnector002_BooleanArgument_Name'
    + * Connector.SelectedArgument named
    + * 'PlugListenConnector002_SelectedArgument_Name'
    + *
    + */ + +public class plugListenConnect002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugListenConnect002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugListenConnect002: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugListenConnect002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + String checkedPlugListenConnectorName = "PlugListenConnector002_Name"; + String checkedPlugListenConnectorDescription = "PlugListenConnector002_Description"; + String checkedPlugListenConnectorTransportName = "PlugListenConnector002_Transport"; + + logAlways("==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002 test..."); + logOnVerbose + ("==> Test checks that expected pluggable listening connector is created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + return STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + checkedPlugListenConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + testResult = STATUS_FAILED; + } + + + ListeningConnector referencePlugListenConnector = new PlugListenConnector002(); + + String emptyString = ""; + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugListenConnector, + checkedPlugListenConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + // strings below are for info only +// String plugListenConnectorStringArgumentKey = "PlugListenConnector002_StringArgument_Key"; +// String plugListenConnectorIntegerArgumentKey = "PlugListenConnector002_IntegerArgument_Key"; +// String plugListenConnectorBooleanArgumentKey = "PlugListenConnector002_BooleanArgument_Key"; +// String plugListenConnectorSelectedArgumentKey = "PlugListenConnector002_SelectedArgument_Key"; + + Map referenceDefaultArguments = referencePlugListenConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugListenConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + testResult = STATUS_FAILED; + } + } + + return testResult; + } +} // end of plugListenConnect002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..559cb0022b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test +nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect003.connectors.PlugListenConnector003 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/connectors/PlugListenConnector003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/connectors/PlugListenConnector003.java new file mode 100644 index 00000000000..264f60d0f7c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/connectors/PlugListenConnector003.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector used by + * nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test + */ + +package nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect003.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugListenConnector003 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName = "PlugListenConnector003_Name"; + static String plugListenConnectorDescription = "PlugListenConnector003_Description"; + static Transport plugListenConnectorTransport = new PlugConnectorsTransport("PlugListenConnector003_Transport"); + static Map plugListenConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector003_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector003_StringArgument_Name", + "PlugListenConnector003_StringArgument_Label", + "PlugListenConnector003_StringArgument_Description", + "PlugListenConnector003_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector003_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector003_IntegerArgument_Name", + "PlugListenConnector003_IntegerArgument_Label", + "PlugListenConnector003_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector003_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector003_BooleanArgument_Name", + "PlugListenConnector003_BooleanArgument_Label", + "PlugListenConnector003_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector003_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector003_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector003_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector003_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector003_SelectedArgument_Name", + "PlugListenConnector003_SelectedArgument_Label", + "PlugListenConnector003_SelectedArgument_Description", + "PlugListenConnector003_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector003() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugListenConnector003: This RuntimeException is thrown intentionally by ListeningConnector " + + "constructor to check creating of pluggable connectors on base of such ListeningConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugListenConnector003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/plugListenConnect003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/plugListenConnect003.java new file mode 100644 index 00000000000..4977185d81a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/plugListenConnect003.java @@ -0,0 +1,211 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked a pluggable + * connector is NOT created on base of PlugListenConnector003 class + * which implements com.sun.jdi.connect.ListeningConnector interface, + * but constructor of PlugListenConnector003 throws Exception. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect003.plugListenConnect003 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect003.plugListenConnect003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect003; + +import nsk.jdi.PlugConnectors.ListenConnector.plugListenConnect003.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked a pluggable
    + * connector is NOT created on base of PlugListenConnector003 class
    + * which implements com.sun.jdi.connect.ListeningConnector interface,
    + * but constructor of PlugListenConnector003 throws Exception.
    + *
    + */ + +public class plugListenConnect003 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugListenConnect003: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugListenConnect003: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugListenConnect003().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003 test..."); + logOnVerbose + ("==> Test checks that pluggable listening connector is NOT created."); + logOnVerbose + (" for ListeningConnector implementation for which instance can not be created."); + + + VirtualMachineManager virtualMachineManager = null; + try { + virtualMachineManager = Bootstrap.virtualMachineManager(); + } catch (Throwable thrown) { + // OK: Bootstrap.virtualMachineManager() may throw an unspecified error + // if initialization of the VirtualMachineManager fails or if the virtual + // machine manager is unable to locate or create any Connectors. + logOnVerbose + (infoLogPrefixNead + "Bootstrap.virtualMachineManager() throws:\n" + thrown); + return STATUS_PASSED; + } + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check that pluggable listening connector is NOT created on base of ListeningConnector + // implementation (PlugListenConnector003 class) for which instance can not be created + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + if ( listeningConnector instanceof PlugListenConnector003 ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created on base of ListeningConnector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in listeningConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnector.name() + "'"); + testResult = STATUS_FAILED; + } + + + // check that pluggable connectors are NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + Connector foundListenConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ){ + Connector connector = (Connector)allConnectorsList.get(i); + if ( connector instanceof PlugListenConnector003 ) { + foundListenConnector = connector; + break; + } + } + + if ( foundListenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created on base of ListeningConnector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + foundListenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + foundListenConnector.name() + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of plugListenConnect003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..3cd901c22bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,29 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.PlugAttachConnector001_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.PlugAttachConnector001_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.PlugLaunchConnector001_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.PlugLaunchConnector001_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.PlugListenConnector001_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.PlugListenConnector001_02 + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugAttachConnector001_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugAttachConnector001_01.java new file mode 100644 index 00000000000..156cc5737ea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugAttachConnector001_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector001_01 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector001_01_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector001_01_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector001_01_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + + public PlugAttachConnector001_01() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + plugAttachConnectorDefaultArguments); + } + +} // end of PlugAttachConnector001_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugAttachConnector001_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugAttachConnector001_02.java new file mode 100644 index 00000000000..28d0fba8c5f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugAttachConnector001_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugAttachConnector001_02 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector001_02_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector001_02_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector001_02_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector001_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector001_02_StringArgument_Name", + "PlugAttachConnector001_02_StringArgument_Label", + "PlugAttachConnector001_02_StringArgument_Description", + "PlugAttachConnector001_02_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector001_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector001_02_IntegerArgument_Name", + "PlugAttachConnector001_02_IntegerArgument_Label", + "PlugAttachConnector001_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector001_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector001_02_BooleanArgument_Name", + "PlugAttachConnector001_02_BooleanArgument_Label", + "PlugAttachConnector001_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector001_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector001_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector001_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector001_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector001_02_SelectedArgument_Name", + "PlugAttachConnector001_02_SelectedArgument_Label", + "PlugAttachConnector001_02_SelectedArgument_Description", + "PlugAttachConnector001_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector001_02() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugAttachConnector001_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugLaunchConnector001_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugLaunchConnector001_01.java new file mode 100644 index 00000000000..8c93829e805 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugLaunchConnector001_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector001_01 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector001_01_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector001_01_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector001_01_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + + public PlugLaunchConnector001_01() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + plugLaunchConnectorDefaultArguments); + } + +} // end of PlugLaunchConnector001_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugLaunchConnector001_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugLaunchConnector001_02.java new file mode 100644 index 00000000000..bfc1b25d584 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugLaunchConnector001_02.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector001_02 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector001_02_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector001_02_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector001_02_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector001_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector001_02_StringArgument_Name", + "PlugLaunchConnector001_02_StringArgument_Label", + "PlugLaunchConnector001_02_StringArgument_Description", + "PlugLaunchConnector001_02_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector001_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector001_02_IntegerArgument_Name", + "PlugLaunchConnector001_02_IntegerArgument_Label", + "PlugLaunchConnector001_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector001_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector001_02_BooleanArgument_Name", + "PlugLaunchConnector001_02_BooleanArgument_Label", + "PlugLaunchConnector001_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector001_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector001_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector001_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector001_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector001_02_SelectedArgument_Name", + "PlugLaunchConnector001_02_SelectedArgument_Label", + "PlugLaunchConnector001_02_SelectedArgument_Description", + "PlugLaunchConnector001_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector001_02() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugLaunchConnector001_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugListenConnector001_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugListenConnector001_01.java new file mode 100644 index 00000000000..6ba12b50f91 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugListenConnector001_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector001_01 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector001_01_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector001_01_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector001_01_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + + public PlugListenConnector001_01() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + plugListenConnectorDefaultArguments); + } + +} // end of PlugListenConnector001_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugListenConnector001_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugListenConnector001_02.java new file mode 100644 index 00000000000..4526294967c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/connectors/PlugListenConnector001_02.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector001_02 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector001_02_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector001_02_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector001_02_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector001_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector001_02_StringArgument_Name", + "PlugListenConnector001_02_StringArgument_Label", + "PlugListenConnector001_02_StringArgument_Description", + "PlugListenConnector001_02_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector001_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector001_02_IntegerArgument_Name", + "PlugListenConnector001_02_IntegerArgument_Label", + "PlugListenConnector001_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector001_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector001_02_BooleanArgument_Name", + "PlugListenConnector001_02_BooleanArgument_Label", + "PlugListenConnector001_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector001_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector001_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector001_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector001_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector001_02_SelectedArgument_Name", + "PlugListenConnector001_02_SelectedArgument_Label", + "PlugListenConnector001_02_SelectedArgument_Description", + "PlugListenConnector001_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector001_02() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugListenConnector001_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/plugMultiConnect001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/plugMultiConnect001.java new file mode 100644 index 00000000000..fc596d20273 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/plugMultiConnect001.java @@ -0,0 +1,348 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the 6 expected + * pluggable connectors are created properly on base of 6 differen + * Connector implementations of different types. + * The test expects that 2 pluggable connectors should be + * of AttachingConnector type, other 2 connectors - + * of ListeningConnector type, and last 2 coonectors - + * of LaunchingConnector type + * Each pluggable connector has to be contained in corresponding list: + * VirtualMachineManager.attachingConnectors(), + * VirtualMachineManager.launchingConnectors() or + * VirtualMachineManager.listeningConnectors(). + * All 6 pluggable connectors have to be contained in + * VirtualMachineManager.allConnectors() list. + * Each pluggable connector is checked for the certain expected + * description and for the certain expected transport. + * For each connector type one pluggable connector should have the + * empty Map of default arguments, and other pluggable connector + * should have 4 default arguments of all types: + * Connector.StringArgument; + * Connector.IntegerArgument; + * Connector.BooleanArgument; + * Connector.SelectedArgument; + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.plugMultiConnect001 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.plugMultiConnect001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001; + +import nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect001.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 6 expected
    + * pluggable connectors are created properly on base of 6 different
    + * Connector implementations of different types.
    + *
    + * The test expects that 2 pluggable connectors should be
    + * of AttachingConnector type, other 2 connectors -
    + * of ListeningConnector type, and last 2 coonectors -
    + * of LaunchingConnector type
    + *
    + * Each pluggable connector has to be contained in corresponding list:
    + * VirtualMachineManager.attachingConnectors(),
    + * VirtualMachineManager.launchingConnectors() or
    + * VirtualMachineManager.listeningConnectors().
    + *
    + * All 6 pluggable connectors have to be contained in
    + * VirtualMachineManager.allConnectors() list.
    + *
    + * Each pluggable connector is checked for the certain expected
    + * description and for the certain expected transport.
    + *
    + * For each connector type one pluggable connector should have the
    + * empty Map of default arguments, and other pluggable connector
    + * should have 4 default arguments of all types:
    + * Connector.StringArgument;
    + * Connector.IntegerArgument;
    + * Connector.BooleanArgument;
    + * Connector.SelectedArgument;
    + *
    + */ + +public class plugMultiConnect001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugMultiConnect001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugMultiConnect001: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugMultiConnect001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001 test..."); + logOnVerbose + ("==> Test checks that expected pluggable connectors are created properly"); + logOnVerbose + ("==> on base of 6 different Connector implementations."); + int expectedConnectorsNumber = 6; + + String[] checkedPlugConnectorNames = new String[expectedConnectorsNumber]; + checkedPlugConnectorNames[0] = "PlugAttachConnector001_01_Name"; + checkedPlugConnectorNames[1] = "PlugAttachConnector001_02_Name"; + checkedPlugConnectorNames[2] = "PlugLaunchConnector001_01_Name"; + checkedPlugConnectorNames[3] = "PlugLaunchConnector001_02_Name"; + checkedPlugConnectorNames[4] = "PlugListenConnector001_01_Name"; + checkedPlugConnectorNames[5] = "PlugListenConnector001_02_Name"; + + Connector[] referencePlugConnectors = new Connector[expectedConnectorsNumber]; + referencePlugConnectors[0] = new PlugAttachConnector001_01(); + referencePlugConnectors[1] = new PlugAttachConnector001_02(); + referencePlugConnectors[2] = new PlugLaunchConnector001_01(); + referencePlugConnectors[3] = new PlugLaunchConnector001_02(); + referencePlugConnectors[4] = new PlugListenConnector001_01(); + referencePlugConnectors[5] = new PlugListenConnector001_02(); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + for (int i=0; i < expectedConnectorsNumber; i++ ) { + int checkResult = checkConnector(virtualMachineManager, + checkedPlugConnectorNames[i], + referencePlugConnectors[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + return testResult; + } + + private int checkConnector (VirtualMachineManager virtualMachineManager, + String checkedPlugConnectorName, + Connector referencePlugConnector) { + int checkResult = STATUS_PASSED; + + // check that checked pluggable connector is found out + // in attaching/launching/listeningConnectors() List + List connectorsList = null; + if ( referencePlugConnector instanceof AttachingConnector) { + connectorsList = virtualMachineManager.attachingConnectors(); + } + if ( referencePlugConnector instanceof LaunchingConnector) { + connectorsList = virtualMachineManager.launchingConnectors(); + } + if ( referencePlugConnector instanceof ListeningConnector) { + connectorsList = virtualMachineManager.listeningConnectors(); + } + + int connectorsNumber = connectorsList.size(); + Connector checkedPlugConnector = null; + + for (int i=0; i < connectorsNumber; i++ ) { + Connector connector = (Connector)connectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugConnectorName.equals(connectorName) ) { + if ( checkedPlugConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + connector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnector = connector; + } + } + } + + if ( checkedPlugConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugConnectorName + "'"); + return STATUS_FAILED; + } + + // check that checked pluggable connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( checkedPlugConnector.equals(foundConnector) ) { + if ( checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnectorFound = true; + } + } + } + + if ( ! checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + checkResult = STATUS_FAILED; + } + + // check that checked pluggable connector matches corresponding reference connector + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugConnector, + checkedPlugConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + Map referenceDefaultArguments = referencePlugConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + int checkedDefaultArgumentsNumber = checkedDefaultArguments.size(); + + if ( referenceDefaultArgumentsNumber != checkedDefaultArgumentsNumber ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector contains unexpected number of default arguments"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + logOnError(errorLogPrefix + "Expected number of default arguments = " + + referenceDefaultArgumentsNumber); + logOnError(errorLogPrefix + "Actual number of default arguments = " + + checkedDefaultArgumentsNumber); + return STATUS_FAILED; + } + + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + checkResult = STATUS_FAILED; + } + } + + return checkResult; + } +} // end of plugMultiConnect001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..b381bb66021 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,32 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugAttachConnector002_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugAttachConnector002_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugAttachConnector002_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugLaunchConnector002_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugLaunchConnector002_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugLaunchConnector002_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugListenConnector002_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugListenConnector002_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.PlugListenConnector002_02 + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_01.java new file mode 100644 index 00000000000..b8eadd6d9b8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector002_01 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector002_01_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector002_01_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector002_01_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + + public PlugAttachConnector002_01() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + plugAttachConnectorDefaultArguments); + } + +} // end of PlugAttachConnector002_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_02.java new file mode 100644 index 00000000000..1d31c426e40 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_02.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector002_02 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector002_02_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector002_02_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector002_02_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector002_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector002_02_StringArgument_Name", + "PlugAttachConnector002_02_StringArgument_Label", + "PlugAttachConnector002_02_StringArgument_Description", + "PlugAttachConnector002_02_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector002_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector002_02_IntegerArgument_Name", + "PlugAttachConnector002_02_IntegerArgument_Label", + "PlugAttachConnector002_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector002_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector002_02_BooleanArgument_Name", + "PlugAttachConnector002_02_BooleanArgument_Label", + "PlugAttachConnector002_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector002_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector002_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector002_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector002_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector002_02_SelectedArgument_Name", + "PlugAttachConnector002_02_SelectedArgument_Label", + "PlugAttachConnector002_02_SelectedArgument_Description", + "PlugAttachConnector002_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector002_02() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugAttachConnector002_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_03.java new file mode 100644 index 00000000000..8cc6061945c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugAttachConnector002_03.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector throwing RuntimeException during instantiating used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector002_03 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName = "PlugAttachConnector002_03_Name"; + static String plugAttachConnectorDescription = "PlugAttachConnector002_03_Description"; + static Transport plugAttachConnectorTransport = new PlugConnectorsTransport("PlugAttachConnector002_03_Transport"); + static Map plugAttachConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector002_03_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector002_03_StringArgument_Name", + "PlugAttachConnector002_03_StringArgument_Label", + "PlugAttachConnector002_03_StringArgument_Description", + "PlugAttachConnector002_03_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector002_03_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector002_03_IntegerArgument_Name", + "PlugAttachConnector002_03_IntegerArgument_Label", + "PlugAttachConnector002_03_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector002_03_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector002_03_BooleanArgument_Name", + "PlugAttachConnector002_03_BooleanArgument_Label", + "PlugAttachConnector002_03_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector002_03_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector002_03_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector002_03_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector002_03_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector002_03_SelectedArgument_Name", + "PlugAttachConnector002_03_SelectedArgument_Label", + "PlugAttachConnector002_03_SelectedArgument_Description", + "PlugAttachConnector002_03_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector002_03() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugAttachConnector002_03: This RuntimeException is thrown intentionally by AttachingConnector " + + "constructor to check creating of pluggable connectors on base of such AttachingConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugAttachConnector002_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_01.java new file mode 100644 index 00000000000..c9c0f70c27f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector002_01 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector002_01_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector002_01_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector002_01_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + + public PlugLaunchConnector002_01() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + plugLaunchConnectorDefaultArguments); + } + +} // end of PlugLaunchConnector002_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_02.java new file mode 100644 index 00000000000..be2c85513a6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_02.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector002_02 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector002_02_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector002_02_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector002_02_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector002_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector002_02_StringArgument_Name", + "PlugLaunchConnector002_02_StringArgument_Label", + "PlugLaunchConnector002_02_StringArgument_Description", + "PlugLaunchConnector002_02_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector002_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector002_02_IntegerArgument_Name", + "PlugLaunchConnector002_02_IntegerArgument_Label", + "PlugLaunchConnector002_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector002_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector002_02_BooleanArgument_Name", + "PlugLaunchConnector002_02_BooleanArgument_Label", + "PlugLaunchConnector002_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector002_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector002_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector002_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector002_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector002_02_SelectedArgument_Name", + "PlugLaunchConnector002_02_SelectedArgument_Label", + "PlugLaunchConnector002_02_SelectedArgument_Description", + "PlugLaunchConnector002_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector002_02() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugLaunchConnector002_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_03.java new file mode 100644 index 00000000000..f3a8391b8d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugLaunchConnector002_03.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector throwing RuntimeException during instantiating used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugLaunchConnector002_03 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName = "PlugLaunchConnector002_03_Name"; + static String plugLaunchConnectorDescription = "PlugLaunchConnector002_03_Description"; + static Transport plugLaunchConnectorTransport = new PlugConnectorsTransport("PlugLaunchConnector002_03_Transport"); + static Map plugLaunchConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector002_03_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector002_03_StringArgument_Name", + "PlugLaunchConnector002_03_StringArgument_Label", + "PlugLaunchConnector002_03_StringArgument_Description", + "PlugLaunchConnector002_03_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector002_03_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector002_03_IntegerArgument_Name", + "PlugLaunchConnector002_03_IntegerArgument_Label", + "PlugLaunchConnector002_03_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector002_03_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector002_03_BooleanArgument_Name", + "PlugLaunchConnector002_03_BooleanArgument_Label", + "PlugLaunchConnector002_03_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector002_03_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector002_03_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector002_03_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector002_03_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector002_03_SelectedArgument_Name", + "PlugLaunchConnector002_03_SelectedArgument_Label", + "PlugLaunchConnector002_03_SelectedArgument_Description", + "PlugLaunchConnector002_03_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector002_03() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugLaunchConnector002_03: This RuntimeException is thrown intentionally by LaunchingConnector " + + "constructor to check creating of pluggable connectors on base of such LaunchingConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugLaunchConnector002_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_01.java new file mode 100644 index 00000000000..189d4ca6a78 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector002_01 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector002_01_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector002_01_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector002_01_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + + public PlugListenConnector002_01() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + plugListenConnectorDefaultArguments); + } + +} // end of PlugListenConnector002_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_02.java new file mode 100644 index 00000000000..ca8bcda833a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_02.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector002_02 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector002_02_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector002_02_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector002_02_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector002_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector002_02_StringArgument_Name", + "PlugListenConnector002_02_StringArgument_Label", + "PlugListenConnector002_02_StringArgument_Description", + "PlugListenConnector002_02_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector002_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector002_02_IntegerArgument_Name", + "PlugListenConnector002_02_IntegerArgument_Label", + "PlugListenConnector002_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector002_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector002_02_BooleanArgument_Name", + "PlugListenConnector002_02_BooleanArgument_Label", + "PlugListenConnector002_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector002_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector002_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector002_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector002_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector002_02_SelectedArgument_Name", + "PlugListenConnector002_02_SelectedArgument_Label", + "PlugListenConnector002_02_SelectedArgument_Description", + "PlugListenConnector002_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector002_02() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugListenConnector002_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_03.java new file mode 100644 index 00000000000..8ef7897d15c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/connectors/PlugListenConnector002_03.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector throwing RuntimeException during instantiating used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector002_03 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName = "PlugListenConnector002_03_Name"; + static String plugListenConnectorDescription = "PlugListenConnector002_03_Description"; + static Transport plugListenConnectorTransport = new PlugConnectorsTransport("PlugListenConnector002_03_Transport"); + static Map plugListenConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector002_03_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector002_03_StringArgument_Name", + "PlugListenConnector002_03_StringArgument_Label", + "PlugListenConnector002_03_StringArgument_Description", + "PlugListenConnector002_03_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector002_03_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector002_03_IntegerArgument_Name", + "PlugListenConnector002_03_IntegerArgument_Label", + "PlugListenConnector002_03_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector002_03_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector002_03_BooleanArgument_Name", + "PlugListenConnector002_03_BooleanArgument_Label", + "PlugListenConnector002_03_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector002_03_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector002_03_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector002_03_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector002_03_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector002_03_SelectedArgument_Name", + "PlugListenConnector002_03_SelectedArgument_Label", + "PlugListenConnector002_03_SelectedArgument_Description", + "PlugListenConnector002_03_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector002_03() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugListenConnector002_03: This RuntimeException is thrown intentionally by ListeningConnector " + + "constructor to check creating of pluggable connectors on base of such ListeningConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugListenConnector002_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/plugMultiConnect002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/plugMultiConnect002.java new file mode 100644 index 00000000000..1991b01d9cb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/plugMultiConnect002.java @@ -0,0 +1,488 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test: + * This test is the test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the 6 expected + * pluggable connectors are created properly on base of 6 different + * Connector implementations of different types, but 3 other pluggable + * connectors are NOT created for Connector implementations for which + * instances can not be created. + * The test expects that 2 created pluggable connectors should be + * of AttachingConnector type, other 2 connectors - + * of ListeningConnector type, and last 2 coonectors - + * of LaunchingConnector type + * Each pluggable connector has to be contained in corresponding list: + * VirtualMachineManager.attachingConnectors(), + * VirtualMachineManager.launchingConnectors() or + * VirtualMachineManager.listeningConnectors(). + * All 6 pluggable connectors have to be contained in + * VirtualMachineManager.allConnectors() list. + * Each pluggable connector is checked for the certain expected + * description and for the certain expected transport. + * For each connector type one pluggable connector should have the + * empty Map of default arguments, and other pluggable connector + * should have 4 default arguments of all types: + * Connector.StringArgument; + * Connector.IntegerArgument; + * Connector.BooleanArgument; + * Connector.SelectedArgument; + * Also the test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the 3 pluggable + * connectors are NOT created as they are based on classes which + * implement the Connector interfaces + * (AttachingConnector, ListeningConnector, and LaunchingConnector), + * but constructors of these classes throw Exception. + * These "invalid" Connector implementations are: + * PlugAttachConnector002_03 class; + * PlugLaunchConnector002_03 class; + * PlugListenConnector002_03 class; + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.plugMultiConnect002 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.plugMultiConnect002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002; + +import nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect002.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 6 expected
    + * pluggable connectors are created properly on base of 6 different
    + * Connector implementations of different types, but 3 other pluggable
    + * connectors are NOT created for Connector implementations for which
    + * instances can not be created.
    + *
    + * The test expects that 2 created pluggable connectors should be
    + * of AttachingConnector type, other 2 connectors -
    + * of ListeningConnector type, and last 2 coonectors -
    + * of LaunchingConnector type
    + *
    + * Each pluggable connector has to be contained in corresponding list:
    + * VirtualMachineManager.attachingConnectors(),
    + * VirtualMachineManager.launchingConnectors() or
    + * VirtualMachineManager.listeningConnectors().
    + *
    + * All 6 pluggable connectors have to be contained in
    + * VirtualMachineManager.allConnectors() list.
    + *
    + * Each pluggable connector is checked for the certain expected
    + * description and for the certain expected transport.
    + *
    + * For each connector type one pluggable connector should have the
    + * empty Map of default arguments, and other pluggable connector
    + * should have 4 default arguments of all types:
    + * Connector.StringArgument;
    + * Connector.IntegerArgument;
    + * Connector.BooleanArgument;
    + * Connector.SelectedArgument;
    + *
    + * Also the test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 3 pluggable
    + * connectors are NOT created as they are based on classes which
    + * implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, and LaunchingConnector),
    + * but constructors of these classes throw Exception.
    + * These "invalid" Connector implementations are:
    + * PlugAttachConnector002_03 class;
    + * PlugLaunchConnector002_03 class;
    + * PlugListenConnector002_03 class;
    + *
    + */ + +public class plugMultiConnect002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugMultiConnect002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugMultiConnect002: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugMultiConnect002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002 test..."); + logOnVerbose + ("==> Test checks that expected pluggable connectors are created properly"); + logOnVerbose + ("==> on base of 6 different Connector implementations,"); + logOnVerbose + ("==> but other pluggable connectors are NOT created"); + logOnVerbose + ("==> for Connector implementations for which instances can not be created.\n"); + int expectedConnectorsNumber = 6; + + String[] checkedPlugConnectorNames = new String[expectedConnectorsNumber]; + checkedPlugConnectorNames[0] = "PlugAttachConnector002_01_Name"; + checkedPlugConnectorNames[1] = "PlugAttachConnector002_02_Name"; + checkedPlugConnectorNames[2] = "PlugLaunchConnector002_01_Name"; + checkedPlugConnectorNames[3] = "PlugLaunchConnector002_02_Name"; + checkedPlugConnectorNames[4] = "PlugListenConnector002_01_Name"; + checkedPlugConnectorNames[5] = "PlugListenConnector002_02_Name"; + + Connector[] referencePlugConnectors = new Connector[expectedConnectorsNumber]; + referencePlugConnectors[0] = new PlugAttachConnector002_01(); + referencePlugConnectors[1] = new PlugAttachConnector002_02(); + referencePlugConnectors[2] = new PlugLaunchConnector002_01(); + referencePlugConnectors[3] = new PlugLaunchConnector002_02(); + referencePlugConnectors[4] = new PlugListenConnector002_01(); + referencePlugConnectors[5] = new PlugListenConnector002_02(); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + for (int i=0; i < expectedConnectorsNumber; i++ ) { + int checkResult = checkForValidConnector(virtualMachineManager, + checkedPlugConnectorNames[i], + referencePlugConnectors[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + int invalidConnectorsNumber = 3; + + String[] invalidPlugConnectorClassesNames = new String[invalidConnectorsNumber]; + invalidPlugConnectorClassesNames[0] = "PlugAttachConnector002_03"; + invalidPlugConnectorClassesNames[1] = "PlugLaunchConnector002_03"; + invalidPlugConnectorClassesNames[2] = "PlugListenConnector002_03"; + + for (int i=0; i < invalidConnectorsNumber; i++ ) { + int checkResult = checkForInvalidConnector(virtualMachineManager, + invalidPlugConnectorClassesNames[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + return testResult; + } + + private int checkForValidConnector (VirtualMachineManager virtualMachineManager, + String checkedPlugConnectorName, + Connector referencePlugConnector) { + int checkResult = STATUS_PASSED; + + // check that checked pluggable connector is found out + // in attaching/launching/listeningConnectors() List + List connectorsList = null; + if ( referencePlugConnector instanceof AttachingConnector) { + connectorsList = virtualMachineManager.attachingConnectors(); + } + if ( referencePlugConnector instanceof LaunchingConnector) { + connectorsList = virtualMachineManager.launchingConnectors(); + } + if ( referencePlugConnector instanceof ListeningConnector) { + connectorsList = virtualMachineManager.listeningConnectors(); + } + + int connectorsNumber = connectorsList.size(); + Connector checkedPlugConnector = null; + + for (int i=0; i < connectorsNumber; i++ ) { + Connector connector = (Connector)connectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugConnectorName.equals(connectorName) ) { + if ( checkedPlugConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + connector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnector = connector; + } + } + } + + if ( checkedPlugConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugConnectorName + "'"); + return STATUS_FAILED; + } + + // check that checked pluggable connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( checkedPlugConnector.equals(foundConnector) ) { + if ( checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnectorFound = true; + } + } + } + + if ( ! checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + checkResult = STATUS_FAILED; + } + + // check that checked pluggable connector matches corresponding reference connector + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugConnector, + checkedPlugConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + Map referenceDefaultArguments = referencePlugConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + int checkedDefaultArgumentsNumber = checkedDefaultArguments.size(); + + if ( referenceDefaultArgumentsNumber != checkedDefaultArgumentsNumber ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector contains unexpected number of default arguments"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + logOnError(errorLogPrefix + "Expected number of default arguments = " + + referenceDefaultArgumentsNumber); + logOnError(errorLogPrefix + "Actual number of default arguments = " + + checkedDefaultArgumentsNumber); + return STATUS_FAILED; + } + + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + checkResult = STATUS_FAILED; + } + } + + return checkResult; + } + + private int checkForInvalidConnector (VirtualMachineManager virtualMachineManager, + String invalidPlugConnectorClassName) { + int checkResult = STATUS_PASSED; + + List connectorsList = null; + String connectorsListName = null; + if ( invalidPlugConnectorClassName.equals("PlugAttachConnector002_03") ) { + connectorsList = virtualMachineManager.attachingConnectors(); + connectorsListName = "attachingConnectors() List"; + } + if ( invalidPlugConnectorClassName.equals("PlugLaunchConnector002_03") ) { + connectorsList = virtualMachineManager.launchingConnectors(); + connectorsListName = "launchingConnectors() List"; + } + if ( invalidPlugConnectorClassName.equals("PlugListenConnector002_03") ) { + connectorsList = virtualMachineManager.listeningConnectors(); + connectorsListName = "listeningConnectors() List"; + } + int connectorsNumber = connectorsList.size(); + + // check that pluggable connector is NOT created on base of Connector + // implementation for which instance can not be created + Connector invalidPlugConnector = null; + + for (int i=0; i < connectorsNumber; i++ ) { + Connector foundConnector = (Connector)connectorsList.get(i); + if ( invalidPlugConnectorClassName.equals("PlugAttachConnector002_03") ) { + if ( foundConnector instanceof PlugAttachConnector002_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugLaunchConnector002_03") ) { + if ( foundConnector instanceof PlugLaunchConnector002_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugListenConnector002_03") ) { + if ( foundConnector instanceof PlugListenConnector002_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + } + + if ( invalidPlugConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable connector is created on base of Connector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in " + connectorsListName); + logOnError(errorLogPrefix + "Connector instance = '" + invalidPlugConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + invalidPlugConnector.name() + "'"); + checkResult = STATUS_FAILED; + } + + + // check that invalid pluggable connector is NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + invalidPlugConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( invalidPlugConnectorClassName.equals("PlugAttachConnector002_03") ) { + if ( foundConnector instanceof PlugAttachConnector002_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugLaunchConnector002_03") ) { + if ( foundConnector instanceof PlugLaunchConnector002_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugListenConnector002_03") ) { + if ( foundConnector instanceof PlugListenConnector002_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + } + + if ( invalidPlugConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable connector is created on base of Connector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() List"); + logOnError(errorLogPrefix + "Connector instance = '" + invalidPlugConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + invalidPlugConnector.name() + "'"); + checkResult = STATUS_FAILED; + } + + return checkResult; + } + +} // end of plugMultiConnect002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..3f005ba4c82 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,24 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.connectors.PlugTransportService003_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.connectors.PlugTransportService003_02 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/PlugTransportService003_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/PlugTransportService003_01.java new file mode 100644 index 00000000000..bc565ade6a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/PlugTransportService003_01.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService003_01 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService003_01_Name"; + static String plugTransportServiceDescription = "PlugTransportService003_01_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService003_01() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService003_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/PlugTransportService003_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/PlugTransportService003_02.java new file mode 100644 index 00000000000..0f1ddca72b0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/connectors/PlugTransportService003_02.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService003_02 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService003_02_Name"; + static String plugTransportServiceDescription = "PlugTransportService003_02_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + false, // supportsAcceptTimeout + false, // supportsAttachTimeout + false, // supportsHandshakeTimeout + false // supportsMultipleConnections + ); + + public PlugTransportService003_02() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService003_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/plugMultiConnect003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/plugMultiConnect003.java new file mode 100644 index 00000000000..e8cffb3db36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/plugMultiConnect003.java @@ -0,0 +1,496 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the TransportService abstract + * class (com.sun.jdi.connect.spi.TransportService). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked four expected pluggable + * connectors (two AttachingConnectors and two ListeningConnectors) are + * created properly on base of two different TransportService + * implementations. + * The created attaching pluggable connectors have to be contained in Lis + * returned by VirtualMachineManager.attachingConnectors(). + * The created listening pluggable connectors have to be contained in Lis + * returned by VirtualMachineManager.listeningConnectors(). + * And all four connectors have to be contained in List returned + * by VirtualMachineManager.allConnectors() methods. + * The attaching pluggable connectors should have names based on the names + * of the corresponding base transport services concatenated with the + * string "Attach", i.e. + * TransportService.name() + "Attach" + * Similarly, the listening pluggable connectors names are formed of names + * of transport services with string "Listen": + * TransportService.name() + "Listen"; + * All pluggable connectors should have the description conterminous with + * the description of the corresponding base transport service + * (TransportService001.description()). + * All pluggable connectors should have two default arguments named + * "address" and "timeout". + * In addition the listening pluggable connectorsshould have + * 'supportsMultipleConnections' capability matching the same base + * TransportService capability. + * The baee TransportServices are: + * PlugTransportService003_01 class which has: + * name() = "PlugTransportService003_01_Name" + * description() = "PlugTransportService003_01_Description" + * capabilities().supportsAcceptTimeout = true + * capabilities().supportsAttachTimeout = true + * capabilities().supportsHandshakeTimeout = true + * capabilities().supportsMultipleConnections = true + * PlugTransportService003_02 class which has: + * name() = "PlugTransportService003_02_Name" + * description() = "PlugTransportService003_02_Description" + * capabilities().supportsAcceptTimeout = false + * capabilities().supportsAttachTimeout = false + * capabilities().supportsHandshakeTimeout = false + * capabilities().supportsMultipleConnections = false + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.plugMultiConnect003 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.plugMultiConnect003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003; + +import nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect003.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the TransportService abstract
    + * class (com.sun.jdi.connect.spi.TransportService).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked four expected pluggable
    + * connectors (two AttachingConnectors and two ListeningConnectors) are
    + * created properly on base of two different TransportService
    + * implementations.
    + *
    + * The created attaching pluggable connectors have to be contained in List
    + * returned by VirtualMachineManager.attachingConnectors().
    + * The created listening pluggable connectors have to be contained in List
    + * returned by VirtualMachineManager.listeningConnectors().
    + * And all four connectors have to be contained in List returned
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * The attaching pluggable connectors should have names based on the names
    + * of the corresponding base transport services concatenated with the
    + * string "Attach", i.e.
    + * TransportService.name() + "Attach"
    + * Similarly, the listening pluggable connectors names are formed of names
    + * of transport services with string "Listen":
    + * TransportService.name() + "Listen";
    + *
    + * All pluggable connectors should have the description conterminous with
    + * the description of the corresponding base transport service
    + * (TransportService001.description()).
    + *
    + * All pluggable connectors should have two default arguments named
    + * "address" and "timeout".
    + *
    + * In addition the listening pluggable connectorsshould have
    + * 'supportsMultipleConnections' capability matching the same base
    + * TransportService capability.
    + *
    + * The baee TransportServices are:
    + * PlugTransportService003_01 class which has:
    + * name() = "PlugTransportService003_01_Name"
    + * description() = "PlugTransportService003_01_Description"
    + * capabilities().supportsAcceptTimeout = true
    + * capabilities().supportsAttachTimeout = true
    + * capabilities().supportsHandshakeTimeout = true
    + * capabilities().supportsMultipleConnections = true
    + * PlugTransportService003_02 class which has:
    + * name() = "PlugTransportService003_02_Name"
    + * description() = "PlugTransportService003_02_Description"
    + * capabilities().supportsAcceptTimeout = false
    + * capabilities().supportsAttachTimeout = false
    + * capabilities().supportsHandshakeTimeout = false
    + * capabilities().supportsMultipleConnections = false
    + *
    + */ + +public class plugMultiConnect003 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugMultiConnect003: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugMultiConnect003: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugMultiConnect003().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003 test..."); + logOnVerbose + ("==> Test checks that expected pluggable connectors are created properly"); + logOnVerbose + ("==> on base of two different TransportService implementations."); + + int referenceTransportServicesNumber = 2; + + TransportService[] referenceTransportServices + = new TransportService[referenceTransportServicesNumber]; + referenceTransportServices[0] = new PlugTransportService003_01(); + referenceTransportServices[1] = new PlugTransportService003_02(); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + for (int i=0; i < referenceTransportServicesNumber; i++ ) { + int checkResult = checkConnectorsForTransportService(virtualMachineManager, + referenceTransportServices[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + return testResult; + } + + private int checkConnectorsForTransportService + (VirtualMachineManager virtualMachineManager, + TransportService referenceTransportService) { + + int checkResult = STATUS_PASSED; + + String checkedPlugAttachConnectorName = referenceTransportService.name() + "Attach"; + String checkedPlugListenConnectorName = referenceTransportService.name() + "Listen"; + String checkedPlugConnectorsDescription = referenceTransportService.description(); + String addressArgumentName = "address"; + String timeoutArgumentName = "timeout"; + boolean expectedMultipleConnectionsCapability + = referenceTransportService.capabilities().supportsMultipleConnections(); + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + attachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnector = attachingConnector; + } + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + listeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnector = listeningConnector; + } + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + if ( checkedPlugAttachConnector != null ) { + // check that expected pluggable attaching connector is found out in allConnectors() List too + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + if ( checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundAttachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = checkedPlugAttachConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT address argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable attaching connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable attaching connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable attaching connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + } + + if ( checkedPlugListenConnector != null ) { + // check that expected pluggable listening connector is found out in allConnectors() List too + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + if ( checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundListeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listenhing connector has expected description + String actualDescription = checkedPlugListenConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT address argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable listening connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable listening connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has 'supportsMultipleConnections' + // capability matching the same base TransportService capability + boolean actualMultipleConnectionsCapability = checkedPlugListenConnector.supportsMultipleConnections(); + if ( actualMultipleConnectionsCapability != expectedMultipleConnectionsCapability ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has 'supportsMultipleConnections'"); + logOnError(errorLogPrefix + "capability NOT matching the same base TransportService capability:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected 'supportsMultipleConnections' capability = " + + expectedMultipleConnectionsCapability); + logOnError(errorLogPrefix + "Actual 'supportsMultipleConnections' capability = " + + actualMultipleConnectionsCapability); + checkResult = STATUS_FAILED; + } + + } + + return checkResult; + } + +} // end of plugMultiConnect003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..ea81c975df5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,25 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors.PlugTransportService004_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors.PlugTransportService004_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors.PlugTransportService004_02 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_01.java new file mode 100644 index 00000000000..f3b43e35691 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_01.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService004_01 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService004_01_Name"; + static String plugTransportServiceDescription = "PlugTransportService004_01_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService004_01() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService004_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_02.java new file mode 100644 index 00000000000..effe7440030 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_02.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService004_02 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService004_02_Name"; + static String plugTransportServiceDescription = "PlugTransportService004_02_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + false, // supportsAcceptTimeout + false, // supportsAttachTimeout + false, // supportsHandshakeTimeout + false // supportsMultipleConnections + ); + + public PlugTransportService004_02() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService004_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_03.java new file mode 100644 index 00000000000..ddcb0e3cd89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/connectors/PlugTransportService004_03.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService implementatiopn with constructor throwing + * Exception. Used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService004_03 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService004_03_Name"; + static String plugTransportServiceDescription = "PlugTransportService004_03_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService004_03() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + + String exceptionMessage = + "<## PlugTransportService004_03: This RuntimeException is thrown intentionally by TransportService " + + "constructor to check creating of pluggable connectors on base of such TransportService. ##>"; + + throw new RuntimeException(exceptionMessage); + + } + +} // end of PlugTransportService004_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/plugMultiConnect004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/plugMultiConnect004.java new file mode 100644 index 00000000000..ef25a332f80 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/plugMultiConnect004.java @@ -0,0 +1,628 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the TransportService abstract + * class (com.sun.jdi.connect.spi.TransportService). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked four expected pluggable + * connectors (two AttachingConnectors and two ListeningConnectors) are + * created properly on base of two different TransportService + * implementations, but 2 other pluggable connectors (AttachingConnector + * and ListeningConnector) are NOT created for TransportService + * implementation for which instances can not be created. + * The created attaching pluggable connectors have to be contained in List + * returned by VirtualMachineManager.attachingConnectors(). + * The created listening pluggable connectors have to be contained in List + * returned by VirtualMachineManager.listeningConnectors(). + * And all four connectors have to be contained in List returned + * by VirtualMachineManager.allConnectors() methods. + * The attaching pluggable connectors should have names based on the names + * of the corresponding base transport services concatenated with the + * string "Attach", i.e. + * TransportService.name() + "Attach" + * Similarly, the listening pluggable connectors names are formed of names + * of transport services with string "Listen": + * TransportService.name() + "Listen"; + * All pluggable connectors should have the description conterminous with + * the description of the corresponding base transport service + * (TransportService001.description()). + * All pluggable connectors should have two default arguments named + * "address" and "timeout". + * In addition the listening pluggable connectorsshould have + * 'supportsMultipleConnections' capability matching the same base + * TransportService capability. + * The baee TransportServices are: + * PlugTransportService004_01 class which has: + * name() = "PlugTransportService004_01_Name" + * description() = "PlugTransportService004_01_Description" + * capabilities().supportsAcceptTimeout = true + * capabilities().supportsAttachTimeout = true + * capabilities().supportsHandshakeTimeout = true + * capabilities().supportsMultipleConnections = true + * PlugTransportService004_02 class which has: + * name() = "PlugTransportService004_02_Name" + * description() = "PlugTransportService004_02_Description" + * capabilities().supportsAcceptTimeout = false + * capabilities().supportsAttachTimeout = false + * capabilities().supportsHandshakeTimeout = false + * capabilities().supportsMultipleConnections = false + * Also the test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the 2 pluggable connectors + * (AttachingConnector and ListeningConnector) are NOT created as they are + * based on class which extends the TransportService abstract class but + * constructors of this class throws Exception. + * This "invalid" TransportService implementations is: + * PlugTransportService004_03 class; + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.plugMultiConnect004 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.plugMultiConnect004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004; + +import nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect004.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the TransportService abstract
    + * class (com.sun.jdi.connect.spi.TransportService).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked four expected pluggable
    + * connectors (two AttachingConnectors and two ListeningConnectors) are
    + * created properly on base of two different TransportService
    + * implementations, but 2 other pluggable connectors (AttachingConnector
    + * and ListeningConnector) are NOT created for TransportService
    + * implementation for which instances can not be created.
    + *
    + * The created attaching pluggable connectors have to be contained in List
    + * returned by VirtualMachineManager.attachingConnectors().
    + * The created listening pluggable connectors have to be contained in List
    + * returned by VirtualMachineManager.listeningConnectors().
    + * And all four connectors have to be contained in List returned
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * The attaching pluggable connectors should have names based on the names
    + * of the corresponding base transport services concatenated with the
    + * string "Attach", i.e.
    + * TransportService.name() + "Attach"
    + * Similarly, the listening pluggable connectors names are formed of names
    + * of transport services with string "Listen":
    + * TransportService.name() + "Listen";
    + *
    + * All pluggable connectors should have the description conterminous with
    + * the description of the corresponding base transport service
    + * (TransportService001.description()).
    + *
    + * All pluggable connectors should have two default arguments named
    + * "address" and "timeout".
    + *
    + * In addition the listening pluggable connectorsshould have
    + * 'supportsMultipleConnections' capability matching the same base
    + * TransportService capability.
    + *
    + * The baee TransportServices are:
    + * PlugTransportService004_01 class which has:
    + * name() = "PlugTransportService004_01_Name"
    + * description() = "PlugTransportService004_01_Description"
    + * capabilities().supportsAcceptTimeout = true
    + * capabilities().supportsAttachTimeout = true
    + * capabilities().supportsHandshakeTimeout = true
    + * capabilities().supportsMultipleConnections = true
    + * PlugTransportService004_02 class which has:
    + * name() = "PlugTransportService004_02_Name"
    + * description() = "PlugTransportService004_02_Description"
    + * capabilities().supportsAcceptTimeout = false
    + * capabilities().supportsAttachTimeout = false
    + * capabilities().supportsHandshakeTimeout = false
    + * capabilities().supportsMultipleConnections = false
    + *
    + * Also the test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 2 pluggable connectors
    + * (AttachingConnector and ListeningConnector) are NOT created as they are
    + * based on class which extends the TransportService abstract class but
    + * constructors of this class throws Exception.
    + * This "invalid" TransportService implementations is:
    + * PlugTransportService004_03 class;
    + *
    + */ + +public class plugMultiConnect004 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugMultiConnect004: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugMultiConnect004: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugMultiConnect004().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004 test..."); + logOnVerbose + ("==> Test checks that expected pluggable connectors are created properly"); + logOnVerbose + ("==> on base of two different TransportService implementations,"); + logOnVerbose + ("==> but other pluggable connectors are NOT created"); + logOnVerbose + ("==> for TransportService implementation for which instance can not be created.\n"); + + int referenceTransportServicesNumber = 2; + + TransportService[] referenceTransportServices + = new TransportService[referenceTransportServicesNumber]; + referenceTransportServices[0] = new PlugTransportService004_01(); + referenceTransportServices[1] = new PlugTransportService004_02(); + + int invalidTransportServicesNumber = 1; + + String[] invalidTransportServicesNames + = new String[invalidTransportServicesNumber]; + invalidTransportServicesNames[0] = "PlugTransportService004_03_Name"; + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + for (int i=0; i < referenceTransportServicesNumber; i++ ) { + int checkResult = checkConnectorsForValidTransportService(virtualMachineManager, + referenceTransportServices[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + for (int i=0; i < invalidTransportServicesNumber; i++ ) { + int checkResult = checkConnectorsForInvalidTransportService(virtualMachineManager, + invalidTransportServicesNames[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + return testResult; + } + + private int checkConnectorsForValidTransportService + (VirtualMachineManager virtualMachineManager, + TransportService referenceTransportService) { + + int checkResult = STATUS_PASSED; + + String checkedPlugAttachConnectorName = referenceTransportService.name() + "Attach"; + String checkedPlugListenConnectorName = referenceTransportService.name() + "Listen"; + String checkedPlugConnectorsDescription = referenceTransportService.description(); + String addressArgumentName = "address"; + String timeoutArgumentName = "timeout"; + boolean expectedMultipleConnectionsCapability + = referenceTransportService.capabilities().supportsMultipleConnections(); + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + attachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnector = attachingConnector; + } + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + listeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnector = listeningConnector; + } + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + if ( checkedPlugAttachConnector != null ) { + // check that expected pluggable attaching connector is found out in allConnectors() List too + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + if ( checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundAttachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = checkedPlugAttachConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT address argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable attaching connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable attaching connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable attaching connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + } + + if ( checkedPlugListenConnector != null ) { + // check that expected pluggable listening connector is found out in allConnectors() List too + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + if ( checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundListeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listenhing connector has expected description + String actualDescription = checkedPlugListenConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT address argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable listening connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable listening connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has 'supportsMultipleConnections' + // capability matching the same base TransportService capability + boolean actualMultipleConnectionsCapability = checkedPlugListenConnector.supportsMultipleConnections(); + if ( actualMultipleConnectionsCapability != expectedMultipleConnectionsCapability ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has 'supportsMultipleConnections'"); + logOnError(errorLogPrefix + "capability NOT matching the same base TransportService capability:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected 'supportsMultipleConnections' capability = " + + expectedMultipleConnectionsCapability); + logOnError(errorLogPrefix + "Actual 'supportsMultipleConnections' capability = " + + actualMultipleConnectionsCapability); + checkResult = STATUS_FAILED; + } + + } + + return checkResult; + } + + private int checkConnectorsForInvalidTransportService + (VirtualMachineManager virtualMachineManager, + String invalidTransportServiceName) { + + int checkResult = STATUS_PASSED; + + String checkedPlugAttachConnectorName = invalidTransportServiceName + "Attach"; + String checkedPlugListenConnectorName = invalidTransportServiceName + "Listen"; + + // check that pluggable attaching connector is NOT created on base of TransportService + // implementation for which instance can not be created + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in attachingConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that pluggable listening connector is NOT created on base of TransportService + // implementation for which instance can not be created + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in listeningConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that pluggable connectors are NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + Connector attachConnector = null; + Connector listenConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector connector = (Connector)allConnectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugAttachConnectorName.equals(connectorName) ) { + attachConnector = connector; + } + if ( checkedPlugListenConnectorName.equals(connectorName) ) { + listenConnector = connector; + } + } + + if ( attachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + attachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + if ( listenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + listenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + return checkResult; + } + +} // end of plugMultiConnect004 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..6616295f5c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,29 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugAttachConnector005_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugAttachConnector005_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugLaunchConnector005_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugLaunchConnector005_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugListenConnector005_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugListenConnector005_02 + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..4ab0a5cbafa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,24 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugTransportService005_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.PlugTransportService005_02 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugAttachConnector005_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugAttachConnector005_01.java new file mode 100644 index 00000000000..289bfe491c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugAttachConnector005_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector005_01 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector005_01_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector005_01_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector005_01_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + + public PlugAttachConnector005_01() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + plugAttachConnectorDefaultArguments); + } + +} // end of PlugAttachConnector005_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugAttachConnector005_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugAttachConnector005_02.java new file mode 100644 index 00000000000..bcac43e29a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugAttachConnector005_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugAttachConnector005_02 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector005_02_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector005_02_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector005_02_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector005_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector005_02_StringArgument_Name", + "PlugAttachConnector005_02_StringArgument_Label", + "PlugAttachConnector005_02_StringArgument_Description", + "PlugAttachConnector005_02_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector005_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector005_02_IntegerArgument_Name", + "PlugAttachConnector005_02_IntegerArgument_Label", + "PlugAttachConnector005_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector005_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector005_02_BooleanArgument_Name", + "PlugAttachConnector005_02_BooleanArgument_Label", + "PlugAttachConnector005_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector005_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector005_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector005_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector005_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector005_02_SelectedArgument_Name", + "PlugAttachConnector005_02_SelectedArgument_Label", + "PlugAttachConnector005_02_SelectedArgument_Description", + "PlugAttachConnector005_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector005_02() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugAttachConnector005_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugLaunchConnector005_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugLaunchConnector005_01.java new file mode 100644 index 00000000000..9b4384038f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugLaunchConnector005_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector005_01 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector005_01_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector005_01_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector005_01_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + + public PlugLaunchConnector005_01() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + plugLaunchConnectorDefaultArguments); + } + +} // end of PlugLaunchConnector005_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugLaunchConnector005_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugLaunchConnector005_02.java new file mode 100644 index 00000000000..c4d44b934f4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugLaunchConnector005_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugLaunchConnector005_02 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector005_02_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector005_02_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector005_02_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector005_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector005_02_StringArgument_Name", + "PlugLaunchConnector005_02_StringArgument_Label", + "PlugLaunchConnector005_02_StringArgument_Description", + "PlugLaunchConnector005_02_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector005_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector005_02_IntegerArgument_Name", + "PlugLaunchConnector005_02_IntegerArgument_Label", + "PlugLaunchConnector005_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector005_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector005_02_BooleanArgument_Name", + "PlugLaunchConnector005_02_BooleanArgument_Label", + "PlugLaunchConnector005_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector005_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector005_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector005_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector005_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector005_02_SelectedArgument_Name", + "PlugLaunchConnector005_02_SelectedArgument_Label", + "PlugLaunchConnector005_02_SelectedArgument_Description", + "PlugLaunchConnector005_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector005_02() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugLaunchConnector005_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugListenConnector005_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugListenConnector005_01.java new file mode 100644 index 00000000000..ef7a34aa64a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugListenConnector005_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector005_01 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector005_01_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector005_01_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector005_01_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + + public PlugListenConnector005_01() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + plugListenConnectorDefaultArguments); + } + +} // end of PlugListenConnector005_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugListenConnector005_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugListenConnector005_02.java new file mode 100644 index 00000000000..6a0e5e418e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugListenConnector005_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugListenConnector005_02 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector005_02_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector005_02_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector005_02_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector005_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector005_02_StringArgument_Name", + "PlugListenConnector005_02_StringArgument_Label", + "PlugListenConnector005_02_StringArgument_Description", + "PlugListenConnector005_02_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector005_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector005_02_IntegerArgument_Name", + "PlugListenConnector005_02_IntegerArgument_Label", + "PlugListenConnector005_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector005_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector005_02_BooleanArgument_Name", + "PlugListenConnector005_02_BooleanArgument_Label", + "PlugListenConnector005_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector005_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector005_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector005_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector005_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector005_02_SelectedArgument_Name", + "PlugListenConnector005_02_SelectedArgument_Label", + "PlugListenConnector005_02_SelectedArgument_Description", + "PlugListenConnector005_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector005_02() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugListenConnector005_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugTransportService005_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugTransportService005_01.java new file mode 100644 index 00000000000..7c01367eeb4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugTransportService005_01.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService005_01 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService005_01_Name"; + static String plugTransportServiceDescription = "PlugTransportService005_01_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService005_01() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService005_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugTransportService005_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugTransportService005_02.java new file mode 100644 index 00000000000..e8e14a69d23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/connectors/PlugTransportService005_02.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService005_02 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService005_02_Name"; + static String plugTransportServiceDescription = "PlugTransportService005_02_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + false, // supportsAcceptTimeout + false, // supportsAttachTimeout + false, // supportsHandshakeTimeout + false // supportsMultipleConnections + ); + + public PlugTransportService005_02() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService005_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/plugMultiConnect005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/plugMultiConnect005.java new file mode 100644 index 00000000000..a4c6c480e5f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/plugMultiConnect005.java @@ -0,0 +1,673 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * and the TransportService abstract class. + * The test checks up that at start-up time when > + * Bootstrap.virtualMachineManager() is invoked the 6 expected + * pluggable connectors are created properly on base of 6 different + * Connector implementations of different types and four expected + * pluggable connectors (two AttachingConnectors and two + * ListeningConnectors) are created properly on base of two different + * TransportService implementations. + * For connectors created on base of Connector implementations the + * test expects that 2 pluggable connectors should be + * of AttachingConnector type, other 2 connectors - + * of ListeningConnector type, and last 2 coonectors - + * of LaunchingConnector type + * Each pluggable connector has to be contained in corresponding list: + * VirtualMachineManager.attachingConnectors(), + * VirtualMachineManager.launchingConnectors() or> + * VirtualMachineManager.listeningConnectors(). + * All 6 pluggable connectors have to be contained in + * VirtualMachineManager.allConnectors() list. + * Each pluggable connector is checked for the certain expected + * description and for the certain expected transport. + * For each connector type one pluggable connector should have the + * empty Map of default arguments, and other pluggable connector + * should have 4 default arguments of all types: > + * Connector.StringArgument; + * Connector.IntegerArgument; + * Connector.BooleanArgument; + * Connector.SelectedArgument; + * For connectors created on base of TransportService implementations + * the test expects that the created attaching pluggable connectors have + * to be contained in List returned by + * VirtualMachineManager.attachingConnectors(). + * The created listening pluggable connectors have to be contained in List + * returned by VirtualMachineManager.listeningConnectors(). + * And all four connectors have to be contained in List returned + * by VirtualMachineManager.allConnectors() methods. + * The attaching pluggable connectors should have names based on the names + * of the corresponding base transport services concatenated with the + * string "Attach", i.e. + * TransportService.name() + "Attach" + * Similarly, the listening pluggable connectors names are formed of names + * of transport services with string "Listen": + * TransportService.name() + "Listen"; + * All pluggable connectors should have the description conterminous with + * the description of the corresponding base transport service + * (TransportService001.description()). + * All pluggable connectors should have two default arguments named + * "address" and "timeout". + * In addition the listening pluggable connectorsshould have + * 'supportsMultipleConnections' capability matching the same base + * TransportService capability. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.plugMultiConnect005 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.plugMultiConnect005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005; + +import nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect005.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + * and the TransportService abstract class.
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 6 expected
    + * pluggable connectors are created properly on base of 6 different
    + * Connector implementations of different types and four expected
    + * pluggable connectors (two AttachingConnectors and two
    + * ListeningConnectors) are created properly on base of two different
    + * TransportService implementations.
    + *
    + * For connectors created on base of Connector implementations the
    + * test expects that 2 pluggable connectors should be
    + * of AttachingConnector type, other 2 connectors -
    + * of ListeningConnector type, and last 2 coonectors -
    + * of LaunchingConnector type
    + *
    + * Each pluggable connector has to be contained in corresponding list:
    + * VirtualMachineManager.attachingConnectors(),
    + * VirtualMachineManager.launchingConnectors() or
    + * VirtualMachineManager.listeningConnectors().
    + *
    + * All 6 pluggable connectors have to be contained in
    + * VirtualMachineManager.allConnectors() list.
    + *
    + * Each pluggable connector is checked for the certain expected
    + * description and for the certain expected transport.
    + *
    + * For each connector type one pluggable connector should have the
    + * empty Map of default arguments, and other pluggable connector
    + * should have 4 default arguments of all types:
    + * Connector.StringArgument;
    + * Connector.IntegerArgument;
    + * Connector.BooleanArgument;
    + * Connector.SelectedArgument;
    + *
    + * For connectors created on base of TransportService implementations
    + * the test expects that the created attaching pluggable connectors have
    + * to be contained in List returned by
    + * VirtualMachineManager.attachingConnectors().
    + * The created listening pluggable connectors have to be contained in List
    + * returned by VirtualMachineManager.listeningConnectors().
    + * And all four connectors have to be contained in List returned
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * The attaching pluggable connectors should have names based on the names
    + * of the corresponding base transport services concatenated with the
    + * string "Attach", i.e.
    + * TransportService.name() + "Attach"
    + * Similarly, the listening pluggable connectors names are formed of names
    + * of transport services with string "Listen":
    + * TransportService.name() + "Listen";
    + *
    + * All pluggable connectors should have the description conterminous with
    + * the description of the corresponding base transport service
    + * (TransportService001.description()).
    + *
    + * All pluggable connectors should have two default arguments named
    + * "address" and "timeout".
    + *
    + * In addition the listening pluggable connectorsshould have
    + * 'supportsMultipleConnections' capability matching the same base
    + * TransportService capability.
    + *
    + */ + +public class plugMultiConnect005 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugMultiConnect005: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugMultiConnect005: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugMultiConnect005().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test..."); + logOnVerbose + ("==> Test checks that expected pluggable connectors are created properly"); + logOnVerbose + ("==> on base of 6 different Connector implementations and of 2 different"); + logOnVerbose + ("==> TransportService implementations."); + int expectedConnectorsNumber = 6; + + String[] checkedPlugConnectorNames = new String[expectedConnectorsNumber]; + checkedPlugConnectorNames[0] = "PlugAttachConnector005_01_Name"; + checkedPlugConnectorNames[1] = "PlugAttachConnector005_02_Name"; + checkedPlugConnectorNames[2] = "PlugLaunchConnector005_01_Name"; + checkedPlugConnectorNames[3] = "PlugLaunchConnector005_02_Name"; + checkedPlugConnectorNames[4] = "PlugListenConnector005_01_Name"; + checkedPlugConnectorNames[5] = "PlugListenConnector005_02_Name"; + + Connector[] referencePlugConnectors = new Connector[expectedConnectorsNumber]; + referencePlugConnectors[0] = new PlugAttachConnector005_01(); + referencePlugConnectors[1] = new PlugAttachConnector005_02(); + referencePlugConnectors[2] = new PlugLaunchConnector005_01(); + referencePlugConnectors[3] = new PlugLaunchConnector005_02(); + referencePlugConnectors[4] = new PlugListenConnector005_01(); + referencePlugConnectors[5] = new PlugListenConnector005_02(); + + int referenceTransportServicesNumber = 2; + + TransportService[] referenceTransportServices + = new TransportService[referenceTransportServicesNumber]; + referenceTransportServices[0] = new PlugTransportService005_01(); + referenceTransportServices[1] = new PlugTransportService005_02(); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + for (int i=0; i < expectedConnectorsNumber; i++ ) { + int checkResult = checkConnector(virtualMachineManager, + checkedPlugConnectorNames[i], + referencePlugConnectors[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + for (int i=0; i < referenceTransportServicesNumber; i++ ) { + int checkResult = checkConnectorsForTransportService(virtualMachineManager, + referenceTransportServices[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + return testResult; + } + + private int checkConnector (VirtualMachineManager virtualMachineManager, + String checkedPlugConnectorName, + Connector referencePlugConnector) { + int checkResult = STATUS_PASSED; + + // check that checked pluggable connector is found out + // in attaching/launching/listeningConnectors() List + List connectorsList = null; + if ( referencePlugConnector instanceof AttachingConnector) { + connectorsList = virtualMachineManager.attachingConnectors(); + } + if ( referencePlugConnector instanceof LaunchingConnector) { + connectorsList = virtualMachineManager.launchingConnectors(); + } + if ( referencePlugConnector instanceof ListeningConnector) { + connectorsList = virtualMachineManager.listeningConnectors(); + } + + int connectorsNumber = connectorsList.size(); + Connector checkedPlugConnector = null; + + for (int i=0; i < connectorsNumber; i++ ) { + Connector connector = (Connector)connectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugConnectorName.equals(connectorName) ) { + if ( checkedPlugConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + connector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnector = connector; + } + } + } + + if ( checkedPlugConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugConnectorName + "'"); + return STATUS_FAILED; + } + + // check that checked pluggable connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( checkedPlugConnector.equals(foundConnector) ) { + if ( checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnectorFound = true; + } + } + } + + if ( ! checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + checkResult = STATUS_FAILED; + } + + // check that checked pluggable connector matches corresponding reference connector + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugConnector, + checkedPlugConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + Map referenceDefaultArguments = referencePlugConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + int checkedDefaultArgumentsNumber = checkedDefaultArguments.size(); + + if ( referenceDefaultArgumentsNumber != checkedDefaultArgumentsNumber ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector contains unexpected number of default arguments"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + logOnError(errorLogPrefix + "Expected number of default arguments = " + + referenceDefaultArgumentsNumber); + logOnError(errorLogPrefix + "Actual number of default arguments = " + + checkedDefaultArgumentsNumber); + return STATUS_FAILED; + } + + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + checkResult = STATUS_FAILED; + } + } + + return checkResult; + } + + private int checkConnectorsForTransportService + (VirtualMachineManager virtualMachineManager, + TransportService referenceTransportService) { + + int checkResult = STATUS_PASSED; + + String checkedPlugAttachConnectorName = referenceTransportService.name() + "Attach"; + String checkedPlugListenConnectorName = referenceTransportService.name() + "Listen"; + String checkedPlugConnectorsDescription = referenceTransportService.description(); + String addressArgumentName = "address"; + String timeoutArgumentName = "timeout"; + boolean expectedMultipleConnectionsCapability + = referenceTransportService.capabilities().supportsMultipleConnections(); + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + attachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnector = attachingConnector; + } + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + listeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnector = listeningConnector; + } + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + if ( checkedPlugAttachConnector != null ) { + // check that expected pluggable attaching connector is found out in allConnectors() List too + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + if ( checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundAttachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = checkedPlugAttachConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT address argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable attaching connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable attaching connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable attaching connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + } + + if ( checkedPlugListenConnector != null ) { + // check that expected pluggable listening connector is found out in allConnectors() List too + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + if ( checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundListeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listenhing connector has expected description + String actualDescription = checkedPlugListenConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT address argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable listening connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable listening connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has 'supportsMultipleConnections' + // capability matching the same base TransportService capability + boolean actualMultipleConnectionsCapability = checkedPlugListenConnector.supportsMultipleConnections(); + if ( actualMultipleConnectionsCapability != expectedMultipleConnectionsCapability ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has 'supportsMultipleConnections'"); + logOnError(errorLogPrefix + "capability NOT matching the same base TransportService capability:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected 'supportsMultipleConnections' capability = " + + expectedMultipleConnectionsCapability); + logOnError(errorLogPrefix + "Actual 'supportsMultipleConnections' capability = " + + actualMultipleConnectionsCapability); + checkResult = STATUS_FAILED; + } + + } + + return checkResult; + } + +} // end of plugMultiConnect005 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/META-INF/services/com.sun.jdi.connect.Connector b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/META-INF/services/com.sun.jdi.connect.Connector new file mode 100644 index 00000000000..0992bbee0fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/META-INF/services/com.sun.jdi.connect.Connector @@ -0,0 +1,32 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugAttachConnector006_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugAttachConnector006_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugAttachConnector006_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugLaunchConnector006_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugLaunchConnector006_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugLaunchConnector006_02 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugListenConnector006_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugListenConnector006_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugListenConnector006_02 + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..e6cf20b7756 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,25 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005 test +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugTransportService006_01 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugTransportService006_03 +nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.PlugTransportService006_02 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_01.java new file mode 100644 index 00000000000..e2db22c2d32 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugAttachConnector006_01 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector006_01_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector006_01_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector006_01_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + + public PlugAttachConnector006_01() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + plugAttachConnectorDefaultArguments); + } + +} // end of PlugAttachConnector006_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_02.java new file mode 100644 index 00000000000..f0615d1af28 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugAttachConnector006_02 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName + = "PlugAttachConnector006_02_Name"; + static String plugAttachConnectorDescription + = "PlugAttachConnector006_02_Description"; + static Transport plugAttachConnectorTransport + = new PlugConnectorsTransport("PlugAttachConnector006_02_Transport"); + static Map plugAttachConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector006_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector006_02_StringArgument_Name", + "PlugAttachConnector006_02_StringArgument_Label", + "PlugAttachConnector006_02_StringArgument_Description", + "PlugAttachConnector006_02_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector006_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector006_02_IntegerArgument_Name", + "PlugAttachConnector006_02_IntegerArgument_Label", + "PlugAttachConnector006_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector006_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector006_02_BooleanArgument_Name", + "PlugAttachConnector006_02_BooleanArgument_Label", + "PlugAttachConnector006_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector006_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector006_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector006_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector006_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector006_02_SelectedArgument_Name", + "PlugAttachConnector006_02_SelectedArgument_Label", + "PlugAttachConnector006_02_SelectedArgument_Description", + "PlugAttachConnector006_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector006_02() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugAttachConnector006_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_03.java new file mode 100644 index 00000000000..bf7481d95ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugAttachConnector006_03.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple AttachingConnector throwing RuntimeException during instantiating used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugAttachConnector006_03 extends PlugConnectors implements AttachingConnector { + + static String plugAttachConnectorName = "PlugAttachConnector006_03_Name"; + static String plugAttachConnectorDescription = "PlugAttachConnector006_03_Description"; + static Transport plugAttachConnectorTransport = new PlugConnectorsTransport("PlugAttachConnector006_03_Transport"); + static Map plugAttachConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugAttachConnectorStringArgumentKey = "PlugAttachConnector006_03_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugAttachConnector006_03_StringArgument_Name", + "PlugAttachConnector006_03_StringArgument_Label", + "PlugAttachConnector006_03_StringArgument_Description", + "PlugAttachConnector006_03_StringArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorStringArgumentKey, testStringArgument); + + String plugAttachConnectorIntegerArgumentKey = "PlugAttachConnector006_03_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugAttachConnector006_03_IntegerArgument_Name", + "PlugAttachConnector006_03_IntegerArgument_Label", + "PlugAttachConnector006_03_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorIntegerArgumentKey, testIntegerArgument); + + String plugAttachConnectorBooleanArgumentKey = "PlugAttachConnector006_03_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugAttachConnector006_03_BooleanArgument_Name", + "PlugAttachConnector006_03_BooleanArgument_Label", + "PlugAttachConnector006_03_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorBooleanArgumentKey, testBooleanArgument); + + String plugAttachConnectorSelectedArgumentKey = "PlugAttachConnector006_03_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugAttachConnector006_03_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugAttachConnector006_03_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugAttachConnector006_03_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugAttachConnector006_03_SelectedArgument_Name", + "PlugAttachConnector006_03_SelectedArgument_Label", + "PlugAttachConnector006_03_SelectedArgument_Description", + "PlugAttachConnector006_03_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugAttachConnectorDefaultArguments.put(plugAttachConnectorSelectedArgumentKey, testSelectedArgument); + + return plugAttachConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugAttachConnector006_03() { + + super(plugAttachConnectorName, + plugAttachConnectorDescription, + plugAttachConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugAttachConnector006_03: This RuntimeException is thrown intentionally by AttachingConnector " + + "constructor to check creating of pluggable connectors on base of such AttachingConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugAttachConnector006_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_01.java new file mode 100644 index 00000000000..124826411c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugLaunchConnector006_01 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector006_01_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector006_01_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector006_01_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + + public PlugLaunchConnector006_01() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + plugLaunchConnectorDefaultArguments); + } + +} // end of PlugLaunchConnector006_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_02.java new file mode 100644 index 00000000000..40e45c4519c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugLaunchConnector006_02 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName + = "PlugLaunchConnector006_02_Name"; + static String plugLaunchConnectorDescription + = "PlugLaunchConnector006_02_Description"; + static Transport plugLaunchConnectorTransport + = new PlugConnectorsTransport("PlugLaunchConnector006_02_Transport"); + static Map plugLaunchConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector006_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector006_02_StringArgument_Name", + "PlugLaunchConnector006_02_StringArgument_Label", + "PlugLaunchConnector006_02_StringArgument_Description", + "PlugLaunchConnector006_02_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector006_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector006_02_IntegerArgument_Name", + "PlugLaunchConnector006_02_IntegerArgument_Label", + "PlugLaunchConnector006_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector006_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector006_02_BooleanArgument_Name", + "PlugLaunchConnector006_02_BooleanArgument_Label", + "PlugLaunchConnector006_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector006_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector006_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector006_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector006_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector006_02_SelectedArgument_Name", + "PlugLaunchConnector006_02_SelectedArgument_Label", + "PlugLaunchConnector006_02_SelectedArgument_Description", + "PlugLaunchConnector006_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector006_02() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugLaunchConnector006_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_03.java new file mode 100644 index 00000000000..5489fc6a349 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugLaunchConnector006_03.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple LaunchingConnector throwing RuntimeException during instantiating used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugLaunchConnector006_03 extends PlugConnectors implements LaunchingConnector { + + static String plugLaunchConnectorName = "PlugLaunchConnector006_03_Name"; + static String plugLaunchConnectorDescription = "PlugLaunchConnector006_03_Description"; + static Transport plugLaunchConnectorTransport = new PlugConnectorsTransport("PlugLaunchConnector006_03_Transport"); + static Map plugLaunchConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugLaunchConnectorStringArgumentKey = "PlugLaunchConnector006_03_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugLaunchConnector006_03_StringArgument_Name", + "PlugLaunchConnector006_03_StringArgument_Label", + "PlugLaunchConnector006_03_StringArgument_Description", + "PlugLaunchConnector006_03_StringArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorStringArgumentKey, testStringArgument); + + String plugLaunchConnectorIntegerArgumentKey = "PlugLaunchConnector006_03_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugLaunchConnector006_03_IntegerArgument_Name", + "PlugLaunchConnector006_03_IntegerArgument_Label", + "PlugLaunchConnector006_03_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorIntegerArgumentKey, testIntegerArgument); + + String plugLaunchConnectorBooleanArgumentKey = "PlugLaunchConnector006_03_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugLaunchConnector006_03_BooleanArgument_Name", + "PlugLaunchConnector006_03_BooleanArgument_Label", + "PlugLaunchConnector006_03_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorBooleanArgumentKey, testBooleanArgument); + + String plugLaunchConnectorSelectedArgumentKey = "PlugLaunchConnector006_03_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugLaunchConnector006_03_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugLaunchConnector006_03_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugLaunchConnector006_03_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugLaunchConnector006_03_SelectedArgument_Name", + "PlugLaunchConnector006_03_SelectedArgument_Label", + "PlugLaunchConnector006_03_SelectedArgument_Description", + "PlugLaunchConnector006_03_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugLaunchConnectorDefaultArguments.put(plugLaunchConnectorSelectedArgumentKey, testSelectedArgument); + + return plugLaunchConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugLaunchConnector006_03() { + + super(plugLaunchConnectorName, + plugLaunchConnectorDescription, + plugLaunchConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugLaunchConnector006_03: This RuntimeException is thrown intentionally by LaunchingConnector " + + "constructor to check creating of pluggable connectors on base of such LaunchingConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugLaunchConnector006_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_01.java new file mode 100644 index 00000000000..f8470957eb6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_01.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector without default arguments used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; + +public class PlugListenConnector006_01 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector006_01_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector006_01_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector006_01_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + + public PlugListenConnector006_01() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + plugListenConnectorDefaultArguments); + } + +} // end of PlugListenConnector006_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_02.java new file mode 100644 index 00000000000..2a2946fd9cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_02.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector with default arguments of all types used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugListenConnector006_02 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName + = "PlugListenConnector006_02_Name"; + static String plugListenConnectorDescription + = "PlugListenConnector006_02_Description"; + static Transport plugListenConnectorTransport + = new PlugConnectorsTransport("PlugListenConnector006_02_Transport"); + static Map plugListenConnectorDefaultArguments + = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector006_02_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector006_02_StringArgument_Name", + "PlugListenConnector006_02_StringArgument_Label", + "PlugListenConnector006_02_StringArgument_Description", + "PlugListenConnector006_02_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector006_02_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector006_02_IntegerArgument_Name", + "PlugListenConnector006_02_IntegerArgument_Label", + "PlugListenConnector006_02_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector006_02_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector006_02_BooleanArgument_Name", + "PlugListenConnector006_02_BooleanArgument_Label", + "PlugListenConnector006_02_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector006_02_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector006_02_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector006_02_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector006_02_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector006_02_SelectedArgument_Name", + "PlugListenConnector006_02_SelectedArgument_Label", + "PlugListenConnector006_02_SelectedArgument_Description", + "PlugListenConnector006_02_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector006_02() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + } + +} // end of PlugListenConnector006_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_03.java new file mode 100644 index 00000000000..2f00b8c5242 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugListenConnector006_03.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple ListeningConnector throwing RuntimeException during instantiating used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.util.ArrayList; + +public class PlugListenConnector006_03 extends PlugConnectors implements ListeningConnector { + + static String plugListenConnectorName = "PlugListenConnector006_03_Name"; + static String plugListenConnectorDescription = "PlugListenConnector006_03_Description"; + static Transport plugListenConnectorTransport = new PlugConnectorsTransport("PlugListenConnector006_03_Transport"); + static Map plugListenConnectorDefaultArguments = new HashMap(); + + static Map prepareConnectorDefaultArguments() { + String plugListenConnectorStringArgumentKey = "PlugListenConnector006_03_StringArgument_Key"; + Connector.StringArgument testStringArgument = new TestStringArgument( + "PlugListenConnector006_03_StringArgument_Name", + "PlugListenConnector006_03_StringArgument_Label", + "PlugListenConnector006_03_StringArgument_Description", + "PlugListenConnector006_03_StringArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorStringArgumentKey, testStringArgument); + + String plugListenConnectorIntegerArgumentKey = "PlugListenConnector006_03_IntegerArgument_Key"; + Connector.IntegerArgument testIntegerArgument = new TestIntegerArgument( + "PlugListenConnector006_03_IntegerArgument_Name", + "PlugListenConnector006_03_IntegerArgument_Label", + "PlugListenConnector006_03_IntegerArgument_Description", + 555555, // IntegerArgument_Value", + 111111, // IntegerArgument_Min", + 999999, // IntegerArgument_Max", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorIntegerArgumentKey, testIntegerArgument); + + String plugListenConnectorBooleanArgumentKey = "PlugListenConnector006_03_BooleanArgument_Key"; + Connector.BooleanArgument testBooleanArgument = new TestBooleanArgument( + "PlugListenConnector006_03_BooleanArgument_Name", + "PlugListenConnector006_03_BooleanArgument_Label", + "PlugListenConnector006_03_BooleanArgument_Description", + true, // BooleanArgument_Value", + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorBooleanArgumentKey, testBooleanArgument); + + String plugListenConnectorSelectedArgumentKey = "PlugListenConnector006_03_SelectedArgument_Key"; + List selectedArgumentChoices = new ArrayList(); + selectedArgumentChoices.add("PlugListenConnector006_03_SelectedArgument_Value_0"); + selectedArgumentChoices.add("PlugListenConnector006_03_SelectedArgument_Value"); + selectedArgumentChoices.add("PlugListenConnector006_03_SelectedArgument_Value_1"); + + Connector.SelectedArgument testSelectedArgument = new TestSelectedArgument( + "PlugListenConnector006_03_SelectedArgument_Name", + "PlugListenConnector006_03_SelectedArgument_Label", + "PlugListenConnector006_03_SelectedArgument_Description", + "PlugListenConnector006_03_SelectedArgument_Value", + selectedArgumentChoices, // List of choices, + true // mustSpecify + ); + plugListenConnectorDefaultArguments.put(plugListenConnectorSelectedArgumentKey, testSelectedArgument); + + return plugListenConnectorDefaultArguments; + } // end of prepareConnectorDefaultArguments() method + + + public PlugListenConnector006_03() { + + super(plugListenConnectorName, + plugListenConnectorDescription, + plugListenConnectorTransport, + prepareConnectorDefaultArguments()); + + String exceptionMessage = + "<## PlugListenConnector006_03: This RuntimeException is thrown intentionally by ListeningConnector " + + "constructor to check creating of pluggable connectors on base of such ListeningConnector. ##>"; + + throw new RuntimeException(exceptionMessage); + } + +} // end of PlugListenConnector006_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_01.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_01.java new file mode 100644 index 00000000000..30b54fa3a90 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_01.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService006_01 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService006_01_Name"; + static String plugTransportServiceDescription = "PlugTransportService006_01_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService006_01() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService006_01 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_02.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_02.java new file mode 100644 index 00000000000..d47f5834540 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_02.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService006_02 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService006_02_Name"; + static String plugTransportServiceDescription = "PlugTransportService006_02_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + false, // supportsAcceptTimeout + false, // supportsAttachTimeout + false, // supportsHandshakeTimeout + false // supportsMultipleConnections + ); + + public PlugTransportService006_02() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService006_02 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_03.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_03.java new file mode 100644 index 00000000000..11ccaf8975e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/connectors/PlugTransportService006_03.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService implementatiopn with constructor throwing + * Exception. Used by + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService006_03 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService006_03_Name"; + static String plugTransportServiceDescription = "PlugTransportService006_03_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService006_03() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + + String exceptionMessage = + "<## PlugTransportService006_03: This RuntimeException is thrown intentionally by TransportService " + + "constructor to check creating of pluggable connectors on base of such TransportService. ##>"; + + throw new RuntimeException(exceptionMessage); + + } + +} // end of PlugTransportService006_03 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/plugMultiConnect006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/plugMultiConnect006.java new file mode 100644 index 00000000000..a203a2e51e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/plugMultiConnect006.java @@ -0,0 +1,921 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the Connector interfaces + * (AttachingConnector, ListeningConnector, or LaunchingConnector). + * and the TransportService abstract class. + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the 6 expected + * pluggable connectors are created properly on base of 6 different + * Connector implementations of different types and four expected + * pluggable connectors (two AttachingConnectors and two + * ListeningConnectors) are created properly on base of two different + * TransportService implementations. + * Also the test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked the 3 pluggable connectors + * are NOT created for Connector implementations for which instances can + * not be created and 2 pluggable connectors (AttachingConnector and + * ListeningConnector) are NOT created for TransportService implementation + * for which instances can not be created. + * These "invalid" Connector implementations are: + * PlugAttachConnector006_03 class; + * PlugLaunchConnector006_03 class; + * PlugListenConnector006_03 class; + * and "invalid" TransportService implementations is: + * PlugTransportService006_03 class; + * For connectors created on base of Connector implementations the + * test expects that 2 pluggable connectors should be + * of AttachingConnector type, other 2 connectors - + * of ListeningConnector type, and last 2 coonectors - + * of LaunchingConnector type + * Each pluggable connector has to be contained in corresponding list: + * VirtualMachineManager.attachingConnectors(), + * VirtualMachineManager.launchingConnectors() or + * VirtualMachineManager.listeningConnectors(). + * All 6 pluggable connectors have to be contained in + * VirtualMachineManager.allConnectors() list. + * Each pluggable connector is checked for the certain expected + * description and for the certain expected transport. + * For each connector type one pluggable connector should have the + * empty Map of default arguments, and other pluggable connector + * should have 4 default arguments of all types: + * Connector.StringArgument; + * Connector.IntegerArgument; + * Connector.BooleanArgument; + * Connector.SelectedArgument; + * For connectors created on base of TransportService implementations + * the test expects that the created attaching pluggable connectors have + * to be contained in List returned by + * VirtualMachineManager.attachingConnectors(). + * The created listening pluggable connectors have to be contained in List + * returned by VirtualMachineManager.listeningConnectors(). + * And all four connectors have to be contained in List returned + * by VirtualMachineManager.allConnectors() methods. + * The attaching pluggable connectors should have names based on the names + * of the corresponding base transport services concatenated with the + * string "Attach", i.e. + * TransportService.name() + "Attach" + * Similarly, the listening pluggable connectors names are formed of names + * of transport services with string "Listen": + * TransportService.name() + "Listen"; + * All pluggable connectors should have the description conterminous with + * the description of the corresponding base transport service + * (TransportService001.description()). + * All pluggable connectors should have two default arguments named + * "address" and "timeout". + * In addition the listening pluggable connectorsshould have + * 'supportsMultipleConnections' capability matching the same base + * TransportService capability. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.plugMultiConnect006 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.plugMultiConnect006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006; + +import nsk.jdi.PlugConnectors.MultiConnectors.plugMultiConnect006.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the Connector interfaces
    + * (AttachingConnector, ListeningConnector, or LaunchingConnector).
    + * and the TransportService abstract class.
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 6 expected
    + * pluggable connectors are created properly on base of 6 different
    + * Connector implementations of different types and four expected
    + * pluggable connectors (two AttachingConnectors and two
    + * ListeningConnectors) are created properly on base of two different
    + * TransportService implementations.
    + *
    + * Also the test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked the 3 pluggable connectors
    + * are NOT created for Connector implementations for which instances can
    + * not be created and 2 pluggable connectors (AttachingConnector and
    + * ListeningConnector) are NOT created for TransportService implementation
    + * for which instances can not be created.
    + * These "invalid" Connector implementations are:
    + * PlugAttachConnector006_03 class;
    + * PlugLaunchConnector006_03 class;
    + * PlugListenConnector006_03 class;
    + * and "invalid" TransportService implementations is:
    + * PlugTransportService006_03 class;
    + *
    + * For connectors created on base of Connector implementations the
    + * test expects that 2 pluggable connectors should be
    + * of AttachingConnector type, other 2 connectors -
    + * of ListeningConnector type, and last 2 coonectors -
    + * of LaunchingConnector type
    + *
    + * Each pluggable connector has to be contained in corresponding list:
    + * VirtualMachineManager.attachingConnectors(),
    + * VirtualMachineManager.launchingConnectors() or
    + * VirtualMachineManager.listeningConnectors().
    + *
    + * All 6 pluggable connectors have to be contained in
    + * VirtualMachineManager.allConnectors() list.
    + *
    + * Each pluggable connector is checked for the certain expected
    + * description and for the certain expected transport.
    + *
    + * For each connector type one pluggable connector should have the
    + * empty Map of default arguments, and other pluggable connector
    + * should have 4 default arguments of all types:
    + * Connector.StringArgument;
    + * Connector.IntegerArgument;
    + * Connector.BooleanArgument;
    + * Connector.SelectedArgument;
    + *
    + * For connectors created on base of TransportService implementations
    + * the test expects that the created attaching pluggable connectors have
    + * to be contained in List returned by
    + * VirtualMachineManager.attachingConnectors().
    + * The created listening pluggable connectors have to be contained in List
    + * returned by VirtualMachineManager.listeningConnectors().
    + * And all four connectors have to be contained in List returned
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * The attaching pluggable connectors should have names based on the names
    + * of the corresponding base transport services concatenated with the
    + * string "Attach", i.e.
    + * TransportService.name() + "Attach"
    + * Similarly, the listening pluggable connectors names are formed of names
    + * of transport services with string "Listen":
    + * TransportService.name() + "Listen";
    + *
    + * All pluggable connectors should have the description conterminous with
    + * the description of the corresponding base transport service
    + * (TransportService001.description()).
    + *
    + * All pluggable connectors should have two default arguments named
    + * "address" and "timeout".
    + *
    + * In addition the listening pluggable connectorsshould have
    + * 'supportsMultipleConnections' capability matching the same base
    + * TransportService capability.
    + *
    + */ + +public class plugMultiConnect006 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "plugMultiConnect006: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> plugMultiConnect006: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new plugMultiConnect006().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006 test..."); + logOnVerbose + ("==> Test checks that expected pluggable connectors are created properly"); + logOnVerbose + ("==> on base of 6 different Connector implementations and of 2 different"); + logOnVerbose + ("==> TransportService implementations."); + logOnVerbose + ("==> But other pluggable connectors are NOT created for Connector and "); + logOnVerbose + ("==> TransportService implementations for which instances can not be created.\n"); + int expectedConnectorsNumber = 6; + + String[] checkedPlugConnectorNames = new String[expectedConnectorsNumber]; + checkedPlugConnectorNames[0] = "PlugAttachConnector006_01_Name"; + checkedPlugConnectorNames[1] = "PlugAttachConnector006_02_Name"; + checkedPlugConnectorNames[2] = "PlugLaunchConnector006_01_Name"; + checkedPlugConnectorNames[3] = "PlugLaunchConnector006_02_Name"; + checkedPlugConnectorNames[4] = "PlugListenConnector006_01_Name"; + checkedPlugConnectorNames[5] = "PlugListenConnector006_02_Name"; + + Connector[] referencePlugConnectors = new Connector[expectedConnectorsNumber]; + referencePlugConnectors[0] = new PlugAttachConnector006_01(); + referencePlugConnectors[1] = new PlugAttachConnector006_02(); + referencePlugConnectors[2] = new PlugLaunchConnector006_01(); + referencePlugConnectors[3] = new PlugLaunchConnector006_02(); + referencePlugConnectors[4] = new PlugListenConnector006_01(); + referencePlugConnectors[5] = new PlugListenConnector006_02(); + + int referenceTransportServicesNumber = 2; + + TransportService[] referenceTransportServices + = new TransportService[referenceTransportServicesNumber]; + referenceTransportServices[0] = new PlugTransportService006_01(); + referenceTransportServices[1] = new PlugTransportService006_02(); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + for (int i=0; i < expectedConnectorsNumber; i++ ) { + int checkResult = checkValidConnector(virtualMachineManager, + checkedPlugConnectorNames[i], + referencePlugConnectors[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + for (int i=0; i < referenceTransportServicesNumber; i++ ) { + int checkResult = checkConnectorsForValidTransportService(virtualMachineManager, + referenceTransportServices[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + int invalidConnectorsNumber = 3; + + String[] invalidPlugConnectorClassesNames = new String[invalidConnectorsNumber]; + invalidPlugConnectorClassesNames[0] = "PlugAttachConnector006_03"; + invalidPlugConnectorClassesNames[1] = "PlugLaunchConnector006_03"; + invalidPlugConnectorClassesNames[2] = "PlugListenConnector006_03"; + + int invalidTransportServicesNumber = 1; + + String[] invalidTransportServicesNames + = new String[invalidTransportServicesNumber]; + invalidTransportServicesNames[0] = "PlugTransportService006_03_Name"; + + for (int i=0; i < invalidConnectorsNumber; i++ ) { + int checkResult = checkForInvalidConnector(virtualMachineManager, + invalidPlugConnectorClassesNames[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + for (int i=0; i < invalidTransportServicesNumber; i++ ) { + int checkResult = checkConnectorsForInvalidTransportService(virtualMachineManager, + invalidTransportServicesNames[i]); + if ( testResult == STATUS_PASSED ) { + testResult = checkResult; + } + } + + return testResult; + } + + private int checkValidConnector (VirtualMachineManager virtualMachineManager, + String checkedPlugConnectorName, + Connector referencePlugConnector) { + int checkResult = STATUS_PASSED; + + // check that checked pluggable connector is found out + // in attaching/launching/listeningConnectors() List + List connectorsList = null; + if ( referencePlugConnector instanceof AttachingConnector) { + connectorsList = virtualMachineManager.attachingConnectors(); + } + if ( referencePlugConnector instanceof LaunchingConnector) { + connectorsList = virtualMachineManager.launchingConnectors(); + } + if ( referencePlugConnector instanceof ListeningConnector) { + connectorsList = virtualMachineManager.listeningConnectors(); + } + + int connectorsNumber = connectorsList.size(); + Connector checkedPlugConnector = null; + + for (int i=0; i < connectorsNumber; i++ ) { + Connector connector = (Connector)connectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugConnectorName.equals(connectorName) ) { + if ( checkedPlugConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + connector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnector = connector; + } + } + } + + if ( checkedPlugConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugConnectorName + "'"); + return STATUS_FAILED; + } + + // check that checked pluggable connector is found out in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + boolean checkedPlugConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( checkedPlugConnector.equals(foundConnector) ) { + if ( checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable connector with the same name is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugConnectorFound = true; + } + } + } + + if ( ! checkedPlugConnectorFound ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + checkResult = STATUS_FAILED; + } + + // check that checked pluggable connector matches corresponding reference connector + String errorMessage = PlugConnectors.compareConnectors( + errorLogPrefixHead, + errorLogPrefix, + referencePlugConnector, + checkedPlugConnector); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + return STATUS_FAILED; + } + + // check default Arguments of checked pluggable connector + + Map referenceDefaultArguments = referencePlugConnector.defaultArguments(); + Map checkedDefaultArguments = checkedPlugConnector.defaultArguments(); + + int referenceDefaultArgumentsNumber = referenceDefaultArguments.size(); + int checkedDefaultArgumentsNumber = checkedDefaultArguments.size(); + + if ( referenceDefaultArgumentsNumber != checkedDefaultArgumentsNumber ) { + logOnError(errorLogPrefixHead + + "Checked pluggable connector contains unexpected number of default arguments"); + logOnError(errorLogPrefix + "Checked connector = " + checkedPlugConnector); + logOnError(errorLogPrefix + "Expected number of default arguments = " + + referenceDefaultArgumentsNumber); + logOnError(errorLogPrefix + "Actual number of default arguments = " + + checkedDefaultArgumentsNumber); + return STATUS_FAILED; + } + + Object[] referenceDefaultArgumentsKeys = referenceDefaultArguments.keySet().toArray(); + for (int i=0; i < referenceDefaultArgumentsNumber; i++) { + String referenceKey = (String)referenceDefaultArgumentsKeys[i]; + Connector.Argument referenceArgument = + (Connector.Argument)(referenceDefaultArguments.get(referenceKey)); + Connector.Argument checkedArgument = + (Connector.Argument)(checkedDefaultArguments.get(referenceKey)); + errorMessage = PlugConnectors.compareConnectorArguments( + errorLogPrefixHead, + errorLogPrefix, + referenceArgument, + checkedArgument); + + if ( ! emptyString.equals(errorMessage) ) { + logOnError(errorMessage); + checkResult = STATUS_FAILED; + } + } + + return checkResult; + } + + private int checkConnectorsForValidTransportService + (VirtualMachineManager virtualMachineManager, + TransportService referenceTransportService) { + + int checkResult = STATUS_PASSED; + + String checkedPlugAttachConnectorName = referenceTransportService.name() + "Attach"; + String checkedPlugListenConnectorName = referenceTransportService.name() + "Listen"; + String checkedPlugConnectorsDescription = referenceTransportService.description(); + String addressArgumentName = "address"; + String timeoutArgumentName = "timeout"; + boolean expectedMultipleConnectionsCapability + = referenceTransportService.capabilities().supportsMultipleConnections(); + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + attachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnector = attachingConnector; + } + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name is found out."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + listeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnector = listeningConnector; + } + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + if ( checkedPlugAttachConnector != null ) { + // check that expected pluggable attaching connector is found out in allConnectors() List too + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + if ( checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable attaching connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundAttachingConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugAttachConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = checkedPlugAttachConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT address argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable attaching connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable attaching connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable attaching connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Attaching connector = '" + checkedPlugAttachConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + } + + if ( checkedPlugListenConnector != null ) { + // check that expected pluggable listening connector is found out in allConnectors() List too + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + if ( checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "One more pluggable listening connector with the same name " + + "is found out in allConnectors() List."); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + logOnError(errorLogPrefix + "First Connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Found Connector = '" + foundListeningConnector + "'"); + checkResult = STATUS_FAILED; + } else { + checkedPlugListenConnectorFound = true; + } + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listenhing connector has expected description + String actualDescription = checkedPlugListenConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + checkResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT address argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable listening connector is NOT of Connector.StringArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + checkResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable listening connector is NOT of Connector.IntegerArgument type"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + checkResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has 'supportsMultipleConnections' + // capability matching the same base TransportService capability + boolean actualMultipleConnectionsCapability = checkedPlugListenConnector.supportsMultipleConnections(); + if ( actualMultipleConnectionsCapability != expectedMultipleConnectionsCapability ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has 'supportsMultipleConnections'"); + logOnError(errorLogPrefix + "capability NOT matching the same base TransportService capability:"); + logOnError(errorLogPrefix + "Listening connector = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Expected 'supportsMultipleConnections' capability = " + + expectedMultipleConnectionsCapability); + logOnError(errorLogPrefix + "Actual 'supportsMultipleConnections' capability = " + + actualMultipleConnectionsCapability); + checkResult = STATUS_FAILED; + } + + } + + return checkResult; + } + + private int checkForInvalidConnector (VirtualMachineManager virtualMachineManager, + String invalidPlugConnectorClassName) { + int checkResult = STATUS_PASSED; + + List connectorsList = null; + String connectorsListName = null; + if ( invalidPlugConnectorClassName.equals("PlugAttachConnector006_03") ) { + connectorsList = virtualMachineManager.attachingConnectors(); + connectorsListName = "attachingConnectors() List"; + } + if ( invalidPlugConnectorClassName.equals("PlugLaunchConnector006_03") ) { + connectorsList = virtualMachineManager.launchingConnectors(); + connectorsListName = "launchingConnectors() List"; + } + if ( invalidPlugConnectorClassName.equals("PlugListenConnector006_03") ) { + connectorsList = virtualMachineManager.listeningConnectors(); + connectorsListName = "listeningConnectors() List"; + } + int connectorsNumber = connectorsList.size(); + + // check that pluggable connector is NOT created on base of Connector + // implementation for which instance can not be created + Connector invalidPlugConnector = null; + + for (int i=0; i < connectorsNumber; i++ ) { + Connector foundConnector = (Connector)connectorsList.get(i); + if ( invalidPlugConnectorClassName.equals("PlugAttachConnector006_03") ) { + if ( foundConnector instanceof PlugAttachConnector006_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugLaunchConnector006_03") ) { + if ( foundConnector instanceof PlugLaunchConnector006_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugListenConnector006_03") ) { + if ( foundConnector instanceof PlugListenConnector006_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + } + + if ( invalidPlugConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable connector is created on base of Connector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in " + connectorsListName); + logOnError(errorLogPrefix + "Connector instance = '" + invalidPlugConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + invalidPlugConnector.name() + "'"); + checkResult = STATUS_FAILED; + } + + + // check that invalid pluggable connector is NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + invalidPlugConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( invalidPlugConnectorClassName.equals("PlugAttachConnector006_03") ) { + if ( foundConnector instanceof PlugAttachConnector006_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugLaunchConnector006_03") ) { + if ( foundConnector instanceof PlugLaunchConnector006_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + if ( invalidPlugConnectorClassName.equals("PlugListenConnector006_03") ) { + if ( foundConnector instanceof PlugListenConnector006_03 ) { + invalidPlugConnector = foundConnector; + break; + } + } + } + + if ( invalidPlugConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable connector is created on base of Connector"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() List"); + logOnError(errorLogPrefix + "Connector instance = '" + invalidPlugConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + invalidPlugConnector.name() + "'"); + checkResult = STATUS_FAILED; + } + + return checkResult; + } + + private int checkConnectorsForInvalidTransportService + (VirtualMachineManager virtualMachineManager, + String invalidTransportServiceName) { + + int checkResult = STATUS_PASSED; + + String checkedPlugAttachConnectorName = invalidTransportServiceName + "Attach"; + String checkedPlugListenConnectorName = invalidTransportServiceName + "Listen"; + + // check that pluggable attaching connector is NOT created on base of TransportService + // implementation for which instance can not be created + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in attachingConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that pluggable listening connector is NOT created on base of TransportService + // implementation for which instance can not be created + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in listeningConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + // check that pluggable connectors are NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + Connector attachConnector = null; + Connector listenConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector connector = (Connector)allConnectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugAttachConnectorName.equals(connectorName) ) { + attachConnector = connector; + } + if ( checkedPlugListenConnectorName.equals(connectorName) ) { + listenConnector = connector; + } + } + + if ( attachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + attachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + if ( listenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + listenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + checkResult = STATUS_FAILED; + } + + return checkResult; + } + +} // end of plugMultiConnect006 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..d655e28e692 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/TransportService/transportService001 test +nsk.jdi.PlugConnectors.TransportService.transportService001.connectors.PlugTransportService001 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/connectors/PlugTransportService001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/connectors/PlugTransportService001.java new file mode 100644 index 00000000000..096dc37b363 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/connectors/PlugTransportService001.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/TransportService/transportService001 test + */ + +package nsk.jdi.PlugConnectors.TransportService.transportService001.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService001 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService001_Name"; + static String plugTransportServiceDescription = "PlugTransportService001_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService001() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/transportService001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/transportService001.java new file mode 100644 index 00000000000..e1d197a5841 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/transportService001.java @@ -0,0 +1,396 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/TransportService/transportService001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/TransportService/transportService001 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the TransportService abstract + * class (com.sun.jdi.connect.spi.TransportService). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked two pluggable + * connectors (AttachingConnector and ListeningConnector) are created + * on base of PlugTransportService001 class which extends + * com.sun.jdi.connect.spi.TransportService abstract class + * Base PlugTransportService001 has: + * TransportService.name() = "PlugTransportService001_Name" + * TransportService.description() = "PlugTransportService001_Description" + * TransportService.capabilities().supportsAcceptTimeout = true + * TransportService.capabilities().supportsAttachTimeout = true + * TransportService.capabilities().supportsHandshakeTimeout = true + * TransportService.capabilities().supportsMultipleConnections = true + * The created attaching pluggable connector has to be contained in list + * returned by VirtualMachineManager.attachingConnectors(). + * The created listening pluggable connector has to be contained in list + * returned by VirtualMachineManager.listeningConnectors(). + * And both connectors have to be contained in list returned + * by VirtualMachineManager.allConnectors() methods. + * The attaching pluggable connector has to have name + * PlugTransportService001.name() + "Attach"; + * The listening pluggable connector has to have name + * PlugTransportService001.name() + "Listen"; + * Both pluggable connectors have to have description + * PlugTransportService001.description(); + * Both pluggable connectors have to have two default arguments named + * "address" and "timeout". + * In addition the listening pluggable connector has to have + * 'supportsMultipleConnections' capability matching the same base + * PlugTransportService001 capability, i.e. = true. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.TransportService.transportService001.transportService001 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.TransportService.transportService001.transportService001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.TransportService.transportService001; + +import nsk.jdi.PlugConnectors.TransportService.transportService001.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the TransportService abstract
    + * class (com.sun.jdi.connect.spi.TransportService).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked two pluggable
    + * connectors (AttachingConnector and ListeningConnector) are created
    + * on base of PlugTransportService001 class which extends
    + * com.sun.jdi.connect.spi.TransportService abstract class
    + *
    + * Base PlugTransportService001 has:
    + * TransportService.name() = "PlugTransportService001_Name"
    + * TransportService.description() = "PlugTransportService001_Description"
    + * TransportService.capabilities().supportsAcceptTimeout = true
    + * TransportService.capabilities().supportsAttachTimeout = true
    + * TransportService.capabilities().supportsHandshakeTimeout = true
    + * TransportService.capabilities().supportsMultipleConnections = true
    + *
    + * The created attaching pluggable connector has to be contained in list
    + * returned by VirtualMachineManager.attachingConnectors().
    + * The created listening pluggable connector has to be contained in list
    + * returned by VirtualMachineManager.listeningConnectors().
    + * And both connectors have to be contained in list returned
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * The attaching pluggable connector has to have name
    + * PlugTransportService001.name() + "Attach";
    + * The listening pluggable connector has to have name
    + * PlugTransportService001.name() + "Listen";
    + * Both pluggable connectors have to have description
    + * PlugTransportService001.description();
    + * Both pluggable connectors have to have two default arguments named
    + * "address" and "timeout".
    + * In addition the listening pluggable connector has to have
    + * 'supportsMultipleConnections' capability matching the same base
    + * PlugTransportService001 capability, i.e. = true.
    + *
    + */ + +public class transportService001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "transportService001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> transportService001: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new transportService001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/TransportService/transportService001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/TransportService/transportService001 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/TransportService/transportService001 test..."); + logOnVerbose + ("==> Test checks that expected pluggable attaching and listening connectors are created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + TransportService referenceTransportService = new PlugTransportService001(); + String checkedPlugAttachConnectorName = referenceTransportService.name() + "Attach"; + String checkedPlugListenConnectorName = referenceTransportService.name() + "Listen"; + String checkedPlugConnectorsDescription = referenceTransportService.description(); + String addressArgumentName = "address"; + String timeoutArgumentName = "timeout"; + boolean expectedMultipleConnectionsCapability + = referenceTransportService.capabilities().supportsMultipleConnections(); + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + testResult = STATUS_FAILED; + } + + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + if ( checkedPlugAttachConnector != null ) { + // check that expected pluggable attaching connector is found out in allConnectors() List too + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + checkedPlugAttachConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = checkedPlugAttachConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT address argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable attaching connector is NOT of Connector.StringArgument type"); + testResult = STATUS_FAILED; + } + } + + // check that expected pluggable attaching connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable attaching connector is NOT of Connector.IntegerArgument type"); + testResult = STATUS_FAILED; + } + } + + } + + if ( checkedPlugListenConnector != null ) { + // check that expected pluggable listening connector is found out in allConnectors() List too + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + checkedPlugListenConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listenhing connector has expected description + String actualDescription = checkedPlugListenConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT address argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable listening connector is NOT of Connector.StringArgument type"); + testResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable listening connector is NOT of Connector.IntegerArgument type"); + testResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has 'supportsMultipleConnections' + // capability matching the same base TransportService capability, i.e. = true + boolean actualMultipleConnectionsCapability = checkedPlugListenConnector.supportsMultipleConnections(); + if ( actualMultipleConnectionsCapability != expectedMultipleConnectionsCapability ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has 'supportsMultipleConnections'"); + logOnError(errorLogPrefix + "capability NOT matching the same base TransportService capability:"); + logOnError(errorLogPrefix + "Expected 'supportsMultipleConnections' capability = " + + expectedMultipleConnectionsCapability); + logOnError(errorLogPrefix + "Actual 'supportsMultipleConnections' capability = " + + actualMultipleConnectionsCapability); + testResult = STATUS_FAILED; + } + + } + return testResult; + } +} // end of transportService001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..2bb0ccf5673 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/TransportService/transportService002 test +nsk.jdi.PlugConnectors.TransportService.transportService002.connectors.PlugTransportService002 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/connectors/PlugTransportService002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/connectors/PlugTransportService002.java new file mode 100644 index 00000000000..9fabc481234 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/connectors/PlugTransportService002.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/TransportService/transportService002 test + */ + +package nsk.jdi.PlugConnectors.TransportService.transportService002.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService002 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService002_Name"; + static String plugTransportServiceDescription = "PlugTransportService002_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + false, // supportsAcceptTimeout + false, // supportsAttachTimeout + false, // supportsHandshakeTimeout + false // supportsMultipleConnections + ); + + public PlugTransportService002() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + } + +} // end of PlugTransportService002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/transportService002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/transportService002.java new file mode 100644 index 00000000000..2f0d06baa29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/transportService002.java @@ -0,0 +1,396 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/TransportService/transportService002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/TransportService/transportService002 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the TransportService abstract + * class (com.sun.jdi.connect.spi.TransportService). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked two pluggable + * connectors (AttachingConnector and ListeningConnector) are created + * on base of PlugTransportService002 class which extends + * com.sun.jdi.connect.spi.TransportService abstract class + * Base PlugTransportService002 has: + * TransportService.name() = "PlugTransportService002_Name" + * TransportService.description() = "PlugTransportService002_Description" + * TransportService.capabilities().supportsAcceptTimeout = false + * TransportService.capabilities().supportsAttachTimeout = false + * TransportService.capabilities().supportsHandshakeTimeout = false + * TransportService.capabilities().supportsMultipleConnections = false + * The created attaching pluggable connector has to be contained in list + * returned by VirtualMachineManager.attachingConnectors(). + * The created listening pluggable connector has to be contained in list + * returned by VirtualMachineManager.listeningConnectors(). + * And both connectors have to be contained in list returned + * by VirtualMachineManager.allConnectors() methods. + * The attaching pluggable connector has to have name + * PlugTransportService002.name() + "Attach"; + * The listening pluggable connector has to have name + * PlugTransportService002.name() + "Listen"; + * Both pluggable connectors have to have description + * PlugTransportService002.description(); + * Both pluggable connectors have to have two default arguments named + * "address" and "timeout". + * In addition the listening pluggable connector has to have + * 'supportsMultipleConnections' capability matching the same base + * PlugTransportService002 capability, i.e. = false. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.TransportService.transportService002.transportService002 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugConnectors + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.TransportService.transportService002.transportService002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.TransportService.transportService002; + +import nsk.jdi.PlugConnectors.TransportService.transportService002.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the TransportService abstract
    + * class (com.sun.jdi.connect.spi.TransportService).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked two pluggable
    + * connectors (AttachingConnector and ListeningConnector) are created
    + * on base of PlugTransportService002 class which extends
    + * com.sun.jdi.connect.spi.TransportService abstract class
    + *
    + * Base PlugTransportService002 has:
    + * TransportService.name() = "PlugTransportService002_Name"
    + * TransportService.description() = "PlugTransportService002_Description"
    + * TransportService.capabilities().supportsAcceptTimeout = false
    + * TransportService.capabilities().supportsAttachTimeout = false
    + * TransportService.capabilities().supportsHandshakeTimeout = false
    + * TransportService.capabilities().supportsMultipleConnections = false
    + *
    + * The created attaching pluggable connector has to be contained in list
    + * returned by VirtualMachineManager.attachingConnectors().
    + * The created listening pluggable connector has to be contained in list
    + * returned by VirtualMachineManager.listeningConnectors().
    + * And both connectors have to be contained in list returned
    + * by VirtualMachineManager.allConnectors() methods.
    + *
    + * The attaching pluggable connector has to have name
    + * PlugTransportService002.name() + "Attach";
    + * The listening pluggable connector has to have name
    + * PlugTransportService002.name() + "Listen";
    + * Both pluggable connectors have to have description
    + * PlugTransportService002.description();
    + * Both pluggable connectors have to have two default arguments named
    + * "address" and "timeout".
    + * In addition the listening pluggable connector has to have
    + * 'supportsMultipleConnections' capability matching the same base
    + * PlugTransportService002 capability, i.e. = false.
    + *
    + */ + +public class transportService002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "transportService002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> transportService002: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new transportService002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/TransportService/transportService002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/TransportService/transportService002 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/TransportService/transportService002 test..."); + logOnVerbose + ("==> Test checks that expected pluggable attaching and listening connectors are created properly."); + + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + TransportService referenceTransportService = new PlugTransportService002(); + String checkedPlugAttachConnectorName = referenceTransportService.name() + "Attach"; + String checkedPlugListenConnectorName = referenceTransportService.name() + "Listen"; + String checkedPlugConnectorsDescription = referenceTransportService.description(); + String addressArgumentName = "address"; + String timeoutArgumentName = "timeout"; + boolean expectedMultipleConnectionsCapability + = referenceTransportService.capabilities().supportsMultipleConnections(); + + // check that expected pluggable attaching connector is found out in attachingConnectors() List + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable attaching connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugAttachConnectorName + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector is found out in listeningConnectors() List + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector == null ) { + logOnError(errorLogPrefixHead + "Expected pluggable listening connector is NOT found out."); + logOnError(errorLogPrefix + "Expected connector name = '" + checkedPlugListenConnectorName + "'"); + testResult = STATUS_FAILED; + } + + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + if ( checkedPlugAttachConnector != null ) { + // check that expected pluggable attaching connector is found out in allConnectors() List too + boolean checkedPlugAttachConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof AttachingConnector ) { + AttachingConnector foundAttachingConnector = (AttachingConnector)foundConnector; + if ( checkedPlugAttachConnector.equals(foundAttachingConnector) ) { + checkedPlugAttachConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugAttachConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable attaching connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugAttachConnector); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has expected description + String actualDescription = checkedPlugAttachConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable attaching connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT address argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable attaching connector is NOT of Connector.StringArgument type"); + testResult = STATUS_FAILED; + } + } + + // check that expected pluggable attaching connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugAttachConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable attaching connector is NOT of Connector.IntegerArgument type"); + testResult = STATUS_FAILED; + } + } + + } + + if ( checkedPlugListenConnector != null ) { + // check that expected pluggable listening connector is found out in allConnectors() List too + boolean checkedPlugListenConnectorFound = false; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector foundConnector = (Connector)allConnectorsList.get(i); + if ( foundConnector instanceof ListeningConnector ) { + ListeningConnector foundListeningConnector = (ListeningConnector)foundConnector; + if ( checkedPlugListenConnector.equals(foundListeningConnector) ) { + checkedPlugListenConnectorFound = true; + break; + } + } + } + + if ( ! checkedPlugListenConnectorFound ) { + logOnError(errorLogPrefixHead + + "Expected pluggable listening connector is NOT found out in allConnectors() List"); + logOnError(errorLogPrefix + "Expected connector = " + checkedPlugListenConnector); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listenhing connector has expected description + String actualDescription = checkedPlugListenConnector.description(); + if ( ! checkedPlugConnectorsDescription.equals(actualDescription) ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has unexpected descripton:"); + logOnError(errorLogPrefix + "Expected descripton = '" + checkedPlugConnectorsDescription + "'"); + logOnError(errorLogPrefix + "Actual descripton = '" + actualDescription + "'"); + testResult = STATUS_FAILED; + } + + // check that expected pluggable listening connector has default argument 'address' + // and this argument is of Connector.StringArgument type + Connector.Argument addressArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, addressArgumentName); + if ( addressArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT address argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + addressArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (addressArgument instanceof Connector.StringArgument) ) { + logOnError(errorLogPrefixHead + + "Address argument of Pluggable listening connector is NOT of Connector.StringArgument type"); + testResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has default argument 'timeout' + // and this argument is of Connector.IntegerArgument type + Connector.Argument timeoutArgument = PlugConnectors.getConnectorDefaultArgument + (checkedPlugListenConnector, timeoutArgumentName); + if ( timeoutArgument == null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has NOT timeout argument:"); + logOnError(errorLogPrefix + "Expected argument name = '" + timeoutArgumentName + "'"); + testResult = STATUS_FAILED; + } else { + if ( ! (timeoutArgument instanceof Connector.IntegerArgument) ) { + logOnError(errorLogPrefixHead + + "Timeout argument of Pluggable listening connector is NOT of Connector.IntegerArgument type"); + testResult = STATUS_FAILED; + } + } + + // check that expected pluggable listening connector has 'supportsMultipleConnections' + // capability matching the same base TransportService capability, i.e. = false + boolean actualMultipleConnectionsCapability = checkedPlugListenConnector.supportsMultipleConnections(); + if ( actualMultipleConnectionsCapability != expectedMultipleConnectionsCapability ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector has 'supportsMultipleConnections'"); + logOnError(errorLogPrefix + "capability NOT matching the same base TransportService capability:"); + logOnError(errorLogPrefix + "Expected 'supportsMultipleConnections' capability = " + + expectedMultipleConnectionsCapability); + logOnError(errorLogPrefix + "Actual 'supportsMultipleConnections' capability = " + + actualMultipleConnectionsCapability); + testResult = STATUS_FAILED; + } + + } + return testResult; + } +} // end of transportService002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService new file mode 100644 index 00000000000..0a8a3c11694 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/connectors/META-INF/services/com.sun.jdi.connect.spi.TransportService @@ -0,0 +1,23 @@ +# Copyright (c) 2007, 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. + +# -- used by nsk/jdi/PlugConnectors/TransportService/transportService003 test +nsk.jdi.PlugConnectors.TransportService.transportService003.connectors.PlugTransportService003 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/connectors/PlugTransportService003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/connectors/PlugTransportService003.java new file mode 100644 index 00000000000..af614827e33 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/connectors/PlugTransportService003.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 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. + */ + +/* + * A Simple TransportService used by + * nsk/jdi/PlugConnectors/TransportService/transportService003 test + */ + +package nsk.jdi.PlugConnectors.TransportService.transportService003.connectors; + +import nsk.share.jdi.*; +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; + +public class PlugTransportService003 extends PlugTransportService { + + static String plugTransportServiceName = "PlugTransportService003_Name"; + static String plugTransportServiceDescription = "PlugTransportService003_Description"; + static TransportService.Capabilities plugTransportServiceCapabilities = + new TestCapabilities( + true, // supportsAcceptTimeout + true, // supportsAttachTimeout + true, // supportsHandshakeTimeout + true // supportsMultipleConnections + ); + + public PlugTransportService003() { + + super( + plugTransportServiceName, + plugTransportServiceDescription, + plugTransportServiceCapabilities + ); + + String exceptionMessage = + "<## PlugTransportService003: This RuntimeException is thrown intentionally by TransportService " + + "constructor to check creating of pluggable connectors on base of such TransportService. ##>"; + + throw new RuntimeException(exceptionMessage); + + } + +} // end of PlugTransportService003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/transportService003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/transportService003.java new file mode 100644 index 00000000000..18efd2f49a5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/transportService003.java @@ -0,0 +1,254 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/PlugConnectors/TransportService/transportService003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/PlugConnectors/TransportService/transportService003 test: + * The test for the mechanism for creating pluggable Connectors + * on base of classes which implement the TransportService abstract + * class (com.sun.jdi.connect.spi.TransportService). + * The test checks up that at start-up time when + * Bootstrap.virtualMachineManager() is invoked pluggable + * connectors (AttachingConnector and ListeningConnector) are NOT created + * on base of PlugTransportService003 class which extends + * com.sun.jdi.connect.spi.TransportService abstract class + * but constructor of PlugTransportService003 throws Exception. + * COMMENTS: + * Fixed bug 6426609: nsk/share/jdi/plug_connectors_jar_file.pl should use + * "system" instead of back-quotes + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.PlugConnectors.TransportService.transportService003.transportService003 + * + * @comment build connectors.jar to jars + * @build nsk.share.jdi.PlugTransportService + * @run driver nsk.jdi.ConnectorsJarBuilder + * + * @build ExecDriver + * @run driver PropertyResolvingWrapper ExecDriver --java + * -cp jars${file.separator}connectors.jar${path.separator}${test.class.path} + * nsk.jdi.PlugConnectors.TransportService.transportService003.transportService003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + */ + +package nsk.jdi.PlugConnectors.TransportService.transportService003; + +import nsk.jdi.PlugConnectors.TransportService.transportService003.connectors.*; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the mechanism for creating pluggable Connectors
    + * on base of classes which implement the TransportService abstract
    + * class (com.sun.jdi.connect.spi.TransportService).
    + *
    + * The test checks up that at start-up time when
    + * Bootstrap.virtualMachineManager() is invoked pluggable
    + * connectors (AttachingConnector and ListeningConnector) are NOT created
    + * on base of PlugTransportService003 class which extends
    + * com.sun.jdi.connect.spi.TransportService abstract class
    + * but constructor of PlugTransportService003 throws Exception.
    + *
    + */ + +public class transportService003 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "transportService003: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixNead = "--> transportService003: "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new transportService003().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/PlugConnectors/TransportService/transportService003 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/PlugConnectors/TransportService/transportService003 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/PlugConnectors/TransportService/transportService003 test..."); + logOnVerbose + ("==> Test checks that pluggable attaching and listening connectors are NOT created"); + logOnVerbose + (" for TransportService implementation for which instance can not be created."); + + VirtualMachineManager virtualMachineManager = null; + try { + virtualMachineManager = Bootstrap.virtualMachineManager(); + } catch (Throwable thrown) { + // OK: Bootstrap.virtualMachineManager() may throw an unspecified error + // if initialization of the VirtualMachineManager fails or if the virtual + // machine manager is unable to locate or create any Connectors. + logOnVerbose + (infoLogPrefixNead + "Bootstrap.virtualMachineManager() throws:\n" + thrown); + return STATUS_PASSED; + } + + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + String checkedPlugAttachConnectorName = "PlugTransportService003_Name" + "Attach"; + String checkedPlugListenConnectorName = "PlugTransportService003_Name" + "Listen"; + + // check that pluggable attaching connector is NOT created on base of TransportService + // implementation (PlugTransportService003 class) for which instance can not be created + List attachingConnectorsList = virtualMachineManager.attachingConnectors(); + int attachingConnectorsNumber = attachingConnectorsList.size(); + AttachingConnector checkedPlugAttachConnector = null; + + for (int i=0; i < attachingConnectorsNumber; i++ ) { + AttachingConnector attachingConnector = (AttachingConnector)attachingConnectorsList.get(i); + String attachConnectorName = attachingConnector.name(); + if ( checkedPlugAttachConnectorName.equals(attachConnectorName) ) { + checkedPlugAttachConnector = attachingConnector; + break; + } + } + + if ( checkedPlugAttachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in attachingConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugAttachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + testResult = STATUS_FAILED; + } + + // check that pluggable listening connector is NOT created on base of TransportService + // implementation (PlugTransportService003 class) for which instance can not be created + List listeningConnectorsList = virtualMachineManager.listeningConnectors(); + int listeningConnectorsNumber = listeningConnectorsList.size(); + ListeningConnector checkedPlugListenConnector = null; + + for (int i=0; i < listeningConnectorsNumber; i++ ) { + ListeningConnector listeningConnector = (ListeningConnector)listeningConnectorsList.get(i); + String listenConnectorName = listeningConnector.name(); + if ( checkedPlugListenConnectorName.equals(listenConnectorName) ) { + checkedPlugListenConnector = listeningConnector; + break; + } + } + + if ( checkedPlugListenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in listeningConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + checkedPlugListenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + testResult = STATUS_FAILED; + } + + // check that pluggable connectors are NOT contained in allConnectors() List too + List allConnectorsList = virtualMachineManager.allConnectors(); + int allConnectorsNumber = allConnectorsList.size(); + + Connector attachConnector = null; + Connector listenConnector = null; + for (int i=0; i < allConnectorsNumber; i++ ) { + Connector connector = (Connector)allConnectorsList.get(i); + String connectorName = connector.name(); + if ( checkedPlugAttachConnectorName.equals(connectorName) ) { + attachConnector = connector; + } + if ( checkedPlugListenConnectorName.equals(connectorName) ) { + listenConnector = connector; + } + } + + if ( attachConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable attaching connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + attachConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugAttachConnectorName + "'"); + testResult = STATUS_FAILED; + } + + if ( listenConnector != null ) { + logOnError(errorLogPrefixHead + "Pluggable listening connector is created for TransportService"); + logOnError(errorLogPrefix + "implementation for which instance can not be created."); + logOnError(errorLogPrefix + "This connector is found out in allConnectors() list"); + logOnError(errorLogPrefix + "Connector instance = '" + listenConnector + "'"); + logOnError(errorLogPrefix + "Connector name = '" + checkedPlugListenConnectorName + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of transportService003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001.java new file mode 100644 index 00000000000..6954b2d390e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001.java @@ -0,0 +1,452 @@ +/* + * 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.PrimitiveType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * PrimitiveType.
    + *
    + * The test checks up that for each PrimitiveType value the cast
    + * from Type to PrimitiveType doesn't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares objects of all PrimitiveTypes and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class primitivetype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveType/_itself_/primitivetype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new primitivetype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveType._itself_.primitivetype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String types[] = { "BooleanType", "ByteType", "CharType", "DoubleType", + "FloatType", "IntegerType", "LongType", "ShortType" }; + + String names[] = { "bl", "bt", "ch", "db", "fl", "in", "ln", "sh" }; + + for (int i2 = 0; i2 < names.length; i2++) { + + log2("......PrimitiveType to test: " + types[i2]); + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(names[i2])).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(names[i2])).type(); + + try { + log2(" checking up on cast: PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001/TestDescription.java new file mode 100644 index 00000000000..813907006d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/PrimitiveType/_itself_/primitivetype001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveType. + * The test checks up that for each PrimitiveType value the cast + * from Type to PrimitiveType doesn't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.PrimitiveType._itself_.primitivetype001; + * the debuggee program - nsk.jdi.PrimitiveType._itself_.primitivetype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.PrimitiveType._itself_.primitivetype001 + * nsk.jdi.PrimitiveType._itself_.primitivetype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveType._itself_.primitivetype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001a.java new file mode 100644 index 00000000000..44977d44984 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveType/_itself_/primitivetype001a.java @@ -0,0 +1,120 @@ +/* + * 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.PrimitiveType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the primitivetype001 JDI test. + */ + +public class primitivetype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static boolean bl = false; + static byte bt = 0; + static char ch = 0; + static double db = 0.0d; + static float fl = 0.0f; + static int in = 0; + static long ln = 0; + static short sh = 0; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001.java new file mode 100644 index 00000000000..62131e5b1f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001.java @@ -0,0 +1,340 @@ +/* + * 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.PrimitiveValue.booleanValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.booleanValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.booleanValue(), !pvbl0.booleanValue(),
    + * pvbt1.booleanValue(), !pvbt0.booleanValue(),
    + * pvch1.booleanValue(), !pvch0.booleanValue(),
    + * pvdb1.booleanValue(), !pvdb0.booleanValue(),
    + * pvfl1.booleanValue(), !pvfl0.booleanValue(),
    + * pvin1.booleanValue(), !pvin0.booleanValue(),
    + * pvln1.booleanValue(), !pvln0.booleanValue(),
    + * pvsh1.booleanValue(), !pvsh0.booleanValue()
    + *
    + */ + +public class booleanvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new booleanvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.booleanValue.booleanvalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("booleanvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("...... checks for: pvbl1.booleanValue() and pvbl0.booleanValue()"); + if (!pvbl1.booleanValue() || pvbl0.booleanValue()) { + log3("ERROR: !pvbl1.booleanValue() || pvbl0.booleanValue()"); + expresult = 1; + } + break; + + case 1: + log2("...... checks for: pvbt1.booleanValue() and pvbt0.booleanValue()"); + if (!pvbt1.booleanValue() || pvbt0.booleanValue()) { + log3("ERROR: !pvbt1.booleanValue() || pvbt0.booleanValue()"); + expresult = 1; + } + break; + + case 2: + log2("...... checks for: pvch1.booleanValue() and pvch0.booleanValue()"); + if (!pvch1.booleanValue() || pvch0.booleanValue()) { + log3("ERROR: !pvch1.booleanValue() || pvch0.booleanValue()"); + expresult = 1; + } + break; + + case 3: + log2("...... checks for: pvdb1.booleanValue() and pvdb0.booleanValue()"); + if (!pvdb1.booleanValue() || pvdb0.booleanValue()) { + log3("ERROR: !pvdb1.booleanValue() || pvdb0.booleanValue()"); + expresult = 1; + } + break; + + case 4: + log2("...... checks for: pvfl1.booleanValue() and pvfl0.booleanValue()"); + if (!pvfl1.booleanValue() || pvfl0.booleanValue()) { + log3("ERROR: !pvfl1.booleanValue() || pvfl0.booleanValue()"); + expresult = 1; + } + break; + + case 5: + log2("...... checks for: pvin1.booleanValue() and pvin0.booleanValue()"); + if (!pvin1.booleanValue() || pvin0.booleanValue()) { + log3("ERROR: !pvin1.booleanValue() || pvin0.booleanValue()"); + expresult = 1; + } + break; + + case 6: + log2("...... checks for: pvln1.booleanValue() and pvln0.booleanValue()"); + if (!pvln1.booleanValue() || pvln0.booleanValue()) { + log3("ERROR: !pvln1.booleanValue() || pvln0.booleanValue()"); + expresult = 1; + } + break; + + case 7: + log2("...... checks for: pvsh1.booleanValue() and pvsh0.booleanValue()"); + if (!pvsh1.booleanValue() || pvsh0.booleanValue()) { + log3("ERROR: !pvsh1.booleanValue() || pvsh0.booleanValue()"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001/TestDescription.java new file mode 100644 index 00000000000..a126046dac8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/PrimitiveValue/booleanValue/booleanvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.booleanValue() + * complies with its spec: + * public boolean booleanValue() + * Converts this value to a BooleanValue and returns the result as a boolean. + * Returns: true if this value is non-zero (or true if already a BooleanValue); + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.booleanValue.booleanvalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.booleanValue.booleanvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.booleanValue.booleanvalue001 + * nsk.jdi.PrimitiveValue.booleanValue.booleanvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.booleanValue.booleanvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001a.java new file mode 100644 index 00000000000..9bc0e6413d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/booleanValue/booleanvalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.booleanValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the booleanvalue001 JDI test. + */ + +public class booleanvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> booleanvalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> booleanvalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.byteValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.byteValue() == 1
    + * pvbl0.byteValue() == 0
    + * pvbt1.byteValue() == Byte.MAX_VALUE
    + * pvbt0.byteValue() == 0
    + * pvch1.byteValue() == (byte) Character.MAX_VALUE
    + * pvch0.byteValue() == 0
    + *
    + *
    + * pvfl1.byteValue() == (byte) Float.MAX_VALUE
    + * pvfl0.byteValue() == 0
    + * pvin1.byteValue() == (byte) Integer.MAX_VALUE
    + * pvin0.byteValue() == 0
    + * pvln1.byteValue() == (byte) Long.MAX_VALUE
    + * pvln0.byteValue() == 0
    + * pvsh1.byteValue() == (byte) Short.MAX_VALUE
    + * pvsh0.byteValue() == 0
    + *
    + */ + +public class bytevalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/byteValue/bytevalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new bytevalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.byteValue.bytevalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("bytevalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......checks for: pvbl1.byteValue() == 1 && pvbl0.byteValue() == 0"); + if (pvbl1.byteValue() != 1 || pvbl0.byteValue() != 0) { + log3("ERROR: pvbl1.byteValue() != 1 || pvbl0.byteValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......checks for: pvbt1.byteValue() == Byte.MAX_VALUE && pvbt0.byteValue() == 0"); + if (pvbt1.byteValue() != Byte.MAX_VALUE || pvbt0.byteValue() != 0) { + log3("ERROR: pvbt1.byteValue() != Byte.MAX_VALUE || pvbt0.byteValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......checks for: pvch1.byteValue() == (byte) Character.MAX_VALUE && pvch0.byteValue() == 0"); + if (pvch1.byteValue() != (byte) Character.MAX_VALUE || pvch0.byteValue() != 0) { + log3("ERROR: pvch1.byteValue() != (byte) Character.MAX_VALUE || pvch0.byteValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......checks for: no checks"); + break; + + case 4: + log2("......checks for: pvfl1.byteValue() == (byte) Float.MAX_VALUE && pvfl0.byteValue() ==0"); + if (pvfl1.byteValue() != (byte) Float.MAX_VALUE || pvfl0.byteValue() !=0 ) { + log3("ERROR: pvfl1.byteValue() != (byte) Float.MAX_VALUE || pvfl0.byteValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......checks for: pvin1.byteValue() == (byte) Integer.MAX_VALUE && pvin0.byteValue() == 0"); + if (pvin1.byteValue() != (byte) Integer.MAX_VALUE || pvin0.byteValue() != 0) { + log3("ERROR: pvin1.byteValue() != (byte) Integer.MAX_VALUE || pvin0.byteValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......checks for: pvln1.byteValue() == (byte) Long.MAX_VALUE && pvln0.byteValue() == 0"); + if (pvln1.byteValue() != (byte) Long.MAX_VALUE || pvln0.byteValue() != 0) { + log3("ERROR: pvln1.byteValue() != (byte) Long.MAX_VALUE || pvln0.byteValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......checks for: pvsh1.byteValue() == (byte) Short.MAX_VALUE && pvsh0.byteValue() == 0"); + if (pvsh1.byteValue() != (byte) Short.MAX_VALUE || pvsh0.byteValue() != 0) { + log3("ERROR: pvsh1.byteValue() != (byte) Short.MAX_VALUE || pvsh0.byteValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/byteValue/bytevalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/byteValue/bytevalue001/TestDescription.java new file mode 100644 index 00000000000..5bab73bcaf7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/byteValue/bytevalue001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/PrimitiveValue/byteValue/bytevalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.byteValue() + * complies with its spec: + * public byte byteValue() + * Converts this value to a ByteValue and returns the result as a byte. + * The value will be narrowed as necessary, and magnitude or + * precision information may be lost + * (as if the primitive had been cast to a byte). + * Returns: the value, converted to byte + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.byteValue.bytevalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.byteValue.bytevalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.byteValue.bytevalue001 + * nsk.jdi.PrimitiveValue.byteValue.bytevalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.byteValue.bytevalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/byteValue/bytevalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/byteValue/bytevalue001a.java new file mode 100644 index 00000000000..4743fca06d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/byteValue/bytevalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.byteValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the bytevalue001 JDI test. + */ + +public class bytevalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> bytevalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> bytevalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.charValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.charValue() == 1
    + * pvbl0.charValue() == 0
    + * pvbt1.charValue() == (char) Byte.MAX_VALUE
    + * pvbt0.charValue() == 0
    + * pvch1.charValue() == Character.MAX_VALUE
    + * pvch0.charValue() == 0
    + *
    + *
    + * pvfl1.charValue() == (char) Float.MAX_VALUE
    + * pvfl0.charValue() == 0
    + * pvin1.charValue() == (char) Integer.MAX_VALUE
    + * pvin0.charValue() == 0
    + * pvln1.charValue() == (char) Long.MAX_VALUE
    + * pvln0.charValue() == 0
    + * pvsh1.charValue() == (char) Short.MAX_VALUE
    + * pvsh0.charValue() == 0
    + *
    + */ + +public class charvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/charValue/charvalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new charvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.charValue.charvalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("charvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......checks for: pvbl1.charValue() == 1 and pvbl0.charValue() != 0"); + if (pvbl1.charValue() != 1 || pvbl0.charValue() != 0) { + log3("ERROR: pvbl1.charValue() != 1 || pvbl0.charValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......checks for: pvbt1.charValue() != (char) Byte.MAX_VALUE and pvbt0.charValue() != 0"); + if (pvbt1.charValue() != (char) Byte.MAX_VALUE || pvbt0.charValue() != 0) { + log3("ERROR: pvbt1.charValue() != (char) Byte.MAX_VALUE || pvbt0.charValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......checks for: pvch1.charValue() != Character.MAX_VALUE and pvch0.charValue() != 0"); + if (pvch1.charValue() != Character.MAX_VALUE || pvch0.charValue() != 0) { + log3("ERROR: pvch1.charValue() != Character.MAX_VALUE || pvch0.charValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......checks for: no checks"); + break; + + case 4: + log2("......checks for: pvfl1.charValue() != (char) Float.MAX_VALUE and pvfl0.charValue() !=0"); + if (pvfl1.charValue() != (char) Float.MAX_VALUE || pvfl0.charValue() !=0 ) { + log3("ERROR: pvfl1.charValue() != (char) Float.MAX_VALUE || pvfl0.charValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......checks for: pvin1.charValue() != (char) Integer.MAX_VALUE and pvin0.charValue() != 0"); + if (pvin1.charValue() != (char) Integer.MAX_VALUE || pvin0.charValue() != 0) { + log3("ERROR: pvin1.charValue() != (char) Integer.MAX_VALUE || pvin0.charValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......checks for: pvln1.charValue() != (char) Long.MAX_VALUE and pvln0.charValue() != 0"); + if (pvln1.charValue() != (char) Long.MAX_VALUE || pvln0.charValue() != 0) { + log3("ERROR: pvln1.charValue() != (char) Long.MAX_VALUE || pvln0.charValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......checks for: pvsh1.charValue() != (char) Short.MAX_VALUE and pvsh0.charValue() != 0"); + if (pvsh1.charValue() != (char) Short.MAX_VALUE || pvsh0.charValue() != 0) { + log3("ERROR: pvsh1.charValue() != (char) Short.MAX_VALUE || pvsh0.charValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/charValue/charvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/charValue/charvalue001/TestDescription.java new file mode 100644 index 00000000000..ad5c01a3acf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/charValue/charvalue001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/PrimitiveValue/charValue/charvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.charValue() + * complies with its spec: + * public char charValue() + * Converts this value to a CharValue and returns the result as a char. + * The value will be narrowed or widened as necessary, and + * magnitude or precision information may be lost + * (as if the primitive had been cast to a char, in the narrowing case). + * Returns: the value, converted to char + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.charValue.charvalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.charValue.charvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.charValue.charvalue001 + * nsk.jdi.PrimitiveValue.charValue.charvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.charValue.charvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/charValue/charvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/charValue/charvalue001a.java new file mode 100644 index 00000000000..35814431b03 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/charValue/charvalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.charValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the charvalue001 JDI test. + */ + +public class charvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> charvalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> charvalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.doubleValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.doubleValue() == 1
    + * pvbl0.doubleValue() == 0
    + * pvbt1.doubleValue() == (double) Byte.MAX_VALUE
    + * pvbt0.doubleValue() == 0
    + * pvch1.doubleValue() == (double) Character.MAX_VALUE
    + * pvch0.doubleValue() == 0
    + *
    + *
    + * pvfl1.doubleValue() == (double) Float.MAX_VALUE
    + * pvfl0.doubleValue() == 0
    + * pvin1.doubleValue() == (double) Integer.MAX_VALUE
    + * pvin0.doubleValue() == 0
    + * pvln1.doubleValue() == (double) Long.MAX_VALUE
    + * pvln0.doubleValue() == 0
    + * pvsh1.doubleValue() == (double) Short.MAX_VALUE
    + * pvsh0.doubleValue() == 0
    + *
    + */ + +public class doublevalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/doubleValue/doublevalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new doublevalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.doubleValue.doublevalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("doublevalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......check: pvbl1.doubleValue() == 1 && pvbl0.doubleValue() == 0"); + if (pvbl1.doubleValue() != 1 || pvbl0.doubleValue() != 0) { + log3("ERROR: pvbl1.doubleValue() != 1 || pvbl0.doubleValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......check: pvbt1.doubleValue() == (double) Byte.MAX_VALUE && pvbt0.doubleValue() == 0"); + if (pvbt1.doubleValue() != (double) Byte.MAX_VALUE || pvbt0.doubleValue() != 0) { + log3("ERROR: pvbt1.doubleValue() != (double) Byte.MAX_VALUE || pvbt0.doubleValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......check: pvch1.doubleValue() == (double) Character.MAX_VALUE && pvch0.doubleValue() == 0"); + if (pvch1.doubleValue() != (double) Character.MAX_VALUE || pvch0.doubleValue() != 0) { + log3("ERROR: pvch1.doubleValue() != (double) Character.MAX_VALUE || pvch0.doubleValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......check: no checks"); + break; + + case 4: + log2("......check: pvfl1.doubleValue() == (double) Float.MAX_VALUE && pvfl0.doubleValue() ==0"); + if (pvfl1.doubleValue() != (double) Float.MAX_VALUE || pvfl0.doubleValue() !=0 ) { + log3("ERROR: pvfl1.doubleValue() != (double) Float.MAX_VALUE || pvfl0.doubleValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......check: pvin1.doubleValue() == (double) Integer.MAX_VALUE && pvin0.doubleValue() == 0"); + if (pvin1.doubleValue() != (double) Integer.MAX_VALUE || pvin0.doubleValue() != 0) { + log3("ERROR: pvin1.doubleValue() != (double) Integer.MAX_VALUE || pvin0.doubleValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......check: pvln1.doubleValue() == (double) Long.MAX_VALUE && pvln0.doubleValue() == 0"); + if (pvln1.doubleValue() != (double) Long.MAX_VALUE || pvln0.doubleValue() != 0) { + log3("ERROR: pvln1.doubleValue() != (double) Long.MAX_VALUE || pvln0.doubleValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......check: pvsh1.doubleValue() == (double) Short.MAX_VALUE && pvsh0.doubleValue() == 0"); + if (pvsh1.doubleValue() != (double) Short.MAX_VALUE || pvsh0.doubleValue() != 0) { + log3("ERROR: pvsh1.doubleValue() != (double) Short.MAX_VALUE || pvsh0.doubleValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue001/TestDescription.java new file mode 100644 index 00000000000..40f6c794c4c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue001/TestDescription.java @@ -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/PrimitiveValue/doubleValue/doublevalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.doubleValue() + * complies with its spec: + * public double doubleValue() + * Converts this value to a DoubleValue and returns the result as a double. + * The value will be widened as necessary, and + * precision information may be lost. + * Returns: the value, converted to double + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.doubleValue.doublevalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.doubleValue.doublevalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.doubleValue.doublevalue001 + * nsk.jdi.PrimitiveValue.doubleValue.doublevalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.doubleValue.doublevalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue001a.java new file mode 100644 index 00000000000..e93a15b2988 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.doubleValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the doublevalue001 JDI test. + */ + +public class doublevalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> doublevalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> doublevalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.doubleValue()
    + * complies with its spec.
    + *
    + * The case for testing is as follows.
    + *
    + * when a gebugger mirrors debuggee's field:
    + * static double db1 = Double.MAX_VALUE;
    + * as PrimitiveValue pvdb1;
    + *
    + * each of the following is true:
    + *
    + * pvdb1.byteValue() == (byte) Double.MAX_VALUE
    + * pvdb1.charValue() == (char) Double.MAX_VALUE
    + * pvdb1.doubleValue() == (double) Double.MAX_VALUE
    + * pvdb1.floatValue() == (float) Double.MAX_VALUE
    + * pvdb1.intValue() == (int) Double.MAX_VALUE
    + * pvdb1.longValue() == (long) Double.MAX_VALUE
    + * pvdb1.shortValue() == (short) Double.MAX_VALUE
    + *
    + */ + +public class doublevalue002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/doubleValue/doublevalue002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new doublevalue002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.doubleValue.doublevalue002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + log2("......Field fsdb1 = execClass.fieldByName('db1');"); + Field fsdb1 = execClass.fieldByName("db1"); + + log2("......PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1);"); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + + + log2("......check: pvdb1.byteValue() == (byte) Double.MAX_VALUE"); + if (pvdb1.byteValue() != (byte) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.byteValue() != (byte) Double.MAX_VALUE"); + log2(" pvdb1.byteValue() == " + pvdb1.byteValue() ); + log2(" (byte) Double.MAX_VALUE == " + ((byte) Double.MAX_VALUE) ); + } + + log2("......check: pvdb1.charValue() == (char) Double.MAX_VALUE"); + if (pvdb1.charValue() != (char) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.charValue() != (char) Double.MAX_VALUE"); + log2(" pvdb1.charValue() == " + pvdb1.charValue() ); + log2(" (char) Double.MAX_VALUE == " + ((char) Double.MAX_VALUE) ); + } + + log2("......check: pvdb1.doubleValue() == (double) Double.MAX_VALUE"); + if (pvdb1.doubleValue() != (double) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.doubleValue() != (double) Double.MAX_VALUE"); + log2(" pvdb1.doubleValue() == " + pvdb1.doubleValue() ); + log2(" (double) Double.MAX_VALUE == " + ((double) Double.MAX_VALUE) ); + } + + log2("......check: pvdb1.floatValue() == (float) Double.MAX_VALUE"); + if (pvdb1.floatValue() != (float) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.floatValue() != (float) Double.MAX_VALUE"); + log2(" pvdb1.floatValue() == " + pvdb1.floatValue() ); + log2(" (float) Double.MAX_VALUE == " + ((float) Double.MAX_VALUE) ); + } + + log2("......check: pvdb1.intValue() == (int) Double.MAX_VALUE"); + if (pvdb1.intValue() != (int) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.intValue() != (int) Double.MAX_VALUE"); + log2(" pvdb1.intValue() == " + pvdb1.intValue() ); + log2(" (int) Double.MAX_VALUE == " + ((int) Double.MAX_VALUE) ); + } + + log2("......check: pvdb1.longValue() == (long) Double.MAX_VALUE"); + if (pvdb1.longValue() != (long) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.longValue() != (long) Double.MAX_VALUE"); + log2(" pvdb1.longValue() == " + pvdb1.longValue() ); + log2(" (long) Double.MAX_VALUE == " + ((long) Double.MAX_VALUE) ); + } + + log2("......check: pvdb1.shortValue() == (short) Double.MAX_VALUE"); + if (pvdb1.shortValue() != (short) Double.MAX_VALUE) { + testExitCode = FAILED; + log3("ERROR: pvdb1.shortValue() != (short) Double.MAX_VALUE"); + log2(" pvdb1.shortValue() == " + pvdb1.shortValue() ); + log2(" (short) Double.MAX_VALUE == " + ((short) Double.MAX_VALUE) ); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002/TestDescription.java new file mode 100644 index 00000000000..d6d89194195 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/PrimitiveValue/doubleValue/doublevalue002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.doubleValue() + * complies with its spec: + * public double doubleValue() + * Converts this value to a DoubleValue and returns the result as a double. + * The value will be widened as necessary, and precision information may be lost. + * Returns: the value, converted to double + * The test works as follows: + * The debugger program - nsk.jdi.PrimitiveValue.doubleValue.doublevalue002; + * the debuggee program - nsk.jdi.PrimitiveValue.doubleValue.doublevalue002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.PrimitiveValue.doubleValue.doublevalue002 + * nsk.jdi.PrimitiveValue.doubleValue.doublevalue002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.doubleValue.doublevalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002a.java new file mode 100644 index 00000000000..1f1cf9bc09c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002a.java @@ -0,0 +1,135 @@ +/* + * 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. + */ +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! templete parameters !!!! +// PrimitiveValue InterfaceName PrimitiveValue +// doubleValue MethodName doubleValue +// doublevalue002 TestName doublevalue002a +// ------------------------------------------------------ + +package nsk.jdi.PrimitiveValue.doubleValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the doublevalue002 JDI test. + */ + +public class doublevalue002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.floatValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.floatValue() == 1
    + * pvbl0.floatValue() == 0
    + * pvbt1.floatValue() == (float) Byte.MAX_VALUE
    + * pvbt0.floatValue() == 0
    + * pvch1.floatValue() == (float) Character.MAX_VALUE
    + * pvch0.floatValue() == 0
    + *
    + *
    + * pvfl1.floatValue() == Float.MAX_VALUE
    + * pvfl0.floatValue() == 0
    + * pvin1.floatValue() == (float) Integer.MAX_VALUE
    + * pvin0.floatValue() == 0
    + * pvln1.floatValue() == (float) Long.MAX_VALUE
    + * pvln0.floatValue() == 0
    + * pvsh1.floatValue() == (float) Short.MAX_VALUE
    + * pvsh0.floatValue() == 0
    + *
    + */ + +public class floatvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/floatValue/floatvalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new floatvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.floatValue.floatvalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("floatvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......checks for: pvbl1.floatValue() == 1 and pvbl0.floatValue() == 0"); + if (pvbl1.floatValue() != 1 || pvbl0.floatValue() != 0) { + log3("ERROR: pvbl1.floatValue() != 1 || pvbl0.floatValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......checks for: pvbt1.floatValue() == (float) Byte.MAX_VALUE and pvbt0.floatValue() == 0"); + if (pvbt1.floatValue() != (float) Byte.MAX_VALUE || pvbt0.floatValue() != 0) { + log3("ERROR: pvbt1.floatValue() != (float) Byte.MAX_VALUE || pvbt0.floatValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......checks for: pvch1.floatValue() == (float) Character.MAX_VALUE and pvch0.floatValue() == 0"); + if (pvch1.floatValue() != (float) Character.MAX_VALUE || pvch0.floatValue() != 0) { + log3("ERROR: pvch1.floatValue() != (float) Character.MAX_VALUE || pvch0.floatValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......checks for: no checks"); + break; + + case 4: + log2("......checks for: pvfl1.floatValue() == Float.MAX_VALUE and pvfl0.floatValue() ==0"); + if (pvfl1.floatValue() != Float.MAX_VALUE || pvfl0.floatValue() !=0 ) { + log3("ERROR: pvfl1.floatValue() != Float.MAX_VALUE || pvfl0.floatValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......checks for: pvin1.floatValue() == (float) Integer.MAX_VALUE and pvin0.floatValue() == 0"); + if (pvin1.floatValue() != (float) Integer.MAX_VALUE || pvin0.floatValue() != 0) { + log3("ERROR: pvin1.floatValue() != (float) Integer.MAX_VALUE || pvin0.floatValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......checks for: pvln1.floatValue() == (float) Long.MAX_VALUE and pvln0.floatValue() == 0"); + if (pvln1.floatValue() != (float) Long.MAX_VALUE || pvln0.floatValue() != 0) { + log3("ERROR: pvln1.floatValue() != (float) Long.MAX_VALUE || pvln0.floatValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......checks for: pvsh1.floatValue() == (float) Short.MAX_VALUE and pvsh0.floatValue() == 0"); + if (pvsh1.floatValue() != (float) Short.MAX_VALUE || pvsh0.floatValue() != 0) { + log3("ERROR: pvsh1.floatValue() != (float) Short.MAX_VALUE || pvsh0.floatValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/floatValue/floatvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/floatValue/floatvalue001/TestDescription.java new file mode 100644 index 00000000000..096e6703b96 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/floatValue/floatvalue001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/PrimitiveValue/floatValue/floatvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.floatValue() + * complies with its spec: + * public float floatValue() + * Converts this value to a FloatValue and returns the result as a float. + * The value will be narrowed or widened as necessary, and + * magnitude or precision information may be lost ( + * as if the primitive had been cast to a float, in the narrowing case). + * Returns: the value, converted to float + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.floatValue.floatvalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.floatValue.floatvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.floatValue.floatvalue001 + * nsk.jdi.PrimitiveValue.floatValue.floatvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.floatValue.floatvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/floatValue/floatvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/floatValue/floatvalue001a.java new file mode 100644 index 00000000000..784e7f8b885 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/floatValue/floatvalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.floatValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the floatvalue001 JDI test. + */ + +public class floatvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> floatvalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> floatvalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.intValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.intValue() == 1
    + * pvbl0.intValue() == 0
    + * pvbt1.intValue() == (int) Byte.MAX_VALUE
    + * pvbt0.intValue() == 0
    + * pvch1.intValue() == (int) Character.MAX_VALUE
    + * pvch0.intValue() == 0
    + *
    + *
    + * pvfl1.intValue() == (int) Float.MAX_VALUE
    + * pvfl0.intValue() == 0
    + * pvin1.intValue() == Integer.MAX_VALUE
    + * pvin0.intValue() == 0
    + * pvln1.intValue() == (int) Long.MAX_VALUE
    + * pvln0.intValue() == 0
    + * pvsh1.intValue() == (int) Short.MAX_VALUE
    + * pvsh0.intValue() == 0
    + *
    + */ + +public class intvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/intValue/intvalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new intvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.intValue.intvalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("intvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......checks for: pvbl1.intValue() == 1 and pvbl0.intValue() == 0"); + if (pvbl1.intValue() != 1 || pvbl0.intValue() != 0) { + log3("ERROR: pvbl1.intValue() != 1 || pvbl0.intValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......checks for: pvbt1.intValue() == (int) Byte.MAX_VALUE and pvbt0.intValue() == 0"); + if (pvbt1.intValue() != (int) Byte.MAX_VALUE || pvbt0.intValue() != 0) { + log3("ERROR: pvbt1.intValue() != (int) Byte.MAX_VALUE || pvbt0.intValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......checks for: pvch1.intValue() == (int) Character.MAX_VALUE and pvch0.intValue() == 0"); + if (pvch1.intValue() != (int) Character.MAX_VALUE || pvch0.intValue() != 0) { + log3("ERROR: pvch1.intValue() != (int) Character.MAX_VALUE || pvch0.intValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......checks for: no checks"); + break; + + case 4: + log2("......checks for: pvfl1.intValue() == (int) Float.MAX_VALUE and pvfl0.intValue() ==0"); + if (pvfl1.intValue() != (int) Float.MAX_VALUE || pvfl0.intValue() !=0 ) { + log3("ERROR: pvfl1.intValue() != (int) Float.MAX_VALUE || pvfl0.intValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......checks for: pvin1.intValue() == Integer.MAX_VALUE and pvin0.intValue() == 0"); + if (pvin1.intValue() != Integer.MAX_VALUE || pvin0.intValue() != 0) { + log3("ERROR: pvin1.intValue() != Integer.MAX_VALUE || pvin0.intValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......checks for: pvln1.intValue() == (int) Long.MAX_VALUE and pvln0.intValue() == 0"); + if (pvln1.intValue() != (int) Long.MAX_VALUE || pvln0.intValue() != 0) { + log3("ERROR: pvln1.intValue() != (int) Long.MAX_VALUE || pvln0.intValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......checks for: pvsh1.intValue() == (int) Short.MAX_VALUE and pvsh0.intValue() == 0"); + if (pvsh1.intValue() != (int) Short.MAX_VALUE || pvsh0.intValue() != 0) { + log3("ERROR: pvsh1.intValue() != (int) Short.MAX_VALUE || pvsh0.intValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/intValue/intvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/intValue/intvalue001/TestDescription.java new file mode 100644 index 00000000000..1b615978966 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/intValue/intvalue001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/PrimitiveValue/intValue/intvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.intValue() + * complies with its spec: + * public int intValue() + * Converts this value to an IntegerValue and returns the result as an int. + * The value will be narrowed or widened as necessary, and + * magnitude or precision information may be lost + * (as if the primitive had been cast to an int, in the narrowing case). + * Returns: the value, converted to int + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.intValue.intvalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.intValue.intvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.intValue.intvalue001 + * nsk.jdi.PrimitiveValue.intValue.intvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.intValue.intvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/intValue/intvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/intValue/intvalue001a.java new file mode 100644 index 00000000000..0bf522dc4a0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/intValue/intvalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.intValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the intvalue001 JDI test. + */ + +public class intvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> intvalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> intvalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.longValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.longValue() == 1
    + * pvbl0.longValue() == 0
    + * pvbt1.longValue() == (long) Byte.MAX_VALUE
    + * pvbt0.longValue() == 0
    + * pvch1.longValue() == (long) Character.MAX_VALUE
    + * pvch0.longValue() == 0
    + *
    + *
    + * pvfl1.longValue() == (long) Float.MAX_VALUE
    + * pvfl0.longValue() == 0
    + * pvin1.longValue() == (long) Integer.MAX_VALUE
    + * pvin0.longValue() == 0
    + * pvln1.longValue() == Long.MAX_VALUE
    + * pvln0.longValue() == 0
    + * pvsh1.longValue() == (long) Short.MAX_VALUE
    + * pvsh0.longValue() == 0
    + *
    + */ + +public class longvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/longValue/longvalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new longvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.longValue.longvalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("longvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......checks for: pvbl1.longValue() == 1 and pvbl0.longValue() == 0"); + if (pvbl1.longValue() != 1 || pvbl0.longValue() != 0) { + log3("ERROR: pvbl1.longValue() != 1 || pvbl0.longValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......checks for: pvbt1.longValue() == (long) Byte.MAX_VALUE and pvbt0.longValue() == 0"); + if (pvbt1.longValue() != (long) Byte.MAX_VALUE || pvbt0.longValue() != 0) { + log3("ERROR: pvbt1.longValue() != (long) Byte.MAX_VALUE || pvbt0.longValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......checks for: pvch1.longValue() == (long) Character.MAX_VALUE and pvch0.longValue() == 0"); + if (pvch1.longValue() != (long) Character.MAX_VALUE || pvch0.longValue() != 0) { + log3("ERROR: pvch1.longValue() != (long) Character.MAX_VALUE || pvch0.longValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......checks for: no checks"); + break; + + case 4: + log2("......checks for: pvfl1.longValue() == (long) Float.MAX_VALUE and pvfl0.longValue() ==0"); + if (pvfl1.longValue() != (long) Float.MAX_VALUE || pvfl0.longValue() !=0 ) { + log3("ERROR: pvfl1.longValue() != (long) Float.MAX_VALUE || pvfl0.longValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......checks for: pvin1.longValue() == (long) Integer.MAX_VALUE and pvin0.longValue() == 0"); + if (pvin1.longValue() != (long) Integer.MAX_VALUE || pvin0.longValue() != 0) { + log3("ERROR: pvin1.longValue() != (long) Integer.MAX_VALUE || pvin0.longValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......checks for: pvln1.longValue() == Long.MAX_VALUE and pvln0.longValue() == 0"); + if (pvln1.longValue() != Long.MAX_VALUE || pvln0.longValue() != 0) { + log3("ERROR: pvln1.longValue() != Long.MAX_VALUE || pvln0.longValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......checks for: pvsh1.longValue() == (long) Short.MAX_VALUE and pvsh0.longValue() == 0"); + if (pvsh1.longValue() != (long) Short.MAX_VALUE || pvsh0.longValue() != 0) { + log3("ERROR: pvsh1.longValue() != (long) Short.MAX_VALUE || pvsh0.longValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/longValue/longvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/longValue/longvalue001/TestDescription.java new file mode 100644 index 00000000000..55cfeaab5b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/longValue/longvalue001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/PrimitiveValue/longValue/longvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.longValue() + * complies with its spec: + * public long longValue() + * Converts this value to a LongValue and returns the result as a long. + * The value will be narrowed or widened as necessary, and + * magnitude or precision information may be lost + * (as if the primitive had been cast to a long, in the narrowing case). + * Returns: the value, converted to long + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.longValue.longvalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.longValue.longvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.longValue.longvalue001 + * nsk.jdi.PrimitiveValue.longValue.longvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.longValue.longvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/longValue/longvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/longValue/longvalue001a.java new file mode 100644 index 00000000000..2970752b731 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/longValue/longvalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.longValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the longvalue001a JDI test. + */ + +public class longvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> longvalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> longvalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * PrimitiveValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.PrimitiveValue.shortValue()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl1 = true;
    + * static boolean bl0 = false;
    + * static byte bt1 = Byte.MAX_VALUE;
    + * static byte bt0 = 0;
    + * static char ch1 = Character.MAX_VALUE;
    + * static char ch0 = 0;
    + * static double db1 = Double.MAX_VALUE;
    + * static double db0 = 0.0d;
    + * static float fl1 = Float.MAX_VALUE;
    + * static float fl0 = 0.0f;
    + * static int in1 = Integer.MAX_VALUE;
    + * static int in0 = 0;
    + * static long ln1 = Long.MAX_VALUE;
    + * static long ln0 = 0;
    + * static short sh1 = Short.MAX_VALUE;
    + * static short sh0 = 0;
    + *
    + * which a debugger mirrors as :
    + *
    + * PrimitiveValue pvbl1, pvbl0, pvbt1, pvbt0,
    + * pvch1, pvch0, pvdb1, pvdb0,
    + * pvfl1, pvfl0, pvin1, pvin0,
    + * pvln1, pvln0, pvsh1, pvsh0;
    + *
    + * each of the following is true:
    + *
    + * pvbl1.shortValue() == 1
    + * pvbl0.shortValue() == 0
    + * pvbt1.shortValue() == (short) Byte.MAX_VALUE
    + * pvbt0.shortValue() == 0
    + * pvch1.shortValue() == (short) Character.MAX_VALUE
    + * pvch0.shortValue() == 0
    + *
    + *
    + * pvfl1.shortValue() == (short) Float.MAX_VALUE
    + * pvfl0.shortValue() == 0
    + * pvin1.shortValue() == (short) Integer.MAX_VALUE
    + * pvin0.shortValue() == 0
    + * pvln1.shortValue() == (short) Long.MAX_VALUE
    + * pvln0.shortValue() == 0
    + * pvsh1.shortValue() == Short.MAX_VALUE
    + * pvsh0.shortValue() == 0
    + *
    + */ + +public class shortvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/PrimitiveValue/shortValue/shortvalue001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new shortvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.PrimitiveValue.shortValue.shortvalue001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("shortvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl1 = execClass.fieldByName("bl1"); + Field fsbl0 = execClass.fieldByName("bl0"); + Field fsbt1 = execClass.fieldByName("bt1"); + Field fsbt0 = execClass.fieldByName("bt0"); + Field fsch1 = execClass.fieldByName("ch1"); + Field fsch0 = execClass.fieldByName("ch0"); + Field fsdb1 = execClass.fieldByName("db1"); + Field fsdb0 = execClass.fieldByName("db0"); + Field fsfl1 = execClass.fieldByName("fl1"); + Field fsfl0 = execClass.fieldByName("fl0"); + Field fsin1 = execClass.fieldByName("in1"); + Field fsin0 = execClass.fieldByName("in0"); + Field fsln1 = execClass.fieldByName("ln1"); + Field fsln0 = execClass.fieldByName("ln0"); + Field fssh1 = execClass.fieldByName("sh1"); + Field fssh0 = execClass.fieldByName("sh0"); + + PrimitiveValue pvbl1 = (PrimitiveValue) execClass.getValue(fsbl1); + PrimitiveValue pvbl0 = (PrimitiveValue) execClass.getValue(fsbl0); + PrimitiveValue pvbt1 = (PrimitiveValue) execClass.getValue(fsbt1); + PrimitiveValue pvbt0 = (PrimitiveValue) execClass.getValue(fsbt0); + PrimitiveValue pvch1 = (PrimitiveValue) execClass.getValue(fsch1); + PrimitiveValue pvch0 = (PrimitiveValue) execClass.getValue(fsch0); + PrimitiveValue pvdb1 = (PrimitiveValue) execClass.getValue(fsdb1); + PrimitiveValue pvdb0 = (PrimitiveValue) execClass.getValue(fsdb0); + PrimitiveValue pvfl1 = (PrimitiveValue) execClass.getValue(fsfl1); + PrimitiveValue pvfl0 = (PrimitiveValue) execClass.getValue(fsfl0); + PrimitiveValue pvin1 = (PrimitiveValue) execClass.getValue(fsin1); + PrimitiveValue pvin0 = (PrimitiveValue) execClass.getValue(fsin0); + PrimitiveValue pvln1 = (PrimitiveValue) execClass.getValue(fsln1); + PrimitiveValue pvln0 = (PrimitiveValue) execClass.getValue(fsln0); + PrimitiveValue pvsh1 = (PrimitiveValue) execClass.getValue(fssh1); + PrimitiveValue pvsh0 = (PrimitiveValue) execClass.getValue(fssh0); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + log2("......checks for: pvbl1.shortValue() == 1 and pvbl0.shortValue() == 0"); + if (pvbl1.shortValue() != 1 || pvbl0.shortValue() != 0) { + log3("ERROR: pvbl1.shortValue() != 1 || pvbl0.shortValue() != 0"); + expresult = 1; + } + break; + + case 1: + log2("......checks for: pvbt1.shortValue() == (short) Byte.MAX_VALUE and pvbt0.shortValue() == 0"); + if (pvbt1.shortValue() != (short) Byte.MAX_VALUE || pvbt0.shortValue() != 0) { + log3("ERROR: pvbt1.shortValue() != (short) Byte.MAX_VALUE || pvbt0.shortValue() != 0"); + expresult = 1; + } + break; + + case 2: + log2("......checks for: pvch1.shortValue() == (short) Character.MAX_VALUE and pvch0.shortValue() == 0"); + if (pvch1.shortValue() != (short) Character.MAX_VALUE || pvch0.shortValue() != 0) { + log3("ERROR: pvch1.shortValue() != (short) Character.MAX_VALUE || pvch0.shortValue() != 0"); + expresult = 1; + } + break; + + case 3: + log2("......checks for: no checks"); + break; + + case 4: + log2("......checks for: pvfl1.shortValue() == (short) Float.MAX_VALUE and pvfl0.shortValue() ==0"); + if (pvfl1.shortValue() != (short) Float.MAX_VALUE || pvfl0.shortValue() !=0 ) { + log3("ERROR: pvfl1.shortValue() != (short) Float.MAX_VALUE || pvfl0.shortValue() !=0"); + expresult = 1; + } + break; + + case 5: + log2("......checks for: pvin1.shortValue() == (short) Integer.MAX_VALUE and pvin0.shortValue() == 0"); + if (pvin1.shortValue() != (short) Integer.MAX_VALUE || pvin0.shortValue() != 0) { + log3("ERROR: pvin1.shortValue() != (short) Integer.MAX_VALUE || pvin0.shortValue() != 0"); + expresult = 1; + } + break; + + case 6: + log2("......checks for: pvln1.shortValue() == (short) Long.MAX_VALUE and pvln0.shortValue() == 0"); + if (pvln1.shortValue() != (short) Long.MAX_VALUE || pvln0.shortValue() != 0) { + log3("ERROR: pvln1.shortValue() != (short) Long.MAX_VALUE || pvln0.shortValue() != 0"); + expresult = 1; + } + break; + + case 7: + log2("......checks for: pvsh1.shortValue() == Short.MAX_VALUE and pvsh0.shortValue() == 0"); + if (pvsh1.shortValue() != Short.MAX_VALUE || pvsh0.shortValue() != 0) { + log3("ERROR: pvsh1.shortValue() != Short.MAX_VALUE || pvsh0.shortValue() != 0"); + expresult = 1; + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { +// log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/shortValue/shortvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/shortValue/shortvalue001/TestDescription.java new file mode 100644 index 00000000000..5e704d5c639 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/shortValue/shortvalue001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/PrimitiveValue/shortValue/shortvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * PrimitiveValue. + * The test checks up that a result of the method + * com.sun.jdi.PrimitiveValue.shortValue() + * complies with its spec: + * public short shortValue() + * Converts this value to a ShortValue and returns the result as a short. + * The value will be narrowed or widened as necessary, and + * magnitude or precision information may be lost + * (as if the primitive had been cast to a short, in the narrowing case). + * Returns: the value, converted to short + * The test works as follows: + * A debugger program - nsk.jdi.PrimitiveValue.shortValue.shortvalue001; + * a debuggee program - nsk.jdi.PrimitiveValue.shortValue.shortvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.PrimitiveValue.shortValue.shortvalue001 + * nsk.jdi.PrimitiveValue.shortValue.shortvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.PrimitiveValue.shortValue.shortvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/shortValue/shortvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/shortValue/shortvalue001a.java new file mode 100644 index 00000000000..89bd687d366 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/shortValue/shortvalue001a.java @@ -0,0 +1,130 @@ +/* + * 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.PrimitiveValue.shortValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the shortvalue001 JDI test. + */ + +public class shortvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> shortvalue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> shortvalue001a: " + message); + } + + //====================================================== test program + + static boolean bl1 = true; + static boolean bl0 = false; + static byte bt1 = Byte.MAX_VALUE; + static byte bt0 = 0; + static char ch1 = Character.MAX_VALUE; + static char ch0 = 0; + static double db1 = Double.MAX_VALUE; + static double db0 = 0.0d; + static float fl1 = Float.MAX_VALUE; + static float fl0 = 0.0f; + static int in1 = Integer.MAX_VALUE; + static int in0 = 0; + static long ln1 = Long.MAX_VALUE; + static long ln0 = 0; + static short sh1 = Short.MAX_VALUE; + static short sh0 = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType: + + * - locationsOfLine(int) for boundary values of Integer + + * - locationsOfLine(String, String, int) for boundary values of + * Integer and various combinations of value of String arguments such as + * null, "", , where means the some + * names of nonexisting object. + * + * - equals(Object) for null-value + */ +public class bounds001 { + + private final static String prefix = "nsk.jdi.ReferenceType._bounds_."; + private final static String debuggerName = prefix + "bounds001"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + public static int exitStatus; + public static Log log; + public static Debugee debugee; + + private static String propertyValue = "something"; + private static int lineNumbers[] = { + Integer.MIN_VALUE, + -1, + Integer.MAX_VALUE + }; + + private static long codeIndexes[] = { + Long.MIN_VALUE, + -1, + Long.MAX_VALUE + }; + + private static String[][] strParams = { + {null, null }, + {null, "" }, + {null, "bounds001_hotchpotch"}, + {"", null }, + {"", "" }, + {"", "bounds001_hotchpotch"}, + {"bounds001_jumble", null }, + {"bounds001_jumble", "" }, + {"bounds001_jumble", "bounds001_hotchpotch"} + }; + +//---------------------------------------------------- + + public static void display(String msg) { + log.display(msg); + } + + public static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds001 thisTest = new bounds001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType testedClass = debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + List list = null; + + display(""); + display("invoking locationsOfLine(int):"); + display("------------------------------"); + for (int i = 0; i < lineNumbers.length; i++) { + display("\tparameter: " + lineNumbers[i]); + try { + list = testedClass.locationsOfLine(lineNumbers[i]); + display("\tsize of locations list: " + list.size()); + if (list.size() > 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + display("invoking locationsOfLine(String, String, int):"); + display("----------------------------------------------"); + for (int i = 0; i < lineNumbers.length; i++) { + for (int j = 0; j < strParams.length; j++) { + display("\tparameters: \"" + strParams[j][0] + "\", \"" + + strParams[j][1] + "\", " + lineNumbers[i]); + try { + list = testedClass.locationsOfLine(strParams[j][0], + strParams[j][1], lineNumbers[i]); + display("\tsize of locations list: " + list.size()); + if (list.size() > 0) { + complain("\twrong size"); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + } + + display("invoking equals(Object):"); + display("----------------------"); + display("\tparameter: "); + try { + if (!testedClass.equals(null)) { + display("\tis not equal to "); + } else { + complain("\tis equal to "); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("\tUnexpected: " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001/TestDescription.java new file mode 100644 index 00000000000..1f838b5a864 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001/TestDescription.java @@ -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/ReferenceType/_bounds_/bounds001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the following methods of com.sun.jdi.Method: + * - locationsOfLine(int) for boundary values of Integer + * - locationsOfLine(String, String, int) for boundary values of + * Integer and various combinations of value of String arguments + * such as null, "", , where means the some + * names of nonexisting object. + * - equals(Object) for null-value + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType._bounds_.bounds001 + * nsk.jdi.ReferenceType._bounds_.bounds001a + * + * @comment make sure bounds001a is compiled with full debug info + * @clean nsk.jdi.ReferenceType._bounds_.bounds001a + * @compile -g:lines,source,vars ../bounds001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType._bounds_.bounds001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001a.java new file mode 100644 index 00000000000..925925c7a68 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001a.java @@ -0,0 +1,50 @@ +/* + * 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.ReferenceType._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * bounds001a is deugee's part of the bounds001. + */ +public class bounds001a { + + 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(bounds001.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(bounds001.SGNL_QUIT)) { + log.display("constructor> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("constructor> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002.java new file mode 100644 index 00000000000..f8eeed59262 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002.java @@ -0,0 +1,206 @@ +/* + * 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.ReferenceType._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up the methods of com.sun.jdi.ReferenceType: + * - fieldByName(String) + * - methodsByName(String) + * - methodsByName(String, String) + * - getValue(Field) + * - getValues(List) + * - equals(Object) + * These methods are invoked with null-value of parameter. + * getValues(List) is invoked with List of zero-size too. + */ + +public class bounds002 { + + private final static String prefix = "nsk.jdi.ReferenceType._bounds_."; + private final static String debuggerName = prefix + "bounds002"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds002 thisTest = new bounds002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType testedClass = debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + Value retValue; + + Field field; + display("fieldByName(null)"); + try { + field = testedClass.fieldByName(null); + if (field != null) { + complain("wrong field: " + field); + exitStatus = Consts.TEST_FAILED; + } else { + display("field: " + field); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + List methodList; + display("methodsByName(null)"); + try { + methodList = testedClass.methodsByName(null); + if (methodList.size() != 0) { + complain("wrong size of method list: " + methodList.size()); + exitStatus = Consts.TEST_FAILED; + } else { + display("size of method list: " + methodList.size()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("methodsByName(null, null)"); + try { + methodList = testedClass.methodsByName(null, null); + if (methodList.size() != 0) { + complain("wrong size of method list: " + methodList.size()); + exitStatus = Consts.TEST_FAILED; + } else { + display("size of method list: " + methodList.size()); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("getValue(null)"); + try { + retValue = testedClass.getValue(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("getValues(null)"); + try { + testedClass.getValues(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + List lst = null; + display("getValues(list with size = 0)"); + try { + testedClass.getValues(lst); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("equals(null)"); + try { + if (testedClass.equals(null)) { + complain("is equal to "); + exitStatus = Consts.TEST_FAILED; + } else { + display("is not equal to "); + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002/TestDescription.java new file mode 100644 index 00000000000..8710dda7622 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/_bounds_/bounds002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods of com.sun.jdi.ReferenceType: + * - fieldByName(String) + * - methodsByName(String) + * - methodsByName(String, String) + * - getValue(Field) + * - getValues(List) + * - equals(Object) + * These methods are invoked with null-value of parameter. + * getValues(List) is invoked with List of zero-size too. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType._bounds_.bounds002 + * nsk.jdi.ReferenceType._bounds_.bounds002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType._bounds_.bounds002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002a.java new file mode 100644 index 00000000000..bcb40c05197 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002a.java @@ -0,0 +1,61 @@ +/* + * 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.ReferenceType._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * bounds002a is deugee's part of the bounds002. + */ +public class bounds002a { + + public final static String testedFieldName = "testedObj"; + public final static String testedMethod = "justMethod"; + + private static bounds002b testedObj = new bounds002b(); + + 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(bounds002.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(bounds002.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class bounds002b { + private static Object testedObj; + public static int justMethod(int val) { + return val; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001.java new file mode 100644 index 00000000000..f6bf66908a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001.java @@ -0,0 +1,322 @@ +/* + * 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.ReferenceType.allFields; + +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 allFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allfields001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allFields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "allfields001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "allfields001aClassForCheck"; + private final static String super_class_for_check = package_prefix + "allfields001aSuperClassForCheck"; + private final static String interf_for_check = package_prefix + "allfields001aInterfaceForCheck"; + private final static String not_found_sign = "NOT FOUND"; + private final static String passed_sign = "PASSED"; + private static String fields_for_check[][] = { + +// field name type name static declaring class check result + + {"s_boolean_field", "boolean", " static", class_for_check, not_found_sign }, + {"s_byte_field", "byte", " static", class_for_check, not_found_sign }, + {"s_char_field", "char", " static", class_for_check, not_found_sign }, + {"s_double_field", "double", " static", class_for_check, not_found_sign }, + {"s_float_field", "float", " static", class_for_check, not_found_sign }, + {"s_int_field", "int", " static", class_for_check, not_found_sign }, + {"s_long_field", "long", " static", class_for_check, not_found_sign }, + {"s_object_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"s_prim_array_field", "long[]", " static", class_for_check, not_found_sign }, + {"s_ref_array_field", "java.lang.Object[]", " static", class_for_check, not_found_sign }, + {"i_boolean_field", "boolean", "", class_for_check, not_found_sign }, + {"i_byte_field", "byte", "", class_for_check, not_found_sign }, + {"i_char_field", "char", "", class_for_check, not_found_sign }, + {"i_double_field", "double", "", class_for_check, not_found_sign }, + {"i_float_field", "float", "", class_for_check, not_found_sign }, + {"i_int_field", "int", "", class_for_check, not_found_sign }, + {"i_long_field", "long", "", class_for_check, not_found_sign }, + {"i_object_field", "java.lang.Object", "", class_for_check, not_found_sign }, + {"i_prim_array_field", "long[]", "", class_for_check, not_found_sign }, + {"i_ref_array_field", "java.lang.Object[]", "", class_for_check, not_found_sign }, + {"s_super_hidden_prim_field", "long", " static", class_for_check, not_found_sign }, + {"s_super_hidden_ref_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"i_super_hidden_prim_field", "long", " static", class_for_check, not_found_sign }, + {"i_super_hidden_ref_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"s_interf_hidden_prim_field", "long", " static", class_for_check, not_found_sign }, + {"s_interf_hidden_ref_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"s_super_boolean_field", "boolean", " static", super_class_for_check, not_found_sign }, + {"s_super_byte_field", "byte", " static", super_class_for_check, not_found_sign }, + {"s_super_char_field", "char", " static", super_class_for_check, not_found_sign }, + {"s_super_double_field", "double", " static", super_class_for_check, not_found_sign }, + {"s_super_float_field", "float", " static", super_class_for_check, not_found_sign }, + {"s_super_int_field", "int", " static", super_class_for_check, not_found_sign }, + {"s_super_long_field", "long", " static", super_class_for_check, not_found_sign }, + {"s_super_object_field", "java.lang.Object", " static", super_class_for_check, not_found_sign }, + {"s_super_hidden_prim_field", "long", " static", super_class_for_check, not_found_sign }, + {"s_super_hidden_ref_field", "java.lang.Object", " static", super_class_for_check, not_found_sign }, + {"i_super_boolean_field", "boolean", "", super_class_for_check, not_found_sign }, + {"i_super_byte_field", "byte", "", super_class_for_check, not_found_sign }, + {"i_super_char_field", "char", "", super_class_for_check, not_found_sign }, + {"i_super_double_field", "double", "", super_class_for_check, not_found_sign }, + {"i_super_float_field", "float", "", super_class_for_check, not_found_sign }, + {"i_super_int_field", "int", "", super_class_for_check, not_found_sign }, + {"i_super_long_field", "long", "", super_class_for_check, not_found_sign }, + {"i_super_object_field", "java.lang.Object", "", super_class_for_check, not_found_sign }, + {"i_super_hidden_prim_field", "long", "", super_class_for_check, not_found_sign }, + {"i_super_hidden_ref_field", "java.lang.Object", "", super_class_for_check, not_found_sign }, + {"ambiguous_prim_field", "long", "", super_class_for_check, not_found_sign }, + {"ambiguous_ref_field", "java.lang.Object", "", super_class_for_check, not_found_sign }, + {"s_interf_boolean_field", "boolean", " static", interf_for_check, not_found_sign }, + {"s_interf_byte_field", "byte", " static", interf_for_check, not_found_sign }, + {"s_interf_char_field", "char", " static", interf_for_check, not_found_sign }, + {"s_interf_double_field", "double", " static", interf_for_check, not_found_sign }, + {"s_interf_float_field", "float", " static", interf_for_check, not_found_sign }, + {"s_interf_int_field", "int", " static", interf_for_check, not_found_sign }, + {"s_interf_long_field", "long", " static", interf_for_check, not_found_sign }, + {"s_interf_object_field", "java.lang.Object", " static", interf_for_check, not_found_sign }, + {"s_interf_hidden_prim_field", "long", " static", interf_for_check, not_found_sign }, + {"s_interf_hidden_ref_field", "java.lang.Object", " static", interf_for_check, not_found_sign }, + {"ambiguous_prim_field", "long", " static", interf_for_check, not_found_sign }, + {"ambiguous_ref_field", "java.lang.Object", " static", interf_for_check, not_found_sign } + + }; + + /** + * Re-call to run(args,out), 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 allfields001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/allFields/allfields001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/allFields/allfields001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/allFields/allfields001 test LOG:"); + out_stream.println("==> test checks allFields() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allfields001: allfields001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> allfields001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> allfields001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allfields001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> allfields001: check ReferenceType.allFields() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean allFields_method_error = false; + int fields_for_check_number = fields_for_check.length; + int not_found_fields_number = 0; + int all_fields_number = 0; + int unexpected_found_fields_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> allfields001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List all_fields_list = null; + try { + all_fields_list = refType.allFields(); + } + catch (Throwable thrown) { + out_stream.println("##> allfields001: FAILED: ReferenceType.allFields() throws unexpected " + + thrown); + allFields_method_error = true; + break; + } + all_fields_number = all_fields_list.size(); + Field all_fields[] = new Field[all_fields_number]; + String unexpected_all_fields[] = new String[all_fields_number]; + all_fields_list.toArray(all_fields); + for (int i=0; i allfields001: FAILED: field is NOT found: " + current_field_for_check); + not_found_fields_number++; + } + else { + print_log_on_verbose + ("--> allfields001: PASSED for field: " + current_field_for_check); + } + } + for (int i=0; i allfields001: FAILED: unexpected found field: " + unexpected_all_fields[i]); + } + break; + } + + out_stream.println("--> allfields001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println("--> allfields001: expected found fields number = " + fields_for_check_number); + out_stream.println("--> allfields001: in fact found fields number = " + all_fields_number); + out_stream.println("--> allfields001: expected and in fact found fields number = " + + (fields_for_check_number - not_found_fields_number)); + out_stream.println + ("##> allfields001: NOT found fields number = " + not_found_fields_number); + out_stream.println + ("##> allfields001: UNEXPECTED found fields number = " + unexpected_found_fields_number); + } + if ( not_found_fields_number + unexpected_found_fields_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> allfields001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> allfields001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allfields001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001/TestDescription.java new file mode 100644 index 00000000000..502dcfd2184 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ReferenceType/allFields/allfields001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allFields/allfields001 test + * checks the allFields() method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.allFields() method is checked for fields of + * debugee's class which extends super class and implements interface. + * Debugee's class has both hidden and ambiguous fields which should + * present in Field list returned by the allFields() method. + * Each field is checked for field name, field type, static modifier + * and declaring class. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allFields.allfields001 + * nsk.jdi.ReferenceType.allFields.allfields001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allFields.allfields001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001a.java new file mode 100644 index 00000000000..8fa0790cc71 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields001a.java @@ -0,0 +1,162 @@ +/* + * 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.ReferenceType.allFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the allfields001 JDI test. + */ + +public class allfields001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 allfields001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + allfields001aClassForCheck class_for_check = new allfields001aClassForCheck(); + + print_log_on_verbose("**> allfields001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allfields001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allfields001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> allfields001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> allfields001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class allfields001aClassForCheck extends allfields001aSuperClassForCheck implements allfields001aInterfaceForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + static long[] s_prim_array_field; + static Object[] s_ref_array_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + long[] i_prim_array_field; + Object[] i_ref_array_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + static long i_super_hidden_prim_field; + static Object i_super_hidden_ref_field; + + static long s_interf_hidden_prim_field; + static Object s_interf_hidden_ref_field; + +} + +class allfields001aSuperClassForCheck { + + static boolean s_super_boolean_field; + static byte s_super_byte_field; + static char s_super_char_field; + static double s_super_double_field; + static float s_super_float_field; + static int s_super_int_field; + static long s_super_long_field; + static Object s_super_object_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + boolean i_super_boolean_field; + byte i_super_byte_field; + char i_super_char_field; + double i_super_double_field; + float i_super_float_field; + int i_super_int_field; + long i_super_long_field; + Object i_super_object_field; + + long i_super_hidden_prim_field; + Object i_super_hidden_ref_field; + + long ambiguous_prim_field; + Object ambiguous_ref_field; + +} + +interface allfields001aInterfaceForCheck { + + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); + + static final long s_interf_hidden_prim_field = 1; + static final Object s_interf_hidden_ref_field = new Object(); + + static final long ambiguous_prim_field = 1; + static final Object ambiguous_ref_field = new Object(); + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002.java new file mode 100644 index 00000000000..5ff2b6b4928 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002.java @@ -0,0 +1,219 @@ +/* + * 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.ReferenceType.allFields; + +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 allFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allfields002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String package_prefix = "nsk.jdi.ReferenceType.allFields."; + private final static String thisClassName = package_prefix + "allfields002"; + private final static String debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "allfields002b"; + + private final static String classLoaderName = package_prefix + "allfields002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + /** + * Re-call to run(args,out), 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 allfields002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/allFields/allfields002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/allFields/allfields002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/allFields/allfields002 test LOG:"); + print_log_on_verbose("==> test checks allFields() method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allfields002: allfields002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> allfields002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> allfields002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allfields002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> allfields002: check ReferenceType.allFields() method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean allFields_method_error = false; + + while ( true ) { // test body + + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> allfields002: Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> allfields002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> allfields002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List all_fields_list = null; + try { + all_fields_list = refType.allFields(); + print_log_anyway + ("##> allfields002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + allFields_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> allfields002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> allfields002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + allFields_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> allfields002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> allfields002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allfields002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002/TestDescription.java new file mode 100644 index 00000000000..5131effb152 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/allFields/allfields002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allFields/allfields002 test + * checks the allFields() method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.allFields() method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allFields.allfields002 + * nsk.jdi.ReferenceType.allFields.allfields002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allFields.allfields002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002/loadclass/allfields002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002/loadclass/allfields002b.java new file mode 100644 index 00000000000..98d244b3b17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002/loadclass/allfields002b.java @@ -0,0 +1,50 @@ +/* + * 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.ReferenceType.allFields; + +/** + * This class is loaded by allfields002aClassLoader . + */ +class allfields002b { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002a.java new file mode 100644 index 00000000000..eb4e99cd953 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields002a.java @@ -0,0 +1,139 @@ +/* + * 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.ReferenceType.allFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the allfields002 JDI test. + */ + +public class allfields002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.allFields."; + private final static String checked_class_name = package_prefix + "allfields002b"; + + 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 allfields002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + allfields002aClassLoader customClassLoader = new allfields002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> allfields002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> allfields002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> allfields002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allfields002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allfields002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> allfields002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> allfields002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class allfields002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public allfields002aClassLoader(String classPath, String className) { + super(allfields002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003.java new file mode 100644 index 00000000000..1b70ed4a82c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003.java @@ -0,0 +1,254 @@ +/* + * 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.ReferenceType.allFields; + +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 allFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allfields003 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allFields.", + thisClassName = package_prefix + "allfields003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "allfields003b"; + + + /** + * Re-call to run(args,out), 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 allfields003().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/allFields/allfields003 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/allFields/allfields003 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/allFields/allfields003 test LOG:"); + out_stream.println("--> test checks allFields() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allfields003: allfields003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> allfields003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> allfields003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allfields003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> allfields003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> allfields003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allfields003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean allFields_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> allfields003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> allfields003: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> allfields003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> allfields003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> allfields003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> allfields003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> allfields003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.allFields() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> allfields003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allfields003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> allfields003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> allfields003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> allfields003: check that checked class has been unloaded realy..."); + out_stream.println + ("--> allfields003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.allFields() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> allfields003: check ReferenceType.allFields() method for unloaded class..."); + List all_fields_list = null; + try { + all_fields_list = refType.allFields(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> allfields003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> allfields003: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + allFields_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> allfields003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> allfields003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allfields003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of allfields003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/TestDescription.java new file mode 100644 index 00000000000..f58719a9ee8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/TestDescription.java @@ -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/ReferenceType/allFields/allfields003. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allFields/allfields003 test + * checks the allFields() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * allFields() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - allfields003b class was moved in 'loadclass' subdirectory; + * - package name was added in allfields003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for allfields003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allFields.allfields003 + * nsk.jdi.ReferenceType.allFields.allfields003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allFields.allfields003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/loadclass/allfields003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/loadclass/allfields003b.java new file mode 100644 index 00000000000..4c17fbe2051 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003/loadclass/allfields003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the allFields() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.allFields; + +class allfields003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003a.java new file mode 100644 index 00000000000..68b88e0af6c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields003a.java @@ -0,0 +1,122 @@ +/* + * 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.ReferenceType.allFields; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the allfields003 JDI test. + */ + +public class allfields003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + static String package_prefix = "nsk.jdi.ReferenceType.allFields."; + static String checked_class_name = package_prefix + "allfields003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> allfields003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> allfields003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + print_log_on_verbose + ("--> allfields003a: checked class dir:" + checked_class_dir); + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> allfields003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + print_log_on_verbose + ("**> allfields003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> allfields003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> allfields003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allfields003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allfields003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> allfields003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> allfields003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> allfields003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> allfields003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> allfields003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> allfields003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> allfields003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allfields003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allfields003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> allfields003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> allfields003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of allfields003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004.java new file mode 100644 index 00000000000..03634e108f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004.java @@ -0,0 +1,208 @@ +/* + * 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.ReferenceType.allFields; + +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 allFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allfields004 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allFields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "allfields004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "allfields004aClassForCheck"; + + /** + * Re-call to run(args,out), 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 allfields004().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/allFields/allfields004 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/allFields/allfields004 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/allFields/allfields004 test LOG:"); + out_stream.println("==> test checks allFields() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for class without any declarated fields\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allfields004: allfields004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> allfields004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> allfields004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allfields004: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> allfields004: check ReferenceType.allFields() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean allFields_method_error = false; + int all_fields_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> allfields004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List all_fields_list = null; + try { + all_fields_list = refType.allFields(); + } + catch (Throwable thrown) { + out_stream.println("##> allfields004: FAILED: ReferenceType.allFields() throws unexpected " + + thrown); + allFields_method_error = true; + break; + } + all_fields_number = all_fields_list.size(); + if ( all_fields_number == 0 ) { + break; + } + Field all_fields[] = new Field[all_fields_number]; + all_fields_list.toArray(all_fields); + for (int i=0; i allfields004: FAILED: unexpected found field: " + full_checked_field); + } + break; + } + + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + if ( all_fields_number > 0 ) { + out_stream.println + ("##> allfields004: UNEXPECTED found fields number = " + all_fields_number); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> allfields004: PASSED: returned list of fields is empty!"); + } + + print_log_on_verbose("--> allfields004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> allfields004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allfields004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004/TestDescription.java new file mode 100644 index 00000000000..f924e11aab5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/allFields/allfields004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allFields/allfields004 test + * checks the allFields() method of ReferenceType interface + * of the com.sun.jdi package for class without any declarated fields: + * the ReferenceType.allFields() method is checked for + * debugee's class which extends super class and implements interface. + * All these classes do not contain any declarated fields. + * The test expects the returned list of fields to be empty. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allFields.allfields004 + * nsk.jdi.ReferenceType.allFields.allfields004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allFields.allfields004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004a.java new file mode 100644 index 00000000000..2384484e59c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields004a.java @@ -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.ReferenceType.allFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the allfields004 JDI test. + */ + +public class allfields004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 allfields004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + allfields004aClassForCheck class_for_check = new allfields004aClassForCheck(); + + print_log_on_verbose("**> allfields004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allfields004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allfields004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> allfields004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> allfields004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class allfields004aClassForCheck extends allfields004aSuperClassForCheck implements allfields004aInterfaceForCheck { +} + +class allfields004aSuperClassForCheck { +} + +interface allfields004aInterfaceForCheck { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields005.java new file mode 100644 index 00000000000..ea2957dfa70 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields005.java @@ -0,0 +1,287 @@ +/* + * 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.ReferenceType.allFields; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.allFields() + * properly returns an empty field list for arrays (ArrayType) and primitive + * classes.

    + * + * Debugger part of it attempts to get a list of all fields declared + * and inherited in several reference types corresponding to debuggee field + * values, which themselves are:
    + * primitive classes, and arrays of primitive types and classes. + */ +public class allfields005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.allFields.allfields005t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested allfields used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new allfields005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "allfields005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i " + 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() { + check(); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static void check () { + try { + ClassType checkedClass = (ClassType)debuggeeClass.fieldByName("f1").type(); + String className = checkedClass.name(); + + List l = checkedClass.allFields(); + if (l.isEmpty()) { + complain("\t ReferenceType.allFields() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + + for (int i = 0; i < expectedEnumFields.length; i++) { + Iterator it = l.iterator(); + while (it.hasNext()) { + Field checkedField = it.next(); + if (expectedEnumFields[i][0].equals(checkedField.name()) && + checkedField.declaringType().name().equals(expectedEnumFields[i][1]) ) + + expectedEnumFields[i][2] = "found"; + } + } + + for (int i = 0; i < expectedEnumFields.length; i++) { + if (expectedEnumFields[i][2] != null) { + display("enum " + className + " has field " + expectedEnumFields[i][0]); + display("\t of type " + expectedEnumFields[i][1]); + } else { + complain("enum " + className + " does not have field " + expectedEnumFields[i][0]); + complain("\t of type " + expectedEnumFields[i][1]); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006/TestDescription.java new file mode 100644 index 00000000000..903476d2ec6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/allFields/allfields006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for allFields() method of ReferenceType interface. + * The test checks if the method returns all enum constants + * declared in mirrored enum type and all inherited fields + * regardless if they are ambigous or not. + * The test consists of a debugger program (allfields006.java) + * and debuggee application (allfields006a.java). + * Package name is nsk.jdi.ReferenceType.allFields . + * 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 allFields() method for field f1 + * of enum type declared in allfields006a class. + * The result list must include enum constant fields e1 and e2, + * and two inherited fields with same name i1. + * 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.ReferenceType.allFields.allfields006 + * nsk.jdi.ReferenceType.allFields.allfields006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allFields.allfields006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006a.java new file mode 100644 index 00000000000..1f5e452e417 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006a.java @@ -0,0 +1,98 @@ +/* + * 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.ReferenceType.allFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class allfields006a { + + //------------------------------------------------------- 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 allfields006Enum1 f1 = allfields006Enum1.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(allfields006.SIGNAL_READY); + receiveSignal(allfields006.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum allfields006Enum1 implements allfields006i1, allfields006i2 { + e1, e2; +} + +interface allfields006i1 { + public final int i1 = 1; +} + +interface allfields006i2 { + public final int i1 = 2; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java new file mode 100644 index 00000000000..f38a6b23fdd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java @@ -0,0 +1,262 @@ +/* + * 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.ReferenceType.allLineLocations; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.allLineLocations()
    + * complies with its spec.
    + * The test checks up that a list of locations for
    + * a tested ReferenceType object
    + * - is not empty and
    + * - is ordered in a proper, from low to high, sequence.
    + */ + +public class alllinelocations001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/allLineLocations/alllinelocations001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new alllinelocations001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.allLineLocations.alllinelocations001a"; + + String mName = "nsk.jdi.ReferenceType.allLineLocations"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List locations = null; + ReferenceType refType = null; + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested ReferenceType object 'refType'"); + refType = (ReferenceType) classes.get(0); + + log2("......locations = refType.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = refType.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + if (locations.size() == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + log2("......checking up element order in the List"); + + ListIterator listIterator = locations.listIterator(); + + Location location1 = null; + Location location2 = null; + + int i2; + + for (i2 = 0; listIterator.hasNext(); i2++) { + + long codeIndex1 = 0l; + long codeIndex2 = 0l; + + try { + location2 = (Location) listIterator.next(); + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + break ; + } + codeIndex2 = location2.codeIndex(); + if (i2 == 0) { + continue; + } + + if (codeIndex2 < codeIndex1) { + testExitCode = FAILED; + log3("ERROR: codeIndex disorder: codeIndex2 < codeIndex1"); + break ; + } + + codeIndex1 = codeIndex2; + } + + log2("......compareing locations.size() to a processed number of elements in the list"); + if (locations.size() != i2) { + testExitCode = FAILED; + log3("ERROR: locations.size() != the processed number"); + break ; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001/TestDescription.java new file mode 100644 index 00000000000..729b38148f7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ReferenceType/allLineLocations/alllinelocations001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.allLineLocations() + * complies with its spec: + * public List allLineLocations() + * throws AbsentInformationException + * Returns a list containing a Location object for + * each executable source line in this reference type. + * This method is equivalent to allLineLocations(vm.getDefaultStratum(),null) - + * see allLineLocations(String,String) for more information. + * Throws: AbsentInformationException - + * if there is no line number information for this class and + * there are non-native, non-abstract executable members of this class. + * ClassNotPreparedException - + * if this class not yet been prepared. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.allLineLocations.alllinelocations001; + * the debuggee program - nsk.jdi.ReferenceType.allLineLocations.alllinelocations001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The option + * JAVAC_OPTS=-g + * is put into the locationsofline002.cfg file. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allLineLocations.alllinelocations001 + * nsk.jdi.ReferenceType.allLineLocations.alllinelocations001a + * + * @comment make sure alllinelocations001a is compiled with full debug info + * @clean nsk.jdi.ReferenceType.allLineLocations.alllinelocations001a + * @compile -g:lines,source,vars ../alllinelocations001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allLineLocations.alllinelocations001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001a.java new file mode 100644 index 00000000000..1c9c6b01d2f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001a.java @@ -0,0 +1,146 @@ +/* + * 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.ReferenceType.allLineLocations; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the alllinelocations001 JDI test. + */ + +public class alllinelocations001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType.allLineLocations() + * properly returns an empty list for arrays (ArrayType), primitive + * classes, and for interfaces (InterfaceType) if the interface has + * no executable code in its class initialization at the specified line + * number.

    + * + * Debugger part of it attempts to get all locations that map to the debuggee + * field values/type declaration, which themselves are:
    + * primitive classes, arrays of primitive types and classes, and finally, + * an interface type. + */ +public class alllinelocations002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.allLineLocations.alllinelocations002t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 25; + // tested fields and used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr", + "dummyIf" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new alllinelocations002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "alllinelocations002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... ... + * 16 --> 1007, source1 + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... ... + * 27 --> 1107, source1 + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... ... + * 38 --> 1207, source1 + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that method 'com.sun.jdi.ReferenceType.allLineLocations(String stratum, String sourceName)' + * returns only expected locations for all stratums: for 'Java' stratum, and for stratums 'TestStratum1'-'TestStratum3'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allLineLocations_ss.allLineLocations_ss003.allLineLocations_ss003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allLineLocations_ss.allLineLocations_ss003.allLineLocations_ss003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.ReferenceType.allLineLocations_ss.allLineLocations_ss003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class allLineLocations_ss003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new allLineLocations_ss003().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type1( + className, + testStratumCount, + true); + + /* + * Method 'prepareDefaultPatchedClassFile_Type1' creates class file with + * following line mapping for each TestStratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... + * ... + * 16 --> 1007, source1 + * + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... + * ... + * 27 --> 1107, source1 + * + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... + * ... + * 38 --> 1207, source1 + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + List expectedLocations = testStratumData.get(stratumName).allLocations; + + // all locations has the same source + String locationsSource = expectedLocations.get(0).sourceName; + + log.display("Check locations for stratum: " + stratumName + ", source " + locationsSource); + + try { + compareLocations( + referenceType.allLineLocations(stratumName, locationsSource), + expectedLocations, + stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + log.display("Check locations for stratum: " + stratumName + ", source " + null); + + try { + compareLocations(referenceType.allLineLocations(stratumName, null), expectedLocations, stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss004/allLineLocations_ss004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss004/allLineLocations_ss004.java new file mode 100644 index 00000000000..1df8bd172fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss004/allLineLocations_ss004.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/allLineLocations_ss/allLineLocations_ss004. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.Method.allLineLocations(String stratum, String sourceName)' returns + * correct values for all stratums available for class and if sourceName == null locaitions for all sources are returned. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined (each method has locations in 3 different sources): + * "Java" "TestStratum" + * + * 9 --> 1000, source1, path1 + * 10 --> 1000, source2, path2 + * 11 --> 1000, source3, path3 + * ... ... + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1100, source2, path2 + * 22 --> 1100, source3, path3 + * ... ... + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1200, source2, path2 + * 33 --> 1200, source3, path3 + * ... ... + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that method 'com.sun.jdi.ReferenceType.allLineLocations(String stratum, String sourceName)' + * returns only expected locations for all test stratums('TestStratum1'-'TestStratum3') depending on given source name, + * and if source name is null locations for all sources are returned. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allLineLocations_ss.allLineLocations_ss004.allLineLocations_ss004 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allLineLocations_ss.allLineLocations_ss004.allLineLocations_ss004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.ReferenceType.allLineLocations_ss.allLineLocations_ss004; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class allLineLocations_ss004 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new allLineLocations_ss004().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type2(className, testStratumCount); + /* + * Method 'prepareDefaultPatchedClassFile_Type2' creates class file with + * following line mapping for each test stratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1, path1 + * 10 --> 1001, source2, path2 + * 11 --> 1002, source3, path3 + * ... + * ... + * + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1101, source2, path2 + * 22 --> 1102, source3, path3 + * ... + * ... + * + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1201, source2, path2 + * 33 --> 1207, source3, path3 ... ... + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + LocationsData locationsData = testStratumData.get(stratumName); + + // for all available sources names + for (String sourceName : locationsData.sourceLocations.keySet()) { + List expectedLocations = locationsData.sourceLocations.get(sourceName); + + log.display("Check locations for stratum: '" + stratumName + "', source '" + sourceName + "'"); + + try { + compareLocations( + referenceType.allLineLocations(stratumName, sourceName), + expectedLocations, + stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } + + // check case when sourceName is null + log.display("Check locations for stratum: '" + stratumName + "', source " + null); + try { + compareLocations( + referenceType.allLineLocations(stratumName, null), + locationsData.allLocations, + stratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java new file mode 100644 index 00000000000..9672ba1f813 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java @@ -0,0 +1,265 @@ +/* + * 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.ReferenceType.allLineLocations_ss; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.allLineLocations(String,String)
    + * The test checks up that a list of locations for
    + * a tested ReferenceType object
    + * - is not empty and
    + * - is ordered in a proper, from low to high, sequence.
    + */ + +public class alllinelocations_ss001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new alllinelocations_ss001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001a"; + + String mName = "nsk.jdi.ReferenceType.allLineLocations_ss"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List locations = null; + ReferenceType refType = null; + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested ReferenceType object 'refType'"); + refType = (ReferenceType) classes.get(0); + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + log2("......locations = refType.allLineLocations(defaultStratum, null);"); + log2(" no AbsentInformationException is expected"); + try { + locations = refType.allLineLocations(defaultStratum, null); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + if (locations.size() == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + log2("......checking up element order in the List"); + + ListIterator listIterator = locations.listIterator(); + + Location location1 = null; + Location location2 = null; + + int i2; + + for (i2 = 0; listIterator.hasNext(); i2++) { + + long codeIndex1 = 0l; + long codeIndex2 = 0l; + + try { + location2 = (Location) listIterator.next(); + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + break ; + } + codeIndex2 = location2.codeIndex(); + if (i2 == 0) { + continue; + } + + if (codeIndex2 < codeIndex1) { + testExitCode = FAILED; + log3("ERROR: codeIndex disorder: codeIndex2 < codeIndex1"); + break ; + } + + codeIndex1 = codeIndex2; + } + + log2("......compareing locations.size() to a processed number of elements in the list"); + if (locations.size() != i2) { + testExitCode = FAILED; + log3("ERROR: locations.size() != the processed number"); + break ; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001/TestDescription.java new file mode 100644 index 00000000000..bfc3acbb311 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001/TestDescription.java @@ -0,0 +1,106 @@ +/* + * 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/ReferenceType/allLineLocations_ss/alllinelocations_ss001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.allLineLocations(String, String) + * complies with its spec: + * public List allLineLocations(String stratum, String sourceName) + * throws AbsentInformationException + * Returns a list containing a Location object for + * each executable source line in this reference type. + * Each location maps a source line to a range of code indices. + * The beginning of the range can be determined through Location.codeIndex(). + * The returned list may contain multiple locations for + * a particular line number, if the compiler and/or VM has mapped that line + * to two or more disjoint code index ranges. + * Note that it is possible for the same source line + * to represent different code index ranges in different methods. + * For arrays (ArrayType) and primitive classes, + * the returned list is always empty. + * For interfaces (InterfaceType), the returned list will be non-empty + * only if the interface has executable code in its class initialization. + * Returned list is for the specified stratum + * (see Location for a description of strata). + * Parameters: stratum - The stratum to retrieve information from or + * null for the defaultStratum(). + * sourceName - Return locations only within this source file or + * null to return locations. + * Returns: a List of all source line Location objects. + * Throws: AbsentInformationException - + * if there is no line number information for this class and + * there are non-native, non-abstract executable members of + * this class. + * Or if sourceName is non-null and + * source name information is not present. + * ClassNotPreparedException - + * if this class not yet been prepared. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001; + * the debuggee program - nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The option + * JAVAC_OPTS=-g + * is put into the locationsofline002.cfg file. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001 + * nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001a + * + * @comment make sure alllinelocations_ss001a is compiled with full debug info + * @clean nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001a + * @compile -g:lines,source,vars ../alllinelocations_ss001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001a.java new file mode 100644 index 00000000000..6482b4a5db5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001a.java @@ -0,0 +1,147 @@ +/* + * 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.ReferenceType.allLineLocations_ss; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the alllinelocations_ss001 JDI test. + */ + +public class alllinelocations_ss001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType.allLineLocations(String,String) + * properly returns an empty list for arrays (ArrayType), primitive + * classes, and for interfaces (InterfaceType) if the interface has + * no executable code in its class initialization at the specified line + * number.

    + * + * Debugger part of it attempts to get all locations that map to the debuggee + * field values/type declaration, which themselves are:
    + * primitive classes, arrays of primitive types and classes, and finally, + * an interface type. + */ +public class alllinelocations_ss002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.allLineLocations_ss.alllinelocations_ss002t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 25; + // tested fields and used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr", + "dummyIf" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new alllinelocations_ss002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "alllinelocations_ss002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; iallMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allmethods001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "allmethods001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "allmethods001aClassForCheck"; + private final static String super_class_for_check = package_prefix + "allmethods001aSuperClassForCheck"; + private final static String interf_for_check = package_prefix + "allmethods001aInterfaceForCheck"; + private final static String not_found_sign = "NOT FOUND"; + private final static String passed_sign = "PASSED"; + private final static String Object_class_name = "java.lang.Object"; + private static String methods_for_check[][] = { + +// method name declaring class check result + + {"", class_for_check, not_found_sign}, + {"ClassForCheck", class_for_check, not_found_sign}, + {"s_void_method", class_for_check, not_found_sign}, + {"s_boolean_method", class_for_check, not_found_sign}, + {"s_byte_method", class_for_check, not_found_sign}, + {"s_char_method", class_for_check, not_found_sign}, + {"s_double_method", class_for_check, not_found_sign}, + {"s_float_method", class_for_check, not_found_sign}, + {"s_int_method", class_for_check, not_found_sign}, + {"s_long_method", class_for_check, not_found_sign}, + {"s_string_method", class_for_check, not_found_sign}, + {"s_object_method", class_for_check, not_found_sign}, + {"s_prim_array_method", class_for_check, not_found_sign}, + {"s_ref_array_method", class_for_check, not_found_sign}, + {"s_super_hidden_void_method", class_for_check, not_found_sign}, + {"s_super_hidden_prim_method", class_for_check, not_found_sign}, + {"s_super_hidden_ref_method", class_for_check, not_found_sign}, + {"s_void_par_method", class_for_check, not_found_sign}, + {"s_boolean_par_method", class_for_check, not_found_sign}, + {"s_byte_par_method", class_for_check, not_found_sign}, + {"s_char_par_method", class_for_check, not_found_sign}, + {"s_double_par_method", class_for_check, not_found_sign}, + {"s_float_par_method", class_for_check, not_found_sign}, + {"s_int_par_method", class_for_check, not_found_sign}, + {"s_long_par_method", class_for_check, not_found_sign}, + {"s_string_par_method", class_for_check, not_found_sign}, + {"s_object_par_method", class_for_check, not_found_sign}, + {"s_prim_array_par_method", class_for_check, not_found_sign}, + {"s_ref_array_par_method", class_for_check, not_found_sign}, + {"s_super_hidden_void_par_method", class_for_check, not_found_sign}, + {"s_super_hidden_prim_par_method", class_for_check, not_found_sign}, + {"s_super_hidden_ref_par_method", class_for_check, not_found_sign}, + {"s_native_method", class_for_check, not_found_sign}, + {"s_synchr_method", class_for_check, not_found_sign}, + {"s_final_method", class_for_check, not_found_sign}, + {"s_private_method", class_for_check, not_found_sign}, + {"s_protected_method", class_for_check, not_found_sign}, + {"s_public_method", class_for_check, not_found_sign}, + {"i_void_method", class_for_check, not_found_sign}, + {"i_boolean_method", class_for_check, not_found_sign}, + {"i_byte_method", class_for_check, not_found_sign}, + {"i_char_method", class_for_check, not_found_sign}, + {"i_double_method", class_for_check, not_found_sign}, + {"i_float_method", class_for_check, not_found_sign}, + {"i_int_method", class_for_check, not_found_sign}, + {"i_long_method", class_for_check, not_found_sign}, + {"i_string_method", class_for_check, not_found_sign}, + {"i_object_method", class_for_check, not_found_sign}, + {"i_prim_array_method", class_for_check, not_found_sign}, + {"i_ref_array_method", class_for_check, not_found_sign}, + {"i_super_overridden_void_method", class_for_check, not_found_sign}, + {"i_super_overridden_prim_method", class_for_check, not_found_sign}, + {"i_super_overridden_ref_method", class_for_check, not_found_sign}, + {"i_interf_overridden_void_method", class_for_check, not_found_sign}, + {"i_interf_overridden_prim_method", class_for_check, not_found_sign}, + {"i_interf_overridden_ref_method", class_for_check, not_found_sign}, + {"i_void_par_method", class_for_check, not_found_sign}, + {"i_boolean_par_method", class_for_check, not_found_sign}, + {"i_byte_par_method", class_for_check, not_found_sign}, + {"i_char_par_method", class_for_check, not_found_sign}, + {"i_double_par_method", class_for_check, not_found_sign}, + {"i_float_par_method", class_for_check, not_found_sign}, + {"i_int_par_method", class_for_check, not_found_sign}, + {"i_long_par_method", class_for_check, not_found_sign}, + {"i_string_par_method", class_for_check, not_found_sign}, + {"i_object_par_method", class_for_check, not_found_sign}, + {"i_prim_array_par_method", class_for_check, not_found_sign}, + {"i_ref_array_par_method", class_for_check, not_found_sign}, + {"i_super_overridden_void_par_method", class_for_check, not_found_sign}, + {"i_super_overridden_prim_par_method", class_for_check, not_found_sign}, + {"i_super_overridden_ref_par_method", class_for_check, not_found_sign}, + {"i_interf_overridden_void_par_method", class_for_check, not_found_sign}, + {"i_interf_overridden_prim_par_method", class_for_check, not_found_sign}, + {"i_interf_overridden_ref_par_method", class_for_check, not_found_sign}, + {"i_abstract_method", class_for_check, not_found_sign}, + {"i_native_method", class_for_check, not_found_sign}, + {"i_synchr_method", class_for_check, not_found_sign}, + {"i_final_method", class_for_check, not_found_sign}, + {"i_private_method", class_for_check, not_found_sign}, + {"i_protected_method", class_for_check, not_found_sign}, + {"i_public_method", class_for_check, not_found_sign}, + {"", class_for_check, not_found_sign}, + + {"", super_class_for_check, not_found_sign}, + {"s_super_void_method", super_class_for_check, not_found_sign}, + {"s_super_prim_method", super_class_for_check, not_found_sign}, + {"s_super_ref_method", super_class_for_check, not_found_sign}, + {"i_super_void_method", super_class_for_check, not_found_sign}, + {"i_super_prim_method", super_class_for_check, not_found_sign}, + {"i_super_ref_method", super_class_for_check, not_found_sign}, + {"s_super_hidden_void_method", super_class_for_check, not_found_sign}, + {"s_super_hidden_prim_method", super_class_for_check, not_found_sign}, + {"s_super_hidden_ref_method", super_class_for_check, not_found_sign}, + {"s_super_hidden_void_par_method", super_class_for_check, not_found_sign}, + {"s_super_hidden_prim_par_method", super_class_for_check, not_found_sign}, + {"s_super_hidden_ref_par_method", super_class_for_check, not_found_sign}, + {"i_super_overridden_void_method", super_class_for_check, not_found_sign}, + {"i_super_overridden_prim_method", super_class_for_check, not_found_sign}, + {"i_super_overridden_ref_method", super_class_for_check, not_found_sign}, + {"i_super_overridden_void_par_method", super_class_for_check, not_found_sign}, + {"i_super_overridden_prim_par_method", super_class_for_check, not_found_sign}, + {"i_super_overridden_ref_par_method", super_class_for_check, not_found_sign}, + {"i_multiple_inherited_method", super_class_for_check, not_found_sign}, + + {"i_interf_ref_method", interf_for_check, not_found_sign}, + {"i_interf_prim_method", interf_for_check, not_found_sign}, + {"i_interf_void_method", interf_for_check, not_found_sign}, + {"i_interf_overridden_void_method", interf_for_check, not_found_sign}, + {"i_interf_overridden_prim_method", interf_for_check, not_found_sign}, + {"i_interf_overridden_ref_method", interf_for_check, not_found_sign}, + {"i_interf_overridden_void_par_method", interf_for_check, not_found_sign}, + {"i_interf_overridden_prim_par_method", interf_for_check, not_found_sign}, + {"i_interf_overridden_ref_par_method", interf_for_check, not_found_sign}, + {"i_multiple_inherited_method", interf_for_check, not_found_sign} + + }; + + /** + * Re-call to run(args,out), 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 allmethods001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/allMethods/allmethods001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/allMethods/allmethods001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/allMethods/allmethods001 test LOG:"); + out_stream.println("==> test checks allMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allmethods001: allmethods001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> allmethods001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> allmethods001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allmethods001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> allmethods001: check ReferenceType.allMethods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean allMethods_method_error = false; + int methods_for_check_number = methods_for_check.length; + int not_found_methods_number = 0; + int all_methods_number = 0; + int unexpected_found_methods_number = 0; + int disregarded_all_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> allmethods001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List all_methods_list = null; + try { + all_methods_list = refType.allMethods(); + } + catch (Throwable thrown) { + out_stream.println("##> allmethods001: FAILED: ReferenceType.allMethods() throws unexpected " + + thrown); + allMethods_method_error = true; + break; + } + all_methods_number = all_methods_list.size(); + Method all_methods[] = new Method[all_methods_number]; + String unexpected_all_methods[] = new String[all_methods_number]; + all_methods_list.toArray(all_methods); + for (int i=0; i allmethods001: FAILED: method is NOT found: " + current_method_for_check); + not_found_methods_number++; + } + else { + print_log_on_verbose + ("--> allmethods001: PASSED for method: " + current_method_for_check); + } + } + for (int i=0; i allmethods001: FAILED: unexpected found method: " + unexpected_all_methods[i]); + } + break; + } + + out_stream.println("--> allmethods001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println("--> allmethods001: expected found methods number = " + methods_for_check_number); + out_stream.println("--> allmethods001: in fact found methods number = " + + (all_methods_number - disregarded_all_methods_number)); + out_stream.println("--> allmethods001: expected and in fact found methods number = " + + (methods_for_check_number - not_found_methods_number)); + out_stream.println + ("##> allmethods001: NOT found methods number = " + not_found_methods_number); + out_stream.println + ("##> allmethods001: UNEXPECTED found methods number = " + unexpected_found_methods_number); + } + if ( not_found_methods_number + unexpected_found_methods_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> allmethods001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> allmethods001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allmethods001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods001/TestDescription.java new file mode 100644 index 00000000000..75ee3609d46 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/allMethods/allmethods001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allMethods/allmethods001 test + * checks the allMethods() method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.allMethods() method is checked for methods of + * debugee's class which extends super class and implements interface. + * Debugee's class has both hidden and overridden methods which should + * present in Method list returned by the allMethods() method.. + * Each method is checked for method name and declaring class name. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allMethods.allmethods001 + * nsk.jdi.ReferenceType.allMethods.allmethods001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allMethods.allmethods001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods001a.java new file mode 100644 index 00000000000..963609fa7df --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods001a.java @@ -0,0 +1,248 @@ +/* + * 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.ReferenceType.allMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the allmethods001 JDI test. + */ + +public class allmethods001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.allMethods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "allmethods001aClassForCheck"; + + + 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 allmethods001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, allmethods001a.class.getClassLoader()); + print_log_on_verbose + ("--> allmethods001a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> allmethods001a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> allmethods001a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> allmethods001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allmethods001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allmethods001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> allmethods001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> allmethods001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +abstract class allmethods001aClassForCheck extends allmethods001aSuperClassForCheck implements allmethods001aInterfaceForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods without params + static void s_void_method() {} + static boolean s_boolean_method() {return true;} + static byte s_byte_method() {return (byte)1;} + static char s_char_method() {return (char)1;} + static double s_double_method() {return (double)100.99;} + static float s_float_method() {return (float)100.88;} + static int s_int_method() {return 100;} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + // static methods with params + static void s_void_par_method(boolean z) {} + static boolean s_boolean_par_method(boolean z) {return true;} + static byte s_byte_par_method(byte b) {return (byte)1;} + static char s_char_par_method(char ch) {return (char)1;} + static double s_double_par_method(double d) {return (double)100.99;} + static float s_float_par_method(float f) {return (float)100.88;} + static int s_int_par_method(int i) {return 100;} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + // other static methods + native static Object s_native_method(Object obj); + static synchronized Object s_synchr_method(Object obj) {return new Object();} + final static Object s_final_method(Object obj) {return new Object();} + private static Object s_private_method(Object obj) {return new Object();} + protected static Object s_protected_method(Object obj) {return new Object();} + public static Object s_public_method(Object obj) {return new Object();} + + // instance methods without params + void i_void_method() {} + boolean i_boolean_method() {return true;} + byte i_byte_method() {return (byte)1;} + char i_char_method() {return (char)1;} + double i_double_method() {return (double)100.99;} + float i_float_method() {return (float)100.88;} + int i_int_method() {return 100;} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + public void i_interf_overridden_void_method() {} + public int i_interf_overridden_prim_method() {return 100;} + public Object i_interf_overridden_ref_method() {return new Object();} + + // instance methods with params + void i_void_par_method(boolean z) {} + boolean i_boolean_par_method(boolean z) {return true;} + byte i_byte_par_method(byte b) {return (byte)1;} + char i_char_par_method(char ch) {return (char)1;} + double i_double_par_method(double d) {return (double)100.99;} + float i_float_par_method(float f) {return (float)100.88;} + int i_int_par_method(int i) {return 100;} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public void i_interf_overridden_void_par_method(int i) {} + public int i_interf_overridden_prim_par_method(int i) {return 100;} + public Object i_interf_overridden_ref_par_method(Object obj) {return new Object();} + + // other instance methods + abstract Object i_abstract_method(Object obj); + native Object i_native_method(Object obj); + synchronized Object i_synchr_method(Object obj) {return new Object();} + final Object i_final_method(Object obj) {return new Object();} + private Object i_private_method(Object obj) {return new Object();} + protected Object i_protected_method(Object obj) {return new Object();} + public Object i_public_method(Object obj) {return new Object();} + + // static initializer + static {} + + +} + +abstract class allmethods001aSuperClassForCheck { + + static void s_super_void_method(long l) {} + static long s_super_prim_method(long l) {return 100;} + static Object s_super_ref_method(Object obj) {return new Object();} + + void i_super_void_method(long l) {} + long i_super_prim_method(long l) {return 100;} + Object i_super_ref_method(Object obj) {return new Object();} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public Object i_multiple_inherited_method(Object obj) {return new Object();} + +} + +interface allmethods001aInterfaceForCheck { + + void i_interf_void_method(long l); + long i_interf_prim_method(long l); + Object i_interf_ref_method(Object obj); + + void i_interf_overridden_void_method(); + int i_interf_overridden_prim_method(); + Object i_interf_overridden_ref_method(); + + void i_interf_overridden_void_par_method(int i); + int i_interf_overridden_prim_par_method(int i); + Object i_interf_overridden_ref_par_method(Object obj); + + public Object i_multiple_inherited_method(Object obj); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002.java new file mode 100644 index 00000000000..27c6fc80138 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002.java @@ -0,0 +1,221 @@ +/* + * 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.ReferenceType.allMethods; + +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 allMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allmethods002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "allmethods002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "allmethods002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "allmethods002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** + * Re-call to run(args,out), 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 allmethods002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/allMethods/allmethods002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/allMethods/allmethods002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/allMethods/allmethods002 test LOG:"); + print_log_on_verbose("==> test checks allMethods() method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allmethods002: allmethods002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> allmethods002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> allmethods002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allmethods002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> allmethods002: check ReferenceType.allMethods() method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean allMethods_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> allmethods002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> allmethods002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List all_methods_list = null; + try { + all_methods_list = refType.allMethods(); + print_log_anyway + ("##> allmethods002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + allMethods_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> allmethods002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> allmethods002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + allMethods_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> allmethods002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> allmethods002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allmethods002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002/TestDescription.java new file mode 100644 index 00000000000..33e41215d2b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/allMethods/allmethods002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allMethods/allmethods002 test + * checks the allMethods() method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.allMethods() method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allMethods.allmethods002 + * nsk.jdi.ReferenceType.allMethods.allmethods002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allMethods.allmethods002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002/loadclass/allmethods002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002/loadclass/allmethods002aClassForCheck.java new file mode 100644 index 00000000000..f03c7101136 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002/loadclass/allmethods002aClassForCheck.java @@ -0,0 +1,69 @@ +/* + * 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.ReferenceType.allMethods; + +/** + * This class is loaded by allmethods002aClassLoader . + */ + +class allmethods002aClassForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods + static void s_void_method() {} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_void_par_method(boolean z) {} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + + // instance methods + void i_void_method() {} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_void_par_method(boolean z) {} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + // static initializer + static {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002a.java new file mode 100644 index 00000000000..0ea324a2aa5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.allMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the allmethods002 JDI test. + */ + +public class allmethods002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.allMethods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "allmethods002aClassForCheck"; + + 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 allmethods002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + allmethods002aClassLoader customClassLoader = new allmethods002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> allmethods002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> allmethods002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> allmethods002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allmethods002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allmethods002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> allmethods002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> allmethods002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class allmethods002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public allmethods002aClassLoader(String classPath, String className) { + super(allmethods002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003.java new file mode 100644 index 00000000000..7a9f4159396 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003.java @@ -0,0 +1,255 @@ +/* + * 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.ReferenceType.allMethods; + +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 allMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allmethods003 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allMethods.", + thisClassName = package_prefix + "allmethods003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "allmethods003b"; + + + /** + * Re-call to run(args,out), 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 allmethods003().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/allMethods/allmethods003 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/allMethods/allmethods003 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/allMethods/allmethods003 test LOG:"); + out_stream.println("--> test checks allMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allmethods003: allmethods003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> allmethods003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> allmethods003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allmethods003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> allmethods003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> allmethods003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allmethods003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean allMethods_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> allmethods003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> allmethods003: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> allmethods003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> allmethods003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> allmethods003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> allmethods003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> allmethods003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.allMethods() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> allmethods003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allmethods003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> allmethods003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> allmethods003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> allmethods003: check that checked class has been unloaded realy..."); + out_stream.println + ("--> allmethods003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.allMethods() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> allmethods003: check ReferenceType.allMethods() method for unloaded class..."); + List all_methods_list = null; + try { + all_methods_list = refType.allMethods(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> allmethods003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> allmethods003: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + allMethods_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> allmethods003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> allmethods003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allmethods003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of allmethods003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/TestDescription.java new file mode 100644 index 00000000000..bf5af306fa7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/TestDescription.java @@ -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/ReferenceType/allMethods/allmethods003. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allMethods/allmethods003 test + * checks the allMethods() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * allMethods() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - allmethods003b class was moved in 'loadclass' subdirectory; + * - package name was added in allmethods003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for allmethods003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allMethods.allmethods003 + * nsk.jdi.ReferenceType.allMethods.allmethods003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allMethods.allmethods003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/loadclass/allmethods003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/loadclass/allmethods003b.java new file mode 100644 index 00000000000..7bfae1c30fa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003/loadclass/allmethods003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the allMethods() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.allMethods; + +class allmethods003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003a.java new file mode 100644 index 00000000000..f8a7af6b717 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods003a.java @@ -0,0 +1,118 @@ +/* + * 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.ReferenceType.allMethods; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the allmethods003 JDI test. + */ + +public class allmethods003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + static String package_prefix = "nsk.jdi.ReferenceType.allMethods."; + static String checked_class_name = package_prefix + "allmethods003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> allmethods003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> allmethods003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> allmethods003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> allmethods003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> allmethods003a: checked class NOT loaded:" + checked_class_name); + // Debugger finds this fact itself + } + + print_log_on_verbose("**> allmethods003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allmethods003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allmethods003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> allmethods003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> allmethods003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> allmethods003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> allmethods003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> allmethods003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> allmethods003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> allmethods003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allmethods003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allmethods003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> allmethods003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> allmethods003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of allmethods003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004.java new file mode 100644 index 00000000000..bd654bd8585 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004.java @@ -0,0 +1,205 @@ +/* + * 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.ReferenceType.allMethods; + +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 allMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class allmethods004 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.allMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "allmethods004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "allmethods004aInterfaceForCheck"; + + /** + * Re-call to run(args,out), 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 allmethods004().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/allMethods/allmethods004 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/allMethods/allmethods004 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/allMethods/allmethods004 test LOG:"); + out_stream.println("==> test checks allMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for class without any methods\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> allmethods004: allmethods004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> allmethods004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> allmethods004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> allmethods004: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> allmethods004: check ReferenceType.allMethods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean allMethods_method_error = false; + int all_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> allmethods004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List all_methods_list = null; + try { + all_methods_list = refType.allMethods(); + } + catch (Throwable thrown) { + out_stream.println("##> allmethods004: FAILED: ReferenceType.allMethods() throws unexpected " + + thrown); + allMethods_method_error = true; + break; + } + all_methods_number = all_methods_list.size(); + if ( all_methods_number == 0 ) { + break; + } + Method all_methods[] = new Method[all_methods_number]; + all_methods_list.toArray(all_methods); + for (int i=0; i allmethods004: FAILED: unexpected found method: " + full_checked_method_info); + } + break; + } + + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || allMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + if ( all_methods_number > 0 ) { + out_stream.println + ("##> allmethods004: UNEXPECTED all methods number = " + all_methods_number); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> allmethods004: PASSED: returned list of methods is empty!"); + } + + print_log_on_verbose("--> allmethods004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> allmethods004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> allmethods004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004/TestDescription.java new file mode 100644 index 00000000000..08b899b7ed3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/ReferenceType/allMethods/allmethods004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/allMethods/allmethods004 test + * checks the allMethods() method of ReferenceType interface + * of the com.sun.jdi package for class without any methods: + * the ReferenceType.allMethods() method is checked for + * debugee's interface which does not contain any methods. + * The test expects the returned list of methods to be empty. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.allMethods.allmethods004 + * nsk.jdi.ReferenceType.allMethods.allmethods004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allMethods.allmethods004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004a.java new file mode 100644 index 00000000000..c7d94273b10 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods004a.java @@ -0,0 +1,81 @@ +/* + * 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.ReferenceType.allMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the allmethods004 JDI test. + */ + +public class allmethods004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 allmethods004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + allmethods004aClassForCheck class_for_check = new allmethods004aClassForCheck(); + + print_log_on_verbose("**> allmethods004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> allmethods004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> allmethods004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> allmethods004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> allmethods004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class allmethods004aClassForCheck implements allmethods004aInterfaceForCheck { + +} + +interface allmethods004aInterfaceForCheck { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods005.java new file mode 100644 index 00000000000..667cfb939e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods005.java @@ -0,0 +1,286 @@ +/* + * 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.ReferenceType.allMethods; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.allMethod() + * properly returns an empty list for arrays (ArrayType) and primitive + * classes.

    + * + * Debugger part of it attempts to get a list of all methods in several + * reference types corresponding to debuggee field values, which are:
    + * primitive classes themselves, and arrays of primitive types and classes. + */ +public class allmethods005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.allMethods.allmethods005t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested fields used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new allmethods005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "allmethods005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i " + 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 < 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(); + + // check existence of inherited methods for this enum type + List l = checkedClass.allMethods(); + if (l.isEmpty()) { + complain("\t ReferenceType.allMethods() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + Vector methodNames = new Vector(); + Iterator it = l.iterator(); + while (it.hasNext()) { + methodNames.add(it.next().name()); + } + + for (int i = 0; i < testedMethodNames.length; i++) { + String methodName = testedMethodNames[i]; + if (methodNames.contains(methodName)) { + display("CHECK" + (i+1) + " PASSED: " + className + " has method " + methodName); + } else { + complain("CHECK" + (i+1) + " FAILED: " + className + " does not have method " + methodName); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006/TestDescription.java new file mode 100644 index 00000000000..59c881b5bba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006/TestDescription.java @@ -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/ReferenceType/allMethods/allmethods006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for allMethods() method of ReferenceType interface. + * The test checks if this method returns all methods declared + * in java.lang.Enum for any mirrored enum type. + * The java.lang.Enum class is superclass for each enum type. + * The test checks existence of methods with following names in + * returned List: + * clone(), + * compareTo(E o), + * equals(Object o), + * getDeclaringClass(), + * hashCode(), + * name(), + * ordinal(), + * toString() + * The test consists of a debugger program (allmethods006.java) + * and debugged application (allmethods006a.java). + * Package name is nsk.jdi.ReferenceType.allMethods . + * 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 allMethods() method for each field + * of enum type declared in allmethods006a class. + * The debugger checks if each of expected method name exists + * in returned list. The test fails if any of expected method + * names has not been met. + * 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.ReferenceType.allMethods.allmethods006 + * nsk.jdi.ReferenceType.allMethods.allmethods006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.allMethods.allmethods006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006a.java new file mode 100644 index 00000000000..e88f3619749 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006a.java @@ -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.ReferenceType.allMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class allmethods006a { + + //------------------------------------------------------- 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 allmethods006Enum1 f1 = allmethods006Enum1.e2; + static allmethods006Enum2 f2 = allmethods006Enum2.e1; + static allmethods006Enum1.Enum1_ f3 = allmethods006Enum1.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(allmethods006.SIGNAL_READY); + + + //pipe.println(allmethods006.SIGNAL_GO); + receiveSignal(allmethods006.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum allmethods006Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum allmethods006Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availableStrata002/availableStrata002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availableStrata002/availableStrata002.java new file mode 100644 index 00000000000..e3082692338 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availableStrata002/availableStrata002.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/availableStrata/availableStrata002. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.ReferenceType.availableStrata()' returns all available stratums defined for class. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3'). Then debugger forces debuggee to load 'TestClass1' from updated class file, + * obtains ReferenceType for this class and checks up that method 'com.sun.jdi.ReferenceType.availableStrata()' returns all following stratums: + * 'Java', 'TestStratum1', 'TestStratum2', 'TestStratum3'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.availableStrata.availableStrata002.availableStrata002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.availableStrata.availableStrata002.availableStrata002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.ReferenceType.availableStrata.availableStrata002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class availableStrata002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new availableStrata002().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type1( + className, + testStratumCount, + true); + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + List expectedStratums = new ArrayList(); + expectedStratums.addAll(testStratumData.keySet()); + + check_ReferenceType_availableStrata(referenceType, expectedStratums); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java new file mode 100644 index 00000000000..ff5c08b2614 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java @@ -0,0 +1,220 @@ +/* + * 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.ReferenceType.availableStrata; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.availableStrata()
    + * complies with its specification.
    + *
    + * The case for testing includes a class file with the base
    + * startum. The test checks that List returned by the method
    + * availableStrata():
    + * - contains only one String element;
    + * - the element is equal to one returned by the method
    + * ReferenceType.defaultStratum()
    + *
    + */ + +public class availablestrata001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/availableStrata/availablestrata001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new availablestrata001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.availableStrata.availablestrata001a"; + + //String mName = "nsk.jdi.ReferenceType.availableStrata"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = vm.classesByName(debuggeeName); + + testedClass = (ReferenceType) classes.get(0); + + log2("......getting List of availableStrata"); + List availableStrata = testedClass.availableStrata(); + int size = availableStrata.size(); + + log2(" checking up on size of List availableStrata; 1 is expected"); + if (size != 1) { + log3("ERROR: availableStrata.size() != 1 : " + size); + testExitCode = FAILED; + } else { + + String stratum = (String) availableStrata.get(0); + String defaultStratum = testedClass.defaultStratum(); + + log2("...... compareing stratum from the List to defaultStratum"); + if (!stratum.equals(defaultStratum)) { + log3("ERROR: stratum is not equal to defaultStratum()"); + log3(" stratum == " + stratum); + log3(" defaultStratum == " + defaultStratum); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001/TestDescription.java new file mode 100644 index 00000000000..46071c73951 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001/TestDescription.java @@ -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/ReferenceType/availableStrata/availablestrata001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.availableStrata() + * complies with its spec: + * public List availableStrata() + * Return the available strata for this reference type. + * See the Location for a description of strata. + * Returns: List of java.lang.String, each representing a stratum + * The case for testing includes List containing only defaultStratum. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.availableStrata.availablestrata001; + * the debuggee program - nsk.jdi.ReferenceType.availableStrata.availablestrata001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.availableStrata.availablestrata001 + * nsk.jdi.ReferenceType.availableStrata.availablestrata001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.availableStrata.availablestrata001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001a.java new file mode 100644 index 00000000000..1675964cafc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001a.java @@ -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.ReferenceType.availableStrata; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the availablestrata001 JDI test. + */ + +public class availablestrata001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } +/* + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } +*/ + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.classLoader()
    + * complies with its spec.
    + *
    + * The case for testing includes a classLoader object for type
    + * loaded through the bootstrap class loader.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class classloader001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/classLoader/classloader001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new classloader001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private final static String packagePrefix = "nsk.jdi.ReferenceType.classLoader."; + private final static String debuggeeName = packagePrefix + "classloader001a"; + private final static String testedClassName0 = packagePrefix + "classloader001b"; + private final static String testedClassName1 = packagePrefix + "classloader001c"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + checkClassLoader (testedClassName0, false); + break; + + case 1: + checkClassLoader (testedClassName1, true); + break; + + default : + throw new JDITestRuntimeException("Wrong test case :" + i); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private void checkClassLoader (String testedClassName, boolean nullExpected) { + log2(" name of tested class : " + testedClassName); + List classes = vm.classesByName(testedClassName); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + return; + } + ReferenceType testedClass = (ReferenceType) classes.get(0); + if (testedClass == null) { + log3("ERROR: testedClass == null"); + testExitCode = FAILED; + } + if (nullExpected) { + log2(" checking: testedClass.classLoader(); expected result is null"); + if (testedClass.classLoader() != null) { + log3("ERROR: method classLoader() returns not null for " + testedClass.name()); + testExitCode = FAILED; + } + } else { + log2(" checking: testedClass.classLoader(); expected result is not null"); + if (testedClass.classLoader() == null) { + log3("ERROR: method classLoader() returns null for " + testedClass.name()); + testExitCode = FAILED; + } + } + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/TestDescription.java new file mode 100644 index 00000000000..6383b112fdc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/TestDescription.java @@ -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/ReferenceType/classLoader/classloader001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.classLoader() + * complies with its spec: + * public ClassLoaderReference classLoader() + * Gets the classloader object which loaded the class corresponding to this type. + * Returns: a ClassLoaderReference which mirrors the classloader, or null + * if the class was loaded through the bootstrap class loader. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.classLoader.classloader001; + * the debuggee program - nsk.jdi.ReferenceType.classLoader.classloader001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was modified due to fix of the bug: + * 4499917 ReferenceType.classLoader() returns non-null for the bootstrap CL + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.classLoader.classloader001 + * nsk.jdi.ReferenceType.classLoader.classloader001a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass loadclass1 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.classLoader.classloader001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts} + * -Xbootclasspath/a:./bin/loadclass1" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/loadclass/classloader001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/loadclass/classloader001b.java new file mode 100644 index 00000000000..3f0a90fbdc1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/loadclass/classloader001b.java @@ -0,0 +1,28 @@ +/* + * 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. + */ + +// this class will be loaded by bootstarp class loader + +package nsk.jdi.ReferenceType.classLoader; + +class classloader001b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/loadclass1/classloader001c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/loadclass1/classloader001c.java new file mode 100644 index 00000000000..8aaad149b83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001/loadclass1/classloader001c.java @@ -0,0 +1,28 @@ +/* + * 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. + */ + +// this class will be loaded by bootstrap class loader + +package nsk.jdi.ReferenceType.classLoader; + +class classloader001c {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001a.java new file mode 100644 index 00000000000..44a9a877cae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classLoader/classloader001a.java @@ -0,0 +1,154 @@ +/* + * 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.ReferenceType.classLoader; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * This class is used as debuggee application for the classloader001 JDI test. + */ + +public class classloader001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 2; // 1; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + private final static String packagePrefix = "nsk.jdi.ReferenceType.classLoader."; + private final static String testedClassName0 = packagePrefix + "classloader001b"; + private final static String testedClassName1 = packagePrefix + "classloader001c"; + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + ArgumentHandler argHandler = new ArgumentHandler(argv); + String checkedClassDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + // Load class by custom class loader + ClassUnloader classUnloader = new ClassUnloader(); + try { + classUnloader.loadClass(testedClassName0, checkedClassDir); + Class loadedClass = classUnloader.getLoadedClass(); + if (loadedClass == null) { + throw new Failure("classUnloader.getLoadedClass() returned null"); + } + if (loadedClass.getClassLoader() == null) { + throw new Failure("loadedClass.getClassLoader() returned null"); + } + log1("checked class : " + loadedClass.toString() + " loaded by custom class loader"); + } catch ( Exception e ) { // ClassNotFoundException + logErr("Unexpected exception thrown while trying to load " + testedClassName0 + " : " + e); + exitCode = FAILED; + } + methodForCommunication(); + break ; + + case 1: + + Class testClass = null; + // Load class by bootstrap class loader + try { + testClass = Class.forName(testedClassName1, true, null); + if (testClass.getClassLoader() != null) { + logErr(testedClassName1 + " is not loaded by bootstrap class loader"); + exitCode = FAILED; + } + } catch (Exception e) { + logErr("Unexpected exception while trying to load " + testedClassName1 + " : " + e); + exitCode = FAILED; + } + methodForCommunication(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001.java new file mode 100644 index 00000000000..2052b5aaa3d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001.java @@ -0,0 +1,228 @@ +/* + * 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.ReferenceType.classObject; + +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 classObject() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class classobj001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.classObject.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "classobj001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + + {"boolean", "primitive_type", "class"}, + {"byte" , "primitive_type", "class"}, + {"char" , "primitive_type", "class"}, + {"double" , "primitive_type", "class"}, + {"float" , "primitive_type", "class"}, + {"int" , "primitive_type", "class"}, + {"long" , "primitive_type", "class"}, + + {"java.lang.Boolean" , "reference_type", "class"}, + {"java.lang.Byte" , "reference_type", "class"}, + {"java.lang.Character", "reference_type", "class"}, + {"java.lang.Double" , "reference_type", "class"}, + {"java.lang.Float" , "reference_type", "class"}, + {"java.lang.Integer" , "reference_type", "class"}, + {"java.lang.Long" , "reference_type", "class"}, + {"java.lang.String" , "reference_type", "class"}, + {"java.lang.Object" , "reference_type", "class"}, + + {debugeeName+"$s_class", "reference_type", "class"}, // static class + {debugeeName+"$s_interf", "reference_type", "interface"}, // static interface + + {package_prefix + "package_class", "reference_type", "class"}, // class + {package_prefix + "package_interf", "reference_type", "interface"} // interface + + }; + + /** + * Re-call to run(args,out), 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 classobj001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/classObject/classobj001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/classObject/classobj001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/classObject/classobj001 test LOG:"); + out_stream.println("==> test checks classObject() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for ArraType, ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> classobj001: classobj001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> classobj001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> classobj001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> classobj001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> classobj001: check ReferenceType.classObject() method for debugee's classes"); + out_stream.println + (" with help of ClassObjectReference.reflectedType() method..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int classObject_method_errors = 0; + for (int i=0; i classobj001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String s_type = classes_for_check[i][2]; + if ( array_measure != 0 ) { // array type + s_type = "class"; + } + ClassObjectReference class_obj_ref = refType.classObject(); + ReferenceType reflected_refType = class_obj_ref.reflectedType(); + if ( ! refType.equals(reflected_refType) ) { + out_stream.println + ("##> classobj001: FAILED: source ReferenceType object is NOT equal to reflected object"); + out_stream.println + ("##> for " + s_type + ": " + className); + classObject_method_errors++; + } + else { + print_log_on_verbose + ("--> classobj001: PASSED: source ReferenceType object is equal to reflected object"); + print_log_on_verbose + ("--> for " + s_type + ": " + className); + } + } + } + out_stream.println("--> classobj001: check completed!"); + out_stream.println("--> classobj001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + out_stream.println("##> classobj001: \"class not found ERRORS\" counter = " + + class_not_found_errors); + } + out_stream.println("##> classobj001: classObject() method ERRORS counter = " + + classObject_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + classObject_method_errors > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> classobj001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> classobj001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> classobj001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001/TestDescription.java new file mode 100644 index 00000000000..2eb623dea91 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001/TestDescription.java @@ -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/ReferenceType/classObject/classobj001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/classObject/classobj001 test + * checks the classObject() method of ReferenceType interface + * of the com.sun.jdi package for ArraType, ClassType, InterfaceType: + * The ReferenceType.classObject() method is checked for debugee's classes + * with help of ClassObjectReference.reflectedType() method by comparing + * source ReferenceType object with reflected ReferenceType object. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.classObject.classobj001 + * nsk.jdi.ReferenceType.classObject.classobj001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.classObject.classobj001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001a.java new file mode 100644 index 00000000000..baac6343384 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj001a.java @@ -0,0 +1,120 @@ +/* + * 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.ReferenceType.classObject; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the classobj001 JDI test. + */ + +public class classobj001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + 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}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static class s_class {} + static interface s_interf {} + static class s_interf_impl implements s_interf {} + s_interf_impl sii0 = new s_interf_impl(); + + s_class s_class0 = new s_class(), s_class1[]={s_class0}, + s_class2[][]={s_class1}; + s_interf s_interf0, s_interf1[]={s_interf0}, s_interf2[][]={s_interf1}; + + package_class package_class0 = new package_class(), + package_class1[]={package_class0}, + package_class2[][]={package_class1}; + package_interf_impl pii0 = new package_interf_impl(); + package_interf package_interf0, package_interf1[]={package_interf0}, + package_interf2[][]={package_interf1}; + + 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 classobj001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + classobj001a classobj001a_obj = new classobj001a(); + + print_log_on_verbose("**> classobj001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> classobj001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> classobj001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> classobj001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> classobj001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** simple class */ +class package_class {} + +/** simple interface */ +interface package_interf {} + +/** Class that implements simple interface */ +class package_interf_impl implements package_interf {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002.java new file mode 100644 index 00000000000..8154c448fbc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002.java @@ -0,0 +1,254 @@ +/* + * 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.ReferenceType.classObject; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +/** + * This test checks the method classObject() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class classobj002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.classObject.", + thisClassName = package_prefix + "classobj002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "classobj002b"; + + + /** + * Re-call to run(args,out), 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 classobj002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/classObject/classobj002 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/classObject/classobj002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/classObject/classobj002 test LOG:"); + out_stream.println("--> test checks classObject() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> classobj002: classobj002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> classobj002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> classobj002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> classobj002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> classobj002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> classobj002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> classobj002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean classObject_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> classobj002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> classobj002: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> classobj002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> classobj002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> classobj002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> classobj002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> classobj002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.classObject() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> classobj002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> classobj002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> classobj002: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> classobj002: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> classobj002: check that checked class has been unloaded realy..."); + out_stream.println + ("--> classobj002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.classObject() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> classobj002: check ReferenceType.classObject() method for unloaded class..."); + ClassObjectReference class_obj_ref = null; + try { + class_obj_ref = refType.classObject(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> classobj002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> classobj002: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + classObject_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || classObject_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> classobj002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> classobj002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> classobj002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of classobj002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/TestDescription.java new file mode 100644 index 00000000000..ede39567c3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/TestDescription.java @@ -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/ReferenceType/classObject/classobj002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/classObject/classobj002 test + * checks the classObject() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * classObject() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - classobj002b class was moved in 'loadclass' subdirectory; + * - package name was added in classobj002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for classobj002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.classObject.classobj002 + * nsk.jdi.ReferenceType.classObject.classobj002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.classObject.classobj002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/loadclass/classobj002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/loadclass/classobj002b.java new file mode 100644 index 00000000000..60eb6fb6b94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002/loadclass/classobj002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the classObject() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.classObject; + +class classobj002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002a.java new file mode 100644 index 00000000000..2d9b1bce94d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj002a.java @@ -0,0 +1,118 @@ +/* + * 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.ReferenceType.classObject; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the classobj002 JDI test. + */ + +public class classobj002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.classObject."; + private final static String checked_class_name = package_prefix + "classobj002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> classobj002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> classobj002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> classobj002a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> classobj002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> classobj002a: checked class NOT loaded:" + checked_class_name); + // Debugger finds this fact itself + } + + print_log_on_verbose("**> classobj002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> classobj002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> classobj002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("##> classobj002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("##> classobj002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> classobj002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> classobj002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> classobj002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> classobj002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> classobj002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> classobj002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> classobj002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> classobj002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> classobj002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of classobj002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003.java new file mode 100644 index 00000000000..facbe38b780 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003.java @@ -0,0 +1,139 @@ +/* + * 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.ReferenceType.classObject; + +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 classobj003 { + + //------------------------------------------------------- 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.ReferenceType.classObject."; + private final static String className = "classobj003"; + 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", "f5", "f6", "f7", "f8"}; + + //------------------------------------------------------- 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 < 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(); + ClassObjectReference checkedClassObject = checkedClass.classObject(); + String className = checkedClass.name(); + if (checkedClassObject == null) { + complain("ReferenceType.classObject() returned null for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else if (checkedClass.equals(checkedClassObject.reflectedType())) { + display("ReferenceType.classObject() returned expected object for type: " + className); + } else { + complain("CHECK FAILED for " + className); + complain("\t ReferenceType.classObject() returned unexpected object : " + checkedClassObject.toString()); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003/TestDescription.java new file mode 100644 index 00000000000..38a811f7472 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ReferenceType/classObject/classobj003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test checks classObject() method of ReferenceType interface + * for mirrored enum types + * The test consists of a debugger program (classObject001.java) + * and debuggee application (classObject001a.java). + * Package name is nsk.jdi.ReferenceType.classObject . + * 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 classObject() method for each field + * of enum type declared in isfinal002a class. + * The test fails if source ReferenceType object is not equal + * to reflected ReferenceType object. + * 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.ReferenceType.classObject.classobj003 + * nsk.jdi.ReferenceType.classObject.classobj003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.classObject.classobj003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003a.java new file mode 100644 index 00000000000..ab7e743d581 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003a.java @@ -0,0 +1,167 @@ +/* + * 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.ReferenceType.classObject; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class classobj003a { + + //------------------------------------------------------- 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; + static Enum4.Enum4_ f4 = Enum4.Enum4_.e1; + static classobj003Enum5 f5 = classobj003Enum5.e2; + static classobj003Enum6 f6 = classobj003Enum6.e1; + static classobj003Enum7 f7 = classobj003Enum7.e2; + static classobj003Enum8.Enum8_ f8 = classobj003Enum8.Enum8_.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(classobj003.SIGNAL_READY); + + + //pipe.println(classobj003.SIGNAL_GO); + receiveSignal(classobj003.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + + enum Enum1 { + e1, e2; + } + + enum Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); + } + + enum Enum3 implements classobj003i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); + } + + enum Enum4 { + e1, e2; + + enum Enum4_ { + e1, e2; + } + } + +} + +//--------------------------------------------------------- test specific classes + +enum classobj003Enum5 { + e1, e2; +} + +enum classobj003Enum6 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum classobj003Enum7 implements classobj003i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +enum classobj003Enum8 { + e1, e2; + enum Enum8_ { + e1, e2; + } +} + +interface classobj003i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum002/defaultStratum002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum002/defaultStratum002.java new file mode 100644 index 00000000000..a113464e364 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum002/defaultStratum002.java @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/defaultStratum/defaultStratum002. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that default stratum specified in class file affects result of following methods: + * - ReferenceType.defaultStratum() + * - ReferenceType.sourceName() + * - ReferenceType.allLineLocations() + * - ReferenceType.locationsOfLine(int lineNumber) + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined: + * "Java" "TestStratum" + * + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... ... + * 16 --> 1007, source1 + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... ... + * 27 --> 1107, source1 + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... ... + * 38 --> 1207, source1 + * Stratum 'TestStratum1' is specified as default for 'TestClass1'. + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that following methods: + * - ReferenceType.defaultStratum() + * - ReferenceType.sourceName() + * - ReferenceType.allLineLocations() + * - ReferenceType.locationsOfLine(int lineNumber) + * returns information for 'TestStratum1'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.defaultStratum.defaultStratum002.defaultStratum002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.defaultStratum.defaultStratum002.defaultStratum002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.ReferenceType.defaultStratum.defaultStratum002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.sde.*; + +public class defaultStratum002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new defaultStratum002().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type1( + className, + testStratumCount, + false); + /* + * Method 'prepareDefaultPatchedClassFile_Type1' creates class file with + * following line mapping: "Java" "TestStratum" + * + * + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... + * ... + * 16 --> 1007, source1 + * + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... + * ... + * 27 --> 1107, source1 + * + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... + * ... + * 38 --> 1207, source1 + */ + + String defaultStratum = null; + + // find wich stratum was set default + // (prepareDefaultPatchedClassFile_Type1 should set default first + // not-java stratum) + for (LocationsData locationsData : testStratumData.values()) { + if (locationsData.isDefault) { + defaultStratum = locationsData.stratumName; + break; + } + } + + if (defaultStratum == null || defaultStratum.equals(javaStratumName)) { + throw new TestBug("Class file with default not-java stratum was not generated"); + } + + log.display("Default stratum for '" + className + "' is '" + defaultStratum + "'"); + log.display("Result of VirtualMachine.getDefaultStratum() is '" + vm.getDefaultStratum() + "'"); + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + String actualDefaultStratum = referenceType.defaultStratum(); + + if (!actualDefaultStratum.equals(defaultStratum)) { + setSuccess(false); + log.complain("ReferenceType.defaultStratum() returns unexpected value: " + actualDefaultStratum + + ", expected is " + defaultStratum); + } + + LocationsData locationsData = testStratumData.get(defaultStratum); + checkReferenceType( + null, + referenceType, + locationsData.sourceNames(), + locationsData.paths, + locationsData.allLocations); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum003/defaultStratum003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum003/defaultStratum003.java new file mode 100644 index 00000000000..9b2d3a8172d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum003/defaultStratum003.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ReferenceType/defaultStratum/defaultStratum003. + * VM Testbase keywords: [jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that default stratum specified in class file affects StepEvents generation. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined: + * "Java" "TestStratum" + * + * 9 --> 1000, source1 + * 11 --> 1002, source1 + * ... ... + * sde_testMethod1 + * 20 --> 1100, source1 + * 22 --> 1101, source1 + * ... ... + * sde_testMethod1 + * 31 --> 1200, source1 + * 33 --> 1201, source1 + * ... ... + * Stratum 'TestStratum1' is specified as default for 'TestClass1'. + * Then debugger forces debuggee to load 'TestClass1' from updated class file, starts event listener thread which saves all received StepEvents, + * enables StepEvent request(class filter is used to receive events only for 'TestClass1') and forces debuggee to execute all methods defined in 'TestClass1'. + * When all methods was executed debugger checks up that StepEvents was generated for all locations specified for 'TestStratum1'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.defaultStratum.defaultStratum003.defaultStratum003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.defaultStratum.defaultStratum003.defaultStratum003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.ReferenceType.defaultStratum.defaultStratum003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.request.StepRequest; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.EventHandler; +import nsk.share.jdi.sde.*; + +public class defaultStratum003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new defaultStratum003().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + private EventHandler eventHandler; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type3( + className, + testStratumCount, + false); + /* + * Method 'prepareDefaultPatchedClassFile_Type3' creates class file with + * following line mapping for each test stratum: + * + * "Java" "TestStratum" + * + * + * 9 --> 1001, source1 + * 11 --> 1002, source1 + * 14 --> 1003, source1 + * 16 --> 1004, source1 + * + * sde_testMethod1 + * 20 --> 1101, source1 + * 22 --> 1102, source1 + * 24 --> 1103, source1 + * 26 --> 1104, source1 + * + * sde_testMethod2 + * 31 --> 1201, source1 + * 33 --> 1202, source1 + * 35 --> 1203, source1 + * 37 --> 1204, source1 + */ + + String defaultStratum = null; + + // find wich stratum was set default + // (prepareDefaultPatchedClassFile_Type3 should set default first + // not-java stratum) + for (LocationsData locationsData : testStratumData.values()) { + if (locationsData.isDefault) { + defaultStratum = locationsData.stratumName; + break; + } + } + + if (defaultStratum == null || defaultStratum.equals(javaStratumName)) { + throw new TestBug("Class file with default not-java stratum was not generated"); + } + + initDefaultBreakpoint(); + + // check that events are generated for default stratum + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + StepEventListener stepEventListener = new StepEventListener(); + eventHandler.addListener(stepEventListener); + + StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest( + debuggee.threadByName(SDEDebuggee.mainThreadName), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + stepRequest.setSuspendPolicy(StepRequest.SUSPEND_EVENT_THREAD); + stepRequest.addClassFilter(TestClass1.class.getName()); + stepRequest.enable(); + + pipe.println(SDEDebuggee.COMMAND_EXECUTE_TEST_METHODS + ":" + className); + + if (!isDebuggeeReady()) + return; + + stepEventListener.waitBreakpointEvent(); + + compareLocations( + stepEventListener.stepLocations(), + testStratumData.get(defaultStratum).allLocations, + defaultStratum); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass1.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass1.java new file mode 100644 index 00000000000..032bd0d094c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass1.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 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.ReferenceType.defaultStratum.defaultStratum004; + +// THIS TEST IS LINE NUMBER SENSITIVE + +// Class contains method with several locations, do not edit this file because of line numbers are hardcoded in tests +public class TestClass1 +{ + public TestClass1() + { + super(); // testStratumData::doTest()::testStratumData->at(0) + int i = 0; + i++; // testStratumData::doTest()::testStratumData->at(1) + i++; + i++; + i++; // testStratumData::doTest()::testStratumData->at(2) + i++; + } // testStratumData::doTest()::testStratumData->at(3) +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass2.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass2.java new file mode 100644 index 00000000000..3586101ef00 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass2.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 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.ReferenceType.defaultStratum.defaultStratum004; + +// THIS TEST IS LINE NUMBER SENSITIVE + +// Class contains method with several locations, do not edit this file because of line numbers are hardcoded in tests +public class TestClass2 +{ + public TestClass2() + { + super(); // testStratumData::doTest()::testStratumData->at(0) + int i = 0; // testStratumData::doTest()::testStratumData->at(1) + i++; // testStratumData::doTest()::testStratumData->at(2) + i++; // testStratumData::doTest()::testStratumData->at(3) + i++; // testStratumData::doTest()::testStratumData->at(4) + i++; // testStratumData::doTest()::testStratumData->at(5) + i++; // testStratumData::doTest()::testStratumData->at(6) + } // testStratumData::doTest()::testStratumData->at(7) +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass3.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass3.java new file mode 100644 index 00000000000..32c7e31bf15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/TestClass3.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007, 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.ReferenceType.defaultStratum.defaultStratum004; + +// THIS TEST IS LINE NUMBER SENSITIVE + +// Class contains method with several locations, do not edit this file because of line numbers are hardcoded in tests +public class TestClass3 +{ + public TestClass3() + { + super(); // testStratumData::doTest()::testStratumData->at(0) + int i = 0; + i++; + i++; + i++; + i++; + i++; + } // testStratumData::doTest()::testStratumData->at(1) +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/defaultStratum004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/defaultStratum004.java new file mode 100644 index 00000000000..9c49323d794 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/defaultStratum004.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ReferenceType/defaultStratum/defaultStratum004. + * VM Testbase keywords: [jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test scenario: + * Debugger creates copies of 3 class files for classes defined in test's package: 'TestClass1'-'TestClass3'. + * SourceDebugExtension attribute is added for all this classes, for all classes different line mapping is defined + * add different default stratums are specified. + * Then debugger forces debuggee to load 'TestClass1'-'TestClass3' from updated class files and starts event listener thread which saves all received StepEvents. + * Then for TestedClass in 'TestClass1'-'TestClass3': + * - enables StepEvent request(class filter is used to receive events only for TestedClass) + * - forces debuggee to execute constructor of TestedClass + * - when constructor was executed debugger checks up that StepEvents was generated for all locations specified for stratum specified as default in TestedClass + * done + * Described event generation is performed 3 times. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.defaultStratum.defaultStratum004.defaultStratum004 + * nsk.jdi.ReferenceType.defaultStratum.defaultStratum004.defaultStratum004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.defaultStratum.defaultStratum004.defaultStratum004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.ReferenceType.defaultStratum.defaultStratum004; + +import java.io.*; +import java.util.*; +import com.sun.jdi.request.StepRequest; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.EventHandler; +import nsk.share.jdi.sde.*; + +public class defaultStratum004 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new defaultStratum004().runIt(argv, out); + } + + protected String debuggeeClassName() { + if (classpath == null) { + throw new TestBug("Debugger requires 'testClassPath' parameter"); + } + + return defaultStratum004a.class.getName() + " -testClassPath " + testWorkDir; + } + + private EventHandler eventHandler; + + protected List preparePatchedClassFile(String className, String stratumName, String sourceName, + String sourcePath, List testStratumData) { + String smapFileName = "TestSMAP.smap"; + SmapGenerator smapGenerator = new SmapGenerator(); + + SmapStratum smapStratum = new SmapStratum(stratumName); + + smapStratum.addFile(sourceName, sourcePath); + + for (DebugLocation debugLocation : testStratumData) { + smapStratum.addLineData(debugLocation.inputLine, sourceName, 1, debugLocation.outputLine, 1); + } + + // set as default stratum + smapGenerator.addStratum(smapStratum, true); + + savePathcedClassFile(className, smapGenerator, smapFileName); + + return testStratumData; + } + + Map> classLocations = new TreeMap>(); + + public void doTest() { + String sourceName = testStratumSourceName; + String sourcePath = testStratumSourcePath; + String methodName = ""; + + String className = TestClass1.class.getName(); + String stratumName = className + "_Stratum"; + List testStratumData = new ArrayList(); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1001, 32)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1002, 34)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1003, 37)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1004, 39)); + preparePatchedClassFile(className, stratumName, sourceName, sourcePath, testStratumData); + classLocations.put(className, testStratumData); + + className = TestClass2.class.getName(); + stratumName = className + "_Stratum"; + testStratumData = new ArrayList(); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1001, 32)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1002, 33)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1003, 34)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1004, 35)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1005, 36)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1006, 37)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1007, 38)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1008, 39)); + preparePatchedClassFile(className, stratumName, sourceName, sourcePath, testStratumData); + classLocations.put(className, testStratumData); + + className = TestClass3.class.getName(); + stratumName = className + "_Stratum"; + testStratumData = new ArrayList(); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1001, 32)); + testStratumData.add(new DebugLocation(sourceName, sourcePath, methodName, 1008, 39)); + preparePatchedClassFile(className, stratumName, sourceName, sourcePath, testStratumData); + classLocations.put(className, testStratumData); + + initDefaultBreakpoint(); + + String command = defaultStratum004a.COMMAND_LOAD_TEST_CLASSES + ":" + TestClass1.class.getName() + " " + + TestClass2.class.getName() + " " + TestClass3.class.getName(); + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + StepEventListener stepEventListener = new StepEventListener(); + eventHandler.addListener(stepEventListener); + + // perform step events generation 3 times + for (int i = 0; i < 3; i++) { + for (String testedClassName : classLocations.keySet()) { + StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest( + debuggee.threadByName(SDEDebuggee.mainThreadName), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + stepRequest.addClassFilter(testedClassName); + stepRequest.setSuspendPolicy(StepRequest.SUSPEND_EVENT_THREAD); + stepRequest.enable(); + + stepEventListener.clearLocations(); + + pipe.println(defaultStratum004a.COMMAND_INSTANTIATE_TEST_CLASS + ":" + testedClassName); + + if (!isDebuggeeReady()) + return; + + stepEventListener.waitBreakpointEvent(); + + compareLocations( + stepEventListener.stepLocations(), + classLocations.get(testedClassName), + testedClassName + "_Stratum"); + + stepRequest.disable(); + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/defaultStratum004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/defaultStratum004a.java new file mode 100644 index 00000000000..e6b243a7dd3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum004/defaultStratum004a.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2007, 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.ReferenceType.defaultStratum.defaultStratum004; + +import java.util.*; +import nsk.share.TestBug; +import nsk.share.jdi.sde.SDEDebuggee; + +public class defaultStratum004a extends SDEDebuggee { + public static void main(String[] args) { + new defaultStratum004a().doTest(args); + } + + // command:class_name class_name ... + public static final String COMMAND_LOAD_TEST_CLASSES = "loadTestClasses"; + + // command:class_name + public static final String COMMAND_INSTANTIATE_TEST_CLASS = "instantiateTestClasses"; + + List testClasses = new ArrayList(); + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.startsWith(COMMAND_LOAD_TEST_CLASSES)) { + String classNamesString[] = command.split(":"); + + if ((classNamesString.length != 2) || (classNamesString[1].length() == 0)) + throw new TestBug("Invalid command format, class names was not specified"); + + String classNames[] = classNamesString[1].split(" "); + + if (classNames.length == 0) + throw new TestBug("Class names was not specified"); + + loadTestClasses(classNames); + + return true; + } else if (command.startsWith(COMMAND_INSTANTIATE_TEST_CLASS)) { + String classNamesString[] = command.split(":"); + + if ((classNamesString.length == 0) || (classNamesString[1].length() == 0)) + throw new TestBug("Class name was not specified"); + + instantiateTestClass(classNamesString[1]); + breakpointMethod(); + + return true; + } + + return false; + } + + public void loadTestClasses(String classNames[]) { + TestClassLoader classLoader = new TestClassLoader(); + classLoader.setClassPath(classpath); + + try { + for (String className : classNames) { + Class klass = classLoader.loadClass(className); + testClasses.add(klass); + + log.display("Class '" + klass.getName() + "' was loaded"); + } + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + + throw new TestBug("Unexpected exception: " + e); + } + } + + public void instantiateTestClass(String className) { + for (Class klass : testClasses) { + if (klass.getName().equals(className)) { + try { + log.display("Create instance of '" + klass.getName() + "'"); + klass.newInstance(); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + + throw new TestBug("Unexpected exception: " + e); + } + + return; + } + } + + throw new TestBug("Class '" + className + "' was not loaded"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java new file mode 100644 index 00000000000..68be4efc6d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java @@ -0,0 +1,204 @@ +/* + * 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.ReferenceType.defaultStratum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.defaultStratum()
    + * complies with its specification.
    + *
    + * The case for testing includes a class file with the base
    + * startum. The test checks that String returned by the method
    + * ReferenceType.defaultStratum() is "Java".
    + *
    + */ + +public class defaultstratum001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/defaultStratum/defaultstratum001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new defaultstratum001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.defaultStratum.defaultstratum001a"; + + //String mName = "nsk.jdi.ReferenceType.defaultStratum"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List classes = vm.classesByName(debuggeeName); + + testedClass = (ReferenceType) classes.get(0); + + String defaultStratum = testedClass.defaultStratum(); + + log2("...... compareing defaultStratum to 'Java'"); + if (!defaultStratum.equals("Java")) { + log3("ERROR: defaultStratum is not equal to 'Java'"); + log3(" defaultStratum == " + defaultStratum); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001/TestDescription.java new file mode 100644 index 00000000000..fbfdf9f77e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ReferenceType/defaultStratum/defaultstratum001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.defaultStratum() + * complies with its spec: + * public String defaultStratum() + * Returns the default stratum for this reference type. + * This value is specified in the class file and cannot be set by the user. + * If the class file does not specify a default stratum the base stratum + * ("Java") will be returned. + * See the Location for a description of strata. + * The case for testing includes only a class file with the base stratum. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.defaultStratum.defaultstratum001; + * the debuggee program - nsk.jdi.ReferenceType.defaultStratum.defaultstratum001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.defaultStratum.defaultstratum001 + * nsk.jdi.ReferenceType.defaultStratum.defaultstratum001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.defaultStratum.defaultstratum001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001a.java new file mode 100644 index 00000000000..d93c6883171 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001a.java @@ -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.ReferenceType.defaultStratum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the defaultstratum001 JDI test. + */ + +public class defaultstratum001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } +/* + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } +*/ + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; iequals() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class equals001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.equals.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "equals001", + debugeeName = thisClassName + "a"; + + private final static String primitive_type_sign = "aprimitive_type"; + private final static String reference_type_sign = "areference_type"; + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + {"boolean", primitive_type_sign}, + {"byte" , primitive_type_sign}, + {"char" , primitive_type_sign}, + {"double" , primitive_type_sign}, + {"float" , primitive_type_sign}, + {"int" , primitive_type_sign}, + {"long" , primitive_type_sign}, + + {"java.lang.Boolean" , reference_type_sign}, + {"java.lang.Byte" , reference_type_sign}, + {"java.lang.Character", reference_type_sign}, + {"java.lang.Double" , reference_type_sign}, + {"java.lang.Float" , reference_type_sign}, + {"java.lang.Integer" , reference_type_sign}, + {"java.lang.Long" , reference_type_sign}, + {"java.lang.String" , reference_type_sign}, + {"java.lang.Object" , reference_type_sign}, + + {package_prefix + "ClassForCheck", reference_type_sign}, + {package_prefix + "InterfaceForCheck", reference_type_sign}, + + {debugeeName+"$s_class", reference_type_sign}, + {debugeeName+"$s_interf", reference_type_sign} + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new equals001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/equals/equals001 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/equals/equals001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/equals/equals001 test LOG:"); + print_log_anyway("==> test checks the equals() method of ReferenceType interface"); + print_log_anyway(" of the com.sun.jdi package for ArrayType, ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> equals001: equals001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway("##> equals001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway("##> equals001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> equals001: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> equals001: checking debugee's classes by ReferenceType.equals() method..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int equals_method_errors_for_equal_objects = 0; + int equals_method_errors_for_unequal_objects = 0; + ReferenceType unequal_refType = null; + for (int i=0; i equals001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + ReferenceType refType_2 = debugee.classByName(className); + if ( ! refType_1.equals(refType_2) ) { + print_log_anyway("##> equals001: FAILED: refType_1.equals(refType_2) returned FALSE"); + print_log_anyway("##> refType_1 = " + refType_1); + print_log_anyway("##> refType_2 = " + refType_2); + equals_method_errors_for_equal_objects++; + } + else { + + print_log_on_verbose("--> equals001: PASSED: refType_1.equals(refType_2) returned TRUE"); + print_log_on_verbose("--> refType_1 = " + refType_1); + print_log_on_verbose("--> refType_2 = " + refType_2); + + } + boolean is_equal = true; + String unequal_refType_str = null; + if ( unequal_refType == null ) { + Object object_for_compare = new Object(); + is_equal = refType_1.equals(object_for_compare); + unequal_refType_str = object_for_compare.toString(); + } + else { + is_equal = refType_1.equals(unequal_refType); + unequal_refType_str = unequal_refType.toString(); + } + if ( is_equal ) { + print_log_anyway("##> equals001: FAILED: refType_1.equals(unequal_refType) returned TRUE"); + print_log_anyway("##> refType_1 = " + refType_1); + print_log_anyway("##> unequal_refType = " + unequal_refType_str); + equals_method_errors_for_unequal_objects++; + } + else { + + print_log_on_verbose("--> equals001: PASSED: refType_1.equals(unequal_refType) returned FALSE"); + print_log_on_verbose("--> refType_1 = " + refType_1); + print_log_on_verbose("--> unequal_refType = " + unequal_refType_str); + + } + unequal_refType = refType_1; + } + } + print_log_anyway("--> equals001: checking debugee's classes completed!"); + print_log_anyway("--> equals001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + print_log_anyway("##> equals001: \"class not found ERRORS\" number = " + + class_not_found_errors); + } + print_log_anyway("##> equals001: errors number of equals() method for equal objects = " + + equals_method_errors_for_equal_objects); + print_log_anyway("##> equals001: errors number of equals() method for unequal objects = " + + equals_method_errors_for_unequal_objects); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + equals_method_errors_for_equal_objects + + equals_method_errors_for_unequal_objects > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> equals001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway("##> equals001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> equals001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..6a224401634 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals001/TestDescription.java @@ -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/ReferenceType/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/equals/equals001 test + * checks the equals() method of ReferenceType interface + * of the com.sun.jdi package for ArrayType, ClassType, InterfaceType: + * For each checked debugee's class the test gets two ReferenceType + * instances for this class and compares these ReferenceType instances + * by equals() method - true is expected to be return. + * Then the test compares two ReferenceType instances for different + * debugee's classes - false is expected to be return. + * Also the test compares ReferenceType instance with Object instance + * - false is expected to be return. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.equals.equals001 + * nsk.jdi.ReferenceType.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals001a.java new file mode 100644 index 00000000000..bc74f002d8c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals001a.java @@ -0,0 +1,152 @@ +/* + * 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.ReferenceType.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the equals001 JDI test. + */ + +public class equals001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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}; + + static class s_class {} + s_class s_class_0 = new s_class(), s_class_1[]={s_class_0}, + s_class_2[][]={s_class_1}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static interface s_interf {} + 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}; + + ClassForCheck class_for_check0 = new ClassForCheck(), + class_for_check1[]={class_for_check0}, + class_for_check2[][]={class_for_check1}; + InterfaceForCheck_impl interf_for_check_impl0 = new InterfaceForCheck_impl(); + InterfaceForCheck interf_for_check0, + interf_for_check1[]={interf_for_check0}, + interf_for_check2[][]={interf_for_check1}; + + 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 equals001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + equals001a equals001a_obj = new equals001a(); + + print_log_on_verbose("**> equals001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> equals001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> equals001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> equals001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> equals001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class ClassForCheck { + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + static long[] s_prim_array_field; + static Object[] s_ref_array_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + long[] i_prim_array_field; + Object[] i_ref_array_field; +} + +interface InterfaceForCheck { + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); +} + +class InterfaceForCheck_impl implements InterfaceForCheck {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002.java new file mode 100644 index 00000000000..1e210565466 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.equals; + +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 equals() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class equals002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.equals.", + thisClassName = package_prefix + "equals002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "equals002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new equals002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/equals/equals002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/equals/equals002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/equals/equals002 test LOG:"); + print_log_anyway("--> test checks equals() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> equals002: equals002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> equals002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> equals002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> equals002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> equals002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> equals002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> equals002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean equals_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> equals002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> equals002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> equals002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> equals002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> equals002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> equals002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> equals002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.equals() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> equals002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> equals002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> equals002: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> equals002: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> equals002: check that checked class has been unloaded realy..."); + print_log_anyway + ("--> equals002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.equals() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> equals002: check ReferenceType.equals() method for unloaded class..."); + boolean equals_sign = false; + try { + equals_sign = refType.equals(refType); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> equals002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> equals002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + equals_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || equals_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> equals002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> equals002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> equals002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of equals002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..278ce65f282 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/TestDescription.java @@ -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/ReferenceType/equals/equals002. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/equals/equals002 test + * checks the equals() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * equals() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - equals002b class was moved in 'loadclass' subdirectory; + * - package name was added in equals002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for equals002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.equals.equals002 + * nsk.jdi.ReferenceType.equals.equals002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/loadclass/equals002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/loadclass/equals002b.java new file mode 100644 index 00000000000..ee2fbb03967 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002/loadclass/equals002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the equals() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.equals; + +class equals002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002a.java new file mode 100644 index 00000000000..0fc1f3a2818 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/equals/equals002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.equals; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the equals002 JDI test. + */ + +public class equals002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.equals."; + private final static String checked_class_name = package_prefix + "equals002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> equals002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> equals002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> equals002a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> equals002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> equals002a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> equals002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> equals002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> equals002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> equals002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> equals002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> equals002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> equals002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> equals002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> equals002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> equals002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> equals002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> equals002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> equals002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> equals002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of equals002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001.java new file mode 100644 index 00000000000..e35a80b9db3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001.java @@ -0,0 +1,202 @@ +/* + * 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.ReferenceType.failedToInitialize; + +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 failedToInitialize() + * of the JDI interface ReferenceType of com.sun.jdi package + * for ClassType, InterfaceType + */ + +public class failedToInitialize001 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.ReferenceType.failedToInitialize.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "failedToInitialize001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + + {thisClassName, "no failed init", "class"}, + {thisClassName+"a", "no failed init", "class"}, + + {package_prefix + "fail_init_class", "failed init", "class"}, + + {package_prefix + "interf", "no failed init", "interface"}, + + {package_prefix + "fail_init_interf", "failed init", "interface"}, + + {package_prefix + "fail_init_subcl", "failed init", "class"} + + }; + + /** + * Re-call to run(args,out), 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 failedToInitialize001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001 test LOG:"); + out_stream.println("==> test checks failedToInitialize() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> failedToInitialize001: failedToInitialize001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> failedToInitialize001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> failedToInitialize001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> failedToInitialize001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> failedToInitialize001: checking debugee's classes by ReferenceType.failedToInitialize() method..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int failedToInitialize_method_errors = 0; + for (int i=0; i failedToInitialize001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String s_failed_sign = classes_for_check[i][1]; + String s_type = classes_for_check[i][2]; + boolean failedToInitialize = s_failed_sign.equals("failed init"); + if (refType.failedToInitialize() != failedToInitialize) { + out_stream.println("##> failedToInitialize001: UNEXPECTED failedToInitialize() method result (" + + !failedToInitialize + ") for " + s_type + ": " + + className + "(" + s_failed_sign + ")"); + failedToInitialize_method_errors++; + } + else { + print_log_on_verbose("--> failedToInitialize001: expected failedToInitialize() method result (" + + failedToInitialize + ") for " + s_type + ": " + + className + "(" + s_failed_sign + ")"); + } + } + out_stream.println("--> failedToInitialize001: checking debugee's classes completed!"); + out_stream.println("--> failedToInitialize001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + out_stream.println("##> failedToInitialize001: \"class not found ERRORS\" counter = " + + class_not_found_errors); + } + out_stream.println("##> failedToInitialize001: failedToInitialize() method ERRORS counter = " + + failedToInitialize_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + failedToInitialize_method_errors > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> failedToInitialize001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> failedToInitialize001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> failedToInitialize001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001/TestDescription.java new file mode 100644 index 00000000000..8a59348a7a6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001/TestDescription.java @@ -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/ReferenceType/failedToInitialize/failedToInitialize001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001 test + * checks the failedToInitialize() method of ReferenceType interface + * of the com.sun.jdi package for ClassType, InterfaceType. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.failedToInitialize.failedToInitialize001 + * nsk.jdi.ReferenceType.failedToInitialize.failedToInitialize001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.failedToInitialize.failedToInitialize001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001a.java new file mode 100644 index 00000000000..f8c801e881c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedToInitialize001a.java @@ -0,0 +1,126 @@ +/* + * 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.ReferenceType.failedToInitialize; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the failedToInitialize001 JDI test. + */ + +public class failedToInitialize001a { + + static boolean verbose_mode = false; + + failedToInitialize001 a001_0=new failedToInitialize001(); + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + interf_impl interf_impl_0 = new interf_impl(); + interf interf_0, interf_1[]={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 failedToInitialize001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + failedToInitialize001a failedToInitialize001a_obj = new failedToInitialize001a(); + try { + fail_init_class fail_init_class_var = new fail_init_class(); + System.err.println + ("!!**> failedToInitialize001a: FAILED - NO ExceptionInInitializerError (fail_init_class)!"); + pipe.println("failedToInitialize001a FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + catch (ExceptionInInitializerError e) { + print_log_on_verbose + ("**> failedToInitialize001a: ExceptionInInitializerError caught (fail_init_class)!"); + } + + try { + fail_init_subcl fail_init_subcl_var = new fail_init_subcl(); + System.err.println + ("!!**> failedToInitialize001a: FAILED - NO ExceptionInInitializerError (fail_init_subcl)!"); + pipe.println("failedToInitialize001a FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + catch (ExceptionInInitializerError e) { + print_log_on_verbose + ("**> failedToInitialize001a: ExceptionInInitializerError caught (fail_init_subcl)!"); + } + + print_log_on_verbose("**> failedToInitialize001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> failedToInitialize001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> failedToInitialize001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> failedToInitialize001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> failedToInitialize001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** failed to initialize class */ +class fail_init_class { + + static { + int int_var = 1/0; + } + +} + +/** interface */ +interface interf {} + +class interf_impl implements interf {} + +/** failed to initialize interface */ +interface fail_init_interf { + static final int int_var = 1/0; +} + +/** failed to initialize subclass */ +class fail_init_subcl implements fail_init_interf { + static int my_int_var = int_var; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002.java new file mode 100644 index 00000000000..0d0726e5686 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002.java @@ -0,0 +1,250 @@ +/* + * 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.ReferenceType.failedToInitialize; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +/** + * This test checks the method failedToInitialize() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class failedtoinit002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class failedToInitializes of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.failedToInitialize.", + thisClassName = package_prefix + "failedtoinit002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "failedtoinit002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new failedtoinit002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002 test LOG:"); + print_log_anyway("--> test checks failedToInitialize() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> failedtoinit002: failedtoinit002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> failedtoinit002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> failedtoinit002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean failedToInitialize_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> failedtoinit002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> failedtoinit002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> failedtoinit002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> failedtoinit002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> failedtoinit002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> failedtoinit002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.failedToInitialize() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> failedtoinit002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> failedtoinit002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> failedtoinit002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> failedtoinit002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> failedtoinit002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.failedToInitialize() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> failedtoinit002: check ReferenceType.failedToInitialize() method for unloaded class..."); + boolean ref_type_failed_to_initialize = true; + try { + ref_type_failed_to_initialize = refType.failedToInitialize(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> failedtoinit002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> failedtoinit002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + failedToInitialize_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || failedToInitialize_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> failedtoinit002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> failedtoinit002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> failedtoinit002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of failedtoinit002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/TestDescription.java new file mode 100644 index 00000000000..b28533b7d39 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/TestDescription.java @@ -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/ReferenceType/failedToInitialize/failedtoinit002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002 test + * checks the failedToInitialize() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * failedToInitialize() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - failedtoinit002b class was moved in 'loadclass' subdirectory; + * - package name was added in failedtoinit002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for failedtoinit002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.failedToInitialize.failedtoinit002 + * nsk.jdi.ReferenceType.failedToInitialize.failedtoinit002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.failedToInitialize.failedtoinit002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/loadclass/failedtoinit002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/loadclass/failedtoinit002b.java new file mode 100644 index 00000000000..91898de306d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002/loadclass/failedtoinit002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the failedToInitialize() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.failedToInitialize; + +class failedtoinit002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002a.java new file mode 100644 index 00000000000..cbd88e24236 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/failedToInitialize/failedtoinit002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.failedToInitialize; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the failedtoinit002 JDI test. + */ + +public class failedtoinit002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.failedToInitialize."; + private final static String checked_class_name = package_prefix + "failedtoinit002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> failedtoinit002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> failedtoinit002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> failedtoinit002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> failedtoinit002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> failedtoinit002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> failedtoinit002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> failedtoinit002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> failedtoinit002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> failedtoinit002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> failedtoinit002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> failedtoinit002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> failedtoinit002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> failedtoinit002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> failedtoinit002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> failedtoinit002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> failedtoinit002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> failedtoinit002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> failedtoinit002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> failedtoinit002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of failedtoinit002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001.java new file mode 100644 index 00000000000..b037ae45de0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001.java @@ -0,0 +1,349 @@ +/* + * 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.ReferenceType.fieldByName; + +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 fieldByName() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fieldbyname001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.fieldByName.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "fieldbyname001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "fieldbyname001aClassForCheck"; + private final static String super_class_for_check = package_prefix + "fieldbyname001aSuperClassForCheck"; + private final static String interf_for_check = package_prefix + "fieldbyname001aInterfaceForCheck"; + private final static String ambiguous_class = "ambiguous_class"; + private final static String not_existing_class = "not_existing_class"; + private static String fields_for_check[][] = { + +// field name type name static declaring class + + {"s_boolean_field", "boolean", " static", class_for_check, }, + {"s_byte_field", "byte", " static", class_for_check, }, + {"s_char_field", "char", " static", class_for_check, }, + {"s_double_field", "double", " static", class_for_check, }, + {"s_float_field", "float", " static", class_for_check, }, + {"s_int_field", "int", " static", class_for_check, }, + {"s_long_field", "long", " static", class_for_check, }, + {"s_object_field", "java.lang.Object", " static", class_for_check, }, + {"s_prim_array_field", "long[]", " static", class_for_check, }, + {"s_ref_array_field", "java.lang.Object[]", " static", class_for_check, }, + {"i_boolean_field", "boolean", "", class_for_check, }, + {"i_byte_field", "byte", "", class_for_check, }, + {"i_char_field", "char", "", class_for_check, }, + {"i_double_field", "double", "", class_for_check, }, + {"i_float_field", "float", "", class_for_check, }, + {"i_int_field", "int", "", class_for_check, }, + {"i_long_field", "long", "", class_for_check, }, + {"i_object_field", "java.lang.Object", "", class_for_check, }, + {"i_prim_array_field", "long[]", "", class_for_check, }, + {"i_ref_array_field", "java.lang.Object[]", "", class_for_check, }, + {"s_super_hidden_prim_field", "long", " static", class_for_check, }, + {"s_super_hidden_ref_field", "java.lang.Object", " static", class_for_check, }, + {"i_super_hidden_prim_field", "long", " static", class_for_check, }, + {"i_super_hidden_ref_field", "java.lang.Object", " static", class_for_check, }, + {"s_interf_hidden_prim_field", "long", " static", class_for_check, }, + {"s_interf_hidden_ref_field", "java.lang.Object", " static", class_for_check, }, + {"s_super_boolean_field", "boolean", " static", super_class_for_check }, + {"s_super_byte_field", "byte", " static", super_class_for_check }, + {"s_super_char_field", "char", " static", super_class_for_check }, + {"s_super_double_field", "double", " static", super_class_for_check }, + {"s_super_float_field", "float", " static", super_class_for_check }, + {"s_super_int_field", "int", " static", super_class_for_check }, + {"s_super_long_field", "long", " static", super_class_for_check }, + {"s_super_object_field", "java.lang.Object", " static", super_class_for_check }, + {"i_super_boolean_field", "boolean", "", super_class_for_check }, + {"i_super_byte_field", "byte", "", super_class_for_check }, + {"i_super_char_field", "char", "", super_class_for_check }, + {"i_super_double_field", "double", "", super_class_for_check }, + {"i_super_float_field", "float", "", super_class_for_check }, + {"i_super_int_field", "int", "", super_class_for_check }, + {"i_super_long_field", "long", "", super_class_for_check }, + {"i_super_object_field", "java.lang.Object", "", super_class_for_check }, + {"s_interf_boolean_field", "boolean", " static", interf_for_check, }, + {"s_interf_byte_field", "byte", " static", interf_for_check, }, + {"s_interf_char_field", "char", " static", interf_for_check, }, + {"s_interf_double_field", "double", " static", interf_for_check, }, + {"s_interf_float_field", "float", " static", interf_for_check, }, + {"s_interf_int_field", "int", " static", interf_for_check, }, + {"s_interf_long_field", "long", " static", interf_for_check, }, + {"s_interf_object_field", "java.lang.Object", " static", interf_for_check, }, + {"ambiguous_prim_field", "long", " static", ambiguous_class, }, + {"ambiguous_ref_field", "java.lang.Object", " static", ambiguous_class, }, + {"non_existing_field", "not_defined_type", "non_def", not_existing_class, } + + }; + + /** + * Re-call to run(args,out), 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 fieldbyname001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/fieldByName/fieldbyname001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/fieldByName/fieldbyname001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/fieldByName/fieldbyname001 test LOG:"); + out_stream.println("==> test checks fieldByName(...) method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> fieldbyname001: fieldbyname001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> fieldbyname001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> fieldbyname001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fieldbyname001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> fieldbyname001: check ReferenceType.fieldByName(...) method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + int fields_for_check_number = fields_for_check.length; + int fieldByName_exceptions = 0; + int not_found_fields_number = 0; + int unexpected_found_fields_number = 0; + int not_corresponded_fields_number = 0; + int all_field_errors_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> fieldbyname001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + for (int i=0; i fieldbyname001: FAILED: fieldByName() throws unexpected " + + thrown); + out_stream.println("##> requested field: " + current_field_for_check); + fieldByName_exceptions++; + all_field_errors_number++; + continue; + } + if ( field_by_name == null ) { + if ( existing_field ) { + out_stream.println("##> fieldbyname001: FAILED: fieldByName() returned null!"); + out_stream.println("##> requested field: " + current_field_for_check); + not_found_fields_number++; + all_field_errors_number++; + } + else { + print_log_on_verbose + ("--> fieldbyname001: PASSED for field: " + current_field_for_check); + print_log_on_verbose + ("--> expected result: null Field"); + } + continue; + } + String field_by_name_name = field_by_name.name(); + String field_by_name_typename = field_by_name.typeName(); + String field_by_name_static; + if ( field_by_name.isStatic() ) { + field_by_name_static = " static"; + } + else { + field_by_name_static = ""; + } + String declaring_class_name = "declaring class NOT defined"; + try { + declaring_class_name = field_by_name.declaringType().name(); + } + catch (Throwable thrown) { + } + String full_field_by_name = field_by_name_static + + " " + field_by_name_typename + " " + field_by_name_name + + " (" + declaring_class_name + ")"; + if ( ! existing_field ) { + out_stream.println("##> fieldbyname001: FAILED: fieldByName() returned unexpected field: " + + full_field_by_name); + out_stream.println("##> requested field: " + current_field_for_check); + out_stream.println("##> expected result: null Field"); + unexpected_found_fields_number++; + all_field_errors_number++; + continue; + } + if ( (field_by_name_name.equals(fields_for_check[i][0])) + && (field_by_name_typename.equals(fields_for_check[i][1])) + && (field_by_name_static.equals(fields_for_check[i][2])) + && (declaring_class_name.equals(fields_for_check[i][3])) ) { + print_log_on_verbose + ("--> fieldbyname001: PASSED for field: " + current_field_for_check); + } + else { + out_stream.println + ("##> fieldbyname001: FAILED: fieldByName() returned field not corresponded to requested field!"); + out_stream.println + ("##> returned field: " + full_field_by_name); + out_stream.println + ("##> requested field: " + current_field_for_check); + not_corresponded_fields_number++; + all_field_errors_number++; + } + } + break; + } + + out_stream.println("--> fieldbyname001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> fieldbyname001: number of checked fields = " + fields_for_check_number); + if ( fieldByName_exceptions > 0 ) { + out_stream.println + ("--> fieldbyname001: number of unexpected exceptions thrown by fieldByName() = " + + fieldByName_exceptions); + } + if ( not_found_fields_number > 0 ) { + out_stream.println + ("--> fieldbyname001: number of fields not found by fieldByName() (null returned) = " + + not_found_fields_number); + } + if ( unexpected_found_fields_number > 0 ) { + out_stream.println + ("--> fieldbyname001: number of unexpected fields found by fieldByName() (not null returned) = " + + unexpected_found_fields_number); + } + if ( not_corresponded_fields_number > 0 ) { + out_stream.println + ("--> fieldbyname001: number of returned by fieldByName() fields not corresponded to requested field = " + + not_corresponded_fields_number); + } + out_stream.println + ("--> fieldbyname001: number of fields for which fieldByName() returned expected result = " + + (fields_for_check_number - all_field_errors_number)); + } + if ( all_field_errors_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> fieldbyname001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> fieldbyname001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fieldbyname001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001/TestDescription.java new file mode 100644 index 00000000000..4e96ca54cb9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001/TestDescription.java @@ -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/ReferenceType/fieldByName/fieldbyname001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fieldByName/fieldbyname001 test + * checks the fieldByName(...) method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.fieldByName(...) method is checked for fields of + * debugee's class which extends super class and implements interface. + * Debugee's classes have both hidden and ambiguous fields which should + * be not found by the fieldByName(...) method. + * Each visible field is checked for field name, field type, + * static modifier and declaring class. + * Also fieldByName(...) method is checked for nonexisting field - null + * Field should be returned. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fieldByName.fieldbyname001 + * nsk.jdi.ReferenceType.fieldByName.fieldbyname001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fieldByName.fieldbyname001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001a.java new file mode 100644 index 00000000000..a08cb86538a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname001a.java @@ -0,0 +1,162 @@ +/* + * 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.ReferenceType.fieldByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the fieldbyname001 JDI test. + */ + +public class fieldbyname001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 fieldbyname001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + fieldbyname001aClassForCheck class_for_check = new fieldbyname001aClassForCheck(); + + print_log_on_verbose("**> fieldbyname001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fieldbyname001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fieldbyname001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> fieldbyname001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> fieldbyname001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class fieldbyname001aClassForCheck extends fieldbyname001aSuperClassForCheck implements fieldbyname001aInterfaceForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + static long[] s_prim_array_field; + static Object[] s_ref_array_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + long[] i_prim_array_field; + Object[] i_ref_array_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + static long i_super_hidden_prim_field; + static Object i_super_hidden_ref_field; + + static long s_interf_hidden_prim_field; + static Object s_interf_hidden_ref_field; + +} + +class fieldbyname001aSuperClassForCheck { + + static boolean s_super_boolean_field; + static byte s_super_byte_field; + static char s_super_char_field; + static double s_super_double_field; + static float s_super_float_field; + static int s_super_int_field; + static long s_super_long_field; + static Object s_super_object_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + boolean i_super_boolean_field; + byte i_super_byte_field; + char i_super_char_field; + double i_super_double_field; + float i_super_float_field; + int i_super_int_field; + long i_super_long_field; + Object i_super_object_field; + + long i_super_hidden_prim_field; + Object i_super_hidden_ref_field; + + int ambiguous_prim_field; + Class ambiguous_ref_field; + +} + +interface fieldbyname001aInterfaceForCheck { + + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); + + static final long s_interf_hidden_prim_field = 1; + static final Object s_interf_hidden_ref_field = new Object(); + + static final long ambiguous_prim_field = 1; + static final Object ambiguous_ref_field = new Object(); + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002.java new file mode 100644 index 00000000000..bcbb8846e72 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002.java @@ -0,0 +1,221 @@ +/* + * 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.ReferenceType.fieldByName; + +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 fieldByName() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fieldbyname002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.fieldByName.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "fieldbyname002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "fieldbyname002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "fieldbyname002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** + * Re-call to run(args,out), 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 fieldbyname002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/fieldByName/fieldbyname002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/fieldByName/fieldbyname002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/fieldByName/fieldbyname002 test LOG:"); + print_log_on_verbose("==> test checks fieldByName(...) method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> fieldbyname002: fieldbyname002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> fieldbyname002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> fieldbyname002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fieldbyname002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> fieldbyname002: check ReferenceType.fieldByName(...) method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean fieldByName_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> fieldbyname002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> fieldbyname002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + Field field_by_name = null; + try { + field_by_name = refType.fieldByName("dummy_field"); + print_log_anyway + ("##> fieldbyname002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + fieldByName_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> fieldbyname002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> fieldbyname002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + fieldByName_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || fieldByName_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> fieldbyname002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> fieldbyname002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fieldbyname002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002/TestDescription.java new file mode 100644 index 00000000000..9f2809dfbbc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/fieldByName/fieldbyname002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fieldByName/fieldbyname002 test + * checks the fieldByName(...) method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.fieldByName(...) method is called for + * dummy field of this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fieldByName.fieldbyname002 + * nsk.jdi.ReferenceType.fieldByName.fieldbyname002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fieldByName.fieldbyname002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002/loadclass/fieldbyname002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002/loadclass/fieldbyname002aClassForCheck.java new file mode 100644 index 00000000000..988bbcbd5d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002/loadclass/fieldbyname002aClassForCheck.java @@ -0,0 +1,51 @@ +/* + * 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.ReferenceType.fieldByName; + +/** + * This class is loaded by fieldbyname002aClassLoader . + */ +class fieldbyname002aClassForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002a.java new file mode 100644 index 00000000000..84d51fc58f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.fieldByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the fieldbyname002 JDI test. + */ + +public class fieldbyname002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.fieldByName."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "fieldbyname002aClassForCheck"; + + 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 fieldbyname002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + fieldbyname002aClassLoader customClassLoader = new fieldbyname002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> fieldbyname002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> fieldbyname002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> fieldbyname002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fieldbyname002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fieldbyname002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> fieldbyname002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> fieldbyname002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class fieldbyname002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public fieldbyname002aClassLoader(String classPath, String className) { + super(fieldbyname002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003.java new file mode 100644 index 00000000000..184cf3e865c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003.java @@ -0,0 +1,256 @@ +/* + * 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.ReferenceType.fieldByName; + +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 fieldByName() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fieldbyname003 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.fieldByName.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "fieldbyname003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "fieldbyname003b"; + + + /** + * Re-call to run(args,out), 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 fieldbyname003().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/fieldByName/fieldbyname003 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/fieldByName/fieldbyname003 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/fieldByName/fieldbyname003 test LOG:"); + out_stream.println("--> test checks fieldByName(...) method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> fieldbyname003: fieldbyname003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fieldbyname003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fieldbyname003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean fieldByName_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> fieldbyname003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> fieldbyname003: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> fieldbyname003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> fieldbyname003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> fieldbyname003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> fieldbyname003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.fieldByName() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fieldbyname003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> fieldbyname003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> fieldbyname003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> fieldbyname003: check that checked class has been unloaded realy..."); + out_stream.println + ("--> fieldbyname003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.fieldByName() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> fieldbyname003: check ReferenceType.fieldByName(...) method for unloaded class..."); + Field field_by_name = null; + try { + field_by_name = refType.fieldByName("dummy_field"); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> fieldbyname003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> fieldbyname003: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + fieldByName_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || fieldByName_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> fieldbyname003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> fieldbyname003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fieldbyname003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of fieldbyname003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/TestDescription.java new file mode 100644 index 00000000000..5e299f27b3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/TestDescription.java @@ -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/ReferenceType/fieldByName/fieldbyname003. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fieldByName/fieldbyname003 test + * checks the fieldByName(...) method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * fieldByName(...) method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - fieldbyname003b class was moved in 'loadclass' subdirectory; + * - package name was added in fieldbyname003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for fieldbyname003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fieldByName.fieldbyname003 + * nsk.jdi.ReferenceType.fieldByName.fieldbyname003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fieldByName.fieldbyname003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/loadclass/fieldbyname003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/loadclass/fieldbyname003b.java new file mode 100644 index 00000000000..bf827f494b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003/loadclass/fieldbyname003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the fieldByName(...) method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.fieldByName; + +class fieldbyname003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003a.java new file mode 100644 index 00000000000..8d2cb87f239 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fieldByName/fieldbyname003a.java @@ -0,0 +1,118 @@ +/* + * 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.ReferenceType.fieldByName; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the fieldbyname003 JDI test. + */ + +public class fieldbyname003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + static String package_prefix = "nsk.jdi.ReferenceType.fieldByName."; + static String checked_class_name = package_prefix + "fieldbyname003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> fieldbyname003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> fieldbyname003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> fieldbyname003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> fieldbyname003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> fieldbyname003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> fieldbyname003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fieldbyname003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fieldbyname003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> fieldbyname003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> fieldbyname003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> fieldbyname003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> fieldbyname003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> fieldbyname003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> fieldbyname003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> fieldbyname003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fieldbyname003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fieldbyname003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> fieldbyname003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> fieldbyname003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of fieldbyname003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001.java new file mode 100644 index 00000000000..3b2fb2c6e3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001.java @@ -0,0 +1,284 @@ +/* + * 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.ReferenceType.fields; + +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 fields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fields001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.fields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "fields001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "fields001aClassForCheck"; + private final static String not_found_sign = "NOT FOUND"; + private final static String passed_sign = "PASSED"; + private static String fields_for_check[][] = { + +// field name type name static declaring class check result + + {"s_boolean_field", "boolean", " static", class_for_check, not_found_sign }, + {"s_byte_field", "byte", " static", class_for_check, not_found_sign }, + {"s_char_field", "char", " static", class_for_check, not_found_sign }, + {"s_double_field", "double", " static", class_for_check, not_found_sign }, + {"s_float_field", "float", " static", class_for_check, not_found_sign }, + {"s_int_field", "int", " static", class_for_check, not_found_sign }, + {"s_long_field", "long", " static", class_for_check, not_found_sign }, + {"s_object_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"s_prim_array_field", "long[]", " static", class_for_check, not_found_sign }, + {"s_ref_array_field", "java.lang.Object[]", " static", class_for_check, not_found_sign }, + {"i_boolean_field", "boolean", "", class_for_check, not_found_sign }, + {"i_byte_field", "byte", "", class_for_check, not_found_sign }, + {"i_char_field", "char", "", class_for_check, not_found_sign }, + {"i_double_field", "double", "", class_for_check, not_found_sign }, + {"i_float_field", "float", "", class_for_check, not_found_sign }, + {"i_int_field", "int", "", class_for_check, not_found_sign }, + {"i_long_field", "long", "", class_for_check, not_found_sign }, + {"i_object_field", "java.lang.Object", "", class_for_check, not_found_sign }, + {"i_prim_array_field", "long[]", "", class_for_check, not_found_sign }, + {"i_ref_array_field", "java.lang.Object[]", "", class_for_check, not_found_sign }, + {"s_super_hidden_prim_field", "long", " static", class_for_check, not_found_sign }, + {"s_super_hidden_ref_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"i_super_hidden_prim_field", "long", " static", class_for_check, not_found_sign }, + {"i_super_hidden_ref_field", "java.lang.Object", " static", class_for_check, not_found_sign }, + {"s_interf_hidden_prim_field", "long", " static", class_for_check, not_found_sign }, + {"s_interf_hidden_ref_field", "java.lang.Object", " static", class_for_check, not_found_sign } + + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new fields001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/fields/fields001 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/fields/fields001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/fields/fields001 test LOG:"); + print_log_anyway("==> test checks fields() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> fields001: fields001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> fields001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> fields001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fields001: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> fields001: check ReferenceType.fields() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean fields_method_error = false; + int fields_for_check_number = fields_for_check.length; + int not_found_fields_number = 0; + int returned_fields_number = 0; + int unexpected_found_fields_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + print_log_anyway("##> fields001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List returned_fields_list = null; + try { + returned_fields_list = refType.fields(); + } + catch (Throwable thrown) { + print_log_anyway("##> fields001: FAILED: ReferenceType.fields() throws unexpected " + + thrown); + fields_method_error = true; + break; + } + returned_fields_number = returned_fields_list.size(); + Field returned_fields_array[] = new Field[returned_fields_number]; + String unexpected_returned_fields_array[] = new String[returned_fields_number]; + returned_fields_list.toArray(returned_fields_array); + for (int i=0; i fields001: FAILED: field is NOT found: " + field_for_check_info); + not_found_fields_number++; + } + else { + print_log_on_verbose + ("--> fields001: PASSED for field: " + field_for_check_info); + } + } + for (int i=0; i fields001: FAILED: unexpected found field: " + unexpected_returned_fields_array[i]); + } + break; + } + + print_log_anyway("--> fields001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || fields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_anyway("--> fields001: expected found fields number = " + fields_for_check_number); + print_log_anyway("--> fields001: in fact found fields number = " + returned_fields_number); + print_log_anyway("--> fields001: expected and in fact found fields number = " + + (fields_for_check_number - not_found_fields_number)); + print_log_anyway + ("##> fields001: NOT found fields number = " + not_found_fields_number); + print_log_anyway + ("##> fields001: UNEXPECTED found fields number = " + unexpected_found_fields_number); + } + if ( not_found_fields_number + unexpected_found_fields_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> fields001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> fields001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fields001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001/TestDescription.java new file mode 100644 index 00000000000..c4d99fe44df --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ReferenceType/fields/fields001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fields/fields001 test + * checks the fields() method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.fields() method is checked for fields of + * debugee's class which extends super class and implements interface. + * The test expects that only declared directly in the checked class + * fields should be included in Field list returned by the fields() method. + * Each field is checked for field name, field type, static modifier + * and declaring class. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fields.fields001 + * nsk.jdi.ReferenceType.fields.fields001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fields.fields001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001a.java new file mode 100644 index 00000000000..d72fb7c5124 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields001a.java @@ -0,0 +1,162 @@ +/* + * 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.ReferenceType.fields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the fields001 JDI test. + */ + +public class fields001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 fields001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + fields001aClassForCheck class_for_check = new fields001aClassForCheck(); + + print_log_on_verbose("**> fields001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fields001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fields001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> fields001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> fields001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class fields001aClassForCheck extends fields001aSuperClassForCheck implements fields001aInterfaceForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + static long[] s_prim_array_field; + static Object[] s_ref_array_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + long[] i_prim_array_field; + Object[] i_ref_array_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + static long i_super_hidden_prim_field; + static Object i_super_hidden_ref_field; + + static long s_interf_hidden_prim_field; + static Object s_interf_hidden_ref_field; + +} + +class fields001aSuperClassForCheck { + + static boolean s_super_boolean_field; + static byte s_super_byte_field; + static char s_super_char_field; + static double s_super_double_field; + static float s_super_float_field; + static int s_super_int_field; + static long s_super_long_field; + static Object s_super_object_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + boolean i_super_boolean_field; + byte i_super_byte_field; + char i_super_char_field; + double i_super_double_field; + float i_super_float_field; + int i_super_int_field; + long i_super_long_field; + Object i_super_object_field; + + long i_super_hidden_prim_field; + Object i_super_hidden_ref_field; + + long ambiguous_prim_field; + Object ambiguous_ref_field; + +} + +interface fields001aInterfaceForCheck { + + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); + + static final long s_interf_hidden_prim_field = 1; + static final Object s_interf_hidden_ref_field = new Object(); + + static final long ambiguous_prim_field = 1; + static final Object ambiguous_ref_field = new Object(); + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002.java new file mode 100644 index 00000000000..63eb6e6ea15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002.java @@ -0,0 +1,216 @@ +/* + * 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.ReferenceType.fields; + +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 fields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fields002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.fields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "fields002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "fields002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "fields002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new fields002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/fields/fields002 test FAILED"); + } + else { + print_log_on_verbose("\n==> nsk/jdi/ReferenceType/fields/fields002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + test_log_handler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, test_log_handler); + + print_log_on_verbose("==> nsk/jdi/ReferenceType/fields/fields002 test LOG:"); + print_log_on_verbose("==> test checks fields() method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + debugee_launch_command = debugeeName + " -vbs"; + } + + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + + debugee.redirectStderr(out); + print_log_on_verbose("--> fields002: fields002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> fields002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> fields002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fields002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> fields002: check ReferenceType.fields() method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean fields_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> fields002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> fields002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List fields_list = null; + try { + fields_list = refType.fields(); + print_log_anyway + ("##> fields002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + fields_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> fields002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> fields002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + fields_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || fields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> fields002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> fields002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fields002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002/TestDescription.java new file mode 100644 index 00000000000..645963209e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/fields/fields002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fields/fields002 test + * checks the fields() method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.fields() method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements ""print_log_anyway"" are replaced with + * "print_log_on_verbose". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fields.fields002 + * nsk.jdi.ReferenceType.fields.fields002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fields.fields002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002/loadclass/fields002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002/loadclass/fields002aClassForCheck.java new file mode 100644 index 00000000000..826cf2e1565 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002/loadclass/fields002aClassForCheck.java @@ -0,0 +1,51 @@ +/* + * 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.ReferenceType.fields; + +/** + * This class is loaded by fields002aClassLoader . + */ +class fields002aClassForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002a.java new file mode 100644 index 00000000000..5f0501c794e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.fields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the fields002 JDI test. + */ + +public class fields002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.fields."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "fields002aClassForCheck"; + + 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 fields002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + fields002aClassLoader customClassLoader = new fields002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> fields002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> fields002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> fields002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fields002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fields002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> fields002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> fields002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class fields002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public fields002aClassLoader(String classPath, String className) { + super(fields002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003.java new file mode 100644 index 00000000000..48807fdda96 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003.java @@ -0,0 +1,250 @@ +/* + * 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.ReferenceType.fields; + +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 fields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fields003 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private static final String package_prefix = "nsk.jdi.ReferenceType.fields."; + private static final String thisClassName = package_prefix + "fields003"; + private static final String debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "fields003b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new fields003().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/fields/fields003 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/fields/fields003 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/fields/fields003 test LOG:"); + print_log_anyway("--> test checks fields() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> fields003: fields003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> fields003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> fields003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fields003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> fields003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> fields003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fields003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean fields_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> fields003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> fields003: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> fields003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> fields003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> fields003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> fields003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> fields003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.fields() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> fields003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fields003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> fields003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> fields003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> fields003: check that checked class has been unloaded realy..."); + print_log_anyway + ("--> fields003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.fields() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> fields003: check ReferenceType.fields() method for unloaded class..."); + List fields_list = null; + try { + fields_list = refType.fields(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> fields003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> fields003: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + fields_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || fields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> fields003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> fields003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fields003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of fields003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/TestDescription.java new file mode 100644 index 00000000000..1f71c07a218 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/TestDescription.java @@ -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/ReferenceType/fields/fields003. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fields/fields003 test + * checks the fields() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * fields() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - fields003b class was moved in 'loadclass' subdirectory; + * - package name was added in fields003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for fields003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fields.fields003 + * nsk.jdi.ReferenceType.fields.fields003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fields.fields003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/loadclass/fields003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/loadclass/fields003b.java new file mode 100644 index 00000000000..fbe6ddee028 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003/loadclass/fields003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the fields() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.fields; + +class fields003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003a.java new file mode 100644 index 00000000000..f808a057799 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields003a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.fields; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the fields003 JDI test. + */ + +public class fields003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private static final String package_prefix = "nsk.jdi.ReferenceType.fields."; + private static final String checked_class_name = package_prefix + "fields003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> fields003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> fields003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> fields003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> fields003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> fields003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> fields003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fields003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fields003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> fields003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> fields003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> fields003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> fields003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> fields003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> fields003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> fields003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fields003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fields003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> fields003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> fields003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of fields003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004.java new file mode 100644 index 00000000000..f796027328d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004.java @@ -0,0 +1,206 @@ +/* + * 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.ReferenceType.fields; + +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 fields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class fields004 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.fields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "fields004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "fields004aClassForCheck"; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new fields004().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/fields/fields004 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/fields/fields004 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/fields/fields004 test LOG:"); + print_log_anyway("==> test checks fields() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for class without any declarated fields\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> fields004: fields004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> fields004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> fields004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> fields004: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> fields004: check ReferenceType.fields() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean fields_method_error = false; + int returned_fields_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + print_log_anyway("##> fields004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List returned_fields_list = null; + try { + returned_fields_list = refType.fields(); + } + catch (Throwable thrown) { + print_log_anyway("##> fields004: FAILED: ReferenceType.fields() throws unexpected " + + thrown); + fields_method_error = true; + break; + } + returned_fields_number = returned_fields_list.size(); + if ( returned_fields_number == 0 ) { + break; + } + Field returned_fields[] = new Field[returned_fields_number]; + returned_fields_list.toArray(returned_fields); + for (int i=0; i fields004: FAILED: unexpected found field: " + returned_field_info); + } + break; + } + + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || fields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + if ( returned_fields_number > 0 ) { + print_log_anyway + ("##> fields004: UNEXPECTED found fields number = " + returned_fields_number); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_anyway + ("--> fields004: PASSED: returned list of fields is empty!"); + } + + print_log_on_verbose("--> fields004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> fields004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> fields004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004/TestDescription.java new file mode 100644 index 00000000000..e8e2a672c23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ReferenceType/fields/fields004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/fields/fields004 test + * checks the fields() method of ReferenceType interface + * of the com.sun.jdi package for class without any declarated fields: + * the ReferenceType.fields() method is checked for + * debugee's class which extends super class and implements interface. + * The checked class does not contain any declarated fields + * but extended super class and implemented interface have + * declarated fields. + * The test expects the returned list of fields to be empty. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.fields.fields004 + * nsk.jdi.ReferenceType.fields.fields004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fields.fields004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004a.java new file mode 100644 index 00000000000..9dc8565cfe4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields004a.java @@ -0,0 +1,128 @@ +/* + * 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.ReferenceType.fields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the fields004 JDI test. + */ + +public class fields004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 fields004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + fields004aClassForCheck class_for_check = new fields004aClassForCheck(); + + print_log_on_verbose("**> fields004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> fields004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> fields004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> fields004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> fields004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class fields004aClassForCheck extends fields004aSuperClassForCheck implements fields004aInterfaceForCheck { + +} + +class fields004aSuperClassForCheck { + + static boolean s_super_boolean_field; + static byte s_super_byte_field; + static char s_super_char_field; + static double s_super_double_field; + static float s_super_float_field; + static int s_super_int_field; + static long s_super_long_field; + static Object s_super_object_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + boolean i_super_boolean_field; + byte i_super_byte_field; + char i_super_char_field; + double i_super_double_field; + float i_super_float_field; + int i_super_int_field; + long i_super_long_field; + Object i_super_object_field; + + long i_super_hidden_prim_field; + Object i_super_hidden_ref_field; + + long ambiguous_prim_field; + Object ambiguous_ref_field; + +} + +interface fields004aInterfaceForCheck { + + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); + + static final long s_interf_hidden_prim_field = 1; + static final Object s_interf_hidden_ref_field = new Object(); + + static final long ambiguous_prim_field = 1; + static final Object ambiguous_ref_field = new Object(); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields005.java new file mode 100644 index 00000000000..625e7ade016 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields005.java @@ -0,0 +1,287 @@ +/* + * 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.ReferenceType.fields; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.fields() + * properly returns an empty field list for arrays (ArrayType) and primitive + * classes.

    + * + * Debugger part of it attempts to get a list of fields declared in several + * reference types corresponding to debuggee field values, which themselves + * are:
    + * primitive classes, and arrays of primitive types and classes. + */ +public class fields005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.fields.fields005t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested fields used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new fields005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "fields005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i " + 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(); + + // check there are enum constant fields + List l = checkedClass.fields(); + if (l.isEmpty()) { + complain("\t ReferenceType.fields() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + for (int i = 0; i < expectedEnumFieldsNames.length; i++) { + boolean hasField = false; + + Iterator it = l.iterator(); + while (it.hasNext()) { + Field checkedField = it.next(); + if (expectedEnumFieldsNames[i].equals(checkedField.name()) && + checkedField.type().equals(checkedClass) ) + + hasField = true; + } + if (hasField) { + display("enum " + className + " has field " + expectedEnumFieldsNames[i]); + display("\t of type " + className); + } 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields006/TestDescription.java new file mode 100644 index 00000000000..99d4c68c9a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields006/TestDescription.java @@ -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/ReferenceType/fields/fields006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for fields() method of ReferenceType interface. + * The test checks if the method returns each enum constants + * declared in mirrored enum type. + * The test consists of a debugger program (fields006.java) + * and debuggee application (fields006a.java). + * Package name is nsk.jdi.ReferenceType.fields . + * 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 fields() method for each field + * of enum type declared in fields006a class. Every of these + * enum types has the same enum constants, i.e fields: e1 and e2. + * The debugger checks if each field of expected name and type + * (it must be "self-typed") exists in returned list. + * The test fails if any of expected fields has not been met. + * 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.ReferenceType.fields.fields006 + * nsk.jdi.ReferenceType.fields.fields006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.fields.fields006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields006a.java new file mode 100644 index 00000000000..e97c7ece505 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/fields/fields006a.java @@ -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.ReferenceType.fields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class fields006a { + + //------------------------------------------------------- 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 fields006Enum1 f1 = fields006Enum1.e2; + static fields006Enum2 f2 = fields006Enum2.e1; + static fields006Enum1.Enum1_ f3 = fields006Enum1.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(fields006.SIGNAL_READY); + + + //pipe.println(fields006.SIGNAL_GO); + receiveSignal(fields006.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum fields006Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum fields006Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001.java new file mode 100644 index 00000000000..ceb9b6286c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001.java @@ -0,0 +1,263 @@ +/* + * 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.ReferenceType.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the ReferenceType.genericSignature() method.
    + *
    + * The test checks up ReferenceType.genericSignature() method
    + * for ArrayType and ClassType objects.
    + *
    + * The first: the test checks that genericSignature() method returns
    + * null for arrays of all primitive types.
    + *
    + * The second: the test checks that genericSignature() method returns
    + * null for arrays of reference types which have a ClassType as its
    + * type.
    + *
    + * The third: the test checks that genericSignature() method returns
    + * null for ClassType types which are not generic types.
    + *
    + * At last: the test checks that genericSignature() method returns
    + * a corresponding signature string for ClassType types which are
    + * generic types.
    + *
    + */ + +public class genericSignature001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature001: "; + static final String infoLogPrefix = "--> "; + static final String packagePrefix = "nsk.jdi.ReferenceType.genericSignature."; + static final String targetVMClassName = packagePrefix + "genericSignature001a"; + + static ArgumentHandler argsHandler; + static Log logHandler; + static boolean verboseMode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + + private final static String primitiveTypeSign = "primitiveType"; + private final static String referenceTypeSign = "referenceType"; + + /** + * Debugee's classes for check: + * classesForCheck[i][0] - basic class name (without arrays' brackets) + * classesForCheck[i][1] - type sign: primitive or reference) + * classesForCheck[i][2] - expected string returned by genericSignature() + */ + private final static String classesForCheck[][] = { + {"boolean", primitiveTypeSign, null}, + {"byte" , primitiveTypeSign, null}, + {"char" , primitiveTypeSign, null}, + {"double" , primitiveTypeSign, null}, + {"float" , primitiveTypeSign, null}, + {"int" , primitiveTypeSign, null}, + {"long" , primitiveTypeSign, null}, + + {packagePrefix + "GS001_Class01", referenceTypeSign, null}, + {packagePrefix + "GS001_Class02", referenceTypeSign, null}, + {packagePrefix + "GS001_Class03", referenceTypeSign, null}, + {packagePrefix + "GS001_Class04", referenceTypeSign, null}, + {packagePrefix + "GS001_Class05", referenceTypeSign, null}, + + {packagePrefix + "GS001_Class06", referenceTypeSign, + "Ljava/lang/Object;"}, + {packagePrefix + "GS001_Class07", referenceTypeSign, + "Ljava/lang/Object;"}, + {packagePrefix + "GS001_Class08", referenceTypeSign, + "Ljava/lang/Object;"}, + {packagePrefix + "GS001_Class09", referenceTypeSign, + "Ljava/lang/Object;"}, + {packagePrefix + "GS001_Class10", referenceTypeSign, + "Ljava/lang/Object;"}, + {packagePrefix + "GS001_Class11", referenceTypeSign, + "Lnsk/jdi/ReferenceType/genericSignature/GS001_Class06;"}, + + }; + + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + 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) { + + int result = new genericSignature001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/ReferenceType/genericSignature/genericSignature001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/ReferenceType/genericSignature/genericSignature001 test PASSED"); + } + return result; + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + verboseMode = argsHandler.verbose(); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/ReferenceType/genericSignature/genericSignature001 test..."); + logOnVerbose + ("==> Test checks the genericSignature() method of ReferenceType interface"); + logOnVerbose + ("==> of the com.sun.jdi package for ArrayType, ClassType, InterfaceType."); + + Binder binder = new Binder(argsHandler,logHandler); + Debugee debugee = binder.bindToDebugee(targetVMClassName); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + logOnVerbose(infoLogPrefixHead + "Debugee (" + targetVMClassName + ") launched..."); + debugee.resume(); + + String readySignal = "ready"; + String signalFromDebugee = pipe.readln(); + if ( ! readySignal.equals(signalFromDebugee) ) { + logOnError(errorLogPrefixHead + "Uexpected debugee's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + readySignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugee + "'"); + return STATUS_FAILED; + } + logOnVerbose(infoLogPrefixHead + "Debugee's signal recieved = '" + readySignal + "'"); + + logOnVerbose(infoLogPrefixHead + "check ReferenceType.genericSignature() method for debugee's classes..."); + String brackets[] = {"", "[]", "[][]"}; + for (int i=0; i 0 ) { + expectedGenericSignature = null; + } + String actualGenericSignature = null; + try { + actualGenericSignature = referenceType.genericSignature(); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "ReferenceType.genericSignature() throws unexpected exception: "); + logOnError(errorLogPrefix + "ReferenceType = '" + referenceType + "'"); + logOnError(errorLogPrefix + "Class name for this ReferenceType = '" + className + "'"); + logOnError(errorLogPrefix + "Exception = '" + thrown + "'"); + testResult = STATUS_FAILED; + continue; + } + boolean isFailure = false; + if ( expectedGenericSignature == null ) { + if ( actualGenericSignature != null ) { + isFailure = true; + } + } else { + if ( ! expectedGenericSignature.equals(actualGenericSignature) ) { + isFailure = true; + } + } + if ( isFailure ) { + logOnError(errorLogPrefixHead + "ReferenceType.genericSignature() returns unexpected signature: "); + logOnError(errorLogPrefix + "ReferenceType = '" + referenceType + "'"); + logOnError(errorLogPrefix + "Class name for this ReferenceType = '" + className + "'"); + logOnError(errorLogPrefix + "Expected generic signature = '" + expectedGenericSignature + "'"); + logOnError(errorLogPrefix + "Actual generic signature = '" + actualGenericSignature + "'"); + testResult = STATUS_FAILED; + } + } + } + logOnVerbose(infoLogPrefixHead + + "Check ReferenceType.genericSignature() method for debugee's classes completed."); + + logOnVerbose(infoLogPrefixHead + "Waiting for debugee finish..."); + String quitSignal = "quit"; + pipe.println(quitSignal); + debugee.waitFor(); + + int debugeeExitStatus = debugee.getStatus(); + if (debugeeExitStatus != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Unexpected Debugee's exit status: "); + logOnError(errorLogPrefix + "Expected status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + logOnError(errorLogPrefix + "Actual status = '" + debugeeExitStatus + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of genericSignature001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001/TestDescription.java new file mode 100644 index 00000000000..e336e3540d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/ReferenceType/genericSignature/genericSignature001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/genericSignature/genericSignature001 test: + * The test for the ReferenceType.genericSignature() method. + * The test checks up ReferenceType.genericSignature() method + * for ArrayType and ClassType objects. + * The first: the test checks that genericSignature() method returns + * null for arrays of all primitive types. + * The second: the test checks that genericSignature() method returns + * null for arrays of reference types which have a ClassType as its + * type. + * The third: the test checks that genericSignature() method returns + * null for ClassType types which are not generic types. + * At last: the test checks that genericSignature() method returns + * a corresponding signature string for ClassType types which are + * generic types. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.genericSignature.genericSignature001 + * nsk.jdi.ReferenceType.genericSignature.genericSignature001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.genericSignature.genericSignature001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001a.java new file mode 100644 index 00000000000..dd41eab3ddc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001a.java @@ -0,0 +1,171 @@ +/* + * 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.ReferenceType.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for + * the nsk/jdi/ReferenceType/genericSignature/genericSignature001 JDI test. + */ + +public class genericSignature001a { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature001(Debugee): "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature001(Debugee): "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + // instantiating of arrays of primitive types for check ReferenceType.genericSignature() method + + 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}; + + // instantiating of non-generic reference types and arrays of non-generic reference types + // for check ReferenceType.genericSignature() method + + GS001_Class01 GS001_Class01_Obj0 = new GS001_Class01(), + GS001_Class01_Obj1[]={GS001_Class01_Obj0}, + GS001_Class01_Obj2[][]={GS001_Class01_Obj1}; + + GS001_Class02 GS001_Class02_Obj0 = new GS001_Class02(), + GS001_Class02_Obj1[]={GS001_Class02_Obj0}, + GS001_Class02_Obj2[][]={GS001_Class02_Obj1}; + + GS001_Class03 GS001_Class03_Obj0 = new GS001_Class03(), + GS001_Class03_Obj1[]={GS001_Class03_Obj0}, + GS001_Class03_Obj2[][]={GS001_Class03_Obj1}; + + GS001_Class04 GS001_Class04_Obj0 = new GS001_Class04(), + GS001_Class04_Obj1[]={GS001_Class04_Obj0}, + GS001_Class04_Obj2[][]={GS001_Class04_Obj1}; + + GS001_Class05 GS001_Class05_Obj0 = new GS001_Class05(), + GS001_Class05_Obj1[]={GS001_Class05_Obj0}, + GS001_Class05_Obj2[][]={GS001_Class05_Obj1}; + + // instantiating of generic types for check ReferenceType.genericSignature() method + + GS001_Class06 GS001_Class06_Obj = new GS001_Class06(); + + GS001_Class07 GS001_Class07_Obj = + new GS001_Class07(); + + GS001_Class08 GS001_Class08_Obj = new GS001_Class08(); + + GS001_Class09 GS001_Class09_Obj = new GS001_Class09(); + + GS001_Class10 GS001_Class10_Obj = + new GS001_Class10(); + + GS001_Class11 GS001_Class11_Obj = new GS001_Class11(); + + + public static void main (String argv[]) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(System.err, argsHandler); + logHandler.enableErrorsSummary(false); + IOPipe pipe = argsHandler.createDebugeeIOPipe(); + + logOnVerbose(infoLogPrefixHead + "Debugee started!"); + + genericSignature001a genericSignature001aDebugee = new genericSignature001a(); + + String readySignal = "ready"; + pipe.println(readySignal); + String quitSignal = "quit"; + logOnVerbose(infoLogPrefixHead + "Wait for '" + quitSignal + "' signal..."); + String signalFromDebugger = pipe.readln(); + if ( ! (quitSignal.equals(signalFromDebugger)) ) { + logOnError(errorLogPrefixHead + "UNEXPECTED debugger's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + quitSignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugger + "'"); + logOnError(errorLogPrefix + "Exiting with Exit Status = '" + (STATUS_FAILED + STATUS_TEMP) + "'"); + System.exit(STATUS_FAILED + STATUS_TEMP); + } + logOnVerbose(infoLogPrefixHead + "'" + quitSignal + "' signal from debugger is received."); + logOnVerbose(infoLogPrefix + "Exiting with Exit Status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + System.exit(STATUS_PASSED + STATUS_TEMP); + } +} // end of genericSignature001a class + + +// non generic classes: + +class GS001_Class01 {} + +class GS001_Class02 {} + +interface GS001_Interf01 {} + +interface GS001_Interf02 {} + +class GS001_Class03 extends GS001_Class01 {} + +class GS001_Class04 extends GS001_Class01 implements GS001_Interf01 {} + +class GS001_Class05 extends GS001_Class02 implements GS001_Interf02 {} + + +// generic classes: + +class GS001_Class06 {} + +class GS001_Class07 {} + +class GS001_Class08 {} + +class GS001_Class09 {} + +class GS001_Class10 {} + +class GS001_Class11 extends GS001_Class06 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002.java new file mode 100644 index 00000000000..86262573aae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002.java @@ -0,0 +1,241 @@ +/* + * 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.ReferenceType.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the ReferenceType.genericSignature() method.
    + *
    + * The test checks up ReferenceType.genericSignature() method
    + * for InterfaceType objects.
    + *
    + * The first: the test checks that genericSignature() method returns
    + * null for arrays of reference types which have a InterfaceType as
    + * its type.
    + *
    + * The second: the test checks that genericSignature() method returns
    + * null for InterfaceType types which are not generic types.
    + *
    + * At last: the test checks that genericSignature() method returns
    + * a corresponding signature string for InterfaceType types which are
    + * generic types.
    + *
    + */ + +public class genericSignature002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature002: "; + static final String infoLogPrefix = "--> "; + static final String packagePrefix = "nsk.jdi.ReferenceType.genericSignature."; + static final String targetVMClassName = packagePrefix + "genericSignature002a"; + + static ArgumentHandler argsHandler; + static Log logHandler; + static boolean verboseMode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + + /** + * Debugee's classes for check: + * classesForCheck[i][0] - basic interface name (without arrays' brackets) + * classesForCheck[i][1] - expected string returned by genericSignature() + */ + /** Debugee's classes for check **/ + private final static String classesForCheck[][] = { + + {packagePrefix + "GS002_Interf01", null}, + {packagePrefix + "GS002_Interf02", null}, + + {packagePrefix + "GS002_Interf03", "Ljava/lang/Object;"}, + {packagePrefix + "GS002_Interf04", "Ljava/lang/Object;"}, + {packagePrefix + "GS002_Interf05", + "Ljava/lang/Object;"}, + {packagePrefix + "GS002_Interf06", + "Ljava/lang/Object;"}, + {packagePrefix + "GS002_Interf07", + "Ljava/lang/Object;"}, + {packagePrefix + "GS002_Interf08", + "Ljava/lang/Object;Lnsk/jdi/ReferenceType/genericSignature/GS002_Interf03;"} + + }; + + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + 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) { + + int result = new genericSignature002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/ReferenceType/genericSignature/genericSignature002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/ReferenceType/genericSignature/genericSignature002 test PASSED"); + } + return result; + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + verboseMode = argsHandler.verbose(); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/ReferenceType/genericSignature/genericSignature002 test..."); + logOnVerbose + ("==> Test checks the genericSignature() method of ReferenceType interface"); + logOnVerbose + ("==> of the com.sun.jdi package for InterfaceType."); + + Binder binder = new Binder(argsHandler,logHandler); + Debugee debugee = binder.bindToDebugee(targetVMClassName); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + logOnVerbose(infoLogPrefixHead + "Debugee (" + targetVMClassName + ") launched..."); + debugee.resume(); + + String readySignal = "ready"; + String signalFromDebugee = pipe.readln(); + if ( ! readySignal.equals(signalFromDebugee) ) { + logOnError(errorLogPrefixHead + "Uexpected debugee's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + readySignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugee + "'"); + return STATUS_FAILED; + } + logOnVerbose(infoLogPrefixHead + "Debugee's signal recieved = '" + readySignal + "'"); + + logOnVerbose(infoLogPrefixHead + "check ReferenceType.genericSignature() method for debugee's classes..."); + String brackets[] = {"", "[]", "[][]"}; + for (int i=0; i 0 ) { // array type + if ( classesForCheck[i][1] != null ) { // it is generic type + continue; // arrays of generic types are not allowed + } + } + String className = basicName + brackets[arrayDimension]; + ReferenceType referenceType = debugee.classByName(className); + if (referenceType == null) { + logOnError(errorLogPrefixHead + "Could NOT find ReferenceType object for debugee's class: "); + logOnError(errorLogPrefix + "Requested class name = '" + className + "'"); + testResult = STATUS_FAILED; + continue; + } + String expectedGenericSignature = classesForCheck[i][1]; + if ( arrayDimension > 0 ) { + expectedGenericSignature = null; + } + String actualGenericSignature = null; + try { + actualGenericSignature = referenceType.genericSignature(); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "ReferenceType.genericSignature() throws unexpected exception: "); + logOnError(errorLogPrefix + "ReferenceType = '" + referenceType + "'"); + logOnError(errorLogPrefix + "Class name for this ReferenceType = '" + className + "'"); + logOnError(errorLogPrefix + "Exception = '" + thrown + "'"); + testResult = STATUS_FAILED; + continue; + } + boolean isFailure = false; + if ( expectedGenericSignature == null ) { + if ( actualGenericSignature != null ) { + isFailure = true; + } + } else { + if ( ! expectedGenericSignature.equals(actualGenericSignature) ) { + isFailure = true; + } + } + if ( isFailure ) { + logOnError(errorLogPrefixHead + "ReferenceType.genericSignature() returns unexpected signature: "); + logOnError(errorLogPrefix + "ReferenceType = '" + referenceType + "'"); + logOnError(errorLogPrefix + "Class name for this ReferenceType = '" + className + "'"); + logOnError(errorLogPrefix + "Expected generic signature = '" + expectedGenericSignature + "'"); + logOnError(errorLogPrefix + "Actual generic signature = '" + actualGenericSignature + "'"); + testResult = STATUS_FAILED; + } + } + } + logOnVerbose(infoLogPrefixHead + + "Check ReferenceType.genericSignature() method for debugee's classes completed."); + + logOnVerbose(infoLogPrefixHead + "Waiting for debugee finish..."); + String quitSignal = "quit"; + pipe.println(quitSignal); + debugee.waitFor(); + + int debugeeExitStatus = debugee.getStatus(); + if (debugeeExitStatus != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Unexpected Debugee's exit status: "); + logOnError(errorLogPrefix + "Expected status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + logOnError(errorLogPrefix + "Actual status = '" + debugeeExitStatus + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of genericSignature002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002/TestDescription.java new file mode 100644 index 00000000000..ef37114b303 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002/TestDescription.java @@ -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/ReferenceType/genericSignature/genericSignature002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/genericSignature/genericSignature002 test: + * The test for the ReferenceType.genericSignature() method. + * The test checks up ReferenceType.genericSignature() method + * for InterfaceType objects. + * The first: the test checks that genericSignature() method returns + * null for arrays of reference types which have a InterfaceType as + * its type. + * The second: the test checks that genericSignature() method returns + * null for InterfaceType types which are not generic types. + * At last: the test checks that genericSignature() method returns + * a corresponding signature string for InterfaceType types which are + * generic types. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.genericSignature.genericSignature002 + * nsk.jdi.ReferenceType.genericSignature.genericSignature002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.genericSignature.genericSignature002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002a.java new file mode 100644 index 00000000000..9be56cd362f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002a.java @@ -0,0 +1,155 @@ +/* + * 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.ReferenceType.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for + * the nsk/jdi/ReferenceType/genericSignature/genericSignature002 JDI test. + */ + +public class genericSignature002a { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature002(Debugee): "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature002(Debugee): "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + // instantiating of non-generic interface types and arrays of non-generic interface types + // for check ReferenceType.genericSignature() method + + GS002_Class00 GS002_Class00_Obj = new GS002_Class00(); + + GS002_Interf01 GS002_Interf01_Obj0 = new GS002_Class01(); + GS002_Interf01[] GS002_Interf01_Obj1 = {GS002_Interf01_Obj0}; + GS002_Interf01[][] GS002_Interf01_Obj2 = {GS002_Interf01_Obj1}; + + GS002_Interf02 GS002_Interf02_Obj0 = new GS002_Class02(); + GS002_Interf02[] GS002_Interf02_Obj1 = {GS002_Interf02_Obj0}; + GS002_Interf02[][] GS002_Interf02_Obj2 = {GS002_Interf02_Obj1}; + + // instantiating of generic interface types for check ReferenceType.genericSignature() method + + GS002_Interf03 GS002_Interf03_Obj = new GS002_Class03(); + GS002_Interf04 GS002_Interf04_Obj = new GS002_Class04(); + GS002_Interf05 GS002_Interf05_Obj = new GS002_Class05(); + GS002_Interf06 GS002_Interf06_Obj = new GS002_Class06(); + GS002_Interf07 GS002_Interf07_Obj = new GS002_Class07(); + GS002_Interf08 GS002_Interf08_Obj = new GS002_Class08(); + + + public static void main (String argv[]) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(System.err, argsHandler); + logHandler.enableErrorsSummary(false); + IOPipe pipe = argsHandler.createDebugeeIOPipe(); + + logOnVerbose(infoLogPrefixHead + "Debugee started!"); + + genericSignature002a genericSignature002aDrbugee = new genericSignature002a(); + + String readySignal = "ready"; + pipe.println(readySignal); + String quitSignal = "quit"; + logOnVerbose(infoLogPrefixHead + "Wait for '" + quitSignal + "' signal..."); + String signalFromDebugger = pipe.readln(); + if ( ! (quitSignal.equals(signalFromDebugger)) ) { + logOnError(errorLogPrefixHead + "UNEXPECTED debugger's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + quitSignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugger + "'"); + logOnError(errorLogPrefix + "Exiting with Exit Status = '" + (STATUS_FAILED + STATUS_TEMP) + "'"); + System.exit(STATUS_FAILED + STATUS_TEMP); + } + logOnVerbose(infoLogPrefixHead + "'" + quitSignal + "' signal from debugger is received."); + logOnVerbose(infoLogPrefix + "Exiting with Exit Status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + System.exit(STATUS_PASSED + STATUS_TEMP); + } +} // end of genericSignature002a class + + +// non generic interfaces: + +interface GS002_Interf01 {} + +interface GS002_Interf02 {} + +// generic interfaces: + +interface GS002_Interf03 {} + +interface GS002_Interf04 {} + +interface GS002_Interf05 {} + +interface GS002_Interf06 {} + +interface GS002_Interf07 {} + +interface GS002_Interf08 extends GS002_Interf03 {} + + + +// Auxiliary classes + +class GS002_Class00 implements GS002_Interf02 {} + +class GS002_Class01 implements GS002_Interf01 {} + +class GS002_Class02 implements GS002_Interf02 {} + +class GS002_Class03 implements GS002_Interf03 {} + +class GS002_Class04 implements GS002_Interf04 {} + +class GS002_Class05 implements GS002_Interf05 {} + +class GS002_Class06 implements GS002_Interf06 {} + +class GS002_Class07 implements GS002_Interf07 {} + +class GS002_Class08 implements GS002_Interf08 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001.java new file mode 100644 index 00000000000..a8bbadaf602 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001.java @@ -0,0 +1,476 @@ +/* + * 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.ReferenceType.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.getValue()
    + * complies with its spec.
    + * Case for testing includes fields mirroring primitive type values.
    + * The test checks that Values returned by the method,
    + * are casted to PrimitiveValue(s).
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class getvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/getValue/getvalue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new getvalue001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.getValue.getvalue001a"; + + private String testedClassName = + "nsk.jdi.ReferenceType.getValue.getvalue001aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" name of tested class : " + testedClassName); + log2(" getting: List classes = vm.classByName(testedClassName);"); + List classes = vm.classesByName(testedClassName); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + break; + } + log2(" getting: ReferenceType testedClass = (ReferenceType) classes.get(0);"); + ReferenceType testedClass = (ReferenceType) classes.get(0); + + log2("------case for testing: primitive values"); + + String fieldNames0[] = { + "bl0", + "bt0", + "ch0", + "db0", + "fl0", + "in0", + "ln0", + "sh0" }; + + for (int i1 = 0; i1 < 8; i1++) { + + log2("......field tested : " + fieldNames0[i1]); + log2(" getting: Field field = testedClass.fieldByName(fieldNames0[i1]);"); + Field field = testedClass.fieldByName(fieldNames0[i1]); + if (field == null) { + log3("ERROR: field == null"); + testExitCode = FAILED; + continue; + } + log2(" getting: Value value = testedClass.getValue(field);"); + Value value = testedClass.getValue(field); + if (value == null) { + log3("ERROR: value == null"); + testExitCode = FAILED; + continue; + } + try { + log2(" getting Class cast: PrimitiveValue primitiveValue = (PrimitiveValue) value;"); + PrimitiveValue primitiveValue = (PrimitiveValue) value; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001/TestDescription.java new file mode 100644 index 00000000000..0c503afd2d8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001/TestDescription.java @@ -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/ReferenceType/getValue/getvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.getValue() + * complies with its spec: + * public Value getValue(Field field) + * Gets the Value of a given static Field in this type. + * The Field must be valid for this type; that is, it must be declared + * in this type, a superclass, a superinterface, or an implemented interface. + * Parameters: field - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * Case for testing includes fields mirroring primitive type values + * in this type, a superclass, a superinterface, and an implemented interface. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.getValue.getvalue001; + * the debuggee program - nsk.jdi.ReferenceType.getValue.getvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ReferenceType.getValue.getvalue001 + * nsk.jdi.ReferenceType.getValue.getvalue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.getValue.getvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001a.java new file mode 100644 index 00000000000..6404f56ed2a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue001a.java @@ -0,0 +1,134 @@ +/* + * 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.ReferenceType.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue001 JDI test. + */ + +public class getvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + getvalue001aTestClass testObj = new getvalue001aTestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +interface getvalue001aInterface1 { + char ch0 = 0; + double db0 = 0.0d; +} +interface getvalue001aInterface0 extends getvalue001aInterface1 { + boolean bl0 = false; + byte bt0 = 0; +} +interface getvalue001aInterface2 { + long ln0 = 0; +} +class getvalue001aClass1 implements getvalue001aInterface2 { + static short sh0 = 0; +} +class getvalue001aTestClass extends getvalue001aClass1 implements getvalue001aInterface0 { + static float fl0 = 0.0f; + static int in0 = 0; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002.java new file mode 100644 index 00000000000..eb701855946 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002.java @@ -0,0 +1,476 @@ +/* + * 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.ReferenceType.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.getValue()
    + * complies with its spec.
    + * Case for testing includes arrays of primitive types declared
    + * in this type and its superclass.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class getvalue002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/getValue/getvalue002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new getvalue002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.getValue.getvalue002a"; + + private String testedClassName = + "nsk.jdi.ReferenceType.getValue.getvalue002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" name of tested class : " + testedClassName); + log2(" getting: List classes = vm.classByName(testedClassName);"); + List classes = vm.classesByName(testedClassName); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + break; + } + log2(" getting: ReferenceType testedClass = (ReferenceType) classes.get(0);"); + ReferenceType testedClass = (ReferenceType) classes.get(0); + + + log2("------case for testing: arrays of primitive values"); + + String fieldNames[] = { + // "fl1", + // "in1", + // "ln1", + // "sh1" + // "fl1", + "in1", + "ln1", + "sh1" + }; + + for (int i1 = 0; i1 < fieldNames.length; i1++) { + + log2("......field tested : " + fieldNames[i1]); + log2(" getting: Field field = testedClass.fieldByName(fieldNames[i1]);"); + Field field = testedClass.fieldByName(fieldNames[i1]); + if (field == null) { + log3("ERROR: field == null"); + testExitCode = FAILED; + continue; + } + log2(" getting: Value value = testedClass.getValue(field);"); + Value value = testedClass.getValue(field); + if (value == null) { + log3("ERROR: value == null"); + testExitCode = FAILED; + continue; + } + try { + log2(" getting Class cast: ObjectReference objectReferenceValue = (ObjectReference) value;"); + ObjectReference objectReferenceValue = (ObjectReference) value; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002/TestDescription.java new file mode 100644 index 00000000000..5510da282e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002/TestDescription.java @@ -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/ReferenceType/getValue/getvalue002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.getValue() + * complies with its spec: + * public Value getValue(Field field) + * Gets the Value of a given static Field in this type. + * The Field must be valid for this type; that is, it must be declared + * in this type, a superclass, a superinterface, or an implemented interface. + * Parameters: field - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * Case for testing includes arrays of primitive types declared + * in this type, a superclass, a superinterface, and an implemented interface. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.getValue.getvalue002; + * the debuggee program - nsk.jdi.ReferenceType.getValue.getvalue002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ReferenceType.getValue.getvalue002 + * nsk.jdi.ReferenceType.getValue.getvalue002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.getValue.getvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002a.java new file mode 100644 index 00000000000..88d45ac47e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue002a.java @@ -0,0 +1,146 @@ +/* + * 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.ReferenceType.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue002 JDI test. + */ + +public class getvalue002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + getvalue002aTestClass testObj = new getvalue002aTestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +interface getvalue002aInterface1 { + boolean[][][][] bl1 = { {{{true, false}, {true, false}}, {{true, false}, {true, false}} }, + {{{true, false}, {true, false}}, {{true, false}, {true, false}} } }; + byte [][][][] bt1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; +} + +interface getvalue002aInterface0 extends getvalue002aInterface1 { + char [][][][] ch1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; + double [][][][] db1 = { {{{0.0d, 1.0d},{0.0d, 1.0d}}, {{0.0d, 1.0d},{0.0d, 1.0d}}}, + {{{0.0d, 1.0d},{0.0d, 1.0d}}, {{0.0d, 1.0d},{0.0d, 1.0d}}} }; +} + +interface getvalue002aInterface2 { + float [][][][] fl1 = { {{{0.0f, 1.0f},{0.0f, 1.0f}}, {{0.0f, 1.0f},{0.0f, 1.0f}}}, + {{{0.0f, 1.0f},{0.0f, 1.0f}}, {{0.0f, 1.0f},{0.0f, 1.0f}}} }; +} + +class getvalue002aClass1 implements getvalue002aInterface2 { + static int [][][][] in1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; +} + +class getvalue002aTestClass extends getvalue002aClass1 implements getvalue002aInterface0 { + static long [][][][] ln1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; + static short [][][][] sh1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003.java new file mode 100644 index 00000000000..1130fbc2f30 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003.java @@ -0,0 +1,476 @@ +/* + * 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.ReferenceType.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.getValue()
    + * complies with its spec.
    + * Case for testing includes arrays of primitive types declared
    + * in a superinterface and an implemented interface.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class getvalue003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/getValue/getvalue003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new getvalue003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.getValue.getvalue003a"; + + private String testedClassName = + "nsk.jdi.ReferenceType.getValue.getvalue003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" name of tested class : " + testedClassName); + log2(" getting: List classes = vm.classByName(testedClassName);"); + List classes = vm.classesByName(testedClassName); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + break; + } + log2(" getting: ReferenceType testedClass = (ReferenceType) classes.get(0);"); + ReferenceType testedClass = (ReferenceType) classes.get(0); + + + log2("------case for testing: arrays of primitive values"); + + String fieldNames[] = { + "bl1", + "bt1", + "ch1", + "db1", + "fl1" + //"in1", + //"ln1", + //"sh1" + }; + + for (int i1 = 0; i1 < fieldNames.length; i1++) { + + log2("......field tested : " + fieldNames[i1]); + log2(" getting: Field field = testedClass.fieldByName(fieldNames[i1]);"); + Field field = testedClass.fieldByName(fieldNames[i1]); + if (field == null) { + log3("ERROR: field == null"); + testExitCode = FAILED; + continue; + } + log2(" getting: Value value = testedClass.getValue(field);"); + Value value = testedClass.getValue(field); + if (value == null) { + log3("ERROR: value == null"); + testExitCode = FAILED; + continue; + } + try { + log2(" getting Class cast: ObjectReference objectReferenceValue = (ObjectReference) value;"); + ObjectReference objectReferenceValue = (ObjectReference) value; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003/TestDescription.java new file mode 100644 index 00000000000..d2a22dfc0d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003/TestDescription.java @@ -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/ReferenceType/getValue/getvalue003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.getValue() + * complies with its spec: + * public Value getValue(Field field) + * Gets the Value of a given static Field in this type. + * The Field must be valid for this type; that is, it must be declared + * in this type, a superclass, a superinterface, or an implemented interface. + * Parameters: field - the field containing the requested value + * Returns: the Value of the instance field. + * Throws: IllegalArgumentException - + * if the field is not valid for this object's class. + * Case for testing includes arrays of primitive types declared + * in this type, a superclass, a superinterface, and an implemented interface. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.getValue.getvalue003; + * the debuggee program - nsk.jdi.ReferenceType.getValue.getvalue003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test modified due to fix of the bug: + * 4499876 TEST_BUG: ReferenceType.getValue() returns null for ArrayType in interface + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.getValue.getvalue003 + * nsk.jdi.ReferenceType.getValue.getvalue003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.getValue.getvalue003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003a.java new file mode 100644 index 00000000000..1da67aae691 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue003a.java @@ -0,0 +1,160 @@ +/* + * 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.ReferenceType.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalue003 JDI test. + */ + +public class getvalue003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + getvalue003aTestClass testObj = new getvalue003aTestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +interface getvalue003aInterface1 { + boolean[][][][] bl1 = { {{{true, false}, {true, false}}, {{true, false}, {true, false}} }, + {{{true, false}, {true, false}}, {{true, false}, {true, false}} } }; + byte [][][][] bt1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; +} + +interface getvalue003aInterface0 extends getvalue003aInterface1 { + char [][][][] ch1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; + double [][][][] db1 = { {{{0.0d, 1.0d},{0.0d, 1.0d}}, {{0.0d, 1.0d},{0.0d, 1.0d}}}, + {{{0.0d, 1.0d},{0.0d, 1.0d}}, {{0.0d, 1.0d},{0.0d, 1.0d}}} }; +} + +interface getvalue003aInterface2 { + float [][][][] fl1 = { {{{0.0f, 1.0f},{0.0f, 1.0f}}, {{0.0f, 1.0f},{0.0f, 1.0f}}}, + {{{0.0f, 1.0f},{0.0f, 1.0f}}, {{0.0f, 1.0f},{0.0f, 1.0f}}} }; +} + +class getvalue003aClass1 implements getvalue003aInterface2 { + static int [][][][] in1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; +} + +class getvalue003aTestClass extends getvalue003aClass1 implements getvalue003aInterface0 { + static final long [][][][] ln1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; + static final short [][][][] sh1 = { {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}}, + {{{0, 1},{0, 1}}, {{0, 1},{0, 1}}} }; + + boolean[][][][] bl0; + byte [][][][] bt0; + char [][][][] ch0; + double [][][][] db0; + float [][][][] fl0; + + public getvalue003aTestClass () { + bl0 = bl1; + bt0 = bt1; + ch0 = ch1; + db0 = db1; + fl0 = fl1; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue004.java new file mode 100644 index 00000000000..e02927bdee2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue004.java @@ -0,0 +1,300 @@ +/* + * 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.ReferenceType.getValue; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.getValue() + * properly throws IllegalArgumentException - if the field + * is not valid for this object's class.

    + * + * Debuggee part of the test consists of the following classes: + * getvalue004t, getvalue004tDummySuperCls, and + * getvalue004tDummyCls which extends getvalue004tDummySuperCls.
    + * The exception is provoked to be thrown by getting a Value of:
    + *

  • field obtained from the getvalue004tDummyCls but applied to + * reference type of the getvalue004t + *
  • private field obtained from the getvalue004tDummySuperCls + * but applied to reference type of the getvalue004t + */ +public class getvalue004 { + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ReferenceType.getValue.getvalue004t", + "nsk.jdi.ReferenceType.getValue.getvalue004tDummyCls", + "nsk.jdi.ReferenceType.getValue.getvalue004tDummySuperCls" + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 58; + + static final int FLD_NUM = 16; + // tested fields used to provoke the exception and + // type reference numbers for obtaining/applying a Field + static final String DEBUGGEE_FLDS[][] = { + {"boolFld", "0", "1"}, + {"byteFld", "0", "1"}, + {"charFld", "0", "1"}, + {"doubleFld", "0", "1"}, + {"floatFld", "0", "1"}, + {"intFld", "0", "1"}, + {"longFld", "0", "1"}, + {"shortFld", "0", "1"}, + {"boolPrFld", "0", "2"}, + {"bytePrFld", "0", "2"}, + {"charPrFld", "0", "2"}, + {"doublePrFld", "0", "2"}, + {"floatPrFld", "0", "2"}, + {"intPrFld", "0", "2"}, + {"longPrFld", "0", "2"}, + {"shortPrFld", "0", "2"} + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getvalue004().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "getvalue004t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + ReferenceType[] rType = new ReferenceType[3]; + // debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + + for (int i=0; icom.sun.jdi.ReferenceType.getValue() + * properly throws IllegalArgumentException for non-static field.

    + * + * The exception is provoked to be thrown by getting a Value of:
    + *

  • protected non-static field + *
  • private non-static field + *
  • package non-static field (default access) + *
  • public non-static field. + */ +public class getvalue005 { + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ReferenceType.getValue.getvalue005t", + "nsk.jdi.ReferenceType.getValue.getvalue005tDummyCls" + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 56; + + static final int FLD_NUM = 32; + // tested non-static fields used to provoke the exception + static final String DEBUGGEE_FLDS[] = { + "boolProtFld", + "byteProtFld", + "charProtFld", + "doubleProtFld", + "floatProtFld", + "intProtFld", + "longProtFld", + "shortProtFld", + "boolPrFld", + "bytePrFld", + "charPrFld", + "doublePrFld", + "floatPrFld", + "intPrFld", + "longPrFld", + "shortPrFld", + "boolPubFld", + "bytePubFld", + "charPubFld", + "doublePubFld", + "floatPubFld", + "intPubFld", + "longPubFld", + "shortPubFld", + "boolFld", + "byteFld", + "charFld", + "doubleFld", + "floatFld", + "intFld", + "longFld", + "shortFld" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getvalue005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "getvalue005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + ReferenceType[] rType = new ReferenceType[2]; + // debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + + for (int i=0; i + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.getValues()
    + * complies with its spec.
    + *
    + * Case for testing includes fields mirroring primitive type values
    + * declared in this type, a superclass, a superinterface, and
    + * an implemented interface.
    + * The test checks that Map returned by the method,
    + * contains all the tested variables.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class getvalues001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/getValues/getvalues001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new getvalues001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.getValues.getvalues001a"; + + private String testedClassName = + "nsk.jdi.ReferenceType.getValues.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2(" name of tested class : " + testedClassName); + log2(" getting: List classes = vm.classByName(testedClassName);"); + List classes = vm.classesByName(testedClassName); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + break; + } + log2(" getting: ReferenceType testedClass = (ReferenceType) classes.get(0);"); + ReferenceType testedClass = (ReferenceType) classes.get(0); + + log2("------case for testing: primitive values"); + + String fieldNames[] = { + "bl0", + "bt0", + "ch0", + "db0", + "fl0", + "in0", + "ln0", + "sh0" + }; + + Field [] fArray = { + testedClass.fieldByName(fieldNames[0]), + testedClass.fieldByName(fieldNames[1]), + testedClass.fieldByName(fieldNames[2]), + testedClass.fieldByName(fieldNames[3]), + testedClass.fieldByName(fieldNames[4]), + testedClass.fieldByName(fieldNames[5]), + testedClass.fieldByName(fieldNames[6]), + testedClass.fieldByName(fieldNames[7]), + }; + + log2(" getting: List fields = testedClass.visibleFields();"); + List fields = testedClass.visibleFields(); + + log2(" getting: Map valuesMap = testedClass.getValues(fields);"); + Map valuesMap = testedClass.getValues(fields); + Set keySet = valuesMap.keySet(); + Iterator setIterator = keySet.iterator(); + + int flag = 0; + int controlFlag = 0xFF; + + Field f1 = null; + + log2(" loop of testing the Map"); + + for (int ifor = 0; setIterator.hasNext(); ifor++) { + + f1 = setIterator.next(); + + int flag1 = 0; + for (int ifor1 = 0; ifor1 < fieldNames.length; ifor1++) { + + if (f1.equals(fArray[ifor1])) { + if (flag1 == 0) { + flag1++; + flag |= 1 << ifor1; + break; + } else { + log3("ERROR: duplication in the Map; ifor = " + ifor + " ifor1 = " + ifor1); + testExitCode = FAILED; + } + } + } + } + if (flag != controlFlag) { + log3("ERROR: returned Map object doesn't contain all tested fields"); + testExitCode = FAILED; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues001/TestDescription.java new file mode 100644 index 00000000000..50487616499 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ReferenceType/getValues/getvalues001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.getValues() + * complies with its spec: + * public Map getValues(List fields) + * Returns a map containing the Value of each static Field in the given list. + * The Fields must be valid for this type; that is, + * they must be declared in this type, a superclass, a superinterface, or + * an implemented interface. + * Parameters: fields - a list of Field objects containing the requested values. + * Returns: a Map of the requested Field objects with their Value. + * Throws: IllegalArgumentException - + * if any field is not valid for this object's class. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to the same VirtualMachine. + * Case for testing includes fields mirroring primitive type values + * declared in this type, a superclass, a superinterface, and an implemented interface. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.getValues.getvalues001; + * the debuggee program - nsk.jdi.ReferenceType.getValues.getvalues001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ReferenceType.getValues.getvalues001 + * nsk.jdi.ReferenceType.getValues.getvalues001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.getValues.getvalues001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues001a.java new file mode 100644 index 00000000000..496d838083e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues001a.java @@ -0,0 +1,134 @@ +/* + * 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.ReferenceType.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getvalues001 JDI test. + */ + +public class getvalues001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + TestClass testObj = new TestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +interface Interface1 { + char ch0 = 0; + double db0 = 0.0d; +} +interface Interface0 extends Interface1 { + boolean bl0 = false; + byte bt0 = 0; +} +interface Interface2 { + long ln0 = 0; +} +class Class1 implements Interface2 { + static short sh0 = 0; +} +class TestClass extends Class1 implements Interface0 { + static float fl0 = 0.0f; + static int in0 = 0; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002.java new file mode 100644 index 00000000000..d0370d4ca34 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002.java @@ -0,0 +1,309 @@ +/* + * 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.ReferenceType.getValues; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.getValues() + * properly throws IllegalArgumentException - if any field is + * not valid for this object's class.

    + * + * Debuggee part of the test consists of the following classes: + * getvalues002t, getvalues002tDummySuperCls, and + * getvalues002tDummyCls which extends getvalues002tDummySuperCls.
    + * The exception is provoked to be thrown by getting a Map of values + * which correspond to a list containing some wrong fields such as:
    + *

  • fields obtained from the getvalues002tDummyCls but applied to + * reference type of the getvalues002t + *
  • some non-static fields from the getvalues002tDummyCls applied to + * its reference type. + */ +public class getvalues002 { + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ReferenceType.getValues.getvalues002t", + "nsk.jdi.ReferenceType.getValues.getvalues002tDummyCls", + "nsk.jdi.ReferenceType.getValues.getvalues002tDummySuperCls" + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 58; + + static final int LST_NUM = 2; // number of lists + static final int FLD_NUM = 8; // number of fields in particular list + // tested fields used to provoke the exception and + // type reference numbers for applying/obtaining a Field + static final String DEBUGGEE_FLDS[][][] = { + {{"boolFld", "0", "1", "static"}, + {"byteFld", "0", "1", "static"}, + {"charFld", "0", "1", "static"}, + {"doubleFld", "0", "1", "static"}, + {"floatFld", "0", "1", "static"}, + {"intFld", "0", "1", "static"}, + {"longFld", "0", "1", "static"}, + {"shortFld", "0", "1", "static"}}, + + {{"boolMiscFld", "1", "1", "static"}, + {"byteMiscFld", "1", "1", "static"}, + {"charMiscFld", "1", "1", "wrong non-static"}, + {"doubleMiscFld", "1", "1", "static"}, + {"floatMiscFld", "1", "1", "static"}, + {"intMiscFld", "1", "1", "static"}, + {"longMiscFld", "1", "1", "wrong non-static"}, + {"shortMiscFld", "1", "1", "static"}} + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getvalues002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "getvalues002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + ReferenceType[] rType = new ReferenceType[3]; + // debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + + for (int l=0; l flds = new ArrayList(); + int appIx = 0; + int obtIx = 0; + + + for (int i=0; i valMap = rType[appIx].getValues(flds); + + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to get a Map containing Value of each field in the list" + + "\n\t\tusing reference type \"" + + rType[appIx] + "\",\n\t\tand some of the fields are not valid"); + tot_res = Consts.TEST_FAILED; + } catch (IllegalArgumentException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch (Exception ue) { + ue.printStackTrace(); + log.complain("TEST FAILED: caught unexpected " + + ue + "\n\tinstead of expected IllegalArgumentException" + + "\n\twhen attempted to get a Map containing Value of each field in the list" + + "\"\n\t\tusing reference type \"" + + rType[appIx] + "\",\n\t\tand some of the fields are not valid"); + tot_res = Consts.TEST_FAILED; + } + + } + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("\nFinal resumption of the debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002/TestDescription.java new file mode 100644 index 00000000000..a50dcc4adc9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/ReferenceType/getValues/getvalues002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ReferenceType.getValues() + * properly throws IllegalArgumentException - if any field is + * not valid for this object's class. + * Debuggee part of the test consists of the following classes: + * "getvalues002t", "getvalues002tDummySuperCls", and "getvalues002tDummyCls" + * which extends getvalues002tDummySuperCls. + * The exception is provoked to be thrown by getting a Map of values + * which correspond to a list containing some wrong fields such as: + * - fields obtained from the getvalues002tDummyCls but applied to + * reference type of the getvalues002t; + * - some non-static fields from the getvalues002tDummyCls applied to + * its reference type. + * COMMENTS + * 4772094 JDI: ReferenceType.getValue() allows to get value of a private field + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.getValues.getvalues002 + * nsk.jdi.ReferenceType.getValues.getvalues002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.getValues.getvalues002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002t.java new file mode 100644 index 00000000000..f174f6cf241 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002t.java @@ -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.ReferenceType.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is debuggee class. + */ +public class getvalues002t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // force debuggee VM to load dummy classes + getvalues002tDummySuperCls dummySuperCls = + new getvalues002tDummySuperCls(); + getvalues002tDummyCls dummyCls = + new getvalues002tDummyCls(); + + pipe.println(getvalues002.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(getvalues002.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command: " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // getvalues002.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(getvalues002.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + return Consts.TEST_FAILED; + } + return Consts.TEST_PASSED; + } +} + +// dummy super class used for provoking IllegalArgumentException in debugger +class getvalues002tDummySuperCls { + private static boolean boolPrFld = false; + private static byte bytePrFld = 127; + private static char charPrFld = 'b'; + private static double doublePrFld = 6.2D; + private static float floatPrFld = 5.1F; + private static int intPrFld = 2147483647; + private static long longPrFld = 9223372036854775807L; + private static short shortPrFld = -32768; +} + +// dummy class used for provoking IllegalArgumentException in debugger +class getvalues002tDummyCls extends getvalues002tDummySuperCls { + static boolean boolFld = false; + static byte byteFld = 127; + static char charFld = 'a'; + static double doubleFld = 6.2D; + static float floatFld = 5.1F; + static int intFld = 2147483647; + static long longFld = 9223372036854775807L; + static short shortFld = -32768; + + static boolean boolMiscFld = true; + static byte byteMiscFld = Byte.MIN_VALUE; + protected char charMiscFld = 'c'; + static double doubleMiscFld = Double.MAX_VALUE; + static float floatMiscFld = Float.MAX_VALUE; + static int intMiscFld = Integer.MIN_VALUE; + long longMiscFld = Long.MIN_VALUE; + static short shortMiscFld = Short.MAX_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003.java new file mode 100644 index 00000000000..c93be1803a5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003.java @@ -0,0 +1,318 @@ +/* + * 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.ReferenceType.getValues; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.getValues() + * properly throws IllegalArgumentException - if any field is + * not valid for this object's class.

    + * + * Debuggee part of the test consists of the following classes: + * getvalues003t inside a main package, and getvalues003ta + * outside the package.
    + * The exception is provoked to be thrown by getting a Map of values + * which correspond to a list containing wrong fields such as:
    + *

  • private fields obtained from the getvalues003ta but applied to + * reference type of the getvalues003t + *
  • default-access fields from the getvalues003ta but applied to + * reference type of the getvalues003t + *
  • protected fields from the getvalues003ta but applied to reference + * type of the getvalues003t. + */ +public class getvalues003 { + static final String DEBUGGEE_CLASSES[] = { + "nsk.jdi.ReferenceType.getValues.getvalues003t", + "nsk.jdi.ReferenceType.dummyPackage.getvalues003a" + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 56; + + static final int LST_NUM = 3; // number of lists + static final int FLD_NUM = 8; // number of fields in particular list + // tested fields used to provoke the exception and + // type reference numbers for applying/obtaining a Field + static final String DEBUGGEE_FLDS[][][] = { + {{"boolFld", "0", "1", "default-access"}, + {"byteFld", "0", "1", "default-access"}, + {"charFld", "0", "1", "default-access"}, + {"doubleFld", "0", "1", "default-access"}, + {"floatFld", "0", "1", "default-access"}, + {"intFld", "0", "1", "default-access"}, + {"longFld", "0", "1", "default-access"}, + {"shortFld", "0", "1", "default-access"}}, + + {{"boolPrFld", "0", "1", "private"}, + {"bytePrFld", "0", "1", "private"}, + {"charPrFld", "0", "1", "private"}, + {"doublePrFld", "0", "1", "private"}, + {"floatPrFld", "0", "1", "private"}, + {"intPrFld", "0", "1", "private"}, + {"longPrFld", "0", "1", "private"}, + {"shortPrFld", "0", "1", "private"}}, + + {{"boolProtFld", "0", "1", "protected"}, + {"byteProtFld", "0", "1", "protected"}, + {"charProtFld", "0", "1", "protected"}, + {"doubleProtFld", "0", "1", "protected"}, + {"floatProtFld", "0", "1", "protected"}, + {"intProtFld", "0", "1", "protected"}, + {"longProtFld", "0", "1", "protected"}, + {"shortProtFld", "0", "1", "protected"}} + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getvalues003().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASSES[0]); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "getvalues003t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + ReferenceType[] rType = new ReferenceType[2]; + // debuggee main & dummy classes + rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]); + rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType[0], DEBUGGEE_STOPATLINE); + + for (int l=0; l flds = new ArrayList(); + int appIx = 0; + int obtIx = 0; + + + for (int i=0; i valMap = rType[appIx].getValues(flds); + + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to get a Map containing Value of each field in the list" + + "\n\t\tusing reference type \"" + + rType[appIx] + "\",\n\t\tand the fields are not valid"); + tot_res = Consts.TEST_FAILED; + } catch (IllegalArgumentException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch (Exception ue) { + ue.printStackTrace(); + log.complain("TEST FAILED: caught unexpected " + + ue + "\n\tinstead of expected IllegalArgumentException" + + "\n\twhen attempted to get a Map containing Value of each field in the list" + + "\"\n\t\tusing reference type \"" + + rType[appIx] + "\",\n\t\tand the fields are not valid"); + tot_res = Consts.TEST_FAILED; + } + + } + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + BPreq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + +// Class containing a critical section which may lead to time out of the test + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("\nFinal resumption of the debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003/TestDescription.java new file mode 100644 index 00000000000..d21d135747a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003/TestDescription.java @@ -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/ReferenceType/getValues/getvalues003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method + * com.sun.jdi.ReferenceType.getValues() + * properly throws IllegalArgumentException - if any field is + * not valid for this object's class. + * Debuggee part of the test consists of the following classes: + * "getvalues003t" inside a main package, and "getvalues003a" outside + * the package. + * The exception is provoked to be thrown by getting a Map of values + * which correspond to a list containing wrong fields such as: + * - private fields obtained from the getvalues003ta + * but applied to reference type of the getvalues003t; + * - default-access fields from the getvalues003ta + * but applied to reference type of the getvalues003t; + * - protected fields from the getvalues003ta + * but applied to reference type of the getvalues003t. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.getValues.getvalues003 + * nsk.jdi.ReferenceType.getValues.getvalues003t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.getValues.getvalues003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003t.java new file mode 100644 index 00000000000..2def2d53993 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003t.java @@ -0,0 +1,66 @@ +/* + * 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.ReferenceType.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is debuggee class. + */ +public class getvalues003t { + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // force debuggee VM to load dummy class + nsk.jdi.ReferenceType.dummyPackage.getvalues003a dummyCls = + new nsk.jdi.ReferenceType.dummyPackage.getvalues003a(); + + pipe.println(getvalues003.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(getvalues003.COMMAND_QUIT)) { + System.err.println("Debuggee: exiting due to the command: " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // getvalues003.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + if (!cmd.equals(getvalues003.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + return Consts.TEST_FAILED; + } + return Consts.TEST_PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001.java new file mode 100644 index 00000000000..558d081fafc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.hashCode; + +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 hashCode() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class hashcode001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.hashCode.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "hashcode001", + debugeeName = thisClassName + "a"; + + private final static String primitive_type_sign = "primitive_type"; + private final static String reference_type_sign = "reference_type"; + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + {"boolean", primitive_type_sign}, + {"byte" , primitive_type_sign}, + {"char" , primitive_type_sign}, + {"double" , primitive_type_sign}, + {"float" , primitive_type_sign}, + {"int" , primitive_type_sign}, + {"long" , primitive_type_sign}, + + {"java.lang.Boolean" , reference_type_sign}, + {"java.lang.Byte" , reference_type_sign}, + {"java.lang.Character", reference_type_sign}, + {"java.lang.Double" , reference_type_sign}, + {"java.lang.Float" , reference_type_sign}, + {"java.lang.Integer" , reference_type_sign}, + {"java.lang.Long" , reference_type_sign}, + {"java.lang.String" , reference_type_sign}, + {"java.lang.Object" , reference_type_sign}, + + {package_prefix + "ClassForCheck", reference_type_sign}, + {package_prefix + "InterfaceForCheck", reference_type_sign}, + + {debugeeName+"$s_class", reference_type_sign}, + {debugeeName+"$s_interf", reference_type_sign} + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new hashcode001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/hashCode/hashcode001 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/hashCode/hashcode001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/hashCode/hashcode001 test LOG:"); + print_log_anyway("==> test checks the hashCode() method of ReferenceType interface"); + print_log_anyway(" of the com.sun.jdi package for ArrayType, ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> hashcode001: hashcode001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway("##> hashcode001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway("##> hashcode001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> hashcode001: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> hashcode001: check ReferenceType.hashCode() method for debugee's classes..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int hashCode_method_exceptions = 0; + int hashCode_method_errors = 0; + for (int i=0; i hashcode001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + int hash_code_1 = 0; + try { + hash_code_1 = refType_1.hashCode(); + } + catch (Throwable thrown) { + print_log_anyway + ("##> hashcode001: FAILED: refType_1.hashCode() threw unexpected exception - " + + thrown); + print_log_anyway + ("##> refType_1 = " + refType_1); + hashCode_method_exceptions++; + continue; + } + ReferenceType refType_2 = debugee.classByName(className); + int hash_code_2 = 0; + try { + hash_code_2 = refType_2.hashCode(); + } + catch (Throwable thrown) { + print_log_anyway + ("##> hashcode001: FAILED: refType_2.hashCode() threw unexpected exception - " + + thrown); + print_log_anyway + ("##> refType_2 = " + refType_2); + hashCode_method_exceptions++; + continue; + } + if ( hash_code_1 != hash_code_2 ) { + print_log_anyway + ("##> hashcode001: FAILED: hashCode() returned unequals values for equals ReferenceType instances:"); + print_log_anyway + ("##> refType_1 = " + refType_1 + "#" + hash_code_1); + print_log_anyway + ("##> refType_2 = " + refType_2 + "#" + hash_code_2); + hashCode_method_errors++; + } + else { + print_log_on_verbose + ("--> hashcode001: PASSED: hashCode() returned equals values for equals ReferenceType instances:"); + print_log_on_verbose + ("--> refType_1 = " + refType_1 + "#" + hash_code_1); + print_log_on_verbose + ("--> refType_2 = " + refType_2 + "#" + hash_code_2); + } + } + } + print_log_anyway("--> hashcode001: check completed!"); + print_log_anyway("--> hashcode001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + print_log_anyway("##> hashcode001: \"class not found ERRORS\" number = " + + class_not_found_errors); + } + if ( hashCode_method_exceptions > 0 ) { + print_log_anyway("##> hashcode001: number of unexpected hashCode() methods exceptions = " + + hashCode_method_exceptions); + } + print_log_anyway("##> hashcode001: hashCode() method errors number = " + + hashCode_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + hashCode_method_errors + hashCode_method_exceptions > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> hashcode001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway("##> hashcode001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> hashcode001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..319e9c1d340 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/hashCode/hashcode001 test + * checks the hashCode() method of ReferenceType interface + * of the com.sun.jdi package for ArrayType, ClassType, InterfaceType: + * For each checked debugee's class the test gets two ReferenceType + * instances for this class and gets the hash code values for these + * ReferenceType instances by hashCode() method. + * The test expects that returned hash code values should be equal. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.hashCode.hashcode001 + * nsk.jdi.ReferenceType.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001a.java new file mode 100644 index 00000000000..4b402d515bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode001a.java @@ -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.ReferenceType.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the hashcode001 JDI test. + */ + +public class hashcode001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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}; + + static class s_class {} + s_class s_class_0 = new s_class(), s_class_1[]={s_class_0}, + s_class_2[][]={s_class_1}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static interface s_interf {} + 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}; + + ClassForCheck class_for_check0 = new ClassForCheck(), + class_for_check1[]={class_for_check0}, + class_for_check2[][]={class_for_check1}; + InterfaceForCheck_impl interf_for_check_impl0 = new InterfaceForCheck_impl(); + InterfaceForCheck interf_for_check0,interf_for_check1[]={interf_for_check0}, interf_for_check2[][]={interf_for_check1}; + + 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 hashcode001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + hashcode001a hashcode001a_obj = new hashcode001a(); + + print_log_on_verbose("**> hashcode001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> hashcode001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> hashcode001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> hashcode001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> hashcode001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class ClassForCheck { + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + static long[] s_prim_array_field; + static Object[] s_ref_array_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + long[] i_prim_array_field; + Object[] i_ref_array_field; +} + +interface InterfaceForCheck { + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); +} + +class InterfaceForCheck_impl implements InterfaceForCheck {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002.java new file mode 100644 index 00000000000..d1c4b24a5ca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.hashCode; + +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 hashCode() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class hashcode002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.hashCode.", + thisClassName = package_prefix + "hashcode002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "hashcode002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new hashcode002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/hashCode/hashcode002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/hashCode/hashcode002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/hashCode/hashcode002 test LOG:"); + print_log_anyway("--> test checks hashCode() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> hashcode002: hashcode002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> hashcode002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> hashcode002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> hashcode002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> hashcode002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> hashcode002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> hashcode002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean hashCode_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> hashcode002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> hashcode002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> hashcode002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> hashcode002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> hashcode002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> hashcode002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> hashcode002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.hashCode() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> hashcode002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> hashcode002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> hashcode002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> hashcode002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> hashcode002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> hashcode002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.hashCode() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> hashcode002: check ReferenceType.hashCode() method for unloaded class..."); + int hash_code = 0; + try { + hash_code = refType.hashCode(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> hashcode002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> hashcode002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + hashCode_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || hashCode_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> hashcode002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> hashcode002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> hashcode002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of hashcode002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/TestDescription.java new file mode 100644 index 00000000000..fc31d0724c0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/TestDescription.java @@ -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/ReferenceType/hashCode/hashcode002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/hashCode/hashcode002 test + * checks the hashCode() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * hashCode() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - hashcode002b class was moved in 'loadclass' subdirectory; + * - package name was added in hashcode002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for hashcode002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.hashCode.hashcode002 + * nsk.jdi.ReferenceType.hashCode.hashcode002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.hashCode.hashcode002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/loadclass/hashcode002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/loadclass/hashcode002b.java new file mode 100644 index 00000000000..dc350ca791b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002/loadclass/hashcode002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the hashCode() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.hashCode; + +class hashcode002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002a.java new file mode 100644 index 00000000000..f72a629b8a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/hashCode/hashcode002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.hashCode; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the hashcode002 JDI test. + */ + +public class hashcode002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.hashCode."; + private final static String checked_class_name = package_prefix + "hashcode002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> hashcode002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> hashcode002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> hashcode002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> hashcode002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> hashcode002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> hashcode002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> hashcode002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> hashcode002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> hashcode002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> hashcode002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> hashcode002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> hashcode002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> hashcode002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> hashcode002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> hashcode002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> hashcode002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> hashcode002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> hashcode002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> hashcode002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of hashcode002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances001/instances001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances001/instances001.java new file mode 100644 index 00000000000..d7d166e2898 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances001/instances001.java @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/instances/instances001. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test checks behaviour of ReferenceType.instances, VirtualMachine.instanceCounts + * in cases when object is reacheable via following types of references: + * - strong + * - soft + * - weak + * - phantom + * - jni local + * - jni global + * - jni weak + * Test is executed for following subclasses of ReferenceType: + * - ArrayType + * - InterfaceType(for InterfaceType methof instances() should always return empty list) + * The test scenario is following: + * - Debugger VM + * - inititate creation instances of sublcass of tested class to ensure that instances of subclasses are not returned by ReferenceType.instances() + * - Debugger VM + * for refererence_type in + * do + * - initiate creation test class instances of type 'refererence_type' + * - check the number of instances is correct + * - initiate deletion of some referreres(making them unreachable) + * - check the number of instances is correct + * done + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.instances.instances001.instances001 + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestClass2 + * nsk.share.jdi.TestInterfaceImplementer1 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ReferenceType.instances.instances001.instances001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ReferenceType.instances.instances001; + +import java.io.PrintStream; +import java.util.*; +import com.sun.jdi.*; + +import nsk.share.Consts; +import nsk.share.ObjectInstancesManager; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class instances001 extends HeapwalkingDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new instances001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return nsk.share.jdi.HeapwalkingDebuggee.class.getName(); + } + + // test given class with all references types + protected void testClass(String className) { + // force GC in debugee VM to avoid collection of weak references during test execution + forceGC(); + + for (String referrerType : ObjectInstancesManager.allReferenceTypes) { + testReferrerType(referrerType, className); + if (ObjectInstancesManager.isWeak(referrerType)) { + // if GC occurs during test the results should be ignored + resetStatusIfGC(); + } + } + } + + protected void testReferrerType(String referrerType, String className) { + int createInstanceCount = 50; + int baseCount = 0; + + ReferenceType referenceType = debuggee.classByName(className); + + // object number created in target VM before debugger command should be filtered + if (referenceType != null) { + List objectReferences = referenceType.instances(0); + + // disable GC because of uncontrolled object deletion may break test checks + for (ObjectReference objectReference : objectReferences) + objectReference.disableCollection(); + + baseCount = objectReferences.size(); + } + + boolean isIncludedIntoInstancesCount = HeapwalkingDebuggee.isIncludedIntoInstancesCount(referrerType); + + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + className + ":" + createInstanceCount + ":" + 1 + ":" + referrerType); + + int expectedCount; + + if (isIncludedIntoInstancesCount) + expectedCount = baseCount + createInstanceCount; + else + expectedCount = baseCount; + + checkDebugeeAnswer_instanceCounts(className, expectedCount); + checkDebugeeAnswer_instances(className, expectedCount); + + //delete half of instances + + int deleteCount = createInstanceCount / 2; + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + className + ":" + deleteCount); + + createInstanceCount -= deleteCount; + + if (isIncludedIntoInstancesCount) + expectedCount = baseCount + createInstanceCount; + else + expectedCount = baseCount; + + checkDebugeeAnswer_instanceCounts(className, expectedCount); + checkDebugeeAnswer_instances(className, expectedCount); + + //delete all instances + + deleteCount = createInstanceCount; + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + className + ":" + deleteCount); + + if (isIncludedIntoInstancesCount) + expectedCount = baseCount; + else + expectedCount = baseCount; + + checkDebugeeAnswer_instanceCounts(className, expectedCount); + checkDebugeeAnswer_instances(className, expectedCount); + } + + // also check number of instanes for InterfaceType + protected void checkDebugeeAnswer_instances(String className, int expectedInstances) { + super.checkDebugeeAnswer_instances(className, expectedInstances); + + ReferenceType referenceType = debuggee.classByName(className); + + // check number of instances for InterfaceType(should be 0) + if (referenceType instanceof ClassType) { + ClassType classType = (ClassType) referenceType; + + for (InterfaceType interfaceType : classType.interfaces()) { + checkDebugeeAnswer_InterfaceType_instances(interfaceType, 0); + } + } + } + + // ArrayType, ClassType and InterfaceType are tested here + protected void doTest() { + String testClassName = "nsk.share.jdi.TestClass1"; + String testClassSubclassName = "nsk.share.jdi.TestClass2"; + + int subclassInstanceCount = 10; + + String testClasses[] = { testClassName, "nsk.share.jdi.TestInterfaceImplementer1", "boolean[]", "float[]" }; + + // create instances of 'nsk.share.jdi.TestClass1' subclass to ensure that instances of subclasses are not returned by ReferenceType.instances() + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + testClassSubclassName + ":" + subclassInstanceCount); + + checkDebugeeAnswer_instanceCounts(testClassSubclassName, subclassInstanceCount); + checkDebugeeAnswer_instances(testClassSubclassName, subclassInstanceCount); + + for (String className : testClasses) { + testClass(className); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java new file mode 100644 index 00000000000..adf38b27e38 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/instances/instances002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test scenario is following: + * - Debugger VM + * - initiate creation a number of instances in debuggee VM using ClassType.newInstance + * - check the number of instances is correct + * - initiate creation a number of instances in debuggee VM using ArrayType.newInstance + * - check the number of instances is correct + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.instances.instances002.instances002 + * nsk.jdi.ReferenceType.instances.instances002.instances002a + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestInterfaceImplementer1 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ReferenceType.instances.instances002.instances002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ReferenceType.instances.instances002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import nsk.share.Consts; +import nsk.share.ObjectInstancesManager; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class instances002 extends HeapwalkingDebugger { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new instances002().runIt(argv, out); + } + + protected boolean canRunTest() { + return super.canRunTest() || (!vm.canBeModified()); + } + + protected String debuggeeClassName() { + return nsk.jdi.ReferenceType.instances.instances002.instances002a.class.getName(); + } + + // create instance of ReferenceType + public ReferenceType prepareReferenceType(String className, int instanceCount) { + String referrerType = ObjectInstancesManager.STRONG_REFERENCE; + + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + className + ":" + instanceCount + ":" + "1" + ":" + referrerType); + + if (!isDebuggeeReady()) + return null; + + return debuggee.classByName(className); + } + + // test method ArrayType.newInstance + public void testArrayType(String className) { + // create some instances in target VM, just to get ReferenceType object + int baseInstances = 10; + + ReferenceType referenceType = prepareReferenceType(className, baseInstances); + + if (referenceType == null) + return; + + if (!(referenceType instanceof ArrayType)) { + setSuccess(false); + log.complain("Unexpected reference type: " + referenceType.getClass().getName() + ", expected is ArrayType"); + return; + } + + baseInstances = referenceType.instances(0).size(); + + int createInstanceCount = 100; + int arraySize = 1; + + ArrayType arrayType = (ArrayType) referenceType; + List objectReferences = new ArrayList(); + + for (int i = 0; i < createInstanceCount; i++) { + // instances created in this way aren't reachable for the purposes of garbage collection, + // to make it reachable call disableCollection() for this objects + ArrayReference arrayReference = arrayType.newInstance(arraySize); + arrayReference.disableCollection(); + + objectReferences.add(arrayReference); + } + + checkDebugeeAnswer_instances(className, createInstanceCount + baseInstances); + + for (ArrayReference arrayReference : objectReferences) + arrayReference.enableCollection(); + } + + // test method ClassType.newInstance + public void testClassType(String className) { + // create some instances in target VM, just to get ReferenceType object + int baseInstances = 10; + + ReferenceType referenceType = prepareReferenceType(className, baseInstances); + + if (referenceType == null) + return; + + if (!(referenceType instanceof ClassType)) { + setSuccess(false); + log.display("Unexpected reference type: " + referenceType.getClass().getName() + ", expected is ClassType"); + return; + } + + baseInstances = referenceType.instances(0).size(); + + ClassType classType = (ClassType) referenceType; + + pipe.println(AbstractDebuggeeTest.COMMAND_FORCE_BREAKPOINT); + + BreakpointEvent breakpointEvent = waitForBreakpoint(defaultBreakpointRequest); + + List methods = referenceType.allMethods(); + List objectReferences = new ArrayList(); + + int createInstanceCount = 100; + + try { + for (Method method : methods) { + if (method.isConstructor()) { + for (int i = 0; i < createInstanceCount; i++) { + objectReferences.add(classType.newInstance(breakpointEvent.thread(), method, new ArrayList(), 0)); + } + + checkDebugeeAnswer_instances(className, baseInstances); + + break; + } + } + } catch (Exception e) { + setSuccess(false); + log.display("Unexpected exception: "); + e.printStackTrace(log.getOutStream()); + } + + debuggee.resume(); + + // wait response for command 'COMMAND_FORCE_BREAKPOINT' + if (!isDebuggeeReady()) + return; + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + className + ":" + baseInstances); + + if (!isDebuggeeReady()) + return; + + checkDebugeeAnswer_instances(className, 0); + } + + protected void doTest() { + initDefaultBreakpoint(); + + String[] testClasses = { "nsk.share.jdi.TestClass1", "nsk.share.jdi.TestInterfaceImplementer1" }; + + for (String className : testClasses) + testClassType(className); + + for (String className : ObjectInstancesManager.primitiveArrayClassNames) + testArrayType(className); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002a.java new file mode 100644 index 00000000000..6a4643dce9a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002a.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2007, 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.ReferenceType.instances.instances002; + +import nsk.share.jdi.*; + +public class instances002a extends HeapwalkingDebuggee { + public final static String MAIN_THREAD_NAME = "instances002a_MainThread"; + + protected String[] doInit(String args[]) { + Thread.currentThread().setName(MAIN_THREAD_NAME); + + return args; + } + + public static void main(String args[]) { + new instances002a().doTest(args); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java new file mode 100644 index 00000000000..fdb07c6c85c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/instances/instances003. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test scenario is following: + * - Debugger VM + * for refererence_type in + * - initiate creation test class instances of type 'refererence_type' in debuggee VM + * - prevent some instances from being garbage collected using ObjectReference.disableCollection + * - initiate GarbageCollection in Debuggee VM + * - check the number of instances is left is correct + * - enables Garbage Collection for instances for which it were previously disabled using ObjectReference.enableCollection + * - initiate GarbageCollection in Debuggee VM + * - check the number of instances is 0 + * done + * Test is executed for following sublcasses of ObjectReference: StringReference, ThreadReference, ClassLoaderReference + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.instances.instances003.instances003 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ReferenceType.instances.instances003.instances003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassNames nsk.jdi.ReferenceType.instances.instances003.instances003$TestClassLoader:java.lang.String:java.lang.Thread + */ + +package nsk.jdi.ReferenceType.instances.instances003; + +import java.io.PrintStream; +import java.util.*; + +import com.sun.jdi.ObjectReference; +import com.sun.jdi.ReferenceType; + +import nsk.share.Consts; +import nsk.share.ObjectInstancesManager; +import nsk.share.TestBug; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class instances003 extends HeapwalkingDebugger { + // use subclass of java.lang.ClassLoader to be sure that there are no its instances in debuggee VM + public static class TestClassLoader extends ClassLoader { + + } + + private String testClasses[]; + + protected String[] doInit(String[] args, PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testClassNames") && (i < args.length - 1)) { + testClasses = args[i + 1].split(":"); + + i++; + } else + standardArgs.add(args[i]); + } + + if ((testClasses == null) || (testClasses.length == 0)) + throw new TestBug("Test class names was not specified, use test parameter '-testClassNames'"); + + return standardArgs.toArray(new String[] {}); + } + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new instances003().runIt(argv, out); + } + + protected String debuggeeClassName() { + return nsk.share.jdi.HeapwalkingDebuggee.class.getName(); + } + + protected void testClass(String className, String referrerType) { + final int createInstanceCount = 50; + final int referrerCount = 1; + + List objectsToFilter = HeapwalkingDebugger.getObjectReferences(className, vm); + + // create 'createInstanceCount' instances of test class + + // create temporary strong references to prevent the weakly referred instances being GCed + // during the time between creating them and disabling collection on them + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + className + ":" + createInstanceCount + + ":" + referrerCount + ":" + referrerType + + (referrerType.equals(ObjectInstancesManager.WEAK_REFERENCE) ? "|" + ObjectInstancesManager.STRONG_REFERENCE : "")); + + // the instance counts should not be affected by creating multiple references + checkDebugeeAnswer_instanceCounts(className, createInstanceCount, objectsToFilter); + + ReferenceType referenceType = debuggee.classByName(className); + List instances = HeapwalkingDebugger.filterObjectReferrence(objectsToFilter, referenceType.instances(0)); + + for (ObjectReference or : instances) { + or.disableCollection(); + } + + // remove the temporary strong references so the weak references can be properly tested + if (referrerType.equals(ObjectInstancesManager.WEAK_REFERENCE)) { + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_REFERRERS + ":" + className + ":" + referrerCount + ":" + ObjectInstancesManager.STRONG_REFERENCE); + if (!isDebuggeeReady()) { + return; + } + } + + // prevent half of instances from GC, delete references and force GC + + int preventGCCount = createInstanceCount / 2; + + for (int i = 0; i < preventGCCount; i++) { + instances.get(i).enableCollection(); + } + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + className + ":" + createInstanceCount); + + if (!isDebuggeeReady()) + return; + + pipe.println(AbstractDebuggeeTest.COMMAND_FORCE_GC); + + checkDebugeeAnswer_instanceCounts(className, createInstanceCount - preventGCCount, objectsToFilter); + + // enable garbage collection for all instances and force GC + + for (ObjectReference reference : referenceType.instances(0)) { + reference.enableCollection(); + } + + pipe.println(AbstractDebuggeeTest.COMMAND_FORCE_GC); + + checkDebugeeAnswer_instanceCounts(className, 0, objectsToFilter); + } + + protected void doTest() { + for (String referenceType : HeapwalkingDebuggee.includedIntoInstancesCountTypes) { + for (String className : testClasses) + testClass(className, referenceType); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances004/TestDescription.java new file mode 100644 index 00000000000..a642a73d031 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances004/TestDescription.java @@ -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/ReferenceType/instances/instances004. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test scenario is following: + * - Debugger VM + * for refererence_type in + * - initiate creation test class instances of type 'refererence_type' in debuggee VM + * - prevent some instances from being garbage collected using ObjectReference.disableCollection + * - initiate GarbageCollection in Debuggee VM + * - check the number of instances is left is correct + * - enables Garbage Collection for instances for which it were previously disabled using ObjectReference.enableCollection + * - initiate GarbageCollection in Debuggee VM + * - check the number of instances is 0 + * done + * Test is executed for following sublcass of ObjectReference: ArrayReference + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.instances.instances003.instances003 + * nsk.share.jdi.TestClass1 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ReferenceType.instances.instances003.instances003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassNames nsk.share.jdi.TestClass1:boolean[]:float[] + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances005/instances005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances005/instances005.java new file mode 100644 index 00000000000..254d7da40c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances005/instances005.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/instances/instances005. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test checks behavior of ReferenceType.instances() in case when there are many + * instances (several thousands) of corresponding ReferenceType in debuggee VM. + * Debugger forces debuggee VM create 100000 (this value can be changed through parameter -instanceCount) instances + * of 'nsk.share.jdi.TestClass1', obtains ReferenceType for 'nsk.share.jdi.TestClass1' and checks that ReferenceType.instances() + * returns collection with correct size and returned instances doesn't throw any exception when call following methods: + * referenceType() + * isCollected() + * uniqueID() + * hashCode() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.instances.instances005.instances005 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ReferenceType.instances.instances005.instances005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ReferenceType.instances.instances005; + +import java.io.PrintStream; +import java.util.*; +import com.sun.jdi.*; + +import nsk.share.Consts; +import nsk.share.ObjectInstancesManager; +import nsk.share.jdi.HeapwalkingDebuggee; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.jdi.TestClass1; + +public class instances005 extends HeapwalkingDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + private int instanceCount = 100000; + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-instanceCount") && (i < args.length - 1)) { + instanceCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + public static int run(String argv[], PrintStream out) { + return new instances005().runIt(argv, out); + } + + protected String debuggeeClassName() { + return HeapwalkingDebuggee.class.getName(); + } + + protected void doTest() { + String className = TestClass1.class.getName(); + + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + className + ":" + instanceCount + ":" + 1 + + ":" + ObjectInstancesManager.STRONG_REFERENCE); + + checkDebugeeAnswer_instanceCounts(className, instanceCount); + checkDebugeeAnswer_instances(className, instanceCount); + + ReferenceType referenceType = debuggee.classByName(className); + List instances = referenceType.instances(0); + + vm.suspend(); + + for (ObjectReference instance : instances) { + try { + if (!referenceType.equals(instance.referenceType())) { + setSuccess(false); + log.complain("Instance's ReferenceType " + instance.referenceType() + " doesn't equal " + + referenceType); + } + if (instance.isCollected()) { + setSuccess(false); + log.complain("isCollected() returns 'true' for " + instance); + } + instance.uniqueID(); + instance.hashCode(); + } catch (Throwable t) { + setSuccess(false); + t.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + t); + } + } + + vm.resume(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001.java new file mode 100644 index 00000000000..1be2afea3da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001.java @@ -0,0 +1,199 @@ +/* + * 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.ReferenceType.isAbstract; + +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 isAbstract() + * of the JDI interface ReferenceType of com.sun.jdi package + * for ClassType, InterfaceType + */ + +public class isAbstract001 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.ReferenceType.isAbstract.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "isAbstract001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + + {thisClassName, "no abstract", "class"}, + {thisClassName+"a", "no abstract", "class"}, + + {debugeeName+"$s_cls", "no abstract", "class"}, + {debugeeName+"$abs_s_cls", "abstract", "class"}, + {debugeeName+"$s_interf", "abstract", "interface"}, + + {package_prefix + "simple_cls", "no abstract", "class"}, + {package_prefix + "abstr_cls", "abstract", "class"}, + {package_prefix + "interf", "abstract", "interface"}, + {package_prefix + "abstr_interf", "abstract", "interface"} + }; + + /** + * Re-call to run(args,out), 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 isAbstract001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/isAbstract/isAbstract001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/isAbstract/isAbstract001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/isAbstract/isAbstract001 test LOG:"); + out_stream.println("==> test checks isAbstract() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for ClassType, InterfaceType\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> isAbstract001: isAbstract001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> isAbstract001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> isAbstract001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isAbstract001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> isAbstract001: checking debugee's classes by ReferenceType.isAbstract() method..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int isAbstract_method_errors = 0; + for (int i=0; i isAbstract001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String s_type = classes_for_check[i][2]; + String s_abstract_sign = classes_for_check[i][1]; + boolean isAbstract = s_abstract_sign.equals("abstract"); + if (refType.isAbstract() != isAbstract) { + out_stream.println("##> isAbstract001: UNEXPECTED isAbstract() method result (" + + !isAbstract + ") for " + s_type + ": " + + className + "(" + s_abstract_sign + ")"); + isAbstract_method_errors++; + } + else { + print_log_on_verbose("--> isAbstract001: expected isAbstract() method result (" + + isAbstract + ") for " + s_type + ": " + + className + "(" + s_abstract_sign + ")"); + } + } + out_stream.println("--> isAbstract001: checking debugee's classes completed!"); + out_stream.println("--> isAbstract001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + out_stream.println("##> isAbstract001: \"class not found ERRORS\" counter = " + + class_not_found_errors); + } + out_stream.println("##> isAbstract001: isAbstract() method ERRORS counter = " + + isAbstract_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + isAbstract_method_errors > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isAbstract001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> isAbstract001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> isAbstract001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001/TestDescription.java new file mode 100644 index 00000000000..e13b3eb03ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001/TestDescription.java @@ -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/ReferenceType/isAbstract/isAbstract001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isAbstract/isAbstract001 test + * checks the isAbstract() method of ReferenceType interface + * of the com.sun.jdi package for ClassType, InterfaceType. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isAbstract.isAbstract001 + * nsk.jdi.ReferenceType.isAbstract.isAbstract001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isAbstract.isAbstract001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001a.java new file mode 100644 index 00000000000..464162b9edb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isAbstract001a.java @@ -0,0 +1,110 @@ +/* + * 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.ReferenceType.isAbstract; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isAbstract001 JDI test. + */ + +public class isAbstract001a { + + static boolean verbose_mode = false; + + // Abstract classes must be extended by a class and that class must be + // initialized, so that abstract classes could be returnedin debugger + + static class s_cls {} + abstract static class abs_s_cls {} + static class abs_s_cls_ext extends abs_s_cls {} + abs_s_cls_ext abs_s_cls_ext_0 = new abs_s_cls_ext(); + static interface s_interf {} + static class s_interf_impl implements s_interf {} + s_interf_impl s_interf_impl_0 = new s_interf_impl(); + + s_cls s_cls_0=new s_cls(); + abs_s_cls abs_s_cls_0, abs_s_cls_1[]={abs_s_cls_0}; + s_interf s_interf_0, s_interf_1[]={s_interf_0}; + + isAbstract001 a001_0=new isAbstract001(); + + simple_cls simple_cls_0=new simple_cls(); + abstr_cls_ext abstr_cls_ext_0= new abstr_cls_ext(); + abstr_cls abstr_cls_0, abstr_cls_1[]={abstr_cls_0}; + interf_impl interf_impl_0= new interf_impl(); + interf interf_0, interf_1[]={interf_0}; + abstr_interf abstr_interf_0, abstr_interf_1[]={abstr_interf_0}; + abstr_interf_impl abstr_interf_impl_0= new abstr_interf_impl(); + + 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 isAbstract001a: debugee started!"); + isAbstract001a isAbstract001a_obj = new isAbstract001a(); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + print_log_on_verbose("**> isAbstract001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isAbstract001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isAbstract001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isAbstract001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isAbstract001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** simple class */ +class simple_cls {} + +/** abstract class */ +abstract class abstr_cls {} +class abstr_cls_ext extends abstr_cls {} + +/** interface */ +interface interf {} +class interf_impl implements interf {} + +/** abstract interface */ +abstract interface abstr_interf {} +class abstr_interf_impl implements abstr_interf {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002.java new file mode 100644 index 00000000000..5bec6ff24fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002.java @@ -0,0 +1,250 @@ +/* + * 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.ReferenceType.isAbstract; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +/** + * This test checks the method isAbstract() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class isabstract002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class isAbstracts of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.isAbstract.", + thisClassName = package_prefix + "isabstract002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "isabstract002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new isabstract002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isAbstract/isabstract002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isAbstract/isabstract002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/isAbstract/isabstract002 test LOG:"); + print_log_anyway("--> test checks isAbstract() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> isabstract002: isabstract002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isabstract002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> isabstract002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isabstract002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isabstract002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> isabstract002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isabstract002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean isAbstract_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> isabstract002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> isabstract002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> isabstract002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> isabstract002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> isabstract002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isabstract002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> isabstract002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.isAbstract() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> isabstract002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isabstract002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> isabstract002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> isabstract002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> isabstract002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> isabstract002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.isAbstract() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> isabstract002: check ReferenceType.isAbstract() method for unloaded class..."); + boolean ref_type_is_abstract = false; + try { + ref_type_is_abstract = refType.isAbstract(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> isabstract002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> isabstract002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + isAbstract_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || isAbstract_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isabstract002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> isabstract002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> isabstract002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of isabstract002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/TestDescription.java new file mode 100644 index 00000000000..15a77258e00 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/TestDescription.java @@ -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/ReferenceType/isAbstract/isabstract002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isAbstract/isabstract002 test + * checks the isAbstract() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * isAbstract() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - isabstract002b class was moved in 'loadclass' subdirectory; + * - package name was added in isabstract002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for isabstract002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isAbstract.isabstract002 + * nsk.jdi.ReferenceType.isAbstract.isabstract002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isAbstract.isabstract002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/loadclass/isabstract002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/loadclass/isabstract002b.java new file mode 100644 index 00000000000..b3fa480d5ab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002/loadclass/isabstract002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the isAbstract() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.isAbstract; + +abstract class isabstract002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002a.java new file mode 100644 index 00000000000..af85baf3d4d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.isAbstract; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isabstract002 JDI test. + */ + +public class isabstract002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.isAbstract."; + static String checked_class_name = package_prefix + "isabstract002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> isabstract002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> isabstract002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> isabstract002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> isabstract002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> isabstract002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> isabstract002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isabstract002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isabstract002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> isabstract002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> isabstract002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> isabstract002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> isabstract002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> isabstract002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> isabstract002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> isabstract002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isabstract002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isabstract002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isabstract002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isabstract002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of isabstract002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003.java new file mode 100644 index 00000000000..43496804edb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003.java @@ -0,0 +1,131 @@ +/* + * 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.ReferenceType.isAbstract; + +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 isabstract003 { + + //------------------------------------------------------- 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.ReferenceType.isAbstract."; + private final static String className = "isabstract003"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String[] testedFieldNames = {"f1"}; + + //------------------------------------------------------- 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.isEnum()) { + display("ReferenceType.isAbstract() returned expected true for type: " + className); + } else { + complain("ReferenceType.isAbstract() returned unexpected false 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003/TestDescription.java new file mode 100644 index 00000000000..91a409c3b74 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003/TestDescription.java @@ -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/ReferenceType/isAbstract/isabstract003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isEnum() method of ReferenceType interface. + * The test checks if the method returns true for any + * mirrored abstract enum type which has enum constant-specific + * class bodies. + * The test consists of a debugger program (isabstract003.java) + * and debuggee application (isabstract003a.java). + * Package name is nsk.jdi.ReferenceType.isAbstract . + * 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 isAbstract() method for field of enum type + * declared in isabstract003a class. The test fails if the method + * returned false. + * 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.ReferenceType.isAbstract.isabstract003 + * nsk.jdi.ReferenceType.isAbstract.isabstract003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isAbstract.isabstract003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003a.java new file mode 100644 index 00000000000..557943d95e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003a.java @@ -0,0 +1,97 @@ +/* + * 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.ReferenceType.isAbstract; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isabstract003a { + + //------------------------------------------------------- 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 isabstract003Enum f1 = isabstract003Enum.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(isabstract003.SIGNAL_READY); + receiveSignal(isabstract003.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum isabstract003Enum { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001.java new file mode 100644 index 00000000000..7153e138fb4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001.java @@ -0,0 +1,553 @@ +/* + * 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.ReferenceType.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.isFinal()
    + * complies with its spec.
    + *
    + * Cases for testing include :
    + * - inner and outer ClassTypes, InterfaceTypes, and ArrayTypes;
    + * - arrays of primitive values;
    + * - primitive classes.
    + */ + +public class isfinal001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/isFinal/isfinal001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new isfinal001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return exitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.isFinal.isfinal001a"; + + private String testedClassName = + "nsk.jdi.ReferenceType.isFinal.ClassToCheck"; + + String mName = "nsk.jdi.ReferenceType.isFinal"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String names1[] = { + + ".TestClass$InnerClass", "f", + ".TestClass$InnerClass[]", "t", + + ".TestClass$FinalInnerClass", "t", + ".TestClass$FinalInnerClass[]", "t", + + ".TestClass$NestedIface", "f", + ".TestClass$NestedIface[]", "t", + + ".OuterClass", "f", + ".OuterClass[]", "t", + ".OuterIface", "f", + ".OuterIface[]", "t", + + ".FinalOuterClass", "t", + ".FinalOuterClass[]", "t" + + }; + + String names2[] = { + + "boolean[][][][]", "t", + "byte[][][][]", "t", + "char[][][][]", "t", + "double[][][][]", "t", + "float[][][][]", "t", + "int[][][][]", "t", + "long[][][][]", "t", + "short[][][][]", "t" + + }; + + String names3[] = { + + "java.lang.Boolean", "t", + "java.lang.Byte", "t", + "java.lang.Character", "t", + "java.lang.Double", "t", + "java.lang.Float", "t", + "java.lang.Integer", "t", + "java.lang.Long", "t", + "java.lang.Short", "t" + + }; + + log2("----- Cases for testing: ReferenceTypes"); + for (int i1 = 0; i1 < names1.length; i1 += 2) { + + String typeForCheck = mName + names1[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isFinal = referenceType.isfinal();"); + boolean isFinal = referenceType.isFinal(); + + if ( names1[i1+1].equals("t") ) { + log2(" expected value of isFinal is 'true'"); + if (!isFinal) { + log3("ERROR: isfinal != true for: " + typeForCheck); + testExitCode = FAILED; + } + } else { + log2(" expected value of isFinal is 'false'"); + if (isFinal) { + log3("ERROR: isfinal != false for: " + typeForCheck); + testExitCode = FAILED; + } + } + } + + log2("----- Cases for testing: primitive type arrays"); + for (int i1 = 0; i1 < names2.length; i1 += 2) { + + String typeForCheck = names2[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isFinal = referenceType.isfinal();"); + boolean isFinal = referenceType.isFinal(); + + log2(" expected value of isFinal is 'true'"); + if (!isFinal) { + log3("ERROR: isfinal != true for: " + typeForCheck); + testExitCode = FAILED; + } + + } + + log2("----- Cases for testing: primitive classes"); + for (int i1 = 0; i1 < names3.length; i1 += 2) { + + String typeForCheck = names3[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isFinal = referenceType.isfinal();"); + boolean isFinal = referenceType.isFinal(); + + log2(" expected value of isFinal is 'true'"); + if (!isFinal) { + log3("ERROR: isfinal != true for: " + typeForCheck); + testExitCode = FAILED; + } + + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001/TestDescription.java new file mode 100644 index 00000000000..5c67dac8a05 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001/TestDescription.java @@ -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/ReferenceType/isFinal/isfinal001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.isFinal() + * complies with its spec: + * public boolean isFinal() + * Determines if this type was declared final. + * For arrays (ArrayType) and primitive classes, + * the return value is always true. + * Returns: true if this type is final; false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.isFinal.isfinal001; + * the debuggee program - nsk.jdi.ReferenceType.isFinal.isfinal001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.isFinal.isfinal001 + * nsk.jdi.ReferenceType.isFinal.isfinal001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isFinal.isfinal001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001a.java new file mode 100644 index 00000000000..7c9dc66003c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal001a.java @@ -0,0 +1,174 @@ +/* + * 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.ReferenceType.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the isfinal001 JDI test. + */ + +public class isfinal001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + TestClass check = new TestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +class TestClass { + + class InnerClass implements NestedIface { + boolean bic = true; + } + InnerClass innerClass = new InnerClass(); + InnerClass innerClassArray[] = { new InnerClass() }; + + final class FinalInnerClass { + boolean bfic = true; + } + FinalInnerClass finalInnerClass = new FinalInnerClass(); + FinalInnerClass finalInnerClassArray[] = { new FinalInnerClass() }; + + interface NestedIface { + boolean bif = true; + } + NestedIface nestedIface = new InnerClass(); + NestedIface nestedIfaceArray[] = { new InnerClass() }; + + static OuterClass outerClass = new OuterClass(); + static OuterClass outerClassArray[] = { new OuterClass() }; + static OuterIface outerIface = new OuterClass(); + static OuterIface outerIfaceArray[] = { new OuterClass() }; + + static FinalOuterClass finalOuterClass = new FinalOuterClass(); + static FinalOuterClass finalOuterClassArray[] = { new FinalOuterClass() }; + + boolean bl[][][][] = {{{{true}}}}; + byte bt[][][][] = {{{{0}}}}; + char ch[][][][] = {{{{0}}}}; + double db[][][][] = {{{{0.0}}}}; + float fl[][][][] = {{{{0.0f}}}}; + int in[][][][] = {{{{0}}}}; + long ln[][][][] = {{{{0}}}}; + short sh[][][][] = {{{{0}}}}; + + Boolean blBl = new Boolean(true); + Byte btBt = new Byte((byte)1); + Character chCh = new Character('c'); + Double dbDb = new Double(0); + Float flFl = new Float(0.0f); + Integer inIn = new Integer(0); + Long lnLn = new Long(0); + Short shSh = new Short((short)1); +} + +interface OuterIface { + static boolean b1 = false; +} + +class OuterClass implements OuterIface { + static final boolean b2 = true; +} + +final class FinalOuterClass implements OuterIface { + static final boolean b3 = true; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002.java new file mode 100644 index 00000000000..d0c76736d69 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002.java @@ -0,0 +1,135 @@ +/* + * 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.ReferenceType.isFinal; + +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 isfinal002 { + + //------------------------------------------------------- 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.ReferenceType.isFinal."; + private final static String className = "isfinal002"; + 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() { + //debuggee.receiveExpectedSignal(SIGNAL_GO); + + 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.isFinal()) { + display("ReferenceType.isFinal() returned true for " + className); + } else { + complain("ReferenceType.isFinal() 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002/TestDescription.java new file mode 100644 index 00000000000..31c664cfc46 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ReferenceType/isFinal/isfinal002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isFinal() method of ReferenceType interface. + * The test checks if the method returns true any mirrored + * enum type which does not have enum constant's specific + * class bodies. This kind of enum types are implicitly final. + * The test consists of a debugger program (isfinal002.java) + * and debuggee application (isfinal002a.java). + * Package name is nsk.jdi.ReferenceType.isFinal . + * 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 isFinal() method for each field + * of enum type declared in isfinal002a 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.ReferenceType.isFinal.isfinal002 + * nsk.jdi.ReferenceType.isFinal.isfinal002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isFinal.isfinal002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002a.java new file mode 100644 index 00000000000..84bad1943f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002a.java @@ -0,0 +1,108 @@ +/* + * 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.ReferenceType.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isfinal002a { + + //------------------------------------------------------- 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 isfinal002Enum2 f3 = isfinal002Enum2.e2; + static isfinal002Enum2.Enum2_ f4 = isfinal002Enum2.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(isfinal002.SIGNAL_READY); + + + //pipe.println(isfinal002.SIGNAL_GO); + receiveSignal(isfinal002.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 isfinal002Enum2 { + e1, e2; + + enum Enum2_ { + e1, e2; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001.java new file mode 100644 index 00000000000..6efaa399b89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001.java @@ -0,0 +1,218 @@ +/* + * 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.ReferenceType.isInitialized; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +/** + * This test checks the method isInitialized() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class isinit001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class isInitializeds of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.isInitialized.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "isinit001", + debugeeName = thisClassName + "a"; + + static String is_initialized_sign = "is_initialized"; + static String not_initialized_sign = "not_initialized"; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + +// {package_prefix + "NotInitializedClass", not_initialized_sign}, +// {package_prefix + "NotInitializedInterface", not_initialized_sign}, + + {package_prefix + "InitializedSuperClass", is_initialized_sign}, + + {package_prefix + "InitializedClass", is_initialized_sign}, + {package_prefix + "InitializedInterface", is_initialized_sign} + + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new isinit001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/isInitialized/isinit001 test FAILED"); + } + else { + print_log_on_verbose("\n==> nsk/jdi/ReferenceType/isInitialized/isinit001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + test_log_handler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, test_log_handler); + + print_log_on_verbose("==> nsk/jdi/ReferenceType/isInitialized/isinit001 test LOG:"); + print_log_on_verbose("==> test checks the isInitialized() method of ReferenceType interface"); + print_log_on_verbose(" of the com.sun.jdi package for ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + debugee_launch_command = debugeeName + " -vbs"; + } + + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + + debugee.redirectStderr(out); + print_log_on_verbose("--> isinit001: isinit001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway("##> isinit001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway("##> isinit001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isinit001: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> isinit001: check ReferenceType.isInitialized() method for debugee's classes..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int isInitialized_method_exceptions = 0; + int isInitialized_method_errors = 0; + for (int i=0; i isinit001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + boolean expected_is_initialized_result = classes_for_check[i][1].equals(is_initialized_sign); + boolean returned_is_initialized_result = false; + try { + returned_is_initialized_result = refType.isInitialized(); + } + catch (Throwable thrown) { + print_log_anyway + ("##> isinit001: FAILED: refType.isInitialized() threw unexpected exception - " + + thrown); + print_log_anyway + ("##> refType = " + refType); + isInitialized_method_exceptions++; + continue; + } + if ( returned_is_initialized_result != expected_is_initialized_result ) { + print_log_anyway + ("##> isinit001: FAILED: ReferenceType.isInitialized() returned unexpected result = " + + returned_is_initialized_result); + print_log_anyway + ("##> checked class = " + className); + isInitialized_method_errors++; + } + else { + print_log_on_verbose + ("--> isinit001: PASSED: ReferenceType.isInitialized() returned expected result = " + + returned_is_initialized_result); + print_log_on_verbose + ("--> checked class = " + className); + } + } + print_log_on_verbose("--> isinit001: check completed!"); + print_log_on_verbose("--> isinit001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + print_log_anyway("##> isinit001: \"class not found ERRORS\" number = " + + class_not_found_errors); + } + if ( isInitialized_method_exceptions > 0 ) { + print_log_anyway("##> isinit001: number of unexpected isInitialized() methods exceptions = " + + isInitialized_method_exceptions); + } + if (isInitialized_method_errors > 0) { + print_log_anyway("##> isinit001: isInitialized() method errors number = " + + isInitialized_method_errors); + } + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + isInitialized_method_errors + isInitialized_method_exceptions > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isinit001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway("##> isinit001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isinit001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001/TestDescription.java new file mode 100644 index 00000000000..8883ec0f669 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ReferenceType/isInitialized/isinit001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isInitialized/isinit001 test + * checks the isInitialized() method of ReferenceType interface + * of the com.sun.jdi package for ClassType, InterfaceType: + * For each checked debugee's class the test gets ReferenceType + * instance for this class and then calls the isInitialized() + * method for this ReferenceType instance. + * Some checked debugee's classes have been initialized but other have not. + * The test expects that returned boolean value should be equal to the + * expected boolean value. + * COMMENTS + * The test is corrected and updated as follows: + * - the checks for NotInitializedClass and NotInitializedInterface are removed + * because the logic of other checks doesn't allow to get + * corresponding objects in the debuggee; + * - statements for establishing LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "print_log_anyway" are replaced with "print_log_on_verbose". + * ------------------------------------------------------- + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isInitialized.isinit001 + * nsk.jdi.ReferenceType.isInitialized.isinit001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isInitialized.isinit001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001a.java new file mode 100644 index 00000000000..91b035ccc29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit001a.java @@ -0,0 +1,113 @@ +/* + * 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.ReferenceType.isInitialized; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isinit001 JDI test. + */ + +public class isinit001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + NotInitializedClass not_initialized_class_0, + not_initialized_class_1[] = {not_initialized_class_0}; + + NotInitializedInterface not_initialized_interface_0, + not_initialized_interface_1[] = {not_initialized_interface_0}; + + InitializedClass initialized_class_0 = new InitializedClass(); + + int copy_super_class_int_var = SubClass.super_class_int_var; + + 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 isinit001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + isinit001a isinit001a_obj = new isinit001a(); + + print_log_on_verbose("**> isinit001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isinit001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isinit001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isinit001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isinit001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +// not initialized class +class NotInitializedClass {} + +// not initialized interface +interface NotInitializedInterface {} + + +// initialized interface +interface InitializedInterface { + static final int int_var = 1; +} + +// initialized class +class InitializedClass implements InitializedInterface { + static int my_int_var = int_var; + +} + +// initialized super class +class InitializedSuperClass { + static int super_class_int_var = 999; + +} + +// subclass +class SubClass extends InitializedSuperClass { + static String dummy_string; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002.java new file mode 100644 index 00000000000..658ed8ad4ba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002.java @@ -0,0 +1,250 @@ +/* + * 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.ReferenceType.isInitialized; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +/** + * This test checks the method isInitialized() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class isinit002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class isInitializeds of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.isInitialized.", + thisClassName = package_prefix + "isinit002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "isinit002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new isinit002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isInitialized/isinit002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isInitialized/isinit002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/isInitialized/isinit002 test LOG:"); + print_log_anyway("--> test checks isInitialized() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> isinit002: isinit002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isinit002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> isinit002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isinit002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isinit002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> isinit002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isinit002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean isInitialized_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> isinit002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> isinit002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> isinit002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> isinit002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> isinit002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isinit002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> isinit002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.isInitialized() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> isinit002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isinit002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> isinit002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> isinit002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> isinit002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> isinit002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.isInitialized() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> isinit002: check ReferenceType.isInitialized() method for unloaded class..."); + boolean ref_type_is_initialized = false; + try { + ref_type_is_initialized = refType.isInitialized(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> isinit002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> isinit002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + isInitialized_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || isInitialized_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isinit002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> isinit002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> isinit002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of isinit002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/TestDescription.java new file mode 100644 index 00000000000..6132e17e001 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/TestDescription.java @@ -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/ReferenceType/isInitialized/isinit002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isInitialized/isinit002 test + * checks the isInitialized() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * isInitialized() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - isinit002b class was moved in 'loadclass' subdirectory; + * - package name was added in isinit002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for isinit002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isInitialized.isinit002 + * nsk.jdi.ReferenceType.isInitialized.isinit002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isInitialized.isinit002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/loadclass/isinit002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/loadclass/isinit002b.java new file mode 100644 index 00000000000..9cfc23c4615 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002/loadclass/isinit002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the isInitialized() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.isInitialized; + +class isinit002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002a.java new file mode 100644 index 00000000000..80a766dc2ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.isInitialized; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isinit002 JDI test. + */ + +public class isinit002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.isInitialized."; + private final static String checked_class_name = package_prefix + "isinit002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> isinit002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> isinit002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> isinit002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + print_log_on_verbose + ("**> isinit002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> isinit002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> isinit002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isinit002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isinit002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> isinit002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> isinit002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> isinit002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> isinit002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> isinit002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> isinit002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> isinit002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isinit002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isinit002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isinit002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isinit002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of isinit002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003.java new file mode 100644 index 00000000000..0f6d0716e1d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003.java @@ -0,0 +1,131 @@ +/* + * 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.ReferenceType.isInitialized; + +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 isinit003 { + + //------------------------------------------------------- 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.ReferenceType.isInitialized."; + private final static String className = "isinit003"; + 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", "f5", "f6", "f7", "f8"}; + + //------------------------------------------------------- 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.isInitialized()) { + display("ReferenceType.isInitialized() returned expected true for type: " + className); + } else { + complain("ReferenceType.isInitialized() returned unexpected false 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003/TestDescription.java new file mode 100644 index 00000000000..17cb719451e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ReferenceType/isInitialized/isinit003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isInitialized() method of ReferenceType interface. + * The test checks if the method returns true for any + * mirrored enum type + * The test consists of a debugger program (isinit003.java) + * and debuggee application (isinit003a.java). + * Package name is nsk.jdi.ReferenceType.isInitialized . + * 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 isInitialized() method for each mirorred + * enum type. The test fails if the method returned false once + * or more. + * 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.ReferenceType.isInitialized.isinit003 + * nsk.jdi.ReferenceType.isInitialized.isinit003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isInitialized.isinit003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003a.java new file mode 100644 index 00000000000..59a53e5335c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003a.java @@ -0,0 +1,164 @@ +/* + * 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.ReferenceType.isInitialized; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isinit003a { + + //------------------------------------------------------- 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; + static Enum4.Enum4_ f4 = Enum4.Enum4_.e1; + static isinit003Enum5 f5 = isinit003Enum5.e2; + static isinit003Enum6 f6 = isinit003Enum6.e1; + static isinit003Enum7 f7 = isinit003Enum7.e2; + static isinit003Enum8.Enum8_ f8 = isinit003Enum8.Enum8_.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(isinit003.SIGNAL_READY); + receiveSignal(isinit003.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + + enum Enum1 { + e1, e2; + } + + enum Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); + } + + enum Enum3 implements isinit003i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); + } + + enum Enum4 { + e1, e2; + + enum Enum4_ { + e1, e2; + } + } + +} + +//--------------------------------------------------------- test specific classes + +enum isinit003Enum5 { + e1, e2; +} + +enum isinit003Enum6 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +enum isinit003Enum7 implements isinit003i { + e1 { + int val() {return i+1;} + }, + + e2 { + int val() {return i+2;} + }; + abstract int val(); +} + +enum isinit003Enum8 { + e1, e2; + enum Enum8_ { + e1, e2; + } +} + +interface isinit003i { + int i = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001.java new file mode 100644 index 00000000000..1f79a950faa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001.java @@ -0,0 +1,216 @@ +/* + * 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.ReferenceType.isPrepared; + +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 isPrepared() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class isprepared001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class isPrepareds of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.isPrepared.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "isprepared001", + debugeeName = thisClassName + "a"; + + static String is_prepared_sign = "is_prepared"; + static String not_prepared_sign = "not_prepared"; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + +// {package_prefix + "NotPreparedClass", not_prepared_sign}, +// {package_prefix + "NotPreparedInterface", not_prepared_sign}, + + {package_prefix + "PreparedClass", is_prepared_sign}, + {package_prefix + "PreparedInterface", is_prepared_sign} + + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new isprepared001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/isPrepared/isprepared001 test FAILED"); + } + else { + print_log_on_verbose("\n==> nsk/jdi/ReferenceType/isPrepared/isprepared001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + test_log_handler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, test_log_handler); + + print_log_on_verbose("==> nsk/jdi/ReferenceType/isInitialized/isinit001 test LOG:"); + print_log_on_verbose("==> test checks the isInitialized() method of ReferenceType interface"); + print_log_on_verbose(" of the com.sun.jdi package for ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + debugee_launch_command = debugeeName + " -vbs"; + } + + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> isprepared001: isprepared001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway("##> isprepared001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway("##> isprepared001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isprepared001: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> isprepared001: check ReferenceType.isPrepared() method for debugee's classes..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int isPrepared_method_exceptions = 0; + int isPrepared_method_errors = 0; + for (int i=0; i isprepared001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + boolean expected_is_prepared_result = classes_for_check[i][1].equals(is_prepared_sign); + boolean returned_is_prepared_result = false; + try { + returned_is_prepared_result = refType.isPrepared(); + } + catch (Throwable thrown) { + print_log_anyway + ("##> isprepared001: FAILED: refType.isPrepared() threw unexpected exception - " + + thrown); + print_log_anyway + ("##> refType = " + refType); + isPrepared_method_exceptions++; + continue; + } + if ( returned_is_prepared_result != expected_is_prepared_result ) { + print_log_anyway + ("##> isprepared001: FAILED: ReferenceType.isPrepared() returned unexpected result = " + + returned_is_prepared_result); + print_log_anyway + ("##> checked class = " + className); + isPrepared_method_errors++; + } + else { + print_log_on_verbose + ("--> isprepared001: PASSED: ReferenceType.isPrepared() returned expected result = " + + returned_is_prepared_result); + print_log_on_verbose + ("--> checked class = " + className); + } + } + print_log_on_verbose("--> isprepared001: check completed!"); + print_log_on_verbose("--> isprepared001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + print_log_anyway("##> isprepared001: \"class not found ERRORS\" number = " + + class_not_found_errors); + } + if ( isPrepared_method_exceptions > 0 ) { + print_log_anyway("##> isprepared001: number of unexpected isPrepared() methods exceptions = " + + isPrepared_method_exceptions); + } + if (isPrepared_method_errors > 0) { + print_log_anyway("##> isprepared001: isPrepared() method errors number = " + + isPrepared_method_errors); + } + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + isPrepared_method_errors + isPrepared_method_exceptions > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isprepared001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway("##> isprepared001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isprepared001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001/TestDescription.java new file mode 100644 index 00000000000..9531602aef3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/ReferenceType/isPrepared/isprepared001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isPrepared/isprepared001 test + * checks the isPrepared() method of ReferenceType interface + * of the com.sun.jdi package for ClassType, InterfaceType: + * For each checked debugee's class the test gets ReferenceType + * instance for this class and then calls the isPrepared() + * method for this ReferenceType instance. + * Some checked debugee's classes have been prepared but other have not. + * The test expects that returned boolean value should be equal to the + * expected boolean value. + * COMMENTS + * The test is corrected and updated as follows: + * - the checks for NotPreparedClass and NotPreparedInterface are removed + * because the logic of other checks doesn't allow to get + * corresponding objects in the debuggee; + * - statements for establishing LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "print_log_anyway" are replaced with "print_log_on_verbose". + * ------------------------------------------------------- + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isPrepared.isprepared001 + * nsk.jdi.ReferenceType.isPrepared.isprepared001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isPrepared.isprepared001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001a.java new file mode 100644 index 00000000000..c43f9ae033c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared001a.java @@ -0,0 +1,97 @@ +/* + * 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.ReferenceType.isPrepared; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isprepared001 JDI test. + */ + +public class isprepared001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + NotPreparedClass not_prepared_class_0, not_prepared_class_1[] = {not_prepared_class_0}; + + NotPreparedInterface not_prepared_interface_0, not_prepared_interface_1[] = {not_prepared_interface_0}; + + PreparedClass prepared_class_0 = new PreparedClass(); + + 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 isprepared001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + isprepared001a isprepared001a_obj = new isprepared001a(); + + print_log_on_verbose("**> isprepared001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isprepared001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isprepared001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isprepared001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isprepared001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +// not prepared class +class NotPreparedClass {} + +// not prepared interface +interface NotPreparedInterface {} + + +// prepared interface +interface PreparedInterface { + static final int int_var = 1; +} + +// prepared class +class PreparedClass implements PreparedInterface { + static int my_int_var = int_var; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002.java new file mode 100644 index 00000000000..d160d257434 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.isPrepared; + +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 isPrepared() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class isprepared002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class isPrepareds of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.isPrepared.", + thisClassName = package_prefix + "isprepared002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "isprepared002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new isprepared002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isPrepared/isprepared002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isPrepared/isprepared002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/isPrepared/isprepared002 test LOG:"); + print_log_anyway("--> test checks isPrepared() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> isprepared002: isprepared002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isprepared002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> isprepared002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isprepared002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isprepared002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> isprepared002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isprepared002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean isPrepared_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> isprepared002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> isprepared002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> isprepared002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> isprepared002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> isprepared002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isprepared002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> isprepared002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.isPrepared() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> isprepared002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isprepared002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> isprepared002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> isprepared002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> isprepared002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> isprepared002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.isPrepared() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> isprepared002: check ReferenceType.isPrepared() method for unloaded class..."); + boolean ref_type_is_prepared = false; + try { + ref_type_is_prepared = refType.isPrepared(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> isprepared002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> isprepared002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + isPrepared_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || isPrepared_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isprepared002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> isprepared002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> isprepared002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of isprepared002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/TestDescription.java new file mode 100644 index 00000000000..48f1942e4fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/TestDescription.java @@ -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/ReferenceType/isPrepared/isprepared002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isPrepared/isprepared002 test + * checks the isPrepared() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * isPrepared() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - isprepared002b class was moved in 'loadclass' subdirectory; + * - package name was added in isprepared002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for isprepared002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isPrepared.isprepared002 + * nsk.jdi.ReferenceType.isPrepared.isprepared002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isPrepared.isprepared002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/loadclass/isprepared002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/loadclass/isprepared002b.java new file mode 100644 index 00000000000..cb6dae35958 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002/loadclass/isprepared002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the isPrepared() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.isPrepared; + +class isprepared002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002a.java new file mode 100644 index 00000000000..b005131cc4c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isPrepared/isprepared002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.isPrepared; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isprepared002 JDI test. + */ + +public class isprepared002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.isPrepared."; + private final static String checked_class_name = package_prefix + "isprepared002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> isprepared002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> isprepared002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> isprepared002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> isprepared002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> isprepared002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> isprepared002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isprepared002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isprepared002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> isprepared002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> isprepared002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> isprepared002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> isprepared002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> isprepared002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> isprepared002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> isprepared002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isprepared002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isprepared002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isprepared002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isprepared002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of isprepared002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001.java new file mode 100644 index 00000000000..f4a8ebbd44d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001.java @@ -0,0 +1,571 @@ +/* + * 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.ReferenceType.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.isStatic()
    + * complies with its spec.
    + *
    + * Cases for testing include :
    + * - nested and outer ClassTypes and InterfaceTypes,
    + * and nested ArrayTypes;
    + * - arrays of primitive values;
    + * - primitive classes.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class isstatic001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/isStatic/isstatic001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new isstatic001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.isStatic.isstatic001a"; + + String mName = "nsk.jdi.ReferenceType.isStatic"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String names1[] = { + + ".isstatic001aTestClass$NestedClass", "f", + ".isstatic001aTestClass$NestedClass[]", "f", + ".isstatic001aTestClass$NestedIface", "t", + ".isstatic001aTestClass$StaticNestedClass", "t", + ".isstatic001aOuterClass", "f", + ".isstatic001aOuterClass[]", "f", + ".isstatic001aOuterIface", "f", + ".isstatic001aOuterIface[]", "f", + ".isstatic001aOuterIface$InnerIface", "t", + ".isstatic001aOuterIface$StaticInnerIface", "t" + + }; + + String names2[] = { + + "boolean[][][][]", "f", + "byte[][][][]", "f", + "char[][][][]", "f", + "double[][][][]", "f", + "float[][][][]", "f", + "int[][][][]", "f", + "long[][][][]", "f", + "short[][][][]", "f" + + }; + + String names3[] = { + + "java.lang.Boolean", "f", + "java.lang.Byte", "f", + "java.lang.Character", "f", + "java.lang.Double", "f", + "java.lang.Float", "f", + "java.lang.Integer", "f", + "java.lang.Long", "f", + "java.lang.Short", "f" + + }; + + log2("----- Cases for testing: ReferenceTypes"); + for (int i1 = 0; i1 < names1.length; i1 += 2) { + + String typeForCheck = mName + names1[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isStatic = referenceType.isStatic();"); + boolean isStatic = referenceType.isStatic(); + + if ( names1[i1+1].equals("t") ) { + log2(" expected value of isStatic is 'true'"); + if (!isStatic) { + log3("ERROR: isStatic != true for: " + typeForCheck); + testExitCode = FAILED; + } + } else { + log2(" expected value of isStatic is 'false'"); + if (isStatic) { + log3("ERROR: isStatic != false for: " + typeForCheck); + testExitCode = FAILED; + } + } + } + + log2("----- Cases for testing: primitive type arrays"); + for (int i1 = 0; i1 < names2.length; i1 += 2) { + + String typeForCheck = names2[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isStatic = referenceType.isStatic();"); + boolean isStatic = referenceType.isStatic(); + + log2(" expected value of isStatic is 'false'"); + if (isStatic) { + log3("ERROR: isStatic != false for: " + typeForCheck); + testExitCode = FAILED; + } + + } + + log2("----- Cases for testing: primitive classes"); + for (int i1 = 0; i1 < names3.length; i1 += 2) { + + String typeForCheck = names3[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isStatic = referenceType.isStatic();"); + boolean isStatic = referenceType.isStatic(); + + log2(" expected value of isStatic is 'false'"); + if (isStatic) { + log3("ERROR: isStatic != false for: " + typeForCheck); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001/TestDescription.java new file mode 100644 index 00000000000..aaa68a69c12 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001/TestDescription.java @@ -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/ReferenceType/isStatic/isstatic001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.isStatic() + * complies with its spec: + * public boolean isStatic() + * Determines if this type was declared static. + * Only nested types, can be declared static, + * so false is returned for any + * package-level type, array type, or primitive class. + * Returns: + * true if this type is static; false otherwise. + * Cases for testing include : + * - nested and outer ClassTypes and InterfaceTypes, and nested ArrayTypes;
    + * - arrays of primitive values; + * - primitive classes. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.isStatic.isstatic001; + * the debuggee program - nsk.jdi.ReferenceType.isStatic.isstatic001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ReferenceType.isStatic.isstatic001 + * nsk.jdi.ReferenceType.isStatic.isstatic001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isStatic.isstatic001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001a.java new file mode 100644 index 00000000000..2065d1f7e5f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic001a.java @@ -0,0 +1,186 @@ +/* + * 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.ReferenceType.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the isstatic001 JDI test. + */ + +public class isstatic001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + isstatic001aTestClass check = new isstatic001aTestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + + +class isstatic001aTestClass { + + class NestedClass implements NestedIface { + boolean bnc = true; + } + NestedClass nestedClass = new NestedClass(); + NestedClass nestedClassArray[] = { new NestedClass() }; + + interface NestedIface { + boolean bnf = true; + } + NestedIface nestedIface = new NestedClass(); +// NestedIface nestedIfaceArray[] = { new NestedClass() }; + + + static class StaticNestedClass { + boolean bsnc = true; + } + StaticNestedClass staticNestedClass = new StaticNestedClass(); +// StaticNestedClass staticNestedClassArray[] = { new StaticNestedClass() }; + + + static isstatic001aOuterClass outerClass = new isstatic001aOuterClass(); + static isstatic001aOuterClass outerClassArray[] = { new isstatic001aOuterClass() }; + static isstatic001aOuterIface outerIface = new isstatic001aOuterClass(); + static isstatic001aOuterIface outerIfaceArray[] = { new isstatic001aOuterClass() }; + + + boolean bl[][][][] = {{{{true}}}}; + byte bt[][][][] = {{{{0}}}}; + char ch[][][][] = {{{{0}}}}; + double db[][][][] = {{{{0.0}}}}; + float fl[][][][] = {{{{0.0f}}}}; + int in[][][][] = {{{{0}}}}; + long ln[][][][] = {{{{0}}}}; + short sh[][][][] = {{{{0}}}}; + + + Boolean blBl = new Boolean(true); + Byte btBt = new Byte((byte)1); + Character chCh = new Character('c'); + Double dbDb = new Double(0); + Float flFl = new Float(0.0f); + Integer inIn = new Integer(0); + Long lnLn = new Long(0); + Short shSh = new Short((short)1); +} + +interface isstatic001aOuterIface { + static boolean b1 = false; + + interface InnerIface {} + + static interface StaticInnerIface {} +} + +class isstatic001aOuterClass implements isstatic001aOuterIface { + static final boolean b2 = true; + + class InnerClass implements isstatic001aOuterIface.InnerIface { + boolean bOiIi = true; + } + InnerClass innerClass = new InnerClass(); + + class StaticInnerClass implements isstatic001aOuterIface.StaticInnerIface { + boolean bOiSii = true; + } + StaticInnerClass staticInnerClass = new StaticInnerClass(); +} + +final class isstatic001aFinalOuterClass implements isstatic001aOuterIface { + static final boolean b3 = true; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002.java new file mode 100644 index 00000000000..16ce817ed5d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002.java @@ -0,0 +1,482 @@ +/* + * 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.ReferenceType.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.isStatic()
    + * complies with its spec.
    + *
    + * Cases for testing include :
    + * - nested and outer ClassTypes and InterfaceTypes,
    + * and nested ArrayTypes;
    + * - arrays of primitive values;
    + * - primitive classes.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class isstatic002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/isStatic/isstatic002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new isstatic002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.isStatic.isstatic002a"; + + String mName = "nsk.jdi.ReferenceType.isStatic"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String names1[] = { + + ".isstatic002aTestClass$NestedIface1[]", "f", + ".isstatic002aTestClass$NestedIface2[]", "f", + ".isstatic002aTestClass$StaticNestedClass[]", "f" + }; + + log2("----- Cases for testing: ReferenceTypes"); + for (int i1 = 0; i1 < names1.length; i1 += 2) { + + String typeForCheck = mName + names1[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + log2(" getting: boolean isStatic = referenceType.isStatic();"); + boolean isStatic = referenceType.isStatic(); + + if ( names1[i1+1].equals("t") ) { + log2(" expected value of isStatic is 'true'"); + if (!isStatic) { + log3("ERROR: isStatic != true for: " + typeForCheck); + testExitCode = FAILED; + } + } else { + log2(" expected value of isStatic is 'false'"); + if (isStatic) { + log3("ERROR: isStatic != false for: " + typeForCheck); + testExitCode = FAILED; + } + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002/TestDescription.java new file mode 100644 index 00000000000..8743a535b71 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ReferenceType/isStatic/isstatic002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.isStatic() + * complies with its spec: + * public boolean isStatic() + * Determines if this type was declared static. + * Only nested types, can be declared static, + * so false is returned for any + * package-level type, array type, or primitive class. + * Returns: + * true if this type is static; false otherwise. + * Cases for testing include : + * - nested package-level ClassTypes and InterfaceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.isStatic.isstatic002; + * the debuggee program - nsk.jdi.ReferenceType.isStatic.isstatic002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ReferenceType.isStatic.isstatic002 + * nsk.jdi.ReferenceType.isStatic.isstatic002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isStatic.isstatic002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002a.java new file mode 100644 index 00000000000..2cf2f97dbb9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isStatic/isstatic002a.java @@ -0,0 +1,139 @@ +/* + * 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.ReferenceType.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the isstatic002 JDI test. + */ + +public class isstatic002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + isstatic002aTestClass check = new isstatic002aTestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + + +class isstatic002aTestClass { + + interface NestedIface1 { + boolean bnf = true; + } + static class NestedClass1 implements NestedIface1 { + boolean bnc = true; + } + NestedIface1 nestedIfaceArray1[] = { new NestedClass1() }; + + + interface NestedIface2 { + boolean bnf = true; + } + class NestedClass2 implements NestedIface2 { + boolean bnc = true; + } + NestedIface2 nestedIfaceArray2[] = { new NestedClass2() }; + + + static class StaticNestedClass { + boolean bsnc = true; + } + StaticNestedClass staticNestedClassArray[] = { new StaticNestedClass() }; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001.java new file mode 100644 index 00000000000..6f920e5417b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001.java @@ -0,0 +1,205 @@ +/* + * 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.ReferenceType.isVerified; + +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 isVerified() + * of the JDI interface ReferenceType of com.sun.jdi package + * for ClassType, InterfaceType + */ + +public class isVerified001 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.ReferenceType.isVerified.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "isVerified001", + debugeeName = thisClassName + "a"; + + + static ArgumentHandler argsHandler; + private static Log logHandler; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + + {thisClassName, "verified", "class"}, + {thisClassName+"a", "verified", "class"}, + +// {package_prefix + "not_verif_cls", "not verified", "class"}, + +// {package_prefix + "not_verif_interf", "not verified", "interface"}, + + {package_prefix + "verif_class", "verified", "class"}, + + {package_prefix + "verif_interf", "verified", "interface"}, + + {package_prefix + "verif_subcl", "verified", "class"} + + }; + + /** + * Re-call to run(args,out), 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 isVerified001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/isVerified/isVerified001 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/isVerified/isVerified001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + print_log_on_verbose("==> nsk/jdi/ReferenceType/isInitialized/isinit001 test LOG:"); + print_log_on_verbose("==> test checks the isInitialized() method of ReferenceType interface"); + print_log_on_verbose(" of the com.sun.jdi package for ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + debugee_launch_command = debugeeName + " -vbs"; + } + + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + + debugee.redirectStderr(out); + print_log_on_verbose("--> isVerified001: isVerified001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + logHandler.complain + ("##> isVerified001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + logHandler.complain + ("##> isVerified001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isVerified001: debugee's \"ready\" signal recieved!"); + } + + logHandler.display + ("--> isVerified001: checking debugee's classes by ReferenceType.isVerified() method..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int isVerified_method_errors = 0; + for (int i=0; i isVerified001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String s_type = classes_for_check[i][2]; + String s_verified_sign = classes_for_check[i][1]; + boolean isVerified = s_verified_sign.equals("verified"); + if (refType.isVerified() != isVerified) { + logHandler.complain("##> isVerified001: UNEXPECTED isVerified() method result (" + + !isVerified + ") for " + s_type + ": " + + className + "(" + s_verified_sign + ")"); + isVerified_method_errors++; + } + else { + print_log_on_verbose("--> isVerified001: expected isVerified() method result (" + + isVerified + ") for " + s_type + ": " + + className + "(" + s_verified_sign + ")"); + } + } + logHandler.display("--> isVerified001: checking debugee's classes completed!"); + logHandler.display("--> isVerified001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + logHandler.complain("##> isVerified001: \"class not found ERRORS\" counter = " + + class_not_found_errors); + } + if (isVerified_method_errors > 0) { + logHandler.complain("##> isVerified001: isVerified() method ERRORS counter = " + + isVerified_method_errors); + } + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + isVerified_method_errors > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isVerified001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + logHandler.complain + ("##> isVerified001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> isVerified001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001/TestDescription.java new file mode 100644 index 00000000000..8b89469aad9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001/TestDescription.java @@ -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/ReferenceType/isVerified/isVerified001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isVerified/isVerified001 test + * checks the isVerified() method of ReferenceType interface + * of the com.sun.jdi package for ClassType, InterfaceType. + * COMMENTS + * The test is corrected and updated as follows: + * - the checks for "not_verif_cls" and "not_verif_interf" are removed + * because the logic of other checks doesn't allow to get + * corresponding objects in the debuggee; + * - statements for establishing LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "logHandler.display" or "logHandler.complain". + * ------------------------------------------------------- + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isVerified.isVerified001 + * nsk.jdi.ReferenceType.isVerified.isVerified001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isVerified.isVerified001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001a.java new file mode 100644 index 00000000000..4f4649dd033 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isVerified001a.java @@ -0,0 +1,108 @@ +/* + * 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.ReferenceType.isVerified; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isVerified001 JDI test. + */ + +public class isVerified001a { + + static boolean verbose_mode = false; + + isVerified001 a001_0 = new isVerified001(); + + not_verif_cls not_verif_cls_0, not_verif_cls_1[] = {not_verif_cls_0}; + + not_verif_interf not_verif_interf_0, not_verif_interf_1[] = {not_verif_interf_0}; + + verif_class verif_class_0 = new verif_class(); + + verif_subcl verif_subcl_0 = new verif_subcl(); + + 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 isVerified001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + isVerified001a isVerified001a_obj = new isVerified001a(); + + print_log_on_verbose("**> isVerified001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isVerified001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isVerified001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isVerified001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isVerified001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** not verified class */ +class not_verif_cls {} + +/** not verified interface */ +interface not_verif_interf {} + +/** verified class */ +class verif_class { + + static { + int int_var = 1; + } + +} + +/** verified interface */ +interface verif_interf { + static final int int_var = 1; +} + +/** verified subclass */ +class verif_subcl implements verif_interf { + static int my_int_var = int_var; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002.java new file mode 100644 index 00000000000..b5fe3449d68 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002.java @@ -0,0 +1,252 @@ +/* + * 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.ReferenceType.isVerified; + +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 isVerified() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class isverified002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class isVerifieds of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.isVerified.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "isverified002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "isverified002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new isverified002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isVerified/isverified002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/isVerified/isverified002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/isVerified/isverified002 test LOG:"); + print_log_anyway("--> test checks isVerified() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> isverified002: isverified002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isverified002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> isverified002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isverified002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isverified002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> isverified002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isverified002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean isVerified_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> isverified002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> isverified002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> isverified002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> isverified002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> isverified002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> isverified002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> isverified002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.isVerified() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> isverified002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> isverified002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> isverified002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> isverified002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> isverified002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> isverified002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.isVerified() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> isverified002: check ReferenceType.isVerified() method for unloaded class..."); + boolean ref_type_is_verified = false; + try { + ref_type_is_verified = refType.isVerified(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> isverified002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> isverified002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + isVerified_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || isVerified_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> isverified002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> isverified002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> isverified002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of isverified002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/TestDescription.java new file mode 100644 index 00000000000..388038571ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/ReferenceType/isVerified/isverified002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/isVerified/isverified002 test + * checks the isVerified() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * isVerified() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - isverified002b class was moved in 'loadclass' subdirectory; + * - package name was added in isverified002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for isverified002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isVerified.isverified002 + * nsk.jdi.ReferenceType.isVerified.isverified002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isVerified.isverified002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/loadclass/isverified002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/loadclass/isverified002b.java new file mode 100644 index 00000000000..3862effdd30 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002/loadclass/isverified002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the isVerified() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.isVerified; + +class isverified002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002a.java new file mode 100644 index 00000000000..6a769b9c78b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified002a.java @@ -0,0 +1,118 @@ +/* + * 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.ReferenceType.isVerified; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the isverified002 JDI test. + */ + +public class isverified002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + static String package_prefix = "nsk.jdi.ReferenceType.isVerified."; + static String checked_class_name = package_prefix + "isverified002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> isverified002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> isverified002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> isverified002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> isverified002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> isverified002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> isverified002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isverified002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isverified002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> isverified002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> isverified002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> isverified002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> isverified002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> isverified002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> isverified002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> isverified002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> isverified002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> isverified002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> isverified002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> isverified002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of isverified002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003.java new file mode 100644 index 00000000000..47e594e51b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003.java @@ -0,0 +1,154 @@ +/* + * 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.ReferenceType.isVerified; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; +import java.util.jar.*; + +/** + */ +public class isverified003 { + + //------------------------------------------------------- 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.ReferenceType.isVerified."; + private final static String className = "isverified003"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String classLoaderName = prefix + "fields002aClassLoader"; + private final static String classFieldName1 = "loadedClass1"; + private final static String classFieldName2 = "loadedClass2"; + + //------------------------------------------------------- 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; + + try { + debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName); + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + throw new Failure("Class '" + debuggeeName + "' not found."); + } else { + execTest(); + } + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain("Unexpected Exception: " + e.getMessage()); + e.printStackTrace(out); + } finally { + debuggee.quit(); + } + return exitStatus; + } + + //------------------------------------------------------ mutable common method + + private static void execTest() { + + ReferenceType refType1 = getFieldType(classFieldName1); + ReferenceType refType2 = getFieldType(classFieldName2); + + display("isPrepared() returned " + refType1.isPrepared() + " for " + refType1); +// display("isPrepared() returned " + refType2.isPrepared() + " for " + refType2); + boolean result1 = refType1.isVerified(); + boolean result2 = refType2.isVerified(); + if (result1 != result2) { + complain("isVerified() returned different results :" + + "\n\t '" + result1 + "' for " + refType1 + "\n\t '" + result2 + "' for " + refType2); + exitStatus = Consts.TEST_FAILED; + } + } + + //--------------------------------------------------------- test specific methods + + private static ReferenceType getFieldType (String fieldName) { + ReferenceType refType = null; + while (true) { + Field classField = debuggeeClass.fieldByName(fieldName); + if ( classField == null) { + complain("Checked field is not found in the debuggee: " + fieldName); + break; + } + + Value classValue = debuggeeClass.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + complain("Unexpected exception while getting ClassObjectReference : " + e.getMessage()); + break; + } + + refType = classObjRef.reflectedType(); + break; + } + if (refType == null) { + throw new Failure("Cannot find ReferenceType for : " + fieldName); + } + return refType; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/TestDescription.java new file mode 100644 index 00000000000..24cf76e1a3b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/TestDescription.java @@ -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/ReferenceType/isVerified/isverified003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that an implementation of the + * com.sun.jdi.ReferenceType.isVerified() method conforms + * with its spec. + * The test verifies an assertion: + * public boolean isVerified() + * Determines if this type has been verified. + * The test consists of: + * debugger application - nsk.jdi.ReferenceType.isVerified.isverified003, + * debuggee application - nsk.jdi.ReferenceType.isVerified.isverified003a, + * custom-loaded classes - nsk.jdi.ReferenceType.isVerified.isverified003b, + * nsk.jdi.ReferenceType.isVerified.isverified003c + * The test checks up results of the method for two classes loaded by + * custom isverified003aClassLoader loader. The custom loader loads + * auxuliary classes until preparation point exclusively. The test fails + * if isVerified() method returns diffrent results for custom-loaded classes + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.isVerified.isverified003 + * nsk.jdi.ReferenceType.isVerified.isverified003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.isVerified.isverified003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/loadclass/isverified003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/loadclass/isverified003b.java new file mode 100644 index 00000000000..42fe42f76ab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/loadclass/isverified003b.java @@ -0,0 +1,29 @@ +/* + * 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.ReferenceType.isVerified; + +/** + * This class is loaded by isverified003aClassLoader until preparation. + */ +class isverified003b { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/loadclass/isverified003c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/loadclass/isverified003c.java new file mode 100644 index 00000000000..75e4abab846 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/loadclass/isverified003c.java @@ -0,0 +1,29 @@ +/* + * 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.ReferenceType.isVerified; + +/** + * This class is loaded by isverified003aClassLoader until preparation. + */ +class isverified003c { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003a.java new file mode 100644 index 00000000000..229c0840e31 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003a.java @@ -0,0 +1,165 @@ +/* + * 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.ReferenceType.isVerified; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * The debugged applcation of the test. + */ +public class isverified003a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + private final static String prefix = "nsk.jdi.ReferenceType.isVerified."; + private final static String checkedClassName1 = prefix + "isverified003b"; + private final static String checkedClassName2 = prefix + "isverified003c"; + static isverified003aClassLoader customClassLoader; + static Class loadedClass1; + static Class loadedClass2; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) throws ClassNotFoundException { + + exitStatus = Consts.TEST_PASSED; + argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + String checkedClassDir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + customClassLoader = new isverified003aClassLoader(checkedClassDir); + + loadedClass1 = loadUntilPreparation (checkedClassName1); + loadedClass2 = loadUntilPreparation (checkedClassName2); + + pipe.println(isverified003.SIGNAL_READY); + + receiveSignal(isverified003.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + + private static Class loadUntilPreparation (String className) throws ClassNotFoundException { + Class loadedClass = customClassLoader.preloadClass(className); + // ensure that class was loaded by custom class loader + if (!(loadedClass.getClassLoader() instanceof isverified003aClassLoader)) { + throw new Failure("Default system loader was used to load class " + className); + } + display ("Checked class loaded but not prepared: " + className); + return loadedClass; + } +} + +//--------------------------------------------------------- test specific classes + +/** + * Custom class loader. + */ +class isverified003aClassLoader extends ClassLoader { + + private String classPath; + + public isverified003aClassLoader(String classPath) { + super(isverified003aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public Class preloadClass (String className) throws ClassNotFoundException { + return findClass(className); + } + + protected synchronized Class findClass(String name) throws ClassNotFoundException { + String classFileName = classPath + "/" + name.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(name, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java new file mode 100644 index 00000000000..356d1c0ee5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java @@ -0,0 +1,261 @@ +/* + * 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.ReferenceType.locationsOfLine_i; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.locationsOfLine(int)
    + * complies with its specification.
    + *
    + * The test checks up that for each line in the List returned
    + * by the method ReferenceType.allLineLocations(),
    + * the method locationsOfLine(lineNumber) returns
    + * non-empty List object in which each object is a Location object.
    + * Not throwing AbsentInformationException is checked up as well.
    + */ + +public class locationsofline_i001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new locationsofline_i001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001a"; + + String mName = "nsk.jdi.ReferenceType.locationsOfLine_i"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List locations = null; + ReferenceType refType = null; + + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested ReferenceType object 'refType'"); + refType = (ReferenceType) classes.get(0); + + log2("......locations = refType.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = refType.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + int size = locations.size(); + if (size == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + ListIterator li1 = locations.listIterator(); + + log2("......the loop of checking locations in the returned list;"); + log2(" AbsentInformationException is not expected"); + + label1: + for (int ifor1 = 0; ifor1 < size; ifor1++) { + + int lineNumber = ((Location) li1.next()).lineNumber(); + + try { + log2("......List lineLocations = refType.locationsOfLine(" + lineNumber + ");"); + List lineLocations = refType.locationsOfLine(lineNumber); + int size1 = lineLocations.size(); + if (size1 == 0) { + testExitCode = FAILED; + log3("ERROR: lineLocations.size() == 0"); + break label1; + } + ListIterator li2 = lineLocations.listIterator(); + try { + for (; li2.hasNext(); ) { + Location loc = (Location) li2.next(); + } + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException, that is, element is not Location"); + break label1; + } + } catch ( AbsentInformationException e2 ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break label1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001/TestDescription.java new file mode 100644 index 00000000000..40ec864d198 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001/TestDescription.java @@ -0,0 +1,94 @@ +/* + * 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/ReferenceType/locationsOfLine_i/locationsofline_i001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.locationsOfLine_i() + * complies with its spec: + * public List locationsOfLine(int lineNumber) + * throws AbsentInformationException + * Returns a List containing all Location objects that + * map to the given line number. + * This method is equivalent to + * locationsOfLine(vm.getDefaultStratum(), null, lineNumber) - + * see locationsOfLine(java.lang.String,java.lang.String,int) + * for more information. + * Parameters: lineNumber - the line number + * Returns: a List of all Location objects that map to the given line. + * Throws: AbsentInformationException - + * if there is no line number information for this class. + * ClassNotPreparedException - + * if this class not yet been prepared. + * The test checks up that for each line in the List returned by the method + * ReferenceType.allLineLocations(), the method locationsOfLine(lineNumber) + * returns non-empty List object in which each object is a Location object. + * Not throwing AbsentInformationException is checked up as well. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001; + * the debuggee program - nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The option + * JAVAC_OPTS=-g + * is put into the locationsofline002.cfg file. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001 + * nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001a + * + * @comment make sure locationsofline_i001a is compiled with full debug info + * @clean nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001a + * @compile -g:lines,source,vars ../locationsofline_i001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001a.java new file mode 100644 index 00000000000..d5e4ca9a40c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001a.java @@ -0,0 +1,136 @@ +/* + * 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.ReferenceType.locationsOfLine_i; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the locationsofline_i001 JDI test. + */ + +public class locationsofline_i001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType.locationsOfLine(int) + * properly returns an empty list for arrays (ArrayType), primitive + * classes, and for interfaces (InterfaceType) if the interface has + * no executable code in its class initialization at the specified line + * number.

    + * + * Debugger part of it attempts to get locations that map to the debuggee + * field values/type declaration, which themselves are:
    + * primitive classes, arrays of primitive types and classes, and finally, + * an interface type. + */ +public class locationsofline_i002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.locationsOfLine_i.locationsofline_i002t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 25; + // tested fields and used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr", + "dummyIf" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new locationsofline_i002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "locationsofline_i002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i + * 32 --> 1001 + * 32 --> 1002 + * 32 --> 1003 + * 32 --> 1004 + * For this case locationsOfLine('TestStratum', null, 1001) should return single location for java line 32, + * and for lines 1002, 1003, 1004 should return empty list. + * 33 --> 1005 + * 36 --> 1005 + * 37 --> 1005 + * 38 --> 1005 + * For this case locationsOfLine('TestStratum', null, 1005) should return 4 locations for java lines 33 - 36, + * 39 --> 1006 + * 40 --> 1007 + * 41 --> 1008 + * For this case locationsOfLine for lines 1006-1007 should return single corresponding java line. + * Debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that for obtained ReferenceType method 'com.sun.jdi.Method.locationsOfLine(String stratum, String sourceName, int lineNumber)' + * returns correct values for 3 cases described above. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsOfLine_ssi003.locationsOfLine_ssi003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsOfLine_ssi003.locationsOfLine_ssi003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsOfLine_ssi003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class locationsOfLine_ssi003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new locationsOfLine_ssi003().runIt(argv, out); + } + + protected void preparePatchedClassFile(String className) { + String smapFileName = "TestSMAP.smap"; + SmapGenerator smapGenerator = new SmapGenerator(); + + SmapStratum smapStratum = new SmapStratum(testStratumName); + smapStratum.addFile(testStratumSourceName, testStratumSourcePath); + + // single output line is mapped to the multiple input lines + // 1001 -> 32 + // 1002 -> 32 + // 1003 -> 32 + // 1004 -> 32 + smapStratum.addLineData(1001, testStratumSourceName, 1, INIT_LINE, 1); + smapStratum.addLineData(1002, testStratumSourceName, 1, INIT_LINE, 1); + smapStratum.addLineData(1003, testStratumSourceName, 1, INIT_LINE, 1); + smapStratum.addLineData(1004, testStratumSourceName, 1, INIT_LINE, 1); + + // multiple output lines are mapped to the single input line + // 1005 -> 10 + // 1005 -> 11 + // 1005 -> 12 + // 1005 -> 13 + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 1, 1); + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 2, 1); + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 3, 1); + smapStratum.addLineData(1005, testStratumSourceName, 1, INIT_LINE + 4, 1); + + // single output line is mapped to the single input line + // 1006 -> 14 + // 1007 -> 15 + // 1008 -> 16 + smapStratum.addLineData(1006, testStratumSourceName, 1, INIT_LINE + 5, 1); + smapStratum.addLineData(1007, testStratumSourceName, 1, INIT_LINE + 6, 1); + smapStratum.addLineData(1008, testStratumSourceName, 1, INIT_LINE + 7, 1); + + smapGenerator.addStratum(smapStratum, false); + + savePathcedClassFile(className, smapGenerator, smapFileName); + } + + public void doTest() { + String className = TestClass1.class.getName(); + + preparePatchedClassFile(className); + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + List expectedLocations = new ArrayList(); + + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1001, INIT_LINE)); + log.display("Check case when single output line is mapped to the multiple input lines"); + // single output line is mapped to the multiple input lines + // 1001 -> 32 + // 1002 -> 32 + // 1003 -> 32 + // 1004 -> 32 + try { + // locationsOfLine.(testStratum, testStratumSource, 1001) should + // return single java location + compareLocations( + referenceType.locationsOfLine(testStratumName, testStratumSourceName, 1001), + expectedLocations, + testStratumName); + + // locationsOfLine.(testStratum, testStratumSource, [1002, 1003, + // 1004]) should return empty list + expectedLocations.clear(); + for (int i = 1002; i <= 1004; i++) + compareLocations( + referenceType.locationsOfLine(testStratumName, testStratumSourceName, i), + expectedLocations, + testStratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 1)); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 2)); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 3)); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1005, INIT_LINE + 4)); + + log.display("Check case when multiple output lines are mapped to the single input line"); + // multiple output lines are mapped to the single input line + // 1005 -> 33 + // 1005 -> 34 + // 1005 -> 35 + // 1005 -> 36 + try { + // locationsOfLine.(testStratum, testStratumSource, 1005) should + // return 4 java locations + compareLocations( + referenceType.locationsOfLine(testStratumName, testStratumSourceName, 1005), + expectedLocations, + testStratumName); + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + log.display("Check case when single output line is mapped to the single input line"); + // single output line is mapped to the single input line + // 1006 -> 37 + // 1007 -> 38 + // 1008 -> 39 + try { + for (int i = 0; i < 3; i++) { + // locationsOfLine.(testStratum, testStratumSource, line) should + // return 1 java locations + expectedLocations.clear(); + expectedLocations.add(new DebugLocation(testStratumSourceName, testStratumSourcePath, + "", 1006 + i, INIT_LINE + 5 + i)); + compareLocations( + referenceType.locationsOfLine(testStratumName, testStratumSourceName, 1006 + i), + expectedLocations, + testStratumName); + } + } catch (AbsentInformationException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004/locationsOfLine_ssi004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004/locationsOfLine_ssi004.java new file mode 100644 index 00000000000..b684cdac6f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004/locationsOfLine_ssi004.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2007, 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/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.ReferenceType.locationsOfLine(String stratum, String sourceName, int lineNumber)' returns + * correct values for all stratums available for class and if sourceName == null locaitions for all sources are returned. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined (each method has locations in 3 different sources): + * "Java" "TestStratum" + * + * 9 --> 1000, source1, path1 + * 10 --> 1000, source2, path2 + * 11 --> 1000, source3, path3 + * ... ... + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1100, source2, path2 + * 22 --> 1100, source3, path3 + * ... ... + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1200, source2, path2 + * 33 --> 1200, source3, path3 + * ... ... + * Then debugger forces debuggee to load 'TestClass1' from updated class file, obtains ReferenceType for this class + * and checks up that method 'com.sun.jdi.ReferenceType.locationsOfLine(String stratum, String sourceName, int lineNumber)' + * for all test stratums('TestStratum1'-'TestStratum3') returns only expected locations depending on given line number and source name, + * and if source name is null locations for all sources are returned. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsOfLine_ssi004.locationsOfLine_ssi004 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsOfLine_ssi004.locationsOfLine_ssi004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsOfLine_ssi004; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class locationsOfLine_ssi004 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new locationsOfLine_ssi004().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type5(className, testStratumCount); + /* + * Method 'prepareDefaultPatchedClassFile_Type5' creates class file with + * following line mapping for each TestStratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1, path1 + * 10 --> 1000, source2, path2 + * 11 --> 1000, source3, path3 + * ... + * ... + * + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1100, source2, path2 + * 22 --> 1100, source3, path3 + * ... + * ... + * + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1200, source2, path2 + * 33 --> 1200, source3, path3 ... ... + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + check_ReferenceType_locationsOfLine( + referenceType, + stratumName, + false, + testStratumData.get(stratumName).allLocations); + check_ReferenceType_locationsOfLine( + referenceType, + stratumName, + true, + testStratumData.get(stratumName).allLocations); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java new file mode 100644 index 00000000000..849b6d50777 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java @@ -0,0 +1,265 @@ +/* + * 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.ReferenceType.locationsOfLine_ssi; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.locationsOfLine(String,String,int)
    + * complies with its specification.
    + *
    + * The test checks up that for each line in the List returned
    + * by the method ReferenceType.allLineLocations(),
    + * the method locationsOfLine(defaultStratum,null,lineNumber)
    + * returns non-empty List object
    + * in which each object is a Location object.
    + * Not throwing AbsentInformationException is checked up as well.
    + */ + +public class locationsofline_ssi001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new locationsofline_ssi001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001a"; + + String mName = "nsk.jdi.ReferenceType.locationsOfLine_ssi"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List locations = null; + ReferenceType refType = null; + + + log2(" getting: List classes = vm.classesByName(mName + '.TestClass');"); + List classes = vm.classesByName(mName + ".TestClass"); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + log2(" getting a tested ReferenceType object 'refType'"); + refType = (ReferenceType) classes.get(0); + + log2("......locations = refType.allLineLocations(); no AbsentInformationException is expected"); + try { + locations = refType.allLineLocations(); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break ; + } + + log2("......checking up on a value of locations.size(); 0 is not expected"); + int size = locations.size(); + if (size == 0) { + testExitCode = FAILED; + log3("ERROR: locations.size() == 0"); + break ; + } + + ListIterator li1 = locations.listIterator(); + + log2("......the loop of checking locations in the returned list;"); + log2(" AbsentInformationException is not expected"); + + label1: + for (int ifor1 = 0; ifor1 < size; ifor1++) { + + int lineNumber = ((Location) li1.next()).lineNumber(); + + try { + log2("......List lineLocations = refType.locationsOfLine(defaultStratum, null, " + lineNumber + ");"); + List lineLocations = refType.locationsOfLine(defaultStratum, null, lineNumber); + int size1 = lineLocations.size(); + if (size1 == 0) { + testExitCode = FAILED; + log3("ERROR: lineLocations.size() == 0"); + break label1; + } + ListIterator li2 = lineLocations.listIterator(); + try { + for (; li2.hasNext(); ) { + Location loc = (Location) li2.next(); + } + } catch ( ClassCastException e) { + testExitCode = FAILED; + log3("ERROR: ClassCastException, that is, element is not Location"); + break label1; + } + } catch ( AbsentInformationException e2 ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + log3(" ATTENTION: see the README file to this test"); + break label1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001/TestDescription.java new file mode 100644 index 00000000000..e3a62d9f6dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001/TestDescription.java @@ -0,0 +1,101 @@ +/* + * 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/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.locationsOfLine(String,String,int) + * complies with its spec: + * public List locationsOfLine(String stratum, String sourceName, int lineNumber) + * throws AbsentInformationException + * Returns a List containing all Location objects that + * map to the given line number. + * For arrays (ArrayType) and primitive classes, + * the returned list is always empty. + * For interfaces (InterfaceType), the returned list will be non-empty only + * if the interface has executable code in its class initialization + * at the specified line number. An empty list will be returned + * if there is no executable code at the specified line number. + * Returned list is for the specified stratum + * (see Location for a description of strata). + * Parameters: stratum - the stratum to use for comparing line number and + * source name, or null to use the defaultStratum(). + * sourceName - the source name containing the line number, or + * null to match all source names + * lineNumber - the line number + * Returns: a List of all Location objects that map to the given line. + * Throws: AbsentInformationException - + * if there is no line number information for this class. + * Or if sourceName is non-null and source name information is not present. + * ClassNotPreparedException - + * if this class not yet been prepared. + * The test checks up that for each line in the List returned + * by the method ReferenceType.allLineLocations(), + * the method locationsOfLine(defaultStratum,null,lineNumber) + * returns non-empty List object in which each object is a Location object. + * Not throwing AbsentInformationException is checked up as well. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001; + * the debuggee program - nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001 + * nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001a + * + * @comment make sure locationsofline_ssi001a is compiled with full debug info + * @clean nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001a + * @compile -g:lines,source,vars ../locationsofline_ssi001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001a.java new file mode 100644 index 00000000000..a054dcf3da7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001a.java @@ -0,0 +1,136 @@ +/* + * 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.ReferenceType.locationsOfLine_ssi; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the locationsofline_ssi001 JDI test. + */ + +public class locationsofline_ssi001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType.locationsOfLine(String,String,int) + * properly returns an empty list for arrays (ArrayType), primitive + * classes, and for interfaces (InterfaceType) if the interface has + * no executable code in its class initialization at the specified line + * number.

    + * + * Debugger part of it attempts to get locations that map to the debuggee + * field values/type declaration, which themselves are:
    + * primitive classes, arrays of primitive types and classes, and finally, + * an interface type. + */ +public class locationsofline_ssi002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.locationsOfLine_ssi.locationsofline_ssi002t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 25; + // tested fields and used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr", + "dummyIf" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new locationsofline_ssi002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "locationsofline_ssi002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; imethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methods001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methods001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methods001aClassForCheck"; + private final static String not_found_sign = "NOT FOUND"; + private final static String passed_sign = "PASSED"; + private static String methods_for_check[][] = { + +// method name declaring class check result + + {"", class_for_check, not_found_sign}, + {"ClassForCheck", class_for_check, not_found_sign}, + {"s_void_method", class_for_check, not_found_sign}, + {"s_boolean_method", class_for_check, not_found_sign}, + {"s_byte_method", class_for_check, not_found_sign}, + {"s_char_method", class_for_check, not_found_sign}, + {"s_double_method", class_for_check, not_found_sign}, + {"s_float_method", class_for_check, not_found_sign}, + {"s_int_method", class_for_check, not_found_sign}, + {"s_long_method", class_for_check, not_found_sign}, + {"s_string_method", class_for_check, not_found_sign}, + {"s_object_method", class_for_check, not_found_sign}, + {"s_prim_array_method", class_for_check, not_found_sign}, + {"s_ref_array_method", class_for_check, not_found_sign}, + {"s_super_hidden_void_method", class_for_check, not_found_sign}, + {"s_super_hidden_prim_method", class_for_check, not_found_sign}, + {"s_super_hidden_ref_method", class_for_check, not_found_sign}, + {"s_void_par_method", class_for_check, not_found_sign}, + {"s_boolean_par_method", class_for_check, not_found_sign}, + {"s_byte_par_method", class_for_check, not_found_sign}, + {"s_char_par_method", class_for_check, not_found_sign}, + {"s_double_par_method", class_for_check, not_found_sign}, + {"s_float_par_method", class_for_check, not_found_sign}, + {"s_int_par_method", class_for_check, not_found_sign}, + {"s_long_par_method", class_for_check, not_found_sign}, + {"s_string_par_method", class_for_check, not_found_sign}, + {"s_object_par_method", class_for_check, not_found_sign}, + {"s_prim_array_par_method", class_for_check, not_found_sign}, + {"s_ref_array_par_method", class_for_check, not_found_sign}, + {"s_super_hidden_void_par_method", class_for_check, not_found_sign}, + {"s_super_hidden_prim_par_method", class_for_check, not_found_sign}, + {"s_super_hidden_ref_par_method", class_for_check, not_found_sign}, + {"s_native_method", class_for_check, not_found_sign}, + {"s_synchr_method", class_for_check, not_found_sign}, + {"s_final_method", class_for_check, not_found_sign}, + {"s_private_method", class_for_check, not_found_sign}, + {"s_protected_method", class_for_check, not_found_sign}, + {"s_public_method", class_for_check, not_found_sign}, + {"i_void_method", class_for_check, not_found_sign}, + {"i_boolean_method", class_for_check, not_found_sign}, + {"i_byte_method", class_for_check, not_found_sign}, + {"i_char_method", class_for_check, not_found_sign}, + {"i_double_method", class_for_check, not_found_sign}, + {"i_float_method", class_for_check, not_found_sign}, + {"i_int_method", class_for_check, not_found_sign}, + {"i_long_method", class_for_check, not_found_sign}, + {"i_string_method", class_for_check, not_found_sign}, + {"i_object_method", class_for_check, not_found_sign}, + {"i_prim_array_method", class_for_check, not_found_sign}, + {"i_ref_array_method", class_for_check, not_found_sign}, + {"i_super_overridden_void_method", class_for_check, not_found_sign}, + {"i_super_overridden_prim_method", class_for_check, not_found_sign}, + {"i_super_overridden_ref_method", class_for_check, not_found_sign}, + {"i_interf_overridden_void_method", class_for_check, not_found_sign}, + {"i_interf_overridden_prim_method", class_for_check, not_found_sign}, + {"i_interf_overridden_ref_method", class_for_check, not_found_sign}, + {"i_void_par_method", class_for_check, not_found_sign}, + {"i_boolean_par_method", class_for_check, not_found_sign}, + {"i_byte_par_method", class_for_check, not_found_sign}, + {"i_char_par_method", class_for_check, not_found_sign}, + {"i_double_par_method", class_for_check, not_found_sign}, + {"i_float_par_method", class_for_check, not_found_sign}, + {"i_int_par_method", class_for_check, not_found_sign}, + {"i_long_par_method", class_for_check, not_found_sign}, + {"i_string_par_method", class_for_check, not_found_sign}, + {"i_object_par_method", class_for_check, not_found_sign}, + {"i_prim_array_par_method", class_for_check, not_found_sign}, + {"i_ref_array_par_method", class_for_check, not_found_sign}, + {"i_super_overridden_void_par_method", class_for_check, not_found_sign}, + {"i_super_overridden_prim_par_method", class_for_check, not_found_sign}, + {"i_super_overridden_ref_par_method", class_for_check, not_found_sign}, + {"i_interf_overridden_void_par_method", class_for_check, not_found_sign}, + {"i_interf_overridden_prim_par_method", class_for_check, not_found_sign}, + {"i_interf_overridden_ref_par_method", class_for_check, not_found_sign}, + {"i_abstract_method", class_for_check, not_found_sign}, + {"i_native_method", class_for_check, not_found_sign}, + {"i_synchr_method", class_for_check, not_found_sign}, + {"i_final_method", class_for_check, not_found_sign}, + {"i_private_method", class_for_check, not_found_sign}, + {"i_protected_method", class_for_check, not_found_sign}, + {"i_public_method", class_for_check, not_found_sign}, + {"", class_for_check, not_found_sign} + + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new methods001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/methods/methods001 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/methods/methods001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/methods/methods001 test LOG:"); + print_log_anyway("==> test checks methods() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methods001: methods001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> methods001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> methods001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methods001: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> methods001: check ReferenceType.methods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean methods_exception_thrown = false; + int methods_for_check_number = methods_for_check.length; + int not_found_methods_number = 0; + int found_methods_number = 0; + int unexpected_found_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + print_log_anyway("##> methods001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List found_methods_list = null; + try { + found_methods_list = refType.methods(); + } + catch (Throwable thrown) { + print_log_anyway("##> methods001: FAILED: ReferenceType.methods() throws unexpected " + + thrown); + methods_exception_thrown = true; + break; + } + found_methods_number = found_methods_list.size(); + Method found_methods[] = new Method[found_methods_number]; + String unexpected_found_methods[] = new String[found_methods_number]; + found_methods_list.toArray(found_methods); + for (int i=0; i methods001: FAILED: method is NOT found: " + current_method_for_check); + not_found_methods_number++; + } + else { + print_log_on_verbose + ("--> methods001: PASSED for method: " + current_method_for_check); + } + } + for (int i=0; i methods001: FAILED: unexpected found method: " + unexpected_found_methods[i]); + } + break; + } + + print_log_anyway("--> methods001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methods_exception_thrown ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_anyway("--> methods001: expected found methods number = " + methods_for_check_number); + print_log_anyway("--> methods001: in fact found methods number = " + + found_methods_number); + print_log_anyway("--> methods001: expected and in fact found methods number = " + + (methods_for_check_number - not_found_methods_number)); + print_log_anyway + ("##> methods001: NOT found methods number = " + not_found_methods_number); + print_log_anyway + ("##> methods001: UNEXPECTED found methods number = " + unexpected_found_methods_number); + } + if ( not_found_methods_number + unexpected_found_methods_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methods001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methods001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methods001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods001/TestDescription.java new file mode 100644 index 00000000000..c9772fbbb0f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/methods/methods001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methods/methods001 test + * checks the methods() method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.methods() method is checked for methods of + * debugee's class which extends super class and implements interface. + * The test expects that only declared directly in the checked class + * methods should be included in Method list returned by the methods() method. + * Each method is checked for method name and declaring class name. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methods.methods001 + * nsk.jdi.ReferenceType.methods.methods001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methods.methods001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods001a.java new file mode 100644 index 00000000000..1055d9f0607 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods001a.java @@ -0,0 +1,249 @@ +/* + * 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.ReferenceType.methods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methods001 JDI test. + */ + +public class methods001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.methods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methods001aClassForCheck"; + + + 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 methods001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, methods001a.class.getClassLoader()); + print_log_on_verbose + ("--> methods001a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> methods001a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> methods001a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methods001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methods001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methods001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methods001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methods001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +abstract class methods001aClassForCheck extends methods001aSuperClassForCheck + implements methods001aInterfaceForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods without params + static void s_void_method() {} + static boolean s_boolean_method() {return true;} + static byte s_byte_method() {return (byte)1;} + static char s_char_method() {return (char)1;} + static double s_double_method() {return (double)100.99;} + static float s_float_method() {return (float)100.88;} + static int s_int_method() {return 100;} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + // static methods with params + static void s_void_par_method(boolean z) {} + static boolean s_boolean_par_method(boolean z) {return true;} + static byte s_byte_par_method(byte b) {return (byte)1;} + static char s_char_par_method(char ch) {return (char)1;} + static double s_double_par_method(double d) {return (double)100.99;} + static float s_float_par_method(float f) {return (float)100.88;} + static int s_int_par_method(int i) {return 100;} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + // other static methods + native static Object s_native_method(Object obj); + static synchronized Object s_synchr_method(Object obj) {return new Object();} + final static Object s_final_method(Object obj) {return new Object();} + private static Object s_private_method(Object obj) {return new Object();} + protected static Object s_protected_method(Object obj) {return new Object();} + public static Object s_public_method(Object obj) {return new Object();} + + // instance methods without params + void i_void_method() {} + boolean i_boolean_method() {return true;} + byte i_byte_method() {return (byte)1;} + char i_char_method() {return (char)1;} + double i_double_method() {return (double)100.99;} + float i_float_method() {return (float)100.88;} + int i_int_method() {return 100;} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + public void i_interf_overridden_void_method() {} + public int i_interf_overridden_prim_method() {return 100;} + public Object i_interf_overridden_ref_method() {return new Object();} + + // instance methods with params + void i_void_par_method(boolean z) {} + boolean i_boolean_par_method(boolean z) {return true;} + byte i_byte_par_method(byte b) {return (byte)1;} + char i_char_par_method(char ch) {return (char)1;} + double i_double_par_method(double d) {return (double)100.99;} + float i_float_par_method(float f) {return (float)100.88;} + int i_int_par_method(int i) {return 100;} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public void i_interf_overridden_void_par_method(int i) {} + public int i_interf_overridden_prim_par_method(int i) {return 100;} + public Object i_interf_overridden_ref_par_method(Object obj) {return new Object();} + + // other instance methods + abstract Object i_abstract_method(Object obj); + native Object i_native_method(Object obj); + synchronized Object i_synchr_method(Object obj) {return new Object();} + final Object i_final_method(Object obj) {return new Object();} + private Object i_private_method(Object obj) {return new Object();} + protected Object i_protected_method(Object obj) {return new Object();} + public Object i_public_method(Object obj) {return new Object();} + + // static initializer + static {} + + +} + +abstract class methods001aSuperClassForCheck { + + static void s_super_void_method(long l) {} + static long s_super_prim_method(long l) {return 100;} + static Object s_super_ref_method(Object obj) {return new Object();} + + void i_super_void_method(long l) {} + long i_super_prim_method(long l) {return 100;} + Object i_super_ref_method(Object obj) {return new Object();} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public Object i_multiple_inherited_method(Object obj) {return new Object();} + +} + +interface methods001aInterfaceForCheck { + + void i_interf_void_method(long l); + long i_interf_prim_method(long l); + Object i_interf_ref_method(Object obj); + + void i_interf_overridden_void_method(); + int i_interf_overridden_prim_method(); + Object i_interf_overridden_ref_method(); + + void i_interf_overridden_void_par_method(int i); + int i_interf_overridden_prim_par_method(int i); + Object i_interf_overridden_ref_par_method(Object obj); + + public Object i_multiple_inherited_method(Object obj); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002.java new file mode 100644 index 00000000000..b8bf39e1842 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002.java @@ -0,0 +1,216 @@ +/* + * 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.ReferenceType.methods; + +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 methods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methods002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methods002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methods002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "methods002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new methods002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/methods/methods002 test FAILED"); + } + else { + print_log_on_verbose("\n==> nsk/jdi/ReferenceType/methods/methods002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + test_log_handler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, test_log_handler); + + print_log_on_verbose("==> nsk/jdi/ReferenceType/methods/methods002 test LOG:"); + print_log_on_verbose("==> test checks methods() method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + debugee_launch_command = debugeeName + " -vbs"; + } + + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + + debugee.redirectStderr(out); + print_log_on_verbose("--> methods002: methods002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> methods002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> methods002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methods002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> methods002: check ReferenceType.methods() method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean methods_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> methods002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> methods002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List methods_list = null; + try { + methods_list = refType.methods(); + print_log_anyway + ("##> methods002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + methods_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> methods002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> methods002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + methods_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methods002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methods002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methods002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002/TestDescription.java new file mode 100644 index 00000000000..cb1c5027693 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/methods/methods002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methods/methods002 test + * checks the methods() method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.methods() method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements ""print_log_anyway"" are replaced with + * "print_log_on_verbose". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methods.methods002 + * nsk.jdi.ReferenceType.methods.methods002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methods.methods002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002/loadclass/methods002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002/loadclass/methods002aClassForCheck.java new file mode 100644 index 00000000000..99934901d2e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002/loadclass/methods002aClassForCheck.java @@ -0,0 +1,68 @@ +/* + * 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.ReferenceType.methods; + +/** + * This class is loaded by methods002aClassLoader . + */ +class methods002aClassForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods + static void s_void_method() {} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_void_par_method(boolean z) {} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + + // instance methods + void i_void_method() {} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_void_par_method(boolean z) {} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + // static initializer + static {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002a.java new file mode 100644 index 00000000000..8ac4f767fe1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods002a.java @@ -0,0 +1,140 @@ +/* + * 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.ReferenceType.methods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + +/** + * This class is used as debugee application for the methods002 JDI test. + */ + +public class methods002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.methods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methods002aClassForCheck"; + + 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 methods002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + methods002aClassLoader customClassLoader = new methods002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> methods002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> methods002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> methods002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methods002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methods002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methods002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methods002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class methods002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public methods002aClassLoader(String classPath, String className) { + super(methods002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003.java new file mode 100644 index 00000000000..e878fae9e39 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.methods; + +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 methods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methods003 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methods.", + thisClassName = package_prefix + "methods003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "methods003b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new methods003().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/methods/methods003 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/methods/methods003 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/methods/methods003 test LOG:"); + print_log_anyway("--> test checks methods() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methods003: methods003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> methods003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> methods003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methods003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> methods003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> methods003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methods003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean methods_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> methods003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> methods003: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> methods003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> methods003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> methods003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> methods003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> methods003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.methods() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> methods003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methods003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> methods003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> methods003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> methods003: check that checked class has been unloaded realy..."); + print_log_anyway + ("--> methods003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.methods() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> methods003: check ReferenceType.methods() method for unloaded class..."); + List methods_list = null; + try { + methods_list = refType.methods(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> methods003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> methods003: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + methods_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methods003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methods003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methods003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of methods003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/TestDescription.java new file mode 100644 index 00000000000..64efccc93a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/TestDescription.java @@ -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/ReferenceType/methods/methods003. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methods/methods003 test + * checks the methods() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * methods() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - methods003b class was moved in 'loadclass' subdirectory; + * - package name was added in methods003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for methods003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methods.methods003 + * nsk.jdi.ReferenceType.methods.methods003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methods.methods003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/loadclass/methods003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/loadclass/methods003b.java new file mode 100644 index 00000000000..fb3220723b0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003/loadclass/methods003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the methods() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.methods; + +class methods003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003a.java new file mode 100644 index 00000000000..0e8c2e3399c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods003a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.methods; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methods003 JDI test. + */ + +public class methods003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.methods."; + private final static String checked_class_name = package_prefix + "methods003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> methods003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> methods003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> methods003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> methods003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> methods003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methods003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methods003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methods003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> methods003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> methods003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> methods003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> methods003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> methods003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> methods003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> methods003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methods003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methods003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methods003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methods003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of methods003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004.java new file mode 100644 index 00000000000..952c5e1515a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004.java @@ -0,0 +1,203 @@ +/* + * 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.ReferenceType.methods; + +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 methods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methods004 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methods004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methods004aInterfaceForCheck"; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new methods004().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/methods/methods004 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/methods/methods004 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/methods/methods004 test LOG:"); + print_log_anyway("==> test checks methods() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for class without any methods\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methods004: methods004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> methods004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> methods004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methods004: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> methods004: check ReferenceType.methods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean methods_method_error = false; + int returned_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + print_log_anyway("##> methods004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List methods_list = null; + try { + methods_list = refType.methods(); + } + catch (Throwable thrown) { + print_log_anyway("##> methods004: FAILED: ReferenceType.methods() throws unexpected " + + thrown); + methods_method_error = true; + break; + } + returned_methods_number = methods_list.size(); + if ( returned_methods_number == 0 ) { + break; + } + Method returned_methods[] = new Method[returned_methods_number]; + methods_list.toArray(returned_methods); + for (int i=0; i methods004: FAILED: unexpected found method: " + returned_method_info); + } + break; + } + + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + if ( returned_methods_number > 0 ) { + print_log_anyway + ("##> methods004: UNEXPECTED all methods number = " + returned_methods_number); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_anyway + ("--> methods004: PASSED: returned list of methods is empty!"); + } + + print_log_on_verbose("--> methods004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methods004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methods004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004/TestDescription.java new file mode 100644 index 00000000000..604af2f7ce3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/methods/methods004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methods/methods004 test + * checks the methods() method of ReferenceType interface + * of the com.sun.jdi package for class without any methods: + * the ReferenceType.methods() method is checked for + * debugee's interface which does not contain any methods + * but extends a super interface with declared methods. + * The test expects the returned list of methods to be empty. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methods.methods004 + * nsk.jdi.ReferenceType.methods.methods004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methods.methods004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004a.java new file mode 100644 index 00000000000..41c1dec7e5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods004a.java @@ -0,0 +1,90 @@ +/* + * 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.ReferenceType.methods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methods004 JDI test. + */ + +public class methods004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 methods004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + methods004aClassForCheck class_for_check = new methods004aClassForCheck(); + + print_log_on_verbose("**> methods004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methods004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methods004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> methods004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> methods004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class methods004aClassForCheck implements methods004aInterfaceForCheck { + + public void i_interf_void_method(long l) {} + public long i_interf_prim_method(long l) {return l;} + public Object i_interf_ref_method(Object obj) {return obj;} +} + +interface methods004aInterfaceForCheck extends methods004aSuperInterfaceForCheck{ +} + +interface methods004aSuperInterfaceForCheck { + void i_interf_void_method(long l); + long i_interf_prim_method(long l); + Object i_interf_ref_method(Object obj); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods005.java new file mode 100644 index 00000000000..9e048f477f8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods005.java @@ -0,0 +1,286 @@ +/* + * 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.ReferenceType.methods; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.methods() + * properly returns an empty list for arrays (ArrayType) and primitive + * classes.

    + * + * Debugger part of it attempts to get a list of methods in several + * reference types corresponding to debuggee field values, which are:
    + * primitive classes themselves, and arrays of primitive types and classes. + */ +public class methods005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.methods.methods005t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested fields used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new methods005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "methods005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i", null }, + {"values", null }, + {"valueOf", null }, + {"foo", null} }; + + //------------------------------------------------------- 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 < 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(); + + // check there are enum methods + List l = checkedClass.methods(); + if (l.isEmpty()) { + complain("\t ReferenceType.methods() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + for (int i = 0; i < expectedEnumMethods.length; i++) { + Iterator it = l.iterator(); + while (it.hasNext()) { + Method checkedMethod = it.next(); + if (expectedEnumMethods[i][0].equals(checkedMethod.name()) ) + + expectedEnumMethods[i][1] = "found"; + } + } + + for (int i = 0; i < expectedEnumMethods.length; i++) { + if (expectedEnumMethods[i][1] != null) { + display("enum " + className + " has Method " + expectedEnumMethods[i][0]); + } else { + complain("enum " + className + " does not have Method " + expectedEnumMethods[i][0]); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods006/TestDescription.java new file mode 100644 index 00000000000..7a8b5932e64 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods006/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/methods/methods006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for methods() method of ReferenceType interface. + * The test checks if the method returns methods declared in + * mirrored enum type, methods automatically generated + * by javac for enums, i.e. values, valueOf and default + * constructor. + * The test consists of a debugger program (methods006.java) + * and debuggee application (methods006a.java). + * Package name is nsk.jdi.ReferenceType.methods . + * 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 methods() method for each field + * of enum type declared in methods006a class. The result list + * list must contain all expected methods. + * 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.ReferenceType.methods.methods006 + * nsk.jdi.ReferenceType.methods.methods006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methods.methods006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods006a.java new file mode 100644 index 00000000000..365e2306dea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methods/methods006a.java @@ -0,0 +1,121 @@ +/* + * 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.ReferenceType.methods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class methods006a { + + //------------------------------------------------------- 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 methods006Enum1 f1 = methods006Enum1.e2; + static methods006Enum2 f2 = methods006Enum2.e1; + static methods006Enum1.Enum1_ f3 = methods006Enum1.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(methods006.SIGNAL_READY); + receiveSignal(methods006.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum methods006Enum1 implements methods006i1, methods006i2 { + e1, e2; + public int foo() {return 1;} + + enum Enum1_ implements methods006i1, methods006i2 { + e1, e2; + public int foo() {return 3;} + } +} + +enum methods006Enum2 implements methods006i1, methods006i2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + + abstract int val(); + public int foo() {return 2;} +} + +interface methods006i1 { + public final int i1 = 1; + public abstract int foo(); +} + +interface methods006i2 { + public final int i1 = 1; + public abstract int foo(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001.java new file mode 100644 index 00000000000..1b17c1e1919 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001.java @@ -0,0 +1,420 @@ +/* + * 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.ReferenceType.methodsByName_s; + +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 methodsByName(String name) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_s001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methbyname_s001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methbyname_s001aClassForCheck"; + private final static String super_class_for_check = package_prefix + "methbyname_s001aSuperClassForCheck"; + private final static String interface_for_check = package_prefix + "methbyname_s001aInterfaceForCheck"; + private final static String not_existing_class = "not_existing_class"; + private static String methods_for_check[][] = { + +// method name declaring class + + {"", class_for_check }, + {"ClassForCheck", class_for_check }, + {"s_void_method", class_for_check }, + {"s_boolean_method", class_for_check }, + {"s_byte_method", class_for_check }, + {"s_char_method", class_for_check }, + {"s_double_method", class_for_check }, + {"s_float_method", class_for_check }, + {"s_int_method", class_for_check }, + {"s_long_method", class_for_check }, + {"s_string_method", class_for_check }, + {"s_object_method", class_for_check }, + {"s_prim_array_method", class_for_check }, + {"s_ref_array_method", class_for_check }, + {"s_super_hidden_void_method", class_for_check }, + {"s_super_hidden_prim_method", class_for_check }, + {"s_super_hidden_ref_method", class_for_check }, + {"s_void_par_method", class_for_check }, + {"s_boolean_par_method", class_for_check }, + {"s_byte_par_method", class_for_check }, + {"s_char_par_method", class_for_check }, + {"s_double_par_method", class_for_check }, + {"s_float_par_method", class_for_check }, + {"s_int_par_method", class_for_check }, + {"s_long_par_method", class_for_check }, + {"s_string_par_method", class_for_check }, + {"s_object_par_method", class_for_check }, + {"s_prim_array_par_method", class_for_check }, + {"s_ref_array_par_method", class_for_check }, + {"s_super_hidden_void_par_method", class_for_check }, + {"s_super_hidden_prim_par_method", class_for_check }, + {"s_super_hidden_ref_par_method", class_for_check }, + {"s_native_method", class_for_check }, + {"s_synchr_method", class_for_check }, + {"s_final_method", class_for_check }, + {"s_private_method", class_for_check }, + {"s_protected_method", class_for_check }, + {"s_public_method", class_for_check }, + {"i_void_method", class_for_check }, + {"i_boolean_method", class_for_check }, + {"i_byte_method", class_for_check }, + {"i_char_method", class_for_check }, + {"i_double_method", class_for_check }, + {"i_float_method", class_for_check }, + {"i_int_method", class_for_check }, + {"i_long_method", class_for_check }, + {"i_string_method", class_for_check }, + {"i_object_method", class_for_check }, + {"i_prim_array_method", class_for_check }, + {"i_ref_array_method", class_for_check }, + {"i_super_overridden_void_method", class_for_check }, + {"i_super_overridden_prim_method", class_for_check }, + {"i_super_overridden_ref_method", class_for_check }, + {"i_interf_overridden_void_method", class_for_check }, + {"i_interf_overridden_prim_method", class_for_check }, + {"i_interf_overridden_ref_method", class_for_check }, + {"i_void_par_method", class_for_check }, + {"i_boolean_par_method", class_for_check }, + {"i_byte_par_method", class_for_check }, + {"i_char_par_method", class_for_check }, + {"i_double_par_method", class_for_check }, + {"i_float_par_method", class_for_check }, + {"i_int_par_method", class_for_check }, + {"i_long_par_method", class_for_check }, + {"i_string_par_method", class_for_check }, + {"i_object_par_method", class_for_check }, + {"i_prim_array_par_method", class_for_check }, + {"i_ref_array_par_method", class_for_check }, + {"i_super_overridden_void_par_method", class_for_check }, + {"i_super_overridden_prim_par_method", class_for_check }, + {"i_super_overridden_ref_par_method", class_for_check }, + {"i_interf_overridden_void_par_method", class_for_check }, + {"i_interf_overridden_prim_par_method", class_for_check }, + {"i_interf_overridden_ref_par_method", class_for_check }, + {"i_abstract_method", class_for_check }, + {"i_native_method", class_for_check }, + {"i_synchr_method", class_for_check }, + {"i_final_method", class_for_check }, + {"i_private_method", class_for_check }, + {"i_protected_method", class_for_check }, + {"i_public_method", class_for_check }, + {"", class_for_check }, + + {"s_super_void_method", super_class_for_check}, + {"s_super_prim_method", super_class_for_check}, + {"s_super_ref_method", super_class_for_check}, + {"i_super_void_method", super_class_for_check}, + {"i_super_prim_method", super_class_for_check}, + {"i_super_ref_method", super_class_for_check}, + {"i_multiple_inherited_method", super_class_for_check}, + + {"i_interf_ref_method", interface_for_check }, + {"i_interf_prim_method", interface_for_check }, + {"i_interf_void_method", interface_for_check }, + + {"non_existing_method", not_existing_class } + + }; + + /** + * Re-call to run(args,out), 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 methbyname_s001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001 test LOG:"); + out_stream.println("==> test checks methodsByName(String name) method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methbyname_s001: methbyname_s001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> methbyname_s001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> methbyname_s001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_s001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> methbyname_s001: check ReferenceType.methodsByName(...) method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + int methods_for_check_number = methods_for_check.length; + int methodsByName_exceptions = 0; + int not_found_methods_number = 0; + int unexpected_found_methods_number = 0; + int not_matched_methods_number = 0; + int all_method_errors_number = 0; + int passed_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> methbyname_s001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + for (int i=0; i methods_byname_list = null; + try { + methods_byname_list = refType.methodsByName(methods_for_check[i][0]); + } + catch (Throwable thrown) { + out_stream.println + ("##> methbyname_s001: FAILED: methodsByName(...) throws unexpected " + + thrown); + out_stream.println + ("##> requested method: " + current_method_for_check); + methodsByName_exceptions++; + all_method_errors_number++; + continue; + } + int methods_byname_number = methods_byname_list.size(); + if ( methods_byname_number == 0 ) { + if ( existing_method ) { + out_stream.println + ("##> methbyname_s001: FAILED: methodsByName(...) returned empty List of methods!"); + out_stream.println + ("##> requested method: " + current_method_for_check); + not_found_methods_number++; + all_method_errors_number++; + } + else { + print_log_on_verbose + ("--> methbyname_s001: PASSED for method: " + current_method_for_check); + print_log_on_verbose + ("--> expected result: empty List of methods"); + passed_methods_number++; + } + continue; + } + Method methods_byname_array[] = new Method[methods_byname_number]; + methods_byname_list.toArray(methods_byname_array); + if ( (! existing_method) || (methods_byname_number > 1) ) { + out_stream.println + ("##> methbyname_s001: FAILED: methodsByName(...) returned unexpected methods - " + + methods_byname_number + " method(s)"); + out_stream.println + ("##> requested method: " + current_method_for_check); + if ( ! existing_method ) { + out_stream.println + ("##> expected result: empty List of methods"); + unexpected_found_methods_number++; + } + else { + out_stream.println + ("##> expected result: List of requested method"); + not_matched_methods_number++; + } + out_stream.println + ("##> returned methods:"); + for (int k=0; k returned method[" + k +"] - " + found_method_info); + } + all_method_errors_number++; + continue; + } + +// The beginning of the patch to fix the test failure. + /* + Method found_method = methods_byname_array[0]; + String found_method_name = found_method.name(); + String declaring_class_name = "declaring class NOT defined"; + try { + declaring_class_name = found_method.declaringType().name(); + } + catch (Throwable thrown) { + } + String found_method_info = found_method_name + " (" + declaring_class_name + ")"; + if ( ! methods_for_check[i][1].equals(declaring_class_name) ) { + out_stream.println + ("##> methbyname_s001: FAILED: methodsByName(...) returned not matched method - " + + found_method_info); + out_stream.println + ("##> requested method: " + current_method_for_check); + not_matched_methods_number++; + all_method_errors_number++; + } + else { + print_log_on_verbose + ("--> methbyname_s001: PASSED for method: " + current_method_for_check); + passed_methods_number++; + } + */ + // the string below replaces the above code fragment + passed_methods_number++; + +// The end of the patch. + + } + break; + } + + out_stream.println("--> methbyname_s001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> methbyname_s001: number of checked methods = " + methods_for_check_number); + if ( methodsByName_exceptions > 0 ) { + out_stream.println + ("--> methbyname_s001: number of unexpected exceptions thrown by methodsByName(...) = " + + methodsByName_exceptions); + } + if ( not_found_methods_number > 0 ) { + out_stream.println + ("--> methbyname_s001: number of methods not found by methodsByName(...) (empty List returned) = " + + not_found_methods_number); + } + if ( unexpected_found_methods_number > 0 ) { + out_stream.println + ("--> methbyname_s001: number of unexpected methods found by methodsByName(...) (not empty List returned) = " + + unexpected_found_methods_number); + } + if ( not_matched_methods_number > 0 ) { + out_stream.println + ("--> methbyname_s001: number of returned by methodsByName(...) methods not matched to requested method = " + + not_matched_methods_number); + } + out_stream.println + ("--> methbyname_s001: number of methods for which methodsByName(...) returned expected result = " + + passed_methods_number); + } + if ( all_method_errors_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_s001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> methbyname_s001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_s001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001/TestDescription.java new file mode 100644 index 00000000000..76860a8d3da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/methodsByName_s/methbyname_s001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001 test + * checks the methodsByName(String name) method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.methodsByName(String name) method is checked for methods of + * debugee's class which extends super class and implements interface. + * Debugee's class has not overloaded methods. + * Each method is checked for method's name. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_s.methbyname_s001 + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001a.java new file mode 100644 index 00000000000..54290e72945 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s001a.java @@ -0,0 +1,249 @@ +/* + * 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.ReferenceType.methodsByName_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methbyname_s001 JDI test. + */ + +public class methbyname_s001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methbyname_s001aClassForCheck"; + + + 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 methbyname_s001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, methbyname_s001a.class.getClassLoader()); + print_log_on_verbose + ("--> methbyname_s001a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> methbyname_s001a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> methbyname_s001a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methbyname_s001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_s001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_s001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_s001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_s001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +abstract class methbyname_s001aClassForCheck extends methbyname_s001aSuperClassForCheck implements methbyname_s001aInterfaceForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods without params + static void s_void_method() {} + static boolean s_boolean_method() {return true;} + static byte s_byte_method() {return (byte)1;} + static char s_char_method() {return (char)1;} + static double s_double_method() {return (double)100.99;} + static float s_float_method() {return (float)100.88;} + static int s_int_method() {return 100;} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + // static methods with params + static void s_void_par_method(boolean z) {} + static boolean s_boolean_par_method(boolean z) {return true;} + static byte s_byte_par_method(byte b) {return (byte)1;} + static char s_char_par_method(char ch) {return (char)1;} + static double s_double_par_method(double d) {return (double)100.99;} + static float s_float_par_method(float f) {return (float)100.88;} + static int s_int_par_method(int i) {return 100;} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + // other static methods + native static Object s_native_method(Object obj); + static synchronized Object s_synchr_method(Object obj) {return new Object();} + final static Object s_final_method(Object obj) {return new Object();} + private static Object s_private_method(Object obj) {return new Object();} + protected static Object s_protected_method(Object obj) {return new Object();} + public static Object s_public_method(Object obj) {return new Object();} + + // instance methods without params + void i_void_method() {} + boolean i_boolean_method() {return true;} + byte i_byte_method() {return (byte)1;} + char i_char_method() {return (char)1;} + double i_double_method() {return (double)100.99;} + float i_float_method() {return (float)100.88;} + int i_int_method() {return 100;} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + public void i_interf_overridden_void_method() {} + public int i_interf_overridden_prim_method() {return 100;} + public Object i_interf_overridden_ref_method() {return new Object();} + + // instance methods with params + void i_void_par_method(boolean z) {} + boolean i_boolean_par_method(boolean z) {return true;} + byte i_byte_par_method(byte b) {return (byte)1;} + char i_char_par_method(char ch) {return (char)1;} + double i_double_par_method(double d) {return (double)100.99;} + float i_float_par_method(float f) {return (float)100.88;} + int i_int_par_method(int i) {return 100;} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public void i_interf_overridden_void_par_method(int i) {} + public int i_interf_overridden_prim_par_method(int i) {return 100;} + public Object i_interf_overridden_ref_par_method(Object obj) {return new Object();} + + // other instance methods + abstract Object i_abstract_method(Object obj); + native Object i_native_method(Object obj); + synchronized Object i_synchr_method(Object obj) {return new Object();} + final Object i_final_method(Object obj) {return new Object();} + private Object i_private_method(Object obj) {return new Object();} + protected Object i_protected_method(Object obj) {return new Object();} + public Object i_public_method(Object obj) {return new Object();} + + + // static initializer + static {} + + +} + +abstract class methbyname_s001aSuperClassForCheck { + + static void s_super_void_method(long l) {} + static long s_super_prim_method(long l) {return 100;} + static Object s_super_ref_method(Object obj) {return new Object();} + + void i_super_void_method(long l) {} + long i_super_prim_method(long l) {return 100;} + Object i_super_ref_method(Object obj) {return new Object();} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public Object i_multiple_inherited_method(Object obj) {return new Object();} + +} + +interface methbyname_s001aInterfaceForCheck { + + void i_interf_void_method(long l); + long i_interf_prim_method(long l); + Object i_interf_ref_method(Object obj); + + void i_interf_overridden_void_method(); + int i_interf_overridden_prim_method(); + Object i_interf_overridden_ref_method(); + + void i_interf_overridden_void_par_method(int i); + int i_interf_overridden_prim_par_method(int i); + Object i_interf_overridden_ref_par_method(Object obj); + + public Object i_multiple_inherited_method(Object obj); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002.java new file mode 100644 index 00000000000..6a2951c8e4e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002.java @@ -0,0 +1,222 @@ +/* + * 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.ReferenceType.methodsByName_s; + +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 methodsByName(String name) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_s002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methbyname_s002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methbyname_s002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "methbyname_s002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** + * Re-call to run(args,out), 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 methbyname_s002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002 test LOG:"); + print_log_on_verbose("==> test checks methodsByName(String name) method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methbyname_s002: methbyname_s002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> methbyname_s002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> methbyname_s002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_s002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> methbyname_s002: check ReferenceType.methodsByName(...) method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean methodsByName_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> methbyname_s002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> methbyname_s002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List methodsByName_methods_list = null; + try { + methodsByName_methods_list = refType.methodsByName("dummy_method_name"); + print_log_anyway + ("##> methbyname_s002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + methodsByName_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> methbyname_s002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> methbyname_s002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + methodsByName_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methodsByName_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_s002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methbyname_s002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_s002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002/TestDescription.java new file mode 100644 index 00000000000..6abe10bc7ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/methodsByName_s/methbyname_s002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002 test + * checks the methodsByName(String name) method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.methodsByName(String name) method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_s.methbyname_s002 + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002/loadclass/methbyname_s002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002/loadclass/methbyname_s002aClassForCheck.java new file mode 100644 index 00000000000..b0796137fd9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002/loadclass/methbyname_s002aClassForCheck.java @@ -0,0 +1,71 @@ +/* + * 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.ReferenceType.methodsByName_s; + +/** + * This class is loaded by methbyname_s002aClassLoader . + */ + +class methbyname_s002aClassForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods + static void s_void_method() {} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_void_par_method(boolean z) {} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + + // instance methods + void i_void_method() {} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_void_par_method(boolean z) {} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + // static initializer + static {} + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002a.java new file mode 100644 index 00000000000..fd2377ccb7d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.methodsByName_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the methbyname_s002 JDI test. + */ + +public class methbyname_s002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methbyname_s002aClassForCheck"; + + 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 methbyname_s002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + methbyname_s002aClassLoader customClassLoader = new methbyname_s002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> methbyname_s002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> methbyname_s002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> methbyname_s002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_s002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_s002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_s002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_s002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class methbyname_s002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public methbyname_s002aClassLoader(String classPath, String className) { + super(methbyname_s002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003.java new file mode 100644 index 00000000000..92aca680933 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003.java @@ -0,0 +1,256 @@ +/* + * 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.ReferenceType.methodsByName_s; + +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 methodsByName(String name) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_s003 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s.", + thisClassName = package_prefix + "methbyname_s003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "methbyname_s003b"; + + + /** + * Re-call to run(args,out), 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 methbyname_s003().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003 test LOG:"); + out_stream.println("--> test checks methodsByName(String name) method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methbyname_s003: methbyname_s003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_s003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_s003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean methodsByName_s_method_error = false; + + while ( true ) { + print_log_on_verbose + ("--> methbyname_s003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> methbyname_s003: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> methbyname_s003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> methbyname_s003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> methbyname_s003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> methbyname_s003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.methodsByName_s() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_s003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> methbyname_s003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> methbyname_s003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> methbyname_s003: check that checked class has been unloaded realy..."); + out_stream.println + ("--> methbyname_s003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.methodsByName_s() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> methbyname_s003: check ReferenceType.methodsByName(...) method for unloaded class..."); + List methods_byname_list = null; + try { + methods_byname_list = refType.methodsByName("dummy_method_name"); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> methbyname_s003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> methbyname_s003: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + methodsByName_s_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methodsByName_s_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_s003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> methbyname_s003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_s003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of methbyname_s003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/TestDescription.java new file mode 100644 index 00000000000..5a3c44f9808 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/TestDescription.java @@ -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/ReferenceType/methodsByName_s/methbyname_s003. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003 test + * checks the methodsByName(String name) method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * methodsByName(String name) method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - methodsByName_s003b class was moved in 'loadclass' subdirectory; + * - package name was added in methodsByName_s003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for methodsByName_s003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_s.methbyname_s003 + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/loadclass/methbyname_s003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/loadclass/methbyname_s003b.java new file mode 100644 index 00000000000..677d4540700 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003/loadclass/methbyname_s003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the methodsByName(String name) method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.methodsByName_s; + +class methbyname_s003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003a.java new file mode 100644 index 00000000000..5ef8e69611e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s003a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.methodsByName_s; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methbyname_s003 JDI test. + */ + +public class methbyname_s003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.methodsByName_s."; + private final static String checked_class_name = package_prefix + "methbyname_s003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> methbyname_s003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> methbyname_s003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> methbyname_s003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> methbyname_s003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> methbyname_s003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methbyname_s003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_s003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_s003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> methbyname_s003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> methbyname_s003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> methbyname_s003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> methbyname_s003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> methbyname_s003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> methbyname_s003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> methbyname_s003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_s003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_s003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_s003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_s003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of methbyname_s003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004.java new file mode 100644 index 00000000000..aeacb65598f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004.java @@ -0,0 +1,399 @@ +/* + * 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.ReferenceType.methodsByName_s; + +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 methodsByName(String name) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_s004 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methbyname_s004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methbyname_s004aClassForCheck"; + private final static String super_class_for_check = package_prefix + "methbyname_s004aSuperClassForCheck"; + private final static String interface_for_check = package_prefix + "methbyname_s004aInterfaceForCheck"; + private static String methods_for_check[][] = { + +// method name returned methods expected number + + {"s_overloaded_method", "4" }, + {"i_overloaded_method", "4" }, + {"i_super_overloaded_method", "2" }, + {"i_interf_overloaded_method", "2" } + + }; + + private static String expected_methods_full_list[][] = { + +// method name declaring class signature + + {"s_overloaded_method", class_for_check, "()V" }, + {"s_overloaded_method", class_for_check, "(Ljava/lang/String;)Ljava/lang/String;" }, + {"s_overloaded_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_overloaded_method", class_for_check, "()V" }, + {"i_overloaded_method", class_for_check, "(Ljava/lang/Object;)J" }, + {"i_overloaded_method", class_for_check, "(Ljava/lang/String;)Ljava/lang/String;" }, + {"i_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_super_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_super_overloaded_method", super_class_for_check, "(J)Ljava/lang/Object;" }, + {"i_interf_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_interf_overloaded_method", interface_for_check, "(J)Ljava/lang/Object;" } + + }; + + /** + * Re-call to run(args,out), 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 methbyname_s004().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004 test LOG:"); + out_stream.println("==> test checks methodsByName(String name) method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for overloaded methods\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methbyname_s004: methbyname_s004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> methbyname_s004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> methbyname_s004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_s004: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> methbyname_s004: check ReferenceType.methodsByName(String name) method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + int methods_for_check_number = methods_for_check.length; + int methodsByName_exceptions = 0; + int not_found_methods_number = 0; + int not_matched_methods_number = 0; + int all_method_errors_number = 0; + int passed_methods_number = 0; + + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> methbyname_s004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + for (int i=0; i methods_byname_list = null; + try { + methods_byname_list = refType.methodsByName(methods_for_check[i][0]); + } + catch (Throwable thrown) { + out_stream.println + ("##> methbyname_s004: FAILED: methodsByName(...) throws unexpected " + + thrown); + out_stream.println + ("##> requested method: " + methods_for_check[i][0]); + methodsByName_exceptions++; + all_method_errors_number++; + continue; + } + int methods_byname_number = methods_byname_list.size(); + if ( methods_byname_number == 0 ) { + out_stream.println + ("##> methbyname_s004: FAILED: methodsByName(...) returned empty List of methods!"); + out_stream.println + ("##> requested method: " + methods_for_check[i][0]); + out_stream.println + ("##> expected number of returned methods = " + expected_methods_number); + not_found_methods_number++; + all_method_errors_number++; + continue; + } + Method methods_byname_array[] = new Method[methods_byname_number]; + methods_byname_list.toArray(methods_byname_array); + if ( methods_byname_number != expected_methods_number ) { + out_stream.println + ("##> methbyname_s004: FAILED: methodsByName(...) returned unexpected methods number = " + + methods_byname_number); + out_stream.println + ("##> requested method: " + methods_for_check[i][0]); + out_stream.println + ("##> expected number of returned methods = " + expected_methods_number); + out_stream.println + ("##> expected methods:"); + int counter = 0; + for (int k=0; k returned method[" + counter +"] - " + expected_method_info); + counter++; + } + out_stream.println + ("##> returned methods:"); + for (int k=0; k expected method[" + k +"] - " + found_method_info); + } + not_matched_methods_number++; + all_method_errors_number++; + continue; + } + int matched_methods_number = 0; + for (int k=0; k methbyname_s004: FAILED: methodsByName(...) returned unexpected List of methods!"); + out_stream.println + ("##> requested method: " + methods_for_check[i][0]); + out_stream.println + ("##> expected number of returned methods = " + expected_methods_number); + out_stream.println + ("##> expected methods:"); + int counter = 0; + for (int k=0; k expected[" + counter +"] - " + expected_method_info); + counter++; + } + out_stream.println + ("##> in fact number of returned methods = " + expected_methods_number); + out_stream.println + ("##> returned methods:"); + for (int k=0; k returned method[" + k +"] - " + found_method_info); + } + not_matched_methods_number++; + all_method_errors_number++; + } + else { + print_log_on_verbose + ("--> methbyname_s004: PASSED for method: " + methods_for_check[i][0]); + passed_methods_number++; + } + } + break; + } + + out_stream.println("--> methbyname_s004: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> methbyname_s004: number of checked methods = " + methods_for_check_number); + if ( methodsByName_exceptions > 0 ) { + out_stream.println + ("--> methbyname_s004: number of unexpected exceptions thrown by methodsByName(...) = " + + methodsByName_exceptions); + } + if ( not_found_methods_number > 0 ) { + out_stream.println + ("--> methbyname_s004: number of methods not found by methodsByName(...) (empty List returned) = " + + not_found_methods_number); + } + if ( not_matched_methods_number > 0 ) { + out_stream.println + ("--> methbyname_s004: number of returned by methodsByName(...) methods not matched to requested method = " + + not_matched_methods_number); + } + out_stream.println + ("--> methbyname_s004: number of methods for which methodsByName(...) returned expected result = " + + passed_methods_number); + } + if ( all_method_errors_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_s004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> methbyname_s004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_s004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004/TestDescription.java new file mode 100644 index 00000000000..6cb60aa15dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/methodsByName_s/methbyname_s004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004 test + * checks the methodsByName(String name) method of ReferenceType interface + * of the com.sun.jdi package for overloaded methods: + * the ReferenceType.methodsByName(String name) method is checked for methods of + * debugee's class which extends super class and implements interface. + * Debugee's class has only overloaded methods. + * Each returned method is checked for its name and signature. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_s.methbyname_s004 + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_s.methbyname_s004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004a.java new file mode 100644 index 00000000000..24ea124d6c4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_s/methbyname_s004a.java @@ -0,0 +1,127 @@ +/* + * 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.ReferenceType.methodsByName_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methbyname_s004 JDI test. + */ + +public class methbyname_s004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_s."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methbyname_s004aClassForCheck"; + + + 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 methbyname_s004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, methbyname_s004a.class.getClassLoader()); + print_log_on_verbose + ("--> methbyname_s004a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> methbyname_s004a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> methbyname_s004a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methbyname_s004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_s004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_s004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_s004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_s004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +abstract class methbyname_s004aClassForCheck extends methbyname_s004aSuperClassForCheck implements methbyname_s004aInterfaceForCheck { + + + // overloaded static methods + static void s_overloaded_method() {} + static String s_overloaded_method(String s) {return "string";} + static Object s_overloaded_method(Object obj) {return new Object();} + static Object s_overloaded_method(long l, String s) {return new Object();} + + static Object s_super_overloaded_method(long l, String s) {return new Object();} + + // overloaded instance methods + void i_overloaded_method() {} + long i_overloaded_method(Object obj) {return (long)1;} + String i_overloaded_method(String s) {return "string";} + Object i_overloaded_method(long l, String s) {return new Object();} + + Object i_super_overloaded_method(long l, String s) {return new Object();} + Object i_interf_overloaded_method(long l, String s) {return new Object();} + + +} + +abstract class methbyname_s004aSuperClassForCheck { + + static Object s_super_overloaded_method(long l) {return new Object();} + Object i_super_overloaded_method(long l) {return new Object();} + +} + +interface methbyname_s004aInterfaceForCheck { + + Object i_interf_overloaded_method(long l); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001.java new file mode 100644 index 00000000000..e316d96ea4f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001.java @@ -0,0 +1,444 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +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 methodsByName(String name, String signature) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_ss001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_ss.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methbyname_ss001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methbyname_ss001aClassForCheck"; + private final static String super_class_for_check = package_prefix + "methbyname_ss001aSuperClassForCheck"; + private final static String interface_for_check = package_prefix + "methbyname_ss001aInterfaceForCheck"; + private final static String not_existing_class = "not_existing_class"; + private static String methods_for_check[][] = { + +// method name declaring class signature + + {"", class_for_check, "()V" }, + {"ClassForCheck", class_for_check, "()V" }, + {"s_void_method", class_for_check, "()V" }, + {"s_boolean_method", class_for_check, "()Z" }, + {"s_byte_method", class_for_check, "()B" }, + {"s_char_method", class_for_check, "()C" }, + {"s_double_method", class_for_check, "()D" }, + {"s_float_method", class_for_check, "()F" }, + {"s_int_method", class_for_check, "()I" }, + {"s_long_method", class_for_check, "()J" }, + {"s_string_method", class_for_check, "()Ljava/lang/String;" }, + {"s_object_method", class_for_check, "()Ljava/lang/Object;" }, + {"s_prim_array_method", class_for_check, "()[J" }, + {"s_ref_array_method", class_for_check, "()[Ljava/lang/Object;" }, + {"s_super_hidden_void_method", class_for_check, "()V" }, + {"s_super_hidden_prim_method", class_for_check, "()I" }, + {"s_super_hidden_ref_method", class_for_check, "()Ljava/lang/Object;" }, + {"s_void_par_method", class_for_check, "(Z)V" }, + {"s_boolean_par_method", class_for_check, "(Z)Z" }, + {"s_byte_par_method", class_for_check, "(B)B" }, + {"s_char_par_method", class_for_check, "(C)C" }, + {"s_double_par_method", class_for_check, "(D)D" }, + {"s_float_par_method", class_for_check, "(F)F" }, + {"s_int_par_method", class_for_check, "(I)I" }, + {"s_long_par_method", class_for_check, "(J)J" }, + {"s_string_par_method", class_for_check, "(Ljava/lang/String;)Ljava/lang/String;" }, + {"s_object_par_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_prim_array_par_method", class_for_check, "([J)[J" }, + {"s_ref_array_par_method", class_for_check, "([Ljava/lang/Object;)[Ljava/lang/Object;" }, + {"s_super_hidden_void_par_method", class_for_check, "(I)V" }, + {"s_super_hidden_prim_par_method", class_for_check, "(I)I" }, + {"s_super_hidden_ref_par_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_native_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_synchr_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_final_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_private_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_protected_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_public_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_void_method", class_for_check, "()V" }, + {"i_boolean_method", class_for_check, "()Z" }, + {"i_byte_method", class_for_check, "()B" }, + {"i_char_method", class_for_check, "()C" }, + {"i_double_method", class_for_check, "()D" }, + {"i_float_method", class_for_check, "()F" }, + {"i_int_method", class_for_check, "()I" }, + {"i_long_method", class_for_check, "()J" }, + {"i_string_method", class_for_check, "()Ljava/lang/String;" }, + {"i_object_method", class_for_check, "()Ljava/lang/Object;" }, + {"i_prim_array_method", class_for_check, "()[J" }, + {"i_ref_array_method", class_for_check, "()[Ljava/lang/Object;" }, + {"i_super_overridden_void_method", class_for_check, "()V" }, + {"i_super_overridden_prim_method", class_for_check, "()I" }, + {"i_super_overridden_ref_method", class_for_check, "()Ljava/lang/Object;" }, + {"i_interf_overridden_void_method", class_for_check, "()V" }, + {"i_interf_overridden_prim_method", class_for_check, "()I" }, + {"i_interf_overridden_ref_method", class_for_check, "()Ljava/lang/Object;" }, + {"i_void_par_method", class_for_check, "(Z)V" }, + {"i_boolean_par_method", class_for_check, "(Z)Z" }, + {"i_byte_par_method", class_for_check, "(B)B" }, + {"i_char_par_method", class_for_check, "(C)C" }, + {"i_double_par_method", class_for_check, "(D)D" }, + {"i_float_par_method", class_for_check, "(F)F" }, + {"i_int_par_method", class_for_check, "(I)I" }, + {"i_long_par_method", class_for_check, "(J)J" }, + {"i_string_par_method", class_for_check, "(Ljava/lang/String;)Ljava/lang/String;" }, + {"i_object_par_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_prim_array_par_method", class_for_check, "([J)[J" }, + {"i_ref_array_par_method", class_for_check, "([Ljava/lang/Object;)[Ljava/lang/Object;" }, + {"i_super_overridden_void_par_method", class_for_check, "(I)V" }, + {"i_super_overridden_prim_par_method", class_for_check, "(I)I" }, + {"i_super_overridden_ref_par_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_interf_overridden_void_par_method", class_for_check, "(I)V" }, + {"i_interf_overridden_prim_par_method", class_for_check, "(I)I" }, + {"i_interf_overridden_ref_par_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_abstract_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_native_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_synchr_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_final_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_private_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_protected_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_public_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"", class_for_check, "()V" }, + + {"s_super_void_method", super_class_for_check, "(J)V" }, + {"s_super_prim_method", super_class_for_check, "(J)J" }, + {"s_super_ref_method", super_class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_super_void_method", super_class_for_check, "(J)V" }, + {"i_super_prim_method", super_class_for_check, "(J)J" }, + {"i_super_ref_method", super_class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_multiple_inherited_method", super_class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + + {"i_interf_ref_method", interface_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"i_interf_prim_method", interface_for_check, "(J)J" }, + {"i_interf_void_method", interface_for_check, "(J)V" }, + + {"s_overloaded_method", class_for_check, "()V" }, + {"s_overloaded_method", class_for_check, "(Ljava/lang/String;)Ljava/lang/String;" }, + {"s_overloaded_method", class_for_check, "(Ljava/lang/Object;)Ljava/lang/Object;" }, + {"s_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_overloaded_method", class_for_check, "()V" }, + {"i_overloaded_method", class_for_check, "(Ljava/lang/Object;)J" }, + {"i_overloaded_method", class_for_check, "(Ljava/lang/String;)Ljava/lang/String;" }, + {"i_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_super_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_super_overloaded_method", super_class_for_check, "(J)Ljava/lang/Object;" }, + {"i_interf_overloaded_method", class_for_check, "(JLjava/lang/String;)Ljava/lang/Object;" }, + {"i_interf_overloaded_method", interface_for_check, "(J)Ljava/lang/Object;" }, + + {"non_existing_method", not_existing_class, "non_existing_signature" } + + }; + + /** + * Re-call to run(args,out), 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 methbyname_ss001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001 test LOG:"); + out_stream.println("==> test checks methodsByName(String name, String signature) method of "); + out_stream.println(" ReferenceType interface of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out_stream); + print_log_on_verbose("--> methbyname_ss001: methbyname_ss001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> methbyname_ss001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> methbyname_ss001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_ss001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> methbyname_ss001: check ReferenceType.methodsByName(...) method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + int methods_for_check_number = methods_for_check.length; + int methodsByName_exceptions = 0; + int not_found_methods_number = 0; + int unexpected_found_methods_number = 0; + int not_matched_methods_number = 0; + int all_method_errors_number = 0; + int passed_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> methbyname_ss001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + for (int i=0; i methods_byname_list = null; + try { + methods_byname_list = refType.methodsByName(expected_method_name, expected_method_signature); + } + catch (Throwable thrown) { + out_stream.println + ("##> methbyname_ss001: FAILED: methodsByName(...) throws unexpected " + + thrown); + out_stream.println + ("##> requested method: " + expected_method_info); + methodsByName_exceptions++; + all_method_errors_number++; + continue; + } + int methods_byname_number = methods_byname_list.size(); + if ( methods_byname_number == 0 ) { + if ( existing_method ) { + out_stream.println + ("##> methbyname_ss001: FAILED: methodsByName(...) returned empty List of methods!"); + out_stream.println + ("##> requested method: " + expected_method_info); + not_found_methods_number++; + all_method_errors_number++; + } + else { + print_log_on_verbose + ("--> methbyname_ss001: PASSED for method: " + expected_method_info); + print_log_on_verbose + ("--> expected result: empty List of methods"); + passed_methods_number++; + } + continue; + } + Method methods_byname_array[] = new Method[methods_byname_number]; + methods_byname_list.toArray(methods_byname_array); + + if ( (! existing_method) || (methods_byname_number > 1) ) { + out_stream.println + ("##> methbyname_ss001: FAILED: methodsByName(...) returned unexpected number of methods - " + + methods_byname_number + " method(s)"); + out_stream.println + ("##> requested method: " + expected_method_info); + if ( ! existing_method ) { + out_stream.println + ("##> expected result: empty List of methods"); + unexpected_found_methods_number++; + } + else { + out_stream.println + ("##> expected result: List of requested method"); + not_matched_methods_number++; + } + out_stream.println + ("##> returned methods:"); + for (int k=0; k returned method[" + k +"] - " + found_method_info); + } + all_method_errors_number++; + continue; + } + Method found_method = methods_byname_array[0]; + String found_method_name = found_method.name(); + String found_method_signature = found_method.signature(); + String found_declaring_class = "declaring class NOT defined"; + try { + found_declaring_class = found_method.declaringType().name(); + } + catch (Throwable thrown) { + } + +// 'found_method_info' is changed to fix the test failure. +// See also: 'expected_method_info' above. +// String found_method_info = found_method_name + " (\"" +// + found_method_signature + "\", " + found_declaring_class + ")"; + String found_method_info = found_method_name + " (\"" + + found_method_signature + "\", )"; + + if ( ! found_method_info.equals(expected_method_info) ) { + out_stream.println + ("##> methbyname_ss001: FAILED: methodsByName(...) returned not matched method - " + + found_method_info); + out_stream.println + ("##> requested method: " + expected_method_info); + not_matched_methods_number++; + all_method_errors_number++; + } + else { + print_log_on_verbose + ("--> methbyname_ss001: PASSED for method: " + expected_method_info); + passed_methods_number++; + } + } + break; + } + out_stream.println("--> methbyname_ss001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> methbyname_ss001: number of checked methods = " + methods_for_check_number); + if ( methodsByName_exceptions > 0 ) { + out_stream.println + ("--> methbyname_ss001: number of unexpected exceptions thrown by methodsByName(...) = " + + methodsByName_exceptions); + } + if ( not_found_methods_number > 0 ) { + out_stream.println + ("--> methbyname_ss001: number of methods not found by methodsByName(...) (empty List returned) = " + + not_found_methods_number); + } + if ( unexpected_found_methods_number > 0 ) { + out_stream.println + ("--> methbyname_ss001: number of unexpected methods found by methodsByName(...) (not empty List returned) = " + + unexpected_found_methods_number); + } + if ( not_matched_methods_number > 0 ) { + out_stream.println + ("--> methbyname_ss001: number of returned by methodsByName(...) methods not matched to requested method = " + + not_matched_methods_number); + } + out_stream.println + ("--> methbyname_ss001: number of methods for which methodsByName(...) returned expected result = " + + passed_methods_number); + } + if ( all_method_errors_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_ss001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> methbyname_ss001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_ss001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001/TestDescription.java new file mode 100644 index 00000000000..d0d2131647d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/methodsByName_ss/methbyname_ss001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001 test + * checks the methodsByName(String name, String signature) method + * of ReferenceType interface of the com.sun.jdi package : + * the ReferenceType.methodsByName(String name, String signature) method + * is checked for methods of debugee's class which extends super class and + * implements interface. + * Each method is checked for its name and signature. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss001 + * nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001a.java new file mode 100644 index 00000000000..13cfdf25901 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss001a.java @@ -0,0 +1,272 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methbyname_ss001 JDI test. + */ + +public class methbyname_ss001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_ss."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methbyname_ss001aClassForCheck"; + + + 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 methbyname_ss001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, methbyname_ss001a.class.getClassLoader()); + print_log_on_verbose + ("--> methbyname_ss001a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> methbyname_ss001a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> methbyname_ss001a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methbyname_ss001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_ss001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_ss001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_ss001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_ss001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +abstract class methbyname_ss001aClassForCheck extends methbyname_ss001aSuperClassForCheck + implements methbyname_ss001aInterfaceForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods without params + static void s_void_method() {} + static boolean s_boolean_method() {return true;} + static byte s_byte_method() {return (byte)1;} + static char s_char_method() {return (char)1;} + static double s_double_method() {return (double)100.99;} + static float s_float_method() {return (float)100.88;} + static int s_int_method() {return 100;} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + // static methods with params + static void s_void_par_method(boolean z) {} + static boolean s_boolean_par_method(boolean z) {return true;} + static byte s_byte_par_method(byte b) {return (byte)1;} + static char s_char_par_method(char ch) {return (char)1;} + static double s_double_par_method(double d) {return (double)100.99;} + static float s_float_par_method(float f) {return (float)100.88;} + static int s_int_par_method(int i) {return 100;} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + // other static methods + native static Object s_native_method(Object obj); + static synchronized Object s_synchr_method(Object obj) {return new Object();} + final static Object s_final_method(Object obj) {return new Object();} + private static Object s_private_method(Object obj) {return new Object();} + protected static Object s_protected_method(Object obj) {return new Object();} + public static Object s_public_method(Object obj) {return new Object();} + + // instance methods without params + void i_void_method() {} + boolean i_boolean_method() {return true;} + byte i_byte_method() {return (byte)1;} + char i_char_method() {return (char)1;} + double i_double_method() {return (double)100.99;} + float i_float_method() {return (float)100.88;} + int i_int_method() {return 100;} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + public void i_interf_overridden_void_method() {} + public int i_interf_overridden_prim_method() {return 100;} + public Object i_interf_overridden_ref_method() {return new Object();} + + // instance methods with params + void i_void_par_method(boolean z) {} + boolean i_boolean_par_method(boolean z) {return true;} + byte i_byte_par_method(byte b) {return (byte)1;} + char i_char_par_method(char ch) {return (char)1;} + double i_double_par_method(double d) {return (double)100.99;} + float i_float_par_method(float f) {return (float)100.88;} + int i_int_par_method(int i) {return 100;} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public void i_interf_overridden_void_par_method(int i) {} + public int i_interf_overridden_prim_par_method(int i) {return 100;} + public Object i_interf_overridden_ref_par_method(Object obj) {return new Object();} + + // other instance methods + abstract Object i_abstract_method(Object obj); + native Object i_native_method(Object obj); + synchronized Object i_synchr_method(Object obj) {return new Object();} + final Object i_final_method(Object obj) {return new Object();} + private Object i_private_method(Object obj) {return new Object();} + protected Object i_protected_method(Object obj) {return new Object();} + public Object i_public_method(Object obj) {return new Object();} + + + // static initializer + static {} + + // overloaded static methods + static void s_overloaded_method() {} + static String s_overloaded_method(String s) {return "string";} + static Object s_overloaded_method(Object obj) {return new Object();} + static Object s_overloaded_method(long l, String s) {return new Object();} + + static Object s_super_overloaded_method(long l, String s) {return new Object();} + + // overloaded instance methods + void i_overloaded_method() {} + long i_overloaded_method(Object obj) {return (long)1;} + String i_overloaded_method(String s) {return "string";} + Object i_overloaded_method(long l, String s) {return new Object();} + + Object i_super_overloaded_method(long l, String s) {return new Object();} + Object i_interf_overloaded_method(long l, String s) {return new Object();} + + +} + +abstract class methbyname_ss001aSuperClassForCheck { + + static void s_super_void_method(long l) {} + static long s_super_prim_method(long l) {return 100;} + static Object s_super_ref_method(Object obj) {return new Object();} + + void i_super_void_method(long l) {} + long i_super_prim_method(long l) {return 100;} + Object i_super_ref_method(Object obj) {return new Object();} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public Object i_multiple_inherited_method(Object obj) {return new Object();} + + static Object s_super_overloaded_method(long l) {return new Object();} + Object i_super_overloaded_method(long l) {return new Object();} + +} + +interface methbyname_ss001aInterfaceForCheck { + + void i_interf_void_method(long l); + long i_interf_prim_method(long l); + Object i_interf_ref_method(Object obj); + + void i_interf_overridden_void_method(); + int i_interf_overridden_prim_method(); + Object i_interf_overridden_ref_method(); + + void i_interf_overridden_void_par_method(int i); + int i_interf_overridden_prim_par_method(int i); + Object i_interf_overridden_ref_par_method(Object obj); + + public Object i_multiple_inherited_method(Object obj); + + Object i_interf_overloaded_method(long l); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002.java new file mode 100644 index 00000000000..d66e8f35e64 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002.java @@ -0,0 +1,221 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +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 methodsByName(String name, String signature) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_ss002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_ss.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methbyname_ss002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "methbyname_ss002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "methbyname_ss002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** + * Re-call to run(args,out), 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 methbyname_ss002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002 test LOG:"); + print_log_on_verbose("==> test checks methodsByName(String name, String signature) method of ReferenceType "); + print_log_on_verbose(" interface of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methbyname_ss002: methbyname_ss002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> methbyname_ss002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> methbyname_ss002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_ss002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> methbyname_ss002: check ReferenceType.methodsByName(...) method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean methodsByName_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> methbyname_ss002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> methbyname_ss002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List methodsByName_methods_list = null; + try { + methodsByName_methods_list = refType.methodsByName("dummy_method_name", "dummy_method_signature"); + print_log_anyway + ("##> methbyname_ss002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + methodsByName_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> methbyname_ss002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> methbyname_ss002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + methodsByName_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methodsByName_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_ss002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methbyname_ss002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_ss002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002/TestDescription.java new file mode 100644 index 00000000000..304d73e4797 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/methodsByName_ss/methbyname_ss002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002 test + * checks the methodsByName(String name, String signature) method of ReferenceType + * interface of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.methodsByName(String name, String signature) + * method is called for this class - ClassNotPreparedException + * should be thrown in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss002 + * nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002/loadclass/methbyname_ss002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002/loadclass/methbyname_ss002aClassForCheck.java new file mode 100644 index 00000000000..656d9678976 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002/loadclass/methbyname_ss002aClassForCheck.java @@ -0,0 +1,71 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +/** + * This class is loaded by methbyname_ss002aClassLoader . + */ + +class methbyname_ss002aClassForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods + static void s_void_method() {} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_void_par_method(boolean z) {} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + + // instance methods + void i_void_method() {} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_void_par_method(boolean z) {} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + // static initializer + static {} + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002a.java new file mode 100644 index 00000000000..88dbe5521ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the methbyname_ss002 JDI test. + */ + +public class methbyname_ss002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_ss."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "methbyname_ss002aClassForCheck"; + + 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 methbyname_ss002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + methbyname_ss002aClassLoader customClassLoader = new methbyname_ss002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> methbyname_ss002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> methbyname_ss002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> methbyname_ss002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_ss002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_ss002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_ss002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_ss002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class methbyname_ss002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public methbyname_ss002aClassLoader(String classPath, String className) { + super(methbyname_ss002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003.java new file mode 100644 index 00000000000..d8c87906b36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003.java @@ -0,0 +1,252 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +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 methodsByName(String name, String signature) + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class methbyname_ss003 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.methodsByName_ss.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "methbyname_ss003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "methbyname_ss003b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new methbyname_ss003().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003 test LOG:"); + print_log_anyway("--> test checks methodsByName(String name, String signature) method of ReferenceType "); + print_log_anyway(" interface of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> methbyname_ss003: methbyname_ss003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_ss003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_ss003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean methodsByName_ss_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> methbyname_ss003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> methbyname_ss003: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> methbyname_ss003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> methbyname_ss003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> methbyname_ss003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> methbyname_ss003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.methodsByName_ss() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> methbyname_ss003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> methbyname_ss003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> methbyname_ss003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> methbyname_ss003: check that checked class has been unloaded realy..."); + print_log_anyway + ("--> methbyname_ss003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.methodsByName_ss() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> methbyname_ss003: check ReferenceType.methodsByName(...) method for unloaded class..."); + List methods_byname_list = null; + try { + methods_byname_list = refType.methodsByName("dummy_method_name", "dummy_method_signature"); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> methbyname_ss003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> methbyname_ss003: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + methodsByName_ss_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || methodsByName_ss_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> methbyname_ss003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> methbyname_ss003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> methbyname_ss003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of methbyname_ss003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/TestDescription.java new file mode 100644 index 00000000000..6aabb1ef753 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/TestDescription.java @@ -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/ReferenceType/methodsByName_ss/methbyname_ss003. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003 test + * checks the methodsByName(String name, String signature) method of + * ReferenceType interface of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * methodsByName(String name, String signature) method - the + * com.sun.jdi.ObjectCollectedException should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - methodsByName_ss003b class was moved in 'loadclass' subdirectory; + * - package name was added in methodsByName_ss003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for methodsByName_ss003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss003 + * nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.methodsByName_ss.methbyname_ss003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/loadclass/methbyname_ss003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/loadclass/methbyname_ss003b.java new file mode 100644 index 00000000000..dbef4b6a91b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003/loadclass/methbyname_ss003b.java @@ -0,0 +1,30 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the methodsByName(String name, String signature) method +//of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.methodsByName_ss; + +class methbyname_ss003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003a.java new file mode 100644 index 00000000000..57906353d8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/methodsByName_ss/methbyname_ss003a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.methodsByName_ss; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the methbyname_ss003 JDI test. + */ + +public class methbyname_ss003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.methodsByName_ss."; + private final static String checked_class_name = package_prefix + "methbyname_ss003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> methbyname_ss003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> methbyname_ss003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> methbyname_ss003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> methbyname_ss003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> methbyname_ss003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> methbyname_ss003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_ss003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_ss003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> methbyname_ss003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> methbyname_ss003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> methbyname_ss003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> methbyname_ss003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> methbyname_ss003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> methbyname_ss003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> methbyname_ss003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> methbyname_ss003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> methbyname_ss003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> methbyname_ss003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> methbyname_ss003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of methbyname_ss003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001.java new file mode 100644 index 00000000000..1b5d3c7e39d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001.java @@ -0,0 +1,237 @@ +/* + * 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.ReferenceType.name; + +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 name() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class name001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.name.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "name001", + debugeeName = thisClassName + "a"; + + private final static String primitive_type_sign = "primitive_type"; + private final static String reference_type_sign = "reference_type"; + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + {"boolean", primitive_type_sign}, + {"byte" , primitive_type_sign}, + {"char" , primitive_type_sign}, + {"double" , primitive_type_sign}, + {"float" , primitive_type_sign}, + {"int" , primitive_type_sign}, + {"long" , primitive_type_sign}, + + {"java.lang.Boolean" , reference_type_sign}, + {"java.lang.Byte" , reference_type_sign}, + {"java.lang.Character", reference_type_sign}, + {"java.lang.Double" , reference_type_sign}, + {"java.lang.Float" , reference_type_sign}, + {"java.lang.Integer" , reference_type_sign}, + {"java.lang.Long" , reference_type_sign}, + {"java.lang.String" , reference_type_sign}, + {"java.lang.Object" , reference_type_sign}, + + {package_prefix + "ClassForCheck", reference_type_sign}, + {package_prefix + "InterfaceForCheck", reference_type_sign}, + + {debugeeName+"$s_class", reference_type_sign}, + {debugeeName+"$s_interf", reference_type_sign} + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new name001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/name/name001 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/name/name001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/name/name001 test LOG:"); + print_log_anyway("==> test checks the name() method of ReferenceType interface"); + print_log_anyway(" of the com.sun.jdi package for ArrayType, ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> name001: name001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway("##> name001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway("##> name001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> name001: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> name001: check ReferenceType.name() method for debugee's classes..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int name_method_exceptions = 0; + int name_method_errors = 0; + for (int i=0; i name001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String ref_type_name = null; + try { + ref_type_name = refType.name(); + } + catch (Throwable thrown) { + print_log_anyway + ("##> name001: FAILED: refType.name() threw unexpected exception - " + + thrown); + print_log_anyway + ("##> refType = " + refType); + name_method_exceptions++; + continue; + } + if ( ! ref_type_name.equals(className) ) { + print_log_anyway + ("##> name001: FAILED: ReferenceType.name() returned unexpected name:"); + print_log_anyway + ("##> expected name = " + className); + print_log_anyway + ("##> returned name = " + ref_type_name); + name_method_errors++; + } + else { + print_log_on_verbose + ("--> name001: PASSED: ReferenceType.name() returned expected name:"); + print_log_on_verbose + ("--> checked class name = " + className); + print_log_on_verbose + ("--> returned name = " + ref_type_name); + } + } + } + print_log_anyway("--> name001: check completed!"); + print_log_anyway("--> name001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + print_log_anyway("##> name001: \"class not found ERRORS\" number = " + + class_not_found_errors); + } + if ( name_method_exceptions > 0 ) { + print_log_anyway("##> name001: number of unexpected name() methods exceptions = " + + name_method_exceptions); + } + print_log_anyway("##> name001: name() method errors number = " + + name_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + name_method_errors + name_method_exceptions > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> name001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway("##> name001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> name001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001/TestDescription.java new file mode 100644 index 00000000000..600154862b7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ReferenceType/name/name001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/name/name001 test + * checks the name() method of ReferenceType interface + * of the com.sun.jdi package for ArrayType, ClassType, InterfaceType: + * For each checked debugee's class the test gets ReferenceType + * instance for this class and then gets the name by name() method + * for this ReferenceType instance. + * The test expects that returned name should be equal to the + * checked debugee's class name. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.name.name001 + * nsk.jdi.ReferenceType.name.name001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001a.java new file mode 100644 index 00000000000..c547460c0ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name001a.java @@ -0,0 +1,119 @@ +/* + * 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.ReferenceType.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the name001 JDI test. + */ + +public class name001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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}; + + static class s_class {} + s_class s_class_0 = new s_class(), s_class_1[]={s_class_0}, + s_class_2[][]={s_class_1}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static interface s_interf {} + 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}; + + ClassForCheck class_for_check0 = new ClassForCheck(), + class_for_check1[]={class_for_check0}, + class_for_check2[][]={class_for_check1}; + InterfaceForCheck_impl interf_for_check_impl0 = new InterfaceForCheck_impl(); + InterfaceForCheck interf_for_check0, + interf_for_check1[]={interf_for_check0}, + interf_for_check2[][]={interf_for_check1}; + + 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 name001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + name001a name001a_obj = new name001a(); + + print_log_on_verbose("**> name001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> name001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> name001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> name001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> name001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class ClassForCheck {} + +interface InterfaceForCheck {} + +class InterfaceForCheck_impl implements InterfaceForCheck{} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002.java new file mode 100644 index 00000000000..8f69320a06d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.name; + +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 name() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class name002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.name.", + thisClassName = package_prefix + "name002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "name002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new name002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/name/name002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/name/name002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/name/name002 test LOG:"); + print_log_anyway("--> test checks name() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> name002: name002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> name002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> name002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> name002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> name002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> name002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> name002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean name_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> name002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> name002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> name002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> name002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> name002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> name002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> name002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.name() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> name002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> name002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> name002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> name002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> name002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> name002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.name() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> name002: check ReferenceType.name() method for unloaded class..."); + String ref_type_name = null; + try { + ref_type_name = refType.name(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> name002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> name002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + name_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || name_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> name002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> name002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> name002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of name002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/TestDescription.java new file mode 100644 index 00000000000..f9be40307cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/TestDescription.java @@ -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/ReferenceType/name/name002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/name/name002 test + * checks the name() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * name() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - name002b class was moved in 'loadclass' subdirectory; + * - package name was added in name002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for name002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.name.name002 + * nsk.jdi.ReferenceType.name.name002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.name.name002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/loadclass/name002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/loadclass/name002b.java new file mode 100644 index 00000000000..956970997e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002/loadclass/name002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the name() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.name; + +class name002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002a.java new file mode 100644 index 00000000000..385056310fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/name/name002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.name; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the name002 JDI test. + */ + +public class name002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.name."; + private final static String checked_class_name = package_prefix + "name002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> name002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> name002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> name002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> name002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> name002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> name002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> name002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> name002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> name002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> name002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> name002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> name002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> name002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> name002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> name002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> name002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> name002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> name002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> name002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of name002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001.java new file mode 100644 index 00000000000..bea80620850 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001.java @@ -0,0 +1,492 @@ +/* + * 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.ReferenceType.nestedTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.nestedTypes()
    + * complies with its spec.
    + *
    + * Cases for testing include only ClassTypes and InterfaceTypes.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class nestedtypes001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/nestedTypes/nestedtypes001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new nestedtypes001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.nestedTypes.nestedtypes001a"; + + String mName = "nsk.jdi.ReferenceType.nestedTypes"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + + String names1[] = { + + ".nestedtypes001aTestClass$NestedClass", + ".nestedtypes001aTestClass$NestedClass[]", + + ".nestedtypes001aTestClass$NestedIface", + ".nestedtypes001aTestClass$NestedIface[]", + + + ".nestedtypes001aTestClass$StaticNestedClass", + ".nestedtypes001aTestClass$StaticNestedClass[]" + + }; + + String typeForCheck = mName + ".nestedtypes001aTestClass"; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classes = vm.classesByName(typeForCheck); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType testedType = (ReferenceType) classList.get(0);"); + ReferenceType testedType = (ReferenceType) classes.get(0); + + log2(" getting: List netsedTypes = testedType.nestedTypes();"); + List nestedTypes = testedType.nestedTypes(); + if (nestedTypes.size() != names1.length) { + log3("ERROR: nestedTypes.size() != names1.length : " + nestedTypes.size()); + testExitCode = FAILED; + continue; + } + + + log2("----- Cases for testing: ReferenceTypes"); + for (int i1 = 0; i1 < names1.length; i1++) { + + typeForCheck = mName + names1[i1]; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classList = vm.classesByName(typeForCheck); + if (classList.size() != 1) { + log3("ERROR: classList.size() != 1 : " + classList.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType referenceType = (ReferenceType) classList.get(0);"); + ReferenceType referenceType = (ReferenceType) classList.get(0); + + boolean equals = false; + + ListIterator li = nestedTypes.listIterator(); + for (; li.hasNext(); ) { + if (li.next().equals(referenceType)) { + equals = true; + break; + } + } + + if (!equals) { + log3("ERROR: referenceType is not in the List: " + typeForCheck); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001/TestDescription.java new file mode 100644 index 00000000000..0dbd66697cc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ReferenceType/nestedTypes/nestedtypes001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.nestedTypes() + * complies with its spec: + * public List nestedTypes() + * Returns a List containing ReferenceType objects that + * are declared within this type and + * are currently loaded into the Virtual Machine. + * Both static nested types and non-static nested types (that is, inner types) + * are included. Local inner types + * (declared within a code block somewhere in this reference type) + * are also included in the returned list. + * For arrays (ArrayType) and primitive classes, + * the returned list is always empty. + * Returns: a List of nested ReferenceType objects; + * the list has 0 length if there are no nested types. + * Cases for testing include only ClassTypes and InterfaceTypes. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.nestedTypes.nestedtypes001; + * the debuggee program - nsk.jdi.ReferenceType.nestedTypes.nestedtypes001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.nestedTypes.nestedtypes001 + * nsk.jdi.ReferenceType.nestedTypes.nestedtypes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.nestedTypes.nestedtypes001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001a.java new file mode 100644 index 00000000000..44619a5a9d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes001a.java @@ -0,0 +1,139 @@ +/* + * 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.ReferenceType.nestedTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the nestedtypes001 JDI test. + */ + +public class nestedtypes001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + nestedtypes001aTestClass check = new nestedtypes001aTestClass(); + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +class nestedtypes001aTestClass { + + + class NestedClass implements NestedIface { + boolean bnc = true; + } + NestedClass nestedClass = new NestedClass(); + NestedClass nestedClassArray[] = { new NestedClass() }; + + interface NestedIface { + boolean bsnf = true; + } + NestedIface nestedIface = new NestedClass(); + NestedIface nestedIfaceArray[] = { new NestedClass() }; + + + static class StaticNestedClass { + boolean bsnc = true; + } + StaticNestedClass staticNestedClass = new StaticNestedClass(); + StaticNestedClass staticNestedClassArray[] = { new StaticNestedClass() }; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002.java new file mode 100644 index 00000000000..559fc020922 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002.java @@ -0,0 +1,511 @@ +/* + * 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.ReferenceType.nestedTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.nestedTypes()
    + * complies with its spec.
    + *
    + * Cases for testing include ArrayType and primitive classes.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class nestedtypes002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/nestedTypes/nestedtypes002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new nestedtypes002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.nestedTypes.nestedtypes002a"; + + String mName = "nsk.jdi.ReferenceType.nestedTypes"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private static BreakpointEvent bpEvent; + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ReferenceType testedType = null; + List nestedTypes = null; + String typeForCheck; + + + log2("----- Case for testing: ArrayType"); + + typeForCheck = mName + ".nestedtypes002aTestClass[]"; + log2("......typeForCheck: " + typeForCheck); + + log2(" getting: List classList = vm.classesByName(typeForCheck);"); + List classes = vm.classesByName(typeForCheck); + if (classes.size() != 1) { + log3("ERROR: classes.size() != 1 : " + classes.size()); + testExitCode = FAILED; + continue; + } + + log2(" getting: ReferenceType testedType = (ReferenceType) classList.get(0);"); + testedType = (ReferenceType) classes.get(0); + + log2(" getting: List nestedTypes = testedType.nestedTypes();"); + nestedTypes = testedType.nestedTypes(); + if (nestedTypes.size() != 0) { + log3("ERROR: nestedTypes.size() != 0 : " + nestedTypes.size()); + testExitCode = FAILED; + continue; + } + + log2("----- Cases for testing: primitive classes"); + + String names[] = { + "bl", + "bt", + "ch", + "db", + "fl", + "in", + "ln", + "sh" + }; + + Method testMethod = (Method)debuggeeClass.methodsByName("main").get(0); + // bpEvent should be assigned while getting of BreakpointEvent + if (bpEvent == null) { + throw new JDITestRuntimeException("bpEvent is null"); + } + + // get stack farme with main method + StackFrame frame = null; + try { + frame = bpEvent.thread().frame(1); + } catch (Exception e) { + throw new JDITestRuntimeException("Unexpected exception while getting stack frame: " + e ); + } + if (frame.location().method() != testMethod) { + throw new JDITestRuntimeException("Cannot take frame of main method"); + } + + for (int i1 = 0; i1 < names.length; i1++) { + + log2("......check for field : " + names[i]); + LocalVariable lVar = null; + try { + lVar = frame.visibleVariableByName(names[i1]); + } catch (Exception e ) { + throw new JDITestRuntimeException("Unexpected exception while searching for field " + names[i1] + " : " + e ); + } + Value val = null; + try { + val = frame.getValue(lVar); + } catch (Exception e ) { + throw new JDITestRuntimeException("Unexpected exception while getting value of field " + names[i1] + " : " + e ); + } + + testedType = ((ClassObjectReference)val).reflectedType(); + + log2(" checking nestedTypes() for ClassObjectReference of : " + testedType.name()); + nestedTypes = testedType.nestedTypes(); + if (nestedTypes.size() != 0) { + log3("ERROR: nestedTypes.size() != 0 : " + nestedTypes.size()); + testExitCode = FAILED; + continue; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + Event event = eventIterator.nextEvent(); + if ( event instanceof BreakpointEvent) { + bpEvent = (BreakpointEvent)event; + return; + } + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002/TestDescription.java new file mode 100644 index 00000000000..ba442df440e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/ReferenceType/nestedTypes/nestedtypes002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.nestedTypes() + * complies with its spec: + * public List nestedTypes() + * Returns a List containing ReferenceType objects that + * are declared within this type and + * are currently loaded into the Virtual Machine. + * Both static nested types and non-static nested types (that is, inner types) + * are included. Local inner types + * (declared within a code block somewhere in this reference type) + * are also included in the returned list. + * For arrays (ArrayType) and primitive classes, + * the returned list is always empty. + * Returns: a List of nested ReferenceType objects; + * the list has 0 length if there are no nested types. + * Cases for testing include ArrayType and primitive classes. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.nestedTypes.nestedtypes002; + * the debuggee program - nsk.jdi.ReferenceType.nestedTypes.nestedtypes002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was modified to fix of the bug: + * 4740126 TEST_BUG: ReferenceType.nestedTypes() returns wrong number of nested types + * Please, see an evaluation of the bug for details. + * 4773489 TEST_BUG nestedtypes002 failing + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.nestedTypes.nestedtypes002 + * nsk.jdi.ReferenceType.nestedTypes.nestedtypes002a + * + * @comment make sure nestedtypes002a is compiled with full debug info + * @clean nsk.jdi.ReferenceType.nestedTypes.nestedtypes002a + * @compile -g:lines,source,vars ../nestedtypes002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.nestedTypes.nestedtypes002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002a.java new file mode 100644 index 00000000000..f486ca5bc26 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/nestedTypes/nestedtypes002a.java @@ -0,0 +1,150 @@ +/* + * 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.ReferenceType.nestedTypes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the nestedtypes002 JDI test. + */ + +public class nestedtypes002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + nestedtypes002aTestClass testArray[] = { new nestedtypes002aTestClass() }; + + Class bl = Boolean.TYPE; + Class bt = Byte.TYPE; + Class ch = Character.TYPE; + Class db = Double.TYPE; + Class fl = Float.TYPE; + Class in = Integer.TYPE; + Class ln = Long.TYPE; + Class sh = Short.TYPE; + + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + +class nestedtypes002aTestClass { + + class NestedClass implements NestedIface { + boolean bnc = true; + } + NestedClass nestedClass = new NestedClass(); + NestedClass nestedClassArray[] = { new NestedClass() }; + + interface NestedIface { + boolean bsnf = true; + } + NestedIface nestedIface = new NestedClass(); + NestedIface nestedIfaceArray[] = { new NestedClass() }; + + + + static class StaticNestedClass { + boolean bsnc = true; + } + StaticNestedClass staticNestedClass = new StaticNestedClass(); + StaticNestedClass staticNestedClassArray[] = { new StaticNestedClass() }; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001.java new file mode 100644 index 00000000000..3db76e18d38 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001.java @@ -0,0 +1,125 @@ +/* + * 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.ReferenceType.sourceDebugExtension; + +import com.sun.jdi.ReferenceType; +import com.sun.jdi.ObjectCollectedException; +import com.sun.jdi.AbsentInformationException; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that the SourceDebugExtension class file + * attribute can be obtained by the JDI method + * ReferenceType.sourceDebugExtension(), + * otherwise the method should throw the AbsentInformationException. + */ +public class srcdebugx001 { + 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.ReferenceType.sourceDebugExtension.srcdebugx001t"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private IOPipe pipe; + private Debugee debuggee; + + 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 srcdebugx001().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType rType; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "srcdebugx001t.err> "); + debuggee.resume(); + + log.display("Waiting for debuggee readiness..."); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + return quitDebuggee(FAILED); + } + + if ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null"); + return quitDebuggee(FAILED); + } + + if (!debuggee.VM().canGetSourceDebugExtension()) { + + log.display(" VirtualMachine.canGetSourceDebugExtension() == false"); + log.display(" UnsupportedOperationException is expected"); + try { + String debugX = rType.sourceDebugExtension(); + log.complain("TEST FAILED: no UnsupportedOperationException thrown"); + return quitDebuggee(FAILED); + } catch ( UnsupportedOperationException e1 ) { + log.display(" UnsupportedOperationException thrown"); + return quitDebuggee(PASSED); + } catch ( Exception e2) { + log.complain("TEST FAILED: unexpected Exception thrown : " + e2); + return quitDebuggee(FAILED); + } + + } else { + + log.display(" VirtualMachine.canGetSourceDebugExtension() == true"); + log.display(" UnsupportedOperationException is not expected"); + + try { + String debugX = rType.sourceDebugExtension(); + log.display("TEST PASSED: successfully obtained the SourceDebugExtension attribute: \"" + + debugX + "\""); + return quitDebuggee(PASSED); + } catch(AbsentInformationException e) { + log.display("TEST PASSED: caught the expected exception: " + e); + return quitDebuggee(PASSED); + } catch (Exception e) { + log.complain("TEST FAILED: caught " + e); + return quitDebuggee(FAILED); + } + } + } + + private int quitDebuggee(int stat) { + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return stat; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001/TestDescription.java new file mode 100644 index 00000000000..8466eab558b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/sourceDebugExtension/srcdebugx001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the SourceDebugExtension class file + * attribute can be obtained by the JDI method + * ReferenceType.sourceDebugExtension(), otherwise the method + * should throw the AbsentInformationException + * COMMENTS + * To fix the bug 4493107, a corresponding check is added. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx001 + * nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx001t + * + * @comment make sure srcdebugx001t is compiled with full debug info + * @clean nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx001t + * @compile -g:lines,source,vars ../srcdebugx001t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001t.java new file mode 100644 index 00000000000..eb249a13a07 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx001t.java @@ -0,0 +1,52 @@ +/* + * 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.ReferenceType.sourceDebugExtension; + +import com.sun.jdi.ReferenceType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This is dummy debuggee class + */ +public class srcdebugx001t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(srcdebugx001.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(srcdebugx001.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(srcdebugx001.JCK_STATUS_BASE + + srcdebugx001.FAILED); + } + System.exit(srcdebugx001.JCK_STATUS_BASE + + srcdebugx001.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002.java new file mode 100644 index 00000000000..710f530d97d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002.java @@ -0,0 +1,121 @@ +/* + * 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.ReferenceType.sourceDebugExtension; + +import com.sun.jdi.ReferenceType; +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ObjectCollectedException; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * The test checks that the JDI method + * ReferenceType.sourceDebugExtension() properly returns + * the SourceDebugExtension Class File attribute. String obtained from + * the sourceDebugExtension() is compared with the expected + * attribute string. + */ +public class srcdebugx002 { + 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.ReferenceType.sourceDebugExtension.srcdebugx002t"; + static final String SRCDEBUGX_CLASS = + "nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx002x"; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String SRCDEBUGXSTR = "Hello world!"; + + private IOPipe pipe; + private Debugee debuggee; + + 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 srcdebugx002().runIt(argv, out); + } + + private int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + Log log = new Log(out, argHandler); + Binder binder = new Binder(argHandler, log); + ReferenceType rType; + String debugX = null; + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "srcdebugx002t.err> "); + debuggee.resume(); + + log.display("Waiting for debuggee readiness..."); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + cmd); + return quitDebuggee(FAILED); + } + + if ((rType = debuggee.classByName(SRCDEBUGX_CLASS)) == null) { + log.complain("TEST FAILURE: Method Debugee.classByName() returned null"); + return quitDebuggee(FAILED); + } + + if (!debuggee.VM().canGetSourceDebugExtension()) { + log.display("TEST CANCELLED: VirtualMachine.canGetSourceDebugExtension() == false"); + return quitDebuggee(PASSED); + } + + try { + debugX = rType.sourceDebugExtension(); + log.display("Check #1 PASSED: successfully obtained the SourceDebugExtension attribute"); + } catch(AbsentInformationException e) { + log.display("TEST FAILED: caught the exception: " + e); + return quitDebuggee(FAILED); + } catch (ObjectCollectedException e) { + log.complain("TEST FAILED: caught the exception: " + e); + return quitDebuggee(FAILED); + } + + if (debugX.equals(SRCDEBUGXSTR)) { + log.display("Check #2 PASSED: obtained the expected SourceDebugExtension attribute \"" + + debugX + "\""); + return quitDebuggee(PASSED); + } else { + log.complain("TEST FAILED: the SourceDebugExtension attribute is \"" + + debugX + "\",\n\texpected: \"" + SRCDEBUGXSTR + "\""); + return quitDebuggee(FAILED); + } + } + + private int quitDebuggee(int stat) { + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return stat; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002/TestDescription.java new file mode 100644 index 00000000000..5aa7a1ddef6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002/TestDescription.java @@ -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/ReferenceType/sourceDebugExtension/srcdebugx002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method ReferenceType.sourceDebugExtension() + * properly returns the SourceDebugExtension Class File attribute. + * String obtained from the sourceDebugExtension() is compared with + * the expected attribute string. + * COMMENTS + * The file srcdebugx002x.jcod has been generated by the JCK's SQE tool Jdec + * for the class file compiled by Javac from a source file srcdebugx002x.java + * which is located at the directory srcdebugx.jdec. Please note that only + * the Jcoder tool implemented the RFE 4460411, must be used. + * The test was updated due to the bug 4422724. + * To fix the bug 4493107, a corresponding check is added. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx002 + * nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx002t + * @compile srcdebugx002x.jcod + * @build ExecDriver + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourceDebugExtension.srcdebugx002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002/srcdebugx002x.jcod b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002/srcdebugx002x.jcod new file mode 100644 index 00000000000..ce8fc1c9aab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002/srcdebugx002x.jcod @@ -0,0 +1,125 @@ +/* + * 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. + */ + +class nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x { + 0xCAFEBABE; + 3; // minor version + 45; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #15; // #1 + class #16; // #2 + class #17; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "LineNumberTable"; // #7 + Utf8 "LocalVariableTable"; // #8 + Utf8 "this"; // #9 + Utf8 "Lnsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x;"; // #10 + Utf8 "readiness"; // #11 + Utf8 "()I"; // #12 + Utf8 "SourceFile"; // #13 + Utf8 "srcdebugx002x.java"; // #14 + NameAndType #4 #5; // #15 + Utf8 "nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x"; // #16 + Utf8 "java/lang/Object"; // #17 + Utf8 "SourceDebugExtension"; // #18 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[] { + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#7) { // LineNumberTable + [] { // LineNumberTable + 0 11; + } + } // end LineNumberTable + ; + Attr(#8) { // LocalVariableTable + [] { // LocalVariableTable + 0 5 9 10 0; + } + } // end LocalVariableTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0008; // access + #11; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 0; // max_locals + Bytes[] { + 0x1107D1AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#7) { // LineNumberTable + [] { // LineNumberTable + 0 13; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#13) { // SourceFile + #14; + } // end SourceFile + ; + Attr(#18) { // SourceDebugExtension + 'Hello world!'; // an UTF string without prepended length + } // end SourceDebugExtension + } // Attributes +} // end class nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002t.java new file mode 100644 index 00000000000..f6ac5ccd209 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002t.java @@ -0,0 +1,63 @@ +/* + * 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.ReferenceType.sourceDebugExtension; + +import com.sun.jdi.ReferenceType; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This debuggee class gets the Class object associated with the class + * srcdebugx002x containing the SourceDebugExtension attribute. + */ +public class srcdebugx002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + Class srcdebX; + +// get auxiliary class containing the SourceDebugExtension attribute + try { + srcdebX = Class.forName(srcdebugx002.SRCDEBUGX_CLASS); + } catch(Exception e) { + System.err.println("TEST BUG: caught in debuggee: " + + e); + System.exit(srcdebugx002.JCK_STATUS_BASE + + srcdebugx002.FAILED); + } + + pipe.println(srcdebugx002.COMMAND_READY); + String cmd = pipe.readln(); + if (!cmd.equals(srcdebugx002.COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown debugger command: " + + cmd); + System.exit(srcdebugx002.JCK_STATUS_BASE + + srcdebugx002.FAILED); + } + System.exit(srcdebugx002.JCK_STATUS_BASE + + srcdebugx002.PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x.java new file mode 100644 index 00000000000..f78fa86f046 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceDebugExtension/srcdebugx002x.java @@ -0,0 +1,34 @@ +/* + * 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.ReferenceType.sourceDebugExtension; + +/** + * This is dummy auxiliary class used only in process of generation + * a source file *.jcod for the JCK's SQE tool Jcoder. + */ +public class srcdebugx002x { + static int readiness() { + return 2001; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001.java new file mode 100644 index 00000000000..cf2f6a74260 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001.java @@ -0,0 +1,216 @@ +/* + * 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.ReferenceType.sourceName; + +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 sourceName() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class sourcename001 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class sourceNames of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.sourceName.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "sourcename001", + debugeeName = thisClassName + "a"; + + static String this_class_source_name = "sourcename001.java"; + static String debugee_source_name = "sourcename001a.java"; + + /** Debugee's classes for check **/ + private final static String classes_for_check[][] = { + + {thisClassName, this_class_source_name}, + {debugeeName, debugee_source_name}, + + {package_prefix + "ClassForCheck", debugee_source_name}, + {package_prefix + "InterfaceForCheck", debugee_source_name}, + + {debugeeName+"$s_class", debugee_source_name}, + {debugeeName+"$s_interf", debugee_source_name} + }; + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new sourcename001().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway("\n==> nsk/jdi/ReferenceType/sourceName/sourcename001 test FAILED"); + } + else { + print_log_anyway("\n==> nsk/jdi/ReferenceType/sourceName/sourcename001 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/sourceName/sourcename001 test LOG:"); + print_log_anyway("==> test checks the sourceName() method of ReferenceType interface"); + print_log_anyway(" of the com.sun.jdi package for ClassType, InterfaceType\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> sourcename001: sourcename001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway("##> sourcename001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway("##> sourcename001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> sourcename001: debugee's \"ready\" signal recieved!"); + } + + print_log_anyway + ("--> sourcename001: check ReferenceType.sourceName() method for debugee's classes..."); + int all_classes_count = 0; + int class_not_found_errors = 0; + int sourceName_method_exceptions = 0; + int sourceName_method_errors = 0; + for (int i=0; i sourcename001: Could NOT FIND class: " + className); + class_not_found_errors++; + continue; + } + String ref_type_source_name = null; + try { + ref_type_source_name = refType.sourceName(); + } + catch (Throwable thrown) { + print_log_anyway + ("##> sourcename001: FAILED: refType.sourceName() threw unexpected exception - " + + thrown); + print_log_anyway + ("##> refType = " + refType); + sourceName_method_exceptions++; + continue; + } + if ( ! ref_type_source_name.equals(source_class_name) ) { + print_log_anyway + ("##> sourcename001: FAILED: ReferenceType.sourceName() returned unexpected source name:"); + print_log_anyway + ("##> expected source name = " + source_class_name); + print_log_anyway + ("##> returned source name = " + ref_type_source_name); + sourceName_method_errors++; + } + else { + print_log_on_verbose + ("--> sourcename001: PASSED: ReferenceType.sourceName() returned expected source name:"); + print_log_on_verbose + ("--> checked class source name = " + source_class_name); + print_log_on_verbose + ("--> returned source name = " + ref_type_source_name); + } + } + print_log_anyway("--> sourcename001: check completed!"); + print_log_anyway("--> sourcename001: number of checked classes = " + all_classes_count); + if ( class_not_found_errors > 0 ) { + print_log_anyway("##> sourcename001: \"class not found ERRORS\" number = " + + class_not_found_errors); + } + if ( sourceName_method_exceptions > 0 ) { + print_log_anyway("##> sourcename001: number of unexpected sourceName() methods exceptions = " + + sourceName_method_exceptions); + } + print_log_anyway("##> sourcename001: sourceName() method errors number = " + + sourceName_method_errors); + int v_test_result = 0/*STATUS_PASSED*/; + if (class_not_found_errors + sourceName_method_errors + sourceName_method_exceptions > 0) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> sourcename001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway("##> sourcename001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> sourcename001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001/TestDescription.java new file mode 100644 index 00000000000..65463387a15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ReferenceType/sourceName/sourcename001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/sourceName/sourcename001 test + * checks the sourceName() method of ReferenceType interface + * of the com.sun.jdi package for ClassType, InterfaceType: + * For each checked debugee's class the test gets ReferenceType + * instance for this class and then gets the source name by sourceName() + * method for this ReferenceType instance. + * The test expects that returned source name should be equal to the + * file name which declarates the checked debugee's class. + * COMMENTS + * Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.sourceName.sourcename001 + * nsk.jdi.ReferenceType.sourceName.sourcename001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourceName.sourcename001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001a.java new file mode 100644 index 00000000000..b6d6e49b9ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename001a.java @@ -0,0 +1,100 @@ +/* + * 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.ReferenceType.sourceName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the sourcename001 JDI test. + */ + +public class sourcename001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + // Classes must be loaded and linked, so all fields must be + // initialized + static class s_class {} + s_class s_class_0 = new s_class(), s_class_1[]={s_class_0}; + + // Interfaces must be loaded and linked, so classes that implement + // interfaces must be initialized. + static interface s_interf {} + 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}; + + ClassForCheck class_for_check0 = new ClassForCheck(), + class_for_check1[]={class_for_check0}; + InterfaceForCheck_impl interf_for_check_impl0 = new InterfaceForCheck_impl(); + InterfaceForCheck interf_for_check0, + interf_for_check1[]={interf_for_check0}; + + sourcename001 sourcename001_0 = new sourcename001(), + sourcename001_1[]={sourcename001_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 sourcename001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + sourcename001a sourcename001a_obj = new sourcename001a(); + + print_log_on_verbose("**> sourcename001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> sourcename001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> sourcename001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> sourcename001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> sourcename001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class ClassForCheck {} + +interface InterfaceForCheck {} + +class InterfaceForCheck_impl implements InterfaceForCheck{} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002.java new file mode 100644 index 00000000000..ff5f2a9caf8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002.java @@ -0,0 +1,251 @@ +/* + * 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.ReferenceType.sourceName; + +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 sourceName() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class sourcename002 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class sourceNames of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.sourceName.", + thisClassName = package_prefix + "sourcename002", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "sourcename002b"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new sourcename002().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/sourceName/sourcename002 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/sourceName/sourcename002 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + argv = argsHandler.getArguments(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/sourceName/sourcename002 test LOG:"); + print_log_anyway("--> test checks sourceName() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for UNLOADED class\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> sourcename002: sourcename002a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> sourcename002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + print_log_anyway + ("##> sourcename002: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> sourcename002: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> sourcename002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + print_log_anyway + ("##> sourcename002: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> sourcename002: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean sourceName_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> sourcename002: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> sourcename002: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> sourcename002: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> sourcename002: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> sourcename002: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> sourcename002: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + print_log_anyway + ("--> sourcename002: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + print_log_anyway + ("--> ReferenceType.sourceName() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + print_log_anyway + ("##> sourcename002: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> sourcename002: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> sourcename002: check that checked class has been unloaded really..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> sourcename002: checked class has been unloaded really: " + checked_class); + } + else { + print_log_without_verbose + ("--> sourcename002: check that checked class has been unloaded really..."); + print_log_anyway + ("--> sourcename002: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + print_log_anyway + ("--> ReferenceType.sourceName() method can NOT be checked!"); + break; + } + + print_log_anyway + ("--> sourcename002: check ReferenceType.sourceName() method for unloaded class..."); + String ref_type_sourceName = null; + try { + ref_type_sourceName = refType.sourceName(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + print_log_anyway + ("--> sourcename002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> sourcename002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + sourceName_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || sourceName_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> sourcename002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> sourcename002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> sourcename002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of sourcename002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/TestDescription.java new file mode 100644 index 00000000000..2ef7a03aff6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/TestDescription.java @@ -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/ReferenceType/sourceName/sourcename002. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/sourceName/sourcename002 test + * checks the sourceName() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * sourceName() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - sourcename002b class was moved in 'loadclass' subdirectory; + * - package name was added in sourcename002b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for sourcename002b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.sourceName.sourcename002 + * nsk.jdi.ReferenceType.sourceName.sourcename002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourceName.sourcename002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/loadclass/sourcename002b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/loadclass/sourcename002b.java new file mode 100644 index 00000000000..77582aaba72 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002/loadclass/sourcename002b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the sourceName() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.sourceName; + +class sourcename002b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002a.java new file mode 100644 index 00000000000..dcb2f8ec75f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename002a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.sourceName; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the sourcename002 JDI test. + */ + +public class sourcename002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.sourceName."; + private final static String checked_class_name = package_prefix + "sourcename002b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> sourcename002a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> sourcename002a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> sourcename002a: checked class loaded: " + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + print_log_on_verbose + ("**> sourcename002a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> sourcename002a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> sourcename002a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> sourcename002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> sourcename002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> sourcename002a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> sourcename002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> sourcename002a: \"continue\" signal recieved!"); + print_log_on_verbose("**> sourcename002a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> sourcename002a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> sourcename002a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> sourcename002a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> sourcename002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> sourcename002a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> sourcename002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> sourcename002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of sourcename002a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003.java new file mode 100644 index 00000000000..ac91b7dc2de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003.java @@ -0,0 +1,200 @@ +/* + * 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.ReferenceType.sourceName; + +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 sourceName() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class sourcename003 { + static ArgumentHandler argsHandler; + static Log test_log_handler; + static boolean verbose_mode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + /** The main class sourceNames of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.sourceName.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "sourcename003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = thisClassName + "[]"; + + + /** + * Re-call to run(args,out), 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) { + + int v_test_result = new sourcename003().runThis(argv,out); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/sourceName/sourcename003 test FAILED"); + } + else { + print_log_anyway + ("\n==> nsk/jdi/ReferenceType/sourceName/sourcename003 test PASSED"); + } + return v_test_result; + } + + private static void print_log_on_verbose(String message) { + test_log_handler.display(message); + } + + private static void print_log_without_verbose(String message) { + test_log_handler.comment(message); + } + + private static void print_log_anyway(String message) { + test_log_handler.println(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + argsHandler = new ArgumentHandler(argv); + verbose_mode = argsHandler.verbose(); + test_log_handler = new Log(out, argsHandler); + + print_log_anyway("==> nsk/jdi/ReferenceType/sourceName/sourcename003 test LOG:"); + print_log_anyway("--> test checks sourceName() method of ReferenceType interface "); + print_log_anyway(" of the com.sun.jdi package for class with unknown source name\n"); + + String debugee_launch_command = debugeeName; + + Binder binder = new Binder(argsHandler,test_log_handler); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> sourcename003: sourcename003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + print_log_anyway + ("##> sourcename003: UNEXPECTED debugee's signal (not \"ready\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready")) { + print_log_anyway + ("##> sourcename003: UNEXPECTED debugee's signal (not \"ready\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> sourcename003: debugee's \"ready\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean sourceName_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> sourcename003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> sourcename003: getting ReferenceType object for loaded checked class..."); + print_log_anyway("##> sourcename003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> sourcename003: checked class FOUND: " + checked_class); + } + print_log_anyway + ("--> sourcename003: check ReferenceType.sourceName() method for class with unknown source name..."); + print_log_anyway + ("--> checked class - " + checked_class); + String ref_type_sourceName = null; + try { + ref_type_sourceName = refType.sourceName(); + print_log_anyway + ("##> sourcename003: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> returned sourceName = " + ref_type_sourceName); + print_log_anyway + ("##> expected Exception - com.sun.jdi.AbsentInformationException"); + sourceName_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.AbsentInformationException) { + print_log_anyway + ("--> sourcename003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> sourcename003: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.AbsentInformationException"); + sourceName_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || sourceName_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> sourcename003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> sourcename003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> sourcename003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of sourcename003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003/TestDescription.java new file mode 100644 index 00000000000..a243d9ef162 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ReferenceType/sourceName/sourcename003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/sourceName/sourcename003 test + * checks the sourceName() method of ReferenceType interface + * of the com.sun.jdi package for class with unknown source name: + * the test loads a class with unknown source name, gets + * a ReferenceType instance for this class and calls the + * sourceName() method - the com.sun.jdi.AbsentInformationException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.sourceName.sourcename003 + * nsk.jdi.ReferenceType.sourceName.sourcename003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourceName.sourcename003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003a.java new file mode 100644 index 00000000000..3bdeddb3ec3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename003a.java @@ -0,0 +1,75 @@ +/* + * 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.ReferenceType.sourceName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the sourcename003 JDI test. + */ + +public class sourcename003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + sourcename003 sourcename003_0, sourcename003_1[]={sourcename003_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 sourcename003a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + sourcename003a sourcename003a_obj = new sourcename003a(); + + print_log_on_verbose("**> sourcename003a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> sourcename003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> sourcename003a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> sourcename003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> sourcename003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename004.java new file mode 100644 index 00000000000..ff54267302b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename004.java @@ -0,0 +1,328 @@ +/* + * 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.ReferenceType.sourceName; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.sourceName() + * properly throws AbsentInformationException - if the source + * name is not known.

    + * + * The test exercises the following assertion:
    + * "For arrays (ArrayType) and primitive classes, + * AbsentInformationException is always thrown".
    + * It works as follows. Debugger part attempts to get an identifying + * source name of reference types corresponding to several debuggee fields + * by calling the JDI method. These fields have types of different + * kinds: primitive classes themselves, and arrays of primitive types + * and classes. The exception is expected to be thrown. + */ +public class sourcename004 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.sourceName.sourcename004t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "sourcename004tThr"; + + // name of debuggee method used to find needed stack frame + static final String DEBUGGEE_METHOD = "sourcename004trunIt"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 57; + + static final int FLD_NUM = 24; + // tested fields used to provoke the exception + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new sourcename004().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "sourcename004t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main thread + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) + throw new Failure("method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + Method meth = debuggee.methodByName(rType, DEBUGGEE_METHOD); + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(thrRef, meth); + + for (int i=0; i standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type2(className, testStratumCount); + /* + * Method 'prepareDefaultPathcedClassFile_Type2' creates class file with + * following line mapping for each TestStratum: "Java" "TestStratum" + * + * + * 9 --> 1000, source1, path1 + * 10 --> 1001, source2, path2 + * 11 --> 1002, source3, path3 + * ... + * ... + * + * sde_testMethod1 + * 20 --> 1100, source1, path1 + * 21 --> 1101, source2, path2 + * 22 --> 1102, source3, path3 + * ... + * ... + * + * sde_testMethod2 + * 31 --> 1200, source1, path1 + * 32 --> 1201, source2, path2 + * 33 --> 1207, source3, path3 + * ... + * ... + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + log.display("Check sources for stratum: '" + stratumName + "'"); + + LocationsData locationsData = testStratumData.get(stratumName); + + // create list with expected sources + List sourceNames = new ArrayList(); + sourceNames.addAll(locationsData.sourceLocations.keySet()); + + check_ReferenceType_sourceNames(referenceType, stratumName, sourceNames); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java new file mode 100644 index 00000000000..2871d7134c5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java @@ -0,0 +1,244 @@ +/* + * 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.ReferenceType.sourceNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.sourceNames(String)
    + * complies with its specification.
    + *
    + * The case for testing includes a Class type in a debuggee, and
    + * debuggee's sourcecode file with a predefined name.
    + * A debugger gets ReferenceType object, mirroring tested Class and
    + * performs the following:
    + * - gets a List returned by the method
    + * ReferenceType.sourceNames(defaultStratum);
    + * - checks that the List contains only one String element which,
    + * is equal to the predefined one.
    + */ + +public class sourcenames001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/sourceNames/sourcenames001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new sourcenames001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.sourceNames.sourcenames001a"; + + //String mName = "nsk.jdi.ReferenceType.sourceNames"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List sourceNames = null; + ReferenceType refType = null; + + log2(" getting: List classes = vm.classesByName(debuggeeName);"); + List classes = vm.classesByName(debuggeeName); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested ReferenceType object 'refType'"); + refType = (ReferenceType) classes.get(0); + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + log2("......sourceNames = refType.sourceNames(defaultStratum);"); + log2(" no AbsentInformationException is expected"); + try { + sourceNames = refType.sourceNames(defaultStratum); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + break ; + } + + log2("......checking up on a value of sourceNames.size(); 1 is expected"); + if (sourceNames.size() != 1) { + testExitCode = FAILED; + log3("ERROR: sourceNames.size() != 1"); + break ; + } + + log2("......getting: String sourceName = sourceNames.get(0);"); + String sourceName; + try { + sourceName = (String) sourceNames.get(0); + log2(" sourceName == " + sourceName); + } catch ( Exception e ) { + log3("ERROR: exception thrown : " + e); + testExitCode = FAILED; + break ; + } + log2("......checking up on equality: sourceName.equals('sourcenames001a.java')"); + if (!sourceName.equals("sourcenames001a.java")) { + log3("ERROR: sourceName is not equal to 'sourcenames001a.java' : " + sourceName); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001/TestDescription.java new file mode 100644 index 00000000000..45b53cbf670 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001/TestDescription.java @@ -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/ReferenceType/sourceNames/sourcenames001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.sourceNames() + * complies with its spec: + * public List sourceNames(String stratum) + * throws AbsentInformationException + * Gets the identifying names for all the source corresponding to + * the declaration of this type. Interpretation of these names is the + * responsibility of the source repository mechanism. + * The returned names are for the specified stratum + * (see Location for a description of strata). + * In the reference implementation, when using the Java programming language stratum, + * the returned List contains one element: + * a String which is the unqualified name of the source file + * containing the declaration of this type. + * In other strata the returned source names are + * all the source names defined for that stratum. + * Parameters: stratum - The stratum to retrieve information from or + * null for the declaring type's default stratum. + * Returns: a List of String objects each representing a source name + * Throws: AbsentInformationException - + * if the source names are not known. + * For arrays (ArrayType) and primitive classes, + * AbsentInformationException is always thrown. + * The case for testing includes a Class type in a debuggee, and + * debuggee's sourcecode file with a predefined name. + * No AbsentInformationException is expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.sourceNames.sourcenames001; + * the debuggee program - nsk.jdi.ReferenceType.sourceNames.sourcenames001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.sourceNames.sourcenames001 + * nsk.jdi.ReferenceType.sourceNames.sourcenames001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourceNames.sourcenames001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001a.java new file mode 100644 index 00000000000..7cb91e2ffe2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001a.java @@ -0,0 +1,111 @@ +/* + * 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.ReferenceType.sourceNames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the sourcenames001 JDI test. + */ + +public class sourcenames001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType.sourceNames() + * properly throws AbsentInformationException - if the source + * names are not known.

    + * + * The test exercises the following assertion:
    + * "For arrays (ArrayType) and primitive classes, + * AbsentInformationException is always thrown".
    + * It works as follows. Debugger part attempts to get identifying + * source names of reference types corresponding to several debuggee + * fields by calling the JDI method. These fields have types of + * different kinds: primitive classes themselves, and arrays of + * primitive types and classes. The exception is expected to be thrown. + */ +public class sourcenames002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.sourceNames.sourcenames002t"; + + // name of debuggee main thread + static final String DEBUGGEE_THRNAME = "sourcenames002tThr"; + + // name of debuggee method used to find needed stack frame + static final String DEBUGGEE_METHOD = "sourcenames002trunIt"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 57; + + static final int FLD_NUM = 24; + // tested fields used to provoke the exception + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new sourcenames002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "sourcenames002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main thread + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) + throw new Failure("method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + Method meth = debuggee.methodByName(rType, DEBUGGEE_METHOD); + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + ObjectReference objRef = findObjRef(thrRef, meth); + + for (int i=0; i standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type2(className, testStratumCount); + /* + * Method 'prepareDefaultPathcedClassFile_Type2' creates SDE with + * following source map: "Java" "TestStratum" + * + * + * 9 --> 1000, source1, path1 + * 10 --> 1001, source1, path1 + * ... + * 16 --> 1007, source1, path1 + * + * testMethod1 + * 20 --> 1100, source2, path2 + * 21 --> 1101, source2, path2 + * ... + * 27 --> 1107, source2, path2 + * + * testMethod1 + * 31 --> 1200, source3, path3 + * 32 --> 1201, source3, path3 + * ... + * 38 --> 1207, source3, path3 + */ + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + for (String stratumName : testStratumData.keySet()) { + log.display("Check paths for stratum: '" + stratumName + "'"); + + LocationsData locationsData = testStratumData.get(stratumName); + check_ReferenceType_sourcePaths(referenceType, stratumName, locationsData.paths); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java new file mode 100644 index 00000000000..7961d33699e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java @@ -0,0 +1,282 @@ +/* + * 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.ReferenceType.sourcePaths; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ReferenceType.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ReferenceType.sourcePaths()
    + * complies with its specification.
    + *
    + * The case for testing debuggee's sourcecode file with a predefined name
    + * and a predefined package name.
    + * A debugger gets ReferenceType object, mirroring debuggee's Class and
    + * performs the following:
    + * - gets a List returned by the method
    + * ReferenceType.sourcePaths(defaultStratum);
    + * - checks that the List contains only one String element which,
    + * is equal to the String which is concatenation of the package name
    + * and the sourceName.
    + */ + +public class sourcepaths001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ReferenceType/sourcePaths/sourcepaths001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new sourcepaths001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ReferenceType.sourcePaths.sourcepaths001a"; + + //String mName = "nsk.jdi.ReferenceType.sourcePaths"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List sourcePaths = null; + List sourceNames = null; + ReferenceType refType = null; + + log2(" getting: List classes = vm.classesByName(debuggeeName);"); + List classes = vm.classesByName(debuggeeName); + + if (classes.size() != 1) { + testExitCode = FAILED; + log3("ERROR: classes.size() != 1"); + break ; + } + + log2(" getting a tested ReferenceType object 'refType'"); + refType = (ReferenceType) classes.get(0); + + log2("...... getting : String defaultStratum = vm.getDefaultStratum();"); + String defaultStratum = vm.getDefaultStratum(); + + log2("......sourcePaths = refType.sourcePaths(defaultStratum);"); + log2(" no AbsentInformationException is expected"); + try { + sourcePaths = refType.sourcePaths(defaultStratum); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + break ; + } + + log2("......checking up on a value of sourcePaths.size(); 1 is expected"); + if (sourcePaths.size() != 1) { + testExitCode = FAILED; + log3("ERROR: sourcePaths.size() != 1"); + break ; + } + + log2("......getting: String sourcePath = sourcePaths.get(0);"); + String sourcePath; + try { + sourcePath = (String) sourcePaths.get(0); + log2(" sourcePath == " + sourcePath); + } catch ( Exception e ) { + log3("ERROR: exception thrown : " + e); + testExitCode = FAILED; + break ; + } + + log2("......sourceNames = refType.sourceNames(defaultStratum);"); + log2(" no AbsentInformationException is expected"); + try { + sourceNames = refType.sourceNames(defaultStratum); + } catch ( AbsentInformationException e ) { + testExitCode = FAILED; + log3("ERROR: AbsentInformationException"); + break ; + } + + log2("......checking up on a value of sourceNames.size(); 1 is expected"); + if (sourceNames.size() != 1) { + testExitCode = FAILED; + log3("ERROR: sourceNames.size() != 1"); + break ; + } + + log2("......getting: String sourceName = sourceNames.get(0);"); + String sourceName; + try { + sourceName = (String) sourceNames.get(0); + log2(" sourceName == " + sourceName); + } catch ( Exception e ) { + log3("ERROR: exception thrown : " + e); + testExitCode = FAILED; + break ; + } + + log2("......forming String debuggeeSourcePath : package name + sourceName"); + String sep = System.getProperty("file.separator"); + String debuggeeSourcePath = "nsk" + sep + "jdi" + sep + "ReferenceType" + sep + + "sourcePaths" + sep + sourceName; + + log2("......compareing: sourcePath to debuggeeSourcePath"); + if (!sourcePath.equals(debuggeeSourcePath)) { + log3("ERROR: sourcePath != debuggeeSourcePath"); + log3(" sourcePath == " + sourcePath); + log3(" debuggeeSourcePath == " + debuggeeSourcePath); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001/TestDescription.java new file mode 100644 index 00000000000..4d9514eae1b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/ReferenceType/sourcePaths/sourcepaths001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ReferenceType. + * The test checks up that a result of the method + * com.sun.jdi.ReferenceType.sourcePaths() + * complies with its spec: + * public List sourcePaths(String stratum) + * throws AbsentInformationException + * Gets the paths to the source corresponding to the declaration of this type. + * Interpretation of these paths is the responsibility of + * the source repository mechanism. + * The returned paths are for the specified stratum + * (see Location for a description of strata). + * In the reference implementation, for strata + * which do not explicitly specify source path + * (the Java programming language stratum never does), + * the returned strings are the sourceNames(String) prefixed by + * the package name of this ReferenceType converted to + * a platform dependent path. For example, on a Windows platform, + * java.lang.Thread would return a List containing one element: + * "java\lang\Thread.java". + * Parameters: stratum - The stratum to retrieve information from or + * null for the declaring type's default stratum. + * Returns: a List of String objects each representing a source path + * Throws: AbsentInformationException - + * if the source names are not known. + * For arrays (ArrayType) and primitive classes, + * AbsentInformationException is always thrown. + * The case for testing debuggee's sourcecode file with a predefined name + * and a predefined package name. + * The test works as follows: + * The debugger program - nsk.jdi.ReferenceType.sourcePaths.sourcepaths001; + * the debuggee program - nsk.jdi.ReferenceType.sourcePaths.sourcepaths001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ReferenceType.sourcePaths.sourcepaths001 + * nsk.jdi.ReferenceType.sourcePaths.sourcepaths001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.sourcePaths.sourcepaths001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001a.java new file mode 100644 index 00000000000..074b833f3e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001a.java @@ -0,0 +1,111 @@ +/* + * 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.ReferenceType.sourcePaths; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the sourcepaths001 JDI test. + */ + +public class sourcepaths001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; icom.sun.jdi.ReferenceType.sourcePaths() + * properly throws AbsentInformationException - if the source + * paths are not known.

    + * + * The test exercises the following assertion:
    + * "For arrays (ArrayType) and primitive classes, + * AbsentInformationException is always thrown".
    + * Debugger part attempts to get paths to the sources corresponding + * to the declaration types of several debuggee fields, which are:
    + * primitive classes themselves, and arrays of primitive types and classes. + */ +public class sourcepaths002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.sourcePaths.sourcepaths002t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested fields used to provoke the exception + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new sourcepaths002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "sourcepaths002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; ivisibleFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibfield001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleFields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibfield001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibfield001aClassForCheck"; + private final static String not_visible_sign = "NOT VISIBLE"; + private final static String passed_sign = "PASSED"; + private static String fields_for_check[][] = { + +// field name type name static check result + {"s_boolean_field", "boolean", " static", not_visible_sign }, + {"s_byte_field", "byte", " static", not_visible_sign }, + {"s_char_field", "char", " static", not_visible_sign }, + {"s_double_field", "double", " static", not_visible_sign }, + {"s_float_field", "float", " static", not_visible_sign }, + {"s_int_field", "int", " static", not_visible_sign }, + {"s_long_field", "long", " static", not_visible_sign }, + {"s_object_field", "java.lang.Object", " static", not_visible_sign }, + {"s_prim_array_field", "long[]", " static", not_visible_sign }, + {"s_ref_array_field", "java.lang.Object[]", " static", not_visible_sign }, + {"i_boolean_field", "boolean", "", not_visible_sign }, + {"i_byte_field", "byte", "", not_visible_sign }, + {"i_char_field", "char", "", not_visible_sign }, + {"i_double_field", "double", "", not_visible_sign }, + {"i_float_field", "float", "", not_visible_sign }, + {"i_int_field", "int", "", not_visible_sign }, + {"i_long_field", "long", "", not_visible_sign }, + {"i_object_field", "java.lang.Object", "", not_visible_sign }, + {"i_prim_array_field", "long[]", "", not_visible_sign }, + {"i_ref_array_field", "java.lang.Object[]", "", not_visible_sign }, + {"s_super_hidden_prim_field", "int", " static", not_visible_sign }, + {"s_super_hidden_ref_field", "java.lang.Class", " static", not_visible_sign }, + {"i_super_hidden_prim_field", "int", " static", not_visible_sign }, + {"i_super_hidden_ref_field", "java.lang.Class", " static", not_visible_sign }, + {"s_interf_hidden_prim_field", "int", " static", not_visible_sign }, + {"s_interf_hidden_ref_field", "java.lang.Class", " static", not_visible_sign }, + {"s_super_boolean_field", "boolean", " static", not_visible_sign }, + {"s_super_byte_field", "byte", " static", not_visible_sign }, + {"s_super_char_field", "char", " static", not_visible_sign }, + {"s_super_double_field", "double", " static", not_visible_sign }, + {"s_super_float_field", "float", " static", not_visible_sign }, + {"s_super_int_field", "int", " static", not_visible_sign }, + {"s_super_long_field", "long", " static", not_visible_sign }, + {"s_super_object_field", "java.lang.Object", " static", not_visible_sign }, + {"i_super_boolean_field", "boolean", "", not_visible_sign }, + {"i_super_byte_field", "byte", "", not_visible_sign }, + {"i_super_char_field", "char", "", not_visible_sign }, + {"i_super_double_field", "double", "", not_visible_sign }, + {"i_super_float_field", "float", "", not_visible_sign }, + {"i_super_int_field", "int", "", not_visible_sign }, + {"i_super_long_field", "long", "", not_visible_sign }, + {"i_super_object_field", "java.lang.Object", "", not_visible_sign }, + {"s_interf_boolean_field", "boolean", " static", not_visible_sign }, + {"s_interf_byte_field", "byte", " static", not_visible_sign }, + {"s_interf_char_field", "char", " static", not_visible_sign }, + {"s_interf_double_field", "double", " static", not_visible_sign }, + {"s_interf_float_field", "float", " static", not_visible_sign }, + {"s_interf_int_field", "int", " static", not_visible_sign }, + {"s_interf_long_field", "long", " static", not_visible_sign }, + {"s_interf_object_field", "java.lang.Object", " static", not_visible_sign } + + }; + + /** + * Re-call to run(args,out), 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 visibfield001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleFields/visibfield001 test LOG:"); + out_stream.println("==> test checks visibleFields() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibfield001: visibfield001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> visibfield001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> visibfield001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibfield001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> visibfield001: check ReferenceType.visibleFields() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleFields_method_error = false; + int fields_for_check_number = fields_for_check.length; + int not_visible_fields_number = 0; + int visible_fields_number = 0; + int unexpected_visible_fields_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> visibfield001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List visible_fields_list = null; + try { + visible_fields_list = refType.visibleFields(); + } + catch (Throwable thrown) { + out_stream.println("##> visibfield001: FAILED: ReferenceType.visibleFields() throws unexpected " + + thrown); + visibleFields_method_error = true; + break; + } + visible_fields_number = visible_fields_list.size(); + Field visible_fields[] = new Field[visible_fields_number]; + String unexpected_visible_fields[] = new String[visible_fields_number]; + visible_fields_list.toArray(visible_fields); + for (int i=0; i visibfield001: FAILED: field is NOT visible: " + current_field_for_check); + not_visible_fields_number++; + } + else { + print_log_on_verbose + ("--> visibfield001: PASSED for field: " + current_field_for_check); + } + } + for (int i=0; i visibfield001: FAILED: unexpected visible field: " + unexpected_visible_fields[i]); + } + break; + } + + out_stream.println("--> visibfield001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println("--> visibfield001: expected visible fields number = " + fields_for_check_number); + out_stream.println("--> visibfield001: in fact visible fields number = " + visible_fields_number); + out_stream.println("--> visibfield001: expected and in fact visible fields number = " + + (fields_for_check_number - not_visible_fields_number)); + out_stream.println + ("##> visibfield001: NOT visible fields number = " + not_visible_fields_number); + out_stream.println + ("##> visibfield001: UNEXPECTED visible fields number = " + unexpected_visible_fields_number); + } + if ( not_visible_fields_number + unexpected_visible_fields_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibfield001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibfield001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibfield001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield001/TestDescription.java new file mode 100644 index 00000000000..8c80682a2a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ReferenceType/visibleFields/visibfield001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleFields/visibfield001 test + * checks the visibleFields() method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.visibleFields() method is checked for fields of + * debugee's class which extends super class and implements interface. + * Debugee's class has both hidden and ambiguous fields which should + * be not visible. + * Each visible field is checked for field name, field type and + * static modifier. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleFields.visibfield001 + * nsk.jdi.ReferenceType.visibleFields.visibfield001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleFields.visibfield001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield001a.java new file mode 100644 index 00000000000..208a73ad90a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield001a.java @@ -0,0 +1,163 @@ +/* + * 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.ReferenceType.visibleFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibfield001 JDI test. + */ + +public class visibfield001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 visibfield001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + visibfield001aClassForCheck class_for_check = new visibfield001aClassForCheck(); + + print_log_on_verbose("**> visibfield001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibfield001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibfield001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibfield001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibfield001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class visibfield001aClassForCheck extends visibfield001aSuperClassForCheck + implements visibfield001aInterfaceForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + static long[] s_prim_array_field; + static Object[] s_ref_array_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + long[] i_prim_array_field; + Object[] i_ref_array_field; + + static int s_super_hidden_prim_field; + static Class s_super_hidden_ref_field; + + static int i_super_hidden_prim_field; + static Class i_super_hidden_ref_field; + + static int s_interf_hidden_prim_field; + static Class s_interf_hidden_ref_field; + +} + +class visibfield001aSuperClassForCheck { + + static boolean s_super_boolean_field; + static byte s_super_byte_field; + static char s_super_char_field; + static double s_super_double_field; + static float s_super_float_field; + static int s_super_int_field; + static long s_super_long_field; + static Object s_super_object_field; + + static long s_super_hidden_prim_field; + static Object s_super_hidden_ref_field; + + boolean i_super_boolean_field; + byte i_super_byte_field; + char i_super_char_field; + double i_super_double_field; + float i_super_float_field; + int i_super_int_field; + long i_super_long_field; + Object i_super_object_field; + + long i_super_hidden_prim_field; + Object i_super_hidden_ref_field; + + int ambiguous_prim_field; + Class ambiguous_ref_field; + +} + +interface visibfield001aInterfaceForCheck { + + static final boolean s_interf_boolean_field = true; + static final byte s_interf_byte_field = (byte)1; + static final char s_interf_char_field = '1'; + static final double s_interf_double_field = 999; + static final float s_interf_float_field = 99; + static final int s_interf_int_field = 100; + static final long s_interf_long_field = 1000; + static final Object s_interf_object_field = new Object(); + + static final long s_interf_hidden_prim_field = 1; + static final Object s_interf_hidden_ref_field = new Object(); + + static final long ambiguous_prim_field = 1; + static final Object ambiguous_ref_field = new Object(); + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002.java new file mode 100644 index 00000000000..d001e50c141 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002.java @@ -0,0 +1,221 @@ +/* + * 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.ReferenceType.visibleFields; + +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 visibleFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibfield002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleFields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibfield002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibfield002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "visibfield002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** + * Re-call to run(args,out), 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 visibfield002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/visibleFields/visibfield002 test LOG:"); + print_log_on_verbose("==> test checks visibleFields() method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibfield002: visibfield002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> visibfield002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> visibfield002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibfield002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> visibfield002: check ReferenceType.visibleFields() method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleFields_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> visibfield002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> visibfield002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List visible_fields_list = null; + try { + visible_fields_list = refType.visibleFields(); + print_log_anyway + ("##> visibfield002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + visibleFields_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> visibfield002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> visibfield002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + visibleFields_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibfield002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> visibfield002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibfield002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002/TestDescription.java new file mode 100644 index 00000000000..14e44821539 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/visibleFields/visibfield002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleFields/visibfield002 test + * checks the visibleFields() method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.visibleFields() method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleFields.visibfield002 + * nsk.jdi.ReferenceType.visibleFields.visibfield002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleFields.visibfield002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002/loadclass/visibfield002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002/loadclass/visibfield002aClassForCheck.java new file mode 100644 index 00000000000..574d2b694bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002/loadclass/visibfield002aClassForCheck.java @@ -0,0 +1,52 @@ +/* + * 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.ReferenceType.visibleFields; + +/** + * This class is loaded by visibfield002aClassLoader . + */ + +class visibfield002aClassForCheck { + + // static fields + static boolean s_boolean_field; + static byte s_byte_field; + static char s_char_field; + static double s_double_field; + static float s_float_field; + static int s_int_field; + static long s_long_field; + static Object s_object_field; + + // instance fields + boolean i_boolean_field; + byte i_byte_field; + char i_char_field; + double i_double_field; + float i_float_field; + int i_int_field; + long i_long_field; + Object i_object_field; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002a.java new file mode 100644 index 00000000000..b8b7ac9f591 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.visibleFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the visibfield002 JDI test. + */ + +public class visibfield002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleFields."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "visibfield002aClassForCheck"; + + 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 visibfield002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + visibfield002aClassLoader customClassLoader = new visibfield002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> visibfield002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> visibfield002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> visibfield002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibfield002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibfield002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibfield002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibfield002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class visibfield002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public visibfield002aClassLoader(String classPath, String className) { + super(visibfield002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003.java new file mode 100644 index 00000000000..8c452d84e89 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003.java @@ -0,0 +1,255 @@ +/* + * 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.ReferenceType.visibleFields; + +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 visibleFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibfield003 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleFields.", + thisClassName = package_prefix + "visibfield003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "visibfield003b"; + + + /** + * Re-call to run(args,out), 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 visibfield003().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield003 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield003 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleFields/visibfield003 test LOG:"); + out_stream.println("--> test checks visibleFields() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibfield003: visibfield003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> visibfield003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> visibfield003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibfield003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> visibfield003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> visibfield003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibfield003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean visibleFields_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> visibfield003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> visibfield003: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> visibfield003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> visibfield003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> visibfield003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> visibfield003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> visibfield003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.visibleFields() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> visibfield003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibfield003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> visibfield003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> visibfield003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> visibfield003: check that checked class has been unloaded realy..."); + out_stream.println + ("--> visibfield003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.visibleFields() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> visibfield003: check ReferenceType.visibleFields() method for unloaded class..."); + List visible_fields_list = null; + try { + visible_fields_list = refType.visibleFields(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> visibfield003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> visibfield003: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + visibleFields_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibfield003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibfield003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibfield003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of visibfield003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/TestDescription.java new file mode 100644 index 00000000000..95b570009e9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/TestDescription.java @@ -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/ReferenceType/visibleFields/visibfield003. + * VM Testbase keywords: [jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleFields/visibfield003 test + * checks the visibleFields() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * visibleFields() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - visibfield003b class was moved in 'loadclass' subdirectory; + * - package name was added in visibfield003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for visibfield003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleFields.visibfield003 + * nsk.jdi.ReferenceType.visibleFields.visibfield003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleFields.visibfield003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/loadclass/visibfield003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/loadclass/visibfield003b.java new file mode 100644 index 00000000000..ccbdfcf8dfd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003/loadclass/visibfield003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the visibleFields() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.visibleFields; + +class visibfield003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003a.java new file mode 100644 index 00000000000..56be764f85b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield003a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.visibleFields; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibfield003 JDI test. + */ + +public class visibfield003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.visibleFields."; + private final static String checked_class_name = package_prefix + "visibfield003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> visibfield003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> visibfield003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> visibfield003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> visibfield003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> visibfield003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> visibfield003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibfield003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibfield003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> visibfield003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> visibfield003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> visibfield003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> visibfield003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> visibfield003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> visibfield003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> visibfield003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibfield003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibfield003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibfield003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibfield003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of visibfield003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004.java new file mode 100644 index 00000000000..7c9b4e7c34d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004.java @@ -0,0 +1,208 @@ +/* + * 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.ReferenceType.visibleFields; + +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 visibleFields() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibfield004 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleFields.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibfield004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibfield004aClassForCheck"; + + /** + * Re-call to run(args,out), 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 visibfield004().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield004 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleFields/visibfield004 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleFields/visibfield004 test LOG:"); + out_stream.println("==> test checks visibleFields() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for class without visible fields\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibfield004: visibfield004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> visibfield004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> visibfield004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibfield004: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> visibfield004: check ReferenceType.visibleFields() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleFields_method_error = false; + int visible_fields_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> visibfield004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List visible_fields_list = null; + try { + visible_fields_list = refType.visibleFields(); + } + catch (Throwable thrown) { + out_stream.println("##> visibfield004: FAILED: ReferenceType.visibleFields() throws unexpected " + + thrown); + visibleFields_method_error = true; + break; + } + visible_fields_number = visible_fields_list.size(); + if ( visible_fields_number == 0 ) { + break; + } + Field visible_fields[] = new Field[visible_fields_number]; + visible_fields_list.toArray(visible_fields); + for (int i=0; i visibfield004: FAILED: unexpected visible field: " + full_checked_field); + } + break; + } + + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleFields_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + if ( visible_fields_number > 0 ) { + out_stream.println + ("##> visibfield004: UNEXPECTED visible fields number = " + visible_fields_number); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> visibfield004: PASSED: returned list of fields is empty!"); + } + + print_log_on_verbose("--> visibfield004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibfield004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibfield004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004/TestDescription.java new file mode 100644 index 00000000000..af1420fb44f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/visibleFields/visibfield004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleFields/visibfield004 test + * checks the visibleFields() method of ReferenceType interface + * of the com.sun.jdi package for class without visible fields: + * the ReferenceType.visibleFields() method is checked for fields of + * debugee's class which extends super class and implements interface. + * Debugee's class has only ambiguous fields which should + * be not visible. + * The test expects the returned list of fields to be empty. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleFields.visibfield004 + * nsk.jdi.ReferenceType.visibleFields.visibfield004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleFields.visibfield004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004a.java new file mode 100644 index 00000000000..acca91d0c43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield004a.java @@ -0,0 +1,91 @@ +/* + * 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.ReferenceType.visibleFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibfield004 JDI test. + */ + +public class visibfield004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 visibfield004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + visibfield004aClassForCheck class_for_check = new visibfield004aClassForCheck(); + + print_log_on_verbose("**> visibfield004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibfield004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibfield004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> visibfield004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> visibfield004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class visibfield004aClassForCheck extends visibfield004aSuperClassForCheck + implements visibfield004aInterfaceForCheck {} + +class visibfield004aSuperClassForCheck { + + int ambiguous_prim_field; + Class ambiguous_ref_field; + +} + +interface visibfield004aInterfaceForCheck { + + static final long ambiguous_prim_field = 1; + static final Object ambiguous_ref_field = new Object(); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield005.java new file mode 100644 index 00000000000..f13995bd242 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield005.java @@ -0,0 +1,287 @@ +/* + * 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.ReferenceType.visibleFields; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.visibleFields() + * properly returns an empty field list for arrays (ArrayType) and primitive + * classes.

    + * + * Debugger part of it attempts to get a list of visible fields in several + * reference types corresponding to debuggee field values, which themselves + * are:
    + * primitive classes, and arrays of primitive types and classes. + */ +public class visibfield005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.visibleFields.visibfield005t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested fields used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new visibfield005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "visibfield005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i " + 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 < 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(); + + // check there are enum constant fields + List l = checkedClass.visibleFields(); + if (l.isEmpty()) { + complain("\t ReferenceType.visibleFields() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + for (int i = 0; i < expectedEnumFieldsNames.length; i++) { + boolean hasField = false; + + Iterator it = l.iterator(); + while (it.hasNext()) { + Field checkedField = it.next(); + if (expectedEnumFieldsNames[i].equals(checkedField.name()) && + checkedField.type().equals(checkedClass) ) + + hasField = true; + } + if (hasField) { + display("enum " + className + " has field " + expectedEnumFieldsNames[i]); + display("\t of type " + className); + } else { + complain("enum " + className + " does not have field " + expectedEnumFieldsNames[i]); + complain("\t of type " + className); + exitStatus = Consts.TEST_FAILED; + } + } + // check that ambiguous field in not returned + Iterator it = l.iterator(); + while (it.hasNext()) { + Field field = it.next(); + if (field.name().equals("i1")) { + complain("enum " + className + " has ambigous field i1 "); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006/TestDescription.java new file mode 100644 index 00000000000..66fd45ba19c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006/TestDescription.java @@ -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/ReferenceType/visibleFields/visibfield006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for visibleFields() method of ReferenceType interface. + * The test checks if the method returns all enum constants + * declared in mirrored enum type and does not return any + * ambiguous inherited field. + * The test consists of a debugger program (visibfield006.java) + * and debuggee application (visibfield006a.java). + * Package name is nsk.jdi.ReferenceType.visibleFields . + * 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 visibleFields() method for each field + * of enum type declared in visibfield006a class. Every of these + * enum types has the same enum constants, i.e fields: e1 and e2, + * which must be included in result list. Some of checked enum + * types implement visibfield006i1 and visibfield006i2 interfaces. + * These interfaces have int field of same name i1. These fields + * are ambigous in enum types and should not be returned by + * visibleFields() method. + * 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.ReferenceType.visibleFields.visibfield006 + * nsk.jdi.ReferenceType.visibleFields.visibfield006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleFields.visibfield006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006a.java new file mode 100644 index 00000000000..cf14b56585c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006a.java @@ -0,0 +1,115 @@ +/* + * 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.ReferenceType.visibleFields; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class visibfield006a { + + //------------------------------------------------------- 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 visibfield006Enum1 f1 = visibfield006Enum1.e2; + static visibfield006Enum2 f2 = visibfield006Enum2.e1; + static visibfield006Enum1.Enum1_ f3 = visibfield006Enum1.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(visibfield006.SIGNAL_READY); + receiveSignal(visibfield006.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum visibfield006Enum1 implements visibfield006i1, visibfield006i2 { + e1, e2; + + enum Enum1_ implements visibfield006i1, visibfield006i2 { + e1, e2; + } +} + +enum visibfield006Enum2 implements visibfield006i1, visibfield006i2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} + +interface visibfield006i1 { + public final int i1 = 1; +} + +interface visibfield006i2 { + public final int i1 = 1; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001.java new file mode 100644 index 00000000000..e4912181f04 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001.java @@ -0,0 +1,350 @@ +/* + * 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.ReferenceType.visibleMethods; + +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 visibleMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibmethod001 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibmethod001", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibmethod001aClassForCheck"; + private final static String super_class_for_check = package_prefix + "visibmethod001aSuperClassForCheck"; + private final static String interface_for_check = package_prefix + "visibmethod001aInterfaceForCheck"; + private final static String not_visible_sign = "NOT VISIBLE"; + private final static String passed_sign = "PASSED"; + private final static String Object_class_name = "java.lang.Object"; + private static String methods_for_check[][] = { + +// method name declaring class check result + + {"", class_for_check, not_visible_sign}, + {"ClassForCheck", class_for_check, not_visible_sign}, + {"s_void_method", class_for_check, not_visible_sign}, + {"s_boolean_method", class_for_check, not_visible_sign}, + {"s_byte_method", class_for_check, not_visible_sign}, + {"s_char_method", class_for_check, not_visible_sign}, + {"s_double_method", class_for_check, not_visible_sign}, + {"s_float_method", class_for_check, not_visible_sign}, + {"s_int_method", class_for_check, not_visible_sign}, + {"s_long_method", class_for_check, not_visible_sign}, + {"s_string_method", class_for_check, not_visible_sign}, + {"s_object_method", class_for_check, not_visible_sign}, + {"s_prim_array_method", class_for_check, not_visible_sign}, + {"s_ref_array_method", class_for_check, not_visible_sign}, + {"s_super_hidden_void_method", class_for_check, not_visible_sign}, + {"s_super_hidden_prim_method", class_for_check, not_visible_sign}, + {"s_super_hidden_ref_method", class_for_check, not_visible_sign}, + {"s_void_par_method", class_for_check, not_visible_sign}, + {"s_boolean_par_method", class_for_check, not_visible_sign}, + {"s_byte_par_method", class_for_check, not_visible_sign}, + {"s_char_par_method", class_for_check, not_visible_sign}, + {"s_double_par_method", class_for_check, not_visible_sign}, + {"s_float_par_method", class_for_check, not_visible_sign}, + {"s_int_par_method", class_for_check, not_visible_sign}, + {"s_long_par_method", class_for_check, not_visible_sign}, + {"s_string_par_method", class_for_check, not_visible_sign}, + {"s_object_par_method", class_for_check, not_visible_sign}, + {"s_prim_array_par_method", class_for_check, not_visible_sign}, + {"s_ref_array_par_method", class_for_check, not_visible_sign}, + {"s_super_hidden_void_par_method", class_for_check, not_visible_sign}, + {"s_super_hidden_prim_par_method", class_for_check, not_visible_sign}, + {"s_super_hidden_ref_par_method", class_for_check, not_visible_sign}, + {"s_native_method", class_for_check, not_visible_sign}, + {"s_synchr_method", class_for_check, not_visible_sign}, + {"s_final_method", class_for_check, not_visible_sign}, + {"s_private_method", class_for_check, not_visible_sign}, + {"s_protected_method", class_for_check, not_visible_sign}, + {"s_public_method", class_for_check, not_visible_sign}, + {"i_void_method", class_for_check, not_visible_sign}, + {"i_boolean_method", class_for_check, not_visible_sign}, + {"i_byte_method", class_for_check, not_visible_sign}, + {"i_char_method", class_for_check, not_visible_sign}, + {"i_double_method", class_for_check, not_visible_sign}, + {"i_float_method", class_for_check, not_visible_sign}, + {"i_int_method", class_for_check, not_visible_sign}, + {"i_long_method", class_for_check, not_visible_sign}, + {"i_string_method", class_for_check, not_visible_sign}, + {"i_object_method", class_for_check, not_visible_sign}, + {"i_prim_array_method", class_for_check, not_visible_sign}, + {"i_ref_array_method", class_for_check, not_visible_sign}, + {"i_super_overridden_void_method", class_for_check, not_visible_sign}, + {"i_super_overridden_prim_method", class_for_check, not_visible_sign}, + {"i_super_overridden_ref_method", class_for_check, not_visible_sign}, + {"i_interf_overridden_void_method", class_for_check, not_visible_sign}, + {"i_interf_overridden_prim_method", class_for_check, not_visible_sign}, + {"i_interf_overridden_ref_method", class_for_check, not_visible_sign}, + {"i_void_par_method", class_for_check, not_visible_sign}, + {"i_boolean_par_method", class_for_check, not_visible_sign}, + {"i_byte_par_method", class_for_check, not_visible_sign}, + {"i_char_par_method", class_for_check, not_visible_sign}, + {"i_double_par_method", class_for_check, not_visible_sign}, + {"i_float_par_method", class_for_check, not_visible_sign}, + {"i_int_par_method", class_for_check, not_visible_sign}, + {"i_long_par_method", class_for_check, not_visible_sign}, + {"i_string_par_method", class_for_check, not_visible_sign}, + {"i_object_par_method", class_for_check, not_visible_sign}, + {"i_prim_array_par_method", class_for_check, not_visible_sign}, + {"i_ref_array_par_method", class_for_check, not_visible_sign}, + {"i_super_overridden_void_par_method", class_for_check, not_visible_sign}, + {"i_super_overridden_prim_par_method", class_for_check, not_visible_sign}, + {"i_super_overridden_ref_par_method", class_for_check, not_visible_sign}, + {"i_interf_overridden_void_par_method", class_for_check, not_visible_sign}, + {"i_interf_overridden_prim_par_method", class_for_check, not_visible_sign}, + {"i_interf_overridden_ref_par_method", class_for_check, not_visible_sign}, + {"i_abstract_method", class_for_check, not_visible_sign}, + {"i_native_method", class_for_check, not_visible_sign}, + {"i_synchr_method", class_for_check, not_visible_sign}, + {"i_final_method", class_for_check, not_visible_sign}, + {"i_private_method", class_for_check, not_visible_sign}, + {"i_protected_method", class_for_check, not_visible_sign}, + {"i_public_method", class_for_check, not_visible_sign}, + {"", class_for_check, not_visible_sign}, + {"s_super_void_method", super_class_for_check, not_visible_sign}, + {"s_super_prim_method", super_class_for_check, not_visible_sign}, + {"s_super_ref_method", super_class_for_check, not_visible_sign}, + {"i_super_void_method", super_class_for_check, not_visible_sign}, + {"i_super_prim_method", super_class_for_check, not_visible_sign}, + {"i_super_ref_method", super_class_for_check, not_visible_sign}, + {"i_multiple_inherited_method", super_class_for_check, not_visible_sign}, + {"i_interf_ref_method", interface_for_check, not_visible_sign}, + {"i_interf_prim_method", interface_for_check, not_visible_sign}, + {"i_interf_void_method", interface_for_check, not_visible_sign} + + }; + + /** + * Re-call to run(args,out), 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 visibmethod001().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod001 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod001 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleMethods/visibmethod001 test LOG:"); + out_stream.println("==> test checks visibleMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibmethod001: visibmethod001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> visibmethod001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> visibmethod001: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod001: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> visibmethod001: check ReferenceType.visibleMethods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleMethods_method_error = false; + int methods_for_check_number = methods_for_check.length; + int not_visible_methods_number = 0; + int visible_methods_number = 0; + int unexpected_visible_methods_number = 0; + int disregarded_visible_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> visibmethod001: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List visible_methods_list = null; + try { + visible_methods_list = refType.visibleMethods(); + } + catch (Throwable thrown) { + out_stream.println("##> visibmethod001: FAILED: ReferenceType.visibleMethods() throws unexpected " + + thrown); + visibleMethods_method_error = true; + break; + } + visible_methods_number = visible_methods_list.size(); + Method visible_methods[] = new Method[visible_methods_number]; + String unexpected_visible_methods[] = new String[visible_methods_number]; + visible_methods_list.toArray(visible_methods); + for (int i=0; i visibmethod001: FAILED: method is NOT visible: " + current_method_for_check); + not_visible_methods_number++; + } + else { + print_log_on_verbose + ("--> visibmethod001: PASSED for method: " + current_method_for_check); + } + } + for (int i=0; i visibmethod001: FAILED: unexpected visible method: " + unexpected_visible_methods[i]); + } + break; + } + + out_stream.println("--> visibmethod001: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println("--> visibmethod001: expected visible methods number = " + methods_for_check_number); + out_stream.println("--> visibmethod001: in fact visible methods number = " + + (visible_methods_number - disregarded_visible_methods_number)); + out_stream.println("--> visibmethod001: expected and in fact visible methods number = " + + (methods_for_check_number - not_visible_methods_number)); + out_stream.println + ("##> visibmethod001: NOT visible methods number = " + not_visible_methods_number); + out_stream.println + ("##> visibmethod001: UNEXPECTED visible methods number = " + unexpected_visible_methods_number); + } + if ( not_visible_methods_number + unexpected_visible_methods_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibmethod001: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibmethod001: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibmethod001: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001/TestDescription.java new file mode 100644 index 00000000000..8cc73d470a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/visibleMethods/visibmethod001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleMethods/visibmethod001 test + * checks the visibleMethods() method of ReferenceType interface + * of the com.sun.jdi package : + * the ReferenceType.visibleMethods() method is checked for methods of + * debugee's class which extends super class and implements interface. + * Debugee's class has both hidden and overridden methods which should + * be not visible. + * Each visible method is checked for method name and declaring class name. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleMethods.visibmethod001 + * nsk.jdi.ReferenceType.visibleMethods.visibmethod001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleMethods.visibmethod001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001a.java new file mode 100644 index 00000000000..723b65577c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod001a.java @@ -0,0 +1,249 @@ +/* + * 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.ReferenceType.visibleMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibmethod001 JDI test. + */ + +public class visibmethod001a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "visibmethod001aClassForCheck"; + + + 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 visibmethod001a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, visibmethod001a.class.getClassLoader()); + print_log_on_verbose + ("--> visibmethod001a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> visibmethod001a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> visibmethod001a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> visibmethod001a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibmethod001a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibmethod001a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibmethod001a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibmethod001a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +abstract class visibmethod001aClassForCheck extends visibmethod001aSuperClassForCheck + implements visibmethod001aInterfaceForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods without params + static void s_void_method() {} + static boolean s_boolean_method() {return true;} + static byte s_byte_method() {return (byte)1;} + static char s_char_method() {return (char)1;} + static double s_double_method() {return (double)100.99;} + static float s_float_method() {return (float)100.88;} + static int s_int_method() {return 100;} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + // static methods with params + static void s_void_par_method(boolean z) {} + static boolean s_boolean_par_method(boolean z) {return true;} + static byte s_byte_par_method(byte b) {return (byte)1;} + static char s_char_par_method(char ch) {return (char)1;} + static double s_double_par_method(double d) {return (double)100.99;} + static float s_float_par_method(float f) {return (float)100.88;} + static int s_int_par_method(int i) {return 100;} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + // other static methods + native static Object s_native_method(Object obj); + static synchronized Object s_synchr_method(Object obj) {return new Object();} + final static Object s_final_method(Object obj) {return new Object();} + private static Object s_private_method(Object obj) {return new Object();} + protected static Object s_protected_method(Object obj) {return new Object();} + public static Object s_public_method(Object obj) {return new Object();} + + // instance methods without params + void i_void_method() {} + boolean i_boolean_method() {return true;} + byte i_byte_method() {return (byte)1;} + char i_char_method() {return (char)1;} + double i_double_method() {return (double)100.99;} + float i_float_method() {return (float)100.88;} + int i_int_method() {return 100;} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + public void i_interf_overridden_void_method() {} + public int i_interf_overridden_prim_method() {return 100;} + public Object i_interf_overridden_ref_method() {return new Object();} + + // instance methods with params + void i_void_par_method(boolean z) {} + boolean i_boolean_par_method(boolean z) {return true;} + byte i_byte_par_method(byte b) {return (byte)1;} + char i_char_par_method(char ch) {return (char)1;} + double i_double_par_method(double d) {return (double)100.99;} + float i_float_par_method(float f) {return (float)100.88;} + int i_int_par_method(int i) {return 100;} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public void i_interf_overridden_void_par_method(int i) {} + public int i_interf_overridden_prim_par_method(int i) {return 100;} + public Object i_interf_overridden_ref_par_method(Object obj) {return new Object();} + + // other instance methods + abstract Object i_abstract_method(Object obj); + native Object i_native_method(Object obj); + synchronized Object i_synchr_method(Object obj) {return new Object();} + final Object i_final_method(Object obj) {return new Object();} + private Object i_private_method(Object obj) {return new Object();} + protected Object i_protected_method(Object obj) {return new Object();} + public Object i_public_method(Object obj) {return new Object();} + + // static initializer + static {} + + +} + +abstract class visibmethod001aSuperClassForCheck { + + static void s_super_void_method(long l) {} + static long s_super_prim_method(long l) {return 100;} + static Object s_super_ref_method(Object obj) {return new Object();} + + void i_super_void_method(long l) {} + long i_super_prim_method(long l) {return 100;} + Object i_super_ref_method(Object obj) {return new Object();} + + static void s_super_hidden_void_method() {} + static int s_super_hidden_prim_method() {return 100;} + static Object s_super_hidden_ref_method() {return new Object();} + + static void s_super_hidden_void_par_method(int i) {} + static int s_super_hidden_prim_par_method(int i) {return 100;} + static Object s_super_hidden_ref_par_method(Object obj) {return new Object();} + + void i_super_overridden_void_method() {} + int i_super_overridden_prim_method() {return 100;} + Object i_super_overridden_ref_method() {return new Object();} + + void i_super_overridden_void_par_method(int i) {} + int i_super_overridden_prim_par_method(int i) {return 100;} + Object i_super_overridden_ref_par_method(Object obj) {return new Object();} + + public Object i_multiple_inherited_method(Object obj) {return new Object();} + +} + +interface visibmethod001aInterfaceForCheck { + + void i_interf_void_method(long l); + long i_interf_prim_method(long l); + Object i_interf_ref_method(Object obj); + + void i_interf_overridden_void_method(); + int i_interf_overridden_prim_method(); + Object i_interf_overridden_ref_method(); + + void i_interf_overridden_void_par_method(int i); + int i_interf_overridden_prim_par_method(int i); + Object i_interf_overridden_ref_par_method(Object obj); + + public Object i_multiple_inherited_method(Object obj); + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002.java new file mode 100644 index 00000000000..4bddea133c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002.java @@ -0,0 +1,221 @@ +/* + * 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.ReferenceType.visibleMethods; + +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 visibleMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibmethod002 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibmethod002", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibmethod002aClassForCheck"; + + private final static String classLoaderName = package_prefix + "visibmethod002aClassLoader"; + private final static String classFieldName = "loadedClass"; + + static ArgumentHandler argsHandler; + private static Log logHandler; + + + /** + * Re-call to run(args,out), 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 visibmethod002().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + logHandler.complain("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod002 test FAILED"); + } + else { + logHandler.display("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod002 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + logHandler.display(message); + } + + private void print_log_anyway(String message) { + logHandler.complain(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + Debugee debugee; + + if (argsHandler.verbose()) { + debugee = binder.bindToDebugee(debugeeName + " -vbs"); + } else { + debugee = binder.bindToDebugee(debugeeName); + } + + print_log_on_verbose("==> nsk/jdi/ReferenceType/visibleMethods/visibmethod002 test LOG:"); + print_log_on_verbose("==> test checks visibleMethods() method of ReferenceType interface "); + print_log_on_verbose(" of the com.sun.jdi package for not prepared class\n"); + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibmethod002: visibmethod002a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + print_log_anyway + ("##> visibmethod002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + print_log_anyway + ("##> visibmethod002: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod002: debugee's \"ready\" signal recieved!"); + } + + print_log_on_verbose + ("--> visibmethod002: check ReferenceType.visibleMethods() method for not prepared " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleMethods_method_error = false; + + while ( true ) { // test body + ReferenceType loaderRefType = debugee.classByName(classLoaderName); + if (loaderRefType == null) { + print_log_anyway("##> Could NOT FIND custom class loader: " + classLoaderName); + class_not_found_error = true; + break; + } + + Field classField = loaderRefType.fieldByName(classFieldName); + Value classValue = loaderRefType.getValue(classField); + + ClassObjectReference classObjRef = null; + try { + classObjRef = (ClassObjectReference)classValue; + } catch (Exception e) { + print_log_anyway ("##> Unexpected exception while getting ClassObjectReference : " + e); + class_not_found_error = true; + break; + } + + ReferenceType refType = classObjRef.reflectedType(); + boolean isPrep = refType.isPrepared(); + if (isPrep) { + print_log_anyway + ("##> visibmethod002: FAILED: isPrepared() returns for " + class_for_check + " : " + isPrep); + class_not_found_error = true; + break; + } else { + print_log_on_verbose + ("--> visibmethod002: isPrepared() returns for " + class_for_check + " : " + isPrep); + } + + List visible_methods_list = null; + try { + visible_methods_list = refType.visibleMethods(); + print_log_anyway + ("##> visibmethod002: FAILED: NO any Exception thrown!"); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + visibleMethods_method_error = true; + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ClassNotPreparedException) { + print_log_on_verbose + ("--> visibmethod002: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + print_log_anyway + ("##> visibmethod002: FAILED: unexpected Exception thrown - " + expt.toString()); + print_log_anyway + ("##> expected Exception - com.sun.jdi.ClassNotPreparedException"); + visibleMethods_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibmethod002: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + print_log_anyway + ("##> visibmethod002: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibmethod002: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002/TestDescription.java new file mode 100644 index 00000000000..348df411f67 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/ReferenceType/visibleMethods/visibmethod002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleMethods/visibmethod002 test + * checks the visibleMethods() method of ReferenceType interface + * of the com.sun.jdi package for not prepared class: + * the checked class is loaded but is not prepared. + * The ReferenceType.visibleMethods() method is called for + * this class - ClassNotPreparedException should be thrown + * in this case. + * COMMENTS + * The test is updated as follows: + * - statements for establishing ArgumentHandler, LogHandler and Binder are updated + * to comply with new version of the shared classes; + * - a number of statements "out_stream.println" are replaced with + * "print_log_on_verbose" and "print_log_anyway". + * ------------------------------------------------------- + * 4477989 TEST_BUG: some nine ReferenceType tests use wrong assumption + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleMethods.visibmethod002 + * nsk.jdi.ReferenceType.visibleMethods.visibmethod002a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleMethods.visibmethod002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002/loadclass/visibmethod002aClassForCheck.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002/loadclass/visibmethod002aClassForCheck.java new file mode 100644 index 00000000000..9c0efc40787 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002/loadclass/visibmethod002aClassForCheck.java @@ -0,0 +1,69 @@ +/* + * 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.ReferenceType.visibleMethods; + +/** + * This class is loaded by visibmethod002aClassLoader . + */ + +class visibmethod002aClassForCheck { + + // constructor + public void ClassForCheck() { + } + + // static methods + static void s_void_method() {} + static long s_long_method() {return 100;} + static String s_string_method() {return "return";} + static Object s_object_method() {return new Object();} + static long[] s_prim_array_method() {return new long[100];} + static Object[] s_ref_array_method() {return new Object[100];} + + static void s_void_par_method(boolean z) {} + static long s_long_par_method(long l) {return 100;} + static String s_string_par_method(String s) {return "return";} + static Object s_object_par_method(Object obj) {return new Object();} + static long[] s_prim_array_par_method(long[] la) {return new long[100];} + static Object[] s_ref_array_par_method(Object[] obja) {return new Object[100];} + + + // instance methods + void i_void_method() {} + long i_long_method() {return 100;} + String i_string_method() {return "return";} + Object i_object_method() {return new Object();} + long[] i_prim_array_method() {return new long[100];} + Object[] i_ref_array_method() {return new Object[100];} + + void i_void_par_method(boolean z) {} + long i_long_par_method(long l) {return 100;} + String i_string_par_method(String s) {return "return";} + Object i_object_par_method(Object obj) {return new Object();} + long[] i_prim_array_par_method(long[] la) {return new long[100];} + Object[] i_ref_array_par_method(Object[] obja) {return new Object[100];} + + // static initializer + static {} +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002a.java new file mode 100644 index 00000000000..4f219b75cf1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod002a.java @@ -0,0 +1,141 @@ +/* + * 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.ReferenceType.visibleMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.io.*; + + +/** + * This class is used as debugee application for the visibmethod002 JDI test. + */ + +public class visibmethod002a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "visibmethod002aClassForCheck"; + + 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 visibmethod002a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + visibmethod002aClassLoader customClassLoader = new visibmethod002aClassLoader(checked_class_dir, checked_class_name); + try { + customClassLoader.preloadClass(checked_class_name); + print_log_on_verbose + ("--> visibmethod002a: checked class loaded but not prepared: " + checked_class_name); + } catch (Throwable e) { // ClassNotFoundException + print_log_on_verbose + ("--> visibmethod002a: checked class NOT loaded: " + e); + } + + print_log_on_verbose("**> visibmethod002a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibmethod002a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibmethod002a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibmethod002a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibmethod002a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +/** + * Custom class loader to load class without preparation. + */ +class visibmethod002aClassLoader extends ClassLoader { + + private String classPath; + public static Class loadedClass; + + public visibmethod002aClassLoader(String classPath, String className) { + super(visibmethod002aClassLoader.class.getClassLoader()); + this.classPath = classPath; + } + + public void preloadClass (String className) throws ClassNotFoundException { + loadedClass = findClass(className); + } + + protected synchronized Class findClass(String className) throws ClassNotFoundException { + String classFileName = classPath + "/" + className.replace('.', '/') + ".class"; + + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + int len; + byte data[]; + try { + len = in.available(); + data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } + } + + return defineClass(className, data, 0, data.length); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003.java new file mode 100644 index 00000000000..70e68d57e34 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003.java @@ -0,0 +1,255 @@ +/* + * 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.ReferenceType.visibleMethods; + +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 visibleMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibmethod003 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to true + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods.", + thisClassName = package_prefix + "visibmethod003", + debugeeName = thisClassName + "a"; + + /** Debugee's class for check **/ + private final static String checked_class = package_prefix + "visibmethod003b"; + + + /** + * Re-call to run(args,out), 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 visibmethod003().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod003 test FAILED"); + } + else { + out_stream.println + ("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod003 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + private static void print_log_without_verbose(String message) { + if ( ! verbose_mode ) { + out_stream.println(message); + } + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleMethods/visibmethod003 test LOG:"); + out_stream.println("--> test checks visibleMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for UNLOADED class\n"); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + argv = argHandler.getArguments(); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = debugee.createIOPipe(); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibmethod003: visibmethod003a debugee launched"); + debugee.resume(); + + String debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> visibmethod003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready0")) { + out_stream.println + ("##> visibmethod003: UNEXPECTED debugee's signal (not \"ready0\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod003: debugee's \"ready0\" signal recieved!"); + } + + // pass to debugee checked_class_dir... + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> visibmethod003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if (!debugee_signal.equals("ready1")) { + out_stream.println + ("##> visibmethod003: UNEXPECTED debugee's signal (not \"ready1\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod003: debugee's \"ready1\" signal recieved!"); + } + + boolean class_not_found_error = false; + boolean visibleMethods_method_error = false; + while ( true ) { + print_log_on_verbose + ("--> visibmethod003: getting ReferenceType object for loaded checked class..."); + ReferenceType refType = debugee.classByName(checked_class); + if (refType == null) { + print_log_without_verbose + ("--> visibmethod003: getting ReferenceType object for loaded checked class..."); + out_stream.println("##> visibmethod003: FAILED: Could NOT FIND checked class: " + checked_class); + class_not_found_error = true; + break; + } + else { + print_log_on_verbose("--> visibmethod003: checked class FOUND: " + checked_class); + } + print_log_on_verbose + ("--> visibmethod003: waiting for \"ready2\" or \"not_unloaded\" signal from debugee..."); + pipe.println("continue"); + debugee_signal = pipe.readln(); + if (debugee_signal == null) { + out_stream.println + ("##> visibmethod003: UNEXPECTED debugee's signal - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + if ( debugee_signal.equals("not_unloaded")) { + out_stream.println + ("--> visibmethod003: debugee's \"not_unloaded\" signal recieved!"); + print_log_without_verbose + ("--> checked class may be NOT unloaded!"); + out_stream.println + ("--> ReferenceType.visibleMethods() method can NOT be checked!"); + break; + } + if (!debugee_signal.equals("ready2")) { + out_stream.println + ("##> visibmethod003: UNEXPECTED debugee's signal (not \"ready2\") - " + debugee_signal); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod003: debugee's \"ready2\" signal recieved!"); + } + print_log_on_verbose + ("--> visibmethod003: check that checked class has been unloaded realy..."); + ReferenceType refType2 = debugee.classByName(checked_class); + if (refType2 == null) { + print_log_on_verbose + ("--> visibmethod003: checked class has been unloaded realy: " + checked_class); + } + else { + print_log_without_verbose + ("--> visibmethod003: check that checked class has been unloaded realy..."); + out_stream.println + ("--> visibmethod003: checked class FOUND: " + checked_class + + " => it has NOT been unloaded!"); + out_stream.println + ("--> ReferenceType.visibleMethods() method can NOT be checked!"); + break; + } + + out_stream.println + ("--> visibmethod003: check ReferenceType.visibleMethods() method for unloaded class..."); + List visible_methods_list = null; + try { + visible_methods_list = refType.visibleMethods(); + } + catch (Exception expt) { + if (expt instanceof com.sun.jdi.ObjectCollectedException) { + out_stream.println + ("--> visibmethod003: PASSED: expected Exception thrown - " + expt.toString()); + } + else { + out_stream.println + ("##> visibmethod003: FAILED: unexpected Exception thrown - " + expt.toString()); + out_stream.println + ("##> expected Exception - com.sun.jdi.ObjectCollectedException"); + visibleMethods_method_error = true; + } + } + break; + } + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibmethod003: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibmethod003: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibmethod003: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} // end of visibmethod003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/TEST.properties new file mode 100644 index 00000000000..8b51b2a9115 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/TEST.properties @@ -0,0 +1,24 @@ +# +# 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. +# + +exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/TestDescription.java new file mode 100644 index 00000000000..af7544c42a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/TestDescription.java @@ -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/ReferenceType/visibleMethods/visibmethod003. + * VM Testbase keywords: [diehard, jpda, jdi, nonconcurrent] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleMethods/visibmethod003 test + * checks the visibleMethods() method of ReferenceType interface + * of the com.sun.jdi package for UNLOADED class: + * the test loads a class, gets a ReferenceType instance for this + * class, then enforces the class to be unloaded and calls the + * visibleMethods() method - the com.sun.jdi.ObjectCollectedException + * should be thrown in this case. + * COMMENTS + * Fixed test due to bug + * 4463674: TEST_BUG: some JDI tests are timing dependent + * The test was modified to comply with new execution scheme + * to have separate directory for precompiled classes: + * - visibmethod003b class was moved in 'loadclass' subdirectory; + * - package name was added in visibmethod003b class; + * - ${COMMON_CLASSES_LOCATION} instead of ${TESTDIR} in .cfg file; + * - ClassUnloader seekes for visibmethod003b class in + * ${COMMON_CLASSES_LOCATION}/loadclass directory. + * 4505735 equals002 and other tests fail with merlin + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleMethods.visibmethod003 + * nsk.jdi.ReferenceType.visibleMethods.visibmethod003a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleMethods.visibmethod003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" ./bin + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/loadclass/visibmethod003b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/loadclass/visibmethod003b.java new file mode 100644 index 00000000000..d154a3e8236 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003/loadclass/visibmethod003b.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +// this class will be loaded and then onloaded to check +// the visibleMethods() method of ReferenceType interface for UNLOADED class + +package nsk.jdi.ReferenceType.visibleMethods; + +class visibmethod003b {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003a.java new file mode 100644 index 00000000000..b04195f51d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod003a.java @@ -0,0 +1,117 @@ +/* + * 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.ReferenceType.visibleMethods; + +import java.lang.reflect.*; +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibmethod003 JDI test. + */ + +public class visibmethod003a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + private final static String package_prefix = "nsk.jdi.ReferenceType.visibleMethods."; + private final static String checked_class_name = package_prefix + "visibmethod003b"; + + private static void print_log_on_verbose(String message) { + if ( verbose_mode ) { + System.err.println(message); + } + } + + public static void main (String argv[]) { + + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + print_log_on_verbose("**> visibmethod003a: debugee started!"); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + print_log_on_verbose("**> visibmethod003a: waiting for \"checked class dir\" info..."); + pipe.println("ready0"); + String checked_class_dir = (argHandler.getArguments())[0] + File.separator + "loadclass"; + + ClassUnloader classUnloader = new ClassUnloader(); + + try { + classUnloader.loadClass(checked_class_name, checked_class_dir); + print_log_on_verbose + ("--> visibmethod003a: checked class loaded:" + checked_class_name); + } + catch ( Exception e ) { // ClassNotFoundException + System.err.println + ("**> visibmethod003a: load class: exception thrown = " + e.toString()); + print_log_on_verbose + ("--> visibmethod003a: checked class NOT loaded:" + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> visibmethod003a: waiting for \"continue\" or \"quit\" signal..."); + pipe.println("ready1"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibmethod003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibmethod003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + if ( ! instruction.equals("continue")) { + System.err.println + ("!!**> visibmethod003a: unexpected signal (no \"continue\" or \"quit\") - " + instruction); + System.err.println("!!**> visibmethod003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } + + print_log_on_verbose("**> visibmethod003a: \"continue\" signal recieved!"); + print_log_on_verbose("**> visibmethod003a: enforce to unload checked class..."); + + boolean test_class_loader_finalized = classUnloader.unloadClass(); + + if ( ! test_class_loader_finalized ) { + print_log_on_verbose("**> visibmethod003a: checked class may be NOT unloaded!"); + pipe.println("not_unloaded"); + } + else { + print_log_on_verbose("**> visibmethod003a: checked class unloaded!"); + pipe.println("ready2"); + } + print_log_on_verbose("**> visibmethod003a: waiting for \"quit\" signal..."); + instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibmethod003a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibmethod003a: completed!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibmethod003a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibmethod003a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} // end of visibmethod003a class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004.java new file mode 100644 index 00000000000..63a859c6c61 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004.java @@ -0,0 +1,205 @@ +/* + * 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.ReferenceType.visibleMethods; + +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 visibleMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibmethod004 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibmethod004", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibmethod004aInterfaceForCheck"; + + /** + * Re-call to run(args,out), 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 visibmethod004().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod004 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod004 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleMethods/visibmethod004 test LOG:"); + out_stream.println("==> test checks visibleMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for class without visible methods\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibmethod004: visibmethod004a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> visibmethod004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> visibmethod004: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod004: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> visibmethod004: check ReferenceType.visibleMethods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleMethods_method_error = false; + int visible_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> visibmethod004: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List visible_methods_list = null; + try { + visible_methods_list = refType.visibleMethods(); + } + catch (Throwable thrown) { + out_stream.println("##> visibmethod004: FAILED: ReferenceType.visibleMethods() throws unexpected " + + thrown); + visibleMethods_method_error = true; + break; + } + visible_methods_number = visible_methods_list.size(); + if ( visible_methods_number == 0 ) { + break; + } + Method visible_methods[] = new Method[visible_methods_number]; + visible_methods_list.toArray(visible_methods); + for (int i=0; i visibmethod004: FAILED: unexpected visible method: " + full_visible_method_info); + } + break; + } + + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + if ( visible_methods_number > 0 ) { + out_stream.println + ("##> visibmethod004: UNEXPECTED visible methods number = " + visible_methods_number); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println + ("--> visibmethod004: PASSED: returned list of methods is empty!"); + } + + print_log_on_verbose("--> visibmethod004: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibmethod004: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibmethod004: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004/TestDescription.java new file mode 100644 index 00000000000..ebba6e0bf39 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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/ReferenceType/visibleMethods/visibmethod004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleMethods/visibmethod004 test + * checks the visibleMethods() method of ReferenceType interface + * of the com.sun.jdi package for class without visible methods: + * the ReferenceType.visibleMethods() method is checked for + * debugee's interface which does not contain any methods. + * The test expects the returned list of methods to be empty. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleMethods.visibmethod004 + * nsk.jdi.ReferenceType.visibleMethods.visibmethod004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleMethods.visibmethod004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004a.java new file mode 100644 index 00000000000..61c2160f794 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod004a.java @@ -0,0 +1,81 @@ +/* + * 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.ReferenceType.visibleMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibmethod004 JDI test. + */ + +public class visibmethod004a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + + + 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 visibmethod004a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + visibmethod004aClassForCheck class_for_check = new visibmethod004aClassForCheck(); + + print_log_on_verbose("**> visibmethod004a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibmethod004a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibmethod004a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("##> visibmethod004a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("##> visibmethod004a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +class visibmethod004aClassForCheck implements visibmethod004aInterfaceForCheck { + +} + +interface visibmethod004aInterfaceForCheck { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005.java new file mode 100644 index 00000000000..ab11e7300d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005.java @@ -0,0 +1,253 @@ +/* + * 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.ReferenceType.visibleMethods; + +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 visibleMethods() + * of the JDI interface ReferenceType of com.sun.jdi package + */ + +public class visibmethod005 extends Log { + static java.io.PrintStream out_stream; + static boolean verbose_mode = false; // test argument -vbs or -verbose switches to static + // - for more easy failure evaluation + + /** The main class names of the debugger & debugee applications. */ + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods.", +// package_prefix = "", // for DEBUG without package + thisClassName = package_prefix + "visibmethod005", + debugeeName = thisClassName + "a"; + + /** Debugee's classes for check **/ + private final static String class_for_check = package_prefix + "visibmethod005aInterfaceForCheck"; + private final static String super_interf_for_check_1 = package_prefix + "visibmethod005aSuperInterfaceForCheck_1"; + private final static String super_interf_for_check_2 = package_prefix + "visibmethod005aSuperInterfaceForCheck_2"; + private final static String not_visible_sign = "NOT VISIBLE"; + private final static String passed_sign = "PASSED"; + private static String methods_for_check[][] = { + +// method name declaring class check result + + {"i_multiple_inherited_abstract_method_1", super_interf_for_check_1, not_visible_sign}, + {"i_multiple_inherited_abstract_method_2", super_interf_for_check_2, not_visible_sign} + + }; + + /** + * Re-call to run(args,out), 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 visibmethod005().runThis(argv,out_stream); + if ( v_test_result == 2/*STATUS_FAILED*/ ) { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod005 test FAILED"); + } + else { + out_stream.println("\n==> nsk/jdi/ReferenceType/visibleMethods/visibmethod005 test PASSED"); + } + return v_test_result; + } + + private void print_log_on_verbose(String message) { + display(message); + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + verbose_mode = argHandler.verbose(); + + if ( out_stream == null ) { + out_stream = out; + } + + out_stream.println("==> nsk/jdi/ReferenceType/visibleMethods/visibmethod005 test LOG:"); + out_stream.println("==> test checks visibleMethods() method of ReferenceType interface "); + out_stream.println(" of the com.sun.jdi package for multiple inherited abstract methods\n"); + + String debugee_launch_command = debugeeName; + if (verbose_mode) { + logTo(out_stream); + } + + Binder binder = new Binder(argHandler,this); + Debugee debugee = binder.bindToDebugee(debugee_launch_command); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + print_log_on_verbose("--> visibmethod005: visibmethod005a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if (line == null) { + out_stream.println + ("##> visibmethod005: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + if (!line.equals("ready")) { + out_stream.println + ("##> visibmethod005: UNEXPECTED debugee's signal (not \"ready\") - " + line); + return 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose("--> visibmethod005: debugee's \"ready\" signal recieved!"); + } + + out_stream.println + ("--> visibmethod005: check ReferenceType.visibleMethods() method for debugee's " + + class_for_check + " class..."); + boolean class_not_found_error = false; + boolean visibleMethods_method_error = false; + int methods_for_check_number = methods_for_check.length; + int not_visible_methods_number = 0; + int visible_methods_number = 0; + int unexpected_visible_methods_number = 0; + + while ( true ) { + ReferenceType refType = debugee.classByName(class_for_check); + if (refType == null) { + out_stream.println("##> visibmethod005: Could NOT FIND class: " + class_for_check); + class_not_found_error = true; + break; + } + List visible_methods_list = null; + try { + visible_methods_list = refType.visibleMethods(); + } + catch (Throwable thrown) { + out_stream.println("##> visibmethod005: FAILED: ReferenceType.visibleMethods() throws unexpected " + + thrown); + visibleMethods_method_error = true; + break; + } + visible_methods_number = visible_methods_list.size(); + Method visible_methods[] = new Method[visible_methods_number]; + String unexpected_visible_methods[] = new String[visible_methods_number]; + visible_methods_list.toArray(visible_methods); + for (int i=0; i visibmethod005: FAILED: method is NOT visible: " + current_method_for_check); + not_visible_methods_number++; + } + else { + print_log_on_verbose + ("--> visibmethod005: PASSED for method: " + current_method_for_check); + } + } + for (int i=0; i visibmethod005: FAILED: unexpected visible method: " + unexpected_visible_methods[i]); + } + break; + } + + out_stream.println("--> visibmethod005: check completed!"); + int v_test_result = 0/*STATUS_PASSED*/; + if ( class_not_found_error || visibleMethods_method_error ) { + v_test_result = 2/*STATUS_FAILED*/; + } + else { + out_stream.println("--> visibmethod005: expected visible methods number = " + methods_for_check_number); + out_stream.println("--> visibmethod005: in fact visible methods number = " + + visible_methods_number); + out_stream.println("--> visibmethod005: expected and in fact visible methods number = " + + (methods_for_check_number - not_visible_methods_number)); + out_stream.println + ("##> visibmethod005: NOT visible methods number = " + not_visible_methods_number); + out_stream.println + ("##> visibmethod005: UNEXPECTED visible methods number = " + unexpected_visible_methods_number); + } + if ( not_visible_methods_number + unexpected_visible_methods_number > 0 ) { + v_test_result = 2/*STATUS_FAILED*/; + } + + print_log_on_verbose("--> visibmethod005: waiting for debugee finish..."); + pipe.println("quit"); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) { + out_stream.println + ("##> visibmethod005: UNEXPECTED Debugee's exit status (not 95) - " + status); + v_test_result = 2/*STATUS_FAILED*/; + } + else { + print_log_on_verbose + ("--> visibmethod005: expected Debugee's exit status - " + status); + } + + return v_test_result; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005/TestDescription.java new file mode 100644 index 00000000000..9c3114798b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/ReferenceType/visibleMethods/visibmethod005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/ReferenceType/visibleMethods/visibmethod005 test + * checks the visibleMethods() method of ReferenceType interface + * of the com.sun.jdi package for multiple inherited abstract methods: + * the ReferenceType.visibleMethods() method is checked for methods of + * debugee's interface which extends two super interfaces. + * Debugee's interface has only multipe inherited abstract methods which + * should be visible. + * Each visible method is checked for method name and declaring class name. + * COMMENTS + * Fixed test due to bug: + * Incorrect initialization of Binder object with argv instead of argHandler. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ReferenceType.visibleMethods.visibmethod005 + * nsk.jdi.ReferenceType.visibleMethods.visibmethod005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleMethods.visibmethod005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005a.java new file mode 100644 index 00000000000..a1c74711229 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod005a.java @@ -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.ReferenceType.visibleMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the visibmethod005 JDI test. + */ + +public class visibmethod005a { + + static boolean verbose_mode = false; // debugger may switch to true + // - for more easy failure evaluation + private final static String + package_prefix = "nsk.jdi.ReferenceType.visibleMethods."; +// package_prefix = ""; // for DEBUG without package + static String checked_class_name = package_prefix + "visibmethod005aInterfaceForCheck"; + + + 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 visibmethod005a: debugee started!"); + ArgumentHandler argHandler = new ArgumentHandler(argv); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Class checked_class_classobj = null; + try { + checked_class_classobj = + Class.forName(checked_class_name, true, visibmethod005a.class.getClassLoader()); + print_log_on_verbose + ("--> visibmethod005a: checked class loaded:" + checked_class_name); + } + catch ( Throwable thrown ) { // ClassNotFoundException +// System.err.println +// ("**> visibmethod005a: load class: Throwable thrown = " + thrown.toString()); + print_log_on_verbose + ("--> visibmethod005a: checked class NOT loaded: " + checked_class_name); + // Debuuger finds this fact itself + } + + print_log_on_verbose("**> visibmethod005a: waiting for \"quit\" signal..."); + pipe.println("ready"); + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + print_log_on_verbose("**> visibmethod005a: \"quit\" signal recieved!"); + print_log_on_verbose("**> visibmethod005a: completed succesfully!"); + System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); + } + System.err.println("!!**> visibmethod005a: unexpected signal (no \"quit\") - " + instruction); + System.err.println("!!**> visibmethod005a: FAILED!"); + System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); + } +} + +interface visibmethod005aInterfaceForCheck extends visibmethod005aSuperInterfaceForCheck_1, visibmethod005aSuperInterfaceForCheck_2 { + +} + +interface visibmethod005aSuperInterfaceForCheck_1 { + + Object i_multiple_inherited_abstract_method_1(Object obj); +} + +interface visibmethod005aSuperInterfaceForCheck_2 { + + Object i_multiple_inherited_abstract_method_2(Object obj); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod006.java new file mode 100644 index 00000000000..9c1e9280622 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod006.java @@ -0,0 +1,287 @@ +/* + * 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.ReferenceType.visibleMethods; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method + * com.sun.jdi.ReferenceType.visibleMethods() + * properly returns an empty method list for arrays (ArrayType) and primitive + * classes.

    + * + * Debugger part of it attempts to get a list of visible methods in several + * reference types corresponding to debuggee field values, which themselves + * are:
    + * primitive classes, and arrays of primitive types and classes. + */ +public class visibmethod006 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ReferenceType.visibleMethods.visibmethod006t"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 52; + + static final int FLD_NUM = 24; + // tested fields used to verify the assertion + static final String DEBUGGEE_FLDS[] = { + "boolCls", + "byteCls", + "charCls", + "doubleCls", + "floatCls", + "intCls", + "longCls", + "shortCls", + "boolArr", + "byteArr", + "charArr", + "doubleArr", + "floatArr", + "intArr", + "longArr", + "shortArr", + "boolClsArr", + "byteClsArr", + "charClsArr", + "doubleClsArr", + "floatClsArr", + "intClsArr", + "longClsArr", + "shortClsArr" + }; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + static final int DELAY = 500; // in milliseconds + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private volatile int tot_res = Consts.TEST_PASSED; + private BreakpointRequest BPreq; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new visibmethod006().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "visibmethod006t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main & dummy classes + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + // suspend debuggee VM at breakpoint + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + for (int i=0; i " + 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(); + + // check existence of inherited methods for this enum type + List l = checkedClass.visibleMethods(); + if (l.isEmpty()) { + complain("\t ReferenceType.visibleMethods() returned empty list for type: " + className); + exitStatus = Consts.TEST_FAILED; + } else { + Vector methodNames = new Vector(); + Iterator it = l.iterator(); + while (it.hasNext()) { + methodNames.add(it.next().name()); + } + + for (int i = 0; i < testedMethodNames.length; i++) { + String methodName = testedMethodNames[i]; + if (methodNames.contains(methodName)) { + display("CHECK" + (i+1) + " PASSED: " + className + " has method " + methodName); + } else { + complain("CHECK" + (i+1) + " FAILED: " + className + " does not have method " + methodName); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007/TestDescription.java new file mode 100644 index 00000000000..ce74e8db0eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ReferenceType/visibleMethods/visibmethod007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for visibleMethods() method of ReferenceType interface. + * The test checks if this method returns all methods declared + * in java.lang.Enum and java.lang.Object classes for any mirrored + * enum type. The java.lang.Enum class is superclass for each enum + * type. + * The test checks existence of methods with following names in + * returned List: + * clone(), + * compareTo(E o), + * equals(Object o), + * getDeclaringClass(), + * hashCode(), + * name(), + * ordinal(), + * toString() + * The test consists of a debugger program (visibmethod007.java) + * and debugged application (visibmethod007a.java). + * Package name is nsk.jdi.ReferenceType.visibleMethods . + * 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 visibleMethods() method for each field + * of enum type declared in visibmethod007a class. + * The debugger checks if each of expected method names exists + * in returned list. The test fails if any of expected method + * names has not been met. + * 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.ReferenceType.visibleMethods.visibmethod007 + * nsk.jdi.ReferenceType.visibleMethods.visibmethod007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ReferenceType.visibleMethods.visibmethod007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007a.java new file mode 100644 index 00000000000..444db3a5cef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007a.java @@ -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.ReferenceType.visibleMethods; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class visibmethod007a { + + //------------------------------------------------------- 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 visibmethod007Enum1 f1 = visibmethod007Enum1.e2; + static visibmethod007Enum2 f2 = visibmethod007Enum2.e1; + static visibmethod007Enum1.Enum1_ f3 = visibmethod007Enum1.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(visibmethod007.SIGNAL_READY); + + + //pipe.println(visibmethod007.SIGNAL_GO); + receiveSignal(visibmethod007.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum visibmethod007Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum visibmethod007Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java new file mode 100644 index 00000000000..401fe637154 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java @@ -0,0 +1,324 @@ +/* + * 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.Scenarios.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Debuggee's part contains a tested class (class B) and debugger exercises + * method runIt() of this class by the following steps:
    + * 1. On ClassPrepareEvent of class B, + * MethodExitRequest is created and debugger waits + * MethodExitEvent for to be shure the static + * members of class B have been initialized
    + * 2. After getting MethodExitEvent for ,
    + * - debugger creates MethodEntryRequest
    + * - invokes the tested method (method runIt) by calling + * com.sun.jdi.ClassType.invokeMethod().
    + * This invoking occurs in special thread of debugger's part so that + * debugger can process the events of the target VM. + * 3. When getting MethodEntryEvent from the invoked method, + * debugger tries to pop current frame (with 0 index). + * + * The test passes when the above steps have been successfuly executed. + */ + +public class popframes001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.Scenarios.invokeMethod."; + private final static String debuggerName = prefix + "popframes001"; + public final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + // We expect runIt() method to be called 2 times. + // First time the method call frame will be popped. + // When the metod is recalled it will complete normally. + public final static int expectedEventCount = 2; + private int eventCount = 0; + private ClassType debugeeClass, testedClass; + private EventRequestManager evm; + + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + popframes001 thisTest = new popframes001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectOutput(log); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canPopFrames()) { + display("\n>>>canPopFrames() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + evm = debugee.getEventRequestManager(); + + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(testedClassName); + req.enable(); + display("\nresuming..."); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\nevent ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\nevent ===>>> " + event); + testedClass = (ClassType )debugee.classByName(testedClassName); + debugeeClass = (ClassType )debugee.classByName(debugeeName); + + display("\ncreating MethodExitRequest for the \"" + + testedClassName + + "\" class"); + + MethodExitRequest mreq = evm.createMethodExitRequest(); + mreq.addClassFilter(testedClassName); + mreq.enable(); + + display("\nresuming..."); + debugee.resume(); + + } else if (event instanceof MethodExitEvent) { + display("\nevent ===>>> " + event); + hitMethodExitEvent((MethodExitEvent )event); + + } else if (event instanceof MethodEntryEvent) { + display("\nevent ===>>> " + event); + hitMethodEntryEvent((MethodEntryEvent )event); + display("\nresuming..."); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount != expectedEventCount) { + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void hitMethodExitEvent(MethodExitEvent event) { + Method mthd = event.method(); + display("MethodExitEvent:: method name :\t" + mthd.name()); + display("MethodExitEvent:: is it :\t" + + mthd.isStaticInitializer()); + if (mthd.isStaticInitializer()) { + display("\nMethodExitEvent:: creating MethodEntryRequest for the \"" + + testedClassName + + "\" class"); + + evm.createExceptionRequest(testedClass, false, true).enable(); + + MethodEntryRequest req = evm.createMethodEntryRequest(); + req.addClassFilter(testedClassName); + req.enable(); + MethodInvoker invoker = new MethodInvoker(testedClass, + popframes001b.methodNameCaller, + event.thread()); + invoker.start(); + + } else { + display("MethodExitEvent:: no actions for this method"); + display("\nresuming..."); + debugee.resume(); + } + } + + // Set a flag that the frame has been popped. + // Otherwise we would get an eternal loop calling and popping runIt(). + private boolean isFramePopped = false; + + private void hitMethodEntryEvent(MethodEntryEvent event) { + String methodName = event.method().name(); + display("MethodEntryEvent:: method name:\t" + methodName); + if (popframes001b.methodName.compareTo(methodName) == 0) { + if (!isFramePopped) { + displayActiveFrames(event.thread()); + popFrames(event.thread()); + displayActiveFrames(event.thread()); + isFramePopped = true; + } + eventCount++; + } + } + + private void displayActiveFrames(ThreadReference thread) { + int i = 0; + display("\nActive frames:"); + try { + for (i = 0; i < thread.frameCount(); i++) { + display("\t" + i + ". " + thread.frame(i).location() + + "\tmethod: " + thread.frame(i).location().method().name()); + } + } catch(IncompatibleThreadStateException e) { + display("\t" + i + ". ??? " + e); + } + } + + private void popFrames(ThreadReference thread) { + try { + StackFrame frame = thread.frame(0); + display("\nresetting frame of " + frame.location().method()); + thread.popFrames(frame); + display("frame has been reset"); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + class MethodInvoker extends Thread { + private ClassType clsType; + private String methodName; + private ThreadReference thread; + + public MethodInvoker(ClassType clsType, String methodName, + ThreadReference thread) { + display("\ninvokingMethodThread:: thread created"); + this.clsType = clsType; + this.methodName = methodName; + this.thread = thread; + } + + public void run() { + Method mthd = debugee.methodByName(clsType, methodName); + display("invokingMethodThread:: invoking method\t:\"" + mthd.name() + "\""); + display("invokingMethodThread:: -------------------------------"); + + try { + clsType.invokeMethod(thread, mthd, new Vector(), 0); + } catch (Throwable e) { + complain("invokingMethodThread:: " + UNEXPECTED_STRING + e); + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } + + display("setting field"); + Field fld = debugeeClass.fieldByName("finishIt"); + try { + debugeeClass.setValue(fld,debugee.VM().mirrorOf(true)); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + debugee.resume(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java new file mode 100644 index 00000000000..2559e112438 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java @@ -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/Scenarios/invokeMethod/popframes001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * Debuggee's part contains a tested class (class B) and debugger exercises + * method runIt() of this class by the following steps: + * 1. On ClassPrepareEvent of class B, MethodExitRequest is created and + * debugger waits MethodExitEvent for to be shure the static + * members of class B have been initialized + * 2. After getting MethodExitEvent for , + * - debugger creates MethodEntryRequest + * - invokes the tested method (method "runIt") by calling + * com.sun.jdi.ClassType.invokeMethod(). + * This invoking occurs in special thread of debugger's part so that + * debugger can process the events of the target VM. + * 3. When getting MethodEntryEvent from the invoked method (method "runIt"), + * debugger tries to pop current frame (with 0 index). + * The test passes when the above steps have been successfuly executed. + * COMMENTS + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Scenarios.invokeMethod.popframes001 + * nsk.jdi.Scenarios.invokeMethod.popframes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Scenarios.invokeMethod.popframes001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java new file mode 100644 index 00000000000..42d8f5446c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java @@ -0,0 +1,78 @@ +/* + * 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.Scenarios.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * popframes001a is deugee's part of the popframes001. + */ + +public class popframes001a { + + volatile public static boolean finishIt = false; + + public static void main(String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.out, argHandler); + + popframes001b.loadClass = true; + + while (!finishIt) { + try { + Thread.sleep(1); + } catch (InterruptedException e) { + } + } + + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } +} + +class popframes001b { + public final static int INITIAL_VALUE = 0; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public final static String methodName = "runIt"; + public final static String methodNameCaller = "runItCaller"; + public final static String flagName = "flag"; + + public static void runIt() { + flag = INITIAL_VALUE; + } + + // We need to call runIt() from a java function. + // This is because jvmti function popFrame() requires that + // both calling and called methods are java functions. + public static void runItCaller() { + runIt(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001.java new file mode 100644 index 00000000000..61174bbf09a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001.java @@ -0,0 +1,307 @@ +/* + * 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.Scenarios.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import jdk.test.lib.Utils; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * This test based on a scenario which consists of the following steps: + * 1. Invoking debugee's static method by ClassType.invokeMethod().
    + * 2. Redefinition of this method.
    + * 3. Invoking the one again.
    + * + * The test checks a value of static field to be equal to new value. + * When the field has unexpected value, the test fails. + */ + +public class redefineclasses001 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.Scenarios.invokeMethod."; + private final static String debuggerName = prefix + "redefineclasses001"; + public final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String classFileName = "redefineclasses001b.class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + public final static int expectedEventCount = redefineclasses001a.brkpLineNumber.length; + private int eventCount = 0; + private ReferenceType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses001 thisTest = new redefineclasses001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectOutput(log); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debugeeName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); +// display("\nevent ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + display("\nevent ===>>> " + event); + prepareTestCases(); + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + display("\nevent ===>>> " + event); + event.request().disable(); + display("\n\n=================="); + display(eventCount + "-case"); + performCase(eventCount, ((BreakpointEvent )event).thread()); + eventCount++; + if (eventCount < expectedEventCount) prepareTestCases(); + + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount != expectedEventCount) { + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void performCase(int num, ThreadReference thread) { + ClassType testedClass = (ClassType )debugee.classByName(testedClassName); + invokeMethod(testedClass, redefineclasses001b.methodName, + thread); + checkFieldVal(testedClass, redefineclasses001b.flagName, + redefineclasses001b.BEFORE_REDEFINITION); + + display("\nredefining..."); + String newClassFile = classDir + File.separator + + "newclass" + File.separator + + prefix.replace('.',File.separatorChar) + + classFileName; + redefineDebugee(testedClass, newClassFile); + + invokeMethod(testedClass, redefineclasses001b.methodName, + thread); + checkFieldVal(testedClass, redefineclasses001b.flagName, + redefineclasses001b.AFTER_REDEFINITION); + + display("\nreturning the previous state..."); + redefineDebugee(testedClass, + ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString()); + } + + private void redefineDebugee(ReferenceType refType, String classFileName) { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(refType, classFileName); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(ReferenceType refType, String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(refType, arrayToRedefine); + return mapForClass; + } + + private void prepareTestCases() { + debugeeClass = debugee.classByName(debugeeName); + display("\npreparing the next testcase..."); + display("debugeeClass\t\t:" + debugeeClass.name()); + display("line number:\t" + redefineclasses001a.brkpLineNumber[eventCount]); + display("setting breakpoint..."); + debugee.setBreakpoint(debugeeClass, + redefineclasses001a.brkpMethodName, + redefineclasses001a.brkpLineNumber[eventCount]); + } + + private void invokeMethod(ClassType clsType, String methodName, + ThreadReference thread) { + Method mthd = debugee.methodByName(clsType, methodName); + display("\ninvoking method\t:\"" + mthd.name() + "\""); + display("-------------------------------"); + Vector args = new Vector(); + args.add(debugee.VM().mirrorOf(false)); + try { + clsType.invokeMethod(thread, mthd, args, 0); + } catch (InvalidTypeException e) { + throw new Failure(UNEXPECTED_STRING + e); + } catch (ClassNotLoadedException e) { + throw new Failure(UNEXPECTED_STRING + e); + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } catch (InvocationException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private boolean checkFieldVal(ReferenceType refType, String fieldName, + int expectedValue) { + display("checking flag's value"); + Field fld = refType.fieldByName(fieldName); + PrimitiveValue val = (PrimitiveValue )refType.getValue(fld); + if (val.intValue() == expectedValue) { + display("The field has expected value:\t" + + redefineclasses001b.flag2String(expectedValue)); + return true; + } else { + complain("The field has value:\t" + + redefineclasses001b.flag2String(val.intValue())); + complain("but it is expected:\t" + + redefineclasses001b.flag2String(expectedValue)); + exitStatus = Consts.TEST_FAILED; + + return false; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/TestDescription.java new file mode 100644 index 00000000000..a5ca6696161 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/TestDescription.java @@ -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/Scenarios/invokeMethod/redefineclasses001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * This test based on a scenario which consists of the following steps: + * 1. Invoking debugee's static method by ClassType.invokeMethod(). + * 2. Redefinition of this method. + * 3. Invoking the one again. + * The test checks a value of static field to be equal to new value. + * When the field has unexpected value, the test fails. + * COMMENTS + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Scenarios.invokeMethod.redefineclasses001 + * nsk.jdi.Scenarios.invokeMethod.redefineclasses001a + * nsk.jdi.Scenarios.invokeMethod.redefineclasses001b + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Scenarios.invokeMethod.redefineclasses001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/newclass/redefineclasses001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/newclass/redefineclasses001b.java new file mode 100644 index 00000000000..599296ab69b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/newclass/redefineclasses001b.java @@ -0,0 +1,93 @@ +/* + * 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.Scenarios.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * redefineclasses001b is deugee's part of the redefineclasses001. + */ + +public class redefineclasses001b extends Thread{ + public final static int INITIAL_VALUE = 0; + public final static int BEFORE_REDEFINITION = 1; + public final static int AFTER_REDEFINITION = 2; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public final static String methodName = "runIt"; + public final static String flagName = "flag"; + + public static Object waitStarting = new Object(); + public static Object waitFinishing = new Object(); + public volatile static boolean notified = false; + + public void run() { + runIt(true); + } + + public static void runIt(boolean doWait) { + + flag = AFTER_REDEFINITION; +// ^^^^^^^^^^^^^^^^^^^ it will be redefined + +// System.out.println("runIt::notify..."); + notified = false; + synchronized(waitStarting) { + waitStarting.notify(); + } + notified = true; + System.out.println("runIt::notified..."); + + if (!doWait) { + return; + } + + synchronized(waitFinishing) { + try { + waitFinishing.wait(); + } catch(InterruptedException e) { + e.printStackTrace(); + } + } + } + + public static String flag2String(int value) { + switch (value) { + case INITIAL_VALUE: + return "INITIAL_VALUE(" + INITIAL_VALUE + ")"; + case BEFORE_REDEFINITION: + return "BEFORE_REDEFINITION(" + BEFORE_REDEFINITION + ")"; + case AFTER_REDEFINITION: + return "AFTER_REDEFINITION(" + AFTER_REDEFINITION + ")"; + default: + return "UNKNOWN_VALUE"; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001a.java new file mode 100644 index 00000000000..9bce5539953 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001a.java @@ -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.Scenarios.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses001a is deugee's part of the redefineclasses001. + */ +public class redefineclasses001a { + public final static String brkpMethodName = "main"; + public final static int [] brkpLineNumber = {51, 59}; + + public final static String testedObjName = "obj"; + private static Log log = null; + + public static void main(String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + + redefineclasses001b.loadClass = true; + int i = 0; + do { + switch (++i) { // brkpLineNumber[0] + case 0: + break; + case 1: + new redefineclasses001b().start(); + + waitStarting(); + + notifyFinishing(); // brkpLineNumber[1] + break; + } + } while (i < redefineclasses001.expectedEventCount); + + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void waitStarting() { + log.display("waiting start of the tested thread..."); + synchronized(redefineclasses001b.waitStarting) { + while(!redefineclasses001b.notified) { + try { + redefineclasses001b.waitStarting.wait(10); + } catch(InterruptedException e) { + log.display("Unexpected" + e); + } + } + } + } + + private static void notifyFinishing() { + log.display("notifying the thread to finish..."); + synchronized(redefineclasses001b.waitFinishing) { + redefineclasses001b.waitFinishing.notify(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001b.java new file mode 100644 index 00000000000..8871e566edf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001b.java @@ -0,0 +1,93 @@ +/* + * 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.Scenarios.invokeMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * redefineclasses001b is deugee's part of the redefineclasses001. + */ + +public class redefineclasses001b extends Thread{ + public final static int INITIAL_VALUE = 0; + public final static int BEFORE_REDEFINITION = 1; + public final static int AFTER_REDEFINITION = 2; + + public static boolean loadClass = false; + public static int flag = INITIAL_VALUE; + + public final static String methodName = "runIt"; + public final static String flagName = "flag"; + + public static Object waitStarting = new Object(); + public static Object waitFinishing = new Object(); + public volatile static boolean notified = false; + + public void run() { + runIt(true); + } + + public static void runIt(boolean doWait) { + + flag = BEFORE_REDEFINITION; +// ^^^^^^^^^^^^^^^^^^^ it will be redefined + +// System.out.println("runIt::notify..."); + notified = false; + synchronized(waitStarting) { + waitStarting.notify(); + } + notified = true; + System.out.println("runIt::notified..."); + + if (!doWait) { + return; + } + + synchronized(waitFinishing) { + try { + waitFinishing.wait(); + } catch(InterruptedException e) { + e.printStackTrace(); + } + } + } + + public static String flag2String(int value) { + switch (value) { + case INITIAL_VALUE: + return "INITIAL_VALUE(" + INITIAL_VALUE + ")"; + case BEFORE_REDEFINITION: + return "BEFORE_REDEFINITION(" + BEFORE_REDEFINITION + ")"; + case AFTER_REDEFINITION: + return "AFTER_REDEFINITION(" + AFTER_REDEFINITION + ")"; + default: + return "UNKNOWN_VALUE"; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/choices/choices001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/choices/choices001.java new file mode 100644 index 00000000000..2194062a6bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/choices/choices001.java @@ -0,0 +1,155 @@ +/* + * 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.SelectedArgument.choices; + +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.SelectedArgument; + + +/** + * The test for the implementation of an object of the type
    + * Connector.SelectedArgument.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.SelectedArgument.choices()
    + * complies with its specification, in particular,
    + * a returned value is a non-empty "List of String".
    + * Values of Strings are not checked up.
    + *
    + * In case of error the test produces the return value 97 and
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class choices001 { + + 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.SelectedArgument.choices\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.SelectedArgument.choices\n" ; + + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.SelectedArgument argument = null; + + for ( ; ; ) { + try { +//out.println("connector"); + 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 { +// +//out.println(" argument"); + argument = (Connector.SelectedArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with SelectedArgument found\n"); + return exitCode0; + } + } + + List listofChoices = argument.choices(); + + if (listofChoices.isEmpty()) { + exitCode = exitCode2; + out.println(sErr2 + + "check: isEmpty\n" + + "error: returned List of String is empty\n"); + } else { + Iterator listIterator = listofChoices.iterator(); + + for ( ; ; ) { + try { + String choice = (String) listIterator.next(); + + } catch ( ClassCastException e1 ) { + exitCode = exitCode2; + out.println(sErr2 + + "check: String\n" + + "error: List contains non-String\n"); + break ; + } catch ( NoSuchElementException e2) { + break ; + } + } + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/choices/choices001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/choices/choices001/TestDescription.java new file mode 100644 index 00000000000..0d7acf7eee8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/choices/choices001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/SelectedArgument/choices/choices001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.SelectedArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.SelectedArgument.choices() + * complies with its specification, in particular, + * a returned value is a non-empty "List of String". + * Values of Strings are not checked up. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.SelectedArgument object is searched among + * Arguments of Connectors. + * If no the argument is found out the test exits + * with the return value = 95 and a warning message. + * - Using the method argument.choices(), + * the list of possible values is obtained. + * IF the list is empty + * THEN an error detected + * - each member of the list is checked up whether + * it is a string or not. + * IF the member is not a string + * THEN an error detected + * 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: + * Since current version of VMM doesn't implement SelectedArgument + * only this is detected but other checks are impossible. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.SelectedArgument.choices.choices001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.SelectedArgument.choices.choices001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001.java new file mode 100644 index 00000000000..6ae87b3e198 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001.java @@ -0,0 +1,158 @@ +/* + * 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.SelectedArgument.isValid; + +import java.io.PrintStream; +import java.io.Serializable; + +import java.util.Map; +import java.util.Set; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +import com.sun.jdi.VirtualMachineManager; +import com.sun.jdi.Bootstrap; +import com.sun.jdi.connect.Connector; + + +/** + * The test for the implementation of an object of the type
    + * Connector.SelectedArgument.
    + * + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.SelectedArgument.isValid()
    + * complies with its specification in the following case:
    + * - for each String in List of choices, isValid returns true;
    + *
    + * In case of any check returns a wrong value - false,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.SelectedArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.SelectedArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.SelectedArgument 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.SelectedArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with SelectedArgument found\n"); + return exitCode0; + } + } + + List listofChoices = argument.choices(); + + if (listofChoices.isEmpty()) { + exitCode = exitCode2; + out.println(sErr2 + + "error: returned List of String is empty\n"); + } else { + + Iterator listIterator = listofChoices.iterator(); + + for ( ; ; ) { + try { + String choiceString = (String) listIterator.next(); + + if (!argument.isValid(choiceString)) { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(arg)\n" + + "error: List contains invalid String\n"); + break ; + } + + } catch ( ClassCastException e1 ) { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(arg)\n" + + "error: List contains non-String\n"); + break ; + } catch ( NoSuchElementException e2) { + break ; + } + } + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001/TestDescription.java new file mode 100644 index 00000000000..8b90e0bacd4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001/TestDescription.java @@ -0,0 +1,67 @@ +/* + * 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/SelectedArgument/isValid/isvalid001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.SelectedArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.SelectedArgument.isValid() + * complies with its specification in the following case: + * - for each String in List of choices, isValid returns true. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.SelectedArgument object is searched among + * Arguments of Connectors. + * If no the argument is found out the test exits + * with the return value = 95 and a warning message. + * - To argument's List of choices, the above checks are applied. + * In case of any check returns a wrong value, + * 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: + * Since current version of VMM doesn't implement SelectedArgument + * only this is detected but other checks are impossible. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.SelectedArgument.isValid.isvalid001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.SelectedArgument.isValid.isvalid001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002.java new file mode 100644 index 00000000000..bf564e1de0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002.java @@ -0,0 +1,166 @@ +/* + * 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.SelectedArgument.isValid; + + +import java.io.PrintStream; +import java.io.Serializable; + +import java.util.Map; +import java.util.Set; +import java.util.Iterator; +import java.util.List; +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.SelectedArgument; + + +/** + * The test for the implementation of an object of the type
    + * Connector.SelectedArgument.
    + * + * The test checks up that results of the method
    + * com.sun.jdi.connect.Connector.SelectedArgument.isValid()
    + * complies with its specification in the follwing cases:
    + * - isValid returns false for null-string and
    + * for a string, different from any in the List.
    + *
    + * In case of any check returns a wrong value - true,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.SelectedArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.SelectedArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.SelectedArgument 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.SelectedArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with SelectedArgument found\n"); + return exitCode0; + } + } + + String longestString = " "; + + List listofChoices = argument.choices(); + + if (listofChoices.isEmpty()) { + exitCode = exitCode2; + out.println(sErr1 + + "error: returned List of String is empty\n"); + } else { + Iterator listIterator = listofChoices.iterator(); + + for ( ; ; ) { + try { + String choiceString = (String) listIterator.next(); + + if (longestString.length() < choiceString.length()) { + longestString = choiceString; + } + } catch ( NoSuchElementException e) { + break ; + } + } + + if (argument.isValid(null)) { + exitCode = exitCode2; + out.println(sErr1 + + "check: isValid(null)\n" + + "error: isValid returns true\n"); + } + + longestString.concat("9"); + if (argument.isValid(longestString)) { + exitCode = exitCode2; + out.println(sErr1 + + "check: isValid(longest+1 String)\n" + + "error: isValid returns true\n"); + } + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002/TestDescription.java new file mode 100644 index 00000000000..15d3ae9b636 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002/TestDescription.java @@ -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/SelectedArgument/isValid/isvalid002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.SelectedArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.SelectedArgument.isValid() + * complies with its specification in the follwing cases: + * - isValid returns false for null-string and + * - for a string, different from any in the List. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.SelectedArgument object is searched among + * Arguments of Connectors. + * If no the argument is found out the test exits + * with the return value = 95 and a warning message. + * - To argument's List of choices, the above checks are applied. + * In case of any check returns a wrong value, + * 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: + * Since current version of VMM doesn't implement SelectedArgument + * only this is detected but other checks are impossible. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.SelectedArgument.isValid.isvalid002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.SelectedArgument.isValid.isvalid002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001.java new file mode 100644 index 00000000000..6cdd5bd4455 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001.java @@ -0,0 +1,456 @@ +/* + * 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.ShortType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ShortType.
    + *
    + * The test checks that for a mirror of a short value, the casts
    + * from Type to ShortType and from PrimitiveType to ShortType
    + * don't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the casts,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares a short field and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the checks.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class shorttype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ShortType/_itself_/shorttype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new shorttype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ShortType._itself_.shorttype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......String name = 'sh';"); + String name = "sh"; + + log2(" getting: Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type();"); + Type type = debuggeeClass.getValue(debuggeeClass.fieldByName(name)).type(); + log2(" PrimitiveType primitiveType = (PrimitiveType) type;"); + PrimitiveType primitiveType = (PrimitiveType) type; + + ShortType shortType = null; + try { + log2(" checking up on cast: ShortType shortType = (ShortType) type;"); + shortType = (ShortType) type; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + try { + log2(" checking up on cast: ShortType shortType = (ShortType) primitiveType;"); + shortType = (ShortType) primitiveType; + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001/TestDescription.java new file mode 100644 index 00000000000..7db5f7169dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001/TestDescription.java @@ -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/ShortType/_itself_/shorttype001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ShortType. + * The test checks that for a mirror of a short value the casts + * from Type to ShortType and from PrimitiveType to ShortType + * don't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.ShortType._itself_.shorttype001; + * the debuggee program - nsk.jdi.ShortType._itself_.shorttype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ShortType._itself_.shorttype001 + * nsk.jdi.ShortType._itself_.shorttype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ShortType._itself_.shorttype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001a.java new file mode 100644 index 00000000000..82eb70e0eb5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001a.java @@ -0,0 +1,113 @@ +/* + * 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.ShortType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the shorttype001 JDI test. + */ + +public class shorttype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static short sh = 0; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001.java new file mode 100644 index 00000000000..483897bcc9c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001.java @@ -0,0 +1,296 @@ +/* + * 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.ShortValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + + +public class compareto001 { + //------------------------------------------------------- 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 IOPipe pipe; + private static Debugee debuggee; + private static ReferenceType debuggeeClass; + + //------------------------------------------------------- mutable common fields + + private final static String prefix = "nsk.jdi.ShortValue.compareTo"; + private final static String className = ".compareto001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + private static Value objectValue; + private static List fieldList; + + //------------------------------------------------------- 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_FAILED; + + 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() { + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return; + } + + // getting of object to check + Field field = debuggeeClass.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + + objectValue = debuggeeClass.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = debuggeeClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = debuggeeClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitiveValues = (ArrayReference)arrValue; + + fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + ShortValue value; + Field fldOtherType; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof ShortValue) ) { + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (ShortValue )v1; + + // comparing with debuggee's fields + display("Checking compateTo(Object object) method for ShortValue: " + value); + + for (int j = 0; j < primitiveValues.length(); j++) { + arrValue = primitiveValues.getValue(j); + + fldOtherType = debuggeeClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = debuggeeClass.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + + } + + //--------------------------------------------------------- test specific methods + + + private static boolean PerformComparing(ShortValue value, Object object ) { + boolean result = true; + + // assertion [ x.compareTo(x) == 0 ] + if (value.compareTo(value) != 0) { + complain("Failed assertion [ x.compareTo(x) == 0 ] for value: " + value.toString()); + result = false; + } + + if (object instanceof ShortValue) { + ShortValue shortObject = (ShortValue)object; + try { + // assertion [ x.compareTo(y) == 0 <==> x.equals(y) ] + if ( ((value.equals(object)) && (value.compareTo(shortObject) != 0)) || + (!(value.equals(object)) && (value.compareTo(shortObject) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (x.equals(y) == true) ] \n\t" + + "where 'x' is ShortValue: " + value + " and 'y' is ShortValue : " + shortObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(shortObject) + "\n\t" + + "result of (x.equals(y)): " + value.equals(object) ); + result = false; + } + + // assertion [ x.compareTo(y) == 0 <==> y.compareTo(x) == 0 ] + if ( ((value.compareTo(shortObject) == 0) && (shortObject.compareTo(value) != 0)) || + ((value.compareTo(shortObject) != 0) && (shortObject.compareTo(value) == 0)) ) { + complain("Failed assertion [ (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0) ] \n\t" + + "where 'x' is ShortValue: " + value + " and 'y' is ShortValue : " + shortObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(shortObject) + "\n\t" + + "result of (y.compareTo(x)): " + shortObject.compareTo(value) ); + result = false; + } + if (value.compareTo(shortObject) != 0) { + // assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] + if (value.compareTo(shortObject) != -(shortObject.compareTo(value))) { + complain("Failed assertion [ if (x.compareTo(y) == i) then (y.compareTo(x) == -i) ] \n\t" + + "where 'x' is ShortValue: " + value + " and 'y' is ShortValue : " + shortObject + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(shortObject) + "\n\t" + + "result of (y.compareTo(x)): " + shortObject.compareTo(value) ); + result = false; + } + } + + // assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] + if (value.compareTo(shortObject) > 0) { + ShortValue lessValue = FindLessShortValue(shortObject); + if (lessValue != null) { + if (value.compareTo(lessValue) <= 0) { + complain("Failed assertion [ if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0) ] \n\t" + + "where 'x' is ShortValue: " + value + " , 'y' is ShortValue : " + shortObject + " , 'z' is ShortValue : " + lessValue + " \n\t" + + "result of (x.compareTo(y)): " + value.compareTo(shortObject) + "\n\t" + + "result of (y.compareTo(z)): " + shortObject.compareTo(lessValue) + "\n\t" + + "result of (x.compareTo(z)): " + value.compareTo(lessValue) ); + result = false; + } + } + } + + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "ShortValue: " + value + " and ShortValue argument: " + object); + result = false; + } + + } else if (object == null) { + try { + value.compareTo(null); + complain("Does not throw expected NullPointerException when comparing \n\t" + + "ShortValue: " + value + " and null argument"); + result = false; + } catch (NullPointerException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "ShortValue: " + value + " and null argument"); + result = false; + } + } else { + try { + value.compareTo((ShortValue)object); + complain("Does not throw expected ClassCastException when comparing \n\t" + + "ShortValue: " + value + " and argument: " + object); + result = false; + } catch (ClassCastException ne) { + // continue + } catch (Exception e) { + complain("Caught unexpected " + e + " when comparing \n\t" + + "ShortValue: " + value + " and argument: " + object); + result = false; + } + } + + return result; + } + + /** + * This function searches the static fieldList - the list of mirrored + * fields of debuggee's compareto001aClassToCheck class. Search is aimed + * to find another ShortValue field which is less then method's argument via + * compareTo method. + */ + + private static ShortValue FindLessShortValue (ShortValue currentValue) { + ShortValue result = null; + + for (int i = 0; i < fieldList.size(); i++ ) { + + Field field = (Field )fieldList.get(i); + ShortValue newValue = (ShortValue)((ObjectReference )objectValue).getValue(field); + + if (currentValue.compareTo(newValue) > 0) { + result = newValue; + break; + } + } + return result; + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001/TestDescription.java new file mode 100644 index 00000000000..921d39928fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001/TestDescription.java @@ -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/ShortValue/compareTo/compareto001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the compareTo(Object o) method of com.sun.jdi.ShortValue + * interface. This method is inherited from java.lang.Comparable interface. + * The test checks the following assertions which imply from spec for + * Comparable.compareTo(Object o): + * - (x.compareTo(y) == 0) is identical to (x.equals(y) == true); + * - (x.compareTo(y) == 0) is identical to (y.compareTo(x) == 0); + * - if (x.compareTo(y) == i) then (y.compareTo(x) == -i); + * - if (x.compareTo(y) > 0) and (y.compareTo(z) > 0), then (x.compareTo(z) > 0); + * - if an argument is null, then NullPointerException is thrown; + * - if an argument is not of ShortValue type, then a ClassCastException is thrown. + * where 'x', 'y' and 'z' denote ShortValue object. + * The debugger program - nsk.jdi.ShortValue.compareto.compareto001; + * the debuggee program - nsk.jdi.ShortValue.compareto.compareto001a; + * The test works as follows: + * Using nsk.jdi.share classes, the debugger connects to the debuggee. + * Then the debugger gets a list of short fields of debuggee's object of + * compareto001aClassToCheck type. For every field a mirror of ShortValue type + * is created and the assertions are checked. A various values for comparison + * are got from values of mirrors of debuggee's static fields. + * 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.ShortValue.compareTo.compareto001 + * nsk.jdi.ShortValue.compareTo.compareto001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ShortValue.compareTo.compareto001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001a.java new file mode 100644 index 00000000000..85b281d3373 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001a.java @@ -0,0 +1,175 @@ +/* + * 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.ShortValue.compareTo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class compareto001a { + + //----------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + static compareto001aClassToCheck testedObj = new compareto001aClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + //------------------------------------------------------ mutable common method + + public static void main (String argv[]) { + + exitStatus = Consts.TEST_FAILED; + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(log); + + try { + pipe.println(compareto001.SIGNAL_READY); +// receiveSignal(compareto001.SIGNAL_GO); + + receiveSignal(compareto001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class compareto001aClassToCheck { + public short shortMAX = Short.MAX_VALUE; + public short short1 = 1; + public short short0 = 0; + public short short_1 = -1; + public short shortMIN = Short.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001.java new file mode 100644 index 00000000000..92150b242dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001.java @@ -0,0 +1,247 @@ +/* + * 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.ShortValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ShortValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ShortValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static short plus1_1 = +1;
    + * public static short plus1_2 = +1;
    + * public static short minus1 = -1;
    + * public static int intplus1 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * ShortValue svplus1_1;
    + * ShortValue svplus1_2;
    + * ShortValue svminus1;
    + * IntegerValue ivplus1;
    + *
    + * the following is true:
    + *
    + * svplus1_1 == svplus1_2
    + * svplus1_1 != svminus1
    + * svplus1_1 != ivplus1
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ShortValue/equals/equals001", + sHeader2 = "--> equals001: ", + sHeader3 = "##> equals001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ShortValue.equals.equals001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("equals001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsplus1_1 = execClass.fieldByName("plus1_1"); + Field fsplus1_2 = execClass.fieldByName("plus1_2"); + Field fsminus1 = execClass.fieldByName("minus1"); + Field fiplus1 = execClass.fieldByName("intplus1"); + + ShortValue svplus1_1 = (ShortValue) execClass.getValue(fsplus1_1); + ShortValue svplus1_2 = (ShortValue) execClass.getValue(fsplus1_2); + ShortValue svminus1 = (ShortValue) execClass.getValue(fsminus1); + IntegerValue ivplus1 = (IntegerValue) execClass.getValue(fiplus1); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (!svplus1_1.equals(svplus1_2)) + expresult = 1; + break; + + case 1: if (svplus1_1.equals(svminus1)) + expresult = 1; + break; + + case 2: if (svplus1_1.equals(ivplus1)) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001/TestDescription.java new file mode 100644 index 00000000000..b6b50a25403 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001/TestDescription.java @@ -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/ShortValue/equals/equals001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ShortValue. + * The test checks up that a result of the method + * com.sun.jdi.ShortValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this ShortValue for equality. + * Returns: true if the Object is a ShortValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.ShortValue.equals.equals001; + * a debuggee program - nsk.jdi.ShortValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.ShortValue.equals.equals001 + * nsk.jdi.ShortValue.equals.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ShortValue.equals.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001a.java new file mode 100644 index 00000000000..d1f49112d3d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals001a.java @@ -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.ShortValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001a JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> equals001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> equals001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static short smallest = Short.MIN_VALUE; +// public static short zero = 0; +// public static short largest = Short.MAX_VALUE; + + public static short plus1_1 = +1; + public static short plus1_2 = +1; + public static short minus1 = -1; + + public static int intplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * types and when parameter is null.
    + * Analyse of the method executing is performed by PerformComparing + * method.
    + * First parameter of PerformComparing is static field of testedObj,
    + * which is placed onto debugee's side.
    + * + * Second parameter is got from debugee too:
    + * Debugee has array of boundary values of each primitive type, execTest reads
    + * them and calls PerformComparing for each of them.
    + */ +public class equals002 { + + private final static String prefix = "nsk.jdi.ShortValue.equals."; + private final static String className = "equals002"; + private final static String debuggerName = prefix + className; + private final static String debugeeName = debuggerName + "a"; + private final static String objectToCheck = "testedObj"; + private final static String arrPrimitives = "testedFields"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static ReferenceType refType; + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_FAILED; + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + execTest(); + debugee.quit(); + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + private static void execTest() { + + exitStatus = Consts.TEST_FAILED; + + refType = debugee.classByName(debugeeName); + if ( refType == null ) { + complain("Class '" + debugeeName + "' not found."); + return; + } + + // getting of object to check + Field field = refType.fieldByName(objectToCheck); + if ( field == null ) { + complain("Field '" + objectToCheck + "' not found."); + return; + } + Value objectValue = refType.getValue(field); + if ( objectValue == null ) { + complain("Field '" + objectToCheck + "' not initialized."); + return; + } + + // geting of array of primitive types + field = refType.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + return; + } + Value arrValue = refType.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + return; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + List fieldList = ((ClassType )objectValue.type()).allFields(); + + Value v1, currentValue; + ShortValue value; + Field fldOtherType; + String msg; + + exitStatus = Consts.TEST_PASSED; + + // comparing loop + for (int i = 0; i < fieldList.size(); i++ ) { + field = (Field )fieldList.get(i); + log.display(""); + msg = "***" + field; + v1 = ((ObjectReference )objectValue).getValue(field); + if ( !(v1 instanceof ShortValue) ) { + msg += " is not ShortValue (skipped)"; + exitStatus = Consts.TEST_FAILED; + continue; + } + value = (ShortValue )v1; + + // comparing with debugee's fields + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = refType.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + currentValue = refType.getValue(fldOtherType); + + if ( !PerformComparing(value, currentValue) ) + exitStatus = Consts.TEST_FAILED; + } + } + } + + private static boolean PerformComparing(ShortValue value, Object object ) { + boolean res = true; + String msg = ""; + try { + if ( value.equals(object) ) { + if ( object instanceof ShortValue ) { + if ( value.value() == ((PrimitiveValue )object).shortValue() ) { + msg += "--> " + value + " == " + object; + } else { + msg += "##> " + value + " == " + object; + res = false; + } + } + else { + msg += "##> " + value + " == " + object + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if ( object == null ) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if ( object instanceof ShortValue ) { + if ( value.value() != ((PrimitiveValue )object).shortValue() ) { + msg += "--> " + value + " != " + object; + } else { + msg += "##> " + value + " != " + object; + res = false; + } + } + else { + msg += "--> " + value + " != " + object; + } + } + + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..7d64104bf54 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals002/TestDescription.java @@ -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/ShortValue/equals/equals002. + * 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.ShortValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this ShortValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a ShortValue and if applying "==" to the two + * mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has boundary values of primitive + * types. Also, case when parameter is considered. + * No exceptions are expected. + * 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.ShortValue.equals.equals002 + * nsk.jdi.ShortValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ShortValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals002a.java new file mode 100644 index 00000000000..aa9782c4330 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/equals/equals002a.java @@ -0,0 +1,142 @@ +/* + * 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.ShortValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * equals002a is deugee's part of the test.
    + * It contains the static fields with boundary values for each primitive type.
    + * ClassToCheck delivers values for first parameter of equals.
    + */ +public class equals002a { + + static ClassToCheck testedObj = new ClassToCheck(); + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByte1", + "cmpByte0", + "cmpByte_1", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDouble1", + "cmpDouble0", + "cmpDouble_1", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloat1", + "cmpFloat0", + "cmpFloat_1", + "cmpFloatMIN", + "cmpIntMAX", + "cmpInt1", + "cmpInt0", + "cmpInt_1", + "cmpIntMIN", + "cmpLongMAX", + "cmpLong1", + "cmpLong0", + "cmpLong_1", + "cmpLongMIN", + "cmpShortMAX", + "cmpShort1", + "cmpShort0", + "cmpShort_1", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByte1 = 1; + static byte cmpByte0 = 0; + static byte cmpByte_1 = -1; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDouble1 = 1; + static double cmpDouble0 = 0; + static double cmpDouble_1 = -1; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloat1 = 1; + static float cmpFloat0 = 0; + static float cmpFloat_1 = -1; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpInt1 = 1; + static int cmpInt0 = 0; + static int cmpInt_1 = -1; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLong1 = 1; + static long cmpLong0 = 0; + static long cmpLong_1 = -1; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShort1 = 1; + static short cmpShort0 = 0; + static short cmpShort_1 = -1; + static short cmpShortMIN = Short.MIN_VALUE; + + 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 received."); + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("DEBUGEE FAILURE> unexpected signal " + + "(no \"quit\") - " + instruction); + log.complain("DEBUGEE FAILURE> TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class ClassToCheck { + public short shortMAX = Short.MAX_VALUE; + public short short1 = 1; + public short short0 = 0; + public short short_1 = -1; + public short shortMIN = Short.MIN_VALUE; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001.java new file mode 100644 index 00000000000..61819af6665 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001.java @@ -0,0 +1,234 @@ +/* + * 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.ShortValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ShortValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ShortValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static short plus1_1 = +1;
    + * public static short plus1_2 = +1;
    + *
    + * which a debugger mirros as :
    + *
    + * ShortValue svplus1_1;
    + * ShortValue svplus1_2;
    + *
    + * the following is true:
    + *
    + * svplus1_1.hashCode() == svplus1_1.hashCode()
    + * svplus1_1.hashCode() == svplus1_2.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ShortValue/hashCode/hashcode001", + sHeader2 = "--> hashcode001: ", + sHeader3 = "##> hashcode001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ShortValue.hashCode.hashcode001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("hashcode001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsplus1_1 = execClass.fieldByName("plus1_1"); + Field fsplus1_2 = execClass.fieldByName("plus1_2"); + + ShortValue svplus1_1 = (ShortValue) execClass.getValue(fsplus1_1); + ShortValue svplus1_2 = (ShortValue) execClass.getValue(fsplus1_2); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (svplus1_1.hashCode() != svplus1_1.hashCode()) + expresult = 1; + break; + + case 1: if (svplus1_1.hashCode() != svplus1_2.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..092a529bc5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001/TestDescription.java @@ -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/ShortValue/hashCode/hashcode001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ShortValue. + * The test checks up that a result of the method + * com.sun.jdi.ShortValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this ShortValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.ShortValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.ShortValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.ShortValue.hashCode.hashcode001 + * nsk.jdi.ShortValue.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ShortValue.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001a.java new file mode 100644 index 00000000000..1c52d8cf363 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/hashCode/hashcode001a.java @@ -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.ShortValue.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001a JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> hashcode001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> hashcode001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + +// public static short smallest = Short.MIN_VALUE; +// public static short zero = 0; +// public static short largest = Short.MAX_VALUE; + + public static short plus1_1 = +1; + public static short plus1_2 = +1; +// public static short minus1 = -1; + +// public static int intplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ShortValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ShortValue.value()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * public static short smallest = Short.MIN_VALUE;
    + * public static short zero = 0;
    + * public static short largest = Short.MAX_VALUE;
    + *
    + * which a debugger mirros as :
    + *
    + * ShortValue svsmallest;
    + * ShortValue svzero;
    + * ShortValue svlargest;
    + *
    + * the following is true:
    + *
    + * svsmallest == Short.MIN_VALUE
    + * svzero == 0
    + * svlargest == Short.MAX_VALUE
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ShortValue/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ShortValue.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fssmallest = execClass.fieldByName("smallest"); + Field fszero = execClass.fieldByName("zero"); + Field fslargest = execClass.fieldByName("largest"); + + ShortValue svsmallest = (ShortValue) execClass.getValue(fssmallest); + ShortValue svzero = (ShortValue) execClass.getValue(fszero); + ShortValue svlargest = (ShortValue) execClass.getValue(fslargest); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: if (svsmallest.value() != Short.MIN_VALUE) + expresult = 1; + break; + + case 1: if (svzero.value() != 0) + expresult = 1; + break; + + case 2: if (svlargest.value() != Short.MAX_VALUE) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/value/value001/TestDescription.java new file mode 100644 index 00000000000..f6a4b0e89aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/value/value001/TestDescription.java @@ -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/ShortValue/value/value001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ShortValue. + * The test checks up that a result of the method + * com.sun.jdi.ShortValue.value() + * complies with its spec: + * public short value() + * Returns this ShortValue as a short. + * Returns: the short mirrored by this object. + * The test works as follows: + * A debugger program - nsk.jdi.ShortValue.value.value001; + * a debuggee program - nsk.jdi.ShortValue.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.ShortValue.value.value001 + * nsk.jdi.ShortValue.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ShortValue.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/value/value001a.java new file mode 100644 index 00000000000..82aa1a1979f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ShortValue/value/value001a.java @@ -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.ShortValue.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + public static short smallest = Short.MIN_VALUE; + public static short zero = 0; + public static short largest = Short.MAX_VALUE; + +// public static short plus1_1 = +1; +// public static short plus1_2 = +1; +// public static short minus1 = -1; + +// public static int intplus1 = +1; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.StackFrame.setValue(Var, Object)
    + * com.sun.jdi.StackFrame.getValue(Var)
    + * for boundry values of primitive types
    + * + * Test checks up the following assertion:
    + * Primitive arguments must be either assignment compatible with
    + * the Var type or must be convertible to the Var type
    + * without loss of information.
    + * for every primitive type.
    + */ + +public class bounds001 extends ValueConversionDebugger { + + static class TestedVariableData { + String name; + ValueType type; + + TestedVariableData(String name, ValueType type) { + this.name = name; + this.type = type; + } + } + + private static TestedVariableData[] testedVars = { + new TestedVariableData("byteVar", BYTE), + new TestedVariableData("charVar", CHAR), + new TestedVariableData("doubleVar", DOUBLE), + new TestedVariableData("floatVar", FLOAT), + new TestedVariableData("intVar", INT), + new TestedVariableData("longVar", LONG), + new TestedVariableData("shortVar", SHORT) + }; + + private static byte [] byteVarValues = + {Byte.MIN_VALUE, + -1, + 0, + 1, + Byte.MAX_VALUE}; + private static char [] charVarValues = + {Character.MIN_VALUE, + Character.MAX_VALUE}; + private static double [] doubleVarValues = + {Double.NEGATIVE_INFINITY, + -1.5D, + -1.0D, + -0.0D, + +0.0D, + Double.MIN_VALUE, + 1.0D, + 1.5D, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY}; + private static float [] floatVarValues = + {Float.NEGATIVE_INFINITY, + -1.5F, + -1.0F, + -0.0F, + +0.0F, + Float.MIN_VALUE, + 1.0F, + 1.5F, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY}; + private static int [] intVarValues = + {Integer.MIN_VALUE, + -1, + 0, + 1, + 1234567890, + Integer.MAX_VALUE}; + private static long [] longVarValues = + {Long.MIN_VALUE, + -1L, + 0L, + 1234567890123456789L, + 1L, + Long.MAX_VALUE}; + private static short [] shortVarValues = + {Short.MIN_VALUE, + -1, + 0, + 1, + Short.MAX_VALUE}; + + protected String debuggeeClassName() { + return bounds001a.class.getName(); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + return new bounds001().runIt(argv, out); + } + + protected void doTest() { + debuggee.suspend(); + + ThreadReference thread = debuggee.threadByName(bounds001a.TEST_THREAD_NAME); + StackFrame stackFrame = null; + try { + for (int i = 0; i < thread.frameCount(); i++) { + stackFrame = thread.frame(i); + if (stackFrame.location().method().name().equals("run") ) { + break; + } + } + } catch (IncompatibleThreadStateException e) { + complain("Unexpected " + e); + setSuccess(false); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + Location loc = stackFrame.location(); + display("StackFrame: " + loc.declaringType().name()); + display(" method: " + loc.method().name()); + display(""); + + PrimitiveValue retValue, value; + Object arr = null; + boolean validConversion; + + LocalVariable var = null; + for (TestedVariableData testedVar : testedVars) { + try { + var = stackFrame.visibleVariableByName(testedVar.name); + } catch (AbsentInformationException e) { + complain("Unexpected " + e); + setSuccess(false); + continue; + } + display("LocalVariable: " + var.name()); + display("======================"); + for (ValueType type : ValueType.values()) { + switch (type) { + case BYTE: + arr = byteVarValues; + display("byte values"); + break; + case CHAR: + arr = charVarValues; + display("char values"); + break; + case DOUBLE: + arr = doubleVarValues; + display("double values"); + break; + case FLOAT: + arr = floatVarValues; + display("float values"); + break; + case INT: + arr = intVarValues; + display("integer values"); + break; + case LONG: + arr = longVarValues; + display("long values"); + break; + case SHORT: + arr = shortVarValues; + display("short values"); + break; + default: + complain("***TEST CASE ERROR***"); + setSuccess(false); + continue; + } + display("-----------------"); + for (int i = 0; i < Array.getLength(arr); i++) { + value = createValue(arr, i); + validConversion = isValidConversion(testedVar.type, value); + display(">value = " + value.toString()); + try { + stackFrame.setValue(var, value); + if (!validConversion) { + complain(lastConversion); + complain("***InvalidTypeException is not thrown***"); + display(""); + setSuccess(false); + continue; + } + retValue = (PrimitiveValue )stackFrame.getValue(var); + + checkValueConversion(value, retValue); + } catch(InvalidTypeException e) { + if (validConversion) { + complain(lastConversion); + complain("*** unexpected InvalidTypeException***"); + display(""); + setSuccess(false); + } else { + display(lastConversion); + display("!!!expected InvalidTypeException"); + display(""); + } + } catch(Exception e) { + complain("unexpected " + e); + display(""); + setSuccess(false); + } + } + display(""); + } + } + + display("============="); + display("TEST FINISHES\n"); + + debuggee.resume(); + + pipe.println(bounds001a.COMMAND_STOP_TEST_THREAD); + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001/TestDescription.java new file mode 100644 index 00000000000..c47f4b906f8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001/TestDescription.java @@ -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/StackFrame/_bounds_/bounds001. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-6604963 + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods: + * com.sun.jdi.StackFrame.setValue(Field, Object) + * com.sun.jdi.StackFrame.getValue(Field) + * for boundry values of primitive types + * Test checks up the following assertion: + * Primitive arguments must be either assignment compatible with + * the field type or must be convertible to the field type + * without loss of information. + * for every primitive type. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame._bounds_.bounds001 + * nsk.jdi.StackFrame._bounds_.bounds001a + * + * @comment make sure bounds001a is compiled with full debug info + * @clean nsk.jdi.StackFrame._bounds_.bounds001a + * @compile -g:lines,source,vars ../bounds001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame._bounds_.bounds001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001a.java new file mode 100644 index 00000000000..7362c558c79 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001a.java @@ -0,0 +1,99 @@ +/* + * 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.StackFrame._bounds_; + +import nsk.share.jdi.*; + +/** + * bounds001a is deugee's part of the bounds001. + */ +public class bounds001a extends AbstractJDIDebuggee { + + static public final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + static public final String TEST_THREAD_NAME = "nsk.jdi.StackFrame._bounds_.bounds001a_TestThread"; + + class TestThread extends Thread { + boolean started; + + TestThread() { + super(TEST_THREAD_NAME); + } + + public void run() { + /* + * Local variables required by debugger + */ + byte byteVar = 0; + char charVar = ' '; + double doubleVar = 0; + float floatVar = 0; + int intVar = 0; + long longVar = 0; + short shortVar = 0; + + started = true; + + try { + Thread.sleep(Long.MAX_VALUE); + } catch (InterruptedException e) { + // expected exception + } + } + } + + private TestThread testThread; + + protected String[] doInit(String[] args) { + testThread = new TestThread(); + testThread.start(); + + while (!testThread.started) + Thread.yield(); + + return super.doInit(args); + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_STOP_TEST_THREAD)) { + testThread.interrupt(); + try { + log.display("Wait for test thread: " + testThread); + testThread.join(); + } catch (InterruptedException e) { + unexpectedException(e); + } + + return true; + } + + return false; + } + + public static void main (String args[]) { + new bounds001a().doTest(args); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002.java new file mode 100644 index 00000000000..acd9db249ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002.java @@ -0,0 +1,232 @@ +/* + * 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.StackFrame._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up StackFrame methods for the following cases:
    + * - getValue(null)
    + * - getValues(null)
    + * - getValues(list with size = 0)
    + * - setValue(null, null)
    + * - setValue(field, null)
    + * - visibleVariableByName(null)
    + * - visibleVariableByName("")
    + * NullPointerException is expected for every test case + * except for the three last. + */ + +public class bounds002 { + + private final static String prefix = "nsk.jdi.StackFrame._bounds_."; + private final static String debuggerName = prefix + "bounds002"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds002 thisTest = new bounds002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + ThreadReference thread = debugee.threadByName("main"); + StackFrame stackFrame = null; + try { + for (int i = 0; i < thread.frameCount(); i++) { + stackFrame = thread.frame(i); + if (stackFrame.location().method().name().equals("main") ) { + break; + } + } + } catch (IncompatibleThreadStateException e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + Location loc = stackFrame.location(); + try { + display("StackFrame: " + loc.sourcePath()); + display(" method: " + loc.method().name()); + } catch (AbsentInformationException e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + return; + } + display(""); + + Value retValue; + + display("getValue(null)"); + try { + retValue = stackFrame.getValue(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("getValues(null)"); + try { + stackFrame.getValues(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + List lst = null; + display("getValues(list with size = 0)"); + try { + stackFrame.getValues(lst); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("setValue(null, null)"); + try { + stackFrame.setValue(null, null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("setValue(variable, null)"); + LocalVariable var = null; + try { + var = stackFrame.visibleVariableByName(bounds002a.testedFieldName); + } catch (AbsentInformationException e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + try { + stackFrame.setValue(var, null); + display("OK"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("visibleVariableByName(null)"); + try { + var = stackFrame.visibleVariableByName(null); + if (var != null ) { + complain("Unexpected local variable "); + exitStatus = Consts.TEST_FAILED; + } else { + display("OK"); + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("visibleVariableByName(\"\")"); + try { + var = stackFrame.visibleVariableByName(""); + if (var != null ) { + complain("Unexpected local variable \"\""); + exitStatus = Consts.TEST_FAILED; + } else { + display("OK"); + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002/TestDescription.java new file mode 100644 index 00000000000..3d0f0cd5768 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002/TestDescription.java @@ -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/StackFrame/_bounds_/bounds002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods com.sun.jdi.StackFrame + * for the following cases: + * - getValue(null) + * - getValues(null) + * - getValues(list with size = 0) + * - setValue(null, null) + * - setValue(field, null) + * - visibleVariableByName(null) + * - visibleVariableByName("") + * NullPointerException is expected for every test case except for + * the three last. + * In cases + * setValue(field, null) + * visibleVariableByName(null) + * visibleVariableByName("") + * no exception is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame._bounds_.bounds002 + * nsk.jdi.StackFrame._bounds_.bounds002a + * + * @comment make sure bounds002a is compiled with full debug info + * @clean nsk.jdi.StackFrame._bounds_.bounds002a + * @compile -g:lines,source,vars ../bounds002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame._bounds_.bounds002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002a.java new file mode 100644 index 00000000000..097a82cbd2d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002a.java @@ -0,0 +1,55 @@ +/* + * 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.StackFrame._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * bounds002a is deugee's part of the bounds002. + */ +public class bounds002a { + + public final static String testedFieldName = "testedObj"; + + public static void main (String argv[]) { + bounds002b testedObj = new bounds002b(); + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println(bounds002.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(bounds002.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class bounds002b { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001.java new file mode 100644 index 00000000000..dafba15cb59 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2007, 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/StackFrame/getArgumentValues/getArgumentValues001. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that method 'StackFrame.getArgumentValues()' returns the values of all arguments in this frame. + * Test calls 'StackFrame.getArgumentValues()' for following methods: + * - methods receiving as argument single argument of primitive type + * - method receiving as argument Object + * - method receiving as argument String + * - method without arguments + * - method receiving all primitive types and Object as arguments + * - method receiving arrays of all primitive types and Object array as arguments + * - method receiving multidimensional arrays of all primitive types and Object multidimensional array as arguments + * - method with single arument, method changes argument several times + * - method with several arguments, arguments are changed in loop many times + * - static method receiving all primitive types and Object as arguments + * - static method with single arument, method changes argument several times + * - static method with several arguments, arguments are changed in loop many times + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getArgumentValues.getArgumentValues001.getArgumentValues001 + * nsk.jdi.StackFrame.getArgumentValues.getArgumentValues001.getArgumentValues001a + * + * @comment make sure getArgumentValues001a is compiled with full debug info + * @clean nsk.jdi.StackFrame.getArgumentValues.getArgumentValues001.getArgumentValues001a + * @compile -g:lines,source,vars getArgumentValues001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getArgumentValues.getArgumentValues001.getArgumentValues001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.StackFrame.getArgumentValues.getArgumentValues001; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.*; +import nsk.share.jdi.*; + +/* + * Test checks that method 'StackFrame.getArgumentValues()' returns the values of all arguments in this frame. + * + * Test checks method 'getArgumentValues()' using special class 'getArgumentValues001a.TestClass'. This class + * contains methods with various arguments and contains static array 'testLocations' with information about + * locations intended for breakpoints, before executing code at this locations debuggee saves values of current + * method arguments at special static array 'TestClass.expectedArgumentValues'. + * Debugger creates BreakpointRequests for test locations using infromation from 'TestClass.testLocations', + * starts thread listening BreakpointEvents and forces debuggee to execute methods of 'getArgumentValues001a.TestClass'. + * When BreakpointEvent is received debugger obtains StackFrame for current frame of thread which was stoped by breakpoint, + * then debugger obtains expected argument values from static array 'TestClass.expectedArgumentValues' and compares + * expected values with values returned by method 'StackFrame.getArgumentValues()'. + */ +public class getArgumentValues001 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getArgumentValues001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return getArgumentValues001a.class.getName(); + } + + private Value extractValue(Value value) { + if (value == null) + return value; + + String valueClassName = getArgumentValues001a.Value.class.getName(); + + /* if value is instance of 'getArgumentValues001a.Value' extact primitive type value + * (name of primitive type is stored in field 'name' and primitive type value is stored + * in field with name "Value") + */ + if (value.type().name().equals(valueClassName)) { + ReferenceType valueClass = debuggee.classByName(valueClassName); + + Field typeNameField = valueClass.fieldByName("name"); + String typeName = ((StringReference)((ObjectReference)value).getValue(typeNameField)).value(); + + Field valueField = valueClass.fieldByName(typeName + "Value"); + + return ((ObjectReference)value).getValue(valueField); + } else + return value; + } + + // print information about expected and actual argument values + void printDebugInfo(List values, ArrayReference expectedValues) { + log.display("Values:"); + int i = 0; + for (Value value : values) { + log.display("Value " + i + ": " + value); + i++; + } + log.display("Expected values:"); + for (i = 0; i < expectedValues.length(); i++) { + log.display("Value " + i + ": " + extractValue(expectedValues.getValue(i))); + } + } + + // information about BreakpointEvents generated by debuggee VM + static class BreakpointData { + + public BreakpointData(BreakpointRequest request, int breakpointsNumber) { + this.request = request; + this.breakpointsNumber = breakpointsNumber; + } + + // breakpoint request + BreakpointRequest request; + // how events are generated for request + int breakpointsNumber; + } + + private Location getLocation(ReferenceType referenceType, int lineNumber) throws AbsentInformationException { + for (Location location : referenceType.allLineLocations()) { + if (location.lineNumber() == lineNumber) + return location; + } + + throw new TestBug("Can't find location with lineNumber = " + lineNumber + " for class " + referenceType); + } + + public void doTest() { + List requests = new ArrayList(); + + ReferenceType referenceType = debuggee.classByName(getArgumentValues001a.TestClass.class.getName()); + try { + // array 'getArgumentValues001a.TestClass.testLocations' contains infromation about BreakpointEvents + // which will be generated during test, create List of BreakpointData based on this information + for (getArgumentValues001a.LocationData locationData : getArgumentValues001a.TestClass.testLocations) { + BreakpointRequest request = debuggee.getEventRequestManager().createBreakpointRequest(getLocation(referenceType, locationData.lineNumber)); + request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + requests.add(new BreakpointData(request, locationData.breakpointsNumber)); + request.enable(); + } + } catch (AbsentInformationException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + return; + } + + boolean testThreadStarted = false; + ThreadReference testThread = null; + + try { + for (BreakpointData requestData : requests) { + + for (int i = 0; i < requestData.breakpointsNumber; i++) { + // start thread wich waits next event generated for given EventRequest + EventListenerThread listenerThread = new EventListenerThread(requestData.request); + listenerThread.start(); + listenerThread.waitStartListen(); + + // if thread wasn't started start it + if (!testThreadStarted) { + pipe.println(getArgumentValues001a.COMMAND_START_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + testThreadStarted = true; + } else + testThread.resume(); + + // wait for next BreakpointEvent + BreakpointEvent event = (BreakpointEvent)listenerThread.getEvent(); + + // expected argument values are stored in special static array 'expectedArgumentValues' + ArrayReference expectedArgValues = (ArrayReference)referenceType.getValue(referenceType.fieldByName("expectedArgumentValues")); + + // get current frame + StackFrame frame = event.thread().frame(0); + List values = frame.getArgumentValues(); + System.out.println("Total values: " + values.size()); + + if (expectedArgValues.length() != values.size()) { + setSuccess(false); + log.complain("Unexpected arguments number: " + values.size() + ", expected number is " + expectedArgValues.length()); + printDebugInfo(values, expectedArgValues); + continue; + } else { + for (int j = 0; j < values.size(); j++) { + Value value = values.get(j); + // values for primitive types are wrapped in special class 'getArgumentValues001a.Value' and + // real value should be extracted before comparing + Value expectedValue = extractValue(expectedArgValues.getValue(j)); + + boolean success; + + if (expectedValue == null) { + success = (value == null); + } else { + success = expectedValue.equals(value); + } + + if (!success) { + setSuccess(false); + log.complain("Unexpected argument value: " + value + ", expected value: " + expectedValue); + printDebugInfo(values, expectedArgValues); + continue; + } + } + } + + if (testThread == null) + testThread = event.thread(); + } + + } + } catch (Throwable t) { + setSuccess(false); + log.complain("Unexpected exception: " + t); + t.printStackTrace(log.getOutStream()); + return; + } + + if (testThread != null) + testThread.resume(); + + pipe.println(getArgumentValues001a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001a.java new file mode 100644 index 00000000000..d88268c4690 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001a.java @@ -0,0 +1,483 @@ +/* + * Copyright (c) 2007, 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.StackFrame.getArgumentValues.getArgumentValues001; + +import java.util.*; +import nsk.share.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/* + * Debugee class, starts thread which executes methods with various arguments. + * + * !!! Edit carefully, array 'getArgumentValues001a.TestClass.testLocations' contains hardcored line numbers !!! + */ +public class getArgumentValues001a extends AbstractJDIDebuggee { + + // class contains methods with different arguments + static class TestClass { + + Log log; + + TestClass(Log log) { + this.log = log; + } + + static List testLocations = new ArrayList(); + + static Object expectedArgumentValues[]; + + // methods receiving as arguments all possible primitive types + + void testMethod1(boolean arg1) { + log.display("testMethod1"); // testLocations.at(0) + } + + void testMethod2(byte arg1) { + log.display("testMethod2"); // testLocations.at(1) + } + + void testMethod3(short arg1) { + log.display("testMethod3"); // testLocations.at(2) + } + + void testMethod4(char arg1) { + log.display("testMethod4"); // testLocations.at(3) + } + + void testMethod5(int arg1) { + log.display("testMethod5"); // testLocations.at(4) // // testLocations.at(13) + } + + void testMethod6(long arg1) { + log.display("testMethod6"); // testLocations.at(5) + } + + void testMethod7(float arg1) { + log.display("testMethod7"); // testLocations.at(6) + } + + void testMethod8(double arg1) { + log.display("testMethod8"); // testLocations.at(7) + } + + // method receiving Object as argument + void testMethod9(Object object) { + log.display("testMethod9"); // testLocations.at(8) + } + + // method receiving String as argument + void testMethod10(String object) { + log.display("testMethod10"); // testLocations.at(9) + } + + // method receiving TestClass as argument + void testMethod11(TestClass object) { + log.display("testMethod11"); // testLocations.at(10) + } + + // method without arguments + void testMethod12() { + log.display("testMethod12"); // testLocations.at(11) + } + + // method receiving all primitive type and Object as arguments + void testMethod13(boolean arg1, byte arg2, short arg3, char arg4, int arg5, long arg6, float arg7, double arg8, Object arg9) { + log.display("testMethod13"); // testLocations.at(12) + } + + // method with single arument changes argument's value several times + void testMethod14(int arg1) { + log.display("testMethod14"); // testLocations.at(14) + arg1++; + TestClass.expectedArgumentValues = new Object[] { new Value(arg1) }; + log.display("testMethod14"); // testLocations.at(15) + arg1--; + TestClass.expectedArgumentValues = new Object[] { new Value(arg1) }; + log.display("testMethod14"); // testLocations.at(16) + arg1 = 0; + TestClass.expectedArgumentValues = new Object[] { new Value(arg1) }; + log.display("testMethod14"); // testLocations.at(17) + } + + // method with several arguments changes its values in loop + void testMethod15(int arg1, float arg2, Object arg3) { + long v1 = (long)(arg1 + arg2); + for (int i = 0; i < 10; i++) { + arg1 = (int)(i * arg2 - v1); + arg2 += 1; + arg2 += v1; + arg3 = (i % 2 == 0) ? null : new Object(); + TestClass.expectedArgumentValues = new Object[] { new Value(arg1), new Value(arg2), arg3}; + log.display("testMethod15"); // testLocations.at(18) + } + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 5; j++) { + arg1 = (int)(i * arg2 + j + v1); + arg2 += i; + arg3 = arg1 + " " + arg2; + TestClass.expectedArgumentValues = new Object[] { new Value(arg1), new Value(arg2), arg3}; + log.display("testMethod15"); // testLocations.at(19) + } + } + } + + // static method with different arguments + static void testMethod16(Log log, boolean arg1, short arg2, char arg3, int arg4, long arg5, float arg6, double arg7, Object arg8) { + log.display("testMethod16"); // testLocations.at(20) + } + + // static method changing argument value + static void testMethod17(Log log, int arg1) { + log.display("testMethod17"); // testLocations.at(21) + arg1++; + TestClass.expectedArgumentValues = new Object[] { log, new Value(arg1) }; + log.display("testMethod17"); // testLocations.at(22) + arg1--; + TestClass.expectedArgumentValues = new Object[] { log, new Value(arg1) }; + log.display("testMethod17"); // testLocations.at(23) + arg1 = 0; + TestClass.expectedArgumentValues = new Object[] { log, new Value(arg1) }; + log.display("testMethod17"); // testLocations.at(24) + } + + // static method changing arguments in loop + static void testMethod18(Log log, int arg1, float arg2, Object arg3) { + long v1 = (long)(arg1 + arg2); + for (int i = 0; i < 10; i++) { + arg1 = (int)(i * arg2 - v1); + arg2 += 1; + arg2 += v1; + arg3 = (i % 2 == 0) ? null : new Object(); + TestClass.expectedArgumentValues = new Object[] { log, new Value(arg1), new Value(arg2), arg3}; + log.display("testMethod18"); // testLocations.at(25) + } + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 5; j++) { + arg1 = (int)(i * arg2 + j + v1); + arg2 += i; + arg3 = arg1 + " " + arg2; + TestClass.expectedArgumentValues = new Object[] { log, new Value(arg1), new Value(arg2), arg3}; + log.display("testMethod18"); // testLocations.at(26) + } + } + } + + // method receiving arrays as arguments + void testMethod19(boolean[] arg1, byte[] arg2, short[] arg3, char[] arg4, int[] arg5, long[] arg6, float[] arg7, double[] arg8, Object[] arg9) { + log.display("testMethod19"); // testLocations.at(27) + } + + // method receiving multidimensional arrays as arguments + void testMethod20(boolean[][][] arg1, byte[][][] arg2, short[][][] arg3, char[][][] arg4, int[][][] arg5, long[][][] arg6, float[][][] arg7, double[][][] arg8, Object[][][] arg9) { + log.display("testMethod20"); // testLocations.at(28) + } + + static { + // primitive values + testLocations.add(new LocationData(54, 1)); + testLocations.add(new LocationData(58, 1)); + testLocations.add(new LocationData(62, 1)); + testLocations.add(new LocationData(66, 1)); + testLocations.add(new LocationData(70, 1)); + testLocations.add(new LocationData(74, 1)); + testLocations.add(new LocationData(78, 1)); + testLocations.add(new LocationData(82, 1)); + + // objects + testLocations.add(new LocationData(87, 1)); + testLocations.add(new LocationData(92, 1)); + testLocations.add(new LocationData(97, 1)); + + // method without args + testLocations.add(new LocationData(102, 1)); + + // method with many arguments + testLocations.add(new LocationData(107, 1)); + + // method 'testMethod5' is called 50 times + testLocations.add(new LocationData(70, 50)); + + // method 3 times changes argument value + testLocations.add(new LocationData(112, 1)); + testLocations.add(new LocationData(115, 1)); + testLocations.add(new LocationData(118, 1)); + testLocations.add(new LocationData(121, 1)); + + // method changes arguments in loop + testLocations.add(new LocationData(133, 10)); + testLocations.add(new LocationData(141, 25)); + + // static method with many arguments + testLocations.add(new LocationData(148, 1)); + + // static method 3 times changes argument value + testLocations.add(new LocationData(153, 1)); + testLocations.add(new LocationData(156, 1)); + testLocations.add(new LocationData(159, 1)); + testLocations.add(new LocationData(162, 1)); + + // static method changes arguments in loop + testLocations.add(new LocationData(174, 10)); + testLocations.add(new LocationData(182, 25)); + + // arrays + testLocations.add(new LocationData(189, 1)); + + // multidimensional arrays + testLocations.add(new LocationData(194, 1)); + } + } + + public static void main(String args[]) { + new getArgumentValues001a().doTest(args); + } + + static class LocationData { + + public LocationData(int lineNumber, int breakpointsNumber) { + this.lineNumber = lineNumber; + this.breakpointsNumber = breakpointsNumber; + } + + public int breakpointsNumber; + + public int lineNumber; + } + + /* + * This class used to store primitive type values, storing type name is stored in + * field type and value is stored in field 'Value' + */ + static class Value { + boolean booleanValue; + + byte byteValue; + + short shortValue; + + char charValue; + + int intValue; + + long longValue; + + float floatValue; + + double doubleValue; + + String name; + + Value(boolean value) { + name = "boolean"; + booleanValue = value; + } + + Value(byte value) { + name = "byte"; + byteValue = value; + } + + Value(short value) { + name = "short"; + shortValue = value; + } + + Value(char value) { + name = "char"; + charValue = value; + } + + Value(int value) { + name = "int"; + intValue = value; + } + + Value(long value) { + name = "long"; + longValue = value; + } + + Value(float value) { + name = "float"; + floatValue = value; + } + + Value(double value) { + name = "double"; + doubleValue = value; + } + } + + public static final String COMMAND_START_TEST_THREAD = "COMMAND_START_TEST_THREAD"; + + public static final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + public String[] doInit(String args[]) { + args = super.doInit(args); + + try { + Class.forName(TestClass.class.getName()); + } catch (Throwable t) { + setSuccess(false); + System.out.println("Unexpected exception during initialization: " + t); + t.printStackTrace(); + throw new TestBug("Unexpected exception during initialization: " + t); + } + + return args; + } + + class TestThread extends Thread { + public void run() { + TestClass testClass = new TestClass(log); + + TestClass.expectedArgumentValues = new Object[] { new Value(true) }; + testClass.testMethod1(true); + + TestClass.expectedArgumentValues = new Object[] { new Value((byte)10) }; + testClass.testMethod2((byte) 10); + + TestClass.expectedArgumentValues = new Object[] { new Value((short) 10) }; + testClass.testMethod3((short) 10); + + TestClass.expectedArgumentValues = new Object[] { new Value((char) 10) }; + testClass.testMethod4((char) 10); + + TestClass.expectedArgumentValues = new Object[] { new Value((int) 10) }; + testClass.testMethod5((int) 10); + + TestClass.expectedArgumentValues = new Object[] { new Value((long) 10) }; + testClass.testMethod6((long) 10); + + TestClass.expectedArgumentValues = new Object[] { new Value((float) 10) }; + testClass.testMethod7((float) 10); + + TestClass.expectedArgumentValues = new Object[] { new Value((double) 10) }; + testClass.testMethod8((double) 10); + + Object arg = new Object(); + TestClass.expectedArgumentValues = new Object[] { arg }; + testClass.testMethod9(arg); + + arg = "String"; + TestClass.expectedArgumentValues = new Object[] { arg }; + testClass.testMethod10((String) arg); + + arg = testClass; + TestClass.expectedArgumentValues = new Object[] { arg }; + testClass.testMethod11((TestClass) arg); + + TestClass.expectedArgumentValues = new Object[] {}; + testClass.testMethod12(); + + arg = new Object(); + TestClass.expectedArgumentValues = new Object[] { new Value(false), new Value((byte) 0), new Value((short) 1), new Value((char) 2), new Value(3), + new Value((long) 4), new Value((float) 5), new Value((double) 6), arg }; + testClass.testMethod13(false, (byte) 0, (short) 1, (char) 2, 3, 4, 5, 6, arg); + + for (int i = 0; i < 50; i++) { + int intArg = 50 + i; + TestClass.expectedArgumentValues = new Object[] { new Value(intArg) }; + testClass.testMethod5(intArg); + } + + TestClass.expectedArgumentValues = new Object[] { new Value((int) 10) }; + testClass.testMethod14(10); + + testClass.testMethod15(11, 0.1f, new Object()); + + arg = new Object(); + TestClass.expectedArgumentValues = new Object[] { log, new Value(false), new Value((short) 1), new Value((char) 2), new Value(3), + new Value((long) 4), new Value((float) 5), new Value((double) 6), arg }; + TestClass.testMethod16(log, false, (short) 1, (char) 2, 3, 4, 5, 6, arg); + + TestClass.expectedArgumentValues = new Object[] {log, new Value((int) 10) }; + TestClass.testMethod17(log, 10); + + TestClass.testMethod18(log, 11, 0.1f, new Object()); + + { + boolean[] arg1 = {}; + byte[] arg2 = {}; + short[] arg3 = {}; + char[] arg4 = {}; + int[] arg5 = {}; + long[] arg6 = {}; + float[] arg7 = {}; + double[] arg8 = {}; + Object[] arg9 = {}; + TestClass.expectedArgumentValues = new Object[] {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9}; + testClass.testMethod19(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + } + { + boolean[][][] arg1 = {}; + byte[][][] arg2 = {}; + short[][][] arg3 = {}; + char[][][] arg4 = {}; + int[][][] arg5 = {}; + long[][][] arg6 = {}; + float[][][] arg7 = {}; + double[][][] arg8 = {}; + Object[][][] arg9 = {}; + TestClass.expectedArgumentValues = new Object[] {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9}; + testClass.testMethod20(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + } + } + } + + private TestThread testThread; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + + if (testThread != null) + throw new TestBug("Thread is already created"); + + testThread = new TestThread(); + testThread.start(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + + if (testThread == null) + throw new TestBug("Thread isn't created"); + + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + return true; + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002.java new file mode 100644 index 00000000000..3cae2654b01 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2007, 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/StackFrame/getArgumentValues/getArgumentValues002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that method 'StackFrame.getArgumentValues()' returns the values of all arguments in this frame. + * The test checks case when thread has stack with 300 frames and checks result of 'StackFrame.getArgumentValues()' for + * all thread's frames. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getArgumentValues.getArgumentValues002.getArgumentValues002 + * nsk.jdi.StackFrame.getArgumentValues.getArgumentValues002.getArgumentValues002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getArgumentValues.getArgumentValues002.getArgumentValues002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.StackFrame.getArgumentValues.getArgumentValues002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.*; + +/* + * Test checks that method 'StackFrame.getArgumentValues()' returns the values of all arguments in this frame. + * Test checks case when thread has stack with many frames: + * - debuggee starts test thread which using recursion creates stack frame containing 300 frames + * - debugger suspends test thread and for each frame of this thread calls method 'StackFrame.getArgumentValues()' and + * compares returned values with expected. + */ +public class getArgumentValues002 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getArgumentValues002().runIt(argv, out); + } + + protected String debuggeeClassName() { + return getArgumentValues002a.class.getName(); + } + + public void doTest() { + pipe.println(getArgumentValues002a.COMMAND_START_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + ThreadReference testThread = debuggee.threadByName(getArgumentValues002a.testThreadName); + testThread.suspend(); + try { + for (int i = 0; i < testThread.frameCount(); i++) { + boolean success = true; + StackFrame frame = testThread.frame(i); + List values = frame.getArgumentValues(); + + // last frame if method Thread.run() + if (i == testThread.frameCount() - 1) { + if (values.size() != 0) { + success = false; + log.complain("ERROR: unexpected values count: " + values.size() + ", expected is 0"); + } + } else { + // StackFrame should have argument equals to it serial number (look at code of getArgumentValues002a.TreadThread for details) + Value expectedValue = vm.mirrorOf((int) i); + + log.display("Expected value: " + expectedValue); + + if (values.size() != 1) { + success = false; + log.complain("ERROR: unexpected values count: " + values.size() + ", expected is 1"); + } else { + if (!values.get(0).equals(expectedValue)) { + success = false; + log.complain("ERROR: unexpected value: " + values.get(0) + ", expected is " + expectedValue); + } + } + } + + if (!success) { + setSuccess(false); + log.complain("Returned values:"); + for (Value value : values) { + log.complain("" + value); + } + } else { + log.display("OK"); + } + } + } catch (Throwable t) { + setSuccess(false); + log.complain("Unexpected exception: " + t); + t.printStackTrace(log.getOutStream()); + } finally { + testThread.resume(); + } + + pipe.println(getArgumentValues002a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002a.java new file mode 100644 index 00000000000..5b0d6341fea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002a.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2007, 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.StackFrame.getArgumentValues.getArgumentValues002; + +import nsk.share.TestBug; +import nsk.share.jdi.*; + +// Debuggee class, starts test thread which has stack with many frames +public class getArgumentValues002a extends AbstractJDIDebuggee { + + public static final String COMMAND_START_TEST_THREAD = "COMMAND_START_TEST_THREAD"; + + public static final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + public static final String testThreadName = "getArgumentValues002a_TestThread"; + + class TestThread extends Thread { + + volatile boolean stackWasCreated; + + volatile boolean stoped; + + public TestThread() { + super(testThreadName); + } + + public void run() { + recursiveMethod1(300); + } + + void recursiveMethod1(int arg1) { + log.display("recursiveMethod1: " + arg1); + if (arg1 > 0) { + if (arg1 % 3 == 0) + recursiveMethod3(arg1 - 1); + else if (arg1 % 3 == 1) + recursiveMethod2(arg1 - 1); + else + recursiveMethod1(arg1 - 1); + } + else { + stackWasCreated = true; + while (!stoped); + } + } + + void recursiveMethod2(int arg1) { + log.display("recursiveMethod2: " + arg1); + if (arg1 > 0) { + if (arg1 % 3 == 0) + recursiveMethod3(arg1 - 1); + else if (arg1 % 3 == 1) + recursiveMethod2(arg1 - 1); + else + recursiveMethod1(arg1 - 1); + } + else { + stackWasCreated = true; + while (!stoped); + } + } + + void recursiveMethod3(int arg1) { + log.display("recursiveMethod3: " + arg1); + if (arg1 > 0) { + if (arg1 % 3 == 0) + recursiveMethod3(arg1 - 1); + else if (arg1 % 3 == 1) + recursiveMethod2(arg1 - 1); + else + recursiveMethod1(arg1 - 1); + } + else { + stackWasCreated = true; + while (!stoped); + } + } + } + + private TestThread testThread; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + + if (testThread != null) + throw new TestBug("Thread is already created"); + + testThread = new TestThread(); + testThread.start(); + while (!testThread.stackWasCreated) + Thread.yield(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + + if (testThread == null) + throw new TestBug("Thread isn't created"); + + testThread.stoped = true; + + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + return true; + } + + return false; + } + + public static void main(String args[]) { + new getArgumentValues002a().doTest(args); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003.java new file mode 100644 index 00000000000..0250b95d1ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2007, 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/StackFrame/getArgumentValues/getArgumentValues003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that method 'StackFrame.getArgumentValues()' throws InvalidStackFrameException if this stack + * frame has become invalid. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getArgumentValues.getArgumentValues003.getArgumentValues003 + * nsk.jdi.StackFrame.getArgumentValues.getArgumentValues003.getArgumentValues003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getArgumentValues.getArgumentValues003.getArgumentValues003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.StackFrame.getArgumentValues.getArgumentValues003; + +import java.io.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.*; + +/* + * Test checks that method 'StackFrame.getArgumentValues()' throws InvalidStackFrameException if this stack + * frame has become invalid (once the frame's thread is resumed, the stack frame is no longer valid). + * + * Test obtains ThreadReference for debuggee test thread, suspends test thread, obtains StackFrame instance for current + * thread frame, calls StackFrame.getArgumentValues() first time and checks that no exception is thrown. Then debugger + * resumes test thread, calls getArgumentValues again and checks that in this case InvalidStackFrameException is thrown. + */ +public class getArgumentValues003 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getArgumentValues003().runIt(argv, out); + } + + protected String debuggeeClassName() { + return getArgumentValues003a.class.getName(); + } + + public void doTest() { + pipe.println(getArgumentValues003a.COMMAND_START_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + ThreadReference testThread = debuggee.threadByName(getArgumentValues003a.testThreadName); + testThread.suspend(); + try { + StackFrame frame = testThread.frame(0); + log.display("Call getArgumentValues()"); + frame.getArgumentValues(); + log.display("OK"); + log.display("Resume thread"); + testThread.resume(); + log.display("Call getArgumentValues()"); + try { + frame.getArgumentValues(); + setSuccess(false); + log.complain("Expected InvalidStackFrameException was not thrown"); + } catch (InvalidStackFrameException e) { + log.display("Expected InvalidStackFrameException was thrown"); + } + } catch (Throwable t) { + setSuccess(false); + log.complain("Unexpected exception: " + t); + t.printStackTrace(log.getOutStream()); + } finally { + if (testThread.isSuspended()) + testThread.resume(); + } + + pipe.println(getArgumentValues003a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003a.java new file mode 100644 index 00000000000..1dccef59b38 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003a.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2007, 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.StackFrame.getArgumentValues.getArgumentValues003; + +import nsk.share.TestBug; +import nsk.share.jdi.*; + +//Debuggee class, handles command to start and stop test thread +public class getArgumentValues003a extends AbstractJDIDebuggee { + + public static final String COMMAND_START_TEST_THREAD = "COMMAND_START_TEST_THREAD"; + + public static final String COMMAND_STOP_TEST_THREAD = "COMMAND_STOP_TEST_THREAD"; + + public static final String testThreadName = "getArgumentValues003a_TestThread"; + + class TestThread extends Thread { + + volatile boolean stackWasCreated; + + volatile boolean stoped; + + public TestThread() { + super(getArgumentValues003a.testThreadName); + } + + public void run() { + stackWasCreated = true; + + while (!stoped); + } + } + + private TestThread testThread; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + + if (testThread != null) + throw new TestBug("Thread is already created"); + + testThread = new TestThread(); + testThread.start(); + + while (!testThread.stackWasCreated) + Thread.yield(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + + if (testThread == null) + throw new TestBug("Thread isn't created"); + + testThread.stoped = true; + + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + return true; + } + + return false; + } + + public static void main(String args[]) { + new getArgumentValues003a().doTest(args); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java new file mode 100644 index 00000000000..2072cf7d267 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java @@ -0,0 +1,749 @@ +/* + * 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.StackFrame.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.getValue()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * 1) After getting a thread2 suspended but before to resume it,
    + * StackFrame.getValue() is used for getting and
    + * checking up the values of visible variables,
    + * local in a tested method, two for each PrimitiveType;
    + * 2) After resuming the thread2, the method StackFrame.getValue() is
    + * invoked second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class getvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/getValue/getvalue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.getValue.getvalue001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.getValue.Threadgetvalue001a"; + + //String mName = "nsk.jdi.StackFrame.getValue"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("getvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + // BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting thread2's StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + // StackFrame stackFrame is ready for testing + + String bl1 = "bl1", bl2 = "bl2"; + String bt1 = "bt1", bt2 = "bt2"; + String ch1 = "ch1", ch2 = "ch2"; + String db1 = "db1", db2 = "db2"; + String fl1 = "fl1", fl2 = "fl2"; + String in1 = "in1", in2 = "in2"; + String ln1 = "ln1", ln2 = "ln2"; + String sh1 = "sh1", sh2 = "sh2"; + + String ini0 = "i0"; + + + for ( int i3 = 0; i3 < 8; i3++) { + + try { + + switch (i3) { + + case 0: BooleanValue blv1 = null; + BooleanValue blv2 = null; + + locvar1 = stackFrame.visibleVariableByName(bl1); + locvar2 = stackFrame.visibleVariableByName(bl2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Boolean"); + expresult = returnCode1; + break; + } + + blv1 = (BooleanValue) stackFrame.getValue(locvar1); + if (blv1.value() != true) { + log3("ERROR: blv1 != true : " + blv1.value() ); + expresult = returnCode1; + } + blv2 = (BooleanValue) stackFrame.getValue(locvar2); + if (blv2.value() != false) { + log3("ERROR: blv2 != false : " + blv2.value() ); + } + + break; + + + case 1: ByteValue btv1 = null; + ByteValue btv2 = null; + + locvar1 = stackFrame.visibleVariableByName(bt1); + locvar2 = stackFrame.visibleVariableByName(bt2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Byte"); + expresult = returnCode1; + break; + } + + btv1 = (ByteValue) stackFrame.getValue(locvar1); + if (btv1.value() != 0) { + log3("ERROR: btv1 != 0 : " + btv1.value() ); + expresult = returnCode1; + } + btv2 = (ByteValue) stackFrame.getValue(locvar2); + if (btv2.value() != 1) { + log3("ERROR: btv2 != 1 : " + btv2.value() ); + expresult = returnCode1; + } + + break; + + + case 2: CharValue chv1 = null; + CharValue chv2 = null; + + locvar1 = stackFrame.visibleVariableByName(ch1); + locvar2 = stackFrame.visibleVariableByName(ch2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Char"); + expresult = returnCode1; + break; + } + + chv1 = (CharValue) stackFrame.getValue(locvar1); + if (chv1.value() != 0) { + log3("ERROR: chv1 != 0 : " + chv1.value() ); + expresult = returnCode1; + } + chv2 = (CharValue) stackFrame.getValue(locvar2); + if (chv2.value() != 1) { + log3("ERROR: chv2 != 1 : " + chv2.value() ); + expresult = returnCode1; + } + + break; + + + case 3: DoubleValue dbv1 = null; + DoubleValue dbv2 = null; + + locvar1 = stackFrame.visibleVariableByName(db1); + locvar2 = stackFrame.visibleVariableByName(db2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Double"); + expresult = returnCode1; + break; + } + + dbv1 = (DoubleValue) stackFrame.getValue(locvar1); + if (dbv1.value() != 0.0d) { + log3("ERROR: dbv1 != 0.0d : " + dbv1.value() ); + expresult = returnCode1; + } + dbv2 = (DoubleValue) stackFrame.getValue(locvar2); + if (dbv2.value() != 1111111111.0d) { + log3("ERROR: dbv2 != 1111111111.0d : " + dbv2.value() ); + expresult = returnCode1; + } + + break; + + + case 4: FloatValue flv1 = null; + FloatValue flv2 = null; + + locvar1 = stackFrame.visibleVariableByName(fl1); + locvar2 = stackFrame.visibleVariableByName(fl2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Float"); + expresult = returnCode1; + break; + } + + flv1 = (FloatValue) stackFrame.getValue(locvar1); + if (flv1.value() != 0.0f) { + log3("ERROR: flv1 != 0.0f : " + flv1.value() ); + expresult = returnCode1; + } + flv2 = (FloatValue) stackFrame.getValue(locvar2); + if (flv2.value() != 1111111111.0f) { + log3("ERROR: flv2 != 1111111111.0f : " + flv2.value() ); + expresult = returnCode1; + } + + break; + + case 5: IntegerValue inv1 = null; + IntegerValue inv2 = null; + + locvar1 = stackFrame.visibleVariableByName(in1); + locvar2 = stackFrame.visibleVariableByName(in2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Integer"); + expresult = returnCode1; + break; + } + + inv1 = (IntegerValue) stackFrame.getValue(locvar1); + if (inv1.value() != 0) { + log3("ERROR: inv1 != 0 : " + inv1.value() ); + expresult = 1; + } + inv2 = (IntegerValue) stackFrame.getValue(locvar2); + if (inv2.value() != 1) { + log3("ERROR: inv2 != 1 : " + inv2.value() ); + expresult = returnCode1; + } + + break; + + + case 6: LongValue lnv1 = null; + LongValue lnv2 = null; + + locvar1 = stackFrame.visibleVariableByName(ln1); + locvar2 = stackFrame.visibleVariableByName(ln2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Long"); + expresult = returnCode1; + break; + } + + lnv1 = (LongValue) stackFrame.getValue(locvar1); + lnv2 = (LongValue) stackFrame.getValue(locvar2); + log2("2 : lnv1= 0x" + Long.toHexString(lnv1.value()) + + " lnv2= 0x" + Long.toHexString(lnv2.value()) ); + if (lnv1.value() != 0) { + log3("ERROR: lnv1 != 0 : " + Long.toHexString(lnv1.value()) ); + expresult = returnCode1; + } + if (lnv2.value() != 0x1234567890abcdefL) { + log3("ERROR: lnv2 != 0x1234567890abcdefL : " + Long.toHexString(lnv2.value()) ); + expresult = returnCode1; + } + + break; + + + case 7: ShortValue shv1 = null; + ShortValue shv2 = null; + locvar1 = stackFrame.visibleVariableByName(sh1); + locvar2 = stackFrame.visibleVariableByName(sh2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Short"); + expresult = returnCode1; + break; + } + + shv1 = (ShortValue) stackFrame.getValue(locvar1); + if (shv1.value() != 0) { + log3("ERROR: shv1 != 0 : " + shv1.value() ); + expresult = returnCode1; + } + shv2 = (ShortValue) stackFrame.getValue(locvar2); + if (shv2.value() != 1) { + log3("ERROR: shv2 != 1 : " + shv2.value() ); + expresult = returnCode1; + } + + break; + + + default : log3("ERROR: TEST ERROR: case: default:"); + expresult = returnCode1; + break; + + } // end of switch + + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for: stackFrame.getValue()"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameException before the thread is resumed "); + expresult = 1; + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + } // end of try + + } // end of for + } + + label2: { + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult != returnCode0) + break label2; + + try { + Value value = stackFrame.getValue(locvar1); + + log3("ERROR: no InvalidStackFrameExceprtion after the thread is resumed"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameException after the thread is resumed"); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001/TestDescription.java new file mode 100644 index 00000000000..227ae2d6af4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001/TestDescription.java @@ -0,0 +1,97 @@ +/* + * 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/StackFrame/getValue/getvalue001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.getValue() + * complies with its spec: + * public Value getValue(LocalVariable variable) + * Gets the Value of a LocalVariable in this frame. + * The variable must be valid for this frame's method and visible + * according to the rules described in visibleVariables(). + * Parameters: variable - the LocalVariable to be accessed + * Returns: the Value of the instance field. + * Throws: java.lang.IllegalArgumentException - + * if the variable is either invalid for this frame's method or + * not visible. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.getValue.getvalue001; + * the debuggee program - nsk.jdi.StackFrame.getValue.getvalue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getValue.getvalue001 + * nsk.jdi.StackFrame.getValue.getvalue001a + * + * @comment make sure getvalue001a is compiled with full debug info + * @clean nsk.jdi.StackFrame.getValue.getvalue001a + * @compile -g:lines,source,vars ../getvalue001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getValue.getvalue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java new file mode 100644 index 00000000000..8313b2d1d44 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java @@ -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.StackFrame.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the getvalue001 JDI test. + */ + +public class getvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.getValue()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The case for testing is as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * Since debuggee's method runt1() calls to the method runt2(),
    + * at the beginning the debugger sets up breakpoints at both
    + * methods, so that, in run-time runt2() is suspended first.
    + * After getting the thread2 suspended first time, the debugger
    + * gets a LocalVariable object locvar1, mirroring
    + * a method variable in the runt2(), which becomes invalid
    + * when runt2() is resumed and runt1() is suspended.
    + * After getting the thread2 suspended second time,
    + * the debugger checks up that the method invocation
    + * StackFrame.getValue() on locvar1 does throw
    + * IllegalArgumentException.
    + *
    + */ + +public class getvalue002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/getValue/getvalue002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalue002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.getValue.getvalue002a"; + + private String testedClassName = + "nsk.jdi.StackFrame.getValue.Threadgetvalue002a"; + + //String mName = "nsk.jdi.StackFrame.getValue"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("getvalue002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + + log2(" getting LocalVariable locvar1 for checking up"); + + String bl1 = "bl1"; + + try { + locvar1 = stackFrame.visibleVariableByName(bl1); + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + break label1; + } + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting thread2's current StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + log2(" checking up that locvar1 is not valid for current StackFrame"); + + try { + Value value = stackFrame.getValue(locvar1); + + log3("ERROR: no IllegalArgumentException after runt() returned"); + expresult = returnCode1; + } catch ( IllegalArgumentException e1 ) { + log2(" : IllegalArgumentException after runt() returned"); + } catch ( Exception e ) { + log3("ERROR: Exception for: Value value = stackFrame.getValue(locvar1); :" + e); + expresult = returnCode1; + break label1; + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002/TestDescription.java new file mode 100644 index 00000000000..1bef8e6eea8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002/TestDescription.java @@ -0,0 +1,97 @@ +/* + * 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/StackFrame/getValue/getvalue002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.getValue() + * complies with its spec: + * public Value getValue(LocalVariable variable) + * Gets the Value of a LocalVariable in this frame. + * The variable must be valid for this frame's method and visible + * according to the rules described in visibleVariables(). + * Parameters: variable - the LocalVariable to be accessed + * Returns: the Value of the instance field. + * Throws: java.lang.IllegalArgumentException - + * if the variable is either invalid for this frame's method or + * not visible. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.getValue.getvalue002; + * the debuggee program - nsk.jdi.StackFrame.getValue.getvalue002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getValue.getvalue002 + * nsk.jdi.StackFrame.getValue.getvalue002a + * + * @comment make sure getvalue002a is compiled with full debug info + * @clean nsk.jdi.StackFrame.getValue.getvalue002a + * @compile -g:lines,source,vars ../getvalue002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getValue.getvalue002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java new file mode 100644 index 00000000000..15bc1fa553c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java @@ -0,0 +1,229 @@ +/* + * 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.StackFrame.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the getvalue002 JDI test. + */ + +public class getvalue002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.StackFrame.getValue()
    + * properly throws IllegalArgumentException - if + * specified variable is invalid for this frame's method.

    + * + * The test works as follows. The target VM executes two debuggee + * threads: getvalue003tMainThr and getvalue003tAuxThr. + * Debugger part tries to get value of the local variable + * getvalue003tFindMe in stack frame obtained from the + * getvalue003tMainThr thread using as a parameter a + * LocalVariable object obtained from the getvalue003tAuxThr thread. + */ +public class getvalue003 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.StackFrame.getValue.getvalue003t"; + + // names of debuggee threads + static final String DEBUGGEE_THRDNAMES[] = { + "getvalue003tMainThr", "getvalue003tAuxThr" + }; + + // debuggee local var used in testing + static final String DEBUGGEE_LOCALVAR = "getvalue003tFindMe"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 69; + + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + private LocalVariable wrongLocVar; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getvalue003().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "getvalue003t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[2]; + for (int i=0; i<2; i++) + if ((thrRef[i] = + debuggee.threadByName(DEBUGGEE_THRDNAMES[i])) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRDNAMES[i]); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + // get a stack frame which belongs to the "getvalue003tMainThr" thread + StackFrame stFrame = findFrame(thrRef[0], DEBUGGEE_LOCALVAR, false); + + // store a LocalVariable which belongs to the "getvalue003tAuxThr" thread + findFrame(thrRef[1], DEBUGGEE_LOCALVAR, true); + + log.display("\nTrying to get value of local variable \"" + + wrongLocVar + + "\"\n\tgotten from thread \"" + thrRef[1] + + "\"\n\tusing stack frame \"" + stFrame + + "\"\n\tbelongs to thread \"" + thrRef[0] + + "\" ..."); + +// Check the tested assersion + try { + Value val = stFrame.getValue(wrongLocVar); + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to get value of local variable \"" + + wrongLocVar + + "\"\n\tgotten from thread \"" + thrRef[1] + + "\"\n\tusing stack frame \"" + stFrame + + "\"\n\tbelongs to thread \"" + thrRef[0] + "\""); + tot_res = Consts.TEST_FAILED; + } catch(IllegalArgumentException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch(Exception ue) { + ue.printStackTrace(); + log.complain("TEST FAILED: StackFrame.getValue(): caught unexpected " + + ue + "\n\tinstead of IllegalArgumentException" + + "\n\twhen attempted to get value of local variable \"" + + wrongLocVar + + "\"\n\tgotten from thread \"" + thrRef[1] + + "\"\n\tusing stack frame \"" + stFrame + + "\"\n\tbelongs to thread \"" + thrRef[0] + "\""); + tot_res = Consts.TEST_FAILED; + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + + return quitDebuggee(); + } + + private StackFrame findFrame(ThreadReference thrRef, + String varName, boolean storeLocVar) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = + stackFr.visibleVariableByName(varName); + // visible variable with the given name is found + if (locVar != null) { + if (storeLocVar) // store a LocalVariable as well + wrongLocVar = locVar; + + return stackFr; + } + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Final resumption of debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003/TestDescription.java new file mode 100644 index 00000000000..274fd5e43d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003/TestDescription.java @@ -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/StackFrame/getValue/getvalue003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method: + * com.sun.jdi.StackFrame.getValue() + * properly throws IllegalArgumentException - if specified variable + * is invalid for this frame's method. + * The test works as follows. The target VM executes two debuggee + * threads: "getvalue003tMainThr" and "getvalue003tAuxThr". + * Debugger part tries to get value of the local variable + * "getvalue003tFindMe" in stack frame obtained from the + * "getvalue003tMainThr" thread using as a parameter a LocalVariable + * object obtained from the "getvalue003tAuxThr" thread. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getValue.getvalue003 + * nsk.jdi.StackFrame.getValue.getvalue003t + * + * @comment make sure getvalue003t is compiled with full debug info + * @clean nsk.jdi.StackFrame.getValue.getvalue003t + * @compile -g:lines,source,vars ../getvalue003t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getValue.getvalue003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003t.java new file mode 100644 index 00000000000..431641de0ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003t.java @@ -0,0 +1,165 @@ +/* + * 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.StackFrame.getValue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class getvalue003t { + private Log log; + private IOPipe pipe; + private OtherThr auxThr; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new getvalue003t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(getvalue003.DEBUGGEE_THRDNAMES[0]); + startThread(); + + // local var used by debugger to find appropriate stack frame + int getvalue003tFindMe = 0; + + // Now the debuggee is ready for testing + pipe.println(getvalue003.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(getvalue003.COMMAND_QUIT)) { + killThread(argHandler.getWaitTime()*60000); + log.complain("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // getvalue003.DEBUGGEE_STOPATLINE + + cmd = pipe.readln(); + killThread(argHandler.getWaitTime()*60000); + if (!cmd.equals(getvalue003.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + return Consts.TEST_FAILED; + } + return Consts.TEST_PASSED; + } + + private void startThread() { + Object readyObj = new Object(); + + auxThr = new OtherThr(readyObj, + getvalue003.DEBUGGEE_THRDNAMES[1]); + auxThr.setDaemon(true); + + log.display("Debuggee: starting thread \"" + + auxThr.getName() + "\" ..."); + synchronized(readyObj) { + auxThr.start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + auxThr + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread \"" + + auxThr.getName() + "\" started"); + } + + private void killThread(int waitTime) { + auxThr.doExit = true; + try { + auxThr.join(waitTime); + log.display("Debuggee: thread \"" + + auxThr.getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread \"" + + auxThr.getName() + "\": caught " + e); + } + } + + /** + * This is an auxiliary thread class used to check + * an IllegalArgumentException in debugger. + */ + class OtherThr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + + OtherThr(Object readyObj, String name) { + super(name); + this.readyObj = readyObj; + } + + public void run() { + // var used by debugger for searching + int getvalue003tFindMe = 0; + + Thread thr = Thread.currentThread(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(this) { + try { + this.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java new file mode 100644 index 00000000000..8471e297026 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java @@ -0,0 +1,611 @@ +/* + * 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.StackFrame.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.getValues()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * 1) After getting the thread2 suspended but before to resume it,
    + * StackFrame.getValues() is used for getting and
    + * checking up a number of visible variables
    + * local in a tested method, and that all the variables
    + * are of PrimitiveType as in the debugged program.
    + * 2) After resuming the thread2, the method StackFrame.getValues() is
    + * invoked second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class getvalues001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/getValues/getvalues001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalues001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.getValues.getvalues001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.getValues.Threadgetvalues001a"; + + //String mName = "nsk.jdi.StackFrame.getValues"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("getvalues001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + // BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting thread2's StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + log2(" StackFrame stackFrame is ready for testing"); + + List testedVars = null; + + log2(" getting List of method's variables"); + try { + testedVars = ( (Method) testedclass.methodsByName(breakpointMethod1).get(0)).variables(); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for testedVars = runMethod.variables()"); + expresult = returnCode1; + break label1; + } + + label:{ + Map returnedVars = null; + + log2(" getting Map of variable's returnedValues"); + try { + returnedVars = stackFrame.getValues(testedVars); + } catch ( IllegalArgumentException e ) { + log3("ERROR: IllegalArgumentException for: stackFrame.getValue()"); + expresult = returnCode1; + break label; + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameException before the thread is resumed "); + expresult = returnCode1; + break label; + } catch ( Throwable e ) { + log3("ERROR: some exception for stackFrame.getValues(testedVars) : " + e); + expresult = returnCode1; + break label; + } + + String bl1 = "bl1"; + String bt1 = "bt1"; + String ch1 = "ch1"; + String db1 = "db1"; + String fl1 = "fl1"; + String in1 = "in1"; + String ln1 = "ln1"; + String sh1 = "sh1"; + + Set keyset = returnedVars.keySet(); + Iterator setIterator = keyset.iterator(); + + log2(" loop of casting returnedValues"); + int i4 = 0; + for (int i3 = 0; setIterator.hasNext(); i3++) { + + LocalVariable lvar = (LocalVariable) setIterator.next(); + + try { + Value val = (Value) returnedVars.get(lvar); + + if (lvar.name().equals(bl1)) { + BooleanValue blv = (BooleanValue) val; + i4 += 1; + } else if (lvar.name().equals(bt1)) { + ByteValue btv = (ByteValue) val; + i4 += 10; + } else if (lvar.name().equals(ch1)) { + CharValue chv = (CharValue) val; + i4 += 100; + } else if (lvar.name().equals(db1)) { + DoubleValue chv = (DoubleValue) val; + i4 += 1000; + } else if (lvar.name().equals(fl1)) { + FloatValue dbv = (FloatValue) val; + i4 += 10000; + } else if (lvar.name().equals(in1)) { + IntegerValue inv = (IntegerValue) val; + i4 += 100000; + } else if (lvar.name().equals(ln1)) { + LongValue dbv = (LongValue) val; + i4 += 1000000; + } else if (lvar.name().equals(sh1)) { + ShortValue shv = (ShortValue) val; + i4 += 10000000; + } else { + log3("ERROR: name in Map doesn't match any expected : " + lvar.name()); + expresult = returnCode1; + } + } catch ( ClassCastException e1 ) { + log3("ERROR: ClassCastException for values in the returned Map: #= " + i3); + expresult = returnCode1; + break label; + } catch ( NullPointerException e2 ) { + log3("ERROR: NullPointerException for values in the returned Map: #= " + i3); + expresult = returnCode1; + break label; + } + + } // end of for + + log2(" checking up whether all PrimitiveValues are tested"); + if (i4 != 11111111) { + log3("ERROR: not all PrimitiveValues are in the returned Map"); + expresult = returnCode1; + break label; + } + } // end of label: + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult != 0) + break label1; + + log2(" testing StackFrame validity after resuming the thread2"); + try { + Map returnedVars = stackFrame.getValues(testedVars); + + log3("ERROR: no InvalidStackFrameExceprtion after the thread2 is resumed"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameException after the thread2 is resumed"); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001/TestDescription.java new file mode 100644 index 00000000000..d46d9ad117d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/StackFrame/getValues/getvalues001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.getValues() + * complies with its spec: + * public java.util.Map getValues(java.util.List variables) + * Returns the values of multiple local variables in this frame. + * Each variable must be valid for this frame's method and + * visible according to the rules described in visibleVariables(). + * Parameters: variables - a list of LocalVariable objects to be accessed + * Returns: a map associating each LocalVariable with its Value + * Throws: java.lang.IllegalArgumentException - + * if any variable is either invalid for this frame's method or + * not visible. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.getValues.getvalues001; + * the debuggee program - nsk.jdi.StackFrame.getValues.getvalues001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.getValues.getvalues001 + * nsk.jdi.StackFrame.getValues.getvalues001a + * + * @comment make sure getvalues001a is compiled with full debug info + * @clean nsk.jdi.StackFrame.getValues.getvalues001a + * @compile -g:lines,source,vars ../getvalues001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getValues.getvalues001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java new file mode 100644 index 00000000000..7cf3736120c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java @@ -0,0 +1,210 @@ +/* + * 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.StackFrame.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the getvalues001 JDI test. + */ + +public class getvalues001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.getValues()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The case for testing is as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * Since debuggee's method runt1() calls to the method runt2(),
    + * at the beginning the debugger sets up breakpoints at both
    + * methods, so that, in run-time runt2() is suspended first.
    + * After getting the thread2 suspended first time, the debugger
    + * gets a Map containing LocalVariable objects, mirroring
    + * method variables in the runt2(), which becomes invalid
    + * when runt2() is resumed and runt1() is suspended.
    + * After getting the thread2 suspended second time,
    + * the debugger extracts a List of LocalVariables from
    + * the Map and checks up that the method invocation
    + * StackFrame.getValues() on the List argument does throw
    + * IllegalArgumentException.
    + *
    + */ + +public class getvalues002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/getValues/getvalues002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new getvalues002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.getValues.getvalues002a"; + + private String testedClassName = + "nsk.jdi.StackFrame.getValues.Threadgetvalues002a"; + + //String mName = "nsk.jdi.StackFrame.getValues"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("getvalues002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting current StackFrame object at first breakpoint"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + List testedVars = null; + + log2(" getting List of LocalVariables for checking up"); + try { + testedVars = stackFrame.visibleVariables(); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for testedVars = runMethod.variables()"); + expresult = returnCode1; + break label1; + } + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + + log2(" getting current StackFrame object at second breakpoint"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + log2(" checking up that the List of testedVars is not valid for current StackFrame"); + try { + Map returnedVars = stackFrame.getValues(testedVars); + + log3("ERROR: no IllegalArgumentException after exit from runt2()"); + expresult = returnCode1; + } catch ( IllegalArgumentException eIllegal ) { + log2(" : IllegalArgumentException after exit from runt2()"); + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002/TestDescription.java new file mode 100644 index 00000000000..c756c8529c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002/TestDescription.java @@ -0,0 +1,97 @@ +/* + * 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/StackFrame/getValues/getvalues002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.getValues() + * complies with its spec: + * public java.util.Map getValues(java.util.List variables) + * Returns the values of multiple local variables in this frame. + * Each variable must be valid for this frame's method and + * visible according to the rules described in visibleVariables(). + * Parameters: variables - a list of LocalVariable objects to be accessed + * Returns: a map associating each LocalVariable with its Value + * Throws: java.lang.IllegalArgumentException - + * if any variable is either invalid for this frame's method or + * not visible. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * VMMismatchException - + * if a Mirror argument and this mirror do not belong to + * the same VirtualMachine. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.getValues.getvalues002; + * the debuggee program - nsk.jdi.StackFrame.getValues.getvalues002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.getValues.getvalues002 + * nsk.jdi.StackFrame.getValues.getvalues002a + * + * @comment make sure getvalues002a is compiled with full debug info + * @clean nsk.jdi.StackFrame.getValues.getvalues002a + * @compile -g:lines,source,vars ../getvalues002a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.getValues.getvalues002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java new file mode 100644 index 00000000000..d23ee96d2d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java @@ -0,0 +1,220 @@ +/* + * 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.StackFrame.getValues; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the getvalues002 JDI test. + */ + +public class getvalues002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.StackFrame.getValues()
    + * properly throws IllegalArgumentException - if + * specified variable is invalid for this frame's method.

    + * + * The test works as follows. The target VM executes two debuggee + * threads: getvalues003tMainThr and getvalues003tAuxThr. + * Debugger part tries to provoke the exception by getting values of + * the local variables in stack frame obtained from the + * getvalue0s03tMainThr thread, and one among them obtained + * from the getvalues003tAuxThr thread. + */ +public class getvalues003 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.StackFrame.getValues.getvalues003t"; + + // names of debuggee threads + static final String DEBUGGEE_THRDNAMES[] = { + "getvalues003tMainThr", "getvalues003tAuxThr" + }; + + // tested debuggee local vars + static final int VAR_NUM = 9; + static final String DEBUGGEE_VARS[] = { + "getvalues003tFindMe", "shortVar", "intVar", + "longVar", "floatVar", "doubleVar", "charVar", + "booleanVar", "strVar" + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 78; + + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + private List locVars; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new getvalues003().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "getvalues003t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[2]; + for (int i=0; i<2; i++) + if ((thrRef[i] = + debuggee.threadByName(DEBUGGEE_THRDNAMES[i])) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRDNAMES[i]); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + // get a stack frame which belongs to the "getvalue003tMainThr" thread + StackFrame stFrame = findFrame(thrRef[0], DEBUGGEE_VARS[0], true); + + // store a LocalVariable which belongs to the "getvalue003tAuxThr" thread + StackFrame wrongStFrame = findFrame(thrRef[1], DEBUGGEE_VARS[0], false); + + StringBuffer varNames = new StringBuffer(); + Iterator varIter = locVars.iterator(); + while (varIter.hasNext()) { + LocalVariable locv = (LocalVariable) varIter.next(); + varNames = varNames.append("\n\t\t" + locv.typeName() + + " " + locv.name() + " " + locv.signature()); + } + + for (int i=0; i " + 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + hashcode001a.brkpMethodName, + hashcode001a.brkpLineNumber); + debuggee.resume(); + + debuggee.sendSignal(SIGNAL_GO); + Event event = null; + + // waiting the breakpoint event + try { + event = debuggee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (!(event instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + ThreadReference thread = ((BreakpointEvent)event).thread(); + List frames = null; + try { + frames = thread.frames(); + } catch(IncompatibleThreadStateException e) { + throw new Failure("Unexpected IncompatibleThreadStateException when getting list of frames"); + } + + display("Checking hashCode() method for debuggee's stack frames..."); + + // Check all methods from debuggee + for (int i = 0; i < frames.size(); i++) { + + StackFrame stackFrame = null; + try { + stackFrame = (StackFrame)frames.get(i); + int hCode = stackFrame.hashCode(); + if (hCode == 0) { + complain("hashCode() returns 0 for stack frame #" + i); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = stackFrame.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for stack frame #" + i + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + // get new reference to the same stack frame and get hash code. + hCode1 = ((StackFrame)frames.get(i)).hashCode(); + if (hCode != stackFrame.hashCode()) { + complain("hashCode() does not return same value for stack frame equal to one #" + i + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns for stack frame #" + i + " : " + hCode); + + } catch(Exception e) { + complain("Unexpected " + e + " when getting StackFrame for stack frame #" + i); + exitStatus = Consts.TEST_FAILED; + } + + } + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..3689514d84a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001/TestDescription.java @@ -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/StackFrame/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.StackFrame interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during an execution + * of a Java application, the hashCode method must consistently return the same + * integer, provided no information used in equals comparisons on the object is + * modified. + * ... + * - If two objects are equal according to the equals(Object) method, then calling the + * hashCode method on each of the two objects must produce the same integer result. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for StackFrame + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.hashCode.hashcode001 + * nsk.jdi.StackFrame.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001a.java new file mode 100644 index 00000000000..be793196de8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001a.java @@ -0,0 +1,96 @@ +/* + * 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.StackFrame.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "breakHere"; + public final static int brkpLineNumber = 92; + + //------------------------------------------------------ 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); + try { + pipe.println(hashcode001.SIGNAL_READY); + breakHere(); + receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + public static void breakHere () { + receiveSignal(hashcode001.SIGNAL_GO); + log.display("breakpoint line"); // brkpLineNumber + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java new file mode 100644 index 00000000000..10da14bfd46 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java @@ -0,0 +1,537 @@ +/* + * 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.StackFrame.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.location()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * 1) After getting the thread2 suspended but before to resume it,
    + * two sequential invokations of the method StackFrame.location()
    + * are executed. Since the thread2 is not resumed yet,
    + * InvalidStackFrameException must not be thrown on
    + * on second invokation, and both returned Location objects
    + * must have the same values returned by invokations on them
    + * methods codeIndex() and lineNumber();
    + * 2) The debugger gets two mirrors of current method in the debuggee
    + * one directly with Location.Method(), and another one with
    + * VirtualMachine.classesByName().get().methodsByName().get(),
    + * and checks up that both mirrors are equal to each other.
    + * 3) After resuming the thread2, the method is invoked one more
    + * time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class location001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/location/location001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new location001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.location.location001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.location.Threadlocation001a"; + + //String mName = "nsk.jdi.StackFrame.location"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + // BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + Location location1; + Location location2; + + log2(" getting two Location objects, 1 and 2"); + try { + stackFrame = thread2.frame(0); + location1 = stackFrame.location(); + location2 = stackFrame.location(); + } catch ( InvalidStackFrameException e1 ) { + expresult = returnCode1; + log3("ERROR: InvalidStackFrameException before thread2 is resumed"); + break label1; + } catch ( IncompatibleThreadStateException e2 ) { + expresult = returnCode1; + log3("ERROR: IncompatibleThreadStateException ??!!"); + break label1; + } + + log2(" checking up that location1&2 have the same codeIndex and lineNumber"); + if ( location1.codeIndex() != location2.codeIndex() || + location1.lineNumber() != location2.lineNumber() ) { + log3("ERROR: codeIndexes or lineNumbers are not equal"); + log3(" line1 # = " + location1.lineNumber() + + " line2 # = " + location2.lineNumber()); + expresult = returnCode1; + break label1; + } + + + log2(" checking up that method is accessable through its Location"); + log2(" and two method's mirrors are equal"); + Method m = location1.method(); + if (m == null) { + log3("ERROR: m == null for: m = location1.method()"); + expresult = returnCode1; + } else if ( !m.equals( (Method) testedclass.methodsByName(breakpointMethod1).get(0)) ) { + log3("ERROR: two method's mirrors are not equal"); + expresult = returnCode1; + } else + log2(" two method's mirrors are equal"); + + + log2(" resuming the thread2 and "); + eventSet.resume(); + + log2(" checking up throwing InvalidStackFrameException"); + try { + location1 = stackFrame.location(); + expresult = returnCode1; + log3("ERROR: no InvalidStackFrameException after thread2 is resumed"); + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameException after thread2 is resumed"); + } + + } + eventSet.resume(); // for case if thread2 was not resumed because of error in a check + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001/TestDescription.java new file mode 100644 index 00000000000..63da70e4387 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/StackFrame/location/location001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.location() + * complies with its spec: + * public Location location() + * Returns the Location of the current instruction in the frame. + * The method for which this frame was created can also + * be accessed through the returned location. + * For the top frame in the stack, + * this location identifies the next instruction to be executed. + * For all other frames, this location identifies the instruction that + * caused the next frame's method to be invoked. + * If the frame represents a native method invocation, + * the returned location indicates the class and method, but + * the code index will not be valid. + * Specified by: location in interface Locatable + * Returns: the Location of the current instruction. + * Throws: InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * The test checks up results of method invokations before and after + * a tested suspended thread is resumed. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.location.location001; + * the debuggee program - nsk.jdi.StackFrame.location.location001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.location.location001 + * nsk.jdi.StackFrame.location.location001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.location.location001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java new file mode 100644 index 00000000000..d5b9562db42 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java @@ -0,0 +1,190 @@ +/* + * 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.StackFrame.location; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the location001 JDI test. + */ + +public class location001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.setValue()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * 1) After getting the thread2 suspended but before to resume it,
    + * StackFrame.setValue() is used for setting and
    + * following checking up the values of visible variables,
    + * local in a tested method, two for each PrimitiveType.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class setvalue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/setValue/setvalue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.setValue.setvalue001.setvalue001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.setValue.setvalue001.Threadsetvalue001a"; + + //String mName = "nsk.jdi.StackFrame.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + // BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting thread2's StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + // StackFrame stackFrame is ready for testing + + String bl1 = "bl1", bl2 = "bl2"; + String bt1 = "bt1", bt2 = "bt2"; + String ch1 = "ch1", ch2 = "ch2"; + String db1 = "db1", db2 = "db2"; + String fl1 = "fl1", fl2 = "fl2"; + String in1 = "in1", in2 = "in2"; + String ln1 = "ln1", ln2 = "ln2"; + String sh1 = "sh1", sh2 = "sh2"; + + String ini0 = "i0"; + + + for ( int i3 = 0; i3 < 8; i3++) { + + try { + + switch (i3) { + + case 0: BooleanValue blv1 = null; + BooleanValue blv2 = null; + + locvar1 = stackFrame.visibleVariableByName(bl1); + locvar2 = stackFrame.visibleVariableByName(bl2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Boolean"); + expresult = returnCode1; + break; + } + + blv2 = (BooleanValue) stackFrame.getValue(locvar2); + stackFrame.setValue(locvar1, blv2); + blv1 = (BooleanValue) stackFrame.getValue(locvar1); + if (blv1.value() != false) { + log3("ERROR: blv1 != false : " + blv1.value() ); + expresult = returnCode1; + } + + break; + + + case 1: ByteValue btv1 = null; + ByteValue btv2 = null; + + locvar1 = stackFrame.visibleVariableByName(bt1); + locvar2 = stackFrame.visibleVariableByName(bt2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Byte"); + expresult = returnCode1; + break; + } + + btv2 = (ByteValue) stackFrame.getValue(locvar2); + stackFrame.setValue(locvar1, btv2); + btv1 = (ByteValue) stackFrame.getValue(locvar1); + if (btv1.value() != 1) { + log3("ERROR: btv1 != 1 : " + btv1.value() ); + expresult = returnCode1; + } + + break; + + + case 2: CharValue chv1 = null; + CharValue chv2 = null; + + locvar1 = stackFrame.visibleVariableByName(ch1); + locvar2 = stackFrame.visibleVariableByName(ch2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Char"); + expresult = returnCode1; + break; + } + + chv2 = (CharValue) stackFrame.getValue(locvar2); + stackFrame.setValue(locvar1, chv2); + chv1 = (CharValue) stackFrame.getValue(locvar1); + if (chv1.value() != 1) { + log3("ERROR: chv1 != 1 : " + chv1.value() ); + expresult = returnCode1; + } + + break; + + + case 3: DoubleValue dbv1 = null; + DoubleValue dbv2 = null; + + locvar1 = stackFrame.visibleVariableByName(db1); + locvar2 = stackFrame.visibleVariableByName(db2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Double"); + expresult = returnCode1; + break; + } + + dbv2 = (DoubleValue) stackFrame.getValue(locvar2); + log2("1 : dbv2 = " + Double.doubleToRawLongBits(dbv2.value()) ); + stackFrame.setValue(locvar1, dbv2); + dbv1 = (DoubleValue) stackFrame.getValue(locvar1); + log2("2 : dbv1 = " + Double.doubleToRawLongBits(dbv1.value()) ); + if (dbv1.value() != 1111111111.0d) { + log3("ERROR: dbv1 != 1111111111.0d : " + dbv1.value() ); + expresult = returnCode1; + } + + break; + + + case 4: FloatValue flv1 = null; + FloatValue flv2 = null; + + locvar1 = stackFrame.visibleVariableByName(fl1); + locvar2 = stackFrame.visibleVariableByName(fl2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Float"); + expresult = returnCode1; + break; + } + + flv2 = (FloatValue) stackFrame.getValue(locvar2); + stackFrame.setValue(locvar1, flv2); + flv1 = (FloatValue) stackFrame.getValue(locvar1); + if (flv1.value() != 1111111111.0f) { + log3("ERROR: flv1 != 1111111111.0f : " + flv1.value() ); + expresult = returnCode1; + } + + break; + + case 5: IntegerValue inv1 = null; + IntegerValue inv2 = null; + + locvar1 = stackFrame.visibleVariableByName(in1); + locvar2 = stackFrame.visibleVariableByName(in2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Integer"); + expresult = returnCode1; + break; + } + + inv2 = (IntegerValue) stackFrame.getValue(locvar2); + stackFrame.setValue(locvar1, inv2); + inv1 = (IntegerValue) stackFrame.getValue(locvar1); + if (inv1.value() != 1) { + log3("ERROR: inv1 != 1 : " + inv1.value() ); + expresult = returnCode1; + } + + break; + + + case 6: LongValue lnv1 = null; + LongValue lnv2 = null; + + locvar1 = stackFrame.visibleVariableByName(ln1); + locvar2 = stackFrame.visibleVariableByName(ln2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Long"); + expresult = returnCode1; + break; + } + + lnv2 = (LongValue) stackFrame.getValue(locvar2); + lnv1 = (LongValue) stackFrame.getValue(locvar1); + log2("1 : lnv1= 0x" + Long.toHexString(lnv1.value()) + + " lnv2= 0x" + Long.toHexString(lnv2.value()) ); + + stackFrame.setValue(locvar1, lnv2); + + lnv1 = (LongValue) stackFrame.getValue(locvar1); + log2("2 : lnv1= 0x" + Long.toHexString(lnv1.value()) + + " lnv2= 0x" + Long.toHexString(lnv2.value())); + if (lnv1.value() != 0x1234567890abcdefL) { + log3("ERROR: lnv1 != 0x1234567890abcdefL : " + + Long.toHexString(lnv1.value()) ); + expresult = returnCode1; + } + + break; + + + case 7: ShortValue shv1 = null; + ShortValue shv2 = null; + locvar1 = stackFrame.visibleVariableByName(sh1); + locvar2 = stackFrame.visibleVariableByName(sh2); + if (locvar1 == null || locvar2 == null) { + log3("ERROR: 'locvar1 == null || locvar2 == null' for Short"); + expresult = returnCode1; + break; + } + + shv2 = (ShortValue) stackFrame.getValue(locvar2); + stackFrame.setValue(locvar1, shv2); + shv1 = (ShortValue) stackFrame.getValue(locvar1); + if (shv1.value() != 1) { + log3("ERROR: shv1 != 1 : " + shv1.value() ); + expresult = returnCode1; + } + + break; + + + default : log3("ERROR: TEST ERROR: case: default:"); + expresult = returnCode1; + break; + + } // end of switch + + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for: stackFrame.getValue()"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameException before the thread is resumed "); + expresult = returnCode1; + } catch ( Throwable e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + } // end of try + + } // end of for + } + + label2: { + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult != returnCode0) + break label2; + + try { + Value value = stackFrame.getValue(locvar1); + + log3("ERROR: no InvalidStackFrameExceprtion after the thread is resumed"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameException after the thread is resumed"); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java new file mode 100644 index 00000000000..aeae4528980 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java @@ -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.StackFrame.setValue.setvalue001; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue001 JDI test. + */ + +public class setvalue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.setValue()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The test checks up throwing
    + * IllegalArgumentException and
    + * InvalidTypeException.
    + * The case for testing is as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * Debuggee's method runt1() calls to the method runt2().
    + * At the beginning the debugger sets up breakpoints at both
    + * methods, so that, in run-time runt2() is suspended first.
    + * After getting the thread2 suspended first time, the debugger
    + * gets a LocalVariable object locvar1, mirroring
    + * a boolean variable in the runt2(), which becomes invalid
    + * when runt2() is left and the thread2 is suspended within run1t().
    + * After getting the thread2 suspended second time,
    + * the debugger checks up that the method invocation
    + * StackFrame.setValue() on locvar1 does throw
    + * IllegalArgumentException.
    + * Then the debugger gets a LocalVariable locvar2 mirroring
    + * a byte variable in current (valid) StackFrame and
    + * checks up that the method invocation
    + * setValue(locvar2, byte argument)
    + * does throw InvalidTypeException.
    + *
    + */ + +public class setvalue002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/setValue/setvalue002/setvalue002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.setValue.setvalue002.setvalue002a"; + + private String testedClassName = + "nsk.jdi.StackFrame.setValue.setvalue002.Threadsetvalue002a"; + + //String mName = "nsk.jdi.StackFrame.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + String bl3 = "bl3"; + String bl4 = "bl4"; + String bl1 = "bl1"; + String locThread = "locThread"; + + log2(" getting LocalVariables for checking up "); + try { + locvar1 = stackFrame.visibleVariableByName(bl3); + locvar2 = stackFrame.visibleVariableByName(bl4); + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + break label1; + } + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting thread2's current StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + + BooleanValue blv2 = null; + + try { + locvar2 = stackFrame.visibleVariableByName(bl1); + blv2 = (BooleanValue) stackFrame.getValue(locvar2); + + log2(" checking up IllegalArgumentException"); + stackFrame.setValue(locvar1, blv2); + + log3("ERROR: no IllegalArgumentException after thread2 returned from runt2()"); + expresult = returnCode1; + } catch ( IllegalArgumentException e1 ) { + log2(" : IllegalArgumentException after thread2 returned from runt2()"); + } catch ( InvalidTypeException e2 ) { + log3("ERROR: InvalidTypeException for stackFrame.setValue(locvar1, blv2)"); + expresult = returnCode1; + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + } + + + try { + locvar2 = stackFrame.visibleVariableByName(locThread); + + log2(" checking up InvalidTypeException"); + stackFrame.setValue(locvar2, blv2); + + log3("ERROR: no InvalidTypeException"); + expresult = returnCode1; + } catch ( InvalidTypeException eInavalid ) { + log2(" : InvalidTypeException"); + } catch ( Exception e ) { + log3("ERROR: unexpected exception: " + e); + expresult = returnCode1; + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java new file mode 100644 index 00000000000..e520deb28a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java @@ -0,0 +1,228 @@ +/* + * 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.StackFrame.setValue.setvalue002; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the setvalue002 JDI test. + */ + +public class setvalue002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + static public Threadsetvalue002a test_thread = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.setValue()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + * The test makes checking up on ReferenceTypes only.
    + *
    + * The case for testing is as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and
    + * after getting the thread2 suspended, checks up that
    + * for LocalVariables locvar1 and locvar2 the following sequence
    + * Value val1 = stackFrame.getValue(locvar1);
    + * stackFrame.setValue(locvar2, val1);
    + * Value val2 = stackFrame.getValue(locvar2);
    + * results in: val1.equals(val2)
    + * for the following tested ReferenceType objects
    + * ClassType
    + * InterfaceType
    + * ClassArray
    + * InterfaceArray
    + * PrimitiveArray
    + *
    + */ + +public class setvalue003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/setValue/setvalue003/setvalue003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.setValue.setvalue003.setvalue003a"; + + private String testedClassName = + "nsk.jdi.StackFrame.setValue.setvalue003.Threadsetvalue003a"; + + //String mName = "nsk.jdi.StackFrame.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + + String names[][] = { { "class1", "class2" }, + { "class3", "class4" }, + { "iface1", "iface2" }, + { "iface3", "iface4" }, + { "array1", "array2" } }; + + + + log2(" checking up variables of ReferenceTypes"); + + for (int i2 = 0; i2 < 5; i2++) { + try { + locvar1 = stackFrame.visibleVariableByName(names[i2][0]); + locvar2 = stackFrame.visibleVariableByName(names[i2][1]); + log2(" : tested type: " + locvar1.typeName()); + log2(" : tested variables: " + names[i2][0] + " " + names[i2][1]); + if (locvar1 != null && locvar2 != null) { + Value val1 = stackFrame.getValue(locvar1); + stackFrame.setValue(locvar2, val1); + Value val2 = stackFrame.getValue(locvar2); + if ( !val1.equals(val2)) { + log3("ERROR: !val1.equals(val2)"); + expresult = returnCode1; + } + } else { + log3("ERROR: locvar1 != null && locvar2 != null"); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java new file mode 100644 index 00000000000..040066b3e01 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java @@ -0,0 +1,250 @@ +/* + * 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.StackFrame.setValue.setvalue003; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setvalue003 JDI test. + */ + +public class setvalue003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.setValue()
    + * complies with its spec in case when a tested program
    + * is prepared with full information (see README file),
    + * hence, AbsentInformationException is not expected to happen.
    + * The test checks up throwing InvalidTypeException
    + *
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and after getting the thread2 suspended,
    + * checks up that for each in primitive types
    + * (1) setValue(PrimitiveType variable, null) does throw whereas
    + * (2) setValue(Object variable, null); does not throw
    + * InvalidTypeException
    + *
    + */ + +public class setvalue004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/setValue/setvalue004/setvalue004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new setvalue004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.setValue.setvalue004.setvalue004a"; + + private String testedClassName = + "nsk.jdi.StackFrame.setValue.setvalue004.Threadsetvalue004a"; + + //String mName = "nsk.jdi.StackFrame.setValue"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue004a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + + String names[] = { "bl1", "bt1", "ch1", "db1", + "fl1", "in1", "ln1", "sh1" }; + + log2(" checking up exception for: stackFrame.setValue(PrimitiveType variable, null);"); + for ( int i2 = 0; i2 < 8; i2++ ) { + + try { + locvar1 = stackFrame.visibleVariableByName(names[i2]); + log2(" checking up exception for: LocalVariable of " + locvar1.typeName() + " type"); + stackFrame.setValue(locvar1, null); + log3("ERROR: no Exception"); + expresult = returnCode1; + } catch ( java.lang.IllegalArgumentException e1 ) { + log3("ERROR: java.lang.IllegalArgumentException "); + expresult = returnCode1; + } catch ( InvalidTypeException e2 ) { + log2(" : InvalidTypeException "); + } catch ( ClassNotLoadedException e3 ) { + log3("ERROR: ClassNotLoadedException "); + expresult = returnCode1; + } catch ( InvalidStackFrameException e4 ) { + log3("ERROR: InvalidStackFrameException "); + expresult = returnCode1; + } catch ( VMMismatchException e5 ) { + log3("ERROR: VMMismatchException "); + expresult = returnCode1; + } catch ( AbsentInformationException e7 ) { + log3("ERROR: AbsentInformationException "); + expresult = returnCode1; + } catch ( Exception e6 ) { + log3("ERROR: UNSPECIFIED EXCEPTION: " + e6); + expresult = returnCode1; + } + } + + + String name = "testObj"; + + log2(" checking up exception for: stackFrame.setValue(Object variable, null);"); + try { + locvar1 = stackFrame.visibleVariableByName(name); + if (locvar1 != null) { + stackFrame.setValue(locvar1, null); + log2(" : no Exception"); + } else { + expresult = returnCode1; + log3("ERROR: locvar1 == null after: locvar1 = stackFrame.visibleVariableByName(name);"); + } + } catch ( java.lang.IllegalArgumentException e1 ) { + log3("ERROR: java.lang.IllegalArgumentException "); + expresult = returnCode1; + } catch ( InvalidTypeException e2 ) { + log3("ERROR: InvalidTypeException "); + expresult = returnCode1; + } catch ( ClassNotLoadedException e3 ) { + log3("ERROR: ClassNotLoadedException "); + expresult = returnCode1; + } catch ( InvalidStackFrameException e4 ) { + log3("ERROR: InvalidStackFrameException "); + expresult = returnCode1; + } catch ( VMMismatchException e5 ) { + log3("ERROR: VMMismatchException "); + expresult = returnCode1; + } catch ( AbsentInformationException e7 ) { + log3("ERROR: AbsentInformationException "); + expresult = returnCode1; + } catch ( Exception e6 ) { + log3("ERROR: UNSPECIFIED EXCEPTION: " + e6); + expresult = returnCode1; + } + + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java new file mode 100644 index 00000000000..0c028b86498 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java @@ -0,0 +1,222 @@ +/* + * 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.StackFrame.setValue.setvalue004; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setvalue004 JDI test. + */ + +public class setvalue004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.StackFrame.setValue()
    + * does not throw ClassNotLoadedException when a debugger part + * of the test attempts to set null value for a debuggee local variable + * which type has not yet been loaded through the appropriate class + * loader.

    + * + * The test works as follows. The debuggee part has two local + * variables: dummyVar of non-loaded type DummyType and + * finDummyVar of non-loaded type FinDummyType. + * Debugger part tries to provoke the exception by setting values of + * these variables. The test makes sure that class has not been loaded + * by the debuggee VM through the JDI method VirtualMachine.classesByName() + * which should return list of loaded classes only. + */ +public class setvalue005 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.StackFrame.setValue.setvalue005.setvalue005t"; + + // names of debuggee threads + static final String DEBUGGEE_THRDNAME = + "setvalue005tMainThr"; + + // tested debuggee local vars and theirs types + static final int VAR_NUM = 3; + static final String DEBUGGEE_VARS[][] = { + {"setvalue005tFindMe", "IGNORE MY TYPE"}, + {"dummyVar", "nsk.jdi.StackFrame.setValue.setvalue005.DummyType"}, + {"finDummyVar", "nsk.jdi.StackFrame.setValue.setvalue005.FinDummyType"} + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 67; + + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue005().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "setvalue005t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRDNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRDNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + // find a stack frame which belongs to the "setvalue005tMainThr" thread + StackFrame stFrame = findFrame(thrRef, DEBUGGEE_VARS[0][0]); + + for (int i=1; i + * com.sun.jdi.StackFrame.getValues()
    + * properly throws InvalidTypeException - if the value's type + * does not match type of specified variable.

    + * + * Debugger part of the test tries to provoke the exception by setting + * values of different primitive types and own DummyType which + * are not assignment compatible with the variable type, and not + * convertible without loss of information as well. + */ +public class setvalue006 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.StackFrame.setValue.setvalue006.setvalue006t"; + + // names of debuggee threads + static final String DEBUGGEE_THRDNAME = + "setvalue006tMainThr"; + + // tested debuggee local vars and theirs types + static final int VAR_NUM = 30; + static final String DEBUGGEE_VARS[][] = { + // list of debuggee's vars used to set values and ones + // used to get their wrong non-conversionable values, + // see section "5.1.2 Widening Primitive Conversion" in the JLS + {"setvalue006tFindMe", "doubleVar"}, + {"byteVar", "strVar"}, + {"byteVar", "shortVar"}, + {"byteVar", "intVar"}, + {"byteVar", "longVar"}, + {"byteVar", "floatVar"}, + {"byteVar", "doubleVar"}, + {"shortVar", "intVar"}, + {"shortVar", "longVar"}, + {"shortVar", "floatVar"}, + {"shortVar", "doubleVar"}, + {"intVar", "longVar"}, + {"intVar", "floatVar"}, + {"intVar", "doubleVar"}, + {"longVar", "floatVar"}, + {"longVar", "doubleVar"}, + {"floatVar", "doubleVar"}, + {"doubleVar", "setvalue006tFindMe"}, + {"charVar", "strVar"}, + {"booleanVar", "byteVar"}, + {"strVar", "charVar"}, + // see section "5.1.1 Identity Conversions" in the JLS: + // "the only permitted conversion that involves the type boolean is + // the identity conversion from boolean to boolean" + {"byteVar", "booleanVar"}, + {"shortVar", "booleanVar"}, + {"intVar", "booleanVar"}, + {"longVar", "booleanVar"}, + {"floatVar", "booleanVar"}, + {"doubleVar", "booleanVar"}, + {"charVar", "booleanVar"}, + {"strVar", "booleanVar"}, + {"setvalue006tFindMe", "booleanVar"} + }; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 72; + + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setvalue006().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "setvalue006t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRDNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRDNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + // find a stack frame which belongs to the "setvalue006tMainThr" thread + StackFrame stFrame = findFrame(thrRef, DEBUGGEE_VARS[0][0]); + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.thisObject()
    + * complies with its spec when the frame represents
    + * a non-native, non-static method.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and performs the following.
    + * 1) After getting a thread2 suspended but before to resume it,
    + * StackFrame.thisObject() is invoked and
    + * its returned value is casted to ThreadReference.
    + * Since the thread is not resumed yet, neither
    + * InvalidStackFrameException no ClassCastException must be thrown.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class thisobject001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/thisObject/thisobject001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new thisobject001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.thisObject.thisobject001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.thisObject.Threadthisobject001a"; + + //String mName = "nsk.jdi.StackFrame.thisObject"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + ObjectReference thisobj; + + log2(" getting stackFrame.thisObject() which must not be null"); + try { + thisobj = stackFrame.thisObject(); + if (thisobj == null) { + log3("ERROR: stackFrame.thisObject()==null for non-static method"); + expresult = returnCode1; + break label1; + } + log2(" casting ObjectReference to ThreadReference"); + ThreadReference t = (ThreadReference) thisobj; + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread is resumed"); + expresult = returnCode1; + break label1; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException for ThreadReference t = (ThreadReference) thisobj;"); + expresult = returnCode1; + break label1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" checking up throwing InvalidStackFrameExceprtion after the thread2 is resumed"); + try { + thisobj = stackFrame.thisObject(); + log3("ERROR: no InvalidStackFrameExceprtion after the thread2 is resumed"); + expresult = returnCode1; + break label1; + } catch ( InvalidStackFrameException e ) { + } + + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001/TestDescription.java new file mode 100644 index 00000000000..16b38e6f7dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/StackFrame/thisObject/thisobject001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.thisObject() + * complies with its spec: + * public ObjectReference thisObject() + * Returns the value of 'this' for the current frame. + * The ObjectReference for 'this' is only available for + * non-native instance methods. + * Returns: an ObjectReference, + * or null if the frame represents a native or static method. + * Throws: InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * when the frame represents a non-native, non-static method. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.thisObject.thisobject001; + * the debuggee program - nsk.jdi.StackFrame.thisObject.thisobject001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.thisObject.thisobject001 + * nsk.jdi.StackFrame.thisObject.thisobject001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.thisObject.thisobject001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java new file mode 100644 index 00000000000..80d06e0364f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java @@ -0,0 +1,222 @@ +/* + * 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.StackFrame.thisObject; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the thisobject001 JDI test. + */ + +public class thisobject001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.thisObject()
    + * complies with its spec for a static method.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and performs the following.
    + * 1) After getting a thread2 suspended but before to resume it,
    + * StackFrame.thisObject() is invoked and
    + * its returned value must be null.
    + * Since the thread is not resumed yet,
    + * InvalidStackFrameException must not be throw.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class thisobject002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/thisObject/thisobject002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new thisobject002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.thisObject.thisobject002a"; + + private String testedClassName = + "nsk.jdi.StackFrame.thisObject.Threadthisobject002a"; + + //String mName = "nsk.jdi.StackFrame.thisObject"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + ObjectReference thisobj; + + log2(" getting stackFrame.thisObject() which must not be null"); + try { + thisobj = stackFrame.thisObject(); + if (thisobj != null) { + log3("ERROR: stackFrame.thisObject() != null for a static method"); + expresult = returnCode1; + break label1; + } + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + break label1; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException for ThreadReference t = (ThreadReference) thisobj;"); + expresult = returnCode1; + break label1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" checking up throwing InvalidStackFrameExceprtion after the thread2 is resumed"); + try { + thisobj = stackFrame.thisObject(); + log3("ERROR: no InvalidStackFrameExceprtion after the thread2 is resumed"); + expresult = returnCode1; + break label1; + } catch ( InvalidStackFrameException e ) { + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002/TestDescription.java new file mode 100644 index 00000000000..e3363086932 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/StackFrame/thisObject/thisobject002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.thisObject() + * complies with its spec: + * public ObjectReference thisObject() + * Returns the value of 'this' for the current frame. + * The ObjectReference for 'this' is only available for + * non-native instance methods. + * Returns: an ObjectReference, + * or null if the frame represents a native or static method. + * Throws: InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * when the frame represents a static method. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.thisObject.thisobject002; + * the debuggee program - nsk.jdi.StackFrame.thisObject.thisobject002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.thisObject.thisobject002 + * nsk.jdi.StackFrame.thisObject.thisobject002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.thisObject.thisobject002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java new file mode 100644 index 00000000000..78961e0d4ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java @@ -0,0 +1,224 @@ +/* + * 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.StackFrame.thisObject; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the thisobject002 JDI test. + */ + +public class thisobject002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.thread()
    + * complies with its spec.
    + *
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * 1) After getting a thread2 suspended but before to resume it,
    + * the name of the thread2 got with StackFrame.thread() is equal to
    + * its name used for suspending the thread2.
    + * Since the thread2 is not resumed yet,
    + * InvalidStackFrameException must not be thrown.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class thread001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/thread/thread001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new thread001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.thread.thread001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.thread.Threadthread001a"; + + //String mName = "nsk.jdi.StackFrame.thread"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + // BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + log2(" checking up that thread2's two names are equal"); + try { + if (!stackFrame.thread().name().equals(threadName) ) { + log3("ERROR: !stackFrame.thread().name().equals(threadName)"); + expresult = returnCode1; + break label1; + } + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameException before the thread2 is resumed"); + expresult = returnCode1; + break label1; + } + + log2(" resuming the thread2 and "); + eventSet.resume(); + + log2(" checking up throwing InvalidStackFrameException"); + try { + ThreadReference t = stackFrame.thread(); + expresult = 1; + log3("ERROR: no InvalidStackFrameExceprtion after the thread2 is resumed"); + } catch ( InvalidStackFrameException e ) { + } + } + eventSet.resume(); // for case if thread2 was not resumed because of error in a check + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..50acc4329d0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/StackFrame/thread/thread001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.thread() + * complies with its spec: + * public ThreadReference thread() + * Returns the thread under which this frame's method is running. + * Returns: a ThreadReference which mirrors the frame's thread. + * Throws: InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.thread.thread001; + * the debuggee program - nsk.jdi.StackFrame.thread.thread001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.thread.thread001 + * nsk.jdi.StackFrame.thread.thread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.thread.thread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java new file mode 100644 index 00000000000..ccba427ba63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java @@ -0,0 +1,191 @@ +/* + * 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.StackFrame.thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the thread001 JDI test. + */ + +public class thread001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + tostring001a.brkpMethodName, + tostring001a.brkpLineNumber); + debuggee.resume(); + + debuggee.sendSignal(SIGNAL_GO); + Event event = null; + + // waiting the breakpoint event + try { + event = debuggee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (!(event instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + ThreadReference thread = ((BreakpointEvent)event).thread(); + List frames = null; + try { + frames = thread.frames(); + } catch(IncompatibleThreadStateException e) { + throw new Failure("Unexpected IncompatibleThreadStateException when getting list of frames"); + } + + display("Checking toString() method for debuggee's stack frames..."); + + // Check all methods from debuggee + for (int i = 0; i < frames.size(); i++) { + + StackFrame stackFrame = null; + try { + stackFrame = (StackFrame)frames.get(i); + String str = stackFrame.toString(); + if (str == null) { + complain("toString() returns null for stack frame #" + i); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for stack frame #" + i); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() returns for stack frame #" + i + " : " + str); + } + } catch(Exception e) { + complain("Unexpected " + e + " when getting StackFrame for stack frame #" + i); + exitStatus = Consts.TEST_FAILED; + } + + } + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..7f01c79ca2e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/toString/tostring001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/StackFrame/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.StackFrame interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * a StackFrame mirror of a debuggee's stack frame. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for StackFrame + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.toString.tostring001 + * nsk.jdi.StackFrame.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/toString/tostring001a.java new file mode 100644 index 00000000000..4542991e33a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/toString/tostring001a.java @@ -0,0 +1,96 @@ +/* + * 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.StackFrame.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "breakHere"; + public final static int brkpLineNumber = 92; + + //------------------------------------------------------ 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); + try { + pipe.println(tostring001.SIGNAL_READY); + breakHere(); + receiveSignal(tostring001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + public static void breakHere () { + receiveSignal(tostring001.SIGNAL_GO); + log.display("breakpoint line"); // brkpLineNumber + } +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java new file mode 100644 index 00000000000..eb53cb45ee4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java @@ -0,0 +1,608 @@ +/* + * 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.StackFrame.visibleVariableByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.visibleVariableByName()
    + * complies with its spec in case when a tested program
    + * is prepared with line number information,
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and performs the following.
    + * 1) After getting a thread2 suspended but before to resume it,
    + * StackFrame.visibleVariablesByName() is used to check up
    + * that the following is true:
    + * - two visible variables - local in a tested method;
    + * - invisible variable - a class variable;
    + * - invisible variable - local in another method;
    + * - invisible variable - local in the tested method.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class visiblevarbyname001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new visiblevarbyname001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.visibleVariableByName.Threadvisiblevarbyname001a"; + + //String mName = "nsk.jdi.StackFrame.visibleVariableByName"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + String name0 = "invi_i0"; + String name1 = "vi_i1"; + String name2 = "invi_i2"; + String name3 = "invi_i3"; + + + label01: { + log2(" checking up visibility of vi_i1"); + try { + locvar1 = stackFrame.visibleVariableByName(name1); + + if (locvar1 == null) { + log3("ERROR: locvar1 == null for 'vi_i1'"); + expresult = returnCode1; + break label01; + } + if (!locvar1.name().equals(name1)) { + log3("ERROR: !locvar1.name().equals(name1) for 'vi_i1'"); + expresult = returnCode1; + break label01; + } + log2(" vi_i1 is OK"); + } catch ( AbsentInformationException e1 ) { + log3("ERROR: AbsentInformationException for locvar1"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e2 ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + } + } + label02: { + log2(" checking up invisibility of invi_i0"); + try { + locvar1 = stackFrame.visibleVariableByName(name0); + if (locvar1 != null) { + log3("ERROR: locvar1 == null for 'invi_i0'"); + expresult = returnCode1; + break label02; + } + log2(" invi_i0 is OK"); + } catch ( AbsentInformationException e1 ) { + log3("ERROR: AbsentInformationException for locvar1"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e2 ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + } + } + label03: { + log2(" checking up invisibility of invi_i2"); + try { + locvar1 = stackFrame.visibleVariableByName(name2); + if (locvar1 != null) { + log3("ERROR: locvar1 != null for 'invi_i2'"); + expresult = returnCode1; + break label03; + } + log2(" invi_i2 is OK"); + } catch ( AbsentInformationException e1 ) { + log3("ERROR: AbsentInformationException for locvar1"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e2 ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + } + } + label04: { + log2(" checking up invisibility of invi_i3"); + try { + locvar1 = stackFrame.visibleVariableByName(name3); + if (locvar1 != null) { + log3("ERROR: locvar1 != null for 'invi_i3'"); + expresult = returnCode1; + break label04; + } + log2(" invi_i3 is OK"); + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for locvar1"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + } + } + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult == returnCode1) + break label1; + + log2(" checking up InvalidStackFrameException after resuming the thread2"); + try { + locvar2 = stackFrame.visibleVariableByName(name1); + log3("ERROR: no InvalidStackFrameExceprtion after the thread2 is resumed"); + expresult = returnCode1; + break label1; + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for locvar2"); + expresult = returnCode1; + break label1; + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameException for locvar2"); + } + + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001/TestDescription.java new file mode 100644 index 00000000000..0729b439891 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/StackFrame/visibleVariableByName/visiblevarbyname001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.visibleVariableByName() + * complies with its spec: + * public LocalVariable visibleVariableByName(java.lang.String name) + * throws AbsentInformationException + * Finds a LocalVariable that matches the given name and is visible + * at the current frame location. + * See visibleVariables() for more information on visibility. + * Parameters: name - the variable name to find + * Returns: the matching LocalVariable, or + * null if there is no visible variable with the given name. + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001; + * the debuggee program - nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001 + * nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001a + * + * @comment make sure visiblevarbyname001a is compiled with full debug info + * @clean nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001a + * @compile -g:lines,source,vars ../visiblevarbyname001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java new file mode 100644 index 00000000000..f9ff4bd6581 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java @@ -0,0 +1,222 @@ +/* + * 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.StackFrame.visibleVariableByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the visiblevarbyname001 JDI test. + */ + +public class visiblevarbyname001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.visibleVariableByName()
    + * complies with its spec in case when a tested program
    + * is prepared with no full information,
    + * hence, AbsentInformationException is expected to happen.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and after getting the thread2 suspended,
    + * it resumes it the thread2, invokes the tested method second time
    + * and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class visiblevarbyname002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new visiblevarbyname002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname002a"; + + private String testedClassName = + "nsk.jdi.StackFrame.visibleVariableByName.Threadvisiblevarbyname002a"; + + //String mName = "nsk.jdi.StackFrame.visibleVariableByName"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + String name1 = "vi_i1"; + + log2(" checking up visibility of vi_i1"); + try { + locvar1 = stackFrame.visibleVariableByName(name1); + log3("ERROR: no AbsentInformationException for locvar1"); + expresult = returnCode1; + } catch ( AbsentInformationException e ) { + log2(" : AbsentInformationException is thrown: OK"); + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameExceprtion before the thread is resumed"); + } + + log2(" resuming the thread2"); + eventSet.resume(); + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002/TestDescription.java new file mode 100644 index 00000000000..4d6b1006c9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/StackFrame/visibleVariableByName/visiblevarbyname002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.visibleVariableByName() + * complies with its spec: + * public LocalVariable visibleVariableByName(java.lang.String name) + * throws AbsentInformationException + * Finds a LocalVariable that matches the given name and is visible + * at the current frame location. + * See visibleVariables() for more information on visibility. + * Parameters: name - the variable name to find + * Returns: the matching LocalVariable, or + * null if there is no visible variable with the given name. + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * when a tested program is prepared with no full information, + * hence, AbsentInformationException is expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname002; + * the debuggee program - nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.visibleVariableByName.visiblevarbyname002 + * nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.visibleVariableByName.visiblevarbyname002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java new file mode 100644 index 00000000000..924557532ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java @@ -0,0 +1,221 @@ +/* + * 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.StackFrame.visibleVariableByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the visiblevarbyname002 JDI test. + */ + +public class visiblevarbyname002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.visibleVariables()
    + * complies with its spec in case when a tested program
    + * is prepared with line number information,
    + * hence, AbsentInformationException is not expected to happen.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and performs the following.
    + * 1) StackFrame.visiblevariables() is used to check up
    + * that returned List contains expected number and names
    + * of visible variables.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class visiblevariables001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/visibleVariables/visiblevariables001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new visiblevariables001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.visibleVariables.visiblevariables001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.visibleVariables.Threadvisiblevariables001a"; + + //String mName = "nsk.jdi.StackFrame.visibleVariables"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + + String name0 = null; + String name1 = null; + String testedName0 = "vi_i1"; + String testedName1 = "vi_bl1"; + + List visiblevars = null; + + log2(" checking up names of visible variables in the List"); + try { + visiblevars = stackFrame.visibleVariables(); + if (visiblevars.size() != 2) { + log3("ERROR: visiblevars.size() != 2 :" + visiblevars.size()); + expresult = returnCode1; + } else { + name0 = ( (LocalVariable) visiblevars.get(0) ).name(); + name1 = ( (LocalVariable) visiblevars.get(1) ).name(); + + if (name0.equals(testedName0)) { + if (!name1.equals(testedName1)) { + log3("ERROR: !name1.equals(testedName1)"); + expresult = returnCode1; + } + } else if (name0.equals(testedName1)) { + if (!name1.equals(testedName0)) { + log3("ERROR: !name1.equals(testedName0)"); + expresult = returnCode1; + } + } else { + log3("ERROR: !name0.equals(testedName1)"); + expresult = returnCode1; + } + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for stackFrame.visiblevariables()"); + expresult = returnCode1; + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + + if (expresult == returnCode1) + break label1; + + log2(" checking up InvalidStackFrameException after resuming the thread2"); + try { + visiblevars = stackFrame.visibleVariables(); + log3("ERROR: no InvalidStackFrameExceprtion after the thread2 is resumed"); + expresult = returnCode1; + break label1; + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for locvar2"); + expresult = returnCode1; + break label1; + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameException is thrown: OK"); + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001/TestDescription.java new file mode 100644 index 00000000000..3336d0b4c23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001/TestDescription.java @@ -0,0 +1,109 @@ +/* + * 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/StackFrame/visibleVariables/visiblevariables001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.visibleVariables() + * complies with its spec: + * public java.util.List visibleVariables() + * throws AbsentInformationException + * Returns a list containing each LocalVariable that + * can be accessed from this frame's location. + * Visibility is based on the code index of the current instruction of + * this StackFrame. Each variable has a range of byte code indices in which + * it is accessible. If this stack frame's method matches + * this variable's method and if the code index of this StackFrame is within + * the variable's byte code range, the variable is visible. + * A variable's byte code range is at least as large as the scope of that + * variable, but can continue beyond the end of the scope under certain + * circumstances: + * the compiler/VM does not immediately reuse the variable's slot. + * the compiler/VM is implemented to report the extended range that + * would result from the item above. + * The advantage of an extended range is that variables from recently + * exited scopes may remain available for examination (this is especially + * useful for loop indices). If, as a result of the extensions above, + * the current frame location is contained within the range of + * multiple local variables of the same name, the variable with + * the highest-starting range is chosen for the returned list. + * Returns: the list of LocalVariable objects currently visible. + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * when a tested program is prepared with full information (see COMMENTS), + * hence, AbsentInformationException is not expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.visibleVariables.visiblevariables001; + * the debuggee program - nsk.jdi.StackFrame.visibleVariables.visiblevariables001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * This test is option depended, + * that is its .cfg file contains the option + * JAVAC_OPTS=-g + * because at the date of preparing the test + * javac prepared full information for the test only + * been invoked with the option. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StackFrame.visibleVariables.visiblevariables001 + * nsk.jdi.StackFrame.visibleVariables.visiblevariables001a + * + * @comment make sure visiblevariables001a is compiled with full debug info + * @clean nsk.jdi.StackFrame.visibleVariables.visiblevariables001a + * @compile -g:lines,source,vars ../visiblevariables001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.visibleVariables.visiblevariables001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java new file mode 100644 index 00000000000..76fc656852b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java @@ -0,0 +1,222 @@ +/* + * 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.StackFrame.visibleVariables; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the visiblevariables001 JDI test. + */ + +public class visiblevariables001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * StackFrame.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StackFrame.visibleVariables()
    + * complies with its spec in case when a tested program
    + * is prepared with no full information,
    + * hence, AbsentInformationException is expected to happen.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up a breakpoint, and performs the following.
    + * 1) StackFrame.visiblevariables() is used to check up
    + * that AbsentInformationException is do thrown.
    + * 2) After resuming the thread2, the tested method is invoked
    + * second time and InvalidStackFrameException must be thrown.
    + *
    + */ + +public class visiblevariables002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StackFrame/visibleVariables/visiblevariables002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new visiblevariables002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StackFrame.visibleVariables.visiblevariables002a"; + + private String testedClassName = + "nsk.jdi.StackFrame.visibleVariables.Threadvisiblevariables002a"; + + //String mName = "nsk.jdi.StackFrame.visibleVariables"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + LocalVariable locvar1 = null; + LocalVariable locvar2 = null; + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + thread2 = debuggee.threadByName(threadName); + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + log2(" the thread2 is at the breakpoint"); + log2(" the check that the thread2 is suspended at the breakpoint"); + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + expresult = returnCode1; + break label1; + } + + + String name0 = null; + String name1 = null; + String testedName0 = "vi_i1"; + String testedName1 = "vi_bl1"; + + List visiblevars = null; + + log2(" invoking stackFrame.visibleVariables() first time before resuming thread2"); + try { + visiblevars = stackFrame.visibleVariables(); + + log3("ERROR: no Exception thrown"); + expresult = returnCode1; + } catch ( AbsentInformationException e ) { + log2(" : AbsentInformationException for stackFrame.visiblevariables()"); + } catch ( InvalidStackFrameException e ) { + log3("ERROR: InvalidStackFrameExceprtion before the thread2 is resumed"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" invoking stackFrame.visibleVariables() second time after resuming thread2"); + try { + visiblevars = stackFrame.visibleVariables(); + + log3("ERROR: no Exception thrown"); + expresult = returnCode1; + } catch ( AbsentInformationException e ) { + log2(" : AbsentInformationException for stackFrame.visiblevariables()"); + } catch ( InvalidStackFrameException e ) { + log2(" : InvalidStackFrameExceprtion before the thread2 is resumed"); + } + } + + log2(" resuming the thread2 for case it was suspended but not resumed yet"); + eventSet.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002/TestDescription.java new file mode 100644 index 00000000000..0caaab23d25 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002/TestDescription.java @@ -0,0 +1,98 @@ +/* + * 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/StackFrame/visibleVariables/visiblevariables002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StackFrame. + * The test checks up that a result of the method + * com.sun.jdi.StackFrame.visibleVariables() + * complies with its spec: + * public java.util.List visibleVariables() + * throws AbsentInformationException + * Returns a list containing each LocalVariable that + * can be accessed from this frame's location. + * Visibility is based on the code index of the current instruction of + * this StackFrame. Each variable has a range of byte code indices in which + * it is accessible. If this stack frame's method matches + * this variable's method and if the code index of this StackFrame is within + * the variable's byte code range, the variable is visible. + * A variable's byte code range is at least as large as the scope of that + * variable, but can continue beyond the end of the scope under certain + * circumstances: + * the compiler/VM does not immediately reuse the variable's slot. + * the compiler/VM is implemented to report the extended range that + * would result from the item above. + * The advantage of an extended range is that variables from recently + * exited scopes may remain available for examination (this is especially + * useful for loop indices). If, as a result of the extensions above, + * the current frame location is contained within the range of + * multiple local variables of the same name, the variable with + * the highest-starting range is chosen for the returned list. + * Returns: the list of LocalVariable objects currently visible. + * Throws: AbsentInformationException - + * if there is no line number information for this method. + * InvalidStackFrameException - + * if this stack frame has become invalid. + * Once the frame's thread is resumed, + * the stack frame is no longer valid. + * when a tested program is prepared with no full information, + * hence, AbsentInformationException is expected to happen. + * The test works as follows: + * The debugger program - nsk.jdi.StackFrame.visibleVariables.visiblevariables002; + * the debuggee program - nsk.jdi.StackFrame.visibleVariables.visiblevariables002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.StackFrame.visibleVariables.visiblevariables002 + * nsk.jdi.StackFrame.visibleVariables.visiblevariables002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StackFrame.visibleVariables.visiblevariables002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java new file mode 100644 index 00000000000..37652469c50 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java @@ -0,0 +1,222 @@ +/* + * 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.StackFrame.visibleVariables; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the visiblevariables002 JDI test. + */ + +public class visiblevariables002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i line 1, source 1 + * line 2 --> line 1, source 2 + * line 3 --> line 1, source 3 + * (lines in "Test stratum" has same numbers but different sources) + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 1 non-Java stratum and for this stratum following line mapping is defined: + * "Java" "TestStratum" + * + * 32 --> 1000, source1 + * 33 --> 1000, source2 + * ... ... + * sde_testMethod1 + * 43 --> 1100, source1 + * 44 --> 1100, source2 + * ... ... + * sde_testMethod1 + * 54 --> 1200, source1 + * 55 --> 1200, source2 + * ... ... + * Then debugger forces debuggee to load 'TestClass1' from updated class file, starts event listener thread which saves all received StepEvents, + * enables StepEvent request(class filter is used to receive events only for 'TestClass1') and forces debuggee to execute all methods defined in 'TestClass1'. + * When all methods was executed debugger checks up that StepEvents was generated for each location specified for 'TestStratum'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepEvent._itself_.stepEvent003.stepEvent003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepEvent._itself_.stepEvent003.stepEvent003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + */ + +package nsk.jdi.StepEvent._itself_.stepEvent003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.request.StepRequest; +import nsk.share.Consts; +import nsk.share.jdi.EventHandler; +import nsk.share.jdi.sde.*; + +public class stepEvent003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new stepEvent003().runIt(argv, out); + } + + private EventHandler eventHandler; + + protected List preparePatchedClassFile(String className) { + /* + * Create file with following line mapping: + * + * "Java" "TestStratum" + * + * + * 32 --> 1000, source1 + * ... + * 39 --> 1000, source8 + * + * sde_testMethod1 + * 43 --> 1100, source1 + * ... + * 50 --> 1100, source8 + * + * sde_testMethod2 + * 54 --> 1200, source1 + * ... + * 61 --> 1200, source8 + */ + + String sourceName = testStratumSourceName; + String sourcePath = testStratumSourcePath; + String stratumName = testStratumName; + + String smapFileName = "TestSMAP.smap"; + SmapGenerator smapGenerator = new SmapGenerator(); + + SmapStratum smapStratum = new SmapStratum(stratumName); + + List testStratumData = new ArrayList(); + + for (int i = 0; i < 8; i++) { + String source = sourceName + (i + 1); + String path = sourcePath + (i + 1); + testStratumData.add(new DebugLocation(source, path, + "", 1000 + i, INIT_LINE + i)); + smapStratum.addFile(source, path); + + testStratumData.add(new DebugLocation(source, path, + "sde_testMethod1", 1100 + i, METHOD1_LINE + i)); + smapStratum.addFile(source, path); + + testStratumData.add(new DebugLocation(source, path, + "sde_testMethod2", 1200 + i, METHOD2_LINE + i)); + smapStratum.addFile(source, path); + } + + for (DebugLocation debugLocation : testStratumData) { + smapStratum.addLineData(debugLocation.inputLine, debugLocation.sourceName, 1, debugLocation.outputLine, 1); + } + + smapGenerator.addStratum(smapStratum, false); + + savePathcedClassFile(className, smapGenerator, smapFileName); + + return testStratumData; + } + + public void doTest() { + String className = TestClass1.class.getName(); + + List locations = preparePatchedClassFile(className); + + initDefaultBreakpoint(); + + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + StepEventListener stepEventListener = new StepEventListener(); + eventHandler.addListener(stepEventListener); + + StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest( + debuggee.threadByName(SDEDebuggee.mainThreadName), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + stepRequest.setSuspendPolicy(StepRequest.SUSPEND_EVENT_THREAD); + stepRequest.addClassFilter(TestClass1.class.getName()); + stepRequest.enable(); + + vm.setDefaultStratum(testStratumName); + + pipe.println(SDEDebuggee.COMMAND_EXECUTE_TEST_METHODS + ":" + className); + + if (!isDebuggeeReady()) + return; + + stepEventListener.waitBreakpointEvent(); + + compareLocations(stepEventListener.stepLocations(), locations, testStratumName); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepEvent004/TestClass1.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepEvent004/TestClass1.java new file mode 100644 index 00000000000..4162f14f240 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepEvent004/TestClass1.java @@ -0,0 +1,1072 @@ +/* + * Copyright (c) 2007, 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.StepEvent._itself_.stepEvent004; + +// THIS TEST IS LINE NUMBER SENSITIVE + +public class TestClass1 // Class contains 10 methods with 100 locations, do not edit this file because of line numbers are hardcoded in test +{ + public TestClass1() + { + super(); // stepEvent004.INIT_LINE + } + public void sde_testMethod1() + { + int i = 0; // stepEvent004.METHOD1_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod2() + { + int i = 0; // stepEvent004.METHOD2_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod3() + { + int i = 0; // stepEvent004.METHOD3_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod4() + { + int i = 0; // stepEvent004.METHOD4_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod5() + { + int i = 0; // stepEvent004.METHOD5_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod6() + { + int i = 0; // stepEvent004.METHOD6_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod7() + { + int i = 0; // stepEvent004.METHOD7_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod8() + { + int i = 0; // stepEvent004.METHOD8_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod9() + { + int i = 0; // stepEvent004.METHOD9_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } + + public void sde_testMethod10() + { + int i = 0; // stepEvent004.METHOD10_LINE + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepEvent004/stepEvent004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepEvent004/stepEvent004.java new file mode 100644 index 00000000000..331d0fbb36b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepEvent004/stepEvent004.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/StepEvent/_itself_/stepEvent004. + * VM Testbase keywords: [jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test scenario: + * There is class 'TestClass1' defined in test package wich has 10 method with 100 locations in each method. + * Debugger creates copy of class file for this class with SourceDebugExtension attribute which contains informations for 3 + * stratums('TestStratum1'-'TestStratum3') and for all this stratums following line mapping is defined: + * "Java" "TestStratum" + * + * 31 --> 1001, source1 + * sde_testMethod1 + * 35 --> 2000, source1 + * ... ... + * 135 --> 2100, source1 + * sde_testMethod2 + * 139 --> 3000, source1 + * ... ... + * 239 --> 3100, source1 + * ... ... + * sde_testMethod10 + * 971 --> 11000, source1 + * ... ... + * 1071 --> 11100, source1 + * Then debugger forces debuggee to load 'TestClass1' from updated class file, starts event listener thread which saves all received StepEvents + * and enables StepEvent request(class filter is used to receive events only for 'TestClass1'). + * for TestStratum in 'TestStratum1'-'TestStratum3' + * do + * - set TestStratum as VM default + * - force debuggee to execute all methods defined in 'TestClass1' + * - when all methods was executed check up that StepEvents was generated for each location specified for TestStratum + * Described event generation is performed 10 times. + * done + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepEvent._itself_.stepEvent004.stepEvent004 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepEvent._itself_.stepEvent004.stepEvent004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.StepEvent._itself_.stepEvent004; + +import java.io.*; +import java.util.*; +import com.sun.jdi.request.StepRequest; +import nsk.share.Consts; +import nsk.share.jdi.EventHandler; +import nsk.share.jdi.sde.*; + +public class stepEvent004 extends SDEDebugger { + private static final int INIT_LINE = 31; + private static final int METHOD1_LINE = 35; + private static final int METHOD2_LINE = 139; + private static final int METHOD3_LINE = 243; + private static final int METHOD4_LINE = 347; + private static final int METHOD5_LINE = 451; + private static final int METHOD6_LINE = 555; + private static final int METHOD7_LINE = 659; + private static final int METHOD8_LINE = 763; + private static final int METHOD9_LINE = 867; + private static final int METHOD10_LINE = 971; + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new stepEvent004().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + private EventHandler eventHandler; + + protected Map preparePatchedClassFile(String className, int testStratumCount) { + /* + * Create file with following line mapping for each test stratum: + * + * "Java" "TestStratum" + * + * 31 --> 1001, source1 + * sde_testMethod1 + * 35 --> 2000, source1 + * ... ... + * 135 --> 2100, source1 + * sde_testMethod2 + * 139 --> 3000, source1 + * ... ... + * 239 --> 3100, source1 + * ... ... + * sde_testMethod10 + * 971 --> 11000, source1 + * ... ... + * 1071 --> 11100, source1 + */ + String smapFileName = "TestSMAP.smap"; + SmapGenerator smapGenerator = new SmapGenerator(); + + Map testStratumData = new TreeMap(); + + for (int i = 0; i < testStratumCount; i++) { + String stratumName = testStratumName + (i + 1); + + LocationsData locationsData = new LocationsData(stratumName); + + String sourceName = testStratumSourceName + (i + 1); + String sourcePath = testStratumSourcePath + (i + 1); + + locationsData.paths.add(sourcePath); + + SmapStratum smapStratum = new SmapStratum(stratumName); + + List sourceLocations = new ArrayList(); + + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "", 1001, INIT_LINE)); + + for (int j = 0; j < 100; j++) { + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod1", 2000 + j, METHOD1_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod2", 3000 + j, METHOD2_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod3", 4000 + j, METHOD3_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod4", 5000 + j, METHOD4_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod5", 6000 + j, METHOD5_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod6", 7000 + j, METHOD6_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod7", 8000 + j, METHOD7_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod8", 9000 + j, METHOD8_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod9", 10000 + j, METHOD9_LINE + j)); + sourceLocations.add(new DebugLocation(sourceName, sourcePath, + "sde_testMethod10", 11000 + j, METHOD10_LINE + j)); + } + + locationsData.sourceLocations.put(sourceName, sourceLocations); + locationsData.allLocations.addAll(sourceLocations); + testStratumData.put(stratumName, locationsData); + + smapStratum.addFile(sourceName, sourcePath); + + for (DebugLocation debugLocation : sourceLocations) { + smapStratum.addLineData( + debugLocation.inputLine, + debugLocation.sourceName, + 1, + debugLocation.outputLine, + 1); + } + + smapGenerator.addStratum(smapStratum, false); + } + + savePathcedClassFile(className, smapGenerator, smapFileName); + + return testStratumData; + } + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = preparePatchedClassFile(className, testStratumCount); + + initDefaultBreakpoint(); + + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + StepEventListener stepEventListener = new StepEventListener(); + eventHandler.addListener(stepEventListener); + + StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest( + debuggee.threadByName(SDEDebuggee.mainThreadName), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + stepRequest.setSuspendPolicy(StepRequest.SUSPEND_EVENT_THREAD); + stepRequest.addClassFilter(TestClass1.class.getName()); + stepRequest.enable(); + + // for each stratum defined for class + for (String stratumName : testStratumData.keySet()) { + log.display("Generate events for stratum: " + stratumName); + + vm.setDefaultStratum(stratumName); + + // perform event generation 10 times + for (int i = 0; i < 10; i++) { + stepEventListener.clearLocations(); + + pipe.println(SDEDebuggee.COMMAND_EXECUTE_TEST_METHODS + ":" + className); + + if (!isDebuggeeReady()) + return; + + stepEventListener.waitBreakpointEvent(); + + compareLocations( + stepEventListener.stepLocations(), + testStratumData.get(stratumName).allLocations, + stratumName); + } + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001.java new file mode 100644 index 00000000000..47bf5432157 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001.java @@ -0,0 +1,386 @@ +/* + * 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.StepEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class stepevent001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String TEST_NAME = "nsk.jdi.StepEvent._itself_.stepevent001"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + static private final int EXPECTED_EVENTS_COUNT = 10; + + static private Debugee debuggee; + static private IOPipe pipe; + static private VirtualMachine vm; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private StepRequest checkedRequest; + static private BreakpointRequest breakpointRequest; + static private Field checkedField; + static private Method checkedMethod; + static private Location checkedLocation; + static private ThreadReference checkedThread; + static private ReferenceType checkedClass; + + static private boolean testFailed; + static private long eventTimeout; + static private int eventsReceived, oldValue; + + static private volatile boolean methodCompleted; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + methodCompleted = false; + eventsReceived = 0; + oldValue = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + debuggee.resume(); + + try { + + // waiting for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + + // find checked location and create StepEventrequest + EventRequestManager eventRManager = vm.eventRequestManager(); + + log.display("Getting loaded class in debuggee"); + List classes = vm.classesByName(DEBUGGEE_NAME); + checkedClass = (ReferenceType) classes.get(0); + + log.display("Getting reference to main thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to main thread"); + } + + log.display("Getting reference to method "); + List allMethods = checkedClass.methodsByName("foo"); + checkedMethod = (Method) allMethods.get(0); + + log.display("Getting reference to field "); + checkedField = checkedClass.fieldByName("counter"); + if (checkedField == null) { + throw new Failure("TEST BUG: unable to find reference to field "); + } + + log.display("Getting all locations"); + List allLineLocations; + try { + allLineLocations = checkedMethod.allLineLocations(); + } catch ( AbsentInformationException e) { + throw new Failure("TEST BUG: caught AbsentInformationException " + e); + } + + log.display("Getting checked location"); + Iterator locIterator = allLineLocations.iterator(); + while (locIterator.hasNext()) { + Location curLocation = (Location)locIterator.next(); + int curNumber = curLocation.lineNumber(); + if (curLocation.lineNumber() == stepevent001a.stepLineBegin) { + if (checkedLocation != null) { + throw new Failure("TEST BUG: multiple locations on breakpoint line"); + } else { + checkedLocation = curLocation; + } + } + } + + if (checkedLocation == null) { + throw new Failure("TEST BUG: incorrect line number of the location in method"); + } + + log.display("Creating auxiliary BreakpointRequest"); + if ((breakpointRequest = eventRManager.createBreakpointRequest(checkedLocation)) == null) { + throw new Failure("TEST BUG: unable to create BreakpointRequest"); + } + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + + switch (breakpointRequest.suspendPolicy()) { + case EventRequest.SUSPEND_ALL: + log.display("suspend policy is SUSPEND_ALL"); + break; + case EventRequest.SUSPEND_EVENT_THREAD: + log.display("suspend policy is SUSPEND_EVENT_THREAD"); + break; + case EventRequest.SUSPEND_NONE: + log.display("suspend policy is SUSPEND_NONE"); + break; + default: + log.complain("TEST BUG: Unknown suspend policy!"); + } + + breakpointRequest.enable(); + log.display("Auxiliary BreakpointRequest is created"); + + log.display("Creating StepRequest"); + if ((checkedRequest = eventRManager.createStepRequest(checkedThread, + StepRequest.STEP_LINE, StepRequest.STEP_OVER)) == null) { + throw new Failure("TEST BUG: unable to create StepRequest"); + } + checkedRequest.addClassFilter(checkedClass); + log.display("StepRequest is created but not yet enabled"); + + // sdefine separate thread for handleing received events + class EventHandler extends Thread { + public void run() { + // handle events antil method invoking completes and all expected events received + while (!methodCompleted || eventsReceived < EXPECTED_EVENTS_COUNT) { + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (InterruptedException e) { + log.complain("Unexpected InterruptedException while receiving event: " + e); + break; + } + + if (eventSet == null) { + log.display("No event"); + continue; + } + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + // handle BreakPointEvent + if (event instanceof BreakpointEvent) { + Location eventLocation = ((BreakpointEvent)event).location(); + log.display("BreakpointEvent received for location " + eventLocation.lineNumber()); + if (eventLocation.lineNumber() == stepevent001a.stepLineBegin) { + checkedRequest.enable(); + log.display("StepRequest is enabled upon receiving breakpoint event on checked line"); + } + } + + // handle StepEvent + if (event instanceof StepEvent) { + StepEvent castedEvent = (StepEvent) event; + log.display("Received event is StepEvent:\n " + event); + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } else { + eventsReceived++; + log.display("Expected StepEvent received: " + eventsReceived + " times"); + } + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 2: eventThread is not equal to checked thread"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 3: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + Location eventLocation = castedEvent.location(); + int lineNumber = eventLocation.lineNumber(); + log.display("StepEvent received for location: " + lineNumber); + + try { + int counterValue = ((IntegerValue)checkedClass.getValue(checkedField)).value(); + log.display("Counter == " + counterValue); + if ( counterValue > oldValue) { + if (!eventThread.isSuspended()) { + log.complain("FAILURE 4: eventThread is not suspended"); + } else { + log.complain("FAILURE 5: StepEvent is generated after code execution"); + } + testFailed = true; + } + oldValue++; // modify for the next event + + } catch (ClassCastException e) { + log.complain("TEST BUG: cannot get value of field"); + testFailed = true; + } + + // disable StepEvent when last checked line reached + if (lineNumber == stepevent001a.stepLineEnd) { + log.display("Disabling event request at the last checked line: " + lineNumber); + checkedRequest.disable(); + } + + } + + // ignore all oter events + } + + log.display("Resuming event set"); + eventSet.resume(); + } + + log.display("eventHandler completed"); + } + } + + // start EventHandler thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to invoke method and generate StepEvents + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + log.display(""); + + // waiting for debuggee finished invoking method + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unknown debuggee's command: " + command); + } + methodCompleted = true; + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // Check if all StepEvents are received + if (eventsReceived < EXPECTED_EVENTS_COUNT) { + log.display("Too few StepEvents are received: " + eventsReceived); + testFailed = true; + } else if (eventsReceived > EXPECTED_EVENTS_COUNT) { + log.display("Too many StepEvents are received: " + eventsReceived); + testFailed = true; + } else { + log.display("All expected StepEvents are received"); + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + // disable event requests to prevent appearance of further events + if (checkedRequest != null && checkedRequest.isEnabled()) { + log.display("Disabling StepEvent request"); + checkedRequest.disable(); + } + if (breakpointRequest != null && breakpointRequest.isEnabled()) { + log.display("Disabling auxilary breakpoint request"); + breakpointRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001/TestDescription.java new file mode 100644 index 00000000000..d513a60e9c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001/TestDescription.java @@ -0,0 +1,97 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/StepEvent/_itself_/stepevent001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.StepEvent interface. + * The test checks the following assertions: + * - StepEvent is received by debugger for requested + * location if this location is reached by some executing thread + * in debugged VM; + * - received StepEvent has proper references to: + * debugged VM, + * executed thread, + * related StepRequest, + * checked location. + * - StepEvent is generated before the code at its location + * is executed. + * A debugger class - nsk.jdi.StepEvent._itself_.stepevent001 ; + * a debuggee class - nsk.jdi.StepEvent._itself_.stepevent001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger launches and connects to debuggee using the default launching + * connector. The debugger creates auxiliary BreakpointRequest on location in + * method of class where field is assigned + * to zero. The field in incremented on next lines of this method + * until exit. Also debugger creates but disables the StepRequest to receive + * StepEvent with size equals to STEP_LINE and depth equals to STEP_OVER + * The debugger starts thread for listening events delivered + * from debuggee, sends command to debuggee and waits for command . + * Upon receiving command from debugger, the debuggee invokes + * method and, after method has been invoked, sends command to debugger. + * When BreakpointEvent is received by , it enables + * StepRequest. + * For each StepEvent received by , it compares all refencies + * of this event ( , , , ) + * with expected values. The current value of field reference + * is compared with expected value. + * When StepEvent for last checked line is received, + * disables StepRequest to prevent further generation of StepEvents. + * When command received from debuggee, debugger notifies + * that method is invoked and waits for + * receives all expected events. If not all events received for + * WAITIME period, debugger interrupts thread and + * complains about an error. + * Finally, debugger disables all requests, sends debuggee command from debugger + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + // invoke checked method to generate StepEvents + foo(); + + // notify debugger that checked method invoked + pipe.println(COMMAND_DONE); + + // wait for command from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + return PASSED; + } + + void foo() { + // Increment 10 times; + counter = 0; // stepLineBegin + counter = 1; + counter = 2; + counter = 3; + counter = 4; + counter = 5; + counter = 6; + counter = 7; + counter = 8; + counter = 9; + counter = 10; // stepLineEnd + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002.java new file mode 100644 index 00000000000..64514434612 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002.java @@ -0,0 +1,311 @@ +/* + * 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.StepEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.List; +import java.util.Iterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class stepevent002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String TEST_NAME = "nsk.jdi.StepEvent._itself_.stepevent002"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + static final int EXPECTED_EVENTS_COUNT = 10; + + static private Debugee debuggee; + static private IOPipe pipe; + static private VirtualMachine vm; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private StepRequest checkedRequest; + static private Location checkedLocation; + static private ThreadReference checkedThread; + static private ReferenceType checkedClass; + + static private long eventTimeout; + static private EventRequestManager eventRManager; + static private boolean testFailed; + static private int eventsCount, frameCount, oldFrameCount; + + static private volatile boolean threadFinished; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + threadFinished = false; + eventsCount = 0; + frameCount = -1; + oldFrameCount = -1; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // prepare debugee, create request, and wait for StepEvent + try { + + // resume debugee and wait for it becomes ready + log.display("Resuming debuggee"); + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (command == null || !command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirror of debugee class + if ((checkedClass = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find debuggee's class " + DEBUGGEE_NAME); + } + + // create request for step event + log.display("Getting reference to thread "); + checkedThread = (ThreadReference) checkedClass.getValue(checkedClass.fieldByName("threadForEvent") ) ; + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to "); + } + + log.display("Creating StepRequest with size = STEP_LINE, depth = STEP_INTO"); + eventRManager = vm.eventRequestManager(); + if ((checkedRequest = eventRManager.createStepRequest( checkedThread, + StepRequest.STEP_LINE, StepRequest.STEP_INTO)) == null) { + throw new Failure("TEST BUG: unable to create StepRequest"); + } +// checkedRequest.addClassFilter(checkedThread.referenceType()); + checkedRequest.addClassFilter(checkedClass); + + // separate thread for handling events + class EventHandler extends Thread { + public void run() { + log.display("Event handler started"); + + // handle events until thread finishes and all expected events received + while (!(threadFinished && eventsCount >= EXPECTED_EVENTS_COUNT)) { + + // get next available event set + eventSet = null; + try { + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + } catch (Exception e) { + throw new Failure("TEST INCOMPLETE: Unexpected exception while getting event: " + e); + } + if (eventSet == null) + continue; + + // handle each event from the event set + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + // handle StepEvent + if (event instanceof StepEvent) { + + StepEvent castedEvent = (StepEvent)event; + log.display("Received event is StepEvent:\n " + castedEvent); + + // check that received event is for checked request + EventRequest eventRequest = castedEvent.request(); + if (checkedRequest.equals(eventRequest)) { + eventsCount++; + log.display("Expected StepEvent for checked request received: " + eventsCount); + } else { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + + // check that received event is for checked VM + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + // check that received event is for checked thread + ThreadReference eventThread = castedEvent.thread(); + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + + Location eventLocation = castedEvent.location(); + log.display("StepEvent received for location: " + eventLocation.lineNumber()); + + try { + frameCount = checkedThread.frameCount(); + log.display("frame count " + frameCount); + if (oldFrameCount > frameCount) { + log.complain("FAILURE 4: step event is not generated for STEP_INTO"); + testFailed = true; + } + oldFrameCount = frameCount; + } catch (Exception e) { + log.complain("ERROR: Unexpected exception is thrown while trying frame count " + e.getMessage()); + testFailed = true; + } + } + + // ignore all other events + } + + // resume each received event set + log.display("Resuming event set"); + eventSet.resume(); + } + + log.display("Event handler finished successfully"); + } + } + + // start event handler in a separate thread + log.display("Starting event handler thread"); + EventHandler eventHandler = new EventHandler(); + eventHandler.start(); + + // enable event request + log.display("Enabling event request"); + checkedRequest.enable(); + log.display("StepRequest for threadForEvent is created and enabled"); + + // force checked class to be unloaded from debuggee + log.display("Force debuggee to invoke checked method and generate step events"); + pipe.println(COMMAND_GO); + + log.display(""); + + // wait for thread finished in debugee + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command == null || !command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + threadFinished = true; + + log.display(""); + + // waiting for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + if (eventHandler.isAlive()) { + log.display("Interrupting event handler thread"); + eventHandler.interrupt(); + } + + // check number of received events + if (eventsCount == 0) { + log.complain("FAILURE 4: No any StepEvent received"); + testFailed = true; + } + if (eventsCount < EXPECTED_EVENTS_COUNT) { + log.complain("FAILURE 4: Too few StepEvents received: " + eventsCount); + testFailed = true; + } + if (eventsCount > EXPECTED_EVENTS_COUNT) { + log.complain("FAILURE 4: Too many StepEvents received: " + eventsCount); + testFailed = true; + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + // disable event request to prevent appearance of further events + if (checkedRequest != null) { + log.display("Disabling event request"); + checkedRequest.disable(); + } + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002/TestDescription.java new file mode 100644 index 00000000000..d1e88daa105 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/StepEvent/_itself_/stepevent002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.StepEvent interface. + * The test checks the following assertions: + * - if debugger creates StepRequest with depth equals to + * STEP_INTO, then for every received StepEvent frame count + * of thead's stack is increased every time. + * A debugger class - nsk.jdi.StepEvent._itself_.stepevent002 ; + * a debuggee class - nsk.jdi.StepEvent._itself_.stepevent002a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger launches and connects to debuggee using the default launching + * connector. The debugger creates the StepRequest to receive StepEvent + * with size equals to STEP_LINE and depth equals to STEP_INTO. + * The debugger clears event queue and starts thread + * to handle received events asynchronously. After started + * debugger enables Steprequest and sends debuggee command to + * force it to invoke checked method in checked thread. + * Upon receiving command from debugger, the debuggee permits + * started thread to invokes recursively method. The + * method of is written at a single line to avoid generating + * step events of line changing while execution. When thread finished + * invoking method it stopped and debuggee sends debugger + * command . + * If in debugger receives StepEvent, it compares all + * refencies of this event ( , , , ) + * with expected values. It is checked that current count of frame of + * checked thread is more or equal to count of frame at the moment of + * previous step event. + * When debugger receives command from debuggee it notifies + * that all metod invokations in the checked thread done and waits for + * finishes. finishes only if all expected events + * received. If no all events received for WAITTIME period, debugger interrupts + * , checks number of received events, and complains about an error. + * Finally, debugger sends debuggee command to quit, clears event queue, + * waits for debugee finished, and exits. + * The test fails if any of this checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4463674: TEST_BUG: some JDI tests are timing dependent + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepEvent._itself_.stepevent002 + * nsk.jdi.StepEvent._itself_.stepevent002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepEvent._itself_.stepevent002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002a.java new file mode 100644 index 00000000000..87a0846be97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002a.java @@ -0,0 +1,164 @@ +/* + * 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.StepEvent._itself_; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +public class stepevent002a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + // commands + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + // monitors + public static Object threadStarted = new Object(); + public static Object threadExecuted = new Object(); + public static Object threadFinished = new Object(); + + // checked thread + private static stepevent002aThread threadForEvent; + + // support classes + private static ArgumentHandler argHandler; + private static IOPipe pipe; + public static Log log; + + public static void main(String args[]) { + stepevent002a _stepevent002a = new stepevent002a(); + System.exit(JCK_STATUS_BASE + _stepevent002a.runIt(args, System.err)); + } + + int runIt( String args[], PrintStream out) { + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + pipe = argHandler.createDebugeeIOPipe(); + + // create checked thread + threadForEvent = new stepevent002aThread("threadForEvent"); + + // lock monitor threadFinished to prevent checked thread + // from exiting after it executed + synchronized (threadFinished) { + + // lock monitor threadExecuted to prevent checked method invokation + // before command received + synchronized (threadExecuted) { + + // start checked thread and wait for it actually started + synchronized (threadStarted) { + log.display("Starting checked thread"); + threadForEvent.start(); + try { + threadStarted.wait(); + } catch (InterruptedException e) { + log.complain("TEST BUG: Debugee: InterruptedException caught: " + e); + return FAILED; + } + } + + // thread started; notify debugger and wait for command + pipe.println(COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + // unlock threadExecuted monitor to permit checked thread to execute + // and wait for checked thread finishes invoking method + try { + log.display("Waiting for checked thread executed"); + threadExecuted.wait(); + } catch (InterruptedException e) { + log.complain("TEST BUG: Debugee: InterruptedException caught: " + e); + return FAILED; + } + } + + // checked method invoked (but thread not finished yet) + // notify debugger + pipe.println(COMMAND_DONE); + + // wait for command from debugger and exit debuggee + String command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + log.complain("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + + // unlock monitor threadFinished to permit checked thread to finish + } + + return PASSED; + } + + // checked method (recursive for 10 times) + static void foo(int i) { if (i-- > 1) { foo(i); } } +} + +// checked thread class +class stepevent002aThread extends Thread { + static private int counter; + + stepevent002aThread (String name) { + super(name); + } + + public void run() { + + // notify main thread that checked thread started + synchronized (stepevent002a.threadStarted) { + stepevent002a.log.display("Checked thread started"); + stepevent002a.threadStarted.notify(); + } + + // wait for main thread releases monitor to permit checked thread to execute + synchronized (stepevent002a.threadExecuted) { + counter = stepevent002.EXPECTED_EVENTS_COUNT; + stepevent002a.log.display("Invoking checked method from checked thread"); + stepevent002a.foo(counter); + stepevent002a.log.display("Checked method invoked"); + + // notify main thread that checked thread executed + stepevent002a.threadExecuted.notify(); + } + + // wait for main thread releases monitor to permit thread to finish + synchronized (stepevent002a.threadFinished) { + stepevent002a.log.display("Checked thread finished"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001.java new file mode 100644 index 00000000000..4055b762f5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001.java @@ -0,0 +1,200 @@ +/* + * 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.StepRequest._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; + +/** + * The test checks up the
    + * - addInstanceFilter(ObjectReference)
    + * - addClassFilter(ReferenceType)
    + * - addClassFilter(String)
    + * - addClassExclusionFilter(String)
    + * methods with null argument value. + * In any cases NullPointerException is expected. + */ +public class filters001 { + + private final static String prefix = "nsk.jdi.StepRequest._bounds_."; + private final static String debuggerName = prefix + "filters001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + display(""); + display(">>>creating StepRequest"); + + ThreadReference thread = debugee.threadByName("main"); + EventRequestManager evm = debugee.getEventRequestManager(); + StepRequest request = evm.createStepRequest(thread, StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + display(""); + addInstanceFilter(request, null); + + display(""); + addClassFilter(request, (ReferenceType )null); + + display(""); + addClassFilter(request, (String )null); + + display(""); + addClassExclusionFilter(request, (String )null); + + display(""); + debugee.quit(); + } + + private void addInstanceFilter(StepRequest request, + ObjectReference instance) { + String tmp = "addInstanceFilter :object value> "; + tmp += (instance == null) ? "" : instance.toString(); + display(tmp); + + try { + request.addInstanceFilter(instance); + if (instance==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (instance == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(StepRequest request, ReferenceType refType) { + + display("addClassFilter :ReferenceType> <" + refType + ">"); + + try { + request.addClassFilter(refType); + if (refType==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (refType==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(StepRequest request, String classPattern) { + + display("addClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(StepRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassExclusionFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..5421c1ee410 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001/TestDescription.java @@ -0,0 +1,58 @@ +/* + * 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/StepRequest/_bounds_/filters001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.StepRequest.addInstanceFilter(ObjectReference) + * com.sun.jdi.request.StepRequest.addClassFilter(ReferenceType) + * com.sun.jdi.request.StepRequest.addClassFilter(String) + * com.sun.jdi.request.StepRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up this methods with argument value. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest._bounds_.filters001 + * nsk.jdi.StepRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..2ecfdf6d4a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001a.java @@ -0,0 +1,54 @@ +/* + * 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.StepRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001.java new file mode 100644 index 00000000000..6146d1476fa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001.java @@ -0,0 +1,196 @@ +/* + * 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.StepRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * StepRequest. + * + * The test checks that results of the method + * com.sun.jdi.StepRequest.addClassExclusionFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - sets up StepRequest1 and restricts it using a pattern that + * begins with '*' + * - resumes the debuggee, and waits for expected StepEvent. + * - The debuggee creates and starts a thread, thread1, + * which being run, invokes methods used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + * Then the same is repeated for a pattern that ends with *. + */ + +public class filter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.StepRequest.addClassExclusionFilter.filter001a"; + return new filter001().runThis(argv, out); + } + + private String testedClassName1 = "TestClass11"; + private String testedClassName2 = "nsk.jdi.StepRequest.addClassExclusionFilter.Thread2filter001a"; + + private static EventRequest eventRequest1; + private static EventRequest eventRequest2; + + protected void testRun() { + + String property1 = "StepRequest1"; + String property2 = "StepRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String threadName1 = "thread1"; + String threadName2 = "thread2"; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + thread1 = debuggee.threadByName(threadName1); + eventRequest1 = setting23StepRequest(thread1, "*" + testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof StepEvent && event.request().equals(eventRequest1)) { + String str = ((StepEvent)event).location().declaringType().name(); + if (str.endsWith(testedClassName1)) { + setFailedStatus("eventRequest1: Received unexpected StepEvent for excluded class:" + str); + } else { + display("eventRequest1: Received expected StepEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting1 for StepEvent in expected thread"); + vm.resume(); + break; + + case 1: + thread2 = debuggee.threadByName(threadName2); + eventRequest2 = setting23StepRequest(thread2, testedClassName2 + "*", + EventRequest.SUSPEND_NONE, property2); + + eventRequest2.enable(); + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof StepEvent && event.request().equals(eventRequest2)) { + String str = ((StepEvent)event).location().declaringType().name(); + if (str.endsWith(testedClassName2)) { + setFailedStatus("eventRequest2: Received unexpected StepEvent for excluded class:" + str); + } else { + display("eventRequest2: Received expected StepEvent for " + str); + } + return true; + } + return false; + } + } + ); + + display("......waiting2 for StepEvent in expected thread"); + vm.resume(); + break; + + case 2: + display("disabling event requests"); + eventRequest1.disable(); + eventRequest2.disable(); + + display("resuming debuggee"); + vm.resume(); + break; + + default: + throw new TestBug("Test logic error"); + } + } + return; + } + + private StepRequest setting23StepRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up StepRequest:"); + display(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + // limit events number (otherwise too many events will be generated) + str.addCountFilter(10); + str.setSuspendPolicy(suspendPolicy); + str.addClassExclusionFilter(testedClass); + + display(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..d0b6c42fd6a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/StepRequest/addClassExclusionFilter/filter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateStep - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassExclusionFilter.filter001; + * the debuggee program - nsk.jdi.StepRequest.addClassExclusionFilter.filter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * Modified due to fix of the bug: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addClassExclusionFilter.filter001 + * nsk.jdi.StepRequest.addClassExclusionFilter.filter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassExclusionFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001a.java new file mode 100644 index 00000000000..73e334a34d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001a.java @@ -0,0 +1,245 @@ +/* + * 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.StepRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter001 JDI test. + */ + +public class filter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter001a thread1 = null; + static Thread2filter001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + + static int maxInstr = 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----1"); + methodForCommunication(); + } + try { + thread1.join(); + } catch ( InterruptedException e ) { + } + break; + + + case 1: + thread2 = new Thread2filter001a("thread2"); + + synchronized (lockObj) { + threadStart(thread2); + log1("methodForCommunication();----2"); + methodForCommunication(); + } + try { + thread2.join(); + } catch ( InterruptedException e ) { + } + break; + //------------------------------------------------- standard end section + + case 2: + log1("methodForCommunication();----3"); + methodForCommunication(); + break; + + default: + instruction = end; + break; + } + + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class Thread1filter001a extends Thread { + + class TestClass10{ + void m10() { + throw new NullPointerException("m10"); + } + } + class TestClass11 extends TestClass10{ + void m11() { + + try { + (new TestClass10()).m10(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + + String tName = null; + + public Thread1filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(filter001a.waitnotifyObj) { + filter001a.waitnotifyObj.notify(); + } + synchronized(filter001a.lockObj) { + try { + (new TestClass11()).m11(); + } catch ( NullPointerException e) { + } + } + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter001a extends Thread { + + class TestClass20{ + void m20() { + throw new NullPointerException("m20"); + } + } + class TestClass21 extends TestClass20{ + void m21() { + + try { + (new TestClass20()).m20(); + } catch ( NullPointerException e ) { + } + throw new NullPointerException("m11"); + } + } + + String tName = null; + + public Thread2filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(filter001a.waitnotifyObj) { + filter001a.waitnotifyObj.notify(); + } + synchronized(filter001a.lockObj) { + try { + (new TestClass21()).m21(); + } catch ( NullPointerException e) { + } + } + filter001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002.java new file mode 100644 index 00000000000..5e44ed731bf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002.java @@ -0,0 +1,533 @@ +/* + * 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.StepRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/addClassExclusionFilter/filter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.addClassExclusionFilter.filter002a"; + + private String testedClassName1 = + "nsk.jdi.StepRequest.addClassExclusionFilter.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "StepRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + ThreadReference thread1 = threadByName("main"); + eventRequest1 = setting23StepRequest(thread1, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassExclusionFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassExclusionFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassExclusionFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassExclusionFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassExclusionFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassExclusionFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + Event evt = eventIterator.nextEvent(); + + if (evt instanceof BreakpointEvent) + return; + + log3("Didn't get expected BreakpointEvent, events are:"); + while(true) { + log3(" event = " + evt); + if (!eventIterator.hasNext()) { + break; + } + evt = eventIterator.nextEvent(); + } + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting23StepRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.addCountFilter(1); + str.setSuspendPolicy(suspendPolicy); + str.addClassExclusionFilter(testedClass); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..316c8e6d470 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/StepRequest/addClassExclusionFilter/filter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateStep - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateStep - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassExclusionFilter.filter002; + * the debuggee program - nsk.jdi.StepRequest.addClassExclusionFilter.filter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was modified to fix the bug: + * 4689354 TEST_BUG: StepRequest/addClassExclusionFilter/filter002 misses its purpose + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addClassExclusionFilter.filter002 + * nsk.jdi.StepRequest.addClassExclusionFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassExclusionFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002a.java new file mode 100644 index 00000000000..a3a63231662 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002a.java @@ -0,0 +1,117 @@ +/* + * 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.StepRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter002 JDI test. + */ + +public class filter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001.java new file mode 100644 index 00000000000..d6076960d09 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001.java @@ -0,0 +1,163 @@ +/* + * 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.StepRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * StepRequest. + * + * The test checks that results of the method + * com.sun.jdi.StepRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or + * any of its subtypes. + * The cases to check include Steps in debuggee's four types, + * two in TestClass10 and its sub-class TestClass11, and + * two in TestClass20 and its sub-class TestClass21. + * The filter restricts StepEvent to only TestClass11. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates and starts two threads, thread1 and thread2; + * thread1 will invoke methods in TestClass10 and TestClass11, and + * thread2 in TestClass20 and TestClass21, + * and steps into methods are objects to test; + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes to use to filter StepEvents, + * - sets up StepRequest for the events, + * - restricts the events to those in TestClass10, that is, in thread1, + * - and resumes the debuggee and waits for the events. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.StepRequest.addClassFilter_rt.filter_rt001a"; + return new filter_rt001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.StepRequest.addClassFilter_rt.TestClass11"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + String property1 = "StepRequest1"; + ReferenceType testClassReference = null; + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = (ReferenceType)debuggee.classByName(testedClassName); + thread1 = debuggee.threadByName(threadName1); + if (thread1 == null) + throw new Failure("Cannot get ThreadReference for " + threadName1); + eventRequest1 = setting21StepRequest(thread1, testClassReference, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for StepEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, false); + + if ( !(newEvent instanceof StepEvent)) { + setFailedStatus("ERROR: new event is not StepEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new StepEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((StepEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference.name()); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private StepRequest setting21StepRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up StepRequest:"); + display(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.setSuspendPolicy(suspendPolicy); + str.addClassFilter(testedClass); + str.addCountFilter(1); + + display(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + throw new Failure("FAILURE to set up StepRequest:" + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001/TestDescription.java new file mode 100644 index 00000000000..266dbda3905 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/StepRequest/addClassFilter_rt/filter_rt001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassFilter_rt.filter_rt001; + * the debuggee program - nsk.jdi.StepRequest.addClassFilter_rt.filter_rt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * Modified due to fix of the bug: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addClassFilter_rt.filter_rt001 + * nsk.jdi.StepRequest.addClassFilter_rt.filter_rt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassFilter_rt.filter_rt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001a.java new file mode 100644 index 00000000000..00c25667c33 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001a.java @@ -0,0 +1,223 @@ +/* + * 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.StepRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import nsk.share.jdi.ThreadState; + +/** + * This class is used as debuggee application for the filter_rt001 JDI test. + */ + +public class filter_rt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static final long THREAD_STATE_TIMEOUT_MS = 30000; + static final String STATE_INIT = "init"; + static final String STATE_THREAD_STARTED = "threadStarted"; + static final String STATE_JDI_INITED = "jdiInited"; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt001a thread1 = new Thread1filter_rt001a( + "thread1", new ThreadState(STATE_INIT, THREAD_STATE_TIMEOUT_MS)); + static Thread2filter_rt001a thread2 = new Thread2filter_rt001a( + "thread2", new ThreadState(STATE_INIT, THREAD_STATE_TIMEOUT_MS)); + + static TestClass11 obj = new TestClass11(); + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1.start(); + thread2.start(); + thread1.getThreadState().waitForState(STATE_THREAD_STARTED); + thread2.getThreadState().waitForState(STATE_THREAD_STARTED); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1.getThreadState().setState(STATE_JDI_INITED); + thread2.getThreadState().setState(STATE_JDI_INITED); + waitForThreadJoin ( thread1, "thread1" ); + waitForThreadJoin ( thread2, "thread2" ); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static void waitForThreadJoin (Thread thread, String threadName) { + log1("waiting for " + threadName + " join"); + int waitMs = argHandler.getWaitTime() * 60 * 1000; + if (thread.isAlive()) { + try { + thread.join(waitMs); + } catch (InterruptedException e) { + throw new Failure("catched unexpected InterruptedException while waiting of " + threadName + " join:" + e); + }; + } + if (thread.isAlive()) { + throw new Failure(threadName + " is still alive"); + } else { + log1(threadName + " joined"); + } + } +} + +class TestClass10{ + static void m10() { + filter_rt001a.log1("entered: m10"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + filter_rt001a.log1("entered: m11"); + TestClass10.m10(); + } +} + +class Thread1filter_rt001a extends Thread { + + private String tName = null; + private ThreadState threadState = null; + + public Thread1filter_rt001a(String threadName, ThreadState threadState) { + super(threadName); + tName = threadName; + this.threadState = threadState; + } + + public ThreadState getThreadState() { + return threadState; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + threadState.setAndWait(filter_rt001a.STATE_THREAD_STARTED, filter_rt001a.STATE_JDI_INITED); + TestClass11.m11(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class TestClass20{ + static void m20() { + filter_rt001a.log1("entered: m20"); + } +} +class TestClass21 extends TestClass20{ + static void m21() { + filter_rt001a.log1("entered: m21"); + TestClass20.m20(); + } +} + +class Thread2filter_rt001a extends Thread { + + private String tName = null; + private ThreadState threadState = null; + + public Thread2filter_rt001a(String threadName, ThreadState threadState) { + super(threadName); + tName = threadName; + this.threadState = threadState; + } + + public ThreadState getThreadState() { + return threadState; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + threadState.setAndWait(filter_rt001a.STATE_THREAD_STARTED, filter_rt001a.STATE_JDI_INITED); + TestClass21.m21(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java new file mode 100644 index 00000000000..212abb2fbd5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java @@ -0,0 +1,534 @@ +/* + * 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.StepRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.addClassFilter(ReferenceType)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a filter_rt002aTestClass10 object, to use as a filter,
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002a"; + + private String testedClassName = + "nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "StepRequest1"; + + ReferenceType testClassReference = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = threadByName(threadName1); + + eventRequest1 = setting21StepRequest(thread1, testClassReference, + EventRequest.SUSPEND_NONE, property1); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" no InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testClassReference);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting21StepRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.addCountFilter(2); + str.setSuspendPolicy(suspendPolicy); + str.addClassFilter(testedClass); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002/TestDescription.java new file mode 100644 index 00000000000..51d13582dd8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002/TestDescription.java @@ -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/StepRequest/addClassFilter_rt/filter_rt002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002; + * the debuggee program - nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002 + * nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassFilter_rt.filter_rt002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002a.java new file mode 100644 index 00000000000..b95d34ce1f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt002 JDI test. + */ + +public class filter_rt002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt002a thread1 = null; + + static filter_rt002aTestClass10 obj = new filter_rt002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_rt002a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class filter_rt002aTestClass10{ + static void m10() { + filter_rt002a.log1("entered: m10"); + } +} +class filter_rt002aTestClass11 extends filter_rt002aTestClass10{ + static void m11() { + filter_rt002a.log1("entered: m11"); + filter_rt002aTestClass10.m10(); + } +} + +class Thread1filter_rt002a extends Thread { + + String tName = null; + + public Thread1filter_rt002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(filter_rt002a.waitnotifyObj) { + filter_rt002a.waitnotifyObj.notify(); + } + synchronized(filter_rt002a.lockObj) { + filter_rt002aTestClass11.m11(); + } + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003.java new file mode 100644 index 00000000000..2fb842f790a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003.java @@ -0,0 +1,187 @@ +/* + * 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.StepRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * StepRequest. + * + * The test checks that results of the method + * com.sun.jdi.StepRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to be + * the preparation of the given reference type and any subtypes. + * The cases to test include re-invocations of the method + * addClassFilter() on the same StepRequest object. + * There are two StepRequests to check as follows: + * (1) For StepRequest2, both invocations are with different + * ReferenceTypes restricting one Step event to two classes. + * The test expects no Step event will be received. + * (2) For StepRequest1, both invocations are with the same + * ReferenceType restricting one Step event to one class. + * The test expects this Step event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2; + * thread1 will invoke methods in filter_rt003aTestClass10 and filter_rt003aTestClass11, and + * thread2 in filter_rt003aTestClass20 and filter_rt003aTestClass21, + * and steps into methods are objects to test; + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two StepRequests 1&2, + * - double restricts StepRequest1 to the RefTypes 1 and 1, + * - double restricts StepRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt003 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003a"; + return new filter_rt003().runThis(argv, out); + } + + private String testedClassName11 = + "nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003aTestClass11"; + private String testedClassName21 = + "nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003aTestClass21"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "StepRequest1"; + String property2 = "StepRequest2"; + + ReferenceType testClassReference11 = null; + ReferenceType testClassReference21 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ThreadReference thread2 = null; + String threadName2 = "thread2"; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference11 = (ReferenceType)debuggee.classByName(testedClassName11); + testClassReference21 = (ReferenceType)debuggee.classByName(testedClassName21); + + thread1 = debuggee.threadByName(threadName1); + thread2 = debuggee.threadByName(threadName2); + + eventRequest1 = setting21StepRequest(thread1, testClassReference11, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21StepRequest(thread2, testClassReference11, + EventRequest.SUSPEND_ALL, property2); + + ((StepRequest) eventRequest1).addClassFilter(testClassReference11); + ((StepRequest) eventRequest2).addClassFilter(testClassReference21); + + display("......waiting for StepEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, false); + + if ( !(newEvent instanceof StepEvent)) { + setFailedStatus("ERROR: new event is not StepEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new StepEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + ReferenceType refType = ((StepEvent)newEvent).location().declaringType(); + if (!refType.equals(testClassReference11)) { + setFailedStatus("Received unexpected declaring type of the event: " + refType.name() + + "\n\texpected one: " + testClassReference11.name()); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private StepRequest setting21StepRequest ( ThreadReference thread, + ReferenceType testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up StepRequest:"); + display(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.setSuspendPolicy(suspendPolicy); + str.addClassFilter(testedClass); + str.addCountFilter(1); + + display(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up StepRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003/TestDescription.java new file mode 100644 index 00000000000..270cc11ff5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/StepRequest/addClassFilter_rt/filter_rt003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003; + * the debuggee program - nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4621092 TEST_BUG: filter_rt003 test uses wrong thread synchronization scheme + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * Modified due to fix of the bug: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003 + * nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassFilter_rt.filter_rt003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003a.java new file mode 100644 index 00000000000..77b28d80b9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003a.java @@ -0,0 +1,228 @@ +/* + * 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.StepRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import nsk.share.jdi.ThreadState; + +/** + * This class is used as debuggee application for the filter_rt003 JDI test. + */ + +public class filter_rt003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static final long THREAD_STATE_TIMEOUT_MS = 30000; + static final String STATE_INIT = "init"; + static final String STATE_THREAD_STARTED = "threadStarted"; + static final String STATE_JDI_INITED = "jdiInited"; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt003a thread1 = new Thread1filter_rt003a( + "thread1", new ThreadState(STATE_INIT, THREAD_STATE_TIMEOUT_MS)); + static Thread2filter_rt003a thread2 = new Thread2filter_rt003a( + "thread2", new ThreadState(STATE_INIT, THREAD_STATE_TIMEOUT_MS)); + + static filter_rt003aTestClass11 obj1 = new filter_rt003aTestClass11(); + static filter_rt003aTestClass21 obj2 = new filter_rt003aTestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + thread1.start(); + thread2.start(); + thread1.getThreadState().waitForState(STATE_THREAD_STARTED); + thread2.getThreadState().waitForState(STATE_THREAD_STARTED); + + log1("debuggee started!"); + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + +//------------------------------------------------------ section tested + + case 0: + thread1.getThreadState().setState(STATE_JDI_INITED); + thread2.getThreadState().setState(STATE_JDI_INITED); + waitForThreadJoin ( thread1, "thread1" ); + waitForThreadJoin ( thread2, "thread2" ); + +//------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static void waitForThreadJoin (Thread thread, String threadName) { + log1("waiting for " + threadName + " join"); + + // get internal timeout in minutes for waiting of thread completion. + int waitTime = argHandler.getWaitTime(); + if (thread.isAlive()) { + try { + thread.join(waitTime * 60 * 1000); + } catch (InterruptedException e) { + throw new Failure("catched unexpected InterruptedException while waiting of " + threadName + " join:" + e); + }; + } + if (thread.isAlive()) { + throw new Failure(threadName + " is still alive"); + } else { + log1(threadName + " joined"); + } + } + +} + +class filter_rt003aTestClass10{ + static void m10() { + filter_rt003a.log1("entered: m10"); + } +} +class filter_rt003aTestClass11 extends filter_rt003aTestClass10{ + static void m11() { + filter_rt003a.log1("entered: m11"); + filter_rt003aTestClass10.m10(); + } +} + +class Thread1filter_rt003a extends Thread { + + private String tName = null; + private ThreadState threadState = null; + + public Thread1filter_rt003a(String threadName, ThreadState threadState) { + super(threadName); + tName = threadName; + this.threadState = threadState; + } + + public ThreadState getThreadState() { + return threadState; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + threadState.setAndWait(filter_rt001a.STATE_THREAD_STARTED, filter_rt001a.STATE_JDI_INITED); + filter_rt003aTestClass11.m11(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt003aTestClass20{ + static void m20() { + filter_rt003a.log1("entered: m20"); + } +} +class filter_rt003aTestClass21 extends filter_rt003aTestClass20{ + static void m21() { + filter_rt003a.log1("entered: m21"); + filter_rt003aTestClass20.m20(); + } +} + +class Thread2filter_rt003a extends Thread { + + private String tName = null; + private ThreadState threadState = null; + + public Thread2filter_rt003a(String threadName, ThreadState threadState) { + super(threadName); + tName = threadName; + this.threadState = threadState; + } + + public ThreadState getThreadState() { + return threadState; + } + + public void run() { + filter_rt003a.log1(" 'run': enter :: threadName == " + tName); + threadState.setAndWait(filter_rt001a.STATE_THREAD_STARTED, filter_rt001a.STATE_JDI_INITED); + filter_rt003aTestClass21.m21(); + filter_rt003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001.java new file mode 100644 index 00000000000..4e9e15fb69e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001.java @@ -0,0 +1,187 @@ +/* + * 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.StepRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * StepRequest. + * + * The test checks that results of the method + * com.sun.jdi.StepRequest.addClassFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * + * The test works as follows. + * - The debugger + * - sets up StepRequests 1&2 and restricts them using patterns that + * begin with '*' and end with '*', + * - resumes the debuggee, and waits for expected StepEvent. + * - The debuggee creates and starts two threads, thread1 and thread2, + * which being run, invoke methods used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_s001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.StepRequest.addClassFilter_s.filter_s001a"; + return new filter_s001().runThis(argv, out); + } + + private String testedClassName1 = "TestClass11"; + private String testedClassName2 = "nsk.jdi.StepRequest.addClassFilter_s.Thread2filter_s001a"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "StepRequest1"; + String property2 = "StepRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String threadName1 = "thread1"; + String threadName2 = "thread2"; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + thread1 = debuggee.threadByName(threadName1); + eventRequest1 = setting23StepRequest(thread1, "*" + testedClassName1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting1 for StepEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof StepEvent)) { + setFailedStatus("ERROR: new event is not StepEvent"); + } else { + String str = ((StepEvent)newEvent).location().declaringType().name(); + if (!str.endsWith(testedClassName1)) { + setFailedStatus("Received StepEvent for unexpected class: \n\t" + str); + } else { + display("Received StepEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + case 1: + thread2 = debuggee.threadByName(threadName2); + eventRequest2 = setting23StepRequest(thread2, testedClassName2 + "*", + EventRequest.SUSPEND_ALL, property2); + + display("......waiting2 for StepEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof StepEvent)) { + setFailedStatus("ERROR: new event is not StepEvent"); + } else { + + String str = ((StepEvent)newEvent).location().declaringType().name(); + if (!(str.indexOf(testedClassName2) == 0)) { + setFailedStatus("Received StepEvent for unexpected class: \n\t" + str); + } else { + display("Received StepEvent for expected class: \n\t" + str); + } + + String property = (String) newEvent.request().getProperty("number"); + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private StepRequest setting23StepRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) { + try { + display("......setting up StepRequest:"); + display(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.setSuspendPolicy(suspendPolicy); + str.addClassFilter(testedClass); + + str.addCountFilter(1); + + display(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001/TestDescription.java new file mode 100644 index 00000000000..4d8f3393ca6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001/TestDescription.java @@ -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/StepRequest/addClassFilter_s/filter_s001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassFilter() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name matches + * a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateStep - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. e.g. "java.*" or "*.Foo". + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassFilter_s.filter_s001; + * the debuggee program - nsk.jdi.StepRequest.addClassFilter_s.filter_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addClassFilter_s.filter_s001 + * nsk.jdi.StepRequest.addClassFilter_s.filter_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassFilter_s.filter_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001a.java new file mode 100644 index 00000000000..1f7fea330d8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001a.java @@ -0,0 +1,226 @@ +/* + * 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.StepRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s001 JDI test. + */ + +public class filter_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s001a thread1 = null; + static Thread2filter_s001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----1"); + methodForCommunication(); + } + try { + thread1.join(); + } catch ( InterruptedException e ) { + } + break; + + + case 1: + thread2 = new Thread2filter_s001a("thread2"); + + synchronized (lockObj) { + threadStart(thread2); + log1("methodForCommunication();----2"); + methodForCommunication(); + } + try { + thread2.join(); + } catch ( InterruptedException e ) { + } + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); +// methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + static void m10() { + filter_s001a.log1("entered: m10"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + filter_s001a.log1("entered: m11"); + TestClass10.m10(); + } +} + +class Thread1filter_s001a extends Thread { + + String tName = null; + + public Thread1filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(filter_s001a.waitnotifyObj) { + filter_s001a.waitnotifyObj.notify(); + } + synchronized(filter_s001a.lockObj) { + TestClass11.m11(); + } + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter_s001a extends Thread { + + static class TestClass20{ + static void m20() { + filter_s001a.log1("entered: m20"); + } + } + static class TestClass21 extends TestClass20{ + static void m21() { + filter_s001a.log1("entered: m20"); + TestClass20.m20(); + } + } + + String tName = null; + + public Thread2filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(filter_s001a.waitnotifyObj) { + filter_s001a.waitnotifyObj.notify(); + } + synchronized(filter_s001a.lockObj) { + TestClass21.m21(); + } + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java new file mode 100644 index 00000000000..2b179b531f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java @@ -0,0 +1,527 @@ +/* + * 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.StepRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.addClassFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates and starts a thread, thread1, and
    + * invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a StepRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/addClassFilter_s/filter_s002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.addClassFilter_s.filter_s002a"; + + private String testedClassName1 = + "nsk.jdi.StepRequest.addClassFilter_s.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + String property1 = "StepRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + ThreadReference thread1 = threadByName("thread1"); + eventRequest1 = setting23StepRequest(thread1, testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting23StepRequest ( ThreadReference thread, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.setSuspendPolicy(suspendPolicy); + str.addClassFilter(testedClass); + +// str.addCountFilter(1); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002/TestDescription.java new file mode 100644 index 00000000000..cfc2c1e536b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002/TestDescription.java @@ -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/StepRequest/addClassFilter_s/filter_s002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addClassFilter() + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose method is in a class whose name does not match + * this restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateStep - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateStep - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addClassFilter_s.filter_s002; + * the debuggee program - nsk.jdi.StepRequest.addClassFilter_s.filter_s002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.addClassFilter_s.filter_s002 + * nsk.jdi.StepRequest.addClassFilter_s.filter_s002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addClassFilter_s.filter_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002a.java new file mode 100644 index 00000000000..d8524596ea8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002a.java @@ -0,0 +1,194 @@ +/* + * 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.StepRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s002 JDI test. + */ + +public class filter_s002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s002a thread1 = null; + + static TestClass objTC = new TestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s002a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Thread1filter_s002a extends Thread { + + String tName = null; + int tNumber; + + public Thread1filter_s002a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + + synchronized (lockObj) { +// log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); +// objTC[tNumber].method(); + } + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001.java new file mode 100644 index 00000000000..dbf11610f18 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001.java @@ -0,0 +1,196 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * StepRequest. + * + * The test checks that results of the method + * com.sun.jdi.StepRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is the object specified. + * The cases to test include invocations of the method addInstanceFilter() on + * two StepRequest objects with different array element (instances) arguments. + * (1) For StepRequest2, a testing thread will not execute an ObjectRefernce + * instance used as the filter; + * hence, the test expects this Step event will not be received. + * (2) For StepRequest1, a testing thread will do execute an ObjectRefernce + * instance used as the filter; + * hence, the test expects this Step event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a StepRequest within the method + * within the method in the class TestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordingly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the Watchpoint event only to thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.StepRequest.addInstanceFilter.instancefilter001a"; + return new instancefilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.StepRequest.addInstanceFilter.TestClass"; + + + protected void testRun() { + + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "StepRequest1"; + String property2 = "StepRequest2"; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + eventRequest1 = setting2StepRequest (thread1, + EventRequest.SUSPEND_ALL, property1); + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + ((StepRequest) eventRequest1).addInstanceFilter(instance1); + + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + eventRequest2 = setting2StepRequest (thread2, + EventRequest.SUSPEND_ALL, property2); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + ((StepRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for StepEvent in expected thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof StepEvent)) { + setFailedStatus("ERROR: new event is not StepEvent"); + throw new Failure("** unexpected event **"); + } else { + Location location = ((StepEvent) newEvent).location(); + StepRequest stepR = (StepRequest) newEvent.request(); + String property = (String) stepR.getProperty("number"); + display(" got new StepEvent with property 'number' == " + property); + display(" thread name == " + stepR.thread().name()); + display(" size == " + stepR.size() + "; depth == " + stepR.depth()); + display(" lineNumber == " + location.lineNumber()); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private StepRequest setting2StepRequest ( ThreadReference thread, + int suspendPolicy, + String property ) + throws Failure { + try { + display("......setting up StepRequest:"); + display(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.setSuspendPolicy(suspendPolicy); + + display(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up StepRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001/TestDescription.java new file mode 100644 index 00000000000..b344f1a4cd8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001/TestDescription.java @@ -0,0 +1,94 @@ +/* + * 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/StepRequest/addInstanceFilter/instancefilter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test include invocations of the method addInstanceFilter() on + * two StepRequest objects with defferent array element (instances) arquments. + * (1) For StepRequest2, a testing thread will not execute an ObjectRefernce + * instance used as the filter; + * hence, the test expects this Step event will not be received. + * (2) For StepRequest1, a testing thread will do execute an ObjectRefernce + * instance used as the filter; + * hence, the test expects this Step event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * Modified due to fix of the bug: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addInstanceFilter.instancefilter001 + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001a.java new file mode 100644 index 00000000000..78ddc3b90bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001a.java @@ -0,0 +1,200 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter001 JDI test. + */ + +public class instancefilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter001a thread1 = null; + static Threadinstancefilter001a thread2 = null; + + static TestClass objTC[] = { new TestClass(), new TestClass(), new TestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter001a("thread1"); + thread2 = new Threadinstancefilter001a("thread2"); + + synchronized (lockObj) { + threadStart(thread1); + threadStart(thread2); + log1("methodForCommunication();----"); + methodForCommunication(); + } + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter001a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter001a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + + synchronized (lockObj) { +// log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002.java new file mode 100644 index 00000000000..e486da70739 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002.java @@ -0,0 +1,552 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a StepRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/addInstanceFilter/instancefilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.addInstanceFilter.instancefilter002a"; + + private String testedClassName = + "nsk.jdi.StepRequest.addInstanceFilter.instancefilter002aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "StepRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2StepRequest (thread1, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + ((StepRequest) eventRequest1).addInstanceFilter(instance); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((StepRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((StepRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting2StepRequest ( ThreadReference thread, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.addCountFilter(2); + str.setSuspendPolicy(suspendPolicy); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002/TestDescription.java new file mode 100644 index 00000000000..1dd74774f6d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/StepRequest/addInstanceFilter/instancefilter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter002; + * the debuggee program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addInstanceFilter.instancefilter002 + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002a.java new file mode 100644 index 00000000000..cb18be123a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002a.java @@ -0,0 +1,197 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter002 JDI test. + */ + +public class instancefilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter002a thread1 = null; + + static instancefilter002aTestClass objTC[] = { new instancefilter002aTestClass(), new instancefilter002aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter002a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter002a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter002a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + objTC[0].method(); + objTC[1].method(); + } + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter002aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003.java new file mode 100644 index 00000000000..0e4b3eb7b34 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003.java @@ -0,0 +1,519 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException -
    + * if the target virtual machine
    + * does not support this operation.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * a BreakpointRequest and if addInstanceFilter() is not supported,
    + * invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/addInstanceFilter/instancefilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.addInstanceFilter.instancefilter003a"; + + private String testedClassName = + "nsk.jdi.StepRequest.addInstanceFilter.instancefilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "StepRequest1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2StepRequest (thread1, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((StepRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting2StepRequest ( ThreadReference thread, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.addCountFilter(2); + str.setSuspendPolicy(suspendPolicy); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003/TestDescription.java new file mode 100644 index 00000000000..9b1f07d0887 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/StepRequest/addInstanceFilter/instancefilter003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter003; + * the debuggee program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addInstanceFilter.instancefilter003 + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003a.java new file mode 100644 index 00000000000..01669e2d5ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003a.java @@ -0,0 +1,197 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter003 JDI test. + */ + +public class instancefilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter003a thread1 = null; + + static instancefilter003aTestClass objTC[] = { new instancefilter003aTestClass(), new instancefilter003aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter003a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter003a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter003a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + objTC[0].method(); + objTC[1].method(); + } + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter003aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004.java new file mode 100644 index 00000000000..76d6ace6d38 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004.java @@ -0,0 +1,197 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * StepRequest. + * + * The test checks that results of the method + * com.sun.jdi.StepRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * The case to test includes re-invocation of the method + * addInstanceFilter() on the same StepRequest object. + * There are two StepRequests to check as follows: + * (1) For StepRequest2, both invocations are with different + * ObjectReferences restricting one Step event to two objects. + * The test expects no Step event will be received. + * (2) For StepRequest1, both invocations are with the same + * ObjectReference restricting one Step event to one object. + * The test expects this Step event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with two instances for testing, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up StepRequests 1&2 within the method + * in the class instancefilter004aTestClass which will be calling by both threads, + * - restricts the StepRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the StepRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.StepRequest.addInstanceFilter.instancefilter004a"; + return new instancefilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.StepRequest.addInstanceFilter.instancefilter004aTestClass"; + + protected void testRun() { + + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "StepRequest1"; + String property2 = "StepRequest2"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = (ReferenceType)debuggee.classByName(testedClassName); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2StepRequest (thread1, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2StepRequest (thread2, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((StepRequest) eventRequest1).addInstanceFilter(instance1); + ((StepRequest) eventRequest1).addInstanceFilter(instance1); + ((StepRequest) eventRequest2).addInstanceFilter(instance1); + ((StepRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for StepEvent in expected thread"); + StepEvent newEvent = (StepEvent)eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + EventRequest newEventRequest = newEvent.request(); + if ( newEventRequest.equals(eventRequest1) ) { + display(" received expected event: " + newEvent); + + ThreadReference newEventThread = newEvent.thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private StepRequest setting2StepRequest ( ThreadReference thread, + int suspendPolicy, + String property ) { + try { + display("......setting up StepRequest:"); + display(" thread: " + thread + "; property: " + property); + + StepRequest + str = eventRManager.createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + str.putProperty("number", property); + str.setSuspendPolicy(suspendPolicy); + + display(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up StepRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004/TestDescription.java new file mode 100644 index 00000000000..6009d693563 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/StepRequest/addInstanceFilter/instancefilter004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same StepRequest object. + * There are two StepRequests to check as follows: + * (1) For StepRequest2, both invocations are with different + * ObjectReferences restricting one Step event to two objects. + * The test expects no Step event will be received. + * (2) For StepRequest1, both invocations are with the same + * ObjectReference restricting one Step event to one object. + * The test expects this Step event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.StepRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4687906 TEST_BUG: some tests for jdi StepRequest are invalid + * Modified due to fix of the bug: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.StepRequest.addInstanceFilter.instancefilter004 + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.addInstanceFilter.instancefilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004a.java new file mode 100644 index 00000000000..fd068b59960 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004a.java @@ -0,0 +1,200 @@ +/* + * 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.StepRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter004 JDI test. + */ + +public class instancefilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter004a thread1 = null; + static Threadinstancefilter004a thread2 = null; + + static instancefilter004aTestClass objTC[] = { new instancefilter004aTestClass(), new instancefilter004aTestClass(), new instancefilter004aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter004a("thread1"); + thread2 = new Threadinstancefilter004a("thread2"); + + synchronized (lockObj) { + threadStart(thread1); + threadStart(thread2); + log1("methodForCommunication();---2"); + methodForCommunication(); + } + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + + synchronized (lockObj) { +// log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter004aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java new file mode 100644 index 00000000000..38eaf7aff0f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java @@ -0,0 +1,496 @@ +/* + * 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.StepRequest.depth; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.depth()
    + * complies with its spec.
    + *
    + * The test checks if an int value StepRequest.STEP_INTO,
    + * an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(),
    + * is equal to one returned by the method StepRequest.depth()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a tested thread
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest with the depth StepRequest.STEP_INTO,
    + * - gets the depth of the Request with the method StepRequest.depth(),
    + * - and compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class depth001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/depth/depth001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new depth001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.depth.depth001a"; + + private String testedClassName = + "nsk.jdi.StepRequest.depth.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + int depth; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest with depth StepRequest.STEP_INTO"); + eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + log2("......getting: depth = ((StepRequest) eventRequest1).depth();"); + depth = ((StepRequest) eventRequest1).depth(); + + log2(" checking up on equality of values"); + if ( depth != StepRequest.STEP_INTO ) { + testExitCode = FAILED; + log3("ERROR: depth() != StepRequest.STEP_INTO : " + depth); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting24StepRequest ( ThreadReference thread, + int size, + int depth ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; size: " + size + "; depth: " + depth); + + StepRequest + str = eventRManager.createStepRequest(thread, size, depth); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001/TestDescription.java new file mode 100644 index 00000000000..ea834f2436b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001/TestDescription.java @@ -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/StepRequest/depth/depth001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.depth() + * complies with its spec: + * public int depth() + * Returns: the step depth + * The test checks if an int value StepRequest.STEP_INTO, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(), + * is equal to one returned by the method StepRequest.depth() + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.depth.depth001; + * the debuggee program - nsk.jdi.StepRequest.depth.depth001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.depth.depth001 + * nsk.jdi.StepRequest.depth.depth001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.depth.depth001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001a.java new file mode 100644 index 00000000000..fb2f80fd26f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.depth; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the depth001 JDI test. + */ + +public class depth001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1depth001a thread1 = null; + + static TestClass10 obj = new TestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1depth001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + static void m10() { + depth001a.log1("entered: m10"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + depth001a.log1("entered: m11"); + TestClass10.m10(); + } +} + +class Thread1depth001a extends Thread { + + String tName = null; + + public Thread1depth001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + depth001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(depth001a.waitnotifyObj) { + depth001a.waitnotifyObj.notify(); + } + synchronized(depth001a.lockObj) { + TestClass11.m11(); + } + depth001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java new file mode 100644 index 00000000000..967e47982cb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java @@ -0,0 +1,496 @@ +/* + * 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.StepRequest.depth; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.depth()
    + * complies with its spec.
    + *
    + * The test checks if an int value StepRequest.STEP_OVER,
    + * an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(),
    + * is equal to one returned by the method StepRequest.depth()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a tested thread
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest with the depth StepRequest.STEP_OVER,
    + * - gets the depth of the Request with the method StepRequest.depth(),
    + * - and compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class depth002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/depth/depth002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new depth002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.depth.depth002a"; + + private String testedClassName = + "nsk.jdi.StepRequest.depth.depth002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + int depth; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest with depth StepRequest.STEP_OVER"); + eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, + StepRequest.STEP_OVER); + + log2("......getting: depth = ((StepRequest) eventRequest1).depth();"); + depth = ((StepRequest) eventRequest1).depth(); + + log2(" checking up on equality of values"); + if ( depth != StepRequest.STEP_OVER ) { + testExitCode = FAILED; + log3("ERROR: depth() != StepRequest.STEP_OVER : " + depth); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting24StepRequest ( ThreadReference thread, + int size, + int depth ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; size: " + size + "; depth: " + depth); + + StepRequest + str = eventRManager.createStepRequest(thread, size, depth); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002/TestDescription.java new file mode 100644 index 00000000000..b797f895a48 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002/TestDescription.java @@ -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/StepRequest/depth/depth002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.depth() + * complies with its spec: + * public int depth() + * Returns: the step depth + * The test checks if an int value StepRequest.STEP_OVER, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(), + * is equal to one returned by the method StepRequest.depth() + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.depth.depth002; + * the debuggee program - nsk.jdi.StepRequest.depth.depth002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.depth.depth002 + * nsk.jdi.StepRequest.depth.depth002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.depth.depth002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002a.java new file mode 100644 index 00000000000..2c50eebb83c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.depth; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the depth002 JDI test. + */ + +public class depth002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1depth002a thread1 = null; + + static depth002aTestClass10 obj = new depth002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1depth002a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class depth002aTestClass10{ + static void m10() { + depth002a.log1("entered: m10"); + } +} +class depth002aTestClass11 extends depth002aTestClass10{ + static void m11() { + depth002a.log1("entered: m11"); + depth002aTestClass10.m10(); + } +} + +class Thread1depth002a extends Thread { + + String tName = null; + + public Thread1depth002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + depth002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(depth002a.waitnotifyObj) { + depth002a.waitnotifyObj.notify(); + } + synchronized(depth002a.lockObj) { + depth002aTestClass11.m11(); + } + depth002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java new file mode 100644 index 00000000000..6c47720eaa8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java @@ -0,0 +1,496 @@ +/* + * 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.StepRequest.depth; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.depth()
    + * complies with its spec.
    + *
    + * The test checks if an int value StepRequest.STEP_OUT,
    + * an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(),
    + * is equal to one returned by the method StepRequest.depth()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a tested thread
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest with the depth StepRequest.STEP_OUT,
    + * - gets the depth of the Request with the method StepRequest.depth(),
    + * - and compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class depth003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/depth/depth003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new depth003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.depth.depth003a"; + + private String testedClassName = + "nsk.jdi.StepRequest.depth.depth003aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + int depth; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest with depth StepRequest.STEP_OUT"); + eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, + StepRequest.STEP_OUT); + + log2("......getting: depth = ((StepRequest) eventRequest1).depth();"); + depth = ((StepRequest) eventRequest1).depth(); + + log2(" checking up on equality of values"); + if ( depth != StepRequest.STEP_OUT ) { + testExitCode = FAILED; + log3("ERROR: depth() != StepRequest.STEP_OUT : " + depth); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting24StepRequest ( ThreadReference thread, + int size, + int depth ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; size: " + size + "; depth: " + depth); + + StepRequest + str = eventRManager.createStepRequest(thread, size, depth); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003/TestDescription.java new file mode 100644 index 00000000000..8c6b0f6ad4e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003/TestDescription.java @@ -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/StepRequest/depth/depth003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.depth() + * complies with its spec: + * public int depth() + * Returns: the step depth + * The test checks if an int value StepRequest.STEP_OUT, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(), + * is equal to one returned by the method StepRequest.depth() + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.depth.depth003; + * the debuggee program - nsk.jdi.StepRequest.depth.depth003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.depth.depth003 + * nsk.jdi.StepRequest.depth.depth003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.depth.depth003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003a.java new file mode 100644 index 00000000000..e30a1de8747 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.depth; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the depth003 JDI test. + */ + +public class depth003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1depth003a thread1 = null; + + static depth003aTestClass10 obj = new depth003aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1depth003a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class depth003aTestClass10{ + static void m10() { + depth003a.log1("entered: m10"); + } +} +class depth003aTestClass11 extends depth003aTestClass10{ + static void m11() { + depth003a.log1("entered: m11"); + depth003aTestClass10.m10(); + } +} + +class Thread1depth003a extends Thread { + + String tName = null; + + public Thread1depth003a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + depth003a.log1(" 'run': enter :: threadName == " + tName); + synchronized(depth003a.waitnotifyObj) { + depth003a.waitnotifyObj.notify(); + } + synchronized(depth003a.lockObj) { + depth003aTestClass11.m11(); + } + depth003a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java new file mode 100644 index 00000000000..3485153b8f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java @@ -0,0 +1,496 @@ +/* + * 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.StepRequest.size; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.size()
    + * complies with its spec.
    + *
    + * The test checks if an int value StepRequest.STEP_MIN,
    + * an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(),
    + * is equal to one returned by the method StepRequest.size()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a tested thread
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest with the size StepRequest.STEP_MIN,
    + * - gets the size of the Request with the method StepRequest.size(),
    + * - and compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class size001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/size/size001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new size001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.size.size001a"; + + private String testedClassName = + "nsk.jdi.StepRequest.size.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + int size; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest with size StepRequest.STEP_MIN"); + eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_MIN, + StepRequest.STEP_INTO); + + log2("......getting: size = ((StepRequest) eventRequest1).size();"); + size = ((StepRequest) eventRequest1).size(); + + log2(" checking up on equality of values"); + if ( size != StepRequest.STEP_MIN ) { + testExitCode = FAILED; + log3("ERROR: size() != StepRequest.STEP_MIN : " + size); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting24StepRequest ( ThreadReference thread, + int size, + int depth ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; size: " + size + "; depth: " + depth); + + StepRequest + str = eventRManager.createStepRequest(thread, size, depth); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001/TestDescription.java new file mode 100644 index 00000000000..5e22a8f192f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001/TestDescription.java @@ -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/StepRequest/size/size001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.size() + * complies with its spec: + * public int size() + * Returns: the step size + * The test checks if an int value StepRequest.STEP_MIN, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(), + * is equal to one returned by the method StepRequest.size() + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.size.size001; + * the debuggee program - nsk.jdi.StepRequest.size.size001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.size.size001 + * nsk.jdi.StepRequest.size.size001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.size.size001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001a.java new file mode 100644 index 00000000000..70b4f0910b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.size; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the size001 JDI test. + */ + +public class size001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1size001a thread1 = null; + + static TestClass10 obj = new TestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1size001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + static void m10() { + size001a.log1("entered: m10"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + size001a.log1("entered: m11"); + TestClass10.m10(); + } +} + +class Thread1size001a extends Thread { + + String tName = null; + + public Thread1size001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + size001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(size001a.waitnotifyObj) { + size001a.waitnotifyObj.notify(); + } + synchronized(size001a.lockObj) { + TestClass11.m11(); + } + size001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java new file mode 100644 index 00000000000..72ea53da199 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java @@ -0,0 +1,496 @@ +/* + * 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.StepRequest.size; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.size()
    + * complies with its spec.
    + *
    + * The test checks if an int value StepRequest.STEP_LINE,
    + * an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(),
    + * is equal to one returned by the method StepRequest.size()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a tested thread
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest with the size StepRequest.STEP_LINE,
    + * - gets the size of the Request with the method StepRequest.size(),
    + * - and compares the values.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class size002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/size/size002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new size002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.size.size002a"; + + private String testedClassName = + "nsk.jdi.StepRequest.size.size002aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + int size; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest with size StepRequest.STEP_LINE"); + eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + log2("......getting: size = ((StepRequest) eventRequest1).size();"); + size = ((StepRequest) eventRequest1).size(); + + log2(" checking up on equality of values"); + if ( size != StepRequest.STEP_LINE ) { + testExitCode = FAILED; + log3("ERROR: size() != StepRequest.STEP_LINE : " + size); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting24StepRequest ( ThreadReference thread, + int size, + int depth ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; size: " + size + "; depth: " + depth); + + StepRequest + str = eventRManager.createStepRequest(thread, size, depth); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002/TestDescription.java new file mode 100644 index 00000000000..e7d6e2d19cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002/TestDescription.java @@ -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/StepRequest/size/size002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.size() + * complies with its spec: + * public int size() + * Returns: the step size + * The test checks if an int value StepRequest.STEP_LINE, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(), + * is equal to one returned by the method StepRequest.size() + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.size.size002; + * the debuggee program - nsk.jdi.StepRequest.size.size002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.size.size002 + * nsk.jdi.StepRequest.size.size002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.size.size002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002a.java new file mode 100644 index 00000000000..924cbea53c8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.size; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the size002 JDI test. + */ + +public class size002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1size002a thread1 = null; + + static size002aTestClass10 obj = new size002aTestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1size002a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class size002aTestClass10{ + static void m10() { + size002a.log1("entered: m10"); + } +} +class size002aTestClass11 extends size002aTestClass10{ + static void m11() { + size002a.log1("entered: m11"); + size002aTestClass10.m10(); + } +} + +class Thread1size002a extends Thread { + + String tName = null; + + public Thread1size002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + size002a.log1(" 'run': enter :: threadName == " + tName); + synchronized(size002a.waitnotifyObj) { + size002a.waitnotifyObj.notify(); + } + synchronized(size002a.lockObj) { + size002aTestClass11.m11(); + } + size002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java new file mode 100644 index 00000000000..d70f1a748d8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java @@ -0,0 +1,497 @@ +/* + * 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.StepRequest.thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StepRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.StepRequest.thread()
    + * complies with its spec.
    + *
    + * The test checks if a ThreadReference object,
    + * an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(),
    + * is equal to one returned by the method StepRequest.thread()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates a tested thread
    + * and invokes the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an StepRequest with the thread1,
    + * - gets the thread of the Request, the thread2,
    + * with the method StepRequest.thread(),
    + * - and compares the objects thrtead1 and thread2.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class thread001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StepRequest/thread/thread001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new thread001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StepRequest.thread.thread001a"; + + private String testedClassName = + "nsk.jdi.StepRequest.thread.TestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String threadName1 = "thread1"; + + ThreadReference thread2; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = threadByName(threadName1); + + log2("......setting up StepRequest with size StepRequest.STEP_MIN"); + eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_MIN, + StepRequest.STEP_INTO); + + log2("......getting: size = ((StepRequest) eventRequest1).thread();"); + thread2 = ((StepRequest) eventRequest1).thread(); + + log2(" checking up on equality of values"); + if ( !thread2.equals(thread1) ) { + testExitCode = FAILED; + log3("ERROR: !thread2.equals(thread1) : " + thread2); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private StepRequest setting24StepRequest ( ThreadReference thread, + int size, + int depth ) + throws JDITestRuntimeException { + try { + log2("......setting up StepRequest:"); + log2(" thread: " + thread + "; size: " + size + "; depth: " + depth); + + StepRequest + str = eventRManager.createStepRequest(thread, size, depth); + + log2(" StepRequest has been set up"); + return str; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingStepRequest() : " + e); + log3(" StepRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..1f128a2bec5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001/TestDescription.java @@ -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/StepRequest/thread/thread001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StepRequest. + * The test checks up that a result of the method + * com.sun.jdi.StepRequest.thread() + * complies with its spec: + * public ThreadReference thread() + * Returns: the thread on which the step event is being requested. + * The test checks if a ThreadReference object, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(), + * is equal to one returned by the method StepRequest.thread() + * The test works as follows: + * The debugger program - nsk.jdi.StepRequest.thread.thread001; + * the debuggee program - nsk.jdi.StepRequest.thread.thread001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.StepRequest.thread.thread001 + * nsk.jdi.StepRequest.thread.thread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StepRequest.thread.thread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001a.java new file mode 100644 index 00000000000..60b1e602032 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001a.java @@ -0,0 +1,179 @@ +/* + * 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.StepRequest.thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the thread001 JDI test. + */ + +public class thread001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1thread001a thread1 = null; + + static TestClass10 obj = new TestClass10(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1thread001a("thread1"); + + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();----"); + methodForCommunication(); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } +} + +class TestClass10{ + static void m10() { + thread001a.log1("entered: m10"); + } +} +class TestClass11 extends TestClass10{ + static void m11() { + thread001a.log1("entered: m11"); + TestClass10.m10(); + } +} + +class Thread1thread001a extends Thread { + + String tName = null; + + public Thread1thread001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + thread001a.log1(" 'run': enter :: threadName == " + tName); + synchronized(thread001a.waitnotifyObj) { + thread001a.waitnotifyObj.notify(); + } + synchronized(thread001a.lockObj) { + TestClass11.m11(); + } + thread001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001.java new file mode 100644 index 00000000000..624f11b221c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001.java @@ -0,0 +1,139 @@ +/* + * 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.StringArgument.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; + + +/** + * The test for the implementation of an object of the type
    + * Connector.StringArgument.
    + *
    + * The test checks up that a result of the method
    + * com.sun.jdi.connect.Connector.StringArgument.isValid()
    + * complies with its specification:
    + * "Returns: true always"
    + * when parameters are empty and non-empty strings.
    + *
    + * In case of the method does set the value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.StringArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.StringArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.StringArgument 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.StringArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with StringArgument found\n"); + return exitCode0; + } + } + + if (!argument.isValid("")) { + exitCode = exitCode2; + out.println(sErr2 + + "case: parameter == empty string\n" + + "error: return value != true\n"); + } + + if (!argument.isValid("0")) { + exitCode = exitCode2; + out.println(sErr2 + + "case: parameter == non-empty string\n" + + "error: return value != true\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001/TestDescription.java new file mode 100644 index 00000000000..d94cdd5eaa9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001/TestDescription.java @@ -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/StringArgument/isValid/isvalid001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.StringArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.StringArgument.isValid() + * complies with its specification: + * "Returns: true always" + * when parameters are empty and non-empty strings. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.StringArgument object is searched among + * Arguments of 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.isValid("")) or (!argument.isValid("0")) + * 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.StringArgument.isValid.isvalid001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StringArgument.isValid.isvalid001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002.java new file mode 100644 index 00000000000..ea4d3f248fa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002.java @@ -0,0 +1,140 @@ +/* + * 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.StringArgument.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; + + +/** + * The test for the implementation of an object of the type
    + * Connector.StringArgument.
    + *
    + * The test checks up that a result of the method
    + * com.sun.jdi.connect.Connector.StringArgument.isValid()
    + * complies with its specification:
    + * "Returns: true always"
    + * when parameter is null.
    + *
    + * In case of the method does set the value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.StringArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.StringArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.StringArgument 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.StringArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != null) { + break ; + } + } catch ( NoSuchElementException e) { + out.println(sErr1 + + "no Connector with StringArgument found\n"); + return exitCode0; + } + } + + try { + if (!argument.isValid(null)) { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(null)\n" + +// + "error: returned value != true\n"); + } + } catch ( NullPointerException e ) { + exitCode = exitCode2; + out.println(sErr2 + + "check: isValid(null)\n" + + "error: NullPointerException\n"); + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002/TestDescription.java new file mode 100644 index 00000000000..47fbc0809d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002/TestDescription.java @@ -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/StringArgument/isValid/isvalid002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.StringArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.StringArgument.isValid() + * complies with its specification: + * "Returns: true always" + * when parameter is the null-value. + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - First Connector.StringArgument object is searched among + * Arguments of 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.isValid(null) + * 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.StringArgument.isValid.isvalid002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StringArgument.isValid.isvalid002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003.java new file mode 100644 index 00000000000..923db27d78a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003.java @@ -0,0 +1,141 @@ +/* + * 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.StringArgument.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; + + +/** + * The test for the implementation of an object of the type
    + * Connector.StringArgument.
    + *
    + * The test checks up that a result of the method
    + * com.sun.jdi.connect.Connector.StringArgument.isValid()
    + * complies with its specification:
    + * "Returns: true always"
    + * when parameter is a null-string.
    + *
    + * In case of the method does set the value,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +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.StringArgument.isValid\n" ; +// + String sErr2 = "ERROR\n" + + "Method tested: " + + "jdi.Connector.StringArgument.isValid\n" ; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + List connectorsList = vmm.allConnectors(); + Iterator connectorsListIterator = connectorsList.iterator(); +// + Connector.StringArgument 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.StringArgument) + defaultArguments.get(argName); + break ; + } catch ( ClassCastException e) { + } + } catch ( NoSuchElementException e) { + break ; + } + } + if (argument != 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; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003/TestDescription.java new file mode 100644 index 00000000000..291d133a546 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003/TestDescription.java @@ -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/StringArgument/isValid/isvalid003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.StringArgument. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.StringArgument.isValid() + * complies with its specification: + * "Returns: true always" + * when parameter is the 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 argument is found out the test exits + * with the return value = 95 and a warning message. + * - The following checks are 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.StringArgument.isValid.isvalid003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StringArgument.isValid.isvalid003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001.java new file mode 100644 index 00000000000..85207ce0e77 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001.java @@ -0,0 +1,271 @@ +/* + * 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.StringReference.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * StringReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.StringReference.value()
    + * complies with its spec regarding the following requirement:
    + * "Returns the StringReference as a String.
    + * The returned string is the equivalent of the mirrored string,
    + * but is an entity in the client VM and can be manipulated
    + * like any other string."
    + *
    + * The test checks up that a returned string is the equivalent
    + * of the mirrored string.
    + *
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/StringReference/value/value001", + sHeader2 = "--> value001: ", + sHeader3 = "##> value001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.StringReference.value.value001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + static StringReference str_ref = null; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("value001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String classForCheckName = + "nsk.jdi.StringReference.value.ClassForCheck"; + + List listOfDebuggeeLoadedClasses = + vm.classesByName(classForCheckName); +/* + if (listOfDebuggeeLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeLoadedClasses.size() != 1 " + + listOfDebuggeeLoadedClasses.size()); + break ; + } +*/ + ReferenceType testClass = + (ReferenceType) listOfDebuggeeLoadedClasses.get(0); + + Field fstr = null; + + try { + fstr = testClass.fieldByName("str"); + } catch ( ClassNotPreparedException e) { + testExitCode = FAILED; + log3("ERROR: 'fstr = testClass.fieldByName' throws " + + "ClassNotPreparedException"); + break ; + } catch ( ObjectCollectedException e) { + testExitCode = FAILED; + log3("ERROR: 'fstr = testClass.fieldByName' throws " + + "ObjectCollectedException"); + break ; + } + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: + try { + str_ref = (StringReference) testClass.getValue(fstr); + log2(" : 1st str_ref = testClass.getValue(fstr) " + + "doesn't throws ObjectCollectedException"); + if (str_ref.value().compareTo("abc") != 0) { + log3("ERROR: strings are not equal"); + expresult = 1; + break ; + } + } catch ( ObjectCollectedException e ) { + log3("ERROR: 1st str_ref = testClass.getValue(fstr) " + + "does throws ObjectCollectedException"); + expresult = 1; + break ; + } + + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: debuggee's reply is not 'docontinue'"); + expresult = 1; + break ; + } + + try { + str_ref = (StringReference) testClass.getValue(fstr); + log2(" : 2nd str_ref = testClass.getValue(fstr) " + + "doesn't throws ObjectCollectedException"); + } catch ( ObjectCollectedException e ) { + log3("ERROR: 2nd str_ref = testClass.getValue(fstr) " + + "does throws ObjectCollectedException"); + expresult = 1; + } + break ; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001/TestDescription.java new file mode 100644 index 00000000000..2ef3883b279 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/StringReference/value/value001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * StringReference. + * The test checks up that a result of the method + * com.sun.jdi.StringReference.value() + * complies with its spec: + * public java.lang.String value() + * Returns the StringReference as a String. + * The returned string is the equivalent of the mirrored string, + * but is an entity in the client VM and can be manipulated + * like any other string. + * Returns: the string value. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * Note. The test doesn't check up the following: + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * The test works as follows: + * A debugger program - nsk.jdi.StringReference.value.value001; + * a debuggee program - nsk.jdi.StringReference.value.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.StringReference.value.value001 + * nsk.jdi.StringReference.value.value001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.StringReference.value.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001a.java new file mode 100644 index 00000000000..8c8caf1fdc4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StringReference/value/value001a.java @@ -0,0 +1,144 @@ +/* + * 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.StringReference.value; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * This class is used as debuggee application for the value001a JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> value001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> value001a: " + message); + } + + //====================================================== test program + //................................................... globals for a debugger + + static ClassForCheck class1 = null; + + //.................................................... + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = new value001a().runThis(argv, System.out); + + System.exit(result + PASS_BASE); + } + + + private static int runThis (String argv[], PrintStream out) { + + for (int i=0; i"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // resume debuggee suspended at start up + log.display("Resuming debuggee"); + debuggee.resume(); + + // perform the test, catch exceptions and finally quit debuggee + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // create and enable event request + log.display("Creating request for ClassPrepareEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + if ((checkedRequest = erManager.createThreadDeathRequest()) == null) { + log.complain("TEST BUG: unable to create createThreadDeathRequest"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return thread001.FAILED; + } + checkedRequest.enable(); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + eventHandlingLoop: + while (eventsReceived < eventsExpected) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + // handle ThreadDeathEvent + if (event instanceof ThreadDeathEvent) { + log.display("\nThreadDeathEvent received"); + ThreadDeathEvent castedEvent = (ThreadDeathEvent)event; + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + ThreadReference eventThread = ((ThreadDeathEvent)event).thread(); + if (eventThread == null) { + log.complain("FAILURE 2: ThreadDeathEvent.thread() returns null"); + testFailed = true; + } + + String threadName = eventThread.name(); + if ((threadName == null) || (threadName.equals(""))) { + log.complain("FAILURE 3: thread reference has invalid empty name"); + testFailed = true; + } else { + log.display ("Expected ThreadDeathEvent was received for " + threadName); + } + + // Check that all expected debuggee's thread create ThreadDeathEvent only once + eventsReceived = 0; + for (int i = 0; i < checkedThreads.length; i++) { + if (threadName.equals(checkedThreads[i][0])) { + if (checkedThreads[i][1].equals("0")) { + checkedThreads[i][1] = "1"; + } else { + log.complain("FAILURE 5: ThreadDeathEvent for " + threadName + " is received more that once"); + testFailed = true; + } + } + if (checkedThreads[i][1].equals("1")) { + eventsReceived++; + } + } + } + + // ignore each other events + + } // end of event handling loop + +// log.display("Resuming event set"); + eventSet.resume(); + + } // end of event set handling loop + + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptionException while waiting for event"); + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + + log.display("Disabling event request"); + checkedRequest.disable(); + + log.display("eventHandler completed"); + + } // end of run() + + } // end of EventHandler + + // start EventHandler thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to quit + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for all tested threads completed + command = pipe.readln(); + if (!command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + log.display(""); + + // wait for all expected events received or timeout exceeds + log.display("Waiting for all expected events received"); + try { + eventHandler.join(eventTimeout); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // Check that all expected debuggee's thread created ThreadDeathEvent + for (int i = 0; i < checkedThreads.length; i++) { + if (checkedThreads[i][1].equals("0")) { + log.complain("FAILURE 1: ThreadDeathEvent for thread " + checkedThreads[i][0] + " is not received"); + testFailed = true; + } + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("TEST FAILURE: Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + log.display(""); + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..58e8ee3a8f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ThreadDeathEvent/thread/thread001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.ThreadDeathEvent.thread() method. + * The test checks the following assertions: + * - ThreadDeathEvent is always received by debugger + * for all normally completed threads in target VM, + * - ThreadDeathEvent.thread() returns valid ThreadReference + * to expected thread in target VM, + * - ThreadDeathEvent is received only once for each expected thread + * A debugger class - nsk.jdi.ThreadDeathEvent.thread.thread001 ; + * a debuggee class - nsk.jdi.ThreadDeathEvent.thread.thread001a . + * The test uses NSK supporting classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates and enables ThreadDeathRequest. + * The debugger starts special thread for listening events + * delivered from debuggee. + * The debuggee starts the following checked threads: , + * , , . These threads consequently + * lock synchronizing object and complete. The main thread waits + * the completion of and threads and complete + * upon receiving command from debugger. + * The debugger switches to to listen the event during + * the time specified by parameter. + * The debugger checks if ThreadDeathEvent were receiced for every + * checked threads. + * The debugger also checks the other assertions of the test. + * The test fails if any of this checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4463674 TEST_BUG: some JDI tests are timing dependent + * ----------------- + * to fix the bug 4502899, + * the statement + * eventTimeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds + * is added next to line #66: + * log = new Log(out, argHandler); + * ----------------- + * 4757762 nsk/jdi/ThreadDeathEvent/thread/thread001 has a race + * ----------------- + * - Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * - Additional synchronization via IOPipe is used after completing + * of tested threads + * - Event handling loop is completed on receiving all expected events + * instead of receiving VMDisconnectEvent + * - Testing main thread is removed + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadDeathEvent.thread.thread001 + * nsk.jdi.ThreadDeathEvent.thread.thread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadDeathEvent.thread.thread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001a.java new file mode 100644 index 00000000000..7184db1cc84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001a.java @@ -0,0 +1,169 @@ +/* + * 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.ThreadDeathEvent.thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class thread001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static int result; + static volatile boolean mainExited = false; + + public static ArgumentHandler argHandler; + public static Log log; + + public static Object threadsLock = new Object(); + public static Object mainThreadLock = new Object(); + + public static Object threadsStarted = new Object(); + public static Object mainThreadCompleted = new Object(); + + public static void main(String args[]) { + argHandler = new ArgumentHandler(args); + log = argHandler.createDebugeeLog(); + + // execute the test + thread001a _thread001a = new thread001a(); + System.exit(JCK_STATUS_BASE + _thread001a.runIt()); + } + + // perform the test + int runIt() { + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + class InnerThread extends Thread { + InnerThread (String name) { + super(name); + } + public void run() { + log.display(this.getName() + " thread started"); + synchronized (threadsLock) { + threadsLock.notifyAll(); + } + log.display(this.getName() + " thread completed"); + } + } + + // create inner and outer threads + InnerThread innerThread = new InnerThread("innerThread"); + InnerThread innerDaemon = new InnerThread("innerDaemon"); + innerDaemon.setDaemon(true); + + OuterThread outerThread = new OuterThread("outerThread"); + OuterThread outerDaemon = new OuterThread("outerDaemon"); + outerDaemon.setDaemon(true); + + // start threads and lock monitor to prevent threads from exit + synchronized (threadsLock) { + innerThread.start(); + innerDaemon.start(); + outerThread.start(); + outerDaemon.start(); + + // wait for all threads started + while (!(innerThread.isAlive() && + innerDaemon.isAlive() && + outerThread.isAlive() && + outerDaemon.isAlive())) { + try { + synchronized (threadsStarted) { + threadsStarted.wait(1000); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for threads started"); + return FAILED; + } + } + + log.display("All checked threads started in debuggee."); + + // notify debugger that debuggee started and ready for testing + pipe.println(COMMAND_READY); + + // wait for command from debuggee + String command = pipe.readln(); + if (!command.equals(COMMAND_GO)) { + log.complain("TEST BUG: unexpected command: " + command); + return FAILED; + } + + // release lock to permit thread to complete + } + + // wait for all threads completed + while (innerThread.isAlive() || + innerDaemon.isAlive() || + outerThread.isAlive() || + outerDaemon.isAlive()) { + try { + synchronized (threadsLock) { + threadsLock.wait(1000); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for threads completed"); + return FAILED; + } + } + + log.display("All checked threads completed in debuggee."); + + // notify debugger that all threads completed + pipe.println(COMMAND_DONE); + + // wait for command from debuggee + String command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + log.complain("TEST BUG: unexpected command: " + command); + return FAILED; + } + + return PASSED; + } +} + +class OuterThread extends Thread { + OuterThread (String name) { + super(name); + } + public void run() { + thread001a.log.display(this.getName() + " thread started"); + synchronized (thread001a.threadsLock) { + thread001a.threadsLock.notifyAll(); + } + thread001a.log.display(this.getName() + " thread completed"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001.java new file mode 100644 index 00000000000..8b7557b30d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001.java @@ -0,0 +1,492 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadDeathRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadDeathRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks that the method restricts the events
    + * genereted by this request to those in the thread to filter.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger creates three ThreadDeathRequests with
    + * addThreadFilter(debuggee's thread2) invoked only on third Request,
    + * resumes the debuggee and waits for the ThreadDeathEvent.
    + * - Debuggee's main thread creates and starts new thread, thread2, and
    + * invokes the methodForCommunication
    + * to inform the debugger with the event.
    + * - Upon getting ThreadDeathEvent, the debugger checks
    + * if EventSet contains all three events; if no, the test FAILED.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class addthreadfilter001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ThreadReference testThread = (ThreadReference) + debuggeeClass.getValue(debuggeeClass.fieldByName("thread2")); + + log2("......setting up ThreadDeathRequest"); + ThreadDeathRequest tdr1 = eventRManager.createThreadDeathRequest(); +// tdr1.addThreadFilter(mainThread); + tdr1.addCountFilter(1); + tdr1.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tdr1.putProperty("number", "ThreadDeathRequest1"); + tdr1.enable(); + + ThreadDeathRequest tdr2 = eventRManager.createThreadDeathRequest(); +// tsr2.addThreadFilter(mainThread); + tdr2.addCountFilter(1); + tdr2.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tdr2.putProperty("number", "ThreadDeathRequest2"); + tdr2.enable(); + + ThreadDeathRequest tdr3 = eventRManager.createThreadDeathRequest(); + tdr3.addThreadFilter(testThread); + tdr3.addCountFilter(1); + tdr3.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tdr3.putProperty("number", "ThreadDeathRequest3"); + tdr3.enable(); + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ThreadDeathEvent"); + getEventSet(); + EventSet eventSet1 = eventSet; + if ( !(eventIterator.nextEvent() instanceof ThreadDeathEvent) ) { + testExitCode = FAILED; + log3("ERROR: new event is not ThreadDeathEvent"); + return; + } + tdr1.disable(); + tdr2.disable(); + tdr3.disable(); + + int setSize = eventSet1.size(); + log2("......eventSet1.size() == " + setSize); + if (setSize != 3) { + log3("ERROR: eventSet1.size() != 3 :: " + setSize); + testExitCode = FAILED; + + EventIterator evI1 = eventSet1.eventIterator(); + while (evI1.hasNext()) { + Event ev1 = evI1.nextEvent(); + log2("........event property : " + ev1.request().getProperty("number")); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001/TestDescription.java new file mode 100644 index 00000000000..79b3c8b6a6a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/ThreadDeathRequest/addThreadFilter/addthreadfilter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadDeathRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadDeathRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks that the method restricts the events genereted by + * this request to those in a thread to filter which is not main. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter001; + * the debuggee program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadDeathRequest.addThreadFilter.addthreadfilter001 + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001a.java new file mode 100644 index 00000000000..44498dbdc13 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001a.java @@ -0,0 +1,165 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter001 JDI test. + */ + +public class addthreadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread2addthreadfilter001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread2 = new Thread2addthreadfilter001a("thread2"); + methodForCommunication(); + + threadStart(thread2); + try { + thread2.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static class Thread2addthreadfilter001a extends Thread { + + String tName = null; + + public Thread2addthreadfilter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log3(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit :: threadName == " + tName); + return; + } + } + + + private static void log3(String str) { + log1(Thread.currentThread().getName() + " : " + str); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002.java new file mode 100644 index 00000000000..d86de05f35c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002.java @@ -0,0 +1,488 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadDeathRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadDeathRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The cases to check are as follows: + * (1) if this request is currently enabled,
    + * - addThreadFilter(ThreadReference) results in throwing
    + * InvalidRequestStateException;
    + * - addThreadFilter(null) results in throwing
    + * NullPointerException or InvalidRequestStateException;
    + * (2) if this request is currently disabled,
    + * addThreadFilter(null) results in throwing
    + * NullPointerException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase, the debugger creates ThreadDeathRequest
    + * and performs the above checks.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class addthreadfilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......setting up ThreadDeathRequest"); + log2("...... ThreadDeathRequest tdr1 = eventRManager.createThreadDeathRequest();"); + ThreadDeathRequest tdr1 = eventRManager.createThreadDeathRequest(); + tdr1.addCountFilter(1); + tdr1.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tdr1.putProperty("number", "ThreadDeathRequest1"); + + log2("...... tdr1.enable();"); + tdr1.enable(); + + try { + log2("...... tdr1.addThreadFilter(mainThread);"); + log2(" InvalidRequestStateException is expected"); + tdr1.addThreadFilter(mainThread); + log3("ERROR: no InvalidRequestStateException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } catch ( Exception e ) { + log3("ERROR: unexpected Exception : " + e); + testExitCode = FAILED; + } + try { + log2("...... tdr1.addThreadFilter(null);"); + log2(" NullPointerException is expected"); + tdr1.addThreadFilter(null); + log3("ERROR: no NullPointerException "); + testExitCode = FAILED; + } catch ( NullPointerException e ) { + log2(" NullPointerException"); + } catch ( Exception e ) { + log3("ERROR: unexpected Exception : " + e); + testExitCode = FAILED; + } + + log2("...... tdr1.disable()"); + tdr1.disable(); + + try { + log2("...... tdr1.addThreadFilter(null);"); + log2(" NullPointerException or InvalidRequestStateException is expected"); + tdr1.addThreadFilter(null); + log3("ERROR: no Exception thrown"); + testExitCode = FAILED; + } catch ( NullPointerException e ) { + log2(" NullPointerException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } catch ( Exception e ) { + log3("ERROR: unexpected Exception : " + e); + testExitCode = FAILED; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002/TestDescription.java new file mode 100644 index 00000000000..cec53f09576 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/ThreadDeathRequest/addThreadFilter/addthreadfilter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadDeathRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadDeathRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks that "if this request is currently enabled" + * calling the method results in throwing InvalidRequestStateException. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter002; + * the debuggee program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadDeathRequest.addThreadFilter.addthreadfilter002 + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002a.java new file mode 100644 index 00000000000..1f8a447f497 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002a.java @@ -0,0 +1,113 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter002 JDI test. + */ + +public class addthreadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003.java new file mode 100644 index 00000000000..28550d18b21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003.java @@ -0,0 +1,528 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadDeathRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadDeathRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ThreadDeathRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + * + + */ + +public class addthreadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter003a"; + + private String testedClassName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ThreadDeathRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ThreadDeathRequest (null, + EventRequest.SUSPEND_NONE, "ThreadDeathRequest1"); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ThreadDeathRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((ThreadDeathRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ThreadDeathRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadDeathRequest setting2ThreadDeathRequest( ThreadReference thread, + int suspendPolicy, + String property) + throws JDITestRuntimeException { + try { + ThreadDeathRequest tsr = eventRManager.createThreadDeathRequest(); + if (thread != null) + tsr.addThreadFilter(thread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingThreadDeathRequest() : " + e); + log3(" ThreadDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadDeathRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003/TestDescription.java new file mode 100644 index 00000000000..47315f8662f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003/TestDescription.java @@ -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/ThreadDeathRequest/addThreadFilter/addthreadfilter003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadDeathRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadDeathRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter003; + * the debuggee program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadDeathRequest.addThreadFilter.addthreadfilter003 + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003a.java new file mode 100644 index 00000000000..0760402f515 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003a.java @@ -0,0 +1,185 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter003 JDI test. + */ + +public class addthreadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter003a thread1 = null; + + static TestClass objTC = new TestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter003a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter003a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter003a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004.java new file mode 100644 index 00000000000..0d875bf0924 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004.java @@ -0,0 +1,183 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ThreadDeathRequest. + * + * The test checks that results of the method + * com.sun.jdi.ThreadDeathRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same ThreadDeathRequest object. + * There are two ThreadDeathRequests to check as follows: + * (1) For ThreadDeathRequest2, both invocations are with different + * ThreadReferences restricting one ThreadDeath event to two threads. + * The test expects no ThreadDeath event will be received. + * (2) For ThreadDeathRequest1, both invocations are with the same + * ThreadReference restricting one ThreadDeath event to one thread. + * The test expects this ThreadDeath event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up ThreadDeathRequests 1&2 within the method + * in the class addthreadfilter004aTestClass which will be calling by both threads, + * - restricts the ThreadDeathRequest1 only to thread1, + * - restricts the ThreadDeathRequest2 only to thread2, + * - resumes debuggee's main thread, and + * - waits for the requested events for both threads. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class addthreadfilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004a"; + return new addthreadfilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ThreadDeathRequest1"; + String property2 = "ThreadDeathRequest2"; + + ReferenceType testClassReference = null; + + boolean thread1EventReceived = false; + boolean thread2EventReceived = false; + boolean bpEventReceived = false; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2ThreadDeathRequest (thread1, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2ThreadDeathRequest (thread1, + EventRequest.SUSPEND_ALL, property2); + + ((ThreadDeathRequest) eventRequest1).addThreadFilter(thread1); + ((ThreadDeathRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for ThreadDeathEvent in tested thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ThreadDeathEvent)) { + setFailedStatus("ERROR: new event is not ThreadDeathEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ThreadDeathEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + EventRequest newEventRequest = newEvent.request(); + if (!newEventRequest.equals(eventRequest1) ) { + setFailedStatus("The ThreadDeathEvent occured not for eventRequest1"); + } + + ThreadReference thr = ((ThreadDeathEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The ThreadDeathEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ThreadDeathRequest setting2ThreadDeathRequest( ThreadReference thread, + int suspendPolicy, + String property) { + try { + ThreadDeathRequest tsr = eventRManager.createThreadDeathRequest(); + if (thread != null) + tsr.addThreadFilter(thread); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ThreadDeathRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004/TestDescription.java new file mode 100644 index 00000000000..8710d3725e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004/TestDescription.java @@ -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/ThreadDeathRequest/addThreadFilter/addthreadfilter004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadDeathRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadDeathRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * There are two ThreadDeathRequests, each one with filter for for his own thread. + * After enabling the requests, the debuggee starts both threads. + * The test expects this ThreadDeath event for both threads will be received. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004; + * the debuggee program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test was fixed due to bug: + * 4559026 TEST_BUG: NSK test addthreadfilter004 fails in -Xcomp mode + * Modified due to fix of the bug: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004 + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004a.java new file mode 100644 index 00000000000..42aa00db4ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004a.java @@ -0,0 +1,219 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addaddthreadfilter004 JDI test. + */ + +public class addthreadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter004a thread1 = null; + static Threadaddthreadfilter004a thread2 = null; + + static addthreadfilter004aTestClass objTC = new addthreadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter004a("thread1"); + thread2 = new Threadaddthreadfilter004a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + waitForThreadJoin (thread1, "thread1"); + waitForThreadJoin (thread2, "thread2"); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static void waitForThreadJoin (Thread thread, String threadName) { + log1("waiting for " + threadName + " join"); + + // get internal timeout in minutes for waiting of thread completion. + int waitTime = argHandler.getWaitTime(); + if (thread.isAlive()) { + try { + thread.join(waitTime * 60 * 1000); + } catch (InterruptedException e) { + throw new Failure("catched unexpected InterruptedException while waiting of " + threadName + " join:" + e); + }; + } + if (thread.isAlive()) { + throw new Failure(threadName + " is still alive"); + } else { + log1(threadName + " joined"); + } + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005.java new file mode 100644 index 00000000000..ae742b7d7ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005.java @@ -0,0 +1,540 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadDeathRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadDeathRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates ThreadDeathRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates ThreadDeathRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates ThreadDeathRequest3, waits the thread1 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + * + + */ + +public class addthreadfilter005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter005a"; + + private String testedClassName = + "nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter005aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + + String thread1Name = "thread1"; + + String property1 = "ThreadDeathRequest1"; + String property2 = "ThreadDeathRequest2"; + String property3 = "ThreadDeathRequest3"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ThreadDeathRequest (null, + EventRequest.SUSPEND_NONE, property1); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ThreadDeathRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2ThreadDeathRequest (null, + EventRequest.SUSPEND_NONE, property2); + + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ThreadDeathRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2ThreadDeathRequest (null, + EventRequest.SUSPEND_NONE, property3); + + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ThreadDeathRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadDeathRequest setting2ThreadDeathRequest( ThreadReference thread, + int suspendPolicy, + String property) + throws JDITestRuntimeException { + try { + ThreadDeathRequest tsr = eventRManager.createThreadDeathRequest(); + if (thread != null) + tsr.addThreadFilter(thread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingThreadDeathRequest() : " + e); + log3(" ThreadDeathRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadDeathRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005/TestDescription.java new file mode 100644 index 00000000000..43f0dcaa911 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ThreadDeathRequest/addThreadFilter/addthreadfilter005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadDeathRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadDeathRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter005; + * the debuggee program - nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadDeathRequest.addThreadFilter.addthreadfilter005 + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadDeathRequest.addThreadFilter.addthreadfilter005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005a.java new file mode 100644 index 00000000000..f43cf02f605 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005a.java @@ -0,0 +1,198 @@ +/* + * 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.ThreadDeathRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addaddthreadfilter005 JDI test. + */ + +public class addthreadfilter005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter005a thread1 = null; + + static addthreadfilter005aTestClass objTC = new addthreadfilter005aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter005a("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter005a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter005a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class addthreadfilter005aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java new file mode 100644 index 00000000000..ea71477890e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java @@ -0,0 +1,275 @@ +/* + * 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.ThreadGroupReference.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +//import com.sun.jdi.event.*; +//import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadGroupReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadGroupReference.name()
    + * complies with its spec.
    + *
    + * The case for testing includes two ThreadGroup objects defined in two
    + * debuggee's classes, and their mirrors in a debugger.
    + * The objects are created together with two debuggee's threads,
    + * main and another one.
    + * The test works as follows. After being started up,
    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets the mirrors of the ThreadGroup objects,
    + * uses the method ThreadGroupReference.name() to get the names of both
    + * objects, and checks up the names are ones expected.
    + */ + +public class name001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadGroupReference/name/name001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadGroupReference.name.name001a"; + + private String testedClassName = + "nsk.jdi.ThreadGroupReference.name.Threadname001a"; + + //String mName = "nsk.jdi.ThreadGroupReference.name"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + //static EventRequestManager eventRManager = null; + //static EventQueue eventQueue = null; + //static EventSet eventSet = null; + + ReferenceType thread2class = null; + ReferenceType mainthreadclass = null; + + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + String mainGroupObj = "mainGroupObj"; + String thread2GroupObj = "thread2GroupObj"; + + String mainGroupName = "mainthreadGroupName"; + String thread2GroupName = "thread2GroupName"; + List classes = null; + + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + log2(" getting: ThreadGroupReference mainGroup"); + ThreadGroupReference mainGroup = (ThreadGroupReference) + mainthreadclass.getValue(mainthreadclass.fieldByName(mainGroupObj) ); + + log2(" getting: ThreadGroupReference thread2Group"); + ThreadGroupReference thread2Group = (ThreadGroupReference) + thread2class.getValue(thread2class.fieldByName(thread2GroupObj) ); + + log2(" checking up: mainGroup.name().equals(mainGroupName)"); + if ( !mainGroup.name().equals(mainGroupName) ) { + log3("ERROR: !mainGroup.name().equals(mainGroupName) : " + mainGroup.name() ); + expresult = returnCode1; + } + + log2(" checking up: thread2Group.name().equals(thread2GroupName)"); + if ( !thread2Group.name().equals(thread2GroupName) ) { + log3("ERROR: !thread2Group.name().equals(thread2GroupName) : " + thread2Group.name() ); + expresult = returnCode1; + } + + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001/TestDescription.java new file mode 100644 index 00000000000..acac4797b40 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ThreadGroupReference/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadGroupReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadGroupReference.name() + * complies with its spec: + * public String name() + * Returns the name of this thread group. + * Returns: the string containing the thread group name. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadGroupReference.name.name001; + * the debuggee program - nsk.jdi.ThreadGroupReference.name.name001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadGroupReference.name.name001 + * nsk.jdi.ThreadGroupReference.name.name001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001a.java new file mode 100644 index 00000000000..9172457a897 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001a.java @@ -0,0 +1,188 @@ +/* + * 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.ThreadGroupReference.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name001 JDI test. + */ + +public class name001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + private static ThreadGroup mainGroupObj = new ThreadGroup("mainthreadGroupName"); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadGroupReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadGroupReference.parent()
    + * complies with its spec.
    + *
    + * The case for testing includes four ThreadGroup objects defined
    + * in two debuggee's classes and in an external class,
    + * and their mirrors in a debugger.
    + * Parenthood relationships between the objects are as follows:
    + * mainParent -> mainthreadGroup -> thread2Group1 -> thread2Group2
    + * The objects are created together with two debuggee's threads,
    + * mainthread and a thread2.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread,
    + * the thread2, informs a debugger of the thread2 creation,
    + * and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets the mirrors of all the ThreadGroup objects,
    + * and checks up the above mentioned parenthood relationships.
    + */ + +public class parent001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadGroupReference/parent/parent001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new parent001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadGroupReference.parent.parent001a"; + + private String testedClassName = + "nsk.jdi.ThreadGroupReference.parent.Threadparent001a"; + + //String mName = "nsk.jdi.ThreadGroupReference.parent"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + //static EventRequestManager eventRManager = null; + //static EventQueue eventQueue = null; + //static EventSet eventSet = null; + + ReferenceType testedclass = null; + + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List classes = null; + + ThreadGroupReference group0 = null; + ThreadGroupReference group1 = null; + ThreadGroupReference group2 = null; + ThreadGroupReference group3 = null; + + String obj0Name = "obj0Name"; + String obj1Name = "obj1Name"; + String obj2Name = "obj2Name"; + String obj3Name = "obj3Name"; + + String str = null; + + ReferenceType mainthreadClass = null; + ReferenceType thread2Class = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2Class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + + log2(" getting a ThreadGroupReference object for a parent of 'mainthreadGroup'"); + str = ( (StringReference) + thread2Class.getValue(thread2Class.fieldByName(obj0Name)) ).value(); + group0 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(str)); + + + log2(" getting a ThreadGroupReference object for 'mainthreadGroup'"); + str = ( (StringReference) + thread2Class.getValue(thread2Class.fieldByName(obj1Name)) ).value(); + group1 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(str)); + + + log2(" getting a ThreadGroupReference object for 'thread2Group1'"); + str = ( (StringReference) + thread2Class.getValue(thread2Class.fieldByName(obj2Name)) ).value(); + group2 = (ThreadGroupReference) + thread2Class.getValue(thread2Class.fieldByName(str)); + + log2(" getting a ThreadGroupReference object for 'thread2Group2'"); + str = ( (StringReference) + thread2Class.getValue(thread2Class.fieldByName(obj3Name)) ).value(); + group3 = (ThreadGroupReference) + thread2Class.getValue(thread2Class.fieldByName(str)); + + + log2(" checking up the parent of 'thread2Group2'; 'thread2Group1' is expected"); + if (!group3.parent().equals(group2)) { + log3("ERROR: !group3.parent().equals(group2)"); + expresult = returnCode1; + } + log2(" checking up the parent of 'thread2Group1'; 'mainthreadGroup' is expected"); + if (!group2.parent().equals(group1)) { + log3("ERROR: !group2.parent().equals(group1)"); + expresult = returnCode1; + } + log2(" checking up the parent of 'mainthreadGroup'; 'mainParent' is expected"); + if (!group1.parent().equals(group0)) { + log3("ERROR: group1.parent().equals(group0) : " + group1.parent().name()); + expresult = returnCode1; + } + + + log2(" instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001/TestDescription.java new file mode 100644 index 00000000000..1fa4b96286a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001/TestDescription.java @@ -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/ThreadGroupReference/parent/parent001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadGroupReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadGroupReference.parent() + * complies with its spec: + * public ThreadGroupReference parent() + * Returns the parent of this thread group. + * Returns: a ThreadGroupReference mirroring the parent of this thread group + * in the target VM, or null if this is a top-level thread group. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadGroupReference.parent.parent001; + * the debuggee program - nsk.jdi.ThreadGroupReference.parent.parent001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadGroupReference.parent.parent001 + * nsk.jdi.ThreadGroupReference.parent.parent001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.parent.parent001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001a.java new file mode 100644 index 00000000000..6c07f0bf03a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001a.java @@ -0,0 +1,204 @@ +/* + * 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.ThreadGroupReference.parent; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the parent001 JDI test. + */ + +public class parent001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static final String mainthreadGroupName = "mainthreadGroup"; + public static ThreadGroup mainthreadGroupObj = new ThreadGroup(mainthreadGroupName); + + public static ThreadGroup mainParent = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadGroupReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadGroupReference.resume()
    + * complies with its spec.
    + *
    + * The case for testing includes four ThreadGroup objects defined
    + * in a debuggee and their mirrors in a debugger.
    + * Parenthood relationships between the objects are as follows:
    + * threadGroups 2&3 are subgroups of threadGroup1
    + * threadGroup4 is a subgroup of threadGroup3
    + * The objects are created together with three threads, Thread 2,3,4,
    + * belonging to the corresponding subgroups.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates the threads,
    + * informs the debugger of the threads creation,
    + * and is waiting for reply.
    + * Since the threads use the same locking object in their 'run' methods
    + * they are locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets mirrors of threadGroups and checks up that
    + * after suspending all the three threads:
    + * - group4.resume(); resumes only Thread4;
    + * - group3.resume(); resumes Thread3 and Thread4;
    + * - group2.resume(); resumes only Thread2;
    + * - group1.resume(); resumes Thread2, Thread3 and Thread4.
    + */ + +public class resume001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadGroupReference/resume/resume001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new resume001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadGroupReference.resume.resume001a"; + + private String testedClassName = + "nsk.jdi.ThreadGroupReference.resume.Threadresume001a"; + + //String mName = "nsk.jdi.ThreadGroupReference.resume"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + List classes = null; + + ThreadGroupReference groups[] = { null, null, null, null }; + + String groupNames [] = { "threadGroup1Obj", + "threadGroup2Obj", + "threadGroup3Obj", + "threadGroup4Obj" }; + + List threads; + ListIterator iterator; + int flag; + String threadName; + ThreadReference thread; + + + String threadNames [] = { "Thread2", "Thread3", "Thread4" }; + + ReferenceType mainthreadClass = null; + ReferenceType thread2Class = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2Class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + log2(" getting a List of all threadGroups"); + for (int i1 = 0; i1 < 4; i1++) { + groups[i1] = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(groupNames[i1])); + } + + log2(" getting a List of all running threads"); + threads = vm.allThreads(); + + + log2("......checking up threads resumed with groups[3].resume()"); + log2(" expected: 'Thread4'"); + groups[0].suspend(); + groups[3].resume(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 3) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) != 0) + log3("ERROR: 'Thread4' is among suspended threads"); + if ((flag & 2) == 0) + log3("ERROR: 'Thread3' is not suspended"); + if ((flag & 1) == 0) + log3("ERROR: 'Thread2' is not suspended"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + log2("......checking up threads resumed with groups[2].resume()"); + log2(" expected: 'Thread3' and 'Thread4'"); + groups[0].suspend(); + groups[2].resume(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 1) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) != 0) + log3("ERROR: 'Thread4' is among suspended threads"); + if ((flag & 2) != 0) + log3("ERROR: 'Thread3' is among suspended threads"); + if ((flag & 1) == 0) + log3("ERROR: 'Thread2' is not suspended"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + log2("......checking up threads resumed with groups[1].resume()"); + log2(" expected: 'Thread2'"); + groups[0].suspend(); + groups[1].resume(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 6) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) == 0) + log3("ERROR: 'Thread4' is not suspended"); + if ((flag & 2) == 0) + log3("ERROR: 'Thread3' is not suspended"); + if ((flag & 1) != 0) + log3("ERROR: 'Thread2' is among suspended threads"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + log2("......checking up threads resumed with groups[0].resume()"); + log2(" expected: 'Thread2', 'Thread3', and 'Thread4'"); + groups[0].suspend(); + groups[0].resume(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 0) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) != 0) + log3("ERROR: 'Thread4' is among suspended threads"); + if ((flag & 2) != 0) + log3("ERROR: 'Thread3' is among suspended threads"); + if ((flag & 1) != 0) + log3("ERROR: 'Thread2' is among suspended threads"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001/TestDescription.java new file mode 100644 index 00000000000..a4c98f4a97c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001/TestDescription.java @@ -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/ThreadGroupReference/resume/resume001. + * VM Testbase keywords: [quick, jpda, jdi, quarantine] + * VM Testbase comments: JDK-8016181 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadGroupReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadGroupReference.resume() + * complies with its spec: + * public void resume() + * Resumes all threads in this thread group. + * Each thread in this group and in all of its subgroups will be resumed as + * described in ThreadReference.resume(). + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadGroupReference.resume.resume001; + * the debuggee program - nsk.jdi.ThreadGroupReference.resume.resume001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadGroupReference.resume.resume001 + * nsk.jdi.ThreadGroupReference.resume.resume001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.resume.resume001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001a.java new file mode 100644 index 00000000000..718a9fd7327 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001a.java @@ -0,0 +1,221 @@ +/* + * 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.ThreadGroupReference.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the resume001 JDI test. + */ + +public class resume001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static final String mainthreadGroupName = "mainthreadGroup"; + public static final String threadGroup2Name = "threadGroup2"; + public static final String threadGroup3Name = "threadGroup3"; + public static final String threadGroup4Name = "threadGroup4"; + + public static ThreadGroup threadGroup1Obj = new ThreadGroup(mainthreadGroupName); + public static ThreadGroup threadGroup2Obj = new ThreadGroup(threadGroup1Obj, threadGroup2Name); + public static ThreadGroup threadGroup3Obj = new ThreadGroup(threadGroup1Obj, threadGroup3Name); + public static ThreadGroup threadGroup4Obj = new ThreadGroup(threadGroup3Obj, threadGroup4Name); + + private static Threadresume001a thread2 = null; + private static Threadresume001a thread3 = null; + private static Threadresume001a thread4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadGroupReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadGroupReference.suspend()
    + * complies with its spec.
    + *
    + * The case for testing includes four ThreadGroup objects defined
    + * in a debuggee and their mirrors in a debugger.
    + * Parenthood relationships between the objects are as follows:
    + * threadGroups 2&3 are subgroups of threadGroup1
    + * threadGroup4 is a subgroup of threadGroup3
    + * The objects are created together with three threads, Thread 2,3,4,
    + * belonging to the corresponding subgroups.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates the threads,
    + * informs the debugger of the threads creation,
    + * and is waiting for reply.
    + * Since the threads use the same locking object in their 'run' methods
    + * they are locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets mirrors of threadGroups and checks up that:
    + * - group4.suspend(); suspends only Thread4;
    + * - group3.suspend(); suspends Thread3 and Thread4;
    + * - group2.suspend(); suspends only Thread2;
    + * - group1.suspend(); suspends Thread2, Thread3 and Thread4.
    + */ + +public class suspend001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadGroupReference/suspend/suspend001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new suspend001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadGroupReference.suspend.suspend001a"; + + private String testedClassName = + "nsk.jdi.ThreadGroupReference.suspend.Threadsuspend001a"; + + //String mName = "nsk.jdi.ThreadGroupReference.suspend"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + List classes = null; + + ThreadGroupReference groups[] = { null, null, null, null }; + + String groupNames [] = { "threadGroup1Obj", + "threadGroup2Obj", + "threadGroup3Obj", + "threadGroup4Obj" }; + + List threads; + ListIterator iterator; + int flag; + String threadName; + ThreadReference thread; + + String threadNames [] = { "Thread2", "Thread3", "Thread4" }; + + ReferenceType mainthreadClass = null; + ReferenceType thread2Class = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2Class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + log2(" getting a List of all threadGroups"); + for (int i1 = 0; i1 < 4; i1++) { + groups[i1] = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(groupNames[i1])); + } + + log2(" getting a List of all running threads"); + threads = vm.allThreads(); + + + log2("......checking up threads suspended with groups[3].suspend()"); + log2(" expected: 'Thread4'"); + groups[3].suspend(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 4) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) == 0) + log3("ERROR: 'Thread4' is not among suspended threads"); + if ((flag & 2) != 0) + log3("ERROR: 'Thread3' is also suspended"); + if ((flag & 1) != 0) + log3("ERROR: 'Thread2' is also suspended"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + log2("......checking up threads suspended with groups[2].suspend()"); + log2(" expected: 'Thread3' and 'Thread4'"); + groups[2].suspend(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 6) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) == 0) + log3("ERROR: 'Thread4' is not among suspended threads"); + if ((flag & 2) == 0) + log3("ERROR: 'Thread3' is not among suspended threads"); + if ((flag & 1) != 0) + log3("ERROR: 'Thread2' is also suspended"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + log2("......checking up threads suspended with groups[1].suspend()"); + log2(" expected: 'Thread2'"); + groups[1].suspend(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 1) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) != 0) + log3("ERROR: 'Thread4' is among suspended threads"); + if ((flag & 2) != 0) + log3("ERROR: 'Thread3' is among suspended threads"); + if ((flag & 1) == 0) + log3("ERROR: 'Thread2' is not among suspended threads"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + log2("......checking up threads suspended with groups[0].suspend()"); + log2(" expected: 'Thread2', 'Thread3', and 'Thread4'"); + groups[0].suspend(); + + iterator = threads.listIterator(); + flag = 0; + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + if (!thread.isSuspended()) + continue; + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + flag |= 1; + else if (threadName.equals(threadNames[1])) + flag |= 2; + else if (threadName.equals(threadNames[2])) + flag |= 4; + else flag |= 8; + } + if (flag != 7) { + expresult = returnCode1; + if (flag == 0) + log3("ERROR: no threads suspunded"); + if ((flag & 4) == 0) + log3("ERROR: 'Thread4' is not among suspended threads"); + if ((flag & 2) == 0) + log3("ERROR: 'Thread3' is not among suspended threads"); + if ((flag & 1) == 0) + log3("ERROR: 'Thread2' is not among suspended threads"); + if (flag >= 8) + log3("ERROR: some extra thread(s) is also suspended"); + } + vm.resume(); + + + + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001/TestDescription.java new file mode 100644 index 00000000000..dcf042b460e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001/TestDescription.java @@ -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/ThreadGroupReference/suspend/suspend001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadGroupReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadGroupReference.suspend() + * complies with its spec: + * public void suspend() + * Suspends all threads in this thread group. + * Each thread in this group and in all of its subgroups will be suspended as + * described in ThreadReference.suspend(). This is not guaranteed to be + * an atomic operation; if the target VM is not interrupted + * at the time this method is called, it is possible that new threads + * will be created between the time that + * threads are enumerated and all of them have been suspended. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadGroupReference.suspend.suspend001; + * the debuggee program - nsk.jdi.ThreadGroupReference.suspend.suspend001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadGroupReference.suspend.suspend001 + * nsk.jdi.ThreadGroupReference.suspend.suspend001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.suspend.suspend001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001a.java new file mode 100644 index 00000000000..468912e349d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001a.java @@ -0,0 +1,221 @@ +/* + * 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.ThreadGroupReference.suspend; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the suspend001 JDI test. + */ + +public class suspend001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static final String mainthreadGroupName = "mainthreadGroup"; + public static final String threadGroup2Name = "threadGroup2"; + public static final String threadGroup3Name = "threadGroup3"; + public static final String threadGroup4Name = "threadGroup4"; + + public static ThreadGroup threadGroup1Obj = new ThreadGroup(mainthreadGroupName); + public static ThreadGroup threadGroup2Obj = new ThreadGroup(threadGroup1Obj, threadGroup2Name); + public static ThreadGroup threadGroup3Obj = new ThreadGroup(threadGroup1Obj, threadGroup3Name); + public static ThreadGroup threadGroup4Obj = new ThreadGroup(threadGroup3Obj, threadGroup4Name); + + private static Threadsuspend001a thread2 = null; + private static Threadsuspend001a thread3 = null; + private static Threadsuspend001a thread4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadGroupReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadGroupReference.threadGroups()
    + * complies with its spec.
    + *
    + * The case for testing includes four ThreadGroup objects defined
    + * in a debuggee and their mirrors in a debugger.
    + * Parenthood relationships between the objects are as follows:
    + * threadGroups 2&3 are subgroups of threadGroup1
    + * threadGroup4 is a subgroup of threadGroup3
    + * The objects are created together with three threads, Thread 2,3,4,
    + * belonnging to the corresponding subgroups.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates the threads,
    + * informs the debugger of the threads creation,
    + * and is waiting for reply.
    + * Since the threads use the same locking object in their 'run' methods
    + * they are locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets mirrors of threadGroups and checks up that:
    + * - threadGroup4 has 0 threadGroup members;
    + * - threadGroup3 has 1 threadGroup member;
    + * - threadGroup1 has 2 threadGroup members with certain names.
    + */ + +public class threadgroups001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new threadgroups001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadGroupReference.threadGroups.threadgroups001a"; + + private String testedClassName = + "nsk.jdi.ThreadGroupReference.threadGroups.Threadthreadgroups001a"; + + //String mName = "nsk.jdi.ThreadGroupReference.threadGroups"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "Thread2"; + + List classes = null; + + ThreadGroupReference group1 = null; + ThreadGroupReference group2 = null; + ThreadGroupReference group3 = null; + ThreadGroupReference group4 = null; + + String parentName = "threadGroup1Obj"; + String group2Name = "threadGroup2Obj"; + String group3Name = "threadGroup3Obj"; + String group4Name = "threadGroup4Obj"; + + String str = null; + + ReferenceType mainthreadClass = null; + ReferenceType thread2Class = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2Class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + + log2(" getting a ThreadGroupReference object for group1"); + group1 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(parentName)); + + log2(" getting a ThreadGroupReference object for group2"); + group2 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(group2Name)); + + log2(" getting a ThreadGroupReference object for group3"); + group3 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(group3Name)); + + log2(" getting a ThreadGroupReference object for group4"); + group4 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(group4Name)); + + + List threadGroups = null; + + log2(" checking up List size for threadGroup4; should be == 0"); + threadGroups = group4.threadGroups(); + if (threadGroups.size() != 0) { + log3("ERROR: threadGroups.size() != 0 for group4: " + threadGroups.size() ); + expresult = 1; + } + + log2(" checking up List size for threadGroup3; should be == 1"); + threadGroups = group3.threadGroups(); + if (threadGroups.size() != 1) { + log3("ERROR: threadGroups.size() != 1 for group3: " + threadGroups.size() ); + expresult = 1; + } + + log2(" checking up List size for threadGroup1; should be == 2"); + threadGroups = group1.threadGroups(); + if (threadGroups.size() != 2) { + log3("ERROR: threadGroups.size() != 2 for group1: " + threadGroups.size() ); + expresult = 1; + } + + log2(" checking up threadGroup names in List for threadGroup1"); + String s1 = ( (ThreadGroupReference) threadGroups.get(0)).name(); + String s2 = ( (ThreadGroupReference) threadGroups.get(1)).name(); + if (s1.equals("threadGroup2")) { + if (!s2.equals("threadGroup3")) { + log3("ERROR: s1.equals('threadGroup2') but !s2.equals('threadGroup3') : " + s2); + expresult = 1; + } + } else if (s1.equals("threadGroup3")) { + if (!s2.equals("threadGroup2")) { + log3("ERROR: s1.equals('threadGroup3') but !s2.equals('threadGroup2') : " + s2); + expresult = 1; + } + } else { + log3("ERROR: !s1.equals('threadGroup2') or !s1.equals('threadGroup3') : " + s1); + expresult = 1; + } + + + log2(" instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001/TestDescription.java new file mode 100644 index 00000000000..f52d42b1311 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001/TestDescription.java @@ -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/ThreadGroupReference/threadGroups/threadgroups001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadGroupReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadGroupReference.threadGroups() + * complies with its spec: + * public List threadGroups() + * Returns a List containing each ThreadGroupReference in this thread group. + * Only the thread groups in this immediate thread group + * (and not its subgroups) are returned. + * Returns: a List of ThreadGroupReference objects mirroring the threads + * from this thread group in the target VM. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadGroupReference.threadGroups.threadgroups001; + * the debuggee program - nsk.jdi.ThreadGroupReference.threadGroups.threadgroups001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadGroupReference.threadGroups.threadgroups001 + * nsk.jdi.ThreadGroupReference.threadGroups.threadgroups001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.threadGroups.threadgroups001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001a.java new file mode 100644 index 00000000000..e5ea28b6e35 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001a.java @@ -0,0 +1,222 @@ +/* + * 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.ThreadGroupReference.threadGroups; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the threadgroups001 JDI test. + */ + +public class threadgroups001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static final String mainthreadGroupName = "mainthreadGroup"; + public static final String threadGroup2Name = "threadGroup2"; + public static final String threadGroup3Name = "threadGroup3"; + public static final String threadGroup4Name = "threadGroup4"; + + public static ThreadGroup threadGroup1Obj = new ThreadGroup(mainthreadGroupName); + public static ThreadGroup threadGroup2Obj = new ThreadGroup(threadGroup1Obj, threadGroup2Name); + public static ThreadGroup threadGroup3Obj = new ThreadGroup(threadGroup1Obj, threadGroup3Name); + public static ThreadGroup threadGroup4Obj = new ThreadGroup(threadGroup3Obj, threadGroup4Name); + + public static ThreadGroup mainParent = null; + + private static Threadthreadgroups001a thread2 = null; + private static Threadthreadgroups001a thread3 = null; + private static Threadthreadgroups001a thread4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadGroupReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadGroupReference.threads()
    + * complies with its spec.
    + *
    + * The case for testing includes two ThreadGroup objects defined
    + * in a debuggee and their mirrors in a debugger.
    + * Parenthood relationships between the objects are as follows:
    + * threadGroup2 is a subgroup of mainParent
    + * The objects are created together with three debuggee's threads;
    + * the main thread and a thread2 belong to the mainParent group,
    + * whereas a thread3 to the subgroup.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates two new threads,
    + * informs the debugger of the threads creation,
    + * and is waiting for reply.
    + * Since the threads use the same locking object in their 'run' methods
    + * they are locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets Lists of threads in each of the groups,
    + * and checks up the sizes of Lists and names of ThreadReference objects
    + * in the List returned by the tested method,
    + * that is, mainParent.threads().
    + */ + +public class threads001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadGroupReference/threads/threads001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new threads001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadGroupReference.threads.threads001a"; + + private String testedClassName = + "nsk.jdi.ThreadGroupReference.threads.Threadthreads001a"; + + //String mName = "nsk.jdi.ThreadGroupReference.threads"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "Thread2"; + + List classes = null; + + ThreadGroupReference group1 = null; + ThreadGroupReference group2 = null; + + + String parentName = "mainParent"; + String group2Name = "threadGroup2Obj"; + + String str = null; + + ReferenceType mainthreadClass = null; + ReferenceType thread2Class = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2Class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + + + log2(" getting a ThreadGroupReference object for main tested group"); + group1 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(parentName)); + + log2(" getting a ThreadGroupReference object for subgroup"); + group2 = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(group2Name)); + + + List threads = null; + + log2(" checking up sizes of Lists of thread groups returned"); + threads = group2.threads(); + if (threads.size() != 1) { + log3("ERROR: threads.size() != 1 for group2: " + threads.size() ); + expresult = 1; + } + threads = group1.threads(); + if (threads.size() < 2) { + log3("ERROR: threads.size() < 2 for group1 : " + threads.size() ); + expresult = 1; + } + + log2(" checking up names of threads 'main' and 'Thread2' in List returned"); + ListIterator li = threads.listIterator(); + int nMain = 0; + int nThread2 = 0; + for ( int i2 = 0; li.hasNext(); i2++ ) { + String s1 = ( (ThreadReference) li.next()).name(); + if (s1.equals("main")) + nMain += 1; + if (s1.equals("Thread2")) + nThread2 += 1; + } + if (nMain != 1) { + log3("ERROR: # of 'main' threads != 1 : " + nMain); + expresult = 1; + } + if (nThread2 != 1) { + log3("ERROR: # of 'Thread2' threads != 1 : " + nThread2); + expresult = 1; + } + + log2(" instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001/TestDescription.java new file mode 100644 index 00000000000..6b55f8bc21f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/ThreadGroupReference/threads/threads001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadGroupReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadGroupReference.threads() + * complies with its spec: + * public List threads() + * Returns a List containing each ThreadReference in this thread group. + * Only the threads in this immediate thread group (and not its subgroups) + * are returned. + * Returns: a List of ThreadReference objects mirroring + * the threads from this thread group in the target VM. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadGroupReference.threads.threads001; + * the debuggee program - nsk.jdi.ThreadGroupReference.threads.threads001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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 4475063, the following correction in file threads001.java are made : + * - new check on + * threads = group1.threads(); + * if (threads.size() < 2) { + * - the check on only two names, "main" and "Thread2", is replaced with the loop + * in which these two names are detected. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadGroupReference.threads.threads001 + * nsk.jdi.ThreadGroupReference.threads.threads001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.threads.threads001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001a.java new file mode 100644 index 00000000000..f316fcf8fc2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001a.java @@ -0,0 +1,212 @@ +/* + * 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.ThreadGroupReference.threads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the threads001 JDI test. + */ + +public class threads001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static final String mainthreadGroupName = "mainthreadGroup"; + public static final String threadGroup2Name = "threadGroup2"; + + public static ThreadGroup mainthreadGroupObj = new ThreadGroup(mainthreadGroupName); + public static ThreadGroup threadGroup2Obj = new ThreadGroup(threadGroup2Name); + + public static ThreadGroup mainParent = null; + + private static Threadthreads001a thread2 = null; + private static Threadthreads001a thread3 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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() { + + checkToString (debuggeeName, mainGroup); + + checkToString (testedClassName, thread2Group); + + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static Method methodByName (ReferenceType refType, String methodName) { + List methodList = refType.methodsByName(methodName); + if (methodList == null) return null; + + Method method = (Method) methodList.get(0); + return method; + } + + private static void checkToString (String className, String fieldName) { + display("Checking toString() method for " + + "\n\tclass: " + className + + "\n\tthread group: " + fieldName ); + + ReferenceType testedClass = debuggee.classByName(className); + + ThreadGroupReference threadGroupRef = null; + try { + threadGroupRef = (ThreadGroupReference)testedClass.getValue(testedClass.fieldByName(fieldName)); + } catch (Exception e) { + throw new Failure("Unexpected exception while getting ThreadGroupReference for " + fieldName + " : " + e.getMessage() ); + } + + String str = threadGroupRef.toString(); + if (str == null) { + complain("toString() returns null for " + threadGroupRef.name()); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for for " + threadGroupRef.name()); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() returns for " + threadGroupRef.name() + " : " + str); + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..da96b484749 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/ThreadGroupReference/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.ThreadGroupReference interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * a ThreadGroupReference mirror of a debuggee's thread group. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for ThreadGroupReference + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadGroupReference.toString.tostring001 + * nsk.jdi.ThreadGroupReference.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadGroupReference.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001a.java new file mode 100644 index 00000000000..ebc175a3dd4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001a.java @@ -0,0 +1,126 @@ +/* + * 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.ThreadGroupReference.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static ThreadGroup mainGroup = new ThreadGroup("mainThreadGroup"); + static ThreadGroup thread2Group = new ThreadGroup("thread2Group"); + + //------------------------------------------------------ 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); + try { + tostring001aThread thread2 = new tostring001aThread(thread2Group, "testedThread"); + display("thread2 is created"); + + synchronized (tostring001aThread.lockingObject) { + synchronized (tostring001aThread.waitnotifyObj) { + thread2.start(); + try { + tostring001aThread.waitnotifyObj.wait(); + } catch (InterruptedException ie) { + thread2.interrupt(); + throw new Failure("Unexpected InterruptedException while waiting for notifying."); + } + + pipe.println(tostring001.SIGNAL_READY); + receiveSignal(tostring001.SIGNAL_QUIT); + } + } + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class tostring001aThread extends Thread { + + public static Object waitnotifyObj = new Object(); + public static Object lockingObject = new Object(); + + private static ThreadGroup thread2Group = null; + + public tostring001aThread(ThreadGroup groupName, String threadName) { + super(groupName, threadName); + thread2Group = groupName; + } + + public void run() { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockingObject) {} + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001.java new file mode 100644 index 00000000000..d1447e7d91a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001.java @@ -0,0 +1,203 @@ +/* + * 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.ThreadReference._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * Test checks up ThreadReference methods for the following cases:
    + * - getValue(null)
    + * - getValues(null)
    + * - getValues(list with size = 0)
    + * - setValue(null, null)
    + * - setValue(field, null)
    + * - visibleVariableByName(null)
    + * - visibleVariableByName("")
    + * NullPointerException is expected for every test case + * except for the three last. + */ + +public class bounds001 { + + private final static String prefix = "nsk.jdi.ThreadReference._bounds_."; + private final static String debuggerName = prefix + "bounds001"; + private final static String debugeeName = debuggerName + "a"; + + public final static String SGNL_READY = "ready"; + public final static String SGNL_QUIT = "quit"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private int[] frameParam = {-1, Integer.MAX_VALUE, -1, -1}; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + bounds001 thisTest = new bounds001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + debugee.VM().suspend(); + ThreadReference thread = debugee.threadByName("main"); + + display("\nTEST BEGINS"); + display("==========="); + + display("stop(null)"); + try { + thread.stop(null); + complain("InvalidTypeException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(InvalidTypeException e) { + display("!!!expected InvalidTypeException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + display("popFrames(null)"); + try { + thread.popFrames(null); + complain("NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } catch(NullPointerException e) { + display("!!!expected NullPointerException"); + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + + int frameCount = 0; + try { + frameCount = thread.frameCount(); + } catch (IncompatibleThreadStateException e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + frameParam[2] = frameCount; + frameParam[3] = frameParam[2] + 1; + display("frame count: " + frameParam[2]); + display("---------------"); + + for (int i = 0; i < frameParam.length; i++) { + display("frame(" + frameParam[i] + ")"); + try { + thread.frame(frameParam[i]); + if (frameParam[i] < 0 || frameParam[i] >= frameCount) { + complain("IndexOutOfBoundsException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } else { + display("OK"); + } + } catch(IndexOutOfBoundsException e) { + if (frameParam[i] < 0 || frameParam[i] >= frameCount) { + display("!!!expected IndexOutOfBoundsException"); + } else { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + + for (int i = 0; i < frameParam.length; i++) { + for (int j = 0; j < frameParam.length; j++) { + display("frames(" + frameParam[i] + ", " + frameParam[j] + ")"); + try { + thread.frames(frameParam[i], frameParam[j]); + if (frameParam[i] < 0 || + frameParam[j] < 0 || + frameParam[i] >= frameCount || + frameParam[i] + frameParam[j] > frameCount) { + complain("IndexOutOfBoundsException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } else { + display("OK"); + } + } catch(IndexOutOfBoundsException e) { + if (frameParam[i] < 0 || + frameParam[j] < 0 || + frameParam[i] >= frameCount || + frameParam[i] + frameParam[j] > frameCount) { + display("!!!expected IndexOutOfBoundsException"); + } else { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch(Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + display(""); + } + } + display(""); + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001/TestDescription.java new file mode 100644 index 00000000000..d5ac645474f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/ThreadReference/_bounds_/bounds001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up the methods com.sun.jdi.ThreadReference + * for the following cases: + * - getValue(null) + * - getValues(null) + * - getValues(list with size = 0) + * - setValue(null, null) + * - setValue(field, null) + * - visibleVariableByName(null) + * - visibleVariableByName("") + * NullPointerException is expected for every test case except for + * the three last. + * In cases + * setValue(field, null) + * visibleVariableByName(null) + * visibleVariableByName("") + * no exception is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference._bounds_.bounds001 + * nsk.jdi.ThreadReference._bounds_.bounds001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference._bounds_.bounds001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001a.java new file mode 100644 index 00000000000..67d79abdafb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/_bounds_/bounds001a.java @@ -0,0 +1,49 @@ +/* + * 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.ThreadReference._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * bounds001a is deugee's part of the bounds001. + */ +public class bounds001a { + + 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(bounds001.SGNL_READY); + String instr = pipe.readln(); + if (instr.equals(bounds001.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java new file mode 100644 index 00000000000..6033e10f9bf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java @@ -0,0 +1,474 @@ +/* + * 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.ThreadReference.currentContendedMonitor; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.currentContendedMonitor()
    + * complies with its spec.
    + *
    + * The test checks up that if a target VM doesn't support
    + * this operation, that is, the method
    + * VirtualMachine.canGetCurrentContendedMonitor()
    + * returns false, and a thread in the target VM is suspended,
    + * invoking the method currentContendedMonitor() on the thread
    + * throws UnsupportedOperationException.
    + */ + +public class currentcm001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new currentcm001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.currentContendedMonitor.currentcm001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.currentContendedMonitor.Threadcurrentcm001a"; + + //String mName = "nsk.jdi.ThreadReference.currentContendedMonitor"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + //static EventRequestManager eventRManager = null; + //static EventQueue eventQueue = null; + //static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + //eventRManager = vm.eventRequestManager(); + //eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + //String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + //String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + + ObjectReference monitor = null; + + ListIterator listIterator = null; + List classes = null; + + //BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + + label0: { + + log2("getting ThreadReference objects"); + try { + allThreads = vm.allThreads(); +// classes = vm.classesByName(testedClassName); +// testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO 'main' thread ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + + if (expresult != 0 ) + break label1; + + log2(" suspending the main thread"); + mainThread.suspend(); + + log2("......checking up on canGetCurrentContendedMonitor()"); + if (!vm.canGetCurrentContendedMonitor()) { + log2(" !vm.canGetCurrentContendedMonitor()"); + log2("......checking up throwing UnsupportedOperationException"); + try { + monitor = mainThread.currentContendedMonitor(); + log3("ERROR: no UnsupportedOperationException thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException is thrown"); + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for a suspended thread"); + expresult = returnCode1; + } catch ( Exception e3 ) { + log3("ERROR: unspecified Exception is thrown" + e3); + expresult = returnCode1; + } + } + log2(" resuming the main thread"); + mainThread.resume(); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ +/* + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } +*/ + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ +/* + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +*/ +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001/TestDescription.java new file mode 100644 index 00000000000..d69fd057714 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001/TestDescription.java @@ -0,0 +1,89 @@ +/* + * 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/ThreadReference/currentContendedMonitor/currentcm001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.currentContendedMonitor() + * complies with its spec: + * public ObjectReference currentContendedMonitor() + * throws IncompatibleThreadStateException + * Returns an ObjectReference for the monitor, if any, + * for which this thread is currently waiting. + * The thread can be waiting for a monitor through entry into + * a synchronized method, the synchronized statement, or Object.wait(long). + * The status() method can be used to differentiate between + * the first two cases and the third. + * Not all target virtual machines support this operation. + * Use VirtualMachine.canGetCurrentContendedMonitor() to determine if + * the operation is supported. + * Returns: the ObjectReference corresponding to the contended monitor, or + * null if it is not waiting for a monitor. + * Throws: java.lang.UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * IncompatibleThreadStateException - + * if the thread is not suspended in the target VM + * ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadGroupReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.currentContendedMonitor.currentcm001; + * the debuggee program - nsk.jdi.ThreadReference.currentContendedMonitor.currentcm001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.currentContendedMonitor.currentcm001 + * nsk.jdi.ThreadReference.currentContendedMonitor.currentcm001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.currentContendedMonitor.currentcm001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001a.java new file mode 100644 index 00000000000..298b7b408ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001a.java @@ -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.ThreadReference.currentContendedMonitor; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the currentcm001 JDI test. + */ + +public class currentcm001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + +// private static Threadcurrentcm001a thread2 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-totalThreadsCount") && (i < args.length - 1)) { + totalThreadsCount = Integer.parseInt(args[i + 1]); + + // if threads count is specified, test should take in account threads factor + totalThreadsCount *= stressOptions.getThreadsFactor(); + + i++; + } else if (args[i].equals("-iterationsNumber") && (i < args.length - 1)) { + baseIterationsNumber = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int totalThreadsCount = 1; + + private int baseIterationsNumber = 1; + + private TestExecutorThread testThread; + + // predefined in TestThread values to pass in forceEarlyReturn() + private Value testValues[]; + + private Value invalidValues[]; + + class TestExecutorThread extends Thread { + TestData testDataArray[]; + + private ThreadReference thread; + + public TestExecutorThread(ReferenceType testedThreadReferenceType, String threadName) { + thread = debuggee.threadByName(threadName); + + testDataArray = new TestData[ForceEarlyReturnTestThread.testedTypesNames.length]; + + for (int i = 0; i < testDataArray.length; i++) { + testDataArray[i] = new TestData(testedThreadReferenceType, + ForceEarlyReturnTestThread.testedTypesNames[i] + "Method", + ForceEarlyReturnTestThread.breakpointLines[i], thread, testValues[i], invalidValues[i]); + } + } + + public void run() { + stresser.start(baseIterationsNumber); + try { + /* + * In this test exit loop condition should be checked before + * resuming test thread + */ + while (true) { + /* + * In this test single iteration is test forceEarlyReturn using + * all elements of testDataArray + */ + stresser.iteration(); + + boolean stopExecution = false; + + for (int i = 0; i < testDataArray.length; i++) { + testForceEarlyReturn(testDataArray[i]); + + // check exit loop condition before resuming test thread + stopExecution = !stresser.continueExecution() || (stresser.getIterationsLeft() == 0); + + if (stopExecution) { + log.display("Execution finished, stopping test threads"); + + /* + * When test completed debuggee should call for test thread + * ForceEstopExecution.stopExecution() before this thread is resumed + */ + pipe.println(forceEarlyReturn001a.COMMAND_STOP_TEST_THREADS); + + if (!isDebuggeeReady()) + return; + + thread.resume(); + + break; + } else { + thread.resume(); + } + } + + if (stopExecution) + break; + } + } finally { + stresser.finish(); + } + + log.display("Waiting for test threads finishing"); + + pipe.println(forceEarlyReturn001a.COMMAND_JOIN_TEST_THREADS); + + if (!isDebuggeeReady()) + return; + } + + private void testForceEarlyReturn(TestData testData) { + BreakpointEvent breakPointEvent = waitForBreakpoint(testData.breakpointRequest); + + try { + log.display("Calling forceEarlyReturn with incompatible value: " + testData.incompatibleValue); + + thread.forceEarlyReturn(testData.incompatibleValue); + setSuccess(false); + log.complain("Expected InvalidTypeException was not thrown, method: " + testData.methodName); + } catch (InvalidTypeException e) { + // expected exception + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e + ", method: " + testData.methodName); + e.printStackTrace(System.out); + } + + try { + log.display("Calling forceEarlyReturn with value: " + testData.returnValue); + breakPointEvent.thread().forceEarlyReturn(testData.returnValue); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e + ", method: " + testData.methodName); + e.printStackTrace(System.out); + } + + testMethodExitEvent(thread, testData.methodName, false); + } + } + + // initialize Values objects to pass in forceEarlyReturn() + protected void initTestValues() { + ReferenceType referenceType = debuggee.classByName(ForceEarlyReturnTestThread.class.getName()); + + Value voidValue = createVoidValue(); + + if (voidValue == null) { + setSuccess(false); + log.complain("Can't create void value"); + return; + } + + testValues = new Value[ForceEarlyReturnTestThread.testedTypesNames.length + 1]; + invalidValues = new Value[ForceEarlyReturnTestThread.testedTypesNames.length + 1]; + + testValues[0] = voidValue; + + for (int i = 1; i < ForceEarlyReturnTestThread.testedTypesNames.length; i++) + testValues[i] = referenceType.getValue(referenceType.fieldByName("expected" + + ForceEarlyReturnTestThread.testedTypesNames[i] + "Value")); + + for (int i = 0; i < ForceEarlyReturnTestThread.testedTypesNames.length; i++) { + invalidValues[i] = referenceType.getValue(referenceType.fieldByName("invalid" + + ForceEarlyReturnTestThread.testedTypesNames[i] + "Value")); + } + } + + private void startTestThread() { + ReferenceType referenceType = debuggee.classByName(ForceEarlyReturnTestThread.class.getName()); + + testThread = new TestExecutorThread(referenceType, forceEarlyReturn001a.baseTestThreadName + 0); + + testThread.start(); + } + + private void waitTestEnd() { + try { + testThread.join(); + } catch (InterruptedException e) { + unexpectedException(e); + } + } + + public void doTest() { + initTestValues(); + + pipe.println(forceEarlyReturn001a.COMMAND_START_AND_SUSPEND_TEST_THREADS + ":" + totalThreadsCount + ":" + + baseIterationsNumber * stressOptions.getIterationsFactor()); + + if (!isDebuggeeReady()) + return; + + startTestThread(); + + pipe.println(forceEarlyReturn001a.COMMAND_START_TEST_THREADS_EXECUTION); + + if (!isDebuggeeReady()) + return; + + waitTestEnd(); + + // delete all created breakpoints + for (TestData testData : testThread.testDataArray) { + debuggee.getEventRequestManager().deleteEventRequest(testData.breakpointRequest); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001a.java new file mode 100644 index 00000000000..9fac59836db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001a.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn001; + +import java.io.*; +import nsk.share.*; +import nsk.share.jpda.ForceEarlyReturnTestThread; +import nsk.share.jdi.*; + +public class forceEarlyReturn001a extends AbstractJDIDebuggee { + static { + try { + // load thread class to let debugger get ReferenceType for + // TestThread class + Class.forName(ForceEarlyReturnTestThread.class.getName()); + } catch (ClassNotFoundException e) { + System.out.println("ClassNotFoundException while loading test thread class: " + e); + e.printStackTrace(System.out); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + + public static void main(String args[]) { + new forceEarlyReturn001a().doTest(args); + } + + // start and suspend test threads to let debugger initialize breakpoints + // (debugger should obtain ThreadReference) + // command:threadsNumber:iterationsNumber + public static final String COMMAND_START_AND_SUSPEND_TEST_THREADS = "startAndSuspendTestThreads"; + + // let test threads continue execution + public static final String COMMAND_START_TEST_THREADS_EXECUTION = "startTestThreadsExecution"; + + // set flag 'stopExecution' for test threads + public static final String COMMAND_STOP_TEST_THREADS = "stopTestThreads"; + + // wait for test threads finishing + public static final String COMMAND_JOIN_TEST_THREADS = "joinTestThreads"; + + // base name for test threads, test thread should be named + // 'baseTestThreadName + threadIndex' + public static final String baseTestThreadName = "forceEarlyReturn001aTestThread_"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(command)); + tokenizer.whitespaceChars(':', ':'); + + try { + if (command.startsWith(COMMAND_START_AND_SUSPEND_TEST_THREADS)) { + tokenizer.nextToken(); + + if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) + throw new TestBug("Invalid command format: " + command); + + int threadsCount = (int) tokenizer.nval; + + if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) + throw new TestBug("Invalid command format: " + command); + + int iterationsNumber = (int) tokenizer.nval; + + startTestThreads(threadsCount, iterationsNumber); + + return true; + } else if (command.equals(COMMAND_START_TEST_THREADS_EXECUTION)) { + startTestThreadsExecution(); + + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREADS)) { + stopTestThreads(); + + return true; + } else if (command.equals(COMMAND_JOIN_TEST_THREADS)) { + joinTestThreads(); + + return true; + } + } catch (IOException e) { + throw new TestBug("Invalid command format: " + command); + } + + return false; + } + + private ForceEarlyReturnTestThread testThreads[]; + + private void startTestThreads(int threadsCount, int iterationsNumber) { + testThreads = new ForceEarlyReturnTestThread[threadsCount]; + + for (int i = 0; i < threadsCount; i++) { + testThreads[i] = new ForceEarlyReturnTestThread(log, (i == 0), iterationsNumber); + testThreads[i].setName(baseTestThreadName + i); + + // testThreads[i] should wait in beginning of run() + testThreads[i].start(); + } + } + + private void startTestThreadsExecution() { + if (testThreads == null) { + throw new TestBug("Test threads weren't started"); + } + + // let test threads continue execution + for (int i = 0; i < testThreads.length; i++) + testThreads[i].startExecuion(); + } + + private void stopTestThreads() { + if (testThreads == null) { + throw new TestBug("Test threads weren't started"); + } + + for (int i = 0; i < testThreads.length; i++) { + testThreads[i].stopExecution(); + } + } + + private void joinTestThreads() { + if (testThreads == null) { + throw new TestBug("Test threads weren't started"); + } + + for (int i = 0; i < testThreads.length; i++) { + try { + testThreads[i].join(); + } catch (InterruptedException e) { + unexpectedException(e); + } + + if (!testThreads[i].getSuccess()) + setSuccess(false); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java new file mode 100644 index 00000000000..7a19c6f966b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - attempt to call forceEarlyReturn for the type which has not yet been loaded throws ClassNotLoadedException + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Debugger VM enable breakpoint in test method which return type is 'nsk.share.jdi.TestClass1', + * force debugee call this method and when debugee VM stop at breakpoint, call forceEarlyReturn(). + * ClassNotLoadedException should be thrown (expect that nsk.share.jdi.TestClass1 isn't loaded in debuggee VM). + * Debugger VM force debuggee VM create instance of 'nsk.share.jdi.TestClass1' and call test method again. + * When debugee VM stop at breakpoint, call forceEarlyReturn() and check that no exception is thrown. + * Debugee checks that correct value is returned from test method after force return. + * Debugger checks that MethodExitEvent is generated after forceEarlyReturn. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002; + +import java.io.PrintStream; +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn002 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return forceEarlyReturn002a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn002().runIt(argv, out); + } + + public void doTest() { + // initialize breakpoint + + ReferenceType referenceType = debuggee.classByName(ClassUsingTestClass.class.getName()); + + BreakpointRequest breakpointRequest = debuggee.makeBreakpoint(referenceType, + ClassUsingTestClass.breakpointMethodName, + ClassUsingTestClass.breakpointLine); + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.enable(); + + pipe.println(forceEarlyReturn002a.COMMAND_CALL_OBJECT_METHOD); + + BreakpointEvent breakPointEvent = waitForBreakpoint(breakpointRequest); + + // if no breakpoint happened then test failed, stop testing + if (breakPointEvent == null) + return; + + /* + * Test can't guarantee that TestClass1 isn't loaded in the debuggee VM (it isn't loaded + * if VM implements lazy loading). Here test checks that TestClass1 isn't loaded and + * if class is really absent in the debuggee VM it is possible to check ClassNotLoadedException. + */ + boolean testClassIsLoaded = false; + + ClassLoaderReference classLoader = debuggee.classByName(forceEarlyReturn002a.class.getName()).classLoader(); + for (ReferenceType loadedClass : classLoader.visibleClasses()) { + if (loadedClass.name().equals("nsk.share.jdi.TestClass1")) { + log.display("WARNING: TestClass1 is loaded in the debuggee VM, can't test ClassNotLoadedException"); + testClassIsLoaded = true; + break; + } + } + + ThreadReference threadReference = debuggee.threadByName(forceEarlyReturn002a.mainThreadName); + + try { + if (testClassIsLoaded) { + threadReference.forceEarlyReturn(null); + } else { + try { + threadReference.forceEarlyReturn(threadReference); + setSuccess(false); + log.complain("Expected 'ClassNotLoadedException' was not thrown"); + } catch (ClassNotLoadedException e) { + log.display("Got expected ClassNotLoadedException"); + } + } + } catch (Exception e) { + unexpectedException(e); + } + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + + // after this command test class should be loaded + pipe.println(forceEarlyReturn002a.COMMAND_LOAD_CLASS_AND_CALL_OBJECT_METHOD); + + breakPointEvent = waitForBreakpoint(breakpointRequest); + + // if no breakpoint happened then test failed, stop testing + if (breakPointEvent == null) + return; + + // get value for early return + ObjectReference returnValue = (ObjectReference) referenceType.getValue(referenceType.fieldByName("expectedValue")); + + try { + // don't expect any exception + threadReference.forceEarlyReturn(returnValue); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + testMethodExitEvent(threadReference, ClassUsingTestClass.breakpointMethodName); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java new file mode 100644 index 00000000000..d06ed40322f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn002; + +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/* + * Methods using TestClass1 were moved to the special class ClassUsingTestClass because of when these methods were in + * the forceEarlyReturn002a class TestClass1 were loaded together with forceEarlyReturn002a but + * this test expects that TestClass1 isn't loaded until method createExpectedValue() isn't called (see 6758252). + * + * NOTE: edit this file carefully, breakpoint line number is hardcoded + */ +class ClassUsingTestClass { + + public static final int breakpointLine = 45; + + public static final String breakpointMethodName = "testClassMethod"; + + static Object expectedValue; + + TestClass1 testClassMethod() { + System.out.println("Inside testClassMethod()"); // breakpointLine + + return null; + } + + void createExpectedValue() { + expectedValue = new TestClass1(); + } +} + +public class forceEarlyReturn002a extends AbstractJDIDebuggee { + + private ClassUsingTestClass classUsingTestClass = new ClassUsingTestClass(); + + public String[] doInit(String args[]) { + args = super.doInit(args); + + Thread.currentThread().setName(mainThreadName); + + return args; + } + + public static String mainThreadName = "MainThread"; + + // call testClassMethod() + public final static String COMMAND_CALL_OBJECT_METHOD = "callObjectMethod"; + + // load TestClass1 and call testClassMethod() + public final static String COMMAND_LOAD_CLASS_AND_CALL_OBJECT_METHOD = "testObjectMethod"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_CALL_OBJECT_METHOD)) { + classUsingTestClass.testClassMethod(); + return true; + } else if (command.equals(COMMAND_LOAD_CLASS_AND_CALL_OBJECT_METHOD)) { + classUsingTestClass.createExpectedValue(); + Object value = classUsingTestClass.testClassMethod(); + + if (ClassUsingTestClass.expectedValue != value) { + setSuccess(false); + log.complain("Unexpected result of testClassMethod: " + value); + } + + return true; + } + + return false; + } + + public static void main(String[] args) { + new forceEarlyReturn002a().doTest(args); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn003/forceEarlyReturn003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn003/forceEarlyReturn003.java new file mode 100644 index 00000000000..8ccbabec479 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn003/forceEarlyReturn003.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - attempt to call forceEarlyReturn on not suspended thread throws IncompatibleThreadStateException + * Test scenario: + * Special thread class is used in debugee VM for testing thread in different states - nsk.share.jpda.StateTestThread. + * StateTestThread sequentially changes its state in following order: + * - thread not started + * - thread is running + * - thread is sleeping + * - thread in Object.wait() + * - thread wait on java monitor + * - thread is finished + * Debugger VM calls ThreadReference.forceEarlyReturn() for all this states and expects IncompatibleThreadStateException. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003; + +import java.io.PrintStream; +import com.sun.jdi.IncompatibleThreadStateException; +import com.sun.jdi.ThreadReference; +import nsk.share.Consts; +import nsk.share.jdi.*; +import nsk.share.jpda.*; + +public class forceEarlyReturn003 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return AbstractJDIDebuggee.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn003().runIt(argv, out); + } + + public void test(ThreadReference threadReference) { + log.display("Thread state: " + threadReference.status()); + try { + // call ThreadReference.forceEarlyReturn() on non-suspended VM + // IncompatibleThreadStateException should be thrown + threadReference.forceEarlyReturn(vm.mirrorOf(0)); + + setSuccess(false); + log.complain("Expected IncompatibleThreadStateException was not thrown"); + } catch (IncompatibleThreadStateException e) { + // expected exception + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(System.out); + } + } + + public void doTest() { + pipe.println(AbstractDebuggeeTest.COMMAND_CREATE_STATETESTTHREAD); + + if (!isDebuggeeReady()) + return; + + ThreadReference threadReference = (ThreadReference) debuggee.classByName(AbstractDebuggeeTest.stateTestThreadClassName).instances(0).get(0); + + test(threadReference); + + int state = 1; + + while (state++ < StateTestThread.stateTestThreadStates.length) { + pipe.println(AbstractDebuggeeTest.COMMAND_NEXTSTATE_STATETESTTHREAD); + + if (!isDebuggeeReady()) + return; + + test(threadReference); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004.java new file mode 100644 index 00000000000..d2e690375de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn004. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - attempt to call com.sun.jdi.forceEarlyReturn for native Java method throws NativeMethodException + * Test scenario: + * Debugger VM force debuggee VM start test thread which execute infinite loop in native method, debugger suspend + * debuggee VM and try call forceEarlyReturn() for test thread, NativeMethodException should be thrown. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004a + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004; + +import java.io.PrintStream; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn004 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn004().runIt(argv, out); + } + + public void doTest() { + pipe.println(forceEarlyReturn004a.COMMAND_STOP_THREAD_IN_NATIVE); + + if (!isDebuggeeReady()) + return; + + // this thread execute native method + ThreadReference threadReference = debuggee.threadByName(forceEarlyReturn004a.testThreadInNativeName); + + vm.suspend(); + + try { + // expect NativeMethodException + threadReference.forceEarlyReturn(vm.mirrorOf(0)); + setSuccess(false); + log.complain("Expected 'NativeMethodException' exception was not thrown"); + } catch (NativeMethodException e) { + // expected exception + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + vm.resume(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004a.java new file mode 100644 index 00000000000..5c12fe0495d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004a.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn004; + +import nsk.share.Consts; +import nsk.share.jdi.*; + +public class forceEarlyReturn004a extends AbstractJDIDebuggee { + static { + try { + System.loadLibrary("forceEarlyReturn004a"); + } catch (UnsatisfiedLinkError e) { + System.out.println("UnsatisfiedLinkError when load library 'forceEarlyReturn004a'"); + e.printStackTrace(System.out); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + + public static void main(String args[]) { + new forceEarlyReturn004a().doTest(args); + } + + public final static String testThreadInNativeName = "forceEarlyReturn004aTestThreadInNative"; + + public final static String COMMAND_STOP_THREAD_IN_NATIVE = "stopInNative"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_STOP_THREAD_IN_NATIVE)) { + stopThreadInNative(); + return true; + } else + + return false; + } + + private Thread testThreadInNative; + + private void stopThreadInNative() { + testThreadInNative = new Thread(new Runnable() { + public void run() { + Thread.currentThread().setName(testThreadInNativeName); + log.display("Enter native method"); + nativeMethod(forceEarlyReturn004a.this); + } + }); + + testThreadInNative.start(); + + while (!threadInNative) + Thread.yield(); + } + + public volatile boolean threadInNative; + + private static native int nativeMethod(Object object); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.c b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.c new file mode 100644 index 00000000000..1f97882dfac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2007, 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. + */ + +#include "jni.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef JNI_ENV_PTR + +#ifdef __cplusplus +#define JNI_ENV_ARG_2(x, y) y +#define JNI_ENV_ARG_3(x, y, z) y, z +#define JNI_ENV_ARG_4(x, y, z, a) y, z, a +#define JNI_ENV_PTR(x) x +#else +#define JNI_ENV_ARG_2(x,y) x, y +#define JNI_ENV_ARG_3(x, y, z) x, y, z +#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a +#define JNI_ENV_PTR(x) (*x) +#endif + +#endif + +int always_true = 1; + +JNIEXPORT jint JNICALL +Java_nsk_jdi_ThreadReference_forceEarlyReturn_forceEarlyReturn004_forceEarlyReturn004a_nativeMethod(JNIEnv *env, jobject classObject, jobject object) +{ + int dummy_counter = 0; + // notify another thread that thread in native method + jclass klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, object)); + jfieldID field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, klass, "threadInNative", "Z")); + JNI_ENV_PTR(env)->SetBooleanField(JNI_ENV_ARG_4(env, object, field, 1)); + + // execute infinite loop to be sure that thread in native method + while(always_true) + { + // Need some dummy code so the optimizer does not remove this loop. + dummy_counter = dummy_counter < 1000 ? 0 : dummy_counter + 1; + } + // The optimizer can be surprisingly clever. + // Use dummy_counter so it can never be optimized out. + // This statement will always return 0. + return dummy_counter >= 0 ? 0 : 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005.java new file mode 100644 index 00000000000..7b2bfdf84c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn005. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - after force return occurred any locks acquired by calling the called method(if it is a synchronized method) + * and locks acquired by entering synchronized blocks within the called method are released in Debuggee VM. + * Also checks that this does not apply to JNI locks or java.util.concurrent.locks locks. + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Special thread class 'TestThread' is used in debugee VM. This class contains following test method: + * - it is synchronized method + * - JNI lock is acquired in this method + * - java.util.concurrent.locks.ReentrantLock is acquired in this method + * - at the end the method contains synchronized block + * Debugger initialize breakpoint in test method(inside the synchronized block) and force debugee VM run test + * thread which call this method. When debuggee's test thread stop at breakpoint debugger call forceEarlyReturn() + * and resume debuggee VM. + * Debugee's test thread after force return check that locks acquired through synchronized method and synchronized block + * was freed and JNI lock and java.util.concurrent.locks.ReentrantLock still locked. + * Also debugger checks that MethodExitEvent is generated after forceEarlyReturn. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005a + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005; + +import java.io.PrintStream; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.ThreadReference; +import com.sun.jdi.event.BreakpointEvent; +import com.sun.jdi.request.BreakpointRequest; +import com.sun.jdi.request.EventRequest; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn005 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn005().runIt(argv, out); + } + + public void doTest() { + // init breakpont in tested method + ReferenceType referenceType = debuggee.classByName( + nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.TestThread.class.getName()); + + BreakpointRequest breakpointRequest = debuggee.makeBreakpoint(referenceType, + TestThread.BREAKPOINT_METHOD_NAME, + TestThread.BREAKPOINT_LINE); + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.enable(); + + // start test thread + pipe.println(forceEarlyReturn005a.COMMAND_RUN_TEST_THREAD); + + BreakpointEvent event = waitForBreakpoint(breakpointRequest); + + ThreadReference threadReference = event.thread(); + + try { + // call forceEarlyReturn, all asserts should be done in debuggee + threadReference.forceEarlyReturn(vm.mirrorOf(0)); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + testMethodExitEvent(threadReference, TestThread.BREAKPOINT_METHOD_NAME); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005a.java new file mode 100644 index 00000000000..53bf9b601a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005a.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn005; + +import java.util.concurrent.locks.ReentrantLock; +import nsk.share.Consts; +import nsk.share.Log; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +class TestThread extends Thread { + // lock acquired through synchronized block + private Object javaLock = new Object(); + + // lock acquired through JNI MonitorEnter + private Object nativeLock = new Object(); + + // java.util.concurrent.ReentrantLock + private ReentrantLock reentrantLock = new ReentrantLock(); + + private forceEarlyReturn005a testObject; + + public TestThread(forceEarlyReturn005a testObject) { + this.testObject = testObject; + } + + public void run() { + // forceEarlyReturn() should be called for methodForEarlyReturn() + methodForEarlyReturn(); + + // check that after forceEarlyReturn() thread released locks acquired through synchronized method and synchronized block + // and didn't release native lock and java.util.concurrent.ReentrantLock + if (holdsLock(this)) { + testObject.setSuccess(false); + testObject.log().complain("Test thread didn't release lock(synchronized method): " + this); + } + if (holdsLock(javaLock)) { + testObject.setSuccess(false); + testObject.log().complain("Test thread didn't release lock(synchronized block): " + javaLock); + } + if (!holdsLock(nativeLock)) { + testObject.setSuccess(false); + testObject.log().complain("Test thread release native lock: " + nativeLock); + } + if (!reentrantLock.isLocked()) { + testObject.setSuccess(false); + testObject.log().complain("Test thread release reentrant lock: " + reentrantLock); + } + } + + static public final int BREAKPOINT_LINE = 83; + + static public final String BREAKPOINT_METHOD_NAME = "methodForEarlyReturn"; + + public synchronized int methodForEarlyReturn() { + // acquire all locks: + + forceEarlyReturn005a.nativeJNIMonitorEnter(nativeLock); + + reentrantLock.lock(); + + synchronized (javaLock) { + testObject.log().display(getName() + " in methodForEarlyReturn"); // BREAKPOINT_LINE + } + + return 0; + } +} + +public class forceEarlyReturn005a extends AbstractJDIDebuggee { + static { + try { + System.loadLibrary("forceEarlyReturn005a"); + } catch (UnsatisfiedLinkError e) { + System.out.println("UnsatisfiedLinkError when load library 'forceEarlyReturn005a'"); + ; + e.printStackTrace(System.out); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + + try { + // load thread class to let debugger get ReferenceType for TestThread class + Class.forName("nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.TestThread"); + } catch (ClassNotFoundException e) { + System.out.println("ClassNotFoundException when load test thread class: " + e); + e.printStackTrace(System.out); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + + public static void main(String args[]) { + new forceEarlyReturn005a().doTest(args); + } + + static public final String testThreadName = "forceEarlyReturn004aTestThread"; + + static public final String COMMAND_RUN_TEST_THREAD = "runTestThread"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_RUN_TEST_THREAD)) { + Thread testThread = new TestThread(this); + testThread.setName(testThreadName); + testThread.start(); + + return true; + } + + return false; + } + + // native method uses this class + private static final Class jniError = nsk.share.TestJNIError.class; + + static native void nativeJNIMonitorEnter(Object object); + + // access to log for TestThread + Log log() { + return log; + } + + // access to success status for TestThread + public void setSuccess(boolean value) { + super.setSuccess(value); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.c b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.c new file mode 100644 index 00000000000..da7a6469f29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007, 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. + */ + +#include "jni.h" +#include "nsk_tools.c" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef JNI_ENV_PTR + +#ifdef __cplusplus +#define JNI_ENV_ARG_2(x, y) y +#define JNI_ENV_ARG_3(x,y,z) y, z +#define JNI_ENV_PTR(x) x +#else +#define JNI_ENV_ARG_2(x,y) x, y +#define JNI_ENV_ARG_3(x,y,z) x, y, z +#define JNI_ENV_PTR(x) (*x) +#endif + +#endif + +JNIEXPORT void JNICALL +Java_nsk_jdi_ThreadReference_forceEarlyReturn_forceEarlyReturn005_forceEarlyReturn005a_nativeJNIMonitorEnter(JNIEnv *env, jobject classObject, jobject object) +{ + jint success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, object)); + + if(success != 0) + { + NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success); + + JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero")); + } +} + +#ifdef __cplusplus +} +#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn006/TestDescription.java new file mode 100644 index 00000000000..b38b6ffb3a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn006/TestDescription.java @@ -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/ThreadReference/forceEarlyReturn/forceEarlyReturn006. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for com.sun.jdi.forceEarlyReturn(Value value). + * The test do the same as forceEarlyReturn001, but do all checks 1000 times. + * Test scenario: + * Debuggee VM start thread(class nsk.share.jpda.ForceEarlyReturnTestThread is used) which in + * loop 1000 times sequentially call test methods with different return value type: + * - void + * - all primitive types + * - String + * - Object + * - array of java.lang.Object + * - Thread + * - ThreadGroup + * - Class object + * - ClassLoader + * Debugger VM set breakpoints in all this methods and wait while BreakpointEvent occurs. When debuggee's + * test thread stop at breakpoint debugger call forceEarlyReturn() with follows parameters: + * - try pass incompatible value to forceEarlyReturn (expect InvalidTypeException) + * - force thread return with value defined at test thread class + * Test thread in debuggee VM check that value returned from test methods equals predefined value and no + * instructions was executed in called method after force return (finally blocks are not executed too). + * Debugger checks that MethodExit is generated after forceEarlyReturn. + * Debugger performs all this check for each tested method 1000 times. + * This test execute test 'nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001' with follows parameters '-iterationsNumber 1000'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -iterationsNumber 100 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn007/TestDescription.java new file mode 100644 index 00000000000..6097dd4adfa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn007/TestDescription.java @@ -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/ThreadReference/forceEarlyReturn/forceEarlyReturn007. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for com.sun.jdi.forceEarlyReturn(Value value). + * The test do the same as forceEarlyReturn001, but do all checks 100 times and + * with multiple number of threads in debuggee VM. + * Test scenario: + * Debuggee VM start multiple number of threads(class nsk.share.jpda.ForceEarlyReturnTestThread is used) which + * sequentially call test methods with different return value type: + * - void + * - all primitive types + * - String + * - Object + * - array of java.lang.Object + * - Thread + * - ThreadGroup + * - Class object + * - ClassLoader + * One of this threads is intended for force early return and call test method in loop 100 times, another threads + * execute until not stoped. + * Debugger VM create breakpoint requests for all this methods and add breakpoint request's filter only for + * thread which intended for force early return. When debuggee's test thread stop at breakpoint debugger call + * forceEarlyReturn() with follows parameters: + * - try pass incompatible value to forceEarlyReturn (expect InvalidTypeException) + * - force thread return with value defined at test thread class + * Test thread in debuggee VM intended for force return check that value returned from test methods equals predefined + * value and no instructions was executed in called method after force return (finally blocks are not executed too). + * Another debuggee's threads check that values returned from test methods aren't affected by force return. + * Debugger check that MethodExitEvent is generated after forceEarlyReturn. + * Debugger perform all this check for each tested method 100 times. + * This test execute test 'nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001' with follows parameters: '-iterationsNumber 100 -totalThreadsCount 20' + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -iterationsNumber 50 + * -totalThreadsCount 3 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008.java new file mode 100644 index 00000000000..abd6cac0d8c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - after force return no extra StepEvent events are generated + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Following thread class is used in debuggee VM: + * 1 class TestThread + * 2 extends Thread + * 3 { + * 4 public void run() + * 5 { + * 6 methodForEarlyReturn(); + * 7 } + * 8 + * 9 public int methodForEarlyReturn() + * 10 { + * 11 // next line for breakpoint + * 12 int i = 0; + * 13 + * 14 // dummy code, test thread shouldn't execute this code and StepEvents shouldn't be generated for this code + * 15 for(i = 0; i < 100; i++) + * 16 { + * 17 int j = 0; + * 18 j = j + i; + * 19 } + * 20 + * 21 return 0; + * 22 } + * 23 } + * Debugger set breakpoint in TestThread.methodForEarlyReturn() at line marked in this description as 12 and force debugee + * start this thread. + * When test thread stop at breakpoint debuggeer initializes StepRequest for this thread, starts event listener thread + * which counting StepEvents, call forceEarlyReturn for test thread and resume debuggee VM. + * Then, debugger waits when debuggee's test thread finish execution and check that number of received step events + * is equal 2: + * - 1st step: thread exit from methodForEarlyReturn() + * - 2ns step: thread exit from run() + * Also debugger checks that MethodExitEvent is generated after forceEarlyReturn. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008; + +import java.io.PrintStream; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.EventHandler; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn008 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn008().runIt(argv, out); + } + + // event listener which counts StepEvents and checks is MethodExitEvent was generated + public class EventsListener extends EventHandler.EventListener { + int totalStepEvents; + + boolean methodExitEventReceived; + + public boolean eventReceived(Event event) { + if (event instanceof StepEvent) { + log.display(++totalStepEvents + " " + ((StepEvent) event)); + + if (!(((StepEvent) event).location().method().name().equals("run"))) { + setSuccess(false); + log.complain("Event was generated for unexpected method: " + ((StepEvent) event).location().method()); + } + + vm.resume(); + + return true; + } + if (event instanceof MethodExitEvent) { + if (((MethodExitEvent) event).method().name().equals(forceEarlyReturn008a.breakpointMethod)) { + methodExitEventReceived = true; + } + + return true; + } + + return false; + } + } + + public void doTest() { + // set breakpoint in TestThread.intMethod + BreakpointRequest breakpointRequest; + + breakpointRequest = debuggee.makeBreakpoint(debuggee.classByName(forceEarlyReturn008a.TestThread.class.getName()), + forceEarlyReturn008a.breakpointMethod, forceEarlyReturn008a.breakpointLine); + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.enable(); + + // force debuggee start TestThread + pipe.println(forceEarlyReturn008a.COMMAND_START_TEST_THREAD); + + waitForBreakpoint(breakpointRequest); + + ThreadReference threadReference = debuggee.threadByName(forceEarlyReturn008a.testThreadName); + + // initialize step request for TestThread + StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest(threadReference, StepRequest.STEP_LINE, StepRequest.STEP_INTO); + stepRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + stepRequest.addClassFilter(debuggee.classByName(forceEarlyReturn008a.TestThread.class.getName())); + stepRequest.enable(); + + EventHandler eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + // add event listener + EventsListener eventListener = new EventsListener(); + eventHandler.addListener(eventListener); + + // create MethodExitRequest for tested thread + MethodExitRequest methodExitRequest; + methodExitRequest = debuggee.getEventRequestManager().createMethodExitRequest(); + methodExitRequest.addThreadFilter(threadReference); + methodExitRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE); + methodExitRequest.enable(); + + try { + threadReference.forceEarlyReturn(vm.mirrorOf(0)); + } catch (Throwable t) { + setSuccess(false); + t.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + t); + } + + vm.resume(); + + // wait READY signal for previous command 'forceEarlyReturn008a.COMMAND_START_TEST_THREAD' + if (!isDebuggeeReady()) + return; + + pipe.println(forceEarlyReturn008a.COMMAND_JOIN_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + + // expect only 2 step events: + // - exit from methodForEarlyReturn() + // - exit from run() + if (eventListener.totalStepEvents != 2) { + setSuccess(false); + log.complain("Unexpected number of step events: " + eventListener + ", only 2 is expected"); + } + + if (!eventListener.methodExitEventReceived) { + setSuccess(false); + log.complain("MethodExit event wasn't generated"); + } + + eventHandler.stopEventHandler(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008a.java new file mode 100644 index 00000000000..64851020209 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008a.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn008; + +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +public class forceEarlyReturn008a extends AbstractJDIDebuggee { + public static void main(String args[]) { + new forceEarlyReturn008a().doTest(args); + } + + class TestThread extends Thread { + public void run() { + methodForEarlyReturn(); + } + + public int methodForEarlyReturn() { + int i = 0; // breakpointLine + + // dummy code, test thread shouldn't execute this code and StepEvents shouldn't be generated for this code + for (i = 0; i < 100; i++) { + int j = 0; + j = j + i; + } + + return 0; + } + } + + public static final String testThreadName = "forceEarlyReturn008a_TestThread"; + + // start TestThread + public static final String COMMAND_START_TEST_THREAD = "startTestThread"; + + // wait when TestThread finish execution + public static final String COMMAND_JOIN_TEST_THREAD = "joinTestThread"; + + public static final String breakpointMethod = "methodForEarlyReturn"; + + public static final int breakpointLine = 39; + + private TestThread testThread = new TestThread(); + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_TEST_THREAD)) { + testThread.setName(testThreadName); + testThread.start(); + + return true; + } else if (command.equals(COMMAND_JOIN_TEST_THREAD)) { + try { + testThread.join(); + } catch (InterruptedException e) { + setSuccess(false); + e.printStackTrace(log.getOutStream()); + log.complain("Unexpected exception: " + e); + } + + return true; + } + + return false; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009.java new file mode 100644 index 00000000000..6b36a9381d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn009. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - forcing return on a thread with only one frame on the stack causes the thread to exit when resumed + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Debugger forces debuggee start test thread which executes infinite loop in it's run() method, so it always has + * only one frame on stack. Debugger suspends debuggee VM, call forceEarlyReturn() for test thread, resumes debuggee + * VM and checks that test thread has status ThreadReference.THREAD_STATUS_ZOMBIE(thread has completed execution) and + * checks that ThreadDeathEvent and MethodExitEvent was generated for test thread. + * Used in this test classes can be used to check forceEarlyReturn() behavior when + * thread has single frame on the stack because of methods which this thread calls were got inlined, + * in this case thread in it's run() in infinite loop calls methods which should be inlined. + * To check this case run test with parameter -inlineType , where is one of: + * - INLINE_METHOD_RETURNING_CONST, thread calls methods which return const values + * - INLINE_METHOD_ACCESSIN_INTERNAL_FIELDS, thread calls methods which access only internal fields + * - INLINE_HOT_METHOD, thread calls method which should be executed a certain number of times before it is compiled + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009; + +import java.io.PrintStream; +import java.util.ArrayList; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn009 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return forceEarlyReturn009a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn009().runIt(argv, out); + } + + private String inlineType; + + protected String[] doInit(String args[], PrintStream out) { + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-inlineType") && (i < args.length - 1)) { + inlineType = args[i + 1]; + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + public void doTest() { + if (inlineType != null) + pipe.println(forceEarlyReturn009a.COMMAND_RUN_THREAD_WITH_SINGLE_FRAME + ":" + inlineType); + else + pipe.println(forceEarlyReturn009a.COMMAND_RUN_THREAD_WITH_SINGLE_FRAME); + + if (!isDebuggeeReady()) + return; + + // this thread has one frame on stack + ThreadReference threadReference = debuggee.threadByName(forceEarlyReturn009a.testThreadWithSingleFrameName); + + Value voidValue = createVoidValue(); + + vm.suspend(); + + try { + // thread should exit when resumed + threadReference.forceEarlyReturn(voidValue); + } catch (InvalidTypeException e) { + // this exception could be thrown if inlining was not done, in this case stop test execution + if (inlineType != null) { + log.display("WARNING: InvalidTypeException was caught, possible inlining was not done, stop test execution"); + vm.resume(); + pipe.println(forceEarlyReturn009a.COMMAND_JOIN_THREAD_WITH_SINGLE_FRAME); + isDebuggeeReady(); + return; + } else { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + } catch (Throwable e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + // create request for ThreadDeathEvent + ThreadDeathRequest threadDeathRequest; + threadDeathRequest = debuggee.getEventRequestManager().createThreadDeathRequest(); + threadDeathRequest.addThreadFilter(threadReference); + threadDeathRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + threadDeathRequest.enable(); + + testMethodExitEvent(threadReference, "run", false); + + vm.resume(); + + EventListenerThread threadDeathEventListeningThread = new EventListenerThread(threadDeathRequest); + threadDeathEventListeningThread.start(); + threadDeathEventListeningThread.waitStartListen(); + + Event event = threadDeathEventListeningThread.getEvent(); + + if (event == null) { + setSuccess(false); + log.complain("ThreadDeath event wasn't generated"); + } + + vm.resume(); + + pipe.println(forceEarlyReturn009a.COMMAND_JOIN_THREAD_WITH_SINGLE_FRAME); + + if (!isDebuggeeReady()) + return; + + // check thread status + int threadStatus = threadReference.status(); + + if (threadStatus != ThreadReference.THREAD_STATUS_ZOMBIE) { + setSuccess(false); + log.complain("Unexpected status of test thread: " + threadStatus + ", expected is 'THREAD_STATUS_ZOMBIE'(" + + ThreadReference.THREAD_STATUS_ZOMBIE + ")"); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009a.java new file mode 100644 index 00000000000..43af687d133 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009a.java @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn009; + +import nsk.share.Log; +import nsk.share.jdi.*; + +public class forceEarlyReturn009a extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new forceEarlyReturn009a().doTest(args); + } + + public final static String testThreadWithSingleFrameName = "forceEarlyReturn009aTestThreadWithSingleFrame"; + + // command:[inlineType] + public final static String COMMAND_RUN_THREAD_WITH_SINGLE_FRAME = "runThreadWithSingleFrame"; + + public final static String COMMAND_JOIN_THREAD_WITH_SINGLE_FRAME = "joinThreadWithSingleFrame"; + + // type of inlined methods + enum InlineType { + // method return const values + INLINE_METHOD_RETURNING_CONST, + + // method access only internal fields + INLINE_METHOD_ACCESSIN_INTERNAL_FIELDS, + + // method which should be executed a certain number of times before it is compiled + INLINE_HOT_METHOD + } + + /* + * Thread can has single frame on the stack because of methods which this thread calls was inlined + * + * inlineType - type of inlined methods which test thread calls + */ + private InlineType inlineType; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.startsWith(COMMAND_RUN_THREAD_WITH_SINGLE_FRAME)) { + int index = command.indexOf(':'); + + if (index < 0) { + inlineType = null; + } else { + inlineType = InlineType.valueOf(command.substring(index + 1)); + log.display("InlineType: " + inlineType); + } + + runThreadWithSingleFrame(); + + return true; + } else if (command.equals(COMMAND_JOIN_THREAD_WITH_SINGLE_FRAME)) { + joinThreadWithSingleFrame(); + return true; + } + + return false; + } + + private ThreadWithSingleFrame threadWithSingleFrame; + + static class ThreadWithSingleFrame extends Thread { + + volatile boolean isSingleFrameThreadStarted; + + // this variable is used to stop thread with signle frame if debugger can't stop it by forceEarlyReturn + // (for example if inlining was not done) + volatile boolean isSingleFrameThreadStoped; + + private Log log; + + private InlineType inlineType; + + public ThreadWithSingleFrame(Log log, InlineType inlineType) { + this.log = log; + this.inlineType = inlineType; + + if (inlineType == InlineType.INLINE_HOT_METHOD) { + // call inlinedHotMethod1() and inlinedHotMethod2() 20000 times to be sure that this method was compiled/inlined + for (long i = 0; i < 20000; i++) { + inlinedHotMethod1(); + inlinedHotMethod2(); + } + } + + } + + private int internalField1; + + private int inlinedMethodAccessingInternalFields1() { + return internalField1++ + internalField2; + } + + private int internalField2; + + private int inlinedMethodAccessingInternalFields2() { + return internalField2++ + internalField1; + } + + private int inlinedMethodReturningInt() { + return 0; + } + + private boolean inlinedMethodReturningBoolean() { + return true; + } + + private Object inlinedMethodReturningObject() { + return null; + } + + public int publicField1; + + public int publicField2; + + public int inlinedHotMethod1() { + return publicField1++ + publicField2 * 2; + } + + public int inlinedHotMethod2() { + return publicField2++ + publicField1 * 2; + } + + public void run() { + Thread.currentThread().setName(testThreadWithSingleFrameName); + + log.display("Thread with single frame started"); + + // if inlineType was specified call methods which should be inlined + if (inlineType == InlineType.INLINE_METHOD_ACCESSIN_INTERNAL_FIELDS) { + while (!isSingleFrameThreadStoped) { + inlinedMethodAccessingInternalFields1(); + inlinedMethodAccessingInternalFields2(); + isSingleFrameThreadStarted = true; + } + } else if (inlineType == InlineType.INLINE_METHOD_RETURNING_CONST) { + while (!isSingleFrameThreadStoped) { + boolean bool = inlinedMethodReturningBoolean(); + int integer = inlinedMethodReturningInt(); + Object object = inlinedMethodReturningObject(); + isSingleFrameThreadStarted = true; + + } + } else if (inlineType == InlineType.INLINE_HOT_METHOD) { + while (!isSingleFrameThreadStoped) { + int temp = inlinedHotMethod1() + inlinedHotMethod2(); + isSingleFrameThreadStarted = true; + } + } else { + while (!isSingleFrameThreadStoped) + isSingleFrameThreadStarted = true; + } + } + } + + private void runThreadWithSingleFrame() { + threadWithSingleFrame = new ThreadWithSingleFrame(log, inlineType); + threadWithSingleFrame.start(); + + while (!threadWithSingleFrame.isSingleFrameThreadStarted) + Thread.yield(); + } + + private void joinThreadWithSingleFrame() { + try { + threadWithSingleFrame.isSingleFrameThreadStoped = true; + + threadWithSingleFrame.join(argHandler.getWaitTime() * 60000); + + if (threadWithSingleFrame.getState() != Thread.State.TERMINATED) { + setSuccess(false); + log.complain("ThreadWithSingleThread didn'f finish execution as expected"); + } + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn010/TestDescription.java new file mode 100644 index 00000000000..e7f5025b498 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn010/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ThreadReference/forceEarlyReturn/forceEarlyReturn010. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - forcing return on a thread with only one frame on the stack causes the thread to exit when resumed + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Test checks case when thread has single frame on the stack because of methods which this thread calls was inlined, + * Debugger VM forces debuggee VM start test thread which in it's run() method call in infinite loop + * methods which return const values, this methods should be inlined, so thread always has + * only one frame on stack. Debugger suspends debuggee VM, calls forceEarlyReturn() for test thread, resumes debuggee + * VM and checks that test thread has status ThreadReference.THREAD_STATUS_ZOMBIE(thread has completed execution) and + * checks that ThreadDeathEvent and MethodExitEvent was generated for test thread. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-XX:+Inline" + * -inlineType INLINE_METHOD_RETURNING_CONST + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn011/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn011/TestDescription.java new file mode 100644 index 00000000000..a120c3030ea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn011/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/ThreadReference/forceEarlyReturn/forceEarlyReturn011. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - forcing return on a thread with only one frame on the stack causes the thread to exit when resumed + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Test check case when thread has single frame on the stack because of methods which this thread calls was inlined, + * Debugger VM force debuggee VM start test thread which in it's run() method call in infinite loop + * methods which access only internal fields, this methods should be inlined, so thread always has + * only one frame on stack. Debugger suspends debuggee VM, calls forceEarlyReturn() for test thread, resumes debuggee + * VM and checks that test thread has status ThreadReference.THREAD_STATUS_ZOMBIE(thread has completed execution) and + * checks that ThreadDeathEvent and MethodExitEvent was generated for test thread. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-XX:+Inline" + * -inlineType INLINE_METHOD_ACCESSIN_INTERNAL_FIELDS + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn012/TestDescription.java new file mode 100644 index 00000000000..623cc0a8e0f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn012/TestDescription.java @@ -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/ThreadReference/forceEarlyReturn/forceEarlyReturn012. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - forcing return on a thread with only one frame on the stack causes the thread to exit when resumed + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Test check case when thread has single frame on the stack because of methods which this thread calls was inlined, + * Debugger forces debuggee start test thread which in it's run() method calls in infinite loop + * method which should be executed a certain number of times before it is compiled and inlined, debuggee during + * initialization calls this method 20000 times, so, this methods should be inlined and thread always has + * only one frame on stack. Debugger suspends debuggee VM, calls forceEarlyReturn() for test thread, + * resumes debuggee VM and checks that test thread has status ThreadReference.THREAD_STATUS_ZOMBIE(thread has completed execution) + * and checks that ThreadDeathEvent and MethodExitEvent was generated for test thread. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn009.forceEarlyReturn009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-XX:+Inline" + * -inlineType INLINE_HOT_METHOD + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013.java new file mode 100644 index 00000000000..4786f6db748 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn013. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks that a result of the method com.sun.jdi.forceEarlyReturn(Value value) + * complies with its specification. The test checks: + * - after force return occurred any locks acquired by calling the called method(if it is a synchronized method) + * and locks acquired by entering synchronized blocks within the called method are released in Debuggee VM. + * - MethodExitEvent is generated as it would be in a normal return + * Test scenario: + * Special class 'TestThread' implementing 'Runnable' is used in debugee VM. TestThread has following 'run' method: + * - it is synchronized method + * - it contains 5 nested synchronized blocks for 5 different objects + * Debugger initializes breakpoint in TestThread's run method(inside the deepest synchronized block) and + * forces debugee VM create thread using instance of 'TestThread' and run this thread. When debuggee's test + * thread stops at breakpoint debugger calls forceEarlyReturn() and resumes debuggee VM. + * Then, debuggee creates new thread object using the same instance of 'TestThread' as for first test thread, + * starts new thread and wait when it finish execution. If first test thread released all locks + * new thread can acquire the same locks and finish, otherwise new thread will be blocked and will be unable to complete + * execution. + * Also debugger checks that MethodExitEvent is generated after forceEarlyReturn. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013; + +import java.io.PrintStream; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn013 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn013().runIt(argv, out); + } + + public void doTest() { + Value voidValue = createVoidValue(); + + // init breakpont in tested method + ReferenceType referenceType = debuggee.classByName(TestThread.class.getName()); + + BreakpointRequest breakpointRequest = debuggee.makeBreakpoint(referenceType, TestThread.BREAKPOINT_METHOD_NAME, TestThread.BREAKPOINT_LINE); + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.enable(); + + // start test thread + pipe.println(forceEarlyReturn013a.COMMAND_RUN_TEST_THREAD); + + BreakpointEvent event = waitForBreakpoint(breakpointRequest); + + breakpointRequest.disable(); + + ThreadReference threadReference = event.thread(); + + try { + threadReference.forceEarlyReturn(voidValue); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + testMethodExitEvent(threadReference, TestThread.BREAKPOINT_METHOD_NAME); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013a.java new file mode 100644 index 00000000000..be705b35149 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013a.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn013; + +import nsk.share.Consts; +import nsk.share.Log; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +class TestThread implements Runnable { + // locks acquired through synchronized block + public static Object javaLock1 = new Object(); + + public static Object javaLock2 = new Object(); + + public static Object javaLock3 = new Object(); + + public static Object javaLock4 = new Object(); + + public static Object javaLock5 = new Object(); + + private forceEarlyReturn013a testObject; + + public TestThread(forceEarlyReturn013a testObject) { + this.testObject = testObject; + } + + public synchronized void run() { + synchronized (javaLock1) { + synchronized (javaLock2) { + synchronized (javaLock3) { // BREAKPOINT_LINE + synchronized (javaLock4) { + synchronized (javaLock5) { + testObject.log().display(Thread.currentThread().getName() + " in run"); + } + } + + } + + } + } + } + + static public final int BREAKPOINT_LINE = 51; + + static public final String BREAKPOINT_METHOD_NAME = "run"; + +} + +public class forceEarlyReturn013a extends AbstractJDIDebuggee { + static { + try { + // load thread class to let debugger get ReferenceType for TestThread class + Class.forName(TestThread.class.getName()); + } catch (ClassNotFoundException e) { + System.out.println("ClassNotFoundException when load test thread class: " + e); + e.printStackTrace(System.out); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + + public static void main(String args[]) { + new forceEarlyReturn013a().doTest(args); + } + + static public final String testThreadName = "forceEarlyReturn0013aTestThread"; + + static public final String COMMAND_RUN_TEST_THREAD = "runTestThread"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_RUN_TEST_THREAD)) { + TestThread testThread = new TestThread(this); + + Thread thread1 = new Thread(testThread); + thread1.setName(testThreadName); + thread1.start(); + + try { + thread1.join(argHandler.getWaitTime() * 60000); + + if (thread1.getState() != Thread.State.TERMINATED) { + setSuccess(false); + log.complain("Test thread didn't complete execution for " + argHandler.getWaitTime() * 60000 + + ", possible, forceEarlyReturn works incorrect"); + } + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + setSuccess(false); + log.complain("Unexpected exception: " + e); + } + + // start new thread, if thread1 released locks this thread can acquire the same locks and finish + Thread thread2 = new Thread(testThread); + thread2.setName("LocksCheckingThread"); + thread2.start(); + + try { + thread2.join(argHandler.getWaitTime() * 60000); + + if (thread2.getState() != Thread.State.TERMINATED) { + setSuccess(false); + log.complain("Locks checking thread didn't complete execution for " + argHandler.getWaitTime() * 60000 + + ", possible, test thread didn't release locks"); + } + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + setSuccess(false); + log.complain("Unexpected exception: " + e); + } + + return true; + } + + return false; + } + + // access to log for TestThread + Log log() { + return log; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014.java new file mode 100644 index 00000000000..a7c15616d16 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn014. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test scenario: + * Debuggee contains following test method: + * public int publicField1 = 1; + * public int publicField2 = 2; + * public int hotMethod() + * { + * return publicField1++ + publicField2 * 2; + * } + * Fisrt, debugger set breakpoint in test method, forces debuggee call this method and wait breakpoint event. + * When debuggee stop at breakpoint debugger call forceEarlyReturn() for suspended thread, checks that no + * any exceptions was thrown and resumes debuggee. Then, debugger disables breakpoint request and forces debuggee + * call test method 20000 times, after this test method should be compiled with JIT. Then, debugger enables + * breakpoint, forces debuggee call test method and when debuggee stop at breakpoint checks that behavior of + * forceEarlyReturn() didn't change. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014; + +import java.io.PrintStream; +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn014 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn014().runIt(argv, out); + } + + private void testForceEarlyReturn(ReferenceType debuggeeClass, BreakpointRequest breakpointRequest) { + EventListenerThread eventListeningThread = new EventListenerThread(breakpointRequest); + eventListeningThread.start(); + eventListeningThread.waitStartListen(); + + pipe.println(forceEarlyReturn014a.COMMAND_EXECUTE_HOT_METHOD); + + BreakpointEvent event = (BreakpointEvent) eventListeningThread.getEvent(); + + Value valueToReturn = debuggeeClass.getValue(debuggeeClass.fieldByName("expectedHotMethodReturnValue")); + + try { + event.thread().forceEarlyReturn(valueToReturn); + } catch (Throwable t) { + t.printStackTrace(log.getOutStream()); + setSuccess(false); + log.complain("Unexpected exception: " + t); + } + + testMethodExitEvent(event.thread(), forceEarlyReturn014a.breakpointMethodName); + + if (!isDebuggeeReady()) + return; + } + + public void doTest() { + ReferenceType debuggeeClass = debuggee.classByName(debuggeeClassName()); + + BreakpointRequest breakpointRequest = debuggee.makeBreakpoint(debuggeeClass, + forceEarlyReturn014a.breakpointMethodName, + forceEarlyReturn014a.breakpointLine); + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.enable(); + + // call forceEarlyReturn for hotMethod() first time + testForceEarlyReturn(debuggeeClass, breakpointRequest); + + breakpointRequest.disable(); + + // fire hotMethod(), it should be compiled + pipe.println(forceEarlyReturn014a.COMMAND_FIRE_HOT_METHOD); + + if (!isDebuggeeReady()) + return; + + breakpointRequest.enable(); + + // call forceEarlyReturn for hotMethod() second time + testForceEarlyReturn(debuggeeClass, breakpointRequest); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014a.java new file mode 100644 index 00000000000..3c26f83d482 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014a.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn014; + +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE +public class forceEarlyReturn014a extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new forceEarlyReturn014a().doTest(args); + } + + public int publicField1 = 1; + + public int publicField2 = 2; + + public int hotMethod() { + return publicField1++ + publicField2 * 2; // breakpointLine + } + + public static final String breakpointMethodName = "hotMethod"; + + public static final int breakpointLine = 39; + + public static final int expectedHotMethodReturnValue = Integer.MAX_VALUE; + + public static final String COMMAND_EXECUTE_HOT_METHOD = "executeHotMethod"; + + public static final String COMMAND_FIRE_HOT_METHOD = "fireHotMethod"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_EXECUTE_HOT_METHOD)) { + int result = hotMethod(); + + if (result != expectedHotMethodReturnValue) { + setSuccess(false); + log.complain("Unexpected value is returned from hotMethod(): " + result); + } + + return true; + } else if (command.equals(COMMAND_FIRE_HOT_METHOD)) { + // after this loop hotMethod() should be compiled + for (int i = 0; i < 20000; i++) + hotMethod(); + + return true; + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015.java new file mode 100644 index 00000000000..9ce0239e917 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/forceEarlyReturn/forceEarlyReturn015. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test provokes method 'ThreadReference.forceEarlyReturn()' throw 'InvalidStackFrameException'. + * Test scenario: + * Debugger enables ThreadStartRequest with suspend policy SUSPEND_ALL and starts thread listening JDI events. + * Then debugger forces debuggee VM to start new thread. When ThreadStartEvent is received debugger obtains + * ThreadReference through 'ThreadStartEvent.thread()' and call 'ThreadReference.forceEarlyReturn()', since + * just started thread has no frames yet 'ThreadReference.forceEarlyReturn()' should throw 'InvalidStackFrameException'. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn015.forceEarlyReturn015 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn015.forceEarlyReturn015a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn015.forceEarlyReturn015 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn015; + +import java.io.PrintStream; + +import com.sun.jdi.InvalidStackFrameException; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.ForceEarlyReturnDebugger; + +public class forceEarlyReturn015 extends ForceEarlyReturnDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public String debuggeeClassName() { + return forceEarlyReturn015a.class.getName(); + } + + public static int run(String argv[], PrintStream out) { + return new forceEarlyReturn015().runIt(argv, out); + } + + public void doTest() { + ThreadStartRequest threadStartRequest = debuggee.getEventRequestManager().createThreadStartRequest(); + threadStartRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); + threadStartRequest.enable(); + + EventListenerThread eventListener = new EventListenerThread(threadStartRequest); + eventListener.start(); + eventListener.waitStartListen(); + + pipe.println(forceEarlyReturn015a.COMMAND_START_NEW_THREAD); + + ThreadStartEvent event = (ThreadStartEvent) eventListener.getEvent(); + + try { + // just started thread has no frames and InvalidStackFrameException + // should be thrown + event.thread().forceEarlyReturn(vm.mirrorOf(0)); + + setSuccess(false); + log.complain("Expected 'InvalidStackFrameException' was not thrown"); + } catch (InvalidStackFrameException e) { + // expected exception + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + threadStartRequest.disable(); + + vm.resume(); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015a.java new file mode 100644 index 00000000000..a2e9255543d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015a.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.forceEarlyReturn.forceEarlyReturn015; + +import nsk.share.jdi.*; + +public class forceEarlyReturn015a extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new forceEarlyReturn015a().doTest(args); + } + + public static final String COMMAND_START_NEW_THREAD = "startNewThread"; + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_START_NEW_THREAD)) { + Thread thread = new Thread(new Runnable() { + public void run() { + log.display("Thread exit"); + } + }); + + thread.setName("forceEarlyReturn015a_NewThread"); + thread.start(); + + return true; + } + + return false; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java new file mode 100644 index 00000000000..d2ca672840e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java @@ -0,0 +1,714 @@ +/* + * 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.ThreadReference.frame; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.frame()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since thread2 uses the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * (1) sets up breakpoints within thread2's two methods to be called
    + * in stack order;
    + * (2) checks up that invoking ThreadReference.frame()
    + * doesn't throw 'IncompatibleThreadStateException' when
    + * thread2 is suspended, and does throw otherwize;
    + * (3) forces first thread to leave the synchronized block
    + * in order to unlock the thread2.
    + * Then the debugger sequentially checks up that:
    + * - when the thread2 is suspended at first breakpoint within 'runt1',
    + * only invoking methods thread2.frame(0) and
    + * thread2.frame(1)
    + * doesn't throw IndexOutOfBoundsException;
    + * - when the thread2 is suspended at first breakpoint within 'runt2',
    + * only invoking methods thread2.frame(0),
    + * thread2.frame(1), and
    + * thread2.frame(2)
    + * doesn't throw IndexOutOfBoundsException;
    + * - when the thread2 is suspended at second breakpoint within 'runt1',
    + * after return from 'runt2',
    + * only invoking methods thread2.frame(0) and
    + * thread2.frame(1)
    + * whereas invoking the method with negative or larger number
    + * does throw IndexOutOfBoundsException.
    + *
    + */ + +public class frame001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/frame/frame001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new frame001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.frame.frame001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.frame.Threadframe001a"; + + //String mName = "nsk.jdi.ThreadReference.frame"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + StackFrame stackFrame = null; + StackFrame stackFrame0 = null; + StackFrame stackFrame1 = null; + StackFrame stackFrame2 = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest3 = settingBreakpoint(breakpointMethod1, bpLine3, "three"); + if (breakpRequest3 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" the check that 'thread2.frameCount()' does throw exception"); + log2(" when the thread2 is not suspended"); + try { + thread2.frame(0); + log3 ("ERROR: no IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e1 ) { + log2(" : IncompatibleThreadStateException"); + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" suspending the thread2"); + thread2.suspend(); + + log2(" the check that 'thread2.frameCount()' doesn't throw exception"); + log2(" when the thread2 is suspended"); + try { + stackFrame0 = thread2.frame(0); + log2(" : no exception"); + } catch ( IncompatibleThreadStateException e1 ) { + log3("ERROR: wrong IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + thread2.resume(); + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" testing the thread2 at breakpoints"); + for (int i3 = 0; i3 < 3; i3++) { + + log2(" : new check case i3# = " + i3); + + int iCount = 0; + + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + + log2(" checking up that thread2.frame(-1) does throw exception"); + try { + stackFrame = thread2.frame(-1); + log3 ("ERROR: no IndexOutOfBoundsException for: thread2.frame(-1)"); + expresult = returnCode1; + } catch ( IndexOutOfBoundsException e1 ) { + log2(" : IndexOutOfBoundsException for: thread2.frame(-1)"); + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for thread2.frame(-1)"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for thread2.frame(-1)"); + expresult = returnCode1; + } + + log2(" checking up that thread2.frame(index) does throw exception"); + log2(" when index is equal to frameCount()"); + + try { + iCount = thread2.frameCount(); + stackFrame = thread2.frame(iCount); + log3 ("ERROR: no IndexOutOfBoundsException for: thread2.frame(iCount) : " + iCount); + expresult = returnCode1; + } catch ( IndexOutOfBoundsException e1 ) { + log2(" : IndexOutOfBoundsException for: thread2.frame(iCount) : " + iCount); + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for thread2.frameCount()"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for thread2.frameCount()"); + expresult = returnCode1; + } + + log2(" checking up that thread2.frame(index) does throw exception"); + log2(" when index is greater than frameCount()"); + + try { + iCount = thread2.frameCount(); + stackFrame = thread2.frame(iCount + 1); + log3 ("ERROR: no IndexOutOfBoundsException for: thread2.frame(iCount + 1) : " + + (thread2.frameCount() +1) ); + expresult = returnCode1; + } catch ( IndexOutOfBoundsException e1 ) { + log2(" : IndexOutOfBoundsException for: thread2.frame(iCount + 1) : " + + (iCount + 1) ); + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for thread2.frameCount()"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for thread2.frameCount()"); + expresult = returnCode1; + } + + + log2(" checking up that thread2.frame(0) doesn't throw exception"); + try { + stackFrame = thread2.frame(0); + log2(" : no Exception for: stackFrame = thread2.frame(0)"); + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException for: thread2.frame(0)"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: wrong IncompatibleThreadStateException for thread2.frame(0)"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for thread2.frame(0)"); + expresult = returnCode1; + } + + + switch (i3) { + + case 0: log2(" first breakpoint in 'runt1'"); + + log2(" checking up that thread2.frame(1) doesn't throw exception"); + try { + stackFrame1 = thread2.frame(1); + log2(" : no exception for: stackFrame1 = thread2.frame(1)"); + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException for case 0:"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for case 0:"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for case 0:"); + expresult = returnCode1; + } + if (expresult == returnCode0) { + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + } + break; + + case 1: log2(" first breakpoint in 'runt2'"); + + log2(" checking up that thread2.frame(1) and "); + log2(" that thread2.frame(2) don't throw exceptions"); + try { + stackFrame1 = thread2.frame(1); + log2(" : no exception for: stackFrame1 = thread2.frame(1)"); + stackFrame2 = thread2.frame(2); + log2(" : no exception for: stackFrame2 = thread2.frame(2)"); + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException for case 1:"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for case 1:"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for case 1:"); + expresult = returnCode1; + } + if (expresult == returnCode0) { + log2(" enabling breakpRequest3"); + breakpRequest3.enable(); + } + break; + + case 2: log2(" second breakpoint in 'runt1'"); + + log2(" checking up that thread2.frame(1) doesn't throw exception"); + try { + stackFrame1 = thread2.frame(1); + log2(" : no exception for: stackFrame1 = thread2.frame(1)"); + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException for case 2:"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException for case 2:"); + expresult = returnCode1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException for case 2:"); + expresult = returnCode1; + } + break; + } + + log2(" resuming the thread2"); + eventSet.resume(); + if (expresult != returnCode0) + break; + } + } + eventSet.resume(); // for case if error when the thread2 was suspended + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001/TestDescription.java new file mode 100644 index 00000000000..135938a78ca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ThreadReference/frame/frame001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.frame() + * complies with its spec: + * public StackFrame frame(int index) + * throws IncompatibleThreadStateException + * Returns the StackFrame at the given index in the thread's current call stack. + * Index 0 retrieves the current frame; + * higher indices retrieve caller frames. + * The thread must be suspended (normally through an interruption to the VM) + * to get this information, and + * it is only valid until the thread is resumed again. + * Parameters: index - the desired frame + * Returns: the requested StackFrame + * Throws: IncompatibleThreadStateException - + * if the thread is not suspended in the target VM + * java.lang.IndexOutOfBoundsException - + * if the index is greater than or equal to frameCount() or + * is negative. + * ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.frame.frame001; + * the debuggee program - nsk.jdi.ThreadReference.frame.frame001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.frame.frame001 + * nsk.jdi.ThreadReference.frame.frame001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.frame.frame001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java new file mode 100644 index 00000000000..7e9951e5554 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java @@ -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.ThreadReference.frame; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the frame001 JDI test. + */ + +public class frame001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.frameCount()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until fmain thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * (1) sets up breakpoints within thread2's two methods to be called
    + * in stack order;
    + * (2) checks up that invocation ThreadReference.frameCount()
    + * doesn't throw 'IncompatibleThreadStateException' when
    + * the thread2 is suspended, and does throw otherwize;
    + * (3) fixes the number of a current frame of the thread2;
    + * (4) forces main thread to leave the synchronized block
    + * in order to unlock the thread2.
    + * Then the debugger sequentially checks up that:
    + * - when the thread2 is suspended at first breakpoint within 'runt1',
    + * new frameCount() returned value is incremented;
    + * - when the thread2 is suspended at first breakpoint within 'runt2',
    + * new frameCount() returned value is incremented again;
    + * - when the thread2 is suspended at second breakpoint within 'runt1',
    + * after return from 'runt2',
    + * new frameCount() returned value is decremented.
    + *
    + */ + +public class framecount001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/frameCount/framecount001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new framecount001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.frameCount.framecount001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.frameCount.Threadframecount001a"; + + //String mName = "nsk.jdi.ThreadReference.frameCount"; + + //====================================================== test program + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount = 0; + + StackFrame stackFrame = null; + StackFrame stackFrame0 = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest3 = settingBreakpoint(breakpointMethod1, bpLine3, "three"); + if (breakpRequest3 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" the check that 'thread2.frameCount()' does throw IncompatibleThreadStateException"); + log2(" when the thread2 is not suspended"); + try { + thread2.frameCount(); + log3 ("ERROR: no IncompatibleThreadStateException "); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e1 ) { + log2(" : IncompatibleThreadStateException ;"); + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" suspending the thread2"); + thread2.suspend(); + + log2(" the check that 'thread2.frameCount()' doesn't throw exception"); + log2(" when the thread2 is suspended"); + try { + frameCount = thread2.frameCount(); + log2(" : no exception"); + } catch ( IncompatibleThreadStateException e1 ) { + log3("ERROR: wrong IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + thread2.resume(); + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" testing the thread2 at breakpoints"); + for (int i3 = 0; i3 < 3; i3++) { + + log2(" : new check case i3# = " + i3); + + int iCount = 0; + int frameCount1 = 0; + + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting a value of current frameCount"); + try { + frameCount1 = thread2.frameCount(); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException ???"); + expresult = returnCode1; + continue; + } + + switch (i3) { + + case 0: + log2(" the thread2 is at first breakpoint in 'runt1'"); + log2(" checking up that frameCount has been incremented"); + if (frameCount1 != (frameCount + 1) ) { + log3("ERROR: case 0: frameCount1 != (frameCount + 1) : " + frameCount1 ); + expresult = returnCode1; + } + if (expresult == returnCode0) { + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + } + break; + + case 1: + log2(" the thread2 is at first breakpoint in 'runt2'"); + log2(" checking up that frameCount has been incremented one more time"); + if (frameCount1 != (frameCount + 2) ) { + log3("ERROR: case 1: frameCount1 != (frameCount + 2) : " + frameCount1 ); + expresult = returnCode1; + } + if (expresult == returnCode0) { + log2(" enabling breakpRequest3"); + breakpRequest3.enable(); + } + break; + + case 2: + log2(" the thread2 is at second breakpoint in 'runt1'"); + log2(" checking up that frameCount has been decremented"); + if (frameCount1 != (frameCount + 1) ) { + log3("ERROR: case 2: frameCount1 != (frameCount + 1) : " + frameCount1 ); + expresult = returnCode1; + } + break; + } + + log2(" resuming the thread2"); + eventSet.resume(); + if (expresult != returnCode0) + break; + } + } + eventSet.resume(); // for case if error when the thread2 was suspended + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001/TestDescription.java new file mode 100644 index 00000000000..ca25fccccb0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ThreadReference/frameCount/framecount001. + * VM Testbase keywords: [quick, jpda, jdi, quarantine] + * VM Testbase comments: JDK-6530620 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.frameCount() + * complies with its spec: + * public int frameCount() + * throws IncompatibleThreadStateException + * Returns the number of stack frames in the thread's current call stack. + * The thread must be suspended (normally through an interruption to the VM) + * to get this information, and + * it is only valid until the thread is resumed again. + * Returns: an integer frame count + * Throws: IncompatibleThreadStateException - + * if the thread is not suspended in the target VM + * ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.frameCount.framecount001; + * the debuggee program - nsk.jdi.ThreadReference.frameCount.framecount001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.frameCount.framecount001 + * nsk.jdi.ThreadReference.frameCount.framecount001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.frameCount.framecount001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java new file mode 100644 index 00000000000..4b470ace728 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java @@ -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.ThreadReference.frameCount; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the framecount001 JDI test. + */ + +public class framecount001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.frames()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until first thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * (1) checks up that invocation ThreadReference.frames()
    + * doesn't throw 'IncompatibleThreadStateException' when
    + * the thread2 is suspended, and does throw otherwize;
    + * (2) sets up breackpoints within thread2's two methods to be called
    + * in stack order;
    + * (3) gets from the debuggee Method objects mirroring
    + * methods 'run', 'runt1', and 'runt2';
    + * (4) forces first thread to leave the synchronized block
    + * in order to unlock the thread2.
    + * Then the debugger checks up that:
    + *
    + * - when the thread2 is suspended at entering first method, 'runt1',
    + * a frameList object returned by threadRef.frames(), has size of 2,
    + * and both StackFrame.location().method() objects in the list
    + * are equal to their mirrors formed earlier;
    + *
    + * - when the thread2 is suspended at entering second method, 'runt2',
    + * a frameList object returned by threadRef.frames(), has size of 3,
    + * and all the three StackFrame.location().method() objects
    + * in the list are equal to their mirrors formed earlier;
    + *
    + * - when the thread2 is suspended
    + * second time in first method after exiting second method,
    + * a frameList object returned by threadRef.frames(), has size of 2,
    + * and both StackFrame.location().method() objects in the list
    + * are equal to their mirrors formed earlier.
    + *
    + */ + +public class frames001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/frames/frames001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new frames001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.frames.frames001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.frames.Threadframes001a"; + + //String mName = "nsk.jdi.ThreadReference.frames"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + BreakpointRequest breakpRequest3 = null; + + String synchroMethod = "run"; + + Method runMethod0 = null; + Method runMethod1 = null; + Method runMethod2 = null; + + List frameList = null; + List frameList0 = null; + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest3 = settingBreakpoint(breakpointMethod1, bpLine3, "three"); + if (breakpRequest3 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" the check that 'thread2.frames()' does throw exception"); + log2(" when the thread2 is not suspended"); + try { + thread2.frames(); + log3 ("ERROR: no IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e1 ) { + log2(" : IncompatibleThreadStateException"); + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" suspending the thread2"); + thread2.suspend(); + + log2(" the check that 'thread2.frames()' doesn't throw exception"); + log2(" when the thread2 is suspended"); + try { + frameList0 = thread2.frames(); + log2(" : no exception"); + } catch ( IncompatibleThreadStateException e1 ) { + log3("ERROR: wrong IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + thread2.resume(); + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + runMethod0 = (Method) testedclass.methodsByName(synchroMethod).get(0); + runMethod1 = (Method) testedclass.methodsByName(breakpointMethod1).get(0); + runMethod2 = (Method) testedclass.methodsByName(breakpointMethod2).get(0); + + Method run0Method = null; + Method runt1Method = null; + Method runt2Method = null; + + StackFrame frame = null; + Location location = null; + + log2(" testing the thread2 at breakpoints"); + for (int i3 = 0; i3 < 3; i3++) { + + log2(" : new check case i3# = " + i3); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + log2(" getting new List of frames"); + try { + frameList = thread2.frames();; + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException"); + expresult = returnCode1; + break label1; + } catch ( IncompatibleThreadStateException e2 ) { + log3("ERROR: IncompatibleThreadStateException"); + expresult = returnCode1; + break label1; + } catch ( ObjectCollectedException e3 ) { + log3("ERROR: ObjectCollectedException"); + expresult = returnCode1; + break label1; + } + + + switch (i3) { + + case 0: + log2(" first breakpoint within 'runt1'"); + log2(" checking up the size of frameList"); + if (frameList.size() != 2) { + log3("ERROR: frameList.size() != 2 for case 0: " + frameList.size()); + expresult = returnCode1; + break; + } + + frame = (StackFrame) frameList.get(0); + location = frame.location(); + runt1Method = location.method(); + + frame = (StackFrame) frameList.get(1); + location = frame.location(); + run0Method = location.method(); + + log2(" checking up the equality of method mirrors"); + if ( !runt1Method.equals(runMethod1) ) { + log3("ERROR: !runt1Method.equals(runMethod1)"); + expresult = returnCode1;; + } + if ( !run0Method.equals(runMethod0) ) { + log3("ERROR: !run0Method.equals(runMethod0)"); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + } + break; + + case 1: + log2(" a breakpoint within 'runt2'"); + log2(" checking up the size of frameList"); + if (frameList.size() != 3) { + log3("ERROR: frameList.size() != 3 for case 1: " + frameList.size()); + expresult = returnCode1; + break; + } + + frame = (StackFrame) frameList.get(0); + location = frame.location(); + runt2Method = location.method(); + + frame = (StackFrame) frameList.get(1); + location = frame.location(); + runt1Method = location.method(); + + frame = (StackFrame) frameList.get(2); + location = frame.location(); + run0Method = location.method(); + + log2(" checking up the equality of method mirrors"); + if ( !runt2Method.equals(runMethod2) ) { + log3("ERROR: !runt2Method.equals(runMethod2)"); + expresult = returnCode1; + } + if ( !runt1Method.equals(runMethod1) ) { + log3("ERROR: !runt1Method.equals(runMethod1)"); + expresult = returnCode1; + } + if ( !run0Method.equals(runMethod0) ) { + log3("ERROR: !run0Method.equals(runMethod0)"); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest3"); + breakpRequest3.enable(); + } + break; + + case 2: + log2(" second breakpoint within 'runt1'"); + log2(" checking up the size of frameList"); + if (frameList.size() != 2) { + log3("ERROR: frameList.size() != 2 for case 2: " + frameList.size()); + expresult = returnCode1; + break; + } + + frame = (StackFrame) frameList.get(0); + location = frame.location(); + runt1Method = location.method(); + + frame = (StackFrame) frameList.get(1); + location = frame.location(); + run0Method = location.method(); + + log2(" checking up the equality of method mirrors"); + if ( !runt1Method.equals(runMethod1) ) { + log3("ERROR: !runt1Method.equals(runMethod1)"); + expresult = returnCode1; + } + if ( !run0Method.equals(runMethod0) ) { + log3("ERROR: !run0Method.equals(runMethod0)"); + expresult = returnCode1; + } + + break; + } + + log2(" resuming the thread2"); + eventSet.resume(); + if (expresult != returnCode0) + break; + } + } + eventSet.resume(); // for case if error when the thread2 was suspended + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001/TestDescription.java new file mode 100644 index 00000000000..97f6e8b6688 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/ThreadReference/frames/frames001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.frames() + * complies with its spec: + * public java.util.List frames() + * throws IncompatibleThreadStateException + * Returns a List containing each StackFrame in the thread's current call stack. + * The thread must be suspended + * (normally through an interruption to the VM) to get this information, and + * it is only valid until the thread is resumed again. + * Returns: a List of StackFrame with the current frame first + * followed by each caller's frame. + * Throws: IncompatibleThreadStateException - + * if the thread is not suspended in the target VM + * ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.frames.frames001; + * the debuggee program - nsk.jdi.ThreadReference.frames.frames001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.frames.frames001 + * nsk.jdi.ThreadReference.frames.frames001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.frames.frames001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java new file mode 100644 index 00000000000..4e5f4987a0a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java @@ -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.ThreadReference.frames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the frames001 JDI test. + */ + +public class frames001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.frames_ii()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - checks up that invocation ThreadReference.frames(,)
    + * doesn't throw 'IncompatibleThreadStateException' when
    + * the thread2 is suspended, and does throw otherwize;
    + * - sets up breakpoints within thread2's 'run', 'runt1', and
    + * 'runt2' methods providing the thread2 will be suspended within
    + * 'runt1' two times, before to call 'runt2' and after return from it;
    + * - forces main thread to leave the synchronized block in order to
    + * unlock the thread2 which will be suspended at the breakpoints.
    + *
    + * At the breakpoints the debugger performs a number of checks as follows.
    + * (1) The breakpoint within 'run':
    + * - frameList = thread2.frames(0, 1); doesn't throw an exception
    + * and frameList.size() == 1
    + * - the sequence of method calls 'frame>location>method'
    + * doesn't throw exception
    + * (2) First breakpoint within 'runt1':
    + * - no exceptions thrown for: frameList = thread2.frames(0, 2);
    + * frameList = thread2.frames(1, 1);
    + * - additionally, two Method objects, mirroring gebuggee's methods
    + * 'run' and 'runt1' are created for further check
    + * (3) The breakpoint within 'runt2':
    + * - no exceptions thrown for several correct pairs of
    + * the arguments index and lenght
    + * (4) Second breakpoint within 'runt1':
    + * - another pair of Method objects, mirroring gebuggee's methods
    + * 'run' and 'runt1', is created , and
    + * first mirror objects are compared to second mirror objects.
    + *
    + */ + +public class frames_ii001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/frames_ii/frames_ii001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new frames_ii001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.frames_ii.frames_ii001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.frames_ii.Threadframes_ii001a"; + + //String mName = "nsk.jdi.ThreadReference.frames_ii"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine0 = "breakpointLineNumber0"; + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest0 = null; + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + BreakpointRequest breakpRequest3 = null; + + String synchroMethod = "run"; + + Method runMethod0 = null; + Method runMethod1 = null; + Method runMethod2 = null; + + List frameList = null; + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest0 = settingBreakpoint(synchroMethod, bpLine0, "zero"); + if (breakpRequest0 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest3 = settingBreakpoint(breakpointMethod1, bpLine3, "three"); + if (breakpRequest3 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" the check that 'thread2.frames(,)' does throw exception"); + log2(" when the thread2 is not suspended"); + try { + thread2.frames(0, 1); + log3 ("ERROR: no IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( IncompatibleThreadStateException e1 ) { + log2(" : IncompatibleThreadStateException"); + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" suspending the thread2"); + thread2.suspend(); + + log2(" the check that 'thread2.frames(,)' doesn't throw exception"); + log2(" when the thread2 is suspended"); + try { + thread2.frames(0, 1); + log2(" : no exception"); + } catch ( IncompatibleThreadStateException e1 ) { + log3("ERROR: wrong IncompatibleThreadStateException"); + expresult = returnCode1; + } catch ( ObjectCollectedException e2 ) { + log3("ERROR: wrong ObjectCollectedException"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + thread2.resume(); + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest0"); + breakpRequest0.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + runMethod0 = (Method) testedclass.methodsByName(synchroMethod).get(0); + runMethod1 = (Method) testedclass.methodsByName(breakpointMethod1).get(0); + runMethod2 = (Method) testedclass.methodsByName(breakpointMethod2).get(0); + + Method runt1Method1 = null; + Method runt1Method2 = null; + + StackFrame frame = null; + Location location = null; + + log2(" testing the thread2 at breakpoints"); + for (int i3 = 0; i3 < 4; i3++) { + + log2(" : new check case i3# = " + i3); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + + switch (i3) { + + case 0: + log2("......a breakpoint within 'run'"); + log2(" case for check: thread2.frames(0, 1);"); + frameList = null; + try { + frameList = thread2.frames(0, 1); + + log2(" checking up on: frameList.size() == 1"); + if (frameList.size() != 1) { + log3("ERROR: frameList.size() != 1 : " + frameList.size()); + expresult = returnCode1; + } + + log2(" checking up on: method calls: frame>location>method"); + try { + frame = (StackFrame) frameList.get(0); + location = frame.location(); + runMethod0 = location.method(); + } catch ( Exception e ) { + log3("ERROR: exception : " + e); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + log2(" case for check: frameList = thread2.frames(0, -1);"); + try { + frameList = thread2.frames(0, -1); + log3("ERROR: no IndexOutOfBoundsException"); + expresult = returnCode1; + } catch ( Exception e ) { + log2(" IndexOutOfBoundsException"); + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + } + break; + + + case 1: + log2("......first breakpoint within 'runt1'"); + log2(" case for check: frameList = thread2.frames(0, 2);"); + frameList = null; + try { + frameList = thread2.frames(0, 2); + + log2(" checking up on: frameList.size() == 2"); + if (frameList.size() != 2) { + log3("ERROR: frameList.size() != 2 : " + frameList.size()); + expresult = returnCode1; + } + + log2(" checking up on: method calls: frame>location>method"); + try { + frame = (StackFrame) frameList.get(0); + location = frame.location(); + runt1Method1 = location.method(); + + frame = (StackFrame) frameList.get(1); + location = frame.location(); + runMethod1 = location.method(); + } catch ( Exception e ) { + log3("ERROR: exception : " + e); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + log2(" case for check: frameList = thread2.frames(0, -1);"); + try { + frameList = thread2.frames(0, -1); + log3("ERROR: no IndexOutOfBoundsException"); + expresult = returnCode1; + } catch ( Exception e ) { + log2(" IndexOutOfBoundsException"); + } + + log2(" case for check: frameList = thread2.frames(1, 1);"); + frameList = null; + try { + frameList = thread2.frames(1, 1); + + log2(" checking up on: frameList.size() == 1"); + if (frameList.size() != 1) { + log3("ERROR: frameList.size() != 1 : " + frameList.size()); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + } + break; + + + case 2: + log2("......a breakpoint within 'runt2'"); + log2(" case for check: thread2.frames(0, 3);"); + frameList = null; + try { + frameList = thread2.frames(0, 3); + + log2(" checking up on: frameList.size() == 3"); + if (frameList.size() != 3) { + log3("ERROR: frameList.size() != 3 : " + frameList.size()); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + log2(" case for check: frameList = thread2.frames(0, -1);"); + try { + frameList = thread2.frames(0, -1); + log3("ERROR: no IndexOutOfBoundsException"); + expresult = returnCode1; + } catch ( Exception e ) { + log2(" IndexOutOfBoundsException"); + } + + log2(" case for check: frameList = thread2.frames(1, 2);"); + frameList = null; + try { + frameList = thread2.frames(1, 2); + + log2(" checking up on: frameList.size() == 2"); + if (frameList.size() != 2) { + log3("ERROR: frameList.size() != 2 : " + frameList.size()); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + log2(" case for check: frameList = thread2.frames(1, -1);"); + try { + frameList = thread2.frames(1, -1); + log3("ERROR: no IndexOutOfBoundsException"); + expresult = returnCode1; + } catch ( Exception e ) { + log2(" IndexOutOfBoundsException"); + } + + log2(" case for check: frameList = thread2.frames(2, 1);"); + frameList = null; + try { + frameList = thread2.frames(2, 1); + + log2(" checking up on: frameList.size() == 1"); + if (frameList.size() != 1) { + log3("ERROR: frameList.size() != 1 : " + frameList.size()); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + log2(" case for check: frameList = thread2.frames(2, -1);"); + try { + frameList = thread2.frames(2, -1); + log3("ERROR: no IndexOutOfBoundsException"); + expresult = returnCode1; + } catch ( Exception e ) { + log2(" IndexOutOfBoundsException"); + } + + log2(" case for check: frameList = thread2.frames(1, 1);"); + frameList = null; + try { + frameList = thread2.frames(1, 1); + + log2(" checking up on: frameList.size() == 1"); + if (frameList.size() != 1) { + log3("ERROR: frameList.size() != 1 : " + frameList.size()); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest3"); + breakpRequest3.enable(); + } + break; + + + case 3: + log2("......second breakpoint within 'runt1'"); + log2(" case for check: frameList = thread2.frames(0, 2);"); + frameList = null; + try { + frameList = thread2.frames(0, 2); + + log2(" checking up on: frameList.size() == 2"); + if (frameList.size() != 2) { + log3("ERROR: frameList.size() != 2 : " + frameList.size()); + expresult = returnCode1; + } + + log2(" checking up on: method calls: frame>location>method"); + try { + frame = (StackFrame) frameList.get(0); + location = frame.location(); + runt1Method2 = location.method(); + + frame = (StackFrame) frameList.get(1); + location = frame.location(); + runMethod2 = location.method(); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + expresult = returnCode1; + } + + log2(" case for check: frameList = thread2.frames(0, -1);"); + try { + frameList = thread2.frames(0, -1); + log3("ERROR: no IndexOutOfBoundsException"); + expresult = returnCode1; + } catch ( Exception e ) { + log2(" IndexOutOfBoundsException"); + } + + if ( !runt1Method1.equals(runt1Method2) ) { + log3("ERROR: !runt1Method1.equals(runt1Method2)"); + expresult = returnCode1; + } + if ( !runMethod1.equals(runMethod2) ) { + log3("ERROR: !runMethod1.equals(runMethod2)"); + expresult = returnCode1; + } + + break; + } + + log2(" resuming the thread2"); + eventSet.resume(); + if (expresult != returnCode0) { + testExitCode = FAILED; + break label1; + } + } + } + eventSet.resume(); // for case if error when the thread2 was suspended + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001/TestDescription.java new file mode 100644 index 00000000000..6c6f607268e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001/TestDescription.java @@ -0,0 +1,100 @@ +/* + * 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/ThreadReference/frames_ii/frames_ii001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.frames(int,int) + * complies with its spec: + * public java.util.List frames(int start, int length) + * throws IncompatibleThreadStateException + * Returns a List containing a range of StackFrame mirrors from + * the thread's current call stack. The thread must be suspended + * (normally through an interruption to the VM) to get this information, and + * it is only valid until the thread is resumed again. + * Parameters: start - the index of the first frame + * length - the number of frames to retrieve + * Returns: a List of StackFrame with the current frame first + * followed by each caller's frame. + * Throws: IncompatibleThreadStateException - + * if the thread is not suspended in the target VM + * IndexOutOfBoundsException - + * if the specified range is not within the range + * from 0 to frameCount() - 1. + * ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.frames_ii.frames_ii001; + * the debuggee program - nsk.jdi.ThreadReference.frames_ii.frames_ii001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * New Merlin specification contains the following conditions to throw + * IndexOutOfBoundsException: + * if the specified range is not within the range of stack frame indicies. + * That is, the exception is thrown if any of the following are true: + * start < 0 + * start >= frameCount() + * length < 0 + * (start+length) > frameCount() + * To comply with the conditions, + * all checks on "length < 0" in the test were corrected + * to catch the specified Exception. + * If the Exception is not thrown, + * the test returnes the value FAILED. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.frames_ii.frames_ii001 + * nsk.jdi.ThreadReference.frames_ii.frames_ii001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.frames_ii.frames_ii001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java new file mode 100644 index 00000000000..70c5d280a47 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java @@ -0,0 +1,213 @@ +/* + * 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.ThreadReference.frames_ii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the frames_ii001 JDI test. + */ + +public class frames_ii001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.frames(int index, int lenght)
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - sets up a breakpoint within thread2's 'run' method;
    + * - forces main thread to leave the synchronized block in order to
    + * unlock the thread2 to get it suspended at the breakpoint.
    + * Then the debugger performs a number of checking calls to
    + * thread2.frames(index,lenght) with the following arguments:
    + *
    + * start < 0 (-1)
    + * lenght < -1 (-2)
    + * lenght == 0
    + * length == thread2.frameCount()
    + * lenght > thread2.frameCount()
    + *
    + */ + +public class frames_ii002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/frames_ii/frames_ii002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new frames_ii002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.frames_ii.frames_ii002a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.frames_ii.Threadframes_ii002a"; + + //String mName = "nsk.jdi.ThreadReference.frames_ii"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine0 = "breakpointLineNumber0"; + //String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest0 = null; + //BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + String synchroMethod = "run"; + + //Method runMethod0 = null; + //Method runMethod1 = null; + //Method runMethod2 = null; + + List frameList = null; + + + label0: { + + log2("getting ThreadReference objects"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up a breakpoint"); + + breakpRequest0 = settingBreakpoint(synchroMethod, bpLine0, "zero"); + if (breakpRequest0 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + + log2(" enabling breakpRequest0"); + breakpRequest0.enable(); + + log2(" making the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + log2(" checks begin"); + + log2("......case for check: start < 0 {thread2.frames(-1, 1);} IndexOutOfBoundsException expected"); + frameList = null; + try { + frameList = thread2.frames(-1, 1); + log3("ERROR: no Exception "); + log2(" frameCount == " + thread2.frameCount()); + expresult = returnCode1;; + } catch ( IndexOutOfBoundsException e1 ) { + log2(" IndexOutOfBoundsException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception : " + e2); + expresult = returnCode1; + } + + log2("......case for check: lenght < -1 {thread2.frames(0, -2);} IndexOutOfBoundsException expected"); + frameList = null; + try { + frameList = thread2.frames(0, -2); + log3("ERROR: no Exception "); + log2(" frameList.size() = " + frameList.size() ); + expresult = returnCode1; + } catch ( IndexOutOfBoundsException e1 ) { + log2(" IndexOutOfBoundsException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception : " + e2); + expresult = returnCode1; + } + + log2("......case for check: lenght == 0: frameList == thread2.frames(0, 0);"); + log2(" no IndexOutOfBoundsException expected"); + frameList = null; + try { + frameList = thread2.frames(0, 0); + log2(" checking up on frameList.size() == 0"); + if (frameList.size() != 0) { + log3("ERROR: frameList.size() != 0: " + frameList.size()); + expresult = returnCode1; + } + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException "); + expresult = returnCode1; + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception " + e2); + expresult = returnCode1; + } + + log2("......case for check: lenght == frameCount() {thread2.frames(0, thread2.frameCount());}"); + log2(" no IndexOutOfBoundsException expected"); + frameList = null; + try { + frameList = thread2.frames(0, thread2.frameCount()); + + log2(" checking up on frameList.size() == 1"); + if (frameList.size() != 1) { + log3("ERROR: frameList.size() != 1: " + frameList.size()); + expresult = returnCode1; + } + } catch ( IndexOutOfBoundsException e1 ) { + log3("ERROR: IndexOutOfBoundsException "); + expresult = returnCode1; + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception : " + e2); + expresult = returnCode1; + } + + + log2("......case for check: lenght > frameCount() {thread2.frames(0, thread2.frameCount() + 1);}"); + log2(" IndexOutOfBoundsException expected"); + frameList = null; + try { + frameList = thread2.frames(0, thread2.frameCount() + 1); + log3("ERROR: no Exception"); + log2(" frameList.size() = " + frameList.size() ); + expresult = returnCode1; + } catch ( IndexOutOfBoundsException e1 ) { + log2(" IndexOutOfBoundsException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception : " + e2); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002/TestDescription.java new file mode 100644 index 00000000000..75a5d4a6604 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ThreadReference/frames_ii/frames_ii002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.frames(int,int) + * complies with its spec: + * public java.util.List frames(int start, int length) + * throws IncompatibleThreadStateException + * Returns a List containing a range of StackFrame mirrors from + * the thread's current call stack. The thread must be suspended + * (normally through an interruption to the VM) to get this information, and + * it is only valid until the thread is resumed again. + * Parameters: start - the index of the first frame + * length - the number of frames to retrieve + * Returns: a List of StackFrame with the current frame first + * followed by each caller's frame. + * Throws: IncompatibleThreadStateException - + * if the thread is not suspended in the target VM + * IndexOutOfBoundsException - + * if the specified range is not within the range + * from 0 to frameCount() - 1. + * ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.frames_ii.frames_ii002; + * the debuggee program - nsk.jdi.ThreadReference.frames_ii.frames_ii002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.frames_ii.frames_ii002 + * nsk.jdi.ThreadReference.frames_ii.frames_ii002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.frames_ii.frames_ii002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java new file mode 100644 index 00000000000..013ef438b8c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java @@ -0,0 +1,212 @@ +/* + * 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.ThreadReference.frames_ii; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the frames_ii002 JDI test. + */ + +public class frames_ii002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.interrupt()
    + * complies with its spec.
    + *
    + * The case for testing includes two tested threads in a debuggee
    + * named thread2 and thread3, and a mirror of thread2 in a debugger.
    + * The method of testing is the comparison of "interrupted status" of
    + * both threads after the method Thread.interrupt() is applied to
    + * thread3 and its "mirroring" method ThreadReference.interrupt() is
    + * applied to the ThreadReference object mirroring thread2.
    + * The test is passed if both 'interrupted status" are equal,
    + * otherwise the test failed.
    + *
    + * The test consists of two cases as follows:
    + * - both debuggee's threads are locked up at synchronized block and
    + * are not suspended;
    + * - both debuggee's threads are locked up at synchronized block and
    + * are suspended by java.lang.Thread.suspend() method;
    + */ + +public class interrupt001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String sHeader1 = "\n==> nsk/jdi/ThreadReference/interrupt/interrupt001 ", sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main(String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new interrupt001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + + public static void log2(String message) { + logHandler.display(sHeader2 + message); + } + + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = "nsk.jdi.ThreadReference.interrupt.interrupt001a"; + + //String mName = "nsk.jdi.ThreadReference.interrupt"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static VirtualMachine vm; + + static Debugee debuggee; + + static IOPipe pipe; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + + static final int returnCode1 = 1; + + static final int returnCode2 = 2; + + static final int returnCode3 = 3; + + static final int returnCode4 = 4; + + static final String EQUALS_INTERRUPTED = "Statuses of threads are equal: interrupted"; + + static final String ONLY_CHECKED_INTERRUPTED = "Only checked Thread2 is interrupted"; + + static final String CHECKED_NOT_INTERRUPTED = "Checked Thread2 is not interrupted"; + + static final String EQUALS_NOT_INTERRUPTED = "Statuses of threads are equal: not interrupted"; + + static final int MAX_CASE = 2; + + //------------------------------------------------------ methods + + private int runThis(String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + pipe = debuggee.createIOPipe(); + + debuggee.redirectStderr(out); + log2("interrupt002a debuggee launched"); + debuggee.resume(); + + try { + debuggee.receiveExpectedSignal("ready"); + } catch (Failure e) { + debuggee.quit(); + throw e; + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; i < MAX_CASE; i++) { + + debuggee.sendSignal("newcheck"); + try { + debuggee.receiveExpectedSignal("checkready"); + } catch (Failure e) { + debuggee.quit(); + throw e; + } + + log1("BEGIN OF CASE #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + switch (i) { + case 0: + executeCase(i, "Thread02"); + break; + + case 1: + executeCase(i, "Thread12"); + break; + } + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + debuggee.sendSignal("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + + } + + private void executeCase(int testCase, String threadName2) { + ThreadReference thread2 = debuggee.threadByName(threadName2); + if (thread2 == null) { + debuggee.quit(); + throw new TestBug("ERROR: Not found ThreadReference for name :" + threadName2); + } + + log2("......interrupting the thread2"); + thread2.interrupt(); + + log2("......instructing main thread to check up threads' interrupted statuses"); + debuggee.sendSignal("check_interruption"); + try { + debuggee.receiveExpectedSignal(EQUALS_INTERRUPTED); + log2("CASE #" + testCase + " PASSED: " + EQUALS_INTERRUPTED); + } catch (Failure e) { + log3("CASE #" + testCase + " FAILED: " + e.getMessage()); + testExitCode = returnCode1; + } + + log2(" forcing the main thread to leave synchronized block"); + debuggee.sendSignal("continue"); + try { + debuggee.receiveExpectedSignal("docontinue"); + } catch (Failure e) { + debuggee.quit(); + throw e; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001/TestDescription.java new file mode 100644 index 00000000000..53ccb6b9175 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001/TestDescription.java @@ -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/ThreadReference/interrupt/interrupt001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.interrupt() + * complies with its spec: + * public void interrupt() + * Interrupts this thread. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * See Also: java.lang.Thread#interrupt() + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.interrupt.interrupt001; + * the debuggee program - nsk.jdi.ThreadReference.interrupt.interrupt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * 4759463 TEST_BUG: tests against ThreadReference.interrupt() should be corrected + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.interrupt.interrupt001 + * nsk.jdi.ThreadReference.interrupt.interrupt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.interrupt.interrupt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java new file mode 100644 index 00000000000..8c8a2cb67f4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java @@ -0,0 +1,284 @@ +/* + * 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.ThreadReference.interrupt; + +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the interrupt001 JDI test. + */ + +public class interrupt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("ERROR: " + message); + } + + //====================================================== test program + + // scaffold objects + private static volatile ArgumentHandler argumentHandler = null; + + private static interrupt001aThread thread2 = null; + + private static interrupt001aThread thread3 = null; + + private static IOPipe pipe; + + //---------------------------------------------------- main method + + public static void main(String argv[]) { + + int exitCode = PASSED; + + argumentHandler = new ArgumentHandler(argv); + + for (int i = 0; i < argv.length; i++) { + if (argv[i].equals("-vbs") || argv[i].equals("-verbose")) { + verbMode = true; + break; + } + } + log1("debuggee started!"); + + // informing a debugger of readyness + pipe = argumentHandler.createDebugeeIOPipe(); + pipe.println("ready"); + + label0: for (int i = 0;; i++) { + + log1("waiting for an instruction from the debugger ..."); + String instruction = pipe.readln(); + + if (instruction.equals("quit")) { + log1("'quit' recieved"); + break; + + } else if (instruction.equals("newcheck")) { + + switch (i) { + case 0: + synchronized (interrupt001aThread.lockingObject) { + thread2 = threadStart("Thread02"); + thread3 = threadStart("Thread03"); + + pipe.println("checkready"); + if (checkInterruptStatus() == FAILED) { + exitCode = FAILED; + break label0; + } + } + log1("mainThread is out of: synchronized (lockingObject)"); + + if (waitThreadJoin(thread2) == FAILED) { + exitCode = FAILED; + } + if (waitThreadJoin(thread3) == FAILED) { + exitCode = FAILED; + } + + instruction = pipe.readln(); + if (!instruction.equals("continue")) { + logErr("Unexpected instruction #1: " + instruction); + exitCode = FAILED; + break label0; + } + pipe.println("docontinue"); + break; + + case 1: + synchronized (interrupt001aThread.lockingObject) { + thread2 = threadStart("Thread12"); + thread3 = threadStart("Thread13"); + + log1("suspending Thread2"); + thread2.suspend(); + + log1("suspending Thread3"); + thread3.suspend(); + + log1("interrupting the Thread3"); + thread3.interrupt(); + + pipe.println("checkready"); + if (checkInterruptStatus() == FAILED) { + exitCode = FAILED; + break label0; + } + } + log1("mainThread is out of: synchronized (lockingObject)"); + + log1("resuming Thread2"); + thread2.resume(); + if (waitThreadJoin(thread2) == FAILED) { + exitCode = FAILED; + } + log1("resuming Thread3"); + thread3.resume(); + if (waitThreadJoin(thread3) == FAILED) { + exitCode = FAILED; + } + + instruction = pipe.readln(); + if (!instruction.equals("continue")) { + logErr("Unexpected instruction #2: " + instruction); + exitCode = FAILED; + break label0; + } + pipe.println("docontinue"); + break; + + //------------------------------------------------- standard end section + } + + } else { + logErr("Unexpected instruction #0: " + instruction); + exitCode = FAILED; + break; + } + } + + System.exit(exitCode + PASS_BASE); + } + + private static interrupt001aThread threadStart(String threadName) { + interrupt001aThread resultThread = new interrupt001aThread(threadName); + synchronized (resultThread.waitnotifyObj) { + resultThread.start(); + try { + log1(" before: waitnotifyObj.wait();"); + while (!resultThread.ready) + resultThread.waitnotifyObj.wait(); + log1(" after: waitnotifyObj.wait();"); + } catch (InterruptedException e) { + logErr("Unexpected InterruptedException while waiting for start of : " + threadName); + } + } + return resultThread; + } + + private static int waitThreadJoin(Thread testedThread) { + long timeout = argumentHandler.getWaitTime() * 60 * 1000; // milliseconds + + if (testedThread.isAlive()) { + // wait for thread finished in a waittime interval + log1("Waiting for tested thread " + testedThread.getName() + " finished for timeout: " + timeout); + try { + testedThread.join(timeout); + } catch (InterruptedException e) { + logErr("Interruption while waiting for tested thread " + testedThread.getName() + " finished:\n\t" + e); + return interrupt001a.FAILED; + } + } + return interrupt001a.PASSED; + } + + private static int checkInterruptStatus() { + log1("waiting for 'check_interruption'"); + String instruction = pipe.readln(); + if (!instruction.equals("check_interruption")) { + logErr("Unexpected instruction #3: " + instruction); + return FAILED; + } + + log1("interrupting thread3"); + thread3.interrupt(); + + log1("checking up statuses of (checked) Thread2 and Thread3"); + if (thread2.isInterrupted()) { + if (thread3.isInterrupted()) { + pipe.println(interrupt001.EQUALS_INTERRUPTED); + log1(" " + interrupt001.EQUALS_INTERRUPTED); + } else { + pipe.println(interrupt001.ONLY_CHECKED_INTERRUPTED); + log1(" " + interrupt001.ONLY_CHECKED_INTERRUPTED); + } + } else if (thread3.isInterrupted()) { + pipe.println(interrupt001.CHECKED_NOT_INTERRUPTED); + log1(" " + interrupt001.CHECKED_NOT_INTERRUPTED); + } else { + pipe.println(interrupt001.EQUALS_NOT_INTERRUPTED); + log1(" " + interrupt001.EQUALS_NOT_INTERRUPTED); + } + return PASSED; + } +} + +class interrupt001aThread extends Thread { + + public interrupt001aThread(String threadName) { + super(threadName); + } + + public boolean ready; + + public Object waitnotifyObj = new Object(); + + public static Object lockingObject = new Object(); + + public void run() { + log("started"); + synchronized (waitnotifyObj) { + log("entered into block: synchronized (waitnotifyObj)"); + ready = true; + waitnotifyObj.notifyAll(); + } + + synchronized (lockingObject) { + log("entered into block: synchronized (lockingObject)"); + } + log("exited from block: synchronized (lockingObject)"); + + log("exited"); + return; + } + + void log(String str) { + interrupt001a.log2(Thread.currentThread().getName() + " : " + str); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java new file mode 100644 index 00000000000..99491e0ac97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java @@ -0,0 +1,516 @@ +/* + * 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.ThreadReference.isAtBreakpoint; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.isAtBreakpoint()
    + * complies with its spec.
    + *
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until the debuggee leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - checks up the values returned by the method isAtBreakpoint();
    + * - sets up a breakpoint within the 'runt1' method to be called.
    + * - forces main thread to leave the synchronized block
    + * in order to unlock the thread2.
    + * When the thread2 is suspended at the breakpoint,
    + * the debugger checks up the value returned by thread2.isAtBreakpoint()
    + * two times, before to resume the thread2 and after that.
    + *
    + */ + +public class isatbreakpoint001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new isatbreakpoint001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.isAtBreakpoint.isatbreakpoint001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.isAtBreakpoint.Threadisatbreakpoint001a"; + + //String mName = "nsk.jdi.ThreadReference.isAtBreakpoint"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + //StackFrame stackFrame = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + + } + + label1: { + if (expresult != returnCode0) + break label1; + + + log2(" checking up the thread2 locked but not at a breakpoint yet"); + if (!thread2.isAtBreakpoint()) { + log2(" : !thread2.isAtBreakpoint()"); + } else { + log3("ERROR: thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + // checking up for Code4 here is to allow further checks that impossible otherwise + if (expresult == returnCode4) + break label1; + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2(" checking up the thread2 before to resume it"); + if (thread2.isAtBreakpoint()) { + log2(" : thread2.isAtBreakpoint()"); + } else { + log3("ERROR: !thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" checking up the thread2 after resuming it"); + if (!thread2.isAtBreakpoint()) { + log2(" : !thread2.isAtBreakpoint()"); + } else { + log3("ERROR: thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + + } + eventSet.resume(); // for case if error when the thread2 was suspended + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001/TestDescription.java new file mode 100644 index 00000000000..e5128862dcf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001/TestDescription.java @@ -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/ThreadReference/isAtBreakpoint/isatbreakpoint001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.isAtBreakpoint() + * complies with its spec: + * public boolean isAtBreakpoint() + * Determines whether the thread is suspended at a breakpoint. + * Returns: true if the thread is currently stopped at a breakpoint; + * false otherwise. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.isAtBreakpoint.isatbreakpoint001; + * the debuggee program - nsk.jdi.ThreadReference.isAtBreakpoint.isatbreakpoint001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.isAtBreakpoint.isatbreakpoint001 + * nsk.jdi.ThreadReference.isAtBreakpoint.isatbreakpoint001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.isAtBreakpoint.isatbreakpoint001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java new file mode 100644 index 00000000000..f3e96f2a1fb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java @@ -0,0 +1,208 @@ +/* + * 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.ThreadReference.isAtBreakpoint; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the isatbreakpoint001 JDI test. + */ + +public class isatbreakpoint001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.isSuspended()
    + * complies with its spec.
    + *
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * (1) Using the method ThreadReference.isSuspended() to get thread2's
    + * state in the following three pairs of suspend-resume methods:
    + * ThreadReference.suspend() - ThreadReference.resume()
    + * ThreadReference.suspend() - VirtualMachine.resume()
    + * VirtualMachine.suspend() - VirtualMachine.resume()
    + * (2) sets up three breakpoints for the thread2 at which it
    + * checks up thread2's state in the following pairs:
    + * suspended_at_breakpoint - EventSet.resume()
    + * suspended_at_breakpoint - ThreadReference.resume()
    + * suspended_at_breakpoint - VirtualMachine.resume()
    + *
    + */ + +public class issuspended001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/isSuspended/issuspended001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + // sHeader2 = "--> issuspended003: ", + // sHeader3 = "##> issuspended003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new issuspended001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.isSuspended.issuspended001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.isSuspended.Threadissuspended001a"; + + //String mName = "nsk.jdi.ThreadReference.isSuspended"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (line.equals("waitnotifyerr")) { + log2(" : returned string is 'waitnotifyerr'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("getting ThreadReference objects for main thread"); + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); + log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest3 = settingBreakpoint(breakpointMethod1, bpLine3, "three"); + if (breakpRequest3 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" checking up the thread2 before to begin testing it"); + + suspCount = thread2.suspendCount(); + log2(" suspendCount == " + suspCount); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + + if (expresult != returnCode0) + break label1; + + log2(".....testing case 1:"); + log2(".....the thread2 is suspended with thread2.suspend();"); + log2(".....and resumed with thread2.resume();"); + + thread2.suspend(); + + suspCount = thread2.suspendCount(); + log2(" checking up the thread2 after suspending it"); + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" suspendCount == " + suspCount); + + thread2.resume(); + + suspCount = thread2.suspendCount(); + log2(" checking up the thread2 after resuming it"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" suspendCount == " + suspCount); + + + log2(".....testing case 2:"); + log2(".....the thread2 is suspended with thread2.suspend();"); + log2(".....and resumed with vm.resume();"); + + thread2.suspend(); + + suspCount = thread2.suspendCount(); + log2(" checking up the thread2 after suspending it"); + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" suspendCount == " + suspCount); + + vm.resume(); + + suspCount = thread2.suspendCount(); + log2(" checking up the thread2 after resuming the application in VM"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" suspendCount == " + suspCount); + + + log2(".....testing case 3:"); + log2(".....the thread2 is suspended with vm.suspend();"); + log2(".....and resumed with vm.resume();"); + + vm.suspend(); + + suspCount = thread2.suspendCount(); + log2(" checking up the thread2 after suspending the application in VM"); + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" suspendCount == " + suspCount); + + vm.resume(); + + suspCount = thread2.suspendCount(); + log2(" checking up the thread2 after resuming the application in VM"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" suspendCount == " + suspCount); + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + } + + log2(" instructing main thread to leave the synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("out_of_synchronized")) { + log3("ERROR: returned string is not 'out_of_synchronized'"); + expresult = returnCode2; + } + + label2: { + + if (expresult == returnCode0) + expresult = breakpoint(); + if (expresult != returnCode0) + break label2; + + log2(" the thread2 is at first breakpoint"); + try { + frameCount = thread2.frameCount(); + log2(" frameCount == " + frameCount); + } catch ( Exception e ) { + log3("ERROR: Exception for : frameCount = thread2.frameCount(); : " + e); + expresult = returnCode1; + } + + log2(" checking up that thread2 is suspended at first breakpoint"); + log2(" suspendCount == " + thread2.suspendCount()); + if ( thread2.isAtBreakpoint() ) { + log2(" : thread2.isAtBreakpoint()"); + } else { + log3("ERROR: !thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + } + + label3: { + + if (expresult != returnCode0) + break label3; + + log2(" instructing main thread to enter the synchronized block"); + pipe.println("enter_synchronized"); + line = pipe.readln(); + if (!line.equals("in_synchronized")) { + log3("ERROR: returned string is not 'in_synchronized'"); + expresult = returnCode4; + break label3; + } + + eventSet.resume(); + + log2(" the thread2 has left the breakpoint"); + + log2(".....testing case 4: suspended_at_breakpoint - eventSet.resume();"); + log2(".....checking up that the thread2 is not at first breakpoint"); + if ( !thread2.isAtBreakpoint() ) { + log2(" : !thread2.isAtBreakpoint()"); + } else { + log3("ERROR: thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + log2(" checking up that the thread2 is not suspended"); + log2(" suspendCount == " + thread2.suspendCount()); + if ( !thread2.isSuspended() ) { + log2(" : !thread2.isSuspended() "); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + } + + log2(" instructing main thread to leave the synchronized block"); + + pipe.println("leave_synchronized"); + line = pipe.readln(); + if (!line.equals("out_of_synchronized")) { + log3("ERROR: returned string is not 'out_of_synchronized'"); + expresult = returnCode4; + } + } + + label4: { + + if (expresult == returnCode0) + expresult = breakpoint(); + if (expresult != returnCode0) + break label4; + + log2(" the thread2 is at second breakpoint"); + try { + frameCount = thread2.frameCount(); + log2(" frameCount == " + frameCount); + } catch ( Exception e ) { + log3("ERROR: Exception for : frameCount = thread2.frameCount(); : " + e); + expresult = returnCode1; + } + + log2(" checking up that the thread2 is suspended at second breakpoint"); + log2(" suspendCount == " + thread2.suspendCount()); + if ( thread2.isAtBreakpoint() ) { + log2(" : thread2.isAtBreakpoint()"); + } else { + log3("ERROR: !thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + } + + label5: { + + if (expresult != returnCode0) + break label5; + + log2(" instructing main thread to enter the synchronized block"); + pipe.println("enter_synchronized"); + line = pipe.readln(); + if (!line.equals("in_synchronized")) { + log3("ERROR: returned string is not 'in_synchronized'"); + expresult = returnCode4; + break label5; + } + + thread2.resume(); + + log2(" the thread2 has left the breakpoint"); + + log2(".....testing case 5: suspended_at_breakpoint - thread2.resume();"); + log2(".....checking up that the thread is not at a breakpoint"); + if ( !thread2.isAtBreakpoint() ) { + log2(" : !thread2.isAtBreakpoint() "); + } else { + log3("ERROR: thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + log2(" checking up that the thread is not suspended"); + log2(" suspendCount == " + thread2.suspendCount()); + if ( !thread2.isSuspended() ) { + log2(" : !thread2.isSuspended() "); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest3"); + breakpRequest3.enable(); + } + + log2(" instructing main thread to leave the synchronized block"); + pipe.println("leave_synchronized"); + line = pipe.readln(); + if (!line.equals("out_of_synchronized")) { + log3("ERROR: returned string is not 'out_of_synchronized'"); + expresult = returnCode4; + } + } + + label6: { + + if (expresult == returnCode0) + expresult = breakpoint(); + if (expresult != returnCode0) + break label6; + + log2(" the thread2 is at third breakpoint"); + try { + frameCount = thread2.frameCount(); + log2(" frameCount == " + frameCount); + } catch ( Exception e ) { + log3("ERROR: Exception for : frameCount = thread2.frameCount(); : " + e); + expresult = returnCode1; + } + + log2(" checking up that the thread2 is suspended at third breakpoint"); + log2(" suspendCount == " + thread2.suspendCount()); + if ( thread2.isAtBreakpoint() ) { + log2(" : thread2.isAtBreakpoint()"); + } else { + log3("ERROR: !thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + + vm.resume(); + + log2(" the thread has left the breakpoint"); + + log2(".....testing case 6: suspended_at_breakpoint - vm.resume();"); + log2(".....checking up that the thread is not at a breakpoint"); + if ( !thread2.isAtBreakpoint() ) { + log2(" : !thread2.isAtBreakpoint() "); + } else { + log3("ERROR: thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + log2(" checking that the thread is not suspended"); + log2(" suspendCount == " + thread2.suspendCount()); + if ( !thread2.isSuspended() ) { + log2(" : !thread2.isSuspended() "); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + } + + if (expresult != returnCode4) { + if (line.equals("in_synchronized")) { + log2("instrucring the main thread to leave synchronized block"); + pipe.println("leave_synchronized"); + line = pipe.readln(); + } + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode2; + } + } + + log2("resuming vm; for case :"); + log2("the thread2 had been suspended at a breakpoint when the test has been aborted"); + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode2; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001/TestDescription.java new file mode 100644 index 00000000000..7eb5f003b5b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ThreadReference/isSuspended/issuspended001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.isSuspended() + * complies with its spec: + * public boolean isSuspended() + * Determines whether the thread has been suspended by the the debugger. + * Returns: true if the thread is currently suspended; false otherwise. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * Testing includes one level suspend()-resume() + * possible pairs of methods specified in + * ThreadReference, VirtualMachine, and EventSet interfaces, + * except for the pair VirtualMachine.suspend()-ThreadReference.resume(). + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.isSuspended.issuspended001; + * the debuggee program - nsk.jdi.ThreadReference.isSuspended.issuspended001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.isSuspended.issuspended001 + * nsk.jdi.ThreadReference.isSuspended.issuspended001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.isSuspended.issuspended001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java new file mode 100644 index 00000000000..0aa5ede48f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java @@ -0,0 +1,244 @@ +/* + * 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.ThreadReference.isSuspended; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the issuspended001 JDI test. + */ + +public class issuspended001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.isSuspended()
    + * complies with its spec.
    + * The test checks up the following case:
    + * - a debuggee with two threads is suspended with VirtualMachine.suspend();
    + * - then one thread is resumed with ThreadReference.resume().
    + *
    + * After being started up, the debuggee :
    + * - creates a 'lockingObject'for synchronizing threads;
    + * - enters into the synchronized block
    + * in which it creates new thread, thread2;
    + * - informs a debugger of the thread creation, and is waiting for reply.
    + * Since the thread2 uses the same lockingObject in its 'run' method
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - sets up a breakpoint for the thread2;
    + * - suspends the thread2 with ThreadReference.suspend();
    + * - instructs the main thread to leave the synchronized block,
    + * after what the thread is waiting for
    + * new instruction from the debugger again;
    + * - totally suspends the debuggee with VirtualMahcine.suspend();
    + * - resumes only the thread2 with double ThreadReference.resume()
    + * that results in thread2's suspendCount == 0;
    + * - checks up that the thread2 is suspended at the breakpoint;
    + * - resumes the debuggee with VirtualMachine.resume().
    + *
    + */ + +public class issuspended002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/isSuspended/issuspended002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new issuspended002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.isSuspended.issuspended002a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.isSuspended.Threadissuspended002a"; + + //String mName = "nsk.jdi.ThreadReference.isSuspended"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("getting ThreadReference objects for main thread"); + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); + log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" checking up before to begin testing the thread2"); + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" mainThread.suspendCount() == " + mainThread.suspendCount()); + if (!mainThread.isSuspended()) { + log2(" : !mainThread.isSuspended()"); + } else { + log3("ERROR: mainThread.isSuspended()"); + expresult = returnCode1; + } + + + log2(" suspending thread2 with thread2.suspend();"); + thread2.suspend(); + + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + log2(" mainThread.suspendCount() == " + mainThread.suspendCount()); + if (!mainThread.isSuspended()) { + log2(" : !mainThread.isSuspended()"); + } else { + log3("ERROR: mainThread.isSuspended() ????????!!!"); + expresult = returnCode1; + } + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + + log2(" suspending VM with vm.suspend();"); + vm.suspend(); + + suspCount = thread2.suspendCount(); + if (suspCount != 2) { + log3("ERROR: thread2.suspendCount() != 2 : " + suspCount); + expresult = returnCode1; + } else { + log2(" thread2.suspendCount() == 2"); + } + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + suspCount = mainThread.suspendCount(); + if (suspCount != 1) { + log3("ERROR: mainThread.suspendCount() != 1 : " + suspCount); + expresult = returnCode1; + } else { + log2(" mainThread.suspendCount() == 1"); + } + if (mainThread.isSuspended()) { + log2(" : mainThread.isSuspended()"); + } else { + log3("ERROR: !mainThread.isSuspended()"); + expresult = returnCode1; + } + + + log2(" double resuming thread2 with thread2.resume();"); + + thread2.resume(); + + suspCount = thread2.suspendCount(); + log2(" thread2.suspendCount() == " + suspCount); + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + + if (expresult == returnCode0) { + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + } + + thread2.resume(); + + suspCount = thread2.suspendCount(); + log2(" thread2.suspendCount() == " + suspCount); + if ( thread2.isAtBreakpoint() ) { + log2(" : thread2.isAtBreakpoint() before call to breakpoint()"); + } else { + log2(" : !thread2.isAtBreakpoint() before call to breakpoint()"); + } + } + + label2: { + + if (expresult == returnCode0) + expresult = breakpoint(); + if (expresult != returnCode0) + break label2; + + log2(" the thread2 is at the breakpoint"); + + log2(" the check that the thread2 is suspended at the breakpoint"); + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + if ( thread2.isAtBreakpoint() ) { + log2(" : thread2.isAtBreakpoint()"); + } else { + log3("ERROR: !thread2.isAtBreakpoint()"); + expresult = returnCode1; + } + if ( thread2.isSuspended() ) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + } + if (mainThread.isSuspended()) { + log2(" : mainThread.isSuspended()"); + } else { + log3("ERROR: !mainThread.isSuspended()"); + expresult = returnCode1; + } + } + + log2(" resuming both second and main thread"); + + vm.resume(); + + if (expresult == returnCode0) { + if ( !thread2.isSuspended() ) { + log2(" : !thread2.isSuspended()"); + } else { + log3("ERROR: thread2.isSuspended()"); + expresult = returnCode1; + } + if ( !mainThread.isSuspended() ) { + log2(" : !mainThread.isSuspended()"); + } else { + log3("ERROR: mainThread.isSuspended()"); + expresult = returnCode2; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java new file mode 100644 index 00000000000..109340eea6c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java @@ -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/ThreadReference/isSuspended/issuspended002. + * VM Testbase keywords: [jpda, jdi, quarantine] + * VM Testbase comments: JDK-4903717 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.isSuspended() + * complies with its spec: + * public boolean isSuspended() + * Determines whether the thread has been suspended by the the debugger. + * Returns: true if the thread is currently suspended; false otherwise. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * Testing includes only the pair + * VirtualMachine.suspend()-ThreadReference.resume(). + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.isSuspended.issuspended002; + * the debuggee program - nsk.jdi.ThreadReference.isSuspended.issuspended002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.isSuspended.issuspended002 + * nsk.jdi.ThreadReference.isSuspended.issuspended002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.isSuspended.issuspended002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java new file mode 100644 index 00000000000..25a50e0ed2a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java @@ -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.ThreadReference.isSuspended; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the issuspended002 JDI test. + */ + +public class issuspended002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.isSuspended()
    + * complies with its spec.
    + * The test checks up the following case:
    + * - a debuggee with second thread, thread2 started up and
    + * locked up at a synchronized block,
    + * - suspending the thread2 with ThreadReference.suspend()
    + * after making debugger's EventQueue empty. + *
    + * After being started up, the debuggee :
    + * - creates a 'lockingObject'for synchronizing threads;
    + * - enters into the synchronized block
    + * in which it creates the thread2;
    + * - informs a debugger of the thread2 creation,
    + * and is waiting for an instruction.
    + * Since thread2 uses the same lockingObject in its 'run' method
    + * it is locked up until the debuggee leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - removes all events from an EventQueue object;
    + * - suspends thread2 with ThreadReference.suspend();
    + * - checks up that the thread2 is suspended.
    + *
    + */ + +public class issuspended003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/isSuspended/issuspended003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + // sHeader2 = "--> issuspended003: ", + // sHeader3 = "##> issuspended003: "; + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new issuspended003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.isSuspended.issuspended003a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.isSuspended.Threadissuspended003a"; + + //String mName = "nsk.jdi.ThreadReference.isSuspended"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("getting ThreadReference objects for main thread"); + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); + log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" checking up before to make eventQueue empty"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + log2(" suspendCount == " + thread2.suspendCount()); + } else { + log3("ERROR: thread2.isSuspended()"); + log2(" suspendCount == " + thread2.suspendCount()); + expresult = returnCode1; + } + + if (expresult == returnCode0) + expresult = removingEvents(); + + if (expresult != returnCode0) + log2("aborting the check because of unsuccessful removing events"); + else { + log2(" checking up after getting eventQueue empty"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + } else { + log3("ERROR: thread2.isSuspended()"); + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + expresult = returnCode1; + } + } + + if (expresult == returnCode0) { + + log2(" suspending thread2 with threadRef.suspend();"); + thread2.suspend(); + + suspCount = thread2.suspendCount(); + boolean isSusp = thread2.isSuspended(); + + log2(" thread2.suspendCount() == " + suspCount); + if (suspCount != returnCode0) + if (isSusp) { + log2(" : thread2.isSuspended() and suspendCount() != 0"); + } else { + log3("ERROR: !thread2.isSuspended() but suspendCount() != 0"); + expresult = returnCode1; + } + else + if (isSusp) { + log2("ERROR: thread2.isSuspended() but suspendCount() == 0"); + } else { + log3("ERROR: !thread2.isSuspended() and suspendCount() == 0"); + expresult = returnCode1; + } + + thread2.resume(); + + } + + log2(" disabling breakpRequest1"); + breakpRequest1.disable(); + + pipe.println("continue"); + + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It set up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ +/* + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode2; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +*/ + /* + * private int removingEvents() + * + * It removs all events from EventQueue. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "1000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove(1000)" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int removingEvents() { + + int returnCode = returnCode0; + + log2(" removing events from EventQueue"); + + for (;;) { + + log2(" new: eventSet = eventQueue.remove(1000);"); + try { + eventSet = eventQueue.remove(1000); + } catch ( Exception e ) { + log3("ERROR: eventSet = eventQueue.remove() : " + e); + returnCode = returnCode2; + break; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break ll; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // end of switch + } catch ( ClassCastException e ) { + } + } // ll: + } // for (; ev.hasNext(); ) + + } else { + log2(" : eventSet == null: EventQueue is empty"); + break; + } + } + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003/TestDescription.java new file mode 100644 index 00000000000..73886d1cb0b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003/TestDescription.java @@ -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/ThreadReference/isSuspended/issuspended003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.isSuspended() + * complies with its spec: + * public boolean isSuspended() + * Determines whether the thread has been suspended by the the debugger. + * Returns: true if the thread is currently suspended; false otherwise. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test checks up the following particular case: + * - a debuggee with second thread started up and + * locked up at a synchronized block, + * - suspending the thread with ThreadReference.suspend() after + * making debugger's EventQueue empty. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.isSuspended.issuspended003; + * the debuggee program - nsk.jdi.ThreadReference.isSuspended.issuspended003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.isSuspended.issuspended003 + * nsk.jdi.ThreadReference.isSuspended.issuspended003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.isSuspended.issuspended003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java new file mode 100644 index 00000000000..4a60d3769b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java @@ -0,0 +1,208 @@ +/* + * 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.ThreadReference.isSuspended; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the issuspended003 JDI test. + */ + +public class issuspended003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.isSuspended()
    + * complies with its spec.
    + * The test checks up the following case:
    + * - a debuggee with second thread started up and
    + * locked up at a synchronized block,
    + * - suspending the thread with VirualMachine.suspend() after
    + * after removing all events from debugger's EventQueue.
    + *
    + * After being started up, the debuggee :
    + * - creates a 'lockingObject'for synchronizing threads;
    + * - enters into the synchronized block
    + * in which it creates new thread, thread2;
    + * - informs a debugger of the thread2 creation,
    + * and is waiting for instruction.
    + * Since new thread uses the same lockingObject in its 'run' method
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - removes all events from its EventQueue object;
    + * - suspends whole the debuggee with VirualMachine.suspend();
    + * - checks up that the thread2 is suspended.
    + *
    + */ + +public class issuspended004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/isSuspended/issuspended004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new issuspended004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.isSuspended.issuspended004a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.isSuspended.Threadissuspended004a"; + + //String mName = "nsk.jdi.ThreadReference.isSuspended"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended004a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + int frameCount; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("getting ThreadReference objects for main thread"); + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); + log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" checking up before to make eventQueue empty"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + log2(" suspendCount == " + thread2.suspendCount()); + } else { + log3("ERROR: thread2.isSuspended()"); + log2(" suspendCount == " + thread2.suspendCount()); + expresult = returnCode1; + } + + if (expresult == returnCode0) + expresult = removingEvents(); + + if (expresult != returnCode0) + log2("aborting the check because of unsuccessful removing events"); + else { + log2(" checking up after getting eventQueue empty"); + if (!thread2.isSuspended()) { + log2(" : !thread2.isSuspended()"); + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + } else { + log3("ERROR: thread2.isSuspended()"); + log2(" thread2.suspendCount() == " + thread2.suspendCount()); + expresult = returnCode1; + } + } + + if (expresult == returnCode0) { + + log2(" suspending thread2 with threadRef.suspend();"); + vm.suspend(); + + suspCount = thread2.suspendCount(); + boolean isSusp = thread2.isSuspended(); + + log2(" thread2.suspendCount() == " + suspCount); + if (suspCount != returnCode0) + if (isSusp) { + log2(" : thread2.isSuspended() and suspendCount() != 0"); + } else { + log3("ERROR: !thread2.isSuspended() but suspendCount() != 0"); + expresult = returnCode1; + } + else + if (isSusp) { + log2("ERROR: thread2.isSuspended() but suspendCount() == 0"); + } else { + log3("ERROR: !thread2.isSuspended() and suspendCount() == 0"); + expresult = returnCode1; + } + } + + log2(" disabling breakpRequest1"); + breakpRequest1.disable(); + + pipe.println("continue"); + + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It set up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ +/* + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode2; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +*/ + + /* + * private int removingEvents() + * + * It removs all events from EventQueue. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "1000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove(1000)" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int removingEvents() { + + int returnCode = 0; + + log2(" removing events from EventQueue"); + + for (;;) { + + log2(" new: eventSet = eventQueue.remove(1000);"); + try { + eventSet = eventQueue.remove(1000); + } catch ( Exception e ) { + log3("ERROR: eventSet = eventQueue.remove() : " + e); + returnCode = 1; + break; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != 0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break ll; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = 1; + break ll; + } // end of switch + } catch ( ClassCastException e ) { + } + } // ll: + } // for (; ev.hasNext(); ) { + + } else { + log2(" : eventSet == null: EventQueue is empty"); + break; + } + } + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004/TestDescription.java new file mode 100644 index 00000000000..20b3ebc7f60 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004/TestDescription.java @@ -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/ThreadReference/isSuspended/issuspended004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.isSuspended() + * complies with its spec: + * public boolean isSuspended() + * Determines whether the thread has been suspended by the the debugger. + * Returns: true if the thread is currently suspended; false otherwise. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test checks up the following particular case: + * - a debuggee with second thread started up and + * locked up at a synchronized block, + * - suspending the thread with VirtualMachine.suspend() after + * making debugger's EventQueue empty. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.isSuspended.issuspended004; + * the debuggee program - nsk.jdi.ThreadReference.isSuspended.issuspended004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.isSuspended.issuspended004 + * nsk.jdi.ThreadReference.isSuspended.issuspended004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.isSuspended.issuspended004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java new file mode 100644 index 00000000000..465ec33e080 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java @@ -0,0 +1,208 @@ +/* + * 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.ThreadReference.isSuspended; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the issuspended004 JDI test. + */ + +public class issuspended004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.name()
    + * complies with its spec.
    + *
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until the debuggee leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger checks up that the string returned by thread2.name()
    + * is equal to one used to create it.
    + *
    + */ + +public class name001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/name/name001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.name.name001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.name.Threadname001a"; + + //String mName = "nsk.jdi.ThreadReference.name"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + //String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + //String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + //BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" checking up thread2's name; expected: 'testedThread'"); + String name = thread2.name(); + if (!name.equals(threadName)) { + log3("ERROR: !name.equals(threadName) :" + name); + expresult = returnCode1; + } + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ +/* + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } +*/ + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ +/* + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +*/ +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001/TestDescription.java new file mode 100644 index 00000000000..035434148db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ThreadReference/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.name() + * complies with its spec: + * public java.lang.String name() + * Returns the name of this thread. + * Returns: the string containing the thread name. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.name.name001; + * the debuggee program - nsk.jdi.ThreadReference.name.name001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.name.name001 + * nsk.jdi.ThreadReference.name.name001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java new file mode 100644 index 00000000000..0c110d46034 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java @@ -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.ThreadReference.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name001 JDI test. + */ + +public class name001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.ownedMonitors()
    + * complies with its spec.
    + */ + +public class ownedmonitors001 { + + //----------------------------------------------------- template section + private static final int PASSED = 0; + private static final int FAILED = 2; + private static final int PASS_BASE = 95; + + private static final String sHeader1 = "==> debugger: "; + private static final String sHeader2 = "--> debugger: "; + private static final String sHeader3 = "ERROR ##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new ownedmonitors001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private static final String debuggeeName = "nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors001a"; +// private static String testedClassName = "nsk.jdi.ThreadReference.ownedMonitors.Threadownedmonitors001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + private static ArgumentHandler argsHandler; + private static int waitTime; + private static VirtualMachine vm = null; + private static int testExitCode = PASSED; + private static ReferenceType debuggeeRef; + + private static Vector expMonitors = new Vector(); + private static Vector monitorNames = new Vector(); + private static final int monitorCount = 2; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + IOPipe pipe = debuggee.createIOPipe(); + + debuggee.redirectStderr(logHandler, "debuggee.err > "); + log2("debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("Signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + log2("TESTING BEGINS"); + label1: { + debuggeeRef = debuggee.classByName(debuggeeName); + if (debuggeeRef == null) { + log3("Cannot find ReferenceType for " + debuggeeName); + testExitCode = FAILED; + break label1; + } + + for (int i2 = 0; ; i2++) { + if (!vm.canGetOwnedMonitorInfo()) { + log1("TEST ABORTED: vm.canGetOwnedMonitorInfo() returned false."); + break label1; + } + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2("'checkend' received"); + break ; + } else if (!line.equals("checkready")) { + log3("Returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log2("Case #" + i2); + switch (i2) { + + case 0 : + checkMonitors("main", 0); + break; + + case 1 : + checkMonitors("main", monitorCount); + break; + + default: + log3("default:"); + break label1; + } + + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("Returned string is not 'docontinue'"); + testExitCode = FAILED; + break label1; + } + + } // for + } + log2("TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log1("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log1("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + private void checkMonitors(String threadName, int expSize) { + log1("Getting ThreadReference for " + threadName + " thread"); + ThreadReference checkedThread = null; + Iterator itr = vm.allThreads().listIterator(); + while (itr.hasNext()) { + ThreadReference thread = (ThreadReference) itr.next(); + if (thread.name().equals(threadName)) { + checkedThread = thread; + } + } + if (checkedThread == null) { + log3("Cannot find " + threadName + "thread in the debuggee"); + testExitCode = FAILED; + return; + } + log1("Checking up throwing an IncompatibleThreadStateException for not suspended thread"); + List monitors; + try { + monitors = checkedThread.ownedMonitors(); + log3("No IncompatibleThreadStateException for " + threadName + " thread"); + testExitCode = FAILED; + } catch ( IncompatibleThreadStateException e1 ) { + log1("Expected IncompatibleThreadStateException is thrown"); + } + + log1("Suspending the " + threadName + " thread"); + checkedThread.suspend(); + + log1("Checking up ownedMonitors() list"); + try { + monitors = checkedThread.ownedMonitors(); + int monSize = monitors.size(); + if (monSize < expSize) { + log3("Got unexpected ownedMonitors() list size : " + monSize + + "\n\t expected minimal value : " + expSize); + testExitCode = FAILED; + } else { + log1("Got size of ownedMonitors() list: " + monSize); + + if (expSize > 0) { + log1("Checking up items in ownedMonitors() list"); + getMonitorRefs(); + itr = expMonitors.iterator(); + while (itr.hasNext()) { + ObjectReference mon = (ObjectReference) itr.next(); + if (monitors.contains(mon)) { + log1("Found expected item in ownedMonitors() list : " + mon); + } else { + log3("Did not found expected item in ownedMonitors() list : " + mon); + testExitCode = FAILED; + } + } + } + } + } catch ( IncompatibleThreadStateException e1 ) { + log3("Unexpected IncompatibleThreadStateException is thrown"); + testExitCode = FAILED; + } + log1("Resuming the main thread"); + checkedThread.resume(); + } + + private void getMonitorRefs () { + monitorNames.add("waitnotifyObj"); + monitorNames.add("lockingObject"); + Iterator itr = monitorNames.iterator(); + while (itr.hasNext()) { + try { + String monName = (String)itr.next(); + Field field = debuggeeRef.fieldByName(monName); + Value value = debuggeeRef.getValue(field); + expMonitors.add((ObjectReference)value); + } catch (Exception e) { + log3("Unexpected excption while getting ObjectReference for monitors"); + testExitCode = FAILED; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001/TestDescription.java new file mode 100644 index 00000000000..05a30e39277 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001/TestDescription.java @@ -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/ThreadReference/ownedMonitors/ownedmonitors001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up that an implementation of the method + * com.sun.jdi.ThreadReference.ownedMonitors() conforms with its spec. + * The test checks an assertion: + * Returns a List containing an ObjectReference for each monitor owned by the thread. + * A monitor is owned by a thread if it has been entered (via the synchronized statement + * or entry into a synchronized method) and has not been relinquished through Object.wait(long). + * There are two test cases: + * - for a thread with no owned monitors, + * - for a thread with owned monitors, entered via the synchronized statement. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors001; + * the debuggee program - nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors001a. + * Communication details between the debugger and the debuggee: + * Using nsk.jdi.share classes, the debugger connects to debuggee program running + * on another VM and establishes a communication pipe with the debuggee. The pipe + * is used in bi-directional way by sending and receiving special commands between + * the debugger and debuggee for synchronization + * In case of error the test produces the exit code 97 and a corresponding error + * message(s). Otherwise, the test is passed and produces the exit code 95 and + * no message. + * COMMENTS: + * 4769563 NSK ownedmonitors001 sends an incorrect test-sync mesg + * 5009132 nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001 monitor count fail + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors001 + * nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001a.java new file mode 100644 index 00000000000..4a9a34803cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001a.java @@ -0,0 +1,150 @@ +/* + * 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.ThreadReference.ownedMonitors; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the ownedmonitors001 JDI test. + */ + +public class ownedmonitors001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println(Thread.currentThread().getName() + " : " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static Object waitnotifyObj = new Object(); + public static Object lockingObject = new Object(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.ThreadReference.ownedMonitors()
    + * properly throws UnsupportedOperationException, if + * the target VM does not support the retrieval of the monitor for + * which a thread is currently waiting (determinated by calling + * VirtualMachine.canGetOwnedMonitorInfo()), and vise versa + * otherwise. + */ +public class ownedmonitors002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors002t"; + + // name of debuggee's main thread + static final String DEBUGGEE_THRNAME = "ownedmonitors002tThr"; + + static final int ATTEMPTS = 5; + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private int tot_res = Consts.TEST_PASSED; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedmonitors002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "ownedmonitors002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + int num = 0; + thrRef.suspend(); + while(!thrRef.isSuspended()) { + num++; + if (num > ATTEMPTS) { + log.complain("TEST FAILURE: Unable to suspend debuggee thread after " + + ATTEMPTS + " attempts"); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + log.display("Waiting for debuggee thread suspension ..."); + try { + Thread.currentThread().sleep(DELAY); + } catch(InterruptedException ie) { + ie.printStackTrace(); + log.complain("TEST FAILURE: caught: " + ie); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + } + +// Check the tested assersion + try { + List mons = thrRef.ownedMonitors(); + if (vm.canGetOwnedMonitorInfo()) { + log.display("CHECK PASSED: got a List of monitors owned by the thread," + + "\n\tand VirtualMachine.canGetOwnedMonitorInfo() shows, that the target VM" + + "supports the retrieval of the monitors owned by a thread as well: " + + vm.canGetOwnedMonitorInfo()); + } else { + log.complain("TEST FAILED: got a List of monitors owned by the thread," + + "\n\thowever, VirtualMachine.canGetOwnedMonitorInfo() shows, that the target VM" + + "\n\tdoes not support the retrieval of the monitors owned by a thread: " + + vm.canGetOwnedMonitorInfo()); + tot_res = Consts.TEST_FAILED; + } + } catch(UnsupportedOperationException une) { + if (vm.canGetOwnedMonitorInfo()) { + une.printStackTrace(); + log.complain("TEST FAILED: caught exception: " + une + + "\n\tHowever, VirtualMachine.canGetOwnedMonitorInfo() shows, that the target VM" + + "\n\tsupports the retrieval of the monitors owned by a thread: " + + vm.canGetOwnedMonitorInfo()); + tot_res = Consts.TEST_FAILED; + } else { + log.display("CHECK PASSED: caught expected exception: " + une + + "\n\tand VirtualMachine.canGetOwnedMonitorInfo() shows, that the target VM" + + "\n\tdoes not support the retrieval of the monitors owned by a thread as well: " + + vm.canGetOwnedMonitorInfo()); + } + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILED: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } + +// Finish the test + return quitDebuggee(); + } + + private int quitDebuggee() { + log.display("Resuming debuggee ..."); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002/TestDescription.java new file mode 100644 index 00000000000..420b3cbd8ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002/TestDescription.java @@ -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/ThreadReference/ownedMonitors/ownedmonitors002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method: + * com.sun.jdi.ThreadReference.ownedMonitors() + * properly throws UnsupportedOperationException, if the target VM + * does not support the retrieval of the monitor for which a thread + * is currently waiting (determinated by calling + * VirtualMachine.canGetOwnedMonitorInfo()), and vise versa otherwise. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors002 + * nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors002t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitors.ownedmonitors002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002t.java new file mode 100644 index 00000000000..f55817ddcdc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002t.java @@ -0,0 +1,54 @@ +/* + * 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.ThreadReference.ownedMonitors; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is a debuggee class. + */ +public class ownedmonitors002t { + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(ownedmonitors002.DEBUGGEE_THRNAME); + + // Now the debuggee is ready for testing + pipe.println(ownedmonitors002.COMMAND_READY); + + String cmd = pipe.readln(); + if (!cmd.equals(ownedmonitors002.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_PASSED); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.java new file mode 100644 index 00000000000..14b5e5d844a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test check that attempt to call com.sun.jdi.ThreadReference.ownedMonitorsAndFrames on non-suspended VM + * throws IncompatibleThreadStateException. + * Special thread class is used in debugee VM for testing thread in different states - nsk.share.jpda.StateTestThread. + * StateTestThread sequentially changes its state in following order: + * - thread not started + * - thread is running + * - thread is sleeping + * - thread in Object.wait() + * - thread wait on java monitor + * - thread is finished + * Debugger VM calls ThreadReference.ownedMonitorsAndFrames() for all this states and expects IncompatibleThreadStateException. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001; + +import java.io.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.*; +import nsk.share.jpda.StateTestThread; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class ownedMonitorsAndFrames001 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return AbstractJDIDebuggee.class.getName(); + } + + private void test(ThreadReference threadReference) { + log.display("Thread state: " + threadReference.status()); + try { + // call ThreadReference.ownedMonitorsAndFrames() on non-suspended VM + // IncompatibleThreadStateException should be thrown + threadReference.ownedMonitorsAndFrames(); + setSuccess(false); + log.complain("Expected IncompatibleThreadStateException was not thrown"); + } catch (IncompatibleThreadStateException e) { + // expected exception + } catch (Throwable e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + } + + public void doTest() { + // create StateTestThread + pipe.println(AbstractDebuggeeTest.COMMAND_CREATE_STATETESTTHREAD); + + if (!isDebuggeeReady()) + return; + + // StateTestThread in state 0 + ThreadReference threadReference = (ThreadReference) findSingleObjectReference(AbstractDebuggeeTest.stateTestThreadClassName); + + test(threadReference); + + // change StateTestThread's state from 1 to stateTestThreadStates.length + int state = 1; + + while (state++ < StateTestThread.stateTestThreadStates.length) { + pipe.println(AbstractDebuggeeTest.COMMAND_NEXTSTATE_STATETESTTHREAD); + + if (!isDebuggeeReady()) + return; + + test(threadReference); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.java new file mode 100644 index 00000000000..771186bfcf3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Debuggee VM create thread which acquires several monitors in following ways: + * - entering synchronized method + * - entering synchronized method for thread object itself + * - entering synchronized static method + * - entering synchronized method for thread class itself + * - entering synchronized block on non-static object + * - entering synchronized block on non-static on thread object itself + * - entering synchronized block on static object + * - entering synchronized block on static thread object itself + * Information about all monitors acquired by test thread is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * When debuggee's test threads acquires all monitors debugger reads information about acquired monitors + * from 'OwnedMonitorsDebuggee.monitorsInfo' and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects. + * Debugger VM forces test thread in debuggee VM sequentially free all monitors(exit from synchronized blocks/methods), + * update debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo object. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002; + +import java.util.*; +import java.io.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.OwnedMonitorsDebuggee; +import nsk.share.jdi.OwnedMonitorsDebugger; +import nsk.share.locks.LockingThread; + +public class ownedMonitorsAndFrames002 extends OwnedMonitorsDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames002().runIt(argv, out); + } + + public void doTest() { + initDefaultBreakpoint(); + + try { + // create command: + + List locksTypes = new ArrayList(); + + // debuggee thread acquires monitors in different ways + locksTypes.add(LockingThread.SYNCHRONIZED_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_BLOCK_STATIC_THREAD_OBJECT); + locksTypes.add(LockingThread.SYNCHRONIZED_THREAD_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_STATIC_THREAD_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_THIS_BLOCK); + locksTypes.add(LockingThread.SYNCHRONIZED_OBJECT_BLOCK); + locksTypes.add(LockingThread.SYNCHRONIZED_BLOCK_STATIC_OBJECT); + locksTypes.add(LockingThread.SYNCHRONIZED_STATIC_METHOD); + locksTypes.add(LockingThread.FRAME_WITHOUT_LOCK); + + String threadName = "ownedMonitorsAndFrames002_LockingThread1"; + String command = OwnedMonitorsDebuggee.COMMAND_CREATE_LOCKING_THREAD + ":" + threadName; + + for (String lockType : locksTypes) { + command += ":" + lockType; + } + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + + ThreadReference threadReference = debuggee.threadByName(threadName); + + // debuggee save information about acquired monitors in array 'OwnedMonitorsDebuggee.monitorsInfo' + pipe.println(OwnedMonitorsDebuggee.COMMAND_UPDATE_MONITOR_INFO + ":" + threadName); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + // check that ThreadReference.ownedMonitorsAndFrames() returns correct data + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + + // force debuggee thread sequentially exit from synchronized blocks/methods and check results of ownedMonitorsAndFrames() + for (int i = 0; i < locksTypes.size(); i++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_EXIT_SINGLE_FRAME + ":" + threadName); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + // check that ThreadReference.ownedMonitorsAndFrames() returns correct data + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + } finally { + removeDefaultBreakpoint(); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames003/ownedMonitorsAndFrames003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames003/ownedMonitorsAndFrames003.java new file mode 100644 index 00000000000..34a0d815676 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames003/ownedMonitorsAndFrames003.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Debuggee VM create thread which acquires 5 different monitors in following ways: + * - entering synchronized method + * - entering synchronized method for thread object itself + * - entering synchronized static method + * - entering synchronized method for thread class itself + * - entering synchronized block on non-static object + * Information about all monitors acquired by test thread is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * Debugger VM reads information about acquired monitors from 'OwnedMonitorsDebuggee.monitorsInfo' + * and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames returns correct list of MonitorInfo objects. + * Debugger VM forces test thread in debuggee VM sequentially free monitors through Object.wait(), + * updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects. + * Debugger VM forces test thread in debuggee VM free all monitors(exit from all synchronized objects/blocks), + * update debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003.ownedMonitorsAndFrames003 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003.ownedMonitorsAndFrames003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.jdi.OwnedMonitorsDebuggee; +import nsk.share.jdi.OwnedMonitorsDebugger; +import nsk.share.locks.LockingThread; +import nsk.share.Consts; + +public class ownedMonitorsAndFrames003 extends OwnedMonitorsDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames003().runIt(argv, out); + } + + public void doTest() { + initDefaultBreakpoint(); + + try { + List locksTypes = new ArrayList(); + + // LockingThread acquire 5 different monitors + locksTypes.add(LockingThread.SYNCHRONIZED_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_THREAD_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_STATIC_THREAD_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_OBJECT_BLOCK); + locksTypes.add(LockingThread.SYNCHRONIZED_STATIC_METHOD); + + String threadName = "ownedMonitorsAndFrames003_LockingThread1"; + String command = OwnedMonitorsDebuggee.COMMAND_CREATE_LOCKING_THREAD + ":" + threadName; + + for (String lockType : locksTypes) { + command += ":" + lockType; + } + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + ThreadReference threadReference = debuggee.threadByName(threadName); + + // check ownedMonitorsAndFrames() first time when all monitors are locked + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + + // For all LockingThread's monitors: + // - force thread relinquish monitors through Object.wait(), + // - check results of ownedMonitorsAndFrames() + // - force debuggee thread acquire relinquished monitor + // - check results of ownedMonitorsAndFrames() + for (int i = 0; i < locksTypes.size(); i++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_RELINQUISH_MONITOR + ":" + threadName + ":" + i); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + + pipe.println(OwnedMonitorsDebuggee.COMMAND_ACQUIRE_RELINQUISHED_MONITOR + ":" + threadName); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + + // LockingThread should free all monitors + + pipe.println(OwnedMonitorsDebuggee.COMMAND_STOP_LOCKING_THREAD + ":" + threadName); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } finally { + removeDefaultBreakpoint(); + } + + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004.java new file mode 100644 index 00000000000..8d08d81cd9b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Debuggee VM creates 3 deadlocks(package nsk.share.locks is used) with usage of following resources: + * - first thread acquires java lock through synchronized block, + * second thread acquires java lock through synchronized method + * - first thread acquires java lock through synchronized blocks, + * second thread acquires lock through JNI function 'MonitorEnter' + * - first thread acquires java locks through synchronized blocks, + * second thread acquires lock through JNI function 'MonitorEnter', + * third thread acquires java locks through synchronized method + * Information about all monitors acquired by test threads is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * Debugger VM reads information about acquired monitors from 'OwnedMonitorsDebuggee.monitorsInfo' + * and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames returns correct list of MonitorInfo objects. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004a + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004; + +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.List; +import nsk.share.Consts; +import nsk.share.jdi.OwnedMonitorsDebugger; +import nsk.share.locks.LockType; + +public class ownedMonitorsAndFrames004 extends OwnedMonitorsDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames004().runIt(argv, out); + } + + public String debuggeeClassName() { + return "nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004a"; + } + + private void checkDeadlockedThread(String... threadNames) { + // expectedData.get(i) - data for thread with name 'threadNames[i]' + List expectedData = getDebugMonitorsInfo(); + + if (expectedData.size() != threadNames.length) { + log.complain("TEST BUG: debugee didn't provide correct debug information"); + setSuccess(false); + return; + } + + List expectedDataForSingleThread = new ArrayList(); + + for (int i = 0; i < threadNames.length; i++) { + expectedDataForSingleThread.clear(); + expectedDataForSingleThread.add(expectedData.get(i)); + + try { + compare(debuggee.threadByName(threadNames[i]).ownedMonitorsAndFrames(), expectedDataForSingleThread); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + } + } + + private int threadNameIndex; + + private void createAndCheckDeadlock(LockType... lockTypes) { + String threadNames[] = new String[lockTypes.length]; + + for (int i = 0; i < threadNames.length; i++) + threadNames[i] = "ownedMonitorsAndFrames004_DeadlockedThread" + (++threadNameIndex); + + String command = ownedMonitorsAndFrames004a.COMMAND_CREATE_DEADLOCK; + + for (int i = 0; i < threadNames.length; i++) { + command += ":" + threadNames[i] + ":" + lockTypes[i]; + } + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + // check result of ownedMonitorsAndFrames() for deadlocked threads + checkDeadlockedThread(threadNames); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + + public void doTest() { + initDefaultBreakpoint(); + + try { + createAndCheckDeadlock(LockType.SYNCHRONIZED_BLOCK, LockType.SYNCHRONIZED_METHOD); + + createAndCheckDeadlock(LockType.SYNCHRONIZED_BLOCK, LockType.JNI_LOCK); + + createAndCheckDeadlock(LockType.SYNCHRONIZED_BLOCK, LockType.JNI_LOCK, LockType.SYNCHRONIZED_METHOD); + } finally { + removeDefaultBreakpoint(); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004a.java new file mode 100644 index 00000000000..424de3673bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004a.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004; + +import java.io.*; +import java.util.ArrayList; +import nsk.share.TestBug; +import nsk.share.jdi.OwnedMonitorsDebuggee; +import nsk.share.locks.*; + +public class ownedMonitorsAndFrames004a extends OwnedMonitorsDebuggee { + // command:threadName:lock_type:threadName:lock_type + public static final String COMMAND_CREATE_DEADLOCK = "createDeadlock"; + + public static void main(String args[]) { + ownedMonitorsAndFrames004a debuggee = new ownedMonitorsAndFrames004a(); + debuggee.init(args); + debuggee.doTest(); + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + try { + if (command.startsWith(COMMAND_CREATE_DEADLOCK)) { + StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(command)); + tokenizer.whitespaceChars(':', ':'); + tokenizer.wordChars('_', '_'); + tokenizer.wordChars(' ', ' '); + tokenizer.wordChars('$', '$'); + + tokenizer.nextToken(); + + ArrayList deadlockedThreadsNames = new ArrayList(); + ArrayList deadlockedThreadsLocksTypes = new ArrayList(); + + int nextToken = tokenizer.nextToken(); + + while (nextToken != StreamTokenizer.TT_EOF) { + String threadName = tokenizer.sval; + + if (tokenizer.nextToken() != StreamTokenizer.TT_WORD) + throw new TestBug("Invalid command format: " + command); + + LockType lockType; + + try { + lockType = LockType.valueOf(tokenizer.sval); + } catch (IllegalArgumentException e) { + throw new TestBug("Invalid command format: " + command + ", invalid lock type: " + tokenizer.sval); + } + + deadlockedThreadsNames.add(threadName); + deadlockedThreadsLocksTypes.add(lockType); + + nextToken = tokenizer.nextToken(); + } + + if (deadlockedThreadsNames.size() < 2) + throw new TestBug("Invalid command format: " + command + ", at least 2 thread are required for deadlock"); + + createDeadlock(deadlockedThreadsNames, deadlockedThreadsLocksTypes); + + return true; + } + } catch (IOException e) { + throw new TestBug("Invalid command format: " + command); + } + + return false; + } + + private DeadlockedThread deadlockedThreads[]; + + public void createDeadlock(ArrayList deadlockedThreadsNames, ArrayList deadlockedThreadsLocksTypes) { + deadlockedThreads = DeadlockMaker.createDeadlockedThreads(deadlockedThreadsLocksTypes); + + monitorsInfo = new LockingThread.DebugMonitorInfo[deadlockedThreadsNames.size()]; + + // fill 'monitorsInfo' array with debug data using knowledge about nsk.share.locks.DeadlockedThread + for (int i = 0; i < deadlockedThreadsNames.size(); i++) { + deadlockedThreads[i].setName(deadlockedThreadsNames.get(i)); + + Object monitor = deadlockedThreads[i].getLocker().getLock(); + + int stackDepth = 2; + boolean isJNILock = false; + + if (deadlockedThreads[i].getLocker() instanceof JNIMonitorLocker) { + stackDepth = -1; + isJNILock = true; + } + + monitorsInfo[i] = new LockingThread.DebugMonitorInfo(monitor, stackDepth, deadlockedThreads[i], isJNILock); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames005/ownedMonitorsAndFrames005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames005/ownedMonitorsAndFrames005.java new file mode 100644 index 00000000000..3dffabd4c21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames005/ownedMonitorsAndFrames005.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames005. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test checks that acquired JNI monitors are handled correctly. Possibility to return JNI monitors related to 6415394, + * it should be fixed in Mustang b85. If JNI monitors should be returned by ThreadReference.ownedMonitorsAndFrames() + * run test with parameter '-expectJNIMonitors', otherwise run test without parameters. + * Test scenario: + * Debuggee VM creates thread which acquires several JNI monitors(through JNI MonitorEnter()) and + * one monitor through entering synchronized block. + * Information about all monitors acquired by test thread is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * Debugger VM reads information about acquired monitors from 'OwnedMonitorsDebuggee.monitorsInfo' + * and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames returns correct list of MonitorInfo objects. + * Debugger VM forces test thread in debuggee VM sequentially free all monitors(exit from synchronized block or + * call JNI MonitorExit()), updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005.ownedMonitorsAndFrames005 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005.ownedMonitorsAndFrames005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -expectJNIMonitors + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.OwnedMonitorsDebuggee; +import nsk.share.jdi.OwnedMonitorsDebugger; +import nsk.share.locks.LockingThread; + +public class ownedMonitorsAndFrames005 extends OwnedMonitorsDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames005().runIt(argv, out); + } + + // expect or not JNI monitors in results of ownedMonitorsAndFrames() + private boolean expectJNIMonitors; + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equalsIgnoreCase("-expectJNIMonitors")) { + expectJNIMonitors = true; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + public String debuggeeClassName() { + if (expectJNIMonitors) + return super.debuggeeClassName() + " -returnJNIMonitors"; + else + return super.debuggeeClassName(); + } + + public void doTest() { + initDefaultBreakpoint(); + + try { + List locksTypes = new ArrayList(); + + // LockingThead should acquire 3 JNI monitors and 1 non-JNI monitor + locksTypes.add(LockingThread.SYNCHRONIZED_OBJECT_BLOCK); + locksTypes.add(LockingThread.JNI_MONITOR_ENTER); + locksTypes.add(LockingThread.JNI_MONITOR_ENTER); + locksTypes.add(LockingThread.JNI_MONITOR_ENTER); + + String threadName = "ownedMonitorsAndFrames005_LockingThread1"; + String command = OwnedMonitorsDebuggee.COMMAND_CREATE_LOCKING_THREAD + ":" + threadName; + + for (String lockType : locksTypes) { + command += ":" + lockType; + } + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + ThreadReference threadReference = debuggee.threadByName(threadName); + + // check ownedMonitorsAndFrames() first time + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + + // force debuggee thread sequentially exit from synchronized blocks, free JNI monitors and check results of ownedMonitorsAndFrames() + for (int i = 0; i < locksTypes.size(); i++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_EXIT_SINGLE_FRAME + ":" + threadName); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + } finally { + removeDefaultBreakpoint(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames006/ownedMonitorsAndFrames006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames006/ownedMonitorsAndFrames006.java new file mode 100644 index 00000000000..764e2f3c284 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames006/ownedMonitorsAndFrames006.java @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames006. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test do the same things as 'ownedMonitorsAndFrames002', but run in debuggee VM several test threads. + * Default test threads count is 10, but number of test threads can be changed through test parameter '-testThreadsCount' + * (for example "-testThreadsCount 100"). + * Debuggee VM creates a number of threads which acquire several monitors in following ways: + * - entering synchronized method + * - entering synchronized method for thread object itself + * - entering synchronized block on non-static object + * - entering synchronized block on thread object itself + * Information about all monitors acquired by test threads is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * Debugger VM reads information about acquired monitors from 'OwnedMonitorsDebuggee.monitorsInfo' + * and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames returns correct list of MonitorInfo objects for + * all test threads. + * Debugger VM forces test all threads in debuggee VM sequentially free all monitors(exit from synchronized blocks/methods), + * updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects for all test threads. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006.ownedMonitorsAndFrames006 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006.ownedMonitorsAndFrames006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006; + +import java.io.PrintStream; +import nsk.share.Consts; +import nsk.share.jdi.OwnedMonitorsDebugger; +import nsk.share.jdi.OwnedMonitorsDebuggee; +import nsk.share.locks.*; +import java.util.*; + +import com.sun.jdi.ThreadReference; + +public class ownedMonitorsAndFrames006 extends OwnedMonitorsDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames006().runIt(argv, out); + } + + private int testThreadsCount = 10; + + // initialize test and remove unsupported by nsk.share.jdi.ArgumentHandler arguments + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testThreadsCount") && (i < args.length - 1)) { + testThreadsCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + public void doTest() { + initDefaultBreakpoint(); + + try { + String testThreadsNames[] = new String[testThreadsCount]; + + for (int i = 0; i < testThreadsNames.length; i++) + testThreadsNames[i] = "ownedMonitorsAndFrames006_LockingThread" + (i + 1); + + List locksTypes = new ArrayList(); + + locksTypes.add(LockingThread.SYNCHRONIZED_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_THREAD_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_THIS_BLOCK); + locksTypes.add(LockingThread.SYNCHRONIZED_OBJECT_BLOCK); + locksTypes.add(LockingThread.FRAME_WITHOUT_LOCK); + + for (int i = 0; i < testThreadsNames.length; i++) { + String threadName = testThreadsNames[i]; + String command = OwnedMonitorsDebuggee.COMMAND_CREATE_LOCKING_THREAD + ":" + threadName; + + for (String lockType : locksTypes) { + command += ":" + lockType; + } + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + } + + // check ownedMonitorsAndFrames() for all threads + for (int i = 0; i < testThreadsNames.length; i++) { + ThreadReference threadReference = debuggee.threadByName(testThreadsNames[i]); + + pipe.println(OwnedMonitorsDebuggee.COMMAND_UPDATE_MONITOR_INFO + ":" + testThreadsNames[i]); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + + // force debuggee threads sequentially exit from synchronized blocks/methods and check results of ownedMonitorsAndFrames() + for (int i = 0; i < locksTypes.size(); i++) { + // all threads free single lock + for (int j = 0; j < testThreadsNames.length; j++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_EXIT_SINGLE_FRAME + ":" + testThreadsNames[j]); + + if (!isDebuggeeReady()) + return; + } + + // check results of ownedMonitorsAndFrames() + for (int j = 0; j < testThreadsNames.length; j++) { + ThreadReference threadReference = debuggee.threadByName(testThreadsNames[j]); + + pipe.println(OwnedMonitorsDebuggee.COMMAND_UPDATE_MONITOR_INFO + ":" + testThreadsNames[j]); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + } + } finally { + removeDefaultBreakpoint(); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames007/ownedMonitorsAndFrames007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames007/ownedMonitorsAndFrames007.java new file mode 100644 index 00000000000..3978374132a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames007/ownedMonitorsAndFrames007.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames007. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test do the same things as 'ownedMonitorsAndFrames003', but run in debuggee VM several test threads. + * Default test threads count is 10, but number of test threads can be changed through test parameter '-testThreadsCount' + * (for example "-testThreadsCount 100"). + * Debuggee VM creates a number of threads and each test thread acquires 4 different monitors in following ways: + * - entering synchronized method + * - entering synchronized block on non-static object + * - entering synchronized method for thread object itself + * - entering synchronized block on static object + * Information about all monitors acquired by test thread is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * Debugger VM reads information about acquired monitors from 'OwnedMonitorsDebuggee.monitorsInfo' + * and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames returns correct list of MonitorInfo objects, this + * check is performed for all test threads. + * Debugger VM forces all test threads in debuggee VM sequentially free monitors through Object.wait(), + * updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects for all test threads. + * Debugger VM forces all test threads in debuggee VM free all monitors(exit from all synchronized objects/blocks), + * updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects for all test threads. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007; + +import java.io.PrintStream; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.OwnedMonitorsDebuggee; +import nsk.share.jdi.OwnedMonitorsDebugger; +import nsk.share.locks.LockingThread; + +public class ownedMonitorsAndFrames007 extends OwnedMonitorsDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames007().runIt(argv, out); + } + + private int testThreadsCount = 10; + + // initialize test and remove unsupported by nsk.share.jdi.ArgumentHandler arguments + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testThreadsCount") && (i < args.length - 1)) { + testThreadsCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private void checkAllThreads(String testThreadsNames[]) { + for (int j = 0; j < testThreadsNames.length; j++) { + ThreadReference threadReference = debuggee.threadByName(testThreadsNames[j]); + + pipe.println(OwnedMonitorsDebuggee.COMMAND_UPDATE_MONITOR_INFO + ":" + testThreadsNames[j]); + + if (!isDebuggeeReady()) + return; + + forceBreakpoint(); + + checkMonitorInfo(threadReference); + + debuggee.resume(); + + if (!isDebuggeeReady()) + return; + } + } + + public void doTest() { + initDefaultBreakpoint(); + + try { + List locksTypes = new ArrayList(); + + String testThreadsNames[] = new String[testThreadsCount]; + + for (int i = 0; i < testThreadsNames.length; i++) + testThreadsNames[i] = "ownedMonitorsAndFrames007_LockingThread" + (i + 1); + + // LockingThreads should acquire 4 different monitors + locksTypes.add(LockingThread.SYNCHRONIZED_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_OBJECT_BLOCK); + locksTypes.add(LockingThread.SYNCHRONIZED_THREAD_METHOD); + locksTypes.add(LockingThread.SYNCHRONIZED_BLOCK_STATIC_OBJECT); + + for (int i = 0; i < testThreadsNames.length; i++) { + String threadName = testThreadsNames[i]; + String command = OwnedMonitorsDebuggee.COMMAND_CREATE_LOCKING_THREAD + ":" + threadName; + + for (String lockType : locksTypes) { + command += ":" + lockType; + } + + pipe.println(command); + + if (!isDebuggeeReady()) + return; + } + + checkAllThreads(testThreadsNames); + + // For all LockingThread's monitors: + // - force thread relinquish monitors through Object.wait(), + // - check results of ownedMonitorsAndFrames() + // - force debuggee thread acquire relinquished monitor + // - check results of ownedMonitorsAndFrames() + for (int i = 0; i < locksTypes.size(); i++) { + // all threads relinquish monitor + for (int j = 0; j < testThreadsNames.length; j++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_RELINQUISH_MONITOR + ":" + testThreadsNames[j] + ":" + i); + + if (!isDebuggeeReady()) + return; + } + + checkAllThreads(testThreadsNames); + + // all threads acquire monitor + for (int j = 0; j < testThreadsNames.length; j++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_ACQUIRE_RELINQUISHED_MONITOR + ":" + testThreadsNames[j]); + + if (!isDebuggeeReady()) + return; + } + + checkAllThreads(testThreadsNames); + } + + // LockingThreads should free all monitors + for (int i = 0; i < testThreadsNames.length; i++) { + pipe.println(OwnedMonitorsDebuggee.COMMAND_STOP_LOCKING_THREAD + ":" + testThreadsNames[i]); + + if (!isDebuggeeReady()) + return; + } + + checkAllThreads(testThreadsNames); + } finally { + removeDefaultBreakpoint(); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames008/TestDescription.java new file mode 100644 index 00000000000..cb983232797 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames008/TestDescription.java @@ -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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames008. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test do the same things as 'ownedMonitorsAndFrames003', but run in debuggee VM several test threads. + * Default test threads count is 10, but number of test threads can be changed through test parameter '-testThreadsCount' + * (for example "-testThreadsCount 100"). + * This test explicitly set following debuggee VM keys: -Xmixed -XX:CompileThreshold=2 to check that tested + * functionality was not broken after JIT compilation. + * Debuggee VM creates a number of threads and each test thread acquires 4 different monitors in following ways: + * - entering synchronized method + * - entering synchronized block on non-static object + * - entering synchronized method for thread object itself + * - entering synchronized block on static object + * Information about all monitors acquired by test thread is stored in debuggee VM and can be obtained through + * special field in debuggee class: OwnedMonitorsDebuggee.monitorsInfo. + * Debugger VM reads information about acquired monitors from 'OwnedMonitorsDebuggee.monitorsInfo' + * and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames returns correct list of MonitorInfo objects, this + * check is performed for all test threads. + * Debugger VM forces all test threads in debuggee VM sequentially free monitors through Object.wait(), + * updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects for all test threads. + * Debugger VM forces all test threads in debuggee VM free all monitors(exit from all synchronized objects/blocks), + * updates debug information about acquired monitors and checks that com.sun.jdi.ThreadReference.ownedMonitorsAndFrames + * returns correct list of MonitorInfo objects for all test threads. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmixed + * -XX:CompileThreshold=2" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009/ownedMonitorsAndFrames009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009/ownedMonitorsAndFrames009.java new file mode 100644 index 00000000000..f96b2fb57f9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009/ownedMonitorsAndFrames009.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2007, 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/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009. + * VM Testbase keywords: [jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * + * Test checks that acquired ReentrantLock, ReentrantReadWriteLock.ReadLock and ReentrantReadWriteLock.WriteLock + * are not returned by ThreadReference,ownedMonitorsAndFrames. + * + * Debuggee creates test thread wich acquires ReentrantLock, ReentrantReadWriteLock.ReadLock and + * ReentrantReadWriteLock.WriteLock. + * + * Debugger obtains ThreadReference for debugee's test thread and checks that ownedMonitorsAndFrames() returns + * empty list. + * Then, debugger forces test thread release all locks and checks again that ownedMonitorsAndFrames() returns empty list. + * + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009a + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009; + +import java.io.PrintStream; +import java.util.ArrayList; +import com.sun.jdi.ThreadReference; +import nsk.share.Consts; +import nsk.share.jdi.OwnedMonitorsDebugger; + +public class ownedMonitorsAndFrames009 extends OwnedMonitorsDebugger { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ownedMonitorsAndFrames009().runIt(argv, out); + } + + protected String debuggeeClassName() { + return ownedMonitorsAndFrames009a.class.getName(); + } + + private void test(ThreadReference thread) { + thread.suspend(); + + try { + // compare result of ownedMonitorsAndFrames() with empty list + compare(thread.ownedMonitorsAndFrames(), new ArrayList()); + } catch (Exception e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + + thread.resume(); + } + + public void doTest() { + ThreadReference thread = debuggee.threadByName(ownedMonitorsAndFrames009a.testThreadName); + + test(thread); + + pipe.println(ownedMonitorsAndFrames009a.COMMAND_RELEASE_ALL_LOCKS); + + if (!isDebuggeeReady()) + return; + + test(thread); + + pipe.println(ownedMonitorsAndFrames009a.COMMAND_STOP_TEST_THREAD); + + if (!isDebuggeeReady()) + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009/ownedMonitorsAndFrames009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009/ownedMonitorsAndFrames009a.java new file mode 100644 index 00000000000..0dc5e4a6890 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames009/ownedMonitorsAndFrames009a.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2007, 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.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009; + +import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import nsk.share.jdi.*; + +public class ownedMonitorsAndFrames009a extends AbstractJDIDebuggee { + + public static String testThreadName = "ownedMonitorsAndFrames009a_TestThread"; + + public static String COMMAND_RELEASE_ALL_LOCKS = "releaseAllLocks"; + + public static String COMMAND_STOP_TEST_THREAD = "stopTestThread"; + + class TestThread extends Thread { + + private volatile boolean locksAcquied; + + private volatile boolean locksReleased; + + private ReentrantLock lock1 = new ReentrantLock(); + + private ReentrantReadWriteLock lock2 = new ReentrantReadWriteLock(); + + private ReentrantReadWriteLock lock3 = new ReentrantReadWriteLock(); + + public TestThread() { + super(testThreadName); + } + + public void run() { + lock1.lock(); + lock2.readLock().lock(); + lock3.writeLock().lock(); + + locksAcquied = true; + + /* + * Methods Thread.sleep/Thread.interrupt are used for synchronization + * with main thread because of wait/notify can't be used in this test + * (see for example test bug 6487131). + */ + + try { + Thread.sleep(Long.MAX_VALUE); + } catch (InterruptedException e) { + // expected exception + } + + lock1.unlock(); + lock2.readLock().unlock(); + lock3.writeLock().unlock(); + + locksReleased = true; + + try { + Thread.sleep(Long.MAX_VALUE); + } catch (InterruptedException e) { + // expected exception + } + } + + public void startTestThread() { + start(); + + while (!locksAcquied) + Thread.yield(); + } + + public void stopTestThread() { + interrupt(); + + try { + join(); + } catch (InterruptedException e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + } + + public void releaseLocks() { + testThread.interrupt(); + + while (!locksReleased) + Thread.yield(); + } + } + + private TestThread testThread; + + public String[] doInit(String args[]) { + args = super.doInit(args); + + testThread = new TestThread(); + testThread.startTestThread(); + + return args; + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_RELEASE_ALL_LOCKS)) { + testThread.releaseLocks(); + return true; + } else if (command.equals(COMMAND_STOP_TEST_THREAD)) { + testThread.stopTestThread(); + return true; + } + + return false; + } + + public static void main(String[] args) { + new ownedMonitorsAndFrames009a().doTest(args); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java new file mode 100644 index 00000000000..f35bf61ae83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java @@ -0,0 +1,551 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.popFrames()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * After this operation,
    + * this thread will be suspended at the invoke instruction of
    + * the target method that created frame.
    + * The frame's method can be reentered with a
    + * step into the instruction.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent, + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + * In the second phase, the debuggee creates second thread which
    + * will call a tested poppedMethod() from its run() method.
    + * Being called, the poppedMethod() increments the value of
    + * the global variable testVar1.
    + * The debugger sets up a breakpoint within the poppedMethod() and,
    + * after getting this brakpoint event, invokes the popFrames() method,
    + * checks the value of testVar1 after first incerment,
    + * and resumes debuggee's second thread to reenter the poppedMethod().
    + * After getting the breakpoint event second time,
    + * the debugger just checks the value of testVar1 which
    + * has to be incremented one more time.
    + */ + +public class popframes001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/popFrames/popframes001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new popframes001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.popFrames.popframes001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + BreakpointRequest breakpointRequest; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + log2("......vm.resume(); resuming debuggee's main thread"); + vm.resume(); + + for (int i = 0; ; i++) { + +// vm.resume(); + + breakpointForCommunication(); + + int instruction; + + log2("......instruction = ((IntegerValue)...; no Exception expected"); + try { + instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + } catch ( Exception e ) { + log3("ERROR: Exception when 'instruction = ((IntegerValue)...' : " + e); + testExitCode = FAILED; + return; + } + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + if ( !vm.canPopFrames() ) { + log2("......vm.canPopFrames() == false : test is cancelled"); + return; + } + + String thread2Name = "thread2"; + ThreadReference thread2Ref = threadByName(thread2Name); + + + String poppedMethod = "poppedMethod"; + String breakpointLine = "breakpointLine"; + String testVariable = "testVar1"; + + log2("......setting breakpoint in poppedMethod"); + try { + breakpointRequest = settingBreakpoint(threadByName(thread2Name), + debuggeeClass, + poppedMethod, breakpointLine, "one"); + } catch ( Exception e ) { + throw e; + } + log2("......breakpointRequest.enable();"); + breakpointRequest.enable(); + + log2("......eventSet.resume(); resuming debuggee's main thread"); + log2(" to get new rendevous at the breakpointForCommunication"); + eventSet.resume(); + log2("......breakpointInMethod();"); + breakpointInMethod(); + + log2("......getting value of 'testVar1'; 1 is expected"); + Value val = debuggeeClass.getValue(debuggeeClass.fieldByName(testVariable)); + int intVal = ((IntegerValue) val).value(); + if (intVal != 1) { + log3("ERROR: intVal != 1"); + testExitCode = FAILED; + break; + } + + log2("......StackFrame stackFrame = thread2Ref.frame(0);"); + StackFrame stackFrame = thread2Ref.frame(0); + + log2("......thread2Ref.popFrames(stackFrame);"); + try { + thread2Ref.popFrames(stackFrame); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException"); + testExitCode = FAILED; + break; + } + + log2("......thread2Ref.resume();"); + thread2Ref.resume(); + log2("......breakpointInMethod();"); + breakpointInMethod(); + + log2("......getting value of 'testVar1'; 2 is expected"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(testVariable)); + intVal = ((IntegerValue) val).value(); + if (intVal != 2) { + log3("ERROR: intVal != 2"); + testExitCode = FAILED; + break; + } + + log2("......thread2Ref.resume();"); + thread2Ref.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private void breakpointInMethod() + throws JDITestRuntimeException { + + log2("breakpointInMethod"); + getEventSet(); + Event event = eventIterator.nextEvent(); + + if ( !(event instanceof BreakpointEvent) ) + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + + if ( !event.request().equals(breakpointRequest) ) + throw new JDITestRuntimeException("** unexpected breakpoint **"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001/TestDescription.java new file mode 100644 index 00000000000..5f566a2f708 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001/TestDescription.java @@ -0,0 +1,122 @@ +/* + * 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/ThreadReference/popFrames/popframes001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.popFrames() + * complies with its spec: + * public void popFrames(StackFrame frame) + * throws IncompatibleThreadStateException + * Pop stack frames. + * All frames up to and including the frame are popped off the stack. + * The frame previous to the + * parameter frame will become the current frame. + * After this operation, this thread will be suspended at the invoke + * instruction of the target method that created frame. + * The frame's method can be reentered with a step into the instruction. + * The operand stack is restored, however, any changes to the arguments that + * occurred in the called method, remain. For example, if the method foo: + * void foo(int x) { + * System.out.println("Foo: " + x); + * x = 4; + * System.out.println("pop here"); + * } + * was called with foo(7) and foo is popped at the second println and resumed, + * it will print: Foo: 4. + * Locks acquired by a popped frame are released when it is popped. + * This applies to synchronized methods that are popped, and + * to any synchronized blocks within them. + * Finally blocks are not executed. + * No aspect of state, other than this thread's execution point and locks, + * is affected by this call. Specifically, the values of fields are unchanged, + * as are external resources such as I/O streams. Additionally, + * the target program might be placed in a state that is impossible with + * normal program flow; for example, order of lock acquisition might be + * perturbed. Thus the target program may proceed differently than the user would expect. + * The specified thread must be suspended. + * All StackFrame objects for this thread are invalidated. + * No events are generated by this method. + * None of the frames through and including frame may be native. + * Not all target virtual machines support this operation. Use + * VirtualMachine.canPopFrames() to determine if the operation is supported. + * Parameters: frame - Stack frame to pop. + * frame is on this thread's call stack. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation - see + * VirtualMachine.canPopFrames(). + * IncompatibleThreadStateException - + * if this thread is not suspended. + * IllegalArgumentException - + * if frame is not on this thread's call stack. + * NativeMethodException - + * if one of the frames that would be popped is that of + * a native method or if frame is native. + * InvalidStackFrameException - + * if frame has become invalid. Once this thread is resumed, + * the stack frame is no longer valid. + * The test checks up on the following assertion: + * After this operation, this thread will be suspended at the invoke instruction of + * the target method that created frame. The frame's method can be reentered with a + * step into the instruction. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.popFrames.popframes001; + * the debuggee program - nsk.jdi.ThreadReference.popFrames.popframes001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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 4510417, + * vm.resume(); is out of (before) the loop + * to eliminate double resuming debeggee's main thread. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.popFrames.popframes001 + * nsk.jdi.ThreadReference.popFrames.popframes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001a.java new file mode 100644 index 00000000000..acfdff08f81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001a.java @@ -0,0 +1,188 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the popframes001 JDI test. + */ + +public class popframes001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadpopframes001a thread2 = null; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread2 = new Threadpopframes001a("thread2"); + log1(" thread2 is created"); + + synchronized (lockingObject) { + synchronized (waitnotifyObj) { + log1(" thread2.start()"); + thread2.start(); + + try { + log1(" before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); + log1(" after: waitnotifyObj.wait();"); + } catch ( Exception e2) { + log1(" Exception e2 exception: " + e2 ); + exitCode = FAILED; + break label0; + } + } + methodForCommunication(); + } + + synchronized (lockingObject2) { + log1("mainThread is in: synchronized (lockingObject2)"); + } + + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + + log1("before: methodForCommunication();"); + methodForCommunication(); + log1("after: methodForCommunication();"); + + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static int testVar1 = 0; + static int testVar2 = 0; + static int breakpointLine = 4; + + static void poppedMethod() { + log1("poppedMethod: enter"); + testVar1 +=1; + testVar2 +=1; + testVar2 +=1; + + log1("poppedMethod: exit"); + return; + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static Object lockingObject2 = new Object(); + + static class Threadpopframes001a extends Thread { + + public Threadpopframes001a(String threadName) { + super(threadName); + } + + public void run() { + synchronized (lockingObject2) { + log1("thread2: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread2: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread2: exited from block: synchronized (waitnotifyObj)"); + synchronized (lockingObject) { + log1("thread2: entered into block: synchronized (lockingObject)"); + } + log1("thread2: exited from block: synchronized (lockingObject)"); + + log1("thread2: before: 'poppedMethod()'"); + poppedMethod(); + log1("thread2: after: 'poppedMethod()'"); + } + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java new file mode 100644 index 00000000000..026a8775ca9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java @@ -0,0 +1,543 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.popFrames()
    + * complies with its spec.
    + *
    + * The test checks up that
    + * a BreakpointRequest in debuggee's third thread
    + * is not affected when
    + * its second thread is suspended at a breakpoint in a method
    + * and method's frame is popped by a debugger.
    + *
    + * The test has two phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent, + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to perform the above check,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates two threads, thread2 and thread3, which will
    + * call a tested synchronized poppedMethod() from their run() methods.
    + * After getting the threads started, the debuggee invokes the
    + * methodForCommunication() to inform the debugger of the threads.
    + * - The debugger sets up two breakpoints within the poppedMethod(),
    + * one for the thread2 and another one for the thread3, and
    + * resumes debuggee's main thread.
    + * - The main thread releases the thread2 and the thread3 in the order
    + * which makes the thread2 to be suspended at the breakpoint within
    + * the poppedMethod and the thread3 to be waiting for releasing the
    + * synchronized poppedMethod by the thread2. Then
    + * the main thread informs the debugger via methodForCommunication().
    + * - After getting both breakpoint events, from the thread2 and the main,
    + * the debugger invokes the popFrames() method and waits for
    + * the breakpoint event in poppedMethod from the thread3.
    + * If no the event, the test FAILED.
    + */ + +public class popframes002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/popFrames/popframes002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new popframes002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.popFrames.popframes002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + BreakpointRequest bpRequest; + BreakpointRequest breakpointRequest2; + BreakpointRequest breakpointRequest3; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + if ( !vm.canPopFrames() ) { + log2("......vm.canPopFrames() == false : test is cancelled"); + vm.resume(); + return; + } + + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + log2("......setting BreakpointRequest (bpRequest) in main thread"); + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + log2("bpRequest.enable();"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + label0: + { + vm.resume(); + breakpointForCommunication(); + + String thread2Name = "thread2"; + ThreadReference thread2Ref = threadByName(thread2Name); + + String thread3Name = "thread3"; + ThreadReference thread3Ref = threadByName(thread3Name); + + String poppedMethod = "poppedMethod"; + String breakpointLine = "breakpointLine"; + String testVariable = "testVar1"; + + log2("......setting breakpoints in poppedMethod"); + try { + breakpointRequest2 = settingBreakpoint(thread2Ref, debuggeeClass, + poppedMethod, breakpointLine, "one"); + } catch ( Exception e ) { + throw e; + } + log2("......breakpointRequest2.enable();"); + breakpointRequest2.enable(); + try { + breakpointRequest3 = settingBreakpoint(thread3Ref, debuggeeClass, + poppedMethod, breakpointLine, "two"); + } catch ( Exception e ) { + throw e; + } + log2("......breakpointRequest3.enable();"); + breakpointRequest3.enable(); + + + log2("......eventSet.resume();"); + eventSet.resume(); + log2("......breakpointInMethod(breakpointRequest2);"); + breakpointInMethod("one"); + + if ( bpRequestFlag == 0 ) + breakpointForCommunication(); + + log2("......StackFrame stackFrame = thread2Ref.frame(0);"); + StackFrame stackFrame = thread2Ref.frame(0); + + log2("......thread2Ref.popFrames(stackFrame);"); + try { + thread2Ref.popFrames(stackFrame); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException"); + testExitCode = FAILED; + break label0; + } + + log2("......breakpointInMethod(breakpointRequest3);"); + try { + breakpointInMethod("two"); + } catch ( JDITestRuntimeException e ) { + log3("ERROR: timeout while waiting for thread3's BreakpointEvent"); + log2(" THREAD_STATUS_MONITOR == " + ThreadReference.THREAD_STATUS_MONITOR ); + log2(" thread3's status == " + thread3Ref.status()); + testExitCode = FAILED; + } + + if (!thread3Ref.isSuspended()) { + log3("ERROR: thread3 is not suspended at the breakpoint"); + testExitCode = FAILED; + break label0; + } + } + + log2("......disabling breakpointRequests 2&3"); + breakpointRequest2.disable(); + breakpointRequest3.disable(); + + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + static int bpRequestFlag = 0; + + private void breakpointInMethod(String number) + throws JDITestRuntimeException { + + Event event; + + for ( ; ; ) { + getEventSet(); + event = eventIterator.nextEvent(); + + if ( !(event instanceof BreakpointEvent) ) + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + + log2("---->: request().getProperty == " + + event.request().getProperty("number")); + + if ( event.request().getProperty("number").equals(number) ) + return; + + if ( !event.request().getProperty("number").equals("zero") ) + throw new JDITestRuntimeException("** unexpected breakpoint **"); + bpRequestFlag = 1; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002/TestDescription.java new file mode 100644 index 00000000000..2cba987ab17 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002/TestDescription.java @@ -0,0 +1,118 @@ +/* + * 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/ThreadReference/popFrames/popframes002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.popFrames() + * complies with its spec: + * public void popFrames(StackFrame frame) + * throws IncompatibleThreadStateException + * Pop stack frames. + * All frames up to and including the frame are popped off the stack. + * The frame previous to the + * parameter frame will become the current frame. + * After this operation, this thread will be suspended at the invoke + * instruction of the target method that created frame. + * The frame's method can be reentered with a step into the instruction. + * The operand stack is restored, however, any changes to the arguments that + * occurred in the called method, remain. For example, if the method foo: + * void foo(int x) { + * System.out.println("Foo: " + x); + * x = 4; + * System.out.println("pop here"); + * } + * was called with foo(7) and foo is popped at the second println and resumed, + * it will print: Foo: 4. + * Locks acquired by a popped frame are released when it is popped. + * This applies to synchronized methods that are popped, and + * to any synchronized blocks within them. + * Finally blocks are not executed. + * No aspect of state, other than this thread's execution point and locks, + * is affected by this call. Specifically, the values of fields are unchanged, + * as are external resources such as I/O streams. Additionally, + * the target program might be placed in a state that is impossible with + * normal program flow; for example, order of lock acquisition might be + * perturbed. Thus the target program may proceed differently than the user would expect. + * The specified thread must be suspended. + * All StackFrame objects for this thread are invalidated. + * No events are generated by this method. + * None of the frames through and including frame may be native. + * Not all target virtual machines support this operation. Use + * VirtualMachine.canPopFrames() to determine if the operation is supported. + * Parameters: frame - Stack frame to pop. + * frame is on this thread's call stack. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation - see + * VirtualMachine.canPopFrames(). + * IncompatibleThreadStateException - + * if this thread is not suspended. + * IllegalArgumentException - + * if frame is not on this thread's call stack. + * NativeMethodException - + * if one of the frames that would be popped is that of + * a native method or if frame is native. + * InvalidStackFrameException - + * if frame has become invalid. Once this thread is resumed, + * the stack frame is no longer valid. + * The test checks up that a BreakpointRequest in debuggee's third thread + * is not affected when its second thread is suspended at a breakpoint + * in a method and method's frame is popped by a debugger. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.popFrames.popframes002; + * the debuggee program - nsk.jdi.ThreadReference.popFrames.popframes002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadReference.popFrames.popframes002 + * nsk.jdi.ThreadReference.popFrames.popframes002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002a.java new file mode 100644 index 00000000000..d7d0a6b7a1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002a.java @@ -0,0 +1,215 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the popframes002 JDI test. + */ + +public class popframes002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread2popframes002a thread2 = null; + static Thread3popframes002a thread3 = null; + + //------------------------------------------------------ common section + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + { + + //------------------------------------------------------ section tested + + thread2 = new Thread2popframes002a("thread2"); + log1(" thread2 is created"); + thread3 = new Thread3popframes002a("thread3"); + log1(" thread3 is created"); + + synchronized (lockingObject1) { + synchronized (lockingObject3) { + synchronized (lockingObject2) { + log1(" thread2.start()"); + if ( threadStart(thread2) != PASSED ) + break label0; + + log1(" thread3.start()"); + if ( threadStart(thread3) != PASSED ) + break label0; + + log1(" methodForCommunication(); ----1"); + methodForCommunication(); + } + + log1(" before: lockingObject1.wait();"); + try { + lockingObject1.wait(); + } catch ( InterruptedException e ) { + logErr(" Exception : " + e ); + break label0; + } + log1(" after: lockingObject1.wait();"); + } + } + log1(" methodForCommunication(); ----2"); + methodForCommunication(); + } + //------------------------------------------------- standard end section + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + log1(" before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); + log1(" after: waitnotifyObj.wait();"); + } catch ( Exception e) { + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObject1 = new Object(); + + static int testVar1 = 0; + static int testVar2 = 0; + static int breakpointLine = 4; + + static synchronized void poppedMethod() { + log1("poppedMethod entered by the thread : " + Thread.currentThread().getName() ); + synchronized (lockingObject1) { lockingObject1.notify(); } + testVar1 +=1; + testVar2 +=1; + testVar2 +=1; + + log1("poppedMethod: exit"); + return; + } + + static Object lockingObject2 = new Object(); + + static class Thread2popframes002a extends Thread { + + public Thread2popframes002a(String threadName) { + super(threadName); + } + + public void run() { + log1("thread2: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread2: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread2: exited from block: synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + log1("thread2: before: 'poppedMethod()'"); + poppedMethod(); + log1("thread2: after: 'poppedMethod()'"); + } + return; + } + } + + static Object lockingObject3 = new Object(); + + static class Thread3popframes002a extends Thread { + + public Thread3popframes002a(String threadName) { + super(threadName); + } + + public void run() { + log1("thread3: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread3: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread3: exited from block: synchronized (waitnotifyObj)"); + + synchronized (lockingObject3) { + log1("thread3: before: 'poppedMethod()'"); + poppedMethod(); + log1("thread3: after: 'poppedMethod()'"); + } + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java new file mode 100644 index 00000000000..a2a625daa81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java @@ -0,0 +1,641 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.popFrames()
    + * complies with its spec.
    + *
    + *
    + * The test checks up that locks acquired by a popped frame,
    + * are released when it is popped.
    + * This applies to synchronized methods being popped.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to perform the above check,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates two threads, thread2 and thread3, which will
    + * call a tested synchronized poppedMethod() from their run() methods.
    + * After getting the threads started, the debuggee invokes the
    + * methodForCommunication() to inform the debugger of the threads.
    + * - The debugger sets up Breakpoint and MethodEntry Requests
    + * within the poppedMethod(), first one for the thread2 and
    + * second one for the thread3, and resumes debuggee's main thread.
    + * - The main thread releases the thread2 and the thread3 in the order
    + * which makes the thread2 to be suspended at the breakpoint within
    + * the poppedMethod and the thread3 to be waiting for releasing the
    + * synchronized poppedMethod by the thread2. Then
    + * the main thread informs the debugger via methodForCommunication().
    + * - After getting both events, from the thread2 and the main,
    + * the debugger invokes the popFrames() method and waits for
    + * the MethodEntry event in poppedMethod from the thread3.
    + * If no the event, the test FAILED.
    + */ + +public class popframes003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/popFrames/popframes003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new popframes003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.popFrames.popframes003a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + BreakpointRequest bpRequest; + MethodEntryRequest meRequest; + + BreakpointRequest bpRequest2; + MethodEntryRequest meRequest3; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + + if ( !vm.canPopFrames() ) { + log2("......vm.canPopFrames() == false : test is cancelled"); + vm.resume(); + return; + } + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference threadMainRef = threadByName("main"); + try { + bpRequest = settingBreakpoint(threadMainRef, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventSet mainThreadEventSet = null; + + int flag = 0; + + + vm.resume(); + breakpointForCommunication(); + + log2("......setting MethodEntryRequest (meRequest) in ForCommunication.methodForCommunication"); + meRequest = settingMethodEntryRequest(threadMainRef, + debuggeeName + "$ForCommunication", + "zero"); + log2("meRequest.enable();"); + meRequest.enable(); + + + String thread2Name = "thread2"; + ThreadReference thread2Ref = threadByName(thread2Name); + + String thread3Name = "thread3"; + ThreadReference thread3Ref = threadByName(thread3Name); + + String poppedMethod = "poppedMethod"; + String breakpointLine = "breakpointLine"; + String testVariable = "testVar1"; + + log2("......setting BreakpointRequest (bpRequest2) in poppedMethod"); + List classes = vm.classesByName(debuggeeName + "$Popped"); + ReferenceType poppedClass = (ReferenceType) classes.get(0); + bpRequest2 = settingBreakpoint(thread2Ref, poppedClass, + poppedMethod, breakpointLine, "one"); + log2("......bpRequest2.enable();"); + bpRequest2.enable(); + + log2("......setting MethodEntryRequest (meRequest3) in poppedMethod"); + meRequest3 = settingMethodEntryRequest(thread3Ref, debuggeeName + "$Popped", + "two"); + log2("......meRequest3.enable();"); + meRequest3.enable(); + + log2("......eventSet.resume();"); + eventSet.resume(); + + log2(".....waiting for Breakpoint(thread2) and MethodEntry(main) Events"); + for ( ; ; ) { + + Event event1; + + if (flag == 3) + break; + + getEventSet(); + event1 = eventIterator.nextEvent(); + + if ( event1 instanceof MethodEntryEvent ) { + mainThreadEventSet = eventSet; + flag |= 1; + log2("......event1 instanceof MethodEntryEvent"); + } else if ( event1 instanceof BreakpointEvent ) { + flag |= 2; + log2("......event1 instanceof BreakpointEvent"); + } else + throw new JDITestRuntimeException("** event1 IS NOT Breakpoint or MethodEntry **"); + } + + log2("......bpRequest2.disable();"); + bpRequest2.disable(); + + label0: + { +// log2(" THREAD_STATUS_RUNNING == " + ThreadReference.THREAD_STATUS_RUNNING ); +// log2(" thread2's status == " + thread2Ref.status()); + + if (thread2Ref.isSuspended()) + log2(" thread2Ref.isSuspended()"); + else { + log3("ERROR: !thread2Ref.isSuspended()"); + testExitCode = FAILED; + break label0; + } + + log2("......mainThreadEventSet.resume();"); + mainThreadEventSet.resume(); + + log2("......up to WAITTIME loop of sleeping"); + log2(" to get thread3 waiting on monitor after calling poppedMethod"); + int thread3Status = 0; + for ( int i1 = 0; i1 < waitTime; i1 += 10000) { + if (thread3Ref.status() == ThreadReference.THREAD_STATUS_MONITOR) { + thread3Status = 1; + break; + } + Thread.sleep(10000); + } + if (thread3Status != 1) { + log3("ERROR: thread3Ref.status() != THREAD_STATUS_MONITOR"); + testExitCode = FAILED; + break label0; + } + + log2("......StackFrame stackFrame = thread2Ref.frame(0);"); + StackFrame stackFrame = thread2Ref.frame(0); + + log2("......thread2Ref.popFrames(stackFrame);"); + try { + thread2Ref.popFrames(stackFrame); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException"); + testExitCode = FAILED; + break label0; + } + + log2(".....waiting for MethodEntry (main and thread3) Events"); + { + flag = 0; + + for ( ; ; ) { + + Event event1; + + if (flag == 3) + break; + + getEventSet(); + event1 = eventIterator.nextEvent(); + + if ( !(event1 instanceof MethodEntryEvent) ) + throw new JDITestRuntimeException("** event IS NOT MethodEntry **"); + + if ( event1.request().getProperty("number").equals("zero") ) { + flag |= 1; + log2("......MethodEntry in mainThread"); + } else { + flag |= 2; + log2("......MethodEntry in thread3"); + } + } + } + + } + + log2("......disabling requests and resuming vm"); + meRequest3.disable(); + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + /* + * private MethodEntryRequest settingMethodEntryRequest(ThreadReference, ReferenceType, + * String) + * + * It sets up a MethodEntryRequest in a given class for a given thread. + * + * Return value: MethodEntryRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private MethodEntryRequest settingMethodEntryRequest ( ThreadReference thread, + String className, + String property) + throws JDITestRuntimeException { + + log2("......setting up a methodEntryRequest:"); + log2(" thread: " + thread + "; className: " + className + + "; property: " + property); + + List classList = vm.classesByName(className); + ReferenceType classRef = (ReferenceType) classList.get(0); + + MethodEntryRequest methodEntryRequest = null; + + try { + methodEntryRequest = eventRManager.createMethodEntryRequest(); + methodEntryRequest.putProperty("number", property); + methodEntryRequest.addThreadFilter(thread); + methodEntryRequest.addClassFilter(classRef); + methodEntryRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e ) { + log3("ERROR: Exception within methodEntryRequest() : " + e); + throw new JDITestRuntimeException("** FAILURE to set up a MethodEntryRequest **"); + } + + log2(" a methodEntryRequest has been set up"); + return methodEntryRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void eventForCommunication() + throws JDITestRuntimeException { + + log2("eventForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof MethodEntryEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a MethodEntryEvent **"); + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003/TestDescription.java new file mode 100644 index 00000000000..dca528d538f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003/TestDescription.java @@ -0,0 +1,118 @@ +/* + * 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/ThreadReference/popFrames/popframes003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.popFrames() + * complies with its spec: + * public void popFrames(StackFrame frame) + * throws IncompatibleThreadStateException + * Pop stack frames. + * All frames up to and including the frame are popped off the stack. + * The frame previous to the + * parameter frame will become the current frame. + * After this operation, this thread will be suspended at the invoke + * instruction of the target method that created frame. + * The frame's method can be reentered with a step into the instruction. + * The operand stack is restored, however, any changes to the arguments that + * occurred in the called method, remain. For example, if the method foo: + * void foo(int x) { + * System.out.println("Foo: " + x); + * x = 4; + * System.out.println("pop here"); + * } + * was called with foo(7) and foo is popped at the second println and resumed, + * it will print: Foo: 4. + * Locks acquired by a popped frame are released when it is popped. + * This applies to synchronized methods that are popped, and + * to any synchronized blocks within them. + * Finally blocks are not executed. + * No aspect of state, other than this thread's execution point and locks, + * is affected by this call. Specifically, the values of fields are unchanged, + * as are external resources such as I/O streams. Additionally, + * the target program might be placed in a state that is impossible with + * normal program flow; for example, order of lock acquisition might be + * perturbed. Thus the target program may proceed differently than the user would expect. + * The specified thread must be suspended. + * All StackFrame objects for this thread are invalidated. + * No events are generated by this method. + * None of the frames through and including frame may be native. + * Not all target virtual machines support this operation. Use + * VirtualMachine.canPopFrames() to determine if the operation is supported. + * Parameters: frame - Stack frame to pop. + * frame is on this thread's call stack. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation - see + * VirtualMachine.canPopFrames(). + * IncompatibleThreadStateException - + * if this thread is not suspended. + * IllegalArgumentException - + * if frame is not on this thread's call stack. + * NativeMethodException - + * if one of the frames that would be popped is that of + * a native method or if frame is native. + * InvalidStackFrameException - + * if frame has become invalid. Once this thread is resumed, + * the stack frame is no longer valid. + * The test checks up that locks acquired by a popped frame, + * are released when it is popped. + * This applies to synchronized methods being popped. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.popFrames.popframes003; + * the debuggee program - nsk.jdi.ThreadReference.popFrames.popframes003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadReference.popFrames.popframes003 + * nsk.jdi.ThreadReference.popFrames.popframes003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003a.java new file mode 100644 index 00000000000..a2b2879e094 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003a.java @@ -0,0 +1,231 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the popframes003 JDI test. + */ + +public class popframes003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread2popframes003a thread2 = null; + static Thread3popframes003a thread3 = null; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + { + thread2 = new Thread2popframes003a("thread2"); + log1(" thread2 is created"); + thread3 = new Thread3popframes003a("thread3"); + log1(" thread3 is created"); + + synchronized (lockingObject1) { + synchronized (lockingObject3) { + synchronized (lockingObject2) { + log1(" thread2.start()"); + if ( threadStart(thread2) != PASSED ) + break label0; + + log1(" thread3.start()"); + if ( threadStart(thread3) != PASSED ) + break label0; + + // to get classes Popped&ForCommunication prepared + Popped.poppedMethod(); + ForCommunication.methodForCommunication(); + + log1(" methodForCommunication();"); + methodForCommunication(); + } + + log1(" before: lockingObject1.wait();"); + try { + lockingObject1.wait(); + } catch ( InterruptedException e ) { + logErr(" Exception : " + e ); + break label0; + } + log1(" after: lockingObject1.wait();"); + } + + log1(" ForCommunication.methodForCommunication(); --1"); + ForCommunication.methodForCommunication(); + } + log1(" ForCommunication.methodForCommunication(); --2"); + ForCommunication.methodForCommunication(); + } + + System.exit(exitCode + PASS_BASE); + } + + + static int testVar1 = 0; + static int testVar2 = 0; + + static class Popped { + + static int breakpointLine = 4; + + static synchronized void poppedMethod() { + log1("poppedMethod entered by the thread : " + Thread.currentThread().getName() ); + synchronized (lockingObject1) { lockingObject1.notify(); } + testVar1 +=1; + testVar2 +=1; + testVar2 +=1; + + log1("poppedMethod: exit"); + return; + } + } + + static class ForCommunication { + + public static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + log1(" before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); + log1(" after: waitnotifyObj.wait();"); + } catch ( Exception e) { + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObject1 = new Object(); + + static Object lockingObject2 = new Object(); + + static class Thread2popframes003a extends Thread { + + public Thread2popframes003a(String threadName) { + super(threadName); + } + + public void run() { + log1("thread2: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread2: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread2: exited from block: synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + log1("thread2: before: 'poppedMethod()'"); + Popped.poppedMethod(); + log1("thread2: after: 'poppedMethod()'"); + } + return; + } + } + + static Object lockingObject3 = new Object(); + + static class Thread3popframes003a extends Thread { + + public Thread3popframes003a(String threadName) { + super(threadName); + } + + public void run() { + log1("thread3: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread3: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread3: exited from block: synchronized (waitnotifyObj)"); + + synchronized (lockingObject3) { + log1("thread3: before: 'poppedMethod()'"); + Popped.poppedMethod(); + log1("thread3: after: 'poppedMethod()'"); + } + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java new file mode 100644 index 00000000000..ed3a048d66c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java @@ -0,0 +1,549 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.popFrames()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Finally blocks are not executed.
    + *
    + * The test has two phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent
    + * in the methodForCommunication().
    + * - The debuggee creates second thread, the thread2, which will
    + * call a tested poppedMethod() two times from its run() method.
    + * The poppedMethod will call the special breakpointMethod,
    + * first time from try clause, second time from catch clause.
    + * The finally clause contains assignment of 1 to the variable testVar,
    + * whose initial value is 0; hence, if the finally clause is executed,
    + * the value of the testVar is changed as well.
    + * After creating the thread2, the debuggee invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent in the methodForCommunication,
    + * the debugger sets up a breakpoint in the breakpointMethod,
    + * resumes the debuggee, waits for BreakpointEvents in the
    + * breakpointMethod and, and upon getting them, invokes popFrames() and
    + * checks up on the value of the testVar.
    + *
    + */ + +public class popframes004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/popFrames/popframes004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new popframes004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.popFrames.popframes004a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + BreakpointRequest bpRequest; + BreakpointRequest breakpointRequest2; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + if ( !vm.canPopFrames() ) { + log2("......vm.canPopFrames() == false : test is cancelled"); + vm.resume(); + return; + } + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + log2("......setting BreakpointRequest (bpRequest) in main thread"); + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + log2("bpRequest.enable();"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + label0: + { + vm.resume(); + breakpointForCommunication(); + + String thread2Name = "thread2"; + ThreadReference thread2Ref = threadByName(thread2Name); + + StackFrame stackFrame = null; + int var; + + String breakpointMethod = "breakpointMethod"; + String breakpointLine = "breakpointLine"; + + String testVar = "testVar"; + + log2("......setting breakpoint in breakpointMethod"); + breakpointRequest2 = settingBreakpoint(thread2Ref, debuggeeClass, + breakpointMethod, breakpointLine, "one"); + log2("......breakpointRequest2.enable();"); + breakpointRequest2.enable(); + + { // to get mainThread suspended; otherwise its end results in + // no suspention for breakpointRequest2 (bug or not?), end of test, + // and VMDisconnectException + thread2Ref.suspend(); + log2("......eventSet.resume();"); + eventSet.resume(); + breakpointForCommunication(); + log2("bpRequest.disable();"); + bpRequest.disable(); + thread2Ref.resume(); + } + + log2("......breakpointInMethod(breakpointRequest2);"); + breakpointInMethod("one"); + + log2(" "); + log2("......TEST CASE: try clause"); + log2(" "); + log2("......stackFrame = thread2Ref.frame(1);"); + stackFrame = thread2Ref.frame(1); + + log2("......thread2Ref.popFrames(stackFrame);"); + try { + thread2Ref.popFrames(stackFrame); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException"); + testExitCode = FAILED; + break label0; + } + var = ((IntegerValue) debuggeeClass.getValue( + debuggeeClass.fieldByName(testVar))).value(); + if (var != 0) { + log3("ERROR: testVar != 0"); + testExitCode = FAILED; + } + + thread2Ref.resume(); + log2("......breakpointInMethod(breakpointRequest2);"); + breakpointInMethod("one"); + + thread2Ref.resume(); + log2("......breakpointInMethod(breakpointRequest2);"); + breakpointInMethod("one"); + + log2(" "); + log2("......TEST CASE: catch clause"); + log2(" "); + + log2("......StackFrame stackFrame = thread2Ref.frame(1);"); + stackFrame = thread2Ref.frame(1); + + log2("......thread2Ref.popFrames(stackFrame);"); + try { + thread2Ref.popFrames(stackFrame); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException"); + testExitCode = FAILED; + break label0; + } + var = ((IntegerValue) debuggeeClass.getValue( + debuggeeClass.fieldByName(testVar))).value(); + if (var != 0) { + log3("ERROR: testVar != 0"); + testExitCode = FAILED; + } + + log2("......breakpointRequest2.disable();"); + breakpointRequest2.disable(); + + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private void breakpointInMethod(String number) + throws JDITestRuntimeException { + + Event event; + + getEventSet(); + event = eventIterator.nextEvent(); + + if ( !(event instanceof BreakpointEvent) ) + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + + log2("---->: request().getProperty == " + + event.request().getProperty("number")); + + if ( event.request().getProperty("number").equals(number) ) + return; + + throw new JDITestRuntimeException("** UNEXPECTED breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004/TestDescription.java new file mode 100644 index 00000000000..56800751c9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004/TestDescription.java @@ -0,0 +1,117 @@ +/* + * 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/ThreadReference/popFrames/popframes004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.popFrames() + * complies with its spec: + * public void popFrames(StackFrame frame) + * throws IncompatibleThreadStateException + * Pop stack frames. + * All frames up to and including the frame are popped off the stack. + * The frame previous to the + * parameter frame will become the current frame. + * After this operation, this thread will be suspended at the invoke + * instruction of the target method that created frame. + * The frame's method can be reentered with a step into the instruction. + * The operand stack is restored, however, any changes to the arguments that + * occurred in the called method, remain. For example, if the method foo: + * void foo(int x) { + * System.out.println("Foo: " + x); + * x = 4; + * System.out.println("pop here"); + * } + * was called with foo(7) and foo is popped at the second println and resumed, + * it will print: Foo: 4. + * Locks acquired by a popped frame are released when it is popped. + * This applies to synchronized methods that are popped, and + * to any synchronized blocks within them. + * Finally blocks are not executed. + * No aspect of state, other than this thread's execution point and locks, + * is affected by this call. Specifically, the values of fields are unchanged, + * as are external resources such as I/O streams. Additionally, + * the target program might be placed in a state that is impossible with + * normal program flow; for example, order of lock acquisition might be + * perturbed. Thus the target program may proceed differently than the user would expect. + * The specified thread must be suspended. + * All StackFrame objects for this thread are invalidated. + * No events are generated by this method. + * None of the frames through and including frame may be native. + * Not all target virtual machines support this operation. Use + * VirtualMachine.canPopFrames() to determine if the operation is supported. + * Parameters: frame - Stack frame to pop. + * frame is on this thread's call stack. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation - see + * VirtualMachine.canPopFrames(). + * IncompatibleThreadStateException - + * if this thread is not suspended. + * IllegalArgumentException - + * if frame is not on this thread's call stack. + * NativeMethodException - + * if one of the frames that would be popped is that of + * a native method or if frame is native. + * InvalidStackFrameException - + * if frame has become invalid. Once this thread is resumed, + * the stack frame is no longer valid. + * The test checks up on the assertion: + * Finally blocks are not executed. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.popFrames.popframes004; + * the debuggee program - nsk.jdi.ThreadReference.popFrames.popframes004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadReference.popFrames.popframes004 + * nsk.jdi.ThreadReference.popFrames.popframes004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004a.java new file mode 100644 index 00000000000..fe70728550a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004a.java @@ -0,0 +1,197 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the popframes004 JDI test. + */ + +public class popframes004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread2popframes004a thread2 = null; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + + + static class JDIDebuggeeException extends Exception { + JDIDebuggeeException(String str) { + super("JDIDebuggeeException : " + str); + } + } + //---------------------------------------------------- main method + + static int var1 = 0; + static volatile int testVar = 0; + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + label0: + { + thread2 = new Thread2popframes004a("thread2"); + log1(" thread2 is created"); + + synchronized (lockingObject2) { + log1(" thread2.start()"); + if ( threadStart(thread2) != PASSED ) + break label0; + + log1(" methodForCommunication();"); + methodForCommunication(); + } + methodForCommunication(); + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + log1(" before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); + log1(" after: waitnotifyObj.wait();"); + } catch ( Exception e) { + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static int breakpointLine = 3; + + static void breakpointMethod () { + log1("breakpointMethod entered by the thread : " + Thread.currentThread().getName() ); + var1 += 1; + var1 += 1; + var1 += 1; + log1("breakpointMethod: exit"); + } + + static void poppedMethod(int arg) { + log1("poppedMethod entered by the thread : " + Thread.currentThread().getName() ); + try { + if (arg == 0) { + log1("thread2: try clause: calling breakpointMethod();"); + breakpointMethod(); + } else { + log1("thread2: try clause: throwing JDIDebuggeeException"); + throw new JDIDebuggeeException("poppedMethod"); + } + } catch ( JDIDebuggeeException e ) { + log1("thread2: catch clause: caught JDIDebuggeeException"); + log1("thread2: catch clause: calling breakpointMethod();"); + breakpointMethod(); + } finally { + log1("thread2: finally clause"); + testVar = 1; + } + + log1("poppedMethod: exit"); + return; + } + + static Object lockingObject2 = new Object(); + + static class Thread2popframes004a extends Thread { + + public Thread2popframes004a(String threadName) { + super(threadName); + } + + public void run() { + log1("thread2: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread2: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread2: exited from block: synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + testVar = 0; + log1("thread2: before: 'poppedMethod(0)'"); + poppedMethod(0); + log1("thread2: after: 'poppedMethod(0)'"); + + testVar = 0; + log1("thread2: before: 'poppedMethod(1)'"); + poppedMethod(1); + log1("thread2: after: 'poppedMethod(1)'"); + } + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java new file mode 100644 index 00000000000..5c471e9182b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java @@ -0,0 +1,531 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.popFrames()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertions:
    + * - All StackFrame objects for this thread are invalidated.
    + * - The frame previous to the parameter frame
    + * will become the current frame.
    + *
    + * The test has two phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent
    + * in the methodForCommunication().
    + * - The debuggee creates second thread, the thread2, which will
    + * call a tested poppedMethod() from its run() method.
    + * The poppedMethod will call the special breakpointMethod,
    + * After creating the thread2, the debuggee invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent in the methodForCommunication,
    + * the debugger sets up a breakpoint in the breakpointMethod,
    + * resumes the debuggee, waits for BreakpointEvent in the
    + * breakpointMethod and, and upon getting it,
    + * (1) to check up on first assertion, gets thread2.frame(2),
    + * invokes popFrames() and checks up on equality of thread2.frame(2)
    + * and thread2.frame(0). Since thread2.frame(2) has to be invalid,
    + * the expected result is false; otherwise, the test FAILED.
    + * (2) to check up on second assertion, gets thread2.frame(1)
    + * which has to result in the IndexOutOfBoundsException because
    + * the current frame is the only one in FramesStack.
    + *
    + */ + +public class popframes005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/popFrames/popframes005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new popframes005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.popFrames.popframes005a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + BreakpointRequest bpRequest; + BreakpointRequest breakpointRequest2; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + if ( !vm.canPopFrames() ) { + log2("......vm.canPopFrames() == false : test is cancelled"); + vm.resume(); + return; + } + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + log2("......setting BreakpointRequest (bpRequest) in main thread"); + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + log2("bpRequest.enable();"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + label0: + { + vm.resume(); + breakpointForCommunication(); + + String thread2Name = "thread2"; + ThreadReference thread2Ref = threadByName(thread2Name); + + StackFrame stackFrame0 = null; + StackFrame stackFrame1 = null; + StackFrame stackFrame2 = null; + + String breakpointMethod = "breakpointMethod"; + String breakpointLine = "breakpointLine"; + + log2("......setting breakpoint in breakpointMethod"); + breakpointRequest2 = settingBreakpoint(thread2Ref, debuggeeClass, + breakpointMethod, breakpointLine, "one"); + log2("......breakpointRequest2.enable();"); + breakpointRequest2.enable(); + + { // to get mainThread suspended; otherwise its end results in + // no suspention for breakpointRequest2 (bug or not?), end of test, + // and VMDisconnectException + thread2Ref.suspend(); + log2("......eventSet.resume();"); + eventSet.resume(); + breakpointForCommunication(); + log2("bpRequest.disable();"); + bpRequest.disable(); + thread2Ref.resume(); + } + + log2("......breakpointInMethod(breakpointRequest2);"); + breakpointInMethod("one"); + + log2("......stackFrame2 = thread2Ref.frame(2);"); + stackFrame2 = thread2Ref.frame(2); + + log2("......stackFrame1 = thread2Ref.frame(1);"); + stackFrame1 = thread2Ref.frame(1); + + log2("......thread2Ref.popFrames(stackFrame1);"); + try { + thread2Ref.popFrames(stackFrame1); + } catch ( IncompatibleThreadStateException e ) { + log3("ERROR: IncompatibleThreadStateException"); + testExitCode = FAILED; + break label0; + } + log2("......checking up on equality"); + if ( thread2Ref.frame(0).equals(stackFrame2) ) { + log3("ERROR: thread2Ref.frame(0).equals(stackFrame2)"); + testExitCode = FAILED; + } + + log2("......stackFrame1 = thread2Ref.frame(1);"); + try { + stackFrame1 = thread2Ref.frame(1); + log3("ERROR: no IndexOutOfBoundsException"); + testExitCode = FAILED; + } catch ( IndexOutOfBoundsException e ) { + log2(" IndexOutOfBoundsException"); + } + + + log2("......breakpointRequest2.disable();"); + breakpointRequest2.disable(); + + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private void breakpointInMethod(String number) + throws JDITestRuntimeException { + + Event event; + + getEventSet(); + event = eventIterator.nextEvent(); + + if ( !(event instanceof BreakpointEvent) ) + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + + log2("---->: request().getProperty == " + + event.request().getProperty("number")); + + if ( event.request().getProperty("number").equals(number) ) + return; + + throw new JDITestRuntimeException("** UNEXPECTED breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005/TestDescription.java new file mode 100644 index 00000000000..50f03ca86ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005/TestDescription.java @@ -0,0 +1,118 @@ +/* + * 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/ThreadReference/popFrames/popframes005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.popFrames() + * complies with its spec: + * public void popFrames(StackFrame frame) + * throws IncompatibleThreadStateException + * Pop stack frames. + * All frames up to and including the frame are popped off the stack. + * The frame previous to the + * parameter frame will become the current frame. + * After this operation, this thread will be suspended at the invoke + * instruction of the target method that created frame. + * The frame's method can be reentered with a step into the instruction. + * The operand stack is restored, however, any changes to the arguments that + * occurred in the called method, remain. For example, if the method foo: + * void foo(int x) { + * System.out.println("Foo: " + x); + * x = 4; + * System.out.println("pop here"); + * } + * was called with foo(7) and foo is popped at the second println and resumed, + * it will print: Foo: 4. + * Locks acquired by a popped frame are released when it is popped. + * This applies to synchronized methods that are popped, and + * to any synchronized blocks within them. + * Finally blocks are not executed. + * No aspect of state, other than this thread's execution point and locks, + * is affected by this call. Specifically, the values of fields are unchanged, + * as are external resources such as I/O streams. Additionally, + * the target program might be placed in a state that is impossible with + * normal program flow; for example, order of lock acquisition might be + * perturbed. Thus the target program may proceed differently than the user would expect. + * The specified thread must be suspended. + * All StackFrame objects for this thread are invalidated. + * No events are generated by this method. + * None of the frames through and including frame may be native. + * Not all target virtual machines support this operation. Use + * VirtualMachine.canPopFrames() to determine if the operation is supported. + * Parameters: frame - Stack frame to pop. + * frame is on this thread's call stack. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation - see + * VirtualMachine.canPopFrames(). + * IncompatibleThreadStateException - + * if this thread is not suspended. + * IllegalArgumentException - + * if frame is not on this thread's call stack. + * NativeMethodException - + * if one of the frames that would be popped is that of + * a native method or if frame is native. + * InvalidStackFrameException - + * if frame has become invalid. Once this thread is resumed, + * the stack frame is no longer valid. + * The test checks up on the assertions: + * (1) All StackFrame objects for this thread are invalidated. + * (2) The frame previous to the parameter frame will become the current frame. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.popFrames.popframes005; + * the debuggee program - nsk.jdi.ThreadReference.popFrames.popframes005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadReference.popFrames.popframes005 + * nsk.jdi.ThreadReference.popFrames.popframes005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005a.java new file mode 100644 index 00000000000..97028a557de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005a.java @@ -0,0 +1,178 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the popframes005 JDI test. + */ + +public class popframes005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread2popframes005a thread2 = null; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + + + static class JDIDebuggeeException extends Exception { + JDIDebuggeeException(String str) { + super("JDIDebuggeeException : " + str); + } + } + //---------------------------------------------------- main method + + static int var1 = 0; + static volatile int testVar = 0; + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + label0: + { + thread2 = new Thread2popframes005a("thread2"); + log1(" thread2 is created"); + + synchronized (lockingObject2) { + log1(" thread2.start()"); + if ( threadStart(thread2) != PASSED ) + break label0; + + log1(" methodForCommunication();"); + methodForCommunication(); + } + methodForCommunication(); + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + log1(" before: waitnotifyObj.wait();"); + waitnotifyObj.wait(); + log1(" after: waitnotifyObj.wait();"); + } catch ( Exception e) { + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static int breakpointLine = 3; + + static void breakpointMethod () { + log1("breakpointMethod entered by the thread : " + Thread.currentThread().getName() ); + var1 += 1; + var1 += 1; + var1 += 1; + log1("breakpointMethod: exit"); + } + + static void poppedMethod() { + log1("poppedMethod entered by the thread : " + Thread.currentThread().getName() ); + + log1("thread2: try clause: calling breakpointMethod();"); + breakpointMethod(); + + log1("poppedMethod: exit"); + return; + } + + static Object lockingObject2 = new Object(); + + static class Thread2popframes005a extends Thread { + + public Thread2popframes005a(String threadName) { + super(threadName); + } + + public void run() { + log1("thread2: method 'run' enter"); + synchronized (waitnotifyObj) { + log1("thread2: entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log1("thread2: exited from block: synchronized (waitnotifyObj)"); + + synchronized (lockingObject2) { + testVar = 0; + log1("thread2: before: 'poppedMethod()'"); + poppedMethod(); + log1("thread2: after: 'poppedMethod()'"); + } + return; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006.java new file mode 100644 index 00000000000..185ec14a7bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006.java @@ -0,0 +1,348 @@ +/* + * 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.ThreadReference.popFrames; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method:
    + * com.sun.jdi.ThreadReference.popFrames()
    + * properly throws IncompatibleThreadStateException or + * InvalidStackFrameException, if specified thread is resumed. + * + *

    Note, the test is pending decision on the bug:

    + * + * 4512840 JDI spec: for ThreadReference.popFrame() needs clarification

    + * + * Actually, only one exception should be thrown in case of resumed + * thread instead of two ones. + */ +public class popframes006 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ThreadReference.popFrames.popframes006t"; + + // name of debuggee's main thread + static final String DEBUGGEE_THRNAME = "popframes006tThr"; + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "popframes006tFindMe"; + // debuggee field used to indicate that popping has been done + static final String DEBUGGEE_FIELD = "wasPopped"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 80; + + static final int ATTEMPTS = 5; + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private ObjectReference objRef; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new popframes006().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "popframes006t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + Field doExit = null; + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + // debuggee field used to indicate that popping has been done + doExit = rType.fieldByName(DEBUGGEE_FIELD); + + // debuggee stack frame to be popped + StackFrame stFrame = findFrame(thrRef, DEBUGGEE_LOCALVAR); + + log.display("\nTrying to pop stack frame \"" + stFrame + + "\"\n\tlocation \"" + stFrame.location() + + "\"\n\tgot from thread reference \"" + thrRef + + "\"\n\twith resumed debuggee thread ..."); + + log.display("Resuming debuggee ..."); + vm.resume(); + + // wait for the thread resumption + int num = 0; + while (thrRef.isSuspended()) { + if (num > ATTEMPTS) + throw new Failure("unable to continue testing after " + + ATTEMPTS + + " attempts: debuggee thread " + + thrRef + " is not resumed yet"); + + Thread.currentThread().sleep(DELAY); + num++; + } + log.display("Debugee is resumed"); + +// Check the tested assersion + try { + thrRef.popFrames(stFrame); + log.complain("TEST FAILED: expected IncompatibleThreadStateException or InvalidStackFrameException was not thrown" + + "\n\twhen attempted to pop stack frame got from thread reference \"" + + thrRef + "\"\n\twith resumed debuggee thread"); + tot_res = Consts.TEST_FAILED; + // actually, it should be only one expected exception instead of two ones: + // see the bug 4512840 + } catch(IncompatibleThreadStateException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch(InvalidStackFrameException ee2) { + log.display("CHECK PASSED: caught expected " + ee2); + } catch(UnsupportedOperationException une) { + if (vm.canPopFrames()) { + une.printStackTrace(); + log.complain("TEST FAILED: caught exception: " + une + + "\n\tHowever, VirtualMachine.canPopFrames() shows, that the target VM" + + "\n\tdoes support popping frames of a threads stack: " + + vm.canPopFrames()); + tot_res = Consts.TEST_FAILED; + } else { + log.display("Warinig: unable to test an assertion: caught exception: " + une + + "\n\tand VirtualMachine.canPopFrames() shows, that the target VM" + + "\n\tdoes not support popping frames of a threads stack as well: " + + vm.canPopFrames()); + } + + } catch(Exception ue) { + ue.printStackTrace(); + log.complain("TEST FAILED: ThreadReference.popFrames(): caught unexpected " + + ue + "\n\tinstead of IncompatibleThreadStateException or InvalidStackFrameException" + + "\n\twhen attempted to pop stack frame got from thread reference \"" + + thrRef + "\"\n\twith resumed debuggee thread"); + tot_res = Consts.TEST_FAILED; + } + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } finally { +// Finish the test + // force an method to exit + if (objRef != null && doExit != null) { + try { + objRef.setValue(doExit, vm.mirrorOf(true)); + } catch(Exception sve) { + sve.printStackTrace(); + } + } + } + + return quitDebuggee(); + } + + private StackFrame findFrame(ThreadReference thrRef, String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = + stackFr.visibleVariableByName(varName); + // visible variable with the given name is found + if (locVar != null) { + objRef = (ObjectReference) + stackFr.getValue(locVar); + return stackFr; + } + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findFrame: caught unexpected exception: " + e); + } + throw new Failure("findFrame: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Final resumption of debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006/TestDescription.java new file mode 100644 index 00000000000..f181e7e6903 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006/TestDescription.java @@ -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/ThreadReference/popFrames/popframes006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method: + * com.sun.jdi.ThreadReference.popFrames() + * properly throws IncompatibleThreadStateException or + * InvalidStackFrameException, if specified thread is resumed. + * COMMENTS + * Note, the test is pending decision on the bug: + * 4512840 JDI spec: for ThreadReference.popFrame() needs clarification + * Actually, only one exception should be thrown in case of resumed + * thread instead of two ones. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.popFrames.popframes006 + * nsk.jdi.ThreadReference.popFrames.popframes006t + * + * @comment make sure popframes006t is compiled with full debug info + * @clean nsk.jdi.ThreadReference.popFrames.popframes006t + * @compile -g:lines,source,vars ../popframes006t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006t.java new file mode 100644 index 00000000000..73e70052c60 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006t.java @@ -0,0 +1,88 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class popframes006t { + private Log log; + private IOPipe pipe; + volatile boolean wasPopped = false; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new popframes006t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(popframes006.DEBUGGEE_THRNAME); + + pipe.println(popframes006.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(popframes006.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + frameToBePopped(); + + cmd = pipe.readln(); + if (!cmd.equals(popframes006.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + return Consts.TEST_FAILED; + } + return Consts.TEST_PASSED; + } + + private void frameToBePopped() { + popframes006t popframes006tFindMe = this; + + log.display("frameToBePopped: enter frameToBePopped()"); + + int stopMeHere = 0; // popframes006.DEBUGGEE_STOPATLINE + + while(!wasPopped) { // looping + stopMeHere++; stopMeHere--; + } + + log.display("frameToBePopped: leaving frameToBePopped()"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007.java new file mode 100644 index 00000000000..c4c25cd2a40 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007.java @@ -0,0 +1,334 @@ +/* + * 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.ThreadReference.popFrames; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The test checks that the JDI method:
    + * com.sun.jdi.ThreadReference.popFrames()
    + * properly throws IllegalArgumentException - if frame is not + * on specified thread's call stack.

    + * + * The target VM executes two debuggee threads: popframes007tMainThr + * and popframes007tAuxThr. Debugger part of the test tries to + * pop stack frame of the popframes007tAuxThr thread using + * reference of the popframes007tMainThr thread. + */ +public class popframes007 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ThreadReference.popFrames.popframes007t"; + + // names of debuggee threads + static final String DEBUGGEE_THRDS[] = { + "popframes007tMainThr", "popframes007tAuxThr" + }; + // debuggee local var used to find needed stack frame + static final String DEBUGGEE_LOCALVAR = "popframes007tFindMe"; + // debuggee field used to indicate that popping has been done + static final String DEBUGGEE_FIELD = "leaveMethod"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 83; + + static final int ATTEMPTS = 5; + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private ObjectReference objRef; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new popframes007().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "popframes007t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef[] = new ThreadReference[2]; + for (int i=0; i<2; i++) + if ((thrRef[i] = + debuggee.threadByName(DEBUGGEE_THRDS[i])) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRDS[i]); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + Field doExit = null; + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + + // debuggee field used to indicate that popping has been done + doExit = rType.fieldByName(DEBUGGEE_FIELD); + + // debuggee stack frame to be popped which is not on specified thread's call stack + StackFrame stFrame = findFrame(thrRef[1], DEBUGGEE_LOCALVAR); + + log.display("\nTrying to pop stack frame \"" + stFrame + + "\"\n\tlocation \"" + stFrame.location() + + "\"\n\tgot from thread reference \"" + thrRef[1] + + "\"\n\tand the frame is not on the following thread's call stack: \"" + + thrRef[0] + "\" ..."); + +// Check the tested assersion + try { + thrRef[0].popFrames(stFrame); + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to pop stack frame \"" + stFrame + + "\"\n\tlocation \"" + stFrame.location() + + "\"\n\tgot from thread reference \"" + thrRef[1] + + "\"\n\tand the frame is not on the following thread's call stack: \"" + + thrRef[0] + "\""); + tot_res = Consts.TEST_FAILED; + } catch(IllegalArgumentException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch(UnsupportedOperationException une) { + if (vm.canPopFrames()) { + une.printStackTrace(); + log.complain("TEST FAILED: caught exception: " + une + + "\n\tHowever, VirtualMachine.canPopFrames() shows, that the target VM" + + "\n\tdoes support popping frames of a threads stack: " + + vm.canPopFrames()); + tot_res = Consts.TEST_FAILED; + } else { + log.display("Warinig: unable to test an assertion: caught exception: " + une + + "\n\tand VirtualMachine.canPopFrames() shows, that the target VM" + + "\n\tdoes not support popping frames of a threads stack as well: " + + vm.canPopFrames()); + } + } catch(Exception ue) { + ue.printStackTrace(); + log.complain("TEST FAILED: ThreadReference.popFrames(): caught unexpected " + + ue + "\n\tinstead of IllegalArgumentException" + + "\n\twhen attempted to pop stack \"" + stFrame + + "\"\n\tlocation \"" + stFrame.location() + + "\"\n\tgot from thread reference \"" + thrRef[1] + + "\"\n\tand the frame is not on the following thread's call stack: \"" + + thrRef[0] + "\""); + tot_res = Consts.TEST_FAILED; + } + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } finally { +// Finish the test + // force an method to exit + if (objRef != null && doExit != null) { + try { + objRef.setValue(doExit, vm.mirrorOf(true)); + } catch(Exception sve) { + sve.printStackTrace(); + } + } + } + + return quitDebuggee(); + } + + private StackFrame findFrame(ThreadReference thrRef, String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = + stackFr.visibleVariableByName(varName); + // visible variable with the given name is found + if (locVar != null) { + objRef = (ObjectReference) + stackFr.getValue(locVar); + return stackFr; + } + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findFrame: caught unexpected exception: " + e); + } + throw new Failure("findFrame: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Final resumption of debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007/TestDescription.java new file mode 100644 index 00000000000..8bc0a33aad4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007/TestDescription.java @@ -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/ThreadReference/popFrames/popframes007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method: + * com.sun.jdi.ThreadReference.popFrames() + * properly throws IllegalArgumentException - if frame is not + * on this thread's call stack. + * The target VM executes two debuggee threads: "popframes007tMainThr" + * and "popframes007tAuxThr". Debugger part of the test tries to + * pop stack frame of the popframes007tAuxThr thread using + * reference of the popframes007tMainThr thread. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.popFrames.popframes007 + * nsk.jdi.ThreadReference.popFrames.popframes007t + * + * @comment make sure popframes007t is compiled with full debug info + * @clean nsk.jdi.ThreadReference.popFrames.popframes007t + * @compile -g:lines,source,vars ../popframes007t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.popFrames.popframes007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007t.java new file mode 100644 index 00000000000..a6eb18078db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007t.java @@ -0,0 +1,178 @@ +/* + * 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.ThreadReference.popFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class popframes007t { + private Log log; + private IOPipe pipe; + private OtherThr auxThr; + volatile boolean leaveMethod = false; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new popframes007t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(popframes007.DEBUGGEE_THRDS[0]); + startThread(); + + // Now the debuggee is ready for testing + pipe.println(popframes007.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(popframes007.COMMAND_QUIT)) { + killThread(argHandler.getWaitTime()*60000); + log.complain("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + frameToBePopped(); + + cmd = pipe.readln(); + killThread(argHandler.getWaitTime()*60000); + if (!cmd.equals(popframes007.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + return Consts.TEST_FAILED; + } + return Consts.TEST_PASSED; + } + + private void frameToBePopped() { + log.display("frameToBePopped: enter frameToBePopped()"); + + int stopMeHere = 0; // popframes007.DEBUGGEE_STOPATLINE + + while(!leaveMethod) { // looping + stopMeHere++; stopMeHere--; + } + + log.display("frameToBePopped: leaving frameToBePopped()"); + } + + private void startThread() { + Object readyObj = new Object(); + + auxThr = new OtherThr(readyObj, + popframes007.DEBUGGEE_THRDS[1], this); + auxThr.setDaemon(true); + + log.display("Debuggee: starting thread \"" + + auxThr.getName() + "\" ..."); + synchronized(readyObj) { + auxThr.start(); + try { + readyObj.wait(); // wait for the thread's readiness + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: waiting for the thread " + + auxThr + " start: caught " + e); + pipe.println("failed"); + System.exit(Consts.JCK_STATUS_BASE + + Consts.TEST_FAILED); + } + } + log.display("Debuggee: the thread \"" + + auxThr.getName() + "\" started"); + } + + private void killThread(int waitTime) { + auxThr.doExit = true; + try { + auxThr.join(waitTime); + log.display("Debuggee: thread \"" + + auxThr.getName() + "\" done"); + } catch (InterruptedException e) { + log.complain("TEST FAILURE: Debuggee: joining the thread \"" + + auxThr.getName() + "\": caught " + e); + } + } + + /** + * This is an auxiliary thread class used to check frame popping + * in the debugger. + */ + class OtherThr extends Thread { + volatile boolean doExit = false; + private Object readyObj; + private popframes007t mainThrObj; + + OtherThr(Object readyObj, String name, popframes007t mainThrObj) { + super(name); + this.readyObj = readyObj; + this.mainThrObj = mainThrObj; + } + + public void run() { + // var used by debugger for searching needed stack frame + popframes007t popframes007tFindMe = mainThrObj; + + Thread thr = Thread.currentThread(); + + synchronized(readyObj) { + readyObj.notify(); // notify the main thread + } + log.display("Debuggee thread \"" + + thr.getName() + "\": going to loop"); + while(!doExit) { + int i = 0; + i++; i--; + + // reliable analogue of Thread.yield() + synchronized(this) { + try { + this.wait(30); + } catch (InterruptedException e) { + e.printStackTrace(log.getOutStream()); + log.complain("TEST FAILURE: Debuggee thread \"" + + thr.getName() + + "\" interrupted while sleeping:\n\t" + e); + break; + } + } + } + log.display("Debuggee thread \"" + + thr.getName() + "\" exiting ..."); + } + } +///////////////////////////////////////////////////////////////////////////// + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java new file mode 100644 index 00000000000..58ab1a1c4c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java @@ -0,0 +1,576 @@ +/* + * 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.ThreadReference.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.resume()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since thread2 uses the same locking object in its 'run' method
    + * it is locked up until first thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up breakpoints within thread2's two methods and checks up that
    + * call to the method thread2.resume() has no effect when the thread2
    + * is not suspended but is just waiting at a synchronized block, and
    + * resumes the thread2 when it is suspended:
    + * - with thread2.suspend()
    + * - at a breakpoint
    + * - with VirtualMachine.suspend()
    + */ + +public class resume001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/resume/resume001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new resume001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.resume.resume001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.resume.Threadresume001a"; + + //String mName = "nsk.jdi.ThreadReference.resume"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + BreakpointRequest breakpRequest3 = null; + + int suspCount = 0; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest3 = settingBreakpoint(breakpointMethod1, bpLine3, "three"); + if (breakpRequest3 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + + log2("......checking up that thread2.resume() has no effect to not suspended thread"); + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" resuming the thread2"); + thread2.resume(); + + log2(" checking up that the thread2 is not at breakpoint"); + if (thread2.isAtBreakpoint()) { + log3("ERROR: thread2.isAtBreakpoint() ???"); + expresult = returnCode1; + } + log2(" checking up that thread2's suspendCount == 0"); + if (thread2.suspendCount() != 0) { + log3("ERROR: thread2.suspendCount() != 0 ???"); + expresult = returnCode1; + } + + log2(" disabling breakpRequest1"); + breakpRequest1.disable(); + + if (expresult != returnCode0) + break label1; + + + log2("......checking up that thread2.resume() resumes thread2 suspended with thread2.suspend()"); + + log2(" suspending the thread2 with thread2.suspend()"); + thread2.suspend(); + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" resuming the thread2"); + thread2.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2("......checking up that thread2.resume() resumes thread2 suspended at a breakpoint"); + + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + + log2(" resuming the thread2"); + thread2.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2("......checking up that thread2.resume() resumes thread2 suspended with VirtualMachine.suspend()"); + + log2(" enabling breakpRequest3"); + breakpRequest3.enable(); + log2(" suspending the thread2 with vm.suspend()"); + vm.suspend(); + log2(" first resuming the thread2 with eventSet.resume()"); + eventSet.resume(); + log2(" checking up thread's state"); + if (thread2.isSuspended()) { + log2(" : thread2.isSuspended()"); + } else { + log3("ERROR: !thread2.isSuspended()"); + expresult = returnCode1; + break label1; + } + log2(" second resuming the thread2 with thread2.resume()"); + thread2.resume(); + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + + log2(" resuming the thread2"); + thread2.resume(); + + } + vm.resume(); + vm.resume(); // for case error when both VirtualMachine and the thread2 were suspended + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001/TestDescription.java new file mode 100644 index 00000000000..aca24385791 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/ThreadReference/resume/resume001. + * VM Testbase keywords: [quick, jpda, jdi, quarantine] + * VM Testbase comments: JDK-8072701 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.resume() + * complies with its spec: + * public void resume() + * Resumes this thread. If this thread was not previously suspended through + * suspend() or through VirtualMachine.suspend(), invoking this method + * has no effect. Otherwise, the count of pending suspends on this thread + * is decremented. If it is decremented to 0, + * the thread will continue to execute. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.resume.resume001; + * the debuggee program - nsk.jdi.ThreadReference.resume.resume001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.resume.resume001 + * nsk.jdi.ThreadReference.resume.resume001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.resume.resume001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java new file mode 100644 index 00000000000..9f3b7da3c1d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java @@ -0,0 +1,208 @@ +/* + * 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.ThreadReference.resume; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the resume001 JDI test. + */ + +public class resume001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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); + check(status003a.testedThreadNames[0], "CHECK1", "CHECK2"); + check(status003a.testedThreadNames[1], "CHECK3", "CHECK4"); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static String getThreadStatusName (int status) { + switch (status) { + case ThreadReference.THREAD_STATUS_UNKNOWN: + return "THREAD_STATUS_UNKNOWN"; + case ThreadReference.THREAD_STATUS_ZOMBIE: + return "THREAD_STATUS_ZOMBIE"; + case ThreadReference.THREAD_STATUS_RUNNING: + return "THREAD_STATUS_RUNNING"; + case ThreadReference.THREAD_STATUS_SLEEPING: + return "THREAD_STATUS_SLEEPING"; + case ThreadReference.THREAD_STATUS_MONITOR: + return "THREAD_STATUS_MONITOR"; + case ThreadReference.THREAD_STATUS_WAIT: + return "THREAD_STATUS_WAIT"; + case ThreadReference.THREAD_STATUS_NOT_STARTED: + return "THREAD_STATUS_NOT_STARTED"; + default: + return "ERROR: Unknown ThreadReference status " + status; + } + } + + private static void check (String threadName, String check1, String check2) { + ThreadReference testedThread = (ThreadReference)debuggeeClass.getValue(debuggeeClass.fieldByName(threadName)); + int threadStatus = testedThread.status(); + + if (threadStatus == ThreadReference.THREAD_STATUS_ZOMBIE) { + display(check1 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_ZOMBIE for unsuspended " + threadName); + } else { + complain(check1 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus)+ " for unsuspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_ZOMBIE)); + exitStatus = Consts.TEST_FAILED; + } + + try { + testedThread.suspend(); + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_ZOMBIE) { + display(check2 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_ZOMBIE for suspended " + threadName); + } else { + complain(check2 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for suspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_ZOMBIE)); + exitStatus = Consts.TEST_FAILED; + } + testedThread.resume(); + } catch (Exception e) { + complain(check2 + " FAILED"); + complain("\t Unexpected exception while calling ThreadReference.suspend() for " + threadName + " : " + e); + exitStatus = Consts.TEST_FAILED; + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status003/status003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status003/status003a.java new file mode 100644 index 00000000000..09ead2f35e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status003/status003a.java @@ -0,0 +1,151 @@ +/* + * 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.ThreadReference.status.status003; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class status003a { + + //------------------------------------------------------- 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 String testedThreadNames[] = {"finishedThread", "interruptedThread"}; + static Thread finishedThread; + static Thread interruptedThread; + + static Wicket wicket1 = new Wicket(); + static Wicket wicket2 = new Wicket(); + static Object lock = new Object(); + + //------------------------------------------------------ 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(status003.SIGNAL_READY); + + finishedThread = new status003aThreadFinished(testedThreadNames[0]); + display(finishedThread.getName() + " is created"); + + finishedThread.start(); + wicket1.waitFor(); + waitForFinish(finishedThread); + + interruptedThread = new status003aThreadInterrupted(testedThreadNames[1]); + display(interruptedThread.getName() + " is created"); + + synchronized (lock) { + interruptedThread.start(); + wicket2.waitFor(); + + interruptedThread.interrupt(); + if (!interruptedThread.isInterrupted()) { + throw new Failure(interruptedThread.getName() + " has not been interrupted"); + } + } + waitForFinish(interruptedThread); + + pipe.println(status003.SIGNAL_GO); + receiveSignal(status003.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void waitForFinish (Thread thread) { + if (thread.isAlive()) { + try { + thread.join(argHandler.getWaitTime() * 60000); + display(thread.getName() + " is finished"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + throw new Failure(thread.getName() + " has not finished after " + argHandler.getWaitTime() + " mins"); + } + } + } + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class status003aThreadFinished extends Thread { + status003aThreadFinished (String name) { + super(name); + } + + public void run () { + status003a.wicket1.unlock(); + status003a.display(Thread.currentThread().getName() + " finished."); + } +} + +class status003aThreadInterrupted extends Thread { + status003aThreadInterrupted (String name) { + super(name); + } + + public void run () { + status003a.wicket2.unlock(); + synchronized (status003a.lock) {}; + status003a.display(Thread.currentThread().getName() + " finished."); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status004/status004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status004/status004.java new file mode 100644 index 00000000000..7ec88df60e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status004/status004.java @@ -0,0 +1,257 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/ThreadReference/status/status004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for status() method of ThreadReference interface. + * The test checks if the method returns + * ThreadReference.THREAD_STATUS_MONITOR status for debuggee's + * thread when it contends to lock a monitor. + * The test has two cases: + * - thread is blocked on enter of synchronized method, + * - thread is blocked on enter of synchronized statement. + * The test checks status of unsuspended and suspended thread in + * both cases. + * The test consists of a debugger program (status004.java) + * and debuggee application (status004a.java). + * Package name is nsk.jdi.ThreadReference.status. + * 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. + * In both test cases the debuggee starts special axiliary threads. + * After notification of readiness from debuggee, the debugger + * checks if ThreadReference.status() returns expected status + * for checked thread. Then the debugger suspends the checked + * thread and checks its status again. + * The test fails if status() method returned a status code + * other then expected THREAD_STATUS_MONITOR one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.status.status004.status004 + * nsk.jdi.ThreadReference.status.status004.status004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.status.status004.status004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.status.status004; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.ThreadReference; + +//import com.sun.jdi.request.*; +//import com.sun.jdi.event.*; +//import com.sun.jdi.connect.*; +import java.io.*; +//import java.util.*; + +/** + * The debugger application of the test. + */ +public class status004 { + + //------------------------------------------------------- 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.ThreadReference.status.status004."; + private final static String className = "status004"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String testedThreadName = prefix + "status004aThread"; + + //------------------------------------------------------- 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); + check(status004a.testedThreadNames[0], "CHECK1", "CHECK2"); + check(status004a.testedThreadNames[1], "CHECK3", "CHECK4"); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static String getThreadStatusName (int status) { + switch (status) { + case ThreadReference.THREAD_STATUS_UNKNOWN: + return "THREAD_STATUS_UNKNOWN"; + case ThreadReference.THREAD_STATUS_ZOMBIE: + return "THREAD_STATUS_ZOMBIE"; + case ThreadReference.THREAD_STATUS_RUNNING: + return "THREAD_STATUS_RUNNING"; + case ThreadReference.THREAD_STATUS_SLEEPING: + return "THREAD_STATUS_SLEEPING"; + case ThreadReference.THREAD_STATUS_MONITOR: + return "THREAD_STATUS_MONITOR"; + case ThreadReference.THREAD_STATUS_WAIT: + return "THREAD_STATUS_WAIT"; + case ThreadReference.THREAD_STATUS_NOT_STARTED: + return "THREAD_STATUS_NOT_STARTED"; + default: + return "ERROR: Unknown ThreadReference status " + status; + } + } + + private static void check (String threadName, String check1, String check2) { + ThreadReference testedThread = (ThreadReference)debuggeeClass.getValue(debuggeeClass.fieldByName(threadName)); + + // wait during waitTime until testedThread has been blocked on monitor + boolean monitorReached = false; + if (debuggee.VM().canGetCurrentContendedMonitor()) { + try { + long oldTime = System.currentTimeMillis(); + while (!monitorReached && (System.currentTimeMillis() - oldTime) <= status004.waitTime) { + testedThread.suspend(); + ObjectReference monitor = testedThread.currentContendedMonitor(); + testedThread.resume(); + + if (monitor != null && monitor.referenceType().name().equals(prefix + "Lock")) { + display("ThreadReference.currentContendedMonitor() returned correct monitor reference for " + threadName); + monitorReached = true; + } else { + try { + Thread.currentThread().sleep(1000); + } catch (InterruptedException e) { + display("Debugger's main thread was interrupted while sleeping "); + } + } + } + } catch (Exception e) { + complain("Unexpected exception while waiting until " + threadName + " has been blocked : " + e); + exitStatus = Consts.TEST_FAILED; + } + } else { + display("WARNING: ThreadReference.currentContendedMonitor() was not checked for " + threadName); + monitorReached = true; + } + if (!monitorReached) { + complain("Tested " + threadName + " has not been blocked on monitor"); + exitStatus = Consts.TEST_FAILED; + + } else { + int threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_MONITOR) { + display(check1 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_MONITOR for unsuspended " + threadName); + } else { + complain(check1 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus)+ " for unsuspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_MONITOR)); + exitStatus = Consts.TEST_FAILED; + } + + try { + testedThread.suspend(); + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_MONITOR) { + display(check2 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_MONITOR for suspended " + threadName); + } else { + complain(check2 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for suspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_MONITOR)); + exitStatus = Consts.TEST_FAILED; + } + testedThread.resume(); + } catch (Exception e) { + complain(check2 + " FAILED"); + complain("\t Unexpected exception while calling ThreadReference.suspend for " + threadName + " : " + e); + exitStatus = Consts.TEST_FAILED; + } + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status004/status004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status004/status004a.java new file mode 100644 index 00000000000..32e046a7833 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status004/status004a.java @@ -0,0 +1,147 @@ +/* + * 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.ThreadReference.status.status004; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class status004a { + + //------------------------------------------------------- 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 String testedThreadNames[] = {"threadBlockedOnMethod", "threadBlockedOnStatmt"}; + static status004aThreadBlockedOnMethod threadBlockedOnMethod; + static status004aThreadBlockedOnStatmt threadBlockedOnStatmt; + + static Wicket wickets[] = { new Wicket(), new Wicket() }; + static Lock lock = new Lock(); + + //------------------------------------------------------ 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(status004.SIGNAL_READY); + + threadBlockedOnMethod = new status004aThreadBlockedOnMethod(testedThreadNames[0]); + threadBlockedOnStatmt = new status004aThreadBlockedOnStatmt(testedThreadNames[1]); + + synchronized (lock) { + threadBlockedOnMethod.start(); + wickets[0].waitFor(); + + threadBlockedOnStatmt.start(); + wickets[1].waitFor(); + + pipe.println(status004.SIGNAL_GO); + receiveSignal(status004.SIGNAL_QUIT); + } + + waitForFinish(threadBlockedOnMethod); + waitForFinish(threadBlockedOnStatmt); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void waitForFinish (Thread thread) { + if (thread.isAlive()) { + try { + thread.join(argHandler.getWaitTime() * 60000); + display(thread.getName() + " is finished"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + throw new Failure(thread.getName() + " has not finished after " + argHandler.getWaitTime() + " mins"); + } + } + } + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class Lock { + synchronized void foo () {} +} + + +class status004aThreadBlockedOnMethod extends Thread { + status004aThreadBlockedOnMethod (String name) { + super(name); + } + + public void run () { + status004a.wickets[0].unlock(); + synchronized (status004a.lock) {}; + } +} + +class status004aThreadBlockedOnStatmt extends Thread { + status004aThreadBlockedOnStatmt (String name) { + super(name); + } + + public void run () { + status004a.wickets[1].unlock(); + status004a.lock.foo(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status005/status005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status005/status005.java new file mode 100644 index 00000000000..b445b72988a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status005/status005.java @@ -0,0 +1,266 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/ThreadReference/status/status005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for status() method of ThreadReference interface. + * The test checks if the method returns + * ThreadReference.THREAD_STATUS_WAIT status for + * debuggee's thread when it performs Object.wait() call. + * The test has two cases: + * - for Object.wait() call, + * - for Object.wait(long) call. + * The test checks status of unsuspended and suspended thread in + * both cases. + * The test consists of a debugger program (status005.java) + * and debuggee application (status005a.java). + * Package name is nsk.jdi.ThreadReference.status. + * 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. + * In both test cases the debuggee starts special axiliary threads. + * After notification of readiness from debuggee, the debugger + * checks if ThreadReference.status() returns expected status + * for checked thread. Then the debugger suspends the checked + * thread and checks its status again. + * The test fails if status() method returned a status code + * other then expected THREAD_STATUS_WAIT one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.status.status005.status005 + * nsk.jdi.ThreadReference.status.status005.status005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.status.status005.status005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.status.status005; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.ThreadReference; + +//import com.sun.jdi.request.*; +//import com.sun.jdi.event.*; +//import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class status005 { + + //------------------------------------------------------- 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.ThreadReference.status.status005."; + private final static String className = "status005"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String testedThreadName = prefix + "status005aThread"; + + //------------------------------------------------------- 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); + check(status005a.testedThreadNames[0], "CHECK1", "CHECK2"); + check(status005a.testedThreadNames[1], "CHECK3", "CHECK4"); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static String getThreadStatusName (int status) { + switch (status) { + case ThreadReference.THREAD_STATUS_UNKNOWN: + return "THREAD_STATUS_UNKNOWN"; + case ThreadReference.THREAD_STATUS_ZOMBIE: + return "THREAD_STATUS_ZOMBIE"; + case ThreadReference.THREAD_STATUS_RUNNING: + return "THREAD_STATUS_RUNNING"; + case ThreadReference.THREAD_STATUS_SLEEPING: + return "THREAD_STATUS_SLEEPING"; + case ThreadReference.THREAD_STATUS_MONITOR: + return "THREAD_STATUS_MONITOR"; + case ThreadReference.THREAD_STATUS_WAIT: + return "THREAD_STATUS_WAIT"; + case ThreadReference.THREAD_STATUS_NOT_STARTED: + return "THREAD_STATUS_NOT_STARTED"; + default: + return "ERROR: Unknown ThreadReference status " + status; + } + } + + private static void check (String threadName, String check1, String check2) { + ThreadReference testedThread = (ThreadReference)debuggeeClass.getValue(debuggeeClass.fieldByName(threadName)); + ObjectReference lockRef = (ObjectReference)debuggeeClass.getValue(debuggeeClass.fieldByName("lock")); + + // wait during waitTime until testedThread becomes waiting notification + boolean waitingNotify = false; + if (debuggee.VM().canGetMonitorInfo()) { + try { + long oldTime = System.currentTimeMillis(); + while (!waitingNotify && (System.currentTimeMillis() - oldTime) <= status005.waitTime) { + + debuggee.VM().suspend(); + + Iterator waitingThreads = lockRef.waitingThreads().iterator(); + while (waitingThreads.hasNext()) { + ThreadReference threadRef = (ThreadReference)waitingThreads.next(); + if (threadRef.equals(testedThread)) { + waitingNotify = true; + display("ObjectReference.waitingThreads() contains expected reference to " + threadName); + } + } + + debuggee.VM().resume(); + + if (!waitingNotify) { + try { + Thread.currentThread().sleep(1000); + } catch (InterruptedException e) { + display("Debugger's main thread was interrupted while sleeping "); + } + } + } + } catch (Exception e) { + complain("Unexpected exception while waiting until " + threadName + " set on waiting state: " + e); + exitStatus = Consts.TEST_FAILED; + } + } else { + display("WARNING: ObjectReference.waitingThreads() was not checked for " + threadName); + waitingNotify = true; + } + if (!waitingNotify) { + complain("Tested " + threadName + " did not wait "); + exitStatus = Consts.TEST_FAILED; + + } else { + int threadStatus = testedThread.status(); + + if (threadStatus == ThreadReference.THREAD_STATUS_WAIT) { + display(check1 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_WAIT for unsuspended " + threadName); + } else { + complain(check1 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for unsuspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_WAIT)); + exitStatus = Consts.TEST_FAILED; + } + + try { + testedThread.suspend(); + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_WAIT) { + display(check2 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_WAIT for suspended " + threadName); + } else { + complain(check2 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus)+ " for suspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_WAIT)); + exitStatus = Consts.TEST_FAILED; + } + testedThread.resume(); + } catch (Exception e) { + complain(check2 + " FAILED"); + complain("\t Unexpected exception while calling ThreadReference.suspend for " + threadName + " : " + e); + exitStatus = Consts.TEST_FAILED; + } + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status005/status005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status005/status005a.java new file mode 100644 index 00000000000..5dac6645b49 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status005/status005a.java @@ -0,0 +1,161 @@ +/* + * 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.ThreadReference.status.status005; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class status005a { + + //------------------------------------------------------- immutable common fields + + private static int exitStatus; + private static Log log; + private static IOPipe pipe; + static ArgumentHandler argHandler; + + //------------------------------------------------------- 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 String testedThreadNames[] = {"threadWaitingInfinitely", "threadWaitingLong"}; + static status005aThreadWaitingInfinitely threadWaitingInfinitely; + static status005aThreadWaitingLong threadWaitingLong; + + static Wicket wickets[] = { new Wicket(), new Wicket() }; + static Lock lock = new Lock(); + + //------------------------------------------------------ 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(status005.SIGNAL_READY); + + threadWaitingInfinitely = new status005aThreadWaitingInfinitely(testedThreadNames[0]); + threadWaitingLong = new status005aThreadWaitingLong(testedThreadNames[1]); + + threadWaitingInfinitely.start(); + wickets[0].waitFor(); + + threadWaitingLong.start(); + wickets[1].waitFor(); + + pipe.println(status005.SIGNAL_GO); + receiveSignal(status005.SIGNAL_QUIT); + + synchronized (lock) { + lock.notifyAll(); + } + + waitForFinish(threadWaitingInfinitely); + waitForFinish(threadWaitingLong); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void waitForFinish (Thread thread) { + if (thread.isAlive()) { + try { + thread.join(argHandler.getWaitTime() * 60000); + display(thread.getName() + " is finished"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + throw new Failure(thread.getName() + " has not finished after " + argHandler.getWaitTime() + " mins"); + } + } + } + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class Lock { + synchronized void foo () {} +} + + +class status005aThreadWaitingInfinitely extends Thread { + status005aThreadWaitingInfinitely (String name) { + super(name); + } + + public void run () { + status005a.wickets[0].unlock(); + synchronized (status005a.lock) { + try { + status005a.lock.wait(); + } catch (InterruptedException e) { + throw new Failure(Thread.currentThread().getName() + ": Unexpected InterruptedException while waiting"); + } + } + } +} + +class status005aThreadWaitingLong extends Thread { + status005aThreadWaitingLong (String name) { + super(name); + } + + public void run () { + status005a.wickets[1].unlock(); + synchronized (status005a.lock) { + try { + status005a.lock.wait(status005a.argHandler.getWaitTime() * 60000 * 2); + } catch (InterruptedException e) { + throw new Failure(Thread.currentThread().getName() + ": Unexpected InterruptedException while waiting"); + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status006/status006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status006/status006.java new file mode 100644 index 00000000000..95b60ed1a98 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status006/status006.java @@ -0,0 +1,244 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/ThreadReference/status/status006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for status() method of ThreadReference interface. + * The test checks if the method returns + * ThreadReference.THREAD_STATUS_SLEEPING status for + * debuggee's thread when it performs Thread.sleep() call. + * The test has two cases: + * - for Thread.sleep(long) call, + * - for Thread.sleep(long, int) call. + * The test checks status of unsuspended and suspended thread + * in both cases. + * The test consists of a debugger program (status006.java) + * and debuggee application (status006a.java). + * Package name is nsk.jdi.ThreadReference.status. + * 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. + * In both test cases the debuggee starts special axiliary threads. + * These threads call Thread.sleep() before checking. After + * notification of readiness from debuggee, the debugger + * checks if ThreadReference.status() returns expected status + * for checked thread. Then the debugger suspends the checked + * thread and checks its status again. + * The test fails if status() method returned a status code + * other then expected THREAD_STATUS_SLEEPING one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.status.status006.status006 + * nsk.jdi.ThreadReference.status.status006.status006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.status.status006.status006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.status.status006; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.ThreadReference; + +//import com.sun.jdi.request.*; +//import com.sun.jdi.event.*; +//import com.sun.jdi.connect.*; +import java.io.*; +//import java.util.*; + +/** + * The debugger application of the test. + */ +public class status006 { + + //------------------------------------------------------- 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.ThreadReference.status.status006."; + private final static String className = "status006"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + final static String SIGNAL_NEXT = "next"; + + private final static String testedThreadName = prefix + "status006aThread"; + + //------------------------------------------------------- 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); + check(status006a.testedThreadNames[0], "CHECK1", "CHECK2"); + debuggee.sendSignal(SIGNAL_NEXT); + debuggee.receiveExpectedSignal(SIGNAL_GO); + check(status006a.testedThreadNames[1], "CHECK3", "CHECK4"); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static String getThreadStatusName (int status) { + switch (status) { + case ThreadReference.THREAD_STATUS_UNKNOWN: + return "THREAD_STATUS_UNKNOWN"; + case ThreadReference.THREAD_STATUS_ZOMBIE: + return "THREAD_STATUS_ZOMBIE"; + case ThreadReference.THREAD_STATUS_RUNNING: + return "THREAD_STATUS_RUNNING"; + case ThreadReference.THREAD_STATUS_SLEEPING: + return "THREAD_STATUS_SLEEPING"; + case ThreadReference.THREAD_STATUS_MONITOR: + return "THREAD_STATUS_MONITOR"; + case ThreadReference.THREAD_STATUS_WAIT: + return "THREAD_STATUS_WAIT"; + case ThreadReference.THREAD_STATUS_NOT_STARTED: + return "THREAD_STATUS_NOT_STARTED"; + default: + return "ERROR: Unknown ThreadReference status " + status; + } + } + + private static void check (String threadName, String check1, String check2) { + ThreadReference testedThread = (ThreadReference)debuggeeClass.getValue(debuggeeClass.fieldByName(threadName)); + + boolean threadWasSleeping = false; + int threadStatus = ThreadReference.THREAD_STATUS_UNKNOWN; + + // check up to 20 times if tested thread was sleeping + for (int i = 0; !threadWasSleeping && i < 20; i++) { + + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_SLEEPING) { + threadWasSleeping = true; + } else { + try { + Thread.currentThread().sleep(1000); + } catch (InterruptedException e) { + display("Debugger's main thread was interrupted while sleeping "); + } + } + } + + if (threadWasSleeping) { + display(check1 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_SLEEPING for unsuspended " + threadName); + } else { + complain(check1 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for unsuspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_SLEEPING)); + exitStatus = Consts.TEST_FAILED; + } + + try { + testedThread.suspend(); + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_SLEEPING) { + display(check2 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_SLEEPING for suspended " + threadName); + } else { + complain(check2 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for suspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_SLEEPING)); + exitStatus = Consts.TEST_FAILED; + } + testedThread.resume(); + } catch (Exception e) { + complain(check2 + " FAILED"); + complain("\t Unexpected exception while calling ThreadReference.suspend for " + threadName + " : " + e); + exitStatus = Consts.TEST_FAILED; + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status006/status006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status006/status006a.java new file mode 100644 index 00000000000..fe3f517172d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status006/status006a.java @@ -0,0 +1,149 @@ +/* + * 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.ThreadReference.status.status006; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class status006a { + + //------------------------------------------------------- immutable common fields + + private static int exitStatus; + private static Log log; + private static IOPipe pipe; + static ArgumentHandler argHandler; + + //------------------------------------------------------- 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 String testedThreadNames[] = {"threadSleepingLong", "threadSleepingLongInt"}; + static status006aThreadSleepingLong threadSleepingLong; + static status006aThreadSleepingLongInt threadSleepingLongInt; + static Wicket wickets[] = { new Wicket(), new Wicket() }; + + //------------------------------------------------------ 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(status006.SIGNAL_READY); + + threadSleepingLong = new status006aThreadSleepingLong(testedThreadNames[0]); + threadSleepingLong.start(); + wickets[0].waitFor(); + + pipe.println(status006.SIGNAL_GO); + receiveSignal(status006.SIGNAL_NEXT); + threadSleepingLong.interrupt(); + + threadSleepingLongInt = new status006aThreadSleepingLongInt(testedThreadNames[1]); + threadSleepingLongInt.start(); + wickets[1].waitFor(); + + pipe.println(status006.SIGNAL_GO); + receiveSignal(status006.SIGNAL_QUIT); + threadSleepingLongInt.interrupt(); + + waitForFinish(threadSleepingLong); + waitForFinish(threadSleepingLongInt); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void waitForFinish (Thread thread) { + if (thread.isAlive()) { + try { + thread.join(argHandler.getWaitTime() * 60000); + display(thread.getName() + " is finished"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + throw new Failure(thread.getName() + " has not finished after " + argHandler.getWaitTime() + " mins"); + } + } + } + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class status006aThreadSleepingLong extends Thread { + status006aThreadSleepingLong (String name) { + super(name); + } + + public void run () { + status006a.wickets[0].unlock(); + try { + Thread.currentThread().sleep(status006a.argHandler.getWaitTime() * 60000); + } catch (InterruptedException e) { + // its's OK + } + } +} + +class status006aThreadSleepingLongInt extends Thread { + status006aThreadSleepingLongInt (String name) { + super(name); + } + + public void run () { + status006a.wickets[1].unlock(); + try { + Thread.currentThread().sleep(status006a.argHandler.getWaitTime() * 60000, 0); + } catch (InterruptedException e) { + // it's OK + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status007/status007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status007/status007.java new file mode 100644 index 00000000000..82c4564784c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status007/status007.java @@ -0,0 +1,215 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/ThreadReference/status/status007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for status() method of ThreadReference interface. + * The test checks if the method returns + * ThreadReference.THREAD_STATUS_RUNNING status for + * debuggee's thread when it is running. + * The test consists of a debugger program (status007.java) + * and debuggee application (status007a.java). + * Package name is nsk.jdi.ThreadReference.status. + * 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. + * The debuggee starts special checked thread. This thread + * executes some 'while' loop. + * After notification of readiness from debuggee, the debugger + * checks if ThreadReference.status() returns expected status + * for checked thread. Then the debugger suspends the checked + * thread and checks its status again. + * The test fails if status() method returned a status code + * other then expected THREAD_STATUS_RUNNING one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.status.status007.status007 + * nsk.jdi.ThreadReference.status.status007.status007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.status.status007.status007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.status.status007; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.ThreadReference; + +//import com.sun.jdi.request.*; +//import com.sun.jdi.event.*; +//import com.sun.jdi.connect.*; +import java.io.*; + +/** + * The debugger application of the test. + */ +public class status007 { + + //------------------------------------------------------- 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.ThreadReference.status.status007."; + private final static String className = "status007"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String testedThreadName = prefix + "status007aThread"; + + //------------------------------------------------------- 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); + check(status007a.testedThreadNames[0], "CHECK1", "CHECK2"); + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static String getThreadStatusName (int status) { + switch (status) { + case ThreadReference.THREAD_STATUS_UNKNOWN: + return "THREAD_STATUS_UNKNOWN"; + case ThreadReference.THREAD_STATUS_ZOMBIE: + return "THREAD_STATUS_ZOMBIE"; + case ThreadReference.THREAD_STATUS_RUNNING: + return "THREAD_STATUS_RUNNING"; + case ThreadReference.THREAD_STATUS_SLEEPING: + return "THREAD_STATUS_SLEEPING"; + case ThreadReference.THREAD_STATUS_MONITOR: + return "THREAD_STATUS_MONITOR"; + case ThreadReference.THREAD_STATUS_WAIT: + return "THREAD_STATUS_WAIT"; + case ThreadReference.THREAD_STATUS_NOT_STARTED: + return "THREAD_STATUS_NOT_STARTED"; + default: + return "ERROR: Unknown ThreadReference status " + status; + } + } + + private static void check (String threadName, String check1, String check2) { + ThreadReference testedThread = (ThreadReference)debuggeeClass.getValue(debuggeeClass.fieldByName(threadName)); + int threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_RUNNING) { + display(check1 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_RUNNING for unsuspended " + threadName); + } else { + complain(check1 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus)+ " for unsuspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_RUNNING)); + exitStatus = Consts.TEST_FAILED; + } + + try { + testedThread.suspend(); + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_RUNNING) { + display(check2 + " PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_RUNNING for suspended " + threadName); + } else { + complain(check2 + " FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for suspended " + threadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_RUNNING)); + exitStatus = Consts.TEST_FAILED; + } + testedThread.resume(); + } catch (Exception e) { + complain(check2 + " FAILED"); + complain("\t Unexpected exception while calling ThreadReference.suspend for " + threadName + " : " + e); + exitStatus = Consts.TEST_FAILED; + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status007/status007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status007/status007a.java new file mode 100644 index 00000000000..f775f14d7ea --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status007/status007a.java @@ -0,0 +1,129 @@ +/* + * 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.ThreadReference.status.status007; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import java.util.*; + +/** + * The debugged application of the test. + */ +public class status007a { + + //------------------------------------------------------- immutable common fields + + private static int exitStatus; + private static Log log; + private static IOPipe pipe; + static ArgumentHandler argHandler; + + //------------------------------------------------------- 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 String testedThreadNames[] = {"threadRunning", "threadRunningNanos"}; + static status007aThreadRunning threadRunning; + static Wicket wicket = new Wicket(); + static volatile boolean shouldRun = true; + + //------------------------------------------------------ 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(status007.SIGNAL_READY); + + threadRunning = new status007aThreadRunning(testedThreadNames[0]); + threadRunning.start(); + wicket.waitFor(); + + pipe.println(status007.SIGNAL_GO); + receiveSignal(status007.SIGNAL_QUIT); + + shouldRun = false; + waitForFinish(threadRunning); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void waitForFinish (Thread thread) { + if (thread.isAlive()) { + try { + thread.join(argHandler.getWaitTime() * 60000); + display(thread.getName() + " is finished"); + } catch (InterruptedException e) { + throw new Failure("Unexpected InterruptedException while waiting for join of " + thread.getName()); + } + if (thread.isAlive()) { + throw new Failure(thread.getName() + " has not finished after " + argHandler.getWaitTime() + " mins"); + } + } + } + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes + +class status007aThreadRunning extends Thread { + status007aThreadRunning (String name) { + super(name); + } + + public void run () { + status007a.wicket.unlock(); + // do something + Vector v = new Vector(); + while (status007a.shouldRun) { + v.add("bla-"); + if (v.size() > 1000) { + v.removeAllElements(); + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status008/status008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status008/status008.java new file mode 100644 index 00000000000..bb5ba64623e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status008/status008.java @@ -0,0 +1,215 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/ThreadReference/status/status008. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for status() method of ThreadReference interface. + * The test checks if the method returns + * ThreadReference.THREAD_STATUS_UNKNOWN status for + * debuggee's thread when it has not been started yet. + * The test checks status of unsuspended and suspended thread. + * The test consists of a debugger program (status008.java) + * and debuggee application (status008a.java). + * Package name is nsk.jdi.ThreadReference.status. + * 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. + * The debuggee's create checked thread, but does not start it. + * After notification of readiness from debuggee, + * the debugger checks if ThreadReference.status() returns + * expected status for checked thread. Then the debugger + * suspends the checked thread and checks its status again. + * The test fails if status() method returned a status code + * other then expected THREAD_STATUS_UNKNOWN one. + * COMMENTS: + * Though JDI spec has THREAD_STATUS_NOT_STARTED status for unstarted + * threads, JDI implementation of status() method never returned this + * status code, but THREAD_STATUS_UNKNOWN one for unstarted threads. + * The 4490152 bug relates to this issue. The 4956818 bug states that + * JPDA interfaces should not return unstarted threads. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.status.status008.status008 + * nsk.jdi.ThreadReference.status.status008.status008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.status.status008.status008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.ThreadReference.status.status008; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class status008 { + + //------------------------------------------------------- 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.ThreadReference.status.status008."; + private final static String className = "status008"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String testedThreadName = prefix + "status008aThread"; + + //------------------------------------------------------- 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() { + ThreadReference testedThread = (ThreadReference)debuggeeClass.getValue(debuggeeClass.fieldByName(status008a.testedThreadName)); + int threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_UNKNOWN) { + display("CHECK1 PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_UNKNOWN for unsuspended " + status008a.testedThreadName); + } else { + complain("CHECK1 FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus)+ " for unsuspended " + status008a.testedThreadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_NOT_STARTED)); + exitStatus = Consts.TEST_FAILED; + } + + try { + testedThread.suspend(); + threadStatus = testedThread.status(); + if (threadStatus == ThreadReference.THREAD_STATUS_UNKNOWN) { + display("CHECK2 PASSED"); + display("\t ThreadReference.status() returned expected status THREAD_STATUS_UNKNOWN for suspended " + status008a.testedThreadName); + } else { + complain("CHECK2 FAILED"); + complain("\t ThreadReference.status() returned unexpected status " + + getThreadStatusName(threadStatus) + " for suspended " + status008a.testedThreadName); + complain("\t Expected status : " + getThreadStatusName(ThreadReference.THREAD_STATUS_NOT_STARTED)); + exitStatus = Consts.TEST_FAILED; + } + testedThread.resume(); + } catch (Exception e) { + complain("CHECK2 FAILED"); + complain("\t Unexpected exception while calling ThreadReference.suspend for " + status008a.testedThreadName + " : " + e); + exitStatus = Consts.TEST_FAILED; + } + + display("Checking completed!"); + } + + //--------------------------------------------------------- test specific methods + + private static String getThreadStatusName (int status) { + switch (status) { + case ThreadReference.THREAD_STATUS_UNKNOWN: + return "THREAD_STATUS_UNKNOWN"; + case ThreadReference.THREAD_STATUS_ZOMBIE: + return "THREAD_STATUS_ZOMBIE"; + case ThreadReference.THREAD_STATUS_RUNNING: + return "THREAD_STATUS_RUNNING"; + case ThreadReference.THREAD_STATUS_SLEEPING: + return "THREAD_STATUS_SLEEPING"; + case ThreadReference.THREAD_STATUS_MONITOR: + return "THREAD_STATUS_MONITOR"; + case ThreadReference.THREAD_STATUS_WAIT: + return "THREAD_STATUS_WAIT"; + case ThreadReference.THREAD_STATUS_NOT_STARTED: + return "THREAD_STATUS_NOT_STARTED"; + default: + return "ERROR: Unknown ThreadReference status " + status; + } + } +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status008/status008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status008/status008a.java new file mode 100644 index 00000000000..ac99fca86a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/status/status008/status008a.java @@ -0,0 +1,89 @@ +/* + * 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.ThreadReference.status.status008; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class status008a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static String testedThreadName = "unStartedThread"; + static Thread unStartedThread; + + //------------------------------------------------------ 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); + + unStartedThread = new Thread(testedThreadName); + + pipe.println(status008.SIGNAL_READY); + receiveSignal(status008.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific methods + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java new file mode 100644 index 00000000000..4b911b9c9d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java @@ -0,0 +1,302 @@ +/* + * 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.ThreadReference.stop; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.stop()
    + * complies with its spec.
    + *
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs the debugger of the thread2 creation,
    + * and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until getting Exception from the debugger.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets a ThreadReference thread2 mirroring the thread2 and
    + * an ObjectReference throwableObj mirroring a special Throwable object
    + * prepared by the main thread in the debuggee,
    + * (note: for identification, throwableObj.getMessage() returns
    + * the string "testException")
    + * and invokes thread2.stop(throwableObj) which should throw exception
    + * in the locked thread2 in the debugger.
    + * In catch subclouse, the thread2 assigns Exception it got to a special
    + * variable tObj of the Throwable type and ends its running.
    + * The main thread reads tObj.message(), compares to "testException",
    + * and informs the debugger of strings match or mismatch.
    + */ + +public class stop001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/stop/stop001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new stop001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.stop.stop001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.stop.Threadstop001a"; + + //String mName = "nsk.jdi.ThreadReference.stop"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "Thread2"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + ReferenceType mainthreadClass = null; + ObjectReference throwableObj = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + + label1: { + if (expresult != returnCode0) + break label1; + + + try { + log2(" getting a mirror of the throwableObj"); + throwableObj = (ObjectReference) + mainthreadClass.getValue(mainthreadClass.fieldByName("throwableObj")); + + log2(" stopping the thread2"); + thread2.stop(throwableObj); + + } catch ( InvalidTypeException e1 ) { + log3("ERROR: InvalidTypeException ???"); + expresult = returnCode1; + } catch ( Exception e2 ) { + log3("ERROR: unexpected exception: " + e2); + expresult = returnCode1; + } + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + + log2("......getting result from mainThread:"); + line = pipe.readln(); + log2(" returned string is: " + line); + if (line.equals("null")) { + log3("ERROR: 'stop001a.tObj = e1;' was not assigned"); + expresult = returnCode1; + } else if (line.equals("equal")) { + } else if (line.equals("NOT_equal")) { + log3("ERROR: in the debugee, e1 is not 'LineUnavailableException'"); + expresult = returnCode1; + } else { + log3("ERROR: returned string is unexpected"); + expresult = returnCode4; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java new file mode 100644 index 00000000000..4b305a50b4f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/ThreadReference/stop/stop001. + * VM Testbase keywords: [quick, jpda, jdi, quarantine] + * VM Testbase comments: JDK-7034630 + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.stop() + * complies with its spec: + * public void stop(ObjectReference throwable) + * throws InvalidTypeException + * Stops this thread with an asynchronous exception. + * A debugger thread in the target VM will stop this thread with the + * given Throwable object. + * Parameters: throwable - the asynchronous exception to throw. + * Throws: InvalidTypeException - + * if throwable is not an instance of java.lang.Throwable in + * the target VM. + * ObjectCollectedException - + * if this object or the asynchronous exception has been garbage collected. + * See Also: java.lang.Thread#stop(Throwable) + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.stop.stop001; + * the debuggee program - nsk.jdi.ThreadReference.stop.stop001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The test ws modified to fixe the bug: + * 4637894 TEST_BUG: stop001a does not check object against null + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.stop.stop001 + * nsk.jdi.ThreadReference.stop.stop001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.stop.stop001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001a.java new file mode 100644 index 00000000000..06ce56593e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001a.java @@ -0,0 +1,230 @@ +/* + * 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.ThreadReference.stop; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + + +/** + * This class is used as debuggee application for the stop001 JDI test. + * + * corrected 5/13/2001 + */ + +public class stop001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; +// static final int FAILED = 2; // see int FAILED below + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + public static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + private static Threadstop001a thread2 = null; + + public static String strException = "testException"; + + private static Throwable throwableObj = new Exception(strException); + public static Throwable tObj = null; + + public static int exitCode = PASSED; + public static final int FAILED = 2; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * com.sun.jdi.ThreadReference.stop()
    + * properly throws InvalidTypeException - if specified + * throwable is not an instance of java.lang.Throwable in the + * target VM.

    + * + * Debugger part of the test tries to stop debuggee thread + * through the JDI method using as a parameter an object + * reference of the main debuggee class stop002t itself + * which is not Throwable. + */ +public class stop002 { + static final String DEBUGGEE_CLASS = + "nsk.jdi.ThreadReference.stop.stop002t"; + + // names of debuggee main thread + static final String DEBUGGEE_THRNAME = "stop002tThr"; + + // debuggee local var used to find needed non-throwable object + static final String DEBUGGEE_LOCALVAR = "stop002tNonThrowable"; + // debuggee field used to indicate that testing is over + static final String DEBUGGEE_FIELD = "stopLooping"; + + // debuggee source line where it should be stopped + static final int DEBUGGEE_STOPATLINE = 69; + + static final int DELAY = 500; // in milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_GO = "go"; + static final String COMMAND_QUIT = "quit"; + + private ArgumentHandler argHandler; + private Log log; + private IOPipe pipe; + private Debugee debuggee; + private VirtualMachine vm; + private BreakpointRequest BPreq; + private volatile int tot_res = Consts.TEST_PASSED; + private volatile boolean gotEvent = false; + + public static void main (String argv[]) { + System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new stop002().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); + + debuggee = binder.bindToDebugee(DEBUGGEE_CLASS); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + debuggee.redirectStderr(log, "stop002t.err> "); + debuggee.resume(); + String cmd = pipe.readln(); + if (!cmd.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee command: " + cmd); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + ThreadReference thrRef = null; + if ((thrRef = + debuggee.threadByName(DEBUGGEE_THRNAME)) == null) { + log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread " + + DEBUGGEE_THRNAME); + tot_res = Consts.TEST_FAILED; + return quitDebuggee(); + } + + Field doExit = null; + ObjectReference objRef = null; + try { + // debuggee main class + ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS); + + suspendAtBP(rType, DEBUGGEE_STOPATLINE); + objRef = findObjRef(thrRef, DEBUGGEE_LOCALVAR); + + // this field is used to indicate that debuggee has to + // stop looping + doExit = rType.fieldByName(DEBUGGEE_FIELD); + + log.display("Resuming debuggee VM ..."); + vm.resume(); + log.display("Resumption of debuggee VM done"); + + log.display("\nTrying to stop debuggee thread \"" + thrRef + + "\"\n\tusing non-throwable object reference \"" + + objRef + "\" as a parameter ..."); + +// Check the tested assersion + try { + thrRef.stop(objRef); + log.complain("TEST FAILED: expected IllegalArgumentException was not thrown" + + "\n\twhen attempted to stop debuggee thread \"" + thrRef + + "\"\n\tusing non-throwable object reference \"" + + objRef + "\" as a parameter"); + tot_res = Consts.TEST_FAILED; + } catch(InvalidTypeException ee) { + log.display("CHECK PASSED: caught expected " + ee); + } catch(Exception ue) { + ue.printStackTrace(); + log.complain("TEST FAILED: ThreadReference.stop(): caught unexpected " + + ue + "\n\tinstead of InvalidTypeException" + + "\n\twhen attempted to stop debuggee thread \"" + thrRef + + "\"\n\tusing non-throwable object reference \"" + + objRef + "\" as a parameter"); + tot_res = Consts.TEST_FAILED; + } + + } catch (Exception e) { + e.printStackTrace(); + log.complain("TEST FAILURE: caught unexpected exception: " + e); + tot_res = Consts.TEST_FAILED; + } finally { +// Finish the test + // force an method to exit + if (objRef != null && doExit != null) { + try { + objRef.setValue(doExit, vm.mirrorOf(true)); + } catch(Exception sve) { + sve.printStackTrace(); + } + } + } + + return quitDebuggee(); + } + + private ObjectReference findObjRef(ThreadReference thrRef, String varName) { + try { + List frames = thrRef.frames(); + Iterator iter = frames.iterator(); + while (iter.hasNext()) { + StackFrame stackFr = (StackFrame) iter.next(); + try { + LocalVariable locVar = + stackFr.visibleVariableByName(varName); + // visible variable with the given name is found + if (locVar != null) { + return (ObjectReference) + stackFr.getValue(locVar); + } + } catch(AbsentInformationException e) { + // this is not needed stack frame, ignoring + } catch(NativeMethodException ne) { + // current method is native, also ignoring + } + } + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + throw new Failure("findObjRef: caught unexpected exception: " + e); + } + throw new Failure("findObjRef: needed debuggee stack frame not found"); + } + + private BreakpointRequest setBP(ReferenceType refType, int bpLine) { + EventRequestManager evReqMan = + debuggee.getEventRequestManager(); + Location loc; + + try { + List locations = refType.allLineLocations(); + Iterator iter = locations.iterator(); + while (iter.hasNext()) { + loc = (Location) iter.next(); + if (loc.lineNumber() == bpLine) { + BreakpointRequest BPreq = + evReqMan.createBreakpointRequest(loc); + log.display("created " + BPreq + "\n\tfor " + refType + + " ; line=" + bpLine); + return BPreq; + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Failure("setBP: caught unexpected exception: " + e); + } + throw new Failure("setBP: location corresponding debuggee source line " + + bpLine + " not found"); + } + + private void suspendAtBP(ReferenceType rType, int bpLine) { + + /** + * This is a class containing a critical section which may lead to time + * out of the test. + */ + class CriticalSection extends Thread { + public volatile boolean waitFor = true; + + public void run() { + try { + do { + EventSet eventSet = vm.eventQueue().remove(DELAY); + if (eventSet != null) { // it is not a timeout + EventIterator it = eventSet.eventIterator(); + while (it.hasNext()) { + Event event = it.nextEvent(); + if (event instanceof VMDisconnectEvent) { + log.complain("TEST FAILED: unexpected VMDisconnectEvent"); + break; + } else if (event instanceof VMDeathEvent) { + log.complain("TEST FAILED: unexpected VMDeathEvent"); + break; + } else if (event instanceof BreakpointEvent) { + if (event.request().equals(BPreq)) { + log.display("expected Breakpoint event occured: " + + event.toString()); + gotEvent = true; + return; + } + } else + log.display("following JDI event occured: " + + event.toString()); + } + } + } while(waitFor); + log.complain("TEST FAILED: no expected Breakpoint event"); + tot_res = Consts.TEST_FAILED; + } catch (Exception e) { + e.printStackTrace(); + tot_res = Consts.TEST_FAILED; + log.complain("TEST FAILED: caught unexpected exception: " + e); + } + } + } +///////////////////////////////////////////////////////////////////////////// + + BPreq = setBP(rType, bpLine); + BPreq.enable(); + CriticalSection critSect = new CriticalSection(); + log.display("\nStarting potential timed out section:\n\twaiting " + + (argHandler.getWaitTime()) + + " minute(s) for JDI Breakpoint event ...\n"); + critSect.start(); + pipe.println(COMMAND_GO); + try { + critSect.join((argHandler.getWaitTime())*60000); + if (critSect.isAlive()) { + critSect.waitFor = false; + throw new Failure("timeout occured while waiting for Breakpoint event"); + } + } catch (InterruptedException e) { + critSect.waitFor = false; + throw new Failure("TEST INCOMPLETE: InterruptedException occured while waiting for Breakpoint event"); + } finally { + BPreq.disable(); + } + log.display("\nPotential timed out section successfully passed\n"); + if (gotEvent == false) + throw new Failure("unable to suspend debuggee thread at breakpoint"); + } + + private int quitDebuggee() { + log.display("Final resumption of debuggee VM"); + vm.resume(); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + int debStat = debuggee.getStatus(); + if (debStat != (Consts.JCK_STATUS_BASE + Consts.TEST_PASSED)) { + log.complain("TEST FAILED: debuggee process finished with status: " + + debStat); + tot_res = Consts.TEST_FAILED; + } else + log.display("\nDebuggee process finished with the status: " + + debStat); + + return tot_res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002/TestDescription.java new file mode 100644 index 00000000000..35032e636f7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002/TestDescription.java @@ -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/ThreadReference/stop/stop002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks that the JDI method: + * com.sun.jdi.ThreadReference.stop() + * properly throws InvalidTypeException - if specified throwable + * is not an instance of java.lang.Throwable in the target VM. + * Debugger part of the test tries to stop debuggee thread + * through the JDI method using as a parameter an object + * reference of the main debuggee class stop002t itself + * which is not Throwable. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadReference.stop.stop002 + * nsk.jdi.ThreadReference.stop.stop002t + * + * @comment make sure stop002t is compiled with full debug info + * @clean nsk.jdi.ThreadReference.stop.stop002t + * @compile -g:lines,source,vars ../stop002t.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.stop.stop002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java new file mode 100644 index 00000000000..a3af4a17a9d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java @@ -0,0 +1,85 @@ +/* + * 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.ThreadReference.stop; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * This is a debuggee class. + */ +public class stop002t { + private Log log; + private IOPipe pipe; + volatile boolean stopLooping = false; + + public static void main(String args[]) { + System.exit(run(args) + Consts.JCK_STATUS_BASE); + } + + public static int run(String args[]) { + return new stop002t().runIt(args); + } + + private int runIt(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + + log = argHandler.createDebugeeLog(); + pipe = argHandler.createDebugeeIOPipe(); + + Thread.currentThread().setName(stop002.DEBUGGEE_THRNAME); + + // non-throwable object which will be used by debugger + // as wrong parameter of JDI method ThreadReference.stop() + stop002t stop002tNonThrowable = this; + + // Now the debuggee is ready for testing + pipe.println(stop002.COMMAND_READY); + String cmd = pipe.readln(); + if (cmd.equals(stop002.COMMAND_QUIT)) { + log.complain("Debuggee: exiting due to the command " + + cmd); + return Consts.TEST_PASSED; + } + + int stopMeHere = 0; // stop002.DEBUGGEE_STOPATLINE + + log.display("Debuggee: going to loop ..."); + while(!stopLooping) { // looping + stopMeHere++; stopMeHere--; + } + log.display("Debuggee: looping done"); + + cmd = pipe.readln(); + if (!cmd.equals(stop002.COMMAND_QUIT)) { + log.complain("TEST BUG: unknown debugger command: " + + cmd); + return Consts.TEST_FAILED; + } + return Consts.TEST_PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java new file mode 100644 index 00000000000..ff6038e7f8d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java @@ -0,0 +1,545 @@ +/* + * 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.ThreadReference.suspend; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.suspend()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since thread2 uses the same locking object in its 'run' method
    + * it is locked up until first thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * sets up breakpoints within thread2's methods and checks up that
    + * call to the method thread2.suspend() does suspend the thread2 when
    + * - the thread2 is not suspended and when
    + * - it is suspended at a breakpoint
    + * In both cases is expected that resuming the thread2 results in
    + * timeout for waiting for the thread2 gets stopping at a breakpoint.
    + */ + +public class suspend001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/suspend/suspend001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new suspend001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.suspend.suspend001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.suspend.Threadsuspend001a"; + + //String mName = "nsk.jdi.ThreadReference.suspend"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + + label1: { + if (expresult != returnCode0) + break label1; + + log2("......checking up that thread2.suspend() does suspend the non-suspended thread2"); + + log2(" suspending the thread2"); + thread2.suspend(); + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" checking up that the thread2 is not at breakpoint1 because of suspension"); + expresult = breakpoint(); + if (expresult != returnCode3) { + log3("ERROR: no timeout for waiting for BreakpointEvent when the thread2 is suspended"); + expresult = returnCode1; + break label1; + } else + expresult = returnCode0; + + + log2("......checking up that thread2.suspend() does suspend the suspended thread2"); + + log2(" resuming the thread2 with thread2.resume();"); + thread2.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + if (!thread2.isSuspended()) { + log3("ERROR: !thread2.isSuspended() at the breakpoint ???"); + expresult = returnCode1; + break label1; + } + + log2(" suspending the thread2"); + thread2.suspend(); + + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + + log2(" resuming the thread2 with eventSet.resume();"); + eventSet.resume(); + + log2(" checking up that the thread2 is not at breakpoint2 because of suspension"); + expresult = breakpoint(); + if (expresult != returnCode3) { + log3("ERROR: no timeout for waiting for BreakpointEvent when the thread2 is suspended"); + expresult = returnCode1; + break label1; + } else + expresult = returnCode0; + + log2(" resuming the thread2 with thread2.resume();"); + thread2.resume(); + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult == returnCode0) { + log2(" thread2 is at breakpoint"); + log2(" resuming the thread2 with eventSet.resume();"); + eventSet.resume(); + } else { + log3("ERROR: breakpoint was not reached"); + expresult = returnCode1; + break label1; + } + } + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove (waitTime*60000); + if (eventSet == null) { + log2(":::::: timeout when waiting for a BreakpintEvent"); +// log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001/TestDescription.java new file mode 100644 index 00000000000..41cb02c2ff6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/ThreadReference/suspend/suspend001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.suspend() + * complies with its spec: + * public void suspend() + * Suspends this thread. The thread can be resumed through resume() or + * resumed with other threads through VirtualMachine.resume(). + * Unlike java.lang.Thread#suspend, suspends of both the virtual machine and + * individual threads are counted. + * Before a thread will run again, it must be resumed (through resume() or + * resume()) the same number of times it has been suspended. + * Suspending single threads with this method has the same dangers as + * java.lang.Thread.suspend(). If the suspended thread holds a monitor + * needed by another running thread, deadlock is possible + * in the target VM (at least until the suspended thread is resumed again). + * The suspended thread is guaranteed to remain suspended until resumed + * through one of the JDI resume methods mentioned above; + * the application in the target VM cannot resume the suspended thread + * through java.lang.Thread#resume. + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.suspend.suspend001; + * the debuggee program - nsk.jdi.ThreadReference.suspend.suspend001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.suspend.suspend001 + * nsk.jdi.ThreadReference.suspend.suspend001a + * @run main/othervm/timeout=420 PropertyResolvingWrapper + * nsk.jdi.ThreadReference.suspend.suspend001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java new file mode 100644 index 00000000000..ee0712a25dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java @@ -0,0 +1,206 @@ +/* + * 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.ThreadReference.suspend; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the suspend001 JDI test. + */ + +public class suspend001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.suspendCount()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object in its 'run' method
    + * it is locked up until the debuggee leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * calls methods ThreadReference.suspend() and .resume(), and
    + * VirualMachine.suspend() and .resume() in a number of combinations,
    + * and checks up that each combination results in the expected value
    + * returned by the method suspendCount().
    + * At the end the debugger instructs the debuggee to unlock the thread2.
    + *
    + */ + +public class suspendcount001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/suspendCount/suspendcount001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new suspendcount001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.suspendCount.suspendcount001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.suspendCount.Threadsuspendcount001a"; + + //String mName = "nsk.jdi.ThreadReference.suspendCount"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + //String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + //String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + //BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + + int suspCount; + + log2(" check #1: the beginning: suspCount == 0 "); + suspCount = thread2.suspendCount(); + if (suspCount != 0) { + log3("ERROR: 1: suspCount != 0 : " + suspCount); + expresult = returnCode1; + } + + + log2(" suspending thread2 with: thread2.suspend(); "); + thread2.suspend(); + + log2(" check #2: suspCount == 1 "); + suspCount = thread2.suspendCount(); + if (suspCount != 1) { + log3("ERROR: 2: suspCount != 1 : " + suspCount); + expresult = returnCode1; + } + + + log2(" suspending thread2 with: thread2.suspend(); "); + thread2.suspend(); + + log2(" check #3: suspCount == 2 "); + suspCount = thread2.suspendCount(); + if (suspCount != 2) { + log3("ERROR: 3: suspCount != 2 : " + suspCount); + expresult = returnCode1;; + } + + + log2(" resuming thread2 with: thread2.resume(); "); + thread2.resume(); + + log2(" check #4: suspCount == 1 "); + suspCount = thread2.suspendCount(); + if (suspCount != 1) { + log3("ERROR: 4: suspCount != 1 : " + suspCount); + expresult = returnCode1; + } + + + log2(" resuming thread2 with: thread2.resume(); "); + thread2.resume(); + + log2(" check #5: suspCount == 0 "); + suspCount = thread2.suspendCount(); + if (suspCount != 0) { + log3("ERROR: 5: suspCount != 0 : " + suspCount); + expresult = returnCode1; + } + + + log2(" resuming NON-SUSPENDED thread2 with: thread2.resume(); "); + thread2.resume(); + + log2(" check #6: suspCount == 0 "); + suspCount = thread2.suspendCount(); + if (suspCount != 0) { + log3("ERROR: 6: suspCount != 0 : " + suspCount); + expresult = returnCode1; + } + + + log2(" suspending thread2 with: thread2.suspend(); "); + thread2.suspend(); + + log2(" check #7: suspCount == 1 "); + suspCount = thread2.suspendCount(); + if (suspCount != 1) { + log3("ERROR: 7: suspCount != 1 : " + suspCount); + expresult = returnCode1; + } + + + log2(" suspending VirtualMachine with vm.suspend(); "); + vm.suspend(); + + log2(" check #8: suspCount == 2 "); + suspCount = thread2.suspendCount(); + if (suspCount != 2) { + log3("ERROR: 8: suspCount != 2 : " + suspCount); + expresult = returnCode1; + } + + + log2(" 9: resuming only thread2 with double thread2.resume(); "); + thread2.resume(); + thread2.resume(); + + log2(" check #9: suspCount == 0 "); + suspCount = thread2.suspendCount(); + if (suspCount != 0) { + log3("ERROR: 9: suspCount != 0 : " + suspCount); + expresult = returnCode1; + } + + + log2(" 10: suspending VirtualMachine with double vm.suspend(); "); + vm.suspend(); + vm.suspend(); + + log2(" check #10: suspCount == 2 "); + suspCount = thread2.suspendCount(); + if (suspCount != 2) { + log3("ERROR: 10: suspCount != 2 : " + suspCount); + expresult = returnCode1; + } + + + log2(" 11: resuming with thread2.resume(); and vm.resume(); "); + thread2.resume(); + vm.resume(); + + log2(" check #11: suspCount == 0 "); + suspCount = thread2.suspendCount(); + if (suspCount != 0) { + log3("ERROR: 11: suspCount != 0 : " + suspCount); + expresult = returnCode1; + } + + vm.resume(); + vm.resume(); + + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ +/* + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } +*/ + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ +/* + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +*/ +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001/TestDescription.java new file mode 100644 index 00000000000..11501b939c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001/TestDescription.java @@ -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/ThreadReference/suspendCount/suspendcount001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.suspendCount() + * complies with its spec: + * public int suspendCount() + * Resumes the number of pending suspends for this thread. + * See suspend() for an explanation of counted suspends. + * Returns: the integer pending suspend count + * Throws: ObjectCollectedException - + * if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.suspendCount.suspendcount001; + * the debuggee program - nsk.jdi.ThreadReference.suspendCount.suspendcount001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.suspendCount.suspendcount001 + * nsk.jdi.ThreadReference.suspendCount.suspendcount001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.suspendCount.suspendcount001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java new file mode 100644 index 00000000000..62d9f146331 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java @@ -0,0 +1,208 @@ +/* + * 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.ThreadReference.suspendCount; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the suspendcount001 JDI test. + */ + +public class suspendcount001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * ThreadReference.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.ThreadReference.threadGroup()
    + * complies with its spec.
    + *
    + * The case for testing includes four ThreadGroup objects defined
    + * in a debuggee and their mirrors in a debugger.
    + * Parenthood relationships between the objects are as follows:
    + * threadGroups 2&3 are subgroups of threadGroup1
    + * threadGroup4 is a subgroup of threadGroup3
    + * The objects are created together with three threads, Thread 2,3,4,
    + * belonging to the corresponding subgroups.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates the threads,
    + * informs the debugger of the threads creation,
    + * and is waiting for reply.
    + * Since the threads use the same locking object in their 'run' methods
    + * they are locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee,
    + * the debugger gets mirrors of threadGroups and running threads,
    + * selects mirrors of Thread2,3,4, and checks up that :
    + * - object returned by Thread4.threadGroup(), is equal to threadGroup4;
    + * - object returned by Thread3.threadGroup(), is equal to threadGroup3;
    + * - object returned by Thread2.threadGroup(), is equal to threadGroup2.
    + */ + +public class threadgroup001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadReference/threadGroup/threadgroup001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new threadgroup001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadReference.threadGroup.threadgroup001a"; + + private String testedClassName = + "nsk.jdi.ThreadReference.threadGroup.Threadthreadgroup001a"; + + //String mName = "nsk.jdi.ThreadReference.threadGroup"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + List classes = null; + + ThreadGroupReference groups[] = { null, null, null, null }; + + String groupNames [] = { "threadGroup1Obj", + "threadGroup2Obj", + "threadGroup3Obj", + "threadGroup4Obj" }; + + List threads; + ListIterator iterator; + int flag; + String threadName; + ThreadReference thread; + + ThreadReference thread2 = null; + ThreadReference thread3 = null; + ThreadReference thread4 = null; + + String threadNames [] = { "Thread2", "Thread3", "Thread4" }; + + ReferenceType mainthreadClass = null; + ReferenceType thread2Class = null; + + label0: { + + log2("getting ThreadReference objects"); + try { + classes = vm.classesByName(testedClassName); + thread2Class = (ReferenceType) classes.get(0); + classes = vm.classesByName(debuggeeName); + mainthreadClass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + log2(" getting a List of all threadGroups"); + for (int i1 = 0; i1 < 4; i1++) { + groups[i1] = (ThreadGroupReference) + mainthreadClass.getValue(mainthreadClass.fieldByName(groupNames[i1])); + } + + log2(" getting a List of all running threads"); + threads = vm.allThreads(); + + + log2(" getting Thread 2,3,4 mirror objects"); + + iterator = threads.listIterator(); + for ( int i2 = 0; iterator.hasNext(); i2++ ) { + thread = (ThreadReference) iterator.next(); + threadName = thread.name(); + if (threadName.equals(threadNames[0])) + thread2 = thread; + else if (threadName.equals(threadNames[1])) + thread3 = thread; + else if (threadName.equals(threadNames[2])) + thread4 = thread; + } + + + log2("......checking up Thread2's group"); + if (!thread2.threadGroup().equals(groups[1])) { + log3("ERROR: !thread2.threadGroup.equals(groups[1])"); + expresult = 1; + } + + log2("......checking up Thread3's group"); + if (!thread3.threadGroup().equals(groups[2])) { + log3("ERROR: !thread3.threadGroup.equals(groups[2])"); + expresult = 1; + } + + + log2("......checking up Thread4's group"); + if (!thread4.threadGroup().equals(groups[3])) { + log3("ERROR: !thread4.threadGroup.equals(groups[3])"); + expresult = 1; + } + + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001/TestDescription.java new file mode 100644 index 00000000000..12a7d2291e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ThreadReference/threadGroup/threadgroup001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadReference. + * The test checks up that a result of the method + * com.sun.jdi.ThreadReference.threadGroup() + * complies with its spec: + * public ThreadGroupReference threadGroup() + * Returns this thread's thread group. + * Returns: a ThreadGroupReference that mirrors this thread's thread group + * in the target VM. + * Throws: ObjectCollectedException - if this object has been garbage collected. + * when a ThreadReference object has not been garbage collected, + * hence ObjectCollectedException is not expected to be thrown. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadReference.threadGroup.threadgroup001; + * the debuggee program - nsk.jdi.ThreadReference.threadGroup.threadgroup001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.ThreadReference.threadGroup.threadgroup001 + * nsk.jdi.ThreadReference.threadGroup.threadgroup001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadReference.threadGroup.threadgroup001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001a.java new file mode 100644 index 00000000000..e6faf0914e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001a.java @@ -0,0 +1,221 @@ +/* + * 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.ThreadReference.threadGroup; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the threadgroup001 JDI test. + */ + +public class threadgroup001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + public static final String mainthreadGroupName = "mainthreadGroup"; + public static final String threadGroup2Name = "threadGroup2"; + public static final String threadGroup3Name = "threadGroup3"; + public static final String threadGroup4Name = "threadGroup4"; + + public static ThreadGroup threadGroup1Obj = new ThreadGroup(mainthreadGroupName); + public static ThreadGroup threadGroup2Obj = new ThreadGroup(threadGroup1Obj, threadGroup2Name); + public static ThreadGroup threadGroup3Obj = new ThreadGroup(threadGroup1Obj, threadGroup3Name); + public static ThreadGroup threadGroup4Obj = new ThreadGroup(threadGroup3Obj, threadGroup4Name); + + private static Threadthreadgroup001a thread2 = null; + private static Threadthreadgroup001a thread3 = null; + private static Threadthreadgroup001a thread4 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // create event request and waits for events + try { + + log.display("Creating request for ThreadStartEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + if ((checkedRequest = erManager.createThreadStartRequest()) == null) { + log.complain("TEST BUG: unable to create createThreadStartRequest"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return thread001.FAILED; + } + checkedRequest.enable(); + + // start event handler + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // wait for all expected events handled or timeout exceeds + try { + eventHandler.join(eventTimeout); + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: interrupted exception while waiting for events: " + e); + testFailed = false; + } + + // interrupt events handler thread if not completed yet + if (eventHandler.isAlive()) { + log.display("Interrupting EventHandler"); + eventHandler.interrupt(); + } + + // check that all expected events received + if (eventsReceived) { + log.display("\nAll expected events received!"); + } else { + for (int i = 0; i < checkedThreads.length; i++) { + if (checkedThreads[i][1].equals("0")) { + log.complain("FAILURE 6: ThreadStartEvent was not received for thread: " + checkedThreads[i][0]); + } + } + testFailed = true; + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception caught: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + // disable event request to prevent appearance of further events + if (checkedRequest != null) { + log.display("Disabling event request"); + checkedRequest.disable(); + } + + // force debuggee to quit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // waiting for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminated"); + int exitCode = debuggee.endDebugee(); + if (exitCode != PASSED + JCK_STATUS_BASE) { + log.complain("Debuggee FAILED with exit code: " + exitCode); + testFailed = true; + } else { + log.display("Debuggee PASSED with exit code: " + exitCode); + } + } + + // exit + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } + + // handle events in a separate thread + static class EventHandler extends Thread { + public void run() { + log.display("EventHandler started"); + eventSet = null; + while (!eventsReceived) { + try { + eventSet = vm.eventQueue().remove(); + } catch (InterruptedException e) { + log.complain("Unexpected interrupted exception while receiving event: " + e); + testFailed = false; + break; + } + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + log.display("\nEvent received:\n " + event); + + if (event instanceof ThreadStartEvent) { + ThreadStartEvent castedEvent = (ThreadStartEvent)event; + log.display("Received event is ThreadStartEvent:\n " + castedEvent); + + EventRequest eventRequest = castedEvent.request(); + if (!(checkedRequest.equals(eventRequest))) { + log.complain("FAILURE 1: eventRequest is not equal to checked request"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + ThreadReference eventThread = castedEvent.thread(); + if (eventThread == null) { + log.complain("FAILURE 2: ThreadStartEvent.thread() returns null"); + testFailed = true; + } + + String threadName = eventThread.name(); + if ((threadName == null) || (threadName.equals(""))) { + log.complain("FAILURE 3: thread reference has invalid empty name"); + testFailed = true; + } else { + log.display ("Expected ThreadStartEvent was received for thread: " + threadName); + } + + // Check that thread is in VirtualMachine.allThreads() list + boolean found = false; + Iterator threadsList = debuggee.VM().allThreads().iterator(); + while (!found && threadsList.hasNext()) { + found = eventThread.equals((ThreadReference)threadsList.next()); + } + if (!found) { + log.complain("FAILURE 4: " + threadName + " is not in debuggee's allThreads() list"); + testFailed = true; + } + + // Check that all expected debuggee's thread create ThreadStartEvent only once + for (int i = 0; i < checkedThreads.length; i++) { + if (threadName.equals(checkedThreads[i][0])) { + if (checkedThreads[i][1].equals("0")) { + checkedThreads[i][1] = "1"; + } else { + log.complain("FAILURE 5: ThreadStartEvent for " + threadName + " is received more that once"); + testFailed = true; + } + } + } + + // Check whether all expected events received + if (!eventsReceived) { + for (int i = 0; i < checkedThreads.length; i++) { + if (checkedThreads[i][1] == "0") { + eventsReceived = false; + break; + } + eventsReceived = true; + } + } + } + // ignore all other events + } + eventSet.resume(); + } + log.display("EventHandler completed"); + } /* run() */ + } /* EventHandler */ + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..d93c62d33bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001/TestDescription.java @@ -0,0 +1,98 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/ThreadStartEvent/thread/thread001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.ThreadStartEvent.thread() method. + * The test checks the following assertions: + * - ThreadStartEvent is always received by debugger + * for all started threads in target VM, + * - ThreadStartEvent.thread() returns valid ThreadReference + * to expected thread in target VM, + * - ThreadStartEvent is received only once for each expected thread + * A debugger class - nsk.jdi.ThreadStartEvent.thread.thread001 ; + * a debuggee class - nsk.jdi.ThreadStartEvent.thread.thread001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates and enables ThreadStartRequest. + * The debuggee creates two auxiliary checked threads: , . + * Before starting threads, debuggee's main thread locks special + * synchronized object to prevent auxiliary threads from finishing + * before test checks performed. + * The debugger starts special thread for listening events + * received from debuggee, and resumes debuggee.The expects + * ThreadStartEvent for each debuggee threads, including main thread, and + * marks that thread in array. + * For each received ThreadStartEvent it is verified to refer to the + * right request, VM, thread references. + * Debugger waits for receives all expected events + * for WAITTIME timeout. If not all events have been received, + * debugger complains about an error. + * Finally, debugger disables event request, cleans events queue, + * sends debuggee command , waits for debuggee terminated, + * and exits. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bugs: + * 4455653 VMDisconnectedException on resume + * 4463674 TEST_BUG: some JDI tests are timing dependent + * ------------------------------------------------------------- + * Modified to fix the bug 4501953, + * the file thread001a.java is modified as follows. + * - A special waitnotify Object is added in the class thread001a. + * - In classes InnerThread and OuterThread, + * synchronized blocks are added + * to make newly created thread certainly to run. + * - In the class thread001a, + * the pervious mechanizm of waiting for predefined time + * is replaced with new one based on wait-notify. + * ------------------------------------------------------------- + * 4434432 TEST_BUG: ThreadStartEvent does not received on Linux + * ------------------------------------------------------------- + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadStartEvent.thread.thread001 + * nsk.jdi.ThreadStartEvent.thread.thread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadStartEvent.thread.thread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001a.java new file mode 100644 index 00000000000..03210618001 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartEvent/thread/thread001a.java @@ -0,0 +1,120 @@ +/* + * 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.ThreadStartEvent.thread; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class thread001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int THREADS_COUNT = 2; + + public static Log log; + + public static Object lock = new Object(); + public static Object waitnotify = new Object(); + + private static Thread threads[] = new Thread[THREADS_COUNT]; + + public static void main(String args[]) { + thread001a _thread001a = new thread001a(); + System.exit(JCK_STATUS_BASE + _thread001a.runIt(args, System.err)); + } + + int runIt(String args[], PrintStream out) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // creating threads + threads[0] = new thread001aThread("Thread1"); + threads[1] = new thread001aThread("Thread2"); + threads[1].setDaemon(true); + + // lock monitor to prevent threads from finishing after they started + synchronized (lock) { + + synchronized (waitnotify) { + // start all threads + for (int i = 0; i < THREADS_COUNT; i++) { + threads[i].start(); + try { + waitnotify.wait(); + } catch ( Exception e ) { + System.err.println("TEST INCOMPLETE: caught InterruptedException while sleeping"); + pipe.println("ERROR"); + return FAILED; + } + } + } + + // waiting for command to finish threads and exit + String command = pipe.readln(); + if (command.equals(thread001.COMMAND_QUIT)) { + System.err.println("'quit' received"); + } else { + System.err.println("TEST BUG: Unexpected debugger's command: " + command); + return FAILED; + } + } + + for (int i = 0; i < THREADS_COUNT; i++) { + if (threads[i].isAlive()) { + try { + threads[i].join(); + } catch (InterruptedException e ) { + System.err.println("TEST INCOMPLETE: caught InterruptedException while waiting for aux thread join"); + pipe.println("ERROR"); + } + } + } + System.err.println("Debuggee exited"); + return PASSED; + } +} + +class thread001aThread extends Thread { + thread001aThread (String name) { + super(name); + } + public void run() { + System.err.println("Thread started: " + this.getName()); + + synchronized (thread001a.waitnotify) { + thread001a.waitnotify.notify(); + } + // prevent thread for early finish + synchronized (thread001a.lock) { + } + System.err.println("Thread completed: "+ this.getName()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001.java new file mode 100644 index 00000000000..73cc0c527f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001.java @@ -0,0 +1,491 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadStartRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadStartRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks that the method restricts the events
    + * genereted by this request to those in the thread to filter.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger creates three ThreadStartRequests with
    + * addThreadFilter(debuggee's thread2) invoked only on third Request,
    + * resumes the debuggee and waits for the ThreadStartEvent.
    + * - Debuggee's main thread creates and starts new thread, thread2, and
    + * invokes the methodForCommunication
    + * to inform the debugger with the event.
    + * - Upon getting ThreadStartEvent, the debugger checks
    + * if EventSet contains all three events; if no, the test FAILED.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggee's variable "instruction".
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class addthreadfilter001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + ThreadReference testThread = (ThreadReference) + debuggeeClass.getValue(debuggeeClass.fieldByName("thread2")); + + log1(" TESTING BEGINS"); + + log2("......setting up ThreadStartRequest"); + ThreadStartRequest tsr1 = eventRManager.createThreadStartRequest(); +// tsr1.addThreadFilter(testThread); + tsr1.addCountFilter(1); + tsr1.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr1.putProperty("number", "ThreadStartRequest1"); + tsr1.enable(); + + ThreadStartRequest tsr2 = eventRManager.createThreadStartRequest(); +// tsr2.addThreadFilter(testThread); + tsr2.addCountFilter(1); + tsr2.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr2.putProperty("number", "ThreadStartRequest2"); + tsr2.enable(); + + ThreadStartRequest tsr3 = eventRManager.createThreadStartRequest(); + tsr3.addThreadFilter(testThread); + tsr3.addCountFilter(1); + tsr3.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr3.putProperty("number", "ThreadStartRequest3"); + tsr3.enable(); + + log2("......vm.resume();"); + vm.resume(); + + log2("......waiting for ThreadStartEvent"); + getEventSet(); + EventSet eventSet1 = eventSet; + if ( !(eventIterator.nextEvent() instanceof ThreadStartEvent) ) { + testExitCode = FAILED; + log3("ERROR: new event is not ThreadStartEvent"); + return; + } + tsr1.disable(); + tsr2.disable(); + tsr3.disable(); + + int setSize = eventSet1.size(); + log2("......eventSet1.size() == " + setSize); + if (setSize != 3) { + log3("ERROR: eventSet1.size() != 3 :: " + setSize); + testExitCode = FAILED; + + EventIterator evI1 = eventSet1.eventIterator(); + while (evI1.hasNext()) { + Event ev1 = evI1.nextEvent(); + log2("........event property : " + ev1.request().getProperty("number")); + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001/TestDescription.java new file mode 100644 index 00000000000..e49cb619f1f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/ThreadStartRequest/addThreadFilter/addthreadfilter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadStartRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadStartRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks that the method restricts the events genereted by + * this request to those in a thread to filter which is not main. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter001; + * the debuggee program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadStartRequest.addThreadFilter.addthreadfilter001 + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001a.java new file mode 100644 index 00000000000..0fa9c7dfedd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001a.java @@ -0,0 +1,161 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter001 JDI test. + */ + +public class addthreadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread2addthreadfilter001a thread2 = null; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread2 = new Thread2addthreadfilter001a("thread2"); + methodForCommunication(); + + threadStart(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + static Object lockingObject = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static class Thread2addthreadfilter001a extends Thread { + + String tName = null; + + public Thread2addthreadfilter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log3(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log3(" 'run': exit :: threadName == " + tName); + return; + } + } + + + private static void log3(String str) { + log1(Thread.currentThread().getName() + " : " + str); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002.java new file mode 100644 index 00000000000..76b2dbe93b0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002.java @@ -0,0 +1,490 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadStartRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadStartRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The cases to check are as follows: + * (1) if this request is currently enabled,
    + * - addThreadFilter(ThreadReference) results in throwing
    + * InvalidRequestStateException;
    + * - addThreadFilter(null) results in throwing
    + * NullPointerException or InvalidRequestStateException;
    + * (2) if this request is currently disabled,
    + * addThreadFilter(null) results in throwing
    + * NullPointerException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase, the debugger creates ThreadStartRequest
    + * and performs the above checks.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class addthreadfilter002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + ThreadReference mainThread = threadByName("main"); + + bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......setting up ThreadStartRequest"); + log2("...... ThreadStartRequest tsr1 = eventRManager.createThreadStartRequest();"); + ThreadStartRequest tsr1 = eventRManager.createThreadStartRequest(); + tsr1.addCountFilter(1); + tsr1.setSuspendPolicy(EventRequest.SUSPEND_ALL); + tsr1.putProperty("number", "ThreadStartRequest1"); + + log2("...... tsr1.enable();"); + tsr1.enable(); + + try { + log2("...... tsr1.addThreadFilter(mainThread);"); + log2(" InvalidRequestStateException is expected"); + tsr1.addThreadFilter(mainThread); + log3("ERROR: no InvalidRequestStateException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } catch ( Exception e ) { + log3("ERROR: unexpected Exception : " + e); + testExitCode = FAILED; + } + try { + log2("...... tsr1.addThreadFilter(null);"); + log2(" NullPointerException or InvalidRequestStateException is expected"); + tsr1.addThreadFilter(null); + log3("ERROR: no Exception thrown"); + testExitCode = FAILED; + } catch ( NullPointerException e ) { + log2(" NullPointerException"); + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } catch ( Exception e ) { + log3("ERROR: unexpected Exception : " + e); + testExitCode = FAILED; + } + + log2("...... tsr1.disable()"); + tsr1.disable(); + + try { + log2("...... tsr1.addThreadFilter(null);"); + log2(" NullPointerException is expected"); + tsr1.addThreadFilter(null); + log3("ERROR: no NullPointerException "); + testExitCode = FAILED; + } catch ( NullPointerException e ) { + log2(" NullPointerException"); + } catch ( Exception e ) { + log3("ERROR: unexpected Exception : " + e); + testExitCode = FAILED; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002/TestDescription.java new file mode 100644 index 00000000000..1dc5560a460 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/ThreadStartRequest/addThreadFilter/addthreadfilter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadStartRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadStartRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks that "if this request is currently enabled" + * calling the method results in throwing InvalidRequestStateException. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter002; + * the debuggee program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadStartRequest.addThreadFilter.addthreadfilter002 + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002a.java new file mode 100644 index 00000000000..d903cc9be22 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002a.java @@ -0,0 +1,113 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter002 JDI test. + */ + +public class addthreadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003.java new file mode 100644 index 00000000000..dd0710a7c75 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003.java @@ -0,0 +1,528 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadStartRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.ThreadStartRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ThreadStartRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + * + + */ + +public class addthreadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter003a"; + + private String testedClassName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.TestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ThreadStartRequest1"; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ThreadStartRequest (null, + EventRequest.SUSPEND_NONE, "ThreadStartRequest1"); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ThreadStartRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((ThreadStartRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ThreadStartRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadStartRequest setting2ThreadStartRequest( ThreadReference thread, + int suspendPolicy, + String property) + throws JDITestRuntimeException { + try { + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + if (thread != null) + tsr.addThreadFilter(thread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingThreadStartRequest() : " + e); + log3(" ThreadStartRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadStartRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003/TestDescription.java new file mode 100644 index 00000000000..95b7952b7db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003/TestDescription.java @@ -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/ThreadStartRequest/addThreadFilter/addthreadfilter003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadStartRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadStartRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter003; + * the debuggee program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadStartRequest.addThreadFilter.addthreadfilter003 + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003a.java new file mode 100644 index 00000000000..80dd6ded8b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003a.java @@ -0,0 +1,185 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter003 JDI test. + */ + +public class addthreadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter003a thread1 = null; + + static TestClass objTC = new TestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter003a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter003a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter003a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004.java new file mode 100644 index 00000000000..bb744b3208f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004.java @@ -0,0 +1,183 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * ThreadStartRequest. + * + * The test checks that results of the method + * com.sun.jdi.ThreadStartRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same ThreadStartRequest object. + * There are two ThreadStartRequests to check as follows: + * (1) For ThreadStartRequest2, both invocations are with different + * ThreadReferences restricting one ThreadStart event to two threads. + * The test expects no ThreadStart event will be received. + * (2) For ThreadStartRequest1, both invocations are with the same + * ThreadReference restricting one ThreadStart event to one thread. + * The test expects this ThreadStart event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up ThreadStartRequests 1&2 within the method + * in the class addthreadfilter004aTestClass which will be calling by both threads, + * - restricts the ThreadStartRequest1 only to thread1, + * - restricts the ThreadStartRequest2 only to thread2, + * - resumes debuggee's main thread, and + * - waits for the requested events for both threads. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class addthreadfilter004 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004a"; + return new addthreadfilter004().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004aTestClass"; + + protected void testRun() { + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ThreadStartRequest1"; + String property2 = "ThreadStartRequest2"; + + ReferenceType testClassReference = null; + + boolean thread1EventReceived = false; + boolean thread2EventReceived = false; + boolean bpEventReceived = false; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2ThreadStartRequest (thread1, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2ThreadStartRequest (thread1, + EventRequest.SUSPEND_ALL, property2); + + ((ThreadStartRequest) eventRequest1).addThreadFilter(thread1); + ((ThreadStartRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for ThreadStartEvent in tested thread"); + Event newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ThreadStartEvent)) { + setFailedStatus("ERROR: new event is not ThreadStartEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ThreadStartEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + EventRequest newEventRequest = newEvent.request(); + if (!newEventRequest.equals(eventRequest1) ) { + setFailedStatus("The ThreadStartEvent occured not for eventRequest1"); + } + + ThreadReference thr = ((ThreadStartEvent)newEvent).thread(); + if (!thr.equals(thread1)) { + setFailedStatus("The ThreadStartEvent occured in unexpected thread: " + thr); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ThreadStartRequest setting2ThreadStartRequest( ThreadReference thread, + int suspendPolicy, + String property) { + try { + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + if (thread != null) + tsr.addThreadFilter(thread); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ThreadStartRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004/TestDescription.java new file mode 100644 index 00000000000..f290090c88d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/ThreadStartRequest/addThreadFilter/addthreadfilter004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadStartRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadStartRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same ThreadStartRequest object. + * There are two ThreadStartRequests to check as follows: + * (1) For ThreadStartRequest2, both invocations are with different + * ThreadReferences restricting one ThreadStart event to two threads. + * The test expects no ThreadStart event will be received. + * (2) For ThreadStartRequest1, both invocations are with the same + * ThreadReference restricting one ThreadStart event to one thread. + * The test expects this ThreadStart event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004; + * the debuggee program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004 + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004a.java new file mode 100644 index 00000000000..9dd95703d21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004a.java @@ -0,0 +1,198 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter004 JDI test. + */ + +public class addthreadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter004a thread1 = null; + static Threadaddthreadfilter004a thread2 = null; + + static addthreadfilter004aTestClass objTC = new addthreadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter004a("thread1"); + thread2 = new Threadaddthreadfilter004a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005.java new file mode 100644 index 00000000000..2dc413b36f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005.java @@ -0,0 +1,535 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * ThreadStartRequest.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates ThreadStartRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates ThreadStartRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates ThreadStartRequest3, waits the thread1 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + * + + */ + +public class addthreadfilter005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter005a"; + + private String testedClassName = + "nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter005aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + + String thread1Name = "thread1"; + + String property1 = "ThreadStartRequest1"; + String property2 = "ThreadStartRequest2"; + String property3 = "ThreadStartRequest3"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ThreadStartRequest (null, + EventRequest.SUSPEND_NONE, property1); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ThreadStartRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2ThreadStartRequest (null, + EventRequest.SUSPEND_NONE, property2); + + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ThreadStartRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2ThreadStartRequest (null, + EventRequest.SUSPEND_NONE, property3); + + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ThreadStartRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ThreadStartRequest setting2ThreadStartRequest( ThreadReference thread, + int suspendPolicy, + String property) + throws JDITestRuntimeException { + try { + ThreadStartRequest tsr = eventRManager.createThreadStartRequest(); + if (thread != null) + tsr.addThreadFilter(thread); + tsr.addCountFilter(1); + tsr.setSuspendPolicy(suspendPolicy); + tsr.putProperty("number", property); + return tsr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingThreadStartRequest() : " + e); + log3(" ThreadStartRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ThreadStartRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005/TestDescription.java new file mode 100644 index 00000000000..d44191cd679 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/ThreadStartRequest/addThreadFilter/addthreadfilter005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * ThreadStartRequest. + * The test checks up that a result of the method + * com.sun.jdi.ThreadStartRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The test works as follows: + * The debugger program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter005; + * the debuggee program - nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.ThreadStartRequest.addThreadFilter.addthreadfilter005 + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.ThreadStartRequest.addThreadFilter.addthreadfilter005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005a.java new file mode 100644 index 00000000000..160caab47d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005a.java @@ -0,0 +1,198 @@ +/* + * 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.ThreadStartRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addaddthreadfilter005 JDI test. + */ + +public class addthreadfilter005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter005a thread1 = null; + + static addthreadfilter005aTestClass objTC = new addthreadfilter005aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter005a("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter005a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter005a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class addthreadfilter005aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Transport/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Transport/name/name001.java new file mode 100644 index 00000000000..6d129e722ca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Transport/name/name001.java @@ -0,0 +1,88 @@ +/* + * 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.Transport.name; + +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.Transport; + + +/** + * The test for the implementation of an object of the type Transport
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.connect.Transport.name()
    + * complies with its specification:
    + * "Returns a short identifier for the transport."
    + *
    + * In case of the method returns string
    + * beginning with another prefix,
    + * the test produces the return value 97 and
    + * a corresponding error message.
    + * Otherwise, the test is passed and produces
    + * the return value 95 and no message.
    + */ + + +public class name001 { + + 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; + + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + + for (Connector connector : vmm.allConnectors()) { + String sName = connector.transport().name(); + + out.println("Transport name: " + sName); + + if (sName == null || sName == "") { + exitCode = exitCode2; + out.println("Transport name is empty"); + } + } + + if (exitCode != exitCode0) + out.println("TEST FAILED"); + + return exitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Transport/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Transport/name/name001/TestDescription.java new file mode 100644 index 00000000000..721f671c406 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Transport/name/name001/TestDescription.java @@ -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/Transport/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Connector.Transport. + * The test checks up that a result of the method + * com.sun.jdi.connect.Connector.Transport.name() + * complies with its specification: + * public java.lang.String name() + * Returns a short identifier for the transport. + * Transport implementors should follow similar naming conventions as are + * used with packages to avoid name collisions. For example, the Sun transport + * implementations have names prefixed with "com.sun.jdi.". + * Returns: the name of this transport. + * Note. The name of this transport is either "dt_socket" or "dt_shmem" + * as it is defined in the document "Connection and Invocation Details". + * The test works as follows: + * - Virtual Machine Manager is invoked. + * - To Transport objects of Connectors + * the following check is applied: + * String returned by tTransport.name() should be + * either "dt_socket" or "dt_shmem" + * 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: + * Fixed 6265221. Transport.name() only checked for emptiness. Former behavior is unspecified and incorrect. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Transport.name.name001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Transport.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001.java new file mode 100644 index 00000000000..66f47634a30 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001.java @@ -0,0 +1,232 @@ +/* + * 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.Type.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class hashcode001 { + + //------------------------------------------------------- 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.Type.hashCode."; + private final static String className = "hashcode001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + private final static String[] checkedFields = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + "s0", "s1", "s2", + "o0", "o1", "o2" + }; + + private final static String[] checkedMethods = { + "Mv", "MvS", "MvI", + "MvY", "MvU", "MvR", + "MvP", "MvN", + "Mz", "Mb", "Mc", + "Md", "Mf", "Mi", + "Ml", "Mr", "Ms", "Mo" + }; + + //------------------------------------------------------- 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() { + + display("Checking hashCode() method for Type mirrors of debuggee's fields"); + + for (int i = 0; i < checkedFields.length; i++) { + checkHashCodeForField(i); + } + + display("Checking hashCode() method for Type mirrors of debuggee's void methods"); + + for (int i = 0; i < checkedMethods.length; i++) { + checkHashCodeForMethod(i); + } + + display("Checking completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + + private static void checkHashCodeForField (int ind) { + Type type; + try { + type = (Type)debuggeeClass.fieldByName(checkedFields[ind]).type(); + } catch (ClassNotLoadedException e) { + throw new Failure("Unexpected ClassNotLoadedException was thrown while first getting Type " + + "mirror for field : " + checkedFields[ind]); + } + int hCode = type.hashCode(); + + if (hCode == 0) { + complain("hashCode() returns 0 for debuggee's field : " + checkedFields[ind] ); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = type.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for debuggee's field : " + checkedFields[ind] + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + // get new reference to the same debuggee's field and get hash code. + try { + type = (Type)debuggeeClass.fieldByName(checkedFields[ind]).type(); + } catch (ClassNotLoadedException e) { + throw new Failure("Unexpected ClassNotLoadedException was thrown while second getting Type " + + "mirror for field : " + checkedFields[ind]); + } + hCode1 = type.hashCode(); + if (hCode != hCode1) { + complain("hashCode() does not return same value for equal mirror of debuggee's field : " + checkedFields[ind] + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns for debuggee's field : " + checkedFields[ind] + " : " + hCode); + } + + private static void checkHashCodeForMethod (int ind) { + Type type; + try { + type = (Type)methodByName(debuggeeClass, checkedMethods[ind]).returnType(); + } catch (ClassNotLoadedException e) { + throw new Failure("Unexpected ClassNotLoadedException was thrown while first getting Type " + + "mirror for method : " + checkedMethods[ind]); + } + int hCode = type.hashCode(); + + if (hCode == 0) { + complain("hashCode() returns 0 for debuggee's method : " + checkedMethods[ind] ); + exitStatus = Consts.TEST_FAILED; + } + + int hCode1 = type.hashCode(); + if (hCode != hCode1) { + complain("hashCode() is not consistent for debuggee's method : " + checkedMethods[ind] + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + // get new reference to the same debuggee's method and get hash code. + try { + type = (Type)methodByName(debuggeeClass, checkedMethods[ind]).returnType(); + } catch (ClassNotLoadedException e) { + throw new Failure("Unexpected ClassNotLoadedException was thrown while second getting Type " + + "mirror for method : " + checkedMethods[ind]); + } + hCode1 = type.hashCode(); + if (hCode != hCode1) { + complain("hashCode() does not return same value for equal mirror of debuggee's method : " + checkedMethods[ind] + + "\n\t first value :" + hCode + " ; second value : " + hCode1); + exitStatus = Consts.TEST_FAILED; + } + + display("hashCode() returns for debuggee's method : " + checkedMethods[ind] + " : " + hCode); + } + + private static Method methodByName(ReferenceType refType, String methodName) { + List methodList = refType.methodsByName(methodName); + if (methodList == null) return null; + + Method method = (Method) methodList.get(0); + return method; + } + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001/TestDescription.java new file mode 100644 index 00000000000..c8de097eba5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/Type/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public hashCode() method of an implementing class of + * com.sun.jdi.Type interface. + * The test checks an assertion cited from spec for hashCode() method of + * java.lang.Object class: + * The general contract of hashCode is: + * - Whenever it is invoked on the same object more than once during + * an execution of a Java application, the hashCode method must + * consistently return the same integer, provided no information used + * in equals comparisons on the object is modified. + * ... + * - If two objects are equal according to the equals(Object) method, + * then calling the hashCode method on each of the two objects must + * produce the same integer result. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for Type + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.Type.hashCode.hashcode001 + * nsk.jdi.Type.hashCode.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.hashCode.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001a.java new file mode 100644 index 00000000000..c52ca9821c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/hashCode/hashcode001a.java @@ -0,0 +1,121 @@ +/* + * 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.Type.hashCode; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class hashcode001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + static boolean z0 = true, z1[] = {z0}, z2[][] = {z1}; + static byte b0 = 0, b1[] = {b0}, b2[][] = {b1}; + static char c0 = '0', c1[] = {c0}, c2[][] = {c1}; + static double d0 = 0.0d, d1[] = {d0}, d2[][] = {d1}; + static float f0 = 0.0f, f1[] = {f0}, f2[][] = {f1}; + static int i0 = 0, i1[] = {i0}, i2[][] = {i1}; + static long l0 = 0, l1[] = {l0}, l2[][] = {l1}; + static short r0 = 0, r1[] = {r0}, r2[][] = {r1}; + + static String s0 = "0", s1[] = {s0}, s2[][] = {s1}; + static Object o0 = new Object(), o1[] = {o0}, o2[][] = {o1}; + + //------------------------------------------------------ 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); + try { + pipe.println(hashcode001.SIGNAL_READY); + receiveSignal(hashcode001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + + void Mv() {}; + + static void MvS() {}; + strictfp void MvI() {}; + synchronized void MvY() {}; + public void MvU() {}; + protected void MvR() {}; + private void MvP() {}; + native void MvN(); + + boolean Mz () { return true; }; + byte Mb () { return (byte)0; }; + char Mc () { return '0'; }; + double Md () { return 0.0d; }; + float Mf () { return 0.0f; }; + int Mi () { return 0; }; + long Ml () { return (long)0; }; + short Mr () { return (short)0; }; + + String Ms () { return "0"; }; + Object Mo () { return new Object(); }; + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001.java new file mode 100644 index 00000000000..18aa4a20782 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001.java @@ -0,0 +1,307 @@ +/* + * 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.Type.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * Type.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Type.name()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee executes the following :
    + * static boolean bl = false;
    + * static byte bt = 0;
    + * static char ch = 0;
    + * static double db = 0.0d;
    + * static float fl = 0.0f;
    + * static int in = 0;
    + * static long ln = 0;
    + * static short sh = 0;
    + *
    + * for all of the above primitive type variables,
    + * a debugger forms their corresponding Type objects
    + * from which it forms text representations of
    + * original types in the debuggee in String variables
    + * named blName, btName, and etc.
    + *
    + * Then the debugger checks up that
    + * the each of the following is true :
    + *
    + * blName.equals("boolean")
    + * btName.equals("byte")
    + * chName.equals("char")
    + * dbName.equals("double")
    + * flName.equals("float")
    + * inName.equals("int")
    + * lnName.equals("long")
    + * shName.equals("short")
    + *
    + */ + +public class name001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Type/name/name001", + sHeader2 = "--> name001: ", + sHeader3 = "##> name001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Type.name.name001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("name001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl = execClass.fieldByName("bl"); + Field fsbt = execClass.fieldByName("bt"); + Field fsch = execClass.fieldByName("ch"); + Field fsdb = execClass.fieldByName("db"); + Field fsfl = execClass.fieldByName("fl"); + Field fsin = execClass.fieldByName("in"); + Field fsln = execClass.fieldByName("ln"); + Field fssh = execClass.fieldByName("sh"); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean + String blName = execClass.getValue(fsbl).type().name(); + if (!blName.equals("boolean")) { + expresult = 1; + log3("ERROR: !blName.equals('boolean')"); + } + break; + + case 1: // byte + String btName = execClass.getValue(fsbt).type().name(); + if (!btName.equals("byte")) { + expresult = 1; + log3("ERROR: !btName.equals('byte')"); + } + break; + + case 2: // char + String chName = execClass.getValue(fsch).type().name(); + if (!chName.equals("char")) { + expresult = 1; + log3("ERROR: !chName.equals('char')"); + } + break; + + case 3: // double + String dbName = execClass.getValue(fsdb).type().name(); + if (!dbName.equals("double")) { + expresult = 1; + log3("ERROR: !dbName.equals('double')"); + } + break; + + case 4: // float + String flName = execClass.getValue(fsfl).type().name(); + if (!flName.equals("float")) { + expresult = 1; + log3("ERROR: !flName.equals('float')"); + } + break; + + case 5: // int + String inName = execClass.getValue(fsin).type().name(); + if (!inName.equals("int")) { + expresult = 1; + log3("ERROR: !inName.equals('int')"); + } + break; + + case 6: // long + String lnName = execClass.getValue(fsln).type().name(); + if (!lnName.equals("long")) { + expresult = 1; + log3("ERROR: !lnName.equals('long')"); + } + break; + + case 7: // short + String shName = execClass.getValue(fssh).type().name(); + if (!shName.equals("short")) { + expresult = 1; + log3("ERROR: !shName.equals('short')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001/TestDescription.java new file mode 100644 index 00000000000..9c47a8c3adb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001/TestDescription.java @@ -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/Type/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Type. + * The test checks up that a result of the method + * com.sun.jdi.Type.name() + * complies with its spec: + * public java.lang.String name() + * Returns: a text representation of this type. + * when the type is one of primitive types. + * The test works as follows: + * A debugger program - nsk.jdi.Type.name.name001; + * a debuggee program - nsk.jdi.Type.name.name001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Type.name.name001 + * nsk.jdi.Type.name.name001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001a.java new file mode 100644 index 00000000000..3b24a0185ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name001a.java @@ -0,0 +1,122 @@ +/* + * 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.Type.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name001a JDI test. + */ + +public class name001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> name001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> name001a: " + message); + } + + //====================================================== test program + + static boolean bl = false; + static byte bt = 0; + static char ch = 0; + static double db = 0.0d; + static float fl = 0.0f; + static int in = 0; + static long ln = 0; + static short sh = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Type.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Type.name()
    + * complies with its spec when
    + * a type is one of ReferenceType(s).
    + *
    + * The test checks up that the names of three Type objects,
    + * corresponding in a debugger to the following in a debuggee:
    + *
    + * array of a class type - "ClassForCheck_2[] class3" field,
    + * class type - "ClassForCheck_2 class2" field,
    + * interface type - "IntefaceForCheck iface" field
    + *
    + * are as follows:
    + * "nsk.jdi.Type.name.ClassForCheck_2[]"
    + * "nsk.jdi.Type.name.ClassForCheck"
    + * "nsk.jdi.Type.name.InterfaceForCheck"
    + *
    + */ + +public class name002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Type/name/name002", + sHeader2 = "--> name002: ", + sHeader3 = "##> name002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Type.name.name002a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("name002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String namePrefix = "nsk.jdi.Type.name"; + List listOfDebuggeeClasses = null; + ReferenceType reftypeObj = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // ArrayType + + listOfDebuggeeClasses = + vm.classesByName(namePrefix + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ArrayType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field arrayField = reftypeObj.fieldByName("class3"); + + Type arrayfieldType = null; + try { + arrayfieldType = arrayField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: arrayfieldType = arrayField.type();"); + expresult =1; + break ; + } + + String arrayfieldTypeName = arrayfieldType.name(); + if (!arrayfieldTypeName.equals(namePrefix + ".ClassForCheck_2[]")) { + expresult = 1; + log3("ERROR: !arrayfieldTypeName.equals(namePrefix + '.ClassForCheck_2[]')"); + } + break; + + case 1: // ClassType + listOfDebuggeeClasses = + vm.classesByName(namePrefix + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ClassType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field classField = reftypeObj.fieldByName("class2"); + + Type classfieldType = null; + try { + classfieldType = classField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: classfieldType = classField.type();"); + expresult =1; + break ; + } + + String classfieldTypeName = classfieldType.name(); + if (!classfieldTypeName.equals(namePrefix + ".ClassForCheck_2")) { + expresult = 1; + log3("ERROR: !classfieldTypeName.equals(namePrefix + '.ClassForCheck_2')"); + } + break; + + case 2: // InterfaceType + listOfDebuggeeClasses = + vm.classesByName(namePrefix + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for InterfaceType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field ifaceField = reftypeObj.fieldByName("iface"); + + Type ifacefieldType = null; + try { + ifacefieldType = ifaceField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ifacefieldType = ifaceField.type();"); + expresult =1; + break ; + } + + String ifacefieldTypeName = ifacefieldType.name(); + if (!ifacefieldTypeName.equals(namePrefix + ".InterfaceForCheck")) { + expresult = 1; + log3("ERROR: !ifacefieldTypeName.equals(namePrefix + '.InterfaceForCheck')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name002/TestDescription.java new file mode 100644 index 00000000000..a2b13036ae2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name002/TestDescription.java @@ -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/Type/name/name002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Type. + * The test checks up that a result of the method + * com.sun.jdi.Type.name() + * complies with its spec: + * public java.lang.String name() + * Returns: a text representation of this type. + * when the type is one of the ReferenceType(s). + * The test works as follows: + * A debugger program - nsk.jdi.Type.name.name002; + * a debuggee program - nsk.jdi.Type.name.name002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Type.name.name002 + * nsk.jdi.Type.name.name002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.name.name002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name002a.java new file mode 100644 index 00000000000..5c156312e15 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name002a.java @@ -0,0 +1,159 @@ +/* + * 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.Type.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name002 JDI test. + */ + +public class name002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> name002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> name002a: " + message); + } + + //====================================================== test program + + static ClassForCheck class1 = new ClassForCheck(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Type.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Type.name()
    + * complies with its spec when
    + * a type is the VoidType.
    + *
    + * The test checks up that the name of the Type objects,
    + * corresponding in a debugger to
    + * the void return type of a test method in a debuggee
    + * is "void".
    + *
    + */ + +public class name003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Type/name/name003", + sHeader2 = "--> name003: ", + sHeader3 = "##> name003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Type.name.name003a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("name003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + List methods = execClass.methodsByName("testMethod"); + if (methods.size() != 1) { + testExitCode = FAILED; + log3("ERROR: methods.size() != 1"); + break ; + } + + Method testmethod = (Method) methods.get(0); + + Type testmethodReturnType = null; + try { + testmethodReturnType = testmethod.returnType(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: testmethodReturnType = testmethod.returnType();"); + testExitCode = FAILED; + break ; + } + + String testmethodReturnTypeName = testmethodReturnType.name(); + + if (!testmethodReturnTypeName.equals("void")) { + testExitCode = FAILED; + log3("ERROR: !testmethodReturnTypeName.equals('void')"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name003/TestDescription.java new file mode 100644 index 00000000000..8aa12a27a1f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name003/TestDescription.java @@ -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/Type/name/name003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Type. + * The test checks up that a result of the method + * com.sun.jdi.Type.name() + * complies with its spec: + * public java.lang.String name() + * Returns: a text representation of this type. + * when the type is the VoidType. + * The test works as follows: + * A debugger program - nsk.jdi.Type.name.name003; + * a debuggee program - nsk.jdi.Type.name.name003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Type.name.name003 + * nsk.jdi.Type.name.name003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.name.name003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name003a.java new file mode 100644 index 00000000000..3f2cfdd2758 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/name/name003a.java @@ -0,0 +1,117 @@ +/* + * 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.Type.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name003 JDI test. + */ + +public class name003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> name003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> name003a: " + message); + } + + //====================================================== test program + + public void testMethod () { + return; + } + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Type.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Type.signature()
    + * complies with its spec when a type is one of primitive types.
    + *
    + * The cases for testing are as follows.
    + *
    + * When a gebuggee executes the following :
    + * static boolean bl = false;
    + * static byte bt = 0;
    + * static char ch = 0;
    + * static double db = 0.0d;
    + * static float fl = 0.0f;
    + * static int in = 0;
    + * static long ln = 0;
    + * static short sh = 0;
    + *
    + * for all of the above primitive type variables,
    + * a debugger forms their corresponding Type objects
    + * from which it forms text representations of
    + * original types in a debuggee in String variables
    + * named blSignature, btSignature, and etc.
    + *
    + * Then the debugger checks up that
    + *the each of the following is true :
    + *
    + * blSignature.equals("Z")
    + * btSignature.equals("B")
    + * chSignature.equals("C")
    + * dbSignature.equals("D")
    + * flSignature.equals("F")
    + * inSignature.equals("I")
    + * lnSignature.equals("J")
    + * shSignature.equals("S")
    + */ + +public class signature001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Type/signature/signature001", + sHeader2 = "--> signature001: ", + sHeader3 = "##> signature001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new signature001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Type.signature.signature001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("signature001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl = execClass.fieldByName("bl"); + Field fsbt = execClass.fieldByName("bt"); + Field fsch = execClass.fieldByName("ch"); + Field fsdb = execClass.fieldByName("db"); + Field fsfl = execClass.fieldByName("fl"); + Field fsin = execClass.fieldByName("in"); + Field fsln = execClass.fieldByName("ln"); + Field fssh = execClass.fieldByName("sh"); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // boolean + String blSignature = + execClass.getValue(fsbl).type().signature(); + if (!blSignature.equals("Z")) { + expresult = 1; + log3("ERROR: !blSignature.equals('Z')"); + } + break; + + case 1: // byte + String btSignature = + execClass.getValue(fsbt).type().signature(); + if (!btSignature.equals("B")) { + expresult = 1; + log3("ERROR: !btSignature.equals('B')"); + } + break; + + case 2: // char + String chSignature = + execClass.getValue(fsch).type().signature(); + if (!chSignature.equals("C")) { + expresult = 1; + log3("ERROR: !chSignature.equals('C')"); + } + break; + + case 3: // double + String dbSignature = + execClass.getValue(fsdb).type().signature(); + if (!dbSignature.equals("D")) { + expresult = 1; + log3("ERROR: !dbSignature.equals('D')"); + } + break; + + case 4: // float + String flSignature = + execClass.getValue(fsfl).type().signature(); + if (!flSignature.equals("F")) { + expresult = 1; + log3("ERROR: !flSignature.equals('F')"); + } + break; + + case 5: // int + String inSignature = + execClass.getValue(fsin).type().signature(); + if (!inSignature.equals("I")) { + expresult = 1; + log3("ERROR: !inSignature.equals('I')"); + } + break; + + case 6: // long + String lnSignature = + execClass.getValue(fsln).type().signature(); + if (!lnSignature.equals("J")) { + expresult = 1; + log3("ERROR: !lnSignature.equals('J')"); + } + break; + + case 7: // short + String shSignature = + execClass.getValue(fssh).type().signature(); + if (!shSignature.equals("S")) { + expresult = 1; + log3("ERROR: !shSignature.equals('S')"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature001/TestDescription.java new file mode 100644 index 00000000000..75199690039 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature001/TestDescription.java @@ -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/Type/signature/signature001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Type. + * The test checks up that a result of the method + * com.sun.jdi.Type.signature() + * complies with its spec: + * public java.lang.String signature() + * Returns the JNI-style signature for this type. + * For primitive classes the returned signature is the signature of + * the corresponding primitive type; for example, + * "I" is returned as the signature of the class + * represented by java.lang.Integer#TYPE. + * Returns: the string containing the type signature. + * when the type is one of primitive types. + * The test works as follows: + * A debugger program - nsk.jdi.Type.signature.signature001; + * a debuggee program - nsk.jdi.Type.signature.signature001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Type.signature.signature001 + * nsk.jdi.Type.signature.signature001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.signature.signature001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature001a.java new file mode 100644 index 00000000000..c0fedb15afb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature001a.java @@ -0,0 +1,122 @@ +/* + * 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.Type.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the signature001 JDI test. + */ + +public class signature001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> signature001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> signature001a: " + message); + } + + //====================================================== test program + + static boolean bl = false; + static byte bt = 0; + static char ch = 0; + static double db = 0.0d; + static float fl = 0.0f; + static int in = 0; + static long ln = 0; + static short sh = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Type.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Type.signature()
    + * a type is one of ReferenceType(s).
    + *
    + * The test checks up that the signatures of three Type objects,
    + * corresponding in a debugger to the following in a debuggee:
    + *
    + * array of a class type - "ClassForCheck_2[] class3" field,
    + * class type - "ClassForCheck_2 class2" field,
    + * interface type - "IntefaceForCheck iface" field
    + *
    + * are as follows:
    + * "[Lnsk/jdi/Type/signature/ClassForCheck_2[];"
    + * "Lnsk/jdi/Type/signature/ClassForCheck;"
    + * "Lnsk/jdi/Type/signature/InterfaceForCheck;"
    + *
    + */ + +public class signature002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Type/signature/signature002", + sHeader2 = "--> signature002: ", + sHeader3 = "##> signature002: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new signature002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Type.signature.signature002a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("signature002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String namePrefix = "nsk.jdi.Type.signature"; + String signaturePrefix = "nsk/jdi/Type/signature"; + List listOfDebuggeeClasses = null; + ReferenceType reftypeObj = null; + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // ArrayType + + listOfDebuggeeClasses = + vm.classesByName(namePrefix + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ArrayType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field arrayField = reftypeObj.fieldByName("class3"); + + Type arrayfieldType = null; + try { + arrayfieldType = arrayField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: arrayfieldType = arrayField.type();"); + expresult =1; + break ; + } + + String arrayfieldTypeSignature = + arrayfieldType.signature(); + if (!arrayfieldTypeSignature.equals( + "[L" + signaturePrefix + "/ClassForCheck_2;")) { + expresult = 1; + log3("ERROR: !arrayfieldTypeSignature.equals(namePrefix +" + + "'.ClassForCheck_2[]')" /* + " " + arrayfieldTypeSignature */ ); + } + break; + + case 1: // ClassType + listOfDebuggeeClasses = + vm.classesByName(namePrefix + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for ClassType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field classField = reftypeObj.fieldByName("class2"); + + Type classfieldType = null; + try { + classfieldType = classField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: classfieldType = classField.type();"); + expresult =1; + break ; + } + + String classfieldTypeSignature = + classfieldType.signature(); + if (!classfieldTypeSignature.equals( + "L" + signaturePrefix + "/ClassForCheck_2;")) { + expresult = 1; + log3("ERROR: !classfieldTypeSignature.equals(namePrefix + " + + "'.ClassForCheck_2')" /* + " " + classfieldTypeSignature */ ); + } + break; + + case 2: // InterfaceType + listOfDebuggeeClasses = + vm.classesByName(namePrefix + ".ClassForCheck"); + if (listOfDebuggeeClasses.size() != 1) { + expresult = 1; + log3("ERROR: for InterfaceType listOfDebuggeeClasses.size() != 1"); + break ; + } + reftypeObj = (ReferenceType) listOfDebuggeeClasses.get(0); + + Field ifaceField = reftypeObj.fieldByName("iface"); + + Type ifacefieldType = null; + try { + ifacefieldType = ifaceField.type(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: ifacefieldType = ifaceField.type();"); + expresult =1; + break ; + } + + String ifacefieldTypeSignature = + ifacefieldType.signature(); + if (!ifacefieldTypeSignature.equals( + "L" + signaturePrefix + "/InterfaceForCheck;")) { + expresult = 1; + log3("ERROR: !ifacefieldTypeSignature.equals(namePrefix + " + + "'.InterfaceForCheck')" /* + " " + ifacefieldTypeSignature */ ); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature002/TestDescription.java new file mode 100644 index 00000000000..2bce3a311ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature002/TestDescription.java @@ -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/Type/signature/signature002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Type. + * The test checks up that a result of the method + * com.sun.jdi.Type.signature() + * complies with its spec: + * public java.lang.String signature() + * Returns the JNI-style signature for this type. + * For primitive classes the returned signature is the signature of + * the corresponding primitive type; for example, + * "I" is returned as the signature of the class + * represented by java.lang.Integer#TYPE. + * Returns: the string containing the type signature. + * when the type is one of the ReferenceType(s). + * The test works as follows: + * A debugger program - nsk.jdi.Type.signature.signature002; + * a debuggee program - nsk.jdi.Type.signature.signature002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Type.signature.signature002 + * nsk.jdi.Type.signature.signature002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.signature.signature002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature002a.java new file mode 100644 index 00000000000..a3cea639dba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature002a.java @@ -0,0 +1,160 @@ +/* + * 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.Type.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the signature002 JDI test. + */ + +public class signature002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> signature002a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> signature002a: " + message); + } + + //====================================================== test program + + static ClassForCheck class1 = new ClassForCheck(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Type.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Type.signature()
    + * complies with its spec when
    + * a type is the VoidType.
    + *
    + * The test checks up that the signature of the Type objects,
    + * corresponding in a debugger to
    + * the void return type of a test method in a debuggee
    + * is "V".
    + *
    + */ + +public class signature003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Type/signature/signature003", + sHeader2 = "--> signature003: ", + sHeader3 = "##> signature003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new signature003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Type.signature.signature003a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("signature003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + List methods = execClass.methodsByName("testMethod"); + if (methods.size() != 1) { + testExitCode = FAILED; + log3("ERROR: methods.size() != 1"); + break ; + } + + Method testmethod = (Method) methods.get(0); + + Type testmethodReturnType = null; + try { + testmethodReturnType = testmethod.returnType(); + } catch ( ClassNotLoadedException e ) { + log3("ERROR: testmethodReturnType = testmethod.returnType();"); + testExitCode = FAILED; + break ; + } + + String testmethodReturnTypeSignature = testmethodReturnType.signature(); + if (!testmethodReturnTypeSignature.equals("V")) { + testExitCode = FAILED; + log3("ERROR: !testmethodReturnTypeSignature.equals('V')" + + " " + testmethodReturnTypeSignature); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature003/TestDescription.java new file mode 100644 index 00000000000..3ff3e27b52e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature003/TestDescription.java @@ -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/Type/signature/signature003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Type. + * The test checks up that a result of the method + * com.sun.jdi.Type.signature() + * complies with its spec: + * public java.lang.String signature() + * Returns the JNI-style signature for this type. + * For primitive classes the returned signature is the signature of + * the corresponding primitive type; for example, + * "I" is returned as the signature of the class + * represented by java.lang.Integer#TYPE. + * Returns: the string containing the type signature. + * when the type is the VoidType. + * The test works as follows: + * A debugger program - nsk.jdi.Type.signature.signature003; + * a debuggee program - nsk.jdi.Type.signature.signature003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Type.signature.signature003 + * nsk.jdi.Type.signature.signature003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Type.signature.signature003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature003a.java new file mode 100644 index 00000000000..9efdd906bb3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Type/signature/signature003a.java @@ -0,0 +1,117 @@ +/* + * 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.Type.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the signature003 JDI test. + */ + +public class signature003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> signature003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> signature003a: " + message); + } + + //====================================================== test program + + public void testMethod () { + return; + } + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i 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."); + } + + // Get MainClass and MainInter from debugee + mainClass = debugee.classByName(mainClassName); + if (mainClass == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + mainInter = debugee.classByName(mainInterName); + if (mainInter == null) { + log.complain("debuger FAILURE> Interface " + mainInterName + " not " + + "found."); + return 2; + } + + // Check all fields from MainClass + log.display("debuger> Total fields in " + mainClassName + ": " + + + mainClass.allFields().size()); + for (int i = 0; i < FIELD_NAME_CLASS.length; i++) { + Field field; + String name; + ReferenceType declType; + boolean equal; + + try { + field = mainClass.fieldByName(FIELD_NAME_CLASS[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME_CLASS[i] + " from " + mainClassName); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + declType = field.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 2> Declaring type is null " + + " for field " + name + " in class " + + mainClassName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " from class " + + mainClassName + " read."); + try { + equal = declType.equals(mainClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 3> Cannot compare reference " + + " types " + declType.name() + " and " + + mainClassName); + log.complain("debuger FAILURE 3> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 4> Declaring type of field " + + name + " is " + declType.name() + ", but should " + + "be " + mainClassName); + testFailed = true; + } + } + + // Check all fields from MainInter + log.display("debuger> Total fields in " + mainInterName + ": " + + + mainInter.allFields().size()); + for (int i = 0; i < FIELD_NAME_INTER.length; i++) { + Field field; + String name; + ReferenceType declType; + boolean equal; + + try { + field = mainInter.fieldByName(FIELD_NAME_INTER[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 5> Can't get field by name " + + FIELD_NAME_INTER[i] + " from " + mainInterName); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + declType = field.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 6> Declaring type is null " + + " for field " + name + " in class " + + mainInterName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " from interface " + + mainInterName + " read."); + try { + equal = declType.equals(mainInter); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 7> Cannot compare reference " + + " types " + declType.name() + " and " + + mainInterName); + log.complain("debuger FAILURE 7> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 8> Declaring type of field " + + name + " is " + declType.name() + ", but should " + + "be " + mainInterName); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001/TestDescription.java new file mode 100644 index 00000000000..437379c6e8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001/TestDescription.java @@ -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/TypeComponent/declaringType/decltype001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType001 checks assertions: + * public java.lang.String declaringType() + * 1. Returns the type in which a field was declared if the type mirrors + * a class in the target VM. + * 2. Returns the type in which a field was declared if the type mirrors + * an interface in the target VM. + * Debugger gets each field from debuggee (MainClass and MainInter) calling + * by name and then checks if method declaringType() returns the same + * reference type. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype001 + * nsk.jdi.TypeComponent.declaringType.decltype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001a.java new file mode 100644 index 00000000000..4606386d964 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001a.java @@ -0,0 +1,127 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + MainClass mainClass = new MainClass(); + ImplClass implClass = new ImplClass(); + + 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); + } +} + +// User class and interface +class Class {} +interface Inter {} + +class MainClass { + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + Class X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + static Long L0S, L1S[]={L0S}, L2S[][]={L1S}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + Inter E0, E1[]={E0}, E2[][]={E1}; + + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + static Inter E0S, E1S[]={E0S}, E2S[][]={E1S}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; +} + +class ImplClass implements MainInter {} + +interface MainInter { + boolean z0 = true, z1[]={z0}, z2[][]={z1}; + byte b0 = 1, b1[]={b0}, b2[][]={b1}; + char c0 = '\u00ff', c1[]={c0}, c2[][]={c1}; + double d0 = 0, d1[]={d0}, d2[][]={d1}; + float f0 = 0f, f1[]={f0}, f2[][]={f1}; + int i0 = 0, i1[]={i0}, i2[][]={i1}; + long l0 = 0l, l1[]={l0}, l2[][]={l1}; + short r0 = 0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + public long lU0 = 1l, lU1[]={lU0}, lU2[][]={lU1}; + static long l0S = 1l, l1S[]={l0S}, l2S[][]={l1S}; + + Class X0 = new Class(), X1[]={X0}, X2[][]={X1}; + Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + public Long LU0 = new Long(1), LU1[]={LU0}, LU2[][]={LU1}; + static Long L0S = new Long(1), L1S[]={L0S}, L2S[][]={L1S}; + + Inter E0 = null, E1[]={E0}, E2[][]={E1}; + + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + public Inter EU0 = null, EU1[]={EU0}, EU2[][]={EU1}; + static Inter E0S = null, E1S[]={E0S}, E2S[][]={E1S}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002.java new file mode 100644 index 00000000000..2093e40c4ac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002.java @@ -0,0 +1,285 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class decltype002 { + final static String FIELD_NAME_CLASS[] = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + + "lF0", "lF1", "lF2", + "lP0", "lP1", "lP2", + "lU0", "lU1", "lU2", + "lR0", "lR1", "lR2", + "l0S", "l1S", "l2S", + "lT0", "lT1", "lT2", + "lV0", "lV1", "lV2", + + "X0", "X1", "X2", + "O0", "O1", "O2", + + "LF0", "LF1", "LF2", + "LP0", "LP1", "LP2", + "LU0", "LU1", "LU2", + "LR0", "LR1", "LR2", + "L0S", "L1S", "L2S", + "LT0", "LT1", "LT2", + "LV0", "LV1", "LV2", + + "E0", "E1", "E2", + "EF0", "EF1", "EF2", + "EP0", "EP1", "EP2", + "EU0", "EU1", "EU2", + "ER0", "ER1", "ER2", + "E0S", "E1S", "E2S", + "ET0", "ET1", "ET2", + "EV0", "EV1", "EV2" + }; + final static String FIELD_NAME_INTER[] = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + + "lF0", "lF1", "lF2", + "lU0", "lU1", "lU2", + "l0S", "l1S", "l2S", + + "X0", "X1", "X2", + "O0", "O1", "O2", + + "LF0", "LF1", "LF2", + "LU0", "LU1", "LU2", + "L0S", "L1S", "L2S", + + "E0", "E1", "E2", + "EF0", "EF1", "EF2", + "EU0", "EU1", "EU2", + "E0S", "E1S", "E2S", + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String mainClassName = prefix + "decltype002aMainClass"; + private final static String sameClassName = prefix + "decltype002aSameClass"; + private final static String mainInterName = prefix + "decltype002aMainInter"; + private final static String sameInterName = prefix + "decltype002aSameInter"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType mainClass; + ReferenceType sameClass; + ReferenceType mainInter; + ReferenceType sameInter; + + // 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."); + } + + // Get decltype002aMainClass, decltype002aMainInter, decltype002aSameClass and decltype002aSameInter from debugee + mainClass = debugee.classByName(mainClassName); + if (mainClass == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + sameClass = debugee.classByName(sameClassName); + if (sameClass == null) { + log.complain("debuger FAILURE> Class " + sameClassName + " not " + + "found."); + return 2; + } + mainInter = debugee.classByName(mainInterName); + if (mainInter == null) { + log.complain("debuger FAILURE> Interface " + mainInterName + " not " + + "found."); + return 2; + } + sameInter = debugee.classByName(sameInterName); + if (sameClass == null) { + log.complain("debuger FAILURE> Interface " + sameInterName + " not " + + "found."); + return 2; + } + + // Check all fields from decltype002aSameClass + log.display("debuger> Total fields in " + mainClassName + ": " + + + mainClass.allFields().size()); + for (int i = 0; i < FIELD_NAME_CLASS.length; i++) { + Field field; + String name; + ReferenceType declType; + boolean equal; + + try { + field = sameClass.fieldByName(FIELD_NAME_CLASS[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME_CLASS[i] + " from type " + sameClassName); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + declType = field.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 2> Declaring type is null " + + " for field " + name + " in class " + + sameClassName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " with declaring " + + "type " + declType.name() + " from class " + + sameClassName + " read."); + try { + equal = declType.equals(mainClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 3> Cannot compare reference " + + " types " + declType.name() + " and " + + mainClassName); + log.complain("debuger FAILURE 3> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 4> Declaring type of field " + + name + " is " + declType.name() + ", but should " + + "be " + mainClassName); + testFailed = true; + } + } + + // Check all fields from decltype002aSameInter + log.display("debuger> Total fields in " + mainInterName + ": " + + + mainInter.allFields().size()); + for (int i = 0; i < FIELD_NAME_INTER.length; i++) { + Field field; + String name; + ReferenceType declType; + boolean equal; + + try { + field = sameInter.fieldByName(FIELD_NAME_INTER[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 5> Can't get field by name " + + FIELD_NAME_INTER[i] + " from type " + + sameInterName); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + declType = field.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 6> Declaring type is null " + + " for field " + name + " in class " + + sameInterName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " with declaring " + + "type " + declType.name() + " from class " + + sameInterName + " read."); + try { + equal = declType.equals(mainInter); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 7> Cannot compare reference " + + " types " + declType.name() + " and " + + mainInterName); + log.complain("debuger FAILURE 7> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 8> Declaring type of field " + + name + " is " + declType.name() + ", but should " + + "be " + mainInterName); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002/TestDescription.java new file mode 100644 index 00000000000..f40535fd5f7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002/TestDescription.java @@ -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/TypeComponent/declaringType/decltype002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType002 checks assertions: + * public java.lang.String declaringType() + * 1. Returns the type in which a field was declared if the type mirrors + * a class in the target VM. + * 2. Returns the type in which a field was declared if the type mirrors + * an interface in the target VM. + * There are classes MainClass and SameClass that extends it and do not + * override fields from super class; interfaces MainInter and SameInter that + * extends MainInter and do not override fields from it. + * Debugger gets each field from debuggee (SameClass and SameInter) calling + * by name and then checks if method declaringType() returns reference type + * where all fields were declared (MainClass and MainInter). + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype002 + * nsk.jdi.TypeComponent.declaringType.decltype002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002a.java new file mode 100644 index 00000000000..1be71f70fd3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002a.java @@ -0,0 +1,136 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); +// MainClass mainClass = new MainClass(); + decltype002aSameClass sameClass = new decltype002aSameClass(); + decltype002aImplClass implClass = new decltype002aImplClass(); + + 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); + } +} + +// User class and interface +class decltype002aClass {} +interface decltype002aInter {} + +class decltype002aSameClass extends decltype002aMainClass { + // All fields are the same as in MainClass +} + +class decltype002aMainClass { + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + decltype002aClass X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + static Long L0S, L1S[]={L0S}, L2S[][]={L1S}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + decltype002aInter E0, E1[]={E0}, E2[][]={E1}; + + final decltype002aInter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private decltype002aInter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public decltype002aInter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected decltype002aInter ER0, ER1[]={ER0}, ER2[][]={ER1}; + static decltype002aInter E0S, E1S[]={E0S}, E2S[][]={E1S}; + transient decltype002aInter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile decltype002aInter EV0, EV1[]={EV0}, EV2[][]={EV1}; +} + +class decltype002aImplClass implements decltype002aSameInter {} + +interface decltype002aSameInter extends decltype002aMainInter { + // All fields are the same as in MainInter +} + +interface decltype002aMainInter { + boolean z0 = true, z1[]={z0}, z2[][]={z1}; + byte b0 = 1, b1[]={b0}, b2[][]={b1}; + char c0 = '\u00ff', c1[]={c0}, c2[][]={c1}; + double d0 = 0, d1[]={d0}, d2[][]={d1}; + float f0 = 0f, f1[]={f0}, f2[][]={f1}; + int i0 = 0, i1[]={i0}, i2[][]={i1}; + long l0 = 0l, l1[]={l0}, l2[][]={l1}; + short r0 = 0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + public long lU0 = 1l, lU1[]={lU0}, lU2[][]={lU1}; + static long l0S = 1l, l1S[]={l0S}, l2S[][]={l1S}; + + decltype002aClass X0 = new decltype002aClass(), X1[]={X0}, X2[][]={X1}; + Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + public Long LU0 = new Long(1), LU1[]={LU0}, LU2[][]={LU1}; + static Long L0S = new Long(1), L1S[]={L0S}, L2S[][]={L1S}; + + decltype002aInter E0 = null, E1[]={E0}, E2[][]={E1}; + + final decltype002aInter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + public decltype002aInter EU0 = null, EU1[]={EU0}, EU2[][]={EU1}; + static decltype002aInter E0S = null, E1S[]={E0S}, E2S[][]={E1S}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003.java new file mode 100644 index 00000000000..d1af14dd610 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003.java @@ -0,0 +1,270 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class decltype003 { + final static String FIELD_NAME_CLASS[] = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + + "lF0", "lF1", "lF2", + "lP0", "lP1", "lP2", + "lU0", "lU1", "lU2", + "lR0", "lR1", "lR2", + "l0S", "l1S", "l2S", + "lT0", "lT1", "lT2", + "lV0", "lV1", "lV2", + + "X0", "X1", "X2", + "O0", "O1", "O2", + + "LF0", "LF1", "LF2", + "LP0", "LP1", "LP2", + "LU0", "LU1", "LU2", + "LR0", "LR1", "LR2", + "L0S", "L1S", "L2S", + "LT0", "LT1", "LT2", + "LV0", "LV1", "LV2", + + "E0", "E1", "E2", + "EF0", "EF1", "EF2", + "EP0", "EP1", "EP2", + "EU0", "EU1", "EU2", + "ER0", "ER1", "ER2", + "E0S", "E1S", "E2S", + "ET0", "ET1", "ET2", + "EV0", "EV1", "EV2" + }; + final static String FIELD_NAME_INTER[] = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + + "lF0", "lF1", "lF2", + "lU0", "lU1", "lU2", + "l0S", "l1S", "l2S", + + "X0", "X1", "X2", + "O0", "O1", "O2", + + "LF0", "LF1", "LF2", + "LU0", "LU1", "LU2", + "L0S", "L1S", "L2S", + + "E0", "E1", "E2", + "EF0", "EF1", "EF2", + "EU0", "EU1", "EU2", + "E0S", "E1S", "E2S", + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String overClassName = prefix + "decltype003aOverridenClass"; + private final static String overInterName = prefix + "decltype003aOverridenInter"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType overClass; + ReferenceType overInter; + + // 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."); + } + + // Get OverridenClass and OverridenInter from debugee + overClass = debugee.classByName(overClassName); + if (overClass == null) { + log.complain("debuger FAILURE> Class " + overClassName + " not " + + "found."); + return 2; + } + overInter = debugee.classByName(overInterName); + if (overInter == null) { + log.complain("debuger FAILURE> Interface " + overInterName + " not " + + "found."); + return 2; + } + + // Check all fields from OverridenClass + log.display("debuger> Total fields in " + overClassName + ": " + + + overClass.fields().size()); + for (int i = 0; i < FIELD_NAME_CLASS.length; i++) { + Field field; + String name; + ReferenceType declType; + boolean equal; + + try { + field = overClass.fieldByName(FIELD_NAME_CLASS[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME_CLASS[i] + " from type " + + overClassName); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + declType = field.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 2> Declaring type is null " + + " for field " + name + " in class " + + overClassName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " with declaring " + + "type " + declType.name() + " from class " + + overClassName + " read."); + try { + equal = declType.equals(overClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 3> Cannot compare reference " + + " types " + declType.name() + " and " + + overClassName); + log.complain("debuger FAILURE 3> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 4> Declaring type of field " + + name + " is " + declType.name() + ", but should " + + "be " + overClassName); + testFailed = true; + } + } + + // Check all fields from OverridenInter + log.display("debuger> Total fields in " + overInterName + ": " + + + overInter.fields().size()); + for (int i = 0; i < FIELD_NAME_INTER.length; i++) { + Field field; + String name; + ReferenceType declType; + boolean equal; + + try { + field = overInter.fieldByName(FIELD_NAME_INTER[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 5> Can't get field by name " + + FIELD_NAME_INTER[i] + " from type " + + overInterName); + log.complain("debuger FAILURE 5> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + declType = field.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 6> Declaring type is null " + + " for field " + name + " in class " + + overInterName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " field " + name + " with declaring " + + "type " + declType.name() + " from class " + + overInterName + " read."); + try { + equal = declType.equals(overInter); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 7> Cannot compare reference " + + " types " + declType.name() + " and " + + overInterName); + log.complain("debuger FAILURE 7> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 8> Declaring type of field " + + name + " is " + declType.name() + ", but should " + + "be " + overInterName); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003/TestDescription.java new file mode 100644 index 00000000000..ade78a9dd5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003/TestDescription.java @@ -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/TypeComponent/declaringType/decltype003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType003 checks assertion: + * public java.lang.String declaringType() + * 1. Returns the type in which a field was declared if the type mirrors + * a class in the target VM. + * 2. Returns the type in which a field was declared if the type mirrors + * an interface in the target VM. + * There are classes MainClass and OverridenClass extends MainClass and + * overrides all fields; interfaces MainInter and OverridenInter that + * extends MainInter and overrides all fields from it. + * Debugger gets each field from debuggee (OverridenClass and OverridenInter) + * calling by name and then checks if method declaringType() returns reference + * type where all fields were declared (OverridenClass and OverridenInter). + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype003 + * nsk.jdi.TypeComponent.declaringType.decltype003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003a.java new file mode 100644 index 00000000000..e8387e5ad70 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003a.java @@ -0,0 +1,199 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + decltype003aOverridenClass overridenClass = new decltype003aOverridenClass(); + decltype003aImplClass implClass = new decltype003aImplClass(); + + 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); + } +} + +// User class and interface +class decltype003aClass {} +interface decltype003aInter {} + +class decltype003aOverridenClass extends decltype003aMainClass { + // All fields are overriden from MainClass + + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + decltype003aClass X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + static Long L0S, L1S[]={L0S}, L2S[][]={L1S}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + decltype003aInter E0, E1[]={E0}, E2[][]={E1}; + + final decltype003aInter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private decltype003aInter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public decltype003aInter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected decltype003aInter ER0, ER1[]={ER0}, ER2[][]={ER1}; + static decltype003aInter E0S, E1S[]={E0S}, E2S[][]={E1S}; + transient decltype003aInter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile decltype003aInter EV0, EV1[]={EV0}, EV2[][]={EV1}; +} + +class decltype003aMainClass { + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + decltype003aClass X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + static Long L0S, L1S[]={L0S}, L2S[][]={L1S}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + decltype003aInter E0, E1[]={E0}, E2[][]={E1}; + + final decltype003aInter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private decltype003aInter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public decltype003aInter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected decltype003aInter ER0, ER1[]={ER0}, ER2[][]={ER1}; + static decltype003aInter E0S, E1S[]={E0S}, E2S[][]={E1S}; + transient decltype003aInter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile decltype003aInter EV0, EV1[]={EV0}, EV2[][]={EV1}; +} + +class decltype003aImplClass implements decltype003aOverridenInter {} + +interface decltype003aOverridenInter extends decltype003aMainInter { + // All fields are overriden from decltype003aMainInter + + boolean z0 = true, z1[]={z0}, z2[][]={z1}; + byte b0 = 1, b1[]={b0}, b2[][]={b1}; + char c0 = '\u00ff', c1[]={c0}, c2[][]={c1}; + double d0 = 0, d1[]={d0}, d2[][]={d1}; + float f0 = 0f, f1[]={f0}, f2[][]={f1}; + int i0 = 0, i1[]={i0}, i2[][]={i1}; + long l0 = 0l, l1[]={l0}, l2[][]={l1}; + short r0 = 0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + public long lU0 = 1l, lU1[]={lU0}, lU2[][]={lU1}; + static long l0S = 1l, l1S[]={l0S}, l2S[][]={l1S}; + + decltype003aClass X0 = new decltype003aClass(), X1[]={X0}, X2[][]={X1}; + Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + public Long LU0 = new Long(1), LU1[]={LU0}, LU2[][]={LU1}; + static Long L0S = new Long(1), L1S[]={L0S}, L2S[][]={L1S}; + + decltype003aInter E0 = null, E1[]={E0}, E2[][]={E1}; + + final decltype003aInter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + public decltype003aInter EU0 = null, EU1[]={EU0}, EU2[][]={EU1}; + static decltype003aInter E0S = null, E1S[]={E0S}, E2S[][]={E1S}; +} + +interface decltype003aMainInter { + boolean z0 = true, z1[]={z0}, z2[][]={z1}; + byte b0 = 1, b1[]={b0}, b2[][]={b1}; + char c0 = '\u00ff', c1[]={c0}, c2[][]={c1}; + double d0 = 0, d1[]={d0}, d2[][]={d1}; + float f0 = 0f, f1[]={f0}, f2[][]={f1}; + int i0 = 0, i1[]={i0}, i2[][]={i1}; + long l0 = 0l, l1[]={l0}, l2[][]={l1}; + short r0 = 0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + public long lU0 = 1l, lU1[]={lU0}, lU2[][]={lU1}; + static long l0S = 1l, l1S[]={l0S}, l2S[][]={l1S}; + + decltype003aClass X0 = new decltype003aClass(), X1[]={X0}, X2[][]={X1}; + Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + public Long LU0 = new Long(1), LU1[]={LU0}, LU2[][]={LU1}; + static Long L0S = new Long(1), L1S[]={L0S}, L2S[][]={L1S}; + + decltype003aInter E0 = null, E1[]={E0}, E2[][]={E1}; + + final decltype003aInter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + public decltype003aInter EU0 = null, EU1[]={EU0}, EU2[][]={EU1}; + static decltype003aInter E0S = null, E1S[]={E0S}, E2S[][]={E1S}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004.java new file mode 100644 index 00000000000..6dcef73ea31 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004.java @@ -0,0 +1,288 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class decltype004 { + final static String METHOD_NAME_CLASS[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvF", "MlF", "MlF1", "MlF2", + "MvN", "MlN", "MlN1", "MlN2", + "MvS", "MlS", "MlS1", "MlS2", + "MvI", "MlI", "MlI1", "MlI2", + "MvY", "MlY", "MlY1", "MlY2", + "MvU", "MlU", "MlU1", "MlU2", + "MvR", "MlR", "MlR1", "MlR2", + "MvP", "MlP", "MlP1", "MlP2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLF", "MLF1", "MLF2", + "MLN", "MLN1", "MLN2", + "MLS", "MLS1", "MLS2", + "MLI", "MLI1", "MLI2", + "MLY", "MLY1", "MLY2", + "MLU", "MLU1", "MLU2", + "MLR", "MLR1", "MLR2", + "MLP", "MLP1", "MLP2", + + "ME", "ME1", "ME2", + "MEF", "MEF1", "MEF2", + "MEN", "MEN1", "MEN2", + "MES", "ME1S", "ME2S", + "MEI", "MEI1", "MEI2", + "MEY", "MEY1", "MEY2", + "MEU", "MEU1", "MEU2", + "MER", "MER1", "MER2", + "MEP", "MEP1", "MEP2" + }; + final static String METHOD_NAME_INTER[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvU", "MlU", "MlU1", "MlU2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLU", "MLU1", "MLU2", + + "ME", "ME1", "ME2", + "MEU", "MEU1", "MEU2", + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype004"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String mainClassName = prefix + "decltype004aMainClass"; + private final static String mainInterName = prefix + "decltype004aMainInter"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType mainClass; + ReferenceType mainInter; + + // 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."); + } + + // Get MainClass and decltype004aMainInter from debugee + mainClass = debugee.classByName(mainClassName); + if (mainClass == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + mainInter = debugee.classByName(mainInterName); + if (mainInter == null) { + log.complain("debuger FAILURE> Interface " + mainInterName + " not " + + "found."); + return 2; + } + + // Check all methods from MainClass + log.display("debuger> Total methods in " + mainClassName + ": " + + + mainClass.methods().size()); + for (int i = 0; i < METHOD_NAME_CLASS.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + ReferenceType declType; + boolean equal; + + try { + listOfMethods = mainClass.methodsByName(METHOD_NAME_CLASS[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME_CLASS[i]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME_CLASS[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + declType = method.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 3> Declaring type is null " + + " for method " + name + " in class " + + mainClassName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method " + name + " from class " + + mainClassName + " read."); + try { + equal = declType.equals(mainClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 4> Cannot compare reference " + + " types " + declType.name() + " and " + + mainClassName); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 5> Declaring type of method " + + name + " is " + declType.name() + ", but should " + + "be " + mainClassName); + testFailed = true; + } + } + + // Check all methods from MainInter + log.display("debuger> Total methods in " + mainInterName + ": " + + + mainInter.methods().size()); + for (int i = 0; i < METHOD_NAME_INTER.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + ReferenceType declType; + boolean equal; + + try { + listOfMethods = mainInter.methodsByName(METHOD_NAME_INTER[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 6> Can't get method by name " + + METHOD_NAME_INTER[i]); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 7> Number of methods by name " + + METHOD_NAME_INTER[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + declType = method.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 8> Declaring type is null " + + " for method " + name + " in class " + + mainInterName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method " + name + " from interface " + + mainInterName + " read."); + try { + equal = declType.equals(mainInter); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 9> Cannot compare reference " + + " types " + declType.name() + " and " + + mainInterName); + log.complain("debuger FAILURE 9> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 10> Declaring type of method " + + name + " is " + declType.name() + ", but should " + + "be " + mainInterName); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004/TestDescription.java new file mode 100644 index 00000000000..84e31330466 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/TypeComponent/declaringType/decltype004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType004 checks assertions: + * public java.lang.String declaringType() + * 1. Returns the type in which a method was declared if the type mirrors + * a class in the target VM. + * 2. Returns the type in which a method was declared if the type mirrors + * an interface in the target VM. + * Debugger gets each method from debuggee (MainClass and MainInter) calling + * by name and then checks if declaringType() returns the same reference type. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype004 + * nsk.jdi.TypeComponent.declaringType.decltype004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004a.java new file mode 100644 index 00000000000..700b2947afb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype004a.java @@ -0,0 +1,283 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype004a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + decltype004aMainClass mainClass = new decltype004aMainClass(); + decltype004aImplClass implClass = new decltype004aImplClass(); + + 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); + } +} + +// User class and interface +class decltype004aClass {} +interface decltype004aInter {} + +class decltype004aMainClass { + void Mv() {}; + boolean Mz(boolean z) { return !z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + final void MvF() {}; + final long MlF(long l) { return l; }; + final long[] MlF1(long l[]) { return l; }; + final long[][] MlF2(long l[][]){ return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + decltype004aClass MX(decltype004aClass X) { return X; }; + decltype004aClass[] MX1(decltype004aClass X[]) { return X; }; + decltype004aClass[][] MX2(decltype004aClass X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + final Long MLF(Long L) { return L; }; + final Long[] MLF1(Long L[]) { return L; }; + final Long[][] MLF2(Long L[][]) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + decltype004aInter ME(decltype004aInter E) { return E; }; + decltype004aInter[] ME1(decltype004aInter[] E) { return E; }; + decltype004aInter[][] ME2(decltype004aInter[][] E) { return E; }; + + final decltype004aInter MEF(decltype004aInter E) { return E; }; + final decltype004aInter[] MEF1(decltype004aInter[] E) { return E; }; + final decltype004aInter[][] MEF2(decltype004aInter[][] E) { return E; }; + native decltype004aInter MEN(decltype004aInter E); + native decltype004aInter[] MEN1(decltype004aInter[] E); + native decltype004aInter[][] MEN2(decltype004aInter[][] E); + static decltype004aInter MES(decltype004aInter E) { return E; }; + static decltype004aInter[] ME1S(decltype004aInter[] E) { return E; }; + static decltype004aInter[][] ME2S(decltype004aInter[][] E) { return E; }; + strictfp decltype004aInter MEI(decltype004aInter E) { return E; }; + strictfp decltype004aInter[] MEI1(decltype004aInter[] E) { return E; }; + strictfp decltype004aInter[][] MEI2(decltype004aInter[][] E) { return E; }; + synchronized decltype004aInter MEY(decltype004aInter E) { return E; }; + synchronized decltype004aInter[] MEY1(decltype004aInter[] E) { return E; }; + synchronized decltype004aInter[][] MEY2(decltype004aInter[][] E) { return E; }; + public decltype004aInter MEU(decltype004aInter E) { return E; }; + public decltype004aInter[] MEU1(decltype004aInter[] E) { return E; }; + public decltype004aInter[][] MEU2(decltype004aInter[][] E) { return E; }; + protected decltype004aInter MER(decltype004aInter E) { return E; }; + protected decltype004aInter[] MER1(decltype004aInter[] E) { return E; }; + protected decltype004aInter[][] MER2(decltype004aInter[][] E) { return E; }; + private decltype004aInter MEP(decltype004aInter E) { return E; }; + private decltype004aInter[] MEP1(decltype004aInter[] E) { return E; }; + private decltype004aInter[][] MEP2(decltype004aInter[][] E) { return E; }; +} + +class decltype004aImplClass implements decltype004aMainInter { + public void Mv() {}; + public boolean Mz(boolean z) { return !z; }; + public boolean[] Mz1(boolean z[]) { return z; }; + public boolean[][] Mz2(boolean z[][]) { return z; }; + public byte Mb(byte b) { return b; }; + public byte[] Mb1(byte b[]) { return b; }; + public byte[][] Mb2(byte b[][]) { return b; }; + public char Mc(char c) { return c; }; + public char[] Mc1(char c[]) { return c; }; + public char[][] Mc2(char c[][]) { return c; }; + public double Md(double d) { return d; }; + public double[] Md1(double d[]) { return d; }; + public double[][] Md2(double d[][]) { return d; }; + public float Mf(float f) { return f; }; + public float[] Mf1(float f[]) { return f; }; + public float[][] Mf2(float f[][]) { return f; }; + public int Mi(int i) { return i; }; + public int[] Mi1(int i[]) { return i; }; + public int[][] Mi2(int i[][]) { return i; }; + public long Ml(long l) { return l; }; + public long[] Ml1(long l[]) { return l; }; + public long[][] Ml2(long l[][]) { return l; }; + public short Mr(short r) { return r; }; + public short[] Mr1(short r[]) { return r; }; + public short[][] Mr2(short r[][]) { return r; }; + + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + + public decltype004aClass MX(decltype004aClass X) { return X; }; + public decltype004aClass[] MX1(decltype004aClass X[]) { return X; }; + public decltype004aClass[][] MX2(decltype004aClass X[][]) { return X; }; + public Object MO(Object O) { return O; }; + public Object[] MO1(Object[] O) { return O; }; + public Object[][] MO2(Object[][] O) { return O; }; + + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + + public decltype004aInter ME(decltype004aInter E) { return E; }; + public decltype004aInter[] ME1(decltype004aInter[] E) { return E; }; + public decltype004aInter[][] ME2(decltype004aInter[][] E) { return E; }; + + public decltype004aInter MEU(decltype004aInter E) { return E; }; + public decltype004aInter[] MEU1(decltype004aInter[] E) { return E; }; + public decltype004aInter[][] MEU2(decltype004aInter[][] E) { return E; }; +} + +interface decltype004aMainInter { + void Mv(); + boolean Mz(boolean z); + boolean[] Mz1(boolean z[]); + boolean[][] Mz2(boolean z[][]); + byte Mb(byte b); + byte[] Mb1(byte b[]); + byte[][] Mb2(byte b[][]); + char Mc(char c); + char[] Mc1(char c[]); + char[][] Mc2(char c[][]); + double Md(double d); + double[] Md1(double d[]); + double[][] Md2(double d[][]); + float Mf(float f); + float[] Mf1(float f[]); + float[][] Mf2(float f[][]); + int Mi(int i); + int[] Mi1(int i[]); + int[][] Mi2(int i[][]); + long Ml(long l); + long[] Ml1(long l[]); + long[][] Ml2(long l[][]); + short Mr(short r); + short[] Mr1(short r[]); + short[][] Mr2(short r[][]); + + public void MvU(); + public long MlU(long l); + public long[] MlU1(long l[]); + public long[][] MlU2(long l[][]); + + decltype004aClass MX(decltype004aClass X); + decltype004aClass[] MX1(decltype004aClass X[]); + decltype004aClass[][] MX2(decltype004aClass X[][]); + Object MO(Object O); + Object[] MO1(Object[] O); + Object[][] MO2(Object[][] O); + + public Long MLU(Long L); + public Long[] MLU1(Long[] L); + public Long[][] MLU2(Long[][] L); + + decltype004aInter ME(decltype004aInter E); + decltype004aInter[] ME1(decltype004aInter[] E); + decltype004aInter[][] ME2(decltype004aInter[][] E); + + public decltype004aInter MEU(decltype004aInter E); + public decltype004aInter[] MEU1(decltype004aInter[] E); + public decltype004aInter[][] MEU2(decltype004aInter[][] E); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005.java new file mode 100644 index 00000000000..2a5379b510e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005.java @@ -0,0 +1,306 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class decltype005 { + final static String METHOD_NAME_CLASS[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvF", "MlF", "MlF1", "MlF2", + "MvN", "MlN", "MlN1", "MlN2", + "MvS", "MlS", "MlS1", "MlS2", + "MvI", "MlI", "MlI1", "MlI2", + "MvY", "MlY", "MlY1", "MlY2", + "MvU", "MlU", "MlU1", "MlU2", + "MvR", "MlR", "MlR1", "MlR2", + "MvP", "MlP", "MlP1", "MlP2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLF", "MLF1", "MLF2", + "MLN", "MLN1", "MLN2", + "MLS", "MLS1", "MLS2", + "MLI", "MLI1", "MLI2", + "MLY", "MLY1", "MLY2", + "MLU", "MLU1", "MLU2", + "MLR", "MLR1", "MLR2", + "MLP", "MLP1", "MLP2", + + "ME", "ME1", "ME2", + "MEF", "MEF1", "MEF2", + "MEN", "MEN1", "MEN2", + "MES", "ME1S", "ME2S", + "MEI", "MEI1", "MEI2", + "MEY", "MEY1", "MEY2", + "MEU", "MEU1", "MEU2", + "MER", "MER1", "MER2", + "MEP", "MEP1", "MEP2" + }; + final static String METHOD_NAME_INTER[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvU", "MlU", "MlU1", "MlU2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLU", "MLU1", "MLU2", + + "ME", "ME1", "ME2", + "MEU", "MEU1", "MEU2", + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype005"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String mainClassName = prefix + "decltype005aMainClass"; + private final static String sameClassName = prefix + "decltype005aSameClass"; + private final static String mainInterName = prefix + "decltype005aMainInter"; + private final static String sameInterName = prefix + "decltype005aSameInter"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType mainClass; + ReferenceType sameClass; + ReferenceType mainInter; + ReferenceType sameInter; + + // 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."); + } + + // Get MainClass, MainInter, SameClass and SameInter from debugee + mainClass = debugee.classByName(mainClassName); + if (mainClass == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + sameClass = debugee.classByName(sameClassName); + if (sameClass == null) { + log.complain("debuger FAILURE> Class " + sameClassName + " not " + + "found."); + return 2; + } + mainInter = debugee.classByName(mainInterName); + if (mainClass == null) { + log.complain("debuger FAILURE> Interface " + mainInterName + " not " + + "found."); + return 2; + } + sameInter = debugee.classByName(sameInterName); + if (sameClass == null) { + log.complain("debuger FAILURE> Interface " + sameInterName + " not " + + "found."); + return 2; + } + + // Check all methods from SameClass + log.display("debuger> Total methods in " + mainClassName + ": " + + + mainClass.methods().size()); + for (int i = 0; i < METHOD_NAME_CLASS.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + ReferenceType declType; + boolean equal; + + try { + listOfMethods = sameClass.methodsByName(METHOD_NAME_CLASS[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME_CLASS[i]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME_CLASS[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + declType = method.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 3> Declaring type is null " + + " for method " + name + " in class " + + sameClassName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method " + name + " with declaring " + + "type " + declType.name() + " from class " + + sameClassName + " read."); + try { + equal = declType.equals(mainClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 4> Cannot compare reference " + + " types " + declType.name() + " and " + + mainClassName); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 5> Declaring type of method " + + name + " is " + declType.name() + ", but should " + + "be " + mainClassName); + testFailed = true; + } + } + + // Check all methods from SameInter + log.display("debuger> Total methods in " + mainInterName + ": " + + + mainInter.methods().size()); + for (int i = 0; i < METHOD_NAME_INTER.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + ReferenceType declType; + boolean equal; + + try { + listOfMethods = sameInter.methodsByName(METHOD_NAME_INTER[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 6> Can't get method by name " + + METHOD_NAME_INTER[i]); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 7> Number of methods by name " + + METHOD_NAME_INTER[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + declType = method.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 8> Declaring type is null " + + " for method " + name + " in class " + + sameInterName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method " + name + " with declaring " + + "type " + declType.name() + " from class " + + sameInterName + " read."); + try { + equal = declType.equals(mainInter); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 9> Cannot compare reference " + + " types " + declType.name() + " and " + + mainInterName); + log.complain("debuger FAILURE 9> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 10> Declaring type of method " + + name + " is " + declType.name() + ", but should " + + "be " + mainInterName); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005/TestDescription.java new file mode 100644 index 00000000000..c6de3c388ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005/TestDescription.java @@ -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/TypeComponent/declaringType/decltype005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType005 checks assertions: + * public java.lang.String declaringType() + * 1. Returns the type in which a method was declared if the type mirrors + * a class in the target VM. + * 2. Returns the type in which a method was declared if the type mirrors + * an interface in the target VM. + * There are classes MainClass and SameClass that extends it and do not + * override methods from super class; interfaces MainInter and SameInter that + * extends MainInter and do not override methods from it. + * Debugger gets each method from debuggee (SameClass and SameInter) calling + * by name and then checks if method declaringType() returns reference type + * where all methods were declared (MainClass and MainInter). + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype005 + * nsk.jdi.TypeComponent.declaringType.decltype005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005a.java new file mode 100644 index 00000000000..036d049335b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype005a.java @@ -0,0 +1,291 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype005a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + decltype005aSameClass sameClass = new decltype005aSameClass(); + decltype005aImplClass implClass = new decltype005aImplClass(); + + 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); + } +} + +// User class and interface +class decltype005aClass {} +interface decltype005aInter {} + +class decltype005aSameClass extends decltype005aMainClass { + // All methods are the same as in MainClass +} + +class decltype005aMainClass { + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + final void MvF() {}; + final long MlF(long l) { return l; }; + final long[] MlF1(long l[]) { return l; }; + final long[][] MlF2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + decltype005aClass MX(decltype005aClass X) { return X; }; + decltype005aClass[] MX1(decltype005aClass X[]) { return X; }; + decltype005aClass[][] MX2(decltype005aClass X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + final Long MLF(Long L) { return L; }; + final Long[] MLF1(Long[] L) { return L; }; + final Long[][] MLF2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + decltype005aInter ME(decltype005aInter E) { return E; }; + decltype005aInter[] ME1(decltype005aInter[] E) { return E; }; + decltype005aInter[][] ME2(decltype005aInter[][] E) { return E; }; + + final decltype005aInter MEF(decltype005aInter E) { return E; }; + final decltype005aInter[] MEF1(decltype005aInter[] E) { return E; }; + final decltype005aInter[][] MEF2(decltype005aInter[][] E) { return E; }; + native decltype005aInter MEN(decltype005aInter E); + native decltype005aInter[] MEN1(decltype005aInter[] E); + native decltype005aInter[][] MEN2(decltype005aInter[][] E); + static decltype005aInter MES(decltype005aInter E) { return E; }; + static decltype005aInter[] ME1S(decltype005aInter[] E) { return E; }; + static decltype005aInter[][] ME2S(decltype005aInter[][] E) { return E; }; + strictfp decltype005aInter MEI(decltype005aInter E) { return E; }; + strictfp decltype005aInter[] MEI1(decltype005aInter[] E) { return E; }; + strictfp decltype005aInter[][] MEI2(decltype005aInter[][] E) { return E; }; + synchronized decltype005aInter MEY(decltype005aInter E) { return E; }; + synchronized decltype005aInter[] MEY1(decltype005aInter[] E) { return E; }; + synchronized decltype005aInter[][] MEY2(decltype005aInter[][] E) { return E; }; + public decltype005aInter MEU(decltype005aInter E) { return E; }; + public decltype005aInter[] MEU1(decltype005aInter[] E) { return E; }; + public decltype005aInter[][] MEU2(decltype005aInter[][] E) { return E; }; + protected decltype005aInter MER(decltype005aInter E) { return E; }; + protected decltype005aInter[] MER1(decltype005aInter[] E) { return E; }; + protected decltype005aInter[][] MER2(decltype005aInter[][] E) { return E; }; + private decltype005aInter MEP(decltype005aInter E) { return E; }; + private decltype005aInter[] MEP1(decltype005aInter[] E) { return E; }; + private decltype005aInter[][] MEP2(decltype005aInter[][] E) { return E; }; +} + +class decltype005aImplClass implements decltype005aSameInter { + public void Mv() {}; + public boolean Mz(boolean z) { return !z; }; + public boolean[] Mz1(boolean z[]) { return z; }; + public boolean[][] Mz2(boolean z[][]) { return z; }; + public byte Mb(byte b) { return b; }; + public byte[] Mb1(byte b[]) { return b; }; + public byte[][] Mb2(byte b[][]) { return b; }; + public char Mc(char c) { return c; }; + public char[] Mc1(char c[]) { return c; }; + public char[][] Mc2(char c[][]) { return c; }; + public double Md(double d) { return d; }; + public double[] Md1(double d[]) { return d; }; + public double[][] Md2(double d[][]) { return d; }; + public float Mf(float f) { return f; }; + public float[] Mf1(float f[]) { return f; }; + public float[][] Mf2(float f[][]) { return f; }; + public int Mi(int i) { return i; }; + public int[] Mi1(int i[]) { return i; }; + public int[][] Mi2(int i[][]) { return i; }; + public long Ml(long l) { return l; }; + public long[] Ml1(long l[]) { return l; }; + public long[][] Ml2(long l[][]) { return l; }; + public short Mr(short r) { return r; }; + public short[] Mr1(short r[]) { return r; }; + public short[][] Mr2(short r[][]) { return r; }; + + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + + public decltype005aClass MX(decltype005aClass X) { return X; }; + public decltype005aClass[] MX1(decltype005aClass X[]) { return X; }; + public decltype005aClass[][] MX2(decltype005aClass X[][]) { return X; }; + public Object MO(Object O) { return O; }; + public Object[] MO1(Object[] O) { return O; }; + public Object[][] MO2(Object[][] O) { return O; }; + + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + + public decltype005aInter ME(decltype005aInter E) { return E; }; + public decltype005aInter[] ME1(decltype005aInter[] E) { return E; }; + public decltype005aInter[][] ME2(decltype005aInter[][] E) { return E; }; + + public decltype005aInter MEU(decltype005aInter E) { return E; }; + public decltype005aInter[] MEU1(decltype005aInter[] E) { return E; }; + public decltype005aInter[][] MEU2(decltype005aInter[][] E) { return E; }; +} + +interface decltype005aSameInter extends decltype005aMainInter { + // All methods are the same as in MainInter +} + +interface decltype005aMainInter { + void Mv(); + boolean Mz(boolean z); + boolean[] Mz1(boolean z[]); + boolean[][] Mz2(boolean z[][]); + byte Mb(byte b); + byte[] Mb1(byte b[]); + byte[][] Mb2(byte b[][]); + char Mc(char c); + char[] Mc1(char c[]); + char[][] Mc2(char c[][]); + double Md(double d); + double[] Md1(double d[]); + double[][] Md2(double d[][]); + float Mf(float f); + float[] Mf1(float f[]); + float[][] Mf2(float f[][]); + int Mi(int i); + int[] Mi1(int i[]); + int[][] Mi2(int i[][]); + long Ml(long l); + long[] Ml1(long l[]); + long[][] Ml2(long l[][]); + short Mr(short r); + short[] Mr1(short r[]); + short[][] Mr2(short r[][]); + + public void MvU(); + public long MlU(long l); + public long[] MlU1(long l[]); + public long[][] MlU2(long l[][]); + + decltype005aClass MX(decltype005aClass X); + decltype005aClass[] MX1(decltype005aClass X[]); + decltype005aClass[][] MX2(decltype005aClass X[][]); + Object MO(Object O); + Object[] MO1(Object[] O); + Object[][] MO2(Object[][] O); + + public Long MLU(Long L); + public Long[] MLU1(Long[] L); + public Long[][] MLU2(Long[][] L); + + decltype005aInter ME(decltype005aInter E); + decltype005aInter[] ME1(decltype005aInter[] E); + decltype005aInter[][] ME2(decltype005aInter[][] E); + + public decltype005aInter MEU(decltype005aInter E); + public decltype005aInter[] MEU1(decltype005aInter[] E); + public decltype005aInter[][] MEU2(decltype005aInter[][] E); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006.java new file mode 100644 index 00000000000..0787af781d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006.java @@ -0,0 +1,286 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class decltype006 { + final static String METHOD_NAME_CLASS[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvN", "MlN", "MlN1", "MlN2", + "MvS", "MlS", "MlS1", "MlS2", + "MvI", "MlI", "MlI1", "MlI2", + "MvY", "MlY", "MlY1", "MlY2", + "MvU", "MlU", "MlU1", "MlU2", + "MvR", "MlR", "MlR1", "MlR2", + "MvP", "MlP", "MlP1", "MlP2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + "MLN", "MLN1", "MLN2", + "MLS", "MLS1", "MLS2", + "MLI", "MLI1", "MLI2", + "MLY", "MLY1", "MLY2", + "MLU", "MLU1", "MLU2", + "MLR", "MLR1", "MLR2", + "MLP", "MLP1", "MLP2", + + "ME", "ME1", "ME2", + "MEN", "MEN1", "MEN2", + "MES", "ME1S", "ME2S", + "MEI", "MEI1", "MEI2", + "MEY", "MEY1", "MEY2", + "MEU", "MEU1", "MEU2", + "MER", "MER1", "MER2", + "MEP", "MEP1", "MEP2" + }; + final static String METHOD_NAME_INTER[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvU", "MlU", "MlU1", "MlU2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLU", "MLU1", "MLU2", + + "ME", "ME1", "ME2", + "MEU", "MEU1", "MEU2", + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype006"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String overClassName = prefix + "decltype006aOverridenClass"; + private final static String overInterName = prefix + "decltype006aOverridenInter"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType overClass; + ReferenceType overInter; + + // 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."); + } + + // Get OverridenClass and OverridenInter,from debugee + overClass = debugee.classByName(overClassName); + if (overClass == null) { + log.complain("debuger FAILURE> Class " + overClassName + " not " + + "found."); + return 2; + } + overInter = debugee.classByName(overInterName); + if (overClass == null) { + log.complain("debuger FAILURE> Interface " + overInterName + " not " + + "found."); + return 2; + } + + // Check all methods from OverridenClass + log.display("debuger> Total methods in " + overClassName + ": " + + + overClass.methods().size()); + for (int i = 0; i < METHOD_NAME_CLASS.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + ReferenceType declType; + boolean equal; + + try { + listOfMethods = overClass.methodsByName(METHOD_NAME_CLASS[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME_CLASS[i]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME_CLASS[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + declType = method.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 3> Declaring type is null " + + " for method " + name + " in class " + + overClassName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method " + name + " with declaring " + + "type " + declType.name() + " from class " + + overClassName + " read."); + try { + equal = declType.equals(overClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 4> Cannot compare reference " + + " types " + declType.name() + " and " + + overClassName); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 5> Declaring type of method " + + name + " is " + declType.name() + ", but should " + + "be " + overClassName); + testFailed = true; + } + } + + // Check all methods from OverridenInter + log.display("debuger> Total methods in " + overInterName + ": " + + + overInter.methods().size()); + for (int i = 0; i < METHOD_NAME_INTER.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + ReferenceType declType; + boolean equal; + + try { + listOfMethods = overInter.methodsByName(METHOD_NAME_INTER[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 6> Can't get method by name " + + METHOD_NAME_INTER[i]); + log.complain("debuger FAILURE 6> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 7> Number of methods by name " + + METHOD_NAME_INTER[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + declType = method.declaringType(); + if (declType == null) { + log.complain("debuger FAILURE 8> Declaring type is null " + + " for method " + name + " in class " + + overInterName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method " + name + " with declaring " + + "type " + declType.name() + " from class " + + overInterName + " read."); + try { + equal = declType.equals(overInter); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 9> Cannot compare reference " + + " types " + declType.name() + " and " + + overInterName); + log.complain("debuger FAILURE 9> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 10> Declaring type of method " + + name + " is " + declType.name() + ", but should " + + "be " + overInterName); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006/TestDescription.java new file mode 100644 index 00000000000..44de7b470c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006/TestDescription.java @@ -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/TypeComponent/declaringType/decltype006. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType006 checks assertion: + * public java.lang.String declaringType() + * 1. Returns the type in which a method was declared if the type mirrors + * a class in the target VM. + * 2. Returns the type in which a method was declared if the type mirrors + * an interface in the target VM. + * There are classes MainClass and OverridenClass extends MainClass and + * overrides all method; interfaces MainInter and OverridenInter that + * extends MainInter and overrides all method from it. + * Debugger gets each method from debuggee (OverridenClass and OverridenInter) + * calling by name and then checks if declaringType() returns reference + * type where all method were declared (OverridenClass and OverridenInter). + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype006 + * nsk.jdi.TypeComponent.declaringType.decltype006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006a.java new file mode 100644 index 00000000000..4cb7066753a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype006a.java @@ -0,0 +1,442 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype006a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + decltype006aOverridenClass overridenClass = new decltype006aOverridenClass(); + decltype006aImplClass implClass = new decltype006aImplClass(); + + 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); + } +} + +// User class and interface +class decltype006aClass {} +interface decltype006aInter {} + +class decltype006aOverridenClass extends decltype006aMainClass { + // All methods are overriden from decltype006aMainClass + + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + decltype006aClass MX(decltype006aClass X) { return X; }; + decltype006aClass[] MX1(decltype006aClass X[]) { return X; }; + decltype006aClass[][] MX2(decltype006aClass X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + decltype006aInter ME(decltype006aInter E) { return E; }; + decltype006aInter[] ME1(decltype006aInter[] E) { return E; }; + decltype006aInter[][] ME2(decltype006aInter[][] E) { return E; }; + + native decltype006aInter MEN(decltype006aInter E); + native decltype006aInter[] MEN1(decltype006aInter[] E); + native decltype006aInter[][] MEN2(decltype006aInter[][] E); + static decltype006aInter MES(decltype006aInter E) { return E; }; + static decltype006aInter[] ME1S(decltype006aInter[] E) { return E; }; + static decltype006aInter[][] ME2S(decltype006aInter[][] E) { return E; }; + strictfp decltype006aInter MEI(decltype006aInter E) { return E; }; + strictfp decltype006aInter[] MEI1(decltype006aInter[] E) { return E; }; + strictfp decltype006aInter[][] MEI2(decltype006aInter[][] E) { return E; }; + synchronized decltype006aInter MEY(decltype006aInter E) { return E; }; + synchronized decltype006aInter[] MEY1(decltype006aInter[] E) { return E; }; + synchronized decltype006aInter[][] MEY2(decltype006aInter[][] E) { return E; }; + public decltype006aInter MEU(decltype006aInter E) { return E; }; + public decltype006aInter[] MEU1(decltype006aInter[] E) { return E; }; + public decltype006aInter[][] MEU2(decltype006aInter[][] E) { return E; }; + protected decltype006aInter MER(decltype006aInter E) { return E; }; + protected decltype006aInter[] MER1(decltype006aInter[] E) { return E; }; + protected decltype006aInter[][] MER2(decltype006aInter[][] E) { return E; }; + private decltype006aInter MEP(decltype006aInter E) { return E; }; + private decltype006aInter[] MEP1(decltype006aInter[] E) { return E; }; + private decltype006aInter[][] MEP2(decltype006aInter[][] E) { return E; }; +} + +class decltype006aMainClass { + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + decltype006aClass MX(decltype006aClass X) { return X; }; + decltype006aClass[] MX1(decltype006aClass X[]) { return X; }; + decltype006aClass[][] MX2(decltype006aClass X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + decltype006aInter ME(decltype006aInter E) { return E; }; + decltype006aInter[] ME1(decltype006aInter[] E) { return E; }; + decltype006aInter[][] ME2(decltype006aInter[][] E) { return E; }; + + native decltype006aInter MEN(decltype006aInter E); + native decltype006aInter[] MEN1(decltype006aInter[] E); + native decltype006aInter[][] MEN2(decltype006aInter[][] E); + static decltype006aInter MES(decltype006aInter E) { return E; }; + static decltype006aInter[] ME1S(decltype006aInter[] E) { return E; }; + static decltype006aInter[][] ME2S(decltype006aInter[][] E) { return E; }; + strictfp decltype006aInter MEI(decltype006aInter E) { return E; }; + strictfp decltype006aInter[] MEI1(decltype006aInter[] E) { return E; }; + strictfp decltype006aInter[][] MEI2(decltype006aInter[][] E) { return E; }; + synchronized decltype006aInter MEY(decltype006aInter E) { return E; }; + synchronized decltype006aInter[] MEY1(decltype006aInter[] E) { return E; }; + synchronized decltype006aInter[][] MEY2(decltype006aInter[][] E) { return E; }; + public decltype006aInter MEU(decltype006aInter E) { return E; }; + public decltype006aInter[] MEU1(decltype006aInter[] E) { return E; }; + public decltype006aInter[][] MEU2(decltype006aInter[][] E) { return E; }; + protected decltype006aInter MER(decltype006aInter E) { return E; }; + protected decltype006aInter[] MER1(decltype006aInter[] E) { return E; }; + protected decltype006aInter[][] MER2(decltype006aInter[][] E) { return E; }; + private decltype006aInter MEP(decltype006aInter E) { return E; }; + private decltype006aInter[] MEP1(decltype006aInter[] E) { return E; }; + private decltype006aInter[][] MEP2(decltype006aInter[][] E) { return E; }; +} + +class decltype006aImplClass implements decltype006aOverridenInter { + public void Mv() {}; + public boolean Mz(boolean z) { return !z; }; + public boolean[] Mz1(boolean z[]) { return z; }; + public boolean[][] Mz2(boolean z[][]) { return z; }; + public byte Mb(byte b) { return b; }; + public byte[] Mb1(byte b[]) { return b; }; + public byte[][] Mb2(byte b[][]) { return b; }; + public char Mc(char c) { return c; }; + public char[] Mc1(char c[]) { return c; }; + public char[][] Mc2(char c[][]) { return c; }; + public double Md(double d) { return d; }; + public double[] Md1(double d[]) { return d; }; + public double[][] Md2(double d[][]) { return d; }; + public float Mf(float f) { return f; }; + public float[] Mf1(float f[]) { return f; }; + public float[][] Mf2(float f[][]) { return f; }; + public int Mi(int i) { return i; }; + public int[] Mi1(int i[]) { return i; }; + public int[][] Mi2(int i[][]) { return i; }; + public long Ml(long l) { return l; }; + public long[] Ml1(long l[]) { return l; }; + public long[][] Ml2(long l[][]) { return l; }; + public short Mr(short r) { return r; }; + public short[] Mr1(short r[]) { return r; }; + public short[][] Mr2(short r[][]) { return r; }; + + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + + public decltype006aClass MX(decltype006aClass X) { return X; }; + public decltype006aClass[] MX1(decltype006aClass X[]) { return X; }; + public decltype006aClass[][] MX2(decltype006aClass X[][]) { return X; }; + public Object MO(Object O) { return O; }; + public Object[] MO1(Object[] O) { return O; }; + public Object[][] MO2(Object[][] O) { return O; }; + + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + + public decltype006aInter ME(decltype006aInter E) { return E; }; + public decltype006aInter[] ME1(decltype006aInter[] E) { return E; }; + public decltype006aInter[][] ME2(decltype006aInter[][] E) { return E; }; + + public decltype006aInter MEU(decltype006aInter E) { return E; }; + public decltype006aInter[] MEU1(decltype006aInter[] E) { return E; }; + public decltype006aInter[][] MEU2(decltype006aInter[][] E) { return E; }; +} + +interface decltype006aOverridenInter extends decltype006aMainInter { + // All methods are overriden from decltype006aMainInter + + void Mv(); + boolean Mz(boolean z); + boolean[] Mz1(boolean z[]); + boolean[][] Mz2(boolean z[][]); + byte Mb(byte b); + byte[] Mb1(byte b[]); + byte[][] Mb2(byte b[][]); + char Mc(char c); + char[] Mc1(char c[]); + char[][] Mc2(char c[][]); + double Md(double d); + double[] Md1(double d[]); + double[][] Md2(double d[][]); + float Mf(float f); + float[] Mf1(float f[]); + float[][] Mf2(float f[][]); + int Mi(int i); + int[] Mi1(int i[]); + int[][] Mi2(int i[][]); + long Ml(long l); + long[] Ml1(long l[]); + long[][] Ml2(long l[][]); + short Mr(short r); + short[] Mr1(short r[]); + short[][] Mr2(short r[][]); + + public void MvU(); + public long MlU(long l); + public long[] MlU1(long l[]); + public long[][] MlU2(long l[][]); + + decltype006aClass MX(decltype006aClass X); + decltype006aClass[] MX1(decltype006aClass X[]); + decltype006aClass[][] MX2(decltype006aClass X[][]); + Object MO(Object O); + Object[] MO1(Object[] O); + Object[][] MO2(Object[][] O); + + public Long MLU(Long L); + public Long[] MLU1(Long[] L); + public Long[][] MLU2(Long[][] L); + + decltype006aInter ME(decltype006aInter E); + decltype006aInter[] ME1(decltype006aInter[] E); + decltype006aInter[][] ME2(decltype006aInter[][] E); + + public decltype006aInter MEU(decltype006aInter E); + public decltype006aInter[] MEU1(decltype006aInter[] E); + public decltype006aInter[][] MEU2(decltype006aInter[][] E); +} + + +interface decltype006aMainInter { + void Mv(); + boolean Mz(boolean z); + boolean[] Mz1(boolean z[]); + boolean[][] Mz2(boolean z[][]); + byte Mb(byte b); + byte[] Mb1(byte b[]); + byte[][] Mb2(byte b[][]); + char Mc(char c); + char[] Mc1(char c[]); + char[][] Mc2(char c[][]); + double Md(double d); + double[] Md1(double d[]); + double[][] Md2(double d[][]); + float Mf(float f); + float[] Mf1(float f[]); + float[][] Mf2(float f[][]); + int Mi(int i); + int[] Mi1(int i[]); + int[][] Mi2(int i[][]); + long Ml(long l); + long[] Ml1(long l[]); + long[][] Ml2(long l[][]); + short Mr(short r); + short[] Mr1(short r[]); + short[][] Mr2(short r[][]); + + public void MvU(); + public long MlU(long l); + public long[] MlU1(long l[]); + public long[][] MlU2(long l[][]); + + decltype006aClass MX(decltype006aClass X); + decltype006aClass[] MX1(decltype006aClass X[]); + decltype006aClass[][] MX2(decltype006aClass X[][]); + Object MO(Object O); + Object[] MO1(Object[] O); + Object[][] MO2(Object[][] O); + + public Long MLU(Long L); + public Long[] MLU1(Long[] L); + public Long[][] MLU2(Long[][] L); + + decltype006aInter ME(decltype006aInter E); + decltype006aInter[] ME1(decltype006aInter[] E); + decltype006aInter[][] ME2(decltype006aInter[][] E); + + public decltype006aInter MEU(decltype006aInter E); + public decltype006aInter[] MEU1(decltype006aInter[] E); + public decltype006aInter[][] MEU2(decltype006aInter[][] E); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007.java new file mode 100644 index 00000000000..b63ecf1849e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007.java @@ -0,0 +1,148 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class decltype007 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype007"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String mainClassName = prefix + "decltype007aMainClass"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType mainClass; + List methods; + + // 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."); + } + + mainClass = debugee.classByName(mainClassName); + if (mainClass == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + + // Get all methods, find constructors and static initializers and + // check them + try { + methods = mainClass.methods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods read " + + totalMethods); + return 2; + } + log.display("debuger> Total methods found: " + totalMethods); + Iterator methodsIterator = methods.iterator(); + for (int i = 0; methodsIterator.hasNext(); i++) { + Method method = (Method)methodsIterator.next(); + String name = method.name(); + ReferenceType declType = method.declaringType(); + String declTypeName = declType.name(); + boolean equal; + + log.display("debuger> " + i + " method " + name + " from " + + declTypeName + " with sign " + method.signature() + + " read."); + if (method.isConstructor() || method.isStaticInitializer()) { + try { + equal = declType.equals(mainClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 1> Cannot compare reference " + + " types " + declType.name() + " and " + + mainClassName); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 2> Declaring type of " + + name + " is " + declTypeName + ", but should " + + "be " + mainClassName); + testFailed = true; + } + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007/TestDescription.java new file mode 100644 index 00000000000..e0f64c55159 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007/TestDescription.java @@ -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/TypeComponent/declaringType/decltype007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType007 checks assertion: + * public java.lang.String declaringType() + * 1. Returns the type in which a method was declared if the type mirrors + * a class in the target VM. + * Debugger gets all methods from debuggee (MainClass), finds constructors and + * static initializers and then checks if declaringType() returns the same + * reference type. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype007 + * nsk.jdi.TypeComponent.declaringType.decltype007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007a.java new file mode 100644 index 00000000000..71a185a04eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007a.java @@ -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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype007a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + decltype007aMainClass mainClass = new decltype007aMainClass(); + + 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 decltype007aMainClass { + decltype007aMainClass() {}; + public decltype007aMainClass(long l) {}; + private decltype007aMainClass(Object obj) {}; + protected decltype007aMainClass(long[] l) {}; + + static int ci; + static Long cL; + static long[] cl = new long[10]; + + static { ci = 1; } + static { cL = new Long(1l); } + static { + for (int i = 0; i < 10; i++) { + cl[i] = (long)i; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008.java new file mode 100644 index 00000000000..6f21d63e9d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008.java @@ -0,0 +1,212 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class decltype008 { + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.declaringType."; + private final static String className = "decltype008"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String mainClassName = prefix + "decltype008aMainClass"; + private final static String otherClassName = prefix + "decltype008aOtherClass"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + ReferenceType mainClass; + ReferenceType otherClass; + List methods; + + // 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."); + } + + mainClass = debugee.classByName(mainClassName); + if (mainClass == null) { + log.complain("debuger FAILURE> Class " + mainClassName + " not " + + "found."); + return 2; + } + otherClass = debugee.classByName(otherClassName); + if (otherClass == null) { + log.complain("debuger FAILURE> Class " + otherClassName + " not " + + "found."); + return 2; + } + + // Get all methods, find constructors and static initializers and + // check them + try { + methods = otherClass.visibleMethods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods read " + + totalMethods); + return 2; + } + log.display("debuger> Total methods found: " + totalMethods); + Iterator methodsIterator = methods.iterator(); + for (int i = 0; methodsIterator.hasNext(); i++) { + Method method = (Method)methodsIterator.next(); + String name = method.name(); + ReferenceType declType = method.declaringType(); + String declTypeName = declType.name(); + String signature = method.signature(); + + if (method.isStaticInitializer()) { + // Static initializers are in OtherClass only + boolean equal; + + log.display("debuger> " + i + " static initializer " + name + + " from " + declTypeName + " with signature " + + signature + " read."); + try { + equal = declType.equals(otherClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 1> Cannot compare reference " + + " types " + declType.name() + " and " + + otherClassName); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + if (!equal) { + log.complain("debuger FAILURE 2> Declaring type of " + + name + " is " + declTypeName + ", but should " + + "be " + otherClassName); + testFailed = true; + } + } else { + if (method.isConstructor()) { + boolean equalOther; + boolean equalMain; + // Constructors from OtherClass starts with reference to + // String object + boolean fromOther = + signature.startsWith("(Ljava/lang/String;"); + // Constructors from MainClass starts with reference to + // Long object + boolean fromMain = + signature.startsWith("(Ljava/lang/Long;"); + + log.display("debuger> " + i + " constructor " + name + + " from " + declTypeName + " with signature " + + signature + " read."); + try { + equalOther = declType.equals(otherClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 3> Cannot compare " + + " reference types " + declType.name() + + " and " + otherClassName); + log.complain("debuger FAILURE 3> Exception: " + e); + testFailed = true; + continue; + } + try { + equalMain = declType.equals(mainClass); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE 4> Cannot compare " + + " reference types " + declType.name() + + " and " + mainClassName); + log.complain("debuger FAILURE 4> Exception: " + e); + testFailed = true; + continue; + } + + if (fromOther && !equalOther) { + log.complain("debuger FAILURE 5> Declaring type of " + + name + " is " + declTypeName + ", but should " + + "be " + otherClassName); + testFailed = true; + } + if (fromMain && !equalMain) { + log.complain("debuger FAILURE 6> Declaring type of " + + name + " is " + declTypeName + ", but should " + + "be " + mainClassName); + testFailed = true; + } + } else { + log.display("debuger> " + i + " method " + name + " from " + + declTypeName + " with signature " + + signature + " passed."); + } + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008/TestDescription.java new file mode 100644 index 00000000000..546c018fe63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008/TestDescription.java @@ -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/TypeComponent/declaringType/decltype008. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the declaringType() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public ReferenceType declaringType() + * Returns the type in which this component was declared. The returned + * ReferenceType mirrors either a class or an interface in the target VM. + * nsk/jdi/TypeComponent/declaringType/declType008 checks assertion: + * public java.lang.String declaringType() + * 1. Returns the type in which a method was declared if the type mirrors + * a class in the target VM. + * There are classes MainClass and OtherClass that extends MainClass in + * target VM. Both classes have constructors and static initializers. + * Debugger gets all visible methods from debuggee (OtherClass), finds + * constructors and static initializers and checks their declaring types. For + * all initializers declaring type must be OtherClass. Each constructor + * that signature begins with reference to Long object must have declaring + * type MainClass. Each constructor that signature begins with reference to + * String object must have declaring type OtherClass. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.declaringType.decltype008 + * nsk.jdi.TypeComponent.declaringType.decltype008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008a.java new file mode 100644 index 00000000000..beee2e30f08 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008a.java @@ -0,0 +1,96 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class decltype008a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + decltype008aOtherClass otherClass = new decltype008aOtherClass(new String("decltype008a"), 1f); + + 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 decltype008aOtherClass extends decltype008aMainClass { + // All contructors from decltype008aOtherClass starts with reference to String object + public decltype008aOtherClass(String S, float f) { + super(new Long(1), f); + }; + private decltype008aOtherClass(String S, Object obj){ + super(new Long(1), obj); + }; + protected decltype008aOtherClass(String S, long[] l) { + super(new Long(1), l); + }; + + static double cd; + static String cS; + static float[] cf = new float[10]; + + static { cd = 1; } + static { cS = new String(); } + static { + for (int i = 0; i < 10; i++) { + cf[i] = (float)i; + } + } +} + +class decltype008aMainClass { + // All contructors from decltype008aMainClass starts with reference to Long object + decltype008aMainClass(Long L, float f) {}; + decltype008aMainClass(Long L, Object obj) {}; + decltype008aMainClass(Long L, long[] l) {}; + + static int ci; + static Long cL; + static long[] cl = new long[10]; + + static { ci = 1; } + static { cL = new Long(1l); } + static { + for (int i = 0; i < 10; i++) { + cl[i] = (long)i; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009.java new file mode 100644 index 00000000000..9681c05fb04 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009.java @@ -0,0 +1,143 @@ +/* + * 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.TypeComponent.declaringType; + +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 decltype009 { + + //------------------------------------------------------- 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.TypeComponent.declaringType."; + private final static String className = "decltype009"; + 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() { + 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.declaringType().equals(checkedClass)) { + display("enum " + className + " has field " + expectedEnumFieldsNames[i]); + display("\t of expected type " + className); + } else { + complain("enum " + className + " has field " + expectedEnumFieldsNames[i]); + complain("\t of unexpected type " + foundField.declaringType().name()); + 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009/TestDescription.java new file mode 100644 index 00000000000..1e287051af1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009/TestDescription.java @@ -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/TypeComponent/declaringType/decltype009. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for declaringType() method of TypeComponent interface. + * The test checks if the method returns correct result for + * each enum constant field declared in mirrored enum type. + * The test consists of a debugger program (decltype009.java) + * and debuggee application (decltype009a.java). + * Package name is nsk.jdi.TypeComponent.declaringType . + * 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 finds mirrors of enum types. Every of these + * enum types has the same enum constant fields: e1 and e2. + * The debugger checks if declaringType() method returns + * enum type itself as declaring for each enum constans. + * 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.TypeComponent.declaringType.decltype009 + * nsk.jdi.TypeComponent.declaringType.decltype009a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.declaringType.decltype009 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009a.java new file mode 100644 index 00000000000..74fbd31232f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009a.java @@ -0,0 +1,107 @@ +/* + * 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.TypeComponent.declaringType; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class decltype009a { + + //------------------------------------------------------- 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 decltype009Enum1 f1 = decltype009Enum1.e2; + static decltype009Enum2 f2 = decltype009Enum2.e1; + static decltype009Enum1.Enum1_ f3 = decltype009Enum1.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(decltype009.SIGNAL_READY); + receiveSignal(decltype009.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum decltype009Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum decltype009Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001.java new file mode 100644 index 00000000000..498e6adefaa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001.java @@ -0,0 +1,300 @@ +/* + * 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.TypeComponent.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the TypeComponent.genericSignature() method.
    + *
    + * The test checks up TypeComponent.genericSignature() method
    + * for Field objects.
    + *
    + * The first: the test checks that genericSignature() method returns
    + * null for fields of all primitive types and for fields which are
    + * arrays of primitive types.
    + *
    + * The second: the test checks that genericSignature() method returns
    + * null for fields whivh are arrays of non-generic reference types.
    + *
    + * The third: the test checks that genericSignature() method returns
    + * null for fields of non-generic reference types.
    + *
    + * At last: the test checks that genericSignature() method returns
    + * a corresponding signature string for fields of generic reference
    + * types.
    + *
    + */ + +public class genericSignature001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature001: "; + static final String infoLogPrefix = "--> "; + static final String packagePrefix = "nsk.jdi.TypeComponent.genericSignature."; + static final String targetVMClassName = packagePrefix + "genericSignature001a"; + + static ArgumentHandler argsHandler; + static Log logHandler; + static boolean verboseMode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + + private final static String primitiveTypeSign = "primitiveType"; + private final static String referenceTypeSign = "referenceType"; + + /** + * Debugee's fields for check: + * fieldsForCheck[i][0] - field name + * fieldsForCheck[i][1] - expected string returned by genericSignature() + */ + private final static String fieldsForCheck[][] = { + {"z0", null}, + {"b0", null}, + {"c0", null}, + {"d0", null}, + {"f0", null}, + {"i0", null}, + {"l0", null}, + + {"z1", null}, + {"b1", null}, + {"c1", null}, + {"d1", null}, + {"f1", null}, + {"i1", null}, + {"l1", null}, + + {"z2", null}, + {"b2", null}, + {"c2", null}, + {"d2", null}, + {"f2", null}, + {"i2", null}, + {"l2", null}, + + {"GS001_Class01_Obj0", null}, + {"GS001_Class02_Obj0", null}, + {"GS001_Class03_Obj0", null}, + {"GS001_Class04_Obj0", null}, + {"GS001_Class05_Obj0", null}, + + {"GS001_Class01_Obj1", null}, + {"GS001_Class02_Obj1", null}, + {"GS001_Class03_Obj1", null}, + {"GS001_Class04_Obj1", null}, + {"GS001_Class05_Obj1", null}, + + {"GS001_Class01_Obj2", null}, + {"GS001_Class02_Obj2", null}, + {"GS001_Class03_Obj2", null}, + {"GS001_Class04_Obj2", null}, + {"GS001_Class05_Obj2", null}, + + {"GS001_Class06_Obj", + "Lnsk/jdi/TypeComponent/genericSignature/GS001_Class06;"}, + {"GS001_Class07_Obj", + "Lnsk/jdi/TypeComponent/genericSignature/GS001_Class07;"}, + {"GS001_Class08_Obj", + "Lnsk/jdi/TypeComponent/genericSignature/GS001_Class08;"}, + {"GS001_Class09_Obj", + "Lnsk/jdi/TypeComponent/genericSignature/GS001_Class09;"}, + {"GS001_Class10_Obj", + "Lnsk/jdi/TypeComponent/genericSignature/GS001_Class10;"} + + }; + + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + 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) { + + int result = new genericSignature001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/TypeComponent/genericSignature/genericSignature001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/TypeComponent/genericSignature/genericSignature001 test PASSED"); + } + return result; + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + verboseMode = argsHandler.verbose(); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/TypeComponent/genericSignature/genericSignature001 test..."); + logOnVerbose + ("==> Test checks the genericSignature() method of TypeComponent interface"); + logOnVerbose + ("==> of the com.sun.jdi package for Field objects."); + + Binder binder = new Binder(argsHandler,logHandler); + Debugee debugee = binder.bindToDebugee(targetVMClassName); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + logOnVerbose(infoLogPrefixHead + "Debugee (" + targetVMClassName + ") launched..."); + debugee.resume(); + + String readySignal = "ready"; + String signalFromDebugee = pipe.readln(); + if ( ! readySignal.equals(signalFromDebugee) ) { + logOnError(errorLogPrefixHead + "Uexpected debugee's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + readySignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugee + "'"); + return STATUS_FAILED; + } + logOnVerbose(infoLogPrefixHead + "Debugee's signal recieved = '" + readySignal + "'"); + + logOnVerbose(infoLogPrefixHead + "Request ReferenceType object for debugee's class..."); + ReferenceType targetVMClass = null; + try { + targetVMClass = debugee.classByName(targetVMClassName); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "Unexpected exception during requesting ReferenceType: "); + logOnError(errorLogPrefix + "Requested class name = '" + targetVMClassName + "'"); + logOnError(errorLogPrefix + "Exception = '" + thrown + "'"); + return STATUS_FAILED; + } + if (targetVMClass == null) { + logOnError(errorLogPrefixHead + "Could NOT find ReferenceType object for debugee's class: "); + logOnError(errorLogPrefix + "Requested class name = '" + targetVMClassName + "'"); + return STATUS_FAILED; + } + + logOnVerbose(infoLogPrefixHead + "check TypeComponent.genericSignature() method for debugee's fields..."); + String brackets[] = {"", "[]", "[][]"}; + for (int i=0; i < fieldsForCheck.length; i++) { + String checkedFieldName = fieldsForCheck[i][0]; + + TypeComponent checkedField = null; + try { + checkedField = targetVMClass.fieldByName(checkedFieldName); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "ReferenceType.fieldByName() throws unexpected exception: "); + logOnError(errorLogPrefix + "Class name = '" + targetVMClassName + "'"); + logOnError(errorLogPrefix + "Requested field name = '" + checkedFieldName + "'"); + testResult = STATUS_FAILED; + continue; + } + if (checkedField == null) { + logOnError(errorLogPrefixHead + "Could NOT find Field object in debugee's class: "); + logOnError(errorLogPrefix + "Debugee's class name = '" + targetVMClassName + "'"); + logOnError(errorLogPrefix + "Requested field name = '" + checkedFieldName + "'"); + testResult = STATUS_FAILED; + continue; + } + String expectedGenericSignature = fieldsForCheck[i][1]; + String actualGenericSignature = null; + try { + actualGenericSignature = checkedField.genericSignature(); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "TypeComponent.genericSignature() throws unexpected exception: "); + logOnError(errorLogPrefix + "TypeComponent = '" + checkedField + "'"); + logOnError(errorLogPrefix + "Field name for this TypeComponent = '" + checkedFieldName + "'"); + testResult = STATUS_FAILED; + continue; + } + boolean isFailure = false; + if ( expectedGenericSignature == null ) { + if ( actualGenericSignature != null ) { + isFailure = true; + } + } else { + if ( ! expectedGenericSignature.equals(actualGenericSignature) ) { + isFailure = true; + } + } + if ( isFailure ) { + logOnError(errorLogPrefixHead + "TypeComponent.genericSignature() returns unexpected signature: "); + logOnError(errorLogPrefix + "TypeComponent = '" + checkedField + "'"); + logOnError(errorLogPrefix + "Field name for this TypeComponent = '" + checkedFieldName + "'"); + logOnError(errorLogPrefix + "Expected generic signature = '" + expectedGenericSignature + "'"); + logOnError(errorLogPrefix + "Actual generic signature = '" + actualGenericSignature + "'"); + testResult = STATUS_FAILED; + } + + } + logOnVerbose(infoLogPrefixHead + + "Check TypeComponent.genericSignature() method for debugee's fields completed."); + + logOnVerbose(infoLogPrefixHead + "Waiting for debugee finish..."); + String quitSignal = "quit"; + pipe.println(quitSignal); + debugee.waitFor(); + + int debugeeExitStatus = debugee.getStatus(); + if (debugeeExitStatus != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Unexpected Debugee's exit status: "); + logOnError(errorLogPrefix + "Expected status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + logOnError(errorLogPrefix + "Actual status = '" + debugeeExitStatus + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of genericSignature001 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001/TestDescription.java new file mode 100644 index 00000000000..db4afdc1d3f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/TypeComponent/genericSignature/genericSignature001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/TypeComponent/genericSignature/genericSignature001 test: + * The test for the TypeComponent.genericSignature() method. + * The test checks up TypeComponent.genericSignature() method + * for Field objects. + * The first: the test checks that genericSignature() method returns + * null for fields of all primitive types and for fields which are + * arrays of primitive types. + * The second: the test checks that genericSignature() method returns + * null for fields whivh are arrays of non-generic reference types. + * The third: the test checks that genericSignature() method returns + * null for fields of non-generic reference types. + * At last: the test checks that genericSignature() method returns + * a corresponding signature string for fields of generic reference + * types. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.genericSignature.genericSignature001 + * nsk.jdi.TypeComponent.genericSignature.genericSignature001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.genericSignature.genericSignature001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001a.java new file mode 100644 index 00000000000..6fe6f41c89f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001a.java @@ -0,0 +1,168 @@ +/* + * 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.TypeComponent.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for + * the nsk/jdi/TypeComponent/genericSignature/genericSignature001 JDI test. + */ + +public class genericSignature001a { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature001(Debugee): "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature001(Debugee): "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + // primitive type fields and arrays of primitive types + // for check TypeComponent.genericSignature() method + + 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}; + + // non-generic reference type fields and arrays of non-generic reference types + // for check TypeComponent.genericSignature() method + + GS001_Class01 GS001_Class01_Obj0 = new GS001_Class01(), + GS001_Class01_Obj1[]={GS001_Class01_Obj0}, + GS001_Class01_Obj2[][]={GS001_Class01_Obj1}; + + GS001_Class02 GS001_Class02_Obj0 = new GS001_Class02(), + GS001_Class02_Obj1[]={GS001_Class02_Obj0}, + GS001_Class02_Obj2[][]={GS001_Class02_Obj1}; + + GS001_Class03 GS001_Class03_Obj0 = new GS001_Class03(), + GS001_Class03_Obj1[]={GS001_Class03_Obj0}, + GS001_Class03_Obj2[][]={GS001_Class03_Obj1}; + + GS001_Class04 GS001_Class04_Obj0 = new GS001_Class04(), + GS001_Class04_Obj1[]={GS001_Class04_Obj0}, + GS001_Class04_Obj2[][]={GS001_Class04_Obj1}; + + GS001_Class05 GS001_Class05_Obj0 = new GS001_Class05(), + GS001_Class05_Obj1[]={GS001_Class05_Obj0}, + GS001_Class05_Obj2[][]={GS001_Class05_Obj1}; + + // generic type fields for check TypeComponent.genericSignature() method + + GS001_Class06 GS001_Class06_Obj = new GS001_Class06(); + + GS001_Class07 GS001_Class07_Obj = + new GS001_Class07(); + + GS001_Class08 GS001_Class08_Obj = new GS001_Class08(); + + GS001_Class09 GS001_Class09_Obj = new GS001_Class09(); + + GS001_Class10 GS001_Class10_Obj = + new GS001_Class10(); + + + public static void main (String argv[]) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(System.err, argsHandler); + logHandler.enableErrorsSummary(false); + IOPipe pipe = argsHandler.createDebugeeIOPipe(); + + logOnVerbose(infoLogPrefixHead + "Debugee started!"); + + genericSignature001a genericSignature001aDebugee = new genericSignature001a(); + + String readySignal = "ready"; + pipe.println(readySignal); + String quitSignal = "quit"; + logOnVerbose(infoLogPrefixHead + "Wait for '" + quitSignal + "' signal..."); + String signalFromDebugger = pipe.readln(); + if ( ! (quitSignal.equals(signalFromDebugger)) ) { + logOnError(errorLogPrefixHead + "UNEXPECTED debugger's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + quitSignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugger + "'"); + logOnError(errorLogPrefix + "Exiting with Exit Status = '" + (STATUS_FAILED + STATUS_TEMP) + "'"); + System.exit(STATUS_FAILED + STATUS_TEMP); + } + logOnVerbose(infoLogPrefixHead + "'" + quitSignal + "' signal from debugger is received."); + logOnVerbose(infoLogPrefix + "Exiting with Exit Status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + System.exit(STATUS_PASSED + STATUS_TEMP); + } +} // end of genericSignature001a class + + +// non generic classes: + +class GS001_Class01 {} + +class GS001_Class02 {} + +interface GS001_Interf01 {} + +interface GS001_Interf02 {} + +class GS001_Class03 extends GS001_Class01 {} + +class GS001_Class04 extends GS001_Class01 implements GS001_Interf01 {} + +class GS001_Class05 extends GS001_Class02 implements GS001_Interf02 {} + + +// generic classes: + +class GS001_Class06 {} + +class GS001_Class07 {} + +class GS001_Class08 {} + +class GS001_Class09 {} + +class GS001_Class10 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002.java new file mode 100644 index 00000000000..0257c81a9b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002.java @@ -0,0 +1,298 @@ +/* + * 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.TypeComponent.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the TypeComponent.genericSignature() method.
    + *
    + * The test checks up TypeComponent.genericSignature() method
    + * for Method objects.
    + *
    + * The first: the test checks that genericSignature() method returns
    + * null for methods which have not generic signature. The methods with
    + * different sets of arguments and with different returned types are
    + * used.
    + *
    + * The second: the test checks that genericSignature() method returns
    + * a corresponding signature string for methods which have generic
    + * signature. The methods with different sets of generic types
    + * arguments and with different returned generic types are used.
    + *
    + */ + +public class genericSignature002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature002: "; + static final String infoLogPrefix = "--> "; + static final String packagePrefix = "nsk.jdi.TypeComponent.genericSignature."; + static final String targetVMClassName = packagePrefix + "genericSignature002a"; + + static ArgumentHandler argsHandler; + static Log logHandler; + static boolean verboseMode = false; // test argument -verbose switches to true + // - for more easy failure evaluation + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + + private final static String primitiveTypeSign = "primitiveType"; + private final static String referenceTypeSign = "referenceType"; + + /** + * Debugee's methods for check: + * methodsForCheck[i][0] - method name + * methodsForCheck[i][1] - expected string returned by genericSignature() + */ + private final static String methodsForCheck[][] = { + {"testMethod_001", null}, + {"testMethod_002", null}, + {"testMethod_003", null}, + {"testMethod_004", null}, + {"testMethod_005", null}, + {"testMethod_006", null}, + {"testMethod_007", null}, + {"testMethod_008", null}, + {"testMethod_009", null}, + {"testMethod_010", null}, + {"testMethod_011", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class06;)V"}, + {"testMethod_012", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class06;)Lnsk/jdi/TypeComponent/genericSignature/GS002_Class06;"}, + {"testMethod_013", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class07;)V"}, + {"testMethod_014", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class07;)Lnsk/jdi/TypeComponent/genericSignature/GS002_Class07;"}, + {"testMethod_015", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class08;)V"}, + {"testMethod_016", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class08;)Lnsk/jdi/TypeComponent/genericSignature/GS002_Class08;"}, + {"testMethod_017", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class09;)V"}, + {"testMethod_018", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class09;)Lnsk/jdi/TypeComponent/genericSignature/GS002_Class09;"}, + {"testMethod_019", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class10;)V"}, + {"testMethod_020", + "(Lnsk/jdi/TypeComponent/genericSignature/GS002_Class10;)Lnsk/jdi/TypeComponent/genericSignature/GS002_Class10;"}, + {"testMethod_021", + "()V"}, + {"testMethod_022", + "(TC;)V"}, + {"testMethod_023", + "(TC;)TC;"}, + {"testMethod_024", + "()V"}, + {"testMethod_025", + "(TC1;TC2;)V"}, + {"testMethod_026", + "(TC1;TC2;)TC2;"}, + {"testMethod_027", + "()V"}, + {"testMethod_028", + "(TC2;TC1;)V"}, + {"testMethod_029", + "(TC2;TC1;)TC1;"}, + + }; + + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + 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) { + + int result = new genericSignature002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/TypeComponent/genericSignature/genericSignature002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/TypeComponent/genericSignature/genericSignature002 test PASSED"); + } + return result; + } + + /** + * Non-static variant of the method run(args,out) + */ + private int runThis (String argv[], PrintStream out) { + + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + verboseMode = argsHandler.verbose(); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/TypeComponent/genericSignature/genericSignature002 test..."); + logOnVerbose + ("==> Test checks the genericSignature() method of TypeComponent interface"); + logOnVerbose + ("==> of the com.sun.jdi package for Method objects."); + + Binder binder = new Binder(argsHandler,logHandler); + Debugee debugee = binder.bindToDebugee(targetVMClassName); + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + logOnVerbose(infoLogPrefixHead + "Debugee (" + targetVMClassName + ") launched..."); + debugee.resume(); + + String readySignal = "ready"; + String signalFromDebugee = pipe.readln(); + if ( ! readySignal.equals(signalFromDebugee) ) { + logOnError(errorLogPrefixHead + "Uexpected debugee's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + readySignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugee + "'"); + return STATUS_FAILED; + } + logOnVerbose(infoLogPrefixHead + "Debugee's signal recieved = '" + readySignal + "'"); + + logOnVerbose(infoLogPrefixHead + "Request ReferenceType object for debugee's class..."); + ReferenceType targetVMClass = null; + try { + targetVMClass = debugee.classByName(targetVMClassName); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "Unexpected exception during requesting ReferenceType: "); + logOnError(errorLogPrefix + "Requested class name = '" + targetVMClassName + "'"); + logOnError(errorLogPrefix + "Exception = '" + thrown + "'"); + return STATUS_FAILED; + } + if (targetVMClass == null) { + logOnError(errorLogPrefixHead + "Could NOT find ReferenceType object for debugee's class: "); + logOnError(errorLogPrefix + "Requested class name = '" + targetVMClassName + "'"); + return STATUS_FAILED; + } + + logOnVerbose(infoLogPrefixHead + "check TypeComponent.genericSignature() method for debugee's methods..."); + String brackets[] = {"", "[]", "[][]"}; + for (int i=0; i < methodsForCheck.length; i++) { + String checkedMethodName = methodsForCheck[i][0]; + + List checkedMethodList = null; + try { + checkedMethodList = targetVMClass.methodsByName(checkedMethodName); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "ReferenceType.methodsByName() throws unexpected exception: "); + logOnError(errorLogPrefix + "Class name = '" + targetVMClassName + "'"); + logOnError(errorLogPrefix + "Requested method name = '" + checkedMethodName + "'"); + testResult = STATUS_FAILED; + continue; + } + + if (checkedMethodList.size() != 1) { + logOnError(errorLogPrefixHead + "ReferenceType.methodsByName() returns unexpected number of methods:"); + logOnError(errorLogPrefix + "Debugee's class name = '" + targetVMClassName + "'"); + logOnError(errorLogPrefix + "Requested method name = '" + checkedMethodName + "'"); + logOnError(errorLogPrefix + "Expected number of methods = 1"); + logOnError(errorLogPrefix + "Actual number of methods = " + checkedMethodList.size()); + testResult = STATUS_FAILED; + continue; + } + + TypeComponent checkedMethod = (TypeComponent)(checkedMethodList.get(0)); + + String expectedGenericSignature = methodsForCheck[i][1]; + String actualGenericSignature = null; + try { + actualGenericSignature = checkedMethod.genericSignature(); + } catch (Throwable thrown) { + logOnError(errorLogPrefixHead + "TypeComponent.genericSignature() throws unexpected exception: "); + logOnError(errorLogPrefix + "TypeComponent = '" + checkedMethod + "'"); + logOnError(errorLogPrefix + "Method name for this TypeComponent = '" + checkedMethodName + "'"); + testResult = STATUS_FAILED; + continue; + } + boolean isFailure = false; + if ( expectedGenericSignature == null ) { + if ( actualGenericSignature != null ) { + isFailure = true; + } + } else { + if ( ! expectedGenericSignature.equals(actualGenericSignature) ) { + isFailure = true; + } + } + if ( isFailure ) { + logOnError(errorLogPrefixHead + "TypeComponent.genericSignature() returns unexpected signature: "); + logOnError(errorLogPrefix + "TypeComponent = '" + checkedMethod + "'"); + logOnError(errorLogPrefix + "Method name for this TypeComponent = '" + checkedMethodName + "'"); + logOnError(errorLogPrefix + "Expected generic signature = '" + expectedGenericSignature + "'"); + logOnError(errorLogPrefix + "Actual generic signature = '" + actualGenericSignature + "'"); + testResult = STATUS_FAILED; + } + + } + logOnVerbose(infoLogPrefixHead + + "Check TypeComponent.genericSignature() method for debugee's methods completed."); + + logOnVerbose(infoLogPrefixHead + "Waiting for debugee finish..."); + String quitSignal = "quit"; + pipe.println(quitSignal); + debugee.waitFor(); + + int debugeeExitStatus = debugee.getStatus(); + if (debugeeExitStatus != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Unexpected Debugee's exit status: "); + logOnError(errorLogPrefix + "Expected status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + logOnError(errorLogPrefix + "Actual status = '" + debugeeExitStatus + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } +} // end of genericSignature002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002/TestDescription.java new file mode 100644 index 00000000000..6922d34f273 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002/TestDescription.java @@ -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/TypeComponent/genericSignature/genericSignature002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * nsk/jdi/TypeComponent/genericSignature/genericSignature002 test: + * The test for the TypeComponent.genericSignature() method. + * The test checks up TypeComponent.genericSignature() method + * for Method objects. + * The first: the test checks that genericSignature() method returns + * null for methods which have not generic signature. The methods with + * different sets of arguments and with different returned types are + * used. + * The second: the test checks that genericSignature() method returns + * a corresponding signature string for methods which have generic + * signature. The methods with different sets of generic types + * arguments and with different returned generic types are used. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.genericSignature.genericSignature002 + * nsk.jdi.TypeComponent.genericSignature.genericSignature002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.genericSignature.genericSignature002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002a.java new file mode 100644 index 00000000000..de3b50167c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002a.java @@ -0,0 +1,344 @@ +/* + * 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.TypeComponent.genericSignature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for + * the nsk/jdi/TypeComponent/genericSignature/genericSignature002 JDI test. + */ + +public class genericSignature002a { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "genericSignature002(Debugee): "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> genericSignature002(Debugee): "; + static final String infoLogPrefix = "--> "; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + // methods without generic signature + // for check TypeComponent.genericSignature() method + + void testMethod_001() + { + } + + void testMethod_002 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + } + + boolean testMethod_003 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return booleanArg; + } + + byte testMethod_004 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return byteArg; + } + + char testMethod_005 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return charArg; + } + + double testMethod_006 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return doubleArg; + } + + float testMethod_007 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return floatArg; + } + + int testMethod_008 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return intArg; + } + + long testMethod_009 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return longArg; + } + + Object testMethod_010 ( + boolean booleanArg, + byte byteArg, + char charArg, + double doubleArg, + float floatArg, + int intArg, + long longArg, + Object objectArg) + { + return objectArg; + } + + // methods with generic signature + // for check TypeComponent.genericSignature() method + + void testMethod_011 ( + GS002_Class06 GS002_Class06_Arg) + { + } + + GS002_Class06 testMethod_012 ( + GS002_Class06 GS002_Class06_Arg) + { + return GS002_Class06_Arg; + } + + void testMethod_013 ( + GS002_Class07 GS002_Class07_Arg) + { + } + + GS002_Class07 testMethod_014 ( + GS002_Class07 GS002_Class07_Arg) + { + return GS002_Class07_Arg; + } + + void testMethod_015 ( + GS002_Class08 GS002_Class08_Arg) + { + } + + GS002_Class08 testMethod_016 ( + GS002_Class08 GS002_Class08_Arg) + { + return GS002_Class08_Arg; + } + + void testMethod_017 ( + GS002_Class09 GS002_Class09_Arg) + { + } + + GS002_Class09 testMethod_018 ( + GS002_Class09 GS002_Class09_Arg) + { + return GS002_Class09_Arg; + } + + void testMethod_019 ( + GS002_Class10 GS002_Class10_Arg) + { + } + + GS002_Class10 testMethod_020 ( + GS002_Class10 GS002_Class10_Arg) + { + return GS002_Class10_Arg; + } + + + void testMethod_021 () + { + } + + void testMethod_022 (C C_Arg) + { + } + + C testMethod_023 (C C_Arg) + { + return C_Arg; + } + + void testMethod_024 () + { + } + + void testMethod_025 (C1 C1_Arg, C2 C2_Arg) + { + } + + C2 testMethod_026 (C1 C1_Arg, C2 C2_Arg) + { + return C2_Arg; + } + + void testMethod_027 () + { + } + + void testMethod_028 ( + C2 C2_Arg, C1 C1_Arg) + { + } + + + C1 testMethod_029 ( + C2 C2_Arg, C1 C1_Arg) + { + return C1_Arg; + } + + + public static void main (String argv[]) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(System.err, argsHandler); + logHandler.enableErrorsSummary(false); + IOPipe pipe = argsHandler.createDebugeeIOPipe(); + + logOnVerbose(infoLogPrefixHead + "Debugee started!"); + + genericSignature002a genericSignature002aDebugee = new genericSignature002a(); + + String readySignal = "ready"; + pipe.println(readySignal); + String quitSignal = "quit"; + logOnVerbose(infoLogPrefixHead + "Wait for '" + quitSignal + "' signal..."); + String signalFromDebugger = pipe.readln(); + if ( ! (quitSignal.equals(signalFromDebugger)) ) { + logOnError(errorLogPrefixHead + "UNEXPECTED debugger's signal:"); + logOnError(errorLogPrefix + "Expected signal = '" + quitSignal + "'"); + logOnError(errorLogPrefix + "Actual signal = '" + signalFromDebugger + "'"); + logOnError(errorLogPrefix + "Exiting with Exit Status = '" + (STATUS_FAILED + STATUS_TEMP) + "'"); + System.exit(STATUS_FAILED + STATUS_TEMP); + } + logOnVerbose(infoLogPrefixHead + "'" + quitSignal + "' signal from debugger is received."); + logOnVerbose(infoLogPrefix + "Exiting with Exit Status = '" + (STATUS_PASSED + STATUS_TEMP) + "'"); + System.exit(STATUS_PASSED + STATUS_TEMP); + } +} // end of genericSignature002a class + + +// non generic classes: + +class GS002_Class01 {} + +class GS002_Class02 {} + +interface GS002_Interf01 {} + +interface GS002_Interf02 {} + +class GS002_Class03 extends GS002_Class01 {} + +class GS002_Class04 extends GS002_Class01 implements GS002_Interf01 {} + +class GS002_Class05 extends GS002_Class02 implements GS002_Interf02 {} + + +// generic classes: + +class GS002_Class06 {} + +class GS002_Class07 {} + +class GS002_Class08 {} + +class GS002_Class09 {} + +class GS002_Class10 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001.java new file mode 100644 index 00000000000..f88290841e4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001.java @@ -0,0 +1,316 @@ +/* + * 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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class isfinal001 { + final static String IS_FINAL = "true"; + final static String NOT_FINAL = "false"; + final static int TOTAL_FIELDS = 165; + final static String FIELD_NAME[][] = { + {"z0", NOT_FINAL}, + {"z1", NOT_FINAL}, + {"z2", NOT_FINAL}, + {"b0", NOT_FINAL}, + {"b1", NOT_FINAL}, + {"b2", NOT_FINAL}, + {"c0", NOT_FINAL}, + {"c1", NOT_FINAL}, + {"c2", NOT_FINAL}, + {"d0", NOT_FINAL}, + {"d1", NOT_FINAL}, + {"d2", NOT_FINAL}, + {"f0", NOT_FINAL}, + {"f1", NOT_FINAL}, + {"f2", NOT_FINAL}, + {"i0", NOT_FINAL}, + {"i1", NOT_FINAL}, + {"i2", NOT_FINAL}, + {"l0", NOT_FINAL}, + {"l1", NOT_FINAL}, + {"l2", NOT_FINAL}, + {"r0", NOT_FINAL}, + {"r1", NOT_FINAL}, + {"r2", NOT_FINAL}, + + {"z0F", IS_FINAL}, + {"z1F", IS_FINAL}, + {"z2F", IS_FINAL}, + {"b0F", IS_FINAL}, + {"b1F", IS_FINAL}, + {"b2F", IS_FINAL}, + {"c0F", IS_FINAL}, + {"c1F", IS_FINAL}, + {"c2F", IS_FINAL}, + {"d0F", IS_FINAL}, + {"d1F", IS_FINAL}, + {"d2F", IS_FINAL}, + {"f0F", IS_FINAL}, + {"f1F", IS_FINAL}, + {"f2F", IS_FINAL}, + {"i0F", IS_FINAL}, + {"i1F", IS_FINAL}, + {"i2F", IS_FINAL}, + {"l0F", IS_FINAL}, + {"l1F", IS_FINAL}, + {"l2F", IS_FINAL}, + {"r0F", IS_FINAL}, + {"r1F", IS_FINAL}, + {"r2F", IS_FINAL}, + + {"lS0", NOT_FINAL}, + {"lS1", NOT_FINAL}, + {"lS2", NOT_FINAL}, + {"lP0", NOT_FINAL}, + {"lP1", NOT_FINAL}, + {"lP2", NOT_FINAL}, + {"lU0", NOT_FINAL}, + {"lU1", NOT_FINAL}, + {"lU2", NOT_FINAL}, + {"lR0", NOT_FINAL}, + {"lR1", NOT_FINAL}, + {"lR2", NOT_FINAL}, + {"lT0", NOT_FINAL}, + {"lT1", NOT_FINAL}, + {"lT2", NOT_FINAL}, + {"lV0", NOT_FINAL}, + {"lV1", NOT_FINAL}, + {"lV2", NOT_FINAL}, + + {"lS0F", IS_FINAL}, + {"lS1F", IS_FINAL}, + {"lS2F", IS_FINAL}, + {"lP0F", IS_FINAL}, + {"lP1F", IS_FINAL}, + {"lP2F", IS_FINAL}, + {"lU0F", IS_FINAL}, + {"lU1F", IS_FINAL}, + {"lU2F", IS_FINAL}, + {"lR0F", IS_FINAL}, + {"lR1F", IS_FINAL}, + {"lR2F", IS_FINAL}, + {"lT0F", IS_FINAL}, + {"lT1F", IS_FINAL}, + {"lT2F", IS_FINAL}, + + {"X0", NOT_FINAL}, + {"X1", NOT_FINAL}, + {"X2", NOT_FINAL}, + {"O0", NOT_FINAL}, + {"O1", NOT_FINAL}, + {"O2", NOT_FINAL}, + + {"X0F", IS_FINAL}, + {"X1F", IS_FINAL}, + {"X2F", IS_FINAL}, + {"O0F", IS_FINAL}, + {"O1F", IS_FINAL}, + {"O2F", IS_FINAL}, + + {"LS0", NOT_FINAL}, + {"LS1", NOT_FINAL}, + {"LS2", NOT_FINAL}, + {"LP0", NOT_FINAL}, + {"LP1", NOT_FINAL}, + {"LP2", NOT_FINAL}, + {"LU0", NOT_FINAL}, + {"LU1", NOT_FINAL}, + {"LU2", NOT_FINAL}, + {"LR0", NOT_FINAL}, + {"LR1", NOT_FINAL}, + {"LR2", NOT_FINAL}, + {"LT0", NOT_FINAL}, + {"LT1", NOT_FINAL}, + {"LT2", NOT_FINAL}, + {"LV0", NOT_FINAL}, + {"LV1", NOT_FINAL}, + {"LV2", NOT_FINAL}, + + {"LS0F", IS_FINAL}, + {"LS1F", IS_FINAL}, + {"LS2F", IS_FINAL}, + {"LP0F", IS_FINAL}, + {"LP1F", IS_FINAL}, + {"LP2F", IS_FINAL}, + {"LU0F", IS_FINAL}, + {"LU1F", IS_FINAL}, + {"LU2F", IS_FINAL}, + {"LR0F", IS_FINAL}, + {"LR1F", IS_FINAL}, + {"LR2F", IS_FINAL}, + {"LT0F", IS_FINAL}, + {"LT1F", IS_FINAL}, + {"LT2F", IS_FINAL}, + + {"E0", NOT_FINAL}, + {"E1", NOT_FINAL}, + {"E2", NOT_FINAL}, + + {"E0F", IS_FINAL}, + {"E1F", IS_FINAL}, + {"E2F", IS_FINAL}, + + {"ES0", NOT_FINAL}, + {"ES1", NOT_FINAL}, + {"ES2", NOT_FINAL}, + {"EP0", NOT_FINAL}, + {"EP1", NOT_FINAL}, + {"EP2", NOT_FINAL}, + {"EU0", NOT_FINAL}, + {"EU1", NOT_FINAL}, + {"EU2", NOT_FINAL}, + {"ER0", NOT_FINAL}, + {"ER1", NOT_FINAL}, + {"ER2", NOT_FINAL}, + {"ET0", NOT_FINAL}, + {"ET1", NOT_FINAL}, + {"ET2", NOT_FINAL}, + {"EV0", NOT_FINAL}, + {"EV1", NOT_FINAL}, + {"EV2", NOT_FINAL}, + + {"ES0F", IS_FINAL}, + {"ES1F", IS_FINAL}, + {"ES2F", IS_FINAL}, + {"EP0F", IS_FINAL}, + {"EP1F", IS_FINAL}, + {"EP2F", IS_FINAL}, + {"EU0F", IS_FINAL}, + {"EU1F", IS_FINAL}, + {"EU2F", IS_FINAL}, + {"ER0F", IS_FINAL}, + {"ER1F", IS_FINAL}, + {"ER2F", IS_FINAL}, + {"ET0F", IS_FINAL}, + {"ET1F", IS_FINAL}, + {"ET2F", IS_FINAL} + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isFinal."; + private final static String className = "isfinal001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "isfinal001aClassToCheck"; + + 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 = new IOPipe(debugee); + 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: " + + TOTAL_FIELDS); + // Check all fields from debugee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String name; + boolean isFinal; + String realIsFinal; + + try { + field = refType.fieldByName(FIELD_NAME[i][0]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME[i][0]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + isFinal = field.isFinal(); + realIsFinal = FIELD_NAME[i][1]; + log.display("debuger> " + i + " field (" + name + "), " + + "isFinal = " + isFinal + " read."); + + // isFinal() returns true if this type component is declared final, + // returns false otherwise + if ((isFinal && !realIsFinal.equals(IS_FINAL)) || + (!isFinal && realIsFinal.equals(IS_FINAL)) + ) { + log.complain("debuger FAILURE 2> " + i + " field " + name + + ": read field.isFinal() = " + isFinal + + "; real isFinal should be " + realIsFinal); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001/TestDescription.java new file mode 100644 index 00000000000..fe0df028b7f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001/TestDescription.java @@ -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/TypeComponent/isFinal/isfinal001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isFinal() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isFinal() + * Determines if this TypeComponent is final. Return value is undefined for + * constructors and static initializers. + * Returns: true if this type component was declared final; false otherwise. + * nsk/jdi/TypeComponent/isFinal/isfinal001 checks assertions: + * public boolean isFinal() + * 1. Returns true if the field was declared final. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isFinal() returns expected value. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isFinal.isfinal001 + * nsk.jdi.TypeComponent.isFinal.isfinal001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isFinal.isfinal001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001a.java new file mode 100644 index 00000000000..4faa54b2e94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001a.java @@ -0,0 +1,124 @@ +/* + * 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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isfinal001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + isfinal001aClassToCheck classToCheck = new isfinal001aClassToCheck(); + + 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 isfinal001aClassToCheck { + // User class and interface + class isfinal001aClass {} + interface isfinal001aInter {} + + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final boolean z0F = true, z1F[]={z0F}, z2F[][]={z1F}; + final byte b0F = 1, b1F[]={b0F}, b2F[][]={b1F}; + final char c0F = '\u00ff', c1F[]={c0F}, c2F[][]={c1F}; + final double d0F = 1, d1F[]={d0F}, d2F[][]={d1F}; + final float f0F = 1f, f1F[]={f0F}, f2F[][]={f1F}; + final int i0F = 1, i1F[]={i0F}, i2F[][]={i1F}; + final long l0F = 1l, l1F[]={l0F}, l2F[][]={l1F}; + final short r0F = 1, r1F[]={r0F}, r2F[][]={r1F}; + + static long lS0, lS1[]={lS0}, lS2[][]={lS1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + final static long lS0F = 1l, lS1F[]={lS0F}, lS2F[][]={lS1F}; + final private long lP0F = 1l, lP1F[]={lP0F}, lP2F[][]={lP1F}; + final public long lU0F = 1l, lU1F[]={lU0F}, lU2F[][]={lU1F}; + final protected long lR0F = 1l, lR1F[]={lR0F}, lR2F[][]={lR1F}; + final transient long lT0F = 1l, lT1F[]={lT0F}, lT2F[][]={lT1F}; + + isfinal001aClass X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final isfinal001aClass X0F = new isfinal001aClass(), X1F[]={X0F}, X2F[][]={X1F}; + final Object O0F = new Object(), O1F[]={O0F}, O2F[][]={O1F}; + + static Long LS0, LS1[]={LS0}, LS2[][]={LS1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + final static Long LS0F = new Long(1), LS1F[]={LS0F}, LS2F[][]={LS1F}; + final private Long LP0F = new Long(1), LP1F[]={LP0F}, LP2F[][]={LP1F}; + final public Long LU0F = new Long(1), LU1F[]={LU0F}, LU2F[][]={LU1F}; + final protected Long LR0F = new Long(1), LR1F[]={LR0F}, LR2F[][]={LR1F}; + final transient Long LT0F = new Long(1), LT1F[]={LT0F}, LT2F[][]={LT1F}; + + isfinal001aInter E0, E1[]={E0}, E2[][]={E1}; + final isfinal001aInter E0F = null, E1F[]={E0F}, E2F[][]={E1F}; + + static isfinal001aInter ES0, ES1[]={ES0}, ES2[][]={ES1}; + private isfinal001aInter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public isfinal001aInter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected isfinal001aInter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient isfinal001aInter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile isfinal001aInter EV0, EV1[]={EV0}, EV2[][]={EV1}; + + final static isfinal001aInter ES0F = null, ES1F[]={ES0F}, ES2F[][]={ES1F}; + final private isfinal001aInter EP0F = null, EP1F[]={EP0F}, EP2F[][]={EP1F}; + final public isfinal001aInter EU0F = null, EU1F[]={EU0F}, EU2F[][]={EU1F}; + final protected isfinal001aInter ER0F = null, ER1F[]={ER0F}, ER2F[][]={ER1F}; + final transient isfinal001aInter ET0F = null, ET1F[]={ET0F}, ET2F[][]={ET1F}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002.java new file mode 100644 index 00000000000..d9b10503f59 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002.java @@ -0,0 +1,367 @@ +/* + * 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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class isfinal002 { + final static String IS_FINAL = "true"; + final static String NOT_FINAL = "false"; + final static int TOTAL_METHODS = 208; + final static String METHOD_NAME[][] = { + {"Mv", NOT_FINAL}, + {"Mz", NOT_FINAL}, + {"Mz1", NOT_FINAL}, + {"Mz2", NOT_FINAL}, + {"Mb", NOT_FINAL}, + {"Mb1", NOT_FINAL}, + {"Mb2", NOT_FINAL}, + {"Mc", NOT_FINAL}, + {"Mc1", NOT_FINAL}, + {"Mc2", NOT_FINAL}, + {"Md", NOT_FINAL}, + {"Md1", NOT_FINAL}, + {"Md2", NOT_FINAL}, + {"Mf", NOT_FINAL}, + {"Mf1", NOT_FINAL}, + {"Mf2", NOT_FINAL}, + {"Mi", NOT_FINAL}, + {"Mi1", NOT_FINAL}, + {"Mi2", NOT_FINAL}, + {"Ml", NOT_FINAL}, + {"Ml1", NOT_FINAL}, + {"Ml2", NOT_FINAL}, + {"Mr", NOT_FINAL}, + {"Mr1", NOT_FINAL}, + {"Mr2", NOT_FINAL}, + + {"MvF", IS_FINAL}, + {"MzF", IS_FINAL}, + {"Mz1F", IS_FINAL}, + {"Mz2F", IS_FINAL}, + {"MbF", IS_FINAL}, + {"Mb1F", IS_FINAL}, + {"Mb2F", IS_FINAL}, + {"McF", IS_FINAL}, + {"Mc1F", IS_FINAL}, + {"Mc2F", IS_FINAL}, + {"MdF", IS_FINAL}, + {"Md1F", IS_FINAL}, + {"Md2F", IS_FINAL}, + {"MfF", IS_FINAL}, + {"Mf1F", IS_FINAL}, + {"Mf2F", IS_FINAL}, + {"MiF", IS_FINAL}, + {"Mi1F", IS_FINAL}, + {"Mi2F", IS_FINAL}, + {"MlF", IS_FINAL}, + {"Ml1F", IS_FINAL}, + {"Ml2F", IS_FINAL}, + {"MrF", IS_FINAL}, + {"Mr1F", IS_FINAL}, + {"Mr2F", IS_FINAL}, + + {"MvS", NOT_FINAL}, + {"MlS", NOT_FINAL}, + {"MlS1", NOT_FINAL}, + {"MlS2", NOT_FINAL}, + {"MvN", NOT_FINAL}, + {"MlN", NOT_FINAL}, + {"MlN1", NOT_FINAL}, + {"MlN2", NOT_FINAL}, + {"MvI", NOT_FINAL}, + {"MlI", NOT_FINAL}, + {"MlI1", NOT_FINAL}, + {"MlI2", NOT_FINAL}, + {"MvY", NOT_FINAL}, + {"MlY", NOT_FINAL}, + {"MlY1", NOT_FINAL}, + {"MlY2", NOT_FINAL}, + {"MvU", NOT_FINAL}, + {"MlU", NOT_FINAL}, + {"MlU1", NOT_FINAL}, + {"MlU2", NOT_FINAL}, + {"MvR", NOT_FINAL}, + {"MlR", NOT_FINAL}, + {"MlR1", NOT_FINAL}, + {"MlR2", NOT_FINAL}, + {"MvP", NOT_FINAL}, + {"MlP", NOT_FINAL}, + {"MlP1", NOT_FINAL}, + {"MlP2", NOT_FINAL}, + + {"MvSF", IS_FINAL}, + {"MlSF", IS_FINAL}, + {"MlS1F", IS_FINAL}, + {"MlS2F", IS_FINAL}, + {"MvNF", IS_FINAL}, + {"MlNF", IS_FINAL}, + {"MlN1F", IS_FINAL}, + {"MlN2F", IS_FINAL}, + {"MvIF", IS_FINAL}, + {"MlIF", IS_FINAL}, + {"MlI1F", IS_FINAL}, + {"MlI2F", IS_FINAL}, + {"MvYF", IS_FINAL}, + {"MlYF", IS_FINAL}, + {"MlY1F", IS_FINAL}, + {"MlY2F", IS_FINAL}, + {"MvUF", IS_FINAL}, + {"MlUF", IS_FINAL}, + {"MlU1F", IS_FINAL}, + {"MlU2F", IS_FINAL}, + {"MvRF", IS_FINAL}, + {"MlRF", IS_FINAL}, + {"MlR1F", IS_FINAL}, + {"MlR2F", IS_FINAL}, + {"MvPF", IS_FINAL}, + {"MlPF", IS_FINAL}, + {"MlP1F", IS_FINAL}, + {"MlP2F", IS_FINAL}, + + {"MX", NOT_FINAL}, + {"MX1", NOT_FINAL}, + {"MX2", NOT_FINAL}, + {"MO", NOT_FINAL}, + {"MO1", NOT_FINAL}, + {"MO2", NOT_FINAL}, + + {"MXF", IS_FINAL}, + {"MX1F", IS_FINAL}, + {"MX2F", IS_FINAL}, + {"MOF", IS_FINAL}, + {"MO1F", IS_FINAL}, + {"MO2F", IS_FINAL}, + + {"MLS", NOT_FINAL}, + {"MLS1", NOT_FINAL}, + {"MLS2", NOT_FINAL}, + {"MLN", NOT_FINAL}, + {"MLN1", NOT_FINAL}, + {"MLN2", NOT_FINAL}, + {"MLI", NOT_FINAL}, + {"MLI1", NOT_FINAL}, + {"MLI2", NOT_FINAL}, + {"MLY", NOT_FINAL}, + {"MLY1", NOT_FINAL}, + {"MLY2", NOT_FINAL}, + {"MLU", NOT_FINAL}, + {"MLU1", NOT_FINAL}, + {"MLU2", NOT_FINAL}, + {"MLR", NOT_FINAL}, + {"MLR1", NOT_FINAL}, + {"MLR2", NOT_FINAL}, + {"MLP", NOT_FINAL}, + {"MLP1", NOT_FINAL}, + {"MLP2", NOT_FINAL}, + + {"MLSF", IS_FINAL}, + {"MLS1F", IS_FINAL}, + {"MLS2F", IS_FINAL}, + {"MLNF", IS_FINAL}, + {"MLN1F", IS_FINAL}, + {"MLN2F", IS_FINAL}, + {"MLIF", IS_FINAL}, + {"MLI1F", IS_FINAL}, + {"MLI2F", IS_FINAL}, + {"MLYF", IS_FINAL}, + {"MLY1F", IS_FINAL}, + {"MLY2F", IS_FINAL}, + {"MLUF", IS_FINAL}, + {"MLU1F", IS_FINAL}, + {"MLU2F", IS_FINAL}, + {"MLRF", IS_FINAL}, + {"MLR1F", IS_FINAL}, + {"MLR2F", IS_FINAL}, + {"MLPF", IS_FINAL}, + {"MLP1F", IS_FINAL}, + {"MLP2F", IS_FINAL}, + + {"ME", NOT_FINAL}, + {"ME1", NOT_FINAL}, + {"ME2", NOT_FINAL}, + {"MEF", IS_FINAL}, + {"ME1F", IS_FINAL}, + {"ME2F", IS_FINAL}, + + {"MES", NOT_FINAL}, + {"MES1", NOT_FINAL}, + {"MES2", NOT_FINAL}, + {"MEN", NOT_FINAL}, + {"MEN1", NOT_FINAL}, + {"MEN2", NOT_FINAL}, + {"MEI", NOT_FINAL}, + {"MEI1", NOT_FINAL}, + {"MEI2", NOT_FINAL}, + {"MEY", NOT_FINAL}, + {"MEY1", NOT_FINAL}, + {"MEY2", NOT_FINAL}, + {"MEU", NOT_FINAL}, + {"MEU1", NOT_FINAL}, + {"MEU2", NOT_FINAL}, + {"MER", NOT_FINAL}, + {"MER1", NOT_FINAL}, + {"MER2", NOT_FINAL}, + {"MEP", NOT_FINAL}, + {"MEP1", NOT_FINAL}, + {"MEP2", NOT_FINAL}, + + {"MESF", IS_FINAL}, + {"MES1F", IS_FINAL}, + {"MES2F", IS_FINAL}, + {"MENF", IS_FINAL}, + {"MEN1F", IS_FINAL}, + {"MEN2F", IS_FINAL}, + {"MEIF", IS_FINAL}, + {"MEI1F", IS_FINAL}, + {"MEI2F", IS_FINAL}, + {"MEYF", IS_FINAL}, + {"MEY1F", IS_FINAL}, + {"MEY2F", IS_FINAL}, + {"MEUF", IS_FINAL}, + {"MEU1F", IS_FINAL}, + {"MEU2F", IS_FINAL}, + {"MERF", IS_FINAL}, + {"MER1F", IS_FINAL}, + {"MER2F", IS_FINAL}, + {"MEPF", IS_FINAL}, + {"MEP1F", IS_FINAL}, + {"MEP2F", IS_FINAL} + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isFinal."; + private final static String className = "isfinal002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "isfinal002aClassToCheck"; + + 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 = new IOPipe(debugee); + 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; + } + + // Check all methods from debugee + for (int i = 0; i < METHOD_NAME.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + boolean isFinal; + String realIsFinal; + + try { + listOfMethods = refType.methodsByName(METHOD_NAME[i][0]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME[i][0]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME[i][0] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + isFinal = method.isFinal(); + realIsFinal = METHOD_NAME[i][1]; + log.display("debuger> " + i + " method (" + name + "), " + + "isFinal = " + isFinal + " read."); + + // isFinal() returns true if this type component is declared + // final, returns false otherwise + if ((isFinal && !realIsFinal.equals(IS_FINAL)) || + (!isFinal && realIsFinal.equals(IS_FINAL)) + ) { + log.display("debuger FAILURE 3> " + i + " method " + name + + ": read method.isFinal() = " + isFinal + + "; real isFinal should be " + realIsFinal); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002/TestDescription.java new file mode 100644 index 00000000000..dd23afba875 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002/TestDescription.java @@ -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/TypeComponent/isFinal/isfinal002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isFinal() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isFinal() + * Determines if this TypeComponent is final. Return value is undefined for + * constructors and static initializers. + * Returns: true if this type component was declared final; false otherwise. + * nsk/jdi/TypeComponent/isFinal/isfinal002 checks assertions: + * public boolean isFinal() + * 1. Returns true if the method was declared final. + * 2. Returns false otherwise. + * Debugger gets each method from debuggee calling by name and then checks + * if isFinal() returns expected value. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isFinal.isfinal002 + * nsk.jdi.TypeComponent.isFinal.isfinal002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isFinal.isfinal002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002a.java new file mode 100644 index 00000000000..4676f6728bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal002a.java @@ -0,0 +1,278 @@ +/* + * 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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isfinal002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + isfinal002aClassToCheck classToCheck = new isfinal002aClassToCheck(); + + 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 isfinal002aClassToCheck { + // User class and interface + class isfinal002aClass {} + interface isfinal002aInter {} + + // Methods + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + final void MvF() {}; + final boolean MzF(boolean z) { return z; }; + final boolean[] Mz1F(boolean z[]) { return z; }; + final boolean[][] Mz2F(boolean z[][]) { return z; }; + final byte MbF(byte b) { return b; }; + final byte[] Mb1F(byte b[]) { return b; }; + final byte[][] Mb2F(byte b[][]) { return b; }; + final char McF(char c) { return c; }; + final char[] Mc1F(char c[]) { return c; }; + final char[][] Mc2F(char c[][]) { return c; }; + final double MdF(double d) { return d; }; + final double[] Md1F(double d[]) { return d; }; + final double[][] Md2F(double d[][]) { return d; }; + final float MfF(float f) { return f; }; + final float[] Mf1F(float f[]) { return f; }; + final float[][] Mf2F(float f[][]) { return f; }; + final int MiF(int i) { return i; }; + final int[] Mi1F(int i[]) { return i; }; + final int[][] Mi2F(int i[][]) { return i; }; + final long MlF(long l) { return l; }; + final long[] Ml1F(long l[]) { return l; }; + final long[][] Ml2F(long l[][]) { return l; }; + final short MrF(short r) { return r; }; + final short[] Mr1F(short r[]) { return r; }; + final short[][] Mr2F(short r[][]) { return r; }; + + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + final static void MvSF() {}; + final static long MlSF(long l) { return l; }; + final static long[] MlS1F(long l[]) { return l; }; + final static long[][] MlS2F(long l[][]) { return l; }; + final native void MvNF(); + final native long MlNF(long l); + final native long[] MlN1F(long l[]); + final native long[][] MlN2F(long l[][]); + final strictfp void MvIF() {}; + final strictfp long MlIF(long l) { return l; }; + final strictfp long[] MlI1F(long l[]) { return l; }; + final strictfp long[][] MlI2F(long l[][]) { return l; }; + final synchronized void MvYF() {}; + final synchronized long MlYF(long l) { return l; }; + final synchronized long[] MlY1F(long l[]) { return l; }; + final synchronized long[][] MlY2F(long l[][]) { return l; }; + final public void MvUF() {}; + final public long MlUF(long l) { return l; }; + final public long[] MlU1F(long l[]) { return l; }; + final public long[][] MlU2F(long l[][]) { return l; }; + final protected void MvRF() {}; + final protected long MlRF(long l) { return l; }; + final protected long[] MlR1F(long l[]) { return l; }; + final protected long[][] MlR2F(long l[][]) { return l; }; + final private void MvPF() {}; + final private long MlPF(long l) { return l; }; + final private long[] MlP1F(long l[]) { return l; }; + final private long[][] MlP2F(long l[][]) { return l; }; + + isfinal002aClass MX(isfinal002aClass X) { return X; }; + isfinal002aClass[] MX1(isfinal002aClass X[]) { return X; }; + isfinal002aClass[][] MX2(isfinal002aClass X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + final isfinal002aClass MXF(isfinal002aClass X) { return X; }; + final isfinal002aClass[] MX1F(isfinal002aClass X[]) { return X; }; + final isfinal002aClass[][] MX2F(isfinal002aClass X[][]) { return X; }; + final Object MOF(Object O) { return O; }; + final Object[] MO1F(Object[] O) { return O; }; + final Object[][] MO2F(Object[][] O) { return O; }; + + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long[] L) { return L; }; + static Long[][] MLS2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + final static Long MLSF(Long L) { return L; }; + final static Long[] MLS1F(Long[] L) { return L; }; + final static Long[][] MLS2F(Long[][] L) { return L; }; + final native Long MLNF(Long L); + final native Long[] MLN1F(Long[] L); + final native Long[][] MLN2F(Long[][] L); + final strictfp Long MLIF(Long L) { return L; }; + final strictfp Long[] MLI1F(Long[] L) { return L; }; + final strictfp Long[][] MLI2F(Long[][] L) { return L; }; + final synchronized Long MLYF(Long L) { return L; }; + final synchronized Long[] MLY1F(Long[] L) { return L; }; + final synchronized Long[][] MLY2F(Long[][] L) { return L; }; + final public Long MLUF(Long L) { return L; }; + final public Long[] MLU1F(Long[] L) { return L; }; + final public Long[][] MLU2F(Long[][] L) { return L; }; + final protected Long MLRF(Long L) { return L; }; + final protected Long[] MLR1F(Long[] L) { return L; }; + final protected Long[][] MLR2F(Long[][] L) { return L; }; + final private Long MLPF(Long L) { return L; }; + final private Long[] MLP1F(Long[] L) { return L; }; + final private Long[][] MLP2F(Long[][] L) { return L; }; + + isfinal002aInter ME(isfinal002aInter E) { return E; }; + isfinal002aInter[] ME1(isfinal002aInter[] E) { return E; }; + isfinal002aInter[][] ME2(isfinal002aInter[][] E) { return E; }; + final isfinal002aInter MEF(isfinal002aInter E) { return E; }; + final isfinal002aInter[] ME1F(isfinal002aInter[] E) { return E; }; + final isfinal002aInter[][] ME2F(isfinal002aInter[][] E) { return E; }; + + static isfinal002aInter MES(isfinal002aInter E) { return E; }; + static isfinal002aInter[] MES1(isfinal002aInter[] E) { return E; }; + static isfinal002aInter[][] MES2(isfinal002aInter[][] E) { return E; }; + native isfinal002aInter MEN(isfinal002aInter E); + native isfinal002aInter[] MEN1(isfinal002aInter[] E); + native isfinal002aInter[][] MEN2(isfinal002aInter[][] E); + strictfp isfinal002aInter MEI(isfinal002aInter E) { return E; }; + strictfp isfinal002aInter[] MEI1(isfinal002aInter[] E) { return E; }; + strictfp isfinal002aInter[][] MEI2(isfinal002aInter[][] E) { return E; }; + synchronized isfinal002aInter MEY(isfinal002aInter E) { return E; }; + synchronized isfinal002aInter[] MEY1(isfinal002aInter[] E) { return E; }; + synchronized isfinal002aInter[][] MEY2(isfinal002aInter[][] E) { return E; }; + public isfinal002aInter MEU(isfinal002aInter E) { return E; }; + public isfinal002aInter[] MEU1(isfinal002aInter[] E) { return E; }; + public isfinal002aInter[][] MEU2(isfinal002aInter[][] E) { return E; }; + protected isfinal002aInter MER(isfinal002aInter E) { return E; }; + protected isfinal002aInter[] MER1(isfinal002aInter[] E) { return E; }; + protected isfinal002aInter[][] MER2(isfinal002aInter[][] E) { return E; }; + private isfinal002aInter MEP(isfinal002aInter E) { return E; }; + private isfinal002aInter[] MEP1(isfinal002aInter[] E) { return E; }; + private isfinal002aInter[][] MEP2(isfinal002aInter[][] E) { return E; }; + + final static isfinal002aInter MESF(isfinal002aInter E) { return E; }; + final static isfinal002aInter[] MES1F(isfinal002aInter[] E) { return E; }; + final static isfinal002aInter[][] MES2F(isfinal002aInter[][] E) { return E; }; + final native isfinal002aInter MENF(isfinal002aInter E); + final native isfinal002aInter[] MEN1F(isfinal002aInter[] E); + final native isfinal002aInter[][] MEN2F(isfinal002aInter[][] E); + final strictfp isfinal002aInter MEIF(isfinal002aInter E) { return E; }; + final strictfp isfinal002aInter[] MEI1F(isfinal002aInter[] E) { return E; }; + final strictfp isfinal002aInter[][] MEI2F(isfinal002aInter[][] E) { return E; }; + final synchronized isfinal002aInter MEYF(isfinal002aInter E) { return E; }; + final synchronized isfinal002aInter[] MEY1F(isfinal002aInter[] E) { return E; }; + final synchronized isfinal002aInter[][] MEY2F(isfinal002aInter[][] E) { return E; }; + final public isfinal002aInter MEUF(isfinal002aInter E) { return E; }; + final public isfinal002aInter[] MEU1F(isfinal002aInter[] E) { return E; }; + final public isfinal002aInter[][] MEU2F(isfinal002aInter[][] E) { return E; }; + final protected isfinal002aInter MERF(isfinal002aInter E) { return E; }; + final protected isfinal002aInter[] MER1F(isfinal002aInter[] E) { return E; }; + final protected isfinal002aInter[][] MER2F(isfinal002aInter[][] E) { return E; }; + final private isfinal002aInter MEPF(isfinal002aInter E) { return E; }; + final private isfinal002aInter[] MEP1F(isfinal002aInter[] E) { return E; }; + final private isfinal002aInter[][] MEP2F(isfinal002aInter[][] E) { return E; }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003.java new file mode 100644 index 00000000000..ff67f43c5dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003.java @@ -0,0 +1,137 @@ +/* + * 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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class isfinal003 { + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isFinal."; + private final static String className = "isfinal003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "isfinal003aClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List methods; + + // 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; + } + + // Get all methods, find constructors and static initializers and + // check them + try { + methods = refType.allMethods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods read " + + totalMethods); + return 2; + } + log.display("debuger> Total methods found: " + totalMethods); + Iterator methodsIterator = methods.iterator(); + for (int i = 0; methodsIterator.hasNext(); i++) { + Method method = (Method)methodsIterator.next(); + boolean isFinal; + String decTypeName = method.declaringType().name(); + String name = method.name(); + + if (method.isConstructor() || method.isStaticInitializer()) { + try { + isFinal = method.isFinal(); + } catch(Exception e) { + log.complain("debuger FAILURE 1> Cannot get isFinal from " + + "method " + name + " in " + decTypeName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method (" + name + "), " + + "isFinal = " + isFinal + " read in " + + decTypeName); + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003/TestDescription.java new file mode 100644 index 00000000000..03b2905b223 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003/TestDescription.java @@ -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/TypeComponent/isFinal/isfinal003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isFinal() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isFinal() + * Determines if this TypeComponent is final. Return value is undefined for + * constructors and static initializers. + * Returns: true if this type component was declared final; false otherwise. + * nsk/jdi/TypeComponent/isFinal/isfinal003 checks assertion: + * public boolean isFinal() + * 1. method isFinal() is defined for constructors and static initializers and + * does not throw an Exception. + * Debugger gets all methods from debuggee, finds contructors and static + * initializers only and checks if isFinal() doesn't throw any Exception. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isFinal.isfinal003 + * nsk.jdi.TypeComponent.isFinal.isfinal003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isFinal.isfinal003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003a.java new file mode 100644 index 00000000000..8dbdebc426e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003a.java @@ -0,0 +1,90 @@ +/* + * 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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isfinal003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + isfinal003aClassToCheck classToCheck = new isfinal003aClassToCheck(); + + 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 isfinal003aClassToCheck extends isfinal003aSuperClass { + isfinal003aClassToCheck() {}; + public isfinal003aClassToCheck(long l) {}; + private isfinal003aClassToCheck(Object obj) {}; + protected isfinal003aClassToCheck(long[] l) {}; + + static int ci; + static Long cL; + static long[] cl = new long[10]; + + static { ci = 1; } + static { cL = new Long(1l); } + static { + for (int i = 0; i < 10; i++) { + cl[i] = (long)i; + } + } +} + +class isfinal003aSuperClass { + isfinal003aSuperClass() {}; + public isfinal003aSuperClass(long l) {}; + private isfinal003aSuperClass(Object obj) {}; + protected isfinal003aSuperClass(long[] l) {}; + + static boolean sb; + static Object sO; + static float[] sf = new float[10]; + + static { sb = true; } + static { sO = new Object(); } + static { + for (int i = 0; i < 10; i++) { + sf[i] = (float)i; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004.java new file mode 100644 index 00000000000..66934851fdf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004.java @@ -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.TypeComponent.isFinal; + +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 isfinal004 { + + //------------------------------------------------------- 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.TypeComponent.isFinal."; + private final static String className = "isfinal004"; + 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.isFinal()) { + display("enum " + className + " has final field " + expectedEnumFieldsNames[i]); + display("\t of type " + className); + } else { + complain("enum " + className + " has not-final 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004/TestDescription.java new file mode 100644 index 00000000000..acac69188fe --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/TypeComponent/isFinal/isfinal004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isFinal() method of TypeComponent interface. + * The test checks if the method returns true for each enum + * constants declared in mirrored enum type. + * The test consists of a debugger program (isfinal004.java) + * and debuggee application (isfinal004a.java). + * Package name is nsk.jdi.TypeComponent.isFinal . + * 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 finds fields of enum type declared in isfinal004a + * class. Then the debugger checks if test assertion for + * every enum constants declared in mirrored enum types. + * 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.TypeComponent.isFinal.isfinal004 + * nsk.jdi.TypeComponent.isFinal.isfinal004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isFinal.isfinal004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004a.java new file mode 100644 index 00000000000..40b6a169833 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004a.java @@ -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.TypeComponent.isFinal; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isfinal004a { + + //------------------------------------------------------- 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 isfinal004Enum1 f1 = isfinal004Enum1.e2; + static isfinal004Enum2 f2 = isfinal004Enum2.e1; + static isfinal004Enum1.Enum1_ f3 = isfinal004Enum1.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(isfinal004.SIGNAL_READY); + + + //pipe.println(isfinal004.SIGNAL_GO); + receiveSignal(isfinal004.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum isfinal004Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum isfinal004Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001.java new file mode 100644 index 00000000000..889a2604edd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001.java @@ -0,0 +1,207 @@ +/* + * 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.TypeComponent.isPackagePrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class ispackageprivate001 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isPackagePrivate."; + private final static String debuggerName = prefix + "ispackageprivate001"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + final static String IS_PPRIVATE = "true"; + final static String NOT_PPRIVATE = "false"; + final static int TOTAL_FIELDS = 132; + + /** debuggee's fields for check **/ + private final static String checkedFields[][] = { + {"z0", IS_PPRIVATE}, {"z1", IS_PPRIVATE}, {"z2", IS_PPRIVATE}, + {"b0", IS_PPRIVATE}, {"b1", IS_PPRIVATE}, {"b2", IS_PPRIVATE}, + {"c0", IS_PPRIVATE}, {"c1", IS_PPRIVATE}, {"c2", IS_PPRIVATE}, + {"d0", IS_PPRIVATE}, {"d1", IS_PPRIVATE}, {"d2", IS_PPRIVATE}, + {"f0", IS_PPRIVATE}, {"f1", IS_PPRIVATE}, {"f2", IS_PPRIVATE}, + {"i0", IS_PPRIVATE}, {"i1", IS_PPRIVATE}, {"i2", IS_PPRIVATE}, + {"l0", IS_PPRIVATE}, {"l1", IS_PPRIVATE}, {"l2", IS_PPRIVATE}, + {"r0", IS_PPRIVATE}, {"r1", IS_PPRIVATE}, {"r2", IS_PPRIVATE}, + + {"zP0", NOT_PPRIVATE}, {"zP1", NOT_PPRIVATE}, {"zP2", NOT_PPRIVATE}, + {"bP0", NOT_PPRIVATE}, {"bP1", NOT_PPRIVATE}, {"bP2", NOT_PPRIVATE}, + {"cP0", NOT_PPRIVATE}, {"cP1", NOT_PPRIVATE}, {"cP2", NOT_PPRIVATE}, + {"dP0", NOT_PPRIVATE}, {"dP1", NOT_PPRIVATE}, {"dP2", NOT_PPRIVATE}, + {"fP0", NOT_PPRIVATE}, {"fP1", NOT_PPRIVATE}, {"fP2", NOT_PPRIVATE}, + {"iP0", NOT_PPRIVATE}, {"iP1", NOT_PPRIVATE}, {"iP2", NOT_PPRIVATE}, + {"lP0", NOT_PPRIVATE}, {"lP1", NOT_PPRIVATE}, {"lP2", NOT_PPRIVATE}, + {"rP0", NOT_PPRIVATE}, {"rP1", NOT_PPRIVATE}, {"rP2", NOT_PPRIVATE}, + + {"Z0", IS_PPRIVATE}, {"Z1", IS_PPRIVATE}, {"Z2", IS_PPRIVATE}, + {"B0", IS_PPRIVATE}, {"B1", IS_PPRIVATE}, {"B2", IS_PPRIVATE}, + {"C0", IS_PPRIVATE}, {"C1", IS_PPRIVATE}, {"C2", IS_PPRIVATE}, + {"D0", IS_PPRIVATE}, {"D1", IS_PPRIVATE}, {"D2", IS_PPRIVATE}, + {"F0", IS_PPRIVATE}, {"F1", IS_PPRIVATE}, {"F2", IS_PPRIVATE}, + {"I0", IS_PPRIVATE}, {"I1", IS_PPRIVATE}, {"I2", IS_PPRIVATE}, + {"L0", IS_PPRIVATE}, {"L1", IS_PPRIVATE}, {"L2", IS_PPRIVATE}, + {"R0", IS_PPRIVATE}, {"R1", IS_PPRIVATE}, {"R2", IS_PPRIVATE}, + + {"ZP0", NOT_PPRIVATE}, {"ZP1", NOT_PPRIVATE}, {"ZP2", NOT_PPRIVATE}, + {"BP0", NOT_PPRIVATE}, {"BP1", NOT_PPRIVATE}, {"BP2", NOT_PPRIVATE}, + {"CP0", NOT_PPRIVATE}, {"CP1", NOT_PPRIVATE}, {"CP2", NOT_PPRIVATE}, + {"DP0", NOT_PPRIVATE}, {"DP1", NOT_PPRIVATE}, {"DP2", NOT_PPRIVATE}, + {"FP0", NOT_PPRIVATE}, {"FP1", NOT_PPRIVATE}, {"FP2", NOT_PPRIVATE}, + {"IP0", NOT_PPRIVATE}, {"IP1", NOT_PPRIVATE}, {"IP2", NOT_PPRIVATE}, + {"LP0", NOT_PPRIVATE}, {"LP1", NOT_PPRIVATE}, {"LP2", NOT_PPRIVATE}, + {"RP0", NOT_PPRIVATE}, {"RP1", NOT_PPRIVATE}, {"RP2", NOT_PPRIVATE}, + + {"s0", NOT_PPRIVATE}, {"s1", NOT_PPRIVATE}, {"s2", NOT_PPRIVATE}, + {"o0", NOT_PPRIVATE}, {"o1", NOT_PPRIVATE}, {"o2", NOT_PPRIVATE}, + {"S0", IS_PPRIVATE}, {"S1", IS_PPRIVATE}, {"S2", IS_PPRIVATE}, + {"O0", IS_PPRIVATE}, {"O1", IS_PPRIVATE}, {"O2", IS_PPRIVATE}, + + {"u0", NOT_PPRIVATE}, {"u1", NOT_PPRIVATE}, {"u2", NOT_PPRIVATE}, + {"v0", IS_PPRIVATE}, {"v1", IS_PPRIVATE}, {"v2", IS_PPRIVATE}, + {"w0", NOT_PPRIVATE}, {"w1", NOT_PPRIVATE}, {"w2", NOT_PPRIVATE}, + {"p0", NOT_PPRIVATE}, {"p1", NOT_PPRIVATE}, {"p2", NOT_PPRIVATE}, + + {"h0", NOT_PPRIVATE}, {"h1", NOT_PPRIVATE}, {"h2", NOT_PPRIVATE}, + {"j0", IS_PPRIVATE}, {"j1", IS_PPRIVATE}, {"j2", IS_PPRIVATE}, + {"k0", NOT_PPRIVATE}, {"k1", NOT_PPRIVATE}, {"k2", NOT_PPRIVATE}, + {"m0", NOT_PPRIVATE}, {"m1", NOT_PPRIVATE}, {"m2", NOT_PPRIVATE} + }; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isPackagePrivate() method for debuggee's fields..."); + + display("Total count of fields read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + TOTAL_FIELDS); + + // Check all fields from debuggee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String name; + boolean isPackagePrivate; + String expectedValue; + + try { + field = debuggeeClass.fieldByName(checkedFields[i][0]); + } catch (Exception e) { + complain("Can't get field by name " + checkedFields[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + name = field.name(); + isPackagePrivate = ((TypeComponent)field).isPackagePrivate(); // cast to TypeComponent interface + expectedValue = checkedFields[i][1]; + if ((isPackagePrivate && !expectedValue.equals(IS_PPRIVATE)) || + (!isPackagePrivate && expectedValue.equals(IS_PPRIVATE)) ) { + complain("isPackagePrivate() returned wrong value: " + isPackagePrivate + + " for field " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isPackagePrivate() returned expected " + isPackagePrivate + + " for field " + name); + } + } + + display("Checking debuggee's fields completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001/TestDescription.java new file mode 100644 index 00000000000..42c5b24ba7d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001/TestDescription.java @@ -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/TypeComponent/isPackagePrivate/ispackageprivate001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isPackagePrivate() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isPackagePrivate() + * Determines if this object mirrors a package private item. A package + * private item is declared with no access specifier. For ArrayType, the return + * value depends on the array component type. For primitive arrays the return + * value is always false. For object arrays, the return value is the same + * as would be returned for the component type. For primitive classes, such + * as Integer.TYPE, the return value is always false. + * Returns: + * true for items with package private access; false otherwise. + * nsk/jdi/TypeComponent/isPackagePrivate/isprivate001 checks assertions: + * public boolean isPackagePrivate() + * 1. Returns true if the field was declared package private. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isPackagePrivate() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isPackagePrivate method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isPackagePrivate.ispackageprivate001 + * nsk.jdi.TypeComponent.isPackagePrivate.ispackageprivate001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isPackagePrivate.ispackageprivate001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001a.java new file mode 100644 index 00000000000..cab9f831129 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001a.java @@ -0,0 +1,108 @@ +/* + * 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.TypeComponent.isPackagePrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class ispackageprivate001a { + + 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}; + short r0, r1[] = {r0}, r2[][] = {r1}; + + private boolean zP0, zP1[] = {zP0}, zP2[][] = {zP1}; + private byte bP0, bP1[] = {bP0}, bP2[][] = {bP1}; + private char cP0, cP1[] = {cP0}, cP2[][] = {cP1}; + private double dP0, dP1[] = {dP0}, dP2[][] = {dP1}; + private float fP0, fP1[] = {fP0}, fP2[][] = {fP1}; + private int iP0, iP1[] = {iP0}, iP2[][] = {iP1}; + private long lP0, lP1[] = {lP0}, lP2[][] = {lP1}; + private short rP0, rP1[] = {rP0}, rP2[][] = {rP1}; + + Boolean Z0, Z1[] = {Z0}, Z2[][] = {Z1}; + Byte B0, B1[] = {B0}, B2[][] = {B1}; + Character C0, C1[] = {C0}, C2[][] = {C1}; + Double D0, D1[] = {D0}, D2[][] = {D1}; + Float F0, F1[] = {F0}, F2[][] = {F1}; + Integer I0, I1[] = {I0}, I2[][] = {I1}; + Long L0, L1[] = {L0}, L2[][] = {L1}; + Short R0, R1[] = {R0}, R2[][] = {R1}; + + private Boolean ZP0, ZP1[] = {ZP0}, ZP2[][] = {ZP1}; + private Byte BP0, BP1[] = {BP0}, BP2[][] = {BP1}; + private Character CP0, CP1[] = {CP0}, CP2[][] = {CP1}; + private Double DP0, DP1[] = {DP0}, DP2[][] = {DP1}; + private Float FP0, FP1[] = {FP0}, FP2[][] = {FP1}; + private Integer IP0, IP1[] = {IP0}, IP2[][] = {IP1}; + private Long LP0, LP1[] = {LP0}, LP2[][] = {LP1}; + private Short RP0, RP1[] = {RP0}, RP2[][] = {RP1}; + + private String s0, s1[] = {s0}, s2[][] = {s1}; + private Object o0, o1[] = {o0}, o2[][] = {o1}; + String S0, S1[] = {S0}, S2[][] = {S1}; + Object O0, O1[] = {O0}, O2[][] = {O1}; + + protected P u0, u1[] = {u0}, u2[][] = {u1}; + public P w0, w1[] = {w0}, w2[][] = {w1}; + private P p0, p1[] = {p0}, p2[][] = {p1}; + P v0, v1[] = {v0}, v2[][] = {v1}; // package private + + protected M h0, h1[] = {h0}, h2[][] = {h1}; + public M k0, k1[] = {k0}, k2[][] = {k1}; + private M m0, m1[] = {m0}, m2[][] = {m1}; + M j0, j1[] = {j0}, j2[][] = {j1}; // package private + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + ispackageprivate001a ispackageprivate001a_ = new ispackageprivate001a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class P {} +interface M {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002.java new file mode 100644 index 00000000000..04583e6c8f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002.java @@ -0,0 +1,368 @@ +/* + * 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.TypeComponent.isPackagePrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class ispackageprivate002 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isPackagePrivate."; + private final static String debuggerName = prefix + "ispackageprivate002"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isPackagePrivate() method for debuggee's methods..."); + + display("Total count of methods read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + checkedMethods.length+1); + + // Check all methods from debuggee + for (int i = 0; i < checkedMethods.length-1; i++) { + List listOfMethods; + int totalMethodsByName; + Method method; + String name; + boolean isPackagePrivate; + String expectedValue; + + try { + listOfMethods = debuggeeClass.methodsByName(checkedMethods[i][0]); + } catch (Exception e) { + complain("Can't get method by name " + checkedMethods[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + checkedMethods[i][0] + " is " + totalMethodsByName + + ", should be 1."); + exitStatus = Consts.TEST_FAILED; + continue; + } + method = (Method)listOfMethods.get(0); + + name = method.name(); + isPackagePrivate = ((TypeComponent)method).isPackagePrivate(); // cast to TypeComponent interface + expectedValue = checkedMethods[i][1]; + if ((isPackagePrivate && !expectedValue.equals(IS_PPRIVATE)) || + (!isPackagePrivate && expectedValue.equals(IS_PPRIVATE)) ) { + complain("isPackagePrivate() returned wrong value: " + isPackagePrivate + + " for method " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isPackagePrivate() returned expected " + isPackagePrivate + + " for method " + name); + } + } + + display("Checking debuggee's methods completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + //--------------------------------------------- test specific fields + + final static String IS_PPRIVATE = "true"; + final static String NOT_PPRIVATE = "false"; + + /** debuggee's methods for check **/ + private final static String checkedMethods[][] = { + {"Mv", IS_PPRIVATE}, + {"Mz", IS_PPRIVATE}, + {"Mz1", IS_PPRIVATE}, + {"Mz2", IS_PPRIVATE}, + {"Mb", IS_PPRIVATE}, + {"Mb1", IS_PPRIVATE}, + {"Mb2", IS_PPRIVATE}, + {"Mc", IS_PPRIVATE}, + {"Mc1", IS_PPRIVATE}, + {"Mc2", IS_PPRIVATE}, + {"Md", IS_PPRIVATE}, + {"Md1", IS_PPRIVATE}, + {"Md2", IS_PPRIVATE}, + {"Mf1", IS_PPRIVATE}, + {"Mf2", IS_PPRIVATE}, + {"Mi", IS_PPRIVATE}, + {"Mi1", IS_PPRIVATE}, + {"Mi2", IS_PPRIVATE}, + {"Ml", IS_PPRIVATE}, + {"Ml1", IS_PPRIVATE}, + {"Ml2", IS_PPRIVATE}, + {"Mr", IS_PPRIVATE}, + {"Mr1", IS_PPRIVATE}, + {"Mr2", IS_PPRIVATE}, + + {"MvM", NOT_PPRIVATE}, + {"MzM", NOT_PPRIVATE}, + {"Mz1M", NOT_PPRIVATE}, + {"Mz2M", NOT_PPRIVATE}, + {"MbM", NOT_PPRIVATE}, + {"Mb1M", NOT_PPRIVATE}, + {"Mb2M", NOT_PPRIVATE}, + {"McM", NOT_PPRIVATE}, + {"Mc1M", NOT_PPRIVATE}, + {"Mc2M", NOT_PPRIVATE}, + {"MdM", NOT_PPRIVATE}, + {"Md1M", NOT_PPRIVATE}, + {"Md2M", NOT_PPRIVATE}, + {"MfM", NOT_PPRIVATE}, + {"Mf1M", NOT_PPRIVATE}, + {"Mf2M", NOT_PPRIVATE}, + {"MiM", NOT_PPRIVATE}, + {"Mi1M", NOT_PPRIVATE}, + {"Mi2M", NOT_PPRIVATE}, + {"MlM", NOT_PPRIVATE}, + {"Ml1M", NOT_PPRIVATE}, + {"Ml2M", NOT_PPRIVATE}, + {"MrM", NOT_PPRIVATE}, + {"Mr1M", NOT_PPRIVATE}, + {"Mr2M", NOT_PPRIVATE}, + + {"MvS", IS_PPRIVATE}, + {"MlS", IS_PPRIVATE}, + {"MlS1", IS_PPRIVATE}, + {"MlS2", IS_PPRIVATE}, + {"MvN", IS_PPRIVATE}, + {"MlN", IS_PPRIVATE}, + {"MlN1", IS_PPRIVATE}, + {"MlN2", IS_PPRIVATE}, + {"MvI", IS_PPRIVATE}, + {"MlI", IS_PPRIVATE}, + {"MlI1", IS_PPRIVATE}, + {"MlI2", IS_PPRIVATE}, + {"MvY", IS_PPRIVATE}, + {"MlY", IS_PPRIVATE}, + {"MlY1", IS_PPRIVATE}, + {"MlY2", IS_PPRIVATE}, + {"MvU", NOT_PPRIVATE}, + {"MlU", NOT_PPRIVATE}, + {"MlU1", NOT_PPRIVATE}, + {"MlU2", NOT_PPRIVATE}, + {"MvR", NOT_PPRIVATE}, + {"MlR", NOT_PPRIVATE}, + {"MlR1", NOT_PPRIVATE}, + {"MlR2", NOT_PPRIVATE}, + {"MvP", NOT_PPRIVATE}, + {"MlP", NOT_PPRIVATE}, + {"MlP1", NOT_PPRIVATE}, + {"MlP2", NOT_PPRIVATE}, + + {"MvSM", NOT_PPRIVATE}, + {"MlSM", NOT_PPRIVATE}, + {"MlS1M", NOT_PPRIVATE}, + {"MlS2M", NOT_PPRIVATE}, + {"MvNM", NOT_PPRIVATE}, + {"MlNM", NOT_PPRIVATE}, + {"MlN1M", NOT_PPRIVATE}, + {"MlN2M", NOT_PPRIVATE}, + {"MvIM", NOT_PPRIVATE}, + {"MlIM", NOT_PPRIVATE}, + {"MlI1M", NOT_PPRIVATE}, + {"MlI2M", NOT_PPRIVATE}, + {"MvYM", NOT_PPRIVATE}, + {"MlYM", NOT_PPRIVATE}, + {"MlY1M", NOT_PPRIVATE}, + {"MlY2M", NOT_PPRIVATE}, + {"MvPM", NOT_PPRIVATE}, + {"MlPM", NOT_PPRIVATE}, + {"MlP1M", NOT_PPRIVATE}, + {"MlP2M", NOT_PPRIVATE}, + + {"MX", IS_PPRIVATE}, + {"MX1", IS_PPRIVATE}, + {"MX2", IS_PPRIVATE}, + {"MO", IS_PPRIVATE}, + {"MO1", IS_PPRIVATE}, + {"MO2", IS_PPRIVATE}, + + {"MXM", NOT_PPRIVATE}, + {"MX1M", NOT_PPRIVATE}, + {"MX2M", NOT_PPRIVATE}, + {"MOM", NOT_PPRIVATE}, + {"MO1M", NOT_PPRIVATE}, + {"MO2M", NOT_PPRIVATE}, + + {"MLS", IS_PPRIVATE}, + {"MLS1", IS_PPRIVATE}, + {"MLS2", IS_PPRIVATE}, + {"MLN", IS_PPRIVATE}, + {"MLN1", IS_PPRIVATE}, + {"MLN2", IS_PPRIVATE}, + {"MLI", IS_PPRIVATE}, + {"MLI1", IS_PPRIVATE}, + {"MLI2", IS_PPRIVATE}, + {"MLY", IS_PPRIVATE}, + {"MLY1", IS_PPRIVATE}, + {"MLY2", IS_PPRIVATE}, + {"MLU", NOT_PPRIVATE}, + {"MLU1", NOT_PPRIVATE}, + {"MLU2", NOT_PPRIVATE}, + {"MLR", NOT_PPRIVATE}, + {"MLR1", NOT_PPRIVATE}, + {"MLR2", NOT_PPRIVATE}, + {"MLP", NOT_PPRIVATE}, + {"MLP1", NOT_PPRIVATE}, + {"MLP2", NOT_PPRIVATE}, + + {"MLSM", NOT_PPRIVATE}, + {"MLS1M", NOT_PPRIVATE}, + {"MLS2M", NOT_PPRIVATE}, + {"MLNM", NOT_PPRIVATE}, + {"MLN1M", NOT_PPRIVATE}, + {"MLN2M", NOT_PPRIVATE}, + {"MLIM", NOT_PPRIVATE}, + {"MLI1M", NOT_PPRIVATE}, + {"MLI2M", NOT_PPRIVATE}, + {"MLYM", NOT_PPRIVATE}, + {"MLY1M", NOT_PPRIVATE}, + {"MLY2M", NOT_PPRIVATE}, + {"MLPM", NOT_PPRIVATE}, + {"MLP1M", NOT_PPRIVATE}, + {"MLP2M", NOT_PPRIVATE}, + + {"ME", IS_PPRIVATE}, + {"ME1", IS_PPRIVATE}, + {"ME2", IS_PPRIVATE}, + {"MEM", NOT_PPRIVATE}, + {"ME1M", NOT_PPRIVATE}, + {"ME2M", NOT_PPRIVATE}, + + {"MES", IS_PPRIVATE}, + {"MES1", IS_PPRIVATE}, + {"MES2", IS_PPRIVATE}, + {"MEN", IS_PPRIVATE}, + {"MEN1", IS_PPRIVATE}, + {"MEN2", IS_PPRIVATE}, + {"MEI", IS_PPRIVATE}, + {"MEI1", IS_PPRIVATE}, + {"MEI2", IS_PPRIVATE}, + {"MEY", IS_PPRIVATE}, + {"MEY1", IS_PPRIVATE}, + {"MEY2", IS_PPRIVATE}, + {"MEU", NOT_PPRIVATE}, + {"MEU1", NOT_PPRIVATE}, + {"MEU2", NOT_PPRIVATE}, + {"MER", NOT_PPRIVATE}, + {"MER1", NOT_PPRIVATE}, + {"MER2", NOT_PPRIVATE}, + {"MEP", NOT_PPRIVATE}, + {"MEP1", NOT_PPRIVATE}, + {"MEP2", NOT_PPRIVATE}, + + {"MESM", NOT_PPRIVATE}, + {"MES1M", NOT_PPRIVATE}, + {"MES2M", NOT_PPRIVATE}, + {"MENM", NOT_PPRIVATE}, + {"MEN1M", NOT_PPRIVATE}, + {"MEN2M", NOT_PPRIVATE}, + {"MEIM", NOT_PPRIVATE}, + {"MEI1M", NOT_PPRIVATE}, + {"MEI2M", NOT_PPRIVATE}, + {"MEYM", NOT_PPRIVATE}, + {"MEY1M", NOT_PPRIVATE}, + {"MEY2M", NOT_PPRIVATE}, + {"MEPM", NOT_PPRIVATE}, + {"MEP1M", NOT_PPRIVATE}, + {"MEP2M", NOT_PPRIVATE} + }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002/TestDescription.java new file mode 100644 index 00000000000..cbcb4d4dc58 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002/TestDescription.java @@ -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/TypeComponent/isPackagePrivate/ispackageprivate002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isPackagePrivate() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isPackagePrivate() + * Determines if this object mirrors a package private item. A package + * private item is declared with no access specifier. For ArrayType, the return + * value depends on the array component type. For primitive arrays the return + * value is always false. For object arrays, the return value is the same + * as would be returned for the component type. For primitive classes, such + * as Integer.TYPE, the return value is always false. + * Returns: + * true for items with package private access; false otherwise. + * nsk/jdi/TypeComponent/isPackagePrivate/isprivate002 checks assertions: + * public boolean isPackagePrivate() + * 1. Returns true if the method was declared package private. + * 2. Returns false otherwise. + * Debugger gets each method from debuggee calling by name and then checks + * if method isPackagePrivate() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isPackagePrivate method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isPackagePrivate.ispackageprivate002 + * nsk.jdi.TypeComponent.isPackagePrivate.ispackageprivate002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isPackagePrivate.ispackageprivate002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002a.java new file mode 100644 index 00000000000..eb04b5ad552 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate002a.java @@ -0,0 +1,261 @@ +/* + * 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.TypeComponent.isPackagePrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class ispackageprivate002a { + + //--------------------------------------------- test mutable methods + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + ispackageprivate002a ispackageprivate002a_ = new ispackageprivate002a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------- test specific methods + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + public void MvM() {}; + public boolean MzM(boolean z) { return z; }; + public boolean[] Mz1M(boolean z[]) { return z; }; + public boolean[][] Mz2M(boolean z[][]) { return z; }; + public byte MbM(byte b) { return b; }; + public byte[] Mb1M(byte b[]) { return b; }; + public byte[][] Mb2M(byte b[][]) { return b; }; + public char McM(char c) { return c; }; + public char[] Mc1M(char c[]) { return c; }; + public char[][] Mc2M(char c[][]) { return c; }; + public double MdM(double d) { return d; }; + public double[] Md1M(double d[]) { return d; }; + public double[][] Md2M(double d[][]) { return d; }; + public float MfM(float f) { return f; }; + public float[] Mf1M(float f[]) { return f; }; + public float[][] Mf2M(float f[][]) { return f; }; + public int MiM(int i) { return i; }; + public int[] Mi1M(int i[]) { return i; }; + public int[][] Mi2M(int i[][]) { return i; }; + public long MlM(long l) { return l; }; + public long[] Ml1M(long l[]) { return l; }; + public long[][] Ml2M(long l[][]) { return l; }; + public short MrM(short r) { return r; }; + public short[] Mr1M(short r[]) { return r; }; + public short[][] Mr2M(short r[][]) { return r; }; + + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + public static void MvSM() {}; + public static long MlSM(long l) { return l; }; + public static long[] MlS1M(long l[]) { return l; }; + public static long[][] MlS2M(long l[][]) { return l; }; + public native void MvNM(); + public native long MlNM(long l); + public native long[] MlN1M(long l[]); + public native long[][] MlN2M(long l[][]); + public strictfp void MvIM() {}; + public strictfp long MlIM(long l) { return l; }; + public strictfp long[] MlI1M(long l[]) { return l; }; + public strictfp long[][] MlI2M(long l[][]) { return l; }; + public synchronized void MvYM() {}; + public synchronized long MlYM(long l) { return l; }; + public synchronized long[] MlY1M(long l[]) { return l; }; + public synchronized long[][] MlY2M(long l[][]) { return l; }; + public final void MvPM() {}; + public final long MlPM(long l) { return l; }; + public final long[] MlP1M(long l[]) { return l; }; + public final long[][] MlP2M(long l[][]) { return l; }; + + C002 MX(C002 X) { return X; }; + C002[] MX1(C002 X[]) { return X; }; + C002[][] MX2(C002 X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + public C002 MXM(C002 X) { return X; }; + public C002[] MX1M(C002 X[]) { return X; }; + public C002[][] MX2M(C002 X[][]) { return X; }; + public Object MOM(Object O) { return O; }; + public Object[] MO1M(Object[] O) { return O; }; + public Object[][] MO2M(Object[][] O) { return O; }; + + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long[] L) { return L; }; + static Long[][] MLS2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + public static Long MLSM(Long L) { return L; }; + public static Long[] MLS1M(Long[] L) { return L; }; + public static Long[][] MLS2M(Long[][] L) { return L; }; + public native Long MLNM(Long L); + public native Long[] MLN1M(Long[] L); + public native Long[][] MLN2M(Long[][] L); + public strictfp Long MLIM(Long L) { return L; }; + public strictfp Long[] MLI1M(Long[] L) { return L; }; + public strictfp Long[][] MLI2M(Long[][] L) { return L; }; + public synchronized Long MLYM(Long L) { return L; }; + public synchronized Long[] MLY1M(Long[] L) { return L; }; + public synchronized Long[][] MLY2M(Long[][] L) { return L; }; + public final Long MLPM(Long L) { return L; }; + public final Long[] MLP1M(Long[] L) { return L; }; + public final Long[][] MLP2M(Long[][] L) { return L; }; + + I002 ME(I002 E) { return E; }; + I002[] ME1(I002[] E) { return E; }; + I002[][] ME2(I002[][] E) { return E; }; + public I002 MEM(I002 E) { return E; }; + public I002[] ME1M(I002[] E) { return E; }; + public I002[][] ME2M(I002[][] E) { return E; }; + + static I002 MES(I002 E) { return E; }; + static I002[] MES1(I002[] E) { return E; }; + static I002[][] MES2(I002[][] E) { return E; }; + native I002 MEN(I002 E); + native I002[] MEN1(I002[] E); + native I002[][] MEN2(I002[][] E); + strictfp I002 MEI(I002 E) { return E; }; + strictfp I002[] MEI1(I002[] E) { return E; }; + strictfp I002[][] MEI2(I002[][] E) { return E; }; + synchronized I002 MEY(I002 E) { return E; }; + synchronized I002[] MEY1(I002[] E) { return E; }; + synchronized I002[][] MEY2(I002[][] E) { return E; }; + public I002 MEU(I002 E) { return E; }; + public I002[] MEU1(I002[] E) { return E; }; + public I002[][] MEU2(I002[][] E) { return E; }; + protected I002 MER(I002 E) { return E; }; + protected I002[] MER1(I002[] E) { return E; }; + protected I002[][] MER2(I002[][] E) { return E; }; + private I002 MEP(I002 E) { return E; }; + private I002[] MEP1(I002[] E) { return E; }; + private I002[][] MEP2(I002[][] E) { return E; }; + + public static I002 MESM(I002 E) { return E; }; + public static I002[] MES1M(I002[] E) { return E; }; + public static I002[][] MES2M(I002[][] E) { return E; }; + public native I002 MENM(I002 E); + public native I002[] MEN1M(I002[] E); + public native I002[][] MEN2M(I002[][] E); + public strictfp I002 MEIM(I002 E) { return E; }; + public strictfp I002[] MEI1M(I002[] E) { return E; }; + public strictfp I002[][] MEI2M(I002[][] E) { return E; }; + public synchronized I002 MEYM(I002 E) { return E; }; + public synchronized I002[] MEY1M(I002[] E) { return E; }; + public synchronized I002[][] MEY2M(I002[][] E) { return E; }; + public final I002 MEPM(I002 E) { return E; }; + public final I002[] MEP1M(I002[] E) { return E; }; + public final I002[][] MEP2M(I002[][] E) { return E; }; + +} + +//--------------------------------------------- test specific methods +class C002 {} +interface I002 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001.java new file mode 100644 index 00000000000..bab410e1145 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001.java @@ -0,0 +1,207 @@ +/* + * 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.TypeComponent.isPrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class isprivate001 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isPrivate."; + private final static String debuggerName = prefix + "isprivate001"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + final static String IS_PRIVATE = "true"; + final static String NOT_PRIVATE = "false"; + final static int TOTAL_FIELDS = 132; + + /** debuggee's fields for check **/ + private final static String checkedFields[][] = { + {"z0", NOT_PRIVATE}, {"z1", NOT_PRIVATE}, {"z2", NOT_PRIVATE}, + {"b0", NOT_PRIVATE}, {"b1", NOT_PRIVATE}, {"b2", NOT_PRIVATE}, + {"c0", NOT_PRIVATE}, {"c1", NOT_PRIVATE}, {"c2", NOT_PRIVATE}, + {"d0", NOT_PRIVATE}, {"d1", NOT_PRIVATE}, {"d2", NOT_PRIVATE}, + {"f0", NOT_PRIVATE}, {"f1", NOT_PRIVATE}, {"f2", NOT_PRIVATE}, + {"i0", NOT_PRIVATE}, {"i1", NOT_PRIVATE}, {"i2", NOT_PRIVATE}, + {"l0", NOT_PRIVATE}, {"l1", NOT_PRIVATE}, {"l2", NOT_PRIVATE}, + {"r0", NOT_PRIVATE}, {"r1", NOT_PRIVATE}, {"r2", NOT_PRIVATE}, + + {"zP0", IS_PRIVATE}, {"zP1", IS_PRIVATE}, {"zP2", IS_PRIVATE}, + {"bP0", IS_PRIVATE}, {"bP1", IS_PRIVATE}, {"bP2", IS_PRIVATE}, + {"cP0", IS_PRIVATE}, {"cP1", IS_PRIVATE}, {"cP2", IS_PRIVATE}, + {"dP0", IS_PRIVATE}, {"dP1", IS_PRIVATE}, {"dP2", IS_PRIVATE}, + {"fP0", IS_PRIVATE}, {"fP1", IS_PRIVATE}, {"fP2", IS_PRIVATE}, + {"iP0", IS_PRIVATE}, {"iP1", IS_PRIVATE}, {"iP2", IS_PRIVATE}, + {"lP0", IS_PRIVATE}, {"lP1", IS_PRIVATE}, {"lP2", IS_PRIVATE}, + {"rP0", IS_PRIVATE}, {"rP1", IS_PRIVATE}, {"rP2", IS_PRIVATE}, + + {"Z0", NOT_PRIVATE}, {"Z1", NOT_PRIVATE}, {"Z2", NOT_PRIVATE}, + {"B0", NOT_PRIVATE}, {"B1", NOT_PRIVATE}, {"B2", NOT_PRIVATE}, + {"C0", NOT_PRIVATE}, {"C1", NOT_PRIVATE}, {"C2", NOT_PRIVATE}, + {"D0", NOT_PRIVATE}, {"D1", NOT_PRIVATE}, {"D2", NOT_PRIVATE}, + {"F0", NOT_PRIVATE}, {"F1", NOT_PRIVATE}, {"F2", NOT_PRIVATE}, + {"I0", NOT_PRIVATE}, {"I1", NOT_PRIVATE}, {"I2", NOT_PRIVATE}, + {"L0", NOT_PRIVATE}, {"L1", NOT_PRIVATE}, {"L2", NOT_PRIVATE}, + {"R0", NOT_PRIVATE}, {"R1", NOT_PRIVATE}, {"R2", NOT_PRIVATE}, + + {"ZP0", IS_PRIVATE}, {"ZP1", IS_PRIVATE}, {"ZP2", IS_PRIVATE}, + {"BP0", IS_PRIVATE}, {"BP1", IS_PRIVATE}, {"BP2", IS_PRIVATE}, + {"CP0", IS_PRIVATE}, {"CP1", IS_PRIVATE}, {"CP2", IS_PRIVATE}, + {"DP0", IS_PRIVATE}, {"DP1", IS_PRIVATE}, {"DP2", IS_PRIVATE}, + {"FP0", IS_PRIVATE}, {"FP1", IS_PRIVATE}, {"FP2", IS_PRIVATE}, + {"IP0", IS_PRIVATE}, {"IP1", IS_PRIVATE}, {"IP2", IS_PRIVATE}, + {"LP0", IS_PRIVATE}, {"LP1", IS_PRIVATE}, {"LP2", IS_PRIVATE}, + {"RP0", IS_PRIVATE}, {"RP1", IS_PRIVATE}, {"RP2", IS_PRIVATE}, + + {"s0", NOT_PRIVATE}, {"s1", NOT_PRIVATE}, {"s2", NOT_PRIVATE}, + {"o0", NOT_PRIVATE}, {"o1", NOT_PRIVATE}, {"o2", NOT_PRIVATE}, + {"S0", IS_PRIVATE}, {"S1", IS_PRIVATE}, {"S2", IS_PRIVATE}, + {"O0", IS_PRIVATE}, {"O1", IS_PRIVATE}, {"O2", IS_PRIVATE}, + + {"u0", NOT_PRIVATE}, {"u1", NOT_PRIVATE}, {"u2", NOT_PRIVATE}, + {"v0", IS_PRIVATE}, {"v1", IS_PRIVATE}, {"v2", IS_PRIVATE}, + {"w0", NOT_PRIVATE}, {"w1", NOT_PRIVATE}, {"w2", NOT_PRIVATE}, + {"p0", NOT_PRIVATE}, {"p1", NOT_PRIVATE}, {"p2", NOT_PRIVATE}, + + {"h0", NOT_PRIVATE}, {"h1", NOT_PRIVATE}, {"h2", NOT_PRIVATE}, + {"j0", IS_PRIVATE}, {"j1", IS_PRIVATE}, {"j2", IS_PRIVATE}, + {"k0", NOT_PRIVATE}, {"k1", NOT_PRIVATE}, {"k2", NOT_PRIVATE}, + {"m0", NOT_PRIVATE}, {"m1", NOT_PRIVATE}, {"m2", NOT_PRIVATE} + }; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isPrivate() method for debuggee's fields..."); + + display("Total count of fields read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + TOTAL_FIELDS); + + // Check all fields from debuggee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String name; + boolean isPrivate; + String expectedValue; + + try { + field = debuggeeClass.fieldByName(checkedFields[i][0]); + } catch (Exception e) { + complain("Can't get field by name " + checkedFields[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + name = field.name(); + isPrivate = ((TypeComponent)field).isPrivate(); // cast to TypeComponent interface + expectedValue = checkedFields[i][1]; + if ((isPrivate && !expectedValue.equals(IS_PRIVATE)) || + (!isPrivate && expectedValue.equals(IS_PRIVATE)) ) { + complain("isPrivate() returned wrong value: " + isPrivate + + " for field " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isPrivate() returned expected " + isPrivate + + " for field " + name); + } + } + + display("Checking debuggee's fields completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001/TestDescription.java new file mode 100644 index 00000000000..48276967462 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001/TestDescription.java @@ -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/TypeComponent/isPrivate/isprivate001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isPrivate() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isPrivate() + * Determines if this object mirrors a private item. For ArrayType, + * the return value depends on the array component type. For primitive + * arrays the return value is always false. For object arrays, the + * return value is the same as would be returned for the component type. + * For primitive classes, such as Integer.TYPE, the return value is + * always false. + * Returns: + * true for items with private access; false otherwise. + * nsk/jdi/TypeComponent/isPrivate/isprivate001 checks assertions: + * public boolean isPrivate() + * 1. Returns true if the field was declared private. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isPrivate() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isPrivate method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isPrivate.isprivate001 + * nsk.jdi.TypeComponent.isPrivate.isprivate001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isPrivate.isprivate001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001a.java new file mode 100644 index 00000000000..7c537c07314 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001a.java @@ -0,0 +1,108 @@ +/* + * 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.TypeComponent.isPrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isprivate001a { + + 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}; + short r0, r1[] = {r0}, r2[][] = {r1}; + + private boolean zP0, zP1[] = {zP0}, zP2[][] = {zP1}; + private byte bP0, bP1[] = {bP0}, bP2[][] = {bP1}; + private char cP0, cP1[] = {cP0}, cP2[][] = {cP1}; + private double dP0, dP1[] = {dP0}, dP2[][] = {dP1}; + private float fP0, fP1[] = {fP0}, fP2[][] = {fP1}; + private int iP0, iP1[] = {iP0}, iP2[][] = {iP1}; + private long lP0, lP1[] = {lP0}, lP2[][] = {lP1}; + private short rP0, rP1[] = {rP0}, rP2[][] = {rP1}; + + Boolean Z0, Z1[] = {Z0}, Z2[][] = {Z1}; + Byte B0, B1[] = {B0}, B2[][] = {B1}; + Character C0, C1[] = {C0}, C2[][] = {C1}; + Double D0, D1[] = {D0}, D2[][] = {D1}; + Float F0, F1[] = {F0}, F2[][] = {F1}; + Integer I0, I1[] = {I0}, I2[][] = {I1}; + Long L0, L1[] = {L0}, L2[][] = {L1}; + Short R0, R1[] = {R0}, R2[][] = {R1}; + + private Boolean ZP0, ZP1[] = {ZP0}, ZP2[][] = {ZP1}; + private Byte BP0, BP1[] = {BP0}, BP2[][] = {BP1}; + private Character CP0, CP1[] = {CP0}, CP2[][] = {CP1}; + private Double DP0, DP1[] = {DP0}, DP2[][] = {DP1}; + private Float FP0, FP1[] = {FP0}, FP2[][] = {FP1}; + private Integer IP0, IP1[] = {IP0}, IP2[][] = {IP1}; + private Long LP0, LP1[] = {LP0}, LP2[][] = {LP1}; + private Short RP0, RP1[] = {RP0}, RP2[][] = {RP1}; + + String s0, s1[] = {s0}, s2[][] = {s1}; + Object o0, o1[] = {o0}, o2[][] = {o1}; + private String S0, S1[] = {S0}, S2[][] = {S1}; + private Object O0, O1[] = {O0}, O2[][] = {O1}; + + protected P u0, u1[] = {u0}, u2[][] = {u1}; + private P v0, v1[] = {v0}, v2[][] = {v1}; + public P w0, w1[] = {w0}, w2[][] = {w1}; + P p0, p1[] = {p0}, p2[][] = {p1}; // package private + + protected M h0, h1[] = {h0}, h2[][] = {h1}; + private M j0, j1[] = {j0}, j2[][] = {j1}; + public M k0, k1[] = {k0}, k2[][] = {k1}; + M m0, m1[] = {m0}, m2[][] = {m1}; // package private + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + isprivate001a isprivate001a_ = new isprivate001a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class P {} +interface M {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002.java new file mode 100644 index 00000000000..3abff8e1a7c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002.java @@ -0,0 +1,368 @@ +/* + * 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.TypeComponent.isPrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class isprivate002 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isPrivate."; + private final static String debuggerName = prefix + "isprivate002"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isPrivate() method for debuggee's methods..."); + + display("Total count of methods read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + checkedMethods.length+1); + + // Check all methods from debuggee + for (int i = 0; i < checkedMethods.length-1; i++) { + List listOfMethods; + int totalMethodsByName; + Method method; + String name; + boolean isPrivate; + String expectedValue; + + try { + listOfMethods = debuggeeClass.methodsByName(checkedMethods[i][0]); + } catch (Exception e) { + complain("Can't get method by name " + checkedMethods[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + checkedMethods[i][0] + " is " + totalMethodsByName + + ", should be 1."); + exitStatus = Consts.TEST_FAILED; + continue; + } + method = (Method)listOfMethods.get(0); + + name = method.name(); + isPrivate = ((TypeComponent)method).isPrivate(); // cast to TypeComponent interface + expectedValue = checkedMethods[i][1]; + if ((isPrivate && !expectedValue.equals(IS_PRIVATE)) || + (!isPrivate && expectedValue.equals(IS_PRIVATE)) ) { + complain("isPrivate() returned wrong value: " + isPrivate + + " for method " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isPrivate() returned expected " + isPrivate + + " for method " + name); + } + } + + display("Checking debuggee's methods completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + //--------------------------------------------- test specific fields + + final static String IS_PRIVATE = "true"; + final static String NOT_PRIVATE = "false"; + + /** debuggee's methods for check **/ + private final static String checkedMethods[][] = { + {"Mv", NOT_PRIVATE}, + {"Mz", NOT_PRIVATE}, + {"Mz1", NOT_PRIVATE}, + {"Mz2", NOT_PRIVATE}, + {"Mb", NOT_PRIVATE}, + {"Mb1", NOT_PRIVATE}, + {"Mb2", NOT_PRIVATE}, + {"Mc", NOT_PRIVATE}, + {"Mc1", NOT_PRIVATE}, + {"Mc2", NOT_PRIVATE}, + {"Md", NOT_PRIVATE}, + {"Md1", NOT_PRIVATE}, + {"Md2", NOT_PRIVATE}, + {"Mf1", NOT_PRIVATE}, + {"Mf2", NOT_PRIVATE}, + {"Mi", NOT_PRIVATE}, + {"Mi1", NOT_PRIVATE}, + {"Mi2", NOT_PRIVATE}, + {"Ml", NOT_PRIVATE}, + {"Ml1", NOT_PRIVATE}, + {"Ml2", NOT_PRIVATE}, + {"Mr", NOT_PRIVATE}, + {"Mr1", NOT_PRIVATE}, + {"Mr2", NOT_PRIVATE}, + + {"MvM", IS_PRIVATE}, + {"MzM", IS_PRIVATE}, + {"Mz1M", IS_PRIVATE}, + {"Mz2M", IS_PRIVATE}, + {"MbM", IS_PRIVATE}, + {"Mb1M", IS_PRIVATE}, + {"Mb2M", IS_PRIVATE}, + {"McM", IS_PRIVATE}, + {"Mc1M", IS_PRIVATE}, + {"Mc2M", IS_PRIVATE}, + {"MdM", IS_PRIVATE}, + {"Md1M", IS_PRIVATE}, + {"Md2M", IS_PRIVATE}, + {"MfM", IS_PRIVATE}, + {"Mf1M", IS_PRIVATE}, + {"Mf2M", IS_PRIVATE}, + {"MiM", IS_PRIVATE}, + {"Mi1M", IS_PRIVATE}, + {"Mi2M", IS_PRIVATE}, + {"MlM", IS_PRIVATE}, + {"Ml1M", IS_PRIVATE}, + {"Ml2M", IS_PRIVATE}, + {"MrM", IS_PRIVATE}, + {"Mr1M", IS_PRIVATE}, + {"Mr2M", IS_PRIVATE}, + + {"MvS", NOT_PRIVATE}, + {"MlS", NOT_PRIVATE}, + {"MlS1", NOT_PRIVATE}, + {"MlS2", NOT_PRIVATE}, + {"MvN", NOT_PRIVATE}, + {"MlN", NOT_PRIVATE}, + {"MlN1", NOT_PRIVATE}, + {"MlN2", NOT_PRIVATE}, + {"MvI", NOT_PRIVATE}, + {"MlI", NOT_PRIVATE}, + {"MlI1", NOT_PRIVATE}, + {"MlI2", NOT_PRIVATE}, + {"MvY", NOT_PRIVATE}, + {"MlY", NOT_PRIVATE}, + {"MlY1", NOT_PRIVATE}, + {"MlY2", NOT_PRIVATE}, + {"MvU", NOT_PRIVATE}, + {"MlU", NOT_PRIVATE}, + {"MlU1", NOT_PRIVATE}, + {"MlU2", NOT_PRIVATE}, + {"MvR", NOT_PRIVATE}, + {"MlR", NOT_PRIVATE}, + {"MlR1", NOT_PRIVATE}, + {"MlR2", NOT_PRIVATE}, + {"MvP", IS_PRIVATE}, + {"MlP", IS_PRIVATE}, + {"MlP1", IS_PRIVATE}, + {"MlP2", IS_PRIVATE}, + + {"MvSM", IS_PRIVATE}, + {"MlSM", IS_PRIVATE}, + {"MlS1M", IS_PRIVATE}, + {"MlS2M", IS_PRIVATE}, + {"MvNM", IS_PRIVATE}, + {"MlNM", IS_PRIVATE}, + {"MlN1M", IS_PRIVATE}, + {"MlN2M", IS_PRIVATE}, + {"MvIM", IS_PRIVATE}, + {"MlIM", IS_PRIVATE}, + {"MlI1M", IS_PRIVATE}, + {"MlI2M", IS_PRIVATE}, + {"MvYM", IS_PRIVATE}, + {"MlYM", IS_PRIVATE}, + {"MlY1M", IS_PRIVATE}, + {"MlY2M", IS_PRIVATE}, + {"MvPM", IS_PRIVATE}, + {"MlPM", IS_PRIVATE}, + {"MlP1M", IS_PRIVATE}, + {"MlP2M", IS_PRIVATE}, + + {"MX", NOT_PRIVATE}, + {"MX1", NOT_PRIVATE}, + {"MX2", NOT_PRIVATE}, + {"MO", NOT_PRIVATE}, + {"MO1", NOT_PRIVATE}, + {"MO2", NOT_PRIVATE}, + + {"MXM", IS_PRIVATE}, + {"MX1M", IS_PRIVATE}, + {"MX2M", IS_PRIVATE}, + {"MOM", IS_PRIVATE}, + {"MO1M", IS_PRIVATE}, + {"MO2M", IS_PRIVATE}, + + {"MLS", NOT_PRIVATE}, + {"MLS1", NOT_PRIVATE}, + {"MLS2", NOT_PRIVATE}, + {"MLN", NOT_PRIVATE}, + {"MLN1", NOT_PRIVATE}, + {"MLN2", NOT_PRIVATE}, + {"MLI", NOT_PRIVATE}, + {"MLI1", NOT_PRIVATE}, + {"MLI2", NOT_PRIVATE}, + {"MLY", NOT_PRIVATE}, + {"MLY1", NOT_PRIVATE}, + {"MLY2", NOT_PRIVATE}, + {"MLU", NOT_PRIVATE}, + {"MLU1", NOT_PRIVATE}, + {"MLU2", NOT_PRIVATE}, + {"MLR", NOT_PRIVATE}, + {"MLR1", NOT_PRIVATE}, + {"MLR2", NOT_PRIVATE}, + {"MLP", IS_PRIVATE}, + {"MLP1", IS_PRIVATE}, + {"MLP2", IS_PRIVATE}, + + {"MLSM", IS_PRIVATE}, + {"MLS1M", IS_PRIVATE}, + {"MLS2M", IS_PRIVATE}, + {"MLNM", IS_PRIVATE}, + {"MLN1M", IS_PRIVATE}, + {"MLN2M", IS_PRIVATE}, + {"MLIM", IS_PRIVATE}, + {"MLI1M", IS_PRIVATE}, + {"MLI2M", IS_PRIVATE}, + {"MLYM", IS_PRIVATE}, + {"MLY1M", IS_PRIVATE}, + {"MLY2M", IS_PRIVATE}, + {"MLPM", IS_PRIVATE}, + {"MLP1M", IS_PRIVATE}, + {"MLP2M", IS_PRIVATE}, + + {"ME", NOT_PRIVATE}, + {"ME1", NOT_PRIVATE}, + {"ME2", NOT_PRIVATE}, + {"MEM", IS_PRIVATE}, + {"ME1M", IS_PRIVATE}, + {"ME2M", IS_PRIVATE}, + + {"MES", NOT_PRIVATE}, + {"MES1", NOT_PRIVATE}, + {"MES2", NOT_PRIVATE}, + {"MEN", NOT_PRIVATE}, + {"MEN1", NOT_PRIVATE}, + {"MEN2", NOT_PRIVATE}, + {"MEI", NOT_PRIVATE}, + {"MEI1", NOT_PRIVATE}, + {"MEI2", NOT_PRIVATE}, + {"MEY", NOT_PRIVATE}, + {"MEY1", NOT_PRIVATE}, + {"MEY2", NOT_PRIVATE}, + {"MEU", NOT_PRIVATE}, + {"MEU1", NOT_PRIVATE}, + {"MEU2", NOT_PRIVATE}, + {"MER", NOT_PRIVATE}, + {"MER1", NOT_PRIVATE}, + {"MER2", NOT_PRIVATE}, + {"MEP", IS_PRIVATE}, + {"MEP1", IS_PRIVATE}, + {"MEP2", IS_PRIVATE}, + + {"MESM", IS_PRIVATE}, + {"MES1M", IS_PRIVATE}, + {"MES2M", IS_PRIVATE}, + {"MENM", IS_PRIVATE}, + {"MEN1M", IS_PRIVATE}, + {"MEN2M", IS_PRIVATE}, + {"MEIM", IS_PRIVATE}, + {"MEI1M", IS_PRIVATE}, + {"MEI2M", IS_PRIVATE}, + {"MEYM", IS_PRIVATE}, + {"MEY1M", IS_PRIVATE}, + {"MEY2M", IS_PRIVATE}, + {"MEPM", IS_PRIVATE}, + {"MEP1M", IS_PRIVATE}, + {"MEP2M", IS_PRIVATE} + }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002/TestDescription.java new file mode 100644 index 00000000000..c1b21a21716 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002/TestDescription.java @@ -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/TypeComponent/isPrivate/isprivate002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isPrivate() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isPrivate() + * Determines if this object mirrors a private item. For ArrayType, + * the return value depends on the array component type. For primitive + * arrays the return value is always false. For object arrays, the + * return value is the same as would be returned for the component type. + * For primitive classes, such as Integer.TYPE, the return value is + * always false. + * Returns: + * true for items with private access; false otherwise. + * nsk/jdi/TypeComponent/isPrivate/isprivate002 checks assertions: + * public boolean isPrivate() + * 1. Returns true if the method was declared private. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isPrivate() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isPrivate method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isPrivate.isprivate002 + * nsk.jdi.TypeComponent.isPrivate.isprivate002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isPrivate.isprivate002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002a.java new file mode 100644 index 00000000000..627c4658f30 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate002a.java @@ -0,0 +1,261 @@ +/* + * 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.TypeComponent.isPrivate; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isprivate002a { + + //--------------------------------------------- test mutable methods + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + isprivate002a isprivate002a_ = new isprivate002a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------- test specific methods + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + private void MvM() {}; + private boolean MzM(boolean z) { return z; }; + private boolean[] Mz1M(boolean z[]) { return z; }; + private boolean[][] Mz2M(boolean z[][]) { return z; }; + private byte MbM(byte b) { return b; }; + private byte[] Mb1M(byte b[]) { return b; }; + private byte[][] Mb2M(byte b[][]) { return b; }; + private char McM(char c) { return c; }; + private char[] Mc1M(char c[]) { return c; }; + private char[][] Mc2M(char c[][]) { return c; }; + private double MdM(double d) { return d; }; + private double[] Md1M(double d[]) { return d; }; + private double[][] Md2M(double d[][]) { return d; }; + private float MfM(float f) { return f; }; + private float[] Mf1M(float f[]) { return f; }; + private float[][] Mf2M(float f[][]) { return f; }; + private int MiM(int i) { return i; }; + private int[] Mi1M(int i[]) { return i; }; + private int[][] Mi2M(int i[][]) { return i; }; + private long MlM(long l) { return l; }; + private long[] Ml1M(long l[]) { return l; }; + private long[][] Ml2M(long l[][]) { return l; }; + private short MrM(short r) { return r; }; + private short[] Mr1M(short r[]) { return r; }; + private short[][] Mr2M(short r[][]) { return r; }; + + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + private static void MvSM() {}; + private static long MlSM(long l) { return l; }; + private static long[] MlS1M(long l[]) { return l; }; + private static long[][] MlS2M(long l[][]) { return l; }; + private native void MvNM(); + private native long MlNM(long l); + private native long[] MlN1M(long l[]); + private native long[][] MlN2M(long l[][]); + private strictfp void MvIM() {}; + private strictfp long MlIM(long l) { return l; }; + private strictfp long[] MlI1M(long l[]) { return l; }; + private strictfp long[][] MlI2M(long l[][]) { return l; }; + private synchronized void MvYM() {}; + private synchronized long MlYM(long l) { return l; }; + private synchronized long[] MlY1M(long l[]) { return l; }; + private synchronized long[][] MlY2M(long l[][]) { return l; }; + private final void MvPM() {}; + private final long MlPM(long l) { return l; }; + private final long[] MlP1M(long l[]) { return l; }; + private final long[][] MlP2M(long l[][]) { return l; }; + + C002 MX(C002 X) { return X; }; + C002[] MX1(C002 X[]) { return X; }; + C002[][] MX2(C002 X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + private C002 MXM(C002 X) { return X; }; + private C002[] MX1M(C002 X[]) { return X; }; + private C002[][] MX2M(C002 X[][]) { return X; }; + private Object MOM(Object O) { return O; }; + private Object[] MO1M(Object[] O) { return O; }; + private Object[][] MO2M(Object[][] O) { return O; }; + + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long[] L) { return L; }; + static Long[][] MLS2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + private static Long MLSM(Long L) { return L; }; + private static Long[] MLS1M(Long[] L) { return L; }; + private static Long[][] MLS2M(Long[][] L) { return L; }; + private native Long MLNM(Long L); + private native Long[] MLN1M(Long[] L); + private native Long[][] MLN2M(Long[][] L); + private strictfp Long MLIM(Long L) { return L; }; + private strictfp Long[] MLI1M(Long[] L) { return L; }; + private strictfp Long[][] MLI2M(Long[][] L) { return L; }; + private synchronized Long MLYM(Long L) { return L; }; + private synchronized Long[] MLY1M(Long[] L) { return L; }; + private synchronized Long[][] MLY2M(Long[][] L) { return L; }; + private final Long MLPM(Long L) { return L; }; + private final Long[] MLP1M(Long[] L) { return L; }; + private final Long[][] MLP2M(Long[][] L) { return L; }; + + I002 ME(I002 E) { return E; }; + I002[] ME1(I002[] E) { return E; }; + I002[][] ME2(I002[][] E) { return E; }; + private I002 MEM(I002 E) { return E; }; + private I002[] ME1M(I002[] E) { return E; }; + private I002[][] ME2M(I002[][] E) { return E; }; + + static I002 MES(I002 E) { return E; }; + static I002[] MES1(I002[] E) { return E; }; + static I002[][] MES2(I002[][] E) { return E; }; + native I002 MEN(I002 E); + native I002[] MEN1(I002[] E); + native I002[][] MEN2(I002[][] E); + strictfp I002 MEI(I002 E) { return E; }; + strictfp I002[] MEI1(I002[] E) { return E; }; + strictfp I002[][] MEI2(I002[][] E) { return E; }; + synchronized I002 MEY(I002 E) { return E; }; + synchronized I002[] MEY1(I002[] E) { return E; }; + synchronized I002[][] MEY2(I002[][] E) { return E; }; + public I002 MEU(I002 E) { return E; }; + public I002[] MEU1(I002[] E) { return E; }; + public I002[][] MEU2(I002[][] E) { return E; }; + protected I002 MER(I002 E) { return E; }; + protected I002[] MER1(I002[] E) { return E; }; + protected I002[][] MER2(I002[][] E) { return E; }; + private I002 MEP(I002 E) { return E; }; + private I002[] MEP1(I002[] E) { return E; }; + private I002[][] MEP2(I002[][] E) { return E; }; + + private static I002 MESM(I002 E) { return E; }; + private static I002[] MES1M(I002[] E) { return E; }; + private static I002[][] MES2M(I002[][] E) { return E; }; + private native I002 MENM(I002 E); + private native I002[] MEN1M(I002[] E); + private native I002[][] MEN2M(I002[][] E); + private strictfp I002 MEIM(I002 E) { return E; }; + private strictfp I002[] MEI1M(I002[] E) { return E; }; + private strictfp I002[][] MEI2M(I002[][] E) { return E; }; + private synchronized I002 MEYM(I002 E) { return E; }; + private synchronized I002[] MEY1M(I002[] E) { return E; }; + private synchronized I002[][] MEY2M(I002[][] E) { return E; }; + private final I002 MEPM(I002 E) { return E; }; + private final I002[] MEP1M(I002[] E) { return E; }; + private final I002[][] MEP2M(I002[][] E) { return E; }; + +} + +//--------------------------------------------- test specific methods +class C002 {} +interface I002 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001.java new file mode 100644 index 00000000000..3c422c62019 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001.java @@ -0,0 +1,207 @@ +/* + * 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.TypeComponent.isProtected; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class isprotected001 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isProtected."; + private final static String debuggerName = prefix + "isprotected001"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + final static String IS_PROTECTED = "true"; + final static String NOT_PROTECTED = "false"; + final static int TOTAL_FIELDS = 132; + + /** debuggee's fields for check **/ + private final static String checkedFields[][] = { + {"z0", NOT_PROTECTED}, {"z1", NOT_PROTECTED}, {"z2", NOT_PROTECTED}, + {"b0", NOT_PROTECTED}, {"b1", NOT_PROTECTED}, {"b2", NOT_PROTECTED}, + {"c0", NOT_PROTECTED}, {"c1", NOT_PROTECTED}, {"c2", NOT_PROTECTED}, + {"d0", NOT_PROTECTED}, {"d1", NOT_PROTECTED}, {"d2", NOT_PROTECTED}, + {"f0", NOT_PROTECTED}, {"f1", NOT_PROTECTED}, {"f2", NOT_PROTECTED}, + {"i0", NOT_PROTECTED}, {"i1", NOT_PROTECTED}, {"i2", NOT_PROTECTED}, + {"l0", NOT_PROTECTED}, {"l1", NOT_PROTECTED}, {"l2", NOT_PROTECTED}, + {"r0", NOT_PROTECTED}, {"r1", NOT_PROTECTED}, {"r2", NOT_PROTECTED}, + + {"zP0", IS_PROTECTED}, {"zP1", IS_PROTECTED}, {"zP2", IS_PROTECTED}, + {"bP0", IS_PROTECTED}, {"bP1", IS_PROTECTED}, {"bP2", IS_PROTECTED}, + {"cP0", IS_PROTECTED}, {"cP1", IS_PROTECTED}, {"cP2", IS_PROTECTED}, + {"dP0", IS_PROTECTED}, {"dP1", IS_PROTECTED}, {"dP2", IS_PROTECTED}, + {"fP0", IS_PROTECTED}, {"fP1", IS_PROTECTED}, {"fP2", IS_PROTECTED}, + {"iP0", IS_PROTECTED}, {"iP1", IS_PROTECTED}, {"iP2", IS_PROTECTED}, + {"lP0", IS_PROTECTED}, {"lP1", IS_PROTECTED}, {"lP2", IS_PROTECTED}, + {"rP0", IS_PROTECTED}, {"rP1", IS_PROTECTED}, {"rP2", IS_PROTECTED}, + + {"Z0", NOT_PROTECTED}, {"Z1", NOT_PROTECTED}, {"Z2", NOT_PROTECTED}, + {"B0", NOT_PROTECTED}, {"B1", NOT_PROTECTED}, {"B2", NOT_PROTECTED}, + {"C0", NOT_PROTECTED}, {"C1", NOT_PROTECTED}, {"C2", NOT_PROTECTED}, + {"D0", NOT_PROTECTED}, {"D1", NOT_PROTECTED}, {"D2", NOT_PROTECTED}, + {"F0", NOT_PROTECTED}, {"F1", NOT_PROTECTED}, {"F2", NOT_PROTECTED}, + {"I0", NOT_PROTECTED}, {"I1", NOT_PROTECTED}, {"I2", NOT_PROTECTED}, + {"L0", NOT_PROTECTED}, {"L1", NOT_PROTECTED}, {"L2", NOT_PROTECTED}, + {"R0", NOT_PROTECTED}, {"R1", NOT_PROTECTED}, {"R2", NOT_PROTECTED}, + + {"ZP0", IS_PROTECTED}, {"ZP1", IS_PROTECTED}, {"ZP2", IS_PROTECTED}, + {"BP0", IS_PROTECTED}, {"BP1", IS_PROTECTED}, {"BP2", IS_PROTECTED}, + {"CP0", IS_PROTECTED}, {"CP1", IS_PROTECTED}, {"CP2", IS_PROTECTED}, + {"DP0", IS_PROTECTED}, {"DP1", IS_PROTECTED}, {"DP2", IS_PROTECTED}, + {"FP0", IS_PROTECTED}, {"FP1", IS_PROTECTED}, {"FP2", IS_PROTECTED}, + {"IP0", IS_PROTECTED}, {"IP1", IS_PROTECTED}, {"IP2", IS_PROTECTED}, + {"LP0", IS_PROTECTED}, {"LP1", IS_PROTECTED}, {"LP2", IS_PROTECTED}, + {"RP0", IS_PROTECTED}, {"RP1", IS_PROTECTED}, {"RP2", IS_PROTECTED}, + + {"s0", NOT_PROTECTED}, {"s1", NOT_PROTECTED}, {"s2", NOT_PROTECTED}, + {"o0", NOT_PROTECTED}, {"o1", NOT_PROTECTED}, {"o2", NOT_PROTECTED}, + {"S0", IS_PROTECTED}, {"S1", IS_PROTECTED}, {"S2", IS_PROTECTED}, + {"O0", IS_PROTECTED}, {"O1", IS_PROTECTED}, {"O2", IS_PROTECTED}, + + {"u0", NOT_PROTECTED}, {"u1", NOT_PROTECTED}, {"u2", NOT_PROTECTED}, + {"v0", IS_PROTECTED}, {"v1", IS_PROTECTED}, {"v2", IS_PROTECTED}, + {"w0", NOT_PROTECTED}, {"w1", NOT_PROTECTED}, {"w2", NOT_PROTECTED}, + {"p0", NOT_PROTECTED}, {"p1", NOT_PROTECTED}, {"p2", NOT_PROTECTED}, + + {"h0", NOT_PROTECTED}, {"h1", NOT_PROTECTED}, {"h2", NOT_PROTECTED}, + {"j0", IS_PROTECTED}, {"j1", IS_PROTECTED}, {"j2", IS_PROTECTED}, + {"k0", NOT_PROTECTED}, {"k1", NOT_PROTECTED}, {"k2", NOT_PROTECTED}, + {"m0", NOT_PROTECTED}, {"m1", NOT_PROTECTED}, {"m2", NOT_PROTECTED} + }; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isProtected() method for debuggee's fields..."); + + display("Total count of fields read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + TOTAL_FIELDS); + + // Check all fields from debuggee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String name; + boolean isProtected; + String expectedValue; + + try { + field = debuggeeClass.fieldByName(checkedFields[i][0]); + } catch (Exception e) { + complain("Can't get field by name " + checkedFields[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + name = field.name(); + isProtected = ((TypeComponent)field).isProtected(); // cast to TypeComponent interface + expectedValue = checkedFields[i][1]; + if ((isProtected && !expectedValue.equals(IS_PROTECTED)) || + (!isProtected && expectedValue.equals(IS_PROTECTED)) ) { + complain("isProtected() returned wrong value: " + isProtected + + " for field " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isProtected() returned expected " + isProtected + + " for field " + name); + } + } + + display("Checking debuggee's fields completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001/TestDescription.java new file mode 100644 index 00000000000..0b48cc8cbda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001/TestDescription.java @@ -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/TypeComponent/isProtected/isprotected001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isProtected() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isProtected() + * Determines if this object mirrors a protected item. For ArrayType, + * the return value depends on the array component type. For primitive arrays + * the return value is always false. For object arrays, the return value is + * the same as would be returned for the component type. For primitive + * classes, such as Integer.TYPE, the return value is always false. + * Returns: + * true for items with private access; false otherwise. + * nsk/jdi/TypeComponent/isProtected/isprotected001 checks assertions: + * public boolean isProtected() + * 1. Returns true if the field was declared protected. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isProtected() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isProtected method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isProtected.isprotected001 + * nsk.jdi.TypeComponent.isProtected.isprotected001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isProtected.isprotected001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001a.java new file mode 100644 index 00000000000..69eec73ebb2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001a.java @@ -0,0 +1,108 @@ +/* + * 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.TypeComponent.isProtected; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isprotected001a { + + 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}; + short r0, r1[] = {r0}, r2[][] = {r1}; + + protected boolean zP0, zP1[] = {zP0}, zP2[][] = {zP1}; + protected byte bP0, bP1[] = {bP0}, bP2[][] = {bP1}; + protected char cP0, cP1[] = {cP0}, cP2[][] = {cP1}; + protected double dP0, dP1[] = {dP0}, dP2[][] = {dP1}; + protected float fP0, fP1[] = {fP0}, fP2[][] = {fP1}; + protected int iP0, iP1[] = {iP0}, iP2[][] = {iP1}; + protected long lP0, lP1[] = {lP0}, lP2[][] = {lP1}; + protected short rP0, rP1[] = {rP0}, rP2[][] = {rP1}; + + Boolean Z0, Z1[] = {Z0}, Z2[][] = {Z1}; + Byte B0, B1[] = {B0}, B2[][] = {B1}; + Character C0, C1[] = {C0}, C2[][] = {C1}; + Double D0, D1[] = {D0}, D2[][] = {D1}; + Float F0, F1[] = {F0}, F2[][] = {F1}; + Integer I0, I1[] = {I0}, I2[][] = {I1}; + Long L0, L1[] = {L0}, L2[][] = {L1}; + Short R0, R1[] = {R0}, R2[][] = {R1}; + + protected Boolean ZP0, ZP1[] = {ZP0}, ZP2[][] = {ZP1}; + protected Byte BP0, BP1[] = {BP0}, BP2[][] = {BP1}; + protected Character CP0, CP1[] = {CP0}, CP2[][] = {CP1}; + protected Double DP0, DP1[] = {DP0}, DP2[][] = {DP1}; + protected Float FP0, FP1[] = {FP0}, FP2[][] = {FP1}; + protected Integer IP0, IP1[] = {IP0}, IP2[][] = {IP1}; + protected Long LP0, LP1[] = {LP0}, LP2[][] = {LP1}; + protected Short RP0, RP1[] = {RP0}, RP2[][] = {RP1}; + + String s0, s1[] = {s0}, s2[][] = {s1}; + Object o0, o1[] = {o0}, o2[][] = {o1}; + protected String S0, S1[] = {S0}, S2[][] = {S1}; + protected Object O0, O1[] = {O0}, O2[][] = {O1}; + + private P u0, u1[] = {u0}, u2[][] = {u1}; + protected P v0, v1[] = {v0}, v2[][] = {v1}; + public P w0, w1[] = {w0}, w2[][] = {w1}; + P p0, p1[] = {p0}, p2[][] = {p1}; // package private + + private M h0, h1[] = {h0}, h2[][] = {h1}; + protected M j0, j1[] = {j0}, j2[][] = {j1}; + public M k0, k1[] = {k0}, k2[][] = {k1}; + M m0, m1[] = {m0}, m2[][] = {m1}; // package private + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + isprotected001a isprotected001a_ = new isprotected001a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class P {} +interface M {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002.java new file mode 100644 index 00000000000..3b6a3a891f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002.java @@ -0,0 +1,368 @@ +/* + * 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.TypeComponent.isProtected; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class isprotected002 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isProtected."; + private final static String debuggerName = prefix + "isprotected002"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isProtected() method for debuggee's methods..."); + + display("Total count of methods read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + checkedMethods.length+1); + + // Check all methods from debuggee + for (int i = 0; i < checkedMethods.length-1; i++) { + List listOfMethods; + int totalMethodsByName; + Method method; + String name; + boolean isProtected; + String expectedValue; + + try { + listOfMethods = debuggeeClass.methodsByName(checkedMethods[i][0]); + } catch (Exception e) { + complain("Can't get method by name " + checkedMethods[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + checkedMethods[i][0] + " is " + totalMethodsByName + + ", should be 1."); + exitStatus = Consts.TEST_FAILED; + continue; + } + method = (Method)listOfMethods.get(0); + + name = method.name(); + isProtected = ((TypeComponent)method).isProtected(); // cast to TypeComponent interface + expectedValue = checkedMethods[i][1]; + if ((isProtected && !expectedValue.equals(IS_PROTECTED)) || + (!isProtected && expectedValue.equals(IS_PROTECTED)) ) { + complain("isProtected() returned wrong value: " + isProtected + + " for method " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isProtected() returned expected " + isProtected + + " for method " + name); + } + } + + display("Checking debuggee's methods completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + //--------------------------------------------- test specific fields + + final static String IS_PROTECTED = "true"; + final static String NOT_PROTECTED = "false"; + + /** debuggee's methods for check **/ + private final static String checkedMethods[][] = { + {"Mv", NOT_PROTECTED}, + {"Mz", NOT_PROTECTED}, + {"Mz1", NOT_PROTECTED}, + {"Mz2", NOT_PROTECTED}, + {"Mb", NOT_PROTECTED}, + {"Mb1", NOT_PROTECTED}, + {"Mb2", NOT_PROTECTED}, + {"Mc", NOT_PROTECTED}, + {"Mc1", NOT_PROTECTED}, + {"Mc2", NOT_PROTECTED}, + {"Md", NOT_PROTECTED}, + {"Md1", NOT_PROTECTED}, + {"Md2", NOT_PROTECTED}, + {"Mf1", NOT_PROTECTED}, + {"Mf2", NOT_PROTECTED}, + {"Mi", NOT_PROTECTED}, + {"Mi1", NOT_PROTECTED}, + {"Mi2", NOT_PROTECTED}, + {"Ml", NOT_PROTECTED}, + {"Ml1", NOT_PROTECTED}, + {"Ml2", NOT_PROTECTED}, + {"Mr", NOT_PROTECTED}, + {"Mr1", NOT_PROTECTED}, + {"Mr2", NOT_PROTECTED}, + + {"MvM", IS_PROTECTED}, + {"MzM", IS_PROTECTED}, + {"Mz1M", IS_PROTECTED}, + {"Mz2M", IS_PROTECTED}, + {"MbM", IS_PROTECTED}, + {"Mb1M", IS_PROTECTED}, + {"Mb2M", IS_PROTECTED}, + {"McM", IS_PROTECTED}, + {"Mc1M", IS_PROTECTED}, + {"Mc2M", IS_PROTECTED}, + {"MdM", IS_PROTECTED}, + {"Md1M", IS_PROTECTED}, + {"Md2M", IS_PROTECTED}, + {"MfM", IS_PROTECTED}, + {"Mf1M", IS_PROTECTED}, + {"Mf2M", IS_PROTECTED}, + {"MiM", IS_PROTECTED}, + {"Mi1M", IS_PROTECTED}, + {"Mi2M", IS_PROTECTED}, + {"MlM", IS_PROTECTED}, + {"Ml1M", IS_PROTECTED}, + {"Ml2M", IS_PROTECTED}, + {"MrM", IS_PROTECTED}, + {"Mr1M", IS_PROTECTED}, + {"Mr2M", IS_PROTECTED}, + + {"MvS", NOT_PROTECTED}, + {"MlS", NOT_PROTECTED}, + {"MlS1", NOT_PROTECTED}, + {"MlS2", NOT_PROTECTED}, + {"MvN", NOT_PROTECTED}, + {"MlN", NOT_PROTECTED}, + {"MlN1", NOT_PROTECTED}, + {"MlN2", NOT_PROTECTED}, + {"MvI", NOT_PROTECTED}, + {"MlI", NOT_PROTECTED}, + {"MlI1", NOT_PROTECTED}, + {"MlI2", NOT_PROTECTED}, + {"MvY", NOT_PROTECTED}, + {"MlY", NOT_PROTECTED}, + {"MlY1", NOT_PROTECTED}, + {"MlY2", NOT_PROTECTED}, + {"MvU", NOT_PROTECTED}, + {"MlU", NOT_PROTECTED}, + {"MlU1", NOT_PROTECTED}, + {"MlU2", NOT_PROTECTED}, + {"MvR", IS_PROTECTED}, + {"MlR", IS_PROTECTED}, + {"MlR1", IS_PROTECTED}, + {"MlR2", IS_PROTECTED}, + {"MvP", NOT_PROTECTED}, + {"MlP", NOT_PROTECTED}, + {"MlP1", NOT_PROTECTED}, + {"MlP2", NOT_PROTECTED}, + + {"MvSM", IS_PROTECTED}, + {"MlSM", IS_PROTECTED}, + {"MlS1M", IS_PROTECTED}, + {"MlS2M", IS_PROTECTED}, + {"MvNM", IS_PROTECTED}, + {"MlNM", IS_PROTECTED}, + {"MlN1M", IS_PROTECTED}, + {"MlN2M", IS_PROTECTED}, + {"MvIM", IS_PROTECTED}, + {"MlIM", IS_PROTECTED}, + {"MlI1M", IS_PROTECTED}, + {"MlI2M", IS_PROTECTED}, + {"MvYM", IS_PROTECTED}, + {"MlYM", IS_PROTECTED}, + {"MlY1M", IS_PROTECTED}, + {"MlY2M", IS_PROTECTED}, + {"MvPM", IS_PROTECTED}, + {"MlPM", IS_PROTECTED}, + {"MlP1M", IS_PROTECTED}, + {"MlP2M", IS_PROTECTED}, + + {"MX", NOT_PROTECTED}, + {"MX1", NOT_PROTECTED}, + {"MX2", NOT_PROTECTED}, + {"MO", NOT_PROTECTED}, + {"MO1", NOT_PROTECTED}, + {"MO2", NOT_PROTECTED}, + + {"MXM", IS_PROTECTED}, + {"MX1M", IS_PROTECTED}, + {"MX2M", IS_PROTECTED}, + {"MOM", IS_PROTECTED}, + {"MO1M", IS_PROTECTED}, + {"MO2M", IS_PROTECTED}, + + {"MLS", NOT_PROTECTED}, + {"MLS1", NOT_PROTECTED}, + {"MLS2", NOT_PROTECTED}, + {"MLN", NOT_PROTECTED}, + {"MLN1", NOT_PROTECTED}, + {"MLN2", NOT_PROTECTED}, + {"MLI", NOT_PROTECTED}, + {"MLI1", NOT_PROTECTED}, + {"MLI2", NOT_PROTECTED}, + {"MLY", NOT_PROTECTED}, + {"MLY1", NOT_PROTECTED}, + {"MLY2", NOT_PROTECTED}, + {"MLU", NOT_PROTECTED}, + {"MLU1", NOT_PROTECTED}, + {"MLU2", NOT_PROTECTED}, + {"MLR", IS_PROTECTED}, + {"MLR1", IS_PROTECTED}, + {"MLR2", IS_PROTECTED}, + {"MLP", NOT_PROTECTED}, + {"MLP1", NOT_PROTECTED}, + {"MLP2", NOT_PROTECTED}, + + {"MLSM", IS_PROTECTED}, + {"MLS1M", IS_PROTECTED}, + {"MLS2M", IS_PROTECTED}, + {"MLNM", IS_PROTECTED}, + {"MLN1M", IS_PROTECTED}, + {"MLN2M", IS_PROTECTED}, + {"MLIM", IS_PROTECTED}, + {"MLI1M", IS_PROTECTED}, + {"MLI2M", IS_PROTECTED}, + {"MLYM", IS_PROTECTED}, + {"MLY1M", IS_PROTECTED}, + {"MLY2M", IS_PROTECTED}, + {"MLPM", IS_PROTECTED}, + {"MLP1M", IS_PROTECTED}, + {"MLP2M", IS_PROTECTED}, + + {"ME", NOT_PROTECTED}, + {"ME1", NOT_PROTECTED}, + {"ME2", NOT_PROTECTED}, + {"MEM", IS_PROTECTED}, + {"ME1M", IS_PROTECTED}, + {"ME2M", IS_PROTECTED}, + + {"MES", NOT_PROTECTED}, + {"MES1", NOT_PROTECTED}, + {"MES2", NOT_PROTECTED}, + {"MEN", NOT_PROTECTED}, + {"MEN1", NOT_PROTECTED}, + {"MEN2", NOT_PROTECTED}, + {"MEI", NOT_PROTECTED}, + {"MEI1", NOT_PROTECTED}, + {"MEI2", NOT_PROTECTED}, + {"MEY", NOT_PROTECTED}, + {"MEY1", NOT_PROTECTED}, + {"MEY2", NOT_PROTECTED}, + {"MEU", NOT_PROTECTED}, + {"MEU1", NOT_PROTECTED}, + {"MEU2", NOT_PROTECTED}, + {"MER", IS_PROTECTED}, + {"MER1", IS_PROTECTED}, + {"MER2", IS_PROTECTED}, + {"MEP", NOT_PROTECTED}, + {"MEP1", NOT_PROTECTED}, + {"MEP2", NOT_PROTECTED}, + + {"MESM", IS_PROTECTED}, + {"MES1M", IS_PROTECTED}, + {"MES2M", IS_PROTECTED}, + {"MENM", IS_PROTECTED}, + {"MEN1M", IS_PROTECTED}, + {"MEN2M", IS_PROTECTED}, + {"MEIM", IS_PROTECTED}, + {"MEI1M", IS_PROTECTED}, + {"MEI2M", IS_PROTECTED}, + {"MEYM", IS_PROTECTED}, + {"MEY1M", IS_PROTECTED}, + {"MEY2M", IS_PROTECTED}, + {"MEPM", IS_PROTECTED}, + {"MEP1M", IS_PROTECTED}, + {"MEP2M", IS_PROTECTED} + }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002/TestDescription.java new file mode 100644 index 00000000000..5a80970f3d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002/TestDescription.java @@ -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/TypeComponent/isProtected/isprotected002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isProtected() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isProtected() + * Determines if this object mirrors a protected item. For ArrayType, + * the return value depends on the array component type. For primitive arrays + * the return value is always false. For object arrays, the return value is + * the same as would be returned for the component type. For primitive + * classes, such as Integer.TYPE, the return value is always false. + * Returns: + * true for items with private access; false otherwise. + * nsk/jdi/TypeComponent/isProtected/isprotected002 checks assertions: + * public boolean isProtected() + * 1. Returns true if the method was declared protected. + * 2. Returns false otherwise. + * Debugger gets each method from debuggee calling by name and then checks + * if method isProtected() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isProtected method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isProtected.isprotected002 + * nsk.jdi.TypeComponent.isProtected.isprotected002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isProtected.isprotected002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002a.java new file mode 100644 index 00000000000..2b912cd57f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected002a.java @@ -0,0 +1,261 @@ +/* + * 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.TypeComponent.isProtected; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isprotected002a { + + //--------------------------------------------- test mutable methods + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + isprotected002a isprotected002a_ = new isprotected002a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------- test specific methods + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + protected void MvM() {}; + protected boolean MzM(boolean z) { return z; }; + protected boolean[] Mz1M(boolean z[]) { return z; }; + protected boolean[][] Mz2M(boolean z[][]) { return z; }; + protected byte MbM(byte b) { return b; }; + protected byte[] Mb1M(byte b[]) { return b; }; + protected byte[][] Mb2M(byte b[][]) { return b; }; + protected char McM(char c) { return c; }; + protected char[] Mc1M(char c[]) { return c; }; + protected char[][] Mc2M(char c[][]) { return c; }; + protected double MdM(double d) { return d; }; + protected double[] Md1M(double d[]) { return d; }; + protected double[][] Md2M(double d[][]) { return d; }; + protected float MfM(float f) { return f; }; + protected float[] Mf1M(float f[]) { return f; }; + protected float[][] Mf2M(float f[][]) { return f; }; + protected int MiM(int i) { return i; }; + protected int[] Mi1M(int i[]) { return i; }; + protected int[][] Mi2M(int i[][]) { return i; }; + protected long MlM(long l) { return l; }; + protected long[] Ml1M(long l[]) { return l; }; + protected long[][] Ml2M(long l[][]) { return l; }; + protected short MrM(short r) { return r; }; + protected short[] Mr1M(short r[]) { return r; }; + protected short[][] Mr2M(short r[][]) { return r; }; + + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + protected static void MvSM() {}; + protected static long MlSM(long l) { return l; }; + protected static long[] MlS1M(long l[]) { return l; }; + protected static long[][] MlS2M(long l[][]) { return l; }; + protected native void MvNM(); + protected native long MlNM(long l); + protected native long[] MlN1M(long l[]); + protected native long[][] MlN2M(long l[][]); + protected strictfp void MvIM() {}; + protected strictfp long MlIM(long l) { return l; }; + protected strictfp long[] MlI1M(long l[]) { return l; }; + protected strictfp long[][] MlI2M(long l[][]) { return l; }; + protected synchronized void MvYM() {}; + protected synchronized long MlYM(long l) { return l; }; + protected synchronized long[] MlY1M(long l[]) { return l; }; + protected synchronized long[][] MlY2M(long l[][]) { return l; }; + protected final void MvPM() {}; + protected final long MlPM(long l) { return l; }; + protected final long[] MlP1M(long l[]) { return l; }; + protected final long[][] MlP2M(long l[][]) { return l; }; + + C002 MX(C002 X) { return X; }; + C002[] MX1(C002 X[]) { return X; }; + C002[][] MX2(C002 X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + protected C002 MXM(C002 X) { return X; }; + protected C002[] MX1M(C002 X[]) { return X; }; + protected C002[][] MX2M(C002 X[][]) { return X; }; + protected Object MOM(Object O) { return O; }; + protected Object[] MO1M(Object[] O) { return O; }; + protected Object[][] MO2M(Object[][] O) { return O; }; + + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long[] L) { return L; }; + static Long[][] MLS2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + protected static Long MLSM(Long L) { return L; }; + protected static Long[] MLS1M(Long[] L) { return L; }; + protected static Long[][] MLS2M(Long[][] L) { return L; }; + protected native Long MLNM(Long L); + protected native Long[] MLN1M(Long[] L); + protected native Long[][] MLN2M(Long[][] L); + protected strictfp Long MLIM(Long L) { return L; }; + protected strictfp Long[] MLI1M(Long[] L) { return L; }; + protected strictfp Long[][] MLI2M(Long[][] L) { return L; }; + protected synchronized Long MLYM(Long L) { return L; }; + protected synchronized Long[] MLY1M(Long[] L) { return L; }; + protected synchronized Long[][] MLY2M(Long[][] L) { return L; }; + protected final Long MLPM(Long L) { return L; }; + protected final Long[] MLP1M(Long[] L) { return L; }; + protected final Long[][] MLP2M(Long[][] L) { return L; }; + + I002 ME(I002 E) { return E; }; + I002[] ME1(I002[] E) { return E; }; + I002[][] ME2(I002[][] E) { return E; }; + protected I002 MEM(I002 E) { return E; }; + protected I002[] ME1M(I002[] E) { return E; }; + protected I002[][] ME2M(I002[][] E) { return E; }; + + static I002 MES(I002 E) { return E; }; + static I002[] MES1(I002[] E) { return E; }; + static I002[][] MES2(I002[][] E) { return E; }; + native I002 MEN(I002 E); + native I002[] MEN1(I002[] E); + native I002[][] MEN2(I002[][] E); + strictfp I002 MEI(I002 E) { return E; }; + strictfp I002[] MEI1(I002[] E) { return E; }; + strictfp I002[][] MEI2(I002[][] E) { return E; }; + synchronized I002 MEY(I002 E) { return E; }; + synchronized I002[] MEY1(I002[] E) { return E; }; + synchronized I002[][] MEY2(I002[][] E) { return E; }; + public I002 MEU(I002 E) { return E; }; + public I002[] MEU1(I002[] E) { return E; }; + public I002[][] MEU2(I002[][] E) { return E; }; + protected I002 MER(I002 E) { return E; }; + protected I002[] MER1(I002[] E) { return E; }; + protected I002[][] MER2(I002[][] E) { return E; }; + private I002 MEP(I002 E) { return E; }; + private I002[] MEP1(I002[] E) { return E; }; + private I002[][] MEP2(I002[][] E) { return E; }; + + protected static I002 MESM(I002 E) { return E; }; + protected static I002[] MES1M(I002[] E) { return E; }; + protected static I002[][] MES2M(I002[][] E) { return E; }; + protected native I002 MENM(I002 E); + protected native I002[] MEN1M(I002[] E); + protected native I002[][] MEN2M(I002[][] E); + protected strictfp I002 MEIM(I002 E) { return E; }; + protected strictfp I002[] MEI1M(I002[] E) { return E; }; + protected strictfp I002[][] MEI2M(I002[][] E) { return E; }; + protected synchronized I002 MEYM(I002 E) { return E; }; + protected synchronized I002[] MEY1M(I002[] E) { return E; }; + protected synchronized I002[][] MEY2M(I002[][] E) { return E; }; + protected final I002 MEPM(I002 E) { return E; }; + protected final I002[] MEP1M(I002[] E) { return E; }; + protected final I002[][] MEP2M(I002[][] E) { return E; }; + +} + +//--------------------------------------------- test specific methods +class C002 {} +interface I002 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001.java new file mode 100644 index 00000000000..83961f8ba0b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001.java @@ -0,0 +1,207 @@ +/* + * 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.TypeComponent.isPublic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class ispublic001 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isPublic."; + private final static String debuggerName = prefix + "ispublic001"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + final static String IS_PUBLIC = "true"; + final static String NOT_PUBLIC = "false"; + final static int TOTAL_FIELDS = 132; + + /** debuggee's fields for check **/ + private final static String checkedFields[][] = { + {"z0", NOT_PUBLIC}, {"z1", NOT_PUBLIC}, {"z2", NOT_PUBLIC}, + {"b0", NOT_PUBLIC}, {"b1", NOT_PUBLIC}, {"b2", NOT_PUBLIC}, + {"c0", NOT_PUBLIC}, {"c1", NOT_PUBLIC}, {"c2", NOT_PUBLIC}, + {"d0", NOT_PUBLIC}, {"d1", NOT_PUBLIC}, {"d2", NOT_PUBLIC}, + {"f0", NOT_PUBLIC}, {"f1", NOT_PUBLIC}, {"f2", NOT_PUBLIC}, + {"i0", NOT_PUBLIC}, {"i1", NOT_PUBLIC}, {"i2", NOT_PUBLIC}, + {"l0", NOT_PUBLIC}, {"l1", NOT_PUBLIC}, {"l2", NOT_PUBLIC}, + {"r0", NOT_PUBLIC}, {"r1", NOT_PUBLIC}, {"r2", NOT_PUBLIC}, + + {"zP0", IS_PUBLIC}, {"zP1", IS_PUBLIC}, {"zP2", IS_PUBLIC}, + {"bP0", IS_PUBLIC}, {"bP1", IS_PUBLIC}, {"bP2", IS_PUBLIC}, + {"cP0", IS_PUBLIC}, {"cP1", IS_PUBLIC}, {"cP2", IS_PUBLIC}, + {"dP0", IS_PUBLIC}, {"dP1", IS_PUBLIC}, {"dP2", IS_PUBLIC}, + {"fP0", IS_PUBLIC}, {"fP1", IS_PUBLIC}, {"fP2", IS_PUBLIC}, + {"iP0", IS_PUBLIC}, {"iP1", IS_PUBLIC}, {"iP2", IS_PUBLIC}, + {"lP0", IS_PUBLIC}, {"lP1", IS_PUBLIC}, {"lP2", IS_PUBLIC}, + {"rP0", IS_PUBLIC}, {"rP1", IS_PUBLIC}, {"rP2", IS_PUBLIC}, + + {"Z0", NOT_PUBLIC}, {"Z1", NOT_PUBLIC}, {"Z2", NOT_PUBLIC}, + {"B0", NOT_PUBLIC}, {"B1", NOT_PUBLIC}, {"B2", NOT_PUBLIC}, + {"C0", NOT_PUBLIC}, {"C1", NOT_PUBLIC}, {"C2", NOT_PUBLIC}, + {"D0", NOT_PUBLIC}, {"D1", NOT_PUBLIC}, {"D2", NOT_PUBLIC}, + {"F0", NOT_PUBLIC}, {"F1", NOT_PUBLIC}, {"F2", NOT_PUBLIC}, + {"I0", NOT_PUBLIC}, {"I1", NOT_PUBLIC}, {"I2", NOT_PUBLIC}, + {"L0", NOT_PUBLIC}, {"L1", NOT_PUBLIC}, {"L2", NOT_PUBLIC}, + {"R0", NOT_PUBLIC}, {"R1", NOT_PUBLIC}, {"R2", NOT_PUBLIC}, + + {"ZP0", IS_PUBLIC}, {"ZP1", IS_PUBLIC}, {"ZP2", IS_PUBLIC}, + {"BP0", IS_PUBLIC}, {"BP1", IS_PUBLIC}, {"BP2", IS_PUBLIC}, + {"CP0", IS_PUBLIC}, {"CP1", IS_PUBLIC}, {"CP2", IS_PUBLIC}, + {"DP0", IS_PUBLIC}, {"DP1", IS_PUBLIC}, {"DP2", IS_PUBLIC}, + {"FP0", IS_PUBLIC}, {"FP1", IS_PUBLIC}, {"FP2", IS_PUBLIC}, + {"IP0", IS_PUBLIC}, {"IP1", IS_PUBLIC}, {"IP2", IS_PUBLIC}, + {"LP0", IS_PUBLIC}, {"LP1", IS_PUBLIC}, {"LP2", IS_PUBLIC}, + {"RP0", IS_PUBLIC}, {"RP1", IS_PUBLIC}, {"RP2", IS_PUBLIC}, + + {"s0", NOT_PUBLIC}, {"s1", NOT_PUBLIC}, {"s2", NOT_PUBLIC}, + {"o0", NOT_PUBLIC}, {"o1", NOT_PUBLIC}, {"o2", NOT_PUBLIC}, + {"S0", IS_PUBLIC}, {"S1", IS_PUBLIC}, {"S2", IS_PUBLIC}, + {"O0", IS_PUBLIC}, {"O1", IS_PUBLIC}, {"O2", IS_PUBLIC}, + + {"u0", NOT_PUBLIC}, {"u1", NOT_PUBLIC}, {"u2", NOT_PUBLIC}, + {"v0", NOT_PUBLIC}, {"v1", NOT_PUBLIC}, {"v2", NOT_PUBLIC}, + {"w0", IS_PUBLIC}, {"w1", IS_PUBLIC}, {"w2", IS_PUBLIC}, + {"p0", NOT_PUBLIC}, {"p1", NOT_PUBLIC}, {"p2", NOT_PUBLIC}, + + {"h0", NOT_PUBLIC}, {"h1", NOT_PUBLIC}, {"h2", NOT_PUBLIC}, + {"j0", NOT_PUBLIC}, {"j1", NOT_PUBLIC}, {"j2", NOT_PUBLIC}, + {"k0", IS_PUBLIC}, {"k1", IS_PUBLIC}, {"k2", IS_PUBLIC}, + {"m0", NOT_PUBLIC}, {"m1", NOT_PUBLIC}, {"m2", NOT_PUBLIC} + }; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isPublic() method for debuggee's fields..."); + + display("Total count of fields read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + TOTAL_FIELDS); + + // Check all fields from debuggee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String name; + boolean isPublic; + String expectedValue; + + try { + field = debuggeeClass.fieldByName(checkedFields[i][0]); + } catch (Exception e) { + complain("Can't get field by name " + checkedFields[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + name = field.name(); + isPublic = ((TypeComponent)field).isPublic(); // cast to TypeComponent interface + expectedValue = checkedFields[i][1]; + if ((isPublic && !expectedValue.equals(IS_PUBLIC)) || + (!isPublic && expectedValue.equals(IS_PUBLIC)) ) { + complain("isPublic() returned wrong value: " + isPublic + + " for field " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isPublic() returned expected " + isPublic + + " for field " + name); + } + } + + display("Checking debuggee's fields completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001/TestDescription.java new file mode 100644 index 00000000000..70564fde7f6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001/TestDescription.java @@ -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/TypeComponent/isPublic/ispublic001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isPublic() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isPublic() + * Determines if this object mirrors a public item. For ArrayType, the return + * value depends on the array component type. For primitive arrays the return + * value is always true. For object arrays, the return value is the same as + * would be returned for the component type. For primitive classes, such as + * Integer.TYPE, the return value is always true. + * Returns: + * true for items with public access; false otherwise. + * nsk/jdi/TypeComponent/isPublic/ispublic001 checks assertions: + * public boolean isPublic() + * 1. Returns true if the field was declared public. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isPublic() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isPublic method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isPublic.ispublic001 + * nsk.jdi.TypeComponent.isPublic.ispublic001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isPublic.ispublic001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001a.java new file mode 100644 index 00000000000..587e91c975f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001a.java @@ -0,0 +1,108 @@ +/* + * 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.TypeComponent.isPublic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class ispublic001a { + + 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}; + short r0, r1[] = {r0}, r2[][] = {r1}; + + public boolean zP0, zP1[] = {zP0}, zP2[][] = {zP1}; + public byte bP0, bP1[] = {bP0}, bP2[][] = {bP1}; + public char cP0, cP1[] = {cP0}, cP2[][] = {cP1}; + public double dP0, dP1[] = {dP0}, dP2[][] = {dP1}; + public float fP0, fP1[] = {fP0}, fP2[][] = {fP1}; + public int iP0, iP1[] = {iP0}, iP2[][] = {iP1}; + public long lP0, lP1[] = {lP0}, lP2[][] = {lP1}; + public short rP0, rP1[] = {rP0}, rP2[][] = {rP1}; + + Boolean Z0, Z1[] = {Z0}, Z2[][] = {Z1}; + Byte B0, B1[] = {B0}, B2[][] = {B1}; + Character C0, C1[] = {C0}, C2[][] = {C1}; + Double D0, D1[] = {D0}, D2[][] = {D1}; + Float F0, F1[] = {F0}, F2[][] = {F1}; + Integer I0, I1[] = {I0}, I2[][] = {I1}; + Long L0, L1[] = {L0}, L2[][] = {L1}; + Short R0, R1[] = {R0}, R2[][] = {R1}; + + public Boolean ZP0, ZP1[] = {ZP0}, ZP2[][] = {ZP1}; + public Byte BP0, BP1[] = {BP0}, BP2[][] = {BP1}; + public Character CP0, CP1[] = {CP0}, CP2[][] = {CP1}; + public Double DP0, DP1[] = {DP0}, DP2[][] = {DP1}; + public Float FP0, FP1[] = {FP0}, FP2[][] = {FP1}; + public Integer IP0, IP1[] = {IP0}, IP2[][] = {IP1}; + public Long LP0, LP1[] = {LP0}, LP2[][] = {LP1}; + public Short RP0, RP1[] = {RP0}, RP2[][] = {RP1}; + + String s0, s1[] = {s0}, s2[][] = {s1}; + Object o0, o1[] = {o0}, o2[][] = {o1}; + public String S0, S1[] = {S0}, S2[][] = {S1}; + public Object O0, O1[] = {O0}, O2[][] = {O1}; + + private P u0, u1[] = {u0}, u2[][] = {u1}; + protected P v0, v1[] = {v0}, v2[][] = {v1}; + public P w0, w1[] = {w0}, w2[][] = {w1}; + P p0, p1[] = {p0}, p2[][] = {p1}; // package private + + private M h0, h1[] = {h0}, h2[][] = {h1}; + protected M j0, j1[] = {j0}, j2[][] = {j1}; + public M k0, k1[] = {k0}, k2[][] = {k1}; + M m0, m1[] = {m0}, m2[][] = {m1}; // package private + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + ispublic001a ispublic001a_ = new ispublic001a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class P {} +interface M {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002.java new file mode 100644 index 00000000000..3b9725280d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002.java @@ -0,0 +1,368 @@ +/* + * 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.TypeComponent.isPublic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; +import java.util.*; + +public class ispublic002 { + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isPublic."; + private final static String debuggerName = prefix + "ispublic002"; + private final static String debuggeeName = debuggerName + "a"; + + private static ReferenceType debuggeeClass; + + /** + * Re-call to run(args,out), and exit with + * either status 95 or 97 (JCK-like exit status). + */ + public static void main (String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + /** + * JCK-like entry point to the test: perform testing, and + * return exit code 0 (Consts.TEST_PASSED) or either 2 (Consts.TEST_FAILED). + */ + 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 debuggee = binder.bindToDebugee(debuggeeName + + (argHandler.verbose() ? " -verbose" : "")); + IOPipe pipe = debuggee.createIOPipe(); + debuggee.redirectStderr(log, "debugger > "); + + debuggee.resume(); + display("Waiting debuggee's \"ready\" signal..."); + String line = pipe.readln(); + + if (line == null) { + complain("UNEXPECTED debuggee's signal - null"); + return Consts.TEST_FAILED; + } + if (!line.equals("ready")) { + complain("UNEXPECTED debuggee's signal - " + line); + return Consts.TEST_FAILED; + } else { + display("debuggee's \"ready\" signal recieved."); + } + + int exitStatus = Consts.TEST_PASSED; + + debuggeeClass = debuggee.classByName(debuggeeName); + if ( debuggeeClass == null ) { + complain("Class '" + debuggeeName + "' not found."); + return Consts.TEST_FAILED; + } + + + display("Checking isPublic() method for debuggee's methods..."); + + display("Total count of methods read from debuggee: " + + debuggeeClass.allFields().size() + ", expected count : " + + checkedMethods.length+1); + + // Check all methods from debuggee + for (int i = 0; i < checkedMethods.length-1; i++) { + List listOfMethods; + int totalMethodsByName; + Method method; + String name; + boolean isPublic; + String expectedValue; + + try { + listOfMethods = debuggeeClass.methodsByName(checkedMethods[i][0]); + } catch (Exception e) { + complain("Can't get method by name " + checkedMethods[i][0]); + complain("Unexpected Exception: " + e); + exitStatus = Consts.TEST_FAILED; + continue; + } + + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + checkedMethods[i][0] + " is " + totalMethodsByName + + ", should be 1."); + exitStatus = Consts.TEST_FAILED; + continue; + } + method = (Method)listOfMethods.get(0); + + name = method.name(); + isPublic = ((TypeComponent)method).isPublic(); // cast to TypeComponent interface + expectedValue = checkedMethods[i][1]; + if ((isPublic && !expectedValue.equals(IS_PUBLIC)) || + (!isPublic && expectedValue.equals(IS_PUBLIC)) ) { + complain("isPublic() returned wrong value: " + isPublic + + " for method " + name + + "; expected value : " + expectedValue); + exitStatus = Consts.TEST_FAILED; + } else { + display("isPublic() returned expected " + isPublic + + " for method " + name); + } + } + + display("Checking debuggee's methods completed!"); + display("Waiting for debuggee's finish..."); + pipe.println("quit"); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != Consts.TEST_PASSED + Consts.JCK_STATUS_BASE) { + complain("UNEXPECTED debuggee's exit status (not 95) - " + status); + exitStatus = Consts.TEST_FAILED; + } else { + display("Got expected debuggee's exit status - " + status); + } + + return exitStatus; + } + + private static void display(String msg) { + log.display("debugger > " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE > " + msg); + } + + //--------------------------------------------- test specific fields + + final static String IS_PUBLIC = "true"; + final static String NOT_PUBLIC = "false"; + + /** debuggee's methods for check **/ + private final static String checkedMethods[][] = { + {"Mv", NOT_PUBLIC}, + {"Mz", NOT_PUBLIC}, + {"Mz1", NOT_PUBLIC}, + {"Mz2", NOT_PUBLIC}, + {"Mb", NOT_PUBLIC}, + {"Mb1", NOT_PUBLIC}, + {"Mb2", NOT_PUBLIC}, + {"Mc", NOT_PUBLIC}, + {"Mc1", NOT_PUBLIC}, + {"Mc2", NOT_PUBLIC}, + {"Md", NOT_PUBLIC}, + {"Md1", NOT_PUBLIC}, + {"Md2", NOT_PUBLIC}, + {"Mf1", NOT_PUBLIC}, + {"Mf2", NOT_PUBLIC}, + {"Mi", NOT_PUBLIC}, + {"Mi1", NOT_PUBLIC}, + {"Mi2", NOT_PUBLIC}, + {"Ml", NOT_PUBLIC}, + {"Ml1", NOT_PUBLIC}, + {"Ml2", NOT_PUBLIC}, + {"Mr", NOT_PUBLIC}, + {"Mr1", NOT_PUBLIC}, + {"Mr2", NOT_PUBLIC}, + + {"MvM", IS_PUBLIC}, + {"MzM", IS_PUBLIC}, + {"Mz1M", IS_PUBLIC}, + {"Mz2M", IS_PUBLIC}, + {"MbM", IS_PUBLIC}, + {"Mb1M", IS_PUBLIC}, + {"Mb2M", IS_PUBLIC}, + {"McM", IS_PUBLIC}, + {"Mc1M", IS_PUBLIC}, + {"Mc2M", IS_PUBLIC}, + {"MdM", IS_PUBLIC}, + {"Md1M", IS_PUBLIC}, + {"Md2M", IS_PUBLIC}, + {"MfM", IS_PUBLIC}, + {"Mf1M", IS_PUBLIC}, + {"Mf2M", IS_PUBLIC}, + {"MiM", IS_PUBLIC}, + {"Mi1M", IS_PUBLIC}, + {"Mi2M", IS_PUBLIC}, + {"MlM", IS_PUBLIC}, + {"Ml1M", IS_PUBLIC}, + {"Ml2M", IS_PUBLIC}, + {"MrM", IS_PUBLIC}, + {"Mr1M", IS_PUBLIC}, + {"Mr2M", IS_PUBLIC}, + + {"MvS", NOT_PUBLIC}, + {"MlS", NOT_PUBLIC}, + {"MlS1", NOT_PUBLIC}, + {"MlS2", NOT_PUBLIC}, + {"MvN", NOT_PUBLIC}, + {"MlN", NOT_PUBLIC}, + {"MlN1", NOT_PUBLIC}, + {"MlN2", NOT_PUBLIC}, + {"MvI", NOT_PUBLIC}, + {"MlI", NOT_PUBLIC}, + {"MlI1", NOT_PUBLIC}, + {"MlI2", NOT_PUBLIC}, + {"MvY", NOT_PUBLIC}, + {"MlY", NOT_PUBLIC}, + {"MlY1", NOT_PUBLIC}, + {"MlY2", NOT_PUBLIC}, + {"MvU", IS_PUBLIC}, + {"MlU", IS_PUBLIC}, + {"MlU1", IS_PUBLIC}, + {"MlU2", IS_PUBLIC}, + {"MvR", NOT_PUBLIC}, + {"MlR", NOT_PUBLIC}, + {"MlR1", NOT_PUBLIC}, + {"MlR2", NOT_PUBLIC}, + {"MvP", NOT_PUBLIC}, + {"MlP", NOT_PUBLIC}, + {"MlP1", NOT_PUBLIC}, + {"MlP2", NOT_PUBLIC}, + + {"MvSM", IS_PUBLIC}, + {"MlSM", IS_PUBLIC}, + {"MlS1M", IS_PUBLIC}, + {"MlS2M", IS_PUBLIC}, + {"MvNM", IS_PUBLIC}, + {"MlNM", IS_PUBLIC}, + {"MlN1M", IS_PUBLIC}, + {"MlN2M", IS_PUBLIC}, + {"MvIM", IS_PUBLIC}, + {"MlIM", IS_PUBLIC}, + {"MlI1M", IS_PUBLIC}, + {"MlI2M", IS_PUBLIC}, + {"MvYM", IS_PUBLIC}, + {"MlYM", IS_PUBLIC}, + {"MlY1M", IS_PUBLIC}, + {"MlY2M", IS_PUBLIC}, + {"MvPM", IS_PUBLIC}, + {"MlPM", IS_PUBLIC}, + {"MlP1M", IS_PUBLIC}, + {"MlP2M", IS_PUBLIC}, + + {"MX", NOT_PUBLIC}, + {"MX1", NOT_PUBLIC}, + {"MX2", NOT_PUBLIC}, + {"MO", NOT_PUBLIC}, + {"MO1", NOT_PUBLIC}, + {"MO2", NOT_PUBLIC}, + + {"MXM", IS_PUBLIC}, + {"MX1M", IS_PUBLIC}, + {"MX2M", IS_PUBLIC}, + {"MOM", IS_PUBLIC}, + {"MO1M", IS_PUBLIC}, + {"MO2M", IS_PUBLIC}, + + {"MLS", NOT_PUBLIC}, + {"MLS1", NOT_PUBLIC}, + {"MLS2", NOT_PUBLIC}, + {"MLN", NOT_PUBLIC}, + {"MLN1", NOT_PUBLIC}, + {"MLN2", NOT_PUBLIC}, + {"MLI", NOT_PUBLIC}, + {"MLI1", NOT_PUBLIC}, + {"MLI2", NOT_PUBLIC}, + {"MLY", NOT_PUBLIC}, + {"MLY1", NOT_PUBLIC}, + {"MLY2", NOT_PUBLIC}, + {"MLU", IS_PUBLIC}, + {"MLU1", IS_PUBLIC}, + {"MLU2", IS_PUBLIC}, + {"MLR", NOT_PUBLIC}, + {"MLR1", NOT_PUBLIC}, + {"MLR2", NOT_PUBLIC}, + {"MLP", NOT_PUBLIC}, + {"MLP1", NOT_PUBLIC}, + {"MLP2", NOT_PUBLIC}, + + {"MLSM", IS_PUBLIC}, + {"MLS1M", IS_PUBLIC}, + {"MLS2M", IS_PUBLIC}, + {"MLNM", IS_PUBLIC}, + {"MLN1M", IS_PUBLIC}, + {"MLN2M", IS_PUBLIC}, + {"MLIM", IS_PUBLIC}, + {"MLI1M", IS_PUBLIC}, + {"MLI2M", IS_PUBLIC}, + {"MLYM", IS_PUBLIC}, + {"MLY1M", IS_PUBLIC}, + {"MLY2M", IS_PUBLIC}, + {"MLPM", IS_PUBLIC}, + {"MLP1M", IS_PUBLIC}, + {"MLP2M", IS_PUBLIC}, + + {"ME", NOT_PUBLIC}, + {"ME1", NOT_PUBLIC}, + {"ME2", NOT_PUBLIC}, + {"MEM", IS_PUBLIC}, + {"ME1M", IS_PUBLIC}, + {"ME2M", IS_PUBLIC}, + + {"MES", NOT_PUBLIC}, + {"MES1", NOT_PUBLIC}, + {"MES2", NOT_PUBLIC}, + {"MEN", NOT_PUBLIC}, + {"MEN1", NOT_PUBLIC}, + {"MEN2", NOT_PUBLIC}, + {"MEI", NOT_PUBLIC}, + {"MEI1", NOT_PUBLIC}, + {"MEI2", NOT_PUBLIC}, + {"MEY", NOT_PUBLIC}, + {"MEY1", NOT_PUBLIC}, + {"MEY2", NOT_PUBLIC}, + {"MEU", IS_PUBLIC}, + {"MEU1", IS_PUBLIC}, + {"MEU2", IS_PUBLIC}, + {"MER", NOT_PUBLIC}, + {"MER1", NOT_PUBLIC}, + {"MER2", NOT_PUBLIC}, + {"MEP", NOT_PUBLIC}, + {"MEP1", NOT_PUBLIC}, + {"MEP2", NOT_PUBLIC}, + + {"MESM", IS_PUBLIC}, + {"MES1M", IS_PUBLIC}, + {"MES2M", IS_PUBLIC}, + {"MENM", IS_PUBLIC}, + {"MEN1M", IS_PUBLIC}, + {"MEN2M", IS_PUBLIC}, + {"MEIM", IS_PUBLIC}, + {"MEI1M", IS_PUBLIC}, + {"MEI2M", IS_PUBLIC}, + {"MEYM", IS_PUBLIC}, + {"MEY1M", IS_PUBLIC}, + {"MEY2M", IS_PUBLIC}, + {"MEPM", IS_PUBLIC}, + {"MEP1M", IS_PUBLIC}, + {"MEP2M", IS_PUBLIC} + }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002/TestDescription.java new file mode 100644 index 00000000000..7541bca6452 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002/TestDescription.java @@ -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/TypeComponent/isPublic/ispublic002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isPublic() method of Accessible interface + * for TypeComponent sub-interface of com.sun.jdi package. + * The method spec: + * public boolean isPublic() + * Determines if this object mirrors a public item. For ArrayType, the return + * value depends on the array component type. For primitive arrays the return + * value is always true. For object arrays, the return value is the same as + * would be returned for the component type. For primitive classes, such as + * Integer.TYPE, the return value is always true. + * Returns: + * true for items with public access; false otherwise. + * nsk/jdi/TypeComponent/isPublic/ispublic002 checks assertions: + * public boolean isPublic() + * 1. Returns true if the method was declared public. + * 2. Returns false otherwise. + * Debugger gets each method from debuggee calling by name and then checks + * if method isPublic() returns an expected value. + * COMMENTS + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for isPublic method. + * The coverage analysis was done for jdk1.4.0-b92 build. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isPublic.ispublic002 + * nsk.jdi.TypeComponent.isPublic.ispublic002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isPublic.ispublic002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002a.java new file mode 100644 index 00000000000..24bf2a0012d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic002a.java @@ -0,0 +1,261 @@ +/* + * 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.TypeComponent.isPublic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class ispublic002a { + + //--------------------------------------------- test mutable methods + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = argHandler.createDebugeeLog(); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + ispublic002a ispublic002a_ = new ispublic002a(); + + log.display(" debuggee started."); + pipe.println("ready"); + + String instruction = pipe.readln(); + if (instruction.equals("quit")) { + log.display("debuggee > \"quit\" signal recieved."); + log.display("debuggee > completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + log.complain("debuggee > unexpected signal (not \"quit\") - " + instruction); + log.complain("debuggee > TEST FAILED"); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------- test specific methods + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + public void MvM() {}; + public boolean MzM(boolean z) { return z; }; + public boolean[] Mz1M(boolean z[]) { return z; }; + public boolean[][] Mz2M(boolean z[][]) { return z; }; + public byte MbM(byte b) { return b; }; + public byte[] Mb1M(byte b[]) { return b; }; + public byte[][] Mb2M(byte b[][]) { return b; }; + public char McM(char c) { return c; }; + public char[] Mc1M(char c[]) { return c; }; + public char[][] Mc2M(char c[][]) { return c; }; + public double MdM(double d) { return d; }; + public double[] Md1M(double d[]) { return d; }; + public double[][] Md2M(double d[][]) { return d; }; + public float MfM(float f) { return f; }; + public float[] Mf1M(float f[]) { return f; }; + public float[][] Mf2M(float f[][]) { return f; }; + public int MiM(int i) { return i; }; + public int[] Mi1M(int i[]) { return i; }; + public int[][] Mi2M(int i[][]) { return i; }; + public long MlM(long l) { return l; }; + public long[] Ml1M(long l[]) { return l; }; + public long[][] Ml2M(long l[][]) { return l; }; + public short MrM(short r) { return r; }; + public short[] Mr1M(short r[]) { return r; }; + public short[][] Mr2M(short r[][]) { return r; }; + + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + public static void MvSM() {}; + public static long MlSM(long l) { return l; }; + public static long[] MlS1M(long l[]) { return l; }; + public static long[][] MlS2M(long l[][]) { return l; }; + public native void MvNM(); + public native long MlNM(long l); + public native long[] MlN1M(long l[]); + public native long[][] MlN2M(long l[][]); + public strictfp void MvIM() {}; + public strictfp long MlIM(long l) { return l; }; + public strictfp long[] MlI1M(long l[]) { return l; }; + public strictfp long[][] MlI2M(long l[][]) { return l; }; + public synchronized void MvYM() {}; + public synchronized long MlYM(long l) { return l; }; + public synchronized long[] MlY1M(long l[]) { return l; }; + public synchronized long[][] MlY2M(long l[][]) { return l; }; + public final void MvPM() {}; + public final long MlPM(long l) { return l; }; + public final long[] MlP1M(long l[]) { return l; }; + public final long[][] MlP2M(long l[][]) { return l; }; + + C002 MX(C002 X) { return X; }; + C002[] MX1(C002 X[]) { return X; }; + C002[][] MX2(C002 X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + public C002 MXM(C002 X) { return X; }; + public C002[] MX1M(C002 X[]) { return X; }; + public C002[][] MX2M(C002 X[][]) { return X; }; + public Object MOM(Object O) { return O; }; + public Object[] MO1M(Object[] O) { return O; }; + public Object[][] MO2M(Object[][] O) { return O; }; + + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long[] L) { return L; }; + static Long[][] MLS2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + public static Long MLSM(Long L) { return L; }; + public static Long[] MLS1M(Long[] L) { return L; }; + public static Long[][] MLS2M(Long[][] L) { return L; }; + public native Long MLNM(Long L); + public native Long[] MLN1M(Long[] L); + public native Long[][] MLN2M(Long[][] L); + public strictfp Long MLIM(Long L) { return L; }; + public strictfp Long[] MLI1M(Long[] L) { return L; }; + public strictfp Long[][] MLI2M(Long[][] L) { return L; }; + public synchronized Long MLYM(Long L) { return L; }; + public synchronized Long[] MLY1M(Long[] L) { return L; }; + public synchronized Long[][] MLY2M(Long[][] L) { return L; }; + public final Long MLPM(Long L) { return L; }; + public final Long[] MLP1M(Long[] L) { return L; }; + public final Long[][] MLP2M(Long[][] L) { return L; }; + + I002 ME(I002 E) { return E; }; + I002[] ME1(I002[] E) { return E; }; + I002[][] ME2(I002[][] E) { return E; }; + public I002 MEM(I002 E) { return E; }; + public I002[] ME1M(I002[] E) { return E; }; + public I002[][] ME2M(I002[][] E) { return E; }; + + static I002 MES(I002 E) { return E; }; + static I002[] MES1(I002[] E) { return E; }; + static I002[][] MES2(I002[][] E) { return E; }; + native I002 MEN(I002 E); + native I002[] MEN1(I002[] E); + native I002[][] MEN2(I002[][] E); + strictfp I002 MEI(I002 E) { return E; }; + strictfp I002[] MEI1(I002[] E) { return E; }; + strictfp I002[][] MEI2(I002[][] E) { return E; }; + synchronized I002 MEY(I002 E) { return E; }; + synchronized I002[] MEY1(I002[] E) { return E; }; + synchronized I002[][] MEY2(I002[][] E) { return E; }; + public I002 MEU(I002 E) { return E; }; + public I002[] MEU1(I002[] E) { return E; }; + public I002[][] MEU2(I002[][] E) { return E; }; + protected I002 MER(I002 E) { return E; }; + protected I002[] MER1(I002[] E) { return E; }; + protected I002[][] MER2(I002[][] E) { return E; }; + private I002 MEP(I002 E) { return E; }; + private I002[] MEP1(I002[] E) { return E; }; + private I002[][] MEP2(I002[][] E) { return E; }; + + public static I002 MESM(I002 E) { return E; }; + public static I002[] MES1M(I002[] E) { return E; }; + public static I002[][] MES2M(I002[][] E) { return E; }; + public native I002 MENM(I002 E); + public native I002[] MEN1M(I002[] E); + public native I002[][] MEN2M(I002[][] E); + public strictfp I002 MEIM(I002 E) { return E; }; + public strictfp I002[] MEI1M(I002[] E) { return E; }; + public strictfp I002[][] MEI2M(I002[][] E) { return E; }; + public synchronized I002 MEYM(I002 E) { return E; }; + public synchronized I002[] MEY1M(I002[] E) { return E; }; + public synchronized I002[][] MEY2M(I002[][] E) { return E; }; + public final I002 MEPM(I002 E) { return E; }; + public final I002[] MEP1M(I002[] E) { return E; }; + public final I002[][] MEP2M(I002[][] E) { return E; }; + +} + +//--------------------------------------------- test specific methods +class C002 {} +interface I002 {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001.java new file mode 100644 index 00000000000..16f5dde6ccc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001.java @@ -0,0 +1,325 @@ +/* + * 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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class isstatic001 { + final static String IS_STATIC = "true"; + final static String NOT_STATIC = "false"; + final static int TOTAL_FIELDS = 174; + final static String FIELD_NAME[][] = { + {"z0", NOT_STATIC}, + {"z1", NOT_STATIC}, + {"z2", NOT_STATIC}, + {"b0", NOT_STATIC}, + {"b1", NOT_STATIC}, + {"b2", NOT_STATIC}, + {"c0", NOT_STATIC}, + {"c1", NOT_STATIC}, + {"c2", NOT_STATIC}, + {"d0", NOT_STATIC}, + {"d1", NOT_STATIC}, + {"d2", NOT_STATIC}, + {"f0", NOT_STATIC}, + {"f1", NOT_STATIC}, + {"f2", NOT_STATIC}, + {"i0", NOT_STATIC}, + {"i1", NOT_STATIC}, + {"i2", NOT_STATIC}, + {"l0", NOT_STATIC}, + {"l1", NOT_STATIC}, + {"l2", NOT_STATIC}, + {"r0", NOT_STATIC}, + {"r1", NOT_STATIC}, + {"r2", NOT_STATIC}, + + {"z0S", IS_STATIC}, + {"z1S", IS_STATIC}, + {"z2S", IS_STATIC}, + {"b0S", IS_STATIC}, + {"b1S", IS_STATIC}, + {"b2S", IS_STATIC}, + {"c0S", IS_STATIC}, + {"c1S", IS_STATIC}, + {"c2S", IS_STATIC}, + {"d0S", IS_STATIC}, + {"d1S", IS_STATIC}, + {"d2S", IS_STATIC}, + {"f0S", IS_STATIC}, + {"f1S", IS_STATIC}, + {"f2S", IS_STATIC}, + {"i0S", IS_STATIC}, + {"i1S", IS_STATIC}, + {"i2S", IS_STATIC}, + {"l0S", IS_STATIC}, + {"l1S", IS_STATIC}, + {"l2S", IS_STATIC}, + {"r0S", IS_STATIC}, + {"r1S", IS_STATIC}, + {"r2S", IS_STATIC}, + + {"lF0", NOT_STATIC}, + {"lF1", NOT_STATIC}, + {"lF2", NOT_STATIC}, + {"lP0", NOT_STATIC}, + {"lP1", NOT_STATIC}, + {"lP2", NOT_STATIC}, + {"lU0", NOT_STATIC}, + {"lU1", NOT_STATIC}, + {"lU2", NOT_STATIC}, + {"lR0", NOT_STATIC}, + {"lR1", NOT_STATIC}, + {"lR2", NOT_STATIC}, + {"lT0", NOT_STATIC}, + {"lT1", NOT_STATIC}, + {"lT2", NOT_STATIC}, + {"lV0", NOT_STATIC}, + {"lV1", NOT_STATIC}, + {"lV2", NOT_STATIC}, + + {"lF0S", IS_STATIC}, + {"lF1S", IS_STATIC}, + {"lF2S", IS_STATIC}, + {"lP0S", IS_STATIC}, + {"lP1S", IS_STATIC}, + {"lP2S", IS_STATIC}, + {"lU0S", IS_STATIC}, + {"lU1S", IS_STATIC}, + {"lU2S", IS_STATIC}, + {"lR0S", IS_STATIC}, + {"lR1S", IS_STATIC}, + {"lR2S", IS_STATIC}, + {"lT0S", IS_STATIC}, + {"lT1S", IS_STATIC}, + {"lT2S", IS_STATIC}, + {"lV0S", IS_STATIC}, + {"lV1S", IS_STATIC}, + {"lV2S", IS_STATIC}, + + {"X0", NOT_STATIC}, + {"X1", NOT_STATIC}, + {"X2", NOT_STATIC}, + {"O0", NOT_STATIC}, + {"O1", NOT_STATIC}, + {"O2", NOT_STATIC}, + + {"X0S", IS_STATIC}, + {"X1S", IS_STATIC}, + {"X2S", IS_STATIC}, + {"O0S", IS_STATIC}, + {"O1S", IS_STATIC}, + {"O2S", IS_STATIC}, + + {"LF0", NOT_STATIC}, + {"LF1", NOT_STATIC}, + {"LF2", NOT_STATIC}, + {"LP0", NOT_STATIC}, + {"LP1", NOT_STATIC}, + {"LP2", NOT_STATIC}, + {"LU0", NOT_STATIC}, + {"LU1", NOT_STATIC}, + {"LU2", NOT_STATIC}, + {"LR0", NOT_STATIC}, + {"LR1", NOT_STATIC}, + {"LR2", NOT_STATIC}, + {"LT0", NOT_STATIC}, + {"LT1", NOT_STATIC}, + {"LT2", NOT_STATIC}, + {"LV0", NOT_STATIC}, + {"LV1", NOT_STATIC}, + {"LV2", NOT_STATIC}, + + {"LF0S", IS_STATIC}, + {"LF1S", IS_STATIC}, + {"LF2S", IS_STATIC}, + {"LP0S", IS_STATIC}, + {"LP1S", IS_STATIC}, + {"LP2S", IS_STATIC}, + {"LU0S", IS_STATIC}, + {"LU1S", IS_STATIC}, + {"LU2S", IS_STATIC}, + {"LR0S", IS_STATIC}, + {"LR1S", IS_STATIC}, + {"LR2S", IS_STATIC}, + {"LT0S", IS_STATIC}, + {"LT1S", IS_STATIC}, + {"LT2S", IS_STATIC}, + {"LV0S", IS_STATIC}, + {"LV1S", IS_STATIC}, + {"LV2S", IS_STATIC}, + + {"E0", NOT_STATIC}, + {"E1", NOT_STATIC}, + {"E2", NOT_STATIC}, + + {"E0S", IS_STATIC}, + {"E1S", IS_STATIC}, + {"E2S", IS_STATIC}, + + {"EF0", NOT_STATIC}, + {"EF1", NOT_STATIC}, + {"EF2", NOT_STATIC}, + {"EP0", NOT_STATIC}, + {"EP1", NOT_STATIC}, + {"EP2", NOT_STATIC}, + {"EU0", NOT_STATIC}, + {"EU1", NOT_STATIC}, + {"EU2", NOT_STATIC}, + {"ER0", NOT_STATIC}, + {"ER1", NOT_STATIC}, + {"ER2", NOT_STATIC}, + {"ET0", NOT_STATIC}, + {"ET1", NOT_STATIC}, + {"ET2", NOT_STATIC}, + {"EV0", NOT_STATIC}, + {"EV1", NOT_STATIC}, + {"EV2", NOT_STATIC}, + + {"EF0S", IS_STATIC}, + {"EF1S", IS_STATIC}, + {"EF2S", IS_STATIC}, + {"EP0S", IS_STATIC}, + {"EP1S", IS_STATIC}, + {"EP2S", IS_STATIC}, + {"EU0S", IS_STATIC}, + {"EU1S", IS_STATIC}, + {"EU2S", IS_STATIC}, + {"ER0S", IS_STATIC}, + {"ER1S", IS_STATIC}, + {"ER2S", IS_STATIC}, + {"ET0S", IS_STATIC}, + {"ET1S", IS_STATIC}, + {"ET2S", IS_STATIC}, + {"EV0S", IS_STATIC}, + {"EV1S", IS_STATIC}, + {"EV2S", IS_STATIC} + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isStatic."; + private final static String className = "isstatic001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "ClassToCheck"; + + 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 = new IOPipe(debugee); + 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.complain("debuger> Total fields in debugee read: " + + refType.allFields().size() + ", total fields in debuger: " + + TOTAL_FIELDS); + // Check all fields from debugee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String name; + boolean isStatic; + String realIsStatic; + + try { + field = refType.fieldByName(FIELD_NAME[i][0]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME[i][0]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + isStatic = field.isStatic(); + realIsStatic = FIELD_NAME[i][1]; + log.display("debuger> " + i + " field (" + name + "), " + + "isStatic = " + isStatic + " read."); + + // isStatic() returns true if this type component is declared + // static, returns false otherwise + if ((isStatic && !realIsStatic.equals(IS_STATIC)) || + (!isStatic && realIsStatic.equals(IS_STATIC)) + ) { + log.complain("debuger FAILURE 2> " + i + " field " + name + + ": read field.isStatic() = " + isStatic + + "; real isStatic should be " + realIsStatic); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001/TestDescription.java new file mode 100644 index 00000000000..09399fb230d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001/TestDescription.java @@ -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/TypeComponent/isStatic/isstatic001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isStatic() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isStatic() + * Determines if this TypeComponent is static. Return value is undefined for + * constructors and static initializers. + * Returns: true if this type component was declared static; false otherwise. + * nsk/jdi/TypeComponent/isStatic/isstatic001 checks assertions: + * public boolean isStatic() + * 1. Returns true if the field was declared static. + * 2. Returns false otherwise. + * Debugger gets each field from debuggee calling by name and then checks + * if method isStatic() returns expected value. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isStatic.isstatic001 + * nsk.jdi.TypeComponent.isStatic.isstatic001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isStatic.isstatic001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001a.java new file mode 100644 index 00000000000..49cd0e814ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001a.java @@ -0,0 +1,127 @@ +/* + * 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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isstatic001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + ClassToCheck classToCheck = new ClassToCheck(); + + 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 ClassToCheck { + // User class and interface + class Class {} + interface Inter {} + + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + static boolean z0S, z1S[]={z0S}, z2S[][]={z1S}; + static byte b0S, b1S[]={b0S}, b2S[][]={b1S}; + static char c0S, c1S[]={c0S}, c2S[][]={c1S}; + static double d0S, d1S[]={d0S}, d2S[][]={d1S}; + static float f0S, f1S[]={f0S}, f2S[][]={f1S}; + static int i0S, i1S[]={i0S}, i2S[][]={i1S}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + static short r0S, r1S[]={r0S}, r2S[][]={r1S}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + static final long lF0S = 1l, lF1S[]={lF0S}, lF2S[][]={lF1S}; + static private long lP0S, lP1S[]={lP0S}, lP2S[][]={lP1S}; + static public long lU0S, lU1S[]={lU0S}, lU2S[][]={lU1S}; + static protected long lR0S, lR1S[]={lR0S}, lR2S[][]={lR1S}; + static transient long lT0S, lT1S[]={lT0S}, lT2S[][]={lT1S}; + static volatile long lV0S, lV1S[]={lV0S}, lV2S[][]={lV1S}; + + Class X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + static Class X0S, X1S[]={X0S}, X2S[][]={X1S}; + static Object O0S, O1S[]={O0S}, O2S[][]={O1S}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + static final Long LF0S = new Long(1), LF1S[]={LF0S}, LF2S[][]={LF1S}; + static private Long LP0S, LP1S[]={LP0S}, LP2S[][]={LP1S}; + static public Long LU0S, LU1S[]={LU0S}, LU2S[][]={LU1S}; + static protected Long LR0S, LR1S[]={LR0S}, LR2S[][]={LR1S}; + static transient Long LT0S, LT1S[]={LT0S}, LT2S[][]={LT1S}; + static volatile Long LV0S, LV1S[]={LV0S}, LV2S[][]={LV1S}; + + Inter E0, E1[]={E0}, E2[][]={E1}; + static Inter E0S, E1S[]={E0S}, E2S[][]={E1S}; + + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + + static final Inter EF0S = null, EF1S[]={EF0S}, EF2S[][]={EF1S}; + static private Inter EP0S, EP1S[]={EP0S}, EP2S[][]={EP1S}; + static public Inter EU0S, EU1S[]={EU0S}, EU2S[][]={EU1S}; + static protected Inter ER0S, ER1S[]={ER0S}, ER2S[][]={ER1S}; + static transient Inter ET0S, ET1S[]={ET0S}, ET2S[][]={ET1S}; + static volatile Inter EV0S, EV1S[]={EV0S}, EV2S[][]={EV1S}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002.java new file mode 100644 index 00000000000..2b0411fd423 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002.java @@ -0,0 +1,367 @@ +/* + * 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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class isstatic002 { + final static String IS_STATIC = "true"; + final static String NOT_STATIC = "false"; + final static int TOTAL_METHODS = 208; + final static String METHOD_NAME[][] = { + {"Mv", NOT_STATIC}, + {"Mz", NOT_STATIC}, + {"Mz1", NOT_STATIC}, + {"Mz2", NOT_STATIC}, + {"Mb", NOT_STATIC}, + {"Mb1", NOT_STATIC}, + {"Mb2", NOT_STATIC}, + {"Mc", NOT_STATIC}, + {"Mc1", NOT_STATIC}, + {"Mc2", NOT_STATIC}, + {"Md", NOT_STATIC}, + {"Md1", NOT_STATIC}, + {"Md2", NOT_STATIC}, + {"Mf", NOT_STATIC}, + {"Mf1", NOT_STATIC}, + {"Mf2", NOT_STATIC}, + {"Mi", NOT_STATIC}, + {"Mi1", NOT_STATIC}, + {"Mi2", NOT_STATIC}, + {"Ml", NOT_STATIC}, + {"Ml1", NOT_STATIC}, + {"Ml2", NOT_STATIC}, + {"Mr", NOT_STATIC}, + {"Mr1", NOT_STATIC}, + {"Mr2", NOT_STATIC}, + + {"MvS", IS_STATIC}, + {"MzS", IS_STATIC}, + {"Mz1S", IS_STATIC}, + {"Mz2S", IS_STATIC}, + {"MbS", IS_STATIC}, + {"Mb1S", IS_STATIC}, + {"Mb2S", IS_STATIC}, + {"McS", IS_STATIC}, + {"Mc1S", IS_STATIC}, + {"Mc2S", IS_STATIC}, + {"MdS", IS_STATIC}, + {"Md1S", IS_STATIC}, + {"Md2S", IS_STATIC}, + {"MfS", IS_STATIC}, + {"Mf1S", IS_STATIC}, + {"Mf2S", IS_STATIC}, + {"MiS", IS_STATIC}, + {"Mi1S", IS_STATIC}, + {"Mi2S", IS_STATIC}, + {"MlS", IS_STATIC}, + {"Ml1S", IS_STATIC}, + {"Ml2S", IS_STATIC}, + {"MrS", IS_STATIC}, + {"Mr1S", IS_STATIC}, + {"Mr2S", IS_STATIC}, + + {"MvF", NOT_STATIC}, + {"MlF", NOT_STATIC}, + {"MlF1", NOT_STATIC}, + {"MlF2", NOT_STATIC}, + {"MvN", NOT_STATIC}, + {"MlN", NOT_STATIC}, + {"MlN1", NOT_STATIC}, + {"MlN2", NOT_STATIC}, + {"MvI", NOT_STATIC}, + {"MlI", NOT_STATIC}, + {"MlI1", NOT_STATIC}, + {"MlI2", NOT_STATIC}, + {"MvY", NOT_STATIC}, + {"MlY", NOT_STATIC}, + {"MlY1", NOT_STATIC}, + {"MlY2", NOT_STATIC}, + {"MvU", NOT_STATIC}, + {"MlU", NOT_STATIC}, + {"MlU1", NOT_STATIC}, + {"MlU2", NOT_STATIC}, + {"MvR", NOT_STATIC}, + {"MlR", NOT_STATIC}, + {"MlR1", NOT_STATIC}, + {"MlR2", NOT_STATIC}, + {"MvP", NOT_STATIC}, + {"MlP", NOT_STATIC}, + {"MlP1", NOT_STATIC}, + {"MlP2", NOT_STATIC}, + + {"MvFS", IS_STATIC}, + {"MlFS", IS_STATIC}, + {"MlF1S", IS_STATIC}, + {"MlF2S", IS_STATIC}, + {"MvNS", IS_STATIC}, + {"MlNS", IS_STATIC}, + {"MlN1S", IS_STATIC}, + {"MlN2S", IS_STATIC}, + {"MvIS", IS_STATIC}, + {"MlIS", IS_STATIC}, + {"MlI1S", IS_STATIC}, + {"MlI2S", IS_STATIC}, + {"MvYS", IS_STATIC}, + {"MlYS", IS_STATIC}, + {"MlY1S", IS_STATIC}, + {"MlY2S", IS_STATIC}, + {"MvUS", IS_STATIC}, + {"MlUS", IS_STATIC}, + {"MlU1S", IS_STATIC}, + {"MlU2S", IS_STATIC}, + {"MvRS", IS_STATIC}, + {"MlRS", IS_STATIC}, + {"MlR1S", IS_STATIC}, + {"MlR2S", IS_STATIC}, + {"MvPS", IS_STATIC}, + {"MlPS", IS_STATIC}, + {"MlP1S", IS_STATIC}, + {"MlP2S", IS_STATIC}, + + {"MX", NOT_STATIC}, + {"MX1", NOT_STATIC}, + {"MX2", NOT_STATIC}, + {"MO", NOT_STATIC}, + {"MO1", NOT_STATIC}, + {"MO2", NOT_STATIC}, + + {"MXS", IS_STATIC}, + {"MX1S", IS_STATIC}, + {"MX2S", IS_STATIC}, + {"MOS", IS_STATIC}, + {"MO1S", IS_STATIC}, + {"MO2S", IS_STATIC}, + + {"MLF", NOT_STATIC}, + {"MLF1", NOT_STATIC}, + {"MLF2", NOT_STATIC}, + {"MLN", NOT_STATIC}, + {"MLN1", NOT_STATIC}, + {"MLN2", NOT_STATIC}, + {"MLI", NOT_STATIC}, + {"MLI1", NOT_STATIC}, + {"MLI2", NOT_STATIC}, + {"MLY", NOT_STATIC}, + {"MLY1", NOT_STATIC}, + {"MLY2", NOT_STATIC}, + {"MLU", NOT_STATIC}, + {"MLU1", NOT_STATIC}, + {"MLU2", NOT_STATIC}, + {"MLR", NOT_STATIC}, + {"MLR1", NOT_STATIC}, + {"MLR2", NOT_STATIC}, + {"MLP", NOT_STATIC}, + {"MLP1", NOT_STATIC}, + {"MLP2", NOT_STATIC}, + + {"MLFS", IS_STATIC}, + {"MLF1S", IS_STATIC}, + {"MLF2S", IS_STATIC}, + {"MLNS", IS_STATIC}, + {"MLN1S", IS_STATIC}, + {"MLN2S", IS_STATIC}, + {"MLIS", IS_STATIC}, + {"MLI1S", IS_STATIC}, + {"MLI2S", IS_STATIC}, + {"MLYS", IS_STATIC}, + {"MLY1S", IS_STATIC}, + {"MLY2S", IS_STATIC}, + {"MLUS", IS_STATIC}, + {"MLU1S", IS_STATIC}, + {"MLU2S", IS_STATIC}, + {"MLRS", IS_STATIC}, + {"MLR1S", IS_STATIC}, + {"MLR2S", IS_STATIC}, + {"MLPS", IS_STATIC}, + {"MLP1S", IS_STATIC}, + {"MLP2S", IS_STATIC}, + + {"ME", NOT_STATIC}, + {"ME1", NOT_STATIC}, + {"ME2", NOT_STATIC}, + {"MES", IS_STATIC}, + {"ME1S", IS_STATIC}, + {"ME2S", IS_STATIC}, + + {"MEF", NOT_STATIC}, + {"MEF1", NOT_STATIC}, + {"MEF2", NOT_STATIC}, + {"MEN", NOT_STATIC}, + {"MEN1", NOT_STATIC}, + {"MEN2", NOT_STATIC}, + {"MEI", NOT_STATIC}, + {"MEI1", NOT_STATIC}, + {"MEI2", NOT_STATIC}, + {"MEY", NOT_STATIC}, + {"MEY1", NOT_STATIC}, + {"MEY2", NOT_STATIC}, + {"MEU", NOT_STATIC}, + {"MEU1", NOT_STATIC}, + {"MEU2", NOT_STATIC}, + {"MER", NOT_STATIC}, + {"MER1", NOT_STATIC}, + {"MER2", NOT_STATIC}, + {"MEP", NOT_STATIC}, + {"MEP1", NOT_STATIC}, + {"MEP2", NOT_STATIC}, + + {"MEFS", IS_STATIC}, + {"MEF1S", IS_STATIC}, + {"MEF2S", IS_STATIC}, + {"MENS", IS_STATIC}, + {"MEN1S", IS_STATIC}, + {"MEN2S", IS_STATIC}, + {"MEIS", IS_STATIC}, + {"MEI1S", IS_STATIC}, + {"MEI2S", IS_STATIC}, + {"MEYS", IS_STATIC}, + {"MEY1S", IS_STATIC}, + {"MEY2S", IS_STATIC}, + {"MEUS", IS_STATIC}, + {"MEU1S", IS_STATIC}, + {"MEU2S", IS_STATIC}, + {"MERS", IS_STATIC}, + {"MER1S", IS_STATIC}, + {"MER2S", IS_STATIC}, + {"MEPS", IS_STATIC}, + {"MEP1S", IS_STATIC}, + {"MEP2S", IS_STATIC}, + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isStatic."; + private final static String className = "isstatic002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "isstatic002aClassToCheck"; + + 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 = new IOPipe(debugee); + 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; + } + + // Check all methods from debugee + for (int i = 0; i < METHOD_NAME.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + boolean isStatic; + String realIsStatic; + + try { + listOfMethods = refType.methodsByName(METHOD_NAME[i][0]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME[i][0]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME[i][0] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + isStatic = method.isStatic(); + realIsStatic = METHOD_NAME[i][1]; + log.display("debuger> " + i + " method (" + name + "), " + + "isStatic = " + isStatic + " read."); + + // isStatic() returns true if this type component is declared + // final, returns false otherwise + if ((isStatic && !realIsStatic.equals(IS_STATIC)) || + (!isStatic && realIsStatic.equals(IS_STATIC)) + ) { + log.display("debuger FAILURE 3> " + i + " method " + name + + ": read method.isStatic() = " + isStatic + + "; real isStatic should be " + realIsStatic); + testFailed = true; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002/TestDescription.java new file mode 100644 index 00000000000..34b7f91750c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002/TestDescription.java @@ -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/TypeComponent/isStatic/isstatic002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isStatic() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isStatic() + * Determines if this TypeComponent is static. Return value is undefined for + * constructors and static initializers. + * Returns: true if this type component was declared static; false otherwise. + * nsk/jdi/TypeComponent/isStatic/isstatic002 checks assertions: + * public boolean isStatic() + * 1. Returns true if the method was declared static + * 2. Returns false otherwise. + * Debugger gets each method from debuggee calling by name and then checks + * if isStatic() returns expected value. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isStatic.isstatic002 + * nsk.jdi.TypeComponent.isStatic.isstatic002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isStatic.isstatic002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002a.java new file mode 100644 index 00000000000..2f6bea12310 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic002a.java @@ -0,0 +1,278 @@ +/* + * 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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isstatic002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + isstatic002aClassToCheck classToCheck = new isstatic002aClassToCheck(); + + 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 isstatic002aClassToCheck { + // User class and interface + class Class {} + interface Inter {} + + // Methods + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + static void MvS() {}; + static boolean MzS(boolean z) { return z; }; + static boolean[] Mz1S(boolean z[]) { return z; }; + static boolean[][] Mz2S(boolean z[][]) { return z; }; + static byte MbS(byte b) { return b; }; + static byte[] Mb1S(byte b[]) { return b; }; + static byte[][] Mb2S(byte b[][]) { return b; }; + static char McS(char c) { return c; }; + static char[] Mc1S(char c[]) { return c; }; + static char[][] Mc2S(char c[][]) { return c; }; + static double MdS(double d) { return d; }; + static double[] Md1S(double d[]) { return d; }; + static double[][] Md2S(double d[][]) { return d; }; + static float MfS(float f) { return f; }; + static float[] Mf1S(float f[]) { return f; }; + static float[][] Mf2S(float f[][]) { return f; }; + static int MiS(int i) { return i; }; + static int[] Mi1S(int i[]) { return i; }; + static int[][] Mi2S(int i[][]) { return i; }; + static long MlS(long l) { return l; }; + static long[] Ml1S(long l[]) { return l; }; + static long[][] Ml2S(long l[][]) { return l; }; + static short MrS(short r) { return r; }; + static short[] Mr1S(short r[]) { return r; }; + static short[][] Mr2S(short r[][]) { return r; }; + + final void MvF() {}; + final long MlF(long l) { return l; }; + final long[] MlF1(long l[]) { return l; }; + final long[][] MlF2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + static final void MvFS() {}; + static final long MlFS(long l) { return l; }; + static final long[] MlF1S(long l[]) { return l; }; + static final long[][] MlF2S(long l[][]) { return l; }; + static native void MvNS(); + static native long MlNS(long l); + static native long[] MlN1S(long l[]); + static native long[][] MlN2S(long l[][]); + static strictfp void MvIS() {}; + static strictfp long MlIS(long l) { return l; }; + static strictfp long[] MlI1S(long l[]) { return l; }; + static strictfp long[][] MlI2S(long l[][]) { return l; }; + static synchronized void MvYS() {}; + static synchronized long MlYS(long l) { return l; }; + static synchronized long[] MlY1S(long l[]) { return l; }; + static synchronized long[][] MlY2S(long l[][]) { return l; }; + static public void MvUS() {}; + static public long MlUS(long l) { return l; }; + static public long[] MlU1S(long l[]) { return l; }; + static public long[][] MlU2S(long l[][]) { return l; }; + static protected void MvRS() {}; + static protected long MlRS(long l) { return l; }; + static protected long[] MlR1S(long l[]) { return l; }; + static protected long[][] MlR2S(long l[][]) { return l; }; + static private void MvPS() {}; + static private long MlPS(long l) { return l; }; + static private long[] MlP1S(long l[]) { return l; }; + static private long[][] MlP2S(long l[][]) { return l; }; + + Class MX(Class X) { return X; }; + Class[] MX1(Class X[]) { return X; }; + Class[][] MX2(Class X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + static Class MXS(Class X) { return X; }; + static Class[] MX1S(Class X[]) { return X; }; + static Class[][] MX2S(Class X[][]) { return X; }; + static Object MOS(Object O) { return O; }; + static Object[] MO1S(Object[] O) { return O; }; + static Object[][] MO2S(Object[][] O) { return O; }; + + final Long MLF(Long L) { return L; }; + final Long[] MLF1(Long[] L) { return L; }; + final Long[][] MLF2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + static final Long MLFS(Long L) { return L; }; + static final Long[] MLF1S(Long[] L) { return L; }; + static final Long[][] MLF2S(Long[][] L) { return L; }; + static native Long MLNS(Long L); + static native Long[] MLN1S(Long[] L); + static native Long[][] MLN2S(Long[][] L); + static strictfp Long MLIS(Long L) { return L; }; + static strictfp Long[] MLI1S(Long[] L) { return L; }; + static strictfp Long[][] MLI2S(Long[][] L) { return L; }; + static synchronized Long MLYS(Long L) { return L; }; + static synchronized Long[] MLY1S(Long[] L) { return L; }; + static synchronized Long[][] MLY2S(Long[][] L) { return L; }; + static public Long MLUS(Long L) { return L; }; + static public Long[] MLU1S(Long[] L) { return L; }; + static public Long[][] MLU2S(Long[][] L) { return L; }; + static protected Long MLRS(Long L) { return L; }; + static protected Long[] MLR1S(Long[] L) { return L; }; + static protected Long[][] MLR2S(Long[][] L) { return L; }; + static private Long MLPS(Long L) { return L; }; + static private Long[] MLP1S(Long[] L) { return L; }; + static private Long[][] MLP2S(Long[][] L) { return L; }; + + Inter ME(Inter E) { return E; }; + Inter[] ME1(Inter[] E) { return E; }; + Inter[][] ME2(Inter[][] E) { return E; }; + static Inter MES(Inter E) { return E; }; + static Inter[] ME1S(Inter[] E) { return E; }; + static Inter[][] ME2S(Inter[][] E) { return E; }; + + final Inter MEF(Inter E) { return E; }; + final Inter[] MEF1(Inter[] E) { return E; }; + final Inter[][] MEF2(Inter[][] E) { return E; }; + native Inter MEN(Inter E); + native Inter[] MEN1(Inter[] E); + native Inter[][] MEN2(Inter[][] E); + strictfp Inter MEI(Inter E) { return E; }; + strictfp Inter[] MEI1(Inter[] E) { return E; }; + strictfp Inter[][] MEI2(Inter[][] E) { return E; }; + synchronized Inter MEY(Inter E) { return E; }; + synchronized Inter[] MEY1(Inter[] E) { return E; }; + synchronized Inter[][] MEY2(Inter[][] E) { return E; }; + public Inter MEU(Inter E) { return E; }; + public Inter[] MEU1(Inter[] E) { return E; }; + public Inter[][] MEU2(Inter[][] E) { return E; }; + protected Inter MER(Inter E) { return E; }; + protected Inter[] MER1(Inter[] E) { return E; }; + protected Inter[][] MER2(Inter[][] E) { return E; }; + private Inter MEP(Inter E) { return E; }; + private Inter[] MEP1(Inter[] E) { return E; }; + private Inter[][] MEP2(Inter[][] E) { return E; }; + + static final Inter MEFS(Inter E) { return E; }; + static final Inter[] MEF1S(Inter[] E) { return E; }; + static final Inter[][] MEF2S(Inter[][] E) { return E; }; + static native Inter MENS(Inter E); + static native Inter[] MEN1S(Inter[] E); + static native Inter[][] MEN2S(Inter[][] E); + static strictfp Inter MEIS(Inter E) { return E; }; + static strictfp Inter[] MEI1S(Inter[] E) { return E; }; + static strictfp Inter[][] MEI2S(Inter[][] E) { return E; }; + static synchronized Inter MEYS(Inter E) { return E; }; + static synchronized Inter[] MEY1S(Inter[] E) { return E; }; + static synchronized Inter[][] MEY2S(Inter[][] E) { return E; }; + static public Inter MEUS(Inter E) { return E; }; + static public Inter[] MEU1S(Inter[] E) { return E; }; + static public Inter[][] MEU2S(Inter[][] E) { return E; }; + static protected Inter MERS(Inter E) { return E; }; + static protected Inter[] MER1S(Inter[] E) { return E; }; + static protected Inter[][] MER2S(Inter[][] E) { return E; }; + static private Inter MEPS(Inter E) { return E; }; + static private Inter[] MEP1S(Inter[] E) { return E; }; + static private Inter[][] MEP2S(Inter[][] E) { return E; }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003.java new file mode 100644 index 00000000000..00996cdaf9b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003.java @@ -0,0 +1,137 @@ +/* + * 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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class isstatic003 { + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isStatic."; + private final static String className = "isstatic003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "isstatic003aClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List methods; + + // 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; + } + + // Get all methods, find constructors and static initializers and + // check them + try { + methods = refType.allMethods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods read " + + totalMethods); + return 2; + } + log.display("debuger> Total methods found: " + totalMethods); + Iterator methodsIterator = methods.iterator(); + for (int i = 0; methodsIterator.hasNext(); i++) { + Method method = (Method)methodsIterator.next(); + boolean isStatic; + String decTypeName = method.declaringType().name(); + String name = method.name(); + + if (method.isConstructor() || method.isStaticInitializer()) { + try { + isStatic = method.isStatic(); + } catch(Exception e) { + log.complain("debuger FAILURE 1> Cannot get isStatic from " + + "method " + name + " in " + decTypeName); + testFailed = true; + continue; + } + log.display("debuger> " + i + " method (" + name + "), " + + "isStatic = " + isStatic + " read in " + + decTypeName); + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003/TestDescription.java new file mode 100644 index 00000000000..344dca68fa7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003/TestDescription.java @@ -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/TypeComponent/isStatic/isstatic003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isStatic() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isStatic() + * Determines if this TypeComponent is static. Return value is undefined for + * constructors and static initializers. + * Returns: true if this type component was declared static; false otherwise. + * nsk/jdi/TypeComponent/isStatic/isstatic003 checks assertion: + * public boolean isStatic() + * 1. method isStatic() is defined for constructors and static initializers + * and does not throw an Exception. + * Debugger gets all methods from debuggee, finds contructors and static + * initializers only and checks if isStatic() doesn't throw any Exception. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isStatic.isstatic003 + * nsk.jdi.TypeComponent.isStatic.isstatic003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isStatic.isstatic003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003a.java new file mode 100644 index 00000000000..d9b4e38ab29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003a.java @@ -0,0 +1,90 @@ +/* + * 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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class isstatic003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + isstatic003aClassToCheck classToCheck = new isstatic003aClassToCheck(); + + 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 isstatic003aClassToCheck extends isstatic003aSuperClass { + isstatic003aClassToCheck() {}; + public isstatic003aClassToCheck(long l) {}; + private isstatic003aClassToCheck(Object obj) {}; + protected isstatic003aClassToCheck(long[] l) {}; + + static int ci; + static Long cL; + static long[] cl = new long[10]; + + static { ci = 1; } + static { cL = new Long(1l); } + static { + for (int i = 0; i < 10; i++) { + cl[i] = (long)i; + } + } +} + +class isstatic003aSuperClass { + isstatic003aSuperClass() {}; + public isstatic003aSuperClass(long l) {}; + private isstatic003aSuperClass(Object obj) {}; + protected isstatic003aSuperClass(long[] l) {}; + + static boolean sb; + static Object sO; + static float[] sf = new float[10]; + + static { sb = true; } + static { sO = new Object(); } + static { + for (int i = 0; i < 10; i++) { + sf[i] = (float)i; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004.java new file mode 100644 index 00000000000..922c85a32f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004.java @@ -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.TypeComponent.isStatic; + +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 isstatic004 { + + //------------------------------------------------------- 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.TypeComponent.isStatic."; + private final static String className = "isstatic004"; + 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.isStatic()) { + display("enum " + className + " has static field " + expectedEnumFieldsNames[i]); + display("\t of type " + className); + } else { + complain("enum " + className + " has instance 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004/TestDescription.java new file mode 100644 index 00000000000..f8c697f7cf4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/TypeComponent/isStatic/isstatic004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * A test for isStatic() method of TypeComponent interface. + * The test checks if the method returns true for each enum + * constants declared in mirrored enum type. + * The test consists of a debugger program (isstatic004.java) + * and debuggee application (isstatic004a.java). + * Package name is nsk.jdi.TypeComponent.isStatic . + * 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 finds fields of enum type declared in isstatic004a + * class. Then the debugger checks test assertion for every + * enum constants declared in mirrored enum types. + * 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.TypeComponent.isStatic.isstatic004 + * nsk.jdi.TypeComponent.isStatic.isstatic004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isStatic.isstatic004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004a.java new file mode 100644 index 00000000000..194c2962334 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004a.java @@ -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.TypeComponent.isStatic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * The debugged application of the test. + */ +public class isstatic004a { + + //------------------------------------------------------- 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 isstatic004Enum1 f1 = isstatic004Enum1.e2; + static isstatic004Enum2 f2 = isstatic004Enum2.e1; + static isstatic004Enum1.Enum1_ f3 = isstatic004Enum1.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(isstatic004.SIGNAL_READY); + + + //pipe.println(isstatic004.SIGNAL_GO); + receiveSignal(isstatic004.SIGNAL_QUIT); + + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + //--------------------------------------------------------- test specific inner classes + +} + +//--------------------------------------------------------- test specific classes + +enum isstatic004Enum1 { + e1, e2; + + enum Enum1_ { + e1, e2; + } +} + +enum isstatic004Enum2 { + e1 { + int val() {return 1;} + }, + + e2 { + int val() {return 2;} + }; + abstract int val(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001.java new file mode 100644 index 00000000000..8bf280dd2cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001.java @@ -0,0 +1,247 @@ +/* + * 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.TypeComponent.isSynthetic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class issynthetic001 { + final static String FIELD_NAME[] = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + + "lF0", "lF1", "lF2", + "lP0", "lP1", "lP2", + "lU0", "lU1", "lU2", + "lR0", "lR1", "lR2", + "lT0", "lT1", "lT2", + "lV0", "lV1", "lV2", + + "X0", "X1", "X2", + "O0", "O1", "O2", + + "LF0", "LF1", "LF2", + "LP0", "LP1", "LP2", + "LU0", "LU1", "LU2", + "LR0", "LR1", "LR2", + "LT0", "LT1", "LT2", + "LV0", "LV1", "LV2", + + "E0", "E1", "E2", + "EF0", "EF1", "EF2", + "EP0", "EP1", "EP2", + "EU0", "EU1", "EU2", + "ER0", "ER1", "ER2", + "ET0", "ET1", "ET2", + "EV0", "EV1", "EV2" + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isSynthetic."; + private final static String className = "issynthetic001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "ClassToCheck"; + + 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" : "")); + VirtualMachine vm = debugee.VM(); + boolean canGetSynthetic = vm.canGetSyntheticAttribute(); + IOPipe pipe = new IOPipe(debugee); + boolean testFailed = false; + List fields; + List nestedTypes; + ReferenceType nestedClass = null; + int totalSyntheticFields = 0; + + log.display("debuger> Value of canGetSyntheticAttribute in current " + + "VM is " + canGetSynthetic); + + // 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; + } + + // Get nested class + try { + nestedTypes = refType.nestedTypes(); + } catch (ObjectCollectedException e) { + log.complain("debuger FAILURE> Cannot get nested types from " + + classToCheckName); + return 2; + } + int totalNestedTypes = nestedTypes.size(); + if (totalNestedTypes == 0) { + log.complain("debuger FAILURE> No nested classes found."); + return 2; + } + nestedClass = (ReferenceType)nestedTypes.get(0); + if (nestedClass == null) { + log.complain("debuger FAILURE> Cannot find nested class."); + return 2; + } + + // Get all fields and check them + try { + fields = nestedClass.fields(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get fields from nested class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalFields = fields.size(); + if (totalFields < 1) { + log.complain("debuger FAILURE> Total number of fields read " + + totalFields); + return 2; + } + log.display("debuger> Total fields in debugee read: " + + totalFields + " total fields in debuger: " + + FIELD_NAME.length); + for (int i = 0; i < fields.size(); i++) { + Field field = (Field)fields.get(i); + String name = field.name(); + boolean isSynthetic; + boolean isRealSynthetic = true; + + try { + isSynthetic = field.isSynthetic(); + + if (!canGetSynthetic) { + log.complain("debuger FAILURE 1> Value of " + + "canGetSyntheticAttribute in current VM is " + + "false, so UnsupportedOperationException was " + + "expected for " + i + " field " + name); + testFailed = true; + continue; + } else { + log.display("debuger> " + i + " field " + name + " with " + + "synthetic value " + isSynthetic + " read " + + "without UnsupportedOperationException."); + } + } catch (UnsupportedOperationException e) { + if (canGetSynthetic) { + log.complain("debuger FAILURE 2> Value of " + + "canGetSyntheticAttribute in current VM is " + + "true, but cannot get synthetic for field " + + "name."); + log.complain("debuger FAILURE 2> Exception: " + e); + testFailed = true; + } else { + log.display("debuger> UnsupportedOperationException was " + + "thrown while getting isSynthetic for " + i + + " field " + name + " because value " + + "canGetSynthetic is false."); + } + continue; + } + + // Find out if field exists in list of fields + for (int j = 0; j < FIELD_NAME.length; j++) { + String nameFromList = FIELD_NAME[j]; + + if (nameFromList.equals(name)) { + // Field found in list - is not synthetic + + isRealSynthetic = false; + break; + } + } + + if (isRealSynthetic != isSynthetic) { + log.complain("debuger FAILURE 3> Field's " + name + + " synthetic is " + isSynthetic + ", but expected " + + "is " + isRealSynthetic); + testFailed = true; + continue; + } + + if (isSynthetic) { + totalSyntheticFields++; + } + } + + if (totalSyntheticFields == 0) { + log.complain("debuger FAILURE 4> Synthetic fields not found."); + testFailed = true; + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001/TestDescription.java new file mode 100644 index 00000000000..865780a8070 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/TypeComponent/isSynthetic/issynthetic001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isSynthetic() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isSynthetic() + * Determines if this TypeComponent is synthetic. Synthetic members are + * generated by the compiler and are not present in the source code for the + * containing class. + * Not all target VMs support this query. See + * VirtualMachine.canGetSyntheticAttribute() to determine if the operation + * is supported. + * Returns: true if this type component is synthetic; false otherwise. + * Throws: java.lang.UnsupportedOperationException - if the target VM cannot + * provide information on synthetic attributes. + * nsk/jdi/TypeComponent/isSynthetic/issynthetic001 checks assertions: + * public java.lang.String isSynthetic() + * 1. Returns true if the operation is supported and the field is synthetic; + * 2. Returns false if the operation is supported and the field is not + * present in the source code for the containing class; + * 3. Throws java.lang.UnsupportedOperationException if the target VM cannot + * provide information on synthetic attributes + * (VirtualMachine.canGetSyntheticAttribute() is false). + * 4. Does not throw java.lang.UnsupportedOperationException if the target + * VM provides information on synthetic attributes + * (VirtualMachine.canGetSyntheticAttribute() is true). + * There are classes ClassToCheck and NestedClass declared within + * ClassToCheck in debugee. So synthetic field (reference to ClassToCheck) + * must exist in NestedClass. + * Debugger gets all fields from NestedClass, gets isSynthetic() value. + * If VirtualMachine.canGetSyntheticAttribute() is false then exception + * java.lang.UnsupportedOperationException must be thrown. Otherwise + * exception is not thrown. + * Then test tries to find field's name in list of fileds that are present + * in the source code. If field is not found, then isSynthetic() value + * expects to be true, otherwise isSynthetic() value expects to be false. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isSynthetic.issynthetic001 + * nsk.jdi.TypeComponent.isSynthetic.issynthetic001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isSynthetic.issynthetic001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001a.java new file mode 100644 index 00000000000..c8abb6a319a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001a.java @@ -0,0 +1,98 @@ +/* + * 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.TypeComponent.isSynthetic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class issynthetic001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + ClassToCheck classToCheck = new ClassToCheck(); + + 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); + } +} + +// User class and interface +class Class {} +interface Inter {} + +class ClassToCheck { + NestedClass nestedClass = new NestedClass(); + + class NestedClass { + // Not-synthetic fields + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + Class X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + Inter E0, E1[]={E0}, E2[][]={E1}; + + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002.java new file mode 100644 index 00000000000..fb684c807c5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002.java @@ -0,0 +1,235 @@ +/* + * 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.TypeComponent.isSynthetic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class issynthetic002 { + final static String METHOD_NAME[] = { + "", + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvF", "MlF", "MlF1", "MlF2", + "MvN", "MlN", "MlN1", "MlN2", + "MvS", "MlS", "MlS1", "MlS2", + "MvI", "MlI", "MlI1", "MlI2", + "MvY", "MlY", "MlY1", "MlY2", + "MvU", "MlU", "MlU1", "MlU2", + "MvR", "MlR", "MlR1", "MlR2", + "MvP", "MlP", "MlP1", "MlP2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLF", "MLF1", "MLF2", + "MLN", "MLN1", "MLN2", + "MLS", "MLS1", "MLS2", + "MLI", "MLI1", "MLI2", + "MLY", "MLY1", "MLY2", + "MLU", "MLU1", "MLU2", + "MLR", "MLR1", "MLR2", + "MLP", "MLP1", "MLP2", + + "ME", "ME1", "ME2", + "MEF", "MEF1", "MEF2", + "MEN", "MEN1", "MEN2", + "MES", "ME1S", "ME2S", + "MEI", "MEI1", "MEI2", + "MEY", "MEY1", "MEY2", + "MEU", "MEU1", "MEU2", + "MER", "MER1", "MER2", + "MEP", "MEP1", "MEP2" + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.isSynthetic."; + private final static String className = "issynthetic002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "issynthetic002aClassToCheck"; + + 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" : "")); + VirtualMachine vm = debugee.VM(); + boolean canGetSynthetic = vm.canGetSyntheticAttribute(); + IOPipe pipe = new IOPipe(debugee); + boolean testFailed = false; + List methods; + int totalSyntheticMethods = 0; + + log.display("debuger> Value of canGetSyntheticAttribute in current " + + "VM is " + canGetSynthetic); + + // 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; + } + + // Check methods from debuggee + try { + methods = refType.methods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from " + + classToCheckName); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods in debuggee " + + "read " + totalMethods); + return 2; + } + log.display("debuger> Total methods in debuggee read: " + + totalMethods + " total methods in debuger: " + + METHOD_NAME.length); + for (int i = 0; i < totalMethods; i++) { + Method method = (Method)methods.get(i); + String name = method.name(); + boolean isSynthetic; + boolean isRealSynthetic = true; + + try { + isSynthetic = method.isSynthetic(); + + if (!canGetSynthetic) { + log.complain("debuger FAILURE 1> Value of " + + "canGetSyntheticAttribute in current VM is " + + "false, so UnsupportedOperationException was " + + "expected for " + i + " method " + name); + testFailed = true; + continue; + } else { + log.display("debuger> " + i + " method " + name + " with " + + "synthetic value " + isSynthetic + " read " + + "without UnsupportedOperationException"); + } + } catch (UnsupportedOperationException e) { + if (canGetSynthetic) { + log.complain("debuger FAILURE 2> Value of " + + "canGetSyntheticAttribute in current VM is " + + "true, but cannot get synthetic for method " + + "name."); + log.complain("debuger FAILURE 2> Exception: " + e); + testFailed = true; + } else { + log.display("debuger> UnsupportedOperationException was " + + "thrown while getting isSynthetic for " + i + + " method " + name + " because value " + + "canGetSynthetic is false."); + } + continue; + } + + // Find out if method exists in list of methods + for (int j = 0; j < METHOD_NAME.length; j++) { + String nameFromList = METHOD_NAME[j]; + + if (nameFromList.equals(name)) { + // Method found in list - is not synthetic + + isRealSynthetic = false; + break; + } + } + + if (isRealSynthetic != isSynthetic) { + log.complain("debuger FAILURE 3> Method's " + name + + " synthetic is " + isSynthetic + ", but expected " + + "is " + isRealSynthetic); + testFailed = true; + continue; + } + + if (isSynthetic) { + totalSyntheticMethods++; + } + } + + if (totalSyntheticMethods == 0) { + log.complain("debuger FAILURE 4> Synthetic methods not found."); + testFailed = true; + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002/TestDescription.java new file mode 100644 index 00000000000..c03394d8160 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/TypeComponent/isSynthetic/issynthetic002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the isSynthetic() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public boolean isSynthetic() + * Determines if this TypeComponent is synthetic. Synthetic members are + * generated by the compiler and are not present in the source code for the + * containing class. + * Not all target VMs support this query. See + * VirtualMachine.canGetSyntheticAttribute() to determine if the operation + * is supported. + * Returns: true if this type component is synthetic; false otherwise. + * Throws: java.lang.UnsupportedOperationException - if the target VM cannot + * provide information on synthetic attributes. + * nsk/jdi/TypeComponent/isSynthetic/issynthetic002 checks assertions: + * public java.lang.String isSynthetic() + * 1. Returns true if the operation is supported and the method is synthetic; + * 2. Returns false if the operation is supported and the method is not + * present in the source code for the containing class; + * 3. Throws java.lang.UnsupportedOperationException if the target VM cannot + * provide information on synthetic attributes + * (VirtualMachine.canGetSyntheticAttribute() is false). + * 4. Does not throw java.lang.UnsupportedOperationException if the target + * VM provides information on synthetic attributes + * (VirtualMachine.canGetSyntheticAttribute() is true). + * There are ClassToCheck and NestedClass declared within ClassToCheck in + * debugee. Nested class uses two private variables from ClassToCheck, so + * synthetic methods (two for each variable) must exist in ClassToCheck. + * Debugger gets all methods from debuggee, gets isSynthetic() value. + * If VirtualMachine.canGetSyntheticAttribute() is false then exception + * java.lang.UnsupportedOperationException must be thrown. Otherwise + * exception is not thrown. + * Then test tries to find method's name in list of methods that are present + * in the source code. If method is not found, then isSynthetic() value + * expects to be true, otherwise isSynthetic() value expects to be false. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.isSynthetic.issynthetic002 + * nsk.jdi.TypeComponent.isSynthetic.issynthetic002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.isSynthetic.issynthetic002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002a.java new file mode 100644 index 00000000000..710b8e58859 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002a.java @@ -0,0 +1,203 @@ +/* + * 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.TypeComponent.isSynthetic; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class issynthetic002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + issynthetic002aClassToCheck classToCheck = new issynthetic002aClassToCheck(); + + 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 issynthetic002aClassToCheck { + // Not-synthetic methods + + // User class and interface + class Class {} + interface Inter {} + + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + final void MvF() {}; + final long MlF(long l) { return l; }; + final long[] MlF1(long l[]) { return l; }; + final long[][] MlF2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + Class MX(Class X) { return X; }; + Class[] MX1(Class X[]) { return X; }; + Class[][] MX2(Class X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + final Long MLF(Long L) { return L; }; + final Long[] MLF1(Long[] L) { return L; }; + final Long[][] MLF2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + Inter ME(Inter E) { return E; }; + Inter[] ME1(Inter[] E) { return E; }; + Inter[][] ME2(Inter[][] E) { return E; }; + + final Inter MEF(Inter E) { return E; }; + final Inter[] MEF1(Inter[] E) { return E; }; + final Inter[][] MEF2(Inter[][] E) { return E; }; + native Inter MEN(Inter E); + native Inter[] MEN1(Inter[] E); + native Inter[][] MEN2(Inter[][] E); + static Inter MES(Inter E) { return E; }; + static Inter[] ME1S(Inter[] E) { return E; }; + static Inter[][] ME2S(Inter[][] E) { return E; }; + strictfp Inter MEI(Inter E) { return E; }; + strictfp Inter[] MEI1(Inter[] E) { return E; }; + strictfp Inter[][] MEI2(Inter[][] E) { return E; }; + synchronized Inter MEY(Inter E) { return E; }; + synchronized Inter[] MEY1(Inter[] E) { return E; }; + synchronized Inter[][] MEY2(Inter[][] E) { return E; }; + public Inter MEU(Inter E) { return E; }; + public Inter[] MEU1(Inter[] E) { return E; }; + public Inter[][] MEU2(Inter[][] E) { return E; }; + protected Inter MER(Inter E) { return E; }; + protected Inter[] MER1(Inter[] E) { return E; }; + protected Inter[][] MER2(Inter[][] E) { return E; }; + private Inter MEP(Inter E) { return E; }; + private Inter[] MEP1(Inter[] E) { return E; }; + private Inter[][] MEP2(Inter[][] E) { return E; }; + + // Synthetic methods + + private int i; + private String s; + + class NestedClass { + boolean MS(String str) { + // Method uses private variable s from ClassToCheck, + // so two synthetic methods must appear in ClassToCheck + + s = s + "NestedClass"; + return s.equals(str); + }; + + boolean Mi(int j) { + // Method uses private variable i from ClassToCheck, + // so two synthetic methods must appear in ClassToCheck + + i = i + 1; + return (i == j); + }; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001.java new file mode 100644 index 00000000000..7d12ab2471f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001.java @@ -0,0 +1,170 @@ +/* + * 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.TypeComponent.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class name001 { + final static String FIELD_NAME[] = { + "z0", "z1", "z2", + "b0", "b1", "b2", + "c0", "c1", "c2", + "d0", "d1", "d2", + "f0", "f1", "f2", + "i0", "i1", "i2", + "l0", "l1", "l2", + "r0", "r1", "r2", + + "lF0", "lF1", "lF2", + "lP0", "lP1", "lP2", + "lU0", "lU1", "lU2", + "lR0", "lR1", "lR2", + "l0S", "l1S", "l2S", + "lT0", "lT1", "lT2", + "lV0", "lV1", "lV2", + + "X0", "X1", "X2", + "O0", "O1", "O2", + + "LF0", "LF1", "LF2", + "LP0", "LP1", "LP2", + "LU0", "LU1", "LU2", + "LR0", "LR1", "LR2", + "L0S", "L1S", "L2S", + "LT0", "LT1", "LT2", + "LV0", "LV1", "LV2", + + "E0", "E1", "E2", + "EF0", "EF1", "EF2", + "EP0", "EP1", "EP2", + "EU0", "EU1", "EU2", + "ER0", "ER1", "ER2", + "E0S", "E1S", "E2S", + "ET0", "ET1", "ET2", + "EV0", "EV1", "EV2" + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.name."; + private final static String className = "name001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "ClassToCheck"; + + 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 = new IOPipe(debugee); + 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); + // Check all fields from debugee + for (int i = 0; i < FIELD_NAME.length; i++) { + Field field; + String name; + + try { + field = refType.fieldByName(FIELD_NAME[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME[i]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + name = field.name(); + if (name == null) { + log.complain("debuger FAILURE 2> Name is null for " + i + + " field (" + FIELD_NAME[i] + ")"); + testFailed = true; + continue; + } + log.display("debuger> " + i + " name of field (" + FIELD_NAME[i] + + ") " + name + " read."); + if (!name.equals(FIELD_NAME[i])) { + log.complain("debuger FAILURE 3> Returned name for field (" + + FIELD_NAME[i] + ") is " + name); + testFailed = true; + continue; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001/TestDescription.java new file mode 100644 index 00000000000..986d0e2ca01 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/TypeComponent/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the name() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public java.lang.String name() + * Gets the name of this type component. + * Note: for fields, this is the field name; for methods, this is the + * method name; for constructors, this is ; for static + * initializers, this is . + * Returns: a string containing the name. + * nsk/jdi/TypeComponent/name/name001 checks assertion: + * public java.lang.String name() + * 1. Returns field name for a field. + * Debugger gets each field from debuggee calling by name and then checks + * if method name() returns the same name of the field. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.name.name001 + * nsk.jdi.TypeComponent.name.name001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001a.java new file mode 100644 index 00000000000..70140884761 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name001a.java @@ -0,0 +1,96 @@ +/* + * 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.TypeComponent.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class name001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + ClassToCheck classToCheck = new ClassToCheck(); + + 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 ClassToCheck { + // User class and interface + class Class {} + interface Inter {} + + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + Class X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + static Long L0S, L1S[]={L0S}, L2S[][]={L1S}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + Inter E0, E1[]={E0}, E2[][]={E1}; + + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + static Inter E0S, E1S[]={E0S}, E2S[][]={E1S}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002.java new file mode 100644 index 00000000000..fdc3cb3c57b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002.java @@ -0,0 +1,183 @@ +/* + * 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.TypeComponent.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class name002 { + final static String METHOD_NAME[] = { + "Mv", + "Mz", "Mz1", "Mz2", + "Mb", "Mb1", "Mb2", + "Mc", "Mc1", "Mc2", + "Md", "Md1", "Md2", + "Mf", "Mf1", "Mf2", + "Mi", "Mi1", "Mi2", + "Ml", "Ml1", "Ml2", + "Mr", "Mr1", "Mr2", + + "MvF", "MlF", "MlF1", "MlF2", + "MvN", "MlN", "MlN1", "MlN2", + "MvS", "MlS", "MlS1", "MlS2", + "MvI", "MlI", "MlI1", "MlI2", + "MvY", "MlY", "MlY1", "MlY2", + "MvU", "MlU", "MlU1", "MlU2", + "MvR", "MlR", "MlR1", "MlR2", + "MvP", "MlP", "MlP1", "MlP2", + + "MX", "MX1", "MX2", + "MO", "MO1", "MO2", + + "MLF", "MLF1", "MLF2", + "MLN", "MLN1", "MLN2", + "MLS", "MLS1", "MLS2", + "MLI", "MLI1", "MLI2", + "MLY", "MLY1", "MLY2", + "MLU", "MLU1", "MLU2", + "MLR", "MLR1", "MLR2", + "MLP", "MLP1", "MLP2", + + "ME", "ME1", "ME2", + "MEF", "MEF1", "MEF2", + "MEN", "MEN1", "MEN2", + "MES", "ME1S", "ME2S", + "MEI", "MEI1", "MEI2", + "MEY", "MEY1", "MEY2", + "MEU", "MEU1", "MEU2", + "MER", "MER1", "MER2", + "MEP", "MEP1", "MEP2" + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.name."; + private final static String className = "name002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "name002aClassToCheck"; + + 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 = new IOPipe(debugee); + 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; + } + + // Check all methods from debugee + for (int i = 0; i < METHOD_NAME.length; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String name; + + try { + listOfMethods = refType.methodsByName(METHOD_NAME[i]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME[i]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME[i] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + name = method.name(); + if (name == null) { + log.complain("debuger FAILURE 3> Name is null for " + i + + " method (" + METHOD_NAME[i] + ")"); + testFailed = true; + continue; + } + log.display("debuger> " + i + " name of method (" + METHOD_NAME[i] + + ") " + name + " read."); + if (!name.equals(METHOD_NAME[i])) { + log.complain("debuger FAILURE 4> Returned name for method (" + + METHOD_NAME[i] + ") is " + name); + testFailed = true; + continue; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002/TestDescription.java new file mode 100644 index 00000000000..1c92e4b20dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/TypeComponent/name/name002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the name() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public java.lang.String name() + * Gets the name of this type component. + * Note: for fields, this is the field name; for methods, this is the + * method name; for constructors, this is ; for static + * initializers, this is . + * Returns: a string containing the name. + * nsk/jdi/TypeComponent/name/name002 checks assertion: + * public java.lang.String name() + * 1. Returns method name for a method. + * Debugger gets each method from debuggee calling by name and then checks + * if name() returns the same name of the method. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.name.name002 + * nsk.jdi.TypeComponent.name.name002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.name.name002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002a.java new file mode 100644 index 00000000000..6ef98dd6a8b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name002a.java @@ -0,0 +1,178 @@ +/* + * 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.TypeComponent.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class name002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + name002aClassToCheck classToCheck = new name002aClassToCheck(); + + 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 name002aClassToCheck { + // User class and interface + class Class {} + interface Inter {} + + void Mv() {}; + boolean Mz(boolean z) { return z; }; + boolean[] Mz1(boolean z[]) { return z; }; + boolean[][] Mz2(boolean z[][]) { return z; }; + byte Mb(byte b) { return b; }; + byte[] Mb1(byte b[]) { return b; }; + byte[][] Mb2(byte b[][]) { return b; }; + char Mc(char c) { return c; }; + char[] Mc1(char c[]) { return c; }; + char[][] Mc2(char c[][]) { return c; }; + double Md(double d) { return d; }; + double[] Md1(double d[]) { return d; }; + double[][] Md2(double d[][]) { return d; }; + float Mf(float f) { return f; }; + float[] Mf1(float f[]) { return f; }; + float[][] Mf2(float f[][]) { return f; }; + int Mi(int i) { return i; }; + int[] Mi1(int i[]) { return i; }; + int[][] Mi2(int i[][]) { return i; }; + long Ml(long l) { return l; }; + long[] Ml1(long l[]) { return l; }; + long[][] Ml2(long l[][]) { return l; }; + short Mr(short r) { return r; }; + short[] Mr1(short r[]) { return r; }; + short[][] Mr2(short r[][]) { return r; }; + + final void MvF() {}; + final long MlF(long l) { return l; }; + final long[] MlF1(long l[]) { return l; }; + final long[][] MlF2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + Class MX(Class X) { return X; }; + Class[] MX1(Class X[]) { return X; }; + Class[][] MX2(Class X[][]) { return X; }; + Object MO(Object O) { return O; }; + Object[] MO1(Object[] O) { return O; }; + Object[][] MO2(Object[][] O) { return O; }; + + final Long MLF(Long L) { return L; }; + final Long[] MLF1(Long[] L) { return L; }; + final Long[][] MLF2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + Inter ME(Inter E) { return E; }; + Inter[] ME1(Inter[] E) { return E; }; + Inter[][] ME2(Inter[][] E) { return E; }; + + final Inter MEF(Inter E) { return E; }; + final Inter[] MEF1(Inter[] E) { return E; }; + final Inter[][] MEF2(Inter[][] E) { return E; }; + native Inter MEN(Inter E); + native Inter[] MEN1(Inter[] E); + native Inter[][] MEN2(Inter[][] E); + static Inter MES(Inter E) { return E; }; + static Inter[] ME1S(Inter[] E) { return E; }; + static Inter[][] ME2S(Inter[][] E) { return E; }; + strictfp Inter MEI(Inter E) { return E; }; + strictfp Inter[] MEI1(Inter[] E) { return E; }; + strictfp Inter[][] MEI2(Inter[][] E) { return E; }; + synchronized Inter MEY(Inter E) { return E; }; + synchronized Inter[] MEY1(Inter[] E) { return E; }; + synchronized Inter[][] MEY2(Inter[][] E) { return E; }; + public Inter MEU(Inter E) { return E; }; + public Inter[] MEU1(Inter[] E) { return E; }; + public Inter[][] MEU2(Inter[][] E) { return E; }; + protected Inter MER(Inter E) { return E; }; + protected Inter[] MER1(Inter[] E) { return E; }; + protected Inter[][] MER2(Inter[][] E) { return E; }; + private Inter MEP(Inter E) { return E; }; + private Inter[] MEP1(Inter[] E) { return E; }; + private Inter[][] MEP2(Inter[][] E) { return E; }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003.java new file mode 100644 index 00000000000..9eb4f553dd1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003.java @@ -0,0 +1,151 @@ +/* + * 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.TypeComponent.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class name003 { + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.name."; + private final static String className = "name003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "name003aClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List methods; + + // 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; + } + + // Get all methods, find constructors and static initializers and + // check them + try { + methods = refType.allMethods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods read " + + totalMethods); + return 2; + } + log.display("debuger> Total methods found: " + totalMethods); + Iterator methodsIterator = methods.iterator(); + for (int i = 0; methodsIterator.hasNext(); i++) { + Method method = (Method)methodsIterator.next(); + String decTypeName = method.declaringType().name(); + String name = method.name(); + + log.display("debuger> " + i + " method " + name + " from " + + decTypeName + " read."); + if (method.isConstructor()) { + // For constructors TypeComponent.name() is "" + if (!name.equals("")) { + log.complain("debuger FAILURE 1> Constructor from " + + decTypeName + " is read with name " + name + + ", but name should be "); + testFailed = true; + continue; + } else { + log.display("debuger> Constructor " + name + " from " + + decTypeName + " checked."); + } + } + if (method.isStaticInitializer()) { + // For static initializers TypeComponent.name() is "" + if (!name.equals("")) { + log.complain("debuger FAILURE 2> Static initializer from " + + decTypeName + " is read with name " + name + + ", but name should be "); + testFailed = true; + continue; + } else { + log.display("debuger> Static initializer " + name + + " from " + decTypeName + " checked."); + } + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003/TestDescription.java new file mode 100644 index 00000000000..e6f494aaff4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/TypeComponent/name/name003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the name() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public java.lang.String name() + * Gets the name of this type component. + * Note: for fields, this is the field name; for methods, this is the + * method name; for constructors, this is ; for static + * initializers, this is . + * Returns: a string containing the name. + * nsk/jdi/TypeComponent/name/name003 checks assertions: + * public java.lang.String name() + * 1. Returns "" for a constructor; + * 2. Returns "" for a static initializer. + * Debugger gets all methods from debuggee, finds only constructors and + * static initializers and then checks if name() returns "" for + * constructors and "" for static initializers. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.name.name003 + * nsk.jdi.TypeComponent.name.name003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.name.name003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003a.java new file mode 100644 index 00000000000..a4e96e9e6eb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/name/name003a.java @@ -0,0 +1,90 @@ +/* + * 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.TypeComponent.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class name003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + name003aClassToCheck classToCheck = new name003aClassToCheck(); + + 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 name003aClassToCheck extends name003aSuperClass { + name003aClassToCheck() {}; + public name003aClassToCheck(long l) {}; + private name003aClassToCheck(Object obj) {}; + protected name003aClassToCheck(long[] l) {}; + + static int ci; + static Long cL; + static long[] cl = new long[10]; + + static { ci = 1; } + static { cL = new Long(1l); } + static { + for (int i = 0; i < 10; i++) { + cl[i] = (long)i; + } + } +} + +class name003aSuperClass { + name003aSuperClass() {}; + public name003aSuperClass(long l) {}; + private name003aSuperClass(Object obj) {}; + protected name003aSuperClass(long[] l) {}; + + static boolean sb; + static Object sO; + static float[] sf = new float[10]; + + static { sb = true; } + static { sO = new Object(); } + static { + for (int i = 0; i < 10; i++) { + sf[i] = (float)i; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001.java new file mode 100644 index 00000000000..b44ac0265d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001.java @@ -0,0 +1,228 @@ +/* + * 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.TypeComponent.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.io.*; + +public class sign001 { + final static int TOTAL_FIELDS = 96; + final static String FIELD_NAME[][] = { + {"z0", "Z"}, + {"z1", "[Z"}, + {"z2", "[[Z"}, + {"b0", "B"}, + {"b1", "[B"}, + {"b2", "[[B"}, + {"c0", "C"}, + {"c1", "[C"}, + {"c2", "[[C"}, + {"d0", "D"}, + {"d1", "[D"}, + {"d2", "[[D"}, + {"f0", "F"}, + {"f1", "[F"}, + {"f2", "[[F"}, + {"i0", "I"}, + {"i1", "[I"}, + {"i2", "[[I"}, + {"l0", "J"}, + {"l1", "[J"}, + {"l2", "[[J"}, + {"r0", "S"}, + {"r1", "[S"}, + {"r2", "[[S"}, + {"lF0", "J"}, + {"lF1", "[J"}, + {"lF2", "[[J"}, + {"lP0", "J"}, + {"lP1", "[J"}, + {"lP2", "[[J"}, + {"lU0", "J"}, + {"lU1", "[J"}, + {"lU2", "[[J"}, + {"lR0", "J"}, + {"lR1", "[J"}, + {"lR2", "[[J"}, + {"l0S", "J"}, + {"l1S", "[J"}, + {"l2S", "[[J"}, + {"lT0", "J"}, + {"lT1", "[J"}, + {"lT2", "[[J"}, + {"lV0", "J"}, + {"lV1", "[J"}, + {"lV2", "[[J"}, + {"X0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Class;"}, + {"X1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Class;"}, + {"X2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Class;"}, + {"O0", "Ljava/lang/Object;"}, + {"O1", "[Ljava/lang/Object;"}, + {"O2", "[[Ljava/lang/Object;"}, + {"LF0", "Ljava/lang/Long;"}, + {"LF1", "[Ljava/lang/Long;"}, + {"LF2", "[[Ljava/lang/Long;"}, + {"LP0", "Ljava/lang/Long;"}, + {"LP1", "[Ljava/lang/Long;"}, + {"LP2", "[[Ljava/lang/Long;"}, + {"LU0", "Ljava/lang/Long;"}, + {"LU1", "[Ljava/lang/Long;"}, + {"LU2", "[[Ljava/lang/Long;"}, + {"LR0", "Ljava/lang/Long;"}, + {"LR1", "[Ljava/lang/Long;"}, + {"LR2", "[[Ljava/lang/Long;"}, + {"L0S", "Ljava/lang/Long;"}, + {"L1S", "[Ljava/lang/Long;"}, + {"L2S", "[[Ljava/lang/Long;"}, + {"LT0", "Ljava/lang/Long;"}, + {"LT1", "[Ljava/lang/Long;"}, + {"LT2", "[[Ljava/lang/Long;"}, + {"LV0", "Ljava/lang/Long;"}, + {"LV1", "[Ljava/lang/Long;"}, + {"LV2", "[[Ljava/lang/Long;"}, + {"E0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"E1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"E2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EF0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EF1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EF2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EP0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EP1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EP2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EU0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EU1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EU2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"ER0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"ER1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"ER2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"E0S", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"E1S", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"E2S", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"ET0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"ET1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"ET2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EV0", "Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EV1", "[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"}, + {"EV2", "[[Lnsk/jdi/TypeComponent/signature/ClassToCheck$Inter;"} + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.signature."; + private final static String className = "sign001"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "ClassToCheck"; + + 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 = new IOPipe(debugee); + 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: " + + TOTAL_FIELDS); + // Check all fields from debugee + for (int i = 0; i < TOTAL_FIELDS; i++) { + Field field; + String signature; + String realSign; + + try { + field = refType.fieldByName(FIELD_NAME[i][0]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get field by name " + + FIELD_NAME[i][0]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + signature = field.signature(); + realSign = FIELD_NAME[i][1]; + log.display("debuger> " + i + " field (" + FIELD_NAME[i][0] + + ") with signature " + signature + " read."); + if (!realSign.equals(signature)) { + log.complain("debuger FAILURE 2> Returned signature for field (" + + FIELD_NAME[i][0] + ") is " + signature + + ", expected " + realSign); + testFailed = true; + continue; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001/TestDescription.java new file mode 100644 index 00000000000..48e44b632f8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/TypeComponent/signature/sign001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the signature() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public java.lang.String signature() + * Gets the JNI-style signature for this type component. The signature is + * encoded type information as defined in the JNI documentation. It is a + * convenient, compact format for for manipulating type information + * internally, not necessarily for display to an end user. See + * Field.typeName() and Method.returnTypeName() for ways to help get a more + * readable representation of the type. + * Returns: a string containing the signature + * See Also: Type Signatures + * nsk/jdi/TypeComponent/signature/signature001 checks assertion: + * public java.lang.String signature() + * 1. Gets the JNI-style signature for a field. + * Debugger gets each field from debuggee calling by name and then checks + * if method signature() returns the expected value for the field. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.signature.sign001 + * nsk.jdi.TypeComponent.signature.sign001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.signature.sign001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001a.java new file mode 100644 index 00000000000..7202aa45494 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign001a.java @@ -0,0 +1,96 @@ +/* + * 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.TypeComponent.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class sign001a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + ClassToCheck classToCheck = new ClassToCheck(); + + 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 ClassToCheck { + // User class and interface + class Class {} + interface Inter {} + + 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}; + short r0, r1[]={r0}, r2[][]={r1}; + + final long lF0 = 1l, lF1[]={lF0}, lF2[][]={lF1}; + private long lP0, lP1[]={lP0}, lP2[][]={lP1}; + public long lU0, lU1[]={lU0}, lU2[][]={lU1}; + protected long lR0, lR1[]={lR0}, lR2[][]={lR1}; + static long l0S, l1S[]={l0S}, l2S[][]={l1S}; + transient long lT0, lT1[]={lT0}, lT2[][]={lT1}; + volatile long lV0, lV1[]={lV0}, lV2[][]={lV1}; + + Class X0, X1[]={X0}, X2[][]={X1}; + Object O0, O1[]={O0}, O2[][]={O1}; + + final Long LF0 = new Long(1), LF1[]={LF0}, LF2[][]={LF1}; + private Long LP0, LP1[]={LP0}, LP2[][]={LP1}; + public Long LU0, LU1[]={LU0}, LU2[][]={LU1}; + protected Long LR0, LR1[]={LR0}, LR2[][]={LR1}; + static Long L0S, L1S[]={L0S}, L2S[][]={L1S}; + transient Long LT0, LT1[]={LT0}, LT2[][]={LT1}; + volatile Long LV0, LV1[]={LV0}, LV2[][]={LV1}; + + Inter E0, E1[]={E0}, E2[][]={E1}; + + final Inter EF0 = null, EF1[]={EF0}, EF2[][]={EF1}; + private Inter EP0, EP1[]={EP0}, EP2[][]={EP1}; + public Inter EU0, EU1[]={EU0}, EU2[][]={EU1}; + protected Inter ER0, ER1[]={ER0}, ER2[][]={ER1}; + static Inter E0S, E1S[]={E0S}, E2S[][]={E1S}; + transient Inter ET0, ET1[]={ET0}, ET2[][]={ET1}; + volatile Inter EV0, EV1[]={EV0}, EV2[][]={EV1}; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002.java new file mode 100644 index 00000000000..3072849d5b2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002.java @@ -0,0 +1,255 @@ +/* + * 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.TypeComponent.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class sign002 { + final static int TOTAL_METHODS = 114; + final static String METHOD_NAME[][] = { + {"Mv", "()V"}, + {"Mz", "(Z[[S)Z"}, + {"Mz1", "([ZZ)[Z"}, + {"Mz2", "([[Z[Z)[[Z"}, + {"Mb", "(B[[Z)B"}, + {"Mb1", "([BB)[B"}, + {"Mb2", "([[B[B)[[B"}, + {"Mc", "(C[[B)C"}, + {"Mc1", "([CC)[C"}, + {"Mc2", "([[C[C)[[C"}, + {"Md", "(D[[C)D"}, + {"Md1", "([DD)[D"}, + {"Md2", "([[D[D)[[D"}, + {"Mf", "(F[[D)F"}, + {"Mf1", "([FF)[F"}, + {"Mf2", "([[F[F)[[F"}, + {"Mi", "(I[[F)I"}, + {"Mi1", "([II)[I"}, + {"Mi2", "([[I[I)[[I"}, + {"Ml", "(J[[I)J"}, + {"Ml1", "([JJ)[J"}, + {"Ml2", "([[J[J)[[J"}, + {"Mr", "(S[[J)S"}, + {"Mr1", "([SS)[S"}, + {"Mr2", "([[S[S)[[S"}, + {"MvF", "()V"}, + {"MlF", "(J)J"}, + {"MlF1", "([J)[J"}, + {"MlF2", "([[J)[[J"}, + {"MvN", "()V"}, + {"MlN", "(J)J"}, + {"MlN1", "([J)[J"}, + {"MlN2", "([[J)[[J"}, + {"MvS", "()V"}, + {"MlS", "(J)J"}, + {"MlS1", "([J)[J"}, + {"MlS2", "([[J)[[J"}, + {"MvI", "()V"}, + {"MlI", "(J)J"}, + {"MlI1", "([J)[J"}, + {"MlI2", "([[J)[[J"}, + {"MvY", "()V"}, + {"MlY", "(J)J"}, + {"MlY1", "([J)[J"}, + {"MlY2", "([[J)[[J"}, + {"MvU", "()V"}, + {"MlU", "(J)J"}, + {"MlU1", "([J)[J"}, + {"MlU2", "([[J)[[J"}, + {"MvR", "()V"}, + {"MlR", "(J)J"}, + {"MlR1", "([J)[J"}, + {"MlR2", "([[J)[[J"}, + {"MvP", "()V"}, + {"MlP", "(J)J"}, + {"MlP1", "([J)[J"}, + {"MlP2", "([[J)[[J"}, + {"MX", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;[[Ljava/lang/Object;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;"}, + {"MX1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;"}, + {"MX2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;"}, + {"MO", "(Ljava/lang/Object;[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Class;)Ljava/lang/Object;"}, + {"MO1", "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"}, + {"MO2", "([[Ljava/lang/Object;[Ljava/lang/Object;)[[Ljava/lang/Object;"}, + {"MLF", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLF1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLF2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLN", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLN1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLN2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLS", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLS1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLS2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLI", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLI1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLI2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLY", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLY1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLY2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLU", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLU1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLU2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLR", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLR1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLR2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"MLP", "(Ljava/lang/Long;)Ljava/lang/Long;"}, + {"MLP1", "([Ljava/lang/Long;)[Ljava/lang/Long;"}, + {"MLP2", "([[Ljava/lang/Long;)[[Ljava/lang/Long;"}, + {"ME", "(IJLnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"ME1", "([I[Ljava/lang/Long;[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"ME2", "([[I[[Ljava/lang/Long;[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEF", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEF1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEF2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEN", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEN1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEN2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MES", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"ME1S", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"ME2S", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEI", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEI1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEI2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEY", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEY1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEY2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEU", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEU1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEU2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MER", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MER1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MER2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEP", "(Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEP1", "([Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + {"MEP2", "([[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;)[[Lnsk/jdi/TypeComponent/signature/sign002aClassToCheck$Inter;"}, + }; + + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.signature."; + private final static String className = "sign002"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "sign002aClassToCheck"; + + 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 = new IOPipe(debugee); + 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; + } + + // Check all methods from debugee + for (int i = 0; i < TOTAL_METHODS; i++) { + Method method; + List listOfMethods; + int totalMethodsByName; + String signature; + String realSign; + + try { + listOfMethods = refType.methodsByName(METHOD_NAME[i][0]); + } catch (Exception e) { + log.complain("debuger FAILURE 1> Can't get method by name " + + METHOD_NAME[i][0]); + log.complain("debuger FAILURE 1> Exception: " + e); + testFailed = true; + continue; + } + totalMethodsByName = listOfMethods.size(); + if (totalMethodsByName != 1) { + log.complain("debuger FAILURE 2> Number of methods by name " + + METHOD_NAME[i][0] + " is " + totalMethodsByName + + ", should be 1."); + testFailed = true; + continue; + } + method = (Method)listOfMethods.get(0); + signature = method.signature(); + realSign = METHOD_NAME[i][1]; + log.display("debuger> " + i + " method (" + METHOD_NAME[i][0] + + ") with signature " + signature + " read."); + if (!realSign.equals(signature)) { + log.complain("debuger FAILURE 3> Returned signature for method " + + " (" + METHOD_NAME[i][0] + ") is " + signature + + " expected " + realSign); + testFailed = true; + continue; + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002/TestDescription.java new file mode 100644 index 00000000000..91247df05cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/TypeComponent/signature/sign002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the signature() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public java.lang.String signature() + * Gets the JNI-style signature for this type component. The signature is + * encoded type information as defined in the JNI documentation. It is a + * convenient, compact format for for manipulating type information + * internally, not necessarily for display to an end user. See + * Field.typeName() and Method.returnTypeName() for ways to help get a more + * readable representation of the type. + * Returns: a string containing the signature + * See Also: Type Signatures + * nsk/jdi/TypeComponent/signature/signature002 checks assertion: + * public java.lang.String signature() + * 1. Gets the JNI-style signature for a method. + * Debugger gets each method from debuggee calling by name and then checks + * if signature() returns the expected value for the method. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.signature.sign002 + * nsk.jdi.TypeComponent.signature.sign002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.signature.sign002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002a.java new file mode 100644 index 00000000000..eebb277a96c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign002a.java @@ -0,0 +1,178 @@ +/* + * 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.TypeComponent.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class sign002a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + sign002aClassToCheck classToCheck = new sign002aClassToCheck(); + + 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 sign002aClassToCheck { + // User class and interface + class Class {} + interface Inter {} + + void Mv() {}; + boolean Mz (boolean z, short r2[][]) { return z; }; + boolean[] Mz1(boolean z1[], boolean z) { return z1; }; + boolean[][] Mz2(boolean z2[][], boolean z1[]) { return z2; }; + byte Mb (byte b, boolean z2[][]) { return b; }; + byte[] Mb1(byte b1[], byte b) { return b1; }; + byte[][] Mb2(byte b2[][], byte b1[]) { return b2; }; + char Mc (char c, byte b2[][]) { return c; }; + char[] Mc1(char c1[], char c) { return c1; }; + char[][] Mc2(char c2[][], char c1[]) { return c2; }; + double Md (double d, char c2[][]) { return d; }; + double[] Md1(double d1[], double d) { return d1; }; + double[][] Md2(double d2[][], double d1[]) { return d2; }; + float Mf (float f, double d2[][]) { return f; }; + float[] Mf1(float f1[], float f) { return f1; }; + float[][] Mf2(float f2[][], float f1[]) { return f2; }; + int Mi (int i, float f2[][]) { return i; }; + int[] Mi1(int i1[], int i) { return i1; }; + int[][] Mi2(int i2[][], int i1[]) { return i2; }; + long Ml (long l, int i2[][]) { return l; }; + long[] Ml1(long l1[], long l) { return l1; }; + long[][] Ml2(long l2[][], long l1[]) { return l2; }; + short Mr (short r, long l2[][]) { return r; }; + short[] Mr1(short r1[], short r) { return r1; }; + short[][] Mr2(short r2[][], short r1[]) { return r2; }; + + final void MvF() {}; + final long MlF(long l) { return l; }; + final long[] MlF1(long l[]) { return l; }; + final long[][] MlF2(long l[][]) { return l; }; + native void MvN(); + native long MlN(long l); + native long[] MlN1(long l[]); + native long[][] MlN2(long l[][]); + static void MvS() {}; + static long MlS(long l) { return l; }; + static long[] MlS1(long l[]) { return l; }; + static long[][] MlS2(long l[][]) { return l; }; + strictfp void MvI() {}; + strictfp long MlI(long l) { return l; }; + strictfp long[] MlI1(long l[]) { return l; }; + strictfp long[][] MlI2(long l[][]) { return l; }; + synchronized void MvY() {}; + synchronized long MlY(long l) { return l; }; + synchronized long[] MlY1(long l[]) { return l; }; + synchronized long[][] MlY2(long l[][]) { return l; }; + public void MvU() {}; + public long MlU(long l) { return l; }; + public long[] MlU1(long l[]) { return l; }; + public long[][] MlU2(long l[][]) { return l; }; + protected void MvR() {}; + protected long MlR(long l) { return l; }; + protected long[] MlR1(long l[]) { return l; }; + protected long[][] MlR2(long l[][]) { return l; }; + private void MvP() {}; + private long MlP(long l) { return l; }; + private long[] MlP1(long l[]) { return l; }; + private long[][] MlP2(long l[][]) { return l; }; + + Class MX (Class X, Object[][] O2) { return X; }; + Class[] MX1(Class X1[], Class X) { return X1; }; + Class[][] MX2(Class X2[][], Class X1[]) { return X2; }; + Object MO (Object O, Class X2[][]) { return O; }; + Object[] MO1(Object[] O1, Object O) { return O1; }; + Object[][] MO2(Object[][] O2, Object[] O1) { return O2; }; + + final Long MLF(Long L) { return L; }; + final Long[] MLF1(Long[] L) { return L; }; + final Long[][] MLF2(Long[][] L) { return L; }; + native Long MLN(Long L); + native Long[] MLN1(Long L[]); + native Long[][] MLN2(Long L[][]); + static Long MLS(Long L) { return L; }; + static Long[] MLS1(Long L[]) { return L; }; + static Long[][] MLS2(Long L[][]) { return L; }; + strictfp Long MLI(Long L) { return L; }; + strictfp Long[] MLI1(Long L[]) { return L; }; + strictfp Long[][] MLI2(Long L[][]) { return L; }; + synchronized Long MLY(Long L) { return L; }; + synchronized Long[] MLY1(Long[] L) { return L; }; + synchronized Long[][] MLY2(Long[][] L) { return L; }; + public Long MLU(Long L) { return L; }; + public Long[] MLU1(Long[] L) { return L; }; + public Long[][] MLU2(Long[][] L) { return L; }; + protected Long MLR(Long L) { return L; }; + protected Long[] MLR1(Long[] L) { return L; }; + protected Long[][] MLR2(Long[][] L) { return L; }; + private Long MLP(Long L) { return L; }; + private Long[] MLP1(Long[] L) { return L; }; + private Long[][] MLP2(Long[][] L) { return L; }; + + Inter ME (int i, long l, Inter E) { return E; }; + Inter[] ME1(int i[], Long L[], Inter E1[]) { return E1; }; + Inter[][] ME2(int i[][], Long L[][], Inter E2[][]) { return E2; }; + + final Inter MEF(Inter E) { return E; }; + final Inter[] MEF1(Inter[] E) { return E; }; + final Inter[][] MEF2(Inter[][] E) { return E; }; + native Inter MEN(Inter E); + native Inter[] MEN1(Inter[] E); + native Inter[][] MEN2(Inter[][] E); + static Inter MES(Inter E) { return E; }; + static Inter[] ME1S(Inter[] E) { return E; }; + static Inter[][] ME2S(Inter[][] E) { return E; }; + strictfp Inter MEI(Inter E) { return E; }; + strictfp Inter[] MEI1(Inter[] E) { return E; }; + strictfp Inter[][] MEI2(Inter[][] E) { return E; }; + synchronized Inter MEY(Inter E) { return E; }; + synchronized Inter[] MEY1(Inter[] E) { return E; }; + synchronized Inter[][] MEY2(Inter[][] E) { return E; }; + public Inter MEU(Inter E) { return E; }; + public Inter[] MEU1(Inter[] E) { return E; }; + public Inter[][] MEU2(Inter[][] E) { return E; }; + protected Inter MER(Inter E) { return E; }; + protected Inter[] MER1(Inter[] E) { return E; }; + protected Inter[][] MER2(Inter[][] E) { return E; }; + private Inter MEP(Inter E) { return E; }; + private Inter[] MEP1(Inter[] E) { return E; }; + private Inter[][] MEP2(Inter[][] E) { return E; }; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003.java new file mode 100644 index 00000000000..804e8ad6c23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003.java @@ -0,0 +1,183 @@ +/* + * 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.TypeComponent.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +public class sign003 { + final static String CONSTR_SIGN[] = { + "()V", + "(ID)V", "([I[D)V", "([[I[[D)V", + + "(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Object;)V", + "([Ljava/lang/Long;[Ljava/lang/String;[Ljava/lang/Object;)V", + "([[Ljava/lang/Long;[[Ljava/lang/String;[[Ljava/lang/Object;)V", + + "(J)V", "(Ljava/lang/Object;)V", "([J)V" + }; + private static Log log; + private final static String prefix = "nsk.jdi.TypeComponent.signature."; + private final static String className = "sign003"; + private final static String debugerName = prefix + className; + private final static String debugeeName = debugerName + "a"; + private final static String classToCheckName = prefix + "sign003aClassToCheck"; + + 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 = new IOPipe(debugee); + boolean testFailed = false; + List methods; + + // 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; + } + + // Get all methods, find constructors and static initializers and + // check them + try { + methods = refType.methods(); + } catch (Exception e) { + log.complain("debuger FAILURE> Can't get methods from class"); + log.complain("debuger FAILURE> Exception: " + e); + return 2; + } + int totalMethods = methods.size(); + if (totalMethods < 1) { + log.complain("debuger FAILURE> Total number of methods read " + + totalMethods); + return 2; + } + log.display("debuger> Total methods found: " + totalMethods); + Iterator methodsIterator = methods.iterator(); + for (int i = 0; methodsIterator.hasNext(); i++) { + Method method = (Method)methodsIterator.next(); + String decTypeName = method.declaringType().name(); + String name = method.name(); + String signature = method.signature(); + + if (method.isConstructor()) { + boolean signFound = false; + + log.display("debuger> " + i + " method (constructor) " + name + + " from " + decTypeName + " with signature " + + signature + " read."); + for (int j = 0; j < CONSTR_SIGN.length; j++) { + // If signature does not exist in list then failure + String realSign = CONSTR_SIGN[j]; + + if (realSign.equals(signature)) { + // Signature found - OK + signFound = true; + log.display("debuger> Signature " + signature + + " found in list - " + j + " element."); + break; + } + } + if (!signFound) { + log.complain("debuger FAILURE 1> Signature " + signature + + " not found in expected list."); + testFailed = true; + continue; + } + } else { + if (method.isStaticInitializer()) { + log.display("debuger> " + i + " method (static " + + "initializer) " + name + " from " + + decTypeName + " with signature " + signature + + " read."); + if (signature == null) { + log.complain("debuger FAILURE 2> Static initializer " + + "from " + decTypeName + " has signature " + + "null."); + testFailed = true; + continue; + } + if (signature.length() == 0) { + log.complain("debuger FAILURE 3> Static initializer " + + "from " + decTypeName + " has empty " + + "signature."); + testFailed = true; + continue; + } + } else { + log.display("debuger> " + i + " method " + name + " from " + + decTypeName + " passed."); + } + } + } + + 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; + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003/TestDescription.java new file mode 100644 index 00000000000..ec6713e3825 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003/TestDescription.java @@ -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/TypeComponent/signature/sign003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test checks the signature() method of TypeComponent interface of + * com.sun.jdi package. + * The method spec: + * public java.lang.String signature() + * Gets the JNI-style signature for this type component. The signature is + * encoded type information as defined in the JNI documentation. It is a + * convenient, compact format for for manipulating type information + * internally, not necessarily for display to an end user. See + * Field.typeName() and Method.returnTypeName() for ways to help get a more + * readable representation of the type. + * Returns: a string containing the signature + * See Also: Type Signatures + * nsk/jdi/TypeComponent/signature/signature003 checks assertions: + * public java.lang.String signature() + * 1. Gets the JNI-style signature for a constructor. + * 2. Returns not null and not empty string for a static initializer. + * Debugger gets all method from debuggee calling by name and then checks + * if signature() returns the expected value for the method. + * Debugger gets all methods from debuggee, if a method is constructor test + * checks that signature() returns expected value for the constructor. If a + * method is static initializer test checks that signature() returns not null + * and not empty string. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.TypeComponent.signature.sign003 + * nsk.jdi.TypeComponent.signature.sign003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.TypeComponent.signature.sign003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003a.java new file mode 100644 index 00000000000..a15bc8ce67c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/signature/sign003a.java @@ -0,0 +1,77 @@ +/* + * 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.TypeComponent.signature; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +public class sign003a { + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + sign003aClassToCheck classToCheck = new sign003aClassToCheck(); + + 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 sign003aClassToCheck { + sign003aClassToCheck() {}; + sign003aClassToCheck(int i, double d) {}; + sign003aClassToCheck(int[] i, double[] d) {}; + sign003aClassToCheck(int[][] i, double[][] d) {}; + sign003aClassToCheck(Long L, String S, Object O) {}; + sign003aClassToCheck(Long[] L, String[] S, Object[] O) {}; + sign003aClassToCheck(Long[][] L, String[][] S, Object[][] O) {}; + public sign003aClassToCheck(long l) {}; + private sign003aClassToCheck(Object obj) {}; + protected sign003aClassToCheck(long[] l) {}; + + static boolean sb; + static Object sO; + static float[] sf = new float[10]; + + static { sb = true; } + static { sO = new Object(); } + static { + for (int i = 0; i < 10; i++) { + sf[i] = (float)i; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001.java new file mode 100644 index 00000000000..e3d5b590092 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001.java @@ -0,0 +1,113 @@ +/* + * 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.VMCannotBeModifiedEx._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; + +import java.io.*; + +/** + * The test checks up com.sun.jdi.VMCannotBeModifiedException. + * It creates, throws, catches and inspects the exception using each + * of two public constructors. + */ + +public class canntbemod001 { + + private static int exitStatus; + private static Log log; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + canntbemod001 thisTest = new canntbemod001(); + + log = new Log(out, new ArgumentHandler(argv)); + + thisTest.execTest(); + + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + exitStatus = Consts.TEST_PASSED; + display("\nTEST BEGINS"); + display("==========="); + + boolean isThrown = false; + try { + throwException(); + } catch (VMCannotBeModifiedException e) { + isThrown = true; + display("VMCannnotBeModifiedException was caught: " + e); + } + if (!isThrown) { + exitStatus = Consts.TEST_FAILED; + complain("VMCannnotBeModifiedException was NOT thrown"); + } + + display(""); + isThrown = false; + try { + throwException("message"); + } catch (VMCannotBeModifiedException e) { + isThrown = true; + display("VMCannnotBeModifiedException was caught: " + e); + } + if (!isThrown) { + exitStatus = Consts.TEST_FAILED; + complain("VMCannnotBeModifiedException was NOT thrown"); + } + display("============="); + display("TEST FINISHES\n"); + } + + private void throwException() { + display("throwing VMCannotBeModifiedException()"); + throw new VMCannotBeModifiedException(); + } + + private void throwException(String msg) { + display("throwing VMCannotBeModifiedException(msg)"); + throw new VMCannotBeModifiedException(msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001/TestDescription.java new file mode 100644 index 00000000000..9b7496b84de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001/TestDescription.java @@ -0,0 +1,50 @@ +/* + * 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/VMCannotBeModifiedEx/_itself_/canntbemod001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.VMCannotBeModifiedException. + * It creates, throws, catches and inspects the exception using each + * of two public constructors. + * COMMENTS + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMCannotBeModifiedEx._itself_.canntbemod001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMCannotBeModifiedEx._itself_.canntbemod001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001.java new file mode 100644 index 00000000000..2409172f9aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001.java @@ -0,0 +1,195 @@ +/* + * 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.VMDeathEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class vmdeath001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String TEST_NAME = "nsk.jdi.VMDeathEvent._itself_.vmdeath001"; + static final String DEBUGEE_NAME = TEST_NAME + "a"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private boolean testFailed; + static private boolean eventReceived; + + static private boolean disconnectReceived; + static private boolean vmdeathIsPrior; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + + disconnectReceived = false; + vmdeathIsPrior = true; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + log.display("Resuming debuggee"); + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + command); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return vmdeath001.FAILED; + } + + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + isConnected: + while (true) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); +// log.display("Event received: " + event.toString()); + + if (event instanceof VMDeathEvent) { + log.display("VMDeathEvent received"); + VMDeathEvent castedEvent = (VMDeathEvent)event; + eventReceived = true; + + // try to check event references if not disconnected + try { + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 3: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + EventRequest request = castedEvent.request(); + if( request != null) { + log.complain("FAILURE 4: Non-null reference returned by Event.request(): " + request); + testFailed = false; + } + } catch (VMDisconnectedException e) { + log.display("Unable to check event references because of VM disconnection"); + } + + } else if (event instanceof VMDisconnectEvent) { + log.display("VMDisconnectEvent received"); + VMDisconnectEvent castedEvent = (VMDisconnectEvent)event; + + if (!eventReceived) { + vmdeathIsPrior = false; + } + disconnectReceived = true; + break isConnected; + } else if (event instanceof VMDeathEvent) { + eventReceived = true; + } + } + + // try to resume event set if not disconnected + try { + eventSet.resume(); + } catch (VMDisconnectedException e) { + log.display("Unable to resume event set because of VM disconnection"); + } + + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + log.display("Waiting for debuggee terminating"); + debuggee.waitFor(); + + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + if (!eventReceived) { + log.complain("FAILURE 1: VMDeathEvent is not received after target VM terminating"); + return vmdeath001.FAILED; + } else if (!vmdeathIsPrior) { + log.complain("FAILURE 2: VMDeathEvent is not received before VMDisconnectEvent"); + return vmdeath001.FAILED; + } + return vmdeath001.PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001/TestDescription.java new file mode 100644 index 00000000000..bbe3e6d20ce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/VMDeathEvent/_itself_/vmdeath001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.VMDeathEvent interface. + * The test checks the following assertions: + * - VMDeathEvent is received by debugger when target VM terminates, + * - VMDeathEvent is received without creating any EventRequest, + * - VMDeathEvent precedes VMDisconnectEvent. + * A debugger class - nsk.jdi.VMDeathEvent.thread.thread001 ; + * a debuggee class - nsk.jdi.VMDeathEvent.thread.thread001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger starts special thread for listening events + * delivered from debuggee. + * The debuggee waits for command from debugger and completes + * upon receiving it. + * The debugger switches to to listen the event during + * the time specified by parameter. + * If the debugger receives VMDeathEvent, it checks all assertions + * of the test. Since debugee may has been terminated this time, + * debugger carefully handles VMDisconnectedException. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - initial IOPipe synchronization is used before starting event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMDeathEvent._itself_.vmdeath001 + * nsk.jdi.VMDeathEvent._itself_.vmdeath001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMDeathEvent._itself_.vmdeath001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001a.java new file mode 100644 index 00000000000..82a3f1f605c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001a.java @@ -0,0 +1,58 @@ +/* + * 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.VMDeathEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +public class vmdeath001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + public static void main(String args[]) { + vmdeath001a _vmdeath001a = new vmdeath001a(); + System.exit(JCK_STATUS_BASE + _vmdeath001a.communication(args)); + } + + int communication( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + + command); + return FAILED; + } + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002.java new file mode 100644 index 00000000000..d23a86ee2a0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002.java @@ -0,0 +1,443 @@ +/* + * 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.VMDeathEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VMDeathEvent.
    + *
    + * The test checks that the interface
    + * com.sun.jdi.VMDeathEvent
    + * complies with its spec.
    + *
    + * The case to test includes receiving the VMDeathEvent
    + * as a response to VirtualMachine.exit(int);
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * Then to test the interface,
    + * the debugger invokes the method VirtualMachine.exit() and checks up
    + * on the event received in the response to.
    + *
    + */ + +public class vmdeath002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VMDeathEvent/_itself_/vmdeath002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new vmdeath002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VMDeathEvent._itself_.vmdeath002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + Event event = eventIterator.nextEvent(); + if ( !(event instanceof VMDeathEvent) ) { + testExitCode = FAILED; + log3("ERROR: last event is not the VMDeathEvent"); + + if (event instanceof VMDisconnectEvent) + log3(" event is the VMDisconnectEvent ????"); + else + log3(" event is NOT the VMDisconnectEvent ????!!!!!!!"); + return 2; + + } + return 0; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + //vm.eventRequestManager().createVMDeathRequest().enable(); + + log2("......vm.exit(PASS_BASE); :: VMDeathEvent is excpected"); + + //vm.exit(PASS_BASE); + break; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } + + //System.out.println("================getEventSet()"); + //for (Event e : eventSet) + //System.out.println("Event in queue: " + e.toString()); + +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002/TestDescription.java new file mode 100644 index 00000000000..2462ccca691 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002/TestDescription.java @@ -0,0 +1,93 @@ +/* + * 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/VMDeathEvent/_itself_/vmdeath002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VMDeathEvent. + * The test checks up that the intefrace com.sun.jdi.VMDeathEvent + * complies with its spec: + * public interface VMDeathEvent + * extends Event + * Notification of target VM termination. This event occurs + * if the target VM terminates before the VM disconnects (VMDisconnectEvent). + * Thus, this event will NOT occur if external forces terminate the connection + * (e.g. a crash) or if the + * connection is intentionally terminated with VirtualMachine.dispose() + * On VM termination, a single unsolicited VMDeathEvent will always be sent + * with a suspend policy of SUSPEND_NONE. + * Additional VMDeathEvents will be sent in the same event set if + * they are requested with a VMDeathRequest. + * The VM is still intact and can be queried at the point this event was initiated + * but immediately thereafter it is not considered intact and cannot be queried. + * Note: If the enclosing EventSet has a suspend policy other than + * SUSPEND_ALL the initiating point may be long past. + * All VMDeathEvents will be in a single EventSet, + * no other events will be in the event set. + * A resume must occur to continue execution + * after any event set which performs suspensions - + * in this case to allow proper shutdown. + * The test checks that + * this event occurs + * if the target VM terminates before the VM disconnects + * as result of calling VirtualMachine.exit(int). + * The test works as follows: + * The debugger program - nsk.jdi.VMDeathEvent._itself_.vmdeath002; + * the debuggee program - nsk.jdi.VMDeathEvent._itself_.vmdeath002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - waiting for VMStartEvent removed because it is handled now in + * binder.bindToDebugee() method + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMDeathEvent._itself_.vmdeath002 + * nsk.jdi.VMDeathEvent._itself_.vmdeath002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMDeathEvent._itself_.vmdeath002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002a.java new file mode 100644 index 00000000000..986574c5c88 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002a.java @@ -0,0 +1,113 @@ +/* + * 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.VMDeathEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the vmdeath002 JDI test. + */ + +public class vmdeath002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 0; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + //System.exit(exitCode + PASS_BASE); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + System.exit(exitCode + PASS_BASE); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003.java new file mode 100644 index 00000000000..c6fb72983ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003.java @@ -0,0 +1,441 @@ +/* + * 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. + */ +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! templete parameters !!!! + +// VMDeathEvent Interface Name VMDeathEvent +// _itself_ Method Name _itself_ +// vmdeath003 Test Name vmdeath003 +// ------------------------------------------------------ + +package nsk.jdi.VMDeathEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VMDeathEvent.
    + *
    + * The test checks that the interface
    + * com.sun.jdi.VMDeathEvent
    + * complies with its spec.
    + *
    + * The case to test includes receiving no VMDeathEvent
    + * as a response to VirtualMachine.dispose();
    + *
    + * The test works as follows.
    + *
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * Then to test the interface,
    + * the debugger invokes the method VirtualMachine.dispose() and
    + * checks up on the event received in the response to.
    + *
    + */ + +public class vmdeath003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VMDeathEvent/_itself_/vmdeath003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new vmdeath003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VMDeathEvent._itself_.vmdeath003a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : //log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); +// testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDisconnectEvent"); + getEventSet(); + Event newEvent = eventIterator.nextEvent(); + if (newEvent instanceof VMDeathEvent) { + testExitCode = FAILED; + log3("ERROR: last event is the VMDeathEvent"); + return 0; + } + if (newEvent instanceof VMDisconnectEvent) { + log2("......received : VMDisconnectEvent"); + return 2; + } + + throw new JDITestRuntimeException("** Unexpected event **"); + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......vm.dispose(); :: VMDeathEvent is NOT excpected"); + + vm.dispose(); + break; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003/TestDescription.java new file mode 100644 index 00000000000..44b81d9d111 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/VMDeathEvent/_itself_/vmdeath003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VMDeathEvent. + * The test checks up that the intefrace com.sun.jdi.VMDeathEvent + * complies with its spec: + * public interface VMDeathEvent + * extends Event + * Notification of target VM termination. This event occurs + * if the target VM terminates before the VM disconnects (VMDisconnectEvent). + * Thus, this event will NOT occur if external forces terminate the connection + * (e.g. a crash) or if the + * connection is intentionally terminated with VirtualMachine.dispose() + * On VM termination, a single unsolicited VMDeathEvent will always be sent + * with a suspend policy of SUSPEND_NONE. + * Additional VMDeathEvents will be sent in the same event set if + * they are requested with a VMDeathRequest. + * The VM is still intact and can be queried at the point this event was initiated + * but immediately thereafter it is not considered intact and cannot be queried. + * Note: If the enclosing EventSet has a suspend policy other than + * SUSPEND_ALL the initiating point may be long past. + * All VMDeathEvents will be in a single EventSet, + * no other events will be in the event set. + * A resume must occur to continue execution + * after any event set which performs suspensions - + * in this case to allow proper shutdown. + * The test checks that + * this event will NOT occur if + * the connection is intentionally terminated with VirtualMachine.dispose() + * The test works as follows: + * The debugger program - nsk.jdi.VMDeathEvent._itself_.vmdeath003; + * the debuggee program - nsk.jdi.VMDeathEvent._itself_.vmdeath003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * Test fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - waiting for VMStartEvent removed because it is handled now in + * binder.bindToDebugee() method + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMDeathEvent._itself_.vmdeath003 + * nsk.jdi.VMDeathEvent._itself_.vmdeath003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMDeathEvent._itself_.vmdeath003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003a.java new file mode 100644 index 00000000000..6a5c1212362 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003a.java @@ -0,0 +1,111 @@ +/* + * 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.VMDeathEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the vmdeath003 JDI test. + */ + +public class vmdeath003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001.java new file mode 100644 index 00000000000..e12ec008d92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001.java @@ -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.VMDisconnectEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger application in the test + +public class disconnect001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String TEST_NAME = "nsk.jdi.VMDisconnectEvent._itself_.disconnect001"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private boolean testFailed; + static private boolean eventReceived; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + Debugee debuggee; + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + command); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return disconnect001.FAILED; + } + + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + isConnected: + while (true) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); +// log.display("Event received: " + event.toString()); + + if (event instanceof VMDisconnectEvent) { + log.display("VMDisconnectEvent received"); + VMDisconnectEvent castedEvent = (VMDisconnectEvent)event; + + // try to check event references if not disconnected + try { + + EventRequest eventRequest = castedEvent.request(); + if (eventRequest != null) { + log.complain("FAILURE 1: eventRequest is not equal to null"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + } catch (VMDisconnectedException e) { + log.display("Unable to check event references because of VM disconnection"); + } + + eventReceived = true; + break isConnected; + } + } + + // try to resume event set if not disconnected + try { + eventSet.resume(); + } catch (VMDisconnectedException e) { + log.display("Unable to resume event set because of VM disconnection"); + } + + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + log.display("Waiting for debuggee terminating"); + debuggee.waitFor(); + + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + if (!eventReceived) { + log.complain("FAILURE 3: VMDisconnectEvent is not received after target VM terminating"); + return disconnect001.FAILED; + } + return disconnect001.PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001/TestDescription.java new file mode 100644 index 00000000000..987eab83954 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/VMDisconnectEvent/_itself_/disconnect001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.VMDisconnectEvent interface. + * The test checks the following assertions: + * - VMDisconnectEvent is received by debugger when target VM + * terminates before disconnection, + * - VMDeathEvent is received without creating any EventRequest. + * A debugger class - nsk.jdi.VMDisconnectEvent._itself_.disconnect001 ; + * a debuggee class - nsk.jdi.VMDisconnectEvent._itself_.disconnect001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger starts special thread for listening events + * delivered from debuggee. + * The debuggee waits for command from debugger and completes + * upon receiving. + * The debugger switches to to listen the event during + * the time specified by parameter. + * If the debugger receives VMDisconnectEvent, it checks all assertions + * of the test. Since debugee may been terminated this time, + * debugger carefully handles VMDisconnectedException. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - initial IOPipe synchronization is used before starting event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMDisconnectEvent._itself_.disconnect001 + * nsk.jdi.VMDisconnectEvent._itself_.disconnect001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMDisconnectEvent._itself_.disconnect001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001a.java new file mode 100644 index 00000000000..d2d71e108d1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001a.java @@ -0,0 +1,57 @@ +/* + * 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.VMDisconnectEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +public class disconnect001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + public static void main(String args[]) { + disconnect001a _disconnect001a = new disconnect001a(); + System.exit(JCK_STATUS_BASE + _disconnect001a.communication(args)); + } + + int communication( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002.java new file mode 100644 index 00000000000..195d54dde97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002.java @@ -0,0 +1,183 @@ +/* + * 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.VMDisconnectEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger application in the test + +public class disconnect002 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String TEST_NAME = "nsk.jdi.VMDisconnectEvent._itself_.disconnect002"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private boolean testFailed; + static private boolean eventReceived; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + Debugee debuggee; + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + command); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return disconnect002.FAILED; + } + + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + isConnected: + while (true) { + + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); +// log.display("Event received: " + event.toString()); + + if (event instanceof VMDisconnectEvent) { + log.display("VMDisconnectEvent received"); + VMDisconnectEvent castedEvent = (VMDisconnectEvent)event; + + // try to check event references if not disconnected + try { + + EventRequest eventRequest = castedEvent.request(); + if (eventRequest != null) { + log.complain("FAILURE 1: eventRequest is not equal to null"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + } catch (VMDisconnectedException e) { + log.display("Unable to check event references because of VM disconnection"); + } + + eventReceived = true; + break isConnected; + } + } + + // try to resume event set if not disconnected + try { + eventSet.resume(); + } catch (VMDisconnectedException e) { + log.display("Unable to resume event set because of VM disconnection"); + } + + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + log.display("Invoking VirtualMachine.dispose() for debuggee."); + vm.dispose(); + + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + log.display("Waiting for debuggee terminating"); + debuggee.waitFor(); + + if (!eventReceived) { + log.complain("FAILURE 3: VMDisconnectEvent is not received after target VM terminating"); + return disconnect002.FAILED; + } + + return disconnect002.PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002/TestDescription.java new file mode 100644 index 00000000000..1b1afceeb0d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002/TestDescription.java @@ -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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/VMDisconnectEvent/_itself_/disconnect002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.VMDisconnectEvent interface. + * The test checks the following assertion: + * - VMDisconnectEvent is received by debugger after invocation + * com.sun.jdi.VirtualMachine.dispose() method for target VM. + * - VMDeathEvent is received without creating any EventRequest. + * A debugger class - nsk.jdi.VMDisconnectEvent._itself_.disconnect002 ; + * a debuggee class - nsk.jdi.VMDisconnectEvent._itself_.disconnect002a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger starts special thread for listening events + * delivered from debuggee. + * Then the debugger invokes VirtualMachine.dispose() method. + * The debugger switches to to listen the event during + * the time specified by parameter. + * If the debugger receives VMDisconnectEvent, it checks all assertions + * of the test. Since debugee may been terminated this time, + * debugger carefully handles VMDisconnectedException. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - initial IOPipe synchronization is used before starting event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMDisconnectEvent._itself_.disconnect002 + * nsk.jdi.VMDisconnectEvent._itself_.disconnect002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMDisconnectEvent._itself_.disconnect002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002a.java new file mode 100644 index 00000000000..98d016381e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002a.java @@ -0,0 +1,58 @@ +/* + * 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.VMDisconnectEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +public class disconnect002a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + public static void main(String args[]) { + disconnect002a _disconnect002a = new disconnect002a(); + System.exit(JCK_STATUS_BASE + _disconnect002a.communication(args)); + } + + int communication( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + + command); + return FAILED; + } + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003.java new file mode 100644 index 00000000000..f4e120bf250 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003.java @@ -0,0 +1,179 @@ +/* + * 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.VMDisconnectEvent._itself_; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger application in the test + +public class disconnect003 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String TEST_NAME = "nsk.jdi.VMDisconnectEvent._itself_.disconnect003"; + static final String DEBUGGEE_NAME = TEST_NAME + "a"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private boolean testFailed; + static private boolean eventReceived; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + Debugee debuggee; + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + debuggee.resume(); + + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + log.complain("TEST BUG: unknown debuggee's command: " + command); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return disconnect003.FAILED; + } + + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + isConnected: + while (true) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); +// log.display("Event received: " + event.toString()); + + if (event instanceof VMDisconnectEvent) { + log.display("VMDisconnectEvent received"); + VMDisconnectEvent castedEvent = (VMDisconnectEvent)event; + + // try to check event references if not disconnected + try { + + EventRequest eventRequest = castedEvent.request(); + if (eventRequest != null) { + log.complain("FAILURE 1: eventRequest is not equal to null"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + } catch (VMDisconnectedException e) { + log.display("Unable to check event references because of VM disconnection"); + } + + eventReceived = true; + break isConnected; + } + } + + // try to resume event set if not disconnected + try { + eventSet.resume(); + } catch (VMDisconnectedException e) { + log.display("Unable to resume event set because of VM disconnection"); + } + + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught VMInterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + log.display("Invoking VirtualMachine.exit(int) for debuggee."); + vm.exit(disconnect003.PASSED); + + log.display("Waiting for debuggee terminating"); + debuggee.waitFor(); + + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + if (!eventReceived) { + log.complain("FAILURE 3: VMDisconnectEvent is not received after target VM terminating"); + return disconnect003.FAILED; + } + + return disconnect003.PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003/TestDescription.java new file mode 100644 index 00000000000..17cc6b003ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003/TestDescription.java @@ -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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/VMDisconnectEvent/_itself_/disconnect003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises com.sun.jdi.event.VMDisconnectEvent interface. + * The test checks the following assertion: + * - VMDisconnectEvent is received by debugger after invocation + * com.sun.jdi.VirtualMachine.exit(int) method for target VM. + * - VMDeathEvent is received without creating any EventRequest. + * A debugger class - nsk.jdi.VMDisconnectEvent._itself_.disconnect003 ; + * a debuggee class - nsk.jdi.VMDisconnectEvent._itself_.disconnect003a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger starts special thread for listening events + * delivered from debuggee. + * Then the debugger invokes VirtualMachine.exit() method. + * The debugger switches to to listen the event during + * the time specified by parameter. + * If the debugger receives VMDisconnectEvent, it checks all assertions + * of the test. Since debugee may been terminated this time, + * debugger carefully handles VMDisconnectedException. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - initial IOPipe synchronization is used before starting event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMDisconnectEvent._itself_.disconnect003 + * nsk.jdi.VMDisconnectEvent._itself_.disconnect003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMDisconnectEvent._itself_.disconnect003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003a.java new file mode 100644 index 00000000000..e7175a7295c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003a.java @@ -0,0 +1,52 @@ +/* + * 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.VMDisconnectEvent._itself_; + +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +public class disconnect003a { + static final String COMMAND_READY = "ready"; + + public static void main(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + pipe.println(COMMAND_READY); + + /* + * In this test debugger kills debuggee using VirtualMachine.exit, so + * standard JDI tests communication protocol isn't used here + */ + try { + Thread.sleep(Long.MAX_VALUE); + } catch (Throwable t) { + // ignore all exceptions + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java new file mode 100644 index 00000000000..77dd0f5afaa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2007, 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/VMOutOfMemoryException/VMOutOfMemoryException001. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * Test provokes 'VMOutOfMemoryException'. + * Test scenario: + * Debugger obtains 'ArrayType' instance for int array and in endless loop instantiates arrays + * in debuggee VM through 'ArrayType.newInstance()' till VMOutOfMemoryException. Any other exception + * thrown by 'ArrayType.newInstance()' is treated as product bug. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMOutOfMemoryException.VMOutOfMemoryException001.VMOutOfMemoryException001 + * nsk.jdi.VMOutOfMemoryException.VMOutOfMemoryException001.VMOutOfMemoryException001t + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMOutOfMemoryException.VMOutOfMemoryException001.VMOutOfMemoryException001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.VMOutOfMemoryException.VMOutOfMemoryException001; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.*; + +public class VMOutOfMemoryException001 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new VMOutOfMemoryException001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return VMOutOfMemoryException001t.class.getName(); + } + + public void doTest() { + ArrayType referenceType = (ArrayType) debuggee.classByName("int[]"); + + try { + List objects = new ArrayList(); + + // create array in debuggee VM till VMOutOfMemoryException + while (true) { + ArrayReference array = referenceType.newInstance(100000); + array.disableCollection(); + objects.add(array); + } + } catch (VMOutOfMemoryException e) { + // expected exception + log.display("Got expected exception: " + e.toString()); + } catch (Throwable t) { + setSuccess(false); + log.complain("Unexpected exception(VMOutOfMemoryException was expected): " + t); + t.printStackTrace(log.getOutStream()); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java new file mode 100644 index 00000000000..6b41e8f790e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2014, 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.VMOutOfMemoryException.VMOutOfMemoryException001; + +import nsk.share.Consts; +import nsk.share.jdi.AbstractJDIDebuggee; + +/* + * This test verifies that a VMOutOfMemoryException is thrown when the debugge runs out of memory. + * The debugger will allocate memory in this debugge until it gets a VMOutOfMemoryException. + * This means that we are likely to get an OutOfMemoryError during the test. + * Any OutOfMemoryErrors is just ignored, since they are expected. + */ +public class VMOutOfMemoryException001t extends AbstractJDIDebuggee { + + public static void main(String args[]) { + new VMOutOfMemoryException001t().doTest(args); + } + + // Just call normal doTest() function, but hide any OutOfMemoryErrors. + public void doTest() { + boolean isOutOfMemory = false; + + try { + super.doTest(); + } catch (OutOfMemoryError e) { + // Don't log anything. We are out of memory. + // A println is likely to genereate a new OutOfMemoryError + isOutOfMemory = true; + } + + // Normally the super class handles the return value. + // If we got here after an OutOfMemoryError, we consider the test passed. + if (isOutOfMemory && callExit) { + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_PASSED); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001.java new file mode 100644 index 00000000000..00abeadbe04 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001.java @@ -0,0 +1,197 @@ +/* + * 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.VMStartEvent.thread; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger application in the test + +public class thread001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + static final String DEBUGEE_NAME = "nsk.jdi.VMStartEvent.thread.thread001a"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private boolean testFailed; + static private boolean eventReceived; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run (final String args[], final PrintStream out) { + + testFailed = false; + eventReceived = false; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + // launch debuggee + Binder binder = new Binder(argHandler, log); + thread001.log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugeeNoWait(DEBUGEE_NAME); + debuggee.redirectStderr(thread001.log, "debuggee >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + while (!eventReceived) { + eventSet = vm.eventQueue().remove(); + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + Event event = eventIterator.nextEvent(); + log.display("Event received: " + event.toString()); + + // handle VMStartEvent + if (event instanceof VMStartEvent) { + VMStartEvent castedEvent = (VMStartEvent)event; + + EventRequest eventRequest = castedEvent.request(); + if (eventRequest != null) { + log.complain("FAILURE 1: eventRequest is not equal to null"); + testFailed = true; + } + VirtualMachine eventMachine = castedEvent.virtualMachine(); + if (!(vm.equals(eventMachine))) { + log.complain("FAILURE 2: eventVirtualMachine is not equal to checked vm"); + testFailed = true; + } + + ThreadReference eventThread = castedEvent.thread(); + if (eventThread == null) { + log.complain("FAILURE 3: ThreadStartEvent.thread() returns null"); + testFailed = true; + } + + String threadName = eventThread.name(); + if ((threadName == null) || (threadName.equals(""))) { + log.complain("FAILURE 4: thread reference has invalid empty name"); + testFailed = true; + } else { + log.display ("VMStartEvent was received in thread " + threadName); + } + + // Check that thread is in VirtualMachine.allThreads() list + boolean found = false; + Iterator threadsList = debuggee.VM().allThreads().iterator(); + while (!found && threadsList.hasNext()) { + found = eventThread.equals((ThreadReference)threadsList.next()); + } + if (!found) { + log.complain("FAILURE 5: " + threadName + " is not in debuggee's allThreads() list"); + testFailed = true; + } + + eventReceived = true; + } + } + // resume each handled event set + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // wait for debuggee started + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + log.complain("Unknown command from debuggee :" + command); + testFailed = true; + } + + // wait for all expected events received + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // force debuggee to exit + thread001.log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee terminated + thread001.log.display("Waiting for debuggee terminating"); + debuggee.endDebugee(); + + // check test results + if (!eventReceived) { + thread001.log.complain("FAILURE 6: VMStartEvent is not received"); + testFailed = true; + } + + if (testFailed) { + return thread001.FAILED; + } + return thread001.PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001/TestDescription.java new file mode 100644 index 00000000000..28b0b7ca13b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001/TestDescription.java @@ -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/VMStartEvent/thread/thread001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * The test exercises + * com.sun.jdi.event.VMStartEvent.thread() method. + * The test checks the following assertions: + * - VMStartEvent is received without creating any EventRequest, + * - VMStarEvent.thread() returns valid ThreadReference + * to the thread in target VM, + * A debugger class - nsk.jdi.VMStartEvent.thread.thread001 ; + * a debuggee class - nsk.jdi.VMStartEvent.thread.thread001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger starts special thread for listening events + * delivered from debuggee. + * The debugger resumes debuggee and waits for command . + * Upon starting debuggee sends command and waits for command + * from debugger and completes upon receiving. + * The debugger switches to listen the event during + * the time specified by parameter. + * If the debugger receives VMStartEvent, it checks all assertions + * of the test. + * The test fails if any of the checks failed. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Test updated to prevent possible VMDisconnectedException on VMDeathEvent: + * - standard method Debugee.endDebugee() is used instead of cleaning event queue + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VMStartEvent.thread.thread001 + * nsk.jdi.VMStartEvent.thread.thread001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VMStartEvent.thread.thread001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001a.java new file mode 100644 index 00000000000..594ddc58f71 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMStartEvent/thread/thread001a.java @@ -0,0 +1,61 @@ +/* + * 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.VMStartEvent.thread; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class thread001a { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + + public static void main(String args[]) { + thread001a _thread001a = new thread001a(); + System.exit(JCK_STATUS_BASE + _thread001a.communication(args)); + } + + int communication( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // notify debbugger that debuggee started + pipe.println(COMMAND_READY); + + // wait from debugger command QUIT + String command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: Debugee: unknown command: " + + command); + return FAILED; + } + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java new file mode 100644 index 00000000000..10b56b0b9bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java @@ -0,0 +1,706 @@ +/* + * 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.Value._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * Value.
    + *
    + * The test checks up that a Value object, mirroring neither
    + * a primitive type value nor a void, is casted to both
    + * ObjectReference and a corresponding object reference;
    + * the tested are ArrayReference, ClassObjectReference,
    + * StringReference, ThreadReference, and ThreadGroupReference.
    + *
    + * The test contains two test cases with different ways to get
    + * a tested Value object:
    + * Value = ReferenceType.getValue(Field);
    + * tested types are all of five mentioned above
    + * Value = StackFrame.getValue(LocalVariable);
    + * tested types are String, Array, and ClassObject only
    + */ + +public class value001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Value/_itself_/value001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new value001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Value._itself_.value001a"; + + private String testedClassName = + "nsk.jdi.Value._itself_.Threadvalue001a"; + + //String mName = "nsk.jdi.Value._itself_"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("===> test case : Value = ReferenceType.getValue(Field);"); + + String stringObjName = "str"; + String arrayObjName = "bArray"; + String threadObjName = "thread2"; + String threadgroupObjName = "threadGroupObj"; + String classObj1Name = "classObj1"; + String classObj2Name = "classObj2"; + + ObjectReference stringObjRef = null; + ObjectReference arrayObjRef = null; + ObjectReference threadObjRef = null; + ObjectReference threadgroupObjRef = null; + ObjectReference classObj1Ref = null; + ObjectReference classObj2Ref = null; + + ReferenceType debuggeeClass = null; + + Value val = null; + + + List classes = null; + + classes = vm.classesByName(debuggeeName); + debuggeeClass = (ReferenceType) classes.get(0); + + + log2("......check for a mirror of String object"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(stringObjName)); + try { + log2(" cast from Value to String"); + StringReference sRef = (StringReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + stringObjRef = (ObjectReference) val; + log2(" cast from ObjectReference to String"); + StringReference sRef = (StringReference) stringObjRef; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + + log2("......check for a mirror of Array object"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(arrayObjName)); + try { + log2(" cast from Value to ArrayReference"); + ArrayReference aRef = (ArrayReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + arrayObjRef = (ObjectReference) val; + log2(" cast from ObjectReference to ArrayReference"); + ArrayReference aRef = (ArrayReference) arrayObjRef; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + + log2("......check for a mirror of Thread object"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(threadObjName)); + try { + log2(" cast from Value to ThreadReference"); + ThreadReference tRef = (ThreadReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + threadObjRef = (ObjectReference) val; + log2(" cast from ObjectReference to ThreadReference"); + ThreadReference tRef = (ThreadReference) threadObjRef; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + + log2("......check for a mirror of ThreadGroup object"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(threadgroupObjName)); + try { + log2(" cast from Value to ThreadGroupReference"); + ThreadGroupReference gRef = (ThreadGroupReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + threadgroupObjRef = (ObjectReference) val; + log2(" cast from ObjectReference to ThreadGroupReference"); + ThreadGroupReference gRef = (ThreadGroupReference) threadgroupObjRef; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + + log2("......check for a mirror of Class object"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(classObj1Name)); + try { + log2(" cast from Value to ClassObjectReference"); + ClassObjectReference c1Ref = (ClassObjectReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + classObj1Ref = (ObjectReference) val; + log2(" cast from ObjectReference to ClassObjectReference"); + ClassObjectReference c1Ref = (ClassObjectReference) classObj1Ref; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + + log2("......check for a mirror of Class object"); + val = debuggeeClass.getValue(debuggeeClass.fieldByName(classObj2Name)); + try { + log2(" cast from Value to ClassObjectReference"); + ClassObjectReference c2Ref = (ClassObjectReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + classObj2Ref = (ObjectReference) val; + log2(" cast from ObjectReference to ClassObjectReference"); + ClassObjectReference c2Ref = (ClassObjectReference) classObj2Ref; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + + log2("===> test case : Value = StackFrame.getValue(LocalVariable);"); + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "Thread2"; + + String breakpointMethod1 = "run"; + String bpLine1 = "breakpointLineNumber1"; + BreakpointRequest breakpRequest1 = null; + + StackFrame stackFrame = null; + + List allThreads = null; + ListIterator listIterator = null; + + + int expresult = returnCode0; + + label0: { + + log2("getting ThreadReference object"); + + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up a breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + + log2(" getting thread2's StackFrame"); + try { + stackFrame = thread2.frame(0); + } catch ( Exception e ) { + log3("ERROR: Exception for stackFrame = thread2.frame(0) :" + e); + testExitCode = FAILED; + break label1; + } + + String stringObj2Name = "str2"; + String arrayObj2Name = "bArray2"; + String classObj3Name = "classObj3"; + + log2("......check for a mirror of String object"); + try { + val = stackFrame.getValue(stackFrame.visibleVariableByName(stringObj2Name)); + + try { + log2(" cast from Value to String"); + StringReference sRef = (StringReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + stringObjRef = (ObjectReference) val; + log2(" cast from ObjectReference to String"); + StringReference sRef = (StringReference) stringObjRef; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for: stackFrame.getValue()"); + expresult = returnCode1; + } + + log2("......check for a mirror of Array object"); + try { + val = stackFrame.getValue(stackFrame.visibleVariableByName(arrayObj2Name)); + try { + log2(" cast from Value to ArrayReference"); + ArrayReference aRef = (ArrayReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + arrayObjRef = (ObjectReference) val; + log2(" cast from ObjectReference to ArrayReference"); + ArrayReference aRef = (ArrayReference) arrayObjRef; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for: stackFrame.getValue()"); + expresult = returnCode1; + } + + log2("......check for a mirror of Class object"); + try { + val = stackFrame.getValue(stackFrame.visibleVariableByName(classObj3Name)); + try { + log2(" cast from Value to ClassObjectReference"); + ClassObjectReference c1Ref = (ClassObjectReference) val; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + try { + log2(" cast from Value to ObjectReference"); + classObj1Ref = (ObjectReference) val; + log2(" cast from ObjectReference to ClassObjectReference"); + ClassObjectReference c1Ref = (ClassObjectReference) classObj1Ref; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + } + + } catch ( AbsentInformationException e ) { + log3("ERROR: AbsentInformationException for: stackFrame.getValue()"); + expresult = returnCode1; + } + } + + thread2.resume(); + + if (expresult != returnCode0) + testExitCode = FAILED; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001/TestDescription.java new file mode 100644 index 00000000000..d9d34770505 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/Value/_itself_/value001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Value. + * The test checks up that a Value object, + * mirroring neither a primitive type value nor a void, + * is casted to both ObjectReference and a corresponding object reference; + * the tested are ArrayReference, ClassObjectReference, + * StringReference, ThreadReference, and ThreadGroupReference. + * The test works as follows: + * The debugger program - nsk.jdi.Value._itself_.value001; + * the debuggee program - nsk.jdi.Value._itself_.value001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.Value._itself_.value001 + * nsk.jdi.Value._itself_.value001a + * + * @comment make sure value001a is compiled with full debug info + * @clean nsk.jdi.Value._itself_.value001a + * @compile -g:lines,source,vars ../value001a.java + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Value._itself_.value001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001a.java new file mode 100644 index 00000000000..93e25042dd7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001a.java @@ -0,0 +1,217 @@ +/* + * 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.Value._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the value001 JDI test. + */ + +public class value001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static String str = "Hello, world!"; + + static boolean[][][][] bArray = + { { {{true, false}, {true, false}}, {{true, false}, {true, false}} }, + { {{true, false}, {true, false}}, {{true, false}, {true, false}} } }; + + + static String threadGroupName = "threadGroup"; + static ThreadGroup threadGroupObj = new ThreadGroup(threadGroupName); + static Threadvalue001a thread2 = null; + + static value001a classObj11 = new value001a(); + static final Class classObj1 = classObj11.getClass(); + + static TestClass classObj21 = new TestClass(); + static final Class classObj2 = classObj21.getClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Value.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Value.type()
    + * complies with its spec when a Value object represents
    + * an object of a primitive type.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee executes the following :
    + * static boolean bl = false;
    + * static byte bt = 0;
    + * static char ch = 0;
    + * static double db = 0.0d;
    + * static float fl = 0.0f;
    + * static int in = 0;
    + * static long ln = 0;
    + * static short sh = 0;
    + *
    + * for each of the above primitive type variables,
    + * a coresponding Type object is created in a debugger
    + * by the statement like the following :
    + *
    + * Type tbl = execClass.getValue(Field fsbl).type();
    + *
    + * the following pair of statements don't throw
    + * ClassCastExceptions:
    + *
    + * PrimitiveType prtbl = (PrimitiveType) tbl;
    + * BooleanType bl = (BooleanType) prtbl;
    + *
    + * PrimitiveType prtbt = (PrimitiveType) tbt;
    + * ByteType bt = (ByteType) prtbt;
    + * .
    + * .
    + * PrimitiveType prtsh = (PrimitiveType) tsh;
    + * ShortType sh = (ShortType) prtsh;
    + *
    + */ + +public class type001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Value/type/type001", + sHeader2 = "--> type001: ", + sHeader3 = "##> type001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new type001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Value.type.type001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("type001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfDebuggeeExecClasses = vm.classesByName(debuggeeName); + if (listOfDebuggeeExecClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfDebuggeeExecClasses.size() != 1"); + break ; + } + ReferenceType execClass = + (ReferenceType) listOfDebuggeeExecClasses.get(0); + + Field fsbl = execClass.fieldByName("bl"); + Field fsbt = execClass.fieldByName("bt"); + Field fsch = execClass.fieldByName("ch"); + Field fsdb = execClass.fieldByName("db"); + Field fsfl = execClass.fieldByName("fl"); + Field fsin = execClass.fieldByName("in"); + Field fsln = execClass.fieldByName("ln"); + Field fssh = execClass.fieldByName("sh"); + + int i2; + + for (i2 = 0; ; i2++) { + + int expresult = 0; + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // BooleanType + Type tbl = execClass.getValue(fsbl).type(); + PrimitiveType prtbl = null; + try { + prtbl = (PrimitiveType) tbl; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtbl = (PrimitiveType) tbl;"); + break ; + } + try { + BooleanType bl = (BooleanType) prtbl; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: BooleanType blt = (BooleanType) prtbl;"); + } + break; + + case 1: // ByteType + Type tbt = execClass.getValue(fsbt).type(); + PrimitiveType prtbt = null; + try { + prtbt = (PrimitiveType) tbt; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType ptbt = (PrimitiveType) tbt;"); + break ; + } + try { + ByteType bt = (ByteType) prtbt; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: ByteType bt = (ByteType) ptbt;"); + } + break; + + case 2: // CharType + Type tch = execClass.getValue(fsch).type(); + PrimitiveType prtch = null; + try { + prtch = (PrimitiveType) tch; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtch = (PrimitiveType) tch;"); + break ; + } + try { + CharType ch = (CharType) prtch; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: CharType ch = (CharType) prtch;"); + } + break; + + case 3: // DoubleType + Type tdb = execClass.getValue(fsdb).type(); + PrimitiveType prtdb = null; + try { + prtdb = (PrimitiveType) tdb; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtdb = (PrimitiveType) tdb;"); + break ; + } + try { + DoubleType db = (DoubleType) prtdb; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: DoubleType db = (DoubleType) prtdb;"); + } + break; + + case 4: // FloatType + Type tfl = execClass.getValue(fsfl).type(); + PrimitiveType prtfl = null; + try { + prtfl = (PrimitiveType) tfl; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtfl = (PrimitiveType) tfl;"); + break ; + } + try { + FloatType fl = (FloatType) prtfl; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: FloatType fl = (FloatType) prtfl;"); + } + break; + + case 5: // IntegerType + Type tin = execClass.getValue(fsin).type(); + PrimitiveType prtin = null; + try { + prtin = (PrimitiveType) tin; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtin = (PrimitiveType) tin;"); + break ; + } + try { + IntegerType in = (IntegerType) prtin; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: IntegerType in = (IntegerType) prtin;"); + } + break; + + case 6: // LongType + Type tln = execClass.getValue(fsln).type(); + PrimitiveType prtln = null; + try { + prtln = (PrimitiveType) tln; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtln = (PrimitiveType) tln;"); + break ; + } + try { + LongType ln = (LongType) prtln; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: LongType ln = (LongType) prtln;"); + } + break; + + case 7: // ShortType + Type tsh = execClass.getValue(fssh).type(); + PrimitiveType prtsh = null; + try { + prtsh = (PrimitiveType) tsh; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: PrimitiveType prtsh = (PrimitiveType) tsh;"); + break ; + } + try { + ShortType sh = (ShortType) prtsh; + } catch ( ClassCastException e ) { + expresult = 1; + log3("ERROR: ShortType sh = (ShortType) prtsh;"); + } + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type001/TestDescription.java new file mode 100644 index 00000000000..7d7a6fcce81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type001/TestDescription.java @@ -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/Value/type/type001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Value. + * The test checks up that a result of the method + * com.sun.jdi.Value() + * complies with its spec when Value objects represent + * objects of the PrimitiveType. + * Note: The spec is missed. + * The test works as follows: + * A debugger program - nsk.jdi.Value.type.type001; + * a debuggee program - nsk.jdi.Value.type.type001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Value.type.type001 + * nsk.jdi.Value.type.type001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Value.type.type001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type001a.java new file mode 100644 index 00000000000..6c71fbb5e21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type001a.java @@ -0,0 +1,122 @@ +/* + * 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.Value.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the type001 JDI test. + */ + +public class type001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> type001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> type001a: " + message); + } + + //====================================================== test program + + static boolean bl = false; + static byte bt = 0; + static char ch = 0; + static double db = 0.0d; + static float fl = 0.0f; + static int in = 0; + static long ln = 0; + static short sh = 0; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Value.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Value.type()
    + * complies with its spec when a Value object represents
    + * an object of a VoidType.
    + *
    + * The case for testing is as follows.
    + *
    + * When a gebuggee is suspended at a breakpoint set up
    + * by a debugger, the debugger invokes debuggee's method
    + * void vdValue1(); to get Value returnvdValue1
    + *
    + * Then it forms a Type object for returnvdValue1
    + * Type typevdValue = returnvdValue1.type();
    + * and performs the following cast:
    + * VoidType voidtypevdValue = (VoidType) typevdValue;
    + * which should not throw ClassCastException.
    + *
    + */ + +public class type002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Value/type/type002/type002", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new type002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Value.type.type002.type002a"; + + private String testedClassName = + "nsk.jdi.Value.type.type002.Threadtype002a"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + String threadName = "Thread2"; + + String breakpointMethod1 = "run"; + String bpLine1 = "breakpointLineNumber1"; + + BreakpointRequest breakpRequest1 = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting a breakpoint event"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + + Value returnvdValue1 = null; + + List invokeMethods = testedclass.methodsByName("vdValue1"); + Method invokeMethod = invokeMethods.get(0); + + List argumentList = Collections.emptyList(); + + try { + log2(" invoking type002a.vdValue1()"); + returnvdValue1 = thread2.invokeMethod(thread2, + invokeMethod, argumentList, 0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + log2(" resuming the thread2"); + eventSet.resume(); + + log2(" Type typevdValue = returnvdValue1.type();"); + Type typevdValue = returnvdValue1.type(); + + log2(" checking up cast"); + try { + log2(" VoidType voidtypevdValue = (VoidType) typevdValue; no Exception expected"); + VoidType voidtypevdValue = (VoidType) typevdValue; + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException"); + expresult = returnCode1; + break label1; + } + + } + + log2(" resuming the vm"); + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002a.java new file mode 100644 index 00000000000..434d759a528 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002a.java @@ -0,0 +1,189 @@ +/* + * 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.Value.type.type002; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the type002 JDI test. + */ + +public class type002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * Value.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.Value.type()
    + * complies with its spec when a Value object represents
    + * an object of a ReferenceType.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee created the following objects:
    + * static ClassForCheck_2 classObj =
    + * new ClassForCheck_2();
    + * static InterfaceForCheck ifaceObj = classObj;
    + * static ClassForCheck[] cfcObj =
    + * { new ClassForCheck(), new ClassForCheck() };
    + *
    + * for each of the above refrence type static fields,
    + * a coresponding Type object named
    + * classFieldType,
    + * ifaceFieldType, and
    + * arrayFieldType
    + * are created in a debugger, which then checks up that
    + * the following statements
    + * don't throw ClassCastExceptions:
    + * ClassType ct = (ClassType) classFieldType;
    + * ClassType ct = (ClassType) ifaceFieldType;
    + * ArrayType at = (ArrayType) arrayFieldType;
    + * whereas the statement
    + * InterfaceType it = (InterfaceType) ifaceFieldType;
    + * does throw the exception.
    + *
    + */ + +public class type003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/Value/type/type003", + sHeader2 = "--> type003: ", + sHeader3 = "##> type003: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new type003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.Value.type.type003a"; + + String mName = "nsk.jdi.Value.type"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("type003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listOfLoadedClasses = vm.classesByName(mName + ".TestClass"); + + if (listOfLoadedClasses.size() != 1) { + testExitCode = FAILED; + log3("ERROR: listOfLoadedClasses.size() != 1 " + + listOfLoadedClasses.size()); + break ; + } + + ReferenceType testedClass = (ReferenceType) listOfLoadedClasses.get(0); + + int i2; + int expresult = 0; + + for (i2 = 0; ; i2++) { + + log2("new check: #" + i2); + + switch (i2) { + + case 0: // ClassType + + String classFieldName = "classObj"; + Field classField = + testedClass.fieldByName(classFieldName); + + Value classFieldValue = testedClass.getValue(classField); + Type classFieldType = classFieldValue.type(); + + try { + ClassType ct = (ClassType) classFieldType; + log2(" : ClassType ct = (ClassType) classFieldType;"); + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassType ct = (ClassType) classFieldType;"); + } + + break; + + case 1: // InterfaceType + + String ifaceFieldName = "ifaceObj"; + Field ifaceField = + testedClass.fieldByName(ifaceFieldName); + + Value ifaceFieldValue = testedClass.getValue(ifaceField); + Type ifaceFieldType = ifaceFieldValue.type(); + + try { + InterfaceType it = (InterfaceType) ifaceFieldType; + testExitCode = FAILED; + log3("ERROR: InterfaceType it = (InterfaceType) ifaceFieldType;"); + } catch ( ClassCastException e ) { + log2(" : ClassCastException for: InterfaceType it = (InterfaceType) ifaceFieldType;"); + } + try { + ClassType ct = (ClassType) ifaceFieldType; + log2(" : ClassType ct = (ClassType) ifaceFieldType;"); + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ClassCastException for: ClassType ct = (ClassType) ifaceFieldType;"); + } + break; + + case 2: // ArrayType + + String arrayFieldName = "cfcObj"; + Field arrayField = + testedClass.fieldByName(arrayFieldName); + + Value arrayFieldValue = testedClass.getValue(arrayField); + Type arrayFieldType = arrayFieldValue.type(); + + try { + ArrayType at = (ArrayType) arrayFieldType; + log2(" : ArrayType at = (ArrayType) arrayFieldType;"); + } catch ( ClassCastException e ) { + testExitCode = FAILED; + log3("ERROR: ArrayType at = (ArrayType) arrayFieldType;"); + } + + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type003/TestDescription.java new file mode 100644 index 00000000000..968020de7e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type003/TestDescription.java @@ -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/Value/type/type003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * Value. + * The test checks up that a result of the method + * com.sun.jdi.Value() + * complies with its spec when Value objects represent + * objects of the ReferenceType. + * Note: The spec is missed. + * The test works as follows: + * A debugger program - nsk.jdi.Value.type.type003; + * a debuggee program - nsk.jdi.Value.type.type003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.Value.type.type003 + * nsk.jdi.Value.type.type003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.Value.type.type003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type003a.java new file mode 100644 index 00000000000..475e24e8560 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type003a.java @@ -0,0 +1,174 @@ +/* + * 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.Value.type; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the type003 JDI test. + */ + +public class type003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> type003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> type003a: " + message); + } + + //====================================================== test program + + static TestClass obj = new TestClass(); + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.allClasses()
    + * complies with its spec.
    + *
    + * The test check up that new class and interface types
    + * are in returned List only after corresponding objects
    + * have been created within the debuggee.
    + * The sequence of the cases for testing is as follows:
    + *
    + * Objects# == 0, Classes# == 0, Interfaces# == 0
    + * hence, the returned List must contain no mirrors of
    + * tested reference types;
    + * Objects# == 1, Classes# == 1, Interfaces# == 0
    + * the returned list must contain only one expected
    + * object mirroring a tested Class type;
    + * Objects# == 2, Classes# == 2, Interfaces# == 1
    + * the returned list must contain three expected objects
    + * mirroring two Class and one Interface types;
    + * Objects# == 3, Classes# == 2, Interfaces# == 1,
    + * the returned list must contain three expected objects
    + * mirroring two Class and one Interface types;
    + * repetirion of previous check after one more object
    + * has been created;
    + * Objects# == 4, Classes# == 3, Interfaces# == 1,
    + * the returned list must contain four expected objects
    + * mirroring three Class and one Interface types;
    + *
    + */ + +public class allclasses001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/allClasses/allclasses001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new allclasses001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return exitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.allClasses.allclasses001a"; + + private String namePrefix = + "nsk.jdi.VirtualMachine.allClasses."; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) ( + debuggeeClass.getValue( + debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String name[] = { "Class1ForCheck", + "Class2ForCheck", + "Class3ForCheck", + "InterfaceForCheck" }; + + + switch (i) { + + case 0: + log2("...... check case: Objects# ==0, Classes# ==0, Interfaces# ==0,"); + if (refTypeYes(name[0]) != 0) { + log3("ERROR: Class in the List: " + name[0]); + expresult = returnCode1; + } + if (refTypeYes(name[1]) != 0) { + log3("ERROR: Class in the List: " + name[1]); + expresult = returnCode1; + } + if (refTypeYes(name[2]) != 0) { + log3("ERROR: Class in the List: " + name[2]); + expresult = returnCode1; + } + if (refTypeYes(name[3]) != 0) { + log3("ERROR: Interface in the List: " + name[3]); + expresult = returnCode1; + } + break; + + + + case 1: + log2("...... check case: Objects# ==1, Classes# ==1, Interfaces# ==0,"); + if (refTypeYes(name[0]) == 0) { + log3("ERROR: Class not in the List: " + name[0]); + expresult = returnCode1; + } + if (refTypeYes(name[1]) != 0) { + log3("ERROR: Class in the List: " + name[1]); + expresult = returnCode1; + } + if (refTypeYes(name[2]) != 0) { + log3("ERROR: Class in the List: " + name[2]); + expresult = returnCode1; + } + if (refTypeYes(name[3]) != 0) { + log3("ERROR: Interface in the List: " + name[3]); + expresult = returnCode1; + } + break; + + + case 2: + log2("...... check case: Objects# ==2, Classes# ==2, Interfaces# ==1,"); + if (refTypeYes(name[0]) == 0) { + log3("ERROR: Class not in the List: " + name[0]); + expresult = returnCode1; + } + if (refTypeYes(name[1]) == 0) { + log3("ERROR: Class not in the List: " + name[1]); + expresult = returnCode1; + } + if (refTypeYes(name[2]) != 0) { + log3("ERROR: Class in the List: " + name[2]); + expresult = returnCode1; + } + if (refTypeYes(name[3]) == 0) { + log3("ERROR: Interface not in the List: " + name[3]); + expresult = returnCode1; + } + break; + + + case 3: + log2("...... check case: Objects# ==3, Classes# ==2, Interfaces# ==1,"); + if (refTypeYes(name[0]) == 0) { + log3("ERROR: Class not in the List: " + name[0]); + expresult = returnCode1; + } + if (refTypeYes(name[1]) == 0) { + log3("ERROR: Class not in the List: " + name[1]); + expresult = returnCode1; + } + if (refTypeYes(name[2]) != 0) { + log3("ERROR: Class in the List: " + name[2]); + expresult = returnCode1; + } + if (refTypeYes(name[3]) == 0) { + log3("ERROR: Interface not in the List: " + name[3]); + expresult = returnCode1; + } + break; + + + case 4: + log2("...... check case: Objects# ==4, Classes# ==3, Interfaces# ==1,"); + if (refTypeYes(name[0]) == 0) { + log3("ERROR: Class not in the List: " + name[0]); + expresult = returnCode1; + } + if (refTypeYes(name[1]) == 0) { + log3("ERROR: Class not in the List: " + name[1]); + expresult = returnCode1; + } + if (refTypeYes(name[2]) == 0) { + log3("ERROR: Class not in the List: " + name[2]); + expresult = returnCode1; + } + if (refTypeYes(name[3]) == 0) { + log3("ERROR: Interface not in the List: " + name[3]); + expresult = returnCode1; + } + break; + + + default: + break ; + } + + if (expresult != returnCode0) + testExitCode = FAILED; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException, Exception { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); +// breakpRequest = null; + throw e1; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); +// breakpRequest = null; + throw e2; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private int refTypeYes ( String name ) { + + List vmClasses = vm.allClasses(); + ListIterator li = vmClasses.listIterator(); + + for ( int i = 0; li.hasNext(); i++) { + ReferenceType obj = (ReferenceType) li.next(); + if ( obj.name().equals(namePrefix + name) ) + return 1; + } + return 0; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001/TestDescription.java new file mode 100644 index 00000000000..dc7818f8e92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001/TestDescription.java @@ -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/VirtualMachine/allClasses/allclasses001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.allClasses() + * complies with its spec: + * public java.util.List allClasses() + * Returns all loaded types. For each loaded type in the target VM + * a ReferenceType will be placed in the returned list. + * The list will include ReferenceTypes which mirror classes, interfaces, and + * array types. + * Returns: a list of ReferenceType objects, each mirroring a loaded type + * in the target VM. + * The case for testing includes only non-array Class and Interface types + * loaded within user's application, that is, + * any system Class and Interface are not taken into account. + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.allClasses.allclasses001; + * a debuggee program - nsk.jdi.VirtualMachine.allClasses.allclasses001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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: + * The test is modified to fix the bug 4482592: + * IOPipe is removed from the test. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.allClasses.allclasses001 + * nsk.jdi.VirtualMachine.allClasses.allclasses001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.allClasses.allclasses001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001a.java new file mode 100644 index 00000000000..0b407ae3de4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001a.java @@ -0,0 +1,262 @@ +/* + * 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.VirtualMachine.allClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debugee application for the allclasses001a JDI test. + + */ + +public class allclasses001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.out.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.out.println("!!**> debuggee: " + message); + } + + //====================================================== test program + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i maxInstr || instruction < 0) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: // Objects# =0;; Classes# =0; Interfaces# =0 + + methodForCommunication(); + break ; + + case 1: // Objects# =1; Classes# =1; Interfaces# =0; + + obj11 = new Class1ForCheck(); + methodForCommunication(); + break ; + + case 2: // Objects# =2; Classes# =2; Interfaces# =1; + + obj21 = new Class2ForCheck(); + methodForCommunication(); + break ; + + case 3: // Objects# =3; Classes# =2; Interfaces# =1; + + obj22 = new Class2ForCheck(); + methodForCommunication(); + break ; + + case 4: // Objects# =4; Classes# =3; Interfaces# =1; + + obj31 = new Class3ForCheck(); + methodForCommunication(); + break ; + + + //------------------------------------------------- standard end section + + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} + + +class Class1ForCheck { + + // static fields + + static boolean s_boolean; + static byte s_byte; + static char s_char; + static double s_double; + static float s_float; + static int s_int; + static long s_long; + static short s_short; + static Object s_object; + static long[] s_prim_array; + static Object[] s_ref_array; + + // instance fields + + boolean i_boolean; + byte i_byte; + char i_char; + double i_double; + float i_float; + int i_int; + long i_long; + short i_short; + Object i_object; + long[] i_prim_array; + Object[] i_ref_array; +} + + +interface InterfaceForCheck { + + static final boolean s_iface_boolean = true; + static final byte s_iface_byte = (byte)1; + static final char s_iface_char = '1'; + static final double s_iface_double = 999; + static final float s_iface_float = 99; + static final int s_iface_int = 100; + static final long s_iface_long = 1000; + static final short s_iface_short = 1000; + static final Object s_iface_object = new Object(); +} + + + +class Class2ForCheck implements InterfaceForCheck { + + // static fields + + static boolean s_boolean; + static byte s_byte; + static char s_char; + static double s_double; + static float s_float; + static int s_int; + static long s_long; + static short s_short; + static Object s_object; + static long[] s_prim_array; + static Object[] s_ref_array; + + // instance fields + + boolean i_boolean; + byte i_byte; + char i_char; + double i_double; + float i_float; + int i_int; + long i_long; + short i_short; + Object i_object; + long[] i_prim_array; + Object[] i_ref_array; +} + +class Class3ForCheck implements InterfaceForCheck { + + // static fields + + static boolean s_boolean; + static byte s_byte; + static char s_char; + static double s_double; + static float s_float; + static int s_int; + static long s_long; + static short s_short; + static Object s_object; + static long[] s_prim_array; + static Object[] s_ref_array; + + // instance fields + + boolean i_boolean; + byte i_byte; + char i_char; + double i_double; + float i_float; + int i_int; + long i_long; + short i_short; + Object i_object; + long[] i_prim_array; + Object[] i_ref_array; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002.java new file mode 100644 index 00000000000..f60e48535e6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002.java @@ -0,0 +1,251 @@ +/* + * 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.VirtualMachine.allClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.allClasses()
    + * complies with its spec.
    + * The test check up that class array type, interface array
    + * type, and all primitive array types are in a List returned
    + * by the method.
    + *
    + */ + +public class allclasses002 { + + //----------------------------------------------------- template section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- template parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/allClasses/allclasses002", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new allclasses002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.allClasses.allclasses002a"; + + private String namePrefix = + "nsk.jdi.VirtualMachine.allClasses."; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("allclasses002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log1(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String name[] = { "allclasses002aClassForCheck[]", + "allclasses002aInterfaceForCheck[]", + "boolean[][][][]", + "byte[][][][]", + "char[][][][]", + "double[][][][]", + "float[][][][]", + "int[][][][]", + "long[][][][]", + "short[][][][]" }; + + + log2(" check for loaded " + namePrefix + name[0] + " type"); + if (refTypeYes(namePrefix + name[0]) == 0) { + log3("ERROR: no " + namePrefix + name[0] + " type in the List"); + testExitCode = FAILED; + } + + log2(" check for loaded " + namePrefix + name[1] + " type"); + if (refTypeYes(namePrefix + name[1]) == 0) { + log3("ERROR: no " + namePrefix + name[1] + " type in the List"); + testExitCode = FAILED; + } + + for (int i1 = 2; i1 < 10; i1++) { + + log2("......check for loaded " + name[i1] + " type"); + if (refTypeYes(name[i1]) == 0) { + log3("ERROR: no " + name[i1] + " type in the List"); + testExitCode = FAILED; + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + int refTypeYes ( String name ) { + + int retCode = 0; + + List vmClasses = vm.allClasses(); + ListIterator li = vmClasses.listIterator(); + + log2("loaded '" + namePrefix + "' types:"); + for ( int i = 0; li.hasNext(); i++) { + ReferenceType obj = (ReferenceType) li.next(); + + if (obj.name().startsWith("nsk.jdi.VirtualMachine")) + log2(" " + i + " : " + obj.name() ); + + if (obj.name().endsWith("[][][][]")) + log2(" " + i + " : " + obj.name() ); + + if ( obj.name().equals(name) ) + retCode = 1; + } + return retCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002/TestDescription.java new file mode 100644 index 00000000000..0cc55159937 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002/TestDescription.java @@ -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/VirtualMachine/allClasses/allclasses002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.allClasses() + * complies with its spec: + * public java.util.List allClasses() + * Returns all loaded types. For each loaded type in the target VM + * a ReferenceType will be placed in the returned list. + * The list will include ReferenceTypes which mirror classes, interfaces, and + * array types. + * Returns: a list of ReferenceType objects, each mirroring a loaded type + * in the target VM. + * The case for testing includes only array Class and Interface types + * loaded within user's application, that is, + * system Class and Interface arrays are not taken into account. + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.allClasses.allclasses002; + * a debuggee program - nsk.jdi.VirtualMachine.allClasses.allclasses002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.allClasses.allclasses002 + * nsk.jdi.VirtualMachine.allClasses.allclasses002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.allClasses.allclasses002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002a.java new file mode 100644 index 00000000000..afab6c21958 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002a.java @@ -0,0 +1,175 @@ +/* + * 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.VirtualMachine.allClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debugee application for the allclasses002a JDI test. + + */ + +public class allclasses002a { + + //----------------------------------------------------- template section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + //====================================================== test program + + static final allclasses002aClassForCheck[] obj1 = { new allclasses002aClassForCheck(), + new allclasses002aClassForCheck() }; + + static final allclasses002aInterfaceForCheck[] ifaceObj = { new allclasses002aClass2ForCheck(), + new allclasses002aClass2ForCheck() }; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.allThreads()
    + * complies with the its spec.
    + *
    + * The test checks up the reasults of the method when
    + * it is invoked two times in raw immediately after
    + * new thread has been started in the debuggee VM.
    + *
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since the thread2 uses the same locking object as main one
    + * it is locked up until the main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * performs the following.
    + * - Upon the receiption of the message "checkready",
    + * the debugger invokes the method VirtualMachine.allThreads()
    + * two times in raw, compares two List objects returned,
    + * and prints out log containing numbers and names of threads
    + * in first returned list.
    + *
    + */ + +public class allthreads001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/allThreads/allthreads001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new allthreads001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.allThreads.allthreads001a"; + + private String testedClassName = + "nsk.jdi.StackFrame.setValue.Threadallthreads001a"; + + //String mName = "nsk.jdi.VirtualMachine.allThreads"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("location001a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List allThreads1 = vm.allThreads(); + log2("allThreads1.size() = " + allThreads1.size()); + + List allThreads2 = vm.allThreads(); + log2("allThreads2.size() = " + allThreads2.size()); + + if ( allThreads1.size() != allThreads2.size() ) { + log3("ERROR: allThreads1.size() != allThreads2.size()"); + expresult = returnCode1; + } + // Verify that the target thread is running: + boolean foundThread = false; + for (int ii = 0; ii < allThreads1.size(); ii++) { + if ((((ThreadReference) allThreads1.get(ii)).name().equals(threadName))) { + foundThread = true; + break; + } + } + if (!foundThread) { + log3("ERROR: did not find '" + threadName + "' on allThreads1 list."); + expresult = returnCode1; + } + + ThreadReference thread = null; + Object[] arrayT = allThreads1.toArray(); + + for (int iii=0; iii < allThreads1.size(); iii++) { + thread = (ThreadReference) arrayT[iii]; + log2("thread.name(" + iii + ") = " + thread.name()); + } + + log2(" forcing main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ +/* + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } +*/ + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ +/* + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } +*/ +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001/TestDescription.java new file mode 100644 index 00000000000..56dec01b96a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/VirtualMachine/allThreads/allthreads001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.allThreads() + * complies with its spec: + * public java.util.List allThreads() + * Returns a list of the currently running threads. + * For each running thread in the target VM, a ThreadReference + * that mirrors it is placed in the list. + * The returned list contains threads created through java.lang.Thread, + * all native threads attached to the target VM through JNI, and + * system threads created by the target VM. + * Thread objects that have not yet been started (see java.lang.Thread#start) + * and thread objects that have completed their execution are not + * included in the returned list. + * Returns: a list of ThreadReference objects, + * one for each running thread in the mirrored VM. + * The testing case is as follows: + * - new thread in a gebuggee is created, started, and waiting for + * entering a synchronized block. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.allThreads.allthreads001; + * the debuggee program - nsk.jdi.VirtualMachine.allThreads.allthreads001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.allThreads.allthreads001 + * nsk.jdi.VirtualMachine.allThreads.allthreads001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.allThreads.allthreads001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001a.java new file mode 100644 index 00000000000..c748c224067 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001a.java @@ -0,0 +1,192 @@ +/* + * 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.VirtualMachine.allThreads; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the allthreads001 JDI test. + */ + +public class allthreads001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canAddMethod()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class canaddmethod001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canaddmethod001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canAddMethod.canaddmethod001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canAddMethod()"); + if ( vm.canAddMethod() ) + log2(" vm.canAddMethod() == true"); + else + log2(" vm.canAddMethod() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001/TestDescription.java new file mode 100644 index 00000000000..8666ae15efc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001/TestDescription.java @@ -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/VirtualMachine/canAddMethod/canaddmethod001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canAddMethod() + * complies with its spec: + * public boolean canAddMethod() + * Determines if the target VM supports the addition of methods + * when performing class redefinition. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canAddMethod.canaddmethod001; + * the debuggee program - nsk.jdi.VirtualMachine.canAddMethod.canaddmethod001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VirtualMachine.canAddMethod.canaddmethod001 + * nsk.jdi.VirtualMachine.canAddMethod.canaddmethod001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canAddMethod.canaddmethod001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001a.java new file mode 100644 index 00000000000..2e37cbdf4fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canAddMethod; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canaddmethod001 JDI test. + */ + +public class canaddmethod001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001.java new file mode 100644 index 00000000000..9c731ebbc3e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001.java @@ -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.VirtualMachine.canBeModified; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; + +/** + * The test checks up com.sun.jdi.VirtualMachine.canBeModified() + * to return true unconditionally. + */ + +public class canbemodified001 { + + private final static String prefix = "nsk.jdi.VirtualMachine.canBeModified."; + private final static String debuggerName = prefix + "canbemodified001"; + public final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + canbemodified001 thisTest = new canbemodified001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectOutput(log); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + display("\nTEST BEGINS"); + display("==========="); + + boolean canBeModified = debugee.VM().canBeModified(); + if (canBeModified) { + display("target VM can be modified"); + exitStatus = Consts.TEST_PASSED; + } else { + complain("target VM can not be modified"); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001/TestDescription.java new file mode 100644 index 00000000000..00823f94175 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001/TestDescription.java @@ -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/VirtualMachine/canBeModified/canbemodified001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.VirtualMachine.canBeModified() + * to return true unconditionally. + * COMMENTS + * Current JDI implementation allows VM to be modified. + * Besides that read-only JDI implementation may be integrated + * into JDK. In this case the test should be reimplemented + * to be run against both implementations. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.canBeModified.canbemodified001 + * nsk.jdi.VirtualMachine.canBeModified.canbemodified001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canBeModified.canbemodified001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001a.java new file mode 100644 index 00000000000..39cdf7e3adb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001a.java @@ -0,0 +1,50 @@ +/* + * 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.VirtualMachine.canBeModified; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; +import java.net.*; + +/** + * canbemodified001a is deugee's part of the canbemodified001. + */ + +public class canbemodified001a { + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + + String oldClassDir = argv[0] + File.separator + "loadclass"; + + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java new file mode 100644 index 00000000000..28150c40e6c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java @@ -0,0 +1,248 @@ +/* + * 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.VirtualMachine.canGetBytecodes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canGetBytecodes()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * After being started up, a debuggee informs a debugger.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - gets the Method mtd object
    + * mirroring the method "testedMethod" in the debuggee,
    + * - calls to the method VirtualMachine.canGetBytecodes()
    + * to get its returned value.
    + * Then if the value is true the debugger checks up that invoking
    + * the method Method.bytecodes() on the mtd doesn't throw
    + * UnsupportedOperationException.
    + * If the value is false the debugger checks up that invoking
    + * the method Method.bytecodes() on the mtd does throw
    + * UnsupportedOperationException.
    + */ + +public class cangetbytecodes001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new cangetbytecodes001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canGetBytecodes.cangetbytecodes001a"; + + //String mName = "nsk.jdi.VirtualMachine.canGetBytecodes"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + Method mtd = null; + + label0: { + + log2("......getting Method mtd object"); + testedclass = (ReferenceType) vm.classesByName(debuggeeName).get(0); + mtd = (Method) testedclass.methodsByName("testedMethod").get(0); + + + if (vm.canGetBytecodes()) { + + log2("......vm.canGetBytecodes() == true"); + log2(" checking up on no UnsupportedOperationException trown"); + try { + mtd.bytecodes(); + log2(" no Exception thrown"); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: UnsupportedOperationException"); + expresult = returnCode1; + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + + } else { + + log2(".......vm.canGetBytecodes() == false"); + log2(" checking up on UnsupportedOperationException trown"); + try { + mtd.bytecodes(); + log3("ERROR: no UnsupportedOperationException thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException thrown"); + } catch ( Exception e2 ) { + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + expresult = returnCode1; + } + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001/TestDescription.java new file mode 100644 index 00000000000..bdd416dd5d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/canGetBytecodes/cangetbytecodes001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canGetBytecodes() + * complies with its spec: + * public boolean canGetBytecodes() + * Determines if this implementation supports the retrieval of + * a method's bytecodes. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canGetBytecodes.cangetbytecodes001; + * the debuggee program - nsk.jdi.VirtualMachine.canGetBytecodes.cangetbytecodes001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.canGetBytecodes.cangetbytecodes001 + * nsk.jdi.VirtualMachine.canGetBytecodes.cangetbytecodes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canGetBytecodes.cangetbytecodes001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001a.java new file mode 100644 index 00000000000..964e05c6205 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001a.java @@ -0,0 +1,117 @@ +/* + * 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.VirtualMachine.canGetBytecodes; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the cangetbytecodes001 JDI test. + */ + +public class cangetbytecodes001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> cangetbytecodes001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> cangetbytecodes001a: " + message); + } + + //====================================================== test program + + public static int testedMethod() { + return PASS_BASE; + } + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canGetCurrentContendedMonitor()
    + * complies with its spec.
    + *
    + * The case for testing includes two threads in a debuggee
    + * and their mirrors in a debugger.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs the debugger of the thread2 creation,
    + * and is waiting for reply.
    + * Since the thread2 use the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * suspends the 'main' thread and gets a boolean value returned by
    + * the method VirtualMachine.canGetCurrentContendedMonitor()
    + *
    + * Then if the value is true the debugger checks up that call to
    + * the method mainThread.currentContendedMonitor() doesn't throw
    + * UnsupportedOperationException.
    + * If the value is false the debugger checks up that call to the
    + * the method mainThread.currentContendedMonitor() does throw
    + * UnsupportedOperationException.
    + */ + +public class cangccm001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new cangccm001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor.cangccm001a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor.Threadcangccm001a"; + + //String mName = "nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List allThreads = null; + ObjectReference monitor = null; + ListIterator listIterator = null; + List classes = null; + + + label0: { + + log2("getting ThreadReference objects"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO 'main' thread ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + + label1: { + if (expresult != returnCode0) + break label1; + + + log2(" supending the main thread"); + mainThread.suspend(); + + if (vm.canGetCurrentContendedMonitor()) { + + log2(".......vm.canGetCurrentContendedMonitor() == true"); + log2(" checking up on no UnsupportedOperationException trown"); + try { + monitor = mainThread.currentContendedMonitor(); + log2(" no Exception thrown"); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: UnsupportedOperationException"); + expresult = returnCode1; + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + } else { + log2(".......vm.canGetCurrentContendedMonitor() == false"); + log2(" checking up on UnsupportedOperationException trown"); + try { + monitor = mainThread.currentContendedMonitor(); + log3("ERROR: no UnsupportedOperationException thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException thrown"); + } catch ( Exception e2 ) { + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + expresult = returnCode1; + } + } + log2(" resuming the main thread"); + mainThread.resume(); + } + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001/TestDescription.java new file mode 100644 index 00000000000..624faa42c6c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/canGetCurrentContendedMonitor/cangccm001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canGetCurrentContendedMonitor() + * complies with its spec: + * public boolean canGetCurrentContendedMonitor() + * Determines if the target VM supports the retrieval of the monitor for + * which a thread is currently waiting. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor.cangccm001; + * the debuggee program - nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor.cangccm001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.canGetCurrentContendedMonitor.cangccm001 + * nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor.cangccm001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canGetCurrentContendedMonitor.cangccm001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java new file mode 100644 index 00000000000..de29feb1a62 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java @@ -0,0 +1,193 @@ +/* + * 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.VirtualMachine.canGetCurrentContendedMonitor; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the cangccm001 JDI test. + */ + +public class cangccm001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + private static Threadcangccm001a thread2 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canGetMonitorInfo()
    + * complies with its spec.
    + *
    + * The case for testing includes two threads in a debuggee.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs the debugger of the thread2 creation,
    + * and is waiting for reply.
    + * Since the thread2 use the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - gets ThreadReference thread2 mirroring thread2 in the debuggee;
    + * - calls to the method VirtualMachine.canGetCurrentContendedMonitor()
    + * to detect whether debuggee's VM supports corresponding method.
    + * This is because the debugger needs to get a special object,
    + * ObjectReference monitor, mirroring a monitor in the debuggee
    + * on which debuggee's thread2 is locked up and waiting;
    + * - If the needed facility is not supported the debugger cancels the test.
    + * - Othewise, it suspends the thread2, calls to the method
    + * tread2.currentContendedMonitor() to get the object "monitor"
    + * mirroring a monitor in the debuggee and gets a boolean value
    + * returned by the method VirtualMachine.canGetMonitorInfo()
    + *
    + * Then if the value is true the debugger checks up that call to
    + * the method monitor.waitingThreads() doesn't throw
    + * UnsupportedOperationException.
    + * If the value is false the debugger checks up that call to the
    + * the method monitor.waitingThreads() does throw
    + * UnsupportedOperationException.
    + */ + +public class cangetmonitorinfo001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new cangetmonitorinfo001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canGetMonitorInfo.cangetmonitorinfo001a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.canGetMonitorInfo.Threadcangetmonitorinfo001a"; + + //String mName = "nsk.jdi.VirtualMachine.canGetMonitorInfo"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "Thread2"; + + List allThreads = null; + ObjectReference monitor = null; + ListIterator listIterator = null; + List classes = null; + + + label0: { + + log2("getting ThreadReference objects"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO 'main' thread ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + if (!vm.canGetCurrentContendedMonitor()) { + log2(".......vm.canGetCurrentContendedMonitor() == false; the test is cancelled"); + break label1; + } + log2(".......vm.canGetCurrentContendedMonitor() == true"); + + + log2(" supending the thread2"); + thread2.suspend(); + + log2(" monitor = thread2.currentContendedMonitor();"); + try { + monitor = waitForMonitor(thread2); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: UnsupportedOperationException"); + expresult = returnCode1; + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + e2.printStackTrace(); + } + if (expresult != returnCode0) + break label1; + + + if (vm.canGetMonitorInfo()) { + log2(".......vm.canGetMonitorInfo() == true"); + log2(" checking up on no UnsupportedOperationException trown"); + try { + monitor.waitingThreads(); + log2(" no Exception thrown"); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: UnsupportedOperationException"); + expresult = returnCode1; + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + e2.printStackTrace(); + } + } else { + log2(".......vm.canGetMonitorInfo() == false"); + log2(" checking up on UnsupportedOperationException trown"); + try { + monitor.waitingThreads(); + log3("ERROR: no UnsupportedOperationException thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException thrown"); + } catch ( Exception e2 ) { + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + e2.printStackTrace(); + expresult = returnCode1; + } + } + + } + + log2(" resuming the thread2 (for case it was suspended)"); + thread2.resume(); + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + // This function will wait until the debuggee thread has reached its monitor. + // The debuggee thread is already running, and should just be a few instructions + // away from reaching the monitor. We should not have to wait a long time. + // + // The debuggee thread should be suspended before calling this method, + // and it should still be suspended after this call. + private ObjectReference waitForMonitor(ThreadReference threadReference) throws Exception { + // Wait for at most 10 seconds. That is more than enough. + long remainingWaitMs = 10000; + final long iterationWaitMs = 100; + + while (remainingWaitMs >= 0) { + ObjectReference monitor = threadReference.currentContendedMonitor(); + if (monitor != null) { + return monitor; + } + + log2("Waiting for currentContendedMonitor. remainingWaitMs " + remainingWaitMs); + remainingWaitMs -= iterationWaitMs; + + try { + // Resume thread so it can reach its monitor. Suspend again after wait. + threadReference.resume(); + Thread.currentThread().sleep(iterationWaitMs); + } finally { + threadReference.suspend(); + } + } + + String msg = String.format("No currentContendedMonitor in thread '%s'", threadReference); + throw new Exception(msg); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001/TestDescription.java new file mode 100644 index 00000000000..e1c0dfed153 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canGetMonitorInfo() + * complies with its spec: + * public boolean canGetMonitorInfo() + * Determines if this implementation supports the retrieval of + * the monitor information for an object. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canGetMonitorInfo.cangetmonitorinfo001; + * the debuggee program - nsk.jdi.VirtualMachine.canGetMonitorInfo.cangetmonitorinfo001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.canGetMonitorInfo.cangetmonitorinfo001 + * nsk.jdi.VirtualMachine.canGetMonitorInfo.cangetmonitorinfo001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canGetMonitorInfo.cangetmonitorinfo001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001a.java new file mode 100644 index 00000000000..7b5af2d6be7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001a.java @@ -0,0 +1,199 @@ +/* + * 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. + */ +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! templete parameters !!!! +// VirtualMachine InterfaceName VirtualMachine +// canGetMonitorInfo MethodName canGetMonitorInfo +// cangetmonitorinfo001 TestName cangetmonitorinfo001a +// ------------------------------------------------------ + +package nsk.jdi.VirtualMachine.canGetMonitorInfo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the cangetmonitorinfo001 JDI test. + */ + +public class cangetmonitorinfo001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + private static Threadcangetmonitorinfo001a thread2 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canGetOwnedMonitorInfo()
    + * complies with its spec.
    + *
    + * The case for testing includes two threads objects defined
    + * in a debuggee and their mirrors in a debugger.
    + * The test works as follows. After being started up,

    + * the debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs the debugger of the thread2 creation,
    + * and is waiting for reply.
    + * Since the thread2 use the same locking object in its 'run' method
    + * it is locked up until main thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger
    + * suspends the 'main' thread and gets a boolean value returned by
    + * the method VirtualMachine.canGetOwnedMonitorInfo()
    + *
    + * Then if the value is true the debugger checks up that call to the
    + * the method mainThread.ownedMonitors() doesn't throw
    + * UnsupportedOperationException.
    + * If the value is false the debugger checks up that call to the
    + * the method mainThread.ownedMonitors() does throw
    + * UnsupportedOperationException.
    + */ + +public class cangetinfo001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new cangetinfo001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo.cangetinfo001a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo.Threadcangetinfo001a"; + + //String mName = "nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List allThreads = null; + List monitors = null; + ListIterator listIterator = null; + List classes = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO 'main' thread ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + + label1: { + if (expresult != returnCode0) + break label1; + + + log2(" supending the main thread"); + mainThread.suspend(); + + if (vm.canGetOwnedMonitorInfo()) { + + log2(".......vm.canGetOwnedMonitorInfo() == true"); + log2(" checking up on no UnsupportedOperationException trown"); + try { + monitors = mainThread.ownedMonitors(); + log2(" no Exception thrown"); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: UnsupportedOperationException"); + expresult = returnCode1; + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + } else { + log2(".......vm.canGetOwnedMonitorInfo() == false"); + log2(" checking up on UnsupportedOperationException trown"); + try { + monitors = mainThread.ownedMonitors(); + log3("ERROR: no UnsupportedOperationException thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException thrown"); + } catch ( Exception e2 ) { + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + expresult = returnCode1; + } + } + log2(" resuming the main thread"); + mainThread.resume(); + } + + log2("......instructing mainThread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001/TestDescription.java new file mode 100644 index 00000000000..09fda1a4bca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canGetOwnedMonitorInfo() + * complies with its spec: + * public boolean canGetOwnedMonitorInfo() + * Determines if the target VM supports the retrieval of the monitors + * owned by a thread. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo.cangetinfo001; + * the debuggee program - nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo.cangetinfo001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.canGetOwnedMonitorInfo.cangetinfo001 + * nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo.cangetinfo001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canGetOwnedMonitorInfo.cangetinfo001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001a.java new file mode 100644 index 00000000000..bed0b57dc80 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001a.java @@ -0,0 +1,193 @@ +/* + * 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.VirtualMachine.canGetOwnedMonitorInfo; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the cangetinfo001 JDI test. + */ + +public class cangetinfo001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + + private static Threadcangetinfo001a thread2 = null; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canGetSourceDebugExtension()
    + * complies with its specification.
    + *
    + * The test checks that the method doesn't throw exceptions.
    + */ + +public class cangetsde001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new cangetsde001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canGetSourceDebugExtension.cangetsde001a"; + + //String mName = "nsk.jdi.VirtualMachine.canGetSourceDebugExtension"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + boolean can = vm.canGetSourceDebugExtension(); + + try { + if (can) + log2(" can"); + else + log2(" cannot"); + } catch ( Throwable t ) { + log3("ERROR: Throwable : " + t); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001/TestDescription.java new file mode 100644 index 00000000000..11e8351e0dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/canGetSourceDebugExtension/cangetsde001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canGetSourceDebugExtension() + * complies with its spec: + * public boolean canGetSourceDebugExtension() + * Determines if the target VM supports getting the source debug extension. + * Returns: true if the feature is supported, false otherwise. + * The test checks that the method doesn't throw exceptions. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canGetSourceDebugExtension.cangetsde001; + * the debuggee program - nsk.jdi.VirtualMachine.canGetSourceDebugExtension.cangetsde001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.canGetSourceDebugExtension.cangetsde001 + * nsk.jdi.VirtualMachine.canGetSourceDebugExtension.cangetsde001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canGetSourceDebugExtension.cangetsde001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001a.java new file mode 100644 index 00000000000..43ce902b6ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001a.java @@ -0,0 +1,111 @@ +/* + * 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.VirtualMachine.canGetSourceDebugExtension; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the cangetsde001 JDI test. + */ + +public class cangetsde001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canGetSyntheticAttribute()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * After being started up, a debuggee informs a debugger.
    + * Upon the receiption a message from the debuggee, the debugger
    + * - gets the Field flagField object
    + * mirroring int variable "flag" in the debuggee,
    + * - calls to the method VirtualMachine.canGetCurrentContendedMonitor()
    + * to get its returned value.
    + * Then if the value is true the debugger checks up that invoking
    + * the method Field.isSynthetic() on the flagField doesn't throw
    + * UnsupportedOperationException.
    + * If the value is false the debugger checks up that invoking
    + * the method Field.isSynthetic() on the flagField does throw
    + * UnsupportedOperationException.
    + */ + +public class cangetattr001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new cangetattr001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canGetSyntheticAttribute.cangetattr001a"; + + //String mName = "nsk.jdi.VirtualMachine.canGetSyntheticAttribute"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + Field flagField = null; + + label0: { + + log2("......getting Field flagField object"); + testedclass = (ReferenceType) vm.classesByName(debuggeeName).get(0); + flagField = testedclass.fieldByName("flag"); + + + if (vm.canGetSyntheticAttribute()) { + + log2("......vm.canGetSyntheticAttribute() == true"); + log2(" checking up on no UnsupportedOperationException trown"); + try { + flagField.isSynthetic(); + log2(" no Exception thrown"); + } catch ( UnsupportedOperationException e1 ) { + log3("ERROR: UnsupportedOperationException"); + expresult = returnCode1; + } catch ( Exception e2 ) { + expresult = returnCode1; + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + } + + } else { + + log2(".......vm.canGetSyntheticAttribute() == false"); + log2(" checking up on UnsupportedOperationException trown"); + try { + flagField.isSynthetic(); + log3("ERROR: no UnsupportedOperationException thrown"); + expresult = returnCode1; + } catch ( UnsupportedOperationException e1 ) { + log2(" UnsupportedOperationException thrown"); + } catch ( Exception e2 ) { + log3("ERROR: UNEXPECTED Exception is thrown : " + e2); + expresult = returnCode1; + } + } + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001/TestDescription.java new file mode 100644 index 00000000000..df17f9271d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/canGetSyntheticAttribute/cangetattr001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canGetSyntheticAttribute() + * complies with its spec: + * public boolean canGetSyntheticAttribute() + * Determines if the target VM supports the query of the synthetic attribute + * of a method or field. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canGetSyntheticAttribute.cangetattr001; + * the debuggee program - nsk.jdi.VirtualMachine.canGetSyntheticAttribute.cangetattr001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.canGetSyntheticAttribute.cangetattr001 + * nsk.jdi.VirtualMachine.canGetSyntheticAttribute.cangetattr001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canGetSyntheticAttribute.cangetattr001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001a.java new file mode 100644 index 00000000000..debd8611aa7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001a.java @@ -0,0 +1,115 @@ +/* + * 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.VirtualMachine.canGetSyntheticAttribute; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the cangetattr001 JDI test. + */ + +public class cangetattr001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> cangetattr001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> cangetattr001a: " + message); + } + + //====================================================== test program + + static int flag = 99; + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canPopFrames()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class canpopframes001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canPopFrames/canpopframes001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canpopframes001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canPopFrames.canpopframes001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canPopFrames()"); + if ( vm.canPopFrames() ) + log2(" vm.canPopFrames() == true"); + else + log2(" vm.canPopFrames() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001/TestDescription.java new file mode 100644 index 00000000000..63e3ad1ea33 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001/TestDescription.java @@ -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/VirtualMachine/canPopFrames/canpopframes001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canPopFrames() + * complies with its spec: + * public boolean canPopFrames() + * Determines if the target VM supports popping frames of a threads stack. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canPopFrames.canpopframes001; + * the debuggee program - nsk.jdi.VirtualMachine.canPopFrames.canpopframes001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VirtualMachine.canPopFrames.canpopframes001 + * nsk.jdi.VirtualMachine.canPopFrames.canpopframes001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canPopFrames.canpopframes001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001a.java new file mode 100644 index 00000000000..19aa7c3c7c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canPopFrames; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canpopframes001 JDI test. + */ + +public class canpopframes001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001.java new file mode 100644 index 00000000000..c1ecbd95cad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001.java @@ -0,0 +1,429 @@ +/* + * 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.VirtualMachine.canRedefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canRedefineClasses()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class canredefineclasses001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canredefineclasses001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canRedefineClasses.canredefineclasses001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canRedefineClasses()"); + if ( vm.canRedefineClasses() ) + log2(" vm.canRedefineClasses() == true"); + else + log2(" vm.canRedefineClasses() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001/TestDescription.java new file mode 100644 index 00000000000..73c0f5bad52 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001/TestDescription.java @@ -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/VirtualMachine/canRedefineClasses/canredefineclasses001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canRedefineClasses() + * complies with its spec: + * public boolean canRedefineClasses() + * Determines if the target VM supports any level of class redefinition. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canRedefineClasses.canredefineclasses001; + * the debuggee program - nsk.jdi.VirtualMachine.canRedefineClasses.canredefineclasses001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VirtualMachine.canRedefineClasses.canredefineclasses001 + * nsk.jdi.VirtualMachine.canRedefineClasses.canredefineclasses001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canRedefineClasses.canredefineclasses001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001a.java new file mode 100644 index 00000000000..255e11afbe7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canRedefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canredefineclasses001 JDI test. + */ + +public class canredefineclasses001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001.java new file mode 100644 index 00000000000..961901a7857 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001.java @@ -0,0 +1,429 @@ +/* + * 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.VirtualMachine.canRequestVMDeathEvent; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canRequestVMDeathEvent()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class canreqvmdev001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canreqvmdev001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canRequestVMDeathEvent.canreqvmdev001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... canRequestVMDeathEvent()"); + if ( vm.canRequestVMDeathEvent() ) + log2(" vm.canRequestVMDeathEvent() == true"); + else + log2(" vm.canRequestVMDeathEvent() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001/TestDescription.java new file mode 100644 index 00000000000..c9dc8a4cebd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001/TestDescription.java @@ -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/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canRequestVMDeathEvent() + * complies with its spec: + * public boolean canRequestVMDeathEvent() + * Determines if the target VM supports the creation of VMDeathRequests. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canRequestVMDeathEvent.canreqvmdev001; + * the debuggee program - nsk.jdi.VirtualMachine.canRequestVMDeathEvent.canreqvmdev001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VirtualMachine.canRequestVMDeathEvent.canreqvmdev001 + * nsk.jdi.VirtualMachine.canRequestVMDeathEvent.canreqvmdev001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canRequestVMDeathEvent.canreqvmdev001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001a.java new file mode 100644 index 00000000000..53234fdf771 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canRequestVMDeathEvent; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canreqvmdev001 JDI test. + */ + +public class canreqvmdev001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001.java new file mode 100644 index 00000000000..f8773004333 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001.java @@ -0,0 +1,429 @@ +/* + * 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.VirtualMachine.canUnrestrictedlyRedefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class curc001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new curc001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses.curc001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canUnrestrictedlyRedefineClasses()"); + if ( vm.canUnrestrictedlyRedefineClasses() ) + log2(" vm.canUnrestrictedlyRedefineClasses() == true"); + else + log2(" vm.canUnrestrictedlyRedefineClasses() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001/TestDescription.java new file mode 100644 index 00000000000..c2104e509b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001/TestDescription.java @@ -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/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses() + * complies with its spec: + * public boolean canUnrestrictedlyRedefineClasses() + * Determines if the target VM supports unrestricted changes when + * performing class redefinition. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses.curc001; + * the debuggee program - nsk.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses.curc001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VirtualMachine.canUnrestrictedlyRedefineClasses.curc001 + * nsk.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses.curc001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canUnrestrictedlyRedefineClasses.curc001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001a.java new file mode 100644 index 00000000000..90b252b8536 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canUnrestrictedlyRedefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the curc001 JDI test. + */ + +public class curc001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001.java new file mode 100644 index 00000000000..3e73b7f58bc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001.java @@ -0,0 +1,429 @@ +/* + * 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.VirtualMachine.canUseInstanceFilters; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canUseInstanceFilters()
    + * complies with its spec.
    + *
    + * The test works as follows.
    + * Upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request
    + * for debuggee's ClassPrepareEvent with SUSPEND_EVENT_THREAD,
    + * resumes the VM, and waits for the event within the predefined
    + * time interval. If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD,
    + * the debugger resumes the debuggee and waits for the BreakpointEvent.
    + * The debuggee prepares new check and invokes the methodForCommunication
    + * to be suspended and to inform the debugger with the event.
    + * Upon getting the BreakpointEvent, the debugger performs the check.
    + * At the end, the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class canusefilters001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canusefilters001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canUseInstanceFilters.canusefilters001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canUseInstanceFilters()"); + if ( vm.canUseInstanceFilters() ) + log2(" vm.canUseInstanceFilters() == true"); + else + log2(" vm.canUseInstanceFilters() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001/TestDescription.java new file mode 100644 index 00000000000..dae09c7bdc9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001/TestDescription.java @@ -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/VirtualMachine/canUseInstanceFilters/canusefilters001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canUseInstanceFilters() + * complies with its spec: + * public boolean canUseInstanceFilters() + * Determines if the target VM supports filtering events by + * specific instance object. For example, see + * BreakpointRequest.addInstanceFilter(com.sun.jdi.ObjectReference). + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canUseInstanceFilters.canusefilters001; + * the debuggee program - nsk.jdi.VirtualMachine.canUseInstanceFilters.canusefilters001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VirtualMachine.canUseInstanceFilters.canusefilters001 + * nsk.jdi.VirtualMachine.canUseInstanceFilters.canusefilters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canUseInstanceFilters.canusefilters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001a.java new file mode 100644 index 00000000000..8ee5148cfa1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canUseInstanceFilters; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canusefilters001 JDI test. + */ + +public class canusefilters001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001.java new file mode 100644 index 00000000000..9ec3c9afc84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001.java @@ -0,0 +1,440 @@ +/* + * 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.VirtualMachine.canWatchFieldAccess; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canWatchFieldAccess()
    + * complies with its spec.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + */ + +public class canwatchaccess001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canwatchaccess001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canWatchFieldAccess.canwatchaccess001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canWatchFieldAccess()"); + if ( vm.canWatchFieldAccess() ) + log2(" vm.canWatchFieldAccess() == true"); + else + log2(" vm.canWatchFieldAccess() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001/TestDescription.java new file mode 100644 index 00000000000..5f6ed571e86 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001/TestDescription.java @@ -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/VirtualMachine/canWatchFieldAccess/canwatchaccess001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canWatchFieldAccess() + * complies with its spec: + * public boolean canWatchFieldAccess() + * Determines if the target VM supports watchpoints for field access. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canWatchFieldAccess.canwatchaccess001; + * the debuggee program - nsk.jdi.VirtualMachine.canWatchFieldAccess.canwatchaccess001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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 4509034 and + * to eliminate the possibility of the bug 4482592 in the test, + * the test is re-implemented on the base of new interaction mechanism + * for communication between a debugger and debuggee. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.canWatchFieldAccess.canwatchaccess001 + * nsk.jdi.VirtualMachine.canWatchFieldAccess.canwatchaccess001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canWatchFieldAccess.canwatchaccess001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001a.java new file mode 100644 index 00000000000..195c3154778 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canWatchFieldAccess; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canwatchaccess001 JDI test. + */ + +public class canwatchaccess001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001.java new file mode 100644 index 00000000000..d0d6fe245d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001.java @@ -0,0 +1,441 @@ +/* + * 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.VirtualMachine.canWatchFieldModification; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.canWatchFieldModification()
    + * complies with its spec.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following loop.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check case required.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class canwatchmod001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new canwatchmod001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.canWatchFieldModification.canwatchmod001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + try { + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + } catch ( Exception e ) { + throw e; + } + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(" new check: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("...... vm.canWatchFieldModification()"); + if ( vm.canWatchFieldModification() ) + log2(" vm.canWatchFieldModification() == true"); + else + log2(" vm.canWatchFieldModification() == false"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001/TestDescription.java new file mode 100644 index 00000000000..4d97049322e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001/TestDescription.java @@ -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/VirtualMachine/canWatchFieldModification/canwatchmod001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.canWatchFieldModification() + * complies with its spec: + * public boolean canWatchFieldModification() + * Determines if the target VM supports watchpoints for field modification. + * Returns: true if the feature is supported, false otherwise. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.canWatchFieldModification.canwatchmod001; + * the debuggee program - nsk.jdi.VirtualMachine.canWatchFieldModification.canwatchmod001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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 4509034 and + * to eliminate the possibility of the bug 4482592 in the test, + * the test is re-implemented on the base of new interaction mechanism + * for communication between a debugger and debuggee. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.canWatchFieldModification.canwatchmod001 + * nsk.jdi.VirtualMachine.canWatchFieldModification.canwatchmod001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.canWatchFieldModification.canwatchmod001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001a.java new file mode 100644 index 00000000000..23dc76c173c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001a.java @@ -0,0 +1,110 @@ +/* + * 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.VirtualMachine.canWatchFieldModification; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the canwatchmod001 JDI test. + */ + +public class canwatchmod001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001.java new file mode 100644 index 00000000000..7f5416d3908 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001.java @@ -0,0 +1,263 @@ +/* + * 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.VirtualMachine.classesByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.classesByName()
    + * complies with the spec for
    + * com.sun.jdi.classesByName methods
    + *
    + * The cases for testing are as follows :
    + *
    + * debuggee debugger
    + * classes loaded
    + *
    + * no vm.classesByName(".Class1ForCheck") ==0
    + *
    + * ".ClassForCheck" vm.classesByName(".Class1ForCheck") ==1
    + * vm.classesByName(".Class2ForCheck") ==0
    + * vm.classesByName(".InterfaceForCheck") ==0
    + *
    + * ".Class2ForCheck" vm.classesByName(".Class2ForCheck") ==1
    + * vm.classesByName(".InterfaceForCheck") ==1
    + *
    + * "Class2ForCheck" vm.classesByName(".Class2ForCheck") ==0
    + */ + +public class classesbyname001 { + + //----------------------------------------------------- template section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- template parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/classesByName/classesbyname001", + sHeader2 = "--> classesbyname001: ", + sHeader3 = "##> classesbyname001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new classesbyname001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.classesByName.classesbyname001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("classesbyname001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1("TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log3(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + String mName = + "nsk.jdi.VirtualMachine.classesByName"; + + log2("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List listVMClasses = null; + int expN = 0; + + switch (i) { + + // no attempt is made to load a class of given name + + case 0: + listVMClasses = vm.classesByName(mName + + ".Class1ForCheck"); + expN = 0; // O#=0; I#=0; + break; + + case 1: + listVMClasses = vm.classesByName(mName + + ".Class1ForCheck"); + expN = 0; // O#=0; I#=0; + break; + + + // Returns the loaded reference types that match a given name + + case 2: + listVMClasses = vm.classesByName(mName + + ".Class1ForCheck"); + expN = 1; // O#=1; I#=0; + break; + case 3: + listVMClasses = vm.classesByName(mName + + ".Class2ForCheck"); + expN = 0; // O#=0; I#=0; + break; + case 4: + listVMClasses = vm.classesByName(mName + + ".InterfaceForCheck"); + expN = 0; // O#=0; I#=0; + break; + case 5: + listVMClasses = vm.classesByName(mName + + ".Class2ForCheck"); + expN = 1; // O#=1; I#=1; + break; + case 6: + listVMClasses = vm.classesByName(mName + + ".InterfaceForCheck"); + expN = 1; // O#=1; I#=1; + break; + + + // not a fully qualified name + + case 7: + listVMClasses = vm.classesByName("Class2ForCheck"); + expN = 0; // O#=2; I#=3?; + break; + + + default: + break ; + } + + if (listVMClasses.size() != expN) { + log3("ERROR: size of returned list != expN but == " + + listVMClasses.size() + "; check # = " + i); + testExitCode = FAILED; + } else { + log2("size of returned list == expN ; check # = " + i); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1("TESTING ENDS"); + + //-------------------------------------------------- test summary section + + + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("ERROR: debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001/TestDescription.java new file mode 100644 index 00000000000..9fa4e1a9f85 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/VirtualMachine/classesByName/classesbyname001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.classesByName() + * complies with the following requirements: + * "The name must be fully qualified (for example, java.lang.String). + * The returned list will contain a ReferenceType for each class or + * interface found with given name. + * The search is confined to loaded classes only; no attempt is made + * to load a class of the given name." + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.classesByName.classesbyname001; + * a debuggee program - nsk.jdi.VirtualMachine.classesByName.classesbyname001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * establishes a pipe with the debuggee program, and then + * send to the programm commands, to which the debuggee replies + * via the pipe after executing instructions. Upon getting reply, + * the debugger calls corresponding debuggee.VM methods to get + * needed data on the state of the debuggee.VM, and compares + * the data got to the data expected. + * In case of mismatch 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.VirtualMachine.classesByName.classesbyname001 + * nsk.jdi.VirtualMachine.classesByName.classesbyname001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.classesByName.classesbyname001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001a.java new file mode 100644 index 00000000000..470263e5e9b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001a.java @@ -0,0 +1,222 @@ +/* + * 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.VirtualMachine.classesByName; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the classesbyname001 JDI test. + */ + +public class classesbyname001a { + + //----------------------------------------------------- template section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbose_mode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbose_mode) + System.err.println("**> classesbyname001a: " + message); + } + + private static void logErr(String message) { + if (verbose_mode) + System.err.println("!!**> classesbyname001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.description()
    + * complies with its specification.
    + */ + +public class description001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/description/description001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new description001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.description.description001a"; + + //String mName = "nsk.jdi.VirtualMachine.description"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String description = vm.description(); + if (description == null) { + log3("ERROR: description == null"); + expresult = returnCode1; + } else + log2(" description == " + description); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001/TestDescription.java new file mode 100644 index 00000000000..85272a99426 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001/TestDescription.java @@ -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/VirtualMachine/description/description001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.description() + * complies with its spec: + * public java.lang.String description() + * Returns text information on the target VM and the debugger support that + * mirrors it. No specific format for this information is guaranteed. + * Typically, this string contains version information for the target VM and + * debugger interfaces. More precise information on VM and JDI versions + * is available through version(), + * VirtualMachineManager.majorInterfaceVersion(), and + * VirtualMachineManager.minorInterfaceVersion() + * Returns: the description. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.description.description001; + * the debuggee program - nsk.jdi.VirtualMachine.description.description001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data. + * 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.VirtualMachine.description.description001 + * nsk.jdi.VirtualMachine.description.description001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.description.description001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001a.java new file mode 100644 index 00000000000..ac7722ff422 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.description; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the description001 JDI test. + */ + +public class description001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> description001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> description001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.dispose()
    + * complies with its specification.
    + * The test checks up that after call to VirtualMachine.dispose(),
    + * the communication channel is closed, hence,
    + * the VirtualMachine object becomes invalid.
    + *
    + * The test works as follows.
    + * After launching a debuggee, a debugger gets its VirtualMachine
    + * object (vm), invokes the method vm.dispose(); and performs
    + * checking call to the method vm.allClasses().
    + * An expected correct reaction to the method allClasses() is
    + * throwing VMDisconnectedException.
    + */ + +public class dispose001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/dispose/dispose001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new dispose001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.dispose.dispose001a"; + + //String mName = "nsk.jdi.VirtualMachine.dispose"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + //log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......vm.dispose();"); + vm.dispose(); + + try { + log2("...... try: vm.allClasses(); VMDisconnectedException is expected"); + vm.allClasses(); + log3("ERROR: no VMDisconnectedException"); + testExitCode = FAILED; + } catch ( VMDisconnectedException e1 ) { + log2(" : VMDisconnectedException"); + } catch ( Exception e2 ) { + log3("ERROR: unexpected Exception : " + e2); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001/TestDescription.java new file mode 100644 index 00000000000..60ef68f2f67 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/VirtualMachine/dispose/dispose001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.dispose() + * complies with its spec: + * public void dispose() + * Invalidates this virtual machine mirror. + * The communication channel to the target VM is closed, and + * the target VM prepares to accept another subsequent connection from + * this debugger or another debugger, including the following tasks: + * All event requests are cancelled. + * All threads suspended by suspend() or by ThreadReference.suspend() + * are resumed as many times as necessary for them to run. + * Garbage collection is re-enabled in all cases where + * it was disabled through ObjectReference.disableCollection(). + * Any current method invocations executing in the target VM are continued + * after the disconnection. Upon completion of any such method invocation, + * the invoking thread continues from the location where + * it was originally stopped. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * The test checks up that after call to VirtualMachine.dispose(), + * the communication channel is closed, hence, + * the VirtualMachine object becomes invalid. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.dispose.dispose001; + * the debuggee program - nsk.jdi.VirtualMachine.dispose.dispose001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.dispose.dispose001 + * nsk.jdi.VirtualMachine.dispose.dispose001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.dispose.dispose001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001a.java new file mode 100644 index 00000000000..11b76fca184 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001a.java @@ -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.VirtualMachine.dispose; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the dispose001 JDI test. + */ + +public class dispose001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> dispose001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> dispose001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.dispose()
    + * complies with its specification.
    + * The test checks up that after call to VirtualMachine.dispose(),
    + * a breakpoint event request set up before the call,
    + * is cancelled.
    + *
    + * The test work as follows.
    + * Upon launch a debuggee creates new thread which is waiting
    + * until a main thread leaves a synchronized block, and informs
    + * a debugger of the tread creation. The debugger sets up
    + * a breakpoint for the tested thread, performs vm.dispose() and
    + * sleeps for a predefined time-test parameter. Then the debugger
    + * asks the debuggee to check up on the tested thread state
    + * which should be "not alive" if the breakpoint was cancelled.
    + */ + +public class dispose002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/dispose/dispose002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new dispose002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.dispose.dispose002a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.dispose.Threaddispose002a"; + + //String mName = "nsk.jdi.VirtualMachine.dispose"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" vm.dispose()"); + vm.dispose(); + + if (breakpRequest1.isEnabled()) + log2(" breakpRequest1 is enabled"); + else + log2(" breakpRequest1 is disabled"); + + + log2("......forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" Thread.sleep(waitTime*60000);"); + try { + Thread.sleep(waitTime*60000); + } catch ( InterruptedException e ) { + log3("ERROR: InterruptedException"); + expresult = returnCode1; + break label1; + } + + log2("......sending to the debuggee: 'check_alive'"); + log2(" expected reply: 'not_alive'"); + pipe.println("check_alive"); + line = pipe.readln(); + if (line.equals("alive")) { + log3("ERROR: thread2 is alive"); + expresult = returnCode1; + } else if (line.equals("not_alive")) { + log2(" thread2 is not alive"); + } else { + log3("ERROR: unexpected reply: " + line); + expresult = returnCode4; + } + + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002/TestDescription.java new file mode 100644 index 00000000000..4e45c88c89b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/VirtualMachine/dispose/dispose002. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.dispose() + * complies with its spec: + * public void dispose() + * Invalidates this virtual machine mirror. + * The communication channel to the target VM is closed, and + * the target VM prepares to accept another subsequent connection from + * this debugger or another debugger, including the following tasks: + * All event requests are cancelled. + * All threads suspended by suspend() or by ThreadReference.suspend() + * are resumed as many times as necessary for them to run. + * Garbage collection is re-enabled in all cases where + * it was disabled through ObjectReference.disableCollection(). + * Any current method invocations executing in the target VM are continued + * after the disconnection. Upon completion of any such method invocation, + * the invoking thread continues from the location where + * it was originally stopped. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * The test checks up that after call to VirtualMachine.dispose(), + * debuggee's tested thread is not suspended at a breakpoint set up before, + * hence, corresponding event request is cancelled. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.dispose.dispose002; + * the debuggee program - nsk.jdi.VirtualMachine.dispose.dispose002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.dispose.dispose002 + * nsk.jdi.VirtualMachine.dispose.dispose002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.dispose.dispose002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002a.java new file mode 100644 index 00000000000..52469ccc636 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002a.java @@ -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.VirtualMachine.dispose; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the dispose002 JDI test. + */ + +public class dispose002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.dispose()
    + * complies with its specification.
    + * The test checks up that after call to VirtualMachine.dispose(),
    + * debuggee's thread suspended before the call by a debugger,
    + * with method ThreadReference.suspend(), is resumed and runs.
    + *
    + * The test work as follows.
    + * Upon launch the debuggee creates new thread which is waiting
    + * until a main thread leaves a synchronized block, and informs
    + * the debugger of the thread creation. The debugger suspends
    + * the tested thread, performs vm.dispose() and sleeps
    + * for a predefined time-test parameter. Then the debugger
    + * asks the debuggee to check up on the tested thread state
    + * which should be "not alive" if the thread was resumed.
    + */ + +public class dispose003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/dispose/dispose003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new dispose003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.dispose.dispose003a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.dispose.Threaddispose003a"; + + //String mName = "nsk.jdi.VirtualMachine.dispose"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" suspending thread2"); + thread2.suspend(); + + + log2(" vm.dispose()"); + vm.dispose(); + + log2("......forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" Thread.sleep(waitTime*60000);"); + try { + Thread.sleep(waitTime*60000); + } catch ( InterruptedException e ) { + log3("ERROR: InterruptedException"); + expresult = returnCode1; + break label1; + } + + log2("......sending to the debuggee: 'check_alive'"); + log2(" expected reply: 'not_alive'"); + pipe.println("check_alive"); + line = pipe.readln(); + if (line.equals("alive")) { + log3("ERROR: thread2 is alive"); + expresult = returnCode1; + } else if (line.equals("not_alive")) { + log2(" thread2 is not alive"); + } else { + log3("ERROR: unexpected reply: " + line); + expresult = returnCode4; + } + + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003/TestDescription.java new file mode 100644 index 00000000000..5fab7b7a082 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/VirtualMachine/dispose/dispose003. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.dispose() + * complies with its spec: + * public void dispose() + * Invalidates this virtual machine mirror. + * The communication channel to the target VM is closed, and + * the target VM prepares to accept another subsequent connection from + * this debugger or another debugger, including the following tasks: + * All event requests are cancelled. + * All threads suspended by suspend() or by ThreadReference.suspend() + * are resumed as many times as necessary for them to run. + * Garbage collection is re-enabled in all cases where + * it was disabled through ObjectReference.disableCollection(). + * Any current method invocations executing in the target VM are continued + * after the disconnection. Upon completion of any such method invocation, + * the invoking thread continues from the location where + * it was originally stopped. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * The test checks up that after call to VirtualMachine.dispose(), + * debuggee's tested thread suspended by the debugger with the method + * ThreadRefrence.suspend(), is resumed and runs. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.dispose.dispose003; + * the debuggee program - nsk.jdi.VirtualMachine.dispose.dispose003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.dispose.dispose003 + * nsk.jdi.VirtualMachine.dispose.dispose003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.dispose.dispose003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003a.java new file mode 100644 index 00000000000..39c491b6fbc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003a.java @@ -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.VirtualMachine.dispose; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the dispose003 JDI test. + */ + +public class dispose003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> dispose003a: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> dispose003a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.dispose()
    + * complies with its specification.
    + * The test checks up that after call to VirtualMachine.dispose(),
    + * debuggee's thread suspended before the call by a debugger,
    + * with method VirtualMachine.suspend(), is resumed and runs.
    + *
    + * The test work as follows.
    + * Upon launch the debuggee creates new thread which is waiting
    + * until a main thread leaves a synchronized block, and informs
    + * the debugger of the thread creation. The debugger suspends
    + * all threads, resumes the main thread, performs vm.dispose()
    + * and sleeps for a predefined time-test parameter.
    + * Then the debugger
    + * asks the debuggee to check up on the tested thread state
    + * which should be "not alive" if the thread was resumed.
    + */ + +public class dispose004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/dispose/dispose004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new dispose004().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.dispose.dispose004a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.dispose.Threaddispose004a"; + + //String mName = "nsk.jdi.VirtualMachine.dispose"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String threadName = "testedThread"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" suspending Virtual Machine"); + vm.suspend(); + log2(" resuming debuggee's main thread"); + mainThread.resume(); + + + log2(" checking up on mainThread state: not suspened is expected"); + if (!mainThread.isSuspended()) { + log2(" mainThread is not suspended"); + } else { + log3("ERROR: mainThread is suspended"); + expresult = returnCode1; + break label1; + } + + log2(" vm.dispose()"); + vm.dispose(); + + log2("......forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + log2(" Thread.sleep(waitTime*60000);"); + try { + Thread.sleep(waitTime*60000); + } catch ( InterruptedException e ) { + log3("ERROR: InterruptedException"); + expresult = returnCode1; + break label1; + } + + log2("......sending to the debuggee: 'check_alive'"); + log2(" expected reply: 'not_alive'"); + pipe.println("check_alive"); + line = pipe.readln(); + if (line.equals("alive")) { + log3("ERROR: thread2 is alive"); + expresult = returnCode1; + } else if (line.equals("not_alive")) { + log2(" thread2 is not alive"); + } else { + log3("ERROR: unexpected reply: " + line); + expresult = returnCode4; + } + + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004/TestDescription.java new file mode 100644 index 00000000000..2586fd29661 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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/VirtualMachine/dispose/dispose004. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.dispose() + * complies with its spec: + * public void dispose() + * Invalidates this virtual machine mirror. + * The communication channel to the target VM is closed, and + * the target VM prepares to accept another subsequent connection from + * this debugger or another debugger, including the following tasks: + * All event requests are cancelled. + * All threads suspended by suspend() or by ThreadReference.suspend() + * are resumed as many times as necessary for them to run. + * Garbage collection is re-enabled in all cases where + * it was disabled through ObjectReference.disableCollection(). + * Any current method invocations executing in the target VM are continued + * after the disconnection. Upon completion of any such method invocation, + * the invoking thread continues from the location where + * it was originally stopped. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * The test checks up that after call to VirtualMachine.dispose(), + * debuggee's tested thread suspended by the debuggee with the method + * Thread.suspend(), is resumed and runs. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.dispose.dispose004; + * the debuggee program - nsk.jdi.VirtualMachine.dispose.dispose004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.dispose.dispose004 + * nsk.jdi.VirtualMachine.dispose.dispose004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.dispose.dispose004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004a.java new file mode 100644 index 00000000000..46aa79d58d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004a.java @@ -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.VirtualMachine.dispose; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the dispose004 JDI test. + */ + +public class dispose004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> dispose004a: " + message); + } + + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> dispose004a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.dispose()
    + * complies with its specification.
    + * The test checks up that after call to VirtualMachine.dispose(),
    + * a method invocations executing in the target VM is continued,
    + * and upon completion of the method invocation,
    + * the invoking thread continues from the location where
    + * it was originally stopped.
    + *
    + * The test work as follows.
    + * Upon its launch the debuggee :
    + * creates new thread, thread2 which is waiting until
    + * the main thread leaves a synchronized block, and
    + * informs the debugger of the thread creation.
    + * The thread2 contains a method to be invoked from the debugger
    + * The debugger :
    + * sets up a breakpoint for debuggee's thread2,
    + * instructs the debuggee to leave the synchronized block in
    + * order to get its thread2 suspended at the breakpoint,
    + * waits for a reply from the debuggee.
    + * The debuggee :
    + * leaves the synchronized block and
    + * enter another synchronized block to lock itself at a monitor
    + * which the method "runt2" to be invoked from
    + * the debugger will unlock,
    + * informs the debugger and waits for new instruction.
    + * The debugger :
    + * upon getting the thread2 at the breakpoint,
    + * creates its own Thread object, named thread2 too,
    + * gets its thread2 running;
    + * debuggee's thread2 suspended at the breakpoint;
    + * the method is at once locked at the monitor holding by
    + * debuggee's main thread;
    + * instructs the debuggee to check whether "runt2" is invoked.
    + * The debuggee :
    + * upon getting unlocked by "runt2",
    + * informs the debugger and waits for new instruction.
    + * The debugger : + * clears interruption status,
    + * invokes vm.dispose() that results in
    + * VMDisconnectException in the thread2
    + * which has been suspended after invoking "runt2"
    + * but after exception it is resumed and sends interruption
    + * to the main thread;
    + * if the interruption is not received yet,
    + * sleeps for a predefined waitTime and within this time
    + * catchs InterruptedException;
    + * Then the debugger
    + * asks the debuggee to check up on its thread2 state
    + * which should be "not alive" if the thread2 was resumed.
    + */ + +public class dispose005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + public static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/dispose/dispose005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new dispose005().runThis(argv, out); + } + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + public static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.dispose.dispose005a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.dispose.Threaddispose005a"; + + //String mName = "nsk.jdi.VirtualMachine.dispose"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + static ReferenceType testedclass = null; + static ClassType classType = null; + + static ThreadReference thread2 = null; + static ThreadReference mainThread = null; + + static ObjectReference threadObjRef = null; + + + public static int testExitCode = PASSED; + + static final int returnCode0 = 0; + public static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + + static Thread currentThread = Thread.currentThread(); + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + int expresult = returnCode0; + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "testedThread"; + + String breakpointMethod1 = "runt1"; + //String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + //String bpLine2 = "breakpointLineNumber2"; + //String bpLine3 = "breakpointLineNumber3"; + + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + //BreakpointRequest breakpRequest2 = null; + //BreakpointRequest breakpRequest3 = null; + + StackFrame stackFrame = null; + + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + classType = (ClassType) testedclass; + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + mainThread = debuggee.threadByName("main"); + thread2 = debuggee.threadByName(threadName); + threadObjRef = thread2; + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + + log2("......forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + } + + if (expresult != returnCode0) + break label1; + + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" testedThread is at breakpoint"); + + + Threaddispose005 thread2 = new Threaddispose005("Thread2"); + log2("......thread2 is created"); + + synchronized (Threaddispose005.lockingObject) { + synchronized (Threaddispose005.waitnotifyObj) { + log2(" synchronized (waitnotifyObj) { enter"); + log2(" before: thread2.start()"); + thread2.start(); + + try { + log2(" before: waitnotifyObj.wait();"); + Threaddispose005.waitnotifyObj.wait(); + log2(" after: waitnotifyObj.wait();"); + + } catch ( Exception e2) { + log3("ERROR: Exception : " + e2 ); +//? pipe.println("waitnotifyerr"); + } + } + } + log2("mainThread is out of: synchronized (lockingObject)"); + + + + log2("......line = pipe.readln(); 'method_invoked' is expected"); + line = pipe.readln(); + if (!line.equals("method_invoked")) { + log3("ERROR: unexpected reply: " + line); + expresult = returnCode4; + break label1; + } + + if (Thread.interrupted()) + log2(" ==>Thread.interrupted()"); + + log2(" vm.dispose()"); + vm.dispose(); + + + if (!Thread.interrupted()) { + log2(" Thread.sleep(waitTime*60000);"); + try { + Thread.sleep(waitTime*60000); + } catch ( InterruptedException e ) { + log2(" : InterruptedException"); + } + } + + log2("......sending to the debuggee: 'check_alive'"); + log2(" expected reply: 'not_alive'"); + pipe.println("check_alive"); + line = pipe.readln(); + if (line.equals("alive")) { + log3("ERROR: testedThread is alive"); + expresult = returnCode1; + } else if (line.equals("not_alive")) { + log2(" testedThread is not alive"); + } else { + log3("ERROR: unexpected reply: " + line); + expresult = returnCode4; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (expresult != returnCode0) + { + log3("expresult != 0 (= " + expresult + ")"); + + testExitCode = FAILED; + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + case 14: VMDisconnectEvent wmde = (VMDisconnectEvent) ev; + log2(" VMDisconnectEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + + +} + +class Threaddispose005 extends Thread { + + public Threaddispose005 (String threadName) { + super(threadName); + } + + public static Object waitnotifyObj = new Object(); + public static Object lockingObject = new Object(); + + + public void run() { + log("method 'run' enter"); + + synchronized (waitnotifyObj) { + log("entered into block: synchronized (waitnotifyObj)"); + waitnotifyObj.notify(); + } + log("exited from block: synchronized (waitnotifyObj)"); + synchronized (lockingObject) { + log("entered into block: synchronized (lockingObject)"); + } + log("exited from block: synchronized (lockingObject)"); + + + List invokeMethods = dispose005.testedclass.methodsByName("runt2"); + Method invokeMethod = invokeMethods.get(0); + + List argumentList = Collections.emptyList(); + + try { + log("......invoking a method in the debuggee; VMDisconnectedException is expected"); + dispose005.threadObjRef.invokeMethod(dispose005.thread2, + invokeMethod, argumentList, 0); + } catch ( VMDisconnectedException e ) { + log(" : VMDisconnectedException "); + } catch ( Exception t ) { + log("ERROR: Exception:" + t); + dispose005.testExitCode = dispose005.FAILED; + } + log("dispose005.currentThread.interrupt();"); + dispose005.currentThread.interrupt(); + + + log("method 'run' exit"); + return; + } + + void log(String str) { + dispose005.log2("thread2: " + str); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005/TestDescription.java new file mode 100644 index 00000000000..6dc631a4a94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005/TestDescription.java @@ -0,0 +1,88 @@ +/* + * 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/VirtualMachine/dispose/dispose005. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.dispose() + * complies with its spec: + * public void dispose() + * Invalidates this virtual machine mirror. + * The communication channel to the target VM is closed, and + * the target VM prepares to accept another subsequent connection from + * this debugger or another debugger, including the following tasks: + * All event requests are cancelled. + * All threads suspended by suspend() or by ThreadReference.suspend() + * are resumed as many times as necessary for them to run. + * Garbage collection is re-enabled in all cases where + * it was disabled through ObjectReference.disableCollection(). + * Any current method invocations executing in the target VM are continued + * after the disconnection. Upon completion of any such method invocation, + * the invoking thread continues from the location where + * it was originally stopped. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * Any current method invocations executing in the target VM are continued + * after the disconnection. Upon completion of any such method invocation, + * the invoking thread continues from the location where + * it was originally stopped. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.dispose.dispose005; + * the debuggee program - nsk.jdi.VirtualMachine.dispose.dispose005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.dispose.dispose005 + * nsk.jdi.VirtualMachine.dispose.dispose005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.dispose.dispose005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005a.java new file mode 100644 index 00000000000..a6cb14f5fd9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005a.java @@ -0,0 +1,261 @@ +/* + * 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.VirtualMachine.dispose; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the dispose005 JDI test. + */ + +public class dispose005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> dispose005a: " + message); + } + + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> dispose005a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.eventQueue()
    + * complies with its specification.
    + *
    + * The test checks up that values of two EventQueue variables,
    + * one static and one instance, after assigning them results of
    + * two calls to the method VirtualMachine.eventQueue(),
    + * are equal.
    + */ + +public class eventqueue001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/eventQueue/eventqueue001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new eventqueue001().runThis(argv, out); + } + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.eventQueue.eventqueue001a"; + + //String mName = "nsk.jdi.VirtualMachine.eventQueue"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventQueue eventQueue1 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + EventQueue eventQueue2 = null; + + + log2("...... getting two EventQueue objects, one is static, another one is instance"); + eventQueue1 = vm.eventQueue(); + eventQueue2 = vm.eventQueue(); + if (eventQueue1 == null) { + log3("ERROR: eventQueue1 == null"); + expresult = returnCode1; + } + if (eventQueue2 == null) { + log3("ERROR: eventQueue2 == null"); + expresult = returnCode1; + } + if (expresult == returnCode0) { + log2("...... compareing two EventQueue objects"); + if (!eventQueue1.equals(eventQueue2)) { + log3("ERROR: !eventQueue1.equals(eventQueue2)"); + expresult = returnCode1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001/TestDescription.java new file mode 100644 index 00000000000..d5080060f01 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001/TestDescription.java @@ -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/VirtualMachine/eventQueue/eventqueue001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.eventQueue() + * complies with its spec: + * public EventQueue eventQueue() + * Returns the event queue for this virtual machine. + * A virtual machine has only one EventQueue object, + * this method will return the same instance each time it is invoked. + * Returns: the EventQueue for this virtual machine. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.eventQueue.eventqueue001; + * the debuggee program - nsk.jdi.VirtualMachine.eventQueue.eventqueue001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.eventQueue.eventqueue001 + * nsk.jdi.VirtualMachine.eventQueue.eventqueue001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.eventQueue.eventqueue001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001a.java new file mode 100644 index 00000000000..d052fa3c32e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.eventQueue; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the eventqueue001 JDI test. + */ + +public class eventqueue001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> eventqueue001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> eventqueue001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.eventRequestManager()
    + * complies with its specification.
    + *
    + * The test checks up that values of two EventRequestManager variables,
    + * one static and one instance, after assigning them results of
    + * two calls to the method VirtualMachine.eventRequestManager(),
    + * are equal.
    + */ + +public class eventrmanager001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new eventrmanager001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.eventRequestManager.eventrmanager001a"; + + //String mName = "nsk.jdi.VirtualMachine.eventRequestManager"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager1 = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + EventRequestManager eventRManager2 = null; + + + log2("...... getting two EventRequestManager objects, one is static, another one is instance"); + eventRManager1 = vm.eventRequestManager(); + eventRManager2 = vm.eventRequestManager(); + if (eventRManager1 == null) { + log3("ERROR: eventRManager1 == null"); + expresult = returnCode1; + } + if (eventRManager2 == null) { + log3("ERROR: eventRManager2 == null"); + expresult = returnCode1; + } + if (expresult == returnCode0) { + log2("...... compareing two EventRequestManager objects"); + if (!eventRManager1.equals(eventRManager2)) { + log3("ERROR: !eventRManager1.equals(eventRManager2)"); + expresult = returnCode1; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001/TestDescription.java new file mode 100644 index 00000000000..e8a92778991 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/VirtualMachine/eventRequestManager/eventrmanager001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.eventRequestManager() + * complies with its spec: + * public EventRequestManager eventRequestManager() + * Returns the event request manager for this virtual machine. + * The EventRequestManager controls user settable events such as breakpoints. + * A virtual machine has only one EventRequestManager object, + * this method will return the same instance each time it is invoked. + * Returns: the EventRequestManager for this virtual machine. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.eventRequestManager.eventrmanager001; + * the debuggee program - nsk.jdi.VirtualMachine.eventRequestManager.eventrmanager001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.eventRequestManager.eventrmanager001 + * nsk.jdi.VirtualMachine.eventRequestManager.eventrmanager001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.eventRequestManager.eventrmanager001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001a.java new file mode 100644 index 00000000000..b494753c90e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.eventRequestManager; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the eventrmanager001 JDI test. + */ + +public class eventrmanager001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> eventrmanager001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> eventrmanager001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.exit()
    + * complies with its specification.
    + * The test checks up that after call to VirtualMachine.exit(),
    + * the communication channel is closed, hence,
    + * the VirtualMachine object becomes invalid.
    + *
    + * The test works as follows.
    + * After launching a debuggee, a debugger gets its VirtualMachine
    + * object (vm), invokes the method vm.exit(0); and performs
    + * checking call to the method vm.allClasses().
    + * An expected correct reaction to the method allClasses() is
    + * throwing VMDisconnectedException.
    + */ + +public class exit001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String sHeader1 = "\n==> nsk/jdi/VirtualMachine/exit/exit001 ", sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main(String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new exit001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = "nsk.jdi.VirtualMachine.exit.exit001a"; + + //String mName = "nsk.jdi.VirtualMachine.exit"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + + static final int returnCode1 = 1; + + static final int returnCode2 = 2; + + static final int returnCode3 = 3; + + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis(String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + log1(" TESTING BEGINS"); + + log2("......vm.exit(0);"); + vm.exit(0); + + try { + log2("...... try: vm.allClasses(); VMDisconnectedException is expected"); + vm.allClasses(); + log3("ERROR: no VMDisconnectedException"); + testExitCode = FAILED; + } catch (VMDisconnectedException e1) { + log2(" : VMDisconnectedException"); + } catch (Exception e2) { + log3("ERROR: unexpected Exception : " + e2); + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001/TestDescription.java new file mode 100644 index 00000000000..fdaa4aa4eb5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001/TestDescription.java @@ -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/VirtualMachine/exit/exit001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.exit() + * complies with its spec: + * public void exit(int exitCode) + * Causes the mirrored VM to terminate with the given error code. + * All resources associated with this VirtualMachine are freed. + * If the mirrored VM is remote, the communication channel to it will be closed. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * Threads running in the mirrored VM are abruptly terminated. + * A thread death exception is not thrown and finally blocks are not run. + * Parameters: exitCode - the exit code for the target VM. + * The test checks up that after call to VirtualMachine.exit(), + * the communication channel is closed, hence, + * the VirtualMachine object becomes invalid. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.exit.exit001; + * the debuggee program - nsk.jdi.VirtualMachine.exit.exit001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.exit.exit001 + * nsk.jdi.VirtualMachine.exit.exit001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.exit.exit001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001a.java new file mode 100644 index 00000000000..93bc079a1b8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001a.java @@ -0,0 +1,62 @@ +/* + * 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.VirtualMachine.exit; + +import nsk.share.Log; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the exit001 JDI test. + */ + +public class exit001a { + + static Log log; + + private static void log1(String message) { + log.display("**> exit001a: " + message); + } + + public static void main(String argv[]) { + // informing a debugger of readiness + ArgumentHandler argHandler = new ArgumentHandler(argv); + + log = argHandler.createDebugeeLog(); + log1("debuggee started!"); + + IOPipe pipe = argHandler.createDebugeeIOPipe(); + pipe.println("ready"); + + /* + * In this test debugger kills debuggee using VirtualMachine.exit, so + * standard JDI tests communication protocol isn't used here + */ + try { + Thread.sleep(Long.MAX_VALUE); + } catch (Throwable t) { + // ignore all exceptions + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java new file mode 100644 index 00000000000..d63b13519da --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java @@ -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.VirtualMachine.exit; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; +import com.sun.jdi.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.exit()
    + * complies with its specification.
    + *
    + * The test works as follows.
    + * After launching a debuggee, a debugger gets its VirtualMachine
    + * object (vm), invokes the method vm.exit(testedReturnCode);
    + * and is waiting for the debuggee to finish and to return
    + * its exit code which should be testedReturnCode
    + * if debuggee's main thread death exception is not thrown.
    + * If the thread death exception is do thrown
    + * the exit code is FAILED.
    + */ + +public class exit002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String sHeader1 = "\n==> nsk/jdi/VirtualMachine/exit/exit002 ", sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main(String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new exit002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = "nsk.jdi.VirtualMachine.exit.exit002a"; + + //String mName = "nsk.jdi.VirtualMachine.exit"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + + static final int returnCode1 = 1; + + static final int returnCode2 = 2; + + static final int returnCode3 = 3; + + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis(String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + // Linux returns only 8 least significant bits of exit status - see #4459019 bug. + int testedReturnCode = 0x7F; + + log2("......Call vm.exit(testedReturnCode) with exit code: " + testedReturnCode); + vm.exit(testedReturnCode); + + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != testedReturnCode) { + log3("debuggee returned UNEXPECTED exit status: " + testedReturnCode); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + testedReturnCode); + } + + log1(" TESTING ENDS"); + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002/TestDescription.java new file mode 100644 index 00000000000..f60fe44cc00 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002/TestDescription.java @@ -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/VirtualMachine/exit/exit002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.exit() + * complies with its spec: + * public void exit(int exitCode) + * Causes the mirrored VM to terminate with the given error code. + * All resources associated with this VirtualMachine are freed. + * If the mirrored VM is remote, the communication channel to it will be closed. + * Resources originating in this VirtualMachine (ObjectReferences, + * ReferenceTypes, etc.) will become invalid. + * Threads running in the mirrored VM are abruptly terminated. + * A thread death exception is not thrown and finally blocks are not run. + * Parameters: exitCode - the exit code for the target VM. + * The test checks up that after call to VirtualMachine.exit(testedReturnCode), + * a thread death exception is not thrown and + * debuggee's exit code is equal to testedReturnCode. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.exit.exit002; + * the debuggee program - nsk.jdi.VirtualMachine.exit.exit002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * 4759453 TEST_BUG: tests against VirtualMachine.exit(int) should be corrected for Mantis + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.exit.exit002 + * nsk.jdi.VirtualMachine.exit.exit002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.exit.exit002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002a.java new file mode 100644 index 00000000000..c90f7f63e0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002a.java @@ -0,0 +1,62 @@ +/* + * 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.VirtualMachine.exit; + +import nsk.share.Log; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the exit002 JDI test. + */ + +public class exit002a { + + static Log log; + + private static void log1(String message) { + log.display("**> exit002a: " + message); + } + + public static void main(String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + + log = argHandler.createDebugeeLog(); + log1("debuggee started!"); + + // informing a debugger of readyness + IOPipe pipe = argHandler.createDebugeeIOPipe(); + pipe.println("ready"); + + /* + * In this test debugger kills debuggee using VirtualMachine.exit, so + * standard JDI tests communication protocol isn't used here + */ + try { + Thread.sleep(Long.MAX_VALUE); + } catch (Throwable t) { + // ignore all exceptions + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java new file mode 100644 index 00000000000..a36f5eee74a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java @@ -0,0 +1,198 @@ +/* + * 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.VirtualMachine.getDefaultStratum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.getDefaultStratum()
    + * complies with its specification.
    + *
    + * The test checks that String returned by the method
    + * VirtualMachine.getDefaultStratum() is null
    + * if the default stratum has not been set with setDefaultStratum(String).
    + *
    + */ + +public class getdefaultstratum001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new getdefaultstratum001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.getDefaultStratum.getdefaultstratum001a"; + + //String mName = "nsk.jdi.VirtualMachine.getDefaultStratum"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String defaultStratum = vm.getDefaultStratum(); + + if (defaultStratum != null) { + log3("ERROR: defaultStratum != null : " + defaultStratum); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001/TestDescription.java new file mode 100644 index 00000000000..eedee8160f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/VirtualMachine/getDefaultStratum/getdefaultstratum001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.getDefaultStratum() + * complies with its spec: + * public String getDefaultStratum() + * Return this VM's default stratum. + * Returns: null (meaning that the per-class default - + * ReferenceType.defaultStratum() - should be used) unless + * the default stratum has been set with setDefaultStratum(String). + * The test checks that a returned value is null if + * the default stratum has not been set with setDefaultStratum(String). + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.getDefaultStratum.getdefaultstratum001; + * the debuggee program - nsk.jdi.VirtualMachine.getDefaultStratum.getdefaultstratum001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.getDefaultStratum.getdefaultstratum001 + * nsk.jdi.VirtualMachine.getDefaultStratum.getdefaultstratum001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.getDefaultStratum.getdefaultstratum001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001a.java new file mode 100644 index 00000000000..c0e104d8b05 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001a.java @@ -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.VirtualMachine.getDefaultStratum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the getdefaultstratum001 JDI test. + */ + +public class getdefaultstratum001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } +/* + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } +*/ + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-forceGC")) + forceGC = true; + else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + protected String debuggeeClassName() { + return nsk.share.jdi.HeapwalkingDebuggee.class.getName(); + } + + protected void doTest() { + String testClassNames[] = { "nsk.share.jdi.TestClass1", "nsk.share.jdi.TestClass2", "nsk.share.jdi.TestInterfaceImplementer1"}; + + int testInstanceCount[] = { 2, 20, 1000, 500 }; + + //create instances + for (int i = 0; i < testClassNames.length; i++) { + pipe.println(HeapwalkingDebuggee.COMMAND_CREATE_INSTANCES + ":" + testClassNames[i] + ":" + testInstanceCount[i]); + checkDebugeeAnswer_instanceCounts(testClassNames[i], testInstanceCount[i]); + } + + testInstanceCounts(); + + //delete half of instances + for (int i = 0; i < testClassNames.length; i++) { + int deleteCount = (testInstanceCount[i] / 2); + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + testClassNames[i] + ":" + deleteCount); + + testInstanceCount[i] -= deleteCount; + checkDebugeeAnswer_instanceCounts(testClassNames[i], testInstanceCount[i]); + } + + if (forceGC) { + forceGC(); + } + + testInstanceCounts(); + + //delete all instances + for (int i = 0; i < testClassNames.length; i++) { + int deleteCount = testInstanceCount[i]; + + pipe.println(HeapwalkingDebuggee.COMMAND_DELETE_INSTANCES + ":" + testClassNames[i] + ":" + deleteCount); + + testInstanceCount[i] -= deleteCount; + checkDebugeeAnswer_instanceCounts(testClassNames[i], testInstanceCount[i]); + } + + testInstanceCounts(); + + } + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts002/TestDescription.java new file mode 100644 index 00000000000..8502ee0d4a9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts002/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/VirtualMachine/instanceCounts/instancecounts002. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This scenario in particular cover the situation described in CR 6376715. + * The test scenario is following: + * - the debugger gets the debuggee running on another JavaVM and + * establishes a pipe with the debuggee program + * - upon receiving corresponding command from the debugger process the debuggee + * loads set of classes and creates the number of class instances + * - the debugger process check that instanceCounts returns correct number + * - the debuggee process delete previously created objects + * (make them unreachable) + * - the debugger process checks that instanceCounts returns 0 and no + * com.sun.jdi.ObjectCollectedException is thrown + * Test execute class nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 with parameter -forceGC + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestClass2 + * nsk.share.jdi.TestInterfaceImplementer1 + * @run main/othervm/native PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -forceGC + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java new file mode 100644 index 00000000000..79e59f2f524 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 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/VirtualMachine/instanceCounts/instancecounts003. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This scenario in particular cover the situation described in CR 6376715. + * The test scenario is following: + * - the debugger gets the debuggee running on another JavaVM and + * establishes a pipe with the debuggee program + * - upon receiving corresponding command from the debugger process the debuggee + * do load set of classes. No instances of classes are created + * - the debugger process check that instanceCounts returns 0 + * - the debuggee process drop all references to the class and forces VM + * to unload them. + * - the debuggee process will check that instanceCounts returns 0 and no + * com.sun.jdi.ObjectCollectedException or com.sun.jdi.ClassNotLoadedException + * exception is thrown. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.instanceCounts.instancecounts003.instancecounts003 + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestInterfaceImplementer1 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts003.instancecounts003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + */ + +package nsk.jdi.VirtualMachine.instanceCounts.instancecounts003; + +import java.io.PrintStream; +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.*; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class instancecounts003 extends HeapwalkingDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new instancecounts003().runIt(argv, out); + } + + protected String debuggeeClassName() { + if (classpath == null) { + throw new TestBug("Debugger requires 'testClassPath' parameter"); + } + + return AbstractJDIDebuggee.class.getName() + " -testClassPath " + classpath; + } + + protected void doTest() { + String testClassNames[] = { "nsk.share.jdi.TestClass1", "nsk.share.jdi.TestInterfaceImplementer1" }; + + // load classes, don't create instances, check that instancCounts returns 0 + for (String className : testClassNames) { + pipe.println(AbstractDebuggeeTest.COMMAND_LOAD_CLASS + ":" + className); + checkDebugeeAnswer_instanceCounts(className, 0); + } + + testInstanceCounts(); + + // unload classes, check that instancCounts returns 0 and there are no unexpected exceptions + for (String className : testClassNames) { + pipe.println(AbstractDebuggeeTest.COMMAND_UNLOAD_CLASS + ":" + className); + checkDebugeeAnswer_instanceCounts(className, 0); + } + + testInstanceCounts(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004.java new file mode 100644 index 00000000000..c1bdc45f9f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2007, 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/VirtualMachine/instanceCounts/instancecounts004. + * VM Testbase keywords: [quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test against method "VirtualMachine.instanceCounts()". + * Test scenario: + * - Repeat the following steps 3 times: + * - Debuggee VM: create the number of different objects to consume 30% of available memory + * - Debuggee VM: create new thread 'GCProvocateur' which will try to consume the rest of memory to provoke GC + * - Debugger VM: at the same time call VirtualMachine.instanceCounts(VirtualMachine.allClasses()) 10 times + * - Debuggee VM: stop 'GCProvocateur' thread + * Test is treated as passed if no any unexpected events was caught during test execution and debuggee VM doesn't crash. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.instanceCounts.instancecounts004.instancecounts004 + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts004.instancecounts004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts004.instancecounts004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.VirtualMachine.instanceCounts.instancecounts004; + +import java.io.PrintStream; +import java.util.*; +import nsk.share.Consts; +import nsk.share.jdi.HeapwalkingDebugger; +import nsk.share.test.Stresser; + +public class instancecounts004 extends HeapwalkingDebugger { + + // It is possible to specify 'testCount', 'methodCallCount' via command line (for example: -methodCallCount 10) + + // test iterations count + private int testCount = 1; + + // how many times call vm.instanceCounts() during single iteration + private int methodCallCount = 10; + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new instancecounts004().runIt(argv, out); + } + + protected String debuggeeClassName() { + return instancecounts004a.class.getName(); + } + + // initialize test and remove arguments unsupported by nsk.share.jdi.ArgumentHandler + protected String[] doInit(String[] args, PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testCount") && (i < args.length - 1)) { + testCount = Integer.parseInt(args[i + 1]); + i++; + } else if (args[i].equals("-methodCallCount") && (i < args.length - 1)) { + methodCallCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + protected void testInstanceCounts(Stresser stresser) { + for (int i = 0; i < methodCallCount && stresser.continueExecution(); i++) { + try { + log.display("Doing vm.instanceCounts(vm.allClasses())"); + vm.instanceCounts(vm.allClasses()); + } catch (Throwable e) { + setSuccess(false); + log.complain("Unexpected exception: " + e); + e.printStackTrace(log.getOutStream()); + } + } + } + + protected void doTest() { + log.display("Use testCount = " + testCount); + log.display("Use methodCallCount = " + methodCallCount); + + stresser.start(testCount); + + try { + while (stresser.iteration()) { + pipe.println(instancecounts004a.COMMAND_CONSUME_MEMORY + ":" + 0.3); + + if (!isDebuggeeReady()) + break; + + pipe.println(instancecounts004a.COMMAND_START_GC_PROVOCATEUR); + + if (!isDebuggeeReady()) + break; + + testInstanceCounts(stresser); + + pipe.println(instancecounts004a.COMMAND_STOP_GC_PROVOCATEUR); + + if (!isDebuggeeReady()) + break; + } + + if (stresser.getIterationsLeft() > 0) { + log.display("Test execution stopped because of test time exceeded"); + } + } finally { + stresser.finish(); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004a.java new file mode 100644 index 00000000000..037c0d6a26a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004a.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2007, 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.VirtualMachine.instanceCounts.instancecounts004; + +import nsk.share.Consts; +import nsk.share.TestBug; +import nsk.share.jdi.*; + +import java.io.*; +import java.util.*; + +/* + * This debuggee class handle requests for start/stop thread which provokes GC + */ +public class instancecounts004a extends HeapwalkingDebuggee { + static public final String COMMAND_START_GC_PROVOCATEUR = "startGCProvokateur"; + + static public final String COMMAND_STOP_GC_PROVOCATEUR = "stopGCProvokateur"; + + static public final String COMMAND_CONSUME_MEMORY = "consumeMemory"; + + protected GCProvokateur provokateur; + + class GCProvokateur extends Thread { + public volatile boolean stop; + + Collection garbage; + + public void run() { + while (!stop) { + try { + while (!stop) { + long memory = Runtime.getRuntime().freeMemory() / 100; + + int arraySize; + + if (memory > Integer.MAX_VALUE) + arraySize = Integer.MAX_VALUE; + else + arraySize = (int) memory; + + garbage = new ArrayList(); + + for (int i = 0; i < 50; i++) + garbage.add(new byte[arraySize]); + + try { + Thread.sleep(10); + } catch (InterruptedException e) { + + } + } + } catch (OutOfMemoryError ignoreError) { + } + } + } + } + + // create large list to increase time needed for VirtualMachine.instanceCount + ArrayList garbageList = new ArrayList(); + + protected String[] doInit(String args[]) { + args = super.doInit(args); + + for (int i = 0; i < 250000; i++) { + TestClass1 t1 = new TestClass1(); + TestClass2 t2 = new TestClass2(); + garbageList.add(t1); + garbageList.add(t2); + } + return args; + } + + protected void consumeMemory(double consumedPart) { + Collection garbage = new ArrayList(); + + log.display("consumeMemory: " + consumedPart); + + if ((consumedPart > 1.0) || (consumedPart < 0)) { + throw new TestBug("Invalid value 'consumedPart'=" + consumedPart + " in consumeMemory, sholud be in [0..1]"); + } + + garbage = new ArrayList(); + + long freeSize = (long) (Runtime.getRuntime().totalMemory() * (1 - consumedPart)); + + int arraySize = (int) (freeSize / 100F); + if (arraySize < 1000) + arraySize = 1000; + + while (Runtime.getRuntime().freeMemory() > freeSize) { + garbage.add(new byte[arraySize]); + } + } + + protected void stopGCProvokateur() { + if (provokateur != null) { + provokateur.stop = true; + + try { + provokateur.join(); + } catch (InterruptedException e) { + log.complain("Main thread was unexpected interrupted when waiting for GCProvokateur termination"); + System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_FAILED); + } + } + } + + protected void startGCProvokateur() { + stopGCProvokateur(); + + provokateur = new GCProvokateur(); + provokateur.start(); + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + try { + StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(command)); + tokenizer.whitespaceChars(':', ':'); + + if (command.equals(COMMAND_START_GC_PROVOCATEUR)) { + startGCProvokateur(); + + return true; + } else if (command.equals(COMMAND_STOP_GC_PROVOCATEUR)) { + stopGCProvokateur(); + + return true; + } else if (command.startsWith(COMMAND_CONSUME_MEMORY)) { + tokenizer.nextToken(); + + if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) + throw new TestBug("Invalid command format"); + + consumeMemory(tokenizer.nval); + + return true; + } + + } catch (IOException e) { + throw new TestBug("Invalid command format: " + command); + } + + return false; + } + + public static void main(String args[]) { + new instancecounts004a().doTest(args); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001.java new file mode 100644 index 00000000000..b306513f70f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001.java @@ -0,0 +1,273 @@ +/* + * 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.VirtualMachine.mirrorOf_bool; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf(boolean value)
    + * complies with the spec for
    + * com.sun.jdi.BooleanValue methods
    + *
    + * The cases for testing are as follows
    + * (prefix 'bv' means 'boolean_value') :
    + *
    + * // BooleanValue bv.value() method
    + *
    + * bvTrue.value() == true
    + * bvFalse.value() == false
    + *
    + * // BooleanValue bv.equals() method
    + *
    + * bvTrue1.equals(bvTrue2)
    + * !bvTrue1.equals(bvFalse1)
    + * bvFalse1.equals(bvFalse2)
    + * !bvFalse1.equals(bvTrue1)
    + *
    + * !bvTrue1.equals(IntegerValue i0)
    + * !bvFalse1.equals(IntegerValue i1)
    + *
    + * // BooleanValue bv.hashCode() method
    + *
    + * bvTrue1.hashCode() == bvTrue1.hashCode()
    + * bvFalse1.hashCode() == bvFalse1.hashCode()
    + * bvTrue1.hashCode() == bvTrue2.hashCode()
    + * bvFalse1.hashCode() == bvFalse2.hashCode()
    + * bvTrue1.hashCode() != bvFalse1.hashCode()
    + */ + +public class mirrorof_bool001 { + + //----------------------------------------------------- template section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- template parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001", + sHeader2 = "--> mirrorof001: ", + sHeader3 = "##> mirrorof001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_bool001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_bool.mirrorof_bool001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_bool001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1("TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + BooleanValue bvTrue1 = vm.mirrorOf(true); + BooleanValue bvTrue2 = vm.mirrorOf(true); + BooleanValue bvFalse1 = vm.mirrorOf(false); + BooleanValue bvFalse2 = vm.mirrorOf(false); + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2("new check: #" + i); + + switch (i) { + + case 0: if (bvTrue1.value() != true) + expresult = 1; + break; + + case 1: if (bvFalse1.value() != false) + expresult = 1; + break; + + + case 2: if (!bvTrue1.equals(bvTrue2)) + expresult = 1; + break; + + case 3: if (bvTrue1.equals(bvFalse1)) + expresult = 1; + break; + + case 4: if (!bvFalse1.equals(bvFalse2)) + expresult = 1; + break; + + case 5: if (bvFalse1.equals(bvTrue1)) + expresult = 1; + break; + + case 6: IntegerValue i0 = vm.mirrorOf(0); + if (bvTrue1.equals(i0)) + expresult = 1; + break; + + case 7: IntegerValue i1 = vm.mirrorOf(1); + if (bvFalse1.equals(i1)) + expresult = 1; + break; + + + case 8: if (bvTrue1.hashCode() != bvTrue1.hashCode()) + expresult = 1; + break; + + case 9: if (bvFalse1.hashCode() != bvFalse1.hashCode()) + expresult = 1; + break; + + case 10: if (bvTrue1.hashCode() != bvTrue2.hashCode()) + expresult = 1; + break; + + case 11: if (bvFalse1.hashCode() != bvFalse2.hashCode()) + expresult = 1; + break; + + case 12: if (bvTrue1.hashCode() == bvFalse1.hashCode()) + expresult = 1; + break; + + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) { + // verbMode=true; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + + log1("TESTING ENDS"); + + //-------------------------------------------------- test summary section + + + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001/TestDescription.java new file mode 100644 index 00000000000..2326f5724e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001/TestDescription.java @@ -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/VirtualMachine/mirrorOf_bool/mirrorof_bool001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(boolean value) + * complies with the following requirements for BooleanValue: + * public boolean value() + * Returns this BooleanValue as a boolean. + * Returns: the boolean mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this BooleanValue + * for equality. + * Returns: + * true if the Object is a BooleanValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this BooleanValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_bool.mirrorof_bool001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_bool.mirrorof_bool001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_bool.mirrorof_bool001 + * nsk.jdi.VirtualMachine.mirrorOf_bool.mirrorof_bool001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_bool.mirrorof_bool001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001a.java new file mode 100644 index 00000000000..45d43848106 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.mirrorOf_bool; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as a debugee application for the mirrorof_bool001 JDI test. + */ + +public class mirrorof_bool001a { + + //----------------------------------------------------- template section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_bool001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_bool001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf(byte value)
    + * complies with the spec for
    + * com.sun.jdi.ByteValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'byte_value_i') :
    + *
    + * // ByteValue val.value() method
    + *
    + * val_i.value(Byte.MIN_VALUE) == Byte.MIN_VALUE
    + * val_i.value(Byte.MAX_VALUE) == Byte.MAX_VALUE
    + * val_i.value(0) == 0
    + * val_i.value(-1) == -1
    + * val_i.value(+1) == +1
    + *
    + * // ByteValue val.equals() method
    + *
    + * val_i.value(1) == val_j.value(1)
    + * val_i.value(1) != val_j.value(-1)
    + *
    + * val_i.value(1) != (ShortValue) val_j.value(1)
    + *
    + * // ByteValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_byte001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001", + sHeader2 = "--> mirrorof_byte001: ", + sHeader3 = "##> mirrorof_byte001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_byte001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_byte.mirrorof_byte001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_byte001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + byte smallest = Byte.MIN_VALUE; + byte zero = 0; + byte largest = Byte.MAX_VALUE; + byte plus1 = +1; + byte minus1 = -1; + + ByteValue val_1 = vm.mirrorOf(smallest); + ByteValue val_2 = vm.mirrorOf(zero); + ByteValue val_3 = vm.mirrorOf(largest); + ByteValue val_4 = vm.mirrorOf(plus1); + ByteValue val_5 = vm.mirrorOf(plus1); + ByteValue val_6 = vm.mirrorOf(minus1); + + ShortValue val_7 = vm.mirrorOf((short)plus1); + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for ByteValue.value() + + case 0: if (val_1.value() != smallest) + expresult = 1; + break; + + case 1: if (val_2.value() != zero) + expresult = 1; + break; + + case 2: if (val_3.value() != largest) + expresult = 1; + break; + + + // tests for ByteValue.equals() + + case 3: if (!val_4.equals(val_5)) + expresult = 1; + break; + + case 4: if (val_4.equals(val_6)) + expresult = 1; + break; + + case 5: if (val_4.equals(val_7)) + expresult = 1; + break; + + + // tests for ByteValue.hashCode() + + case 6: if (val_1.hashCode() != val_1.hashCode()) + expresult = 1; + break; + + case 7: if (val_4.hashCode() != val_5.hashCode()) + expresult = 1; + break; + + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001/TestDescription.java new file mode 100644 index 00000000000..62c7b3781b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_byte/mirrorof_byte001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(byte value) + * complies with the following requirements for ByteValue: + * public byte value() + * Returns this ByteValue as a byte. + * Returns: the byte mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this ByteValue for equality. + * Returns: true if the Object is a ByteValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this ByteValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_byte.mirrorof_byte001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_byte.mirrorof_byte001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_byte.mirrorof_byte001 + * nsk.jdi.VirtualMachine.mirrorOf_byte.mirrorof_byte001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_byte.mirrorof_byte001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001a.java new file mode 100644 index 00000000000..a78aa56f570 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001a.java @@ -0,0 +1,118 @@ +/* + * 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.VirtualMachine.mirrorOf_byte; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_byte001a JDI test. + */ + +public class mirrorof_byte001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_byte001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_byte001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_char()
    + * complies with the spec for
    + * com.sun.jdi.CharValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'char_value_i') :
    + *
    + * // CharValue val.value() method
    + *
    + * val_i.value(Character.MIN_VALUE) == Character.MIN_VALUE
    + * val_i.value(Character.MAX_VALUE) == Character.MAX_VALUE
    + * val_i.value(0) == 0
    + * val_i.value(-1) == -1
    + * val_i.value(+1) == +1
    + *
    + * // CharValue val.equals() method
    + *
    + * val_i.value(1) == val_j.value(1)
    + * val_i.value(1) != val_j.value(-1)
    + *
    + * val_i.value(1) != (ShortValue) val_j.value(1)
    + *
    + * // CharValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_char001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001", + sHeader2 = "--> mirrorof_char001: ", + sHeader3 = "##> mirrorof_char001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_char001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_char.mirrorof_char001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_char001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + char smallest = Character.MIN_VALUE; + char largest = Character.MAX_VALUE; + + char char_a = 'a'; + char char_b = 'b'; + + CharValue val_1 = vm.mirrorOf(smallest); + CharValue val_2 = vm.mirrorOf(largest); + + CharValue val_4 = vm.mirrorOf(char_a); + CharValue val_5 = vm.mirrorOf(char_a); + CharValue val_6 = vm.mirrorOf(char_b); + + ShortValue val_7 = vm.mirrorOf((short) char_a); + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for CharValue.value() + + case 0: if (val_1.value() != smallest) + expresult = 1; + break; + + case 1: if (val_2.value() != largest) + expresult = 1; + break; + + + // tests for CharValue.equals() + + case 2: if (!val_4.equals(val_5)) + expresult = 1; + break; + + case 3: if (val_4.equals(val_6)) + expresult = 1; + break; + + case 4: if (val_4.equals(val_7)) + expresult = 1; + break; + + + // tests for CharValue.hashCode() + + case 5: if (val_1.hashCode() != val_1.hashCode()) + expresult = 1; + break; + + case 6: if (val_4.hashCode() != val_5.hashCode()) + expresult = 1; + break; + + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001/TestDescription.java new file mode 100644 index 00000000000..9f5a82eda98 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_char/mirrorof_char001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(char value) + * complies with the following requirements for CharValue: + * public char value() + * Returns this CharValue as a char. + * Returns: the char mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this CharValue for equality. + * Returns: true if the Object is a CharValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this CharValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_char.mirrorof_char001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_char.mirrorof_char001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_char.mirrorof_char001 + * nsk.jdi.VirtualMachine.mirrorOf_char.mirrorof_char001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_char.mirrorof_char001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001a.java new file mode 100644 index 00000000000..9d0dbbad3e1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001a.java @@ -0,0 +1,117 @@ +/* + * 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.VirtualMachine.mirrorOf_char; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_char001a JDI test. + */ + +public class mirrorof_char001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_char001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_char001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_double()
    + * complies with the spec for
    + * com.sun.jdi.DoubleValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'double_value_i') :
    + *
    + * // DoubleValue val.value() method
    + *
    + * val_i.value(Double.NEGATIVE_INFINITY) == Double.NEGATIVE_INFINITY
    + * val_i.value(-Double.MAX_VALUE) == -Double.MAX_VALUE
    + * val_i.value(-Double.MIN_VALUE) == -Double.MIN_VALUE
    + * val_i.value(-0.0f) == -0.0f
    + * val_i.value(0.0f) == 0.0f
    + * val_i.value(Double.MIN_VALUE) == Double.MIN_VALUE
    + * val_i.value(Double.MAX_VALUE) == Double.MAX_VALUE
    + * val_i.value(Double.POSITIVE_INFINITY) == Double.POSITIVE_INFINITY
    + * val_i.value(Double.NaN) == Double.NaN
    + *
    + * // DoubleValue val.equals() method
    + *
    + * val_i.value(+1.0f) == val_j.value(+1.0f)
    + * val_i.value(+1.0f) != val_j.value(-1.0f)
    + *
    + * val_i.value(1.0) != doubleValue.value(1.0)
    + *
    + * // DoubleValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_double001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001", + sHeader2 = "--> mirrorof_double001: ", + sHeader3 = "##> mirrorof_double001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_double001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_double.mirrorof_double001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_double001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + double pos_inf = Double.POSITIVE_INFINITY; + double pos_zero = 0.0d; + double neg_zero = -0.0d; + double neg_inf = Double.NEGATIVE_INFINITY; + + double pos_largest = Double.MAX_VALUE; + double pos_smallest = Double.MIN_VALUE; + double neg_largest = -Double.MAX_VALUE; + double neg_smallest = -Double.MIN_VALUE; + + double double_nan = Double.NaN; + + double plus1 = +1.0d; + double minus1 = -1.0d; + + DoubleValue val_1 = vm.mirrorOf(neg_inf); + DoubleValue val_2 = vm.mirrorOf(neg_largest); + DoubleValue val_3 = vm.mirrorOf(neg_smallest); + DoubleValue val_4 = vm.mirrorOf(neg_zero); + DoubleValue val_5 = vm.mirrorOf(pos_zero); + DoubleValue val_6 = vm.mirrorOf(pos_smallest); + DoubleValue val_7 = vm.mirrorOf(pos_largest); + DoubleValue val_8 = vm.mirrorOf(pos_inf); + + DoubleValue val_9 = vm.mirrorOf(double_nan); + + DoubleValue val_10 = vm.mirrorOf(plus1); + DoubleValue val_11 = vm.mirrorOf(plus1); + DoubleValue val_12 = vm.mirrorOf(minus1); + + FloatValue val_13 = vm.mirrorOf((float)plus1); + + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for DoubleValue.value() + + case 0: if (val_1.value() != neg_inf) + expresult = 1; + break; + + case 1: if (val_2.value() != neg_largest) + expresult = 1; + break; + + case 2: if (val_3.value() != neg_smallest) + expresult = 1; + break; + + case 3: if (val_4.value() != neg_zero) + expresult = 1; + break; + + case 4: if (val_5.value() != pos_zero) + expresult = 1; + break; + + case 5: if (val_6.value() != pos_smallest) + expresult = 1; + break; + + case 6: if (val_7.value() != pos_largest) + expresult = 1; + break; + + case 7: if (val_8.value() != pos_inf) + expresult = 1; + break; + + case 8: if ( !(val_9.value() != val_9.value()) ) + expresult = 1; + break; + + + // tests for DoubleValue.equals() + + case 9: if (!val_10.equals(val_11)) + expresult = 1; + break; + + case 10: if (val_10.equals(val_12)) + expresult = 1; + break; + + case 11: if (val_10.equals(val_13)) + expresult = 1; + break; + + + // tests for DoubleValue.hashCode() + + case 12: if (val_7.hashCode() != val_7.hashCode()) + expresult = 1; + break; + + case 13: if (val_10.hashCode() != val_11.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001/TestDescription.java new file mode 100644 index 00000000000..c4fe41c4e84 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_double/mirrorof_double001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(double value) + * complies with the following requirements for DoubleValue: + * public double value() + * Returns this DoubleValue as a double. + * Returns: the double mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this DoubleValue for equality. + * Returns: true if the Object is a DoubleValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this DoubleValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_double.mirrorof_double001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_double.mirrorof_double001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_double.mirrorof_double001 + * nsk.jdi.VirtualMachine.mirrorOf_double.mirrorof_double001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_double.mirrorof_double001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001a.java new file mode 100644 index 00000000000..999f170082f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001a.java @@ -0,0 +1,118 @@ +/* + * 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.VirtualMachine.mirrorOf_double; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_double001a JDI test. + */ + +public class mirrorof_double001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + private static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_double001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_double001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_float()
    + * complies with the spec for
    + * com.sun.jdi.FloatValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'float_value_i') :
    + *
    + * // FloatValue val.value() method
    + *
    + * val_i.value(Float.NEGATIVE_INFINITY) == Float.NEGATIVE_INFINITY
    + * val_i.value(-Float.MAX_VALUE) == -Float.MAX_VALUE
    + * val_i.value(-Float.MIN_VALUE) == -Float.MIN_VALUE
    + * val_i.value(-0.0f) == -0.0f
    + * val_i.value(0.0f) == 0.0f
    + * val_i.value(Float.MIN_VALUE) == Float.MIN_VALUE
    + * val_i.value(Float.MAX_VALUE) == Float.MAX_VALUE
    + * val_i.value(Float.POSITIVE_INFINITY) == Float.POSITIVE_INFINITY
    + * val_i.value(Float.NaN) == Float.NaN
    + *
    + * // FloatValue val.equals() method
    + *
    + * val_i.value(+1.0f) == val_j.value(+1.0f)
    + * val_i.value(+1.0f) != val_j.value(-1.0f)
    + *
    + * val_i.value(1.0) != doubleValue.value(1.0)
    + *
    + * // FloatValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_float001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001", + sHeader2 = "--> mirrorof_float001: ", + sHeader3 = "##> mirrorof_float001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_float001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_float.mirrorof_float001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_float001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + float pos_inf = Float.POSITIVE_INFINITY; + float pos_zero = 0.0f; + float neg_zero = -0.0f; + float neg_inf = Float.NEGATIVE_INFINITY; + + float pos_largest = Float.MAX_VALUE; + float pos_smallest = Float.MIN_VALUE; + float neg_largest = -Float.MAX_VALUE; + float neg_smallest = -Float.MIN_VALUE; + + float float_nan = Float.NaN; + + float plus1 = +1.0f; + float minus1 = -1.0f; + + FloatValue val_1 = vm.mirrorOf(neg_inf); + FloatValue val_2 = vm.mirrorOf(neg_largest); + FloatValue val_3 = vm.mirrorOf(neg_smallest); + FloatValue val_4 = vm.mirrorOf(neg_zero); + FloatValue val_5 = vm.mirrorOf(pos_zero); + FloatValue val_6 = vm.mirrorOf(pos_smallest); + FloatValue val_7 = vm.mirrorOf(pos_largest); + FloatValue val_8 = vm.mirrorOf(pos_inf); + + FloatValue val_9 = vm.mirrorOf(float_nan); + + FloatValue val_10 = vm.mirrorOf(plus1); + FloatValue val_11 = vm.mirrorOf(plus1); + FloatValue val_12 = vm.mirrorOf(minus1); + + DoubleValue val_13 = vm.mirrorOf((double)plus1); + + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for FloatValue.value() + + case 0: if (val_1.value() != neg_inf) + expresult = 1; + break; + + case 1: if (val_2.value() != neg_largest) + expresult = 1; + break; + + case 2: if (val_3.value() != neg_smallest) + expresult = 1; + break; + + case 3: if (val_4.value() != neg_zero) + expresult = 1; + break; + + case 4: if (val_5.value() != pos_zero) + expresult = 1; + break; + + case 5: if (val_6.value() != pos_smallest) + expresult = 1; + break; + + case 6: if (val_7.value() != pos_largest) + expresult = 1; + break; + + case 7: if (val_8.value() != pos_inf) + expresult = 1; + break; + + case 8: if ( !(val_9.value() != val_9.value()) ) + expresult = 1; + break; + + + // tests for FloatValue.equals() + + case 9: if (!val_10.equals(val_11)) + expresult = 1; + break; + + case 10: if (val_10.equals(val_12)) + expresult = 1; + break; + + case 11: if (val_10.equals(val_13)) + expresult = 1; + break; + + + // tests for FloatValue.hashCode() + + case 12: if (val_7.hashCode() != val_7.hashCode()) + expresult = 1; + break; + + case 13: if (val_10.hashCode() != val_11.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001/TestDescription.java new file mode 100644 index 00000000000..3f9eea6055c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_float/mirrorof_float001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(float value) + * complies with the following requirements for FloatValue: + * public float value() + * Returns this FloatValue as a float. + * Returns: the float mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this FloatValue for equality. + * Returns: true if the Object is a FloatValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this FloatValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_float.mirrorof_float001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_float.mirrorof_float001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_float.mirrorof_float001 + * nsk.jdi.VirtualMachine.mirrorOf_float.mirrorof_float001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_float.mirrorof_float001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001a.java new file mode 100644 index 00000000000..5b30c8193a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001a.java @@ -0,0 +1,117 @@ +/* + * 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.VirtualMachine.mirrorOf_float; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_float001a JDI test. + */ + +public class mirrorof_float001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_float001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_float001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_int()
    + * complies with the spec for
    + * com.sun.jdi.IntegerValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'integer_value_i') :
    + *
    + * // IntegerValue val.value() method
    + *
    + * val_i.value(Integer.MIN_VALUE) == Integer.MIN_VALUE
    + * val_i.value(Integer.MAX_VALUE) == Integer.MAX_VALUE
    + * val_i.value(0) == 0
    + * val_i.value(-1) == -1
    + * val_i.value(+1) == +1
    + *
    + * // IntegerValue val.equals() method
    + *
    + * val_i.value(1) == val_j.value(1)
    + * val_i.value(1) != val_j.value(-1)
    + *
    + * val_i.value(1) != integerValue.value(1)
    + *
    + * // IntegerValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_int001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001", + sHeader2 = "--> mirrorof_int001: ", + sHeader3 = "##> mirrorof_int001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_int001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_int.mirrorof_int001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_int001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int smallest = Integer.MIN_VALUE; + int zero = 0; + int largest = Integer.MAX_VALUE; + int plus1 = +1; + int minus1 = -1; + + IntegerValue val_1 = vm.mirrorOf(smallest); + IntegerValue val_2 = vm.mirrorOf(zero); + IntegerValue val_3 = vm.mirrorOf(largest); + IntegerValue val_4 = vm.mirrorOf(plus1); + IntegerValue val_5 = vm.mirrorOf(plus1); + IntegerValue val_6 = vm.mirrorOf(minus1); + + LongValue val_7 = vm.mirrorOf((long)plus1); + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for IntegerValue.value() + + case 0: if (val_1.value() != smallest) + expresult = 1; + break; + + case 1: if (val_2.value() != zero) + expresult = 1; + break; + + case 2: if (val_3.value() != largest) + expresult = 1; + break; + + + // tests for IntegerValue.equals() + + case 3: if (!val_4.equals(val_5)) + expresult = 1; + break; + + case 4: if (val_4.equals(val_6)) + expresult = 1; + break; + + case 5: if (val_4.equals(val_7)) + expresult = 1; + break; + + + // tests for IntegerValue.hashCode() + + case 6: if (val_1.hashCode() != val_1.hashCode()) + expresult = 1; + break; + + case 7: if (val_4.hashCode() != val_5.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001/TestDescription.java new file mode 100644 index 00000000000..1368b7b20a1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_int/mirrorof_int001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(int value) + * complies with the following requirements for IntegerValue: + * public int value() + * Returns this IntegerValue as an int. + * Returns: the int mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this IntegerValue for equality. + * Returns: true if the Object is an IntegerValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this IntegerValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_int.mirrorof_int001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_int.mirrorof_int001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_int.mirrorof_int001 + * nsk.jdi.VirtualMachine.mirrorOf_int.mirrorof_int001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_int.mirrorof_int001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001a.java new file mode 100644 index 00000000000..453f43c2d23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001a.java @@ -0,0 +1,117 @@ +/* + * 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.VirtualMachine.mirrorOf_int; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_int001a JDI test. + */ + +public class mirrorof_int001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_int001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_int001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_long()
    + * complies with the spec for
    + * com.sun.jdi.LongValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'long_value_i') :
    + *
    + * // LongValue val.value() method
    + *
    + * val_i.value(Long.MIN_VALUE) == Long.MIN_VALUE
    + * val_i.value(Long.MAX_VALUE) == Long.MAX_VALUE
    + * val_i.value(0) == 0
    + * val_i.value(-1) == -1
    + * val_i.value(+1) == +1
    + *
    + * // LongValue val.equals() method
    + *
    + * val_i.value(1) == val_j.value(1)
    + * val_i.value(1) != val_j.value(-1)
    + *
    + * val_i.value(1) != integerValue.value(1)
    + *
    + * // LongValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_long001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001", + sHeader2 = "--> mirrorof_long001: ", + sHeader3 = "##> mirrorof_long001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_long001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_long.mirrorof_long001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_long001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + long smallest = Long.MIN_VALUE; + long zero = 0; + long largest = Long.MAX_VALUE; + long plus1 = +1; + long minus1 = -1; + + LongValue val_1 = vm.mirrorOf(smallest); + LongValue val_2 = vm.mirrorOf(zero); + LongValue val_3 = vm.mirrorOf(largest); + LongValue val_4 = vm.mirrorOf(plus1); + LongValue val_5 = vm.mirrorOf(plus1); + LongValue val_6 = vm.mirrorOf(minus1); + + FloatValue val_7 = vm.mirrorOf((float)plus1); + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for LongValue.value() + + case 0: if (val_1.value() != smallest) + expresult = 1; + break; + + case 1: if (val_2.value() != zero) + expresult = 1; + break; + + case 2: if (val_3.value() != largest) + expresult = 1; + break; + + + // tests for LongValue.equals() + + case 3: if (!val_4.equals(val_5)) + expresult = 1; + break; + + case 4: if (val_4.equals(val_6)) + expresult = 1; + break; + + case 5: if (val_4.equals(val_7)) + expresult = 1; + break; + + + // tests for LongValue.hashCode() + + case 6: if (val_1.hashCode() != val_1.hashCode()) + expresult = 1; + break; + + case 7: if (val_4.hashCode() != val_5.hashCode()) + expresult = 1; + break; + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001/TestDescription.java new file mode 100644 index 00000000000..14843c23520 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_long/mirrorof_long001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(long value) + * complies with the following requirements for LongValue: + * public long value() + * Returns this LongValue as a long. + * Returns: the long mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this LongValue for equality. + * Returns: true if the Object is a LongValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this LongValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_long.mirrorof_long001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_long.mirrorof_long001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_long.mirrorof_long001 + * nsk.jdi.VirtualMachine.mirrorOf_long.mirrorof_long001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_long.mirrorof_long001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001a.java new file mode 100644 index 00000000000..418ba3fb7be --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001a.java @@ -0,0 +1,118 @@ +/* + * 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.VirtualMachine.mirrorOf_long; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_long001a JDI test. + + */ + +public class mirrorof_long001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_long001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_long001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_short()
    + * complies with the spec for
    + * com.sun.jdi.ShortValue methods
    + *
    + * The cases for testing are as follows
    + * ('val_i' means 'short_value_i') :
    + *
    + * // ShortValue val.value() method
    + *
    + * val_i.value(Short.MIN_VALUE) == Short.MIN_VALUE
    + * val_i.value(Short.MAX_VALUE) == Short.MAX_VALUE
    + * val_i.value(0) == 0
    + * val_i.value(-1) == -1
    + * val_i.value(+1) == +1
    + *
    + * // ShortValue val.equals() method
    + *
    + * val_i.value(1) == val_j.value(1)
    + * val_i.value(1) != val_j.value(-1)
    + *
    + * val_i.value(1) != integerValue.value(1)
    + *
    + * // ShortValue val.hashCode() method
    + *
    + * val_i.hashCode() == val_i.hashCode()
    + *
    + * if (val_i.value() == val_j.value()) {
    + * val_i.hashCode() == val_j.hashCode()
    + * }
    + *
    + */ + +public class mirrorof_short001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001", + sHeader2 = "--> mirrorof_short001: ", + sHeader3 = "##> mirrorof_short001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_short001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_short.mirrorof_short001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_short001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + short smallest = Short.MIN_VALUE; + short zero = 0; + short largest = Short.MAX_VALUE; + short plus1 = +1; + short minus1 = -1; + + ShortValue val_1 = vm.mirrorOf(smallest); + ShortValue val_2 = vm.mirrorOf(zero); + ShortValue val_3 = vm.mirrorOf(largest); + ShortValue val_4 = vm.mirrorOf(plus1); + ShortValue val_5 = vm.mirrorOf(plus1); + ShortValue val_6 = vm.mirrorOf(minus1); + + IntegerValue val_7 = vm.mirrorOf((int)plus1); + + int i; + + for (i = 0; ; i++) { + + int expresult = 0; + + log2(" new check: #" + i); + + switch (i) { + + // tests for ShortValue.value() + + case 0: if (val_1.value() != smallest) + expresult = 1; + break; + + case 1: if (val_2.value() != zero) + expresult = 1; + break; + + case 2: if (val_3.value() != largest) + expresult = 1; + break; + + + // tests for ShortValue.equals() + + case 3: if (!val_4.equals(val_5)) + expresult = 1; + break; + + case 4: if (val_4.equals(val_6)) + expresult = 1; + break; + + case 5: if (val_4.equals(val_7)) + expresult = 1; + break; + + + // tests for ShortValue.hashCode() + + case 6: if (val_1.hashCode() != val_1.hashCode()) + expresult = 1; + break; + + case 7: if (val_4.hashCode() != val_5.hashCode()) + expresult = 1; + break; + + + + default: expresult = 2; + break ; + } + + if (expresult == 2) { + log2(" test cases finished"); + break ; + } else if (expresult == 1) {; + log3("ERROR: expresult != true; check # = " + i); + testExitCode = FAILED; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001/TestDescription.java new file mode 100644 index 00000000000..786e62c12b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001/TestDescription.java @@ -0,0 +1,79 @@ +/* + * 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/VirtualMachine/mirrorOf_short/mirrorof_short001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(short value) + * complies with the following requirements for ShortValue: + * public short value() + * Returns this ShortValue as a short. + * Returns: the short mirrored by this object. + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this ShortValue for equality. + * Returns: true if the Object is a ShortValue and if applying "==" + * to the two mirrored primitives would evaluate to true; + * false otherwise. + * public int hashCode() + * Returns the hash code value for this ShortValue. + * Returns: the integer hash code + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_short.mirrorof_short001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_short.mirrorof_short001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_short.mirrorof_short001 + * nsk.jdi.VirtualMachine.mirrorOf_short.mirrorof_short001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_short.mirrorof_short001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001a.java new file mode 100644 index 00000000000..49dc174c346 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001a.java @@ -0,0 +1,119 @@ +/* + * 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.VirtualMachine.mirrorOf_short; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_short001a JDI test. + + */ + +public class mirrorof_short001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_short001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_short001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.mirrorOf_string()
    + * complies with the spec for
    + * com.sun.jdi.StringValue methods.
    + *
    + * The cases for testing are as follows:
    + * s2 = s_ref.value();
    + * doesn't throw ObjectCollectedException
    + *
    + * for String objects s1 and s2
    + * s_ref = vm.mirrorOf(s1); s1.compareTo(s2) == 0
    + *
    + */ + +public class mirrorof_string001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001", + sHeader2 = "--> mirrorof_string001: ", + sHeader3 = "##> mirrorof_string001: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new mirrorof_string001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debugeeName = + "nsk.jdi.VirtualMachine.mirrorOf_string.mirrorof_string001a"; + + //====================================================== test program + + static ArgumentHandler argsHandler; + static int testExitCode = PASSED; + + //------------------------------------------------------ common section + + 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"); // *** tp + } else { + debugee = binder.bindToDebugee(debugeeName); // *** tp + } + + IOPipe pipe = new IOPipe(debugee); + + debugee.redirectStderr(out); + log2("mirrorof_string001a debugee launched"); + debugee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debugee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String s1 = "abc"; + String s2 = null; + + StringReference s_ref = vm.mirrorOf(s1); + + try { + s2 = s_ref.value(); + } catch ( ObjectCollectedException e ) { + log3("ERROR: 's2=s_ref.value' throws ObjectCollectedException"); + testExitCode = FAILED; + } + + if (testExitCode != FAILED) + if (s1.compareTo(s2) != 0) { + log3("ERROR: strings are not equal"); + testExitCode = FAILED; + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + //-------------------------------------------------- test summary section + + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debugee finish ..."); + debugee.waitFor(); + + int status = debugee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debugee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debugee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001/TestDescription.java new file mode 100644 index 00000000000..ecc5322a573 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001/TestDescription.java @@ -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/VirtualMachine/mirrorOf_string/mirrorof_string001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.mirrorOf(String value) + * complies with the following requirements: + * public java.lang.String value() + * Returns the StringReference as a String. + * The returned string is the equivalent of the mirrored string, + * but is an entity in the client VM and + * can be manipulated like any other string. + * Returns: the string value. + * Throws: + * ObjectCollectedException - if this object has been garbage collected. + * The test works as follows: + * A debugger program - nsk.jdi.VirtualMachine.mirrorOf_string.mirrorof_string001; + * a debuggee program - nsk.jdi.VirtualMachine.mirrorOf_string.mirrorof_string001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VirtualMachine.mirrorOf_string.mirrorof_string001 + * nsk.jdi.VirtualMachine.mirrorOf_string.mirrorof_string001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.mirrorOf_string.mirrorof_string001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001a.java new file mode 100644 index 00000000000..59525056755 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001a.java @@ -0,0 +1,118 @@ +/* + * 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.VirtualMachine.mirrorOf_string; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debugee application for the mirrorof_string001a JDI test. + */ + +public class mirrorof_string001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; // debugger may switch to true + + private static void log1(String message) { + if (verbMode) + System.err.println("**> mirrorof_string001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mirrorof_string001a: " + message); + } + + //====================================================== test program + + //------------------------------------------------------ common section + + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.name()
    + * complies with its specification.
    + */ + +public class name001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/name/name001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new name001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.name.name001a"; + + //String mName = "nsk.jdi.VirtualMachine.name"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String name = vm.name(); + if (name == null) { + log3("ERROR: name == null"); + expresult = returnCode1; + } else + log2(" name == " + name); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001/TestDescription.java new file mode 100644 index 00000000000..79fa778406f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001/TestDescription.java @@ -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/VirtualMachine/name/name001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.name() + * complies with its spec: + * public java.lang.String name() + * Returns the name of the target VM as reported by the property java.vm.name. + * Returns: the target VM name. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.name.name001; + * the debuggee program - nsk.jdi.VirtualMachine.name.name001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.name.name001 + * nsk.jdi.VirtualMachine.name.name001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.name.name001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001a.java new file mode 100644 index 00000000000..b297606b0bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.name; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the name001 JDI test. + */ + +public class name001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> name001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> name001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.process()
    + * complies with it specification.
    + *
    + * The test checks up that if a target VirtualMachine is
    + * launched by a LaunchingConnector a value returned by the
    + * method is not null.
    + */ + +public class process001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/process/process001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new process001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.process.process001a"; + + //String mName = "nsk.jdi.VirtualMachine.process"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + Process process = vm.process(); + + if (argsHandler.isLaunchingConnector()) { + log2("......VirtualMachine is launched by a LaunchingConnector"); + log2(" check that VirtualMachine.process() has retuned not null"); + if (process == null) { + log3("ERROR: VirtualMachine.process() has retuned null"); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001/TestDescription.java new file mode 100644 index 00000000000..629c9e31f3a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/VirtualMachine/process/process001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.process() + * complies with its spec: + * public java.lang.Process process() + * Returns the Process object for this virtual machine + * if launched by a LaunchingConnector + * Returns: the Process object for this virtual machine, or + * null if it was not launched by a LaunchingConnector. + * The test case includes only a LaunchingConnector. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.process.process001; + * the debuggee program - nsk.jdi.VirtualMachine.process.process001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.process.process001 + * nsk.jdi.VirtualMachine.process.process001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.process.process001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001a.java new file mode 100644 index 00000000000..c11a3feebed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.process; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the process001 JDI test. + */ + +public class process001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> process001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> process001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.redefineClasses()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * If any redefined methods have active stack frames,
    + * those active frames continue to run the bytecodes of
    + * the previous method.
    + * The redefined methods will be used on new invokes.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assetion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new tested class object, objRF1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the breakpointForCommunication Event,
    + * the debugger sets up the breakpoint bpRequest2 in the tested method
    + * redefineclasses001b.m2(), resumes the debuggee.
    + * - The debuggee invokes objRF1.m1() method to be suspended
    + * at the breakpoint in the method m2().
    + * - Upon getting the breakpointInMethod Event,
    + * the debugger prepares mapClassToByte, invokes
    + * VirtualMachine.redefineClasses(mapClassToByte)
    + * and resumes the debuggee.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * once again and to inform the debugger with the event.
    + * - Upon getting seconf breakpointForCommunication Event,
    + * the debugger sets up another breakpoint in the redefined method m2()
    + * and resumes the debuggee.
    + * - The debuggee invokes the method m1() to invoke m2() second time,
    + * wher it will be suspended once again.
    + * - Upon getting second breakpointInMethod Event,
    + * the debugger checks up the value of the class variable "i1"
    + * which should be equal to the expected value.
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class redefineclasses001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new redefineclasses001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + + debuggee = binder.bindToDebugee(debuggeeName); + + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + + if ( !vm.canRedefineClasses() ) { + log2("......vm.canRedefineClasses() == false : test is cancelled"); + vm.resume(); + return; + } + + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + String bpClassName = "nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001b"; + String bpMethodName = "m2"; + String bpLineName = "bpline"; + String varName = "i1"; + int varValue = 2; + + BreakpointRequest bpRequest2 = null; + BreakpointRequest bpRequest3 = null; + ReferenceType bpClass = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + case 0: + List classes = vm.classesByName(bpClassName); + bpClass = (ReferenceType) classes.get(0); + bpRequest2 = settingBreakpoint(threadByName("main"), + bpClass, + bpMethodName, bpLineName, "one"); + bpRequest2.enable(); + + vm.resume(); + breakpointInMethod("one"); + bpRequest2.disable(); + + try { + log2("......vm.redefineClasses(mapClassToBytes());"); + vm.redefineClasses(mapClassToBytes()); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + testExitCode = FAILED; + throw e; + } catch ( Error e ) { + log3("ERROR: Error: " + e); + testExitCode = FAILED; + throw e; + } + break; + + case 1: + + bpRequest3 = settingBreakpoint(threadByName("main"), + bpClass, + bpMethodName, bpLineName, "one"); + + bpRequest3.enable(); + + vm.resume(); + breakpointInMethod("one"); + bpRequest3.disable(); + + int i1 = ( (IntegerValue) + bpClass.getValue(bpClass.fieldByName(varName) ) ).value(); + + if (i1 != varValue) { + testExitCode = FAILED; + log3("ERROR: value of i1 != 2 (expected) but : " + i1); + } + break; + + default: + throw new JDITestRuntimeException ("** default case **"); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } +// this is for debugging +// testExitCode = FAILED; + + vm.resume(); + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + alllineLocations = method.allLineLocations(); + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private void breakpointInMethod(String number) + throws JDITestRuntimeException { + + Event event; + + getEventSet(); + event = eventIterator.nextEvent(); + + if ( !(event instanceof BreakpointEvent) ) + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + + log2("---->: request().getProperty == " + + event.request().getProperty("number")); + + if ( event.request().getProperty("number").equals(number) ) + return; + + throw new JDITestRuntimeException("** UNEXPECTED breakpoint **"); + } + + + private Map mapClassToBytes() + throws JDITestRuntimeException { + + byte []arrayToRedefine; + +// ----------------------------- + log2("......getting: String[] args = argsHandler.getArguments();"); + String[] args = argsHandler.getArguments(); + if (args.length <= 0) { + log3("ERROR: args.length <= 0"); + testExitCode = FAILED; + throw new JDITestRuntimeException("** args.length <= 0 **"); + } + String testDir = args[0]; + log2("...... testDir = " + testDir); + + + String filePrefix = File.separator + "nsk" + + File.separator + "jdi" + + File.separator + "VirtualMachine" + + File.separator + "redefineClasses"; + + String fileToRedefineName = testDir + + File.separator + "newclass" + + filePrefix + + File.separator + "redefineclasses001b.class"; + + log2("...... fileToRedefineName = " + fileToRedefineName); +// ----------------------------- + + try { + log2("......File fileToRedefine = new File(fileToRedefineName);"); + File fileToRedefine = new File(fileToRedefineName); + if (fileToRedefine.exists()) + log2(" fileToRedefine.exists()"); + else { + log3("ERROR: fileToRedefine doesn't exist"); + testExitCode = FAILED; + } + + if (testExitCode == FAILED) + throw new JDITestRuntimeException("** testExitCode == FAILED **"); + + int fileToRedefineLength = (int) fileToRedefine.length(); + log2(" fileToRedefineLength == " + fileToRedefineLength); + + FileInputStream inputFile = new FileInputStream(fileToRedefine); + arrayToRedefine = new byte[fileToRedefineLength]; + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch ( IOException e ) { + log3("ERROR: IOException: " + e); + throw new JDITestRuntimeException("** IOException **"); + } + + String testClassName = "nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001b"; + List classes = vm.classesByName(testClassName); + ReferenceType testClass = (ReferenceType) classes.get(0); + + HashMap mapForClass = new HashMap(); + mapForClass.put(testClass, arrayToRedefine); + + return mapForClass; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/TestDescription.java new file mode 100644 index 00000000000..186d491bd9a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/TestDescription.java @@ -0,0 +1,139 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.redefineClasses() + * complies with its spec: + * public void redefineClasses(Map classToBytes) + * All classes given are redefined according to the definitions supplied. + * If any redefined methods have active stack frames, those + * active frames continue to run the bytecodes of the previous method. + * The redefined methods will be used on new invokes. + * If resetting these frames is desired, use ThreadReference.popFrames(StackFrame) + * with Method.isObsolete(). + * This function does not cause any initialization except that which + * would occur under the customary JVM semantics. In other words, + * redefining a class does not cause its initializers to be run. + * The values of preexisting static variables will remain as they were + * prior to the call. However, completely uninitialized (new) static variables + * will be assigned their default value. + * If a redefined class has instances then all those instances will have + * the fields defined by the redefined class at the completion of the call. + * Preexisting fields will retain their previous values. + * Any new fields will have their default values; + * no instance initializers or constructors are run. + * Threads need not be suspended. + * No events are generated by this function. + * Not all target virtual machines support this operation. + * Use canRedefineClasses() to determine if the operation is supported. + * Use canAddMethod() to determine if the redefinition can add methods. + * Use canUnrestrictedlyRedefineClasses() to determine if + * the redefinition can change the schema, delete methods, + * change the class hierarchy, etc. + * Parameters: + * classToBytes - A map from ReferenceType to array of byte. + * The bytes represent the new class definition and + * are in Java Virtual Machine class file format. + * Throws: + * UnsupportedOperationException - if the target virtual machine does not + * support this operation. + * If canRedefineClasses() is false + * any call of this method will throw this exception. + * If canAddMethod() is false attempting to add a method + * will throw this exception. + * If canUnrestrictedlyRedefineClasses() is false, + * attempting any of the following will throw this exception + * changing the schema (the fields) + * changing the hierarchy (subclasses, interfaces) + * deleting a method + * changing class modifiers + * changing method modifiers + * NoClassDefFoundError - if the bytes don't correspond to the reference type + * (the names don't match). + * VerifyError - if a "verifier" detects that a class, though well formed, + * contains an internal inconsistency or security problem. + * ClassFormatError - if the bytes do not represent a valid class. + * ClassCircularityError - if a circularity has been detected + * while initializing a class. + * UnsupportedClassVersionError - if the major and minor version numbers in bytes + * are not supported by the VM. + * The test checks up on the following assertion: + * If any redefined methods have active stack frames, + * those active frames continue to run the bytecodes of the previous method. + * The redefined methods will be used on new invokes. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001; + * the debuggee program - nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * The test suite contains + * the precompiled class file redefineclasses001b.klass . + * Its source file is redefineclasses001b.ja . + * Test was updated according to rfe: + * 4691123 TEST: some jdi tests contain precompiled .klass files undes SCCS. + * redefineclasses001b.ja was moved into newclass directory and renamed + * to redefineclasses001b.java. + * The precompiled class file is created during test base build process. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses001 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/newclass/redefineclasses001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/newclass/redefineclasses001b.java new file mode 100644 index 00000000000..86ef9d1eaa0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/newclass/redefineclasses001b.java @@ -0,0 +1,60 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is the redefining class for the redefineclasses001 JDI test. + */ + +public class redefineclasses001b { + + static final String prefix = "**> debuggee: "; + static Log log; + + redefineclasses001b(Log log) { + this.log = log; + log.display(prefix + " This is the class to be redefine"); + } + + static int i1 = 0; + + static int bpline = 2; + + static void m2() { + i1 = 2; + i1 = 2; + } + + static void m1() { + log.display(prefix + "redefining method: before: m2()"); + m2(); + log.display(prefix + "redefining method: after: m2()"); + log.display(prefix + "redefining method: value of i1 == " + i1); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001a.java new file mode 100644 index 00000000000..9e80c9125b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001a.java @@ -0,0 +1,120 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the redefineclasses001 JDI test. + */ + +public class redefineclasses001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static redefineclasses001b objRF1; + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + objRF1 = new redefineclasses001b(log); + methodForCommunication(); + objRF1.m1(); + break ; + + case 1: + methodForCommunication(); + objRF1.m1(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001b.java new file mode 100644 index 00000000000..65c174b84e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001b.java @@ -0,0 +1,59 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This is the redefined class for the redefineclasses001 JDI test. + */ + +public class redefineclasses001b { + + static final String prefix = "**> debuggee: "; + static Log log; + + redefineclasses001b(Log log) { + this.log = log; + log.display(prefix + " This is the class to be redefined"); + } + + static int i1 = 0; + + static int bpline = 2; + + static void m2() { + i1 = 1; + i1 = 1; + } + + static void m1() { + log.display(prefix + "redefined method: before: m2()"); + m2(); + log.display(prefix + "redefined method: after: m2()"); + log.display(prefix + "redefined method: value of i1 == " + i1); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002.java new file mode 100644 index 00000000000..7182fa752ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002.java @@ -0,0 +1,322 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * The redefined methods will be used on new invokes.
    + * If resetting these frames is desired, use + * ThreadReference.popFrames(StackFrame) with + * Method.isObsolete().
    + * + * The test consits of the following files:
    + * redefineclasses002.java - debugger
    + * redefineclasses002a.java - initial debuggee
    + * newclass/redefineclasses002a.java - redefined debuggee
    + * + * + * This test performs the following steps:
    + * 1. Setting breakpoint at line of method, which will be redefined. + * This method has a local variable testedVar and the breakpoint + * is placed after it's initializing.
    + * 2. When breakpoint event is arrived, Debugger requests initial + * value of testedVar
    + * 3. While VM suspended Debugger redefines the tested method. + * It is added new line, after execution point. That line changes + * value of testedVar, different from initial-value.
    + * 4. While debugee remains suspending, debuger tries to get value of + * testedVar. In this case AbsentInformationException + * is expected.
    + * 5. Popping the active frame and trying to get value again. + * It is expected, method will be not found in active stack frames.
    + * 6. Setting breakpoint at line after the new one and resuming debugee.
    + * 7. Trying to get new value of testedVar. It is expected the last + * value will be different from initial-value.
    + * + * The test should be compiled with -g option, so cfg-file redefines + * JAVA_OPTS variable. + */ + +public class redefineclasses002 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses002"; + private final static String debugeeName = debuggerName + "a"; + private final static String newClass = "newclass" + + File.separator + prefix.replace('.',File.separatorChar) + + "redefineclasses002a.class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + + private ClassType testedClass; + + class MethodNotFoundException extends RuntimeException { + MethodNotFoundException (String msg) { + super(msg); + } + } + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses002 thisTest = new redefineclasses002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses002a.brkpMethodName, + redefineclasses002a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + BreakpointEvent brkpEvent = waitBreakpointEvent(brkp, waitTime); + + ThreadReference thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + IntegerValue val = readVariableValue(thread, brkpEvent.location().method(), + redefineclasses002a.testedVarName); + + if ( val.intValue() != redefineclasses002a.INITIAL_VALUE) { + complain("***UNEXPECTED value*** " + val); + exitStatus = Consts.TEST_FAILED; + } + + display(">redefining the Debugee class..."); + Map mapBytes = mapClassToBytes(testDir + File.separator + newClass); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canRedefineClasses()) { + complain("*** Warning: " + e); + complain("*** The test is considered as passed"); + return; + } + throw new TestBug(UNEXPECTED_STRING + e); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + Method method = null; + try { + display("thread location>" + thread.frame(0).location()); + method = thread.frame(0).location().method(); + } catch(IncompatibleThreadStateException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + val = readVariableValue(thread, method, redefineclasses002a.testedVarName); + + display(">frames is being popped..."); + try { + thread.popFrames(thread.frame(0)); + } catch (IncompatibleThreadStateException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + val = readVariableValue(thread, method, redefineclasses002a.testedVarName); + } catch (MethodNotFoundException e) { + display(EXPECTED_STRING + e + "\n"); + } + + brkp = debugee.setBreakpoint(testedClass, + redefineclasses002a.brkpMethodName, + redefineclasses002a.brkpLineNumber + 2); + debugee.resume(); + + brkpEvent = waitBreakpointEvent(brkp, waitTime); + + ThreadReference thrd = brkpEvent.thread(); + val = readVariableValue(thrd, brkpEvent.location().method(), + redefineclasses002a.testedVarName); + if ( val.intValue() != redefineclasses002a.REDEFINED_VALUE) { + complain("***UNEXPECTED value*** " + val); + exitStatus = Consts.TEST_FAILED; + } + + debugee.resume(); + + display("============="); + display("TEST FINISHES\n"); + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private IntegerValue readVariableValue(ThreadReference thrd, Method method, + String varName) { + String methodName = method.name(); + display(">getting value of local variable..."); + display("method name\t: " + methodName); + display("variable name\t: " + varName); + StackFrame stckFrm = null; + List frames = null; + try { + frames = thrd.frames(); + } catch (IncompatibleThreadStateException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + Iterator iterator = frames.iterator(); + boolean isMethodFound = false; + boolean isIntegerExpected = true; + IntegerValue res = null; + + while (iterator.hasNext()) { + stckFrm = (StackFrame )iterator.next(); + + if (stckFrm == null) + throw new TestBug("Not defined frame"); + if (method.equals(stckFrm.location().method())) { + isMethodFound = true; + try { + LocalVariable var = stckFrm.visibleVariableByName(varName); + res = (IntegerValue )stckFrm.getValue(var); + } catch (AbsentInformationException e) { + if (method.isObsolete()) { + display(EXPECTED_STRING + e + "\n"); + isIntegerExpected = false; + } + else + throw new TestBug(UNEXPECTED_STRING + e); + } + break; + } + } + if (!isMethodFound) + throw new MethodNotFoundException("Method :" + methodName + " not found"); + + if ( !(res instanceof IntegerValue) ) { + if (isIntegerExpected) + display("unexpected value\t: <" + res + ">\n"); + } else { + display(varName + " = " + res + "\n"); + } + + return res; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/TestDescription.java new file mode 100644 index 00000000000..443241b3c58 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses002. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * The redefined methods will be used on new invokes. + * If resetting these frames is desired, use + * ThreadReference.popFrames(StackFrame) with Method.isObsolete(). + * The test consists of the following files: + * redefineclasses002.java - debugger + * redefineclasses002a.java - initial debuggee + * newclass/redefineclasses002a.java - redefining debuggee + * This test performs the following steps: + * 1. Setting breakpoint at line of method, which will be redefined. + * This method has a local variable and the breakpoint + * is placed after it's initializing. + * 2. When breakpoint event is arrived, Debugger requests initial + * value of + * 3. While VM suspended Debugger redefines the tested method. + * It is added new line, after execution point. That line changes + * value of , different from initial-value. + * 4. While debugee remains suspending, debuger tries to get value of + * . In this case AbsentInformationException is expected. + * 5. Popping the active frame and trying to get value again. + * It is expected, method will be not found in active stack frames. + * 6. Setting breakpoint at line after the new one and resuming debugee. + * 7. Trying to get new value of . It is expected the last + * value will be different from initial-value. + * The test should be compiled with "-g" option, so cfg-file redefines + * JAVA_OPTS variable. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses002 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses002a + * + * @comment make sure redefineclasses002a is compiled with full debug info + * @clean nsk.jdi.VirtualMachine.redefineClasses.redefineclasses002a + * @compile -g:lines,source,vars ../redefineclasses002a.java + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses002 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/newclass/redefineclasses002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/newclass/redefineclasses002a.java new file mode 100644 index 00000000000..25b4340348c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/newclass/redefineclasses002a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses002a is deugee's part of the redefineclasses002. + */ +public class redefineclasses002a { + + public final static String testedVarName = "testedVar"; + + public final static String brkpMethodName = "redefinedMethod"; + public final static int brkpLineNumber = 77; + + public final static int INITIAL_VALUE = 0; + public final static int REDEFINED_VALUE = 1; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("continue")) { + runIt(); + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private static void runIt() { + redefineclasses002a obj = new redefineclasses002a(); + obj.redefinedMethod(); + } + + public void redefinedMethod() { + int testedVar = INITIAL_VALUE; // brkpLineNumber + log.display("redefinedMethod> breakpoint line"); + testedVar = REDEFINED_VALUE; + log.display("redefinedMethod> breakpoint line"); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002a.java new file mode 100644 index 00000000000..b5ddbc50899 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002a.java @@ -0,0 +1,81 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses002a is deugee's part of the redefineclasses002. + */ +public class redefineclasses002a { + + public final static String testedVarName = "testedVar"; + + public final static String brkpMethodName = "redefinedMethod"; + public final static int brkpLineNumber = 78; + + public final static int INITIAL_VALUE = 0; + public final static int REDEFINED_VALUE = 1; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("continue")) { + runIt(); + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private static void runIt() { + redefineclasses002a obj = new redefineclasses002a(); + obj.redefinedMethod(); + } + + public void redefinedMethod() { + int testedVar = INITIAL_VALUE; + log.display("redefinedMethod> breakpoint line"); // brkpLineNumber + // Let's try to insert code here + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003.java new file mode 100644 index 00000000000..dc3e5458dec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003.java @@ -0,0 +1,263 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test consits of the following files: + * redefineclasses003.java - debugger + * redefineclasses003a.java - initial debuggee + * newclass/redefineclasses003a.java - redefined debuggee + * + * When the test is starting debugee, debugger sets breakpoint at + * a line of method_A, where method_B is called. + * After the breakpoint is reached, debugger: + * - redefines debugee-class, that is inserting line after point of + * execution: log.display("new line"); + * - creates step request adding class filter + * - waits for a step event three times. + * + * In case, a step event didn't arrive from method_B, test fails. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + * + * The test should be compiled with -g option, so cfg-file redefines + * JAVA_OPTS variable. + */ + +public class redefineclasses003 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses003"; + private final static String debugeeName = debuggerName + "a"; + private final static String newClassFile = "newclass" + + File.separator + prefix.replace('.',File.separatorChar) + + "redefineclasses003a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String clsDir; + + private ClassType testedClass; + + class MethodNotFoundException extends RuntimeException { + MethodNotFoundException (String msg) { + super(msg); + } + } + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses003 thisTest = new redefineclasses003(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + clsDir = argv[0]; + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses003a.brkpMethodName, + redefineclasses003a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + Field fld = null; + + display("\nTEST BEGINS"); + display("==========="); + + display(">>> Static fields initialized by "); + checkFields(redefineclasses003a.INITIAL_VALUE); + redefineClass(clsDir + File.separator + newClassFile); + checkFields(redefineclasses003a.INITIAL_VALUE); + + display("\n>>> Static fields initialized by debugger"); + IntegerValue newValue = debugee.VM().mirrorOf(redefineclasses003a.ASSIGNED_VALUE); + for (int i = 0; i < redefineclasses003a.testedFields.length; i++) { + fld = testedClass.fieldByName(redefineclasses003a.testedFields[i]); + try { + ((ClassType )testedClass).setValue(fld, newValue); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + checkFields(redefineclasses003a.ASSIGNED_VALUE); + redefineClass(oldClassFile); + checkFields(redefineclasses003a.ASSIGNED_VALUE); + + display("\n>>> Static fields initialized by debuggee at runtime"); + brkp = debugee.setBreakpoint(testedClass, + redefineclasses003a.brkpMethodName, + redefineclasses003a.brkpLineNumber + 9); + debugee.resume(); + + waitBreakpointEvent(brkp, waitTime); + + checkFields(redefineclasses003a.REASSIGNED_VALUE); + redefineClass(clsDir + File.separator + newClassFile); + checkFields(redefineclasses003a.REASSIGNED_VALUE); + + debugee.resume(); + display("============="); + display("TEST FINISHES\n"); + } + + private void checkFields(int expectedValue) { + int value; + Field fld; + Value val; + for (int i = 0; i < redefineclasses003a.testedFields.length; i++) { + fld = testedClass.fieldByName(redefineclasses003a.testedFields[i]); + val = testedClass.getValue(fld); + value = ((IntegerValue )val).value(); + if (value != expectedValue) { + complain("Unexpected " + fld.name() + " = " + + redefineclasses003a.value2String(value)); + exitStatus = Consts.TEST_FAILED; + return; + } + display(fld.name() + " = " + redefineclasses003a.value2String(value)); + } + } + + private void redefineClass(String classFile) { + display(">redefining the Debugee class..."); + Map mapBytes = mapClassToBytes(classFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canRedefineClasses()) { + complain("*** Warning: " + e); + complain("*** The test is considered as passed"); + return; + } + throw new TestBug(UNEXPECTED_STRING + e); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/TestDescription.java new file mode 100644 index 00000000000..d7adf74d742 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses003. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "...redefining a class does not cause its initializers to be run. + * The values of preexisting static variables will remain as they + * were prior to the call." + * The test consists of the following files: + * redefineclasses003.java - debugger + * redefineclasses003a.java - initial debuggee + * newclass/redefineclasses003a.java - redefining debuggee + * The redefined debugee differs from the initial debuggee by static + * initializer only. + * This test performs the following cases: + * 1. Values of static fields are assigned by + * 2. Values of static fields are changed by debugger + * 3. Values of static fields are changed by debugee + * After changing values of static fields, debugger redefines + * and checks that no initializer are run. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses003 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses003a + * + * @comment make sure redefineclasses003a is compiled with full debug info + * @clean nsk.jdi.VirtualMachine.redefineClasses.redefineclasses003a + * @compile -g:lines,source,vars ../redefineclasses003a.java + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses003 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/newclass/redefineclasses003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/newclass/redefineclasses003a.java new file mode 100644 index 00000000000..8a94c1ed0fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/newclass/redefineclasses003a.java @@ -0,0 +1,100 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses003a is deugee's part of the redefineclasses003. + */ +public class redefineclasses003a { + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 60; + public final static int INITIAL_VALUE = 0; + public final static int REDEFINED_VALUE = 1; + public final static int ASSIGNED_VALUE = 2; + public final static int REASSIGNED_VALUE = 3; + public final static String[] testedFields = { + "Field_1", + "Field_2", + "Field_3" + }; + // tested fields + private static int Field_1; + protected static int Field_2; + public static int Field_3; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (instr.equals("continue")) { + Field_1 = REASSIGNED_VALUE; + Field_2 = REASSIGNED_VALUE; + Field_3 = REASSIGNED_VALUE; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static String value2String(int val) { + switch (val) { + case INITIAL_VALUE: + return "INITIAL_VALUE"; + case REDEFINED_VALUE: + return "REDEFINED_VALUE"; + case ASSIGNED_VALUE: + return "ASSIGNED_VALUE"; + case REASSIGNED_VALUE: + return "REASSIGNED_VALUE"; + } + return ""; + } + + static { + Field_1 = REDEFINED_VALUE; + Field_2 = REDEFINED_VALUE; + Field_3 = REDEFINED_VALUE; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003a.java new file mode 100644 index 00000000000..ceafadb1596 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003a.java @@ -0,0 +1,102 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses003a is deugee's part of the redefineclasses003. + */ +public class redefineclasses003a { + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 63; + + public final static int INITIAL_VALUE = 0; + public final static int REDEFINED_VALUE = 1; + public final static int ASSIGNED_VALUE = 2; + public final static int REASSIGNED_VALUE = 3; + public final static String[] testedFields = { + "Field_1", + "Field_2", + "Field_3" + }; + + // tested fields + private static int Field_1; + protected static int Field_2; + public static int Field_3; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("continue")) { // brkpLineNumber + Field_1 = REASSIGNED_VALUE; + Field_2 = REASSIGNED_VALUE; + Field_3 = REASSIGNED_VALUE; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static String value2String(int val) { + switch (val) { + case INITIAL_VALUE: + return "INITIAL_VALUE"; + case REDEFINED_VALUE: + return "REDEFINED_VALUE"; + case ASSIGNED_VALUE: + return "ASSIGNED_VALUE"; + case REASSIGNED_VALUE: + return "REASSIGNED_VALUE"; + } + return ""; + } + + static { + Field_1 = INITIAL_VALUE; + Field_2 = INITIAL_VALUE; + Field_3 = INITIAL_VALUE; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004.java new file mode 100644 index 00000000000..97987dc2e8e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004.java @@ -0,0 +1,251 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * changing the schema(the fields) will throw UnsupportedOperationException + * exception" + * + * The test consists of the following files:
    + * redefineclasses004.java - debugger
    + * redefineclasses004a.java - initial debuggee
    + * newclassXX/redefineclasses004a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding the fields
    + * 2. newclass02 - deleting the fields
    + * 3. newclass03 - changing field modifiers (adding static)
    + * 4. newclass04 - changing field modifiers (adding final)
    + * 5. newclass05 - changing field modifiers (adding transient)
    + * 6. newclass06 - changing field modifiers (adding volatile)
    + * 7. newclass07 - changing field modifiers (changing public to protected)
    + * 8. newclass08 - changing field modifiers (changing protected to private)
    + * 9. newclass09 - changing field modifiers (changing protected to public)
    + * 10. newclass10 - changing field modifiers (changing private to public)
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses004 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses004"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","adding the fields"}, + {"newclass02","deleting the fields"}, + {"newclass03","changing field modifiers (adding static)"}, + {"newclass04","changing field modifiers (adding final)"}, + {"newclass05","changing field modifiers (adding transient)"}, + {"newclass06","changing field modifiers (adding volatile)"}, + {"newclass07","changing field modifiers (changing public to protected"}, + {"newclass08","changing field modifiers (changing protected to private"}, + {"newclass09","changing field modifiers (changing protected to public)"}, + {"newclass10","changing field modifiers (changing private to public)"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses004a.class"; + private final static String oldClassFile = "classes" + + File.separator + prefix.replace('.',File.separatorChar) + + "redefineclasses004a.class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String clsDir; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses004 thisTest = new redefineclasses004(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + clsDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + display("\n\n<<>>"); + display("--------------------------"); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + display("\n\n<<>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + complain("***" + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(clsDir + File.separator + fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/TestDescription.java new file mode 100644 index 00000000000..950aa1c547d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses004. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, changing the schema + * (the fields) will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses004.java - debugger + * redefineclasses004a.java - initial debuggee + * newclassXX/redefineclasses004a.java - redefining debuggees + * This test performs the following cases: + * 1. newclass01 - adding the fields + * 2. newclass02 - deleting the fields + * 3. newclass03 - changing field modifiers (adding static) + * 4. newclass04 - changing field modifiers (adding final) + * 5. newclass05 - changing field modifiers (adding transient) + * 6. newclass06 - changing field modifiers (adding volatile) + * 7. newclass07 - changing field modifiers (changing public to protected) + * 8. newclass08 - changing field modifiers (changing protected to private) + * 9. newclass09 - changing field modifiers (changing protected to public) + * 10. newclass10 - changing field modifiers (changing private to public) + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses004 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses004a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 newclass05 newclass06 newclass07 newclass08 newclass09 newclass10 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses004 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass01/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass01/redefineclasses004a.java new file mode 100644 index 00000000000..8e56507bfa9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass01/redefineclasses004a.java @@ -0,0 +1,75 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing the schema (adding the fields) + */ + +public class redefineclasses004a { + + //preexisting fields + public Object field001; + protected Object field002; + private Object field003; + Object field004; + + static public Object field005 = null; + static protected Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + //new fields + public Object newField001; + protected Object newField002; + private Object newField003; + Object newField004; + + static public Object newField005; + static protected Object newField006; + static private Object newField007; + static Object newField008; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass02/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass02/redefineclasses004a.java new file mode 100644 index 00000000000..b799f6fc46b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass02/redefineclasses004a.java @@ -0,0 +1,55 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing the schema (deleting the fields) + */ + +public class redefineclasses004a { + + //preexisting fields + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass03/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass03/redefineclasses004a.java new file mode 100644 index 00000000000..ea9e4bc65e3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass03/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers - adding static + */ + +public class redefineclasses004a { + + //preexisting fields + static public Object field001; + static protected Object field002; + static private Object field003; + static Object field004; + + static public Object field005 = null; + static protected Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass04/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass04/redefineclasses004a.java new file mode 100644 index 00000000000..e38d4607fd6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass04/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (adding final) + */ + +public class redefineclasses004a { + + //preexisting fields + public Object field001; + protected Object field002; + private Object field003; + Object field004; + + static final public Object field005 = null; + static final protected Object field006 = null; + static final private Object field007 = null; + static final Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass05/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass05/redefineclasses004a.java new file mode 100644 index 00000000000..7fbccdd861e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass05/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (adding transient) + */ + +public class redefineclasses004a { + + //preexisting fields + transient public Object field001; + transient protected Object field002; + transient private Object field003; + transient Object field004; + + static public Object field005 = null; + static protected Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass06/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass06/redefineclasses004a.java new file mode 100644 index 00000000000..3b5f901e893 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass06/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (adding volatile) + */ + +public class redefineclasses004a { + + //preexisting fields + volatile public Object field001; + volatile protected Object field002; + volatile private Object field003; + volatile Object field004; + + static public Object field005 = null; + static protected Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass07/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass07/redefineclasses004a.java new file mode 100644 index 00000000000..6937a955c14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass07/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (changing public to protected) + */ + +public class redefineclasses004a { + + //preexisting fields + protected Object field001; + protected Object field002; + private Object field003; + Object field004; + + static protected Object field005 = null; + static protected Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass08/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass08/redefineclasses004a.java new file mode 100644 index 00000000000..bc1760df82a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass08/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (changing protected to private) + */ + +public class redefineclasses004a { + + //preexisting fields + public Object field001; + private Object field002; + private Object field003; + Object field004; + + static public Object field005 = null; + static private Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass09/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass09/redefineclasses004a.java new file mode 100644 index 00000000000..8436355817d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass09/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (changing private to public) + */ + +public class redefineclasses004a { + + //preexisting fields + public Object field001; + protected Object field002; + public Object field003; + Object field004; + + static public Object field005 = null; + static protected Object field006 = null; + static public Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass10/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass10/redefineclasses004a.java new file mode 100644 index 00000000000..bc1760df82a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/newclass10/redefineclasses004a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + * changing field modifiers (changing protected to private) + */ + +public class redefineclasses004a { + + //preexisting fields + public Object field001; + private Object field002; + private Object field003; + Object field004; + + static public Object field005 = null; + static private Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004a.java new file mode 100644 index 00000000000..8d25dbaba4f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004a.java @@ -0,0 +1,63 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses004a is deugee's part of the redefineclasses004. + */ + +public class redefineclasses004a { + + //preexisting fields + public Object field001; + protected Object field002; + private Object field003; + Object field004; + + static public Object field005 = null; + static protected Object field006 = null; + static private Object field007 = null; + static Object field008 = null; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005.java new file mode 100644 index 00000000000..c70a620b39e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005.java @@ -0,0 +1,263 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canAddMethod() is false attempting to add + * a method will throw UnsupportedOperationException exception." + * + * The test consists of the following files:
    + * redefineclasses005.java - debugger
    + * redefineclasses005a.java - initial debuggee
    + * newclassXX/redefineclasses005a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding a public method
    + * 2. newclass02 - adding a protected method
    + * 3. newclass03 - adding a private method
    + * 4. newclass04 - adding a private package method
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses005 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses005"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","adding a public method"}, + {"newclass02","adding a protected method"}, + {"newclass03","adding a private method"}, + {"newclass04","adding a private package method"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses005a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String clsDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses005 thisTest = new redefineclasses005(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + clsDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses005a.brkpMethodName, + redefineclasses005a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(clsDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canAddMethod()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canAddMethod()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/TestDescription.java new file mode 100644 index 00000000000..3ae0fe7ea93 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses005. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canAddMethod() is false attempting to add a method will throw + * UnsupportedOperationException exception." + * The test consists of the following files: + * redefineclasses005.java - debugger + * redefineclasses005a.java - initial debuggee + * newclassXX/redefineclasses005a.java - redefining debuggees + * This test performs the following cases: + * 1. newclass01 - adding a public method + * 2. newclass02 - adding a protected method + * 3. newclass03 - adding a private method + * 4. newclass04 - adding a private package method + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses005 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses005a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses005 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass01/redefineclasses005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass01/redefineclasses005a.java new file mode 100644 index 00000000000..8f27c9c5785 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass01/redefineclasses005a.java @@ -0,0 +1,79 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses005a is deugee's part of the redefineclasses005. + * adding a public method + */ +public class redefineclasses005a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void newMethod() { + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass02/redefineclasses005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass02/redefineclasses005a.java new file mode 100644 index 00000000000..ff8d591ee97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass02/redefineclasses005a.java @@ -0,0 +1,79 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses005a is deugee's part of the redefineclasses005. + * adding a protected method + */ +public class redefineclasses005a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 50; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + protected void newMethod() { + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass03/redefineclasses005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass03/redefineclasses005a.java new file mode 100644 index 00000000000..58341e74f0a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass03/redefineclasses005a.java @@ -0,0 +1,79 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses005a is deugee's part of the redefineclasses005. + * adding a private method + */ +public class redefineclasses005a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private void newMethod() { + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass04/redefineclasses005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass04/redefineclasses005a.java new file mode 100644 index 00000000000..34d79198f92 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/newclass04/redefineclasses005a.java @@ -0,0 +1,79 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses005a is deugee's part of the redefineclasses005. + * adding a private package method + */ +public class redefineclasses005a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 50; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + void newMethod() { + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005a.java new file mode 100644 index 00000000000..231b47bb3e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005a.java @@ -0,0 +1,75 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses005a is deugee's part of the redefineclasses005. + */ +public class redefineclasses005a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006.java new file mode 100644 index 00000000000..de6ff8afc22 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006.java @@ -0,0 +1,265 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to delete a method will throw UnsupportedOperationException + * exception." + * + * The test consists of the following files:
    + * redefineclasses006.java - debugger
    + * redefineclasses006a.java - initial debuggee
    + * newclassXX/redefineclasses006a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - deleting a public method
    + * 2. newclass02 - deleting a protected method
    + * 3. newclass03 - deleting a private method
    + * 4. newclass04 - deleting a private package method
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses006 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses006"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","deleting a public method"}, + {"newclass02","deleting a protected method"}, + {"newclass03","deleting a private method"}, + {"newclass04","deleting a private package method"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses006a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses006 thisTest = new redefineclasses006(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses006a.brkpMethodName, + redefineclasses006a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***" + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/TestDescription.java new file mode 100644 index 00000000000..35aacba6cce --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses006. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * delete a method will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses006.java - debugger + * redefineclasses006a.java - initial debuggee + * newclassXX/redefineclasses006a.java - redefining debuggees + * This test performs the following cases: + * 1. newclass01 - deleting a public method + * 2. newclass02 - deleting a protected method + * 3. newclass03 - deleting a private method + * 4. newclass04 - deleting a private package method + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses006 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses006a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses006 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass01/redefineclasses006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass01/redefineclasses006a.java new file mode 100644 index 00000000000..d95f5755484 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass01/redefineclasses006a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses006a is deugee's part of the redefineclasses006. + * deleting a public method + */ +public class redefineclasses006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass02/redefineclasses006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass02/redefineclasses006a.java new file mode 100644 index 00000000000..0dc5f253fef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass02/redefineclasses006a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses006a is deugee's part of the redefineclasses006. + * deleting a protected method + */ +public class redefineclasses006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass03/redefineclasses006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass03/redefineclasses006a.java new file mode 100644 index 00000000000..60fd3c0bda0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass03/redefineclasses006a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses006a is deugee's part of the redefineclasses006. + * deleting a private method + */ +public class redefineclasses006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass04/redefineclasses006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass04/redefineclasses006a.java new file mode 100644 index 00000000000..d338188510a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/newclass04/redefineclasses006a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses006a is deugee's part of the redefineclasses006. + * deleting a private package method + */ +public class redefineclasses006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006a.java new file mode 100644 index 00000000000..279c5b25398 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006a.java @@ -0,0 +1,75 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses006a is deugee's part of the redefineclasses006. + */ +public class redefineclasses006a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007.java new file mode 100644 index 00000000000..cd386c8ada7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007.java @@ -0,0 +1,276 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to change method modifiers will throw + * UnsupportedOperationException exception + * + * The test consists of the following files:
    + * redefineclasses007.java - debugger
    + * redefineclasses007a.java - initial debuggee
    + * newclassXX/redefineclasses007a.java - redefining debuggees
    + * + * Initial debugee-class has four dummy methods with different kind of accessibility: + * public, protected, private and + * default access (package private). + * This test performs the following cases:
    + * 1. adding modifiers to public method
    + * 2. adding modifiers to 4 methods
    + * 3. adding modifiers to public method
    + * 4. adding modifiers to 4 methods
    + * 5. adding modifiers to public method
    + * 6. adding modifiers to 4 methods
    + * 7. adding modifiers to public method
    + * 8. adding modifiers to 4 methods
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses007 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses007"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","adding modifiers to public method"}, + {"newclass02","adding modifiers to 4 methods"}, + {"newclass03","adding modifiers to public method"}, + {"newclass04","adding modifiers to 4 methods"}, + {"newclass05","adding modifiers to public method"}, + {"newclass06","adding modifiers to 4 methods"}, + {"newclass07","adding modifiers to public method"}, + {"newclass08","adding modifiers to 4 methods"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses007a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses007 thisTest = new redefineclasses007(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses007a.brkpMethodName, + redefineclasses007a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***" + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/TestDescription.java new file mode 100644 index 00000000000..d53762c0598 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses007. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * change method modifiers will throw UnsupportedOperationException + * exception" + * The test consists of the following files: + * redefineclasses007.java - debugger + * redefineclasses007a.java - initial debuggee + * newclassXX/redefineclasses007a.java - redefining debuggees + * Initial debugee-class has four dummy methods with different + * kind of accessibility: public, protected, private and + * default access (package private). + * This test performs the following cases: + * 1. newclass01 - adding modifiers to public method + * 2. newclass02 - adding modifiers to 4 methods + * 3. newclass03 - adding modifiers to public method + * 4. newclass04 - adding modifiers to 4 methods + * 5. newclass05 - adding modifiers to public method + * 6. newclass06 - adding modifiers to 4 methods + * 7. newclass07 - adding modifiers to public method + * 8. newclass08 - adding modifiers to 4 methods + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses007 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses007a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 newclass05 newclass06 newclass07 newclass08 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses007 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass01/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass01/redefineclasses007a.java new file mode 100644 index 00000000000..7f3530c82ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass01/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (1 method to static) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + static public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass02/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass02/redefineclasses007a.java new file mode 100644 index 00000000000..be4842b3092 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass02/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (4 methods to static) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + static public void dummyMethod01() { + } + + static protected void dummyMethod02() { + } + + static private void dummyMethod03() { + } + + static void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass03/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass03/redefineclasses007a.java new file mode 100644 index 00000000000..3e665456b47 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass03/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (1 method to final) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public final void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass04/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass04/redefineclasses007a.java new file mode 100644 index 00000000000..092bedb8124 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass04/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (4 methods to final) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + final public void dummyMethod01() { + } + + final protected void dummyMethod02() { + } + + final private void dummyMethod03() { + } + + final void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass05/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass05/redefineclasses007a.java new file mode 100644 index 00000000000..7f126200c45 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass05/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (to synchronized) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 50; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + synchronized public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass06/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass06/redefineclasses007a.java new file mode 100644 index 00000000000..cd7807e2adf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass06/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (4 methods to synchronized) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + synchronized public void dummyMethod01(){ + } + + synchronized protected void dummyMethod02(){ + } + + synchronized private void dummyMethod03(){ + } + + synchronized void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass07/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass07/redefineclasses007a.java new file mode 100644 index 00000000000..6dccb5cb496 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass07/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (1 method to strictfp) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + strictfp public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass08/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass08/redefineclasses007a.java new file mode 100644 index 00000000000..ca99ce12732 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/newclass08/redefineclasses007a.java @@ -0,0 +1,76 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + * changing method modifiers (4 methods to strictfp) + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + strictfp public void dummyMethod01(){ + } + + strictfp protected void dummyMethod02(){ + } + + strictfp private void dummyMethod03(){ + } + + strictfp void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007a.java new file mode 100644 index 00000000000..22e1d0dfb65 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007a.java @@ -0,0 +1,75 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses007a is deugee's part of the redefineclasses007. + */ +public class redefineclasses007a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } + + void dummyMethod04() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008.java new file mode 100644 index 00000000000..fee67914466 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008.java @@ -0,0 +1,274 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to change method modifiers will throw + * UnsupportedOperationException exception" + * + * The test consists of the following files:
    + * redefineclasses008.java - debugger
    + * redefineclasses008a.java - initial debuggee
    + * newclassXX/redefineclasses008a.java - redefining debuggees
    + * + * Initial debugee-class has three dummy methods with different + * kind of accessibility: public, protected and private (see COMMENTS into readme-file) + * This test performs the following cases:
    + * 1.newclass01 - adding modifiers to public method
    + * 2.newclass02 - adding modifiers to 3 methods
    + * 3.newclass03 - adding modifiers to public method
    + * 4.newclass04 - adding modifiers to 3 methods
    + * 5.newclass05 - adding modifiers to public method
    + * 6.newclass06 - adding modifiers to 3 methods
    + * 7.newclass07 - adding modifiers to public method
    + * 8.newclass08 - adding modifiers to 3 methods
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses008 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses008"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","adding modifiers to public method"}, + {"newclass02","adding modifiers to 3 methods"}, + {"newclass03","adding modifiers to public method"}, + {"newclass04","adding modifiers to 3 methods"}, + {"newclass05","adding modifiers to public method"}, + {"newclass06","adding modifiers to 3 methods"}, + {"newclass07","adding modifiers to public method"}, + {"newclass08","adding modifiers to 3 methods"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses008a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses008 thisTest = new redefineclasses008(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses008a.brkpMethodName, + redefineclasses008a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/TestDescription.java new file mode 100644 index 00000000000..087af8ea2b0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses008. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * change method modifiers will throw UnsupportedOperationException + * exception" + * The test consists of the following files: + * redefineclasses008.java - debugger + * redefineclasses008a.java - initial debuggee + * newclassXX/redefineclasses008a.java - redefining debuggees + * Initial debugee-class has three dummy methods with different + * kind of accessibility: public, protected and private (see COMMENTS) + * This test performs the following cases: + * 1. newclass01 - adding modifiers to public method + * 2. newclass02 - adding modifiers to 3 methods + * 3. newclass03 - adding modifiers to public method + * 4. newclass04 - adding modifiers to 3 methods + * 5. newclass05 - adding modifiers to public method + * 6. newclass06 - adding modifiers to 3 methods + * 7. newclass07 - adding modifiers to public method + * 8. newclass08 - adding modifiers to 3 methods + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * This test looks like redefinclasses07 and differs from redefinclasses07 + * that default access (package private) is excluded from examintation. + * There are no differs except the one. It was observed, count and + * accessibility of the methods affect the test behaviour. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses008 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses008a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 newclass05 newclass06 newclass07 newclass08 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses008 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass01/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass01/redefineclasses008a.java new file mode 100644 index 00000000000..4cd288f0756 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass01/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (1 method to static) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + static public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass02/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass02/redefineclasses008a.java new file mode 100644 index 00000000000..4396922ca62 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass02/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (3 methods to static) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + static public void dummyMethod01() { + } + + static protected void dummyMethod02() { + } + + static private void dummyMethod03() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass03/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass03/redefineclasses008a.java new file mode 100644 index 00000000000..ac9dc5694ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass03/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (1 method to final) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public final void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass04/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass04/redefineclasses008a.java new file mode 100644 index 00000000000..c65b3f4ca73 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass04/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (3 methods to final) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + final public void dummyMethod01() { + } + + final protected void dummyMethod02() { + } + + final private void dummyMethod03() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass05/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass05/redefineclasses008a.java new file mode 100644 index 00000000000..51acebb8384 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass05/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (to synchronized) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 50; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + synchronized public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass06/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass06/redefineclasses008a.java new file mode 100644 index 00000000000..a92f0b5f591 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass06/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (3 methods to synchronized) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + synchronized public void dummyMethod01(){ + } + + synchronized protected void dummyMethod02(){ + } + + synchronized private void dummyMethod03(){ + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass07/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass07/redefineclasses008a.java new file mode 100644 index 00000000000..b48ead051d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass07/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (1 method to strictfp) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + strictfp public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass08/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass08/redefineclasses008a.java new file mode 100644 index 00000000000..13330e1ab14 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/newclass08/redefineclasses008a.java @@ -0,0 +1,73 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + * changing method modifiers (3 methods to strictfp) + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + strictfp public void dummyMethod01(){ + } + + strictfp protected void dummyMethod02(){ + } + + strictfp private void dummyMethod03(){ + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008a.java new file mode 100644 index 00000000000..591f8e77067 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008a.java @@ -0,0 +1,72 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses008a is deugee's part of the redefineclasses008. + */ +public class redefineclasses008a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public void dummyMethod01() { + } + + protected void dummyMethod02() { + } + + private void dummyMethod03() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009.java new file mode 100644 index 00000000000..17bdee16578 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009.java @@ -0,0 +1,262 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to change constructor modifiers will throw + * UnsupportedOperationException exception" + * + * The test consists of the following files:
    + * redefineclasses009.java - debugger
    + * redefineclasses009a.java - initial debuggee
    + * newclassXX/redefineclasses009a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1.newclass01 - adding modifier to constructor
    + * 2.newclass02 - adding modifier to constructor
    + * 3.newclass03 - adding modifier to constructor
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses009 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses009"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","adding modifier to constructor"}, + {"newclass02","adding modifier to constructor"}, + {"newclass03","adding modifier to constructor"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses009a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses009 thisTest = new redefineclasses009(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses009a.brkpMethodName, + redefineclasses009a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/TestDescription.java new file mode 100644 index 00000000000..5a545224f11 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses009. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * change constructor modifiers will throw UnsupportedOperationException + * exception" + * The test consists of the following files: + * redefineclasses009.java - debugger + * redefineclasses009a.java - initial debugee + * newclassXX/redefineclasses009a.java - redefining debugees + * This test performs the following cases: + * 1. newclass01 - adding modifier to constructor + * 2. newclass02 - adding modifier to constructor + * 3. newclass03 - adding modifier to constructor + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * This test looks like redefinclasses07 and differs from redefinclasses07 + * that default access (package private) is excluded from examintation. + * There are no differs except the one. It was observed, count and + * accessibility of the methods affect the test behaviour. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses009 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses009a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses009 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass01/redefineclasses009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass01/redefineclasses009a.java new file mode 100644 index 00000000000..db8fc9a904e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass01/redefineclasses009a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses009a is deugee's part of the redefineclasses009. + */ +public class redefineclasses009a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public redefineclasses009a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass02/redefineclasses009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass02/redefineclasses009a.java new file mode 100644 index 00000000000..659551a4d6c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass02/redefineclasses009a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses009a is deugee's part of the redefineclasses009. + */ +public class redefineclasses009a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + protected redefineclasses009a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass03/redefineclasses009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass03/redefineclasses009a.java new file mode 100644 index 00000000000..827c2ac71f0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/newclass03/redefineclasses009a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses009a is deugee's part of the redefineclasses009. + */ +public class redefineclasses009a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private redefineclasses009a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009a.java new file mode 100644 index 00000000000..0b428e18466 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses009a is deugee's part of the redefineclasses009. + */ +public class redefineclasses009a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + redefineclasses009a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010.java new file mode 100644 index 00000000000..740e38485fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010.java @@ -0,0 +1,264 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to delete constructor will throw + * UnsupportedOperationException exception" + * + * The test consists of the following files:
    + * redefineclasses010.java - debugger
    + * redefineclasses010a.java - initial debuggee
    + * newclassXX/redefineclasses010a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1.newclass01 - deleting constructor
    + * 2.newclass02 - deleting constructor
    + * 3.newclass03 - deleting constructor
    + * 4.newclass04 - deleting constructor
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses010 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses010"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","deleting constructor"}, + {"newclass02","deleting constructor"}, + {"newclass03","deleting constructor"}, + {"newclass04","deleting constructor"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses010a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses010 thisTest = new redefineclasses010(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses010a.brkpMethodName, + redefineclasses010a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/TestDescription.java new file mode 100644 index 00000000000..5a5297e67a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses010. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * delete constructor will throw UnsupportedOperationException + * exception" + * The test consists of the following files: + * redefineclasses010.java - debugger + * redefineclasses010a.java - initial debugee + * newclassXX/redefineclasses010a.java - redefining debugees + * This test performs the following cases: + * 1. newclass01 - deleting constructor + * 2. newclass02 - deleting constructor + * 3. newclass03 - deleting constructor + * 4. newclass04 - deleting constructor + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses010 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses010a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses010 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass01/redefineclasses010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass01/redefineclasses010a.java new file mode 100644 index 00000000000..06eb341b4f2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass01/redefineclasses010a.java @@ -0,0 +1,72 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses010a is deugee's part of the redefineclasses010. + */ +public class redefineclasses010a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + protected redefineclasses010a(Object par) { + } + + private redefineclasses010a(Object par1, Object par2) { + } + + redefineclasses010a(Object par1, Object par2, Object par3) { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass02/redefineclasses010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass02/redefineclasses010a.java new file mode 100644 index 00000000000..68343dedc95 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass02/redefineclasses010a.java @@ -0,0 +1,72 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses010a is deugee's part of the redefineclasses010. + */ +public class redefineclasses010a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public redefineclasses010a() { + } + + private redefineclasses010a(Object par1, Object par2) { + } + + redefineclasses010a(Object par1, Object par2, Object par3) { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass03/redefineclasses010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass03/redefineclasses010a.java new file mode 100644 index 00000000000..724d1f4916f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass03/redefineclasses010a.java @@ -0,0 +1,72 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses010a is deugee's part of the redefineclasses010. + */ +public class redefineclasses010a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public redefineclasses010a() { + } + + protected redefineclasses010a(Object par) { + } + + redefineclasses010a(Object par1, Object par2, Object par3) { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass04/redefineclasses010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass04/redefineclasses010a.java new file mode 100644 index 00000000000..248bdd1bb1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/newclass04/redefineclasses010a.java @@ -0,0 +1,72 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses010a is deugee's part of the redefineclasses010. + */ +public class redefineclasses010a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public redefineclasses010a() { + } + + protected redefineclasses010a(Object par) { + } + + private redefineclasses010a(Object par1, Object par2) { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010a.java new file mode 100644 index 00000000000..7d4ceacb898 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010a.java @@ -0,0 +1,75 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses010a is deugee's part of the redefineclasses010. + */ +public class redefineclasses010a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public redefineclasses010a() { + } + + protected redefineclasses010a(Object par) { + } + + private redefineclasses010a(Object par1, Object par2) { + } + + redefineclasses010a(Object par1, Object par2, Object par3) { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011.java new file mode 100644 index 00000000000..28d9a53f272 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011.java @@ -0,0 +1,300 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to add a constructor will throw + * UnsupportedOperationException exception" + * + * The test consists of the following files:
    + * redefineclasses011.java - debugger
    + * redefineclasses011a.java - initial debuggee
    + * newclassXX/redefineclasses011a.java - redefining debuggees
    + * + * Initial debugee-class has four dummy methods with different + * kind of accessibility: public, protected and private (see COMMENTS into readme-file) + * This test performs the following cases:
    + * 1.newclass01 - adding constructor
    + * 2.newclass02 - adding constructor
    + * 3.newclass03 - adding constructor
    + * 4.newclass04 - adding constructor
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses011 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses011"; + private final static String debugeeName = debuggerName + "a"; + + private final static String[][] subDirs = { + {"newclass01","adding constructor"}, + {"newclass02","adding constructor"}, + {"newclass03","adding constructor"}, + {"newclass04","adding constructor"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses011a.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(debugeeName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses011 thisTest = new redefineclasses011(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + debugee.sendSignal("continue"); + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + testedClass = (ClassType)debugee.classByName(debugeeName); + display("Tested class\t:" + testedClass.name()); + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + redefineclasses011a.brkpMethodName, + redefineclasses011a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal("continue"); + + waitBreakpointEvent(brkp, waitTime); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + + /* adding an explicit public ctor into a public class without + constructor declarations. + The JLS 2nd ed. says: + "8.8.7 Default Constructor + If a class contains no constructor declarations, then a + default constructor that takes no parameters is automatically + provided. + ... + If the class is declared public, then the default constructor + is implicitly given the access modifier public (6.6)" + + So, no exception is expected. + */ + display("\n" + subDirs[0][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [0][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + + display(">check passed: class file redefinition done successfully" + + "\n>return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } catch(Exception e) { + complain("***Unexpected " + e +" is thrown" + + "\n***\twhile " + subDirs[0][1]); + exitStatus = Consts.TEST_FAILED; + } + + // adding an explicit ctor with different access modifiers + for (int i = 1; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canAddMethod()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canAddMethod()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + display(">waiting breakpoint event..."); + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new TestBug("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/TestDescription.java new file mode 100644 index 00000000000..fb3bd40fdfe --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/TestDescription.java @@ -0,0 +1,90 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses011. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * add a constructor will throw UnsupportedOperationException + * exception" + * The test consists of the following files: + * redefineclasses011.java - debugger + * redefineclasses011a.java - initial debugee + * newclassXX/redefineclasses011a.java - redefining debugees + * This test performs the following cases: + * 1. newclass01 - adding an explicit constructor into a public + * class without constructor declarations. No exception is expected: + * the JLS 2nd ed. says: + * "8.8.7 Default Constructor + * If a class contains no constructor declarations, then a + * default constructor that takes no parameters is automatically + * provided. + * ... + * If the class is declared public, then the default constructor + * is implicitly given the access modifier public (6.6)" + * 2. newclass02 - adding constructor into a public class + * without constructor declarations, exception may occure + * 3. newclass03 - adding constructor into a public class + * without constructor declarations, exception may occure + * 4. newclass04 - adding constructor into a public class + * without constructor declarations, exception may occure + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * The test was fixed due to the following bug: + * 4762721 TEST_BUG: Some tests for RedefineClasses erroneously change + * ctor modifier + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses011 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses011a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses011 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass01/redefineclasses011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass01/redefineclasses011a.java new file mode 100644 index 00000000000..92bd1c596d6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass01/redefineclasses011a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses011a is deugee's part of the redefineclasses011. + */ +public class redefineclasses011a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public redefineclasses011a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass02/redefineclasses011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass02/redefineclasses011a.java new file mode 100644 index 00000000000..85068514d65 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass02/redefineclasses011a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses011a is deugee's part of the redefineclasses011. + */ +public class redefineclasses011a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + protected redefineclasses011a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass03/redefineclasses011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass03/redefineclasses011a.java new file mode 100644 index 00000000000..0ce5a6023c0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass03/redefineclasses011a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses011a is deugee's part of the redefineclasses011. + */ +public class redefineclasses011a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + private redefineclasses011a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass04/redefineclasses011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass04/redefineclasses011a.java new file mode 100644 index 00000000000..9d91baa0154 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/newclass04/redefineclasses011a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses011a is deugee's part of the redefineclasses011. + */ +public class redefineclasses011a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 48; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); // brkpLineNumber + if (!instr.equals("continue")) { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + redefineclasses011a() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011a.java new file mode 100644 index 00000000000..ba9a9a63239 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011a.java @@ -0,0 +1,63 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses011a is deugee's part of the redefineclasses011. + */ +public class redefineclasses011a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 49; + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (!instr.equals("continue")) { // brkpLineNumber + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012.java new file mode 100644 index 00000000000..b5490cbbfd7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012.java @@ -0,0 +1,247 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * changing the schema(the fields) will throw UnsupportedOperationException + * exception" + * This test looks like redefineclasses004 and checks the assertion + * against interfaces. + * + * The test consists of the following files:
    + * redefineclasses012.java - debugger
    + * redefineclasses012a.java - initial debuggee
    + * newclassXX/redefineclasses012a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding the fields
    + * 2. newclass02 - deleting the fields
    + * 3. newclass03 - adding modifier
    + * 4. newclass04 - adding modifier
    + * 5. newclass05 - changing modifier to
    + * 6. newclass06 - changing modifier to
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses012 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses012"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","adding the fields"}, + {"newclass02","deleting the fields"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses012b.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType debugeeClass, testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses012 thisTest = new redefineclasses012(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + debugeeClass = debugee.classByName(debugeeName); + testedClass = debugee.classByName(testedClassName); + display("Tested class\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***" + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/TestDescription.java new file mode 100644 index 00000000000..7a075502631 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses012. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, changing the schema + * (the fields) will throw UnsupportedOperationException exception" + * This test looks like redefineclasses004 and checks the assertion + * against interfaces. + * The test consists of the following files: + * redefineclasses012.java - debugger + * redefineclasses012a.java - debuggee + * redefineclasses012b.java - an initial redefined class + * newclassXX/redefineclasses012b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - adding the fields + * 2. newclass02 - deleting the fields + * 3. newclass03 - adding modifier + * 4. newclass04 - adding modifier + * 5. newclass05 - changing modifier to + * 6. newclass06 - changing modifier to + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses012 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses012a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses012 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/newclass01/redefineclasses012b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/newclass01/redefineclasses012b.java new file mode 100644 index 00000000000..d005e19ae83 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/newclass01/redefineclasses012b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses012b is deugee's part of the redefineclasses012. + * adding new field + */ + +public interface redefineclasses012b { + + //new fields + static public final Object newField001 = null; + + //preexisting fields + static public final Object field001 = null; + public final Object field002 = null; + final Object field003 = null; + Object field004 = null; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/newclass02/redefineclasses012b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/newclass02/redefineclasses012b.java new file mode 100644 index 00000000000..56bb1fc0032 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/newclass02/redefineclasses012b.java @@ -0,0 +1,38 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses012b is deugee's part of the redefineclasses012. + * deleting fields + */ + +public interface redefineclasses012b { + + //preexisting fields +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012a.java new file mode 100644 index 00000000000..017eee1a0cd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012a.java @@ -0,0 +1,56 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses012a is deugee's part of the redefineclasses012. + */ + +public class redefineclasses012a { + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + redefineclasses012bc obj = new redefineclasses012bc(); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class redefineclasses012bc implements redefineclasses012b { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012b.java new file mode 100644 index 00000000000..53e2b150244 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012b.java @@ -0,0 +1,41 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses012b is deugee's part of the redefineclasses012. + */ + +public interface redefineclasses012b { + + //preexisting fields + static public final Object field001 = null; + public final Object field002 = null; + final Object field003 = null; + Object field004 = null; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013.java new file mode 100644 index 00000000000..beb100e86d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013.java @@ -0,0 +1,281 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canAddMethod() is false attempting to add + * a method will throw UnsupportedOperationException exception." + * This test looks like redefineclasses005 and checks the assertion + * against interfaces. + * + * The test consists of the following files:
    + * redefineclasses013.java - debugger
    + * redefineclasses013a.java - initial debuggee
    + * newclassXX/redefineclasses013a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding new method declared as
    + * abstract public void newMethod()
    + * 2. newclass02 - adding new method declared as
    + * public void newMethod()
    + * 3. newclass03 - adding new method declared as
    + * void newMethod()
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses013 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses013"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","adding \"abstract public void newMethod()\""}, + {"newclass02","adding \"public void newMethod()\""}, + {"newclass03","adding \"void newMethod()\""} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses013b.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses013 thisTest = new redefineclasses013(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + ClassPrepareRequest clpr = debugee.getEventRequestManager().createClassPrepareRequest(); + clpr.addClassFilter(testedClassName); + clpr.enable(); + + debugee.sendSignal("load_class"); + + ClassPrepareEvent clpEvent = waitClassPrepareEvent(clpr, waitTime); + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canAddMethod()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canAddMethod()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private ClassPrepareEvent waitClassPrepareEvent(ClassPrepareRequest clpr, long waitTime) { + Event event; + display(">waiting class prepare event..."); + try { + event = debugee.waitingEvent(clpr, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof ClassPrepareEvent )) { + throw new TestBug("ClassPrepareEvent didn't arrive"); + } + + return (ClassPrepareEvent )event; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/TestDescription.java new file mode 100644 index 00000000000..29dc5cba634 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses013. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canAddMethod() is false attempting to add a method will throw + * UnsupportedOperationException exception." + * This test looks like redefineclasses005 and checks the assertion + * against interfaces. + * The test consists of the following files: + * redefineclasses013.java - debugger + * redefineclasses013a.java - debuggee + * redefineclasses013b.java - an initial redefined class + * newclassXX/redefineclasses013b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - adding new method declared as + * "abstract public void newMethod()" + * 2. newclass02 - adding new method declared as "public void newMethod()" + * 3. newclass03 - adding new method declared as "void newMethod()" + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses013 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses013a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses013 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/src/hotspot/share/classfile/systemDictionary_ext.hpp b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass01/redefineclasses013b.java similarity index 61% rename from src/hotspot/share/classfile/systemDictionary_ext.hpp rename to test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass01/redefineclasses013b.java index 6d257cd09e9..fffb19a1263 100644 --- a/src/hotspot/share/classfile/systemDictionary_ext.hpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass01/redefineclasses013b.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. + * 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 @@ -19,23 +19,26 @@ * 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. - * */ -#ifndef SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_EXT_HPP -#define SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_EXT_HPP +package nsk.jdi.VirtualMachine.redefineClasses; -#if INCLUDE_CDS +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; -#define WK_KLASSES_DO_EXT(do_klass) \ - /* well-known classes */ \ - do_klass(jdk_internal_loader_ClassLoaders_klass, jdk_internal_loader_ClassLoaders, Pre ) \ - /*end*/ +/** + * redefineclasses013b is deugee's part of the redefineclasses013. + * adding new method declared as abstract public void newMethod() + */ -#else +public interface redefineclasses013b { -#define WK_KLASSES_DO_EXT(do_klass) + abstract public void newMethod(); -#endif // INCLUDE_CDS + abstract public void dummyMethod01(); -#endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_EXT_HPP + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass02/redefineclasses013b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass02/redefineclasses013b.java new file mode 100644 index 00000000000..6cadc886333 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass02/redefineclasses013b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses013b is deugee's part of the redefineclasses013. + * adding new method declared as public void newMethod() + */ + +public interface redefineclasses013b { + + public void newMethod(); + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass03/redefineclasses013b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass03/redefineclasses013b.java new file mode 100644 index 00000000000..7e6d6c74f76 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/newclass03/redefineclasses013b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses013b is deugee's part of the redefineclasses013. + * adding new method declared as void newMethod() + */ + +public interface redefineclasses013b { + + void newMethod(); + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013a.java new file mode 100644 index 00000000000..e5c19184561 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013a.java @@ -0,0 +1,67 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses013a is deugee's part of the redefineclasses013. + */ + +public class redefineclasses013a { + + 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 instr = pipe.readln(); + if (instr.equals("load_class")) { + // to force ClassPrepareEvent, change value of this field + redefineclasses013bc.classPrepare = true; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + +} + +abstract class redefineclasses013bc implements redefineclasses013b { + // to force ClassPrepareEvent, change value of this field + static boolean classPrepare; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013b.java new file mode 100644 index 00000000000..46fc7f2aa09 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013b.java @@ -0,0 +1,41 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses013b is deugee's part of the redefineclasses013. + */ + +public interface redefineclasses013b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014.java new file mode 100644 index 00000000000..7f5e2ec4c57 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014.java @@ -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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to delete a method will throw UnsupportedOperationException + * exception." + * This test looks like redefineclasses006 and checks the assertion + * against interfaces. + * + * The test consists of the following files:
    + * redefineclasses014.java - debugger
    + * redefineclasses014a.java - initial debuggee
    + * newclassXX/redefineclasses014a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - deleting method declared as abstract
    + * abstract public void dummyMethod01()
    + * 2. newclass02 - deleting method declared as
    + * public void dummyMethod02()
    + * 3. newclass03 - deleting method declared as
    + * void dummyMethod03()
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses014 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses014"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","deleting \"abstract public void dummyMethod01()\""}, + {"newclass02","deleting \"public void dummyMethod02()\""}, + {"newclass03","deleting \"void dummyMethod03()\""} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses014b.class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses014 thisTest = new redefineclasses014(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + ClassPrepareRequest clpr = debugee.getEventRequestManager().createClassPrepareRequest(); + clpr.addClassFilter(testedClassName); + clpr.enable(); + + debugee.sendSignal("load_class"); + + ClassPrepareEvent clpEvent = waitClassPrepareEvent(clpr, waitTime); + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canAddMethod()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canAddMethod()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private ClassPrepareEvent waitClassPrepareEvent(ClassPrepareRequest clpr, long waitTime) { + Event event; + display(">waiting class prepare event..."); + try { + event = debugee.waitingEvent(clpr, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof ClassPrepareEvent )) { + throw new TestBug("ClassPrepareEvent didn't arrive"); + } + + return (ClassPrepareEvent )event; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/TestDescription.java new file mode 100644 index 00000000000..5e151ea7fac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses014. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * delete a method will throw UnsupportedOperationException exception" + * This test looks like redefineclasses006 and checks the assertion + * against interfaces. + * The test consists of the following files: + * redefineclasses014.java - debugger + * redefineclasses014a.java - debuggee + * redefineclasses014b.java - an initial redefined class + * newclassXX/redefineclasses014b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - deleting a public method + * 2. newclass02 - deleting a private package method + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses014 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses014a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses014 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass01/redefineclasses014b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass01/redefineclasses014b.java new file mode 100644 index 00000000000..cdd7fa32342 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass01/redefineclasses014b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses014b is deugee's part of the redefineclasses014. + * deleting method declared as abstract abstract public void dummyMethod01() + */ + +public interface redefineclasses014b { + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass02/redefineclasses014b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass02/redefineclasses014b.java new file mode 100644 index 00000000000..be09cd35093 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass02/redefineclasses014b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses014b is deugee's part of the redefineclasses014. + * deleting method declared as public void dummyMethod02() + */ + +public interface redefineclasses014b { + + abstract public void dummyMethod01(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass03/redefineclasses014b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass03/redefineclasses014b.java new file mode 100644 index 00000000000..30561f15e29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/newclass03/redefineclasses014b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses014b is deugee's part of the redefineclasses014. + * deleting method declared as void dummyMethod03() + */ + +public interface redefineclasses014b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014a.java new file mode 100644 index 00000000000..0354af09f7f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014a.java @@ -0,0 +1,67 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses014a is deugee's part of the redefineclasses014. + */ + +public class redefineclasses014a { + + 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 instr = pipe.readln(); + if (instr.equals("load_class")) { + // to force ClassPrepareEvent, change value of this field + redefineclasses014bc.classPrepare = true; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + +} + +abstract class redefineclasses014bc implements redefineclasses014b { + // to force ClassPrepareEvent, change value of this field + static boolean classPrepare; + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014b.java new file mode 100644 index 00000000000..7ac2493aba1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014b.java @@ -0,0 +1,41 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses014b is deugee's part of the redefineclasses014. + */ + +public interface redefineclasses014b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015.java new file mode 100644 index 00000000000..9c1596b5e52 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015.java @@ -0,0 +1,281 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * attempting to change a method will throw UnsupportedOperationException + * exception"
    + * On debugee part there is an interface that has three method declarations:
    + * abstract public void dummyMethod01();
    + * public void dummyMethod02();
    + * void dummyMethod03();
    + * JLSS 9.4 says "...every method declaration in the body of an interface is + * implicitly abstract..." and "...every method declaration in the body + * of an interface is implicitly public..." + * The test tries to redefine this interface, manipulating modifiers of + * these methods, and expects UnsupportedOperationException will not be thrown. + * + * The test consists of the following files:
    + * redefineclasses015.java - debugger
    + * redefineclasses015a.java - initial debuggee
    + * newclassXX/redefineclasses015a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - deleting abstract modifier from + * abstract public void dummyMethod01()
    + * 2. newclass02 - deleting public modifier from + * abstract public void dummyMethod01()
    + * 3. newclass03 - deleting abstract,public modifiers from + * abstract public void dummyMethod01()
    + * 4. newclass04 - deleting public modifier from + * public void dummyMethod02()
    + * 5. newclass05 - adding abstract modifier to + * public void dummyMethod02()
    + * 6. newclass06 - adding abstract modifier to + * void dummyMethod03()
    + * 7. newclass07 - adding public modifier to + * void dummyMethod03()
    + * 8. newclass08 - adding abstract,public modifiers to + * void dummyMethod03()
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses015 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses015"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","deleting modifier from \"abstract public void dummyMethod01()\""}, + {"newclass02","deleting modifier from \"abstract public void dummyMethod01()\""}, + {"newclass03","deleting , modifiers from \"abstract public void dummyMethod01()\""}, + {"newclass04","deleting modifier from \"public void dummyMethod02()\""}, + {"newclass05","adding modifier to \"public void dummyMethod02()\""}, + {"newclass06","adding modifier to \"void dummyMethod03()\""}, + {"newclass07","adding modifier to \"void dummyMethod03()\""}, + {"newclass08","adding , modifiers to \"void dummyMethod03()\""} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses015b.class"; + + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses015 thisTest = new redefineclasses015(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + ClassPrepareRequest clpr = debugee.getEventRequestManager().createClassPrepareRequest(); + clpr.addClassFilter(testedClassName); + clpr.enable(); + + debugee.sendSignal("load_class"); + + ClassPrepareEvent clpEvent = waitClassPrepareEvent(clpr, waitTime); + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + display("REDEFINED"); + } catch (UnsupportedOperationException e) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private ClassPrepareEvent waitClassPrepareEvent(ClassPrepareRequest clpr, long waitTime) { + Event event; + display(">waiting class prepare event..."); + try { + event = debugee.waitingEvent(clpr, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof ClassPrepareEvent )) { + throw new TestBug("ClassPrepareEvent didn't arrive"); + } + + return (ClassPrepareEvent )event; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/TestDescription.java new file mode 100644 index 00000000000..d6d2b048b9f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/TestDescription.java @@ -0,0 +1,95 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses015. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, attempting to + * change a method will throw UnsupportedOperationException exception" + * On debugee part there is an interface that has three method declarations: + * abstract public void dummyMethod01(); + * public void dummyMethod02(); + * void dummyMethod03(); + * JLSS 9.4 says "...every method declaration in the body of an interface is + * implicitly abstract..." and "...every method declaration in the body + * of an interface is implicitly public..." + * The test tries to redefine this interface, manipulating modifiers of + * these methods, and expects UnsupportedOperationException will not be + * thrown. + * The test consists of the following files: + * redefineclasses015.java - debugger + * redefineclasses015a.java - debuggee + * redefineclasses015b.java - an initial redefined class + * newclassXX/redefineclasses015b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - deleting modifier from + * "abstract public void dummyMethod01()" + * 2. newclass02 - deleting modifier from + * "abstract public void dummyMethod01()" + * 3. newclass03 - deleting , modifiers from + * "abstract public void dummyMethod01()" + * 4. newclass04 - deleting modifier from + * "public void dummyMethod02()" + * 5. newclass05 - adding modifier to + * "public void dummyMethod02()" + * 6. newclass06 - adding modifier to "void dummyMethod03()" + * 7. newclass07 - adding modifier to "void dummyMethod03()" + * 8. newclass08 - adding , modifiers to + * "void dummyMethod03()" + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses015 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses015a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 newclass05 newclass06 newclass07 newclass08 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses015 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass01/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass01/redefineclasses015b.java new file mode 100644 index 00000000000..520cda12f0e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass01/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * deleting abstract modifier from + * abstract public void dummyMethod01() + */ + +public interface redefineclasses015b { + +// ======== + public void dummyMethod01(); +// ======== + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass02/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass02/redefineclasses015b.java new file mode 100644 index 00000000000..2b80ab4793b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass02/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * deleting public modifier from + * abstract public void dummyMethod01() + */ + +public interface redefineclasses015b { + +// ====== + abstract void dummyMethod01(); +// ====== + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass03/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass03/redefineclasses015b.java new file mode 100644 index 00000000000..c8bbf14d4db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass03/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * deleting abstract public modifiers from + * abstract public void dummyMethod01() + */ + +public interface redefineclasses015b { + +// =============== + void dummyMethod01(); +// =============== + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass04/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass04/redefineclasses015b.java new file mode 100644 index 00000000000..bc131ca901e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass04/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * deleting public modifier from + * public void dummyMethod02() + */ + +public interface redefineclasses015b { + + abstract public void dummyMethod01(); + +// ====== + void dummyMethod02(); +// ====== + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass05/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass05/redefineclasses015b.java new file mode 100644 index 00000000000..73b64ff0ddb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass05/redefineclasses015b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * adding abstract modifier to + * public void dummyMethod02() + */ + +public interface redefineclasses015b { + + abstract public void dummyMethod01(); + +// ======== + abstract public void dummyMethod02(); +// ======== + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass06/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass06/redefineclasses015b.java new file mode 100644 index 00000000000..4af3c14b0bf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass06/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * adding abstract modifier to + * void dummyMethod03() + */ + +public interface redefineclasses015b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + +// ======== + abstract void dummyMethod03(); +// ======== +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass07/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass07/redefineclasses015b.java new file mode 100644 index 00000000000..ca147ed97c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass07/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * adding public modifier to + * void dummyMethod03() + */ + +public interface redefineclasses015b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + +// ====== + public void dummyMethod03(); +// ====== +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass08/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass08/redefineclasses015b.java new file mode 100644 index 00000000000..b12089bc764 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/newclass08/redefineclasses015b.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + * adding abstract public modifiers to + * void dummyMethod03() + */ + +public interface redefineclasses015b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + +// =============== + abstract public void dummyMethod03(); +// =============== +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015a.java new file mode 100644 index 00000000000..70401212af0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015a.java @@ -0,0 +1,66 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015a is deugee's part of the redefineclasses015. + */ + +public class redefineclasses015a { + + 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 instr = pipe.readln(); + if (instr.equals("load_class")) { + // to force ClassPrepareEvent, change value of this field + redefineclasses015bc.classPrepare = true; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + +} + +abstract class redefineclasses015bc implements redefineclasses015b { + // to force ClassPrepareEvent, change value of this field + static boolean classPrepare; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015b.java new file mode 100644 index 00000000000..30fed7870af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015b.java @@ -0,0 +1,41 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses015b is deugee's part of the redefineclasses015. + */ + +public interface redefineclasses015b { + + abstract public void dummyMethod01(); + + public void dummyMethod02(); + + void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016.java new file mode 100644 index 00000000000..caf6ec689e8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016.java @@ -0,0 +1,234 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false, + * changing the schema(the fields) will throw UnsupportedOperationException + * exception" + * On debugee part there is an interface that has three method declarations:
    + * static public final Object field001
    + * public final Object field002
    + * final Object field003
    + * Object field004
    + * JLSS 9.3 says "...every field declaration in the body of an interface is implicitly + * public, static and final..." + * The test tries to redefine this interface, manipulating modifiers of + * these fields, and expects UnsupportedOperationException will not be thrown. + * + * The test consists of the following files:
    + * redefineclasses016.java - debugger
    + * redefineclasses016a.java - initial debuggee
    + * newclassXX/redefineclasses016a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - removing static modifiers
    + * 2. newclass02 - adding static modifiers
    + * 3. newclass03 - removing final modifiers
    + * 4. newclass04 - adding final modifiers
    + * 5. newclass05 - removing public modifiers
    + * 6. newclass06 - adding public modifiers
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses016 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses016"; + private final static String debugeeName = debuggerName + "a"; + private final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","removing modifiers"}, + {"newclass02","adding modifiers"}, + {"newclass03","removing modifiers"}, + {"newclass04","adding modifiers"}, + {"newclass05","removing modifiers"}, + {"newclass06","adding modifiers"} + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses016b.class"; + + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType debugeeClass, testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses016 thisTest = new redefineclasses016(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + debugeeClass = debugee.classByName(debugeeName); + testedClass = debugee.classByName(testedClassName); + display("Tested class\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } + performCases(); + + debugee.resume(); + + thrd = debugee.threadByName("main"); + if (!thrd.isSuspended()) { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + display("REDEFINED"); + } catch (UnsupportedOperationException e) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/TestDescription.java new file mode 100644 index 00000000000..6453a11f90c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/TestDescription.java @@ -0,0 +1,86 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses016. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, + * changing the schema(the fields) will throw UnsupportedOperationException + * exception" + * On debugee part there is an interface that has three method declarations: + * static public final Object field001 + * public final Object field002 + * final Object field003 + * Object field004 + * JLSS 9.3 says "...every field declaration in the body of an interface is + * implicitly public, static and final..." + * The test tries to redefine this interface, manipulating modifiers of + * these fields, and expects UnsupportedOperationException will not be thrown. + * The test consists of the following files: + * redefineclasses016.java - debugger + * redefineclasses016a.java - debuggee + * redefineclasses016b.java - an initial redefined class + * newclassXX/redefineclasses016b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - removing modifiers + * 2. newclass02 - adding modifiers + * 3. newclass03 - removing modifiers + * 4. newclass04 - adding modifiers + * 5. newclass05 - removing modifiers + * 6. newclass06 - adding modifiers + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is considered as passed and + * completes it's execution. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses016 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses016a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 newclass05 newclass06 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses016 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass01/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass01/redefineclasses016b.java new file mode 100644 index 00000000000..f431d617b37 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass01/redefineclasses016b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + * removing modifiers + */ + +public interface redefineclasses016b { + + //preexisting fields +// ====== + public final Object field001 = null; +// ====== + public final Object field002 = null; + final Object field003 = null; + Object field004 = null; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass02/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass02/redefineclasses016b.java new file mode 100644 index 00000000000..38aab5feff3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass02/redefineclasses016b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + * adding modifiers + */ + +public interface redefineclasses016b { + + //preexisting fields + static public final Object field001 = null; +// ====== + static public final Object field002 = null; + static final Object field003 = null; + static Object field004 = null; +// ====== +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass03/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass03/redefineclasses016b.java new file mode 100644 index 00000000000..ae1405654be --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass03/redefineclasses016b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + * removing modifiers + */ + +public interface redefineclasses016b { + + //preexisting fields +// ===== + static public Object field001 = null; + public Object field002 = null; + Object field003 = null; +// ===== + Object field004 = null; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass04/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass04/redefineclasses016b.java new file mode 100644 index 00000000000..e5d220964ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass04/redefineclasses016b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + * adding modifier to fields + */ + +public interface redefineclasses016b { + + //preexisting fields + static public final Object field001 = null; + public final Object field002 = null; + final Object field003 = null; +// ===== + final Object field004 = null; +// ===== +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass05/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass05/redefineclasses016b.java new file mode 100644 index 00000000000..cff3890c395 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass05/redefineclasses016b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + * removing modifiers + */ + +public interface redefineclasses016b { + + //preexisting fields +// ====== + static final Object field001 = null; + final Object field002 = null; +// ====== + final Object field003 = null; + Object field004 = null; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass06/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass06/redefineclasses016b.java new file mode 100644 index 00000000000..d777596860c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/newclass06/redefineclasses016b.java @@ -0,0 +1,44 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + * adding modifiers + */ + +public interface redefineclasses016b { + + //preexisting fields + static public final Object field001 = null; + public final Object field002 = null; +// ====== + public final Object field003 = null; + public Object field004 = null; +// ====== +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016a.java new file mode 100644 index 00000000000..01ee7bc00b1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016a.java @@ -0,0 +1,56 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016a is deugee's part of the redefineclasses016. + */ + +public class redefineclasses016a { + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + Log log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + + redefineclasses016bc obj = new redefineclasses016bc(); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} + +class redefineclasses016bc implements redefineclasses016b { +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016b.java new file mode 100644 index 00000000000..c53dc94871a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016b.java @@ -0,0 +1,41 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses016b is deugee's part of the redefineclasses016. + */ + +public interface redefineclasses016b { + + //preexisting fields + static public final Object field001 = null; + public final Object field002 = null; + final Object field003 = null; + Object field004 = null; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020.java new file mode 100644 index 00000000000..a4f0eefbe2a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020.java @@ -0,0 +1,247 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false attempting + * to add a class modifiers will throw UnsupportedOperationException + * exception." + * + * The test consists of the following files:
    + * redefineclasses020.java - debugger
    + * redefineclasses020a.java - initial debuggee
    + * newclassXX/redefineclasses020a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding class modifier
    + * 2. newclass02 - adding class modifier
    + * 3. newclass03 - adding class modifier
    + * 4. newclass04 - adding class modifier
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses020 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses020"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b$redefineclasses020ib"; + + private final static String[][] subDirs = { + {"newclass01","adding class-modifier"}, + {"newclass02","adding class-modifier"}, + {"newclass03","adding class-modifier"}, + {"newclass04","adding class-modifier"} + }; + + private final static String newClassFile = File.separator + + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType debugeeClass, testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses020 thisTest = new redefineclasses020(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + debugeeClass = debugee.classByName(debugeeName); + testedClass = debugee.classByName(testedClassName); + display("Tested class\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/TestDescription.java new file mode 100644 index 00000000000..fc6c32771dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses020. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, adding class + * modifiers will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses020.java - debugger + * redefineclasses020a.java - debuggee + * redefineclasses020b.java - an initial redefined class + * newclassXX/redefineclasses020b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - adding class modifier + * 2. newclass02 - adding class modifier + * 3. newclass03 - adding class modifier + * 4. newclass04 - adding class-modifier + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses020 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses020a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses020 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass01/redefineclasses020b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass01/redefineclasses020b.java new file mode 100644 index 00000000000..c9d04663491 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass01/redefineclasses020b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses020b is deugee's part of the redefineclasses020. + * adding class modifier + */ + +public class redefineclasses020b { + + Object obj = new redefineclasses020ib(); + + public class redefineclasses020ib { +// ^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass02/redefineclasses020b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass02/redefineclasses020b.java new file mode 100644 index 00000000000..1dc53a9f744 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass02/redefineclasses020b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses020b is deugee's part of the redefineclasses020. + * adding class modifier + */ + +public class redefineclasses020b { + + Object obj = new redefineclasses020ib(); + + protected class redefineclasses020ib { +// ^^^^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass03/redefineclasses020b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass03/redefineclasses020b.java new file mode 100644 index 00000000000..080bf6c0551 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass03/redefineclasses020b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses020b is deugee's part of the redefineclasses020. + * adding class modifier + */ + +public class redefineclasses020b { + + Object obj = new redefineclasses020ib(); + + private class redefineclasses020ib { +// ^^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass04/redefineclasses020b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass04/redefineclasses020b.java new file mode 100644 index 00000000000..cf5ef55b3cb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/newclass04/redefineclasses020b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses020b is deugee's part of the redefineclasses020. + * adding class modifier + */ + +public class redefineclasses020b { + + Object obj = new redefineclasses020ib(); + + static class redefineclasses020ib { +// ^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020a.java new file mode 100644 index 00000000000..6138f6273f7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020a.java @@ -0,0 +1,54 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses020a is deugee's part of the redefineclasses020. + */ +public class redefineclasses020a { + + private static Log log; + + static redefineclasses020b obj = new redefineclasses020b(); + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020b.java new file mode 100644 index 00000000000..ad06c4f97a5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020b.java @@ -0,0 +1,50 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses020b is deugee's part of the redefineclasses020. + */ + +public class redefineclasses020b { + + Object obj = new redefineclasses020ib(); + + class redefineclasses020ib { + + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021.java new file mode 100644 index 00000000000..2a963de200b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021.java @@ -0,0 +1,267 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false attempting + * to add a interface modifiers will throw UnsupportedOperationException + * exception." + * + * The test consists of the following files:
    + * redefineclasses021.java - debugger
    + * redefineclasses021a.java - initial debuggee
    + * newclassXX/redefineclasses021a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding public interface-modifier
    + * 2. newclass02 - adding protected interface-modifier
    + * 3. newclass03 - adding private interface-modifier
    + * 4. newclass04 - adding static interface-modifier
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses021 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses021"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b$redefineclasses021bi"; + + private final static String[][] subDirs = { + {"newclass01","adding interface-modifier"}, + {"newclass02","adding interface-modifier"}, + {"newclass03","adding interface-modifier"}, + {"newclass04","adding interface-modifier"} + }; + + private final static String newClassFile = File.separator + + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses021 thisTest = new redefineclasses021(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Failure e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + displayVMStatus(); + performCases(); + + debugee.resume(); + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (i < 3) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + } else { + display("!!!No exception is thrown!!! Member interfaces are always implicitly static"); + } + } catch (UnsupportedOperationException e) { + if (i == 3) { + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + exitStatus = Consts.TEST_FAILED; + } else { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java new file mode 100644 index 00000000000..eccdf2efbfc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses021. + * VM Testbase keywords: [jpda, jdi, redefine, quarantine] + * VM Testbase comments: JDK-8065773 + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, adding interface + * modifiers will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses021.java - debugger + * redefineclasses021a.java - debuggee + * redefineclasses021b.java - an initial redefined class + * newclassXX/redefineclasses021b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - adding interface-modifier + * 2. newclass02 - adding interface-modifier + * 3. newclass03 - adding interface-modifier + * 4. newclass04 - adding interface-modifier + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * 10.17.2002 fix for #4764339 + * For the 4-th testcase UnsupportedOperationException should not be thrown. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses021 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses021a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses021 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass01/redefineclasses021b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass01/redefineclasses021b.java new file mode 100644 index 00000000000..76cc8cc73d3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass01/redefineclasses021b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses021b is deugee's part of the redefineclasses021. + * adding public modifier + */ + +public class redefineclasses021b { + + redefineclasses021bc obj = new redefineclasses021bc(); + + public interface redefineclasses021bi { +// ^^^^^^ + void dummyMethod01(); + + } + + class redefineclasses021bc implements redefineclasses021bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass02/redefineclasses021b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass02/redefineclasses021b.java new file mode 100644 index 00000000000..424a345494f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass02/redefineclasses021b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses021b is deugee's part of the redefineclasses021. + * adding protected modifier + */ + +public class redefineclasses021b { + + redefineclasses021bc obj = new redefineclasses021bc(); + + protected interface redefineclasses021bi { +// ^^^^^^^^^ + void dummyMethod01(); + + } + + class redefineclasses021bc implements redefineclasses021bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass03/redefineclasses021b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass03/redefineclasses021b.java new file mode 100644 index 00000000000..07d86dc1b8f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass03/redefineclasses021b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses021b is deugee's part of the redefineclasses021. + * adding private modifier + */ + +public class redefineclasses021b { + + redefineclasses021bc obj = new redefineclasses021bc(); + + private interface redefineclasses021bi { +// ^^^^^^^ + void dummyMethod01(); + + } + + class redefineclasses021bc implements redefineclasses021bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass04/redefineclasses021b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass04/redefineclasses021b.java new file mode 100644 index 00000000000..18a61272780 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/newclass04/redefineclasses021b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses021b is deugee's part of the redefineclasses021. + * adding static modifier + */ + +public class redefineclasses021b { + + redefineclasses021bc obj = new redefineclasses021bc(); + + static interface redefineclasses021bi { +// ^^^^^^ + void dummyMethod01(); + + } + + class redefineclasses021bc implements redefineclasses021bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021a.java new file mode 100644 index 00000000000..5001ab764b8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021a.java @@ -0,0 +1,53 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses021a is deugee's part of the redefineclasses021. + */ +public class redefineclasses021a { + + private static Log log; + + // to force ClassPrepareEvent, create instance + static redefineclasses021b obj = new redefineclasses021b(); + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021b.java new file mode 100644 index 00000000000..cdf22005bc5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses021b is deugee's part of the redefineclasses021. + */ + +public class redefineclasses021b { + + redefineclasses021bc obj = new redefineclasses021bc(); + + interface redefineclasses021bi { + + + void dummyMethod01(); + + } + + class redefineclasses021bc implements redefineclasses021bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022.java new file mode 100644 index 00000000000..4204945ac81 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022.java @@ -0,0 +1,245 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false attempting + * to change a class modifiers will throw UnsupportedOperationException + * exception." + * + * The test consists of the following files:
    + * redefineclasses022.java - debugger
    + * redefineclasses022a.java - initial debuggee
    + * newclassXX/redefineclasses022a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - changing class-modifier to
    + * 2. newclass02 - changing class-modifier to
    + * 3. newclass03 - changing class-modifier to
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses022 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses022"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b$redefineclasses022ib"; + + private final static String[][] subDirs = { + {"newclass01","changing class-modifier to "}, + {"newclass02","changing class-modifier to "}, + {"newclass03","changing class-modifier to "} + }; + + private final static String newClassFile = File.separator + + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType debugeeClass, testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses022 thisTest = new redefineclasses022(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugee.VM().suspend(); + debugeeClass = debugee.classByName(debugeeName); + testedClass = debugee.classByName(testedClassName); + display("Tested class\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/TestDescription.java new file mode 100644 index 00000000000..4d9d4decae1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses022. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, changing class + * modifiers will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses022.java - debugger + * redefineclasses022a.java - debuggee + * redefineclasses022b.java - an initial redefined class + * newclassXX/redefineclasses022b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - changing class-modifier to + * 2. newclass02 - changing class-modifier to + * 3. newclass03 - changing class-modifier to + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses022 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses022a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses022 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass01/redefineclasses022b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass01/redefineclasses022b.java new file mode 100644 index 00000000000..7fc6ca15d41 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass01/redefineclasses022b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses022b is deugee's part of the redefineclasses022. + * changing class modifier to + */ + +public class redefineclasses022b { + + Object obj = new redefineclasses022ib(); + + protected class redefineclasses022ib { +// ^^^^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass02/redefineclasses022b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass02/redefineclasses022b.java new file mode 100644 index 00000000000..33ad76beb26 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass02/redefineclasses022b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses022b is deugee's part of the redefineclasses022. + * changing class modifier to + */ + +public class redefineclasses022b { + + Object obj = new redefineclasses022ib(); + + private class redefineclasses022ib { +// ^^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass03/redefineclasses022b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass03/redefineclasses022b.java new file mode 100644 index 00000000000..3f2ec5d8597 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/newclass03/redefineclasses022b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses022b is deugee's part of the redefineclasses022. + * adding class modifier to + */ + +public class redefineclasses022b { + + Object obj = new redefineclasses022ib(); + + class redefineclasses022ib { +// ^^^^^^^^ + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022a.java new file mode 100644 index 00000000000..21b25d95fbc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022a.java @@ -0,0 +1,53 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses022a is deugee's part of the redefineclasses022. + */ +public class redefineclasses022a { + + private static Log log; + + static redefineclasses022b obj = new redefineclasses022b(); + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022b.java new file mode 100644 index 00000000000..6baf48bc54e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022b.java @@ -0,0 +1,50 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses022b is deugee's part of the redefineclasses022. + */ + +public class redefineclasses022b { + + Object obj = new redefineclasses022ib(); + + public class redefineclasses022ib { + + + public void dummyMethod01(){ + } + + protected void dummyMethod02(){ + } + + private void dummyMethod03(){ + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023.java new file mode 100644 index 00000000000..ad2d9e10be3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023.java @@ -0,0 +1,255 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false attempting + * to change a class modifiers will throw UnsupportedOperationException + * exception." + * + * The test consists of the following files:
    + * redefineclasses023.java - debugger
    + * redefineclasses023a.java - initial debuggee
    + * newclassXX/redefineclasses023a.java - redefining debuggees
    + * + * This test performs the following cases:
    + * 1. newclass01 - changing class-modifier to
    + * 2. newclass02 - changing class-modifier to
    + * 3. newclass03 - changing class-modifier to
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses023 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses023"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b$redefineclasses023bi"; + + private final static String[][] subDirs = { + {"newclass01","changing class-modifier to "}, + {"newclass02","changing class-modifier to "}, + {"newclass03","changing class-modifier to "} + }; + + private final static String newClassFile = File.separator + + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses023 thisTest = new redefineclasses023(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + displayVMStatus(); + performCases(); + + debugee.resume(); + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java new file mode 100644 index 00000000000..ce9beebdc96 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses023. + * VM Testbase keywords: [jpda, jdi, redefine, quarantine] + * VM Testbase comments: JDK-8065773 + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, changing class + * modifiers will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses023.java - debugger + * redefineclasses023a.java - debuggee + * redefineclasses023b.java - an initial redefined class + * newclassXX/redefineclasses023b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - changing class-modifier to + * 2. newclass02 - changing class-modifier to + * 3. newclass03 - changing class-modifier to + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses023 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses023a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses023 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass01/redefineclasses023b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass01/redefineclasses023b.java new file mode 100644 index 00000000000..29b2230ff09 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass01/redefineclasses023b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses023b is deugee's part of the redefineclasses023. + * changing class-modifier to + */ + +public class redefineclasses023b { + + redefineclasses023bc obj = new redefineclasses023bc(); + + protected interface redefineclasses023bi { +// ^^^^^^^^^ + + void dummyMethod01(); + + } + + class redefineclasses023bc implements redefineclasses023bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass02/redefineclasses023b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass02/redefineclasses023b.java new file mode 100644 index 00000000000..f5e4ef6697a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass02/redefineclasses023b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses023b is deugee's part of the redefineclasses023. + * changing class-modifier to + */ + +public class redefineclasses023b { + + redefineclasses023bc obj = new redefineclasses023bc(); + + private interface redefineclasses023bi { +// ^^^^^^^ + + void dummyMethod01(); + + } + + class redefineclasses023bc implements redefineclasses023bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass03/redefineclasses023b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass03/redefineclasses023b.java new file mode 100644 index 00000000000..ead162abd93 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/newclass03/redefineclasses023b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses023b is deugee's part of the redefineclasses023. + * changing class-modifier to + */ + +public class redefineclasses023b { + + redefineclasses023bc obj = new redefineclasses023bc(); + + interface redefineclasses023bi { +// ^^^^^^ + + void dummyMethod01(); + + } + + class redefineclasses023bc implements redefineclasses023bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023a.java new file mode 100644 index 00000000000..eb2e0c63393 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023a.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses023a is deugee's part of the redefineclasses023. + */ +public class redefineclasses023a { + + private static Log log; + + // to force ClassPrepareEvent, create instance + static redefineclasses023b obj = new redefineclasses023b(); + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023b.java new file mode 100644 index 00000000000..a839510bf0b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses023b is deugee's part of the redefineclasses023. + */ + +public class redefineclasses023b { + + redefineclasses023bc obj = new redefineclasses023bc(); + + public interface redefineclasses023bi { + + + void dummyMethod01(); + + } + + class redefineclasses023bc implements redefineclasses023bi { + + public void dummyMethod01() { + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024.java new file mode 100644 index 00000000000..fad049736f1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024.java @@ -0,0 +1,303 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false attempting + * to change a a class hierarchy will throw UnsupportedOperationException + * exception." + * + * The test consists of the following files:
    + * redefineclasses024.java - debugger
    + * redefineclasses024a.java - debuggee
    + * redefineclasses024c.java - a subsidiary class
    + * redefineclasses024i.java - a subsidiary interface
    + * redefineclasses024b.java - an initial redefined class
    + * newclassXX/redefineclasses024b.java - redefining debuggee's class
    + * + * This test performs the following cases:
    + * 1. newclass01 - implements an interface
    + * 2. newclass02 - extends a class
    + * 3. newclass03 - extends a class, implements an interface
    + * 4. newclass04 - extends Object class
    + * The last case assumes the exception will not be thrown. + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses024 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses024"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","implements an interface"}, + {"newclass02","extends a class"}, + {"newclass03","extends a class, implements an interface"}, + {"newclass04","extends Object"} + }; + + private final static String newClassFile = File.separator + + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses024 thisTest = new redefineclasses024(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + waitTime = argHandler.getWaitTime() * 60000; + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + ClassPrepareRequest clpr = debugee.getEventRequestManager().createClassPrepareRequest(); + clpr.addClassFilter(testedClassName); + clpr.enable(); + + debugee.sendSignal("load_class"); + + ClassPrepareEvent clpEvent = waitClassPrepareEvent(clpr, waitTime); + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if ( i < 3 ) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } else { + display("REDEFINED"); + } + } catch (UnsupportedOperationException e) { + if ( i < 3 ) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private ClassPrepareEvent waitClassPrepareEvent(ClassPrepareRequest clpr, long waitTime) { + Event event; + display(">waiting class prepare event..."); + try { + event = debugee.waitingEvent(clpr, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof ClassPrepareEvent )) { + throw new TestBug("ClassPrepareEvent didn't arrive"); + } + + return (ClassPrepareEvent )event; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/TestDescription.java new file mode 100644 index 00000000000..67afbe6c624 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses024. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, changing a class + * hierarchy will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses024.java - debugger + * redefineclasses024a.java - debuggee + * redefineclasses024c.java - a subsidiary class + * redefineclasses024i.java - a subsidiary interface + * redefineclasses024b.java - an initial redefined class + * newclassXX/redefineclasses024b.java - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - implements an interface + * 2. newclass02 - extends a class + * 3. newclass03 - extends a class, implements an interface + * 4. newclass04 - extends Object class + * The last case assumes the exception will not be thrown. + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses024 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses024a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses024 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass01/redefineclasses024b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass01/redefineclasses024b.java new file mode 100644 index 00000000000..26467596ece --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass01/redefineclasses024b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses024b is deugee's part of the redefineclasses024. + * implements an interface + */ + +class redefineclasses024b implements redefineclasses024i { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + static boolean classPrepare = false; + + public void dummyMethod01() { + } +} + +interface redefineclasses024i { + + public void dummyMethod01(); +} + +class redefineclasses024c { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass02/redefineclasses024b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass02/redefineclasses024b.java new file mode 100644 index 00000000000..a82efd6ec03 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass02/redefineclasses024b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses024b is deugee's part of the redefineclasses024. + * extends a class + */ + +class redefineclasses024b extends redefineclasses024c { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + static boolean classPrepare = false; + + public void dummyMethod01() { + } +} + +interface redefineclasses024i { + + public void dummyMethod01(); +} + +class redefineclasses024c { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass03/redefineclasses024b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass03/redefineclasses024b.java new file mode 100644 index 00000000000..9a0e5e8c268 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass03/redefineclasses024b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses024b is deugee's part of the redefineclasses024. + * extends a class implements an interface + */ + +class redefineclasses024b extends redefineclasses024c implements redefineclasses024i { + + static boolean classPrepare = false; + + public void dummyMethod01() { + } +} + +interface redefineclasses024i { + + public void dummyMethod01(); +} + +class redefineclasses024c { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass04/redefineclasses024b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass04/redefineclasses024b.java new file mode 100644 index 00000000000..a30d729a12b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/newclass04/redefineclasses024b.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses024b is deugee's part of the redefineclasses024. + * extends Object + */ + +class redefineclasses024b extends Object { +// ^^^^^^^^^^^^^^ + static boolean classPrepare = false; + + public void dummyMethod01() { + } +} + +interface redefineclasses024i { + + public void dummyMethod01(); +} + +class redefineclasses024c { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024a.java new file mode 100644 index 00000000000..3fefa04fe5e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024a.java @@ -0,0 +1,59 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses024a is deugee's part of the redefineclasses024. + */ +public class redefineclasses024a { + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("load_class")) { + // to force ClassPrepareEvent, change value of this field + redefineclasses024b.classPrepare = true; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024b.java new file mode 100644 index 00000000000..84c8188eaa7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024b.java @@ -0,0 +1,51 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses024b is deugee's part of the redefineclasses024. + */ + +class redefineclasses024b { + + static boolean classPrepare = false; + + public void dummyMethod01() { + } +} + +interface redefineclasses024i { + + public void dummyMethod01(); +} + +class redefineclasses024c { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025.java new file mode 100644 index 00000000000..ab78dc5d1a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025.java @@ -0,0 +1,278 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If canUnrestrictedlyRedefineClasses() is false attempting + * to change interface hierarchy will throw UnsupportedOperationException exception." + * + * The test consists of the following files:
    + * redefineclasses025.java - debugger
    + * redefineclasses025a.java - debuggee
    + * redefineclasses025b.java - an initial redefined interface
    + * newclassXX/redefineclasses025b.java - redefining debuggee's interface
    + * + * This test performs the following cases:
    + * 1. newclass01 - adding implemented interface
    + * 2. newclass02 - removing implemented interface
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses025 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses025"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","adding extended interface"}, + {"newclass02","removing extended interface"} + }; + + private final static String newClassFile = File.separator + + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses025 thisTest = new redefineclasses025(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + waitTime = argHandler.getWaitTime() * 60000; + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + ClassPrepareRequest clpr = debugee.getEventRequestManager().createClassPrepareRequest(); + clpr.addClassFilter(testedClassName); + clpr.enable(); + + debugee.sendSignal("load_class"); + + ClassPrepareEvent clpEvent = waitClassPrepareEvent(clpr, waitTime); + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedOperationException is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } catch (UnsupportedOperationException e) { + if (!debugee.VM().canUnrestrictedlyRedefineClasses()) { + display(EXPECTED_STRING + e); + } else { + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain(statDebugee + UNEXPECTED_STRING + + "UnsupportedOperationException"); + complain("***\twhile " + subDirs[i][1]); + } + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private ClassPrepareEvent waitClassPrepareEvent(ClassPrepareRequest clpr, long waitTime) { + Event event; + display(">waiting class prepare event..."); + try { + event = debugee.waitingEvent(clpr, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof ClassPrepareEvent )) { + throw new TestBug("ClassPrepareEvent didn't arrive"); + } + + return (ClassPrepareEvent )event; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/TestDescription.java new file mode 100644 index 00000000000..a5aed63222f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses025. + * VM Testbase keywords: [jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If canUnrestrictedlyRedefineClasses() is false, changing interface + * hierarchy will throw UnsupportedOperationException exception" + * The test consists of the following files: + * redefineclasses025.java - debugger + * redefineclasses025a.java - debuggee + * redefineclasses025b.java - an initial redefined interface + * newclassXX/redefineclasses025b.java - redefining debuggee's interface + * This test performs the following cases: + * 1. newclass01 - adding extendeded interface + * 2. newclass02 - removing extendeded interface + * The test checks two different cases for suspended debugee and not + * suspended one. + * COMMENTS: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses025 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses025a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses025 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/newclass01/redefineclasses025b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/newclass01/redefineclasses025b.java new file mode 100644 index 00000000000..529af4dc54b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/newclass01/redefineclasses025b.java @@ -0,0 +1,47 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses025b is deugee's part of the redefineclasses025. + */ + +interface redefineclasses025b extends redefineclasses025i, redefineclasses025j { +// ^^^^^^^^^^^^^^^^^^^^^^^^ + public void dummyMethod01(); +} + +interface redefineclasses025i { + + public void dummyMethod02(); +} + +interface redefineclasses025j { + + public void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/newclass02/redefineclasses025b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/newclass02/redefineclasses025b.java new file mode 100644 index 00000000000..7baf9bc6eff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025/newclass02/redefineclasses025b.java @@ -0,0 +1,47 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses025b is deugee's part of the redefineclasses025. + */ + +interface redefineclasses025b { +// ^^^ + public void dummyMethod01(); +} + +interface redefineclasses025i { + + public void dummyMethod02(); +} + +interface redefineclasses025j { + + public void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025a.java new file mode 100644 index 00000000000..02610173ec4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025a.java @@ -0,0 +1,63 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses025a is deugee's part of the redefineclasses025. + */ +public class redefineclasses025a { + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("load_class")) { + // to force ClassPrepareEvent, change value of this field + redefineclasses025c.classPrepare = true; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} + +abstract class redefineclasses025c implements redefineclasses025b { + static boolean classPrepare = false; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025b.java new file mode 100644 index 00000000000..f3250835429 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses025b.java @@ -0,0 +1,47 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses025b is deugee's part of the redefineclasses025. + */ + +interface redefineclasses025b extends redefineclasses025i { + + public void dummyMethod01(); +} + +interface redefineclasses025i { + + public void dummyMethod02(); +} + +interface redefineclasses025j { + + public void dummyMethod03(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026.java new file mode 100644 index 00000000000..3eee2a7b9ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026.java @@ -0,0 +1,217 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If the bytes don't correspond to the reference type (the names don't match) + * NoClassDefFoundError will be thrown." + * + * The test consists of the following files:
    + * redefineclasses026.java - debugger
    + * redefineclasses026a.java - debuggee
    + * redefineclasses026c.java - an initial class
    + * newclass/redefineclasses026c.java - redefining class
    + * + * This test attepmts to redefine class with wrong classname. + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses026 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses026"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "c"; + + private final static String newClassFile = "newclass" + File.separator + + testedClassName.replace('.',File.separatorChar) + + "_otherName.class"; + + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses026 thisTest = new redefineclasses026(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + waitTime = argHandler.getWaitTime() * 60000; + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + mapBytes = mapClassToBytes(testDir + File.separator + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + exitStatus = Consts.TEST_FAILED; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + complain("***NoClassDefFoundError is not thrown"); + + } catch (NoClassDefFoundError e) { + display(EXPECTED_STRING + e); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/TestDescription.java new file mode 100644 index 00000000000..5e764cf35c9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses026. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If the bytes don't correspond to the reference type (the names + * don't match) NoClassDefFoundError will be thrown." + * The test consists of the following files: + * redefineclasses026.java - debugger + * redefineclasses026a.java - debuggee + * redefineclasses026c.java - an initial class + * newclass/redefineclasses026c.java - redefining class + * This test attepmts to redefine class with wrong classname. + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses026 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses026a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses026 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/newclass/redefineclasses026c_otherName.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/newclass/redefineclasses026c_otherName.java new file mode 100644 index 00000000000..50971e71bc3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/newclass/redefineclasses026c_otherName.java @@ -0,0 +1,39 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses026c is deugee's part of the redefineclasses026. + */ + +public class redefineclasses026c_otherName { +// ^^^^^^^^^^ + public void dummyMethod01() { + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026a.java new file mode 100644 index 00000000000..c95cbf78c1f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026a.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses026a is deugee's part of the redefineclasses026. + */ +public class redefineclasses026a { + + private static Log log; + + static redefineclasses026c obj = new redefineclasses026c(); + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026c.java new file mode 100644 index 00000000000..3bc614b93c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026c.java @@ -0,0 +1,39 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses026c is deugee's part of the redefineclasses026. + */ + +public class redefineclasses026c { + + public void dummyMethod01() { + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027.java new file mode 100644 index 00000000000..654ec5bd5f1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027.java @@ -0,0 +1,276 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If the major and minor version numbers in bytes are not supported by the VM + * UnsupportedClassVersionError will be thrown." + * + * The test consists of the following files:
    + * redefineclasses027.java - debugger
    + * redefineclasses027a.java - debuggee
    + * redefineclasses027c.java - tested class
    + * redefineclasses027i.java - tested interface
    + * + * This test corrupts byte-code of the version number and tries to redefine + * the tested classes. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses027 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses027"; + private final static String debugeeName = debuggerName + "a"; + + public final static String [] testedClassNames = { + debuggerName + "c", + debuggerName + "i" + }; + + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses027 thisTest = new redefineclasses027(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + waitTime = argHandler.getWaitTime() * 60000; + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + ClassPrepareRequest clpr = debugee.getEventRequestManager().createClassPrepareRequest(); + clpr.addClassFilter(debuggerName + "*"); + // #4736633 is fixed + clpr.addClassExclusionFilter(debuggerName + "ic"); + clpr.enable(); + + debugee.sendSignal("load_class"); + + ClassPrepareEvent clpEvent = waitClassPrepareEvent(clpr, waitTime); + display(typePrompt(testedClass) + ":\t" + clpEvent.referenceType().name()); + debugee.resume(); + + clpEvent = waitClassPrepareEvent(clpr, waitTime); + display(typePrompt(testedClass) + ":\t" + clpEvent.referenceType().name()); + + + display("\nTEST BEGINS"); + display("==========="); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + + String oldClassFile; + for (int i = 0; i < testedClassNames.length; i++) { + testedClass = debugee.classByName(testedClassNames[i]); + display(typePrompt(testedClass) + ":\t" + testedClass.name()); + + oldClassFile = ClassFileFinder.findClassFile(testedClassNames[i], Utils.TEST_CLASS_PATH).toString(); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***UnsupportedClassVersionError is not thrown"); + } catch (UnsupportedClassVersionError e) { + display(EXPECTED_STRING + e); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + display(""); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file:\t" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + + // corrupting major and minor version numbers of class file structure + display("actual version number: \t" + + getValue(arrayToRedefine[6], arrayToRedefine[7]) + + "." + + getValue(arrayToRedefine[4], arrayToRedefine[5])); + arrayToRedefine[4] = (byte )0xF; + arrayToRedefine[5] = arrayToRedefine[4]; + arrayToRedefine[6] = arrayToRedefine[4]; + arrayToRedefine[7] = arrayToRedefine[4]; + display("corrupted version number:\t" + + getValue(arrayToRedefine[6], arrayToRedefine[7]) + + "." + + getValue(arrayToRedefine[4], arrayToRedefine[5])); + + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + int getValue(byte b1, byte b2) { + int val = b1 * 0x100 + b2; + return val; + } + + private ClassPrepareEvent waitClassPrepareEvent(ClassPrepareRequest clpr, long waitTime) { + Event event; + display(">waiting class prepare event..."); + try { + event = debugee.waitingEvent(clpr, waitTime); + } catch (InterruptedException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + if (!(event instanceof ClassPrepareEvent )) { + throw new TestBug("ClassPrepareEvent didn't arrive"); + } + + return (ClassPrepareEvent )event; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027/TestDescription.java new file mode 100644 index 00000000000..6efdef033ab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses027. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If the major and minor version numbers in bytes are not supported + * by the VM, UnsupportedClassVersionError will be thrown." + * The test consists of the following files: + * redefineclasses027.java - debugger + * redefineclasses027a.java - debuggee + * redefineclasses027c.java - tested class + * redefineclasses027i.java - tested interface + * This test corrupts byte-code of the version number and tries to redefine + * the tested classes. When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + * COMMENTS: + * #4736633 is fixed + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses027 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses027a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses027 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027a.java new file mode 100644 index 00000000000..d0e0e1fbed6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027a.java @@ -0,0 +1,64 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses027a is deugee's part of the redefineclasses027. + */ +public class redefineclasses027a { + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("load_class")) { + // to force ClassPrepareEvent, create instance + redefineclasses027c obj = new redefineclasses027c(); + redefineclasses027ic.classPrepare = true; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} + +abstract class redefineclasses027ic implements redefineclasses027i { + static boolean classPrepare = false; +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027c.java new file mode 100644 index 00000000000..6ab0013263f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027c.java @@ -0,0 +1,38 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses027c is deugee's part of the redefineclasses027. + */ + +public class redefineclasses027c { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027i.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027i.java new file mode 100644 index 00000000000..42f5b85a9dc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027i.java @@ -0,0 +1,37 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses027i is deugee's part of the redefineclasses027. + */ + +interface redefineclasses027i { + + public void dummyMethod01(); +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028.java new file mode 100644 index 00000000000..7b9e39c7d4d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028.java @@ -0,0 +1,221 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If the bytes do not represent a valid class, ClassFormatError + * will be thrown." + * + * The test consists of the following files:
    + * redefineclasses028.java - debugger
    + * redefineclasses028a.java - debuggee
    + * redefineclasses028b.java - initial class
    + * + * This test reads redefineclasses028b class-file and corrupts it. Then tries + * to redefine the redefineclasses028b class using the corrupted byte-code. + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses028 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses028"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String newClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses028 thisTest = new redefineclasses028(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + exitStatus = Consts.TEST_FAILED; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + complain("***ClassFormatError is not thrown"); + } catch (ClassFormatError e) { + display(EXPECTED_STRING + e); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + // corrupting bytes + for (int i = 8; i < fileToRedefineLength; i++) { + arrayToRedefine[i] = (byte )i; + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028/TestDescription.java new file mode 100644 index 00000000000..e7cc7f7a67b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses028. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If the bytes do not represent a valid class, ClassFormatError + * will be thrown." + * The test consists of the following files: + * redefineclasses028.java - debugger + * redefineclasses028a.java - debuggee + * redefineclasses028b.java - initial class + * This test reads redefineclasses028b class-file and corrupts it. + * Then tries to redefine the redefineclasses028b class using the + * corrupted byte-code. + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is considered as passed + * and completes it's execution. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses028 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses028a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses028 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028a.java new file mode 100644 index 00000000000..35e1a97cc97 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028a.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses028a is deugee's part of the redefineclasses028. + */ +public class redefineclasses028a { + + private static Log log; + + static redefineclasses028b obj = new redefineclasses028b(); + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028b.java new file mode 100644 index 00000000000..f235285c02d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028b.java @@ -0,0 +1,38 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses028b is deugee's part of the redefineclasses028. + */ + +class redefineclasses028b { + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029.java new file mode 100644 index 00000000000..469d2d5304d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029.java @@ -0,0 +1,153 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If the bytes do not represent a valid class, ClassFormatError + * will be thrown." + * + * The test consists of the following files:
    + * redefineclasses029.java - debugger
    + * redefineclasses029a.java - initial debuggee
    + * + * This test creates byte code, that has zero-length, and tries it + * to redefine the debugee. The test expects ClassFormatError exception. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses029 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses029"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses029 thisTest = new redefineclasses029(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + testedClass = debugee.classByName(debugeeName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + HashMap mapBytes = new HashMap(); + display(">attempting to redefine a class by \"empty\" class-file..."); + mapBytes.put(testedClass, new byte[0]); + try { + debugee.VM().redefineClasses(mapBytes); + exitStatus = Consts.TEST_FAILED; + complain("***ClassFormatError is not thrown"); + } catch (ClassFormatError e) { + display(EXPECTED_STRING + e); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + complain(UNEXPECTED_STRING + e); + e.printStackTrace(); + } + debugee.resume(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029/TestDescription.java new file mode 100644 index 00000000000..df21af79743 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses029. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If the bytes do not represent a valid class, ClassFormatError + * will be thrown." + * The test consists of the following files: + * redefineclasses029.java - debugger + * redefineclasses029a.java - initial debuggee + * This test creates byte code, that has zero-length, and tries it + * to redefine the debugee. The test expects ClassFormatError exception. + * When canRedefineClasses() is false, the test is considered as passed + * and completes it's execution. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses029 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses029a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses029 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029a.java new file mode 100644 index 00000000000..629395ed212 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029a.java @@ -0,0 +1,50 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses029a is deugee's part of the redefineclasses029. + */ +public class redefineclasses029a { + + private static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030.java new file mode 100644 index 00000000000..efa6ba4db79 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030.java @@ -0,0 +1,278 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import jdk.test.lib.Utils; +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion:
    + * "If a "verifier" detects that a class, though well formed, contains an internal + * inconsistency or security problem, VerifyError will be thrown." + * + * The test consists of the following files:
    + * redefineclasses030.java - debugger
    + * redefineclasses030a.java - debuggee
    + * redefineclasses030b.java - an initial redefined class
    + * newclassXX/redefineclasses030b.jasm - redefining debuggee's class
    + * + * This test performs the following cases:
    + * 1. newclass01 - reducing stack size
    + * 2. newclass02 - pushing a local variable with wrong index
    + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses030 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses030"; + private final static String debugeeName = debuggerName + "a"; + public final static String testedClassName = debuggerName + "b"; + + private final static String[][] subDirs = { + {"newclass01","reducing stack size"}, + {"newclass02","pushing a local variable with wrong index"} + }; + + private final static String classFileName = + testedClassName.replace('.',File.separatorChar) + + ".class"; + private final static String oldClassFile + = ClassFileFinder.findClassFile(testedClassName, Utils.TEST_CLASS_PATH) + .toString(); + + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static String testDir; + private static String statDebugee; + + private ReferenceType testedClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses030 thisTest = new redefineclasses030(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (TestBug e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } catch (Exception e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws TestBug { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + testedClass = debugee.classByName(testedClassName); + display(typePrompt(testedClass) + "\t:" + testedClass.name()); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + + displayVMStatus(); + performCases(); + + debugee.resume(); + + displayVMStatus(); + performCases(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void performCases() { + Map mapBytes; + boolean alreadyComplained = false; + for (int i = 0; i < subDirs.length; i++) { + display("\n" + subDirs[i][1] + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + subDirs [i][0] + File.separator + classFileName); + try { + debugee.VM().redefineClasses(mapBytes); + exitStatus = Consts.TEST_FAILED; + if (!alreadyComplained) { + alreadyComplained = true; + complain("***" + dashes); + complain("***" + statDebugee); + complain("***" + dashes); + } + complain("***VerifyError is not thrown"); + complain("***\twhile " + subDirs[i][1]); + + display(">return to the previous state..."); + mapBytes = mapClassToBytes(oldClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } catch (VerifyError e) { + display(EXPECTED_STRING + e); + } catch (Exception e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new TestBug(UNEXPECTED_STRING + e); + } + + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private String typePrompt(ReferenceType refType) { + String msg = "Tested "; + if (refType instanceof InterfaceType) { + msg += "interface"; + } else if (refType instanceof ClassType) { + msg += "class"; + } else { + msg += "type"; + } + return msg; + } + + void displayVMStatus() { + ThreadReference thrd = debugee.threadByName("main"); + if (thrd.isSuspended()) { + statDebugee = "Debugee is suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display(dashes); + } else { + statDebugee = "Debugee is not suspended"; + display("\n\n<<<" + statDebugee + ">>>"); + display("------------------------------"); + } + } + + public static String toHexString(long b, int length) { + return Right(Long.toHexString(b), length).replace(' ', '0').toUpperCase(); + } + + private static String Right(String source, int length) { + + if (length <= 0) + return ""; + + if (length <= source.length()) + return source.substring(source.length() - length, source.length()); + else + return PadL(source, length); + } + + private static String PadL(String source, int length, String what) { + + if (length <= 0) + return ""; + + if (source.length() > length) + return PadL("", length, "*"); + + while (source.length() < length) + source = what + source; + + return source; + } + + + private static String PadL(String source, int length) { + return PadL(source, length, " "); + } + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/TestDescription.java new file mode 100644 index 00000000000..8ffcc43a185 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses030. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test against the method com.sun.jdi.VirtualMachine.redefineClasses() + * and checks up the following assertion: + * "If a "verifier" detects that a class, though well formed, contains + * an internal inconsistency or security problem, VerifyError will be + * thrown." + * The test consists of the following files: + * redefineclasses030.java - debugger + * redefineclasses030a.java - debuggee + * redefineclasses030b.java - an initial redefined class + * newclassXX/redefineclasses030b.jasm - redefining debuggee's class + * This test performs the following cases: + * 1. newclass01 - reducing stack size + * 2. newclass02 - pushing a local variable with wrong index + * The test checks two different cases for suspended debugee and not + * suspended one. + * When canRedefineClasses() is false, the test is considered as passed + * and completes it's execution. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * + * @comment compile newclassXX/*.jasm to bin/newclassXX and make sure the classes + * aren't in test.class.path + * @compile newclass01/redefineclasses030b.jasm + * @run driver + * nsk.jdi.ExtraClassesInstaller + * newclass01 nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030b.class + * @clean nsk.jdi.VirtualMachine.redefineClasses.redefineclasses030b + * @compile newclass02/redefineclasses030b.jasm + * @run driver + * nsk.jdi.ExtraClassesInstaller + * newclass02 nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030b.class + * @clean nsk.jdi.VirtualMachine.redefineClasses.redefineclasses030b + * + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses030 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses030a + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses030 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/newclass01/redefineclasses030b.jasm b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/newclass01/redefineclasses030b.jasm new file mode 100644 index 00000000000..c5d0a2391c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/newclass01/redefineclasses030b.jasm @@ -0,0 +1,52 @@ +/* + * 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/VirtualMachine/redefineClasses; + +super class redefineclasses030b +{ + +Field Value:I; + +Method "":"()V" +//------------------------------- +//-----> test substitution <----- +//------------------------------- +// stack 1 locals 1 + stack 0 locals 1 // instead of the previous line +//------------------------------- +//------------------------------- +{ +// null + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; +} + +public Method dummyMethod01:"()V" + stack 0 locals 1 +{ +// null + return; +} + +} // end Class redefineclasses030b diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/newclass02/redefineclasses030b.jasm b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/newclass02/redefineclasses030b.jasm new file mode 100644 index 00000000000..4c19491644b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/newclass02/redefineclasses030b.jasm @@ -0,0 +1,53 @@ +/* + * 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/VirtualMachine/redefineClasses; + +super class redefineclasses030b +{ + +Field Value:I; + +Method "":"()V" + stack 1 locals 1 +{ +// null +//------------------------------- +//-----> test substitution <----- +//------------------------------- +// aload_0; + aload_1; // instead of the previous line +//------------------------------- +//------------------------------- + invokespecial Method java/lang/Object."":"()V"; + return; +} + +public Method dummyMethod01:"()V" + stack 0 locals 1 +{ +// null + return; +} + +} // end Class redefineclasses030b diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030a.java new file mode 100644 index 00000000000..6d0da69d6a0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030a.java @@ -0,0 +1,52 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses030a is deugee's part of the redefineclasses030. + */ +public class redefineclasses030a { + + private static Log log; + + static redefineclasses030b obj = new redefineclasses030b(); + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + IOPipe pipe = argHandler.createDebugeeIOPipe(log); + pipe.println("ready"); + + String instr = pipe.readln(); + if (instr.equals("quit")) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030b.java new file mode 100644 index 00000000000..dfee6d99eab --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030b.java @@ -0,0 +1,42 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses030b is deugee's part of the redefineclasses030. + * to generate jasm-file: + * java -cp javasoft.sqe.jdis.Main -sl nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030b.class > redefineclasses030b.jasm + */ + +class redefineclasses030b { + + int Value; + + public void dummyMethod01() { + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031.java new file mode 100644 index 00000000000..7a98229d5ad --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031.java @@ -0,0 +1,247 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses(). + * In for loop the test sets breakpoint and tries to redefines debugee's + * method by changing value of debugee's field. After resuming debugee, + * the test checks if a tested field contains correct value. + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses031 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + public final static String EXPECTED_STRING = "!!!Expected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses031"; + private final static String debugeeName = debuggerName + "a"; + private final static String Name = debuggerName + "b"; + + public final static String PREPARE_SGL = "prepare"; + public final static String PERFORM_SGL = "perform"; + public final static String QUIT_SGL = "quit"; + public final static String READY_SGL = "ready"; + + private final static String[] subDirs = { + "newclass01", + "newclass02", + "newclass03", + "newclass04", + "newclass05" + }; + + private final static String newClassFile = File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses031a.class"; + private static final String dashes = "--------------------------"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + private static String statDebugee; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses031 thisTest = new redefineclasses031(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Failure e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + debugee.sendSignal(PERFORM_SGL); + + display("Tested class\t:" + debugeeClass.name()); + + ThreadReference thrd = debugee.threadByName("main"); + + StepRequest sreq; + BreakpointRequest brkp; + Field testedField; + PrimitiveValue val; + + for (int i = 0; i < subDirs.length; i++) { + brkp = debugee.setBreakpoint(debugeeClass, + redefineclasses031a.brkpMethodName, + redefineclasses031a.brkpLineNumber); + debugee.resume(); + + waitBreakpointEvent(brkp, waitTime); + + redefineDebugee(subDirs[i]); + + sreq = debugee.getEventRequestManager().createStepRequest(thrd, + StepRequest.STEP_LINE, + StepRequest.STEP_OVER); + sreq.enable(); + debugee.resume(); + + waitStepEvent(sreq, waitTime); + + testedField = debugeeClass.fieldByName("testedField"); + val = (PrimitiveValue )debugeeClass.getValue(testedField); + if (val.intValue() != redefineclasses031a.NEW_VALUES[i]) { + exitStatus = Consts.TEST_FAILED; + complain("actual value = " + val.intValue() + + ", expected " + redefineclasses031a.NEW_VALUES[i]); + } else { + display("actual value = " + val.intValue() + + ", expected " + redefineclasses031a.NEW_VALUES[i]); + } + + debugee.getEventRequestManager().deleteEventRequest(sreq); + } + debugee.resume(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee(String newClassDir) { + Map mapBytes; + boolean alreadyComplained = false; + display("\n" + newClassDir + ">>>"); + mapBytes = mapClassToBytes(testDir + File.separator + newClassDir + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new Failure("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } + + private StepEvent waitStepEvent(StepRequest brkp, long waitTime) { + Event event; + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + if (!(event instanceof StepEvent )) { + throw new Failure("StepEvent didn't arrive"); + } + + return (StepEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/TestDescription.java new file mode 100644 index 00000000000..1dacd22efca --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/TestDescription.java @@ -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/VirtualMachine/redefineClasses/redefineclasses031. + * VM Testbase keywords: [jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses(). + * In for loop the test sets breakpoint and tries to redefines debugee's + * method by changing value of debugee's field. After resuming + * debugee, the test checks if a tested field contains correct + * value. + * COMMENTS + * This is a regression test on the following bug: + * 4724076 Redefine does not work in for/while loop + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses031 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses031a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass01 newclass02 newclass03 newclass04 newclass05 + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses031 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass01/redefineclasses031a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass01/redefineclasses031a.java new file mode 100644 index 00000000000..981d20b42ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass01/redefineclasses031a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses031a is deugee's part of the redefineclasses031. + */ +public class redefineclasses031a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 78; + + static final int [] NEW_VALUES = { + 1, 2, 3, 4, 5 + }; + + static int testedField = 0; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + performTest(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static public void doSomething() { + + testedField = NEW_VALUES[0]; +// ^^^ will be changed + } + + static void performTest() { + // invoking of redefined method + for(int i = 0; i < NEW_VALUES.length; i++) { + // brkpLineNumber + doSomething(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass02/redefineclasses031a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass02/redefineclasses031a.java new file mode 100644 index 00000000000..55a93d492aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass02/redefineclasses031a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses031a is deugee's part of the redefineclasses031. + */ +public class redefineclasses031a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 78; + + static final int [] NEW_VALUES = { + 1, 2, 3, 4, 5 + }; + + static int testedField = 0; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + performTest(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static public void doSomething() { + + testedField = NEW_VALUES[1]; +// ^^^ will be changed + } + + static void performTest() { + // invoking of redefined method + for(int i = 0; i < NEW_VALUES.length; i++) { + // brkpLineNumber + doSomething(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass03/redefineclasses031a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass03/redefineclasses031a.java new file mode 100644 index 00000000000..620d4fb961b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass03/redefineclasses031a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses031a is deugee's part of the redefineclasses031. + */ +public class redefineclasses031a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 78; + + static final int [] NEW_VALUES = { + 1, 2, 3, 4, 5 + }; + + static int testedField = 0; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + performTest(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static public void doSomething() { + + testedField = NEW_VALUES[2]; +// ^^^ will be changed + } + + static void performTest() { + // invoking of redefined method + for(int i = 0; i < NEW_VALUES.length; i++) { + // brkpLineNumber + doSomething(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass04/redefineclasses031a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass04/redefineclasses031a.java new file mode 100644 index 00000000000..527951266d2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass04/redefineclasses031a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses031a is deugee's part of the redefineclasses031. + */ +public class redefineclasses031a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 78; + + static final int [] NEW_VALUES = { + 1, 2, 3, 4, 5 + }; + + static int testedField = 0; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + performTest(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static public void doSomething() { + + testedField = NEW_VALUES[3]; +// ^^^ will be changed + } + + static void performTest() { + // invoking of redefined method + for(int i = 0; i < NEW_VALUES.length; i++) { + // brkpLineNumber + doSomething(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass05/redefineclasses031a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass05/redefineclasses031a.java new file mode 100644 index 00000000000..941315415ae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031/newclass05/redefineclasses031a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses031a is deugee's part of the redefineclasses031. + */ +public class redefineclasses031a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 78; + + static final int [] NEW_VALUES = { + 1, 2, 3, 4, 5 + }; + + static int testedField = 0; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + performTest(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static public void doSomething() { + + testedField = NEW_VALUES[4]; +// ^^^ will be changed + } + + static void performTest() { + // invoking of redefined method + for(int i = 0; i < NEW_VALUES.length; i++) { + // brkpLineNumber + doSomething(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031a.java new file mode 100644 index 00000000000..8f3980b4e41 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses031a.java @@ -0,0 +1,82 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses031a is deugee's part of the redefineclasses031. + */ +public class redefineclasses031a { + + public final static String brkpMethodName = "performTest"; + public final static int brkpLineNumber = 79; + + static final int [] NEW_VALUES = { + 1, 2, 3, 4, 5 + }; + + static int testedField = 0; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + performTest(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static public void doSomething() { + + testedField = 0; +// ^^^ will be changed + } + + static void performTest() { + // invoking of redefined method + for(int i = 0; i < NEW_VALUES.length; i++) { + + doSomething(); // brkpLineNumber + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032.java new file mode 100644 index 00000000000..b5401270162 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032.java @@ -0,0 +1,212 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses(). + * The test stops in justMethod, does a redefineClasses which deletes + * a line in that method and then tries to get StackFrame.thisObject(). + * When canRedefineClasses() is false, the test is + * considered as passed and completes it's execution. + */ + +public class redefineclasses032 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses032"; + private final static String debugeeName = debuggerName + "a"; + private final static String Name = debuggerName + "b"; + + public final static String PERFORM_SGL = "perform"; + + private final static String newClassFile = "newclass" + File.separator + + prefix.replace('.',File.separatorChar) + + "redefineclasses032a.class"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String testDir; + + private ClassType debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses032 thisTest = new redefineclasses032(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + testDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + try { + thisTest.execTest(); + } catch (Failure e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.resume(); + debugee.quit(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + debugeeClass = (ClassType)debugee.classByName(debugeeName); + + display("\nTEST BEGINS"); + display("==========="); + + debugee.VM().suspend(); + + display("Tested class\t:" + debugeeClass.name()); + + ThreadReference thrd = debugee.threadByName("main"); + + BreakpointRequest brkp = debugee.setBreakpoint(debugeeClass, + redefineclasses032a.brkpMethodName, + redefineclasses032a.brkpLineNumber); + debugee.resume(); + debugee.sendSignal(PERFORM_SGL); + + waitBreakpointEvent(brkp, waitTime); + + display("\nredefining..."); + redefineDebugee(); + + StackFrame stackFrame = null; + ObjectReference obj = null; + display("getting current frane..."); + try { + stackFrame = thrd.frame(0); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + display("getting stackFrame.thisObject()..."); + try { + obj = stackFrame.thisObject(); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + if (obj != null) { + exitStatus = Consts.TEST_FAILED; + complain("stackFrame.thisObject() is not null for static method"); + } + + debugee.resume(); + + display("\n============="); + display("TEST FINISHES\n"); + } + + private void redefineDebugee() { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(testDir + File.separator + newClassFile); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(debugeeClass, arrayToRedefine); + return mapForClass; + } + + private BreakpointEvent waitBreakpointEvent(BreakpointRequest brkp, long waitTime) { + Event event; + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + if (!(event instanceof BreakpointEvent )) { + throw new Failure("BreakpointEvent didn't arrive"); + } + + return (BreakpointEvent )event; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/TestDescription.java new file mode 100644 index 00000000000..db8b11e6178 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses032. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses(). + * The test stops in justMethod, does a redefineClasses which deletes + * a line in that method and then tries to get StackFrame.thisObject(). + * COMMENTS + * This is a regression test on the following bug: + * 4660477 After a redefineClasses, StackFrame.thisObject() + * gets JDWP Error 23 + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses032 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses032a + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses032 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/newclass/redefineclasses032a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/newclass/redefineclasses032a.java new file mode 100644 index 00000000000..54f538dd158 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/newclass/redefineclasses032a.java @@ -0,0 +1,67 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses032a is deugee's part of the redefineclasses032. + */ +public class redefineclasses032a { + + public final static String brkpMethodName = "justMethod"; + public final static int brkpLineNumber = 63; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + justMethod(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static void justMethod() { // brkpLineNumber +// int local = 0; +// return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032a.java new file mode 100644 index 00000000000..214e6420f36 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032a.java @@ -0,0 +1,67 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses032a is deugee's part of the redefineclasses032. + */ +public class redefineclasses032a { + + public final static String brkpMethodName = "justMethod"; + public final static int brkpLineNumber = 64; + + 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 instr; + do { + instr = pipe.readln(); + if (instr.equals("perform")) { + justMethod(); + } else if (instr.equals("quit")) { + log.display(instr); + break; + } else { + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } while (true); + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + static void justMethod() { + int local = 0; // brkpLineNumber + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034.java new file mode 100644 index 00000000000..8651738aeef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034.java @@ -0,0 +1,316 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses() + * in case when redefined class loaded by a custom loader. + * + * The test perform next steps:
    + * 1. Debugee loads a tested class by the custom loader.
    + * 2. When getting ClassPrepareEvent, debugger checks + * class loader of tested class to be the custom class loader.
    + * 3. Debugger redefines the tested class and checks the redefinition + * to be successful.
    + * The abose steps are performed for two cases, when the custom loader + * extends java.net.URLClassLoader and when the custom loader + * directly extends java.lang.ClassLoader. + */ + +public class redefineclasses034 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses034"; + public final static String debugeeName = debuggerName + "a"; + public final static int TESTCASE_NUMBER = 2; + public final static String [] testedClassName = { + debuggerName + "b", + debuggerName + "c" + }; + private final static String [] clsLdrs = { + debugeeName + "ClassLoaderB", + debugeeName + "ClassLoaderC" + }; + + private static final String redefinedMethodName = "justMethod"; + + private final static String PATH = "newclass" + File.separator + + prefix.replace('.',File.separatorChar); + private final static String [] newClassFile = { + PATH + "redefineclasses034b.class", + PATH + "redefineclasses034c.class" + }; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 3; + private int currentCase = -1; + private ReferenceType testedClass, debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses034 thisTest = new redefineclasses034(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); +// debugee.redirectStderr(log.getOutStream()); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); +// debugee.resume(); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + int eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debuggerName + "*"); + req.addClassExclusionFilter(debugeeName + "Class*"); + req.addClassExclusionFilter(debuggerName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + display(" event ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + testedClass = ((ClassPrepareEvent )event).referenceType();// debugee.classByName(testedClassNameB); + String className = testedClass.name(); + debugeeClass = debugee.classByName(debugeeName); + display(">>>>" + className); + if (className.compareTo(debugeeName) == 0) { + debugee.setBreakpoint(testedClass, + redefineclasses034a.brkpMethodName, + redefineclasses034a.brkpLineNumber); + display(""); + + } else if ( !checkCase(currentCase) ) { + complain("Unexpected event for \"" + className + + "\" class"); + exitStatus = Consts.TEST_FAILED; + } + + debugee.resume(); + eventCount++; + + } else if (event instanceof BreakpointEvent) { + currentCase++; + display("\ntestcase " + (currentCase + 1)); + display("==========="); + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount != expectedEventCount) { + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private boolean checkCase(int index) { + display("\nclasses info on debugger side:"); + display("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + display("testedClass\t:" + testedClassName[index]); + + String clsLdrName = testedClass.classLoader().referenceType().name(); + String clsLdrName4Debugee = debugeeClass.classLoader().referenceType().name(); + display("class loader\t:" + clsLdrName); + display("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + display("debugeeClass\t:" + debugeeClass.name()); + display("class loader\t:" + clsLdrName4Debugee); + display("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + if (clsLdrName.compareTo(clsLdrName4Debugee) == 0 + || clsLdrName.compareTo(clsLdrs[index]) != 0) { + complain("wrong class loader \"" + clsLdrName + + "\"\n\tfor \"" + testedClassName[index] + "\""); + exitStatus = Consts.TEST_FAILED; + } + + List methods = testedClass.methodsByName(redefinedMethodName); + Method mthd = (Method)methods.get(0); + int varsBefore = localVars(mthd); + + display("\nredefining..."); + redefineDebugee(newClassFile[index]); + + methods = testedClass.methodsByName(redefinedMethodName); + mthd = (Method)methods.get(0); + int varsAfter = localVars(mthd); + + if (varsAfter == varsBefore) { + complain("count of local variables is not changed!"); + exitStatus = Consts.TEST_FAILED; + } + display(""); + return exitStatus != Consts.TEST_FAILED; + } + + private void redefineDebugee(String classFileName) { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(classDir + File.separator + classFileName); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private int localVars(Method mthd) { + int res = 0; + try { + List locVars = mthd.variables(); + res = locVars.size(); + display("\ncount of local variables: " + res); + + } catch (AbsentInformationException e) { + display("AbsentInformationException: no info"); + } + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/TestDescription.java new file mode 100644 index 00000000000..4c9f21e17fa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses034. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses() + * in case when redefined class loaded by a custom loader. + * The test perform next steps: + * 1. Debugee loads a tested class by the custom loader. + * 2. When getting ClassPrepareEvent, debugger checks + * class loader of tested class to be the custom class loader. + * 3. Debugger redefines the tested class and checks the redefinition + * to be successful. + * The abose steps are performed for two cases, when the custom loader + * extends java.net.URLClassLoader and when the custom loader directly + * extends java.lang.ClassLoader. + * COMMENTS + * The test was developed as a regression test for + * #4739099 JDI HotSwap class file replacement with custom classloader broken + * 12/20/2002 test was fixed according to test bug 4778296: + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034a + * + * @comment make sure redefineclasses034a is compiled with full debug info + * @clean nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034a + * @compile -g:lines,source,vars ../redefineclasses034a.java + * + * @comment compile loadclassXX to bin/loadclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * loadclass + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/loadclass/redefineclasses034b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/loadclass/redefineclasses034b.java new file mode 100644 index 00000000000..e4c8641d5de --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/loadclass/redefineclasses034b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses034b is deugee's part of the redefineclasses034. + */ + +public class redefineclasses034b { + + void justMethod() { +// int local = 0; +// return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/loadclass/redefineclasses034c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/loadclass/redefineclasses034c.java new file mode 100644 index 00000000000..9bd4734f00c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/loadclass/redefineclasses034c.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses034b is deugee's part of the redefineclasses034. + */ + +public class redefineclasses034c { + + void justMethod() { +// int local = 0; +// return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/newclass/redefineclasses034b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/newclass/redefineclasses034b.java new file mode 100644 index 00000000000..03bed706a52 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/newclass/redefineclasses034b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses034b is deugee's part of the redefineclasses034. + */ + +public class redefineclasses034b { + + void justMethod() { + int local = 0; + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/newclass/redefineclasses034c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/newclass/redefineclasses034c.java new file mode 100644 index 00000000000..8b3490e4910 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/newclass/redefineclasses034c.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses034b is deugee's part of the redefineclasses034. + */ + +public class redefineclasses034c { + + void justMethod() { + int local = 0; + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034a.java new file mode 100644 index 00000000000..ba0205b8987 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034a.java @@ -0,0 +1,136 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; +import java.net.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses034a is deugee's part of the redefineclasses034. + */ +public class redefineclasses034a { + public final static String brkpMethodName = "loadClass"; + public final static int brkpLineNumber = 72; + + static Object obj; + static Class cls; + static ClassLoader clsLoader[]; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.err, argHandler); + + String oldClassDir = argv[0] + File.separator + "loadclass"; + + URL urls[] = new URL[1]; + clsLoader = new ClassLoader[redefineclasses034.TESTCASE_NUMBER]; + try { + urls[0] = new File(oldClassDir).toURL(); + } catch (MalformedURLException e) { + log.display("->" + e); + } + clsLoader[0] = new redefineclasses034aClassLoaderB(urls); + clsLoader[1] = new redefineclasses034aClassLoaderC(oldClassDir); + + for (int i = 0; i < 2; i++) { + loadClass(clsLoader[i],redefineclasses034.testedClassName[i]); + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void loadClass(ClassLoader clsLoader, String className) { + try { + cls = clsLoader.loadClass(className); // brkpLineNumber + obj = cls.newInstance(); + log.display(className); + log.display("===================================="); + log.display("class loader's info on debugee side:"); + log.display("===================================="); + log.display("custom class loader\t:" + cls.getClassLoader()); + log.display("default class loader\t:" + + Class.forName(redefineclasses034.debugeeName).getClassLoader()); + + log.display("------------------------------------"); + } catch (Exception e) { + log.display("" + e); + e.printStackTrace(); + } + } +} + +class redefineclasses034aClassLoaderB extends URLClassLoader{ + + redefineclasses034aClassLoaderB(URL [] urllst) { + super(urllst); + } +} + +class redefineclasses034aClassLoaderC extends ClassLoader{ + + private String classPath; + + redefineclasses034aClassLoaderC(String classPath) { + super(redefineclasses034aClassLoaderC.class.getClassLoader()); + this.classPath = classPath; + } + + protected Class findClass(String name) throws ClassNotFoundException { + String classFileName = classPath + File.separator + + name.replace('.', File.separatorChar) + + ".class"; + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + try { + int len = in.available(); + byte[] data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + return defineClass(name, data, 0, data.length); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (Throwable e) { + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035.java new file mode 100644 index 00000000000..ca7b7c167c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035.java @@ -0,0 +1,335 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; + +import java.util.*; +import java.io.*; + +/** + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses() + * in case when redefined class loaded by a custom loader. + * + * The test perform next steps:
    + * 1. Debugee loads a tested class by the custom loader.
    + * 2. When getting ClassPrepareEvent, debugger checks class + * loader of tested class to be the custom class loader and creates + * MethodEntryRequest for tested class and waits + * a corresponding event.
    + * 3. Debugee calls a method of the tested class.
    + * 4. After getting MethodEntryEvent, debugger redefines + * the tested class and checks the redefinition to be successful.
    + * + * The above steps are performed for two cases, when the custom loader + * extends java.net.URLClassLoader and when the custom loader directly + * extends java.lang.ClassLoader. + */ + +public class redefineclasses035 { + + public final static String UNEXPECTED_STRING = "***Unexpected exception "; + + private final static String prefix = "nsk.jdi.VirtualMachine.redefineClasses."; + private final static String debuggerName = prefix + "redefineclasses035"; + public final static String debugeeName = debuggerName + "a"; + public final static int TESTCASE_NUMBER = 2; + public final static String [] testedClassName = { + debuggerName + "b", + debuggerName + "c" + }; + private final static String [] expectedClsLdrs = { + debugeeName + "ClassLoaderB", + debugeeName + "ClassLoaderC" + }; + + static final String redefinedMethodName = "justMethod"; + + private final static String PATH = "newclass" + File.separator + + prefix.replace('.',File.separatorChar); + private final static String [] newClassFile = { + PATH + "redefineclasses035b.class", + PATH + "redefineclasses035c.class" + }; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + private static long waitTime; + private static String classDir; + + private int expectedEventCount = 4; + private int currentCase = -1; + private ReferenceType testedClass, debugeeClass; + + private static void display(String msg) { + log.display(msg); + } + + private static void complain(String msg) { + log.complain(msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + redefineclasses035 thisTest = new redefineclasses035(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + classDir = argv[0]; + waitTime = argHandler.getWaitTime() * 60000; + + Binder binder = new Binder(argHandler, log); + debugee = binder.bindToDebugee(debugeeName); + debugee.redirectOutput(log); + + try { + thisTest.execTest(); + } catch (Throwable e) { + exitStatus = Consts.TEST_FAILED; + e.printStackTrace(); + } finally { + debugee.endDebugee(); + } + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() throws Failure { + + if (!debugee.VM().canRedefineClasses()) { + display("\n>>>canRedefineClasses() is false<<< test canceled.\n"); + return; + } + + display("\nTEST BEGINS"); + display("==========="); + + EventSet eventSet = null; + EventIterator eventIterator = null; + Event event; + long totalTime = waitTime; + long tmp, begin = System.currentTimeMillis(), + delta = 0; + boolean exit = false; + + int eventCount = 0; + EventRequestManager evm = debugee.getEventRequestManager(); + ClassPrepareRequest req = evm.createClassPrepareRequest(); + req.addClassFilter(debuggerName + "*"); + req.addClassExclusionFilter(debugeeName + "Class*"); + req.addClassExclusionFilter(debuggerName); + req.enable(); + debugee.resume(); + + while (totalTime > 0 && !exit) { + if (eventIterator == null || !eventIterator.hasNext()) { + try { + eventSet = debugee.VM().eventQueue().remove(totalTime); + } catch (InterruptedException e) { + new Failure(e); + } + if (eventSet != null) { + eventIterator = eventSet.eventIterator(); + } else { + eventIterator = null; + } + } + if (eventIterator != null) { + while (eventIterator.hasNext()) { + event = eventIterator.nextEvent(); + display("\nevent ===>>> " + event); + + if (event instanceof ClassPrepareEvent) { + testedClass = ((ClassPrepareEvent )event).referenceType(); + String className = testedClass.name(); + + if (className.compareTo(debugeeName) == 0) { + prepareTestCases(); + + } else { + createMethodEntryRequest(currentCase); + } + + debugee.resume(); + + } else if (event instanceof BreakpointEvent) { + currentCase++; + display("\ntestcase " + (currentCase + 1)); + display("==========="); + debugee.resume(); + + } else if (event instanceof MethodEntryEvent) { + checkCase((MethodEntryEvent )event); + eventCount++; + debugee.resume(); + + } else if (event instanceof VMDeathEvent) { + exit = true; + break; + } else if (event instanceof VMDisconnectEvent) { + exit = true; + break; + } // if + } // while + } // if + tmp = System.currentTimeMillis(); + delta = tmp - begin; + totalTime -= delta; + begin = tmp; + } + + if (totalTime <= 0) { + complain("out of wait time..."); + exitStatus = Consts.TEST_FAILED; + } + if (eventCount != expectedEventCount) { + complain("expecting " + expectedEventCount + + " events, but " + + eventCount + " events arrived."); + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + } + + private void checkCase(MethodEntryEvent event) { + Method mthd = getCurrentMethod(event.thread()); + if (mthd.isConstructor()) { + display("it is constructor (skipped)"); + return; + } + + display("\nredefining..."); + redefineDebugee(newClassFile[currentCase]); + + mthd = getCurrentMethod(event.thread()); + + if (mthd.isObsolete()) { + display("!!!method is obsolete!!!"); + display("redefinition is OK"); + event.request().disable(); + display("MethodEntryEvent is being disabled"); + } else { + complain("method is not obsolete"); + complain("redefinition was not OK"); + exitStatus = Consts.TEST_FAILED; + } + display(""); + return; + } + + private MethodEntryRequest createMethodEntryRequest(int index) { + display("\nclasses info on debugger side:"); + display("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + display("testedClass\t:" + testedClassName[currentCase]); + + String clsLdrName = testedClass.classLoader().referenceType().name(); + String clsLdrName4Debugee = debugeeClass.classLoader().referenceType().name(); + display("class loader\t:" + clsLdrName); + display("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + if (clsLdrName.compareTo(expectedClsLdrs[currentCase]) != 0) { + complain("wrong class loader \"" + clsLdrName + + "\"\n\tfor \"" + testedClassName[currentCase] + "\""); + exitStatus = Consts.TEST_FAILED; + } + + EventRequestManager evm = debugee.getEventRequestManager(); + MethodEntryRequest request = evm.createMethodEntryRequest(); + request.addClassFilter(testedClassName[index]); + request.enable(); + return request; + } + + private void redefineDebugee(String classFileName) { + Map mapBytes; + boolean alreadyComplained = false; + mapBytes = mapClassToBytes(classDir + File.separator + classFileName); + try { + debugee.VM().redefineClasses(mapBytes); + } catch (Exception e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private Map mapClassToBytes(String fileName) { + display("class-file\t:" + fileName); + File fileToBeRedefined = new File(fileName); + int fileToRedefineLength = (int )fileToBeRedefined.length(); + byte[] arrayToRedefine = new byte[fileToRedefineLength]; + + FileInputStream inputFile; + try { + inputFile = new FileInputStream(fileToBeRedefined); + } catch (FileNotFoundException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + + try { + inputFile.read(arrayToRedefine); + inputFile.close(); + } catch (IOException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + HashMap mapForClass = new HashMap(); + mapForClass.put(testedClass, arrayToRedefine); + return mapForClass; + } + + private Method getCurrentMethod(ThreadReference thread) { + try { + Method mthd = thread.frame(0).location().method(); + display("current method\t:" + mthd); + return mthd; + } catch (IncompatibleThreadStateException e) { + throw new Failure(UNEXPECTED_STRING + e); + } + } + + private void prepareTestCases() { + debugeeClass = debugee.classByName(debugeeName); + display("debugeeClass\t\t:" + debugeeClass.name()); + display("default class loader\t:" + + debugeeClass.classLoader().referenceType().name()); + display("setting breakpoint..."); + debugee.setBreakpoint(testedClass, + redefineclasses035a.brkpMethodName, + redefineclasses035a.brkpLineNumber); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/TestDescription.java new file mode 100644 index 00000000000..d6f04cef61a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/VirtualMachine/redefineClasses/redefineclasses035. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test checks up com.sun.jdi.VirtualMachine.redefineClasses() + * in case when redefined class loaded by a custom loader. + * The test perform next steps: + * 1. Debugee loads a tested class by the custom loader. + * 2. When getting ClassPrepareEvent, debugger checks class loader + * of tested class to be the custom class loader and creates + * MethodEntryRequest for tested class and waits a corresponding + * event. + * 3. Debugee calls a method of the tested class. + * 4. After getting MethodEntryEvent, debugger redefines the tested + * class and checks the redefinition to be successful. + * The above steps are performed for two cases, when the custom loader + * extends java.net.URLClassLoader and when the custom loader directly + * extends java.lang.ClassLoader. + * COMMENTS + * The test was developed as a regression test for + * #4739099 JDI HotSwap class file replacement with custom classloader broken + * 4777347 TEST_BUG: redefineclasses035 wrongly redefines method + * Test was fixed according to test bug 4778296: + * - handling VMStartEvent was removed from the debugger part of the test + * - quit on VMDeathEvent was added to the event handling loop + * Test updated to wait for debugee VM exit: + * - standard method Debugee.endDebugee() is used instead of final Debugee.resume() + * #5055417 TEST: warnings and notes caused by generification + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses035 + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses035a + * + * @comment compile loadclassXX to bin/loadclassXX + * @run driver nsk.share.ExtraClassesBuilder + * loadclass + * + * @comment compile newclassXX to bin/newclassXX + * with full debug info + * @run driver nsk.share.ExtraClassesBuilder + * -g:lines,source,vars + * newclass + * + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.redefineClasses.redefineclasses035 + * ./bin + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/loadclass/redefineclasses035b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/loadclass/redefineclasses035b.java new file mode 100644 index 00000000000..3e78d3e3f63 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/loadclass/redefineclasses035b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses035b is deugee's part of the redefineclasses035. + */ + +public class redefineclasses035b { + + public void justMethod() { + int local = 0; + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/loadclass/redefineclasses035c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/loadclass/redefineclasses035c.java new file mode 100644 index 00000000000..0bdc28011ee --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/loadclass/redefineclasses035c.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses035b is deugee's part of the redefineclasses035. + */ + +public class redefineclasses035c { + + public void justMethod() { + int local = 0; + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/newclass/redefineclasses035b.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/newclass/redefineclasses035b.java new file mode 100644 index 00000000000..5dfb82a3ed7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/newclass/redefineclasses035b.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses035b is deugee's part of the redefineclasses035. + */ + +public class redefineclasses035b { + + public void justMethod() { + int local = 0, local1 = 1; + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/newclass/redefineclasses035c.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/newclass/redefineclasses035c.java new file mode 100644 index 00000000000..32d70c6eb20 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/newclass/redefineclasses035c.java @@ -0,0 +1,40 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * redefineclasses035b is deugee's part of the redefineclasses035. + */ + +public class redefineclasses035c { + + public void justMethod() { + int local = 0, local1 = 1; + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035a.java new file mode 100644 index 00000000000..bb12bc8c9ba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035a.java @@ -0,0 +1,143 @@ +/* + * 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.VirtualMachine.redefineClasses; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import java.io.*; +import java.net.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * redefineclasses035a is deugee's part of the redefineclasses035. + */ +public class redefineclasses035a { + public final static String brkpMethodName = "loadClass"; + public final static int brkpLineNumber = 72; + + static Object obj; + static Class cls; + static ClassLoader clsLoader[]; + static Log log; + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(System.out, argHandler); + + String oldClassDir = argv[0] + File.separator + "loadclass"; + + URL urls[] = new URL[1]; + clsLoader = new ClassLoader[redefineclasses035.TESTCASE_NUMBER]; + try { + urls[0] = new File(oldClassDir).toURL(); + } catch (MalformedURLException e) { + log.display("->" + e); + } + clsLoader[0] = new redefineclasses035aClassLoaderB(urls); + clsLoader[1] = new redefineclasses035aClassLoaderC(oldClassDir); + + for (int i = 0; i < 2; i++) { + loadClass(clsLoader[i],redefineclasses035.testedClassName[i]); + } + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + private static void loadClass(ClassLoader clsLoader, String className) { + try { + log.display("loading class \"" + className + "\"..."); // brkpLineNumber + cls = clsLoader.loadClass(className); + obj = cls.newInstance(); + log.display("===================================="); + log.display("class loader's info on debugee side:"); + log.display("===================================="); + log.display("custom class loader\t:" + cls.getClassLoader()); + log.display("default class loader\t:" + + Class.forName(redefineclasses035.debugeeName).getClassLoader()); + + log.display("------------------------------------"); + + log.display("invoking \"" + redefineclasses035.redefinedMethodName + + "\"..."); + java.lang.reflect.Method mthd; + mthd = cls.getMethod(redefineclasses035.redefinedMethodName); + mthd.invoke(obj); + + } catch (Exception e) { + log.display("" + e); + e.printStackTrace(); + } + } +} + +class redefineclasses035aClassLoaderB extends URLClassLoader{ + + redefineclasses035aClassLoaderB(URL [] urllst) { + super(urllst); + } +} + +class redefineclasses035aClassLoaderC extends ClassLoader{ + + private String classPath; + + redefineclasses035aClassLoaderC(String classPath) { + super(redefineclasses035aClassLoaderC.class.getClassLoader()); + this.classPath = classPath; + } + + protected Class findClass(String name) throws ClassNotFoundException { + String classFileName = classPath + File.separator + + name.replace('.', File.separatorChar) + + ".class"; + FileInputStream in; + try { + in = new FileInputStream(classFileName); + if (in == null) { + throw new ClassNotFoundException(classFileName); + } + } catch (FileNotFoundException e) { + throw new ClassNotFoundException(classFileName, e); + } + + try { + int len = in.available(); + byte[] data = new byte[len]; + for (int total = 0; total < data.length; ) { + total += in.read(data, total, data.length - total); + } + return defineClass(name, data, 0, data.length); + } catch (IOException e) { + throw new ClassNotFoundException(classFileName, e); + } finally { + try { + in.close(); + } catch (Throwable e) { + } + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001.java new file mode 100644 index 00000000000..db12a441e96 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001.java @@ -0,0 +1,176 @@ +/* + * 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.VirtualMachine.resume; + +import nsk.share.*; +import nsk.share.jdi.*; +import com.sun.jdi.*; +import java.io.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +public class resume001 extends TestDebuggerType2 { + + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new resume001().runIt(argv, out); + } + + protected String debuggeeClassName() { + return resume001a.class.getName(); + } + + class EventListener extends EventHandler.EventListener { + Object lock = new Object(); + + volatile int breakpointCounter; + + volatile int expectedBreakpointNumber; + + EventListener(int expectedBreakpointNumber) { + this.expectedBreakpointNumber = expectedBreakpointNumber; + } + + void waitForBreakpoints() { + synchronized (lock) { + while (breakpointCounter < expectedBreakpointNumber) { + try { + lock.wait(); + } catch (InterruptedException e) { + unexpectedException(e); + } + } + } + } + + public boolean eventReceived(Event event) { + if (event instanceof BreakpointEvent) { + log.display("BreakpointEvent was received: " + event); + + breakpointCounter++; + + if (breakpointCounter == expectedBreakpointNumber) { + synchronized (lock) { + lock.notify(); + } + } + + if (breakpointCounter > expectedBreakpointNumber) { + setSuccess(false); + System.out.println("Extra breakpoint event was received: " + event); + } + + return true; + } + + return false; + } + } + + protected void doTest() { + ReferenceType testThreadClass = debuggee.classByName(resume001a.class.getName()); + + BreakpointRequest breakpointRequest = null; + + try { + for (Location location : testThreadClass.allLineLocations()) { + if (location.lineNumber() == resume001a.BREAKPOINT_LINE_NUMBER) { + breakpointRequest = debuggee.getEventRequestManager().createBreakpointRequest(location); + break; + } + } + } catch (AbsentInformationException e) { + unexpectedException(e); + return; + } + + if (breakpointRequest == null) { + setSuccess(false); + log.complain("Location for line " + resume001a.BREAKPOINT_LINE_NUMBER + " wasn't found in class " + testThreadClass.name()); + return; + } + + breakpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + breakpointRequest.enable(); + + log.display("BreakpointRequest was created: " + breakpointRequest); + + EventHandler eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + try { + /* + * Wait for BreakpointEvents from debuggee main thread and from each + * additional test thread + */ + final int suspendedThreadsNumber = resume001a.TEST_THREAD_NUMBER + 1; + + EventListener listener = new EventListener(suspendedThreadsNumber); + eventHandler.addListener(listener); + + pipe.println(resume001a.COMMAND_STOP_ALL_THREADS_AT_BREAKPOINT); + + listener.waitForBreakpoints(); + + log.display("Resume debuggee VM"); + + debuggee.VM().resume(); + + /* + * Wait for replay for previous command (resume001a.COMMAND_STOP_ALL_THREADS_AT_BREAKPOINT) + */ + if (!isDebuggeeReady()) + return; + + pipe.println(resume001a.COMMAND_JOIN_TEST_THREADS); + + if (!isDebuggeeReady()) + return; + + ReferenceType debuggeeClass = debuggee.classByName(debuggeeClassNameWithoutArgs()); + + Field counterField = debuggeeClass.fieldByName(resume001a.COUNTER_FIELD_NAME); + if (counterField == null) { + setSuccess(false); + log.complain("Field " + resume001a.COUNTER_FIELD_NAME + " wasn't found in class " + debuggeeClassNameWithoutArgs()); + return; + } + + IntegerValue value = (IntegerValue) debuggeeClass.getValue(counterField); + + /* + * Each suspended thread should increment counter after resuming + */ + if (value.value() != suspendedThreadsNumber) { + setSuccess(false); + log.complain("Unexpected value of field " + resume001a.COUNTER_FIELD_NAME + + ": " + value.intValue() + ", expected value is " + suspendedThreadsNumber); + } + } finally { + eventHandler.stopEventHandler(); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001/TestDescription.java new file mode 100644 index 00000000000..8bb58e72b9a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001/TestDescription.java @@ -0,0 +1,56 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/VirtualMachine/resume/resume001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test checks that method VirtualMachine.resume resumes all threads in debuggee VM + * as documented in ThreadReference.resume(). + * Test scenario: + * Debugger creates breakpoint at the special method in debuggee application's class. + * Then debugger forces debuggee to start several threads executing this method with + * breakpoint, main debuggee thread also calls this method. Debugger waits when all + * debuggee threads will be suspended at breakpoint, calls method VirtualMachine.resume + * and checks that all suspended threads in debuggee VM were resumed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.resume.resume001 + * nsk.jdi.VirtualMachine.resume.resume001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.resume.resume001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001a.java new file mode 100644 index 00000000000..a22ae0bdc78 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/resume/resume001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.resume; + +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/* + * Debuggee part of test (debuggee starts several test threads which should + * be suspended at breakpoint) + * + * WARNING: edit this file carefully, breakpoint line number is hardcoded + */ +public class resume001a extends AbstractJDIDebuggee { + + static final String COMMAND_STOP_ALL_THREADS_AT_BREAKPOINT = "COMMAND_START_TEST_THREADS"; + + static final String COMMAND_JOIN_TEST_THREADS = "COMMAND_JOIN_TEST_THREADS"; + + static int counter; + + static final String COUNTER_FIELD_NAME = "counter"; + + synchronized static void incCounter() { + counter++; + } + + class TestThread extends Thread { + + public void run() { + log.display(getName() + " started"); + + stopAtBreakpoint(); + + log.display(getName() + " finished"); + } + } + + static final int BREAKPOINT_LINE_NUMBER = 63; + + static void stopAtBreakpoint() { + int i = 0; // BREAKPOINT_LINE_NUMBER + + incCounter(); + } + + static final int TEST_THREAD_NUMBER = 10; + + private TestThread[] testThreads = new TestThread[TEST_THREAD_NUMBER]; + + public resume001a() { + for (int i = 0; i < testThreads.length; i++) { + testThreads[i] = new TestThread(); + } + } + + public boolean parseCommand(String command) { + if (super.parseCommand(command)) + return true; + + if (command.equals(COMMAND_STOP_ALL_THREADS_AT_BREAKPOINT)) { + /* + * All TestThreads execute method stopAtBreakpoint() + */ + for (TestThread testThread : testThreads) { + testThread.start(); + } + + // debuggee main thread also stops at breakpoint + stopAtBreakpoint(); + + return true; + } else if (command.equals(COMMAND_JOIN_TEST_THREADS)) { + for (TestThread testThread : testThreads) { + try { + testThread.join(); + } catch (InterruptedException e) { + unexpectedException(e); + } + } + return true; + } + + return false; + } + + public static void main(String args[]) { + new resume001a().doTest(args); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum002/setDefaultStratum002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum002/setDefaultStratum002.java new file mode 100644 index 00000000000..ae3f0c2f1fa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum002/setDefaultStratum002.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2007, 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/VirtualMachine/setDefaultStratum/setDefaultStratum002. + * VM Testbase keywords: [quick, jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.VirtualMachine.setDefaultStratum(String stratum)' affects result of following methods: + * - ReferenceType.defaultStratum() + * - ReferenceType.sourceName() + * - ReferenceType.allLineLocations() + * - ReferenceType.locationsOfLine(int lineNumber) + * - Method.allLineLocations() + * - Method.locationsOfLine(int lineNumber) + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined: + * "Java" "TestStratum" + * + * 9 --> 1000, source1 + * 10 --> 1001, source1 + * ... ... + * 16 --> 1007, source1 + * sde_testMethod1 + * 20 --> 1100, source1 + * 21 --> 1101, source1 + * ... ... + * 27 --> 1107, source1 + * sde_testMethod1 + * 31 --> 1200, source1 + * 32 --> 1201, source1 + * ... ... + * 38 --> 1207, source1 + * Then debugger forces debuggee to load 'TestClass1' from updated class file and obtains ReferenceType for this class + * for TestStratum in 'TestStratum1'-'TestStratum3' + * do + * - set TestStratum as VM default using 'VirtualMachine.setDefaultStratum(String stratum)' + * - checks up that following methods: + * - ReferenceType.defaultStratum() + * - ReferenceType.sourceName() + * - ReferenceType.allLineLocations() + * - ReferenceType.locationsOfLine(int lineNumber) + * - Method.allLineLocations() + * - Method.locationsOfLine(int lineNumber) + * returns information for TestStratum. + * done + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum002.setDefaultStratum002 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum002.setDefaultStratum002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum002; + +import java.io.*; +import java.util.*; +import com.sun.jdi.*; +import nsk.share.Consts; +import nsk.share.jdi.sde.*; + +public class setDefaultStratum002 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setDefaultStratum002().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type1( + className, + testStratumCount, + true); + + // debuggee loads TestClass1 from patched class file + pipe.println(SDEDebuggee.COMMAND_LOAD_CLASS + ":" + className); + + if (!isDebuggeeReady()) + return; + + // obtain ReferenceType for loaded class + ReferenceType referenceType = debuggee.classByName(className); + + List sourceNames = new ArrayList(); + List sourcePaths = new ArrayList(); + // if ReferenceType.sourcePaths(String stratum) is called with 'null' + // argument it returns source path for + // declaring type's default stratum, in this test default stratum for + // TestClass1 is "Java" + sourcePaths.add(javaSourcePath_TestClass1); + + // for each stratum available for class + for (String stratumName : testStratumData.keySet()) { + // for each stratum all locations have similar sourceName + String sourceName = testStratumData.get(stratumName).allLocations.get(0).sourceName; + + log.display("Check default stratum '" + stratumName + "' (source name '" + sourceName + "')"); + + sourceNames.clear(); + sourceNames.add(sourceName); + + vm.setDefaultStratum(stratumName); + checkReferenceType( + null, + referenceType, + sourceNames, + sourcePaths, + testStratumData.get(stratumName).allLocations); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum003/setDefaultStratum003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum003/setDefaultStratum003.java new file mode 100644 index 00000000000..27c15b952ff --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum003/setDefaultStratum003.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2007, 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum003. + * VM Testbase keywords: [jpda, jdi, feature_sde, vm6] + * VM Testbase readme: + * DESCRIPTION + * The test checks up that method 'com.sun.jdi.VirtualMachine.setDefaultStratum(String stratum)' affects StepEvents generation. + * Debugger creates copy of class file for class 'nsk.share.jdi.TestClass1' with SourceDebugExtension attribute + * which contains informations for 3 stratums('TestStratum1'-'TestStratum3') and for each of this stratums following line mapping + * is defined: + * "Java" "TestStratum" + * + * 9 --> 1000, source1 + * 11 --> 1002, source1 + * ... ... + * sde_testMethod1 + * 20 --> 1100, source1 + * 22 --> 1101, source1 + * ... ... + * sde_testMethod1 + * 31 --> 1200, source1 + * 33 --> 1201, source1 + * ... ... + * Then debugger forces debuggee to load 'TestClass1' from updated class file, starts event listener thread which saves all received StepEvents, + * enables StepEvent request(class filter is used to receive events only for 'TestClass1'). + * for TestStratum in 'TestStratum1'-'TestStratum3' + * do + * - set TestStratum as VM default + * - force debuggee to execute all methods defined in 'TestClass1' + * - when all methods was executed check up that StepEvents was generated for each location specified for TestStratum + * done + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum003.setDefaultStratum003 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum003.setDefaultStratum003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -testWorkDir . + * -testStratumCount 3 + */ + +package nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum003; + +import java.io.*; +import java.util.*; +import com.sun.jdi.request.*; +import nsk.share.Consts; +import nsk.share.jdi.EventHandler; +import nsk.share.jdi.sde.*; + +public class setDefaultStratum003 extends SDEDebugger { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new setDefaultStratum003().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-testStratumCount") && (i < args.length - 1)) { + testStratumCount = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + private int testStratumCount = 1; + + private EventHandler eventHandler; + + public void doTest() { + String className = TestClass1.class.getName(); + + Map testStratumData = prepareDefaultPatchedClassFile_Type3( + className, + testStratumCount, + true); + /* + * Method 'prepareDefaultPatchedClassFile_Type3' creates class file with + * following line mapping for each test stratum: + * + * "Java" "TestStratum" + * + * + * 9 --> 1001, source1 + * 11 --> 1002, source1 + * 14 --> 1003, source1 + * 16 --> 1004, source1 + * + * sde_testMethod1 + * 20 --> 1101, source1 + * 22 --> 1102, source1 + * 24 --> 1103, source1 + * 26 --> 1104, source1 + * + * sde_testMethod2 + * 31 --> 1201, source1 + * 33 --> 1202, source1 + * 35 --> 1203, source1 + * 37 --> 1204, source1 + */ + + eventHandler = new EventHandler(debuggee, log); + eventHandler.startListening(); + + StepEventListener stepEventListener = new StepEventListener(); + eventHandler.addListener(stepEventListener); + + StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest( + debuggee.threadByName(SDEDebuggee.mainThreadName), + StepRequest.STEP_LINE, + StepRequest.STEP_INTO); + + stepRequest.setSuspendPolicy(StepRequest.SUSPEND_EVENT_THREAD); + stepRequest.addClassFilter(TestClass1.class.getName()); + stepRequest.enable(); + + // for each stratum available for class + for (String defaultStratum : testStratumData.keySet()) { + log.display("Set default stratum: " + defaultStratum); + + stepEventListener.clearLocations(); + + vm.setDefaultStratum(defaultStratum); + + pipe.println(SDEDebuggee.COMMAND_EXECUTE_TEST_METHODS + ":" + className); + + if (!isDebuggeeReady()) + return; + + compareLocations( + stepEventListener.stepLocations(), + testStratumData.get(defaultStratum).allLocations, + defaultStratum); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java new file mode 100644 index 00000000000..99263fb0695 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java @@ -0,0 +1,204 @@ +/* + * 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.VirtualMachine.setDefaultStratum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.setDefaultStratum()
    + * complies with its specification.
    + *
    + * The test checks that String returned by the method
    + * VirtualMachine.getDefaultStratum() is equal to one
    + * set with setDefaultStratum(String).
    + *
    + */ + +public class setdefaultstratum001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + return new setdefaultstratum001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.setDefaultStratum.setdefaultstratum001a"; + + //String mName = "nsk.jdi.VirtualMachine.setDefaultStratum"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + ReferenceType testedClass = null; + + static int testExitCode = PASSED; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + String newDefaultStratum = "krop"; + + try { + vm.setDefaultStratum(newDefaultStratum); + String defaultStratum = vm.getDefaultStratum(); + if (defaultStratum != newDefaultStratum) { + log3("ERROR: defaultStratum is not set up correctly : " + defaultStratum); + testExitCode = FAILED; + } + } catch ( UnsupportedOperationException e ) { + log2(" UnsupportedOperationException"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001/TestDescription.java new file mode 100644 index 00000000000..2baa33d31d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001/TestDescription.java @@ -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/VirtualMachine/setDefaultStratum/setdefaultstratum001. + * VM Testbase keywords: [quick, jpda, jdi, redefine] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.setDefaultStratum(String) + * complies with its spec: + * public void setDefaultStratum(String stratum) + * Set this VM's default stratum (see Location for a discussion of strata). + * Overrides the per-class default set in the class file. + * Affects location queries (such as, Location.sourceName()) and + * the line boundaries used in single stepping. + * Parameters: stratum - the stratum to set as VM default, or + * null to use per-class defaults. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.setDefaultStratum.setdefaultstratum001; + * the debuggee program - nsk.jdi.VirtualMachine.setDefaultStratum.setdefaultstratum001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.setDefaultStratum.setdefaultstratum001 + * nsk.jdi.VirtualMachine.setDefaultStratum.setdefaultstratum001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.setDefaultStratum.setdefaultstratum001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001a.java new file mode 100644 index 00000000000..a3dd356c4a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001a.java @@ -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.VirtualMachine.setDefaultStratum; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the setdefaultstratum001 JDI test. + */ + +public class setdefaultstratum001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> debuggee: " + message); + } +/* + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } +*/ + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> debuggee: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.suspend()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows.
    + * After being started up,
    + * a debuggee creates a 'lockingObject' for synchronizing threads,
    + * enters a synchronized block in which it creates new thread, thread2,
    + * informs a debugger of the thread2 creation, and is waiting for reply.
    + * Since thread2 uses the same locking object in its 'run' method
    + * it is locked up until first thread leaves the synchronized block.
    + * Upon the receiption a message from the debuggee, the debugger :
    + * - sets up breakpoints for both thread2 and main thread in the debuggee,
    + * - gets both threads suspended at the breakpoints,
    + * - calls to the method VirtualMachine.suspend(),
    + * - resumes both threads individually, one time each,
    + * - sleeps for predefined time - a standard parameter of the test,
    + * - then checks up the value of debuggee's field "flagCount" which is
    + * incremented by both tested threads only after their points of
    + * suspension. Hence, if the value == 0 (initial), it has not been
    + * changed by any tested thread while the debugger has been sleeping.
    + */ + +public class suspend001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/suspend/suspend001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new suspend001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.suspend.suspend001a"; + + private String testedClassName = + "nsk.jdi.VirtualMachine.suspend.VMsuspend001a"; + + //String mName = "nsk.jdi.VirtualMachine.suspend"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + String threadName = "Thread2"; + String flagName = "flagCount"; + + String breakpointMethod1 = "runt1"; + String breakpointMethod2 = "runt2"; + + String bpLine1 = "breakpointLineNumber1"; + String bpLine2 = "breakpointLineNumber2"; + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + BreakpointRequest breakpRequest1 = null; + BreakpointRequest breakpRequest2 = null; + + + label0: { + + log2("getting ThreadReference objects and setting up breakponts"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + listIterator = allThreads.listIterator(); + for (;;) { + try { + mainThread = (ThreadReference) listIterator.next(); + if (mainThread.name().equals("main")) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoints"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + breakpRequest2 = settingBreakpoint(breakpointMethod2, bpLine2, "two"); + if (breakpRequest2 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" instructing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" thread2 is at breakpoint"); + + log2(" copying: EventSet eventSet1 = eventSet;"); + EventSet eventSet1 = eventSet; + + log2(" enabling breakpRequest2"); + breakpRequest2.enable(); + + log2(" instructing the main thread to leave to continue"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting BreakpointEvent"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + log2(" mainThread is at breakpoint"); + + log2(" debugger turned off pipe pinging"); + pipe.setPingTimeout(0); + + log2(" suspending VM"); + vm.suspend(); + + log2(" resuming threads individually: eventSet1.resume(); eventSet.resume();"); + eventSet1.resume(); + eventSet.resume(); + + log2(" before: Thread.sleep(waitTime*60000);"); + try { + Thread.sleep(waitTime*60000); + } catch ( InterruptedException e ) { + log3("ERROR: InterruptedException"); + expresult = returnCode1; + break label1; + } + + log2(" checking up debuggee's flagCount value"); + int flag = ((IntegerValue) testedclass.getValue(testedclass.fieldByName(flagName))).value(); + log2(" value of flagCount == " + flag); + if (flag != 0) { + log3("ERROR: value of flagCount != 0"); + expresult = returnCode1; + } + } + + log2(" resuming VM"); + vm.resume(); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); +// breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove (waitTime*60000); + if (eventSet == null) { +// log2(":::::: timeout when waiting for a BreakpintEvent"); + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001/TestDescription.java new file mode 100644 index 00000000000..6676e8e00d9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001/TestDescription.java @@ -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/VirtualMachine/suspend/suspend001. + * VM Testbase keywords: [jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.suspend() + * complies with its spec: + * public void suspend() + * Suspends the execution of the application running in this virtual machine. + * All threads currently running will be suspended. + * Unlike java.lang.Thread#suspend, suspends of both the virtual machine and + * individual threads are counted. Before a thread will run again, + * it must be resumed (through resume() or ThreadReference.resume()) + * the same number of times it has been suspended. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.suspend.suspend001; + * the debuggee program - nsk.jdi.VirtualMachine.suspend.suspend001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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: + * The test was modified due to fix for the bug: + * 4623150 TEST_BUG: suspend001 test fails due to internal ping timeout + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachine.suspend.suspend001 + * nsk.jdi.VirtualMachine.suspend.suspend001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.suspend.suspend001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001a.java new file mode 100644 index 00000000000..20898633f44 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001a.java @@ -0,0 +1,225 @@ +/* + * 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.VirtualMachine.suspend; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the suspend001 JDI test. + */ + +public class suspend001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> suspend001a: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> suspend001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.topLevelThreadGroups()
    + * complies with its specification.
    + *
    + * The test checks up that a List object returned by
    + * the method VirtualMachine.topLevelThreadGroups() contains
    + * only one element which type is ThreadGroupReference.
    + */ + +public class toplevelgroups001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new toplevelgroups001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.topLevelThreadGroups.toplevelgroups001a"; + + //String mName = "nsk.jdi.VirtualMachine.topLevelThreadGroups"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + List groupList = vm.topLevelThreadGroups(); + + log2("...... checking up groupList.size(); expected value == 1"); + int size = groupList.size(); + + if (size != 1) { + + log3("ERROR: groupList.size() != 1 : " + size); + testExitCode = FAILED; + + } else { + + log2("......checking up cast to ThreadGroupReference type"); + try { + String name = ((ThreadGroupReference) groupList.get(0)).name(); + log2(" groupName == " + name); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001/TestDescription.java new file mode 100644 index 00000000000..6a029487fa4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001/TestDescription.java @@ -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/VirtualMachine/topLevelThreadGroups/toplevelgroups001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.topLevelThreadGroups() + * complies with its spec: + * public java.util.List topLevelThreadGroups() + * Returns each thread group which does not have a parent. + * For each top level thread group a ThreadGroupReference is + * placed in the returned list. + * This command may be used as the first step in building a tree (or trees) + * of the existing thread groups. + * Returns: a list of ThreadGroupReference objects, + * one for each top level thread group. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.topLevelThreadGroups.toplevelgroups001; + * the debuggee program - nsk.jdi.VirtualMachine.topLevelThreadGroups.toplevelgroups001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.topLevelThreadGroups.toplevelgroups001 + * nsk.jdi.VirtualMachine.topLevelThreadGroups.toplevelgroups001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.topLevelThreadGroups.toplevelgroups001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001a.java new file mode 100644 index 00000000000..0e69c9110d0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001a.java @@ -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.VirtualMachine.topLevelThreadGroups; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the toplevelgroups001 JDI test. + */ + +public class toplevelgroups001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachine.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachine.version()
    +** complies with its specification.
    + */ + +public class version001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachine/version/version001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new version001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachine.version.version001a"; + + //String mName = "nsk.jdi.VirtualMachine.version"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + String version = vm.version(); + if (version == null) { + log3("ERROR: version == null"); + expresult = returnCode1; + } else + log2(" version == " + version); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001/TestDescription.java new file mode 100644 index 00000000000..a2d41371010 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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/VirtualMachine/version/version001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachine. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachine.version() + * complies with its spec: + * public java.lang.String version() + * Returns the version of the Java Runtime Environment in the target VM as + * reported by the property java.version. For obtaining the JDI interface + * version, use VirtualMachineManager.majorInterfaceVersion() and + * VirtualMachineManager.minorInterfaceVersion() + * Returns: the target VM version. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachine.version.version001; + * the debuggee program - nsk.jdi.VirtualMachine.version.version001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * 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.VirtualMachine.version.version001 + * nsk.jdi.VirtualMachine.version.version001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachine.version.version001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001a.java new file mode 100644 index 00000000000..656ea1bb696 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachine.version; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the version001 JDI test. + */ + +public class version001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> version001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> version001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.allConnectors()
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.allConnectors() doesn't throw
    + * an exception and returnes a List of non-null values of
    + * the Connector type each.
    + */ + +public class allconnectors001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/allConnectors/allconnectors001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new allconnectors001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + waitTime = argsHandler.getWaitTime(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + try { + log2("......call to vmm.allConnectors()"); + List connectors = vmm.allConnectors(); + log2(" size of List == " + connectors.size()); + + log2("......checking up on nulls and casts to Connector"); + ListIterator li = connectors.listIterator(); + for (; li.hasNext(); ) { + Connector connector = (Connector) li.next(); + if (connector == null) { + log3("ERROR: connector == null"); + testExitCode = FAILED; + } + } + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/allConnectors/allconnectors001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/allConnectors/allconnectors001/TestDescription.java new file mode 100644 index 00000000000..5c6e5195d25 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/allConnectors/allconnectors001/TestDescription.java @@ -0,0 +1,59 @@ +/* + * 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/VirtualMachineManager/allConnectors/allconnectors001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.allConnectors() + * complies with its spec: + * public java.util.List allConnectors() + * Returns the list of all known Connector objects. + * Returns: a list of Connector objects. + * 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.VirtualMachineManager.allConnectors.allconnectors001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.allConnectors.allconnectors001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001.java new file mode 100644 index 00000000000..e2c03af18c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001.java @@ -0,0 +1,153 @@ +/* + * 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.VirtualMachineManager.attachingConnectors; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.attachingConnectors() doesn't throw
    + * an exception and returnes a List of non-null values of
    + * the AttachingConnector type each.
    + */ + +public class attaching001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new attaching001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + waitTime = argsHandler.getWaitTime(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + try { + log2("......call to vmm.attachingConnectors()"); + List connectors = vmm.attachingConnectors(); + log2(" size of List == " + connectors.size()); + + log2("......checking up on nulls and casts to AttachingConnector"); + ListIterator li = connectors.listIterator(); + for (; li.hasNext(); ) { + AttachingConnector attachingConnector = (AttachingConnector) li.next(); + if (attachingConnector == null) { + log3("ERROR: attachingConnector == null"); + testExitCode = FAILED; + } + } + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001/TestDescription.java new file mode 100644 index 00000000000..7e8d5078a9a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001/TestDescription.java @@ -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/VirtualMachineManager/attachingConnectors/attaching001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.attachingConnectors() + * complies with its spec: + * public java.util.List attachingConnectors() + * Returns the list of known AttachingConnector objects. + * Any of the returned objects can be used to attach to + * an existing target VM and create a VirtualMachine mirror for it. + * Returns: a list of AttachingConnector objects. + * 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.VirtualMachineManager.attachingConnectors.attaching001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.attachingConnectors.attaching001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java new file mode 100644 index 00000000000..a1ab73fefa4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java @@ -0,0 +1,383 @@ +/* + * 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.VirtualMachineManager.connectedVirtualMachines; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +import java.net.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.connectedVirtualMachines()
    + * complies with its specification.
    + *
    + * Test case includes only one debuggee.
    + * The test checks up that :
    + * - after launching debugged Virtual Machine the tested method
    + * returns List containing one element of
    + * a VirtualMachine type which is equal to a mirror of
    + * the debuggee already got after launching;
    + * - after the deguggee normally ends via its exit() method,
    + * the call to the method returns an empty List.
    + */ + +public class convm001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new convm001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm001a"; + + //String mName = "nsk.jdi.VirtualMachineManager.connectedVirtualMachines"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + VirtualMachineManager vmm = null; + + List connectedVM; + VirtualMachine vm1 = null; + + int size = 0; + + + for (int i = 0; ; i++) { + + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + + vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + log2("......call to vmm.connectedVirtualMachines()"); + connectedVM = vmm.connectedVirtualMachines(); + + size = connectedVM.size(); + if (size != 1) { + log3("ERROR: connectedVM.size() != 1 : " + size); + testExitCode = FAILED; + } else { + log2(" connectedVM.size() == 1"); + log2("......getting: VirtualMachine vm1 = connectedVM.get(0);"); + vm1 = (VirtualMachine) connectedVM.get(0); + + log2("......comparing: vm.equals(vm1)"); + if (!vm.equals(vm1)) { + log3("ERROR: !vm.equals(vm1)"); + testExitCode = FAILED; + } + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + + eventQueue = vm.eventQueue(); + eventSet = null; + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + + if (vmDisconnect() == 0 ) { + log2("......connectedVM = vmm.connectedVirtualMachines();"); + connectedVM = vmm.connectedVirtualMachines(); + + size = connectedVM.size(); + if (size != 0) { + log3("ERROR: connectedVM.size() != 0 : " + size); + testExitCode = FAILED; + + log2("......since a returned list is not empty"); + log2("......try to get first element and compare to the mirror of the vm tested"); + try { + log2(" getting: vm1 = (VirtualMachine) connectedVM.get(0);"); + vm1 = (VirtualMachine) connectedVM.get(0); + + log2(" vm.name()== " + vm1.name()); + if (vm.equals(vm1)) + log2("vm.equals(vm1)"); + else + log2("!vm.equals(vm1)"); + } catch ( Exception e ) { + log2("......failure because of Exception: " + e); + } + + } else + log2(" connectedVM.size() == 0"); + } else { + log3("ERROR: threadDeath != 0"); + testExitCode = FAILED; + } + + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + private int vmDisconnect () { + + int returnCode = returnCode0; + + log2(" waiting for VMDisconnectEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a ThreadDeathEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break ll; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + case 14: VMDisconnectEvent wmde = (VMDisconnectEvent) ev; + log2(" VMDisconnectEvent removed"); + break labelBP; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001/TestDescription.java new file mode 100644 index 00000000000..203a40f8573 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001/TestDescription.java @@ -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/VirtualMachineManager/connectedVirtualMachines/convm001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.connectedVirtualMachines() + * complies with its spec: + * public List connectedVirtualMachines() + * Lists all target VMs which are connected to the debugger. + * The list includes VirtualMachine instances for any + * target VMs which initiated a connection and any target VMs to which + * this manager has initiated a connection. + * A target VM will remain in this list until the VM is disconnected. + * VMDisconnectEvent is placed in the event queue after the VM is removed from the list. + * Returns: a list of VirtualMachine objects, each mirroring a target VM. + * The tested case includes normal VM termination. + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm001; + * the debuggee program - nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 forces debuggee to invoke method System.exit() to get debuggee's death + * and checks up on the list of connected VM. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - waiting for VMStartEvent was removed from the debugger part of the test + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm001 + * nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001a.java new file mode 100644 index 00000000000..f42467be496 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachineManager.connectedVirtualMachines; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the convm001 JDI test. + */ + +public class convm001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> convm001a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> convm001a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.connectedVirtualMachines()
    + * complies with its specification.
    + *
    + * Test case includes only one debuggee.
    + * The test checks up that :
    + * - after launching debugged Virtual Machine the tested method
    + * returns List containing one element of
    + * a VirtualMachine type which is equal to a mirror of
    + * the debuggee already got after launching;
    + * - after the degugger terminates the debuggee with the method
    + * VirtualMachine.exit(),
    + * the call to the method returns an empty List.
    + */ + +public class convm002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + + static final int FAILED = 2; + + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002 ", + sHeader2 = "--> debugger: ", sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main(String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new convm002().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = "nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm002a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager = null; + + static EventQueue eventQueue = null; + + static EventSet eventSet = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + + static final int returnCode1 = 1; + + static final int returnCode2 = 2; + + static final int returnCode3 = 3; + + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis(String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + VirtualMachineManager vmm = null; + + List connectedVM; + VirtualMachine vm1 = null; + + int size = 0; + + log2("......call to Bootstrap.virtualMachineManager()"); + + vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + log2("......call to vmm.connectedVirtualMachines()"); + connectedVM = vmm.connectedVirtualMachines(); + + size = connectedVM.size(); + if (size != 1) { + log3("ERROR: connectedVM.size() != 1 : " + size); + testExitCode = FAILED; + } else { + log2(" connectedVM.size() == 1"); + log2("......getting: VirtualMachine vm1 = connectedVM.get(0);"); + vm1 = (VirtualMachine) connectedVM.get(0); + + log2("......comparing: vm.equals(vm1)"); + if (!vm.equals(vm1)) { + log3("ERROR: !vm.equals(vm1)"); + testExitCode = FAILED; + } + } + } + + eventQueue = vm.eventQueue(); + eventSet = null; + + log2("......vm1.exit(" + (PASSED + PASS_BASE) + ")"); + vm1.exit(PASSED + PASS_BASE); + + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + status + " == PASS_BASE"); + } + + if (vmDisconnect() == 0) { + log2("......connectedVM = vmm.connectedVirtualMachines();"); + connectedVM = vmm.connectedVirtualMachines(); + + size = connectedVM.size(); + if (size != 0) { + log3("ERROR: connectedVM.size() != 0 : " + size); + testExitCode = FAILED; + + log2("......since a returned list is not empty"); + log2("......try to get first element and compare to the mirror of the vm tested"); + try { + log2(" getting: vm1 = (VirtualMachine) connectedVM.get(0);"); + vm1 = (VirtualMachine) connectedVM.get(0); + + log2(" vm.name()== " + vm1.name()); + if (vm.equals(vm1)) + log2("vm.equals(vm1)"); + else + log2("!vm.equals(vm1)"); + } catch (Exception e) { + log2("......failure because of Exception: " + e); + } + + } else + log2(" connectedVM.size() == 0"); + } else { + log3("ERROR: threadDeath != 0"); + testExitCode = FAILED; + } + + log1(" TESTING ENDS"); + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + private int vmDisconnect() { + + int returnCode = returnCode0; + + log2(" waiting for VMDisconnectEvent"); + + labelBP: for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime * 60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a ThreadDeathEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch (Exception e) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext();) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor = 0;; ifor++) { + + try { + switch (ifor) { + + case 0: + AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: + BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break ll; + case 2: + ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: + ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: + ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: + MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: + MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: + ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: + StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: + ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: + ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: + VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: + VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: + WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + case 14: + VMDisconnectEvent wmde = (VMDisconnectEvent) ev; + log2(" VMDisconnectEvent removed"); + break labelBP; + + default: + log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch (ClassCastException e) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002/TestDescription.java new file mode 100644 index 00000000000..5858253ddf4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/VirtualMachineManager/connectedVirtualMachines/convm002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.connectedVirtualMachines() + * complies with its spec: + * public List connectedVirtualMachines() + * Lists all target VMs which are connected to the debugger. + * The list includes VirtualMachine instances for any + * target VMs which initiated a connection and any target VMs to which + * this manager has initiated a connection. + * A target VM will remain in this list until the VM is disconnected. + * VMDisconnectEvent is placed in the event queue after the VM is removed from the list. + * Returns: a list of VirtualMachine objects, each mirroring a target VM. + * The tested case includes terminating a gebuggee by a debugger with + * the method VirtualMachine.exit(). + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm002; + * the debuggee program - nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls to the method VirtualMachine.exit() to get debuggee's death + * and checks up on the list of connected VM. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - waiting for VMStartEvent was removed from the debugger part of the test + * - waiting for debuggee VM exit was added after invocation of vm.exit() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm002 + * nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002a.java new file mode 100644 index 00000000000..f13f9232702 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002a.java @@ -0,0 +1,62 @@ +/* + * 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.VirtualMachineManager.connectedVirtualMachines; + +import nsk.share.Log; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the convm002 JDI test. + */ + +public class convm002a { + + static Log log; + + private static void log1(String message) { + log.display("**> convm002a: " + message); + } + + public static void main (String argv[]) { + ArgumentHandler argHandler = new ArgumentHandler(argv); + + log = argHandler.createDebugeeLog(); + log1("debuggee started!"); + + // informing a debugger of readiness + IOPipe pipe = argHandler.createDebugeeIOPipe(); + pipe.println("ready"); + + /* + * In this test debugger kills debuggee using VirtualMachine.exit, so + * standard JDI tests communication protocol isn't used here + */ + try { + Thread.sleep(Long.MAX_VALUE); + } catch (Throwable t) { + // ignore all exceptions + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java new file mode 100644 index 00000000000..4b53a61d03e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java @@ -0,0 +1,388 @@ +/* + * 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.VirtualMachineManager.connectedVirtualMachines; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.connectedVirtualMachines()
    + * complies with its specification.
    + *
    + * Test case includes only one debuggee.
    + * The test checks up that :
    + * - after launching debugged Virtual Machine the tested method
    + * returns List containing one element of
    + * a VirtualMachine type which is equal to a mirror of
    + * the debuggee already got after launching;
    + * - after a debugger invalidates the debuggee
    + * with the method VirtualMachine.dispose(),
    + * the call to the method returns an empty List.
    + */ + +public class convm003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new convm003().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm003a"; + + //String mName = "nsk.jdi.VirtualMachineManager.connectedVirtualMachines"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("issuspended002a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + VirtualMachineManager vmm = null; + + List connectedVM; + VirtualMachine vm1 = null; + + int size = 0; + + + //for (int i = 0; ; i++) { + + label0 : + { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break label0; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break label0; + } + + //log1("new checkready: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + log2("......call to Bootstrap.virtualMachineManager()"); + + vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + log2("......call to vmm.connectedVirtualMachines()"); + connectedVM = vmm.connectedVirtualMachines(); + + size = connectedVM.size(); + if (size != 1) { + log3("ERROR: connectedVM.size() != 1 : " + size); + testExitCode = FAILED; + } else { + log2(" connectedVM.size() == 1"); + log2("......getting: VirtualMachine vm1 = connectedVM.get(0);"); + vm1 = (VirtualMachine) connectedVM.get(0); + + log2("......comparing: vm.equals(vm1)"); + if (!vm.equals(vm1)) { + log3("ERROR: !vm.equals(vm1)"); + testExitCode = FAILED; + } + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + //log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + eventQueue = vm.eventQueue(); + eventSet = null; + + log2("......vm1.dispose()"); + vm1.dispose(); + + if (vmDisconnect() == 0 ) { + log2("......connectedVM = vmm.connectedVirtualMachines();"); + connectedVM = vmm.connectedVirtualMachines(); + + size = connectedVM.size(); + if (size != 0) { + log3("ERROR: connectedVM.size() != 0 : " + size); + testExitCode = FAILED; + + log2("......since a returned list is not empty"); + log2("......try to get first element and compare to the mirror of the vm tested"); + try { + log2(" getting: vm1 = (VirtualMachine) connectedVM.get(0);"); + vm1 = (VirtualMachine) connectedVM.get(0); + + log2(" vm.name()== " + vm1.name()); + if (vm.equals(vm1)) + log2("vm.equals(vm1)"); + else + log2("!vm.equals(vm1)"); + } catch ( Exception e ) { + log2("......failure because of Exception: " + e); + } + + } else + log2(" connectedVM.size() == 0"); + } else { + log3("ERROR: threadDeath != 0"); + testExitCode = FAILED; + } + + log1(" TESTING ENDS"); + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + private int vmDisconnect () { + + int returnCode = returnCode0; + + log2(" waiting for VMDisconnectEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a ThreadDeathEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break ll; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + case 14: VMDisconnectEvent wmde = (VMDisconnectEvent) ev; + log2(" VMDisconnectEvent removed"); + break labelBP; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003/TestDescription.java new file mode 100644 index 00000000000..0c4ad742862 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/VirtualMachineManager/connectedVirtualMachines/convm003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.connectedVirtualMachines() + * complies with its spec: + * public List connectedVirtualMachines() + * Lists all target VMs which are connected to the debugger. + * The list includes VirtualMachine instances for any + * target VMs which initiated a connection and any target VMs to which + * this manager has initiated a connection. + * A target VM will remain in this list until the VM is disconnected. + * VMDisconnectEvent is placed in the event queue after the VM is removed from the list. + * Returns: a list of VirtualMachine objects, each mirroring a target VM. + * The tested case includes invalidating a gebuggee by a debugger with + * the method VirtualMachine.dispose(). + * The test works as follows: + * The debugger program - nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm003; + * the debuggee program - nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls to the method VirtualMachine.exit() to get debuggee's death + * and checks up on the list of connected VM. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - waiting for VMStartEvent was removed from the debugger part of the test + * - waiting for debuggee VM exit was added after invocation of vm.dispose() + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm003 + * nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.connectedVirtualMachines.convm003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003a.java new file mode 100644 index 00000000000..e35533935aa --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003a.java @@ -0,0 +1,112 @@ +/* + * 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.VirtualMachineManager.connectedVirtualMachines; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the convm003 JDI test. + */ + +public class convm003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + private static void log1(String message) { + if (verbMode) + System.err.println("**> convm003a: " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> convm003a: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test.
    + *
    + */ + +public class CreateVM002_TargetVM { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + + public static void main (String argv[]) { + System.exit(STATUS_PASSED + STATUS_TEMP); + } + + +} // end of CreateVM002_TargetVM class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM002_TranspServ.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM002_TranspServ.java new file mode 100644 index 00000000000..7ee86bf6f8a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM002_TranspServ.java @@ -0,0 +1,613 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.net.*; +import java.io.*; +import java.util.*; + +/* + * A transport service implementation based on a TCP connection used by + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test. + * It is borrowed from the com.sun.tools.jdi.SocketTransportService + */ + +public class CreateVM002_TranspServ extends TransportService { + + /** + * The listener returned by startListening encapsulates + * the ServerSocket. + */ + static class SocketListenKey extends ListenKey { + ServerSocket ss; + + SocketListenKey(ServerSocket ss) { + this.ss = ss; + } + + ServerSocket socket() { + return ss; + } + + public String address() { + InetAddress localaddr = ss.getInetAddress(); + int port = ss.getLocalPort(); + if (localaddr.isAnyLocalAddress()) { + return "" + port; + } else { + return localaddr + ":" + port; + } + } + + public String toString() { + return address(); + } + } + + /** + * Handshake with the debuggee + */ + void handshake(Socket s, long timeout) throws IOException { + s.setSoTimeout((int)timeout); + + byte[] hello = "JDWP-Handshake".getBytes("UTF-8"); + s.getOutputStream().write(hello); + + byte[] b = new byte[hello.length]; + int received = 0; + while (received < hello.length) { + int n; + try { + n = s.getInputStream().read(b, received, hello.length-received); + } catch (SocketTimeoutException x) { + throw new IOException("##> CreateVM002_TranspServ: Handshake timeout"); + } + if (n < 0) { + s.close(); + throw new IOException + ("##> CreateVM002_TranspServ: Handshake FAILED - connection prematurally closed!"); + } + received += n; + } + for (int i=0; i CreateVM002_TranspServ: Handshake FAILED - unrecognized message from target VM"); + } + } + + // disable read timeout + s.setSoTimeout(0); + } + + /** + * No-arg constructor + */ + public CreateVM002_TranspServ() { + } + + /** + * The name of this transport service + */ + public String name() { + return "CreateVM002_TranspServ"; + } + + /** + * The description of this transport service + */ + public String description() { + return "SocketTransportService for nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test."; + } + + /** + * Return the capabilities of this transport service + */ + public Capabilities capabilities() { + return new CreateVM002_TranspServCapabilities(); + } + + + /** + * Attach to the specified address with optional attach and handshake + * timeout. + */ + public Connection attach(String address, long attachTimeout, long handshakeTimeout) + throws IOException { + + if (address == null) { + throw new NullPointerException("##> CreateVM002_TranspServ: attach() - address is null"); + } + if (attachTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException("##> CreateVM002_TranspServ: attach() - timeout is negative"); + } + + int splitIndex = address.indexOf(':'); + String host; + String portStr; + if (splitIndex < 0) { + host = InetAddress.getLocalHost().getHostName(); + portStr = address; + } else { + host = address.substring(0, splitIndex); + portStr = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(portStr).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM002_TranspServ: attach() - unable to parse port number in address"); + } + + + // open TCP connection to VM + + InetSocketAddress sa = new InetSocketAddress(host, port); + Socket s = new Socket(); + try { + s.connect(sa, (int)attachTimeout); + } catch (SocketTimeoutException exc) { + try { + s.close(); + } catch (IOException x) { } + throw new TransportTimeoutException + ("##> CreateVM002_TranspServ: attach() - timed out trying to establish connection"); + } + + // handshake with the target VM + try { + handshake(s, handshakeTimeout); + } catch (IOException exc) { + try { + s.close(); + } catch (IOException x) { } + throw exc; + } + + return new CreateVM002_Connection(s); + } + + /* + * Listen on the specified address and port. Return a listener + * that encapsulates the ServerSocket. + */ + ListenKey startListening(String localaddress, int port) throws IOException { + InetSocketAddress sa; + if (localaddress == null) { + sa = new InetSocketAddress(port); + } else { + sa = new InetSocketAddress(localaddress, port); + } + ServerSocket ss = new ServerSocket(); + // if port is 0 do not set the SO_REUSEADDR flag + if (port == 0) { + ss.setReuseAddress(false); + } + ss.bind(sa); + return new SocketListenKey(ss); + } + + /** + * Listen on the specified address + */ + public ListenKey startListening(String address) throws IOException { + // use ephemeral port if address isn't specified. + if (address == null || address.length() == 0) { + address = "0"; + } + + int splitIndex = address.indexOf(':'); + String localaddr = null; + if (splitIndex >= 0) { + localaddr = address.substring(0, splitIndex); + address = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(address).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM002_TranspServ: startListening() - unable to parse port number in address"); + } + + return startListening(localaddr, port); + } + + /** + * Listen on the default address + */ + public ListenKey startListening() throws IOException { + return startListening(null, 0); + } + + /** + * Stop the listener + */ + public void stopListening(ListenKey listener) throws IOException { + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM002_TranspServ: stopListening() - Invalid listener"); + } + + synchronized (listener) { + ServerSocket ss = ((SocketListenKey)listener).socket(); + + // if the ServerSocket has been closed it means + // the listener is invalid + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM002_TranspServ: stopListening() - Invalid listener"); + } + ss.close(); + } + } + + /** + * Accept a connection from a debuggee and handshake with it. + */ + public Connection accept(ListenKey listener, long acceptTimeout, long handshakeTimeout) throws IOException { + if (acceptTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException + ("##> CreateVM002_TranspServ: accept() - timeout is negative"); + } + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM002_TranspServ: accept() - Invalid listener"); + } + ServerSocket ss; + + // obtain the ServerSocket from the listener - if the + // socket is closed it means the listener is invalid + synchronized (listener) { + ss = ((SocketListenKey)listener).socket(); + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM002_TranspServ: accept() - Invalid listener"); + } + } + + ss.setSoTimeout((int)acceptTimeout); + Socket s; + try { + s = ss.accept(); + } catch (SocketTimeoutException x) { + throw new TransportTimeoutException + ("##> CreateVM002_TranspServ: accept() - timeout waiting for connection"); + } + + // handshake here + handshake(s, handshakeTimeout); + + return new CreateVM002_Connection(s); + } + + public String toString() { + return name(); + } +} // end of CreateVM002_TranspServ class + +class CreateVM002_Connection extends Connection { + private Socket socket; + private boolean closed = false; + private OutputStream socketOutput; + private InputStream socketInput; + private Object receiveLock = new Object(); + private Object sendLock = new Object(); + private Object closeLock = new Object(); + private boolean toPrintPacket = false; + private int readPacketRequestNumber = 0; + private int writePacketRequestNumber = 0; + public boolean wasIOException = false; + + CreateVM002_Connection(Socket socket) throws IOException { + this.socket = socket; + socket.setTcpNoDelay(true); + socketInput = socket.getInputStream(); + socketOutput = socket.getOutputStream(); + } + + public void close() throws IOException { + synchronized (closeLock) { + if (closed) { + return; + } + socketOutput.close(); + socketInput.close(); + socket.close(); + closed = true; + } + } + + public boolean isOpen() { + synchronized (closeLock) { + return !closed; + } + } + + public byte[] readPacket() throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM002_Connection: readPacket() - connection is closed: N1"); + } + synchronized (receiveLock) { + int b1,b2,b3,b4; + + // length + try { + b1 = socketInput.read(); + b2 = socketInput.read(); + b3 = socketInput.read(); + b4 = socketInput.read(); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM002_Connection: readPacket() - connection is closed: N2"); + } else { + throw ioe; + } + } + + if (b1<0 || b2<0 || b3<0 || b4<0) + throw new EOFException(); + + int len = ((b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0)); + + if (len < 0) { + throw new IOException + ("##> CreateVM002_Connection: readPacket() - protocol error: invalid Packet's length"); + } + + byte b[] = new byte[len]; + b[0] = (byte)b1; + b[1] = (byte)b2; + b[2] = (byte)b3; + b[3] = (byte)b4; + + int off = 4; + len -= off; + + while (len > 0) { + int count; + try { + count = socketInput.read(b, off, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM002_Connection: readPacket() - connection is closed: N3"); + } else { + throw ioe; + } + } + if (count < 0) { + throw new EOFException + ("##> CreateVM002_Connection: readPacket() - read() method returns negative value"); + } + len -= count; + off += count; + } + + readPacketRequestNumber++; + if ( readPacketRequestNumber == -1 ) { + throw new IOException + ("Dummy IOException in CreateVM002_Connection.readPacket(); readPacketRequestNumber = " + + readPacketRequestNumber); + } + printPacket("readPacket:", b); + return b; + } + } + + public void writePacket(byte b[]) throws IOException { + writePacketRequestNumber++; + if ( writePacketRequestNumber == 2 ) { + wasIOException = true; + throw new IOException + ("Dummy IOException in CreateVM002_Connection.writePacket(); writePacketRequestNumber = " + + writePacketRequestNumber); + } + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM002_Connection: writePacket() - connection is closed: N1"); + } + + printPacket("writePacket:", b); + + /* + * Check the packet size + */ + if (b.length < 11) { + throw new IllegalArgumentException + ("##> CreateVM002_Connection: writePacket() - packet is insufficient size: N1"); + } + int b0 = b[0] & 0xff; + int b1 = b[1] & 0xff; + int b2 = b[2] & 0xff; + int b3 = b[3] & 0xff; + int len = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0)); + if (len < 11) { + throw new IllegalArgumentException + ("##> CreateVM002_Connection: writePacket() - packet is insufficient size: N2"); + } + + /* + * Check that the byte array contains the complete packet + */ + if (len > b.length) { + throw new IllegalArgumentException + ("##> CreateVM002_Connection: writePacket() - length mis-match"); + } + + synchronized (sendLock) { + try { + /* + * Send the packet (ignoring any bytes that follow + * the packet in the byte array). + */ + socketOutput.write(b, 0, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM002_Connection: writePacket() - connection is closed: N2"); + } else { + throw ioe; + } + } + } + } + + public void toPrintPacket(boolean toPrint) { + + if ( toPrintPacket ) { + if ( ! toPrint ) { + toPrintPacket = false; + System.out.println("\n>>>> CreateVM002_Connection: toPrintPacket - Off! " + + currentDateWithMlsecs()); + } + } else { + if ( toPrint ) { + toPrintPacket = true; + System.out.println("\n>>>> CreateVM002_Connection: toPrintPacket - On! " + + currentDateWithMlsecs()); + } + } + + } + + String currentDateWithMlsecs() { + GregorianCalendar calendar = new GregorianCalendar(); + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + 1; + String strMonth = month > 9 ? "" + month : "0" + month; + int day = calendar.get(Calendar.DAY_OF_MONTH); + String strDay = day > 9 ? "" + day : "0" + day; + int hours = calendar.get(Calendar.HOUR_OF_DAY); + String strHours = hours > 9 ? "" + hours : "0" + hours; + int minutes = calendar.get(Calendar.MINUTE); + String strMinutes = minutes > 9 ? "" + minutes : "0" + minutes; + int seconds = calendar.get(Calendar.SECOND); + String strSeconds = seconds > 9 ? "" + seconds : "0" + seconds; + int mlsecs = (int)(calendar.getTimeInMillis() % 1000); + String strMlsecs = mlsecs < 10 ? "00" + mlsecs : (mlsecs < 100 ? "0" + mlsecs : "" + mlsecs); + return "" + year + "." + strMonth + "." + strDay + "; " + strHours + + ":" + strMinutes + ":" + strSeconds + "::" + strMlsecs; + } + + public void printPacket(String headMessage, byte b[]) { + + if ( ! toPrintPacket ) { + return; + } + + System.out.println("\n>>>> CreateVM005_Connection: printPacket: " + currentDateWithMlsecs()); + System.out.println(" >> " + headMessage); + int packetLength = b.length; + + String handsHake = "JDWP-Handshake"; + + System.out.println(" >> packet length = " + packetLength); + if ( packetLength < 11 ) { + System.out.println(" >> Invalid packet length!"); + System.out.println("\n>>>> CreateVM005_Connection: printPacket - END\n"); + return; + } + + String packetString = new String(b); + if ( handsHake.equals(packetString) ) { + System.out.println(" >> Packet as String = " + packetString); + System.out.println("\n>>>> CreateVM005_Connection: printPacket - END\n"); + return; + } + + int b0 = b[0] & 0xff; + int b1 = b[1] & 0xff; + int b2 = b[2] & 0xff; + int b3 = b[3] & 0xff; + int lengthField = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0)); + System.out.println(" >> lengthField = " + lengthField); + + int b4 = b[4] & 0xff; + int b5 = b[5] & 0xff; + int b6 = b[6] & 0xff; + int b7 = b[7] & 0xff; + int idField = ((b4 << 24) | (b5 << 16) | (b6 << 8) | (b7 << 0)); + System.out.println(" >> idField(integer) = " + idField); + + int flagsField = b[8] & 0xff; + System.out.println(" >> flagsField(integer) = " + flagsField); + int replyPacket = b[8] & 0x80; + if ( replyPacket != 0 ) { + System.out.println(" >> Replay Packet:"); + int b9 = b[9] & 0xff; + int b10 = b[10] & 0xff; + int errorCodeField = ((b9 << 8) | (b10 << 0)); + System.out.println(" >> errorCodeField(integer) = " + errorCodeField); + } else { + System.out.println(" >> Command Packet:"); + int commandSetField = b[9] & 0xff; + System.out.println(" >> commandSetField(integer) = " + commandSetField); + int commandField = b[10] & 0xff; + System.out.println(" >> commandField(integer) = " + commandField); + } + + if ( packetLength > 11 ) { + int dataLength = packetLength-11; + String data = ""; + for (int i=0; i < dataLength; i++) { + data = data + "," + (int)(b[11+i] & 0xff); + } + System.out.println(" >> Packet's data = " + data); + } + System.out.println(">>>> CreateVM005_Connection: printPacket - END"); + } + +} // end of CreateVM002_Connection class + +/* + * The capabilities of the socket transport service + */ +class CreateVM002_TranspServCapabilities extends TransportService.Capabilities { + + public boolean supportsMultipleConnections() { + return true; + } + + public boolean supportsAttachTimeout() { + return true; + } + + public boolean supportsAcceptTimeout() { + return true; + } + + public boolean supportsHandshakeTimeout() { + return true; + } + +} // end of CreateVM002_TranspServCapabilities class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM003_TargetVM.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM003_TargetVM.java new file mode 100644 index 00000000000..bad8453daba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM003_TargetVM.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + + +/** + * This is the target Java VM for the
    + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test.
    + *
    + */ + +public class CreateVM003_TargetVM { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + + public static void main (String argv[]) { + System.exit(STATUS_PASSED + STATUS_TEMP); + } + + +} // end of CreateVM003_TargetVM class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM003_TranspServ.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM003_TranspServ.java new file mode 100644 index 00000000000..771c48963af --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM003_TranspServ.java @@ -0,0 +1,488 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.net.*; +import java.io.*; +import java.util.*; + +/* + * A transport service implementation based on a TCP connection used by + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test. + * It is borrowed from the com.sun.tools.jdi.SocketTransportService + */ + +public class CreateVM003_TranspServ extends TransportService { + + /** + * The listener returned by startListening encapsulates + * the ServerSocket. + */ + static class SocketListenKey extends ListenKey { + ServerSocket ss; + + SocketListenKey(ServerSocket ss) { + this.ss = ss; + } + + ServerSocket socket() { + return ss; + } + + public String address() { + InetAddress localaddr = ss.getInetAddress(); + int port = ss.getLocalPort(); + if (localaddr.isAnyLocalAddress()) { + return "" + port; + } else { + return localaddr + ":" + port; + } + } + + public String toString() { + return address(); + } + } + + /** + * Handshake with the debuggee + */ + void handshake(Socket s, long timeout) throws IOException { + s.setSoTimeout((int)timeout); + + byte[] hello = "JDWP-Handshake".getBytes("UTF-8"); + s.getOutputStream().write(hello); + + byte[] b = new byte[hello.length]; + int received = 0; + while (received < hello.length) { + int n; + try { + n = s.getInputStream().read(b, received, hello.length-received); + } catch (SocketTimeoutException x) { + throw new IOException("##> CreateVM003_TranspServ: Handshake timeout"); + } + if (n < 0) { + s.close(); + throw new IOException + ("##> CreateVM003_TranspServ: Handshake FAILED - connection prematurally closed!"); + } + received += n; + } + for (int i=0; i CreateVM003_TranspServ: Handshake FAILED - unrecognized message from target VM"); + } + } + + // disable read timeout + s.setSoTimeout(0); + } + + /** + * No-arg constructor + */ + public CreateVM003_TranspServ() { + } + + /** + * The name of this transport service + */ + public String name() { + return "CreateVM003_TranspServ"; + } + + /** + * The description of this transport service + */ + public String description() { + return "SocketTransportService for nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test."; + } + + /** + * Return the capabilities of this transport service + */ + public Capabilities capabilities() { + return new CreateVM003_TranspServCapabilities(); + } + + + /** + * Attach to the specified address with optional attach and handshake + * timeout. + */ + public Connection attach(String address, long attachTimeout, long handshakeTimeout) + throws IOException { + + if (address == null) { + throw new NullPointerException("##> CreateVM003_TranspServ: attach() - address is null"); + } + if (attachTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException("##> CreateVM003_TranspServ: attach() - timeout is negative"); + } + + int splitIndex = address.indexOf(':'); + String host; + String portStr; + if (splitIndex < 0) { + host = InetAddress.getLocalHost().getHostName(); + portStr = address; + } else { + host = address.substring(0, splitIndex); + portStr = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(portStr).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM003_TranspServ: attach() - unable to parse port number in address"); + } + + + // open TCP connection to VM + + InetSocketAddress sa = new InetSocketAddress(host, port); + Socket s = new Socket(); + try { + s.connect(sa, (int)attachTimeout); + } catch (SocketTimeoutException exc) { + try { + s.close(); + } catch (IOException x) { } + throw new TransportTimeoutException + ("##> CreateVM003_TranspServ: attach() - timed out trying to establish connection"); + } + + // handshake with the target VM + try { + handshake(s, handshakeTimeout); + } catch (IOException exc) { + try { + s.close(); + } catch (IOException x) { } + throw exc; + } + + return new CreateVM003_Connection(s); + } + + /* + * Listen on the specified address and port. Return a listener + * that encapsulates the ServerSocket. + */ + ListenKey startListening(String localaddress, int port) throws IOException { + InetSocketAddress sa; + if (localaddress == null) { + sa = new InetSocketAddress(port); + } else { + sa = new InetSocketAddress(localaddress, port); + } + ServerSocket ss = new ServerSocket(); + // if port is 0 do not set the SO_REUSEADDR flag + if (port == 0) { + ss.setReuseAddress(false); + } + ss.bind(sa); + return new SocketListenKey(ss); + } + + /** + * Listen on the specified address + */ + public ListenKey startListening(String address) throws IOException { + // use ephemeral port if address isn't specified. + if (address == null || address.length() == 0) { + address = "0"; + } + + int splitIndex = address.indexOf(':'); + String localaddr = null; + if (splitIndex >= 0) { + localaddr = address.substring(0, splitIndex); + address = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(address).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM003_TranspServ: startListening() - unable to parse port number in address"); + } + + return startListening(localaddr, port); + } + + /** + * Listen on the default address + */ + public ListenKey startListening() throws IOException { + return startListening(null, 0); + } + + /** + * Stop the listener + */ + public void stopListening(ListenKey listener) throws IOException { + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM003_TranspServ: stopListening() - Invalid listener"); + } + + synchronized (listener) { + ServerSocket ss = ((SocketListenKey)listener).socket(); + + // if the ServerSocket has been closed it means + // the listener is invalid + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM003_TranspServ: stopListening() - Invalid listener"); + } + ss.close(); + } + } + + /** + * Accept a connection from a debuggee and handshake with it. + */ + public Connection accept(ListenKey listener, long acceptTimeout, long handshakeTimeout) throws IOException { + if (acceptTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException + ("##> CreateVM003_TranspServ: accept() - timeout is negative"); + } + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM003_TranspServ: accept() - Invalid listener"); + } + ServerSocket ss; + + // obtain the ServerSocket from the listener - if the + // socket is closed it means the listener is invalid + synchronized (listener) { + ss = ((SocketListenKey)listener).socket(); + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM003_TranspServ: accept() - Invalid listener"); + } + } + + ss.setSoTimeout((int)acceptTimeout); + Socket s; + try { + s = ss.accept(); + } catch (SocketTimeoutException x) { + throw new TransportTimeoutException + ("##> CreateVM003_TranspServ: accept() - timeout waiting for connection"); + } + + // handshake here + handshake(s, handshakeTimeout); + + return new CreateVM003_Connection(s); + } + + public String toString() { + return name(); + } +} // end of CreateVM003_TranspServ class + +class CreateVM003_Connection extends Connection { + private Socket socket; + private boolean closed = false; + private OutputStream socketOutput; + private InputStream socketInput; + private Object receiveLock = new Object(); + private Object sendLock = new Object(); + private Object closeLock = new Object(); + + CreateVM003_Connection(Socket socket) throws IOException { + this.socket = socket; + socket.setTcpNoDelay(true); + socketInput = socket.getInputStream(); + socketOutput = socket.getOutputStream(); + } + + public void close() throws IOException { + synchronized (closeLock) { + if (closed) { + return; + } + socketOutput.close(); + socketInput.close(); + socket.close(); + closed = true; + } + } + + public boolean isOpen() { + synchronized (closeLock) { + return !closed; + } + } + + public byte[] readPacket() throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM003_Connection: readPacket() - connection is closed"); + } + synchronized (receiveLock) { + int b1,b2,b3,b4; + + // length + try { + b1 = socketInput.read(); + b2 = socketInput.read(); + b3 = socketInput.read(); + b4 = socketInput.read(); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM003_Connection: readPacket() - connection is closed"); + } else { + throw ioe; + } + } + + if (b1<0 || b2<0 || b3<0 || b4<0) + throw new EOFException(); + + int len = ((b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0)); + + if (len < 0) { + throw new IOException + ("##> CreateVM003_Connection: readPacket() - protocol error: invalid Packet's length"); + } + + byte b[] = new byte[len]; + b[0] = (byte)b1; + b[1] = (byte)b2; + b[2] = (byte)b3; + b[3] = (byte)b4; + + int off = 4; + len -= off; + + while (len > 0) { + int count; + try { + count = socketInput.read(b, off, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM003_Connection: readPacket() - connection is closed"); + } else { + throw ioe; + } + } + if (count < 0) { + throw new EOFException + ("##> CreateVM003_Connection: readPacket() - read() method returns negative value"); + } + len -= count; + off += count; + } + + return b; + } + } + + public void writePacket(byte b[]) throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM003_Connection: writePacket() - connection is closed"); + } + + /* + * Check the packet size + */ + if (b.length < 11) { + throw new IllegalArgumentException + ("##> CreateVM003_Connection: writePacket() - packet is insufficient size"); + } + int b0 = b[0] & 0xff; + int b1 = b[1] & 0xff; + int b2 = b[2] & 0xff; + int b3 = b[3] & 0xff; + int len = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0)); + if (len < 11) { + throw new IllegalArgumentException + ("##> CreateVM003_Connection: writePacket() - packet is insufficient size"); + } + + /* + * Check that the byte array contains the complete packet + */ + if (len > b.length) { + throw new IllegalArgumentException + ("##> CreateVM003_Connection: writePacket() - length mis-match"); + } + + synchronized (sendLock) { + try { + /* + * Send the packet (ignoring any bytes that follow + * the packet in the byte array). + */ + socketOutput.write(b, 0, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM003_Connection: writePacket() - connection is closed"); + } else { + throw ioe; + } + } + } + } + +} // end of CreateVM003_Connection class + +/* + * The capabilities of the socket transport service + */ +class CreateVM003_TranspServCapabilities extends TransportService.Capabilities { + + public boolean supportsMultipleConnections() { + return true; + } + + public boolean supportsAttachTimeout() { + return true; + } + + public boolean supportsAcceptTimeout() { + return true; + } + + public boolean supportsHandshakeTimeout() { + return true; + } + +} // end of CreateVM003_TranspServCapabilities class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM004_TargetVM.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM004_TargetVM.java new file mode 100644 index 00000000000..34f056de81d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM004_TargetVM.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + + +/** + * This is the target Java VM for the
    + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test.
    + *
    + */ + +public class CreateVM004_TargetVM { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + + public static void main (String argv[]) { + System.exit(STATUS_PASSED + STATUS_TEMP); + } + + +} // end of CreateVM004_TargetVM class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM004_TranspServ.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM004_TranspServ.java new file mode 100644 index 00000000000..bbed62c3bfd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM004_TranspServ.java @@ -0,0 +1,489 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.net.*; +import java.io.*; +import java.util.*; + +/* + * A transport service implementation based on a TCP connection used by + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test. + * It is borrowed from the com.sun.tools.jdi.SocketTransportService + */ + +public class CreateVM004_TranspServ extends TransportService { + + /** + * The listener returned by startListening encapsulates + * the ServerSocket. + */ + static class SocketListenKey extends ListenKey { + ServerSocket ss; + + SocketListenKey(ServerSocket ss) { + this.ss = ss; + } + + ServerSocket socket() { + return ss; + } + + public String address() { + InetAddress localaddr = ss.getInetAddress(); + int port = ss.getLocalPort(); + if (localaddr.isAnyLocalAddress()) { + return "" + port; + } else { + return localaddr + ":" + port; + } + } + + public String toString() { + return address(); + } + } + + /** + * Handshake with the debuggee + */ + void handshake(Socket s, long timeout) throws IOException { + s.setSoTimeout((int)timeout); + + byte[] hello = "JDWP-Handshake".getBytes("UTF-8"); + s.getOutputStream().write(hello); + + byte[] b = new byte[hello.length]; + int received = 0; + while (received < hello.length) { + int n; + try { + n = s.getInputStream().read(b, received, hello.length-received); + } catch (SocketTimeoutException x) { + throw new IOException("##> CreateVM004_TranspServ: Handshake timeout"); + } + if (n < 0) { + s.close(); + throw new IOException + ("##> CreateVM004_TranspServ: Handshake FAILED - connection prematurally closed!"); + } + received += n; + } + for (int i=0; i CreateVM004_TranspServ: Handshake FAILED - unrecognized message from target VM"); + } + } + + // disable read timeout + s.setSoTimeout(0); + } + + /** + * No-arg constructor + */ + public CreateVM004_TranspServ() { + } + + /** + * The name of this transport service + */ + public String name() { + return "CreateVM004_TranspServ"; + } + + /** + * The description of this transport service + */ + public String description() { + return "SocketTransportService for nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test."; + } + + /** + * Return the capabilities of this transport service + */ + public Capabilities capabilities() { + return new CreateVM004_TranspServCapabilities(); + } + + + /** + * Attach to the specified address with optional attach and handshake + * timeout. + */ + public Connection attach(String address, long attachTimeout, long handshakeTimeout) + throws IOException { + + if (address == null) { + throw new NullPointerException("##> CreateVM004_TranspServ: attach() - address is null"); + } + if (attachTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException("##> CreateVM004_TranspServ: attach() - timeout is negative"); + } + + int splitIndex = address.indexOf(':'); + String host; + String portStr; + if (splitIndex < 0) { + host = InetAddress.getLocalHost().getHostName(); + portStr = address; + } else { + host = address.substring(0, splitIndex); + portStr = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(portStr).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM004_TranspServ: attach() - unable to parse port number in address"); + } + + + // open TCP connection to VM + + InetSocketAddress sa = new InetSocketAddress(host, port); + Socket s = new Socket(); + try { + s.connect(sa, (int)attachTimeout); + } catch (SocketTimeoutException exc) { + try { + s.close(); + } catch (IOException x) { } + throw new TransportTimeoutException + ("##> CreateVM004_TranspServ: attach() - timed out trying to establish connection"); + } + + // handshake with the target VM + try { + handshake(s, handshakeTimeout); + } catch (IOException exc) { + try { + s.close(); + } catch (IOException x) { } + throw exc; + } + + return new CreateVM004_Connection(s); + } + + /* + * Listen on the specified address and port. Return a listener + * that encapsulates the ServerSocket. + */ + ListenKey startListening(String localaddress, int port) throws IOException { + InetSocketAddress sa; + if (localaddress == null) { + sa = new InetSocketAddress(port); + } else { + sa = new InetSocketAddress(localaddress, port); + } + ServerSocket ss = new ServerSocket(); + // if port is 0 do not set the SO_REUSEADDR flag + if (port == 0) { + ss.setReuseAddress(false); + } + ss.bind(sa); + return new SocketListenKey(ss); + } + + /** + * Listen on the specified address + */ + public ListenKey startListening(String address) throws IOException { + // use ephemeral port if address isn't specified. + if (address == null || address.length() == 0) { + address = "0"; + } + + int splitIndex = address.indexOf(':'); + String localaddr = null; + if (splitIndex >= 0) { + localaddr = address.substring(0, splitIndex); + address = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(address).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM004_TranspServ: startListening() - unable to parse port number in address"); + } + + return startListening(localaddr, port); + } + + /** + * Listen on the default address + */ + public ListenKey startListening() throws IOException { + return startListening(null, 0); + } + + /** + * Stop the listener + */ + public void stopListening(ListenKey listener) throws IOException { + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM004_TranspServ: stopListening() - Invalid listener"); + } + + synchronized (listener) { + ServerSocket ss = ((SocketListenKey)listener).socket(); + + // if the ServerSocket has been closed it means + // the listener is invalid + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM004_TranspServ: stopListening() - Invalid listener"); + } + ss.close(); + } + } + + /** + * Accept a connection from a debuggee and handshake with it. + */ + public Connection accept(ListenKey listener, long acceptTimeout, long handshakeTimeout) throws IOException { + if (acceptTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException + ("##> CreateVM004_TranspServ: accept() - timeout is negative"); + } + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM004_TranspServ: accept() - Invalid listener"); + } + ServerSocket ss; + + // obtain the ServerSocket from the listener - if the + // socket is closed it means the listener is invalid + synchronized (listener) { + ss = ((SocketListenKey)listener).socket(); + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM004_TranspServ: accept() - Invalid listener"); + } + } + + ss.setSoTimeout((int)acceptTimeout); + Socket s; + try { + s = ss.accept(); + } catch (SocketTimeoutException x) { + throw new TransportTimeoutException + ("##> CreateVM004_TranspServ: accept() - timeout waiting for connection"); + } + + // handshake here + handshake(s, handshakeTimeout); + + return new CreateVM004_Connection(s); + } + + public String toString() { + return name(); + } +} // end of CreateVM004_TranspServ class + +class CreateVM004_Connection extends Connection { + private Socket socket; + private boolean closed = false; + private OutputStream socketOutput; + private InputStream socketInput; + private Object receiveLock = new Object(); + private Object sendLock = new Object(); + private Object closeLock = new Object(); + + CreateVM004_Connection(Socket socket) throws IOException { + this.socket = socket; + socket.setTcpNoDelay(true); + socketInput = socket.getInputStream(); + socketOutput = socket.getOutputStream(); + } + + public void close() throws IOException { + synchronized (closeLock) { + if (closed) { + return; + } + socketOutput.close(); + socketInput.close(); + socket.close(); + closed = true; + } + } + + public boolean isOpen() { + synchronized (closeLock) { + return !closed; + } + } + + public byte[] readPacket() throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM004_Connection: readPacket() - connection is closed"); + } + synchronized (receiveLock) { + int b1,b2,b3,b4; + + // length + try { + b1 = socketInput.read(); + b2 = socketInput.read(); + b3 = socketInput.read(); + b4 = socketInput.read(); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM004_Connection: readPacket() - connection is closed"); + } else { + throw ioe; + } + } + + if (b1<0 || b2<0 || b3<0 || b4<0) + throw new EOFException(); + + int len = ((b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0)); + + if (len < 0) { + throw new IOException + ("##> CreateVM004_Connection: readPacket() - protocol error: invalid Packet's length"); + } + + byte b[] = new byte[len]; + b[0] = (byte)b1; + b[1] = (byte)b2; + b[2] = (byte)b3; + b[3] = (byte)b4; + + int off = 4; + len -= off; + + while (len > 0) { + int count; + try { + count = socketInput.read(b, off, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM004_Connection: readPacket() - connection is closed"); + } else { + throw ioe; + } + } + if (count < 0) { + throw new EOFException + ("##> CreateVM004_Connection: readPacket() - read() method returns negative value"); + } + len -= count; + off += count; + } + + return b; + } + } + + public void writePacket(byte b[]) throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM004_Connection: writePacket() - connection is closed"); + } + + /* + * Check the packet size + */ + if (b.length < 11) { + throw new IllegalArgumentException + ("##> CreateVM004_Connection: writePacket() - packet is insufficient size"); + } + int b0 = b[0] & 0xff; + int b1 = b[1] & 0xff; + int b2 = b[2] & 0xff; + int b3 = b[3] & 0xff; + int len = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0)); + if (len < 11) { + throw new IllegalArgumentException + ("##> CreateVM004_Connection: writePacket() - packet is insufficient size"); + } + + /* + * Check that the byte array contains the complete packet + */ + if (len > b.length) { + throw new IllegalArgumentException + ("##> CreateVM004_Connection: writePacket() - length mis-match"); + } + + synchronized (sendLock) { + try { + /* + * Send the packet (ignoring any bytes that follow + * the packet in the byte array). + */ + socketOutput.write(b, 0, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM004_Connection: writePacket() - connection is closed"); + } else { + throw ioe; + } + } + } + } + +} // end of CreateVM004_Connection class + + +/* + * The capabilities of the socket transport service + */ +class CreateVM004_TranspServCapabilities extends TransportService.Capabilities { + + public boolean supportsMultipleConnections() { + return true; + } + + public boolean supportsAttachTimeout() { + return true; + } + + public boolean supportsAcceptTimeout() { + return true; + } + + public boolean supportsHandshakeTimeout() { + return true; + } + +} // end of CreateVM004_TranspServCapabilities class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM005_TargetVM.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM005_TargetVM.java new file mode 100644 index 00000000000..c69cd901c1d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM005_TargetVM.java @@ -0,0 +1,45 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + + +/** + * This is the target Java VM for the
    + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test.
    + *
    + */ + +public class CreateVM005_TargetVM { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + + public static void main (String argv[]) { + System.exit(STATUS_PASSED + STATUS_TEMP); + } + + +} // end of CreateVM005_TargetVM class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM005_TranspServ.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM005_TranspServ.java new file mode 100644 index 00000000000..7a45c16e6b9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/CreateVM005_TranspServ.java @@ -0,0 +1,488 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.net.*; +import java.io.*; +import java.util.*; + +/* + * A transport service implementation based on a TCP connection used by + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test. + * It is borrowed from the com.sun.tools.jdi.SocketTransportService + */ + +public class CreateVM005_TranspServ extends TransportService { + + /** + * The listener returned by startListening encapsulates + * the ServerSocket. + */ + static class SocketListenKey extends ListenKey { + ServerSocket ss; + + SocketListenKey(ServerSocket ss) { + this.ss = ss; + } + + ServerSocket socket() { + return ss; + } + + public String address() { + InetAddress localaddr = ss.getInetAddress(); + int port = ss.getLocalPort(); + if (localaddr.isAnyLocalAddress()) { + return "" + port; + } else { + return localaddr + ":" + port; + } + } + + public String toString() { + return address(); + } + } + + /** + * Handshake with the debuggee + */ + void handshake(Socket s, long timeout) throws IOException { + s.setSoTimeout((int)timeout); + + byte[] hello = "JDWP-Handshake".getBytes("UTF-8"); + s.getOutputStream().write(hello); + + byte[] b = new byte[hello.length]; + int received = 0; + while (received < hello.length) { + int n; + try { + n = s.getInputStream().read(b, received, hello.length-received); + } catch (SocketTimeoutException x) { + throw new IOException("##> CreateVM005_TranspServ: Handshake timeout"); + } + if (n < 0) { + s.close(); + throw new IOException + ("##> CreateVM005_TranspServ: Handshake FAILED - connection prematurally closed!"); + } + received += n; + } + for (int i=0; i CreateVM005_TranspServ: Handshake FAILED - unrecognized message from target VM"); + } + } + + // disable read timeout + s.setSoTimeout(0); + } + + /** + * No-arg constructor + */ + public CreateVM005_TranspServ() { + } + + /** + * The name of this transport service + */ + public String name() { + return "CreateVM005_TranspServ"; + } + + /** + * The description of this transport service + */ + public String description() { + return "SocketTransportService for nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test."; + } + + /** + * Return the capabilities of this transport service + */ + public Capabilities capabilities() { + return new CreateVM005_TranspServCapabilities(); + } + + + /** + * Attach to the specified address with optional attach and handshake + * timeout. + */ + public Connection attach(String address, long attachTimeout, long handshakeTimeout) + throws IOException { + + if (address == null) { + throw new NullPointerException("##> CreateVM005_TranspServ: attach() - address is null"); + } + if (attachTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException("##> CreateVM005_TranspServ: attach() - timeout is negative"); + } + + int splitIndex = address.indexOf(':'); + String host; + String portStr; + if (splitIndex < 0) { + host = InetAddress.getLocalHost().getHostName(); + portStr = address; + } else { + host = address.substring(0, splitIndex); + portStr = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(portStr).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM005_TranspServ: attach() - unable to parse port number in address"); + } + + + // open TCP connection to VM + + InetSocketAddress sa = new InetSocketAddress(host, port); + Socket s = new Socket(); + try { + s.connect(sa, (int)attachTimeout); + } catch (SocketTimeoutException exc) { + try { + s.close(); + } catch (IOException x) { } + throw new TransportTimeoutException + ("##> CreateVM005_TranspServ: attach() - timed out trying to establish connection"); + } + + // handshake with the target VM + try { + handshake(s, handshakeTimeout); + } catch (IOException exc) { + try { + s.close(); + } catch (IOException x) { } + throw exc; + } + + return new CreateVM005_Connection(s); + } + + /* + * Listen on the specified address and port. Return a listener + * that encapsulates the ServerSocket. + */ + ListenKey startListening(String localaddress, int port) throws IOException { + InetSocketAddress sa; + if (localaddress == null) { + sa = new InetSocketAddress(port); + } else { + sa = new InetSocketAddress(localaddress, port); + } + ServerSocket ss = new ServerSocket(); + // if port is 0 do not set the SO_REUSEADDR flag + if (port == 0) { + ss.setReuseAddress(false); + } + ss.bind(sa); + return new SocketListenKey(ss); + } + + /** + * Listen on the specified address + */ + public ListenKey startListening(String address) throws IOException { + // use ephemeral port if address isn't specified. + if (address == null || address.length() == 0) { + address = "0"; + } + + int splitIndex = address.indexOf(':'); + String localaddr = null; + if (splitIndex >= 0) { + localaddr = address.substring(0, splitIndex); + address = address.substring(splitIndex+1); + } + + int port; + try { + port = Integer.decode(address).intValue(); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "##> CreateVM005_TranspServ: startListening() - unable to parse port number in address"); + } + + return startListening(localaddr, port); + } + + /** + * Listen on the default address + */ + public ListenKey startListening() throws IOException { + return startListening(null, 0); + } + + /** + * Stop the listener + */ + public void stopListening(ListenKey listener) throws IOException { + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM005_TranspServ: stopListening() - Invalid listener"); + } + + synchronized (listener) { + ServerSocket ss = ((SocketListenKey)listener).socket(); + + // if the ServerSocket has been closed it means + // the listener is invalid + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM005_TranspServ: stopListening() - Invalid listener"); + } + ss.close(); + } + } + + /** + * Accept a connection from a debuggee and handshake with it. + */ + public Connection accept(ListenKey listener, long acceptTimeout, long handshakeTimeout) throws IOException { + if (acceptTimeout < 0 || handshakeTimeout < 0) { + throw new IllegalArgumentException + ("##> CreateVM005_TranspServ: accept() - timeout is negative"); + } + if (!(listener instanceof SocketListenKey)) { + throw new IllegalArgumentException + ("##> CreateVM005_TranspServ: accept() - Invalid listener"); + } + ServerSocket ss; + + // obtain the ServerSocket from the listener - if the + // socket is closed it means the listener is invalid + synchronized (listener) { + ss = ((SocketListenKey)listener).socket(); + if (ss.isClosed()) { + throw new IllegalArgumentException + ("##> CreateVM005_TranspServ: accept() - Invalid listener"); + } + } + + ss.setSoTimeout((int)acceptTimeout); + Socket s; + try { + s = ss.accept(); + } catch (SocketTimeoutException x) { + throw new TransportTimeoutException + ("##> CreateVM005_TranspServ: accept() - timeout waiting for connection"); + } + + // handshake here + handshake(s, handshakeTimeout); + + return new CreateVM005_Connection(s); + } + + public String toString() { + return name(); + } +} // end of CreateVM005_TranspServ class + +class CreateVM005_Connection extends Connection { + private Socket socket; + private boolean closed = false; + private OutputStream socketOutput; + private InputStream socketInput; + private Object receiveLock = new Object(); + private Object sendLock = new Object(); + private Object closeLock = new Object(); + + CreateVM005_Connection(Socket socket) throws IOException { + this.socket = socket; + socket.setTcpNoDelay(true); + socketInput = socket.getInputStream(); + socketOutput = socket.getOutputStream(); + } + + public void close() throws IOException { + synchronized (closeLock) { + if (closed) { + return; + } + socketOutput.close(); + socketInput.close(); + socket.close(); + closed = true; + } + } + + public boolean isOpen() { + synchronized (closeLock) { + return !closed; + } + } + + public byte[] readPacket() throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM005_Connection: readPacket() - connection is closed"); + } + synchronized (receiveLock) { + int b1,b2,b3,b4; + + // length + try { + b1 = socketInput.read(); + b2 = socketInput.read(); + b3 = socketInput.read(); + b4 = socketInput.read(); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM005_Connection: readPacket() - connection is closed"); + } else { + throw ioe; + } + } + + if (b1<0 || b2<0 || b3<0 || b4<0) + throw new EOFException(); + + int len = ((b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0)); + + if (len < 0) { + throw new IOException + ("##> CreateVM005_Connection: readPacket() - protocol error: invalid Packet's length"); + } + + byte b[] = new byte[len]; + b[0] = (byte)b1; + b[1] = (byte)b2; + b[2] = (byte)b3; + b[3] = (byte)b4; + + int off = 4; + len -= off; + + while (len > 0) { + int count; + try { + count = socketInput.read(b, off, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM005_Connection: readPacket() - connection is closed"); + } else { + throw ioe; + } + } + if (count < 0) { + throw new EOFException + ("##> CreateVM005_Connection: readPacket() - read() method returns negative value"); + } + len -= count; + off += count; + } + + return b; + } + } + + public void writePacket(byte b[]) throws IOException { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM005_Connection: writePacket() - connection is closed"); + } + + /* + * Check the packet size + */ + if (b.length < 11) { + throw new IllegalArgumentException + ("##> CreateVM005_Connection: writePacket() - packet is insufficient size"); + } + int b0 = b[0] & 0xff; + int b1 = b[1] & 0xff; + int b2 = b[2] & 0xff; + int b3 = b[3] & 0xff; + int len = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0)); + if (len < 11) { + throw new IllegalArgumentException + ("##> CreateVM005_Connection: writePacket() - packet is insufficient size"); + } + + /* + * Check that the byte array contains the complete packet + */ + if (len > b.length) { + throw new IllegalArgumentException + ("##> CreateVM005_Connection: writePacket() - length mis-match"); + } + + synchronized (sendLock) { + try { + /* + * Send the packet (ignoring any bytes that follow + * the packet in the byte array). + */ + socketOutput.write(b, 0, len); + } catch (IOException ioe) { + if (!isOpen()) { + throw new ClosedConnectionException + ("##> CreateVM005_Connection: writePacket() - connection is closed"); + } else { + throw ioe; + } + } + } + } + +} // end of CreateVM005_Connection class + +/* + * The capabilities of the socket transport service + */ +class CreateVM005_TranspServCapabilities extends TransportService.Capabilities { + + public boolean supportsMultipleConnections() { + return true; + } + + public boolean supportsAttachTimeout() { + return true; + } + + public boolean supportsAcceptTimeout() { + return true; + } + + public boolean supportsHandshakeTimeout() { + return true; + } + +} // end of CreateVM005_TranspServCapabilities class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001.java new file mode 100644 index 00000000000..4a30f01fe58 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001.java @@ -0,0 +1,197 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the
    + * virtualMachineManager.createVirtualMachine(...) methods.
    + *
    + * The test checks up that both createVirtualMachine(Connection) and
    + * createVirtualMachine(Connection, Process) methods throw
    + * IllegalStateException if the used Connection is not open.
    + *
    + */ + +public class createVM001 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "createVM001: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> createVM001: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new createVM001().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + logHandler.enableErrorsSummary(false); + + logAlways("==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001 test..."); + logOnVerbose + ("==> Test checks that virtualMachineManager.createVirtualMachine(...) methods"); + logOnVerbose + ("==> throw IllegalStateException for Connection that is not open."); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + // check method virtualMachineManager.createVirtualMachine(Connection)... + Connection testConnection = new createVM001_Connection(); + try { + VirtualMachine dummyVM = virtualMachineManager.createVirtualMachine(testConnection); + } catch ( IllegalStateException illegStExcep ) { + // OK - expected IllegalStateException because Connection is not open + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "virtualMachineManager.createVirtualMachine(Connection) throws"); + logOnError(errorLogPrefix + "unexpected Exception for Connection that is not open:"); + logOnError(errorLogPrefix + "Expected Exception - IllegalStateException"); + logOnError(errorLogPrefix + "Actual Exception - '" + thrown + "'"); + testResult = STATUS_FAILED; + } + + // check method virtualMachineManager.createVirtualMachine(Connection, Process)... + testConnection = new createVM001_Connection(); + Process dummyProcess = new createVM001_Process(); + try { + VirtualMachine dummyVM = virtualMachineManager.createVirtualMachine(testConnection, dummyProcess); + } catch ( IllegalStateException illegStExcep ) { + // OK - expected IllegalStateException because Connection is not open + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "virtualMachineManager.createVirtualMachine(Connection, Process)"); + logOnError(errorLogPrefix + "throws unexpected Exception for Connection that is not open:"); + logOnError(errorLogPrefix + "Expected Exception - IllegalStateException"); + logOnError(errorLogPrefix + "Actual Exception - '" + thrown + "'"); + testResult = STATUS_FAILED; + } + + return testResult; + } + +} // end of createVM001 class + +class createVM001_Connection extends Connection { + + public void close() throws IOException { + if ( true ) { + throw new IOException("Dummy IOException in createVM001_Connection.close()."); + } + } + + public boolean isOpen() { + return false; + } + + public byte[] readPacket() throws IOException { + if ( true ) { + throw new IOException("Dummy IOException in createVM001_Connection.readPacket()."); + } + + return new byte[11]; + } + + public void writePacket(byte b[]) throws IOException { + if ( true ) { + throw new IOException("Dummy IOException in createVM001_Connection.writePacket(byte b[])."); + } + + } + +} // end of createVM001_Connection class + +class createVM001_Process extends Process { + + public OutputStream getOutputStream() { + return null; + } + + public InputStream getInputStream() { + return null; + } + + public InputStream getErrorStream() { + return null; + } + + public int waitFor() throws InterruptedException { + return 0; + } + + public int exitValue() { + return 0; + } + + public void destroy() { + } + +} // end of createVM001_Process class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001/TestDescription.java new file mode 100644 index 00000000000..8dbbe63ac29 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001/TestDescription.java @@ -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/VirtualMachineManager/createVirtualMachine/createVM001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001 test: + * The test for the + * virtualMachineManager.createVirtualMachine(...) methods. + * The test checks up that both createVirtualMachine(Connection) and + * createVirtualMachine(Connection, Process) methods throw + * IllegalStateException if the used Connection is not open. + * COMMENTS: + * Test fixed according to test RFE: + * 4943437 TEST_RFE: createVM002 does not honor DEBUGEE_VM_* setting + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002.java new file mode 100644 index 00000000000..e49fc7460cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002.java @@ -0,0 +1,260 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the
    + * virtualMachineManager.createVirtualMachine(...) methods.
    + *
    + * The test checks up that the
    + * createVirtualMachine(Connection, Process) method throws
    + * IOException when I/O error occurs in used Connection during
    + * creating of Virtual Mashine.
    + *
    + */ +public class createVM002 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "createVM002: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> createVM002: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + static final String packagePrefix = "nsk.jdi.VirtualMachineManager.createVirtualMachine."; +// static final String packagePrefix = emptyString; + static final String targetVMClassName = packagePrefix + "CreateVM002_TargetVM"; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new createVM002().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_FAILED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + logAlways("==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test..."); + logOnVerbose + ("==> Test checks that virtualMachineManager.createVirtualMachine(Connection, Process) method"); + logOnVerbose + ("==> throw IOException when I/O error occurs in Connection."); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + TransportService testTransportService = new CreateVM002_TranspServ(); + + TransportService.ListenKey testTransportServiceListenKey = null; + logOnVerbose(infoLogPrefixHead + "Start Listening for target VM..."); + try { + testTransportServiceListenKey = testTransportService.startListening(); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.startListening() throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.startListening() throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + String targetJava = argsHandler.getLaunchExecPath() + + " " + argsHandler.getLaunchOptions(); + String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" + + testTransportServiceListenKey.address() + + // Addind "suspend=n' option helps avoid debugee hang. See 6803636. + ",suspend=n" + + " " + targetVMClassName; + + Binder binder = new Binder(argsHandler, logHandler); + Debugee debugee = null; + Process processToRun = null; + Connection testTransportServiceConnection = null; + VirtualMachine testVirtualMachine = null; + + try { + + logOnVerbose(infoLogPrefixHead + "PROCESS is being created:"); + logOnVerbose(infoLogPrefix + "Command to run: " + commandToRun); + + debugee = binder.startLocalDebugee(commandToRun); + debugee.redirectOutput(logHandler); + processToRun = debugee.getProcess(); + + logOnVerbose(infoLogPrefixHead + "Accepting launched target VM..."); + try { + testTransportServiceConnection + = testTransportService.accept(testTransportServiceListenKey, 0, 0); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.accept(testTransportServiceListenKey, 0, 0) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.accept(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + try { + testTransportService.stopListening(testTransportServiceListenKey); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + logOnVerbose(infoLogPrefixHead + "Creating VirtualMachine for target VM..."); +// ( (CreateVM002_Connection)testTransportServiceConnection).toPrintPacket(true); + boolean wasIOExceptionInConnection = false; + try { + testVirtualMachine + = virtualMachineManager.createVirtualMachine(testTransportServiceConnection, + processToRun); + wasIOExceptionInConnection + =( (CreateVM002_Connection)testTransportServiceConnection).wasIOException; + if ( wasIOExceptionInConnection ) { + logOnError(errorLogPrefixHead + "VirtualMachineManager.createVirtualMachine(Connection, Process) does"); + logOnError(errorLogPrefix + "NOT throw IOException when I/O error occurs in Connection."); + testResult = STATUS_FAILED; + } + debugee.setupVM(testVirtualMachine); + } catch ( IOException ioExcept ) { + // OK. It is expected Exception + logOnVerbose(infoLogPrefixHead + + "VirtualMachineManager.createVirtualMachine(Connection, Process) throws IOException."); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + testResult = STATUS_PASSED; + } catch ( Throwable thrown ) { + wasIOExceptionInConnection + =( (CreateVM002_Connection)testTransportServiceConnection).wasIOException; + logOnError(errorLogPrefixHead + "VirtualMachineManager.createVirtualMachine(Connection, Process) throws"); + if ( wasIOExceptionInConnection ) { + logOnError(errorLogPrefix + "unexpected Exception when I/O error occurs in Connection:"); + logOnError(errorLogPrefix + "Expected Exception - 'IOException'"); + logOnError(errorLogPrefix + "Actual Exception - '" + thrown + "'"); + } else { + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + } + testResult = STATUS_FAILED; + } +// ( (CreateVM002_Connection)testTransportServiceConnection).toPrintPacket(false); + + } finally { + + logOnVerbose(infoLogPrefixHead + "Closing connection and destroying target VM..."); + if (testVirtualMachine != null) { + logOnVerbose(infoLogPrefix + "Disposing target VM mirror"); + testVirtualMachine.dispose(); + } + if (testTransportServiceConnection != null) { + logOnVerbose(infoLogPrefix + "Closing transport connection"); + try { + testTransportServiceConnection.close(); + } catch (IOException e) { + logAlways("# WARNING: IOException while closing connection:\n\t" + e); + } + } + if (debugee != null) { + logOnVerbose(infoLogPrefix + "Waiting for target VM exit"); + int status = debugee.waitFor(); + logOnVerbose(infoLogPrefix + "debuggee exit status: " + status); + } + } + + return testResult; + } + +} // end of createVM002 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002/TestDescription.java new file mode 100644 index 00000000000..406822f74a4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002/TestDescription.java @@ -0,0 +1,57 @@ +/* + * 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/VirtualMachineManager/createVirtualMachine/createVM002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002 test: + * The test for the + * virtualMachineManager.createVirtualMachine(...) methods. + * The test checks up that the + * createVirtualMachine(Connection, Process) method throws + * IOException when I/O error occurs in used Connection during + * creating of Virtual Mashine. + * COMMENTS: + * Test fixed according to test RFE: + * 4943437 TEST_RFE: createVM002 does not honor DEBUGEE_VM_* setting + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM002 + * nsk.jdi.VirtualMachineManager.createVirtualMachine.CreateVM002_TargetVM + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003.java new file mode 100644 index 00000000000..92bed251e41 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003.java @@ -0,0 +1,268 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the
    + * virtualMachineManager.createVirtualMachine(...) methods.
    + *
    + * The test checks up that createVirtualMachine(Connection, Process)
    + * method creates the VirtualMachine properly for Process that is NOT
    + * null.
    + *
    + * After the VirtualMachine is created the test checks that:
    + * - VirtualMachine.process() method returns the same Process passed
    + * to the createVirtualMachine(Connection, Process) method;
    + * - after VirtualMachine.resume() the Process should finish for
    + * specified time with expected Exit Status value;
    + *
    + */ +public class createVM003 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "createVM003: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> createVM003: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + static final String packagePrefix = "nsk.jdi.VirtualMachineManager.createVirtualMachine."; +// static final String packagePrefix = emptyString; + static final String targetVMClassName = packagePrefix + "CreateVM003_TargetVM"; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new createVM003().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + logAlways("==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test..."); + logOnVerbose + ("==> Test checks that virtualMachineManager.createVirtualMachine(Connection, Process) method"); + logOnVerbose + ("==> creates Virtual Machine properly for Process that is NOT null."); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + TransportService testTransportService = new CreateVM003_TranspServ(); + + TransportService.ListenKey testTransportServiceListenKey = null; + logOnVerbose(infoLogPrefixHead + "Start Listening for target VM..."); + try { + testTransportServiceListenKey = testTransportService.startListening(); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.startListening() throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.startListening() throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + String targetJava = argsHandler.getLaunchExecPath() + + " " + argsHandler.getLaunchOptions(); + String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" + + testTransportServiceListenKey.address() + " " + targetVMClassName; + + Binder binder = new Binder(argsHandler, logHandler); + Debugee debugee = null; + Process processToRun = null; + Connection testTransportServiceConnection = null; + + try { + + logOnVerbose(infoLogPrefixHead + "PROCESS is being created:"); + logOnVerbose(infoLogPrefix + "Command to run: " + commandToRun); + + debugee = binder.startLocalDebugee(commandToRun); + debugee.redirectOutput(logHandler); + processToRun = debugee.getProcess(); + + logOnVerbose(infoLogPrefixHead + "Accepting launched target VM..."); + try { + testTransportServiceConnection + = testTransportService.accept(testTransportServiceListenKey, 0, 0); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.accept(testTransportServiceListenKey, 0, 0) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.accept(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + try { + testTransportService.stopListening(testTransportServiceListenKey); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + logOnVerbose(infoLogPrefixHead + "Creating VirtualMachine for target VM..."); + VirtualMachine testVirtualMachine = null; + try { + testVirtualMachine + = virtualMachineManager.createVirtualMachine(testTransportServiceConnection, + processToRun); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "VirtualMachineManager.createVirtualMachine(Connection, Process) throws IOException."); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + + "VirtualMachineManager.createVirtualMachine(Connection, Process) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "Connection = '" + testTransportServiceConnection + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + Process testVirtualMachineProcess = testVirtualMachine.process(); + if ( ! processToRun.equals(testVirtualMachineProcess) ) { + logOnError(errorLogPrefixHead + "Created VirtualMachine returns unexpected Process:"); + logOnError(errorLogPrefix + "Expected Process = '" + processToRun + "'"); + logOnError(errorLogPrefix + "Returned Process = '" + testVirtualMachineProcess + "'"); + testResult = STATUS_FAILED; + } + + long timeout = argsHandler.getWaitTime() * 60 * 1000; // milliseconds + + logOnVerbose(infoLogPrefixHead + "Managing target VM"); + debugee.setupVM(testVirtualMachine); + logOnVerbose(infoLogPrefix + "Waiting for VM initialized"); + debugee.waitForVMInit(timeout); + logOnVerbose(infoLogPrefix + "Resuming VM"); + debugee.resume(); + logOnVerbose(infoLogPrefix + "Waiting for VM exit"); + int procExitValue = debugee.waitFor(); + logOnVerbose(infoLogPrefix + "VM exit status: " + procExitValue); + + if ( procExitValue != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Target VM finished unexpectedly:"); + logOnError(errorLogPrefix + "Expected Exit status = " + (STATUS_PASSED + STATUS_TEMP)); + logOnError(errorLogPrefix + "Actual Exit status = " + procExitValue); + testResult = STATUS_FAILED; + } else { + logOnVerbose(infoLogPrefixHead + "Target VM finished succesfully!"); + } + + } finally { + + logOnVerbose(infoLogPrefixHead + "Closing connection and destroying target VM..."); + if (testTransportServiceConnection != null) { + try { + testTransportServiceConnection.close(); + } catch (IOException e) { + logAlways("# WARNING: IOException while closing connection:\n\t" + e); + } + } + if (debugee != null) { + debugee.close(); + } + } + + return testResult; + } + +} // end of createVM003 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003/TestDescription.java new file mode 100644 index 00000000000..5d36a5f4737 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003/TestDescription.java @@ -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/VirtualMachineManager/createVirtualMachine/createVM003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003 test: + * The test for the + * virtualMachineManager.createVirtualMachine(...) methods. + * The test checks up that createVirtualMachine(Connection, Process) + * method creates the VirtualMachine properly for Process that is NOT null. + * After the VirtualMachine is created the test checks that: + * - VirtualMachine.process() method returns the same Process passed + * to the createVirtualMachine(Connection, Process) method; + * - VMStartEvent should be received for specified timeout; + * - after VirtualMachine.resume() the Process should finish + * with expected exit status; + * COMMENTS: + * Test fixed according to test RFE: + * 4943437 TEST_RFE: createVM002 does not honor DEBUGEE_VM_* setting + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM003 + * nsk.jdi.VirtualMachineManager.createVirtualMachine.CreateVM003_TargetVM + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004.java new file mode 100644 index 00000000000..4a485e21d21 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004.java @@ -0,0 +1,270 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the
    + * virtualMachineManager.createVirtualMachine(...) methods.
    + *
    + * The test checks up that createVirtualMachine(Connection, Process)
    + * method creates the VirtualMachine properly when 'Process' argument
    + * is null.
    + *
    + * After the VirtualMachine is created the test checks that:
    + * - VirtualMachine.process() method returns the null as
    + * the specification says about it.
    + * - nevertheless after VirtualMachine.resume() the target VM should
    + * finish for specified time with expected Exit Status value;
    + *
    + */ +public class createVM004 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "createVM004: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> createVM004: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + static final String packagePrefix = "nsk.jdi.VirtualMachineManager.createVirtualMachine."; +// static final String packagePrefix = emptyString; + static final String targetVMClassName = packagePrefix + "CreateVM004_TargetVM"; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new createVM004().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + logAlways("==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test..."); + logOnVerbose + ("==> Test checks that virtualMachineManager.createVirtualMachine(Connection, Process) method"); + logOnVerbose + ("==> creates Virtual Machine properly when 'Process' argument is null."); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + String targetJavaKey = "targetJava="; + String[] testArgs = argsHandler.getArguments(); + + TransportService testTransportService = new CreateVM004_TranspServ(); + + TransportService.ListenKey testTransportServiceListenKey = null; + logOnVerbose(infoLogPrefixHead + "Start Listening for target VM..."); + try { + testTransportServiceListenKey = testTransportService.startListening(); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.startListening() throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.startListening() throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + String targetJava = argsHandler.getLaunchExecPath() + + " " + argsHandler.getLaunchOptions(); + String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" + + testTransportServiceListenKey.address() + " " + targetVMClassName; + + Binder binder = new Binder(argsHandler, logHandler); + Debugee debugee = null; + Process processToRun = null; + Connection testTransportServiceConnection = null; + + try { + + logOnVerbose(infoLogPrefixHead + "PROCESS is being created:"); + logOnVerbose(infoLogPrefix + "Command to run: " + commandToRun); + + debugee = binder.startLocalDebugee(commandToRun); + debugee.redirectOutput(logHandler); + processToRun = debugee.getProcess(); + + logOnVerbose(infoLogPrefixHead + "Accepting launched target VM..."); + try { + testTransportServiceConnection + = testTransportService.accept(testTransportServiceListenKey, 0, 0); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.accept(testTransportServiceListenKey, 0, 0) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.accept(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + try { + testTransportService.stopListening(testTransportServiceListenKey); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + logOnVerbose(infoLogPrefixHead + "Creating VirtualMachine for target VM..."); + VirtualMachine testVirtualMachine = null; + try { + testVirtualMachine + = virtualMachineManager.createVirtualMachine(testTransportServiceConnection, null); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "VirtualMachineManager.createVirtualMachine(Connection, null) throws IOException."); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "VirtualMachineManager.createVirtualMachine(Connection, null) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "Connection = '" + testTransportServiceConnection + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + Process testVirtualMachineProcess = testVirtualMachine.process(); + if ( testVirtualMachineProcess != null ) { + logOnError(errorLogPrefixHead + + "Created VirtualMachine with null 'Process' argument returns unexpected Process:"); + logOnError(errorLogPrefix + "Expected Process = null"); + logOnError(errorLogPrefix + "Returned Process = '" + testVirtualMachineProcess + "'"); + testResult = STATUS_FAILED; + } + + long timeout = argsHandler.getWaitTime() * 60 * 1000; // milliseconds + + logOnVerbose(infoLogPrefixHead + "Managing target VM"); + debugee.setupVM(testVirtualMachine); + logOnVerbose(infoLogPrefix + "Waiting for VM initialized"); + debugee.waitForVMInit(timeout); + logOnVerbose(infoLogPrefix + "Resuming VM"); + debugee.resume(); + logOnVerbose(infoLogPrefix + "Waiting for VM exit"); + int procExitValue = debugee.waitFor(); + logOnVerbose(infoLogPrefix + "VM exit status: " + procExitValue); + + if ( procExitValue != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Target VM finished unexpectedly:"); + logOnError(errorLogPrefix + "Expected Exit status = " + (STATUS_PASSED + STATUS_TEMP)); + logOnError(errorLogPrefix + "Actual Exit status = " + procExitValue); + testResult = STATUS_FAILED; + } else { + logOnVerbose(infoLogPrefixHead + "Target VM finished succesfully!"); + } + + } finally { + + logOnVerbose(infoLogPrefixHead + "Closing connection and destroying target VM..."); + if (testTransportServiceConnection != null) { + try { + testTransportServiceConnection.close(); + } catch (IOException e) { + logAlways("# WARNING: IOException while closing connection:\n\t" + e); + } + } + if (debugee != null) { + debugee.close(); + } + } + + return testResult; + } + +} // end of createVM004 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004/TestDescription.java new file mode 100644 index 00000000000..49d4cb9d911 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004/TestDescription.java @@ -0,0 +1,62 @@ +/* + * 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/VirtualMachineManager/createVirtualMachine/createVM004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004 test: + * The test for the + * virtualMachineManager.createVirtualMachine(...) methods. + * The test checks up that createVirtualMachine(Connection, Process) + * method creates the VirtualMachine properly when 'Process' argument + * is null. + * After the VirtualMachine is created the test checks that: + * - VirtualMachine.process() method returns the null as + * the specification says about it. + * - VMStartEvent should be received for specified timeout; + * - after VirtualMachine.resume() the Process should finish + * with expected exit status; + * COMMENTS: + * Test fixed according to test RFE: + * 4943437 TEST_RFE: createVM002 does not honor DEBUGEE_VM_* setting + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM004 + * nsk.jdi.VirtualMachineManager.createVirtualMachine.CreateVM004_TargetVM + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005.java new file mode 100644 index 00000000000..2b47fede424 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005.java @@ -0,0 +1,265 @@ +/* + * 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.VirtualMachineManager.createVirtualMachine; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import com.sun.jdi.connect.spi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the
    + * virtualMachineManager.createVirtualMachine(Connection) method.
    + *
    + * The test checks up that createVirtualMachine(Connection) method
    + * creates the VirtualMachine properly.
    + *
    + * After the VirtualMachine is created the test checks that:
    + * - VirtualMachine.process() method returns the null as
    + * the specification says about it.
    + * - nevertheless after VirtualMachine.resume() the target VM should
    + * finish for specified time with expected Exit Status value;
    + *
    + */ +public class createVM005 { + + static final int STATUS_PASSED = 0; + static final int STATUS_FAILED = 2; + static final int STATUS_TEMP = 95; + + static final String errorLogPrefixHead = "createVM005: "; + static final String errorLogPrefix = " "; + static final String infoLogPrefixHead = "--> createVM005: "; + static final String infoLogPrefix = "--> "; + static final String emptyString = ""; + static final String packagePrefix = "nsk.jdi.VirtualMachineManager.createVirtualMachine."; +// static final String packagePrefix = emptyString; + static final String targetVMClassName = packagePrefix + "CreateVM005_TargetVM"; + + static ArgumentHandler argsHandler; + static Log logHandler; + + private static void logOnVerbose(String message) { + logHandler.display(message); + } + + private static void logOnError(String message) { + logHandler.complain(message); + } + + private static void logAlways(String message) { + logHandler.println(message); + } + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + STATUS_TEMP); + } + + public static int run (String argv[], PrintStream out) { + int result = new createVM005().runThis(argv, out); + if ( result == STATUS_FAILED ) { + logAlways("\n##> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test FAILED"); + } + else { + logAlways("\n==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test PASSED"); + } + return result; + } + + + private int runThis (String argv[], PrintStream out) { + int testResult = STATUS_PASSED; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + logAlways("==> nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test..."); + logOnVerbose + ("==> Test checks that virtualMachineManager.createVirtualMachine(Connection) method"); + logOnVerbose + ("==> creates Virtual Machine properly."); + + VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager(); + if (virtualMachineManager == null) { + logOnError(errorLogPrefixHead + "Bootstrap.virtualMachineManager() returns null."); + return STATUS_FAILED; + } + + TransportService testTransportService = new CreateVM005_TranspServ(); + + TransportService.ListenKey testTransportServiceListenKey = null; + logOnVerbose(infoLogPrefixHead + "Start Listening for target VM..."); + try { + testTransportServiceListenKey = testTransportService.startListening(); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.startListening() throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.startListening() throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + String targetJava = argsHandler.getLaunchExecPath() + + " " + argsHandler.getLaunchOptions(); + String commandToRun = targetJava + " -Xdebug -Xrunjdwp:transport=dt_socket,address=" + + testTransportServiceListenKey.address() + " " + targetVMClassName; + + Binder binder = new Binder(argsHandler, logHandler); + Debugee debugee = null; + Process processToRun = null; + Connection testTransportServiceConnection = null; + + try { + + logOnVerbose(infoLogPrefixHead + "PROCESS is being created:"); + logOnVerbose(infoLogPrefix + "Command to run: " + commandToRun); + + debugee = binder.startLocalDebugee(commandToRun); + debugee.redirectOutput(logHandler); + processToRun = debugee.getProcess(); + + logOnVerbose(infoLogPrefixHead + "Accepting launched target VM..."); + try { + testTransportServiceConnection + = testTransportService.accept(testTransportServiceListenKey, 0, 0); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.accept(testTransportServiceListenKey, 0, 0) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "testTransportService.accept(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + try { + testTransportService.stopListening(testTransportServiceListenKey); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws IOException."); + logOnVerbose(infoLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnVerbose(infoLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + + "testTransportService.stopListening(testTransportServiceListenKey) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "testTransportService = '" + testTransportService + "'"); + logOnError(errorLogPrefix + "testTransportServiceListenKey = '" + testTransportServiceListenKey + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + logOnVerbose(infoLogPrefixHead + "Creating VirtualMachine for target VM..."); + VirtualMachine testVirtualMachine = null; + try { + testVirtualMachine + = virtualMachineManager.createVirtualMachine(testTransportServiceConnection); + } catch ( IOException ioExcept ) { + // OK. It is possible Exception + logOnVerbose(infoLogPrefixHead + + "VirtualMachineManager.createVirtualMachine(Connection) throws IOException."); + logOnVerbose(infoLogPrefix + "IOException - '" + ioExcept + "'"); + logOnVerbose(infoLogPrefix + "The test is stopped."); + return STATUS_PASSED; + } catch ( Throwable thrown ) { + logOnError(errorLogPrefixHead + "VirtualMachineManager.createVirtualMachine(Connection) throws"); + logOnError(errorLogPrefix + "unexpected Exception:"); + logOnError(errorLogPrefix + "Connection = '" + testTransportServiceConnection + "'"); + logOnError(errorLogPrefix + "Exception - '" + thrown + "'"); + return STATUS_FAILED; + } + + Process testVirtualMachineProcess = testVirtualMachine.process(); + if ( testVirtualMachineProcess != null ) { + logOnError(errorLogPrefixHead + + "Created VirtualMachine without 'Process' argument returns unexpected Process:"); + logOnError(errorLogPrefix + "Expected Process = null"); + logOnError(errorLogPrefix + "Returned Process = '" + testVirtualMachineProcess + "'"); + testResult = STATUS_FAILED; + } + + long timeout = argsHandler.getWaitTime() * 60 * 1000; // milliseconds + + logOnVerbose(infoLogPrefixHead + "Managing target VM"); + debugee.setupVM(testVirtualMachine); + logOnVerbose(infoLogPrefix + "Waiting for VM initialized"); + debugee.waitForVMInit(timeout); + logOnVerbose(infoLogPrefix + "Resuming VM"); + debugee.resume(); + logOnVerbose(infoLogPrefix + "Waiting for VM exit"); + int procExitValue = debugee.waitFor(); + logOnVerbose(infoLogPrefix + "VM exit status: " + procExitValue); + + if ( procExitValue != (STATUS_PASSED + STATUS_TEMP) ) { + logOnError(errorLogPrefixHead + "Target VM finished unexpectedly:"); + logOnError(errorLogPrefix + "Expected Exit status = " + (STATUS_PASSED + STATUS_TEMP)); + logOnError(errorLogPrefix + "Actual Exit status = " + procExitValue); + testResult = STATUS_FAILED; + } else { + logOnVerbose(infoLogPrefixHead + "Target VM finished succesfully!"); + } + + } finally { + + logOnVerbose(infoLogPrefixHead + "Closing connection and destroying target VM..."); + if (testTransportServiceConnection != null) { + try { + testTransportServiceConnection.close(); + } catch (IOException e) { + logAlways("# WARNING: IOException while closing connection:\n\t" + e); + } + } + if (debugee != null) { + debugee.close(); + } + } + return testResult; + } + +} // end of createVM005 class diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005/TestDescription.java new file mode 100644 index 00000000000..cf69a7b9fb7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005/TestDescription.java @@ -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/VirtualMachineManager/createVirtualMachine/createVM005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005 test: + * The test for the + * virtualMachineManager.createVirtualMachine(Connection) method. + * The test checks up that createVirtualMachine(Connection) method + * creates the VirtualMachine properly. + * After the VirtualMachine is created the test checks that: + * - VirtualMachine.process() method returns the null as + * the specification says about it. + * - VMStartEvent should be received for specified timeout; + * - after VirtualMachine.resume() the Process should finish + * with expected exit status; + * COMMENTS: + * Test fixed according to test RFE: + * 4943437 TEST_RFE: createVM002 does not honor DEBUGEE_VM_* setting + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM005 + * nsk.jdi.VirtualMachineManager.createVirtualMachine.CreateVM005_TargetVM + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.createVirtualMachine.createVM005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001.java new file mode 100644 index 00000000000..6a230db6877 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001.java @@ -0,0 +1,148 @@ +/* + * 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.VirtualMachineManager.defaultConnector; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.defaultConnector()
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.defaultConnector() doesn't throw
    + * an exception and returnes a non-null value of the
    + * LaunchingConnector type.
    + */ + +public class default001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/defaultConnector/default001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new default001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + waitTime = argsHandler.getWaitTime(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + log2("......call to vmm.defaultConnector()"); + LaunchingConnector defaultConnector; + try { + defaultConnector = vmm.defaultConnector(); + if (defaultConnector == null) { + log3("ERROR: defaultConnector == null"); + testExitCode = FAILED; + } + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001/TestDescription.java new file mode 100644 index 00000000000..1a609febaf3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001/TestDescription.java @@ -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/VirtualMachineManager/defaultConnector/default001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.defaultConnector() + * complies with its spec: + * public LaunchingConnector defaultConnector() + * Identifies the default connector. + * This connector should be used as the launching connector when + * selection of a connector with specific characteristics is unnecessary. + * Returns: the default LaunchingConnector + * 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.VirtualMachineManager.defaultConnector.default001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.defaultConnector.default001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001.java new file mode 100644 index 00000000000..fdd198189e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001.java @@ -0,0 +1,152 @@ +/* + * 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.VirtualMachineManager.launchingConnectors; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.launchingConnectors()
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.launchingConnectors() doesn't throw
    + * an exception and returnes a List of non-null values of
    + * the LaunchingConnector type each.
    + */ + +public class launching001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/launchingConnectors/launching001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new launching001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + try { + log2("......call to vmm.launchingConnectors()"); + List connectors = vmm.launchingConnectors(); + log2(" size of List == " + connectors.size()); + + log2("......checking up on nulls and casts to LaunchingConnector"); + ListIterator li = connectors.listIterator(); + for (; li.hasNext(); ) { + LaunchingConnector launchingConnector = (LaunchingConnector) li.next(); + if (launchingConnector == null) { + log3("ERROR: launchingConnector == null"); + testExitCode = FAILED; + } + } + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001/TestDescription.java new file mode 100644 index 00000000000..44f355063bd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001/TestDescription.java @@ -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/VirtualMachineManager/launchingConnectors/launching001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.launchingConnectors() + * complies with its spec: + * public java.util.List launchingConnectors() + * Returns the list of known LaunchingConnector objects. + * Any of the returned objects can be used to launch + * a new target VM and immediately create a VirtualMachine mirror for it. + * Returns: a list of LaunchingConnector objects. + * 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.VirtualMachineManager.launchingConnectors.launching001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.launchingConnectors.launching001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001.java new file mode 100644 index 00000000000..4e7e4009a68 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001.java @@ -0,0 +1,154 @@ +/* + * 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.VirtualMachineManager.listeningConnectors; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.listeningConnectors()
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.listeningConnectors() doesn't throw
    + * an exception and returnes a List of non-null values of
    + * the ListeningConnector type each.
    + */ + +public class listening001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/listeningConnectors/listening001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new listening001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + waitTime = argsHandler.getWaitTime(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + try { + log2("......call to vmm.listeningConnectors()"); + List connectors = vmm.listeningConnectors(); + log2(" size of List == " + connectors.size()); + + log2("......checking up on nulls and casts to ListeningConnector"); + ListIterator li = connectors.listIterator(); + for (; li.hasNext(); ) { + ListeningConnector listeningConnector = (ListeningConnector) li.next(); + if (listeningConnector == null) { + log3("ERROR: listeningConnector == null"); + testExitCode = FAILED; + } + } + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001/TestDescription.java new file mode 100644 index 00000000000..3a1dd4aa8e0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001/TestDescription.java @@ -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/VirtualMachineManager/listeningConnectors/listening001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.listeningConnectors() + * complies with its spec: + * public java.util.List listeningConnectors() + * Returns the list of known ListeningConnector objects. + * Any of the returned objects can be used to listen for a connection + * initiated by a target VM and create a VirtualMachine mirror for it. + * Returns: a list of ListeningConnector objects. + * 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.VirtualMachineManager.listeningConnectors.listening001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.listeningConnectors.listening001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001.java new file mode 100644 index 00000000000..dd11ba4d854 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001.java @@ -0,0 +1,144 @@ +/* + * 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.VirtualMachineManager.majorInterfaceVersion; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.majorInterfaceVersion()
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.majorInterfaceVersion() doesn't throw
    + * an exception and a returned value is of the int type.
    + */ + +public class major001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new major001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + waitTime = argsHandler.getWaitTime(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + log2("......call to vmm.majorInterfaceVersion()"); + int majorVersion; + try { + majorVersion = vmm.majorInterfaceVersion(); + log2(" majorInterfaceVersion() == " + majorVersion); + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001/TestDescription.java new file mode 100644 index 00000000000..2b2d1e86e49 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001/TestDescription.java @@ -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/VirtualMachineManager/majorInterfaceVersion/major001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager.majorInterfaceVersion() + * complies with its spec: + * public int majorInterfaceVersion() + * Returns the major version number of the JDI interface. + * See VirtualMachine.version() target VM version and + * information and VirtualMachine.description() more version information. + * Returns: the integer major version number. + * 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.VirtualMachineManager.majorInterfaceVersion.major001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.majorInterfaceVersion.major001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001.java new file mode 100644 index 00000000000..d2293425828 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001.java @@ -0,0 +1,149 @@ +/* + * 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. + */ +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! templete parameters !!!! + +// VirtualMachineManager Interface Name VirtualMachineManager +// minorInterfaceVersion Method Name minorInterfaceVersion +// minor001 Test Name minor001 +// ------------------------------------------------------ + +package nsk.jdi.VirtualMachineManager.minorInterfaceVersion; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VirtualMachineManager.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VirtualMachineManager.minorInterfaceVersion()
    + * complies with its specification.
    + *
    + * The test checks up that invoking the method
    + * VirtualMachineManager.minorInterfaceVersion() doesn't throw
    + * an exception and a returned value is of the int type.
    + */ + +public class minor001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new minor001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + + waitTime = argsHandler.getWaitTime(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......call to Bootstrap.virtualMachineManager()"); + VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); + if (vmm == null) { + log3("ERROR: null returned"); + testExitCode = FAILED; + } else { + + log2("......call to vmm.minorInterfaceVersion()"); + int minorVersion; + try { + minorVersion = vmm.minorInterfaceVersion(); + log2(" minorInterfaceVersion() == " + minorVersion); + } catch ( Exception e) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001/TestDescription.java new file mode 100644 index 00000000000..614e1615682 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001/TestDescription.java @@ -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/VirtualMachineManager/minorInterfaceVersion/minor001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VirtualMachineManager. + * The test checks up that a result of the method + * com.sun.jdi.VirtualMachineManager. minorInterfaceVersion() + * complies with its spec: + * public int minorInterfaceVersion() + * Returns the minor version number of the JDI interface. + * See VirtualMachine.version() target VM version + * and information and VirtualMachine.description() more version information. + * Returns: the integer minor version number + * 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.VirtualMachineManager.minorInterfaceVersion.minor001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VirtualMachineManager.minorInterfaceVersion.minor001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001.java new file mode 100644 index 00000000000..4997fc38879 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001.java @@ -0,0 +1,458 @@ +/* + * 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.VoidType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VoidType.
    + *
    + * The test checks that for a mirror of a "void" value the cast
    + * from Type to VoidType doesn't throw ClassCastException.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the cast,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee prepares new check case and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent,
    + * the debugger performs the check.
    + * Note. To inform each other of needed actions, the debugger and
    + * and the debuggee use debuggeee's variable "instruction".
    + *
    + * In third phase when at the end,
    + * the debuggee changes the value of the "instruction"
    + * to inform the debugger of checks finished, and both end.
    + *
    + */ + +public class voidtype001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VoidType/_itself_/voidtype001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new voidtype001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VoidType._itself_.voidtype001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : e"); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + BreakpointRequest bpRequest; + + bpRequest = settingBreakpoint(threadByName("main"), + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + log2("......getting: List methods = debuggeeClass.methodsByName('testMethod');"); + List methods = debuggeeClass.methodsByName("testMethod"); + if (methods.size() != 1) { + testExitCode = FAILED; + log3("ERROR: methods.size() != 1"); + break ; + } + + log2("......getting: Method testMethod = (Method) methods.get(0);"); + Method testMethod = (Method) methods.get(0); + + try { + log2("......getting: Type testMethodReturnType = testMethod.returnType();"); + Type testMethodReturnType = testMethod.returnType(); + + log2("......VoidType voidType = (VoidType) testMethodReturnType;"); + VoidType voidType = (VoidType) testMethodReturnType; + } catch ( ClassNotLoadedException e ) { + log3("ERROR: testmethodReturnType = testmethod.returnType();"); + testExitCode = FAILED; + break ; + } catch ( ClassCastException e ) { + log3("ERROR: ClassCastException"); + testExitCode = FAILED; + break ; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001/TestDescription.java new file mode 100644 index 00000000000..a580f0c4cde --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/VoidType/_itself_/voidtype001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VoidType. + * The test checks that for a mirror of a "void" value the cast + * from Type to VoidType doesn't throw ClassCastException. + * The test works as follows: + * The debugger program - nsk.jdi.VoidType._itself_.voidtype001; + * the debuggee program - nsk.jdi.VoidType._itself_.voidtype001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.VoidType._itself_.voidtype001 + * nsk.jdi.VoidType._itself_.voidtype001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VoidType._itself_.voidtype001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001a.java new file mode 100644 index 00000000000..d9b6ce0442e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001a.java @@ -0,0 +1,115 @@ +/* + * 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.VoidType._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the voidtype001 JDI test. + */ + +public class voidtype001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + public void testMethod () { + return; + } + + //------------------------------------------------------ common section + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + int exitCode = PASSED; + + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + methodForCommunication(); + break ; + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + System.exit(exitCode + PASS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001.java new file mode 100644 index 00000000000..37686b6f956 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001.java @@ -0,0 +1,179 @@ +/* + * 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.VoidType.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; +import com.sun.jdi.event.*; +import com.sun.jdi.connect.*; +import java.io.*; +import java.util.*; + +/** + * The debugger application of the test. + */ +public class tostring001 { + + //------------------------------------------------------- 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.VoidType.toString."; + private final static String className = "tostring001"; + private final static String debuggerName = prefix + className; + private final static String debuggeeName = debuggerName + "a"; + + //------------------------------------------------------- test specific fields + + /** debuggee's methods for check **/ + private final static String checkedMethods[] = { + "Mv" , "MvS", "MvI", "MvY", "MvU", "MvN", + "MvR", "MvP", "MvSM", "MvIM", "MvYM", "MvPM", "MvNP" + }; + + //------------------------------------------------------- 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + tostring001a.brkpMethodName, + tostring001a.brkpLineNumber); + debuggee.resume(); + + debuggee.sendSignal(SIGNAL_GO); + Event event = null; + + // waiting the breakpoint event + try { + event = debuggee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (!(event instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + ThreadReference thread = ((BreakpointEvent)event).thread(); + List params = new Vector(); + ClassType testedClass = (ClassType)debuggeeClass; + ObjectReference testedObject = null; + + // Finding of debuggee's class constructor + Method ctor = debuggee.methodByName(debuggeeClass, ""); + + try { + testedObject = testedClass.newInstance(thread, ctor, params, 0); + } catch (Exception e) { + throw new Failure("unexpected " + e + " when invoking debuggee's constructor"); + } + + display("Checking toString() method for debuggee's void type methods..."); + + // Check all methods from debuggee + for (int i = 0; i < checkedMethods.length-1; i++) { + + VoidType voidType = null; + Method method; + + method = debuggee.methodByName(debuggeeClass, checkedMethods[i]); + try { + voidType = (VoidType)method.returnType(); + String str = voidType.toString(); + if (str == null) { + complain("toString() returns null for VoidType of debugges's method: " + checkedMethods[i]); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for VoidType of debugges's method: " + checkedMethods[i]); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() returns for debuggee's void method " + checkedMethods[i] + " : " + str); + } + } catch(Exception e) { + complain("Unexpected " + e + " when getting VoidType of debuggee's method: " + checkedMethods[i]); + exitStatus = Consts.TEST_FAILED; + } + + } + + display("Checking of debuggee's void type methods completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods + +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..df13a6dea95 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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/VoidType/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.VoidType interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * a VoidType object of a debuggee's void type method. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for VoidType + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VoidType.toString.tostring001 + * nsk.jdi.VoidType.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VoidType.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001a.java new file mode 100644 index 00000000000..1dd64e50b1b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidType/toString/tostring001a.java @@ -0,0 +1,110 @@ +/* + * 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.VoidType.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 80; + + //------------------------------------------------------ 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); + try { + pipe.println(tostring001.SIGNAL_READY); + receiveSignal(tostring001.SIGNAL_GO); + log.display("breakpoint line"); // brkpLineNumber + receiveSignal(tostring001.SIGNAL_QUIT); + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + + void Mv() {}; + + static void MvS() {}; + strictfp void MvI() {}; + synchronized void MvY() {}; + public void MvU() {}; + protected void MvR() {}; + private void MvP() {}; + native void MvN(); + + public static void MvSM() {}; + private strictfp void MvIM() {}; + static synchronized void MvYM() {}; + public final void MvPM() {}; + native protected void MvNP(); + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java new file mode 100644 index 00000000000..97b07c7383d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java @@ -0,0 +1,595 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/VoidValue/equals/equals001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VoidValue. + * The test checks up that a result of the method + * com.sun.jdi.VoidValue.equals() + * complies with its spec: + * public boolean equals(java.lang.Object obj) + * Compares the specified Object with this VoidValue for equality. + * Returns: true if the Object is a VoidValue; false otherwise. + * The test works as follows: + * A debugger program - nsk.jdi.VoidValue.equals.equals001; + * a debuggee program - nsk.jdi.VoidValue.equals.equals001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VoidValue.equals.equals001.equals001 + * nsk.jdi.VoidValue.equals.equals001.equals001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VoidValue.equals.equals001.equals001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.VoidValue.equals.equals001; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VoidValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VoidValue.equals()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee is suspended at a breakpoint set up
    + * by a debugger the debugger invokes two debuggee's methods:
    + * void vdValue1(); and void vdValue2();
    + * to form objects
    + * Value returnvdValue1, Value returnvdValue2;
    + *
    + * then performs the following casts:
    + * VoidValue vdValue1 = (VoidValue) returnvdValue1;
    + * VoidValue vdValue2 = (VoidValue) returnvdValue2;
    + *
    + * and checks up that the following is true:
    + *
    + * a) vdValue1.equals(vdValue2)
    + *
    + * b) Object testObj = null;
    + * !vdValue1.equals(testObj)
    + *
    + */ + +public class equals001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VoidValue/equals/equals001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new equals001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VoidValue.equals.equals001.equals001a"; + + private String testedClassName = + "nsk.jdi.VoidValue.equals.equals001.Threadequals001a"; + + //====================================================== test program + //------------------------------------------------------ common section + + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + String threadName = "Thread2"; + + String breakpointMethod1 = "run"; + String bpLine1 = "breakpointLineNumber1"; + + BreakpointRequest breakpRequest1 = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting a breakpoint event"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + + Value returnvdValue1 = null; + Value returnvdValue2 = null; + List invokeMethods = null; + Method invokeMethod = null; + List argumentList = null; + + + invokeMethods = testedclass.methodsByName("vdValue1"); + invokeMethod = (Method) invokeMethods.get(0); + + argumentList = Collections.emptyList(); + + try { + log2(" invoking equals001a.vdValue1(); no Exception expected"); + returnvdValue1 = thread2.invokeMethod(thread2, + invokeMethod, argumentList, 0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + invokeMethods = testedclass.methodsByName("vdValue2"); + invokeMethod = (Method) invokeMethods.get(0); + + try { + log2(" invoking equals001a.vdValue2(); no Exception expected"); + returnvdValue2 = thread2.invokeMethod(thread2, + invokeMethod, argumentList, 0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + + VoidValue vdValue1 = null; + VoidValue vdValue2 = null; + + log2(" checking up cast: vdValue1 = (VoidValue) returnvdValue1;"); + try { + vdValue1 = (VoidValue) returnvdValue1; + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException"); + expresult = returnCode1; + break label1; + } + + log2(" checking up cast: vdValue2 = (VoidValue) returnvdValue2;"); + try { + vdValue2 = (VoidValue) returnvdValue2; + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException"); + expresult = returnCode1; + break label1; + } + + log2(" checking up equality: vdValue1.equals(vdValue2)"); + if (!vdValue1.equals(vdValue2)) { + log3("ERROR: !vdValue1.equals(vdValue2)"); + expresult = returnCode1; + } + + Object testObj = null; + log2(" checking up equality: vdValue1.equals(null)"); + if (vdValue1.equals(testObj)) { + log3("ERROR: vdValue1.equals(null)"); + expresult = returnCode1; + } + } + log2(" resuming the vm"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + logHandler.complain("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001a.java new file mode 100644 index 00000000000..d8f3155f7f5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001a.java @@ -0,0 +1,189 @@ +/* + * 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.VoidValue.equals.equals001; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the equals001 JDI test. + */ + +public class equals001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + equals002 thisTest = new equals002(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + waitTime = argHandler.getWaitTime() * 60000; + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("Test finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + debugee.VM().suspend(); + testedClass = (ClassType )debugee.classByName(debugeeName); + + BreakpointRequest brkp = debugee.setBreakpoint(testedClass, + equals002a.brkpMethodName, + equals002a.brkpLineNumber); + debugee.resume(); + + debugee.sendSignal(""); + Event event = null; + + // waiting the breakpoint event + try { + event = debugee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new TestRuntimeException("unexpected InterruptedException"); + } + if (!(event instanceof BreakpointEvent )) { + debugee.resume(); + throw new TestRuntimeException("BreakpointEvent didn't arrive"); + } + + BreakpointEvent brkpEvent = (BreakpointEvent )event; + if (brkpEvent == null) { + debugee.resume(); + throw new TestRuntimeException("No breakpoint events"); + } + + thread = brkpEvent.thread(); + + display("\nTEST BEGINS"); + display("==========="); + + Method method = debugee.methodByName(testedClass, method2Invoke); + List params = new Vector(); + VoidValue voidValue1 = null, + voidValue2 = null; + try { + voidValue1 = (VoidValue )testedClass.invokeMethod(thread, method, params, 0); + voidValue2 = (VoidValue )testedClass.invokeMethod(thread, method, params, 0); + } catch(Exception e) { + complain("unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + + // geting of array of primitive types + Field fldOtherType, field = testedClass.fieldByName(arrPrimitives); + if ( field == null ) { + complain("Field '" + arrPrimitives + "' not found."); + exitStatus = Consts.TEST_FAILED; + } + Value valueOtherType, arrValue = testedClass.getValue(field); + if ( arrValue == null || !(arrValue instanceof ArrayReference) ) { + complain("Field '" + arrValue + "' is wrong."); + exitStatus = Consts.TEST_FAILED; + } + ArrayReference primitivValues = (ArrayReference )arrValue; + + // comparing with debugee's fields + if ( !PerformComparing(voidValue1, voidValue2) ) + exitStatus = Consts.TEST_FAILED; + for (int j = 0; j < primitivValues.length(); j++) { + arrValue = primitivValues.getValue(j); + + fldOtherType = testedClass.fieldByName(((StringReference )arrValue).value()); + if ( fldOtherType == null ) { + complain("Field '" + arrValue + "' not found."); + exitStatus = Consts.TEST_FAILED; + continue; + } + + valueOtherType = testedClass.getValue(fldOtherType); + + if ( !PerformComparing(voidValue1, valueOtherType) ) + exitStatus = Consts.TEST_FAILED; + } + + display("============="); + display("TEST FINISHES\n"); + + debugee.resume(); + debugee.quit(); + } + + private boolean PerformComparing(VoidValue value, Value object ) { + boolean res = true; + String msg = ""; + String type = "(" + (object == null ? "" : object.type().toString()) + ")"; + try { + if (value.equals(object)) { + if (object instanceof VoidValue) { + msg += "--> " + value + " == " + object + type; + } + else { + msg += "##> " + value + " == " + object + type + + " : are different types " + value.type() + " - " + + ((Value )object).type(); + res = false; + } + if (object == null) { + msg += " ***Wrong result!!!***"; + res = false; + } + } else { + if (!(object instanceof VoidValue)) { + msg += "--> " + value + " != " + object + type; + } + } + } catch (Exception e) { + msg += " ***Unexpected " + e + "***"; + res = false; + } + + if ( !res ) + complain(msg); + else + display(msg); + + return res; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals002/TestDescription.java new file mode 100644 index 00000000000..8fdca046c06 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals002/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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/VoidValue/equals/equals002. + * VM Testbase keywords: [quick, 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.BooleanValue.equals(Object) + * correctly works for the boundary value of parameter, throws described + * exceptions and complies with its spec: + * public boolean equals(Object obj) + * Compares the specified Object with this BooleanValue for equality. + * Overrides: + * equals in class Object + * Returns: + * true if the Object is a BooleanValue and if applying "==" to the + * two mirrored primitives would evaluate to true; false otherwise. + * The test check up case when parameter has value or boundary + * values of primitive types. In this case no exception is expected. + * 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: + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VoidValue.equals.equals002 + * nsk.jdi.VoidValue.equals.equals002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VoidValue.equals.equals002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals002a.java new file mode 100644 index 00000000000..f5271843112 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals002a.java @@ -0,0 +1,97 @@ +/* + * 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.VoidValue.equals; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +public class equals002a { + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 83; + + static String[] testedFields = { + "cmpObjNULL", + "cmpObject", + "cmpBoolMAX", + "cmpBoolMIN", + "cmpByteMAX", + "cmpByteMIN", + "cmpCharMAX", + "cmpCharMIN", + "cmpDoubleMAX", + "cmpDoubleMIN", + "cmpFloatMAX", + "cmpFloatMIN", + "cmpIntMAX", + "cmpIntMIN", + "cmpLongMAX", + "cmpLongMIN", + "cmpShortMAX", + "cmpShortMIN" + }; + + static Object cmpObjNULL = null; + static Object cmpObject = new Object(); + static boolean cmpBoolMAX = true; + static boolean cmpBoolMIN = false; + static byte cmpByteMAX = Byte.MAX_VALUE; + static byte cmpByteMIN = Byte.MIN_VALUE; + static char cmpCharMAX = Character.MAX_VALUE; + static char cmpCharMIN = Character.MIN_VALUE; + static double cmpDoubleMAX= Double.MAX_VALUE; + static double cmpDoubleMIN= Double.MIN_VALUE; + static float cmpFloatMAX = Float.MAX_VALUE; + static float cmpFloatMIN = Float.MIN_VALUE; + static int cmpIntMAX = Integer.MAX_VALUE; + static int cmpIntMIN = Integer.MIN_VALUE; + static long cmpLongMAX = Long.MAX_VALUE; + static long cmpLongMIN = Long.MIN_VALUE; + static short cmpShortMAX = Short.MAX_VALUE; + static short cmpShortMIN = Short.MIN_VALUE; + + 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(equals002.SGNL_READY); + String instr = pipe.readln(); + log.display("breakpoint line"); // brkpLineNumber + instr = pipe.readln(); + if (instr.equals(equals002.SGNL_QUIT)) { + log.display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + + public static void voidValue() { + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java new file mode 100644 index 00000000000..213c8cb37b4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java @@ -0,0 +1,609 @@ +/* + * 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. + */ + + +/* + * @test + * + * @summary converted from VM Testbase nsk/jdi/VoidValue/hashCode/hashcode001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * VoidValue. + * The test checks up that a result of the method + * com.sun.jdi.VoidValue.hashCode() + * complies with its spec: + * public int hashCode() + * Returns the hash code value for this VoidValue. + * Returns: the hash code + * Overrides: hashCode in class java.lang.Object + * The test works as follows: + * A debugger program - nsk.jdi.VoidValue.hashCode.hashcode001; + * a debuggee program - nsk.jdi.VoidValue.hashCode.hashcode001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, + * 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 calls corresponding debuggee.VM methods to get + * needed data and compares the data got to the data expected. + * In case of mismatch 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.VoidValue.hashCode.hashcode001.hashcode001 + * nsk.jdi.VoidValue.hashCode.hashcode001.hashcode001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VoidValue.hashCode.hashcode001.hashcode001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + +package nsk.jdi.VoidValue.hashCode.hashcode001; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * VoidValue.
    + *
    + * The test checks up that results of the method
    + * com.sun.jdi.VoidValue.hashCode()
    + * complies with its spec.
    + *
    + * The cases for testing are as follows :
    + *
    + * when a gebuggee is suspended at a breakpoint
    + * set by a debugger,
    + * the debugger invokes debuggee's methods:
    + * void vdValue1(); void vdValue1(); void vdValue2();
    + * to form the follwing objects: Value returnvdValue1,
    + * Value returnvdValue2, and Value returnvdValue3;
    + *
    + * performs following casts:
    + * VoidValue vdValue1 = (VoidValue) returnvdValue1;
    + * VoidValue vdValue2 = (VoidValue) returnvdValue2;
    + * VoidValue vdValue3 = (VoidValue) returnvdValue3;
    + *
    + * and checks up that each of the following is true:
    + *
    + * vdValue1.hashCode() == vdValue2.hashCode()
    + * vdValue1.hashCode() == vdValue3.hashCode()
    + *
    + */ + +public class hashcode001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/VoidValue/hashCode/hashcode001", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + int result = run(argv, System.out); + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + return new hashcode001().runThis(argv, out); + } + + //-------------------------------------------------- log procedures + + //private static boolean verbMode = false; + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.VoidValue.hashCode.hashcode001.hashcode001a"; + + private String testedClassName = + "nsk.jdi.VoidValue.hashCode.hashcode001.Threadhashcode001a"; + + //====================================================== test program + //------------------------------------------------------ common section + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + + ReferenceType testedclass = null; + ThreadReference thread2 = null; + ThreadReference mainThread = null; + + static int testExitCode = PASSED; + + static final int returnCode0 = 0; + static final int returnCode1 = 1; + static final int returnCode2 = 2; + static final int returnCode3 = 3; + static final int returnCode4 = 4; + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + Debugee debuggee; + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); // *** tp + } else { + debuggee = binder.bindToDebugee(debuggeeName); // *** tp + } + + waitTime = argsHandler.getWaitTime(); + + + IOPipe pipe = new IOPipe(debuggee); + + debuggee.redirectStderr(out); + log2("setvalue003a debuggee launched"); + debuggee.resume(); + + String line = pipe.readln(); + if ((line == null) || !line.equals("ready")) { + log3("signal received is not 'ready' but: " + line); + return FAILED; + } else { + log2("'ready' recieved"); + } + + VirtualMachine vm = debuggee.VM(); + + //------------------------------------------------------ testing section + log1(" TESTING BEGINS"); + + for (int i = 0; ; i++) { + pipe.println("newcheck"); + line = pipe.readln(); + + if (line.equals("checkend")) { + log2(" : returned string is 'checkend'"); + break ; + } else if (!line.equals("checkready")) { + log3("ERROR: returned string is not 'checkready'"); + testExitCode = FAILED; + break ; + } + + log1("new check: #" + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + int expresult = returnCode0; + + eventRManager = vm.eventRequestManager(); + eventQueue = vm.eventQueue(); + + List allThreads = null; + ListIterator listIterator = null; + List classes = null; + + String threadName = "Thread2"; + + String breakpointMethod1 = "run"; + String bpLine1 = "breakpointLineNumber1"; + + BreakpointRequest breakpRequest1 = null; + + + label0: { + + log2("getting ThreadReference object"); + try { + allThreads = vm.allThreads(); + classes = vm.classesByName(testedClassName); + testedclass = (ReferenceType) classes.get(0); + } catch ( Exception e) { + log3("ERROR: Exception at very beginning !? : " + e); + expresult = returnCode1; + break label0; + } + + listIterator = allThreads.listIterator(); + for (;;) { + try { + thread2 = (ThreadReference) listIterator.next(); + if (thread2.name().equals(threadName)) + break ; + } catch ( NoSuchElementException e ) { + log3("ERROR: NoSuchElementException for listIterator.next()"); + log3("ERROR: NO THREAD2 ?????????!!!!!!!"); + expresult = returnCode1; + break label0; + } + } + + log2("setting up breakpoint"); + + breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); + if (breakpRequest1 == null) { + expresult = returnCode1; + break label0; + } + } + + label1: { + + if (expresult != returnCode0) + break label1; + + log2(" enabling breakpRequest1"); + breakpRequest1.enable(); + + log2(" forcing the main thread to leave synchronized block"); + pipe.println("continue"); + line = pipe.readln(); + if (!line.equals("docontinue")) { + log3("ERROR: returned string is not 'docontinue'"); + expresult = returnCode4; + break label1; + } + + log2(" getting a breakpoint event"); + expresult = breakpoint(); + if (expresult != returnCode0) + break label1; + + + Value returnvdValue1 = null; + Value returnvdValue2 = null; + Value returnvdValue3 = null; + List invokeMethods = null; + Method invokeMethod = null; + List argumentList = null; + + + invokeMethods = testedclass.methodsByName("vdValue1"); + invokeMethod = (Method) invokeMethods.get(0); + + argumentList = Collections.emptyList(); + + try { + log2(" 1st invoking hashcode001a.vdValue1(); no Exception expected"); + returnvdValue1 = thread2.invokeMethod(thread2, + invokeMethod, argumentList, 0); + log2(" 2nd invoking hashcode001a.vdValue1(); no Exception expected"); + returnvdValue2 = thread2.invokeMethod(thread2, + invokeMethod, argumentList, 0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + // invoking hashcode001a.vdValue2() + + invokeMethods = testedclass.methodsByName("vdValue2"); + invokeMethod = (Method) invokeMethods.get(0); + + try { + log2(" invoking hashcode001a.vdValue2(); no Exception expected"); + returnvdValue3 = thread2.invokeMethod(thread2, + invokeMethod, argumentList, 0); + } catch ( Exception e ) { + log3("ERROR: Exception: " + e); + expresult = returnCode1; + break label1; + } + + + VoidValue vdValue1 = null; + VoidValue vdValue2 = null; + VoidValue vdValue3 = null; + + try { + log2(" checking up cast: vdValue1 = (VoidValue) returnvdValue1; no Exception expected"); + vdValue1 = (VoidValue) returnvdValue1; + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException"); + expresult = returnCode1; + break label1; + } + + try { + log2(" checking up cast: vdValue2 = (VoidValue) returnvdValue2; no Exception expected"); + vdValue2 = (VoidValue) returnvdValue2; + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException"); + expresult = returnCode1; + break label1; + } + + try { + log2(" checking up cast: vdValue3 = (VoidValue) returnvdValue3; no Exception expected"); + vdValue3 = (VoidValue) returnvdValue3; + } catch ( ClassCastException e ) { + log3("ERROR : ClassCastException"); + expresult = returnCode1; + break label1; + } + + log2(" checking up: dValue1.hashCode() == vdValue2.hashCode()"); + if (vdValue1.hashCode() != vdValue2.hashCode() ) { + log3("ERROR: vdValue1.hashCode() != vdValue2.hashCode()"); + expresult = returnCode1; + } + log2(" checking up: dValue1.hashCode() == vdValue3.hashCode()"); + if (vdValue1.hashCode() != vdValue3.hashCode() ) { + log3("ERROR: vdValue1.hashCode() != vdValue3.hashCode()"); + expresult = returnCode1; + } + } + log2(" resuming the vm"); + vm.resume(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + log2(" the end of testing"); + if (expresult != returnCode0) + testExitCode = FAILED; + } + log1(" TESTING ENDS"); + + //-------------------------------------------------- test summary section + //------------------------------------------------- standard end section + + pipe.println("quit"); + log2("waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + int status = debuggee.getStatus(); + if (status != PASSED + PASS_BASE) { + log3("debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + + if (testExitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + + + /* + * private BreakpointRequest settingBreakpoint(String, String, String) + * + * It sets up a breakpoint within a given method at given line number + * for the thread2 only. + * Third parameter is required for any case in future debugging, as if. + * + * Return codes: + * = BreakpointRequest object in case of success + * = null in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( String methodName, + String bpLine, + String property) { + + log2("setting up a breakpoint: method: '" + methodName + "' line: " + bpLine ); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedclass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedclass.getValue(testedclass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread2); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + else + log2(" a breakpoint has been set up"); + + return breakpRequest; + } + + + /* + * private int breakpoint () + * + * It removes events from EventQueue until gets first BreakpointEvent. + * To get next EventSet value, it uses the method + * EventQueue.remove(int timeout) + * The timeout argument passed to the method, is "waitTime*60000". + * Note: the value of waitTime is set up with + * the method ArgumentHandler.getWaitTime() at the beginning of the test. + * + * Return codes: + * = returnCode0 - success; + * = returnCode2 - Exception when "eventSet = eventQueue.remove()" is executed + * = returnCode3 - default case when loop of processing an event, that is, + * an unspecified event was taken from the EventQueue + */ + + private int breakpoint () { + + int returnCode = returnCode0; + + log2(" waiting for BreakpointEvent"); + + labelBP: + for (;;) { + + log2(" new: eventSet = eventQueue.remove();"); + try { + eventSet = eventQueue.remove(waitTime*60000); + if (eventSet == null) { + log3("ERROR: timeout for waiting for a BreakpintEvent"); + returnCode = returnCode3; + break labelBP; + } + } catch ( Exception e ) { + log3("ERROR: Exception for eventSet = eventQueue.remove(); : " + e); + returnCode = 1; + break labelBP; + } + + if (eventSet != null) { + + log2(" : eventSet != null; size == " + eventSet.size()); + + EventIterator eIter = eventSet.eventIterator(); + Event ev = null; + + for (; eIter.hasNext(); ) { + + if (returnCode != returnCode0) + break; + + ev = eIter.nextEvent(); + + ll: for (int ifor =0; ; ifor++) { + + try { + switch (ifor) { + + case 0: AccessWatchpointEvent awe = (AccessWatchpointEvent) ev; + log2(" AccessWatchpointEvent removed"); + break ll; + case 1: BreakpointEvent be = (BreakpointEvent) ev; + log2(" BreakpointEvent removed"); + break labelBP; + case 2: ClassPrepareEvent cpe = (ClassPrepareEvent) ev; + log2(" ClassPreparEvent removed"); + break ll; + case 3: ClassUnloadEvent cue = (ClassUnloadEvent) ev; + log2(" ClassUnloadEvent removed"); + break ll; + case 4: ExceptionEvent ee = (ExceptionEvent) ev; + log2(" ExceptionEvent removed"); + break ll; + case 5: MethodEntryEvent mene = (MethodEntryEvent) ev; + log2(" MethodEntryEvent removed"); + break ll; + case 6: MethodExitEvent mexe = (MethodExitEvent) ev; + log2(" MethodExiEvent removed"); + break ll; + case 7: ModificationWatchpointEvent mwe = (ModificationWatchpointEvent) ev; + log2(" ModificationWatchpointEvent removed"); + break ll; + case 8: StepEvent se = (StepEvent) ev; + log2(" StepEvent removed"); + break ll; + case 9: ThreadDeathEvent tde = (ThreadDeathEvent) ev; + log2(" ThreadDeathEvent removed"); + break ll; + case 10: ThreadStartEvent tse = (ThreadStartEvent) ev; + log2(" ThreadStartEvent removed"); + break ll; + case 11: VMDeathEvent vmde = (VMDeathEvent) ev; + log2(" VMDeathEvent removed"); + break ll; + case 12: VMStartEvent vmse = (VMStartEvent) ev; + log2(" VMStartEvent removed"); + break ll; + case 13: WatchpointEvent we = (WatchpointEvent) ev; + log2(" WatchpointEvent removed"); + break ll; + + default: log3("ERROR: default case for casting event"); + returnCode = returnCode3; + break ll; + } // switch + } catch ( ClassCastException e ) { + } // try + } // ll: for (int ifor =0; ; ifor++) + } // for (; ev.hasNext(); ) + } + } + if (returnCode == returnCode0) + log2(" : eventSet == null: EventQueue is empty"); + + return returnCode; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001a.java new file mode 100644 index 00000000000..5cee04fa40a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001a.java @@ -0,0 +1,189 @@ +/* + * 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.VoidValue.hashCode.hashcode001; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +/** + * This class is used as debuggee application for the hashcode001 JDI test. + */ + +public class hashcode001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //-------------------------------------------------- log procedures + + static boolean verbMode = false; + + public static void log1(String message) { + if (verbMode) + System.err.println("**> mainThread: " + message); + } + public static void log2(String message) { + if (verbMode) + System.err.println("**> " + message); + } + + private static void logErr(String message) { + if (verbMode) + System.err.println("!!**> mainThread: " + message); + } + + //====================================================== test program + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + for (int i=0; i " + 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() { + + BreakpointRequest brkp = debuggee.setBreakpoint(debuggeeClass, + tostring001a.brkpMethodName, + tostring001a.brkpLineNumber); + debuggee.resume(); + + debuggee.sendSignal(SIGNAL_GO); + Event event = null; + + // waiting the breakpoint event + try { + event = debuggee.waitingEvent(brkp, waitTime); + } catch (InterruptedException e) { + throw new Failure("unexpected InterruptedException while waiting for Breakpoint event"); + } + if (!(event instanceof BreakpointEvent)) { + debuggee.resume(); + throw new Failure("BreakpointEvent didn't arrive"); + } + + ThreadReference thread = ((BreakpointEvent)event).thread(); + List params = new Vector(); + ClassType testedClass = (ClassType)debuggeeClass; + ObjectReference testedObject = null; + + // Finding of debuggee's class constructor + Method ctor = debuggee.methodByName(debuggeeClass, ""); + + try { + testedObject = testedClass.newInstance(thread, ctor, params, 0); + } catch (Exception e) { + throw new Failure("unexpected " + e + " when invoking debuggee's constructor"); + } + + display("Checking toString() method for debuggee's void value methods..."); + + // Check all methods from debuggee + for (int i = 0; i < checkedMethods.length-1; i++) { + + VoidValue voidValue = null; + Method method; + + method = debuggee.methodByName(debuggeeClass, checkedMethods[i]); + try { + if (method.isStatic()) { + voidValue = (VoidValue) testedClass.invokeMethod(thread, method, params, 0); + } else { + voidValue = (VoidValue) testedObject.invokeMethod(thread, method, params, 0); + } + + String str = voidValue.toString(); + if (str == null) { + complain("toString() returns null for VoidValue of debugges's method: " + checkedMethods[i]); + exitStatus = Consts.TEST_FAILED; + } else if (str.length() == 0) { + complain("toString() returns empty string for VoidValue of debugges's method: " + checkedMethods[i]); + exitStatus = Consts.TEST_FAILED; + } else { + display("toString() returns for VoidValue of debugges's method " + checkedMethods[i] + " : " + str); + } + } catch(Exception e) { + complain("Unexpected " + e + " when invoking debuggee's method: " + checkedMethods[i]); + exitStatus = Consts.TEST_FAILED; + } + + } + + display("Checking of debuggee's void value methods completed!"); + debuggee.resume(); + } + + //--------------------------------------------------------- test specific methods +} +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java new file mode 100644 index 00000000000..dd5ef890b61 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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/VoidValue/toString/tostring001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for public toString() method of an implementing class of + * com.sun.jdi.VoidValue interface. + * The test checks an assertion: + * In conformity with the contract for java.lang.Object.toString(), + * the overrided method returns representing non-empty string for + * for a VoidValue object returned by an invocation of a debuggee's + * void type method. + * COMMENTS: + * The test is aimed to increase jdi source code coverage and checks + * the code which was not yet covered by previous tests for VoidValue + * interface. The coverage analysis was done for jdk1.4.0-b92 build. + * Test was fixed according to test bug: + * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming + * - handling VMStartEvent was removed from the debugger part of the test + * Test fixed according to test bug: + * 4798088 TEST_BUG: setBreakpoint() method depends of the locations implementation + * - using standard Debugee.setBreakpoint() method + * - adjusting source line numbers used for setting breakpoint + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.VoidValue.toString.tostring001 + * nsk.jdi.VoidValue.toString.tostring001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.VoidValue.toString.tostring001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001a.java new file mode 100644 index 00000000000..4a8c1be9a59 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001a.java @@ -0,0 +1,108 @@ +/* + * 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.VoidValue.toString; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * The debugged application of the test. + */ +public class tostring001a { + + //------------------------------------------------------- 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("debuger's <" + signal + "> signal received."); + } + + //------------------------------------------------------ mutable common fields + + //------------------------------------------------------ test specific fields + + public final static String brkpMethodName = "main"; + public final static int brkpLineNumber = 81; + + //------------------------------------------------------ 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); + try { + pipe.println(tostring001.SIGNAL_READY); + receiveSignal(tostring001.SIGNAL_GO); + log.display("breakpoint line"); + receiveSignal(tostring001.SIGNAL_QUIT); // brkpLineNumber + display("completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } catch (Failure e) { + log.complain(e.getMessage()); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } + } + + //--------------------------------------------------------- test specific methods + + void Mv() {}; + + static void MvS() {}; + strictfp void MvI() {}; + synchronized void MvY() {}; + public void MvU() {}; + protected void MvR() {}; + private void MvP() {}; + + public static void MvSM() {}; + private strictfp void MvIM() {}; + static synchronized void MvYM() {}; + public final void MvPM() {}; + +} + +//--------------------------------------------------------- test specific classes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001.java new file mode 100644 index 00000000000..adfd1d56e2a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001.java @@ -0,0 +1,196 @@ +/* + * 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.WatchpointEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointEvent. + * + * The test checks that results of methods in the interface + * com.sun.jdi.WatchpointEvent + * complies with its spec. + * + * The test checks up on the following assertion: + * The number of WatchpointEvents received is equal to + * the number of WatchpointRequestsset up by a debugger. + * Tested are both Access and Modification WatchpointEvents. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee an object foo of CheckedClass and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger: + * - set up enabled WatchpointRequests for all fields, + * - resumes the debuggee, and + * - waiting for all expected events to receive. + */ + +public class wevent001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointEvent._itself_.wevent001a"; + return new wevent001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointEvent._itself_.CheckedClass"; + + volatile int mwEventsCount = 0; + volatile int awEventsCount = 0; + volatile int requestsCount = 0; + + protected void testRun() { + + if ( !vm.canWatchFieldModification() ) { + display("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + ReferenceType refType = null; + List fields = null; + ListIterator li = null; + Field field = null; + + ModificationWatchpointRequest mwRequest = null; + AccessWatchpointRequest awRequest = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + refType = (ReferenceType) vm.classesByName(testedClassName).get(0); + fields = refType.fields(); + li = fields.listIterator(); + + display("......setting up WatchpointRequests"); + while (li.hasNext()) { + field = (Field) li.next(); + if (!field.isSynthetic()) { + mwRequest = eventRManager.createModificationWatchpointRequest(field); + mwRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE); + mwRequest.enable(); + + awRequest = eventRManager.createAccessWatchpointRequest(field); + awRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE); + awRequest.enable(); + + requestsCount++; + } + } + display(" # Requests set up : " + requestsCount); + + eventHandler.addListener( + new EventHandler.EventListener() { + public boolean eventReceived(Event event) { + if (event instanceof ModificationWatchpointEvent) { + display("Received ModificationWatchpointEvent "); + mwEventsCount++; + return true; + } else if (event instanceof AccessWatchpointEvent) { + display("Received AccessWatchpointEvent "); + awEventsCount++; + return true; + } + if (gotAllRequestedEvents()) { + synchronized (eventHandler) { + eventHandler.notifyAll(); + } + } + return false; + } + } + ); + + display("......waiting for WatchpointEvents"); + vm.resume(); + + long timeToFinish = System.currentTimeMillis() + waitTime; + long timeLeft = waitTime; + while (!gotAllRequestedEvents() && timeLeft > 0) { + try { + synchronized (eventHandler) { + eventHandler.wait(timeLeft); + timeLeft = timeToFinish - System.currentTimeMillis(); + } + } catch (InterruptedException e) { + setFailedStatus("InterruptedException was thrown while waiting for the events."); + throw new Failure(e); + } + } + + display("......checking up on numbers"); + if ( mwEventsCount != requestsCount ) { + setFailedStatus("ERROR: # ModificationWatchpointEvents != # Requests :: " + + mwEventsCount + " != " + requestsCount); + } + if ( awEventsCount != requestsCount ) { + setFailedStatus("ERROR: # AccessWatchpointEvents != # Requests :: " + + awEventsCount + " != " + requestsCount); + } + + display(" # mwEventsCount == " + mwEventsCount); + display(" # awEventsCount == " + awEventsCount); + + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + boolean gotAllRequestedEvents() { + return (mwEventsCount >= requestsCount && awEventsCount >= requestsCount); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001/TestDescription.java new file mode 100644 index 00000000000..8484ca54077 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001/TestDescription.java @@ -0,0 +1,72 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/WatchpointEvent/_itself_/wevent001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointEvent. + * The test checks up on the following assertion: + * The number of WatchpointEvents received is equal to + * the number of WatchpointRequestsset up by a debugger. + * Tested are both Access and Modification WatchpointEvents. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointEvent._itself_.wevent001; + * the debuggee program - nsk.jdi.WatchpointEvent._itself_.wevent001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * class CheckedClass being used in the debuggee + * has been taken from the test + * nsk.jdi.WatchpointEvent.valueCurrent.valuecur001 + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointEvent._itself_.wevent001 + * nsk.jdi.WatchpointEvent._itself_.wevent001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointEvent._itself_.wevent001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001a.java new file mode 100644 index 00000000000..ceaacf9e672 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001a.java @@ -0,0 +1,300 @@ +/* + * 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.WatchpointEvent._itself_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the wevent001 JDI test. + */ + +public class wevent001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + CheckedClass foo = new CheckedClass(); +// foo.run(); + methodForCommunication(); + foo.run(); + + //------------------------------------------------- standard end section + + default: + instruction = end; + methodForCommunication(); + break label0; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class CheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + class Class implements Inter {} + Class X0, X1[], X2[][]; + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + void run() { + + z0 = true; + b0 = 0; + c0 = 0; + d0 = 0; + f0 = 0; + i0 = 0; + l0 = 0; + s0 = 0; + + lS0 = 0; + lP0 = 0; + lU0 = 0; + lR0 = 0; + lT0 = 0; + lV0 = 0; + + z1 = new boolean[] {z0}; + z2 = new boolean[][] {z1}; + b1 = new byte[] {b0}; + b2 = new byte[][] {b1}; + c1 = new char[] {c0}; + c2 = new char[][] {c1}; + d1 = new double[] {d0}; + d2 = new double[][] {d1}; + f1 = new float[] {f0}; + f2 = new float[][] {f1}; + i1 = new int[] {i0}; + i2 = new int[][] {i1}; + l1 = new long[] {l0}; + l2 = new long[][] {l1}; + s1 = new short[] {s0}; + s2 = new short[][] {s1}; + + lS1 = new long[] {lS0}; + lS2 = new long[][] {lS1}; + lP1 = new long[] {lP0}; + lP2 = new long[][] {lP1}; + lU1 = new long[] {lU0}; + lU2 = new long[][] {lU1}; + lR1 = new long[] {lR0}; + lR2 = new long[][] {lR1}; + lT1 = new long[] {lT0}; + lT2 = new long[][] {lT1}; + lV1 = new long[] {lV0}; + lV2 = new long[][] {lV1}; + + X0 = new Class(); + X1 = new Class[] {X0}; + X2 = new Class[][] {X1}; + Z0 = new Boolean(true); + Z1 = new Boolean[] {Z0}; + Z2 = new Boolean[][] {Z1}; + B0 = new Byte(java.lang.Byte.MIN_VALUE); + B1 = new Byte[] {B0}; + B2 = new Byte[][] {B1}; + C0 = new Character(java.lang.Character.MIN_VALUE); + C1 = new Character[] {C0}; + C2 = new Character[][]{C1}; + D0 = new Double(java.lang.Double.MIN_VALUE); + D1 = new Double[] {D0}; + D2 = new Double[][] {D1}; + F0 = new Float(java.lang.Float.MIN_VALUE); + F1 = new Float[] {F0}; + F2 = new Float[][] {F1}; + I0 = new Integer(java.lang.Integer.MIN_VALUE); + I1 = new Integer[] {I0}; + I2 = new Integer[][] {I1}; + L0 = new Long(java.lang.Long.MIN_VALUE); + L1 = new Long[] {L0}; + L2 = new Long[][] {L1}; + S0 = new Short(java.lang.Short.MIN_VALUE); + S1 = new Short[] {S0}; + S2 = new Short[][] {S1}; + W0 = new String(); + W1 = new String[] {W0}; + W2 = new String[][] {W1}; + O0 = new Object(); + O1 = new Object[] {O0}; + O2 = new Object[][] {O1}; + + LS0 = new Long(java.lang.Long.MAX_VALUE); + LS1 = new Long[] {LS0}; + LS2 = new Long[][] {LS1}; + LP0 = new Long(java.lang.Long.MAX_VALUE); + LP1 = new Long[] {LP0}; + LP2 = new Long[][] {LP1}; + LU0 = new Long(java.lang.Long.MAX_VALUE); + LU1 = new Long[] {LU0}; + LU2 = new Long[][] {LU1}; + LR0 = new Long(java.lang.Long.MAX_VALUE); + LR1 = new Long[] {LR0}; + LR2 = new Long[][] {LR1}; + LT0 = new Long(java.lang.Long.MAX_VALUE); + LT1 = new Long[] {LT0}; + LT2 = new Long[][] {LT1}; + LV0 = new Long(java.lang.Long.MAX_VALUE); + LV1 = new Long[] {LV0}; + LV2 = new Long[][] {LV1}; + + E0 = new Class(); + E1 = new Inter[] {E0}; + E2 = new Inter[][] {E1}; + ES0 = new Class(); + ES1 = new Inter[] {ES0}; + ES2 = new Inter[][] {ES1}; + EP0 = new Class(); + EP1 = new Inter[] {EP0}; + EP2 = new Inter[][] {EP1}; + EU0 = new Class(); + EU1 = new Inter[] {EU0}; + EU2 = new Inter[][] {EU1}; + ER0 = new Class(); + ER1 = new Inter[] {ER0}; + ER2 = new Inter[][] {ER1}; + ET0 = new Class(); + ET1 = new Inter[] {ET0}; + ET2 = new Inter[][] {ET1}; + EV0 = new Class(); + EV1 = new Inter[] {EV0}; + EV2 = new Inter[][] {EV1}; + + m(z2); m(b2); m(c2); m(d2); m(f2); m(i2); m(l2); m(s2); + + m(lS2); m(lP2); m(lU2); m(lR2); m(lT2); m(lV2); + + m(X2); m(Z2); m(B2); m(C2); m(D2); m(F2); m(I2); m(S2); m(W2); m(O2); + + m(LS2); m(LP2); m(LU2); m(LR2); m(LT2); m(LV2); + + m(X2); m(E2); m(ES2); m(EP2); m(EU2); m(ER2); m(ET2); m(EV2); + + } + + void m(Object obj) { + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001.java new file mode 100644 index 00000000000..f60ea00bca1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001.java @@ -0,0 +1,327 @@ +/* + * 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.WatchpointEvent.field; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class field001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String DEBUGGEE_NAME = "nsk.jdi.WatchpointEvent.field.field001a"; + static final String CHECKED_CLASS_NAME = "nsk.jdi.WatchpointEvent.field.CheckedClass"; + + static final int EXPECTED_ACCESS_EVENTS = field001a.ACCESS_COUNT; + static final int EXPECTED_MODIFICATION_EVENTS = field001a.MODIFICATIONS_COUNT; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ReferenceType rType; + static private WatchpointRequest wpRequest; + static private List fieldsList; + + static private volatile boolean testFailed; + static private volatile boolean done; + static private volatile int requestsCount, awpEventsCount, mwpEventsCount; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + done = false; + requestsCount = 0; + awpEventsCount = 0; + mwpEventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "field001a >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // check for debuggee's capabilities + if (!debuggee.VM().canWatchFieldAccess()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field access"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return field001.PASSED; + } + + if (!debuggee.VM().canWatchFieldModification()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field modification"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return field001.PASSED; + } + + // catch all exceptions while testing + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (command == null || !command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + if ((rType = debuggee.classByName(CHECKED_CLASS_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + CHECKED_CLASS_NAME); + } + + // create event requests + log.display("Creating requests for WatchpointEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + Iterator fieldsIter; + try { + fieldsList = rType.fields(); + fieldsIter = fieldsList.iterator(); + } catch (ClassNotPreparedException e) { + throw new Failure( "TEST_BUG: " + rType.name() + " is not prepared"); + } + while (fieldsIter.hasNext()) { + Field refField = (Field)fieldsIter.next(); + if ((wpRequest = erManager.createAccessWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create AccessWatchpointRequest"); + } else { + log.display("AccessWatchpointRequest for field " + refField.name() + " created"); + wpRequest.enable(); + } + if ((wpRequest = erManager.createModificationWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create ModificationWatchpointRequest"); + } else { + log.display("ModificationWatchpointRequest for field " + refField.name() + " created"); + wpRequest.enable(); + } + requestsCount++; + } + log.display("Created total " + requestsCount + " WatchpointRequests"); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + // handle events until all events generated and received + while (!(done + && awpEventsCount >= EXPECTED_ACCESS_EVENTS + && mwpEventsCount >= EXPECTED_MODIFICATION_EVENTS)) { + + eventSet = null; + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + + if (eventSet == null) + continue; + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); +// log.display("Event received: " + event); + + // handle WatchpointEvent + if (event instanceof WatchpointEvent) { + WatchpointEvent castedEvent = (WatchpointEvent)event; + Field evField = castedEvent.field(); + Field evField1 = castedEvent.field(); + + if (event instanceof AccessWatchpointEvent) { + awpEventsCount++; + log.display("AccessWatchpointEvent received for " + evField.name()); + } else if (event instanceof ModificationWatchpointEvent) { + mwpEventsCount++; + log.display("ModificationWatchpointEvent received for " + evField.name()); + } + + if (evField == null) { + log.complain("FAILURE 1: WatchpointEvent.field() returns null"); + testFailed = true; + } else if (evField != evField1) { + log.complain("FAILURE 2: method fieldd() returns inconsistent results for " + + evField.name() + "\nevField: " + evField + " ; evField1: " + evField1); + testFailed = true; + } else if (!(fieldsList.contains(evField))) { + log.complain("FAILURE 3: Watchpoint.field() returns unknown field"); + testFailed = true; + } else { + log.display("WatchpointEvent received for " + evField.name()); + } + } + } + + // resume each hamdled event set + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for confirmation from debugee + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command == null || !command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // notify EventHandler that all events generated + done = true; + + // wait for all expected events received + log.display("Waiting for all expected events received"); + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check for all expected events received + if (awpEventsCount == 0) { + log.complain("FAILURE 4: No AccessWatchpointEvents were received"); + testFailed = true; + } else if (awpEventsCount < EXPECTED_ACCESS_EVENTS) { + log.complain("FAILURE 4: Too few AccessWatchpointEvents were received: " + + (EXPECTED_ACCESS_EVENTS - awpEventsCount) + " not received"); + testFailed = true; + } else if (awpEventsCount > EXPECTED_ACCESS_EVENTS) { + log.complain("FAILURE 4: Too many AccessWatchpointEvents were received: " + + "extra " + (awpEventsCount - EXPECTED_ACCESS_EVENTS) + " received"); + testFailed = true; + } else { + log.display("All expected AccessWatchpointEvents were received: " + + awpEventsCount + " events"); + } + if (mwpEventsCount == 0) { + log.complain("FAILURE 4: No ModificationWatchpointEvents were received"); + testFailed = true; + } else if (mwpEventsCount < EXPECTED_MODIFICATION_EVENTS) { + log.complain("FAILURE 4: Too few ModificationWatchpointEvents were received: " + + (EXPECTED_MODIFICATION_EVENTS - mwpEventsCount) + " not received"); + testFailed = true; + } else if (mwpEventsCount > EXPECTED_MODIFICATION_EVENTS) { + log.complain("FAILURE 4: Too many ModificationWatchpointEvents were received: " + + "extra " + (mwpEventsCount - EXPECTED_MODIFICATION_EVENTS) + " received"); + testFailed = true; + } else { + log.display("All expected ModificationWatchpointEvents were received: " + + mwpEventsCount + " events"); + } + + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001/TestDescription.java new file mode 100644 index 00000000000..f4c1884f8d4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001/TestDescription.java @@ -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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/WatchpointEvent/field/field001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.WatchpointEvent.field() method. + * The test checks the following assertion: + * Field reference returned by WatchpointEvent.field() + * exists in the list of fields returned by com.sun.jdi.ReferenceType.fields() + * method for . + * A debugger class - nsk.jdi.WatchpointEvent.field.field001 ; + * a debuggee class - nsk.jdi.WatchpointEvent.field.field001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates WatchpointRequests to the fields defined + * in checked class. + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee initializes its + * fields. + * The debugger switches to to listen the event during the + * time specified by parameter. Then debugger shuts down debuggee + * by command. + * If debugger receives WatchpointEvent, it checks if reference returned by + * WatchpointEvent.field() exists in the list of fields of the class loaded + * in the debuggee. + * The test also fails if no WatchpointEvent was received. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointEvent.field.field001 + * nsk.jdi.WatchpointEvent.field.field001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointEvent.field.field001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001a.java new file mode 100644 index 00000000000..9df72d45d71 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/field/field001a.java @@ -0,0 +1,219 @@ +/* + * 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.WatchpointEvent.field; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class field001a { + + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final int ACCESS_COUNT = 76; + static final int MODIFICATIONS_COUNT = ACCESS_COUNT; + + public static void main(String args[]) { + System.exit(JCK_STATUS_BASE + run(args)); + } + + static int run( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // create instance of checked class + CheckedClass foo = new CheckedClass(); + + // notify debugger that debuggee started + pipe.println(COMMAND_READY); + + // wait for command GO from debugger + String command = pipe.readln(); + if (command.equals(COMMAND_QUIT)) { + return PASSED; + } + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + + // perform actions + foo.run(); + + // notify debugger that the command done + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} + +// class for checking +class CheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + class Class {} + Class X0, X1[], X2[][]; + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + public void run() { + + z1 = new boolean[] {z0}; + z2 = new boolean[][] {z1}; + b1 = new byte[] {b0}; + b2 = new byte[][] {b1}; + c1 = new char[] {c0}; + c2 = new char[][] {c1}; + d1 = new double[] {d0}; + d2 = new double[][] {d1}; + f1 = new float[] {f0}; + f2 = new float[][] {f1}; + i1 = new int[] {i0}; + i2 = new int[][] {i1}; + l1 = new long[] {l0}; + l2 = new long[][] {l1}; + s1 = new short[] {s0}; + s2 = new short[][] {s1}; + + lS1 = new long[] {lS0}; + lS2 = new long[][] {lS1}; + lP1 = new long[] {lP0}; + lP2 = new long[][] {lP1}; + lU1 = new long[] {lU0}; + lU2 = new long[][] {lU1}; + lR1 = new long[] {lR0}; + lR2 = new long[][] {lR1}; + lT1 = new long[] {lT0}; + lT2 = new long[][] {lT1}; + lV1 = new long[] {lV0}; + lV2 = new long[][] {lV1}; + + X1 = new Class[] {X0}; + X2 = new Class[][] {X1}; + Z1 = new Boolean[] {Z0}; + Z2 = new Boolean[][] {Z1}; + B1 = new Byte[] {B0}; + B2 = new Byte[][] {B1}; + C1 = new Character[] {C0}; + C2 = new Character[][]{C1}; + D1 = new Double[] {D0}; + D2 = new Double[][] {D1}; + F1 = new Float[] {F0}; + F2 = new Float[][] {F1}; + I1 = new Integer[] {I0}; + I2 = new Integer[][] {I1}; + L1 = new Long[] {L0}; + L2 = new Long[][] {L1}; + S1 = new Short[] {S0}; + S2 = new Short[][] {S1}; + W1 = new String[] {W0}; + W2 = new String[][] {W1}; + O1 = new Object[] {O0}; + O2 = new Object[][] {O1}; + + LS1 = new Long[] {LS0}; + LS2 = new Long[][] {LS1}; + LP1 = new Long[] {LP0}; + LP2 = new Long[][] {LP1}; + LU1 = new Long[] {LU0}; + LU2 = new Long[][] {LU1}; + LR1 = new Long[] {LR0}; + LR2 = new Long[][] {LR1}; + LT1 = new Long[] {LT0}; + LT2 = new Long[][] {LT1}; + LV1 = new Long[] {LV0}; + LV2 = new Long[][] {LV1}; + + E1 = new Inter[] {E0}; + E2 = new Inter[][] {E1}; + ES1 = new Inter[] {ES0}; + ES2 = new Inter[][] {ES1}; + EP1 = new Inter[] {EP0}; + EP2 = new Inter[][] {EP1}; + EU1 = new Inter[] {EU0}; + EU2 = new Inter[][] {EU1}; + ER1 = new Inter[] {ER0}; + ER2 = new Inter[][] {ER1}; + ET1 = new Inter[] {ET0}; + ET2 = new Inter[][] {ET1}; + EV1 = new Inter[] {EV0}; + EV2 = new Inter[][] {EV1}; + + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001.java new file mode 100644 index 00000000000..ab86e0dc272 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001.java @@ -0,0 +1,428 @@ +/* + * 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.WatchpointEvent.object; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class object001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final int EXPECTED_ACCESS_EVENTS = object001a.ACCESS_COUNT; + static final int EXPECTED_MODIFICATION_EVENTS = object001a.MODIFICATIONS_COUNT; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String DEBUGGEE_NAME = "nsk.jdi.WatchpointEvent.object.object001a"; + static final String CHECKED_CLASS_NAME = "nsk.jdi.WatchpointEvent.object.CheckedClass"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private WatchpointRequest checkedRequest; + static private ObjectReference checkedObject; +// static private Method checkedMethod; +// static private LocalVariable checkedVariable; + static private ReferenceType checkedClass; + static private ReferenceType debuggeeClass; + static private ThreadReference checkedThread; +// static private Location checkedLocation; +// static private StackFrame checkedFrame; + + static private List fieldsList; + + static private volatile boolean testFailed; + static private volatile boolean done; + static private volatile int requestsCount, awpEventsCount, mwpEventsCount; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + done = false; + requestsCount = 0; + awpEventsCount = 0; + mwpEventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + //launch debugee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "object001a >"); + + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // check debuggee's capabilities + if (!debuggee.VM().canWatchFieldAccess()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field access"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return PASSED; + } + + if (!debuggee.VM().canWatchFieldModification()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field modification"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return PASSED; + } + + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (command == null || !command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors + log.display("Getting loaded classes in debuggee"); + if ((debuggeeClass = debuggee.classByName(DEBUGGEE_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + DEBUGGEE_NAME); + } + if ((checkedClass = debuggee.classByName(CHECKED_CLASS_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + CHECKED_CLASS_NAME); + } + + log.display("Getting reference to
    thread"); + Iterator threadIterator = vm.allThreads().iterator(); + while (threadIterator.hasNext()) { + ThreadReference curThread = (ThreadReference) threadIterator.next(); + if (curThread.name().equals("main")) { + checkedThread = curThread; + } + } + if (checkedThread == null) { + throw new Failure("TEST BUG: unable to find reference to
    thread"); + } + + // get object of checked class + log.display("Getting object of checked class"); + Field fooField = debuggeeClass.fieldByName("foo"); + if (fooField == null) { + throw new Failure("TEST BUG: unable to find field "); + } + try { + checkedObject = (ObjectReference)debuggeeClass.getValue(fooField); + } catch (Exception e) { + log.complain("TEST BUG: Exception while trying to get value of field : " + e.getMessage()); + e.printStackTrace(out); + testFailed = true; + } + if (checkedObject == null) { + log.complain("TEST BUG: unable to get value of field "); + testFailed = true; + } + + // create events requests + log.display("Creating requests for WatchpointEvent"); + Iterator fieldsIter; + try { + fieldsList = checkedClass.fields(); + fieldsIter = fieldsList.iterator(); + } catch (ClassNotPreparedException e) { + throw new Failure( "TEST_BUG: " + checkedClass.name() + " is not prepared"); + } + while (fieldsIter.hasNext()) { + Field refField = (Field)fieldsIter.next(); + if ((checkedRequest = erManager.createAccessWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create AccessWatchpointRequest"); + } else { + log.display("AccessWatchpointRequest for field " + refField.name() + " created"); + checkedRequest.enable(); + } + if ((checkedRequest = erManager.createModificationWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create ModificationWatchpointRequest"); + } else { + log.display("ModificationWatchpointRequest for field " + refField.name() + " created"); + checkedRequest.enable(); + } + requestsCount++; + } + log.display("Created total " + requestsCount + " WatchpointRequests"); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + // handle events until all expected events generated and received + while (!(done + && awpEventsCount >= EXPECTED_ACCESS_EVENTS + && mwpEventsCount >= EXPECTED_MODIFICATION_EVENTS)) { + + eventSet = null; + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + + if (eventSet == null) + continue; + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + +/* + // handle BreakpointEvent + if (event instanceof BreakpointEvent) { + + BreakpointEvent castedEvent = (BreakpointEvent) event; + ThreadReference eventThread = castedEvent.thread(); + + log.complain("BreakpointEvent is received in thread " + eventThread.name()); + + if (!(checkedThread.equals(eventThread))) { + log.complain("FAILURE 3: eventThread is not equal to checked thread"); + testFailed = true; + } + + log.display("Getting reference to stack frame"); + try { + checkedFrame = eventThread.frame(0); + } catch (Exception e) { + log.complain("TEST BUG: Exception while trying to get reference stack frame: " + e.getMessage()); + e.printStackTrace(out); + testFailed = true; + } + + log.display("Getting reference to <_object001a> variable"); + try { + checkedVariable = checkedFrame.visibleVariableByName("_object001a"); + } catch (Exception e) { + log.complain("TEST BUG: Exception while trying to get reference to <_object001a> variable: " + e.getMessage()); + e.printStackTrace(out); + testFailed = true; + } + if (checkedVariable == null) { + log.complain("TEST BUG: unable to find reference to <_object001a> variable"); + testFailed = true; + } + + log.display("Getting value of <_object001a> variable"); + try { + checkedObject = (ObjectReference)checkedFrame.getValue(checkedVariable); + } catch (Exception e) { + log.complain("TEST BUG: Exception while trying to get value of <_object001a> variable: " + e.getMessage()); + e.printStackTrace(out); + testFailed = true; + } + if (checkedObject == null) { + log.complain("TEST BUG: unable to get value of <_object001a> variable"); + testFailed = true; + } + + } +*/ + + // handle WatchpointEvent + if (event instanceof WatchpointEvent) { + WatchpointEvent castedEvent = (WatchpointEvent)event; + Value evValue = castedEvent.valueCurrent(); + Field evField = castedEvent.field(); + ObjectReference evObject = castedEvent.object(); + + if (event instanceof AccessWatchpointEvent) { + awpEventsCount++; + log.display("AccessWatchpointEvent received for " + evField.name()); + } else if (event instanceof ModificationWatchpointEvent) { + mwpEventsCount++; + log.display("ModificationWatchpointEvent received for " + evField.name()); + } + + if (castedEvent.field().isStatic()) { + if (evObject != null) { + object001.log.complain("FAILURE 1: WatchpointEvent.object() returns not null for static field"); + testFailed = true; + } else { + object001.log.display("WatchpointEvent received for static field " + castedEvent.field().name()); + } + } else { + if (evObject == null) { + object001.log.complain("FAILURE 2: WatchpointEvent.object() returns null for instance field"); + testFailed = true; + } else { + object001.log.display("WatchpointEvent received for instance field " + castedEvent.field().name()); + if (checkedObject == null) { + object001.log.complain("FAILURE 3: BreakpointEvent was not received prior to WatchpointEvent"); + testFailed = true; + } else if (!castedEvent.object().equals(checkedObject)) { + object001.log.complain("FAILURE 3: WatchpointEvent.object() does not equal to checked object"); + testFailed = true; + } + } + } + } + } + // resume each handled event set + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for confirmation from debugee + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command == null || !command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // notify EventHandler that all events generated + done = true; + + // wait for all expected events received + log.display("Waiting for all expected events received"); + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + + // check for all expected events received + if (awpEventsCount == 0) { + log.complain("FAILURE 4: No AccessWatchpointEvents were received"); + testFailed = true; + } else if (awpEventsCount < EXPECTED_ACCESS_EVENTS) { + log.complain("FAILURE 4: Too few AccessWatchpointEvents were received: " + + (EXPECTED_ACCESS_EVENTS - awpEventsCount) + " not received"); + testFailed = true; + } else if (awpEventsCount > EXPECTED_ACCESS_EVENTS) { + log.complain("FAILURE 4: Too many AccessWatchpointEvents were received: " + + "extra " + (awpEventsCount - EXPECTED_ACCESS_EVENTS) + " received"); + testFailed = true; + } else { + log.display("All expected AccessWatchpointEvents were received: " + + awpEventsCount + " events"); + } + if (mwpEventsCount == 0) { + log.complain("FAILURE 4: No ModificationWatchpointEvents were received"); + testFailed = true; + } else if (mwpEventsCount < EXPECTED_MODIFICATION_EVENTS) { + log.complain("FAILURE 4: Too few ModificationWatchpointEvents were received: " + + (EXPECTED_MODIFICATION_EVENTS - mwpEventsCount) + " not received"); + testFailed = true; + } else if (mwpEventsCount > EXPECTED_MODIFICATION_EVENTS) { + log.complain("FAILURE 4: Too many ModificationWatchpointEvents were received: " + + "extra " + (mwpEventsCount - EXPECTED_MODIFICATION_EVENTS) + " received"); + testFailed = true; + } else { + log.display("All expected ModificationWatchpointEvents were received: " + + mwpEventsCount + " events"); + } + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001/TestDescription.java new file mode 100644 index 00000000000..b2793827bd9 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/WatchpointEvent/object/object001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.WatchpointEvent.object() method. + * The test checks the following assertion: + * method WatchpointEvent.object() returns + * correct ObjectReference for instance field and + * null for static field. + * A debugger class - nsk.jdi.WatchpointEvent.object.object001 ; + * a debuggee class - nsk.jdi.WatchpointEvent.object.object001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates WatchpointRequests to the fields defined + * in checked class. + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee initializes its + * fields and sends command . + * The debugger switches to to listen the event during the + * time specified by parameter. Finally debugger shuts down debuggee + * by command. + * If debugger receives WatchpointEvent, it checks the assertion of the test. + * The test also fails if no WatchpointEvent was received. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointEvent.object.object001 + * nsk.jdi.WatchpointEvent.object.object001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointEvent.object.object001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001a.java new file mode 100644 index 00000000000..87dc289cbeb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/object/object001a.java @@ -0,0 +1,248 @@ +/* + * 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.WatchpointEvent.object; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class object001a { + + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + +// public static final int BREAKPOINT_LINE_NUMBER = 75; + + static final int ACCESS_COUNT = 76; + static final int MODIFICATIONS_COUNT = 100; + + public static CheckedClass foo; + + public static void main(String args[]) { +// object001a _object001a = new object001a(); + System.exit(JCK_STATUS_BASE + run(args)); + } + + static int run( String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // create instance of checked class + foo = new CheckedClass(); + + // notify debugger that debuggee started + pipe.println(COMMAND_READY); + + // wait for command GO from debugger + String command = pipe.readln(); + if (command.equals(COMMAND_QUIT)) { + return PASSED; + } + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + + // perform actions + foo.run(); + + // notify debugger that the command done + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} + +// class for checking +class CheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + class Class implements Inter {} + Class X0, X1[], X2[][]; + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + void run() { + + z1 = new boolean[] {z0}; + z2 = new boolean[][] {z1}; + b1 = new byte[] {b0}; + b2 = new byte[][] {b1}; + c1 = new char[] {c0}; + c2 = new char[][] {c1}; + d1 = new double[] {d0}; + d2 = new double[][] {d1}; + f1 = new float[] {f0}; + f2 = new float[][] {f1}; + i1 = new int[] {i0}; + i2 = new int[][] {i1}; + l1 = new long[] {l0}; + l2 = new long[][] {l1}; + s1 = new short[] {s0}; + s2 = new short[][] {s1}; + + lS1 = new long[] {lS0}; + lS2 = new long[][] {lS1}; + lP1 = new long[] {lP0}; + lP2 = new long[][] {lP1}; + lU1 = new long[] {lU0}; + lU2 = new long[][] {lU1}; + lR1 = new long[] {lR0}; + lR2 = new long[][] {lR1}; + lT1 = new long[] {lT0}; + lT2 = new long[][] {lT1}; + lV1 = new long[] {lV0}; + lV2 = new long[][] {lV1}; + + X0 = new Class(); + X1 = new Class[] {X0}; + X2 = new Class[][] {X1}; + Z0 = new Boolean(true); + Z1 = new Boolean[] {Z0}; + Z2 = new Boolean[][] {Z1}; + B0 = new Byte(java.lang.Byte.MIN_VALUE); + B1 = new Byte[] {B0}; + B2 = new Byte[][] {B1}; + C0 = new Character(java.lang.Character.MIN_VALUE); + C1 = new Character[] {C0}; + C2 = new Character[][]{C1}; + D0 = new Double(java.lang.Double.MIN_VALUE); + D1 = new Double[] {D0}; + D2 = new Double[][] {D1}; + F0 = new Float(java.lang.Float.MIN_VALUE); + F1 = new Float[] {F0}; + F2 = new Float[][] {F1}; + I0 = new Integer(java.lang.Integer.MIN_VALUE); + I1 = new Integer[] {I0}; + I2 = new Integer[][] {I1}; + L0 = new Long(java.lang.Long.MIN_VALUE); + L1 = new Long[] {L0}; + L2 = new Long[][] {L1}; + S0 = new Short(java.lang.Short.MIN_VALUE); + S1 = new Short[] {S0}; + S2 = new Short[][] {S1}; + W0 = new String(); + W1 = new String[] {W0}; + W2 = new String[][] {W1}; + O0 = new Object(); + O1 = new Object[] {O0}; + O2 = new Object[][] {O1}; + + LS0 = new Long(java.lang.Long.MAX_VALUE); + LS1 = new Long[] {LS0}; + LS2 = new Long[][] {LS1}; + LP0 = new Long(java.lang.Long.MAX_VALUE); + LP1 = new Long[] {LP0}; + LP2 = new Long[][] {LP1}; + LU0 = new Long(java.lang.Long.MAX_VALUE); + LU1 = new Long[] {LU0}; + LU2 = new Long[][] {LU1}; + LR0 = new Long(java.lang.Long.MAX_VALUE); + LR1 = new Long[] {LR0}; + LR2 = new Long[][] {LR1}; + LT0 = new Long(java.lang.Long.MAX_VALUE); + LT1 = new Long[] {LT0}; + LT2 = new Long[][] {LT1}; + LV0 = new Long(java.lang.Long.MAX_VALUE); + LV1 = new Long[] {LV0}; + LV2 = new Long[][] {LV1}; + + E0 = new Class(); + E1 = new Inter[] {E0}; + E2 = new Inter[][] {E1}; + ES0 = new Class(); + ES1 = new Inter[] {ES0}; + ES2 = new Inter[][] {ES1}; + EP0 = new Class(); + EP1 = new Inter[] {EP0}; + EP2 = new Inter[][] {EP1}; + EU0 = new Class(); + EU1 = new Inter[] {EU0}; + EU2 = new Inter[][] {EU1}; + ER0 = new Class(); + ER1 = new Inter[] {ER0}; + ER2 = new Inter[][] {ER1}; + ET0 = new Class(); + ET1 = new Inter[] {ET0}; + ET2 = new Inter[][] {ET1}; + EV0 = new Class(); + EV1 = new Inter[] {EV0}; + EV2 = new Inter[][] {EV1}; + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001.java new file mode 100644 index 00000000000..34a0fad1f53 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001.java @@ -0,0 +1,298 @@ +/* + * 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.WatchpointEvent.valueCurrent; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.io.*; +import java.util.Iterator; +import java.util.List; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugger in the test + +public class valuecur001 { + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final int TIMEOUT_DELTA = 1000; // milliseconds + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + static final String DEBUGGEE_NAME = "nsk.jdi.WatchpointEvent.valueCurrent.valuecur001a"; + static final String CHECKED_CLASS_NAME = "nsk.jdi.WatchpointEvent.valueCurrent.CheckedClass"; + + static private Debugee debuggee; + static private VirtualMachine vm; + static private IOPipe pipe; + static private Log log; + static private ArgumentHandler argHandler; + static private EventSet eventSet; + + static private ReferenceType rType; + static private WatchpointRequest checkedRequest; + static private List fieldsList; + + static private volatile boolean testFailed; + static private volatile boolean done; + static private volatile int requestsCount, awpEventsCount, mwpEventsCount; + + public static void main (String args[]) { + System.exit(run(args, System.out) + JCK_STATUS_BASE); + } + + public static int run(final String args[], final PrintStream out) { + + testFailed = false; + requestsCount = 0; + awpEventsCount = 0; + mwpEventsCount = 0; + + argHandler = new ArgumentHandler(args); + log = new Log(out, argHandler); + + // launch debuggee + Binder binder = new Binder(argHandler, log); + log.display("Connecting to debuggee"); + debuggee = binder.bindToDebugee(DEBUGGEE_NAME); + debuggee.redirectStderr(log, "valuecur001a >"); + pipe = debuggee.createIOPipe(); + vm = debuggee.VM(); + + // resume debuggee + log.display("Resuming debuggee"); + debuggee.resume(); + + // check debuggee's capabilities + if (!debuggee.VM().canWatchFieldAccess()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field access"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return PASSED; + } + + if (!debuggee.VM().canWatchFieldModification()) { + log.display("TEST WARNING: test passed because JDI implementation does not support " + + "watchpoints for field modification"); + pipe.println(COMMAND_QUIT); + debuggee.waitFor(); + return PASSED; + } + + try { + + // wait for debuggee started + log.display("Waiting for command: " + COMMAND_READY); + String command = pipe.readln(); + if (!command.equals(COMMAND_READY)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // get mirrors + if ((rType = debuggee.classByName(CHECKED_CLASS_NAME)) == null) { + throw new Failure("TEST BUG: cannot find " + CHECKED_CLASS_NAME); + } + + // create events requests + log.display("Creating requests for WatchpointEvent"); + EventRequestManager erManager = debuggee.VM().eventRequestManager(); + Iterator fieldsIter; + try { + fieldsList = rType.fields(); + fieldsIter = fieldsList.iterator(); + } catch (ClassNotPreparedException e) { + throw new Failure( "TEST_BUG: " + rType.name() + " is not prepared"); + } + while (fieldsIter.hasNext()) { + Field refField = (Field)fieldsIter.next(); + if ((checkedRequest = erManager.createAccessWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create AccessWatchpointRequest"); + } else { + log.display("AccessWatchpointRequest for field " + refField.name() + " created"); + checkedRequest.enable(); + } + if ((checkedRequest = erManager.createModificationWatchpointRequest(refField)) == null) { + throw new Failure("TEST BUG: unable to create ModificationWatchpointRequest"); + } else { + log.display("ModificationWatchpointRequest for field " + refField.name() + " created"); + checkedRequest.enable(); + } + requestsCount++; + } + log.display("Created total " + requestsCount + " WatchpointRequests"); + + // define separate thread for handling events + class EventHandler extends Thread { + public void run() { + eventSet = null; + try { + // handle events until all events generated and received + while ( awpEventsCount < requestsCount + || mwpEventsCount < requestsCount ) { + + eventSet = null; + eventSet = vm.eventQueue().remove(TIMEOUT_DELTA); + + if (eventSet == null) + continue; + + EventIterator eventIterator = eventSet.eventIterator(); + while (eventIterator.hasNext()) { + + Event event = eventIterator.nextEvent(); + + // handle WatchpointEvent + if (event instanceof WatchpointEvent) { + WatchpointEvent castedEvent = (WatchpointEvent)event; + Value evValue = castedEvent.valueCurrent(); + Field evField = castedEvent.field(); + + if (event instanceof AccessWatchpointEvent) { + awpEventsCount++; + log.display("AccessWatchpointEvent received for " + evField.name()); + } else if (event instanceof ModificationWatchpointEvent) { + mwpEventsCount++; + log.display("ModificationWatchpointEvent received for " + evField.name()); + } + + if (evValue == null) { + log.complain("FAILURE 1: WatchpointEvent.valueCurrent() returns null for " + evField.name()); + testFailed = true; + } else { + int ind = fieldsList.indexOf(evField); + if (ind == -1) { + log.complain("FAILURE 2: Watchpoint.field() returns unknown field"); + testFailed = true; + } else { + Value valueCur = castedEvent.valueCurrent(); + Value valueFld; + try { + valueFld = castedEvent.object().getValue(evField); + } catch (NullPointerException e) { + // field is static + valueFld = rType.getValue(evField); + } + if (!valueFld.equals(valueCur)) { + log.complain("FAILURE 3: Watchpoint.valueCurrent() returns incorrect value for " + + evField.name() + "\nvalueCurrent(): " + valueCur + " ; getValue(): " + valueFld); + testFailed = true; + } else { + valuecur001.log.display(evField.name() + " equals to " + castedEvent.valueCurrent().toString()); + } + } + } + } + } + eventSet.resume(); + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: caught InterruptedException while waiting for event"); + testFailed = true; + } catch (VMDisconnectedException e) { + log.complain("TEST INCOMPLETE: caught VMDisconnectedException while waiting for event"); + testFailed = true; + } + log.display("eventHandler completed"); + } + } + + // start event handling thread + EventHandler eventHandler = new EventHandler(); + log.display("Starting eventHandler"); + eventHandler.start(); + + // force debuggee to generate events + log.display("Sending command: " + COMMAND_GO); + pipe.println(COMMAND_GO); + + // wait for confirmation from debugee + log.display("Waiting for command: " + COMMAND_DONE); + command = pipe.readln(); + if (command == null || !command.equals(COMMAND_DONE)) { + throw new Failure("TEST BUG: unexpected debuggee's command: " + command); + } + + // notify EventHandler that all events generated + done = true; + + // wait for all expected events received + log.display("Waiting for all expected events received"); + try { + eventHandler.join(argHandler.getWaitTime()*60000); + if (eventHandler.isAlive()) { + log.complain("FAILURE 20: Timeout for waiting of event was exceeded"); + eventHandler.interrupt(); + testFailed = true; + } + } catch (InterruptedException e) { + log.complain("TEST INCOMPLETE: InterruptedException caught while waiting for eventHandler's death"); + testFailed = true; + } + } catch (Failure e) { + log.complain("TEST FAILURE: " + e.getMessage()); + testFailed = true; + } catch (Exception e) { + log.complain("Unexpected exception: " + e); + e.printStackTrace(out); + testFailed = true; + } finally { + + log.display(""); + + // force debugee to exit + log.display("Sending command: " + COMMAND_QUIT); + pipe.println(COMMAND_QUIT); + + // wait for debuggee exits and analize its exit code + log.display("Waiting for debuggee terminating"); + int debuggeeStatus = debuggee.endDebugee(); + if (debuggeeStatus == PASSED + JCK_STATUS_BASE) { + log.display("Debuggee PASSED with exit code: " + debuggeeStatus); + } else { + log.complain("Debuggee FAILED with exit code: " + debuggeeStatus); + testFailed = true; + } + } + + // check test results + if (testFailed) { + log.complain("TEST FAILED"); + return FAILED; + } + + log.display("TEST PASSED"); + return PASSED; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001/TestDescription.java new file mode 100644 index 00000000000..db9d7a238f3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001/TestDescription.java @@ -0,0 +1,87 @@ +/* + * 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 + * @modules java.base/jdk.internal.misc:+open + * + * @summary converted from VM Testbase nsk/jdi/WatchpointEvent/valueCurrent/valuecur001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION + * This test exercises + * com.sun.jdi.event.WatchpointEvent.valueCurrent() method. + * The test checks the following assertion: + * the Value reference returned by WatchpointEvent.valueCurrent() + * equals to one returned by ObjectReference.getValue() for instance + * field or to one returned ReferenceType.getValue() for static field. + * A debugger class - nsk.jdi.WatchpointEvent.valueCurrent.valuecur001 ; + * a debuggee class - nsk.jdi.WatchpointEvent.valueCurrent.valuecur001a . + * The test uses supporting nsk/jdi/share classes for launching debuggee + * and for creating communication pipe between debugger and debuggee. The + * debugger and debugee communicates with special commands. + * The debugger creates WatchpointRequests to the fields defined + * in debuggee class. + * The debugger starts thread for listening events delivered + * from debuggee. + * Upon receiving command from debugger, the debuggee initializes its + * fields and sends command . + * The debugger switches to to listen the event during the + * time specified by parameter. Then debugger shuts down debuggee + * by command. + * If debugger receives WatchpointEvent, it checks the assertion of the test. + * The test also fails if no WatchpointEvent was received. + * COMMENTS + * Test fixed due to bug: + * 4455653 VMDisconnectedException on resume + * ----------------- + * The test has been modified as follows. + * 1. To fix the bug 4505743, + * foo.run(); is added right after + * CheckedClass foo = new CheckedClass(); (line 37 in valuecur001a.java) + * 2. As the test contains unnecessary check on numbers of received events, + * hence wrong because the spec for the method doesn't require to check, + * the check is removed. + * A special test with such check against the inteface will be added. + * 3. The number of checks on AccessWatchpointEvents put in correcpondence with + * the number of checks on ModificationWatchpointEvents. + * ----------------- + * Standard method Debugee.endDebugee() is used instead of cleaning + * event queue on debuggee VM exit. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointEvent.valueCurrent.valuecur001 + * nsk.jdi.WatchpointEvent.valueCurrent.valuecur001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointEvent.valueCurrent.valuecur001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001a.java new file mode 100644 index 00000000000..b9ae0a1ae3b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001a.java @@ -0,0 +1,271 @@ +/* + * 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.WatchpointEvent.valueCurrent; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + + +// This class is the debugged application in the test + +class valuecur001a { + + static final int PASSED = 0; + static final int FAILED = 2; + static final int JCK_STATUS_BASE = 95; + + static final String COMMAND_READY = "ready"; + static final String COMMAND_QUIT = "quit"; + static final String COMMAND_GO = "go"; + static final String COMMAND_DONE = "done"; + + public static void main(String args[]) { + System.exit(JCK_STATUS_BASE + run(args)); + } + + static int run(String args[]) { + ArgumentHandler argHandler = new ArgumentHandler(args); + IOPipe pipe = argHandler.createDebugeeIOPipe(); + + // create instance of checked class + CheckedClass foo = new CheckedClass(); + foo.run(); + + // notify debuggeer that debuggee started + pipe.println(COMMAND_READY); + + // wait for command GO from debugger + String command = pipe.readln(); + if (command.equals(COMMAND_QUIT)) { + return PASSED; + } + if (!command.equals(COMMAND_GO)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + + // perform actions + foo.run(); + + // notify debugger that the command done + pipe.println(COMMAND_DONE); + + // wait for command QUIT from debugger and exit + command = pipe.readln(); + if (!command.equals(COMMAND_QUIT)) { + System.err.println("TEST BUG: unknown command: " + command); + return FAILED; + } + return PASSED; + } +} + +// class for checking +class CheckedClass { + + boolean z0, z1[], z2[][]; + byte b0, b1[], b2[][]; + char c0, c1[], c2[][]; + double d0, d1[], d2[][]; + float f0, f1[], f2[][]; + int i0, i1[], i2[][]; + long l0, l1[], l2[][]; + short s0, s1[], s2[][]; + + static long lS0, lS1[], lS2[][]; + private long lP0, lP1[], lP2[][]; + public long lU0, lU1[], lU2[][]; + protected long lR0, lR1[], lR2[][]; + transient long lT0, lT1[], lT2[][]; + volatile long lV0, lV1[], lV2[][]; + + Boolean Z0, Z1[], Z2[][]; + Byte B0, B1[], B2[][]; + Character C0, C1[], C2[][]; + Double D0, D1[], D2[][]; + Float F0, F1[], F2[][]; + Integer I0, I1[], I2[][]; + Long L0, L1[], L2[][]; + String W0, W1[], W2[][]; + Short S0, S1[], S2[][]; + Object O0, O1[], O2[][]; + + static Long LS0, LS1[], LS2[][]; + private Long LP0, LP1[], LP2[][]; + public Long LU0, LU1[], LU2[][]; + protected Long LR0, LR1[], LR2[][]; + transient Long LT0, LT1[], LT2[][]; + volatile Long LV0, LV1[], LV2[][]; + + interface Inter {} + class Class implements Inter {} + Class X0, X1[], X2[][]; + Inter E0, E1[], E2[][]; + static Inter ES0, ES1[], ES2[][]; + private Inter EP0, EP1[], EP2[][]; + public Inter EU0, EU1[], EU2[][]; + protected Inter ER0, ER1[], ER2[][]; + transient Inter ET0, ET1[], ET2[][]; + volatile Inter EV0, EV1[], EV2[][]; + + void run() { + + z0 = true; + b0 = 0; + c0 = 0; + d0 = 0; + f0 = 0; + i0 = 0; + l0 = 0; + s0 = 0; + + lS0 = 0; + lP0 = 0; + lU0 = 0; + lR0 = 0; + lT0 = 0; + lV0 = 0; + + z1 = new boolean[] {z0}; + z2 = new boolean[][] {z1}; + b1 = new byte[] {b0}; + b2 = new byte[][] {b1}; + c1 = new char[] {c0}; + c2 = new char[][] {c1}; + d1 = new double[] {d0}; + d2 = new double[][] {d1}; + f1 = new float[] {f0}; + f2 = new float[][] {f1}; + i1 = new int[] {i0}; + i2 = new int[][] {i1}; + l1 = new long[] {l0}; + l2 = new long[][] {l1}; + s1 = new short[] {s0}; + s2 = new short[][] {s1}; + + lS1 = new long[] {lS0}; + lS2 = new long[][] {lS1}; + lP1 = new long[] {lP0}; + lP2 = new long[][] {lP1}; + lU1 = new long[] {lU0}; + lU2 = new long[][] {lU1}; + lR1 = new long[] {lR0}; + lR2 = new long[][] {lR1}; + lT1 = new long[] {lT0}; + lT2 = new long[][] {lT1}; + lV1 = new long[] {lV0}; + lV2 = new long[][] {lV1}; + + X0 = new Class(); + X1 = new Class[] {X0}; + X2 = new Class[][] {X1}; + Z0 = new Boolean(true); + Z1 = new Boolean[] {Z0}; + Z2 = new Boolean[][] {Z1}; + B0 = new Byte(java.lang.Byte.MIN_VALUE); + B1 = new Byte[] {B0}; + B2 = new Byte[][] {B1}; + C0 = new Character(java.lang.Character.MIN_VALUE); + C1 = new Character[] {C0}; + C2 = new Character[][]{C1}; + D0 = new Double(java.lang.Double.MIN_VALUE); + D1 = new Double[] {D0}; + D2 = new Double[][] {D1}; + F0 = new Float(java.lang.Float.MIN_VALUE); + F1 = new Float[] {F0}; + F2 = new Float[][] {F1}; + I0 = new Integer(java.lang.Integer.MIN_VALUE); + I1 = new Integer[] {I0}; + I2 = new Integer[][] {I1}; + L0 = new Long(java.lang.Long.MIN_VALUE); + L1 = new Long[] {L0}; + L2 = new Long[][] {L1}; + S0 = new Short(java.lang.Short.MIN_VALUE); + S1 = new Short[] {S0}; + S2 = new Short[][] {S1}; + W0 = new String(); + W1 = new String[] {W0}; + W2 = new String[][] {W1}; + O0 = new Object(); + O1 = new Object[] {O0}; + O2 = new Object[][] {O1}; + + LS0 = new Long(java.lang.Long.MAX_VALUE); + LS1 = new Long[] {LS0}; + LS2 = new Long[][] {LS1}; + LP0 = new Long(java.lang.Long.MAX_VALUE); + LP1 = new Long[] {LP0}; + LP2 = new Long[][] {LP1}; + LU0 = new Long(java.lang.Long.MAX_VALUE); + LU1 = new Long[] {LU0}; + LU2 = new Long[][] {LU1}; + LR0 = new Long(java.lang.Long.MAX_VALUE); + LR1 = new Long[] {LR0}; + LR2 = new Long[][] {LR1}; + LT0 = new Long(java.lang.Long.MAX_VALUE); + LT1 = new Long[] {LT0}; + LT2 = new Long[][] {LT1}; + LV0 = new Long(java.lang.Long.MAX_VALUE); + LV1 = new Long[] {LV0}; + LV2 = new Long[][] {LV1}; + + E0 = new Class(); + E1 = new Inter[] {E0}; + E2 = new Inter[][] {E1}; + ES0 = new Class(); + ES1 = new Inter[] {ES0}; + ES2 = new Inter[][] {ES1}; + EP0 = new Class(); + EP1 = new Inter[] {EP0}; + EP2 = new Inter[][] {EP1}; + EU0 = new Class(); + EU1 = new Inter[] {EU0}; + EU2 = new Inter[][] {EU1}; + ER0 = new Class(); + ER1 = new Inter[] {ER0}; + ER2 = new Inter[][] {ER1}; + ET0 = new Class(); + ET1 = new Inter[] {ET0}; + ET2 = new Inter[][] {ET1}; + EV0 = new Class(); + EV1 = new Inter[] {EV0}; + EV2 = new Inter[][] {EV1}; + + m(z2); m(b2); m(c2); m(d2); m(f2); m(i2); m(l2); m(s2); + + m(lS2); m(lP2); m(lU2); m(lR2); m(lT2); m(lV2); + + m(X2); m(Z2); m(B2); m(C2); m(D2); m(F2); m(I2); m(S2); m(W2); m(O2); + + m(LS2); m(LP2); m(LU2); m(LR2); m(LT2); m(LV2); + + m(X2); m(E2); m(ES2); m(EP2); m(EU2); m(ER2); m(ET2); m(EV2); + + } + + void m(Object obj) { + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001.java new file mode 100644 index 00000000000..8a444234744 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001.java @@ -0,0 +1,238 @@ +/* + * 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.WatchpointRequest._bounds_; + +import nsk.share.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.request.*; + +import java.io.*; + +/** + * The test checks up the
    + * - addThreadFilter(ThreadReference)
    + * - addInstanceFilter(ObjectReference)
    + * - addClassFilter(ReferenceType)
    + * - addClassFilter(String)
    + * - addClassExclusionFilter(String)
    + * methods with null argument value.
    + *

    + * This test performs checking for the AccessWatchpointRequest and + * ModificationWatchpointRequest instances. In any cases + * NullPointerException is expected. + */ +public class filters001 { + + private final static String prefix = "nsk.jdi.WatchpointRequest._bounds_."; + private final static String debuggerName = prefix + "filters001"; + private final static String debugeeName = debuggerName + "a"; + + private static int exitStatus; + private static Log log; + private static Debugee debugee; + + private static void display(String msg) { + log.display("debugger> " + msg); + } + + private static void complain(String msg) { + log.complain("debugger FAILURE> " + msg + "\n"); + } + + public static void main(String argv[]) { + System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out)); + } + + public static int run(String argv[], PrintStream out) { + + exitStatus = Consts.TEST_PASSED; + + filters001 thisTest = new filters001(); + + ArgumentHandler argHandler = new ArgumentHandler(argv); + log = new Log(out, argHandler); + + debugee = Debugee.prepareDebugee(argHandler, log, debugeeName); + + thisTest.execTest(); + display("execTest finished. exitStatus = " + exitStatus); + + return exitStatus; + } + + private void execTest() { + + ReferenceType refType = debugee.classByName(debugeeName); + Field field = refType.fieldByName(filters001a.fieldName); + + EventRequestManager evm = debugee.getEventRequestManager(); + WatchpointRequest[] request = new WatchpointRequest[2]; + request[0] = evm.createAccessWatchpointRequest(field); + request[1] = evm.createModificationWatchpointRequest(field); + + for (int i = 0; i < request.length; i++) { + display(""); + if (i == 0 ) { + display(">>>checking AccessWatchpointRequest"); + } else { + display(">>>checking ModificationWatchpointRequest"); + } + display("-----------------------------------------"); + addThreadFilter(request[i], null); + + display(""); + addInstanceFilter(request[i], null); + + display(""); + addClassFilter(request[i], (ReferenceType )null); + + display(""); + addClassFilter(request[i], (String )null); + + display(""); + addClassExclusionFilter(request[i], (String )null); + } + display(""); + debugee.quit(); + } + + private void addThreadFilter(WatchpointRequest request, ThreadReference thread) { + String tmp = "addThreadFilter :thread name> "; + tmp += (thread == null) ? "" : thread.name(); + display(tmp); + + try { + request.addThreadFilter(thread); + if (thread==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (thread == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addInstanceFilter(WatchpointRequest request, + ObjectReference instance) { + String tmp = "addInstanceFilter :object value> "; + tmp += (instance == null) ? "" : instance.toString(); + display(tmp); + + try { + request.addInstanceFilter(instance); + if (instance==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (instance == null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(WatchpointRequest request, ReferenceType refType) { + + display("addClassFilter :ReferenceType> <" + refType + ">"); + + try { + request.addClassFilter(refType); + if (refType==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (refType==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassFilter(WatchpointRequest request, String classPattern) { + + display("addClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + + private void addClassExclusionFilter(WatchpointRequest request, + String classPattern) { + display("addExclusionClassFilter :classPattern> <" + classPattern + ">"); + try { + request.addClassExclusionFilter(classPattern); + if (classPattern==null){ + complain("*****NullPointerException is not thrown"); + exitStatus = Consts.TEST_FAILED; + } + } catch (NullPointerException e) { + if (classPattern==null){ + display("!!!Expected " + e); + } else { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } catch (Exception e) { + complain("*****Unexpected " + e); + exitStatus = Consts.TEST_FAILED; + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001/TestDescription.java new file mode 100644 index 00000000000..748151cb36a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001/TestDescription.java @@ -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/WatchpointRequest/_bounds_/filters001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the boundary value of the parameters. + * The test checks up that the methods + * com.sun.jdi.request.WatchpointRequest.addThreadFilter(ThreadReference) + * com.sun.jdi.request.WatchpointRequest.addInstanceFilter(ObjectReference) + * com.sun.jdi.request.WatchpointRequest.addClassFilter(ReferenceType) + * com.sun.jdi.request.WatchpointRequest.addClassFilter(String) + * com.sun.jdi.request.WatchpointRequest.addClassExclusionFilter(String) + * correctly work for the boundary value of parameter and throw described + * exceptions. + * The test check up this methods with argument value. The test + * performs checking for the AccessWatchpointRequest and + * ModificationWatchpointRequest instances. In any cases + * NullPointerException is expected. + * COMMENTS: + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest._bounds_.filters001 + * nsk.jdi.WatchpointRequest._bounds_.filters001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest._bounds_.filters001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001a.java new file mode 100644 index 00000000000..a3be022b500 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001a.java @@ -0,0 +1,58 @@ +/* + * 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.WatchpointRequest._bounds_; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * filters001a is deugee's part of the test. + */ +public class filters001a { + + static String fieldName = "justField"; + + static int justField = 0; + + 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 instr = pipe.readln(); + + if (instr.equals("quit")) { + log.display("DEBUGEE> completed succesfully."); + System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); + } + + log.complain("DEBUGEE> unexpected signal of debugger."); + System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001.java new file mode 100644 index 00000000000..7446bd971e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001.java @@ -0,0 +1,215 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * - The debugger + * - sets up two WatchpointRequests, + * - using patterns that begins with '*' and ends with *, + * restricts the Requests, + * - waits for expected WatchpointEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, throw NullPointerExceptions used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter001a"; + return new filter001().runThis(argv, out); + } + + private String classExclFilter1 = "*TestClass11"; + private String classExclFilter2 = + "nsk.jdi.WatchpointRequest.addClassExclusionFilter.TestClass21*"; + + private String classExclName1 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.TestClass11"; + private String classExclName2 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.TestClass21"; + + private String className1 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.TestClass10"; + private String className2 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.TestClass20"; + + protected void testRun() { + + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String fieldName1 = "var101"; + String fieldName2 = "var201"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(className1).get(0); + + eventRequest1 = setting23AccessWatchpointRequest (null, + testClassReference, fieldName1, + classExclFilter1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not AccessWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + String str = ((AccessWatchpointEvent) newEvent).location().declaringType().name(); + display(" Class name == " + str); + if (str.endsWith(classExclName1)) { + setFailedStatus("ERROR: name of Class ends with the testing pattern: " + str); + } + } + vm.resume(); + break; + + case 1: + testClassReference = + (ReferenceType) vm.classesByName(className2).get(0); + + eventRequest2 = setting23AccessWatchpointRequest (null, + testClassReference, fieldName2, + classExclFilter2, + EventRequest.SUSPEND_ALL, property2); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not AccessWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + + String str = ((AccessWatchpointEvent) newEvent).location().declaringType().name(); + display(" Class name == " + str); + if (str.endsWith(classExclName2)) { + setFailedStatus("ERROR: name of Class ends with the testing pattern: " + str); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private AccessWatchpointRequest setting23AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + String classExclFilter, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + awr.addClassExclusionFilter(classExclFilter); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001/TestDescription.java new file mode 100644 index 00000000000..bcf8273551c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassExclusionFilter/filter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to test include AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter001; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter001 + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001a.java new file mode 100644 index 00000000000..708da9194f4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001a.java @@ -0,0 +1,259 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter001 JDI test. + */ + +public class filter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter001a thread1 = null; + static Thread2filter001a thread2 = null; + + static TestClass10 obj10 = new TestClass10(); + static TestClass11 obj11 = new TestClass11(); + static TestClass20 obj20 = new TestClass20(); + static TestClass21 obj21 = new TestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter001a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + break; + + case 1: + thread2 = new Thread2filter001a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + + + static class Thread1filter001a extends Thread { + + String tName = null; + + public Thread1filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + obj10.method(); + obj11.method(); + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + static class Thread2filter001a extends Thread { + + String tName = null; + + public Thread2filter001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + obj20.method(); + obj21.method(); + log1(" 'run': exit :: threadName == " + tName); + return; + } + } +} + +class TestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class TestClass11 extends TestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// TestClass10.method(); + } +} + +class TestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } +} +class TestClass21 extends TestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; +// TestClass20.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002.java new file mode 100644 index 00000000000..ecf875735db --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002.java @@ -0,0 +1,215 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * - The debugger + * - sets up two WatchpointRequests, + * - using patterns that begins with '*' and ends with *, + * restricts the Requests, + * - waits for expected WatchpointEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, throw NullPointerExceptions used + * to generate Events and to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter002 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002a"; + return new filter002().runThis(argv, out); + } + + private String classExclFilter1 = "*filter002aTestClass11"; + private String classExclFilter2 = + "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002aTestClass21*"; + + private String classExclName1 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002aTestClass11"; + private String classExclName2 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002aTestClass21"; + + private String className1 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002aTestClass10"; + private String className2 = "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002aTestClass20"; + + protected void testRun() { + + if ( !vm.canWatchFieldModification() ) { + display("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String fieldName1 = "var101"; + String fieldName2 = "var201"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(className1).get(0); + + eventRequest1 = setting23ModificationWatchpointRequest (null, + testClassReference, fieldName1, + classExclFilter1, + EventRequest.SUSPEND_ALL, property1); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + + String str = ((ModificationWatchpointEvent) newEvent).location().declaringType().name(); + display(" Class name == " + str); + if (str.endsWith(classExclName1)) { + setFailedStatus("ERROR: name of Class ends with the testing pattern: " + str); + } + } + vm.resume(); + break; + + case 1: + testClassReference = + (ReferenceType) vm.classesByName(className2).get(0); + + eventRequest2 = setting23ModificationWatchpointRequest (null, + testClassReference, fieldName2, + classExclFilter2, + EventRequest.SUSPEND_ALL, property2); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + + String str = ((ModificationWatchpointEvent) newEvent).location().declaringType().name(); + display(" Class name == " + str); + if (str.endsWith(classExclName2)) { + setFailedStatus("ERROR: name of Class ends with the testing pattern: " + str); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting23ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + String classExclFilter, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + awr.addClassExclusionFilter(classExclFilter); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002/TestDescription.java new file mode 100644 index 00000000000..0d041f634bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassExclusionFilter/filter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002 + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002a.java new file mode 100644 index 00000000000..b034912dc23 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002a.java @@ -0,0 +1,259 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter002 JDI test. + */ + +public class filter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter002a thread1 = null; + static Thread2filter002a thread2 = null; + + static filter002aTestClass10 obj10 = new filter002aTestClass10(); + static filter002aTestClass11 obj11 = new filter002aTestClass11(); + static filter002aTestClass20 obj20 = new filter002aTestClass20(); + static filter002aTestClass21 obj21 = new filter002aTestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter002a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + break; + + case 1: + thread2 = new Thread2filter002a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + + + static class Thread1filter002a extends Thread { + + String tName = null; + + public Thread1filter002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + obj10.method(); + obj11.method(); + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + + static class Thread2filter002a extends Thread { + + String tName = null; + + public Thread2filter002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + obj20.method(); + obj21.method(); + log1(" 'run': exit :: threadName == " + tName); + return; + } + } +} + +class filter002aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter002aTestClass11 extends filter002aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// TestClass10.method(); + } +} + +class filter002aTestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } +} +class filter002aTestClass21 extends filter002aTestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; +// filter002aTestClass20.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003.java new file mode 100644 index 00000000000..27de4de00fd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003.java @@ -0,0 +1,538 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The cases to test include AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an AccessWatchpointRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter003a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter003aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "AccessWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + eventRequest1 = setting23AccessWatchpointRequest (null, + testClassReference, fieldName1, + testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting23AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + awr.addClassExclusionFilter(testedClass); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003/TestDescription.java new file mode 100644 index 00000000000..41e38d1d1ba --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003/TestDescription.java @@ -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/WatchpointRequest/addClassExclusionFilter/filter003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter003; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addClassExclusionFilter.filter003 + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003a.java new file mode 100644 index 00000000000..e7b5c4880d8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003a.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter003 JDI test. + */ + +public class filter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter003aTestClass10 obj10 = new filter003aTestClass10(); + static filter003aTestClass11 obj11 = new filter003aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ +} + +class filter003aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter003aTestClass11 extends filter003aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// filter003aTestClass10.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004.java new file mode 100644 index 00000000000..c405dfbac72 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004.java @@ -0,0 +1,538 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The cases to test include ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ModificationWatchpointRequest and enables it,
    + * - invokes the method addClassExclusionFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassExclusionFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassExclusionFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter004a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter004aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "ModificationWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + eventRequest1 = setting23ModificationWatchpointRequest (null, + testClassReference, fieldName1, + testedClassName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting23ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + String testedClass, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + awr.addClassExclusionFilter(testedClass); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004/TestDescription.java new file mode 100644 index 00000000000..b2b07fdcc5f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004/TestDescription.java @@ -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/WatchpointRequest/addClassExclusionFilter/filter004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassExclusionFilter() + * complies with its spec: + * public void addClassExclusionFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name does not match a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter against. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter004; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addClassExclusionFilter.filter004 + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassExclusionFilter.filter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004a.java new file mode 100644 index 00000000000..a832e079ec0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004a.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.addClassExclusionFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter004 JDI test. + */ + +public class filter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter004aTestClass10 obj10 = new filter004aTestClass10(); + static filter004aTestClass11 obj11 = new filter004aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ +} + +class filter004aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter004aTestClass11 extends filter004aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// filter004aTestClass10.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001.java new file mode 100644 index 00000000000..06500aa6a94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those whose + * location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * The case to test include AccessWatchpointRequest. + * + * The test works as follows: + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates objects of ClassTypes to test and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a WatchpointRequest, + * - gets ReferenecType and, using it, restricts the Request, + * - resumes the debuggee and waits for expected WatchpointEvent. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, invokes methods performing access to fileds, + * used to generate Event and to test the filters. + * - Upon getting the event, the debugger performs checks required. + */ + +public class filter_rt001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt001a"; + return new filter_rt001().runThis(argv, out); + } + + String className1 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.TestClass10"; + String className2 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.TestClass11"; + + + protected void testRun() { + + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + String property1 = "AccessWatchpointRequest1"; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(className1).get(0); + + eventRequest1 = setting21AccessWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_ALL, property1); + + testClassReference = + (ReferenceType) vm.classesByName(className2).get(0); + + ((AccessWatchpointRequest) eventRequest1).addClassFilter(testClassReference); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not AccessWatchpointEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private AccessWatchpointRequest setting21AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001/TestDescription.java new file mode 100644 index 00000000000..6305c3d00fe --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassFilter_rt/filter_rt001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * The cases to test include AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt001; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt001 + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001a.java new file mode 100644 index 00000000000..46f26faaf60 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001a.java @@ -0,0 +1,254 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt001 JDI test. + */ + +public class filter_rt001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt001a thread1 = null; + static Thread2filter_rt001a thread2 = null; + + static TestClass10 obj10 = new TestClass10(); + static TestClass11 obj11 = new TestClass11(); + + static Thread2filter_rt001a.TestClass20 obj20 = new Thread2filter_rt001a.TestClass20(); + static Thread2filter_rt001a.TestClass21 obj21 = new Thread2filter_rt001a.TestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_rt001a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + thread2 = new Thread2filter_rt001a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class TestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class TestClass11 extends TestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1filter_rt001a extends Thread { + + String tName = null; + + public Thread1filter_rt001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt001a.waitnotifyObj) { + filter_rt001a.waitnotifyObj.notify(); + } + TestClass10.method(); + TestClass11.method(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter_rt001a extends Thread { + + String tName = null; + + public Thread2filter_rt001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt001a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt001a.waitnotifyObj) { + filter_rt001a.waitnotifyObj.notify(); + } + TestClass20.method(); + TestClass21.method(); + filter_rt001a.log1(" 'run': exit :: threadName == " + tName); + return; + } + + static class TestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } + } + static class TestClass21 extends TestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002.java new file mode 100644 index 00000000000..75da12ed92e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002.java @@ -0,0 +1,170 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those whose + * location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * The case to test include ModificationWatchpointRequest. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates objects of ClassTypes to test and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a WatchpointRequest, + * - gets ReferenecType and, using it, restricts the Request, + * - resumes the debuggee and waits for expected WatchpointEvent. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, invokes methods performing access to fileds, + * used to generate Event and to test the filters. + * - Upon getting the event, the debugger performs checks required. + */ + +public class filter_rt002 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002a"; + return new filter_rt002().runThis(argv, out); + } + + // ************************************************ test parameters + + String className1 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002aTestClass10"; + String className2 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002aTestClass11"; + + protected void testRun() { + + if ( !vm.canWatchFieldModification() ) { + display("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + String property1 = "ModificationWatchpointRequest1"; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String fieldName1 = "var101"; + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(className1).get(0); + + eventRequest1 = setting21ModificationWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_ALL, property1); + + testClassReference = + (ReferenceType) vm.classesByName(className2).get(0); + + ((ModificationWatchpointRequest) eventRequest1).addClassFilter(testClassReference); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("new event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting21ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002/TestDescription.java new file mode 100644 index 00000000000..87c46475024 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassFilter_rt/filter_rt002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002 + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002a.java new file mode 100644 index 00000000000..c70eb2361fc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002a.java @@ -0,0 +1,254 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt002 JDI test. + */ + +public class filter_rt002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt002a thread1 = null; + static Thread2filter_rt002a thread2 = null; + + static filter_rt002aTestClass10 obj10 = new filter_rt002aTestClass10(); + static filter_rt002aTestClass11 obj11 = new filter_rt002aTestClass11(); + + static Thread2filter_rt002a.TestClass20 obj20 = new Thread2filter_rt002a.TestClass20(); + static Thread2filter_rt002a.TestClass21 obj21 = new Thread2filter_rt002a.TestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_rt002a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + thread2 = new Thread2filter_rt002a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class filter_rt002aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_rt002aTestClass11 extends filter_rt002aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1filter_rt002a extends Thread { + + String tName = null; + + public Thread1filter_rt002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt002a.waitnotifyObj) { + filter_rt002a.waitnotifyObj.notify(); + } + filter_rt002aTestClass10.method(); + filter_rt002aTestClass11.method(); + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class Thread2filter_rt002a extends Thread { + + String tName = null; + + public Thread2filter_rt002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt002a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt002a.waitnotifyObj) { + filter_rt002a.waitnotifyObj.notify(); + } + TestClass20.method(); + TestClass21.method(); + filter_rt002a.log1(" 'run': exit :: threadName == " + tName); + return; + } + + static class TestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } + } + static class TestClass21 extends TestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003.java new file mode 100644 index 00000000000..463bdc5768e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003.java @@ -0,0 +1,535 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The cases to test include AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an AccessWatchpointRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt003a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt003aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "AccessWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + eventRequest1 = setting21AccessWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting21AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003/TestDescription.java new file mode 100644 index 00000000000..2ead856ca94 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003/TestDescription.java @@ -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/WatchpointRequest/addClassFilter_rt/filter_rt003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The cases to test include AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt003; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addClassFilter_rt.filter_rt003 + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003a.java new file mode 100644 index 00000000000..967870c0275 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003a.java @@ -0,0 +1,146 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt003 JDI test. + */ + +public class filter_rt003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt003aTestClass10 obj10 = new filter_rt003aTestClass10(); + static filter_rt003aTestClass11 obj11 = new filter_rt003aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class filter_rt003aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_rt003aTestClass11 extends filter_rt003aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004.java new file mode 100644 index 00000000000..a633bd7a6ec --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004.java @@ -0,0 +1,535 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The cases to test include ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ModificationWatchpointRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_rt004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_rt004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt004a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt004aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "ModificationWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + eventRequest1 = setting21ModificationWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testClassReference); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testClassReference); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting21ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004/TestDescription.java new file mode 100644 index 00000000000..43cbcce270f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004/TestDescription.java @@ -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/WatchpointRequest/addClassFilter_rt/filter_rt004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt004; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addClassFilter_rt.filter_rt004 + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004a.java new file mode 100644 index 00000000000..a9ad445d072 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004a.java @@ -0,0 +1,146 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt004 JDI test. + */ + +public class filter_rt004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_rt004aTestClass10 obj10 = new filter_rt004aTestClass10(); + static filter_rt004aTestClass11 obj11 = new filter_rt004aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +} + +class filter_rt004aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_rt004aTestClass11 extends filter_rt004aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005.java new file mode 100644 index 00000000000..4f002b6b0c7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005.java @@ -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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The WatchpointRequest to test is AccessWatchpointRequest. + * The cases to test include re-invocations of the method + * addClassFilter() on the same AccessWatchpointtRequest object. + * There are two AccessWatchpointRequests to check as follows: + * (1) For AccessWatchpointRequest2, both invocations are with different + * ReferenceTypes restricting one AccessWatchpoint event to two classes. + * The test expects no AccessWatchpoint event will be received. + * (2) For AccessWatchpointRequest1, both invocations are with the same + * ReferenceType restricting one AccessWatchpoint event to one class. + * The test expects this AccessWatchpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates objects of needed classes + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two AccessWatchpointRequests 1&2, + * - double restricts AccessWatchpointRequest1 to the RefTypes 1 and 1, + * - double restricts AccessWatchpointRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee creates and starts two threads, thread1 and thread2, + * generating the events to be filtered. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt005 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005a"; + return new filter_rt005().runThis(argv, out); + } + + // ************************************************ test parameters + + String className10 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005aTestClass10"; + String className20 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005aTestClass20"; + + String className11 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005aTestClass11"; + String className21 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005aTestClass21"; + + protected void testRun() { + + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String fieldName1 = "var101"; + String fieldName2 = "var201"; + + ReferenceType testClassReference10 = null; + ReferenceType testClassReference11 = null; + ReferenceType testClassReference20 = null; + ReferenceType testClassReference21 = null; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference10 = + (ReferenceType) vm.classesByName(className10).get(0); + testClassReference11 = + (ReferenceType) vm.classesByName(className11).get(0); + testClassReference20 = + (ReferenceType) vm.classesByName(className20).get(0); + testClassReference21 = + (ReferenceType) vm.classesByName(className21).get(0); + + eventRequest1 = setting21AccessWatchpointRequest (null, + testClassReference10, fieldName1, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21AccessWatchpointRequest (null, + testClassReference20, fieldName2, + EventRequest.SUSPEND_ALL, property2); + + + ((AccessWatchpointRequest) eventRequest1).addClassFilter(testClassReference11); + ((AccessWatchpointRequest) eventRequest1).addClassFilter(testClassReference11); + + ((AccessWatchpointRequest) eventRequest2).addClassFilter(testClassReference11); + ((AccessWatchpointRequest) eventRequest2).addClassFilter(testClassReference21); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("New event is not AccessWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private AccessWatchpointRequest setting21AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws Failure { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005/TestDescription.java new file mode 100644 index 00000000000..5fbe9179ecc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassFilter_rt/filter_rt005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * The cases to test include AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005 + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005a.java new file mode 100644 index 00000000000..029496ffdb3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005a.java @@ -0,0 +1,254 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt005 JDI test. + */ + +public class filter_rt005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt005a thread1 = null; + static Thread2filter_rt005a thread2 = null; + + static filter_rt005aTestClass10 obj10 = new filter_rt005aTestClass10(); + static filter_rt005aTestClass11 obj11 = new filter_rt005aTestClass11(); + + static filter_rt005aTestClass20 obj20 = new filter_rt005aTestClass20(); + static filter_rt005aTestClass21 obj21 = new filter_rt005aTestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_rt005a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + thread2 = new Thread2filter_rt005a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class filter_rt005aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_rt005aTestClass11 extends filter_rt005aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1filter_rt005a extends Thread { + + String tName = null; + + public Thread1filter_rt005a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt005a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt005a.waitnotifyObj) { + filter_rt005a.waitnotifyObj.notify(); + } + filter_rt005aTestClass10.method(); + filter_rt005aTestClass11.method(); + filter_rt005a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt005aTestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } +} +class filter_rt005aTestClass21 extends filter_rt005aTestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; + } +} + +class Thread2filter_rt005a extends Thread { + + String tName = null; + + public Thread2filter_rt005a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt005a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt005a.waitnotifyObj) { + filter_rt005a.waitnotifyObj.notify(); + } + filter_rt005aTestClass20.method(); + filter_rt005aTestClass21.method(); + filter_rt005a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006.java new file mode 100644 index 00000000000..fee62ff52a8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006.java @@ -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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The WatchpointRequest to test is ModificationWatchpointRequest. + * The cases to test include re-invocations of the method + * addClassFilter() on the same ModificationWatchpointtRequest object. + * There are two ModificationWatchpointRequests to check as follows: + * (1) For ModificationWatchpointRequest2, both invocations are with different + * ReferenceTypes restricting one ModificationWatchpoint event to two classes. + * The test expects no ModificationWatchpoint event will be received. + * (2) For ModificationWatchpointRequest1, both invocations are with the same + * ReferenceType restricting one ModificationWatchpoint event to one class. + * The test expects this ModificationWatchpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates objects of needed classes + * and invokes the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - gets ReferenceTypes 1&2 for the Classes to filter, + * - sets up two ModificationWatchpointRequests 1&2, + * - double restricts ModificationWatchpointRequest1 to the RefTypes 1 and 1, + * - double restricts ModificationWatchpointRequest2 to the RefTypes 1 and 2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - The debuggee creates and starts two threads, thread1 and thread2, + * generating the events to be filtered. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_rt006 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006a"; + return new filter_rt006().runThis(argv, out); + } + + String className10 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006aTestClass10"; + String className20 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006aTestClass20"; + + String className11 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006aTestClass11"; + String className21 = "nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006aTestClass21"; + + protected void testRun() { + + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String fieldName1 = "var101"; + String fieldName2 = "var201"; + + ReferenceType testClassReference10 = null; + ReferenceType testClassReference11 = null; + ReferenceType testClassReference20 = null; + ReferenceType testClassReference21 = null; + + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference10 = + (ReferenceType) vm.classesByName(className10).get(0); + testClassReference11 = + (ReferenceType) vm.classesByName(className11).get(0); + testClassReference20 = + (ReferenceType) vm.classesByName(className20).get(0); + testClassReference21 = + (ReferenceType) vm.classesByName(className21).get(0); + + eventRequest1 = setting21ModificationWatchpointRequest (null, + testClassReference10, fieldName1, + EventRequest.SUSPEND_ALL, property1); + + eventRequest2 = setting21ModificationWatchpointRequest (null, + testClassReference20, fieldName2, + EventRequest.SUSPEND_ALL, property2); + + + ((ModificationWatchpointRequest) eventRequest1).addClassFilter(testClassReference11); + ((ModificationWatchpointRequest) eventRequest1).addClassFilter(testClassReference11); + + ((ModificationWatchpointRequest) eventRequest2).addClassFilter(testClassReference11); + ((ModificationWatchpointRequest) eventRequest2).addClassFilter(testClassReference21); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("New event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) + setFailedStatus("Property is not : " + property1); + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting21ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws Failure { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006/TestDescription.java new file mode 100644 index 00000000000..431a8c2dbbc --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassFilter_rt/filter_rt006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(ReferenceType) + * complies with its spec: + * public void addClassFilter(ReferenceType refType) + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * Parameters: refType - the reference type to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in the given reference type or any of its subtypes. + * An event will be generated for any location in a reference type + * that can be safely cast to the given reference type. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006 + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_rt.filter_rt006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006a.java new file mode 100644 index 00000000000..c420b249704 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006a.java @@ -0,0 +1,254 @@ +/* + * 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.WatchpointRequest.addClassFilter_rt; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_rt006 JDI test. + */ + +public class filter_rt006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_rt006a thread1 = null; + static Thread2filter_rt006a thread2 = null; + + static filter_rt006aTestClass10 obj10 = new filter_rt006aTestClass10(); + static filter_rt006aTestClass11 obj11 = new filter_rt006aTestClass11(); + + static filter_rt006aTestClass20 obj20 = new filter_rt006aTestClass20(); + static filter_rt006aTestClass21 obj21 = new filter_rt006aTestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_rt006a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + thread2 = new Thread2filter_rt006a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +} + +class filter_rt006aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_rt006aTestClass11 extends filter_rt006aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1filter_rt006a extends Thread { + + String tName = null; + + public Thread1filter_rt006a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt006a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt006a.waitnotifyObj) { + filter_rt006a.waitnotifyObj.notify(); + } + filter_rt006aTestClass10.method(); + filter_rt006aTestClass11.method(); + filter_rt006a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_rt006aTestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } +} +class filter_rt006aTestClass21 extends filter_rt006aTestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; + } +} + +class Thread2filter_rt006a extends Thread { + + String tName = null; + + public Thread2filter_rt006a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_rt006a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_rt006a.waitnotifyObj) { + filter_rt006a.waitnotifyObj.notify(); + } + filter_rt006aTestClass20.method(); + filter_rt006aTestClass21.method(); + filter_rt006a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001.java new file mode 100644 index 00000000000..562efe4cac1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001.java @@ -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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(String) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * The cases to test include AccessWatchpointRequest. + * + * The test works as follows. + * - The debugger + * - sets up two WatchpointRequests, + * - using patterns that begins with '*' and ends with *, + * restricts the Requests, so that, + * first time events will be filtered only from thread1 and + * second time events will be filtered only from thread2, + * - resumes the debuggee, and + * - waits for expected WatchpointEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, generate Events to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_s001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s001a"; + return new filter_s001().runThis(argv, out); + } + + private String testedClassName1 = "*TestClass11"; + + private String testedClassName2 = + "nsk.jdi.WatchpointRequest.addClassFilter_s.Thread2filter_s001a*"; + + String className1 = "nsk.jdi.WatchpointRequest.addClassFilter_s.TestClass10"; + String className2 = "nsk.jdi.WatchpointRequest.addClassFilter_s.TestClass20"; + + protected void testRun() { + + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String fieldName1 = "var101"; + String fieldName2 = "var201"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(className1).get(0); + + eventRequest1 = setting21AccessWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_ALL, property1); + + ((AccessWatchpointRequest) eventRequest1).addClassFilter(testedClassName1); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not AccessWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + case 1: + testClassReference = + (ReferenceType) vm.classesByName(className2).get(0); + + eventRequest2 = setting21AccessWatchpointRequest (null, + testClassReference, fieldName2, + EventRequest.SUSPEND_ALL, property2); + + ((AccessWatchpointRequest) eventRequest2).addClassFilter(testedClassName2); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not AccessWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + } + vm.resume(); + break; + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private AccessWatchpointRequest setting21AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001/TestDescription.java new file mode 100644 index 00000000000..17091207082 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassFilter_s/filter_s001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(String) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to test include AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s001; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s001 + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001a.java new file mode 100644 index 00000000000..3836f92e51e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001a.java @@ -0,0 +1,260 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s001 JDI test. + */ + +public class filter_s001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s001a thread1 = null; + static Thread2filter_s001a thread2 = null; + + static TestClass10 obj10 = new TestClass10(); + static TestClass11 obj11 = new TestClass11(); + + static TestClass20 obj20 = new TestClass20(); + static Thread2filter_s001a.TestClass21 obj21 = new Thread2filter_s001a.TestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s001a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + TestClass20.method(); // otherwise TestClass20 is not loaded; bug? + break; + + case 1: + thread2 = new Thread2filter_s001a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class TestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class TestClass11 extends TestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1filter_s001a extends Thread { + + String tName = null; + + public Thread1filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_s001a.waitnotifyObj) { + filter_s001a.waitnotifyObj.notify(); + } + TestClass10.method(); + TestClass11.method(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class TestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } +} + +class Thread2filter_s001a extends Thread { + + String tName = null; + + public Thread2filter_s001a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s001a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_s001a.waitnotifyObj) { + filter_s001a.waitnotifyObj.notify(); + } + TestClass20.method(); + TestClass21.method(); + filter_s001a.log1(" 'run': exit :: threadName == " + tName); + return; + } + + static class TestClass21 extends TestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002.java new file mode 100644 index 00000000000..fccb6ab8b3e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002.java @@ -0,0 +1,206 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(String) + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to check include both a pattern that begin with '*' and + * one that end with '*'. + * The cases to test include ModificationWatchpointRequest. + * + * The test works as follows. + * - The debugger + * - sets up two WatchpointRequests, + * - using patterns that begins with '*' and ends with *, + * restricts the Requests, so that, + * first time events will be filtered only from thread1 and + * second time events will be filtered only from thread2, + * - resumes the debuggee, and + * - waits for expected WatchpointEvents. + * - The debuggee creates and starts two threads, thread1 and thread2, + * that being run, generate Events to test the filters. + * - Upon getting the events, the debugger performs checks required. + */ + +public class filter_s002 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002a"; + return new filter_s002().runThis(argv, out); + } + + private String testedClassName1 = "*filter_s002aTestClass11"; + + private String testedClassName2 = + "nsk.jdi.WatchpointRequest.addClassFilter_s.Thread2filter_s002a*"; + + String className1 = "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002aTestClass10"; + String className2 = "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002aTestClass20"; + + protected void testRun() { + if ( !vm.canWatchFieldModification() ) { + display("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String fieldName1 = "var101"; + String fieldName2 = "var201"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(className1).get(0); + + eventRequest1 = setting21ModificationWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_ALL, property1); + + ((ModificationWatchpointRequest) eventRequest1).addClassFilter(testedClassName1); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + case 1: + testClassReference = + (ReferenceType) vm.classesByName(className2).get(0); + + eventRequest2 = setting21ModificationWatchpointRequest (null, + testClassReference, fieldName2, + EventRequest.SUSPEND_ALL, property2); + + ((ModificationWatchpointRequest) eventRequest2).addClassFilter(testedClassName2); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property2) ) { + setFailedStatus("ERROR: property is not : " + property2); + } + } + vm.resume(); + break; + default: + throw new Failure("** default case 2 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting21ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002/TestDescription.java new file mode 100644 index 00000000000..6f7e4c05c71 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addClassFilter_s/filter_s002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(String) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002 + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002a.java new file mode 100644 index 00000000000..4b805545721 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002a.java @@ -0,0 +1,260 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s002 JDI test. + */ + +public class filter_s002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Thread1filter_s002a thread1 = null; + static Thread2filter_s002a thread2 = null; + + static filter_s002aTestClass10 obj10 = new filter_s002aTestClass10(); + static filter_s002aTestClass11 obj11 = new filter_s002aTestClass11(); + + static filter_s002aTestClass20 obj20 = new filter_s002aTestClass20(); + static Thread2filter_s002a.TestClass21 obj21 = new Thread2filter_s002a.TestClass21(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Thread1filter_s002a("thread1"); + log1("run1(thread1);"); + run1(thread1); + + filter_s002aTestClass20.method(); // otherwise filter_s002aTestClass20 is not loaded; bug? + break; + + case 1: + thread2 = new Thread2filter_s002a("thread2"); + log1("run1(thread2);"); + run1(thread2); + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static void run1(Thread t) { + threadStart(t); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } + +} + +class filter_s002aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_s002aTestClass11 extends filter_s002aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; + } +} + +class Thread1filter_s002a extends Thread { + + String tName = null; + + public Thread1filter_s002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s002a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_s002a.waitnotifyObj) { + filter_s002a.waitnotifyObj.notify(); + } + filter_s002aTestClass10.method(); + filter_s002aTestClass11.method(); + filter_s002a.log1(" 'run': exit :: threadName == " + tName); + return; + } +} + +class filter_s002aTestClass20 { + + static int var201 = 0; + static int var202 = 0; + static int var203 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + } +} + +class Thread2filter_s002a extends Thread { + + String tName = null; + + public Thread2filter_s002a(String threadName) { + super(threadName); + tName = threadName; + } + + public void run() { + filter_s002a.log1(" 'run': enter :: threadName == " + tName); + synchronized (filter_s002a.waitnotifyObj) { + filter_s002a.waitnotifyObj.notify(); + } + filter_s002aTestClass20.method(); + TestClass21.method(); + filter_s002a.log1(" 'run': exit :: threadName == " + tName); + return; + } + + static class TestClass21 extends filter_s002aTestClass20 { + + static int var211 = 0; + static int var212 = 0; + static int var213 = 0; + + static void method () { + var201 = 1; + var203 = var201; + var202 = var203; + + var211 = 1; + var213 = var211; + var212 = var213; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003.java new file mode 100644 index 00000000000..cf64ce2b7c2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003.java @@ -0,0 +1,535 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addClassFilter(String)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The cases to test include AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an AccessWatchpointRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s003a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s003aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "AccessWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + eventRequest1 = setting21AccessWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting21AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003/TestDescription.java new file mode 100644 index 00000000000..ffb8c33bfae --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003/TestDescription.java @@ -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/WatchpointRequest/addClassFilter_s/filter_s003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(String) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The cases to test include AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s003; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addClassFilter_s.filter_s003 + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003a.java new file mode 100644 index 00000000000..43ac0e97b76 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003a.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s003 JDI test. + */ + +public class filter_s003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_s003aTestClass10 obj10 = new filter_s003aTestClass10(); + static filter_s003aTestClass11 obj11 = new filter_s003aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ +} + +class filter_s003aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_s003aTestClass11 extends filter_s003aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// filter_s003aTestClass10.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004.java new file mode 100644 index 00000000000..24f96c2c323 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004.java @@ -0,0 +1,535 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addClassFilter(String)
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The cases to test include ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ModificationWatchpointRequest and enables it,
    + * - invokes the method addClassFilter() on the request
    + * expecting to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addClassFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addClassFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class filter_s004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new filter_s004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s004a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s004aTestClass10"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "ModificationWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + eventRequest1 = setting21ModificationWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_NONE, property1); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" no InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addClassFilter(testedClassName1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addClassFilter(testedClassName1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting21ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004/TestDescription.java new file mode 100644 index 00000000000..e335b95b790 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004/TestDescription.java @@ -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/WatchpointRequest/addClassFilter_s/filter_s004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addClassFilter(String) + * complies with its spec: + * public void addClassFilter(String classPattern) + * Restricts the events generated by this request to those + * whose location is in a class + * whose name matches a restricted regular expression. + * Regular expressions are limited to exact matches and patterns + * that begin with '*' or end with '*'; for example, "*.Foo" or "java.*". + * Parameters: classPattern - the pattern String to filter for. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The cases to test include ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s004; + * the debuggee program - nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addClassFilter_s.filter_s004 + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addClassFilter_s.filter_s004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004a.java new file mode 100644 index 00000000000..a9fdb591d03 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004a.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.addClassFilter_s; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the filter_s004 JDI test. + */ + +public class filter_s004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static filter_s004aTestClass10 obj10 = new filter_s004aTestClass10(); + static filter_s004aTestClass11 obj11 = new filter_s004aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ +} + +class filter_s004aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class filter_s004aTestClass11 extends filter_s004aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// filter_s004aTestClass10.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001.java new file mode 100644 index 00000000000..6b54694b2ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001.java @@ -0,0 +1,197 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * This request is AccessWatchpointRequest. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a WatchpointRequest + * within the method in the class TestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordinly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the Watchpoint event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter001a"; + return new instancefilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.TestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + + String fieldName = "var1"; + + Event newEvent = null; + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + eventRequest1 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property1); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + eventRequest2 = setting2AccessWatchpointRequest (thread2, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property2); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + ((WatchpointRequest) eventRequest2).addInstanceFilter(instance); + + display("......waiting for WatchpointEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof WatchpointEvent)) { + setFailedStatus("ERROR: new event is not WatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new WatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001/TestDescription.java new file mode 100644 index 00000000000..ac8c6c8775b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * This request is AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter001; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter001 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001a.java new file mode 100644 index 00000000000..d0867c1cca1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001a.java @@ -0,0 +1,196 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter001 JDI test. + */ + +public class instancefilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter001a thread1 = null; + static Threadinstancefilter001a thread2 = null; + + static TestClass objTC[] = { new TestClass(), new TestClass(), new TestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter001a("thread1"); + thread2 = new Threadinstancefilter001a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter001a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter001a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + + int var1 = 0; + int var2 = 0; + int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002.java new file mode 100644 index 00000000000..ab5a0ca5104 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002.java @@ -0,0 +1,196 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those + * in which the currently executing instance is + * the object specified. + * This request is ModificationWatchpointRequest. + * + * The test works as follows. + * + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates a special array with three Object instances, + * and two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a WatchpointRequest + * within the method in the class instancefilter002aTestClass + * whose array element instances #0 and #1 + * will be calling by the thread1 and the thread2 accordinly, + * - invokes addInstanceFilter() on array element #0 for the thread1 + * and #2 for the thread2, + * thus restricting the Modification event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter002 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002a"; + return new instancefilter002().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002aTestClass"; + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + + String fieldName = "var1"; + + Event newEvent = null; + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + eventRequest1 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property1); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + eventRequest2 = setting2ModificationWatchpointRequest (thread2, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property2); + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(2); + ((WatchpointRequest) eventRequest2).addInstanceFilter(instance); + + display("......waiting for WatchpointEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if ( !(newEvent instanceof WatchpointEvent)) { + setFailedStatus("ERROR: new event is not WatchpointEvent"); + } else { + + String property = (String) newEvent.request().getProperty("number"); + display(" got new WatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002/TestDescription.java new file mode 100644 index 00000000000..649ed43d4e5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002/TestDescription.java @@ -0,0 +1,84 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * This request is ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002a.java new file mode 100644 index 00000000000..5525dcd5d9e --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002a.java @@ -0,0 +1,196 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter002 JDI test. + */ + +public class instancefilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter002a thread1 = null; + static Threadinstancefilter002a thread2 = null; + + static instancefilter002aTestClass objTC[] = { new instancefilter002aTestClass(), new instancefilter002aTestClass(), new instancefilter002aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter002a("thread1"); + thread2 = new Threadinstancefilter002a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter002a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter002a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter002aTestClass { + + static int breakpointLine = 3; + + int var1 = 0; + int var2 = 0; + int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003.java new file mode 100644 index 00000000000..79c7e8e54b5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003.java @@ -0,0 +1,562 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * This request is AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an AccessWatchpointRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter003a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "AccessWatchpointRequest1"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003/TestDescription.java new file mode 100644 index 00000000000..3b74ca779d5 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequestRequest. + * The test checks up that a result of the method + * com.sun.jdi.MethodExitRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * This request is AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter003; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addInstanceFilter.instancefilter003 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003a.java new file mode 100644 index 00000000000..7b177420cac --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003a.java @@ -0,0 +1,183 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter003 JDI test. + */ + +public class instancefilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter003a thread1 = null; + + static instancefilter003aTestClass objTC[] = { new instancefilter003aTestClass(), new instancefilter003aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter003a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter003a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter003a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter003aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004.java new file mode 100644 index 00000000000..4bd8dbf2016 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004.java @@ -0,0 +1,562 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * This request is ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates a ModificationWatchpointRequest and enables it,
    + * - invokes the method addInstanceFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addInstanceFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addInstanceFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter004a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter004aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ModificationWatchpointRequest1"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + + eventRequest1.enable(); + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" no InvalidRequestStateException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" InvalidRequestStateException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004/TestDescription.java new file mode 100644 index 00000000000..7ead0841ac6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004/TestDescription.java @@ -0,0 +1,83 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * This request is ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter004; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addInstanceFilter.instancefilter004 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004a.java new file mode 100644 index 00000000000..b951e6ed189 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004a.java @@ -0,0 +1,183 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter004 JDI test. + */ + +public class instancefilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter004a thread1 = null; + + static instancefilter004aTestClass objTC[] = { new instancefilter004aTestClass(), new instancefilter004aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter004a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter004aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005.java new file mode 100644 index 00000000000..fda553215d7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005.java @@ -0,0 +1,529 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException -
    + * if the target virtual machine
    + * does not support this operation.
    + * This request is AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * a WatchpointRequest and if addInstanceFilter() is not supported,
    + * invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter005a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter005aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "AccessWatchpointRequest1"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005/TestDescription.java new file mode 100644 index 00000000000..fa068169ce6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter005; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addInstanceFilter.instancefilter005 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005a.java new file mode 100644 index 00000000000..1f67260cfd0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005a.java @@ -0,0 +1,183 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter005 JDI test. + */ + +public class instancefilter005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter005a thread1 = null; + + static instancefilter005aTestClass objTC[] = { new instancefilter005aTestClass(), new instancefilter005aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter005a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter005a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter005a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter005aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006.java new file mode 100644 index 00000000000..4343ca0abb8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006.java @@ -0,0 +1,529 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addInstanceFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: UnsupportedOperationException -
    + * if the target virtual machine
    + * does not support this operation.
    + * This request is ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger creates
    + * a ModificationWatchpointRequest and if addInstanceFilter()
    + * is not supported, invokes the method on the request expecting
    + * to catch UnsupportedOperationException.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class instancefilter006 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new instancefilter006().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter006a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter006aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ModificationWatchpointRequest1"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + ObjectReference instance = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, property1); + + instance = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + + if ( vm.canUseInstanceFilters() ) { + log2("......vm.canUseInstanceFilters == true :: test cancelled"); + } else { + + try { + log2("......eventRequest1.addInstanceFilter(instance);"); + log2(" UnsupportedOperationException expected"); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance); + log3("ERROR: no UnsupportedOperationException "); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" UnsupportedOperationException "); + } + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006/TestDescription.java new file mode 100644 index 00000000000..1e7db87c516 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006/TestDescription.java @@ -0,0 +1,82 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter006; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addInstanceFilter.instancefilter006 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006a.java new file mode 100644 index 00000000000..b798f685063 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006a.java @@ -0,0 +1,183 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter006 JDI test. + */ + +public class instancefilter006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter006a thread1 = null; + + static instancefilter006aTestClass objTC[] = { new instancefilter006aTestClass(), new instancefilter006aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter006a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter006a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter006a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter006aTestClass { + + static int breakpointLine = 3; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007.java new file mode 100644 index 00000000000..8d2095bb8f1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007.java @@ -0,0 +1,212 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * This request is AccessWatchpointRequest. + * The case to test includes re-invocation of the method + * addInstanceFilter() on the same AccessWatchpointRequest object. + * There are two AccessWatchpointRequests to check as follows: + * (1) For AccessWatchpointRequest2, both invocations are with different + * ObjectReferences restricting one AccessWatchpoint event to two objects. + * The test expects no AccessWatchpoint event will be received. + * (2) For AccessWatchpointRequest1, both invocations are with the same + * ObjectReference restricting one AccessWatchpoint event to one object. + * The test expects this AccessWatchpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up AccessWatchpointRequests 1&2 within the method + * in the class instancefilter007aTestClass which will be calling by both threads, + * - restricts the AccessWatchpointRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the AccessWatchpointRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter007 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007a"; + return new instancefilter007().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007aTestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + + String fieldName = "var1"; + + Event newEvent = null; + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2AccessWatchpointRequest (thread2, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance1); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance1); + ((WatchpointRequest) eventRequest2).addInstanceFilter(instance1); + ((WatchpointRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for AccessWatchpointEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + EventRequest newEventRequest = newEvent.request(); + if (!(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not WatchpointEvent"); + } else { + display(" got expected event"); + + ThreadReference newEventThread = ((AccessWatchpointEvent) newEvent).thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007/TestDescription.java new file mode 100644 index 00000000000..2bedd09b2a6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same AccessWatchpointRequest object. + * There are two AccessWatchpointRequests to check as follows: + * (1) For AccessWatchpointRequest2, both invocations are with different + * ObjectReferences restricting one AccessWatchpoint event to two objects. + * The test expects no AccessWatchpoint event will be received. + * (2) For AccessWatchpointRequest1, both invocations are with the same + * ObjectReference restricting one AccessWatchpoint event to one object. + * The test expects this AccessWatchpoint event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007a.java new file mode 100644 index 00000000000..bf52ae67c80 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007a.java @@ -0,0 +1,196 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter007 JDI test. + */ + +public class instancefilter007a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter007a thread1 = null; + static Threadinstancefilter007a thread2 = null; + + static instancefilter007aTestClass objTC[] = { new instancefilter007aTestClass(), new instancefilter007aTestClass(), new instancefilter007aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter007a("thread1"); + thread2 = new Threadinstancefilter007a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter007a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter007a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter007aTestClass { + + static int breakpointLine = 3; + + int var1 = 0; + int var2 = 0; + int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008.java new file mode 100644 index 00000000000..e800a5cfa52 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008.java @@ -0,0 +1,210 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * This request is ModificationWatchpointRequest. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same ModificationWatchpointRequest object. + * There are two ModificationWatchpointRequests to check as follows: + * (1) For ModificationWatchpointRequest2, both invocations are with different + * ObjectReferences restricting one ModificationWatchpoint event to two objects. + * The test expects no ModificationWatchpoint event will be received. + * (2) For ModificationWatchpointRequest1, both invocations are with the same + * ObjectReference restricting one ModificationWatchpoint event to one object. + * The test expects this ModificationWatchpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up ModificationWatchpointRequests 1&2 within the method + * in the class instancefilter008aTestClass which will be calling by both threads, + * - restricts the ModificationWatchpointRequest1 to the tread1 and + * to the array elements #0 & #0 calling only within thread1, + * - restricts the ModificationWatchpointRequest2 to the thread2 and + * the array elements #0 & #1 calling within thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class instancefilter008 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008a"; + return new instancefilter008().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008aTestClass"; + + + protected void testRun() { + if ( !vm.canUseInstanceFilters() ) { + display("......vm.canUseInstanceFilters == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + + String fieldName = "var1"; + + Event newEvent = null; + ReferenceType testClassReference = null; + + String arrayName = "objTC"; + + ObjectReference instance1 = null; + ObjectReference instance2 = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2ModificationWatchpointRequest (thread2, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property2); + + instance1 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(0); + instance2 = (ObjectReference) + ((ArrayReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(arrayName)) ).getValue(1); + + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance1); + ((WatchpointRequest) eventRequest1).addInstanceFilter(instance1); + ((WatchpointRequest) eventRequest2).addInstanceFilter(instance1); + ((WatchpointRequest) eventRequest2).addInstanceFilter(instance2); + + display("......waiting for ModificationWatchpointEvent in expected thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if (!(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not WatchpointEvent"); + } else { + display(" got expected event"); + + ThreadReference newEventThread = ((ModificationWatchpointEvent) newEvent).thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008/TestDescription.java new file mode 100644 index 00000000000..963fbc05489 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008/TestDescription.java @@ -0,0 +1,92 @@ +/* + * 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/WatchpointRequest/addInstanceFilter/instancefilter008. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addInstanceFilter() + * complies with its spec: + * public void addInstanceFilter(ObjectReference instance) + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * Not all targets support this operation. + * Use VirtualMachine.canUseInstanceFilters() to determine + * if the operation is supported. + * Parameters: instance - the object which must be the current instance + * in order to pass this filter. + * Throws: UnsupportedOperationException - + * if the target virtual machine does not support this operation. + * InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in which + * the currently executing instance is the object specified. + * The cases to test includes re-invocation of the method + * addInstanceFilter() on the same WatchpointRequest object. + * There are two ModificationWatchpointRequests to check as follows: + * (1) For ModificationWatchpointRequest2, both invocations are with different + * ObjectReferences restricting one ModificationWatchpoint event to two objects. + * The test expects no ModificationWatchpoint event will be received. + * (2) For ModificationWatchpointRequest1, both invocations are with the same + * ObjectReference restricting one ModificationWatchpoint event to one object. + * The test expects this ModificationWatchpoint event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008; + * the debuggee program - nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008 + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addInstanceFilter.instancefilter008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008a.java new file mode 100644 index 00000000000..47b953e5b46 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008a.java @@ -0,0 +1,196 @@ +/* + * 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.WatchpointRequest.addInstanceFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the instancefilter008 JDI test. + */ + +public class instancefilter008a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadinstancefilter008a thread1 = null; + static Threadinstancefilter008a thread2 = null; + + static instancefilter008aTestClass objTC[] = { new instancefilter008aTestClass(), new instancefilter008aTestClass(), new instancefilter008aTestClass() }; + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadinstancefilter008a("thread1"); + thread2 = new Threadinstancefilter008a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("main: synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("main: synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadinstancefilter008a extends Thread { + + String tName = null; + int tNumber; + + public Threadinstancefilter008a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + log1(" objTC[tNumber].method(); :: threadName == " + tName + " tNumber == " + tNumber); + objTC[tNumber].method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class instancefilter008aTestClass { + + static int breakpointLine = 3; + + int var1 = 0; + int var2 = 0; + int var3 = 0; + + public void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001.java new file mode 100644 index 00000000000..882a3cf3724 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001.java @@ -0,0 +1,165 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a WatchpointRequest within the method + * in the class TestClass which will be calling by both threads, + * - restricts the watchpoint event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class addthreadfilter001 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter001a"; + return new addthreadfilter001().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.TestClass"; + + + protected void testRun() { + + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String property1 = "AccessWatchpointRequest1"; + String fieldName = "var1"; + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, "AccessWatchpointRequest1"); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not AccessWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new AccessWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001/TestDescription.java new file mode 100644 index 00000000000..631b3ff4ab2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001/TestDescription.java @@ -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/WatchpointRequest/addThreadFilter/addthreadfilter001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * This request is AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter001; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter001 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001a.java new file mode 100644 index 00000000000..65502ec94a2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001a.java @@ -0,0 +1,197 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter001 JDI test. + */ + +public class addthreadfilter001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter001a thread1 = null; + static Threadaddthreadfilter001a thread2 = null; + + static TestClass objTC = new TestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter001a("thread1"); + thread2 = new Threadaddthreadfilter001a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter001a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter001a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class TestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002.java new file mode 100644 index 00000000000..1bc6e165d43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002.java @@ -0,0 +1,164 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks that results of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up a WatchpointRequest within the method + * in the class TestClass which will be calling by both threads, + * - restricts the watchpoint event only for thread1, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class addthreadfilter002 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002a"; + return new addthreadfilter002().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002aTestClass"; + + protected void testRun() { + + if ( !vm.canWatchFieldModification() ) { + display("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + ThreadReference thread1 = null; + String thread1Name = "thread1"; + String property1 = "ModificationWatchpointRequest1"; + String fieldName = "var1"; + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, "ModificationWatchpointRequest1"); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1}, waitTime, true); + + if ( !(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not ModificationWatchpointEvent"); + } else { + String property = (String) newEvent.request().getProperty("number"); + display(" got new ModificationWatchpointEvent with property 'number' == " + property); + + if ( !property.equals(property1) ) { + setFailedStatus("ERROR: property is not : " + property1); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002/TestDescription.java new file mode 100644 index 00000000000..d3fafec1fe8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002/TestDescription.java @@ -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/WatchpointRequest/addThreadFilter/addthreadfilter002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * This request is ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002a.java new file mode 100644 index 00000000000..56807766120 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002a.java @@ -0,0 +1,197 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter002 JDI test. + */ + +public class addthreadfilter002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter002a thread1 = null; + static Threadaddthreadfilter002a thread2 = null; + + static addthreadfilter002aTestClass objTC = new addthreadfilter002aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter002a("thread1"); + thread2 = new Threadaddthreadfilter002a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter002a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter002a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter002aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003.java new file mode 100644 index 00000000000..3320fc6b274 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003.java @@ -0,0 +1,552 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The test case includes AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an AccessWatchpointRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class addthreadfilter003 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter003().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter003a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter003aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "AccessWatchpointRequest1"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2AccessWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "AccessWatchpointRequest1"); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((AccessWatchpointRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003/TestDescription.java new file mode 100644 index 00000000000..e11281f777a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003/TestDescription.java @@ -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/WatchpointRequest/addThreadFilter/addthreadfilter003. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter003; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter003a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addThreadFilter.addthreadfilter003 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter003a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter003 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003a.java new file mode 100644 index 00000000000..3b725ff511c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003a.java @@ -0,0 +1,185 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter003 JDI test. + */ + +public class addthreadfilter003a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter003a thread1 = null; + + static addthreadfilter003aTestClass objTC = new addthreadfilter003aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter003a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter003a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter003a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter003aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004.java new file mode 100644 index 00000000000..61d8894fd5a --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004.java @@ -0,0 +1,552 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Throws: InvalidRequestStateException -
    + * if this request is currently enabled
    + * or has been deleted.
    + * Filters may be added only to disabled requests.
    + * The test case includes ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new threads, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ModificationWatchpointRequest and enables it,
    + * - invokes the method addThreadFilter() on the request expecting
    + * to catch InvalidRequestStateException,
    + * - disables the request and invokes the method addThreadFilter()
    + * expecting to catch no InvalidRequestStateException,
    + * - deletes the request and invokes the method addThreadFilter()
    + * once again expecting to catch InvalidRequestStateException.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class addthreadfilter004 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter004().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter004a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter004aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldModification() ) { + log2("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ModificationWatchpointRequest1"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "ModificationWatchpointRequest1"); + + log2("......eventRequest1.enable();"); + eventRequest1.enable(); + + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + + log2("......eventRequest1.disable();"); + eventRequest1.disable(); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addThreadFilter(thread1); + log2(" no InvalidRequestStateException"); + } catch ( InvalidRequestStateException e ) { + log3("ERROR: InvalidRequestStateException"); + testExitCode = FAILED; + } + + log2("......eventRManager.deleteEventRequest(eventRequest1);"); + eventRManager.deleteEventRequest(eventRequest1); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" InvalidRequestStateException expected"); + ((ModificationWatchpointRequest)eventRequest1).addThreadFilter(thread1); + log3("ERROR: no InvalidRequestStateException"); + testExitCode = FAILED; + } catch ( InvalidRequestStateException e ) { + log2(" InvalidRequestStateException"); + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004/TestDescription.java new file mode 100644 index 00000000000..4544e3119ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004/TestDescription.java @@ -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/WatchpointRequest/addThreadFilter/addthreadfilter004. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter004; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter004a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addThreadFilter.addthreadfilter004 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter004a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter004 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004a.java new file mode 100644 index 00000000000..3fcd781d203 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004a.java @@ -0,0 +1,185 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter004 JDI test. + */ + +public class addthreadfilter004a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter004a thread1 = null; + + static addthreadfilter004aTestClass objTC = new addthreadfilter004aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter004a("thread1"); + break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter004a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter004a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter004aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005.java new file mode 100644 index 00000000000..7f6ad0d47ef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005.java @@ -0,0 +1,555 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + * The tested Request is AccessWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates AccessWatchpointRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates AccessWatchpointRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates AccessWatchpointRequest3, waits the thread1 to die, and
    + * invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class addthreadfilter005 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter005().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter005a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter005aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldAccess() ) { + log2("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + String property3 = "AccessWatchpointRequest3"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2AccessWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "AccessWatchpointRequest1"); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((AccessWatchpointRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2AccessWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "AccessWatchpointRequest2"); + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((AccessWatchpointRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2AccessWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "AccessWatchpointRequest3"); + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((AccessWatchpointRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005/TestDescription.java new file mode 100644 index 00000000000..b72c8d0c3cf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005/TestDescription.java @@ -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/WatchpointRequest/addThreadFilter/addthreadfilter005. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The tested Request is AccessWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter005; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter005a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addThreadFilter.addthreadfilter005 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter005a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter005 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005a.java new file mode 100644 index 00000000000..f9831d54e43 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005a.java @@ -0,0 +1,188 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter005 JDI test. + */ + +public class addthreadfilter005a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter005a thread1 = null; + + static addthreadfilter005aTestClass objTC = new addthreadfilter005aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter005a("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class Threadaddthreadfilter005a extends Thread { + + public Threadaddthreadfilter005a(String threadName) { + super(threadName); + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class addthreadfilter005aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006.java new file mode 100644 index 00000000000..498a27dff33 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006.java @@ -0,0 +1,555 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.addThreadFilter()
    + * complies with its spec.
    + *
    + * The test checks up on the following assertion:
    + * Restricts the events generated by this request
    + * to those in the given thread.
    + * The cases to test include three thread's states:
    + * not started, running, dead.
    + * The tested Request is ModificationWatchpointRequest.
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee creates new thread, thread1, and invokes
    + * the methodForCommunication to be suspended and
    + * to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates ModificationWatchpointRequest1 and
    + * invokes the method addThreadFilter(tread1) on the request1,
    + * - creates ModificationWatchpointRequest2,
    + * resumes the debuggee to get the thread1 started, and
    + * invokes the method addThreadFilter(thread) on the request2,
    + * - creates ModificationWatchpointRequest3, waits the thread1 to die,
    + * and invokes the method addThreadFilter(thread) on the request3.
    + *
    + * In third phase, at the end of the test,
    + * the debuggee changes the value of the "instruction" which
    + * the debugger and debuggee use to inform each other of needed actions,
    + * and both end. + *
    + */ + +public class addthreadfilter006 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new addthreadfilter006().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter006a"; + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter006aTestClass"; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + if ( !vm.canWatchFieldModification() ) { + log2("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(PASS_BASE); + return; + } + + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + EventRequest eventRequest3 = null; + + ThreadReference thread1 = null; + String thread1Name = "thread1"; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + String property3 = "ModificationWatchpointRequest3"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "ModificationWatchpointRequest1"); + try { + log2("......eventRequest1.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ModificationWatchpointRequest)eventRequest1).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 1: + eventRequest2 = setting2ModificationWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "ModificationWatchpointRequest2"); + try { + log2("......eventRequest2.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ModificationWatchpointRequest)eventRequest2).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + case 2: + eventRequest3 = setting2ModificationWatchpointRequest (null, + testClassReference, fieldName, + EventRequest.SUSPEND_NONE, "ModificationWatchpointRequest3"); + try { + log2("......eventRequest3.addThreadFilter(thread1);"); + log2(" no Exception expected"); + ((ModificationWatchpointRequest)eventRequest3).addThreadFilter(thread1); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + testExitCode = FAILED; + } + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006/TestDescription.java new file mode 100644 index 00000000000..632412c7706 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006/TestDescription.java @@ -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/WatchpointRequest/addThreadFilter/addthreadfilter006. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The cases to test include three thread's states: not started, running, dead. + * The tested Request is ModificationWatchpointRequest. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter006; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter006a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.addThreadFilter.addthreadfilter006 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter006a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter006 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006a.java new file mode 100644 index 00000000000..b6299fce536 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006a.java @@ -0,0 +1,188 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter006 JDI test. + */ + +public class addthreadfilter006a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter006a thread1 = null; + + static addthreadfilter006aTestClass objTC = new addthreadfilter006aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter006a("thread1"); + break; + + case 1: + synchronized (lockObj) { + threadStart(thread1); + log1("methodForCommunication();"); + methodForCommunication(); + } + break; + + case 2: + try { + thread1.join(); + } catch ( InterruptedException e) { + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + static Object lockObj = new Object(); + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static class Threadaddthreadfilter006a extends Thread { + + public Threadaddthreadfilter006a(String threadName) { + super(threadName); + } + + public void run() { + log1(" 'run': enter "); + + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + synchronized (lockObj) { + log1(" 'run': exit "); + } + return; + } + } + +} + +class addthreadfilter006aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007.java new file mode 100644 index 00000000000..e8b7f6268e2 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007.java @@ -0,0 +1,190 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same AccessWatchpointRequest object. + * There are two AccessWatchpointRequests to check as follows: + * (1) For AccessWatchpointRequest2, both invocations are with different + * ThreadReferences restricting one AccessWatchpoint event to two threads. + * The test expects no AccessWatchpoint event will be received. + * (2) For AccessWatchpointRequest1, both invocations are with the same + * ThreadReference restricting one AccessWatchpoint event to one thread. + * The test expects this AccessWatchpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up AccessWatchpointRequests 1&2 within the method + * in the class addthreadfilter007aTestClass which will be calling by both threads, + * - restricts the AccessWatchpointRequest1 only to thread1, + * - restricts the AccessWatchpointRequest2 to both thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class addthreadfilter007 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007a"; + return new addthreadfilter007().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007aTestClass"; + + + protected void testRun() { + if ( !vm.canWatchFieldAccess() ) { + display("......vm.canWatchFieldAccess == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "AccessWatchpointRequest1"; + String property2 = "AccessWatchpointRequest2"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2AccessWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property2); + + ((AccessWatchpointRequest) eventRequest1).addThreadFilter(thread1); + ((AccessWatchpointRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for AccessWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if (!(newEvent instanceof AccessWatchpointEvent)) { + setFailedStatus("ERROR: new event is not WatchpointEvent"); + } else { + display(" got expected event"); + + ThreadReference newEventThread = ((AccessWatchpointEvent) newEvent).thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private AccessWatchpointRequest setting2AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up AccessWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007/TestDescription.java new file mode 100644 index 00000000000..24c3e74bb56 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/WatchpointRequest/addThreadFilter/addthreadfilter007. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The tested Request is AccessWatchpointRequest and + * the cases to test include re-invocations of the method + * addThreadFilter() on the same AccessWatchpointRequest object. + * There are two AccessWatchpointRequests to check as follows: + * (1) For AccessWatchpointRequest2, both invocations are with different + * ThreadReferences restricting one AccessWatchpoint event to two threads. + * The test expects no AccessWatchpoint event will be received. + * (2) For AccessWatchpointRequest1, both invocations are with the same + * ThreadReference restricting one AccessWatchpoint event to one thread. + * The test expects this AccessWatchpoint event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter007 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007a.java new file mode 100644 index 00000000000..e9737904e34 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007a.java @@ -0,0 +1,198 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter007 JDI test. + */ + +public class addthreadfilter007a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter007a thread1 = null; + static Threadaddthreadfilter007a thread2 = null; + + static addthreadfilter007aTestClass objTC = new addthreadfilter007aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter007a("thread1"); + thread2 = new Threadaddthreadfilter007a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter007a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter007a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter007aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008.java new file mode 100644 index 00000000000..130510f45b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008.java @@ -0,0 +1,190 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type + * WatchpointRequest. + * + * The test checks up on the following assertion: + * Restricts the events generated by this request + * to those in the given thread. + * The cases to test include re-invocations of the method + * addThreadFilter() on the same ModificationWatchpointRequest object. + * There are two ModificationWatchpointRequests to check as follows: + * (1) For ModificationWatchpointRequest2, both invocations are with different + * ThreadReferences restricting one ModificationWatchpoint event to two threads. + * The test expects no ModificationWatchpoint event will be received. + * (2) For ModificationWatchpointRequest1, both invocations are with the same + * ThreadReference restricting one ModificationWatchpoint event to one thread. + * The test expects this ModificationWatchpoint event will be received. + * + * The test works as follows. + * - The debugger resumes the debuggee and waits for the BreakpointEvent. + * - The debuggee creates two threads, thread1 and thread2, and invokes + * the methodForCommunication to be suspended and + * to inform the debugger with the event. + * - Upon getting the BreakpointEvent, the debugger + * - sets up ModificationWatchpointRequests 1&2 within the method + * in the class addthreadfilter008aTestClass which will be calling by both threads, + * - restricts the ModificationWatchpointRequest1 only to thread1, + * - restricts the ModificationWatchpointRequest2 to both thread1 and thread2, + * - resumes debuggee's main thread, and + * - waits for the event. + * - Debuggee's main thread starts both threads. + * - Upon getting the event, the debugger performs the checks required. + */ + +public class addthreadfilter008 extends TestDebuggerType1 { + + public static void main (String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run (String argv[], PrintStream out) { + debuggeeName = "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008a"; + return new addthreadfilter008().runThis(argv, out); + } + + private String testedClassName = + "nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008aTestClass"; + + + protected void testRun() { + if ( !vm.canWatchFieldModification() ) { + display("......vm.canWatchFieldModification == false :: test cancelled"); + vm.exit(Consts.JCK_STATUS_BASE); + return; + } + + EventRequest eventRequest1 = null; + EventRequest eventRequest2 = null; + + ThreadReference thread1 = null; + ThreadReference thread2 = null; + + String thread1Name = "thread1"; + String thread2Name = "thread2"; + + String property1 = "ModificationWatchpointRequest1"; + String property2 = "ModificationWatchpointRequest2"; + + String fieldName = "var1"; + + ReferenceType testClassReference = null; + Event newEvent = null; + + for (int i = 0; ; i++) { + + if (!shouldRunAfterBreakpoint()) { + vm.resume(); + break; + } + + display(":::::: case: # " + i); + + switch (i) { + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName).get(0); + + thread1 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread1Name)); + thread2 = (ThreadReference) debuggeeClass.getValue( + debuggeeClass.fieldByName(thread2Name)); + + eventRequest1 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property1); + eventRequest2 = setting2ModificationWatchpointRequest (thread1, + testClassReference, fieldName, + EventRequest.SUSPEND_ALL, property2); + + ((ModificationWatchpointRequest) eventRequest1).addThreadFilter(thread1); + ((ModificationWatchpointRequest) eventRequest2).addThreadFilter(thread2); + + display("......waiting for ModificationWatchpointEvent in tested thread"); + newEvent = eventHandler.waitForRequestedEvent(new EventRequest[]{eventRequest1, eventRequest2}, waitTime, true); + + if (!(newEvent instanceof ModificationWatchpointEvent)) { + setFailedStatus("ERROR: new event is not WatchpointEvent"); + } else { + display(" got expected event"); + + ThreadReference newEventThread = ((ModificationWatchpointEvent) newEvent).thread(); + String threadName = newEventThread.name(); + display(" the event is in thread == " + newEventThread.name()); + if ( !newEventThread.equals(thread1) ) { + setFailedStatus("ERROR: the event is not in thread1"); + } + } + vm.resume(); + break; + + default: + throw new Failure("** default case 1 **"); + } + } + return; + } + + private ModificationWatchpointRequest setting2ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType testedClass, + String fieldName, + int suspendPolicy, + String property ) { + try { + display("......setting up ModificationWatchpointRequest:"); + display(" thread: " + thread + "; class: " + testedClass + "; fieldName: " + fieldName); + Field field = testedClass.fieldByName(fieldName); + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + display(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + throw new Failure("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008/TestDescription.java new file mode 100644 index 00000000000..aa236d990df --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008/TestDescription.java @@ -0,0 +1,85 @@ +/* + * 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/WatchpointRequest/addThreadFilter/addthreadfilter008. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.addThreadFilter() + * complies with its spec: + * public void addThreadFilter(ThreadReference thread) + * Restricts the events generated by this request to those in the given thread. + * Parameters: thread - the thread to filter on. + * Throws: InvalidRequestStateException - + * if this request is currently enabled or has been deleted. + * Filters may be added only to disabled requests. + * The test checks up on the following assertion: + * Restricts the events generated by this request to those in the given thread. + * The tested Request is ModificationWatchpointRequest and + * the cases to test include re-invocations of the method + * addThreadFilter() on the same ModificationWatchpointRequest object. + * There are two ModificationWatchpointRequests to check as follows: + * (1) For ModificationWatchpointRequest2, both invocations are with different + * ThreadReferences restricting one ModificationWatchpoint event to two threads. + * The test expects no ModificationWatchpoint event will be received. + * (2) For ModificationWatchpointRequest1, both invocations are with the same + * ThreadReference restricting one ModificationWatchpoint event to one thread. + * The test expects this ModificationWatchpoint event will be received. + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008; + * the debuggee program - nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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: + * 4930911 TEST_BUG: filter_rt006 debuggee has a race + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008 + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.addThreadFilter.addthreadfilter008 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008a.java new file mode 100644 index 00000000000..8eeb68ac3c1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008a.java @@ -0,0 +1,198 @@ +/* + * 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.WatchpointRequest.addThreadFilter; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the addthreadfilter008 JDI test. + */ + +public class addthreadfilter008a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + private static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static Threadaddthreadfilter008a thread1 = null; + static Threadaddthreadfilter008a thread2 = null; + + static addthreadfilter008aTestClass objTC = new addthreadfilter008aTestClass(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: + thread1 = new Threadaddthreadfilter008a("thread1"); + thread2 = new Threadaddthreadfilter008a("thread2"); + break; + + case 1: + threadStart(thread1); + threadStart(thread2); + synchronized(lockingObj[0]) { + log1("synchronized(lockingObj[0])"); + } + synchronized(lockingObj[1]) { + log1("synchronized(lockingObj[1])"); + } + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } + + + + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + static Object lockingObj[] = new Object[2]; + static volatile int number = 0; + + static class Threadaddthreadfilter008a extends Thread { + + String tName = null; + int tNumber; + + public Threadaddthreadfilter008a(String threadName) { + super(threadName); + tName = threadName; + tNumber = number; + number++; + lockingObj[tNumber] = threadName; + } + + public void run() { + log1(" 'run': enter :: threadName == " + tName); + if (lockingObj[tNumber] == null) + log1("lockingObj[tNumber] == null"); + synchronized(lockingObj[tNumber]) { + synchronized (waitnotifyObj) { + waitnotifyObj.notify(); + } + objTC.method(); + } + log1(" 'run': exit :: threadName == " + tName); + return; + } + } + +} + +class addthreadfilter008aTestClass { + + static int breakpointLine = 3; + static String awFieldName = "var1"; + static String mwFieldName = "var2"; + + static int var1 = 0; + static int var2 = 0; + static int var3 = 0; + + static void method () { + var1 = 1; + var3 = var1; + var2 = var3; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001.java new file mode 100644 index 00000000000..3746a3b4eb3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001.java @@ -0,0 +1,510 @@ +/* + * 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.WatchpointRequest.field; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.field()
    + * complies with its spec.
    + *
    + * The case to test include AccessWatchpointRequest.
    + * The test checks if a Field object, an argument of the method
    + * EventRequestManager.createAccessWatchpointRequest(Field),
    + * is equal to one returned by the method WatchpointRequest.field()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an AccessWatchpointRequest and gets Field object filed1,
    + * - gets Field object field2 with the method WatchpointRequest.field(),
    + * - compares the Filed objects.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class field001 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/field/field001 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new field001().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.field.field001a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.field.TestClass10"; + + Field field1 = null; + Field field2 = null; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "AccessWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + log2("......setting up AccessWatchpointRequest and getting Field object field1"); + eventRequest1 = setting21AccessWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_NONE, property1); + + log2("......getting: field2 = ((WatchpointRequest) eventRequest1).field();"); + field2 = ((WatchpointRequest) eventRequest1).field(); + + log2(" checking up on equality of field1 and field2"); + if ( !field1.equals(field2) ) { + testExitCode = FAILED; + log3("ERROR: Field objects are not equal"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private AccessWatchpointRequest setting21AccessWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up AccessWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + field1 = field; + + AccessWatchpointRequest + awr = eventRManager.createAccessWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" AccessWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingAccessWatchpointRequest() : " + e); + log3(" AccessWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001/TestDescription.java new file mode 100644 index 00000000000..89593b3641f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001/TestDescription.java @@ -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/WatchpointRequest/field/field001. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.field() + * complies with its spec: + * public Field field() + * Gets the Field being watched by this WatchpointRequest. + * Returns: the Field this Watchpoint is monitoring. + * The case to test include AccessWatchpointRequest. + * The test checks if a Field object, + * an argument of the method EventRequestManager.createAccessWatchpointRequest(Field), + * is equal to one returned by the method WatchpointRequest.field() + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.field.field001; + * the debuggee program - nsk.jdi.WatchpointRequest.field.field001a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.field.field001 + * nsk.jdi.WatchpointRequest.field.field001a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.field.field001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001a.java new file mode 100644 index 00000000000..375e84573ed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field001a.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.field; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the field001 JDI test. + */ + +public class field001a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static TestClass10 obj10 = new TestClass10(); + static TestClass11 obj11 = new TestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ +} + +class TestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class TestClass11 extends TestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// TestClass10.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002.java new file mode 100644 index 00000000000..1e09ff899b8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002.java @@ -0,0 +1,511 @@ +/* + * 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.WatchpointRequest.field; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; +import java.io.*; + +/** + * The test for the implementation of an object of the type
    + * WatchpointRequest.
    + *
    + * The test checks that results of the method
    + * com.sun.jdi.WatchpointRequest.field()
    + * complies with its spec.
    + *
    + * The case to test include ModificationWatchpointRequest.
    + * The test checks if a Field object, an argument of the method
    + * EventRequestManager.createModificationWatchpointRequest(Field),
    + * is equal to one returned by the method WatchpointRequest.field()
    + *
    + * The test has three phases and works as follows.
    + *
    + * In first phase,
    + * upon launching debuggee's VM which will be suspended,
    + * a debugger waits for the VMStartEvent within a predefined
    + * time interval. If no the VMStartEvent received, the test is FAILED.
    + * Upon getting the VMStartEvent, it makes the request for debuggee's
    + * ClassPrepareEvent with SUSPEND_EVENT_THREAD, resumes the VM,
    + * and waits for the event within the predefined time interval.
    + * If no the ClassPrepareEvent received, the test is FAILED.
    + * Upon getting the ClassPrepareEvent,
    + * the debugger sets up the breakpoint with SUSPEND_EVENT_THREAD
    + * within debuggee's special methodForCommunication().
    + *
    + * In second phase to check the assertion,
    + * the debugger and the debuggee perform the following.
    + * - The debugger resumes the debuggee and waits for the BreakpointEvent.
    + * - The debuggee invokes the methodForCommunication to be suspended
    + * and to inform the debugger with the event.
    + * - Upon getting the BreakpointEvent, the debugger
    + * - creates an ModificationWatchpointRequest and
    + * gets Field object filed1,
    + * - gets Field object field2 with the method WatchpointRequest.field(),
    + * - compares the Filed objects.
    + *
    + * In third phase, at the end of the test, the debuggee changes
    + * the value of the "instruction" which the debugger and debuggee
    + * use to inform each other of needed actions, and both end.
    + *
    + */ + +public class field002 { + + //----------------------------------------------------- templete section + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + //----------------------------------------------------- templete parameters + static final String + sHeader1 = "\n==> nsk/jdi/WatchpointRequest/field/field002 ", + sHeader2 = "--> debugger: ", + sHeader3 = "##> debugger: "; + + //----------------------------------------------------- main method + + public static void main (String argv[]) { + + int result = run(argv, System.out); + + System.exit(result + PASS_BASE); + } + + public static int run (String argv[], PrintStream out) { + + int exitCode = new field002().runThis(argv, out); + + if (exitCode != PASSED) { + System.out.println("TEST FAILED"); + } + return testExitCode; + } + + //-------------------------------------------------- log procedures + + private static Log logHandler; + + private static void log1(String message) { + logHandler.display(sHeader1 + message); + } + private static void log2(String message) { + logHandler.display(sHeader2 + message); + } + private static void log3(String message) { + logHandler.complain(sHeader3 + message); + } + + // ************************************************ test parameters + + private String debuggeeName = + "nsk.jdi.WatchpointRequest.field.field002a"; + + private String testedClassName1 = + "nsk.jdi.WatchpointRequest.field.field002aTestClass10"; + + Field field1 = null; + Field field2 = null; + + //====================================================== test program + //------------------------------------------------------ common section + + static Debugee debuggee; + static ArgumentHandler argsHandler; + + static int waitTime; + + static VirtualMachine vm = null; + static EventRequestManager eventRManager = null; + static EventQueue eventQueue = null; + static EventSet eventSet = null; + static EventIterator eventIterator = null; + + static ReferenceType debuggeeClass = null; + + static int testExitCode = PASSED; + + + class JDITestRuntimeException extends RuntimeException { + JDITestRuntimeException(String str) { + super("JDITestRuntimeException : " + str); + } + } + + //------------------------------------------------------ methods + + private int runThis (String argv[], PrintStream out) { + + argsHandler = new ArgumentHandler(argv); + logHandler = new Log(out, argsHandler); + Binder binder = new Binder(argsHandler, logHandler); + + waitTime = argsHandler.getWaitTime() * 60000; + + try { + log2("launching a debuggee :"); + log2(" " + debuggeeName); + if (argsHandler.verbose()) { + debuggee = binder.bindToDebugee(debuggeeName + " -vbs"); + } else { + debuggee = binder.bindToDebugee(debuggeeName); + } + if (debuggee == null) { + log3("ERROR: no debuggee launched"); + return FAILED; + } + log2("debuggee launched"); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + log2(" test cancelled"); + return FAILED; + } + + debuggee.redirectOutput(logHandler); + + vm = debuggee.VM(); + + eventQueue = vm.eventQueue(); + if (eventQueue == null) { + log3("ERROR: eventQueue == null : TEST ABORTED"); + vm.exit(PASS_BASE); + return FAILED; + } + + log2("invocation of the method runTest()"); + switch (runTest()) { + + case 0 : log2("test phase has finished normally"); + log2(" waiting for the debuggee to finish ..."); + debuggee.waitFor(); + + log2("......getting the debuggee's exit status"); + int status = debuggee.getStatus(); + if (status != PASS_BASE) { + log3("ERROR: debuggee returned UNEXPECTED exit status: " + + status + " != PASS_BASE"); + testExitCode = FAILED; + } else { + log2("......debuggee returned expected exit status: " + + status + " == PASS_BASE"); + } + break; + + default : log3("ERROR: runTest() returned unexpected value"); + + case 1 : log3("test phase has not finished normally: debuggee is still alive"); + log2("......forcing: vm.exit();"); + testExitCode = FAILED; + try { + vm.exit(PASS_BASE); + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + + case 2 : log3("test cancelled due to VMDisconnectedException"); + log2("......trying: vm.process().destroy();"); + testExitCode = FAILED; + try { + Process vmProcess = vm.process(); + if (vmProcess != null) { + vmProcess.destroy(); + } + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + } + break; + } + + return testExitCode; + } + + + /* + * Return value: 0 - normal end of the test + * 1 - ubnormal end of the test + * 2 - VMDisconnectedException while test phase + */ + + private int runTest() { + + try { + testRun(); + + log2("waiting for VMDeathEvent"); + getEventSet(); + if (eventIterator.nextEvent() instanceof VMDeathEvent) + return 0; + + log3("ERROR: last event is not the VMDeathEvent"); + return 1; + } catch ( VMDisconnectedException e ) { + log3("ERROR: VMDisconnectedException : " + e); + return 2; + } catch ( Exception e ) { + log3("ERROR: Exception : " + e); + return 1; + } + + } + + private void testRun() + throws JDITestRuntimeException, Exception { + + eventRManager = vm.eventRequestManager(); + + ClassPrepareRequest cpRequest = eventRManager.createClassPrepareRequest(); + cpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + cpRequest.addClassFilter(debuggeeName); + + cpRequest.enable(); + vm.resume(); + getEventSet(); + cpRequest.disable(); + + ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next(); + debuggeeClass = event.referenceType(); + + if (!debuggeeClass.name().equals(debuggeeName)) + throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **"); + + log2(" received: ClassPrepareEvent for debuggeeClass"); + + String bPointMethod = "methodForCommunication"; + String lineForComm = "lineForComm"; + + ThreadReference mainThread = threadByName("main"); + + BreakpointRequest bpRequest = settingBreakpoint(mainThread, + debuggeeClass, + bPointMethod, lineForComm, "zero"); + bpRequest.enable(); + + //------------------------------------------------------ testing section + + log1(" TESTING BEGINS"); + + EventRequest eventRequest1 = null; + String property1 = "ModificationWatchpointRequest1"; + String fieldName1 = "var101"; + + ReferenceType testClassReference = null; + + + for (int i = 0; ; i++) { + + vm.resume(); + breakpointForCommunication(); + + int instruction = ((IntegerValue) + (debuggeeClass.getValue(debuggeeClass.fieldByName("instruction")))).value(); + + if (instruction == 0) { + vm.resume(); + break; + } + + + log1(":::::: case: # " + i); + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part + + switch (i) { + + case 0: + testClassReference = + (ReferenceType) vm.classesByName(testedClassName1).get(0); + + log2(".....setting up ModificationWatchpointRequest and getting Field object field1"); + eventRequest1 = setting21ModificationWatchpointRequest (null, + testClassReference, fieldName1, + EventRequest.SUSPEND_NONE, property1); + + log2("......getting: field2 = ((WatchpointRequest) eventRequest1).field();"); + field2 = ((WatchpointRequest) eventRequest1).field(); + + log2(" checking up on equality of field1 and field2"); + if ( !field1.equals(field2) ) { + testExitCode = FAILED; + log3("ERROR: Field objects are not equal"); + } + + break; + + default: + throw new JDITestRuntimeException("** default case 2 **"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + log1(" TESTING ENDS"); + return; + } + + private ThreadReference threadByName(String name) + throws JDITestRuntimeException { + + List all = vm.allThreads(); + ListIterator li = all.listIterator(); + + for (; li.hasNext(); ) { + ThreadReference thread = (ThreadReference) li.next(); + if (thread.name().equals(name)) + return thread; + } + throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); + } + + /* + * private BreakpointRequest settingBreakpoint(ThreadReference, ReferenceType, + * String, String, String) + * + * It sets up a breakpoint at given line number within a given method in a given class + * for a given thread. + * + * Return value: BreakpointRequest object in case of success + * + * JDITestRuntimeException in case of an Exception thrown within the method + */ + + private BreakpointRequest settingBreakpoint ( ThreadReference thread, + ReferenceType testedClass, + String methodName, + String bpLine, + String property) + throws JDITestRuntimeException { + + log2("......setting up a breakpoint:"); + log2(" thread: " + thread + "; class: " + testedClass + + "; method: " + methodName + "; line: " + bpLine); + + List alllineLocations = null; + Location lineLocation = null; + BreakpointRequest breakpRequest = null; + + try { + Method method = (Method) testedClass.methodsByName(methodName).get(0); + + alllineLocations = method.allLineLocations(); + + int n = + ( (IntegerValue) testedClass.getValue(testedClass.fieldByName(bpLine) ) ).value(); + if (n > alllineLocations.size()) { + log3("ERROR: TEST_ERROR_IN_settingBreakpoint(): number is out of bound of method's lines"); + } else { + lineLocation = (Location) alllineLocations.get(n); + try { + breakpRequest = eventRManager.createBreakpointRequest(lineLocation); + breakpRequest.putProperty("number", property); + breakpRequest.addThreadFilter(thread); + breakpRequest.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD); + } catch ( Exception e1 ) { + log3("ERROR: inner Exception within settingBreakpoint() : " + e1); + breakpRequest = null; + } + } + } catch ( Exception e2 ) { + log3("ERROR: ATTENTION: outer Exception within settingBreakpoint() : " + e2); + breakpRequest = null; + } + + if (breakpRequest == null) { + log2(" A BREAKPOINT HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("**FAILURE to set up a breakpoint**"); + } + + log2(" a breakpoint has been set up"); + return breakpRequest; + } + + + private void getEventSet() + throws JDITestRuntimeException { + try { +// log2(" eventSet = eventQueue.remove(waitTime);"); + eventSet = eventQueue.remove(waitTime); + if (eventSet == null) { + throw new JDITestRuntimeException("** TIMEOUT while waiting for event **"); + } +// log2(" eventIterator = eventSet.eventIterator;"); + eventIterator = eventSet.eventIterator(); + } catch ( Exception e ) { + throw new JDITestRuntimeException("** EXCEPTION while waiting for event ** : " + e); + } + } + + + private void breakpointForCommunication() + throws JDITestRuntimeException { + + log2("breakpointForCommunication"); + getEventSet(); + + if (eventIterator.nextEvent() instanceof BreakpointEvent) + return; + + throw new JDITestRuntimeException("** event IS NOT a breakpoint **"); + } + + // ============================== test's additional methods + + private ModificationWatchpointRequest setting21ModificationWatchpointRequest ( + ThreadReference thread, + ReferenceType fieldClass, + String fieldName, + int suspendPolicy, + String property ) + throws JDITestRuntimeException { + try { + log2("......setting up ModificationWatchpointRequest:"); + log2(" thread: " + thread + "; fieldClass: " + fieldClass + "; fieldName: " + fieldName); + Field field = fieldClass.fieldByName(fieldName); + + field1 = field; + + ModificationWatchpointRequest + awr = eventRManager.createModificationWatchpointRequest(field); + awr.putProperty("number", property); + + if (thread != null) + awr.addThreadFilter(thread); + awr.setSuspendPolicy(suspendPolicy); + + log2(" ModificationWatchpointRequest has been set up"); + return awr; + } catch ( Exception e ) { + log3("ERROR: ATTENTION: Exception within settingModificationWatchpointRequest() : " + e); + log3(" ModificationWatchpointRequest HAS NOT BEEN SET UP"); + throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); + } + } + +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002/TestDescription.java new file mode 100644 index 00000000000..e7053acf918 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002/TestDescription.java @@ -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/WatchpointRequest/field/field002. + * VM Testbase keywords: [quick, jpda, jdi] + * VM Testbase readme: + * DESCRIPTION: + * The test for the implementation of an object of the type + * WatchpointRequest. + * The test checks up that a result of the method + * com.sun.jdi.WatchpointRequest.field() + * complies with its spec: + * public Field field() + * Gets the Field being watched by this WatchpointRequest. + * Returns: the Field this Watchpoint is monitoring. + * The case to test include ModificationWatchpointRequest. + * The test checks if a Field object, + * an argument of the method EventRequestManager.createModificationWatchpointRequest(Field), + * is equal to one returned by the method WatchpointRequest.field() + * The test works as follows: + * The debugger program - nsk.jdi.WatchpointRequest.field.field002; + * the debuggee program - nsk.jdi.WatchpointRequest.field.field002a. + * Using nsk.jdi.share classes, + * the debugger gets the debuggee running on another JavaVM, + * creates the object debuggee.VM, and waits for VMStartEvent. + * Upon getting the debuggee VM started, + * the debugger calls corresponding debuggee.VM methods to get + * needed data and to perform checks. + * 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.WatchpointRequest.field.field002 + * nsk.jdi.WatchpointRequest.field.field002a + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.WatchpointRequest.field.field002 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002a.java new file mode 100644 index 00000000000..1ccb944aed0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/WatchpointRequest/field/field002a.java @@ -0,0 +1,172 @@ +/* + * 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.WatchpointRequest.field; + +import nsk.share.*; +import nsk.share.jpda.*; +import nsk.share.jdi.*; + +/** + * This class is used as debuggee application for the field002 JDI test. + */ + +public class field002a { + + //----------------------------------------------------- templete section + + static final int PASSED = 0; + static final int FAILED = 2; + static final int PASS_BASE = 95; + + static ArgumentHandler argHandler; + static Log log; + + //-------------------------------------------------- log procedures + + public static void log1(String message) { + log.display("**> debuggee: " + message); + } + + private static void logErr(String message) { + log.complain("**> debuggee: " + message); + } + + //====================================================== test program + + static field002aTestClass10 obj10 = new field002aTestClass10(); + static field002aTestClass11 obj11 = new field002aTestClass11(); + + //------------------------------------------------------ common section + + static int exitCode = PASSED; + + static int instruction = 1; + static int end = 0; + // static int quit = 0; + // static int continue = 2; + static int maxInstr = 1; // 2; + + static int lineForComm = 2; + + private static void methodForCommunication() { + int i1 = instruction; + int i2 = i1; + int i3 = i2; + } + //---------------------------------------------------- main method + + public static void main (String argv[]) { + + argHandler = new ArgumentHandler(argv); + log = argHandler.createDebugeeLog(); + + log1("debuggee started!"); + + label0: + for (int i = 0; ; i++) { + + log1("methodForCommunication();"); + methodForCommunication(); + if (instruction == end) + break; + + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + + switch (i) { + + //------------------------------------------------------ section tested + + case 0: +// break; + + //------------------------------------------------- standard end section + + default: + instruction = end; + break; + } + } + + log1("debuggee exits"); + System.exit(exitCode + PASS_BASE); + } +/* + static Object waitnotifyObj = new Object(); + + static int threadStart(Thread t) { + synchronized (waitnotifyObj) { + t.start(); + try { + waitnotifyObj.wait(); + } catch ( Exception e) { + exitCode = FAILED; + logErr(" Exception : " + e ); + return FAILED; + } + } + return PASSED; + } + + public void run1(Thread t) { + t.start(); + try { + t.join(); + } catch ( InterruptedException e ) { + } + } +*/ +} + +class field002aTestClass10 { + static int var101 = 0; + static int var102 = 0; + static int var103 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + } +} +class field002aTestClass11 extends field002aTestClass10 { + + static int var111 = 0; + static int var112 = 0; + static int var113 = 0; + + static void method () { + var101 = 1; + var103 = var101; + var102 = var103; + + var111 = 1; + var113 = var111; + var112 = var113; +// field002aTestClass10.method(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/ClassPrepareEvents/ClassPrepareEvents001/ClassPrepareEvents001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/ClassPrepareEvents/ClassPrepareEvents001/ClassPrepareEvents001.java new file mode 100644 index 00000000000..e4d8961cb77 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/ClassPrepareEvents/ClassPrepareEvents001/ClassPrepareEvents001.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2007, 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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/ClassPrepareEvents/ClassPrepareEvents001. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6, quarantine] + * VM Testbase comments: JDK-6426321 + * VM Testbase readme: + * DESCRIPTION + * Test covers bug 6426321. Test stress event queue forcing loading of 3000 classes in debuggee. + * Debugger in loop sends commad to debuggee to load class and waits READY answer. + * Test passes if no hangs or any other errors occur in debuggee (if debuggee successfully sends answers for all commands). + * (number of classes to load can be changed through parameter -classesToLoad (for example -classesToLoad 1000)). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.jdi.stress.ClassPrepareEvents.ClassPrepareEvents001.ClassPrepareEvents001 + * @run main/othervm PropertyResolvingWrapper + * nsk.jdi.stress.ClassPrepareEvents.ClassPrepareEvents001.ClassPrepareEvents001 + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + */ + +package nsk.jdi.stress.ClassPrepareEvents.ClassPrepareEvents001; + +import java.io.*; +import java.util.ArrayList; +import nsk.share.*; +import nsk.share.jdi.*; +import nsk.share.jpda.AbstractDebuggeeTest; + +public class ClassPrepareEvents001 extends TestDebuggerType2 { + public static void main(String argv[]) { + System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + } + + public static int run(String argv[], PrintStream out) { + return new ClassPrepareEvents001().runIt(argv, out); + } + + protected String[] doInit(String args[], PrintStream out) { + args = super.doInit(args, out); + + ArrayList standardArgs = new ArrayList(); + + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-classesToLoad") && (i < args.length - 1)) { + classesToLoad = Integer.parseInt(args[i + 1]); + i++; + } else + standardArgs.add(args[i]); + } + + return standardArgs.toArray(new String[] {}); + } + + protected String debuggeeClassName() { + if (classpath == null) + throw new TestBug("Debugger requires 'testClassPath' parameter"); + + return AbstractJDIDebuggee.class.getName() + " -testClassPath " + classpath; + } + + private int classesToLoad = 3000; + + public void doTest() { + log.display("Debugger forces debuggee to load " + classesToLoad + " classes"); + + // force loading of 'classesToLoad' classes in debuggee VM + for (int i = 0; i < classesToLoad; i++) { + pipe.println(AbstractDebuggeeTest.COMMAND_LOAD_CLASS + ":" + TestClass1.class.getName()); + if (!isDebuggeeReady()) + return; + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/MonitorEvents/MonitorEvents001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/MonitorEvents/MonitorEvents001/TestDescription.java new file mode 100644 index 00000000000..59d117049a3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/MonitorEvents/MonitorEvents001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/MonitorEvents/MonitorEvents001. + * VM Testbase keywords: [stress, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for following jdi events and event requests: + * - MonitorContendedEnteredRequest/MonitorContendedEnteredEvent + * - MonitorContendedEnterRequest/MonitorContendedEnterEvent + * - MonitorWaitRequest/MonitorWaitEvent + * - MonitorWaitedRequest/MonitorWaitedEvent + * Debugger forces debuggee generate several thousands of monitor events and checks that all events was received and contain + * correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint, all event generators save information about generated events + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 500 and threadsNumber to 1, but because of framework design each requested + * MonitorEnterEvent and MonitorEnteredEvent should be generated in 3 different way(through synchronized block, synchronized method + * and JNI MonitorEnter), and by 3 different threads, so actual number of this events is (eventsNumber * 9) and + * actual number of threads generating this events is (threadsNumber * 3). + * MonitorWait and MonitorWaited events are generated by 3 different threads and each MonitorWaited event should be generated for 4 cases: + * thread exits from wait() after timeout, waiting thread is waked up with notify() or notifyAll(), or waiting thread + * is interrupted with interrupt(), so actual number of this events is (eventsNumber * 12), and actual number of threads generating this events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED:MONITOR_CONTENTED_ENTER + * -allowExtraEvents MONITOR_CONTENTED_ENTER:MONITOR_CONTENTED_ENTERED + * -eventTypes MONITOR_CONTENTED_ENTERED:MONITOR_CONTENTED_ENTER:MONITOR_WAIT:MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 100 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/MonitorEvents/MonitorEvents002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/MonitorEvents/MonitorEvents002/TestDescription.java new file mode 100644 index 00000000000..0581f8dced6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/MonitorEvents/MonitorEvents002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open java.base/jdk.internal.misc:+open + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/MonitorEvents/MonitorEvents002. + * VM Testbase keywords: [stress, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This is stress test for following jdi events and event requests: + * - MonitorContendedEnteredRequest/MonitorContendedEnteredEvent + * - MonitorContendedEnterRequest/MonitorContendedEnterEvent + * - MonitorWaitRequest/MonitorWaitEvent + * - MonitorWaitedRequest/MonitorWaitedEvent + * Debugger force debuggee start several threads which simultaneously generate events and check that all events + * was received and contain correct information. + * Test executes class nsk.share.jdi.EventTestTemplates$StressTestTemplate which uses JDI events testing + * framework based on classes from package nsk.share.jdi.*. + * This framework uses following scenario: + * - debugger VM forces debuggee VM to create number of objects which should generate events during test + * - debuggee performs event generation and stop at breakpoint, all event generators save information about generated events + * - debugger reads data saved by debuggee's event generators and checks is only expected events was generated + * Stress test template allows to specify number of events which should be generated during test execution(parameter -eventsNumber) + * and number of threads which simultaneously generate events (parameter -threadsNumber). + * This test set eventsNumber to 50 and threadsNumber to 10, but because of framework design each requested + * MonitorEnterEvent and MonitorEnteredEvent should be generated in 3 different way(through synchronized block, synchronized method + * and JNI MonitorEnter), and by 3 different threads, so actual number of this events is (eventsNumber * 9) and + * actual number of threads generating this events is (threadsNumber * 3). + * MonitorWait and MonitorWaited events are generated by 3 different threads and each MonitorWaited event should be generated for 4 cases: + * thread exits from wait() after timeout, waiting thread is waked up with notify() or notifyAll(), or waiting thread + * is interrupted with interrupt(), so actual number of this events is (eventsNumber * 12), and actual number of threads generating this events is (threadsNumber * 3). + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.EventTestTemplates$StressTestTemplate + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -allowMissedEvents MONITOR_CONTENTED_ENTERED:MONITOR_CONTENTED_ENTER + * -allowExtraEvents MONITOR_CONTENTED_ENTER:MONITOR_CONTENTED_ENTERED + * -eventTypes MONITOR_CONTENTED_ENTERED:MONITOR_CONTENTED_ENTER:MONITOR_WAIT:MONITOR_WAITED + * -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + * -eventsNumber 10 + * -threadsNumber 2 + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/TestDescription.java new file mode 100644 index 00000000000..c77f621ac01 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/TestDescription.java @@ -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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/forceEarlyReturn001. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'forceEarlyReturn001.tests' and tests are executed in given order. + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from forceEarlyReturn001.tests + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014a + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./forceEarlyReturn001.tests + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/forceEarlyReturn001.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/forceEarlyReturn001.tests new file mode 100644 index 00000000000..b58a2ffaeef --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/forceEarlyReturn001.tests @@ -0,0 +1,8 @@ +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java new file mode 100644 index 00000000000..e59c810490d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/forceEarlyReturn002. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'forceEarlyReturn002.tests', before execution test list is shuffled and tests are executed + * in random order, resulted test order is saved in file 'run.tests', to reproduce failed test execute it + * with option '-configFile run.tests'(instead of -configFile forceEarlyReturn002.tests). + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from forceEarlyReturn002.tests + * @build nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014a + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./forceEarlyReturn002.tests + * -testWorkDir . + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/forceEarlyReturn002.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/forceEarlyReturn002.tests new file mode 100644 index 00000000000..36baf61f6dd --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/forceEarlyReturn002.tests @@ -0,0 +1,9 @@ +OPTIONS:shuffle +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn005.forceEarlyReturn005 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn008.forceEarlyReturn008 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn013.forceEarlyReturn013 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn014.forceEarlyReturn014 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java new file mode 100644 index 00000000000..3b925d509e7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java @@ -0,0 +1,65 @@ +/* + * 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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/heapwalking001. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'heapwalking001.tests' and tests are executed in given order. + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from heapwalking001.tests + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 + * nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003a + * nsk.jdi.ObjectReference.referringObjects.referringObjects004.referringObjects004 + * nsk.jdi.ReferenceType.instances.instances003.instances003 + * nsk.share.jdi.TestClass1 + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestClass2 + * nsk.share.jdi.TestInterfaceImplementer1 + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./heapwalking001.tests + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/heapwalking001.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/heapwalking001.tests new file mode 100644 index 00000000000..f727d6b2cda --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/heapwalking001.tests @@ -0,0 +1,5 @@ +nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 +nsk.jdi.ObjectReference.referringObjects.referringObjects004.referringObjects004 +nsk.jdi.ReferenceType.instances.instances003.instances003 -testClassNames java.lang.String:nsk.share.jdi.TestClass1:boolean[] +nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 +nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 -forceGC diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking002/TestDescription.java new file mode 100644 index 00000000000..2c6cc6a2121 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking002/TestDescription.java @@ -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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/heapwalking002. + * VM Testbase keywords: [stress, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'heapwalkin002.tests', before execution test list is shuffled and tests are executed + * in random order, resulted test order is saved in file 'run.tests', to reproduce failed test execute it + * with option '-configFile run.tests'(instead of -configFile heapwalking002.tests). + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from heapwalking002.tests + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 + * nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003a + * nsk.jdi.ObjectReference.referringObjects.referringObjects004.referringObjects004 + * nsk.jdi.ReferenceType.instances.instances003.instances003 + * nsk.share.jdi.TestClass1 + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestClass2 + * nsk.share.jdi.TestInterfaceImplementer1 + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./heapwalking002.tests + * -testWorkDir . + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking002/heapwalking002.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking002/heapwalking002.tests new file mode 100644 index 00000000000..066ad40c267 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking002/heapwalking002.tests @@ -0,0 +1,6 @@ +OPTIONS:shuffle +nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 +nsk.jdi.ObjectReference.referringObjects.referringObjects004.referringObjects004 +nsk.jdi.ReferenceType.instances.instances003.instances003 -testClassNames java.lang.String:nsk.share.jdi.TestClass1:boolean[] +nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 +nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 -forceGC diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed001/TestDescription.java new file mode 100644 index 00000000000..3397778dd12 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed001/TestDescription.java @@ -0,0 +1,75 @@ +/* + * 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 + * @modules jdk.jdi/com.sun.tools.jdi:+open + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/mixed001. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'mixed001.tests' and tests are executed in given order. + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from mixed001.tests + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 + * nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003a + * nsk.jdi.ReferenceType.instances.instances003.instances003 + * nsk.share.jdi.TestClass1 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004a + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + * nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 + * nsk.share.jdi.TestClass1 + * nsk.share.jdi.TestClass2 + * nsk.share.jdi.TestInterfaceImplementer1 + * nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./mixed001.tests + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed001/mixed001.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed001/mixed001.tests new file mode 100644 index 00000000000..e4c49c96f1f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed001/mixed001.tests @@ -0,0 +1,15 @@ +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAIT -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAITED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + +nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 +nsk.jdi.ReferenceType.instances.instances003.instances003 -testClassNames java.lang.String:nsk.share.jdi.TestClass1:boolean[] +nsk.jdi.VirtualMachine.instanceCounts.instancecounts001.instancecounts001 + +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java new file mode 100644 index 00000000000..192a98dde45 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java @@ -0,0 +1,74 @@ +/* + * 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 + * @modules jdk.jdi/com.sun.tools.jdi:+open + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/mixed002. + * VM Testbase keywords: [stress, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'mixed002.tests', before execution test list is shuffled and tests are executed + * in random order, resulted test order is saved in file 'run.tests', to reproduce failed test execute it + * with option '-configFile run.tests'(instead of -configFile mixed002.tests). + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from mixed002.tests + * @build nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 + * nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003a + * nsk.jdi.ReferenceType.instances.instances003.instances003 + * nsk.share.jdi.TestClass1 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 + * nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004a + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + * nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=-Xmx128M ${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./mixed002.tests + * -testWorkDir . + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed002/mixed002.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed002/mixed002.tests new file mode 100644 index 00000000000..02eecb9625f --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/mixed002/mixed002.tests @@ -0,0 +1,15 @@ +OPTIONS:shuffle +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAIT -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAITED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee + +nsk.jdi.ObjectReference.referringObjects.referringObjects003.referringObjects003 +nsk.jdi.ReferenceType.instances.instances003.instances003 -testClassNames java.lang.String:nsk.share.jdi.TestClass1:boolean[] + +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn003.forceEarlyReturn003 +nsk.jdi.ThreadReference.forceEarlyReturn.forceEarlyReturn004.forceEarlyReturn004 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents001/TestDescription.java new file mode 100644 index 00000000000..f43557b5df4 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents001/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/monitorEvents001. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'monitorEvents001.tests' and tests are executed in given order. + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from monitorEvents001.tests + * @build nsk.share.jdi.EventTestTemplates + * + * @build nsk.share.jdi.SerialExecutionDebugger + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./monitorEvents001.tests + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents001/monitorEvents001.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents001/monitorEvents001.tests new file mode 100644 index 00000000000..fe54bc37eed --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents001/monitorEvents001.tests @@ -0,0 +1,10 @@ +nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_1Subclass:nsk.share.jdi.MonitorEnterExecutor_2Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_1Subclass:nsk.share.jdi.MonitorEnterExecutor_2Subclass +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAIT -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAITED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents002/TestDescription.java new file mode 100644 index 00000000000..0e0283cf5a7 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents002/TestDescription.java @@ -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 + * @modules jdk.jdi/com.sun.tools.jdi:+open + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/monitorEvents002. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'monitorEvents002.tests', before execution test list is shuffled and tests are executed + * in random order, resulted test order is saved in file 'run.tests', to reproduce failed test execute it + * with option '-configFile run.tests'(instead of -configFile monitorEvents002.tests). + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from monitorEvents002.tests + * @build nsk.share.jdi.EventTestTemplates + * nsk.share.jdi.JDIEventsDebuggee + * nsk.share.jdi.MonitorEventsDebuggee + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./monitorEvents002.tests + * -testWorkDir . + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents002/monitorEvents002.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents002/monitorEvents002.tests new file mode 100644 index 00000000000..34d11de48c0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/monitorEvents002/monitorEvents002.tests @@ -0,0 +1,11 @@ +OPTIONS:shuffle +nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassExclusionFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ClassName -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_*:*Subclass:nsk.share.jdi.MonitorEnterExecutor_1Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_1Subclass:nsk.share.jdi.MonitorEnterExecutor_2Subclass +nsk.share.jdi.EventTestTemplates$ClassFilterTest_ReferenceType -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee -classPatterns nsk.share.jdi.MonitorEnterExecutor_1Subclass:nsk.share.jdi.MonitorEnterExecutor_2Subclass +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTERED -eventType MONITOR_CONTENTED_ENTERED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -allowMissedEvents MONITOR_CONTENTED_ENTER -eventType MONITOR_CONTENTED_ENTER -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAIT -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee +nsk.share.jdi.EventTestTemplates$ThreadFilterTest -eventType MONITOR_WAITED -debuggeeClassName nsk.share.jdi.MonitorEventsDebuggee diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/TestDescription.java new file mode 100644 index 00000000000..a3667ec89bb --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/TestDescription.java @@ -0,0 +1,64 @@ +/* + * 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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/ownedMonitorsAndFrames001. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'ownedMonitorsAndFrames001.tests' and tests are executed in given order. + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from ownedMonitorsAndFrames001.tests + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003.ownedMonitorsAndFrames003 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004a + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005.ownedMonitorsAndFrames005 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006.ownedMonitorsAndFrames006 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009 + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./ownedMonitorsAndFrames001.tests + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.tests new file mode 100644 index 00000000000..3f88f41f4b3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.tests @@ -0,0 +1,8 @@ +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003.ownedMonitorsAndFrames003 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005.ownedMonitorsAndFrames005 -expectJNIMonitors +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006.ownedMonitorsAndFrames006 -testThreadsCount 5 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 -testThreadsCount 5 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/TestDescription.java new file mode 100644 index 00000000000..479c8802f1c --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/TestDescription.java @@ -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 + * @key stress + * + * @summary converted from VM Testbase nsk/jdi/stress/serial/ownedMonitorsAndFrames002. + * VM Testbase keywords: [stress, quick, jpda, jdi, feature_jdk6_jpda, vm6] + * VM Testbase readme: + * DESCRIPTION + * This test executes one after another several JDI tests in single VM + * (for detailed description see nsk.share.jdi.SerialExecutionDebugger and nsk.share.jdi.SerialExecutionDebuggee). + * Tests to execute are specified in file 'ownedMonitorsAndFrames002.tests', before execution test list is shuffled and tests are executed + * in random order, resulted test order is saved in file 'run.tests', to reproduce failed test execute it + * with option '-configFile run.tests'(instead of -configFile ownedMonitorsAndFrames002.tests). + * Test is treated as FAILED if at least one of executed tests failed. + * + * @library /vmTestbase + * /test/lib + * @run driver jdk.test.lib.FileInstaller . . + * + * @comment build classes required for tests from ownedMonitorsAndFrames002.tests + * @build nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003.ownedMonitorsAndFrames003 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004a + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005.ownedMonitorsAndFrames005 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006.ownedMonitorsAndFrames006 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009 + * nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009a + * + * @build nsk.share.jdi.SerialExecutionDebugger + * @run main/othervm/native PropertyResolvingWrapper + * nsk.share.jdi.SerialExecutionDebugger + * -verbose + * -arch=${os.family}-${os.simpleArch} + * -waittime=5 + * -debugee.vmkind=java + * -transport.address=dynamic + * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" + * -testClassPath ${test.class.path} + * -configFile ./ownedMonitorsAndFrames002.tests + * -testWorkDir . + */ + diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.tests b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.tests new file mode 100644 index 00000000000..a76b4839ae1 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.tests @@ -0,0 +1,9 @@ +OPTIONS:shuffle +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames001.ownedMonitorsAndFrames001 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames002.ownedMonitorsAndFrames002 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames003.ownedMonitorsAndFrames003 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames004.ownedMonitorsAndFrames004 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames005.ownedMonitorsAndFrames005 -expectJNIMonitors +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames006.ownedMonitorsAndFrames006 -testThreadsCount 5 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames007.ownedMonitorsAndFrames007 -testThreadsCount 5 +nsk.jdi.ThreadReference.ownedMonitorsAndFrames.ownedMonitorsAndFrames009.ownedMonitorsAndFrames009 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java new file mode 100644 index 00000000000..162f8fa84c6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java @@ -0,0 +1,96 @@ +/* + * 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. + */ + +package nsk.share; + +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Utils; +import jdk.test.lib.process.ProcessTools; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.stream.Stream; + +public class ExtraClassesBuilder { + public static void main(String[] args) { + String[] javacOpts = Arrays.stream(args) + .takeWhile(s -> s.startsWith("-")) + .toArray(String[]::new); + + Arrays.stream(args) + .dropWhile(s -> s.startsWith("-")) + .forEach(s -> ExtraClassesBuilder.compile(s, javacOpts)); + } + + private static void compile(String name, String[] args) { + Path src = Paths.get(Utils.TEST_SRC) + .resolve(name) + .toAbsolutePath(); + if (Files.notExists(src)) { + throw new Error(src + " doesn't exist"); + } + Path dst = Paths.get("bin") + .resolve(Paths.get(name).getFileName()) + .toAbsolutePath(); + try { + Files.createDirectories(dst); + } catch (IOException e) { + throw new Error("can't create dir " + dst, e); + } + JDKToolLauncher javac = JDKToolLauncher.create("javac") + .addToolArg("-d") + .addToolArg(dst.toString()) + .addToolArg("-cp") + .addToolArg(Utils.TEST_CLASS_PATH); + + for (String arg : args) { + javac.addToolArg(arg); + } + + try (Stream stream = Files.walk(src)) { + stream.map(Path::toAbsolutePath) + .map(Path::toString) + .filter(s -> s.endsWith(".java")) + .forEach(javac::addToolArg); + } catch (IOException e) { + throw new Error("traverse dir " + src, e); + } + + executeTool(javac); + } + + private static void executeTool(JDKToolLauncher tool) { + String[] command = tool.getCommand(); + try { + ProcessTools.executeCommand(command) + .shouldHaveExitValue(0); + } catch (Error | RuntimeException e) { + throw e; + } catch (Throwable e) { + throw new Error("execution of " + Arrays.toString(command) + " failed", e); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/libMonitorEnterExecutor.c b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/libMonitorEnterExecutor.c new file mode 100644 index 00000000000..db9236055d0 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/libMonitorEnterExecutor.c @@ -0,0 +1,25 @@ +/* + * 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. + */ + +#include "nsk_tools.c" +#include "MonitorEnterExecutor.c" diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/libJNIreferences.c b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/libJNIreferences.c new file mode 100644 index 00000000000..d5bcd73b9c8 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/libJNIreferences.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017, 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. + */ + +#include "JNIreferences.c" +#include "nsk_tools.c" diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/NativeMethodsTestThread.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/NativeMethodsTestThread.java new file mode 100644 index 00000000000..c373e023bbf --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/NativeMethodsTestThread.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2007, 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.share.jpda; + +import java.net.*; +import nsk.share.*; + +/* + * This thread class executes in loop native methods with different return types + */ +public class NativeMethodsTestThread extends Thread { + + static { + System.loadLibrary("NativeMethodsTestThread"); + } + + native void VoidMethod(String message); + + native boolean BooleanMethod(String message); + + native byte ByteMethod(String message); + + native short ShortMethod(String message); + + native char CharMethod(String message); + + native int IntMethod(String message); + + native long LongMethod(String message); + + native float FloatMethod(String message); + + native double DoubleMethod(String message); + + native Object[] ObjectArrayMethod(String message); + + native String StringMethod(String message); + + native Thread ThreadMethod(String message); + + native ThreadGroup ThreadGroupMethod(String message); + + native Class ClassObjectMethod(String message); + + native ClassLoader ClassLoaderMethod(String message); + + native Object ObjectMethod(String message); + + native Boolean BooleanWrapperMethod(String message); + + native Byte ByteWrapperMethod(String message); + + native Short ShortWrapperMethod(String message); + + native Character CharWrapperMethod(String message); + + native Integer IntWrapperMethod(String message); + + native Long LongWrapperMethod(String message); + + native Float FloatWrapperMethod(String message); + + native Double DoubleWrapperMethod(String message); + + private void log(String message) { + log.display(message); + } + + public static boolean expectedBooleanValue = Boolean.TRUE; + + public static byte expectedByteValue = Byte.MAX_VALUE; + + public static char expectedCharValue = Character.MAX_VALUE; + + public static short expectedShortValue = Short.MAX_VALUE; + + public static int expectedIntValue = Integer.MAX_VALUE; + + public static long expectedLongValue = Long.MAX_VALUE; + + public static float expectedFloatValue = Float.MAX_VALUE; + + public static double expectedDoubleValue = Double.MAX_VALUE; + + public static Object[] expectedObjectArrayValue = new Object[1000]; + + public static Thread expectedThreadValue = new Thread(); + + public static ThreadGroup expectedThreadGroupValue = new ThreadGroup("Expected thread group"); + + public static Class expectedClassObjectValue = NativeMethodsTestThread.class; + + public static ClassLoader expectedClassLoaderValue = new URLClassLoader(new URL[] {}); + + public static String expectedStringValue = "EXPECTED STRING"; + + public static Object expectedObjectValue = new Object(); + + public static Boolean expectedBooleanWrapperValue = new Boolean(Boolean.TRUE); + + public static Byte expectedByteWrapperValue = new Byte(Byte.MAX_VALUE); + + public static Character expectedCharWrapperValue = new Character(Character.MAX_VALUE); + + public static Short expectedShortWrapperValue = new Short(Short.MAX_VALUE); + + public static Integer expectedIntWrapperValue = new Integer(Integer.MAX_VALUE); + + public static Long expectedLongWrapperValue = new Long(Long.MAX_VALUE); + + public static Float expectedFloatWrapperValue = new Float(Float.MAX_VALUE); + + public static Double expectedDoubleWrapperValue = new Double(Double.MAX_VALUE); + + // names of tested types, this names can be used to derive names of tested methods(typeName + 'Method'), + public static String testedTypesNames[] = {"Void", "Boolean", "Byte", "Short", "Char", "Int", "Long", "Float", "Double", "ObjectArray", + "String", "Thread", "ThreadGroup", "ClassObject", "ClassLoader", "Object", "BooleanWrapper", "ByteWrapper", "ShortWrapper", + "CharWrapper", "IntWrapper", "LongWrapper", "FloatWrapper", "DoubleWrapper" }; + + private Log log; + + // is forceEarlyReturn would called for this thread + private boolean isTestThread; + + // how many times call all test methods + private int iterationsNumber = 1; + + // test thread wait on 'startExecutionWicket' in beginning of run() + private Wicket startExecutionWicket = new Wicket(); + + private boolean success = true; + + public NativeMethodsTestThread(Log log, boolean isTestThread, int iterationNumber) { + this.log = log; + this.isTestThread = isTestThread; + + this.iterationsNumber = iterationNumber; + } + + private volatile boolean stopExecution; + + public void stopExecution() { + stopExecution = true; + } + + public void startExecuion() { + startExecutionWicket.unlockAll(); + } + + public void run() { + // first, debuggee VM starts and suspends test threads to let debugger initialize breakpoints + startExecutionWicket.waitFor(); + + int iterationCount = 0; + + // test thread executes test methods 'iterationNumber' times + // non-test thread execute until not interrupted + while ((iterationCount++ < iterationsNumber) || (!isTestThread && !stopExecution)) { + // execute test methods in order given in 'testMethodsNames' array + for (int i = 0; i < testedTypesNames.length; i++) { + executeMethod(testedTypesNames[i] + "Method"); + } + } + + log("Test thread exit"); + } + + // execute test method and check that correct value is returned + private void executeMethod(String methodName) { + String message = Thread.currentThread() + " in " + methodName; + if (methodName.equals("VoidMethod")) { + VoidMethod(message); + } + if (methodName.equals("BooleanMethod")) { + boolean result = BooleanMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ByteMethod")) { + byte result = ByteMethod(message); + + log("Result: " + result); + } + if (methodName.equals("CharMethod")) { + char result = CharMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ShortMethod")) { + short result = ShortMethod(message); + + log("Result: " + result); + } + if (methodName.equals("IntMethod")) { + int result = IntMethod(message); + + log("Result: " + result); + } + if (methodName.equals("LongMethod")) { + long result = LongMethod(message); + + log("Result: " + result); + } + if (methodName.equals("FloatMethod")) { + float result = FloatMethod(message); + + log("Result: " + result); + } + if (methodName.equals("DoubleMethod")) { + double result = DoubleMethod(message); + + log("Result: " + result); + } + if (methodName.equals("StringMethod")) { + String result = StringMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ObjectMethod")) { + Object result = ObjectMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ObjectArrayMethod")) { + Object[] result = ObjectArrayMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ThreadMethod")) { + Thread result = ThreadMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ThreadGroupMethod")) { + ThreadGroup result = ThreadGroupMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ClassObjectMethod")) { + Class result = ClassObjectMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ClassLoaderMethod")) { + ClassLoader result = ClassLoaderMethod(message); + + log("Result: " + result); + } + if (methodName.equals("BooleanWrapperMethod")) { + Boolean result = BooleanWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ByteWrapperMethod")) { + Byte result = ByteWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("ShortWrapperMethod")) { + Short result = ShortWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("CharWrapperMethod")) { + Character result = CharWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("IntWrapperMethod")) { + Integer result = IntWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("LongWrapperMethod")) { + Long result = LongWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("FloatWrapperMethod")) { + Float result = FloatWrapperMethod(message); + + log("Result: " + result); + } + if (methodName.equals("DoubleWrapperMethod")) { + Double result = DoubleWrapperMethod(message); + + log("Result: " + result); + } + } + + public boolean getSuccess() { + return success; + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/libNativeMethodsTestThread.c b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/libNativeMethodsTestThread.c new file mode 100644 index 00000000000..caf6e73f652 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/libNativeMethodsTestThread.c @@ -0,0 +1,527 @@ +/* + * Copyright (c) 2007, 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. + */ +#include "jni.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef JNI_ENV_PTR + +#ifdef __cplusplus +#define JNI_ENV_ARG_2(x, y) y +#define JNI_ENV_ARG_3(x, y, z) y, z +#define JNI_ENV_ARG_4(x, y, z, a) y, z, a +#define JNI_ENV_PTR(x) x +#else +#define JNI_ENV_ARG_2(x,y) x, y +#define JNI_ENV_ARG_3(x, y, z) x, y, z +#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a +#define JNI_ENV_PTR(x) (*x) +#endif + +#endif + +static void logMessage(JNIEnv *env, jobject thisObject, jstring message) +{ + jclass klass; + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + JNI_ENV_PTR(env)->CallVoidMethod( + JNI_ENV_ARG_4( + env, + thisObject, + JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, klass, "log", "(Ljava/lang/String;)V")), + message)); +} + +JNIEXPORT void JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_VoidMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + logMessage(env, thisObject, message); +} + +JNIEXPORT jboolean JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_BooleanMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedBooleanValue", + "Z")); + + return JNI_ENV_PTR(env)->GetStaticBooleanField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jbyte JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ByteMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedByteValue", + "B")); + + return JNI_ENV_PTR(env)->GetStaticByteField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jshort JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ShortMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedShortValue", + "S")); + + return JNI_ENV_PTR(env)->GetStaticShortField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jchar JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_CharMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedCharValue", + "C")); + + return JNI_ENV_PTR(env)->GetStaticCharField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jint JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_IntMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedIntValue", + "I")); + + return JNI_ENV_PTR(env)->GetStaticIntField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jlong JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_LongMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedLongValue", + "J")); + + return JNI_ENV_PTR(env)->GetStaticLongField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jfloat JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_FloatMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedFloatValue", + "F")); + + return JNI_ENV_PTR(env)->GetStaticFloatField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jdouble JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_DoubleMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedDoubleValue", + "D")); + + return JNI_ENV_PTR(env)->GetStaticDoubleField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ObjectArrayMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedObjectArrayValue", + "[Ljava/lang/Object;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_StringMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedStringValue", + "Ljava/lang/String;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ThreadMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedThreadValue", + "Ljava/lang/Thread;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ThreadGroupMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedThreadGroupValue", + "Ljava/lang/ThreadGroup;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ClassObjectMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedClassObjectValue", + "Ljava/lang/Class;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ClassLoaderMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedClassLoaderValue", + "Ljava/lang/ClassLoader;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ObjectMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedObjectValue", + "Ljava/lang/Object;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_BooleanWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedBooleanWrapperValue", + "Ljava/lang/Boolean;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ByteWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedByteWrapperValue", + "Ljava/lang/Byte;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_ShortWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedShortWrapperValue", + "Ljava/lang/Short;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_CharWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedCharWrapperValue", + "Ljava/lang/Character;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_IntWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedIntWrapperValue", + "Ljava/lang/Integer;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_LongWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedLongWrapperValue", + "Ljava/lang/Long;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_FloatWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedFloatWrapperValue", + "Ljava/lang/Float;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +JNIEXPORT jobject JNICALL +Java_nsk_share_jpda_NativeMethodsTestThread_DoubleWrapperMethod(JNIEnv *env, + jobject thisObject, jstring message) +{ + jclass klass; + jfieldID valueField; + + logMessage(env, thisObject, message); + + klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject)); + + valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4( + env, + klass, + "expectedDoubleWrapperValue", + "Ljava/lang/Double;")); + + return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField)); +} + +#ifdef __cplusplus +} +#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/libJNIMonitorLocker.c b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/libJNIMonitorLocker.c new file mode 100644 index 00000000000..85f46f45307 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/libJNIMonitorLocker.c @@ -0,0 +1,25 @@ +/* + * 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. + */ + +#include "nsk_tools.c" +#include "JNIMonitorLocker.c" diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/libLockingThread.c b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/libLockingThread.c new file mode 100644 index 00000000000..0eef28071c3 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/libLockingThread.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017, 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. + */ + +#include "LockingThread.c" +#include "nsk_tools.c" diff --git a/test/jdk/com/sun/crypto/provider/KeyAgreement/DHGenSecretKey.java b/test/jdk/com/sun/crypto/provider/KeyAgreement/DHGenSecretKey.java deleted file mode 100644 index d77dc6b0da9..00000000000 --- a/test/jdk/com/sun/crypto/provider/KeyAgreement/DHGenSecretKey.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2005, 2017, 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 - * @bug 4936763 - * @summary Verify that DHKeyAgreement can generate secret key - * objects for AES algorithm - * @author Valerie Peng - * @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true DHGenSecretKey - */ -import java.security.*; -import java.security.interfaces.*; -import javax.crypto.*; - -public class DHGenSecretKey { - - public static void main(String[] args) throws Exception { - DHGenSecretKey test = new DHGenSecretKey(); - test.run(); - } - - public void run() throws Exception { - // generate keyPairs using parameters - KeyPairGenerator keyGen = - KeyPairGenerator.getInstance("DH", "SunJCE"); - - // Alice generates her key pairs - KeyPair keyA = keyGen.generateKeyPair(); - - // Bob generates his key pairs - KeyPair keyB = keyGen.generateKeyPair(); - - KeyAgreement bobAlice = KeyAgreement.getInstance("DH", "SunJCE"); - bobAlice.init(keyB.getPrivate()); - bobAlice.doPhase(keyA.getPublic(), true); - byte[] keyMaterial = bobAlice.generateSecret(); - - bobAlice.doPhase(keyA.getPublic(), true); - SecretKey skey = bobAlice.generateSecret("AES"); - byte[] keyVal = skey.getEncoded(); - - System.out.println("Generated " + keyVal.length*8 + - "-bit AES key"); - for (int i = 0; i < keyVal.length; i++) { - if (keyVal[i] != keyMaterial[i]) { - throw new Exception("Error: key value comparison failed!"); - } - } - System.out.println("Test Passed"); - } -} diff --git a/test/jdk/java/lang/Character/Blocks.txt b/test/jdk/java/lang/Character/Blocks.txt new file mode 100644 index 00000000000..8406c531eda --- /dev/null +++ b/test/jdk/java/lang/Character/Blocks.txt @@ -0,0 +1,316 @@ +# Blocks-10.0.0.txt +# Date: 2017-04-12, 17:30:00 GMT [KW] +# Copyright (c) 2017 Unicode, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# +# Unicode Character Database +# For documentation, see http://www.unicode.org/reports/tr44/ +# +# Format: +# Start Code..End Code; Block Name + +# ================================================ + +# Note: When comparing block names, casing, whitespace, hyphens, +# and underbars are ignored. +# For example, "Latin Extended-A" and "latin extended a" are equivalent. +# For more information on the comparison of property values, +# see UAX #44: http://www.unicode.org/reports/tr44/ +# +# All block ranges start with a value where (cp MOD 16) = 0, +# and end with a value where (cp MOD 16) = 15. In other words, +# the last hexadecimal digit of the start of range is ...0 +# and the last hexadecimal digit of the end of range is ...F. +# This constraint on block ranges guarantees that allocations +# are done in terms of whole columns, and that code chart display +# never involves splitting columns in the charts. +# +# All code points not explicitly listed for Block +# have the value No_Block. + +# Property: Block +# +# @missing: 0000..10FFFF; No_Block + +0000..007F; Basic Latin +0080..00FF; Latin-1 Supplement +0100..017F; Latin Extended-A +0180..024F; Latin Extended-B +0250..02AF; IPA Extensions +02B0..02FF; Spacing Modifier Letters +0300..036F; Combining Diacritical Marks +0370..03FF; Greek and Coptic +0400..04FF; Cyrillic +0500..052F; Cyrillic Supplement +0530..058F; Armenian +0590..05FF; Hebrew +0600..06FF; Arabic +0700..074F; Syriac +0750..077F; Arabic Supplement +0780..07BF; Thaana +07C0..07FF; NKo +0800..083F; Samaritan +0840..085F; Mandaic +0860..086F; Syriac Supplement +08A0..08FF; Arabic Extended-A +0900..097F; Devanagari +0980..09FF; Bengali +0A00..0A7F; Gurmukhi +0A80..0AFF; Gujarati +0B00..0B7F; Oriya +0B80..0BFF; Tamil +0C00..0C7F; Telugu +0C80..0CFF; Kannada +0D00..0D7F; Malayalam +0D80..0DFF; Sinhala +0E00..0E7F; Thai +0E80..0EFF; Lao +0F00..0FFF; Tibetan +1000..109F; Myanmar +10A0..10FF; Georgian +1100..11FF; Hangul Jamo +1200..137F; Ethiopic +1380..139F; Ethiopic Supplement +13A0..13FF; Cherokee +1400..167F; Unified Canadian Aboriginal Syllabics +1680..169F; Ogham +16A0..16FF; Runic +1700..171F; Tagalog +1720..173F; Hanunoo +1740..175F; Buhid +1760..177F; Tagbanwa +1780..17FF; Khmer +1800..18AF; Mongolian +18B0..18FF; Unified Canadian Aboriginal Syllabics Extended +1900..194F; Limbu +1950..197F; Tai Le +1980..19DF; New Tai Lue +19E0..19FF; Khmer Symbols +1A00..1A1F; Buginese +1A20..1AAF; Tai Tham +1AB0..1AFF; Combining Diacritical Marks Extended +1B00..1B7F; Balinese +1B80..1BBF; Sundanese +1BC0..1BFF; Batak +1C00..1C4F; Lepcha +1C50..1C7F; Ol Chiki +1C80..1C8F; Cyrillic Extended-C +1CC0..1CCF; Sundanese Supplement +1CD0..1CFF; Vedic Extensions +1D00..1D7F; Phonetic Extensions +1D80..1DBF; Phonetic Extensions Supplement +1DC0..1DFF; Combining Diacritical Marks Supplement +1E00..1EFF; Latin Extended Additional +1F00..1FFF; Greek Extended +2000..206F; General Punctuation +2070..209F; Superscripts and Subscripts +20A0..20CF; Currency Symbols +20D0..20FF; Combining Diacritical Marks for Symbols +2100..214F; Letterlike Symbols +2150..218F; Number Forms +2190..21FF; Arrows +2200..22FF; Mathematical Operators +2300..23FF; Miscellaneous Technical +2400..243F; Control Pictures +2440..245F; Optical Character Recognition +2460..24FF; Enclosed Alphanumerics +2500..257F; Box Drawing +2580..259F; Block Elements +25A0..25FF; Geometric Shapes +2600..26FF; Miscellaneous Symbols +2700..27BF; Dingbats +27C0..27EF; Miscellaneous Mathematical Symbols-A +27F0..27FF; Supplemental Arrows-A +2800..28FF; Braille Patterns +2900..297F; Supplemental Arrows-B +2980..29FF; Miscellaneous Mathematical Symbols-B +2A00..2AFF; Supplemental Mathematical Operators +2B00..2BFF; Miscellaneous Symbols and Arrows +2C00..2C5F; Glagolitic +2C60..2C7F; Latin Extended-C +2C80..2CFF; Coptic +2D00..2D2F; Georgian Supplement +2D30..2D7F; Tifinagh +2D80..2DDF; Ethiopic Extended +2DE0..2DFF; Cyrillic Extended-A +2E00..2E7F; Supplemental Punctuation +2E80..2EFF; CJK Radicals Supplement +2F00..2FDF; Kangxi Radicals +2FF0..2FFF; Ideographic Description Characters +3000..303F; CJK Symbols and Punctuation +3040..309F; Hiragana +30A0..30FF; Katakana +3100..312F; Bopomofo +3130..318F; Hangul Compatibility Jamo +3190..319F; Kanbun +31A0..31BF; Bopomofo Extended +31C0..31EF; CJK Strokes +31F0..31FF; Katakana Phonetic Extensions +3200..32FF; Enclosed CJK Letters and Months +3300..33FF; CJK Compatibility +3400..4DBF; CJK Unified Ideographs Extension A +4DC0..4DFF; Yijing Hexagram Symbols +4E00..9FFF; CJK Unified Ideographs +A000..A48F; Yi Syllables +A490..A4CF; Yi Radicals +A4D0..A4FF; Lisu +A500..A63F; Vai +A640..A69F; Cyrillic Extended-B +A6A0..A6FF; Bamum +A700..A71F; Modifier Tone Letters +A720..A7FF; Latin Extended-D +A800..A82F; Syloti Nagri +A830..A83F; Common Indic Number Forms +A840..A87F; Phags-pa +A880..A8DF; Saurashtra +A8E0..A8FF; Devanagari Extended +A900..A92F; Kayah Li +A930..A95F; Rejang +A960..A97F; Hangul Jamo Extended-A +A980..A9DF; Javanese +A9E0..A9FF; Myanmar Extended-B +AA00..AA5F; Cham +AA60..AA7F; Myanmar Extended-A +AA80..AADF; Tai Viet +AAE0..AAFF; Meetei Mayek Extensions +AB00..AB2F; Ethiopic Extended-A +AB30..AB6F; Latin Extended-E +AB70..ABBF; Cherokee Supplement +ABC0..ABFF; Meetei Mayek +AC00..D7AF; Hangul Syllables +D7B0..D7FF; Hangul Jamo Extended-B +D800..DB7F; High Surrogates +DB80..DBFF; High Private Use Surrogates +DC00..DFFF; Low Surrogates +E000..F8FF; Private Use Area +F900..FAFF; CJK Compatibility Ideographs +FB00..FB4F; Alphabetic Presentation Forms +FB50..FDFF; Arabic Presentation Forms-A +FE00..FE0F; Variation Selectors +FE10..FE1F; Vertical Forms +FE20..FE2F; Combining Half Marks +FE30..FE4F; CJK Compatibility Forms +FE50..FE6F; Small Form Variants +FE70..FEFF; Arabic Presentation Forms-B +FF00..FFEF; Halfwidth and Fullwidth Forms +FFF0..FFFF; Specials +10000..1007F; Linear B Syllabary +10080..100FF; Linear B Ideograms +10100..1013F; Aegean Numbers +10140..1018F; Ancient Greek Numbers +10190..101CF; Ancient Symbols +101D0..101FF; Phaistos Disc +10280..1029F; Lycian +102A0..102DF; Carian +102E0..102FF; Coptic Epact Numbers +10300..1032F; Old Italic +10330..1034F; Gothic +10350..1037F; Old Permic +10380..1039F; Ugaritic +103A0..103DF; Old Persian +10400..1044F; Deseret +10450..1047F; Shavian +10480..104AF; Osmanya +104B0..104FF; Osage +10500..1052F; Elbasan +10530..1056F; Caucasian Albanian +10600..1077F; Linear A +10800..1083F; Cypriot Syllabary +10840..1085F; Imperial Aramaic +10860..1087F; Palmyrene +10880..108AF; Nabataean +108E0..108FF; Hatran +10900..1091F; Phoenician +10920..1093F; Lydian +10980..1099F; Meroitic Hieroglyphs +109A0..109FF; Meroitic Cursive +10A00..10A5F; Kharoshthi +10A60..10A7F; Old South Arabian +10A80..10A9F; Old North Arabian +10AC0..10AFF; Manichaean +10B00..10B3F; Avestan +10B40..10B5F; Inscriptional Parthian +10B60..10B7F; Inscriptional Pahlavi +10B80..10BAF; Psalter Pahlavi +10C00..10C4F; Old Turkic +10C80..10CFF; Old Hungarian +10E60..10E7F; Rumi Numeral Symbols +11000..1107F; Brahmi +11080..110CF; Kaithi +110D0..110FF; Sora Sompeng +11100..1114F; Chakma +11150..1117F; Mahajani +11180..111DF; Sharada +111E0..111FF; Sinhala Archaic Numbers +11200..1124F; Khojki +11280..112AF; Multani +112B0..112FF; Khudawadi +11300..1137F; Grantha +11400..1147F; Newa +11480..114DF; Tirhuta +11580..115FF; Siddham +11600..1165F; Modi +11660..1167F; Mongolian Supplement +11680..116CF; Takri +11700..1173F; Ahom +118A0..118FF; Warang Citi +11A00..11A4F; Zanabazar Square +11A50..11AAF; Soyombo +11AC0..11AFF; Pau Cin Hau +11C00..11C6F; Bhaiksuki +11C70..11CBF; Marchen +11D00..11D5F; Masaram Gondi +12000..123FF; Cuneiform +12400..1247F; Cuneiform Numbers and Punctuation +12480..1254F; Early Dynastic Cuneiform +13000..1342F; Egyptian Hieroglyphs +14400..1467F; Anatolian Hieroglyphs +16800..16A3F; Bamum Supplement +16A40..16A6F; Mro +16AD0..16AFF; Bassa Vah +16B00..16B8F; Pahawh Hmong +16F00..16F9F; Miao +16FE0..16FFF; Ideographic Symbols and Punctuation +17000..187FF; Tangut +18800..18AFF; Tangut Components +1B000..1B0FF; Kana Supplement +1B100..1B12F; Kana Extended-A +1B170..1B2FF; Nushu +1BC00..1BC9F; Duployan +1BCA0..1BCAF; Shorthand Format Controls +1D000..1D0FF; Byzantine Musical Symbols +1D100..1D1FF; Musical Symbols +1D200..1D24F; Ancient Greek Musical Notation +1D300..1D35F; Tai Xuan Jing Symbols +1D360..1D37F; Counting Rod Numerals +1D400..1D7FF; Mathematical Alphanumeric Symbols +1D800..1DAAF; Sutton SignWriting +1E000..1E02F; Glagolitic Supplement +1E800..1E8DF; Mende Kikakui +1E900..1E95F; Adlam +1EE00..1EEFF; Arabic Mathematical Alphabetic Symbols +1F000..1F02F; Mahjong Tiles +1F030..1F09F; Domino Tiles +1F0A0..1F0FF; Playing Cards +1F100..1F1FF; Enclosed Alphanumeric Supplement +1F200..1F2FF; Enclosed Ideographic Supplement +1F300..1F5FF; Miscellaneous Symbols and Pictographs +1F600..1F64F; Emoticons +1F650..1F67F; Ornamental Dingbats +1F680..1F6FF; Transport and Map Symbols +1F700..1F77F; Alchemical Symbols +1F780..1F7FF; Geometric Shapes Extended +1F800..1F8FF; Supplemental Arrows-C +1F900..1F9FF; Supplemental Symbols and Pictographs +20000..2A6DF; CJK Unified Ideographs Extension B +2A700..2B73F; CJK Unified Ideographs Extension C +2B740..2B81F; CJK Unified Ideographs Extension D +2B820..2CEAF; CJK Unified Ideographs Extension E +2CEB0..2EBEF; CJK Unified Ideographs Extension F +2F800..2FA1F; CJK Compatibility Ideographs Supplement +E0000..E007F; Tags +E0100..E01EF; Variation Selectors Supplement +F0000..FFFFF; Supplementary Private Use Area-A +100000..10FFFF; Supplementary Private Use Area-B + +# EOF diff --git a/test/jdk/java/lang/Character/CharCheck.java b/test/jdk/java/lang/Character/CharCheck.java new file mode 100644 index 00000000000..d67dd546b1a --- /dev/null +++ b/test/jdk/java/lang/Character/CharCheck.java @@ -0,0 +1,560 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * + * @author Alan Liu + * @author John O'Conner + */ + +import java.io.*; + + +/** + * This class either loads or dumps the character properties of all Unicode + * characters out to a file. When loading, it compares the loaded data with + * that obtained through the java.lang.Character API. This allows detection of + * changes to the character properties between versions of the Java VM. A + * typical usage would be to dump the properties under an early VM, and load + * them under a later VM. + * + * Also: Check the current VM's character properties against those in a + * Unicode database. The database should be of the format + * available on ftp.unicode.org/Public/UNIDATA. + * + */ +public class CharCheck { + static int differences = 0; + + public static void main(String args[]) throws Exception { + + if (args.length != 2 && args.length != 3) usage(); + if (args[0].equals("dump")) + dump(Integer.parseInt(args[1], 16), new ObjectOutputStream(new FileOutputStream(args[2]))); + else if (args[0].equals("load")) + load(Integer.parseInt(args[1], 16), new ObjectInputStream(new FileInputStream(args[2]))); + else if (args[0].equals("check")) + check(Integer.parseInt(args[1], 16), new File(args[2])); + else if (args[0].equals("char")) + showChar(Integer.parseInt(args[1],16)); + else if (args[0].equals("fchar")) + showFileChar(args[1], Integer.parseInt(args[2],16)); + else usage(); + if (differences != 0) { + throw new RuntimeException("There are differences between Character properties and the specification."); + } + } + + static void usage() { + System.err.println("Usage: java CharCheck "); + System.err.println("where is one of the following:"); + System.err.println("dump - dumps the character properties of the given plane,"); + System.err.println(" read from the current VM, to the given file."); + System.err.println("load - loads the character properties from the given"); + System.err.println(" file and compares them to those of the given character plane"); + System.err.println(" in the current VM."); + System.err.println("check - compare the current VM's character properties"); + System.err.println(" in the given plane to those listed in the given file, "); + System.err.println(" which should be in the format available on "); + System.err.println(" ftp.unicode.org/Public/2.0-Update."); + System.err.println("char - show current VM properties of the given Unicode char."); + System.err.println("fchar - show file properties of the given Unicode char."); + System.exit(0); + } + + static String getTypeName(int type) { + return (type >= 0 && type < UnicodeSpec.generalCategoryList.length) ? + (UnicodeSpec.generalCategoryList[type][UnicodeSpec.LONG] + '(' + type + ')') : + (""); + } + + static int check(int plane, File specFile) throws Exception { + + String version = System.getProperty("java.version"); + System.out.println("Current VM version " + version); + int rangeLimit = (plane << 16) | 0xFFFF; + String record; + UnicodeSpec[] spec = UnicodeSpec.readSpecFile(specFile, plane); + int rangeStart = 0x0000; + boolean isRange = false; + + lastCheck = (plane << 16) - 1; + + for (int currentSpec = 0; currentSpec < spec.length; currentSpec++) { + int c = spec[currentSpec].getCodePoint(); + if (isRange) { + // Must see end of range now + if (spec[currentSpec].getName().endsWith("Last>")) { + for (int d=rangeStart; d<=c; d++) { + checkOneChar(d, spec[currentSpec]); + } + } + else { + // No good -- First without Last + System.out.println("BAD FILE: First without last at '" + escape(rangeStart) + "'"); + } + isRange = false; + } + else { + // Look for a First, Last pair: This is a pair of entries like the following: + // 4E00;;Lo;0;L;;;;;N;;;;; + // 9FA5;;Lo;0;L;;;;;N;;;;; + if (spec[currentSpec].getName().endsWith("First>")) { + rangeStart = c; + isRange = true; + } + else { + checkOneChar(c, spec[currentSpec]); + } + } + } + + // Check undefined chars at the end of the range + + while (lastCheck < rangeLimit) checkOneCharDefined(++lastCheck, "?", false); + + System.out.println("Total differences: "+differences); + return differences; + } + + static int lastCheck = -1; + + static final void checkOneCharDefined(int c, String name, boolean fileDefined) { + if (Character.isDefined(c) != fileDefined) + showDifference(c, name, "isDefined", ""+(!fileDefined), ""+fileDefined); + } + + // In GenerateCharacter, the following ranges are handled specially. + // Each is the start of a 26-character range with values 10..35. + static final char NUMERIC_EXCEPTION[] = { '\u0041', '\u0061', '\uFF21', '\uFF41' }; + + static void checkOneChar(int c, UnicodeSpec charSpec) { + // Handle intervening ranges -- we assume that we will be called in monotonically + // increasing order. If the last char we checked is more than one before this + // char, then check the intervening range -- it should all be undefined. + int lowerLimit = (c & 0xFF0000); + if (lastCheck >= lowerLimit && (lastCheck+1) != c) { + for (int i=lastCheck+1; i= NUMERIC_EXCEPTION[k] && c < (char)(NUMERIC_EXCEPTION[k]+26)) { + numericValueDB = c - NUMERIC_EXCEPTION[k] + 10; + break; + } + } + } + else { + String strValue = charSpec.getNumericValue(); + int parsedNumericValue; + if (strValue.equals("10000000000") + || strValue.equals("1000000000000")) { + System.out.println("Skipping strValue: " + strValue + + " for " + charSpec.getName() + + "(0x" + Integer.toHexString(c) + ")"); + parsedNumericValue = -2; + } else { + parsedNumericValue = strValue.indexOf('/') < 0 ? + Integer.parseInt(strValue) : -2; + } + numericValueDB = parsedNumericValue < 0 ? -2 : parsedNumericValue; + } + if (numericValue != numericValueDB) + showDifference(c, charSpec.getName(), "numeric value", ""+numericValue, ""+numericValueDB); + } + + static void showDifference(int c, String name, String property, String vmValue, String dbValue) { + System.out.println(escape("Mismatch at '" + hex6(c) + "' (" + name+ "): " + + property + "=" + vmValue + ", db=" + dbValue)); + ++differences; + } + + /** + * Given a record containing ';'-separated fields, return the fieldno-th + * field. The first field is field 0. + */ + static String getField(String record, int fieldno) { + int i=0; + int j=record.indexOf(';'); + while (fieldno > 0) { + i=j+1; + j=record.indexOf(';', i); + } + return record.substring(i, j); + } + + static final int FIELD_COUNT = 15; + + /** + * Given a record containing ';'-separated fields, return an array of + * the fields. It is assumed that there are FIELD_COUNT fields per record. + */ + static void getFields(String record, String[] fields) { + int i=0; + int j=record.indexOf(';'); + fields[0] = record.substring(i, j); + for (int n=1; n= 0x20 && c <= 0x7F) buf.append(c); + else { + buf.append("\\u"); + String h = "000" + Integer.toHexString(c); + if (h.length() > 4) h = h.substring(h.length() - 4); + buf.append(h); + } + } + return buf.toString(); + } + + static String escape(int c) { + StringBuffer buf = new StringBuffer(); + if (c >= 0x20 && c <= 0x7F) buf.append(c); + else { + buf.append("\\u"); + String h = "000" + Integer.toHexString(c); + if (h.length() > 4) h = h.substring(h.length() - 4); + buf.append(h); + } + return buf.toString(); + } +} + + +//eof diff --git a/test/jdk/java/lang/Character/CheckBlocks.java b/test/jdk/java/lang/Character/CheckBlocks.java new file mode 100644 index 00000000000..6e1b04ad38d --- /dev/null +++ b/test/jdk/java/lang/Character/CheckBlocks.java @@ -0,0 +1,301 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 4830803 4886934 6565620 6959267 7070436 7198195 8032446 8072600 + * @summary Check that the UnicodeBlock forName() method works as expected and block ranges are correct for all Unicode characters. + * @run main CheckBlocks + * @author John O'Conner + */ + +import java.io.*; +import java.util.*; +import java.lang.Character.UnicodeBlock; + + +public class CheckBlocks { + + static boolean err = false; + static Class character; + + public static void main(String[] args) throws Exception { + generateBlockList(); + + try { + character = Class.forName("java.lang.Character$UnicodeBlock"); + } catch (ClassNotFoundException e) { + throw new RuntimeException("Class.forName(\"Character\") failed."); + } + + for (Block blk : blocks) { + test4830803_1(blk); + test4830803_2(); + test4886934(blk); + } + + if (err) { + throw new RuntimeException("Failed"); + } else { + System.out.println("Passed"); + } + } + + /** + * Check that the UnicodeBlock forName() method works as expected. + */ + private static void test4830803_1(Block blk) throws Exception { + + /* + * Try 3 forms of block name in the forName() method. Each form should + * produce the same expected block. + */ + String blkName = blk.getName(); + + // For backward compatibility + if (blkName.equals("COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS")) { + blkName = "COMBINING_MARKS_FOR_SYMBOLS"; + System.out.println("*** COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS is replaced with COMBINING_MARKS_FOR_SYMBOLS for backward compatibility."); + } else if (blkName.equals("GREEK_AND_COPTIC")) { + blkName = "GREEK"; + System.out.println("*** GREEK_AND_COPTIC is replaced with GREEK for backward compatibility."); + } else if (blkName.equals("CYRILLIC_SUPPLEMENT")) { + blkName = "CYRILLIC_SUPPLEMENTARY"; + System.out.println("*** CYRILLIC_SUPPLEMENT is replaced with CYRILLIC_SUPPLEMENTARY for backward compatibility."); + } + + String expectedBlock = null; + try { + expectedBlock = character.getField(blkName).getName(); + } catch (NoSuchFieldException | SecurityException e) { + System.err.println("Error: " + blkName + " was not found."); + err = true; + return; + } + + String canonicalBlockName = blk.getOriginalName(); + String idBlockName = expectedBlock; + String regexBlockName = toRegExString(canonicalBlockName); + + if (regexBlockName == null) { + System.err.println("Error: Block name which was processed with regex was null."); + err = true; + return; + } + + if (!expectedBlock.equals(UnicodeBlock.forName(canonicalBlockName).toString())) { + System.err.println("Error #1: UnicodeBlock.forName(\"" + + canonicalBlockName + "\") returned wrong value.\n\tGot: " + + UnicodeBlock.forName(canonicalBlockName) + + "\n\tExpected: " + expectedBlock); + err = true; + } + + if (!expectedBlock.equals(UnicodeBlock.forName(idBlockName).toString())) { + System.err.println("Error #2: UnicodeBlock.forName(\"" + + idBlockName + "\") returned wrong value.\n\tGot: " + + UnicodeBlock.forName(idBlockName) + + "\n\tExpected: " + expectedBlock); + err = true; + } + + if (!expectedBlock.equals(UnicodeBlock.forName(regexBlockName).toString())) { + System.err.println("Error #3: UnicodeBlock.forName(\"" + + regexBlockName + "\") returned wrong value.\n\tGot: " + + UnicodeBlock.forName(regexBlockName) + + "\n\tExpected: " + expectedBlock); + err = true; + } + } + + /** + * now try a bad block name. This should produce an IAE. + */ + private static void test4830803_2() { + boolean threwExpected = false; + + try { + UnicodeBlock block = UnicodeBlock.forName("notdefined"); + } + catch(IllegalArgumentException e) { + threwExpected = true; + } + + if (threwExpected == false) { + System.err.println("Error: UnicodeBlock.forName(\"notdefined\") should throw IllegalArgumentException."); + err = true; + } + } + + /** + * Convert the argument to a block name form used by the regex package. + * That is, remove all spaces. + */ + private static String toRegExString(String str) { + String[] tokens = null; + StringBuilder retStr = new StringBuilder(); + try { + tokens = str.split(" "); + } + catch(java.util.regex.PatternSyntaxException e) { + return null; + } + for(int x=0; x < tokens.length; ++x) { + retStr.append(tokens[x]); + } + return retStr.toString(); + } + + private static void test4886934(Block blk) { + String blkName = blk.getName(); + String blkOrigName = blk.getOriginalName(); + int ch = blk.getBegin(); + UnicodeBlock block = UnicodeBlock.of(ch); + + if (block == null) { + System.err.println("Error: The block for " + blkName + + " is missing. Please check java.lang.Character.UnicodeBlock."); + err = true; + return; + } + + // For backward compatibility + if (blkName.equals("COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS")) { + blkName = "COMBINING_MARKS_FOR_SYMBOLS"; + System.out.println("*** COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS is replaced with COMBINING_MARKS_FOR_SYMBOLS for backward compatibility."); + } else if (blkName.equals("GREEK_AND_COPTIC")) { + blkName = "GREEK"; + System.out.println("*** GREEK_AND_COPTIC is replaced with GREEK for backward compatibility."); + } else if (blkName.equals("CYRILLIC_SUPPLEMENT")) { + blkName = "CYRILLIC_SUPPLEMENTARY"; + System.out.println("*** CYRILLIC_SUPPLEMENT is replaced with CYRILLIC_SUPPLEMENTARY for backward compatibility."); + } + + String blockName = block.toString(); + if (!blockName.equals(blkName)) { + System.err.println("Error: Begin-of-block character(0x" + + Integer.toHexString(ch).toUpperCase() + + ") should be in \"" + blkName + "\" block " + + "(Block name is \"" + blkOrigName + "\")" + + " but found in \"" + blockName + "\" block."); + err = true; + } + + block = UnicodeBlock.of(++ch); + blockName = block.toString(); + if (!blockName.equals(blkName)) { + System.err.println("Error: Character(0x" + + Integer.toHexString(ch).toUpperCase() + + ") should be in \"" + blkName + "\" block " + + "(Block name is \"" + blkOrigName + "\")" + + " but found in \"" + blockName + "\" block."); + err = true; + } + + ch = blk.getEnd(); + block = UnicodeBlock.of(ch); + blockName = block.toString(); + if (!blockName.equals(blkName)) { + System.err.println("Error: End-of-block Character(0x" + + Integer.toHexString(ch).toUpperCase() + + ") should be in \"" + blkName + "\" block " + + "(Block name is \"" + blkOrigName + "\")" + + " but found in \"" + blockName + "\" block."); + err = true; + } + } + + // List of all Unicode blocks, their start, and end codepoints. + public static HashSet blocks = new HashSet<>(); + + private static void generateBlockList() throws Exception { + BufferedReader f = new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Blocks.txt"))); + + String line; + while ((line = f.readLine()) != null) { + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } + + int index1 = line.indexOf('.'); + int begin = Integer.parseInt(line.substring(0, index1), 16); + int index2 = line.indexOf(';'); + int end = Integer.parseInt(line.substring(index1+2, index2), 16); + String name = line.substring(index2+1).trim(); + + System.out.println(" Adding a Block(" + + Integer.toHexString(begin) + ", " + Integer.toHexString(end) + + ", " + name + ")"); + blocks.add(new Block(begin, end, name)); + } + f.close(); + } +} + +class Block { + + public Block() { + blockBegin = 0; + blockEnd = 0; + blockName = null; + } + + public Block(int begin, int end, String name) { + blockBegin = begin; + blockEnd = end; + blockName = name.replaceAll("[ -]", "_").toUpperCase(Locale.ENGLISH); + originalBlockName = name; + } + + public int getBegin() { + return blockBegin; + } + + public int getEnd() { + return blockEnd; + } + + public String getName() { + return blockName; + } + + public String getOriginalName() { + return originalBlockName; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) return false; + if (!(obj instanceof Block)) return false; + + Block other = (Block)obj; + return other.blockBegin == blockBegin && + other.blockEnd == blockEnd && + other.blockName.equals(blockName) && + other.originalBlockName.equals(originalBlockName); + } + int blockBegin, blockEnd; + String blockName, originalBlockName; +} diff --git a/test/jdk/java/lang/Character/CheckUnicode.java b/test/jdk/java/lang/Character/CheckUnicode.java new file mode 100644 index 00000000000..97b2a10fb2e --- /dev/null +++ b/test/jdk/java/lang/Character/CheckUnicode.java @@ -0,0 +1,111 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 4114080 6565620 6959267 7070436 7198195 8032446 8072600 + * @summary Make sure the attributes of Unicode characters, as + * returned by the Character API, are as expected. Do this by + * comparing them to a baseline file together with a list of + * known diffs. + * @build UnicodeSpec CharCheck + * @run main CheckUnicode + * @author Alan Liu + * @author John O'Conner + */ + +import java.io.*; + +public class CheckUnicode { + public static void main(String args[]) throws Exception { + + // 1. Check that the dumped property files for planes 0, 1, 2, 3, 14, 15, and 16 + // are the same as in the current Character properties. + int[] planes = {0, 1, 2, 3, 14, 15, 16}; + String[] fileNames = {"charprop00.bin", "charprop01.bin", "charprop02.bin", "charprop03.bin", + "charprop0E.bin", "charprop0F.bin", "charprop10.bin" }; + + // Read in the Unicode 4.0 data + + for (int x=0; x < planes.length && x < fileNames.length; ++x) { + File unicodeProp = new File(System.getProperty("test.src", "."), fileNames[x]); + ObjectInputStream ois = new ObjectInputStream(new FileInputStream(unicodeProp)); + // Find differences -- should be none + int diffs = CharCheck.load(planes[x], ois); + if (diffs != 0) { + throw new RuntimeException("Bug 4114080 - Unicode properties have changed " + + "in an unexpected way"); + } + } + + + + + // 2. Check that the current 4.0 spec file is handled by the current + // version of Character. + File unicodeSpec = new File(System.getProperty("test.src", "."), "UnicodeData.txt"); + for (int x=0; x... 2329 ; Deprecated # Ps LEFT-POINTING ANGLE BRACKET 232A ; Deprecated # Pe RIGHT-POINTING ANGLE BRACKET E0001 ; Deprecated # Cf LANGUAGE TAG -E007F ; Deprecated # Cf CANCEL TAG -# Total code points: 16 +# Total code points: 15 # ================================================ @@ -1160,11 +1233,12 @@ AABB..AABC ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL AUE..TAI VIET # ================================================ +1885..1886 ; Other_ID_Start # Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA 2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P 212E ; Other_ID_Start # So ESTIMATED SYMBOL 309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK -# Total code points: 4 +# Total code points: 6 # ================================================ @@ -1177,72 +1251,76 @@ AABB..AABC ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL AUE..TAI VIET # ================================================ -0021 ; STerm # Po EXCLAMATION MARK -002E ; STerm # Po FULL STOP -003F ; STerm # Po QUESTION MARK -0589 ; STerm # Po ARMENIAN FULL STOP -061F ; STerm # Po ARABIC QUESTION MARK -06D4 ; STerm # Po ARABIC FULL STOP -0700..0702 ; STerm # Po [3] SYRIAC END OF PARAGRAPH..SYRIAC SUBLINEAR FULL STOP -07F9 ; STerm # Po NKO EXCLAMATION MARK -0964..0965 ; STerm # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA -104A..104B ; STerm # Po [2] MYANMAR SIGN LITTLE SECTION..MYANMAR SIGN SECTION -1362 ; STerm # Po ETHIOPIC FULL STOP -1367..1368 ; STerm # Po [2] ETHIOPIC QUESTION MARK..ETHIOPIC PARAGRAPH SEPARATOR -166E ; STerm # Po CANADIAN SYLLABICS FULL STOP -1735..1736 ; STerm # Po [2] PHILIPPINE SINGLE PUNCTUATION..PHILIPPINE DOUBLE PUNCTUATION -1803 ; STerm # Po MONGOLIAN FULL STOP -1809 ; STerm # Po MONGOLIAN MANCHU FULL STOP -1944..1945 ; STerm # Po [2] LIMBU EXCLAMATION MARK..LIMBU QUESTION MARK -1AA8..1AAB ; STerm # Po [4] TAI THAM SIGN KAAN..TAI THAM SIGN SATKAANKUU -1B5A..1B5B ; STerm # Po [2] BALINESE PANTI..BALINESE PAMADA -1B5E..1B5F ; STerm # Po [2] BALINESE CARIK SIKI..BALINESE CARIK PAREREN -1C3B..1C3C ; STerm # Po [2] LEPCHA PUNCTUATION TA-ROL..LEPCHA PUNCTUATION NYET THYOOM TA-ROL -1C7E..1C7F ; STerm # Po [2] OL CHIKI PUNCTUATION MUCAAD..OL CHIKI PUNCTUATION DOUBLE MUCAAD -203C..203D ; STerm # Po [2] DOUBLE EXCLAMATION MARK..INTERROBANG -2047..2049 ; STerm # Po [3] DOUBLE QUESTION MARK..EXCLAMATION QUESTION MARK -2E2E ; STerm # Po REVERSED QUESTION MARK -2E3C ; STerm # Po STENOGRAPHIC FULL STOP -3002 ; STerm # Po IDEOGRAPHIC FULL STOP -A4FF ; STerm # Po LISU PUNCTUATION FULL STOP -A60E..A60F ; STerm # Po [2] VAI FULL STOP..VAI QUESTION MARK -A6F3 ; STerm # Po BAMUM FULL STOP -A6F7 ; STerm # Po BAMUM QUESTION MARK -A876..A877 ; STerm # Po [2] PHAGS-PA MARK SHAD..PHAGS-PA MARK DOUBLE SHAD -A8CE..A8CF ; STerm # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA -A92F ; STerm # Po KAYAH LI SIGN SHYA -A9C8..A9C9 ; STerm # Po [2] JAVANESE PADA LINGSA..JAVANESE PADA LUNGSI -AA5D..AA5F ; STerm # Po [3] CHAM PUNCTUATION DANDA..CHAM PUNCTUATION TRIPLE DANDA -AAF0..AAF1 ; STerm # Po [2] MEETEI MAYEK CHEIKHAN..MEETEI MAYEK AHANG KHUDAM -ABEB ; STerm # Po MEETEI MAYEK CHEIKHEI -FE52 ; STerm # Po SMALL FULL STOP -FE56..FE57 ; STerm # Po [2] SMALL QUESTION MARK..SMALL EXCLAMATION MARK -FF01 ; STerm # Po FULLWIDTH EXCLAMATION MARK -FF0E ; STerm # Po FULLWIDTH FULL STOP -FF1F ; STerm # Po FULLWIDTH QUESTION MARK -FF61 ; STerm # Po HALFWIDTH IDEOGRAPHIC FULL STOP -10A56..10A57 ; STerm # Po [2] KHAROSHTHI PUNCTUATION DANDA..KHAROSHTHI PUNCTUATION DOUBLE DANDA -11047..11048 ; STerm # Po [2] BRAHMI DANDA..BRAHMI DOUBLE DANDA -110BE..110C1 ; STerm # Po [4] KAITHI SECTION MARK..KAITHI DOUBLE DANDA -11141..11143 ; STerm # Po [3] CHAKMA DANDA..CHAKMA QUESTION MARK -111C5..111C6 ; STerm # Po [2] SHARADA DANDA..SHARADA DOUBLE DANDA -111CD ; STerm # Po SHARADA SUTRA MARK -111DE..111DF ; STerm # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2 -11238..11239 ; STerm # Po [2] KHOJKI DANDA..KHOJKI DOUBLE DANDA -1123B..1123C ; STerm # Po [2] KHOJKI SECTION MARK..KHOJKI DOUBLE SECTION MARK -112A9 ; STerm # Po MULTANI SECTION MARK -115C2..115C3 ; STerm # Po [2] SIDDHAM DANDA..SIDDHAM DOUBLE DANDA -115C9..115D7 ; STerm # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES -11641..11642 ; STerm # Po [2] MODI DANDA..MODI DOUBLE DANDA -1173C..1173E ; STerm # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI -16A6E..16A6F ; STerm # Po [2] MRO DANDA..MRO DOUBLE DANDA -16AF5 ; STerm # Po BASSA VAH FULL STOP -16B37..16B38 ; STerm # Po [2] PAHAWH HMONG SIGN VOS THOM..PAHAWH HMONG SIGN VOS TSHAB CEEB -16B44 ; STerm # Po PAHAWH HMONG SIGN XAUS -1BC9F ; STerm # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP -1DA88 ; STerm # Po SIGNWRITING FULL STOP +0021 ; Sentence_Terminal # Po EXCLAMATION MARK +002E ; Sentence_Terminal # Po FULL STOP +003F ; Sentence_Terminal # Po QUESTION MARK +0589 ; Sentence_Terminal # Po ARMENIAN FULL STOP +061F ; Sentence_Terminal # Po ARABIC QUESTION MARK +06D4 ; Sentence_Terminal # Po ARABIC FULL STOP +0700..0702 ; Sentence_Terminal # Po [3] SYRIAC END OF PARAGRAPH..SYRIAC SUBLINEAR FULL STOP +07F9 ; Sentence_Terminal # Po NKO EXCLAMATION MARK +0964..0965 ; Sentence_Terminal # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA +104A..104B ; Sentence_Terminal # Po [2] MYANMAR SIGN LITTLE SECTION..MYANMAR SIGN SECTION +1362 ; Sentence_Terminal # Po ETHIOPIC FULL STOP +1367..1368 ; Sentence_Terminal # Po [2] ETHIOPIC QUESTION MARK..ETHIOPIC PARAGRAPH SEPARATOR +166E ; Sentence_Terminal # Po CANADIAN SYLLABICS FULL STOP +1735..1736 ; Sentence_Terminal # Po [2] PHILIPPINE SINGLE PUNCTUATION..PHILIPPINE DOUBLE PUNCTUATION +1803 ; Sentence_Terminal # Po MONGOLIAN FULL STOP +1809 ; Sentence_Terminal # Po MONGOLIAN MANCHU FULL STOP +1944..1945 ; Sentence_Terminal # Po [2] LIMBU EXCLAMATION MARK..LIMBU QUESTION MARK +1AA8..1AAB ; Sentence_Terminal # Po [4] TAI THAM SIGN KAAN..TAI THAM SIGN SATKAANKUU +1B5A..1B5B ; Sentence_Terminal # Po [2] BALINESE PANTI..BALINESE PAMADA +1B5E..1B5F ; Sentence_Terminal # Po [2] BALINESE CARIK SIKI..BALINESE CARIK PAREREN +1C3B..1C3C ; Sentence_Terminal # Po [2] LEPCHA PUNCTUATION TA-ROL..LEPCHA PUNCTUATION NYET THYOOM TA-ROL +1C7E..1C7F ; Sentence_Terminal # Po [2] OL CHIKI PUNCTUATION MUCAAD..OL CHIKI PUNCTUATION DOUBLE MUCAAD +203C..203D ; Sentence_Terminal # Po [2] DOUBLE EXCLAMATION MARK..INTERROBANG +2047..2049 ; Sentence_Terminal # Po [3] DOUBLE QUESTION MARK..EXCLAMATION QUESTION MARK +2E2E ; Sentence_Terminal # Po REVERSED QUESTION MARK +2E3C ; Sentence_Terminal # Po STENOGRAPHIC FULL STOP +3002 ; Sentence_Terminal # Po IDEOGRAPHIC FULL STOP +A4FF ; Sentence_Terminal # Po LISU PUNCTUATION FULL STOP +A60E..A60F ; Sentence_Terminal # Po [2] VAI FULL STOP..VAI QUESTION MARK +A6F3 ; Sentence_Terminal # Po BAMUM FULL STOP +A6F7 ; Sentence_Terminal # Po BAMUM QUESTION MARK +A876..A877 ; Sentence_Terminal # Po [2] PHAGS-PA MARK SHAD..PHAGS-PA MARK DOUBLE SHAD +A8CE..A8CF ; Sentence_Terminal # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA +A92F ; Sentence_Terminal # Po KAYAH LI SIGN SHYA +A9C8..A9C9 ; Sentence_Terminal # Po [2] JAVANESE PADA LINGSA..JAVANESE PADA LUNGSI +AA5D..AA5F ; Sentence_Terminal # Po [3] CHAM PUNCTUATION DANDA..CHAM PUNCTUATION TRIPLE DANDA +AAF0..AAF1 ; Sentence_Terminal # Po [2] MEETEI MAYEK CHEIKHAN..MEETEI MAYEK AHANG KHUDAM +ABEB ; Sentence_Terminal # Po MEETEI MAYEK CHEIKHEI +FE52 ; Sentence_Terminal # Po SMALL FULL STOP +FE56..FE57 ; Sentence_Terminal # Po [2] SMALL QUESTION MARK..SMALL EXCLAMATION MARK +FF01 ; Sentence_Terminal # Po FULLWIDTH EXCLAMATION MARK +FF0E ; Sentence_Terminal # Po FULLWIDTH FULL STOP +FF1F ; Sentence_Terminal # Po FULLWIDTH QUESTION MARK +FF61 ; Sentence_Terminal # Po HALFWIDTH IDEOGRAPHIC FULL STOP +10A56..10A57 ; Sentence_Terminal # Po [2] KHAROSHTHI PUNCTUATION DANDA..KHAROSHTHI PUNCTUATION DOUBLE DANDA +11047..11048 ; Sentence_Terminal # Po [2] BRAHMI DANDA..BRAHMI DOUBLE DANDA +110BE..110C1 ; Sentence_Terminal # Po [4] KAITHI SECTION MARK..KAITHI DOUBLE DANDA +11141..11143 ; Sentence_Terminal # Po [3] CHAKMA DANDA..CHAKMA QUESTION MARK +111C5..111C6 ; Sentence_Terminal # Po [2] SHARADA DANDA..SHARADA DOUBLE DANDA +111CD ; Sentence_Terminal # Po SHARADA SUTRA MARK +111DE..111DF ; Sentence_Terminal # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2 +11238..11239 ; Sentence_Terminal # Po [2] KHOJKI DANDA..KHOJKI DOUBLE DANDA +1123B..1123C ; Sentence_Terminal # Po [2] KHOJKI SECTION MARK..KHOJKI DOUBLE SECTION MARK +112A9 ; Sentence_Terminal # Po MULTANI SECTION MARK +1144B..1144C ; Sentence_Terminal # Po [2] NEWA DANDA..NEWA DOUBLE DANDA +115C2..115C3 ; Sentence_Terminal # Po [2] SIDDHAM DANDA..SIDDHAM DOUBLE DANDA +115C9..115D7 ; Sentence_Terminal # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES +11641..11642 ; Sentence_Terminal # Po [2] MODI DANDA..MODI DOUBLE DANDA +1173C..1173E ; Sentence_Terminal # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI +11A42..11A43 ; Sentence_Terminal # Po [2] ZANABAZAR SQUARE MARK SHAD..ZANABAZAR SQUARE MARK DOUBLE SHAD +11A9B..11A9C ; Sentence_Terminal # Po [2] SOYOMBO MARK SHAD..SOYOMBO MARK DOUBLE SHAD +11C41..11C42 ; Sentence_Terminal # Po [2] BHAIKSUKI DANDA..BHAIKSUKI DOUBLE DANDA +16A6E..16A6F ; Sentence_Terminal # Po [2] MRO DANDA..MRO DOUBLE DANDA +16AF5 ; Sentence_Terminal # Po BASSA VAH FULL STOP +16B37..16B38 ; Sentence_Terminal # Po [2] PAHAWH HMONG SIGN VOS THOM..PAHAWH HMONG SIGN VOS TSHAB CEEB +16B44 ; Sentence_Terminal # Po PAHAWH HMONG SIGN XAUS +1BC9F ; Sentence_Terminal # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP +1DA88 ; Sentence_Terminal # Po SIGNWRITING FULL STOP -# Total code points: 120 +# Total code points: 128 # ================================================ @@ -1359,9 +1437,7 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S 239B..23B3 ; Pattern_Syntax # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23DB ; Pattern_Syntax # So [40] TOP SQUARE BRACKET..FUSE 23DC..23E1 ; Pattern_Syntax # Sm [6] TOP PARENTHESIS..BOTTOM TORTOISE SHELL BRACKET -23E2..23FA ; Pattern_Syntax # So [25] WHITE TRAPEZIUM..BLACK CIRCLE FOR RECORD -23FB..23FF ; Pattern_Syntax # Cn [5] .. -2400..2426 ; Pattern_Syntax # So [39] SYMBOL FOR NULL..SYMBOL FOR SUBSTITUTE FORM TWO +23E2..2426 ; Pattern_Syntax # So [69] WHITE TRAPEZIUM..SYMBOL FOR SUBSTITUTE FORM TWO 2427..243F ; Pattern_Syntax # Cn [25] .. 2440..244A ; Pattern_Syntax # So [11] OCR HOOK..OCR DOUBLE BACKSLASH 244B..245F ; Pattern_Syntax # Cn [21] .. @@ -1449,8 +1525,8 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S 2BBA..2BBC ; Pattern_Syntax # Cn [3] .. 2BBD..2BC8 ; Pattern_Syntax # So [12] BALLOT BOX WITH LIGHT X..BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED 2BC9 ; Pattern_Syntax # Cn -2BCA..2BD1 ; Pattern_Syntax # So [8] TOP HALF BLACK CIRCLE..UNCERTAINTY SIGN -2BD2..2BEB ; Pattern_Syntax # Cn [26] .. +2BCA..2BD2 ; Pattern_Syntax # So [9] TOP HALF BLACK CIRCLE..GROUP MARK +2BD3..2BEB ; Pattern_Syntax # Cn [25] .. 2BEC..2BEF ; Pattern_Syntax # So [4] LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS..DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS 2BF0..2BFF ; Pattern_Syntax # Cn [16] .. 2E00..2E01 ; Pattern_Syntax # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER @@ -1490,7 +1566,8 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S 2E40 ; Pattern_Syntax # Pd DOUBLE HYPHEN 2E41 ; Pattern_Syntax # Po REVERSED COMMA 2E42 ; Pattern_Syntax # Ps DOUBLE LOW-REVERSED-9 QUOTATION MARK -2E43..2E7F ; Pattern_Syntax # Cn [61] .. +2E43..2E49 ; Pattern_Syntax # Po [7] DASH WITH LEFT UPTURN..DOUBLE STACKED COMMA +2E4A..2E7F ; Pattern_Syntax # Cn [54] .. 3001..3003 ; Pattern_Syntax # Po [3] IDEOGRAPHIC COMMA..DITTO MARK 3008 ; Pattern_Syntax # Ps LEFT ANGLE BRACKET 3009 ; Pattern_Syntax # Pe RIGHT ANGLE BRACKET @@ -1522,4 +1599,20 @@ FE45..FE46 ; Pattern_Syntax # Po [2] SESAME DOT..WHITE SESAME DOT # Total code points: 2760 +# ================================================ + +0600..0605 ; Prepended_Concatenation_Mark # Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE +06DD ; Prepended_Concatenation_Mark # Cf ARABIC END OF AYAH +070F ; Prepended_Concatenation_Mark # Cf SYRIAC ABBREVIATION MARK +08E2 ; Prepended_Concatenation_Mark # Cf ARABIC DISPUTED END OF AYAH +110BD ; Prepended_Concatenation_Mark # Cf KAITHI NUMBER SIGN + +# Total code points: 10 + +# ================================================ + +1F1E6..1F1FF ; Regional_Indicator # So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z + +# Total code points: 26 + # EOF diff --git a/test/jdk/java/lang/Character/PropertyValueAliases.txt b/test/jdk/java/lang/Character/PropertyValueAliases.txt index 595744668b0..f48bbd49049 100644 --- a/test/jdk/java/lang/Character/PropertyValueAliases.txt +++ b/test/jdk/java/lang/Character/PropertyValueAliases.txt @@ -1,10 +1,11 @@ -# PropertyValueAliases-8.0.0.txt -# Date: 2015-03-11, 22:29:33 GMT [MD] +# PropertyValueAliases-10.0.0.txt +# Date: 2017-05-17, 08:45:34 GMT +# Copyright (c) 2017 Unicode, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see http://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2015 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# For documentation, see http://www.unicode.org/reports/tr44/ +# For documentation, see http://www.unicode.org/reports/tr44/ # # This file contains aliases for property values used in the UCD. # These names can be used for XML formats of UCD data, for regular-expression @@ -78,6 +79,8 @@ age; 6.2 ; V6_2 age; 6.3 ; V6_3 age; 7.0 ; V7_0 age; 8.0 ; V8_0 +age; 9.0 ; V9_0 +age; 10.0 ; V10_0 age; NA ; Unassigned # Alphabetic (Alpha) @@ -138,6 +141,7 @@ bpt; o ; Open # Block (blk) +blk; Adlam ; Adlam blk; Aegean_Numbers ; Aegean_Numbers blk; Ahom ; Ahom blk; Alchemical ; Alchemical_Symbols @@ -162,6 +166,7 @@ blk; Bamum_Sup ; Bamum_Supplement blk; Bassa_Vah ; Bassa_Vah blk; Batak ; Batak blk; Bengali ; Bengali +blk; Bhaiksuki ; Bhaiksuki blk; Block_Elements ; Block_Elements blk; Bopomofo ; Bopomofo blk; Bopomofo_Ext ; Bopomofo_Extended @@ -187,6 +192,7 @@ blk; CJK_Ext_B ; CJK_Unified_Ideographs_Extension_B blk; CJK_Ext_C ; CJK_Unified_Ideographs_Extension_C blk; CJK_Ext_D ; CJK_Unified_Ideographs_Extension_D blk; CJK_Ext_E ; CJK_Unified_Ideographs_Extension_E +blk; CJK_Ext_F ; CJK_Unified_Ideographs_Extension_F blk; CJK_Radicals_Sup ; CJK_Radicals_Supplement blk; CJK_Strokes ; CJK_Strokes blk; CJK_Symbols ; CJK_Symbols_And_Punctuation @@ -202,6 +208,7 @@ blk; Cypriot_Syllabary ; Cypriot_Syllabary blk; Cyrillic ; Cyrillic blk; Cyrillic_Ext_A ; Cyrillic_Extended_A blk; Cyrillic_Ext_B ; Cyrillic_Extended_B +blk; Cyrillic_Ext_C ; Cyrillic_Extended_C blk; Cyrillic_Sup ; Cyrillic_Supplement ; Cyrillic_Supplementary blk; Deseret ; Deseret blk; Devanagari ; Devanagari @@ -230,6 +237,7 @@ blk; Geometric_Shapes_Ext ; Geometric_Shapes_Extended blk; Georgian ; Georgian blk; Georgian_Sup ; Georgian_Supplement blk; Glagolitic ; Glagolitic +blk; Glagolitic_Sup ; Glagolitic_Supplement blk; Gothic ; Gothic blk; Grantha ; Grantha blk; Greek ; Greek_And_Coptic @@ -246,6 +254,7 @@ blk; High_PU_Surrogates ; High_Private_Use_Surrogates blk; High_Surrogates ; High_Surrogates blk; Hiragana ; Hiragana blk; IDC ; Ideographic_Description_Characters +blk; Ideographic_Symbols ; Ideographic_Symbols_And_Punctuation blk; Imperial_Aramaic ; Imperial_Aramaic blk; Indic_Number_Forms ; Common_Indic_Number_Forms blk; Inscriptional_Pahlavi ; Inscriptional_Pahlavi @@ -256,6 +265,7 @@ blk; Jamo_Ext_A ; Hangul_Jamo_Extended_A blk; Jamo_Ext_B ; Hangul_Jamo_Extended_B blk; Javanese ; Javanese blk; Kaithi ; Kaithi +blk; Kana_Ext_A ; Kana_Extended_A blk; Kana_Sup ; Kana_Supplement blk; Kanbun ; Kanbun blk; Kangxi ; Kangxi_Radicals @@ -291,6 +301,8 @@ blk; Mahjong ; Mahjong_Tiles blk; Malayalam ; Malayalam blk; Mandaic ; Mandaic blk; Manichaean ; Manichaean +blk; Marchen ; Marchen +blk; Masaram_Gondi ; Masaram_Gondi blk; Math_Alphanum ; Mathematical_Alphanumeric_Symbols blk; Math_Operators ; Mathematical_Operators blk; Meetei_Mayek ; Meetei_Mayek @@ -309,6 +321,7 @@ blk; Modi ; Modi blk; Modifier_Letters ; Spacing_Modifier_Letters blk; Modifier_Tone_Letters ; Modifier_Tone_Letters blk; Mongolian ; Mongolian +blk; Mongolian_Sup ; Mongolian_Supplement blk; Mro ; Mro blk; Multani ; Multani blk; Music ; Musical_Symbols @@ -318,8 +331,10 @@ blk; Myanmar_Ext_B ; Myanmar_Extended_B blk; Nabataean ; Nabataean blk; NB ; No_Block blk; New_Tai_Lue ; New_Tai_Lue +blk; Newa ; Newa blk; NKo ; NKo blk; Number_Forms ; Number_Forms +blk; Nushu ; Nushu blk; OCR ; Optical_Character_Recognition blk; Ogham ; Ogham blk; Ol_Chiki ; Ol_Chiki @@ -332,6 +347,7 @@ blk; Old_South_Arabian ; Old_South_Arabian blk; Old_Turkic ; Old_Turkic blk; Oriya ; Oriya blk; Ornamental_Dingbats ; Ornamental_Dingbats +blk; Osage ; Osage blk; Osmanya ; Osmanya blk; Pahawh_Hmong ; Pahawh_Hmong blk; Palmyrene ; Palmyrene @@ -358,6 +374,7 @@ blk; Sinhala ; Sinhala blk; Sinhala_Archaic_Numbers ; Sinhala_Archaic_Numbers blk; Small_Forms ; Small_Form_Variants blk; Sora_Sompeng ; Sora_Sompeng +blk; Soyombo ; Soyombo blk; Specials ; Specials blk; Sundanese ; Sundanese blk; Sundanese_Sup ; Sundanese_Supplement @@ -373,6 +390,7 @@ blk; Super_And_Sub ; Superscripts_And_Subscripts blk; Sutton_SignWriting ; Sutton_SignWriting blk; Syloti_Nagri ; Syloti_Nagri blk; Syriac ; Syriac +blk; Syriac_Sup ; Syriac_Supplement blk; Tagalog ; Tagalog blk; Tagbanwa ; Tagbanwa blk; Tags ; Tags @@ -382,6 +400,8 @@ blk; Tai_Viet ; Tai_Viet blk; Tai_Xuan_Jing ; Tai_Xuan_Jing_Symbols blk; Takri ; Takri blk; Tamil ; Tamil +blk; Tangut ; Tangut +blk; Tangut_Components ; Tangut_Components blk; Telugu ; Telugu blk; Thaana ; Thaana blk; Thai ; Thai @@ -401,6 +421,7 @@ blk; Warang_Citi ; Warang_Citi blk; Yi_Radicals ; Yi_Radicals blk; Yi_Syllables ; Yi_Syllables blk; Yijing ; Yijing_Hexagram_Symbols +blk; Zanabazar_Square ; Zanabazar_Square # Canonical_Combining_Class (ccc) @@ -650,7 +671,11 @@ Gr_Base; Y ; Yes ; T GCB; CN ; Control GCB; CR ; CR +GCB; EB ; E_Base +GCB; EBG ; E_Base_GAZ +GCB; EM ; E_Modifier GCB; EX ; Extend +GCB; GAZ ; Glue_After_Zwj GCB; L ; L GCB; LF ; LF GCB; LV ; LV @@ -661,6 +686,7 @@ GCB; SM ; SpacingMark GCB; T ; T GCB; V ; V GCB; XX ; Other +GCB; ZWJ ; ZWJ # Grapheme_Extend (Gr_Ext) @@ -723,6 +749,7 @@ Ideo; Y ; Yes ; T # Indic_Positional_Category (InPC) InPC; Bottom ; Bottom +InPC; Bottom_And_Left ; Bottom_And_Left InPC; Bottom_And_Right ; Bottom_And_Right InPC; Left ; Left InPC; Left_And_Right ; Left_And_Right @@ -838,6 +865,9 @@ Join_C; Y ; Yes ; T # Joining_Group (jg) +jg ; African_Feh ; African_Feh +jg ; African_Noon ; African_Noon +jg ; African_Qaf ; African_Qaf jg ; Ain ; Ain jg ; Alaph ; Alaph jg ; Alef ; Alef @@ -864,6 +894,17 @@ jg ; Khaph ; Khaph jg ; Knotted_Heh ; Knotted_Heh jg ; Lam ; Lam jg ; Lamadh ; Lamadh +jg ; Malayalam_Bha ; Malayalam_Bha +jg ; Malayalam_Ja ; Malayalam_Ja +jg ; Malayalam_Lla ; Malayalam_Lla +jg ; Malayalam_Llla ; Malayalam_Llla +jg ; Malayalam_Nga ; Malayalam_Nga +jg ; Malayalam_Nna ; Malayalam_Nna +jg ; Malayalam_Nnna ; Malayalam_Nnna +jg ; Malayalam_Nya ; Malayalam_Nya +jg ; Malayalam_Ra ; Malayalam_Ra +jg ; Malayalam_Ssa ; Malayalam_Ssa +jg ; Malayalam_Tta ; Malayalam_Tta jg ; Manichaean_Aleph ; Manichaean_Aleph jg ; Manichaean_Ayin ; Manichaean_Ayin jg ; Manichaean_Beth ; Manichaean_Beth @@ -948,6 +989,8 @@ lb ; CL ; Close_Punctuation lb ; CM ; Combining_Mark lb ; CP ; Close_Parenthesis lb ; CR ; Carriage_Return +lb ; EB ; E_Base +lb ; EM ; E_Modifier lb ; EX ; Exclamation lb ; GL ; Glue lb ; H2 ; H2 @@ -976,6 +1019,7 @@ lb ; SY ; Break_Symbols lb ; WJ ; Word_Joiner lb ; XX ; Unknown lb ; ZW ; ZWSpace +lb ; ZWJ ; ZWJ # Logical_Order_Exception (LOE) @@ -1096,6 +1140,11 @@ Pat_Syn; Y ; Yes ; T Pat_WS; N ; No ; F ; False Pat_WS; Y ; Yes ; T ; True +# Prepended_Concatenation_Mark (PCM) + +PCM; N ; No ; F ; False +PCM; Y ; Yes ; T ; True + # Quotation_Mark (QMark) QMark; N ; No ; F ; False @@ -1106,13 +1155,14 @@ QMark; Y ; Yes ; T Radical; N ; No ; F ; False Radical; Y ; Yes ; T ; True -# STerm (STerm) +# Regional_Indicator (RI) -STerm; N ; No ; F ; False -STerm; Y ; Yes ; T ; True +RI ; N ; No ; F ; False +RI ; Y ; Yes ; T ; True # Script (sc) +sc ; Adlm ; Adlam sc ; Aghb ; Caucasian_Albanian sc ; Ahom ; Ahom sc ; Arab ; Arabic @@ -1124,6 +1174,7 @@ sc ; Bamu ; Bamum sc ; Bass ; Bassa_Vah sc ; Batk ; Batak sc ; Beng ; Bengali +sc ; Bhks ; Bhaiksuki sc ; Bopo ; Bopomofo sc ; Brah ; Brahmi sc ; Brai ; Braille @@ -1145,6 +1196,7 @@ sc ; Elba ; Elbasan sc ; Ethi ; Ethiopic sc ; Geor ; Georgian sc ; Glag ; Glagolitic +sc ; Gonm ; Masaram_Gondi sc ; Goth ; Gothic sc ; Gran ; Grantha sc ; Grek ; Greek @@ -1182,6 +1234,7 @@ sc ; Lydi ; Lydian sc ; Mahj ; Mahajani sc ; Mand ; Mandaic sc ; Mani ; Manichaean +sc ; Marc ; Marchen sc ; Mend ; Mende_Kikakui sc ; Merc ; Meroitic_Cursive sc ; Mero ; Meroitic_Hieroglyphs @@ -1194,11 +1247,14 @@ sc ; Mult ; Multani sc ; Mymr ; Myanmar sc ; Narb ; Old_North_Arabian sc ; Nbat ; Nabataean +sc ; Newa ; Newa sc ; Nkoo ; Nko +sc ; Nshu ; Nushu sc ; Ogam ; Ogham sc ; Olck ; Ol_Chiki sc ; Orkh ; Old_Turkic sc ; Orya ; Oriya +sc ; Osge ; Osage sc ; Osma ; Osmanya sc ; Palm ; Palmyrene sc ; Pauc ; Pau_Cin_Hau @@ -1221,6 +1277,7 @@ sc ; Sidd ; Siddham sc ; Sind ; Khudawadi sc ; Sinh ; Sinhala sc ; Sora ; Sora_Sompeng +sc ; Soyo ; Soyombo sc ; Sund ; Sundanese sc ; Sylo ; Syloti_Nagri sc ; Syrc ; Syriac @@ -1229,6 +1286,7 @@ sc ; Takr ; Takri sc ; Tale ; Tai_Le sc ; Talu ; New_Tai_Lue sc ; Taml ; Tamil +sc ; Tang ; Tangut sc ; Tavt ; Tai_Viet sc ; Telu ; Telugu sc ; Tfng ; Tifinagh @@ -1243,6 +1301,7 @@ sc ; Wara ; Warang_Citi sc ; Xpeo ; Old_Persian sc ; Xsux ; Cuneiform sc ; Yiii ; Yi +sc ; Zanb ; Zanabazar_Square sc ; Zinh ; Inherited ; Qaai sc ; Zyyy ; Common sc ; Zzzz ; Unknown @@ -1269,6 +1328,11 @@ SB ; ST ; STerm SB ; UP ; Upper SB ; XX ; Other +# Sentence_Terminal (STerm) + +STerm; N ; No ; F ; False +STerm; Y ; Yes ; T ; True + # Simple_Case_Folding (scf) # @missing: 0000..10FFFF; Simple_Case_Folding; @@ -1322,6 +1386,13 @@ Upper; Y ; Yes ; T VS ; N ; No ; F ; False VS ; Y ; Yes ; T ; True +# Vertical_Orientation (vo) + +vo ; R ; Rotated +vo ; Tr ; Transformed_Rotated +vo ; Tu ; Transformed_Upright +vo ; U ; Upright + # White_Space (WSpace) WSpace; N ; No ; F ; False @@ -1331,9 +1402,13 @@ WSpace; Y ; Yes ; T WB ; CR ; CR WB ; DQ ; Double_Quote +WB ; EB ; E_Base +WB ; EBG ; E_Base_GAZ +WB ; EM ; E_Modifier WB ; EX ; ExtendNumLet WB ; Extend ; Extend WB ; FO ; Format +WB ; GAZ ; Glue_After_Zwj WB ; HL ; Hebrew_Letter WB ; KA ; Katakana WB ; LE ; ALetter @@ -1346,6 +1421,7 @@ WB ; NU ; Numeric WB ; RI ; Regional_Indicator WB ; SQ ; Single_Quote WB ; XX ; Other +WB ; ZWJ ; ZWJ # XID_Continue (XIDC) diff --git a/test/jdk/java/lang/Character/Scripts.txt b/test/jdk/java/lang/Character/Scripts.txt index 7e42740407c..80430b32a8f 100644 --- a/test/jdk/java/lang/Character/Scripts.txt +++ b/test/jdk/java/lang/Character/Scripts.txt @@ -1,10 +1,11 @@ -# Scripts-8.0.0.txt -# Date: 2015-03-11, 22:29:42 GMT [MD] +# Scripts-10.0.0.txt +# Date: 2017-03-11, 06:40:37 GMT +# Copyright (c) 2017 Unicode, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see http://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2015 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# For documentation, see http://www.unicode.org/reports/tr44/ +# For documentation, see http://www.unicode.org/reports/tr44/ # For more information, see: # UAX #24, Unicode Script Property: http://www.unicode.org/reports/tr24/ # Especially the sections: @@ -92,10 +93,10 @@ 0605 ; Common # Cf ARABIC NUMBER MARK ABOVE 060C ; Common # Po ARABIC COMMA 061B ; Common # Po ARABIC SEMICOLON -061C ; Common # Cf ARABIC LETTER MARK 061F ; Common # Po ARABIC QUESTION MARK 0640 ; Common # Lm ARABIC TATWEEL 06DD ; Common # Cf ARABIC END OF AYAH +08E2 ; Common # Cf ARABIC DISPUTED END OF AYAH 0964..0965 ; Common # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA 0E3F ; Common # Sc THAI CURRENCY SYMBOL BAHT 0FD5..0FD8 ; Common # So [4] RIGHT-FACING SVASTI SIGN..LEFT-FACING SVASTI SIGN WITH DOTS @@ -110,6 +111,7 @@ 1CEE..1CF1 ; Common # Lo [4] VEDIC SIGN HEXIFORM LONG ANUSVARA..VEDIC SIGN ANUSVARA UBHAYATO MUKHA 1CF2..1CF3 ; Common # Mc [2] VEDIC SIGN ARDHAVISARGA..VEDIC SIGN ROTATED ARDHAVISARGA 1CF5..1CF6 ; Common # Lo [2] VEDIC SIGN JIHVAMULIYA..VEDIC SIGN UPADHMANIYA +1CF7 ; Common # Mc VEDIC SIGN ATIKRAMA 2000..200A ; Common # Zs [11] EN QUAD..HAIR SPACE 200B ; Common # Cf ZERO WIDTH SPACE 200E..200F ; Common # Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK @@ -153,7 +155,7 @@ 208A..208C ; Common # Sm [3] SUBSCRIPT PLUS SIGN..SUBSCRIPT EQUALS SIGN 208D ; Common # Ps SUBSCRIPT LEFT PARENTHESIS 208E ; Common # Pe SUBSCRIPT RIGHT PARENTHESIS -20A0..20BE ; Common # Sc [31] EURO-CURRENCY SIGN..LARI SIGN +20A0..20BF ; Common # Sc [32] EURO-CURRENCY SIGN..BITCOIN SIGN 2100..2101 ; Common # So [2] ACCOUNT OF..ADDRESSED TO THE SUBJECT 2102 ; Common # L& DOUBLE-STRUCK CAPITAL C 2103..2106 ; Common # So [4] DEGREE CELSIUS..CADA UNA @@ -223,8 +225,7 @@ 239B..23B3 ; Common # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM 23B4..23DB ; Common # So [40] TOP SQUARE BRACKET..FUSE 23DC..23E1 ; Common # Sm [6] TOP PARENTHESIS..BOTTOM TORTOISE SHELL BRACKET -23E2..23FA ; Common # So [25] WHITE TRAPEZIUM..BLACK CIRCLE FOR RECORD -2400..2426 ; Common # So [39] SYMBOL FOR NULL..SYMBOL FOR SUBSTITUTE FORM TWO +23E2..2426 ; Common # So [69] WHITE TRAPEZIUM..SYMBOL FOR SUBSTITUTE FORM TWO 2440..244A ; Common # So [11] OCR HOOK..OCR DOUBLE BACKSLASH 2460..249B ; Common # No [60] CIRCLED DIGIT ONE..NUMBER TWENTY FULL STOP 249C..24E9 ; Common # So [78] PARENTHESIZED LATIN SMALL LETTER A..CIRCLED LATIN SMALL LETTER Z @@ -309,7 +310,7 @@ 2B76..2B95 ; Common # So [32] NORTH WEST TRIANGLE-HEADED ARROW TO BAR..RIGHTWARDS BLACK ARROW 2B98..2BB9 ; Common # So [34] THREE-D TOP-LIGHTED LEFTWARDS EQUILATERAL ARROWHEAD..UP ARROWHEAD IN A RECTANGLE BOX 2BBD..2BC8 ; Common # So [12] BALLOT BOX WITH LIGHT X..BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED -2BCA..2BD1 ; Common # So [8] TOP HALF BLACK CIRCLE..UNCERTAINTY SIGN +2BCA..2BD2 ; Common # So [9] TOP HALF BLACK CIRCLE..GROUP MARK 2BEC..2BEF ; Common # So [4] LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS..DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS 2E00..2E01 ; Common # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER 2E02 ; Common # Pi LEFT SUBSTITUTION BRACKET @@ -348,6 +349,7 @@ 2E40 ; Common # Pd DOUBLE HYPHEN 2E41 ; Common # Po REVERSED COMMA 2E42 ; Common # Ps DOUBLE LOW-REVERSED-9 QUOTATION MARK +2E43..2E49 ; Common # Po [7] DASH WITH LEFT UPTURN..DOUBLE STACKED COMMA 2FF0..2FFB ; Common # So [12] IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT..IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID 3000 ; Common # Zs IDEOGRAPHIC SPACE 3001..3003 ; Common # Po [3] IDEOGRAPHIC COMMA..DITTO MARK @@ -572,19 +574,18 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR 1F100..1F10C ; Common # No [13] DIGIT ZERO FULL STOP..DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ZERO 1F110..1F12E ; Common # So [31] PARENTHESIZED LATIN CAPITAL LETTER A..CIRCLED WZ 1F130..1F16B ; Common # So [60] SQUARED LATIN CAPITAL LETTER A..RAISED MD SIGN -1F170..1F19A ; Common # So [43] NEGATIVE SQUARED LATIN CAPITAL LETTER A..SQUARED VS +1F170..1F1AC ; Common # So [61] NEGATIVE SQUARED LATIN CAPITAL LETTER A..SQUARED VOD 1F1E6..1F1FF ; Common # So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z 1F201..1F202 ; Common # So [2] SQUARED KATAKANA KOKO..SQUARED KATAKANA SA -1F210..1F23A ; Common # So [43] SQUARED CJK UNIFIED IDEOGRAPH-624B..SQUARED CJK UNIFIED IDEOGRAPH-55B6 +1F210..1F23B ; Common # So [44] SQUARED CJK UNIFIED IDEOGRAPH-624B..SQUARED CJK UNIFIED IDEOGRAPH-914D 1F240..1F248 ; Common # So [9] TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-672C..TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557 1F250..1F251 ; Common # So [2] CIRCLED IDEOGRAPH ADVANTAGE..CIRCLED IDEOGRAPH ACCEPT +1F260..1F265 ; Common # So [6] ROUNDED SYMBOL FOR FU..ROUNDED SYMBOL FOR CAI 1F300..1F3FA ; Common # So [251] CYCLONE..AMPHORA 1F3FB..1F3FF ; Common # Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6 -1F400..1F579 ; Common # So [378] RAT..JOYSTICK -1F57B..1F5A3 ; Common # So [41] LEFT HAND TELEPHONE RECEIVER..BLACK DOWN POINTING BACKHAND INDEX -1F5A5..1F6D0 ; Common # So [300] DESKTOP COMPUTER..PLACE OF WORSHIP +1F400..1F6D4 ; Common # So [725] RAT..PAGODA 1F6E0..1F6EC ; Common # So [13] HAMMER AND WRENCH..AIRPLANE ARRIVING -1F6F0..1F6F3 ; Common # So [4] SATELLITE..PASSENGER SHIP +1F6F0..1F6F8 ; Common # So [9] SATELLITE..FLYING SAUCER 1F700..1F773 ; Common # So [116] ALCHEMICAL SYMBOL FOR QUINTESSENCE..ALCHEMICAL SYMBOL FOR HALF OUNCE 1F780..1F7D4 ; Common # So [85] BLACK LEFT-POINTING ISOSCELES RIGHT TRIANGLE..HEAVY TWELVE POINTED PINWHEEL STAR 1F800..1F80B ; Common # So [12] LEFTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD..DOWNWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD @@ -592,13 +593,17 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR 1F850..1F859 ; Common # So [10] LEFTWARDS SANS-SERIF ARROW..UP DOWN SANS-SERIF ARROW 1F860..1F887 ; Common # So [40] WIDE-HEADED LEFTWARDS LIGHT BARB ARROW..WIDE-HEADED SOUTH WEST VERY HEAVY BARB ARROW 1F890..1F8AD ; Common # So [30] LEFTWARDS TRIANGLE ARROWHEAD..WHITE ARROW SHAFT WIDTH TWO THIRDS -1F910..1F918 ; Common # So [9] ZIPPER-MOUTH FACE..SIGN OF THE HORNS -1F980..1F984 ; Common # So [5] CRAB..UNICORN FACE +1F900..1F90B ; Common # So [12] CIRCLED CROSS FORMEE WITH FOUR DOTS..DOWNWARD FACING NOTCHED HOOK WITH DOT +1F910..1F93E ; Common # So [47] ZIPPER-MOUTH FACE..HANDBALL +1F940..1F94C ; Common # So [13] WILTED FLOWER..CURLING STONE +1F950..1F96B ; Common # So [28] CROISSANT..CANNED FOOD +1F980..1F997 ; Common # So [24] CRAB..CRICKET 1F9C0 ; Common # So CHEESE WEDGE +1F9D0..1F9E6 ; Common # So [23] FACE WITH MONOCLE..SOCKS E0001 ; Common # Cf LANGUAGE TAG E0020..E007F ; Common # Cf [96] TAG SPACE..CANCEL TAG -# Total code points: 7179 +# Total code points: 7363 # ================================================ @@ -641,7 +646,7 @@ A770 ; Latin # Lm MODIFIER LETTER US A771..A787 ; Latin # L& [23] LATIN SMALL LETTER DUM..LATIN SMALL LETTER INSULAR T A78B..A78E ; Latin # L& [4] LATIN CAPITAL LETTER SALTILLO..LATIN SMALL LETTER L WITH RETROFLEX HOOK AND BELT A78F ; Latin # Lo LATIN LETTER SINOLOGICAL DOT -A790..A7AD ; Latin # L& [30] LATIN CAPITAL LETTER N WITH DESCENDER..LATIN CAPITAL LETTER L WITH BELT +A790..A7AE ; Latin # L& [31] LATIN CAPITAL LETTER N WITH DESCENDER..LATIN CAPITAL LETTER SMALL CAPITAL I A7B0..A7B7 ; Latin # L& [8] LATIN CAPITAL LETTER TURNED K..LATIN SMALL LETTER OMEGA A7F7 ; Latin # Lo LATIN EPIGRAPHIC LETTER SIDEWAYS I A7F8..A7F9 ; Latin # Lm [2] MODIFIER LETTER CAPITAL H WITH STROKE..MODIFIER LETTER SMALL LIGATURE OE @@ -654,7 +659,7 @@ FB00..FB06 ; Latin # L& [7] LATIN SMALL LIGATURE FF..LATIN SMALL LIGATURE S FF21..FF3A ; Latin # L& [26] FULLWIDTH LATIN CAPITAL LETTER A..FULLWIDTH LATIN CAPITAL LETTER Z FF41..FF5A ; Latin # L& [26] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH LATIN SMALL LETTER Z -# Total code points: 1349 +# Total code points: 1350 # ================================================ @@ -708,13 +713,13 @@ AB65 ; Greek # L& GREEK LETTER SMALL CAPITAL OMEGA 10175..10178 ; Greek # No [4] GREEK ONE HALF SIGN..GREEK THREE QUARTERS SIGN 10179..10189 ; Greek # So [17] GREEK YEAR SIGN..GREEK TRYBLION BASE SIGN 1018A..1018B ; Greek # No [2] GREEK ZERO SIGN..GREEK ONE QUARTER SIGN -1018C ; Greek # So GREEK SINUSOID SIGN +1018C..1018E ; Greek # So [3] GREEK SINUSOID SIGN..NOMISMA SIGN 101A0 ; Greek # So GREEK SYMBOL TAU RHO 1D200..1D241 ; Greek # So [66] GREEK VOCAL NOTATION SYMBOL-1..GREEK INSTRUMENTAL NOTATION SYMBOL-54 1D242..1D244 ; Greek # Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME 1D245 ; Greek # So GREEK MUSICAL LEIMMA -# Total code points: 516 +# Total code points: 518 # ================================================ @@ -724,6 +729,7 @@ AB65 ; Greek # L& GREEK LETTER SMALL CAPITAL OMEGA 0487 ; Cyrillic # Mn COMBINING CYRILLIC POKRYTIE 0488..0489 ; Cyrillic # Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN 048A..052F ; Cyrillic # L& [166] CYRILLIC CAPITAL LETTER SHORT I WITH TAIL..CYRILLIC SMALL LETTER EL WITH DESCENDER +1C80..1C88 ; Cyrillic # L& [9] CYRILLIC SMALL LETTER ROUNDED VE..CYRILLIC SMALL LETTER UNBLENDED UK 1D2B ; Cyrillic # L& CYRILLIC LETTER SMALL CAPITAL EL 1D78 ; Cyrillic # Lm MODIFIER LETTER CYRILLIC EN 2DE0..2DFF ; Cyrillic # Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS @@ -740,7 +746,7 @@ A69C..A69D ; Cyrillic # Lm [2] MODIFIER LETTER CYRILLIC HARD SIGN..MODIFIER A69E..A69F ; Cyrillic # Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E FE2E..FE2F ; Cyrillic # Mn [2] COMBINING CYRILLIC TITLO LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF -# Total code points: 434 +# Total code points: 443 # ================================================ @@ -791,6 +797,7 @@ FB46..FB4F ; Hebrew # Lo [10] HEBREW LETTER TSADI WITH DAGESH..HEBREW LIGATU 060D ; Arabic # Po ARABIC DATE SEPARATOR 060E..060F ; Arabic # So [2] ARABIC POETIC VERSE SIGN..ARABIC SIGN MISRA 0610..061A ; Arabic # Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA +061C ; Arabic # Cf ARABIC LETTER MARK 061E ; Arabic # Po ARABIC TRIPLE DOT PUNCTUATION MARK 0620..063F ; Arabic # Lo [32] ARABIC LETTER KASHMIRI YEH..ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE 0641..064A ; Arabic # Lo [10] ARABIC LETTER FEH..ARABIC LETTER YEH @@ -815,6 +822,8 @@ FB46..FB4F ; Hebrew # Lo [10] HEBREW LETTER TSADI WITH DAGESH..HEBREW LIGATU 06FF ; Arabic # Lo ARABIC LETTER HEH WITH INVERTED V 0750..077F ; Arabic # Lo [48] ARABIC LETTER BEH WITH THREE DOTS HORIZONTALLY BELOW..ARABIC LETTER KAF WITH TWO DOTS ABOVE 08A0..08B4 ; Arabic # Lo [21] ARABIC LETTER BEH WITH SMALL V BELOW..ARABIC LETTER KAF WITH DOT BELOW +08B6..08BD ; Arabic # Lo [8] ARABIC LETTER BEH WITH SMALL MEEM ABOVE..ARABIC LETTER AFRICAN NOON +08D4..08E1 ; Arabic # Mn [14] ARABIC SMALL HIGH WORD AR-RUB..ARABIC SMALL HIGH SIGN SAFHA 08E3..08FF ; Arabic # Mn [29] ARABIC TURNED DAMMA BELOW..ARABIC MARK SIDEWAYS NOON GHUNNA FB50..FBB1 ; Arabic # Lo [98] ARABIC LETTER ALEF WASLA ISOLATED FORM..ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM FBB2..FBC1 ; Arabic # Sk [16] ARABIC SYMBOL DOT ABOVE..ARABIC SYMBOL SMALL TAH BELOW @@ -862,7 +871,7 @@ FE76..FEFC ; Arabic # Lo [135] ARABIC FATHA ISOLATED FORM..ARABIC LIGATURE LA 1EEAB..1EEBB ; Arabic # Lo [17] ARABIC MATHEMATICAL DOUBLE-STRUCK LAM..ARABIC MATHEMATICAL DOUBLE-STRUCK GHAIN 1EEF0..1EEF1 ; Arabic # Sm [2] ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL..ARABIC MATHEMATICAL OPERATOR HAH WITH DAL -# Total code points: 1257 +# Total code points: 1280 # ================================================ @@ -873,8 +882,9 @@ FE76..FEFC ; Arabic # Lo [135] ARABIC FATHA ISOLATED FORM..ARABIC LIGATURE LA 0712..072F ; Syriac # Lo [30] SYRIAC LETTER BETH..SYRIAC LETTER PERSIAN DHALATH 0730..074A ; Syriac # Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH 074D..074F ; Syriac # Lo [3] SYRIAC LETTER SOGDIAN ZHAIN..SYRIAC LETTER SOGDIAN FE +0860..086A ; Syriac # Lo [11] SYRIAC LETTER MALAYALAM NGA..SYRIAC LETTER MALAYALAM SSA -# Total code points: 77 +# Total code points: 88 # ================================================ @@ -944,8 +954,10 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 09F4..09F9 ; Bengali # No [6] BENGALI CURRENCY NUMERATOR ONE..BENGALI CURRENCY DENOMINATOR SIXTEEN 09FA ; Bengali # So BENGALI ISSHAR 09FB ; Bengali # Sc BENGALI GANDA MARK +09FC ; Bengali # Lo BENGALI LETTER VEDIC ANUSVARA +09FD ; Bengali # Po BENGALI ABBREVIATION SIGN -# Total code points: 93 +# Total code points: 95 # ================================================ @@ -998,8 +1010,9 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 0AF0 ; Gujarati # Po GUJARATI ABBREVIATION SIGN 0AF1 ; Gujarati # Sc GUJARATI RUPEE SIGN 0AF9 ; Gujarati # Lo GUJARATI LETTER ZHA +0AFA..0AFF ; Gujarati # Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE -# Total code points: 85 +# Total code points: 91 # ================================================ @@ -1086,6 +1099,7 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM # ================================================ +0C80 ; Kannada # Lo KANNADA SIGN SPACING CANDRABINDU 0C81 ; Kannada # Mn KANNADA SIGN CANDRABINDU 0C82..0C83 ; Kannada # Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA 0C85..0C8C ; Kannada # Lo [8] KANNADA LETTER A..KANNADA LETTER VOCALIC L @@ -1109,15 +1123,16 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 0CE6..0CEF ; Kannada # Nd [10] KANNADA DIGIT ZERO..KANNADA DIGIT NINE 0CF1..0CF2 ; Kannada # Lo [2] KANNADA SIGN JIHVAMULIYA..KANNADA SIGN UPADHMANIYA -# Total code points: 87 +# Total code points: 88 # ================================================ -0D01 ; Malayalam # Mn MALAYALAM SIGN CANDRABINDU +0D00..0D01 ; Malayalam # Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU 0D02..0D03 ; Malayalam # Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA 0D05..0D0C ; Malayalam # Lo [8] MALAYALAM LETTER A..MALAYALAM LETTER VOCALIC L 0D0E..0D10 ; Malayalam # Lo [3] MALAYALAM LETTER E..MALAYALAM LETTER AI 0D12..0D3A ; Malayalam # Lo [41] MALAYALAM LETTER O..MALAYALAM LETTER TTTA +0D3B..0D3C ; Malayalam # Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA 0D3D ; Malayalam # Lo MALAYALAM SIGN AVAGRAHA 0D3E..0D40 ; Malayalam # Mc [3] MALAYALAM VOWEL SIGN AA..MALAYALAM VOWEL SIGN II 0D41..0D44 ; Malayalam # Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR @@ -1125,15 +1140,18 @@ A8FD ; Devanagari # Lo DEVANAGARI JAIN OM 0D4A..0D4C ; Malayalam # Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU 0D4D ; Malayalam # Mn MALAYALAM SIGN VIRAMA 0D4E ; Malayalam # Lo MALAYALAM LETTER DOT REPH +0D4F ; Malayalam # So MALAYALAM SIGN PARA +0D54..0D56 ; Malayalam # Lo [3] MALAYALAM LETTER CHILLU M..MALAYALAM LETTER CHILLU LLL 0D57 ; Malayalam # Mc MALAYALAM AU LENGTH MARK +0D58..0D5E ; Malayalam # No [7] MALAYALAM FRACTION ONE ONE-HUNDRED-AND-SIXTIETH..MALAYALAM FRACTION ONE FIFTH 0D5F..0D61 ; Malayalam # Lo [3] MALAYALAM LETTER ARCHAIC II..MALAYALAM LETTER VOCALIC LL 0D62..0D63 ; Malayalam # Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL 0D66..0D6F ; Malayalam # Nd [10] MALAYALAM DIGIT ZERO..MALAYALAM DIGIT NINE -0D70..0D75 ; Malayalam # No [6] MALAYALAM NUMBER TEN..MALAYALAM FRACTION THREE QUARTERS +0D70..0D78 ; Malayalam # No [9] MALAYALAM NUMBER TEN..MALAYALAM FRACTION THREE SIXTEENTHS 0D79 ; Malayalam # So MALAYALAM DATE MARK 0D7A..0D7F ; Malayalam # Lo [6] MALAYALAM LETTER CHILLU NN..MALAYALAM LETTER CHILLU K -# Total code points: 100 +# Total code points: 117 # ================================================ @@ -1436,21 +1454,24 @@ AB70..ABBF ; Cherokee # L& [80] CHEROKEE SMALL LETTER A..CHEROKEE SMALL LETT 1820..1842 ; Mongolian # Lo [35] MONGOLIAN LETTER A..MONGOLIAN LETTER CHI 1843 ; Mongolian # Lm MONGOLIAN LETTER TODO LONG VOWEL SIGN 1844..1877 ; Mongolian # Lo [52] MONGOLIAN LETTER TODO E..MONGOLIAN LETTER MANCHU ZHA -1880..18A8 ; Mongolian # Lo [41] MONGOLIAN LETTER ALI GALI ANUSVARA ONE..MONGOLIAN LETTER MANCHU ALI GALI BHA +1880..1884 ; Mongolian # Lo [5] MONGOLIAN LETTER ALI GALI ANUSVARA ONE..MONGOLIAN LETTER ALI GALI INVERTED UBADAMA +1885..1886 ; Mongolian # Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA +1887..18A8 ; Mongolian # Lo [34] MONGOLIAN LETTER ALI GALI A..MONGOLIAN LETTER MANCHU ALI GALI BHA 18A9 ; Mongolian # Mn MONGOLIAN LETTER ALI GALI DAGALGA 18AA ; Mongolian # Lo MONGOLIAN LETTER MANCHU ALI GALI LHA +11660..1166C ; Mongolian # Po [13] MONGOLIAN BIRGA WITH ORNAMENT..MONGOLIAN TURNED SWIRL BIRGA WITH DOUBLE ORNAMENT -# Total code points: 153 +# Total code points: 166 # ================================================ 3041..3096 ; Hiragana # Lo [86] HIRAGANA LETTER SMALL A..HIRAGANA LETTER SMALL KE 309D..309E ; Hiragana # Lm [2] HIRAGANA ITERATION MARK..HIRAGANA VOICED ITERATION MARK 309F ; Hiragana # Lo HIRAGANA DIGRAPH YORI -1B001 ; Hiragana # Lo HIRAGANA LETTER ARCHAIC YE +1B001..1B11E ; Hiragana # Lo [286] HIRAGANA LETTER ARCHAIC YE..HENTAIGANA LETTER N-MU-MO-2 1F200 ; Hiragana # So SQUARE HIRAGANA HOKA -# Total code points: 91 +# Total code points: 376 # ================================================ @@ -1469,10 +1490,10 @@ FF71..FF9D ; Katakana # Lo [45] HALFWIDTH KATAKANA LETTER A..HALFWIDTH KATAK # ================================================ 02EA..02EB ; Bopomofo # Sk [2] MODIFIER LETTER YIN DEPARTING TONE MARK..MODIFIER LETTER YANG DEPARTING TONE MARK -3105..312D ; Bopomofo # Lo [41] BOPOMOFO LETTER B..BOPOMOFO LETTER IH +3105..312E ; Bopomofo # Lo [42] BOPOMOFO LETTER B..BOPOMOFO LETTER O WITH DOT ABOVE 31A0..31BA ; Bopomofo # Lo [27] BOPOMOFO LETTER BU..BOPOMOFO LETTER ZY -# Total code points: 70 +# Total code points: 71 # ================================================ @@ -1485,16 +1506,17 @@ FF71..FF9D ; Katakana # Lo [45] HALFWIDTH KATAKANA LETTER A..HALFWIDTH KATAK 3038..303A ; Han # Nl [3] HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY 303B ; Han # Lm VERTICAL IDEOGRAPHIC ITERATION MARK 3400..4DB5 ; Han # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5 -4E00..9FD5 ; Han # Lo [20950] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FD5 +4E00..9FEA ; Han # Lo [20971] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FEA F900..FA6D ; Han # Lo [366] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA6D FA70..FAD9 ; Han # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9 20000..2A6D6 ; Han # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6 2A700..2B734 ; Han # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734 2B740..2B81D ; Han # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D 2B820..2CEA1 ; Han # Lo [5762] CJK UNIFIED IDEOGRAPH-2B820..CJK UNIFIED IDEOGRAPH-2CEA1 +2CEB0..2EBE0 ; Han # Lo [7473] CJK UNIFIED IDEOGRAPH-2CEB0..CJK UNIFIED IDEOGRAPH-2EBE0 2F800..2FA1D ; Han # Lo [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D -# Total code points: 81734 +# Total code points: 89228 # ================================================ @@ -1509,8 +1531,9 @@ A490..A4C6 ; Yi # So [55] YI RADICAL QOT..YI RADICAL KE 10300..1031F ; Old_Italic # Lo [32] OLD ITALIC LETTER A..OLD ITALIC LETTER ESS 10320..10323 ; Old_Italic # No [4] OLD ITALIC NUMERAL ONE..OLD ITALIC NUMERAL FIFTY +1032D..1032F ; Old_Italic # Lo [3] OLD ITALIC LETTER YE..OLD ITALIC LETTER SOUTHERN TSE -# Total code points: 36 +# Total code points: 39 # ================================================ @@ -1542,8 +1565,8 @@ A490..A4C6 ; Yi # So [55] YI RADICAL QOT..YI RADICAL KE 1CED ; Inherited # Mn VEDIC SIGN TIRYAK 1CF4 ; Inherited # Mn VEDIC TONE CANDRA ABOVE 1CF8..1CF9 ; Inherited # Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE -1DC0..1DF5 ; Inherited # Mn [54] COMBINING DOTTED GRAVE ACCENT..COMBINING UP TACK ABOVE -1DFC..1DFF ; Inherited # Mn [4] COMBINING DOUBLE INVERTED BREVE BELOW..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW +1DC0..1DF9 ; Inherited # Mn [58] COMBINING DOTTED GRAVE ACCENT..COMBINING WIDE INVERTED BRIDGE BELOW +1DFB..1DFF ; Inherited # Mn [5] COMBINING DELETION MARK..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW 200C..200D ; Inherited # Cf [2] ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER 20D0..20DC ; Inherited # Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE 20DD..20E0 ; Inherited # Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH @@ -1562,7 +1585,7 @@ FE20..FE2D ; Inherited # Mn [14] COMBINING LIGATURE LEFT HALF..COMBINING CON 1D1AA..1D1AD ; Inherited # Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO E0100..E01EF ; Inherited # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 -# Total code points: 563 +# Total code points: 568 # ================================================ @@ -1705,8 +1728,13 @@ E0100..E01EF ; Inherited # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-2 2C00..2C2E ; Glagolitic # L& [47] GLAGOLITIC CAPITAL LETTER AZU..GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE 2C30..2C5E ; Glagolitic # L& [47] GLAGOLITIC SMALL LETTER AZU..GLAGOLITIC SMALL LETTER LATINATE MYSLITE +1E000..1E006 ; Glagolitic # Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE +1E008..1E018 ; Glagolitic # Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU +1E01B..1E021 ; Glagolitic # Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI +1E023..1E024 ; Glagolitic # Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS +1E026..1E02A ; Glagolitic # Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA -# Total code points: 94 +# Total code points: 132 # ================================================ @@ -1872,11 +1900,11 @@ A62A..A62B ; Vai # Lo [2] VAI SYLLABLE NDOLE MA..VAI SYLLABLE NDOLE DO A880..A881 ; Saurashtra # Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA A882..A8B3 ; Saurashtra # Lo [50] SAURASHTRA LETTER A..SAURASHTRA LETTER LLA A8B4..A8C3 ; Saurashtra # Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU -A8C4 ; Saurashtra # Mn SAURASHTRA SIGN VIRAMA +A8C4..A8C5 ; Saurashtra # Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU A8CE..A8CF ; Saurashtra # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA A8D0..A8D9 ; Saurashtra # Nd [10] SAURASHTRA DIGIT ZERO..SAURASHTRA DIGIT NINE -# Total code points: 81 +# Total code points: 82 # ================================================ @@ -2314,8 +2342,9 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI 11235 ; Khojki # Mc KHOJKI SIGN VIRAMA 11236..11237 ; Khojki # Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA 11238..1123D ; Khojki # Po [6] KHOJKI DANDA..KHOJKI ABBREVIATION SIGN +1123E ; Khojki # Mn KHOJKI SIGN SUKUN -# Total code points: 61 +# Total code points: 62 # ================================================ @@ -2536,4 +2565,129 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI # Total code points: 672 +# ================================================ + +1E900..1E943 ; Adlam # L& [68] ADLAM CAPITAL LETTER ALIF..ADLAM SMALL LETTER SHA +1E944..1E94A ; Adlam # Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA +1E950..1E959 ; Adlam # Nd [10] ADLAM DIGIT ZERO..ADLAM DIGIT NINE +1E95E..1E95F ; Adlam # Po [2] ADLAM INITIAL EXCLAMATION MARK..ADLAM INITIAL QUESTION MARK + +# Total code points: 87 + +# ================================================ + +11C00..11C08 ; Bhaiksuki # Lo [9] BHAIKSUKI LETTER A..BHAIKSUKI LETTER VOCALIC L +11C0A..11C2E ; Bhaiksuki # Lo [37] BHAIKSUKI LETTER E..BHAIKSUKI LETTER HA +11C2F ; Bhaiksuki # Mc BHAIKSUKI VOWEL SIGN AA +11C30..11C36 ; Bhaiksuki # Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L +11C38..11C3D ; Bhaiksuki # Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA +11C3E ; Bhaiksuki # Mc BHAIKSUKI SIGN VISARGA +11C3F ; Bhaiksuki # Mn BHAIKSUKI SIGN VIRAMA +11C40 ; Bhaiksuki # Lo BHAIKSUKI SIGN AVAGRAHA +11C41..11C45 ; Bhaiksuki # Po [5] BHAIKSUKI DANDA..BHAIKSUKI GAP FILLER-2 +11C50..11C59 ; Bhaiksuki # Nd [10] BHAIKSUKI DIGIT ZERO..BHAIKSUKI DIGIT NINE +11C5A..11C6C ; Bhaiksuki # No [19] BHAIKSUKI NUMBER ONE..BHAIKSUKI HUNDREDS UNIT MARK + +# Total code points: 97 + +# ================================================ + +11C70..11C71 ; Marchen # Po [2] MARCHEN HEAD MARK..MARCHEN MARK SHAD +11C72..11C8F ; Marchen # Lo [30] MARCHEN LETTER KA..MARCHEN LETTER A +11C92..11CA7 ; Marchen # Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA +11CA9 ; Marchen # Mc MARCHEN SUBJOINED LETTER YA +11CAA..11CB0 ; Marchen # Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA +11CB1 ; Marchen # Mc MARCHEN VOWEL SIGN I +11CB2..11CB3 ; Marchen # Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E +11CB4 ; Marchen # Mc MARCHEN VOWEL SIGN O +11CB5..11CB6 ; Marchen # Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU + +# Total code points: 68 + +# ================================================ + +11400..11434 ; Newa # Lo [53] NEWA LETTER A..NEWA LETTER HA +11435..11437 ; Newa # Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II +11438..1143F ; Newa # Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI +11440..11441 ; Newa # Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU +11442..11444 ; Newa # Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA +11445 ; Newa # Mc NEWA SIGN VISARGA +11446 ; Newa # Mn NEWA SIGN NUKTA +11447..1144A ; Newa # Lo [4] NEWA SIGN AVAGRAHA..NEWA SIDDHI +1144B..1144F ; Newa # Po [5] NEWA DANDA..NEWA ABBREVIATION SIGN +11450..11459 ; Newa # Nd [10] NEWA DIGIT ZERO..NEWA DIGIT NINE +1145B ; Newa # Po NEWA PLACEHOLDER MARK +1145D ; Newa # Po NEWA INSERTION SIGN + +# Total code points: 92 + +# ================================================ + +104B0..104D3 ; Osage # L& [36] OSAGE CAPITAL LETTER A..OSAGE CAPITAL LETTER ZHA +104D8..104FB ; Osage # L& [36] OSAGE SMALL LETTER A..OSAGE SMALL LETTER ZHA + +# Total code points: 72 + +# ================================================ + +16FE0 ; Tangut # Lm TANGUT ITERATION MARK +17000..187EC ; Tangut # Lo [6125] TANGUT IDEOGRAPH-17000..TANGUT IDEOGRAPH-187EC +18800..18AF2 ; Tangut # Lo [755] TANGUT COMPONENT-001..TANGUT COMPONENT-755 + +# Total code points: 6881 + +# ================================================ + +11D00..11D06 ; Masaram_Gondi # Lo [7] MASARAM GONDI LETTER A..MASARAM GONDI LETTER E +11D08..11D09 ; Masaram_Gondi # Lo [2] MASARAM GONDI LETTER AI..MASARAM GONDI LETTER O +11D0B..11D30 ; Masaram_Gondi # Lo [38] MASARAM GONDI LETTER AU..MASARAM GONDI LETTER TRA +11D31..11D36 ; Masaram_Gondi # Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R +11D3A ; Masaram_Gondi # Mn MASARAM GONDI VOWEL SIGN E +11D3C..11D3D ; Masaram_Gondi # Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O +11D3F..11D45 ; Masaram_Gondi # Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA +11D46 ; Masaram_Gondi # Lo MASARAM GONDI REPHA +11D47 ; Masaram_Gondi # Mn MASARAM GONDI RA-KARA +11D50..11D59 ; Masaram_Gondi # Nd [10] MASARAM GONDI DIGIT ZERO..MASARAM GONDI DIGIT NINE + +# Total code points: 75 + +# ================================================ + +16FE1 ; Nushu # Lm NUSHU ITERATION MARK +1B170..1B2FB ; Nushu # Lo [396] NUSHU CHARACTER-1B170..NUSHU CHARACTER-1B2FB + +# Total code points: 397 + +# ================================================ + +11A50 ; Soyombo # Lo SOYOMBO LETTER A +11A51..11A56 ; Soyombo # Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE +11A57..11A58 ; Soyombo # Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU +11A59..11A5B ; Soyombo # Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK +11A5C..11A83 ; Soyombo # Lo [40] SOYOMBO LETTER KA..SOYOMBO LETTER KSSA +11A86..11A89 ; Soyombo # Lo [4] SOYOMBO CLUSTER-INITIAL LETTER RA..SOYOMBO CLUSTER-INITIAL LETTER SA +11A8A..11A96 ; Soyombo # Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA +11A97 ; Soyombo # Mc SOYOMBO SIGN VISARGA +11A98..11A99 ; Soyombo # Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER +11A9A..11A9C ; Soyombo # Po [3] SOYOMBO MARK TSHEG..SOYOMBO MARK DOUBLE SHAD +11A9E..11AA2 ; Soyombo # Po [5] SOYOMBO HEAD MARK WITH MOON AND SUN AND TRIPLE FLAME..SOYOMBO TERMINAL MARK-2 + +# Total code points: 80 + +# ================================================ + +11A00 ; Zanabazar_Square # Lo ZANABAZAR SQUARE LETTER A +11A01..11A06 ; Zanabazar_Square # Mn [6] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL SIGN O +11A07..11A08 ; Zanabazar_Square # Mc [2] ZANABAZAR SQUARE VOWEL SIGN AI..ZANABAZAR SQUARE VOWEL SIGN AU +11A09..11A0A ; Zanabazar_Square # Mn [2] ZANABAZAR SQUARE VOWEL SIGN REVERSED I..ZANABAZAR SQUARE VOWEL LENGTH MARK +11A0B..11A32 ; Zanabazar_Square # Lo [40] ZANABAZAR SQUARE LETTER KA..ZANABAZAR SQUARE LETTER KSSA +11A33..11A38 ; Zanabazar_Square # Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA +11A39 ; Zanabazar_Square # Mc ZANABAZAR SQUARE SIGN VISARGA +11A3A ; Zanabazar_Square # Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA +11A3B..11A3E ; Zanabazar_Square # Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA +11A3F..11A46 ; Zanabazar_Square # Po [8] ZANABAZAR SQUARE INITIAL HEAD MARK..ZANABAZAR SQUARE CLOSING DOUBLE-LINED HEAD MARK +11A47 ; Zanabazar_Square # Mn ZANABAZAR SQUARE SUBJOINER + +# Total code points: 72 + # EOF diff --git a/test/jdk/java/lang/Character/SpecialCasing.txt b/test/jdk/java/lang/Character/SpecialCasing.txt new file mode 100644 index 00000000000..26c7ecd6ae1 --- /dev/null +++ b/test/jdk/java/lang/Character/SpecialCasing.txt @@ -0,0 +1,281 @@ +# SpecialCasing-10.0.0.txt +# Date: 2017-04-14, 05:40:43 GMT +# Copyright (c) 2017 Unicode, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# +# Unicode Character Database +# For documentation, see http://www.unicode.org/reports/tr44/ +# +# Special Casing +# +# This file is a supplement to the UnicodeData.txt file. It does not define any +# properties, but rather provides additional information about the casing of +# Unicode characters, for situations when casing incurs a change in string length +# or is dependent on context or locale. For compatibility, the UnicodeData.txt +# file only contains simple case mappings for characters where they are one-to-one +# and independent of context and language. The data in this file, combined with +# the simple case mappings in UnicodeData.txt, defines the full case mappings +# Lowercase_Mapping (lc), Titlecase_Mapping (tc), and Uppercase_Mapping (uc). +# +# Note that the preferred mechanism for defining tailored casing operations is +# the Unicode Common Locale Data Repository (CLDR). For more information, see the +# discussion of case mappings and case algorithms in the Unicode Standard. +# +# All code points not listed in this file that do not have a simple case mappings +# in UnicodeData.txt map to themselves. +# ================================================================================ +# Format +# ================================================================================ +# The entries in this file are in the following machine-readable format: +# +# ; ; ; <upper>; (<condition_list>;)? # <comment> +# +# <code>, <lower>, <title>, and <upper> provide the respective full case mappings +# of <code>, expressed as character values in hex. If there is more than one character, +# they are separated by spaces. Other than as used to separate elements, spaces are +# to be ignored. +# +# The <condition_list> is optional. Where present, it consists of one or more language IDs +# or casing contexts, separated by spaces. In these conditions: +# - A condition list overrides the normal behavior if all of the listed conditions are true. +# - The casing context is always the context of the characters in the original string, +# NOT in the resulting string. +# - Case distinctions in the condition list are not significant. +# - Conditions preceded by "Not_" represent the negation of the condition. +# The condition list is not represented in the UCD as a formal property. +# +# A language ID is defined by BCP 47, with '-' and '_' treated equivalently. +# +# A casing context for a character is defined by Section 3.13 Default Case Algorithms +# of The Unicode Standard. +# +# Parsers of this file must be prepared to deal with future additions to this format: +# * Additional contexts +# * Additional fields +# ================================================================================ + +# ================================================================================ +# Unconditional mappings +# ================================================================================ + +# The German es-zed is special--the normal mapping is to SS. +# Note: the titlecase should never occur in practice. It is equal to titlecase(uppercase(<es-zed>)) + +00DF; 00DF; 0053 0073; 0053 0053; # LATIN SMALL LETTER SHARP S + +# Preserve canonical equivalence for I with dot. Turkic is handled below. + +0130; 0069 0307; 0130; 0130; # LATIN CAPITAL LETTER I WITH DOT ABOVE + +# Ligatures + +FB00; FB00; 0046 0066; 0046 0046; # LATIN SMALL LIGATURE FF +FB01; FB01; 0046 0069; 0046 0049; # LATIN SMALL LIGATURE FI +FB02; FB02; 0046 006C; 0046 004C; # LATIN SMALL LIGATURE FL +FB03; FB03; 0046 0066 0069; 0046 0046 0049; # LATIN SMALL LIGATURE FFI +FB04; FB04; 0046 0066 006C; 0046 0046 004C; # LATIN SMALL LIGATURE FFL +FB05; FB05; 0053 0074; 0053 0054; # LATIN SMALL LIGATURE LONG S T +FB06; FB06; 0053 0074; 0053 0054; # LATIN SMALL LIGATURE ST + +0587; 0587; 0535 0582; 0535 0552; # ARMENIAN SMALL LIGATURE ECH YIWN +FB13; FB13; 0544 0576; 0544 0546; # ARMENIAN SMALL LIGATURE MEN NOW +FB14; FB14; 0544 0565; 0544 0535; # ARMENIAN SMALL LIGATURE MEN ECH +FB15; FB15; 0544 056B; 0544 053B; # ARMENIAN SMALL LIGATURE MEN INI +FB16; FB16; 054E 0576; 054E 0546; # ARMENIAN SMALL LIGATURE VEW NOW +FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH + +# No corresponding uppercase precomposed character + +0149; 0149; 02BC 004E; 02BC 004E; # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE +0390; 0390; 0399 0308 0301; 0399 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS +03B0; 03B0; 03A5 0308 0301; 03A5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS +01F0; 01F0; 004A 030C; 004A 030C; # LATIN SMALL LETTER J WITH CARON +1E96; 1E96; 0048 0331; 0048 0331; # LATIN SMALL LETTER H WITH LINE BELOW +1E97; 1E97; 0054 0308; 0054 0308; # LATIN SMALL LETTER T WITH DIAERESIS +1E98; 1E98; 0057 030A; 0057 030A; # LATIN SMALL LETTER W WITH RING ABOVE +1E99; 1E99; 0059 030A; 0059 030A; # LATIN SMALL LETTER Y WITH RING ABOVE +1E9A; 1E9A; 0041 02BE; 0041 02BE; # LATIN SMALL LETTER A WITH RIGHT HALF RING +1F50; 1F50; 03A5 0313; 03A5 0313; # GREEK SMALL LETTER UPSILON WITH PSILI +1F52; 1F52; 03A5 0313 0300; 03A5 0313 0300; # GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA +1F54; 1F54; 03A5 0313 0301; 03A5 0313 0301; # GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA +1F56; 1F56; 03A5 0313 0342; 03A5 0313 0342; # GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI +1FB6; 1FB6; 0391 0342; 0391 0342; # GREEK SMALL LETTER ALPHA WITH PERISPOMENI +1FC6; 1FC6; 0397 0342; 0397 0342; # GREEK SMALL LETTER ETA WITH PERISPOMENI +1FD2; 1FD2; 0399 0308 0300; 0399 0308 0300; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA +1FD3; 1FD3; 0399 0308 0301; 0399 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA +1FD6; 1FD6; 0399 0342; 0399 0342; # GREEK SMALL LETTER IOTA WITH PERISPOMENI +1FD7; 1FD7; 0399 0308 0342; 0399 0308 0342; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI +1FE2; 1FE2; 03A5 0308 0300; 03A5 0308 0300; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA +1FE3; 1FE3; 03A5 0308 0301; 03A5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA +1FE4; 1FE4; 03A1 0313; 03A1 0313; # GREEK SMALL LETTER RHO WITH PSILI +1FE6; 1FE6; 03A5 0342; 03A5 0342; # GREEK SMALL LETTER UPSILON WITH PERISPOMENI +1FE7; 1FE7; 03A5 0308 0342; 03A5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI +1FF6; 1FF6; 03A9 0342; 03A9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI + +# IMPORTANT-when iota-subscript (0345) is uppercased or titlecased, +# the result will be incorrect unless the iota-subscript is moved to the end +# of any sequence of combining marks. Otherwise, the accents will go on the capital iota. +# This process can be achieved by first transforming the text to NFC before casing. +# E.g. <alpha><iota_subscript><acute> is uppercased to <ALPHA><acute><IOTA> + +# The following cases are already in the UnicodeData.txt file, so are only commented here. + +# 0345; 0345; 0345; 0399; # COMBINING GREEK YPOGEGRAMMENI + +# All letters with YPOGEGRAMMENI (iota-subscript) or PROSGEGRAMMENI (iota adscript) +# have special uppercases. +# Note: characters with PROSGEGRAMMENI are actually titlecase, not uppercase! + +1F80; 1F80; 1F88; 1F08 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI +1F81; 1F81; 1F89; 1F09 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI +1F82; 1F82; 1F8A; 1F0A 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI +1F83; 1F83; 1F8B; 1F0B 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI +1F84; 1F84; 1F8C; 1F0C 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI +1F85; 1F85; 1F8D; 1F0D 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI +1F86; 1F86; 1F8E; 1F0E 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +1F87; 1F87; 1F8F; 1F0F 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +1F88; 1F80; 1F88; 1F08 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI +1F89; 1F81; 1F89; 1F09 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI +1F8A; 1F82; 1F8A; 1F0A 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1F8B; 1F83; 1F8B; 1F0B 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1F8C; 1F84; 1F8C; 1F0C 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1F8D; 1F85; 1F8D; 1F0D 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1F8E; 1F86; 1F8E; 1F0E 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1F8F; 1F87; 1F8F; 1F0F 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1F90; 1F90; 1F98; 1F28 0399; # GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI +1F91; 1F91; 1F99; 1F29 0399; # GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI +1F92; 1F92; 1F9A; 1F2A 0399; # GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI +1F93; 1F93; 1F9B; 1F2B 0399; # GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI +1F94; 1F94; 1F9C; 1F2C 0399; # GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI +1F95; 1F95; 1F9D; 1F2D 0399; # GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI +1F96; 1F96; 1F9E; 1F2E 0399; # GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +1F97; 1F97; 1F9F; 1F2F 0399; # GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +1F98; 1F90; 1F98; 1F28 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI +1F99; 1F91; 1F99; 1F29 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI +1F9A; 1F92; 1F9A; 1F2A 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1F9B; 1F93; 1F9B; 1F2B 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1F9C; 1F94; 1F9C; 1F2C 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1F9D; 1F95; 1F9D; 1F2D 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1F9E; 1F96; 1F9E; 1F2E 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1F9F; 1F97; 1F9F; 1F2F 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1FA0; 1FA0; 1FA8; 1F68 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI +1FA1; 1FA1; 1FA9; 1F69 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI +1FA2; 1FA2; 1FAA; 1F6A 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI +1FA3; 1FA3; 1FAB; 1F6B 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI +1FA4; 1FA4; 1FAC; 1F6C 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI +1FA5; 1FA5; 1FAD; 1F6D 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI +1FA6; 1FA6; 1FAE; 1F6E 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +1FA7; 1FA7; 1FAF; 1F6F 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +1FA8; 1FA0; 1FA8; 1F68 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI +1FA9; 1FA1; 1FA9; 1F69 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI +1FAA; 1FA2; 1FAA; 1F6A 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1FAB; 1FA3; 1FAB; 1F6B 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1FAC; 1FA4; 1FAC; 1F6C 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1FAD; 1FA5; 1FAD; 1F6D 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1FAE; 1FA6; 1FAE; 1F6E 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1FAF; 1FA7; 1FAF; 1F6F 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1FB3; 1FB3; 1FBC; 0391 0399; # GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI +1FBC; 1FB3; 1FBC; 0391 0399; # GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI +1FC3; 1FC3; 1FCC; 0397 0399; # GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI +1FCC; 1FC3; 1FCC; 0397 0399; # GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI +1FF3; 1FF3; 1FFC; 03A9 0399; # GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI +1FFC; 1FF3; 1FFC; 03A9 0399; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI + +# Some characters with YPOGEGRAMMENI also have no corresponding titlecases + +1FB2; 1FB2; 1FBA 0345; 1FBA 0399; # GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI +1FB4; 1FB4; 0386 0345; 0386 0399; # GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI +1FC2; 1FC2; 1FCA 0345; 1FCA 0399; # GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI +1FC4; 1FC4; 0389 0345; 0389 0399; # GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI +1FF2; 1FF2; 1FFA 0345; 1FFA 0399; # GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI +1FF4; 1FF4; 038F 0345; 038F 0399; # GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI + +1FB7; 1FB7; 0391 0342 0345; 0391 0342 0399; # GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI +1FC7; 1FC7; 0397 0342 0345; 0397 0342 0399; # GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI +1FF7; 1FF7; 03A9 0342 0345; 03A9 0342 0399; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI + +# ================================================================================ +# Conditional Mappings +# The remainder of this file provides conditional casing data used to produce +# full case mappings. +# ================================================================================ +# Language-Insensitive Mappings +# These are characters whose full case mappings do not depend on language, but do +# depend on context (which characters come before or after). For more information +# see the header of this file and the Unicode Standard. +# ================================================================================ + +# Special case for final form of sigma + +03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA + +# Note: the following cases for non-final are already in the UnicodeData.txt file. + +# 03A3; 03C3; 03A3; 03A3; # GREEK CAPITAL LETTER SIGMA +# 03C3; 03C3; 03A3; 03A3; # GREEK SMALL LETTER SIGMA +# 03C2; 03C2; 03A3; 03A3; # GREEK SMALL LETTER FINAL SIGMA + +# Note: the following cases are not included, since they would case-fold in lowercasing + +# 03C3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK SMALL LETTER SIGMA +# 03C2; 03C3; 03A3; 03A3; Not_Final_Sigma; # GREEK SMALL LETTER FINAL SIGMA + +# ================================================================================ +# Language-Sensitive Mappings +# These are characters whose full case mappings depend on language and perhaps also +# context (which characters come before or after). For more information +# see the header of this file and the Unicode Standard. +# ================================================================================ + +# Lithuanian + +# Lithuanian retains the dot in a lowercase i when followed by accents. + +# Remove DOT ABOVE after "i" with upper or titlecase + +0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE + +# Introduce an explicit dot above when lowercasing capital I's and J's +# whenever there are more accents above. +# (of the accents used in Lithuanian: grave, acute, tilde above, and ogonek) + +0049; 0069 0307; 0049; 0049; lt More_Above; # LATIN CAPITAL LETTER I +004A; 006A 0307; 004A; 004A; lt More_Above; # LATIN CAPITAL LETTER J +012E; 012F 0307; 012E; 012E; lt More_Above; # LATIN CAPITAL LETTER I WITH OGONEK +00CC; 0069 0307 0300; 00CC; 00CC; lt; # LATIN CAPITAL LETTER I WITH GRAVE +00CD; 0069 0307 0301; 00CD; 00CD; lt; # LATIN CAPITAL LETTER I WITH ACUTE +0128; 0069 0307 0303; 0128; 0128; lt; # LATIN CAPITAL LETTER I WITH TILDE + +# ================================================================================ + +# Turkish and Azeri + +# I and i-dotless; I-dot and i are case pairs in Turkish and Azeri +# The following rules handle those cases. + +0130; 0069; 0130; 0130; tr; # LATIN CAPITAL LETTER I WITH DOT ABOVE +0130; 0069; 0130; 0130; az; # LATIN CAPITAL LETTER I WITH DOT ABOVE + +# When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i. +# This matches the behavior of the canonically equivalent I-dot_above + +0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE +0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE + +# When lowercasing, unless an I is before a dot_above, it turns into a dotless i. + +0049; 0131; 0049; 0049; tr Not_Before_Dot; # LATIN CAPITAL LETTER I +0049; 0131; 0049; 0049; az Not_Before_Dot; # LATIN CAPITAL LETTER I + +# When uppercasing, i turns into a dotted capital I + +0069; 0069; 0130; 0130; tr; # LATIN SMALL LETTER I +0069; 0069; 0130; 0130; az; # LATIN SMALL LETTER I + +# Note: the following case is already in the UnicodeData.txt file. + +# 0131; 0131; 0049; 0049; tr; # LATIN SMALL LETTER DOTLESS I + +# EOF + diff --git a/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java b/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java index 9a7811e5590..abff5a4ebbc 100644 --- a/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java +++ b/test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /** * @test - * @bug 8080535 + * @bug 8080535 8191410 * @summary Expected size of Character.UnicodeBlock.map is not optimal * @library /lib/testlibrary * @modules java.base/java.lang:open @@ -41,8 +41,8 @@ import jdk.testlibrary.OptimalCapacity; // According to http://www.unicode.org/versions/beta-8.0.0.html , // in Unicode 8 there will be added 10 more blocks (30 with aliases). // -// After implementing support of Unicode 7 and 8 in Java, there will -// be 510+96+30 = 636 entries in Character.UnicodeBlock.map. +// After implementing support of Unicode 9 and 10 in Java, there will +// be 638 entries in Character.UnicodeBlock.map. // // Initialization of the map and this test will have to be adjusted // accordingly then. @@ -51,7 +51,7 @@ public class OptimalMapSize { public static void main(String[] args) throws Throwable { // The initial size of Character.UnicodeBlock.map. // See src/java.base/share/classes/java/lang/Character.java - int initialCapacity = (int)(510 / 0.75f + 1.0f); + int initialCapacity = (int)(638 / 0.75f + 1.0f); OptimalCapacity.ofHashMap(Character.UnicodeBlock.class, "map", initialCapacity); diff --git a/test/jdk/java/lang/Character/UnicodeCasingTest.java b/test/jdk/java/lang/Character/UnicodeCasingTest.java new file mode 100644 index 00000000000..0843ce6a729 --- /dev/null +++ b/test/jdk/java/lang/Character/UnicodeCasingTest.java @@ -0,0 +1,177 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4397357 6565620 6959267 8032446 8072600 + * @summary Confirm normal case mappings are handled correctly. + * @run main/timeout=200 UnicodeCasingTest + */ + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +public class UnicodeCasingTest { + + private static boolean err = false; + + // Locales which are used for testing + private static List<Locale> locales = new ArrayList<>(); + static { + locales.add(new Locale("az", "")); + locales.addAll(java.util.Arrays.asList(Locale.getAvailableLocales())); + } + + + public static void main(String[] args) { + UnicodeCasingTest specialCasingTest = new UnicodeCasingTest(); + specialCasingTest.test(); + } + + private void test() { + Locale defaultLocale = Locale.getDefault(); + + BufferedReader in = null; + + try { + File file = new File(System.getProperty("test.src", "."), + "UnicodeData.txt"); + + int locale_num = locales.size(); + for (int l = 0; l < locale_num; l++) { + Locale locale = locales.get(l); + Locale.setDefault(locale); + System.out.println("Testing on " + locale + " locale...."); + + in = new BufferedReader(new FileReader(file)); + + String line; + while ((line = in.readLine()) != null) { + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } + + test(line); + } + + in.close(); + in = null; + } + } + catch (Exception e) { + err = true; + e.printStackTrace(); + } + finally { + if (in != null) { + try { + in.close(); + } + catch (Exception e) { + } + } + + Locale.setDefault(defaultLocale); + + if (err) { + throw new RuntimeException("UnicodeCasingTest failed."); + } else { + System.out.println("UnicodeCasingTest passed."); + } + } + } + + private void test(String line) { + String[] fields = line.split(";", 15); + int orig = convert(fields[0]); + + if (fields[12].length() != 0) { + testUpperCase(orig, convert(fields[12])); + } else { + testUpperCase(orig, orig); + } + + if (fields[13].length() != 0) { + testLowerCase(orig, convert(fields[13])); + } else { + testLowerCase(orig, orig); + } + + if (fields[14].length() != 0) { + testTitleCase(orig, convert(fields[14])); + } else { + testTitleCase(orig, orig); + } + } + + private void testUpperCase(int orig, int expected) { + int got = Character.toUpperCase(orig); + + if (expected != got) { + err = true; + System.err.println("toUpperCase(" + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected)); + } + } + + private void testLowerCase(int orig, int expected) { + int got = Character.toLowerCase(orig); + + if (expected != got) { + err = true; + System.err.println("toLowerCase(" + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected)); + } + } + + private void testTitleCase(int orig, int expected) { + int got = Character.toTitleCase(orig); + + if (expected != got) { + err = true; + System.err.println("toTitleCase(" + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected)); + } + } + + private int convert(String str) { + return Integer.parseInt(str, 16); + } + + private String toString(int i) { + return Integer.toHexString(i).toUpperCase(); + } + +} diff --git a/test/jdk/java/lang/Character/UnicodeData.txt b/test/jdk/java/lang/Character/UnicodeData.txt new file mode 100644 index 00000000000..d89c64f526a --- /dev/null +++ b/test/jdk/java/lang/Character/UnicodeData.txt @@ -0,0 +1,31618 @@ +0000;<control>;Cc;0;BN;;;;;N;NULL;;;; +0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; +0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; +0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; +0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; +0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; +0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; +0007;<control>;Cc;0;BN;;;;;N;BELL;;;; +0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;; +0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;; +000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;; +000B;<control>;Cc;0;S;;;;;N;LINE TABULATION;;;; +000C;<control>;Cc;0;WS;;;;;N;FORM FEED (FF);;;; +000D;<control>;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;; +000E;<control>;Cc;0;BN;;;;;N;SHIFT OUT;;;; +000F;<control>;Cc;0;BN;;;;;N;SHIFT IN;;;; +0010;<control>;Cc;0;BN;;;;;N;DATA LINK ESCAPE;;;; +0011;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL ONE;;;; +0012;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL TWO;;;; +0013;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL THREE;;;; +0014;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL FOUR;;;; +0015;<control>;Cc;0;BN;;;;;N;NEGATIVE ACKNOWLEDGE;;;; +0016;<control>;Cc;0;BN;;;;;N;SYNCHRONOUS IDLE;;;; +0017;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION BLOCK;;;; +0018;<control>;Cc;0;BN;;;;;N;CANCEL;;;; +0019;<control>;Cc;0;BN;;;;;N;END OF MEDIUM;;;; +001A;<control>;Cc;0;BN;;;;;N;SUBSTITUTE;;;; +001B;<control>;Cc;0;BN;;;;;N;ESCAPE;;;; +001C;<control>;Cc;0;B;;;;;N;INFORMATION SEPARATOR FOUR;;;; +001D;<control>;Cc;0;B;;;;;N;INFORMATION SEPARATOR THREE;;;; +001E;<control>;Cc;0;B;;;;;N;INFORMATION SEPARATOR TWO;;;; +001F;<control>;Cc;0;S;;;;;N;INFORMATION SEPARATOR ONE;;;; +0020;SPACE;Zs;0;WS;;;;;N;;;;; +0021;EXCLAMATION MARK;Po;0;ON;;;;;N;;;;; +0022;QUOTATION MARK;Po;0;ON;;;;;N;;;;; +0023;NUMBER SIGN;Po;0;ET;;;;;N;;;;; +0024;DOLLAR SIGN;Sc;0;ET;;;;;N;;;;; +0025;PERCENT SIGN;Po;0;ET;;;;;N;;;;; +0026;AMPERSAND;Po;0;ON;;;;;N;;;;; +0027;APOSTROPHE;Po;0;ON;;;;;N;APOSTROPHE-QUOTE;;;; +0028;LEFT PARENTHESIS;Ps;0;ON;;;;;Y;OPENING PARENTHESIS;;;; +0029;RIGHT PARENTHESIS;Pe;0;ON;;;;;Y;CLOSING PARENTHESIS;;;; +002A;ASTERISK;Po;0;ON;;;;;N;;;;; +002B;PLUS SIGN;Sm;0;ES;;;;;N;;;;; +002C;COMMA;Po;0;CS;;;;;N;;;;; +002D;HYPHEN-MINUS;Pd;0;ES;;;;;N;;;;; +002E;FULL STOP;Po;0;CS;;;;;N;PERIOD;;;; +002F;SOLIDUS;Po;0;CS;;;;;N;SLASH;;;; +0030;DIGIT ZERO;Nd;0;EN;;0;0;0;N;;;;; +0031;DIGIT ONE;Nd;0;EN;;1;1;1;N;;;;; +0032;DIGIT TWO;Nd;0;EN;;2;2;2;N;;;;; +0033;DIGIT THREE;Nd;0;EN;;3;3;3;N;;;;; +0034;DIGIT FOUR;Nd;0;EN;;4;4;4;N;;;;; +0035;DIGIT FIVE;Nd;0;EN;;5;5;5;N;;;;; +0036;DIGIT SIX;Nd;0;EN;;6;6;6;N;;;;; +0037;DIGIT SEVEN;Nd;0;EN;;7;7;7;N;;;;; +0038;DIGIT EIGHT;Nd;0;EN;;8;8;8;N;;;;; +0039;DIGIT NINE;Nd;0;EN;;9;9;9;N;;;;; +003A;COLON;Po;0;CS;;;;;N;;;;; +003B;SEMICOLON;Po;0;ON;;;;;N;;;;; +003C;LESS-THAN SIGN;Sm;0;ON;;;;;Y;;;;; +003D;EQUALS SIGN;Sm;0;ON;;;;;N;;;;; +003E;GREATER-THAN SIGN;Sm;0;ON;;;;;Y;;;;; +003F;QUESTION MARK;Po;0;ON;;;;;N;;;;; +0040;COMMERCIAL AT;Po;0;ON;;;;;N;;;;; +0041;LATIN CAPITAL LETTER A;Lu;0;L;;;;;N;;;;0061; +0042;LATIN CAPITAL LETTER B;Lu;0;L;;;;;N;;;;0062; +0043;LATIN CAPITAL LETTER C;Lu;0;L;;;;;N;;;;0063; +0044;LATIN CAPITAL LETTER D;Lu;0;L;;;;;N;;;;0064; +0045;LATIN CAPITAL LETTER E;Lu;0;L;;;;;N;;;;0065; +0046;LATIN CAPITAL LETTER F;Lu;0;L;;;;;N;;;;0066; +0047;LATIN CAPITAL LETTER G;Lu;0;L;;;;;N;;;;0067; +0048;LATIN CAPITAL LETTER H;Lu;0;L;;;;;N;;;;0068; +0049;LATIN CAPITAL LETTER I;Lu;0;L;;;;;N;;;;0069; +004A;LATIN CAPITAL LETTER J;Lu;0;L;;;;;N;;;;006A; +004B;LATIN CAPITAL LETTER K;Lu;0;L;;;;;N;;;;006B; +004C;LATIN CAPITAL LETTER L;Lu;0;L;;;;;N;;;;006C; +004D;LATIN CAPITAL LETTER M;Lu;0;L;;;;;N;;;;006D; +004E;LATIN CAPITAL LETTER N;Lu;0;L;;;;;N;;;;006E; +004F;LATIN CAPITAL LETTER O;Lu;0;L;;;;;N;;;;006F; +0050;LATIN CAPITAL LETTER P;Lu;0;L;;;;;N;;;;0070; +0051;LATIN CAPITAL LETTER Q;Lu;0;L;;;;;N;;;;0071; +0052;LATIN CAPITAL LETTER R;Lu;0;L;;;;;N;;;;0072; +0053;LATIN CAPITAL LETTER S;Lu;0;L;;;;;N;;;;0073; +0054;LATIN CAPITAL LETTER T;Lu;0;L;;;;;N;;;;0074; +0055;LATIN CAPITAL LETTER U;Lu;0;L;;;;;N;;;;0075; +0056;LATIN CAPITAL LETTER V;Lu;0;L;;;;;N;;;;0076; +0057;LATIN CAPITAL LETTER W;Lu;0;L;;;;;N;;;;0077; +0058;LATIN CAPITAL LETTER X;Lu;0;L;;;;;N;;;;0078; +0059;LATIN CAPITAL LETTER Y;Lu;0;L;;;;;N;;;;0079; +005A;LATIN CAPITAL LETTER Z;Lu;0;L;;;;;N;;;;007A; +005B;LEFT SQUARE BRACKET;Ps;0;ON;;;;;Y;OPENING SQUARE BRACKET;;;; +005C;REVERSE SOLIDUS;Po;0;ON;;;;;N;BACKSLASH;;;; +005D;RIGHT SQUARE BRACKET;Pe;0;ON;;;;;Y;CLOSING SQUARE BRACKET;;;; +005E;CIRCUMFLEX ACCENT;Sk;0;ON;;;;;N;SPACING CIRCUMFLEX;;;; +005F;LOW LINE;Pc;0;ON;;;;;N;SPACING UNDERSCORE;;;; +0060;GRAVE ACCENT;Sk;0;ON;;;;;N;SPACING GRAVE;;;; +0061;LATIN SMALL LETTER A;Ll;0;L;;;;;N;;;0041;;0041 +0062;LATIN SMALL LETTER B;Ll;0;L;;;;;N;;;0042;;0042 +0063;LATIN SMALL LETTER C;Ll;0;L;;;;;N;;;0043;;0043 +0064;LATIN SMALL LETTER D;Ll;0;L;;;;;N;;;0044;;0044 +0065;LATIN SMALL LETTER E;Ll;0;L;;;;;N;;;0045;;0045 +0066;LATIN SMALL LETTER F;Ll;0;L;;;;;N;;;0046;;0046 +0067;LATIN SMALL LETTER G;Ll;0;L;;;;;N;;;0047;;0047 +0068;LATIN SMALL LETTER H;Ll;0;L;;;;;N;;;0048;;0048 +0069;LATIN SMALL LETTER I;Ll;0;L;;;;;N;;;0049;;0049 +006A;LATIN SMALL LETTER J;Ll;0;L;;;;;N;;;004A;;004A +006B;LATIN SMALL LETTER K;Ll;0;L;;;;;N;;;004B;;004B +006C;LATIN SMALL LETTER L;Ll;0;L;;;;;N;;;004C;;004C +006D;LATIN SMALL LETTER M;Ll;0;L;;;;;N;;;004D;;004D +006E;LATIN SMALL LETTER N;Ll;0;L;;;;;N;;;004E;;004E +006F;LATIN SMALL LETTER O;Ll;0;L;;;;;N;;;004F;;004F +0070;LATIN SMALL LETTER P;Ll;0;L;;;;;N;;;0050;;0050 +0071;LATIN SMALL LETTER Q;Ll;0;L;;;;;N;;;0051;;0051 +0072;LATIN SMALL LETTER R;Ll;0;L;;;;;N;;;0052;;0052 +0073;LATIN SMALL LETTER S;Ll;0;L;;;;;N;;;0053;;0053 +0074;LATIN SMALL LETTER T;Ll;0;L;;;;;N;;;0054;;0054 +0075;LATIN SMALL LETTER U;Ll;0;L;;;;;N;;;0055;;0055 +0076;LATIN SMALL LETTER V;Ll;0;L;;;;;N;;;0056;;0056 +0077;LATIN SMALL LETTER W;Ll;0;L;;;;;N;;;0057;;0057 +0078;LATIN SMALL LETTER X;Ll;0;L;;;;;N;;;0058;;0058 +0079;LATIN SMALL LETTER Y;Ll;0;L;;;;;N;;;0059;;0059 +007A;LATIN SMALL LETTER Z;Ll;0;L;;;;;N;;;005A;;005A +007B;LEFT CURLY BRACKET;Ps;0;ON;;;;;Y;OPENING CURLY BRACKET;;;; +007C;VERTICAL LINE;Sm;0;ON;;;;;N;VERTICAL BAR;;;; +007D;RIGHT CURLY BRACKET;Pe;0;ON;;;;;Y;CLOSING CURLY BRACKET;;;; +007E;TILDE;Sm;0;ON;;;;;N;;;;; +007F;<control>;Cc;0;BN;;;;;N;DELETE;;;; +0080;<control>;Cc;0;BN;;;;;N;;;;; +0081;<control>;Cc;0;BN;;;;;N;;;;; +0082;<control>;Cc;0;BN;;;;;N;BREAK PERMITTED HERE;;;; +0083;<control>;Cc;0;BN;;;;;N;NO BREAK HERE;;;; +0084;<control>;Cc;0;BN;;;;;N;;;;; +0085;<control>;Cc;0;B;;;;;N;NEXT LINE (NEL);;;; +0086;<control>;Cc;0;BN;;;;;N;START OF SELECTED AREA;;;; +0087;<control>;Cc;0;BN;;;;;N;END OF SELECTED AREA;;;; +0088;<control>;Cc;0;BN;;;;;N;CHARACTER TABULATION SET;;;; +0089;<control>;Cc;0;BN;;;;;N;CHARACTER TABULATION WITH JUSTIFICATION;;;; +008A;<control>;Cc;0;BN;;;;;N;LINE TABULATION SET;;;; +008B;<control>;Cc;0;BN;;;;;N;PARTIAL LINE FORWARD;;;; +008C;<control>;Cc;0;BN;;;;;N;PARTIAL LINE BACKWARD;;;; +008D;<control>;Cc;0;BN;;;;;N;REVERSE LINE FEED;;;; +008E;<control>;Cc;0;BN;;;;;N;SINGLE SHIFT TWO;;;; +008F;<control>;Cc;0;BN;;;;;N;SINGLE SHIFT THREE;;;; +0090;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL STRING;;;; +0091;<control>;Cc;0;BN;;;;;N;PRIVATE USE ONE;;;; +0092;<control>;Cc;0;BN;;;;;N;PRIVATE USE TWO;;;; +0093;<control>;Cc;0;BN;;;;;N;SET TRANSMIT STATE;;;; +0094;<control>;Cc;0;BN;;;;;N;CANCEL CHARACTER;;;; +0095;<control>;Cc;0;BN;;;;;N;MESSAGE WAITING;;;; +0096;<control>;Cc;0;BN;;;;;N;START OF GUARDED AREA;;;; +0097;<control>;Cc;0;BN;;;;;N;END OF GUARDED AREA;;;; +0098;<control>;Cc;0;BN;;;;;N;START OF STRING;;;; +0099;<control>;Cc;0;BN;;;;;N;;;;; +009A;<control>;Cc;0;BN;;;;;N;SINGLE CHARACTER INTRODUCER;;;; +009B;<control>;Cc;0;BN;;;;;N;CONTROL SEQUENCE INTRODUCER;;;; +009C;<control>;Cc;0;BN;;;;;N;STRING TERMINATOR;;;; +009D;<control>;Cc;0;BN;;;;;N;OPERATING SYSTEM COMMAND;;;; +009E;<control>;Cc;0;BN;;;;;N;PRIVACY MESSAGE;;;; +009F;<control>;Cc;0;BN;;;;;N;APPLICATION PROGRAM COMMAND;;;; +00A0;NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;NON-BREAKING SPACE;;;; +00A1;INVERTED EXCLAMATION MARK;Po;0;ON;;;;;N;;;;; +00A2;CENT SIGN;Sc;0;ET;;;;;N;;;;; +00A3;POUND SIGN;Sc;0;ET;;;;;N;;;;; +00A4;CURRENCY SIGN;Sc;0;ET;;;;;N;;;;; +00A5;YEN SIGN;Sc;0;ET;;;;;N;;;;; +00A6;BROKEN BAR;So;0;ON;;;;;N;BROKEN VERTICAL BAR;;;; +00A7;SECTION SIGN;Po;0;ON;;;;;N;;;;; +00A8;DIAERESIS;Sk;0;ON;<compat> 0020 0308;;;;N;SPACING DIAERESIS;;;; +00A9;COPYRIGHT SIGN;So;0;ON;;;;;N;;;;; +00AA;FEMININE ORDINAL INDICATOR;Lo;0;L;<super> 0061;;;;N;;;;; +00AB;LEFT-POINTING DOUBLE ANGLE QUOTATION MARK;Pi;0;ON;;;;;Y;LEFT POINTING GUILLEMET;;;; +00AC;NOT SIGN;Sm;0;ON;;;;;N;;;;; +00AD;SOFT HYPHEN;Cf;0;BN;;;;;N;;;;; +00AE;REGISTERED SIGN;So;0;ON;;;;;N;REGISTERED TRADE MARK SIGN;;;; +00AF;MACRON;Sk;0;ON;<compat> 0020 0304;;;;N;SPACING MACRON;;;; +00B0;DEGREE SIGN;So;0;ET;;;;;N;;;;; +00B1;PLUS-MINUS SIGN;Sm;0;ET;;;;;N;PLUS-OR-MINUS SIGN;;;; +00B2;SUPERSCRIPT TWO;No;0;EN;<super> 0032;;2;2;N;SUPERSCRIPT DIGIT TWO;;;; +00B3;SUPERSCRIPT THREE;No;0;EN;<super> 0033;;3;3;N;SUPERSCRIPT DIGIT THREE;;;; +00B4;ACUTE ACCENT;Sk;0;ON;<compat> 0020 0301;;;;N;SPACING ACUTE;;;; +00B5;MICRO SIGN;Ll;0;L;<compat> 03BC;;;;N;;;039C;;039C +00B6;PILCROW SIGN;Po;0;ON;;;;;N;PARAGRAPH SIGN;;;; +00B7;MIDDLE DOT;Po;0;ON;;;;;N;;;;; +00B8;CEDILLA;Sk;0;ON;<compat> 0020 0327;;;;N;SPACING CEDILLA;;;; +00B9;SUPERSCRIPT ONE;No;0;EN;<super> 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;; +00BA;MASCULINE ORDINAL INDICATOR;Lo;0;L;<super> 006F;;;;N;;;;; +00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;;;; +00BC;VULGAR FRACTION ONE QUARTER;No;0;ON;<fraction> 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;; +00BD;VULGAR FRACTION ONE HALF;No;0;ON;<fraction> 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;; +00BE;VULGAR FRACTION THREE QUARTERS;No;0;ON;<fraction> 0033 2044 0034;;;3/4;N;FRACTION THREE QUARTERS;;;; +00BF;INVERTED QUESTION MARK;Po;0;ON;;;;;N;;;;; +00C0;LATIN CAPITAL LETTER A WITH GRAVE;Lu;0;L;0041 0300;;;;N;LATIN CAPITAL LETTER A GRAVE;;;00E0; +00C1;LATIN CAPITAL LETTER A WITH ACUTE;Lu;0;L;0041 0301;;;;N;LATIN CAPITAL LETTER A ACUTE;;;00E1; +00C2;LATIN CAPITAL LETTER A WITH CIRCUMFLEX;Lu;0;L;0041 0302;;;;N;LATIN CAPITAL LETTER A CIRCUMFLEX;;;00E2; +00C3;LATIN CAPITAL LETTER A WITH TILDE;Lu;0;L;0041 0303;;;;N;LATIN CAPITAL LETTER A TILDE;;;00E3; +00C4;LATIN CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0041 0308;;;;N;LATIN CAPITAL LETTER A DIAERESIS;;;00E4; +00C5;LATIN CAPITAL LETTER A WITH RING ABOVE;Lu;0;L;0041 030A;;;;N;LATIN CAPITAL LETTER A RING;;;00E5; +00C6;LATIN CAPITAL LETTER AE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER A E;;;00E6; +00C7;LATIN CAPITAL LETTER C WITH CEDILLA;Lu;0;L;0043 0327;;;;N;LATIN CAPITAL LETTER C CEDILLA;;;00E7; +00C8;LATIN CAPITAL LETTER E WITH GRAVE;Lu;0;L;0045 0300;;;;N;LATIN CAPITAL LETTER E GRAVE;;;00E8; +00C9;LATIN CAPITAL LETTER E WITH ACUTE;Lu;0;L;0045 0301;;;;N;LATIN CAPITAL LETTER E ACUTE;;;00E9; +00CA;LATIN CAPITAL LETTER E WITH CIRCUMFLEX;Lu;0;L;0045 0302;;;;N;LATIN CAPITAL LETTER E CIRCUMFLEX;;;00EA; +00CB;LATIN CAPITAL LETTER E WITH DIAERESIS;Lu;0;L;0045 0308;;;;N;LATIN CAPITAL LETTER E DIAERESIS;;;00EB; +00CC;LATIN CAPITAL LETTER I WITH GRAVE;Lu;0;L;0049 0300;;;;N;LATIN CAPITAL LETTER I GRAVE;;;00EC; +00CD;LATIN CAPITAL LETTER I WITH ACUTE;Lu;0;L;0049 0301;;;;N;LATIN CAPITAL LETTER I ACUTE;;;00ED; +00CE;LATIN CAPITAL LETTER I WITH CIRCUMFLEX;Lu;0;L;0049 0302;;;;N;LATIN CAPITAL LETTER I CIRCUMFLEX;;;00EE; +00CF;LATIN CAPITAL LETTER I WITH DIAERESIS;Lu;0;L;0049 0308;;;;N;LATIN CAPITAL LETTER I DIAERESIS;;;00EF; +00D0;LATIN CAPITAL LETTER ETH;Lu;0;L;;;;;N;;;;00F0; +00D1;LATIN CAPITAL LETTER N WITH TILDE;Lu;0;L;004E 0303;;;;N;LATIN CAPITAL LETTER N TILDE;;;00F1; +00D2;LATIN CAPITAL LETTER O WITH GRAVE;Lu;0;L;004F 0300;;;;N;LATIN CAPITAL LETTER O GRAVE;;;00F2; +00D3;LATIN CAPITAL LETTER O WITH ACUTE;Lu;0;L;004F 0301;;;;N;LATIN CAPITAL LETTER O ACUTE;;;00F3; +00D4;LATIN CAPITAL LETTER O WITH CIRCUMFLEX;Lu;0;L;004F 0302;;;;N;LATIN CAPITAL LETTER O CIRCUMFLEX;;;00F4; +00D5;LATIN CAPITAL LETTER O WITH TILDE;Lu;0;L;004F 0303;;;;N;LATIN CAPITAL LETTER O TILDE;;;00F5; +00D6;LATIN CAPITAL LETTER O WITH DIAERESIS;Lu;0;L;004F 0308;;;;N;LATIN CAPITAL LETTER O DIAERESIS;;;00F6; +00D7;MULTIPLICATION SIGN;Sm;0;ON;;;;;N;;;;; +00D8;LATIN CAPITAL LETTER O WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER O SLASH;;;00F8; +00D9;LATIN CAPITAL LETTER U WITH GRAVE;Lu;0;L;0055 0300;;;;N;LATIN CAPITAL LETTER U GRAVE;;;00F9; +00DA;LATIN CAPITAL LETTER U WITH ACUTE;Lu;0;L;0055 0301;;;;N;LATIN CAPITAL LETTER U ACUTE;;;00FA; +00DB;LATIN CAPITAL LETTER U WITH CIRCUMFLEX;Lu;0;L;0055 0302;;;;N;LATIN CAPITAL LETTER U CIRCUMFLEX;;;00FB; +00DC;LATIN CAPITAL LETTER U WITH DIAERESIS;Lu;0;L;0055 0308;;;;N;LATIN CAPITAL LETTER U DIAERESIS;;;00FC; +00DD;LATIN CAPITAL LETTER Y WITH ACUTE;Lu;0;L;0059 0301;;;;N;LATIN CAPITAL LETTER Y ACUTE;;;00FD; +00DE;LATIN CAPITAL LETTER THORN;Lu;0;L;;;;;N;;;;00FE; +00DF;LATIN SMALL LETTER SHARP S;Ll;0;L;;;;;N;;;;; +00E0;LATIN SMALL LETTER A WITH GRAVE;Ll;0;L;0061 0300;;;;N;LATIN SMALL LETTER A GRAVE;;00C0;;00C0 +00E1;LATIN SMALL LETTER A WITH ACUTE;Ll;0;L;0061 0301;;;;N;LATIN SMALL LETTER A ACUTE;;00C1;;00C1 +00E2;LATIN SMALL LETTER A WITH CIRCUMFLEX;Ll;0;L;0061 0302;;;;N;LATIN SMALL LETTER A CIRCUMFLEX;;00C2;;00C2 +00E3;LATIN SMALL LETTER A WITH TILDE;Ll;0;L;0061 0303;;;;N;LATIN SMALL LETTER A TILDE;;00C3;;00C3 +00E4;LATIN SMALL LETTER A WITH DIAERESIS;Ll;0;L;0061 0308;;;;N;LATIN SMALL LETTER A DIAERESIS;;00C4;;00C4 +00E5;LATIN SMALL LETTER A WITH RING ABOVE;Ll;0;L;0061 030A;;;;N;LATIN SMALL LETTER A RING;;00C5;;00C5 +00E6;LATIN SMALL LETTER AE;Ll;0;L;;;;;N;LATIN SMALL LETTER A E;;00C6;;00C6 +00E7;LATIN SMALL LETTER C WITH CEDILLA;Ll;0;L;0063 0327;;;;N;LATIN SMALL LETTER C CEDILLA;;00C7;;00C7 +00E8;LATIN SMALL LETTER E WITH GRAVE;Ll;0;L;0065 0300;;;;N;LATIN SMALL LETTER E GRAVE;;00C8;;00C8 +00E9;LATIN SMALL LETTER E WITH ACUTE;Ll;0;L;0065 0301;;;;N;LATIN SMALL LETTER E ACUTE;;00C9;;00C9 +00EA;LATIN SMALL LETTER E WITH CIRCUMFLEX;Ll;0;L;0065 0302;;;;N;LATIN SMALL LETTER E CIRCUMFLEX;;00CA;;00CA +00EB;LATIN SMALL LETTER E WITH DIAERESIS;Ll;0;L;0065 0308;;;;N;LATIN SMALL LETTER E DIAERESIS;;00CB;;00CB +00EC;LATIN SMALL LETTER I WITH GRAVE;Ll;0;L;0069 0300;;;;N;LATIN SMALL LETTER I GRAVE;;00CC;;00CC +00ED;LATIN SMALL LETTER I WITH ACUTE;Ll;0;L;0069 0301;;;;N;LATIN SMALL LETTER I ACUTE;;00CD;;00CD +00EE;LATIN SMALL LETTER I WITH CIRCUMFLEX;Ll;0;L;0069 0302;;;;N;LATIN SMALL LETTER I CIRCUMFLEX;;00CE;;00CE +00EF;LATIN SMALL LETTER I WITH DIAERESIS;Ll;0;L;0069 0308;;;;N;LATIN SMALL LETTER I DIAERESIS;;00CF;;00CF +00F0;LATIN SMALL LETTER ETH;Ll;0;L;;;;;N;;;00D0;;00D0 +00F1;LATIN SMALL LETTER N WITH TILDE;Ll;0;L;006E 0303;;;;N;LATIN SMALL LETTER N TILDE;;00D1;;00D1 +00F2;LATIN SMALL LETTER O WITH GRAVE;Ll;0;L;006F 0300;;;;N;LATIN SMALL LETTER O GRAVE;;00D2;;00D2 +00F3;LATIN SMALL LETTER O WITH ACUTE;Ll;0;L;006F 0301;;;;N;LATIN SMALL LETTER O ACUTE;;00D3;;00D3 +00F4;LATIN SMALL LETTER O WITH CIRCUMFLEX;Ll;0;L;006F 0302;;;;N;LATIN SMALL LETTER O CIRCUMFLEX;;00D4;;00D4 +00F5;LATIN SMALL LETTER O WITH TILDE;Ll;0;L;006F 0303;;;;N;LATIN SMALL LETTER O TILDE;;00D5;;00D5 +00F6;LATIN SMALL LETTER O WITH DIAERESIS;Ll;0;L;006F 0308;;;;N;LATIN SMALL LETTER O DIAERESIS;;00D6;;00D6 +00F7;DIVISION SIGN;Sm;0;ON;;;;;N;;;;; +00F8;LATIN SMALL LETTER O WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER O SLASH;;00D8;;00D8 +00F9;LATIN SMALL LETTER U WITH GRAVE;Ll;0;L;0075 0300;;;;N;LATIN SMALL LETTER U GRAVE;;00D9;;00D9 +00FA;LATIN SMALL LETTER U WITH ACUTE;Ll;0;L;0075 0301;;;;N;LATIN SMALL LETTER U ACUTE;;00DA;;00DA +00FB;LATIN SMALL LETTER U WITH CIRCUMFLEX;Ll;0;L;0075 0302;;;;N;LATIN SMALL LETTER U CIRCUMFLEX;;00DB;;00DB +00FC;LATIN SMALL LETTER U WITH DIAERESIS;Ll;0;L;0075 0308;;;;N;LATIN SMALL LETTER U DIAERESIS;;00DC;;00DC +00FD;LATIN SMALL LETTER Y WITH ACUTE;Ll;0;L;0079 0301;;;;N;LATIN SMALL LETTER Y ACUTE;;00DD;;00DD +00FE;LATIN SMALL LETTER THORN;Ll;0;L;;;;;N;;;00DE;;00DE +00FF;LATIN SMALL LETTER Y WITH DIAERESIS;Ll;0;L;0079 0308;;;;N;LATIN SMALL LETTER Y DIAERESIS;;0178;;0178 +0100;LATIN CAPITAL LETTER A WITH MACRON;Lu;0;L;0041 0304;;;;N;LATIN CAPITAL LETTER A MACRON;;;0101; +0101;LATIN SMALL LETTER A WITH MACRON;Ll;0;L;0061 0304;;;;N;LATIN SMALL LETTER A MACRON;;0100;;0100 +0102;LATIN CAPITAL LETTER A WITH BREVE;Lu;0;L;0041 0306;;;;N;LATIN CAPITAL LETTER A BREVE;;;0103; +0103;LATIN SMALL LETTER A WITH BREVE;Ll;0;L;0061 0306;;;;N;LATIN SMALL LETTER A BREVE;;0102;;0102 +0104;LATIN CAPITAL LETTER A WITH OGONEK;Lu;0;L;0041 0328;;;;N;LATIN CAPITAL LETTER A OGONEK;;;0105; +0105;LATIN SMALL LETTER A WITH OGONEK;Ll;0;L;0061 0328;;;;N;LATIN SMALL LETTER A OGONEK;;0104;;0104 +0106;LATIN CAPITAL LETTER C WITH ACUTE;Lu;0;L;0043 0301;;;;N;LATIN CAPITAL LETTER C ACUTE;;;0107; +0107;LATIN SMALL LETTER C WITH ACUTE;Ll;0;L;0063 0301;;;;N;LATIN SMALL LETTER C ACUTE;;0106;;0106 +0108;LATIN CAPITAL LETTER C WITH CIRCUMFLEX;Lu;0;L;0043 0302;;;;N;LATIN CAPITAL LETTER C CIRCUMFLEX;;;0109; +0109;LATIN SMALL LETTER C WITH CIRCUMFLEX;Ll;0;L;0063 0302;;;;N;LATIN SMALL LETTER C CIRCUMFLEX;;0108;;0108 +010A;LATIN CAPITAL LETTER C WITH DOT ABOVE;Lu;0;L;0043 0307;;;;N;LATIN CAPITAL LETTER C DOT;;;010B; +010B;LATIN SMALL LETTER C WITH DOT ABOVE;Ll;0;L;0063 0307;;;;N;LATIN SMALL LETTER C DOT;;010A;;010A +010C;LATIN CAPITAL LETTER C WITH CARON;Lu;0;L;0043 030C;;;;N;LATIN CAPITAL LETTER C HACEK;;;010D; +010D;LATIN SMALL LETTER C WITH CARON;Ll;0;L;0063 030C;;;;N;LATIN SMALL LETTER C HACEK;;010C;;010C +010E;LATIN CAPITAL LETTER D WITH CARON;Lu;0;L;0044 030C;;;;N;LATIN CAPITAL LETTER D HACEK;;;010F; +010F;LATIN SMALL LETTER D WITH CARON;Ll;0;L;0064 030C;;;;N;LATIN SMALL LETTER D HACEK;;010E;;010E +0110;LATIN CAPITAL LETTER D WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D BAR;;;0111; +0111;LATIN SMALL LETTER D WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER D BAR;;0110;;0110 +0112;LATIN CAPITAL LETTER E WITH MACRON;Lu;0;L;0045 0304;;;;N;LATIN CAPITAL LETTER E MACRON;;;0113; +0113;LATIN SMALL LETTER E WITH MACRON;Ll;0;L;0065 0304;;;;N;LATIN SMALL LETTER E MACRON;;0112;;0112 +0114;LATIN CAPITAL LETTER E WITH BREVE;Lu;0;L;0045 0306;;;;N;LATIN CAPITAL LETTER E BREVE;;;0115; +0115;LATIN SMALL LETTER E WITH BREVE;Ll;0;L;0065 0306;;;;N;LATIN SMALL LETTER E BREVE;;0114;;0114 +0116;LATIN CAPITAL LETTER E WITH DOT ABOVE;Lu;0;L;0045 0307;;;;N;LATIN CAPITAL LETTER E DOT;;;0117; +0117;LATIN SMALL LETTER E WITH DOT ABOVE;Ll;0;L;0065 0307;;;;N;LATIN SMALL LETTER E DOT;;0116;;0116 +0118;LATIN CAPITAL LETTER E WITH OGONEK;Lu;0;L;0045 0328;;;;N;LATIN CAPITAL LETTER E OGONEK;;;0119; +0119;LATIN SMALL LETTER E WITH OGONEK;Ll;0;L;0065 0328;;;;N;LATIN SMALL LETTER E OGONEK;;0118;;0118 +011A;LATIN CAPITAL LETTER E WITH CARON;Lu;0;L;0045 030C;;;;N;LATIN CAPITAL LETTER E HACEK;;;011B; +011B;LATIN SMALL LETTER E WITH CARON;Ll;0;L;0065 030C;;;;N;LATIN SMALL LETTER E HACEK;;011A;;011A +011C;LATIN CAPITAL LETTER G WITH CIRCUMFLEX;Lu;0;L;0047 0302;;;;N;LATIN CAPITAL LETTER G CIRCUMFLEX;;;011D; +011D;LATIN SMALL LETTER G WITH CIRCUMFLEX;Ll;0;L;0067 0302;;;;N;LATIN SMALL LETTER G CIRCUMFLEX;;011C;;011C +011E;LATIN CAPITAL LETTER G WITH BREVE;Lu;0;L;0047 0306;;;;N;LATIN CAPITAL LETTER G BREVE;;;011F; +011F;LATIN SMALL LETTER G WITH BREVE;Ll;0;L;0067 0306;;;;N;LATIN SMALL LETTER G BREVE;;011E;;011E +0120;LATIN CAPITAL LETTER G WITH DOT ABOVE;Lu;0;L;0047 0307;;;;N;LATIN CAPITAL LETTER G DOT;;;0121; +0121;LATIN SMALL LETTER G WITH DOT ABOVE;Ll;0;L;0067 0307;;;;N;LATIN SMALL LETTER G DOT;;0120;;0120 +0122;LATIN CAPITAL LETTER G WITH CEDILLA;Lu;0;L;0047 0327;;;;N;LATIN CAPITAL LETTER G CEDILLA;;;0123; +0123;LATIN SMALL LETTER G WITH CEDILLA;Ll;0;L;0067 0327;;;;N;LATIN SMALL LETTER G CEDILLA;;0122;;0122 +0124;LATIN CAPITAL LETTER H WITH CIRCUMFLEX;Lu;0;L;0048 0302;;;;N;LATIN CAPITAL LETTER H CIRCUMFLEX;;;0125; +0125;LATIN SMALL LETTER H WITH CIRCUMFLEX;Ll;0;L;0068 0302;;;;N;LATIN SMALL LETTER H CIRCUMFLEX;;0124;;0124 +0126;LATIN CAPITAL LETTER H WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER H BAR;;;0127; +0127;LATIN SMALL LETTER H WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER H BAR;;0126;;0126 +0128;LATIN CAPITAL LETTER I WITH TILDE;Lu;0;L;0049 0303;;;;N;LATIN CAPITAL LETTER I TILDE;;;0129; +0129;LATIN SMALL LETTER I WITH TILDE;Ll;0;L;0069 0303;;;;N;LATIN SMALL LETTER I TILDE;;0128;;0128 +012A;LATIN CAPITAL LETTER I WITH MACRON;Lu;0;L;0049 0304;;;;N;LATIN CAPITAL LETTER I MACRON;;;012B; +012B;LATIN SMALL LETTER I WITH MACRON;Ll;0;L;0069 0304;;;;N;LATIN SMALL LETTER I MACRON;;012A;;012A +012C;LATIN CAPITAL LETTER I WITH BREVE;Lu;0;L;0049 0306;;;;N;LATIN CAPITAL LETTER I BREVE;;;012D; +012D;LATIN SMALL LETTER I WITH BREVE;Ll;0;L;0069 0306;;;;N;LATIN SMALL LETTER I BREVE;;012C;;012C +012E;LATIN CAPITAL LETTER I WITH OGONEK;Lu;0;L;0049 0328;;;;N;LATIN CAPITAL LETTER I OGONEK;;;012F; +012F;LATIN SMALL LETTER I WITH OGONEK;Ll;0;L;0069 0328;;;;N;LATIN SMALL LETTER I OGONEK;;012E;;012E +0130;LATIN CAPITAL LETTER I WITH DOT ABOVE;Lu;0;L;0049 0307;;;;N;LATIN CAPITAL LETTER I DOT;;;0069; +0131;LATIN SMALL LETTER DOTLESS I;Ll;0;L;;;;;N;;;0049;;0049 +0132;LATIN CAPITAL LIGATURE IJ;Lu;0;L;<compat> 0049 004A;;;;N;LATIN CAPITAL LETTER I J;;;0133; +0133;LATIN SMALL LIGATURE IJ;Ll;0;L;<compat> 0069 006A;;;;N;LATIN SMALL LETTER I J;;0132;;0132 +0134;LATIN CAPITAL LETTER J WITH CIRCUMFLEX;Lu;0;L;004A 0302;;;;N;LATIN CAPITAL LETTER J CIRCUMFLEX;;;0135; +0135;LATIN SMALL LETTER J WITH CIRCUMFLEX;Ll;0;L;006A 0302;;;;N;LATIN SMALL LETTER J CIRCUMFLEX;;0134;;0134 +0136;LATIN CAPITAL LETTER K WITH CEDILLA;Lu;0;L;004B 0327;;;;N;LATIN CAPITAL LETTER K CEDILLA;;;0137; +0137;LATIN SMALL LETTER K WITH CEDILLA;Ll;0;L;006B 0327;;;;N;LATIN SMALL LETTER K CEDILLA;;0136;;0136 +0138;LATIN SMALL LETTER KRA;Ll;0;L;;;;;N;;;;; +0139;LATIN CAPITAL LETTER L WITH ACUTE;Lu;0;L;004C 0301;;;;N;LATIN CAPITAL LETTER L ACUTE;;;013A; +013A;LATIN SMALL LETTER L WITH ACUTE;Ll;0;L;006C 0301;;;;N;LATIN SMALL LETTER L ACUTE;;0139;;0139 +013B;LATIN CAPITAL LETTER L WITH CEDILLA;Lu;0;L;004C 0327;;;;N;LATIN CAPITAL LETTER L CEDILLA;;;013C; +013C;LATIN SMALL LETTER L WITH CEDILLA;Ll;0;L;006C 0327;;;;N;LATIN SMALL LETTER L CEDILLA;;013B;;013B +013D;LATIN CAPITAL LETTER L WITH CARON;Lu;0;L;004C 030C;;;;N;LATIN CAPITAL LETTER L HACEK;;;013E; +013E;LATIN SMALL LETTER L WITH CARON;Ll;0;L;006C 030C;;;;N;LATIN SMALL LETTER L HACEK;;013D;;013D +013F;LATIN CAPITAL LETTER L WITH MIDDLE DOT;Lu;0;L;<compat> 004C 00B7;;;;N;;;;0140; +0140;LATIN SMALL LETTER L WITH MIDDLE DOT;Ll;0;L;<compat> 006C 00B7;;;;N;;;013F;;013F +0141;LATIN CAPITAL LETTER L WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER L SLASH;;;0142; +0142;LATIN SMALL LETTER L WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER L SLASH;;0141;;0141 +0143;LATIN CAPITAL LETTER N WITH ACUTE;Lu;0;L;004E 0301;;;;N;LATIN CAPITAL LETTER N ACUTE;;;0144; +0144;LATIN SMALL LETTER N WITH ACUTE;Ll;0;L;006E 0301;;;;N;LATIN SMALL LETTER N ACUTE;;0143;;0143 +0145;LATIN CAPITAL LETTER N WITH CEDILLA;Lu;0;L;004E 0327;;;;N;LATIN CAPITAL LETTER N CEDILLA;;;0146; +0146;LATIN SMALL LETTER N WITH CEDILLA;Ll;0;L;006E 0327;;;;N;LATIN SMALL LETTER N CEDILLA;;0145;;0145 +0147;LATIN CAPITAL LETTER N WITH CARON;Lu;0;L;004E 030C;;;;N;LATIN CAPITAL LETTER N HACEK;;;0148; +0148;LATIN SMALL LETTER N WITH CARON;Ll;0;L;006E 030C;;;;N;LATIN SMALL LETTER N HACEK;;0147;;0147 +0149;LATIN SMALL LETTER N PRECEDED BY APOSTROPHE;Ll;0;L;<compat> 02BC 006E;;;;N;LATIN SMALL LETTER APOSTROPHE N;;;; +014A;LATIN CAPITAL LETTER ENG;Lu;0;L;;;;;N;;;;014B; +014B;LATIN SMALL LETTER ENG;Ll;0;L;;;;;N;;;014A;;014A +014C;LATIN CAPITAL LETTER O WITH MACRON;Lu;0;L;004F 0304;;;;N;LATIN CAPITAL LETTER O MACRON;;;014D; +014D;LATIN SMALL LETTER O WITH MACRON;Ll;0;L;006F 0304;;;;N;LATIN SMALL LETTER O MACRON;;014C;;014C +014E;LATIN CAPITAL LETTER O WITH BREVE;Lu;0;L;004F 0306;;;;N;LATIN CAPITAL LETTER O BREVE;;;014F; +014F;LATIN SMALL LETTER O WITH BREVE;Ll;0;L;006F 0306;;;;N;LATIN SMALL LETTER O BREVE;;014E;;014E +0150;LATIN CAPITAL LETTER O WITH DOUBLE ACUTE;Lu;0;L;004F 030B;;;;N;LATIN CAPITAL LETTER O DOUBLE ACUTE;;;0151; +0151;LATIN SMALL LETTER O WITH DOUBLE ACUTE;Ll;0;L;006F 030B;;;;N;LATIN SMALL LETTER O DOUBLE ACUTE;;0150;;0150 +0152;LATIN CAPITAL LIGATURE OE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER O E;;;0153; +0153;LATIN SMALL LIGATURE OE;Ll;0;L;;;;;N;LATIN SMALL LETTER O E;;0152;;0152 +0154;LATIN CAPITAL LETTER R WITH ACUTE;Lu;0;L;0052 0301;;;;N;LATIN CAPITAL LETTER R ACUTE;;;0155; +0155;LATIN SMALL LETTER R WITH ACUTE;Ll;0;L;0072 0301;;;;N;LATIN SMALL LETTER R ACUTE;;0154;;0154 +0156;LATIN CAPITAL LETTER R WITH CEDILLA;Lu;0;L;0052 0327;;;;N;LATIN CAPITAL LETTER R CEDILLA;;;0157; +0157;LATIN SMALL LETTER R WITH CEDILLA;Ll;0;L;0072 0327;;;;N;LATIN SMALL LETTER R CEDILLA;;0156;;0156 +0158;LATIN CAPITAL LETTER R WITH CARON;Lu;0;L;0052 030C;;;;N;LATIN CAPITAL LETTER R HACEK;;;0159; +0159;LATIN SMALL LETTER R WITH CARON;Ll;0;L;0072 030C;;;;N;LATIN SMALL LETTER R HACEK;;0158;;0158 +015A;LATIN CAPITAL LETTER S WITH ACUTE;Lu;0;L;0053 0301;;;;N;LATIN CAPITAL LETTER S ACUTE;;;015B; +015B;LATIN SMALL LETTER S WITH ACUTE;Ll;0;L;0073 0301;;;;N;LATIN SMALL LETTER S ACUTE;;015A;;015A +015C;LATIN CAPITAL LETTER S WITH CIRCUMFLEX;Lu;0;L;0053 0302;;;;N;LATIN CAPITAL LETTER S CIRCUMFLEX;;;015D; +015D;LATIN SMALL LETTER S WITH CIRCUMFLEX;Ll;0;L;0073 0302;;;;N;LATIN SMALL LETTER S CIRCUMFLEX;;015C;;015C +015E;LATIN CAPITAL LETTER S WITH CEDILLA;Lu;0;L;0053 0327;;;;N;LATIN CAPITAL LETTER S CEDILLA;;;015F; +015F;LATIN SMALL LETTER S WITH CEDILLA;Ll;0;L;0073 0327;;;;N;LATIN SMALL LETTER S CEDILLA;;015E;;015E +0160;LATIN CAPITAL LETTER S WITH CARON;Lu;0;L;0053 030C;;;;N;LATIN CAPITAL LETTER S HACEK;;;0161; +0161;LATIN SMALL LETTER S WITH CARON;Ll;0;L;0073 030C;;;;N;LATIN SMALL LETTER S HACEK;;0160;;0160 +0162;LATIN CAPITAL LETTER T WITH CEDILLA;Lu;0;L;0054 0327;;;;N;LATIN CAPITAL LETTER T CEDILLA;;;0163; +0163;LATIN SMALL LETTER T WITH CEDILLA;Ll;0;L;0074 0327;;;;N;LATIN SMALL LETTER T CEDILLA;;0162;;0162 +0164;LATIN CAPITAL LETTER T WITH CARON;Lu;0;L;0054 030C;;;;N;LATIN CAPITAL LETTER T HACEK;;;0165; +0165;LATIN SMALL LETTER T WITH CARON;Ll;0;L;0074 030C;;;;N;LATIN SMALL LETTER T HACEK;;0164;;0164 +0166;LATIN CAPITAL LETTER T WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER T BAR;;;0167; +0167;LATIN SMALL LETTER T WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER T BAR;;0166;;0166 +0168;LATIN CAPITAL LETTER U WITH TILDE;Lu;0;L;0055 0303;;;;N;LATIN CAPITAL LETTER U TILDE;;;0169; +0169;LATIN SMALL LETTER U WITH TILDE;Ll;0;L;0075 0303;;;;N;LATIN SMALL LETTER U TILDE;;0168;;0168 +016A;LATIN CAPITAL LETTER U WITH MACRON;Lu;0;L;0055 0304;;;;N;LATIN CAPITAL LETTER U MACRON;;;016B; +016B;LATIN SMALL LETTER U WITH MACRON;Ll;0;L;0075 0304;;;;N;LATIN SMALL LETTER U MACRON;;016A;;016A +016C;LATIN CAPITAL LETTER U WITH BREVE;Lu;0;L;0055 0306;;;;N;LATIN CAPITAL LETTER U BREVE;;;016D; +016D;LATIN SMALL LETTER U WITH BREVE;Ll;0;L;0075 0306;;;;N;LATIN SMALL LETTER U BREVE;;016C;;016C +016E;LATIN CAPITAL LETTER U WITH RING ABOVE;Lu;0;L;0055 030A;;;;N;LATIN CAPITAL LETTER U RING;;;016F; +016F;LATIN SMALL LETTER U WITH RING ABOVE;Ll;0;L;0075 030A;;;;N;LATIN SMALL LETTER U RING;;016E;;016E +0170;LATIN CAPITAL LETTER U WITH DOUBLE ACUTE;Lu;0;L;0055 030B;;;;N;LATIN CAPITAL LETTER U DOUBLE ACUTE;;;0171; +0171;LATIN SMALL LETTER U WITH DOUBLE ACUTE;Ll;0;L;0075 030B;;;;N;LATIN SMALL LETTER U DOUBLE ACUTE;;0170;;0170 +0172;LATIN CAPITAL LETTER U WITH OGONEK;Lu;0;L;0055 0328;;;;N;LATIN CAPITAL LETTER U OGONEK;;;0173; +0173;LATIN SMALL LETTER U WITH OGONEK;Ll;0;L;0075 0328;;;;N;LATIN SMALL LETTER U OGONEK;;0172;;0172 +0174;LATIN CAPITAL LETTER W WITH CIRCUMFLEX;Lu;0;L;0057 0302;;;;N;LATIN CAPITAL LETTER W CIRCUMFLEX;;;0175; +0175;LATIN SMALL LETTER W WITH CIRCUMFLEX;Ll;0;L;0077 0302;;;;N;LATIN SMALL LETTER W CIRCUMFLEX;;0174;;0174 +0176;LATIN CAPITAL LETTER Y WITH CIRCUMFLEX;Lu;0;L;0059 0302;;;;N;LATIN CAPITAL LETTER Y CIRCUMFLEX;;;0177; +0177;LATIN SMALL LETTER Y WITH CIRCUMFLEX;Ll;0;L;0079 0302;;;;N;LATIN SMALL LETTER Y CIRCUMFLEX;;0176;;0176 +0178;LATIN CAPITAL LETTER Y WITH DIAERESIS;Lu;0;L;0059 0308;;;;N;LATIN CAPITAL LETTER Y DIAERESIS;;;00FF; +0179;LATIN CAPITAL LETTER Z WITH ACUTE;Lu;0;L;005A 0301;;;;N;LATIN CAPITAL LETTER Z ACUTE;;;017A; +017A;LATIN SMALL LETTER Z WITH ACUTE;Ll;0;L;007A 0301;;;;N;LATIN SMALL LETTER Z ACUTE;;0179;;0179 +017B;LATIN CAPITAL LETTER Z WITH DOT ABOVE;Lu;0;L;005A 0307;;;;N;LATIN CAPITAL LETTER Z DOT;;;017C; +017C;LATIN SMALL LETTER Z WITH DOT ABOVE;Ll;0;L;007A 0307;;;;N;LATIN SMALL LETTER Z DOT;;017B;;017B +017D;LATIN CAPITAL LETTER Z WITH CARON;Lu;0;L;005A 030C;;;;N;LATIN CAPITAL LETTER Z HACEK;;;017E; +017E;LATIN SMALL LETTER Z WITH CARON;Ll;0;L;007A 030C;;;;N;LATIN SMALL LETTER Z HACEK;;017D;;017D +017F;LATIN SMALL LETTER LONG S;Ll;0;L;<compat> 0073;;;;N;;;0053;;0053 +0180;LATIN SMALL LETTER B WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER B BAR;;0243;;0243 +0181;LATIN CAPITAL LETTER B WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER B HOOK;;;0253; +0182;LATIN CAPITAL LETTER B WITH TOPBAR;Lu;0;L;;;;;N;LATIN CAPITAL LETTER B TOPBAR;;;0183; +0183;LATIN SMALL LETTER B WITH TOPBAR;Ll;0;L;;;;;N;LATIN SMALL LETTER B TOPBAR;;0182;;0182 +0184;LATIN CAPITAL LETTER TONE SIX;Lu;0;L;;;;;N;;;;0185; +0185;LATIN SMALL LETTER TONE SIX;Ll;0;L;;;;;N;;;0184;;0184 +0186;LATIN CAPITAL LETTER OPEN O;Lu;0;L;;;;;N;;;;0254; +0187;LATIN CAPITAL LETTER C WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER C HOOK;;;0188; +0188;LATIN SMALL LETTER C WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER C HOOK;;0187;;0187 +0189;LATIN CAPITAL LETTER AFRICAN D;Lu;0;L;;;;;N;;;;0256; +018A;LATIN CAPITAL LETTER D WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D HOOK;;;0257; +018B;LATIN CAPITAL LETTER D WITH TOPBAR;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D TOPBAR;;;018C; +018C;LATIN SMALL LETTER D WITH TOPBAR;Ll;0;L;;;;;N;LATIN SMALL LETTER D TOPBAR;;018B;;018B +018D;LATIN SMALL LETTER TURNED DELTA;Ll;0;L;;;;;N;;;;; +018E;LATIN CAPITAL LETTER REVERSED E;Lu;0;L;;;;;N;LATIN CAPITAL LETTER TURNED E;;;01DD; +018F;LATIN CAPITAL LETTER SCHWA;Lu;0;L;;;;;N;;;;0259; +0190;LATIN CAPITAL LETTER OPEN E;Lu;0;L;;;;;N;LATIN CAPITAL LETTER EPSILON;;;025B; +0191;LATIN CAPITAL LETTER F WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER F HOOK;;;0192; +0192;LATIN SMALL LETTER F WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER SCRIPT F;;0191;;0191 +0193;LATIN CAPITAL LETTER G WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER G HOOK;;;0260; +0194;LATIN CAPITAL LETTER GAMMA;Lu;0;L;;;;;N;;;;0263; +0195;LATIN SMALL LETTER HV;Ll;0;L;;;;;N;LATIN SMALL LETTER H V;;01F6;;01F6 +0196;LATIN CAPITAL LETTER IOTA;Lu;0;L;;;;;N;;;;0269; +0197;LATIN CAPITAL LETTER I WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER BARRED I;;;0268; +0198;LATIN CAPITAL LETTER K WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER K HOOK;;;0199; +0199;LATIN SMALL LETTER K WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER K HOOK;;0198;;0198 +019A;LATIN SMALL LETTER L WITH BAR;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED L;;023D;;023D +019B;LATIN SMALL LETTER LAMBDA WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED LAMBDA;;;; +019C;LATIN CAPITAL LETTER TURNED M;Lu;0;L;;;;;N;;;;026F; +019D;LATIN CAPITAL LETTER N WITH LEFT HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER N HOOK;;;0272; +019E;LATIN SMALL LETTER N WITH LONG RIGHT LEG;Ll;0;L;;;;;N;;;0220;;0220 +019F;LATIN CAPITAL LETTER O WITH MIDDLE TILDE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER BARRED O;;;0275; +01A0;LATIN CAPITAL LETTER O WITH HORN;Lu;0;L;004F 031B;;;;N;LATIN CAPITAL LETTER O HORN;;;01A1; +01A1;LATIN SMALL LETTER O WITH HORN;Ll;0;L;006F 031B;;;;N;LATIN SMALL LETTER O HORN;;01A0;;01A0 +01A2;LATIN CAPITAL LETTER OI;Lu;0;L;;;;;N;LATIN CAPITAL LETTER O I;;;01A3; +01A3;LATIN SMALL LETTER OI;Ll;0;L;;;;;N;LATIN SMALL LETTER O I;;01A2;;01A2 +01A4;LATIN CAPITAL LETTER P WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER P HOOK;;;01A5; +01A5;LATIN SMALL LETTER P WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER P HOOK;;01A4;;01A4 +01A6;LATIN LETTER YR;Lu;0;L;;;;;N;LATIN LETTER Y R;;;0280; +01A7;LATIN CAPITAL LETTER TONE TWO;Lu;0;L;;;;;N;;;;01A8; +01A8;LATIN SMALL LETTER TONE TWO;Ll;0;L;;;;;N;;;01A7;;01A7 +01A9;LATIN CAPITAL LETTER ESH;Lu;0;L;;;;;N;;;;0283; +01AA;LATIN LETTER REVERSED ESH LOOP;Ll;0;L;;;;;N;;;;; +01AB;LATIN SMALL LETTER T WITH PALATAL HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER T PALATAL HOOK;;;; +01AC;LATIN CAPITAL LETTER T WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER T HOOK;;;01AD; +01AD;LATIN SMALL LETTER T WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER T HOOK;;01AC;;01AC +01AE;LATIN CAPITAL LETTER T WITH RETROFLEX HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER T RETROFLEX HOOK;;;0288; +01AF;LATIN CAPITAL LETTER U WITH HORN;Lu;0;L;0055 031B;;;;N;LATIN CAPITAL LETTER U HORN;;;01B0; +01B0;LATIN SMALL LETTER U WITH HORN;Ll;0;L;0075 031B;;;;N;LATIN SMALL LETTER U HORN;;01AF;;01AF +01B1;LATIN CAPITAL LETTER UPSILON;Lu;0;L;;;;;N;;;;028A; +01B2;LATIN CAPITAL LETTER V WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER SCRIPT V;;;028B; +01B3;LATIN CAPITAL LETTER Y WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER Y HOOK;;;01B4; +01B4;LATIN SMALL LETTER Y WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER Y HOOK;;01B3;;01B3 +01B5;LATIN CAPITAL LETTER Z WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER Z BAR;;;01B6; +01B6;LATIN SMALL LETTER Z WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER Z BAR;;01B5;;01B5 +01B7;LATIN CAPITAL LETTER EZH;Lu;0;L;;;;;N;LATIN CAPITAL LETTER YOGH;;;0292; +01B8;LATIN CAPITAL LETTER EZH REVERSED;Lu;0;L;;;;;N;LATIN CAPITAL LETTER REVERSED YOGH;;;01B9; +01B9;LATIN SMALL LETTER EZH REVERSED;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED YOGH;;01B8;;01B8 +01BA;LATIN SMALL LETTER EZH WITH TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER YOGH WITH TAIL;;;; +01BB;LATIN LETTER TWO WITH STROKE;Lo;0;L;;;;;N;LATIN LETTER TWO BAR;;;; +01BC;LATIN CAPITAL LETTER TONE FIVE;Lu;0;L;;;;;N;;;;01BD; +01BD;LATIN SMALL LETTER TONE FIVE;Ll;0;L;;;;;N;;;01BC;;01BC +01BE;LATIN LETTER INVERTED GLOTTAL STOP WITH STROKE;Ll;0;L;;;;;N;LATIN LETTER INVERTED GLOTTAL STOP BAR;;;; +01BF;LATIN LETTER WYNN;Ll;0;L;;;;;N;;;01F7;;01F7 +01C0;LATIN LETTER DENTAL CLICK;Lo;0;L;;;;;N;LATIN LETTER PIPE;;;; +01C1;LATIN LETTER LATERAL CLICK;Lo;0;L;;;;;N;LATIN LETTER DOUBLE PIPE;;;; +01C2;LATIN LETTER ALVEOLAR CLICK;Lo;0;L;;;;;N;LATIN LETTER PIPE DOUBLE BAR;;;; +01C3;LATIN LETTER RETROFLEX CLICK;Lo;0;L;;;;;N;LATIN LETTER EXCLAMATION MARK;;;; +01C4;LATIN CAPITAL LETTER DZ WITH CARON;Lu;0;L;<compat> 0044 017D;;;;N;LATIN CAPITAL LETTER D Z HACEK;;;01C6;01C5 +01C5;LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON;Lt;0;L;<compat> 0044 017E;;;;N;LATIN LETTER CAPITAL D SMALL Z HACEK;;01C4;01C6;01C5 +01C6;LATIN SMALL LETTER DZ WITH CARON;Ll;0;L;<compat> 0064 017E;;;;N;LATIN SMALL LETTER D Z HACEK;;01C4;;01C5 +01C7;LATIN CAPITAL LETTER LJ;Lu;0;L;<compat> 004C 004A;;;;N;LATIN CAPITAL LETTER L J;;;01C9;01C8 +01C8;LATIN CAPITAL LETTER L WITH SMALL LETTER J;Lt;0;L;<compat> 004C 006A;;;;N;LATIN LETTER CAPITAL L SMALL J;;01C7;01C9;01C8 +01C9;LATIN SMALL LETTER LJ;Ll;0;L;<compat> 006C 006A;;;;N;LATIN SMALL LETTER L J;;01C7;;01C8 +01CA;LATIN CAPITAL LETTER NJ;Lu;0;L;<compat> 004E 004A;;;;N;LATIN CAPITAL LETTER N J;;;01CC;01CB +01CB;LATIN CAPITAL LETTER N WITH SMALL LETTER J;Lt;0;L;<compat> 004E 006A;;;;N;LATIN LETTER CAPITAL N SMALL J;;01CA;01CC;01CB +01CC;LATIN SMALL LETTER NJ;Ll;0;L;<compat> 006E 006A;;;;N;LATIN SMALL LETTER N J;;01CA;;01CB +01CD;LATIN CAPITAL LETTER A WITH CARON;Lu;0;L;0041 030C;;;;N;LATIN CAPITAL LETTER A HACEK;;;01CE; +01CE;LATIN SMALL LETTER A WITH CARON;Ll;0;L;0061 030C;;;;N;LATIN SMALL LETTER A HACEK;;01CD;;01CD +01CF;LATIN CAPITAL LETTER I WITH CARON;Lu;0;L;0049 030C;;;;N;LATIN CAPITAL LETTER I HACEK;;;01D0; +01D0;LATIN SMALL LETTER I WITH CARON;Ll;0;L;0069 030C;;;;N;LATIN SMALL LETTER I HACEK;;01CF;;01CF +01D1;LATIN CAPITAL LETTER O WITH CARON;Lu;0;L;004F 030C;;;;N;LATIN CAPITAL LETTER O HACEK;;;01D2; +01D2;LATIN SMALL LETTER O WITH CARON;Ll;0;L;006F 030C;;;;N;LATIN SMALL LETTER O HACEK;;01D1;;01D1 +01D3;LATIN CAPITAL LETTER U WITH CARON;Lu;0;L;0055 030C;;;;N;LATIN CAPITAL LETTER U HACEK;;;01D4; +01D4;LATIN SMALL LETTER U WITH CARON;Ll;0;L;0075 030C;;;;N;LATIN SMALL LETTER U HACEK;;01D3;;01D3 +01D5;LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON;Lu;0;L;00DC 0304;;;;N;LATIN CAPITAL LETTER U DIAERESIS MACRON;;;01D6; +01D6;LATIN SMALL LETTER U WITH DIAERESIS AND MACRON;Ll;0;L;00FC 0304;;;;N;LATIN SMALL LETTER U DIAERESIS MACRON;;01D5;;01D5 +01D7;LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE;Lu;0;L;00DC 0301;;;;N;LATIN CAPITAL LETTER U DIAERESIS ACUTE;;;01D8; +01D8;LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE;Ll;0;L;00FC 0301;;;;N;LATIN SMALL LETTER U DIAERESIS ACUTE;;01D7;;01D7 +01D9;LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON;Lu;0;L;00DC 030C;;;;N;LATIN CAPITAL LETTER U DIAERESIS HACEK;;;01DA; +01DA;LATIN SMALL LETTER U WITH DIAERESIS AND CARON;Ll;0;L;00FC 030C;;;;N;LATIN SMALL LETTER U DIAERESIS HACEK;;01D9;;01D9 +01DB;LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE;Lu;0;L;00DC 0300;;;;N;LATIN CAPITAL LETTER U DIAERESIS GRAVE;;;01DC; +01DC;LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE;Ll;0;L;00FC 0300;;;;N;LATIN SMALL LETTER U DIAERESIS GRAVE;;01DB;;01DB +01DD;LATIN SMALL LETTER TURNED E;Ll;0;L;;;;;N;;;018E;;018E +01DE;LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON;Lu;0;L;00C4 0304;;;;N;LATIN CAPITAL LETTER A DIAERESIS MACRON;;;01DF; +01DF;LATIN SMALL LETTER A WITH DIAERESIS AND MACRON;Ll;0;L;00E4 0304;;;;N;LATIN SMALL LETTER A DIAERESIS MACRON;;01DE;;01DE +01E0;LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON;Lu;0;L;0226 0304;;;;N;LATIN CAPITAL LETTER A DOT MACRON;;;01E1; +01E1;LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON;Ll;0;L;0227 0304;;;;N;LATIN SMALL LETTER A DOT MACRON;;01E0;;01E0 +01E2;LATIN CAPITAL LETTER AE WITH MACRON;Lu;0;L;00C6 0304;;;;N;LATIN CAPITAL LETTER A E MACRON;;;01E3; +01E3;LATIN SMALL LETTER AE WITH MACRON;Ll;0;L;00E6 0304;;;;N;LATIN SMALL LETTER A E MACRON;;01E2;;01E2 +01E4;LATIN CAPITAL LETTER G WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER G BAR;;;01E5; +01E5;LATIN SMALL LETTER G WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER G BAR;;01E4;;01E4 +01E6;LATIN CAPITAL LETTER G WITH CARON;Lu;0;L;0047 030C;;;;N;LATIN CAPITAL LETTER G HACEK;;;01E7; +01E7;LATIN SMALL LETTER G WITH CARON;Ll;0;L;0067 030C;;;;N;LATIN SMALL LETTER G HACEK;;01E6;;01E6 +01E8;LATIN CAPITAL LETTER K WITH CARON;Lu;0;L;004B 030C;;;;N;LATIN CAPITAL LETTER K HACEK;;;01E9; +01E9;LATIN SMALL LETTER K WITH CARON;Ll;0;L;006B 030C;;;;N;LATIN SMALL LETTER K HACEK;;01E8;;01E8 +01EA;LATIN CAPITAL LETTER O WITH OGONEK;Lu;0;L;004F 0328;;;;N;LATIN CAPITAL LETTER O OGONEK;;;01EB; +01EB;LATIN SMALL LETTER O WITH OGONEK;Ll;0;L;006F 0328;;;;N;LATIN SMALL LETTER O OGONEK;;01EA;;01EA +01EC;LATIN CAPITAL LETTER O WITH OGONEK AND MACRON;Lu;0;L;01EA 0304;;;;N;LATIN CAPITAL LETTER O OGONEK MACRON;;;01ED; +01ED;LATIN SMALL LETTER O WITH OGONEK AND MACRON;Ll;0;L;01EB 0304;;;;N;LATIN SMALL LETTER O OGONEK MACRON;;01EC;;01EC +01EE;LATIN CAPITAL LETTER EZH WITH CARON;Lu;0;L;01B7 030C;;;;N;LATIN CAPITAL LETTER YOGH HACEK;;;01EF; +01EF;LATIN SMALL LETTER EZH WITH CARON;Ll;0;L;0292 030C;;;;N;LATIN SMALL LETTER YOGH HACEK;;01EE;;01EE +01F0;LATIN SMALL LETTER J WITH CARON;Ll;0;L;006A 030C;;;;N;LATIN SMALL LETTER J HACEK;;;; +01F1;LATIN CAPITAL LETTER DZ;Lu;0;L;<compat> 0044 005A;;;;N;;;;01F3;01F2 +01F2;LATIN CAPITAL LETTER D WITH SMALL LETTER Z;Lt;0;L;<compat> 0044 007A;;;;N;;;01F1;01F3;01F2 +01F3;LATIN SMALL LETTER DZ;Ll;0;L;<compat> 0064 007A;;;;N;;;01F1;;01F2 +01F4;LATIN CAPITAL LETTER G WITH ACUTE;Lu;0;L;0047 0301;;;;N;;;;01F5; +01F5;LATIN SMALL LETTER G WITH ACUTE;Ll;0;L;0067 0301;;;;N;;;01F4;;01F4 +01F6;LATIN CAPITAL LETTER HWAIR;Lu;0;L;;;;;N;;;;0195; +01F7;LATIN CAPITAL LETTER WYNN;Lu;0;L;;;;;N;;;;01BF; +01F8;LATIN CAPITAL LETTER N WITH GRAVE;Lu;0;L;004E 0300;;;;N;;;;01F9; +01F9;LATIN SMALL LETTER N WITH GRAVE;Ll;0;L;006E 0300;;;;N;;;01F8;;01F8 +01FA;LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE;Lu;0;L;00C5 0301;;;;N;;;;01FB; +01FB;LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE;Ll;0;L;00E5 0301;;;;N;;;01FA;;01FA +01FC;LATIN CAPITAL LETTER AE WITH ACUTE;Lu;0;L;00C6 0301;;;;N;;;;01FD; +01FD;LATIN SMALL LETTER AE WITH ACUTE;Ll;0;L;00E6 0301;;;;N;;;01FC;;01FC +01FE;LATIN CAPITAL LETTER O WITH STROKE AND ACUTE;Lu;0;L;00D8 0301;;;;N;;;;01FF; +01FF;LATIN SMALL LETTER O WITH STROKE AND ACUTE;Ll;0;L;00F8 0301;;;;N;;;01FE;;01FE +0200;LATIN CAPITAL LETTER A WITH DOUBLE GRAVE;Lu;0;L;0041 030F;;;;N;;;;0201; +0201;LATIN SMALL LETTER A WITH DOUBLE GRAVE;Ll;0;L;0061 030F;;;;N;;;0200;;0200 +0202;LATIN CAPITAL LETTER A WITH INVERTED BREVE;Lu;0;L;0041 0311;;;;N;;;;0203; +0203;LATIN SMALL LETTER A WITH INVERTED BREVE;Ll;0;L;0061 0311;;;;N;;;0202;;0202 +0204;LATIN CAPITAL LETTER E WITH DOUBLE GRAVE;Lu;0;L;0045 030F;;;;N;;;;0205; +0205;LATIN SMALL LETTER E WITH DOUBLE GRAVE;Ll;0;L;0065 030F;;;;N;;;0204;;0204 +0206;LATIN CAPITAL LETTER E WITH INVERTED BREVE;Lu;0;L;0045 0311;;;;N;;;;0207; +0207;LATIN SMALL LETTER E WITH INVERTED BREVE;Ll;0;L;0065 0311;;;;N;;;0206;;0206 +0208;LATIN CAPITAL LETTER I WITH DOUBLE GRAVE;Lu;0;L;0049 030F;;;;N;;;;0209; +0209;LATIN SMALL LETTER I WITH DOUBLE GRAVE;Ll;0;L;0069 030F;;;;N;;;0208;;0208 +020A;LATIN CAPITAL LETTER I WITH INVERTED BREVE;Lu;0;L;0049 0311;;;;N;;;;020B; +020B;LATIN SMALL LETTER I WITH INVERTED BREVE;Ll;0;L;0069 0311;;;;N;;;020A;;020A +020C;LATIN CAPITAL LETTER O WITH DOUBLE GRAVE;Lu;0;L;004F 030F;;;;N;;;;020D; +020D;LATIN SMALL LETTER O WITH DOUBLE GRAVE;Ll;0;L;006F 030F;;;;N;;;020C;;020C +020E;LATIN CAPITAL LETTER O WITH INVERTED BREVE;Lu;0;L;004F 0311;;;;N;;;;020F; +020F;LATIN SMALL LETTER O WITH INVERTED BREVE;Ll;0;L;006F 0311;;;;N;;;020E;;020E +0210;LATIN CAPITAL LETTER R WITH DOUBLE GRAVE;Lu;0;L;0052 030F;;;;N;;;;0211; +0211;LATIN SMALL LETTER R WITH DOUBLE GRAVE;Ll;0;L;0072 030F;;;;N;;;0210;;0210 +0212;LATIN CAPITAL LETTER R WITH INVERTED BREVE;Lu;0;L;0052 0311;;;;N;;;;0213; +0213;LATIN SMALL LETTER R WITH INVERTED BREVE;Ll;0;L;0072 0311;;;;N;;;0212;;0212 +0214;LATIN CAPITAL LETTER U WITH DOUBLE GRAVE;Lu;0;L;0055 030F;;;;N;;;;0215; +0215;LATIN SMALL LETTER U WITH DOUBLE GRAVE;Ll;0;L;0075 030F;;;;N;;;0214;;0214 +0216;LATIN CAPITAL LETTER U WITH INVERTED BREVE;Lu;0;L;0055 0311;;;;N;;;;0217; +0217;LATIN SMALL LETTER U WITH INVERTED BREVE;Ll;0;L;0075 0311;;;;N;;;0216;;0216 +0218;LATIN CAPITAL LETTER S WITH COMMA BELOW;Lu;0;L;0053 0326;;;;N;;;;0219; +0219;LATIN SMALL LETTER S WITH COMMA BELOW;Ll;0;L;0073 0326;;;;N;;;0218;;0218 +021A;LATIN CAPITAL LETTER T WITH COMMA BELOW;Lu;0;L;0054 0326;;;;N;;;;021B; +021B;LATIN SMALL LETTER T WITH COMMA BELOW;Ll;0;L;0074 0326;;;;N;;;021A;;021A +021C;LATIN CAPITAL LETTER YOGH;Lu;0;L;;;;;N;;;;021D; +021D;LATIN SMALL LETTER YOGH;Ll;0;L;;;;;N;;;021C;;021C +021E;LATIN CAPITAL LETTER H WITH CARON;Lu;0;L;0048 030C;;;;N;;;;021F; +021F;LATIN SMALL LETTER H WITH CARON;Ll;0;L;0068 030C;;;;N;;;021E;;021E +0220;LATIN CAPITAL LETTER N WITH LONG RIGHT LEG;Lu;0;L;;;;;N;;;;019E; +0221;LATIN SMALL LETTER D WITH CURL;Ll;0;L;;;;;N;;;;; +0222;LATIN CAPITAL LETTER OU;Lu;0;L;;;;;N;;;;0223; +0223;LATIN SMALL LETTER OU;Ll;0;L;;;;;N;;;0222;;0222 +0224;LATIN CAPITAL LETTER Z WITH HOOK;Lu;0;L;;;;;N;;;;0225; +0225;LATIN SMALL LETTER Z WITH HOOK;Ll;0;L;;;;;N;;;0224;;0224 +0226;LATIN CAPITAL LETTER A WITH DOT ABOVE;Lu;0;L;0041 0307;;;;N;;;;0227; +0227;LATIN SMALL LETTER A WITH DOT ABOVE;Ll;0;L;0061 0307;;;;N;;;0226;;0226 +0228;LATIN CAPITAL LETTER E WITH CEDILLA;Lu;0;L;0045 0327;;;;N;;;;0229; +0229;LATIN SMALL LETTER E WITH CEDILLA;Ll;0;L;0065 0327;;;;N;;;0228;;0228 +022A;LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON;Lu;0;L;00D6 0304;;;;N;;;;022B; +022B;LATIN SMALL LETTER O WITH DIAERESIS AND MACRON;Ll;0;L;00F6 0304;;;;N;;;022A;;022A +022C;LATIN CAPITAL LETTER O WITH TILDE AND MACRON;Lu;0;L;00D5 0304;;;;N;;;;022D; +022D;LATIN SMALL LETTER O WITH TILDE AND MACRON;Ll;0;L;00F5 0304;;;;N;;;022C;;022C +022E;LATIN CAPITAL LETTER O WITH DOT ABOVE;Lu;0;L;004F 0307;;;;N;;;;022F; +022F;LATIN SMALL LETTER O WITH DOT ABOVE;Ll;0;L;006F 0307;;;;N;;;022E;;022E +0230;LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON;Lu;0;L;022E 0304;;;;N;;;;0231; +0231;LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON;Ll;0;L;022F 0304;;;;N;;;0230;;0230 +0232;LATIN CAPITAL LETTER Y WITH MACRON;Lu;0;L;0059 0304;;;;N;;;;0233; +0233;LATIN SMALL LETTER Y WITH MACRON;Ll;0;L;0079 0304;;;;N;;;0232;;0232 +0234;LATIN SMALL LETTER L WITH CURL;Ll;0;L;;;;;N;;;;; +0235;LATIN SMALL LETTER N WITH CURL;Ll;0;L;;;;;N;;;;; +0236;LATIN SMALL LETTER T WITH CURL;Ll;0;L;;;;;N;;;;; +0237;LATIN SMALL LETTER DOTLESS J;Ll;0;L;;;;;N;;;;; +0238;LATIN SMALL LETTER DB DIGRAPH;Ll;0;L;;;;;N;;;;; +0239;LATIN SMALL LETTER QP DIGRAPH;Ll;0;L;;;;;N;;;;; +023A;LATIN CAPITAL LETTER A WITH STROKE;Lu;0;L;;;;;N;;;;2C65; +023B;LATIN CAPITAL LETTER C WITH STROKE;Lu;0;L;;;;;N;;;;023C; +023C;LATIN SMALL LETTER C WITH STROKE;Ll;0;L;;;;;N;;;023B;;023B +023D;LATIN CAPITAL LETTER L WITH BAR;Lu;0;L;;;;;N;;;;019A; +023E;LATIN CAPITAL LETTER T WITH DIAGONAL STROKE;Lu;0;L;;;;;N;;;;2C66; +023F;LATIN SMALL LETTER S WITH SWASH TAIL;Ll;0;L;;;;;N;;;2C7E;;2C7E +0240;LATIN SMALL LETTER Z WITH SWASH TAIL;Ll;0;L;;;;;N;;;2C7F;;2C7F +0241;LATIN CAPITAL LETTER GLOTTAL STOP;Lu;0;L;;;;;N;;;;0242; +0242;LATIN SMALL LETTER GLOTTAL STOP;Ll;0;L;;;;;N;;;0241;;0241 +0243;LATIN CAPITAL LETTER B WITH STROKE;Lu;0;L;;;;;N;;;;0180; +0244;LATIN CAPITAL LETTER U BAR;Lu;0;L;;;;;N;;;;0289; +0245;LATIN CAPITAL LETTER TURNED V;Lu;0;L;;;;;N;;;;028C; +0246;LATIN CAPITAL LETTER E WITH STROKE;Lu;0;L;;;;;N;;;;0247; +0247;LATIN SMALL LETTER E WITH STROKE;Ll;0;L;;;;;N;;;0246;;0246 +0248;LATIN CAPITAL LETTER J WITH STROKE;Lu;0;L;;;;;N;;;;0249; +0249;LATIN SMALL LETTER J WITH STROKE;Ll;0;L;;;;;N;;;0248;;0248 +024A;LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL;Lu;0;L;;;;;N;;;;024B; +024B;LATIN SMALL LETTER Q WITH HOOK TAIL;Ll;0;L;;;;;N;;;024A;;024A +024C;LATIN CAPITAL LETTER R WITH STROKE;Lu;0;L;;;;;N;;;;024D; +024D;LATIN SMALL LETTER R WITH STROKE;Ll;0;L;;;;;N;;;024C;;024C +024E;LATIN CAPITAL LETTER Y WITH STROKE;Lu;0;L;;;;;N;;;;024F; +024F;LATIN SMALL LETTER Y WITH STROKE;Ll;0;L;;;;;N;;;024E;;024E +0250;LATIN SMALL LETTER TURNED A;Ll;0;L;;;;;N;;;2C6F;;2C6F +0251;LATIN SMALL LETTER ALPHA;Ll;0;L;;;;;N;LATIN SMALL LETTER SCRIPT A;;2C6D;;2C6D +0252;LATIN SMALL LETTER TURNED ALPHA;Ll;0;L;;;;;N;LATIN SMALL LETTER TURNED SCRIPT A;;2C70;;2C70 +0253;LATIN SMALL LETTER B WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER B HOOK;;0181;;0181 +0254;LATIN SMALL LETTER OPEN O;Ll;0;L;;;;;N;;;0186;;0186 +0255;LATIN SMALL LETTER C WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER C CURL;;;; +0256;LATIN SMALL LETTER D WITH TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER D RETROFLEX HOOK;;0189;;0189 +0257;LATIN SMALL LETTER D WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER D HOOK;;018A;;018A +0258;LATIN SMALL LETTER REVERSED E;Ll;0;L;;;;;N;;;;; +0259;LATIN SMALL LETTER SCHWA;Ll;0;L;;;;;N;;;018F;;018F +025A;LATIN SMALL LETTER SCHWA WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER SCHWA HOOK;;;; +025B;LATIN SMALL LETTER OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER EPSILON;;0190;;0190 +025C;LATIN SMALL LETTER REVERSED OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED EPSILON;;A7AB;;A7AB +025D;LATIN SMALL LETTER REVERSED OPEN E WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED EPSILON HOOK;;;; +025E;LATIN SMALL LETTER CLOSED REVERSED OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER CLOSED REVERSED EPSILON;;;; +025F;LATIN SMALL LETTER DOTLESS J WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER DOTLESS J BAR;;;; +0260;LATIN SMALL LETTER G WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER G HOOK;;0193;;0193 +0261;LATIN SMALL LETTER SCRIPT G;Ll;0;L;;;;;N;;;A7AC;;A7AC +0262;LATIN LETTER SMALL CAPITAL G;Ll;0;L;;;;;N;;;;; +0263;LATIN SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;0194;;0194 +0264;LATIN SMALL LETTER RAMS HORN;Ll;0;L;;;;;N;LATIN SMALL LETTER BABY GAMMA;;;; +0265;LATIN SMALL LETTER TURNED H;Ll;0;L;;;;;N;;;A78D;;A78D +0266;LATIN SMALL LETTER H WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER H HOOK;;A7AA;;A7AA +0267;LATIN SMALL LETTER HENG WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER HENG HOOK;;;; +0268;LATIN SMALL LETTER I WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED I;;0197;;0197 +0269;LATIN SMALL LETTER IOTA;Ll;0;L;;;;;N;;;0196;;0196 +026A;LATIN LETTER SMALL CAPITAL I;Ll;0;L;;;;;N;;;A7AE;;A7AE +026B;LATIN SMALL LETTER L WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;2C62;;2C62 +026C;LATIN SMALL LETTER L WITH BELT;Ll;0;L;;;;;N;LATIN SMALL LETTER L BELT;;A7AD;;A7AD +026D;LATIN SMALL LETTER L WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER L RETROFLEX HOOK;;;; +026E;LATIN SMALL LETTER LEZH;Ll;0;L;;;;;N;LATIN SMALL LETTER L YOGH;;;; +026F;LATIN SMALL LETTER TURNED M;Ll;0;L;;;;;N;;;019C;;019C +0270;LATIN SMALL LETTER TURNED M WITH LONG LEG;Ll;0;L;;;;;N;;;;; +0271;LATIN SMALL LETTER M WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER M HOOK;;2C6E;;2C6E +0272;LATIN SMALL LETTER N WITH LEFT HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER N HOOK;;019D;;019D +0273;LATIN SMALL LETTER N WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER N RETROFLEX HOOK;;;; +0274;LATIN LETTER SMALL CAPITAL N;Ll;0;L;;;;;N;;;;; +0275;LATIN SMALL LETTER BARRED O;Ll;0;L;;;;;N;;;019F;;019F +0276;LATIN LETTER SMALL CAPITAL OE;Ll;0;L;;;;;N;LATIN LETTER SMALL CAPITAL O E;;;; +0277;LATIN SMALL LETTER CLOSED OMEGA;Ll;0;L;;;;;N;;;;; +0278;LATIN SMALL LETTER PHI;Ll;0;L;;;;;N;;;;; +0279;LATIN SMALL LETTER TURNED R;Ll;0;L;;;;;N;;;;; +027A;LATIN SMALL LETTER TURNED R WITH LONG LEG;Ll;0;L;;;;;N;;;;; +027B;LATIN SMALL LETTER TURNED R WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER TURNED R HOOK;;;; +027C;LATIN SMALL LETTER R WITH LONG LEG;Ll;0;L;;;;;N;;;;; +027D;LATIN SMALL LETTER R WITH TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER R HOOK;;2C64;;2C64 +027E;LATIN SMALL LETTER R WITH FISHHOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER FISHHOOK R;;;; +027F;LATIN SMALL LETTER REVERSED R WITH FISHHOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED FISHHOOK R;;;; +0280;LATIN LETTER SMALL CAPITAL R;Ll;0;L;;;;;N;;;01A6;;01A6 +0281;LATIN LETTER SMALL CAPITAL INVERTED R;Ll;0;L;;;;;N;;;;; +0282;LATIN SMALL LETTER S WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER S HOOK;;;; +0283;LATIN SMALL LETTER ESH;Ll;0;L;;;;;N;;;01A9;;01A9 +0284;LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER DOTLESS J BAR HOOK;;;; +0285;LATIN SMALL LETTER SQUAT REVERSED ESH;Ll;0;L;;;;;N;;;;; +0286;LATIN SMALL LETTER ESH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER ESH CURL;;;; +0287;LATIN SMALL LETTER TURNED T;Ll;0;L;;;;;N;;;A7B1;;A7B1 +0288;LATIN SMALL LETTER T WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER T RETROFLEX HOOK;;01AE;;01AE +0289;LATIN SMALL LETTER U BAR;Ll;0;L;;;;;N;;;0244;;0244 +028A;LATIN SMALL LETTER UPSILON;Ll;0;L;;;;;N;;;01B1;;01B1 +028B;LATIN SMALL LETTER V WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER SCRIPT V;;01B2;;01B2 +028C;LATIN SMALL LETTER TURNED V;Ll;0;L;;;;;N;;;0245;;0245 +028D;LATIN SMALL LETTER TURNED W;Ll;0;L;;;;;N;;;;; +028E;LATIN SMALL LETTER TURNED Y;Ll;0;L;;;;;N;;;;; +028F;LATIN LETTER SMALL CAPITAL Y;Ll;0;L;;;;;N;;;;; +0290;LATIN SMALL LETTER Z WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER Z RETROFLEX HOOK;;;; +0291;LATIN SMALL LETTER Z WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER Z CURL;;;; +0292;LATIN SMALL LETTER EZH;Ll;0;L;;;;;N;LATIN SMALL LETTER YOGH;;01B7;;01B7 +0293;LATIN SMALL LETTER EZH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER YOGH CURL;;;; +0294;LATIN LETTER GLOTTAL STOP;Lo;0;L;;;;;N;;;;; +0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;; +0296;LATIN LETTER INVERTED GLOTTAL STOP;Ll;0;L;;;;;N;;;;; +0297;LATIN LETTER STRETCHED C;Ll;0;L;;;;;N;;;;; +0298;LATIN LETTER BILABIAL CLICK;Ll;0;L;;;;;N;LATIN LETTER BULLSEYE;;;; +0299;LATIN LETTER SMALL CAPITAL B;Ll;0;L;;;;;N;;;;; +029A;LATIN SMALL LETTER CLOSED OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER CLOSED EPSILON;;;; +029B;LATIN LETTER SMALL CAPITAL G WITH HOOK;Ll;0;L;;;;;N;LATIN LETTER SMALL CAPITAL G HOOK;;;; +029C;LATIN LETTER SMALL CAPITAL H;Ll;0;L;;;;;N;;;;; +029D;LATIN SMALL LETTER J WITH CROSSED-TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER CROSSED-TAIL J;;A7B2;;A7B2 +029E;LATIN SMALL LETTER TURNED K;Ll;0;L;;;;;N;;;A7B0;;A7B0 +029F;LATIN LETTER SMALL CAPITAL L;Ll;0;L;;;;;N;;;;; +02A0;LATIN SMALL LETTER Q WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER Q HOOK;;;; +02A1;LATIN LETTER GLOTTAL STOP WITH STROKE;Ll;0;L;;;;;N;LATIN LETTER GLOTTAL STOP BAR;;;; +02A2;LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP BAR;;;; +02A3;LATIN SMALL LETTER DZ DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER D Z;;;; +02A4;LATIN SMALL LETTER DEZH DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER D YOGH;;;; +02A5;LATIN SMALL LETTER DZ DIGRAPH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER D Z CURL;;;; +02A6;LATIN SMALL LETTER TS DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER T S;;;; +02A7;LATIN SMALL LETTER TESH DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER T ESH;;;; +02A8;LATIN SMALL LETTER TC DIGRAPH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER T C CURL;;;; +02A9;LATIN SMALL LETTER FENG DIGRAPH;Ll;0;L;;;;;N;;;;; +02AA;LATIN SMALL LETTER LS DIGRAPH;Ll;0;L;;;;;N;;;;; +02AB;LATIN SMALL LETTER LZ DIGRAPH;Ll;0;L;;;;;N;;;;; +02AC;LATIN LETTER BILABIAL PERCUSSIVE;Ll;0;L;;;;;N;;;;; +02AD;LATIN LETTER BIDENTAL PERCUSSIVE;Ll;0;L;;;;;N;;;;; +02AE;LATIN SMALL LETTER TURNED H WITH FISHHOOK;Ll;0;L;;;;;N;;;;; +02AF;LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL;Ll;0;L;;;;;N;;;;; +02B0;MODIFIER LETTER SMALL H;Lm;0;L;<super> 0068;;;;N;;;;; +02B1;MODIFIER LETTER SMALL H WITH HOOK;Lm;0;L;<super> 0266;;;;N;MODIFIER LETTER SMALL H HOOK;;;; +02B2;MODIFIER LETTER SMALL J;Lm;0;L;<super> 006A;;;;N;;;;; +02B3;MODIFIER LETTER SMALL R;Lm;0;L;<super> 0072;;;;N;;;;; +02B4;MODIFIER LETTER SMALL TURNED R;Lm;0;L;<super> 0279;;;;N;;;;; +02B5;MODIFIER LETTER SMALL TURNED R WITH HOOK;Lm;0;L;<super> 027B;;;;N;MODIFIER LETTER SMALL TURNED R HOOK;;;; +02B6;MODIFIER LETTER SMALL CAPITAL INVERTED R;Lm;0;L;<super> 0281;;;;N;;;;; +02B7;MODIFIER LETTER SMALL W;Lm;0;L;<super> 0077;;;;N;;;;; +02B8;MODIFIER LETTER SMALL Y;Lm;0;L;<super> 0079;;;;N;;;;; +02B9;MODIFIER LETTER PRIME;Lm;0;ON;;;;;N;;;;; +02BA;MODIFIER LETTER DOUBLE PRIME;Lm;0;ON;;;;;N;;;;; +02BB;MODIFIER LETTER TURNED COMMA;Lm;0;L;;;;;N;;;;; +02BC;MODIFIER LETTER APOSTROPHE;Lm;0;L;;;;;N;;;;; +02BD;MODIFIER LETTER REVERSED COMMA;Lm;0;L;;;;;N;;;;; +02BE;MODIFIER LETTER RIGHT HALF RING;Lm;0;L;;;;;N;;;;; +02BF;MODIFIER LETTER LEFT HALF RING;Lm;0;L;;;;;N;;;;; +02C0;MODIFIER LETTER GLOTTAL STOP;Lm;0;L;;;;;N;;;;; +02C1;MODIFIER LETTER REVERSED GLOTTAL STOP;Lm;0;L;;;;;N;;;;; +02C2;MODIFIER LETTER LEFT ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02C3;MODIFIER LETTER RIGHT ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02C4;MODIFIER LETTER UP ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02C5;MODIFIER LETTER DOWN ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02C6;MODIFIER LETTER CIRCUMFLEX ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER CIRCUMFLEX;;;; +02C7;CARON;Lm;0;ON;;;;;N;MODIFIER LETTER HACEK;;;; +02C8;MODIFIER LETTER VERTICAL LINE;Lm;0;ON;;;;;N;;;;; +02C9;MODIFIER LETTER MACRON;Lm;0;ON;;;;;N;;;;; +02CA;MODIFIER LETTER ACUTE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER ACUTE;;;; +02CB;MODIFIER LETTER GRAVE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER GRAVE;;;; +02CC;MODIFIER LETTER LOW VERTICAL LINE;Lm;0;ON;;;;;N;;;;; +02CD;MODIFIER LETTER LOW MACRON;Lm;0;ON;;;;;N;;;;; +02CE;MODIFIER LETTER LOW GRAVE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER LOW GRAVE;;;; +02CF;MODIFIER LETTER LOW ACUTE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER LOW ACUTE;;;; +02D0;MODIFIER LETTER TRIANGULAR COLON;Lm;0;L;;;;;N;;;;; +02D1;MODIFIER LETTER HALF TRIANGULAR COLON;Lm;0;L;;;;;N;;;;; +02D2;MODIFIER LETTER CENTRED RIGHT HALF RING;Sk;0;ON;;;;;N;MODIFIER LETTER CENTERED RIGHT HALF RING;;;; +02D3;MODIFIER LETTER CENTRED LEFT HALF RING;Sk;0;ON;;;;;N;MODIFIER LETTER CENTERED LEFT HALF RING;;;; +02D4;MODIFIER LETTER UP TACK;Sk;0;ON;;;;;N;;;;; +02D5;MODIFIER LETTER DOWN TACK;Sk;0;ON;;;;;N;;;;; +02D6;MODIFIER LETTER PLUS SIGN;Sk;0;ON;;;;;N;;;;; +02D7;MODIFIER LETTER MINUS SIGN;Sk;0;ON;;;;;N;;;;; +02D8;BREVE;Sk;0;ON;<compat> 0020 0306;;;;N;SPACING BREVE;;;; +02D9;DOT ABOVE;Sk;0;ON;<compat> 0020 0307;;;;N;SPACING DOT ABOVE;;;; +02DA;RING ABOVE;Sk;0;ON;<compat> 0020 030A;;;;N;SPACING RING ABOVE;;;; +02DB;OGONEK;Sk;0;ON;<compat> 0020 0328;;;;N;SPACING OGONEK;;;; +02DC;SMALL TILDE;Sk;0;ON;<compat> 0020 0303;;;;N;SPACING TILDE;;;; +02DD;DOUBLE ACUTE ACCENT;Sk;0;ON;<compat> 0020 030B;;;;N;SPACING DOUBLE ACUTE;;;; +02DE;MODIFIER LETTER RHOTIC HOOK;Sk;0;ON;;;;;N;;;;; +02DF;MODIFIER LETTER CROSS ACCENT;Sk;0;ON;;;;;N;;;;; +02E0;MODIFIER LETTER SMALL GAMMA;Lm;0;L;<super> 0263;;;;N;;;;; +02E1;MODIFIER LETTER SMALL L;Lm;0;L;<super> 006C;;;;N;;;;; +02E2;MODIFIER LETTER SMALL S;Lm;0;L;<super> 0073;;;;N;;;;; +02E3;MODIFIER LETTER SMALL X;Lm;0;L;<super> 0078;;;;N;;;;; +02E4;MODIFIER LETTER SMALL REVERSED GLOTTAL STOP;Lm;0;L;<super> 0295;;;;N;;;;; +02E5;MODIFIER LETTER EXTRA-HIGH TONE BAR;Sk;0;ON;;;;;N;;;;; +02E6;MODIFIER LETTER HIGH TONE BAR;Sk;0;ON;;;;;N;;;;; +02E7;MODIFIER LETTER MID TONE BAR;Sk;0;ON;;;;;N;;;;; +02E8;MODIFIER LETTER LOW TONE BAR;Sk;0;ON;;;;;N;;;;; +02E9;MODIFIER LETTER EXTRA-LOW TONE BAR;Sk;0;ON;;;;;N;;;;; +02EA;MODIFIER LETTER YIN DEPARTING TONE MARK;Sk;0;ON;;;;;N;;;;; +02EB;MODIFIER LETTER YANG DEPARTING TONE MARK;Sk;0;ON;;;;;N;;;;; +02EC;MODIFIER LETTER VOICING;Lm;0;ON;;;;;N;;;;; +02ED;MODIFIER LETTER UNASPIRATED;Sk;0;ON;;;;;N;;;;; +02EE;MODIFIER LETTER DOUBLE APOSTROPHE;Lm;0;L;;;;;N;;;;; +02EF;MODIFIER LETTER LOW DOWN ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02F0;MODIFIER LETTER LOW UP ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02F1;MODIFIER LETTER LOW LEFT ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02F2;MODIFIER LETTER LOW RIGHT ARROWHEAD;Sk;0;ON;;;;;N;;;;; +02F3;MODIFIER LETTER LOW RING;Sk;0;ON;;;;;N;;;;; +02F4;MODIFIER LETTER MIDDLE GRAVE ACCENT;Sk;0;ON;;;;;N;;;;; +02F5;MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT;Sk;0;ON;;;;;N;;;;; +02F6;MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT;Sk;0;ON;;;;;N;;;;; +02F7;MODIFIER LETTER LOW TILDE;Sk;0;ON;;;;;N;;;;; +02F8;MODIFIER LETTER RAISED COLON;Sk;0;ON;;;;;N;;;;; +02F9;MODIFIER LETTER BEGIN HIGH TONE;Sk;0;ON;;;;;N;;;;; +02FA;MODIFIER LETTER END HIGH TONE;Sk;0;ON;;;;;N;;;;; +02FB;MODIFIER LETTER BEGIN LOW TONE;Sk;0;ON;;;;;N;;;;; +02FC;MODIFIER LETTER END LOW TONE;Sk;0;ON;;;;;N;;;;; +02FD;MODIFIER LETTER SHELF;Sk;0;ON;;;;;N;;;;; +02FE;MODIFIER LETTER OPEN SHELF;Sk;0;ON;;;;;N;;;;; +02FF;MODIFIER LETTER LOW LEFT ARROW;Sk;0;ON;;;;;N;;;;; +0300;COMBINING GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING GRAVE;;;; +0301;COMBINING ACUTE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING ACUTE;;;; +0302;COMBINING CIRCUMFLEX ACCENT;Mn;230;NSM;;;;;N;NON-SPACING CIRCUMFLEX;;;; +0303;COMBINING TILDE;Mn;230;NSM;;;;;N;NON-SPACING TILDE;;;; +0304;COMBINING MACRON;Mn;230;NSM;;;;;N;NON-SPACING MACRON;;;; +0305;COMBINING OVERLINE;Mn;230;NSM;;;;;N;NON-SPACING OVERSCORE;;;; +0306;COMBINING BREVE;Mn;230;NSM;;;;;N;NON-SPACING BREVE;;;; +0307;COMBINING DOT ABOVE;Mn;230;NSM;;;;;N;NON-SPACING DOT ABOVE;;;; +0308;COMBINING DIAERESIS;Mn;230;NSM;;;;;N;NON-SPACING DIAERESIS;;;; +0309;COMBINING HOOK ABOVE;Mn;230;NSM;;;;;N;NON-SPACING HOOK ABOVE;;;; +030A;COMBINING RING ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RING ABOVE;;;; +030B;COMBINING DOUBLE ACUTE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE ACUTE;;;; +030C;COMBINING CARON;Mn;230;NSM;;;;;N;NON-SPACING HACEK;;;; +030D;COMBINING VERTICAL LINE ABOVE;Mn;230;NSM;;;;;N;NON-SPACING VERTICAL LINE ABOVE;;;; +030E;COMBINING DOUBLE VERTICAL LINE ABOVE;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE VERTICAL LINE ABOVE;;;; +030F;COMBINING DOUBLE GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE GRAVE;;;; +0310;COMBINING CANDRABINDU;Mn;230;NSM;;;;;N;NON-SPACING CANDRABINDU;;;; +0311;COMBINING INVERTED BREVE;Mn;230;NSM;;;;;N;NON-SPACING INVERTED BREVE;;;; +0312;COMBINING TURNED COMMA ABOVE;Mn;230;NSM;;;;;N;NON-SPACING TURNED COMMA ABOVE;;;; +0313;COMBINING COMMA ABOVE;Mn;230;NSM;;;;;N;NON-SPACING COMMA ABOVE;;;; +0314;COMBINING REVERSED COMMA ABOVE;Mn;230;NSM;;;;;N;NON-SPACING REVERSED COMMA ABOVE;;;; +0315;COMBINING COMMA ABOVE RIGHT;Mn;232;NSM;;;;;N;NON-SPACING COMMA ABOVE RIGHT;;;; +0316;COMBINING GRAVE ACCENT BELOW;Mn;220;NSM;;;;;N;NON-SPACING GRAVE BELOW;;;; +0317;COMBINING ACUTE ACCENT BELOW;Mn;220;NSM;;;;;N;NON-SPACING ACUTE BELOW;;;; +0318;COMBINING LEFT TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING LEFT TACK BELOW;;;; +0319;COMBINING RIGHT TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING RIGHT TACK BELOW;;;; +031A;COMBINING LEFT ANGLE ABOVE;Mn;232;NSM;;;;;N;NON-SPACING LEFT ANGLE ABOVE;;;; +031B;COMBINING HORN;Mn;216;NSM;;;;;N;NON-SPACING HORN;;;; +031C;COMBINING LEFT HALF RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING LEFT HALF RING BELOW;;;; +031D;COMBINING UP TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING UP TACK BELOW;;;; +031E;COMBINING DOWN TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING DOWN TACK BELOW;;;; +031F;COMBINING PLUS SIGN BELOW;Mn;220;NSM;;;;;N;NON-SPACING PLUS SIGN BELOW;;;; +0320;COMBINING MINUS SIGN BELOW;Mn;220;NSM;;;;;N;NON-SPACING MINUS SIGN BELOW;;;; +0321;COMBINING PALATALIZED HOOK BELOW;Mn;202;NSM;;;;;N;NON-SPACING PALATALIZED HOOK BELOW;;;; +0322;COMBINING RETROFLEX HOOK BELOW;Mn;202;NSM;;;;;N;NON-SPACING RETROFLEX HOOK BELOW;;;; +0323;COMBINING DOT BELOW;Mn;220;NSM;;;;;N;NON-SPACING DOT BELOW;;;; +0324;COMBINING DIAERESIS BELOW;Mn;220;NSM;;;;;N;NON-SPACING DOUBLE DOT BELOW;;;; +0325;COMBINING RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RING BELOW;;;; +0326;COMBINING COMMA BELOW;Mn;220;NSM;;;;;N;NON-SPACING COMMA BELOW;;;; +0327;COMBINING CEDILLA;Mn;202;NSM;;;;;N;NON-SPACING CEDILLA;;;; +0328;COMBINING OGONEK;Mn;202;NSM;;;;;N;NON-SPACING OGONEK;;;; +0329;COMBINING VERTICAL LINE BELOW;Mn;220;NSM;;;;;N;NON-SPACING VERTICAL LINE BELOW;;;; +032A;COMBINING BRIDGE BELOW;Mn;220;NSM;;;;;N;NON-SPACING BRIDGE BELOW;;;; +032B;COMBINING INVERTED DOUBLE ARCH BELOW;Mn;220;NSM;;;;;N;NON-SPACING INVERTED DOUBLE ARCH BELOW;;;; +032C;COMBINING CARON BELOW;Mn;220;NSM;;;;;N;NON-SPACING HACEK BELOW;;;; +032D;COMBINING CIRCUMFLEX ACCENT BELOW;Mn;220;NSM;;;;;N;NON-SPACING CIRCUMFLEX BELOW;;;; +032E;COMBINING BREVE BELOW;Mn;220;NSM;;;;;N;NON-SPACING BREVE BELOW;;;; +032F;COMBINING INVERTED BREVE BELOW;Mn;220;NSM;;;;;N;NON-SPACING INVERTED BREVE BELOW;;;; +0330;COMBINING TILDE BELOW;Mn;220;NSM;;;;;N;NON-SPACING TILDE BELOW;;;; +0331;COMBINING MACRON BELOW;Mn;220;NSM;;;;;N;NON-SPACING MACRON BELOW;;;; +0332;COMBINING LOW LINE;Mn;220;NSM;;;;;N;NON-SPACING UNDERSCORE;;;; +0333;COMBINING DOUBLE LOW LINE;Mn;220;NSM;;;;;N;NON-SPACING DOUBLE UNDERSCORE;;;; +0334;COMBINING TILDE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING TILDE OVERLAY;;;; +0335;COMBINING SHORT STROKE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING SHORT BAR OVERLAY;;;; +0336;COMBINING LONG STROKE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG BAR OVERLAY;;;; +0337;COMBINING SHORT SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING SHORT SLASH OVERLAY;;;; +0338;COMBINING LONG SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG SLASH OVERLAY;;;; +0339;COMBINING RIGHT HALF RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RIGHT HALF RING BELOW;;;; +033A;COMBINING INVERTED BRIDGE BELOW;Mn;220;NSM;;;;;N;NON-SPACING INVERTED BRIDGE BELOW;;;; +033B;COMBINING SQUARE BELOW;Mn;220;NSM;;;;;N;NON-SPACING SQUARE BELOW;;;; +033C;COMBINING SEAGULL BELOW;Mn;220;NSM;;;;;N;NON-SPACING SEAGULL BELOW;;;; +033D;COMBINING X ABOVE;Mn;230;NSM;;;;;N;NON-SPACING X ABOVE;;;; +033E;COMBINING VERTICAL TILDE;Mn;230;NSM;;;;;N;NON-SPACING VERTICAL TILDE;;;; +033F;COMBINING DOUBLE OVERLINE;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE OVERSCORE;;;; +0340;COMBINING GRAVE TONE MARK;Mn;230;NSM;0300;;;;N;NON-SPACING GRAVE TONE MARK;;;; +0341;COMBINING ACUTE TONE MARK;Mn;230;NSM;0301;;;;N;NON-SPACING ACUTE TONE MARK;;;; +0342;COMBINING GREEK PERISPOMENI;Mn;230;NSM;;;;;N;;;;; +0343;COMBINING GREEK KORONIS;Mn;230;NSM;0313;;;;N;;;;; +0344;COMBINING GREEK DIALYTIKA TONOS;Mn;230;NSM;0308 0301;;;;N;GREEK NON-SPACING DIAERESIS TONOS;;;; +0345;COMBINING GREEK YPOGEGRAMMENI;Mn;240;NSM;;;;;N;GREEK NON-SPACING IOTA BELOW;;0399;;0399 +0346;COMBINING BRIDGE ABOVE;Mn;230;NSM;;;;;N;;;;; +0347;COMBINING EQUALS SIGN BELOW;Mn;220;NSM;;;;;N;;;;; +0348;COMBINING DOUBLE VERTICAL LINE BELOW;Mn;220;NSM;;;;;N;;;;; +0349;COMBINING LEFT ANGLE BELOW;Mn;220;NSM;;;;;N;;;;; +034A;COMBINING NOT TILDE ABOVE;Mn;230;NSM;;;;;N;;;;; +034B;COMBINING HOMOTHETIC ABOVE;Mn;230;NSM;;;;;N;;;;; +034C;COMBINING ALMOST EQUAL TO ABOVE;Mn;230;NSM;;;;;N;;;;; +034D;COMBINING LEFT RIGHT ARROW BELOW;Mn;220;NSM;;;;;N;;;;; +034E;COMBINING UPWARDS ARROW BELOW;Mn;220;NSM;;;;;N;;;;; +034F;COMBINING GRAPHEME JOINER;Mn;0;NSM;;;;;N;;;;; +0350;COMBINING RIGHT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;; +0351;COMBINING LEFT HALF RING ABOVE;Mn;230;NSM;;;;;N;;;;; +0352;COMBINING FERMATA;Mn;230;NSM;;;;;N;;;;; +0353;COMBINING X BELOW;Mn;220;NSM;;;;;N;;;;; +0354;COMBINING LEFT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;; +0355;COMBINING RIGHT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;; +0356;COMBINING RIGHT ARROWHEAD AND UP ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;; +0357;COMBINING RIGHT HALF RING ABOVE;Mn;230;NSM;;;;;N;;;;; +0358;COMBINING DOT ABOVE RIGHT;Mn;232;NSM;;;;;N;;;;; +0359;COMBINING ASTERISK BELOW;Mn;220;NSM;;;;;N;;;;; +035A;COMBINING DOUBLE RING BELOW;Mn;220;NSM;;;;;N;;;;; +035B;COMBINING ZIGZAG ABOVE;Mn;230;NSM;;;;;N;;;;; +035C;COMBINING DOUBLE BREVE BELOW;Mn;233;NSM;;;;;N;;;;; +035D;COMBINING DOUBLE BREVE;Mn;234;NSM;;;;;N;;;;; +035E;COMBINING DOUBLE MACRON;Mn;234;NSM;;;;;N;;;;; +035F;COMBINING DOUBLE MACRON BELOW;Mn;233;NSM;;;;;N;;;;; +0360;COMBINING DOUBLE TILDE;Mn;234;NSM;;;;;N;;;;; +0361;COMBINING DOUBLE INVERTED BREVE;Mn;234;NSM;;;;;N;;;;; +0362;COMBINING DOUBLE RIGHTWARDS ARROW BELOW;Mn;233;NSM;;;;;N;;;;; +0363;COMBINING LATIN SMALL LETTER A;Mn;230;NSM;;;;;N;;;;; +0364;COMBINING LATIN SMALL LETTER E;Mn;230;NSM;;;;;N;;;;; +0365;COMBINING LATIN SMALL LETTER I;Mn;230;NSM;;;;;N;;;;; +0366;COMBINING LATIN SMALL LETTER O;Mn;230;NSM;;;;;N;;;;; +0367;COMBINING LATIN SMALL LETTER U;Mn;230;NSM;;;;;N;;;;; +0368;COMBINING LATIN SMALL LETTER C;Mn;230;NSM;;;;;N;;;;; +0369;COMBINING LATIN SMALL LETTER D;Mn;230;NSM;;;;;N;;;;; +036A;COMBINING LATIN SMALL LETTER H;Mn;230;NSM;;;;;N;;;;; +036B;COMBINING LATIN SMALL LETTER M;Mn;230;NSM;;;;;N;;;;; +036C;COMBINING LATIN SMALL LETTER R;Mn;230;NSM;;;;;N;;;;; +036D;COMBINING LATIN SMALL LETTER T;Mn;230;NSM;;;;;N;;;;; +036E;COMBINING LATIN SMALL LETTER V;Mn;230;NSM;;;;;N;;;;; +036F;COMBINING LATIN SMALL LETTER X;Mn;230;NSM;;;;;N;;;;; +0370;GREEK CAPITAL LETTER HETA;Lu;0;L;;;;;N;;;;0371; +0371;GREEK SMALL LETTER HETA;Ll;0;L;;;;;N;;;0370;;0370 +0372;GREEK CAPITAL LETTER ARCHAIC SAMPI;Lu;0;L;;;;;N;;;;0373; +0373;GREEK SMALL LETTER ARCHAIC SAMPI;Ll;0;L;;;;;N;;;0372;;0372 +0374;GREEK NUMERAL SIGN;Lm;0;ON;02B9;;;;N;GREEK UPPER NUMERAL SIGN;;;; +0375;GREEK LOWER NUMERAL SIGN;Sk;0;ON;;;;;N;;;;; +0376;GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA;Lu;0;L;;;;;N;;;;0377; +0377;GREEK SMALL LETTER PAMPHYLIAN DIGAMMA;Ll;0;L;;;;;N;;;0376;;0376 +037A;GREEK YPOGEGRAMMENI;Lm;0;L;<compat> 0020 0345;;;;N;GREEK SPACING IOTA BELOW;;;; +037B;GREEK SMALL REVERSED LUNATE SIGMA SYMBOL;Ll;0;L;;;;;N;;;03FD;;03FD +037C;GREEK SMALL DOTTED LUNATE SIGMA SYMBOL;Ll;0;L;;;;;N;;;03FE;;03FE +037D;GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL;Ll;0;L;;;;;N;;;03FF;;03FF +037E;GREEK QUESTION MARK;Po;0;ON;003B;;;;N;;;;; +037F;GREEK CAPITAL LETTER YOT;Lu;0;L;;;;;N;;;;03F3; +0384;GREEK TONOS;Sk;0;ON;<compat> 0020 0301;;;;N;GREEK SPACING TONOS;;;; +0385;GREEK DIALYTIKA TONOS;Sk;0;ON;00A8 0301;;;;N;GREEK SPACING DIAERESIS TONOS;;;; +0386;GREEK CAPITAL LETTER ALPHA WITH TONOS;Lu;0;L;0391 0301;;;;N;GREEK CAPITAL LETTER ALPHA TONOS;;;03AC; +0387;GREEK ANO TELEIA;Po;0;ON;00B7;;;;N;;;;; +0388;GREEK CAPITAL LETTER EPSILON WITH TONOS;Lu;0;L;0395 0301;;;;N;GREEK CAPITAL LETTER EPSILON TONOS;;;03AD; +0389;GREEK CAPITAL LETTER ETA WITH TONOS;Lu;0;L;0397 0301;;;;N;GREEK CAPITAL LETTER ETA TONOS;;;03AE; +038A;GREEK CAPITAL LETTER IOTA WITH TONOS;Lu;0;L;0399 0301;;;;N;GREEK CAPITAL LETTER IOTA TONOS;;;03AF; +038C;GREEK CAPITAL LETTER OMICRON WITH TONOS;Lu;0;L;039F 0301;;;;N;GREEK CAPITAL LETTER OMICRON TONOS;;;03CC; +038E;GREEK CAPITAL LETTER UPSILON WITH TONOS;Lu;0;L;03A5 0301;;;;N;GREEK CAPITAL LETTER UPSILON TONOS;;;03CD; +038F;GREEK CAPITAL LETTER OMEGA WITH TONOS;Lu;0;L;03A9 0301;;;;N;GREEK CAPITAL LETTER OMEGA TONOS;;;03CE; +0390;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS;Ll;0;L;03CA 0301;;;;N;GREEK SMALL LETTER IOTA DIAERESIS TONOS;;;; +0391;GREEK CAPITAL LETTER ALPHA;Lu;0;L;;;;;N;;;;03B1; +0392;GREEK CAPITAL LETTER BETA;Lu;0;L;;;;;N;;;;03B2; +0393;GREEK CAPITAL LETTER GAMMA;Lu;0;L;;;;;N;;;;03B3; +0394;GREEK CAPITAL LETTER DELTA;Lu;0;L;;;;;N;;;;03B4; +0395;GREEK CAPITAL LETTER EPSILON;Lu;0;L;;;;;N;;;;03B5; +0396;GREEK CAPITAL LETTER ZETA;Lu;0;L;;;;;N;;;;03B6; +0397;GREEK CAPITAL LETTER ETA;Lu;0;L;;;;;N;;;;03B7; +0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8; +0399;GREEK CAPITAL LETTER IOTA;Lu;0;L;;;;;N;;;;03B9; +039A;GREEK CAPITAL LETTER KAPPA;Lu;0;L;;;;;N;;;;03BA; +039B;GREEK CAPITAL LETTER LAMDA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER LAMBDA;;;03BB; +039C;GREEK CAPITAL LETTER MU;Lu;0;L;;;;;N;;;;03BC; +039D;GREEK CAPITAL LETTER NU;Lu;0;L;;;;;N;;;;03BD; +039E;GREEK CAPITAL LETTER XI;Lu;0;L;;;;;N;;;;03BE; +039F;GREEK CAPITAL LETTER OMICRON;Lu;0;L;;;;;N;;;;03BF; +03A0;GREEK CAPITAL LETTER PI;Lu;0;L;;;;;N;;;;03C0; +03A1;GREEK CAPITAL LETTER RHO;Lu;0;L;;;;;N;;;;03C1; +03A3;GREEK CAPITAL LETTER SIGMA;Lu;0;L;;;;;N;;;;03C3; +03A4;GREEK CAPITAL LETTER TAU;Lu;0;L;;;;;N;;;;03C4; +03A5;GREEK CAPITAL LETTER UPSILON;Lu;0;L;;;;;N;;;;03C5; +03A6;GREEK CAPITAL LETTER PHI;Lu;0;L;;;;;N;;;;03C6; +03A7;GREEK CAPITAL LETTER CHI;Lu;0;L;;;;;N;;;;03C7; +03A8;GREEK CAPITAL LETTER PSI;Lu;0;L;;;;;N;;;;03C8; +03A9;GREEK CAPITAL LETTER OMEGA;Lu;0;L;;;;;N;;;;03C9; +03AA;GREEK CAPITAL LETTER IOTA WITH DIALYTIKA;Lu;0;L;0399 0308;;;;N;GREEK CAPITAL LETTER IOTA DIAERESIS;;;03CA; +03AB;GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA;Lu;0;L;03A5 0308;;;;N;GREEK CAPITAL LETTER UPSILON DIAERESIS;;;03CB; +03AC;GREEK SMALL LETTER ALPHA WITH TONOS;Ll;0;L;03B1 0301;;;;N;GREEK SMALL LETTER ALPHA TONOS;;0386;;0386 +03AD;GREEK SMALL LETTER EPSILON WITH TONOS;Ll;0;L;03B5 0301;;;;N;GREEK SMALL LETTER EPSILON TONOS;;0388;;0388 +03AE;GREEK SMALL LETTER ETA WITH TONOS;Ll;0;L;03B7 0301;;;;N;GREEK SMALL LETTER ETA TONOS;;0389;;0389 +03AF;GREEK SMALL LETTER IOTA WITH TONOS;Ll;0;L;03B9 0301;;;;N;GREEK SMALL LETTER IOTA TONOS;;038A;;038A +03B0;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS;Ll;0;L;03CB 0301;;;;N;GREEK SMALL LETTER UPSILON DIAERESIS TONOS;;;; +03B1;GREEK SMALL LETTER ALPHA;Ll;0;L;;;;;N;;;0391;;0391 +03B2;GREEK SMALL LETTER BETA;Ll;0;L;;;;;N;;;0392;;0392 +03B3;GREEK SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;0393;;0393 +03B4;GREEK SMALL LETTER DELTA;Ll;0;L;;;;;N;;;0394;;0394 +03B5;GREEK SMALL LETTER EPSILON;Ll;0;L;;;;;N;;;0395;;0395 +03B6;GREEK SMALL LETTER ZETA;Ll;0;L;;;;;N;;;0396;;0396 +03B7;GREEK SMALL LETTER ETA;Ll;0;L;;;;;N;;;0397;;0397 +03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398 +03B9;GREEK SMALL LETTER IOTA;Ll;0;L;;;;;N;;;0399;;0399 +03BA;GREEK SMALL LETTER KAPPA;Ll;0;L;;;;;N;;;039A;;039A +03BB;GREEK SMALL LETTER LAMDA;Ll;0;L;;;;;N;GREEK SMALL LETTER LAMBDA;;039B;;039B +03BC;GREEK SMALL LETTER MU;Ll;0;L;;;;;N;;;039C;;039C +03BD;GREEK SMALL LETTER NU;Ll;0;L;;;;;N;;;039D;;039D +03BE;GREEK SMALL LETTER XI;Ll;0;L;;;;;N;;;039E;;039E +03BF;GREEK SMALL LETTER OMICRON;Ll;0;L;;;;;N;;;039F;;039F +03C0;GREEK SMALL LETTER PI;Ll;0;L;;;;;N;;;03A0;;03A0 +03C1;GREEK SMALL LETTER RHO;Ll;0;L;;;;;N;;;03A1;;03A1 +03C2;GREEK SMALL LETTER FINAL SIGMA;Ll;0;L;;;;;N;;;03A3;;03A3 +03C3;GREEK SMALL LETTER SIGMA;Ll;0;L;;;;;N;;;03A3;;03A3 +03C4;GREEK SMALL LETTER TAU;Ll;0;L;;;;;N;;;03A4;;03A4 +03C5;GREEK SMALL LETTER UPSILON;Ll;0;L;;;;;N;;;03A5;;03A5 +03C6;GREEK SMALL LETTER PHI;Ll;0;L;;;;;N;;;03A6;;03A6 +03C7;GREEK SMALL LETTER CHI;Ll;0;L;;;;;N;;;03A7;;03A7 +03C8;GREEK SMALL LETTER PSI;Ll;0;L;;;;;N;;;03A8;;03A8 +03C9;GREEK SMALL LETTER OMEGA;Ll;0;L;;;;;N;;;03A9;;03A9 +03CA;GREEK SMALL LETTER IOTA WITH DIALYTIKA;Ll;0;L;03B9 0308;;;;N;GREEK SMALL LETTER IOTA DIAERESIS;;03AA;;03AA +03CB;GREEK SMALL LETTER UPSILON WITH DIALYTIKA;Ll;0;L;03C5 0308;;;;N;GREEK SMALL LETTER UPSILON DIAERESIS;;03AB;;03AB +03CC;GREEK SMALL LETTER OMICRON WITH TONOS;Ll;0;L;03BF 0301;;;;N;GREEK SMALL LETTER OMICRON TONOS;;038C;;038C +03CD;GREEK SMALL LETTER UPSILON WITH TONOS;Ll;0;L;03C5 0301;;;;N;GREEK SMALL LETTER UPSILON TONOS;;038E;;038E +03CE;GREEK SMALL LETTER OMEGA WITH TONOS;Ll;0;L;03C9 0301;;;;N;GREEK SMALL LETTER OMEGA TONOS;;038F;;038F +03CF;GREEK CAPITAL KAI SYMBOL;Lu;0;L;;;;;N;;;;03D7; +03D0;GREEK BETA SYMBOL;Ll;0;L;<compat> 03B2;;;;N;GREEK SMALL LETTER CURLED BETA;;0392;;0392 +03D1;GREEK THETA SYMBOL;Ll;0;L;<compat> 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398 +03D2;GREEK UPSILON WITH HOOK SYMBOL;Lu;0;L;<compat> 03A5;;;;N;GREEK CAPITAL LETTER UPSILON HOOK;;;; +03D3;GREEK UPSILON WITH ACUTE AND HOOK SYMBOL;Lu;0;L;03D2 0301;;;;N;GREEK CAPITAL LETTER UPSILON HOOK TONOS;;;; +03D4;GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL;Lu;0;L;03D2 0308;;;;N;GREEK CAPITAL LETTER UPSILON HOOK DIAERESIS;;;; +03D5;GREEK PHI SYMBOL;Ll;0;L;<compat> 03C6;;;;N;GREEK SMALL LETTER SCRIPT PHI;;03A6;;03A6 +03D6;GREEK PI SYMBOL;Ll;0;L;<compat> 03C0;;;;N;GREEK SMALL LETTER OMEGA PI;;03A0;;03A0 +03D7;GREEK KAI SYMBOL;Ll;0;L;;;;;N;;;03CF;;03CF +03D8;GREEK LETTER ARCHAIC KOPPA;Lu;0;L;;;;;N;;;;03D9; +03D9;GREEK SMALL LETTER ARCHAIC KOPPA;Ll;0;L;;;;;N;;;03D8;;03D8 +03DA;GREEK LETTER STIGMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER STIGMA;;;03DB; +03DB;GREEK SMALL LETTER STIGMA;Ll;0;L;;;;;N;;;03DA;;03DA +03DC;GREEK LETTER DIGAMMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER DIGAMMA;;;03DD; +03DD;GREEK SMALL LETTER DIGAMMA;Ll;0;L;;;;;N;;;03DC;;03DC +03DE;GREEK LETTER KOPPA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER KOPPA;;;03DF; +03DF;GREEK SMALL LETTER KOPPA;Ll;0;L;;;;;N;;;03DE;;03DE +03E0;GREEK LETTER SAMPI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SAMPI;;;03E1; +03E1;GREEK SMALL LETTER SAMPI;Ll;0;L;;;;;N;;;03E0;;03E0 +03E2;COPTIC CAPITAL LETTER SHEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SHEI;;;03E3; +03E3;COPTIC SMALL LETTER SHEI;Ll;0;L;;;;;N;GREEK SMALL LETTER SHEI;;03E2;;03E2 +03E4;COPTIC CAPITAL LETTER FEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER FEI;;;03E5; +03E5;COPTIC SMALL LETTER FEI;Ll;0;L;;;;;N;GREEK SMALL LETTER FEI;;03E4;;03E4 +03E6;COPTIC CAPITAL LETTER KHEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER KHEI;;;03E7; +03E7;COPTIC SMALL LETTER KHEI;Ll;0;L;;;;;N;GREEK SMALL LETTER KHEI;;03E6;;03E6 +03E8;COPTIC CAPITAL LETTER HORI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER HORI;;;03E9; +03E9;COPTIC SMALL LETTER HORI;Ll;0;L;;;;;N;GREEK SMALL LETTER HORI;;03E8;;03E8 +03EA;COPTIC CAPITAL LETTER GANGIA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER GANGIA;;;03EB; +03EB;COPTIC SMALL LETTER GANGIA;Ll;0;L;;;;;N;GREEK SMALL LETTER GANGIA;;03EA;;03EA +03EC;COPTIC CAPITAL LETTER SHIMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SHIMA;;;03ED; +03ED;COPTIC SMALL LETTER SHIMA;Ll;0;L;;;;;N;GREEK SMALL LETTER SHIMA;;03EC;;03EC +03EE;COPTIC CAPITAL LETTER DEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER DEI;;;03EF; +03EF;COPTIC SMALL LETTER DEI;Ll;0;L;;;;;N;GREEK SMALL LETTER DEI;;03EE;;03EE +03F0;GREEK KAPPA SYMBOL;Ll;0;L;<compat> 03BA;;;;N;GREEK SMALL LETTER SCRIPT KAPPA;;039A;;039A +03F1;GREEK RHO SYMBOL;Ll;0;L;<compat> 03C1;;;;N;GREEK SMALL LETTER TAILED RHO;;03A1;;03A1 +03F2;GREEK LUNATE SIGMA SYMBOL;Ll;0;L;<compat> 03C2;;;;N;GREEK SMALL LETTER LUNATE SIGMA;;03F9;;03F9 +03F3;GREEK LETTER YOT;Ll;0;L;;;;;N;;;037F;;037F +03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L;<compat> 0398;;;;N;;;;03B8; +03F5;GREEK LUNATE EPSILON SYMBOL;Ll;0;L;<compat> 03B5;;;;N;;;0395;;0395 +03F6;GREEK REVERSED LUNATE EPSILON SYMBOL;Sm;0;ON;;;;;N;;;;; +03F7;GREEK CAPITAL LETTER SHO;Lu;0;L;;;;;N;;;;03F8; +03F8;GREEK SMALL LETTER SHO;Ll;0;L;;;;;N;;;03F7;;03F7 +03F9;GREEK CAPITAL LUNATE SIGMA SYMBOL;Lu;0;L;<compat> 03A3;;;;N;;;;03F2; +03FA;GREEK CAPITAL LETTER SAN;Lu;0;L;;;;;N;;;;03FB; +03FB;GREEK SMALL LETTER SAN;Ll;0;L;;;;;N;;;03FA;;03FA +03FC;GREEK RHO WITH STROKE SYMBOL;Ll;0;L;;;;;N;;;;; +03FD;GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL;Lu;0;L;;;;;N;;;;037B; +03FE;GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL;Lu;0;L;;;;;N;;;;037C; +03FF;GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL;Lu;0;L;;;;;N;;;;037D; +0400;CYRILLIC CAPITAL LETTER IE WITH GRAVE;Lu;0;L;0415 0300;;;;N;;;;0450; +0401;CYRILLIC CAPITAL LETTER IO;Lu;0;L;0415 0308;;;;N;;;;0451; +0402;CYRILLIC CAPITAL LETTER DJE;Lu;0;L;;;;;N;;;;0452; +0403;CYRILLIC CAPITAL LETTER GJE;Lu;0;L;0413 0301;;;;N;;;;0453; +0404;CYRILLIC CAPITAL LETTER UKRAINIAN IE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER E;;;0454; +0405;CYRILLIC CAPITAL LETTER DZE;Lu;0;L;;;;;N;;;;0455; +0406;CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER I;;;0456; +0407;CYRILLIC CAPITAL LETTER YI;Lu;0;L;0406 0308;;;;N;;;;0457; +0408;CYRILLIC CAPITAL LETTER JE;Lu;0;L;;;;;N;;;;0458; +0409;CYRILLIC CAPITAL LETTER LJE;Lu;0;L;;;;;N;;;;0459; +040A;CYRILLIC CAPITAL LETTER NJE;Lu;0;L;;;;;N;;;;045A; +040B;CYRILLIC CAPITAL LETTER TSHE;Lu;0;L;;;;;N;;;;045B; +040C;CYRILLIC CAPITAL LETTER KJE;Lu;0;L;041A 0301;;;;N;;;;045C; +040D;CYRILLIC CAPITAL LETTER I WITH GRAVE;Lu;0;L;0418 0300;;;;N;;;;045D; +040E;CYRILLIC CAPITAL LETTER SHORT U;Lu;0;L;0423 0306;;;;N;;;;045E; +040F;CYRILLIC CAPITAL LETTER DZHE;Lu;0;L;;;;;N;;;;045F; +0410;CYRILLIC CAPITAL LETTER A;Lu;0;L;;;;;N;;;;0430; +0411;CYRILLIC CAPITAL LETTER BE;Lu;0;L;;;;;N;;;;0431; +0412;CYRILLIC CAPITAL LETTER VE;Lu;0;L;;;;;N;;;;0432; +0413;CYRILLIC CAPITAL LETTER GHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE;;;0433; +0414;CYRILLIC CAPITAL LETTER DE;Lu;0;L;;;;;N;;;;0434; +0415;CYRILLIC CAPITAL LETTER IE;Lu;0;L;;;;;N;;;;0435; +0416;CYRILLIC CAPITAL LETTER ZHE;Lu;0;L;;;;;N;;;;0436; +0417;CYRILLIC CAPITAL LETTER ZE;Lu;0;L;;;;;N;;;;0437; +0418;CYRILLIC CAPITAL LETTER I;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER II;;;0438; +0419;CYRILLIC CAPITAL LETTER SHORT I;Lu;0;L;0418 0306;;;;N;CYRILLIC CAPITAL LETTER SHORT II;;;0439; +041A;CYRILLIC CAPITAL LETTER KA;Lu;0;L;;;;;N;;;;043A; +041B;CYRILLIC CAPITAL LETTER EL;Lu;0;L;;;;;N;;;;043B; +041C;CYRILLIC CAPITAL LETTER EM;Lu;0;L;;;;;N;;;;043C; +041D;CYRILLIC CAPITAL LETTER EN;Lu;0;L;;;;;N;;;;043D; +041E;CYRILLIC CAPITAL LETTER O;Lu;0;L;;;;;N;;;;043E; +041F;CYRILLIC CAPITAL LETTER PE;Lu;0;L;;;;;N;;;;043F; +0420;CYRILLIC CAPITAL LETTER ER;Lu;0;L;;;;;N;;;;0440; +0421;CYRILLIC CAPITAL LETTER ES;Lu;0;L;;;;;N;;;;0441; +0422;CYRILLIC CAPITAL LETTER TE;Lu;0;L;;;;;N;;;;0442; +0423;CYRILLIC CAPITAL LETTER U;Lu;0;L;;;;;N;;;;0443; +0424;CYRILLIC CAPITAL LETTER EF;Lu;0;L;;;;;N;;;;0444; +0425;CYRILLIC CAPITAL LETTER HA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KHA;;;0445; +0426;CYRILLIC CAPITAL LETTER TSE;Lu;0;L;;;;;N;;;;0446; +0427;CYRILLIC CAPITAL LETTER CHE;Lu;0;L;;;;;N;;;;0447; +0428;CYRILLIC CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;0448; +0429;CYRILLIC CAPITAL LETTER SHCHA;Lu;0;L;;;;;N;;;;0449; +042A;CYRILLIC CAPITAL LETTER HARD SIGN;Lu;0;L;;;;;N;;;;044A; +042B;CYRILLIC CAPITAL LETTER YERU;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER YERI;;;044B; +042C;CYRILLIC CAPITAL LETTER SOFT SIGN;Lu;0;L;;;;;N;;;;044C; +042D;CYRILLIC CAPITAL LETTER E;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER REVERSED E;;;044D; +042E;CYRILLIC CAPITAL LETTER YU;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IU;;;044E; +042F;CYRILLIC CAPITAL LETTER YA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IA;;;044F; +0430;CYRILLIC SMALL LETTER A;Ll;0;L;;;;;N;;;0410;;0410 +0431;CYRILLIC SMALL LETTER BE;Ll;0;L;;;;;N;;;0411;;0411 +0432;CYRILLIC SMALL LETTER VE;Ll;0;L;;;;;N;;;0412;;0412 +0433;CYRILLIC SMALL LETTER GHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE;;0413;;0413 +0434;CYRILLIC SMALL LETTER DE;Ll;0;L;;;;;N;;;0414;;0414 +0435;CYRILLIC SMALL LETTER IE;Ll;0;L;;;;;N;;;0415;;0415 +0436;CYRILLIC SMALL LETTER ZHE;Ll;0;L;;;;;N;;;0416;;0416 +0437;CYRILLIC SMALL LETTER ZE;Ll;0;L;;;;;N;;;0417;;0417 +0438;CYRILLIC SMALL LETTER I;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER II;;0418;;0418 +0439;CYRILLIC SMALL LETTER SHORT I;Ll;0;L;0438 0306;;;;N;CYRILLIC SMALL LETTER SHORT II;;0419;;0419 +043A;CYRILLIC SMALL LETTER KA;Ll;0;L;;;;;N;;;041A;;041A +043B;CYRILLIC SMALL LETTER EL;Ll;0;L;;;;;N;;;041B;;041B +043C;CYRILLIC SMALL LETTER EM;Ll;0;L;;;;;N;;;041C;;041C +043D;CYRILLIC SMALL LETTER EN;Ll;0;L;;;;;N;;;041D;;041D +043E;CYRILLIC SMALL LETTER O;Ll;0;L;;;;;N;;;041E;;041E +043F;CYRILLIC SMALL LETTER PE;Ll;0;L;;;;;N;;;041F;;041F +0440;CYRILLIC SMALL LETTER ER;Ll;0;L;;;;;N;;;0420;;0420 +0441;CYRILLIC SMALL LETTER ES;Ll;0;L;;;;;N;;;0421;;0421 +0442;CYRILLIC SMALL LETTER TE;Ll;0;L;;;;;N;;;0422;;0422 +0443;CYRILLIC SMALL LETTER U;Ll;0;L;;;;;N;;;0423;;0423 +0444;CYRILLIC SMALL LETTER EF;Ll;0;L;;;;;N;;;0424;;0424 +0445;CYRILLIC SMALL LETTER HA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KHA;;0425;;0425 +0446;CYRILLIC SMALL LETTER TSE;Ll;0;L;;;;;N;;;0426;;0426 +0447;CYRILLIC SMALL LETTER CHE;Ll;0;L;;;;;N;;;0427;;0427 +0448;CYRILLIC SMALL LETTER SHA;Ll;0;L;;;;;N;;;0428;;0428 +0449;CYRILLIC SMALL LETTER SHCHA;Ll;0;L;;;;;N;;;0429;;0429 +044A;CYRILLIC SMALL LETTER HARD SIGN;Ll;0;L;;;;;N;;;042A;;042A +044B;CYRILLIC SMALL LETTER YERU;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER YERI;;042B;;042B +044C;CYRILLIC SMALL LETTER SOFT SIGN;Ll;0;L;;;;;N;;;042C;;042C +044D;CYRILLIC SMALL LETTER E;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER REVERSED E;;042D;;042D +044E;CYRILLIC SMALL LETTER YU;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IU;;042E;;042E +044F;CYRILLIC SMALL LETTER YA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IA;;042F;;042F +0450;CYRILLIC SMALL LETTER IE WITH GRAVE;Ll;0;L;0435 0300;;;;N;;;0400;;0400 +0451;CYRILLIC SMALL LETTER IO;Ll;0;L;0435 0308;;;;N;;;0401;;0401 +0452;CYRILLIC SMALL LETTER DJE;Ll;0;L;;;;;N;;;0402;;0402 +0453;CYRILLIC SMALL LETTER GJE;Ll;0;L;0433 0301;;;;N;;;0403;;0403 +0454;CYRILLIC SMALL LETTER UKRAINIAN IE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER E;;0404;;0404 +0455;CYRILLIC SMALL LETTER DZE;Ll;0;L;;;;;N;;;0405;;0405 +0456;CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER I;;0406;;0406 +0457;CYRILLIC SMALL LETTER YI;Ll;0;L;0456 0308;;;;N;;;0407;;0407 +0458;CYRILLIC SMALL LETTER JE;Ll;0;L;;;;;N;;;0408;;0408 +0459;CYRILLIC SMALL LETTER LJE;Ll;0;L;;;;;N;;;0409;;0409 +045A;CYRILLIC SMALL LETTER NJE;Ll;0;L;;;;;N;;;040A;;040A +045B;CYRILLIC SMALL LETTER TSHE;Ll;0;L;;;;;N;;;040B;;040B +045C;CYRILLIC SMALL LETTER KJE;Ll;0;L;043A 0301;;;;N;;;040C;;040C +045D;CYRILLIC SMALL LETTER I WITH GRAVE;Ll;0;L;0438 0300;;;;N;;;040D;;040D +045E;CYRILLIC SMALL LETTER SHORT U;Ll;0;L;0443 0306;;;;N;;;040E;;040E +045F;CYRILLIC SMALL LETTER DZHE;Ll;0;L;;;;;N;;;040F;;040F +0460;CYRILLIC CAPITAL LETTER OMEGA;Lu;0;L;;;;;N;;;;0461; +0461;CYRILLIC SMALL LETTER OMEGA;Ll;0;L;;;;;N;;;0460;;0460 +0462;CYRILLIC CAPITAL LETTER YAT;Lu;0;L;;;;;N;;;;0463; +0463;CYRILLIC SMALL LETTER YAT;Ll;0;L;;;;;N;;;0462;;0462 +0464;CYRILLIC CAPITAL LETTER IOTIFIED E;Lu;0;L;;;;;N;;;;0465; +0465;CYRILLIC SMALL LETTER IOTIFIED E;Ll;0;L;;;;;N;;;0464;;0464 +0466;CYRILLIC CAPITAL LETTER LITTLE YUS;Lu;0;L;;;;;N;;;;0467; +0467;CYRILLIC SMALL LETTER LITTLE YUS;Ll;0;L;;;;;N;;;0466;;0466 +0468;CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS;Lu;0;L;;;;;N;;;;0469; +0469;CYRILLIC SMALL LETTER IOTIFIED LITTLE YUS;Ll;0;L;;;;;N;;;0468;;0468 +046A;CYRILLIC CAPITAL LETTER BIG YUS;Lu;0;L;;;;;N;;;;046B; +046B;CYRILLIC SMALL LETTER BIG YUS;Ll;0;L;;;;;N;;;046A;;046A +046C;CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS;Lu;0;L;;;;;N;;;;046D; +046D;CYRILLIC SMALL LETTER IOTIFIED BIG YUS;Ll;0;L;;;;;N;;;046C;;046C +046E;CYRILLIC CAPITAL LETTER KSI;Lu;0;L;;;;;N;;;;046F; +046F;CYRILLIC SMALL LETTER KSI;Ll;0;L;;;;;N;;;046E;;046E +0470;CYRILLIC CAPITAL LETTER PSI;Lu;0;L;;;;;N;;;;0471; +0471;CYRILLIC SMALL LETTER PSI;Ll;0;L;;;;;N;;;0470;;0470 +0472;CYRILLIC CAPITAL LETTER FITA;Lu;0;L;;;;;N;;;;0473; +0473;CYRILLIC SMALL LETTER FITA;Ll;0;L;;;;;N;;;0472;;0472 +0474;CYRILLIC CAPITAL LETTER IZHITSA;Lu;0;L;;;;;N;;;;0475; +0475;CYRILLIC SMALL LETTER IZHITSA;Ll;0;L;;;;;N;;;0474;;0474 +0476;CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT;Lu;0;L;0474 030F;;;;N;CYRILLIC CAPITAL LETTER IZHITSA DOUBLE GRAVE;;;0477; +0477;CYRILLIC SMALL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT;Ll;0;L;0475 030F;;;;N;CYRILLIC SMALL LETTER IZHITSA DOUBLE GRAVE;;0476;;0476 +0478;CYRILLIC CAPITAL LETTER UK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER UK DIGRAPH;;;0479; +0479;CYRILLIC SMALL LETTER UK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER UK DIGRAPH;;0478;;0478 +047A;CYRILLIC CAPITAL LETTER ROUND OMEGA;Lu;0;L;;;;;N;;;;047B; +047B;CYRILLIC SMALL LETTER ROUND OMEGA;Ll;0;L;;;;;N;;;047A;;047A +047C;CYRILLIC CAPITAL LETTER OMEGA WITH TITLO;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER OMEGA TITLO;;;047D; +047D;CYRILLIC SMALL LETTER OMEGA WITH TITLO;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER OMEGA TITLO;;047C;;047C +047E;CYRILLIC CAPITAL LETTER OT;Lu;0;L;;;;;N;;;;047F; +047F;CYRILLIC SMALL LETTER OT;Ll;0;L;;;;;N;;;047E;;047E +0480;CYRILLIC CAPITAL LETTER KOPPA;Lu;0;L;;;;;N;;;;0481; +0481;CYRILLIC SMALL LETTER KOPPA;Ll;0;L;;;;;N;;;0480;;0480 +0482;CYRILLIC THOUSANDS SIGN;So;0;L;;;;;N;;;;; +0483;COMBINING CYRILLIC TITLO;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING TITLO;;;; +0484;COMBINING CYRILLIC PALATALIZATION;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING PALATALIZATION;;;; +0485;COMBINING CYRILLIC DASIA PNEUMATA;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING DASIA PNEUMATA;;;; +0486;COMBINING CYRILLIC PSILI PNEUMATA;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING PSILI PNEUMATA;;;; +0487;COMBINING CYRILLIC POKRYTIE;Mn;230;NSM;;;;;N;;;;; +0488;COMBINING CYRILLIC HUNDRED THOUSANDS SIGN;Me;0;NSM;;;;;N;;;;; +0489;COMBINING CYRILLIC MILLIONS SIGN;Me;0;NSM;;;;;N;;;;; +048A;CYRILLIC CAPITAL LETTER SHORT I WITH TAIL;Lu;0;L;;;;;N;;;;048B; +048B;CYRILLIC SMALL LETTER SHORT I WITH TAIL;Ll;0;L;;;;;N;;;048A;;048A +048C;CYRILLIC CAPITAL LETTER SEMISOFT SIGN;Lu;0;L;;;;;N;;;;048D; +048D;CYRILLIC SMALL LETTER SEMISOFT SIGN;Ll;0;L;;;;;N;;;048C;;048C +048E;CYRILLIC CAPITAL LETTER ER WITH TICK;Lu;0;L;;;;;N;;;;048F; +048F;CYRILLIC SMALL LETTER ER WITH TICK;Ll;0;L;;;;;N;;;048E;;048E +0490;CYRILLIC CAPITAL LETTER GHE WITH UPTURN;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE WITH UPTURN;;;0491; +0491;CYRILLIC SMALL LETTER GHE WITH UPTURN;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE WITH UPTURN;;0490;;0490 +0492;CYRILLIC CAPITAL LETTER GHE WITH STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE BAR;;;0493; +0493;CYRILLIC SMALL LETTER GHE WITH STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE BAR;;0492;;0492 +0494;CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE HOOK;;;0495; +0495;CYRILLIC SMALL LETTER GHE WITH MIDDLE HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE HOOK;;0494;;0494 +0496;CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER ZHE WITH RIGHT DESCENDER;;;0497; +0497;CYRILLIC SMALL LETTER ZHE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER ZHE WITH RIGHT DESCENDER;;0496;;0496 +0498;CYRILLIC CAPITAL LETTER ZE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER ZE CEDILLA;;;0499; +0499;CYRILLIC SMALL LETTER ZE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER ZE CEDILLA;;0498;;0498 +049A;CYRILLIC CAPITAL LETTER KA WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA WITH RIGHT DESCENDER;;;049B; +049B;CYRILLIC SMALL LETTER KA WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA WITH RIGHT DESCENDER;;049A;;049A +049C;CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA VERTICAL BAR;;;049D; +049D;CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA VERTICAL BAR;;049C;;049C +049E;CYRILLIC CAPITAL LETTER KA WITH STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA BAR;;;049F; +049F;CYRILLIC SMALL LETTER KA WITH STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA BAR;;049E;;049E +04A0;CYRILLIC CAPITAL LETTER BASHKIR KA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER REVERSED GE KA;;;04A1; +04A1;CYRILLIC SMALL LETTER BASHKIR KA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER REVERSED GE KA;;04A0;;04A0 +04A2;CYRILLIC CAPITAL LETTER EN WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER EN WITH RIGHT DESCENDER;;;04A3; +04A3;CYRILLIC SMALL LETTER EN WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER EN WITH RIGHT DESCENDER;;04A2;;04A2 +04A4;CYRILLIC CAPITAL LIGATURE EN GHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER EN GE;;;04A5; +04A5;CYRILLIC SMALL LIGATURE EN GHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER EN GE;;04A4;;04A4 +04A6;CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER PE HOOK;;;04A7; +04A7;CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER PE HOOK;;04A6;;04A6 +04A8;CYRILLIC CAPITAL LETTER ABKHASIAN HA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER O HOOK;;;04A9; +04A9;CYRILLIC SMALL LETTER ABKHASIAN HA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER O HOOK;;04A8;;04A8 +04AA;CYRILLIC CAPITAL LETTER ES WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER ES CEDILLA;;;04AB; +04AB;CYRILLIC SMALL LETTER ES WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER ES CEDILLA;;04AA;;04AA +04AC;CYRILLIC CAPITAL LETTER TE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER TE WITH RIGHT DESCENDER;;;04AD; +04AD;CYRILLIC SMALL LETTER TE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER TE WITH RIGHT DESCENDER;;04AC;;04AC +04AE;CYRILLIC CAPITAL LETTER STRAIGHT U;Lu;0;L;;;;;N;;;;04AF; +04AF;CYRILLIC SMALL LETTER STRAIGHT U;Ll;0;L;;;;;N;;;04AE;;04AE +04B0;CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER STRAIGHT U BAR;;;04B1; +04B1;CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER STRAIGHT U BAR;;04B0;;04B0 +04B2;CYRILLIC CAPITAL LETTER HA WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KHA WITH RIGHT DESCENDER;;;04B3; +04B3;CYRILLIC SMALL LETTER HA WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KHA WITH RIGHT DESCENDER;;04B2;;04B2 +04B4;CYRILLIC CAPITAL LIGATURE TE TSE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER TE TSE;;;04B5; +04B5;CYRILLIC SMALL LIGATURE TE TSE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER TE TSE;;04B4;;04B4 +04B6;CYRILLIC CAPITAL LETTER CHE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER CHE WITH RIGHT DESCENDER;;;04B7; +04B7;CYRILLIC SMALL LETTER CHE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER CHE WITH RIGHT DESCENDER;;04B6;;04B6 +04B8;CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER CHE VERTICAL BAR;;;04B9; +04B9;CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER CHE VERTICAL BAR;;04B8;;04B8 +04BA;CYRILLIC CAPITAL LETTER SHHA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER H;;;04BB; +04BB;CYRILLIC SMALL LETTER SHHA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER H;;04BA;;04BA +04BC;CYRILLIC CAPITAL LETTER ABKHASIAN CHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IE HOOK;;;04BD; +04BD;CYRILLIC SMALL LETTER ABKHASIAN CHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IE HOOK;;04BC;;04BC +04BE;CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IE HOOK OGONEK;;;04BF; +04BF;CYRILLIC SMALL LETTER ABKHASIAN CHE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IE HOOK OGONEK;;04BE;;04BE +04C0;CYRILLIC LETTER PALOCHKA;Lu;0;L;;;;;N;CYRILLIC LETTER I;;;04CF; +04C1;CYRILLIC CAPITAL LETTER ZHE WITH BREVE;Lu;0;L;0416 0306;;;;N;CYRILLIC CAPITAL LETTER SHORT ZHE;;;04C2; +04C2;CYRILLIC SMALL LETTER ZHE WITH BREVE;Ll;0;L;0436 0306;;;;N;CYRILLIC SMALL LETTER SHORT ZHE;;04C1;;04C1 +04C3;CYRILLIC CAPITAL LETTER KA WITH HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA HOOK;;;04C4; +04C4;CYRILLIC SMALL LETTER KA WITH HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA HOOK;;04C3;;04C3 +04C5;CYRILLIC CAPITAL LETTER EL WITH TAIL;Lu;0;L;;;;;N;;;;04C6; +04C6;CYRILLIC SMALL LETTER EL WITH TAIL;Ll;0;L;;;;;N;;;04C5;;04C5 +04C7;CYRILLIC CAPITAL LETTER EN WITH HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER EN HOOK;;;04C8; +04C8;CYRILLIC SMALL LETTER EN WITH HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER EN HOOK;;04C7;;04C7 +04C9;CYRILLIC CAPITAL LETTER EN WITH TAIL;Lu;0;L;;;;;N;;;;04CA; +04CA;CYRILLIC SMALL LETTER EN WITH TAIL;Ll;0;L;;;;;N;;;04C9;;04C9 +04CB;CYRILLIC CAPITAL LETTER KHAKASSIAN CHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER CHE WITH LEFT DESCENDER;;;04CC; +04CC;CYRILLIC SMALL LETTER KHAKASSIAN CHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER CHE WITH LEFT DESCENDER;;04CB;;04CB +04CD;CYRILLIC CAPITAL LETTER EM WITH TAIL;Lu;0;L;;;;;N;;;;04CE; +04CE;CYRILLIC SMALL LETTER EM WITH TAIL;Ll;0;L;;;;;N;;;04CD;;04CD +04CF;CYRILLIC SMALL LETTER PALOCHKA;Ll;0;L;;;;;N;;;04C0;;04C0 +04D0;CYRILLIC CAPITAL LETTER A WITH BREVE;Lu;0;L;0410 0306;;;;N;;;;04D1; +04D1;CYRILLIC SMALL LETTER A WITH BREVE;Ll;0;L;0430 0306;;;;N;;;04D0;;04D0 +04D2;CYRILLIC CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0410 0308;;;;N;;;;04D3; +04D3;CYRILLIC SMALL LETTER A WITH DIAERESIS;Ll;0;L;0430 0308;;;;N;;;04D2;;04D2 +04D4;CYRILLIC CAPITAL LIGATURE A IE;Lu;0;L;;;;;N;;;;04D5; +04D5;CYRILLIC SMALL LIGATURE A IE;Ll;0;L;;;;;N;;;04D4;;04D4 +04D6;CYRILLIC CAPITAL LETTER IE WITH BREVE;Lu;0;L;0415 0306;;;;N;;;;04D7; +04D7;CYRILLIC SMALL LETTER IE WITH BREVE;Ll;0;L;0435 0306;;;;N;;;04D6;;04D6 +04D8;CYRILLIC CAPITAL LETTER SCHWA;Lu;0;L;;;;;N;;;;04D9; +04D9;CYRILLIC SMALL LETTER SCHWA;Ll;0;L;;;;;N;;;04D8;;04D8 +04DA;CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS;Lu;0;L;04D8 0308;;;;N;;;;04DB; +04DB;CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS;Ll;0;L;04D9 0308;;;;N;;;04DA;;04DA +04DC;CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS;Lu;0;L;0416 0308;;;;N;;;;04DD; +04DD;CYRILLIC SMALL LETTER ZHE WITH DIAERESIS;Ll;0;L;0436 0308;;;;N;;;04DC;;04DC +04DE;CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS;Lu;0;L;0417 0308;;;;N;;;;04DF; +04DF;CYRILLIC SMALL LETTER ZE WITH DIAERESIS;Ll;0;L;0437 0308;;;;N;;;04DE;;04DE +04E0;CYRILLIC CAPITAL LETTER ABKHASIAN DZE;Lu;0;L;;;;;N;;;;04E1; +04E1;CYRILLIC SMALL LETTER ABKHASIAN DZE;Ll;0;L;;;;;N;;;04E0;;04E0 +04E2;CYRILLIC CAPITAL LETTER I WITH MACRON;Lu;0;L;0418 0304;;;;N;;;;04E3; +04E3;CYRILLIC SMALL LETTER I WITH MACRON;Ll;0;L;0438 0304;;;;N;;;04E2;;04E2 +04E4;CYRILLIC CAPITAL LETTER I WITH DIAERESIS;Lu;0;L;0418 0308;;;;N;;;;04E5; +04E5;CYRILLIC SMALL LETTER I WITH DIAERESIS;Ll;0;L;0438 0308;;;;N;;;04E4;;04E4 +04E6;CYRILLIC CAPITAL LETTER O WITH DIAERESIS;Lu;0;L;041E 0308;;;;N;;;;04E7; +04E7;CYRILLIC SMALL LETTER O WITH DIAERESIS;Ll;0;L;043E 0308;;;;N;;;04E6;;04E6 +04E8;CYRILLIC CAPITAL LETTER BARRED O;Lu;0;L;;;;;N;;;;04E9; +04E9;CYRILLIC SMALL LETTER BARRED O;Ll;0;L;;;;;N;;;04E8;;04E8 +04EA;CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS;Lu;0;L;04E8 0308;;;;N;;;;04EB; +04EB;CYRILLIC SMALL LETTER BARRED O WITH DIAERESIS;Ll;0;L;04E9 0308;;;;N;;;04EA;;04EA +04EC;CYRILLIC CAPITAL LETTER E WITH DIAERESIS;Lu;0;L;042D 0308;;;;N;;;;04ED; +04ED;CYRILLIC SMALL LETTER E WITH DIAERESIS;Ll;0;L;044D 0308;;;;N;;;04EC;;04EC +04EE;CYRILLIC CAPITAL LETTER U WITH MACRON;Lu;0;L;0423 0304;;;;N;;;;04EF; +04EF;CYRILLIC SMALL LETTER U WITH MACRON;Ll;0;L;0443 0304;;;;N;;;04EE;;04EE +04F0;CYRILLIC CAPITAL LETTER U WITH DIAERESIS;Lu;0;L;0423 0308;;;;N;;;;04F1; +04F1;CYRILLIC SMALL LETTER U WITH DIAERESIS;Ll;0;L;0443 0308;;;;N;;;04F0;;04F0 +04F2;CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE;Lu;0;L;0423 030B;;;;N;;;;04F3; +04F3;CYRILLIC SMALL LETTER U WITH DOUBLE ACUTE;Ll;0;L;0443 030B;;;;N;;;04F2;;04F2 +04F4;CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS;Lu;0;L;0427 0308;;;;N;;;;04F5; +04F5;CYRILLIC SMALL LETTER CHE WITH DIAERESIS;Ll;0;L;0447 0308;;;;N;;;04F4;;04F4 +04F6;CYRILLIC CAPITAL LETTER GHE WITH DESCENDER;Lu;0;L;;;;;N;;;;04F7; +04F7;CYRILLIC SMALL LETTER GHE WITH DESCENDER;Ll;0;L;;;;;N;;;04F6;;04F6 +04F8;CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS;Lu;0;L;042B 0308;;;;N;;;;04F9; +04F9;CYRILLIC SMALL LETTER YERU WITH DIAERESIS;Ll;0;L;044B 0308;;;;N;;;04F8;;04F8 +04FA;CYRILLIC CAPITAL LETTER GHE WITH STROKE AND HOOK;Lu;0;L;;;;;N;;;;04FB; +04FB;CYRILLIC SMALL LETTER GHE WITH STROKE AND HOOK;Ll;0;L;;;;;N;;;04FA;;04FA +04FC;CYRILLIC CAPITAL LETTER HA WITH HOOK;Lu;0;L;;;;;N;;;;04FD; +04FD;CYRILLIC SMALL LETTER HA WITH HOOK;Ll;0;L;;;;;N;;;04FC;;04FC +04FE;CYRILLIC CAPITAL LETTER HA WITH STROKE;Lu;0;L;;;;;N;;;;04FF; +04FF;CYRILLIC SMALL LETTER HA WITH STROKE;Ll;0;L;;;;;N;;;04FE;;04FE +0500;CYRILLIC CAPITAL LETTER KOMI DE;Lu;0;L;;;;;N;;;;0501; +0501;CYRILLIC SMALL LETTER KOMI DE;Ll;0;L;;;;;N;;;0500;;0500 +0502;CYRILLIC CAPITAL LETTER KOMI DJE;Lu;0;L;;;;;N;;;;0503; +0503;CYRILLIC SMALL LETTER KOMI DJE;Ll;0;L;;;;;N;;;0502;;0502 +0504;CYRILLIC CAPITAL LETTER KOMI ZJE;Lu;0;L;;;;;N;;;;0505; +0505;CYRILLIC SMALL LETTER KOMI ZJE;Ll;0;L;;;;;N;;;0504;;0504 +0506;CYRILLIC CAPITAL LETTER KOMI DZJE;Lu;0;L;;;;;N;;;;0507; +0507;CYRILLIC SMALL LETTER KOMI DZJE;Ll;0;L;;;;;N;;;0506;;0506 +0508;CYRILLIC CAPITAL LETTER KOMI LJE;Lu;0;L;;;;;N;;;;0509; +0509;CYRILLIC SMALL LETTER KOMI LJE;Ll;0;L;;;;;N;;;0508;;0508 +050A;CYRILLIC CAPITAL LETTER KOMI NJE;Lu;0;L;;;;;N;;;;050B; +050B;CYRILLIC SMALL LETTER KOMI NJE;Ll;0;L;;;;;N;;;050A;;050A +050C;CYRILLIC CAPITAL LETTER KOMI SJE;Lu;0;L;;;;;N;;;;050D; +050D;CYRILLIC SMALL LETTER KOMI SJE;Ll;0;L;;;;;N;;;050C;;050C +050E;CYRILLIC CAPITAL LETTER KOMI TJE;Lu;0;L;;;;;N;;;;050F; +050F;CYRILLIC SMALL LETTER KOMI TJE;Ll;0;L;;;;;N;;;050E;;050E +0510;CYRILLIC CAPITAL LETTER REVERSED ZE;Lu;0;L;;;;;N;;;;0511; +0511;CYRILLIC SMALL LETTER REVERSED ZE;Ll;0;L;;;;;N;;;0510;;0510 +0512;CYRILLIC CAPITAL LETTER EL WITH HOOK;Lu;0;L;;;;;N;;;;0513; +0513;CYRILLIC SMALL LETTER EL WITH HOOK;Ll;0;L;;;;;N;;;0512;;0512 +0514;CYRILLIC CAPITAL LETTER LHA;Lu;0;L;;;;;N;;;;0515; +0515;CYRILLIC SMALL LETTER LHA;Ll;0;L;;;;;N;;;0514;;0514 +0516;CYRILLIC CAPITAL LETTER RHA;Lu;0;L;;;;;N;;;;0517; +0517;CYRILLIC SMALL LETTER RHA;Ll;0;L;;;;;N;;;0516;;0516 +0518;CYRILLIC CAPITAL LETTER YAE;Lu;0;L;;;;;N;;;;0519; +0519;CYRILLIC SMALL LETTER YAE;Ll;0;L;;;;;N;;;0518;;0518 +051A;CYRILLIC CAPITAL LETTER QA;Lu;0;L;;;;;N;;;;051B; +051B;CYRILLIC SMALL LETTER QA;Ll;0;L;;;;;N;;;051A;;051A +051C;CYRILLIC CAPITAL LETTER WE;Lu;0;L;;;;;N;;;;051D; +051D;CYRILLIC SMALL LETTER WE;Ll;0;L;;;;;N;;;051C;;051C +051E;CYRILLIC CAPITAL LETTER ALEUT KA;Lu;0;L;;;;;N;;;;051F; +051F;CYRILLIC SMALL LETTER ALEUT KA;Ll;0;L;;;;;N;;;051E;;051E +0520;CYRILLIC CAPITAL LETTER EL WITH MIDDLE HOOK;Lu;0;L;;;;;N;;;;0521; +0521;CYRILLIC SMALL LETTER EL WITH MIDDLE HOOK;Ll;0;L;;;;;N;;;0520;;0520 +0522;CYRILLIC CAPITAL LETTER EN WITH MIDDLE HOOK;Lu;0;L;;;;;N;;;;0523; +0523;CYRILLIC SMALL LETTER EN WITH MIDDLE HOOK;Ll;0;L;;;;;N;;;0522;;0522 +0524;CYRILLIC CAPITAL LETTER PE WITH DESCENDER;Lu;0;L;;;;;N;;;;0525; +0525;CYRILLIC SMALL LETTER PE WITH DESCENDER;Ll;0;L;;;;;N;;;0524;;0524 +0526;CYRILLIC CAPITAL LETTER SHHA WITH DESCENDER;Lu;0;L;;;;;N;;;;0527; +0527;CYRILLIC SMALL LETTER SHHA WITH DESCENDER;Ll;0;L;;;;;N;;;0526;;0526 +0528;CYRILLIC CAPITAL LETTER EN WITH LEFT HOOK;Lu;0;L;;;;;N;;;;0529; +0529;CYRILLIC SMALL LETTER EN WITH LEFT HOOK;Ll;0;L;;;;;N;;;0528;;0528 +052A;CYRILLIC CAPITAL LETTER DZZHE;Lu;0;L;;;;;N;;;;052B; +052B;CYRILLIC SMALL LETTER DZZHE;Ll;0;L;;;;;N;;;052A;;052A +052C;CYRILLIC CAPITAL LETTER DCHE;Lu;0;L;;;;;N;;;;052D; +052D;CYRILLIC SMALL LETTER DCHE;Ll;0;L;;;;;N;;;052C;;052C +052E;CYRILLIC CAPITAL LETTER EL WITH DESCENDER;Lu;0;L;;;;;N;;;;052F; +052F;CYRILLIC SMALL LETTER EL WITH DESCENDER;Ll;0;L;;;;;N;;;052E;;052E +0531;ARMENIAN CAPITAL LETTER AYB;Lu;0;L;;;;;N;;;;0561; +0532;ARMENIAN CAPITAL LETTER BEN;Lu;0;L;;;;;N;;;;0562; +0533;ARMENIAN CAPITAL LETTER GIM;Lu;0;L;;;;;N;;;;0563; +0534;ARMENIAN CAPITAL LETTER DA;Lu;0;L;;;;;N;;;;0564; +0535;ARMENIAN CAPITAL LETTER ECH;Lu;0;L;;;;;N;;;;0565; +0536;ARMENIAN CAPITAL LETTER ZA;Lu;0;L;;;;;N;;;;0566; +0537;ARMENIAN CAPITAL LETTER EH;Lu;0;L;;;;;N;;;;0567; +0538;ARMENIAN CAPITAL LETTER ET;Lu;0;L;;;;;N;;;;0568; +0539;ARMENIAN CAPITAL LETTER TO;Lu;0;L;;;;;N;;;;0569; +053A;ARMENIAN CAPITAL LETTER ZHE;Lu;0;L;;;;;N;;;;056A; +053B;ARMENIAN CAPITAL LETTER INI;Lu;0;L;;;;;N;;;;056B; +053C;ARMENIAN CAPITAL LETTER LIWN;Lu;0;L;;;;;N;;;;056C; +053D;ARMENIAN CAPITAL LETTER XEH;Lu;0;L;;;;;N;;;;056D; +053E;ARMENIAN CAPITAL LETTER CA;Lu;0;L;;;;;N;;;;056E; +053F;ARMENIAN CAPITAL LETTER KEN;Lu;0;L;;;;;N;;;;056F; +0540;ARMENIAN CAPITAL LETTER HO;Lu;0;L;;;;;N;;;;0570; +0541;ARMENIAN CAPITAL LETTER JA;Lu;0;L;;;;;N;;;;0571; +0542;ARMENIAN CAPITAL LETTER GHAD;Lu;0;L;;;;;N;ARMENIAN CAPITAL LETTER LAD;;;0572; +0543;ARMENIAN CAPITAL LETTER CHEH;Lu;0;L;;;;;N;;;;0573; +0544;ARMENIAN CAPITAL LETTER MEN;Lu;0;L;;;;;N;;;;0574; +0545;ARMENIAN CAPITAL LETTER YI;Lu;0;L;;;;;N;;;;0575; +0546;ARMENIAN CAPITAL LETTER NOW;Lu;0;L;;;;;N;;;;0576; +0547;ARMENIAN CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;0577; +0548;ARMENIAN CAPITAL LETTER VO;Lu;0;L;;;;;N;;;;0578; +0549;ARMENIAN CAPITAL LETTER CHA;Lu;0;L;;;;;N;;;;0579; +054A;ARMENIAN CAPITAL LETTER PEH;Lu;0;L;;;;;N;;;;057A; +054B;ARMENIAN CAPITAL LETTER JHEH;Lu;0;L;;;;;N;;;;057B; +054C;ARMENIAN CAPITAL LETTER RA;Lu;0;L;;;;;N;;;;057C; +054D;ARMENIAN CAPITAL LETTER SEH;Lu;0;L;;;;;N;;;;057D; +054E;ARMENIAN CAPITAL LETTER VEW;Lu;0;L;;;;;N;;;;057E; +054F;ARMENIAN CAPITAL LETTER TIWN;Lu;0;L;;;;;N;;;;057F; +0550;ARMENIAN CAPITAL LETTER REH;Lu;0;L;;;;;N;;;;0580; +0551;ARMENIAN CAPITAL LETTER CO;Lu;0;L;;;;;N;;;;0581; +0552;ARMENIAN CAPITAL LETTER YIWN;Lu;0;L;;;;;N;;;;0582; +0553;ARMENIAN CAPITAL LETTER PIWR;Lu;0;L;;;;;N;;;;0583; +0554;ARMENIAN CAPITAL LETTER KEH;Lu;0;L;;;;;N;;;;0584; +0555;ARMENIAN CAPITAL LETTER OH;Lu;0;L;;;;;N;;;;0585; +0556;ARMENIAN CAPITAL LETTER FEH;Lu;0;L;;;;;N;;;;0586; +0559;ARMENIAN MODIFIER LETTER LEFT HALF RING;Lm;0;L;;;;;N;;;;; +055A;ARMENIAN APOSTROPHE;Po;0;L;;;;;N;ARMENIAN MODIFIER LETTER RIGHT HALF RING;;;; +055B;ARMENIAN EMPHASIS MARK;Po;0;L;;;;;N;;;;; +055C;ARMENIAN EXCLAMATION MARK;Po;0;L;;;;;N;;;;; +055D;ARMENIAN COMMA;Po;0;L;;;;;N;;;;; +055E;ARMENIAN QUESTION MARK;Po;0;L;;;;;N;;;;; +055F;ARMENIAN ABBREVIATION MARK;Po;0;L;;;;;N;;;;; +0561;ARMENIAN SMALL LETTER AYB;Ll;0;L;;;;;N;;;0531;;0531 +0562;ARMENIAN SMALL LETTER BEN;Ll;0;L;;;;;N;;;0532;;0532 +0563;ARMENIAN SMALL LETTER GIM;Ll;0;L;;;;;N;;;0533;;0533 +0564;ARMENIAN SMALL LETTER DA;Ll;0;L;;;;;N;;;0534;;0534 +0565;ARMENIAN SMALL LETTER ECH;Ll;0;L;;;;;N;;;0535;;0535 +0566;ARMENIAN SMALL LETTER ZA;Ll;0;L;;;;;N;;;0536;;0536 +0567;ARMENIAN SMALL LETTER EH;Ll;0;L;;;;;N;;;0537;;0537 +0568;ARMENIAN SMALL LETTER ET;Ll;0;L;;;;;N;;;0538;;0538 +0569;ARMENIAN SMALL LETTER TO;Ll;0;L;;;;;N;;;0539;;0539 +056A;ARMENIAN SMALL LETTER ZHE;Ll;0;L;;;;;N;;;053A;;053A +056B;ARMENIAN SMALL LETTER INI;Ll;0;L;;;;;N;;;053B;;053B +056C;ARMENIAN SMALL LETTER LIWN;Ll;0;L;;;;;N;;;053C;;053C +056D;ARMENIAN SMALL LETTER XEH;Ll;0;L;;;;;N;;;053D;;053D +056E;ARMENIAN SMALL LETTER CA;Ll;0;L;;;;;N;;;053E;;053E +056F;ARMENIAN SMALL LETTER KEN;Ll;0;L;;;;;N;;;053F;;053F +0570;ARMENIAN SMALL LETTER HO;Ll;0;L;;;;;N;;;0540;;0540 +0571;ARMENIAN SMALL LETTER JA;Ll;0;L;;;;;N;;;0541;;0541 +0572;ARMENIAN SMALL LETTER GHAD;Ll;0;L;;;;;N;ARMENIAN SMALL LETTER LAD;;0542;;0542 +0573;ARMENIAN SMALL LETTER CHEH;Ll;0;L;;;;;N;;;0543;;0543 +0574;ARMENIAN SMALL LETTER MEN;Ll;0;L;;;;;N;;;0544;;0544 +0575;ARMENIAN SMALL LETTER YI;Ll;0;L;;;;;N;;;0545;;0545 +0576;ARMENIAN SMALL LETTER NOW;Ll;0;L;;;;;N;;;0546;;0546 +0577;ARMENIAN SMALL LETTER SHA;Ll;0;L;;;;;N;;;0547;;0547 +0578;ARMENIAN SMALL LETTER VO;Ll;0;L;;;;;N;;;0548;;0548 +0579;ARMENIAN SMALL LETTER CHA;Ll;0;L;;;;;N;;;0549;;0549 +057A;ARMENIAN SMALL LETTER PEH;Ll;0;L;;;;;N;;;054A;;054A +057B;ARMENIAN SMALL LETTER JHEH;Ll;0;L;;;;;N;;;054B;;054B +057C;ARMENIAN SMALL LETTER RA;Ll;0;L;;;;;N;;;054C;;054C +057D;ARMENIAN SMALL LETTER SEH;Ll;0;L;;;;;N;;;054D;;054D +057E;ARMENIAN SMALL LETTER VEW;Ll;0;L;;;;;N;;;054E;;054E +057F;ARMENIAN SMALL LETTER TIWN;Ll;0;L;;;;;N;;;054F;;054F +0580;ARMENIAN SMALL LETTER REH;Ll;0;L;;;;;N;;;0550;;0550 +0581;ARMENIAN SMALL LETTER CO;Ll;0;L;;;;;N;;;0551;;0551 +0582;ARMENIAN SMALL LETTER YIWN;Ll;0;L;;;;;N;;;0552;;0552 +0583;ARMENIAN SMALL LETTER PIWR;Ll;0;L;;;;;N;;;0553;;0553 +0584;ARMENIAN SMALL LETTER KEH;Ll;0;L;;;;;N;;;0554;;0554 +0585;ARMENIAN SMALL LETTER OH;Ll;0;L;;;;;N;;;0555;;0555 +0586;ARMENIAN SMALL LETTER FEH;Ll;0;L;;;;;N;;;0556;;0556 +0587;ARMENIAN SMALL LIGATURE ECH YIWN;Ll;0;L;<compat> 0565 0582;;;;N;;;;; +0589;ARMENIAN FULL STOP;Po;0;L;;;;;N;ARMENIAN PERIOD;;;; +058A;ARMENIAN HYPHEN;Pd;0;ON;;;;;N;;;;; +058D;RIGHT-FACING ARMENIAN ETERNITY SIGN;So;0;ON;;;;;N;;;;; +058E;LEFT-FACING ARMENIAN ETERNITY SIGN;So;0;ON;;;;;N;;;;; +058F;ARMENIAN DRAM SIGN;Sc;0;ET;;;;;N;;;;; +0591;HEBREW ACCENT ETNAHTA;Mn;220;NSM;;;;;N;;;;; +0592;HEBREW ACCENT SEGOL;Mn;230;NSM;;;;;N;;;;; +0593;HEBREW ACCENT SHALSHELET;Mn;230;NSM;;;;;N;;;;; +0594;HEBREW ACCENT ZAQEF QATAN;Mn;230;NSM;;;;;N;;;;; +0595;HEBREW ACCENT ZAQEF GADOL;Mn;230;NSM;;;;;N;;;;; +0596;HEBREW ACCENT TIPEHA;Mn;220;NSM;;;;;N;;;;; +0597;HEBREW ACCENT REVIA;Mn;230;NSM;;;;;N;;;;; +0598;HEBREW ACCENT ZARQA;Mn;230;NSM;;;;;N;;;;; +0599;HEBREW ACCENT PASHTA;Mn;230;NSM;;;;;N;;;;; +059A;HEBREW ACCENT YETIV;Mn;222;NSM;;;;;N;;;;; +059B;HEBREW ACCENT TEVIR;Mn;220;NSM;;;;;N;;;;; +059C;HEBREW ACCENT GERESH;Mn;230;NSM;;;;;N;;;;; +059D;HEBREW ACCENT GERESH MUQDAM;Mn;230;NSM;;;;;N;;;;; +059E;HEBREW ACCENT GERSHAYIM;Mn;230;NSM;;;;;N;;;;; +059F;HEBREW ACCENT QARNEY PARA;Mn;230;NSM;;;;;N;;;;; +05A0;HEBREW ACCENT TELISHA GEDOLA;Mn;230;NSM;;;;;N;;;;; +05A1;HEBREW ACCENT PAZER;Mn;230;NSM;;;;;N;;;;; +05A2;HEBREW ACCENT ATNAH HAFUKH;Mn;220;NSM;;;;;N;;;;; +05A3;HEBREW ACCENT MUNAH;Mn;220;NSM;;;;;N;;;;; +05A4;HEBREW ACCENT MAHAPAKH;Mn;220;NSM;;;;;N;;;;; +05A5;HEBREW ACCENT MERKHA;Mn;220;NSM;;;;;N;;;;; +05A6;HEBREW ACCENT MERKHA KEFULA;Mn;220;NSM;;;;;N;;;;; +05A7;HEBREW ACCENT DARGA;Mn;220;NSM;;;;;N;;;;; +05A8;HEBREW ACCENT QADMA;Mn;230;NSM;;;;;N;;;;; +05A9;HEBREW ACCENT TELISHA QETANA;Mn;230;NSM;;;;;N;;;;; +05AA;HEBREW ACCENT YERAH BEN YOMO;Mn;220;NSM;;;;;N;;;;; +05AB;HEBREW ACCENT OLE;Mn;230;NSM;;;;;N;;;;; +05AC;HEBREW ACCENT ILUY;Mn;230;NSM;;;;;N;;;;; +05AD;HEBREW ACCENT DEHI;Mn;222;NSM;;;;;N;;;;; +05AE;HEBREW ACCENT ZINOR;Mn;228;NSM;;;;;N;;;;; +05AF;HEBREW MARK MASORA CIRCLE;Mn;230;NSM;;;;;N;;;;; +05B0;HEBREW POINT SHEVA;Mn;10;NSM;;;;;N;;;;; +05B1;HEBREW POINT HATAF SEGOL;Mn;11;NSM;;;;;N;;;;; +05B2;HEBREW POINT HATAF PATAH;Mn;12;NSM;;;;;N;;;;; +05B3;HEBREW POINT HATAF QAMATS;Mn;13;NSM;;;;;N;;;;; +05B4;HEBREW POINT HIRIQ;Mn;14;NSM;;;;;N;;;;; +05B5;HEBREW POINT TSERE;Mn;15;NSM;;;;;N;;;;; +05B6;HEBREW POINT SEGOL;Mn;16;NSM;;;;;N;;;;; +05B7;HEBREW POINT PATAH;Mn;17;NSM;;;;;N;;;;; +05B8;HEBREW POINT QAMATS;Mn;18;NSM;;;;;N;;;;; +05B9;HEBREW POINT HOLAM;Mn;19;NSM;;;;;N;;;;; +05BA;HEBREW POINT HOLAM HASER FOR VAV;Mn;19;NSM;;;;;N;;;;; +05BB;HEBREW POINT QUBUTS;Mn;20;NSM;;;;;N;;;;; +05BC;HEBREW POINT DAGESH OR MAPIQ;Mn;21;NSM;;;;;N;HEBREW POINT DAGESH;;;; +05BD;HEBREW POINT METEG;Mn;22;NSM;;;;;N;;;;; +05BE;HEBREW PUNCTUATION MAQAF;Pd;0;R;;;;;N;;;;; +05BF;HEBREW POINT RAFE;Mn;23;NSM;;;;;N;;;;; +05C0;HEBREW PUNCTUATION PASEQ;Po;0;R;;;;;N;HEBREW POINT PASEQ;;;; +05C1;HEBREW POINT SHIN DOT;Mn;24;NSM;;;;;N;;;;; +05C2;HEBREW POINT SIN DOT;Mn;25;NSM;;;;;N;;;;; +05C3;HEBREW PUNCTUATION SOF PASUQ;Po;0;R;;;;;N;;;;; +05C4;HEBREW MARK UPPER DOT;Mn;230;NSM;;;;;N;;;;; +05C5;HEBREW MARK LOWER DOT;Mn;220;NSM;;;;;N;;;;; +05C6;HEBREW PUNCTUATION NUN HAFUKHA;Po;0;R;;;;;N;;;;; +05C7;HEBREW POINT QAMATS QATAN;Mn;18;NSM;;;;;N;;;;; +05D0;HEBREW LETTER ALEF;Lo;0;R;;;;;N;;;;; +05D1;HEBREW LETTER BET;Lo;0;R;;;;;N;;;;; +05D2;HEBREW LETTER GIMEL;Lo;0;R;;;;;N;;;;; +05D3;HEBREW LETTER DALET;Lo;0;R;;;;;N;;;;; +05D4;HEBREW LETTER HE;Lo;0;R;;;;;N;;;;; +05D5;HEBREW LETTER VAV;Lo;0;R;;;;;N;;;;; +05D6;HEBREW LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +05D7;HEBREW LETTER HET;Lo;0;R;;;;;N;;;;; +05D8;HEBREW LETTER TET;Lo;0;R;;;;;N;;;;; +05D9;HEBREW LETTER YOD;Lo;0;R;;;;;N;;;;; +05DA;HEBREW LETTER FINAL KAF;Lo;0;R;;;;;N;;;;; +05DB;HEBREW LETTER KAF;Lo;0;R;;;;;N;;;;; +05DC;HEBREW LETTER LAMED;Lo;0;R;;;;;N;;;;; +05DD;HEBREW LETTER FINAL MEM;Lo;0;R;;;;;N;;;;; +05DE;HEBREW LETTER MEM;Lo;0;R;;;;;N;;;;; +05DF;HEBREW LETTER FINAL NUN;Lo;0;R;;;;;N;;;;; +05E0;HEBREW LETTER NUN;Lo;0;R;;;;;N;;;;; +05E1;HEBREW LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +05E2;HEBREW LETTER AYIN;Lo;0;R;;;;;N;;;;; +05E3;HEBREW LETTER FINAL PE;Lo;0;R;;;;;N;;;;; +05E4;HEBREW LETTER PE;Lo;0;R;;;;;N;;;;; +05E5;HEBREW LETTER FINAL TSADI;Lo;0;R;;;;;N;;;;; +05E6;HEBREW LETTER TSADI;Lo;0;R;;;;;N;;;;; +05E7;HEBREW LETTER QOF;Lo;0;R;;;;;N;;;;; +05E8;HEBREW LETTER RESH;Lo;0;R;;;;;N;;;;; +05E9;HEBREW LETTER SHIN;Lo;0;R;;;;;N;;;;; +05EA;HEBREW LETTER TAV;Lo;0;R;;;;;N;;;;; +05F0;HEBREW LIGATURE YIDDISH DOUBLE VAV;Lo;0;R;;;;;N;HEBREW LETTER DOUBLE VAV;;;; +05F1;HEBREW LIGATURE YIDDISH VAV YOD;Lo;0;R;;;;;N;HEBREW LETTER VAV YOD;;;; +05F2;HEBREW LIGATURE YIDDISH DOUBLE YOD;Lo;0;R;;;;;N;HEBREW LETTER DOUBLE YOD;;;; +05F3;HEBREW PUNCTUATION GERESH;Po;0;R;;;;;N;;;;; +05F4;HEBREW PUNCTUATION GERSHAYIM;Po;0;R;;;;;N;;;;; +0600;ARABIC NUMBER SIGN;Cf;0;AN;;;;;N;;;;; +0601;ARABIC SIGN SANAH;Cf;0;AN;;;;;N;;;;; +0602;ARABIC FOOTNOTE MARKER;Cf;0;AN;;;;;N;;;;; +0603;ARABIC SIGN SAFHA;Cf;0;AN;;;;;N;;;;; +0604;ARABIC SIGN SAMVAT;Cf;0;AN;;;;;N;;;;; +0605;ARABIC NUMBER MARK ABOVE;Cf;0;AN;;;;;N;;;;; +0606;ARABIC-INDIC CUBE ROOT;Sm;0;ON;;;;;N;;;;; +0607;ARABIC-INDIC FOURTH ROOT;Sm;0;ON;;;;;N;;;;; +0608;ARABIC RAY;Sm;0;AL;;;;;N;;;;; +0609;ARABIC-INDIC PER MILLE SIGN;Po;0;ET;;;;;N;;;;; +060A;ARABIC-INDIC PER TEN THOUSAND SIGN;Po;0;ET;;;;;N;;;;; +060B;AFGHANI SIGN;Sc;0;AL;;;;;N;;;;; +060C;ARABIC COMMA;Po;0;CS;;;;;N;;;;; +060D;ARABIC DATE SEPARATOR;Po;0;AL;;;;;N;;;;; +060E;ARABIC POETIC VERSE SIGN;So;0;ON;;;;;N;;;;; +060F;ARABIC SIGN MISRA;So;0;ON;;;;;N;;;;; +0610;ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM;Mn;230;NSM;;;;;N;;;;; +0611;ARABIC SIGN ALAYHE ASSALLAM;Mn;230;NSM;;;;;N;;;;; +0612;ARABIC SIGN RAHMATULLAH ALAYHE;Mn;230;NSM;;;;;N;;;;; +0613;ARABIC SIGN RADI ALLAHOU ANHU;Mn;230;NSM;;;;;N;;;;; +0614;ARABIC SIGN TAKHALLUS;Mn;230;NSM;;;;;N;;;;; +0615;ARABIC SMALL HIGH TAH;Mn;230;NSM;;;;;N;;;;; +0616;ARABIC SMALL HIGH LIGATURE ALEF WITH LAM WITH YEH;Mn;230;NSM;;;;;N;;;;; +0617;ARABIC SMALL HIGH ZAIN;Mn;230;NSM;;;;;N;;;;; +0618;ARABIC SMALL FATHA;Mn;30;NSM;;;;;N;;;;; +0619;ARABIC SMALL DAMMA;Mn;31;NSM;;;;;N;;;;; +061A;ARABIC SMALL KASRA;Mn;32;NSM;;;;;N;;;;; +061B;ARABIC SEMICOLON;Po;0;AL;;;;;N;;;;; +061C;ARABIC LETTER MARK;Cf;0;AL;;;;;N;;;;; +061E;ARABIC TRIPLE DOT PUNCTUATION MARK;Po;0;AL;;;;;N;;;;; +061F;ARABIC QUESTION MARK;Po;0;AL;;;;;N;;;;; +0620;ARABIC LETTER KASHMIRI YEH;Lo;0;AL;;;;;N;;;;; +0621;ARABIC LETTER HAMZA;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAH;;;; +0622;ARABIC LETTER ALEF WITH MADDA ABOVE;Lo;0;AL;0627 0653;;;;N;ARABIC LETTER MADDAH ON ALEF;;;; +0623;ARABIC LETTER ALEF WITH HAMZA ABOVE;Lo;0;AL;0627 0654;;;;N;ARABIC LETTER HAMZAH ON ALEF;;;; +0624;ARABIC LETTER WAW WITH HAMZA ABOVE;Lo;0;AL;0648 0654;;;;N;ARABIC LETTER HAMZAH ON WAW;;;; +0625;ARABIC LETTER ALEF WITH HAMZA BELOW;Lo;0;AL;0627 0655;;;;N;ARABIC LETTER HAMZAH UNDER ALEF;;;; +0626;ARABIC LETTER YEH WITH HAMZA ABOVE;Lo;0;AL;064A 0654;;;;N;ARABIC LETTER HAMZAH ON YA;;;; +0627;ARABIC LETTER ALEF;Lo;0;AL;;;;;N;;;;; +0628;ARABIC LETTER BEH;Lo;0;AL;;;;;N;ARABIC LETTER BAA;;;; +0629;ARABIC LETTER TEH MARBUTA;Lo;0;AL;;;;;N;ARABIC LETTER TAA MARBUTAH;;;; +062A;ARABIC LETTER TEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA;;;; +062B;ARABIC LETTER THEH;Lo;0;AL;;;;;N;ARABIC LETTER THAA;;;; +062C;ARABIC LETTER JEEM;Lo;0;AL;;;;;N;;;;; +062D;ARABIC LETTER HAH;Lo;0;AL;;;;;N;ARABIC LETTER HAA;;;; +062E;ARABIC LETTER KHAH;Lo;0;AL;;;;;N;ARABIC LETTER KHAA;;;; +062F;ARABIC LETTER DAL;Lo;0;AL;;;;;N;;;;; +0630;ARABIC LETTER THAL;Lo;0;AL;;;;;N;;;;; +0631;ARABIC LETTER REH;Lo;0;AL;;;;;N;ARABIC LETTER RA;;;; +0632;ARABIC LETTER ZAIN;Lo;0;AL;;;;;N;;;;; +0633;ARABIC LETTER SEEN;Lo;0;AL;;;;;N;;;;; +0634;ARABIC LETTER SHEEN;Lo;0;AL;;;;;N;;;;; +0635;ARABIC LETTER SAD;Lo;0;AL;;;;;N;;;;; +0636;ARABIC LETTER DAD;Lo;0;AL;;;;;N;;;;; +0637;ARABIC LETTER TAH;Lo;0;AL;;;;;N;;;;; +0638;ARABIC LETTER ZAH;Lo;0;AL;;;;;N;ARABIC LETTER DHAH;;;; +0639;ARABIC LETTER AIN;Lo;0;AL;;;;;N;;;;; +063A;ARABIC LETTER GHAIN;Lo;0;AL;;;;;N;;;;; +063B;ARABIC LETTER KEHEH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +063C;ARABIC LETTER KEHEH WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; +063D;ARABIC LETTER FARSI YEH WITH INVERTED V;Lo;0;AL;;;;;N;;;;; +063E;ARABIC LETTER FARSI YEH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +063F;ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0640;ARABIC TATWEEL;Lm;0;AL;;;;;N;;;;; +0641;ARABIC LETTER FEH;Lo;0;AL;;;;;N;ARABIC LETTER FA;;;; +0642;ARABIC LETTER QAF;Lo;0;AL;;;;;N;;;;; +0643;ARABIC LETTER KAF;Lo;0;AL;;;;;N;ARABIC LETTER CAF;;;; +0644;ARABIC LETTER LAM;Lo;0;AL;;;;;N;;;;; +0645;ARABIC LETTER MEEM;Lo;0;AL;;;;;N;;;;; +0646;ARABIC LETTER NOON;Lo;0;AL;;;;;N;;;;; +0647;ARABIC LETTER HEH;Lo;0;AL;;;;;N;ARABIC LETTER HA;;;; +0648;ARABIC LETTER WAW;Lo;0;AL;;;;;N;;;;; +0649;ARABIC LETTER ALEF MAKSURA;Lo;0;AL;;;;;N;ARABIC LETTER ALEF MAQSURAH;;;; +064A;ARABIC LETTER YEH;Lo;0;AL;;;;;N;ARABIC LETTER YA;;;; +064B;ARABIC FATHATAN;Mn;27;NSM;;;;;N;;;;; +064C;ARABIC DAMMATAN;Mn;28;NSM;;;;;N;;;;; +064D;ARABIC KASRATAN;Mn;29;NSM;;;;;N;;;;; +064E;ARABIC FATHA;Mn;30;NSM;;;;;N;ARABIC FATHAH;;;; +064F;ARABIC DAMMA;Mn;31;NSM;;;;;N;ARABIC DAMMAH;;;; +0650;ARABIC KASRA;Mn;32;NSM;;;;;N;ARABIC KASRAH;;;; +0651;ARABIC SHADDA;Mn;33;NSM;;;;;N;ARABIC SHADDAH;;;; +0652;ARABIC SUKUN;Mn;34;NSM;;;;;N;;;;; +0653;ARABIC MADDAH ABOVE;Mn;230;NSM;;;;;N;;;;; +0654;ARABIC HAMZA ABOVE;Mn;230;NSM;;;;;N;;;;; +0655;ARABIC HAMZA BELOW;Mn;220;NSM;;;;;N;;;;; +0656;ARABIC SUBSCRIPT ALEF;Mn;220;NSM;;;;;N;;;;; +0657;ARABIC INVERTED DAMMA;Mn;230;NSM;;;;;N;;;;; +0658;ARABIC MARK NOON GHUNNA;Mn;230;NSM;;;;;N;;;;; +0659;ARABIC ZWARAKAY;Mn;230;NSM;;;;;N;;;;; +065A;ARABIC VOWEL SIGN SMALL V ABOVE;Mn;230;NSM;;;;;N;;;;; +065B;ARABIC VOWEL SIGN INVERTED SMALL V ABOVE;Mn;230;NSM;;;;;N;;;;; +065C;ARABIC VOWEL SIGN DOT BELOW;Mn;220;NSM;;;;;N;;;;; +065D;ARABIC REVERSED DAMMA;Mn;230;NSM;;;;;N;;;;; +065E;ARABIC FATHA WITH TWO DOTS;Mn;230;NSM;;;;;N;;;;; +065F;ARABIC WAVY HAMZA BELOW;Mn;220;NSM;;;;;N;;;;; +0660;ARABIC-INDIC DIGIT ZERO;Nd;0;AN;;0;0;0;N;;;;; +0661;ARABIC-INDIC DIGIT ONE;Nd;0;AN;;1;1;1;N;;;;; +0662;ARABIC-INDIC DIGIT TWO;Nd;0;AN;;2;2;2;N;;;;; +0663;ARABIC-INDIC DIGIT THREE;Nd;0;AN;;3;3;3;N;;;;; +0664;ARABIC-INDIC DIGIT FOUR;Nd;0;AN;;4;4;4;N;;;;; +0665;ARABIC-INDIC DIGIT FIVE;Nd;0;AN;;5;5;5;N;;;;; +0666;ARABIC-INDIC DIGIT SIX;Nd;0;AN;;6;6;6;N;;;;; +0667;ARABIC-INDIC DIGIT SEVEN;Nd;0;AN;;7;7;7;N;;;;; +0668;ARABIC-INDIC DIGIT EIGHT;Nd;0;AN;;8;8;8;N;;;;; +0669;ARABIC-INDIC DIGIT NINE;Nd;0;AN;;9;9;9;N;;;;; +066A;ARABIC PERCENT SIGN;Po;0;ET;;;;;N;;;;; +066B;ARABIC DECIMAL SEPARATOR;Po;0;AN;;;;;N;;;;; +066C;ARABIC THOUSANDS SEPARATOR;Po;0;AN;;;;;N;;;;; +066D;ARABIC FIVE POINTED STAR;Po;0;AL;;;;;N;;;;; +066E;ARABIC LETTER DOTLESS BEH;Lo;0;AL;;;;;N;;;;; +066F;ARABIC LETTER DOTLESS QAF;Lo;0;AL;;;;;N;;;;; +0670;ARABIC LETTER SUPERSCRIPT ALEF;Mn;35;NSM;;;;;N;ARABIC ALEF ABOVE;;;; +0671;ARABIC LETTER ALEF WASLA;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAT WASL ON ALEF;;;; +0672;ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER WAVY HAMZAH ON ALEF;;;; +0673;ARABIC LETTER ALEF WITH WAVY HAMZA BELOW;Lo;0;AL;;;;;N;ARABIC LETTER WAVY HAMZAH UNDER ALEF;;;; +0674;ARABIC LETTER HIGH HAMZA;Lo;0;AL;;;;;N;ARABIC LETTER HIGH HAMZAH;;;; +0675;ARABIC LETTER HIGH HAMZA ALEF;Lo;0;AL;<compat> 0627 0674;;;;N;ARABIC LETTER HIGH HAMZAH ALEF;;;; +0676;ARABIC LETTER HIGH HAMZA WAW;Lo;0;AL;<compat> 0648 0674;;;;N;ARABIC LETTER HIGH HAMZAH WAW;;;; +0677;ARABIC LETTER U WITH HAMZA ABOVE;Lo;0;AL;<compat> 06C7 0674;;;;N;ARABIC LETTER HIGH HAMZAH WAW WITH DAMMAH;;;; +0678;ARABIC LETTER HIGH HAMZA YEH;Lo;0;AL;<compat> 064A 0674;;;;N;ARABIC LETTER HIGH HAMZAH YA;;;; +0679;ARABIC LETTER TTEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH SMALL TAH;;;; +067A;ARABIC LETTER TTEHEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH TWO DOTS VERTICAL ABOVE;;;; +067B;ARABIC LETTER BEEH;Lo;0;AL;;;;;N;ARABIC LETTER BAA WITH TWO DOTS VERTICAL BELOW;;;; +067C;ARABIC LETTER TEH WITH RING;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH RING;;;; +067D;ARABIC LETTER TEH WITH THREE DOTS ABOVE DOWNWARDS;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH THREE DOTS ABOVE DOWNWARD;;;; +067E;ARABIC LETTER PEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH THREE DOTS BELOW;;;; +067F;ARABIC LETTER TEHEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH FOUR DOTS ABOVE;;;; +0680;ARABIC LETTER BEHEH;Lo;0;AL;;;;;N;ARABIC LETTER BAA WITH FOUR DOTS BELOW;;;; +0681;ARABIC LETTER HAH WITH HAMZA ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAH ON HAA;;;; +0682;ARABIC LETTER HAH WITH TWO DOTS VERTICAL ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH TWO DOTS VERTICAL ABOVE;;;; +0683;ARABIC LETTER NYEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE TWO DOTS;;;; +0684;ARABIC LETTER DYEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE TWO DOTS VERTICAL;;;; +0685;ARABIC LETTER HAH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH THREE DOTS ABOVE;;;; +0686;ARABIC LETTER TCHEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE THREE DOTS DOWNWARD;;;; +0687;ARABIC LETTER TCHEHEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE FOUR DOTS;;;; +0688;ARABIC LETTER DDAL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH SMALL TAH;;;; +0689;ARABIC LETTER DAL WITH RING;Lo;0;AL;;;;;N;;;;; +068A;ARABIC LETTER DAL WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +068B;ARABIC LETTER DAL WITH DOT BELOW AND SMALL TAH;Lo;0;AL;;;;;N;;;;; +068C;ARABIC LETTER DAHAL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH TWO DOTS ABOVE;;;; +068D;ARABIC LETTER DDAHAL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH TWO DOTS BELOW;;;; +068E;ARABIC LETTER DUL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH THREE DOTS ABOVE;;;; +068F;ARABIC LETTER DAL WITH THREE DOTS ABOVE DOWNWARDS;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH THREE DOTS ABOVE DOWNWARD;;;; +0690;ARABIC LETTER DAL WITH FOUR DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0691;ARABIC LETTER RREH;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH SMALL TAH;;;; +0692;ARABIC LETTER REH WITH SMALL V;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH SMALL V;;;; +0693;ARABIC LETTER REH WITH RING;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH RING;;;; +0694;ARABIC LETTER REH WITH DOT BELOW;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH DOT BELOW;;;; +0695;ARABIC LETTER REH WITH SMALL V BELOW;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH SMALL V BELOW;;;; +0696;ARABIC LETTER REH WITH DOT BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH DOT BELOW AND DOT ABOVE;;;; +0697;ARABIC LETTER REH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH TWO DOTS ABOVE;;;; +0698;ARABIC LETTER JEH;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH THREE DOTS ABOVE;;;; +0699;ARABIC LETTER REH WITH FOUR DOTS ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH FOUR DOTS ABOVE;;;; +069A;ARABIC LETTER SEEN WITH DOT BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;;;;; +069B;ARABIC LETTER SEEN WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; +069C;ARABIC LETTER SEEN WITH THREE DOTS BELOW AND THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +069D;ARABIC LETTER SAD WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;; +069E;ARABIC LETTER SAD WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +069F;ARABIC LETTER TAH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06A0;ARABIC LETTER AIN WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06A1;ARABIC LETTER DOTLESS FEH;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS FA;;;; +06A2;ARABIC LETTER FEH WITH DOT MOVED BELOW;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH DOT MOVED BELOW;;;; +06A3;ARABIC LETTER FEH WITH DOT BELOW;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH DOT BELOW;;;; +06A4;ARABIC LETTER VEH;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH THREE DOTS ABOVE;;;; +06A5;ARABIC LETTER FEH WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH THREE DOTS BELOW;;;; +06A6;ARABIC LETTER PEHEH;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH FOUR DOTS ABOVE;;;; +06A7;ARABIC LETTER QAF WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;; +06A8;ARABIC LETTER QAF WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06A9;ARABIC LETTER KEHEH;Lo;0;AL;;;;;N;ARABIC LETTER OPEN CAF;;;; +06AA;ARABIC LETTER SWASH KAF;Lo;0;AL;;;;;N;ARABIC LETTER SWASH CAF;;;; +06AB;ARABIC LETTER KAF WITH RING;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH RING;;;; +06AC;ARABIC LETTER KAF WITH DOT ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH DOT ABOVE;;;; +06AD;ARABIC LETTER NG;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH THREE DOTS ABOVE;;;; +06AE;ARABIC LETTER KAF WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH THREE DOTS BELOW;;;; +06AF;ARABIC LETTER GAF;Lo;0;AL;;;;;N;;;;; +06B0;ARABIC LETTER GAF WITH RING;Lo;0;AL;;;;;N;;;;; +06B1;ARABIC LETTER NGOEH;Lo;0;AL;;;;;N;ARABIC LETTER GAF WITH TWO DOTS ABOVE;;;; +06B2;ARABIC LETTER GAF WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;; +06B3;ARABIC LETTER GUEH;Lo;0;AL;;;;;N;ARABIC LETTER GAF WITH TWO DOTS VERTICAL BELOW;;;; +06B4;ARABIC LETTER GAF WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06B5;ARABIC LETTER LAM WITH SMALL V;Lo;0;AL;;;;;N;;;;; +06B6;ARABIC LETTER LAM WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;; +06B7;ARABIC LETTER LAM WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06B8;ARABIC LETTER LAM WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; +06B9;ARABIC LETTER NOON WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +06BA;ARABIC LETTER NOON GHUNNA;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS NOON;;;; +06BB;ARABIC LETTER RNOON;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS NOON WITH SMALL TAH;;;; +06BC;ARABIC LETTER NOON WITH RING;Lo;0;AL;;;;;N;;;;; +06BD;ARABIC LETTER NOON WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06BE;ARABIC LETTER HEH DOACHASHMEE;Lo;0;AL;;;;;N;ARABIC LETTER KNOTTED HA;;;; +06BF;ARABIC LETTER TCHEH WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;; +06C0;ARABIC LETTER HEH WITH YEH ABOVE;Lo;0;AL;06D5 0654;;;;N;ARABIC LETTER HAMZAH ON HA;;;; +06C1;ARABIC LETTER HEH GOAL;Lo;0;AL;;;;;N;ARABIC LETTER HA GOAL;;;; +06C2;ARABIC LETTER HEH GOAL WITH HAMZA ABOVE;Lo;0;AL;06C1 0654;;;;N;ARABIC LETTER HAMZAH ON HA GOAL;;;; +06C3;ARABIC LETTER TEH MARBUTA GOAL;Lo;0;AL;;;;;N;ARABIC LETTER TAA MARBUTAH GOAL;;;; +06C4;ARABIC LETTER WAW WITH RING;Lo;0;AL;;;;;N;;;;; +06C5;ARABIC LETTER KIRGHIZ OE;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH BAR;;;; +06C6;ARABIC LETTER OE;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH SMALL V;;;; +06C7;ARABIC LETTER U;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH DAMMAH;;;; +06C8;ARABIC LETTER YU;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH ALEF ABOVE;;;; +06C9;ARABIC LETTER KIRGHIZ YU;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH INVERTED SMALL V;;;; +06CA;ARABIC LETTER WAW WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +06CB;ARABIC LETTER VE;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH THREE DOTS ABOVE;;;; +06CC;ARABIC LETTER FARSI YEH;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS YA;;;; +06CD;ARABIC LETTER YEH WITH TAIL;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH TAIL;;;; +06CE;ARABIC LETTER YEH WITH SMALL V;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH SMALL V;;;; +06CF;ARABIC LETTER WAW WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;; +06D0;ARABIC LETTER E;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH TWO DOTS VERTICAL BELOW;;;; +06D1;ARABIC LETTER YEH WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH THREE DOTS BELOW;;;; +06D2;ARABIC LETTER YEH BARREE;Lo;0;AL;;;;;N;ARABIC LETTER YA BARREE;;;; +06D3;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE;Lo;0;AL;06D2 0654;;;;N;ARABIC LETTER HAMZAH ON YA BARREE;;;; +06D4;ARABIC FULL STOP;Po;0;AL;;;;;N;ARABIC PERIOD;;;; +06D5;ARABIC LETTER AE;Lo;0;AL;;;;;N;;;;; +06D6;ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA;Mn;230;NSM;;;;;N;;;;; +06D7;ARABIC SMALL HIGH LIGATURE QAF WITH LAM WITH ALEF MAKSURA;Mn;230;NSM;;;;;N;;;;; +06D8;ARABIC SMALL HIGH MEEM INITIAL FORM;Mn;230;NSM;;;;;N;;;;; +06D9;ARABIC SMALL HIGH LAM ALEF;Mn;230;NSM;;;;;N;;;;; +06DA;ARABIC SMALL HIGH JEEM;Mn;230;NSM;;;;;N;;;;; +06DB;ARABIC SMALL HIGH THREE DOTS;Mn;230;NSM;;;;;N;;;;; +06DC;ARABIC SMALL HIGH SEEN;Mn;230;NSM;;;;;N;;;;; +06DD;ARABIC END OF AYAH;Cf;0;AN;;;;;N;;;;; +06DE;ARABIC START OF RUB EL HIZB;So;0;ON;;;;;N;;;;; +06DF;ARABIC SMALL HIGH ROUNDED ZERO;Mn;230;NSM;;;;;N;;;;; +06E0;ARABIC SMALL HIGH UPRIGHT RECTANGULAR ZERO;Mn;230;NSM;;;;;N;;;;; +06E1;ARABIC SMALL HIGH DOTLESS HEAD OF KHAH;Mn;230;NSM;;;;;N;;;;; +06E2;ARABIC SMALL HIGH MEEM ISOLATED FORM;Mn;230;NSM;;;;;N;;;;; +06E3;ARABIC SMALL LOW SEEN;Mn;220;NSM;;;;;N;;;;; +06E4;ARABIC SMALL HIGH MADDA;Mn;230;NSM;;;;;N;;;;; +06E5;ARABIC SMALL WAW;Lm;0;AL;;;;;N;;;;; +06E6;ARABIC SMALL YEH;Lm;0;AL;;;;;N;;;;; +06E7;ARABIC SMALL HIGH YEH;Mn;230;NSM;;;;;N;;;;; +06E8;ARABIC SMALL HIGH NOON;Mn;230;NSM;;;;;N;;;;; +06E9;ARABIC PLACE OF SAJDAH;So;0;ON;;;;;N;;;;; +06EA;ARABIC EMPTY CENTRE LOW STOP;Mn;220;NSM;;;;;N;;;;; +06EB;ARABIC EMPTY CENTRE HIGH STOP;Mn;230;NSM;;;;;N;;;;; +06EC;ARABIC ROUNDED HIGH STOP WITH FILLED CENTRE;Mn;230;NSM;;;;;N;;;;; +06ED;ARABIC SMALL LOW MEEM;Mn;220;NSM;;;;;N;;;;; +06EE;ARABIC LETTER DAL WITH INVERTED V;Lo;0;AL;;;;;N;;;;; +06EF;ARABIC LETTER REH WITH INVERTED V;Lo;0;AL;;;;;N;;;;; +06F0;EXTENDED ARABIC-INDIC DIGIT ZERO;Nd;0;EN;;0;0;0;N;EASTERN ARABIC-INDIC DIGIT ZERO;;;; +06F1;EXTENDED ARABIC-INDIC DIGIT ONE;Nd;0;EN;;1;1;1;N;EASTERN ARABIC-INDIC DIGIT ONE;;;; +06F2;EXTENDED ARABIC-INDIC DIGIT TWO;Nd;0;EN;;2;2;2;N;EASTERN ARABIC-INDIC DIGIT TWO;;;; +06F3;EXTENDED ARABIC-INDIC DIGIT THREE;Nd;0;EN;;3;3;3;N;EASTERN ARABIC-INDIC DIGIT THREE;;;; +06F4;EXTENDED ARABIC-INDIC DIGIT FOUR;Nd;0;EN;;4;4;4;N;EASTERN ARABIC-INDIC DIGIT FOUR;;;; +06F5;EXTENDED ARABIC-INDIC DIGIT FIVE;Nd;0;EN;;5;5;5;N;EASTERN ARABIC-INDIC DIGIT FIVE;;;; +06F6;EXTENDED ARABIC-INDIC DIGIT SIX;Nd;0;EN;;6;6;6;N;EASTERN ARABIC-INDIC DIGIT SIX;;;; +06F7;EXTENDED ARABIC-INDIC DIGIT SEVEN;Nd;0;EN;;7;7;7;N;EASTERN ARABIC-INDIC DIGIT SEVEN;;;; +06F8;EXTENDED ARABIC-INDIC DIGIT EIGHT;Nd;0;EN;;8;8;8;N;EASTERN ARABIC-INDIC DIGIT EIGHT;;;; +06F9;EXTENDED ARABIC-INDIC DIGIT NINE;Nd;0;EN;;9;9;9;N;EASTERN ARABIC-INDIC DIGIT NINE;;;; +06FA;ARABIC LETTER SHEEN WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +06FB;ARABIC LETTER DAD WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +06FC;ARABIC LETTER GHAIN WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +06FD;ARABIC SIGN SINDHI AMPERSAND;So;0;AL;;;;;N;;;;; +06FE;ARABIC SIGN SINDHI POSTPOSITION MEN;So;0;AL;;;;;N;;;;; +06FF;ARABIC LETTER HEH WITH INVERTED V;Lo;0;AL;;;;;N;;;;; +0700;SYRIAC END OF PARAGRAPH;Po;0;AL;;;;;N;;;;; +0701;SYRIAC SUPRALINEAR FULL STOP;Po;0;AL;;;;;N;;;;; +0702;SYRIAC SUBLINEAR FULL STOP;Po;0;AL;;;;;N;;;;; +0703;SYRIAC SUPRALINEAR COLON;Po;0;AL;;;;;N;;;;; +0704;SYRIAC SUBLINEAR COLON;Po;0;AL;;;;;N;;;;; +0705;SYRIAC HORIZONTAL COLON;Po;0;AL;;;;;N;;;;; +0706;SYRIAC COLON SKEWED LEFT;Po;0;AL;;;;;N;;;;; +0707;SYRIAC COLON SKEWED RIGHT;Po;0;AL;;;;;N;;;;; +0708;SYRIAC SUPRALINEAR COLON SKEWED LEFT;Po;0;AL;;;;;N;;;;; +0709;SYRIAC SUBLINEAR COLON SKEWED RIGHT;Po;0;AL;;;;;N;;;;; +070A;SYRIAC CONTRACTION;Po;0;AL;;;;;N;;;;; +070B;SYRIAC HARKLEAN OBELUS;Po;0;AL;;;;;N;;;;; +070C;SYRIAC HARKLEAN METOBELUS;Po;0;AL;;;;;N;;;;; +070D;SYRIAC HARKLEAN ASTERISCUS;Po;0;AL;;;;;N;;;;; +070F;SYRIAC ABBREVIATION MARK;Cf;0;AL;;;;;N;;;;; +0710;SYRIAC LETTER ALAPH;Lo;0;AL;;;;;N;;;;; +0711;SYRIAC LETTER SUPERSCRIPT ALAPH;Mn;36;NSM;;;;;N;;;;; +0712;SYRIAC LETTER BETH;Lo;0;AL;;;;;N;;;;; +0713;SYRIAC LETTER GAMAL;Lo;0;AL;;;;;N;;;;; +0714;SYRIAC LETTER GAMAL GARSHUNI;Lo;0;AL;;;;;N;;;;; +0715;SYRIAC LETTER DALATH;Lo;0;AL;;;;;N;;;;; +0716;SYRIAC LETTER DOTLESS DALATH RISH;Lo;0;AL;;;;;N;;;;; +0717;SYRIAC LETTER HE;Lo;0;AL;;;;;N;;;;; +0718;SYRIAC LETTER WAW;Lo;0;AL;;;;;N;;;;; +0719;SYRIAC LETTER ZAIN;Lo;0;AL;;;;;N;;;;; +071A;SYRIAC LETTER HETH;Lo;0;AL;;;;;N;;;;; +071B;SYRIAC LETTER TETH;Lo;0;AL;;;;;N;;;;; +071C;SYRIAC LETTER TETH GARSHUNI;Lo;0;AL;;;;;N;;;;; +071D;SYRIAC LETTER YUDH;Lo;0;AL;;;;;N;;;;; +071E;SYRIAC LETTER YUDH HE;Lo;0;AL;;;;;N;;;;; +071F;SYRIAC LETTER KAPH;Lo;0;AL;;;;;N;;;;; +0720;SYRIAC LETTER LAMADH;Lo;0;AL;;;;;N;;;;; +0721;SYRIAC LETTER MIM;Lo;0;AL;;;;;N;;;;; +0722;SYRIAC LETTER NUN;Lo;0;AL;;;;;N;;;;; +0723;SYRIAC LETTER SEMKATH;Lo;0;AL;;;;;N;;;;; +0724;SYRIAC LETTER FINAL SEMKATH;Lo;0;AL;;;;;N;;;;; +0725;SYRIAC LETTER E;Lo;0;AL;;;;;N;;;;; +0726;SYRIAC LETTER PE;Lo;0;AL;;;;;N;;;;; +0727;SYRIAC LETTER REVERSED PE;Lo;0;AL;;;;;N;;;;; +0728;SYRIAC LETTER SADHE;Lo;0;AL;;;;;N;;;;; +0729;SYRIAC LETTER QAPH;Lo;0;AL;;;;;N;;;;; +072A;SYRIAC LETTER RISH;Lo;0;AL;;;;;N;;;;; +072B;SYRIAC LETTER SHIN;Lo;0;AL;;;;;N;;;;; +072C;SYRIAC LETTER TAW;Lo;0;AL;;;;;N;;;;; +072D;SYRIAC LETTER PERSIAN BHETH;Lo;0;AL;;;;;N;;;;; +072E;SYRIAC LETTER PERSIAN GHAMAL;Lo;0;AL;;;;;N;;;;; +072F;SYRIAC LETTER PERSIAN DHALATH;Lo;0;AL;;;;;N;;;;; +0730;SYRIAC PTHAHA ABOVE;Mn;230;NSM;;;;;N;;;;; +0731;SYRIAC PTHAHA BELOW;Mn;220;NSM;;;;;N;;;;; +0732;SYRIAC PTHAHA DOTTED;Mn;230;NSM;;;;;N;;;;; +0733;SYRIAC ZQAPHA ABOVE;Mn;230;NSM;;;;;N;;;;; +0734;SYRIAC ZQAPHA BELOW;Mn;220;NSM;;;;;N;;;;; +0735;SYRIAC ZQAPHA DOTTED;Mn;230;NSM;;;;;N;;;;; +0736;SYRIAC RBASA ABOVE;Mn;230;NSM;;;;;N;;;;; +0737;SYRIAC RBASA BELOW;Mn;220;NSM;;;;;N;;;;; +0738;SYRIAC DOTTED ZLAMA HORIZONTAL;Mn;220;NSM;;;;;N;;;;; +0739;SYRIAC DOTTED ZLAMA ANGULAR;Mn;220;NSM;;;;;N;;;;; +073A;SYRIAC HBASA ABOVE;Mn;230;NSM;;;;;N;;;;; +073B;SYRIAC HBASA BELOW;Mn;220;NSM;;;;;N;;;;; +073C;SYRIAC HBASA-ESASA DOTTED;Mn;220;NSM;;;;;N;;;;; +073D;SYRIAC ESASA ABOVE;Mn;230;NSM;;;;;N;;;;; +073E;SYRIAC ESASA BELOW;Mn;220;NSM;;;;;N;;;;; +073F;SYRIAC RWAHA;Mn;230;NSM;;;;;N;;;;; +0740;SYRIAC FEMININE DOT;Mn;230;NSM;;;;;N;;;;; +0741;SYRIAC QUSHSHAYA;Mn;230;NSM;;;;;N;;;;; +0742;SYRIAC RUKKAKHA;Mn;220;NSM;;;;;N;;;;; +0743;SYRIAC TWO VERTICAL DOTS ABOVE;Mn;230;NSM;;;;;N;;;;; +0744;SYRIAC TWO VERTICAL DOTS BELOW;Mn;220;NSM;;;;;N;;;;; +0745;SYRIAC THREE DOTS ABOVE;Mn;230;NSM;;;;;N;;;;; +0746;SYRIAC THREE DOTS BELOW;Mn;220;NSM;;;;;N;;;;; +0747;SYRIAC OBLIQUE LINE ABOVE;Mn;230;NSM;;;;;N;;;;; +0748;SYRIAC OBLIQUE LINE BELOW;Mn;220;NSM;;;;;N;;;;; +0749;SYRIAC MUSIC;Mn;230;NSM;;;;;N;;;;; +074A;SYRIAC BARREKH;Mn;230;NSM;;;;;N;;;;; +074D;SYRIAC LETTER SOGDIAN ZHAIN;Lo;0;AL;;;;;N;;;;; +074E;SYRIAC LETTER SOGDIAN KHAPH;Lo;0;AL;;;;;N;;;;; +074F;SYRIAC LETTER SOGDIAN FE;Lo;0;AL;;;;;N;;;;; +0750;ARABIC LETTER BEH WITH THREE DOTS HORIZONTALLY BELOW;Lo;0;AL;;;;;N;;;;; +0751;ARABIC LETTER BEH WITH DOT BELOW AND THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0752;ARABIC LETTER BEH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;; +0753;ARABIC LETTER BEH WITH THREE DOTS POINTING UPWARDS BELOW AND TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0754;ARABIC LETTER BEH WITH TWO DOTS BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;;;;; +0755;ARABIC LETTER BEH WITH INVERTED SMALL V BELOW;Lo;0;AL;;;;;N;;;;; +0756;ARABIC LETTER BEH WITH SMALL V;Lo;0;AL;;;;;N;;;;; +0757;ARABIC LETTER HAH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0758;ARABIC LETTER HAH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;; +0759;ARABIC LETTER DAL WITH TWO DOTS VERTICALLY BELOW AND SMALL TAH;Lo;0;AL;;;;;N;;;;; +075A;ARABIC LETTER DAL WITH INVERTED SMALL V BELOW;Lo;0;AL;;;;;N;;;;; +075B;ARABIC LETTER REH WITH STROKE;Lo;0;AL;;;;;N;;;;; +075C;ARABIC LETTER SEEN WITH FOUR DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +075D;ARABIC LETTER AIN WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +075E;ARABIC LETTER AIN WITH THREE DOTS POINTING DOWNWARDS ABOVE;Lo;0;AL;;;;;N;;;;; +075F;ARABIC LETTER AIN WITH TWO DOTS VERTICALLY ABOVE;Lo;0;AL;;;;;N;;;;; +0760;ARABIC LETTER FEH WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;; +0761;ARABIC LETTER FEH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;; +0762;ARABIC LETTER KEHEH WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;; +0763;ARABIC LETTER KEHEH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0764;ARABIC LETTER KEHEH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;; +0765;ARABIC LETTER MEEM WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;; +0766;ARABIC LETTER MEEM WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +0767;ARABIC LETTER NOON WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;; +0768;ARABIC LETTER NOON WITH SMALL TAH;Lo;0;AL;;;;;N;;;;; +0769;ARABIC LETTER NOON WITH SMALL V;Lo;0;AL;;;;;N;;;;; +076A;ARABIC LETTER LAM WITH BAR;Lo;0;AL;;;;;N;;;;; +076B;ARABIC LETTER REH WITH TWO DOTS VERTICALLY ABOVE;Lo;0;AL;;;;;N;;;;; +076C;ARABIC LETTER REH WITH HAMZA ABOVE;Lo;0;AL;;;;;N;;;;; +076D;ARABIC LETTER SEEN WITH TWO DOTS VERTICALLY ABOVE;Lo;0;AL;;;;;N;;;;; +076E;ARABIC LETTER HAH WITH SMALL ARABIC LETTER TAH BELOW;Lo;0;AL;;;;;N;;;;; +076F;ARABIC LETTER HAH WITH SMALL ARABIC LETTER TAH AND TWO DOTS;Lo;0;AL;;;;;N;;;;; +0770;ARABIC LETTER SEEN WITH SMALL ARABIC LETTER TAH AND TWO DOTS;Lo;0;AL;;;;;N;;;;; +0771;ARABIC LETTER REH WITH SMALL ARABIC LETTER TAH AND TWO DOTS;Lo;0;AL;;;;;N;;;;; +0772;ARABIC LETTER HAH WITH SMALL ARABIC LETTER TAH ABOVE;Lo;0;AL;;;;;N;;;;; +0773;ARABIC LETTER ALEF WITH EXTENDED ARABIC-INDIC DIGIT TWO ABOVE;Lo;0;AL;;;;;N;;;;; +0774;ARABIC LETTER ALEF WITH EXTENDED ARABIC-INDIC DIGIT THREE ABOVE;Lo;0;AL;;;;;N;;;;; +0775;ARABIC LETTER FARSI YEH WITH EXTENDED ARABIC-INDIC DIGIT TWO ABOVE;Lo;0;AL;;;;;N;;;;; +0776;ARABIC LETTER FARSI YEH WITH EXTENDED ARABIC-INDIC DIGIT THREE ABOVE;Lo;0;AL;;;;;N;;;;; +0777;ARABIC LETTER FARSI YEH WITH EXTENDED ARABIC-INDIC DIGIT FOUR BELOW;Lo;0;AL;;;;;N;;;;; +0778;ARABIC LETTER WAW WITH EXTENDED ARABIC-INDIC DIGIT TWO ABOVE;Lo;0;AL;;;;;N;;;;; +0779;ARABIC LETTER WAW WITH EXTENDED ARABIC-INDIC DIGIT THREE ABOVE;Lo;0;AL;;;;;N;;;;; +077A;ARABIC LETTER YEH BARREE WITH EXTENDED ARABIC-INDIC DIGIT TWO ABOVE;Lo;0;AL;;;;;N;;;;; +077B;ARABIC LETTER YEH BARREE WITH EXTENDED ARABIC-INDIC DIGIT THREE ABOVE;Lo;0;AL;;;;;N;;;;; +077C;ARABIC LETTER HAH WITH EXTENDED ARABIC-INDIC DIGIT FOUR BELOW;Lo;0;AL;;;;;N;;;;; +077D;ARABIC LETTER SEEN WITH EXTENDED ARABIC-INDIC DIGIT FOUR ABOVE;Lo;0;AL;;;;;N;;;;; +077E;ARABIC LETTER SEEN WITH INVERTED V;Lo;0;AL;;;;;N;;;;; +077F;ARABIC LETTER KAF WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +0780;THAANA LETTER HAA;Lo;0;AL;;;;;N;;;;; +0781;THAANA LETTER SHAVIYANI;Lo;0;AL;;;;;N;;;;; +0782;THAANA LETTER NOONU;Lo;0;AL;;;;;N;;;;; +0783;THAANA LETTER RAA;Lo;0;AL;;;;;N;;;;; +0784;THAANA LETTER BAA;Lo;0;AL;;;;;N;;;;; +0785;THAANA LETTER LHAVIYANI;Lo;0;AL;;;;;N;;;;; +0786;THAANA LETTER KAAFU;Lo;0;AL;;;;;N;;;;; +0787;THAANA LETTER ALIFU;Lo;0;AL;;;;;N;;;;; +0788;THAANA LETTER VAAVU;Lo;0;AL;;;;;N;;;;; +0789;THAANA LETTER MEEMU;Lo;0;AL;;;;;N;;;;; +078A;THAANA LETTER FAAFU;Lo;0;AL;;;;;N;;;;; +078B;THAANA LETTER DHAALU;Lo;0;AL;;;;;N;;;;; +078C;THAANA LETTER THAA;Lo;0;AL;;;;;N;;;;; +078D;THAANA LETTER LAAMU;Lo;0;AL;;;;;N;;;;; +078E;THAANA LETTER GAAFU;Lo;0;AL;;;;;N;;;;; +078F;THAANA LETTER GNAVIYANI;Lo;0;AL;;;;;N;;;;; +0790;THAANA LETTER SEENU;Lo;0;AL;;;;;N;;;;; +0791;THAANA LETTER DAVIYANI;Lo;0;AL;;;;;N;;;;; +0792;THAANA LETTER ZAVIYANI;Lo;0;AL;;;;;N;;;;; +0793;THAANA LETTER TAVIYANI;Lo;0;AL;;;;;N;;;;; +0794;THAANA LETTER YAA;Lo;0;AL;;;;;N;;;;; +0795;THAANA LETTER PAVIYANI;Lo;0;AL;;;;;N;;;;; +0796;THAANA LETTER JAVIYANI;Lo;0;AL;;;;;N;;;;; +0797;THAANA LETTER CHAVIYANI;Lo;0;AL;;;;;N;;;;; +0798;THAANA LETTER TTAA;Lo;0;AL;;;;;N;;;;; +0799;THAANA LETTER HHAA;Lo;0;AL;;;;;N;;;;; +079A;THAANA LETTER KHAA;Lo;0;AL;;;;;N;;;;; +079B;THAANA LETTER THAALU;Lo;0;AL;;;;;N;;;;; +079C;THAANA LETTER ZAA;Lo;0;AL;;;;;N;;;;; +079D;THAANA LETTER SHEENU;Lo;0;AL;;;;;N;;;;; +079E;THAANA LETTER SAADHU;Lo;0;AL;;;;;N;;;;; +079F;THAANA LETTER DAADHU;Lo;0;AL;;;;;N;;;;; +07A0;THAANA LETTER TO;Lo;0;AL;;;;;N;;;;; +07A1;THAANA LETTER ZO;Lo;0;AL;;;;;N;;;;; +07A2;THAANA LETTER AINU;Lo;0;AL;;;;;N;;;;; +07A3;THAANA LETTER GHAINU;Lo;0;AL;;;;;N;;;;; +07A4;THAANA LETTER QAAFU;Lo;0;AL;;;;;N;;;;; +07A5;THAANA LETTER WAAVU;Lo;0;AL;;;;;N;;;;; +07A6;THAANA ABAFILI;Mn;0;NSM;;;;;N;;;;; +07A7;THAANA AABAAFILI;Mn;0;NSM;;;;;N;;;;; +07A8;THAANA IBIFILI;Mn;0;NSM;;;;;N;;;;; +07A9;THAANA EEBEEFILI;Mn;0;NSM;;;;;N;;;;; +07AA;THAANA UBUFILI;Mn;0;NSM;;;;;N;;;;; +07AB;THAANA OOBOOFILI;Mn;0;NSM;;;;;N;;;;; +07AC;THAANA EBEFILI;Mn;0;NSM;;;;;N;;;;; +07AD;THAANA EYBEYFILI;Mn;0;NSM;;;;;N;;;;; +07AE;THAANA OBOFILI;Mn;0;NSM;;;;;N;;;;; +07AF;THAANA OABOAFILI;Mn;0;NSM;;;;;N;;;;; +07B0;THAANA SUKUN;Mn;0;NSM;;;;;N;;;;; +07B1;THAANA LETTER NAA;Lo;0;AL;;;;;N;;;;; +07C0;NKO DIGIT ZERO;Nd;0;R;;0;0;0;N;;;;; +07C1;NKO DIGIT ONE;Nd;0;R;;1;1;1;N;;;;; +07C2;NKO DIGIT TWO;Nd;0;R;;2;2;2;N;;;;; +07C3;NKO DIGIT THREE;Nd;0;R;;3;3;3;N;;;;; +07C4;NKO DIGIT FOUR;Nd;0;R;;4;4;4;N;;;;; +07C5;NKO DIGIT FIVE;Nd;0;R;;5;5;5;N;;;;; +07C6;NKO DIGIT SIX;Nd;0;R;;6;6;6;N;;;;; +07C7;NKO DIGIT SEVEN;Nd;0;R;;7;7;7;N;;;;; +07C8;NKO DIGIT EIGHT;Nd;0;R;;8;8;8;N;;;;; +07C9;NKO DIGIT NINE;Nd;0;R;;9;9;9;N;;;;; +07CA;NKO LETTER A;Lo;0;R;;;;;N;;;;; +07CB;NKO LETTER EE;Lo;0;R;;;;;N;;;;; +07CC;NKO LETTER I;Lo;0;R;;;;;N;;;;; +07CD;NKO LETTER E;Lo;0;R;;;;;N;;;;; +07CE;NKO LETTER U;Lo;0;R;;;;;N;;;;; +07CF;NKO LETTER OO;Lo;0;R;;;;;N;;;;; +07D0;NKO LETTER O;Lo;0;R;;;;;N;;;;; +07D1;NKO LETTER DAGBASINNA;Lo;0;R;;;;;N;;;;; +07D2;NKO LETTER N;Lo;0;R;;;;;N;;;;; +07D3;NKO LETTER BA;Lo;0;R;;;;;N;;;;; +07D4;NKO LETTER PA;Lo;0;R;;;;;N;;;;; +07D5;NKO LETTER TA;Lo;0;R;;;;;N;;;;; +07D6;NKO LETTER JA;Lo;0;R;;;;;N;;;;; +07D7;NKO LETTER CHA;Lo;0;R;;;;;N;;;;; +07D8;NKO LETTER DA;Lo;0;R;;;;;N;;;;; +07D9;NKO LETTER RA;Lo;0;R;;;;;N;;;;; +07DA;NKO LETTER RRA;Lo;0;R;;;;;N;;;;; +07DB;NKO LETTER SA;Lo;0;R;;;;;N;;;;; +07DC;NKO LETTER GBA;Lo;0;R;;;;;N;;;;; +07DD;NKO LETTER FA;Lo;0;R;;;;;N;;;;; +07DE;NKO LETTER KA;Lo;0;R;;;;;N;;;;; +07DF;NKO LETTER LA;Lo;0;R;;;;;N;;;;; +07E0;NKO LETTER NA WOLOSO;Lo;0;R;;;;;N;;;;; +07E1;NKO LETTER MA;Lo;0;R;;;;;N;;;;; +07E2;NKO LETTER NYA;Lo;0;R;;;;;N;;;;; +07E3;NKO LETTER NA;Lo;0;R;;;;;N;;;;; +07E4;NKO LETTER HA;Lo;0;R;;;;;N;;;;; +07E5;NKO LETTER WA;Lo;0;R;;;;;N;;;;; +07E6;NKO LETTER YA;Lo;0;R;;;;;N;;;;; +07E7;NKO LETTER NYA WOLOSO;Lo;0;R;;;;;N;;;;; +07E8;NKO LETTER JONA JA;Lo;0;R;;;;;N;;;;; +07E9;NKO LETTER JONA CHA;Lo;0;R;;;;;N;;;;; +07EA;NKO LETTER JONA RA;Lo;0;R;;;;;N;;;;; +07EB;NKO COMBINING SHORT HIGH TONE;Mn;230;NSM;;;;;N;;;;; +07EC;NKO COMBINING SHORT LOW TONE;Mn;230;NSM;;;;;N;;;;; +07ED;NKO COMBINING SHORT RISING TONE;Mn;230;NSM;;;;;N;;;;; +07EE;NKO COMBINING LONG DESCENDING TONE;Mn;230;NSM;;;;;N;;;;; +07EF;NKO COMBINING LONG HIGH TONE;Mn;230;NSM;;;;;N;;;;; +07F0;NKO COMBINING LONG LOW TONE;Mn;230;NSM;;;;;N;;;;; +07F1;NKO COMBINING LONG RISING TONE;Mn;230;NSM;;;;;N;;;;; +07F2;NKO COMBINING NASALIZATION MARK;Mn;220;NSM;;;;;N;;;;; +07F3;NKO COMBINING DOUBLE DOT ABOVE;Mn;230;NSM;;;;;N;;;;; +07F4;NKO HIGH TONE APOSTROPHE;Lm;0;R;;;;;N;;;;; +07F5;NKO LOW TONE APOSTROPHE;Lm;0;R;;;;;N;;;;; +07F6;NKO SYMBOL OO DENNEN;So;0;ON;;;;;N;;;;; +07F7;NKO SYMBOL GBAKURUNEN;Po;0;ON;;;;;N;;;;; +07F8;NKO COMMA;Po;0;ON;;;;;N;;;;; +07F9;NKO EXCLAMATION MARK;Po;0;ON;;;;;N;;;;; +07FA;NKO LAJANYALAN;Lm;0;R;;;;;N;;;;; +0800;SAMARITAN LETTER ALAF;Lo;0;R;;;;;N;;;;; +0801;SAMARITAN LETTER BIT;Lo;0;R;;;;;N;;;;; +0802;SAMARITAN LETTER GAMAN;Lo;0;R;;;;;N;;;;; +0803;SAMARITAN LETTER DALAT;Lo;0;R;;;;;N;;;;; +0804;SAMARITAN LETTER IY;Lo;0;R;;;;;N;;;;; +0805;SAMARITAN LETTER BAA;Lo;0;R;;;;;N;;;;; +0806;SAMARITAN LETTER ZEN;Lo;0;R;;;;;N;;;;; +0807;SAMARITAN LETTER IT;Lo;0;R;;;;;N;;;;; +0808;SAMARITAN LETTER TIT;Lo;0;R;;;;;N;;;;; +0809;SAMARITAN LETTER YUT;Lo;0;R;;;;;N;;;;; +080A;SAMARITAN LETTER KAAF;Lo;0;R;;;;;N;;;;; +080B;SAMARITAN LETTER LABAT;Lo;0;R;;;;;N;;;;; +080C;SAMARITAN LETTER MIM;Lo;0;R;;;;;N;;;;; +080D;SAMARITAN LETTER NUN;Lo;0;R;;;;;N;;;;; +080E;SAMARITAN LETTER SINGAAT;Lo;0;R;;;;;N;;;;; +080F;SAMARITAN LETTER IN;Lo;0;R;;;;;N;;;;; +0810;SAMARITAN LETTER FI;Lo;0;R;;;;;N;;;;; +0811;SAMARITAN LETTER TSAADIY;Lo;0;R;;;;;N;;;;; +0812;SAMARITAN LETTER QUF;Lo;0;R;;;;;N;;;;; +0813;SAMARITAN LETTER RISH;Lo;0;R;;;;;N;;;;; +0814;SAMARITAN LETTER SHAN;Lo;0;R;;;;;N;;;;; +0815;SAMARITAN LETTER TAAF;Lo;0;R;;;;;N;;;;; +0816;SAMARITAN MARK IN;Mn;230;NSM;;;;;N;;;;; +0817;SAMARITAN MARK IN-ALAF;Mn;230;NSM;;;;;N;;;;; +0818;SAMARITAN MARK OCCLUSION;Mn;230;NSM;;;;;N;;;;; +0819;SAMARITAN MARK DAGESH;Mn;230;NSM;;;;;N;;;;; +081A;SAMARITAN MODIFIER LETTER EPENTHETIC YUT;Lm;0;R;;;;;N;;;;; +081B;SAMARITAN MARK EPENTHETIC YUT;Mn;230;NSM;;;;;N;;;;; +081C;SAMARITAN VOWEL SIGN LONG E;Mn;230;NSM;;;;;N;;;;; +081D;SAMARITAN VOWEL SIGN E;Mn;230;NSM;;;;;N;;;;; +081E;SAMARITAN VOWEL SIGN OVERLONG AA;Mn;230;NSM;;;;;N;;;;; +081F;SAMARITAN VOWEL SIGN LONG AA;Mn;230;NSM;;;;;N;;;;; +0820;SAMARITAN VOWEL SIGN AA;Mn;230;NSM;;;;;N;;;;; +0821;SAMARITAN VOWEL SIGN OVERLONG A;Mn;230;NSM;;;;;N;;;;; +0822;SAMARITAN VOWEL SIGN LONG A;Mn;230;NSM;;;;;N;;;;; +0823;SAMARITAN VOWEL SIGN A;Mn;230;NSM;;;;;N;;;;; +0824;SAMARITAN MODIFIER LETTER SHORT A;Lm;0;R;;;;;N;;;;; +0825;SAMARITAN VOWEL SIGN SHORT A;Mn;230;NSM;;;;;N;;;;; +0826;SAMARITAN VOWEL SIGN LONG U;Mn;230;NSM;;;;;N;;;;; +0827;SAMARITAN VOWEL SIGN U;Mn;230;NSM;;;;;N;;;;; +0828;SAMARITAN MODIFIER LETTER I;Lm;0;R;;;;;N;;;;; +0829;SAMARITAN VOWEL SIGN LONG I;Mn;230;NSM;;;;;N;;;;; +082A;SAMARITAN VOWEL SIGN I;Mn;230;NSM;;;;;N;;;;; +082B;SAMARITAN VOWEL SIGN O;Mn;230;NSM;;;;;N;;;;; +082C;SAMARITAN VOWEL SIGN SUKUN;Mn;230;NSM;;;;;N;;;;; +082D;SAMARITAN MARK NEQUDAA;Mn;230;NSM;;;;;N;;;;; +0830;SAMARITAN PUNCTUATION NEQUDAA;Po;0;R;;;;;N;;;;; +0831;SAMARITAN PUNCTUATION AFSAAQ;Po;0;R;;;;;N;;;;; +0832;SAMARITAN PUNCTUATION ANGED;Po;0;R;;;;;N;;;;; +0833;SAMARITAN PUNCTUATION BAU;Po;0;R;;;;;N;;;;; +0834;SAMARITAN PUNCTUATION ATMAAU;Po;0;R;;;;;N;;;;; +0835;SAMARITAN PUNCTUATION SHIYYAALAA;Po;0;R;;;;;N;;;;; +0836;SAMARITAN ABBREVIATION MARK;Po;0;R;;;;;N;;;;; +0837;SAMARITAN PUNCTUATION MELODIC QITSA;Po;0;R;;;;;N;;;;; +0838;SAMARITAN PUNCTUATION ZIQAA;Po;0;R;;;;;N;;;;; +0839;SAMARITAN PUNCTUATION QITSA;Po;0;R;;;;;N;;;;; +083A;SAMARITAN PUNCTUATION ZAEF;Po;0;R;;;;;N;;;;; +083B;SAMARITAN PUNCTUATION TURU;Po;0;R;;;;;N;;;;; +083C;SAMARITAN PUNCTUATION ARKAANU;Po;0;R;;;;;N;;;;; +083D;SAMARITAN PUNCTUATION SOF MASHFAAT;Po;0;R;;;;;N;;;;; +083E;SAMARITAN PUNCTUATION ANNAAU;Po;0;R;;;;;N;;;;; +0840;MANDAIC LETTER HALQA;Lo;0;R;;;;;N;;;;; +0841;MANDAIC LETTER AB;Lo;0;R;;;;;N;;;;; +0842;MANDAIC LETTER AG;Lo;0;R;;;;;N;;;;; +0843;MANDAIC LETTER AD;Lo;0;R;;;;;N;;;;; +0844;MANDAIC LETTER AH;Lo;0;R;;;;;N;;;;; +0845;MANDAIC LETTER USHENNA;Lo;0;R;;;;;N;;;;; +0846;MANDAIC LETTER AZ;Lo;0;R;;;;;N;;;;; +0847;MANDAIC LETTER IT;Lo;0;R;;;;;N;;;;; +0848;MANDAIC LETTER ATT;Lo;0;R;;;;;N;;;;; +0849;MANDAIC LETTER AKSA;Lo;0;R;;;;;N;;;;; +084A;MANDAIC LETTER AK;Lo;0;R;;;;;N;;;;; +084B;MANDAIC LETTER AL;Lo;0;R;;;;;N;;;;; +084C;MANDAIC LETTER AM;Lo;0;R;;;;;N;;;;; +084D;MANDAIC LETTER AN;Lo;0;R;;;;;N;;;;; +084E;MANDAIC LETTER AS;Lo;0;R;;;;;N;;;;; +084F;MANDAIC LETTER IN;Lo;0;R;;;;;N;;;;; +0850;MANDAIC LETTER AP;Lo;0;R;;;;;N;;;;; +0851;MANDAIC LETTER ASZ;Lo;0;R;;;;;N;;;;; +0852;MANDAIC LETTER AQ;Lo;0;R;;;;;N;;;;; +0853;MANDAIC LETTER AR;Lo;0;R;;;;;N;;;;; +0854;MANDAIC LETTER ASH;Lo;0;R;;;;;N;;;;; +0855;MANDAIC LETTER AT;Lo;0;R;;;;;N;;;;; +0856;MANDAIC LETTER DUSHENNA;Lo;0;R;;;;;N;;;;; +0857;MANDAIC LETTER KAD;Lo;0;R;;;;;N;;;;; +0858;MANDAIC LETTER AIN;Lo;0;R;;;;;N;;;;; +0859;MANDAIC AFFRICATION MARK;Mn;220;NSM;;;;;N;;;;; +085A;MANDAIC VOCALIZATION MARK;Mn;220;NSM;;;;;N;;;;; +085B;MANDAIC GEMINATION MARK;Mn;220;NSM;;;;;N;;;;; +085E;MANDAIC PUNCTUATION;Po;0;R;;;;;N;;;;; +0860;SYRIAC LETTER MALAYALAM NGA;Lo;0;AL;;;;;N;;;;; +0861;SYRIAC LETTER MALAYALAM JA;Lo;0;AL;;;;;N;;;;; +0862;SYRIAC LETTER MALAYALAM NYA;Lo;0;AL;;;;;N;;;;; +0863;SYRIAC LETTER MALAYALAM TTA;Lo;0;AL;;;;;N;;;;; +0864;SYRIAC LETTER MALAYALAM NNA;Lo;0;AL;;;;;N;;;;; +0865;SYRIAC LETTER MALAYALAM NNNA;Lo;0;AL;;;;;N;;;;; +0866;SYRIAC LETTER MALAYALAM BHA;Lo;0;AL;;;;;N;;;;; +0867;SYRIAC LETTER MALAYALAM RA;Lo;0;AL;;;;;N;;;;; +0868;SYRIAC LETTER MALAYALAM LLA;Lo;0;AL;;;;;N;;;;; +0869;SYRIAC LETTER MALAYALAM LLLA;Lo;0;AL;;;;;N;;;;; +086A;SYRIAC LETTER MALAYALAM SSA;Lo;0;AL;;;;;N;;;;; +08A0;ARABIC LETTER BEH WITH SMALL V BELOW;Lo;0;AL;;;;;N;;;;; +08A1;ARABIC LETTER BEH WITH HAMZA ABOVE;Lo;0;AL;;;;;N;;;;; +08A2;ARABIC LETTER JEEM WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +08A3;ARABIC LETTER TAH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +08A4;ARABIC LETTER FEH WITH DOT BELOW AND THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +08A5;ARABIC LETTER QAF WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +08A6;ARABIC LETTER LAM WITH DOUBLE BAR;Lo;0;AL;;;;;N;;;;; +08A7;ARABIC LETTER MEEM WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;; +08A8;ARABIC LETTER YEH WITH TWO DOTS BELOW AND HAMZA ABOVE;Lo;0;AL;;;;;N;;;;; +08A9;ARABIC LETTER YEH WITH TWO DOTS BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;;;;; +08AA;ARABIC LETTER REH WITH LOOP;Lo;0;AL;;;;;N;;;;; +08AB;ARABIC LETTER WAW WITH DOT WITHIN;Lo;0;AL;;;;;N;;;;; +08AC;ARABIC LETTER ROHINGYA YEH;Lo;0;AL;;;;;N;;;;; +08AD;ARABIC LETTER LOW ALEF;Lo;0;AL;;;;;N;;;;; +08AE;ARABIC LETTER DAL WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; +08AF;ARABIC LETTER SAD WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; +08B0;ARABIC LETTER GAF WITH INVERTED STROKE;Lo;0;AL;;;;;N;;;;; +08B1;ARABIC LETTER STRAIGHT WAW;Lo;0;AL;;;;;N;;;;; +08B2;ARABIC LETTER ZAIN WITH INVERTED V ABOVE;Lo;0;AL;;;;;N;;;;; +08B3;ARABIC LETTER AIN WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;; +08B4;ARABIC LETTER KAF WITH DOT BELOW;Lo;0;AL;;;;;N;;;;; +08B6;ARABIC LETTER BEH WITH SMALL MEEM ABOVE;Lo;0;AL;;;;;N;;;;; +08B7;ARABIC LETTER PEH WITH SMALL MEEM ABOVE;Lo;0;AL;;;;;N;;;;; +08B8;ARABIC LETTER TEH WITH SMALL TEH ABOVE;Lo;0;AL;;;;;N;;;;; +08B9;ARABIC LETTER REH WITH SMALL NOON ABOVE;Lo;0;AL;;;;;N;;;;; +08BA;ARABIC LETTER YEH WITH TWO DOTS BELOW AND SMALL NOON ABOVE;Lo;0;AL;;;;;N;;;;; +08BB;ARABIC LETTER AFRICAN FEH;Lo;0;AL;;;;;N;;;;; +08BC;ARABIC LETTER AFRICAN QAF;Lo;0;AL;;;;;N;;;;; +08BD;ARABIC LETTER AFRICAN NOON;Lo;0;AL;;;;;N;;;;; +08D4;ARABIC SMALL HIGH WORD AR-RUB;Mn;230;NSM;;;;;N;;;;; +08D5;ARABIC SMALL HIGH SAD;Mn;230;NSM;;;;;N;;;;; +08D6;ARABIC SMALL HIGH AIN;Mn;230;NSM;;;;;N;;;;; +08D7;ARABIC SMALL HIGH QAF;Mn;230;NSM;;;;;N;;;;; +08D8;ARABIC SMALL HIGH NOON WITH KASRA;Mn;230;NSM;;;;;N;;;;; +08D9;ARABIC SMALL LOW NOON WITH KASRA;Mn;230;NSM;;;;;N;;;;; +08DA;ARABIC SMALL HIGH WORD ATH-THALATHA;Mn;230;NSM;;;;;N;;;;; +08DB;ARABIC SMALL HIGH WORD AS-SAJDA;Mn;230;NSM;;;;;N;;;;; +08DC;ARABIC SMALL HIGH WORD AN-NISF;Mn;230;NSM;;;;;N;;;;; +08DD;ARABIC SMALL HIGH WORD SAKTA;Mn;230;NSM;;;;;N;;;;; +08DE;ARABIC SMALL HIGH WORD QIF;Mn;230;NSM;;;;;N;;;;; +08DF;ARABIC SMALL HIGH WORD WAQFA;Mn;230;NSM;;;;;N;;;;; +08E0;ARABIC SMALL HIGH FOOTNOTE MARKER;Mn;230;NSM;;;;;N;;;;; +08E1;ARABIC SMALL HIGH SIGN SAFHA;Mn;230;NSM;;;;;N;;;;; +08E2;ARABIC DISPUTED END OF AYAH;Cf;0;AN;;;;;N;;;;; +08E3;ARABIC TURNED DAMMA BELOW;Mn;220;NSM;;;;;N;;;;; +08E4;ARABIC CURLY FATHA;Mn;230;NSM;;;;;N;;;;; +08E5;ARABIC CURLY DAMMA;Mn;230;NSM;;;;;N;;;;; +08E6;ARABIC CURLY KASRA;Mn;220;NSM;;;;;N;;;;; +08E7;ARABIC CURLY FATHATAN;Mn;230;NSM;;;;;N;;;;; +08E8;ARABIC CURLY DAMMATAN;Mn;230;NSM;;;;;N;;;;; +08E9;ARABIC CURLY KASRATAN;Mn;220;NSM;;;;;N;;;;; +08EA;ARABIC TONE ONE DOT ABOVE;Mn;230;NSM;;;;;N;;;;; +08EB;ARABIC TONE TWO DOTS ABOVE;Mn;230;NSM;;;;;N;;;;; +08EC;ARABIC TONE LOOP ABOVE;Mn;230;NSM;;;;;N;;;;; +08ED;ARABIC TONE ONE DOT BELOW;Mn;220;NSM;;;;;N;;;;; +08EE;ARABIC TONE TWO DOTS BELOW;Mn;220;NSM;;;;;N;;;;; +08EF;ARABIC TONE LOOP BELOW;Mn;220;NSM;;;;;N;;;;; +08F0;ARABIC OPEN FATHATAN;Mn;27;NSM;;;;;N;;;;; +08F1;ARABIC OPEN DAMMATAN;Mn;28;NSM;;;;;N;;;;; +08F2;ARABIC OPEN KASRATAN;Mn;29;NSM;;;;;N;;;;; +08F3;ARABIC SMALL HIGH WAW;Mn;230;NSM;;;;;N;;;;; +08F4;ARABIC FATHA WITH RING;Mn;230;NSM;;;;;N;;;;; +08F5;ARABIC FATHA WITH DOT ABOVE;Mn;230;NSM;;;;;N;;;;; +08F6;ARABIC KASRA WITH DOT BELOW;Mn;220;NSM;;;;;N;;;;; +08F7;ARABIC LEFT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;; +08F8;ARABIC RIGHT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;; +08F9;ARABIC LEFT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;; +08FA;ARABIC RIGHT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;; +08FB;ARABIC DOUBLE RIGHT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;; +08FC;ARABIC DOUBLE RIGHT ARROWHEAD ABOVE WITH DOT;Mn;230;NSM;;;;;N;;;;; +08FD;ARABIC RIGHT ARROWHEAD ABOVE WITH DOT;Mn;230;NSM;;;;;N;;;;; +08FE;ARABIC DAMMA WITH DOT;Mn;230;NSM;;;;;N;;;;; +08FF;ARABIC MARK SIDEWAYS NOON GHUNNA;Mn;230;NSM;;;;;N;;;;; +0900;DEVANAGARI SIGN INVERTED CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0901;DEVANAGARI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0902;DEVANAGARI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +0903;DEVANAGARI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0904;DEVANAGARI LETTER SHORT A;Lo;0;L;;;;;N;;;;; +0905;DEVANAGARI LETTER A;Lo;0;L;;;;;N;;;;; +0906;DEVANAGARI LETTER AA;Lo;0;L;;;;;N;;;;; +0907;DEVANAGARI LETTER I;Lo;0;L;;;;;N;;;;; +0908;DEVANAGARI LETTER II;Lo;0;L;;;;;N;;;;; +0909;DEVANAGARI LETTER U;Lo;0;L;;;;;N;;;;; +090A;DEVANAGARI LETTER UU;Lo;0;L;;;;;N;;;;; +090B;DEVANAGARI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +090C;DEVANAGARI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +090D;DEVANAGARI LETTER CANDRA E;Lo;0;L;;;;;N;;;;; +090E;DEVANAGARI LETTER SHORT E;Lo;0;L;;;;;N;;;;; +090F;DEVANAGARI LETTER E;Lo;0;L;;;;;N;;;;; +0910;DEVANAGARI LETTER AI;Lo;0;L;;;;;N;;;;; +0911;DEVANAGARI LETTER CANDRA O;Lo;0;L;;;;;N;;;;; +0912;DEVANAGARI LETTER SHORT O;Lo;0;L;;;;;N;;;;; +0913;DEVANAGARI LETTER O;Lo;0;L;;;;;N;;;;; +0914;DEVANAGARI LETTER AU;Lo;0;L;;;;;N;;;;; +0915;DEVANAGARI LETTER KA;Lo;0;L;;;;;N;;;;; +0916;DEVANAGARI LETTER KHA;Lo;0;L;;;;;N;;;;; +0917;DEVANAGARI LETTER GA;Lo;0;L;;;;;N;;;;; +0918;DEVANAGARI LETTER GHA;Lo;0;L;;;;;N;;;;; +0919;DEVANAGARI LETTER NGA;Lo;0;L;;;;;N;;;;; +091A;DEVANAGARI LETTER CA;Lo;0;L;;;;;N;;;;; +091B;DEVANAGARI LETTER CHA;Lo;0;L;;;;;N;;;;; +091C;DEVANAGARI LETTER JA;Lo;0;L;;;;;N;;;;; +091D;DEVANAGARI LETTER JHA;Lo;0;L;;;;;N;;;;; +091E;DEVANAGARI LETTER NYA;Lo;0;L;;;;;N;;;;; +091F;DEVANAGARI LETTER TTA;Lo;0;L;;;;;N;;;;; +0920;DEVANAGARI LETTER TTHA;Lo;0;L;;;;;N;;;;; +0921;DEVANAGARI LETTER DDA;Lo;0;L;;;;;N;;;;; +0922;DEVANAGARI LETTER DDHA;Lo;0;L;;;;;N;;;;; +0923;DEVANAGARI LETTER NNA;Lo;0;L;;;;;N;;;;; +0924;DEVANAGARI LETTER TA;Lo;0;L;;;;;N;;;;; +0925;DEVANAGARI LETTER THA;Lo;0;L;;;;;N;;;;; +0926;DEVANAGARI LETTER DA;Lo;0;L;;;;;N;;;;; +0927;DEVANAGARI LETTER DHA;Lo;0;L;;;;;N;;;;; +0928;DEVANAGARI LETTER NA;Lo;0;L;;;;;N;;;;; +0929;DEVANAGARI LETTER NNNA;Lo;0;L;0928 093C;;;;N;;;;; +092A;DEVANAGARI LETTER PA;Lo;0;L;;;;;N;;;;; +092B;DEVANAGARI LETTER PHA;Lo;0;L;;;;;N;;;;; +092C;DEVANAGARI LETTER BA;Lo;0;L;;;;;N;;;;; +092D;DEVANAGARI LETTER BHA;Lo;0;L;;;;;N;;;;; +092E;DEVANAGARI LETTER MA;Lo;0;L;;;;;N;;;;; +092F;DEVANAGARI LETTER YA;Lo;0;L;;;;;N;;;;; +0930;DEVANAGARI LETTER RA;Lo;0;L;;;;;N;;;;; +0931;DEVANAGARI LETTER RRA;Lo;0;L;0930 093C;;;;N;;;;; +0932;DEVANAGARI LETTER LA;Lo;0;L;;;;;N;;;;; +0933;DEVANAGARI LETTER LLA;Lo;0;L;;;;;N;;;;; +0934;DEVANAGARI LETTER LLLA;Lo;0;L;0933 093C;;;;N;;;;; +0935;DEVANAGARI LETTER VA;Lo;0;L;;;;;N;;;;; +0936;DEVANAGARI LETTER SHA;Lo;0;L;;;;;N;;;;; +0937;DEVANAGARI LETTER SSA;Lo;0;L;;;;;N;;;;; +0938;DEVANAGARI LETTER SA;Lo;0;L;;;;;N;;;;; +0939;DEVANAGARI LETTER HA;Lo;0;L;;;;;N;;;;; +093A;DEVANAGARI VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;; +093B;DEVANAGARI VOWEL SIGN OOE;Mc;0;L;;;;;N;;;;; +093C;DEVANAGARI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +093D;DEVANAGARI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +093E;DEVANAGARI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +093F;DEVANAGARI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +0940;DEVANAGARI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +0941;DEVANAGARI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +0942;DEVANAGARI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +0943;DEVANAGARI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +0944;DEVANAGARI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +0945;DEVANAGARI VOWEL SIGN CANDRA E;Mn;0;NSM;;;;;N;;;;; +0946;DEVANAGARI VOWEL SIGN SHORT E;Mn;0;NSM;;;;;N;;;;; +0947;DEVANAGARI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +0948;DEVANAGARI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +0949;DEVANAGARI VOWEL SIGN CANDRA O;Mc;0;L;;;;;N;;;;; +094A;DEVANAGARI VOWEL SIGN SHORT O;Mc;0;L;;;;;N;;;;; +094B;DEVANAGARI VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +094C;DEVANAGARI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +094D;DEVANAGARI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +094E;DEVANAGARI VOWEL SIGN PRISHTHAMATRA E;Mc;0;L;;;;;N;;;;; +094F;DEVANAGARI VOWEL SIGN AW;Mc;0;L;;;;;N;;;;; +0950;DEVANAGARI OM;Lo;0;L;;;;;N;;;;; +0951;DEVANAGARI STRESS SIGN UDATTA;Mn;230;NSM;;;;;N;;;;; +0952;DEVANAGARI STRESS SIGN ANUDATTA;Mn;220;NSM;;;;;N;;;;; +0953;DEVANAGARI GRAVE ACCENT;Mn;230;NSM;;;;;N;;;;; +0954;DEVANAGARI ACUTE ACCENT;Mn;230;NSM;;;;;N;;;;; +0955;DEVANAGARI VOWEL SIGN CANDRA LONG E;Mn;0;NSM;;;;;N;;;;; +0956;DEVANAGARI VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +0957;DEVANAGARI VOWEL SIGN UUE;Mn;0;NSM;;;;;N;;;;; +0958;DEVANAGARI LETTER QA;Lo;0;L;0915 093C;;;;N;;;;; +0959;DEVANAGARI LETTER KHHA;Lo;0;L;0916 093C;;;;N;;;;; +095A;DEVANAGARI LETTER GHHA;Lo;0;L;0917 093C;;;;N;;;;; +095B;DEVANAGARI LETTER ZA;Lo;0;L;091C 093C;;;;N;;;;; +095C;DEVANAGARI LETTER DDDHA;Lo;0;L;0921 093C;;;;N;;;;; +095D;DEVANAGARI LETTER RHA;Lo;0;L;0922 093C;;;;N;;;;; +095E;DEVANAGARI LETTER FA;Lo;0;L;092B 093C;;;;N;;;;; +095F;DEVANAGARI LETTER YYA;Lo;0;L;092F 093C;;;;N;;;;; +0960;DEVANAGARI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +0961;DEVANAGARI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +0962;DEVANAGARI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +0963;DEVANAGARI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +0964;DEVANAGARI DANDA;Po;0;L;;;;;N;;;;; +0965;DEVANAGARI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +0966;DEVANAGARI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0967;DEVANAGARI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0968;DEVANAGARI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0969;DEVANAGARI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +096A;DEVANAGARI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +096B;DEVANAGARI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +096C;DEVANAGARI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +096D;DEVANAGARI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +096E;DEVANAGARI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +096F;DEVANAGARI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0970;DEVANAGARI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +0971;DEVANAGARI SIGN HIGH SPACING DOT;Lm;0;L;;;;;N;;;;; +0972;DEVANAGARI LETTER CANDRA A;Lo;0;L;;;;;N;;;;; +0973;DEVANAGARI LETTER OE;Lo;0;L;;;;;N;;;;; +0974;DEVANAGARI LETTER OOE;Lo;0;L;;;;;N;;;;; +0975;DEVANAGARI LETTER AW;Lo;0;L;;;;;N;;;;; +0976;DEVANAGARI LETTER UE;Lo;0;L;;;;;N;;;;; +0977;DEVANAGARI LETTER UUE;Lo;0;L;;;;;N;;;;; +0978;DEVANAGARI LETTER MARWARI DDA;Lo;0;L;;;;;N;;;;; +0979;DEVANAGARI LETTER ZHA;Lo;0;L;;;;;N;;;;; +097A;DEVANAGARI LETTER HEAVY YA;Lo;0;L;;;;;N;;;;; +097B;DEVANAGARI LETTER GGA;Lo;0;L;;;;;N;;;;; +097C;DEVANAGARI LETTER JJA;Lo;0;L;;;;;N;;;;; +097D;DEVANAGARI LETTER GLOTTAL STOP;Lo;0;L;;;;;N;;;;; +097E;DEVANAGARI LETTER DDDA;Lo;0;L;;;;;N;;;;; +097F;DEVANAGARI LETTER BBA;Lo;0;L;;;;;N;;;;; +0980;BENGALI ANJI;Lo;0;L;;;;;N;;;;; +0981;BENGALI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0982;BENGALI SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +0983;BENGALI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0985;BENGALI LETTER A;Lo;0;L;;;;;N;;;;; +0986;BENGALI LETTER AA;Lo;0;L;;;;;N;;;;; +0987;BENGALI LETTER I;Lo;0;L;;;;;N;;;;; +0988;BENGALI LETTER II;Lo;0;L;;;;;N;;;;; +0989;BENGALI LETTER U;Lo;0;L;;;;;N;;;;; +098A;BENGALI LETTER UU;Lo;0;L;;;;;N;;;;; +098B;BENGALI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +098C;BENGALI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +098F;BENGALI LETTER E;Lo;0;L;;;;;N;;;;; +0990;BENGALI LETTER AI;Lo;0;L;;;;;N;;;;; +0993;BENGALI LETTER O;Lo;0;L;;;;;N;;;;; +0994;BENGALI LETTER AU;Lo;0;L;;;;;N;;;;; +0995;BENGALI LETTER KA;Lo;0;L;;;;;N;;;;; +0996;BENGALI LETTER KHA;Lo;0;L;;;;;N;;;;; +0997;BENGALI LETTER GA;Lo;0;L;;;;;N;;;;; +0998;BENGALI LETTER GHA;Lo;0;L;;;;;N;;;;; +0999;BENGALI LETTER NGA;Lo;0;L;;;;;N;;;;; +099A;BENGALI LETTER CA;Lo;0;L;;;;;N;;;;; +099B;BENGALI LETTER CHA;Lo;0;L;;;;;N;;;;; +099C;BENGALI LETTER JA;Lo;0;L;;;;;N;;;;; +099D;BENGALI LETTER JHA;Lo;0;L;;;;;N;;;;; +099E;BENGALI LETTER NYA;Lo;0;L;;;;;N;;;;; +099F;BENGALI LETTER TTA;Lo;0;L;;;;;N;;;;; +09A0;BENGALI LETTER TTHA;Lo;0;L;;;;;N;;;;; +09A1;BENGALI LETTER DDA;Lo;0;L;;;;;N;;;;; +09A2;BENGALI LETTER DDHA;Lo;0;L;;;;;N;;;;; +09A3;BENGALI LETTER NNA;Lo;0;L;;;;;N;;;;; +09A4;BENGALI LETTER TA;Lo;0;L;;;;;N;;;;; +09A5;BENGALI LETTER THA;Lo;0;L;;;;;N;;;;; +09A6;BENGALI LETTER DA;Lo;0;L;;;;;N;;;;; +09A7;BENGALI LETTER DHA;Lo;0;L;;;;;N;;;;; +09A8;BENGALI LETTER NA;Lo;0;L;;;;;N;;;;; +09AA;BENGALI LETTER PA;Lo;0;L;;;;;N;;;;; +09AB;BENGALI LETTER PHA;Lo;0;L;;;;;N;;;;; +09AC;BENGALI LETTER BA;Lo;0;L;;;;;N;;;;; +09AD;BENGALI LETTER BHA;Lo;0;L;;;;;N;;;;; +09AE;BENGALI LETTER MA;Lo;0;L;;;;;N;;;;; +09AF;BENGALI LETTER YA;Lo;0;L;;;;;N;;;;; +09B0;BENGALI LETTER RA;Lo;0;L;;;;;N;;;;; +09B2;BENGALI LETTER LA;Lo;0;L;;;;;N;;;;; +09B6;BENGALI LETTER SHA;Lo;0;L;;;;;N;;;;; +09B7;BENGALI LETTER SSA;Lo;0;L;;;;;N;;;;; +09B8;BENGALI LETTER SA;Lo;0;L;;;;;N;;;;; +09B9;BENGALI LETTER HA;Lo;0;L;;;;;N;;;;; +09BC;BENGALI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +09BD;BENGALI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +09BE;BENGALI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +09BF;BENGALI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +09C0;BENGALI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +09C1;BENGALI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +09C2;BENGALI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +09C3;BENGALI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +09C4;BENGALI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +09C7;BENGALI VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +09C8;BENGALI VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +09CB;BENGALI VOWEL SIGN O;Mc;0;L;09C7 09BE;;;;N;;;;; +09CC;BENGALI VOWEL SIGN AU;Mc;0;L;09C7 09D7;;;;N;;;;; +09CD;BENGALI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +09CE;BENGALI LETTER KHANDA TA;Lo;0;L;;;;;N;;;;; +09D7;BENGALI AU LENGTH MARK;Mc;0;L;;;;;N;;;;; +09DC;BENGALI LETTER RRA;Lo;0;L;09A1 09BC;;;;N;;;;; +09DD;BENGALI LETTER RHA;Lo;0;L;09A2 09BC;;;;N;;;;; +09DF;BENGALI LETTER YYA;Lo;0;L;09AF 09BC;;;;N;;;;; +09E0;BENGALI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +09E1;BENGALI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +09E2;BENGALI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +09E3;BENGALI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +09E6;BENGALI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +09E7;BENGALI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +09E8;BENGALI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +09E9;BENGALI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +09EA;BENGALI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +09EB;BENGALI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +09EC;BENGALI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +09ED;BENGALI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +09EE;BENGALI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +09EF;BENGALI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +09F0;BENGALI LETTER RA WITH MIDDLE DIAGONAL;Lo;0;L;;;;;N;;;;; +09F1;BENGALI LETTER RA WITH LOWER DIAGONAL;Lo;0;L;;;;;N;BENGALI LETTER VA WITH LOWER DIAGONAL;;;; +09F2;BENGALI RUPEE MARK;Sc;0;ET;;;;;N;;;;; +09F3;BENGALI RUPEE SIGN;Sc;0;ET;;;;;N;;;;; +09F4;BENGALI CURRENCY NUMERATOR ONE;No;0;L;;;;1/16;N;;;;; +09F5;BENGALI CURRENCY NUMERATOR TWO;No;0;L;;;;1/8;N;;;;; +09F6;BENGALI CURRENCY NUMERATOR THREE;No;0;L;;;;3/16;N;;;;; +09F7;BENGALI CURRENCY NUMERATOR FOUR;No;0;L;;;;1/4;N;;;;; +09F8;BENGALI CURRENCY NUMERATOR ONE LESS THAN THE DENOMINATOR;No;0;L;;;;3/4;N;;;;; +09F9;BENGALI CURRENCY DENOMINATOR SIXTEEN;No;0;L;;;;16;N;;;;; +09FA;BENGALI ISSHAR;So;0;L;;;;;N;;;;; +09FB;BENGALI GANDA MARK;Sc;0;ET;;;;;N;;;;; +09FC;BENGALI LETTER VEDIC ANUSVARA;Lo;0;L;;;;;N;;;;; +09FD;BENGALI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +0A01;GURMUKHI SIGN ADAK BINDI;Mn;0;NSM;;;;;N;;;;; +0A02;GURMUKHI SIGN BINDI;Mn;0;NSM;;;;;N;;;;; +0A03;GURMUKHI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0A05;GURMUKHI LETTER A;Lo;0;L;;;;;N;;;;; +0A06;GURMUKHI LETTER AA;Lo;0;L;;;;;N;;;;; +0A07;GURMUKHI LETTER I;Lo;0;L;;;;;N;;;;; +0A08;GURMUKHI LETTER II;Lo;0;L;;;;;N;;;;; +0A09;GURMUKHI LETTER U;Lo;0;L;;;;;N;;;;; +0A0A;GURMUKHI LETTER UU;Lo;0;L;;;;;N;;;;; +0A0F;GURMUKHI LETTER EE;Lo;0;L;;;;;N;;;;; +0A10;GURMUKHI LETTER AI;Lo;0;L;;;;;N;;;;; +0A13;GURMUKHI LETTER OO;Lo;0;L;;;;;N;;;;; +0A14;GURMUKHI LETTER AU;Lo;0;L;;;;;N;;;;; +0A15;GURMUKHI LETTER KA;Lo;0;L;;;;;N;;;;; +0A16;GURMUKHI LETTER KHA;Lo;0;L;;;;;N;;;;; +0A17;GURMUKHI LETTER GA;Lo;0;L;;;;;N;;;;; +0A18;GURMUKHI LETTER GHA;Lo;0;L;;;;;N;;;;; +0A19;GURMUKHI LETTER NGA;Lo;0;L;;;;;N;;;;; +0A1A;GURMUKHI LETTER CA;Lo;0;L;;;;;N;;;;; +0A1B;GURMUKHI LETTER CHA;Lo;0;L;;;;;N;;;;; +0A1C;GURMUKHI LETTER JA;Lo;0;L;;;;;N;;;;; +0A1D;GURMUKHI LETTER JHA;Lo;0;L;;;;;N;;;;; +0A1E;GURMUKHI LETTER NYA;Lo;0;L;;;;;N;;;;; +0A1F;GURMUKHI LETTER TTA;Lo;0;L;;;;;N;;;;; +0A20;GURMUKHI LETTER TTHA;Lo;0;L;;;;;N;;;;; +0A21;GURMUKHI LETTER DDA;Lo;0;L;;;;;N;;;;; +0A22;GURMUKHI LETTER DDHA;Lo;0;L;;;;;N;;;;; +0A23;GURMUKHI LETTER NNA;Lo;0;L;;;;;N;;;;; +0A24;GURMUKHI LETTER TA;Lo;0;L;;;;;N;;;;; +0A25;GURMUKHI LETTER THA;Lo;0;L;;;;;N;;;;; +0A26;GURMUKHI LETTER DA;Lo;0;L;;;;;N;;;;; +0A27;GURMUKHI LETTER DHA;Lo;0;L;;;;;N;;;;; +0A28;GURMUKHI LETTER NA;Lo;0;L;;;;;N;;;;; +0A2A;GURMUKHI LETTER PA;Lo;0;L;;;;;N;;;;; +0A2B;GURMUKHI LETTER PHA;Lo;0;L;;;;;N;;;;; +0A2C;GURMUKHI LETTER BA;Lo;0;L;;;;;N;;;;; +0A2D;GURMUKHI LETTER BHA;Lo;0;L;;;;;N;;;;; +0A2E;GURMUKHI LETTER MA;Lo;0;L;;;;;N;;;;; +0A2F;GURMUKHI LETTER YA;Lo;0;L;;;;;N;;;;; +0A30;GURMUKHI LETTER RA;Lo;0;L;;;;;N;;;;; +0A32;GURMUKHI LETTER LA;Lo;0;L;;;;;N;;;;; +0A33;GURMUKHI LETTER LLA;Lo;0;L;0A32 0A3C;;;;N;;;;; +0A35;GURMUKHI LETTER VA;Lo;0;L;;;;;N;;;;; +0A36;GURMUKHI LETTER SHA;Lo;0;L;0A38 0A3C;;;;N;;;;; +0A38;GURMUKHI LETTER SA;Lo;0;L;;;;;N;;;;; +0A39;GURMUKHI LETTER HA;Lo;0;L;;;;;N;;;;; +0A3C;GURMUKHI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +0A3E;GURMUKHI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +0A3F;GURMUKHI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +0A40;GURMUKHI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +0A41;GURMUKHI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +0A42;GURMUKHI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +0A47;GURMUKHI VOWEL SIGN EE;Mn;0;NSM;;;;;N;;;;; +0A48;GURMUKHI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +0A4B;GURMUKHI VOWEL SIGN OO;Mn;0;NSM;;;;;N;;;;; +0A4C;GURMUKHI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +0A4D;GURMUKHI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0A51;GURMUKHI SIGN UDAAT;Mn;0;NSM;;;;;N;;;;; +0A59;GURMUKHI LETTER KHHA;Lo;0;L;0A16 0A3C;;;;N;;;;; +0A5A;GURMUKHI LETTER GHHA;Lo;0;L;0A17 0A3C;;;;N;;;;; +0A5B;GURMUKHI LETTER ZA;Lo;0;L;0A1C 0A3C;;;;N;;;;; +0A5C;GURMUKHI LETTER RRA;Lo;0;L;;;;;N;;;;; +0A5E;GURMUKHI LETTER FA;Lo;0;L;0A2B 0A3C;;;;N;;;;; +0A66;GURMUKHI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0A67;GURMUKHI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0A68;GURMUKHI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0A69;GURMUKHI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0A6A;GURMUKHI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0A6B;GURMUKHI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0A6C;GURMUKHI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0A6D;GURMUKHI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0A6E;GURMUKHI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0A6F;GURMUKHI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0A70;GURMUKHI TIPPI;Mn;0;NSM;;;;;N;;;;; +0A71;GURMUKHI ADDAK;Mn;0;NSM;;;;;N;;;;; +0A72;GURMUKHI IRI;Lo;0;L;;;;;N;;;;; +0A73;GURMUKHI URA;Lo;0;L;;;;;N;;;;; +0A74;GURMUKHI EK ONKAR;Lo;0;L;;;;;N;;;;; +0A75;GURMUKHI SIGN YAKASH;Mn;0;NSM;;;;;N;;;;; +0A81;GUJARATI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0A82;GUJARATI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +0A83;GUJARATI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0A85;GUJARATI LETTER A;Lo;0;L;;;;;N;;;;; +0A86;GUJARATI LETTER AA;Lo;0;L;;;;;N;;;;; +0A87;GUJARATI LETTER I;Lo;0;L;;;;;N;;;;; +0A88;GUJARATI LETTER II;Lo;0;L;;;;;N;;;;; +0A89;GUJARATI LETTER U;Lo;0;L;;;;;N;;;;; +0A8A;GUJARATI LETTER UU;Lo;0;L;;;;;N;;;;; +0A8B;GUJARATI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +0A8C;GUJARATI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +0A8D;GUJARATI VOWEL CANDRA E;Lo;0;L;;;;;N;;;;; +0A8F;GUJARATI LETTER E;Lo;0;L;;;;;N;;;;; +0A90;GUJARATI LETTER AI;Lo;0;L;;;;;N;;;;; +0A91;GUJARATI VOWEL CANDRA O;Lo;0;L;;;;;N;;;;; +0A93;GUJARATI LETTER O;Lo;0;L;;;;;N;;;;; +0A94;GUJARATI LETTER AU;Lo;0;L;;;;;N;;;;; +0A95;GUJARATI LETTER KA;Lo;0;L;;;;;N;;;;; +0A96;GUJARATI LETTER KHA;Lo;0;L;;;;;N;;;;; +0A97;GUJARATI LETTER GA;Lo;0;L;;;;;N;;;;; +0A98;GUJARATI LETTER GHA;Lo;0;L;;;;;N;;;;; +0A99;GUJARATI LETTER NGA;Lo;0;L;;;;;N;;;;; +0A9A;GUJARATI LETTER CA;Lo;0;L;;;;;N;;;;; +0A9B;GUJARATI LETTER CHA;Lo;0;L;;;;;N;;;;; +0A9C;GUJARATI LETTER JA;Lo;0;L;;;;;N;;;;; +0A9D;GUJARATI LETTER JHA;Lo;0;L;;;;;N;;;;; +0A9E;GUJARATI LETTER NYA;Lo;0;L;;;;;N;;;;; +0A9F;GUJARATI LETTER TTA;Lo;0;L;;;;;N;;;;; +0AA0;GUJARATI LETTER TTHA;Lo;0;L;;;;;N;;;;; +0AA1;GUJARATI LETTER DDA;Lo;0;L;;;;;N;;;;; +0AA2;GUJARATI LETTER DDHA;Lo;0;L;;;;;N;;;;; +0AA3;GUJARATI LETTER NNA;Lo;0;L;;;;;N;;;;; +0AA4;GUJARATI LETTER TA;Lo;0;L;;;;;N;;;;; +0AA5;GUJARATI LETTER THA;Lo;0;L;;;;;N;;;;; +0AA6;GUJARATI LETTER DA;Lo;0;L;;;;;N;;;;; +0AA7;GUJARATI LETTER DHA;Lo;0;L;;;;;N;;;;; +0AA8;GUJARATI LETTER NA;Lo;0;L;;;;;N;;;;; +0AAA;GUJARATI LETTER PA;Lo;0;L;;;;;N;;;;; +0AAB;GUJARATI LETTER PHA;Lo;0;L;;;;;N;;;;; +0AAC;GUJARATI LETTER BA;Lo;0;L;;;;;N;;;;; +0AAD;GUJARATI LETTER BHA;Lo;0;L;;;;;N;;;;; +0AAE;GUJARATI LETTER MA;Lo;0;L;;;;;N;;;;; +0AAF;GUJARATI LETTER YA;Lo;0;L;;;;;N;;;;; +0AB0;GUJARATI LETTER RA;Lo;0;L;;;;;N;;;;; +0AB2;GUJARATI LETTER LA;Lo;0;L;;;;;N;;;;; +0AB3;GUJARATI LETTER LLA;Lo;0;L;;;;;N;;;;; +0AB5;GUJARATI LETTER VA;Lo;0;L;;;;;N;;;;; +0AB6;GUJARATI LETTER SHA;Lo;0;L;;;;;N;;;;; +0AB7;GUJARATI LETTER SSA;Lo;0;L;;;;;N;;;;; +0AB8;GUJARATI LETTER SA;Lo;0;L;;;;;N;;;;; +0AB9;GUJARATI LETTER HA;Lo;0;L;;;;;N;;;;; +0ABC;GUJARATI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +0ABD;GUJARATI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +0ABE;GUJARATI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +0ABF;GUJARATI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +0AC0;GUJARATI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +0AC1;GUJARATI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +0AC2;GUJARATI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +0AC3;GUJARATI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +0AC4;GUJARATI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +0AC5;GUJARATI VOWEL SIGN CANDRA E;Mn;0;NSM;;;;;N;;;;; +0AC7;GUJARATI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +0AC8;GUJARATI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +0AC9;GUJARATI VOWEL SIGN CANDRA O;Mc;0;L;;;;;N;;;;; +0ACB;GUJARATI VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +0ACC;GUJARATI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +0ACD;GUJARATI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0AD0;GUJARATI OM;Lo;0;L;;;;;N;;;;; +0AE0;GUJARATI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +0AE1;GUJARATI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +0AE2;GUJARATI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +0AE3;GUJARATI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +0AE6;GUJARATI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0AE7;GUJARATI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0AE8;GUJARATI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0AE9;GUJARATI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0AEA;GUJARATI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0AEB;GUJARATI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0AEC;GUJARATI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0AED;GUJARATI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0AEE;GUJARATI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0AEF;GUJARATI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0AF0;GUJARATI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +0AF1;GUJARATI RUPEE SIGN;Sc;0;ET;;;;;N;;;;; +0AF9;GUJARATI LETTER ZHA;Lo;0;L;;;;;N;;;;; +0AFA;GUJARATI SIGN SUKUN;Mn;0;NSM;;;;;N;;;;; +0AFB;GUJARATI SIGN SHADDA;Mn;0;NSM;;;;;N;;;;; +0AFC;GUJARATI SIGN MADDAH;Mn;0;NSM;;;;;N;;;;; +0AFD;GUJARATI SIGN THREE-DOT NUKTA ABOVE;Mn;0;NSM;;;;;N;;;;; +0AFE;GUJARATI SIGN CIRCLE NUKTA ABOVE;Mn;0;NSM;;;;;N;;;;; +0AFF;GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE;Mn;0;NSM;;;;;N;;;;; +0B01;ORIYA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0B02;ORIYA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +0B03;ORIYA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0B05;ORIYA LETTER A;Lo;0;L;;;;;N;;;;; +0B06;ORIYA LETTER AA;Lo;0;L;;;;;N;;;;; +0B07;ORIYA LETTER I;Lo;0;L;;;;;N;;;;; +0B08;ORIYA LETTER II;Lo;0;L;;;;;N;;;;; +0B09;ORIYA LETTER U;Lo;0;L;;;;;N;;;;; +0B0A;ORIYA LETTER UU;Lo;0;L;;;;;N;;;;; +0B0B;ORIYA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +0B0C;ORIYA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +0B0F;ORIYA LETTER E;Lo;0;L;;;;;N;;;;; +0B10;ORIYA LETTER AI;Lo;0;L;;;;;N;;;;; +0B13;ORIYA LETTER O;Lo;0;L;;;;;N;;;;; +0B14;ORIYA LETTER AU;Lo;0;L;;;;;N;;;;; +0B15;ORIYA LETTER KA;Lo;0;L;;;;;N;;;;; +0B16;ORIYA LETTER KHA;Lo;0;L;;;;;N;;;;; +0B17;ORIYA LETTER GA;Lo;0;L;;;;;N;;;;; +0B18;ORIYA LETTER GHA;Lo;0;L;;;;;N;;;;; +0B19;ORIYA LETTER NGA;Lo;0;L;;;;;N;;;;; +0B1A;ORIYA LETTER CA;Lo;0;L;;;;;N;;;;; +0B1B;ORIYA LETTER CHA;Lo;0;L;;;;;N;;;;; +0B1C;ORIYA LETTER JA;Lo;0;L;;;;;N;;;;; +0B1D;ORIYA LETTER JHA;Lo;0;L;;;;;N;;;;; +0B1E;ORIYA LETTER NYA;Lo;0;L;;;;;N;;;;; +0B1F;ORIYA LETTER TTA;Lo;0;L;;;;;N;;;;; +0B20;ORIYA LETTER TTHA;Lo;0;L;;;;;N;;;;; +0B21;ORIYA LETTER DDA;Lo;0;L;;;;;N;;;;; +0B22;ORIYA LETTER DDHA;Lo;0;L;;;;;N;;;;; +0B23;ORIYA LETTER NNA;Lo;0;L;;;;;N;;;;; +0B24;ORIYA LETTER TA;Lo;0;L;;;;;N;;;;; +0B25;ORIYA LETTER THA;Lo;0;L;;;;;N;;;;; +0B26;ORIYA LETTER DA;Lo;0;L;;;;;N;;;;; +0B27;ORIYA LETTER DHA;Lo;0;L;;;;;N;;;;; +0B28;ORIYA LETTER NA;Lo;0;L;;;;;N;;;;; +0B2A;ORIYA LETTER PA;Lo;0;L;;;;;N;;;;; +0B2B;ORIYA LETTER PHA;Lo;0;L;;;;;N;;;;; +0B2C;ORIYA LETTER BA;Lo;0;L;;;;;N;;;;; +0B2D;ORIYA LETTER BHA;Lo;0;L;;;;;N;;;;; +0B2E;ORIYA LETTER MA;Lo;0;L;;;;;N;;;;; +0B2F;ORIYA LETTER YA;Lo;0;L;;;;;N;;;;; +0B30;ORIYA LETTER RA;Lo;0;L;;;;;N;;;;; +0B32;ORIYA LETTER LA;Lo;0;L;;;;;N;;;;; +0B33;ORIYA LETTER LLA;Lo;0;L;;;;;N;;;;; +0B35;ORIYA LETTER VA;Lo;0;L;;;;;N;;;;; +0B36;ORIYA LETTER SHA;Lo;0;L;;;;;N;;;;; +0B37;ORIYA LETTER SSA;Lo;0;L;;;;;N;;;;; +0B38;ORIYA LETTER SA;Lo;0;L;;;;;N;;;;; +0B39;ORIYA LETTER HA;Lo;0;L;;;;;N;;;;; +0B3C;ORIYA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +0B3D;ORIYA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +0B3E;ORIYA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +0B3F;ORIYA VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +0B40;ORIYA VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +0B41;ORIYA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +0B42;ORIYA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +0B43;ORIYA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +0B44;ORIYA VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +0B47;ORIYA VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +0B48;ORIYA VOWEL SIGN AI;Mc;0;L;0B47 0B56;;;;N;;;;; +0B4B;ORIYA VOWEL SIGN O;Mc;0;L;0B47 0B3E;;;;N;;;;; +0B4C;ORIYA VOWEL SIGN AU;Mc;0;L;0B47 0B57;;;;N;;;;; +0B4D;ORIYA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0B56;ORIYA AI LENGTH MARK;Mn;0;NSM;;;;;N;;;;; +0B57;ORIYA AU LENGTH MARK;Mc;0;L;;;;;N;;;;; +0B5C;ORIYA LETTER RRA;Lo;0;L;0B21 0B3C;;;;N;;;;; +0B5D;ORIYA LETTER RHA;Lo;0;L;0B22 0B3C;;;;N;;;;; +0B5F;ORIYA LETTER YYA;Lo;0;L;;;;;N;;;;; +0B60;ORIYA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +0B61;ORIYA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +0B62;ORIYA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +0B63;ORIYA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +0B66;ORIYA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0B67;ORIYA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0B68;ORIYA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0B69;ORIYA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0B6A;ORIYA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0B6B;ORIYA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0B6C;ORIYA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0B6D;ORIYA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0B6E;ORIYA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0B6F;ORIYA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0B70;ORIYA ISSHAR;So;0;L;;;;;N;;;;; +0B71;ORIYA LETTER WA;Lo;0;L;;;;;N;;;;; +0B72;ORIYA FRACTION ONE QUARTER;No;0;L;;;;1/4;N;;;;; +0B73;ORIYA FRACTION ONE HALF;No;0;L;;;;1/2;N;;;;; +0B74;ORIYA FRACTION THREE QUARTERS;No;0;L;;;;3/4;N;;;;; +0B75;ORIYA FRACTION ONE SIXTEENTH;No;0;L;;;;1/16;N;;;;; +0B76;ORIYA FRACTION ONE EIGHTH;No;0;L;;;;1/8;N;;;;; +0B77;ORIYA FRACTION THREE SIXTEENTHS;No;0;L;;;;3/16;N;;;;; +0B82;TAMIL SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +0B83;TAMIL SIGN VISARGA;Lo;0;L;;;;;N;;;;; +0B85;TAMIL LETTER A;Lo;0;L;;;;;N;;;;; +0B86;TAMIL LETTER AA;Lo;0;L;;;;;N;;;;; +0B87;TAMIL LETTER I;Lo;0;L;;;;;N;;;;; +0B88;TAMIL LETTER II;Lo;0;L;;;;;N;;;;; +0B89;TAMIL LETTER U;Lo;0;L;;;;;N;;;;; +0B8A;TAMIL LETTER UU;Lo;0;L;;;;;N;;;;; +0B8E;TAMIL LETTER E;Lo;0;L;;;;;N;;;;; +0B8F;TAMIL LETTER EE;Lo;0;L;;;;;N;;;;; +0B90;TAMIL LETTER AI;Lo;0;L;;;;;N;;;;; +0B92;TAMIL LETTER O;Lo;0;L;;;;;N;;;;; +0B93;TAMIL LETTER OO;Lo;0;L;;;;;N;;;;; +0B94;TAMIL LETTER AU;Lo;0;L;0B92 0BD7;;;;N;;;;; +0B95;TAMIL LETTER KA;Lo;0;L;;;;;N;;;;; +0B99;TAMIL LETTER NGA;Lo;0;L;;;;;N;;;;; +0B9A;TAMIL LETTER CA;Lo;0;L;;;;;N;;;;; +0B9C;TAMIL LETTER JA;Lo;0;L;;;;;N;;;;; +0B9E;TAMIL LETTER NYA;Lo;0;L;;;;;N;;;;; +0B9F;TAMIL LETTER TTA;Lo;0;L;;;;;N;;;;; +0BA3;TAMIL LETTER NNA;Lo;0;L;;;;;N;;;;; +0BA4;TAMIL LETTER TA;Lo;0;L;;;;;N;;;;; +0BA8;TAMIL LETTER NA;Lo;0;L;;;;;N;;;;; +0BA9;TAMIL LETTER NNNA;Lo;0;L;;;;;N;;;;; +0BAA;TAMIL LETTER PA;Lo;0;L;;;;;N;;;;; +0BAE;TAMIL LETTER MA;Lo;0;L;;;;;N;;;;; +0BAF;TAMIL LETTER YA;Lo;0;L;;;;;N;;;;; +0BB0;TAMIL LETTER RA;Lo;0;L;;;;;N;;;;; +0BB1;TAMIL LETTER RRA;Lo;0;L;;;;;N;;;;; +0BB2;TAMIL LETTER LA;Lo;0;L;;;;;N;;;;; +0BB3;TAMIL LETTER LLA;Lo;0;L;;;;;N;;;;; +0BB4;TAMIL LETTER LLLA;Lo;0;L;;;;;N;;;;; +0BB5;TAMIL LETTER VA;Lo;0;L;;;;;N;;;;; +0BB6;TAMIL LETTER SHA;Lo;0;L;;;;;N;;;;; +0BB7;TAMIL LETTER SSA;Lo;0;L;;;;;N;;;;; +0BB8;TAMIL LETTER SA;Lo;0;L;;;;;N;;;;; +0BB9;TAMIL LETTER HA;Lo;0;L;;;;;N;;;;; +0BBE;TAMIL VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +0BBF;TAMIL VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +0BC0;TAMIL VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +0BC1;TAMIL VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +0BC2;TAMIL VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +0BC6;TAMIL VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +0BC7;TAMIL VOWEL SIGN EE;Mc;0;L;;;;;N;;;;; +0BC8;TAMIL VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +0BCA;TAMIL VOWEL SIGN O;Mc;0;L;0BC6 0BBE;;;;N;;;;; +0BCB;TAMIL VOWEL SIGN OO;Mc;0;L;0BC7 0BBE;;;;N;;;;; +0BCC;TAMIL VOWEL SIGN AU;Mc;0;L;0BC6 0BD7;;;;N;;;;; +0BCD;TAMIL SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0BD0;TAMIL OM;Lo;0;L;;;;;N;;;;; +0BD7;TAMIL AU LENGTH MARK;Mc;0;L;;;;;N;;;;; +0BE6;TAMIL DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0BE7;TAMIL DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0BE8;TAMIL DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0BE9;TAMIL DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0BEA;TAMIL DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0BEB;TAMIL DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0BEC;TAMIL DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0BED;TAMIL DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0BEE;TAMIL DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0BEF;TAMIL DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0BF0;TAMIL NUMBER TEN;No;0;L;;;;10;N;;;;; +0BF1;TAMIL NUMBER ONE HUNDRED;No;0;L;;;;100;N;;;;; +0BF2;TAMIL NUMBER ONE THOUSAND;No;0;L;;;;1000;N;;;;; +0BF3;TAMIL DAY SIGN;So;0;ON;;;;;N;;;;; +0BF4;TAMIL MONTH SIGN;So;0;ON;;;;;N;;;;; +0BF5;TAMIL YEAR SIGN;So;0;ON;;;;;N;;;;; +0BF6;TAMIL DEBIT SIGN;So;0;ON;;;;;N;;;;; +0BF7;TAMIL CREDIT SIGN;So;0;ON;;;;;N;;;;; +0BF8;TAMIL AS ABOVE SIGN;So;0;ON;;;;;N;;;;; +0BF9;TAMIL RUPEE SIGN;Sc;0;ET;;;;;N;;;;; +0BFA;TAMIL NUMBER SIGN;So;0;ON;;;;;N;;;;; +0C00;TELUGU SIGN COMBINING CANDRABINDU ABOVE;Mn;0;NSM;;;;;N;;;;; +0C01;TELUGU SIGN CANDRABINDU;Mc;0;L;;;;;N;;;;; +0C02;TELUGU SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +0C03;TELUGU SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0C05;TELUGU LETTER A;Lo;0;L;;;;;N;;;;; +0C06;TELUGU LETTER AA;Lo;0;L;;;;;N;;;;; +0C07;TELUGU LETTER I;Lo;0;L;;;;;N;;;;; +0C08;TELUGU LETTER II;Lo;0;L;;;;;N;;;;; +0C09;TELUGU LETTER U;Lo;0;L;;;;;N;;;;; +0C0A;TELUGU LETTER UU;Lo;0;L;;;;;N;;;;; +0C0B;TELUGU LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +0C0C;TELUGU LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +0C0E;TELUGU LETTER E;Lo;0;L;;;;;N;;;;; +0C0F;TELUGU LETTER EE;Lo;0;L;;;;;N;;;;; +0C10;TELUGU LETTER AI;Lo;0;L;;;;;N;;;;; +0C12;TELUGU LETTER O;Lo;0;L;;;;;N;;;;; +0C13;TELUGU LETTER OO;Lo;0;L;;;;;N;;;;; +0C14;TELUGU LETTER AU;Lo;0;L;;;;;N;;;;; +0C15;TELUGU LETTER KA;Lo;0;L;;;;;N;;;;; +0C16;TELUGU LETTER KHA;Lo;0;L;;;;;N;;;;; +0C17;TELUGU LETTER GA;Lo;0;L;;;;;N;;;;; +0C18;TELUGU LETTER GHA;Lo;0;L;;;;;N;;;;; +0C19;TELUGU LETTER NGA;Lo;0;L;;;;;N;;;;; +0C1A;TELUGU LETTER CA;Lo;0;L;;;;;N;;;;; +0C1B;TELUGU LETTER CHA;Lo;0;L;;;;;N;;;;; +0C1C;TELUGU LETTER JA;Lo;0;L;;;;;N;;;;; +0C1D;TELUGU LETTER JHA;Lo;0;L;;;;;N;;;;; +0C1E;TELUGU LETTER NYA;Lo;0;L;;;;;N;;;;; +0C1F;TELUGU LETTER TTA;Lo;0;L;;;;;N;;;;; +0C20;TELUGU LETTER TTHA;Lo;0;L;;;;;N;;;;; +0C21;TELUGU LETTER DDA;Lo;0;L;;;;;N;;;;; +0C22;TELUGU LETTER DDHA;Lo;0;L;;;;;N;;;;; +0C23;TELUGU LETTER NNA;Lo;0;L;;;;;N;;;;; +0C24;TELUGU LETTER TA;Lo;0;L;;;;;N;;;;; +0C25;TELUGU LETTER THA;Lo;0;L;;;;;N;;;;; +0C26;TELUGU LETTER DA;Lo;0;L;;;;;N;;;;; +0C27;TELUGU LETTER DHA;Lo;0;L;;;;;N;;;;; +0C28;TELUGU LETTER NA;Lo;0;L;;;;;N;;;;; +0C2A;TELUGU LETTER PA;Lo;0;L;;;;;N;;;;; +0C2B;TELUGU LETTER PHA;Lo;0;L;;;;;N;;;;; +0C2C;TELUGU LETTER BA;Lo;0;L;;;;;N;;;;; +0C2D;TELUGU LETTER BHA;Lo;0;L;;;;;N;;;;; +0C2E;TELUGU LETTER MA;Lo;0;L;;;;;N;;;;; +0C2F;TELUGU LETTER YA;Lo;0;L;;;;;N;;;;; +0C30;TELUGU LETTER RA;Lo;0;L;;;;;N;;;;; +0C31;TELUGU LETTER RRA;Lo;0;L;;;;;N;;;;; +0C32;TELUGU LETTER LA;Lo;0;L;;;;;N;;;;; +0C33;TELUGU LETTER LLA;Lo;0;L;;;;;N;;;;; +0C34;TELUGU LETTER LLLA;Lo;0;L;;;;;N;;;;; +0C35;TELUGU LETTER VA;Lo;0;L;;;;;N;;;;; +0C36;TELUGU LETTER SHA;Lo;0;L;;;;;N;;;;; +0C37;TELUGU LETTER SSA;Lo;0;L;;;;;N;;;;; +0C38;TELUGU LETTER SA;Lo;0;L;;;;;N;;;;; +0C39;TELUGU LETTER HA;Lo;0;L;;;;;N;;;;; +0C3D;TELUGU SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +0C3E;TELUGU VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +0C3F;TELUGU VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +0C40;TELUGU VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +0C41;TELUGU VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +0C42;TELUGU VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +0C43;TELUGU VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;; +0C44;TELUGU VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;; +0C46;TELUGU VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +0C47;TELUGU VOWEL SIGN EE;Mn;0;NSM;;;;;N;;;;; +0C48;TELUGU VOWEL SIGN AI;Mn;0;NSM;0C46 0C56;;;;N;;;;; +0C4A;TELUGU VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +0C4B;TELUGU VOWEL SIGN OO;Mn;0;NSM;;;;;N;;;;; +0C4C;TELUGU VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +0C4D;TELUGU SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0C55;TELUGU LENGTH MARK;Mn;84;NSM;;;;;N;;;;; +0C56;TELUGU AI LENGTH MARK;Mn;91;NSM;;;;;N;;;;; +0C58;TELUGU LETTER TSA;Lo;0;L;;;;;N;;;;; +0C59;TELUGU LETTER DZA;Lo;0;L;;;;;N;;;;; +0C5A;TELUGU LETTER RRRA;Lo;0;L;;;;;N;;;;; +0C60;TELUGU LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +0C61;TELUGU LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +0C62;TELUGU VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +0C63;TELUGU VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +0C66;TELUGU DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0C67;TELUGU DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0C68;TELUGU DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0C69;TELUGU DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0C6A;TELUGU DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0C6B;TELUGU DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0C6C;TELUGU DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0C6D;TELUGU DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0C6E;TELUGU DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0C6F;TELUGU DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0C78;TELUGU FRACTION DIGIT ZERO FOR ODD POWERS OF FOUR;No;0;ON;;;;0;N;;;;; +0C79;TELUGU FRACTION DIGIT ONE FOR ODD POWERS OF FOUR;No;0;ON;;;;1;N;;;;; +0C7A;TELUGU FRACTION DIGIT TWO FOR ODD POWERS OF FOUR;No;0;ON;;;;2;N;;;;; +0C7B;TELUGU FRACTION DIGIT THREE FOR ODD POWERS OF FOUR;No;0;ON;;;;3;N;;;;; +0C7C;TELUGU FRACTION DIGIT ONE FOR EVEN POWERS OF FOUR;No;0;ON;;;;1;N;;;;; +0C7D;TELUGU FRACTION DIGIT TWO FOR EVEN POWERS OF FOUR;No;0;ON;;;;2;N;;;;; +0C7E;TELUGU FRACTION DIGIT THREE FOR EVEN POWERS OF FOUR;No;0;ON;;;;3;N;;;;; +0C7F;TELUGU SIGN TUUMU;So;0;L;;;;;N;;;;; +0C80;KANNADA SIGN SPACING CANDRABINDU;Lo;0;L;;;;;N;;;;; +0C81;KANNADA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0C82;KANNADA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +0C83;KANNADA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0C85;KANNADA LETTER A;Lo;0;L;;;;;N;;;;; +0C86;KANNADA LETTER AA;Lo;0;L;;;;;N;;;;; +0C87;KANNADA LETTER I;Lo;0;L;;;;;N;;;;; +0C88;KANNADA LETTER II;Lo;0;L;;;;;N;;;;; +0C89;KANNADA LETTER U;Lo;0;L;;;;;N;;;;; +0C8A;KANNADA LETTER UU;Lo;0;L;;;;;N;;;;; +0C8B;KANNADA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +0C8C;KANNADA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +0C8E;KANNADA LETTER E;Lo;0;L;;;;;N;;;;; +0C8F;KANNADA LETTER EE;Lo;0;L;;;;;N;;;;; +0C90;KANNADA LETTER AI;Lo;0;L;;;;;N;;;;; +0C92;KANNADA LETTER O;Lo;0;L;;;;;N;;;;; +0C93;KANNADA LETTER OO;Lo;0;L;;;;;N;;;;; +0C94;KANNADA LETTER AU;Lo;0;L;;;;;N;;;;; +0C95;KANNADA LETTER KA;Lo;0;L;;;;;N;;;;; +0C96;KANNADA LETTER KHA;Lo;0;L;;;;;N;;;;; +0C97;KANNADA LETTER GA;Lo;0;L;;;;;N;;;;; +0C98;KANNADA LETTER GHA;Lo;0;L;;;;;N;;;;; +0C99;KANNADA LETTER NGA;Lo;0;L;;;;;N;;;;; +0C9A;KANNADA LETTER CA;Lo;0;L;;;;;N;;;;; +0C9B;KANNADA LETTER CHA;Lo;0;L;;;;;N;;;;; +0C9C;KANNADA LETTER JA;Lo;0;L;;;;;N;;;;; +0C9D;KANNADA LETTER JHA;Lo;0;L;;;;;N;;;;; +0C9E;KANNADA LETTER NYA;Lo;0;L;;;;;N;;;;; +0C9F;KANNADA LETTER TTA;Lo;0;L;;;;;N;;;;; +0CA0;KANNADA LETTER TTHA;Lo;0;L;;;;;N;;;;; +0CA1;KANNADA LETTER DDA;Lo;0;L;;;;;N;;;;; +0CA2;KANNADA LETTER DDHA;Lo;0;L;;;;;N;;;;; +0CA3;KANNADA LETTER NNA;Lo;0;L;;;;;N;;;;; +0CA4;KANNADA LETTER TA;Lo;0;L;;;;;N;;;;; +0CA5;KANNADA LETTER THA;Lo;0;L;;;;;N;;;;; +0CA6;KANNADA LETTER DA;Lo;0;L;;;;;N;;;;; +0CA7;KANNADA LETTER DHA;Lo;0;L;;;;;N;;;;; +0CA8;KANNADA LETTER NA;Lo;0;L;;;;;N;;;;; +0CAA;KANNADA LETTER PA;Lo;0;L;;;;;N;;;;; +0CAB;KANNADA LETTER PHA;Lo;0;L;;;;;N;;;;; +0CAC;KANNADA LETTER BA;Lo;0;L;;;;;N;;;;; +0CAD;KANNADA LETTER BHA;Lo;0;L;;;;;N;;;;; +0CAE;KANNADA LETTER MA;Lo;0;L;;;;;N;;;;; +0CAF;KANNADA LETTER YA;Lo;0;L;;;;;N;;;;; +0CB0;KANNADA LETTER RA;Lo;0;L;;;;;N;;;;; +0CB1;KANNADA LETTER RRA;Lo;0;L;;;;;N;;;;; +0CB2;KANNADA LETTER LA;Lo;0;L;;;;;N;;;;; +0CB3;KANNADA LETTER LLA;Lo;0;L;;;;;N;;;;; +0CB5;KANNADA LETTER VA;Lo;0;L;;;;;N;;;;; +0CB6;KANNADA LETTER SHA;Lo;0;L;;;;;N;;;;; +0CB7;KANNADA LETTER SSA;Lo;0;L;;;;;N;;;;; +0CB8;KANNADA LETTER SA;Lo;0;L;;;;;N;;;;; +0CB9;KANNADA LETTER HA;Lo;0;L;;;;;N;;;;; +0CBC;KANNADA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +0CBD;KANNADA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +0CBE;KANNADA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +0CBF;KANNADA VOWEL SIGN I;Mn;0;L;;;;;N;;;;; +0CC0;KANNADA VOWEL SIGN II;Mc;0;L;0CBF 0CD5;;;;N;;;;; +0CC1;KANNADA VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +0CC2;KANNADA VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +0CC3;KANNADA VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;; +0CC4;KANNADA VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;; +0CC6;KANNADA VOWEL SIGN E;Mn;0;L;;;;;N;;;;; +0CC7;KANNADA VOWEL SIGN EE;Mc;0;L;0CC6 0CD5;;;;N;;;;; +0CC8;KANNADA VOWEL SIGN AI;Mc;0;L;0CC6 0CD6;;;;N;;;;; +0CCA;KANNADA VOWEL SIGN O;Mc;0;L;0CC6 0CC2;;;;N;;;;; +0CCB;KANNADA VOWEL SIGN OO;Mc;0;L;0CCA 0CD5;;;;N;;;;; +0CCC;KANNADA VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +0CCD;KANNADA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0CD5;KANNADA LENGTH MARK;Mc;0;L;;;;;N;;;;; +0CD6;KANNADA AI LENGTH MARK;Mc;0;L;;;;;N;;;;; +0CDE;KANNADA LETTER FA;Lo;0;L;;;;;N;;;;; +0CE0;KANNADA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +0CE1;KANNADA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +0CE2;KANNADA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +0CE3;KANNADA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +0CE6;KANNADA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0CE7;KANNADA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0CE8;KANNADA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0CE9;KANNADA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0CEA;KANNADA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0CEB;KANNADA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0CEC;KANNADA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0CED;KANNADA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0CEE;KANNADA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0CEF;KANNADA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0CF1;KANNADA SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;; +0CF2;KANNADA SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;; +0D00;MALAYALAM SIGN COMBINING ANUSVARA ABOVE;Mn;0;NSM;;;;;N;;;;; +0D01;MALAYALAM SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +0D02;MALAYALAM SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +0D03;MALAYALAM SIGN VISARGA;Mc;0;L;;;;;N;;;;; +0D05;MALAYALAM LETTER A;Lo;0;L;;;;;N;;;;; +0D06;MALAYALAM LETTER AA;Lo;0;L;;;;;N;;;;; +0D07;MALAYALAM LETTER I;Lo;0;L;;;;;N;;;;; +0D08;MALAYALAM LETTER II;Lo;0;L;;;;;N;;;;; +0D09;MALAYALAM LETTER U;Lo;0;L;;;;;N;;;;; +0D0A;MALAYALAM LETTER UU;Lo;0;L;;;;;N;;;;; +0D0B;MALAYALAM LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +0D0C;MALAYALAM LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +0D0E;MALAYALAM LETTER E;Lo;0;L;;;;;N;;;;; +0D0F;MALAYALAM LETTER EE;Lo;0;L;;;;;N;;;;; +0D10;MALAYALAM LETTER AI;Lo;0;L;;;;;N;;;;; +0D12;MALAYALAM LETTER O;Lo;0;L;;;;;N;;;;; +0D13;MALAYALAM LETTER OO;Lo;0;L;;;;;N;;;;; +0D14;MALAYALAM LETTER AU;Lo;0;L;;;;;N;;;;; +0D15;MALAYALAM LETTER KA;Lo;0;L;;;;;N;;;;; +0D16;MALAYALAM LETTER KHA;Lo;0;L;;;;;N;;;;; +0D17;MALAYALAM LETTER GA;Lo;0;L;;;;;N;;;;; +0D18;MALAYALAM LETTER GHA;Lo;0;L;;;;;N;;;;; +0D19;MALAYALAM LETTER NGA;Lo;0;L;;;;;N;;;;; +0D1A;MALAYALAM LETTER CA;Lo;0;L;;;;;N;;;;; +0D1B;MALAYALAM LETTER CHA;Lo;0;L;;;;;N;;;;; +0D1C;MALAYALAM LETTER JA;Lo;0;L;;;;;N;;;;; +0D1D;MALAYALAM LETTER JHA;Lo;0;L;;;;;N;;;;; +0D1E;MALAYALAM LETTER NYA;Lo;0;L;;;;;N;;;;; +0D1F;MALAYALAM LETTER TTA;Lo;0;L;;;;;N;;;;; +0D20;MALAYALAM LETTER TTHA;Lo;0;L;;;;;N;;;;; +0D21;MALAYALAM LETTER DDA;Lo;0;L;;;;;N;;;;; +0D22;MALAYALAM LETTER DDHA;Lo;0;L;;;;;N;;;;; +0D23;MALAYALAM LETTER NNA;Lo;0;L;;;;;N;;;;; +0D24;MALAYALAM LETTER TA;Lo;0;L;;;;;N;;;;; +0D25;MALAYALAM LETTER THA;Lo;0;L;;;;;N;;;;; +0D26;MALAYALAM LETTER DA;Lo;0;L;;;;;N;;;;; +0D27;MALAYALAM LETTER DHA;Lo;0;L;;;;;N;;;;; +0D28;MALAYALAM LETTER NA;Lo;0;L;;;;;N;;;;; +0D29;MALAYALAM LETTER NNNA;Lo;0;L;;;;;N;;;;; +0D2A;MALAYALAM LETTER PA;Lo;0;L;;;;;N;;;;; +0D2B;MALAYALAM LETTER PHA;Lo;0;L;;;;;N;;;;; +0D2C;MALAYALAM LETTER BA;Lo;0;L;;;;;N;;;;; +0D2D;MALAYALAM LETTER BHA;Lo;0;L;;;;;N;;;;; +0D2E;MALAYALAM LETTER MA;Lo;0;L;;;;;N;;;;; +0D2F;MALAYALAM LETTER YA;Lo;0;L;;;;;N;;;;; +0D30;MALAYALAM LETTER RA;Lo;0;L;;;;;N;;;;; +0D31;MALAYALAM LETTER RRA;Lo;0;L;;;;;N;;;;; +0D32;MALAYALAM LETTER LA;Lo;0;L;;;;;N;;;;; +0D33;MALAYALAM LETTER LLA;Lo;0;L;;;;;N;;;;; +0D34;MALAYALAM LETTER LLLA;Lo;0;L;;;;;N;;;;; +0D35;MALAYALAM LETTER VA;Lo;0;L;;;;;N;;;;; +0D36;MALAYALAM LETTER SHA;Lo;0;L;;;;;N;;;;; +0D37;MALAYALAM LETTER SSA;Lo;0;L;;;;;N;;;;; +0D38;MALAYALAM LETTER SA;Lo;0;L;;;;;N;;;;; +0D39;MALAYALAM LETTER HA;Lo;0;L;;;;;N;;;;; +0D3A;MALAYALAM LETTER TTTA;Lo;0;L;;;;;N;;;;; +0D3B;MALAYALAM SIGN VERTICAL BAR VIRAMA;Mn;9;NSM;;;;;N;;;;; +0D3C;MALAYALAM SIGN CIRCULAR VIRAMA;Mn;9;NSM;;;;;N;;;;; +0D3D;MALAYALAM SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +0D3E;MALAYALAM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +0D3F;MALAYALAM VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +0D40;MALAYALAM VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +0D41;MALAYALAM VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +0D42;MALAYALAM VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +0D43;MALAYALAM VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +0D44;MALAYALAM VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +0D46;MALAYALAM VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +0D47;MALAYALAM VOWEL SIGN EE;Mc;0;L;;;;;N;;;;; +0D48;MALAYALAM VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +0D4A;MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;; +0D4B;MALAYALAM VOWEL SIGN OO;Mc;0;L;0D47 0D3E;;;;N;;;;; +0D4C;MALAYALAM VOWEL SIGN AU;Mc;0;L;0D46 0D57;;;;N;;;;; +0D4D;MALAYALAM SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +0D4E;MALAYALAM LETTER DOT REPH;Lo;0;L;;;;;N;;;;; +0D4F;MALAYALAM SIGN PARA;So;0;L;;;;;N;;;;; +0D54;MALAYALAM LETTER CHILLU M;Lo;0;L;;;;;N;;;;; +0D55;MALAYALAM LETTER CHILLU Y;Lo;0;L;;;;;N;;;;; +0D56;MALAYALAM LETTER CHILLU LLL;Lo;0;L;;;;;N;;;;; +0D57;MALAYALAM AU LENGTH MARK;Mc;0;L;;;;;N;;;;; +0D58;MALAYALAM FRACTION ONE ONE-HUNDRED-AND-SIXTIETH;No;0;L;;;;1/160;N;;;;; +0D59;MALAYALAM FRACTION ONE FORTIETH;No;0;L;;;;1/40;N;;;;; +0D5A;MALAYALAM FRACTION THREE EIGHTIETHS;No;0;L;;;;3/80;N;;;;; +0D5B;MALAYALAM FRACTION ONE TWENTIETH;No;0;L;;;;1/20;N;;;;; +0D5C;MALAYALAM FRACTION ONE TENTH;No;0;L;;;;1/10;N;;;;; +0D5D;MALAYALAM FRACTION THREE TWENTIETHS;No;0;L;;;;3/20;N;;;;; +0D5E;MALAYALAM FRACTION ONE FIFTH;No;0;L;;;;1/5;N;;;;; +0D5F;MALAYALAM LETTER ARCHAIC II;Lo;0;L;;;;;N;;;;; +0D60;MALAYALAM LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +0D61;MALAYALAM LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +0D62;MALAYALAM VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +0D63;MALAYALAM VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +0D66;MALAYALAM DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0D67;MALAYALAM DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0D68;MALAYALAM DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0D69;MALAYALAM DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0D6A;MALAYALAM DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0D6B;MALAYALAM DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0D6C;MALAYALAM DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0D6D;MALAYALAM DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0D6E;MALAYALAM DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0D6F;MALAYALAM DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0D70;MALAYALAM NUMBER TEN;No;0;L;;;;10;N;;;;; +0D71;MALAYALAM NUMBER ONE HUNDRED;No;0;L;;;;100;N;;;;; +0D72;MALAYALAM NUMBER ONE THOUSAND;No;0;L;;;;1000;N;;;;; +0D73;MALAYALAM FRACTION ONE QUARTER;No;0;L;;;;1/4;N;;;;; +0D74;MALAYALAM FRACTION ONE HALF;No;0;L;;;;1/2;N;;;;; +0D75;MALAYALAM FRACTION THREE QUARTERS;No;0;L;;;;3/4;N;;;;; +0D76;MALAYALAM FRACTION ONE SIXTEENTH;No;0;L;;;;1/16;N;;;;; +0D77;MALAYALAM FRACTION ONE EIGHTH;No;0;L;;;;1/8;N;;;;; +0D78;MALAYALAM FRACTION THREE SIXTEENTHS;No;0;L;;;;3/16;N;;;;; +0D79;MALAYALAM DATE MARK;So;0;L;;;;;N;;;;; +0D7A;MALAYALAM LETTER CHILLU NN;Lo;0;L;;;;;N;;;;; +0D7B;MALAYALAM LETTER CHILLU N;Lo;0;L;;;;;N;;;;; +0D7C;MALAYALAM LETTER CHILLU RR;Lo;0;L;;;;;N;;;;; +0D7D;MALAYALAM LETTER CHILLU L;Lo;0;L;;;;;N;;;;; +0D7E;MALAYALAM LETTER CHILLU LL;Lo;0;L;;;;;N;;;;; +0D7F;MALAYALAM LETTER CHILLU K;Lo;0;L;;;;;N;;;;; +0D82;SINHALA SIGN ANUSVARAYA;Mc;0;L;;;;;N;;;;; +0D83;SINHALA SIGN VISARGAYA;Mc;0;L;;;;;N;;;;; +0D85;SINHALA LETTER AYANNA;Lo;0;L;;;;;N;;;;; +0D86;SINHALA LETTER AAYANNA;Lo;0;L;;;;;N;;;;; +0D87;SINHALA LETTER AEYANNA;Lo;0;L;;;;;N;;;;; +0D88;SINHALA LETTER AEEYANNA;Lo;0;L;;;;;N;;;;; +0D89;SINHALA LETTER IYANNA;Lo;0;L;;;;;N;;;;; +0D8A;SINHALA LETTER IIYANNA;Lo;0;L;;;;;N;;;;; +0D8B;SINHALA LETTER UYANNA;Lo;0;L;;;;;N;;;;; +0D8C;SINHALA LETTER UUYANNA;Lo;0;L;;;;;N;;;;; +0D8D;SINHALA LETTER IRUYANNA;Lo;0;L;;;;;N;;;;; +0D8E;SINHALA LETTER IRUUYANNA;Lo;0;L;;;;;N;;;;; +0D8F;SINHALA LETTER ILUYANNA;Lo;0;L;;;;;N;;;;; +0D90;SINHALA LETTER ILUUYANNA;Lo;0;L;;;;;N;;;;; +0D91;SINHALA LETTER EYANNA;Lo;0;L;;;;;N;;;;; +0D92;SINHALA LETTER EEYANNA;Lo;0;L;;;;;N;;;;; +0D93;SINHALA LETTER AIYANNA;Lo;0;L;;;;;N;;;;; +0D94;SINHALA LETTER OYANNA;Lo;0;L;;;;;N;;;;; +0D95;SINHALA LETTER OOYANNA;Lo;0;L;;;;;N;;;;; +0D96;SINHALA LETTER AUYANNA;Lo;0;L;;;;;N;;;;; +0D9A;SINHALA LETTER ALPAPRAANA KAYANNA;Lo;0;L;;;;;N;;;;; +0D9B;SINHALA LETTER MAHAAPRAANA KAYANNA;Lo;0;L;;;;;N;;;;; +0D9C;SINHALA LETTER ALPAPRAANA GAYANNA;Lo;0;L;;;;;N;;;;; +0D9D;SINHALA LETTER MAHAAPRAANA GAYANNA;Lo;0;L;;;;;N;;;;; +0D9E;SINHALA LETTER KANTAJA NAASIKYAYA;Lo;0;L;;;;;N;;;;; +0D9F;SINHALA LETTER SANYAKA GAYANNA;Lo;0;L;;;;;N;;;;; +0DA0;SINHALA LETTER ALPAPRAANA CAYANNA;Lo;0;L;;;;;N;;;;; +0DA1;SINHALA LETTER MAHAAPRAANA CAYANNA;Lo;0;L;;;;;N;;;;; +0DA2;SINHALA LETTER ALPAPRAANA JAYANNA;Lo;0;L;;;;;N;;;;; +0DA3;SINHALA LETTER MAHAAPRAANA JAYANNA;Lo;0;L;;;;;N;;;;; +0DA4;SINHALA LETTER TAALUJA NAASIKYAYA;Lo;0;L;;;;;N;;;;; +0DA5;SINHALA LETTER TAALUJA SANYOOGA NAAKSIKYAYA;Lo;0;L;;;;;N;;;;; +0DA6;SINHALA LETTER SANYAKA JAYANNA;Lo;0;L;;;;;N;;;;; +0DA7;SINHALA LETTER ALPAPRAANA TTAYANNA;Lo;0;L;;;;;N;;;;; +0DA8;SINHALA LETTER MAHAAPRAANA TTAYANNA;Lo;0;L;;;;;N;;;;; +0DA9;SINHALA LETTER ALPAPRAANA DDAYANNA;Lo;0;L;;;;;N;;;;; +0DAA;SINHALA LETTER MAHAAPRAANA DDAYANNA;Lo;0;L;;;;;N;;;;; +0DAB;SINHALA LETTER MUURDHAJA NAYANNA;Lo;0;L;;;;;N;;;;; +0DAC;SINHALA LETTER SANYAKA DDAYANNA;Lo;0;L;;;;;N;;;;; +0DAD;SINHALA LETTER ALPAPRAANA TAYANNA;Lo;0;L;;;;;N;;;;; +0DAE;SINHALA LETTER MAHAAPRAANA TAYANNA;Lo;0;L;;;;;N;;;;; +0DAF;SINHALA LETTER ALPAPRAANA DAYANNA;Lo;0;L;;;;;N;;;;; +0DB0;SINHALA LETTER MAHAAPRAANA DAYANNA;Lo;0;L;;;;;N;;;;; +0DB1;SINHALA LETTER DANTAJA NAYANNA;Lo;0;L;;;;;N;;;;; +0DB3;SINHALA LETTER SANYAKA DAYANNA;Lo;0;L;;;;;N;;;;; +0DB4;SINHALA LETTER ALPAPRAANA PAYANNA;Lo;0;L;;;;;N;;;;; +0DB5;SINHALA LETTER MAHAAPRAANA PAYANNA;Lo;0;L;;;;;N;;;;; +0DB6;SINHALA LETTER ALPAPRAANA BAYANNA;Lo;0;L;;;;;N;;;;; +0DB7;SINHALA LETTER MAHAAPRAANA BAYANNA;Lo;0;L;;;;;N;;;;; +0DB8;SINHALA LETTER MAYANNA;Lo;0;L;;;;;N;;;;; +0DB9;SINHALA LETTER AMBA BAYANNA;Lo;0;L;;;;;N;;;;; +0DBA;SINHALA LETTER YAYANNA;Lo;0;L;;;;;N;;;;; +0DBB;SINHALA LETTER RAYANNA;Lo;0;L;;;;;N;;;;; +0DBD;SINHALA LETTER DANTAJA LAYANNA;Lo;0;L;;;;;N;;;;; +0DC0;SINHALA LETTER VAYANNA;Lo;0;L;;;;;N;;;;; +0DC1;SINHALA LETTER TAALUJA SAYANNA;Lo;0;L;;;;;N;;;;; +0DC2;SINHALA LETTER MUURDHAJA SAYANNA;Lo;0;L;;;;;N;;;;; +0DC3;SINHALA LETTER DANTAJA SAYANNA;Lo;0;L;;;;;N;;;;; +0DC4;SINHALA LETTER HAYANNA;Lo;0;L;;;;;N;;;;; +0DC5;SINHALA LETTER MUURDHAJA LAYANNA;Lo;0;L;;;;;N;;;;; +0DC6;SINHALA LETTER FAYANNA;Lo;0;L;;;;;N;;;;; +0DCA;SINHALA SIGN AL-LAKUNA;Mn;9;NSM;;;;;N;;;;; +0DCF;SINHALA VOWEL SIGN AELA-PILLA;Mc;0;L;;;;;N;;;;; +0DD0;SINHALA VOWEL SIGN KETTI AEDA-PILLA;Mc;0;L;;;;;N;;;;; +0DD1;SINHALA VOWEL SIGN DIGA AEDA-PILLA;Mc;0;L;;;;;N;;;;; +0DD2;SINHALA VOWEL SIGN KETTI IS-PILLA;Mn;0;NSM;;;;;N;;;;; +0DD3;SINHALA VOWEL SIGN DIGA IS-PILLA;Mn;0;NSM;;;;;N;;;;; +0DD4;SINHALA VOWEL SIGN KETTI PAA-PILLA;Mn;0;NSM;;;;;N;;;;; +0DD6;SINHALA VOWEL SIGN DIGA PAA-PILLA;Mn;0;NSM;;;;;N;;;;; +0DD8;SINHALA VOWEL SIGN GAETTA-PILLA;Mc;0;L;;;;;N;;;;; +0DD9;SINHALA VOWEL SIGN KOMBUVA;Mc;0;L;;;;;N;;;;; +0DDA;SINHALA VOWEL SIGN DIGA KOMBUVA;Mc;0;L;0DD9 0DCA;;;;N;;;;; +0DDB;SINHALA VOWEL SIGN KOMBU DEKA;Mc;0;L;;;;;N;;;;; +0DDC;SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA;Mc;0;L;0DD9 0DCF;;;;N;;;;; +0DDD;SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA;Mc;0;L;0DDC 0DCA;;;;N;;;;; +0DDE;SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA;Mc;0;L;0DD9 0DDF;;;;N;;;;; +0DDF;SINHALA VOWEL SIGN GAYANUKITTA;Mc;0;L;;;;;N;;;;; +0DE6;SINHALA LITH DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0DE7;SINHALA LITH DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0DE8;SINHALA LITH DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0DE9;SINHALA LITH DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0DEA;SINHALA LITH DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0DEB;SINHALA LITH DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0DEC;SINHALA LITH DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0DED;SINHALA LITH DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0DEE;SINHALA LITH DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0DEF;SINHALA LITH DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0DF2;SINHALA VOWEL SIGN DIGA GAETTA-PILLA;Mc;0;L;;;;;N;;;;; +0DF3;SINHALA VOWEL SIGN DIGA GAYANUKITTA;Mc;0;L;;;;;N;;;;; +0DF4;SINHALA PUNCTUATION KUNDDALIYA;Po;0;L;;;;;N;;;;; +0E01;THAI CHARACTER KO KAI;Lo;0;L;;;;;N;THAI LETTER KO KAI;;;; +0E02;THAI CHARACTER KHO KHAI;Lo;0;L;;;;;N;THAI LETTER KHO KHAI;;;; +0E03;THAI CHARACTER KHO KHUAT;Lo;0;L;;;;;N;THAI LETTER KHO KHUAT;;;; +0E04;THAI CHARACTER KHO KHWAI;Lo;0;L;;;;;N;THAI LETTER KHO KHWAI;;;; +0E05;THAI CHARACTER KHO KHON;Lo;0;L;;;;;N;THAI LETTER KHO KHON;;;; +0E06;THAI CHARACTER KHO RAKHANG;Lo;0;L;;;;;N;THAI LETTER KHO RAKHANG;;;; +0E07;THAI CHARACTER NGO NGU;Lo;0;L;;;;;N;THAI LETTER NGO NGU;;;; +0E08;THAI CHARACTER CHO CHAN;Lo;0;L;;;;;N;THAI LETTER CHO CHAN;;;; +0E09;THAI CHARACTER CHO CHING;Lo;0;L;;;;;N;THAI LETTER CHO CHING;;;; +0E0A;THAI CHARACTER CHO CHANG;Lo;0;L;;;;;N;THAI LETTER CHO CHANG;;;; +0E0B;THAI CHARACTER SO SO;Lo;0;L;;;;;N;THAI LETTER SO SO;;;; +0E0C;THAI CHARACTER CHO CHOE;Lo;0;L;;;;;N;THAI LETTER CHO CHOE;;;; +0E0D;THAI CHARACTER YO YING;Lo;0;L;;;;;N;THAI LETTER YO YING;;;; +0E0E;THAI CHARACTER DO CHADA;Lo;0;L;;;;;N;THAI LETTER DO CHADA;;;; +0E0F;THAI CHARACTER TO PATAK;Lo;0;L;;;;;N;THAI LETTER TO PATAK;;;; +0E10;THAI CHARACTER THO THAN;Lo;0;L;;;;;N;THAI LETTER THO THAN;;;; +0E11;THAI CHARACTER THO NANGMONTHO;Lo;0;L;;;;;N;THAI LETTER THO NANGMONTHO;;;; +0E12;THAI CHARACTER THO PHUTHAO;Lo;0;L;;;;;N;THAI LETTER THO PHUTHAO;;;; +0E13;THAI CHARACTER NO NEN;Lo;0;L;;;;;N;THAI LETTER NO NEN;;;; +0E14;THAI CHARACTER DO DEK;Lo;0;L;;;;;N;THAI LETTER DO DEK;;;; +0E15;THAI CHARACTER TO TAO;Lo;0;L;;;;;N;THAI LETTER TO TAO;;;; +0E16;THAI CHARACTER THO THUNG;Lo;0;L;;;;;N;THAI LETTER THO THUNG;;;; +0E17;THAI CHARACTER THO THAHAN;Lo;0;L;;;;;N;THAI LETTER THO THAHAN;;;; +0E18;THAI CHARACTER THO THONG;Lo;0;L;;;;;N;THAI LETTER THO THONG;;;; +0E19;THAI CHARACTER NO NU;Lo;0;L;;;;;N;THAI LETTER NO NU;;;; +0E1A;THAI CHARACTER BO BAIMAI;Lo;0;L;;;;;N;THAI LETTER BO BAIMAI;;;; +0E1B;THAI CHARACTER PO PLA;Lo;0;L;;;;;N;THAI LETTER PO PLA;;;; +0E1C;THAI CHARACTER PHO PHUNG;Lo;0;L;;;;;N;THAI LETTER PHO PHUNG;;;; +0E1D;THAI CHARACTER FO FA;Lo;0;L;;;;;N;THAI LETTER FO FA;;;; +0E1E;THAI CHARACTER PHO PHAN;Lo;0;L;;;;;N;THAI LETTER PHO PHAN;;;; +0E1F;THAI CHARACTER FO FAN;Lo;0;L;;;;;N;THAI LETTER FO FAN;;;; +0E20;THAI CHARACTER PHO SAMPHAO;Lo;0;L;;;;;N;THAI LETTER PHO SAMPHAO;;;; +0E21;THAI CHARACTER MO MA;Lo;0;L;;;;;N;THAI LETTER MO MA;;;; +0E22;THAI CHARACTER YO YAK;Lo;0;L;;;;;N;THAI LETTER YO YAK;;;; +0E23;THAI CHARACTER RO RUA;Lo;0;L;;;;;N;THAI LETTER RO RUA;;;; +0E24;THAI CHARACTER RU;Lo;0;L;;;;;N;THAI LETTER RU;;;; +0E25;THAI CHARACTER LO LING;Lo;0;L;;;;;N;THAI LETTER LO LING;;;; +0E26;THAI CHARACTER LU;Lo;0;L;;;;;N;THAI LETTER LU;;;; +0E27;THAI CHARACTER WO WAEN;Lo;0;L;;;;;N;THAI LETTER WO WAEN;;;; +0E28;THAI CHARACTER SO SALA;Lo;0;L;;;;;N;THAI LETTER SO SALA;;;; +0E29;THAI CHARACTER SO RUSI;Lo;0;L;;;;;N;THAI LETTER SO RUSI;;;; +0E2A;THAI CHARACTER SO SUA;Lo;0;L;;;;;N;THAI LETTER SO SUA;;;; +0E2B;THAI CHARACTER HO HIP;Lo;0;L;;;;;N;THAI LETTER HO HIP;;;; +0E2C;THAI CHARACTER LO CHULA;Lo;0;L;;;;;N;THAI LETTER LO CHULA;;;; +0E2D;THAI CHARACTER O ANG;Lo;0;L;;;;;N;THAI LETTER O ANG;;;; +0E2E;THAI CHARACTER HO NOKHUK;Lo;0;L;;;;;N;THAI LETTER HO NOK HUK;;;; +0E2F;THAI CHARACTER PAIYANNOI;Lo;0;L;;;;;N;THAI PAI YAN NOI;;;; +0E30;THAI CHARACTER SARA A;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA A;;;; +0E31;THAI CHARACTER MAI HAN-AKAT;Mn;0;NSM;;;;;N;THAI VOWEL SIGN MAI HAN-AKAT;;;; +0E32;THAI CHARACTER SARA AA;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA AA;;;; +0E33;THAI CHARACTER SARA AM;Lo;0;L;<compat> 0E4D 0E32;;;;N;THAI VOWEL SIGN SARA AM;;;; +0E34;THAI CHARACTER SARA I;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA I;;;; +0E35;THAI CHARACTER SARA II;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA II;;;; +0E36;THAI CHARACTER SARA UE;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA UE;;;; +0E37;THAI CHARACTER SARA UEE;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA UEE;;;; +0E38;THAI CHARACTER SARA U;Mn;103;NSM;;;;;N;THAI VOWEL SIGN SARA U;;;; +0E39;THAI CHARACTER SARA UU;Mn;103;NSM;;;;;N;THAI VOWEL SIGN SARA UU;;;; +0E3A;THAI CHARACTER PHINTHU;Mn;9;NSM;;;;;N;THAI VOWEL SIGN PHINTHU;;;; +0E3F;THAI CURRENCY SYMBOL BAHT;Sc;0;ET;;;;;N;THAI BAHT SIGN;;;; +0E40;THAI CHARACTER SARA E;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA E;;;; +0E41;THAI CHARACTER SARA AE;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA AE;;;; +0E42;THAI CHARACTER SARA O;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA O;;;; +0E43;THAI CHARACTER SARA AI MAIMUAN;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA MAI MUAN;;;; +0E44;THAI CHARACTER SARA AI MAIMALAI;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA MAI MALAI;;;; +0E45;THAI CHARACTER LAKKHANGYAO;Lo;0;L;;;;;N;THAI LAK KHANG YAO;;;; +0E46;THAI CHARACTER MAIYAMOK;Lm;0;L;;;;;N;THAI MAI YAMOK;;;; +0E47;THAI CHARACTER MAITAIKHU;Mn;0;NSM;;;;;N;THAI VOWEL SIGN MAI TAI KHU;;;; +0E48;THAI CHARACTER MAI EK;Mn;107;NSM;;;;;N;THAI TONE MAI EK;;;; +0E49;THAI CHARACTER MAI THO;Mn;107;NSM;;;;;N;THAI TONE MAI THO;;;; +0E4A;THAI CHARACTER MAI TRI;Mn;107;NSM;;;;;N;THAI TONE MAI TRI;;;; +0E4B;THAI CHARACTER MAI CHATTAWA;Mn;107;NSM;;;;;N;THAI TONE MAI CHATTAWA;;;; +0E4C;THAI CHARACTER THANTHAKHAT;Mn;0;NSM;;;;;N;THAI THANTHAKHAT;;;; +0E4D;THAI CHARACTER NIKHAHIT;Mn;0;NSM;;;;;N;THAI NIKKHAHIT;;;; +0E4E;THAI CHARACTER YAMAKKAN;Mn;0;NSM;;;;;N;THAI YAMAKKAN;;;; +0E4F;THAI CHARACTER FONGMAN;Po;0;L;;;;;N;THAI FONGMAN;;;; +0E50;THAI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0E51;THAI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0E52;THAI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0E53;THAI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0E54;THAI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0E55;THAI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0E56;THAI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0E57;THAI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0E58;THAI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0E59;THAI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0E5A;THAI CHARACTER ANGKHANKHU;Po;0;L;;;;;N;THAI ANGKHANKHU;;;; +0E5B;THAI CHARACTER KHOMUT;Po;0;L;;;;;N;THAI KHOMUT;;;; +0E81;LAO LETTER KO;Lo;0;L;;;;;N;;;;; +0E82;LAO LETTER KHO SUNG;Lo;0;L;;;;;N;;;;; +0E84;LAO LETTER KHO TAM;Lo;0;L;;;;;N;;;;; +0E87;LAO LETTER NGO;Lo;0;L;;;;;N;;;;; +0E88;LAO LETTER CO;Lo;0;L;;;;;N;;;;; +0E8A;LAO LETTER SO TAM;Lo;0;L;;;;;N;;;;; +0E8D;LAO LETTER NYO;Lo;0;L;;;;;N;;;;; +0E94;LAO LETTER DO;Lo;0;L;;;;;N;;;;; +0E95;LAO LETTER TO;Lo;0;L;;;;;N;;;;; +0E96;LAO LETTER THO SUNG;Lo;0;L;;;;;N;;;;; +0E97;LAO LETTER THO TAM;Lo;0;L;;;;;N;;;;; +0E99;LAO LETTER NO;Lo;0;L;;;;;N;;;;; +0E9A;LAO LETTER BO;Lo;0;L;;;;;N;;;;; +0E9B;LAO LETTER PO;Lo;0;L;;;;;N;;;;; +0E9C;LAO LETTER PHO SUNG;Lo;0;L;;;;;N;;;;; +0E9D;LAO LETTER FO TAM;Lo;0;L;;;;;N;;;;; +0E9E;LAO LETTER PHO TAM;Lo;0;L;;;;;N;;;;; +0E9F;LAO LETTER FO SUNG;Lo;0;L;;;;;N;;;;; +0EA1;LAO LETTER MO;Lo;0;L;;;;;N;;;;; +0EA2;LAO LETTER YO;Lo;0;L;;;;;N;;;;; +0EA3;LAO LETTER LO LING;Lo;0;L;;;;;N;;;;; +0EA5;LAO LETTER LO LOOT;Lo;0;L;;;;;N;;;;; +0EA7;LAO LETTER WO;Lo;0;L;;;;;N;;;;; +0EAA;LAO LETTER SO SUNG;Lo;0;L;;;;;N;;;;; +0EAB;LAO LETTER HO SUNG;Lo;0;L;;;;;N;;;;; +0EAD;LAO LETTER O;Lo;0;L;;;;;N;;;;; +0EAE;LAO LETTER HO TAM;Lo;0;L;;;;;N;;;;; +0EAF;LAO ELLIPSIS;Lo;0;L;;;;;N;;;;; +0EB0;LAO VOWEL SIGN A;Lo;0;L;;;;;N;;;;; +0EB1;LAO VOWEL SIGN MAI KAN;Mn;0;NSM;;;;;N;;;;; +0EB2;LAO VOWEL SIGN AA;Lo;0;L;;;;;N;;;;; +0EB3;LAO VOWEL SIGN AM;Lo;0;L;<compat> 0ECD 0EB2;;;;N;;;;; +0EB4;LAO VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +0EB5;LAO VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +0EB6;LAO VOWEL SIGN Y;Mn;0;NSM;;;;;N;;;;; +0EB7;LAO VOWEL SIGN YY;Mn;0;NSM;;;;;N;;;;; +0EB8;LAO VOWEL SIGN U;Mn;118;NSM;;;;;N;;;;; +0EB9;LAO VOWEL SIGN UU;Mn;118;NSM;;;;;N;;;;; +0EBB;LAO VOWEL SIGN MAI KON;Mn;0;NSM;;;;;N;;;;; +0EBC;LAO SEMIVOWEL SIGN LO;Mn;0;NSM;;;;;N;;;;; +0EBD;LAO SEMIVOWEL SIGN NYO;Lo;0;L;;;;;N;;;;; +0EC0;LAO VOWEL SIGN E;Lo;0;L;;;;;N;;;;; +0EC1;LAO VOWEL SIGN EI;Lo;0;L;;;;;N;;;;; +0EC2;LAO VOWEL SIGN O;Lo;0;L;;;;;N;;;;; +0EC3;LAO VOWEL SIGN AY;Lo;0;L;;;;;N;;;;; +0EC4;LAO VOWEL SIGN AI;Lo;0;L;;;;;N;;;;; +0EC6;LAO KO LA;Lm;0;L;;;;;N;;;;; +0EC8;LAO TONE MAI EK;Mn;122;NSM;;;;;N;;;;; +0EC9;LAO TONE MAI THO;Mn;122;NSM;;;;;N;;;;; +0ECA;LAO TONE MAI TI;Mn;122;NSM;;;;;N;;;;; +0ECB;LAO TONE MAI CATAWA;Mn;122;NSM;;;;;N;;;;; +0ECC;LAO CANCELLATION MARK;Mn;0;NSM;;;;;N;;;;; +0ECD;LAO NIGGAHITA;Mn;0;NSM;;;;;N;;;;; +0ED0;LAO DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0ED1;LAO DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0ED2;LAO DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0ED3;LAO DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0ED4;LAO DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0ED5;LAO DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0ED6;LAO DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0ED7;LAO DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0ED8;LAO DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0ED9;LAO DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0EDC;LAO HO NO;Lo;0;L;<compat> 0EAB 0E99;;;;N;;;;; +0EDD;LAO HO MO;Lo;0;L;<compat> 0EAB 0EA1;;;;N;;;;; +0EDE;LAO LETTER KHMU GO;Lo;0;L;;;;;N;;;;; +0EDF;LAO LETTER KHMU NYO;Lo;0;L;;;;;N;;;;; +0F00;TIBETAN SYLLABLE OM;Lo;0;L;;;;;N;;;;; +0F01;TIBETAN MARK GTER YIG MGO TRUNCATED A;So;0;L;;;;;N;;;;; +0F02;TIBETAN MARK GTER YIG MGO -UM RNAM BCAD MA;So;0;L;;;;;N;;;;; +0F03;TIBETAN MARK GTER YIG MGO -UM GTER TSHEG MA;So;0;L;;;;;N;;;;; +0F04;TIBETAN MARK INITIAL YIG MGO MDUN MA;Po;0;L;;;;;N;TIBETAN SINGLE ORNAMENT;;;; +0F05;TIBETAN MARK CLOSING YIG MGO SGAB MA;Po;0;L;;;;;N;;;;; +0F06;TIBETAN MARK CARET YIG MGO PHUR SHAD MA;Po;0;L;;;;;N;;;;; +0F07;TIBETAN MARK YIG MGO TSHEG SHAD MA;Po;0;L;;;;;N;;;;; +0F08;TIBETAN MARK SBRUL SHAD;Po;0;L;;;;;N;TIBETAN RGYANSHAD;;;; +0F09;TIBETAN MARK BSKUR YIG MGO;Po;0;L;;;;;N;;;;; +0F0A;TIBETAN MARK BKA- SHOG YIG MGO;Po;0;L;;;;;N;;;;; +0F0B;TIBETAN MARK INTERSYLLABIC TSHEG;Po;0;L;;;;;N;TIBETAN TSEG;;;; +0F0C;TIBETAN MARK DELIMITER TSHEG BSTAR;Po;0;L;<noBreak> 0F0B;;;;N;;;;; +0F0D;TIBETAN MARK SHAD;Po;0;L;;;;;N;TIBETAN SHAD;;;; +0F0E;TIBETAN MARK NYIS SHAD;Po;0;L;;;;;N;TIBETAN DOUBLE SHAD;;;; +0F0F;TIBETAN MARK TSHEG SHAD;Po;0;L;;;;;N;;;;; +0F10;TIBETAN MARK NYIS TSHEG SHAD;Po;0;L;;;;;N;;;;; +0F11;TIBETAN MARK RIN CHEN SPUNGS SHAD;Po;0;L;;;;;N;TIBETAN RINCHANPHUNGSHAD;;;; +0F12;TIBETAN MARK RGYA GRAM SHAD;Po;0;L;;;;;N;;;;; +0F13;TIBETAN MARK CARET -DZUD RTAGS ME LONG CAN;So;0;L;;;;;N;;;;; +0F14;TIBETAN MARK GTER TSHEG;Po;0;L;;;;;N;TIBETAN COMMA;;;; +0F15;TIBETAN LOGOTYPE SIGN CHAD RTAGS;So;0;L;;;;;N;;;;; +0F16;TIBETAN LOGOTYPE SIGN LHAG RTAGS;So;0;L;;;;;N;;;;; +0F17;TIBETAN ASTROLOGICAL SIGN SGRA GCAN -CHAR RTAGS;So;0;L;;;;;N;;;;; +0F18;TIBETAN ASTROLOGICAL SIGN -KHYUD PA;Mn;220;NSM;;;;;N;;;;; +0F19;TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS;Mn;220;NSM;;;;;N;;;;; +0F1A;TIBETAN SIGN RDEL DKAR GCIG;So;0;L;;;;;N;;;;; +0F1B;TIBETAN SIGN RDEL DKAR GNYIS;So;0;L;;;;;N;;;;; +0F1C;TIBETAN SIGN RDEL DKAR GSUM;So;0;L;;;;;N;;;;; +0F1D;TIBETAN SIGN RDEL NAG GCIG;So;0;L;;;;;N;;;;; +0F1E;TIBETAN SIGN RDEL NAG GNYIS;So;0;L;;;;;N;;;;; +0F1F;TIBETAN SIGN RDEL DKAR RDEL NAG;So;0;L;;;;;N;;;;; +0F20;TIBETAN DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +0F21;TIBETAN DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +0F22;TIBETAN DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +0F23;TIBETAN DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +0F24;TIBETAN DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +0F25;TIBETAN DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +0F26;TIBETAN DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +0F27;TIBETAN DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +0F28;TIBETAN DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +0F29;TIBETAN DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +0F2A;TIBETAN DIGIT HALF ONE;No;0;L;;;;1/2;N;;;;; +0F2B;TIBETAN DIGIT HALF TWO;No;0;L;;;;3/2;N;;;;; +0F2C;TIBETAN DIGIT HALF THREE;No;0;L;;;;5/2;N;;;;; +0F2D;TIBETAN DIGIT HALF FOUR;No;0;L;;;;7/2;N;;;;; +0F2E;TIBETAN DIGIT HALF FIVE;No;0;L;;;;9/2;N;;;;; +0F2F;TIBETAN DIGIT HALF SIX;No;0;L;;;;11/2;N;;;;; +0F30;TIBETAN DIGIT HALF SEVEN;No;0;L;;;;13/2;N;;;;; +0F31;TIBETAN DIGIT HALF EIGHT;No;0;L;;;;15/2;N;;;;; +0F32;TIBETAN DIGIT HALF NINE;No;0;L;;;;17/2;N;;;;; +0F33;TIBETAN DIGIT HALF ZERO;No;0;L;;;;-1/2;N;;;;; +0F34;TIBETAN MARK BSDUS RTAGS;So;0;L;;;;;N;;;;; +0F35;TIBETAN MARK NGAS BZUNG NYI ZLA;Mn;220;NSM;;;;;N;TIBETAN HONORIFIC UNDER RING;;;; +0F36;TIBETAN MARK CARET -DZUD RTAGS BZHI MIG CAN;So;0;L;;;;;N;;;;; +0F37;TIBETAN MARK NGAS BZUNG SGOR RTAGS;Mn;220;NSM;;;;;N;TIBETAN UNDER RING;;;; +0F38;TIBETAN MARK CHE MGO;So;0;L;;;;;N;;;;; +0F39;TIBETAN MARK TSA -PHRU;Mn;216;NSM;;;;;N;TIBETAN LENITION MARK;;;; +0F3A;TIBETAN MARK GUG RTAGS GYON;Ps;0;ON;;;;;Y;;;;; +0F3B;TIBETAN MARK GUG RTAGS GYAS;Pe;0;ON;;;;;Y;;;;; +0F3C;TIBETAN MARK ANG KHANG GYON;Ps;0;ON;;;;;Y;TIBETAN LEFT BRACE;;;; +0F3D;TIBETAN MARK ANG KHANG GYAS;Pe;0;ON;;;;;Y;TIBETAN RIGHT BRACE;;;; +0F3E;TIBETAN SIGN YAR TSHES;Mc;0;L;;;;;N;;;;; +0F3F;TIBETAN SIGN MAR TSHES;Mc;0;L;;;;;N;;;;; +0F40;TIBETAN LETTER KA;Lo;0;L;;;;;N;;;;; +0F41;TIBETAN LETTER KHA;Lo;0;L;;;;;N;;;;; +0F42;TIBETAN LETTER GA;Lo;0;L;;;;;N;;;;; +0F43;TIBETAN LETTER GHA;Lo;0;L;0F42 0FB7;;;;N;;;;; +0F44;TIBETAN LETTER NGA;Lo;0;L;;;;;N;;;;; +0F45;TIBETAN LETTER CA;Lo;0;L;;;;;N;;;;; +0F46;TIBETAN LETTER CHA;Lo;0;L;;;;;N;;;;; +0F47;TIBETAN LETTER JA;Lo;0;L;;;;;N;;;;; +0F49;TIBETAN LETTER NYA;Lo;0;L;;;;;N;;;;; +0F4A;TIBETAN LETTER TTA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED TA;;;; +0F4B;TIBETAN LETTER TTHA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED THA;;;; +0F4C;TIBETAN LETTER DDA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED DA;;;; +0F4D;TIBETAN LETTER DDHA;Lo;0;L;0F4C 0FB7;;;;N;;;;; +0F4E;TIBETAN LETTER NNA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED NA;;;; +0F4F;TIBETAN LETTER TA;Lo;0;L;;;;;N;;;;; +0F50;TIBETAN LETTER THA;Lo;0;L;;;;;N;;;;; +0F51;TIBETAN LETTER DA;Lo;0;L;;;;;N;;;;; +0F52;TIBETAN LETTER DHA;Lo;0;L;0F51 0FB7;;;;N;;;;; +0F53;TIBETAN LETTER NA;Lo;0;L;;;;;N;;;;; +0F54;TIBETAN LETTER PA;Lo;0;L;;;;;N;;;;; +0F55;TIBETAN LETTER PHA;Lo;0;L;;;;;N;;;;; +0F56;TIBETAN LETTER BA;Lo;0;L;;;;;N;;;;; +0F57;TIBETAN LETTER BHA;Lo;0;L;0F56 0FB7;;;;N;;;;; +0F58;TIBETAN LETTER MA;Lo;0;L;;;;;N;;;;; +0F59;TIBETAN LETTER TSA;Lo;0;L;;;;;N;;;;; +0F5A;TIBETAN LETTER TSHA;Lo;0;L;;;;;N;;;;; +0F5B;TIBETAN LETTER DZA;Lo;0;L;;;;;N;;;;; +0F5C;TIBETAN LETTER DZHA;Lo;0;L;0F5B 0FB7;;;;N;;;;; +0F5D;TIBETAN LETTER WA;Lo;0;L;;;;;N;;;;; +0F5E;TIBETAN LETTER ZHA;Lo;0;L;;;;;N;;;;; +0F5F;TIBETAN LETTER ZA;Lo;0;L;;;;;N;;;;; +0F60;TIBETAN LETTER -A;Lo;0;L;;;;;N;TIBETAN LETTER AA;;;; +0F61;TIBETAN LETTER YA;Lo;0;L;;;;;N;;;;; +0F62;TIBETAN LETTER RA;Lo;0;L;;;;;N;;;;; +0F63;TIBETAN LETTER LA;Lo;0;L;;;;;N;;;;; +0F64;TIBETAN LETTER SHA;Lo;0;L;;;;;N;;;;; +0F65;TIBETAN LETTER SSA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED SHA;;;; +0F66;TIBETAN LETTER SA;Lo;0;L;;;;;N;;;;; +0F67;TIBETAN LETTER HA;Lo;0;L;;;;;N;;;;; +0F68;TIBETAN LETTER A;Lo;0;L;;;;;N;;;;; +0F69;TIBETAN LETTER KSSA;Lo;0;L;0F40 0FB5;;;;N;;;;; +0F6A;TIBETAN LETTER FIXED-FORM RA;Lo;0;L;;;;;N;;;;; +0F6B;TIBETAN LETTER KKA;Lo;0;L;;;;;N;;;;; +0F6C;TIBETAN LETTER RRA;Lo;0;L;;;;;N;;;;; +0F71;TIBETAN VOWEL SIGN AA;Mn;129;NSM;;;;;N;;;;; +0F72;TIBETAN VOWEL SIGN I;Mn;130;NSM;;;;;N;;;;; +0F73;TIBETAN VOWEL SIGN II;Mn;0;NSM;0F71 0F72;;;;N;;;;; +0F74;TIBETAN VOWEL SIGN U;Mn;132;NSM;;;;;N;;;;; +0F75;TIBETAN VOWEL SIGN UU;Mn;0;NSM;0F71 0F74;;;;N;;;;; +0F76;TIBETAN VOWEL SIGN VOCALIC R;Mn;0;NSM;0FB2 0F80;;;;N;;;;; +0F77;TIBETAN VOWEL SIGN VOCALIC RR;Mn;0;NSM;<compat> 0FB2 0F81;;;;N;;;;; +0F78;TIBETAN VOWEL SIGN VOCALIC L;Mn;0;NSM;0FB3 0F80;;;;N;;;;; +0F79;TIBETAN VOWEL SIGN VOCALIC LL;Mn;0;NSM;<compat> 0FB3 0F81;;;;N;;;;; +0F7A;TIBETAN VOWEL SIGN E;Mn;130;NSM;;;;;N;;;;; +0F7B;TIBETAN VOWEL SIGN EE;Mn;130;NSM;;;;;N;TIBETAN VOWEL SIGN AI;;;; +0F7C;TIBETAN VOWEL SIGN O;Mn;130;NSM;;;;;N;;;;; +0F7D;TIBETAN VOWEL SIGN OO;Mn;130;NSM;;;;;N;TIBETAN VOWEL SIGN AU;;;; +0F7E;TIBETAN SIGN RJES SU NGA RO;Mn;0;NSM;;;;;N;TIBETAN ANUSVARA;;;; +0F7F;TIBETAN SIGN RNAM BCAD;Mc;0;L;;;;;N;TIBETAN VISARGA;;;; +0F80;TIBETAN VOWEL SIGN REVERSED I;Mn;130;NSM;;;;;N;TIBETAN VOWEL SIGN SHORT I;;;; +0F81;TIBETAN VOWEL SIGN REVERSED II;Mn;0;NSM;0F71 0F80;;;;N;;;;; +0F82;TIBETAN SIGN NYI ZLA NAA DA;Mn;230;NSM;;;;;N;TIBETAN CANDRABINDU WITH ORNAMENT;;;; +0F83;TIBETAN SIGN SNA LDAN;Mn;230;NSM;;;;;N;TIBETAN CANDRABINDU;;;; +0F84;TIBETAN MARK HALANTA;Mn;9;NSM;;;;;N;TIBETAN VIRAMA;;;; +0F85;TIBETAN MARK PALUTA;Po;0;L;;;;;N;TIBETAN CHUCHENYIGE;;;; +0F86;TIBETAN SIGN LCI RTAGS;Mn;230;NSM;;;;;N;;;;; +0F87;TIBETAN SIGN YANG RTAGS;Mn;230;NSM;;;;;N;;;;; +0F88;TIBETAN SIGN LCE TSA CAN;Lo;0;L;;;;;N;;;;; +0F89;TIBETAN SIGN MCHU CAN;Lo;0;L;;;;;N;;;;; +0F8A;TIBETAN SIGN GRU CAN RGYINGS;Lo;0;L;;;;;N;;;;; +0F8B;TIBETAN SIGN GRU MED RGYINGS;Lo;0;L;;;;;N;;;;; +0F8C;TIBETAN SIGN INVERTED MCHU CAN;Lo;0;L;;;;;N;;;;; +0F8D;TIBETAN SUBJOINED SIGN LCE TSA CAN;Mn;0;NSM;;;;;N;;;;; +0F8E;TIBETAN SUBJOINED SIGN MCHU CAN;Mn;0;NSM;;;;;N;;;;; +0F8F;TIBETAN SUBJOINED SIGN INVERTED MCHU CAN;Mn;0;NSM;;;;;N;;;;; +0F90;TIBETAN SUBJOINED LETTER KA;Mn;0;NSM;;;;;N;;;;; +0F91;TIBETAN SUBJOINED LETTER KHA;Mn;0;NSM;;;;;N;;;;; +0F92;TIBETAN SUBJOINED LETTER GA;Mn;0;NSM;;;;;N;;;;; +0F93;TIBETAN SUBJOINED LETTER GHA;Mn;0;NSM;0F92 0FB7;;;;N;;;;; +0F94;TIBETAN SUBJOINED LETTER NGA;Mn;0;NSM;;;;;N;;;;; +0F95;TIBETAN SUBJOINED LETTER CA;Mn;0;NSM;;;;;N;;;;; +0F96;TIBETAN SUBJOINED LETTER CHA;Mn;0;NSM;;;;;N;;;;; +0F97;TIBETAN SUBJOINED LETTER JA;Mn;0;NSM;;;;;N;;;;; +0F99;TIBETAN SUBJOINED LETTER NYA;Mn;0;NSM;;;;;N;;;;; +0F9A;TIBETAN SUBJOINED LETTER TTA;Mn;0;NSM;;;;;N;;;;; +0F9B;TIBETAN SUBJOINED LETTER TTHA;Mn;0;NSM;;;;;N;;;;; +0F9C;TIBETAN SUBJOINED LETTER DDA;Mn;0;NSM;;;;;N;;;;; +0F9D;TIBETAN SUBJOINED LETTER DDHA;Mn;0;NSM;0F9C 0FB7;;;;N;;;;; +0F9E;TIBETAN SUBJOINED LETTER NNA;Mn;0;NSM;;;;;N;;;;; +0F9F;TIBETAN SUBJOINED LETTER TA;Mn;0;NSM;;;;;N;;;;; +0FA0;TIBETAN SUBJOINED LETTER THA;Mn;0;NSM;;;;;N;;;;; +0FA1;TIBETAN SUBJOINED LETTER DA;Mn;0;NSM;;;;;N;;;;; +0FA2;TIBETAN SUBJOINED LETTER DHA;Mn;0;NSM;0FA1 0FB7;;;;N;;;;; +0FA3;TIBETAN SUBJOINED LETTER NA;Mn;0;NSM;;;;;N;;;;; +0FA4;TIBETAN SUBJOINED LETTER PA;Mn;0;NSM;;;;;N;;;;; +0FA5;TIBETAN SUBJOINED LETTER PHA;Mn;0;NSM;;;;;N;;;;; +0FA6;TIBETAN SUBJOINED LETTER BA;Mn;0;NSM;;;;;N;;;;; +0FA7;TIBETAN SUBJOINED LETTER BHA;Mn;0;NSM;0FA6 0FB7;;;;N;;;;; +0FA8;TIBETAN SUBJOINED LETTER MA;Mn;0;NSM;;;;;N;;;;; +0FA9;TIBETAN SUBJOINED LETTER TSA;Mn;0;NSM;;;;;N;;;;; +0FAA;TIBETAN SUBJOINED LETTER TSHA;Mn;0;NSM;;;;;N;;;;; +0FAB;TIBETAN SUBJOINED LETTER DZA;Mn;0;NSM;;;;;N;;;;; +0FAC;TIBETAN SUBJOINED LETTER DZHA;Mn;0;NSM;0FAB 0FB7;;;;N;;;;; +0FAD;TIBETAN SUBJOINED LETTER WA;Mn;0;NSM;;;;;N;;;;; +0FAE;TIBETAN SUBJOINED LETTER ZHA;Mn;0;NSM;;;;;N;;;;; +0FAF;TIBETAN SUBJOINED LETTER ZA;Mn;0;NSM;;;;;N;;;;; +0FB0;TIBETAN SUBJOINED LETTER -A;Mn;0;NSM;;;;;N;;;;; +0FB1;TIBETAN SUBJOINED LETTER YA;Mn;0;NSM;;;;;N;;;;; +0FB2;TIBETAN SUBJOINED LETTER RA;Mn;0;NSM;;;;;N;;;;; +0FB3;TIBETAN SUBJOINED LETTER LA;Mn;0;NSM;;;;;N;;;;; +0FB4;TIBETAN SUBJOINED LETTER SHA;Mn;0;NSM;;;;;N;;;;; +0FB5;TIBETAN SUBJOINED LETTER SSA;Mn;0;NSM;;;;;N;;;;; +0FB6;TIBETAN SUBJOINED LETTER SA;Mn;0;NSM;;;;;N;;;;; +0FB7;TIBETAN SUBJOINED LETTER HA;Mn;0;NSM;;;;;N;;;;; +0FB8;TIBETAN SUBJOINED LETTER A;Mn;0;NSM;;;;;N;;;;; +0FB9;TIBETAN SUBJOINED LETTER KSSA;Mn;0;NSM;0F90 0FB5;;;;N;;;;; +0FBA;TIBETAN SUBJOINED LETTER FIXED-FORM WA;Mn;0;NSM;;;;;N;;;;; +0FBB;TIBETAN SUBJOINED LETTER FIXED-FORM YA;Mn;0;NSM;;;;;N;;;;; +0FBC;TIBETAN SUBJOINED LETTER FIXED-FORM RA;Mn;0;NSM;;;;;N;;;;; +0FBE;TIBETAN KU RU KHA;So;0;L;;;;;N;;;;; +0FBF;TIBETAN KU RU KHA BZHI MIG CAN;So;0;L;;;;;N;;;;; +0FC0;TIBETAN CANTILLATION SIGN HEAVY BEAT;So;0;L;;;;;N;;;;; +0FC1;TIBETAN CANTILLATION SIGN LIGHT BEAT;So;0;L;;;;;N;;;;; +0FC2;TIBETAN CANTILLATION SIGN CANG TE-U;So;0;L;;;;;N;;;;; +0FC3;TIBETAN CANTILLATION SIGN SBUB -CHAL;So;0;L;;;;;N;;;;; +0FC4;TIBETAN SYMBOL DRIL BU;So;0;L;;;;;N;;;;; +0FC5;TIBETAN SYMBOL RDO RJE;So;0;L;;;;;N;;;;; +0FC6;TIBETAN SYMBOL PADMA GDAN;Mn;220;NSM;;;;;N;;;;; +0FC7;TIBETAN SYMBOL RDO RJE RGYA GRAM;So;0;L;;;;;N;;;;; +0FC8;TIBETAN SYMBOL PHUR PA;So;0;L;;;;;N;;;;; +0FC9;TIBETAN SYMBOL NOR BU;So;0;L;;;;;N;;;;; +0FCA;TIBETAN SYMBOL NOR BU NYIS -KHYIL;So;0;L;;;;;N;;;;; +0FCB;TIBETAN SYMBOL NOR BU GSUM -KHYIL;So;0;L;;;;;N;;;;; +0FCC;TIBETAN SYMBOL NOR BU BZHI -KHYIL;So;0;L;;;;;N;;;;; +0FCE;TIBETAN SIGN RDEL NAG RDEL DKAR;So;0;L;;;;;N;;;;; +0FCF;TIBETAN SIGN RDEL NAG GSUM;So;0;L;;;;;N;;;;; +0FD0;TIBETAN MARK BSKA- SHOG GI MGO RGYAN;Po;0;L;;;;;N;;;;; +0FD1;TIBETAN MARK MNYAM YIG GI MGO RGYAN;Po;0;L;;;;;N;;;;; +0FD2;TIBETAN MARK NYIS TSHEG;Po;0;L;;;;;N;;;;; +0FD3;TIBETAN MARK INITIAL BRDA RNYING YIG MGO MDUN MA;Po;0;L;;;;;N;;;;; +0FD4;TIBETAN MARK CLOSING BRDA RNYING YIG MGO SGAB MA;Po;0;L;;;;;N;;;;; +0FD5;RIGHT-FACING SVASTI SIGN;So;0;L;;;;;N;;;;; +0FD6;LEFT-FACING SVASTI SIGN;So;0;L;;;;;N;;;;; +0FD7;RIGHT-FACING SVASTI SIGN WITH DOTS;So;0;L;;;;;N;;;;; +0FD8;LEFT-FACING SVASTI SIGN WITH DOTS;So;0;L;;;;;N;;;;; +0FD9;TIBETAN MARK LEADING MCHAN RTAGS;Po;0;L;;;;;N;;;;; +0FDA;TIBETAN MARK TRAILING MCHAN RTAGS;Po;0;L;;;;;N;;;;; +1000;MYANMAR LETTER KA;Lo;0;L;;;;;N;;;;; +1001;MYANMAR LETTER KHA;Lo;0;L;;;;;N;;;;; +1002;MYANMAR LETTER GA;Lo;0;L;;;;;N;;;;; +1003;MYANMAR LETTER GHA;Lo;0;L;;;;;N;;;;; +1004;MYANMAR LETTER NGA;Lo;0;L;;;;;N;;;;; +1005;MYANMAR LETTER CA;Lo;0;L;;;;;N;;;;; +1006;MYANMAR LETTER CHA;Lo;0;L;;;;;N;;;;; +1007;MYANMAR LETTER JA;Lo;0;L;;;;;N;;;;; +1008;MYANMAR LETTER JHA;Lo;0;L;;;;;N;;;;; +1009;MYANMAR LETTER NYA;Lo;0;L;;;;;N;;;;; +100A;MYANMAR LETTER NNYA;Lo;0;L;;;;;N;;;;; +100B;MYANMAR LETTER TTA;Lo;0;L;;;;;N;;;;; +100C;MYANMAR LETTER TTHA;Lo;0;L;;;;;N;;;;; +100D;MYANMAR LETTER DDA;Lo;0;L;;;;;N;;;;; +100E;MYANMAR LETTER DDHA;Lo;0;L;;;;;N;;;;; +100F;MYANMAR LETTER NNA;Lo;0;L;;;;;N;;;;; +1010;MYANMAR LETTER TA;Lo;0;L;;;;;N;;;;; +1011;MYANMAR LETTER THA;Lo;0;L;;;;;N;;;;; +1012;MYANMAR LETTER DA;Lo;0;L;;;;;N;;;;; +1013;MYANMAR LETTER DHA;Lo;0;L;;;;;N;;;;; +1014;MYANMAR LETTER NA;Lo;0;L;;;;;N;;;;; +1015;MYANMAR LETTER PA;Lo;0;L;;;;;N;;;;; +1016;MYANMAR LETTER PHA;Lo;0;L;;;;;N;;;;; +1017;MYANMAR LETTER BA;Lo;0;L;;;;;N;;;;; +1018;MYANMAR LETTER BHA;Lo;0;L;;;;;N;;;;; +1019;MYANMAR LETTER MA;Lo;0;L;;;;;N;;;;; +101A;MYANMAR LETTER YA;Lo;0;L;;;;;N;;;;; +101B;MYANMAR LETTER RA;Lo;0;L;;;;;N;;;;; +101C;MYANMAR LETTER LA;Lo;0;L;;;;;N;;;;; +101D;MYANMAR LETTER WA;Lo;0;L;;;;;N;;;;; +101E;MYANMAR LETTER SA;Lo;0;L;;;;;N;;;;; +101F;MYANMAR LETTER HA;Lo;0;L;;;;;N;;;;; +1020;MYANMAR LETTER LLA;Lo;0;L;;;;;N;;;;; +1021;MYANMAR LETTER A;Lo;0;L;;;;;N;;;;; +1022;MYANMAR LETTER SHAN A;Lo;0;L;;;;;N;;;;; +1023;MYANMAR LETTER I;Lo;0;L;;;;;N;;;;; +1024;MYANMAR LETTER II;Lo;0;L;;;;;N;;;;; +1025;MYANMAR LETTER U;Lo;0;L;;;;;N;;;;; +1026;MYANMAR LETTER UU;Lo;0;L;1025 102E;;;;N;;;;; +1027;MYANMAR LETTER E;Lo;0;L;;;;;N;;;;; +1028;MYANMAR LETTER MON E;Lo;0;L;;;;;N;;;;; +1029;MYANMAR LETTER O;Lo;0;L;;;;;N;;;;; +102A;MYANMAR LETTER AU;Lo;0;L;;;;;N;;;;; +102B;MYANMAR VOWEL SIGN TALL AA;Mc;0;L;;;;;N;;;;; +102C;MYANMAR VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +102D;MYANMAR VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +102E;MYANMAR VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +102F;MYANMAR VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1030;MYANMAR VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +1031;MYANMAR VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +1032;MYANMAR VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +1033;MYANMAR VOWEL SIGN MON II;Mn;0;NSM;;;;;N;;;;; +1034;MYANMAR VOWEL SIGN MON O;Mn;0;NSM;;;;;N;;;;; +1035;MYANMAR VOWEL SIGN E ABOVE;Mn;0;NSM;;;;;N;;;;; +1036;MYANMAR SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +1037;MYANMAR SIGN DOT BELOW;Mn;7;NSM;;;;;N;;;;; +1038;MYANMAR SIGN VISARGA;Mc;0;L;;;;;N;;;;; +1039;MYANMAR SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +103A;MYANMAR SIGN ASAT;Mn;9;NSM;;;;;N;;;;; +103B;MYANMAR CONSONANT SIGN MEDIAL YA;Mc;0;L;;;;;N;;;;; +103C;MYANMAR CONSONANT SIGN MEDIAL RA;Mc;0;L;;;;;N;;;;; +103D;MYANMAR CONSONANT SIGN MEDIAL WA;Mn;0;NSM;;;;;N;;;;; +103E;MYANMAR CONSONANT SIGN MEDIAL HA;Mn;0;NSM;;;;;N;;;;; +103F;MYANMAR LETTER GREAT SA;Lo;0;L;;;;;N;;;;; +1040;MYANMAR DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1041;MYANMAR DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1042;MYANMAR DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1043;MYANMAR DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1044;MYANMAR DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1045;MYANMAR DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1046;MYANMAR DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1047;MYANMAR DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1048;MYANMAR DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1049;MYANMAR DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +104A;MYANMAR SIGN LITTLE SECTION;Po;0;L;;;;;N;;;;; +104B;MYANMAR SIGN SECTION;Po;0;L;;;;;N;;;;; +104C;MYANMAR SYMBOL LOCATIVE;Po;0;L;;;;;N;;;;; +104D;MYANMAR SYMBOL COMPLETED;Po;0;L;;;;;N;;;;; +104E;MYANMAR SYMBOL AFOREMENTIONED;Po;0;L;;;;;N;;;;; +104F;MYANMAR SYMBOL GENITIVE;Po;0;L;;;;;N;;;;; +1050;MYANMAR LETTER SHA;Lo;0;L;;;;;N;;;;; +1051;MYANMAR LETTER SSA;Lo;0;L;;;;;N;;;;; +1052;MYANMAR LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +1053;MYANMAR LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +1054;MYANMAR LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +1055;MYANMAR LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1056;MYANMAR VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;; +1057;MYANMAR VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;; +1058;MYANMAR VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +1059;MYANMAR VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +105A;MYANMAR LETTER MON NGA;Lo;0;L;;;;;N;;;;; +105B;MYANMAR LETTER MON JHA;Lo;0;L;;;;;N;;;;; +105C;MYANMAR LETTER MON BBA;Lo;0;L;;;;;N;;;;; +105D;MYANMAR LETTER MON BBE;Lo;0;L;;;;;N;;;;; +105E;MYANMAR CONSONANT SIGN MON MEDIAL NA;Mn;0;NSM;;;;;N;;;;; +105F;MYANMAR CONSONANT SIGN MON MEDIAL MA;Mn;0;NSM;;;;;N;;;;; +1060;MYANMAR CONSONANT SIGN MON MEDIAL LA;Mn;0;NSM;;;;;N;;;;; +1061;MYANMAR LETTER SGAW KAREN SHA;Lo;0;L;;;;;N;;;;; +1062;MYANMAR VOWEL SIGN SGAW KAREN EU;Mc;0;L;;;;;N;;;;; +1063;MYANMAR TONE MARK SGAW KAREN HATHI;Mc;0;L;;;;;N;;;;; +1064;MYANMAR TONE MARK SGAW KAREN KE PHO;Mc;0;L;;;;;N;;;;; +1065;MYANMAR LETTER WESTERN PWO KAREN THA;Lo;0;L;;;;;N;;;;; +1066;MYANMAR LETTER WESTERN PWO KAREN PWA;Lo;0;L;;;;;N;;;;; +1067;MYANMAR VOWEL SIGN WESTERN PWO KAREN EU;Mc;0;L;;;;;N;;;;; +1068;MYANMAR VOWEL SIGN WESTERN PWO KAREN UE;Mc;0;L;;;;;N;;;;; +1069;MYANMAR SIGN WESTERN PWO KAREN TONE-1;Mc;0;L;;;;;N;;;;; +106A;MYANMAR SIGN WESTERN PWO KAREN TONE-2;Mc;0;L;;;;;N;;;;; +106B;MYANMAR SIGN WESTERN PWO KAREN TONE-3;Mc;0;L;;;;;N;;;;; +106C;MYANMAR SIGN WESTERN PWO KAREN TONE-4;Mc;0;L;;;;;N;;;;; +106D;MYANMAR SIGN WESTERN PWO KAREN TONE-5;Mc;0;L;;;;;N;;;;; +106E;MYANMAR LETTER EASTERN PWO KAREN NNA;Lo;0;L;;;;;N;;;;; +106F;MYANMAR LETTER EASTERN PWO KAREN YWA;Lo;0;L;;;;;N;;;;; +1070;MYANMAR LETTER EASTERN PWO KAREN GHWA;Lo;0;L;;;;;N;;;;; +1071;MYANMAR VOWEL SIGN GEBA KAREN I;Mn;0;NSM;;;;;N;;;;; +1072;MYANMAR VOWEL SIGN KAYAH OE;Mn;0;NSM;;;;;N;;;;; +1073;MYANMAR VOWEL SIGN KAYAH U;Mn;0;NSM;;;;;N;;;;; +1074;MYANMAR VOWEL SIGN KAYAH EE;Mn;0;NSM;;;;;N;;;;; +1075;MYANMAR LETTER SHAN KA;Lo;0;L;;;;;N;;;;; +1076;MYANMAR LETTER SHAN KHA;Lo;0;L;;;;;N;;;;; +1077;MYANMAR LETTER SHAN GA;Lo;0;L;;;;;N;;;;; +1078;MYANMAR LETTER SHAN CA;Lo;0;L;;;;;N;;;;; +1079;MYANMAR LETTER SHAN ZA;Lo;0;L;;;;;N;;;;; +107A;MYANMAR LETTER SHAN NYA;Lo;0;L;;;;;N;;;;; +107B;MYANMAR LETTER SHAN DA;Lo;0;L;;;;;N;;;;; +107C;MYANMAR LETTER SHAN NA;Lo;0;L;;;;;N;;;;; +107D;MYANMAR LETTER SHAN PHA;Lo;0;L;;;;;N;;;;; +107E;MYANMAR LETTER SHAN FA;Lo;0;L;;;;;N;;;;; +107F;MYANMAR LETTER SHAN BA;Lo;0;L;;;;;N;;;;; +1080;MYANMAR LETTER SHAN THA;Lo;0;L;;;;;N;;;;; +1081;MYANMAR LETTER SHAN HA;Lo;0;L;;;;;N;;;;; +1082;MYANMAR CONSONANT SIGN SHAN MEDIAL WA;Mn;0;NSM;;;;;N;;;;; +1083;MYANMAR VOWEL SIGN SHAN AA;Mc;0;L;;;;;N;;;;; +1084;MYANMAR VOWEL SIGN SHAN E;Mc;0;L;;;;;N;;;;; +1085;MYANMAR VOWEL SIGN SHAN E ABOVE;Mn;0;NSM;;;;;N;;;;; +1086;MYANMAR VOWEL SIGN SHAN FINAL Y;Mn;0;NSM;;;;;N;;;;; +1087;MYANMAR SIGN SHAN TONE-2;Mc;0;L;;;;;N;;;;; +1088;MYANMAR SIGN SHAN TONE-3;Mc;0;L;;;;;N;;;;; +1089;MYANMAR SIGN SHAN TONE-5;Mc;0;L;;;;;N;;;;; +108A;MYANMAR SIGN SHAN TONE-6;Mc;0;L;;;;;N;;;;; +108B;MYANMAR SIGN SHAN COUNCIL TONE-2;Mc;0;L;;;;;N;;;;; +108C;MYANMAR SIGN SHAN COUNCIL TONE-3;Mc;0;L;;;;;N;;;;; +108D;MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE;Mn;220;NSM;;;;;N;;;;; +108E;MYANMAR LETTER RUMAI PALAUNG FA;Lo;0;L;;;;;N;;;;; +108F;MYANMAR SIGN RUMAI PALAUNG TONE-5;Mc;0;L;;;;;N;;;;; +1090;MYANMAR SHAN DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1091;MYANMAR SHAN DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1092;MYANMAR SHAN DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1093;MYANMAR SHAN DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1094;MYANMAR SHAN DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1095;MYANMAR SHAN DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1096;MYANMAR SHAN DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1097;MYANMAR SHAN DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1098;MYANMAR SHAN DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1099;MYANMAR SHAN DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +109A;MYANMAR SIGN KHAMTI TONE-1;Mc;0;L;;;;;N;;;;; +109B;MYANMAR SIGN KHAMTI TONE-3;Mc;0;L;;;;;N;;;;; +109C;MYANMAR VOWEL SIGN AITON A;Mc;0;L;;;;;N;;;;; +109D;MYANMAR VOWEL SIGN AITON AI;Mn;0;NSM;;;;;N;;;;; +109E;MYANMAR SYMBOL SHAN ONE;So;0;L;;;;;N;;;;; +109F;MYANMAR SYMBOL SHAN EXCLAMATION;So;0;L;;;;;N;;;;; +10A0;GEORGIAN CAPITAL LETTER AN;Lu;0;L;;;;;N;;;;2D00; +10A1;GEORGIAN CAPITAL LETTER BAN;Lu;0;L;;;;;N;;;;2D01; +10A2;GEORGIAN CAPITAL LETTER GAN;Lu;0;L;;;;;N;;;;2D02; +10A3;GEORGIAN CAPITAL LETTER DON;Lu;0;L;;;;;N;;;;2D03; +10A4;GEORGIAN CAPITAL LETTER EN;Lu;0;L;;;;;N;;;;2D04; +10A5;GEORGIAN CAPITAL LETTER VIN;Lu;0;L;;;;;N;;;;2D05; +10A6;GEORGIAN CAPITAL LETTER ZEN;Lu;0;L;;;;;N;;;;2D06; +10A7;GEORGIAN CAPITAL LETTER TAN;Lu;0;L;;;;;N;;;;2D07; +10A8;GEORGIAN CAPITAL LETTER IN;Lu;0;L;;;;;N;;;;2D08; +10A9;GEORGIAN CAPITAL LETTER KAN;Lu;0;L;;;;;N;;;;2D09; +10AA;GEORGIAN CAPITAL LETTER LAS;Lu;0;L;;;;;N;;;;2D0A; +10AB;GEORGIAN CAPITAL LETTER MAN;Lu;0;L;;;;;N;;;;2D0B; +10AC;GEORGIAN CAPITAL LETTER NAR;Lu;0;L;;;;;N;;;;2D0C; +10AD;GEORGIAN CAPITAL LETTER ON;Lu;0;L;;;;;N;;;;2D0D; +10AE;GEORGIAN CAPITAL LETTER PAR;Lu;0;L;;;;;N;;;;2D0E; +10AF;GEORGIAN CAPITAL LETTER ZHAR;Lu;0;L;;;;;N;;;;2D0F; +10B0;GEORGIAN CAPITAL LETTER RAE;Lu;0;L;;;;;N;;;;2D10; +10B1;GEORGIAN CAPITAL LETTER SAN;Lu;0;L;;;;;N;;;;2D11; +10B2;GEORGIAN CAPITAL LETTER TAR;Lu;0;L;;;;;N;;;;2D12; +10B3;GEORGIAN CAPITAL LETTER UN;Lu;0;L;;;;;N;;;;2D13; +10B4;GEORGIAN CAPITAL LETTER PHAR;Lu;0;L;;;;;N;;;;2D14; +10B5;GEORGIAN CAPITAL LETTER KHAR;Lu;0;L;;;;;N;;;;2D15; +10B6;GEORGIAN CAPITAL LETTER GHAN;Lu;0;L;;;;;N;;;;2D16; +10B7;GEORGIAN CAPITAL LETTER QAR;Lu;0;L;;;;;N;;;;2D17; +10B8;GEORGIAN CAPITAL LETTER SHIN;Lu;0;L;;;;;N;;;;2D18; +10B9;GEORGIAN CAPITAL LETTER CHIN;Lu;0;L;;;;;N;;;;2D19; +10BA;GEORGIAN CAPITAL LETTER CAN;Lu;0;L;;;;;N;;;;2D1A; +10BB;GEORGIAN CAPITAL LETTER JIL;Lu;0;L;;;;;N;;;;2D1B; +10BC;GEORGIAN CAPITAL LETTER CIL;Lu;0;L;;;;;N;;;;2D1C; +10BD;GEORGIAN CAPITAL LETTER CHAR;Lu;0;L;;;;;N;;;;2D1D; +10BE;GEORGIAN CAPITAL LETTER XAN;Lu;0;L;;;;;N;;;;2D1E; +10BF;GEORGIAN CAPITAL LETTER JHAN;Lu;0;L;;;;;N;;;;2D1F; +10C0;GEORGIAN CAPITAL LETTER HAE;Lu;0;L;;;;;N;;;;2D20; +10C1;GEORGIAN CAPITAL LETTER HE;Lu;0;L;;;;;N;;;;2D21; +10C2;GEORGIAN CAPITAL LETTER HIE;Lu;0;L;;;;;N;;;;2D22; +10C3;GEORGIAN CAPITAL LETTER WE;Lu;0;L;;;;;N;;;;2D23; +10C4;GEORGIAN CAPITAL LETTER HAR;Lu;0;L;;;;;N;;;;2D24; +10C5;GEORGIAN CAPITAL LETTER HOE;Lu;0;L;;;;;N;;;;2D25; +10C7;GEORGIAN CAPITAL LETTER YN;Lu;0;L;;;;;N;;;;2D27; +10CD;GEORGIAN CAPITAL LETTER AEN;Lu;0;L;;;;;N;;;;2D2D; +10D0;GEORGIAN LETTER AN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER AN;;;; +10D1;GEORGIAN LETTER BAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER BAN;;;; +10D2;GEORGIAN LETTER GAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER GAN;;;; +10D3;GEORGIAN LETTER DON;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER DON;;;; +10D4;GEORGIAN LETTER EN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER EN;;;; +10D5;GEORGIAN LETTER VIN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER VIN;;;; +10D6;GEORGIAN LETTER ZEN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER ZEN;;;; +10D7;GEORGIAN LETTER TAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER TAN;;;; +10D8;GEORGIAN LETTER IN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER IN;;;; +10D9;GEORGIAN LETTER KAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER KAN;;;; +10DA;GEORGIAN LETTER LAS;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER LAS;;;; +10DB;GEORGIAN LETTER MAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER MAN;;;; +10DC;GEORGIAN LETTER NAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER NAR;;;; +10DD;GEORGIAN LETTER ON;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER ON;;;; +10DE;GEORGIAN LETTER PAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER PAR;;;; +10DF;GEORGIAN LETTER ZHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER ZHAR;;;; +10E0;GEORGIAN LETTER RAE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER RAE;;;; +10E1;GEORGIAN LETTER SAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER SAN;;;; +10E2;GEORGIAN LETTER TAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER TAR;;;; +10E3;GEORGIAN LETTER UN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER UN;;;; +10E4;GEORGIAN LETTER PHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER PHAR;;;; +10E5;GEORGIAN LETTER KHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER KHAR;;;; +10E6;GEORGIAN LETTER GHAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER GHAN;;;; +10E7;GEORGIAN LETTER QAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER QAR;;;; +10E8;GEORGIAN LETTER SHIN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER SHIN;;;; +10E9;GEORGIAN LETTER CHIN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CHIN;;;; +10EA;GEORGIAN LETTER CAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CAN;;;; +10EB;GEORGIAN LETTER JIL;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER JIL;;;; +10EC;GEORGIAN LETTER CIL;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CIL;;;; +10ED;GEORGIAN LETTER CHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CHAR;;;; +10EE;GEORGIAN LETTER XAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER XAN;;;; +10EF;GEORGIAN LETTER JHAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER JHAN;;;; +10F0;GEORGIAN LETTER HAE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HAE;;;; +10F1;GEORGIAN LETTER HE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HE;;;; +10F2;GEORGIAN LETTER HIE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HIE;;;; +10F3;GEORGIAN LETTER WE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER WE;;;; +10F4;GEORGIAN LETTER HAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HAR;;;; +10F5;GEORGIAN LETTER HOE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HOE;;;; +10F6;GEORGIAN LETTER FI;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER FI;;;; +10F7;GEORGIAN LETTER YN;Lo;0;L;;;;;N;;;;; +10F8;GEORGIAN LETTER ELIFI;Lo;0;L;;;;;N;;;;; +10F9;GEORGIAN LETTER TURNED GAN;Lo;0;L;;;;;N;;;;; +10FA;GEORGIAN LETTER AIN;Lo;0;L;;;;;N;;;;; +10FB;GEORGIAN PARAGRAPH SEPARATOR;Po;0;L;;;;;N;;;;; +10FC;MODIFIER LETTER GEORGIAN NAR;Lm;0;L;<super> 10DC;;;;N;;;;; +10FD;GEORGIAN LETTER AEN;Lo;0;L;;;;;N;;;;; +10FE;GEORGIAN LETTER HARD SIGN;Lo;0;L;;;;;N;;;;; +10FF;GEORGIAN LETTER LABIAL SIGN;Lo;0;L;;;;;N;;;;; +1100;HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;;;; +1101;HANGUL CHOSEONG SSANGKIYEOK;Lo;0;L;;;;;N;;;;; +1102;HANGUL CHOSEONG NIEUN;Lo;0;L;;;;;N;;;;; +1103;HANGUL CHOSEONG TIKEUT;Lo;0;L;;;;;N;;;;; +1104;HANGUL CHOSEONG SSANGTIKEUT;Lo;0;L;;;;;N;;;;; +1105;HANGUL CHOSEONG RIEUL;Lo;0;L;;;;;N;;;;; +1106;HANGUL CHOSEONG MIEUM;Lo;0;L;;;;;N;;;;; +1107;HANGUL CHOSEONG PIEUP;Lo;0;L;;;;;N;;;;; +1108;HANGUL CHOSEONG SSANGPIEUP;Lo;0;L;;;;;N;;;;; +1109;HANGUL CHOSEONG SIOS;Lo;0;L;;;;;N;;;;; +110A;HANGUL CHOSEONG SSANGSIOS;Lo;0;L;;;;;N;;;;; +110B;HANGUL CHOSEONG IEUNG;Lo;0;L;;;;;N;;;;; +110C;HANGUL CHOSEONG CIEUC;Lo;0;L;;;;;N;;;;; +110D;HANGUL CHOSEONG SSANGCIEUC;Lo;0;L;;;;;N;;;;; +110E;HANGUL CHOSEONG CHIEUCH;Lo;0;L;;;;;N;;;;; +110F;HANGUL CHOSEONG KHIEUKH;Lo;0;L;;;;;N;;;;; +1110;HANGUL CHOSEONG THIEUTH;Lo;0;L;;;;;N;;;;; +1111;HANGUL CHOSEONG PHIEUPH;Lo;0;L;;;;;N;;;;; +1112;HANGUL CHOSEONG HIEUH;Lo;0;L;;;;;N;;;;; +1113;HANGUL CHOSEONG NIEUN-KIYEOK;Lo;0;L;;;;;N;;;;; +1114;HANGUL CHOSEONG SSANGNIEUN;Lo;0;L;;;;;N;;;;; +1115;HANGUL CHOSEONG NIEUN-TIKEUT;Lo;0;L;;;;;N;;;;; +1116;HANGUL CHOSEONG NIEUN-PIEUP;Lo;0;L;;;;;N;;;;; +1117;HANGUL CHOSEONG TIKEUT-KIYEOK;Lo;0;L;;;;;N;;;;; +1118;HANGUL CHOSEONG RIEUL-NIEUN;Lo;0;L;;;;;N;;;;; +1119;HANGUL CHOSEONG SSANGRIEUL;Lo;0;L;;;;;N;;;;; +111A;HANGUL CHOSEONG RIEUL-HIEUH;Lo;0;L;;;;;N;;;;; +111B;HANGUL CHOSEONG KAPYEOUNRIEUL;Lo;0;L;;;;;N;;;;; +111C;HANGUL CHOSEONG MIEUM-PIEUP;Lo;0;L;;;;;N;;;;; +111D;HANGUL CHOSEONG KAPYEOUNMIEUM;Lo;0;L;;;;;N;;;;; +111E;HANGUL CHOSEONG PIEUP-KIYEOK;Lo;0;L;;;;;N;;;;; +111F;HANGUL CHOSEONG PIEUP-NIEUN;Lo;0;L;;;;;N;;;;; +1120;HANGUL CHOSEONG PIEUP-TIKEUT;Lo;0;L;;;;;N;;;;; +1121;HANGUL CHOSEONG PIEUP-SIOS;Lo;0;L;;;;;N;;;;; +1122;HANGUL CHOSEONG PIEUP-SIOS-KIYEOK;Lo;0;L;;;;;N;;;;; +1123;HANGUL CHOSEONG PIEUP-SIOS-TIKEUT;Lo;0;L;;;;;N;;;;; +1124;HANGUL CHOSEONG PIEUP-SIOS-PIEUP;Lo;0;L;;;;;N;;;;; +1125;HANGUL CHOSEONG PIEUP-SSANGSIOS;Lo;0;L;;;;;N;;;;; +1126;HANGUL CHOSEONG PIEUP-SIOS-CIEUC;Lo;0;L;;;;;N;;;;; +1127;HANGUL CHOSEONG PIEUP-CIEUC;Lo;0;L;;;;;N;;;;; +1128;HANGUL CHOSEONG PIEUP-CHIEUCH;Lo;0;L;;;;;N;;;;; +1129;HANGUL CHOSEONG PIEUP-THIEUTH;Lo;0;L;;;;;N;;;;; +112A;HANGUL CHOSEONG PIEUP-PHIEUPH;Lo;0;L;;;;;N;;;;; +112B;HANGUL CHOSEONG KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;; +112C;HANGUL CHOSEONG KAPYEOUNSSANGPIEUP;Lo;0;L;;;;;N;;;;; +112D;HANGUL CHOSEONG SIOS-KIYEOK;Lo;0;L;;;;;N;;;;; +112E;HANGUL CHOSEONG SIOS-NIEUN;Lo;0;L;;;;;N;;;;; +112F;HANGUL CHOSEONG SIOS-TIKEUT;Lo;0;L;;;;;N;;;;; +1130;HANGUL CHOSEONG SIOS-RIEUL;Lo;0;L;;;;;N;;;;; +1131;HANGUL CHOSEONG SIOS-MIEUM;Lo;0;L;;;;;N;;;;; +1132;HANGUL CHOSEONG SIOS-PIEUP;Lo;0;L;;;;;N;;;;; +1133;HANGUL CHOSEONG SIOS-PIEUP-KIYEOK;Lo;0;L;;;;;N;;;;; +1134;HANGUL CHOSEONG SIOS-SSANGSIOS;Lo;0;L;;;;;N;;;;; +1135;HANGUL CHOSEONG SIOS-IEUNG;Lo;0;L;;;;;N;;;;; +1136;HANGUL CHOSEONG SIOS-CIEUC;Lo;0;L;;;;;N;;;;; +1137;HANGUL CHOSEONG SIOS-CHIEUCH;Lo;0;L;;;;;N;;;;; +1138;HANGUL CHOSEONG SIOS-KHIEUKH;Lo;0;L;;;;;N;;;;; +1139;HANGUL CHOSEONG SIOS-THIEUTH;Lo;0;L;;;;;N;;;;; +113A;HANGUL CHOSEONG SIOS-PHIEUPH;Lo;0;L;;;;;N;;;;; +113B;HANGUL CHOSEONG SIOS-HIEUH;Lo;0;L;;;;;N;;;;; +113C;HANGUL CHOSEONG CHITUEUMSIOS;Lo;0;L;;;;;N;;;;; +113D;HANGUL CHOSEONG CHITUEUMSSANGSIOS;Lo;0;L;;;;;N;;;;; +113E;HANGUL CHOSEONG CEONGCHIEUMSIOS;Lo;0;L;;;;;N;;;;; +113F;HANGUL CHOSEONG CEONGCHIEUMSSANGSIOS;Lo;0;L;;;;;N;;;;; +1140;HANGUL CHOSEONG PANSIOS;Lo;0;L;;;;;N;;;;; +1141;HANGUL CHOSEONG IEUNG-KIYEOK;Lo;0;L;;;;;N;;;;; +1142;HANGUL CHOSEONG IEUNG-TIKEUT;Lo;0;L;;;;;N;;;;; +1143;HANGUL CHOSEONG IEUNG-MIEUM;Lo;0;L;;;;;N;;;;; +1144;HANGUL CHOSEONG IEUNG-PIEUP;Lo;0;L;;;;;N;;;;; +1145;HANGUL CHOSEONG IEUNG-SIOS;Lo;0;L;;;;;N;;;;; +1146;HANGUL CHOSEONG IEUNG-PANSIOS;Lo;0;L;;;;;N;;;;; +1147;HANGUL CHOSEONG SSANGIEUNG;Lo;0;L;;;;;N;;;;; +1148;HANGUL CHOSEONG IEUNG-CIEUC;Lo;0;L;;;;;N;;;;; +1149;HANGUL CHOSEONG IEUNG-CHIEUCH;Lo;0;L;;;;;N;;;;; +114A;HANGUL CHOSEONG IEUNG-THIEUTH;Lo;0;L;;;;;N;;;;; +114B;HANGUL CHOSEONG IEUNG-PHIEUPH;Lo;0;L;;;;;N;;;;; +114C;HANGUL CHOSEONG YESIEUNG;Lo;0;L;;;;;N;;;;; +114D;HANGUL CHOSEONG CIEUC-IEUNG;Lo;0;L;;;;;N;;;;; +114E;HANGUL CHOSEONG CHITUEUMCIEUC;Lo;0;L;;;;;N;;;;; +114F;HANGUL CHOSEONG CHITUEUMSSANGCIEUC;Lo;0;L;;;;;N;;;;; +1150;HANGUL CHOSEONG CEONGCHIEUMCIEUC;Lo;0;L;;;;;N;;;;; +1151;HANGUL CHOSEONG CEONGCHIEUMSSANGCIEUC;Lo;0;L;;;;;N;;;;; +1152;HANGUL CHOSEONG CHIEUCH-KHIEUKH;Lo;0;L;;;;;N;;;;; +1153;HANGUL CHOSEONG CHIEUCH-HIEUH;Lo;0;L;;;;;N;;;;; +1154;HANGUL CHOSEONG CHITUEUMCHIEUCH;Lo;0;L;;;;;N;;;;; +1155;HANGUL CHOSEONG CEONGCHIEUMCHIEUCH;Lo;0;L;;;;;N;;;;; +1156;HANGUL CHOSEONG PHIEUPH-PIEUP;Lo;0;L;;;;;N;;;;; +1157;HANGUL CHOSEONG KAPYEOUNPHIEUPH;Lo;0;L;;;;;N;;;;; +1158;HANGUL CHOSEONG SSANGHIEUH;Lo;0;L;;;;;N;;;;; +1159;HANGUL CHOSEONG YEORINHIEUH;Lo;0;L;;;;;N;;;;; +115A;HANGUL CHOSEONG KIYEOK-TIKEUT;Lo;0;L;;;;;N;;;;; +115B;HANGUL CHOSEONG NIEUN-SIOS;Lo;0;L;;;;;N;;;;; +115C;HANGUL CHOSEONG NIEUN-CIEUC;Lo;0;L;;;;;N;;;;; +115D;HANGUL CHOSEONG NIEUN-HIEUH;Lo;0;L;;;;;N;;;;; +115E;HANGUL CHOSEONG TIKEUT-RIEUL;Lo;0;L;;;;;N;;;;; +115F;HANGUL CHOSEONG FILLER;Lo;0;L;;;;;N;;;;; +1160;HANGUL JUNGSEONG FILLER;Lo;0;L;;;;;N;;;;; +1161;HANGUL JUNGSEONG A;Lo;0;L;;;;;N;;;;; +1162;HANGUL JUNGSEONG AE;Lo;0;L;;;;;N;;;;; +1163;HANGUL JUNGSEONG YA;Lo;0;L;;;;;N;;;;; +1164;HANGUL JUNGSEONG YAE;Lo;0;L;;;;;N;;;;; +1165;HANGUL JUNGSEONG EO;Lo;0;L;;;;;N;;;;; +1166;HANGUL JUNGSEONG E;Lo;0;L;;;;;N;;;;; +1167;HANGUL JUNGSEONG YEO;Lo;0;L;;;;;N;;;;; +1168;HANGUL JUNGSEONG YE;Lo;0;L;;;;;N;;;;; +1169;HANGUL JUNGSEONG O;Lo;0;L;;;;;N;;;;; +116A;HANGUL JUNGSEONG WA;Lo;0;L;;;;;N;;;;; +116B;HANGUL JUNGSEONG WAE;Lo;0;L;;;;;N;;;;; +116C;HANGUL JUNGSEONG OE;Lo;0;L;;;;;N;;;;; +116D;HANGUL JUNGSEONG YO;Lo;0;L;;;;;N;;;;; +116E;HANGUL JUNGSEONG U;Lo;0;L;;;;;N;;;;; +116F;HANGUL JUNGSEONG WEO;Lo;0;L;;;;;N;;;;; +1170;HANGUL JUNGSEONG WE;Lo;0;L;;;;;N;;;;; +1171;HANGUL JUNGSEONG WI;Lo;0;L;;;;;N;;;;; +1172;HANGUL JUNGSEONG YU;Lo;0;L;;;;;N;;;;; +1173;HANGUL JUNGSEONG EU;Lo;0;L;;;;;N;;;;; +1174;HANGUL JUNGSEONG YI;Lo;0;L;;;;;N;;;;; +1175;HANGUL JUNGSEONG I;Lo;0;L;;;;;N;;;;; +1176;HANGUL JUNGSEONG A-O;Lo;0;L;;;;;N;;;;; +1177;HANGUL JUNGSEONG A-U;Lo;0;L;;;;;N;;;;; +1178;HANGUL JUNGSEONG YA-O;Lo;0;L;;;;;N;;;;; +1179;HANGUL JUNGSEONG YA-YO;Lo;0;L;;;;;N;;;;; +117A;HANGUL JUNGSEONG EO-O;Lo;0;L;;;;;N;;;;; +117B;HANGUL JUNGSEONG EO-U;Lo;0;L;;;;;N;;;;; +117C;HANGUL JUNGSEONG EO-EU;Lo;0;L;;;;;N;;;;; +117D;HANGUL JUNGSEONG YEO-O;Lo;0;L;;;;;N;;;;; +117E;HANGUL JUNGSEONG YEO-U;Lo;0;L;;;;;N;;;;; +117F;HANGUL JUNGSEONG O-EO;Lo;0;L;;;;;N;;;;; +1180;HANGUL JUNGSEONG O-E;Lo;0;L;;;;;N;;;;; +1181;HANGUL JUNGSEONG O-YE;Lo;0;L;;;;;N;;;;; +1182;HANGUL JUNGSEONG O-O;Lo;0;L;;;;;N;;;;; +1183;HANGUL JUNGSEONG O-U;Lo;0;L;;;;;N;;;;; +1184;HANGUL JUNGSEONG YO-YA;Lo;0;L;;;;;N;;;;; +1185;HANGUL JUNGSEONG YO-YAE;Lo;0;L;;;;;N;;;;; +1186;HANGUL JUNGSEONG YO-YEO;Lo;0;L;;;;;N;;;;; +1187;HANGUL JUNGSEONG YO-O;Lo;0;L;;;;;N;;;;; +1188;HANGUL JUNGSEONG YO-I;Lo;0;L;;;;;N;;;;; +1189;HANGUL JUNGSEONG U-A;Lo;0;L;;;;;N;;;;; +118A;HANGUL JUNGSEONG U-AE;Lo;0;L;;;;;N;;;;; +118B;HANGUL JUNGSEONG U-EO-EU;Lo;0;L;;;;;N;;;;; +118C;HANGUL JUNGSEONG U-YE;Lo;0;L;;;;;N;;;;; +118D;HANGUL JUNGSEONG U-U;Lo;0;L;;;;;N;;;;; +118E;HANGUL JUNGSEONG YU-A;Lo;0;L;;;;;N;;;;; +118F;HANGUL JUNGSEONG YU-EO;Lo;0;L;;;;;N;;;;; +1190;HANGUL JUNGSEONG YU-E;Lo;0;L;;;;;N;;;;; +1191;HANGUL JUNGSEONG YU-YEO;Lo;0;L;;;;;N;;;;; +1192;HANGUL JUNGSEONG YU-YE;Lo;0;L;;;;;N;;;;; +1193;HANGUL JUNGSEONG YU-U;Lo;0;L;;;;;N;;;;; +1194;HANGUL JUNGSEONG YU-I;Lo;0;L;;;;;N;;;;; +1195;HANGUL JUNGSEONG EU-U;Lo;0;L;;;;;N;;;;; +1196;HANGUL JUNGSEONG EU-EU;Lo;0;L;;;;;N;;;;; +1197;HANGUL JUNGSEONG YI-U;Lo;0;L;;;;;N;;;;; +1198;HANGUL JUNGSEONG I-A;Lo;0;L;;;;;N;;;;; +1199;HANGUL JUNGSEONG I-YA;Lo;0;L;;;;;N;;;;; +119A;HANGUL JUNGSEONG I-O;Lo;0;L;;;;;N;;;;; +119B;HANGUL JUNGSEONG I-U;Lo;0;L;;;;;N;;;;; +119C;HANGUL JUNGSEONG I-EU;Lo;0;L;;;;;N;;;;; +119D;HANGUL JUNGSEONG I-ARAEA;Lo;0;L;;;;;N;;;;; +119E;HANGUL JUNGSEONG ARAEA;Lo;0;L;;;;;N;;;;; +119F;HANGUL JUNGSEONG ARAEA-EO;Lo;0;L;;;;;N;;;;; +11A0;HANGUL JUNGSEONG ARAEA-U;Lo;0;L;;;;;N;;;;; +11A1;HANGUL JUNGSEONG ARAEA-I;Lo;0;L;;;;;N;;;;; +11A2;HANGUL JUNGSEONG SSANGARAEA;Lo;0;L;;;;;N;;;;; +11A3;HANGUL JUNGSEONG A-EU;Lo;0;L;;;;;N;;;;; +11A4;HANGUL JUNGSEONG YA-U;Lo;0;L;;;;;N;;;;; +11A5;HANGUL JUNGSEONG YEO-YA;Lo;0;L;;;;;N;;;;; +11A6;HANGUL JUNGSEONG O-YA;Lo;0;L;;;;;N;;;;; +11A7;HANGUL JUNGSEONG O-YAE;Lo;0;L;;;;;N;;;;; +11A8;HANGUL JONGSEONG KIYEOK;Lo;0;L;;;;;N;;;;; +11A9;HANGUL JONGSEONG SSANGKIYEOK;Lo;0;L;;;;;N;;;;; +11AA;HANGUL JONGSEONG KIYEOK-SIOS;Lo;0;L;;;;;N;;;;; +11AB;HANGUL JONGSEONG NIEUN;Lo;0;L;;;;;N;;;;; +11AC;HANGUL JONGSEONG NIEUN-CIEUC;Lo;0;L;;;;;N;;;;; +11AD;HANGUL JONGSEONG NIEUN-HIEUH;Lo;0;L;;;;;N;;;;; +11AE;HANGUL JONGSEONG TIKEUT;Lo;0;L;;;;;N;;;;; +11AF;HANGUL JONGSEONG RIEUL;Lo;0;L;;;;;N;;;;; +11B0;HANGUL JONGSEONG RIEUL-KIYEOK;Lo;0;L;;;;;N;;;;; +11B1;HANGUL JONGSEONG RIEUL-MIEUM;Lo;0;L;;;;;N;;;;; +11B2;HANGUL JONGSEONG RIEUL-PIEUP;Lo;0;L;;;;;N;;;;; +11B3;HANGUL JONGSEONG RIEUL-SIOS;Lo;0;L;;;;;N;;;;; +11B4;HANGUL JONGSEONG RIEUL-THIEUTH;Lo;0;L;;;;;N;;;;; +11B5;HANGUL JONGSEONG RIEUL-PHIEUPH;Lo;0;L;;;;;N;;;;; +11B6;HANGUL JONGSEONG RIEUL-HIEUH;Lo;0;L;;;;;N;;;;; +11B7;HANGUL JONGSEONG MIEUM;Lo;0;L;;;;;N;;;;; +11B8;HANGUL JONGSEONG PIEUP;Lo;0;L;;;;;N;;;;; +11B9;HANGUL JONGSEONG PIEUP-SIOS;Lo;0;L;;;;;N;;;;; +11BA;HANGUL JONGSEONG SIOS;Lo;0;L;;;;;N;;;;; +11BB;HANGUL JONGSEONG SSANGSIOS;Lo;0;L;;;;;N;;;;; +11BC;HANGUL JONGSEONG IEUNG;Lo;0;L;;;;;N;;;;; +11BD;HANGUL JONGSEONG CIEUC;Lo;0;L;;;;;N;;;;; +11BE;HANGUL JONGSEONG CHIEUCH;Lo;0;L;;;;;N;;;;; +11BF;HANGUL JONGSEONG KHIEUKH;Lo;0;L;;;;;N;;;;; +11C0;HANGUL JONGSEONG THIEUTH;Lo;0;L;;;;;N;;;;; +11C1;HANGUL JONGSEONG PHIEUPH;Lo;0;L;;;;;N;;;;; +11C2;HANGUL JONGSEONG HIEUH;Lo;0;L;;;;;N;;;;; +11C3;HANGUL JONGSEONG KIYEOK-RIEUL;Lo;0;L;;;;;N;;;;; +11C4;HANGUL JONGSEONG KIYEOK-SIOS-KIYEOK;Lo;0;L;;;;;N;;;;; +11C5;HANGUL JONGSEONG NIEUN-KIYEOK;Lo;0;L;;;;;N;;;;; +11C6;HANGUL JONGSEONG NIEUN-TIKEUT;Lo;0;L;;;;;N;;;;; +11C7;HANGUL JONGSEONG NIEUN-SIOS;Lo;0;L;;;;;N;;;;; +11C8;HANGUL JONGSEONG NIEUN-PANSIOS;Lo;0;L;;;;;N;;;;; +11C9;HANGUL JONGSEONG NIEUN-THIEUTH;Lo;0;L;;;;;N;;;;; +11CA;HANGUL JONGSEONG TIKEUT-KIYEOK;Lo;0;L;;;;;N;;;;; +11CB;HANGUL JONGSEONG TIKEUT-RIEUL;Lo;0;L;;;;;N;;;;; +11CC;HANGUL JONGSEONG RIEUL-KIYEOK-SIOS;Lo;0;L;;;;;N;;;;; +11CD;HANGUL JONGSEONG RIEUL-NIEUN;Lo;0;L;;;;;N;;;;; +11CE;HANGUL JONGSEONG RIEUL-TIKEUT;Lo;0;L;;;;;N;;;;; +11CF;HANGUL JONGSEONG RIEUL-TIKEUT-HIEUH;Lo;0;L;;;;;N;;;;; +11D0;HANGUL JONGSEONG SSANGRIEUL;Lo;0;L;;;;;N;;;;; +11D1;HANGUL JONGSEONG RIEUL-MIEUM-KIYEOK;Lo;0;L;;;;;N;;;;; +11D2;HANGUL JONGSEONG RIEUL-MIEUM-SIOS;Lo;0;L;;;;;N;;;;; +11D3;HANGUL JONGSEONG RIEUL-PIEUP-SIOS;Lo;0;L;;;;;N;;;;; +11D4;HANGUL JONGSEONG RIEUL-PIEUP-HIEUH;Lo;0;L;;;;;N;;;;; +11D5;HANGUL JONGSEONG RIEUL-KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;; +11D6;HANGUL JONGSEONG RIEUL-SSANGSIOS;Lo;0;L;;;;;N;;;;; +11D7;HANGUL JONGSEONG RIEUL-PANSIOS;Lo;0;L;;;;;N;;;;; +11D8;HANGUL JONGSEONG RIEUL-KHIEUKH;Lo;0;L;;;;;N;;;;; +11D9;HANGUL JONGSEONG RIEUL-YEORINHIEUH;Lo;0;L;;;;;N;;;;; +11DA;HANGUL JONGSEONG MIEUM-KIYEOK;Lo;0;L;;;;;N;;;;; +11DB;HANGUL JONGSEONG MIEUM-RIEUL;Lo;0;L;;;;;N;;;;; +11DC;HANGUL JONGSEONG MIEUM-PIEUP;Lo;0;L;;;;;N;;;;; +11DD;HANGUL JONGSEONG MIEUM-SIOS;Lo;0;L;;;;;N;;;;; +11DE;HANGUL JONGSEONG MIEUM-SSANGSIOS;Lo;0;L;;;;;N;;;;; +11DF;HANGUL JONGSEONG MIEUM-PANSIOS;Lo;0;L;;;;;N;;;;; +11E0;HANGUL JONGSEONG MIEUM-CHIEUCH;Lo;0;L;;;;;N;;;;; +11E1;HANGUL JONGSEONG MIEUM-HIEUH;Lo;0;L;;;;;N;;;;; +11E2;HANGUL JONGSEONG KAPYEOUNMIEUM;Lo;0;L;;;;;N;;;;; +11E3;HANGUL JONGSEONG PIEUP-RIEUL;Lo;0;L;;;;;N;;;;; +11E4;HANGUL JONGSEONG PIEUP-PHIEUPH;Lo;0;L;;;;;N;;;;; +11E5;HANGUL JONGSEONG PIEUP-HIEUH;Lo;0;L;;;;;N;;;;; +11E6;HANGUL JONGSEONG KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;; +11E7;HANGUL JONGSEONG SIOS-KIYEOK;Lo;0;L;;;;;N;;;;; +11E8;HANGUL JONGSEONG SIOS-TIKEUT;Lo;0;L;;;;;N;;;;; +11E9;HANGUL JONGSEONG SIOS-RIEUL;Lo;0;L;;;;;N;;;;; +11EA;HANGUL JONGSEONG SIOS-PIEUP;Lo;0;L;;;;;N;;;;; +11EB;HANGUL JONGSEONG PANSIOS;Lo;0;L;;;;;N;;;;; +11EC;HANGUL JONGSEONG IEUNG-KIYEOK;Lo;0;L;;;;;N;;;;; +11ED;HANGUL JONGSEONG IEUNG-SSANGKIYEOK;Lo;0;L;;;;;N;;;;; +11EE;HANGUL JONGSEONG SSANGIEUNG;Lo;0;L;;;;;N;;;;; +11EF;HANGUL JONGSEONG IEUNG-KHIEUKH;Lo;0;L;;;;;N;;;;; +11F0;HANGUL JONGSEONG YESIEUNG;Lo;0;L;;;;;N;;;;; +11F1;HANGUL JONGSEONG YESIEUNG-SIOS;Lo;0;L;;;;;N;;;;; +11F2;HANGUL JONGSEONG YESIEUNG-PANSIOS;Lo;0;L;;;;;N;;;;; +11F3;HANGUL JONGSEONG PHIEUPH-PIEUP;Lo;0;L;;;;;N;;;;; +11F4;HANGUL JONGSEONG KAPYEOUNPHIEUPH;Lo;0;L;;;;;N;;;;; +11F5;HANGUL JONGSEONG HIEUH-NIEUN;Lo;0;L;;;;;N;;;;; +11F6;HANGUL JONGSEONG HIEUH-RIEUL;Lo;0;L;;;;;N;;;;; +11F7;HANGUL JONGSEONG HIEUH-MIEUM;Lo;0;L;;;;;N;;;;; +11F8;HANGUL JONGSEONG HIEUH-PIEUP;Lo;0;L;;;;;N;;;;; +11F9;HANGUL JONGSEONG YEORINHIEUH;Lo;0;L;;;;;N;;;;; +11FA;HANGUL JONGSEONG KIYEOK-NIEUN;Lo;0;L;;;;;N;;;;; +11FB;HANGUL JONGSEONG KIYEOK-PIEUP;Lo;0;L;;;;;N;;;;; +11FC;HANGUL JONGSEONG KIYEOK-CHIEUCH;Lo;0;L;;;;;N;;;;; +11FD;HANGUL JONGSEONG KIYEOK-KHIEUKH;Lo;0;L;;;;;N;;;;; +11FE;HANGUL JONGSEONG KIYEOK-HIEUH;Lo;0;L;;;;;N;;;;; +11FF;HANGUL JONGSEONG SSANGNIEUN;Lo;0;L;;;;;N;;;;; +1200;ETHIOPIC SYLLABLE HA;Lo;0;L;;;;;N;;;;; +1201;ETHIOPIC SYLLABLE HU;Lo;0;L;;;;;N;;;;; +1202;ETHIOPIC SYLLABLE HI;Lo;0;L;;;;;N;;;;; +1203;ETHIOPIC SYLLABLE HAA;Lo;0;L;;;;;N;;;;; +1204;ETHIOPIC SYLLABLE HEE;Lo;0;L;;;;;N;;;;; +1205;ETHIOPIC SYLLABLE HE;Lo;0;L;;;;;N;;;;; +1206;ETHIOPIC SYLLABLE HO;Lo;0;L;;;;;N;;;;; +1207;ETHIOPIC SYLLABLE HOA;Lo;0;L;;;;;N;;;;; +1208;ETHIOPIC SYLLABLE LA;Lo;0;L;;;;;N;;;;; +1209;ETHIOPIC SYLLABLE LU;Lo;0;L;;;;;N;;;;; +120A;ETHIOPIC SYLLABLE LI;Lo;0;L;;;;;N;;;;; +120B;ETHIOPIC SYLLABLE LAA;Lo;0;L;;;;;N;;;;; +120C;ETHIOPIC SYLLABLE LEE;Lo;0;L;;;;;N;;;;; +120D;ETHIOPIC SYLLABLE LE;Lo;0;L;;;;;N;;;;; +120E;ETHIOPIC SYLLABLE LO;Lo;0;L;;;;;N;;;;; +120F;ETHIOPIC SYLLABLE LWA;Lo;0;L;;;;;N;;;;; +1210;ETHIOPIC SYLLABLE HHA;Lo;0;L;;;;;N;;;;; +1211;ETHIOPIC SYLLABLE HHU;Lo;0;L;;;;;N;;;;; +1212;ETHIOPIC SYLLABLE HHI;Lo;0;L;;;;;N;;;;; +1213;ETHIOPIC SYLLABLE HHAA;Lo;0;L;;;;;N;;;;; +1214;ETHIOPIC SYLLABLE HHEE;Lo;0;L;;;;;N;;;;; +1215;ETHIOPIC SYLLABLE HHE;Lo;0;L;;;;;N;;;;; +1216;ETHIOPIC SYLLABLE HHO;Lo;0;L;;;;;N;;;;; +1217;ETHIOPIC SYLLABLE HHWA;Lo;0;L;;;;;N;;;;; +1218;ETHIOPIC SYLLABLE MA;Lo;0;L;;;;;N;;;;; +1219;ETHIOPIC SYLLABLE MU;Lo;0;L;;;;;N;;;;; +121A;ETHIOPIC SYLLABLE MI;Lo;0;L;;;;;N;;;;; +121B;ETHIOPIC SYLLABLE MAA;Lo;0;L;;;;;N;;;;; +121C;ETHIOPIC SYLLABLE MEE;Lo;0;L;;;;;N;;;;; +121D;ETHIOPIC SYLLABLE ME;Lo;0;L;;;;;N;;;;; +121E;ETHIOPIC SYLLABLE MO;Lo;0;L;;;;;N;;;;; +121F;ETHIOPIC SYLLABLE MWA;Lo;0;L;;;;;N;;;;; +1220;ETHIOPIC SYLLABLE SZA;Lo;0;L;;;;;N;;;;; +1221;ETHIOPIC SYLLABLE SZU;Lo;0;L;;;;;N;;;;; +1222;ETHIOPIC SYLLABLE SZI;Lo;0;L;;;;;N;;;;; +1223;ETHIOPIC SYLLABLE SZAA;Lo;0;L;;;;;N;;;;; +1224;ETHIOPIC SYLLABLE SZEE;Lo;0;L;;;;;N;;;;; +1225;ETHIOPIC SYLLABLE SZE;Lo;0;L;;;;;N;;;;; +1226;ETHIOPIC SYLLABLE SZO;Lo;0;L;;;;;N;;;;; +1227;ETHIOPIC SYLLABLE SZWA;Lo;0;L;;;;;N;;;;; +1228;ETHIOPIC SYLLABLE RA;Lo;0;L;;;;;N;;;;; +1229;ETHIOPIC SYLLABLE RU;Lo;0;L;;;;;N;;;;; +122A;ETHIOPIC SYLLABLE RI;Lo;0;L;;;;;N;;;;; +122B;ETHIOPIC SYLLABLE RAA;Lo;0;L;;;;;N;;;;; +122C;ETHIOPIC SYLLABLE REE;Lo;0;L;;;;;N;;;;; +122D;ETHIOPIC SYLLABLE RE;Lo;0;L;;;;;N;;;;; +122E;ETHIOPIC SYLLABLE RO;Lo;0;L;;;;;N;;;;; +122F;ETHIOPIC SYLLABLE RWA;Lo;0;L;;;;;N;;;;; +1230;ETHIOPIC SYLLABLE SA;Lo;0;L;;;;;N;;;;; +1231;ETHIOPIC SYLLABLE SU;Lo;0;L;;;;;N;;;;; +1232;ETHIOPIC SYLLABLE SI;Lo;0;L;;;;;N;;;;; +1233;ETHIOPIC SYLLABLE SAA;Lo;0;L;;;;;N;;;;; +1234;ETHIOPIC SYLLABLE SEE;Lo;0;L;;;;;N;;;;; +1235;ETHIOPIC SYLLABLE SE;Lo;0;L;;;;;N;;;;; +1236;ETHIOPIC SYLLABLE SO;Lo;0;L;;;;;N;;;;; +1237;ETHIOPIC SYLLABLE SWA;Lo;0;L;;;;;N;;;;; +1238;ETHIOPIC SYLLABLE SHA;Lo;0;L;;;;;N;;;;; +1239;ETHIOPIC SYLLABLE SHU;Lo;0;L;;;;;N;;;;; +123A;ETHIOPIC SYLLABLE SHI;Lo;0;L;;;;;N;;;;; +123B;ETHIOPIC SYLLABLE SHAA;Lo;0;L;;;;;N;;;;; +123C;ETHIOPIC SYLLABLE SHEE;Lo;0;L;;;;;N;;;;; +123D;ETHIOPIC SYLLABLE SHE;Lo;0;L;;;;;N;;;;; +123E;ETHIOPIC SYLLABLE SHO;Lo;0;L;;;;;N;;;;; +123F;ETHIOPIC SYLLABLE SHWA;Lo;0;L;;;;;N;;;;; +1240;ETHIOPIC SYLLABLE QA;Lo;0;L;;;;;N;;;;; +1241;ETHIOPIC SYLLABLE QU;Lo;0;L;;;;;N;;;;; +1242;ETHIOPIC SYLLABLE QI;Lo;0;L;;;;;N;;;;; +1243;ETHIOPIC SYLLABLE QAA;Lo;0;L;;;;;N;;;;; +1244;ETHIOPIC SYLLABLE QEE;Lo;0;L;;;;;N;;;;; +1245;ETHIOPIC SYLLABLE QE;Lo;0;L;;;;;N;;;;; +1246;ETHIOPIC SYLLABLE QO;Lo;0;L;;;;;N;;;;; +1247;ETHIOPIC SYLLABLE QOA;Lo;0;L;;;;;N;;;;; +1248;ETHIOPIC SYLLABLE QWA;Lo;0;L;;;;;N;;;;; +124A;ETHIOPIC SYLLABLE QWI;Lo;0;L;;;;;N;;;;; +124B;ETHIOPIC SYLLABLE QWAA;Lo;0;L;;;;;N;;;;; +124C;ETHIOPIC SYLLABLE QWEE;Lo;0;L;;;;;N;;;;; +124D;ETHIOPIC SYLLABLE QWE;Lo;0;L;;;;;N;;;;; +1250;ETHIOPIC SYLLABLE QHA;Lo;0;L;;;;;N;;;;; +1251;ETHIOPIC SYLLABLE QHU;Lo;0;L;;;;;N;;;;; +1252;ETHIOPIC SYLLABLE QHI;Lo;0;L;;;;;N;;;;; +1253;ETHIOPIC SYLLABLE QHAA;Lo;0;L;;;;;N;;;;; +1254;ETHIOPIC SYLLABLE QHEE;Lo;0;L;;;;;N;;;;; +1255;ETHIOPIC SYLLABLE QHE;Lo;0;L;;;;;N;;;;; +1256;ETHIOPIC SYLLABLE QHO;Lo;0;L;;;;;N;;;;; +1258;ETHIOPIC SYLLABLE QHWA;Lo;0;L;;;;;N;;;;; +125A;ETHIOPIC SYLLABLE QHWI;Lo;0;L;;;;;N;;;;; +125B;ETHIOPIC SYLLABLE QHWAA;Lo;0;L;;;;;N;;;;; +125C;ETHIOPIC SYLLABLE QHWEE;Lo;0;L;;;;;N;;;;; +125D;ETHIOPIC SYLLABLE QHWE;Lo;0;L;;;;;N;;;;; +1260;ETHIOPIC SYLLABLE BA;Lo;0;L;;;;;N;;;;; +1261;ETHIOPIC SYLLABLE BU;Lo;0;L;;;;;N;;;;; +1262;ETHIOPIC SYLLABLE BI;Lo;0;L;;;;;N;;;;; +1263;ETHIOPIC SYLLABLE BAA;Lo;0;L;;;;;N;;;;; +1264;ETHIOPIC SYLLABLE BEE;Lo;0;L;;;;;N;;;;; +1265;ETHIOPIC SYLLABLE BE;Lo;0;L;;;;;N;;;;; +1266;ETHIOPIC SYLLABLE BO;Lo;0;L;;;;;N;;;;; +1267;ETHIOPIC SYLLABLE BWA;Lo;0;L;;;;;N;;;;; +1268;ETHIOPIC SYLLABLE VA;Lo;0;L;;;;;N;;;;; +1269;ETHIOPIC SYLLABLE VU;Lo;0;L;;;;;N;;;;; +126A;ETHIOPIC SYLLABLE VI;Lo;0;L;;;;;N;;;;; +126B;ETHIOPIC SYLLABLE VAA;Lo;0;L;;;;;N;;;;; +126C;ETHIOPIC SYLLABLE VEE;Lo;0;L;;;;;N;;;;; +126D;ETHIOPIC SYLLABLE VE;Lo;0;L;;;;;N;;;;; +126E;ETHIOPIC SYLLABLE VO;Lo;0;L;;;;;N;;;;; +126F;ETHIOPIC SYLLABLE VWA;Lo;0;L;;;;;N;;;;; +1270;ETHIOPIC SYLLABLE TA;Lo;0;L;;;;;N;;;;; +1271;ETHIOPIC SYLLABLE TU;Lo;0;L;;;;;N;;;;; +1272;ETHIOPIC SYLLABLE TI;Lo;0;L;;;;;N;;;;; +1273;ETHIOPIC SYLLABLE TAA;Lo;0;L;;;;;N;;;;; +1274;ETHIOPIC SYLLABLE TEE;Lo;0;L;;;;;N;;;;; +1275;ETHIOPIC SYLLABLE TE;Lo;0;L;;;;;N;;;;; +1276;ETHIOPIC SYLLABLE TO;Lo;0;L;;;;;N;;;;; +1277;ETHIOPIC SYLLABLE TWA;Lo;0;L;;;;;N;;;;; +1278;ETHIOPIC SYLLABLE CA;Lo;0;L;;;;;N;;;;; +1279;ETHIOPIC SYLLABLE CU;Lo;0;L;;;;;N;;;;; +127A;ETHIOPIC SYLLABLE CI;Lo;0;L;;;;;N;;;;; +127B;ETHIOPIC SYLLABLE CAA;Lo;0;L;;;;;N;;;;; +127C;ETHIOPIC SYLLABLE CEE;Lo;0;L;;;;;N;;;;; +127D;ETHIOPIC SYLLABLE CE;Lo;0;L;;;;;N;;;;; +127E;ETHIOPIC SYLLABLE CO;Lo;0;L;;;;;N;;;;; +127F;ETHIOPIC SYLLABLE CWA;Lo;0;L;;;;;N;;;;; +1280;ETHIOPIC SYLLABLE XA;Lo;0;L;;;;;N;;;;; +1281;ETHIOPIC SYLLABLE XU;Lo;0;L;;;;;N;;;;; +1282;ETHIOPIC SYLLABLE XI;Lo;0;L;;;;;N;;;;; +1283;ETHIOPIC SYLLABLE XAA;Lo;0;L;;;;;N;;;;; +1284;ETHIOPIC SYLLABLE XEE;Lo;0;L;;;;;N;;;;; +1285;ETHIOPIC SYLLABLE XE;Lo;0;L;;;;;N;;;;; +1286;ETHIOPIC SYLLABLE XO;Lo;0;L;;;;;N;;;;; +1287;ETHIOPIC SYLLABLE XOA;Lo;0;L;;;;;N;;;;; +1288;ETHIOPIC SYLLABLE XWA;Lo;0;L;;;;;N;;;;; +128A;ETHIOPIC SYLLABLE XWI;Lo;0;L;;;;;N;;;;; +128B;ETHIOPIC SYLLABLE XWAA;Lo;0;L;;;;;N;;;;; +128C;ETHIOPIC SYLLABLE XWEE;Lo;0;L;;;;;N;;;;; +128D;ETHIOPIC SYLLABLE XWE;Lo;0;L;;;;;N;;;;; +1290;ETHIOPIC SYLLABLE NA;Lo;0;L;;;;;N;;;;; +1291;ETHIOPIC SYLLABLE NU;Lo;0;L;;;;;N;;;;; +1292;ETHIOPIC SYLLABLE NI;Lo;0;L;;;;;N;;;;; +1293;ETHIOPIC SYLLABLE NAA;Lo;0;L;;;;;N;;;;; +1294;ETHIOPIC SYLLABLE NEE;Lo;0;L;;;;;N;;;;; +1295;ETHIOPIC SYLLABLE NE;Lo;0;L;;;;;N;;;;; +1296;ETHIOPIC SYLLABLE NO;Lo;0;L;;;;;N;;;;; +1297;ETHIOPIC SYLLABLE NWA;Lo;0;L;;;;;N;;;;; +1298;ETHIOPIC SYLLABLE NYA;Lo;0;L;;;;;N;;;;; +1299;ETHIOPIC SYLLABLE NYU;Lo;0;L;;;;;N;;;;; +129A;ETHIOPIC SYLLABLE NYI;Lo;0;L;;;;;N;;;;; +129B;ETHIOPIC SYLLABLE NYAA;Lo;0;L;;;;;N;;;;; +129C;ETHIOPIC SYLLABLE NYEE;Lo;0;L;;;;;N;;;;; +129D;ETHIOPIC SYLLABLE NYE;Lo;0;L;;;;;N;;;;; +129E;ETHIOPIC SYLLABLE NYO;Lo;0;L;;;;;N;;;;; +129F;ETHIOPIC SYLLABLE NYWA;Lo;0;L;;;;;N;;;;; +12A0;ETHIOPIC SYLLABLE GLOTTAL A;Lo;0;L;;;;;N;;;;; +12A1;ETHIOPIC SYLLABLE GLOTTAL U;Lo;0;L;;;;;N;;;;; +12A2;ETHIOPIC SYLLABLE GLOTTAL I;Lo;0;L;;;;;N;;;;; +12A3;ETHIOPIC SYLLABLE GLOTTAL AA;Lo;0;L;;;;;N;;;;; +12A4;ETHIOPIC SYLLABLE GLOTTAL EE;Lo;0;L;;;;;N;;;;; +12A5;ETHIOPIC SYLLABLE GLOTTAL E;Lo;0;L;;;;;N;;;;; +12A6;ETHIOPIC SYLLABLE GLOTTAL O;Lo;0;L;;;;;N;;;;; +12A7;ETHIOPIC SYLLABLE GLOTTAL WA;Lo;0;L;;;;;N;;;;; +12A8;ETHIOPIC SYLLABLE KA;Lo;0;L;;;;;N;;;;; +12A9;ETHIOPIC SYLLABLE KU;Lo;0;L;;;;;N;;;;; +12AA;ETHIOPIC SYLLABLE KI;Lo;0;L;;;;;N;;;;; +12AB;ETHIOPIC SYLLABLE KAA;Lo;0;L;;;;;N;;;;; +12AC;ETHIOPIC SYLLABLE KEE;Lo;0;L;;;;;N;;;;; +12AD;ETHIOPIC SYLLABLE KE;Lo;0;L;;;;;N;;;;; +12AE;ETHIOPIC SYLLABLE KO;Lo;0;L;;;;;N;;;;; +12AF;ETHIOPIC SYLLABLE KOA;Lo;0;L;;;;;N;;;;; +12B0;ETHIOPIC SYLLABLE KWA;Lo;0;L;;;;;N;;;;; +12B2;ETHIOPIC SYLLABLE KWI;Lo;0;L;;;;;N;;;;; +12B3;ETHIOPIC SYLLABLE KWAA;Lo;0;L;;;;;N;;;;; +12B4;ETHIOPIC SYLLABLE KWEE;Lo;0;L;;;;;N;;;;; +12B5;ETHIOPIC SYLLABLE KWE;Lo;0;L;;;;;N;;;;; +12B8;ETHIOPIC SYLLABLE KXA;Lo;0;L;;;;;N;;;;; +12B9;ETHIOPIC SYLLABLE KXU;Lo;0;L;;;;;N;;;;; +12BA;ETHIOPIC SYLLABLE KXI;Lo;0;L;;;;;N;;;;; +12BB;ETHIOPIC SYLLABLE KXAA;Lo;0;L;;;;;N;;;;; +12BC;ETHIOPIC SYLLABLE KXEE;Lo;0;L;;;;;N;;;;; +12BD;ETHIOPIC SYLLABLE KXE;Lo;0;L;;;;;N;;;;; +12BE;ETHIOPIC SYLLABLE KXO;Lo;0;L;;;;;N;;;;; +12C0;ETHIOPIC SYLLABLE KXWA;Lo;0;L;;;;;N;;;;; +12C2;ETHIOPIC SYLLABLE KXWI;Lo;0;L;;;;;N;;;;; +12C3;ETHIOPIC SYLLABLE KXWAA;Lo;0;L;;;;;N;;;;; +12C4;ETHIOPIC SYLLABLE KXWEE;Lo;0;L;;;;;N;;;;; +12C5;ETHIOPIC SYLLABLE KXWE;Lo;0;L;;;;;N;;;;; +12C8;ETHIOPIC SYLLABLE WA;Lo;0;L;;;;;N;;;;; +12C9;ETHIOPIC SYLLABLE WU;Lo;0;L;;;;;N;;;;; +12CA;ETHIOPIC SYLLABLE WI;Lo;0;L;;;;;N;;;;; +12CB;ETHIOPIC SYLLABLE WAA;Lo;0;L;;;;;N;;;;; +12CC;ETHIOPIC SYLLABLE WEE;Lo;0;L;;;;;N;;;;; +12CD;ETHIOPIC SYLLABLE WE;Lo;0;L;;;;;N;;;;; +12CE;ETHIOPIC SYLLABLE WO;Lo;0;L;;;;;N;;;;; +12CF;ETHIOPIC SYLLABLE WOA;Lo;0;L;;;;;N;;;;; +12D0;ETHIOPIC SYLLABLE PHARYNGEAL A;Lo;0;L;;;;;N;;;;; +12D1;ETHIOPIC SYLLABLE PHARYNGEAL U;Lo;0;L;;;;;N;;;;; +12D2;ETHIOPIC SYLLABLE PHARYNGEAL I;Lo;0;L;;;;;N;;;;; +12D3;ETHIOPIC SYLLABLE PHARYNGEAL AA;Lo;0;L;;;;;N;;;;; +12D4;ETHIOPIC SYLLABLE PHARYNGEAL EE;Lo;0;L;;;;;N;;;;; +12D5;ETHIOPIC SYLLABLE PHARYNGEAL E;Lo;0;L;;;;;N;;;;; +12D6;ETHIOPIC SYLLABLE PHARYNGEAL O;Lo;0;L;;;;;N;;;;; +12D8;ETHIOPIC SYLLABLE ZA;Lo;0;L;;;;;N;;;;; +12D9;ETHIOPIC SYLLABLE ZU;Lo;0;L;;;;;N;;;;; +12DA;ETHIOPIC SYLLABLE ZI;Lo;0;L;;;;;N;;;;; +12DB;ETHIOPIC SYLLABLE ZAA;Lo;0;L;;;;;N;;;;; +12DC;ETHIOPIC SYLLABLE ZEE;Lo;0;L;;;;;N;;;;; +12DD;ETHIOPIC SYLLABLE ZE;Lo;0;L;;;;;N;;;;; +12DE;ETHIOPIC SYLLABLE ZO;Lo;0;L;;;;;N;;;;; +12DF;ETHIOPIC SYLLABLE ZWA;Lo;0;L;;;;;N;;;;; +12E0;ETHIOPIC SYLLABLE ZHA;Lo;0;L;;;;;N;;;;; +12E1;ETHIOPIC SYLLABLE ZHU;Lo;0;L;;;;;N;;;;; +12E2;ETHIOPIC SYLLABLE ZHI;Lo;0;L;;;;;N;;;;; +12E3;ETHIOPIC SYLLABLE ZHAA;Lo;0;L;;;;;N;;;;; +12E4;ETHIOPIC SYLLABLE ZHEE;Lo;0;L;;;;;N;;;;; +12E5;ETHIOPIC SYLLABLE ZHE;Lo;0;L;;;;;N;;;;; +12E6;ETHIOPIC SYLLABLE ZHO;Lo;0;L;;;;;N;;;;; +12E7;ETHIOPIC SYLLABLE ZHWA;Lo;0;L;;;;;N;;;;; +12E8;ETHIOPIC SYLLABLE YA;Lo;0;L;;;;;N;;;;; +12E9;ETHIOPIC SYLLABLE YU;Lo;0;L;;;;;N;;;;; +12EA;ETHIOPIC SYLLABLE YI;Lo;0;L;;;;;N;;;;; +12EB;ETHIOPIC SYLLABLE YAA;Lo;0;L;;;;;N;;;;; +12EC;ETHIOPIC SYLLABLE YEE;Lo;0;L;;;;;N;;;;; +12ED;ETHIOPIC SYLLABLE YE;Lo;0;L;;;;;N;;;;; +12EE;ETHIOPIC SYLLABLE YO;Lo;0;L;;;;;N;;;;; +12EF;ETHIOPIC SYLLABLE YOA;Lo;0;L;;;;;N;;;;; +12F0;ETHIOPIC SYLLABLE DA;Lo;0;L;;;;;N;;;;; +12F1;ETHIOPIC SYLLABLE DU;Lo;0;L;;;;;N;;;;; +12F2;ETHIOPIC SYLLABLE DI;Lo;0;L;;;;;N;;;;; +12F3;ETHIOPIC SYLLABLE DAA;Lo;0;L;;;;;N;;;;; +12F4;ETHIOPIC SYLLABLE DEE;Lo;0;L;;;;;N;;;;; +12F5;ETHIOPIC SYLLABLE DE;Lo;0;L;;;;;N;;;;; +12F6;ETHIOPIC SYLLABLE DO;Lo;0;L;;;;;N;;;;; +12F7;ETHIOPIC SYLLABLE DWA;Lo;0;L;;;;;N;;;;; +12F8;ETHIOPIC SYLLABLE DDA;Lo;0;L;;;;;N;;;;; +12F9;ETHIOPIC SYLLABLE DDU;Lo;0;L;;;;;N;;;;; +12FA;ETHIOPIC SYLLABLE DDI;Lo;0;L;;;;;N;;;;; +12FB;ETHIOPIC SYLLABLE DDAA;Lo;0;L;;;;;N;;;;; +12FC;ETHIOPIC SYLLABLE DDEE;Lo;0;L;;;;;N;;;;; +12FD;ETHIOPIC SYLLABLE DDE;Lo;0;L;;;;;N;;;;; +12FE;ETHIOPIC SYLLABLE DDO;Lo;0;L;;;;;N;;;;; +12FF;ETHIOPIC SYLLABLE DDWA;Lo;0;L;;;;;N;;;;; +1300;ETHIOPIC SYLLABLE JA;Lo;0;L;;;;;N;;;;; +1301;ETHIOPIC SYLLABLE JU;Lo;0;L;;;;;N;;;;; +1302;ETHIOPIC SYLLABLE JI;Lo;0;L;;;;;N;;;;; +1303;ETHIOPIC SYLLABLE JAA;Lo;0;L;;;;;N;;;;; +1304;ETHIOPIC SYLLABLE JEE;Lo;0;L;;;;;N;;;;; +1305;ETHIOPIC SYLLABLE JE;Lo;0;L;;;;;N;;;;; +1306;ETHIOPIC SYLLABLE JO;Lo;0;L;;;;;N;;;;; +1307;ETHIOPIC SYLLABLE JWA;Lo;0;L;;;;;N;;;;; +1308;ETHIOPIC SYLLABLE GA;Lo;0;L;;;;;N;;;;; +1309;ETHIOPIC SYLLABLE GU;Lo;0;L;;;;;N;;;;; +130A;ETHIOPIC SYLLABLE GI;Lo;0;L;;;;;N;;;;; +130B;ETHIOPIC SYLLABLE GAA;Lo;0;L;;;;;N;;;;; +130C;ETHIOPIC SYLLABLE GEE;Lo;0;L;;;;;N;;;;; +130D;ETHIOPIC SYLLABLE GE;Lo;0;L;;;;;N;;;;; +130E;ETHIOPIC SYLLABLE GO;Lo;0;L;;;;;N;;;;; +130F;ETHIOPIC SYLLABLE GOA;Lo;0;L;;;;;N;;;;; +1310;ETHIOPIC SYLLABLE GWA;Lo;0;L;;;;;N;;;;; +1312;ETHIOPIC SYLLABLE GWI;Lo;0;L;;;;;N;;;;; +1313;ETHIOPIC SYLLABLE GWAA;Lo;0;L;;;;;N;;;;; +1314;ETHIOPIC SYLLABLE GWEE;Lo;0;L;;;;;N;;;;; +1315;ETHIOPIC SYLLABLE GWE;Lo;0;L;;;;;N;;;;; +1318;ETHIOPIC SYLLABLE GGA;Lo;0;L;;;;;N;;;;; +1319;ETHIOPIC SYLLABLE GGU;Lo;0;L;;;;;N;;;;; +131A;ETHIOPIC SYLLABLE GGI;Lo;0;L;;;;;N;;;;; +131B;ETHIOPIC SYLLABLE GGAA;Lo;0;L;;;;;N;;;;; +131C;ETHIOPIC SYLLABLE GGEE;Lo;0;L;;;;;N;;;;; +131D;ETHIOPIC SYLLABLE GGE;Lo;0;L;;;;;N;;;;; +131E;ETHIOPIC SYLLABLE GGO;Lo;0;L;;;;;N;;;;; +131F;ETHIOPIC SYLLABLE GGWAA;Lo;0;L;;;;;N;;;;; +1320;ETHIOPIC SYLLABLE THA;Lo;0;L;;;;;N;;;;; +1321;ETHIOPIC SYLLABLE THU;Lo;0;L;;;;;N;;;;; +1322;ETHIOPIC SYLLABLE THI;Lo;0;L;;;;;N;;;;; +1323;ETHIOPIC SYLLABLE THAA;Lo;0;L;;;;;N;;;;; +1324;ETHIOPIC SYLLABLE THEE;Lo;0;L;;;;;N;;;;; +1325;ETHIOPIC SYLLABLE THE;Lo;0;L;;;;;N;;;;; +1326;ETHIOPIC SYLLABLE THO;Lo;0;L;;;;;N;;;;; +1327;ETHIOPIC SYLLABLE THWA;Lo;0;L;;;;;N;;;;; +1328;ETHIOPIC SYLLABLE CHA;Lo;0;L;;;;;N;;;;; +1329;ETHIOPIC SYLLABLE CHU;Lo;0;L;;;;;N;;;;; +132A;ETHIOPIC SYLLABLE CHI;Lo;0;L;;;;;N;;;;; +132B;ETHIOPIC SYLLABLE CHAA;Lo;0;L;;;;;N;;;;; +132C;ETHIOPIC SYLLABLE CHEE;Lo;0;L;;;;;N;;;;; +132D;ETHIOPIC SYLLABLE CHE;Lo;0;L;;;;;N;;;;; +132E;ETHIOPIC SYLLABLE CHO;Lo;0;L;;;;;N;;;;; +132F;ETHIOPIC SYLLABLE CHWA;Lo;0;L;;;;;N;;;;; +1330;ETHIOPIC SYLLABLE PHA;Lo;0;L;;;;;N;;;;; +1331;ETHIOPIC SYLLABLE PHU;Lo;0;L;;;;;N;;;;; +1332;ETHIOPIC SYLLABLE PHI;Lo;0;L;;;;;N;;;;; +1333;ETHIOPIC SYLLABLE PHAA;Lo;0;L;;;;;N;;;;; +1334;ETHIOPIC SYLLABLE PHEE;Lo;0;L;;;;;N;;;;; +1335;ETHIOPIC SYLLABLE PHE;Lo;0;L;;;;;N;;;;; +1336;ETHIOPIC SYLLABLE PHO;Lo;0;L;;;;;N;;;;; +1337;ETHIOPIC SYLLABLE PHWA;Lo;0;L;;;;;N;;;;; +1338;ETHIOPIC SYLLABLE TSA;Lo;0;L;;;;;N;;;;; +1339;ETHIOPIC SYLLABLE TSU;Lo;0;L;;;;;N;;;;; +133A;ETHIOPIC SYLLABLE TSI;Lo;0;L;;;;;N;;;;; +133B;ETHIOPIC SYLLABLE TSAA;Lo;0;L;;;;;N;;;;; +133C;ETHIOPIC SYLLABLE TSEE;Lo;0;L;;;;;N;;;;; +133D;ETHIOPIC SYLLABLE TSE;Lo;0;L;;;;;N;;;;; +133E;ETHIOPIC SYLLABLE TSO;Lo;0;L;;;;;N;;;;; +133F;ETHIOPIC SYLLABLE TSWA;Lo;0;L;;;;;N;;;;; +1340;ETHIOPIC SYLLABLE TZA;Lo;0;L;;;;;N;;;;; +1341;ETHIOPIC SYLLABLE TZU;Lo;0;L;;;;;N;;;;; +1342;ETHIOPIC SYLLABLE TZI;Lo;0;L;;;;;N;;;;; +1343;ETHIOPIC SYLLABLE TZAA;Lo;0;L;;;;;N;;;;; +1344;ETHIOPIC SYLLABLE TZEE;Lo;0;L;;;;;N;;;;; +1345;ETHIOPIC SYLLABLE TZE;Lo;0;L;;;;;N;;;;; +1346;ETHIOPIC SYLLABLE TZO;Lo;0;L;;;;;N;;;;; +1347;ETHIOPIC SYLLABLE TZOA;Lo;0;L;;;;;N;;;;; +1348;ETHIOPIC SYLLABLE FA;Lo;0;L;;;;;N;;;;; +1349;ETHIOPIC SYLLABLE FU;Lo;0;L;;;;;N;;;;; +134A;ETHIOPIC SYLLABLE FI;Lo;0;L;;;;;N;;;;; +134B;ETHIOPIC SYLLABLE FAA;Lo;0;L;;;;;N;;;;; +134C;ETHIOPIC SYLLABLE FEE;Lo;0;L;;;;;N;;;;; +134D;ETHIOPIC SYLLABLE FE;Lo;0;L;;;;;N;;;;; +134E;ETHIOPIC SYLLABLE FO;Lo;0;L;;;;;N;;;;; +134F;ETHIOPIC SYLLABLE FWA;Lo;0;L;;;;;N;;;;; +1350;ETHIOPIC SYLLABLE PA;Lo;0;L;;;;;N;;;;; +1351;ETHIOPIC SYLLABLE PU;Lo;0;L;;;;;N;;;;; +1352;ETHIOPIC SYLLABLE PI;Lo;0;L;;;;;N;;;;; +1353;ETHIOPIC SYLLABLE PAA;Lo;0;L;;;;;N;;;;; +1354;ETHIOPIC SYLLABLE PEE;Lo;0;L;;;;;N;;;;; +1355;ETHIOPIC SYLLABLE PE;Lo;0;L;;;;;N;;;;; +1356;ETHIOPIC SYLLABLE PO;Lo;0;L;;;;;N;;;;; +1357;ETHIOPIC SYLLABLE PWA;Lo;0;L;;;;;N;;;;; +1358;ETHIOPIC SYLLABLE RYA;Lo;0;L;;;;;N;;;;; +1359;ETHIOPIC SYLLABLE MYA;Lo;0;L;;;;;N;;;;; +135A;ETHIOPIC SYLLABLE FYA;Lo;0;L;;;;;N;;;;; +135D;ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK;Mn;230;NSM;;;;;N;;;;; +135E;ETHIOPIC COMBINING VOWEL LENGTH MARK;Mn;230;NSM;;;;;N;;;;; +135F;ETHIOPIC COMBINING GEMINATION MARK;Mn;230;NSM;;;;;N;;;;; +1360;ETHIOPIC SECTION MARK;Po;0;L;;;;;N;;;;; +1361;ETHIOPIC WORDSPACE;Po;0;L;;;;;N;;;;; +1362;ETHIOPIC FULL STOP;Po;0;L;;;;;N;;;;; +1363;ETHIOPIC COMMA;Po;0;L;;;;;N;;;;; +1364;ETHIOPIC SEMICOLON;Po;0;L;;;;;N;;;;; +1365;ETHIOPIC COLON;Po;0;L;;;;;N;;;;; +1366;ETHIOPIC PREFACE COLON;Po;0;L;;;;;N;;;;; +1367;ETHIOPIC QUESTION MARK;Po;0;L;;;;;N;;;;; +1368;ETHIOPIC PARAGRAPH SEPARATOR;Po;0;L;;;;;N;;;;; +1369;ETHIOPIC DIGIT ONE;No;0;L;;;1;1;N;;;;; +136A;ETHIOPIC DIGIT TWO;No;0;L;;;2;2;N;;;;; +136B;ETHIOPIC DIGIT THREE;No;0;L;;;3;3;N;;;;; +136C;ETHIOPIC DIGIT FOUR;No;0;L;;;4;4;N;;;;; +136D;ETHIOPIC DIGIT FIVE;No;0;L;;;5;5;N;;;;; +136E;ETHIOPIC DIGIT SIX;No;0;L;;;6;6;N;;;;; +136F;ETHIOPIC DIGIT SEVEN;No;0;L;;;7;7;N;;;;; +1370;ETHIOPIC DIGIT EIGHT;No;0;L;;;8;8;N;;;;; +1371;ETHIOPIC DIGIT NINE;No;0;L;;;9;9;N;;;;; +1372;ETHIOPIC NUMBER TEN;No;0;L;;;;10;N;;;;; +1373;ETHIOPIC NUMBER TWENTY;No;0;L;;;;20;N;;;;; +1374;ETHIOPIC NUMBER THIRTY;No;0;L;;;;30;N;;;;; +1375;ETHIOPIC NUMBER FORTY;No;0;L;;;;40;N;;;;; +1376;ETHIOPIC NUMBER FIFTY;No;0;L;;;;50;N;;;;; +1377;ETHIOPIC NUMBER SIXTY;No;0;L;;;;60;N;;;;; +1378;ETHIOPIC NUMBER SEVENTY;No;0;L;;;;70;N;;;;; +1379;ETHIOPIC NUMBER EIGHTY;No;0;L;;;;80;N;;;;; +137A;ETHIOPIC NUMBER NINETY;No;0;L;;;;90;N;;;;; +137B;ETHIOPIC NUMBER HUNDRED;No;0;L;;;;100;N;;;;; +137C;ETHIOPIC NUMBER TEN THOUSAND;No;0;L;;;;10000;N;;;;; +1380;ETHIOPIC SYLLABLE SEBATBEIT MWA;Lo;0;L;;;;;N;;;;; +1381;ETHIOPIC SYLLABLE MWI;Lo;0;L;;;;;N;;;;; +1382;ETHIOPIC SYLLABLE MWEE;Lo;0;L;;;;;N;;;;; +1383;ETHIOPIC SYLLABLE MWE;Lo;0;L;;;;;N;;;;; +1384;ETHIOPIC SYLLABLE SEBATBEIT BWA;Lo;0;L;;;;;N;;;;; +1385;ETHIOPIC SYLLABLE BWI;Lo;0;L;;;;;N;;;;; +1386;ETHIOPIC SYLLABLE BWEE;Lo;0;L;;;;;N;;;;; +1387;ETHIOPIC SYLLABLE BWE;Lo;0;L;;;;;N;;;;; +1388;ETHIOPIC SYLLABLE SEBATBEIT FWA;Lo;0;L;;;;;N;;;;; +1389;ETHIOPIC SYLLABLE FWI;Lo;0;L;;;;;N;;;;; +138A;ETHIOPIC SYLLABLE FWEE;Lo;0;L;;;;;N;;;;; +138B;ETHIOPIC SYLLABLE FWE;Lo;0;L;;;;;N;;;;; +138C;ETHIOPIC SYLLABLE SEBATBEIT PWA;Lo;0;L;;;;;N;;;;; +138D;ETHIOPIC SYLLABLE PWI;Lo;0;L;;;;;N;;;;; +138E;ETHIOPIC SYLLABLE PWEE;Lo;0;L;;;;;N;;;;; +138F;ETHIOPIC SYLLABLE PWE;Lo;0;L;;;;;N;;;;; +1390;ETHIOPIC TONAL MARK YIZET;So;0;ON;;;;;N;;;;; +1391;ETHIOPIC TONAL MARK DERET;So;0;ON;;;;;N;;;;; +1392;ETHIOPIC TONAL MARK RIKRIK;So;0;ON;;;;;N;;;;; +1393;ETHIOPIC TONAL MARK SHORT RIKRIK;So;0;ON;;;;;N;;;;; +1394;ETHIOPIC TONAL MARK DIFAT;So;0;ON;;;;;N;;;;; +1395;ETHIOPIC TONAL MARK KENAT;So;0;ON;;;;;N;;;;; +1396;ETHIOPIC TONAL MARK CHIRET;So;0;ON;;;;;N;;;;; +1397;ETHIOPIC TONAL MARK HIDET;So;0;ON;;;;;N;;;;; +1398;ETHIOPIC TONAL MARK DERET-HIDET;So;0;ON;;;;;N;;;;; +1399;ETHIOPIC TONAL MARK KURT;So;0;ON;;;;;N;;;;; +13A0;CHEROKEE LETTER A;Lu;0;L;;;;;N;;;;AB70; +13A1;CHEROKEE LETTER E;Lu;0;L;;;;;N;;;;AB71; +13A2;CHEROKEE LETTER I;Lu;0;L;;;;;N;;;;AB72; +13A3;CHEROKEE LETTER O;Lu;0;L;;;;;N;;;;AB73; +13A4;CHEROKEE LETTER U;Lu;0;L;;;;;N;;;;AB74; +13A5;CHEROKEE LETTER V;Lu;0;L;;;;;N;;;;AB75; +13A6;CHEROKEE LETTER GA;Lu;0;L;;;;;N;;;;AB76; +13A7;CHEROKEE LETTER KA;Lu;0;L;;;;;N;;;;AB77; +13A8;CHEROKEE LETTER GE;Lu;0;L;;;;;N;;;;AB78; +13A9;CHEROKEE LETTER GI;Lu;0;L;;;;;N;;;;AB79; +13AA;CHEROKEE LETTER GO;Lu;0;L;;;;;N;;;;AB7A; +13AB;CHEROKEE LETTER GU;Lu;0;L;;;;;N;;;;AB7B; +13AC;CHEROKEE LETTER GV;Lu;0;L;;;;;N;;;;AB7C; +13AD;CHEROKEE LETTER HA;Lu;0;L;;;;;N;;;;AB7D; +13AE;CHEROKEE LETTER HE;Lu;0;L;;;;;N;;;;AB7E; +13AF;CHEROKEE LETTER HI;Lu;0;L;;;;;N;;;;AB7F; +13B0;CHEROKEE LETTER HO;Lu;0;L;;;;;N;;;;AB80; +13B1;CHEROKEE LETTER HU;Lu;0;L;;;;;N;;;;AB81; +13B2;CHEROKEE LETTER HV;Lu;0;L;;;;;N;;;;AB82; +13B3;CHEROKEE LETTER LA;Lu;0;L;;;;;N;;;;AB83; +13B4;CHEROKEE LETTER LE;Lu;0;L;;;;;N;;;;AB84; +13B5;CHEROKEE LETTER LI;Lu;0;L;;;;;N;;;;AB85; +13B6;CHEROKEE LETTER LO;Lu;0;L;;;;;N;;;;AB86; +13B7;CHEROKEE LETTER LU;Lu;0;L;;;;;N;;;;AB87; +13B8;CHEROKEE LETTER LV;Lu;0;L;;;;;N;;;;AB88; +13B9;CHEROKEE LETTER MA;Lu;0;L;;;;;N;;;;AB89; +13BA;CHEROKEE LETTER ME;Lu;0;L;;;;;N;;;;AB8A; +13BB;CHEROKEE LETTER MI;Lu;0;L;;;;;N;;;;AB8B; +13BC;CHEROKEE LETTER MO;Lu;0;L;;;;;N;;;;AB8C; +13BD;CHEROKEE LETTER MU;Lu;0;L;;;;;N;;;;AB8D; +13BE;CHEROKEE LETTER NA;Lu;0;L;;;;;N;;;;AB8E; +13BF;CHEROKEE LETTER HNA;Lu;0;L;;;;;N;;;;AB8F; +13C0;CHEROKEE LETTER NAH;Lu;0;L;;;;;N;;;;AB90; +13C1;CHEROKEE LETTER NE;Lu;0;L;;;;;N;;;;AB91; +13C2;CHEROKEE LETTER NI;Lu;0;L;;;;;N;;;;AB92; +13C3;CHEROKEE LETTER NO;Lu;0;L;;;;;N;;;;AB93; +13C4;CHEROKEE LETTER NU;Lu;0;L;;;;;N;;;;AB94; +13C5;CHEROKEE LETTER NV;Lu;0;L;;;;;N;;;;AB95; +13C6;CHEROKEE LETTER QUA;Lu;0;L;;;;;N;;;;AB96; +13C7;CHEROKEE LETTER QUE;Lu;0;L;;;;;N;;;;AB97; +13C8;CHEROKEE LETTER QUI;Lu;0;L;;;;;N;;;;AB98; +13C9;CHEROKEE LETTER QUO;Lu;0;L;;;;;N;;;;AB99; +13CA;CHEROKEE LETTER QUU;Lu;0;L;;;;;N;;;;AB9A; +13CB;CHEROKEE LETTER QUV;Lu;0;L;;;;;N;;;;AB9B; +13CC;CHEROKEE LETTER SA;Lu;0;L;;;;;N;;;;AB9C; +13CD;CHEROKEE LETTER S;Lu;0;L;;;;;N;;;;AB9D; +13CE;CHEROKEE LETTER SE;Lu;0;L;;;;;N;;;;AB9E; +13CF;CHEROKEE LETTER SI;Lu;0;L;;;;;N;;;;AB9F; +13D0;CHEROKEE LETTER SO;Lu;0;L;;;;;N;;;;ABA0; +13D1;CHEROKEE LETTER SU;Lu;0;L;;;;;N;;;;ABA1; +13D2;CHEROKEE LETTER SV;Lu;0;L;;;;;N;;;;ABA2; +13D3;CHEROKEE LETTER DA;Lu;0;L;;;;;N;;;;ABA3; +13D4;CHEROKEE LETTER TA;Lu;0;L;;;;;N;;;;ABA4; +13D5;CHEROKEE LETTER DE;Lu;0;L;;;;;N;;;;ABA5; +13D6;CHEROKEE LETTER TE;Lu;0;L;;;;;N;;;;ABA6; +13D7;CHEROKEE LETTER DI;Lu;0;L;;;;;N;;;;ABA7; +13D8;CHEROKEE LETTER TI;Lu;0;L;;;;;N;;;;ABA8; +13D9;CHEROKEE LETTER DO;Lu;0;L;;;;;N;;;;ABA9; +13DA;CHEROKEE LETTER DU;Lu;0;L;;;;;N;;;;ABAA; +13DB;CHEROKEE LETTER DV;Lu;0;L;;;;;N;;;;ABAB; +13DC;CHEROKEE LETTER DLA;Lu;0;L;;;;;N;;;;ABAC; +13DD;CHEROKEE LETTER TLA;Lu;0;L;;;;;N;;;;ABAD; +13DE;CHEROKEE LETTER TLE;Lu;0;L;;;;;N;;;;ABAE; +13DF;CHEROKEE LETTER TLI;Lu;0;L;;;;;N;;;;ABAF; +13E0;CHEROKEE LETTER TLO;Lu;0;L;;;;;N;;;;ABB0; +13E1;CHEROKEE LETTER TLU;Lu;0;L;;;;;N;;;;ABB1; +13E2;CHEROKEE LETTER TLV;Lu;0;L;;;;;N;;;;ABB2; +13E3;CHEROKEE LETTER TSA;Lu;0;L;;;;;N;;;;ABB3; +13E4;CHEROKEE LETTER TSE;Lu;0;L;;;;;N;;;;ABB4; +13E5;CHEROKEE LETTER TSI;Lu;0;L;;;;;N;;;;ABB5; +13E6;CHEROKEE LETTER TSO;Lu;0;L;;;;;N;;;;ABB6; +13E7;CHEROKEE LETTER TSU;Lu;0;L;;;;;N;;;;ABB7; +13E8;CHEROKEE LETTER TSV;Lu;0;L;;;;;N;;;;ABB8; +13E9;CHEROKEE LETTER WA;Lu;0;L;;;;;N;;;;ABB9; +13EA;CHEROKEE LETTER WE;Lu;0;L;;;;;N;;;;ABBA; +13EB;CHEROKEE LETTER WI;Lu;0;L;;;;;N;;;;ABBB; +13EC;CHEROKEE LETTER WO;Lu;0;L;;;;;N;;;;ABBC; +13ED;CHEROKEE LETTER WU;Lu;0;L;;;;;N;;;;ABBD; +13EE;CHEROKEE LETTER WV;Lu;0;L;;;;;N;;;;ABBE; +13EF;CHEROKEE LETTER YA;Lu;0;L;;;;;N;;;;ABBF; +13F0;CHEROKEE LETTER YE;Lu;0;L;;;;;N;;;;13F8; +13F1;CHEROKEE LETTER YI;Lu;0;L;;;;;N;;;;13F9; +13F2;CHEROKEE LETTER YO;Lu;0;L;;;;;N;;;;13FA; +13F3;CHEROKEE LETTER YU;Lu;0;L;;;;;N;;;;13FB; +13F4;CHEROKEE LETTER YV;Lu;0;L;;;;;N;;;;13FC; +13F5;CHEROKEE LETTER MV;Lu;0;L;;;;;N;;;;13FD; +13F8;CHEROKEE SMALL LETTER YE;Ll;0;L;;;;;N;;;13F0;;13F0 +13F9;CHEROKEE SMALL LETTER YI;Ll;0;L;;;;;N;;;13F1;;13F1 +13FA;CHEROKEE SMALL LETTER YO;Ll;0;L;;;;;N;;;13F2;;13F2 +13FB;CHEROKEE SMALL LETTER YU;Ll;0;L;;;;;N;;;13F3;;13F3 +13FC;CHEROKEE SMALL LETTER YV;Ll;0;L;;;;;N;;;13F4;;13F4 +13FD;CHEROKEE SMALL LETTER MV;Ll;0;L;;;;;N;;;13F5;;13F5 +1400;CANADIAN SYLLABICS HYPHEN;Pd;0;ON;;;;;N;;;;; +1401;CANADIAN SYLLABICS E;Lo;0;L;;;;;N;;;;; +1402;CANADIAN SYLLABICS AAI;Lo;0;L;;;;;N;;;;; +1403;CANADIAN SYLLABICS I;Lo;0;L;;;;;N;;;;; +1404;CANADIAN SYLLABICS II;Lo;0;L;;;;;N;;;;; +1405;CANADIAN SYLLABICS O;Lo;0;L;;;;;N;;;;; +1406;CANADIAN SYLLABICS OO;Lo;0;L;;;;;N;;;;; +1407;CANADIAN SYLLABICS Y-CREE OO;Lo;0;L;;;;;N;;;;; +1408;CANADIAN SYLLABICS CARRIER EE;Lo;0;L;;;;;N;;;;; +1409;CANADIAN SYLLABICS CARRIER I;Lo;0;L;;;;;N;;;;; +140A;CANADIAN SYLLABICS A;Lo;0;L;;;;;N;;;;; +140B;CANADIAN SYLLABICS AA;Lo;0;L;;;;;N;;;;; +140C;CANADIAN SYLLABICS WE;Lo;0;L;;;;;N;;;;; +140D;CANADIAN SYLLABICS WEST-CREE WE;Lo;0;L;;;;;N;;;;; +140E;CANADIAN SYLLABICS WI;Lo;0;L;;;;;N;;;;; +140F;CANADIAN SYLLABICS WEST-CREE WI;Lo;0;L;;;;;N;;;;; +1410;CANADIAN SYLLABICS WII;Lo;0;L;;;;;N;;;;; +1411;CANADIAN SYLLABICS WEST-CREE WII;Lo;0;L;;;;;N;;;;; +1412;CANADIAN SYLLABICS WO;Lo;0;L;;;;;N;;;;; +1413;CANADIAN SYLLABICS WEST-CREE WO;Lo;0;L;;;;;N;;;;; +1414;CANADIAN SYLLABICS WOO;Lo;0;L;;;;;N;;;;; +1415;CANADIAN SYLLABICS WEST-CREE WOO;Lo;0;L;;;;;N;;;;; +1416;CANADIAN SYLLABICS NASKAPI WOO;Lo;0;L;;;;;N;;;;; +1417;CANADIAN SYLLABICS WA;Lo;0;L;;;;;N;;;;; +1418;CANADIAN SYLLABICS WEST-CREE WA;Lo;0;L;;;;;N;;;;; +1419;CANADIAN SYLLABICS WAA;Lo;0;L;;;;;N;;;;; +141A;CANADIAN SYLLABICS WEST-CREE WAA;Lo;0;L;;;;;N;;;;; +141B;CANADIAN SYLLABICS NASKAPI WAA;Lo;0;L;;;;;N;;;;; +141C;CANADIAN SYLLABICS AI;Lo;0;L;;;;;N;;;;; +141D;CANADIAN SYLLABICS Y-CREE W;Lo;0;L;;;;;N;;;;; +141E;CANADIAN SYLLABICS GLOTTAL STOP;Lo;0;L;;;;;N;;;;; +141F;CANADIAN SYLLABICS FINAL ACUTE;Lo;0;L;;;;;N;;;;; +1420;CANADIAN SYLLABICS FINAL GRAVE;Lo;0;L;;;;;N;;;;; +1421;CANADIAN SYLLABICS FINAL BOTTOM HALF RING;Lo;0;L;;;;;N;;;;; +1422;CANADIAN SYLLABICS FINAL TOP HALF RING;Lo;0;L;;;;;N;;;;; +1423;CANADIAN SYLLABICS FINAL RIGHT HALF RING;Lo;0;L;;;;;N;;;;; +1424;CANADIAN SYLLABICS FINAL RING;Lo;0;L;;;;;N;;;;; +1425;CANADIAN SYLLABICS FINAL DOUBLE ACUTE;Lo;0;L;;;;;N;;;;; +1426;CANADIAN SYLLABICS FINAL DOUBLE SHORT VERTICAL STROKES;Lo;0;L;;;;;N;;;;; +1427;CANADIAN SYLLABICS FINAL MIDDLE DOT;Lo;0;L;;;;;N;;;;; +1428;CANADIAN SYLLABICS FINAL SHORT HORIZONTAL STROKE;Lo;0;L;;;;;N;;;;; +1429;CANADIAN SYLLABICS FINAL PLUS;Lo;0;L;;;;;N;;;;; +142A;CANADIAN SYLLABICS FINAL DOWN TACK;Lo;0;L;;;;;N;;;;; +142B;CANADIAN SYLLABICS EN;Lo;0;L;;;;;N;;;;; +142C;CANADIAN SYLLABICS IN;Lo;0;L;;;;;N;;;;; +142D;CANADIAN SYLLABICS ON;Lo;0;L;;;;;N;;;;; +142E;CANADIAN SYLLABICS AN;Lo;0;L;;;;;N;;;;; +142F;CANADIAN SYLLABICS PE;Lo;0;L;;;;;N;;;;; +1430;CANADIAN SYLLABICS PAAI;Lo;0;L;;;;;N;;;;; +1431;CANADIAN SYLLABICS PI;Lo;0;L;;;;;N;;;;; +1432;CANADIAN SYLLABICS PII;Lo;0;L;;;;;N;;;;; +1433;CANADIAN SYLLABICS PO;Lo;0;L;;;;;N;;;;; +1434;CANADIAN SYLLABICS POO;Lo;0;L;;;;;N;;;;; +1435;CANADIAN SYLLABICS Y-CREE POO;Lo;0;L;;;;;N;;;;; +1436;CANADIAN SYLLABICS CARRIER HEE;Lo;0;L;;;;;N;;;;; +1437;CANADIAN SYLLABICS CARRIER HI;Lo;0;L;;;;;N;;;;; +1438;CANADIAN SYLLABICS PA;Lo;0;L;;;;;N;;;;; +1439;CANADIAN SYLLABICS PAA;Lo;0;L;;;;;N;;;;; +143A;CANADIAN SYLLABICS PWE;Lo;0;L;;;;;N;;;;; +143B;CANADIAN SYLLABICS WEST-CREE PWE;Lo;0;L;;;;;N;;;;; +143C;CANADIAN SYLLABICS PWI;Lo;0;L;;;;;N;;;;; +143D;CANADIAN SYLLABICS WEST-CREE PWI;Lo;0;L;;;;;N;;;;; +143E;CANADIAN SYLLABICS PWII;Lo;0;L;;;;;N;;;;; +143F;CANADIAN SYLLABICS WEST-CREE PWII;Lo;0;L;;;;;N;;;;; +1440;CANADIAN SYLLABICS PWO;Lo;0;L;;;;;N;;;;; +1441;CANADIAN SYLLABICS WEST-CREE PWO;Lo;0;L;;;;;N;;;;; +1442;CANADIAN SYLLABICS PWOO;Lo;0;L;;;;;N;;;;; +1443;CANADIAN SYLLABICS WEST-CREE PWOO;Lo;0;L;;;;;N;;;;; +1444;CANADIAN SYLLABICS PWA;Lo;0;L;;;;;N;;;;; +1445;CANADIAN SYLLABICS WEST-CREE PWA;Lo;0;L;;;;;N;;;;; +1446;CANADIAN SYLLABICS PWAA;Lo;0;L;;;;;N;;;;; +1447;CANADIAN SYLLABICS WEST-CREE PWAA;Lo;0;L;;;;;N;;;;; +1448;CANADIAN SYLLABICS Y-CREE PWAA;Lo;0;L;;;;;N;;;;; +1449;CANADIAN SYLLABICS P;Lo;0;L;;;;;N;;;;; +144A;CANADIAN SYLLABICS WEST-CREE P;Lo;0;L;;;;;N;;;;; +144B;CANADIAN SYLLABICS CARRIER H;Lo;0;L;;;;;N;;;;; +144C;CANADIAN SYLLABICS TE;Lo;0;L;;;;;N;;;;; +144D;CANADIAN SYLLABICS TAAI;Lo;0;L;;;;;N;;;;; +144E;CANADIAN SYLLABICS TI;Lo;0;L;;;;;N;;;;; +144F;CANADIAN SYLLABICS TII;Lo;0;L;;;;;N;;;;; +1450;CANADIAN SYLLABICS TO;Lo;0;L;;;;;N;;;;; +1451;CANADIAN SYLLABICS TOO;Lo;0;L;;;;;N;;;;; +1452;CANADIAN SYLLABICS Y-CREE TOO;Lo;0;L;;;;;N;;;;; +1453;CANADIAN SYLLABICS CARRIER DEE;Lo;0;L;;;;;N;;;;; +1454;CANADIAN SYLLABICS CARRIER DI;Lo;0;L;;;;;N;;;;; +1455;CANADIAN SYLLABICS TA;Lo;0;L;;;;;N;;;;; +1456;CANADIAN SYLLABICS TAA;Lo;0;L;;;;;N;;;;; +1457;CANADIAN SYLLABICS TWE;Lo;0;L;;;;;N;;;;; +1458;CANADIAN SYLLABICS WEST-CREE TWE;Lo;0;L;;;;;N;;;;; +1459;CANADIAN SYLLABICS TWI;Lo;0;L;;;;;N;;;;; +145A;CANADIAN SYLLABICS WEST-CREE TWI;Lo;0;L;;;;;N;;;;; +145B;CANADIAN SYLLABICS TWII;Lo;0;L;;;;;N;;;;; +145C;CANADIAN SYLLABICS WEST-CREE TWII;Lo;0;L;;;;;N;;;;; +145D;CANADIAN SYLLABICS TWO;Lo;0;L;;;;;N;;;;; +145E;CANADIAN SYLLABICS WEST-CREE TWO;Lo;0;L;;;;;N;;;;; +145F;CANADIAN SYLLABICS TWOO;Lo;0;L;;;;;N;;;;; +1460;CANADIAN SYLLABICS WEST-CREE TWOO;Lo;0;L;;;;;N;;;;; +1461;CANADIAN SYLLABICS TWA;Lo;0;L;;;;;N;;;;; +1462;CANADIAN SYLLABICS WEST-CREE TWA;Lo;0;L;;;;;N;;;;; +1463;CANADIAN SYLLABICS TWAA;Lo;0;L;;;;;N;;;;; +1464;CANADIAN SYLLABICS WEST-CREE TWAA;Lo;0;L;;;;;N;;;;; +1465;CANADIAN SYLLABICS NASKAPI TWAA;Lo;0;L;;;;;N;;;;; +1466;CANADIAN SYLLABICS T;Lo;0;L;;;;;N;;;;; +1467;CANADIAN SYLLABICS TTE;Lo;0;L;;;;;N;;;;; +1468;CANADIAN SYLLABICS TTI;Lo;0;L;;;;;N;;;;; +1469;CANADIAN SYLLABICS TTO;Lo;0;L;;;;;N;;;;; +146A;CANADIAN SYLLABICS TTA;Lo;0;L;;;;;N;;;;; +146B;CANADIAN SYLLABICS KE;Lo;0;L;;;;;N;;;;; +146C;CANADIAN SYLLABICS KAAI;Lo;0;L;;;;;N;;;;; +146D;CANADIAN SYLLABICS KI;Lo;0;L;;;;;N;;;;; +146E;CANADIAN SYLLABICS KII;Lo;0;L;;;;;N;;;;; +146F;CANADIAN SYLLABICS KO;Lo;0;L;;;;;N;;;;; +1470;CANADIAN SYLLABICS KOO;Lo;0;L;;;;;N;;;;; +1471;CANADIAN SYLLABICS Y-CREE KOO;Lo;0;L;;;;;N;;;;; +1472;CANADIAN SYLLABICS KA;Lo;0;L;;;;;N;;;;; +1473;CANADIAN SYLLABICS KAA;Lo;0;L;;;;;N;;;;; +1474;CANADIAN SYLLABICS KWE;Lo;0;L;;;;;N;;;;; +1475;CANADIAN SYLLABICS WEST-CREE KWE;Lo;0;L;;;;;N;;;;; +1476;CANADIAN SYLLABICS KWI;Lo;0;L;;;;;N;;;;; +1477;CANADIAN SYLLABICS WEST-CREE KWI;Lo;0;L;;;;;N;;;;; +1478;CANADIAN SYLLABICS KWII;Lo;0;L;;;;;N;;;;; +1479;CANADIAN SYLLABICS WEST-CREE KWII;Lo;0;L;;;;;N;;;;; +147A;CANADIAN SYLLABICS KWO;Lo;0;L;;;;;N;;;;; +147B;CANADIAN SYLLABICS WEST-CREE KWO;Lo;0;L;;;;;N;;;;; +147C;CANADIAN SYLLABICS KWOO;Lo;0;L;;;;;N;;;;; +147D;CANADIAN SYLLABICS WEST-CREE KWOO;Lo;0;L;;;;;N;;;;; +147E;CANADIAN SYLLABICS KWA;Lo;0;L;;;;;N;;;;; +147F;CANADIAN SYLLABICS WEST-CREE KWA;Lo;0;L;;;;;N;;;;; +1480;CANADIAN SYLLABICS KWAA;Lo;0;L;;;;;N;;;;; +1481;CANADIAN SYLLABICS WEST-CREE KWAA;Lo;0;L;;;;;N;;;;; +1482;CANADIAN SYLLABICS NASKAPI KWAA;Lo;0;L;;;;;N;;;;; +1483;CANADIAN SYLLABICS K;Lo;0;L;;;;;N;;;;; +1484;CANADIAN SYLLABICS KW;Lo;0;L;;;;;N;;;;; +1485;CANADIAN SYLLABICS SOUTH-SLAVEY KEH;Lo;0;L;;;;;N;;;;; +1486;CANADIAN SYLLABICS SOUTH-SLAVEY KIH;Lo;0;L;;;;;N;;;;; +1487;CANADIAN SYLLABICS SOUTH-SLAVEY KOH;Lo;0;L;;;;;N;;;;; +1488;CANADIAN SYLLABICS SOUTH-SLAVEY KAH;Lo;0;L;;;;;N;;;;; +1489;CANADIAN SYLLABICS CE;Lo;0;L;;;;;N;;;;; +148A;CANADIAN SYLLABICS CAAI;Lo;0;L;;;;;N;;;;; +148B;CANADIAN SYLLABICS CI;Lo;0;L;;;;;N;;;;; +148C;CANADIAN SYLLABICS CII;Lo;0;L;;;;;N;;;;; +148D;CANADIAN SYLLABICS CO;Lo;0;L;;;;;N;;;;; +148E;CANADIAN SYLLABICS COO;Lo;0;L;;;;;N;;;;; +148F;CANADIAN SYLLABICS Y-CREE COO;Lo;0;L;;;;;N;;;;; +1490;CANADIAN SYLLABICS CA;Lo;0;L;;;;;N;;;;; +1491;CANADIAN SYLLABICS CAA;Lo;0;L;;;;;N;;;;; +1492;CANADIAN SYLLABICS CWE;Lo;0;L;;;;;N;;;;; +1493;CANADIAN SYLLABICS WEST-CREE CWE;Lo;0;L;;;;;N;;;;; +1494;CANADIAN SYLLABICS CWI;Lo;0;L;;;;;N;;;;; +1495;CANADIAN SYLLABICS WEST-CREE CWI;Lo;0;L;;;;;N;;;;; +1496;CANADIAN SYLLABICS CWII;Lo;0;L;;;;;N;;;;; +1497;CANADIAN SYLLABICS WEST-CREE CWII;Lo;0;L;;;;;N;;;;; +1498;CANADIAN SYLLABICS CWO;Lo;0;L;;;;;N;;;;; +1499;CANADIAN SYLLABICS WEST-CREE CWO;Lo;0;L;;;;;N;;;;; +149A;CANADIAN SYLLABICS CWOO;Lo;0;L;;;;;N;;;;; +149B;CANADIAN SYLLABICS WEST-CREE CWOO;Lo;0;L;;;;;N;;;;; +149C;CANADIAN SYLLABICS CWA;Lo;0;L;;;;;N;;;;; +149D;CANADIAN SYLLABICS WEST-CREE CWA;Lo;0;L;;;;;N;;;;; +149E;CANADIAN SYLLABICS CWAA;Lo;0;L;;;;;N;;;;; +149F;CANADIAN SYLLABICS WEST-CREE CWAA;Lo;0;L;;;;;N;;;;; +14A0;CANADIAN SYLLABICS NASKAPI CWAA;Lo;0;L;;;;;N;;;;; +14A1;CANADIAN SYLLABICS C;Lo;0;L;;;;;N;;;;; +14A2;CANADIAN SYLLABICS SAYISI TH;Lo;0;L;;;;;N;;;;; +14A3;CANADIAN SYLLABICS ME;Lo;0;L;;;;;N;;;;; +14A4;CANADIAN SYLLABICS MAAI;Lo;0;L;;;;;N;;;;; +14A5;CANADIAN SYLLABICS MI;Lo;0;L;;;;;N;;;;; +14A6;CANADIAN SYLLABICS MII;Lo;0;L;;;;;N;;;;; +14A7;CANADIAN SYLLABICS MO;Lo;0;L;;;;;N;;;;; +14A8;CANADIAN SYLLABICS MOO;Lo;0;L;;;;;N;;;;; +14A9;CANADIAN SYLLABICS Y-CREE MOO;Lo;0;L;;;;;N;;;;; +14AA;CANADIAN SYLLABICS MA;Lo;0;L;;;;;N;;;;; +14AB;CANADIAN SYLLABICS MAA;Lo;0;L;;;;;N;;;;; +14AC;CANADIAN SYLLABICS MWE;Lo;0;L;;;;;N;;;;; +14AD;CANADIAN SYLLABICS WEST-CREE MWE;Lo;0;L;;;;;N;;;;; +14AE;CANADIAN SYLLABICS MWI;Lo;0;L;;;;;N;;;;; +14AF;CANADIAN SYLLABICS WEST-CREE MWI;Lo;0;L;;;;;N;;;;; +14B0;CANADIAN SYLLABICS MWII;Lo;0;L;;;;;N;;;;; +14B1;CANADIAN SYLLABICS WEST-CREE MWII;Lo;0;L;;;;;N;;;;; +14B2;CANADIAN SYLLABICS MWO;Lo;0;L;;;;;N;;;;; +14B3;CANADIAN SYLLABICS WEST-CREE MWO;Lo;0;L;;;;;N;;;;; +14B4;CANADIAN SYLLABICS MWOO;Lo;0;L;;;;;N;;;;; +14B5;CANADIAN SYLLABICS WEST-CREE MWOO;Lo;0;L;;;;;N;;;;; +14B6;CANADIAN SYLLABICS MWA;Lo;0;L;;;;;N;;;;; +14B7;CANADIAN SYLLABICS WEST-CREE MWA;Lo;0;L;;;;;N;;;;; +14B8;CANADIAN SYLLABICS MWAA;Lo;0;L;;;;;N;;;;; +14B9;CANADIAN SYLLABICS WEST-CREE MWAA;Lo;0;L;;;;;N;;;;; +14BA;CANADIAN SYLLABICS NASKAPI MWAA;Lo;0;L;;;;;N;;;;; +14BB;CANADIAN SYLLABICS M;Lo;0;L;;;;;N;;;;; +14BC;CANADIAN SYLLABICS WEST-CREE M;Lo;0;L;;;;;N;;;;; +14BD;CANADIAN SYLLABICS MH;Lo;0;L;;;;;N;;;;; +14BE;CANADIAN SYLLABICS ATHAPASCAN M;Lo;0;L;;;;;N;;;;; +14BF;CANADIAN SYLLABICS SAYISI M;Lo;0;L;;;;;N;;;;; +14C0;CANADIAN SYLLABICS NE;Lo;0;L;;;;;N;;;;; +14C1;CANADIAN SYLLABICS NAAI;Lo;0;L;;;;;N;;;;; +14C2;CANADIAN SYLLABICS NI;Lo;0;L;;;;;N;;;;; +14C3;CANADIAN SYLLABICS NII;Lo;0;L;;;;;N;;;;; +14C4;CANADIAN SYLLABICS NO;Lo;0;L;;;;;N;;;;; +14C5;CANADIAN SYLLABICS NOO;Lo;0;L;;;;;N;;;;; +14C6;CANADIAN SYLLABICS Y-CREE NOO;Lo;0;L;;;;;N;;;;; +14C7;CANADIAN SYLLABICS NA;Lo;0;L;;;;;N;;;;; +14C8;CANADIAN SYLLABICS NAA;Lo;0;L;;;;;N;;;;; +14C9;CANADIAN SYLLABICS NWE;Lo;0;L;;;;;N;;;;; +14CA;CANADIAN SYLLABICS WEST-CREE NWE;Lo;0;L;;;;;N;;;;; +14CB;CANADIAN SYLLABICS NWA;Lo;0;L;;;;;N;;;;; +14CC;CANADIAN SYLLABICS WEST-CREE NWA;Lo;0;L;;;;;N;;;;; +14CD;CANADIAN SYLLABICS NWAA;Lo;0;L;;;;;N;;;;; +14CE;CANADIAN SYLLABICS WEST-CREE NWAA;Lo;0;L;;;;;N;;;;; +14CF;CANADIAN SYLLABICS NASKAPI NWAA;Lo;0;L;;;;;N;;;;; +14D0;CANADIAN SYLLABICS N;Lo;0;L;;;;;N;;;;; +14D1;CANADIAN SYLLABICS CARRIER NG;Lo;0;L;;;;;N;;;;; +14D2;CANADIAN SYLLABICS NH;Lo;0;L;;;;;N;;;;; +14D3;CANADIAN SYLLABICS LE;Lo;0;L;;;;;N;;;;; +14D4;CANADIAN SYLLABICS LAAI;Lo;0;L;;;;;N;;;;; +14D5;CANADIAN SYLLABICS LI;Lo;0;L;;;;;N;;;;; +14D6;CANADIAN SYLLABICS LII;Lo;0;L;;;;;N;;;;; +14D7;CANADIAN SYLLABICS LO;Lo;0;L;;;;;N;;;;; +14D8;CANADIAN SYLLABICS LOO;Lo;0;L;;;;;N;;;;; +14D9;CANADIAN SYLLABICS Y-CREE LOO;Lo;0;L;;;;;N;;;;; +14DA;CANADIAN SYLLABICS LA;Lo;0;L;;;;;N;;;;; +14DB;CANADIAN SYLLABICS LAA;Lo;0;L;;;;;N;;;;; +14DC;CANADIAN SYLLABICS LWE;Lo;0;L;;;;;N;;;;; +14DD;CANADIAN SYLLABICS WEST-CREE LWE;Lo;0;L;;;;;N;;;;; +14DE;CANADIAN SYLLABICS LWI;Lo;0;L;;;;;N;;;;; +14DF;CANADIAN SYLLABICS WEST-CREE LWI;Lo;0;L;;;;;N;;;;; +14E0;CANADIAN SYLLABICS LWII;Lo;0;L;;;;;N;;;;; +14E1;CANADIAN SYLLABICS WEST-CREE LWII;Lo;0;L;;;;;N;;;;; +14E2;CANADIAN SYLLABICS LWO;Lo;0;L;;;;;N;;;;; +14E3;CANADIAN SYLLABICS WEST-CREE LWO;Lo;0;L;;;;;N;;;;; +14E4;CANADIAN SYLLABICS LWOO;Lo;0;L;;;;;N;;;;; +14E5;CANADIAN SYLLABICS WEST-CREE LWOO;Lo;0;L;;;;;N;;;;; +14E6;CANADIAN SYLLABICS LWA;Lo;0;L;;;;;N;;;;; +14E7;CANADIAN SYLLABICS WEST-CREE LWA;Lo;0;L;;;;;N;;;;; +14E8;CANADIAN SYLLABICS LWAA;Lo;0;L;;;;;N;;;;; +14E9;CANADIAN SYLLABICS WEST-CREE LWAA;Lo;0;L;;;;;N;;;;; +14EA;CANADIAN SYLLABICS L;Lo;0;L;;;;;N;;;;; +14EB;CANADIAN SYLLABICS WEST-CREE L;Lo;0;L;;;;;N;;;;; +14EC;CANADIAN SYLLABICS MEDIAL L;Lo;0;L;;;;;N;;;;; +14ED;CANADIAN SYLLABICS SE;Lo;0;L;;;;;N;;;;; +14EE;CANADIAN SYLLABICS SAAI;Lo;0;L;;;;;N;;;;; +14EF;CANADIAN SYLLABICS SI;Lo;0;L;;;;;N;;;;; +14F0;CANADIAN SYLLABICS SII;Lo;0;L;;;;;N;;;;; +14F1;CANADIAN SYLLABICS SO;Lo;0;L;;;;;N;;;;; +14F2;CANADIAN SYLLABICS SOO;Lo;0;L;;;;;N;;;;; +14F3;CANADIAN SYLLABICS Y-CREE SOO;Lo;0;L;;;;;N;;;;; +14F4;CANADIAN SYLLABICS SA;Lo;0;L;;;;;N;;;;; +14F5;CANADIAN SYLLABICS SAA;Lo;0;L;;;;;N;;;;; +14F6;CANADIAN SYLLABICS SWE;Lo;0;L;;;;;N;;;;; +14F7;CANADIAN SYLLABICS WEST-CREE SWE;Lo;0;L;;;;;N;;;;; +14F8;CANADIAN SYLLABICS SWI;Lo;0;L;;;;;N;;;;; +14F9;CANADIAN SYLLABICS WEST-CREE SWI;Lo;0;L;;;;;N;;;;; +14FA;CANADIAN SYLLABICS SWII;Lo;0;L;;;;;N;;;;; +14FB;CANADIAN SYLLABICS WEST-CREE SWII;Lo;0;L;;;;;N;;;;; +14FC;CANADIAN SYLLABICS SWO;Lo;0;L;;;;;N;;;;; +14FD;CANADIAN SYLLABICS WEST-CREE SWO;Lo;0;L;;;;;N;;;;; +14FE;CANADIAN SYLLABICS SWOO;Lo;0;L;;;;;N;;;;; +14FF;CANADIAN SYLLABICS WEST-CREE SWOO;Lo;0;L;;;;;N;;;;; +1500;CANADIAN SYLLABICS SWA;Lo;0;L;;;;;N;;;;; +1501;CANADIAN SYLLABICS WEST-CREE SWA;Lo;0;L;;;;;N;;;;; +1502;CANADIAN SYLLABICS SWAA;Lo;0;L;;;;;N;;;;; +1503;CANADIAN SYLLABICS WEST-CREE SWAA;Lo;0;L;;;;;N;;;;; +1504;CANADIAN SYLLABICS NASKAPI SWAA;Lo;0;L;;;;;N;;;;; +1505;CANADIAN SYLLABICS S;Lo;0;L;;;;;N;;;;; +1506;CANADIAN SYLLABICS ATHAPASCAN S;Lo;0;L;;;;;N;;;;; +1507;CANADIAN SYLLABICS SW;Lo;0;L;;;;;N;;;;; +1508;CANADIAN SYLLABICS BLACKFOOT S;Lo;0;L;;;;;N;;;;; +1509;CANADIAN SYLLABICS MOOSE-CREE SK;Lo;0;L;;;;;N;;;;; +150A;CANADIAN SYLLABICS NASKAPI SKW;Lo;0;L;;;;;N;;;;; +150B;CANADIAN SYLLABICS NASKAPI S-W;Lo;0;L;;;;;N;;;;; +150C;CANADIAN SYLLABICS NASKAPI SPWA;Lo;0;L;;;;;N;;;;; +150D;CANADIAN SYLLABICS NASKAPI STWA;Lo;0;L;;;;;N;;;;; +150E;CANADIAN SYLLABICS NASKAPI SKWA;Lo;0;L;;;;;N;;;;; +150F;CANADIAN SYLLABICS NASKAPI SCWA;Lo;0;L;;;;;N;;;;; +1510;CANADIAN SYLLABICS SHE;Lo;0;L;;;;;N;;;;; +1511;CANADIAN SYLLABICS SHI;Lo;0;L;;;;;N;;;;; +1512;CANADIAN SYLLABICS SHII;Lo;0;L;;;;;N;;;;; +1513;CANADIAN SYLLABICS SHO;Lo;0;L;;;;;N;;;;; +1514;CANADIAN SYLLABICS SHOO;Lo;0;L;;;;;N;;;;; +1515;CANADIAN SYLLABICS SHA;Lo;0;L;;;;;N;;;;; +1516;CANADIAN SYLLABICS SHAA;Lo;0;L;;;;;N;;;;; +1517;CANADIAN SYLLABICS SHWE;Lo;0;L;;;;;N;;;;; +1518;CANADIAN SYLLABICS WEST-CREE SHWE;Lo;0;L;;;;;N;;;;; +1519;CANADIAN SYLLABICS SHWI;Lo;0;L;;;;;N;;;;; +151A;CANADIAN SYLLABICS WEST-CREE SHWI;Lo;0;L;;;;;N;;;;; +151B;CANADIAN SYLLABICS SHWII;Lo;0;L;;;;;N;;;;; +151C;CANADIAN SYLLABICS WEST-CREE SHWII;Lo;0;L;;;;;N;;;;; +151D;CANADIAN SYLLABICS SHWO;Lo;0;L;;;;;N;;;;; +151E;CANADIAN SYLLABICS WEST-CREE SHWO;Lo;0;L;;;;;N;;;;; +151F;CANADIAN SYLLABICS SHWOO;Lo;0;L;;;;;N;;;;; +1520;CANADIAN SYLLABICS WEST-CREE SHWOO;Lo;0;L;;;;;N;;;;; +1521;CANADIAN SYLLABICS SHWA;Lo;0;L;;;;;N;;;;; +1522;CANADIAN SYLLABICS WEST-CREE SHWA;Lo;0;L;;;;;N;;;;; +1523;CANADIAN SYLLABICS SHWAA;Lo;0;L;;;;;N;;;;; +1524;CANADIAN SYLLABICS WEST-CREE SHWAA;Lo;0;L;;;;;N;;;;; +1525;CANADIAN SYLLABICS SH;Lo;0;L;;;;;N;;;;; +1526;CANADIAN SYLLABICS YE;Lo;0;L;;;;;N;;;;; +1527;CANADIAN SYLLABICS YAAI;Lo;0;L;;;;;N;;;;; +1528;CANADIAN SYLLABICS YI;Lo;0;L;;;;;N;;;;; +1529;CANADIAN SYLLABICS YII;Lo;0;L;;;;;N;;;;; +152A;CANADIAN SYLLABICS YO;Lo;0;L;;;;;N;;;;; +152B;CANADIAN SYLLABICS YOO;Lo;0;L;;;;;N;;;;; +152C;CANADIAN SYLLABICS Y-CREE YOO;Lo;0;L;;;;;N;;;;; +152D;CANADIAN SYLLABICS YA;Lo;0;L;;;;;N;;;;; +152E;CANADIAN SYLLABICS YAA;Lo;0;L;;;;;N;;;;; +152F;CANADIAN SYLLABICS YWE;Lo;0;L;;;;;N;;;;; +1530;CANADIAN SYLLABICS WEST-CREE YWE;Lo;0;L;;;;;N;;;;; +1531;CANADIAN SYLLABICS YWI;Lo;0;L;;;;;N;;;;; +1532;CANADIAN SYLLABICS WEST-CREE YWI;Lo;0;L;;;;;N;;;;; +1533;CANADIAN SYLLABICS YWII;Lo;0;L;;;;;N;;;;; +1534;CANADIAN SYLLABICS WEST-CREE YWII;Lo;0;L;;;;;N;;;;; +1535;CANADIAN SYLLABICS YWO;Lo;0;L;;;;;N;;;;; +1536;CANADIAN SYLLABICS WEST-CREE YWO;Lo;0;L;;;;;N;;;;; +1537;CANADIAN SYLLABICS YWOO;Lo;0;L;;;;;N;;;;; +1538;CANADIAN SYLLABICS WEST-CREE YWOO;Lo;0;L;;;;;N;;;;; +1539;CANADIAN SYLLABICS YWA;Lo;0;L;;;;;N;;;;; +153A;CANADIAN SYLLABICS WEST-CREE YWA;Lo;0;L;;;;;N;;;;; +153B;CANADIAN SYLLABICS YWAA;Lo;0;L;;;;;N;;;;; +153C;CANADIAN SYLLABICS WEST-CREE YWAA;Lo;0;L;;;;;N;;;;; +153D;CANADIAN SYLLABICS NASKAPI YWAA;Lo;0;L;;;;;N;;;;; +153E;CANADIAN SYLLABICS Y;Lo;0;L;;;;;N;;;;; +153F;CANADIAN SYLLABICS BIBLE-CREE Y;Lo;0;L;;;;;N;;;;; +1540;CANADIAN SYLLABICS WEST-CREE Y;Lo;0;L;;;;;N;;;;; +1541;CANADIAN SYLLABICS SAYISI YI;Lo;0;L;;;;;N;;;;; +1542;CANADIAN SYLLABICS RE;Lo;0;L;;;;;N;;;;; +1543;CANADIAN SYLLABICS R-CREE RE;Lo;0;L;;;;;N;;;;; +1544;CANADIAN SYLLABICS WEST-CREE LE;Lo;0;L;;;;;N;;;;; +1545;CANADIAN SYLLABICS RAAI;Lo;0;L;;;;;N;;;;; +1546;CANADIAN SYLLABICS RI;Lo;0;L;;;;;N;;;;; +1547;CANADIAN SYLLABICS RII;Lo;0;L;;;;;N;;;;; +1548;CANADIAN SYLLABICS RO;Lo;0;L;;;;;N;;;;; +1549;CANADIAN SYLLABICS ROO;Lo;0;L;;;;;N;;;;; +154A;CANADIAN SYLLABICS WEST-CREE LO;Lo;0;L;;;;;N;;;;; +154B;CANADIAN SYLLABICS RA;Lo;0;L;;;;;N;;;;; +154C;CANADIAN SYLLABICS RAA;Lo;0;L;;;;;N;;;;; +154D;CANADIAN SYLLABICS WEST-CREE LA;Lo;0;L;;;;;N;;;;; +154E;CANADIAN SYLLABICS RWAA;Lo;0;L;;;;;N;;;;; +154F;CANADIAN SYLLABICS WEST-CREE RWAA;Lo;0;L;;;;;N;;;;; +1550;CANADIAN SYLLABICS R;Lo;0;L;;;;;N;;;;; +1551;CANADIAN SYLLABICS WEST-CREE R;Lo;0;L;;;;;N;;;;; +1552;CANADIAN SYLLABICS MEDIAL R;Lo;0;L;;;;;N;;;;; +1553;CANADIAN SYLLABICS FE;Lo;0;L;;;;;N;;;;; +1554;CANADIAN SYLLABICS FAAI;Lo;0;L;;;;;N;;;;; +1555;CANADIAN SYLLABICS FI;Lo;0;L;;;;;N;;;;; +1556;CANADIAN SYLLABICS FII;Lo;0;L;;;;;N;;;;; +1557;CANADIAN SYLLABICS FO;Lo;0;L;;;;;N;;;;; +1558;CANADIAN SYLLABICS FOO;Lo;0;L;;;;;N;;;;; +1559;CANADIAN SYLLABICS FA;Lo;0;L;;;;;N;;;;; +155A;CANADIAN SYLLABICS FAA;Lo;0;L;;;;;N;;;;; +155B;CANADIAN SYLLABICS FWAA;Lo;0;L;;;;;N;;;;; +155C;CANADIAN SYLLABICS WEST-CREE FWAA;Lo;0;L;;;;;N;;;;; +155D;CANADIAN SYLLABICS F;Lo;0;L;;;;;N;;;;; +155E;CANADIAN SYLLABICS THE;Lo;0;L;;;;;N;;;;; +155F;CANADIAN SYLLABICS N-CREE THE;Lo;0;L;;;;;N;;;;; +1560;CANADIAN SYLLABICS THI;Lo;0;L;;;;;N;;;;; +1561;CANADIAN SYLLABICS N-CREE THI;Lo;0;L;;;;;N;;;;; +1562;CANADIAN SYLLABICS THII;Lo;0;L;;;;;N;;;;; +1563;CANADIAN SYLLABICS N-CREE THII;Lo;0;L;;;;;N;;;;; +1564;CANADIAN SYLLABICS THO;Lo;0;L;;;;;N;;;;; +1565;CANADIAN SYLLABICS THOO;Lo;0;L;;;;;N;;;;; +1566;CANADIAN SYLLABICS THA;Lo;0;L;;;;;N;;;;; +1567;CANADIAN SYLLABICS THAA;Lo;0;L;;;;;N;;;;; +1568;CANADIAN SYLLABICS THWAA;Lo;0;L;;;;;N;;;;; +1569;CANADIAN SYLLABICS WEST-CREE THWAA;Lo;0;L;;;;;N;;;;; +156A;CANADIAN SYLLABICS TH;Lo;0;L;;;;;N;;;;; +156B;CANADIAN SYLLABICS TTHE;Lo;0;L;;;;;N;;;;; +156C;CANADIAN SYLLABICS TTHI;Lo;0;L;;;;;N;;;;; +156D;CANADIAN SYLLABICS TTHO;Lo;0;L;;;;;N;;;;; +156E;CANADIAN SYLLABICS TTHA;Lo;0;L;;;;;N;;;;; +156F;CANADIAN SYLLABICS TTH;Lo;0;L;;;;;N;;;;; +1570;CANADIAN SYLLABICS TYE;Lo;0;L;;;;;N;;;;; +1571;CANADIAN SYLLABICS TYI;Lo;0;L;;;;;N;;;;; +1572;CANADIAN SYLLABICS TYO;Lo;0;L;;;;;N;;;;; +1573;CANADIAN SYLLABICS TYA;Lo;0;L;;;;;N;;;;; +1574;CANADIAN SYLLABICS NUNAVIK HE;Lo;0;L;;;;;N;;;;; +1575;CANADIAN SYLLABICS NUNAVIK HI;Lo;0;L;;;;;N;;;;; +1576;CANADIAN SYLLABICS NUNAVIK HII;Lo;0;L;;;;;N;;;;; +1577;CANADIAN SYLLABICS NUNAVIK HO;Lo;0;L;;;;;N;;;;; +1578;CANADIAN SYLLABICS NUNAVIK HOO;Lo;0;L;;;;;N;;;;; +1579;CANADIAN SYLLABICS NUNAVIK HA;Lo;0;L;;;;;N;;;;; +157A;CANADIAN SYLLABICS NUNAVIK HAA;Lo;0;L;;;;;N;;;;; +157B;CANADIAN SYLLABICS NUNAVIK H;Lo;0;L;;;;;N;;;;; +157C;CANADIAN SYLLABICS NUNAVUT H;Lo;0;L;;;;;N;;;;; +157D;CANADIAN SYLLABICS HK;Lo;0;L;;;;;N;;;;; +157E;CANADIAN SYLLABICS QAAI;Lo;0;L;;;;;N;;;;; +157F;CANADIAN SYLLABICS QI;Lo;0;L;;;;;N;;;;; +1580;CANADIAN SYLLABICS QII;Lo;0;L;;;;;N;;;;; +1581;CANADIAN SYLLABICS QO;Lo;0;L;;;;;N;;;;; +1582;CANADIAN SYLLABICS QOO;Lo;0;L;;;;;N;;;;; +1583;CANADIAN SYLLABICS QA;Lo;0;L;;;;;N;;;;; +1584;CANADIAN SYLLABICS QAA;Lo;0;L;;;;;N;;;;; +1585;CANADIAN SYLLABICS Q;Lo;0;L;;;;;N;;;;; +1586;CANADIAN SYLLABICS TLHE;Lo;0;L;;;;;N;;;;; +1587;CANADIAN SYLLABICS TLHI;Lo;0;L;;;;;N;;;;; +1588;CANADIAN SYLLABICS TLHO;Lo;0;L;;;;;N;;;;; +1589;CANADIAN SYLLABICS TLHA;Lo;0;L;;;;;N;;;;; +158A;CANADIAN SYLLABICS WEST-CREE RE;Lo;0;L;;;;;N;;;;; +158B;CANADIAN SYLLABICS WEST-CREE RI;Lo;0;L;;;;;N;;;;; +158C;CANADIAN SYLLABICS WEST-CREE RO;Lo;0;L;;;;;N;;;;; +158D;CANADIAN SYLLABICS WEST-CREE RA;Lo;0;L;;;;;N;;;;; +158E;CANADIAN SYLLABICS NGAAI;Lo;0;L;;;;;N;;;;; +158F;CANADIAN SYLLABICS NGI;Lo;0;L;;;;;N;;;;; +1590;CANADIAN SYLLABICS NGII;Lo;0;L;;;;;N;;;;; +1591;CANADIAN SYLLABICS NGO;Lo;0;L;;;;;N;;;;; +1592;CANADIAN SYLLABICS NGOO;Lo;0;L;;;;;N;;;;; +1593;CANADIAN SYLLABICS NGA;Lo;0;L;;;;;N;;;;; +1594;CANADIAN SYLLABICS NGAA;Lo;0;L;;;;;N;;;;; +1595;CANADIAN SYLLABICS NG;Lo;0;L;;;;;N;;;;; +1596;CANADIAN SYLLABICS NNG;Lo;0;L;;;;;N;;;;; +1597;CANADIAN SYLLABICS SAYISI SHE;Lo;0;L;;;;;N;;;;; +1598;CANADIAN SYLLABICS SAYISI SHI;Lo;0;L;;;;;N;;;;; +1599;CANADIAN SYLLABICS SAYISI SHO;Lo;0;L;;;;;N;;;;; +159A;CANADIAN SYLLABICS SAYISI SHA;Lo;0;L;;;;;N;;;;; +159B;CANADIAN SYLLABICS WOODS-CREE THE;Lo;0;L;;;;;N;;;;; +159C;CANADIAN SYLLABICS WOODS-CREE THI;Lo;0;L;;;;;N;;;;; +159D;CANADIAN SYLLABICS WOODS-CREE THO;Lo;0;L;;;;;N;;;;; +159E;CANADIAN SYLLABICS WOODS-CREE THA;Lo;0;L;;;;;N;;;;; +159F;CANADIAN SYLLABICS WOODS-CREE TH;Lo;0;L;;;;;N;;;;; +15A0;CANADIAN SYLLABICS LHI;Lo;0;L;;;;;N;;;;; +15A1;CANADIAN SYLLABICS LHII;Lo;0;L;;;;;N;;;;; +15A2;CANADIAN SYLLABICS LHO;Lo;0;L;;;;;N;;;;; +15A3;CANADIAN SYLLABICS LHOO;Lo;0;L;;;;;N;;;;; +15A4;CANADIAN SYLLABICS LHA;Lo;0;L;;;;;N;;;;; +15A5;CANADIAN SYLLABICS LHAA;Lo;0;L;;;;;N;;;;; +15A6;CANADIAN SYLLABICS LH;Lo;0;L;;;;;N;;;;; +15A7;CANADIAN SYLLABICS TH-CREE THE;Lo;0;L;;;;;N;;;;; +15A8;CANADIAN SYLLABICS TH-CREE THI;Lo;0;L;;;;;N;;;;; +15A9;CANADIAN SYLLABICS TH-CREE THII;Lo;0;L;;;;;N;;;;; +15AA;CANADIAN SYLLABICS TH-CREE THO;Lo;0;L;;;;;N;;;;; +15AB;CANADIAN SYLLABICS TH-CREE THOO;Lo;0;L;;;;;N;;;;; +15AC;CANADIAN SYLLABICS TH-CREE THA;Lo;0;L;;;;;N;;;;; +15AD;CANADIAN SYLLABICS TH-CREE THAA;Lo;0;L;;;;;N;;;;; +15AE;CANADIAN SYLLABICS TH-CREE TH;Lo;0;L;;;;;N;;;;; +15AF;CANADIAN SYLLABICS AIVILIK B;Lo;0;L;;;;;N;;;;; +15B0;CANADIAN SYLLABICS BLACKFOOT E;Lo;0;L;;;;;N;;;;; +15B1;CANADIAN SYLLABICS BLACKFOOT I;Lo;0;L;;;;;N;;;;; +15B2;CANADIAN SYLLABICS BLACKFOOT O;Lo;0;L;;;;;N;;;;; +15B3;CANADIAN SYLLABICS BLACKFOOT A;Lo;0;L;;;;;N;;;;; +15B4;CANADIAN SYLLABICS BLACKFOOT WE;Lo;0;L;;;;;N;;;;; +15B5;CANADIAN SYLLABICS BLACKFOOT WI;Lo;0;L;;;;;N;;;;; +15B6;CANADIAN SYLLABICS BLACKFOOT WO;Lo;0;L;;;;;N;;;;; +15B7;CANADIAN SYLLABICS BLACKFOOT WA;Lo;0;L;;;;;N;;;;; +15B8;CANADIAN SYLLABICS BLACKFOOT NE;Lo;0;L;;;;;N;;;;; +15B9;CANADIAN SYLLABICS BLACKFOOT NI;Lo;0;L;;;;;N;;;;; +15BA;CANADIAN SYLLABICS BLACKFOOT NO;Lo;0;L;;;;;N;;;;; +15BB;CANADIAN SYLLABICS BLACKFOOT NA;Lo;0;L;;;;;N;;;;; +15BC;CANADIAN SYLLABICS BLACKFOOT KE;Lo;0;L;;;;;N;;;;; +15BD;CANADIAN SYLLABICS BLACKFOOT KI;Lo;0;L;;;;;N;;;;; +15BE;CANADIAN SYLLABICS BLACKFOOT KO;Lo;0;L;;;;;N;;;;; +15BF;CANADIAN SYLLABICS BLACKFOOT KA;Lo;0;L;;;;;N;;;;; +15C0;CANADIAN SYLLABICS SAYISI HE;Lo;0;L;;;;;N;;;;; +15C1;CANADIAN SYLLABICS SAYISI HI;Lo;0;L;;;;;N;;;;; +15C2;CANADIAN SYLLABICS SAYISI HO;Lo;0;L;;;;;N;;;;; +15C3;CANADIAN SYLLABICS SAYISI HA;Lo;0;L;;;;;N;;;;; +15C4;CANADIAN SYLLABICS CARRIER GHU;Lo;0;L;;;;;N;;;;; +15C5;CANADIAN SYLLABICS CARRIER GHO;Lo;0;L;;;;;N;;;;; +15C6;CANADIAN SYLLABICS CARRIER GHE;Lo;0;L;;;;;N;;;;; +15C7;CANADIAN SYLLABICS CARRIER GHEE;Lo;0;L;;;;;N;;;;; +15C8;CANADIAN SYLLABICS CARRIER GHI;Lo;0;L;;;;;N;;;;; +15C9;CANADIAN SYLLABICS CARRIER GHA;Lo;0;L;;;;;N;;;;; +15CA;CANADIAN SYLLABICS CARRIER RU;Lo;0;L;;;;;N;;;;; +15CB;CANADIAN SYLLABICS CARRIER RO;Lo;0;L;;;;;N;;;;; +15CC;CANADIAN SYLLABICS CARRIER RE;Lo;0;L;;;;;N;;;;; +15CD;CANADIAN SYLLABICS CARRIER REE;Lo;0;L;;;;;N;;;;; +15CE;CANADIAN SYLLABICS CARRIER RI;Lo;0;L;;;;;N;;;;; +15CF;CANADIAN SYLLABICS CARRIER RA;Lo;0;L;;;;;N;;;;; +15D0;CANADIAN SYLLABICS CARRIER WU;Lo;0;L;;;;;N;;;;; +15D1;CANADIAN SYLLABICS CARRIER WO;Lo;0;L;;;;;N;;;;; +15D2;CANADIAN SYLLABICS CARRIER WE;Lo;0;L;;;;;N;;;;; +15D3;CANADIAN SYLLABICS CARRIER WEE;Lo;0;L;;;;;N;;;;; +15D4;CANADIAN SYLLABICS CARRIER WI;Lo;0;L;;;;;N;;;;; +15D5;CANADIAN SYLLABICS CARRIER WA;Lo;0;L;;;;;N;;;;; +15D6;CANADIAN SYLLABICS CARRIER HWU;Lo;0;L;;;;;N;;;;; +15D7;CANADIAN SYLLABICS CARRIER HWO;Lo;0;L;;;;;N;;;;; +15D8;CANADIAN SYLLABICS CARRIER HWE;Lo;0;L;;;;;N;;;;; +15D9;CANADIAN SYLLABICS CARRIER HWEE;Lo;0;L;;;;;N;;;;; +15DA;CANADIAN SYLLABICS CARRIER HWI;Lo;0;L;;;;;N;;;;; +15DB;CANADIAN SYLLABICS CARRIER HWA;Lo;0;L;;;;;N;;;;; +15DC;CANADIAN SYLLABICS CARRIER THU;Lo;0;L;;;;;N;;;;; +15DD;CANADIAN SYLLABICS CARRIER THO;Lo;0;L;;;;;N;;;;; +15DE;CANADIAN SYLLABICS CARRIER THE;Lo;0;L;;;;;N;;;;; +15DF;CANADIAN SYLLABICS CARRIER THEE;Lo;0;L;;;;;N;;;;; +15E0;CANADIAN SYLLABICS CARRIER THI;Lo;0;L;;;;;N;;;;; +15E1;CANADIAN SYLLABICS CARRIER THA;Lo;0;L;;;;;N;;;;; +15E2;CANADIAN SYLLABICS CARRIER TTU;Lo;0;L;;;;;N;;;;; +15E3;CANADIAN SYLLABICS CARRIER TTO;Lo;0;L;;;;;N;;;;; +15E4;CANADIAN SYLLABICS CARRIER TTE;Lo;0;L;;;;;N;;;;; +15E5;CANADIAN SYLLABICS CARRIER TTEE;Lo;0;L;;;;;N;;;;; +15E6;CANADIAN SYLLABICS CARRIER TTI;Lo;0;L;;;;;N;;;;; +15E7;CANADIAN SYLLABICS CARRIER TTA;Lo;0;L;;;;;N;;;;; +15E8;CANADIAN SYLLABICS CARRIER PU;Lo;0;L;;;;;N;;;;; +15E9;CANADIAN SYLLABICS CARRIER PO;Lo;0;L;;;;;N;;;;; +15EA;CANADIAN SYLLABICS CARRIER PE;Lo;0;L;;;;;N;;;;; +15EB;CANADIAN SYLLABICS CARRIER PEE;Lo;0;L;;;;;N;;;;; +15EC;CANADIAN SYLLABICS CARRIER PI;Lo;0;L;;;;;N;;;;; +15ED;CANADIAN SYLLABICS CARRIER PA;Lo;0;L;;;;;N;;;;; +15EE;CANADIAN SYLLABICS CARRIER P;Lo;0;L;;;;;N;;;;; +15EF;CANADIAN SYLLABICS CARRIER GU;Lo;0;L;;;;;N;;;;; +15F0;CANADIAN SYLLABICS CARRIER GO;Lo;0;L;;;;;N;;;;; +15F1;CANADIAN SYLLABICS CARRIER GE;Lo;0;L;;;;;N;;;;; +15F2;CANADIAN SYLLABICS CARRIER GEE;Lo;0;L;;;;;N;;;;; +15F3;CANADIAN SYLLABICS CARRIER GI;Lo;0;L;;;;;N;;;;; +15F4;CANADIAN SYLLABICS CARRIER GA;Lo;0;L;;;;;N;;;;; +15F5;CANADIAN SYLLABICS CARRIER KHU;Lo;0;L;;;;;N;;;;; +15F6;CANADIAN SYLLABICS CARRIER KHO;Lo;0;L;;;;;N;;;;; +15F7;CANADIAN SYLLABICS CARRIER KHE;Lo;0;L;;;;;N;;;;; +15F8;CANADIAN SYLLABICS CARRIER KHEE;Lo;0;L;;;;;N;;;;; +15F9;CANADIAN SYLLABICS CARRIER KHI;Lo;0;L;;;;;N;;;;; +15FA;CANADIAN SYLLABICS CARRIER KHA;Lo;0;L;;;;;N;;;;; +15FB;CANADIAN SYLLABICS CARRIER KKU;Lo;0;L;;;;;N;;;;; +15FC;CANADIAN SYLLABICS CARRIER KKO;Lo;0;L;;;;;N;;;;; +15FD;CANADIAN SYLLABICS CARRIER KKE;Lo;0;L;;;;;N;;;;; +15FE;CANADIAN SYLLABICS CARRIER KKEE;Lo;0;L;;;;;N;;;;; +15FF;CANADIAN SYLLABICS CARRIER KKI;Lo;0;L;;;;;N;;;;; +1600;CANADIAN SYLLABICS CARRIER KKA;Lo;0;L;;;;;N;;;;; +1601;CANADIAN SYLLABICS CARRIER KK;Lo;0;L;;;;;N;;;;; +1602;CANADIAN SYLLABICS CARRIER NU;Lo;0;L;;;;;N;;;;; +1603;CANADIAN SYLLABICS CARRIER NO;Lo;0;L;;;;;N;;;;; +1604;CANADIAN SYLLABICS CARRIER NE;Lo;0;L;;;;;N;;;;; +1605;CANADIAN SYLLABICS CARRIER NEE;Lo;0;L;;;;;N;;;;; +1606;CANADIAN SYLLABICS CARRIER NI;Lo;0;L;;;;;N;;;;; +1607;CANADIAN SYLLABICS CARRIER NA;Lo;0;L;;;;;N;;;;; +1608;CANADIAN SYLLABICS CARRIER MU;Lo;0;L;;;;;N;;;;; +1609;CANADIAN SYLLABICS CARRIER MO;Lo;0;L;;;;;N;;;;; +160A;CANADIAN SYLLABICS CARRIER ME;Lo;0;L;;;;;N;;;;; +160B;CANADIAN SYLLABICS CARRIER MEE;Lo;0;L;;;;;N;;;;; +160C;CANADIAN SYLLABICS CARRIER MI;Lo;0;L;;;;;N;;;;; +160D;CANADIAN SYLLABICS CARRIER MA;Lo;0;L;;;;;N;;;;; +160E;CANADIAN SYLLABICS CARRIER YU;Lo;0;L;;;;;N;;;;; +160F;CANADIAN SYLLABICS CARRIER YO;Lo;0;L;;;;;N;;;;; +1610;CANADIAN SYLLABICS CARRIER YE;Lo;0;L;;;;;N;;;;; +1611;CANADIAN SYLLABICS CARRIER YEE;Lo;0;L;;;;;N;;;;; +1612;CANADIAN SYLLABICS CARRIER YI;Lo;0;L;;;;;N;;;;; +1613;CANADIAN SYLLABICS CARRIER YA;Lo;0;L;;;;;N;;;;; +1614;CANADIAN SYLLABICS CARRIER JU;Lo;0;L;;;;;N;;;;; +1615;CANADIAN SYLLABICS SAYISI JU;Lo;0;L;;;;;N;;;;; +1616;CANADIAN SYLLABICS CARRIER JO;Lo;0;L;;;;;N;;;;; +1617;CANADIAN SYLLABICS CARRIER JE;Lo;0;L;;;;;N;;;;; +1618;CANADIAN SYLLABICS CARRIER JEE;Lo;0;L;;;;;N;;;;; +1619;CANADIAN SYLLABICS CARRIER JI;Lo;0;L;;;;;N;;;;; +161A;CANADIAN SYLLABICS SAYISI JI;Lo;0;L;;;;;N;;;;; +161B;CANADIAN SYLLABICS CARRIER JA;Lo;0;L;;;;;N;;;;; +161C;CANADIAN SYLLABICS CARRIER JJU;Lo;0;L;;;;;N;;;;; +161D;CANADIAN SYLLABICS CARRIER JJO;Lo;0;L;;;;;N;;;;; +161E;CANADIAN SYLLABICS CARRIER JJE;Lo;0;L;;;;;N;;;;; +161F;CANADIAN SYLLABICS CARRIER JJEE;Lo;0;L;;;;;N;;;;; +1620;CANADIAN SYLLABICS CARRIER JJI;Lo;0;L;;;;;N;;;;; +1621;CANADIAN SYLLABICS CARRIER JJA;Lo;0;L;;;;;N;;;;; +1622;CANADIAN SYLLABICS CARRIER LU;Lo;0;L;;;;;N;;;;; +1623;CANADIAN SYLLABICS CARRIER LO;Lo;0;L;;;;;N;;;;; +1624;CANADIAN SYLLABICS CARRIER LE;Lo;0;L;;;;;N;;;;; +1625;CANADIAN SYLLABICS CARRIER LEE;Lo;0;L;;;;;N;;;;; +1626;CANADIAN SYLLABICS CARRIER LI;Lo;0;L;;;;;N;;;;; +1627;CANADIAN SYLLABICS CARRIER LA;Lo;0;L;;;;;N;;;;; +1628;CANADIAN SYLLABICS CARRIER DLU;Lo;0;L;;;;;N;;;;; +1629;CANADIAN SYLLABICS CARRIER DLO;Lo;0;L;;;;;N;;;;; +162A;CANADIAN SYLLABICS CARRIER DLE;Lo;0;L;;;;;N;;;;; +162B;CANADIAN SYLLABICS CARRIER DLEE;Lo;0;L;;;;;N;;;;; +162C;CANADIAN SYLLABICS CARRIER DLI;Lo;0;L;;;;;N;;;;; +162D;CANADIAN SYLLABICS CARRIER DLA;Lo;0;L;;;;;N;;;;; +162E;CANADIAN SYLLABICS CARRIER LHU;Lo;0;L;;;;;N;;;;; +162F;CANADIAN SYLLABICS CARRIER LHO;Lo;0;L;;;;;N;;;;; +1630;CANADIAN SYLLABICS CARRIER LHE;Lo;0;L;;;;;N;;;;; +1631;CANADIAN SYLLABICS CARRIER LHEE;Lo;0;L;;;;;N;;;;; +1632;CANADIAN SYLLABICS CARRIER LHI;Lo;0;L;;;;;N;;;;; +1633;CANADIAN SYLLABICS CARRIER LHA;Lo;0;L;;;;;N;;;;; +1634;CANADIAN SYLLABICS CARRIER TLHU;Lo;0;L;;;;;N;;;;; +1635;CANADIAN SYLLABICS CARRIER TLHO;Lo;0;L;;;;;N;;;;; +1636;CANADIAN SYLLABICS CARRIER TLHE;Lo;0;L;;;;;N;;;;; +1637;CANADIAN SYLLABICS CARRIER TLHEE;Lo;0;L;;;;;N;;;;; +1638;CANADIAN SYLLABICS CARRIER TLHI;Lo;0;L;;;;;N;;;;; +1639;CANADIAN SYLLABICS CARRIER TLHA;Lo;0;L;;;;;N;;;;; +163A;CANADIAN SYLLABICS CARRIER TLU;Lo;0;L;;;;;N;;;;; +163B;CANADIAN SYLLABICS CARRIER TLO;Lo;0;L;;;;;N;;;;; +163C;CANADIAN SYLLABICS CARRIER TLE;Lo;0;L;;;;;N;;;;; +163D;CANADIAN SYLLABICS CARRIER TLEE;Lo;0;L;;;;;N;;;;; +163E;CANADIAN SYLLABICS CARRIER TLI;Lo;0;L;;;;;N;;;;; +163F;CANADIAN SYLLABICS CARRIER TLA;Lo;0;L;;;;;N;;;;; +1640;CANADIAN SYLLABICS CARRIER ZU;Lo;0;L;;;;;N;;;;; +1641;CANADIAN SYLLABICS CARRIER ZO;Lo;0;L;;;;;N;;;;; +1642;CANADIAN SYLLABICS CARRIER ZE;Lo;0;L;;;;;N;;;;; +1643;CANADIAN SYLLABICS CARRIER ZEE;Lo;0;L;;;;;N;;;;; +1644;CANADIAN SYLLABICS CARRIER ZI;Lo;0;L;;;;;N;;;;; +1645;CANADIAN SYLLABICS CARRIER ZA;Lo;0;L;;;;;N;;;;; +1646;CANADIAN SYLLABICS CARRIER Z;Lo;0;L;;;;;N;;;;; +1647;CANADIAN SYLLABICS CARRIER INITIAL Z;Lo;0;L;;;;;N;;;;; +1648;CANADIAN SYLLABICS CARRIER DZU;Lo;0;L;;;;;N;;;;; +1649;CANADIAN SYLLABICS CARRIER DZO;Lo;0;L;;;;;N;;;;; +164A;CANADIAN SYLLABICS CARRIER DZE;Lo;0;L;;;;;N;;;;; +164B;CANADIAN SYLLABICS CARRIER DZEE;Lo;0;L;;;;;N;;;;; +164C;CANADIAN SYLLABICS CARRIER DZI;Lo;0;L;;;;;N;;;;; +164D;CANADIAN SYLLABICS CARRIER DZA;Lo;0;L;;;;;N;;;;; +164E;CANADIAN SYLLABICS CARRIER SU;Lo;0;L;;;;;N;;;;; +164F;CANADIAN SYLLABICS CARRIER SO;Lo;0;L;;;;;N;;;;; +1650;CANADIAN SYLLABICS CARRIER SE;Lo;0;L;;;;;N;;;;; +1651;CANADIAN SYLLABICS CARRIER SEE;Lo;0;L;;;;;N;;;;; +1652;CANADIAN SYLLABICS CARRIER SI;Lo;0;L;;;;;N;;;;; +1653;CANADIAN SYLLABICS CARRIER SA;Lo;0;L;;;;;N;;;;; +1654;CANADIAN SYLLABICS CARRIER SHU;Lo;0;L;;;;;N;;;;; +1655;CANADIAN SYLLABICS CARRIER SHO;Lo;0;L;;;;;N;;;;; +1656;CANADIAN SYLLABICS CARRIER SHE;Lo;0;L;;;;;N;;;;; +1657;CANADIAN SYLLABICS CARRIER SHEE;Lo;0;L;;;;;N;;;;; +1658;CANADIAN SYLLABICS CARRIER SHI;Lo;0;L;;;;;N;;;;; +1659;CANADIAN SYLLABICS CARRIER SHA;Lo;0;L;;;;;N;;;;; +165A;CANADIAN SYLLABICS CARRIER SH;Lo;0;L;;;;;N;;;;; +165B;CANADIAN SYLLABICS CARRIER TSU;Lo;0;L;;;;;N;;;;; +165C;CANADIAN SYLLABICS CARRIER TSO;Lo;0;L;;;;;N;;;;; +165D;CANADIAN SYLLABICS CARRIER TSE;Lo;0;L;;;;;N;;;;; +165E;CANADIAN SYLLABICS CARRIER TSEE;Lo;0;L;;;;;N;;;;; +165F;CANADIAN SYLLABICS CARRIER TSI;Lo;0;L;;;;;N;;;;; +1660;CANADIAN SYLLABICS CARRIER TSA;Lo;0;L;;;;;N;;;;; +1661;CANADIAN SYLLABICS CARRIER CHU;Lo;0;L;;;;;N;;;;; +1662;CANADIAN SYLLABICS CARRIER CHO;Lo;0;L;;;;;N;;;;; +1663;CANADIAN SYLLABICS CARRIER CHE;Lo;0;L;;;;;N;;;;; +1664;CANADIAN SYLLABICS CARRIER CHEE;Lo;0;L;;;;;N;;;;; +1665;CANADIAN SYLLABICS CARRIER CHI;Lo;0;L;;;;;N;;;;; +1666;CANADIAN SYLLABICS CARRIER CHA;Lo;0;L;;;;;N;;;;; +1667;CANADIAN SYLLABICS CARRIER TTSU;Lo;0;L;;;;;N;;;;; +1668;CANADIAN SYLLABICS CARRIER TTSO;Lo;0;L;;;;;N;;;;; +1669;CANADIAN SYLLABICS CARRIER TTSE;Lo;0;L;;;;;N;;;;; +166A;CANADIAN SYLLABICS CARRIER TTSEE;Lo;0;L;;;;;N;;;;; +166B;CANADIAN SYLLABICS CARRIER TTSI;Lo;0;L;;;;;N;;;;; +166C;CANADIAN SYLLABICS CARRIER TTSA;Lo;0;L;;;;;N;;;;; +166D;CANADIAN SYLLABICS CHI SIGN;Po;0;L;;;;;N;;;;; +166E;CANADIAN SYLLABICS FULL STOP;Po;0;L;;;;;N;;;;; +166F;CANADIAN SYLLABICS QAI;Lo;0;L;;;;;N;;;;; +1670;CANADIAN SYLLABICS NGAI;Lo;0;L;;;;;N;;;;; +1671;CANADIAN SYLLABICS NNGI;Lo;0;L;;;;;N;;;;; +1672;CANADIAN SYLLABICS NNGII;Lo;0;L;;;;;N;;;;; +1673;CANADIAN SYLLABICS NNGO;Lo;0;L;;;;;N;;;;; +1674;CANADIAN SYLLABICS NNGOO;Lo;0;L;;;;;N;;;;; +1675;CANADIAN SYLLABICS NNGA;Lo;0;L;;;;;N;;;;; +1676;CANADIAN SYLLABICS NNGAA;Lo;0;L;;;;;N;;;;; +1677;CANADIAN SYLLABICS WOODS-CREE THWEE;Lo;0;L;;;;;N;;;;; +1678;CANADIAN SYLLABICS WOODS-CREE THWI;Lo;0;L;;;;;N;;;;; +1679;CANADIAN SYLLABICS WOODS-CREE THWII;Lo;0;L;;;;;N;;;;; +167A;CANADIAN SYLLABICS WOODS-CREE THWO;Lo;0;L;;;;;N;;;;; +167B;CANADIAN SYLLABICS WOODS-CREE THWOO;Lo;0;L;;;;;N;;;;; +167C;CANADIAN SYLLABICS WOODS-CREE THWA;Lo;0;L;;;;;N;;;;; +167D;CANADIAN SYLLABICS WOODS-CREE THWAA;Lo;0;L;;;;;N;;;;; +167E;CANADIAN SYLLABICS WOODS-CREE FINAL TH;Lo;0;L;;;;;N;;;;; +167F;CANADIAN SYLLABICS BLACKFOOT W;Lo;0;L;;;;;N;;;;; +1680;OGHAM SPACE MARK;Zs;0;WS;;;;;N;;;;; +1681;OGHAM LETTER BEITH;Lo;0;L;;;;;N;;;;; +1682;OGHAM LETTER LUIS;Lo;0;L;;;;;N;;;;; +1683;OGHAM LETTER FEARN;Lo;0;L;;;;;N;;;;; +1684;OGHAM LETTER SAIL;Lo;0;L;;;;;N;;;;; +1685;OGHAM LETTER NION;Lo;0;L;;;;;N;;;;; +1686;OGHAM LETTER UATH;Lo;0;L;;;;;N;;;;; +1687;OGHAM LETTER DAIR;Lo;0;L;;;;;N;;;;; +1688;OGHAM LETTER TINNE;Lo;0;L;;;;;N;;;;; +1689;OGHAM LETTER COLL;Lo;0;L;;;;;N;;;;; +168A;OGHAM LETTER CEIRT;Lo;0;L;;;;;N;;;;; +168B;OGHAM LETTER MUIN;Lo;0;L;;;;;N;;;;; +168C;OGHAM LETTER GORT;Lo;0;L;;;;;N;;;;; +168D;OGHAM LETTER NGEADAL;Lo;0;L;;;;;N;;;;; +168E;OGHAM LETTER STRAIF;Lo;0;L;;;;;N;;;;; +168F;OGHAM LETTER RUIS;Lo;0;L;;;;;N;;;;; +1690;OGHAM LETTER AILM;Lo;0;L;;;;;N;;;;; +1691;OGHAM LETTER ONN;Lo;0;L;;;;;N;;;;; +1692;OGHAM LETTER UR;Lo;0;L;;;;;N;;;;; +1693;OGHAM LETTER EADHADH;Lo;0;L;;;;;N;;;;; +1694;OGHAM LETTER IODHADH;Lo;0;L;;;;;N;;;;; +1695;OGHAM LETTER EABHADH;Lo;0;L;;;;;N;;;;; +1696;OGHAM LETTER OR;Lo;0;L;;;;;N;;;;; +1697;OGHAM LETTER UILLEANN;Lo;0;L;;;;;N;;;;; +1698;OGHAM LETTER IFIN;Lo;0;L;;;;;N;;;;; +1699;OGHAM LETTER EAMHANCHOLL;Lo;0;L;;;;;N;;;;; +169A;OGHAM LETTER PEITH;Lo;0;L;;;;;N;;;;; +169B;OGHAM FEATHER MARK;Ps;0;ON;;;;;Y;;;;; +169C;OGHAM REVERSED FEATHER MARK;Pe;0;ON;;;;;Y;;;;; +16A0;RUNIC LETTER FEHU FEOH FE F;Lo;0;L;;;;;N;;;;; +16A1;RUNIC LETTER V;Lo;0;L;;;;;N;;;;; +16A2;RUNIC LETTER URUZ UR U;Lo;0;L;;;;;N;;;;; +16A3;RUNIC LETTER YR;Lo;0;L;;;;;N;;;;; +16A4;RUNIC LETTER Y;Lo;0;L;;;;;N;;;;; +16A5;RUNIC LETTER W;Lo;0;L;;;;;N;;;;; +16A6;RUNIC LETTER THURISAZ THURS THORN;Lo;0;L;;;;;N;;;;; +16A7;RUNIC LETTER ETH;Lo;0;L;;;;;N;;;;; +16A8;RUNIC LETTER ANSUZ A;Lo;0;L;;;;;N;;;;; +16A9;RUNIC LETTER OS O;Lo;0;L;;;;;N;;;;; +16AA;RUNIC LETTER AC A;Lo;0;L;;;;;N;;;;; +16AB;RUNIC LETTER AESC;Lo;0;L;;;;;N;;;;; +16AC;RUNIC LETTER LONG-BRANCH-OSS O;Lo;0;L;;;;;N;;;;; +16AD;RUNIC LETTER SHORT-TWIG-OSS O;Lo;0;L;;;;;N;;;;; +16AE;RUNIC LETTER O;Lo;0;L;;;;;N;;;;; +16AF;RUNIC LETTER OE;Lo;0;L;;;;;N;;;;; +16B0;RUNIC LETTER ON;Lo;0;L;;;;;N;;;;; +16B1;RUNIC LETTER RAIDO RAD REID R;Lo;0;L;;;;;N;;;;; +16B2;RUNIC LETTER KAUNA;Lo;0;L;;;;;N;;;;; +16B3;RUNIC LETTER CEN;Lo;0;L;;;;;N;;;;; +16B4;RUNIC LETTER KAUN K;Lo;0;L;;;;;N;;;;; +16B5;RUNIC LETTER G;Lo;0;L;;;;;N;;;;; +16B6;RUNIC LETTER ENG;Lo;0;L;;;;;N;;;;; +16B7;RUNIC LETTER GEBO GYFU G;Lo;0;L;;;;;N;;;;; +16B8;RUNIC LETTER GAR;Lo;0;L;;;;;N;;;;; +16B9;RUNIC LETTER WUNJO WYNN W;Lo;0;L;;;;;N;;;;; +16BA;RUNIC LETTER HAGLAZ H;Lo;0;L;;;;;N;;;;; +16BB;RUNIC LETTER HAEGL H;Lo;0;L;;;;;N;;;;; +16BC;RUNIC LETTER LONG-BRANCH-HAGALL H;Lo;0;L;;;;;N;;;;; +16BD;RUNIC LETTER SHORT-TWIG-HAGALL H;Lo;0;L;;;;;N;;;;; +16BE;RUNIC LETTER NAUDIZ NYD NAUD N;Lo;0;L;;;;;N;;;;; +16BF;RUNIC LETTER SHORT-TWIG-NAUD N;Lo;0;L;;;;;N;;;;; +16C0;RUNIC LETTER DOTTED-N;Lo;0;L;;;;;N;;;;; +16C1;RUNIC LETTER ISAZ IS ISS I;Lo;0;L;;;;;N;;;;; +16C2;RUNIC LETTER E;Lo;0;L;;;;;N;;;;; +16C3;RUNIC LETTER JERAN J;Lo;0;L;;;;;N;;;;; +16C4;RUNIC LETTER GER;Lo;0;L;;;;;N;;;;; +16C5;RUNIC LETTER LONG-BRANCH-AR AE;Lo;0;L;;;;;N;;;;; +16C6;RUNIC LETTER SHORT-TWIG-AR A;Lo;0;L;;;;;N;;;;; +16C7;RUNIC LETTER IWAZ EOH;Lo;0;L;;;;;N;;;;; +16C8;RUNIC LETTER PERTHO PEORTH P;Lo;0;L;;;;;N;;;;; +16C9;RUNIC LETTER ALGIZ EOLHX;Lo;0;L;;;;;N;;;;; +16CA;RUNIC LETTER SOWILO S;Lo;0;L;;;;;N;;;;; +16CB;RUNIC LETTER SIGEL LONG-BRANCH-SOL S;Lo;0;L;;;;;N;;;;; +16CC;RUNIC LETTER SHORT-TWIG-SOL S;Lo;0;L;;;;;N;;;;; +16CD;RUNIC LETTER C;Lo;0;L;;;;;N;;;;; +16CE;RUNIC LETTER Z;Lo;0;L;;;;;N;;;;; +16CF;RUNIC LETTER TIWAZ TIR TYR T;Lo;0;L;;;;;N;;;;; +16D0;RUNIC LETTER SHORT-TWIG-TYR T;Lo;0;L;;;;;N;;;;; +16D1;RUNIC LETTER D;Lo;0;L;;;;;N;;;;; +16D2;RUNIC LETTER BERKANAN BEORC BJARKAN B;Lo;0;L;;;;;N;;;;; +16D3;RUNIC LETTER SHORT-TWIG-BJARKAN B;Lo;0;L;;;;;N;;;;; +16D4;RUNIC LETTER DOTTED-P;Lo;0;L;;;;;N;;;;; +16D5;RUNIC LETTER OPEN-P;Lo;0;L;;;;;N;;;;; +16D6;RUNIC LETTER EHWAZ EH E;Lo;0;L;;;;;N;;;;; +16D7;RUNIC LETTER MANNAZ MAN M;Lo;0;L;;;;;N;;;;; +16D8;RUNIC LETTER LONG-BRANCH-MADR M;Lo;0;L;;;;;N;;;;; +16D9;RUNIC LETTER SHORT-TWIG-MADR M;Lo;0;L;;;;;N;;;;; +16DA;RUNIC LETTER LAUKAZ LAGU LOGR L;Lo;0;L;;;;;N;;;;; +16DB;RUNIC LETTER DOTTED-L;Lo;0;L;;;;;N;;;;; +16DC;RUNIC LETTER INGWAZ;Lo;0;L;;;;;N;;;;; +16DD;RUNIC LETTER ING;Lo;0;L;;;;;N;;;;; +16DE;RUNIC LETTER DAGAZ DAEG D;Lo;0;L;;;;;N;;;;; +16DF;RUNIC LETTER OTHALAN ETHEL O;Lo;0;L;;;;;N;;;;; +16E0;RUNIC LETTER EAR;Lo;0;L;;;;;N;;;;; +16E1;RUNIC LETTER IOR;Lo;0;L;;;;;N;;;;; +16E2;RUNIC LETTER CWEORTH;Lo;0;L;;;;;N;;;;; +16E3;RUNIC LETTER CALC;Lo;0;L;;;;;N;;;;; +16E4;RUNIC LETTER CEALC;Lo;0;L;;;;;N;;;;; +16E5;RUNIC LETTER STAN;Lo;0;L;;;;;N;;;;; +16E6;RUNIC LETTER LONG-BRANCH-YR;Lo;0;L;;;;;N;;;;; +16E7;RUNIC LETTER SHORT-TWIG-YR;Lo;0;L;;;;;N;;;;; +16E8;RUNIC LETTER ICELANDIC-YR;Lo;0;L;;;;;N;;;;; +16E9;RUNIC LETTER Q;Lo;0;L;;;;;N;;;;; +16EA;RUNIC LETTER X;Lo;0;L;;;;;N;;;;; +16EB;RUNIC SINGLE PUNCTUATION;Po;0;L;;;;;N;;;;; +16EC;RUNIC MULTIPLE PUNCTUATION;Po;0;L;;;;;N;;;;; +16ED;RUNIC CROSS PUNCTUATION;Po;0;L;;;;;N;;;;; +16EE;RUNIC ARLAUG SYMBOL;Nl;0;L;;;;17;N;;;;; +16EF;RUNIC TVIMADUR SYMBOL;Nl;0;L;;;;18;N;;;;; +16F0;RUNIC BELGTHOR SYMBOL;Nl;0;L;;;;19;N;;;;; +16F1;RUNIC LETTER K;Lo;0;L;;;;;N;;;;; +16F2;RUNIC LETTER SH;Lo;0;L;;;;;N;;;;; +16F3;RUNIC LETTER OO;Lo;0;L;;;;;N;;;;; +16F4;RUNIC LETTER FRANKS CASKET OS;Lo;0;L;;;;;N;;;;; +16F5;RUNIC LETTER FRANKS CASKET IS;Lo;0;L;;;;;N;;;;; +16F6;RUNIC LETTER FRANKS CASKET EH;Lo;0;L;;;;;N;;;;; +16F7;RUNIC LETTER FRANKS CASKET AC;Lo;0;L;;;;;N;;;;; +16F8;RUNIC LETTER FRANKS CASKET AESC;Lo;0;L;;;;;N;;;;; +1700;TAGALOG LETTER A;Lo;0;L;;;;;N;;;;; +1701;TAGALOG LETTER I;Lo;0;L;;;;;N;;;;; +1702;TAGALOG LETTER U;Lo;0;L;;;;;N;;;;; +1703;TAGALOG LETTER KA;Lo;0;L;;;;;N;;;;; +1704;TAGALOG LETTER GA;Lo;0;L;;;;;N;;;;; +1705;TAGALOG LETTER NGA;Lo;0;L;;;;;N;;;;; +1706;TAGALOG LETTER TA;Lo;0;L;;;;;N;;;;; +1707;TAGALOG LETTER DA;Lo;0;L;;;;;N;;;;; +1708;TAGALOG LETTER NA;Lo;0;L;;;;;N;;;;; +1709;TAGALOG LETTER PA;Lo;0;L;;;;;N;;;;; +170A;TAGALOG LETTER BA;Lo;0;L;;;;;N;;;;; +170B;TAGALOG LETTER MA;Lo;0;L;;;;;N;;;;; +170C;TAGALOG LETTER YA;Lo;0;L;;;;;N;;;;; +170E;TAGALOG LETTER LA;Lo;0;L;;;;;N;;;;; +170F;TAGALOG LETTER WA;Lo;0;L;;;;;N;;;;; +1710;TAGALOG LETTER SA;Lo;0;L;;;;;N;;;;; +1711;TAGALOG LETTER HA;Lo;0;L;;;;;N;;;;; +1712;TAGALOG VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1713;TAGALOG VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1714;TAGALOG SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +1720;HANUNOO LETTER A;Lo;0;L;;;;;N;;;;; +1721;HANUNOO LETTER I;Lo;0;L;;;;;N;;;;; +1722;HANUNOO LETTER U;Lo;0;L;;;;;N;;;;; +1723;HANUNOO LETTER KA;Lo;0;L;;;;;N;;;;; +1724;HANUNOO LETTER GA;Lo;0;L;;;;;N;;;;; +1725;HANUNOO LETTER NGA;Lo;0;L;;;;;N;;;;; +1726;HANUNOO LETTER TA;Lo;0;L;;;;;N;;;;; +1727;HANUNOO LETTER DA;Lo;0;L;;;;;N;;;;; +1728;HANUNOO LETTER NA;Lo;0;L;;;;;N;;;;; +1729;HANUNOO LETTER PA;Lo;0;L;;;;;N;;;;; +172A;HANUNOO LETTER BA;Lo;0;L;;;;;N;;;;; +172B;HANUNOO LETTER MA;Lo;0;L;;;;;N;;;;; +172C;HANUNOO LETTER YA;Lo;0;L;;;;;N;;;;; +172D;HANUNOO LETTER RA;Lo;0;L;;;;;N;;;;; +172E;HANUNOO LETTER LA;Lo;0;L;;;;;N;;;;; +172F;HANUNOO LETTER WA;Lo;0;L;;;;;N;;;;; +1730;HANUNOO LETTER SA;Lo;0;L;;;;;N;;;;; +1731;HANUNOO LETTER HA;Lo;0;L;;;;;N;;;;; +1732;HANUNOO VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1733;HANUNOO VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1734;HANUNOO SIGN PAMUDPOD;Mn;9;NSM;;;;;N;;;;; +1735;PHILIPPINE SINGLE PUNCTUATION;Po;0;L;;;;;N;;;;; +1736;PHILIPPINE DOUBLE PUNCTUATION;Po;0;L;;;;;N;;;;; +1740;BUHID LETTER A;Lo;0;L;;;;;N;;;;; +1741;BUHID LETTER I;Lo;0;L;;;;;N;;;;; +1742;BUHID LETTER U;Lo;0;L;;;;;N;;;;; +1743;BUHID LETTER KA;Lo;0;L;;;;;N;;;;; +1744;BUHID LETTER GA;Lo;0;L;;;;;N;;;;; +1745;BUHID LETTER NGA;Lo;0;L;;;;;N;;;;; +1746;BUHID LETTER TA;Lo;0;L;;;;;N;;;;; +1747;BUHID LETTER DA;Lo;0;L;;;;;N;;;;; +1748;BUHID LETTER NA;Lo;0;L;;;;;N;;;;; +1749;BUHID LETTER PA;Lo;0;L;;;;;N;;;;; +174A;BUHID LETTER BA;Lo;0;L;;;;;N;;;;; +174B;BUHID LETTER MA;Lo;0;L;;;;;N;;;;; +174C;BUHID LETTER YA;Lo;0;L;;;;;N;;;;; +174D;BUHID LETTER RA;Lo;0;L;;;;;N;;;;; +174E;BUHID LETTER LA;Lo;0;L;;;;;N;;;;; +174F;BUHID LETTER WA;Lo;0;L;;;;;N;;;;; +1750;BUHID LETTER SA;Lo;0;L;;;;;N;;;;; +1751;BUHID LETTER HA;Lo;0;L;;;;;N;;;;; +1752;BUHID VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1753;BUHID VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1760;TAGBANWA LETTER A;Lo;0;L;;;;;N;;;;; +1761;TAGBANWA LETTER I;Lo;0;L;;;;;N;;;;; +1762;TAGBANWA LETTER U;Lo;0;L;;;;;N;;;;; +1763;TAGBANWA LETTER KA;Lo;0;L;;;;;N;;;;; +1764;TAGBANWA LETTER GA;Lo;0;L;;;;;N;;;;; +1765;TAGBANWA LETTER NGA;Lo;0;L;;;;;N;;;;; +1766;TAGBANWA LETTER TA;Lo;0;L;;;;;N;;;;; +1767;TAGBANWA LETTER DA;Lo;0;L;;;;;N;;;;; +1768;TAGBANWA LETTER NA;Lo;0;L;;;;;N;;;;; +1769;TAGBANWA LETTER PA;Lo;0;L;;;;;N;;;;; +176A;TAGBANWA LETTER BA;Lo;0;L;;;;;N;;;;; +176B;TAGBANWA LETTER MA;Lo;0;L;;;;;N;;;;; +176C;TAGBANWA LETTER YA;Lo;0;L;;;;;N;;;;; +176E;TAGBANWA LETTER LA;Lo;0;L;;;;;N;;;;; +176F;TAGBANWA LETTER WA;Lo;0;L;;;;;N;;;;; +1770;TAGBANWA LETTER SA;Lo;0;L;;;;;N;;;;; +1772;TAGBANWA VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1773;TAGBANWA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1780;KHMER LETTER KA;Lo;0;L;;;;;N;;;;; +1781;KHMER LETTER KHA;Lo;0;L;;;;;N;;;;; +1782;KHMER LETTER KO;Lo;0;L;;;;;N;;;;; +1783;KHMER LETTER KHO;Lo;0;L;;;;;N;;;;; +1784;KHMER LETTER NGO;Lo;0;L;;;;;N;;;;; +1785;KHMER LETTER CA;Lo;0;L;;;;;N;;;;; +1786;KHMER LETTER CHA;Lo;0;L;;;;;N;;;;; +1787;KHMER LETTER CO;Lo;0;L;;;;;N;;;;; +1788;KHMER LETTER CHO;Lo;0;L;;;;;N;;;;; +1789;KHMER LETTER NYO;Lo;0;L;;;;;N;;;;; +178A;KHMER LETTER DA;Lo;0;L;;;;;N;;;;; +178B;KHMER LETTER TTHA;Lo;0;L;;;;;N;;;;; +178C;KHMER LETTER DO;Lo;0;L;;;;;N;;;;; +178D;KHMER LETTER TTHO;Lo;0;L;;;;;N;;;;; +178E;KHMER LETTER NNO;Lo;0;L;;;;;N;;;;; +178F;KHMER LETTER TA;Lo;0;L;;;;;N;;;;; +1790;KHMER LETTER THA;Lo;0;L;;;;;N;;;;; +1791;KHMER LETTER TO;Lo;0;L;;;;;N;;;;; +1792;KHMER LETTER THO;Lo;0;L;;;;;N;;;;; +1793;KHMER LETTER NO;Lo;0;L;;;;;N;;;;; +1794;KHMER LETTER BA;Lo;0;L;;;;;N;;;;; +1795;KHMER LETTER PHA;Lo;0;L;;;;;N;;;;; +1796;KHMER LETTER PO;Lo;0;L;;;;;N;;;;; +1797;KHMER LETTER PHO;Lo;0;L;;;;;N;;;;; +1798;KHMER LETTER MO;Lo;0;L;;;;;N;;;;; +1799;KHMER LETTER YO;Lo;0;L;;;;;N;;;;; +179A;KHMER LETTER RO;Lo;0;L;;;;;N;;;;; +179B;KHMER LETTER LO;Lo;0;L;;;;;N;;;;; +179C;KHMER LETTER VO;Lo;0;L;;;;;N;;;;; +179D;KHMER LETTER SHA;Lo;0;L;;;;;N;;;;; +179E;KHMER LETTER SSO;Lo;0;L;;;;;N;;;;; +179F;KHMER LETTER SA;Lo;0;L;;;;;N;;;;; +17A0;KHMER LETTER HA;Lo;0;L;;;;;N;;;;; +17A1;KHMER LETTER LA;Lo;0;L;;;;;N;;;;; +17A2;KHMER LETTER QA;Lo;0;L;;;;;N;;;;; +17A3;KHMER INDEPENDENT VOWEL QAQ;Lo;0;L;;;;;N;;;;; +17A4;KHMER INDEPENDENT VOWEL QAA;Lo;0;L;;;;;N;;;;; +17A5;KHMER INDEPENDENT VOWEL QI;Lo;0;L;;;;;N;;;;; +17A6;KHMER INDEPENDENT VOWEL QII;Lo;0;L;;;;;N;;;;; +17A7;KHMER INDEPENDENT VOWEL QU;Lo;0;L;;;;;N;;;;; +17A8;KHMER INDEPENDENT VOWEL QUK;Lo;0;L;;;;;N;;;;; +17A9;KHMER INDEPENDENT VOWEL QUU;Lo;0;L;;;;;N;;;;; +17AA;KHMER INDEPENDENT VOWEL QUUV;Lo;0;L;;;;;N;;;;; +17AB;KHMER INDEPENDENT VOWEL RY;Lo;0;L;;;;;N;;;;; +17AC;KHMER INDEPENDENT VOWEL RYY;Lo;0;L;;;;;N;;;;; +17AD;KHMER INDEPENDENT VOWEL LY;Lo;0;L;;;;;N;;;;; +17AE;KHMER INDEPENDENT VOWEL LYY;Lo;0;L;;;;;N;;;;; +17AF;KHMER INDEPENDENT VOWEL QE;Lo;0;L;;;;;N;;;;; +17B0;KHMER INDEPENDENT VOWEL QAI;Lo;0;L;;;;;N;;;;; +17B1;KHMER INDEPENDENT VOWEL QOO TYPE ONE;Lo;0;L;;;;;N;;;;; +17B2;KHMER INDEPENDENT VOWEL QOO TYPE TWO;Lo;0;L;;;;;N;;;;; +17B3;KHMER INDEPENDENT VOWEL QAU;Lo;0;L;;;;;N;;;;; +17B4;KHMER VOWEL INHERENT AQ;Mn;0;NSM;;;;;N;;;;; +17B5;KHMER VOWEL INHERENT AA;Mn;0;NSM;;;;;N;;;;; +17B6;KHMER VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +17B7;KHMER VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +17B8;KHMER VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +17B9;KHMER VOWEL SIGN Y;Mn;0;NSM;;;;;N;;;;; +17BA;KHMER VOWEL SIGN YY;Mn;0;NSM;;;;;N;;;;; +17BB;KHMER VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +17BC;KHMER VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +17BD;KHMER VOWEL SIGN UA;Mn;0;NSM;;;;;N;;;;; +17BE;KHMER VOWEL SIGN OE;Mc;0;L;;;;;N;;;;; +17BF;KHMER VOWEL SIGN YA;Mc;0;L;;;;;N;;;;; +17C0;KHMER VOWEL SIGN IE;Mc;0;L;;;;;N;;;;; +17C1;KHMER VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +17C2;KHMER VOWEL SIGN AE;Mc;0;L;;;;;N;;;;; +17C3;KHMER VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +17C4;KHMER VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +17C5;KHMER VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +17C6;KHMER SIGN NIKAHIT;Mn;0;NSM;;;;;N;;;;; +17C7;KHMER SIGN REAHMUK;Mc;0;L;;;;;N;;;;; +17C8;KHMER SIGN YUUKALEAPINTU;Mc;0;L;;;;;N;;;;; +17C9;KHMER SIGN MUUSIKATOAN;Mn;0;NSM;;;;;N;;;;; +17CA;KHMER SIGN TRIISAP;Mn;0;NSM;;;;;N;;;;; +17CB;KHMER SIGN BANTOC;Mn;0;NSM;;;;;N;;;;; +17CC;KHMER SIGN ROBAT;Mn;0;NSM;;;;;N;;;;; +17CD;KHMER SIGN TOANDAKHIAT;Mn;0;NSM;;;;;N;;;;; +17CE;KHMER SIGN KAKABAT;Mn;0;NSM;;;;;N;;;;; +17CF;KHMER SIGN AHSDA;Mn;0;NSM;;;;;N;;;;; +17D0;KHMER SIGN SAMYOK SANNYA;Mn;0;NSM;;;;;N;;;;; +17D1;KHMER SIGN VIRIAM;Mn;0;NSM;;;;;N;;;;; +17D2;KHMER SIGN COENG;Mn;9;NSM;;;;;N;;;;; +17D3;KHMER SIGN BATHAMASAT;Mn;0;NSM;;;;;N;;;;; +17D4;KHMER SIGN KHAN;Po;0;L;;;;;N;;;;; +17D5;KHMER SIGN BARIYOOSAN;Po;0;L;;;;;N;;;;; +17D6;KHMER SIGN CAMNUC PII KUUH;Po;0;L;;;;;N;;;;; +17D7;KHMER SIGN LEK TOO;Lm;0;L;;;;;N;;;;; +17D8;KHMER SIGN BEYYAL;Po;0;L;;;;;N;;;;; +17D9;KHMER SIGN PHNAEK MUAN;Po;0;L;;;;;N;;;;; +17DA;KHMER SIGN KOOMUUT;Po;0;L;;;;;N;;;;; +17DB;KHMER CURRENCY SYMBOL RIEL;Sc;0;ET;;;;;N;;;;; +17DC;KHMER SIGN AVAKRAHASANYA;Lo;0;L;;;;;N;;;;; +17DD;KHMER SIGN ATTHACAN;Mn;230;NSM;;;;;N;;;;; +17E0;KHMER DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +17E1;KHMER DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +17E2;KHMER DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +17E3;KHMER DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +17E4;KHMER DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +17E5;KHMER DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +17E6;KHMER DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +17E7;KHMER DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +17E8;KHMER DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +17E9;KHMER DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +17F0;KHMER SYMBOL LEK ATTAK SON;No;0;ON;;;;0;N;;;;; +17F1;KHMER SYMBOL LEK ATTAK MUOY;No;0;ON;;;;1;N;;;;; +17F2;KHMER SYMBOL LEK ATTAK PII;No;0;ON;;;;2;N;;;;; +17F3;KHMER SYMBOL LEK ATTAK BEI;No;0;ON;;;;3;N;;;;; +17F4;KHMER SYMBOL LEK ATTAK BUON;No;0;ON;;;;4;N;;;;; +17F5;KHMER SYMBOL LEK ATTAK PRAM;No;0;ON;;;;5;N;;;;; +17F6;KHMER SYMBOL LEK ATTAK PRAM-MUOY;No;0;ON;;;;6;N;;;;; +17F7;KHMER SYMBOL LEK ATTAK PRAM-PII;No;0;ON;;;;7;N;;;;; +17F8;KHMER SYMBOL LEK ATTAK PRAM-BEI;No;0;ON;;;;8;N;;;;; +17F9;KHMER SYMBOL LEK ATTAK PRAM-BUON;No;0;ON;;;;9;N;;;;; +1800;MONGOLIAN BIRGA;Po;0;ON;;;;;N;;;;; +1801;MONGOLIAN ELLIPSIS;Po;0;ON;;;;;N;;;;; +1802;MONGOLIAN COMMA;Po;0;ON;;;;;N;;;;; +1803;MONGOLIAN FULL STOP;Po;0;ON;;;;;N;;;;; +1804;MONGOLIAN COLON;Po;0;ON;;;;;N;;;;; +1805;MONGOLIAN FOUR DOTS;Po;0;ON;;;;;N;;;;; +1806;MONGOLIAN TODO SOFT HYPHEN;Pd;0;ON;;;;;N;;;;; +1807;MONGOLIAN SIBE SYLLABLE BOUNDARY MARKER;Po;0;ON;;;;;N;;;;; +1808;MONGOLIAN MANCHU COMMA;Po;0;ON;;;;;N;;;;; +1809;MONGOLIAN MANCHU FULL STOP;Po;0;ON;;;;;N;;;;; +180A;MONGOLIAN NIRUGU;Po;0;ON;;;;;N;;;;; +180B;MONGOLIAN FREE VARIATION SELECTOR ONE;Mn;0;NSM;;;;;N;;;;; +180C;MONGOLIAN FREE VARIATION SELECTOR TWO;Mn;0;NSM;;;;;N;;;;; +180D;MONGOLIAN FREE VARIATION SELECTOR THREE;Mn;0;NSM;;;;;N;;;;; +180E;MONGOLIAN VOWEL SEPARATOR;Cf;0;BN;;;;;N;;;;; +1810;MONGOLIAN DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1811;MONGOLIAN DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1812;MONGOLIAN DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1813;MONGOLIAN DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1814;MONGOLIAN DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1815;MONGOLIAN DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1816;MONGOLIAN DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1817;MONGOLIAN DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1818;MONGOLIAN DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1819;MONGOLIAN DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1820;MONGOLIAN LETTER A;Lo;0;L;;;;;N;;;;; +1821;MONGOLIAN LETTER E;Lo;0;L;;;;;N;;;;; +1822;MONGOLIAN LETTER I;Lo;0;L;;;;;N;;;;; +1823;MONGOLIAN LETTER O;Lo;0;L;;;;;N;;;;; +1824;MONGOLIAN LETTER U;Lo;0;L;;;;;N;;;;; +1825;MONGOLIAN LETTER OE;Lo;0;L;;;;;N;;;;; +1826;MONGOLIAN LETTER UE;Lo;0;L;;;;;N;;;;; +1827;MONGOLIAN LETTER EE;Lo;0;L;;;;;N;;;;; +1828;MONGOLIAN LETTER NA;Lo;0;L;;;;;N;;;;; +1829;MONGOLIAN LETTER ANG;Lo;0;L;;;;;N;;;;; +182A;MONGOLIAN LETTER BA;Lo;0;L;;;;;N;;;;; +182B;MONGOLIAN LETTER PA;Lo;0;L;;;;;N;;;;; +182C;MONGOLIAN LETTER QA;Lo;0;L;;;;;N;;;;; +182D;MONGOLIAN LETTER GA;Lo;0;L;;;;;N;;;;; +182E;MONGOLIAN LETTER MA;Lo;0;L;;;;;N;;;;; +182F;MONGOLIAN LETTER LA;Lo;0;L;;;;;N;;;;; +1830;MONGOLIAN LETTER SA;Lo;0;L;;;;;N;;;;; +1831;MONGOLIAN LETTER SHA;Lo;0;L;;;;;N;;;;; +1832;MONGOLIAN LETTER TA;Lo;0;L;;;;;N;;;;; +1833;MONGOLIAN LETTER DA;Lo;0;L;;;;;N;;;;; +1834;MONGOLIAN LETTER CHA;Lo;0;L;;;;;N;;;;; +1835;MONGOLIAN LETTER JA;Lo;0;L;;;;;N;;;;; +1836;MONGOLIAN LETTER YA;Lo;0;L;;;;;N;;;;; +1837;MONGOLIAN LETTER RA;Lo;0;L;;;;;N;;;;; +1838;MONGOLIAN LETTER WA;Lo;0;L;;;;;N;;;;; +1839;MONGOLIAN LETTER FA;Lo;0;L;;;;;N;;;;; +183A;MONGOLIAN LETTER KA;Lo;0;L;;;;;N;;;;; +183B;MONGOLIAN LETTER KHA;Lo;0;L;;;;;N;;;;; +183C;MONGOLIAN LETTER TSA;Lo;0;L;;;;;N;;;;; +183D;MONGOLIAN LETTER ZA;Lo;0;L;;;;;N;;;;; +183E;MONGOLIAN LETTER HAA;Lo;0;L;;;;;N;;;;; +183F;MONGOLIAN LETTER ZRA;Lo;0;L;;;;;N;;;;; +1840;MONGOLIAN LETTER LHA;Lo;0;L;;;;;N;;;;; +1841;MONGOLIAN LETTER ZHI;Lo;0;L;;;;;N;;;;; +1842;MONGOLIAN LETTER CHI;Lo;0;L;;;;;N;;;;; +1843;MONGOLIAN LETTER TODO LONG VOWEL SIGN;Lm;0;L;;;;;N;;;;; +1844;MONGOLIAN LETTER TODO E;Lo;0;L;;;;;N;;;;; +1845;MONGOLIAN LETTER TODO I;Lo;0;L;;;;;N;;;;; +1846;MONGOLIAN LETTER TODO O;Lo;0;L;;;;;N;;;;; +1847;MONGOLIAN LETTER TODO U;Lo;0;L;;;;;N;;;;; +1848;MONGOLIAN LETTER TODO OE;Lo;0;L;;;;;N;;;;; +1849;MONGOLIAN LETTER TODO UE;Lo;0;L;;;;;N;;;;; +184A;MONGOLIAN LETTER TODO ANG;Lo;0;L;;;;;N;;;;; +184B;MONGOLIAN LETTER TODO BA;Lo;0;L;;;;;N;;;;; +184C;MONGOLIAN LETTER TODO PA;Lo;0;L;;;;;N;;;;; +184D;MONGOLIAN LETTER TODO QA;Lo;0;L;;;;;N;;;;; +184E;MONGOLIAN LETTER TODO GA;Lo;0;L;;;;;N;;;;; +184F;MONGOLIAN LETTER TODO MA;Lo;0;L;;;;;N;;;;; +1850;MONGOLIAN LETTER TODO TA;Lo;0;L;;;;;N;;;;; +1851;MONGOLIAN LETTER TODO DA;Lo;0;L;;;;;N;;;;; +1852;MONGOLIAN LETTER TODO CHA;Lo;0;L;;;;;N;;;;; +1853;MONGOLIAN LETTER TODO JA;Lo;0;L;;;;;N;;;;; +1854;MONGOLIAN LETTER TODO TSA;Lo;0;L;;;;;N;;;;; +1855;MONGOLIAN LETTER TODO YA;Lo;0;L;;;;;N;;;;; +1856;MONGOLIAN LETTER TODO WA;Lo;0;L;;;;;N;;;;; +1857;MONGOLIAN LETTER TODO KA;Lo;0;L;;;;;N;;;;; +1858;MONGOLIAN LETTER TODO GAA;Lo;0;L;;;;;N;;;;; +1859;MONGOLIAN LETTER TODO HAA;Lo;0;L;;;;;N;;;;; +185A;MONGOLIAN LETTER TODO JIA;Lo;0;L;;;;;N;;;;; +185B;MONGOLIAN LETTER TODO NIA;Lo;0;L;;;;;N;;;;; +185C;MONGOLIAN LETTER TODO DZA;Lo;0;L;;;;;N;;;;; +185D;MONGOLIAN LETTER SIBE E;Lo;0;L;;;;;N;;;;; +185E;MONGOLIAN LETTER SIBE I;Lo;0;L;;;;;N;;;;; +185F;MONGOLIAN LETTER SIBE IY;Lo;0;L;;;;;N;;;;; +1860;MONGOLIAN LETTER SIBE UE;Lo;0;L;;;;;N;;;;; +1861;MONGOLIAN LETTER SIBE U;Lo;0;L;;;;;N;;;;; +1862;MONGOLIAN LETTER SIBE ANG;Lo;0;L;;;;;N;;;;; +1863;MONGOLIAN LETTER SIBE KA;Lo;0;L;;;;;N;;;;; +1864;MONGOLIAN LETTER SIBE GA;Lo;0;L;;;;;N;;;;; +1865;MONGOLIAN LETTER SIBE HA;Lo;0;L;;;;;N;;;;; +1866;MONGOLIAN LETTER SIBE PA;Lo;0;L;;;;;N;;;;; +1867;MONGOLIAN LETTER SIBE SHA;Lo;0;L;;;;;N;;;;; +1868;MONGOLIAN LETTER SIBE TA;Lo;0;L;;;;;N;;;;; +1869;MONGOLIAN LETTER SIBE DA;Lo;0;L;;;;;N;;;;; +186A;MONGOLIAN LETTER SIBE JA;Lo;0;L;;;;;N;;;;; +186B;MONGOLIAN LETTER SIBE FA;Lo;0;L;;;;;N;;;;; +186C;MONGOLIAN LETTER SIBE GAA;Lo;0;L;;;;;N;;;;; +186D;MONGOLIAN LETTER SIBE HAA;Lo;0;L;;;;;N;;;;; +186E;MONGOLIAN LETTER SIBE TSA;Lo;0;L;;;;;N;;;;; +186F;MONGOLIAN LETTER SIBE ZA;Lo;0;L;;;;;N;;;;; +1870;MONGOLIAN LETTER SIBE RAA;Lo;0;L;;;;;N;;;;; +1871;MONGOLIAN LETTER SIBE CHA;Lo;0;L;;;;;N;;;;; +1872;MONGOLIAN LETTER SIBE ZHA;Lo;0;L;;;;;N;;;;; +1873;MONGOLIAN LETTER MANCHU I;Lo;0;L;;;;;N;;;;; +1874;MONGOLIAN LETTER MANCHU KA;Lo;0;L;;;;;N;;;;; +1875;MONGOLIAN LETTER MANCHU RA;Lo;0;L;;;;;N;;;;; +1876;MONGOLIAN LETTER MANCHU FA;Lo;0;L;;;;;N;;;;; +1877;MONGOLIAN LETTER MANCHU ZHA;Lo;0;L;;;;;N;;;;; +1880;MONGOLIAN LETTER ALI GALI ANUSVARA ONE;Lo;0;L;;;;;N;;;;; +1881;MONGOLIAN LETTER ALI GALI VISARGA ONE;Lo;0;L;;;;;N;;;;; +1882;MONGOLIAN LETTER ALI GALI DAMARU;Lo;0;L;;;;;N;;;;; +1883;MONGOLIAN LETTER ALI GALI UBADAMA;Lo;0;L;;;;;N;;;;; +1884;MONGOLIAN LETTER ALI GALI INVERTED UBADAMA;Lo;0;L;;;;;N;;;;; +1885;MONGOLIAN LETTER ALI GALI BALUDA;Mn;0;NSM;;;;;N;;;;; +1886;MONGOLIAN LETTER ALI GALI THREE BALUDA;Mn;0;NSM;;;;;N;;;;; +1887;MONGOLIAN LETTER ALI GALI A;Lo;0;L;;;;;N;;;;; +1888;MONGOLIAN LETTER ALI GALI I;Lo;0;L;;;;;N;;;;; +1889;MONGOLIAN LETTER ALI GALI KA;Lo;0;L;;;;;N;;;;; +188A;MONGOLIAN LETTER ALI GALI NGA;Lo;0;L;;;;;N;;;;; +188B;MONGOLIAN LETTER ALI GALI CA;Lo;0;L;;;;;N;;;;; +188C;MONGOLIAN LETTER ALI GALI TTA;Lo;0;L;;;;;N;;;;; +188D;MONGOLIAN LETTER ALI GALI TTHA;Lo;0;L;;;;;N;;;;; +188E;MONGOLIAN LETTER ALI GALI DDA;Lo;0;L;;;;;N;;;;; +188F;MONGOLIAN LETTER ALI GALI NNA;Lo;0;L;;;;;N;;;;; +1890;MONGOLIAN LETTER ALI GALI TA;Lo;0;L;;;;;N;;;;; +1891;MONGOLIAN LETTER ALI GALI DA;Lo;0;L;;;;;N;;;;; +1892;MONGOLIAN LETTER ALI GALI PA;Lo;0;L;;;;;N;;;;; +1893;MONGOLIAN LETTER ALI GALI PHA;Lo;0;L;;;;;N;;;;; +1894;MONGOLIAN LETTER ALI GALI SSA;Lo;0;L;;;;;N;;;;; +1895;MONGOLIAN LETTER ALI GALI ZHA;Lo;0;L;;;;;N;;;;; +1896;MONGOLIAN LETTER ALI GALI ZA;Lo;0;L;;;;;N;;;;; +1897;MONGOLIAN LETTER ALI GALI AH;Lo;0;L;;;;;N;;;;; +1898;MONGOLIAN LETTER TODO ALI GALI TA;Lo;0;L;;;;;N;;;;; +1899;MONGOLIAN LETTER TODO ALI GALI ZHA;Lo;0;L;;;;;N;;;;; +189A;MONGOLIAN LETTER MANCHU ALI GALI GHA;Lo;0;L;;;;;N;;;;; +189B;MONGOLIAN LETTER MANCHU ALI GALI NGA;Lo;0;L;;;;;N;;;;; +189C;MONGOLIAN LETTER MANCHU ALI GALI CA;Lo;0;L;;;;;N;;;;; +189D;MONGOLIAN LETTER MANCHU ALI GALI JHA;Lo;0;L;;;;;N;;;;; +189E;MONGOLIAN LETTER MANCHU ALI GALI TTA;Lo;0;L;;;;;N;;;;; +189F;MONGOLIAN LETTER MANCHU ALI GALI DDHA;Lo;0;L;;;;;N;;;;; +18A0;MONGOLIAN LETTER MANCHU ALI GALI TA;Lo;0;L;;;;;N;;;;; +18A1;MONGOLIAN LETTER MANCHU ALI GALI DHA;Lo;0;L;;;;;N;;;;; +18A2;MONGOLIAN LETTER MANCHU ALI GALI SSA;Lo;0;L;;;;;N;;;;; +18A3;MONGOLIAN LETTER MANCHU ALI GALI CYA;Lo;0;L;;;;;N;;;;; +18A4;MONGOLIAN LETTER MANCHU ALI GALI ZHA;Lo;0;L;;;;;N;;;;; +18A5;MONGOLIAN LETTER MANCHU ALI GALI ZA;Lo;0;L;;;;;N;;;;; +18A6;MONGOLIAN LETTER ALI GALI HALF U;Lo;0;L;;;;;N;;;;; +18A7;MONGOLIAN LETTER ALI GALI HALF YA;Lo;0;L;;;;;N;;;;; +18A8;MONGOLIAN LETTER MANCHU ALI GALI BHA;Lo;0;L;;;;;N;;;;; +18A9;MONGOLIAN LETTER ALI GALI DAGALGA;Mn;228;NSM;;;;;N;;;;; +18AA;MONGOLIAN LETTER MANCHU ALI GALI LHA;Lo;0;L;;;;;N;;;;; +18B0;CANADIAN SYLLABICS OY;Lo;0;L;;;;;N;;;;; +18B1;CANADIAN SYLLABICS AY;Lo;0;L;;;;;N;;;;; +18B2;CANADIAN SYLLABICS AAY;Lo;0;L;;;;;N;;;;; +18B3;CANADIAN SYLLABICS WAY;Lo;0;L;;;;;N;;;;; +18B4;CANADIAN SYLLABICS POY;Lo;0;L;;;;;N;;;;; +18B5;CANADIAN SYLLABICS PAY;Lo;0;L;;;;;N;;;;; +18B6;CANADIAN SYLLABICS PWOY;Lo;0;L;;;;;N;;;;; +18B7;CANADIAN SYLLABICS TAY;Lo;0;L;;;;;N;;;;; +18B8;CANADIAN SYLLABICS KAY;Lo;0;L;;;;;N;;;;; +18B9;CANADIAN SYLLABICS KWAY;Lo;0;L;;;;;N;;;;; +18BA;CANADIAN SYLLABICS MAY;Lo;0;L;;;;;N;;;;; +18BB;CANADIAN SYLLABICS NOY;Lo;0;L;;;;;N;;;;; +18BC;CANADIAN SYLLABICS NAY;Lo;0;L;;;;;N;;;;; +18BD;CANADIAN SYLLABICS LAY;Lo;0;L;;;;;N;;;;; +18BE;CANADIAN SYLLABICS SOY;Lo;0;L;;;;;N;;;;; +18BF;CANADIAN SYLLABICS SAY;Lo;0;L;;;;;N;;;;; +18C0;CANADIAN SYLLABICS SHOY;Lo;0;L;;;;;N;;;;; +18C1;CANADIAN SYLLABICS SHAY;Lo;0;L;;;;;N;;;;; +18C2;CANADIAN SYLLABICS SHWOY;Lo;0;L;;;;;N;;;;; +18C3;CANADIAN SYLLABICS YOY;Lo;0;L;;;;;N;;;;; +18C4;CANADIAN SYLLABICS YAY;Lo;0;L;;;;;N;;;;; +18C5;CANADIAN SYLLABICS RAY;Lo;0;L;;;;;N;;;;; +18C6;CANADIAN SYLLABICS NWI;Lo;0;L;;;;;N;;;;; +18C7;CANADIAN SYLLABICS OJIBWAY NWI;Lo;0;L;;;;;N;;;;; +18C8;CANADIAN SYLLABICS NWII;Lo;0;L;;;;;N;;;;; +18C9;CANADIAN SYLLABICS OJIBWAY NWII;Lo;0;L;;;;;N;;;;; +18CA;CANADIAN SYLLABICS NWO;Lo;0;L;;;;;N;;;;; +18CB;CANADIAN SYLLABICS OJIBWAY NWO;Lo;0;L;;;;;N;;;;; +18CC;CANADIAN SYLLABICS NWOO;Lo;0;L;;;;;N;;;;; +18CD;CANADIAN SYLLABICS OJIBWAY NWOO;Lo;0;L;;;;;N;;;;; +18CE;CANADIAN SYLLABICS RWEE;Lo;0;L;;;;;N;;;;; +18CF;CANADIAN SYLLABICS RWI;Lo;0;L;;;;;N;;;;; +18D0;CANADIAN SYLLABICS RWII;Lo;0;L;;;;;N;;;;; +18D1;CANADIAN SYLLABICS RWO;Lo;0;L;;;;;N;;;;; +18D2;CANADIAN SYLLABICS RWOO;Lo;0;L;;;;;N;;;;; +18D3;CANADIAN SYLLABICS RWA;Lo;0;L;;;;;N;;;;; +18D4;CANADIAN SYLLABICS OJIBWAY P;Lo;0;L;;;;;N;;;;; +18D5;CANADIAN SYLLABICS OJIBWAY T;Lo;0;L;;;;;N;;;;; +18D6;CANADIAN SYLLABICS OJIBWAY K;Lo;0;L;;;;;N;;;;; +18D7;CANADIAN SYLLABICS OJIBWAY C;Lo;0;L;;;;;N;;;;; +18D8;CANADIAN SYLLABICS OJIBWAY M;Lo;0;L;;;;;N;;;;; +18D9;CANADIAN SYLLABICS OJIBWAY N;Lo;0;L;;;;;N;;;;; +18DA;CANADIAN SYLLABICS OJIBWAY S;Lo;0;L;;;;;N;;;;; +18DB;CANADIAN SYLLABICS OJIBWAY SH;Lo;0;L;;;;;N;;;;; +18DC;CANADIAN SYLLABICS EASTERN W;Lo;0;L;;;;;N;;;;; +18DD;CANADIAN SYLLABICS WESTERN W;Lo;0;L;;;;;N;;;;; +18DE;CANADIAN SYLLABICS FINAL SMALL RING;Lo;0;L;;;;;N;;;;; +18DF;CANADIAN SYLLABICS FINAL RAISED DOT;Lo;0;L;;;;;N;;;;; +18E0;CANADIAN SYLLABICS R-CREE RWE;Lo;0;L;;;;;N;;;;; +18E1;CANADIAN SYLLABICS WEST-CREE LOO;Lo;0;L;;;;;N;;;;; +18E2;CANADIAN SYLLABICS WEST-CREE LAA;Lo;0;L;;;;;N;;;;; +18E3;CANADIAN SYLLABICS THWE;Lo;0;L;;;;;N;;;;; +18E4;CANADIAN SYLLABICS THWA;Lo;0;L;;;;;N;;;;; +18E5;CANADIAN SYLLABICS TTHWE;Lo;0;L;;;;;N;;;;; +18E6;CANADIAN SYLLABICS TTHOO;Lo;0;L;;;;;N;;;;; +18E7;CANADIAN SYLLABICS TTHAA;Lo;0;L;;;;;N;;;;; +18E8;CANADIAN SYLLABICS TLHWE;Lo;0;L;;;;;N;;;;; +18E9;CANADIAN SYLLABICS TLHOO;Lo;0;L;;;;;N;;;;; +18EA;CANADIAN SYLLABICS SAYISI SHWE;Lo;0;L;;;;;N;;;;; +18EB;CANADIAN SYLLABICS SAYISI SHOO;Lo;0;L;;;;;N;;;;; +18EC;CANADIAN SYLLABICS SAYISI HOO;Lo;0;L;;;;;N;;;;; +18ED;CANADIAN SYLLABICS CARRIER GWU;Lo;0;L;;;;;N;;;;; +18EE;CANADIAN SYLLABICS CARRIER DENE GEE;Lo;0;L;;;;;N;;;;; +18EF;CANADIAN SYLLABICS CARRIER GAA;Lo;0;L;;;;;N;;;;; +18F0;CANADIAN SYLLABICS CARRIER GWA;Lo;0;L;;;;;N;;;;; +18F1;CANADIAN SYLLABICS SAYISI JUU;Lo;0;L;;;;;N;;;;; +18F2;CANADIAN SYLLABICS CARRIER JWA;Lo;0;L;;;;;N;;;;; +18F3;CANADIAN SYLLABICS BEAVER DENE L;Lo;0;L;;;;;N;;;;; +18F4;CANADIAN SYLLABICS BEAVER DENE R;Lo;0;L;;;;;N;;;;; +18F5;CANADIAN SYLLABICS CARRIER DENTAL S;Lo;0;L;;;;;N;;;;; +1900;LIMBU VOWEL-CARRIER LETTER;Lo;0;L;;;;;N;;;;; +1901;LIMBU LETTER KA;Lo;0;L;;;;;N;;;;; +1902;LIMBU LETTER KHA;Lo;0;L;;;;;N;;;;; +1903;LIMBU LETTER GA;Lo;0;L;;;;;N;;;;; +1904;LIMBU LETTER GHA;Lo;0;L;;;;;N;;;;; +1905;LIMBU LETTER NGA;Lo;0;L;;;;;N;;;;; +1906;LIMBU LETTER CA;Lo;0;L;;;;;N;;;;; +1907;LIMBU LETTER CHA;Lo;0;L;;;;;N;;;;; +1908;LIMBU LETTER JA;Lo;0;L;;;;;N;;;;; +1909;LIMBU LETTER JHA;Lo;0;L;;;;;N;;;;; +190A;LIMBU LETTER YAN;Lo;0;L;;;;;N;;;;; +190B;LIMBU LETTER TA;Lo;0;L;;;;;N;;;;; +190C;LIMBU LETTER THA;Lo;0;L;;;;;N;;;;; +190D;LIMBU LETTER DA;Lo;0;L;;;;;N;;;;; +190E;LIMBU LETTER DHA;Lo;0;L;;;;;N;;;;; +190F;LIMBU LETTER NA;Lo;0;L;;;;;N;;;;; +1910;LIMBU LETTER PA;Lo;0;L;;;;;N;;;;; +1911;LIMBU LETTER PHA;Lo;0;L;;;;;N;;;;; +1912;LIMBU LETTER BA;Lo;0;L;;;;;N;;;;; +1913;LIMBU LETTER BHA;Lo;0;L;;;;;N;;;;; +1914;LIMBU LETTER MA;Lo;0;L;;;;;N;;;;; +1915;LIMBU LETTER YA;Lo;0;L;;;;;N;;;;; +1916;LIMBU LETTER RA;Lo;0;L;;;;;N;;;;; +1917;LIMBU LETTER LA;Lo;0;L;;;;;N;;;;; +1918;LIMBU LETTER WA;Lo;0;L;;;;;N;;;;; +1919;LIMBU LETTER SHA;Lo;0;L;;;;;N;;;;; +191A;LIMBU LETTER SSA;Lo;0;L;;;;;N;;;;; +191B;LIMBU LETTER SA;Lo;0;L;;;;;N;;;;; +191C;LIMBU LETTER HA;Lo;0;L;;;;;N;;;;; +191D;LIMBU LETTER GYAN;Lo;0;L;;;;;N;;;;; +191E;LIMBU LETTER TRA;Lo;0;L;;;;;N;;;;; +1920;LIMBU VOWEL SIGN A;Mn;0;NSM;;;;;N;;;;; +1921;LIMBU VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1922;LIMBU VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1923;LIMBU VOWEL SIGN EE;Mc;0;L;;;;;N;;;;; +1924;LIMBU VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +1925;LIMBU VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +1926;LIMBU VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +1927;LIMBU VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +1928;LIMBU VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +1929;LIMBU SUBJOINED LETTER YA;Mc;0;L;;;;;N;;;;; +192A;LIMBU SUBJOINED LETTER RA;Mc;0;L;;;;;N;;;;; +192B;LIMBU SUBJOINED LETTER WA;Mc;0;L;;;;;N;;;;; +1930;LIMBU SMALL LETTER KA;Mc;0;L;;;;;N;;;;; +1931;LIMBU SMALL LETTER NGA;Mc;0;L;;;;;N;;;;; +1932;LIMBU SMALL LETTER ANUSVARA;Mn;0;NSM;;;;;N;;;;; +1933;LIMBU SMALL LETTER TA;Mc;0;L;;;;;N;;;;; +1934;LIMBU SMALL LETTER NA;Mc;0;L;;;;;N;;;;; +1935;LIMBU SMALL LETTER PA;Mc;0;L;;;;;N;;;;; +1936;LIMBU SMALL LETTER MA;Mc;0;L;;;;;N;;;;; +1937;LIMBU SMALL LETTER RA;Mc;0;L;;;;;N;;;;; +1938;LIMBU SMALL LETTER LA;Mc;0;L;;;;;N;;;;; +1939;LIMBU SIGN MUKPHRENG;Mn;222;NSM;;;;;N;;;;; +193A;LIMBU SIGN KEMPHRENG;Mn;230;NSM;;;;;N;;;;; +193B;LIMBU SIGN SA-I;Mn;220;NSM;;;;;N;;;;; +1940;LIMBU SIGN LOO;So;0;ON;;;;;N;;;;; +1944;LIMBU EXCLAMATION MARK;Po;0;ON;;;;;N;;;;; +1945;LIMBU QUESTION MARK;Po;0;ON;;;;;N;;;;; +1946;LIMBU DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1947;LIMBU DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1948;LIMBU DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1949;LIMBU DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +194A;LIMBU DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +194B;LIMBU DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +194C;LIMBU DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +194D;LIMBU DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +194E;LIMBU DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +194F;LIMBU DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1950;TAI LE LETTER KA;Lo;0;L;;;;;N;;;;; +1951;TAI LE LETTER XA;Lo;0;L;;;;;N;;;;; +1952;TAI LE LETTER NGA;Lo;0;L;;;;;N;;;;; +1953;TAI LE LETTER TSA;Lo;0;L;;;;;N;;;;; +1954;TAI LE LETTER SA;Lo;0;L;;;;;N;;;;; +1955;TAI LE LETTER YA;Lo;0;L;;;;;N;;;;; +1956;TAI LE LETTER TA;Lo;0;L;;;;;N;;;;; +1957;TAI LE LETTER THA;Lo;0;L;;;;;N;;;;; +1958;TAI LE LETTER LA;Lo;0;L;;;;;N;;;;; +1959;TAI LE LETTER PA;Lo;0;L;;;;;N;;;;; +195A;TAI LE LETTER PHA;Lo;0;L;;;;;N;;;;; +195B;TAI LE LETTER MA;Lo;0;L;;;;;N;;;;; +195C;TAI LE LETTER FA;Lo;0;L;;;;;N;;;;; +195D;TAI LE LETTER VA;Lo;0;L;;;;;N;;;;; +195E;TAI LE LETTER HA;Lo;0;L;;;;;N;;;;; +195F;TAI LE LETTER QA;Lo;0;L;;;;;N;;;;; +1960;TAI LE LETTER KHA;Lo;0;L;;;;;N;;;;; +1961;TAI LE LETTER TSHA;Lo;0;L;;;;;N;;;;; +1962;TAI LE LETTER NA;Lo;0;L;;;;;N;;;;; +1963;TAI LE LETTER A;Lo;0;L;;;;;N;;;;; +1964;TAI LE LETTER I;Lo;0;L;;;;;N;;;;; +1965;TAI LE LETTER EE;Lo;0;L;;;;;N;;;;; +1966;TAI LE LETTER EH;Lo;0;L;;;;;N;;;;; +1967;TAI LE LETTER U;Lo;0;L;;;;;N;;;;; +1968;TAI LE LETTER OO;Lo;0;L;;;;;N;;;;; +1969;TAI LE LETTER O;Lo;0;L;;;;;N;;;;; +196A;TAI LE LETTER UE;Lo;0;L;;;;;N;;;;; +196B;TAI LE LETTER E;Lo;0;L;;;;;N;;;;; +196C;TAI LE LETTER AUE;Lo;0;L;;;;;N;;;;; +196D;TAI LE LETTER AI;Lo;0;L;;;;;N;;;;; +1970;TAI LE LETTER TONE-2;Lo;0;L;;;;;N;;;;; +1971;TAI LE LETTER TONE-3;Lo;0;L;;;;;N;;;;; +1972;TAI LE LETTER TONE-4;Lo;0;L;;;;;N;;;;; +1973;TAI LE LETTER TONE-5;Lo;0;L;;;;;N;;;;; +1974;TAI LE LETTER TONE-6;Lo;0;L;;;;;N;;;;; +1980;NEW TAI LUE LETTER HIGH QA;Lo;0;L;;;;;N;;;;; +1981;NEW TAI LUE LETTER LOW QA;Lo;0;L;;;;;N;;;;; +1982;NEW TAI LUE LETTER HIGH KA;Lo;0;L;;;;;N;;;;; +1983;NEW TAI LUE LETTER HIGH XA;Lo;0;L;;;;;N;;;;; +1984;NEW TAI LUE LETTER HIGH NGA;Lo;0;L;;;;;N;;;;; +1985;NEW TAI LUE LETTER LOW KA;Lo;0;L;;;;;N;;;;; +1986;NEW TAI LUE LETTER LOW XA;Lo;0;L;;;;;N;;;;; +1987;NEW TAI LUE LETTER LOW NGA;Lo;0;L;;;;;N;;;;; +1988;NEW TAI LUE LETTER HIGH TSA;Lo;0;L;;;;;N;;;;; +1989;NEW TAI LUE LETTER HIGH SA;Lo;0;L;;;;;N;;;;; +198A;NEW TAI LUE LETTER HIGH YA;Lo;0;L;;;;;N;;;;; +198B;NEW TAI LUE LETTER LOW TSA;Lo;0;L;;;;;N;;;;; +198C;NEW TAI LUE LETTER LOW SA;Lo;0;L;;;;;N;;;;; +198D;NEW TAI LUE LETTER LOW YA;Lo;0;L;;;;;N;;;;; +198E;NEW TAI LUE LETTER HIGH TA;Lo;0;L;;;;;N;;;;; +198F;NEW TAI LUE LETTER HIGH THA;Lo;0;L;;;;;N;;;;; +1990;NEW TAI LUE LETTER HIGH NA;Lo;0;L;;;;;N;;;;; +1991;NEW TAI LUE LETTER LOW TA;Lo;0;L;;;;;N;;;;; +1992;NEW TAI LUE LETTER LOW THA;Lo;0;L;;;;;N;;;;; +1993;NEW TAI LUE LETTER LOW NA;Lo;0;L;;;;;N;;;;; +1994;NEW TAI LUE LETTER HIGH PA;Lo;0;L;;;;;N;;;;; +1995;NEW TAI LUE LETTER HIGH PHA;Lo;0;L;;;;;N;;;;; +1996;NEW TAI LUE LETTER HIGH MA;Lo;0;L;;;;;N;;;;; +1997;NEW TAI LUE LETTER LOW PA;Lo;0;L;;;;;N;;;;; +1998;NEW TAI LUE LETTER LOW PHA;Lo;0;L;;;;;N;;;;; +1999;NEW TAI LUE LETTER LOW MA;Lo;0;L;;;;;N;;;;; +199A;NEW TAI LUE LETTER HIGH FA;Lo;0;L;;;;;N;;;;; +199B;NEW TAI LUE LETTER HIGH VA;Lo;0;L;;;;;N;;;;; +199C;NEW TAI LUE LETTER HIGH LA;Lo;0;L;;;;;N;;;;; +199D;NEW TAI LUE LETTER LOW FA;Lo;0;L;;;;;N;;;;; +199E;NEW TAI LUE LETTER LOW VA;Lo;0;L;;;;;N;;;;; +199F;NEW TAI LUE LETTER LOW LA;Lo;0;L;;;;;N;;;;; +19A0;NEW TAI LUE LETTER HIGH HA;Lo;0;L;;;;;N;;;;; +19A1;NEW TAI LUE LETTER HIGH DA;Lo;0;L;;;;;N;;;;; +19A2;NEW TAI LUE LETTER HIGH BA;Lo;0;L;;;;;N;;;;; +19A3;NEW TAI LUE LETTER LOW HA;Lo;0;L;;;;;N;;;;; +19A4;NEW TAI LUE LETTER LOW DA;Lo;0;L;;;;;N;;;;; +19A5;NEW TAI LUE LETTER LOW BA;Lo;0;L;;;;;N;;;;; +19A6;NEW TAI LUE LETTER HIGH KVA;Lo;0;L;;;;;N;;;;; +19A7;NEW TAI LUE LETTER HIGH XVA;Lo;0;L;;;;;N;;;;; +19A8;NEW TAI LUE LETTER LOW KVA;Lo;0;L;;;;;N;;;;; +19A9;NEW TAI LUE LETTER LOW XVA;Lo;0;L;;;;;N;;;;; +19AA;NEW TAI LUE LETTER HIGH SUA;Lo;0;L;;;;;N;;;;; +19AB;NEW TAI LUE LETTER LOW SUA;Lo;0;L;;;;;N;;;;; +19B0;NEW TAI LUE VOWEL SIGN VOWEL SHORTENER;Lo;0;L;;;;;N;;;;; +19B1;NEW TAI LUE VOWEL SIGN AA;Lo;0;L;;;;;N;;;;; +19B2;NEW TAI LUE VOWEL SIGN II;Lo;0;L;;;;;N;;;;; +19B3;NEW TAI LUE VOWEL SIGN U;Lo;0;L;;;;;N;;;;; +19B4;NEW TAI LUE VOWEL SIGN UU;Lo;0;L;;;;;N;;;;; +19B5;NEW TAI LUE VOWEL SIGN E;Lo;0;L;;;;;N;;;;; +19B6;NEW TAI LUE VOWEL SIGN AE;Lo;0;L;;;;;N;;;;; +19B7;NEW TAI LUE VOWEL SIGN O;Lo;0;L;;;;;N;;;;; +19B8;NEW TAI LUE VOWEL SIGN OA;Lo;0;L;;;;;N;;;;; +19B9;NEW TAI LUE VOWEL SIGN UE;Lo;0;L;;;;;N;;;;; +19BA;NEW TAI LUE VOWEL SIGN AY;Lo;0;L;;;;;N;;;;; +19BB;NEW TAI LUE VOWEL SIGN AAY;Lo;0;L;;;;;N;;;;; +19BC;NEW TAI LUE VOWEL SIGN UY;Lo;0;L;;;;;N;;;;; +19BD;NEW TAI LUE VOWEL SIGN OY;Lo;0;L;;;;;N;;;;; +19BE;NEW TAI LUE VOWEL SIGN OAY;Lo;0;L;;;;;N;;;;; +19BF;NEW TAI LUE VOWEL SIGN UEY;Lo;0;L;;;;;N;;;;; +19C0;NEW TAI LUE VOWEL SIGN IY;Lo;0;L;;;;;N;;;;; +19C1;NEW TAI LUE LETTER FINAL V;Lo;0;L;;;;;N;;;;; +19C2;NEW TAI LUE LETTER FINAL NG;Lo;0;L;;;;;N;;;;; +19C3;NEW TAI LUE LETTER FINAL N;Lo;0;L;;;;;N;;;;; +19C4;NEW TAI LUE LETTER FINAL M;Lo;0;L;;;;;N;;;;; +19C5;NEW TAI LUE LETTER FINAL K;Lo;0;L;;;;;N;;;;; +19C6;NEW TAI LUE LETTER FINAL D;Lo;0;L;;;;;N;;;;; +19C7;NEW TAI LUE LETTER FINAL B;Lo;0;L;;;;;N;;;;; +19C8;NEW TAI LUE TONE MARK-1;Lo;0;L;;;;;N;;;;; +19C9;NEW TAI LUE TONE MARK-2;Lo;0;L;;;;;N;;;;; +19D0;NEW TAI LUE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +19D1;NEW TAI LUE DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +19D2;NEW TAI LUE DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +19D3;NEW TAI LUE DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +19D4;NEW TAI LUE DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +19D5;NEW TAI LUE DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +19D6;NEW TAI LUE DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +19D7;NEW TAI LUE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +19D8;NEW TAI LUE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +19D9;NEW TAI LUE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +19DA;NEW TAI LUE THAM DIGIT ONE;No;0;L;;;1;1;N;;;;; +19DE;NEW TAI LUE SIGN LAE;So;0;ON;;;;;N;;;;; +19DF;NEW TAI LUE SIGN LAEV;So;0;ON;;;;;N;;;;; +19E0;KHMER SYMBOL PATHAMASAT;So;0;ON;;;;;N;;;;; +19E1;KHMER SYMBOL MUOY KOET;So;0;ON;;;;;N;;;;; +19E2;KHMER SYMBOL PII KOET;So;0;ON;;;;;N;;;;; +19E3;KHMER SYMBOL BEI KOET;So;0;ON;;;;;N;;;;; +19E4;KHMER SYMBOL BUON KOET;So;0;ON;;;;;N;;;;; +19E5;KHMER SYMBOL PRAM KOET;So;0;ON;;;;;N;;;;; +19E6;KHMER SYMBOL PRAM-MUOY KOET;So;0;ON;;;;;N;;;;; +19E7;KHMER SYMBOL PRAM-PII KOET;So;0;ON;;;;;N;;;;; +19E8;KHMER SYMBOL PRAM-BEI KOET;So;0;ON;;;;;N;;;;; +19E9;KHMER SYMBOL PRAM-BUON KOET;So;0;ON;;;;;N;;;;; +19EA;KHMER SYMBOL DAP KOET;So;0;ON;;;;;N;;;;; +19EB;KHMER SYMBOL DAP-MUOY KOET;So;0;ON;;;;;N;;;;; +19EC;KHMER SYMBOL DAP-PII KOET;So;0;ON;;;;;N;;;;; +19ED;KHMER SYMBOL DAP-BEI KOET;So;0;ON;;;;;N;;;;; +19EE;KHMER SYMBOL DAP-BUON KOET;So;0;ON;;;;;N;;;;; +19EF;KHMER SYMBOL DAP-PRAM KOET;So;0;ON;;;;;N;;;;; +19F0;KHMER SYMBOL TUTEYASAT;So;0;ON;;;;;N;;;;; +19F1;KHMER SYMBOL MUOY ROC;So;0;ON;;;;;N;;;;; +19F2;KHMER SYMBOL PII ROC;So;0;ON;;;;;N;;;;; +19F3;KHMER SYMBOL BEI ROC;So;0;ON;;;;;N;;;;; +19F4;KHMER SYMBOL BUON ROC;So;0;ON;;;;;N;;;;; +19F5;KHMER SYMBOL PRAM ROC;So;0;ON;;;;;N;;;;; +19F6;KHMER SYMBOL PRAM-MUOY ROC;So;0;ON;;;;;N;;;;; +19F7;KHMER SYMBOL PRAM-PII ROC;So;0;ON;;;;;N;;;;; +19F8;KHMER SYMBOL PRAM-BEI ROC;So;0;ON;;;;;N;;;;; +19F9;KHMER SYMBOL PRAM-BUON ROC;So;0;ON;;;;;N;;;;; +19FA;KHMER SYMBOL DAP ROC;So;0;ON;;;;;N;;;;; +19FB;KHMER SYMBOL DAP-MUOY ROC;So;0;ON;;;;;N;;;;; +19FC;KHMER SYMBOL DAP-PII ROC;So;0;ON;;;;;N;;;;; +19FD;KHMER SYMBOL DAP-BEI ROC;So;0;ON;;;;;N;;;;; +19FE;KHMER SYMBOL DAP-BUON ROC;So;0;ON;;;;;N;;;;; +19FF;KHMER SYMBOL DAP-PRAM ROC;So;0;ON;;;;;N;;;;; +1A00;BUGINESE LETTER KA;Lo;0;L;;;;;N;;;;; +1A01;BUGINESE LETTER GA;Lo;0;L;;;;;N;;;;; +1A02;BUGINESE LETTER NGA;Lo;0;L;;;;;N;;;;; +1A03;BUGINESE LETTER NGKA;Lo;0;L;;;;;N;;;;; +1A04;BUGINESE LETTER PA;Lo;0;L;;;;;N;;;;; +1A05;BUGINESE LETTER BA;Lo;0;L;;;;;N;;;;; +1A06;BUGINESE LETTER MA;Lo;0;L;;;;;N;;;;; +1A07;BUGINESE LETTER MPA;Lo;0;L;;;;;N;;;;; +1A08;BUGINESE LETTER TA;Lo;0;L;;;;;N;;;;; +1A09;BUGINESE LETTER DA;Lo;0;L;;;;;N;;;;; +1A0A;BUGINESE LETTER NA;Lo;0;L;;;;;N;;;;; +1A0B;BUGINESE LETTER NRA;Lo;0;L;;;;;N;;;;; +1A0C;BUGINESE LETTER CA;Lo;0;L;;;;;N;;;;; +1A0D;BUGINESE LETTER JA;Lo;0;L;;;;;N;;;;; +1A0E;BUGINESE LETTER NYA;Lo;0;L;;;;;N;;;;; +1A0F;BUGINESE LETTER NYCA;Lo;0;L;;;;;N;;;;; +1A10;BUGINESE LETTER YA;Lo;0;L;;;;;N;;;;; +1A11;BUGINESE LETTER RA;Lo;0;L;;;;;N;;;;; +1A12;BUGINESE LETTER LA;Lo;0;L;;;;;N;;;;; +1A13;BUGINESE LETTER VA;Lo;0;L;;;;;N;;;;; +1A14;BUGINESE LETTER SA;Lo;0;L;;;;;N;;;;; +1A15;BUGINESE LETTER A;Lo;0;L;;;;;N;;;;; +1A16;BUGINESE LETTER HA;Lo;0;L;;;;;N;;;;; +1A17;BUGINESE VOWEL SIGN I;Mn;230;NSM;;;;;N;;;;; +1A18;BUGINESE VOWEL SIGN U;Mn;220;NSM;;;;;N;;;;; +1A19;BUGINESE VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +1A1A;BUGINESE VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +1A1B;BUGINESE VOWEL SIGN AE;Mn;0;NSM;;;;;N;;;;; +1A1E;BUGINESE PALLAWA;Po;0;L;;;;;N;;;;; +1A1F;BUGINESE END OF SECTION;Po;0;L;;;;;N;;;;; +1A20;TAI THAM LETTER HIGH KA;Lo;0;L;;;;;N;;;;; +1A21;TAI THAM LETTER HIGH KHA;Lo;0;L;;;;;N;;;;; +1A22;TAI THAM LETTER HIGH KXA;Lo;0;L;;;;;N;;;;; +1A23;TAI THAM LETTER LOW KA;Lo;0;L;;;;;N;;;;; +1A24;TAI THAM LETTER LOW KXA;Lo;0;L;;;;;N;;;;; +1A25;TAI THAM LETTER LOW KHA;Lo;0;L;;;;;N;;;;; +1A26;TAI THAM LETTER NGA;Lo;0;L;;;;;N;;;;; +1A27;TAI THAM LETTER HIGH CA;Lo;0;L;;;;;N;;;;; +1A28;TAI THAM LETTER HIGH CHA;Lo;0;L;;;;;N;;;;; +1A29;TAI THAM LETTER LOW CA;Lo;0;L;;;;;N;;;;; +1A2A;TAI THAM LETTER LOW SA;Lo;0;L;;;;;N;;;;; +1A2B;TAI THAM LETTER LOW CHA;Lo;0;L;;;;;N;;;;; +1A2C;TAI THAM LETTER NYA;Lo;0;L;;;;;N;;;;; +1A2D;TAI THAM LETTER RATA;Lo;0;L;;;;;N;;;;; +1A2E;TAI THAM LETTER HIGH RATHA;Lo;0;L;;;;;N;;;;; +1A2F;TAI THAM LETTER DA;Lo;0;L;;;;;N;;;;; +1A30;TAI THAM LETTER LOW RATHA;Lo;0;L;;;;;N;;;;; +1A31;TAI THAM LETTER RANA;Lo;0;L;;;;;N;;;;; +1A32;TAI THAM LETTER HIGH TA;Lo;0;L;;;;;N;;;;; +1A33;TAI THAM LETTER HIGH THA;Lo;0;L;;;;;N;;;;; +1A34;TAI THAM LETTER LOW TA;Lo;0;L;;;;;N;;;;; +1A35;TAI THAM LETTER LOW THA;Lo;0;L;;;;;N;;;;; +1A36;TAI THAM LETTER NA;Lo;0;L;;;;;N;;;;; +1A37;TAI THAM LETTER BA;Lo;0;L;;;;;N;;;;; +1A38;TAI THAM LETTER HIGH PA;Lo;0;L;;;;;N;;;;; +1A39;TAI THAM LETTER HIGH PHA;Lo;0;L;;;;;N;;;;; +1A3A;TAI THAM LETTER HIGH FA;Lo;0;L;;;;;N;;;;; +1A3B;TAI THAM LETTER LOW PA;Lo;0;L;;;;;N;;;;; +1A3C;TAI THAM LETTER LOW FA;Lo;0;L;;;;;N;;;;; +1A3D;TAI THAM LETTER LOW PHA;Lo;0;L;;;;;N;;;;; +1A3E;TAI THAM LETTER MA;Lo;0;L;;;;;N;;;;; +1A3F;TAI THAM LETTER LOW YA;Lo;0;L;;;;;N;;;;; +1A40;TAI THAM LETTER HIGH YA;Lo;0;L;;;;;N;;;;; +1A41;TAI THAM LETTER RA;Lo;0;L;;;;;N;;;;; +1A42;TAI THAM LETTER RUE;Lo;0;L;;;;;N;;;;; +1A43;TAI THAM LETTER LA;Lo;0;L;;;;;N;;;;; +1A44;TAI THAM LETTER LUE;Lo;0;L;;;;;N;;;;; +1A45;TAI THAM LETTER WA;Lo;0;L;;;;;N;;;;; +1A46;TAI THAM LETTER HIGH SHA;Lo;0;L;;;;;N;;;;; +1A47;TAI THAM LETTER HIGH SSA;Lo;0;L;;;;;N;;;;; +1A48;TAI THAM LETTER HIGH SA;Lo;0;L;;;;;N;;;;; +1A49;TAI THAM LETTER HIGH HA;Lo;0;L;;;;;N;;;;; +1A4A;TAI THAM LETTER LLA;Lo;0;L;;;;;N;;;;; +1A4B;TAI THAM LETTER A;Lo;0;L;;;;;N;;;;; +1A4C;TAI THAM LETTER LOW HA;Lo;0;L;;;;;N;;;;; +1A4D;TAI THAM LETTER I;Lo;0;L;;;;;N;;;;; +1A4E;TAI THAM LETTER II;Lo;0;L;;;;;N;;;;; +1A4F;TAI THAM LETTER U;Lo;0;L;;;;;N;;;;; +1A50;TAI THAM LETTER UU;Lo;0;L;;;;;N;;;;; +1A51;TAI THAM LETTER EE;Lo;0;L;;;;;N;;;;; +1A52;TAI THAM LETTER OO;Lo;0;L;;;;;N;;;;; +1A53;TAI THAM LETTER LAE;Lo;0;L;;;;;N;;;;; +1A54;TAI THAM LETTER GREAT SA;Lo;0;L;;;;;N;;;;; +1A55;TAI THAM CONSONANT SIGN MEDIAL RA;Mc;0;L;;;;;N;;;;; +1A56;TAI THAM CONSONANT SIGN MEDIAL LA;Mn;0;NSM;;;;;N;;;;; +1A57;TAI THAM CONSONANT SIGN LA TANG LAI;Mc;0;L;;;;;N;;;;; +1A58;TAI THAM SIGN MAI KANG LAI;Mn;0;NSM;;;;;N;;;;; +1A59;TAI THAM CONSONANT SIGN FINAL NGA;Mn;0;NSM;;;;;N;;;;; +1A5A;TAI THAM CONSONANT SIGN LOW PA;Mn;0;NSM;;;;;N;;;;; +1A5B;TAI THAM CONSONANT SIGN HIGH RATHA OR LOW PA;Mn;0;NSM;;;;;N;;;;; +1A5C;TAI THAM CONSONANT SIGN MA;Mn;0;NSM;;;;;N;;;;; +1A5D;TAI THAM CONSONANT SIGN BA;Mn;0;NSM;;;;;N;;;;; +1A5E;TAI THAM CONSONANT SIGN SA;Mn;0;NSM;;;;;N;;;;; +1A60;TAI THAM SIGN SAKOT;Mn;9;NSM;;;;;N;;;;; +1A61;TAI THAM VOWEL SIGN A;Mc;0;L;;;;;N;;;;; +1A62;TAI THAM VOWEL SIGN MAI SAT;Mn;0;NSM;;;;;N;;;;; +1A63;TAI THAM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +1A64;TAI THAM VOWEL SIGN TALL AA;Mc;0;L;;;;;N;;;;; +1A65;TAI THAM VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1A66;TAI THAM VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +1A67;TAI THAM VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +1A68;TAI THAM VOWEL SIGN UUE;Mn;0;NSM;;;;;N;;;;; +1A69;TAI THAM VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1A6A;TAI THAM VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +1A6B;TAI THAM VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +1A6C;TAI THAM VOWEL SIGN OA BELOW;Mn;0;NSM;;;;;N;;;;; +1A6D;TAI THAM VOWEL SIGN OY;Mc;0;L;;;;;N;;;;; +1A6E;TAI THAM VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +1A6F;TAI THAM VOWEL SIGN AE;Mc;0;L;;;;;N;;;;; +1A70;TAI THAM VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +1A71;TAI THAM VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +1A72;TAI THAM VOWEL SIGN THAM AI;Mc;0;L;;;;;N;;;;; +1A73;TAI THAM VOWEL SIGN OA ABOVE;Mn;0;NSM;;;;;N;;;;; +1A74;TAI THAM SIGN MAI KANG;Mn;0;NSM;;;;;N;;;;; +1A75;TAI THAM SIGN TONE-1;Mn;230;NSM;;;;;N;;;;; +1A76;TAI THAM SIGN TONE-2;Mn;230;NSM;;;;;N;;;;; +1A77;TAI THAM SIGN KHUEN TONE-3;Mn;230;NSM;;;;;N;;;;; +1A78;TAI THAM SIGN KHUEN TONE-4;Mn;230;NSM;;;;;N;;;;; +1A79;TAI THAM SIGN KHUEN TONE-5;Mn;230;NSM;;;;;N;;;;; +1A7A;TAI THAM SIGN RA HAAM;Mn;230;NSM;;;;;N;;;;; +1A7B;TAI THAM SIGN MAI SAM;Mn;230;NSM;;;;;N;;;;; +1A7C;TAI THAM SIGN KHUEN-LUE KARAN;Mn;230;NSM;;;;;N;;;;; +1A7F;TAI THAM COMBINING CRYPTOGRAMMIC DOT;Mn;220;NSM;;;;;N;;;;; +1A80;TAI THAM HORA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1A81;TAI THAM HORA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1A82;TAI THAM HORA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1A83;TAI THAM HORA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1A84;TAI THAM HORA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1A85;TAI THAM HORA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1A86;TAI THAM HORA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1A87;TAI THAM HORA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1A88;TAI THAM HORA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1A89;TAI THAM HORA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1A90;TAI THAM THAM DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1A91;TAI THAM THAM DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1A92;TAI THAM THAM DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1A93;TAI THAM THAM DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1A94;TAI THAM THAM DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1A95;TAI THAM THAM DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1A96;TAI THAM THAM DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1A97;TAI THAM THAM DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1A98;TAI THAM THAM DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1A99;TAI THAM THAM DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1AA0;TAI THAM SIGN WIANG;Po;0;L;;;;;N;;;;; +1AA1;TAI THAM SIGN WIANGWAAK;Po;0;L;;;;;N;;;;; +1AA2;TAI THAM SIGN SAWAN;Po;0;L;;;;;N;;;;; +1AA3;TAI THAM SIGN KEOW;Po;0;L;;;;;N;;;;; +1AA4;TAI THAM SIGN HOY;Po;0;L;;;;;N;;;;; +1AA5;TAI THAM SIGN DOKMAI;Po;0;L;;;;;N;;;;; +1AA6;TAI THAM SIGN REVERSED ROTATED RANA;Po;0;L;;;;;N;;;;; +1AA7;TAI THAM SIGN MAI YAMOK;Lm;0;L;;;;;N;;;;; +1AA8;TAI THAM SIGN KAAN;Po;0;L;;;;;N;;;;; +1AA9;TAI THAM SIGN KAANKUU;Po;0;L;;;;;N;;;;; +1AAA;TAI THAM SIGN SATKAAN;Po;0;L;;;;;N;;;;; +1AAB;TAI THAM SIGN SATKAANKUU;Po;0;L;;;;;N;;;;; +1AAC;TAI THAM SIGN HANG;Po;0;L;;;;;N;;;;; +1AAD;TAI THAM SIGN CAANG;Po;0;L;;;;;N;;;;; +1AB0;COMBINING DOUBLED CIRCUMFLEX ACCENT;Mn;230;NSM;;;;;N;;;;; +1AB1;COMBINING DIAERESIS-RING;Mn;230;NSM;;;;;N;;;;; +1AB2;COMBINING INFINITY;Mn;230;NSM;;;;;N;;;;; +1AB3;COMBINING DOWNWARDS ARROW;Mn;230;NSM;;;;;N;;;;; +1AB4;COMBINING TRIPLE DOT;Mn;230;NSM;;;;;N;;;;; +1AB5;COMBINING X-X BELOW;Mn;220;NSM;;;;;N;;;;; +1AB6;COMBINING WIGGLY LINE BELOW;Mn;220;NSM;;;;;N;;;;; +1AB7;COMBINING OPEN MARK BELOW;Mn;220;NSM;;;;;N;;;;; +1AB8;COMBINING DOUBLE OPEN MARK BELOW;Mn;220;NSM;;;;;N;;;;; +1AB9;COMBINING LIGHT CENTRALIZATION STROKE BELOW;Mn;220;NSM;;;;;N;;;;; +1ABA;COMBINING STRONG CENTRALIZATION STROKE BELOW;Mn;220;NSM;;;;;N;;;;; +1ABB;COMBINING PARENTHESES ABOVE;Mn;230;NSM;;;;;N;;;;; +1ABC;COMBINING DOUBLE PARENTHESES ABOVE;Mn;230;NSM;;;;;N;;;;; +1ABD;COMBINING PARENTHESES BELOW;Mn;220;NSM;;;;;N;;;;; +1ABE;COMBINING PARENTHESES OVERLAY;Me;0;NSM;;;;;N;;;;; +1B00;BALINESE SIGN ULU RICEM;Mn;0;NSM;;;;;N;;;;; +1B01;BALINESE SIGN ULU CANDRA;Mn;0;NSM;;;;;N;;;;; +1B02;BALINESE SIGN CECEK;Mn;0;NSM;;;;;N;;;;; +1B03;BALINESE SIGN SURANG;Mn;0;NSM;;;;;N;;;;; +1B04;BALINESE SIGN BISAH;Mc;0;L;;;;;N;;;;; +1B05;BALINESE LETTER AKARA;Lo;0;L;;;;;N;;;;; +1B06;BALINESE LETTER AKARA TEDUNG;Lo;0;L;1B05 1B35;;;;N;;;;; +1B07;BALINESE LETTER IKARA;Lo;0;L;;;;;N;;;;; +1B08;BALINESE LETTER IKARA TEDUNG;Lo;0;L;1B07 1B35;;;;N;;;;; +1B09;BALINESE LETTER UKARA;Lo;0;L;;;;;N;;;;; +1B0A;BALINESE LETTER UKARA TEDUNG;Lo;0;L;1B09 1B35;;;;N;;;;; +1B0B;BALINESE LETTER RA REPA;Lo;0;L;;;;;N;;;;; +1B0C;BALINESE LETTER RA REPA TEDUNG;Lo;0;L;1B0B 1B35;;;;N;;;;; +1B0D;BALINESE LETTER LA LENGA;Lo;0;L;;;;;N;;;;; +1B0E;BALINESE LETTER LA LENGA TEDUNG;Lo;0;L;1B0D 1B35;;;;N;;;;; +1B0F;BALINESE LETTER EKARA;Lo;0;L;;;;;N;;;;; +1B10;BALINESE LETTER AIKARA;Lo;0;L;;;;;N;;;;; +1B11;BALINESE LETTER OKARA;Lo;0;L;;;;;N;;;;; +1B12;BALINESE LETTER OKARA TEDUNG;Lo;0;L;1B11 1B35;;;;N;;;;; +1B13;BALINESE LETTER KA;Lo;0;L;;;;;N;;;;; +1B14;BALINESE LETTER KA MAHAPRANA;Lo;0;L;;;;;N;;;;; +1B15;BALINESE LETTER GA;Lo;0;L;;;;;N;;;;; +1B16;BALINESE LETTER GA GORA;Lo;0;L;;;;;N;;;;; +1B17;BALINESE LETTER NGA;Lo;0;L;;;;;N;;;;; +1B18;BALINESE LETTER CA;Lo;0;L;;;;;N;;;;; +1B19;BALINESE LETTER CA LACA;Lo;0;L;;;;;N;;;;; +1B1A;BALINESE LETTER JA;Lo;0;L;;;;;N;;;;; +1B1B;BALINESE LETTER JA JERA;Lo;0;L;;;;;N;;;;; +1B1C;BALINESE LETTER NYA;Lo;0;L;;;;;N;;;;; +1B1D;BALINESE LETTER TA LATIK;Lo;0;L;;;;;N;;;;; +1B1E;BALINESE LETTER TA MURDA MAHAPRANA;Lo;0;L;;;;;N;;;;; +1B1F;BALINESE LETTER DA MURDA ALPAPRANA;Lo;0;L;;;;;N;;;;; +1B20;BALINESE LETTER DA MURDA MAHAPRANA;Lo;0;L;;;;;N;;;;; +1B21;BALINESE LETTER NA RAMBAT;Lo;0;L;;;;;N;;;;; +1B22;BALINESE LETTER TA;Lo;0;L;;;;;N;;;;; +1B23;BALINESE LETTER TA TAWA;Lo;0;L;;;;;N;;;;; +1B24;BALINESE LETTER DA;Lo;0;L;;;;;N;;;;; +1B25;BALINESE LETTER DA MADU;Lo;0;L;;;;;N;;;;; +1B26;BALINESE LETTER NA;Lo;0;L;;;;;N;;;;; +1B27;BALINESE LETTER PA;Lo;0;L;;;;;N;;;;; +1B28;BALINESE LETTER PA KAPAL;Lo;0;L;;;;;N;;;;; +1B29;BALINESE LETTER BA;Lo;0;L;;;;;N;;;;; +1B2A;BALINESE LETTER BA KEMBANG;Lo;0;L;;;;;N;;;;; +1B2B;BALINESE LETTER MA;Lo;0;L;;;;;N;;;;; +1B2C;BALINESE LETTER YA;Lo;0;L;;;;;N;;;;; +1B2D;BALINESE LETTER RA;Lo;0;L;;;;;N;;;;; +1B2E;BALINESE LETTER LA;Lo;0;L;;;;;N;;;;; +1B2F;BALINESE LETTER WA;Lo;0;L;;;;;N;;;;; +1B30;BALINESE LETTER SA SAGA;Lo;0;L;;;;;N;;;;; +1B31;BALINESE LETTER SA SAPA;Lo;0;L;;;;;N;;;;; +1B32;BALINESE LETTER SA;Lo;0;L;;;;;N;;;;; +1B33;BALINESE LETTER HA;Lo;0;L;;;;;N;;;;; +1B34;BALINESE SIGN REREKAN;Mn;7;NSM;;;;;N;;;;; +1B35;BALINESE VOWEL SIGN TEDUNG;Mc;0;L;;;;;N;;;;; +1B36;BALINESE VOWEL SIGN ULU;Mn;0;NSM;;;;;N;;;;; +1B37;BALINESE VOWEL SIGN ULU SARI;Mn;0;NSM;;;;;N;;;;; +1B38;BALINESE VOWEL SIGN SUKU;Mn;0;NSM;;;;;N;;;;; +1B39;BALINESE VOWEL SIGN SUKU ILUT;Mn;0;NSM;;;;;N;;;;; +1B3A;BALINESE VOWEL SIGN RA REPA;Mn;0;NSM;;;;;N;;;;; +1B3B;BALINESE VOWEL SIGN RA REPA TEDUNG;Mc;0;L;1B3A 1B35;;;;N;;;;; +1B3C;BALINESE VOWEL SIGN LA LENGA;Mn;0;NSM;;;;;N;;;;; +1B3D;BALINESE VOWEL SIGN LA LENGA TEDUNG;Mc;0;L;1B3C 1B35;;;;N;;;;; +1B3E;BALINESE VOWEL SIGN TALING;Mc;0;L;;;;;N;;;;; +1B3F;BALINESE VOWEL SIGN TALING REPA;Mc;0;L;;;;;N;;;;; +1B40;BALINESE VOWEL SIGN TALING TEDUNG;Mc;0;L;1B3E 1B35;;;;N;;;;; +1B41;BALINESE VOWEL SIGN TALING REPA TEDUNG;Mc;0;L;1B3F 1B35;;;;N;;;;; +1B42;BALINESE VOWEL SIGN PEPET;Mn;0;NSM;;;;;N;;;;; +1B43;BALINESE VOWEL SIGN PEPET TEDUNG;Mc;0;L;1B42 1B35;;;;N;;;;; +1B44;BALINESE ADEG ADEG;Mc;9;L;;;;;N;;;;; +1B45;BALINESE LETTER KAF SASAK;Lo;0;L;;;;;N;;;;; +1B46;BALINESE LETTER KHOT SASAK;Lo;0;L;;;;;N;;;;; +1B47;BALINESE LETTER TZIR SASAK;Lo;0;L;;;;;N;;;;; +1B48;BALINESE LETTER EF SASAK;Lo;0;L;;;;;N;;;;; +1B49;BALINESE LETTER VE SASAK;Lo;0;L;;;;;N;;;;; +1B4A;BALINESE LETTER ZAL SASAK;Lo;0;L;;;;;N;;;;; +1B4B;BALINESE LETTER ASYURA SASAK;Lo;0;L;;;;;N;;;;; +1B50;BALINESE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1B51;BALINESE DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1B52;BALINESE DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1B53;BALINESE DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1B54;BALINESE DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1B55;BALINESE DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1B56;BALINESE DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1B57;BALINESE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1B58;BALINESE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1B59;BALINESE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1B5A;BALINESE PANTI;Po;0;L;;;;;N;;;;; +1B5B;BALINESE PAMADA;Po;0;L;;;;;N;;;;; +1B5C;BALINESE WINDU;Po;0;L;;;;;N;;;;; +1B5D;BALINESE CARIK PAMUNGKAH;Po;0;L;;;;;N;;;;; +1B5E;BALINESE CARIK SIKI;Po;0;L;;;;;N;;;;; +1B5F;BALINESE CARIK PAREREN;Po;0;L;;;;;N;;;;; +1B60;BALINESE PAMENENG;Po;0;L;;;;;N;;;;; +1B61;BALINESE MUSICAL SYMBOL DONG;So;0;L;;;;;N;;;;; +1B62;BALINESE MUSICAL SYMBOL DENG;So;0;L;;;;;N;;;;; +1B63;BALINESE MUSICAL SYMBOL DUNG;So;0;L;;;;;N;;;;; +1B64;BALINESE MUSICAL SYMBOL DANG;So;0;L;;;;;N;;;;; +1B65;BALINESE MUSICAL SYMBOL DANG SURANG;So;0;L;;;;;N;;;;; +1B66;BALINESE MUSICAL SYMBOL DING;So;0;L;;;;;N;;;;; +1B67;BALINESE MUSICAL SYMBOL DAENG;So;0;L;;;;;N;;;;; +1B68;BALINESE MUSICAL SYMBOL DEUNG;So;0;L;;;;;N;;;;; +1B69;BALINESE MUSICAL SYMBOL DAING;So;0;L;;;;;N;;;;; +1B6A;BALINESE MUSICAL SYMBOL DANG GEDE;So;0;L;;;;;N;;;;; +1B6B;BALINESE MUSICAL SYMBOL COMBINING TEGEH;Mn;230;NSM;;;;;N;;;;; +1B6C;BALINESE MUSICAL SYMBOL COMBINING ENDEP;Mn;220;NSM;;;;;N;;;;; +1B6D;BALINESE MUSICAL SYMBOL COMBINING KEMPUL;Mn;230;NSM;;;;;N;;;;; +1B6E;BALINESE MUSICAL SYMBOL COMBINING KEMPLI;Mn;230;NSM;;;;;N;;;;; +1B6F;BALINESE MUSICAL SYMBOL COMBINING JEGOGAN;Mn;230;NSM;;;;;N;;;;; +1B70;BALINESE MUSICAL SYMBOL COMBINING KEMPUL WITH JEGOGAN;Mn;230;NSM;;;;;N;;;;; +1B71;BALINESE MUSICAL SYMBOL COMBINING KEMPLI WITH JEGOGAN;Mn;230;NSM;;;;;N;;;;; +1B72;BALINESE MUSICAL SYMBOL COMBINING BENDE;Mn;230;NSM;;;;;N;;;;; +1B73;BALINESE MUSICAL SYMBOL COMBINING GONG;Mn;230;NSM;;;;;N;;;;; +1B74;BALINESE MUSICAL SYMBOL RIGHT-HAND OPEN DUG;So;0;L;;;;;N;;;;; +1B75;BALINESE MUSICAL SYMBOL RIGHT-HAND OPEN DAG;So;0;L;;;;;N;;;;; +1B76;BALINESE MUSICAL SYMBOL RIGHT-HAND CLOSED TUK;So;0;L;;;;;N;;;;; +1B77;BALINESE MUSICAL SYMBOL RIGHT-HAND CLOSED TAK;So;0;L;;;;;N;;;;; +1B78;BALINESE MUSICAL SYMBOL LEFT-HAND OPEN PANG;So;0;L;;;;;N;;;;; +1B79;BALINESE MUSICAL SYMBOL LEFT-HAND OPEN PUNG;So;0;L;;;;;N;;;;; +1B7A;BALINESE MUSICAL SYMBOL LEFT-HAND CLOSED PLAK;So;0;L;;;;;N;;;;; +1B7B;BALINESE MUSICAL SYMBOL LEFT-HAND CLOSED PLUK;So;0;L;;;;;N;;;;; +1B7C;BALINESE MUSICAL SYMBOL LEFT-HAND OPEN PING;So;0;L;;;;;N;;;;; +1B80;SUNDANESE SIGN PANYECEK;Mn;0;NSM;;;;;N;;;;; +1B81;SUNDANESE SIGN PANGLAYAR;Mn;0;NSM;;;;;N;;;;; +1B82;SUNDANESE SIGN PANGWISAD;Mc;0;L;;;;;N;;;;; +1B83;SUNDANESE LETTER A;Lo;0;L;;;;;N;;;;; +1B84;SUNDANESE LETTER I;Lo;0;L;;;;;N;;;;; +1B85;SUNDANESE LETTER U;Lo;0;L;;;;;N;;;;; +1B86;SUNDANESE LETTER AE;Lo;0;L;;;;;N;;;;; +1B87;SUNDANESE LETTER O;Lo;0;L;;;;;N;;;;; +1B88;SUNDANESE LETTER E;Lo;0;L;;;;;N;;;;; +1B89;SUNDANESE LETTER EU;Lo;0;L;;;;;N;;;;; +1B8A;SUNDANESE LETTER KA;Lo;0;L;;;;;N;;;;; +1B8B;SUNDANESE LETTER QA;Lo;0;L;;;;;N;;;;; +1B8C;SUNDANESE LETTER GA;Lo;0;L;;;;;N;;;;; +1B8D;SUNDANESE LETTER NGA;Lo;0;L;;;;;N;;;;; +1B8E;SUNDANESE LETTER CA;Lo;0;L;;;;;N;;;;; +1B8F;SUNDANESE LETTER JA;Lo;0;L;;;;;N;;;;; +1B90;SUNDANESE LETTER ZA;Lo;0;L;;;;;N;;;;; +1B91;SUNDANESE LETTER NYA;Lo;0;L;;;;;N;;;;; +1B92;SUNDANESE LETTER TA;Lo;0;L;;;;;N;;;;; +1B93;SUNDANESE LETTER DA;Lo;0;L;;;;;N;;;;; +1B94;SUNDANESE LETTER NA;Lo;0;L;;;;;N;;;;; +1B95;SUNDANESE LETTER PA;Lo;0;L;;;;;N;;;;; +1B96;SUNDANESE LETTER FA;Lo;0;L;;;;;N;;;;; +1B97;SUNDANESE LETTER VA;Lo;0;L;;;;;N;;;;; +1B98;SUNDANESE LETTER BA;Lo;0;L;;;;;N;;;;; +1B99;SUNDANESE LETTER MA;Lo;0;L;;;;;N;;;;; +1B9A;SUNDANESE LETTER YA;Lo;0;L;;;;;N;;;;; +1B9B;SUNDANESE LETTER RA;Lo;0;L;;;;;N;;;;; +1B9C;SUNDANESE LETTER LA;Lo;0;L;;;;;N;;;;; +1B9D;SUNDANESE LETTER WA;Lo;0;L;;;;;N;;;;; +1B9E;SUNDANESE LETTER SA;Lo;0;L;;;;;N;;;;; +1B9F;SUNDANESE LETTER XA;Lo;0;L;;;;;N;;;;; +1BA0;SUNDANESE LETTER HA;Lo;0;L;;;;;N;;;;; +1BA1;SUNDANESE CONSONANT SIGN PAMINGKAL;Mc;0;L;;;;;N;;;;; +1BA2;SUNDANESE CONSONANT SIGN PANYAKRA;Mn;0;NSM;;;;;N;;;;; +1BA3;SUNDANESE CONSONANT SIGN PANYIKU;Mn;0;NSM;;;;;N;;;;; +1BA4;SUNDANESE VOWEL SIGN PANGHULU;Mn;0;NSM;;;;;N;;;;; +1BA5;SUNDANESE VOWEL SIGN PANYUKU;Mn;0;NSM;;;;;N;;;;; +1BA6;SUNDANESE VOWEL SIGN PANAELAENG;Mc;0;L;;;;;N;;;;; +1BA7;SUNDANESE VOWEL SIGN PANOLONG;Mc;0;L;;;;;N;;;;; +1BA8;SUNDANESE VOWEL SIGN PAMEPET;Mn;0;NSM;;;;;N;;;;; +1BA9;SUNDANESE VOWEL SIGN PANEULEUNG;Mn;0;NSM;;;;;N;;;;; +1BAA;SUNDANESE SIGN PAMAAEH;Mc;9;L;;;;;N;;;;; +1BAB;SUNDANESE SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +1BAC;SUNDANESE CONSONANT SIGN PASANGAN MA;Mn;0;NSM;;;;;N;;;;; +1BAD;SUNDANESE CONSONANT SIGN PASANGAN WA;Mn;0;NSM;;;;;N;;;;; +1BAE;SUNDANESE LETTER KHA;Lo;0;L;;;;;N;;;;; +1BAF;SUNDANESE LETTER SYA;Lo;0;L;;;;;N;;;;; +1BB0;SUNDANESE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1BB1;SUNDANESE DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1BB2;SUNDANESE DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1BB3;SUNDANESE DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1BB4;SUNDANESE DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1BB5;SUNDANESE DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1BB6;SUNDANESE DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1BB7;SUNDANESE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1BB8;SUNDANESE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1BB9;SUNDANESE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1BBA;SUNDANESE AVAGRAHA;Lo;0;L;;;;;N;;;;; +1BBB;SUNDANESE LETTER REU;Lo;0;L;;;;;N;;;;; +1BBC;SUNDANESE LETTER LEU;Lo;0;L;;;;;N;;;;; +1BBD;SUNDANESE LETTER BHA;Lo;0;L;;;;;N;;;;; +1BBE;SUNDANESE LETTER FINAL K;Lo;0;L;;;;;N;;;;; +1BBF;SUNDANESE LETTER FINAL M;Lo;0;L;;;;;N;;;;; +1BC0;BATAK LETTER A;Lo;0;L;;;;;N;;;;; +1BC1;BATAK LETTER SIMALUNGUN A;Lo;0;L;;;;;N;;;;; +1BC2;BATAK LETTER HA;Lo;0;L;;;;;N;;;;; +1BC3;BATAK LETTER SIMALUNGUN HA;Lo;0;L;;;;;N;;;;; +1BC4;BATAK LETTER MANDAILING HA;Lo;0;L;;;;;N;;;;; +1BC5;BATAK LETTER BA;Lo;0;L;;;;;N;;;;; +1BC6;BATAK LETTER KARO BA;Lo;0;L;;;;;N;;;;; +1BC7;BATAK LETTER PA;Lo;0;L;;;;;N;;;;; +1BC8;BATAK LETTER SIMALUNGUN PA;Lo;0;L;;;;;N;;;;; +1BC9;BATAK LETTER NA;Lo;0;L;;;;;N;;;;; +1BCA;BATAK LETTER MANDAILING NA;Lo;0;L;;;;;N;;;;; +1BCB;BATAK LETTER WA;Lo;0;L;;;;;N;;;;; +1BCC;BATAK LETTER SIMALUNGUN WA;Lo;0;L;;;;;N;;;;; +1BCD;BATAK LETTER PAKPAK WA;Lo;0;L;;;;;N;;;;; +1BCE;BATAK LETTER GA;Lo;0;L;;;;;N;;;;; +1BCF;BATAK LETTER SIMALUNGUN GA;Lo;0;L;;;;;N;;;;; +1BD0;BATAK LETTER JA;Lo;0;L;;;;;N;;;;; +1BD1;BATAK LETTER DA;Lo;0;L;;;;;N;;;;; +1BD2;BATAK LETTER RA;Lo;0;L;;;;;N;;;;; +1BD3;BATAK LETTER SIMALUNGUN RA;Lo;0;L;;;;;N;;;;; +1BD4;BATAK LETTER MA;Lo;0;L;;;;;N;;;;; +1BD5;BATAK LETTER SIMALUNGUN MA;Lo;0;L;;;;;N;;;;; +1BD6;BATAK LETTER SOUTHERN TA;Lo;0;L;;;;;N;;;;; +1BD7;BATAK LETTER NORTHERN TA;Lo;0;L;;;;;N;;;;; +1BD8;BATAK LETTER SA;Lo;0;L;;;;;N;;;;; +1BD9;BATAK LETTER SIMALUNGUN SA;Lo;0;L;;;;;N;;;;; +1BDA;BATAK LETTER MANDAILING SA;Lo;0;L;;;;;N;;;;; +1BDB;BATAK LETTER YA;Lo;0;L;;;;;N;;;;; +1BDC;BATAK LETTER SIMALUNGUN YA;Lo;0;L;;;;;N;;;;; +1BDD;BATAK LETTER NGA;Lo;0;L;;;;;N;;;;; +1BDE;BATAK LETTER LA;Lo;0;L;;;;;N;;;;; +1BDF;BATAK LETTER SIMALUNGUN LA;Lo;0;L;;;;;N;;;;; +1BE0;BATAK LETTER NYA;Lo;0;L;;;;;N;;;;; +1BE1;BATAK LETTER CA;Lo;0;L;;;;;N;;;;; +1BE2;BATAK LETTER NDA;Lo;0;L;;;;;N;;;;; +1BE3;BATAK LETTER MBA;Lo;0;L;;;;;N;;;;; +1BE4;BATAK LETTER I;Lo;0;L;;;;;N;;;;; +1BE5;BATAK LETTER U;Lo;0;L;;;;;N;;;;; +1BE6;BATAK SIGN TOMPI;Mn;7;NSM;;;;;N;;;;; +1BE7;BATAK VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +1BE8;BATAK VOWEL SIGN PAKPAK E;Mn;0;NSM;;;;;N;;;;; +1BE9;BATAK VOWEL SIGN EE;Mn;0;NSM;;;;;N;;;;; +1BEA;BATAK VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +1BEB;BATAK VOWEL SIGN KARO I;Mc;0;L;;;;;N;;;;; +1BEC;BATAK VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +1BED;BATAK VOWEL SIGN KARO O;Mn;0;NSM;;;;;N;;;;; +1BEE;BATAK VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +1BEF;BATAK VOWEL SIGN U FOR SIMALUNGUN SA;Mn;0;NSM;;;;;N;;;;; +1BF0;BATAK CONSONANT SIGN NG;Mn;0;NSM;;;;;N;;;;; +1BF1;BATAK CONSONANT SIGN H;Mn;0;NSM;;;;;N;;;;; +1BF2;BATAK PANGOLAT;Mc;9;L;;;;;N;;;;; +1BF3;BATAK PANONGONAN;Mc;9;L;;;;;N;;;;; +1BFC;BATAK SYMBOL BINDU NA METEK;Po;0;L;;;;;N;;;;; +1BFD;BATAK SYMBOL BINDU PINARBORAS;Po;0;L;;;;;N;;;;; +1BFE;BATAK SYMBOL BINDU JUDUL;Po;0;L;;;;;N;;;;; +1BFF;BATAK SYMBOL BINDU PANGOLAT;Po;0;L;;;;;N;;;;; +1C00;LEPCHA LETTER KA;Lo;0;L;;;;;N;;;;; +1C01;LEPCHA LETTER KLA;Lo;0;L;;;;;N;;;;; +1C02;LEPCHA LETTER KHA;Lo;0;L;;;;;N;;;;; +1C03;LEPCHA LETTER GA;Lo;0;L;;;;;N;;;;; +1C04;LEPCHA LETTER GLA;Lo;0;L;;;;;N;;;;; +1C05;LEPCHA LETTER NGA;Lo;0;L;;;;;N;;;;; +1C06;LEPCHA LETTER CA;Lo;0;L;;;;;N;;;;; +1C07;LEPCHA LETTER CHA;Lo;0;L;;;;;N;;;;; +1C08;LEPCHA LETTER JA;Lo;0;L;;;;;N;;;;; +1C09;LEPCHA LETTER NYA;Lo;0;L;;;;;N;;;;; +1C0A;LEPCHA LETTER TA;Lo;0;L;;;;;N;;;;; +1C0B;LEPCHA LETTER THA;Lo;0;L;;;;;N;;;;; +1C0C;LEPCHA LETTER DA;Lo;0;L;;;;;N;;;;; +1C0D;LEPCHA LETTER NA;Lo;0;L;;;;;N;;;;; +1C0E;LEPCHA LETTER PA;Lo;0;L;;;;;N;;;;; +1C0F;LEPCHA LETTER PLA;Lo;0;L;;;;;N;;;;; +1C10;LEPCHA LETTER PHA;Lo;0;L;;;;;N;;;;; +1C11;LEPCHA LETTER FA;Lo;0;L;;;;;N;;;;; +1C12;LEPCHA LETTER FLA;Lo;0;L;;;;;N;;;;; +1C13;LEPCHA LETTER BA;Lo;0;L;;;;;N;;;;; +1C14;LEPCHA LETTER BLA;Lo;0;L;;;;;N;;;;; +1C15;LEPCHA LETTER MA;Lo;0;L;;;;;N;;;;; +1C16;LEPCHA LETTER MLA;Lo;0;L;;;;;N;;;;; +1C17;LEPCHA LETTER TSA;Lo;0;L;;;;;N;;;;; +1C18;LEPCHA LETTER TSHA;Lo;0;L;;;;;N;;;;; +1C19;LEPCHA LETTER DZA;Lo;0;L;;;;;N;;;;; +1C1A;LEPCHA LETTER YA;Lo;0;L;;;;;N;;;;; +1C1B;LEPCHA LETTER RA;Lo;0;L;;;;;N;;;;; +1C1C;LEPCHA LETTER LA;Lo;0;L;;;;;N;;;;; +1C1D;LEPCHA LETTER HA;Lo;0;L;;;;;N;;;;; +1C1E;LEPCHA LETTER HLA;Lo;0;L;;;;;N;;;;; +1C1F;LEPCHA LETTER VA;Lo;0;L;;;;;N;;;;; +1C20;LEPCHA LETTER SA;Lo;0;L;;;;;N;;;;; +1C21;LEPCHA LETTER SHA;Lo;0;L;;;;;N;;;;; +1C22;LEPCHA LETTER WA;Lo;0;L;;;;;N;;;;; +1C23;LEPCHA LETTER A;Lo;0;L;;;;;N;;;;; +1C24;LEPCHA SUBJOINED LETTER YA;Mc;0;L;;;;;N;;;;; +1C25;LEPCHA SUBJOINED LETTER RA;Mc;0;L;;;;;N;;;;; +1C26;LEPCHA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +1C27;LEPCHA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +1C28;LEPCHA VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +1C29;LEPCHA VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +1C2A;LEPCHA VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +1C2B;LEPCHA VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +1C2C;LEPCHA VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +1C2D;LEPCHA CONSONANT SIGN K;Mn;0;NSM;;;;;N;;;;; +1C2E;LEPCHA CONSONANT SIGN M;Mn;0;NSM;;;;;N;;;;; +1C2F;LEPCHA CONSONANT SIGN L;Mn;0;NSM;;;;;N;;;;; +1C30;LEPCHA CONSONANT SIGN N;Mn;0;NSM;;;;;N;;;;; +1C31;LEPCHA CONSONANT SIGN P;Mn;0;NSM;;;;;N;;;;; +1C32;LEPCHA CONSONANT SIGN R;Mn;0;NSM;;;;;N;;;;; +1C33;LEPCHA CONSONANT SIGN T;Mn;0;NSM;;;;;N;;;;; +1C34;LEPCHA CONSONANT SIGN NYIN-DO;Mc;0;L;;;;;N;;;;; +1C35;LEPCHA CONSONANT SIGN KANG;Mc;0;L;;;;;N;;;;; +1C36;LEPCHA SIGN RAN;Mn;0;NSM;;;;;N;;;;; +1C37;LEPCHA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +1C3B;LEPCHA PUNCTUATION TA-ROL;Po;0;L;;;;;N;;;;; +1C3C;LEPCHA PUNCTUATION NYET THYOOM TA-ROL;Po;0;L;;;;;N;;;;; +1C3D;LEPCHA PUNCTUATION CER-WA;Po;0;L;;;;;N;;;;; +1C3E;LEPCHA PUNCTUATION TSHOOK CER-WA;Po;0;L;;;;;N;;;;; +1C3F;LEPCHA PUNCTUATION TSHOOK;Po;0;L;;;;;N;;;;; +1C40;LEPCHA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1C41;LEPCHA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1C42;LEPCHA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1C43;LEPCHA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1C44;LEPCHA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1C45;LEPCHA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1C46;LEPCHA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1C47;LEPCHA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1C48;LEPCHA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1C49;LEPCHA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1C4D;LEPCHA LETTER TTA;Lo;0;L;;;;;N;;;;; +1C4E;LEPCHA LETTER TTHA;Lo;0;L;;;;;N;;;;; +1C4F;LEPCHA LETTER DDA;Lo;0;L;;;;;N;;;;; +1C50;OL CHIKI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +1C51;OL CHIKI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +1C52;OL CHIKI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +1C53;OL CHIKI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1C54;OL CHIKI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1C55;OL CHIKI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1C56;OL CHIKI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1C57;OL CHIKI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1C58;OL CHIKI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1C59;OL CHIKI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1C5A;OL CHIKI LETTER LA;Lo;0;L;;;;;N;;;;; +1C5B;OL CHIKI LETTER AT;Lo;0;L;;;;;N;;;;; +1C5C;OL CHIKI LETTER AG;Lo;0;L;;;;;N;;;;; +1C5D;OL CHIKI LETTER ANG;Lo;0;L;;;;;N;;;;; +1C5E;OL CHIKI LETTER AL;Lo;0;L;;;;;N;;;;; +1C5F;OL CHIKI LETTER LAA;Lo;0;L;;;;;N;;;;; +1C60;OL CHIKI LETTER AAK;Lo;0;L;;;;;N;;;;; +1C61;OL CHIKI LETTER AAJ;Lo;0;L;;;;;N;;;;; +1C62;OL CHIKI LETTER AAM;Lo;0;L;;;;;N;;;;; +1C63;OL CHIKI LETTER AAW;Lo;0;L;;;;;N;;;;; +1C64;OL CHIKI LETTER LI;Lo;0;L;;;;;N;;;;; +1C65;OL CHIKI LETTER IS;Lo;0;L;;;;;N;;;;; +1C66;OL CHIKI LETTER IH;Lo;0;L;;;;;N;;;;; +1C67;OL CHIKI LETTER INY;Lo;0;L;;;;;N;;;;; +1C68;OL CHIKI LETTER IR;Lo;0;L;;;;;N;;;;; +1C69;OL CHIKI LETTER LU;Lo;0;L;;;;;N;;;;; +1C6A;OL CHIKI LETTER UC;Lo;0;L;;;;;N;;;;; +1C6B;OL CHIKI LETTER UD;Lo;0;L;;;;;N;;;;; +1C6C;OL CHIKI LETTER UNN;Lo;0;L;;;;;N;;;;; +1C6D;OL CHIKI LETTER UY;Lo;0;L;;;;;N;;;;; +1C6E;OL CHIKI LETTER LE;Lo;0;L;;;;;N;;;;; +1C6F;OL CHIKI LETTER EP;Lo;0;L;;;;;N;;;;; +1C70;OL CHIKI LETTER EDD;Lo;0;L;;;;;N;;;;; +1C71;OL CHIKI LETTER EN;Lo;0;L;;;;;N;;;;; +1C72;OL CHIKI LETTER ERR;Lo;0;L;;;;;N;;;;; +1C73;OL CHIKI LETTER LO;Lo;0;L;;;;;N;;;;; +1C74;OL CHIKI LETTER OTT;Lo;0;L;;;;;N;;;;; +1C75;OL CHIKI LETTER OB;Lo;0;L;;;;;N;;;;; +1C76;OL CHIKI LETTER OV;Lo;0;L;;;;;N;;;;; +1C77;OL CHIKI LETTER OH;Lo;0;L;;;;;N;;;;; +1C78;OL CHIKI MU TTUDDAG;Lm;0;L;;;;;N;;;;; +1C79;OL CHIKI GAAHLAA TTUDDAAG;Lm;0;L;;;;;N;;;;; +1C7A;OL CHIKI MU-GAAHLAA TTUDDAAG;Lm;0;L;;;;;N;;;;; +1C7B;OL CHIKI RELAA;Lm;0;L;;;;;N;;;;; +1C7C;OL CHIKI PHAARKAA;Lm;0;L;;;;;N;;;;; +1C7D;OL CHIKI AHAD;Lm;0;L;;;;;N;;;;; +1C7E;OL CHIKI PUNCTUATION MUCAAD;Po;0;L;;;;;N;;;;; +1C7F;OL CHIKI PUNCTUATION DOUBLE MUCAAD;Po;0;L;;;;;N;;;;; +1C80;CYRILLIC SMALL LETTER ROUNDED VE;Ll;0;L;;;;;N;;;0412;;0412 +1C81;CYRILLIC SMALL LETTER LONG-LEGGED DE;Ll;0;L;;;;;N;;;0414;;0414 +1C82;CYRILLIC SMALL LETTER NARROW O;Ll;0;L;;;;;N;;;041E;;041E +1C83;CYRILLIC SMALL LETTER WIDE ES;Ll;0;L;;;;;N;;;0421;;0421 +1C84;CYRILLIC SMALL LETTER TALL TE;Ll;0;L;;;;;N;;;0422;;0422 +1C85;CYRILLIC SMALL LETTER THREE-LEGGED TE;Ll;0;L;;;;;N;;;0422;;0422 +1C86;CYRILLIC SMALL LETTER TALL HARD SIGN;Ll;0;L;;;;;N;;;042A;;042A +1C87;CYRILLIC SMALL LETTER TALL YAT;Ll;0;L;;;;;N;;;0462;;0462 +1C88;CYRILLIC SMALL LETTER UNBLENDED UK;Ll;0;L;;;;;N;;;A64A;;A64A +1CC0;SUNDANESE PUNCTUATION BINDU SURYA;Po;0;L;;;;;N;;;;; +1CC1;SUNDANESE PUNCTUATION BINDU PANGLONG;Po;0;L;;;;;N;;;;; +1CC2;SUNDANESE PUNCTUATION BINDU PURNAMA;Po;0;L;;;;;N;;;;; +1CC3;SUNDANESE PUNCTUATION BINDU CAKRA;Po;0;L;;;;;N;;;;; +1CC4;SUNDANESE PUNCTUATION BINDU LEU SATANGA;Po;0;L;;;;;N;;;;; +1CC5;SUNDANESE PUNCTUATION BINDU KA SATANGA;Po;0;L;;;;;N;;;;; +1CC6;SUNDANESE PUNCTUATION BINDU DA SATANGA;Po;0;L;;;;;N;;;;; +1CC7;SUNDANESE PUNCTUATION BINDU BA SATANGA;Po;0;L;;;;;N;;;;; +1CD0;VEDIC TONE KARSHANA;Mn;230;NSM;;;;;N;;;;; +1CD1;VEDIC TONE SHARA;Mn;230;NSM;;;;;N;;;;; +1CD2;VEDIC TONE PRENKHA;Mn;230;NSM;;;;;N;;;;; +1CD3;VEDIC SIGN NIHSHVASA;Po;0;L;;;;;N;;;;; +1CD4;VEDIC SIGN YAJURVEDIC MIDLINE SVARITA;Mn;1;NSM;;;;;N;;;;; +1CD5;VEDIC TONE YAJURVEDIC AGGRAVATED INDEPENDENT SVARITA;Mn;220;NSM;;;;;N;;;;; +1CD6;VEDIC TONE YAJURVEDIC INDEPENDENT SVARITA;Mn;220;NSM;;;;;N;;;;; +1CD7;VEDIC TONE YAJURVEDIC KATHAKA INDEPENDENT SVARITA;Mn;220;NSM;;;;;N;;;;; +1CD8;VEDIC TONE CANDRA BELOW;Mn;220;NSM;;;;;N;;;;; +1CD9;VEDIC TONE YAJURVEDIC KATHAKA INDEPENDENT SVARITA SCHROEDER;Mn;220;NSM;;;;;N;;;;; +1CDA;VEDIC TONE DOUBLE SVARITA;Mn;230;NSM;;;;;N;;;;; +1CDB;VEDIC TONE TRIPLE SVARITA;Mn;230;NSM;;;;;N;;;;; +1CDC;VEDIC TONE KATHAKA ANUDATTA;Mn;220;NSM;;;;;N;;;;; +1CDD;VEDIC TONE DOT BELOW;Mn;220;NSM;;;;;N;;;;; +1CDE;VEDIC TONE TWO DOTS BELOW;Mn;220;NSM;;;;;N;;;;; +1CDF;VEDIC TONE THREE DOTS BELOW;Mn;220;NSM;;;;;N;;;;; +1CE0;VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA;Mn;230;NSM;;;;;N;;;;; +1CE1;VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA;Mc;0;L;;;;;N;;;;; +1CE2;VEDIC SIGN VISARGA SVARITA;Mn;1;NSM;;;;;N;;;;; +1CE3;VEDIC SIGN VISARGA UDATTA;Mn;1;NSM;;;;;N;;;;; +1CE4;VEDIC SIGN REVERSED VISARGA UDATTA;Mn;1;NSM;;;;;N;;;;; +1CE5;VEDIC SIGN VISARGA ANUDATTA;Mn;1;NSM;;;;;N;;;;; +1CE6;VEDIC SIGN REVERSED VISARGA ANUDATTA;Mn;1;NSM;;;;;N;;;;; +1CE7;VEDIC SIGN VISARGA UDATTA WITH TAIL;Mn;1;NSM;;;;;N;;;;; +1CE8;VEDIC SIGN VISARGA ANUDATTA WITH TAIL;Mn;1;NSM;;;;;N;;;;; +1CE9;VEDIC SIGN ANUSVARA ANTARGOMUKHA;Lo;0;L;;;;;N;;;;; +1CEA;VEDIC SIGN ANUSVARA BAHIRGOMUKHA;Lo;0;L;;;;;N;;;;; +1CEB;VEDIC SIGN ANUSVARA VAMAGOMUKHA;Lo;0;L;;;;;N;;;;; +1CEC;VEDIC SIGN ANUSVARA VAMAGOMUKHA WITH TAIL;Lo;0;L;;;;;N;;;;; +1CED;VEDIC SIGN TIRYAK;Mn;220;NSM;;;;;N;;;;; +1CEE;VEDIC SIGN HEXIFORM LONG ANUSVARA;Lo;0;L;;;;;N;;;;; +1CEF;VEDIC SIGN LONG ANUSVARA;Lo;0;L;;;;;N;;;;; +1CF0;VEDIC SIGN RTHANG LONG ANUSVARA;Lo;0;L;;;;;N;;;;; +1CF1;VEDIC SIGN ANUSVARA UBHAYATO MUKHA;Lo;0;L;;;;;N;;;;; +1CF2;VEDIC SIGN ARDHAVISARGA;Mc;0;L;;;;;N;;;;; +1CF3;VEDIC SIGN ROTATED ARDHAVISARGA;Mc;0;L;;;;;N;;;;; +1CF4;VEDIC TONE CANDRA ABOVE;Mn;230;NSM;;;;;N;;;;; +1CF5;VEDIC SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;; +1CF6;VEDIC SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;; +1CF7;VEDIC SIGN ATIKRAMA;Mc;0;L;;;;;N;;;;; +1CF8;VEDIC TONE RING ABOVE;Mn;230;NSM;;;;;N;;;;; +1CF9;VEDIC TONE DOUBLE RING ABOVE;Mn;230;NSM;;;;;N;;;;; +1D00;LATIN LETTER SMALL CAPITAL A;Ll;0;L;;;;;N;;;;; +1D01;LATIN LETTER SMALL CAPITAL AE;Ll;0;L;;;;;N;;;;; +1D02;LATIN SMALL LETTER TURNED AE;Ll;0;L;;;;;N;;;;; +1D03;LATIN LETTER SMALL CAPITAL BARRED B;Ll;0;L;;;;;N;;;;; +1D04;LATIN LETTER SMALL CAPITAL C;Ll;0;L;;;;;N;;;;; +1D05;LATIN LETTER SMALL CAPITAL D;Ll;0;L;;;;;N;;;;; +1D06;LATIN LETTER SMALL CAPITAL ETH;Ll;0;L;;;;;N;;;;; +1D07;LATIN LETTER SMALL CAPITAL E;Ll;0;L;;;;;N;;;;; +1D08;LATIN SMALL LETTER TURNED OPEN E;Ll;0;L;;;;;N;;;;; +1D09;LATIN SMALL LETTER TURNED I;Ll;0;L;;;;;N;;;;; +1D0A;LATIN LETTER SMALL CAPITAL J;Ll;0;L;;;;;N;;;;; +1D0B;LATIN LETTER SMALL CAPITAL K;Ll;0;L;;;;;N;;;;; +1D0C;LATIN LETTER SMALL CAPITAL L WITH STROKE;Ll;0;L;;;;;N;;;;; +1D0D;LATIN LETTER SMALL CAPITAL M;Ll;0;L;;;;;N;;;;; +1D0E;LATIN LETTER SMALL CAPITAL REVERSED N;Ll;0;L;;;;;N;;;;; +1D0F;LATIN LETTER SMALL CAPITAL O;Ll;0;L;;;;;N;;;;; +1D10;LATIN LETTER SMALL CAPITAL OPEN O;Ll;0;L;;;;;N;;;;; +1D11;LATIN SMALL LETTER SIDEWAYS O;Ll;0;L;;;;;N;;;;; +1D12;LATIN SMALL LETTER SIDEWAYS OPEN O;Ll;0;L;;;;;N;;;;; +1D13;LATIN SMALL LETTER SIDEWAYS O WITH STROKE;Ll;0;L;;;;;N;;;;; +1D14;LATIN SMALL LETTER TURNED OE;Ll;0;L;;;;;N;;;;; +1D15;LATIN LETTER SMALL CAPITAL OU;Ll;0;L;;;;;N;;;;; +1D16;LATIN SMALL LETTER TOP HALF O;Ll;0;L;;;;;N;;;;; +1D17;LATIN SMALL LETTER BOTTOM HALF O;Ll;0;L;;;;;N;;;;; +1D18;LATIN LETTER SMALL CAPITAL P;Ll;0;L;;;;;N;;;;; +1D19;LATIN LETTER SMALL CAPITAL REVERSED R;Ll;0;L;;;;;N;;;;; +1D1A;LATIN LETTER SMALL CAPITAL TURNED R;Ll;0;L;;;;;N;;;;; +1D1B;LATIN LETTER SMALL CAPITAL T;Ll;0;L;;;;;N;;;;; +1D1C;LATIN LETTER SMALL CAPITAL U;Ll;0;L;;;;;N;;;;; +1D1D;LATIN SMALL LETTER SIDEWAYS U;Ll;0;L;;;;;N;;;;; +1D1E;LATIN SMALL LETTER SIDEWAYS DIAERESIZED U;Ll;0;L;;;;;N;;;;; +1D1F;LATIN SMALL LETTER SIDEWAYS TURNED M;Ll;0;L;;;;;N;;;;; +1D20;LATIN LETTER SMALL CAPITAL V;Ll;0;L;;;;;N;;;;; +1D21;LATIN LETTER SMALL CAPITAL W;Ll;0;L;;;;;N;;;;; +1D22;LATIN LETTER SMALL CAPITAL Z;Ll;0;L;;;;;N;;;;; +1D23;LATIN LETTER SMALL CAPITAL EZH;Ll;0;L;;;;;N;;;;; +1D24;LATIN LETTER VOICED LARYNGEAL SPIRANT;Ll;0;L;;;;;N;;;;; +1D25;LATIN LETTER AIN;Ll;0;L;;;;;N;;;;; +1D26;GREEK LETTER SMALL CAPITAL GAMMA;Ll;0;L;;;;;N;;;;; +1D27;GREEK LETTER SMALL CAPITAL LAMDA;Ll;0;L;;;;;N;;;;; +1D28;GREEK LETTER SMALL CAPITAL PI;Ll;0;L;;;;;N;;;;; +1D29;GREEK LETTER SMALL CAPITAL RHO;Ll;0;L;;;;;N;;;;; +1D2A;GREEK LETTER SMALL CAPITAL PSI;Ll;0;L;;;;;N;;;;; +1D2B;CYRILLIC LETTER SMALL CAPITAL EL;Ll;0;L;;;;;N;;;;; +1D2C;MODIFIER LETTER CAPITAL A;Lm;0;L;<super> 0041;;;;N;;;;; +1D2D;MODIFIER LETTER CAPITAL AE;Lm;0;L;<super> 00C6;;;;N;;;;; +1D2E;MODIFIER LETTER CAPITAL B;Lm;0;L;<super> 0042;;;;N;;;;; +1D2F;MODIFIER LETTER CAPITAL BARRED B;Lm;0;L;;;;;N;;;;; +1D30;MODIFIER LETTER CAPITAL D;Lm;0;L;<super> 0044;;;;N;;;;; +1D31;MODIFIER LETTER CAPITAL E;Lm;0;L;<super> 0045;;;;N;;;;; +1D32;MODIFIER LETTER CAPITAL REVERSED E;Lm;0;L;<super> 018E;;;;N;;;;; +1D33;MODIFIER LETTER CAPITAL G;Lm;0;L;<super> 0047;;;;N;;;;; +1D34;MODIFIER LETTER CAPITAL H;Lm;0;L;<super> 0048;;;;N;;;;; +1D35;MODIFIER LETTER CAPITAL I;Lm;0;L;<super> 0049;;;;N;;;;; +1D36;MODIFIER LETTER CAPITAL J;Lm;0;L;<super> 004A;;;;N;;;;; +1D37;MODIFIER LETTER CAPITAL K;Lm;0;L;<super> 004B;;;;N;;;;; +1D38;MODIFIER LETTER CAPITAL L;Lm;0;L;<super> 004C;;;;N;;;;; +1D39;MODIFIER LETTER CAPITAL M;Lm;0;L;<super> 004D;;;;N;;;;; +1D3A;MODIFIER LETTER CAPITAL N;Lm;0;L;<super> 004E;;;;N;;;;; +1D3B;MODIFIER LETTER CAPITAL REVERSED N;Lm;0;L;;;;;N;;;;; +1D3C;MODIFIER LETTER CAPITAL O;Lm;0;L;<super> 004F;;;;N;;;;; +1D3D;MODIFIER LETTER CAPITAL OU;Lm;0;L;<super> 0222;;;;N;;;;; +1D3E;MODIFIER LETTER CAPITAL P;Lm;0;L;<super> 0050;;;;N;;;;; +1D3F;MODIFIER LETTER CAPITAL R;Lm;0;L;<super> 0052;;;;N;;;;; +1D40;MODIFIER LETTER CAPITAL T;Lm;0;L;<super> 0054;;;;N;;;;; +1D41;MODIFIER LETTER CAPITAL U;Lm;0;L;<super> 0055;;;;N;;;;; +1D42;MODIFIER LETTER CAPITAL W;Lm;0;L;<super> 0057;;;;N;;;;; +1D43;MODIFIER LETTER SMALL A;Lm;0;L;<super> 0061;;;;N;;;;; +1D44;MODIFIER LETTER SMALL TURNED A;Lm;0;L;<super> 0250;;;;N;;;;; +1D45;MODIFIER LETTER SMALL ALPHA;Lm;0;L;<super> 0251;;;;N;;;;; +1D46;MODIFIER LETTER SMALL TURNED AE;Lm;0;L;<super> 1D02;;;;N;;;;; +1D47;MODIFIER LETTER SMALL B;Lm;0;L;<super> 0062;;;;N;;;;; +1D48;MODIFIER LETTER SMALL D;Lm;0;L;<super> 0064;;;;N;;;;; +1D49;MODIFIER LETTER SMALL E;Lm;0;L;<super> 0065;;;;N;;;;; +1D4A;MODIFIER LETTER SMALL SCHWA;Lm;0;L;<super> 0259;;;;N;;;;; +1D4B;MODIFIER LETTER SMALL OPEN E;Lm;0;L;<super> 025B;;;;N;;;;; +1D4C;MODIFIER LETTER SMALL TURNED OPEN E;Lm;0;L;<super> 025C;;;;N;;;;; +1D4D;MODIFIER LETTER SMALL G;Lm;0;L;<super> 0067;;;;N;;;;; +1D4E;MODIFIER LETTER SMALL TURNED I;Lm;0;L;;;;;N;;;;; +1D4F;MODIFIER LETTER SMALL K;Lm;0;L;<super> 006B;;;;N;;;;; +1D50;MODIFIER LETTER SMALL M;Lm;0;L;<super> 006D;;;;N;;;;; +1D51;MODIFIER LETTER SMALL ENG;Lm;0;L;<super> 014B;;;;N;;;;; +1D52;MODIFIER LETTER SMALL O;Lm;0;L;<super> 006F;;;;N;;;;; +1D53;MODIFIER LETTER SMALL OPEN O;Lm;0;L;<super> 0254;;;;N;;;;; +1D54;MODIFIER LETTER SMALL TOP HALF O;Lm;0;L;<super> 1D16;;;;N;;;;; +1D55;MODIFIER LETTER SMALL BOTTOM HALF O;Lm;0;L;<super> 1D17;;;;N;;;;; +1D56;MODIFIER LETTER SMALL P;Lm;0;L;<super> 0070;;;;N;;;;; +1D57;MODIFIER LETTER SMALL T;Lm;0;L;<super> 0074;;;;N;;;;; +1D58;MODIFIER LETTER SMALL U;Lm;0;L;<super> 0075;;;;N;;;;; +1D59;MODIFIER LETTER SMALL SIDEWAYS U;Lm;0;L;<super> 1D1D;;;;N;;;;; +1D5A;MODIFIER LETTER SMALL TURNED M;Lm;0;L;<super> 026F;;;;N;;;;; +1D5B;MODIFIER LETTER SMALL V;Lm;0;L;<super> 0076;;;;N;;;;; +1D5C;MODIFIER LETTER SMALL AIN;Lm;0;L;<super> 1D25;;;;N;;;;; +1D5D;MODIFIER LETTER SMALL BETA;Lm;0;L;<super> 03B2;;;;N;;;;; +1D5E;MODIFIER LETTER SMALL GREEK GAMMA;Lm;0;L;<super> 03B3;;;;N;;;;; +1D5F;MODIFIER LETTER SMALL DELTA;Lm;0;L;<super> 03B4;;;;N;;;;; +1D60;MODIFIER LETTER SMALL GREEK PHI;Lm;0;L;<super> 03C6;;;;N;;;;; +1D61;MODIFIER LETTER SMALL CHI;Lm;0;L;<super> 03C7;;;;N;;;;; +1D62;LATIN SUBSCRIPT SMALL LETTER I;Lm;0;L;<sub> 0069;;;;N;;;;; +1D63;LATIN SUBSCRIPT SMALL LETTER R;Lm;0;L;<sub> 0072;;;;N;;;;; +1D64;LATIN SUBSCRIPT SMALL LETTER U;Lm;0;L;<sub> 0075;;;;N;;;;; +1D65;LATIN SUBSCRIPT SMALL LETTER V;Lm;0;L;<sub> 0076;;;;N;;;;; +1D66;GREEK SUBSCRIPT SMALL LETTER BETA;Lm;0;L;<sub> 03B2;;;;N;;;;; +1D67;GREEK SUBSCRIPT SMALL LETTER GAMMA;Lm;0;L;<sub> 03B3;;;;N;;;;; +1D68;GREEK SUBSCRIPT SMALL LETTER RHO;Lm;0;L;<sub> 03C1;;;;N;;;;; +1D69;GREEK SUBSCRIPT SMALL LETTER PHI;Lm;0;L;<sub> 03C6;;;;N;;;;; +1D6A;GREEK SUBSCRIPT SMALL LETTER CHI;Lm;0;L;<sub> 03C7;;;;N;;;;; +1D6B;LATIN SMALL LETTER UE;Ll;0;L;;;;;N;;;;; +1D6C;LATIN SMALL LETTER B WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D6D;LATIN SMALL LETTER D WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D6E;LATIN SMALL LETTER F WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D6F;LATIN SMALL LETTER M WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D70;LATIN SMALL LETTER N WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D71;LATIN SMALL LETTER P WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D72;LATIN SMALL LETTER R WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D73;LATIN SMALL LETTER R WITH FISHHOOK AND MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D74;LATIN SMALL LETTER S WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D75;LATIN SMALL LETTER T WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D76;LATIN SMALL LETTER Z WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +1D77;LATIN SMALL LETTER TURNED G;Ll;0;L;;;;;N;;;;; +1D78;MODIFIER LETTER CYRILLIC EN;Lm;0;L;<super> 043D;;;;N;;;;; +1D79;LATIN SMALL LETTER INSULAR G;Ll;0;L;;;;;N;;;A77D;;A77D +1D7A;LATIN SMALL LETTER TH WITH STRIKETHROUGH;Ll;0;L;;;;;N;;;;; +1D7B;LATIN SMALL CAPITAL LETTER I WITH STROKE;Ll;0;L;;;;;N;;;;; +1D7C;LATIN SMALL LETTER IOTA WITH STROKE;Ll;0;L;;;;;N;;;;; +1D7D;LATIN SMALL LETTER P WITH STROKE;Ll;0;L;;;;;N;;;2C63;;2C63 +1D7E;LATIN SMALL CAPITAL LETTER U WITH STROKE;Ll;0;L;;;;;N;;;;; +1D7F;LATIN SMALL LETTER UPSILON WITH STROKE;Ll;0;L;;;;;N;;;;; +1D80;LATIN SMALL LETTER B WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D81;LATIN SMALL LETTER D WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D82;LATIN SMALL LETTER F WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D83;LATIN SMALL LETTER G WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D84;LATIN SMALL LETTER K WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D85;LATIN SMALL LETTER L WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D86;LATIN SMALL LETTER M WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D87;LATIN SMALL LETTER N WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D88;LATIN SMALL LETTER P WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D89;LATIN SMALL LETTER R WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D8A;LATIN SMALL LETTER S WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D8B;LATIN SMALL LETTER ESH WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D8C;LATIN SMALL LETTER V WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D8D;LATIN SMALL LETTER X WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D8E;LATIN SMALL LETTER Z WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +1D8F;LATIN SMALL LETTER A WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D90;LATIN SMALL LETTER ALPHA WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D91;LATIN SMALL LETTER D WITH HOOK AND TAIL;Ll;0;L;;;;;N;;;;; +1D92;LATIN SMALL LETTER E WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D93;LATIN SMALL LETTER OPEN E WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D94;LATIN SMALL LETTER REVERSED OPEN E WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D95;LATIN SMALL LETTER SCHWA WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D96;LATIN SMALL LETTER I WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D97;LATIN SMALL LETTER OPEN O WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D98;LATIN SMALL LETTER ESH WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D99;LATIN SMALL LETTER U WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D9A;LATIN SMALL LETTER EZH WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;; +1D9B;MODIFIER LETTER SMALL TURNED ALPHA;Lm;0;L;<super> 0252;;;;N;;;;; +1D9C;MODIFIER LETTER SMALL C;Lm;0;L;<super> 0063;;;;N;;;;; +1D9D;MODIFIER LETTER SMALL C WITH CURL;Lm;0;L;<super> 0255;;;;N;;;;; +1D9E;MODIFIER LETTER SMALL ETH;Lm;0;L;<super> 00F0;;;;N;;;;; +1D9F;MODIFIER LETTER SMALL REVERSED OPEN E;Lm;0;L;<super> 025C;;;;N;;;;; +1DA0;MODIFIER LETTER SMALL F;Lm;0;L;<super> 0066;;;;N;;;;; +1DA1;MODIFIER LETTER SMALL DOTLESS J WITH STROKE;Lm;0;L;<super> 025F;;;;N;;;;; +1DA2;MODIFIER LETTER SMALL SCRIPT G;Lm;0;L;<super> 0261;;;;N;;;;; +1DA3;MODIFIER LETTER SMALL TURNED H;Lm;0;L;<super> 0265;;;;N;;;;; +1DA4;MODIFIER LETTER SMALL I WITH STROKE;Lm;0;L;<super> 0268;;;;N;;;;; +1DA5;MODIFIER LETTER SMALL IOTA;Lm;0;L;<super> 0269;;;;N;;;;; +1DA6;MODIFIER LETTER SMALL CAPITAL I;Lm;0;L;<super> 026A;;;;N;;;;; +1DA7;MODIFIER LETTER SMALL CAPITAL I WITH STROKE;Lm;0;L;<super> 1D7B;;;;N;;;;; +1DA8;MODIFIER LETTER SMALL J WITH CROSSED-TAIL;Lm;0;L;<super> 029D;;;;N;;;;; +1DA9;MODIFIER LETTER SMALL L WITH RETROFLEX HOOK;Lm;0;L;<super> 026D;;;;N;;;;; +1DAA;MODIFIER LETTER SMALL L WITH PALATAL HOOK;Lm;0;L;<super> 1D85;;;;N;;;;; +1DAB;MODIFIER LETTER SMALL CAPITAL L;Lm;0;L;<super> 029F;;;;N;;;;; +1DAC;MODIFIER LETTER SMALL M WITH HOOK;Lm;0;L;<super> 0271;;;;N;;;;; +1DAD;MODIFIER LETTER SMALL TURNED M WITH LONG LEG;Lm;0;L;<super> 0270;;;;N;;;;; +1DAE;MODIFIER LETTER SMALL N WITH LEFT HOOK;Lm;0;L;<super> 0272;;;;N;;;;; +1DAF;MODIFIER LETTER SMALL N WITH RETROFLEX HOOK;Lm;0;L;<super> 0273;;;;N;;;;; +1DB0;MODIFIER LETTER SMALL CAPITAL N;Lm;0;L;<super> 0274;;;;N;;;;; +1DB1;MODIFIER LETTER SMALL BARRED O;Lm;0;L;<super> 0275;;;;N;;;;; +1DB2;MODIFIER LETTER SMALL PHI;Lm;0;L;<super> 0278;;;;N;;;;; +1DB3;MODIFIER LETTER SMALL S WITH HOOK;Lm;0;L;<super> 0282;;;;N;;;;; +1DB4;MODIFIER LETTER SMALL ESH;Lm;0;L;<super> 0283;;;;N;;;;; +1DB5;MODIFIER LETTER SMALL T WITH PALATAL HOOK;Lm;0;L;<super> 01AB;;;;N;;;;; +1DB6;MODIFIER LETTER SMALL U BAR;Lm;0;L;<super> 0289;;;;N;;;;; +1DB7;MODIFIER LETTER SMALL UPSILON;Lm;0;L;<super> 028A;;;;N;;;;; +1DB8;MODIFIER LETTER SMALL CAPITAL U;Lm;0;L;<super> 1D1C;;;;N;;;;; +1DB9;MODIFIER LETTER SMALL V WITH HOOK;Lm;0;L;<super> 028B;;;;N;;;;; +1DBA;MODIFIER LETTER SMALL TURNED V;Lm;0;L;<super> 028C;;;;N;;;;; +1DBB;MODIFIER LETTER SMALL Z;Lm;0;L;<super> 007A;;;;N;;;;; +1DBC;MODIFIER LETTER SMALL Z WITH RETROFLEX HOOK;Lm;0;L;<super> 0290;;;;N;;;;; +1DBD;MODIFIER LETTER SMALL Z WITH CURL;Lm;0;L;<super> 0291;;;;N;;;;; +1DBE;MODIFIER LETTER SMALL EZH;Lm;0;L;<super> 0292;;;;N;;;;; +1DBF;MODIFIER LETTER SMALL THETA;Lm;0;L;<super> 03B8;;;;N;;;;; +1DC0;COMBINING DOTTED GRAVE ACCENT;Mn;230;NSM;;;;;N;;;;; +1DC1;COMBINING DOTTED ACUTE ACCENT;Mn;230;NSM;;;;;N;;;;; +1DC2;COMBINING SNAKE BELOW;Mn;220;NSM;;;;;N;;;;; +1DC3;COMBINING SUSPENSION MARK;Mn;230;NSM;;;;;N;;;;; +1DC4;COMBINING MACRON-ACUTE;Mn;230;NSM;;;;;N;;;;; +1DC5;COMBINING GRAVE-MACRON;Mn;230;NSM;;;;;N;;;;; +1DC6;COMBINING MACRON-GRAVE;Mn;230;NSM;;;;;N;;;;; +1DC7;COMBINING ACUTE-MACRON;Mn;230;NSM;;;;;N;;;;; +1DC8;COMBINING GRAVE-ACUTE-GRAVE;Mn;230;NSM;;;;;N;;;;; +1DC9;COMBINING ACUTE-GRAVE-ACUTE;Mn;230;NSM;;;;;N;;;;; +1DCA;COMBINING LATIN SMALL LETTER R BELOW;Mn;220;NSM;;;;;N;;;;; +1DCB;COMBINING BREVE-MACRON;Mn;230;NSM;;;;;N;;;;; +1DCC;COMBINING MACRON-BREVE;Mn;230;NSM;;;;;N;;;;; +1DCD;COMBINING DOUBLE CIRCUMFLEX ABOVE;Mn;234;NSM;;;;;N;;;;; +1DCE;COMBINING OGONEK ABOVE;Mn;214;NSM;;;;;N;;;;; +1DCF;COMBINING ZIGZAG BELOW;Mn;220;NSM;;;;;N;;;;; +1DD0;COMBINING IS BELOW;Mn;202;NSM;;;;;N;;;;; +1DD1;COMBINING UR ABOVE;Mn;230;NSM;;;;;N;;;;; +1DD2;COMBINING US ABOVE;Mn;230;NSM;;;;;N;;;;; +1DD3;COMBINING LATIN SMALL LETTER FLATTENED OPEN A ABOVE;Mn;230;NSM;;;;;N;;;;; +1DD4;COMBINING LATIN SMALL LETTER AE;Mn;230;NSM;;;;;N;;;;; +1DD5;COMBINING LATIN SMALL LETTER AO;Mn;230;NSM;;;;;N;;;;; +1DD6;COMBINING LATIN SMALL LETTER AV;Mn;230;NSM;;;;;N;;;;; +1DD7;COMBINING LATIN SMALL LETTER C CEDILLA;Mn;230;NSM;;;;;N;;;;; +1DD8;COMBINING LATIN SMALL LETTER INSULAR D;Mn;230;NSM;;;;;N;;;;; +1DD9;COMBINING LATIN SMALL LETTER ETH;Mn;230;NSM;;;;;N;;;;; +1DDA;COMBINING LATIN SMALL LETTER G;Mn;230;NSM;;;;;N;;;;; +1DDB;COMBINING LATIN LETTER SMALL CAPITAL G;Mn;230;NSM;;;;;N;;;;; +1DDC;COMBINING LATIN SMALL LETTER K;Mn;230;NSM;;;;;N;;;;; +1DDD;COMBINING LATIN SMALL LETTER L;Mn;230;NSM;;;;;N;;;;; +1DDE;COMBINING LATIN LETTER SMALL CAPITAL L;Mn;230;NSM;;;;;N;;;;; +1DDF;COMBINING LATIN LETTER SMALL CAPITAL M;Mn;230;NSM;;;;;N;;;;; +1DE0;COMBINING LATIN SMALL LETTER N;Mn;230;NSM;;;;;N;;;;; +1DE1;COMBINING LATIN LETTER SMALL CAPITAL N;Mn;230;NSM;;;;;N;;;;; +1DE2;COMBINING LATIN LETTER SMALL CAPITAL R;Mn;230;NSM;;;;;N;;;;; +1DE3;COMBINING LATIN SMALL LETTER R ROTUNDA;Mn;230;NSM;;;;;N;;;;; +1DE4;COMBINING LATIN SMALL LETTER S;Mn;230;NSM;;;;;N;;;;; +1DE5;COMBINING LATIN SMALL LETTER LONG S;Mn;230;NSM;;;;;N;;;;; +1DE6;COMBINING LATIN SMALL LETTER Z;Mn;230;NSM;;;;;N;;;;; +1DE7;COMBINING LATIN SMALL LETTER ALPHA;Mn;230;NSM;;;;;N;;;;; +1DE8;COMBINING LATIN SMALL LETTER B;Mn;230;NSM;;;;;N;;;;; +1DE9;COMBINING LATIN SMALL LETTER BETA;Mn;230;NSM;;;;;N;;;;; +1DEA;COMBINING LATIN SMALL LETTER SCHWA;Mn;230;NSM;;;;;N;;;;; +1DEB;COMBINING LATIN SMALL LETTER F;Mn;230;NSM;;;;;N;;;;; +1DEC;COMBINING LATIN SMALL LETTER L WITH DOUBLE MIDDLE TILDE;Mn;230;NSM;;;;;N;;;;; +1DED;COMBINING LATIN SMALL LETTER O WITH LIGHT CENTRALIZATION STROKE;Mn;230;NSM;;;;;N;;;;; +1DEE;COMBINING LATIN SMALL LETTER P;Mn;230;NSM;;;;;N;;;;; +1DEF;COMBINING LATIN SMALL LETTER ESH;Mn;230;NSM;;;;;N;;;;; +1DF0;COMBINING LATIN SMALL LETTER U WITH LIGHT CENTRALIZATION STROKE;Mn;230;NSM;;;;;N;;;;; +1DF1;COMBINING LATIN SMALL LETTER W;Mn;230;NSM;;;;;N;;;;; +1DF2;COMBINING LATIN SMALL LETTER A WITH DIAERESIS;Mn;230;NSM;;;;;N;;;;; +1DF3;COMBINING LATIN SMALL LETTER O WITH DIAERESIS;Mn;230;NSM;;;;;N;;;;; +1DF4;COMBINING LATIN SMALL LETTER U WITH DIAERESIS;Mn;230;NSM;;;;;N;;;;; +1DF5;COMBINING UP TACK ABOVE;Mn;230;NSM;;;;;N;;;;; +1DF6;COMBINING KAVYKA ABOVE RIGHT;Mn;232;NSM;;;;;N;;;;; +1DF7;COMBINING KAVYKA ABOVE LEFT;Mn;228;NSM;;;;;N;;;;; +1DF8;COMBINING DOT ABOVE LEFT;Mn;228;NSM;;;;;N;;;;; +1DF9;COMBINING WIDE INVERTED BRIDGE BELOW;Mn;220;NSM;;;;;N;;;;; +1DFB;COMBINING DELETION MARK;Mn;230;NSM;;;;;N;;;;; +1DFC;COMBINING DOUBLE INVERTED BREVE BELOW;Mn;233;NSM;;;;;N;;;;; +1DFD;COMBINING ALMOST EQUAL TO BELOW;Mn;220;NSM;;;;;N;;;;; +1DFE;COMBINING LEFT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;; +1DFF;COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;; +1E00;LATIN CAPITAL LETTER A WITH RING BELOW;Lu;0;L;0041 0325;;;;N;;;;1E01; +1E01;LATIN SMALL LETTER A WITH RING BELOW;Ll;0;L;0061 0325;;;;N;;;1E00;;1E00 +1E02;LATIN CAPITAL LETTER B WITH DOT ABOVE;Lu;0;L;0042 0307;;;;N;;;;1E03; +1E03;LATIN SMALL LETTER B WITH DOT ABOVE;Ll;0;L;0062 0307;;;;N;;;1E02;;1E02 +1E04;LATIN CAPITAL LETTER B WITH DOT BELOW;Lu;0;L;0042 0323;;;;N;;;;1E05; +1E05;LATIN SMALL LETTER B WITH DOT BELOW;Ll;0;L;0062 0323;;;;N;;;1E04;;1E04 +1E06;LATIN CAPITAL LETTER B WITH LINE BELOW;Lu;0;L;0042 0331;;;;N;;;;1E07; +1E07;LATIN SMALL LETTER B WITH LINE BELOW;Ll;0;L;0062 0331;;;;N;;;1E06;;1E06 +1E08;LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE;Lu;0;L;00C7 0301;;;;N;;;;1E09; +1E09;LATIN SMALL LETTER C WITH CEDILLA AND ACUTE;Ll;0;L;00E7 0301;;;;N;;;1E08;;1E08 +1E0A;LATIN CAPITAL LETTER D WITH DOT ABOVE;Lu;0;L;0044 0307;;;;N;;;;1E0B; +1E0B;LATIN SMALL LETTER D WITH DOT ABOVE;Ll;0;L;0064 0307;;;;N;;;1E0A;;1E0A +1E0C;LATIN CAPITAL LETTER D WITH DOT BELOW;Lu;0;L;0044 0323;;;;N;;;;1E0D; +1E0D;LATIN SMALL LETTER D WITH DOT BELOW;Ll;0;L;0064 0323;;;;N;;;1E0C;;1E0C +1E0E;LATIN CAPITAL LETTER D WITH LINE BELOW;Lu;0;L;0044 0331;;;;N;;;;1E0F; +1E0F;LATIN SMALL LETTER D WITH LINE BELOW;Ll;0;L;0064 0331;;;;N;;;1E0E;;1E0E +1E10;LATIN CAPITAL LETTER D WITH CEDILLA;Lu;0;L;0044 0327;;;;N;;;;1E11; +1E11;LATIN SMALL LETTER D WITH CEDILLA;Ll;0;L;0064 0327;;;;N;;;1E10;;1E10 +1E12;LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW;Lu;0;L;0044 032D;;;;N;;;;1E13; +1E13;LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW;Ll;0;L;0064 032D;;;;N;;;1E12;;1E12 +1E14;LATIN CAPITAL LETTER E WITH MACRON AND GRAVE;Lu;0;L;0112 0300;;;;N;;;;1E15; +1E15;LATIN SMALL LETTER E WITH MACRON AND GRAVE;Ll;0;L;0113 0300;;;;N;;;1E14;;1E14 +1E16;LATIN CAPITAL LETTER E WITH MACRON AND ACUTE;Lu;0;L;0112 0301;;;;N;;;;1E17; +1E17;LATIN SMALL LETTER E WITH MACRON AND ACUTE;Ll;0;L;0113 0301;;;;N;;;1E16;;1E16 +1E18;LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW;Lu;0;L;0045 032D;;;;N;;;;1E19; +1E19;LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW;Ll;0;L;0065 032D;;;;N;;;1E18;;1E18 +1E1A;LATIN CAPITAL LETTER E WITH TILDE BELOW;Lu;0;L;0045 0330;;;;N;;;;1E1B; +1E1B;LATIN SMALL LETTER E WITH TILDE BELOW;Ll;0;L;0065 0330;;;;N;;;1E1A;;1E1A +1E1C;LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE;Lu;0;L;0228 0306;;;;N;;;;1E1D; +1E1D;LATIN SMALL LETTER E WITH CEDILLA AND BREVE;Ll;0;L;0229 0306;;;;N;;;1E1C;;1E1C +1E1E;LATIN CAPITAL LETTER F WITH DOT ABOVE;Lu;0;L;0046 0307;;;;N;;;;1E1F; +1E1F;LATIN SMALL LETTER F WITH DOT ABOVE;Ll;0;L;0066 0307;;;;N;;;1E1E;;1E1E +1E20;LATIN CAPITAL LETTER G WITH MACRON;Lu;0;L;0047 0304;;;;N;;;;1E21; +1E21;LATIN SMALL LETTER G WITH MACRON;Ll;0;L;0067 0304;;;;N;;;1E20;;1E20 +1E22;LATIN CAPITAL LETTER H WITH DOT ABOVE;Lu;0;L;0048 0307;;;;N;;;;1E23; +1E23;LATIN SMALL LETTER H WITH DOT ABOVE;Ll;0;L;0068 0307;;;;N;;;1E22;;1E22 +1E24;LATIN CAPITAL LETTER H WITH DOT BELOW;Lu;0;L;0048 0323;;;;N;;;;1E25; +1E25;LATIN SMALL LETTER H WITH DOT BELOW;Ll;0;L;0068 0323;;;;N;;;1E24;;1E24 +1E26;LATIN CAPITAL LETTER H WITH DIAERESIS;Lu;0;L;0048 0308;;;;N;;;;1E27; +1E27;LATIN SMALL LETTER H WITH DIAERESIS;Ll;0;L;0068 0308;;;;N;;;1E26;;1E26 +1E28;LATIN CAPITAL LETTER H WITH CEDILLA;Lu;0;L;0048 0327;;;;N;;;;1E29; +1E29;LATIN SMALL LETTER H WITH CEDILLA;Ll;0;L;0068 0327;;;;N;;;1E28;;1E28 +1E2A;LATIN CAPITAL LETTER H WITH BREVE BELOW;Lu;0;L;0048 032E;;;;N;;;;1E2B; +1E2B;LATIN SMALL LETTER H WITH BREVE BELOW;Ll;0;L;0068 032E;;;;N;;;1E2A;;1E2A +1E2C;LATIN CAPITAL LETTER I WITH TILDE BELOW;Lu;0;L;0049 0330;;;;N;;;;1E2D; +1E2D;LATIN SMALL LETTER I WITH TILDE BELOW;Ll;0;L;0069 0330;;;;N;;;1E2C;;1E2C +1E2E;LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE;Lu;0;L;00CF 0301;;;;N;;;;1E2F; +1E2F;LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE;Ll;0;L;00EF 0301;;;;N;;;1E2E;;1E2E +1E30;LATIN CAPITAL LETTER K WITH ACUTE;Lu;0;L;004B 0301;;;;N;;;;1E31; +1E31;LATIN SMALL LETTER K WITH ACUTE;Ll;0;L;006B 0301;;;;N;;;1E30;;1E30 +1E32;LATIN CAPITAL LETTER K WITH DOT BELOW;Lu;0;L;004B 0323;;;;N;;;;1E33; +1E33;LATIN SMALL LETTER K WITH DOT BELOW;Ll;0;L;006B 0323;;;;N;;;1E32;;1E32 +1E34;LATIN CAPITAL LETTER K WITH LINE BELOW;Lu;0;L;004B 0331;;;;N;;;;1E35; +1E35;LATIN SMALL LETTER K WITH LINE BELOW;Ll;0;L;006B 0331;;;;N;;;1E34;;1E34 +1E36;LATIN CAPITAL LETTER L WITH DOT BELOW;Lu;0;L;004C 0323;;;;N;;;;1E37; +1E37;LATIN SMALL LETTER L WITH DOT BELOW;Ll;0;L;006C 0323;;;;N;;;1E36;;1E36 +1E38;LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON;Lu;0;L;1E36 0304;;;;N;;;;1E39; +1E39;LATIN SMALL LETTER L WITH DOT BELOW AND MACRON;Ll;0;L;1E37 0304;;;;N;;;1E38;;1E38 +1E3A;LATIN CAPITAL LETTER L WITH LINE BELOW;Lu;0;L;004C 0331;;;;N;;;;1E3B; +1E3B;LATIN SMALL LETTER L WITH LINE BELOW;Ll;0;L;006C 0331;;;;N;;;1E3A;;1E3A +1E3C;LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW;Lu;0;L;004C 032D;;;;N;;;;1E3D; +1E3D;LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW;Ll;0;L;006C 032D;;;;N;;;1E3C;;1E3C +1E3E;LATIN CAPITAL LETTER M WITH ACUTE;Lu;0;L;004D 0301;;;;N;;;;1E3F; +1E3F;LATIN SMALL LETTER M WITH ACUTE;Ll;0;L;006D 0301;;;;N;;;1E3E;;1E3E +1E40;LATIN CAPITAL LETTER M WITH DOT ABOVE;Lu;0;L;004D 0307;;;;N;;;;1E41; +1E41;LATIN SMALL LETTER M WITH DOT ABOVE;Ll;0;L;006D 0307;;;;N;;;1E40;;1E40 +1E42;LATIN CAPITAL LETTER M WITH DOT BELOW;Lu;0;L;004D 0323;;;;N;;;;1E43; +1E43;LATIN SMALL LETTER M WITH DOT BELOW;Ll;0;L;006D 0323;;;;N;;;1E42;;1E42 +1E44;LATIN CAPITAL LETTER N WITH DOT ABOVE;Lu;0;L;004E 0307;;;;N;;;;1E45; +1E45;LATIN SMALL LETTER N WITH DOT ABOVE;Ll;0;L;006E 0307;;;;N;;;1E44;;1E44 +1E46;LATIN CAPITAL LETTER N WITH DOT BELOW;Lu;0;L;004E 0323;;;;N;;;;1E47; +1E47;LATIN SMALL LETTER N WITH DOT BELOW;Ll;0;L;006E 0323;;;;N;;;1E46;;1E46 +1E48;LATIN CAPITAL LETTER N WITH LINE BELOW;Lu;0;L;004E 0331;;;;N;;;;1E49; +1E49;LATIN SMALL LETTER N WITH LINE BELOW;Ll;0;L;006E 0331;;;;N;;;1E48;;1E48 +1E4A;LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW;Lu;0;L;004E 032D;;;;N;;;;1E4B; +1E4B;LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW;Ll;0;L;006E 032D;;;;N;;;1E4A;;1E4A +1E4C;LATIN CAPITAL LETTER O WITH TILDE AND ACUTE;Lu;0;L;00D5 0301;;;;N;;;;1E4D; +1E4D;LATIN SMALL LETTER O WITH TILDE AND ACUTE;Ll;0;L;00F5 0301;;;;N;;;1E4C;;1E4C +1E4E;LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS;Lu;0;L;00D5 0308;;;;N;;;;1E4F; +1E4F;LATIN SMALL LETTER O WITH TILDE AND DIAERESIS;Ll;0;L;00F5 0308;;;;N;;;1E4E;;1E4E +1E50;LATIN CAPITAL LETTER O WITH MACRON AND GRAVE;Lu;0;L;014C 0300;;;;N;;;;1E51; +1E51;LATIN SMALL LETTER O WITH MACRON AND GRAVE;Ll;0;L;014D 0300;;;;N;;;1E50;;1E50 +1E52;LATIN CAPITAL LETTER O WITH MACRON AND ACUTE;Lu;0;L;014C 0301;;;;N;;;;1E53; +1E53;LATIN SMALL LETTER O WITH MACRON AND ACUTE;Ll;0;L;014D 0301;;;;N;;;1E52;;1E52 +1E54;LATIN CAPITAL LETTER P WITH ACUTE;Lu;0;L;0050 0301;;;;N;;;;1E55; +1E55;LATIN SMALL LETTER P WITH ACUTE;Ll;0;L;0070 0301;;;;N;;;1E54;;1E54 +1E56;LATIN CAPITAL LETTER P WITH DOT ABOVE;Lu;0;L;0050 0307;;;;N;;;;1E57; +1E57;LATIN SMALL LETTER P WITH DOT ABOVE;Ll;0;L;0070 0307;;;;N;;;1E56;;1E56 +1E58;LATIN CAPITAL LETTER R WITH DOT ABOVE;Lu;0;L;0052 0307;;;;N;;;;1E59; +1E59;LATIN SMALL LETTER R WITH DOT ABOVE;Ll;0;L;0072 0307;;;;N;;;1E58;;1E58 +1E5A;LATIN CAPITAL LETTER R WITH DOT BELOW;Lu;0;L;0052 0323;;;;N;;;;1E5B; +1E5B;LATIN SMALL LETTER R WITH DOT BELOW;Ll;0;L;0072 0323;;;;N;;;1E5A;;1E5A +1E5C;LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON;Lu;0;L;1E5A 0304;;;;N;;;;1E5D; +1E5D;LATIN SMALL LETTER R WITH DOT BELOW AND MACRON;Ll;0;L;1E5B 0304;;;;N;;;1E5C;;1E5C +1E5E;LATIN CAPITAL LETTER R WITH LINE BELOW;Lu;0;L;0052 0331;;;;N;;;;1E5F; +1E5F;LATIN SMALL LETTER R WITH LINE BELOW;Ll;0;L;0072 0331;;;;N;;;1E5E;;1E5E +1E60;LATIN CAPITAL LETTER S WITH DOT ABOVE;Lu;0;L;0053 0307;;;;N;;;;1E61; +1E61;LATIN SMALL LETTER S WITH DOT ABOVE;Ll;0;L;0073 0307;;;;N;;;1E60;;1E60 +1E62;LATIN CAPITAL LETTER S WITH DOT BELOW;Lu;0;L;0053 0323;;;;N;;;;1E63; +1E63;LATIN SMALL LETTER S WITH DOT BELOW;Ll;0;L;0073 0323;;;;N;;;1E62;;1E62 +1E64;LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE;Lu;0;L;015A 0307;;;;N;;;;1E65; +1E65;LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE;Ll;0;L;015B 0307;;;;N;;;1E64;;1E64 +1E66;LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE;Lu;0;L;0160 0307;;;;N;;;;1E67; +1E67;LATIN SMALL LETTER S WITH CARON AND DOT ABOVE;Ll;0;L;0161 0307;;;;N;;;1E66;;1E66 +1E68;LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE;Lu;0;L;1E62 0307;;;;N;;;;1E69; +1E69;LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE;Ll;0;L;1E63 0307;;;;N;;;1E68;;1E68 +1E6A;LATIN CAPITAL LETTER T WITH DOT ABOVE;Lu;0;L;0054 0307;;;;N;;;;1E6B; +1E6B;LATIN SMALL LETTER T WITH DOT ABOVE;Ll;0;L;0074 0307;;;;N;;;1E6A;;1E6A +1E6C;LATIN CAPITAL LETTER T WITH DOT BELOW;Lu;0;L;0054 0323;;;;N;;;;1E6D; +1E6D;LATIN SMALL LETTER T WITH DOT BELOW;Ll;0;L;0074 0323;;;;N;;;1E6C;;1E6C +1E6E;LATIN CAPITAL LETTER T WITH LINE BELOW;Lu;0;L;0054 0331;;;;N;;;;1E6F; +1E6F;LATIN SMALL LETTER T WITH LINE BELOW;Ll;0;L;0074 0331;;;;N;;;1E6E;;1E6E +1E70;LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW;Lu;0;L;0054 032D;;;;N;;;;1E71; +1E71;LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW;Ll;0;L;0074 032D;;;;N;;;1E70;;1E70 +1E72;LATIN CAPITAL LETTER U WITH DIAERESIS BELOW;Lu;0;L;0055 0324;;;;N;;;;1E73; +1E73;LATIN SMALL LETTER U WITH DIAERESIS BELOW;Ll;0;L;0075 0324;;;;N;;;1E72;;1E72 +1E74;LATIN CAPITAL LETTER U WITH TILDE BELOW;Lu;0;L;0055 0330;;;;N;;;;1E75; +1E75;LATIN SMALL LETTER U WITH TILDE BELOW;Ll;0;L;0075 0330;;;;N;;;1E74;;1E74 +1E76;LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW;Lu;0;L;0055 032D;;;;N;;;;1E77; +1E77;LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW;Ll;0;L;0075 032D;;;;N;;;1E76;;1E76 +1E78;LATIN CAPITAL LETTER U WITH TILDE AND ACUTE;Lu;0;L;0168 0301;;;;N;;;;1E79; +1E79;LATIN SMALL LETTER U WITH TILDE AND ACUTE;Ll;0;L;0169 0301;;;;N;;;1E78;;1E78 +1E7A;LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS;Lu;0;L;016A 0308;;;;N;;;;1E7B; +1E7B;LATIN SMALL LETTER U WITH MACRON AND DIAERESIS;Ll;0;L;016B 0308;;;;N;;;1E7A;;1E7A +1E7C;LATIN CAPITAL LETTER V WITH TILDE;Lu;0;L;0056 0303;;;;N;;;;1E7D; +1E7D;LATIN SMALL LETTER V WITH TILDE;Ll;0;L;0076 0303;;;;N;;;1E7C;;1E7C +1E7E;LATIN CAPITAL LETTER V WITH DOT BELOW;Lu;0;L;0056 0323;;;;N;;;;1E7F; +1E7F;LATIN SMALL LETTER V WITH DOT BELOW;Ll;0;L;0076 0323;;;;N;;;1E7E;;1E7E +1E80;LATIN CAPITAL LETTER W WITH GRAVE;Lu;0;L;0057 0300;;;;N;;;;1E81; +1E81;LATIN SMALL LETTER W WITH GRAVE;Ll;0;L;0077 0300;;;;N;;;1E80;;1E80 +1E82;LATIN CAPITAL LETTER W WITH ACUTE;Lu;0;L;0057 0301;;;;N;;;;1E83; +1E83;LATIN SMALL LETTER W WITH ACUTE;Ll;0;L;0077 0301;;;;N;;;1E82;;1E82 +1E84;LATIN CAPITAL LETTER W WITH DIAERESIS;Lu;0;L;0057 0308;;;;N;;;;1E85; +1E85;LATIN SMALL LETTER W WITH DIAERESIS;Ll;0;L;0077 0308;;;;N;;;1E84;;1E84 +1E86;LATIN CAPITAL LETTER W WITH DOT ABOVE;Lu;0;L;0057 0307;;;;N;;;;1E87; +1E87;LATIN SMALL LETTER W WITH DOT ABOVE;Ll;0;L;0077 0307;;;;N;;;1E86;;1E86 +1E88;LATIN CAPITAL LETTER W WITH DOT BELOW;Lu;0;L;0057 0323;;;;N;;;;1E89; +1E89;LATIN SMALL LETTER W WITH DOT BELOW;Ll;0;L;0077 0323;;;;N;;;1E88;;1E88 +1E8A;LATIN CAPITAL LETTER X WITH DOT ABOVE;Lu;0;L;0058 0307;;;;N;;;;1E8B; +1E8B;LATIN SMALL LETTER X WITH DOT ABOVE;Ll;0;L;0078 0307;;;;N;;;1E8A;;1E8A +1E8C;LATIN CAPITAL LETTER X WITH DIAERESIS;Lu;0;L;0058 0308;;;;N;;;;1E8D; +1E8D;LATIN SMALL LETTER X WITH DIAERESIS;Ll;0;L;0078 0308;;;;N;;;1E8C;;1E8C +1E8E;LATIN CAPITAL LETTER Y WITH DOT ABOVE;Lu;0;L;0059 0307;;;;N;;;;1E8F; +1E8F;LATIN SMALL LETTER Y WITH DOT ABOVE;Ll;0;L;0079 0307;;;;N;;;1E8E;;1E8E +1E90;LATIN CAPITAL LETTER Z WITH CIRCUMFLEX;Lu;0;L;005A 0302;;;;N;;;;1E91; +1E91;LATIN SMALL LETTER Z WITH CIRCUMFLEX;Ll;0;L;007A 0302;;;;N;;;1E90;;1E90 +1E92;LATIN CAPITAL LETTER Z WITH DOT BELOW;Lu;0;L;005A 0323;;;;N;;;;1E93; +1E93;LATIN SMALL LETTER Z WITH DOT BELOW;Ll;0;L;007A 0323;;;;N;;;1E92;;1E92 +1E94;LATIN CAPITAL LETTER Z WITH LINE BELOW;Lu;0;L;005A 0331;;;;N;;;;1E95; +1E95;LATIN SMALL LETTER Z WITH LINE BELOW;Ll;0;L;007A 0331;;;;N;;;1E94;;1E94 +1E96;LATIN SMALL LETTER H WITH LINE BELOW;Ll;0;L;0068 0331;;;;N;;;;; +1E97;LATIN SMALL LETTER T WITH DIAERESIS;Ll;0;L;0074 0308;;;;N;;;;; +1E98;LATIN SMALL LETTER W WITH RING ABOVE;Ll;0;L;0077 030A;;;;N;;;;; +1E99;LATIN SMALL LETTER Y WITH RING ABOVE;Ll;0;L;0079 030A;;;;N;;;;; +1E9A;LATIN SMALL LETTER A WITH RIGHT HALF RING;Ll;0;L;<compat> 0061 02BE;;;;N;;;;; +1E9B;LATIN SMALL LETTER LONG S WITH DOT ABOVE;Ll;0;L;017F 0307;;;;N;;;1E60;;1E60 +1E9C;LATIN SMALL LETTER LONG S WITH DIAGONAL STROKE;Ll;0;L;;;;;N;;;;; +1E9D;LATIN SMALL LETTER LONG S WITH HIGH STROKE;Ll;0;L;;;;;N;;;;; +1E9E;LATIN CAPITAL LETTER SHARP S;Lu;0;L;;;;;N;;;;00DF; +1E9F;LATIN SMALL LETTER DELTA;Ll;0;L;;;;;N;;;;; +1EA0;LATIN CAPITAL LETTER A WITH DOT BELOW;Lu;0;L;0041 0323;;;;N;;;;1EA1; +1EA1;LATIN SMALL LETTER A WITH DOT BELOW;Ll;0;L;0061 0323;;;;N;;;1EA0;;1EA0 +1EA2;LATIN CAPITAL LETTER A WITH HOOK ABOVE;Lu;0;L;0041 0309;;;;N;;;;1EA3; +1EA3;LATIN SMALL LETTER A WITH HOOK ABOVE;Ll;0;L;0061 0309;;;;N;;;1EA2;;1EA2 +1EA4;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE;Lu;0;L;00C2 0301;;;;N;;;;1EA5; +1EA5;LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE;Ll;0;L;00E2 0301;;;;N;;;1EA4;;1EA4 +1EA6;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE;Lu;0;L;00C2 0300;;;;N;;;;1EA7; +1EA7;LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE;Ll;0;L;00E2 0300;;;;N;;;1EA6;;1EA6 +1EA8;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE;Lu;0;L;00C2 0309;;;;N;;;;1EA9; +1EA9;LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE;Ll;0;L;00E2 0309;;;;N;;;1EA8;;1EA8 +1EAA;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE;Lu;0;L;00C2 0303;;;;N;;;;1EAB; +1EAB;LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE;Ll;0;L;00E2 0303;;;;N;;;1EAA;;1EAA +1EAC;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW;Lu;0;L;1EA0 0302;;;;N;;;;1EAD; +1EAD;LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW;Ll;0;L;1EA1 0302;;;;N;;;1EAC;;1EAC +1EAE;LATIN CAPITAL LETTER A WITH BREVE AND ACUTE;Lu;0;L;0102 0301;;;;N;;;;1EAF; +1EAF;LATIN SMALL LETTER A WITH BREVE AND ACUTE;Ll;0;L;0103 0301;;;;N;;;1EAE;;1EAE +1EB0;LATIN CAPITAL LETTER A WITH BREVE AND GRAVE;Lu;0;L;0102 0300;;;;N;;;;1EB1; +1EB1;LATIN SMALL LETTER A WITH BREVE AND GRAVE;Ll;0;L;0103 0300;;;;N;;;1EB0;;1EB0 +1EB2;LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE;Lu;0;L;0102 0309;;;;N;;;;1EB3; +1EB3;LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE;Ll;0;L;0103 0309;;;;N;;;1EB2;;1EB2 +1EB4;LATIN CAPITAL LETTER A WITH BREVE AND TILDE;Lu;0;L;0102 0303;;;;N;;;;1EB5; +1EB5;LATIN SMALL LETTER A WITH BREVE AND TILDE;Ll;0;L;0103 0303;;;;N;;;1EB4;;1EB4 +1EB6;LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW;Lu;0;L;1EA0 0306;;;;N;;;;1EB7; +1EB7;LATIN SMALL LETTER A WITH BREVE AND DOT BELOW;Ll;0;L;1EA1 0306;;;;N;;;1EB6;;1EB6 +1EB8;LATIN CAPITAL LETTER E WITH DOT BELOW;Lu;0;L;0045 0323;;;;N;;;;1EB9; +1EB9;LATIN SMALL LETTER E WITH DOT BELOW;Ll;0;L;0065 0323;;;;N;;;1EB8;;1EB8 +1EBA;LATIN CAPITAL LETTER E WITH HOOK ABOVE;Lu;0;L;0045 0309;;;;N;;;;1EBB; +1EBB;LATIN SMALL LETTER E WITH HOOK ABOVE;Ll;0;L;0065 0309;;;;N;;;1EBA;;1EBA +1EBC;LATIN CAPITAL LETTER E WITH TILDE;Lu;0;L;0045 0303;;;;N;;;;1EBD; +1EBD;LATIN SMALL LETTER E WITH TILDE;Ll;0;L;0065 0303;;;;N;;;1EBC;;1EBC +1EBE;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE;Lu;0;L;00CA 0301;;;;N;;;;1EBF; +1EBF;LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE;Ll;0;L;00EA 0301;;;;N;;;1EBE;;1EBE +1EC0;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE;Lu;0;L;00CA 0300;;;;N;;;;1EC1; +1EC1;LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE;Ll;0;L;00EA 0300;;;;N;;;1EC0;;1EC0 +1EC2;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE;Lu;0;L;00CA 0309;;;;N;;;;1EC3; +1EC3;LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE;Ll;0;L;00EA 0309;;;;N;;;1EC2;;1EC2 +1EC4;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE;Lu;0;L;00CA 0303;;;;N;;;;1EC5; +1EC5;LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE;Ll;0;L;00EA 0303;;;;N;;;1EC4;;1EC4 +1EC6;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW;Lu;0;L;1EB8 0302;;;;N;;;;1EC7; +1EC7;LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW;Ll;0;L;1EB9 0302;;;;N;;;1EC6;;1EC6 +1EC8;LATIN CAPITAL LETTER I WITH HOOK ABOVE;Lu;0;L;0049 0309;;;;N;;;;1EC9; +1EC9;LATIN SMALL LETTER I WITH HOOK ABOVE;Ll;0;L;0069 0309;;;;N;;;1EC8;;1EC8 +1ECA;LATIN CAPITAL LETTER I WITH DOT BELOW;Lu;0;L;0049 0323;;;;N;;;;1ECB; +1ECB;LATIN SMALL LETTER I WITH DOT BELOW;Ll;0;L;0069 0323;;;;N;;;1ECA;;1ECA +1ECC;LATIN CAPITAL LETTER O WITH DOT BELOW;Lu;0;L;004F 0323;;;;N;;;;1ECD; +1ECD;LATIN SMALL LETTER O WITH DOT BELOW;Ll;0;L;006F 0323;;;;N;;;1ECC;;1ECC +1ECE;LATIN CAPITAL LETTER O WITH HOOK ABOVE;Lu;0;L;004F 0309;;;;N;;;;1ECF; +1ECF;LATIN SMALL LETTER O WITH HOOK ABOVE;Ll;0;L;006F 0309;;;;N;;;1ECE;;1ECE +1ED0;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE;Lu;0;L;00D4 0301;;;;N;;;;1ED1; +1ED1;LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE;Ll;0;L;00F4 0301;;;;N;;;1ED0;;1ED0 +1ED2;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE;Lu;0;L;00D4 0300;;;;N;;;;1ED3; +1ED3;LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE;Ll;0;L;00F4 0300;;;;N;;;1ED2;;1ED2 +1ED4;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE;Lu;0;L;00D4 0309;;;;N;;;;1ED5; +1ED5;LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE;Ll;0;L;00F4 0309;;;;N;;;1ED4;;1ED4 +1ED6;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE;Lu;0;L;00D4 0303;;;;N;;;;1ED7; +1ED7;LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE;Ll;0;L;00F4 0303;;;;N;;;1ED6;;1ED6 +1ED8;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW;Lu;0;L;1ECC 0302;;;;N;;;;1ED9; +1ED9;LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW;Ll;0;L;1ECD 0302;;;;N;;;1ED8;;1ED8 +1EDA;LATIN CAPITAL LETTER O WITH HORN AND ACUTE;Lu;0;L;01A0 0301;;;;N;;;;1EDB; +1EDB;LATIN SMALL LETTER O WITH HORN AND ACUTE;Ll;0;L;01A1 0301;;;;N;;;1EDA;;1EDA +1EDC;LATIN CAPITAL LETTER O WITH HORN AND GRAVE;Lu;0;L;01A0 0300;;;;N;;;;1EDD; +1EDD;LATIN SMALL LETTER O WITH HORN AND GRAVE;Ll;0;L;01A1 0300;;;;N;;;1EDC;;1EDC +1EDE;LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE;Lu;0;L;01A0 0309;;;;N;;;;1EDF; +1EDF;LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE;Ll;0;L;01A1 0309;;;;N;;;1EDE;;1EDE +1EE0;LATIN CAPITAL LETTER O WITH HORN AND TILDE;Lu;0;L;01A0 0303;;;;N;;;;1EE1; +1EE1;LATIN SMALL LETTER O WITH HORN AND TILDE;Ll;0;L;01A1 0303;;;;N;;;1EE0;;1EE0 +1EE2;LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW;Lu;0;L;01A0 0323;;;;N;;;;1EE3; +1EE3;LATIN SMALL LETTER O WITH HORN AND DOT BELOW;Ll;0;L;01A1 0323;;;;N;;;1EE2;;1EE2 +1EE4;LATIN CAPITAL LETTER U WITH DOT BELOW;Lu;0;L;0055 0323;;;;N;;;;1EE5; +1EE5;LATIN SMALL LETTER U WITH DOT BELOW;Ll;0;L;0075 0323;;;;N;;;1EE4;;1EE4 +1EE6;LATIN CAPITAL LETTER U WITH HOOK ABOVE;Lu;0;L;0055 0309;;;;N;;;;1EE7; +1EE7;LATIN SMALL LETTER U WITH HOOK ABOVE;Ll;0;L;0075 0309;;;;N;;;1EE6;;1EE6 +1EE8;LATIN CAPITAL LETTER U WITH HORN AND ACUTE;Lu;0;L;01AF 0301;;;;N;;;;1EE9; +1EE9;LATIN SMALL LETTER U WITH HORN AND ACUTE;Ll;0;L;01B0 0301;;;;N;;;1EE8;;1EE8 +1EEA;LATIN CAPITAL LETTER U WITH HORN AND GRAVE;Lu;0;L;01AF 0300;;;;N;;;;1EEB; +1EEB;LATIN SMALL LETTER U WITH HORN AND GRAVE;Ll;0;L;01B0 0300;;;;N;;;1EEA;;1EEA +1EEC;LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE;Lu;0;L;01AF 0309;;;;N;;;;1EED; +1EED;LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE;Ll;0;L;01B0 0309;;;;N;;;1EEC;;1EEC +1EEE;LATIN CAPITAL LETTER U WITH HORN AND TILDE;Lu;0;L;01AF 0303;;;;N;;;;1EEF; +1EEF;LATIN SMALL LETTER U WITH HORN AND TILDE;Ll;0;L;01B0 0303;;;;N;;;1EEE;;1EEE +1EF0;LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW;Lu;0;L;01AF 0323;;;;N;;;;1EF1; +1EF1;LATIN SMALL LETTER U WITH HORN AND DOT BELOW;Ll;0;L;01B0 0323;;;;N;;;1EF0;;1EF0 +1EF2;LATIN CAPITAL LETTER Y WITH GRAVE;Lu;0;L;0059 0300;;;;N;;;;1EF3; +1EF3;LATIN SMALL LETTER Y WITH GRAVE;Ll;0;L;0079 0300;;;;N;;;1EF2;;1EF2 +1EF4;LATIN CAPITAL LETTER Y WITH DOT BELOW;Lu;0;L;0059 0323;;;;N;;;;1EF5; +1EF5;LATIN SMALL LETTER Y WITH DOT BELOW;Ll;0;L;0079 0323;;;;N;;;1EF4;;1EF4 +1EF6;LATIN CAPITAL LETTER Y WITH HOOK ABOVE;Lu;0;L;0059 0309;;;;N;;;;1EF7; +1EF7;LATIN SMALL LETTER Y WITH HOOK ABOVE;Ll;0;L;0079 0309;;;;N;;;1EF6;;1EF6 +1EF8;LATIN CAPITAL LETTER Y WITH TILDE;Lu;0;L;0059 0303;;;;N;;;;1EF9; +1EF9;LATIN SMALL LETTER Y WITH TILDE;Ll;0;L;0079 0303;;;;N;;;1EF8;;1EF8 +1EFA;LATIN CAPITAL LETTER MIDDLE-WELSH LL;Lu;0;L;;;;;N;;;;1EFB; +1EFB;LATIN SMALL LETTER MIDDLE-WELSH LL;Ll;0;L;;;;;N;;;1EFA;;1EFA +1EFC;LATIN CAPITAL LETTER MIDDLE-WELSH V;Lu;0;L;;;;;N;;;;1EFD; +1EFD;LATIN SMALL LETTER MIDDLE-WELSH V;Ll;0;L;;;;;N;;;1EFC;;1EFC +1EFE;LATIN CAPITAL LETTER Y WITH LOOP;Lu;0;L;;;;;N;;;;1EFF; +1EFF;LATIN SMALL LETTER Y WITH LOOP;Ll;0;L;;;;;N;;;1EFE;;1EFE +1F00;GREEK SMALL LETTER ALPHA WITH PSILI;Ll;0;L;03B1 0313;;;;N;;;1F08;;1F08 +1F01;GREEK SMALL LETTER ALPHA WITH DASIA;Ll;0;L;03B1 0314;;;;N;;;1F09;;1F09 +1F02;GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA;Ll;0;L;1F00 0300;;;;N;;;1F0A;;1F0A +1F03;GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA;Ll;0;L;1F01 0300;;;;N;;;1F0B;;1F0B +1F04;GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA;Ll;0;L;1F00 0301;;;;N;;;1F0C;;1F0C +1F05;GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA;Ll;0;L;1F01 0301;;;;N;;;1F0D;;1F0D +1F06;GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI;Ll;0;L;1F00 0342;;;;N;;;1F0E;;1F0E +1F07;GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI;Ll;0;L;1F01 0342;;;;N;;;1F0F;;1F0F +1F08;GREEK CAPITAL LETTER ALPHA WITH PSILI;Lu;0;L;0391 0313;;;;N;;;;1F00; +1F09;GREEK CAPITAL LETTER ALPHA WITH DASIA;Lu;0;L;0391 0314;;;;N;;;;1F01; +1F0A;GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA;Lu;0;L;1F08 0300;;;;N;;;;1F02; +1F0B;GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA;Lu;0;L;1F09 0300;;;;N;;;;1F03; +1F0C;GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA;Lu;0;L;1F08 0301;;;;N;;;;1F04; +1F0D;GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA;Lu;0;L;1F09 0301;;;;N;;;;1F05; +1F0E;GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI;Lu;0;L;1F08 0342;;;;N;;;;1F06; +1F0F;GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI;Lu;0;L;1F09 0342;;;;N;;;;1F07; +1F10;GREEK SMALL LETTER EPSILON WITH PSILI;Ll;0;L;03B5 0313;;;;N;;;1F18;;1F18 +1F11;GREEK SMALL LETTER EPSILON WITH DASIA;Ll;0;L;03B5 0314;;;;N;;;1F19;;1F19 +1F12;GREEK SMALL LETTER EPSILON WITH PSILI AND VARIA;Ll;0;L;1F10 0300;;;;N;;;1F1A;;1F1A +1F13;GREEK SMALL LETTER EPSILON WITH DASIA AND VARIA;Ll;0;L;1F11 0300;;;;N;;;1F1B;;1F1B +1F14;GREEK SMALL LETTER EPSILON WITH PSILI AND OXIA;Ll;0;L;1F10 0301;;;;N;;;1F1C;;1F1C +1F15;GREEK SMALL LETTER EPSILON WITH DASIA AND OXIA;Ll;0;L;1F11 0301;;;;N;;;1F1D;;1F1D +1F18;GREEK CAPITAL LETTER EPSILON WITH PSILI;Lu;0;L;0395 0313;;;;N;;;;1F10; +1F19;GREEK CAPITAL LETTER EPSILON WITH DASIA;Lu;0;L;0395 0314;;;;N;;;;1F11; +1F1A;GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA;Lu;0;L;1F18 0300;;;;N;;;;1F12; +1F1B;GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA;Lu;0;L;1F19 0300;;;;N;;;;1F13; +1F1C;GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA;Lu;0;L;1F18 0301;;;;N;;;;1F14; +1F1D;GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA;Lu;0;L;1F19 0301;;;;N;;;;1F15; +1F20;GREEK SMALL LETTER ETA WITH PSILI;Ll;0;L;03B7 0313;;;;N;;;1F28;;1F28 +1F21;GREEK SMALL LETTER ETA WITH DASIA;Ll;0;L;03B7 0314;;;;N;;;1F29;;1F29 +1F22;GREEK SMALL LETTER ETA WITH PSILI AND VARIA;Ll;0;L;1F20 0300;;;;N;;;1F2A;;1F2A +1F23;GREEK SMALL LETTER ETA WITH DASIA AND VARIA;Ll;0;L;1F21 0300;;;;N;;;1F2B;;1F2B +1F24;GREEK SMALL LETTER ETA WITH PSILI AND OXIA;Ll;0;L;1F20 0301;;;;N;;;1F2C;;1F2C +1F25;GREEK SMALL LETTER ETA WITH DASIA AND OXIA;Ll;0;L;1F21 0301;;;;N;;;1F2D;;1F2D +1F26;GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI;Ll;0;L;1F20 0342;;;;N;;;1F2E;;1F2E +1F27;GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI;Ll;0;L;1F21 0342;;;;N;;;1F2F;;1F2F +1F28;GREEK CAPITAL LETTER ETA WITH PSILI;Lu;0;L;0397 0313;;;;N;;;;1F20; +1F29;GREEK CAPITAL LETTER ETA WITH DASIA;Lu;0;L;0397 0314;;;;N;;;;1F21; +1F2A;GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA;Lu;0;L;1F28 0300;;;;N;;;;1F22; +1F2B;GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA;Lu;0;L;1F29 0300;;;;N;;;;1F23; +1F2C;GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA;Lu;0;L;1F28 0301;;;;N;;;;1F24; +1F2D;GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA;Lu;0;L;1F29 0301;;;;N;;;;1F25; +1F2E;GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI;Lu;0;L;1F28 0342;;;;N;;;;1F26; +1F2F;GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI;Lu;0;L;1F29 0342;;;;N;;;;1F27; +1F30;GREEK SMALL LETTER IOTA WITH PSILI;Ll;0;L;03B9 0313;;;;N;;;1F38;;1F38 +1F31;GREEK SMALL LETTER IOTA WITH DASIA;Ll;0;L;03B9 0314;;;;N;;;1F39;;1F39 +1F32;GREEK SMALL LETTER IOTA WITH PSILI AND VARIA;Ll;0;L;1F30 0300;;;;N;;;1F3A;;1F3A +1F33;GREEK SMALL LETTER IOTA WITH DASIA AND VARIA;Ll;0;L;1F31 0300;;;;N;;;1F3B;;1F3B +1F34;GREEK SMALL LETTER IOTA WITH PSILI AND OXIA;Ll;0;L;1F30 0301;;;;N;;;1F3C;;1F3C +1F35;GREEK SMALL LETTER IOTA WITH DASIA AND OXIA;Ll;0;L;1F31 0301;;;;N;;;1F3D;;1F3D +1F36;GREEK SMALL LETTER IOTA WITH PSILI AND PERISPOMENI;Ll;0;L;1F30 0342;;;;N;;;1F3E;;1F3E +1F37;GREEK SMALL LETTER IOTA WITH DASIA AND PERISPOMENI;Ll;0;L;1F31 0342;;;;N;;;1F3F;;1F3F +1F38;GREEK CAPITAL LETTER IOTA WITH PSILI;Lu;0;L;0399 0313;;;;N;;;;1F30; +1F39;GREEK CAPITAL LETTER IOTA WITH DASIA;Lu;0;L;0399 0314;;;;N;;;;1F31; +1F3A;GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA;Lu;0;L;1F38 0300;;;;N;;;;1F32; +1F3B;GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA;Lu;0;L;1F39 0300;;;;N;;;;1F33; +1F3C;GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA;Lu;0;L;1F38 0301;;;;N;;;;1F34; +1F3D;GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA;Lu;0;L;1F39 0301;;;;N;;;;1F35; +1F3E;GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI;Lu;0;L;1F38 0342;;;;N;;;;1F36; +1F3F;GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI;Lu;0;L;1F39 0342;;;;N;;;;1F37; +1F40;GREEK SMALL LETTER OMICRON WITH PSILI;Ll;0;L;03BF 0313;;;;N;;;1F48;;1F48 +1F41;GREEK SMALL LETTER OMICRON WITH DASIA;Ll;0;L;03BF 0314;;;;N;;;1F49;;1F49 +1F42;GREEK SMALL LETTER OMICRON WITH PSILI AND VARIA;Ll;0;L;1F40 0300;;;;N;;;1F4A;;1F4A +1F43;GREEK SMALL LETTER OMICRON WITH DASIA AND VARIA;Ll;0;L;1F41 0300;;;;N;;;1F4B;;1F4B +1F44;GREEK SMALL LETTER OMICRON WITH PSILI AND OXIA;Ll;0;L;1F40 0301;;;;N;;;1F4C;;1F4C +1F45;GREEK SMALL LETTER OMICRON WITH DASIA AND OXIA;Ll;0;L;1F41 0301;;;;N;;;1F4D;;1F4D +1F48;GREEK CAPITAL LETTER OMICRON WITH PSILI;Lu;0;L;039F 0313;;;;N;;;;1F40; +1F49;GREEK CAPITAL LETTER OMICRON WITH DASIA;Lu;0;L;039F 0314;;;;N;;;;1F41; +1F4A;GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA;Lu;0;L;1F48 0300;;;;N;;;;1F42; +1F4B;GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA;Lu;0;L;1F49 0300;;;;N;;;;1F43; +1F4C;GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA;Lu;0;L;1F48 0301;;;;N;;;;1F44; +1F4D;GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA;Lu;0;L;1F49 0301;;;;N;;;;1F45; +1F50;GREEK SMALL LETTER UPSILON WITH PSILI;Ll;0;L;03C5 0313;;;;N;;;;; +1F51;GREEK SMALL LETTER UPSILON WITH DASIA;Ll;0;L;03C5 0314;;;;N;;;1F59;;1F59 +1F52;GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA;Ll;0;L;1F50 0300;;;;N;;;;; +1F53;GREEK SMALL LETTER UPSILON WITH DASIA AND VARIA;Ll;0;L;1F51 0300;;;;N;;;1F5B;;1F5B +1F54;GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA;Ll;0;L;1F50 0301;;;;N;;;;; +1F55;GREEK SMALL LETTER UPSILON WITH DASIA AND OXIA;Ll;0;L;1F51 0301;;;;N;;;1F5D;;1F5D +1F56;GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI;Ll;0;L;1F50 0342;;;;N;;;;; +1F57;GREEK SMALL LETTER UPSILON WITH DASIA AND PERISPOMENI;Ll;0;L;1F51 0342;;;;N;;;1F5F;;1F5F +1F59;GREEK CAPITAL LETTER UPSILON WITH DASIA;Lu;0;L;03A5 0314;;;;N;;;;1F51; +1F5B;GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA;Lu;0;L;1F59 0300;;;;N;;;;1F53; +1F5D;GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA;Lu;0;L;1F59 0301;;;;N;;;;1F55; +1F5F;GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI;Lu;0;L;1F59 0342;;;;N;;;;1F57; +1F60;GREEK SMALL LETTER OMEGA WITH PSILI;Ll;0;L;03C9 0313;;;;N;;;1F68;;1F68 +1F61;GREEK SMALL LETTER OMEGA WITH DASIA;Ll;0;L;03C9 0314;;;;N;;;1F69;;1F69 +1F62;GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA;Ll;0;L;1F60 0300;;;;N;;;1F6A;;1F6A +1F63;GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA;Ll;0;L;1F61 0300;;;;N;;;1F6B;;1F6B +1F64;GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA;Ll;0;L;1F60 0301;;;;N;;;1F6C;;1F6C +1F65;GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA;Ll;0;L;1F61 0301;;;;N;;;1F6D;;1F6D +1F66;GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI;Ll;0;L;1F60 0342;;;;N;;;1F6E;;1F6E +1F67;GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI;Ll;0;L;1F61 0342;;;;N;;;1F6F;;1F6F +1F68;GREEK CAPITAL LETTER OMEGA WITH PSILI;Lu;0;L;03A9 0313;;;;N;;;;1F60; +1F69;GREEK CAPITAL LETTER OMEGA WITH DASIA;Lu;0;L;03A9 0314;;;;N;;;;1F61; +1F6A;GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA;Lu;0;L;1F68 0300;;;;N;;;;1F62; +1F6B;GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA;Lu;0;L;1F69 0300;;;;N;;;;1F63; +1F6C;GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA;Lu;0;L;1F68 0301;;;;N;;;;1F64; +1F6D;GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA;Lu;0;L;1F69 0301;;;;N;;;;1F65; +1F6E;GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI;Lu;0;L;1F68 0342;;;;N;;;;1F66; +1F6F;GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI;Lu;0;L;1F69 0342;;;;N;;;;1F67; +1F70;GREEK SMALL LETTER ALPHA WITH VARIA;Ll;0;L;03B1 0300;;;;N;;;1FBA;;1FBA +1F71;GREEK SMALL LETTER ALPHA WITH OXIA;Ll;0;L;03AC;;;;N;;;1FBB;;1FBB +1F72;GREEK SMALL LETTER EPSILON WITH VARIA;Ll;0;L;03B5 0300;;;;N;;;1FC8;;1FC8 +1F73;GREEK SMALL LETTER EPSILON WITH OXIA;Ll;0;L;03AD;;;;N;;;1FC9;;1FC9 +1F74;GREEK SMALL LETTER ETA WITH VARIA;Ll;0;L;03B7 0300;;;;N;;;1FCA;;1FCA +1F75;GREEK SMALL LETTER ETA WITH OXIA;Ll;0;L;03AE;;;;N;;;1FCB;;1FCB +1F76;GREEK SMALL LETTER IOTA WITH VARIA;Ll;0;L;03B9 0300;;;;N;;;1FDA;;1FDA +1F77;GREEK SMALL LETTER IOTA WITH OXIA;Ll;0;L;03AF;;;;N;;;1FDB;;1FDB +1F78;GREEK SMALL LETTER OMICRON WITH VARIA;Ll;0;L;03BF 0300;;;;N;;;1FF8;;1FF8 +1F79;GREEK SMALL LETTER OMICRON WITH OXIA;Ll;0;L;03CC;;;;N;;;1FF9;;1FF9 +1F7A;GREEK SMALL LETTER UPSILON WITH VARIA;Ll;0;L;03C5 0300;;;;N;;;1FEA;;1FEA +1F7B;GREEK SMALL LETTER UPSILON WITH OXIA;Ll;0;L;03CD;;;;N;;;1FEB;;1FEB +1F7C;GREEK SMALL LETTER OMEGA WITH VARIA;Ll;0;L;03C9 0300;;;;N;;;1FFA;;1FFA +1F7D;GREEK SMALL LETTER OMEGA WITH OXIA;Ll;0;L;03CE;;;;N;;;1FFB;;1FFB +1F80;GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI;Ll;0;L;1F00 0345;;;;N;;;1F88;;1F88 +1F81;GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI;Ll;0;L;1F01 0345;;;;N;;;1F89;;1F89 +1F82;GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F02 0345;;;;N;;;1F8A;;1F8A +1F83;GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F03 0345;;;;N;;;1F8B;;1F8B +1F84;GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F04 0345;;;;N;;;1F8C;;1F8C +1F85;GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F05 0345;;;;N;;;1F8D;;1F8D +1F86;GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F06 0345;;;;N;;;1F8E;;1F8E +1F87;GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F07 0345;;;;N;;;1F8F;;1F8F +1F88;GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI;Lt;0;L;1F08 0345;;;;N;;;;1F80; +1F89;GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI;Lt;0;L;1F09 0345;;;;N;;;;1F81; +1F8A;GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F0A 0345;;;;N;;;;1F82; +1F8B;GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F0B 0345;;;;N;;;;1F83; +1F8C;GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F0C 0345;;;;N;;;;1F84; +1F8D;GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F0D 0345;;;;N;;;;1F85; +1F8E;GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F0E 0345;;;;N;;;;1F86; +1F8F;GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F0F 0345;;;;N;;;;1F87; +1F90;GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI;Ll;0;L;1F20 0345;;;;N;;;1F98;;1F98 +1F91;GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI;Ll;0;L;1F21 0345;;;;N;;;1F99;;1F99 +1F92;GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F22 0345;;;;N;;;1F9A;;1F9A +1F93;GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F23 0345;;;;N;;;1F9B;;1F9B +1F94;GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F24 0345;;;;N;;;1F9C;;1F9C +1F95;GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F25 0345;;;;N;;;1F9D;;1F9D +1F96;GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F26 0345;;;;N;;;1F9E;;1F9E +1F97;GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F27 0345;;;;N;;;1F9F;;1F9F +1F98;GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI;Lt;0;L;1F28 0345;;;;N;;;;1F90; +1F99;GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI;Lt;0;L;1F29 0345;;;;N;;;;1F91; +1F9A;GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F2A 0345;;;;N;;;;1F92; +1F9B;GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F2B 0345;;;;N;;;;1F93; +1F9C;GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F2C 0345;;;;N;;;;1F94; +1F9D;GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F2D 0345;;;;N;;;;1F95; +1F9E;GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F2E 0345;;;;N;;;;1F96; +1F9F;GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F2F 0345;;;;N;;;;1F97; +1FA0;GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI;Ll;0;L;1F60 0345;;;;N;;;1FA8;;1FA8 +1FA1;GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI;Ll;0;L;1F61 0345;;;;N;;;1FA9;;1FA9 +1FA2;GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F62 0345;;;;N;;;1FAA;;1FAA +1FA3;GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F63 0345;;;;N;;;1FAB;;1FAB +1FA4;GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F64 0345;;;;N;;;1FAC;;1FAC +1FA5;GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F65 0345;;;;N;;;1FAD;;1FAD +1FA6;GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F66 0345;;;;N;;;1FAE;;1FAE +1FA7;GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F67 0345;;;;N;;;1FAF;;1FAF +1FA8;GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI;Lt;0;L;1F68 0345;;;;N;;;;1FA0; +1FA9;GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI;Lt;0;L;1F69 0345;;;;N;;;;1FA1; +1FAA;GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F6A 0345;;;;N;;;;1FA2; +1FAB;GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F6B 0345;;;;N;;;;1FA3; +1FAC;GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F6C 0345;;;;N;;;;1FA4; +1FAD;GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F6D 0345;;;;N;;;;1FA5; +1FAE;GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F6E 0345;;;;N;;;;1FA6; +1FAF;GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F6F 0345;;;;N;;;;1FA7; +1FB0;GREEK SMALL LETTER ALPHA WITH VRACHY;Ll;0;L;03B1 0306;;;;N;;;1FB8;;1FB8 +1FB1;GREEK SMALL LETTER ALPHA WITH MACRON;Ll;0;L;03B1 0304;;;;N;;;1FB9;;1FB9 +1FB2;GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI;Ll;0;L;1F70 0345;;;;N;;;;; +1FB3;GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI;Ll;0;L;03B1 0345;;;;N;;;1FBC;;1FBC +1FB4;GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI;Ll;0;L;03AC 0345;;;;N;;;;; +1FB6;GREEK SMALL LETTER ALPHA WITH PERISPOMENI;Ll;0;L;03B1 0342;;;;N;;;;; +1FB7;GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1FB6 0345;;;;N;;;;; +1FB8;GREEK CAPITAL LETTER ALPHA WITH VRACHY;Lu;0;L;0391 0306;;;;N;;;;1FB0; +1FB9;GREEK CAPITAL LETTER ALPHA WITH MACRON;Lu;0;L;0391 0304;;;;N;;;;1FB1; +1FBA;GREEK CAPITAL LETTER ALPHA WITH VARIA;Lu;0;L;0391 0300;;;;N;;;;1F70; +1FBB;GREEK CAPITAL LETTER ALPHA WITH OXIA;Lu;0;L;0386;;;;N;;;;1F71; +1FBC;GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI;Lt;0;L;0391 0345;;;;N;;;;1FB3; +1FBD;GREEK KORONIS;Sk;0;ON;<compat> 0020 0313;;;;N;;;;; +1FBE;GREEK PROSGEGRAMMENI;Ll;0;L;03B9;;;;N;;;0399;;0399 +1FBF;GREEK PSILI;Sk;0;ON;<compat> 0020 0313;;;;N;;;;; +1FC0;GREEK PERISPOMENI;Sk;0;ON;<compat> 0020 0342;;;;N;;;;; +1FC1;GREEK DIALYTIKA AND PERISPOMENI;Sk;0;ON;00A8 0342;;;;N;;;;; +1FC2;GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI;Ll;0;L;1F74 0345;;;;N;;;;; +1FC3;GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI;Ll;0;L;03B7 0345;;;;N;;;1FCC;;1FCC +1FC4;GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI;Ll;0;L;03AE 0345;;;;N;;;;; +1FC6;GREEK SMALL LETTER ETA WITH PERISPOMENI;Ll;0;L;03B7 0342;;;;N;;;;; +1FC7;GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1FC6 0345;;;;N;;;;; +1FC8;GREEK CAPITAL LETTER EPSILON WITH VARIA;Lu;0;L;0395 0300;;;;N;;;;1F72; +1FC9;GREEK CAPITAL LETTER EPSILON WITH OXIA;Lu;0;L;0388;;;;N;;;;1F73; +1FCA;GREEK CAPITAL LETTER ETA WITH VARIA;Lu;0;L;0397 0300;;;;N;;;;1F74; +1FCB;GREEK CAPITAL LETTER ETA WITH OXIA;Lu;0;L;0389;;;;N;;;;1F75; +1FCC;GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI;Lt;0;L;0397 0345;;;;N;;;;1FC3; +1FCD;GREEK PSILI AND VARIA;Sk;0;ON;1FBF 0300;;;;N;;;;; +1FCE;GREEK PSILI AND OXIA;Sk;0;ON;1FBF 0301;;;;N;;;;; +1FCF;GREEK PSILI AND PERISPOMENI;Sk;0;ON;1FBF 0342;;;;N;;;;; +1FD0;GREEK SMALL LETTER IOTA WITH VRACHY;Ll;0;L;03B9 0306;;;;N;;;1FD8;;1FD8 +1FD1;GREEK SMALL LETTER IOTA WITH MACRON;Ll;0;L;03B9 0304;;;;N;;;1FD9;;1FD9 +1FD2;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA;Ll;0;L;03CA 0300;;;;N;;;;; +1FD3;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA;Ll;0;L;0390;;;;N;;;;; +1FD6;GREEK SMALL LETTER IOTA WITH PERISPOMENI;Ll;0;L;03B9 0342;;;;N;;;;; +1FD7;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI;Ll;0;L;03CA 0342;;;;N;;;;; +1FD8;GREEK CAPITAL LETTER IOTA WITH VRACHY;Lu;0;L;0399 0306;;;;N;;;;1FD0; +1FD9;GREEK CAPITAL LETTER IOTA WITH MACRON;Lu;0;L;0399 0304;;;;N;;;;1FD1; +1FDA;GREEK CAPITAL LETTER IOTA WITH VARIA;Lu;0;L;0399 0300;;;;N;;;;1F76; +1FDB;GREEK CAPITAL LETTER IOTA WITH OXIA;Lu;0;L;038A;;;;N;;;;1F77; +1FDD;GREEK DASIA AND VARIA;Sk;0;ON;1FFE 0300;;;;N;;;;; +1FDE;GREEK DASIA AND OXIA;Sk;0;ON;1FFE 0301;;;;N;;;;; +1FDF;GREEK DASIA AND PERISPOMENI;Sk;0;ON;1FFE 0342;;;;N;;;;; +1FE0;GREEK SMALL LETTER UPSILON WITH VRACHY;Ll;0;L;03C5 0306;;;;N;;;1FE8;;1FE8 +1FE1;GREEK SMALL LETTER UPSILON WITH MACRON;Ll;0;L;03C5 0304;;;;N;;;1FE9;;1FE9 +1FE2;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA;Ll;0;L;03CB 0300;;;;N;;;;; +1FE3;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA;Ll;0;L;03B0;;;;N;;;;; +1FE4;GREEK SMALL LETTER RHO WITH PSILI;Ll;0;L;03C1 0313;;;;N;;;;; +1FE5;GREEK SMALL LETTER RHO WITH DASIA;Ll;0;L;03C1 0314;;;;N;;;1FEC;;1FEC +1FE6;GREEK SMALL LETTER UPSILON WITH PERISPOMENI;Ll;0;L;03C5 0342;;;;N;;;;; +1FE7;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI;Ll;0;L;03CB 0342;;;;N;;;;; +1FE8;GREEK CAPITAL LETTER UPSILON WITH VRACHY;Lu;0;L;03A5 0306;;;;N;;;;1FE0; +1FE9;GREEK CAPITAL LETTER UPSILON WITH MACRON;Lu;0;L;03A5 0304;;;;N;;;;1FE1; +1FEA;GREEK CAPITAL LETTER UPSILON WITH VARIA;Lu;0;L;03A5 0300;;;;N;;;;1F7A; +1FEB;GREEK CAPITAL LETTER UPSILON WITH OXIA;Lu;0;L;038E;;;;N;;;;1F7B; +1FEC;GREEK CAPITAL LETTER RHO WITH DASIA;Lu;0;L;03A1 0314;;;;N;;;;1FE5; +1FED;GREEK DIALYTIKA AND VARIA;Sk;0;ON;00A8 0300;;;;N;;;;; +1FEE;GREEK DIALYTIKA AND OXIA;Sk;0;ON;0385;;;;N;;;;; +1FEF;GREEK VARIA;Sk;0;ON;0060;;;;N;;;;; +1FF2;GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI;Ll;0;L;1F7C 0345;;;;N;;;;; +1FF3;GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI;Ll;0;L;03C9 0345;;;;N;;;1FFC;;1FFC +1FF4;GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI;Ll;0;L;03CE 0345;;;;N;;;;; +1FF6;GREEK SMALL LETTER OMEGA WITH PERISPOMENI;Ll;0;L;03C9 0342;;;;N;;;;; +1FF7;GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1FF6 0345;;;;N;;;;; +1FF8;GREEK CAPITAL LETTER OMICRON WITH VARIA;Lu;0;L;039F 0300;;;;N;;;;1F78; +1FF9;GREEK CAPITAL LETTER OMICRON WITH OXIA;Lu;0;L;038C;;;;N;;;;1F79; +1FFA;GREEK CAPITAL LETTER OMEGA WITH VARIA;Lu;0;L;03A9 0300;;;;N;;;;1F7C; +1FFB;GREEK CAPITAL LETTER OMEGA WITH OXIA;Lu;0;L;038F;;;;N;;;;1F7D; +1FFC;GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI;Lt;0;L;03A9 0345;;;;N;;;;1FF3; +1FFD;GREEK OXIA;Sk;0;ON;00B4;;;;N;;;;; +1FFE;GREEK DASIA;Sk;0;ON;<compat> 0020 0314;;;;N;;;;; +2000;EN QUAD;Zs;0;WS;2002;;;;N;;;;; +2001;EM QUAD;Zs;0;WS;2003;;;;N;;;;; +2002;EN SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2003;EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2004;THREE-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2005;FOUR-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2006;SIX-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2007;FIGURE SPACE;Zs;0;WS;<noBreak> 0020;;;;N;;;;; +2008;PUNCTUATION SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2009;THIN SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +200A;HAIR SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +200B;ZERO WIDTH SPACE;Cf;0;BN;;;;;N;;;;; +200C;ZERO WIDTH NON-JOINER;Cf;0;BN;;;;;N;;;;; +200D;ZERO WIDTH JOINER;Cf;0;BN;;;;;N;;;;; +200E;LEFT-TO-RIGHT MARK;Cf;0;L;;;;;N;;;;; +200F;RIGHT-TO-LEFT MARK;Cf;0;R;;;;;N;;;;; +2010;HYPHEN;Pd;0;ON;;;;;N;;;;; +2011;NON-BREAKING HYPHEN;Pd;0;ON;<noBreak> 2010;;;;N;;;;; +2012;FIGURE DASH;Pd;0;ON;;;;;N;;;;; +2013;EN DASH;Pd;0;ON;;;;;N;;;;; +2014;EM DASH;Pd;0;ON;;;;;N;;;;; +2015;HORIZONTAL BAR;Pd;0;ON;;;;;N;QUOTATION DASH;;;; +2016;DOUBLE VERTICAL LINE;Po;0;ON;;;;;N;DOUBLE VERTICAL BAR;;;; +2017;DOUBLE LOW LINE;Po;0;ON;<compat> 0020 0333;;;;N;SPACING DOUBLE UNDERSCORE;;;; +2018;LEFT SINGLE QUOTATION MARK;Pi;0;ON;;;;;N;SINGLE TURNED COMMA QUOTATION MARK;;;; +2019;RIGHT SINGLE QUOTATION MARK;Pf;0;ON;;;;;N;SINGLE COMMA QUOTATION MARK;;;; +201A;SINGLE LOW-9 QUOTATION MARK;Ps;0;ON;;;;;N;LOW SINGLE COMMA QUOTATION MARK;;;; +201B;SINGLE HIGH-REVERSED-9 QUOTATION MARK;Pi;0;ON;;;;;N;SINGLE REVERSED COMMA QUOTATION MARK;;;; +201C;LEFT DOUBLE QUOTATION MARK;Pi;0;ON;;;;;N;DOUBLE TURNED COMMA QUOTATION MARK;;;; +201D;RIGHT DOUBLE QUOTATION MARK;Pf;0;ON;;;;;N;DOUBLE COMMA QUOTATION MARK;;;; +201E;DOUBLE LOW-9 QUOTATION MARK;Ps;0;ON;;;;;N;LOW DOUBLE COMMA QUOTATION MARK;;;; +201F;DOUBLE HIGH-REVERSED-9 QUOTATION MARK;Pi;0;ON;;;;;N;DOUBLE REVERSED COMMA QUOTATION MARK;;;; +2020;DAGGER;Po;0;ON;;;;;N;;;;; +2021;DOUBLE DAGGER;Po;0;ON;;;;;N;;;;; +2022;BULLET;Po;0;ON;;;;;N;;;;; +2023;TRIANGULAR BULLET;Po;0;ON;;;;;N;;;;; +2024;ONE DOT LEADER;Po;0;ON;<compat> 002E;;;;N;;;;; +2025;TWO DOT LEADER;Po;0;ON;<compat> 002E 002E;;;;N;;;;; +2026;HORIZONTAL ELLIPSIS;Po;0;ON;<compat> 002E 002E 002E;;;;N;;;;; +2027;HYPHENATION POINT;Po;0;ON;;;;;N;;;;; +2028;LINE SEPARATOR;Zl;0;WS;;;;;N;;;;; +2029;PARAGRAPH SEPARATOR;Zp;0;B;;;;;N;;;;; +202A;LEFT-TO-RIGHT EMBEDDING;Cf;0;LRE;;;;;N;;;;; +202B;RIGHT-TO-LEFT EMBEDDING;Cf;0;RLE;;;;;N;;;;; +202C;POP DIRECTIONAL FORMATTING;Cf;0;PDF;;;;;N;;;;; +202D;LEFT-TO-RIGHT OVERRIDE;Cf;0;LRO;;;;;N;;;;; +202E;RIGHT-TO-LEFT OVERRIDE;Cf;0;RLO;;;;;N;;;;; +202F;NARROW NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;;;;; +2030;PER MILLE SIGN;Po;0;ET;;;;;N;;;;; +2031;PER TEN THOUSAND SIGN;Po;0;ET;;;;;N;;;;; +2032;PRIME;Po;0;ET;;;;;N;;;;; +2033;DOUBLE PRIME;Po;0;ET;<compat> 2032 2032;;;;N;;;;; +2034;TRIPLE PRIME;Po;0;ET;<compat> 2032 2032 2032;;;;N;;;;; +2035;REVERSED PRIME;Po;0;ON;;;;;N;;;;; +2036;REVERSED DOUBLE PRIME;Po;0;ON;<compat> 2035 2035;;;;N;;;;; +2037;REVERSED TRIPLE PRIME;Po;0;ON;<compat> 2035 2035 2035;;;;N;;;;; +2038;CARET;Po;0;ON;;;;;N;;;;; +2039;SINGLE LEFT-POINTING ANGLE QUOTATION MARK;Pi;0;ON;;;;;Y;LEFT POINTING SINGLE GUILLEMET;;;; +203A;SINGLE RIGHT-POINTING ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING SINGLE GUILLEMET;;;; +203B;REFERENCE MARK;Po;0;ON;;;;;N;;;;; +203C;DOUBLE EXCLAMATION MARK;Po;0;ON;<compat> 0021 0021;;;;N;;;;; +203D;INTERROBANG;Po;0;ON;;;;;N;;;;; +203E;OVERLINE;Po;0;ON;<compat> 0020 0305;;;;N;SPACING OVERSCORE;;;; +203F;UNDERTIE;Pc;0;ON;;;;;N;;;;; +2040;CHARACTER TIE;Pc;0;ON;;;;;N;;;;; +2041;CARET INSERTION POINT;Po;0;ON;;;;;N;;;;; +2042;ASTERISM;Po;0;ON;;;;;N;;;;; +2043;HYPHEN BULLET;Po;0;ON;;;;;N;;;;; +2044;FRACTION SLASH;Sm;0;CS;;;;;N;;;;; +2045;LEFT SQUARE BRACKET WITH QUILL;Ps;0;ON;;;;;Y;;;;; +2046;RIGHT SQUARE BRACKET WITH QUILL;Pe;0;ON;;;;;Y;;;;; +2047;DOUBLE QUESTION MARK;Po;0;ON;<compat> 003F 003F;;;;N;;;;; +2048;QUESTION EXCLAMATION MARK;Po;0;ON;<compat> 003F 0021;;;;N;;;;; +2049;EXCLAMATION QUESTION MARK;Po;0;ON;<compat> 0021 003F;;;;N;;;;; +204A;TIRONIAN SIGN ET;Po;0;ON;;;;;N;;;;; +204B;REVERSED PILCROW SIGN;Po;0;ON;;;;;N;;;;; +204C;BLACK LEFTWARDS BULLET;Po;0;ON;;;;;N;;;;; +204D;BLACK RIGHTWARDS BULLET;Po;0;ON;;;;;N;;;;; +204E;LOW ASTERISK;Po;0;ON;;;;;N;;;;; +204F;REVERSED SEMICOLON;Po;0;ON;;;;;N;;;;; +2050;CLOSE UP;Po;0;ON;;;;;N;;;;; +2051;TWO ASTERISKS ALIGNED VERTICALLY;Po;0;ON;;;;;N;;;;; +2052;COMMERCIAL MINUS SIGN;Sm;0;ON;;;;;N;;;;; +2053;SWUNG DASH;Po;0;ON;;;;;N;;;;; +2054;INVERTED UNDERTIE;Pc;0;ON;;;;;N;;;;; +2055;FLOWER PUNCTUATION MARK;Po;0;ON;;;;;N;;;;; +2056;THREE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +2057;QUADRUPLE PRIME;Po;0;ON;<compat> 2032 2032 2032 2032;;;;N;;;;; +2058;FOUR DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +2059;FIVE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +205A;TWO DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +205B;FOUR DOT MARK;Po;0;ON;;;;;N;;;;; +205C;DOTTED CROSS;Po;0;ON;;;;;N;;;;; +205D;TRICOLON;Po;0;ON;;;;;N;;;;; +205E;VERTICAL FOUR DOTS;Po;0;ON;;;;;N;;;;; +205F;MEDIUM MATHEMATICAL SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;; +2060;WORD JOINER;Cf;0;BN;;;;;N;;;;; +2061;FUNCTION APPLICATION;Cf;0;BN;;;;;N;;;;; +2062;INVISIBLE TIMES;Cf;0;BN;;;;;N;;;;; +2063;INVISIBLE SEPARATOR;Cf;0;BN;;;;;N;;;;; +2064;INVISIBLE PLUS;Cf;0;BN;;;;;N;;;;; +2066;LEFT-TO-RIGHT ISOLATE;Cf;0;LRI;;;;;N;;;;; +2067;RIGHT-TO-LEFT ISOLATE;Cf;0;RLI;;;;;N;;;;; +2068;FIRST STRONG ISOLATE;Cf;0;FSI;;;;;N;;;;; +2069;POP DIRECTIONAL ISOLATE;Cf;0;PDI;;;;;N;;;;; +206A;INHIBIT SYMMETRIC SWAPPING;Cf;0;BN;;;;;N;;;;; +206B;ACTIVATE SYMMETRIC SWAPPING;Cf;0;BN;;;;;N;;;;; +206C;INHIBIT ARABIC FORM SHAPING;Cf;0;BN;;;;;N;;;;; +206D;ACTIVATE ARABIC FORM SHAPING;Cf;0;BN;;;;;N;;;;; +206E;NATIONAL DIGIT SHAPES;Cf;0;BN;;;;;N;;;;; +206F;NOMINAL DIGIT SHAPES;Cf;0;BN;;;;;N;;;;; +2070;SUPERSCRIPT ZERO;No;0;EN;<super> 0030;;0;0;N;SUPERSCRIPT DIGIT ZERO;;;; +2071;SUPERSCRIPT LATIN SMALL LETTER I;Lm;0;L;<super> 0069;;;;N;;;;; +2074;SUPERSCRIPT FOUR;No;0;EN;<super> 0034;;4;4;N;SUPERSCRIPT DIGIT FOUR;;;; +2075;SUPERSCRIPT FIVE;No;0;EN;<super> 0035;;5;5;N;SUPERSCRIPT DIGIT FIVE;;;; +2076;SUPERSCRIPT SIX;No;0;EN;<super> 0036;;6;6;N;SUPERSCRIPT DIGIT SIX;;;; +2077;SUPERSCRIPT SEVEN;No;0;EN;<super> 0037;;7;7;N;SUPERSCRIPT DIGIT SEVEN;;;; +2078;SUPERSCRIPT EIGHT;No;0;EN;<super> 0038;;8;8;N;SUPERSCRIPT DIGIT EIGHT;;;; +2079;SUPERSCRIPT NINE;No;0;EN;<super> 0039;;9;9;N;SUPERSCRIPT DIGIT NINE;;;; +207A;SUPERSCRIPT PLUS SIGN;Sm;0;ES;<super> 002B;;;;N;;;;; +207B;SUPERSCRIPT MINUS;Sm;0;ES;<super> 2212;;;;N;SUPERSCRIPT HYPHEN-MINUS;;;; +207C;SUPERSCRIPT EQUALS SIGN;Sm;0;ON;<super> 003D;;;;N;;;;; +207D;SUPERSCRIPT LEFT PARENTHESIS;Ps;0;ON;<super> 0028;;;;Y;SUPERSCRIPT OPENING PARENTHESIS;;;; +207E;SUPERSCRIPT RIGHT PARENTHESIS;Pe;0;ON;<super> 0029;;;;Y;SUPERSCRIPT CLOSING PARENTHESIS;;;; +207F;SUPERSCRIPT LATIN SMALL LETTER N;Lm;0;L;<super> 006E;;;;N;;;;; +2080;SUBSCRIPT ZERO;No;0;EN;<sub> 0030;;0;0;N;SUBSCRIPT DIGIT ZERO;;;; +2081;SUBSCRIPT ONE;No;0;EN;<sub> 0031;;1;1;N;SUBSCRIPT DIGIT ONE;;;; +2082;SUBSCRIPT TWO;No;0;EN;<sub> 0032;;2;2;N;SUBSCRIPT DIGIT TWO;;;; +2083;SUBSCRIPT THREE;No;0;EN;<sub> 0033;;3;3;N;SUBSCRIPT DIGIT THREE;;;; +2084;SUBSCRIPT FOUR;No;0;EN;<sub> 0034;;4;4;N;SUBSCRIPT DIGIT FOUR;;;; +2085;SUBSCRIPT FIVE;No;0;EN;<sub> 0035;;5;5;N;SUBSCRIPT DIGIT FIVE;;;; +2086;SUBSCRIPT SIX;No;0;EN;<sub> 0036;;6;6;N;SUBSCRIPT DIGIT SIX;;;; +2087;SUBSCRIPT SEVEN;No;0;EN;<sub> 0037;;7;7;N;SUBSCRIPT DIGIT SEVEN;;;; +2088;SUBSCRIPT EIGHT;No;0;EN;<sub> 0038;;8;8;N;SUBSCRIPT DIGIT EIGHT;;;; +2089;SUBSCRIPT NINE;No;0;EN;<sub> 0039;;9;9;N;SUBSCRIPT DIGIT NINE;;;; +208A;SUBSCRIPT PLUS SIGN;Sm;0;ES;<sub> 002B;;;;N;;;;; +208B;SUBSCRIPT MINUS;Sm;0;ES;<sub> 2212;;;;N;SUBSCRIPT HYPHEN-MINUS;;;; +208C;SUBSCRIPT EQUALS SIGN;Sm;0;ON;<sub> 003D;;;;N;;;;; +208D;SUBSCRIPT LEFT PARENTHESIS;Ps;0;ON;<sub> 0028;;;;Y;SUBSCRIPT OPENING PARENTHESIS;;;; +208E;SUBSCRIPT RIGHT PARENTHESIS;Pe;0;ON;<sub> 0029;;;;Y;SUBSCRIPT CLOSING PARENTHESIS;;;; +2090;LATIN SUBSCRIPT SMALL LETTER A;Lm;0;L;<sub> 0061;;;;N;;;;; +2091;LATIN SUBSCRIPT SMALL LETTER E;Lm;0;L;<sub> 0065;;;;N;;;;; +2092;LATIN SUBSCRIPT SMALL LETTER O;Lm;0;L;<sub> 006F;;;;N;;;;; +2093;LATIN SUBSCRIPT SMALL LETTER X;Lm;0;L;<sub> 0078;;;;N;;;;; +2094;LATIN SUBSCRIPT SMALL LETTER SCHWA;Lm;0;L;<sub> 0259;;;;N;;;;; +2095;LATIN SUBSCRIPT SMALL LETTER H;Lm;0;L;<sub> 0068;;;;N;;;;; +2096;LATIN SUBSCRIPT SMALL LETTER K;Lm;0;L;<sub> 006B;;;;N;;;;; +2097;LATIN SUBSCRIPT SMALL LETTER L;Lm;0;L;<sub> 006C;;;;N;;;;; +2098;LATIN SUBSCRIPT SMALL LETTER M;Lm;0;L;<sub> 006D;;;;N;;;;; +2099;LATIN SUBSCRIPT SMALL LETTER N;Lm;0;L;<sub> 006E;;;;N;;;;; +209A;LATIN SUBSCRIPT SMALL LETTER P;Lm;0;L;<sub> 0070;;;;N;;;;; +209B;LATIN SUBSCRIPT SMALL LETTER S;Lm;0;L;<sub> 0073;;;;N;;;;; +209C;LATIN SUBSCRIPT SMALL LETTER T;Lm;0;L;<sub> 0074;;;;N;;;;; +20A0;EURO-CURRENCY SIGN;Sc;0;ET;;;;;N;;;;; +20A1;COLON SIGN;Sc;0;ET;;;;;N;;;;; +20A2;CRUZEIRO SIGN;Sc;0;ET;;;;;N;;;;; +20A3;FRENCH FRANC SIGN;Sc;0;ET;;;;;N;;;;; +20A4;LIRA SIGN;Sc;0;ET;;;;;N;;;;; +20A5;MILL SIGN;Sc;0;ET;;;;;N;;;;; +20A6;NAIRA SIGN;Sc;0;ET;;;;;N;;;;; +20A7;PESETA SIGN;Sc;0;ET;;;;;N;;;;; +20A8;RUPEE SIGN;Sc;0;ET;<compat> 0052 0073;;;;N;;;;; +20A9;WON SIGN;Sc;0;ET;;;;;N;;;;; +20AA;NEW SHEQEL SIGN;Sc;0;ET;;;;;N;;;;; +20AB;DONG SIGN;Sc;0;ET;;;;;N;;;;; +20AC;EURO SIGN;Sc;0;ET;;;;;N;;;;; +20AD;KIP SIGN;Sc;0;ET;;;;;N;;;;; +20AE;TUGRIK SIGN;Sc;0;ET;;;;;N;;;;; +20AF;DRACHMA SIGN;Sc;0;ET;;;;;N;;;;; +20B0;GERMAN PENNY SIGN;Sc;0;ET;;;;;N;;;;; +20B1;PESO SIGN;Sc;0;ET;;;;;N;;;;; +20B2;GUARANI SIGN;Sc;0;ET;;;;;N;;;;; +20B3;AUSTRAL SIGN;Sc;0;ET;;;;;N;;;;; +20B4;HRYVNIA SIGN;Sc;0;ET;;;;;N;;;;; +20B5;CEDI SIGN;Sc;0;ET;;;;;N;;;;; +20B6;LIVRE TOURNOIS SIGN;Sc;0;ET;;;;;N;;;;; +20B7;SPESMILO SIGN;Sc;0;ET;;;;;N;;;;; +20B8;TENGE SIGN;Sc;0;ET;;;;;N;;;;; +20B9;INDIAN RUPEE SIGN;Sc;0;ET;;;;;N;;;;; +20BA;TURKISH LIRA SIGN;Sc;0;ET;;;;;N;;;;; +20BB;NORDIC MARK SIGN;Sc;0;ET;;;;;N;;;;; +20BC;MANAT SIGN;Sc;0;ET;;;;;N;;;;; +20BD;RUBLE SIGN;Sc;0;ET;;;;;N;;;;; +20BE;LARI SIGN;Sc;0;ET;;;;;N;;;;; +20BF;BITCOIN SIGN;Sc;0;ET;;;;;N;;;;; +20D0;COMBINING LEFT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT HARPOON ABOVE;;;; +20D1;COMBINING RIGHT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT HARPOON ABOVE;;;; +20D2;COMBINING LONG VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG VERTICAL BAR OVERLAY;;;; +20D3;COMBINING SHORT VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING SHORT VERTICAL BAR OVERLAY;;;; +20D4;COMBINING ANTICLOCKWISE ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING ANTICLOCKWISE ARROW ABOVE;;;; +20D5;COMBINING CLOCKWISE ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING CLOCKWISE ARROW ABOVE;;;; +20D6;COMBINING LEFT ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT ARROW ABOVE;;;; +20D7;COMBINING RIGHT ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT ARROW ABOVE;;;; +20D8;COMBINING RING OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING RING OVERLAY;;;; +20D9;COMBINING CLOCKWISE RING OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING CLOCKWISE RING OVERLAY;;;; +20DA;COMBINING ANTICLOCKWISE RING OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING ANTICLOCKWISE RING OVERLAY;;;; +20DB;COMBINING THREE DOTS ABOVE;Mn;230;NSM;;;;;N;NON-SPACING THREE DOTS ABOVE;;;; +20DC;COMBINING FOUR DOTS ABOVE;Mn;230;NSM;;;;;N;NON-SPACING FOUR DOTS ABOVE;;;; +20DD;COMBINING ENCLOSING CIRCLE;Me;0;NSM;;;;;N;ENCLOSING CIRCLE;;;; +20DE;COMBINING ENCLOSING SQUARE;Me;0;NSM;;;;;N;ENCLOSING SQUARE;;;; +20DF;COMBINING ENCLOSING DIAMOND;Me;0;NSM;;;;;N;ENCLOSING DIAMOND;;;; +20E0;COMBINING ENCLOSING CIRCLE BACKSLASH;Me;0;NSM;;;;;N;ENCLOSING CIRCLE SLASH;;;; +20E1;COMBINING LEFT RIGHT ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT RIGHT ARROW ABOVE;;;; +20E2;COMBINING ENCLOSING SCREEN;Me;0;NSM;;;;;N;;;;; +20E3;COMBINING ENCLOSING KEYCAP;Me;0;NSM;;;;;N;;;;; +20E4;COMBINING ENCLOSING UPWARD POINTING TRIANGLE;Me;0;NSM;;;;;N;;;;; +20E5;COMBINING REVERSE SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;;;;; +20E6;COMBINING DOUBLE VERTICAL STROKE OVERLAY;Mn;1;NSM;;;;;N;;;;; +20E7;COMBINING ANNUITY SYMBOL;Mn;230;NSM;;;;;N;;;;; +20E8;COMBINING TRIPLE UNDERDOT;Mn;220;NSM;;;;;N;;;;; +20E9;COMBINING WIDE BRIDGE ABOVE;Mn;230;NSM;;;;;N;;;;; +20EA;COMBINING LEFTWARDS ARROW OVERLAY;Mn;1;NSM;;;;;N;;;;; +20EB;COMBINING LONG DOUBLE SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;;;;; +20EC;COMBINING RIGHTWARDS HARPOON WITH BARB DOWNWARDS;Mn;220;NSM;;;;;N;;;;; +20ED;COMBINING LEFTWARDS HARPOON WITH BARB DOWNWARDS;Mn;220;NSM;;;;;N;;;;; +20EE;COMBINING LEFT ARROW BELOW;Mn;220;NSM;;;;;N;;;;; +20EF;COMBINING RIGHT ARROW BELOW;Mn;220;NSM;;;;;N;;;;; +20F0;COMBINING ASTERISK ABOVE;Mn;230;NSM;;;;;N;;;;; +2100;ACCOUNT OF;So;0;ON;<compat> 0061 002F 0063;;;;N;;;;; +2101;ADDRESSED TO THE SUBJECT;So;0;ON;<compat> 0061 002F 0073;;;;N;;;;; +2102;DOUBLE-STRUCK CAPITAL C;Lu;0;L;<font> 0043;;;;N;DOUBLE-STRUCK C;;;; +2103;DEGREE CELSIUS;So;0;ON;<compat> 00B0 0043;;;;N;DEGREES CENTIGRADE;;;; +2104;CENTRE LINE SYMBOL;So;0;ON;;;;;N;C L SYMBOL;;;; +2105;CARE OF;So;0;ON;<compat> 0063 002F 006F;;;;N;;;;; +2106;CADA UNA;So;0;ON;<compat> 0063 002F 0075;;;;N;;;;; +2107;EULER CONSTANT;Lu;0;L;<compat> 0190;;;;N;EULERS;;;; +2108;SCRUPLE;So;0;ON;;;;;N;;;;; +2109;DEGREE FAHRENHEIT;So;0;ON;<compat> 00B0 0046;;;;N;DEGREES FAHRENHEIT;;;; +210A;SCRIPT SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +210B;SCRIPT CAPITAL H;Lu;0;L;<font> 0048;;;;N;SCRIPT H;;;; +210C;BLACK-LETTER CAPITAL H;Lu;0;L;<font> 0048;;;;N;BLACK-LETTER H;;;; +210D;DOUBLE-STRUCK CAPITAL H;Lu;0;L;<font> 0048;;;;N;DOUBLE-STRUCK H;;;; +210E;PLANCK CONSTANT;Ll;0;L;<font> 0068;;;;N;;;;; +210F;PLANCK CONSTANT OVER TWO PI;Ll;0;L;<font> 0127;;;;N;PLANCK CONSTANT OVER 2 PI;;;; +2110;SCRIPT CAPITAL I;Lu;0;L;<font> 0049;;;;N;SCRIPT I;;;; +2111;BLACK-LETTER CAPITAL I;Lu;0;L;<font> 0049;;;;N;BLACK-LETTER I;;;; +2112;SCRIPT CAPITAL L;Lu;0;L;<font> 004C;;;;N;SCRIPT L;;;; +2113;SCRIPT SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +2114;L B BAR SYMBOL;So;0;ON;;;;;N;;;;; +2115;DOUBLE-STRUCK CAPITAL N;Lu;0;L;<font> 004E;;;;N;DOUBLE-STRUCK N;;;; +2116;NUMERO SIGN;So;0;ON;<compat> 004E 006F;;;;N;NUMERO;;;; +2117;SOUND RECORDING COPYRIGHT;So;0;ON;;;;;N;;;;; +2118;SCRIPT CAPITAL P;Sm;0;ON;;;;;N;SCRIPT P;;;; +2119;DOUBLE-STRUCK CAPITAL P;Lu;0;L;<font> 0050;;;;N;DOUBLE-STRUCK P;;;; +211A;DOUBLE-STRUCK CAPITAL Q;Lu;0;L;<font> 0051;;;;N;DOUBLE-STRUCK Q;;;; +211B;SCRIPT CAPITAL R;Lu;0;L;<font> 0052;;;;N;SCRIPT R;;;; +211C;BLACK-LETTER CAPITAL R;Lu;0;L;<font> 0052;;;;N;BLACK-LETTER R;;;; +211D;DOUBLE-STRUCK CAPITAL R;Lu;0;L;<font> 0052;;;;N;DOUBLE-STRUCK R;;;; +211E;PRESCRIPTION TAKE;So;0;ON;;;;;N;;;;; +211F;RESPONSE;So;0;ON;;;;;N;;;;; +2120;SERVICE MARK;So;0;ON;<super> 0053 004D;;;;N;;;;; +2121;TELEPHONE SIGN;So;0;ON;<compat> 0054 0045 004C;;;;N;T E L SYMBOL;;;; +2122;TRADE MARK SIGN;So;0;ON;<super> 0054 004D;;;;N;TRADEMARK;;;; +2123;VERSICLE;So;0;ON;;;;;N;;;;; +2124;DOUBLE-STRUCK CAPITAL Z;Lu;0;L;<font> 005A;;;;N;DOUBLE-STRUCK Z;;;; +2125;OUNCE SIGN;So;0;ON;;;;;N;OUNCE;;;; +2126;OHM SIGN;Lu;0;L;03A9;;;;N;OHM;;;03C9; +2127;INVERTED OHM SIGN;So;0;ON;;;;;N;MHO;;;; +2128;BLACK-LETTER CAPITAL Z;Lu;0;L;<font> 005A;;;;N;BLACK-LETTER Z;;;; +2129;TURNED GREEK SMALL LETTER IOTA;So;0;ON;;;;;N;;;;; +212A;KELVIN SIGN;Lu;0;L;004B;;;;N;DEGREES KELVIN;;;006B; +212B;ANGSTROM SIGN;Lu;0;L;00C5;;;;N;ANGSTROM UNIT;;;00E5; +212C;SCRIPT CAPITAL B;Lu;0;L;<font> 0042;;;;N;SCRIPT B;;;; +212D;BLACK-LETTER CAPITAL C;Lu;0;L;<font> 0043;;;;N;BLACK-LETTER C;;;; +212E;ESTIMATED SYMBOL;So;0;ET;;;;;N;;;;; +212F;SCRIPT SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +2130;SCRIPT CAPITAL E;Lu;0;L;<font> 0045;;;;N;SCRIPT E;;;; +2131;SCRIPT CAPITAL F;Lu;0;L;<font> 0046;;;;N;SCRIPT F;;;; +2132;TURNED CAPITAL F;Lu;0;L;;;;;N;TURNED F;;;214E; +2133;SCRIPT CAPITAL M;Lu;0;L;<font> 004D;;;;N;SCRIPT M;;;; +2134;SCRIPT SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +2135;ALEF SYMBOL;Lo;0;L;<compat> 05D0;;;;N;FIRST TRANSFINITE CARDINAL;;;; +2136;BET SYMBOL;Lo;0;L;<compat> 05D1;;;;N;SECOND TRANSFINITE CARDINAL;;;; +2137;GIMEL SYMBOL;Lo;0;L;<compat> 05D2;;;;N;THIRD TRANSFINITE CARDINAL;;;; +2138;DALET SYMBOL;Lo;0;L;<compat> 05D3;;;;N;FOURTH TRANSFINITE CARDINAL;;;; +2139;INFORMATION SOURCE;Ll;0;L;<font> 0069;;;;N;;;;; +213A;ROTATED CAPITAL Q;So;0;ON;;;;;N;;;;; +213B;FACSIMILE SIGN;So;0;ON;<compat> 0046 0041 0058;;;;N;;;;; +213C;DOUBLE-STRUCK SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;; +213D;DOUBLE-STRUCK SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;; +213E;DOUBLE-STRUCK CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;; +213F;DOUBLE-STRUCK CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;; +2140;DOUBLE-STRUCK N-ARY SUMMATION;Sm;0;ON;<font> 2211;;;;Y;;;;; +2141;TURNED SANS-SERIF CAPITAL G;Sm;0;ON;;;;;N;;;;; +2142;TURNED SANS-SERIF CAPITAL L;Sm;0;ON;;;;;N;;;;; +2143;REVERSED SANS-SERIF CAPITAL L;Sm;0;ON;;;;;N;;;;; +2144;TURNED SANS-SERIF CAPITAL Y;Sm;0;ON;;;;;N;;;;; +2145;DOUBLE-STRUCK ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +2146;DOUBLE-STRUCK ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +2147;DOUBLE-STRUCK ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +2148;DOUBLE-STRUCK ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +2149;DOUBLE-STRUCK ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +214A;PROPERTY LINE;So;0;ON;;;;;N;;;;; +214B;TURNED AMPERSAND;Sm;0;ON;;;;;N;;;;; +214C;PER SIGN;So;0;ON;;;;;N;;;;; +214D;AKTIESELSKAB;So;0;ON;;;;;N;;;;; +214E;TURNED SMALL F;Ll;0;L;;;;;N;;;2132;;2132 +214F;SYMBOL FOR SAMARITAN SOURCE;So;0;L;;;;;N;;;;; +2150;VULGAR FRACTION ONE SEVENTH;No;0;ON;<fraction> 0031 2044 0037;;;1/7;N;;;;; +2151;VULGAR FRACTION ONE NINTH;No;0;ON;<fraction> 0031 2044 0039;;;1/9;N;;;;; +2152;VULGAR FRACTION ONE TENTH;No;0;ON;<fraction> 0031 2044 0031 0030;;;1/10;N;;;;; +2153;VULGAR FRACTION ONE THIRD;No;0;ON;<fraction> 0031 2044 0033;;;1/3;N;FRACTION ONE THIRD;;;; +2154;VULGAR FRACTION TWO THIRDS;No;0;ON;<fraction> 0032 2044 0033;;;2/3;N;FRACTION TWO THIRDS;;;; +2155;VULGAR FRACTION ONE FIFTH;No;0;ON;<fraction> 0031 2044 0035;;;1/5;N;FRACTION ONE FIFTH;;;; +2156;VULGAR FRACTION TWO FIFTHS;No;0;ON;<fraction> 0032 2044 0035;;;2/5;N;FRACTION TWO FIFTHS;;;; +2157;VULGAR FRACTION THREE FIFTHS;No;0;ON;<fraction> 0033 2044 0035;;;3/5;N;FRACTION THREE FIFTHS;;;; +2158;VULGAR FRACTION FOUR FIFTHS;No;0;ON;<fraction> 0034 2044 0035;;;4/5;N;FRACTION FOUR FIFTHS;;;; +2159;VULGAR FRACTION ONE SIXTH;No;0;ON;<fraction> 0031 2044 0036;;;1/6;N;FRACTION ONE SIXTH;;;; +215A;VULGAR FRACTION FIVE SIXTHS;No;0;ON;<fraction> 0035 2044 0036;;;5/6;N;FRACTION FIVE SIXTHS;;;; +215B;VULGAR FRACTION ONE EIGHTH;No;0;ON;<fraction> 0031 2044 0038;;;1/8;N;FRACTION ONE EIGHTH;;;; +215C;VULGAR FRACTION THREE EIGHTHS;No;0;ON;<fraction> 0033 2044 0038;;;3/8;N;FRACTION THREE EIGHTHS;;;; +215D;VULGAR FRACTION FIVE EIGHTHS;No;0;ON;<fraction> 0035 2044 0038;;;5/8;N;FRACTION FIVE EIGHTHS;;;; +215E;VULGAR FRACTION SEVEN EIGHTHS;No;0;ON;<fraction> 0037 2044 0038;;;7/8;N;FRACTION SEVEN EIGHTHS;;;; +215F;FRACTION NUMERATOR ONE;No;0;ON;<fraction> 0031 2044;;;1;N;;;;; +2160;ROMAN NUMERAL ONE;Nl;0;L;<compat> 0049;;;1;N;;;;2170; +2161;ROMAN NUMERAL TWO;Nl;0;L;<compat> 0049 0049;;;2;N;;;;2171; +2162;ROMAN NUMERAL THREE;Nl;0;L;<compat> 0049 0049 0049;;;3;N;;;;2172; +2163;ROMAN NUMERAL FOUR;Nl;0;L;<compat> 0049 0056;;;4;N;;;;2173; +2164;ROMAN NUMERAL FIVE;Nl;0;L;<compat> 0056;;;5;N;;;;2174; +2165;ROMAN NUMERAL SIX;Nl;0;L;<compat> 0056 0049;;;6;N;;;;2175; +2166;ROMAN NUMERAL SEVEN;Nl;0;L;<compat> 0056 0049 0049;;;7;N;;;;2176; +2167;ROMAN NUMERAL EIGHT;Nl;0;L;<compat> 0056 0049 0049 0049;;;8;N;;;;2177; +2168;ROMAN NUMERAL NINE;Nl;0;L;<compat> 0049 0058;;;9;N;;;;2178; +2169;ROMAN NUMERAL TEN;Nl;0;L;<compat> 0058;;;10;N;;;;2179; +216A;ROMAN NUMERAL ELEVEN;Nl;0;L;<compat> 0058 0049;;;11;N;;;;217A; +216B;ROMAN NUMERAL TWELVE;Nl;0;L;<compat> 0058 0049 0049;;;12;N;;;;217B; +216C;ROMAN NUMERAL FIFTY;Nl;0;L;<compat> 004C;;;50;N;;;;217C; +216D;ROMAN NUMERAL ONE HUNDRED;Nl;0;L;<compat> 0043;;;100;N;;;;217D; +216E;ROMAN NUMERAL FIVE HUNDRED;Nl;0;L;<compat> 0044;;;500;N;;;;217E; +216F;ROMAN NUMERAL ONE THOUSAND;Nl;0;L;<compat> 004D;;;1000;N;;;;217F; +2170;SMALL ROMAN NUMERAL ONE;Nl;0;L;<compat> 0069;;;1;N;;;2160;;2160 +2171;SMALL ROMAN NUMERAL TWO;Nl;0;L;<compat> 0069 0069;;;2;N;;;2161;;2161 +2172;SMALL ROMAN NUMERAL THREE;Nl;0;L;<compat> 0069 0069 0069;;;3;N;;;2162;;2162 +2173;SMALL ROMAN NUMERAL FOUR;Nl;0;L;<compat> 0069 0076;;;4;N;;;2163;;2163 +2174;SMALL ROMAN NUMERAL FIVE;Nl;0;L;<compat> 0076;;;5;N;;;2164;;2164 +2175;SMALL ROMAN NUMERAL SIX;Nl;0;L;<compat> 0076 0069;;;6;N;;;2165;;2165 +2176;SMALL ROMAN NUMERAL SEVEN;Nl;0;L;<compat> 0076 0069 0069;;;7;N;;;2166;;2166 +2177;SMALL ROMAN NUMERAL EIGHT;Nl;0;L;<compat> 0076 0069 0069 0069;;;8;N;;;2167;;2167 +2178;SMALL ROMAN NUMERAL NINE;Nl;0;L;<compat> 0069 0078;;;9;N;;;2168;;2168 +2179;SMALL ROMAN NUMERAL TEN;Nl;0;L;<compat> 0078;;;10;N;;;2169;;2169 +217A;SMALL ROMAN NUMERAL ELEVEN;Nl;0;L;<compat> 0078 0069;;;11;N;;;216A;;216A +217B;SMALL ROMAN NUMERAL TWELVE;Nl;0;L;<compat> 0078 0069 0069;;;12;N;;;216B;;216B +217C;SMALL ROMAN NUMERAL FIFTY;Nl;0;L;<compat> 006C;;;50;N;;;216C;;216C +217D;SMALL ROMAN NUMERAL ONE HUNDRED;Nl;0;L;<compat> 0063;;;100;N;;;216D;;216D +217E;SMALL ROMAN NUMERAL FIVE HUNDRED;Nl;0;L;<compat> 0064;;;500;N;;;216E;;216E +217F;SMALL ROMAN NUMERAL ONE THOUSAND;Nl;0;L;<compat> 006D;;;1000;N;;;216F;;216F +2180;ROMAN NUMERAL ONE THOUSAND C D;Nl;0;L;;;;1000;N;;;;; +2181;ROMAN NUMERAL FIVE THOUSAND;Nl;0;L;;;;5000;N;;;;; +2182;ROMAN NUMERAL TEN THOUSAND;Nl;0;L;;;;10000;N;;;;; +2183;ROMAN NUMERAL REVERSED ONE HUNDRED;Lu;0;L;;;;;N;;;;2184; +2184;LATIN SMALL LETTER REVERSED C;Ll;0;L;;;;;N;;;2183;;2183 +2185;ROMAN NUMERAL SIX LATE FORM;Nl;0;L;;;;6;N;;;;; +2186;ROMAN NUMERAL FIFTY EARLY FORM;Nl;0;L;;;;50;N;;;;; +2187;ROMAN NUMERAL FIFTY THOUSAND;Nl;0;L;;;;50000;N;;;;; +2188;ROMAN NUMERAL ONE HUNDRED THOUSAND;Nl;0;L;;;;100000;N;;;;; +2189;VULGAR FRACTION ZERO THIRDS;No;0;ON;<fraction> 0030 2044 0033;;;0;N;;;;; +218A;TURNED DIGIT TWO;So;0;ON;;;;;N;;;;; +218B;TURNED DIGIT THREE;So;0;ON;;;;;N;;;;; +2190;LEFTWARDS ARROW;Sm;0;ON;;;;;N;LEFT ARROW;;;; +2191;UPWARDS ARROW;Sm;0;ON;;;;;N;UP ARROW;;;; +2192;RIGHTWARDS ARROW;Sm;0;ON;;;;;N;RIGHT ARROW;;;; +2193;DOWNWARDS ARROW;Sm;0;ON;;;;;N;DOWN ARROW;;;; +2194;LEFT RIGHT ARROW;Sm;0;ON;;;;;N;;;;; +2195;UP DOWN ARROW;So;0;ON;;;;;N;;;;; +2196;NORTH WEST ARROW;So;0;ON;;;;;N;UPPER LEFT ARROW;;;; +2197;NORTH EAST ARROW;So;0;ON;;;;;N;UPPER RIGHT ARROW;;;; +2198;SOUTH EAST ARROW;So;0;ON;;;;;N;LOWER RIGHT ARROW;;;; +2199;SOUTH WEST ARROW;So;0;ON;;;;;N;LOWER LEFT ARROW;;;; +219A;LEFTWARDS ARROW WITH STROKE;Sm;0;ON;2190 0338;;;;N;LEFT ARROW WITH STROKE;;;; +219B;RIGHTWARDS ARROW WITH STROKE;Sm;0;ON;2192 0338;;;;N;RIGHT ARROW WITH STROKE;;;; +219C;LEFTWARDS WAVE ARROW;So;0;ON;;;;;N;LEFT WAVE ARROW;;;; +219D;RIGHTWARDS WAVE ARROW;So;0;ON;;;;;N;RIGHT WAVE ARROW;;;; +219E;LEFTWARDS TWO HEADED ARROW;So;0;ON;;;;;N;LEFT TWO HEADED ARROW;;;; +219F;UPWARDS TWO HEADED ARROW;So;0;ON;;;;;N;UP TWO HEADED ARROW;;;; +21A0;RIGHTWARDS TWO HEADED ARROW;Sm;0;ON;;;;;N;RIGHT TWO HEADED ARROW;;;; +21A1;DOWNWARDS TWO HEADED ARROW;So;0;ON;;;;;N;DOWN TWO HEADED ARROW;;;; +21A2;LEFTWARDS ARROW WITH TAIL;So;0;ON;;;;;N;LEFT ARROW WITH TAIL;;;; +21A3;RIGHTWARDS ARROW WITH TAIL;Sm;0;ON;;;;;N;RIGHT ARROW WITH TAIL;;;; +21A4;LEFTWARDS ARROW FROM BAR;So;0;ON;;;;;N;LEFT ARROW FROM BAR;;;; +21A5;UPWARDS ARROW FROM BAR;So;0;ON;;;;;N;UP ARROW FROM BAR;;;; +21A6;RIGHTWARDS ARROW FROM BAR;Sm;0;ON;;;;;N;RIGHT ARROW FROM BAR;;;; +21A7;DOWNWARDS ARROW FROM BAR;So;0;ON;;;;;N;DOWN ARROW FROM BAR;;;; +21A8;UP DOWN ARROW WITH BASE;So;0;ON;;;;;N;;;;; +21A9;LEFTWARDS ARROW WITH HOOK;So;0;ON;;;;;N;LEFT ARROW WITH HOOK;;;; +21AA;RIGHTWARDS ARROW WITH HOOK;So;0;ON;;;;;N;RIGHT ARROW WITH HOOK;;;; +21AB;LEFTWARDS ARROW WITH LOOP;So;0;ON;;;;;N;LEFT ARROW WITH LOOP;;;; +21AC;RIGHTWARDS ARROW WITH LOOP;So;0;ON;;;;;N;RIGHT ARROW WITH LOOP;;;; +21AD;LEFT RIGHT WAVE ARROW;So;0;ON;;;;;N;;;;; +21AE;LEFT RIGHT ARROW WITH STROKE;Sm;0;ON;2194 0338;;;;N;;;;; +21AF;DOWNWARDS ZIGZAG ARROW;So;0;ON;;;;;N;DOWN ZIGZAG ARROW;;;; +21B0;UPWARDS ARROW WITH TIP LEFTWARDS;So;0;ON;;;;;N;UP ARROW WITH TIP LEFT;;;; +21B1;UPWARDS ARROW WITH TIP RIGHTWARDS;So;0;ON;;;;;N;UP ARROW WITH TIP RIGHT;;;; +21B2;DOWNWARDS ARROW WITH TIP LEFTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH TIP LEFT;;;; +21B3;DOWNWARDS ARROW WITH TIP RIGHTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH TIP RIGHT;;;; +21B4;RIGHTWARDS ARROW WITH CORNER DOWNWARDS;So;0;ON;;;;;N;RIGHT ARROW WITH CORNER DOWN;;;; +21B5;DOWNWARDS ARROW WITH CORNER LEFTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH CORNER LEFT;;;; +21B6;ANTICLOCKWISE TOP SEMICIRCLE ARROW;So;0;ON;;;;;N;;;;; +21B7;CLOCKWISE TOP SEMICIRCLE ARROW;So;0;ON;;;;;N;;;;; +21B8;NORTH WEST ARROW TO LONG BAR;So;0;ON;;;;;N;UPPER LEFT ARROW TO LONG BAR;;;; +21B9;LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR;So;0;ON;;;;;N;LEFT ARROW TO BAR OVER RIGHT ARROW TO BAR;;;; +21BA;ANTICLOCKWISE OPEN CIRCLE ARROW;So;0;ON;;;;;N;;;;; +21BB;CLOCKWISE OPEN CIRCLE ARROW;So;0;ON;;;;;N;;;;; +21BC;LEFTWARDS HARPOON WITH BARB UPWARDS;So;0;ON;;;;;N;LEFT HARPOON WITH BARB UP;;;; +21BD;LEFTWARDS HARPOON WITH BARB DOWNWARDS;So;0;ON;;;;;N;LEFT HARPOON WITH BARB DOWN;;;; +21BE;UPWARDS HARPOON WITH BARB RIGHTWARDS;So;0;ON;;;;;N;UP HARPOON WITH BARB RIGHT;;;; +21BF;UPWARDS HARPOON WITH BARB LEFTWARDS;So;0;ON;;;;;N;UP HARPOON WITH BARB LEFT;;;; +21C0;RIGHTWARDS HARPOON WITH BARB UPWARDS;So;0;ON;;;;;N;RIGHT HARPOON WITH BARB UP;;;; +21C1;RIGHTWARDS HARPOON WITH BARB DOWNWARDS;So;0;ON;;;;;N;RIGHT HARPOON WITH BARB DOWN;;;; +21C2;DOWNWARDS HARPOON WITH BARB RIGHTWARDS;So;0;ON;;;;;N;DOWN HARPOON WITH BARB RIGHT;;;; +21C3;DOWNWARDS HARPOON WITH BARB LEFTWARDS;So;0;ON;;;;;N;DOWN HARPOON WITH BARB LEFT;;;; +21C4;RIGHTWARDS ARROW OVER LEFTWARDS ARROW;So;0;ON;;;;;N;RIGHT ARROW OVER LEFT ARROW;;;; +21C5;UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW;So;0;ON;;;;;N;UP ARROW LEFT OF DOWN ARROW;;;; +21C6;LEFTWARDS ARROW OVER RIGHTWARDS ARROW;So;0;ON;;;;;N;LEFT ARROW OVER RIGHT ARROW;;;; +21C7;LEFTWARDS PAIRED ARROWS;So;0;ON;;;;;N;LEFT PAIRED ARROWS;;;; +21C8;UPWARDS PAIRED ARROWS;So;0;ON;;;;;N;UP PAIRED ARROWS;;;; +21C9;RIGHTWARDS PAIRED ARROWS;So;0;ON;;;;;N;RIGHT PAIRED ARROWS;;;; +21CA;DOWNWARDS PAIRED ARROWS;So;0;ON;;;;;N;DOWN PAIRED ARROWS;;;; +21CB;LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON;So;0;ON;;;;;N;LEFT HARPOON OVER RIGHT HARPOON;;;; +21CC;RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON;So;0;ON;;;;;N;RIGHT HARPOON OVER LEFT HARPOON;;;; +21CD;LEFTWARDS DOUBLE ARROW WITH STROKE;So;0;ON;21D0 0338;;;;N;LEFT DOUBLE ARROW WITH STROKE;;;; +21CE;LEFT RIGHT DOUBLE ARROW WITH STROKE;Sm;0;ON;21D4 0338;;;;N;;;;; +21CF;RIGHTWARDS DOUBLE ARROW WITH STROKE;Sm;0;ON;21D2 0338;;;;N;RIGHT DOUBLE ARROW WITH STROKE;;;; +21D0;LEFTWARDS DOUBLE ARROW;So;0;ON;;;;;N;LEFT DOUBLE ARROW;;;; +21D1;UPWARDS DOUBLE ARROW;So;0;ON;;;;;N;UP DOUBLE ARROW;;;; +21D2;RIGHTWARDS DOUBLE ARROW;Sm;0;ON;;;;;N;RIGHT DOUBLE ARROW;;;; +21D3;DOWNWARDS DOUBLE ARROW;So;0;ON;;;;;N;DOWN DOUBLE ARROW;;;; +21D4;LEFT RIGHT DOUBLE ARROW;Sm;0;ON;;;;;N;;;;; +21D5;UP DOWN DOUBLE ARROW;So;0;ON;;;;;N;;;;; +21D6;NORTH WEST DOUBLE ARROW;So;0;ON;;;;;N;UPPER LEFT DOUBLE ARROW;;;; +21D7;NORTH EAST DOUBLE ARROW;So;0;ON;;;;;N;UPPER RIGHT DOUBLE ARROW;;;; +21D8;SOUTH EAST DOUBLE ARROW;So;0;ON;;;;;N;LOWER RIGHT DOUBLE ARROW;;;; +21D9;SOUTH WEST DOUBLE ARROW;So;0;ON;;;;;N;LOWER LEFT DOUBLE ARROW;;;; +21DA;LEFTWARDS TRIPLE ARROW;So;0;ON;;;;;N;LEFT TRIPLE ARROW;;;; +21DB;RIGHTWARDS TRIPLE ARROW;So;0;ON;;;;;N;RIGHT TRIPLE ARROW;;;; +21DC;LEFTWARDS SQUIGGLE ARROW;So;0;ON;;;;;N;LEFT SQUIGGLE ARROW;;;; +21DD;RIGHTWARDS SQUIGGLE ARROW;So;0;ON;;;;;N;RIGHT SQUIGGLE ARROW;;;; +21DE;UPWARDS ARROW WITH DOUBLE STROKE;So;0;ON;;;;;N;UP ARROW WITH DOUBLE STROKE;;;; +21DF;DOWNWARDS ARROW WITH DOUBLE STROKE;So;0;ON;;;;;N;DOWN ARROW WITH DOUBLE STROKE;;;; +21E0;LEFTWARDS DASHED ARROW;So;0;ON;;;;;N;LEFT DASHED ARROW;;;; +21E1;UPWARDS DASHED ARROW;So;0;ON;;;;;N;UP DASHED ARROW;;;; +21E2;RIGHTWARDS DASHED ARROW;So;0;ON;;;;;N;RIGHT DASHED ARROW;;;; +21E3;DOWNWARDS DASHED ARROW;So;0;ON;;;;;N;DOWN DASHED ARROW;;;; +21E4;LEFTWARDS ARROW TO BAR;So;0;ON;;;;;N;LEFT ARROW TO BAR;;;; +21E5;RIGHTWARDS ARROW TO BAR;So;0;ON;;;;;N;RIGHT ARROW TO BAR;;;; +21E6;LEFTWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE LEFT ARROW;;;; +21E7;UPWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE UP ARROW;;;; +21E8;RIGHTWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE RIGHT ARROW;;;; +21E9;DOWNWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE DOWN ARROW;;;; +21EA;UPWARDS WHITE ARROW FROM BAR;So;0;ON;;;;;N;WHITE UP ARROW FROM BAR;;;; +21EB;UPWARDS WHITE ARROW ON PEDESTAL;So;0;ON;;;;;N;;;;; +21EC;UPWARDS WHITE ARROW ON PEDESTAL WITH HORIZONTAL BAR;So;0;ON;;;;;N;;;;; +21ED;UPWARDS WHITE ARROW ON PEDESTAL WITH VERTICAL BAR;So;0;ON;;;;;N;;;;; +21EE;UPWARDS WHITE DOUBLE ARROW;So;0;ON;;;;;N;;;;; +21EF;UPWARDS WHITE DOUBLE ARROW ON PEDESTAL;So;0;ON;;;;;N;;;;; +21F0;RIGHTWARDS WHITE ARROW FROM WALL;So;0;ON;;;;;N;;;;; +21F1;NORTH WEST ARROW TO CORNER;So;0;ON;;;;;N;;;;; +21F2;SOUTH EAST ARROW TO CORNER;So;0;ON;;;;;N;;;;; +21F3;UP DOWN WHITE ARROW;So;0;ON;;;;;N;;;;; +21F4;RIGHT ARROW WITH SMALL CIRCLE;Sm;0;ON;;;;;N;;;;; +21F5;DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW;Sm;0;ON;;;;;N;;;;; +21F6;THREE RIGHTWARDS ARROWS;Sm;0;ON;;;;;N;;;;; +21F7;LEFTWARDS ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +21F8;RIGHTWARDS ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +21F9;LEFT RIGHT ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +21FA;LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +21FB;RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +21FC;LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +21FD;LEFTWARDS OPEN-HEADED ARROW;Sm;0;ON;;;;;N;;;;; +21FE;RIGHTWARDS OPEN-HEADED ARROW;Sm;0;ON;;;;;N;;;;; +21FF;LEFT RIGHT OPEN-HEADED ARROW;Sm;0;ON;;;;;N;;;;; +2200;FOR ALL;Sm;0;ON;;;;;N;;;;; +2201;COMPLEMENT;Sm;0;ON;;;;;Y;;;;; +2202;PARTIAL DIFFERENTIAL;Sm;0;ON;;;;;Y;;;;; +2203;THERE EXISTS;Sm;0;ON;;;;;Y;;;;; +2204;THERE DOES NOT EXIST;Sm;0;ON;2203 0338;;;;Y;;;;; +2205;EMPTY SET;Sm;0;ON;;;;;N;;;;; +2206;INCREMENT;Sm;0;ON;;;;;N;;;;; +2207;NABLA;Sm;0;ON;;;;;N;;;;; +2208;ELEMENT OF;Sm;0;ON;;;;;Y;;;;; +2209;NOT AN ELEMENT OF;Sm;0;ON;2208 0338;;;;Y;;;;; +220A;SMALL ELEMENT OF;Sm;0;ON;;;;;Y;;;;; +220B;CONTAINS AS MEMBER;Sm;0;ON;;;;;Y;;;;; +220C;DOES NOT CONTAIN AS MEMBER;Sm;0;ON;220B 0338;;;;Y;;;;; +220D;SMALL CONTAINS AS MEMBER;Sm;0;ON;;;;;Y;;;;; +220E;END OF PROOF;Sm;0;ON;;;;;N;;;;; +220F;N-ARY PRODUCT;Sm;0;ON;;;;;N;;;;; +2210;N-ARY COPRODUCT;Sm;0;ON;;;;;N;;;;; +2211;N-ARY SUMMATION;Sm;0;ON;;;;;Y;;;;; +2212;MINUS SIGN;Sm;0;ES;;;;;N;;;;; +2213;MINUS-OR-PLUS SIGN;Sm;0;ET;;;;;N;;;;; +2214;DOT PLUS;Sm;0;ON;;;;;N;;;;; +2215;DIVISION SLASH;Sm;0;ON;;;;;Y;;;;; +2216;SET MINUS;Sm;0;ON;;;;;Y;;;;; +2217;ASTERISK OPERATOR;Sm;0;ON;;;;;N;;;;; +2218;RING OPERATOR;Sm;0;ON;;;;;N;;;;; +2219;BULLET OPERATOR;Sm;0;ON;;;;;N;;;;; +221A;SQUARE ROOT;Sm;0;ON;;;;;Y;;;;; +221B;CUBE ROOT;Sm;0;ON;;;;;Y;;;;; +221C;FOURTH ROOT;Sm;0;ON;;;;;Y;;;;; +221D;PROPORTIONAL TO;Sm;0;ON;;;;;Y;;;;; +221E;INFINITY;Sm;0;ON;;;;;N;;;;; +221F;RIGHT ANGLE;Sm;0;ON;;;;;Y;;;;; +2220;ANGLE;Sm;0;ON;;;;;Y;;;;; +2221;MEASURED ANGLE;Sm;0;ON;;;;;Y;;;;; +2222;SPHERICAL ANGLE;Sm;0;ON;;;;;Y;;;;; +2223;DIVIDES;Sm;0;ON;;;;;N;;;;; +2224;DOES NOT DIVIDE;Sm;0;ON;2223 0338;;;;Y;;;;; +2225;PARALLEL TO;Sm;0;ON;;;;;N;;;;; +2226;NOT PARALLEL TO;Sm;0;ON;2225 0338;;;;Y;;;;; +2227;LOGICAL AND;Sm;0;ON;;;;;N;;;;; +2228;LOGICAL OR;Sm;0;ON;;;;;N;;;;; +2229;INTERSECTION;Sm;0;ON;;;;;N;;;;; +222A;UNION;Sm;0;ON;;;;;N;;;;; +222B;INTEGRAL;Sm;0;ON;;;;;Y;;;;; +222C;DOUBLE INTEGRAL;Sm;0;ON;<compat> 222B 222B;;;;Y;;;;; +222D;TRIPLE INTEGRAL;Sm;0;ON;<compat> 222B 222B 222B;;;;Y;;;;; +222E;CONTOUR INTEGRAL;Sm;0;ON;;;;;Y;;;;; +222F;SURFACE INTEGRAL;Sm;0;ON;<compat> 222E 222E;;;;Y;;;;; +2230;VOLUME INTEGRAL;Sm;0;ON;<compat> 222E 222E 222E;;;;Y;;;;; +2231;CLOCKWISE INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2232;CLOCKWISE CONTOUR INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2233;ANTICLOCKWISE CONTOUR INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2234;THEREFORE;Sm;0;ON;;;;;N;;;;; +2235;BECAUSE;Sm;0;ON;;;;;N;;;;; +2236;RATIO;Sm;0;ON;;;;;N;;;;; +2237;PROPORTION;Sm;0;ON;;;;;N;;;;; +2238;DOT MINUS;Sm;0;ON;;;;;N;;;;; +2239;EXCESS;Sm;0;ON;;;;;Y;;;;; +223A;GEOMETRIC PROPORTION;Sm;0;ON;;;;;N;;;;; +223B;HOMOTHETIC;Sm;0;ON;;;;;Y;;;;; +223C;TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;; +223D;REVERSED TILDE;Sm;0;ON;;;;;Y;;;;; +223E;INVERTED LAZY S;Sm;0;ON;;;;;Y;;;;; +223F;SINE WAVE;Sm;0;ON;;;;;Y;;;;; +2240;WREATH PRODUCT;Sm;0;ON;;;;;Y;;;;; +2241;NOT TILDE;Sm;0;ON;223C 0338;;;;Y;;;;; +2242;MINUS TILDE;Sm;0;ON;;;;;Y;;;;; +2243;ASYMPTOTICALLY EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2244;NOT ASYMPTOTICALLY EQUAL TO;Sm;0;ON;2243 0338;;;;Y;;;;; +2245;APPROXIMATELY EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2246;APPROXIMATELY BUT NOT ACTUALLY EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2247;NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO;Sm;0;ON;2245 0338;;;;Y;;;;; +2248;ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2249;NOT ALMOST EQUAL TO;Sm;0;ON;2248 0338;;;;Y;;;;; +224A;ALMOST EQUAL OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +224B;TRIPLE TILDE;Sm;0;ON;;;;;Y;;;;; +224C;ALL EQUAL TO;Sm;0;ON;;;;;Y;;;;; +224D;EQUIVALENT TO;Sm;0;ON;;;;;N;;;;; +224E;GEOMETRICALLY EQUIVALENT TO;Sm;0;ON;;;;;N;;;;; +224F;DIFFERENCE BETWEEN;Sm;0;ON;;;;;N;;;;; +2250;APPROACHES THE LIMIT;Sm;0;ON;;;;;N;;;;; +2251;GEOMETRICALLY EQUAL TO;Sm;0;ON;;;;;N;;;;; +2252;APPROXIMATELY EQUAL TO OR THE IMAGE OF;Sm;0;ON;;;;;Y;;;;; +2253;IMAGE OF OR APPROXIMATELY EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2254;COLON EQUALS;Sm;0;ON;;;;;Y;COLON EQUAL;;;; +2255;EQUALS COLON;Sm;0;ON;;;;;Y;EQUAL COLON;;;; +2256;RING IN EQUAL TO;Sm;0;ON;;;;;N;;;;; +2257;RING EQUAL TO;Sm;0;ON;;;;;N;;;;; +2258;CORRESPONDS TO;Sm;0;ON;;;;;N;;;;; +2259;ESTIMATES;Sm;0;ON;;;;;N;;;;; +225A;EQUIANGULAR TO;Sm;0;ON;;;;;N;;;;; +225B;STAR EQUALS;Sm;0;ON;;;;;N;;;;; +225C;DELTA EQUAL TO;Sm;0;ON;;;;;N;;;;; +225D;EQUAL TO BY DEFINITION;Sm;0;ON;;;;;N;;;;; +225E;MEASURED BY;Sm;0;ON;;;;;N;;;;; +225F;QUESTIONED EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2260;NOT EQUAL TO;Sm;0;ON;003D 0338;;;;Y;;;;; +2261;IDENTICAL TO;Sm;0;ON;;;;;N;;;;; +2262;NOT IDENTICAL TO;Sm;0;ON;2261 0338;;;;Y;;;;; +2263;STRICTLY EQUIVALENT TO;Sm;0;ON;;;;;N;;;;; +2264;LESS-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;LESS THAN OR EQUAL TO;;;; +2265;GREATER-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;GREATER THAN OR EQUAL TO;;;; +2266;LESS-THAN OVER EQUAL TO;Sm;0;ON;;;;;Y;LESS THAN OVER EQUAL TO;;;; +2267;GREATER-THAN OVER EQUAL TO;Sm;0;ON;;;;;Y;GREATER THAN OVER EQUAL TO;;;; +2268;LESS-THAN BUT NOT EQUAL TO;Sm;0;ON;;;;;Y;LESS THAN BUT NOT EQUAL TO;;;; +2269;GREATER-THAN BUT NOT EQUAL TO;Sm;0;ON;;;;;Y;GREATER THAN BUT NOT EQUAL TO;;;; +226A;MUCH LESS-THAN;Sm;0;ON;;;;;Y;MUCH LESS THAN;;;; +226B;MUCH GREATER-THAN;Sm;0;ON;;;;;Y;MUCH GREATER THAN;;;; +226C;BETWEEN;Sm;0;ON;;;;;N;;;;; +226D;NOT EQUIVALENT TO;Sm;0;ON;224D 0338;;;;N;;;;; +226E;NOT LESS-THAN;Sm;0;ON;003C 0338;;;;Y;NOT LESS THAN;;;; +226F;NOT GREATER-THAN;Sm;0;ON;003E 0338;;;;Y;NOT GREATER THAN;;;; +2270;NEITHER LESS-THAN NOR EQUAL TO;Sm;0;ON;2264 0338;;;;Y;NEITHER LESS THAN NOR EQUAL TO;;;; +2271;NEITHER GREATER-THAN NOR EQUAL TO;Sm;0;ON;2265 0338;;;;Y;NEITHER GREATER THAN NOR EQUAL TO;;;; +2272;LESS-THAN OR EQUIVALENT TO;Sm;0;ON;;;;;Y;LESS THAN OR EQUIVALENT TO;;;; +2273;GREATER-THAN OR EQUIVALENT TO;Sm;0;ON;;;;;Y;GREATER THAN OR EQUIVALENT TO;;;; +2274;NEITHER LESS-THAN NOR EQUIVALENT TO;Sm;0;ON;2272 0338;;;;Y;NEITHER LESS THAN NOR EQUIVALENT TO;;;; +2275;NEITHER GREATER-THAN NOR EQUIVALENT TO;Sm;0;ON;2273 0338;;;;Y;NEITHER GREATER THAN NOR EQUIVALENT TO;;;; +2276;LESS-THAN OR GREATER-THAN;Sm;0;ON;;;;;Y;LESS THAN OR GREATER THAN;;;; +2277;GREATER-THAN OR LESS-THAN;Sm;0;ON;;;;;Y;GREATER THAN OR LESS THAN;;;; +2278;NEITHER LESS-THAN NOR GREATER-THAN;Sm;0;ON;2276 0338;;;;Y;NEITHER LESS THAN NOR GREATER THAN;;;; +2279;NEITHER GREATER-THAN NOR LESS-THAN;Sm;0;ON;2277 0338;;;;Y;NEITHER GREATER THAN NOR LESS THAN;;;; +227A;PRECEDES;Sm;0;ON;;;;;Y;;;;; +227B;SUCCEEDS;Sm;0;ON;;;;;Y;;;;; +227C;PRECEDES OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +227D;SUCCEEDS OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +227E;PRECEDES OR EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;; +227F;SUCCEEDS OR EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;; +2280;DOES NOT PRECEDE;Sm;0;ON;227A 0338;;;;Y;;;;; +2281;DOES NOT SUCCEED;Sm;0;ON;227B 0338;;;;Y;;;;; +2282;SUBSET OF;Sm;0;ON;;;;;Y;;;;; +2283;SUPERSET OF;Sm;0;ON;;;;;Y;;;;; +2284;NOT A SUBSET OF;Sm;0;ON;2282 0338;;;;Y;;;;; +2285;NOT A SUPERSET OF;Sm;0;ON;2283 0338;;;;Y;;;;; +2286;SUBSET OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2287;SUPERSET OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2288;NEITHER A SUBSET OF NOR EQUAL TO;Sm;0;ON;2286 0338;;;;Y;;;;; +2289;NEITHER A SUPERSET OF NOR EQUAL TO;Sm;0;ON;2287 0338;;;;Y;;;;; +228A;SUBSET OF WITH NOT EQUAL TO;Sm;0;ON;;;;;Y;SUBSET OF OR NOT EQUAL TO;;;; +228B;SUPERSET OF WITH NOT EQUAL TO;Sm;0;ON;;;;;Y;SUPERSET OF OR NOT EQUAL TO;;;; +228C;MULTISET;Sm;0;ON;;;;;Y;;;;; +228D;MULTISET MULTIPLICATION;Sm;0;ON;;;;;N;;;;; +228E;MULTISET UNION;Sm;0;ON;;;;;N;;;;; +228F;SQUARE IMAGE OF;Sm;0;ON;;;;;Y;;;;; +2290;SQUARE ORIGINAL OF;Sm;0;ON;;;;;Y;;;;; +2291;SQUARE IMAGE OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2292;SQUARE ORIGINAL OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2293;SQUARE CAP;Sm;0;ON;;;;;N;;;;; +2294;SQUARE CUP;Sm;0;ON;;;;;N;;;;; +2295;CIRCLED PLUS;Sm;0;ON;;;;;N;;;;; +2296;CIRCLED MINUS;Sm;0;ON;;;;;N;;;;; +2297;CIRCLED TIMES;Sm;0;ON;;;;;N;;;;; +2298;CIRCLED DIVISION SLASH;Sm;0;ON;;;;;Y;;;;; +2299;CIRCLED DOT OPERATOR;Sm;0;ON;;;;;N;;;;; +229A;CIRCLED RING OPERATOR;Sm;0;ON;;;;;N;;;;; +229B;CIRCLED ASTERISK OPERATOR;Sm;0;ON;;;;;N;;;;; +229C;CIRCLED EQUALS;Sm;0;ON;;;;;N;;;;; +229D;CIRCLED DASH;Sm;0;ON;;;;;N;;;;; +229E;SQUARED PLUS;Sm;0;ON;;;;;N;;;;; +229F;SQUARED MINUS;Sm;0;ON;;;;;N;;;;; +22A0;SQUARED TIMES;Sm;0;ON;;;;;N;;;;; +22A1;SQUARED DOT OPERATOR;Sm;0;ON;;;;;N;;;;; +22A2;RIGHT TACK;Sm;0;ON;;;;;Y;;;;; +22A3;LEFT TACK;Sm;0;ON;;;;;Y;;;;; +22A4;DOWN TACK;Sm;0;ON;;;;;N;;;;; +22A5;UP TACK;Sm;0;ON;;;;;N;;;;; +22A6;ASSERTION;Sm;0;ON;;;;;Y;;;;; +22A7;MODELS;Sm;0;ON;;;;;Y;;;;; +22A8;TRUE;Sm;0;ON;;;;;Y;;;;; +22A9;FORCES;Sm;0;ON;;;;;Y;;;;; +22AA;TRIPLE VERTICAL BAR RIGHT TURNSTILE;Sm;0;ON;;;;;Y;;;;; +22AB;DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE;Sm;0;ON;;;;;Y;;;;; +22AC;DOES NOT PROVE;Sm;0;ON;22A2 0338;;;;Y;;;;; +22AD;NOT TRUE;Sm;0;ON;22A8 0338;;;;Y;;;;; +22AE;DOES NOT FORCE;Sm;0;ON;22A9 0338;;;;Y;;;;; +22AF;NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE;Sm;0;ON;22AB 0338;;;;Y;;;;; +22B0;PRECEDES UNDER RELATION;Sm;0;ON;;;;;Y;;;;; +22B1;SUCCEEDS UNDER RELATION;Sm;0;ON;;;;;Y;;;;; +22B2;NORMAL SUBGROUP OF;Sm;0;ON;;;;;Y;;;;; +22B3;CONTAINS AS NORMAL SUBGROUP;Sm;0;ON;;;;;Y;;;;; +22B4;NORMAL SUBGROUP OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +22B5;CONTAINS AS NORMAL SUBGROUP OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +22B6;ORIGINAL OF;Sm;0;ON;;;;;Y;;;;; +22B7;IMAGE OF;Sm;0;ON;;;;;Y;;;;; +22B8;MULTIMAP;Sm;0;ON;;;;;Y;;;;; +22B9;HERMITIAN CONJUGATE MATRIX;Sm;0;ON;;;;;N;;;;; +22BA;INTERCALATE;Sm;0;ON;;;;;N;;;;; +22BB;XOR;Sm;0;ON;;;;;N;;;;; +22BC;NAND;Sm;0;ON;;;;;N;;;;; +22BD;NOR;Sm;0;ON;;;;;N;;;;; +22BE;RIGHT ANGLE WITH ARC;Sm;0;ON;;;;;Y;;;;; +22BF;RIGHT TRIANGLE;Sm;0;ON;;;;;Y;;;;; +22C0;N-ARY LOGICAL AND;Sm;0;ON;;;;;N;;;;; +22C1;N-ARY LOGICAL OR;Sm;0;ON;;;;;N;;;;; +22C2;N-ARY INTERSECTION;Sm;0;ON;;;;;N;;;;; +22C3;N-ARY UNION;Sm;0;ON;;;;;N;;;;; +22C4;DIAMOND OPERATOR;Sm;0;ON;;;;;N;;;;; +22C5;DOT OPERATOR;Sm;0;ON;;;;;N;;;;; +22C6;STAR OPERATOR;Sm;0;ON;;;;;N;;;;; +22C7;DIVISION TIMES;Sm;0;ON;;;;;N;;;;; +22C8;BOWTIE;Sm;0;ON;;;;;N;;;;; +22C9;LEFT NORMAL FACTOR SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;; +22CA;RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;; +22CB;LEFT SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;; +22CC;RIGHT SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;; +22CD;REVERSED TILDE EQUALS;Sm;0;ON;;;;;Y;;;;; +22CE;CURLY LOGICAL OR;Sm;0;ON;;;;;N;;;;; +22CF;CURLY LOGICAL AND;Sm;0;ON;;;;;N;;;;; +22D0;DOUBLE SUBSET;Sm;0;ON;;;;;Y;;;;; +22D1;DOUBLE SUPERSET;Sm;0;ON;;;;;Y;;;;; +22D2;DOUBLE INTERSECTION;Sm;0;ON;;;;;N;;;;; +22D3;DOUBLE UNION;Sm;0;ON;;;;;N;;;;; +22D4;PITCHFORK;Sm;0;ON;;;;;N;;;;; +22D5;EQUAL AND PARALLEL TO;Sm;0;ON;;;;;N;;;;; +22D6;LESS-THAN WITH DOT;Sm;0;ON;;;;;Y;LESS THAN WITH DOT;;;; +22D7;GREATER-THAN WITH DOT;Sm;0;ON;;;;;Y;GREATER THAN WITH DOT;;;; +22D8;VERY MUCH LESS-THAN;Sm;0;ON;;;;;Y;VERY MUCH LESS THAN;;;; +22D9;VERY MUCH GREATER-THAN;Sm;0;ON;;;;;Y;VERY MUCH GREATER THAN;;;; +22DA;LESS-THAN EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;LESS THAN EQUAL TO OR GREATER THAN;;;; +22DB;GREATER-THAN EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;GREATER THAN EQUAL TO OR LESS THAN;;;; +22DC;EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;EQUAL TO OR LESS THAN;;;; +22DD;EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;EQUAL TO OR GREATER THAN;;;; +22DE;EQUAL TO OR PRECEDES;Sm;0;ON;;;;;Y;;;;; +22DF;EQUAL TO OR SUCCEEDS;Sm;0;ON;;;;;Y;;;;; +22E0;DOES NOT PRECEDE OR EQUAL;Sm;0;ON;227C 0338;;;;Y;;;;; +22E1;DOES NOT SUCCEED OR EQUAL;Sm;0;ON;227D 0338;;;;Y;;;;; +22E2;NOT SQUARE IMAGE OF OR EQUAL TO;Sm;0;ON;2291 0338;;;;Y;;;;; +22E3;NOT SQUARE ORIGINAL OF OR EQUAL TO;Sm;0;ON;2292 0338;;;;Y;;;;; +22E4;SQUARE IMAGE OF OR NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +22E5;SQUARE ORIGINAL OF OR NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +22E6;LESS-THAN BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;LESS THAN BUT NOT EQUIVALENT TO;;;; +22E7;GREATER-THAN BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;GREATER THAN BUT NOT EQUIVALENT TO;;;; +22E8;PRECEDES BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;; +22E9;SUCCEEDS BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;; +22EA;NOT NORMAL SUBGROUP OF;Sm;0;ON;22B2 0338;;;;Y;;;;; +22EB;DOES NOT CONTAIN AS NORMAL SUBGROUP;Sm;0;ON;22B3 0338;;;;Y;;;;; +22EC;NOT NORMAL SUBGROUP OF OR EQUAL TO;Sm;0;ON;22B4 0338;;;;Y;;;;; +22ED;DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL;Sm;0;ON;22B5 0338;;;;Y;;;;; +22EE;VERTICAL ELLIPSIS;Sm;0;ON;;;;;N;;;;; +22EF;MIDLINE HORIZONTAL ELLIPSIS;Sm;0;ON;;;;;N;;;;; +22F0;UP RIGHT DIAGONAL ELLIPSIS;Sm;0;ON;;;;;Y;;;;; +22F1;DOWN RIGHT DIAGONAL ELLIPSIS;Sm;0;ON;;;;;Y;;;;; +22F2;ELEMENT OF WITH LONG HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +22F3;ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +22F4;SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +22F5;ELEMENT OF WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +22F6;ELEMENT OF WITH OVERBAR;Sm;0;ON;;;;;Y;;;;; +22F7;SMALL ELEMENT OF WITH OVERBAR;Sm;0;ON;;;;;Y;;;;; +22F8;ELEMENT OF WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;; +22F9;ELEMENT OF WITH TWO HORIZONTAL STROKES;Sm;0;ON;;;;;Y;;;;; +22FA;CONTAINS WITH LONG HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +22FB;CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +22FC;SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +22FD;CONTAINS WITH OVERBAR;Sm;0;ON;;;;;Y;;;;; +22FE;SMALL CONTAINS WITH OVERBAR;Sm;0;ON;;;;;Y;;;;; +22FF;Z NOTATION BAG MEMBERSHIP;Sm;0;ON;;;;;Y;;;;; +2300;DIAMETER SIGN;So;0;ON;;;;;N;;;;; +2301;ELECTRIC ARROW;So;0;ON;;;;;N;;;;; +2302;HOUSE;So;0;ON;;;;;N;;;;; +2303;UP ARROWHEAD;So;0;ON;;;;;N;;;;; +2304;DOWN ARROWHEAD;So;0;ON;;;;;N;;;;; +2305;PROJECTIVE;So;0;ON;;;;;N;;;;; +2306;PERSPECTIVE;So;0;ON;;;;;N;;;;; +2307;WAVY LINE;So;0;ON;;;;;N;;;;; +2308;LEFT CEILING;Ps;0;ON;;;;;Y;;;;; +2309;RIGHT CEILING;Pe;0;ON;;;;;Y;;;;; +230A;LEFT FLOOR;Ps;0;ON;;;;;Y;;;;; +230B;RIGHT FLOOR;Pe;0;ON;;;;;Y;;;;; +230C;BOTTOM RIGHT CROP;So;0;ON;;;;;N;;;;; +230D;BOTTOM LEFT CROP;So;0;ON;;;;;N;;;;; +230E;TOP RIGHT CROP;So;0;ON;;;;;N;;;;; +230F;TOP LEFT CROP;So;0;ON;;;;;N;;;;; +2310;REVERSED NOT SIGN;So;0;ON;;;;;N;;;;; +2311;SQUARE LOZENGE;So;0;ON;;;;;N;;;;; +2312;ARC;So;0;ON;;;;;N;;;;; +2313;SEGMENT;So;0;ON;;;;;N;;;;; +2314;SECTOR;So;0;ON;;;;;N;;;;; +2315;TELEPHONE RECORDER;So;0;ON;;;;;N;;;;; +2316;POSITION INDICATOR;So;0;ON;;;;;N;;;;; +2317;VIEWDATA SQUARE;So;0;ON;;;;;N;;;;; +2318;PLACE OF INTEREST SIGN;So;0;ON;;;;;N;COMMAND KEY;;;; +2319;TURNED NOT SIGN;So;0;ON;;;;;N;;;;; +231A;WATCH;So;0;ON;;;;;N;;;;; +231B;HOURGLASS;So;0;ON;;;;;N;;;;; +231C;TOP LEFT CORNER;So;0;ON;;;;;N;;;;; +231D;TOP RIGHT CORNER;So;0;ON;;;;;N;;;;; +231E;BOTTOM LEFT CORNER;So;0;ON;;;;;N;;;;; +231F;BOTTOM RIGHT CORNER;So;0;ON;;;;;N;;;;; +2320;TOP HALF INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2321;BOTTOM HALF INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2322;FROWN;So;0;ON;;;;;N;;;;; +2323;SMILE;So;0;ON;;;;;N;;;;; +2324;UP ARROWHEAD BETWEEN TWO HORIZONTAL BARS;So;0;ON;;;;;N;ENTER KEY;;;; +2325;OPTION KEY;So;0;ON;;;;;N;;;;; +2326;ERASE TO THE RIGHT;So;0;ON;;;;;N;DELETE TO THE RIGHT KEY;;;; +2327;X IN A RECTANGLE BOX;So;0;ON;;;;;N;CLEAR KEY;;;; +2328;KEYBOARD;So;0;ON;;;;;N;;;;; +2329;LEFT-POINTING ANGLE BRACKET;Ps;0;ON;3008;;;;Y;BRA;;;; +232A;RIGHT-POINTING ANGLE BRACKET;Pe;0;ON;3009;;;;Y;KET;;;; +232B;ERASE TO THE LEFT;So;0;ON;;;;;N;DELETE TO THE LEFT KEY;;;; +232C;BENZENE RING;So;0;ON;;;;;N;;;;; +232D;CYLINDRICITY;So;0;ON;;;;;N;;;;; +232E;ALL AROUND-PROFILE;So;0;ON;;;;;N;;;;; +232F;SYMMETRY;So;0;ON;;;;;N;;;;; +2330;TOTAL RUNOUT;So;0;ON;;;;;N;;;;; +2331;DIMENSION ORIGIN;So;0;ON;;;;;N;;;;; +2332;CONICAL TAPER;So;0;ON;;;;;N;;;;; +2333;SLOPE;So;0;ON;;;;;N;;;;; +2334;COUNTERBORE;So;0;ON;;;;;N;;;;; +2335;COUNTERSINK;So;0;ON;;;;;N;;;;; +2336;APL FUNCTIONAL SYMBOL I-BEAM;So;0;L;;;;;N;;;;; +2337;APL FUNCTIONAL SYMBOL SQUISH QUAD;So;0;L;;;;;N;;;;; +2338;APL FUNCTIONAL SYMBOL QUAD EQUAL;So;0;L;;;;;N;;;;; +2339;APL FUNCTIONAL SYMBOL QUAD DIVIDE;So;0;L;;;;;N;;;;; +233A;APL FUNCTIONAL SYMBOL QUAD DIAMOND;So;0;L;;;;;N;;;;; +233B;APL FUNCTIONAL SYMBOL QUAD JOT;So;0;L;;;;;N;;;;; +233C;APL FUNCTIONAL SYMBOL QUAD CIRCLE;So;0;L;;;;;N;;;;; +233D;APL FUNCTIONAL SYMBOL CIRCLE STILE;So;0;L;;;;;N;;;;; +233E;APL FUNCTIONAL SYMBOL CIRCLE JOT;So;0;L;;;;;N;;;;; +233F;APL FUNCTIONAL SYMBOL SLASH BAR;So;0;L;;;;;N;;;;; +2340;APL FUNCTIONAL SYMBOL BACKSLASH BAR;So;0;L;;;;;N;;;;; +2341;APL FUNCTIONAL SYMBOL QUAD SLASH;So;0;L;;;;;N;;;;; +2342;APL FUNCTIONAL SYMBOL QUAD BACKSLASH;So;0;L;;;;;N;;;;; +2343;APL FUNCTIONAL SYMBOL QUAD LESS-THAN;So;0;L;;;;;N;;;;; +2344;APL FUNCTIONAL SYMBOL QUAD GREATER-THAN;So;0;L;;;;;N;;;;; +2345;APL FUNCTIONAL SYMBOL LEFTWARDS VANE;So;0;L;;;;;N;;;;; +2346;APL FUNCTIONAL SYMBOL RIGHTWARDS VANE;So;0;L;;;;;N;;;;; +2347;APL FUNCTIONAL SYMBOL QUAD LEFTWARDS ARROW;So;0;L;;;;;N;;;;; +2348;APL FUNCTIONAL SYMBOL QUAD RIGHTWARDS ARROW;So;0;L;;;;;N;;;;; +2349;APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH;So;0;L;;;;;N;;;;; +234A;APL FUNCTIONAL SYMBOL DOWN TACK UNDERBAR;So;0;L;;;;;N;;;;; +234B;APL FUNCTIONAL SYMBOL DELTA STILE;So;0;L;;;;;N;;;;; +234C;APL FUNCTIONAL SYMBOL QUAD DOWN CARET;So;0;L;;;;;N;;;;; +234D;APL FUNCTIONAL SYMBOL QUAD DELTA;So;0;L;;;;;N;;;;; +234E;APL FUNCTIONAL SYMBOL DOWN TACK JOT;So;0;L;;;;;N;;;;; +234F;APL FUNCTIONAL SYMBOL UPWARDS VANE;So;0;L;;;;;N;;;;; +2350;APL FUNCTIONAL SYMBOL QUAD UPWARDS ARROW;So;0;L;;;;;N;;;;; +2351;APL FUNCTIONAL SYMBOL UP TACK OVERBAR;So;0;L;;;;;N;;;;; +2352;APL FUNCTIONAL SYMBOL DEL STILE;So;0;L;;;;;N;;;;; +2353;APL FUNCTIONAL SYMBOL QUAD UP CARET;So;0;L;;;;;N;;;;; +2354;APL FUNCTIONAL SYMBOL QUAD DEL;So;0;L;;;;;N;;;;; +2355;APL FUNCTIONAL SYMBOL UP TACK JOT;So;0;L;;;;;N;;;;; +2356;APL FUNCTIONAL SYMBOL DOWNWARDS VANE;So;0;L;;;;;N;;;;; +2357;APL FUNCTIONAL SYMBOL QUAD DOWNWARDS ARROW;So;0;L;;;;;N;;;;; +2358;APL FUNCTIONAL SYMBOL QUOTE UNDERBAR;So;0;L;;;;;N;;;;; +2359;APL FUNCTIONAL SYMBOL DELTA UNDERBAR;So;0;L;;;;;N;;;;; +235A;APL FUNCTIONAL SYMBOL DIAMOND UNDERBAR;So;0;L;;;;;N;;;;; +235B;APL FUNCTIONAL SYMBOL JOT UNDERBAR;So;0;L;;;;;N;;;;; +235C;APL FUNCTIONAL SYMBOL CIRCLE UNDERBAR;So;0;L;;;;;N;;;;; +235D;APL FUNCTIONAL SYMBOL UP SHOE JOT;So;0;L;;;;;N;;;;; +235E;APL FUNCTIONAL SYMBOL QUOTE QUAD;So;0;L;;;;;N;;;;; +235F;APL FUNCTIONAL SYMBOL CIRCLE STAR;So;0;L;;;;;N;;;;; +2360;APL FUNCTIONAL SYMBOL QUAD COLON;So;0;L;;;;;N;;;;; +2361;APL FUNCTIONAL SYMBOL UP TACK DIAERESIS;So;0;L;;;;;N;;;;; +2362;APL FUNCTIONAL SYMBOL DEL DIAERESIS;So;0;L;;;;;N;;;;; +2363;APL FUNCTIONAL SYMBOL STAR DIAERESIS;So;0;L;;;;;N;;;;; +2364;APL FUNCTIONAL SYMBOL JOT DIAERESIS;So;0;L;;;;;N;;;;; +2365;APL FUNCTIONAL SYMBOL CIRCLE DIAERESIS;So;0;L;;;;;N;;;;; +2366;APL FUNCTIONAL SYMBOL DOWN SHOE STILE;So;0;L;;;;;N;;;;; +2367;APL FUNCTIONAL SYMBOL LEFT SHOE STILE;So;0;L;;;;;N;;;;; +2368;APL FUNCTIONAL SYMBOL TILDE DIAERESIS;So;0;L;;;;;N;;;;; +2369;APL FUNCTIONAL SYMBOL GREATER-THAN DIAERESIS;So;0;L;;;;;N;;;;; +236A;APL FUNCTIONAL SYMBOL COMMA BAR;So;0;L;;;;;N;;;;; +236B;APL FUNCTIONAL SYMBOL DEL TILDE;So;0;L;;;;;N;;;;; +236C;APL FUNCTIONAL SYMBOL ZILDE;So;0;L;;;;;N;;;;; +236D;APL FUNCTIONAL SYMBOL STILE TILDE;So;0;L;;;;;N;;;;; +236E;APL FUNCTIONAL SYMBOL SEMICOLON UNDERBAR;So;0;L;;;;;N;;;;; +236F;APL FUNCTIONAL SYMBOL QUAD NOT EQUAL;So;0;L;;;;;N;;;;; +2370;APL FUNCTIONAL SYMBOL QUAD QUESTION;So;0;L;;;;;N;;;;; +2371;APL FUNCTIONAL SYMBOL DOWN CARET TILDE;So;0;L;;;;;N;;;;; +2372;APL FUNCTIONAL SYMBOL UP CARET TILDE;So;0;L;;;;;N;;;;; +2373;APL FUNCTIONAL SYMBOL IOTA;So;0;L;;;;;N;;;;; +2374;APL FUNCTIONAL SYMBOL RHO;So;0;L;;;;;N;;;;; +2375;APL FUNCTIONAL SYMBOL OMEGA;So;0;L;;;;;N;;;;; +2376;APL FUNCTIONAL SYMBOL ALPHA UNDERBAR;So;0;L;;;;;N;;;;; +2377;APL FUNCTIONAL SYMBOL EPSILON UNDERBAR;So;0;L;;;;;N;;;;; +2378;APL FUNCTIONAL SYMBOL IOTA UNDERBAR;So;0;L;;;;;N;;;;; +2379;APL FUNCTIONAL SYMBOL OMEGA UNDERBAR;So;0;L;;;;;N;;;;; +237A;APL FUNCTIONAL SYMBOL ALPHA;So;0;L;;;;;N;;;;; +237B;NOT CHECK MARK;So;0;ON;;;;;N;;;;; +237C;RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW;Sm;0;ON;;;;;N;;;;; +237D;SHOULDERED OPEN BOX;So;0;ON;;;;;N;;;;; +237E;BELL SYMBOL;So;0;ON;;;;;N;;;;; +237F;VERTICAL LINE WITH MIDDLE DOT;So;0;ON;;;;;N;;;;; +2380;INSERTION SYMBOL;So;0;ON;;;;;N;;;;; +2381;CONTINUOUS UNDERLINE SYMBOL;So;0;ON;;;;;N;;;;; +2382;DISCONTINUOUS UNDERLINE SYMBOL;So;0;ON;;;;;N;;;;; +2383;EMPHASIS SYMBOL;So;0;ON;;;;;N;;;;; +2384;COMPOSITION SYMBOL;So;0;ON;;;;;N;;;;; +2385;WHITE SQUARE WITH CENTRE VERTICAL LINE;So;0;ON;;;;;N;;;;; +2386;ENTER SYMBOL;So;0;ON;;;;;N;;;;; +2387;ALTERNATIVE KEY SYMBOL;So;0;ON;;;;;N;;;;; +2388;HELM SYMBOL;So;0;ON;;;;;N;;;;; +2389;CIRCLED HORIZONTAL BAR WITH NOTCH;So;0;ON;;;;;N;;;;; +238A;CIRCLED TRIANGLE DOWN;So;0;ON;;;;;N;;;;; +238B;BROKEN CIRCLE WITH NORTHWEST ARROW;So;0;ON;;;;;N;;;;; +238C;UNDO SYMBOL;So;0;ON;;;;;N;;;;; +238D;MONOSTABLE SYMBOL;So;0;ON;;;;;N;;;;; +238E;HYSTERESIS SYMBOL;So;0;ON;;;;;N;;;;; +238F;OPEN-CIRCUIT-OUTPUT H-TYPE SYMBOL;So;0;ON;;;;;N;;;;; +2390;OPEN-CIRCUIT-OUTPUT L-TYPE SYMBOL;So;0;ON;;;;;N;;;;; +2391;PASSIVE-PULL-DOWN-OUTPUT SYMBOL;So;0;ON;;;;;N;;;;; +2392;PASSIVE-PULL-UP-OUTPUT SYMBOL;So;0;ON;;;;;N;;;;; +2393;DIRECT CURRENT SYMBOL FORM TWO;So;0;ON;;;;;N;;;;; +2394;SOFTWARE-FUNCTION SYMBOL;So;0;ON;;;;;N;;;;; +2395;APL FUNCTIONAL SYMBOL QUAD;So;0;L;;;;;N;;;;; +2396;DECIMAL SEPARATOR KEY SYMBOL;So;0;ON;;;;;N;;;;; +2397;PREVIOUS PAGE;So;0;ON;;;;;N;;;;; +2398;NEXT PAGE;So;0;ON;;;;;N;;;;; +2399;PRINT SCREEN SYMBOL;So;0;ON;;;;;N;;;;; +239A;CLEAR SCREEN SYMBOL;So;0;ON;;;;;N;;;;; +239B;LEFT PARENTHESIS UPPER HOOK;Sm;0;ON;;;;;N;;;;; +239C;LEFT PARENTHESIS EXTENSION;Sm;0;ON;;;;;N;;;;; +239D;LEFT PARENTHESIS LOWER HOOK;Sm;0;ON;;;;;N;;;;; +239E;RIGHT PARENTHESIS UPPER HOOK;Sm;0;ON;;;;;N;;;;; +239F;RIGHT PARENTHESIS EXTENSION;Sm;0;ON;;;;;N;;;;; +23A0;RIGHT PARENTHESIS LOWER HOOK;Sm;0;ON;;;;;N;;;;; +23A1;LEFT SQUARE BRACKET UPPER CORNER;Sm;0;ON;;;;;N;;;;; +23A2;LEFT SQUARE BRACKET EXTENSION;Sm;0;ON;;;;;N;;;;; +23A3;LEFT SQUARE BRACKET LOWER CORNER;Sm;0;ON;;;;;N;;;;; +23A4;RIGHT SQUARE BRACKET UPPER CORNER;Sm;0;ON;;;;;N;;;;; +23A5;RIGHT SQUARE BRACKET EXTENSION;Sm;0;ON;;;;;N;;;;; +23A6;RIGHT SQUARE BRACKET LOWER CORNER;Sm;0;ON;;;;;N;;;;; +23A7;LEFT CURLY BRACKET UPPER HOOK;Sm;0;ON;;;;;N;;;;; +23A8;LEFT CURLY BRACKET MIDDLE PIECE;Sm;0;ON;;;;;N;;;;; +23A9;LEFT CURLY BRACKET LOWER HOOK;Sm;0;ON;;;;;N;;;;; +23AA;CURLY BRACKET EXTENSION;Sm;0;ON;;;;;N;;;;; +23AB;RIGHT CURLY BRACKET UPPER HOOK;Sm;0;ON;;;;;N;;;;; +23AC;RIGHT CURLY BRACKET MIDDLE PIECE;Sm;0;ON;;;;;N;;;;; +23AD;RIGHT CURLY BRACKET LOWER HOOK;Sm;0;ON;;;;;N;;;;; +23AE;INTEGRAL EXTENSION;Sm;0;ON;;;;;N;;;;; +23AF;HORIZONTAL LINE EXTENSION;Sm;0;ON;;;;;N;;;;; +23B0;UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION;Sm;0;ON;;;;;N;;;;; +23B1;UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION;Sm;0;ON;;;;;N;;;;; +23B2;SUMMATION TOP;Sm;0;ON;;;;;N;;;;; +23B3;SUMMATION BOTTOM;Sm;0;ON;;;;;N;;;;; +23B4;TOP SQUARE BRACKET;So;0;ON;;;;;N;;;;; +23B5;BOTTOM SQUARE BRACKET;So;0;ON;;;;;N;;;;; +23B6;BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET;So;0;ON;;;;;N;;;;; +23B7;RADICAL SYMBOL BOTTOM;So;0;ON;;;;;N;;;;; +23B8;LEFT VERTICAL BOX LINE;So;0;ON;;;;;N;;;;; +23B9;RIGHT VERTICAL BOX LINE;So;0;ON;;;;;N;;;;; +23BA;HORIZONTAL SCAN LINE-1;So;0;ON;;;;;N;;;;; +23BB;HORIZONTAL SCAN LINE-3;So;0;ON;;;;;N;;;;; +23BC;HORIZONTAL SCAN LINE-7;So;0;ON;;;;;N;;;;; +23BD;HORIZONTAL SCAN LINE-9;So;0;ON;;;;;N;;;;; +23BE;DENTISTRY SYMBOL LIGHT VERTICAL AND TOP RIGHT;So;0;ON;;;;;N;;;;; +23BF;DENTISTRY SYMBOL LIGHT VERTICAL AND BOTTOM RIGHT;So;0;ON;;;;;N;;;;; +23C0;DENTISTRY SYMBOL LIGHT VERTICAL WITH CIRCLE;So;0;ON;;;;;N;;;;; +23C1;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH CIRCLE;So;0;ON;;;;;N;;;;; +23C2;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH CIRCLE;So;0;ON;;;;;N;;;;; +23C3;DENTISTRY SYMBOL LIGHT VERTICAL WITH TRIANGLE;So;0;ON;;;;;N;;;;; +23C4;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH TRIANGLE;So;0;ON;;;;;N;;;;; +23C5;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH TRIANGLE;So;0;ON;;;;;N;;;;; +23C6;DENTISTRY SYMBOL LIGHT VERTICAL AND WAVE;So;0;ON;;;;;N;;;;; +23C7;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH WAVE;So;0;ON;;;;;N;;;;; +23C8;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH WAVE;So;0;ON;;;;;N;;;;; +23C9;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL;So;0;ON;;;;;N;;;;; +23CA;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL;So;0;ON;;;;;N;;;;; +23CB;DENTISTRY SYMBOL LIGHT VERTICAL AND TOP LEFT;So;0;ON;;;;;N;;;;; +23CC;DENTISTRY SYMBOL LIGHT VERTICAL AND BOTTOM LEFT;So;0;ON;;;;;N;;;;; +23CD;SQUARE FOOT;So;0;ON;;;;;N;;;;; +23CE;RETURN SYMBOL;So;0;ON;;;;;N;;;;; +23CF;EJECT SYMBOL;So;0;ON;;;;;N;;;;; +23D0;VERTICAL LINE EXTENSION;So;0;ON;;;;;N;;;;; +23D1;METRICAL BREVE;So;0;ON;;;;;N;;;;; +23D2;METRICAL LONG OVER SHORT;So;0;ON;;;;;N;;;;; +23D3;METRICAL SHORT OVER LONG;So;0;ON;;;;;N;;;;; +23D4;METRICAL LONG OVER TWO SHORTS;So;0;ON;;;;;N;;;;; +23D5;METRICAL TWO SHORTS OVER LONG;So;0;ON;;;;;N;;;;; +23D6;METRICAL TWO SHORTS JOINED;So;0;ON;;;;;N;;;;; +23D7;METRICAL TRISEME;So;0;ON;;;;;N;;;;; +23D8;METRICAL TETRASEME;So;0;ON;;;;;N;;;;; +23D9;METRICAL PENTASEME;So;0;ON;;;;;N;;;;; +23DA;EARTH GROUND;So;0;ON;;;;;N;;;;; +23DB;FUSE;So;0;ON;;;;;N;;;;; +23DC;TOP PARENTHESIS;Sm;0;ON;;;;;N;;;;; +23DD;BOTTOM PARENTHESIS;Sm;0;ON;;;;;N;;;;; +23DE;TOP CURLY BRACKET;Sm;0;ON;;;;;N;;;;; +23DF;BOTTOM CURLY BRACKET;Sm;0;ON;;;;;N;;;;; +23E0;TOP TORTOISE SHELL BRACKET;Sm;0;ON;;;;;N;;;;; +23E1;BOTTOM TORTOISE SHELL BRACKET;Sm;0;ON;;;;;N;;;;; +23E2;WHITE TRAPEZIUM;So;0;ON;;;;;N;;;;; +23E3;BENZENE RING WITH CIRCLE;So;0;ON;;;;;N;;;;; +23E4;STRAIGHTNESS;So;0;ON;;;;;N;;;;; +23E5;FLATNESS;So;0;ON;;;;;N;;;;; +23E6;AC CURRENT;So;0;ON;;;;;N;;;;; +23E7;ELECTRICAL INTERSECTION;So;0;ON;;;;;N;;;;; +23E8;DECIMAL EXPONENT SYMBOL;So;0;ON;;;;;N;;;;; +23E9;BLACK RIGHT-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;; +23EA;BLACK LEFT-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;; +23EB;BLACK UP-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;; +23EC;BLACK DOWN-POINTING DOUBLE TRIANGLE;So;0;ON;;;;;N;;;;; +23ED;BLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR;So;0;ON;;;;;N;;;;; +23EE;BLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR;So;0;ON;;;;;N;;;;; +23EF;BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR;So;0;ON;;;;;N;;;;; +23F0;ALARM CLOCK;So;0;ON;;;;;N;;;;; +23F1;STOPWATCH;So;0;ON;;;;;N;;;;; +23F2;TIMER CLOCK;So;0;ON;;;;;N;;;;; +23F3;HOURGLASS WITH FLOWING SAND;So;0;ON;;;;;N;;;;; +23F4;BLACK MEDIUM LEFT-POINTING TRIANGLE;So;0;ON;;;;;N;;;;; +23F5;BLACK MEDIUM RIGHT-POINTING TRIANGLE;So;0;ON;;;;;N;;;;; +23F6;BLACK MEDIUM UP-POINTING TRIANGLE;So;0;ON;;;;;N;;;;; +23F7;BLACK MEDIUM DOWN-POINTING TRIANGLE;So;0;ON;;;;;N;;;;; +23F8;DOUBLE VERTICAL BAR;So;0;ON;;;;;N;;;;; +23F9;BLACK SQUARE FOR STOP;So;0;ON;;;;;N;;;;; +23FA;BLACK CIRCLE FOR RECORD;So;0;ON;;;;;N;;;;; +23FB;POWER SYMBOL;So;0;ON;;;;;N;;;;; +23FC;POWER ON-OFF SYMBOL;So;0;ON;;;;;N;;;;; +23FD;POWER ON SYMBOL;So;0;ON;;;;;N;;;;; +23FE;POWER SLEEP SYMBOL;So;0;ON;;;;;N;;;;; +23FF;OBSERVER EYE SYMBOL;So;0;ON;;;;;N;;;;; +2400;SYMBOL FOR NULL;So;0;ON;;;;;N;GRAPHIC FOR NULL;;;; +2401;SYMBOL FOR START OF HEADING;So;0;ON;;;;;N;GRAPHIC FOR START OF HEADING;;;; +2402;SYMBOL FOR START OF TEXT;So;0;ON;;;;;N;GRAPHIC FOR START OF TEXT;;;; +2403;SYMBOL FOR END OF TEXT;So;0;ON;;;;;N;GRAPHIC FOR END OF TEXT;;;; +2404;SYMBOL FOR END OF TRANSMISSION;So;0;ON;;;;;N;GRAPHIC FOR END OF TRANSMISSION;;;; +2405;SYMBOL FOR ENQUIRY;So;0;ON;;;;;N;GRAPHIC FOR ENQUIRY;;;; +2406;SYMBOL FOR ACKNOWLEDGE;So;0;ON;;;;;N;GRAPHIC FOR ACKNOWLEDGE;;;; +2407;SYMBOL FOR BELL;So;0;ON;;;;;N;GRAPHIC FOR BELL;;;; +2408;SYMBOL FOR BACKSPACE;So;0;ON;;;;;N;GRAPHIC FOR BACKSPACE;;;; +2409;SYMBOL FOR HORIZONTAL TABULATION;So;0;ON;;;;;N;GRAPHIC FOR HORIZONTAL TABULATION;;;; +240A;SYMBOL FOR LINE FEED;So;0;ON;;;;;N;GRAPHIC FOR LINE FEED;;;; +240B;SYMBOL FOR VERTICAL TABULATION;So;0;ON;;;;;N;GRAPHIC FOR VERTICAL TABULATION;;;; +240C;SYMBOL FOR FORM FEED;So;0;ON;;;;;N;GRAPHIC FOR FORM FEED;;;; +240D;SYMBOL FOR CARRIAGE RETURN;So;0;ON;;;;;N;GRAPHIC FOR CARRIAGE RETURN;;;; +240E;SYMBOL FOR SHIFT OUT;So;0;ON;;;;;N;GRAPHIC FOR SHIFT OUT;;;; +240F;SYMBOL FOR SHIFT IN;So;0;ON;;;;;N;GRAPHIC FOR SHIFT IN;;;; +2410;SYMBOL FOR DATA LINK ESCAPE;So;0;ON;;;;;N;GRAPHIC FOR DATA LINK ESCAPE;;;; +2411;SYMBOL FOR DEVICE CONTROL ONE;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL ONE;;;; +2412;SYMBOL FOR DEVICE CONTROL TWO;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL TWO;;;; +2413;SYMBOL FOR DEVICE CONTROL THREE;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL THREE;;;; +2414;SYMBOL FOR DEVICE CONTROL FOUR;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL FOUR;;;; +2415;SYMBOL FOR NEGATIVE ACKNOWLEDGE;So;0;ON;;;;;N;GRAPHIC FOR NEGATIVE ACKNOWLEDGE;;;; +2416;SYMBOL FOR SYNCHRONOUS IDLE;So;0;ON;;;;;N;GRAPHIC FOR SYNCHRONOUS IDLE;;;; +2417;SYMBOL FOR END OF TRANSMISSION BLOCK;So;0;ON;;;;;N;GRAPHIC FOR END OF TRANSMISSION BLOCK;;;; +2418;SYMBOL FOR CANCEL;So;0;ON;;;;;N;GRAPHIC FOR CANCEL;;;; +2419;SYMBOL FOR END OF MEDIUM;So;0;ON;;;;;N;GRAPHIC FOR END OF MEDIUM;;;; +241A;SYMBOL FOR SUBSTITUTE;So;0;ON;;;;;N;GRAPHIC FOR SUBSTITUTE;;;; +241B;SYMBOL FOR ESCAPE;So;0;ON;;;;;N;GRAPHIC FOR ESCAPE;;;; +241C;SYMBOL FOR FILE SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR FILE SEPARATOR;;;; +241D;SYMBOL FOR GROUP SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR GROUP SEPARATOR;;;; +241E;SYMBOL FOR RECORD SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR RECORD SEPARATOR;;;; +241F;SYMBOL FOR UNIT SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR UNIT SEPARATOR;;;; +2420;SYMBOL FOR SPACE;So;0;ON;;;;;N;GRAPHIC FOR SPACE;;;; +2421;SYMBOL FOR DELETE;So;0;ON;;;;;N;GRAPHIC FOR DELETE;;;; +2422;BLANK SYMBOL;So;0;ON;;;;;N;BLANK;;;; +2423;OPEN BOX;So;0;ON;;;;;N;;;;; +2424;SYMBOL FOR NEWLINE;So;0;ON;;;;;N;GRAPHIC FOR NEWLINE;;;; +2425;SYMBOL FOR DELETE FORM TWO;So;0;ON;;;;;N;;;;; +2426;SYMBOL FOR SUBSTITUTE FORM TWO;So;0;ON;;;;;N;;;;; +2440;OCR HOOK;So;0;ON;;;;;N;;;;; +2441;OCR CHAIR;So;0;ON;;;;;N;;;;; +2442;OCR FORK;So;0;ON;;;;;N;;;;; +2443;OCR INVERTED FORK;So;0;ON;;;;;N;;;;; +2444;OCR BELT BUCKLE;So;0;ON;;;;;N;;;;; +2445;OCR BOW TIE;So;0;ON;;;;;N;;;;; +2446;OCR BRANCH BANK IDENTIFICATION;So;0;ON;;;;;N;;;;; +2447;OCR AMOUNT OF CHECK;So;0;ON;;;;;N;;;;; +2448;OCR DASH;So;0;ON;;;;;N;;;;; +2449;OCR CUSTOMER ACCOUNT NUMBER;So;0;ON;;;;;N;;;;; +244A;OCR DOUBLE BACKSLASH;So;0;ON;;;;;N;;;;; +2460;CIRCLED DIGIT ONE;No;0;ON;<circle> 0031;;1;1;N;;;;; +2461;CIRCLED DIGIT TWO;No;0;ON;<circle> 0032;;2;2;N;;;;; +2462;CIRCLED DIGIT THREE;No;0;ON;<circle> 0033;;3;3;N;;;;; +2463;CIRCLED DIGIT FOUR;No;0;ON;<circle> 0034;;4;4;N;;;;; +2464;CIRCLED DIGIT FIVE;No;0;ON;<circle> 0035;;5;5;N;;;;; +2465;CIRCLED DIGIT SIX;No;0;ON;<circle> 0036;;6;6;N;;;;; +2466;CIRCLED DIGIT SEVEN;No;0;ON;<circle> 0037;;7;7;N;;;;; +2467;CIRCLED DIGIT EIGHT;No;0;ON;<circle> 0038;;8;8;N;;;;; +2468;CIRCLED DIGIT NINE;No;0;ON;<circle> 0039;;9;9;N;;;;; +2469;CIRCLED NUMBER TEN;No;0;ON;<circle> 0031 0030;;;10;N;;;;; +246A;CIRCLED NUMBER ELEVEN;No;0;ON;<circle> 0031 0031;;;11;N;;;;; +246B;CIRCLED NUMBER TWELVE;No;0;ON;<circle> 0031 0032;;;12;N;;;;; +246C;CIRCLED NUMBER THIRTEEN;No;0;ON;<circle> 0031 0033;;;13;N;;;;; +246D;CIRCLED NUMBER FOURTEEN;No;0;ON;<circle> 0031 0034;;;14;N;;;;; +246E;CIRCLED NUMBER FIFTEEN;No;0;ON;<circle> 0031 0035;;;15;N;;;;; +246F;CIRCLED NUMBER SIXTEEN;No;0;ON;<circle> 0031 0036;;;16;N;;;;; +2470;CIRCLED NUMBER SEVENTEEN;No;0;ON;<circle> 0031 0037;;;17;N;;;;; +2471;CIRCLED NUMBER EIGHTEEN;No;0;ON;<circle> 0031 0038;;;18;N;;;;; +2472;CIRCLED NUMBER NINETEEN;No;0;ON;<circle> 0031 0039;;;19;N;;;;; +2473;CIRCLED NUMBER TWENTY;No;0;ON;<circle> 0032 0030;;;20;N;;;;; +2474;PARENTHESIZED DIGIT ONE;No;0;ON;<compat> 0028 0031 0029;;1;1;N;;;;; +2475;PARENTHESIZED DIGIT TWO;No;0;ON;<compat> 0028 0032 0029;;2;2;N;;;;; +2476;PARENTHESIZED DIGIT THREE;No;0;ON;<compat> 0028 0033 0029;;3;3;N;;;;; +2477;PARENTHESIZED DIGIT FOUR;No;0;ON;<compat> 0028 0034 0029;;4;4;N;;;;; +2478;PARENTHESIZED DIGIT FIVE;No;0;ON;<compat> 0028 0035 0029;;5;5;N;;;;; +2479;PARENTHESIZED DIGIT SIX;No;0;ON;<compat> 0028 0036 0029;;6;6;N;;;;; +247A;PARENTHESIZED DIGIT SEVEN;No;0;ON;<compat> 0028 0037 0029;;7;7;N;;;;; +247B;PARENTHESIZED DIGIT EIGHT;No;0;ON;<compat> 0028 0038 0029;;8;8;N;;;;; +247C;PARENTHESIZED DIGIT NINE;No;0;ON;<compat> 0028 0039 0029;;9;9;N;;;;; +247D;PARENTHESIZED NUMBER TEN;No;0;ON;<compat> 0028 0031 0030 0029;;;10;N;;;;; +247E;PARENTHESIZED NUMBER ELEVEN;No;0;ON;<compat> 0028 0031 0031 0029;;;11;N;;;;; +247F;PARENTHESIZED NUMBER TWELVE;No;0;ON;<compat> 0028 0031 0032 0029;;;12;N;;;;; +2480;PARENTHESIZED NUMBER THIRTEEN;No;0;ON;<compat> 0028 0031 0033 0029;;;13;N;;;;; +2481;PARENTHESIZED NUMBER FOURTEEN;No;0;ON;<compat> 0028 0031 0034 0029;;;14;N;;;;; +2482;PARENTHESIZED NUMBER FIFTEEN;No;0;ON;<compat> 0028 0031 0035 0029;;;15;N;;;;; +2483;PARENTHESIZED NUMBER SIXTEEN;No;0;ON;<compat> 0028 0031 0036 0029;;;16;N;;;;; +2484;PARENTHESIZED NUMBER SEVENTEEN;No;0;ON;<compat> 0028 0031 0037 0029;;;17;N;;;;; +2485;PARENTHESIZED NUMBER EIGHTEEN;No;0;ON;<compat> 0028 0031 0038 0029;;;18;N;;;;; +2486;PARENTHESIZED NUMBER NINETEEN;No;0;ON;<compat> 0028 0031 0039 0029;;;19;N;;;;; +2487;PARENTHESIZED NUMBER TWENTY;No;0;ON;<compat> 0028 0032 0030 0029;;;20;N;;;;; +2488;DIGIT ONE FULL STOP;No;0;EN;<compat> 0031 002E;;1;1;N;DIGIT ONE PERIOD;;;; +2489;DIGIT TWO FULL STOP;No;0;EN;<compat> 0032 002E;;2;2;N;DIGIT TWO PERIOD;;;; +248A;DIGIT THREE FULL STOP;No;0;EN;<compat> 0033 002E;;3;3;N;DIGIT THREE PERIOD;;;; +248B;DIGIT FOUR FULL STOP;No;0;EN;<compat> 0034 002E;;4;4;N;DIGIT FOUR PERIOD;;;; +248C;DIGIT FIVE FULL STOP;No;0;EN;<compat> 0035 002E;;5;5;N;DIGIT FIVE PERIOD;;;; +248D;DIGIT SIX FULL STOP;No;0;EN;<compat> 0036 002E;;6;6;N;DIGIT SIX PERIOD;;;; +248E;DIGIT SEVEN FULL STOP;No;0;EN;<compat> 0037 002E;;7;7;N;DIGIT SEVEN PERIOD;;;; +248F;DIGIT EIGHT FULL STOP;No;0;EN;<compat> 0038 002E;;8;8;N;DIGIT EIGHT PERIOD;;;; +2490;DIGIT NINE FULL STOP;No;0;EN;<compat> 0039 002E;;9;9;N;DIGIT NINE PERIOD;;;; +2491;NUMBER TEN FULL STOP;No;0;EN;<compat> 0031 0030 002E;;;10;N;NUMBER TEN PERIOD;;;; +2492;NUMBER ELEVEN FULL STOP;No;0;EN;<compat> 0031 0031 002E;;;11;N;NUMBER ELEVEN PERIOD;;;; +2493;NUMBER TWELVE FULL STOP;No;0;EN;<compat> 0031 0032 002E;;;12;N;NUMBER TWELVE PERIOD;;;; +2494;NUMBER THIRTEEN FULL STOP;No;0;EN;<compat> 0031 0033 002E;;;13;N;NUMBER THIRTEEN PERIOD;;;; +2495;NUMBER FOURTEEN FULL STOP;No;0;EN;<compat> 0031 0034 002E;;;14;N;NUMBER FOURTEEN PERIOD;;;; +2496;NUMBER FIFTEEN FULL STOP;No;0;EN;<compat> 0031 0035 002E;;;15;N;NUMBER FIFTEEN PERIOD;;;; +2497;NUMBER SIXTEEN FULL STOP;No;0;EN;<compat> 0031 0036 002E;;;16;N;NUMBER SIXTEEN PERIOD;;;; +2498;NUMBER SEVENTEEN FULL STOP;No;0;EN;<compat> 0031 0037 002E;;;17;N;NUMBER SEVENTEEN PERIOD;;;; +2499;NUMBER EIGHTEEN FULL STOP;No;0;EN;<compat> 0031 0038 002E;;;18;N;NUMBER EIGHTEEN PERIOD;;;; +249A;NUMBER NINETEEN FULL STOP;No;0;EN;<compat> 0031 0039 002E;;;19;N;NUMBER NINETEEN PERIOD;;;; +249B;NUMBER TWENTY FULL STOP;No;0;EN;<compat> 0032 0030 002E;;;20;N;NUMBER TWENTY PERIOD;;;; +249C;PARENTHESIZED LATIN SMALL LETTER A;So;0;L;<compat> 0028 0061 0029;;;;N;;;;; +249D;PARENTHESIZED LATIN SMALL LETTER B;So;0;L;<compat> 0028 0062 0029;;;;N;;;;; +249E;PARENTHESIZED LATIN SMALL LETTER C;So;0;L;<compat> 0028 0063 0029;;;;N;;;;; +249F;PARENTHESIZED LATIN SMALL LETTER D;So;0;L;<compat> 0028 0064 0029;;;;N;;;;; +24A0;PARENTHESIZED LATIN SMALL LETTER E;So;0;L;<compat> 0028 0065 0029;;;;N;;;;; +24A1;PARENTHESIZED LATIN SMALL LETTER F;So;0;L;<compat> 0028 0066 0029;;;;N;;;;; +24A2;PARENTHESIZED LATIN SMALL LETTER G;So;0;L;<compat> 0028 0067 0029;;;;N;;;;; +24A3;PARENTHESIZED LATIN SMALL LETTER H;So;0;L;<compat> 0028 0068 0029;;;;N;;;;; +24A4;PARENTHESIZED LATIN SMALL LETTER I;So;0;L;<compat> 0028 0069 0029;;;;N;;;;; +24A5;PARENTHESIZED LATIN SMALL LETTER J;So;0;L;<compat> 0028 006A 0029;;;;N;;;;; +24A6;PARENTHESIZED LATIN SMALL LETTER K;So;0;L;<compat> 0028 006B 0029;;;;N;;;;; +24A7;PARENTHESIZED LATIN SMALL LETTER L;So;0;L;<compat> 0028 006C 0029;;;;N;;;;; +24A8;PARENTHESIZED LATIN SMALL LETTER M;So;0;L;<compat> 0028 006D 0029;;;;N;;;;; +24A9;PARENTHESIZED LATIN SMALL LETTER N;So;0;L;<compat> 0028 006E 0029;;;;N;;;;; +24AA;PARENTHESIZED LATIN SMALL LETTER O;So;0;L;<compat> 0028 006F 0029;;;;N;;;;; +24AB;PARENTHESIZED LATIN SMALL LETTER P;So;0;L;<compat> 0028 0070 0029;;;;N;;;;; +24AC;PARENTHESIZED LATIN SMALL LETTER Q;So;0;L;<compat> 0028 0071 0029;;;;N;;;;; +24AD;PARENTHESIZED LATIN SMALL LETTER R;So;0;L;<compat> 0028 0072 0029;;;;N;;;;; +24AE;PARENTHESIZED LATIN SMALL LETTER S;So;0;L;<compat> 0028 0073 0029;;;;N;;;;; +24AF;PARENTHESIZED LATIN SMALL LETTER T;So;0;L;<compat> 0028 0074 0029;;;;N;;;;; +24B0;PARENTHESIZED LATIN SMALL LETTER U;So;0;L;<compat> 0028 0075 0029;;;;N;;;;; +24B1;PARENTHESIZED LATIN SMALL LETTER V;So;0;L;<compat> 0028 0076 0029;;;;N;;;;; +24B2;PARENTHESIZED LATIN SMALL LETTER W;So;0;L;<compat> 0028 0077 0029;;;;N;;;;; +24B3;PARENTHESIZED LATIN SMALL LETTER X;So;0;L;<compat> 0028 0078 0029;;;;N;;;;; +24B4;PARENTHESIZED LATIN SMALL LETTER Y;So;0;L;<compat> 0028 0079 0029;;;;N;;;;; +24B5;PARENTHESIZED LATIN SMALL LETTER Z;So;0;L;<compat> 0028 007A 0029;;;;N;;;;; +24B6;CIRCLED LATIN CAPITAL LETTER A;So;0;L;<circle> 0041;;;;N;;;;24D0; +24B7;CIRCLED LATIN CAPITAL LETTER B;So;0;L;<circle> 0042;;;;N;;;;24D1; +24B8;CIRCLED LATIN CAPITAL LETTER C;So;0;L;<circle> 0043;;;;N;;;;24D2; +24B9;CIRCLED LATIN CAPITAL LETTER D;So;0;L;<circle> 0044;;;;N;;;;24D3; +24BA;CIRCLED LATIN CAPITAL LETTER E;So;0;L;<circle> 0045;;;;N;;;;24D4; +24BB;CIRCLED LATIN CAPITAL LETTER F;So;0;L;<circle> 0046;;;;N;;;;24D5; +24BC;CIRCLED LATIN CAPITAL LETTER G;So;0;L;<circle> 0047;;;;N;;;;24D6; +24BD;CIRCLED LATIN CAPITAL LETTER H;So;0;L;<circle> 0048;;;;N;;;;24D7; +24BE;CIRCLED LATIN CAPITAL LETTER I;So;0;L;<circle> 0049;;;;N;;;;24D8; +24BF;CIRCLED LATIN CAPITAL LETTER J;So;0;L;<circle> 004A;;;;N;;;;24D9; +24C0;CIRCLED LATIN CAPITAL LETTER K;So;0;L;<circle> 004B;;;;N;;;;24DA; +24C1;CIRCLED LATIN CAPITAL LETTER L;So;0;L;<circle> 004C;;;;N;;;;24DB; +24C2;CIRCLED LATIN CAPITAL LETTER M;So;0;L;<circle> 004D;;;;N;;;;24DC; +24C3;CIRCLED LATIN CAPITAL LETTER N;So;0;L;<circle> 004E;;;;N;;;;24DD; +24C4;CIRCLED LATIN CAPITAL LETTER O;So;0;L;<circle> 004F;;;;N;;;;24DE; +24C5;CIRCLED LATIN CAPITAL LETTER P;So;0;L;<circle> 0050;;;;N;;;;24DF; +24C6;CIRCLED LATIN CAPITAL LETTER Q;So;0;L;<circle> 0051;;;;N;;;;24E0; +24C7;CIRCLED LATIN CAPITAL LETTER R;So;0;L;<circle> 0052;;;;N;;;;24E1; +24C8;CIRCLED LATIN CAPITAL LETTER S;So;0;L;<circle> 0053;;;;N;;;;24E2; +24C9;CIRCLED LATIN CAPITAL LETTER T;So;0;L;<circle> 0054;;;;N;;;;24E3; +24CA;CIRCLED LATIN CAPITAL LETTER U;So;0;L;<circle> 0055;;;;N;;;;24E4; +24CB;CIRCLED LATIN CAPITAL LETTER V;So;0;L;<circle> 0056;;;;N;;;;24E5; +24CC;CIRCLED LATIN CAPITAL LETTER W;So;0;L;<circle> 0057;;;;N;;;;24E6; +24CD;CIRCLED LATIN CAPITAL LETTER X;So;0;L;<circle> 0058;;;;N;;;;24E7; +24CE;CIRCLED LATIN CAPITAL LETTER Y;So;0;L;<circle> 0059;;;;N;;;;24E8; +24CF;CIRCLED LATIN CAPITAL LETTER Z;So;0;L;<circle> 005A;;;;N;;;;24E9; +24D0;CIRCLED LATIN SMALL LETTER A;So;0;L;<circle> 0061;;;;N;;;24B6;;24B6 +24D1;CIRCLED LATIN SMALL LETTER B;So;0;L;<circle> 0062;;;;N;;;24B7;;24B7 +24D2;CIRCLED LATIN SMALL LETTER C;So;0;L;<circle> 0063;;;;N;;;24B8;;24B8 +24D3;CIRCLED LATIN SMALL LETTER D;So;0;L;<circle> 0064;;;;N;;;24B9;;24B9 +24D4;CIRCLED LATIN SMALL LETTER E;So;0;L;<circle> 0065;;;;N;;;24BA;;24BA +24D5;CIRCLED LATIN SMALL LETTER F;So;0;L;<circle> 0066;;;;N;;;24BB;;24BB +24D6;CIRCLED LATIN SMALL LETTER G;So;0;L;<circle> 0067;;;;N;;;24BC;;24BC +24D7;CIRCLED LATIN SMALL LETTER H;So;0;L;<circle> 0068;;;;N;;;24BD;;24BD +24D8;CIRCLED LATIN SMALL LETTER I;So;0;L;<circle> 0069;;;;N;;;24BE;;24BE +24D9;CIRCLED LATIN SMALL LETTER J;So;0;L;<circle> 006A;;;;N;;;24BF;;24BF +24DA;CIRCLED LATIN SMALL LETTER K;So;0;L;<circle> 006B;;;;N;;;24C0;;24C0 +24DB;CIRCLED LATIN SMALL LETTER L;So;0;L;<circle> 006C;;;;N;;;24C1;;24C1 +24DC;CIRCLED LATIN SMALL LETTER M;So;0;L;<circle> 006D;;;;N;;;24C2;;24C2 +24DD;CIRCLED LATIN SMALL LETTER N;So;0;L;<circle> 006E;;;;N;;;24C3;;24C3 +24DE;CIRCLED LATIN SMALL LETTER O;So;0;L;<circle> 006F;;;;N;;;24C4;;24C4 +24DF;CIRCLED LATIN SMALL LETTER P;So;0;L;<circle> 0070;;;;N;;;24C5;;24C5 +24E0;CIRCLED LATIN SMALL LETTER Q;So;0;L;<circle> 0071;;;;N;;;24C6;;24C6 +24E1;CIRCLED LATIN SMALL LETTER R;So;0;L;<circle> 0072;;;;N;;;24C7;;24C7 +24E2;CIRCLED LATIN SMALL LETTER S;So;0;L;<circle> 0073;;;;N;;;24C8;;24C8 +24E3;CIRCLED LATIN SMALL LETTER T;So;0;L;<circle> 0074;;;;N;;;24C9;;24C9 +24E4;CIRCLED LATIN SMALL LETTER U;So;0;L;<circle> 0075;;;;N;;;24CA;;24CA +24E5;CIRCLED LATIN SMALL LETTER V;So;0;L;<circle> 0076;;;;N;;;24CB;;24CB +24E6;CIRCLED LATIN SMALL LETTER W;So;0;L;<circle> 0077;;;;N;;;24CC;;24CC +24E7;CIRCLED LATIN SMALL LETTER X;So;0;L;<circle> 0078;;;;N;;;24CD;;24CD +24E8;CIRCLED LATIN SMALL LETTER Y;So;0;L;<circle> 0079;;;;N;;;24CE;;24CE +24E9;CIRCLED LATIN SMALL LETTER Z;So;0;L;<circle> 007A;;;;N;;;24CF;;24CF +24EA;CIRCLED DIGIT ZERO;No;0;ON;<circle> 0030;;0;0;N;;;;; +24EB;NEGATIVE CIRCLED NUMBER ELEVEN;No;0;ON;;;;11;N;;;;; +24EC;NEGATIVE CIRCLED NUMBER TWELVE;No;0;ON;;;;12;N;;;;; +24ED;NEGATIVE CIRCLED NUMBER THIRTEEN;No;0;ON;;;;13;N;;;;; +24EE;NEGATIVE CIRCLED NUMBER FOURTEEN;No;0;ON;;;;14;N;;;;; +24EF;NEGATIVE CIRCLED NUMBER FIFTEEN;No;0;ON;;;;15;N;;;;; +24F0;NEGATIVE CIRCLED NUMBER SIXTEEN;No;0;ON;;;;16;N;;;;; +24F1;NEGATIVE CIRCLED NUMBER SEVENTEEN;No;0;ON;;;;17;N;;;;; +24F2;NEGATIVE CIRCLED NUMBER EIGHTEEN;No;0;ON;;;;18;N;;;;; +24F3;NEGATIVE CIRCLED NUMBER NINETEEN;No;0;ON;;;;19;N;;;;; +24F4;NEGATIVE CIRCLED NUMBER TWENTY;No;0;ON;;;;20;N;;;;; +24F5;DOUBLE CIRCLED DIGIT ONE;No;0;ON;;;1;1;N;;;;; +24F6;DOUBLE CIRCLED DIGIT TWO;No;0;ON;;;2;2;N;;;;; +24F7;DOUBLE CIRCLED DIGIT THREE;No;0;ON;;;3;3;N;;;;; +24F8;DOUBLE CIRCLED DIGIT FOUR;No;0;ON;;;4;4;N;;;;; +24F9;DOUBLE CIRCLED DIGIT FIVE;No;0;ON;;;5;5;N;;;;; +24FA;DOUBLE CIRCLED DIGIT SIX;No;0;ON;;;6;6;N;;;;; +24FB;DOUBLE CIRCLED DIGIT SEVEN;No;0;ON;;;7;7;N;;;;; +24FC;DOUBLE CIRCLED DIGIT EIGHT;No;0;ON;;;8;8;N;;;;; +24FD;DOUBLE CIRCLED DIGIT NINE;No;0;ON;;;9;9;N;;;;; +24FE;DOUBLE CIRCLED NUMBER TEN;No;0;ON;;;;10;N;;;;; +24FF;NEGATIVE CIRCLED DIGIT ZERO;No;0;ON;;;0;0;N;;;;; +2500;BOX DRAWINGS LIGHT HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT HORIZONTAL;;;; +2501;BOX DRAWINGS HEAVY HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY HORIZONTAL;;;; +2502;BOX DRAWINGS LIGHT VERTICAL;So;0;ON;;;;;N;FORMS LIGHT VERTICAL;;;; +2503;BOX DRAWINGS HEAVY VERTICAL;So;0;ON;;;;;N;FORMS HEAVY VERTICAL;;;; +2504;BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT TRIPLE DASH HORIZONTAL;;;; +2505;BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY TRIPLE DASH HORIZONTAL;;;; +2506;BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS LIGHT TRIPLE DASH VERTICAL;;;; +2507;BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS HEAVY TRIPLE DASH VERTICAL;;;; +2508;BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT QUADRUPLE DASH HORIZONTAL;;;; +2509;BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY QUADRUPLE DASH HORIZONTAL;;;; +250A;BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS LIGHT QUADRUPLE DASH VERTICAL;;;; +250B;BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS HEAVY QUADRUPLE DASH VERTICAL;;;; +250C;BOX DRAWINGS LIGHT DOWN AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT DOWN AND RIGHT;;;; +250D;BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND RIGHT HEAVY;;;; +250E;BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND RIGHT LIGHT;;;; +250F;BOX DRAWINGS HEAVY DOWN AND RIGHT;So;0;ON;;;;;N;FORMS HEAVY DOWN AND RIGHT;;;; +2510;BOX DRAWINGS LIGHT DOWN AND LEFT;So;0;ON;;;;;N;FORMS LIGHT DOWN AND LEFT;;;; +2511;BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND LEFT HEAVY;;;; +2512;BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND LEFT LIGHT;;;; +2513;BOX DRAWINGS HEAVY DOWN AND LEFT;So;0;ON;;;;;N;FORMS HEAVY DOWN AND LEFT;;;; +2514;BOX DRAWINGS LIGHT UP AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT UP AND RIGHT;;;; +2515;BOX DRAWINGS UP LIGHT AND RIGHT HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND RIGHT HEAVY;;;; +2516;BOX DRAWINGS UP HEAVY AND RIGHT LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND RIGHT LIGHT;;;; +2517;BOX DRAWINGS HEAVY UP AND RIGHT;So;0;ON;;;;;N;FORMS HEAVY UP AND RIGHT;;;; +2518;BOX DRAWINGS LIGHT UP AND LEFT;So;0;ON;;;;;N;FORMS LIGHT UP AND LEFT;;;; +2519;BOX DRAWINGS UP LIGHT AND LEFT HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND LEFT HEAVY;;;; +251A;BOX DRAWINGS UP HEAVY AND LEFT LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND LEFT LIGHT;;;; +251B;BOX DRAWINGS HEAVY UP AND LEFT;So;0;ON;;;;;N;FORMS HEAVY UP AND LEFT;;;; +251C;BOX DRAWINGS LIGHT VERTICAL AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT VERTICAL AND RIGHT;;;; +251D;BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY;So;0;ON;;;;;N;FORMS VERTICAL LIGHT AND RIGHT HEAVY;;;; +251E;BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND RIGHT DOWN LIGHT;;;; +251F;BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND RIGHT UP LIGHT;;;; +2520;BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT;So;0;ON;;;;;N;FORMS VERTICAL HEAVY AND RIGHT LIGHT;;;; +2521;BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND RIGHT UP HEAVY;;;; +2522;BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND RIGHT DOWN HEAVY;;;; +2523;BOX DRAWINGS HEAVY VERTICAL AND RIGHT;So;0;ON;;;;;N;FORMS HEAVY VERTICAL AND RIGHT;;;; +2524;BOX DRAWINGS LIGHT VERTICAL AND LEFT;So;0;ON;;;;;N;FORMS LIGHT VERTICAL AND LEFT;;;; +2525;BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY;So;0;ON;;;;;N;FORMS VERTICAL LIGHT AND LEFT HEAVY;;;; +2526;BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND LEFT DOWN LIGHT;;;; +2527;BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND LEFT UP LIGHT;;;; +2528;BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT;So;0;ON;;;;;N;FORMS VERTICAL HEAVY AND LEFT LIGHT;;;; +2529;BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND LEFT UP HEAVY;;;; +252A;BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND LEFT DOWN HEAVY;;;; +252B;BOX DRAWINGS HEAVY VERTICAL AND LEFT;So;0;ON;;;;;N;FORMS HEAVY VERTICAL AND LEFT;;;; +252C;BOX DRAWINGS LIGHT DOWN AND HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT DOWN AND HORIZONTAL;;;; +252D;BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT;So;0;ON;;;;;N;FORMS LEFT HEAVY AND RIGHT DOWN LIGHT;;;; +252E;BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT;So;0;ON;;;;;N;FORMS RIGHT HEAVY AND LEFT DOWN LIGHT;;;; +252F;BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND HORIZONTAL HEAVY;;;; +2530;BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND HORIZONTAL LIGHT;;;; +2531;BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY;So;0;ON;;;;;N;FORMS RIGHT LIGHT AND LEFT DOWN HEAVY;;;; +2532;BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY;So;0;ON;;;;;N;FORMS LEFT LIGHT AND RIGHT DOWN HEAVY;;;; +2533;BOX DRAWINGS HEAVY DOWN AND HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY DOWN AND HORIZONTAL;;;; +2534;BOX DRAWINGS LIGHT UP AND HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT UP AND HORIZONTAL;;;; +2535;BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT;So;0;ON;;;;;N;FORMS LEFT HEAVY AND RIGHT UP LIGHT;;;; +2536;BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT;So;0;ON;;;;;N;FORMS RIGHT HEAVY AND LEFT UP LIGHT;;;; +2537;BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND HORIZONTAL HEAVY;;;; +2538;BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND HORIZONTAL LIGHT;;;; +2539;BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY;So;0;ON;;;;;N;FORMS RIGHT LIGHT AND LEFT UP HEAVY;;;; +253A;BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY;So;0;ON;;;;;N;FORMS LEFT LIGHT AND RIGHT UP HEAVY;;;; +253B;BOX DRAWINGS HEAVY UP AND HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY UP AND HORIZONTAL;;;; +253C;BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT VERTICAL AND HORIZONTAL;;;; +253D;BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT;So;0;ON;;;;;N;FORMS LEFT HEAVY AND RIGHT VERTICAL LIGHT;;;; +253E;BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT;So;0;ON;;;;;N;FORMS RIGHT HEAVY AND LEFT VERTICAL LIGHT;;;; +253F;BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS VERTICAL LIGHT AND HORIZONTAL HEAVY;;;; +2540;BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND DOWN HORIZONTAL LIGHT;;;; +2541;BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND UP HORIZONTAL LIGHT;;;; +2542;BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS VERTICAL HEAVY AND HORIZONTAL LIGHT;;;; +2543;BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT;So;0;ON;;;;;N;FORMS LEFT UP HEAVY AND RIGHT DOWN LIGHT;;;; +2544;BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT;So;0;ON;;;;;N;FORMS RIGHT UP HEAVY AND LEFT DOWN LIGHT;;;; +2545;BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT;So;0;ON;;;;;N;FORMS LEFT DOWN HEAVY AND RIGHT UP LIGHT;;;; +2546;BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT;So;0;ON;;;;;N;FORMS RIGHT DOWN HEAVY AND LEFT UP LIGHT;;;; +2547;BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND UP HORIZONTAL HEAVY;;;; +2548;BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND DOWN HORIZONTAL HEAVY;;;; +2549;BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY;So;0;ON;;;;;N;FORMS RIGHT LIGHT AND LEFT VERTICAL HEAVY;;;; +254A;BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY;So;0;ON;;;;;N;FORMS LEFT LIGHT AND RIGHT VERTICAL HEAVY;;;; +254B;BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY VERTICAL AND HORIZONTAL;;;; +254C;BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT DOUBLE DASH HORIZONTAL;;;; +254D;BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY DOUBLE DASH HORIZONTAL;;;; +254E;BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL;So;0;ON;;;;;N;FORMS LIGHT DOUBLE DASH VERTICAL;;;; +254F;BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL;So;0;ON;;;;;N;FORMS HEAVY DOUBLE DASH VERTICAL;;;; +2550;BOX DRAWINGS DOUBLE HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE HORIZONTAL;;;; +2551;BOX DRAWINGS DOUBLE VERTICAL;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL;;;; +2552;BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE;So;0;ON;;;;;N;FORMS DOWN SINGLE AND RIGHT DOUBLE;;;; +2553;BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE;So;0;ON;;;;;N;FORMS DOWN DOUBLE AND RIGHT SINGLE;;;; +2554;BOX DRAWINGS DOUBLE DOWN AND RIGHT;So;0;ON;;;;;N;FORMS DOUBLE DOWN AND RIGHT;;;; +2555;BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE;So;0;ON;;;;;N;FORMS DOWN SINGLE AND LEFT DOUBLE;;;; +2556;BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE;So;0;ON;;;;;N;FORMS DOWN DOUBLE AND LEFT SINGLE;;;; +2557;BOX DRAWINGS DOUBLE DOWN AND LEFT;So;0;ON;;;;;N;FORMS DOUBLE DOWN AND LEFT;;;; +2558;BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE;So;0;ON;;;;;N;FORMS UP SINGLE AND RIGHT DOUBLE;;;; +2559;BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE;So;0;ON;;;;;N;FORMS UP DOUBLE AND RIGHT SINGLE;;;; +255A;BOX DRAWINGS DOUBLE UP AND RIGHT;So;0;ON;;;;;N;FORMS DOUBLE UP AND RIGHT;;;; +255B;BOX DRAWINGS UP SINGLE AND LEFT DOUBLE;So;0;ON;;;;;N;FORMS UP SINGLE AND LEFT DOUBLE;;;; +255C;BOX DRAWINGS UP DOUBLE AND LEFT SINGLE;So;0;ON;;;;;N;FORMS UP DOUBLE AND LEFT SINGLE;;;; +255D;BOX DRAWINGS DOUBLE UP AND LEFT;So;0;ON;;;;;N;FORMS DOUBLE UP AND LEFT;;;; +255E;BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE;So;0;ON;;;;;N;FORMS VERTICAL SINGLE AND RIGHT DOUBLE;;;; +255F;BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE;So;0;ON;;;;;N;FORMS VERTICAL DOUBLE AND RIGHT SINGLE;;;; +2560;BOX DRAWINGS DOUBLE VERTICAL AND RIGHT;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL AND RIGHT;;;; +2561;BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE;So;0;ON;;;;;N;FORMS VERTICAL SINGLE AND LEFT DOUBLE;;;; +2562;BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE;So;0;ON;;;;;N;FORMS VERTICAL DOUBLE AND LEFT SINGLE;;;; +2563;BOX DRAWINGS DOUBLE VERTICAL AND LEFT;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL AND LEFT;;;; +2564;BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE;So;0;ON;;;;;N;FORMS DOWN SINGLE AND HORIZONTAL DOUBLE;;;; +2565;BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE;So;0;ON;;;;;N;FORMS DOWN DOUBLE AND HORIZONTAL SINGLE;;;; +2566;BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE DOWN AND HORIZONTAL;;;; +2567;BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE;So;0;ON;;;;;N;FORMS UP SINGLE AND HORIZONTAL DOUBLE;;;; +2568;BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE;So;0;ON;;;;;N;FORMS UP DOUBLE AND HORIZONTAL SINGLE;;;; +2569;BOX DRAWINGS DOUBLE UP AND HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE UP AND HORIZONTAL;;;; +256A;BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE;So;0;ON;;;;;N;FORMS VERTICAL SINGLE AND HORIZONTAL DOUBLE;;;; +256B;BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE;So;0;ON;;;;;N;FORMS VERTICAL DOUBLE AND HORIZONTAL SINGLE;;;; +256C;BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL AND HORIZONTAL;;;; +256D;BOX DRAWINGS LIGHT ARC DOWN AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT ARC DOWN AND RIGHT;;;; +256E;BOX DRAWINGS LIGHT ARC DOWN AND LEFT;So;0;ON;;;;;N;FORMS LIGHT ARC DOWN AND LEFT;;;; +256F;BOX DRAWINGS LIGHT ARC UP AND LEFT;So;0;ON;;;;;N;FORMS LIGHT ARC UP AND LEFT;;;; +2570;BOX DRAWINGS LIGHT ARC UP AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT ARC UP AND RIGHT;;;; +2571;BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT;So;0;ON;;;;;N;FORMS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT;;;; +2572;BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT;So;0;ON;;;;;N;FORMS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT;;;; +2573;BOX DRAWINGS LIGHT DIAGONAL CROSS;So;0;ON;;;;;N;FORMS LIGHT DIAGONAL CROSS;;;; +2574;BOX DRAWINGS LIGHT LEFT;So;0;ON;;;;;N;FORMS LIGHT LEFT;;;; +2575;BOX DRAWINGS LIGHT UP;So;0;ON;;;;;N;FORMS LIGHT UP;;;; +2576;BOX DRAWINGS LIGHT RIGHT;So;0;ON;;;;;N;FORMS LIGHT RIGHT;;;; +2577;BOX DRAWINGS LIGHT DOWN;So;0;ON;;;;;N;FORMS LIGHT DOWN;;;; +2578;BOX DRAWINGS HEAVY LEFT;So;0;ON;;;;;N;FORMS HEAVY LEFT;;;; +2579;BOX DRAWINGS HEAVY UP;So;0;ON;;;;;N;FORMS HEAVY UP;;;; +257A;BOX DRAWINGS HEAVY RIGHT;So;0;ON;;;;;N;FORMS HEAVY RIGHT;;;; +257B;BOX DRAWINGS HEAVY DOWN;So;0;ON;;;;;N;FORMS HEAVY DOWN;;;; +257C;BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT;So;0;ON;;;;;N;FORMS LIGHT LEFT AND HEAVY RIGHT;;;; +257D;BOX DRAWINGS LIGHT UP AND HEAVY DOWN;So;0;ON;;;;;N;FORMS LIGHT UP AND HEAVY DOWN;;;; +257E;BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT;So;0;ON;;;;;N;FORMS HEAVY LEFT AND LIGHT RIGHT;;;; +257F;BOX DRAWINGS HEAVY UP AND LIGHT DOWN;So;0;ON;;;;;N;FORMS HEAVY UP AND LIGHT DOWN;;;; +2580;UPPER HALF BLOCK;So;0;ON;;;;;N;;;;; +2581;LOWER ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;; +2582;LOWER ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;; +2583;LOWER THREE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;; +2584;LOWER HALF BLOCK;So;0;ON;;;;;N;;;;; +2585;LOWER FIVE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;; +2586;LOWER THREE QUARTERS BLOCK;So;0;ON;;;;;N;LOWER THREE QUARTER BLOCK;;;; +2587;LOWER SEVEN EIGHTHS BLOCK;So;0;ON;;;;;N;;;;; +2588;FULL BLOCK;So;0;ON;;;;;N;;;;; +2589;LEFT SEVEN EIGHTHS BLOCK;So;0;ON;;;;;N;;;;; +258A;LEFT THREE QUARTERS BLOCK;So;0;ON;;;;;N;LEFT THREE QUARTER BLOCK;;;; +258B;LEFT FIVE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;; +258C;LEFT HALF BLOCK;So;0;ON;;;;;N;;;;; +258D;LEFT THREE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;; +258E;LEFT ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;; +258F;LEFT ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;; +2590;RIGHT HALF BLOCK;So;0;ON;;;;;N;;;;; +2591;LIGHT SHADE;So;0;ON;;;;;N;;;;; +2592;MEDIUM SHADE;So;0;ON;;;;;N;;;;; +2593;DARK SHADE;So;0;ON;;;;;N;;;;; +2594;UPPER ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;; +2595;RIGHT ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;; +2596;QUADRANT LOWER LEFT;So;0;ON;;;;;N;;;;; +2597;QUADRANT LOWER RIGHT;So;0;ON;;;;;N;;;;; +2598;QUADRANT UPPER LEFT;So;0;ON;;;;;N;;;;; +2599;QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT;So;0;ON;;;;;N;;;;; +259A;QUADRANT UPPER LEFT AND LOWER RIGHT;So;0;ON;;;;;N;;;;; +259B;QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT;So;0;ON;;;;;N;;;;; +259C;QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT;So;0;ON;;;;;N;;;;; +259D;QUADRANT UPPER RIGHT;So;0;ON;;;;;N;;;;; +259E;QUADRANT UPPER RIGHT AND LOWER LEFT;So;0;ON;;;;;N;;;;; +259F;QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT;So;0;ON;;;;;N;;;;; +25A0;BLACK SQUARE;So;0;ON;;;;;N;;;;; +25A1;WHITE SQUARE;So;0;ON;;;;;N;;;;; +25A2;WHITE SQUARE WITH ROUNDED CORNERS;So;0;ON;;;;;N;;;;; +25A3;WHITE SQUARE CONTAINING BLACK SMALL SQUARE;So;0;ON;;;;;N;;;;; +25A4;SQUARE WITH HORIZONTAL FILL;So;0;ON;;;;;N;;;;; +25A5;SQUARE WITH VERTICAL FILL;So;0;ON;;;;;N;;;;; +25A6;SQUARE WITH ORTHOGONAL CROSSHATCH FILL;So;0;ON;;;;;N;;;;; +25A7;SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL;So;0;ON;;;;;N;;;;; +25A8;SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL;So;0;ON;;;;;N;;;;; +25A9;SQUARE WITH DIAGONAL CROSSHATCH FILL;So;0;ON;;;;;N;;;;; +25AA;BLACK SMALL SQUARE;So;0;ON;;;;;N;;;;; +25AB;WHITE SMALL SQUARE;So;0;ON;;;;;N;;;;; +25AC;BLACK RECTANGLE;So;0;ON;;;;;N;;;;; +25AD;WHITE RECTANGLE;So;0;ON;;;;;N;;;;; +25AE;BLACK VERTICAL RECTANGLE;So;0;ON;;;;;N;;;;; +25AF;WHITE VERTICAL RECTANGLE;So;0;ON;;;;;N;;;;; +25B0;BLACK PARALLELOGRAM;So;0;ON;;;;;N;;;;; +25B1;WHITE PARALLELOGRAM;So;0;ON;;;;;N;;;;; +25B2;BLACK UP-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK UP POINTING TRIANGLE;;;; +25B3;WHITE UP-POINTING TRIANGLE;So;0;ON;;;;;N;WHITE UP POINTING TRIANGLE;;;; +25B4;BLACK UP-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK UP POINTING SMALL TRIANGLE;;;; +25B5;WHITE UP-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE UP POINTING SMALL TRIANGLE;;;; +25B6;BLACK RIGHT-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK RIGHT POINTING TRIANGLE;;;; +25B7;WHITE RIGHT-POINTING TRIANGLE;Sm;0;ON;;;;;N;WHITE RIGHT POINTING TRIANGLE;;;; +25B8;BLACK RIGHT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK RIGHT POINTING SMALL TRIANGLE;;;; +25B9;WHITE RIGHT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE RIGHT POINTING SMALL TRIANGLE;;;; +25BA;BLACK RIGHT-POINTING POINTER;So;0;ON;;;;;N;BLACK RIGHT POINTING POINTER;;;; +25BB;WHITE RIGHT-POINTING POINTER;So;0;ON;;;;;N;WHITE RIGHT POINTING POINTER;;;; +25BC;BLACK DOWN-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK DOWN POINTING TRIANGLE;;;; +25BD;WHITE DOWN-POINTING TRIANGLE;So;0;ON;;;;;N;WHITE DOWN POINTING TRIANGLE;;;; +25BE;BLACK DOWN-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK DOWN POINTING SMALL TRIANGLE;;;; +25BF;WHITE DOWN-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE DOWN POINTING SMALL TRIANGLE;;;; +25C0;BLACK LEFT-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK LEFT POINTING TRIANGLE;;;; +25C1;WHITE LEFT-POINTING TRIANGLE;Sm;0;ON;;;;;N;WHITE LEFT POINTING TRIANGLE;;;; +25C2;BLACK LEFT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK LEFT POINTING SMALL TRIANGLE;;;; +25C3;WHITE LEFT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE LEFT POINTING SMALL TRIANGLE;;;; +25C4;BLACK LEFT-POINTING POINTER;So;0;ON;;;;;N;BLACK LEFT POINTING POINTER;;;; +25C5;WHITE LEFT-POINTING POINTER;So;0;ON;;;;;N;WHITE LEFT POINTING POINTER;;;; +25C6;BLACK DIAMOND;So;0;ON;;;;;N;;;;; +25C7;WHITE DIAMOND;So;0;ON;;;;;N;;;;; +25C8;WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND;So;0;ON;;;;;N;;;;; +25C9;FISHEYE;So;0;ON;;;;;N;;;;; +25CA;LOZENGE;So;0;ON;;;;;N;;;;; +25CB;WHITE CIRCLE;So;0;ON;;;;;N;;;;; +25CC;DOTTED CIRCLE;So;0;ON;;;;;N;;;;; +25CD;CIRCLE WITH VERTICAL FILL;So;0;ON;;;;;N;;;;; +25CE;BULLSEYE;So;0;ON;;;;;N;;;;; +25CF;BLACK CIRCLE;So;0;ON;;;;;N;;;;; +25D0;CIRCLE WITH LEFT HALF BLACK;So;0;ON;;;;;N;;;;; +25D1;CIRCLE WITH RIGHT HALF BLACK;So;0;ON;;;;;N;;;;; +25D2;CIRCLE WITH LOWER HALF BLACK;So;0;ON;;;;;N;;;;; +25D3;CIRCLE WITH UPPER HALF BLACK;So;0;ON;;;;;N;;;;; +25D4;CIRCLE WITH UPPER RIGHT QUADRANT BLACK;So;0;ON;;;;;N;;;;; +25D5;CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK;So;0;ON;;;;;N;;;;; +25D6;LEFT HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;; +25D7;RIGHT HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;; +25D8;INVERSE BULLET;So;0;ON;;;;;N;;;;; +25D9;INVERSE WHITE CIRCLE;So;0;ON;;;;;N;;;;; +25DA;UPPER HALF INVERSE WHITE CIRCLE;So;0;ON;;;;;N;;;;; +25DB;LOWER HALF INVERSE WHITE CIRCLE;So;0;ON;;;;;N;;;;; +25DC;UPPER LEFT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;; +25DD;UPPER RIGHT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;; +25DE;LOWER RIGHT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;; +25DF;LOWER LEFT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;; +25E0;UPPER HALF CIRCLE;So;0;ON;;;;;N;;;;; +25E1;LOWER HALF CIRCLE;So;0;ON;;;;;N;;;;; +25E2;BLACK LOWER RIGHT TRIANGLE;So;0;ON;;;;;N;;;;; +25E3;BLACK LOWER LEFT TRIANGLE;So;0;ON;;;;;N;;;;; +25E4;BLACK UPPER LEFT TRIANGLE;So;0;ON;;;;;N;;;;; +25E5;BLACK UPPER RIGHT TRIANGLE;So;0;ON;;;;;N;;;;; +25E6;WHITE BULLET;So;0;ON;;;;;N;;;;; +25E7;SQUARE WITH LEFT HALF BLACK;So;0;ON;;;;;N;;;;; +25E8;SQUARE WITH RIGHT HALF BLACK;So;0;ON;;;;;N;;;;; +25E9;SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;; +25EA;SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;; +25EB;WHITE SQUARE WITH VERTICAL BISECTING LINE;So;0;ON;;;;;N;;;;; +25EC;WHITE UP-POINTING TRIANGLE WITH DOT;So;0;ON;;;;;N;WHITE UP POINTING TRIANGLE WITH DOT;;;; +25ED;UP-POINTING TRIANGLE WITH LEFT HALF BLACK;So;0;ON;;;;;N;UP POINTING TRIANGLE WITH LEFT HALF BLACK;;;; +25EE;UP-POINTING TRIANGLE WITH RIGHT HALF BLACK;So;0;ON;;;;;N;UP POINTING TRIANGLE WITH RIGHT HALF BLACK;;;; +25EF;LARGE CIRCLE;So;0;ON;;;;;N;;;;; +25F0;WHITE SQUARE WITH UPPER LEFT QUADRANT;So;0;ON;;;;;N;;;;; +25F1;WHITE SQUARE WITH LOWER LEFT QUADRANT;So;0;ON;;;;;N;;;;; +25F2;WHITE SQUARE WITH LOWER RIGHT QUADRANT;So;0;ON;;;;;N;;;;; +25F3;WHITE SQUARE WITH UPPER RIGHT QUADRANT;So;0;ON;;;;;N;;;;; +25F4;WHITE CIRCLE WITH UPPER LEFT QUADRANT;So;0;ON;;;;;N;;;;; +25F5;WHITE CIRCLE WITH LOWER LEFT QUADRANT;So;0;ON;;;;;N;;;;; +25F6;WHITE CIRCLE WITH LOWER RIGHT QUADRANT;So;0;ON;;;;;N;;;;; +25F7;WHITE CIRCLE WITH UPPER RIGHT QUADRANT;So;0;ON;;;;;N;;;;; +25F8;UPPER LEFT TRIANGLE;Sm;0;ON;;;;;N;;;;; +25F9;UPPER RIGHT TRIANGLE;Sm;0;ON;;;;;N;;;;; +25FA;LOWER LEFT TRIANGLE;Sm;0;ON;;;;;N;;;;; +25FB;WHITE MEDIUM SQUARE;Sm;0;ON;;;;;N;;;;; +25FC;BLACK MEDIUM SQUARE;Sm;0;ON;;;;;N;;;;; +25FD;WHITE MEDIUM SMALL SQUARE;Sm;0;ON;;;;;N;;;;; +25FE;BLACK MEDIUM SMALL SQUARE;Sm;0;ON;;;;;N;;;;; +25FF;LOWER RIGHT TRIANGLE;Sm;0;ON;;;;;N;;;;; +2600;BLACK SUN WITH RAYS;So;0;ON;;;;;N;;;;; +2601;CLOUD;So;0;ON;;;;;N;;;;; +2602;UMBRELLA;So;0;ON;;;;;N;;;;; +2603;SNOWMAN;So;0;ON;;;;;N;;;;; +2604;COMET;So;0;ON;;;;;N;;;;; +2605;BLACK STAR;So;0;ON;;;;;N;;;;; +2606;WHITE STAR;So;0;ON;;;;;N;;;;; +2607;LIGHTNING;So;0;ON;;;;;N;;;;; +2608;THUNDERSTORM;So;0;ON;;;;;N;;;;; +2609;SUN;So;0;ON;;;;;N;;;;; +260A;ASCENDING NODE;So;0;ON;;;;;N;;;;; +260B;DESCENDING NODE;So;0;ON;;;;;N;;;;; +260C;CONJUNCTION;So;0;ON;;;;;N;;;;; +260D;OPPOSITION;So;0;ON;;;;;N;;;;; +260E;BLACK TELEPHONE;So;0;ON;;;;;N;;;;; +260F;WHITE TELEPHONE;So;0;ON;;;;;N;;;;; +2610;BALLOT BOX;So;0;ON;;;;;N;;;;; +2611;BALLOT BOX WITH CHECK;So;0;ON;;;;;N;;;;; +2612;BALLOT BOX WITH X;So;0;ON;;;;;N;;;;; +2613;SALTIRE;So;0;ON;;;;;N;;;;; +2614;UMBRELLA WITH RAIN DROPS;So;0;ON;;;;;N;;;;; +2615;HOT BEVERAGE;So;0;ON;;;;;N;;;;; +2616;WHITE SHOGI PIECE;So;0;ON;;;;;N;;;;; +2617;BLACK SHOGI PIECE;So;0;ON;;;;;N;;;;; +2618;SHAMROCK;So;0;ON;;;;;N;;;;; +2619;REVERSED ROTATED FLORAL HEART BULLET;So;0;ON;;;;;N;;;;; +261A;BLACK LEFT POINTING INDEX;So;0;ON;;;;;N;;;;; +261B;BLACK RIGHT POINTING INDEX;So;0;ON;;;;;N;;;;; +261C;WHITE LEFT POINTING INDEX;So;0;ON;;;;;N;;;;; +261D;WHITE UP POINTING INDEX;So;0;ON;;;;;N;;;;; +261E;WHITE RIGHT POINTING INDEX;So;0;ON;;;;;N;;;;; +261F;WHITE DOWN POINTING INDEX;So;0;ON;;;;;N;;;;; +2620;SKULL AND CROSSBONES;So;0;ON;;;;;N;;;;; +2621;CAUTION SIGN;So;0;ON;;;;;N;;;;; +2622;RADIOACTIVE SIGN;So;0;ON;;;;;N;;;;; +2623;BIOHAZARD SIGN;So;0;ON;;;;;N;;;;; +2624;CADUCEUS;So;0;ON;;;;;N;;;;; +2625;ANKH;So;0;ON;;;;;N;;;;; +2626;ORTHODOX CROSS;So;0;ON;;;;;N;;;;; +2627;CHI RHO;So;0;ON;;;;;N;;;;; +2628;CROSS OF LORRAINE;So;0;ON;;;;;N;;;;; +2629;CROSS OF JERUSALEM;So;0;ON;;;;;N;;;;; +262A;STAR AND CRESCENT;So;0;ON;;;;;N;;;;; +262B;FARSI SYMBOL;So;0;ON;;;;;N;SYMBOL OF IRAN;;;; +262C;ADI SHAKTI;So;0;ON;;;;;N;;;;; +262D;HAMMER AND SICKLE;So;0;ON;;;;;N;;;;; +262E;PEACE SYMBOL;So;0;ON;;;;;N;;;;; +262F;YIN YANG;So;0;ON;;;;;N;;;;; +2630;TRIGRAM FOR HEAVEN;So;0;ON;;;;;N;;;;; +2631;TRIGRAM FOR LAKE;So;0;ON;;;;;N;;;;; +2632;TRIGRAM FOR FIRE;So;0;ON;;;;;N;;;;; +2633;TRIGRAM FOR THUNDER;So;0;ON;;;;;N;;;;; +2634;TRIGRAM FOR WIND;So;0;ON;;;;;N;;;;; +2635;TRIGRAM FOR WATER;So;0;ON;;;;;N;;;;; +2636;TRIGRAM FOR MOUNTAIN;So;0;ON;;;;;N;;;;; +2637;TRIGRAM FOR EARTH;So;0;ON;;;;;N;;;;; +2638;WHEEL OF DHARMA;So;0;ON;;;;;N;;;;; +2639;WHITE FROWNING FACE;So;0;ON;;;;;N;;;;; +263A;WHITE SMILING FACE;So;0;ON;;;;;N;;;;; +263B;BLACK SMILING FACE;So;0;ON;;;;;N;;;;; +263C;WHITE SUN WITH RAYS;So;0;ON;;;;;N;;;;; +263D;FIRST QUARTER MOON;So;0;ON;;;;;N;;;;; +263E;LAST QUARTER MOON;So;0;ON;;;;;N;;;;; +263F;MERCURY;So;0;ON;;;;;N;;;;; +2640;FEMALE SIGN;So;0;ON;;;;;N;;;;; +2641;EARTH;So;0;ON;;;;;N;;;;; +2642;MALE SIGN;So;0;ON;;;;;N;;;;; +2643;JUPITER;So;0;ON;;;;;N;;;;; +2644;SATURN;So;0;ON;;;;;N;;;;; +2645;URANUS;So;0;ON;;;;;N;;;;; +2646;NEPTUNE;So;0;ON;;;;;N;;;;; +2647;PLUTO;So;0;ON;;;;;N;;;;; +2648;ARIES;So;0;ON;;;;;N;;;;; +2649;TAURUS;So;0;ON;;;;;N;;;;; +264A;GEMINI;So;0;ON;;;;;N;;;;; +264B;CANCER;So;0;ON;;;;;N;;;;; +264C;LEO;So;0;ON;;;;;N;;;;; +264D;VIRGO;So;0;ON;;;;;N;;;;; +264E;LIBRA;So;0;ON;;;;;N;;;;; +264F;SCORPIUS;So;0;ON;;;;;N;;;;; +2650;SAGITTARIUS;So;0;ON;;;;;N;;;;; +2651;CAPRICORN;So;0;ON;;;;;N;;;;; +2652;AQUARIUS;So;0;ON;;;;;N;;;;; +2653;PISCES;So;0;ON;;;;;N;;;;; +2654;WHITE CHESS KING;So;0;ON;;;;;N;;;;; +2655;WHITE CHESS QUEEN;So;0;ON;;;;;N;;;;; +2656;WHITE CHESS ROOK;So;0;ON;;;;;N;;;;; +2657;WHITE CHESS BISHOP;So;0;ON;;;;;N;;;;; +2658;WHITE CHESS KNIGHT;So;0;ON;;;;;N;;;;; +2659;WHITE CHESS PAWN;So;0;ON;;;;;N;;;;; +265A;BLACK CHESS KING;So;0;ON;;;;;N;;;;; +265B;BLACK CHESS QUEEN;So;0;ON;;;;;N;;;;; +265C;BLACK CHESS ROOK;So;0;ON;;;;;N;;;;; +265D;BLACK CHESS BISHOP;So;0;ON;;;;;N;;;;; +265E;BLACK CHESS KNIGHT;So;0;ON;;;;;N;;;;; +265F;BLACK CHESS PAWN;So;0;ON;;;;;N;;;;; +2660;BLACK SPADE SUIT;So;0;ON;;;;;N;;;;; +2661;WHITE HEART SUIT;So;0;ON;;;;;N;;;;; +2662;WHITE DIAMOND SUIT;So;0;ON;;;;;N;;;;; +2663;BLACK CLUB SUIT;So;0;ON;;;;;N;;;;; +2664;WHITE SPADE SUIT;So;0;ON;;;;;N;;;;; +2665;BLACK HEART SUIT;So;0;ON;;;;;N;;;;; +2666;BLACK DIAMOND SUIT;So;0;ON;;;;;N;;;;; +2667;WHITE CLUB SUIT;So;0;ON;;;;;N;;;;; +2668;HOT SPRINGS;So;0;ON;;;;;N;;;;; +2669;QUARTER NOTE;So;0;ON;;;;;N;;;;; +266A;EIGHTH NOTE;So;0;ON;;;;;N;;;;; +266B;BEAMED EIGHTH NOTES;So;0;ON;;;;;N;BARRED EIGHTH NOTES;;;; +266C;BEAMED SIXTEENTH NOTES;So;0;ON;;;;;N;BARRED SIXTEENTH NOTES;;;; +266D;MUSIC FLAT SIGN;So;0;ON;;;;;N;FLAT;;;; +266E;MUSIC NATURAL SIGN;So;0;ON;;;;;N;NATURAL;;;; +266F;MUSIC SHARP SIGN;Sm;0;ON;;;;;N;SHARP;;;; +2670;WEST SYRIAC CROSS;So;0;ON;;;;;N;;;;; +2671;EAST SYRIAC CROSS;So;0;ON;;;;;N;;;;; +2672;UNIVERSAL RECYCLING SYMBOL;So;0;ON;;;;;N;;;;; +2673;RECYCLING SYMBOL FOR TYPE-1 PLASTICS;So;0;ON;;;;;N;;;;; +2674;RECYCLING SYMBOL FOR TYPE-2 PLASTICS;So;0;ON;;;;;N;;;;; +2675;RECYCLING SYMBOL FOR TYPE-3 PLASTICS;So;0;ON;;;;;N;;;;; +2676;RECYCLING SYMBOL FOR TYPE-4 PLASTICS;So;0;ON;;;;;N;;;;; +2677;RECYCLING SYMBOL FOR TYPE-5 PLASTICS;So;0;ON;;;;;N;;;;; +2678;RECYCLING SYMBOL FOR TYPE-6 PLASTICS;So;0;ON;;;;;N;;;;; +2679;RECYCLING SYMBOL FOR TYPE-7 PLASTICS;So;0;ON;;;;;N;;;;; +267A;RECYCLING SYMBOL FOR GENERIC MATERIALS;So;0;ON;;;;;N;;;;; +267B;BLACK UNIVERSAL RECYCLING SYMBOL;So;0;ON;;;;;N;;;;; +267C;RECYCLED PAPER SYMBOL;So;0;ON;;;;;N;;;;; +267D;PARTIALLY-RECYCLED PAPER SYMBOL;So;0;ON;;;;;N;;;;; +267E;PERMANENT PAPER SIGN;So;0;ON;;;;;N;;;;; +267F;WHEELCHAIR SYMBOL;So;0;ON;;;;;N;;;;; +2680;DIE FACE-1;So;0;ON;;;;;N;;;;; +2681;DIE FACE-2;So;0;ON;;;;;N;;;;; +2682;DIE FACE-3;So;0;ON;;;;;N;;;;; +2683;DIE FACE-4;So;0;ON;;;;;N;;;;; +2684;DIE FACE-5;So;0;ON;;;;;N;;;;; +2685;DIE FACE-6;So;0;ON;;;;;N;;;;; +2686;WHITE CIRCLE WITH DOT RIGHT;So;0;ON;;;;;N;;;;; +2687;WHITE CIRCLE WITH TWO DOTS;So;0;ON;;;;;N;;;;; +2688;BLACK CIRCLE WITH WHITE DOT RIGHT;So;0;ON;;;;;N;;;;; +2689;BLACK CIRCLE WITH TWO WHITE DOTS;So;0;ON;;;;;N;;;;; +268A;MONOGRAM FOR YANG;So;0;ON;;;;;N;;;;; +268B;MONOGRAM FOR YIN;So;0;ON;;;;;N;;;;; +268C;DIGRAM FOR GREATER YANG;So;0;ON;;;;;N;;;;; +268D;DIGRAM FOR LESSER YIN;So;0;ON;;;;;N;;;;; +268E;DIGRAM FOR LESSER YANG;So;0;ON;;;;;N;;;;; +268F;DIGRAM FOR GREATER YIN;So;0;ON;;;;;N;;;;; +2690;WHITE FLAG;So;0;ON;;;;;N;;;;; +2691;BLACK FLAG;So;0;ON;;;;;N;;;;; +2692;HAMMER AND PICK;So;0;ON;;;;;N;;;;; +2693;ANCHOR;So;0;ON;;;;;N;;;;; +2694;CROSSED SWORDS;So;0;ON;;;;;N;;;;; +2695;STAFF OF AESCULAPIUS;So;0;ON;;;;;N;;;;; +2696;SCALES;So;0;ON;;;;;N;;;;; +2697;ALEMBIC;So;0;ON;;;;;N;;;;; +2698;FLOWER;So;0;ON;;;;;N;;;;; +2699;GEAR;So;0;ON;;;;;N;;;;; +269A;STAFF OF HERMES;So;0;ON;;;;;N;;;;; +269B;ATOM SYMBOL;So;0;ON;;;;;N;;;;; +269C;FLEUR-DE-LIS;So;0;ON;;;;;N;;;;; +269D;OUTLINED WHITE STAR;So;0;ON;;;;;N;;;;; +269E;THREE LINES CONVERGING RIGHT;So;0;ON;;;;;N;;;;; +269F;THREE LINES CONVERGING LEFT;So;0;ON;;;;;N;;;;; +26A0;WARNING SIGN;So;0;ON;;;;;N;;;;; +26A1;HIGH VOLTAGE SIGN;So;0;ON;;;;;N;;;;; +26A2;DOUBLED FEMALE SIGN;So;0;ON;;;;;N;;;;; +26A3;DOUBLED MALE SIGN;So;0;ON;;;;;N;;;;; +26A4;INTERLOCKED FEMALE AND MALE SIGN;So;0;ON;;;;;N;;;;; +26A5;MALE AND FEMALE SIGN;So;0;ON;;;;;N;;;;; +26A6;MALE WITH STROKE SIGN;So;0;ON;;;;;N;;;;; +26A7;MALE WITH STROKE AND MALE AND FEMALE SIGN;So;0;ON;;;;;N;;;;; +26A8;VERTICAL MALE WITH STROKE SIGN;So;0;ON;;;;;N;;;;; +26A9;HORIZONTAL MALE WITH STROKE SIGN;So;0;ON;;;;;N;;;;; +26AA;MEDIUM WHITE CIRCLE;So;0;ON;;;;;N;;;;; +26AB;MEDIUM BLACK CIRCLE;So;0;ON;;;;;N;;;;; +26AC;MEDIUM SMALL WHITE CIRCLE;So;0;L;;;;;N;;;;; +26AD;MARRIAGE SYMBOL;So;0;ON;;;;;N;;;;; +26AE;DIVORCE SYMBOL;So;0;ON;;;;;N;;;;; +26AF;UNMARRIED PARTNERSHIP SYMBOL;So;0;ON;;;;;N;;;;; +26B0;COFFIN;So;0;ON;;;;;N;;;;; +26B1;FUNERAL URN;So;0;ON;;;;;N;;;;; +26B2;NEUTER;So;0;ON;;;;;N;;;;; +26B3;CERES;So;0;ON;;;;;N;;;;; +26B4;PALLAS;So;0;ON;;;;;N;;;;; +26B5;JUNO;So;0;ON;;;;;N;;;;; +26B6;VESTA;So;0;ON;;;;;N;;;;; +26B7;CHIRON;So;0;ON;;;;;N;;;;; +26B8;BLACK MOON LILITH;So;0;ON;;;;;N;;;;; +26B9;SEXTILE;So;0;ON;;;;;N;;;;; +26BA;SEMISEXTILE;So;0;ON;;;;;N;;;;; +26BB;QUINCUNX;So;0;ON;;;;;N;;;;; +26BC;SESQUIQUADRATE;So;0;ON;;;;;N;;;;; +26BD;SOCCER BALL;So;0;ON;;;;;N;;;;; +26BE;BASEBALL;So;0;ON;;;;;N;;;;; +26BF;SQUARED KEY;So;0;ON;;;;;N;;;;; +26C0;WHITE DRAUGHTS MAN;So;0;ON;;;;;N;;;;; +26C1;WHITE DRAUGHTS KING;So;0;ON;;;;;N;;;;; +26C2;BLACK DRAUGHTS MAN;So;0;ON;;;;;N;;;;; +26C3;BLACK DRAUGHTS KING;So;0;ON;;;;;N;;;;; +26C4;SNOWMAN WITHOUT SNOW;So;0;ON;;;;;N;;;;; +26C5;SUN BEHIND CLOUD;So;0;ON;;;;;N;;;;; +26C6;RAIN;So;0;ON;;;;;N;;;;; +26C7;BLACK SNOWMAN;So;0;ON;;;;;N;;;;; +26C8;THUNDER CLOUD AND RAIN;So;0;ON;;;;;N;;;;; +26C9;TURNED WHITE SHOGI PIECE;So;0;ON;;;;;N;;;;; +26CA;TURNED BLACK SHOGI PIECE;So;0;ON;;;;;N;;;;; +26CB;WHITE DIAMOND IN SQUARE;So;0;ON;;;;;N;;;;; +26CC;CROSSING LANES;So;0;ON;;;;;N;;;;; +26CD;DISABLED CAR;So;0;ON;;;;;N;;;;; +26CE;OPHIUCHUS;So;0;ON;;;;;N;;;;; +26CF;PICK;So;0;ON;;;;;N;;;;; +26D0;CAR SLIDING;So;0;ON;;;;;N;;;;; +26D1;HELMET WITH WHITE CROSS;So;0;ON;;;;;N;;;;; +26D2;CIRCLED CROSSING LANES;So;0;ON;;;;;N;;;;; +26D3;CHAINS;So;0;ON;;;;;N;;;;; +26D4;NO ENTRY;So;0;ON;;;;;N;;;;; +26D5;ALTERNATE ONE-WAY LEFT WAY TRAFFIC;So;0;ON;;;;;N;;;;; +26D6;BLACK TWO-WAY LEFT WAY TRAFFIC;So;0;ON;;;;;N;;;;; +26D7;WHITE TWO-WAY LEFT WAY TRAFFIC;So;0;ON;;;;;N;;;;; +26D8;BLACK LEFT LANE MERGE;So;0;ON;;;;;N;;;;; +26D9;WHITE LEFT LANE MERGE;So;0;ON;;;;;N;;;;; +26DA;DRIVE SLOW SIGN;So;0;ON;;;;;N;;;;; +26DB;HEAVY WHITE DOWN-POINTING TRIANGLE;So;0;ON;;;;;N;;;;; +26DC;LEFT CLOSED ENTRY;So;0;ON;;;;;N;;;;; +26DD;SQUARED SALTIRE;So;0;ON;;;;;N;;;;; +26DE;FALLING DIAGONAL IN WHITE CIRCLE IN BLACK SQUARE;So;0;ON;;;;;N;;;;; +26DF;BLACK TRUCK;So;0;ON;;;;;N;;;;; +26E0;RESTRICTED LEFT ENTRY-1;So;0;ON;;;;;N;;;;; +26E1;RESTRICTED LEFT ENTRY-2;So;0;ON;;;;;N;;;;; +26E2;ASTRONOMICAL SYMBOL FOR URANUS;So;0;ON;;;;;N;;;;; +26E3;HEAVY CIRCLE WITH STROKE AND TWO DOTS ABOVE;So;0;ON;;;;;N;;;;; +26E4;PENTAGRAM;So;0;ON;;;;;N;;;;; +26E5;RIGHT-HANDED INTERLACED PENTAGRAM;So;0;ON;;;;;N;;;;; +26E6;LEFT-HANDED INTERLACED PENTAGRAM;So;0;ON;;;;;N;;;;; +26E7;INVERTED PENTAGRAM;So;0;ON;;;;;N;;;;; +26E8;BLACK CROSS ON SHIELD;So;0;ON;;;;;N;;;;; +26E9;SHINTO SHRINE;So;0;ON;;;;;N;;;;; +26EA;CHURCH;So;0;ON;;;;;N;;;;; +26EB;CASTLE;So;0;ON;;;;;N;;;;; +26EC;HISTORIC SITE;So;0;ON;;;;;N;;;;; +26ED;GEAR WITHOUT HUB;So;0;ON;;;;;N;;;;; +26EE;GEAR WITH HANDLES;So;0;ON;;;;;N;;;;; +26EF;MAP SYMBOL FOR LIGHTHOUSE;So;0;ON;;;;;N;;;;; +26F0;MOUNTAIN;So;0;ON;;;;;N;;;;; +26F1;UMBRELLA ON GROUND;So;0;ON;;;;;N;;;;; +26F2;FOUNTAIN;So;0;ON;;;;;N;;;;; +26F3;FLAG IN HOLE;So;0;ON;;;;;N;;;;; +26F4;FERRY;So;0;ON;;;;;N;;;;; +26F5;SAILBOAT;So;0;ON;;;;;N;;;;; +26F6;SQUARE FOUR CORNERS;So;0;ON;;;;;N;;;;; +26F7;SKIER;So;0;ON;;;;;N;;;;; +26F8;ICE SKATE;So;0;ON;;;;;N;;;;; +26F9;PERSON WITH BALL;So;0;ON;;;;;N;;;;; +26FA;TENT;So;0;ON;;;;;N;;;;; +26FB;JAPANESE BANK SYMBOL;So;0;ON;;;;;N;;;;; +26FC;HEADSTONE GRAVEYARD SYMBOL;So;0;ON;;;;;N;;;;; +26FD;FUEL PUMP;So;0;ON;;;;;N;;;;; +26FE;CUP ON BLACK SQUARE;So;0;ON;;;;;N;;;;; +26FF;WHITE FLAG WITH HORIZONTAL MIDDLE BLACK STRIPE;So;0;ON;;;;;N;;;;; +2700;BLACK SAFETY SCISSORS;So;0;ON;;;;;N;;;;; +2701;UPPER BLADE SCISSORS;So;0;ON;;;;;N;;;;; +2702;BLACK SCISSORS;So;0;ON;;;;;N;;;;; +2703;LOWER BLADE SCISSORS;So;0;ON;;;;;N;;;;; +2704;WHITE SCISSORS;So;0;ON;;;;;N;;;;; +2705;WHITE HEAVY CHECK MARK;So;0;ON;;;;;N;;;;; +2706;TELEPHONE LOCATION SIGN;So;0;ON;;;;;N;;;;; +2707;TAPE DRIVE;So;0;ON;;;;;N;;;;; +2708;AIRPLANE;So;0;ON;;;;;N;;;;; +2709;ENVELOPE;So;0;ON;;;;;N;;;;; +270A;RAISED FIST;So;0;ON;;;;;N;;;;; +270B;RAISED HAND;So;0;ON;;;;;N;;;;; +270C;VICTORY HAND;So;0;ON;;;;;N;;;;; +270D;WRITING HAND;So;0;ON;;;;;N;;;;; +270E;LOWER RIGHT PENCIL;So;0;ON;;;;;N;;;;; +270F;PENCIL;So;0;ON;;;;;N;;;;; +2710;UPPER RIGHT PENCIL;So;0;ON;;;;;N;;;;; +2711;WHITE NIB;So;0;ON;;;;;N;;;;; +2712;BLACK NIB;So;0;ON;;;;;N;;;;; +2713;CHECK MARK;So;0;ON;;;;;N;;;;; +2714;HEAVY CHECK MARK;So;0;ON;;;;;N;;;;; +2715;MULTIPLICATION X;So;0;ON;;;;;N;;;;; +2716;HEAVY MULTIPLICATION X;So;0;ON;;;;;N;;;;; +2717;BALLOT X;So;0;ON;;;;;N;;;;; +2718;HEAVY BALLOT X;So;0;ON;;;;;N;;;;; +2719;OUTLINED GREEK CROSS;So;0;ON;;;;;N;;;;; +271A;HEAVY GREEK CROSS;So;0;ON;;;;;N;;;;; +271B;OPEN CENTRE CROSS;So;0;ON;;;;;N;OPEN CENTER CROSS;;;; +271C;HEAVY OPEN CENTRE CROSS;So;0;ON;;;;;N;HEAVY OPEN CENTER CROSS;;;; +271D;LATIN CROSS;So;0;ON;;;;;N;;;;; +271E;SHADOWED WHITE LATIN CROSS;So;0;ON;;;;;N;;;;; +271F;OUTLINED LATIN CROSS;So;0;ON;;;;;N;;;;; +2720;MALTESE CROSS;So;0;ON;;;;;N;;;;; +2721;STAR OF DAVID;So;0;ON;;;;;N;;;;; +2722;FOUR TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +2723;FOUR BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +2724;HEAVY FOUR BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +2725;FOUR CLUB-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +2726;BLACK FOUR POINTED STAR;So;0;ON;;;;;N;;;;; +2727;WHITE FOUR POINTED STAR;So;0;ON;;;;;N;;;;; +2728;SPARKLES;So;0;ON;;;;;N;;;;; +2729;STRESS OUTLINED WHITE STAR;So;0;ON;;;;;N;;;;; +272A;CIRCLED WHITE STAR;So;0;ON;;;;;N;;;;; +272B;OPEN CENTRE BLACK STAR;So;0;ON;;;;;N;OPEN CENTER BLACK STAR;;;; +272C;BLACK CENTRE WHITE STAR;So;0;ON;;;;;N;BLACK CENTER WHITE STAR;;;; +272D;OUTLINED BLACK STAR;So;0;ON;;;;;N;;;;; +272E;HEAVY OUTLINED BLACK STAR;So;0;ON;;;;;N;;;;; +272F;PINWHEEL STAR;So;0;ON;;;;;N;;;;; +2730;SHADOWED WHITE STAR;So;0;ON;;;;;N;;;;; +2731;HEAVY ASTERISK;So;0;ON;;;;;N;;;;; +2732;OPEN CENTRE ASTERISK;So;0;ON;;;;;N;OPEN CENTER ASTERISK;;;; +2733;EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +2734;EIGHT POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +2735;EIGHT POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +2736;SIX POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +2737;EIGHT POINTED RECTILINEAR BLACK STAR;So;0;ON;;;;;N;;;;; +2738;HEAVY EIGHT POINTED RECTILINEAR BLACK STAR;So;0;ON;;;;;N;;;;; +2739;TWELVE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +273A;SIXTEEN POINTED ASTERISK;So;0;ON;;;;;N;;;;; +273B;TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +273C;OPEN CENTRE TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;OPEN CENTER TEARDROP-SPOKED ASTERISK;;;; +273D;HEAVY TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +273E;SIX PETALLED BLACK AND WHITE FLORETTE;So;0;ON;;;;;N;;;;; +273F;BLACK FLORETTE;So;0;ON;;;;;N;;;;; +2740;WHITE FLORETTE;So;0;ON;;;;;N;;;;; +2741;EIGHT PETALLED OUTLINED BLACK FLORETTE;So;0;ON;;;;;N;;;;; +2742;CIRCLED OPEN CENTRE EIGHT POINTED STAR;So;0;ON;;;;;N;CIRCLED OPEN CENTER EIGHT POINTED STAR;;;; +2743;HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK;So;0;ON;;;;;N;;;;; +2744;SNOWFLAKE;So;0;ON;;;;;N;;;;; +2745;TIGHT TRIFOLIATE SNOWFLAKE;So;0;ON;;;;;N;;;;; +2746;HEAVY CHEVRON SNOWFLAKE;So;0;ON;;;;;N;;;;; +2747;SPARKLE;So;0;ON;;;;;N;;;;; +2748;HEAVY SPARKLE;So;0;ON;;;;;N;;;;; +2749;BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +274A;EIGHT TEARDROP-SPOKED PROPELLER ASTERISK;So;0;ON;;;;;N;;;;; +274B;HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK;So;0;ON;;;;;N;;;;; +274C;CROSS MARK;So;0;ON;;;;;N;;;;; +274D;SHADOWED WHITE CIRCLE;So;0;ON;;;;;N;;;;; +274E;NEGATIVE SQUARED CROSS MARK;So;0;ON;;;;;N;;;;; +274F;LOWER RIGHT DROP-SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;; +2750;UPPER RIGHT DROP-SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;; +2751;LOWER RIGHT SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;; +2752;UPPER RIGHT SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;; +2753;BLACK QUESTION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2754;WHITE QUESTION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2755;WHITE EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2756;BLACK DIAMOND MINUS WHITE X;So;0;ON;;;;;N;;;;; +2757;HEAVY EXCLAMATION MARK SYMBOL;So;0;ON;;;;;N;;;;; +2758;LIGHT VERTICAL BAR;So;0;ON;;;;;N;;;;; +2759;MEDIUM VERTICAL BAR;So;0;ON;;;;;N;;;;; +275A;HEAVY VERTICAL BAR;So;0;ON;;;;;N;;;;; +275B;HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +275C;HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +275D;HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +275E;HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +275F;HEAVY LOW SINGLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2760;HEAVY LOW DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2761;CURVED STEM PARAGRAPH SIGN ORNAMENT;So;0;ON;;;;;N;;;;; +2762;HEAVY EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2763;HEAVY HEART EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +2764;HEAVY BLACK HEART;So;0;ON;;;;;N;;;;; +2765;ROTATED HEAVY BLACK HEART BULLET;So;0;ON;;;;;N;;;;; +2766;FLORAL HEART;So;0;ON;;;;;N;;;;; +2767;ROTATED FLORAL HEART BULLET;So;0;ON;;;;;N;;;;; +2768;MEDIUM LEFT PARENTHESIS ORNAMENT;Ps;0;ON;;;;;Y;;;;; +2769;MEDIUM RIGHT PARENTHESIS ORNAMENT;Pe;0;ON;;;;;Y;;;;; +276A;MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT;Ps;0;ON;;;;;Y;;;;; +276B;MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT;Pe;0;ON;;;;;Y;;;;; +276C;MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;; +276D;MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;; +276E;HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT;Ps;0;ON;;;;;Y;;;;; +276F;HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT;Pe;0;ON;;;;;Y;;;;; +2770;HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;; +2771;HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;; +2772;LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;; +2773;LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;; +2774;MEDIUM LEFT CURLY BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;; +2775;MEDIUM RIGHT CURLY BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;; +2776;DINGBAT NEGATIVE CIRCLED DIGIT ONE;No;0;ON;;;1;1;N;INVERSE CIRCLED DIGIT ONE;;;; +2777;DINGBAT NEGATIVE CIRCLED DIGIT TWO;No;0;ON;;;2;2;N;INVERSE CIRCLED DIGIT TWO;;;; +2778;DINGBAT NEGATIVE CIRCLED DIGIT THREE;No;0;ON;;;3;3;N;INVERSE CIRCLED DIGIT THREE;;;; +2779;DINGBAT NEGATIVE CIRCLED DIGIT FOUR;No;0;ON;;;4;4;N;INVERSE CIRCLED DIGIT FOUR;;;; +277A;DINGBAT NEGATIVE CIRCLED DIGIT FIVE;No;0;ON;;;5;5;N;INVERSE CIRCLED DIGIT FIVE;;;; +277B;DINGBAT NEGATIVE CIRCLED DIGIT SIX;No;0;ON;;;6;6;N;INVERSE CIRCLED DIGIT SIX;;;; +277C;DINGBAT NEGATIVE CIRCLED DIGIT SEVEN;No;0;ON;;;7;7;N;INVERSE CIRCLED DIGIT SEVEN;;;; +277D;DINGBAT NEGATIVE CIRCLED DIGIT EIGHT;No;0;ON;;;8;8;N;INVERSE CIRCLED DIGIT EIGHT;;;; +277E;DINGBAT NEGATIVE CIRCLED DIGIT NINE;No;0;ON;;;9;9;N;INVERSE CIRCLED DIGIT NINE;;;; +277F;DINGBAT NEGATIVE CIRCLED NUMBER TEN;No;0;ON;;;;10;N;INVERSE CIRCLED NUMBER TEN;;;; +2780;DINGBAT CIRCLED SANS-SERIF DIGIT ONE;No;0;ON;;;1;1;N;CIRCLED SANS-SERIF DIGIT ONE;;;; +2781;DINGBAT CIRCLED SANS-SERIF DIGIT TWO;No;0;ON;;;2;2;N;CIRCLED SANS-SERIF DIGIT TWO;;;; +2782;DINGBAT CIRCLED SANS-SERIF DIGIT THREE;No;0;ON;;;3;3;N;CIRCLED SANS-SERIF DIGIT THREE;;;; +2783;DINGBAT CIRCLED SANS-SERIF DIGIT FOUR;No;0;ON;;;4;4;N;CIRCLED SANS-SERIF DIGIT FOUR;;;; +2784;DINGBAT CIRCLED SANS-SERIF DIGIT FIVE;No;0;ON;;;5;5;N;CIRCLED SANS-SERIF DIGIT FIVE;;;; +2785;DINGBAT CIRCLED SANS-SERIF DIGIT SIX;No;0;ON;;;6;6;N;CIRCLED SANS-SERIF DIGIT SIX;;;; +2786;DINGBAT CIRCLED SANS-SERIF DIGIT SEVEN;No;0;ON;;;7;7;N;CIRCLED SANS-SERIF DIGIT SEVEN;;;; +2787;DINGBAT CIRCLED SANS-SERIF DIGIT EIGHT;No;0;ON;;;8;8;N;CIRCLED SANS-SERIF DIGIT EIGHT;;;; +2788;DINGBAT CIRCLED SANS-SERIF DIGIT NINE;No;0;ON;;;9;9;N;CIRCLED SANS-SERIF DIGIT NINE;;;; +2789;DINGBAT CIRCLED SANS-SERIF NUMBER TEN;No;0;ON;;;;10;N;CIRCLED SANS-SERIF NUMBER TEN;;;; +278A;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE;No;0;ON;;;1;1;N;INVERSE CIRCLED SANS-SERIF DIGIT ONE;;;; +278B;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO;No;0;ON;;;2;2;N;INVERSE CIRCLED SANS-SERIF DIGIT TWO;;;; +278C;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE;No;0;ON;;;3;3;N;INVERSE CIRCLED SANS-SERIF DIGIT THREE;;;; +278D;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR;No;0;ON;;;4;4;N;INVERSE CIRCLED SANS-SERIF DIGIT FOUR;;;; +278E;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE;No;0;ON;;;5;5;N;INVERSE CIRCLED SANS-SERIF DIGIT FIVE;;;; +278F;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX;No;0;ON;;;6;6;N;INVERSE CIRCLED SANS-SERIF DIGIT SIX;;;; +2790;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN;No;0;ON;;;7;7;N;INVERSE CIRCLED SANS-SERIF DIGIT SEVEN;;;; +2791;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT;No;0;ON;;;8;8;N;INVERSE CIRCLED SANS-SERIF DIGIT EIGHT;;;; +2792;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE;No;0;ON;;;9;9;N;INVERSE CIRCLED SANS-SERIF DIGIT NINE;;;; +2793;DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN;No;0;ON;;;;10;N;INVERSE CIRCLED SANS-SERIF NUMBER TEN;;;; +2794;HEAVY WIDE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY WIDE-HEADED RIGHT ARROW;;;; +2795;HEAVY PLUS SIGN;So;0;ON;;;;;N;;;;; +2796;HEAVY MINUS SIGN;So;0;ON;;;;;N;;;;; +2797;HEAVY DIVISION SIGN;So;0;ON;;;;;N;;;;; +2798;HEAVY SOUTH EAST ARROW;So;0;ON;;;;;N;HEAVY LOWER RIGHT ARROW;;;; +2799;HEAVY RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY RIGHT ARROW;;;; +279A;HEAVY NORTH EAST ARROW;So;0;ON;;;;;N;HEAVY UPPER RIGHT ARROW;;;; +279B;DRAFTING POINT RIGHTWARDS ARROW;So;0;ON;;;;;N;DRAFTING POINT RIGHT ARROW;;;; +279C;HEAVY ROUND-TIPPED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY ROUND-TIPPED RIGHT ARROW;;;; +279D;TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;TRIANGLE-HEADED RIGHT ARROW;;;; +279E;HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY TRIANGLE-HEADED RIGHT ARROW;;;; +279F;DASHED TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;DASHED TRIANGLE-HEADED RIGHT ARROW;;;; +27A0;HEAVY DASHED TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY DASHED TRIANGLE-HEADED RIGHT ARROW;;;; +27A1;BLACK RIGHTWARDS ARROW;So;0;ON;;;;;N;BLACK RIGHT ARROW;;;; +27A2;THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD;So;0;ON;;;;;N;THREE-D TOP-LIGHTED RIGHT ARROWHEAD;;;; +27A3;THREE-D BOTTOM-LIGHTED RIGHTWARDS ARROWHEAD;So;0;ON;;;;;N;THREE-D BOTTOM-LIGHTED RIGHT ARROWHEAD;;;; +27A4;BLACK RIGHTWARDS ARROWHEAD;So;0;ON;;;;;N;BLACK RIGHT ARROWHEAD;;;; +27A5;HEAVY BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY BLACK CURVED DOWN AND RIGHT ARROW;;;; +27A6;HEAVY BLACK CURVED UPWARDS AND RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY BLACK CURVED UP AND RIGHT ARROW;;;; +27A7;SQUAT BLACK RIGHTWARDS ARROW;So;0;ON;;;;;N;SQUAT BLACK RIGHT ARROW;;;; +27A8;HEAVY CONCAVE-POINTED BLACK RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY CONCAVE-POINTED BLACK RIGHT ARROW;;;; +27A9;RIGHT-SHADED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;RIGHT-SHADED WHITE RIGHT ARROW;;;; +27AA;LEFT-SHADED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;LEFT-SHADED WHITE RIGHT ARROW;;;; +27AB;BACK-TILTED SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;BACK-TILTED SHADOWED WHITE RIGHT ARROW;;;; +27AC;FRONT-TILTED SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;FRONT-TILTED SHADOWED WHITE RIGHT ARROW;;;; +27AD;HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY LOWER RIGHT-SHADOWED WHITE RIGHT ARROW;;;; +27AE;HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY UPPER RIGHT-SHADOWED WHITE RIGHT ARROW;;;; +27AF;NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHT ARROW;;;; +27B0;CURLY LOOP;So;0;ON;;;;;N;;;;; +27B1;NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHT ARROW;;;; +27B2;CIRCLED HEAVY WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;CIRCLED HEAVY WHITE RIGHT ARROW;;;; +27B3;WHITE-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;WHITE-FEATHERED RIGHT ARROW;;;; +27B4;BLACK-FEATHERED SOUTH EAST ARROW;So;0;ON;;;;;N;BLACK-FEATHERED LOWER RIGHT ARROW;;;; +27B5;BLACK-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;BLACK-FEATHERED RIGHT ARROW;;;; +27B6;BLACK-FEATHERED NORTH EAST ARROW;So;0;ON;;;;;N;BLACK-FEATHERED UPPER RIGHT ARROW;;;; +27B7;HEAVY BLACK-FEATHERED SOUTH EAST ARROW;So;0;ON;;;;;N;HEAVY BLACK-FEATHERED LOWER RIGHT ARROW;;;; +27B8;HEAVY BLACK-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY BLACK-FEATHERED RIGHT ARROW;;;; +27B9;HEAVY BLACK-FEATHERED NORTH EAST ARROW;So;0;ON;;;;;N;HEAVY BLACK-FEATHERED UPPER RIGHT ARROW;;;; +27BA;TEARDROP-BARBED RIGHTWARDS ARROW;So;0;ON;;;;;N;TEARDROP-BARBED RIGHT ARROW;;;; +27BB;HEAVY TEARDROP-SHANKED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY TEARDROP-SHANKED RIGHT ARROW;;;; +27BC;WEDGE-TAILED RIGHTWARDS ARROW;So;0;ON;;;;;N;WEDGE-TAILED RIGHT ARROW;;;; +27BD;HEAVY WEDGE-TAILED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY WEDGE-TAILED RIGHT ARROW;;;; +27BE;OPEN-OUTLINED RIGHTWARDS ARROW;So;0;ON;;;;;N;OPEN-OUTLINED RIGHT ARROW;;;; +27BF;DOUBLE CURLY LOOP;So;0;ON;;;;;N;;;;; +27C0;THREE DIMENSIONAL ANGLE;Sm;0;ON;;;;;Y;;;;; +27C1;WHITE TRIANGLE CONTAINING SMALL WHITE TRIANGLE;Sm;0;ON;;;;;N;;;;; +27C2;PERPENDICULAR;Sm;0;ON;;;;;N;;;;; +27C3;OPEN SUBSET;Sm;0;ON;;;;;Y;;;;; +27C4;OPEN SUPERSET;Sm;0;ON;;;;;Y;;;;; +27C5;LEFT S-SHAPED BAG DELIMITER;Ps;0;ON;;;;;Y;;;;; +27C6;RIGHT S-SHAPED BAG DELIMITER;Pe;0;ON;;;;;Y;;;;; +27C7;OR WITH DOT INSIDE;Sm;0;ON;;;;;N;;;;; +27C8;REVERSE SOLIDUS PRECEDING SUBSET;Sm;0;ON;;;;;Y;;;;; +27C9;SUPERSET PRECEDING SOLIDUS;Sm;0;ON;;;;;Y;;;;; +27CA;VERTICAL BAR WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;; +27CB;MATHEMATICAL RISING DIAGONAL;Sm;0;ON;;;;;Y;;;;; +27CC;LONG DIVISION;Sm;0;ON;;;;;Y;;;;; +27CD;MATHEMATICAL FALLING DIAGONAL;Sm;0;ON;;;;;Y;;;;; +27CE;SQUARED LOGICAL AND;Sm;0;ON;;;;;N;;;;; +27CF;SQUARED LOGICAL OR;Sm;0;ON;;;;;N;;;;; +27D0;WHITE DIAMOND WITH CENTRED DOT;Sm;0;ON;;;;;N;;;;; +27D1;AND WITH DOT;Sm;0;ON;;;;;N;;;;; +27D2;ELEMENT OF OPENING UPWARDS;Sm;0;ON;;;;;N;;;;; +27D3;LOWER RIGHT CORNER WITH DOT;Sm;0;ON;;;;;Y;;;;; +27D4;UPPER LEFT CORNER WITH DOT;Sm;0;ON;;;;;Y;;;;; +27D5;LEFT OUTER JOIN;Sm;0;ON;;;;;Y;;;;; +27D6;RIGHT OUTER JOIN;Sm;0;ON;;;;;Y;;;;; +27D7;FULL OUTER JOIN;Sm;0;ON;;;;;N;;;;; +27D8;LARGE UP TACK;Sm;0;ON;;;;;N;;;;; +27D9;LARGE DOWN TACK;Sm;0;ON;;;;;N;;;;; +27DA;LEFT AND RIGHT DOUBLE TURNSTILE;Sm;0;ON;;;;;N;;;;; +27DB;LEFT AND RIGHT TACK;Sm;0;ON;;;;;N;;;;; +27DC;LEFT MULTIMAP;Sm;0;ON;;;;;Y;;;;; +27DD;LONG RIGHT TACK;Sm;0;ON;;;;;Y;;;;; +27DE;LONG LEFT TACK;Sm;0;ON;;;;;Y;;;;; +27DF;UP TACK WITH CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;; +27E0;LOZENGE DIVIDED BY HORIZONTAL RULE;Sm;0;ON;;;;;N;;;;; +27E1;WHITE CONCAVE-SIDED DIAMOND;Sm;0;ON;;;;;N;;;;; +27E2;WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK;Sm;0;ON;;;;;Y;;;;; +27E3;WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK;Sm;0;ON;;;;;Y;;;;; +27E4;WHITE SQUARE WITH LEFTWARDS TICK;Sm;0;ON;;;;;Y;;;;; +27E5;WHITE SQUARE WITH RIGHTWARDS TICK;Sm;0;ON;;;;;Y;;;;; +27E6;MATHEMATICAL LEFT WHITE SQUARE BRACKET;Ps;0;ON;;;;;Y;;;;; +27E7;MATHEMATICAL RIGHT WHITE SQUARE BRACKET;Pe;0;ON;;;;;Y;;;;; +27E8;MATHEMATICAL LEFT ANGLE BRACKET;Ps;0;ON;;;;;Y;;;;; +27E9;MATHEMATICAL RIGHT ANGLE BRACKET;Pe;0;ON;;;;;Y;;;;; +27EA;MATHEMATICAL LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;;;;;Y;;;;; +27EB;MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;;;;;Y;;;;; +27EC;MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;;;;; +27ED;MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;;;;; +27EE;MATHEMATICAL LEFT FLATTENED PARENTHESIS;Ps;0;ON;;;;;Y;;;;; +27EF;MATHEMATICAL RIGHT FLATTENED PARENTHESIS;Pe;0;ON;;;;;Y;;;;; +27F0;UPWARDS QUADRUPLE ARROW;Sm;0;ON;;;;;N;;;;; +27F1;DOWNWARDS QUADRUPLE ARROW;Sm;0;ON;;;;;N;;;;; +27F2;ANTICLOCKWISE GAPPED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;; +27F3;CLOCKWISE GAPPED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;; +27F4;RIGHT ARROW WITH CIRCLED PLUS;Sm;0;ON;;;;;N;;;;; +27F5;LONG LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +27F6;LONG RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +27F7;LONG LEFT RIGHT ARROW;Sm;0;ON;;;;;N;;;;; +27F8;LONG LEFTWARDS DOUBLE ARROW;Sm;0;ON;;;;;N;;;;; +27F9;LONG RIGHTWARDS DOUBLE ARROW;Sm;0;ON;;;;;N;;;;; +27FA;LONG LEFT RIGHT DOUBLE ARROW;Sm;0;ON;;;;;N;;;;; +27FB;LONG LEFTWARDS ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +27FC;LONG RIGHTWARDS ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +27FD;LONG LEFTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +27FE;LONG RIGHTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +27FF;LONG RIGHTWARDS SQUIGGLE ARROW;Sm;0;ON;;;;;N;;;;; +2800;BRAILLE PATTERN BLANK;So;0;L;;;;;N;;;;; +2801;BRAILLE PATTERN DOTS-1;So;0;L;;;;;N;;;;; +2802;BRAILLE PATTERN DOTS-2;So;0;L;;;;;N;;;;; +2803;BRAILLE PATTERN DOTS-12;So;0;L;;;;;N;;;;; +2804;BRAILLE PATTERN DOTS-3;So;0;L;;;;;N;;;;; +2805;BRAILLE PATTERN DOTS-13;So;0;L;;;;;N;;;;; +2806;BRAILLE PATTERN DOTS-23;So;0;L;;;;;N;;;;; +2807;BRAILLE PATTERN DOTS-123;So;0;L;;;;;N;;;;; +2808;BRAILLE PATTERN DOTS-4;So;0;L;;;;;N;;;;; +2809;BRAILLE PATTERN DOTS-14;So;0;L;;;;;N;;;;; +280A;BRAILLE PATTERN DOTS-24;So;0;L;;;;;N;;;;; +280B;BRAILLE PATTERN DOTS-124;So;0;L;;;;;N;;;;; +280C;BRAILLE PATTERN DOTS-34;So;0;L;;;;;N;;;;; +280D;BRAILLE PATTERN DOTS-134;So;0;L;;;;;N;;;;; +280E;BRAILLE PATTERN DOTS-234;So;0;L;;;;;N;;;;; +280F;BRAILLE PATTERN DOTS-1234;So;0;L;;;;;N;;;;; +2810;BRAILLE PATTERN DOTS-5;So;0;L;;;;;N;;;;; +2811;BRAILLE PATTERN DOTS-15;So;0;L;;;;;N;;;;; +2812;BRAILLE PATTERN DOTS-25;So;0;L;;;;;N;;;;; +2813;BRAILLE PATTERN DOTS-125;So;0;L;;;;;N;;;;; +2814;BRAILLE PATTERN DOTS-35;So;0;L;;;;;N;;;;; +2815;BRAILLE PATTERN DOTS-135;So;0;L;;;;;N;;;;; +2816;BRAILLE PATTERN DOTS-235;So;0;L;;;;;N;;;;; +2817;BRAILLE PATTERN DOTS-1235;So;0;L;;;;;N;;;;; +2818;BRAILLE PATTERN DOTS-45;So;0;L;;;;;N;;;;; +2819;BRAILLE PATTERN DOTS-145;So;0;L;;;;;N;;;;; +281A;BRAILLE PATTERN DOTS-245;So;0;L;;;;;N;;;;; +281B;BRAILLE PATTERN DOTS-1245;So;0;L;;;;;N;;;;; +281C;BRAILLE PATTERN DOTS-345;So;0;L;;;;;N;;;;; +281D;BRAILLE PATTERN DOTS-1345;So;0;L;;;;;N;;;;; +281E;BRAILLE PATTERN DOTS-2345;So;0;L;;;;;N;;;;; +281F;BRAILLE PATTERN DOTS-12345;So;0;L;;;;;N;;;;; +2820;BRAILLE PATTERN DOTS-6;So;0;L;;;;;N;;;;; +2821;BRAILLE PATTERN DOTS-16;So;0;L;;;;;N;;;;; +2822;BRAILLE PATTERN DOTS-26;So;0;L;;;;;N;;;;; +2823;BRAILLE PATTERN DOTS-126;So;0;L;;;;;N;;;;; +2824;BRAILLE PATTERN DOTS-36;So;0;L;;;;;N;;;;; +2825;BRAILLE PATTERN DOTS-136;So;0;L;;;;;N;;;;; +2826;BRAILLE PATTERN DOTS-236;So;0;L;;;;;N;;;;; +2827;BRAILLE PATTERN DOTS-1236;So;0;L;;;;;N;;;;; +2828;BRAILLE PATTERN DOTS-46;So;0;L;;;;;N;;;;; +2829;BRAILLE PATTERN DOTS-146;So;0;L;;;;;N;;;;; +282A;BRAILLE PATTERN DOTS-246;So;0;L;;;;;N;;;;; +282B;BRAILLE PATTERN DOTS-1246;So;0;L;;;;;N;;;;; +282C;BRAILLE PATTERN DOTS-346;So;0;L;;;;;N;;;;; +282D;BRAILLE PATTERN DOTS-1346;So;0;L;;;;;N;;;;; +282E;BRAILLE PATTERN DOTS-2346;So;0;L;;;;;N;;;;; +282F;BRAILLE PATTERN DOTS-12346;So;0;L;;;;;N;;;;; +2830;BRAILLE PATTERN DOTS-56;So;0;L;;;;;N;;;;; +2831;BRAILLE PATTERN DOTS-156;So;0;L;;;;;N;;;;; +2832;BRAILLE PATTERN DOTS-256;So;0;L;;;;;N;;;;; +2833;BRAILLE PATTERN DOTS-1256;So;0;L;;;;;N;;;;; +2834;BRAILLE PATTERN DOTS-356;So;0;L;;;;;N;;;;; +2835;BRAILLE PATTERN DOTS-1356;So;0;L;;;;;N;;;;; +2836;BRAILLE PATTERN DOTS-2356;So;0;L;;;;;N;;;;; +2837;BRAILLE PATTERN DOTS-12356;So;0;L;;;;;N;;;;; +2838;BRAILLE PATTERN DOTS-456;So;0;L;;;;;N;;;;; +2839;BRAILLE PATTERN DOTS-1456;So;0;L;;;;;N;;;;; +283A;BRAILLE PATTERN DOTS-2456;So;0;L;;;;;N;;;;; +283B;BRAILLE PATTERN DOTS-12456;So;0;L;;;;;N;;;;; +283C;BRAILLE PATTERN DOTS-3456;So;0;L;;;;;N;;;;; +283D;BRAILLE PATTERN DOTS-13456;So;0;L;;;;;N;;;;; +283E;BRAILLE PATTERN DOTS-23456;So;0;L;;;;;N;;;;; +283F;BRAILLE PATTERN DOTS-123456;So;0;L;;;;;N;;;;; +2840;BRAILLE PATTERN DOTS-7;So;0;L;;;;;N;;;;; +2841;BRAILLE PATTERN DOTS-17;So;0;L;;;;;N;;;;; +2842;BRAILLE PATTERN DOTS-27;So;0;L;;;;;N;;;;; +2843;BRAILLE PATTERN DOTS-127;So;0;L;;;;;N;;;;; +2844;BRAILLE PATTERN DOTS-37;So;0;L;;;;;N;;;;; +2845;BRAILLE PATTERN DOTS-137;So;0;L;;;;;N;;;;; +2846;BRAILLE PATTERN DOTS-237;So;0;L;;;;;N;;;;; +2847;BRAILLE PATTERN DOTS-1237;So;0;L;;;;;N;;;;; +2848;BRAILLE PATTERN DOTS-47;So;0;L;;;;;N;;;;; +2849;BRAILLE PATTERN DOTS-147;So;0;L;;;;;N;;;;; +284A;BRAILLE PATTERN DOTS-247;So;0;L;;;;;N;;;;; +284B;BRAILLE PATTERN DOTS-1247;So;0;L;;;;;N;;;;; +284C;BRAILLE PATTERN DOTS-347;So;0;L;;;;;N;;;;; +284D;BRAILLE PATTERN DOTS-1347;So;0;L;;;;;N;;;;; +284E;BRAILLE PATTERN DOTS-2347;So;0;L;;;;;N;;;;; +284F;BRAILLE PATTERN DOTS-12347;So;0;L;;;;;N;;;;; +2850;BRAILLE PATTERN DOTS-57;So;0;L;;;;;N;;;;; +2851;BRAILLE PATTERN DOTS-157;So;0;L;;;;;N;;;;; +2852;BRAILLE PATTERN DOTS-257;So;0;L;;;;;N;;;;; +2853;BRAILLE PATTERN DOTS-1257;So;0;L;;;;;N;;;;; +2854;BRAILLE PATTERN DOTS-357;So;0;L;;;;;N;;;;; +2855;BRAILLE PATTERN DOTS-1357;So;0;L;;;;;N;;;;; +2856;BRAILLE PATTERN DOTS-2357;So;0;L;;;;;N;;;;; +2857;BRAILLE PATTERN DOTS-12357;So;0;L;;;;;N;;;;; +2858;BRAILLE PATTERN DOTS-457;So;0;L;;;;;N;;;;; +2859;BRAILLE PATTERN DOTS-1457;So;0;L;;;;;N;;;;; +285A;BRAILLE PATTERN DOTS-2457;So;0;L;;;;;N;;;;; +285B;BRAILLE PATTERN DOTS-12457;So;0;L;;;;;N;;;;; +285C;BRAILLE PATTERN DOTS-3457;So;0;L;;;;;N;;;;; +285D;BRAILLE PATTERN DOTS-13457;So;0;L;;;;;N;;;;; +285E;BRAILLE PATTERN DOTS-23457;So;0;L;;;;;N;;;;; +285F;BRAILLE PATTERN DOTS-123457;So;0;L;;;;;N;;;;; +2860;BRAILLE PATTERN DOTS-67;So;0;L;;;;;N;;;;; +2861;BRAILLE PATTERN DOTS-167;So;0;L;;;;;N;;;;; +2862;BRAILLE PATTERN DOTS-267;So;0;L;;;;;N;;;;; +2863;BRAILLE PATTERN DOTS-1267;So;0;L;;;;;N;;;;; +2864;BRAILLE PATTERN DOTS-367;So;0;L;;;;;N;;;;; +2865;BRAILLE PATTERN DOTS-1367;So;0;L;;;;;N;;;;; +2866;BRAILLE PATTERN DOTS-2367;So;0;L;;;;;N;;;;; +2867;BRAILLE PATTERN DOTS-12367;So;0;L;;;;;N;;;;; +2868;BRAILLE PATTERN DOTS-467;So;0;L;;;;;N;;;;; +2869;BRAILLE PATTERN DOTS-1467;So;0;L;;;;;N;;;;; +286A;BRAILLE PATTERN DOTS-2467;So;0;L;;;;;N;;;;; +286B;BRAILLE PATTERN DOTS-12467;So;0;L;;;;;N;;;;; +286C;BRAILLE PATTERN DOTS-3467;So;0;L;;;;;N;;;;; +286D;BRAILLE PATTERN DOTS-13467;So;0;L;;;;;N;;;;; +286E;BRAILLE PATTERN DOTS-23467;So;0;L;;;;;N;;;;; +286F;BRAILLE PATTERN DOTS-123467;So;0;L;;;;;N;;;;; +2870;BRAILLE PATTERN DOTS-567;So;0;L;;;;;N;;;;; +2871;BRAILLE PATTERN DOTS-1567;So;0;L;;;;;N;;;;; +2872;BRAILLE PATTERN DOTS-2567;So;0;L;;;;;N;;;;; +2873;BRAILLE PATTERN DOTS-12567;So;0;L;;;;;N;;;;; +2874;BRAILLE PATTERN DOTS-3567;So;0;L;;;;;N;;;;; +2875;BRAILLE PATTERN DOTS-13567;So;0;L;;;;;N;;;;; +2876;BRAILLE PATTERN DOTS-23567;So;0;L;;;;;N;;;;; +2877;BRAILLE PATTERN DOTS-123567;So;0;L;;;;;N;;;;; +2878;BRAILLE PATTERN DOTS-4567;So;0;L;;;;;N;;;;; +2879;BRAILLE PATTERN DOTS-14567;So;0;L;;;;;N;;;;; +287A;BRAILLE PATTERN DOTS-24567;So;0;L;;;;;N;;;;; +287B;BRAILLE PATTERN DOTS-124567;So;0;L;;;;;N;;;;; +287C;BRAILLE PATTERN DOTS-34567;So;0;L;;;;;N;;;;; +287D;BRAILLE PATTERN DOTS-134567;So;0;L;;;;;N;;;;; +287E;BRAILLE PATTERN DOTS-234567;So;0;L;;;;;N;;;;; +287F;BRAILLE PATTERN DOTS-1234567;So;0;L;;;;;N;;;;; +2880;BRAILLE PATTERN DOTS-8;So;0;L;;;;;N;;;;; +2881;BRAILLE PATTERN DOTS-18;So;0;L;;;;;N;;;;; +2882;BRAILLE PATTERN DOTS-28;So;0;L;;;;;N;;;;; +2883;BRAILLE PATTERN DOTS-128;So;0;L;;;;;N;;;;; +2884;BRAILLE PATTERN DOTS-38;So;0;L;;;;;N;;;;; +2885;BRAILLE PATTERN DOTS-138;So;0;L;;;;;N;;;;; +2886;BRAILLE PATTERN DOTS-238;So;0;L;;;;;N;;;;; +2887;BRAILLE PATTERN DOTS-1238;So;0;L;;;;;N;;;;; +2888;BRAILLE PATTERN DOTS-48;So;0;L;;;;;N;;;;; +2889;BRAILLE PATTERN DOTS-148;So;0;L;;;;;N;;;;; +288A;BRAILLE PATTERN DOTS-248;So;0;L;;;;;N;;;;; +288B;BRAILLE PATTERN DOTS-1248;So;0;L;;;;;N;;;;; +288C;BRAILLE PATTERN DOTS-348;So;0;L;;;;;N;;;;; +288D;BRAILLE PATTERN DOTS-1348;So;0;L;;;;;N;;;;; +288E;BRAILLE PATTERN DOTS-2348;So;0;L;;;;;N;;;;; +288F;BRAILLE PATTERN DOTS-12348;So;0;L;;;;;N;;;;; +2890;BRAILLE PATTERN DOTS-58;So;0;L;;;;;N;;;;; +2891;BRAILLE PATTERN DOTS-158;So;0;L;;;;;N;;;;; +2892;BRAILLE PATTERN DOTS-258;So;0;L;;;;;N;;;;; +2893;BRAILLE PATTERN DOTS-1258;So;0;L;;;;;N;;;;; +2894;BRAILLE PATTERN DOTS-358;So;0;L;;;;;N;;;;; +2895;BRAILLE PATTERN DOTS-1358;So;0;L;;;;;N;;;;; +2896;BRAILLE PATTERN DOTS-2358;So;0;L;;;;;N;;;;; +2897;BRAILLE PATTERN DOTS-12358;So;0;L;;;;;N;;;;; +2898;BRAILLE PATTERN DOTS-458;So;0;L;;;;;N;;;;; +2899;BRAILLE PATTERN DOTS-1458;So;0;L;;;;;N;;;;; +289A;BRAILLE PATTERN DOTS-2458;So;0;L;;;;;N;;;;; +289B;BRAILLE PATTERN DOTS-12458;So;0;L;;;;;N;;;;; +289C;BRAILLE PATTERN DOTS-3458;So;0;L;;;;;N;;;;; +289D;BRAILLE PATTERN DOTS-13458;So;0;L;;;;;N;;;;; +289E;BRAILLE PATTERN DOTS-23458;So;0;L;;;;;N;;;;; +289F;BRAILLE PATTERN DOTS-123458;So;0;L;;;;;N;;;;; +28A0;BRAILLE PATTERN DOTS-68;So;0;L;;;;;N;;;;; +28A1;BRAILLE PATTERN DOTS-168;So;0;L;;;;;N;;;;; +28A2;BRAILLE PATTERN DOTS-268;So;0;L;;;;;N;;;;; +28A3;BRAILLE PATTERN DOTS-1268;So;0;L;;;;;N;;;;; +28A4;BRAILLE PATTERN DOTS-368;So;0;L;;;;;N;;;;; +28A5;BRAILLE PATTERN DOTS-1368;So;0;L;;;;;N;;;;; +28A6;BRAILLE PATTERN DOTS-2368;So;0;L;;;;;N;;;;; +28A7;BRAILLE PATTERN DOTS-12368;So;0;L;;;;;N;;;;; +28A8;BRAILLE PATTERN DOTS-468;So;0;L;;;;;N;;;;; +28A9;BRAILLE PATTERN DOTS-1468;So;0;L;;;;;N;;;;; +28AA;BRAILLE PATTERN DOTS-2468;So;0;L;;;;;N;;;;; +28AB;BRAILLE PATTERN DOTS-12468;So;0;L;;;;;N;;;;; +28AC;BRAILLE PATTERN DOTS-3468;So;0;L;;;;;N;;;;; +28AD;BRAILLE PATTERN DOTS-13468;So;0;L;;;;;N;;;;; +28AE;BRAILLE PATTERN DOTS-23468;So;0;L;;;;;N;;;;; +28AF;BRAILLE PATTERN DOTS-123468;So;0;L;;;;;N;;;;; +28B0;BRAILLE PATTERN DOTS-568;So;0;L;;;;;N;;;;; +28B1;BRAILLE PATTERN DOTS-1568;So;0;L;;;;;N;;;;; +28B2;BRAILLE PATTERN DOTS-2568;So;0;L;;;;;N;;;;; +28B3;BRAILLE PATTERN DOTS-12568;So;0;L;;;;;N;;;;; +28B4;BRAILLE PATTERN DOTS-3568;So;0;L;;;;;N;;;;; +28B5;BRAILLE PATTERN DOTS-13568;So;0;L;;;;;N;;;;; +28B6;BRAILLE PATTERN DOTS-23568;So;0;L;;;;;N;;;;; +28B7;BRAILLE PATTERN DOTS-123568;So;0;L;;;;;N;;;;; +28B8;BRAILLE PATTERN DOTS-4568;So;0;L;;;;;N;;;;; +28B9;BRAILLE PATTERN DOTS-14568;So;0;L;;;;;N;;;;; +28BA;BRAILLE PATTERN DOTS-24568;So;0;L;;;;;N;;;;; +28BB;BRAILLE PATTERN DOTS-124568;So;0;L;;;;;N;;;;; +28BC;BRAILLE PATTERN DOTS-34568;So;0;L;;;;;N;;;;; +28BD;BRAILLE PATTERN DOTS-134568;So;0;L;;;;;N;;;;; +28BE;BRAILLE PATTERN DOTS-234568;So;0;L;;;;;N;;;;; +28BF;BRAILLE PATTERN DOTS-1234568;So;0;L;;;;;N;;;;; +28C0;BRAILLE PATTERN DOTS-78;So;0;L;;;;;N;;;;; +28C1;BRAILLE PATTERN DOTS-178;So;0;L;;;;;N;;;;; +28C2;BRAILLE PATTERN DOTS-278;So;0;L;;;;;N;;;;; +28C3;BRAILLE PATTERN DOTS-1278;So;0;L;;;;;N;;;;; +28C4;BRAILLE PATTERN DOTS-378;So;0;L;;;;;N;;;;; +28C5;BRAILLE PATTERN DOTS-1378;So;0;L;;;;;N;;;;; +28C6;BRAILLE PATTERN DOTS-2378;So;0;L;;;;;N;;;;; +28C7;BRAILLE PATTERN DOTS-12378;So;0;L;;;;;N;;;;; +28C8;BRAILLE PATTERN DOTS-478;So;0;L;;;;;N;;;;; +28C9;BRAILLE PATTERN DOTS-1478;So;0;L;;;;;N;;;;; +28CA;BRAILLE PATTERN DOTS-2478;So;0;L;;;;;N;;;;; +28CB;BRAILLE PATTERN DOTS-12478;So;0;L;;;;;N;;;;; +28CC;BRAILLE PATTERN DOTS-3478;So;0;L;;;;;N;;;;; +28CD;BRAILLE PATTERN DOTS-13478;So;0;L;;;;;N;;;;; +28CE;BRAILLE PATTERN DOTS-23478;So;0;L;;;;;N;;;;; +28CF;BRAILLE PATTERN DOTS-123478;So;0;L;;;;;N;;;;; +28D0;BRAILLE PATTERN DOTS-578;So;0;L;;;;;N;;;;; +28D1;BRAILLE PATTERN DOTS-1578;So;0;L;;;;;N;;;;; +28D2;BRAILLE PATTERN DOTS-2578;So;0;L;;;;;N;;;;; +28D3;BRAILLE PATTERN DOTS-12578;So;0;L;;;;;N;;;;; +28D4;BRAILLE PATTERN DOTS-3578;So;0;L;;;;;N;;;;; +28D5;BRAILLE PATTERN DOTS-13578;So;0;L;;;;;N;;;;; +28D6;BRAILLE PATTERN DOTS-23578;So;0;L;;;;;N;;;;; +28D7;BRAILLE PATTERN DOTS-123578;So;0;L;;;;;N;;;;; +28D8;BRAILLE PATTERN DOTS-4578;So;0;L;;;;;N;;;;; +28D9;BRAILLE PATTERN DOTS-14578;So;0;L;;;;;N;;;;; +28DA;BRAILLE PATTERN DOTS-24578;So;0;L;;;;;N;;;;; +28DB;BRAILLE PATTERN DOTS-124578;So;0;L;;;;;N;;;;; +28DC;BRAILLE PATTERN DOTS-34578;So;0;L;;;;;N;;;;; +28DD;BRAILLE PATTERN DOTS-134578;So;0;L;;;;;N;;;;; +28DE;BRAILLE PATTERN DOTS-234578;So;0;L;;;;;N;;;;; +28DF;BRAILLE PATTERN DOTS-1234578;So;0;L;;;;;N;;;;; +28E0;BRAILLE PATTERN DOTS-678;So;0;L;;;;;N;;;;; +28E1;BRAILLE PATTERN DOTS-1678;So;0;L;;;;;N;;;;; +28E2;BRAILLE PATTERN DOTS-2678;So;0;L;;;;;N;;;;; +28E3;BRAILLE PATTERN DOTS-12678;So;0;L;;;;;N;;;;; +28E4;BRAILLE PATTERN DOTS-3678;So;0;L;;;;;N;;;;; +28E5;BRAILLE PATTERN DOTS-13678;So;0;L;;;;;N;;;;; +28E6;BRAILLE PATTERN DOTS-23678;So;0;L;;;;;N;;;;; +28E7;BRAILLE PATTERN DOTS-123678;So;0;L;;;;;N;;;;; +28E8;BRAILLE PATTERN DOTS-4678;So;0;L;;;;;N;;;;; +28E9;BRAILLE PATTERN DOTS-14678;So;0;L;;;;;N;;;;; +28EA;BRAILLE PATTERN DOTS-24678;So;0;L;;;;;N;;;;; +28EB;BRAILLE PATTERN DOTS-124678;So;0;L;;;;;N;;;;; +28EC;BRAILLE PATTERN DOTS-34678;So;0;L;;;;;N;;;;; +28ED;BRAILLE PATTERN DOTS-134678;So;0;L;;;;;N;;;;; +28EE;BRAILLE PATTERN DOTS-234678;So;0;L;;;;;N;;;;; +28EF;BRAILLE PATTERN DOTS-1234678;So;0;L;;;;;N;;;;; +28F0;BRAILLE PATTERN DOTS-5678;So;0;L;;;;;N;;;;; +28F1;BRAILLE PATTERN DOTS-15678;So;0;L;;;;;N;;;;; +28F2;BRAILLE PATTERN DOTS-25678;So;0;L;;;;;N;;;;; +28F3;BRAILLE PATTERN DOTS-125678;So;0;L;;;;;N;;;;; +28F4;BRAILLE PATTERN DOTS-35678;So;0;L;;;;;N;;;;; +28F5;BRAILLE PATTERN DOTS-135678;So;0;L;;;;;N;;;;; +28F6;BRAILLE PATTERN DOTS-235678;So;0;L;;;;;N;;;;; +28F7;BRAILLE PATTERN DOTS-1235678;So;0;L;;;;;N;;;;; +28F8;BRAILLE PATTERN DOTS-45678;So;0;L;;;;;N;;;;; +28F9;BRAILLE PATTERN DOTS-145678;So;0;L;;;;;N;;;;; +28FA;BRAILLE PATTERN DOTS-245678;So;0;L;;;;;N;;;;; +28FB;BRAILLE PATTERN DOTS-1245678;So;0;L;;;;;N;;;;; +28FC;BRAILLE PATTERN DOTS-345678;So;0;L;;;;;N;;;;; +28FD;BRAILLE PATTERN DOTS-1345678;So;0;L;;;;;N;;;;; +28FE;BRAILLE PATTERN DOTS-2345678;So;0;L;;;;;N;;;;; +28FF;BRAILLE PATTERN DOTS-12345678;So;0;L;;;;;N;;;;; +2900;RIGHTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2901;RIGHTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2902;LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2903;RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2904;LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2905;RIGHTWARDS TWO-HEADED ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +2906;LEFTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +2907;RIGHTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +2908;DOWNWARDS ARROW WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;; +2909;UPWARDS ARROW WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;; +290A;UPWARDS TRIPLE ARROW;Sm;0;ON;;;;;N;;;;; +290B;DOWNWARDS TRIPLE ARROW;Sm;0;ON;;;;;N;;;;; +290C;LEFTWARDS DOUBLE DASH ARROW;Sm;0;ON;;;;;N;;;;; +290D;RIGHTWARDS DOUBLE DASH ARROW;Sm;0;ON;;;;;N;;;;; +290E;LEFTWARDS TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;; +290F;RIGHTWARDS TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;; +2910;RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;; +2911;RIGHTWARDS ARROW WITH DOTTED STEM;Sm;0;ON;;;;;N;;;;; +2912;UPWARDS ARROW TO BAR;Sm;0;ON;;;;;N;;;;; +2913;DOWNWARDS ARROW TO BAR;Sm;0;ON;;;;;N;;;;; +2914;RIGHTWARDS ARROW WITH TAIL WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2915;RIGHTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2916;RIGHTWARDS TWO-HEADED ARROW WITH TAIL;Sm;0;ON;;;;;N;;;;; +2917;RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2918;RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2919;LEFTWARDS ARROW-TAIL;Sm;0;ON;;;;;N;;;;; +291A;RIGHTWARDS ARROW-TAIL;Sm;0;ON;;;;;N;;;;; +291B;LEFTWARDS DOUBLE ARROW-TAIL;Sm;0;ON;;;;;N;;;;; +291C;RIGHTWARDS DOUBLE ARROW-TAIL;Sm;0;ON;;;;;N;;;;; +291D;LEFTWARDS ARROW TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;; +291E;RIGHTWARDS ARROW TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;; +291F;LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;; +2920;RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;; +2921;NORTH WEST AND SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +2922;NORTH EAST AND SOUTH WEST ARROW;Sm;0;ON;;;;;N;;;;; +2923;NORTH WEST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;; +2924;NORTH EAST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;; +2925;SOUTH EAST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;; +2926;SOUTH WEST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;; +2927;NORTH WEST ARROW AND NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +2928;NORTH EAST ARROW AND SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +2929;SOUTH EAST ARROW AND SOUTH WEST ARROW;Sm;0;ON;;;;;N;;;;; +292A;SOUTH WEST ARROW AND NORTH WEST ARROW;Sm;0;ON;;;;;N;;;;; +292B;RISING DIAGONAL CROSSING FALLING DIAGONAL;Sm;0;ON;;;;;N;;;;; +292C;FALLING DIAGONAL CROSSING RISING DIAGONAL;Sm;0;ON;;;;;N;;;;; +292D;SOUTH EAST ARROW CROSSING NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +292E;NORTH EAST ARROW CROSSING SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +292F;FALLING DIAGONAL CROSSING NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +2930;RISING DIAGONAL CROSSING SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +2931;NORTH EAST ARROW CROSSING NORTH WEST ARROW;Sm;0;ON;;;;;N;;;;; +2932;NORTH WEST ARROW CROSSING NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;; +2933;WAVE ARROW POINTING DIRECTLY RIGHT;Sm;0;ON;;;;;N;;;;; +2934;ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS;Sm;0;ON;;;;;N;;;;; +2935;ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS;Sm;0;ON;;;;;N;;;;; +2936;ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS;Sm;0;ON;;;;;N;;;;; +2937;ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS;Sm;0;ON;;;;;N;;;;; +2938;RIGHT-SIDE ARC CLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;; +2939;LEFT-SIDE ARC ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;; +293A;TOP ARC ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;; +293B;BOTTOM ARC ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;; +293C;TOP ARC CLOCKWISE ARROW WITH MINUS;Sm;0;ON;;;;;N;;;;; +293D;TOP ARC ANTICLOCKWISE ARROW WITH PLUS;Sm;0;ON;;;;;N;;;;; +293E;LOWER RIGHT SEMICIRCULAR CLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;; +293F;LOWER LEFT SEMICIRCULAR ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;; +2940;ANTICLOCKWISE CLOSED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;; +2941;CLOCKWISE CLOSED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;; +2942;RIGHTWARDS ARROW ABOVE SHORT LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2943;LEFTWARDS ARROW ABOVE SHORT RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2944;SHORT RIGHTWARDS ARROW ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2945;RIGHTWARDS ARROW WITH PLUS BELOW;Sm;0;ON;;;;;N;;;;; +2946;LEFTWARDS ARROW WITH PLUS BELOW;Sm;0;ON;;;;;N;;;;; +2947;RIGHTWARDS ARROW THROUGH X;Sm;0;ON;;;;;N;;;;; +2948;LEFT RIGHT ARROW THROUGH SMALL CIRCLE;Sm;0;ON;;;;;N;;;;; +2949;UPWARDS TWO-HEADED ARROW FROM SMALL CIRCLE;Sm;0;ON;;;;;N;;;;; +294A;LEFT BARB UP RIGHT BARB DOWN HARPOON;Sm;0;ON;;;;;N;;;;; +294B;LEFT BARB DOWN RIGHT BARB UP HARPOON;Sm;0;ON;;;;;N;;;;; +294C;UP BARB RIGHT DOWN BARB LEFT HARPOON;Sm;0;ON;;;;;N;;;;; +294D;UP BARB LEFT DOWN BARB RIGHT HARPOON;Sm;0;ON;;;;;N;;;;; +294E;LEFT BARB UP RIGHT BARB UP HARPOON;Sm;0;ON;;;;;N;;;;; +294F;UP BARB RIGHT DOWN BARB RIGHT HARPOON;Sm;0;ON;;;;;N;;;;; +2950;LEFT BARB DOWN RIGHT BARB DOWN HARPOON;Sm;0;ON;;;;;N;;;;; +2951;UP BARB LEFT DOWN BARB LEFT HARPOON;Sm;0;ON;;;;;N;;;;; +2952;LEFTWARDS HARPOON WITH BARB UP TO BAR;Sm;0;ON;;;;;N;;;;; +2953;RIGHTWARDS HARPOON WITH BARB UP TO BAR;Sm;0;ON;;;;;N;;;;; +2954;UPWARDS HARPOON WITH BARB RIGHT TO BAR;Sm;0;ON;;;;;N;;;;; +2955;DOWNWARDS HARPOON WITH BARB RIGHT TO BAR;Sm;0;ON;;;;;N;;;;; +2956;LEFTWARDS HARPOON WITH BARB DOWN TO BAR;Sm;0;ON;;;;;N;;;;; +2957;RIGHTWARDS HARPOON WITH BARB DOWN TO BAR;Sm;0;ON;;;;;N;;;;; +2958;UPWARDS HARPOON WITH BARB LEFT TO BAR;Sm;0;ON;;;;;N;;;;; +2959;DOWNWARDS HARPOON WITH BARB LEFT TO BAR;Sm;0;ON;;;;;N;;;;; +295A;LEFTWARDS HARPOON WITH BARB UP FROM BAR;Sm;0;ON;;;;;N;;;;; +295B;RIGHTWARDS HARPOON WITH BARB UP FROM BAR;Sm;0;ON;;;;;N;;;;; +295C;UPWARDS HARPOON WITH BARB RIGHT FROM BAR;Sm;0;ON;;;;;N;;;;; +295D;DOWNWARDS HARPOON WITH BARB RIGHT FROM BAR;Sm;0;ON;;;;;N;;;;; +295E;LEFTWARDS HARPOON WITH BARB DOWN FROM BAR;Sm;0;ON;;;;;N;;;;; +295F;RIGHTWARDS HARPOON WITH BARB DOWN FROM BAR;Sm;0;ON;;;;;N;;;;; +2960;UPWARDS HARPOON WITH BARB LEFT FROM BAR;Sm;0;ON;;;;;N;;;;; +2961;DOWNWARDS HARPOON WITH BARB LEFT FROM BAR;Sm;0;ON;;;;;N;;;;; +2962;LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;; +2963;UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;; +2964;RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;; +2965;DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;; +2966;LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP;Sm;0;ON;;;;;N;;;;; +2967;LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;; +2968;RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP;Sm;0;ON;;;;;N;;;;; +2969;RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;; +296A;LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH;Sm;0;ON;;;;;N;;;;; +296B;LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH;Sm;0;ON;;;;;N;;;;; +296C;RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH;Sm;0;ON;;;;;N;;;;; +296D;RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH;Sm;0;ON;;;;;N;;;;; +296E;UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;; +296F;DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;; +2970;RIGHT DOUBLE ARROW WITH ROUNDED HEAD;Sm;0;ON;;;;;N;;;;; +2971;EQUALS SIGN ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2972;TILDE OPERATOR ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2973;LEFTWARDS ARROW ABOVE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;; +2974;RIGHTWARDS ARROW ABOVE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;; +2975;RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;N;;;;; +2976;LESS-THAN ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2977;LEFTWARDS ARROW THROUGH LESS-THAN;Sm;0;ON;;;;;N;;;;; +2978;GREATER-THAN ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2979;SUBSET ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +297A;LEFTWARDS ARROW THROUGH SUBSET;Sm;0;ON;;;;;N;;;;; +297B;SUPERSET ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +297C;LEFT FISH TAIL;Sm;0;ON;;;;;N;;;;; +297D;RIGHT FISH TAIL;Sm;0;ON;;;;;N;;;;; +297E;UP FISH TAIL;Sm;0;ON;;;;;N;;;;; +297F;DOWN FISH TAIL;Sm;0;ON;;;;;N;;;;; +2980;TRIPLE VERTICAL BAR DELIMITER;Sm;0;ON;;;;;N;;;;; +2981;Z NOTATION SPOT;Sm;0;ON;;;;;N;;;;; +2982;Z NOTATION TYPE COLON;Sm;0;ON;;;;;N;;;;; +2983;LEFT WHITE CURLY BRACKET;Ps;0;ON;;;;;Y;;;;; +2984;RIGHT WHITE CURLY BRACKET;Pe;0;ON;;;;;Y;;;;; +2985;LEFT WHITE PARENTHESIS;Ps;0;ON;;;;;Y;;;;; +2986;RIGHT WHITE PARENTHESIS;Pe;0;ON;;;;;Y;;;;; +2987;Z NOTATION LEFT IMAGE BRACKET;Ps;0;ON;;;;;Y;;;;; +2988;Z NOTATION RIGHT IMAGE BRACKET;Pe;0;ON;;;;;Y;;;;; +2989;Z NOTATION LEFT BINDING BRACKET;Ps;0;ON;;;;;Y;;;;; +298A;Z NOTATION RIGHT BINDING BRACKET;Pe;0;ON;;;;;Y;;;;; +298B;LEFT SQUARE BRACKET WITH UNDERBAR;Ps;0;ON;;;;;Y;;;;; +298C;RIGHT SQUARE BRACKET WITH UNDERBAR;Pe;0;ON;;;;;Y;;;;; +298D;LEFT SQUARE BRACKET WITH TICK IN TOP CORNER;Ps;0;ON;;;;;Y;;;;; +298E;RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER;Pe;0;ON;;;;;Y;;;;; +298F;LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER;Ps;0;ON;;;;;Y;;;;; +2990;RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER;Pe;0;ON;;;;;Y;;;;; +2991;LEFT ANGLE BRACKET WITH DOT;Ps;0;ON;;;;;Y;;;;; +2992;RIGHT ANGLE BRACKET WITH DOT;Pe;0;ON;;;;;Y;;;;; +2993;LEFT ARC LESS-THAN BRACKET;Ps;0;ON;;;;;Y;;;;; +2994;RIGHT ARC GREATER-THAN BRACKET;Pe;0;ON;;;;;Y;;;;; +2995;DOUBLE LEFT ARC GREATER-THAN BRACKET;Ps;0;ON;;;;;Y;;;;; +2996;DOUBLE RIGHT ARC LESS-THAN BRACKET;Pe;0;ON;;;;;Y;;;;; +2997;LEFT BLACK TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;;;;; +2998;RIGHT BLACK TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;;;;; +2999;DOTTED FENCE;Sm;0;ON;;;;;N;;;;; +299A;VERTICAL ZIGZAG LINE;Sm;0;ON;;;;;N;;;;; +299B;MEASURED ANGLE OPENING LEFT;Sm;0;ON;;;;;Y;;;;; +299C;RIGHT ANGLE VARIANT WITH SQUARE;Sm;0;ON;;;;;Y;;;;; +299D;MEASURED RIGHT ANGLE WITH DOT;Sm;0;ON;;;;;Y;;;;; +299E;ANGLE WITH S INSIDE;Sm;0;ON;;;;;Y;;;;; +299F;ACUTE ANGLE;Sm;0;ON;;;;;Y;;;;; +29A0;SPHERICAL ANGLE OPENING LEFT;Sm;0;ON;;;;;Y;;;;; +29A1;SPHERICAL ANGLE OPENING UP;Sm;0;ON;;;;;Y;;;;; +29A2;TURNED ANGLE;Sm;0;ON;;;;;Y;;;;; +29A3;REVERSED ANGLE;Sm;0;ON;;;;;Y;;;;; +29A4;ANGLE WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;; +29A5;REVERSED ANGLE WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;; +29A6;OBLIQUE ANGLE OPENING UP;Sm;0;ON;;;;;Y;;;;; +29A7;OBLIQUE ANGLE OPENING DOWN;Sm;0;ON;;;;;Y;;;;; +29A8;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT;Sm;0;ON;;;;;Y;;;;; +29A9;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT;Sm;0;ON;;;;;Y;;;;; +29AA;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT;Sm;0;ON;;;;;Y;;;;; +29AB;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT;Sm;0;ON;;;;;Y;;;;; +29AC;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP;Sm;0;ON;;;;;Y;;;;; +29AD;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP;Sm;0;ON;;;;;Y;;;;; +29AE;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN;Sm;0;ON;;;;;Y;;;;; +29AF;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN;Sm;0;ON;;;;;Y;;;;; +29B0;REVERSED EMPTY SET;Sm;0;ON;;;;;N;;;;; +29B1;EMPTY SET WITH OVERBAR;Sm;0;ON;;;;;N;;;;; +29B2;EMPTY SET WITH SMALL CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;; +29B3;EMPTY SET WITH RIGHT ARROW ABOVE;Sm;0;ON;;;;;N;;;;; +29B4;EMPTY SET WITH LEFT ARROW ABOVE;Sm;0;ON;;;;;N;;;;; +29B5;CIRCLE WITH HORIZONTAL BAR;Sm;0;ON;;;;;N;;;;; +29B6;CIRCLED VERTICAL BAR;Sm;0;ON;;;;;N;;;;; +29B7;CIRCLED PARALLEL;Sm;0;ON;;;;;N;;;;; +29B8;CIRCLED REVERSE SOLIDUS;Sm;0;ON;;;;;Y;;;;; +29B9;CIRCLED PERPENDICULAR;Sm;0;ON;;;;;N;;;;; +29BA;CIRCLE DIVIDED BY HORIZONTAL BAR AND TOP HALF DIVIDED BY VERTICAL BAR;Sm;0;ON;;;;;N;;;;; +29BB;CIRCLE WITH SUPERIMPOSED X;Sm;0;ON;;;;;N;;;;; +29BC;CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN;Sm;0;ON;;;;;N;;;;; +29BD;UP ARROW THROUGH CIRCLE;Sm;0;ON;;;;;N;;;;; +29BE;CIRCLED WHITE BULLET;Sm;0;ON;;;;;N;;;;; +29BF;CIRCLED BULLET;Sm;0;ON;;;;;N;;;;; +29C0;CIRCLED LESS-THAN;Sm;0;ON;;;;;Y;;;;; +29C1;CIRCLED GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +29C2;CIRCLE WITH SMALL CIRCLE TO THE RIGHT;Sm;0;ON;;;;;Y;;;;; +29C3;CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT;Sm;0;ON;;;;;Y;;;;; +29C4;SQUARED RISING DIAGONAL SLASH;Sm;0;ON;;;;;Y;;;;; +29C5;SQUARED FALLING DIAGONAL SLASH;Sm;0;ON;;;;;Y;;;;; +29C6;SQUARED ASTERISK;Sm;0;ON;;;;;N;;;;; +29C7;SQUARED SMALL CIRCLE;Sm;0;ON;;;;;N;;;;; +29C8;SQUARED SQUARE;Sm;0;ON;;;;;N;;;;; +29C9;TWO JOINED SQUARES;Sm;0;ON;;;;;Y;;;;; +29CA;TRIANGLE WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;; +29CB;TRIANGLE WITH UNDERBAR;Sm;0;ON;;;;;N;;;;; +29CC;S IN TRIANGLE;Sm;0;ON;;;;;N;;;;; +29CD;TRIANGLE WITH SERIFS AT BOTTOM;Sm;0;ON;;;;;N;;;;; +29CE;RIGHT TRIANGLE ABOVE LEFT TRIANGLE;Sm;0;ON;;;;;Y;;;;; +29CF;LEFT TRIANGLE BESIDE VERTICAL BAR;Sm;0;ON;;;;;Y;;;;; +29D0;VERTICAL BAR BESIDE RIGHT TRIANGLE;Sm;0;ON;;;;;Y;;;;; +29D1;BOWTIE WITH LEFT HALF BLACK;Sm;0;ON;;;;;Y;;;;; +29D2;BOWTIE WITH RIGHT HALF BLACK;Sm;0;ON;;;;;Y;;;;; +29D3;BLACK BOWTIE;Sm;0;ON;;;;;N;;;;; +29D4;TIMES WITH LEFT HALF BLACK;Sm;0;ON;;;;;Y;;;;; +29D5;TIMES WITH RIGHT HALF BLACK;Sm;0;ON;;;;;Y;;;;; +29D6;WHITE HOURGLASS;Sm;0;ON;;;;;N;;;;; +29D7;BLACK HOURGLASS;Sm;0;ON;;;;;N;;;;; +29D8;LEFT WIGGLY FENCE;Ps;0;ON;;;;;Y;;;;; +29D9;RIGHT WIGGLY FENCE;Pe;0;ON;;;;;Y;;;;; +29DA;LEFT DOUBLE WIGGLY FENCE;Ps;0;ON;;;;;Y;;;;; +29DB;RIGHT DOUBLE WIGGLY FENCE;Pe;0;ON;;;;;Y;;;;; +29DC;INCOMPLETE INFINITY;Sm;0;ON;;;;;Y;;;;; +29DD;TIE OVER INFINITY;Sm;0;ON;;;;;N;;;;; +29DE;INFINITY NEGATED WITH VERTICAL BAR;Sm;0;ON;;;;;N;;;;; +29DF;DOUBLE-ENDED MULTIMAP;Sm;0;ON;;;;;N;;;;; +29E0;SQUARE WITH CONTOURED OUTLINE;Sm;0;ON;;;;;N;;;;; +29E1;INCREASES AS;Sm;0;ON;;;;;Y;;;;; +29E2;SHUFFLE PRODUCT;Sm;0;ON;;;;;N;;;;; +29E3;EQUALS SIGN AND SLANTED PARALLEL;Sm;0;ON;;;;;Y;;;;; +29E4;EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE;Sm;0;ON;;;;;Y;;;;; +29E5;IDENTICAL TO AND SLANTED PARALLEL;Sm;0;ON;;;;;Y;;;;; +29E6;GLEICH STARK;Sm;0;ON;;;;;N;;;;; +29E7;THERMODYNAMIC;Sm;0;ON;;;;;N;;;;; +29E8;DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK;Sm;0;ON;;;;;Y;;;;; +29E9;DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK;Sm;0;ON;;;;;Y;;;;; +29EA;BLACK DIAMOND WITH DOWN ARROW;Sm;0;ON;;;;;N;;;;; +29EB;BLACK LOZENGE;Sm;0;ON;;;;;N;;;;; +29EC;WHITE CIRCLE WITH DOWN ARROW;Sm;0;ON;;;;;N;;;;; +29ED;BLACK CIRCLE WITH DOWN ARROW;Sm;0;ON;;;;;N;;;;; +29EE;ERROR-BARRED WHITE SQUARE;Sm;0;ON;;;;;N;;;;; +29EF;ERROR-BARRED BLACK SQUARE;Sm;0;ON;;;;;N;;;;; +29F0;ERROR-BARRED WHITE DIAMOND;Sm;0;ON;;;;;N;;;;; +29F1;ERROR-BARRED BLACK DIAMOND;Sm;0;ON;;;;;N;;;;; +29F2;ERROR-BARRED WHITE CIRCLE;Sm;0;ON;;;;;N;;;;; +29F3;ERROR-BARRED BLACK CIRCLE;Sm;0;ON;;;;;N;;;;; +29F4;RULE-DELAYED;Sm;0;ON;;;;;Y;;;;; +29F5;REVERSE SOLIDUS OPERATOR;Sm;0;ON;;;;;Y;;;;; +29F6;SOLIDUS WITH OVERBAR;Sm;0;ON;;;;;Y;;;;; +29F7;REVERSE SOLIDUS WITH HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;; +29F8;BIG SOLIDUS;Sm;0;ON;;;;;Y;;;;; +29F9;BIG REVERSE SOLIDUS;Sm;0;ON;;;;;Y;;;;; +29FA;DOUBLE PLUS;Sm;0;ON;;;;;N;;;;; +29FB;TRIPLE PLUS;Sm;0;ON;;;;;N;;;;; +29FC;LEFT-POINTING CURVED ANGLE BRACKET;Ps;0;ON;;;;;Y;;;;; +29FD;RIGHT-POINTING CURVED ANGLE BRACKET;Pe;0;ON;;;;;Y;;;;; +29FE;TINY;Sm;0;ON;;;;;N;;;;; +29FF;MINY;Sm;0;ON;;;;;N;;;;; +2A00;N-ARY CIRCLED DOT OPERATOR;Sm;0;ON;;;;;N;;;;; +2A01;N-ARY CIRCLED PLUS OPERATOR;Sm;0;ON;;;;;N;;;;; +2A02;N-ARY CIRCLED TIMES OPERATOR;Sm;0;ON;;;;;N;;;;; +2A03;N-ARY UNION OPERATOR WITH DOT;Sm;0;ON;;;;;N;;;;; +2A04;N-ARY UNION OPERATOR WITH PLUS;Sm;0;ON;;;;;N;;;;; +2A05;N-ARY SQUARE INTERSECTION OPERATOR;Sm;0;ON;;;;;N;;;;; +2A06;N-ARY SQUARE UNION OPERATOR;Sm;0;ON;;;;;N;;;;; +2A07;TWO LOGICAL AND OPERATOR;Sm;0;ON;;;;;N;;;;; +2A08;TWO LOGICAL OR OPERATOR;Sm;0;ON;;;;;N;;;;; +2A09;N-ARY TIMES OPERATOR;Sm;0;ON;;;;;N;;;;; +2A0A;MODULO TWO SUM;Sm;0;ON;;;;;Y;;;;; +2A0B;SUMMATION WITH INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2A0C;QUADRUPLE INTEGRAL OPERATOR;Sm;0;ON;<compat> 222B 222B 222B 222B;;;;Y;;;;; +2A0D;FINITE PART INTEGRAL;Sm;0;ON;;;;;Y;;;;; +2A0E;INTEGRAL WITH DOUBLE STROKE;Sm;0;ON;;;;;Y;;;;; +2A0F;INTEGRAL AVERAGE WITH SLASH;Sm;0;ON;;;;;Y;;;;; +2A10;CIRCULATION FUNCTION;Sm;0;ON;;;;;Y;;;;; +2A11;ANTICLOCKWISE INTEGRATION;Sm;0;ON;;;;;Y;;;;; +2A12;LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE;Sm;0;ON;;;;;Y;;;;; +2A13;LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE;Sm;0;ON;;;;;Y;;;;; +2A14;LINE INTEGRATION NOT INCLUDING THE POLE;Sm;0;ON;;;;;Y;;;;; +2A15;INTEGRAL AROUND A POINT OPERATOR;Sm;0;ON;;;;;Y;;;;; +2A16;QUATERNION INTEGRAL OPERATOR;Sm;0;ON;;;;;Y;;;;; +2A17;INTEGRAL WITH LEFTWARDS ARROW WITH HOOK;Sm;0;ON;;;;;Y;;;;; +2A18;INTEGRAL WITH TIMES SIGN;Sm;0;ON;;;;;Y;;;;; +2A19;INTEGRAL WITH INTERSECTION;Sm;0;ON;;;;;Y;;;;; +2A1A;INTEGRAL WITH UNION;Sm;0;ON;;;;;Y;;;;; +2A1B;INTEGRAL WITH OVERBAR;Sm;0;ON;;;;;Y;;;;; +2A1C;INTEGRAL WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;; +2A1D;JOIN;Sm;0;ON;;;;;N;;;;; +2A1E;LARGE LEFT TRIANGLE OPERATOR;Sm;0;ON;;;;;Y;;;;; +2A1F;Z NOTATION SCHEMA COMPOSITION;Sm;0;ON;;;;;Y;;;;; +2A20;Z NOTATION SCHEMA PIPING;Sm;0;ON;;;;;Y;;;;; +2A21;Z NOTATION SCHEMA PROJECTION;Sm;0;ON;;;;;Y;;;;; +2A22;PLUS SIGN WITH SMALL CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;; +2A23;PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE;Sm;0;ON;;;;;N;;;;; +2A24;PLUS SIGN WITH TILDE ABOVE;Sm;0;ON;;;;;Y;;;;; +2A25;PLUS SIGN WITH DOT BELOW;Sm;0;ON;;;;;N;;;;; +2A26;PLUS SIGN WITH TILDE BELOW;Sm;0;ON;;;;;Y;;;;; +2A27;PLUS SIGN WITH SUBSCRIPT TWO;Sm;0;ON;;;;;N;;;;; +2A28;PLUS SIGN WITH BLACK TRIANGLE;Sm;0;ON;;;;;N;;;;; +2A29;MINUS SIGN WITH COMMA ABOVE;Sm;0;ON;;;;;Y;;;;; +2A2A;MINUS SIGN WITH DOT BELOW;Sm;0;ON;;;;;N;;;;; +2A2B;MINUS SIGN WITH FALLING DOTS;Sm;0;ON;;;;;Y;;;;; +2A2C;MINUS SIGN WITH RISING DOTS;Sm;0;ON;;;;;Y;;;;; +2A2D;PLUS SIGN IN LEFT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;; +2A2E;PLUS SIGN IN RIGHT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;; +2A2F;VECTOR OR CROSS PRODUCT;Sm;0;ON;;;;;N;;;;; +2A30;MULTIPLICATION SIGN WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;; +2A31;MULTIPLICATION SIGN WITH UNDERBAR;Sm;0;ON;;;;;N;;;;; +2A32;SEMIDIRECT PRODUCT WITH BOTTOM CLOSED;Sm;0;ON;;;;;N;;;;; +2A33;SMASH PRODUCT;Sm;0;ON;;;;;N;;;;; +2A34;MULTIPLICATION SIGN IN LEFT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;; +2A35;MULTIPLICATION SIGN IN RIGHT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;; +2A36;CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT;Sm;0;ON;;;;;N;;;;; +2A37;MULTIPLICATION SIGN IN DOUBLE CIRCLE;Sm;0;ON;;;;;N;;;;; +2A38;CIRCLED DIVISION SIGN;Sm;0;ON;;;;;N;;;;; +2A39;PLUS SIGN IN TRIANGLE;Sm;0;ON;;;;;N;;;;; +2A3A;MINUS SIGN IN TRIANGLE;Sm;0;ON;;;;;N;;;;; +2A3B;MULTIPLICATION SIGN IN TRIANGLE;Sm;0;ON;;;;;N;;;;; +2A3C;INTERIOR PRODUCT;Sm;0;ON;;;;;Y;;;;; +2A3D;RIGHTHAND INTERIOR PRODUCT;Sm;0;ON;;;;;Y;;;;; +2A3E;Z NOTATION RELATIONAL COMPOSITION;Sm;0;ON;;;;;Y;;;;; +2A3F;AMALGAMATION OR COPRODUCT;Sm;0;ON;;;;;N;;;;; +2A40;INTERSECTION WITH DOT;Sm;0;ON;;;;;N;;;;; +2A41;UNION WITH MINUS SIGN;Sm;0;ON;;;;;N;;;;; +2A42;UNION WITH OVERBAR;Sm;0;ON;;;;;N;;;;; +2A43;INTERSECTION WITH OVERBAR;Sm;0;ON;;;;;N;;;;; +2A44;INTERSECTION WITH LOGICAL AND;Sm;0;ON;;;;;N;;;;; +2A45;UNION WITH LOGICAL OR;Sm;0;ON;;;;;N;;;;; +2A46;UNION ABOVE INTERSECTION;Sm;0;ON;;;;;N;;;;; +2A47;INTERSECTION ABOVE UNION;Sm;0;ON;;;;;N;;;;; +2A48;UNION ABOVE BAR ABOVE INTERSECTION;Sm;0;ON;;;;;N;;;;; +2A49;INTERSECTION ABOVE BAR ABOVE UNION;Sm;0;ON;;;;;N;;;;; +2A4A;UNION BESIDE AND JOINED WITH UNION;Sm;0;ON;;;;;N;;;;; +2A4B;INTERSECTION BESIDE AND JOINED WITH INTERSECTION;Sm;0;ON;;;;;N;;;;; +2A4C;CLOSED UNION WITH SERIFS;Sm;0;ON;;;;;N;;;;; +2A4D;CLOSED INTERSECTION WITH SERIFS;Sm;0;ON;;;;;N;;;;; +2A4E;DOUBLE SQUARE INTERSECTION;Sm;0;ON;;;;;N;;;;; +2A4F;DOUBLE SQUARE UNION;Sm;0;ON;;;;;N;;;;; +2A50;CLOSED UNION WITH SERIFS AND SMASH PRODUCT;Sm;0;ON;;;;;N;;;;; +2A51;LOGICAL AND WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;; +2A52;LOGICAL OR WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;; +2A53;DOUBLE LOGICAL AND;Sm;0;ON;;;;;N;;;;; +2A54;DOUBLE LOGICAL OR;Sm;0;ON;;;;;N;;;;; +2A55;TWO INTERSECTING LOGICAL AND;Sm;0;ON;;;;;N;;;;; +2A56;TWO INTERSECTING LOGICAL OR;Sm;0;ON;;;;;N;;;;; +2A57;SLOPING LARGE OR;Sm;0;ON;;;;;Y;;;;; +2A58;SLOPING LARGE AND;Sm;0;ON;;;;;Y;;;;; +2A59;LOGICAL OR OVERLAPPING LOGICAL AND;Sm;0;ON;;;;;N;;;;; +2A5A;LOGICAL AND WITH MIDDLE STEM;Sm;0;ON;;;;;N;;;;; +2A5B;LOGICAL OR WITH MIDDLE STEM;Sm;0;ON;;;;;N;;;;; +2A5C;LOGICAL AND WITH HORIZONTAL DASH;Sm;0;ON;;;;;N;;;;; +2A5D;LOGICAL OR WITH HORIZONTAL DASH;Sm;0;ON;;;;;N;;;;; +2A5E;LOGICAL AND WITH DOUBLE OVERBAR;Sm;0;ON;;;;;N;;;;; +2A5F;LOGICAL AND WITH UNDERBAR;Sm;0;ON;;;;;N;;;;; +2A60;LOGICAL AND WITH DOUBLE UNDERBAR;Sm;0;ON;;;;;N;;;;; +2A61;SMALL VEE WITH UNDERBAR;Sm;0;ON;;;;;N;;;;; +2A62;LOGICAL OR WITH DOUBLE OVERBAR;Sm;0;ON;;;;;N;;;;; +2A63;LOGICAL OR WITH DOUBLE UNDERBAR;Sm;0;ON;;;;;N;;;;; +2A64;Z NOTATION DOMAIN ANTIRESTRICTION;Sm;0;ON;;;;;Y;;;;; +2A65;Z NOTATION RANGE ANTIRESTRICTION;Sm;0;ON;;;;;Y;;;;; +2A66;EQUALS SIGN WITH DOT BELOW;Sm;0;ON;;;;;N;;;;; +2A67;IDENTICAL WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;; +2A68;TRIPLE HORIZONTAL BAR WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2A69;TRIPLE HORIZONTAL BAR WITH TRIPLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2A6A;TILDE OPERATOR WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +2A6B;TILDE OPERATOR WITH RISING DOTS;Sm;0;ON;;;;;Y;;;;; +2A6C;SIMILAR MINUS SIMILAR;Sm;0;ON;;;;;Y;;;;; +2A6D;CONGRUENT WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +2A6E;EQUALS WITH ASTERISK;Sm;0;ON;;;;;N;;;;; +2A6F;ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT;Sm;0;ON;;;;;Y;;;;; +2A70;APPROXIMATELY EQUAL OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2A71;EQUALS SIGN ABOVE PLUS SIGN;Sm;0;ON;;;;;N;;;;; +2A72;PLUS SIGN ABOVE EQUALS SIGN;Sm;0;ON;;;;;N;;;;; +2A73;EQUALS SIGN ABOVE TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;; +2A74;DOUBLE COLON EQUAL;Sm;0;ON;<compat> 003A 003A 003D;;;;Y;;;;; +2A75;TWO CONSECUTIVE EQUALS SIGNS;Sm;0;ON;<compat> 003D 003D;;;;N;;;;; +2A76;THREE CONSECUTIVE EQUALS SIGNS;Sm;0;ON;<compat> 003D 003D 003D;;;;N;;;;; +2A77;EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW;Sm;0;ON;;;;;N;;;;; +2A78;EQUIVALENT WITH FOUR DOTS ABOVE;Sm;0;ON;;;;;N;;;;; +2A79;LESS-THAN WITH CIRCLE INSIDE;Sm;0;ON;;;;;Y;;;;; +2A7A;GREATER-THAN WITH CIRCLE INSIDE;Sm;0;ON;;;;;Y;;;;; +2A7B;LESS-THAN WITH QUESTION MARK ABOVE;Sm;0;ON;;;;;Y;;;;; +2A7C;GREATER-THAN WITH QUESTION MARK ABOVE;Sm;0;ON;;;;;Y;;;;; +2A7D;LESS-THAN OR SLANTED EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2A7E;GREATER-THAN OR SLANTED EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2A7F;LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;; +2A80;GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;; +2A81;LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +2A82;GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +2A83;LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT;Sm;0;ON;;;;;Y;;;;; +2A84;GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT;Sm;0;ON;;;;;Y;;;;; +2A85;LESS-THAN OR APPROXIMATE;Sm;0;ON;;;;;Y;;;;; +2A86;GREATER-THAN OR APPROXIMATE;Sm;0;ON;;;;;Y;;;;; +2A87;LESS-THAN AND SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2A88;GREATER-THAN AND SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2A89;LESS-THAN AND NOT APPROXIMATE;Sm;0;ON;;;;;Y;;;;; +2A8A;GREATER-THAN AND NOT APPROXIMATE;Sm;0;ON;;;;;Y;;;;; +2A8B;LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2A8C;GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2A8D;LESS-THAN ABOVE SIMILAR OR EQUAL;Sm;0;ON;;;;;Y;;;;; +2A8E;GREATER-THAN ABOVE SIMILAR OR EQUAL;Sm;0;ON;;;;;Y;;;;; +2A8F;LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2A90;GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2A91;LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL;Sm;0;ON;;;;;Y;;;;; +2A92;GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL;Sm;0;ON;;;;;Y;;;;; +2A93;LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;; +2A94;GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;; +2A95;SLANTED EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2A96;SLANTED EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2A97;SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;; +2A98;SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;; +2A99;DOUBLE-LINE EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2A9A;DOUBLE-LINE EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2A9B;DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2A9C;DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2A9D;SIMILAR OR LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2A9E;SIMILAR OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2A9F;SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AA0;SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AA1;DOUBLE NESTED LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2AA2;DOUBLE NESTED GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2AA3;DOUBLE NESTED LESS-THAN WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;; +2AA4;GREATER-THAN OVERLAPPING LESS-THAN;Sm;0;ON;;;;;N;;;;; +2AA5;GREATER-THAN BESIDE LESS-THAN;Sm;0;ON;;;;;N;;;;; +2AA6;LESS-THAN CLOSED BY CURVE;Sm;0;ON;;;;;Y;;;;; +2AA7;GREATER-THAN CLOSED BY CURVE;Sm;0;ON;;;;;Y;;;;; +2AA8;LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;; +2AA9;GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;; +2AAA;SMALLER THAN;Sm;0;ON;;;;;Y;;;;; +2AAB;LARGER THAN;Sm;0;ON;;;;;Y;;;;; +2AAC;SMALLER THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AAD;LARGER THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AAE;EQUALS SIGN WITH BUMPY ABOVE;Sm;0;ON;;;;;N;;;;; +2AAF;PRECEDES ABOVE SINGLE-LINE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AB0;SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AB1;PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AB2;SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AB3;PRECEDES ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AB4;SUCCEEDS ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AB5;PRECEDES ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AB6;SUCCEEDS ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AB7;PRECEDES ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AB8;SUCCEEDS ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AB9;PRECEDES ABOVE NOT ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2ABA;SUCCEEDS ABOVE NOT ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2ABB;DOUBLE PRECEDES;Sm;0;ON;;;;;Y;;;;; +2ABC;DOUBLE SUCCEEDS;Sm;0;ON;;;;;Y;;;;; +2ABD;SUBSET WITH DOT;Sm;0;ON;;;;;Y;;;;; +2ABE;SUPERSET WITH DOT;Sm;0;ON;;;;;Y;;;;; +2ABF;SUBSET WITH PLUS SIGN BELOW;Sm;0;ON;;;;;Y;;;;; +2AC0;SUPERSET WITH PLUS SIGN BELOW;Sm;0;ON;;;;;Y;;;;; +2AC1;SUBSET WITH MULTIPLICATION SIGN BELOW;Sm;0;ON;;;;;Y;;;;; +2AC2;SUPERSET WITH MULTIPLICATION SIGN BELOW;Sm;0;ON;;;;;Y;;;;; +2AC3;SUBSET OF OR EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +2AC4;SUPERSET OF OR EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;; +2AC5;SUBSET OF ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AC6;SUPERSET OF ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;; +2AC7;SUBSET OF ABOVE TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;; +2AC8;SUPERSET OF ABOVE TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;; +2AC9;SUBSET OF ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2ACA;SUPERSET OF ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2ACB;SUBSET OF ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2ACC;SUPERSET OF ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2ACD;SQUARE LEFT OPEN BOX OPERATOR;Sm;0;ON;;;;;Y;;;;; +2ACE;SQUARE RIGHT OPEN BOX OPERATOR;Sm;0;ON;;;;;Y;;;;; +2ACF;CLOSED SUBSET;Sm;0;ON;;;;;Y;;;;; +2AD0;CLOSED SUPERSET;Sm;0;ON;;;;;Y;;;;; +2AD1;CLOSED SUBSET OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AD2;CLOSED SUPERSET OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AD3;SUBSET ABOVE SUPERSET;Sm;0;ON;;;;;Y;;;;; +2AD4;SUPERSET ABOVE SUBSET;Sm;0;ON;;;;;Y;;;;; +2AD5;SUBSET ABOVE SUBSET;Sm;0;ON;;;;;Y;;;;; +2AD6;SUPERSET ABOVE SUPERSET;Sm;0;ON;;;;;Y;;;;; +2AD7;SUPERSET BESIDE SUBSET;Sm;0;ON;;;;;N;;;;; +2AD8;SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET;Sm;0;ON;;;;;N;;;;; +2AD9;ELEMENT OF OPENING DOWNWARDS;Sm;0;ON;;;;;N;;;;; +2ADA;PITCHFORK WITH TEE TOP;Sm;0;ON;;;;;N;;;;; +2ADB;TRANSVERSAL INTERSECTION;Sm;0;ON;;;;;N;;;;; +2ADC;FORKING;Sm;0;ON;2ADD 0338;;;;Y;;;;; +2ADD;NONFORKING;Sm;0;ON;;;;;N;;;;; +2ADE;SHORT LEFT TACK;Sm;0;ON;;;;;Y;;;;; +2ADF;SHORT DOWN TACK;Sm;0;ON;;;;;N;;;;; +2AE0;SHORT UP TACK;Sm;0;ON;;;;;N;;;;; +2AE1;PERPENDICULAR WITH S;Sm;0;ON;;;;;N;;;;; +2AE2;VERTICAL BAR TRIPLE RIGHT TURNSTILE;Sm;0;ON;;;;;Y;;;;; +2AE3;DOUBLE VERTICAL BAR LEFT TURNSTILE;Sm;0;ON;;;;;Y;;;;; +2AE4;VERTICAL BAR DOUBLE LEFT TURNSTILE;Sm;0;ON;;;;;Y;;;;; +2AE5;DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE;Sm;0;ON;;;;;Y;;;;; +2AE6;LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL;Sm;0;ON;;;;;Y;;;;; +2AE7;SHORT DOWN TACK WITH OVERBAR;Sm;0;ON;;;;;N;;;;; +2AE8;SHORT UP TACK WITH UNDERBAR;Sm;0;ON;;;;;N;;;;; +2AE9;SHORT UP TACK ABOVE SHORT DOWN TACK;Sm;0;ON;;;;;N;;;;; +2AEA;DOUBLE DOWN TACK;Sm;0;ON;;;;;N;;;;; +2AEB;DOUBLE UP TACK;Sm;0;ON;;;;;N;;;;; +2AEC;DOUBLE STROKE NOT SIGN;Sm;0;ON;;;;;Y;;;;; +2AED;REVERSED DOUBLE STROKE NOT SIGN;Sm;0;ON;;;;;Y;;;;; +2AEE;DOES NOT DIVIDE WITH REVERSED NEGATION SLASH;Sm;0;ON;;;;;Y;;;;; +2AEF;VERTICAL LINE WITH CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;; +2AF0;VERTICAL LINE WITH CIRCLE BELOW;Sm;0;ON;;;;;N;;;;; +2AF1;DOWN TACK WITH CIRCLE BELOW;Sm;0;ON;;;;;N;;;;; +2AF2;PARALLEL WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;; +2AF3;PARALLEL WITH TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;; +2AF4;TRIPLE VERTICAL BAR BINARY RELATION;Sm;0;ON;;;;;N;;;;; +2AF5;TRIPLE VERTICAL BAR WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;; +2AF6;TRIPLE COLON OPERATOR;Sm;0;ON;;;;;N;;;;; +2AF7;TRIPLE NESTED LESS-THAN;Sm;0;ON;;;;;Y;;;;; +2AF8;TRIPLE NESTED GREATER-THAN;Sm;0;ON;;;;;Y;;;;; +2AF9;DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AFA;DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;; +2AFB;TRIPLE SOLIDUS BINARY RELATION;Sm;0;ON;;;;;Y;;;;; +2AFC;LARGE TRIPLE VERTICAL BAR OPERATOR;Sm;0;ON;;;;;N;;;;; +2AFD;DOUBLE SOLIDUS OPERATOR;Sm;0;ON;;;;;Y;;;;; +2AFE;WHITE VERTICAL BAR;Sm;0;ON;;;;;N;;;;; +2AFF;N-ARY WHITE VERTICAL BAR;Sm;0;ON;;;;;N;;;;; +2B00;NORTH EAST WHITE ARROW;So;0;ON;;;;;N;;;;; +2B01;NORTH WEST WHITE ARROW;So;0;ON;;;;;N;;;;; +2B02;SOUTH EAST WHITE ARROW;So;0;ON;;;;;N;;;;; +2B03;SOUTH WEST WHITE ARROW;So;0;ON;;;;;N;;;;; +2B04;LEFT RIGHT WHITE ARROW;So;0;ON;;;;;N;;;;; +2B05;LEFTWARDS BLACK ARROW;So;0;ON;;;;;N;;;;; +2B06;UPWARDS BLACK ARROW;So;0;ON;;;;;N;;;;; +2B07;DOWNWARDS BLACK ARROW;So;0;ON;;;;;N;;;;; +2B08;NORTH EAST BLACK ARROW;So;0;ON;;;;;N;;;;; +2B09;NORTH WEST BLACK ARROW;So;0;ON;;;;;N;;;;; +2B0A;SOUTH EAST BLACK ARROW;So;0;ON;;;;;N;;;;; +2B0B;SOUTH WEST BLACK ARROW;So;0;ON;;;;;N;;;;; +2B0C;LEFT RIGHT BLACK ARROW;So;0;ON;;;;;N;;;;; +2B0D;UP DOWN BLACK ARROW;So;0;ON;;;;;N;;;;; +2B0E;RIGHTWARDS ARROW WITH TIP DOWNWARDS;So;0;ON;;;;;N;;;;; +2B0F;RIGHTWARDS ARROW WITH TIP UPWARDS;So;0;ON;;;;;N;;;;; +2B10;LEFTWARDS ARROW WITH TIP DOWNWARDS;So;0;ON;;;;;N;;;;; +2B11;LEFTWARDS ARROW WITH TIP UPWARDS;So;0;ON;;;;;N;;;;; +2B12;SQUARE WITH TOP HALF BLACK;So;0;ON;;;;;N;;;;; +2B13;SQUARE WITH BOTTOM HALF BLACK;So;0;ON;;;;;N;;;;; +2B14;SQUARE WITH UPPER RIGHT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;; +2B15;SQUARE WITH LOWER LEFT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;; +2B16;DIAMOND WITH LEFT HALF BLACK;So;0;ON;;;;;N;;;;; +2B17;DIAMOND WITH RIGHT HALF BLACK;So;0;ON;;;;;N;;;;; +2B18;DIAMOND WITH TOP HALF BLACK;So;0;ON;;;;;N;;;;; +2B19;DIAMOND WITH BOTTOM HALF BLACK;So;0;ON;;;;;N;;;;; +2B1A;DOTTED SQUARE;So;0;ON;;;;;N;;;;; +2B1B;BLACK LARGE SQUARE;So;0;ON;;;;;N;;;;; +2B1C;WHITE LARGE SQUARE;So;0;ON;;;;;N;;;;; +2B1D;BLACK VERY SMALL SQUARE;So;0;ON;;;;;N;;;;; +2B1E;WHITE VERY SMALL SQUARE;So;0;ON;;;;;N;;;;; +2B1F;BLACK PENTAGON;So;0;ON;;;;;N;;;;; +2B20;WHITE PENTAGON;So;0;ON;;;;;N;;;;; +2B21;WHITE HEXAGON;So;0;ON;;;;;N;;;;; +2B22;BLACK HEXAGON;So;0;ON;;;;;N;;;;; +2B23;HORIZONTAL BLACK HEXAGON;So;0;ON;;;;;N;;;;; +2B24;BLACK LARGE CIRCLE;So;0;ON;;;;;N;;;;; +2B25;BLACK MEDIUM DIAMOND;So;0;ON;;;;;N;;;;; +2B26;WHITE MEDIUM DIAMOND;So;0;ON;;;;;N;;;;; +2B27;BLACK MEDIUM LOZENGE;So;0;ON;;;;;N;;;;; +2B28;WHITE MEDIUM LOZENGE;So;0;ON;;;;;N;;;;; +2B29;BLACK SMALL DIAMOND;So;0;ON;;;;;N;;;;; +2B2A;BLACK SMALL LOZENGE;So;0;ON;;;;;N;;;;; +2B2B;WHITE SMALL LOZENGE;So;0;ON;;;;;N;;;;; +2B2C;BLACK HORIZONTAL ELLIPSE;So;0;ON;;;;;N;;;;; +2B2D;WHITE HORIZONTAL ELLIPSE;So;0;ON;;;;;N;;;;; +2B2E;BLACK VERTICAL ELLIPSE;So;0;ON;;;;;N;;;;; +2B2F;WHITE VERTICAL ELLIPSE;So;0;ON;;;;;N;;;;; +2B30;LEFT ARROW WITH SMALL CIRCLE;Sm;0;ON;;;;;N;;;;; +2B31;THREE LEFTWARDS ARROWS;Sm;0;ON;;;;;N;;;;; +2B32;LEFT ARROW WITH CIRCLED PLUS;Sm;0;ON;;;;;N;;;;; +2B33;LONG LEFTWARDS SQUIGGLE ARROW;Sm;0;ON;;;;;N;;;;; +2B34;LEFTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2B35;LEFTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2B36;LEFTWARDS TWO-HEADED ARROW FROM BAR;Sm;0;ON;;;;;N;;;;; +2B37;LEFTWARDS TWO-HEADED TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;; +2B38;LEFTWARDS ARROW WITH DOTTED STEM;Sm;0;ON;;;;;N;;;;; +2B39;LEFTWARDS ARROW WITH TAIL WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2B3A;LEFTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2B3B;LEFTWARDS TWO-HEADED ARROW WITH TAIL;Sm;0;ON;;;;;N;;;;; +2B3C;LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2B3D;LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;; +2B3E;LEFTWARDS ARROW THROUGH X;Sm;0;ON;;;;;N;;;;; +2B3F;WAVE ARROW POINTING DIRECTLY LEFT;Sm;0;ON;;;;;N;;;;; +2B40;EQUALS SIGN ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2B41;REVERSE TILDE OPERATOR ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2B42;LEFTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO;Sm;0;ON;;;;;N;;;;; +2B43;RIGHTWARDS ARROW THROUGH GREATER-THAN;Sm;0;ON;;;;;N;;;;; +2B44;RIGHTWARDS ARROW THROUGH SUPERSET;Sm;0;ON;;;;;N;;;;; +2B45;LEFTWARDS QUADRUPLE ARROW;So;0;ON;;;;;N;;;;; +2B46;RIGHTWARDS QUADRUPLE ARROW;So;0;ON;;;;;N;;;;; +2B47;REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2B48;RIGHTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO;Sm;0;ON;;;;;N;;;;; +2B49;TILDE OPERATOR ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;; +2B4A;LEFTWARDS ARROW ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;N;;;;; +2B4B;LEFTWARDS ARROW ABOVE REVERSE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;; +2B4C;RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;; +2B4D;DOWNWARDS TRIANGLE-HEADED ZIGZAG ARROW;So;0;ON;;;;;N;;;;; +2B4E;SHORT SLANTED NORTH ARROW;So;0;ON;;;;;N;;;;; +2B4F;SHORT BACKSLANTED SOUTH ARROW;So;0;ON;;;;;N;;;;; +2B50;WHITE MEDIUM STAR;So;0;ON;;;;;N;;;;; +2B51;BLACK SMALL STAR;So;0;ON;;;;;N;;;;; +2B52;WHITE SMALL STAR;So;0;ON;;;;;N;;;;; +2B53;BLACK RIGHT-POINTING PENTAGON;So;0;ON;;;;;N;;;;; +2B54;WHITE RIGHT-POINTING PENTAGON;So;0;ON;;;;;N;;;;; +2B55;HEAVY LARGE CIRCLE;So;0;ON;;;;;N;;;;; +2B56;HEAVY OVAL WITH OVAL INSIDE;So;0;ON;;;;;N;;;;; +2B57;HEAVY CIRCLE WITH CIRCLE INSIDE;So;0;ON;;;;;N;;;;; +2B58;HEAVY CIRCLE;So;0;ON;;;;;N;;;;; +2B59;HEAVY CIRCLED SALTIRE;So;0;ON;;;;;N;;;;; +2B5A;SLANTED NORTH ARROW WITH HOOKED HEAD;So;0;ON;;;;;N;;;;; +2B5B;BACKSLANTED SOUTH ARROW WITH HOOKED TAIL;So;0;ON;;;;;N;;;;; +2B5C;SLANTED NORTH ARROW WITH HORIZONTAL TAIL;So;0;ON;;;;;N;;;;; +2B5D;BACKSLANTED SOUTH ARROW WITH HORIZONTAL TAIL;So;0;ON;;;;;N;;;;; +2B5E;BENT ARROW POINTING DOWNWARDS THEN NORTH EAST;So;0;ON;;;;;N;;;;; +2B5F;SHORT BENT ARROW POINTING DOWNWARDS THEN NORTH EAST;So;0;ON;;;;;N;;;;; +2B60;LEFTWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B61;UPWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B62;RIGHTWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B63;DOWNWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B64;LEFT RIGHT TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B65;UP DOWN TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B66;NORTH WEST TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B67;NORTH EAST TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B68;SOUTH EAST TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B69;SOUTH WEST TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B6A;LEFTWARDS TRIANGLE-HEADED DASHED ARROW;So;0;ON;;;;;N;;;;; +2B6B;UPWARDS TRIANGLE-HEADED DASHED ARROW;So;0;ON;;;;;N;;;;; +2B6C;RIGHTWARDS TRIANGLE-HEADED DASHED ARROW;So;0;ON;;;;;N;;;;; +2B6D;DOWNWARDS TRIANGLE-HEADED DASHED ARROW;So;0;ON;;;;;N;;;;; +2B6E;CLOCKWISE TRIANGLE-HEADED OPEN CIRCLE ARROW;So;0;ON;;;;;N;;;;; +2B6F;ANTICLOCKWISE TRIANGLE-HEADED OPEN CIRCLE ARROW;So;0;ON;;;;;N;;;;; +2B70;LEFTWARDS TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B71;UPWARDS TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B72;RIGHTWARDS TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B73;DOWNWARDS TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B76;NORTH WEST TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B77;NORTH EAST TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B78;SOUTH EAST TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B79;SOUTH WEST TRIANGLE-HEADED ARROW TO BAR;So;0;ON;;;;;N;;;;; +2B7A;LEFTWARDS TRIANGLE-HEADED ARROW WITH DOUBLE HORIZONTAL STROKE;So;0;ON;;;;;N;;;;; +2B7B;UPWARDS TRIANGLE-HEADED ARROW WITH DOUBLE HORIZONTAL STROKE;So;0;ON;;;;;N;;;;; +2B7C;RIGHTWARDS TRIANGLE-HEADED ARROW WITH DOUBLE HORIZONTAL STROKE;So;0;ON;;;;;N;;;;; +2B7D;DOWNWARDS TRIANGLE-HEADED ARROW WITH DOUBLE HORIZONTAL STROKE;So;0;ON;;;;;N;;;;; +2B7E;HORIZONTAL TAB KEY;So;0;ON;;;;;N;;;;; +2B7F;VERTICAL TAB KEY;So;0;ON;;;;;N;;;;; +2B80;LEFTWARDS TRIANGLE-HEADED ARROW OVER RIGHTWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B81;UPWARDS TRIANGLE-HEADED ARROW LEFTWARDS OF DOWNWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B82;RIGHTWARDS TRIANGLE-HEADED ARROW OVER LEFTWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B83;DOWNWARDS TRIANGLE-HEADED ARROW LEFTWARDS OF UPWARDS TRIANGLE-HEADED ARROW;So;0;ON;;;;;N;;;;; +2B84;LEFTWARDS TRIANGLE-HEADED PAIRED ARROWS;So;0;ON;;;;;N;;;;; +2B85;UPWARDS TRIANGLE-HEADED PAIRED ARROWS;So;0;ON;;;;;N;;;;; +2B86;RIGHTWARDS TRIANGLE-HEADED PAIRED ARROWS;So;0;ON;;;;;N;;;;; +2B87;DOWNWARDS TRIANGLE-HEADED PAIRED ARROWS;So;0;ON;;;;;N;;;;; +2B88;LEFTWARDS BLACK CIRCLED WHITE ARROW;So;0;ON;;;;;N;;;;; +2B89;UPWARDS BLACK CIRCLED WHITE ARROW;So;0;ON;;;;;N;;;;; +2B8A;RIGHTWARDS BLACK CIRCLED WHITE ARROW;So;0;ON;;;;;N;;;;; +2B8B;DOWNWARDS BLACK CIRCLED WHITE ARROW;So;0;ON;;;;;N;;;;; +2B8C;ANTICLOCKWISE TRIANGLE-HEADED RIGHT U-SHAPED ARROW;So;0;ON;;;;;N;;;;; +2B8D;ANTICLOCKWISE TRIANGLE-HEADED BOTTOM U-SHAPED ARROW;So;0;ON;;;;;N;;;;; +2B8E;ANTICLOCKWISE TRIANGLE-HEADED LEFT U-SHAPED ARROW;So;0;ON;;;;;N;;;;; +2B8F;ANTICLOCKWISE TRIANGLE-HEADED TOP U-SHAPED ARROW;So;0;ON;;;;;N;;;;; +2B90;RETURN LEFT;So;0;ON;;;;;N;;;;; +2B91;RETURN RIGHT;So;0;ON;;;;;N;;;;; +2B92;NEWLINE LEFT;So;0;ON;;;;;N;;;;; +2B93;NEWLINE RIGHT;So;0;ON;;;;;N;;;;; +2B94;FOUR CORNER ARROWS CIRCLING ANTICLOCKWISE;So;0;ON;;;;;N;;;;; +2B95;RIGHTWARDS BLACK ARROW;So;0;ON;;;;;N;;;;; +2B98;THREE-D TOP-LIGHTED LEFTWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B99;THREE-D RIGHT-LIGHTED UPWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B9A;THREE-D TOP-LIGHTED RIGHTWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B9B;THREE-D LEFT-LIGHTED DOWNWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B9C;BLACK LEFTWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B9D;BLACK UPWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B9E;BLACK RIGHTWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2B9F;BLACK DOWNWARDS EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +2BA0;DOWNWARDS TRIANGLE-HEADED ARROW WITH LONG TIP LEFTWARDS;So;0;ON;;;;;N;;;;; +2BA1;DOWNWARDS TRIANGLE-HEADED ARROW WITH LONG TIP RIGHTWARDS;So;0;ON;;;;;N;;;;; +2BA2;UPWARDS TRIANGLE-HEADED ARROW WITH LONG TIP LEFTWARDS;So;0;ON;;;;;N;;;;; +2BA3;UPWARDS TRIANGLE-HEADED ARROW WITH LONG TIP RIGHTWARDS;So;0;ON;;;;;N;;;;; +2BA4;LEFTWARDS TRIANGLE-HEADED ARROW WITH LONG TIP UPWARDS;So;0;ON;;;;;N;;;;; +2BA5;RIGHTWARDS TRIANGLE-HEADED ARROW WITH LONG TIP UPWARDS;So;0;ON;;;;;N;;;;; +2BA6;LEFTWARDS TRIANGLE-HEADED ARROW WITH LONG TIP DOWNWARDS;So;0;ON;;;;;N;;;;; +2BA7;RIGHTWARDS TRIANGLE-HEADED ARROW WITH LONG TIP DOWNWARDS;So;0;ON;;;;;N;;;;; +2BA8;BLACK CURVED DOWNWARDS AND LEFTWARDS ARROW;So;0;ON;;;;;N;;;;; +2BA9;BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW;So;0;ON;;;;;N;;;;; +2BAA;BLACK CURVED UPWARDS AND LEFTWARDS ARROW;So;0;ON;;;;;N;;;;; +2BAB;BLACK CURVED UPWARDS AND RIGHTWARDS ARROW;So;0;ON;;;;;N;;;;; +2BAC;BLACK CURVED LEFTWARDS AND UPWARDS ARROW;So;0;ON;;;;;N;;;;; +2BAD;BLACK CURVED RIGHTWARDS AND UPWARDS ARROW;So;0;ON;;;;;N;;;;; +2BAE;BLACK CURVED LEFTWARDS AND DOWNWARDS ARROW;So;0;ON;;;;;N;;;;; +2BAF;BLACK CURVED RIGHTWARDS AND DOWNWARDS ARROW;So;0;ON;;;;;N;;;;; +2BB0;RIBBON ARROW DOWN LEFT;So;0;ON;;;;;N;;;;; +2BB1;RIBBON ARROW DOWN RIGHT;So;0;ON;;;;;N;;;;; +2BB2;RIBBON ARROW UP LEFT;So;0;ON;;;;;N;;;;; +2BB3;RIBBON ARROW UP RIGHT;So;0;ON;;;;;N;;;;; +2BB4;RIBBON ARROW LEFT UP;So;0;ON;;;;;N;;;;; +2BB5;RIBBON ARROW RIGHT UP;So;0;ON;;;;;N;;;;; +2BB6;RIBBON ARROW LEFT DOWN;So;0;ON;;;;;N;;;;; +2BB7;RIBBON ARROW RIGHT DOWN;So;0;ON;;;;;N;;;;; +2BB8;UPWARDS WHITE ARROW FROM BAR WITH HORIZONTAL BAR;So;0;ON;;;;;N;;;;; +2BB9;UP ARROWHEAD IN A RECTANGLE BOX;So;0;ON;;;;;N;;;;; +2BBD;BALLOT BOX WITH LIGHT X;So;0;ON;;;;;N;;;;; +2BBE;CIRCLED X;So;0;ON;;;;;N;;;;; +2BBF;CIRCLED BOLD X;So;0;ON;;;;;N;;;;; +2BC0;BLACK SQUARE CENTRED;So;0;ON;;;;;N;;;;; +2BC1;BLACK DIAMOND CENTRED;So;0;ON;;;;;N;;;;; +2BC2;TURNED BLACK PENTAGON;So;0;ON;;;;;N;;;;; +2BC3;HORIZONTAL BLACK OCTAGON;So;0;ON;;;;;N;;;;; +2BC4;BLACK OCTAGON;So;0;ON;;;;;N;;;;; +2BC5;BLACK MEDIUM UP-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;; +2BC6;BLACK MEDIUM DOWN-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;; +2BC7;BLACK MEDIUM LEFT-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;; +2BC8;BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;; +2BCA;TOP HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;; +2BCB;BOTTOM HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;; +2BCC;LIGHT FOUR POINTED BLACK CUSP;So;0;ON;;;;;N;;;;; +2BCD;ROTATED LIGHT FOUR POINTED BLACK CUSP;So;0;ON;;;;;N;;;;; +2BCE;WHITE FOUR POINTED CUSP;So;0;ON;;;;;N;;;;; +2BCF;ROTATED WHITE FOUR POINTED CUSP;So;0;ON;;;;;N;;;;; +2BD0;SQUARE POSITION INDICATOR;So;0;ON;;;;;N;;;;; +2BD1;UNCERTAINTY SIGN;So;0;ON;;;;;N;;;;; +2BD2;GROUP MARK;So;0;ON;;;;;N;;;;; +2BEC;LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; +2BED;UPWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; +2BEE;RIGHTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; +2BEF;DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS;So;0;ON;;;;;N;;;;; +2C00;GLAGOLITIC CAPITAL LETTER AZU;Lu;0;L;;;;;N;;;;2C30; +2C01;GLAGOLITIC CAPITAL LETTER BUKY;Lu;0;L;;;;;N;;;;2C31; +2C02;GLAGOLITIC CAPITAL LETTER VEDE;Lu;0;L;;;;;N;;;;2C32; +2C03;GLAGOLITIC CAPITAL LETTER GLAGOLI;Lu;0;L;;;;;N;;;;2C33; +2C04;GLAGOLITIC CAPITAL LETTER DOBRO;Lu;0;L;;;;;N;;;;2C34; +2C05;GLAGOLITIC CAPITAL LETTER YESTU;Lu;0;L;;;;;N;;;;2C35; +2C06;GLAGOLITIC CAPITAL LETTER ZHIVETE;Lu;0;L;;;;;N;;;;2C36; +2C07;GLAGOLITIC CAPITAL LETTER DZELO;Lu;0;L;;;;;N;;;;2C37; +2C08;GLAGOLITIC CAPITAL LETTER ZEMLJA;Lu;0;L;;;;;N;;;;2C38; +2C09;GLAGOLITIC CAPITAL LETTER IZHE;Lu;0;L;;;;;N;;;;2C39; +2C0A;GLAGOLITIC CAPITAL LETTER INITIAL IZHE;Lu;0;L;;;;;N;;;;2C3A; +2C0B;GLAGOLITIC CAPITAL LETTER I;Lu;0;L;;;;;N;;;;2C3B; +2C0C;GLAGOLITIC CAPITAL LETTER DJERVI;Lu;0;L;;;;;N;;;;2C3C; +2C0D;GLAGOLITIC CAPITAL LETTER KAKO;Lu;0;L;;;;;N;;;;2C3D; +2C0E;GLAGOLITIC CAPITAL LETTER LJUDIJE;Lu;0;L;;;;;N;;;;2C3E; +2C0F;GLAGOLITIC CAPITAL LETTER MYSLITE;Lu;0;L;;;;;N;;;;2C3F; +2C10;GLAGOLITIC CAPITAL LETTER NASHI;Lu;0;L;;;;;N;;;;2C40; +2C11;GLAGOLITIC CAPITAL LETTER ONU;Lu;0;L;;;;;N;;;;2C41; +2C12;GLAGOLITIC CAPITAL LETTER POKOJI;Lu;0;L;;;;;N;;;;2C42; +2C13;GLAGOLITIC CAPITAL LETTER RITSI;Lu;0;L;;;;;N;;;;2C43; +2C14;GLAGOLITIC CAPITAL LETTER SLOVO;Lu;0;L;;;;;N;;;;2C44; +2C15;GLAGOLITIC CAPITAL LETTER TVRIDO;Lu;0;L;;;;;N;;;;2C45; +2C16;GLAGOLITIC CAPITAL LETTER UKU;Lu;0;L;;;;;N;;;;2C46; +2C17;GLAGOLITIC CAPITAL LETTER FRITU;Lu;0;L;;;;;N;;;;2C47; +2C18;GLAGOLITIC CAPITAL LETTER HERU;Lu;0;L;;;;;N;;;;2C48; +2C19;GLAGOLITIC CAPITAL LETTER OTU;Lu;0;L;;;;;N;;;;2C49; +2C1A;GLAGOLITIC CAPITAL LETTER PE;Lu;0;L;;;;;N;;;;2C4A; +2C1B;GLAGOLITIC CAPITAL LETTER SHTA;Lu;0;L;;;;;N;;;;2C4B; +2C1C;GLAGOLITIC CAPITAL LETTER TSI;Lu;0;L;;;;;N;;;;2C4C; +2C1D;GLAGOLITIC CAPITAL LETTER CHRIVI;Lu;0;L;;;;;N;;;;2C4D; +2C1E;GLAGOLITIC CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;2C4E; +2C1F;GLAGOLITIC CAPITAL LETTER YERU;Lu;0;L;;;;;N;;;;2C4F; +2C20;GLAGOLITIC CAPITAL LETTER YERI;Lu;0;L;;;;;N;;;;2C50; +2C21;GLAGOLITIC CAPITAL LETTER YATI;Lu;0;L;;;;;N;;;;2C51; +2C22;GLAGOLITIC CAPITAL LETTER SPIDERY HA;Lu;0;L;;;;;N;;;;2C52; +2C23;GLAGOLITIC CAPITAL LETTER YU;Lu;0;L;;;;;N;;;;2C53; +2C24;GLAGOLITIC CAPITAL LETTER SMALL YUS;Lu;0;L;;;;;N;;;;2C54; +2C25;GLAGOLITIC CAPITAL LETTER SMALL YUS WITH TAIL;Lu;0;L;;;;;N;;;;2C55; +2C26;GLAGOLITIC CAPITAL LETTER YO;Lu;0;L;;;;;N;;;;2C56; +2C27;GLAGOLITIC CAPITAL LETTER IOTATED SMALL YUS;Lu;0;L;;;;;N;;;;2C57; +2C28;GLAGOLITIC CAPITAL LETTER BIG YUS;Lu;0;L;;;;;N;;;;2C58; +2C29;GLAGOLITIC CAPITAL LETTER IOTATED BIG YUS;Lu;0;L;;;;;N;;;;2C59; +2C2A;GLAGOLITIC CAPITAL LETTER FITA;Lu;0;L;;;;;N;;;;2C5A; +2C2B;GLAGOLITIC CAPITAL LETTER IZHITSA;Lu;0;L;;;;;N;;;;2C5B; +2C2C;GLAGOLITIC CAPITAL LETTER SHTAPIC;Lu;0;L;;;;;N;;;;2C5C; +2C2D;GLAGOLITIC CAPITAL LETTER TROKUTASTI A;Lu;0;L;;;;;N;;;;2C5D; +2C2E;GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE;Lu;0;L;;;;;N;;;;2C5E; +2C30;GLAGOLITIC SMALL LETTER AZU;Ll;0;L;;;;;N;;;2C00;;2C00 +2C31;GLAGOLITIC SMALL LETTER BUKY;Ll;0;L;;;;;N;;;2C01;;2C01 +2C32;GLAGOLITIC SMALL LETTER VEDE;Ll;0;L;;;;;N;;;2C02;;2C02 +2C33;GLAGOLITIC SMALL LETTER GLAGOLI;Ll;0;L;;;;;N;;;2C03;;2C03 +2C34;GLAGOLITIC SMALL LETTER DOBRO;Ll;0;L;;;;;N;;;2C04;;2C04 +2C35;GLAGOLITIC SMALL LETTER YESTU;Ll;0;L;;;;;N;;;2C05;;2C05 +2C36;GLAGOLITIC SMALL LETTER ZHIVETE;Ll;0;L;;;;;N;;;2C06;;2C06 +2C37;GLAGOLITIC SMALL LETTER DZELO;Ll;0;L;;;;;N;;;2C07;;2C07 +2C38;GLAGOLITIC SMALL LETTER ZEMLJA;Ll;0;L;;;;;N;;;2C08;;2C08 +2C39;GLAGOLITIC SMALL LETTER IZHE;Ll;0;L;;;;;N;;;2C09;;2C09 +2C3A;GLAGOLITIC SMALL LETTER INITIAL IZHE;Ll;0;L;;;;;N;;;2C0A;;2C0A +2C3B;GLAGOLITIC SMALL LETTER I;Ll;0;L;;;;;N;;;2C0B;;2C0B +2C3C;GLAGOLITIC SMALL LETTER DJERVI;Ll;0;L;;;;;N;;;2C0C;;2C0C +2C3D;GLAGOLITIC SMALL LETTER KAKO;Ll;0;L;;;;;N;;;2C0D;;2C0D +2C3E;GLAGOLITIC SMALL LETTER LJUDIJE;Ll;0;L;;;;;N;;;2C0E;;2C0E +2C3F;GLAGOLITIC SMALL LETTER MYSLITE;Ll;0;L;;;;;N;;;2C0F;;2C0F +2C40;GLAGOLITIC SMALL LETTER NASHI;Ll;0;L;;;;;N;;;2C10;;2C10 +2C41;GLAGOLITIC SMALL LETTER ONU;Ll;0;L;;;;;N;;;2C11;;2C11 +2C42;GLAGOLITIC SMALL LETTER POKOJI;Ll;0;L;;;;;N;;;2C12;;2C12 +2C43;GLAGOLITIC SMALL LETTER RITSI;Ll;0;L;;;;;N;;;2C13;;2C13 +2C44;GLAGOLITIC SMALL LETTER SLOVO;Ll;0;L;;;;;N;;;2C14;;2C14 +2C45;GLAGOLITIC SMALL LETTER TVRIDO;Ll;0;L;;;;;N;;;2C15;;2C15 +2C46;GLAGOLITIC SMALL LETTER UKU;Ll;0;L;;;;;N;;;2C16;;2C16 +2C47;GLAGOLITIC SMALL LETTER FRITU;Ll;0;L;;;;;N;;;2C17;;2C17 +2C48;GLAGOLITIC SMALL LETTER HERU;Ll;0;L;;;;;N;;;2C18;;2C18 +2C49;GLAGOLITIC SMALL LETTER OTU;Ll;0;L;;;;;N;;;2C19;;2C19 +2C4A;GLAGOLITIC SMALL LETTER PE;Ll;0;L;;;;;N;;;2C1A;;2C1A +2C4B;GLAGOLITIC SMALL LETTER SHTA;Ll;0;L;;;;;N;;;2C1B;;2C1B +2C4C;GLAGOLITIC SMALL LETTER TSI;Ll;0;L;;;;;N;;;2C1C;;2C1C +2C4D;GLAGOLITIC SMALL LETTER CHRIVI;Ll;0;L;;;;;N;;;2C1D;;2C1D +2C4E;GLAGOLITIC SMALL LETTER SHA;Ll;0;L;;;;;N;;;2C1E;;2C1E +2C4F;GLAGOLITIC SMALL LETTER YERU;Ll;0;L;;;;;N;;;2C1F;;2C1F +2C50;GLAGOLITIC SMALL LETTER YERI;Ll;0;L;;;;;N;;;2C20;;2C20 +2C51;GLAGOLITIC SMALL LETTER YATI;Ll;0;L;;;;;N;;;2C21;;2C21 +2C52;GLAGOLITIC SMALL LETTER SPIDERY HA;Ll;0;L;;;;;N;;;2C22;;2C22 +2C53;GLAGOLITIC SMALL LETTER YU;Ll;0;L;;;;;N;;;2C23;;2C23 +2C54;GLAGOLITIC SMALL LETTER SMALL YUS;Ll;0;L;;;;;N;;;2C24;;2C24 +2C55;GLAGOLITIC SMALL LETTER SMALL YUS WITH TAIL;Ll;0;L;;;;;N;;;2C25;;2C25 +2C56;GLAGOLITIC SMALL LETTER YO;Ll;0;L;;;;;N;;;2C26;;2C26 +2C57;GLAGOLITIC SMALL LETTER IOTATED SMALL YUS;Ll;0;L;;;;;N;;;2C27;;2C27 +2C58;GLAGOLITIC SMALL LETTER BIG YUS;Ll;0;L;;;;;N;;;2C28;;2C28 +2C59;GLAGOLITIC SMALL LETTER IOTATED BIG YUS;Ll;0;L;;;;;N;;;2C29;;2C29 +2C5A;GLAGOLITIC SMALL LETTER FITA;Ll;0;L;;;;;N;;;2C2A;;2C2A +2C5B;GLAGOLITIC SMALL LETTER IZHITSA;Ll;0;L;;;;;N;;;2C2B;;2C2B +2C5C;GLAGOLITIC SMALL LETTER SHTAPIC;Ll;0;L;;;;;N;;;2C2C;;2C2C +2C5D;GLAGOLITIC SMALL LETTER TROKUTASTI A;Ll;0;L;;;;;N;;;2C2D;;2C2D +2C5E;GLAGOLITIC SMALL LETTER LATINATE MYSLITE;Ll;0;L;;;;;N;;;2C2E;;2C2E +2C60;LATIN CAPITAL LETTER L WITH DOUBLE BAR;Lu;0;L;;;;;N;;;;2C61; +2C61;LATIN SMALL LETTER L WITH DOUBLE BAR;Ll;0;L;;;;;N;;;2C60;;2C60 +2C62;LATIN CAPITAL LETTER L WITH MIDDLE TILDE;Lu;0;L;;;;;N;;;;026B; +2C63;LATIN CAPITAL LETTER P WITH STROKE;Lu;0;L;;;;;N;;;;1D7D; +2C64;LATIN CAPITAL LETTER R WITH TAIL;Lu;0;L;;;;;N;;;;027D; +2C65;LATIN SMALL LETTER A WITH STROKE;Ll;0;L;;;;;N;;;023A;;023A +2C66;LATIN SMALL LETTER T WITH DIAGONAL STROKE;Ll;0;L;;;;;N;;;023E;;023E +2C67;LATIN CAPITAL LETTER H WITH DESCENDER;Lu;0;L;;;;;N;;;;2C68; +2C68;LATIN SMALL LETTER H WITH DESCENDER;Ll;0;L;;;;;N;;;2C67;;2C67 +2C69;LATIN CAPITAL LETTER K WITH DESCENDER;Lu;0;L;;;;;N;;;;2C6A; +2C6A;LATIN SMALL LETTER K WITH DESCENDER;Ll;0;L;;;;;N;;;2C69;;2C69 +2C6B;LATIN CAPITAL LETTER Z WITH DESCENDER;Lu;0;L;;;;;N;;;;2C6C; +2C6C;LATIN SMALL LETTER Z WITH DESCENDER;Ll;0;L;;;;;N;;;2C6B;;2C6B +2C6D;LATIN CAPITAL LETTER ALPHA;Lu;0;L;;;;;N;;;;0251; +2C6E;LATIN CAPITAL LETTER M WITH HOOK;Lu;0;L;;;;;N;;;;0271; +2C6F;LATIN CAPITAL LETTER TURNED A;Lu;0;L;;;;;N;;;;0250; +2C70;LATIN CAPITAL LETTER TURNED ALPHA;Lu;0;L;;;;;N;;;;0252; +2C71;LATIN SMALL LETTER V WITH RIGHT HOOK;Ll;0;L;;;;;N;;;;; +2C72;LATIN CAPITAL LETTER W WITH HOOK;Lu;0;L;;;;;N;;;;2C73; +2C73;LATIN SMALL LETTER W WITH HOOK;Ll;0;L;;;;;N;;;2C72;;2C72 +2C74;LATIN SMALL LETTER V WITH CURL;Ll;0;L;;;;;N;;;;; +2C75;LATIN CAPITAL LETTER HALF H;Lu;0;L;;;;;N;;;;2C76; +2C76;LATIN SMALL LETTER HALF H;Ll;0;L;;;;;N;;;2C75;;2C75 +2C77;LATIN SMALL LETTER TAILLESS PHI;Ll;0;L;;;;;N;;;;; +2C78;LATIN SMALL LETTER E WITH NOTCH;Ll;0;L;;;;;N;;;;; +2C79;LATIN SMALL LETTER TURNED R WITH TAIL;Ll;0;L;;;;;N;;;;; +2C7A;LATIN SMALL LETTER O WITH LOW RING INSIDE;Ll;0;L;;;;;N;;;;; +2C7B;LATIN LETTER SMALL CAPITAL TURNED E;Ll;0;L;;;;;N;;;;; +2C7C;LATIN SUBSCRIPT SMALL LETTER J;Lm;0;L;<sub> 006A;;;;N;;;;; +2C7D;MODIFIER LETTER CAPITAL V;Lm;0;L;<super> 0056;;;;N;;;;; +2C7E;LATIN CAPITAL LETTER S WITH SWASH TAIL;Lu;0;L;;;;;N;;;;023F; +2C7F;LATIN CAPITAL LETTER Z WITH SWASH TAIL;Lu;0;L;;;;;N;;;;0240; +2C80;COPTIC CAPITAL LETTER ALFA;Lu;0;L;;;;;N;;;;2C81; +2C81;COPTIC SMALL LETTER ALFA;Ll;0;L;;;;;N;;;2C80;;2C80 +2C82;COPTIC CAPITAL LETTER VIDA;Lu;0;L;;;;;N;;;;2C83; +2C83;COPTIC SMALL LETTER VIDA;Ll;0;L;;;;;N;;;2C82;;2C82 +2C84;COPTIC CAPITAL LETTER GAMMA;Lu;0;L;;;;;N;;;;2C85; +2C85;COPTIC SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;2C84;;2C84 +2C86;COPTIC CAPITAL LETTER DALDA;Lu;0;L;;;;;N;;;;2C87; +2C87;COPTIC SMALL LETTER DALDA;Ll;0;L;;;;;N;;;2C86;;2C86 +2C88;COPTIC CAPITAL LETTER EIE;Lu;0;L;;;;;N;;;;2C89; +2C89;COPTIC SMALL LETTER EIE;Ll;0;L;;;;;N;;;2C88;;2C88 +2C8A;COPTIC CAPITAL LETTER SOU;Lu;0;L;;;;;N;;;;2C8B; +2C8B;COPTIC SMALL LETTER SOU;Ll;0;L;;;;;N;;;2C8A;;2C8A +2C8C;COPTIC CAPITAL LETTER ZATA;Lu;0;L;;;;;N;;;;2C8D; +2C8D;COPTIC SMALL LETTER ZATA;Ll;0;L;;;;;N;;;2C8C;;2C8C +2C8E;COPTIC CAPITAL LETTER HATE;Lu;0;L;;;;;N;;;;2C8F; +2C8F;COPTIC SMALL LETTER HATE;Ll;0;L;;;;;N;;;2C8E;;2C8E +2C90;COPTIC CAPITAL LETTER THETHE;Lu;0;L;;;;;N;;;;2C91; +2C91;COPTIC SMALL LETTER THETHE;Ll;0;L;;;;;N;;;2C90;;2C90 +2C92;COPTIC CAPITAL LETTER IAUDA;Lu;0;L;;;;;N;;;;2C93; +2C93;COPTIC SMALL LETTER IAUDA;Ll;0;L;;;;;N;;;2C92;;2C92 +2C94;COPTIC CAPITAL LETTER KAPA;Lu;0;L;;;;;N;;;;2C95; +2C95;COPTIC SMALL LETTER KAPA;Ll;0;L;;;;;N;;;2C94;;2C94 +2C96;COPTIC CAPITAL LETTER LAULA;Lu;0;L;;;;;N;;;;2C97; +2C97;COPTIC SMALL LETTER LAULA;Ll;0;L;;;;;N;;;2C96;;2C96 +2C98;COPTIC CAPITAL LETTER MI;Lu;0;L;;;;;N;;;;2C99; +2C99;COPTIC SMALL LETTER MI;Ll;0;L;;;;;N;;;2C98;;2C98 +2C9A;COPTIC CAPITAL LETTER NI;Lu;0;L;;;;;N;;;;2C9B; +2C9B;COPTIC SMALL LETTER NI;Ll;0;L;;;;;N;;;2C9A;;2C9A +2C9C;COPTIC CAPITAL LETTER KSI;Lu;0;L;;;;;N;;;;2C9D; +2C9D;COPTIC SMALL LETTER KSI;Ll;0;L;;;;;N;;;2C9C;;2C9C +2C9E;COPTIC CAPITAL LETTER O;Lu;0;L;;;;;N;;;;2C9F; +2C9F;COPTIC SMALL LETTER O;Ll;0;L;;;;;N;;;2C9E;;2C9E +2CA0;COPTIC CAPITAL LETTER PI;Lu;0;L;;;;;N;;;;2CA1; +2CA1;COPTIC SMALL LETTER PI;Ll;0;L;;;;;N;;;2CA0;;2CA0 +2CA2;COPTIC CAPITAL LETTER RO;Lu;0;L;;;;;N;;;;2CA3; +2CA3;COPTIC SMALL LETTER RO;Ll;0;L;;;;;N;;;2CA2;;2CA2 +2CA4;COPTIC CAPITAL LETTER SIMA;Lu;0;L;;;;;N;;;;2CA5; +2CA5;COPTIC SMALL LETTER SIMA;Ll;0;L;;;;;N;;;2CA4;;2CA4 +2CA6;COPTIC CAPITAL LETTER TAU;Lu;0;L;;;;;N;;;;2CA7; +2CA7;COPTIC SMALL LETTER TAU;Ll;0;L;;;;;N;;;2CA6;;2CA6 +2CA8;COPTIC CAPITAL LETTER UA;Lu;0;L;;;;;N;;;;2CA9; +2CA9;COPTIC SMALL LETTER UA;Ll;0;L;;;;;N;;;2CA8;;2CA8 +2CAA;COPTIC CAPITAL LETTER FI;Lu;0;L;;;;;N;;;;2CAB; +2CAB;COPTIC SMALL LETTER FI;Ll;0;L;;;;;N;;;2CAA;;2CAA +2CAC;COPTIC CAPITAL LETTER KHI;Lu;0;L;;;;;N;;;;2CAD; +2CAD;COPTIC SMALL LETTER KHI;Ll;0;L;;;;;N;;;2CAC;;2CAC +2CAE;COPTIC CAPITAL LETTER PSI;Lu;0;L;;;;;N;;;;2CAF; +2CAF;COPTIC SMALL LETTER PSI;Ll;0;L;;;;;N;;;2CAE;;2CAE +2CB0;COPTIC CAPITAL LETTER OOU;Lu;0;L;;;;;N;;;;2CB1; +2CB1;COPTIC SMALL LETTER OOU;Ll;0;L;;;;;N;;;2CB0;;2CB0 +2CB2;COPTIC CAPITAL LETTER DIALECT-P ALEF;Lu;0;L;;;;;N;;;;2CB3; +2CB3;COPTIC SMALL LETTER DIALECT-P ALEF;Ll;0;L;;;;;N;;;2CB2;;2CB2 +2CB4;COPTIC CAPITAL LETTER OLD COPTIC AIN;Lu;0;L;;;;;N;;;;2CB5; +2CB5;COPTIC SMALL LETTER OLD COPTIC AIN;Ll;0;L;;;;;N;;;2CB4;;2CB4 +2CB6;COPTIC CAPITAL LETTER CRYPTOGRAMMIC EIE;Lu;0;L;;;;;N;;;;2CB7; +2CB7;COPTIC SMALL LETTER CRYPTOGRAMMIC EIE;Ll;0;L;;;;;N;;;2CB6;;2CB6 +2CB8;COPTIC CAPITAL LETTER DIALECT-P KAPA;Lu;0;L;;;;;N;;;;2CB9; +2CB9;COPTIC SMALL LETTER DIALECT-P KAPA;Ll;0;L;;;;;N;;;2CB8;;2CB8 +2CBA;COPTIC CAPITAL LETTER DIALECT-P NI;Lu;0;L;;;;;N;;;;2CBB; +2CBB;COPTIC SMALL LETTER DIALECT-P NI;Ll;0;L;;;;;N;;;2CBA;;2CBA +2CBC;COPTIC CAPITAL LETTER CRYPTOGRAMMIC NI;Lu;0;L;;;;;N;;;;2CBD; +2CBD;COPTIC SMALL LETTER CRYPTOGRAMMIC NI;Ll;0;L;;;;;N;;;2CBC;;2CBC +2CBE;COPTIC CAPITAL LETTER OLD COPTIC OOU;Lu;0;L;;;;;N;;;;2CBF; +2CBF;COPTIC SMALL LETTER OLD COPTIC OOU;Ll;0;L;;;;;N;;;2CBE;;2CBE +2CC0;COPTIC CAPITAL LETTER SAMPI;Lu;0;L;;;;;N;;;;2CC1; +2CC1;COPTIC SMALL LETTER SAMPI;Ll;0;L;;;;;N;;;2CC0;;2CC0 +2CC2;COPTIC CAPITAL LETTER CROSSED SHEI;Lu;0;L;;;;;N;;;;2CC3; +2CC3;COPTIC SMALL LETTER CROSSED SHEI;Ll;0;L;;;;;N;;;2CC2;;2CC2 +2CC4;COPTIC CAPITAL LETTER OLD COPTIC SHEI;Lu;0;L;;;;;N;;;;2CC5; +2CC5;COPTIC SMALL LETTER OLD COPTIC SHEI;Ll;0;L;;;;;N;;;2CC4;;2CC4 +2CC6;COPTIC CAPITAL LETTER OLD COPTIC ESH;Lu;0;L;;;;;N;;;;2CC7; +2CC7;COPTIC SMALL LETTER OLD COPTIC ESH;Ll;0;L;;;;;N;;;2CC6;;2CC6 +2CC8;COPTIC CAPITAL LETTER AKHMIMIC KHEI;Lu;0;L;;;;;N;;;;2CC9; +2CC9;COPTIC SMALL LETTER AKHMIMIC KHEI;Ll;0;L;;;;;N;;;2CC8;;2CC8 +2CCA;COPTIC CAPITAL LETTER DIALECT-P HORI;Lu;0;L;;;;;N;;;;2CCB; +2CCB;COPTIC SMALL LETTER DIALECT-P HORI;Ll;0;L;;;;;N;;;2CCA;;2CCA +2CCC;COPTIC CAPITAL LETTER OLD COPTIC HORI;Lu;0;L;;;;;N;;;;2CCD; +2CCD;COPTIC SMALL LETTER OLD COPTIC HORI;Ll;0;L;;;;;N;;;2CCC;;2CCC +2CCE;COPTIC CAPITAL LETTER OLD COPTIC HA;Lu;0;L;;;;;N;;;;2CCF; +2CCF;COPTIC SMALL LETTER OLD COPTIC HA;Ll;0;L;;;;;N;;;2CCE;;2CCE +2CD0;COPTIC CAPITAL LETTER L-SHAPED HA;Lu;0;L;;;;;N;;;;2CD1; +2CD1;COPTIC SMALL LETTER L-SHAPED HA;Ll;0;L;;;;;N;;;2CD0;;2CD0 +2CD2;COPTIC CAPITAL LETTER OLD COPTIC HEI;Lu;0;L;;;;;N;;;;2CD3; +2CD3;COPTIC SMALL LETTER OLD COPTIC HEI;Ll;0;L;;;;;N;;;2CD2;;2CD2 +2CD4;COPTIC CAPITAL LETTER OLD COPTIC HAT;Lu;0;L;;;;;N;;;;2CD5; +2CD5;COPTIC SMALL LETTER OLD COPTIC HAT;Ll;0;L;;;;;N;;;2CD4;;2CD4 +2CD6;COPTIC CAPITAL LETTER OLD COPTIC GANGIA;Lu;0;L;;;;;N;;;;2CD7; +2CD7;COPTIC SMALL LETTER OLD COPTIC GANGIA;Ll;0;L;;;;;N;;;2CD6;;2CD6 +2CD8;COPTIC CAPITAL LETTER OLD COPTIC DJA;Lu;0;L;;;;;N;;;;2CD9; +2CD9;COPTIC SMALL LETTER OLD COPTIC DJA;Ll;0;L;;;;;N;;;2CD8;;2CD8 +2CDA;COPTIC CAPITAL LETTER OLD COPTIC SHIMA;Lu;0;L;;;;;N;;;;2CDB; +2CDB;COPTIC SMALL LETTER OLD COPTIC SHIMA;Ll;0;L;;;;;N;;;2CDA;;2CDA +2CDC;COPTIC CAPITAL LETTER OLD NUBIAN SHIMA;Lu;0;L;;;;;N;;;;2CDD; +2CDD;COPTIC SMALL LETTER OLD NUBIAN SHIMA;Ll;0;L;;;;;N;;;2CDC;;2CDC +2CDE;COPTIC CAPITAL LETTER OLD NUBIAN NGI;Lu;0;L;;;;;N;;;;2CDF; +2CDF;COPTIC SMALL LETTER OLD NUBIAN NGI;Ll;0;L;;;;;N;;;2CDE;;2CDE +2CE0;COPTIC CAPITAL LETTER OLD NUBIAN NYI;Lu;0;L;;;;;N;;;;2CE1; +2CE1;COPTIC SMALL LETTER OLD NUBIAN NYI;Ll;0;L;;;;;N;;;2CE0;;2CE0 +2CE2;COPTIC CAPITAL LETTER OLD NUBIAN WAU;Lu;0;L;;;;;N;;;;2CE3; +2CE3;COPTIC SMALL LETTER OLD NUBIAN WAU;Ll;0;L;;;;;N;;;2CE2;;2CE2 +2CE4;COPTIC SYMBOL KAI;Ll;0;L;;;;;N;;;;; +2CE5;COPTIC SYMBOL MI RO;So;0;ON;;;;;N;;;;; +2CE6;COPTIC SYMBOL PI RO;So;0;ON;;;;;N;;;;; +2CE7;COPTIC SYMBOL STAUROS;So;0;ON;;;;;N;;;;; +2CE8;COPTIC SYMBOL TAU RO;So;0;ON;;;;;N;;;;; +2CE9;COPTIC SYMBOL KHI RO;So;0;ON;;;;;N;;;;; +2CEA;COPTIC SYMBOL SHIMA SIMA;So;0;ON;;;;;N;;;;; +2CEB;COPTIC CAPITAL LETTER CRYPTOGRAMMIC SHEI;Lu;0;L;;;;;N;;;;2CEC; +2CEC;COPTIC SMALL LETTER CRYPTOGRAMMIC SHEI;Ll;0;L;;;;;N;;;2CEB;;2CEB +2CED;COPTIC CAPITAL LETTER CRYPTOGRAMMIC GANGIA;Lu;0;L;;;;;N;;;;2CEE; +2CEE;COPTIC SMALL LETTER CRYPTOGRAMMIC GANGIA;Ll;0;L;;;;;N;;;2CED;;2CED +2CEF;COPTIC COMBINING NI ABOVE;Mn;230;NSM;;;;;N;;;;; +2CF0;COPTIC COMBINING SPIRITUS ASPER;Mn;230;NSM;;;;;N;;;;; +2CF1;COPTIC COMBINING SPIRITUS LENIS;Mn;230;NSM;;;;;N;;;;; +2CF2;COPTIC CAPITAL LETTER BOHAIRIC KHEI;Lu;0;L;;;;;N;;;;2CF3; +2CF3;COPTIC SMALL LETTER BOHAIRIC KHEI;Ll;0;L;;;;;N;;;2CF2;;2CF2 +2CF9;COPTIC OLD NUBIAN FULL STOP;Po;0;ON;;;;;N;;;;; +2CFA;COPTIC OLD NUBIAN DIRECT QUESTION MARK;Po;0;ON;;;;;N;;;;; +2CFB;COPTIC OLD NUBIAN INDIRECT QUESTION MARK;Po;0;ON;;;;;N;;;;; +2CFC;COPTIC OLD NUBIAN VERSE DIVIDER;Po;0;ON;;;;;N;;;;; +2CFD;COPTIC FRACTION ONE HALF;No;0;ON;;;;1/2;N;;;;; +2CFE;COPTIC FULL STOP;Po;0;ON;;;;;N;;;;; +2CFF;COPTIC MORPHOLOGICAL DIVIDER;Po;0;ON;;;;;N;;;;; +2D00;GEORGIAN SMALL LETTER AN;Ll;0;L;;;;;N;;;10A0;;10A0 +2D01;GEORGIAN SMALL LETTER BAN;Ll;0;L;;;;;N;;;10A1;;10A1 +2D02;GEORGIAN SMALL LETTER GAN;Ll;0;L;;;;;N;;;10A2;;10A2 +2D03;GEORGIAN SMALL LETTER DON;Ll;0;L;;;;;N;;;10A3;;10A3 +2D04;GEORGIAN SMALL LETTER EN;Ll;0;L;;;;;N;;;10A4;;10A4 +2D05;GEORGIAN SMALL LETTER VIN;Ll;0;L;;;;;N;;;10A5;;10A5 +2D06;GEORGIAN SMALL LETTER ZEN;Ll;0;L;;;;;N;;;10A6;;10A6 +2D07;GEORGIAN SMALL LETTER TAN;Ll;0;L;;;;;N;;;10A7;;10A7 +2D08;GEORGIAN SMALL LETTER IN;Ll;0;L;;;;;N;;;10A8;;10A8 +2D09;GEORGIAN SMALL LETTER KAN;Ll;0;L;;;;;N;;;10A9;;10A9 +2D0A;GEORGIAN SMALL LETTER LAS;Ll;0;L;;;;;N;;;10AA;;10AA +2D0B;GEORGIAN SMALL LETTER MAN;Ll;0;L;;;;;N;;;10AB;;10AB +2D0C;GEORGIAN SMALL LETTER NAR;Ll;0;L;;;;;N;;;10AC;;10AC +2D0D;GEORGIAN SMALL LETTER ON;Ll;0;L;;;;;N;;;10AD;;10AD +2D0E;GEORGIAN SMALL LETTER PAR;Ll;0;L;;;;;N;;;10AE;;10AE +2D0F;GEORGIAN SMALL LETTER ZHAR;Ll;0;L;;;;;N;;;10AF;;10AF +2D10;GEORGIAN SMALL LETTER RAE;Ll;0;L;;;;;N;;;10B0;;10B0 +2D11;GEORGIAN SMALL LETTER SAN;Ll;0;L;;;;;N;;;10B1;;10B1 +2D12;GEORGIAN SMALL LETTER TAR;Ll;0;L;;;;;N;;;10B2;;10B2 +2D13;GEORGIAN SMALL LETTER UN;Ll;0;L;;;;;N;;;10B3;;10B3 +2D14;GEORGIAN SMALL LETTER PHAR;Ll;0;L;;;;;N;;;10B4;;10B4 +2D15;GEORGIAN SMALL LETTER KHAR;Ll;0;L;;;;;N;;;10B5;;10B5 +2D16;GEORGIAN SMALL LETTER GHAN;Ll;0;L;;;;;N;;;10B6;;10B6 +2D17;GEORGIAN SMALL LETTER QAR;Ll;0;L;;;;;N;;;10B7;;10B7 +2D18;GEORGIAN SMALL LETTER SHIN;Ll;0;L;;;;;N;;;10B8;;10B8 +2D19;GEORGIAN SMALL LETTER CHIN;Ll;0;L;;;;;N;;;10B9;;10B9 +2D1A;GEORGIAN SMALL LETTER CAN;Ll;0;L;;;;;N;;;10BA;;10BA +2D1B;GEORGIAN SMALL LETTER JIL;Ll;0;L;;;;;N;;;10BB;;10BB +2D1C;GEORGIAN SMALL LETTER CIL;Ll;0;L;;;;;N;;;10BC;;10BC +2D1D;GEORGIAN SMALL LETTER CHAR;Ll;0;L;;;;;N;;;10BD;;10BD +2D1E;GEORGIAN SMALL LETTER XAN;Ll;0;L;;;;;N;;;10BE;;10BE +2D1F;GEORGIAN SMALL LETTER JHAN;Ll;0;L;;;;;N;;;10BF;;10BF +2D20;GEORGIAN SMALL LETTER HAE;Ll;0;L;;;;;N;;;10C0;;10C0 +2D21;GEORGIAN SMALL LETTER HE;Ll;0;L;;;;;N;;;10C1;;10C1 +2D22;GEORGIAN SMALL LETTER HIE;Ll;0;L;;;;;N;;;10C2;;10C2 +2D23;GEORGIAN SMALL LETTER WE;Ll;0;L;;;;;N;;;10C3;;10C3 +2D24;GEORGIAN SMALL LETTER HAR;Ll;0;L;;;;;N;;;10C4;;10C4 +2D25;GEORGIAN SMALL LETTER HOE;Ll;0;L;;;;;N;;;10C5;;10C5 +2D27;GEORGIAN SMALL LETTER YN;Ll;0;L;;;;;N;;;10C7;;10C7 +2D2D;GEORGIAN SMALL LETTER AEN;Ll;0;L;;;;;N;;;10CD;;10CD +2D30;TIFINAGH LETTER YA;Lo;0;L;;;;;N;;;;; +2D31;TIFINAGH LETTER YAB;Lo;0;L;;;;;N;;;;; +2D32;TIFINAGH LETTER YABH;Lo;0;L;;;;;N;;;;; +2D33;TIFINAGH LETTER YAG;Lo;0;L;;;;;N;;;;; +2D34;TIFINAGH LETTER YAGHH;Lo;0;L;;;;;N;;;;; +2D35;TIFINAGH LETTER BERBER ACADEMY YAJ;Lo;0;L;;;;;N;;;;; +2D36;TIFINAGH LETTER YAJ;Lo;0;L;;;;;N;;;;; +2D37;TIFINAGH LETTER YAD;Lo;0;L;;;;;N;;;;; +2D38;TIFINAGH LETTER YADH;Lo;0;L;;;;;N;;;;; +2D39;TIFINAGH LETTER YADD;Lo;0;L;;;;;N;;;;; +2D3A;TIFINAGH LETTER YADDH;Lo;0;L;;;;;N;;;;; +2D3B;TIFINAGH LETTER YEY;Lo;0;L;;;;;N;;;;; +2D3C;TIFINAGH LETTER YAF;Lo;0;L;;;;;N;;;;; +2D3D;TIFINAGH LETTER YAK;Lo;0;L;;;;;N;;;;; +2D3E;TIFINAGH LETTER TUAREG YAK;Lo;0;L;;;;;N;;;;; +2D3F;TIFINAGH LETTER YAKHH;Lo;0;L;;;;;N;;;;; +2D40;TIFINAGH LETTER YAH;Lo;0;L;;;;;N;;;;; +2D41;TIFINAGH LETTER BERBER ACADEMY YAH;Lo;0;L;;;;;N;;;;; +2D42;TIFINAGH LETTER TUAREG YAH;Lo;0;L;;;;;N;;;;; +2D43;TIFINAGH LETTER YAHH;Lo;0;L;;;;;N;;;;; +2D44;TIFINAGH LETTER YAA;Lo;0;L;;;;;N;;;;; +2D45;TIFINAGH LETTER YAKH;Lo;0;L;;;;;N;;;;; +2D46;TIFINAGH LETTER TUAREG YAKH;Lo;0;L;;;;;N;;;;; +2D47;TIFINAGH LETTER YAQ;Lo;0;L;;;;;N;;;;; +2D48;TIFINAGH LETTER TUAREG YAQ;Lo;0;L;;;;;N;;;;; +2D49;TIFINAGH LETTER YI;Lo;0;L;;;;;N;;;;; +2D4A;TIFINAGH LETTER YAZH;Lo;0;L;;;;;N;;;;; +2D4B;TIFINAGH LETTER AHAGGAR YAZH;Lo;0;L;;;;;N;;;;; +2D4C;TIFINAGH LETTER TUAREG YAZH;Lo;0;L;;;;;N;;;;; +2D4D;TIFINAGH LETTER YAL;Lo;0;L;;;;;N;;;;; +2D4E;TIFINAGH LETTER YAM;Lo;0;L;;;;;N;;;;; +2D4F;TIFINAGH LETTER YAN;Lo;0;L;;;;;N;;;;; +2D50;TIFINAGH LETTER TUAREG YAGN;Lo;0;L;;;;;N;;;;; +2D51;TIFINAGH LETTER TUAREG YANG;Lo;0;L;;;;;N;;;;; +2D52;TIFINAGH LETTER YAP;Lo;0;L;;;;;N;;;;; +2D53;TIFINAGH LETTER YU;Lo;0;L;;;;;N;;;;; +2D54;TIFINAGH LETTER YAR;Lo;0;L;;;;;N;;;;; +2D55;TIFINAGH LETTER YARR;Lo;0;L;;;;;N;;;;; +2D56;TIFINAGH LETTER YAGH;Lo;0;L;;;;;N;;;;; +2D57;TIFINAGH LETTER TUAREG YAGH;Lo;0;L;;;;;N;;;;; +2D58;TIFINAGH LETTER AYER YAGH;Lo;0;L;;;;;N;;;;; +2D59;TIFINAGH LETTER YAS;Lo;0;L;;;;;N;;;;; +2D5A;TIFINAGH LETTER YASS;Lo;0;L;;;;;N;;;;; +2D5B;TIFINAGH LETTER YASH;Lo;0;L;;;;;N;;;;; +2D5C;TIFINAGH LETTER YAT;Lo;0;L;;;;;N;;;;; +2D5D;TIFINAGH LETTER YATH;Lo;0;L;;;;;N;;;;; +2D5E;TIFINAGH LETTER YACH;Lo;0;L;;;;;N;;;;; +2D5F;TIFINAGH LETTER YATT;Lo;0;L;;;;;N;;;;; +2D60;TIFINAGH LETTER YAV;Lo;0;L;;;;;N;;;;; +2D61;TIFINAGH LETTER YAW;Lo;0;L;;;;;N;;;;; +2D62;TIFINAGH LETTER YAY;Lo;0;L;;;;;N;;;;; +2D63;TIFINAGH LETTER YAZ;Lo;0;L;;;;;N;;;;; +2D64;TIFINAGH LETTER TAWELLEMET YAZ;Lo;0;L;;;;;N;;;;; +2D65;TIFINAGH LETTER YAZZ;Lo;0;L;;;;;N;;;;; +2D66;TIFINAGH LETTER YE;Lo;0;L;;;;;N;;;;; +2D67;TIFINAGH LETTER YO;Lo;0;L;;;;;N;;;;; +2D6F;TIFINAGH MODIFIER LETTER LABIALIZATION MARK;Lm;0;L;<super> 2D61;;;;N;;;;; +2D70;TIFINAGH SEPARATOR MARK;Po;0;L;;;;;N;;;;; +2D7F;TIFINAGH CONSONANT JOINER;Mn;9;NSM;;;;;N;;;;; +2D80;ETHIOPIC SYLLABLE LOA;Lo;0;L;;;;;N;;;;; +2D81;ETHIOPIC SYLLABLE MOA;Lo;0;L;;;;;N;;;;; +2D82;ETHIOPIC SYLLABLE ROA;Lo;0;L;;;;;N;;;;; +2D83;ETHIOPIC SYLLABLE SOA;Lo;0;L;;;;;N;;;;; +2D84;ETHIOPIC SYLLABLE SHOA;Lo;0;L;;;;;N;;;;; +2D85;ETHIOPIC SYLLABLE BOA;Lo;0;L;;;;;N;;;;; +2D86;ETHIOPIC SYLLABLE TOA;Lo;0;L;;;;;N;;;;; +2D87;ETHIOPIC SYLLABLE COA;Lo;0;L;;;;;N;;;;; +2D88;ETHIOPIC SYLLABLE NOA;Lo;0;L;;;;;N;;;;; +2D89;ETHIOPIC SYLLABLE NYOA;Lo;0;L;;;;;N;;;;; +2D8A;ETHIOPIC SYLLABLE GLOTTAL OA;Lo;0;L;;;;;N;;;;; +2D8B;ETHIOPIC SYLLABLE ZOA;Lo;0;L;;;;;N;;;;; +2D8C;ETHIOPIC SYLLABLE DOA;Lo;0;L;;;;;N;;;;; +2D8D;ETHIOPIC SYLLABLE DDOA;Lo;0;L;;;;;N;;;;; +2D8E;ETHIOPIC SYLLABLE JOA;Lo;0;L;;;;;N;;;;; +2D8F;ETHIOPIC SYLLABLE THOA;Lo;0;L;;;;;N;;;;; +2D90;ETHIOPIC SYLLABLE CHOA;Lo;0;L;;;;;N;;;;; +2D91;ETHIOPIC SYLLABLE PHOA;Lo;0;L;;;;;N;;;;; +2D92;ETHIOPIC SYLLABLE POA;Lo;0;L;;;;;N;;;;; +2D93;ETHIOPIC SYLLABLE GGWA;Lo;0;L;;;;;N;;;;; +2D94;ETHIOPIC SYLLABLE GGWI;Lo;0;L;;;;;N;;;;; +2D95;ETHIOPIC SYLLABLE GGWEE;Lo;0;L;;;;;N;;;;; +2D96;ETHIOPIC SYLLABLE GGWE;Lo;0;L;;;;;N;;;;; +2DA0;ETHIOPIC SYLLABLE SSA;Lo;0;L;;;;;N;;;;; +2DA1;ETHIOPIC SYLLABLE SSU;Lo;0;L;;;;;N;;;;; +2DA2;ETHIOPIC SYLLABLE SSI;Lo;0;L;;;;;N;;;;; +2DA3;ETHIOPIC SYLLABLE SSAA;Lo;0;L;;;;;N;;;;; +2DA4;ETHIOPIC SYLLABLE SSEE;Lo;0;L;;;;;N;;;;; +2DA5;ETHIOPIC SYLLABLE SSE;Lo;0;L;;;;;N;;;;; +2DA6;ETHIOPIC SYLLABLE SSO;Lo;0;L;;;;;N;;;;; +2DA8;ETHIOPIC SYLLABLE CCA;Lo;0;L;;;;;N;;;;; +2DA9;ETHIOPIC SYLLABLE CCU;Lo;0;L;;;;;N;;;;; +2DAA;ETHIOPIC SYLLABLE CCI;Lo;0;L;;;;;N;;;;; +2DAB;ETHIOPIC SYLLABLE CCAA;Lo;0;L;;;;;N;;;;; +2DAC;ETHIOPIC SYLLABLE CCEE;Lo;0;L;;;;;N;;;;; +2DAD;ETHIOPIC SYLLABLE CCE;Lo;0;L;;;;;N;;;;; +2DAE;ETHIOPIC SYLLABLE CCO;Lo;0;L;;;;;N;;;;; +2DB0;ETHIOPIC SYLLABLE ZZA;Lo;0;L;;;;;N;;;;; +2DB1;ETHIOPIC SYLLABLE ZZU;Lo;0;L;;;;;N;;;;; +2DB2;ETHIOPIC SYLLABLE ZZI;Lo;0;L;;;;;N;;;;; +2DB3;ETHIOPIC SYLLABLE ZZAA;Lo;0;L;;;;;N;;;;; +2DB4;ETHIOPIC SYLLABLE ZZEE;Lo;0;L;;;;;N;;;;; +2DB5;ETHIOPIC SYLLABLE ZZE;Lo;0;L;;;;;N;;;;; +2DB6;ETHIOPIC SYLLABLE ZZO;Lo;0;L;;;;;N;;;;; +2DB8;ETHIOPIC SYLLABLE CCHA;Lo;0;L;;;;;N;;;;; +2DB9;ETHIOPIC SYLLABLE CCHU;Lo;0;L;;;;;N;;;;; +2DBA;ETHIOPIC SYLLABLE CCHI;Lo;0;L;;;;;N;;;;; +2DBB;ETHIOPIC SYLLABLE CCHAA;Lo;0;L;;;;;N;;;;; +2DBC;ETHIOPIC SYLLABLE CCHEE;Lo;0;L;;;;;N;;;;; +2DBD;ETHIOPIC SYLLABLE CCHE;Lo;0;L;;;;;N;;;;; +2DBE;ETHIOPIC SYLLABLE CCHO;Lo;0;L;;;;;N;;;;; +2DC0;ETHIOPIC SYLLABLE QYA;Lo;0;L;;;;;N;;;;; +2DC1;ETHIOPIC SYLLABLE QYU;Lo;0;L;;;;;N;;;;; +2DC2;ETHIOPIC SYLLABLE QYI;Lo;0;L;;;;;N;;;;; +2DC3;ETHIOPIC SYLLABLE QYAA;Lo;0;L;;;;;N;;;;; +2DC4;ETHIOPIC SYLLABLE QYEE;Lo;0;L;;;;;N;;;;; +2DC5;ETHIOPIC SYLLABLE QYE;Lo;0;L;;;;;N;;;;; +2DC6;ETHIOPIC SYLLABLE QYO;Lo;0;L;;;;;N;;;;; +2DC8;ETHIOPIC SYLLABLE KYA;Lo;0;L;;;;;N;;;;; +2DC9;ETHIOPIC SYLLABLE KYU;Lo;0;L;;;;;N;;;;; +2DCA;ETHIOPIC SYLLABLE KYI;Lo;0;L;;;;;N;;;;; +2DCB;ETHIOPIC SYLLABLE KYAA;Lo;0;L;;;;;N;;;;; +2DCC;ETHIOPIC SYLLABLE KYEE;Lo;0;L;;;;;N;;;;; +2DCD;ETHIOPIC SYLLABLE KYE;Lo;0;L;;;;;N;;;;; +2DCE;ETHIOPIC SYLLABLE KYO;Lo;0;L;;;;;N;;;;; +2DD0;ETHIOPIC SYLLABLE XYA;Lo;0;L;;;;;N;;;;; +2DD1;ETHIOPIC SYLLABLE XYU;Lo;0;L;;;;;N;;;;; +2DD2;ETHIOPIC SYLLABLE XYI;Lo;0;L;;;;;N;;;;; +2DD3;ETHIOPIC SYLLABLE XYAA;Lo;0;L;;;;;N;;;;; +2DD4;ETHIOPIC SYLLABLE XYEE;Lo;0;L;;;;;N;;;;; +2DD5;ETHIOPIC SYLLABLE XYE;Lo;0;L;;;;;N;;;;; +2DD6;ETHIOPIC SYLLABLE XYO;Lo;0;L;;;;;N;;;;; +2DD8;ETHIOPIC SYLLABLE GYA;Lo;0;L;;;;;N;;;;; +2DD9;ETHIOPIC SYLLABLE GYU;Lo;0;L;;;;;N;;;;; +2DDA;ETHIOPIC SYLLABLE GYI;Lo;0;L;;;;;N;;;;; +2DDB;ETHIOPIC SYLLABLE GYAA;Lo;0;L;;;;;N;;;;; +2DDC;ETHIOPIC SYLLABLE GYEE;Lo;0;L;;;;;N;;;;; +2DDD;ETHIOPIC SYLLABLE GYE;Lo;0;L;;;;;N;;;;; +2DDE;ETHIOPIC SYLLABLE GYO;Lo;0;L;;;;;N;;;;; +2DE0;COMBINING CYRILLIC LETTER BE;Mn;230;NSM;;;;;N;;;;; +2DE1;COMBINING CYRILLIC LETTER VE;Mn;230;NSM;;;;;N;;;;; +2DE2;COMBINING CYRILLIC LETTER GHE;Mn;230;NSM;;;;;N;;;;; +2DE3;COMBINING CYRILLIC LETTER DE;Mn;230;NSM;;;;;N;;;;; +2DE4;COMBINING CYRILLIC LETTER ZHE;Mn;230;NSM;;;;;N;;;;; +2DE5;COMBINING CYRILLIC LETTER ZE;Mn;230;NSM;;;;;N;;;;; +2DE6;COMBINING CYRILLIC LETTER KA;Mn;230;NSM;;;;;N;;;;; +2DE7;COMBINING CYRILLIC LETTER EL;Mn;230;NSM;;;;;N;;;;; +2DE8;COMBINING CYRILLIC LETTER EM;Mn;230;NSM;;;;;N;;;;; +2DE9;COMBINING CYRILLIC LETTER EN;Mn;230;NSM;;;;;N;;;;; +2DEA;COMBINING CYRILLIC LETTER O;Mn;230;NSM;;;;;N;;;;; +2DEB;COMBINING CYRILLIC LETTER PE;Mn;230;NSM;;;;;N;;;;; +2DEC;COMBINING CYRILLIC LETTER ER;Mn;230;NSM;;;;;N;;;;; +2DED;COMBINING CYRILLIC LETTER ES;Mn;230;NSM;;;;;N;;;;; +2DEE;COMBINING CYRILLIC LETTER TE;Mn;230;NSM;;;;;N;;;;; +2DEF;COMBINING CYRILLIC LETTER HA;Mn;230;NSM;;;;;N;;;;; +2DF0;COMBINING CYRILLIC LETTER TSE;Mn;230;NSM;;;;;N;;;;; +2DF1;COMBINING CYRILLIC LETTER CHE;Mn;230;NSM;;;;;N;;;;; +2DF2;COMBINING CYRILLIC LETTER SHA;Mn;230;NSM;;;;;N;;;;; +2DF3;COMBINING CYRILLIC LETTER SHCHA;Mn;230;NSM;;;;;N;;;;; +2DF4;COMBINING CYRILLIC LETTER FITA;Mn;230;NSM;;;;;N;;;;; +2DF5;COMBINING CYRILLIC LETTER ES-TE;Mn;230;NSM;;;;;N;;;;; +2DF6;COMBINING CYRILLIC LETTER A;Mn;230;NSM;;;;;N;;;;; +2DF7;COMBINING CYRILLIC LETTER IE;Mn;230;NSM;;;;;N;;;;; +2DF8;COMBINING CYRILLIC LETTER DJERV;Mn;230;NSM;;;;;N;;;;; +2DF9;COMBINING CYRILLIC LETTER MONOGRAPH UK;Mn;230;NSM;;;;;N;;;;; +2DFA;COMBINING CYRILLIC LETTER YAT;Mn;230;NSM;;;;;N;;;;; +2DFB;COMBINING CYRILLIC LETTER YU;Mn;230;NSM;;;;;N;;;;; +2DFC;COMBINING CYRILLIC LETTER IOTIFIED A;Mn;230;NSM;;;;;N;;;;; +2DFD;COMBINING CYRILLIC LETTER LITTLE YUS;Mn;230;NSM;;;;;N;;;;; +2DFE;COMBINING CYRILLIC LETTER BIG YUS;Mn;230;NSM;;;;;N;;;;; +2DFF;COMBINING CYRILLIC LETTER IOTIFIED BIG YUS;Mn;230;NSM;;;;;N;;;;; +2E00;RIGHT ANGLE SUBSTITUTION MARKER;Po;0;ON;;;;;N;;;;; +2E01;RIGHT ANGLE DOTTED SUBSTITUTION MARKER;Po;0;ON;;;;;N;;;;; +2E02;LEFT SUBSTITUTION BRACKET;Pi;0;ON;;;;;Y;;;;; +2E03;RIGHT SUBSTITUTION BRACKET;Pf;0;ON;;;;;Y;;;;; +2E04;LEFT DOTTED SUBSTITUTION BRACKET;Pi;0;ON;;;;;Y;;;;; +2E05;RIGHT DOTTED SUBSTITUTION BRACKET;Pf;0;ON;;;;;Y;;;;; +2E06;RAISED INTERPOLATION MARKER;Po;0;ON;;;;;N;;;;; +2E07;RAISED DOTTED INTERPOLATION MARKER;Po;0;ON;;;;;N;;;;; +2E08;DOTTED TRANSPOSITION MARKER;Po;0;ON;;;;;N;;;;; +2E09;LEFT TRANSPOSITION BRACKET;Pi;0;ON;;;;;Y;;;;; +2E0A;RIGHT TRANSPOSITION BRACKET;Pf;0;ON;;;;;Y;;;;; +2E0B;RAISED SQUARE;Po;0;ON;;;;;N;;;;; +2E0C;LEFT RAISED OMISSION BRACKET;Pi;0;ON;;;;;Y;;;;; +2E0D;RIGHT RAISED OMISSION BRACKET;Pf;0;ON;;;;;Y;;;;; +2E0E;EDITORIAL CORONIS;Po;0;ON;;;;;N;;;;; +2E0F;PARAGRAPHOS;Po;0;ON;;;;;N;;;;; +2E10;FORKED PARAGRAPHOS;Po;0;ON;;;;;N;;;;; +2E11;REVERSED FORKED PARAGRAPHOS;Po;0;ON;;;;;N;;;;; +2E12;HYPODIASTOLE;Po;0;ON;;;;;N;;;;; +2E13;DOTTED OBELOS;Po;0;ON;;;;;N;;;;; +2E14;DOWNWARDS ANCORA;Po;0;ON;;;;;N;;;;; +2E15;UPWARDS ANCORA;Po;0;ON;;;;;N;;;;; +2E16;DOTTED RIGHT-POINTING ANGLE;Po;0;ON;;;;;N;;;;; +2E17;DOUBLE OBLIQUE HYPHEN;Pd;0;ON;;;;;N;;;;; +2E18;INVERTED INTERROBANG;Po;0;ON;;;;;N;;;;; +2E19;PALM BRANCH;Po;0;ON;;;;;N;;;;; +2E1A;HYPHEN WITH DIAERESIS;Pd;0;ON;;;;;N;;;;; +2E1B;TILDE WITH RING ABOVE;Po;0;ON;;;;;N;;;;; +2E1C;LEFT LOW PARAPHRASE BRACKET;Pi;0;ON;;;;;Y;;;;; +2E1D;RIGHT LOW PARAPHRASE BRACKET;Pf;0;ON;;;;;Y;;;;; +2E1E;TILDE WITH DOT ABOVE;Po;0;ON;;;;;N;;;;; +2E1F;TILDE WITH DOT BELOW;Po;0;ON;;;;;N;;;;; +2E20;LEFT VERTICAL BAR WITH QUILL;Pi;0;ON;;;;;Y;;;;; +2E21;RIGHT VERTICAL BAR WITH QUILL;Pf;0;ON;;;;;Y;;;;; +2E22;TOP LEFT HALF BRACKET;Ps;0;ON;;;;;Y;;;;; +2E23;TOP RIGHT HALF BRACKET;Pe;0;ON;;;;;Y;;;;; +2E24;BOTTOM LEFT HALF BRACKET;Ps;0;ON;;;;;Y;;;;; +2E25;BOTTOM RIGHT HALF BRACKET;Pe;0;ON;;;;;Y;;;;; +2E26;LEFT SIDEWAYS U BRACKET;Ps;0;ON;;;;;Y;;;;; +2E27;RIGHT SIDEWAYS U BRACKET;Pe;0;ON;;;;;Y;;;;; +2E28;LEFT DOUBLE PARENTHESIS;Ps;0;ON;;;;;Y;;;;; +2E29;RIGHT DOUBLE PARENTHESIS;Pe;0;ON;;;;;Y;;;;; +2E2A;TWO DOTS OVER ONE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +2E2B;ONE DOT OVER TWO DOTS PUNCTUATION;Po;0;ON;;;;;N;;;;; +2E2C;SQUARED FOUR DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +2E2D;FIVE DOT MARK;Po;0;ON;;;;;N;;;;; +2E2E;REVERSED QUESTION MARK;Po;0;ON;;;;;N;;;;; +2E2F;VERTICAL TILDE;Lm;0;ON;;;;;N;;;;; +2E30;RING POINT;Po;0;ON;;;;;N;;;;; +2E31;WORD SEPARATOR MIDDLE DOT;Po;0;ON;;;;;N;;;;; +2E32;TURNED COMMA;Po;0;ON;;;;;N;;;;; +2E33;RAISED DOT;Po;0;ON;;;;;N;;;;; +2E34;RAISED COMMA;Po;0;ON;;;;;N;;;;; +2E35;TURNED SEMICOLON;Po;0;ON;;;;;N;;;;; +2E36;DAGGER WITH LEFT GUARD;Po;0;ON;;;;;N;;;;; +2E37;DAGGER WITH RIGHT GUARD;Po;0;ON;;;;;N;;;;; +2E38;TURNED DAGGER;Po;0;ON;;;;;N;;;;; +2E39;TOP HALF SECTION SIGN;Po;0;ON;;;;;N;;;;; +2E3A;TWO-EM DASH;Pd;0;ON;;;;;N;;;;; +2E3B;THREE-EM DASH;Pd;0;ON;;;;;N;;;;; +2E3C;STENOGRAPHIC FULL STOP;Po;0;ON;;;;;N;;;;; +2E3D;VERTICAL SIX DOTS;Po;0;ON;;;;;N;;;;; +2E3E;WIGGLY VERTICAL LINE;Po;0;ON;;;;;N;;;;; +2E3F;CAPITULUM;Po;0;ON;;;;;N;;;;; +2E40;DOUBLE HYPHEN;Pd;0;ON;;;;;N;;;;; +2E41;REVERSED COMMA;Po;0;ON;;;;;N;;;;; +2E42;DOUBLE LOW-REVERSED-9 QUOTATION MARK;Ps;0;ON;;;;;N;;;;; +2E43;DASH WITH LEFT UPTURN;Po;0;ON;;;;;N;;;;; +2E44;DOUBLE SUSPENSION MARK;Po;0;ON;;;;;N;;;;; +2E45;INVERTED LOW KAVYKA;Po;0;ON;;;;;N;;;;; +2E46;INVERTED LOW KAVYKA WITH KAVYKA ABOVE;Po;0;ON;;;;;N;;;;; +2E47;LOW KAVYKA;Po;0;ON;;;;;N;;;;; +2E48;LOW KAVYKA WITH DOT;Po;0;ON;;;;;N;;;;; +2E49;DOUBLE STACKED COMMA;Po;0;ON;;;;;N;;;;; +2E80;CJK RADICAL REPEAT;So;0;ON;;;;;N;;;;; +2E81;CJK RADICAL CLIFF;So;0;ON;;;;;N;;;;; +2E82;CJK RADICAL SECOND ONE;So;0;ON;;;;;N;;;;; +2E83;CJK RADICAL SECOND TWO;So;0;ON;;;;;N;;;;; +2E84;CJK RADICAL SECOND THREE;So;0;ON;;;;;N;;;;; +2E85;CJK RADICAL PERSON;So;0;ON;;;;;N;;;;; +2E86;CJK RADICAL BOX;So;0;ON;;;;;N;;;;; +2E87;CJK RADICAL TABLE;So;0;ON;;;;;N;;;;; +2E88;CJK RADICAL KNIFE ONE;So;0;ON;;;;;N;;;;; +2E89;CJK RADICAL KNIFE TWO;So;0;ON;;;;;N;;;;; +2E8A;CJK RADICAL DIVINATION;So;0;ON;;;;;N;;;;; +2E8B;CJK RADICAL SEAL;So;0;ON;;;;;N;;;;; +2E8C;CJK RADICAL SMALL ONE;So;0;ON;;;;;N;;;;; +2E8D;CJK RADICAL SMALL TWO;So;0;ON;;;;;N;;;;; +2E8E;CJK RADICAL LAME ONE;So;0;ON;;;;;N;;;;; +2E8F;CJK RADICAL LAME TWO;So;0;ON;;;;;N;;;;; +2E90;CJK RADICAL LAME THREE;So;0;ON;;;;;N;;;;; +2E91;CJK RADICAL LAME FOUR;So;0;ON;;;;;N;;;;; +2E92;CJK RADICAL SNAKE;So;0;ON;;;;;N;;;;; +2E93;CJK RADICAL THREAD;So;0;ON;;;;;N;;;;; +2E94;CJK RADICAL SNOUT ONE;So;0;ON;;;;;N;;;;; +2E95;CJK RADICAL SNOUT TWO;So;0;ON;;;;;N;;;;; +2E96;CJK RADICAL HEART ONE;So;0;ON;;;;;N;;;;; +2E97;CJK RADICAL HEART TWO;So;0;ON;;;;;N;;;;; +2E98;CJK RADICAL HAND;So;0;ON;;;;;N;;;;; +2E99;CJK RADICAL RAP;So;0;ON;;;;;N;;;;; +2E9B;CJK RADICAL CHOKE;So;0;ON;;;;;N;;;;; +2E9C;CJK RADICAL SUN;So;0;ON;;;;;N;;;;; +2E9D;CJK RADICAL MOON;So;0;ON;;;;;N;;;;; +2E9E;CJK RADICAL DEATH;So;0;ON;;;;;N;;;;; +2E9F;CJK RADICAL MOTHER;So;0;ON;<compat> 6BCD;;;;N;;;;; +2EA0;CJK RADICAL CIVILIAN;So;0;ON;;;;;N;;;;; +2EA1;CJK RADICAL WATER ONE;So;0;ON;;;;;N;;;;; +2EA2;CJK RADICAL WATER TWO;So;0;ON;;;;;N;;;;; +2EA3;CJK RADICAL FIRE;So;0;ON;;;;;N;;;;; +2EA4;CJK RADICAL PAW ONE;So;0;ON;;;;;N;;;;; +2EA5;CJK RADICAL PAW TWO;So;0;ON;;;;;N;;;;; +2EA6;CJK RADICAL SIMPLIFIED HALF TREE TRUNK;So;0;ON;;;;;N;;;;; +2EA7;CJK RADICAL COW;So;0;ON;;;;;N;;;;; +2EA8;CJK RADICAL DOG;So;0;ON;;;;;N;;;;; +2EA9;CJK RADICAL JADE;So;0;ON;;;;;N;;;;; +2EAA;CJK RADICAL BOLT OF CLOTH;So;0;ON;;;;;N;;;;; +2EAB;CJK RADICAL EYE;So;0;ON;;;;;N;;;;; +2EAC;CJK RADICAL SPIRIT ONE;So;0;ON;;;;;N;;;;; +2EAD;CJK RADICAL SPIRIT TWO;So;0;ON;;;;;N;;;;; +2EAE;CJK RADICAL BAMBOO;So;0;ON;;;;;N;;;;; +2EAF;CJK RADICAL SILK;So;0;ON;;;;;N;;;;; +2EB0;CJK RADICAL C-SIMPLIFIED SILK;So;0;ON;;;;;N;;;;; +2EB1;CJK RADICAL NET ONE;So;0;ON;;;;;N;;;;; +2EB2;CJK RADICAL NET TWO;So;0;ON;;;;;N;;;;; +2EB3;CJK RADICAL NET THREE;So;0;ON;;;;;N;;;;; +2EB4;CJK RADICAL NET FOUR;So;0;ON;;;;;N;;;;; +2EB5;CJK RADICAL MESH;So;0;ON;;;;;N;;;;; +2EB6;CJK RADICAL SHEEP;So;0;ON;;;;;N;;;;; +2EB7;CJK RADICAL RAM;So;0;ON;;;;;N;;;;; +2EB8;CJK RADICAL EWE;So;0;ON;;;;;N;;;;; +2EB9;CJK RADICAL OLD;So;0;ON;;;;;N;;;;; +2EBA;CJK RADICAL BRUSH ONE;So;0;ON;;;;;N;;;;; +2EBB;CJK RADICAL BRUSH TWO;So;0;ON;;;;;N;;;;; +2EBC;CJK RADICAL MEAT;So;0;ON;;;;;N;;;;; +2EBD;CJK RADICAL MORTAR;So;0;ON;;;;;N;;;;; +2EBE;CJK RADICAL GRASS ONE;So;0;ON;;;;;N;;;;; +2EBF;CJK RADICAL GRASS TWO;So;0;ON;;;;;N;;;;; +2EC0;CJK RADICAL GRASS THREE;So;0;ON;;;;;N;;;;; +2EC1;CJK RADICAL TIGER;So;0;ON;;;;;N;;;;; +2EC2;CJK RADICAL CLOTHES;So;0;ON;;;;;N;;;;; +2EC3;CJK RADICAL WEST ONE;So;0;ON;;;;;N;;;;; +2EC4;CJK RADICAL WEST TWO;So;0;ON;;;;;N;;;;; +2EC5;CJK RADICAL C-SIMPLIFIED SEE;So;0;ON;;;;;N;;;;; +2EC6;CJK RADICAL SIMPLIFIED HORN;So;0;ON;;;;;N;;;;; +2EC7;CJK RADICAL HORN;So;0;ON;;;;;N;;;;; +2EC8;CJK RADICAL C-SIMPLIFIED SPEECH;So;0;ON;;;;;N;;;;; +2EC9;CJK RADICAL C-SIMPLIFIED SHELL;So;0;ON;;;;;N;;;;; +2ECA;CJK RADICAL FOOT;So;0;ON;;;;;N;;;;; +2ECB;CJK RADICAL C-SIMPLIFIED CART;So;0;ON;;;;;N;;;;; +2ECC;CJK RADICAL SIMPLIFIED WALK;So;0;ON;;;;;N;;;;; +2ECD;CJK RADICAL WALK ONE;So;0;ON;;;;;N;;;;; +2ECE;CJK RADICAL WALK TWO;So;0;ON;;;;;N;;;;; +2ECF;CJK RADICAL CITY;So;0;ON;;;;;N;;;;; +2ED0;CJK RADICAL C-SIMPLIFIED GOLD;So;0;ON;;;;;N;;;;; +2ED1;CJK RADICAL LONG ONE;So;0;ON;;;;;N;;;;; +2ED2;CJK RADICAL LONG TWO;So;0;ON;;;;;N;;;;; +2ED3;CJK RADICAL C-SIMPLIFIED LONG;So;0;ON;;;;;N;;;;; +2ED4;CJK RADICAL C-SIMPLIFIED GATE;So;0;ON;;;;;N;;;;; +2ED5;CJK RADICAL MOUND ONE;So;0;ON;;;;;N;;;;; +2ED6;CJK RADICAL MOUND TWO;So;0;ON;;;;;N;;;;; +2ED7;CJK RADICAL RAIN;So;0;ON;;;;;N;;;;; +2ED8;CJK RADICAL BLUE;So;0;ON;;;;;N;;;;; +2ED9;CJK RADICAL C-SIMPLIFIED TANNED LEATHER;So;0;ON;;;;;N;;;;; +2EDA;CJK RADICAL C-SIMPLIFIED LEAF;So;0;ON;;;;;N;;;;; +2EDB;CJK RADICAL C-SIMPLIFIED WIND;So;0;ON;;;;;N;;;;; +2EDC;CJK RADICAL C-SIMPLIFIED FLY;So;0;ON;;;;;N;;;;; +2EDD;CJK RADICAL EAT ONE;So;0;ON;;;;;N;;;;; +2EDE;CJK RADICAL EAT TWO;So;0;ON;;;;;N;;;;; +2EDF;CJK RADICAL EAT THREE;So;0;ON;;;;;N;;;;; +2EE0;CJK RADICAL C-SIMPLIFIED EAT;So;0;ON;;;;;N;;;;; +2EE1;CJK RADICAL HEAD;So;0;ON;;;;;N;;;;; +2EE2;CJK RADICAL C-SIMPLIFIED HORSE;So;0;ON;;;;;N;;;;; +2EE3;CJK RADICAL BONE;So;0;ON;;;;;N;;;;; +2EE4;CJK RADICAL GHOST;So;0;ON;;;;;N;;;;; +2EE5;CJK RADICAL C-SIMPLIFIED FISH;So;0;ON;;;;;N;;;;; +2EE6;CJK RADICAL C-SIMPLIFIED BIRD;So;0;ON;;;;;N;;;;; +2EE7;CJK RADICAL C-SIMPLIFIED SALT;So;0;ON;;;;;N;;;;; +2EE8;CJK RADICAL SIMPLIFIED WHEAT;So;0;ON;;;;;N;;;;; +2EE9;CJK RADICAL SIMPLIFIED YELLOW;So;0;ON;;;;;N;;;;; +2EEA;CJK RADICAL C-SIMPLIFIED FROG;So;0;ON;;;;;N;;;;; +2EEB;CJK RADICAL J-SIMPLIFIED EVEN;So;0;ON;;;;;N;;;;; +2EEC;CJK RADICAL C-SIMPLIFIED EVEN;So;0;ON;;;;;N;;;;; +2EED;CJK RADICAL J-SIMPLIFIED TOOTH;So;0;ON;;;;;N;;;;; +2EEE;CJK RADICAL C-SIMPLIFIED TOOTH;So;0;ON;;;;;N;;;;; +2EEF;CJK RADICAL J-SIMPLIFIED DRAGON;So;0;ON;;;;;N;;;;; +2EF0;CJK RADICAL C-SIMPLIFIED DRAGON;So;0;ON;;;;;N;;;;; +2EF1;CJK RADICAL TURTLE;So;0;ON;;;;;N;;;;; +2EF2;CJK RADICAL J-SIMPLIFIED TURTLE;So;0;ON;;;;;N;;;;; +2EF3;CJK RADICAL C-SIMPLIFIED TURTLE;So;0;ON;<compat> 9F9F;;;;N;;;;; +2F00;KANGXI RADICAL ONE;So;0;ON;<compat> 4E00;;;;N;;;;; +2F01;KANGXI RADICAL LINE;So;0;ON;<compat> 4E28;;;;N;;;;; +2F02;KANGXI RADICAL DOT;So;0;ON;<compat> 4E36;;;;N;;;;; +2F03;KANGXI RADICAL SLASH;So;0;ON;<compat> 4E3F;;;;N;;;;; +2F04;KANGXI RADICAL SECOND;So;0;ON;<compat> 4E59;;;;N;;;;; +2F05;KANGXI RADICAL HOOK;So;0;ON;<compat> 4E85;;;;N;;;;; +2F06;KANGXI RADICAL TWO;So;0;ON;<compat> 4E8C;;;;N;;;;; +2F07;KANGXI RADICAL LID;So;0;ON;<compat> 4EA0;;;;N;;;;; +2F08;KANGXI RADICAL MAN;So;0;ON;<compat> 4EBA;;;;N;;;;; +2F09;KANGXI RADICAL LEGS;So;0;ON;<compat> 513F;;;;N;;;;; +2F0A;KANGXI RADICAL ENTER;So;0;ON;<compat> 5165;;;;N;;;;; +2F0B;KANGXI RADICAL EIGHT;So;0;ON;<compat> 516B;;;;N;;;;; +2F0C;KANGXI RADICAL DOWN BOX;So;0;ON;<compat> 5182;;;;N;;;;; +2F0D;KANGXI RADICAL COVER;So;0;ON;<compat> 5196;;;;N;;;;; +2F0E;KANGXI RADICAL ICE;So;0;ON;<compat> 51AB;;;;N;;;;; +2F0F;KANGXI RADICAL TABLE;So;0;ON;<compat> 51E0;;;;N;;;;; +2F10;KANGXI RADICAL OPEN BOX;So;0;ON;<compat> 51F5;;;;N;;;;; +2F11;KANGXI RADICAL KNIFE;So;0;ON;<compat> 5200;;;;N;;;;; +2F12;KANGXI RADICAL POWER;So;0;ON;<compat> 529B;;;;N;;;;; +2F13;KANGXI RADICAL WRAP;So;0;ON;<compat> 52F9;;;;N;;;;; +2F14;KANGXI RADICAL SPOON;So;0;ON;<compat> 5315;;;;N;;;;; +2F15;KANGXI RADICAL RIGHT OPEN BOX;So;0;ON;<compat> 531A;;;;N;;;;; +2F16;KANGXI RADICAL HIDING ENCLOSURE;So;0;ON;<compat> 5338;;;;N;;;;; +2F17;KANGXI RADICAL TEN;So;0;ON;<compat> 5341;;;;N;;;;; +2F18;KANGXI RADICAL DIVINATION;So;0;ON;<compat> 535C;;;;N;;;;; +2F19;KANGXI RADICAL SEAL;So;0;ON;<compat> 5369;;;;N;;;;; +2F1A;KANGXI RADICAL CLIFF;So;0;ON;<compat> 5382;;;;N;;;;; +2F1B;KANGXI RADICAL PRIVATE;So;0;ON;<compat> 53B6;;;;N;;;;; +2F1C;KANGXI RADICAL AGAIN;So;0;ON;<compat> 53C8;;;;N;;;;; +2F1D;KANGXI RADICAL MOUTH;So;0;ON;<compat> 53E3;;;;N;;;;; +2F1E;KANGXI RADICAL ENCLOSURE;So;0;ON;<compat> 56D7;;;;N;;;;; +2F1F;KANGXI RADICAL EARTH;So;0;ON;<compat> 571F;;;;N;;;;; +2F20;KANGXI RADICAL SCHOLAR;So;0;ON;<compat> 58EB;;;;N;;;;; +2F21;KANGXI RADICAL GO;So;0;ON;<compat> 5902;;;;N;;;;; +2F22;KANGXI RADICAL GO SLOWLY;So;0;ON;<compat> 590A;;;;N;;;;; +2F23;KANGXI RADICAL EVENING;So;0;ON;<compat> 5915;;;;N;;;;; +2F24;KANGXI RADICAL BIG;So;0;ON;<compat> 5927;;;;N;;;;; +2F25;KANGXI RADICAL WOMAN;So;0;ON;<compat> 5973;;;;N;;;;; +2F26;KANGXI RADICAL CHILD;So;0;ON;<compat> 5B50;;;;N;;;;; +2F27;KANGXI RADICAL ROOF;So;0;ON;<compat> 5B80;;;;N;;;;; +2F28;KANGXI RADICAL INCH;So;0;ON;<compat> 5BF8;;;;N;;;;; +2F29;KANGXI RADICAL SMALL;So;0;ON;<compat> 5C0F;;;;N;;;;; +2F2A;KANGXI RADICAL LAME;So;0;ON;<compat> 5C22;;;;N;;;;; +2F2B;KANGXI RADICAL CORPSE;So;0;ON;<compat> 5C38;;;;N;;;;; +2F2C;KANGXI RADICAL SPROUT;So;0;ON;<compat> 5C6E;;;;N;;;;; +2F2D;KANGXI RADICAL MOUNTAIN;So;0;ON;<compat> 5C71;;;;N;;;;; +2F2E;KANGXI RADICAL RIVER;So;0;ON;<compat> 5DDB;;;;N;;;;; +2F2F;KANGXI RADICAL WORK;So;0;ON;<compat> 5DE5;;;;N;;;;; +2F30;KANGXI RADICAL ONESELF;So;0;ON;<compat> 5DF1;;;;N;;;;; +2F31;KANGXI RADICAL TURBAN;So;0;ON;<compat> 5DFE;;;;N;;;;; +2F32;KANGXI RADICAL DRY;So;0;ON;<compat> 5E72;;;;N;;;;; +2F33;KANGXI RADICAL SHORT THREAD;So;0;ON;<compat> 5E7A;;;;N;;;;; +2F34;KANGXI RADICAL DOTTED CLIFF;So;0;ON;<compat> 5E7F;;;;N;;;;; +2F35;KANGXI RADICAL LONG STRIDE;So;0;ON;<compat> 5EF4;;;;N;;;;; +2F36;KANGXI RADICAL TWO HANDS;So;0;ON;<compat> 5EFE;;;;N;;;;; +2F37;KANGXI RADICAL SHOOT;So;0;ON;<compat> 5F0B;;;;N;;;;; +2F38;KANGXI RADICAL BOW;So;0;ON;<compat> 5F13;;;;N;;;;; +2F39;KANGXI RADICAL SNOUT;So;0;ON;<compat> 5F50;;;;N;;;;; +2F3A;KANGXI RADICAL BRISTLE;So;0;ON;<compat> 5F61;;;;N;;;;; +2F3B;KANGXI RADICAL STEP;So;0;ON;<compat> 5F73;;;;N;;;;; +2F3C;KANGXI RADICAL HEART;So;0;ON;<compat> 5FC3;;;;N;;;;; +2F3D;KANGXI RADICAL HALBERD;So;0;ON;<compat> 6208;;;;N;;;;; +2F3E;KANGXI RADICAL DOOR;So;0;ON;<compat> 6236;;;;N;;;;; +2F3F;KANGXI RADICAL HAND;So;0;ON;<compat> 624B;;;;N;;;;; +2F40;KANGXI RADICAL BRANCH;So;0;ON;<compat> 652F;;;;N;;;;; +2F41;KANGXI RADICAL RAP;So;0;ON;<compat> 6534;;;;N;;;;; +2F42;KANGXI RADICAL SCRIPT;So;0;ON;<compat> 6587;;;;N;;;;; +2F43;KANGXI RADICAL DIPPER;So;0;ON;<compat> 6597;;;;N;;;;; +2F44;KANGXI RADICAL AXE;So;0;ON;<compat> 65A4;;;;N;;;;; +2F45;KANGXI RADICAL SQUARE;So;0;ON;<compat> 65B9;;;;N;;;;; +2F46;KANGXI RADICAL NOT;So;0;ON;<compat> 65E0;;;;N;;;;; +2F47;KANGXI RADICAL SUN;So;0;ON;<compat> 65E5;;;;N;;;;; +2F48;KANGXI RADICAL SAY;So;0;ON;<compat> 66F0;;;;N;;;;; +2F49;KANGXI RADICAL MOON;So;0;ON;<compat> 6708;;;;N;;;;; +2F4A;KANGXI RADICAL TREE;So;0;ON;<compat> 6728;;;;N;;;;; +2F4B;KANGXI RADICAL LACK;So;0;ON;<compat> 6B20;;;;N;;;;; +2F4C;KANGXI RADICAL STOP;So;0;ON;<compat> 6B62;;;;N;;;;; +2F4D;KANGXI RADICAL DEATH;So;0;ON;<compat> 6B79;;;;N;;;;; +2F4E;KANGXI RADICAL WEAPON;So;0;ON;<compat> 6BB3;;;;N;;;;; +2F4F;KANGXI RADICAL DO NOT;So;0;ON;<compat> 6BCB;;;;N;;;;; +2F50;KANGXI RADICAL COMPARE;So;0;ON;<compat> 6BD4;;;;N;;;;; +2F51;KANGXI RADICAL FUR;So;0;ON;<compat> 6BDB;;;;N;;;;; +2F52;KANGXI RADICAL CLAN;So;0;ON;<compat> 6C0F;;;;N;;;;; +2F53;KANGXI RADICAL STEAM;So;0;ON;<compat> 6C14;;;;N;;;;; +2F54;KANGXI RADICAL WATER;So;0;ON;<compat> 6C34;;;;N;;;;; +2F55;KANGXI RADICAL FIRE;So;0;ON;<compat> 706B;;;;N;;;;; +2F56;KANGXI RADICAL CLAW;So;0;ON;<compat> 722A;;;;N;;;;; +2F57;KANGXI RADICAL FATHER;So;0;ON;<compat> 7236;;;;N;;;;; +2F58;KANGXI RADICAL DOUBLE X;So;0;ON;<compat> 723B;;;;N;;;;; +2F59;KANGXI RADICAL HALF TREE TRUNK;So;0;ON;<compat> 723F;;;;N;;;;; +2F5A;KANGXI RADICAL SLICE;So;0;ON;<compat> 7247;;;;N;;;;; +2F5B;KANGXI RADICAL FANG;So;0;ON;<compat> 7259;;;;N;;;;; +2F5C;KANGXI RADICAL COW;So;0;ON;<compat> 725B;;;;N;;;;; +2F5D;KANGXI RADICAL DOG;So;0;ON;<compat> 72AC;;;;N;;;;; +2F5E;KANGXI RADICAL PROFOUND;So;0;ON;<compat> 7384;;;;N;;;;; +2F5F;KANGXI RADICAL JADE;So;0;ON;<compat> 7389;;;;N;;;;; +2F60;KANGXI RADICAL MELON;So;0;ON;<compat> 74DC;;;;N;;;;; +2F61;KANGXI RADICAL TILE;So;0;ON;<compat> 74E6;;;;N;;;;; +2F62;KANGXI RADICAL SWEET;So;0;ON;<compat> 7518;;;;N;;;;; +2F63;KANGXI RADICAL LIFE;So;0;ON;<compat> 751F;;;;N;;;;; +2F64;KANGXI RADICAL USE;So;0;ON;<compat> 7528;;;;N;;;;; +2F65;KANGXI RADICAL FIELD;So;0;ON;<compat> 7530;;;;N;;;;; +2F66;KANGXI RADICAL BOLT OF CLOTH;So;0;ON;<compat> 758B;;;;N;;;;; +2F67;KANGXI RADICAL SICKNESS;So;0;ON;<compat> 7592;;;;N;;;;; +2F68;KANGXI RADICAL DOTTED TENT;So;0;ON;<compat> 7676;;;;N;;;;; +2F69;KANGXI RADICAL WHITE;So;0;ON;<compat> 767D;;;;N;;;;; +2F6A;KANGXI RADICAL SKIN;So;0;ON;<compat> 76AE;;;;N;;;;; +2F6B;KANGXI RADICAL DISH;So;0;ON;<compat> 76BF;;;;N;;;;; +2F6C;KANGXI RADICAL EYE;So;0;ON;<compat> 76EE;;;;N;;;;; +2F6D;KANGXI RADICAL SPEAR;So;0;ON;<compat> 77DB;;;;N;;;;; +2F6E;KANGXI RADICAL ARROW;So;0;ON;<compat> 77E2;;;;N;;;;; +2F6F;KANGXI RADICAL STONE;So;0;ON;<compat> 77F3;;;;N;;;;; +2F70;KANGXI RADICAL SPIRIT;So;0;ON;<compat> 793A;;;;N;;;;; +2F71;KANGXI RADICAL TRACK;So;0;ON;<compat> 79B8;;;;N;;;;; +2F72;KANGXI RADICAL GRAIN;So;0;ON;<compat> 79BE;;;;N;;;;; +2F73;KANGXI RADICAL CAVE;So;0;ON;<compat> 7A74;;;;N;;;;; +2F74;KANGXI RADICAL STAND;So;0;ON;<compat> 7ACB;;;;N;;;;; +2F75;KANGXI RADICAL BAMBOO;So;0;ON;<compat> 7AF9;;;;N;;;;; +2F76;KANGXI RADICAL RICE;So;0;ON;<compat> 7C73;;;;N;;;;; +2F77;KANGXI RADICAL SILK;So;0;ON;<compat> 7CF8;;;;N;;;;; +2F78;KANGXI RADICAL JAR;So;0;ON;<compat> 7F36;;;;N;;;;; +2F79;KANGXI RADICAL NET;So;0;ON;<compat> 7F51;;;;N;;;;; +2F7A;KANGXI RADICAL SHEEP;So;0;ON;<compat> 7F8A;;;;N;;;;; +2F7B;KANGXI RADICAL FEATHER;So;0;ON;<compat> 7FBD;;;;N;;;;; +2F7C;KANGXI RADICAL OLD;So;0;ON;<compat> 8001;;;;N;;;;; +2F7D;KANGXI RADICAL AND;So;0;ON;<compat> 800C;;;;N;;;;; +2F7E;KANGXI RADICAL PLOW;So;0;ON;<compat> 8012;;;;N;;;;; +2F7F;KANGXI RADICAL EAR;So;0;ON;<compat> 8033;;;;N;;;;; +2F80;KANGXI RADICAL BRUSH;So;0;ON;<compat> 807F;;;;N;;;;; +2F81;KANGXI RADICAL MEAT;So;0;ON;<compat> 8089;;;;N;;;;; +2F82;KANGXI RADICAL MINISTER;So;0;ON;<compat> 81E3;;;;N;;;;; +2F83;KANGXI RADICAL SELF;So;0;ON;<compat> 81EA;;;;N;;;;; +2F84;KANGXI RADICAL ARRIVE;So;0;ON;<compat> 81F3;;;;N;;;;; +2F85;KANGXI RADICAL MORTAR;So;0;ON;<compat> 81FC;;;;N;;;;; +2F86;KANGXI RADICAL TONGUE;So;0;ON;<compat> 820C;;;;N;;;;; +2F87;KANGXI RADICAL OPPOSE;So;0;ON;<compat> 821B;;;;N;;;;; +2F88;KANGXI RADICAL BOAT;So;0;ON;<compat> 821F;;;;N;;;;; +2F89;KANGXI RADICAL STOPPING;So;0;ON;<compat> 826E;;;;N;;;;; +2F8A;KANGXI RADICAL COLOR;So;0;ON;<compat> 8272;;;;N;;;;; +2F8B;KANGXI RADICAL GRASS;So;0;ON;<compat> 8278;;;;N;;;;; +2F8C;KANGXI RADICAL TIGER;So;0;ON;<compat> 864D;;;;N;;;;; +2F8D;KANGXI RADICAL INSECT;So;0;ON;<compat> 866B;;;;N;;;;; +2F8E;KANGXI RADICAL BLOOD;So;0;ON;<compat> 8840;;;;N;;;;; +2F8F;KANGXI RADICAL WALK ENCLOSURE;So;0;ON;<compat> 884C;;;;N;;;;; +2F90;KANGXI RADICAL CLOTHES;So;0;ON;<compat> 8863;;;;N;;;;; +2F91;KANGXI RADICAL WEST;So;0;ON;<compat> 897E;;;;N;;;;; +2F92;KANGXI RADICAL SEE;So;0;ON;<compat> 898B;;;;N;;;;; +2F93;KANGXI RADICAL HORN;So;0;ON;<compat> 89D2;;;;N;;;;; +2F94;KANGXI RADICAL SPEECH;So;0;ON;<compat> 8A00;;;;N;;;;; +2F95;KANGXI RADICAL VALLEY;So;0;ON;<compat> 8C37;;;;N;;;;; +2F96;KANGXI RADICAL BEAN;So;0;ON;<compat> 8C46;;;;N;;;;; +2F97;KANGXI RADICAL PIG;So;0;ON;<compat> 8C55;;;;N;;;;; +2F98;KANGXI RADICAL BADGER;So;0;ON;<compat> 8C78;;;;N;;;;; +2F99;KANGXI RADICAL SHELL;So;0;ON;<compat> 8C9D;;;;N;;;;; +2F9A;KANGXI RADICAL RED;So;0;ON;<compat> 8D64;;;;N;;;;; +2F9B;KANGXI RADICAL RUN;So;0;ON;<compat> 8D70;;;;N;;;;; +2F9C;KANGXI RADICAL FOOT;So;0;ON;<compat> 8DB3;;;;N;;;;; +2F9D;KANGXI RADICAL BODY;So;0;ON;<compat> 8EAB;;;;N;;;;; +2F9E;KANGXI RADICAL CART;So;0;ON;<compat> 8ECA;;;;N;;;;; +2F9F;KANGXI RADICAL BITTER;So;0;ON;<compat> 8F9B;;;;N;;;;; +2FA0;KANGXI RADICAL MORNING;So;0;ON;<compat> 8FB0;;;;N;;;;; +2FA1;KANGXI RADICAL WALK;So;0;ON;<compat> 8FB5;;;;N;;;;; +2FA2;KANGXI RADICAL CITY;So;0;ON;<compat> 9091;;;;N;;;;; +2FA3;KANGXI RADICAL WINE;So;0;ON;<compat> 9149;;;;N;;;;; +2FA4;KANGXI RADICAL DISTINGUISH;So;0;ON;<compat> 91C6;;;;N;;;;; +2FA5;KANGXI RADICAL VILLAGE;So;0;ON;<compat> 91CC;;;;N;;;;; +2FA6;KANGXI RADICAL GOLD;So;0;ON;<compat> 91D1;;;;N;;;;; +2FA7;KANGXI RADICAL LONG;So;0;ON;<compat> 9577;;;;N;;;;; +2FA8;KANGXI RADICAL GATE;So;0;ON;<compat> 9580;;;;N;;;;; +2FA9;KANGXI RADICAL MOUND;So;0;ON;<compat> 961C;;;;N;;;;; +2FAA;KANGXI RADICAL SLAVE;So;0;ON;<compat> 96B6;;;;N;;;;; +2FAB;KANGXI RADICAL SHORT TAILED BIRD;So;0;ON;<compat> 96B9;;;;N;;;;; +2FAC;KANGXI RADICAL RAIN;So;0;ON;<compat> 96E8;;;;N;;;;; +2FAD;KANGXI RADICAL BLUE;So;0;ON;<compat> 9751;;;;N;;;;; +2FAE;KANGXI RADICAL WRONG;So;0;ON;<compat> 975E;;;;N;;;;; +2FAF;KANGXI RADICAL FACE;So;0;ON;<compat> 9762;;;;N;;;;; +2FB0;KANGXI RADICAL LEATHER;So;0;ON;<compat> 9769;;;;N;;;;; +2FB1;KANGXI RADICAL TANNED LEATHER;So;0;ON;<compat> 97CB;;;;N;;;;; +2FB2;KANGXI RADICAL LEEK;So;0;ON;<compat> 97ED;;;;N;;;;; +2FB3;KANGXI RADICAL SOUND;So;0;ON;<compat> 97F3;;;;N;;;;; +2FB4;KANGXI RADICAL LEAF;So;0;ON;<compat> 9801;;;;N;;;;; +2FB5;KANGXI RADICAL WIND;So;0;ON;<compat> 98A8;;;;N;;;;; +2FB6;KANGXI RADICAL FLY;So;0;ON;<compat> 98DB;;;;N;;;;; +2FB7;KANGXI RADICAL EAT;So;0;ON;<compat> 98DF;;;;N;;;;; +2FB8;KANGXI RADICAL HEAD;So;0;ON;<compat> 9996;;;;N;;;;; +2FB9;KANGXI RADICAL FRAGRANT;So;0;ON;<compat> 9999;;;;N;;;;; +2FBA;KANGXI RADICAL HORSE;So;0;ON;<compat> 99AC;;;;N;;;;; +2FBB;KANGXI RADICAL BONE;So;0;ON;<compat> 9AA8;;;;N;;;;; +2FBC;KANGXI RADICAL TALL;So;0;ON;<compat> 9AD8;;;;N;;;;; +2FBD;KANGXI RADICAL HAIR;So;0;ON;<compat> 9ADF;;;;N;;;;; +2FBE;KANGXI RADICAL FIGHT;So;0;ON;<compat> 9B25;;;;N;;;;; +2FBF;KANGXI RADICAL SACRIFICIAL WINE;So;0;ON;<compat> 9B2F;;;;N;;;;; +2FC0;KANGXI RADICAL CAULDRON;So;0;ON;<compat> 9B32;;;;N;;;;; +2FC1;KANGXI RADICAL GHOST;So;0;ON;<compat> 9B3C;;;;N;;;;; +2FC2;KANGXI RADICAL FISH;So;0;ON;<compat> 9B5A;;;;N;;;;; +2FC3;KANGXI RADICAL BIRD;So;0;ON;<compat> 9CE5;;;;N;;;;; +2FC4;KANGXI RADICAL SALT;So;0;ON;<compat> 9E75;;;;N;;;;; +2FC5;KANGXI RADICAL DEER;So;0;ON;<compat> 9E7F;;;;N;;;;; +2FC6;KANGXI RADICAL WHEAT;So;0;ON;<compat> 9EA5;;;;N;;;;; +2FC7;KANGXI RADICAL HEMP;So;0;ON;<compat> 9EBB;;;;N;;;;; +2FC8;KANGXI RADICAL YELLOW;So;0;ON;<compat> 9EC3;;;;N;;;;; +2FC9;KANGXI RADICAL MILLET;So;0;ON;<compat> 9ECD;;;;N;;;;; +2FCA;KANGXI RADICAL BLACK;So;0;ON;<compat> 9ED1;;;;N;;;;; +2FCB;KANGXI RADICAL EMBROIDERY;So;0;ON;<compat> 9EF9;;;;N;;;;; +2FCC;KANGXI RADICAL FROG;So;0;ON;<compat> 9EFD;;;;N;;;;; +2FCD;KANGXI RADICAL TRIPOD;So;0;ON;<compat> 9F0E;;;;N;;;;; +2FCE;KANGXI RADICAL DRUM;So;0;ON;<compat> 9F13;;;;N;;;;; +2FCF;KANGXI RADICAL RAT;So;0;ON;<compat> 9F20;;;;N;;;;; +2FD0;KANGXI RADICAL NOSE;So;0;ON;<compat> 9F3B;;;;N;;;;; +2FD1;KANGXI RADICAL EVEN;So;0;ON;<compat> 9F4A;;;;N;;;;; +2FD2;KANGXI RADICAL TOOTH;So;0;ON;<compat> 9F52;;;;N;;;;; +2FD3;KANGXI RADICAL DRAGON;So;0;ON;<compat> 9F8D;;;;N;;;;; +2FD4;KANGXI RADICAL TURTLE;So;0;ON;<compat> 9F9C;;;;N;;;;; +2FD5;KANGXI RADICAL FLUTE;So;0;ON;<compat> 9FA0;;;;N;;;;; +2FF0;IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT;So;0;ON;;;;;N;;;;; +2FF1;IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO BELOW;So;0;ON;;;;;N;;;;; +2FF2;IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT;So;0;ON;;;;;N;;;;; +2FF3;IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW;So;0;ON;;;;;N;;;;; +2FF4;IDEOGRAPHIC DESCRIPTION CHARACTER FULL SURROUND;So;0;ON;;;;;N;;;;; +2FF5;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE;So;0;ON;;;;;N;;;;; +2FF6;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM BELOW;So;0;ON;;;;;N;;;;; +2FF7;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LEFT;So;0;ON;;;;;N;;;;; +2FF8;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER LEFT;So;0;ON;;;;;N;;;;; +2FF9;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER RIGHT;So;0;ON;;;;;N;;;;; +2FFA;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LOWER LEFT;So;0;ON;;;;;N;;;;; +2FFB;IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID;So;0;ON;;;;;N;;;;; +3000;IDEOGRAPHIC SPACE;Zs;0;WS;<wide> 0020;;;;N;;;;; +3001;IDEOGRAPHIC COMMA;Po;0;ON;;;;;N;;;;; +3002;IDEOGRAPHIC FULL STOP;Po;0;ON;;;;;N;IDEOGRAPHIC PERIOD;;;; +3003;DITTO MARK;Po;0;ON;;;;;N;;;;; +3004;JAPANESE INDUSTRIAL STANDARD SYMBOL;So;0;ON;;;;;N;;;;; +3005;IDEOGRAPHIC ITERATION MARK;Lm;0;L;;;;;N;;;;; +3006;IDEOGRAPHIC CLOSING MARK;Lo;0;L;;;;;N;;;;; +3007;IDEOGRAPHIC NUMBER ZERO;Nl;0;L;;;;0;N;;;;; +3008;LEFT ANGLE BRACKET;Ps;0;ON;;;;;Y;OPENING ANGLE BRACKET;;;; +3009;RIGHT ANGLE BRACKET;Pe;0;ON;;;;;Y;CLOSING ANGLE BRACKET;;;; +300A;LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;;;;;Y;OPENING DOUBLE ANGLE BRACKET;;;; +300B;RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;;;;;Y;CLOSING DOUBLE ANGLE BRACKET;;;; +300C;LEFT CORNER BRACKET;Ps;0;ON;;;;;Y;OPENING CORNER BRACKET;;;; +300D;RIGHT CORNER BRACKET;Pe;0;ON;;;;;Y;CLOSING CORNER BRACKET;;;; +300E;LEFT WHITE CORNER BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE CORNER BRACKET;;;; +300F;RIGHT WHITE CORNER BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE CORNER BRACKET;;;; +3010;LEFT BLACK LENTICULAR BRACKET;Ps;0;ON;;;;;Y;OPENING BLACK LENTICULAR BRACKET;;;; +3011;RIGHT BLACK LENTICULAR BRACKET;Pe;0;ON;;;;;Y;CLOSING BLACK LENTICULAR BRACKET;;;; +3012;POSTAL MARK;So;0;ON;;;;;N;;;;; +3013;GETA MARK;So;0;ON;;;;;N;;;;; +3014;LEFT TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;OPENING TORTOISE SHELL BRACKET;;;; +3015;RIGHT TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;CLOSING TORTOISE SHELL BRACKET;;;; +3016;LEFT WHITE LENTICULAR BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE LENTICULAR BRACKET;;;; +3017;RIGHT WHITE LENTICULAR BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE LENTICULAR BRACKET;;;; +3018;LEFT WHITE TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE TORTOISE SHELL BRACKET;;;; +3019;RIGHT WHITE TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE TORTOISE SHELL BRACKET;;;; +301A;LEFT WHITE SQUARE BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE SQUARE BRACKET;;;; +301B;RIGHT WHITE SQUARE BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE SQUARE BRACKET;;;; +301C;WAVE DASH;Pd;0;ON;;;;;N;;;;; +301D;REVERSED DOUBLE PRIME QUOTATION MARK;Ps;0;ON;;;;;N;;;;; +301E;DOUBLE PRIME QUOTATION MARK;Pe;0;ON;;;;;N;;;;; +301F;LOW DOUBLE PRIME QUOTATION MARK;Pe;0;ON;;;;;N;;;;; +3020;POSTAL MARK FACE;So;0;ON;;;;;N;;;;; +3021;HANGZHOU NUMERAL ONE;Nl;0;L;;;;1;N;;;;; +3022;HANGZHOU NUMERAL TWO;Nl;0;L;;;;2;N;;;;; +3023;HANGZHOU NUMERAL THREE;Nl;0;L;;;;3;N;;;;; +3024;HANGZHOU NUMERAL FOUR;Nl;0;L;;;;4;N;;;;; +3025;HANGZHOU NUMERAL FIVE;Nl;0;L;;;;5;N;;;;; +3026;HANGZHOU NUMERAL SIX;Nl;0;L;;;;6;N;;;;; +3027;HANGZHOU NUMERAL SEVEN;Nl;0;L;;;;7;N;;;;; +3028;HANGZHOU NUMERAL EIGHT;Nl;0;L;;;;8;N;;;;; +3029;HANGZHOU NUMERAL NINE;Nl;0;L;;;;9;N;;;;; +302A;IDEOGRAPHIC LEVEL TONE MARK;Mn;218;NSM;;;;;N;;;;; +302B;IDEOGRAPHIC RISING TONE MARK;Mn;228;NSM;;;;;N;;;;; +302C;IDEOGRAPHIC DEPARTING TONE MARK;Mn;232;NSM;;;;;N;;;;; +302D;IDEOGRAPHIC ENTERING TONE MARK;Mn;222;NSM;;;;;N;;;;; +302E;HANGUL SINGLE DOT TONE MARK;Mc;224;L;;;;;N;;;;; +302F;HANGUL DOUBLE DOT TONE MARK;Mc;224;L;;;;;N;;;;; +3030;WAVY DASH;Pd;0;ON;;;;;N;;;;; +3031;VERTICAL KANA REPEAT MARK;Lm;0;L;;;;;N;;;;; +3032;VERTICAL KANA REPEAT WITH VOICED SOUND MARK;Lm;0;L;;;;;N;;;;; +3033;VERTICAL KANA REPEAT MARK UPPER HALF;Lm;0;L;;;;;N;;;;; +3034;VERTICAL KANA REPEAT WITH VOICED SOUND MARK UPPER HALF;Lm;0;L;;;;;N;;;;; +3035;VERTICAL KANA REPEAT MARK LOWER HALF;Lm;0;L;;;;;N;;;;; +3036;CIRCLED POSTAL MARK;So;0;ON;<compat> 3012;;;;N;;;;; +3037;IDEOGRAPHIC TELEGRAPH LINE FEED SEPARATOR SYMBOL;So;0;ON;;;;;N;;;;; +3038;HANGZHOU NUMERAL TEN;Nl;0;L;<compat> 5341;;;10;N;;;;; +3039;HANGZHOU NUMERAL TWENTY;Nl;0;L;<compat> 5344;;;20;N;;;;; +303A;HANGZHOU NUMERAL THIRTY;Nl;0;L;<compat> 5345;;;30;N;;;;; +303B;VERTICAL IDEOGRAPHIC ITERATION MARK;Lm;0;L;;;;;N;;;;; +303C;MASU MARK;Lo;0;L;;;;;N;;;;; +303D;PART ALTERNATION MARK;Po;0;ON;;;;;N;;;;; +303E;IDEOGRAPHIC VARIATION INDICATOR;So;0;ON;;;;;N;;;;; +303F;IDEOGRAPHIC HALF FILL SPACE;So;0;ON;;;;;N;;;;; +3041;HIRAGANA LETTER SMALL A;Lo;0;L;;;;;N;;;;; +3042;HIRAGANA LETTER A;Lo;0;L;;;;;N;;;;; +3043;HIRAGANA LETTER SMALL I;Lo;0;L;;;;;N;;;;; +3044;HIRAGANA LETTER I;Lo;0;L;;;;;N;;;;; +3045;HIRAGANA LETTER SMALL U;Lo;0;L;;;;;N;;;;; +3046;HIRAGANA LETTER U;Lo;0;L;;;;;N;;;;; +3047;HIRAGANA LETTER SMALL E;Lo;0;L;;;;;N;;;;; +3048;HIRAGANA LETTER E;Lo;0;L;;;;;N;;;;; +3049;HIRAGANA LETTER SMALL O;Lo;0;L;;;;;N;;;;; +304A;HIRAGANA LETTER O;Lo;0;L;;;;;N;;;;; +304B;HIRAGANA LETTER KA;Lo;0;L;;;;;N;;;;; +304C;HIRAGANA LETTER GA;Lo;0;L;304B 3099;;;;N;;;;; +304D;HIRAGANA LETTER KI;Lo;0;L;;;;;N;;;;; +304E;HIRAGANA LETTER GI;Lo;0;L;304D 3099;;;;N;;;;; +304F;HIRAGANA LETTER KU;Lo;0;L;;;;;N;;;;; +3050;HIRAGANA LETTER GU;Lo;0;L;304F 3099;;;;N;;;;; +3051;HIRAGANA LETTER KE;Lo;0;L;;;;;N;;;;; +3052;HIRAGANA LETTER GE;Lo;0;L;3051 3099;;;;N;;;;; +3053;HIRAGANA LETTER KO;Lo;0;L;;;;;N;;;;; +3054;HIRAGANA LETTER GO;Lo;0;L;3053 3099;;;;N;;;;; +3055;HIRAGANA LETTER SA;Lo;0;L;;;;;N;;;;; +3056;HIRAGANA LETTER ZA;Lo;0;L;3055 3099;;;;N;;;;; +3057;HIRAGANA LETTER SI;Lo;0;L;;;;;N;;;;; +3058;HIRAGANA LETTER ZI;Lo;0;L;3057 3099;;;;N;;;;; +3059;HIRAGANA LETTER SU;Lo;0;L;;;;;N;;;;; +305A;HIRAGANA LETTER ZU;Lo;0;L;3059 3099;;;;N;;;;; +305B;HIRAGANA LETTER SE;Lo;0;L;;;;;N;;;;; +305C;HIRAGANA LETTER ZE;Lo;0;L;305B 3099;;;;N;;;;; +305D;HIRAGANA LETTER SO;Lo;0;L;;;;;N;;;;; +305E;HIRAGANA LETTER ZO;Lo;0;L;305D 3099;;;;N;;;;; +305F;HIRAGANA LETTER TA;Lo;0;L;;;;;N;;;;; +3060;HIRAGANA LETTER DA;Lo;0;L;305F 3099;;;;N;;;;; +3061;HIRAGANA LETTER TI;Lo;0;L;;;;;N;;;;; +3062;HIRAGANA LETTER DI;Lo;0;L;3061 3099;;;;N;;;;; +3063;HIRAGANA LETTER SMALL TU;Lo;0;L;;;;;N;;;;; +3064;HIRAGANA LETTER TU;Lo;0;L;;;;;N;;;;; +3065;HIRAGANA LETTER DU;Lo;0;L;3064 3099;;;;N;;;;; +3066;HIRAGANA LETTER TE;Lo;0;L;;;;;N;;;;; +3067;HIRAGANA LETTER DE;Lo;0;L;3066 3099;;;;N;;;;; +3068;HIRAGANA LETTER TO;Lo;0;L;;;;;N;;;;; +3069;HIRAGANA LETTER DO;Lo;0;L;3068 3099;;;;N;;;;; +306A;HIRAGANA LETTER NA;Lo;0;L;;;;;N;;;;; +306B;HIRAGANA LETTER NI;Lo;0;L;;;;;N;;;;; +306C;HIRAGANA LETTER NU;Lo;0;L;;;;;N;;;;; +306D;HIRAGANA LETTER NE;Lo;0;L;;;;;N;;;;; +306E;HIRAGANA LETTER NO;Lo;0;L;;;;;N;;;;; +306F;HIRAGANA LETTER HA;Lo;0;L;;;;;N;;;;; +3070;HIRAGANA LETTER BA;Lo;0;L;306F 3099;;;;N;;;;; +3071;HIRAGANA LETTER PA;Lo;0;L;306F 309A;;;;N;;;;; +3072;HIRAGANA LETTER HI;Lo;0;L;;;;;N;;;;; +3073;HIRAGANA LETTER BI;Lo;0;L;3072 3099;;;;N;;;;; +3074;HIRAGANA LETTER PI;Lo;0;L;3072 309A;;;;N;;;;; +3075;HIRAGANA LETTER HU;Lo;0;L;;;;;N;;;;; +3076;HIRAGANA LETTER BU;Lo;0;L;3075 3099;;;;N;;;;; +3077;HIRAGANA LETTER PU;Lo;0;L;3075 309A;;;;N;;;;; +3078;HIRAGANA LETTER HE;Lo;0;L;;;;;N;;;;; +3079;HIRAGANA LETTER BE;Lo;0;L;3078 3099;;;;N;;;;; +307A;HIRAGANA LETTER PE;Lo;0;L;3078 309A;;;;N;;;;; +307B;HIRAGANA LETTER HO;Lo;0;L;;;;;N;;;;; +307C;HIRAGANA LETTER BO;Lo;0;L;307B 3099;;;;N;;;;; +307D;HIRAGANA LETTER PO;Lo;0;L;307B 309A;;;;N;;;;; +307E;HIRAGANA LETTER MA;Lo;0;L;;;;;N;;;;; +307F;HIRAGANA LETTER MI;Lo;0;L;;;;;N;;;;; +3080;HIRAGANA LETTER MU;Lo;0;L;;;;;N;;;;; +3081;HIRAGANA LETTER ME;Lo;0;L;;;;;N;;;;; +3082;HIRAGANA LETTER MO;Lo;0;L;;;;;N;;;;; +3083;HIRAGANA LETTER SMALL YA;Lo;0;L;;;;;N;;;;; +3084;HIRAGANA LETTER YA;Lo;0;L;;;;;N;;;;; +3085;HIRAGANA LETTER SMALL YU;Lo;0;L;;;;;N;;;;; +3086;HIRAGANA LETTER YU;Lo;0;L;;;;;N;;;;; +3087;HIRAGANA LETTER SMALL YO;Lo;0;L;;;;;N;;;;; +3088;HIRAGANA LETTER YO;Lo;0;L;;;;;N;;;;; +3089;HIRAGANA LETTER RA;Lo;0;L;;;;;N;;;;; +308A;HIRAGANA LETTER RI;Lo;0;L;;;;;N;;;;; +308B;HIRAGANA LETTER RU;Lo;0;L;;;;;N;;;;; +308C;HIRAGANA LETTER RE;Lo;0;L;;;;;N;;;;; +308D;HIRAGANA LETTER RO;Lo;0;L;;;;;N;;;;; +308E;HIRAGANA LETTER SMALL WA;Lo;0;L;;;;;N;;;;; +308F;HIRAGANA LETTER WA;Lo;0;L;;;;;N;;;;; +3090;HIRAGANA LETTER WI;Lo;0;L;;;;;N;;;;; +3091;HIRAGANA LETTER WE;Lo;0;L;;;;;N;;;;; +3092;HIRAGANA LETTER WO;Lo;0;L;;;;;N;;;;; +3093;HIRAGANA LETTER N;Lo;0;L;;;;;N;;;;; +3094;HIRAGANA LETTER VU;Lo;0;L;3046 3099;;;;N;;;;; +3095;HIRAGANA LETTER SMALL KA;Lo;0;L;;;;;N;;;;; +3096;HIRAGANA LETTER SMALL KE;Lo;0;L;;;;;N;;;;; +3099;COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK;Mn;8;NSM;;;;;N;NON-SPACING KATAKANA-HIRAGANA VOICED SOUND MARK;;;; +309A;COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK;Mn;8;NSM;;;;;N;NON-SPACING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK;;;; +309B;KATAKANA-HIRAGANA VOICED SOUND MARK;Sk;0;ON;<compat> 0020 3099;;;;N;;;;; +309C;KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK;Sk;0;ON;<compat> 0020 309A;;;;N;;;;; +309D;HIRAGANA ITERATION MARK;Lm;0;L;;;;;N;;;;; +309E;HIRAGANA VOICED ITERATION MARK;Lm;0;L;309D 3099;;;;N;;;;; +309F;HIRAGANA DIGRAPH YORI;Lo;0;L;<vertical> 3088 308A;;;;N;;;;; +30A0;KATAKANA-HIRAGANA DOUBLE HYPHEN;Pd;0;ON;;;;;N;;;;; +30A1;KATAKANA LETTER SMALL A;Lo;0;L;;;;;N;;;;; +30A2;KATAKANA LETTER A;Lo;0;L;;;;;N;;;;; +30A3;KATAKANA LETTER SMALL I;Lo;0;L;;;;;N;;;;; +30A4;KATAKANA LETTER I;Lo;0;L;;;;;N;;;;; +30A5;KATAKANA LETTER SMALL U;Lo;0;L;;;;;N;;;;; +30A6;KATAKANA LETTER U;Lo;0;L;;;;;N;;;;; +30A7;KATAKANA LETTER SMALL E;Lo;0;L;;;;;N;;;;; +30A8;KATAKANA LETTER E;Lo;0;L;;;;;N;;;;; +30A9;KATAKANA LETTER SMALL O;Lo;0;L;;;;;N;;;;; +30AA;KATAKANA LETTER O;Lo;0;L;;;;;N;;;;; +30AB;KATAKANA LETTER KA;Lo;0;L;;;;;N;;;;; +30AC;KATAKANA LETTER GA;Lo;0;L;30AB 3099;;;;N;;;;; +30AD;KATAKANA LETTER KI;Lo;0;L;;;;;N;;;;; +30AE;KATAKANA LETTER GI;Lo;0;L;30AD 3099;;;;N;;;;; +30AF;KATAKANA LETTER KU;Lo;0;L;;;;;N;;;;; +30B0;KATAKANA LETTER GU;Lo;0;L;30AF 3099;;;;N;;;;; +30B1;KATAKANA LETTER KE;Lo;0;L;;;;;N;;;;; +30B2;KATAKANA LETTER GE;Lo;0;L;30B1 3099;;;;N;;;;; +30B3;KATAKANA LETTER KO;Lo;0;L;;;;;N;;;;; +30B4;KATAKANA LETTER GO;Lo;0;L;30B3 3099;;;;N;;;;; +30B5;KATAKANA LETTER SA;Lo;0;L;;;;;N;;;;; +30B6;KATAKANA LETTER ZA;Lo;0;L;30B5 3099;;;;N;;;;; +30B7;KATAKANA LETTER SI;Lo;0;L;;;;;N;;;;; +30B8;KATAKANA LETTER ZI;Lo;0;L;30B7 3099;;;;N;;;;; +30B9;KATAKANA LETTER SU;Lo;0;L;;;;;N;;;;; +30BA;KATAKANA LETTER ZU;Lo;0;L;30B9 3099;;;;N;;;;; +30BB;KATAKANA LETTER SE;Lo;0;L;;;;;N;;;;; +30BC;KATAKANA LETTER ZE;Lo;0;L;30BB 3099;;;;N;;;;; +30BD;KATAKANA LETTER SO;Lo;0;L;;;;;N;;;;; +30BE;KATAKANA LETTER ZO;Lo;0;L;30BD 3099;;;;N;;;;; +30BF;KATAKANA LETTER TA;Lo;0;L;;;;;N;;;;; +30C0;KATAKANA LETTER DA;Lo;0;L;30BF 3099;;;;N;;;;; +30C1;KATAKANA LETTER TI;Lo;0;L;;;;;N;;;;; +30C2;KATAKANA LETTER DI;Lo;0;L;30C1 3099;;;;N;;;;; +30C3;KATAKANA LETTER SMALL TU;Lo;0;L;;;;;N;;;;; +30C4;KATAKANA LETTER TU;Lo;0;L;;;;;N;;;;; +30C5;KATAKANA LETTER DU;Lo;0;L;30C4 3099;;;;N;;;;; +30C6;KATAKANA LETTER TE;Lo;0;L;;;;;N;;;;; +30C7;KATAKANA LETTER DE;Lo;0;L;30C6 3099;;;;N;;;;; +30C8;KATAKANA LETTER TO;Lo;0;L;;;;;N;;;;; +30C9;KATAKANA LETTER DO;Lo;0;L;30C8 3099;;;;N;;;;; +30CA;KATAKANA LETTER NA;Lo;0;L;;;;;N;;;;; +30CB;KATAKANA LETTER NI;Lo;0;L;;;;;N;;;;; +30CC;KATAKANA LETTER NU;Lo;0;L;;;;;N;;;;; +30CD;KATAKANA LETTER NE;Lo;0;L;;;;;N;;;;; +30CE;KATAKANA LETTER NO;Lo;0;L;;;;;N;;;;; +30CF;KATAKANA LETTER HA;Lo;0;L;;;;;N;;;;; +30D0;KATAKANA LETTER BA;Lo;0;L;30CF 3099;;;;N;;;;; +30D1;KATAKANA LETTER PA;Lo;0;L;30CF 309A;;;;N;;;;; +30D2;KATAKANA LETTER HI;Lo;0;L;;;;;N;;;;; +30D3;KATAKANA LETTER BI;Lo;0;L;30D2 3099;;;;N;;;;; +30D4;KATAKANA LETTER PI;Lo;0;L;30D2 309A;;;;N;;;;; +30D5;KATAKANA LETTER HU;Lo;0;L;;;;;N;;;;; +30D6;KATAKANA LETTER BU;Lo;0;L;30D5 3099;;;;N;;;;; +30D7;KATAKANA LETTER PU;Lo;0;L;30D5 309A;;;;N;;;;; +30D8;KATAKANA LETTER HE;Lo;0;L;;;;;N;;;;; +30D9;KATAKANA LETTER BE;Lo;0;L;30D8 3099;;;;N;;;;; +30DA;KATAKANA LETTER PE;Lo;0;L;30D8 309A;;;;N;;;;; +30DB;KATAKANA LETTER HO;Lo;0;L;;;;;N;;;;; +30DC;KATAKANA LETTER BO;Lo;0;L;30DB 3099;;;;N;;;;; +30DD;KATAKANA LETTER PO;Lo;0;L;30DB 309A;;;;N;;;;; +30DE;KATAKANA LETTER MA;Lo;0;L;;;;;N;;;;; +30DF;KATAKANA LETTER MI;Lo;0;L;;;;;N;;;;; +30E0;KATAKANA LETTER MU;Lo;0;L;;;;;N;;;;; +30E1;KATAKANA LETTER ME;Lo;0;L;;;;;N;;;;; +30E2;KATAKANA LETTER MO;Lo;0;L;;;;;N;;;;; +30E3;KATAKANA LETTER SMALL YA;Lo;0;L;;;;;N;;;;; +30E4;KATAKANA LETTER YA;Lo;0;L;;;;;N;;;;; +30E5;KATAKANA LETTER SMALL YU;Lo;0;L;;;;;N;;;;; +30E6;KATAKANA LETTER YU;Lo;0;L;;;;;N;;;;; +30E7;KATAKANA LETTER SMALL YO;Lo;0;L;;;;;N;;;;; +30E8;KATAKANA LETTER YO;Lo;0;L;;;;;N;;;;; +30E9;KATAKANA LETTER RA;Lo;0;L;;;;;N;;;;; +30EA;KATAKANA LETTER RI;Lo;0;L;;;;;N;;;;; +30EB;KATAKANA LETTER RU;Lo;0;L;;;;;N;;;;; +30EC;KATAKANA LETTER RE;Lo;0;L;;;;;N;;;;; +30ED;KATAKANA LETTER RO;Lo;0;L;;;;;N;;;;; +30EE;KATAKANA LETTER SMALL WA;Lo;0;L;;;;;N;;;;; +30EF;KATAKANA LETTER WA;Lo;0;L;;;;;N;;;;; +30F0;KATAKANA LETTER WI;Lo;0;L;;;;;N;;;;; +30F1;KATAKANA LETTER WE;Lo;0;L;;;;;N;;;;; +30F2;KATAKANA LETTER WO;Lo;0;L;;;;;N;;;;; +30F3;KATAKANA LETTER N;Lo;0;L;;;;;N;;;;; +30F4;KATAKANA LETTER VU;Lo;0;L;30A6 3099;;;;N;;;;; +30F5;KATAKANA LETTER SMALL KA;Lo;0;L;;;;;N;;;;; +30F6;KATAKANA LETTER SMALL KE;Lo;0;L;;;;;N;;;;; +30F7;KATAKANA LETTER VA;Lo;0;L;30EF 3099;;;;N;;;;; +30F8;KATAKANA LETTER VI;Lo;0;L;30F0 3099;;;;N;;;;; +30F9;KATAKANA LETTER VE;Lo;0;L;30F1 3099;;;;N;;;;; +30FA;KATAKANA LETTER VO;Lo;0;L;30F2 3099;;;;N;;;;; +30FB;KATAKANA MIDDLE DOT;Po;0;ON;;;;;N;;;;; +30FC;KATAKANA-HIRAGANA PROLONGED SOUND MARK;Lm;0;L;;;;;N;;;;; +30FD;KATAKANA ITERATION MARK;Lm;0;L;;;;;N;;;;; +30FE;KATAKANA VOICED ITERATION MARK;Lm;0;L;30FD 3099;;;;N;;;;; +30FF;KATAKANA DIGRAPH KOTO;Lo;0;L;<vertical> 30B3 30C8;;;;N;;;;; +3105;BOPOMOFO LETTER B;Lo;0;L;;;;;N;;;;; +3106;BOPOMOFO LETTER P;Lo;0;L;;;;;N;;;;; +3107;BOPOMOFO LETTER M;Lo;0;L;;;;;N;;;;; +3108;BOPOMOFO LETTER F;Lo;0;L;;;;;N;;;;; +3109;BOPOMOFO LETTER D;Lo;0;L;;;;;N;;;;; +310A;BOPOMOFO LETTER T;Lo;0;L;;;;;N;;;;; +310B;BOPOMOFO LETTER N;Lo;0;L;;;;;N;;;;; +310C;BOPOMOFO LETTER L;Lo;0;L;;;;;N;;;;; +310D;BOPOMOFO LETTER G;Lo;0;L;;;;;N;;;;; +310E;BOPOMOFO LETTER K;Lo;0;L;;;;;N;;;;; +310F;BOPOMOFO LETTER H;Lo;0;L;;;;;N;;;;; +3110;BOPOMOFO LETTER J;Lo;0;L;;;;;N;;;;; +3111;BOPOMOFO LETTER Q;Lo;0;L;;;;;N;;;;; +3112;BOPOMOFO LETTER X;Lo;0;L;;;;;N;;;;; +3113;BOPOMOFO LETTER ZH;Lo;0;L;;;;;N;;;;; +3114;BOPOMOFO LETTER CH;Lo;0;L;;;;;N;;;;; +3115;BOPOMOFO LETTER SH;Lo;0;L;;;;;N;;;;; +3116;BOPOMOFO LETTER R;Lo;0;L;;;;;N;;;;; +3117;BOPOMOFO LETTER Z;Lo;0;L;;;;;N;;;;; +3118;BOPOMOFO LETTER C;Lo;0;L;;;;;N;;;;; +3119;BOPOMOFO LETTER S;Lo;0;L;;;;;N;;;;; +311A;BOPOMOFO LETTER A;Lo;0;L;;;;;N;;;;; +311B;BOPOMOFO LETTER O;Lo;0;L;;;;;N;;;;; +311C;BOPOMOFO LETTER E;Lo;0;L;;;;;N;;;;; +311D;BOPOMOFO LETTER EH;Lo;0;L;;;;;N;;;;; +311E;BOPOMOFO LETTER AI;Lo;0;L;;;;;N;;;;; +311F;BOPOMOFO LETTER EI;Lo;0;L;;;;;N;;;;; +3120;BOPOMOFO LETTER AU;Lo;0;L;;;;;N;;;;; +3121;BOPOMOFO LETTER OU;Lo;0;L;;;;;N;;;;; +3122;BOPOMOFO LETTER AN;Lo;0;L;;;;;N;;;;; +3123;BOPOMOFO LETTER EN;Lo;0;L;;;;;N;;;;; +3124;BOPOMOFO LETTER ANG;Lo;0;L;;;;;N;;;;; +3125;BOPOMOFO LETTER ENG;Lo;0;L;;;;;N;;;;; +3126;BOPOMOFO LETTER ER;Lo;0;L;;;;;N;;;;; +3127;BOPOMOFO LETTER I;Lo;0;L;;;;;N;;;;; +3128;BOPOMOFO LETTER U;Lo;0;L;;;;;N;;;;; +3129;BOPOMOFO LETTER IU;Lo;0;L;;;;;N;;;;; +312A;BOPOMOFO LETTER V;Lo;0;L;;;;;N;;;;; +312B;BOPOMOFO LETTER NG;Lo;0;L;;;;;N;;;;; +312C;BOPOMOFO LETTER GN;Lo;0;L;;;;;N;;;;; +312D;BOPOMOFO LETTER IH;Lo;0;L;;;;;N;;;;; +312E;BOPOMOFO LETTER O WITH DOT ABOVE;Lo;0;L;;;;;N;;;;; +3131;HANGUL LETTER KIYEOK;Lo;0;L;<compat> 1100;;;;N;HANGUL LETTER GIYEOG;;;; +3132;HANGUL LETTER SSANGKIYEOK;Lo;0;L;<compat> 1101;;;;N;HANGUL LETTER SSANG GIYEOG;;;; +3133;HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;; +3134;HANGUL LETTER NIEUN;Lo;0;L;<compat> 1102;;;;N;;;;; +3135;HANGUL LETTER NIEUN-CIEUC;Lo;0;L;<compat> 11AC;;;;N;HANGUL LETTER NIEUN JIEUJ;;;; +3136;HANGUL LETTER NIEUN-HIEUH;Lo;0;L;<compat> 11AD;;;;N;HANGUL LETTER NIEUN HIEUH;;;; +3137;HANGUL LETTER TIKEUT;Lo;0;L;<compat> 1103;;;;N;HANGUL LETTER DIGEUD;;;; +3138;HANGUL LETTER SSANGTIKEUT;Lo;0;L;<compat> 1104;;;;N;HANGUL LETTER SSANG DIGEUD;;;; +3139;HANGUL LETTER RIEUL;Lo;0;L;<compat> 1105;;;;N;HANGUL LETTER LIEUL;;;; +313A;HANGUL LETTER RIEUL-KIYEOK;Lo;0;L;<compat> 11B0;;;;N;HANGUL LETTER LIEUL GIYEOG;;;; +313B;HANGUL LETTER RIEUL-MIEUM;Lo;0;L;<compat> 11B1;;;;N;HANGUL LETTER LIEUL MIEUM;;;; +313C;HANGUL LETTER RIEUL-PIEUP;Lo;0;L;<compat> 11B2;;;;N;HANGUL LETTER LIEUL BIEUB;;;; +313D;HANGUL LETTER RIEUL-SIOS;Lo;0;L;<compat> 11B3;;;;N;HANGUL LETTER LIEUL SIOS;;;; +313E;HANGUL LETTER RIEUL-THIEUTH;Lo;0;L;<compat> 11B4;;;;N;HANGUL LETTER LIEUL TIEUT;;;; +313F;HANGUL LETTER RIEUL-PHIEUPH;Lo;0;L;<compat> 11B5;;;;N;HANGUL LETTER LIEUL PIEUP;;;; +3140;HANGUL LETTER RIEUL-HIEUH;Lo;0;L;<compat> 111A;;;;N;HANGUL LETTER LIEUL HIEUH;;;; +3141;HANGUL LETTER MIEUM;Lo;0;L;<compat> 1106;;;;N;;;;; +3142;HANGUL LETTER PIEUP;Lo;0;L;<compat> 1107;;;;N;HANGUL LETTER BIEUB;;;; +3143;HANGUL LETTER SSANGPIEUP;Lo;0;L;<compat> 1108;;;;N;HANGUL LETTER SSANG BIEUB;;;; +3144;HANGUL LETTER PIEUP-SIOS;Lo;0;L;<compat> 1121;;;;N;HANGUL LETTER BIEUB SIOS;;;; +3145;HANGUL LETTER SIOS;Lo;0;L;<compat> 1109;;;;N;;;;; +3146;HANGUL LETTER SSANGSIOS;Lo;0;L;<compat> 110A;;;;N;HANGUL LETTER SSANG SIOS;;;; +3147;HANGUL LETTER IEUNG;Lo;0;L;<compat> 110B;;;;N;;;;; +3148;HANGUL LETTER CIEUC;Lo;0;L;<compat> 110C;;;;N;HANGUL LETTER JIEUJ;;;; +3149;HANGUL LETTER SSANGCIEUC;Lo;0;L;<compat> 110D;;;;N;HANGUL LETTER SSANG JIEUJ;;;; +314A;HANGUL LETTER CHIEUCH;Lo;0;L;<compat> 110E;;;;N;HANGUL LETTER CIEUC;;;; +314B;HANGUL LETTER KHIEUKH;Lo;0;L;<compat> 110F;;;;N;HANGUL LETTER KIYEOK;;;; +314C;HANGUL LETTER THIEUTH;Lo;0;L;<compat> 1110;;;;N;HANGUL LETTER TIEUT;;;; +314D;HANGUL LETTER PHIEUPH;Lo;0;L;<compat> 1111;;;;N;HANGUL LETTER PIEUP;;;; +314E;HANGUL LETTER HIEUH;Lo;0;L;<compat> 1112;;;;N;;;;; +314F;HANGUL LETTER A;Lo;0;L;<compat> 1161;;;;N;;;;; +3150;HANGUL LETTER AE;Lo;0;L;<compat> 1162;;;;N;;;;; +3151;HANGUL LETTER YA;Lo;0;L;<compat> 1163;;;;N;;;;; +3152;HANGUL LETTER YAE;Lo;0;L;<compat> 1164;;;;N;;;;; +3153;HANGUL LETTER EO;Lo;0;L;<compat> 1165;;;;N;;;;; +3154;HANGUL LETTER E;Lo;0;L;<compat> 1166;;;;N;;;;; +3155;HANGUL LETTER YEO;Lo;0;L;<compat> 1167;;;;N;;;;; +3156;HANGUL LETTER YE;Lo;0;L;<compat> 1168;;;;N;;;;; +3157;HANGUL LETTER O;Lo;0;L;<compat> 1169;;;;N;;;;; +3158;HANGUL LETTER WA;Lo;0;L;<compat> 116A;;;;N;;;;; +3159;HANGUL LETTER WAE;Lo;0;L;<compat> 116B;;;;N;;;;; +315A;HANGUL LETTER OE;Lo;0;L;<compat> 116C;;;;N;;;;; +315B;HANGUL LETTER YO;Lo;0;L;<compat> 116D;;;;N;;;;; +315C;HANGUL LETTER U;Lo;0;L;<compat> 116E;;;;N;;;;; +315D;HANGUL LETTER WEO;Lo;0;L;<compat> 116F;;;;N;;;;; +315E;HANGUL LETTER WE;Lo;0;L;<compat> 1170;;;;N;;;;; +315F;HANGUL LETTER WI;Lo;0;L;<compat> 1171;;;;N;;;;; +3160;HANGUL LETTER YU;Lo;0;L;<compat> 1172;;;;N;;;;; +3161;HANGUL LETTER EU;Lo;0;L;<compat> 1173;;;;N;;;;; +3162;HANGUL LETTER YI;Lo;0;L;<compat> 1174;;;;N;;;;; +3163;HANGUL LETTER I;Lo;0;L;<compat> 1175;;;;N;;;;; +3164;HANGUL FILLER;Lo;0;L;<compat> 1160;;;;N;HANGUL CAE OM;;;; +3165;HANGUL LETTER SSANGNIEUN;Lo;0;L;<compat> 1114;;;;N;HANGUL LETTER SSANG NIEUN;;;; +3166;HANGUL LETTER NIEUN-TIKEUT;Lo;0;L;<compat> 1115;;;;N;HANGUL LETTER NIEUN DIGEUD;;;; +3167;HANGUL LETTER NIEUN-SIOS;Lo;0;L;<compat> 11C7;;;;N;HANGUL LETTER NIEUN SIOS;;;; +3168;HANGUL LETTER NIEUN-PANSIOS;Lo;0;L;<compat> 11C8;;;;N;HANGUL LETTER NIEUN BAN CHI EUM;;;; +3169;HANGUL LETTER RIEUL-KIYEOK-SIOS;Lo;0;L;<compat> 11CC;;;;N;HANGUL LETTER LIEUL GIYEOG SIOS;;;; +316A;HANGUL LETTER RIEUL-TIKEUT;Lo;0;L;<compat> 11CE;;;;N;HANGUL LETTER LIEUL DIGEUD;;;; +316B;HANGUL LETTER RIEUL-PIEUP-SIOS;Lo;0;L;<compat> 11D3;;;;N;HANGUL LETTER LIEUL BIEUB SIOS;;;; +316C;HANGUL LETTER RIEUL-PANSIOS;Lo;0;L;<compat> 11D7;;;;N;HANGUL LETTER LIEUL BAN CHI EUM;;;; +316D;HANGUL LETTER RIEUL-YEORINHIEUH;Lo;0;L;<compat> 11D9;;;;N;HANGUL LETTER LIEUL YEOLIN HIEUH;;;; +316E;HANGUL LETTER MIEUM-PIEUP;Lo;0;L;<compat> 111C;;;;N;HANGUL LETTER MIEUM BIEUB;;;; +316F;HANGUL LETTER MIEUM-SIOS;Lo;0;L;<compat> 11DD;;;;N;HANGUL LETTER MIEUM SIOS;;;; +3170;HANGUL LETTER MIEUM-PANSIOS;Lo;0;L;<compat> 11DF;;;;N;HANGUL LETTER BIEUB BAN CHI EUM;;;; +3171;HANGUL LETTER KAPYEOUNMIEUM;Lo;0;L;<compat> 111D;;;;N;HANGUL LETTER MIEUM SUN GYEONG EUM;;;; +3172;HANGUL LETTER PIEUP-KIYEOK;Lo;0;L;<compat> 111E;;;;N;HANGUL LETTER BIEUB GIYEOG;;;; +3173;HANGUL LETTER PIEUP-TIKEUT;Lo;0;L;<compat> 1120;;;;N;HANGUL LETTER BIEUB DIGEUD;;;; +3174;HANGUL LETTER PIEUP-SIOS-KIYEOK;Lo;0;L;<compat> 1122;;;;N;HANGUL LETTER BIEUB SIOS GIYEOG;;;; +3175;HANGUL LETTER PIEUP-SIOS-TIKEUT;Lo;0;L;<compat> 1123;;;;N;HANGUL LETTER BIEUB SIOS DIGEUD;;;; +3176;HANGUL LETTER PIEUP-CIEUC;Lo;0;L;<compat> 1127;;;;N;HANGUL LETTER BIEUB JIEUJ;;;; +3177;HANGUL LETTER PIEUP-THIEUTH;Lo;0;L;<compat> 1129;;;;N;HANGUL LETTER BIEUB TIEUT;;;; +3178;HANGUL LETTER KAPYEOUNPIEUP;Lo;0;L;<compat> 112B;;;;N;HANGUL LETTER BIEUB SUN GYEONG EUM;;;; +3179;HANGUL LETTER KAPYEOUNSSANGPIEUP;Lo;0;L;<compat> 112C;;;;N;HANGUL LETTER SSANG BIEUB SUN GYEONG EUM;;;; +317A;HANGUL LETTER SIOS-KIYEOK;Lo;0;L;<compat> 112D;;;;N;HANGUL LETTER SIOS GIYEOG;;;; +317B;HANGUL LETTER SIOS-NIEUN;Lo;0;L;<compat> 112E;;;;N;HANGUL LETTER SIOS NIEUN;;;; +317C;HANGUL LETTER SIOS-TIKEUT;Lo;0;L;<compat> 112F;;;;N;HANGUL LETTER SIOS DIGEUD;;;; +317D;HANGUL LETTER SIOS-PIEUP;Lo;0;L;<compat> 1132;;;;N;HANGUL LETTER SIOS BIEUB;;;; +317E;HANGUL LETTER SIOS-CIEUC;Lo;0;L;<compat> 1136;;;;N;HANGUL LETTER SIOS JIEUJ;;;; +317F;HANGUL LETTER PANSIOS;Lo;0;L;<compat> 1140;;;;N;HANGUL LETTER BAN CHI EUM;;;; +3180;HANGUL LETTER SSANGIEUNG;Lo;0;L;<compat> 1147;;;;N;HANGUL LETTER SSANG IEUNG;;;; +3181;HANGUL LETTER YESIEUNG;Lo;0;L;<compat> 114C;;;;N;HANGUL LETTER NGIEUNG;;;; +3182;HANGUL LETTER YESIEUNG-SIOS;Lo;0;L;<compat> 11F1;;;;N;HANGUL LETTER NGIEUNG SIOS;;;; +3183;HANGUL LETTER YESIEUNG-PANSIOS;Lo;0;L;<compat> 11F2;;;;N;HANGUL LETTER NGIEUNG BAN CHI EUM;;;; +3184;HANGUL LETTER KAPYEOUNPHIEUPH;Lo;0;L;<compat> 1157;;;;N;HANGUL LETTER PIEUP SUN GYEONG EUM;;;; +3185;HANGUL LETTER SSANGHIEUH;Lo;0;L;<compat> 1158;;;;N;HANGUL LETTER SSANG HIEUH;;;; +3186;HANGUL LETTER YEORINHIEUH;Lo;0;L;<compat> 1159;;;;N;HANGUL LETTER YEOLIN HIEUH;;;; +3187;HANGUL LETTER YO-YA;Lo;0;L;<compat> 1184;;;;N;HANGUL LETTER YOYA;;;; +3188;HANGUL LETTER YO-YAE;Lo;0;L;<compat> 1185;;;;N;HANGUL LETTER YOYAE;;;; +3189;HANGUL LETTER YO-I;Lo;0;L;<compat> 1188;;;;N;HANGUL LETTER YOI;;;; +318A;HANGUL LETTER YU-YEO;Lo;0;L;<compat> 1191;;;;N;HANGUL LETTER YUYEO;;;; +318B;HANGUL LETTER YU-YE;Lo;0;L;<compat> 1192;;;;N;HANGUL LETTER YUYE;;;; +318C;HANGUL LETTER YU-I;Lo;0;L;<compat> 1194;;;;N;HANGUL LETTER YUI;;;; +318D;HANGUL LETTER ARAEA;Lo;0;L;<compat> 119E;;;;N;HANGUL LETTER ALAE A;;;; +318E;HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;; +3190;IDEOGRAPHIC ANNOTATION LINKING MARK;So;0;L;;;;;N;KANBUN TATETEN;;;; +3191;IDEOGRAPHIC ANNOTATION REVERSE MARK;So;0;L;;;;;N;KAERITEN RE;;;; +3192;IDEOGRAPHIC ANNOTATION ONE MARK;No;0;L;<super> 4E00;;;1;N;KAERITEN ITI;;;; +3193;IDEOGRAPHIC ANNOTATION TWO MARK;No;0;L;<super> 4E8C;;;2;N;KAERITEN NI;;;; +3194;IDEOGRAPHIC ANNOTATION THREE MARK;No;0;L;<super> 4E09;;;3;N;KAERITEN SAN;;;; +3195;IDEOGRAPHIC ANNOTATION FOUR MARK;No;0;L;<super> 56DB;;;4;N;KAERITEN SI;;;; +3196;IDEOGRAPHIC ANNOTATION TOP MARK;So;0;L;<super> 4E0A;;;;N;KAERITEN ZYOU;;;; +3197;IDEOGRAPHIC ANNOTATION MIDDLE MARK;So;0;L;<super> 4E2D;;;;N;KAERITEN TYUU;;;; +3198;IDEOGRAPHIC ANNOTATION BOTTOM MARK;So;0;L;<super> 4E0B;;;;N;KAERITEN GE;;;; +3199;IDEOGRAPHIC ANNOTATION FIRST MARK;So;0;L;<super> 7532;;;;N;KAERITEN KOU;;;; +319A;IDEOGRAPHIC ANNOTATION SECOND MARK;So;0;L;<super> 4E59;;;;N;KAERITEN OTU;;;; +319B;IDEOGRAPHIC ANNOTATION THIRD MARK;So;0;L;<super> 4E19;;;;N;KAERITEN HEI;;;; +319C;IDEOGRAPHIC ANNOTATION FOURTH MARK;So;0;L;<super> 4E01;;;;N;KAERITEN TEI;;;; +319D;IDEOGRAPHIC ANNOTATION HEAVEN MARK;So;0;L;<super> 5929;;;;N;KAERITEN TEN;;;; +319E;IDEOGRAPHIC ANNOTATION EARTH MARK;So;0;L;<super> 5730;;;;N;KAERITEN TI;;;; +319F;IDEOGRAPHIC ANNOTATION MAN MARK;So;0;L;<super> 4EBA;;;;N;KAERITEN ZIN;;;; +31A0;BOPOMOFO LETTER BU;Lo;0;L;;;;;N;;;;; +31A1;BOPOMOFO LETTER ZI;Lo;0;L;;;;;N;;;;; +31A2;BOPOMOFO LETTER JI;Lo;0;L;;;;;N;;;;; +31A3;BOPOMOFO LETTER GU;Lo;0;L;;;;;N;;;;; +31A4;BOPOMOFO LETTER EE;Lo;0;L;;;;;N;;;;; +31A5;BOPOMOFO LETTER ENN;Lo;0;L;;;;;N;;;;; +31A6;BOPOMOFO LETTER OO;Lo;0;L;;;;;N;;;;; +31A7;BOPOMOFO LETTER ONN;Lo;0;L;;;;;N;;;;; +31A8;BOPOMOFO LETTER IR;Lo;0;L;;;;;N;;;;; +31A9;BOPOMOFO LETTER ANN;Lo;0;L;;;;;N;;;;; +31AA;BOPOMOFO LETTER INN;Lo;0;L;;;;;N;;;;; +31AB;BOPOMOFO LETTER UNN;Lo;0;L;;;;;N;;;;; +31AC;BOPOMOFO LETTER IM;Lo;0;L;;;;;N;;;;; +31AD;BOPOMOFO LETTER NGG;Lo;0;L;;;;;N;;;;; +31AE;BOPOMOFO LETTER AINN;Lo;0;L;;;;;N;;;;; +31AF;BOPOMOFO LETTER AUNN;Lo;0;L;;;;;N;;;;; +31B0;BOPOMOFO LETTER AM;Lo;0;L;;;;;N;;;;; +31B1;BOPOMOFO LETTER OM;Lo;0;L;;;;;N;;;;; +31B2;BOPOMOFO LETTER ONG;Lo;0;L;;;;;N;;;;; +31B3;BOPOMOFO LETTER INNN;Lo;0;L;;;;;N;;;;; +31B4;BOPOMOFO FINAL LETTER P;Lo;0;L;;;;;N;;;;; +31B5;BOPOMOFO FINAL LETTER T;Lo;0;L;;;;;N;;;;; +31B6;BOPOMOFO FINAL LETTER K;Lo;0;L;;;;;N;;;;; +31B7;BOPOMOFO FINAL LETTER H;Lo;0;L;;;;;N;;;;; +31B8;BOPOMOFO LETTER GH;Lo;0;L;;;;;N;;;;; +31B9;BOPOMOFO LETTER LH;Lo;0;L;;;;;N;;;;; +31BA;BOPOMOFO LETTER ZY;Lo;0;L;;;;;N;;;;; +31C0;CJK STROKE T;So;0;ON;;;;;N;;;;; +31C1;CJK STROKE WG;So;0;ON;;;;;N;;;;; +31C2;CJK STROKE XG;So;0;ON;;;;;N;;;;; +31C3;CJK STROKE BXG;So;0;ON;;;;;N;;;;; +31C4;CJK STROKE SW;So;0;ON;;;;;N;;;;; +31C5;CJK STROKE HZZ;So;0;ON;;;;;N;;;;; +31C6;CJK STROKE HZG;So;0;ON;;;;;N;;;;; +31C7;CJK STROKE HP;So;0;ON;;;;;N;;;;; +31C8;CJK STROKE HZWG;So;0;ON;;;;;N;;;;; +31C9;CJK STROKE SZWG;So;0;ON;;;;;N;;;;; +31CA;CJK STROKE HZT;So;0;ON;;;;;N;;;;; +31CB;CJK STROKE HZZP;So;0;ON;;;;;N;;;;; +31CC;CJK STROKE HPWG;So;0;ON;;;;;N;;;;; +31CD;CJK STROKE HZW;So;0;ON;;;;;N;;;;; +31CE;CJK STROKE HZZZ;So;0;ON;;;;;N;;;;; +31CF;CJK STROKE N;So;0;ON;;;;;N;;;;; +31D0;CJK STROKE H;So;0;ON;;;;;N;;;;; +31D1;CJK STROKE S;So;0;ON;;;;;N;;;;; +31D2;CJK STROKE P;So;0;ON;;;;;N;;;;; +31D3;CJK STROKE SP;So;0;ON;;;;;N;;;;; +31D4;CJK STROKE D;So;0;ON;;;;;N;;;;; +31D5;CJK STROKE HZ;So;0;ON;;;;;N;;;;; +31D6;CJK STROKE HG;So;0;ON;;;;;N;;;;; +31D7;CJK STROKE SZ;So;0;ON;;;;;N;;;;; +31D8;CJK STROKE SWZ;So;0;ON;;;;;N;;;;; +31D9;CJK STROKE ST;So;0;ON;;;;;N;;;;; +31DA;CJK STROKE SG;So;0;ON;;;;;N;;;;; +31DB;CJK STROKE PD;So;0;ON;;;;;N;;;;; +31DC;CJK STROKE PZ;So;0;ON;;;;;N;;;;; +31DD;CJK STROKE TN;So;0;ON;;;;;N;;;;; +31DE;CJK STROKE SZZ;So;0;ON;;;;;N;;;;; +31DF;CJK STROKE SWG;So;0;ON;;;;;N;;;;; +31E0;CJK STROKE HXWG;So;0;ON;;;;;N;;;;; +31E1;CJK STROKE HZZZG;So;0;ON;;;;;N;;;;; +31E2;CJK STROKE PG;So;0;ON;;;;;N;;;;; +31E3;CJK STROKE Q;So;0;ON;;;;;N;;;;; +31F0;KATAKANA LETTER SMALL KU;Lo;0;L;;;;;N;;;;; +31F1;KATAKANA LETTER SMALL SI;Lo;0;L;;;;;N;;;;; +31F2;KATAKANA LETTER SMALL SU;Lo;0;L;;;;;N;;;;; +31F3;KATAKANA LETTER SMALL TO;Lo;0;L;;;;;N;;;;; +31F4;KATAKANA LETTER SMALL NU;Lo;0;L;;;;;N;;;;; +31F5;KATAKANA LETTER SMALL HA;Lo;0;L;;;;;N;;;;; +31F6;KATAKANA LETTER SMALL HI;Lo;0;L;;;;;N;;;;; +31F7;KATAKANA LETTER SMALL HU;Lo;0;L;;;;;N;;;;; +31F8;KATAKANA LETTER SMALL HE;Lo;0;L;;;;;N;;;;; +31F9;KATAKANA LETTER SMALL HO;Lo;0;L;;;;;N;;;;; +31FA;KATAKANA LETTER SMALL MU;Lo;0;L;;;;;N;;;;; +31FB;KATAKANA LETTER SMALL RA;Lo;0;L;;;;;N;;;;; +31FC;KATAKANA LETTER SMALL RI;Lo;0;L;;;;;N;;;;; +31FD;KATAKANA LETTER SMALL RU;Lo;0;L;;;;;N;;;;; +31FE;KATAKANA LETTER SMALL RE;Lo;0;L;;;;;N;;;;; +31FF;KATAKANA LETTER SMALL RO;Lo;0;L;;;;;N;;;;; +3200;PARENTHESIZED HANGUL KIYEOK;So;0;L;<compat> 0028 1100 0029;;;;N;PARENTHESIZED HANGUL GIYEOG;;;; +3201;PARENTHESIZED HANGUL NIEUN;So;0;L;<compat> 0028 1102 0029;;;;N;;;;; +3202;PARENTHESIZED HANGUL TIKEUT;So;0;L;<compat> 0028 1103 0029;;;;N;PARENTHESIZED HANGUL DIGEUD;;;; +3203;PARENTHESIZED HANGUL RIEUL;So;0;L;<compat> 0028 1105 0029;;;;N;PARENTHESIZED HANGUL LIEUL;;;; +3204;PARENTHESIZED HANGUL MIEUM;So;0;L;<compat> 0028 1106 0029;;;;N;;;;; +3205;PARENTHESIZED HANGUL PIEUP;So;0;L;<compat> 0028 1107 0029;;;;N;PARENTHESIZED HANGUL BIEUB;;;; +3206;PARENTHESIZED HANGUL SIOS;So;0;L;<compat> 0028 1109 0029;;;;N;;;;; +3207;PARENTHESIZED HANGUL IEUNG;So;0;L;<compat> 0028 110B 0029;;;;N;;;;; +3208;PARENTHESIZED HANGUL CIEUC;So;0;L;<compat> 0028 110C 0029;;;;N;PARENTHESIZED HANGUL JIEUJ;;;; +3209;PARENTHESIZED HANGUL CHIEUCH;So;0;L;<compat> 0028 110E 0029;;;;N;PARENTHESIZED HANGUL CIEUC;;;; +320A;PARENTHESIZED HANGUL KHIEUKH;So;0;L;<compat> 0028 110F 0029;;;;N;PARENTHESIZED HANGUL KIYEOK;;;; +320B;PARENTHESIZED HANGUL THIEUTH;So;0;L;<compat> 0028 1110 0029;;;;N;PARENTHESIZED HANGUL TIEUT;;;; +320C;PARENTHESIZED HANGUL PHIEUPH;So;0;L;<compat> 0028 1111 0029;;;;N;PARENTHESIZED HANGUL PIEUP;;;; +320D;PARENTHESIZED HANGUL HIEUH;So;0;L;<compat> 0028 1112 0029;;;;N;;;;; +320E;PARENTHESIZED HANGUL KIYEOK A;So;0;L;<compat> 0028 1100 1161 0029;;;;N;PARENTHESIZED HANGUL GA;;;; +320F;PARENTHESIZED HANGUL NIEUN A;So;0;L;<compat> 0028 1102 1161 0029;;;;N;PARENTHESIZED HANGUL NA;;;; +3210;PARENTHESIZED HANGUL TIKEUT A;So;0;L;<compat> 0028 1103 1161 0029;;;;N;PARENTHESIZED HANGUL DA;;;; +3211;PARENTHESIZED HANGUL RIEUL A;So;0;L;<compat> 0028 1105 1161 0029;;;;N;PARENTHESIZED HANGUL LA;;;; +3212;PARENTHESIZED HANGUL MIEUM A;So;0;L;<compat> 0028 1106 1161 0029;;;;N;PARENTHESIZED HANGUL MA;;;; +3213;PARENTHESIZED HANGUL PIEUP A;So;0;L;<compat> 0028 1107 1161 0029;;;;N;PARENTHESIZED HANGUL BA;;;; +3214;PARENTHESIZED HANGUL SIOS A;So;0;L;<compat> 0028 1109 1161 0029;;;;N;PARENTHESIZED HANGUL SA;;;; +3215;PARENTHESIZED HANGUL IEUNG A;So;0;L;<compat> 0028 110B 1161 0029;;;;N;PARENTHESIZED HANGUL A;;;; +3216;PARENTHESIZED HANGUL CIEUC A;So;0;L;<compat> 0028 110C 1161 0029;;;;N;PARENTHESIZED HANGUL JA;;;; +3217;PARENTHESIZED HANGUL CHIEUCH A;So;0;L;<compat> 0028 110E 1161 0029;;;;N;PARENTHESIZED HANGUL CA;;;; +3218;PARENTHESIZED HANGUL KHIEUKH A;So;0;L;<compat> 0028 110F 1161 0029;;;;N;PARENTHESIZED HANGUL KA;;;; +3219;PARENTHESIZED HANGUL THIEUTH A;So;0;L;<compat> 0028 1110 1161 0029;;;;N;PARENTHESIZED HANGUL TA;;;; +321A;PARENTHESIZED HANGUL PHIEUPH A;So;0;L;<compat> 0028 1111 1161 0029;;;;N;PARENTHESIZED HANGUL PA;;;; +321B;PARENTHESIZED HANGUL HIEUH A;So;0;L;<compat> 0028 1112 1161 0029;;;;N;PARENTHESIZED HANGUL HA;;;; +321C;PARENTHESIZED HANGUL CIEUC U;So;0;L;<compat> 0028 110C 116E 0029;;;;N;PARENTHESIZED HANGUL JU;;;; +321D;PARENTHESIZED KOREAN CHARACTER OJEON;So;0;ON;<compat> 0028 110B 1169 110C 1165 11AB 0029;;;;N;;;;; +321E;PARENTHESIZED KOREAN CHARACTER O HU;So;0;ON;<compat> 0028 110B 1169 1112 116E 0029;;;;N;;;;; +3220;PARENTHESIZED IDEOGRAPH ONE;No;0;L;<compat> 0028 4E00 0029;;;1;N;;;;; +3221;PARENTHESIZED IDEOGRAPH TWO;No;0;L;<compat> 0028 4E8C 0029;;;2;N;;;;; +3222;PARENTHESIZED IDEOGRAPH THREE;No;0;L;<compat> 0028 4E09 0029;;;3;N;;;;; +3223;PARENTHESIZED IDEOGRAPH FOUR;No;0;L;<compat> 0028 56DB 0029;;;4;N;;;;; +3224;PARENTHESIZED IDEOGRAPH FIVE;No;0;L;<compat> 0028 4E94 0029;;;5;N;;;;; +3225;PARENTHESIZED IDEOGRAPH SIX;No;0;L;<compat> 0028 516D 0029;;;6;N;;;;; +3226;PARENTHESIZED IDEOGRAPH SEVEN;No;0;L;<compat> 0028 4E03 0029;;;7;N;;;;; +3227;PARENTHESIZED IDEOGRAPH EIGHT;No;0;L;<compat> 0028 516B 0029;;;8;N;;;;; +3228;PARENTHESIZED IDEOGRAPH NINE;No;0;L;<compat> 0028 4E5D 0029;;;9;N;;;;; +3229;PARENTHESIZED IDEOGRAPH TEN;No;0;L;<compat> 0028 5341 0029;;;10;N;;;;; +322A;PARENTHESIZED IDEOGRAPH MOON;So;0;L;<compat> 0028 6708 0029;;;;N;;;;; +322B;PARENTHESIZED IDEOGRAPH FIRE;So;0;L;<compat> 0028 706B 0029;;;;N;;;;; +322C;PARENTHESIZED IDEOGRAPH WATER;So;0;L;<compat> 0028 6C34 0029;;;;N;;;;; +322D;PARENTHESIZED IDEOGRAPH WOOD;So;0;L;<compat> 0028 6728 0029;;;;N;;;;; +322E;PARENTHESIZED IDEOGRAPH METAL;So;0;L;<compat> 0028 91D1 0029;;;;N;;;;; +322F;PARENTHESIZED IDEOGRAPH EARTH;So;0;L;<compat> 0028 571F 0029;;;;N;;;;; +3230;PARENTHESIZED IDEOGRAPH SUN;So;0;L;<compat> 0028 65E5 0029;;;;N;;;;; +3231;PARENTHESIZED IDEOGRAPH STOCK;So;0;L;<compat> 0028 682A 0029;;;;N;;;;; +3232;PARENTHESIZED IDEOGRAPH HAVE;So;0;L;<compat> 0028 6709 0029;;;;N;;;;; +3233;PARENTHESIZED IDEOGRAPH SOCIETY;So;0;L;<compat> 0028 793E 0029;;;;N;;;;; +3234;PARENTHESIZED IDEOGRAPH NAME;So;0;L;<compat> 0028 540D 0029;;;;N;;;;; +3235;PARENTHESIZED IDEOGRAPH SPECIAL;So;0;L;<compat> 0028 7279 0029;;;;N;;;;; +3236;PARENTHESIZED IDEOGRAPH FINANCIAL;So;0;L;<compat> 0028 8CA1 0029;;;;N;;;;; +3237;PARENTHESIZED IDEOGRAPH CONGRATULATION;So;0;L;<compat> 0028 795D 0029;;;;N;;;;; +3238;PARENTHESIZED IDEOGRAPH LABOR;So;0;L;<compat> 0028 52B4 0029;;;;N;;;;; +3239;PARENTHESIZED IDEOGRAPH REPRESENT;So;0;L;<compat> 0028 4EE3 0029;;;;N;;;;; +323A;PARENTHESIZED IDEOGRAPH CALL;So;0;L;<compat> 0028 547C 0029;;;;N;;;;; +323B;PARENTHESIZED IDEOGRAPH STUDY;So;0;L;<compat> 0028 5B66 0029;;;;N;;;;; +323C;PARENTHESIZED IDEOGRAPH SUPERVISE;So;0;L;<compat> 0028 76E3 0029;;;;N;;;;; +323D;PARENTHESIZED IDEOGRAPH ENTERPRISE;So;0;L;<compat> 0028 4F01 0029;;;;N;;;;; +323E;PARENTHESIZED IDEOGRAPH RESOURCE;So;0;L;<compat> 0028 8CC7 0029;;;;N;;;;; +323F;PARENTHESIZED IDEOGRAPH ALLIANCE;So;0;L;<compat> 0028 5354 0029;;;;N;;;;; +3240;PARENTHESIZED IDEOGRAPH FESTIVAL;So;0;L;<compat> 0028 796D 0029;;;;N;;;;; +3241;PARENTHESIZED IDEOGRAPH REST;So;0;L;<compat> 0028 4F11 0029;;;;N;;;;; +3242;PARENTHESIZED IDEOGRAPH SELF;So;0;L;<compat> 0028 81EA 0029;;;;N;;;;; +3243;PARENTHESIZED IDEOGRAPH REACH;So;0;L;<compat> 0028 81F3 0029;;;;N;;;;; +3244;CIRCLED IDEOGRAPH QUESTION;So;0;L;<circle> 554F;;;;N;;;;; +3245;CIRCLED IDEOGRAPH KINDERGARTEN;So;0;L;<circle> 5E7C;;;;N;;;;; +3246;CIRCLED IDEOGRAPH SCHOOL;So;0;L;<circle> 6587;;;;N;;;;; +3247;CIRCLED IDEOGRAPH KOTO;So;0;L;<circle> 7B8F;;;;N;;;;; +3248;CIRCLED NUMBER TEN ON BLACK SQUARE;No;0;L;;;;10;N;;;;; +3249;CIRCLED NUMBER TWENTY ON BLACK SQUARE;No;0;L;;;;20;N;;;;; +324A;CIRCLED NUMBER THIRTY ON BLACK SQUARE;No;0;L;;;;30;N;;;;; +324B;CIRCLED NUMBER FORTY ON BLACK SQUARE;No;0;L;;;;40;N;;;;; +324C;CIRCLED NUMBER FIFTY ON BLACK SQUARE;No;0;L;;;;50;N;;;;; +324D;CIRCLED NUMBER SIXTY ON BLACK SQUARE;No;0;L;;;;60;N;;;;; +324E;CIRCLED NUMBER SEVENTY ON BLACK SQUARE;No;0;L;;;;70;N;;;;; +324F;CIRCLED NUMBER EIGHTY ON BLACK SQUARE;No;0;L;;;;80;N;;;;; +3250;PARTNERSHIP SIGN;So;0;ON;<square> 0050 0054 0045;;;;N;;;;; +3251;CIRCLED NUMBER TWENTY ONE;No;0;ON;<circle> 0032 0031;;;21;N;;;;; +3252;CIRCLED NUMBER TWENTY TWO;No;0;ON;<circle> 0032 0032;;;22;N;;;;; +3253;CIRCLED NUMBER TWENTY THREE;No;0;ON;<circle> 0032 0033;;;23;N;;;;; +3254;CIRCLED NUMBER TWENTY FOUR;No;0;ON;<circle> 0032 0034;;;24;N;;;;; +3255;CIRCLED NUMBER TWENTY FIVE;No;0;ON;<circle> 0032 0035;;;25;N;;;;; +3256;CIRCLED NUMBER TWENTY SIX;No;0;ON;<circle> 0032 0036;;;26;N;;;;; +3257;CIRCLED NUMBER TWENTY SEVEN;No;0;ON;<circle> 0032 0037;;;27;N;;;;; +3258;CIRCLED NUMBER TWENTY EIGHT;No;0;ON;<circle> 0032 0038;;;28;N;;;;; +3259;CIRCLED NUMBER TWENTY NINE;No;0;ON;<circle> 0032 0039;;;29;N;;;;; +325A;CIRCLED NUMBER THIRTY;No;0;ON;<circle> 0033 0030;;;30;N;;;;; +325B;CIRCLED NUMBER THIRTY ONE;No;0;ON;<circle> 0033 0031;;;31;N;;;;; +325C;CIRCLED NUMBER THIRTY TWO;No;0;ON;<circle> 0033 0032;;;32;N;;;;; +325D;CIRCLED NUMBER THIRTY THREE;No;0;ON;<circle> 0033 0033;;;33;N;;;;; +325E;CIRCLED NUMBER THIRTY FOUR;No;0;ON;<circle> 0033 0034;;;34;N;;;;; +325F;CIRCLED NUMBER THIRTY FIVE;No;0;ON;<circle> 0033 0035;;;35;N;;;;; +3260;CIRCLED HANGUL KIYEOK;So;0;L;<circle> 1100;;;;N;CIRCLED HANGUL GIYEOG;;;; +3261;CIRCLED HANGUL NIEUN;So;0;L;<circle> 1102;;;;N;;;;; +3262;CIRCLED HANGUL TIKEUT;So;0;L;<circle> 1103;;;;N;CIRCLED HANGUL DIGEUD;;;; +3263;CIRCLED HANGUL RIEUL;So;0;L;<circle> 1105;;;;N;CIRCLED HANGUL LIEUL;;;; +3264;CIRCLED HANGUL MIEUM;So;0;L;<circle> 1106;;;;N;;;;; +3265;CIRCLED HANGUL PIEUP;So;0;L;<circle> 1107;;;;N;CIRCLED HANGUL BIEUB;;;; +3266;CIRCLED HANGUL SIOS;So;0;L;<circle> 1109;;;;N;;;;; +3267;CIRCLED HANGUL IEUNG;So;0;L;<circle> 110B;;;;N;;;;; +3268;CIRCLED HANGUL CIEUC;So;0;L;<circle> 110C;;;;N;CIRCLED HANGUL JIEUJ;;;; +3269;CIRCLED HANGUL CHIEUCH;So;0;L;<circle> 110E;;;;N;CIRCLED HANGUL CIEUC;;;; +326A;CIRCLED HANGUL KHIEUKH;So;0;L;<circle> 110F;;;;N;CIRCLED HANGUL KIYEOK;;;; +326B;CIRCLED HANGUL THIEUTH;So;0;L;<circle> 1110;;;;N;CIRCLED HANGUL TIEUT;;;; +326C;CIRCLED HANGUL PHIEUPH;So;0;L;<circle> 1111;;;;N;CIRCLED HANGUL PIEUP;;;; +326D;CIRCLED HANGUL HIEUH;So;0;L;<circle> 1112;;;;N;;;;; +326E;CIRCLED HANGUL KIYEOK A;So;0;L;<circle> 1100 1161;;;;N;CIRCLED HANGUL GA;;;; +326F;CIRCLED HANGUL NIEUN A;So;0;L;<circle> 1102 1161;;;;N;CIRCLED HANGUL NA;;;; +3270;CIRCLED HANGUL TIKEUT A;So;0;L;<circle> 1103 1161;;;;N;CIRCLED HANGUL DA;;;; +3271;CIRCLED HANGUL RIEUL A;So;0;L;<circle> 1105 1161;;;;N;CIRCLED HANGUL LA;;;; +3272;CIRCLED HANGUL MIEUM A;So;0;L;<circle> 1106 1161;;;;N;CIRCLED HANGUL MA;;;; +3273;CIRCLED HANGUL PIEUP A;So;0;L;<circle> 1107 1161;;;;N;CIRCLED HANGUL BA;;;; +3274;CIRCLED HANGUL SIOS A;So;0;L;<circle> 1109 1161;;;;N;CIRCLED HANGUL SA;;;; +3275;CIRCLED HANGUL IEUNG A;So;0;L;<circle> 110B 1161;;;;N;CIRCLED HANGUL A;;;; +3276;CIRCLED HANGUL CIEUC A;So;0;L;<circle> 110C 1161;;;;N;CIRCLED HANGUL JA;;;; +3277;CIRCLED HANGUL CHIEUCH A;So;0;L;<circle> 110E 1161;;;;N;CIRCLED HANGUL CA;;;; +3278;CIRCLED HANGUL KHIEUKH A;So;0;L;<circle> 110F 1161;;;;N;CIRCLED HANGUL KA;;;; +3279;CIRCLED HANGUL THIEUTH A;So;0;L;<circle> 1110 1161;;;;N;CIRCLED HANGUL TA;;;; +327A;CIRCLED HANGUL PHIEUPH A;So;0;L;<circle> 1111 1161;;;;N;CIRCLED HANGUL PA;;;; +327B;CIRCLED HANGUL HIEUH A;So;0;L;<circle> 1112 1161;;;;N;CIRCLED HANGUL HA;;;; +327C;CIRCLED KOREAN CHARACTER CHAMKO;So;0;ON;<circle> 110E 1161 11B7 1100 1169;;;;N;;;;; +327D;CIRCLED KOREAN CHARACTER JUEUI;So;0;ON;<circle> 110C 116E 110B 1174;;;;N;;;;; +327E;CIRCLED HANGUL IEUNG U;So;0;ON;<circle> 110B 116E;;;;N;;;;; +327F;KOREAN STANDARD SYMBOL;So;0;L;;;;;N;;;;; +3280;CIRCLED IDEOGRAPH ONE;No;0;L;<circle> 4E00;;;1;N;;;;; +3281;CIRCLED IDEOGRAPH TWO;No;0;L;<circle> 4E8C;;;2;N;;;;; +3282;CIRCLED IDEOGRAPH THREE;No;0;L;<circle> 4E09;;;3;N;;;;; +3283;CIRCLED IDEOGRAPH FOUR;No;0;L;<circle> 56DB;;;4;N;;;;; +3284;CIRCLED IDEOGRAPH FIVE;No;0;L;<circle> 4E94;;;5;N;;;;; +3285;CIRCLED IDEOGRAPH SIX;No;0;L;<circle> 516D;;;6;N;;;;; +3286;CIRCLED IDEOGRAPH SEVEN;No;0;L;<circle> 4E03;;;7;N;;;;; +3287;CIRCLED IDEOGRAPH EIGHT;No;0;L;<circle> 516B;;;8;N;;;;; +3288;CIRCLED IDEOGRAPH NINE;No;0;L;<circle> 4E5D;;;9;N;;;;; +3289;CIRCLED IDEOGRAPH TEN;No;0;L;<circle> 5341;;;10;N;;;;; +328A;CIRCLED IDEOGRAPH MOON;So;0;L;<circle> 6708;;;;N;;;;; +328B;CIRCLED IDEOGRAPH FIRE;So;0;L;<circle> 706B;;;;N;;;;; +328C;CIRCLED IDEOGRAPH WATER;So;0;L;<circle> 6C34;;;;N;;;;; +328D;CIRCLED IDEOGRAPH WOOD;So;0;L;<circle> 6728;;;;N;;;;; +328E;CIRCLED IDEOGRAPH METAL;So;0;L;<circle> 91D1;;;;N;;;;; +328F;CIRCLED IDEOGRAPH EARTH;So;0;L;<circle> 571F;;;;N;;;;; +3290;CIRCLED IDEOGRAPH SUN;So;0;L;<circle> 65E5;;;;N;;;;; +3291;CIRCLED IDEOGRAPH STOCK;So;0;L;<circle> 682A;;;;N;;;;; +3292;CIRCLED IDEOGRAPH HAVE;So;0;L;<circle> 6709;;;;N;;;;; +3293;CIRCLED IDEOGRAPH SOCIETY;So;0;L;<circle> 793E;;;;N;;;;; +3294;CIRCLED IDEOGRAPH NAME;So;0;L;<circle> 540D;;;;N;;;;; +3295;CIRCLED IDEOGRAPH SPECIAL;So;0;L;<circle> 7279;;;;N;;;;; +3296;CIRCLED IDEOGRAPH FINANCIAL;So;0;L;<circle> 8CA1;;;;N;;;;; +3297;CIRCLED IDEOGRAPH CONGRATULATION;So;0;L;<circle> 795D;;;;N;;;;; +3298;CIRCLED IDEOGRAPH LABOR;So;0;L;<circle> 52B4;;;;N;;;;; +3299;CIRCLED IDEOGRAPH SECRET;So;0;L;<circle> 79D8;;;;N;;;;; +329A;CIRCLED IDEOGRAPH MALE;So;0;L;<circle> 7537;;;;N;;;;; +329B;CIRCLED IDEOGRAPH FEMALE;So;0;L;<circle> 5973;;;;N;;;;; +329C;CIRCLED IDEOGRAPH SUITABLE;So;0;L;<circle> 9069;;;;N;;;;; +329D;CIRCLED IDEOGRAPH EXCELLENT;So;0;L;<circle> 512A;;;;N;;;;; +329E;CIRCLED IDEOGRAPH PRINT;So;0;L;<circle> 5370;;;;N;;;;; +329F;CIRCLED IDEOGRAPH ATTENTION;So;0;L;<circle> 6CE8;;;;N;;;;; +32A0;CIRCLED IDEOGRAPH ITEM;So;0;L;<circle> 9805;;;;N;;;;; +32A1;CIRCLED IDEOGRAPH REST;So;0;L;<circle> 4F11;;;;N;;;;; +32A2;CIRCLED IDEOGRAPH COPY;So;0;L;<circle> 5199;;;;N;;;;; +32A3;CIRCLED IDEOGRAPH CORRECT;So;0;L;<circle> 6B63;;;;N;;;;; +32A4;CIRCLED IDEOGRAPH HIGH;So;0;L;<circle> 4E0A;;;;N;;;;; +32A5;CIRCLED IDEOGRAPH CENTRE;So;0;L;<circle> 4E2D;;;;N;CIRCLED IDEOGRAPH CENTER;;;; +32A6;CIRCLED IDEOGRAPH LOW;So;0;L;<circle> 4E0B;;;;N;;;;; +32A7;CIRCLED IDEOGRAPH LEFT;So;0;L;<circle> 5DE6;;;;N;;;;; +32A8;CIRCLED IDEOGRAPH RIGHT;So;0;L;<circle> 53F3;;;;N;;;;; +32A9;CIRCLED IDEOGRAPH MEDICINE;So;0;L;<circle> 533B;;;;N;;;;; +32AA;CIRCLED IDEOGRAPH RELIGION;So;0;L;<circle> 5B97;;;;N;;;;; +32AB;CIRCLED IDEOGRAPH STUDY;So;0;L;<circle> 5B66;;;;N;;;;; +32AC;CIRCLED IDEOGRAPH SUPERVISE;So;0;L;<circle> 76E3;;;;N;;;;; +32AD;CIRCLED IDEOGRAPH ENTERPRISE;So;0;L;<circle> 4F01;;;;N;;;;; +32AE;CIRCLED IDEOGRAPH RESOURCE;So;0;L;<circle> 8CC7;;;;N;;;;; +32AF;CIRCLED IDEOGRAPH ALLIANCE;So;0;L;<circle> 5354;;;;N;;;;; +32B0;CIRCLED IDEOGRAPH NIGHT;So;0;L;<circle> 591C;;;;N;;;;; +32B1;CIRCLED NUMBER THIRTY SIX;No;0;ON;<circle> 0033 0036;;;36;N;;;;; +32B2;CIRCLED NUMBER THIRTY SEVEN;No;0;ON;<circle> 0033 0037;;;37;N;;;;; +32B3;CIRCLED NUMBER THIRTY EIGHT;No;0;ON;<circle> 0033 0038;;;38;N;;;;; +32B4;CIRCLED NUMBER THIRTY NINE;No;0;ON;<circle> 0033 0039;;;39;N;;;;; +32B5;CIRCLED NUMBER FORTY;No;0;ON;<circle> 0034 0030;;;40;N;;;;; +32B6;CIRCLED NUMBER FORTY ONE;No;0;ON;<circle> 0034 0031;;;41;N;;;;; +32B7;CIRCLED NUMBER FORTY TWO;No;0;ON;<circle> 0034 0032;;;42;N;;;;; +32B8;CIRCLED NUMBER FORTY THREE;No;0;ON;<circle> 0034 0033;;;43;N;;;;; +32B9;CIRCLED NUMBER FORTY FOUR;No;0;ON;<circle> 0034 0034;;;44;N;;;;; +32BA;CIRCLED NUMBER FORTY FIVE;No;0;ON;<circle> 0034 0035;;;45;N;;;;; +32BB;CIRCLED NUMBER FORTY SIX;No;0;ON;<circle> 0034 0036;;;46;N;;;;; +32BC;CIRCLED NUMBER FORTY SEVEN;No;0;ON;<circle> 0034 0037;;;47;N;;;;; +32BD;CIRCLED NUMBER FORTY EIGHT;No;0;ON;<circle> 0034 0038;;;48;N;;;;; +32BE;CIRCLED NUMBER FORTY NINE;No;0;ON;<circle> 0034 0039;;;49;N;;;;; +32BF;CIRCLED NUMBER FIFTY;No;0;ON;<circle> 0035 0030;;;50;N;;;;; +32C0;IDEOGRAPHIC TELEGRAPH SYMBOL FOR JANUARY;So;0;L;<compat> 0031 6708;;;;N;;;;; +32C1;IDEOGRAPHIC TELEGRAPH SYMBOL FOR FEBRUARY;So;0;L;<compat> 0032 6708;;;;N;;;;; +32C2;IDEOGRAPHIC TELEGRAPH SYMBOL FOR MARCH;So;0;L;<compat> 0033 6708;;;;N;;;;; +32C3;IDEOGRAPHIC TELEGRAPH SYMBOL FOR APRIL;So;0;L;<compat> 0034 6708;;;;N;;;;; +32C4;IDEOGRAPHIC TELEGRAPH SYMBOL FOR MAY;So;0;L;<compat> 0035 6708;;;;N;;;;; +32C5;IDEOGRAPHIC TELEGRAPH SYMBOL FOR JUNE;So;0;L;<compat> 0036 6708;;;;N;;;;; +32C6;IDEOGRAPHIC TELEGRAPH SYMBOL FOR JULY;So;0;L;<compat> 0037 6708;;;;N;;;;; +32C7;IDEOGRAPHIC TELEGRAPH SYMBOL FOR AUGUST;So;0;L;<compat> 0038 6708;;;;N;;;;; +32C8;IDEOGRAPHIC TELEGRAPH SYMBOL FOR SEPTEMBER;So;0;L;<compat> 0039 6708;;;;N;;;;; +32C9;IDEOGRAPHIC TELEGRAPH SYMBOL FOR OCTOBER;So;0;L;<compat> 0031 0030 6708;;;;N;;;;; +32CA;IDEOGRAPHIC TELEGRAPH SYMBOL FOR NOVEMBER;So;0;L;<compat> 0031 0031 6708;;;;N;;;;; +32CB;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DECEMBER;So;0;L;<compat> 0031 0032 6708;;;;N;;;;; +32CC;SQUARE HG;So;0;ON;<square> 0048 0067;;;;N;;;;; +32CD;SQUARE ERG;So;0;ON;<square> 0065 0072 0067;;;;N;;;;; +32CE;SQUARE EV;So;0;ON;<square> 0065 0056;;;;N;;;;; +32CF;LIMITED LIABILITY SIGN;So;0;ON;<square> 004C 0054 0044;;;;N;;;;; +32D0;CIRCLED KATAKANA A;So;0;L;<circle> 30A2;;;;N;;;;; +32D1;CIRCLED KATAKANA I;So;0;L;<circle> 30A4;;;;N;;;;; +32D2;CIRCLED KATAKANA U;So;0;L;<circle> 30A6;;;;N;;;;; +32D3;CIRCLED KATAKANA E;So;0;L;<circle> 30A8;;;;N;;;;; +32D4;CIRCLED KATAKANA O;So;0;L;<circle> 30AA;;;;N;;;;; +32D5;CIRCLED KATAKANA KA;So;0;L;<circle> 30AB;;;;N;;;;; +32D6;CIRCLED KATAKANA KI;So;0;L;<circle> 30AD;;;;N;;;;; +32D7;CIRCLED KATAKANA KU;So;0;L;<circle> 30AF;;;;N;;;;; +32D8;CIRCLED KATAKANA KE;So;0;L;<circle> 30B1;;;;N;;;;; +32D9;CIRCLED KATAKANA KO;So;0;L;<circle> 30B3;;;;N;;;;; +32DA;CIRCLED KATAKANA SA;So;0;L;<circle> 30B5;;;;N;;;;; +32DB;CIRCLED KATAKANA SI;So;0;L;<circle> 30B7;;;;N;;;;; +32DC;CIRCLED KATAKANA SU;So;0;L;<circle> 30B9;;;;N;;;;; +32DD;CIRCLED KATAKANA SE;So;0;L;<circle> 30BB;;;;N;;;;; +32DE;CIRCLED KATAKANA SO;So;0;L;<circle> 30BD;;;;N;;;;; +32DF;CIRCLED KATAKANA TA;So;0;L;<circle> 30BF;;;;N;;;;; +32E0;CIRCLED KATAKANA TI;So;0;L;<circle> 30C1;;;;N;;;;; +32E1;CIRCLED KATAKANA TU;So;0;L;<circle> 30C4;;;;N;;;;; +32E2;CIRCLED KATAKANA TE;So;0;L;<circle> 30C6;;;;N;;;;; +32E3;CIRCLED KATAKANA TO;So;0;L;<circle> 30C8;;;;N;;;;; +32E4;CIRCLED KATAKANA NA;So;0;L;<circle> 30CA;;;;N;;;;; +32E5;CIRCLED KATAKANA NI;So;0;L;<circle> 30CB;;;;N;;;;; +32E6;CIRCLED KATAKANA NU;So;0;L;<circle> 30CC;;;;N;;;;; +32E7;CIRCLED KATAKANA NE;So;0;L;<circle> 30CD;;;;N;;;;; +32E8;CIRCLED KATAKANA NO;So;0;L;<circle> 30CE;;;;N;;;;; +32E9;CIRCLED KATAKANA HA;So;0;L;<circle> 30CF;;;;N;;;;; +32EA;CIRCLED KATAKANA HI;So;0;L;<circle> 30D2;;;;N;;;;; +32EB;CIRCLED KATAKANA HU;So;0;L;<circle> 30D5;;;;N;;;;; +32EC;CIRCLED KATAKANA HE;So;0;L;<circle> 30D8;;;;N;;;;; +32ED;CIRCLED KATAKANA HO;So;0;L;<circle> 30DB;;;;N;;;;; +32EE;CIRCLED KATAKANA MA;So;0;L;<circle> 30DE;;;;N;;;;; +32EF;CIRCLED KATAKANA MI;So;0;L;<circle> 30DF;;;;N;;;;; +32F0;CIRCLED KATAKANA MU;So;0;L;<circle> 30E0;;;;N;;;;; +32F1;CIRCLED KATAKANA ME;So;0;L;<circle> 30E1;;;;N;;;;; +32F2;CIRCLED KATAKANA MO;So;0;L;<circle> 30E2;;;;N;;;;; +32F3;CIRCLED KATAKANA YA;So;0;L;<circle> 30E4;;;;N;;;;; +32F4;CIRCLED KATAKANA YU;So;0;L;<circle> 30E6;;;;N;;;;; +32F5;CIRCLED KATAKANA YO;So;0;L;<circle> 30E8;;;;N;;;;; +32F6;CIRCLED KATAKANA RA;So;0;L;<circle> 30E9;;;;N;;;;; +32F7;CIRCLED KATAKANA RI;So;0;L;<circle> 30EA;;;;N;;;;; +32F8;CIRCLED KATAKANA RU;So;0;L;<circle> 30EB;;;;N;;;;; +32F9;CIRCLED KATAKANA RE;So;0;L;<circle> 30EC;;;;N;;;;; +32FA;CIRCLED KATAKANA RO;So;0;L;<circle> 30ED;;;;N;;;;; +32FB;CIRCLED KATAKANA WA;So;0;L;<circle> 30EF;;;;N;;;;; +32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;; +32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;; +32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;; +3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;; +3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;; +3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;; +3303;SQUARE AARU;So;0;L;<square> 30A2 30FC 30EB;;;;N;SQUARED AARU;;;; +3304;SQUARE ININGU;So;0;L;<square> 30A4 30CB 30F3 30B0;;;;N;SQUARED ININGU;;;; +3305;SQUARE INTI;So;0;L;<square> 30A4 30F3 30C1;;;;N;SQUARED INTI;;;; +3306;SQUARE UON;So;0;L;<square> 30A6 30A9 30F3;;;;N;SQUARED UON;;;; +3307;SQUARE ESUKUUDO;So;0;L;<square> 30A8 30B9 30AF 30FC 30C9;;;;N;SQUARED ESUKUUDO;;;; +3308;SQUARE EEKAA;So;0;L;<square> 30A8 30FC 30AB 30FC;;;;N;SQUARED EEKAA;;;; +3309;SQUARE ONSU;So;0;L;<square> 30AA 30F3 30B9;;;;N;SQUARED ONSU;;;; +330A;SQUARE OOMU;So;0;L;<square> 30AA 30FC 30E0;;;;N;SQUARED OOMU;;;; +330B;SQUARE KAIRI;So;0;L;<square> 30AB 30A4 30EA;;;;N;SQUARED KAIRI;;;; +330C;SQUARE KARATTO;So;0;L;<square> 30AB 30E9 30C3 30C8;;;;N;SQUARED KARATTO;;;; +330D;SQUARE KARORII;So;0;L;<square> 30AB 30ED 30EA 30FC;;;;N;SQUARED KARORII;;;; +330E;SQUARE GARON;So;0;L;<square> 30AC 30ED 30F3;;;;N;SQUARED GARON;;;; +330F;SQUARE GANMA;So;0;L;<square> 30AC 30F3 30DE;;;;N;SQUARED GANMA;;;; +3310;SQUARE GIGA;So;0;L;<square> 30AE 30AC;;;;N;SQUARED GIGA;;;; +3311;SQUARE GINII;So;0;L;<square> 30AE 30CB 30FC;;;;N;SQUARED GINII;;;; +3312;SQUARE KYURII;So;0;L;<square> 30AD 30E5 30EA 30FC;;;;N;SQUARED KYURII;;;; +3313;SQUARE GIRUDAA;So;0;L;<square> 30AE 30EB 30C0 30FC;;;;N;SQUARED GIRUDAA;;;; +3314;SQUARE KIRO;So;0;L;<square> 30AD 30ED;;;;N;SQUARED KIRO;;;; +3315;SQUARE KIROGURAMU;So;0;L;<square> 30AD 30ED 30B0 30E9 30E0;;;;N;SQUARED KIROGURAMU;;;; +3316;SQUARE KIROMEETORU;So;0;L;<square> 30AD 30ED 30E1 30FC 30C8 30EB;;;;N;SQUARED KIROMEETORU;;;; +3317;SQUARE KIROWATTO;So;0;L;<square> 30AD 30ED 30EF 30C3 30C8;;;;N;SQUARED KIROWATTO;;;; +3318;SQUARE GURAMU;So;0;L;<square> 30B0 30E9 30E0;;;;N;SQUARED GURAMU;;;; +3319;SQUARE GURAMUTON;So;0;L;<square> 30B0 30E9 30E0 30C8 30F3;;;;N;SQUARED GURAMUTON;;;; +331A;SQUARE KURUZEIRO;So;0;L;<square> 30AF 30EB 30BC 30A4 30ED;;;;N;SQUARED KURUZEIRO;;;; +331B;SQUARE KUROONE;So;0;L;<square> 30AF 30ED 30FC 30CD;;;;N;SQUARED KUROONE;;;; +331C;SQUARE KEESU;So;0;L;<square> 30B1 30FC 30B9;;;;N;SQUARED KEESU;;;; +331D;SQUARE KORUNA;So;0;L;<square> 30B3 30EB 30CA;;;;N;SQUARED KORUNA;;;; +331E;SQUARE KOOPO;So;0;L;<square> 30B3 30FC 30DD;;;;N;SQUARED KOOPO;;;; +331F;SQUARE SAIKURU;So;0;L;<square> 30B5 30A4 30AF 30EB;;;;N;SQUARED SAIKURU;;;; +3320;SQUARE SANTIIMU;So;0;L;<square> 30B5 30F3 30C1 30FC 30E0;;;;N;SQUARED SANTIIMU;;;; +3321;SQUARE SIRINGU;So;0;L;<square> 30B7 30EA 30F3 30B0;;;;N;SQUARED SIRINGU;;;; +3322;SQUARE SENTI;So;0;L;<square> 30BB 30F3 30C1;;;;N;SQUARED SENTI;;;; +3323;SQUARE SENTO;So;0;L;<square> 30BB 30F3 30C8;;;;N;SQUARED SENTO;;;; +3324;SQUARE DAASU;So;0;L;<square> 30C0 30FC 30B9;;;;N;SQUARED DAASU;;;; +3325;SQUARE DESI;So;0;L;<square> 30C7 30B7;;;;N;SQUARED DESI;;;; +3326;SQUARE DORU;So;0;L;<square> 30C9 30EB;;;;N;SQUARED DORU;;;; +3327;SQUARE TON;So;0;L;<square> 30C8 30F3;;;;N;SQUARED TON;;;; +3328;SQUARE NANO;So;0;L;<square> 30CA 30CE;;;;N;SQUARED NANO;;;; +3329;SQUARE NOTTO;So;0;L;<square> 30CE 30C3 30C8;;;;N;SQUARED NOTTO;;;; +332A;SQUARE HAITU;So;0;L;<square> 30CF 30A4 30C4;;;;N;SQUARED HAITU;;;; +332B;SQUARE PAASENTO;So;0;L;<square> 30D1 30FC 30BB 30F3 30C8;;;;N;SQUARED PAASENTO;;;; +332C;SQUARE PAATU;So;0;L;<square> 30D1 30FC 30C4;;;;N;SQUARED PAATU;;;; +332D;SQUARE BAARERU;So;0;L;<square> 30D0 30FC 30EC 30EB;;;;N;SQUARED BAARERU;;;; +332E;SQUARE PIASUTORU;So;0;L;<square> 30D4 30A2 30B9 30C8 30EB;;;;N;SQUARED PIASUTORU;;;; +332F;SQUARE PIKURU;So;0;L;<square> 30D4 30AF 30EB;;;;N;SQUARED PIKURU;;;; +3330;SQUARE PIKO;So;0;L;<square> 30D4 30B3;;;;N;SQUARED PIKO;;;; +3331;SQUARE BIRU;So;0;L;<square> 30D3 30EB;;;;N;SQUARED BIRU;;;; +3332;SQUARE HUARADDO;So;0;L;<square> 30D5 30A1 30E9 30C3 30C9;;;;N;SQUARED HUARADDO;;;; +3333;SQUARE HUIITO;So;0;L;<square> 30D5 30A3 30FC 30C8;;;;N;SQUARED HUIITO;;;; +3334;SQUARE BUSSYERU;So;0;L;<square> 30D6 30C3 30B7 30A7 30EB;;;;N;SQUARED BUSSYERU;;;; +3335;SQUARE HURAN;So;0;L;<square> 30D5 30E9 30F3;;;;N;SQUARED HURAN;;;; +3336;SQUARE HEKUTAARU;So;0;L;<square> 30D8 30AF 30BF 30FC 30EB;;;;N;SQUARED HEKUTAARU;;;; +3337;SQUARE PESO;So;0;L;<square> 30DA 30BD;;;;N;SQUARED PESO;;;; +3338;SQUARE PENIHI;So;0;L;<square> 30DA 30CB 30D2;;;;N;SQUARED PENIHI;;;; +3339;SQUARE HERUTU;So;0;L;<square> 30D8 30EB 30C4;;;;N;SQUARED HERUTU;;;; +333A;SQUARE PENSU;So;0;L;<square> 30DA 30F3 30B9;;;;N;SQUARED PENSU;;;; +333B;SQUARE PEEZI;So;0;L;<square> 30DA 30FC 30B8;;;;N;SQUARED PEEZI;;;; +333C;SQUARE BEETA;So;0;L;<square> 30D9 30FC 30BF;;;;N;SQUARED BEETA;;;; +333D;SQUARE POINTO;So;0;L;<square> 30DD 30A4 30F3 30C8;;;;N;SQUARED POINTO;;;; +333E;SQUARE BORUTO;So;0;L;<square> 30DC 30EB 30C8;;;;N;SQUARED BORUTO;;;; +333F;SQUARE HON;So;0;L;<square> 30DB 30F3;;;;N;SQUARED HON;;;; +3340;SQUARE PONDO;So;0;L;<square> 30DD 30F3 30C9;;;;N;SQUARED PONDO;;;; +3341;SQUARE HOORU;So;0;L;<square> 30DB 30FC 30EB;;;;N;SQUARED HOORU;;;; +3342;SQUARE HOON;So;0;L;<square> 30DB 30FC 30F3;;;;N;SQUARED HOON;;;; +3343;SQUARE MAIKURO;So;0;L;<square> 30DE 30A4 30AF 30ED;;;;N;SQUARED MAIKURO;;;; +3344;SQUARE MAIRU;So;0;L;<square> 30DE 30A4 30EB;;;;N;SQUARED MAIRU;;;; +3345;SQUARE MAHHA;So;0;L;<square> 30DE 30C3 30CF;;;;N;SQUARED MAHHA;;;; +3346;SQUARE MARUKU;So;0;L;<square> 30DE 30EB 30AF;;;;N;SQUARED MARUKU;;;; +3347;SQUARE MANSYON;So;0;L;<square> 30DE 30F3 30B7 30E7 30F3;;;;N;SQUARED MANSYON;;;; +3348;SQUARE MIKURON;So;0;L;<square> 30DF 30AF 30ED 30F3;;;;N;SQUARED MIKURON;;;; +3349;SQUARE MIRI;So;0;L;<square> 30DF 30EA;;;;N;SQUARED MIRI;;;; +334A;SQUARE MIRIBAARU;So;0;L;<square> 30DF 30EA 30D0 30FC 30EB;;;;N;SQUARED MIRIBAARU;;;; +334B;SQUARE MEGA;So;0;L;<square> 30E1 30AC;;;;N;SQUARED MEGA;;;; +334C;SQUARE MEGATON;So;0;L;<square> 30E1 30AC 30C8 30F3;;;;N;SQUARED MEGATON;;;; +334D;SQUARE MEETORU;So;0;L;<square> 30E1 30FC 30C8 30EB;;;;N;SQUARED MEETORU;;;; +334E;SQUARE YAADO;So;0;L;<square> 30E4 30FC 30C9;;;;N;SQUARED YAADO;;;; +334F;SQUARE YAARU;So;0;L;<square> 30E4 30FC 30EB;;;;N;SQUARED YAARU;;;; +3350;SQUARE YUAN;So;0;L;<square> 30E6 30A2 30F3;;;;N;SQUARED YUAN;;;; +3351;SQUARE RITTORU;So;0;L;<square> 30EA 30C3 30C8 30EB;;;;N;SQUARED RITTORU;;;; +3352;SQUARE RIRA;So;0;L;<square> 30EA 30E9;;;;N;SQUARED RIRA;;;; +3353;SQUARE RUPII;So;0;L;<square> 30EB 30D4 30FC;;;;N;SQUARED RUPII;;;; +3354;SQUARE RUUBURU;So;0;L;<square> 30EB 30FC 30D6 30EB;;;;N;SQUARED RUUBURU;;;; +3355;SQUARE REMU;So;0;L;<square> 30EC 30E0;;;;N;SQUARED REMU;;;; +3356;SQUARE RENTOGEN;So;0;L;<square> 30EC 30F3 30C8 30B2 30F3;;;;N;SQUARED RENTOGEN;;;; +3357;SQUARE WATTO;So;0;L;<square> 30EF 30C3 30C8;;;;N;SQUARED WATTO;;;; +3358;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ZERO;So;0;L;<compat> 0030 70B9;;;;N;;;;; +3359;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ONE;So;0;L;<compat> 0031 70B9;;;;N;;;;; +335A;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWO;So;0;L;<compat> 0032 70B9;;;;N;;;;; +335B;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR THREE;So;0;L;<compat> 0033 70B9;;;;N;;;;; +335C;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FOUR;So;0;L;<compat> 0034 70B9;;;;N;;;;; +335D;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FIVE;So;0;L;<compat> 0035 70B9;;;;N;;;;; +335E;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SIX;So;0;L;<compat> 0036 70B9;;;;N;;;;; +335F;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SEVEN;So;0;L;<compat> 0037 70B9;;;;N;;;;; +3360;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR EIGHT;So;0;L;<compat> 0038 70B9;;;;N;;;;; +3361;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR NINE;So;0;L;<compat> 0039 70B9;;;;N;;;;; +3362;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TEN;So;0;L;<compat> 0031 0030 70B9;;;;N;;;;; +3363;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ELEVEN;So;0;L;<compat> 0031 0031 70B9;;;;N;;;;; +3364;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWELVE;So;0;L;<compat> 0031 0032 70B9;;;;N;;;;; +3365;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR THIRTEEN;So;0;L;<compat> 0031 0033 70B9;;;;N;;;;; +3366;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FOURTEEN;So;0;L;<compat> 0031 0034 70B9;;;;N;;;;; +3367;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FIFTEEN;So;0;L;<compat> 0031 0035 70B9;;;;N;;;;; +3368;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SIXTEEN;So;0;L;<compat> 0031 0036 70B9;;;;N;;;;; +3369;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SEVENTEEN;So;0;L;<compat> 0031 0037 70B9;;;;N;;;;; +336A;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR EIGHTEEN;So;0;L;<compat> 0031 0038 70B9;;;;N;;;;; +336B;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR NINETEEN;So;0;L;<compat> 0031 0039 70B9;;;;N;;;;; +336C;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY;So;0;L;<compat> 0032 0030 70B9;;;;N;;;;; +336D;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-ONE;So;0;L;<compat> 0032 0031 70B9;;;;N;;;;; +336E;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-TWO;So;0;L;<compat> 0032 0032 70B9;;;;N;;;;; +336F;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-THREE;So;0;L;<compat> 0032 0033 70B9;;;;N;;;;; +3370;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-FOUR;So;0;L;<compat> 0032 0034 70B9;;;;N;;;;; +3371;SQUARE HPA;So;0;L;<square> 0068 0050 0061;;;;N;;;;; +3372;SQUARE DA;So;0;L;<square> 0064 0061;;;;N;;;;; +3373;SQUARE AU;So;0;L;<square> 0041 0055;;;;N;;;;; +3374;SQUARE BAR;So;0;L;<square> 0062 0061 0072;;;;N;;;;; +3375;SQUARE OV;So;0;L;<square> 006F 0056;;;;N;;;;; +3376;SQUARE PC;So;0;L;<square> 0070 0063;;;;N;;;;; +3377;SQUARE DM;So;0;ON;<square> 0064 006D;;;;N;;;;; +3378;SQUARE DM SQUARED;So;0;ON;<square> 0064 006D 00B2;;;;N;;;;; +3379;SQUARE DM CUBED;So;0;ON;<square> 0064 006D 00B3;;;;N;;;;; +337A;SQUARE IU;So;0;ON;<square> 0049 0055;;;;N;;;;; +337B;SQUARE ERA NAME HEISEI;So;0;L;<square> 5E73 6210;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME HEISEI;;;; +337C;SQUARE ERA NAME SYOUWA;So;0;L;<square> 662D 548C;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME SYOUWA;;;; +337D;SQUARE ERA NAME TAISYOU;So;0;L;<square> 5927 6B63;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME TAISYOU;;;; +337E;SQUARE ERA NAME MEIZI;So;0;L;<square> 660E 6CBB;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME MEIZI;;;; +337F;SQUARE CORPORATION;So;0;L;<square> 682A 5F0F 4F1A 793E;;;;N;SQUARED FOUR IDEOGRAPHS CORPORATION;;;; +3380;SQUARE PA AMPS;So;0;L;<square> 0070 0041;;;;N;SQUARED PA AMPS;;;; +3381;SQUARE NA;So;0;L;<square> 006E 0041;;;;N;SQUARED NA;;;; +3382;SQUARE MU A;So;0;L;<square> 03BC 0041;;;;N;SQUARED MU A;;;; +3383;SQUARE MA;So;0;L;<square> 006D 0041;;;;N;SQUARED MA;;;; +3384;SQUARE KA;So;0;L;<square> 006B 0041;;;;N;SQUARED KA;;;; +3385;SQUARE KB;So;0;L;<square> 004B 0042;;;;N;SQUARED KB;;;; +3386;SQUARE MB;So;0;L;<square> 004D 0042;;;;N;SQUARED MB;;;; +3387;SQUARE GB;So;0;L;<square> 0047 0042;;;;N;SQUARED GB;;;; +3388;SQUARE CAL;So;0;L;<square> 0063 0061 006C;;;;N;SQUARED CAL;;;; +3389;SQUARE KCAL;So;0;L;<square> 006B 0063 0061 006C;;;;N;SQUARED KCAL;;;; +338A;SQUARE PF;So;0;L;<square> 0070 0046;;;;N;SQUARED PF;;;; +338B;SQUARE NF;So;0;L;<square> 006E 0046;;;;N;SQUARED NF;;;; +338C;SQUARE MU F;So;0;L;<square> 03BC 0046;;;;N;SQUARED MU F;;;; +338D;SQUARE MU G;So;0;L;<square> 03BC 0067;;;;N;SQUARED MU G;;;; +338E;SQUARE MG;So;0;L;<square> 006D 0067;;;;N;SQUARED MG;;;; +338F;SQUARE KG;So;0;L;<square> 006B 0067;;;;N;SQUARED KG;;;; +3390;SQUARE HZ;So;0;L;<square> 0048 007A;;;;N;SQUARED HZ;;;; +3391;SQUARE KHZ;So;0;L;<square> 006B 0048 007A;;;;N;SQUARED KHZ;;;; +3392;SQUARE MHZ;So;0;L;<square> 004D 0048 007A;;;;N;SQUARED MHZ;;;; +3393;SQUARE GHZ;So;0;L;<square> 0047 0048 007A;;;;N;SQUARED GHZ;;;; +3394;SQUARE THZ;So;0;L;<square> 0054 0048 007A;;;;N;SQUARED THZ;;;; +3395;SQUARE MU L;So;0;L;<square> 03BC 2113;;;;N;SQUARED MU L;;;; +3396;SQUARE ML;So;0;L;<square> 006D 2113;;;;N;SQUARED ML;;;; +3397;SQUARE DL;So;0;L;<square> 0064 2113;;;;N;SQUARED DL;;;; +3398;SQUARE KL;So;0;L;<square> 006B 2113;;;;N;SQUARED KL;;;; +3399;SQUARE FM;So;0;L;<square> 0066 006D;;;;N;SQUARED FM;;;; +339A;SQUARE NM;So;0;L;<square> 006E 006D;;;;N;SQUARED NM;;;; +339B;SQUARE MU M;So;0;L;<square> 03BC 006D;;;;N;SQUARED MU M;;;; +339C;SQUARE MM;So;0;L;<square> 006D 006D;;;;N;SQUARED MM;;;; +339D;SQUARE CM;So;0;L;<square> 0063 006D;;;;N;SQUARED CM;;;; +339E;SQUARE KM;So;0;L;<square> 006B 006D;;;;N;SQUARED KM;;;; +339F;SQUARE MM SQUARED;So;0;L;<square> 006D 006D 00B2;;;;N;SQUARED MM SQUARED;;;; +33A0;SQUARE CM SQUARED;So;0;L;<square> 0063 006D 00B2;;;;N;SQUARED CM SQUARED;;;; +33A1;SQUARE M SQUARED;So;0;L;<square> 006D 00B2;;;;N;SQUARED M SQUARED;;;; +33A2;SQUARE KM SQUARED;So;0;L;<square> 006B 006D 00B2;;;;N;SQUARED KM SQUARED;;;; +33A3;SQUARE MM CUBED;So;0;L;<square> 006D 006D 00B3;;;;N;SQUARED MM CUBED;;;; +33A4;SQUARE CM CUBED;So;0;L;<square> 0063 006D 00B3;;;;N;SQUARED CM CUBED;;;; +33A5;SQUARE M CUBED;So;0;L;<square> 006D 00B3;;;;N;SQUARED M CUBED;;;; +33A6;SQUARE KM CUBED;So;0;L;<square> 006B 006D 00B3;;;;N;SQUARED KM CUBED;;;; +33A7;SQUARE M OVER S;So;0;L;<square> 006D 2215 0073;;;;N;SQUARED M OVER S;;;; +33A8;SQUARE M OVER S SQUARED;So;0;L;<square> 006D 2215 0073 00B2;;;;N;SQUARED M OVER S SQUARED;;;; +33A9;SQUARE PA;So;0;L;<square> 0050 0061;;;;N;SQUARED PA;;;; +33AA;SQUARE KPA;So;0;L;<square> 006B 0050 0061;;;;N;SQUARED KPA;;;; +33AB;SQUARE MPA;So;0;L;<square> 004D 0050 0061;;;;N;SQUARED MPA;;;; +33AC;SQUARE GPA;So;0;L;<square> 0047 0050 0061;;;;N;SQUARED GPA;;;; +33AD;SQUARE RAD;So;0;L;<square> 0072 0061 0064;;;;N;SQUARED RAD;;;; +33AE;SQUARE RAD OVER S;So;0;L;<square> 0072 0061 0064 2215 0073;;;;N;SQUARED RAD OVER S;;;; +33AF;SQUARE RAD OVER S SQUARED;So;0;L;<square> 0072 0061 0064 2215 0073 00B2;;;;N;SQUARED RAD OVER S SQUARED;;;; +33B0;SQUARE PS;So;0;L;<square> 0070 0073;;;;N;SQUARED PS;;;; +33B1;SQUARE NS;So;0;L;<square> 006E 0073;;;;N;SQUARED NS;;;; +33B2;SQUARE MU S;So;0;L;<square> 03BC 0073;;;;N;SQUARED MU S;;;; +33B3;SQUARE MS;So;0;L;<square> 006D 0073;;;;N;SQUARED MS;;;; +33B4;SQUARE PV;So;0;L;<square> 0070 0056;;;;N;SQUARED PV;;;; +33B5;SQUARE NV;So;0;L;<square> 006E 0056;;;;N;SQUARED NV;;;; +33B6;SQUARE MU V;So;0;L;<square> 03BC 0056;;;;N;SQUARED MU V;;;; +33B7;SQUARE MV;So;0;L;<square> 006D 0056;;;;N;SQUARED MV;;;; +33B8;SQUARE KV;So;0;L;<square> 006B 0056;;;;N;SQUARED KV;;;; +33B9;SQUARE MV MEGA;So;0;L;<square> 004D 0056;;;;N;SQUARED MV MEGA;;;; +33BA;SQUARE PW;So;0;L;<square> 0070 0057;;;;N;SQUARED PW;;;; +33BB;SQUARE NW;So;0;L;<square> 006E 0057;;;;N;SQUARED NW;;;; +33BC;SQUARE MU W;So;0;L;<square> 03BC 0057;;;;N;SQUARED MU W;;;; +33BD;SQUARE MW;So;0;L;<square> 006D 0057;;;;N;SQUARED MW;;;; +33BE;SQUARE KW;So;0;L;<square> 006B 0057;;;;N;SQUARED KW;;;; +33BF;SQUARE MW MEGA;So;0;L;<square> 004D 0057;;;;N;SQUARED MW MEGA;;;; +33C0;SQUARE K OHM;So;0;L;<square> 006B 03A9;;;;N;SQUARED K OHM;;;; +33C1;SQUARE M OHM;So;0;L;<square> 004D 03A9;;;;N;SQUARED M OHM;;;; +33C2;SQUARE AM;So;0;L;<square> 0061 002E 006D 002E;;;;N;SQUARED AM;;;; +33C3;SQUARE BQ;So;0;L;<square> 0042 0071;;;;N;SQUARED BQ;;;; +33C4;SQUARE CC;So;0;L;<square> 0063 0063;;;;N;SQUARED CC;;;; +33C5;SQUARE CD;So;0;L;<square> 0063 0064;;;;N;SQUARED CD;;;; +33C6;SQUARE C OVER KG;So;0;L;<square> 0043 2215 006B 0067;;;;N;SQUARED C OVER KG;;;; +33C7;SQUARE CO;So;0;L;<square> 0043 006F 002E;;;;N;SQUARED CO;;;; +33C8;SQUARE DB;So;0;L;<square> 0064 0042;;;;N;SQUARED DB;;;; +33C9;SQUARE GY;So;0;L;<square> 0047 0079;;;;N;SQUARED GY;;;; +33CA;SQUARE HA;So;0;L;<square> 0068 0061;;;;N;SQUARED HA;;;; +33CB;SQUARE HP;So;0;L;<square> 0048 0050;;;;N;SQUARED HP;;;; +33CC;SQUARE IN;So;0;L;<square> 0069 006E;;;;N;SQUARED IN;;;; +33CD;SQUARE KK;So;0;L;<square> 004B 004B;;;;N;SQUARED KK;;;; +33CE;SQUARE KM CAPITAL;So;0;L;<square> 004B 004D;;;;N;SQUARED KM CAPITAL;;;; +33CF;SQUARE KT;So;0;L;<square> 006B 0074;;;;N;SQUARED KT;;;; +33D0;SQUARE LM;So;0;L;<square> 006C 006D;;;;N;SQUARED LM;;;; +33D1;SQUARE LN;So;0;L;<square> 006C 006E;;;;N;SQUARED LN;;;; +33D2;SQUARE LOG;So;0;L;<square> 006C 006F 0067;;;;N;SQUARED LOG;;;; +33D3;SQUARE LX;So;0;L;<square> 006C 0078;;;;N;SQUARED LX;;;; +33D4;SQUARE MB SMALL;So;0;L;<square> 006D 0062;;;;N;SQUARED MB SMALL;;;; +33D5;SQUARE MIL;So;0;L;<square> 006D 0069 006C;;;;N;SQUARED MIL;;;; +33D6;SQUARE MOL;So;0;L;<square> 006D 006F 006C;;;;N;SQUARED MOL;;;; +33D7;SQUARE PH;So;0;L;<square> 0050 0048;;;;N;SQUARED PH;;;; +33D8;SQUARE PM;So;0;L;<square> 0070 002E 006D 002E;;;;N;SQUARED PM;;;; +33D9;SQUARE PPM;So;0;L;<square> 0050 0050 004D;;;;N;SQUARED PPM;;;; +33DA;SQUARE PR;So;0;L;<square> 0050 0052;;;;N;SQUARED PR;;;; +33DB;SQUARE SR;So;0;L;<square> 0073 0072;;;;N;SQUARED SR;;;; +33DC;SQUARE SV;So;0;L;<square> 0053 0076;;;;N;SQUARED SV;;;; +33DD;SQUARE WB;So;0;L;<square> 0057 0062;;;;N;SQUARED WB;;;; +33DE;SQUARE V OVER M;So;0;ON;<square> 0056 2215 006D;;;;N;;;;; +33DF;SQUARE A OVER M;So;0;ON;<square> 0041 2215 006D;;;;N;;;;; +33E0;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ONE;So;0;L;<compat> 0031 65E5;;;;N;;;;; +33E1;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWO;So;0;L;<compat> 0032 65E5;;;;N;;;;; +33E2;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THREE;So;0;L;<compat> 0033 65E5;;;;N;;;;; +33E3;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FOUR;So;0;L;<compat> 0034 65E5;;;;N;;;;; +33E4;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FIVE;So;0;L;<compat> 0035 65E5;;;;N;;;;; +33E5;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SIX;So;0;L;<compat> 0036 65E5;;;;N;;;;; +33E6;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SEVEN;So;0;L;<compat> 0037 65E5;;;;N;;;;; +33E7;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY EIGHT;So;0;L;<compat> 0038 65E5;;;;N;;;;; +33E8;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY NINE;So;0;L;<compat> 0039 65E5;;;;N;;;;; +33E9;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TEN;So;0;L;<compat> 0031 0030 65E5;;;;N;;;;; +33EA;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ELEVEN;So;0;L;<compat> 0031 0031 65E5;;;;N;;;;; +33EB;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWELVE;So;0;L;<compat> 0031 0032 65E5;;;;N;;;;; +33EC;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTEEN;So;0;L;<compat> 0031 0033 65E5;;;;N;;;;; +33ED;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FOURTEEN;So;0;L;<compat> 0031 0034 65E5;;;;N;;;;; +33EE;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FIFTEEN;So;0;L;<compat> 0031 0035 65E5;;;;N;;;;; +33EF;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SIXTEEN;So;0;L;<compat> 0031 0036 65E5;;;;N;;;;; +33F0;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SEVENTEEN;So;0;L;<compat> 0031 0037 65E5;;;;N;;;;; +33F1;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY EIGHTEEN;So;0;L;<compat> 0031 0038 65E5;;;;N;;;;; +33F2;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY NINETEEN;So;0;L;<compat> 0031 0039 65E5;;;;N;;;;; +33F3;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY;So;0;L;<compat> 0032 0030 65E5;;;;N;;;;; +33F4;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-ONE;So;0;L;<compat> 0032 0031 65E5;;;;N;;;;; +33F5;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-TWO;So;0;L;<compat> 0032 0032 65E5;;;;N;;;;; +33F6;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-THREE;So;0;L;<compat> 0032 0033 65E5;;;;N;;;;; +33F7;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-FOUR;So;0;L;<compat> 0032 0034 65E5;;;;N;;;;; +33F8;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-FIVE;So;0;L;<compat> 0032 0035 65E5;;;;N;;;;; +33F9;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-SIX;So;0;L;<compat> 0032 0036 65E5;;;;N;;;;; +33FA;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-SEVEN;So;0;L;<compat> 0032 0037 65E5;;;;N;;;;; +33FB;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-EIGHT;So;0;L;<compat> 0032 0038 65E5;;;;N;;;;; +33FC;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-NINE;So;0;L;<compat> 0032 0039 65E5;;;;N;;;;; +33FD;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY;So;0;L;<compat> 0033 0030 65E5;;;;N;;;;; +33FE;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY-ONE;So;0;L;<compat> 0033 0031 65E5;;;;N;;;;; +33FF;SQUARE GAL;So;0;ON;<square> 0067 0061 006C;;;;N;;;;; +3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;; +4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;; +4DC0;HEXAGRAM FOR THE CREATIVE HEAVEN;So;0;ON;;;;;N;;;;; +4DC1;HEXAGRAM FOR THE RECEPTIVE EARTH;So;0;ON;;;;;N;;;;; +4DC2;HEXAGRAM FOR DIFFICULTY AT THE BEGINNING;So;0;ON;;;;;N;;;;; +4DC3;HEXAGRAM FOR YOUTHFUL FOLLY;So;0;ON;;;;;N;;;;; +4DC4;HEXAGRAM FOR WAITING;So;0;ON;;;;;N;;;;; +4DC5;HEXAGRAM FOR CONFLICT;So;0;ON;;;;;N;;;;; +4DC6;HEXAGRAM FOR THE ARMY;So;0;ON;;;;;N;;;;; +4DC7;HEXAGRAM FOR HOLDING TOGETHER;So;0;ON;;;;;N;;;;; +4DC8;HEXAGRAM FOR SMALL TAMING;So;0;ON;;;;;N;;;;; +4DC9;HEXAGRAM FOR TREADING;So;0;ON;;;;;N;;;;; +4DCA;HEXAGRAM FOR PEACE;So;0;ON;;;;;N;;;;; +4DCB;HEXAGRAM FOR STANDSTILL;So;0;ON;;;;;N;;;;; +4DCC;HEXAGRAM FOR FELLOWSHIP;So;0;ON;;;;;N;;;;; +4DCD;HEXAGRAM FOR GREAT POSSESSION;So;0;ON;;;;;N;;;;; +4DCE;HEXAGRAM FOR MODESTY;So;0;ON;;;;;N;;;;; +4DCF;HEXAGRAM FOR ENTHUSIASM;So;0;ON;;;;;N;;;;; +4DD0;HEXAGRAM FOR FOLLOWING;So;0;ON;;;;;N;;;;; +4DD1;HEXAGRAM FOR WORK ON THE DECAYED;So;0;ON;;;;;N;;;;; +4DD2;HEXAGRAM FOR APPROACH;So;0;ON;;;;;N;;;;; +4DD3;HEXAGRAM FOR CONTEMPLATION;So;0;ON;;;;;N;;;;; +4DD4;HEXAGRAM FOR BITING THROUGH;So;0;ON;;;;;N;;;;; +4DD5;HEXAGRAM FOR GRACE;So;0;ON;;;;;N;;;;; +4DD6;HEXAGRAM FOR SPLITTING APART;So;0;ON;;;;;N;;;;; +4DD7;HEXAGRAM FOR RETURN;So;0;ON;;;;;N;;;;; +4DD8;HEXAGRAM FOR INNOCENCE;So;0;ON;;;;;N;;;;; +4DD9;HEXAGRAM FOR GREAT TAMING;So;0;ON;;;;;N;;;;; +4DDA;HEXAGRAM FOR MOUTH CORNERS;So;0;ON;;;;;N;;;;; +4DDB;HEXAGRAM FOR GREAT PREPONDERANCE;So;0;ON;;;;;N;;;;; +4DDC;HEXAGRAM FOR THE ABYSMAL WATER;So;0;ON;;;;;N;;;;; +4DDD;HEXAGRAM FOR THE CLINGING FIRE;So;0;ON;;;;;N;;;;; +4DDE;HEXAGRAM FOR INFLUENCE;So;0;ON;;;;;N;;;;; +4DDF;HEXAGRAM FOR DURATION;So;0;ON;;;;;N;;;;; +4DE0;HEXAGRAM FOR RETREAT;So;0;ON;;;;;N;;;;; +4DE1;HEXAGRAM FOR GREAT POWER;So;0;ON;;;;;N;;;;; +4DE2;HEXAGRAM FOR PROGRESS;So;0;ON;;;;;N;;;;; +4DE3;HEXAGRAM FOR DARKENING OF THE LIGHT;So;0;ON;;;;;N;;;;; +4DE4;HEXAGRAM FOR THE FAMILY;So;0;ON;;;;;N;;;;; +4DE5;HEXAGRAM FOR OPPOSITION;So;0;ON;;;;;N;;;;; +4DE6;HEXAGRAM FOR OBSTRUCTION;So;0;ON;;;;;N;;;;; +4DE7;HEXAGRAM FOR DELIVERANCE;So;0;ON;;;;;N;;;;; +4DE8;HEXAGRAM FOR DECREASE;So;0;ON;;;;;N;;;;; +4DE9;HEXAGRAM FOR INCREASE;So;0;ON;;;;;N;;;;; +4DEA;HEXAGRAM FOR BREAKTHROUGH;So;0;ON;;;;;N;;;;; +4DEB;HEXAGRAM FOR COMING TO MEET;So;0;ON;;;;;N;;;;; +4DEC;HEXAGRAM FOR GATHERING TOGETHER;So;0;ON;;;;;N;;;;; +4DED;HEXAGRAM FOR PUSHING UPWARD;So;0;ON;;;;;N;;;;; +4DEE;HEXAGRAM FOR OPPRESSION;So;0;ON;;;;;N;;;;; +4DEF;HEXAGRAM FOR THE WELL;So;0;ON;;;;;N;;;;; +4DF0;HEXAGRAM FOR REVOLUTION;So;0;ON;;;;;N;;;;; +4DF1;HEXAGRAM FOR THE CAULDRON;So;0;ON;;;;;N;;;;; +4DF2;HEXAGRAM FOR THE AROUSING THUNDER;So;0;ON;;;;;N;;;;; +4DF3;HEXAGRAM FOR THE KEEPING STILL MOUNTAIN;So;0;ON;;;;;N;;;;; +4DF4;HEXAGRAM FOR DEVELOPMENT;So;0;ON;;;;;N;;;;; +4DF5;HEXAGRAM FOR THE MARRYING MAIDEN;So;0;ON;;;;;N;;;;; +4DF6;HEXAGRAM FOR ABUNDANCE;So;0;ON;;;;;N;;;;; +4DF7;HEXAGRAM FOR THE WANDERER;So;0;ON;;;;;N;;;;; +4DF8;HEXAGRAM FOR THE GENTLE WIND;So;0;ON;;;;;N;;;;; +4DF9;HEXAGRAM FOR THE JOYOUS LAKE;So;0;ON;;;;;N;;;;; +4DFA;HEXAGRAM FOR DISPERSION;So;0;ON;;;;;N;;;;; +4DFB;HEXAGRAM FOR LIMITATION;So;0;ON;;;;;N;;;;; +4DFC;HEXAGRAM FOR INNER TRUTH;So;0;ON;;;;;N;;;;; +4DFD;HEXAGRAM FOR SMALL PREPONDERANCE;So;0;ON;;;;;N;;;;; +4DFE;HEXAGRAM FOR AFTER COMPLETION;So;0;ON;;;;;N;;;;; +4DFF;HEXAGRAM FOR BEFORE COMPLETION;So;0;ON;;;;;N;;;;; +4E00;<CJK Ideograph, First>;Lo;0;L;;;;;N;;;;; +9FEA;<CJK Ideograph, Last>;Lo;0;L;;;;;N;;;;; +A000;YI SYLLABLE IT;Lo;0;L;;;;;N;;;;; +A001;YI SYLLABLE IX;Lo;0;L;;;;;N;;;;; +A002;YI SYLLABLE I;Lo;0;L;;;;;N;;;;; +A003;YI SYLLABLE IP;Lo;0;L;;;;;N;;;;; +A004;YI SYLLABLE IET;Lo;0;L;;;;;N;;;;; +A005;YI SYLLABLE IEX;Lo;0;L;;;;;N;;;;; +A006;YI SYLLABLE IE;Lo;0;L;;;;;N;;;;; +A007;YI SYLLABLE IEP;Lo;0;L;;;;;N;;;;; +A008;YI SYLLABLE AT;Lo;0;L;;;;;N;;;;; +A009;YI SYLLABLE AX;Lo;0;L;;;;;N;;;;; +A00A;YI SYLLABLE A;Lo;0;L;;;;;N;;;;; +A00B;YI SYLLABLE AP;Lo;0;L;;;;;N;;;;; +A00C;YI SYLLABLE UOX;Lo;0;L;;;;;N;;;;; +A00D;YI SYLLABLE UO;Lo;0;L;;;;;N;;;;; +A00E;YI SYLLABLE UOP;Lo;0;L;;;;;N;;;;; +A00F;YI SYLLABLE OT;Lo;0;L;;;;;N;;;;; +A010;YI SYLLABLE OX;Lo;0;L;;;;;N;;;;; +A011;YI SYLLABLE O;Lo;0;L;;;;;N;;;;; +A012;YI SYLLABLE OP;Lo;0;L;;;;;N;;;;; +A013;YI SYLLABLE EX;Lo;0;L;;;;;N;;;;; +A014;YI SYLLABLE E;Lo;0;L;;;;;N;;;;; +A015;YI SYLLABLE WU;Lm;0;L;;;;;N;;;;; +A016;YI SYLLABLE BIT;Lo;0;L;;;;;N;;;;; +A017;YI SYLLABLE BIX;Lo;0;L;;;;;N;;;;; +A018;YI SYLLABLE BI;Lo;0;L;;;;;N;;;;; +A019;YI SYLLABLE BIP;Lo;0;L;;;;;N;;;;; +A01A;YI SYLLABLE BIET;Lo;0;L;;;;;N;;;;; +A01B;YI SYLLABLE BIEX;Lo;0;L;;;;;N;;;;; +A01C;YI SYLLABLE BIE;Lo;0;L;;;;;N;;;;; +A01D;YI SYLLABLE BIEP;Lo;0;L;;;;;N;;;;; +A01E;YI SYLLABLE BAT;Lo;0;L;;;;;N;;;;; +A01F;YI SYLLABLE BAX;Lo;0;L;;;;;N;;;;; +A020;YI SYLLABLE BA;Lo;0;L;;;;;N;;;;; +A021;YI SYLLABLE BAP;Lo;0;L;;;;;N;;;;; +A022;YI SYLLABLE BUOX;Lo;0;L;;;;;N;;;;; +A023;YI SYLLABLE BUO;Lo;0;L;;;;;N;;;;; +A024;YI SYLLABLE BUOP;Lo;0;L;;;;;N;;;;; +A025;YI SYLLABLE BOT;Lo;0;L;;;;;N;;;;; +A026;YI SYLLABLE BOX;Lo;0;L;;;;;N;;;;; +A027;YI SYLLABLE BO;Lo;0;L;;;;;N;;;;; +A028;YI SYLLABLE BOP;Lo;0;L;;;;;N;;;;; +A029;YI SYLLABLE BEX;Lo;0;L;;;;;N;;;;; +A02A;YI SYLLABLE BE;Lo;0;L;;;;;N;;;;; +A02B;YI SYLLABLE BEP;Lo;0;L;;;;;N;;;;; +A02C;YI SYLLABLE BUT;Lo;0;L;;;;;N;;;;; +A02D;YI SYLLABLE BUX;Lo;0;L;;;;;N;;;;; +A02E;YI SYLLABLE BU;Lo;0;L;;;;;N;;;;; +A02F;YI SYLLABLE BUP;Lo;0;L;;;;;N;;;;; +A030;YI SYLLABLE BURX;Lo;0;L;;;;;N;;;;; +A031;YI SYLLABLE BUR;Lo;0;L;;;;;N;;;;; +A032;YI SYLLABLE BYT;Lo;0;L;;;;;N;;;;; +A033;YI SYLLABLE BYX;Lo;0;L;;;;;N;;;;; +A034;YI SYLLABLE BY;Lo;0;L;;;;;N;;;;; +A035;YI SYLLABLE BYP;Lo;0;L;;;;;N;;;;; +A036;YI SYLLABLE BYRX;Lo;0;L;;;;;N;;;;; +A037;YI SYLLABLE BYR;Lo;0;L;;;;;N;;;;; +A038;YI SYLLABLE PIT;Lo;0;L;;;;;N;;;;; +A039;YI SYLLABLE PIX;Lo;0;L;;;;;N;;;;; +A03A;YI SYLLABLE PI;Lo;0;L;;;;;N;;;;; +A03B;YI SYLLABLE PIP;Lo;0;L;;;;;N;;;;; +A03C;YI SYLLABLE PIEX;Lo;0;L;;;;;N;;;;; +A03D;YI SYLLABLE PIE;Lo;0;L;;;;;N;;;;; +A03E;YI SYLLABLE PIEP;Lo;0;L;;;;;N;;;;; +A03F;YI SYLLABLE PAT;Lo;0;L;;;;;N;;;;; +A040;YI SYLLABLE PAX;Lo;0;L;;;;;N;;;;; +A041;YI SYLLABLE PA;Lo;0;L;;;;;N;;;;; +A042;YI SYLLABLE PAP;Lo;0;L;;;;;N;;;;; +A043;YI SYLLABLE PUOX;Lo;0;L;;;;;N;;;;; +A044;YI SYLLABLE PUO;Lo;0;L;;;;;N;;;;; +A045;YI SYLLABLE PUOP;Lo;0;L;;;;;N;;;;; +A046;YI SYLLABLE POT;Lo;0;L;;;;;N;;;;; +A047;YI SYLLABLE POX;Lo;0;L;;;;;N;;;;; +A048;YI SYLLABLE PO;Lo;0;L;;;;;N;;;;; +A049;YI SYLLABLE POP;Lo;0;L;;;;;N;;;;; +A04A;YI SYLLABLE PUT;Lo;0;L;;;;;N;;;;; +A04B;YI SYLLABLE PUX;Lo;0;L;;;;;N;;;;; +A04C;YI SYLLABLE PU;Lo;0;L;;;;;N;;;;; +A04D;YI SYLLABLE PUP;Lo;0;L;;;;;N;;;;; +A04E;YI SYLLABLE PURX;Lo;0;L;;;;;N;;;;; +A04F;YI SYLLABLE PUR;Lo;0;L;;;;;N;;;;; +A050;YI SYLLABLE PYT;Lo;0;L;;;;;N;;;;; +A051;YI SYLLABLE PYX;Lo;0;L;;;;;N;;;;; +A052;YI SYLLABLE PY;Lo;0;L;;;;;N;;;;; +A053;YI SYLLABLE PYP;Lo;0;L;;;;;N;;;;; +A054;YI SYLLABLE PYRX;Lo;0;L;;;;;N;;;;; +A055;YI SYLLABLE PYR;Lo;0;L;;;;;N;;;;; +A056;YI SYLLABLE BBIT;Lo;0;L;;;;;N;;;;; +A057;YI SYLLABLE BBIX;Lo;0;L;;;;;N;;;;; +A058;YI SYLLABLE BBI;Lo;0;L;;;;;N;;;;; +A059;YI SYLLABLE BBIP;Lo;0;L;;;;;N;;;;; +A05A;YI SYLLABLE BBIET;Lo;0;L;;;;;N;;;;; +A05B;YI SYLLABLE BBIEX;Lo;0;L;;;;;N;;;;; +A05C;YI SYLLABLE BBIE;Lo;0;L;;;;;N;;;;; +A05D;YI SYLLABLE BBIEP;Lo;0;L;;;;;N;;;;; +A05E;YI SYLLABLE BBAT;Lo;0;L;;;;;N;;;;; +A05F;YI SYLLABLE BBAX;Lo;0;L;;;;;N;;;;; +A060;YI SYLLABLE BBA;Lo;0;L;;;;;N;;;;; +A061;YI SYLLABLE BBAP;Lo;0;L;;;;;N;;;;; +A062;YI SYLLABLE BBUOX;Lo;0;L;;;;;N;;;;; +A063;YI SYLLABLE BBUO;Lo;0;L;;;;;N;;;;; +A064;YI SYLLABLE BBUOP;Lo;0;L;;;;;N;;;;; +A065;YI SYLLABLE BBOT;Lo;0;L;;;;;N;;;;; +A066;YI SYLLABLE BBOX;Lo;0;L;;;;;N;;;;; +A067;YI SYLLABLE BBO;Lo;0;L;;;;;N;;;;; +A068;YI SYLLABLE BBOP;Lo;0;L;;;;;N;;;;; +A069;YI SYLLABLE BBEX;Lo;0;L;;;;;N;;;;; +A06A;YI SYLLABLE BBE;Lo;0;L;;;;;N;;;;; +A06B;YI SYLLABLE BBEP;Lo;0;L;;;;;N;;;;; +A06C;YI SYLLABLE BBUT;Lo;0;L;;;;;N;;;;; +A06D;YI SYLLABLE BBUX;Lo;0;L;;;;;N;;;;; +A06E;YI SYLLABLE BBU;Lo;0;L;;;;;N;;;;; +A06F;YI SYLLABLE BBUP;Lo;0;L;;;;;N;;;;; +A070;YI SYLLABLE BBURX;Lo;0;L;;;;;N;;;;; +A071;YI SYLLABLE BBUR;Lo;0;L;;;;;N;;;;; +A072;YI SYLLABLE BBYT;Lo;0;L;;;;;N;;;;; +A073;YI SYLLABLE BBYX;Lo;0;L;;;;;N;;;;; +A074;YI SYLLABLE BBY;Lo;0;L;;;;;N;;;;; +A075;YI SYLLABLE BBYP;Lo;0;L;;;;;N;;;;; +A076;YI SYLLABLE NBIT;Lo;0;L;;;;;N;;;;; +A077;YI SYLLABLE NBIX;Lo;0;L;;;;;N;;;;; +A078;YI SYLLABLE NBI;Lo;0;L;;;;;N;;;;; +A079;YI SYLLABLE NBIP;Lo;0;L;;;;;N;;;;; +A07A;YI SYLLABLE NBIEX;Lo;0;L;;;;;N;;;;; +A07B;YI SYLLABLE NBIE;Lo;0;L;;;;;N;;;;; +A07C;YI SYLLABLE NBIEP;Lo;0;L;;;;;N;;;;; +A07D;YI SYLLABLE NBAT;Lo;0;L;;;;;N;;;;; +A07E;YI SYLLABLE NBAX;Lo;0;L;;;;;N;;;;; +A07F;YI SYLLABLE NBA;Lo;0;L;;;;;N;;;;; +A080;YI SYLLABLE NBAP;Lo;0;L;;;;;N;;;;; +A081;YI SYLLABLE NBOT;Lo;0;L;;;;;N;;;;; +A082;YI SYLLABLE NBOX;Lo;0;L;;;;;N;;;;; +A083;YI SYLLABLE NBO;Lo;0;L;;;;;N;;;;; +A084;YI SYLLABLE NBOP;Lo;0;L;;;;;N;;;;; +A085;YI SYLLABLE NBUT;Lo;0;L;;;;;N;;;;; +A086;YI SYLLABLE NBUX;Lo;0;L;;;;;N;;;;; +A087;YI SYLLABLE NBU;Lo;0;L;;;;;N;;;;; +A088;YI SYLLABLE NBUP;Lo;0;L;;;;;N;;;;; +A089;YI SYLLABLE NBURX;Lo;0;L;;;;;N;;;;; +A08A;YI SYLLABLE NBUR;Lo;0;L;;;;;N;;;;; +A08B;YI SYLLABLE NBYT;Lo;0;L;;;;;N;;;;; +A08C;YI SYLLABLE NBYX;Lo;0;L;;;;;N;;;;; +A08D;YI SYLLABLE NBY;Lo;0;L;;;;;N;;;;; +A08E;YI SYLLABLE NBYP;Lo;0;L;;;;;N;;;;; +A08F;YI SYLLABLE NBYRX;Lo;0;L;;;;;N;;;;; +A090;YI SYLLABLE NBYR;Lo;0;L;;;;;N;;;;; +A091;YI SYLLABLE HMIT;Lo;0;L;;;;;N;;;;; +A092;YI SYLLABLE HMIX;Lo;0;L;;;;;N;;;;; +A093;YI SYLLABLE HMI;Lo;0;L;;;;;N;;;;; +A094;YI SYLLABLE HMIP;Lo;0;L;;;;;N;;;;; +A095;YI SYLLABLE HMIEX;Lo;0;L;;;;;N;;;;; +A096;YI SYLLABLE HMIE;Lo;0;L;;;;;N;;;;; +A097;YI SYLLABLE HMIEP;Lo;0;L;;;;;N;;;;; +A098;YI SYLLABLE HMAT;Lo;0;L;;;;;N;;;;; +A099;YI SYLLABLE HMAX;Lo;0;L;;;;;N;;;;; +A09A;YI SYLLABLE HMA;Lo;0;L;;;;;N;;;;; +A09B;YI SYLLABLE HMAP;Lo;0;L;;;;;N;;;;; +A09C;YI SYLLABLE HMUOX;Lo;0;L;;;;;N;;;;; +A09D;YI SYLLABLE HMUO;Lo;0;L;;;;;N;;;;; +A09E;YI SYLLABLE HMUOP;Lo;0;L;;;;;N;;;;; +A09F;YI SYLLABLE HMOT;Lo;0;L;;;;;N;;;;; +A0A0;YI SYLLABLE HMOX;Lo;0;L;;;;;N;;;;; +A0A1;YI SYLLABLE HMO;Lo;0;L;;;;;N;;;;; +A0A2;YI SYLLABLE HMOP;Lo;0;L;;;;;N;;;;; +A0A3;YI SYLLABLE HMUT;Lo;0;L;;;;;N;;;;; +A0A4;YI SYLLABLE HMUX;Lo;0;L;;;;;N;;;;; +A0A5;YI SYLLABLE HMU;Lo;0;L;;;;;N;;;;; +A0A6;YI SYLLABLE HMUP;Lo;0;L;;;;;N;;;;; +A0A7;YI SYLLABLE HMURX;Lo;0;L;;;;;N;;;;; +A0A8;YI SYLLABLE HMUR;Lo;0;L;;;;;N;;;;; +A0A9;YI SYLLABLE HMYX;Lo;0;L;;;;;N;;;;; +A0AA;YI SYLLABLE HMY;Lo;0;L;;;;;N;;;;; +A0AB;YI SYLLABLE HMYP;Lo;0;L;;;;;N;;;;; +A0AC;YI SYLLABLE HMYRX;Lo;0;L;;;;;N;;;;; +A0AD;YI SYLLABLE HMYR;Lo;0;L;;;;;N;;;;; +A0AE;YI SYLLABLE MIT;Lo;0;L;;;;;N;;;;; +A0AF;YI SYLLABLE MIX;Lo;0;L;;;;;N;;;;; +A0B0;YI SYLLABLE MI;Lo;0;L;;;;;N;;;;; +A0B1;YI SYLLABLE MIP;Lo;0;L;;;;;N;;;;; +A0B2;YI SYLLABLE MIEX;Lo;0;L;;;;;N;;;;; +A0B3;YI SYLLABLE MIE;Lo;0;L;;;;;N;;;;; +A0B4;YI SYLLABLE MIEP;Lo;0;L;;;;;N;;;;; +A0B5;YI SYLLABLE MAT;Lo;0;L;;;;;N;;;;; +A0B6;YI SYLLABLE MAX;Lo;0;L;;;;;N;;;;; +A0B7;YI SYLLABLE MA;Lo;0;L;;;;;N;;;;; +A0B8;YI SYLLABLE MAP;Lo;0;L;;;;;N;;;;; +A0B9;YI SYLLABLE MUOT;Lo;0;L;;;;;N;;;;; +A0BA;YI SYLLABLE MUOX;Lo;0;L;;;;;N;;;;; +A0BB;YI SYLLABLE MUO;Lo;0;L;;;;;N;;;;; +A0BC;YI SYLLABLE MUOP;Lo;0;L;;;;;N;;;;; +A0BD;YI SYLLABLE MOT;Lo;0;L;;;;;N;;;;; +A0BE;YI SYLLABLE MOX;Lo;0;L;;;;;N;;;;; +A0BF;YI SYLLABLE MO;Lo;0;L;;;;;N;;;;; +A0C0;YI SYLLABLE MOP;Lo;0;L;;;;;N;;;;; +A0C1;YI SYLLABLE MEX;Lo;0;L;;;;;N;;;;; +A0C2;YI SYLLABLE ME;Lo;0;L;;;;;N;;;;; +A0C3;YI SYLLABLE MUT;Lo;0;L;;;;;N;;;;; +A0C4;YI SYLLABLE MUX;Lo;0;L;;;;;N;;;;; +A0C5;YI SYLLABLE MU;Lo;0;L;;;;;N;;;;; +A0C6;YI SYLLABLE MUP;Lo;0;L;;;;;N;;;;; +A0C7;YI SYLLABLE MURX;Lo;0;L;;;;;N;;;;; +A0C8;YI SYLLABLE MUR;Lo;0;L;;;;;N;;;;; +A0C9;YI SYLLABLE MYT;Lo;0;L;;;;;N;;;;; +A0CA;YI SYLLABLE MYX;Lo;0;L;;;;;N;;;;; +A0CB;YI SYLLABLE MY;Lo;0;L;;;;;N;;;;; +A0CC;YI SYLLABLE MYP;Lo;0;L;;;;;N;;;;; +A0CD;YI SYLLABLE FIT;Lo;0;L;;;;;N;;;;; +A0CE;YI SYLLABLE FIX;Lo;0;L;;;;;N;;;;; +A0CF;YI SYLLABLE FI;Lo;0;L;;;;;N;;;;; +A0D0;YI SYLLABLE FIP;Lo;0;L;;;;;N;;;;; +A0D1;YI SYLLABLE FAT;Lo;0;L;;;;;N;;;;; +A0D2;YI SYLLABLE FAX;Lo;0;L;;;;;N;;;;; +A0D3;YI SYLLABLE FA;Lo;0;L;;;;;N;;;;; +A0D4;YI SYLLABLE FAP;Lo;0;L;;;;;N;;;;; +A0D5;YI SYLLABLE FOX;Lo;0;L;;;;;N;;;;; +A0D6;YI SYLLABLE FO;Lo;0;L;;;;;N;;;;; +A0D7;YI SYLLABLE FOP;Lo;0;L;;;;;N;;;;; +A0D8;YI SYLLABLE FUT;Lo;0;L;;;;;N;;;;; +A0D9;YI SYLLABLE FUX;Lo;0;L;;;;;N;;;;; +A0DA;YI SYLLABLE FU;Lo;0;L;;;;;N;;;;; +A0DB;YI SYLLABLE FUP;Lo;0;L;;;;;N;;;;; +A0DC;YI SYLLABLE FURX;Lo;0;L;;;;;N;;;;; +A0DD;YI SYLLABLE FUR;Lo;0;L;;;;;N;;;;; +A0DE;YI SYLLABLE FYT;Lo;0;L;;;;;N;;;;; +A0DF;YI SYLLABLE FYX;Lo;0;L;;;;;N;;;;; +A0E0;YI SYLLABLE FY;Lo;0;L;;;;;N;;;;; +A0E1;YI SYLLABLE FYP;Lo;0;L;;;;;N;;;;; +A0E2;YI SYLLABLE VIT;Lo;0;L;;;;;N;;;;; +A0E3;YI SYLLABLE VIX;Lo;0;L;;;;;N;;;;; +A0E4;YI SYLLABLE VI;Lo;0;L;;;;;N;;;;; +A0E5;YI SYLLABLE VIP;Lo;0;L;;;;;N;;;;; +A0E6;YI SYLLABLE VIET;Lo;0;L;;;;;N;;;;; +A0E7;YI SYLLABLE VIEX;Lo;0;L;;;;;N;;;;; +A0E8;YI SYLLABLE VIE;Lo;0;L;;;;;N;;;;; +A0E9;YI SYLLABLE VIEP;Lo;0;L;;;;;N;;;;; +A0EA;YI SYLLABLE VAT;Lo;0;L;;;;;N;;;;; +A0EB;YI SYLLABLE VAX;Lo;0;L;;;;;N;;;;; +A0EC;YI SYLLABLE VA;Lo;0;L;;;;;N;;;;; +A0ED;YI SYLLABLE VAP;Lo;0;L;;;;;N;;;;; +A0EE;YI SYLLABLE VOT;Lo;0;L;;;;;N;;;;; +A0EF;YI SYLLABLE VOX;Lo;0;L;;;;;N;;;;; +A0F0;YI SYLLABLE VO;Lo;0;L;;;;;N;;;;; +A0F1;YI SYLLABLE VOP;Lo;0;L;;;;;N;;;;; +A0F2;YI SYLLABLE VEX;Lo;0;L;;;;;N;;;;; +A0F3;YI SYLLABLE VEP;Lo;0;L;;;;;N;;;;; +A0F4;YI SYLLABLE VUT;Lo;0;L;;;;;N;;;;; +A0F5;YI SYLLABLE VUX;Lo;0;L;;;;;N;;;;; +A0F6;YI SYLLABLE VU;Lo;0;L;;;;;N;;;;; +A0F7;YI SYLLABLE VUP;Lo;0;L;;;;;N;;;;; +A0F8;YI SYLLABLE VURX;Lo;0;L;;;;;N;;;;; +A0F9;YI SYLLABLE VUR;Lo;0;L;;;;;N;;;;; +A0FA;YI SYLLABLE VYT;Lo;0;L;;;;;N;;;;; +A0FB;YI SYLLABLE VYX;Lo;0;L;;;;;N;;;;; +A0FC;YI SYLLABLE VY;Lo;0;L;;;;;N;;;;; +A0FD;YI SYLLABLE VYP;Lo;0;L;;;;;N;;;;; +A0FE;YI SYLLABLE VYRX;Lo;0;L;;;;;N;;;;; +A0FF;YI SYLLABLE VYR;Lo;0;L;;;;;N;;;;; +A100;YI SYLLABLE DIT;Lo;0;L;;;;;N;;;;; +A101;YI SYLLABLE DIX;Lo;0;L;;;;;N;;;;; +A102;YI SYLLABLE DI;Lo;0;L;;;;;N;;;;; +A103;YI SYLLABLE DIP;Lo;0;L;;;;;N;;;;; +A104;YI SYLLABLE DIEX;Lo;0;L;;;;;N;;;;; +A105;YI SYLLABLE DIE;Lo;0;L;;;;;N;;;;; +A106;YI SYLLABLE DIEP;Lo;0;L;;;;;N;;;;; +A107;YI SYLLABLE DAT;Lo;0;L;;;;;N;;;;; +A108;YI SYLLABLE DAX;Lo;0;L;;;;;N;;;;; +A109;YI SYLLABLE DA;Lo;0;L;;;;;N;;;;; +A10A;YI SYLLABLE DAP;Lo;0;L;;;;;N;;;;; +A10B;YI SYLLABLE DUOX;Lo;0;L;;;;;N;;;;; +A10C;YI SYLLABLE DUO;Lo;0;L;;;;;N;;;;; +A10D;YI SYLLABLE DOT;Lo;0;L;;;;;N;;;;; +A10E;YI SYLLABLE DOX;Lo;0;L;;;;;N;;;;; +A10F;YI SYLLABLE DO;Lo;0;L;;;;;N;;;;; +A110;YI SYLLABLE DOP;Lo;0;L;;;;;N;;;;; +A111;YI SYLLABLE DEX;Lo;0;L;;;;;N;;;;; +A112;YI SYLLABLE DE;Lo;0;L;;;;;N;;;;; +A113;YI SYLLABLE DEP;Lo;0;L;;;;;N;;;;; +A114;YI SYLLABLE DUT;Lo;0;L;;;;;N;;;;; +A115;YI SYLLABLE DUX;Lo;0;L;;;;;N;;;;; +A116;YI SYLLABLE DU;Lo;0;L;;;;;N;;;;; +A117;YI SYLLABLE DUP;Lo;0;L;;;;;N;;;;; +A118;YI SYLLABLE DURX;Lo;0;L;;;;;N;;;;; +A119;YI SYLLABLE DUR;Lo;0;L;;;;;N;;;;; +A11A;YI SYLLABLE TIT;Lo;0;L;;;;;N;;;;; +A11B;YI SYLLABLE TIX;Lo;0;L;;;;;N;;;;; +A11C;YI SYLLABLE TI;Lo;0;L;;;;;N;;;;; +A11D;YI SYLLABLE TIP;Lo;0;L;;;;;N;;;;; +A11E;YI SYLLABLE TIEX;Lo;0;L;;;;;N;;;;; +A11F;YI SYLLABLE TIE;Lo;0;L;;;;;N;;;;; +A120;YI SYLLABLE TIEP;Lo;0;L;;;;;N;;;;; +A121;YI SYLLABLE TAT;Lo;0;L;;;;;N;;;;; +A122;YI SYLLABLE TAX;Lo;0;L;;;;;N;;;;; +A123;YI SYLLABLE TA;Lo;0;L;;;;;N;;;;; +A124;YI SYLLABLE TAP;Lo;0;L;;;;;N;;;;; +A125;YI SYLLABLE TUOT;Lo;0;L;;;;;N;;;;; +A126;YI SYLLABLE TUOX;Lo;0;L;;;;;N;;;;; +A127;YI SYLLABLE TUO;Lo;0;L;;;;;N;;;;; +A128;YI SYLLABLE TUOP;Lo;0;L;;;;;N;;;;; +A129;YI SYLLABLE TOT;Lo;0;L;;;;;N;;;;; +A12A;YI SYLLABLE TOX;Lo;0;L;;;;;N;;;;; +A12B;YI SYLLABLE TO;Lo;0;L;;;;;N;;;;; +A12C;YI SYLLABLE TOP;Lo;0;L;;;;;N;;;;; +A12D;YI SYLLABLE TEX;Lo;0;L;;;;;N;;;;; +A12E;YI SYLLABLE TE;Lo;0;L;;;;;N;;;;; +A12F;YI SYLLABLE TEP;Lo;0;L;;;;;N;;;;; +A130;YI SYLLABLE TUT;Lo;0;L;;;;;N;;;;; +A131;YI SYLLABLE TUX;Lo;0;L;;;;;N;;;;; +A132;YI SYLLABLE TU;Lo;0;L;;;;;N;;;;; +A133;YI SYLLABLE TUP;Lo;0;L;;;;;N;;;;; +A134;YI SYLLABLE TURX;Lo;0;L;;;;;N;;;;; +A135;YI SYLLABLE TUR;Lo;0;L;;;;;N;;;;; +A136;YI SYLLABLE DDIT;Lo;0;L;;;;;N;;;;; +A137;YI SYLLABLE DDIX;Lo;0;L;;;;;N;;;;; +A138;YI SYLLABLE DDI;Lo;0;L;;;;;N;;;;; +A139;YI SYLLABLE DDIP;Lo;0;L;;;;;N;;;;; +A13A;YI SYLLABLE DDIEX;Lo;0;L;;;;;N;;;;; +A13B;YI SYLLABLE DDIE;Lo;0;L;;;;;N;;;;; +A13C;YI SYLLABLE DDIEP;Lo;0;L;;;;;N;;;;; +A13D;YI SYLLABLE DDAT;Lo;0;L;;;;;N;;;;; +A13E;YI SYLLABLE DDAX;Lo;0;L;;;;;N;;;;; +A13F;YI SYLLABLE DDA;Lo;0;L;;;;;N;;;;; +A140;YI SYLLABLE DDAP;Lo;0;L;;;;;N;;;;; +A141;YI SYLLABLE DDUOX;Lo;0;L;;;;;N;;;;; +A142;YI SYLLABLE DDUO;Lo;0;L;;;;;N;;;;; +A143;YI SYLLABLE DDUOP;Lo;0;L;;;;;N;;;;; +A144;YI SYLLABLE DDOT;Lo;0;L;;;;;N;;;;; +A145;YI SYLLABLE DDOX;Lo;0;L;;;;;N;;;;; +A146;YI SYLLABLE DDO;Lo;0;L;;;;;N;;;;; +A147;YI SYLLABLE DDOP;Lo;0;L;;;;;N;;;;; +A148;YI SYLLABLE DDEX;Lo;0;L;;;;;N;;;;; +A149;YI SYLLABLE DDE;Lo;0;L;;;;;N;;;;; +A14A;YI SYLLABLE DDEP;Lo;0;L;;;;;N;;;;; +A14B;YI SYLLABLE DDUT;Lo;0;L;;;;;N;;;;; +A14C;YI SYLLABLE DDUX;Lo;0;L;;;;;N;;;;; +A14D;YI SYLLABLE DDU;Lo;0;L;;;;;N;;;;; +A14E;YI SYLLABLE DDUP;Lo;0;L;;;;;N;;;;; +A14F;YI SYLLABLE DDURX;Lo;0;L;;;;;N;;;;; +A150;YI SYLLABLE DDUR;Lo;0;L;;;;;N;;;;; +A151;YI SYLLABLE NDIT;Lo;0;L;;;;;N;;;;; +A152;YI SYLLABLE NDIX;Lo;0;L;;;;;N;;;;; +A153;YI SYLLABLE NDI;Lo;0;L;;;;;N;;;;; +A154;YI SYLLABLE NDIP;Lo;0;L;;;;;N;;;;; +A155;YI SYLLABLE NDIEX;Lo;0;L;;;;;N;;;;; +A156;YI SYLLABLE NDIE;Lo;0;L;;;;;N;;;;; +A157;YI SYLLABLE NDAT;Lo;0;L;;;;;N;;;;; +A158;YI SYLLABLE NDAX;Lo;0;L;;;;;N;;;;; +A159;YI SYLLABLE NDA;Lo;0;L;;;;;N;;;;; +A15A;YI SYLLABLE NDAP;Lo;0;L;;;;;N;;;;; +A15B;YI SYLLABLE NDOT;Lo;0;L;;;;;N;;;;; +A15C;YI SYLLABLE NDOX;Lo;0;L;;;;;N;;;;; +A15D;YI SYLLABLE NDO;Lo;0;L;;;;;N;;;;; +A15E;YI SYLLABLE NDOP;Lo;0;L;;;;;N;;;;; +A15F;YI SYLLABLE NDEX;Lo;0;L;;;;;N;;;;; +A160;YI SYLLABLE NDE;Lo;0;L;;;;;N;;;;; +A161;YI SYLLABLE NDEP;Lo;0;L;;;;;N;;;;; +A162;YI SYLLABLE NDUT;Lo;0;L;;;;;N;;;;; +A163;YI SYLLABLE NDUX;Lo;0;L;;;;;N;;;;; +A164;YI SYLLABLE NDU;Lo;0;L;;;;;N;;;;; +A165;YI SYLLABLE NDUP;Lo;0;L;;;;;N;;;;; +A166;YI SYLLABLE NDURX;Lo;0;L;;;;;N;;;;; +A167;YI SYLLABLE NDUR;Lo;0;L;;;;;N;;;;; +A168;YI SYLLABLE HNIT;Lo;0;L;;;;;N;;;;; +A169;YI SYLLABLE HNIX;Lo;0;L;;;;;N;;;;; +A16A;YI SYLLABLE HNI;Lo;0;L;;;;;N;;;;; +A16B;YI SYLLABLE HNIP;Lo;0;L;;;;;N;;;;; +A16C;YI SYLLABLE HNIET;Lo;0;L;;;;;N;;;;; +A16D;YI SYLLABLE HNIEX;Lo;0;L;;;;;N;;;;; +A16E;YI SYLLABLE HNIE;Lo;0;L;;;;;N;;;;; +A16F;YI SYLLABLE HNIEP;Lo;0;L;;;;;N;;;;; +A170;YI SYLLABLE HNAT;Lo;0;L;;;;;N;;;;; +A171;YI SYLLABLE HNAX;Lo;0;L;;;;;N;;;;; +A172;YI SYLLABLE HNA;Lo;0;L;;;;;N;;;;; +A173;YI SYLLABLE HNAP;Lo;0;L;;;;;N;;;;; +A174;YI SYLLABLE HNUOX;Lo;0;L;;;;;N;;;;; +A175;YI SYLLABLE HNUO;Lo;0;L;;;;;N;;;;; +A176;YI SYLLABLE HNOT;Lo;0;L;;;;;N;;;;; +A177;YI SYLLABLE HNOX;Lo;0;L;;;;;N;;;;; +A178;YI SYLLABLE HNOP;Lo;0;L;;;;;N;;;;; +A179;YI SYLLABLE HNEX;Lo;0;L;;;;;N;;;;; +A17A;YI SYLLABLE HNE;Lo;0;L;;;;;N;;;;; +A17B;YI SYLLABLE HNEP;Lo;0;L;;;;;N;;;;; +A17C;YI SYLLABLE HNUT;Lo;0;L;;;;;N;;;;; +A17D;YI SYLLABLE NIT;Lo;0;L;;;;;N;;;;; +A17E;YI SYLLABLE NIX;Lo;0;L;;;;;N;;;;; +A17F;YI SYLLABLE NI;Lo;0;L;;;;;N;;;;; +A180;YI SYLLABLE NIP;Lo;0;L;;;;;N;;;;; +A181;YI SYLLABLE NIEX;Lo;0;L;;;;;N;;;;; +A182;YI SYLLABLE NIE;Lo;0;L;;;;;N;;;;; +A183;YI SYLLABLE NIEP;Lo;0;L;;;;;N;;;;; +A184;YI SYLLABLE NAX;Lo;0;L;;;;;N;;;;; +A185;YI SYLLABLE NA;Lo;0;L;;;;;N;;;;; +A186;YI SYLLABLE NAP;Lo;0;L;;;;;N;;;;; +A187;YI SYLLABLE NUOX;Lo;0;L;;;;;N;;;;; +A188;YI SYLLABLE NUO;Lo;0;L;;;;;N;;;;; +A189;YI SYLLABLE NUOP;Lo;0;L;;;;;N;;;;; +A18A;YI SYLLABLE NOT;Lo;0;L;;;;;N;;;;; +A18B;YI SYLLABLE NOX;Lo;0;L;;;;;N;;;;; +A18C;YI SYLLABLE NO;Lo;0;L;;;;;N;;;;; +A18D;YI SYLLABLE NOP;Lo;0;L;;;;;N;;;;; +A18E;YI SYLLABLE NEX;Lo;0;L;;;;;N;;;;; +A18F;YI SYLLABLE NE;Lo;0;L;;;;;N;;;;; +A190;YI SYLLABLE NEP;Lo;0;L;;;;;N;;;;; +A191;YI SYLLABLE NUT;Lo;0;L;;;;;N;;;;; +A192;YI SYLLABLE NUX;Lo;0;L;;;;;N;;;;; +A193;YI SYLLABLE NU;Lo;0;L;;;;;N;;;;; +A194;YI SYLLABLE NUP;Lo;0;L;;;;;N;;;;; +A195;YI SYLLABLE NURX;Lo;0;L;;;;;N;;;;; +A196;YI SYLLABLE NUR;Lo;0;L;;;;;N;;;;; +A197;YI SYLLABLE HLIT;Lo;0;L;;;;;N;;;;; +A198;YI SYLLABLE HLIX;Lo;0;L;;;;;N;;;;; +A199;YI SYLLABLE HLI;Lo;0;L;;;;;N;;;;; +A19A;YI SYLLABLE HLIP;Lo;0;L;;;;;N;;;;; +A19B;YI SYLLABLE HLIEX;Lo;0;L;;;;;N;;;;; +A19C;YI SYLLABLE HLIE;Lo;0;L;;;;;N;;;;; +A19D;YI SYLLABLE HLIEP;Lo;0;L;;;;;N;;;;; +A19E;YI SYLLABLE HLAT;Lo;0;L;;;;;N;;;;; +A19F;YI SYLLABLE HLAX;Lo;0;L;;;;;N;;;;; +A1A0;YI SYLLABLE HLA;Lo;0;L;;;;;N;;;;; +A1A1;YI SYLLABLE HLAP;Lo;0;L;;;;;N;;;;; +A1A2;YI SYLLABLE HLUOX;Lo;0;L;;;;;N;;;;; +A1A3;YI SYLLABLE HLUO;Lo;0;L;;;;;N;;;;; +A1A4;YI SYLLABLE HLUOP;Lo;0;L;;;;;N;;;;; +A1A5;YI SYLLABLE HLOX;Lo;0;L;;;;;N;;;;; +A1A6;YI SYLLABLE HLO;Lo;0;L;;;;;N;;;;; +A1A7;YI SYLLABLE HLOP;Lo;0;L;;;;;N;;;;; +A1A8;YI SYLLABLE HLEX;Lo;0;L;;;;;N;;;;; +A1A9;YI SYLLABLE HLE;Lo;0;L;;;;;N;;;;; +A1AA;YI SYLLABLE HLEP;Lo;0;L;;;;;N;;;;; +A1AB;YI SYLLABLE HLUT;Lo;0;L;;;;;N;;;;; +A1AC;YI SYLLABLE HLUX;Lo;0;L;;;;;N;;;;; +A1AD;YI SYLLABLE HLU;Lo;0;L;;;;;N;;;;; +A1AE;YI SYLLABLE HLUP;Lo;0;L;;;;;N;;;;; +A1AF;YI SYLLABLE HLURX;Lo;0;L;;;;;N;;;;; +A1B0;YI SYLLABLE HLUR;Lo;0;L;;;;;N;;;;; +A1B1;YI SYLLABLE HLYT;Lo;0;L;;;;;N;;;;; +A1B2;YI SYLLABLE HLYX;Lo;0;L;;;;;N;;;;; +A1B3;YI SYLLABLE HLY;Lo;0;L;;;;;N;;;;; +A1B4;YI SYLLABLE HLYP;Lo;0;L;;;;;N;;;;; +A1B5;YI SYLLABLE HLYRX;Lo;0;L;;;;;N;;;;; +A1B6;YI SYLLABLE HLYR;Lo;0;L;;;;;N;;;;; +A1B7;YI SYLLABLE LIT;Lo;0;L;;;;;N;;;;; +A1B8;YI SYLLABLE LIX;Lo;0;L;;;;;N;;;;; +A1B9;YI SYLLABLE LI;Lo;0;L;;;;;N;;;;; +A1BA;YI SYLLABLE LIP;Lo;0;L;;;;;N;;;;; +A1BB;YI SYLLABLE LIET;Lo;0;L;;;;;N;;;;; +A1BC;YI SYLLABLE LIEX;Lo;0;L;;;;;N;;;;; +A1BD;YI SYLLABLE LIE;Lo;0;L;;;;;N;;;;; +A1BE;YI SYLLABLE LIEP;Lo;0;L;;;;;N;;;;; +A1BF;YI SYLLABLE LAT;Lo;0;L;;;;;N;;;;; +A1C0;YI SYLLABLE LAX;Lo;0;L;;;;;N;;;;; +A1C1;YI SYLLABLE LA;Lo;0;L;;;;;N;;;;; +A1C2;YI SYLLABLE LAP;Lo;0;L;;;;;N;;;;; +A1C3;YI SYLLABLE LUOT;Lo;0;L;;;;;N;;;;; +A1C4;YI SYLLABLE LUOX;Lo;0;L;;;;;N;;;;; +A1C5;YI SYLLABLE LUO;Lo;0;L;;;;;N;;;;; +A1C6;YI SYLLABLE LUOP;Lo;0;L;;;;;N;;;;; +A1C7;YI SYLLABLE LOT;Lo;0;L;;;;;N;;;;; +A1C8;YI SYLLABLE LOX;Lo;0;L;;;;;N;;;;; +A1C9;YI SYLLABLE LO;Lo;0;L;;;;;N;;;;; +A1CA;YI SYLLABLE LOP;Lo;0;L;;;;;N;;;;; +A1CB;YI SYLLABLE LEX;Lo;0;L;;;;;N;;;;; +A1CC;YI SYLLABLE LE;Lo;0;L;;;;;N;;;;; +A1CD;YI SYLLABLE LEP;Lo;0;L;;;;;N;;;;; +A1CE;YI SYLLABLE LUT;Lo;0;L;;;;;N;;;;; +A1CF;YI SYLLABLE LUX;Lo;0;L;;;;;N;;;;; +A1D0;YI SYLLABLE LU;Lo;0;L;;;;;N;;;;; +A1D1;YI SYLLABLE LUP;Lo;0;L;;;;;N;;;;; +A1D2;YI SYLLABLE LURX;Lo;0;L;;;;;N;;;;; +A1D3;YI SYLLABLE LUR;Lo;0;L;;;;;N;;;;; +A1D4;YI SYLLABLE LYT;Lo;0;L;;;;;N;;;;; +A1D5;YI SYLLABLE LYX;Lo;0;L;;;;;N;;;;; +A1D6;YI SYLLABLE LY;Lo;0;L;;;;;N;;;;; +A1D7;YI SYLLABLE LYP;Lo;0;L;;;;;N;;;;; +A1D8;YI SYLLABLE LYRX;Lo;0;L;;;;;N;;;;; +A1D9;YI SYLLABLE LYR;Lo;0;L;;;;;N;;;;; +A1DA;YI SYLLABLE GIT;Lo;0;L;;;;;N;;;;; +A1DB;YI SYLLABLE GIX;Lo;0;L;;;;;N;;;;; +A1DC;YI SYLLABLE GI;Lo;0;L;;;;;N;;;;; +A1DD;YI SYLLABLE GIP;Lo;0;L;;;;;N;;;;; +A1DE;YI SYLLABLE GIET;Lo;0;L;;;;;N;;;;; +A1DF;YI SYLLABLE GIEX;Lo;0;L;;;;;N;;;;; +A1E0;YI SYLLABLE GIE;Lo;0;L;;;;;N;;;;; +A1E1;YI SYLLABLE GIEP;Lo;0;L;;;;;N;;;;; +A1E2;YI SYLLABLE GAT;Lo;0;L;;;;;N;;;;; +A1E3;YI SYLLABLE GAX;Lo;0;L;;;;;N;;;;; +A1E4;YI SYLLABLE GA;Lo;0;L;;;;;N;;;;; +A1E5;YI SYLLABLE GAP;Lo;0;L;;;;;N;;;;; +A1E6;YI SYLLABLE GUOT;Lo;0;L;;;;;N;;;;; +A1E7;YI SYLLABLE GUOX;Lo;0;L;;;;;N;;;;; +A1E8;YI SYLLABLE GUO;Lo;0;L;;;;;N;;;;; +A1E9;YI SYLLABLE GUOP;Lo;0;L;;;;;N;;;;; +A1EA;YI SYLLABLE GOT;Lo;0;L;;;;;N;;;;; +A1EB;YI SYLLABLE GOX;Lo;0;L;;;;;N;;;;; +A1EC;YI SYLLABLE GO;Lo;0;L;;;;;N;;;;; +A1ED;YI SYLLABLE GOP;Lo;0;L;;;;;N;;;;; +A1EE;YI SYLLABLE GET;Lo;0;L;;;;;N;;;;; +A1EF;YI SYLLABLE GEX;Lo;0;L;;;;;N;;;;; +A1F0;YI SYLLABLE GE;Lo;0;L;;;;;N;;;;; +A1F1;YI SYLLABLE GEP;Lo;0;L;;;;;N;;;;; +A1F2;YI SYLLABLE GUT;Lo;0;L;;;;;N;;;;; +A1F3;YI SYLLABLE GUX;Lo;0;L;;;;;N;;;;; +A1F4;YI SYLLABLE GU;Lo;0;L;;;;;N;;;;; +A1F5;YI SYLLABLE GUP;Lo;0;L;;;;;N;;;;; +A1F6;YI SYLLABLE GURX;Lo;0;L;;;;;N;;;;; +A1F7;YI SYLLABLE GUR;Lo;0;L;;;;;N;;;;; +A1F8;YI SYLLABLE KIT;Lo;0;L;;;;;N;;;;; +A1F9;YI SYLLABLE KIX;Lo;0;L;;;;;N;;;;; +A1FA;YI SYLLABLE KI;Lo;0;L;;;;;N;;;;; +A1FB;YI SYLLABLE KIP;Lo;0;L;;;;;N;;;;; +A1FC;YI SYLLABLE KIEX;Lo;0;L;;;;;N;;;;; +A1FD;YI SYLLABLE KIE;Lo;0;L;;;;;N;;;;; +A1FE;YI SYLLABLE KIEP;Lo;0;L;;;;;N;;;;; +A1FF;YI SYLLABLE KAT;Lo;0;L;;;;;N;;;;; +A200;YI SYLLABLE KAX;Lo;0;L;;;;;N;;;;; +A201;YI SYLLABLE KA;Lo;0;L;;;;;N;;;;; +A202;YI SYLLABLE KAP;Lo;0;L;;;;;N;;;;; +A203;YI SYLLABLE KUOX;Lo;0;L;;;;;N;;;;; +A204;YI SYLLABLE KUO;Lo;0;L;;;;;N;;;;; +A205;YI SYLLABLE KUOP;Lo;0;L;;;;;N;;;;; +A206;YI SYLLABLE KOT;Lo;0;L;;;;;N;;;;; +A207;YI SYLLABLE KOX;Lo;0;L;;;;;N;;;;; +A208;YI SYLLABLE KO;Lo;0;L;;;;;N;;;;; +A209;YI SYLLABLE KOP;Lo;0;L;;;;;N;;;;; +A20A;YI SYLLABLE KET;Lo;0;L;;;;;N;;;;; +A20B;YI SYLLABLE KEX;Lo;0;L;;;;;N;;;;; +A20C;YI SYLLABLE KE;Lo;0;L;;;;;N;;;;; +A20D;YI SYLLABLE KEP;Lo;0;L;;;;;N;;;;; +A20E;YI SYLLABLE KUT;Lo;0;L;;;;;N;;;;; +A20F;YI SYLLABLE KUX;Lo;0;L;;;;;N;;;;; +A210;YI SYLLABLE KU;Lo;0;L;;;;;N;;;;; +A211;YI SYLLABLE KUP;Lo;0;L;;;;;N;;;;; +A212;YI SYLLABLE KURX;Lo;0;L;;;;;N;;;;; +A213;YI SYLLABLE KUR;Lo;0;L;;;;;N;;;;; +A214;YI SYLLABLE GGIT;Lo;0;L;;;;;N;;;;; +A215;YI SYLLABLE GGIX;Lo;0;L;;;;;N;;;;; +A216;YI SYLLABLE GGI;Lo;0;L;;;;;N;;;;; +A217;YI SYLLABLE GGIEX;Lo;0;L;;;;;N;;;;; +A218;YI SYLLABLE GGIE;Lo;0;L;;;;;N;;;;; +A219;YI SYLLABLE GGIEP;Lo;0;L;;;;;N;;;;; +A21A;YI SYLLABLE GGAT;Lo;0;L;;;;;N;;;;; +A21B;YI SYLLABLE GGAX;Lo;0;L;;;;;N;;;;; +A21C;YI SYLLABLE GGA;Lo;0;L;;;;;N;;;;; +A21D;YI SYLLABLE GGAP;Lo;0;L;;;;;N;;;;; +A21E;YI SYLLABLE GGUOT;Lo;0;L;;;;;N;;;;; +A21F;YI SYLLABLE GGUOX;Lo;0;L;;;;;N;;;;; +A220;YI SYLLABLE GGUO;Lo;0;L;;;;;N;;;;; +A221;YI SYLLABLE GGUOP;Lo;0;L;;;;;N;;;;; +A222;YI SYLLABLE GGOT;Lo;0;L;;;;;N;;;;; +A223;YI SYLLABLE GGOX;Lo;0;L;;;;;N;;;;; +A224;YI SYLLABLE GGO;Lo;0;L;;;;;N;;;;; +A225;YI SYLLABLE GGOP;Lo;0;L;;;;;N;;;;; +A226;YI SYLLABLE GGET;Lo;0;L;;;;;N;;;;; +A227;YI SYLLABLE GGEX;Lo;0;L;;;;;N;;;;; +A228;YI SYLLABLE GGE;Lo;0;L;;;;;N;;;;; +A229;YI SYLLABLE GGEP;Lo;0;L;;;;;N;;;;; +A22A;YI SYLLABLE GGUT;Lo;0;L;;;;;N;;;;; +A22B;YI SYLLABLE GGUX;Lo;0;L;;;;;N;;;;; +A22C;YI SYLLABLE GGU;Lo;0;L;;;;;N;;;;; +A22D;YI SYLLABLE GGUP;Lo;0;L;;;;;N;;;;; +A22E;YI SYLLABLE GGURX;Lo;0;L;;;;;N;;;;; +A22F;YI SYLLABLE GGUR;Lo;0;L;;;;;N;;;;; +A230;YI SYLLABLE MGIEX;Lo;0;L;;;;;N;;;;; +A231;YI SYLLABLE MGIE;Lo;0;L;;;;;N;;;;; +A232;YI SYLLABLE MGAT;Lo;0;L;;;;;N;;;;; +A233;YI SYLLABLE MGAX;Lo;0;L;;;;;N;;;;; +A234;YI SYLLABLE MGA;Lo;0;L;;;;;N;;;;; +A235;YI SYLLABLE MGAP;Lo;0;L;;;;;N;;;;; +A236;YI SYLLABLE MGUOX;Lo;0;L;;;;;N;;;;; +A237;YI SYLLABLE MGUO;Lo;0;L;;;;;N;;;;; +A238;YI SYLLABLE MGUOP;Lo;0;L;;;;;N;;;;; +A239;YI SYLLABLE MGOT;Lo;0;L;;;;;N;;;;; +A23A;YI SYLLABLE MGOX;Lo;0;L;;;;;N;;;;; +A23B;YI SYLLABLE MGO;Lo;0;L;;;;;N;;;;; +A23C;YI SYLLABLE MGOP;Lo;0;L;;;;;N;;;;; +A23D;YI SYLLABLE MGEX;Lo;0;L;;;;;N;;;;; +A23E;YI SYLLABLE MGE;Lo;0;L;;;;;N;;;;; +A23F;YI SYLLABLE MGEP;Lo;0;L;;;;;N;;;;; +A240;YI SYLLABLE MGUT;Lo;0;L;;;;;N;;;;; +A241;YI SYLLABLE MGUX;Lo;0;L;;;;;N;;;;; +A242;YI SYLLABLE MGU;Lo;0;L;;;;;N;;;;; +A243;YI SYLLABLE MGUP;Lo;0;L;;;;;N;;;;; +A244;YI SYLLABLE MGURX;Lo;0;L;;;;;N;;;;; +A245;YI SYLLABLE MGUR;Lo;0;L;;;;;N;;;;; +A246;YI SYLLABLE HXIT;Lo;0;L;;;;;N;;;;; +A247;YI SYLLABLE HXIX;Lo;0;L;;;;;N;;;;; +A248;YI SYLLABLE HXI;Lo;0;L;;;;;N;;;;; +A249;YI SYLLABLE HXIP;Lo;0;L;;;;;N;;;;; +A24A;YI SYLLABLE HXIET;Lo;0;L;;;;;N;;;;; +A24B;YI SYLLABLE HXIEX;Lo;0;L;;;;;N;;;;; +A24C;YI SYLLABLE HXIE;Lo;0;L;;;;;N;;;;; +A24D;YI SYLLABLE HXIEP;Lo;0;L;;;;;N;;;;; +A24E;YI SYLLABLE HXAT;Lo;0;L;;;;;N;;;;; +A24F;YI SYLLABLE HXAX;Lo;0;L;;;;;N;;;;; +A250;YI SYLLABLE HXA;Lo;0;L;;;;;N;;;;; +A251;YI SYLLABLE HXAP;Lo;0;L;;;;;N;;;;; +A252;YI SYLLABLE HXUOT;Lo;0;L;;;;;N;;;;; +A253;YI SYLLABLE HXUOX;Lo;0;L;;;;;N;;;;; +A254;YI SYLLABLE HXUO;Lo;0;L;;;;;N;;;;; +A255;YI SYLLABLE HXUOP;Lo;0;L;;;;;N;;;;; +A256;YI SYLLABLE HXOT;Lo;0;L;;;;;N;;;;; +A257;YI SYLLABLE HXOX;Lo;0;L;;;;;N;;;;; +A258;YI SYLLABLE HXO;Lo;0;L;;;;;N;;;;; +A259;YI SYLLABLE HXOP;Lo;0;L;;;;;N;;;;; +A25A;YI SYLLABLE HXEX;Lo;0;L;;;;;N;;;;; +A25B;YI SYLLABLE HXE;Lo;0;L;;;;;N;;;;; +A25C;YI SYLLABLE HXEP;Lo;0;L;;;;;N;;;;; +A25D;YI SYLLABLE NGIEX;Lo;0;L;;;;;N;;;;; +A25E;YI SYLLABLE NGIE;Lo;0;L;;;;;N;;;;; +A25F;YI SYLLABLE NGIEP;Lo;0;L;;;;;N;;;;; +A260;YI SYLLABLE NGAT;Lo;0;L;;;;;N;;;;; +A261;YI SYLLABLE NGAX;Lo;0;L;;;;;N;;;;; +A262;YI SYLLABLE NGA;Lo;0;L;;;;;N;;;;; +A263;YI SYLLABLE NGAP;Lo;0;L;;;;;N;;;;; +A264;YI SYLLABLE NGUOT;Lo;0;L;;;;;N;;;;; +A265;YI SYLLABLE NGUOX;Lo;0;L;;;;;N;;;;; +A266;YI SYLLABLE NGUO;Lo;0;L;;;;;N;;;;; +A267;YI SYLLABLE NGOT;Lo;0;L;;;;;N;;;;; +A268;YI SYLLABLE NGOX;Lo;0;L;;;;;N;;;;; +A269;YI SYLLABLE NGO;Lo;0;L;;;;;N;;;;; +A26A;YI SYLLABLE NGOP;Lo;0;L;;;;;N;;;;; +A26B;YI SYLLABLE NGEX;Lo;0;L;;;;;N;;;;; +A26C;YI SYLLABLE NGE;Lo;0;L;;;;;N;;;;; +A26D;YI SYLLABLE NGEP;Lo;0;L;;;;;N;;;;; +A26E;YI SYLLABLE HIT;Lo;0;L;;;;;N;;;;; +A26F;YI SYLLABLE HIEX;Lo;0;L;;;;;N;;;;; +A270;YI SYLLABLE HIE;Lo;0;L;;;;;N;;;;; +A271;YI SYLLABLE HAT;Lo;0;L;;;;;N;;;;; +A272;YI SYLLABLE HAX;Lo;0;L;;;;;N;;;;; +A273;YI SYLLABLE HA;Lo;0;L;;;;;N;;;;; +A274;YI SYLLABLE HAP;Lo;0;L;;;;;N;;;;; +A275;YI SYLLABLE HUOT;Lo;0;L;;;;;N;;;;; +A276;YI SYLLABLE HUOX;Lo;0;L;;;;;N;;;;; +A277;YI SYLLABLE HUO;Lo;0;L;;;;;N;;;;; +A278;YI SYLLABLE HUOP;Lo;0;L;;;;;N;;;;; +A279;YI SYLLABLE HOT;Lo;0;L;;;;;N;;;;; +A27A;YI SYLLABLE HOX;Lo;0;L;;;;;N;;;;; +A27B;YI SYLLABLE HO;Lo;0;L;;;;;N;;;;; +A27C;YI SYLLABLE HOP;Lo;0;L;;;;;N;;;;; +A27D;YI SYLLABLE HEX;Lo;0;L;;;;;N;;;;; +A27E;YI SYLLABLE HE;Lo;0;L;;;;;N;;;;; +A27F;YI SYLLABLE HEP;Lo;0;L;;;;;N;;;;; +A280;YI SYLLABLE WAT;Lo;0;L;;;;;N;;;;; +A281;YI SYLLABLE WAX;Lo;0;L;;;;;N;;;;; +A282;YI SYLLABLE WA;Lo;0;L;;;;;N;;;;; +A283;YI SYLLABLE WAP;Lo;0;L;;;;;N;;;;; +A284;YI SYLLABLE WUOX;Lo;0;L;;;;;N;;;;; +A285;YI SYLLABLE WUO;Lo;0;L;;;;;N;;;;; +A286;YI SYLLABLE WUOP;Lo;0;L;;;;;N;;;;; +A287;YI SYLLABLE WOX;Lo;0;L;;;;;N;;;;; +A288;YI SYLLABLE WO;Lo;0;L;;;;;N;;;;; +A289;YI SYLLABLE WOP;Lo;0;L;;;;;N;;;;; +A28A;YI SYLLABLE WEX;Lo;0;L;;;;;N;;;;; +A28B;YI SYLLABLE WE;Lo;0;L;;;;;N;;;;; +A28C;YI SYLLABLE WEP;Lo;0;L;;;;;N;;;;; +A28D;YI SYLLABLE ZIT;Lo;0;L;;;;;N;;;;; +A28E;YI SYLLABLE ZIX;Lo;0;L;;;;;N;;;;; +A28F;YI SYLLABLE ZI;Lo;0;L;;;;;N;;;;; +A290;YI SYLLABLE ZIP;Lo;0;L;;;;;N;;;;; +A291;YI SYLLABLE ZIEX;Lo;0;L;;;;;N;;;;; +A292;YI SYLLABLE ZIE;Lo;0;L;;;;;N;;;;; +A293;YI SYLLABLE ZIEP;Lo;0;L;;;;;N;;;;; +A294;YI SYLLABLE ZAT;Lo;0;L;;;;;N;;;;; +A295;YI SYLLABLE ZAX;Lo;0;L;;;;;N;;;;; +A296;YI SYLLABLE ZA;Lo;0;L;;;;;N;;;;; +A297;YI SYLLABLE ZAP;Lo;0;L;;;;;N;;;;; +A298;YI SYLLABLE ZUOX;Lo;0;L;;;;;N;;;;; +A299;YI SYLLABLE ZUO;Lo;0;L;;;;;N;;;;; +A29A;YI SYLLABLE ZUOP;Lo;0;L;;;;;N;;;;; +A29B;YI SYLLABLE ZOT;Lo;0;L;;;;;N;;;;; +A29C;YI SYLLABLE ZOX;Lo;0;L;;;;;N;;;;; +A29D;YI SYLLABLE ZO;Lo;0;L;;;;;N;;;;; +A29E;YI SYLLABLE ZOP;Lo;0;L;;;;;N;;;;; +A29F;YI SYLLABLE ZEX;Lo;0;L;;;;;N;;;;; +A2A0;YI SYLLABLE ZE;Lo;0;L;;;;;N;;;;; +A2A1;YI SYLLABLE ZEP;Lo;0;L;;;;;N;;;;; +A2A2;YI SYLLABLE ZUT;Lo;0;L;;;;;N;;;;; +A2A3;YI SYLLABLE ZUX;Lo;0;L;;;;;N;;;;; +A2A4;YI SYLLABLE ZU;Lo;0;L;;;;;N;;;;; +A2A5;YI SYLLABLE ZUP;Lo;0;L;;;;;N;;;;; +A2A6;YI SYLLABLE ZURX;Lo;0;L;;;;;N;;;;; +A2A7;YI SYLLABLE ZUR;Lo;0;L;;;;;N;;;;; +A2A8;YI SYLLABLE ZYT;Lo;0;L;;;;;N;;;;; +A2A9;YI SYLLABLE ZYX;Lo;0;L;;;;;N;;;;; +A2AA;YI SYLLABLE ZY;Lo;0;L;;;;;N;;;;; +A2AB;YI SYLLABLE ZYP;Lo;0;L;;;;;N;;;;; +A2AC;YI SYLLABLE ZYRX;Lo;0;L;;;;;N;;;;; +A2AD;YI SYLLABLE ZYR;Lo;0;L;;;;;N;;;;; +A2AE;YI SYLLABLE CIT;Lo;0;L;;;;;N;;;;; +A2AF;YI SYLLABLE CIX;Lo;0;L;;;;;N;;;;; +A2B0;YI SYLLABLE CI;Lo;0;L;;;;;N;;;;; +A2B1;YI SYLLABLE CIP;Lo;0;L;;;;;N;;;;; +A2B2;YI SYLLABLE CIET;Lo;0;L;;;;;N;;;;; +A2B3;YI SYLLABLE CIEX;Lo;0;L;;;;;N;;;;; +A2B4;YI SYLLABLE CIE;Lo;0;L;;;;;N;;;;; +A2B5;YI SYLLABLE CIEP;Lo;0;L;;;;;N;;;;; +A2B6;YI SYLLABLE CAT;Lo;0;L;;;;;N;;;;; +A2B7;YI SYLLABLE CAX;Lo;0;L;;;;;N;;;;; +A2B8;YI SYLLABLE CA;Lo;0;L;;;;;N;;;;; +A2B9;YI SYLLABLE CAP;Lo;0;L;;;;;N;;;;; +A2BA;YI SYLLABLE CUOX;Lo;0;L;;;;;N;;;;; +A2BB;YI SYLLABLE CUO;Lo;0;L;;;;;N;;;;; +A2BC;YI SYLLABLE CUOP;Lo;0;L;;;;;N;;;;; +A2BD;YI SYLLABLE COT;Lo;0;L;;;;;N;;;;; +A2BE;YI SYLLABLE COX;Lo;0;L;;;;;N;;;;; +A2BF;YI SYLLABLE CO;Lo;0;L;;;;;N;;;;; +A2C0;YI SYLLABLE COP;Lo;0;L;;;;;N;;;;; +A2C1;YI SYLLABLE CEX;Lo;0;L;;;;;N;;;;; +A2C2;YI SYLLABLE CE;Lo;0;L;;;;;N;;;;; +A2C3;YI SYLLABLE CEP;Lo;0;L;;;;;N;;;;; +A2C4;YI SYLLABLE CUT;Lo;0;L;;;;;N;;;;; +A2C5;YI SYLLABLE CUX;Lo;0;L;;;;;N;;;;; +A2C6;YI SYLLABLE CU;Lo;0;L;;;;;N;;;;; +A2C7;YI SYLLABLE CUP;Lo;0;L;;;;;N;;;;; +A2C8;YI SYLLABLE CURX;Lo;0;L;;;;;N;;;;; +A2C9;YI SYLLABLE CUR;Lo;0;L;;;;;N;;;;; +A2CA;YI SYLLABLE CYT;Lo;0;L;;;;;N;;;;; +A2CB;YI SYLLABLE CYX;Lo;0;L;;;;;N;;;;; +A2CC;YI SYLLABLE CY;Lo;0;L;;;;;N;;;;; +A2CD;YI SYLLABLE CYP;Lo;0;L;;;;;N;;;;; +A2CE;YI SYLLABLE CYRX;Lo;0;L;;;;;N;;;;; +A2CF;YI SYLLABLE CYR;Lo;0;L;;;;;N;;;;; +A2D0;YI SYLLABLE ZZIT;Lo;0;L;;;;;N;;;;; +A2D1;YI SYLLABLE ZZIX;Lo;0;L;;;;;N;;;;; +A2D2;YI SYLLABLE ZZI;Lo;0;L;;;;;N;;;;; +A2D3;YI SYLLABLE ZZIP;Lo;0;L;;;;;N;;;;; +A2D4;YI SYLLABLE ZZIET;Lo;0;L;;;;;N;;;;; +A2D5;YI SYLLABLE ZZIEX;Lo;0;L;;;;;N;;;;; +A2D6;YI SYLLABLE ZZIE;Lo;0;L;;;;;N;;;;; +A2D7;YI SYLLABLE ZZIEP;Lo;0;L;;;;;N;;;;; +A2D8;YI SYLLABLE ZZAT;Lo;0;L;;;;;N;;;;; +A2D9;YI SYLLABLE ZZAX;Lo;0;L;;;;;N;;;;; +A2DA;YI SYLLABLE ZZA;Lo;0;L;;;;;N;;;;; +A2DB;YI SYLLABLE ZZAP;Lo;0;L;;;;;N;;;;; +A2DC;YI SYLLABLE ZZOX;Lo;0;L;;;;;N;;;;; +A2DD;YI SYLLABLE ZZO;Lo;0;L;;;;;N;;;;; +A2DE;YI SYLLABLE ZZOP;Lo;0;L;;;;;N;;;;; +A2DF;YI SYLLABLE ZZEX;Lo;0;L;;;;;N;;;;; +A2E0;YI SYLLABLE ZZE;Lo;0;L;;;;;N;;;;; +A2E1;YI SYLLABLE ZZEP;Lo;0;L;;;;;N;;;;; +A2E2;YI SYLLABLE ZZUX;Lo;0;L;;;;;N;;;;; +A2E3;YI SYLLABLE ZZU;Lo;0;L;;;;;N;;;;; +A2E4;YI SYLLABLE ZZUP;Lo;0;L;;;;;N;;;;; +A2E5;YI SYLLABLE ZZURX;Lo;0;L;;;;;N;;;;; +A2E6;YI SYLLABLE ZZUR;Lo;0;L;;;;;N;;;;; +A2E7;YI SYLLABLE ZZYT;Lo;0;L;;;;;N;;;;; +A2E8;YI SYLLABLE ZZYX;Lo;0;L;;;;;N;;;;; +A2E9;YI SYLLABLE ZZY;Lo;0;L;;;;;N;;;;; +A2EA;YI SYLLABLE ZZYP;Lo;0;L;;;;;N;;;;; +A2EB;YI SYLLABLE ZZYRX;Lo;0;L;;;;;N;;;;; +A2EC;YI SYLLABLE ZZYR;Lo;0;L;;;;;N;;;;; +A2ED;YI SYLLABLE NZIT;Lo;0;L;;;;;N;;;;; +A2EE;YI SYLLABLE NZIX;Lo;0;L;;;;;N;;;;; +A2EF;YI SYLLABLE NZI;Lo;0;L;;;;;N;;;;; +A2F0;YI SYLLABLE NZIP;Lo;0;L;;;;;N;;;;; +A2F1;YI SYLLABLE NZIEX;Lo;0;L;;;;;N;;;;; +A2F2;YI SYLLABLE NZIE;Lo;0;L;;;;;N;;;;; +A2F3;YI SYLLABLE NZIEP;Lo;0;L;;;;;N;;;;; +A2F4;YI SYLLABLE NZAT;Lo;0;L;;;;;N;;;;; +A2F5;YI SYLLABLE NZAX;Lo;0;L;;;;;N;;;;; +A2F6;YI SYLLABLE NZA;Lo;0;L;;;;;N;;;;; +A2F7;YI SYLLABLE NZAP;Lo;0;L;;;;;N;;;;; +A2F8;YI SYLLABLE NZUOX;Lo;0;L;;;;;N;;;;; +A2F9;YI SYLLABLE NZUO;Lo;0;L;;;;;N;;;;; +A2FA;YI SYLLABLE NZOX;Lo;0;L;;;;;N;;;;; +A2FB;YI SYLLABLE NZOP;Lo;0;L;;;;;N;;;;; +A2FC;YI SYLLABLE NZEX;Lo;0;L;;;;;N;;;;; +A2FD;YI SYLLABLE NZE;Lo;0;L;;;;;N;;;;; +A2FE;YI SYLLABLE NZUX;Lo;0;L;;;;;N;;;;; +A2FF;YI SYLLABLE NZU;Lo;0;L;;;;;N;;;;; +A300;YI SYLLABLE NZUP;Lo;0;L;;;;;N;;;;; +A301;YI SYLLABLE NZURX;Lo;0;L;;;;;N;;;;; +A302;YI SYLLABLE NZUR;Lo;0;L;;;;;N;;;;; +A303;YI SYLLABLE NZYT;Lo;0;L;;;;;N;;;;; +A304;YI SYLLABLE NZYX;Lo;0;L;;;;;N;;;;; +A305;YI SYLLABLE NZY;Lo;0;L;;;;;N;;;;; +A306;YI SYLLABLE NZYP;Lo;0;L;;;;;N;;;;; +A307;YI SYLLABLE NZYRX;Lo;0;L;;;;;N;;;;; +A308;YI SYLLABLE NZYR;Lo;0;L;;;;;N;;;;; +A309;YI SYLLABLE SIT;Lo;0;L;;;;;N;;;;; +A30A;YI SYLLABLE SIX;Lo;0;L;;;;;N;;;;; +A30B;YI SYLLABLE SI;Lo;0;L;;;;;N;;;;; +A30C;YI SYLLABLE SIP;Lo;0;L;;;;;N;;;;; +A30D;YI SYLLABLE SIEX;Lo;0;L;;;;;N;;;;; +A30E;YI SYLLABLE SIE;Lo;0;L;;;;;N;;;;; +A30F;YI SYLLABLE SIEP;Lo;0;L;;;;;N;;;;; +A310;YI SYLLABLE SAT;Lo;0;L;;;;;N;;;;; +A311;YI SYLLABLE SAX;Lo;0;L;;;;;N;;;;; +A312;YI SYLLABLE SA;Lo;0;L;;;;;N;;;;; +A313;YI SYLLABLE SAP;Lo;0;L;;;;;N;;;;; +A314;YI SYLLABLE SUOX;Lo;0;L;;;;;N;;;;; +A315;YI SYLLABLE SUO;Lo;0;L;;;;;N;;;;; +A316;YI SYLLABLE SUOP;Lo;0;L;;;;;N;;;;; +A317;YI SYLLABLE SOT;Lo;0;L;;;;;N;;;;; +A318;YI SYLLABLE SOX;Lo;0;L;;;;;N;;;;; +A319;YI SYLLABLE SO;Lo;0;L;;;;;N;;;;; +A31A;YI SYLLABLE SOP;Lo;0;L;;;;;N;;;;; +A31B;YI SYLLABLE SEX;Lo;0;L;;;;;N;;;;; +A31C;YI SYLLABLE SE;Lo;0;L;;;;;N;;;;; +A31D;YI SYLLABLE SEP;Lo;0;L;;;;;N;;;;; +A31E;YI SYLLABLE SUT;Lo;0;L;;;;;N;;;;; +A31F;YI SYLLABLE SUX;Lo;0;L;;;;;N;;;;; +A320;YI SYLLABLE SU;Lo;0;L;;;;;N;;;;; +A321;YI SYLLABLE SUP;Lo;0;L;;;;;N;;;;; +A322;YI SYLLABLE SURX;Lo;0;L;;;;;N;;;;; +A323;YI SYLLABLE SUR;Lo;0;L;;;;;N;;;;; +A324;YI SYLLABLE SYT;Lo;0;L;;;;;N;;;;; +A325;YI SYLLABLE SYX;Lo;0;L;;;;;N;;;;; +A326;YI SYLLABLE SY;Lo;0;L;;;;;N;;;;; +A327;YI SYLLABLE SYP;Lo;0;L;;;;;N;;;;; +A328;YI SYLLABLE SYRX;Lo;0;L;;;;;N;;;;; +A329;YI SYLLABLE SYR;Lo;0;L;;;;;N;;;;; +A32A;YI SYLLABLE SSIT;Lo;0;L;;;;;N;;;;; +A32B;YI SYLLABLE SSIX;Lo;0;L;;;;;N;;;;; +A32C;YI SYLLABLE SSI;Lo;0;L;;;;;N;;;;; +A32D;YI SYLLABLE SSIP;Lo;0;L;;;;;N;;;;; +A32E;YI SYLLABLE SSIEX;Lo;0;L;;;;;N;;;;; +A32F;YI SYLLABLE SSIE;Lo;0;L;;;;;N;;;;; +A330;YI SYLLABLE SSIEP;Lo;0;L;;;;;N;;;;; +A331;YI SYLLABLE SSAT;Lo;0;L;;;;;N;;;;; +A332;YI SYLLABLE SSAX;Lo;0;L;;;;;N;;;;; +A333;YI SYLLABLE SSA;Lo;0;L;;;;;N;;;;; +A334;YI SYLLABLE SSAP;Lo;0;L;;;;;N;;;;; +A335;YI SYLLABLE SSOT;Lo;0;L;;;;;N;;;;; +A336;YI SYLLABLE SSOX;Lo;0;L;;;;;N;;;;; +A337;YI SYLLABLE SSO;Lo;0;L;;;;;N;;;;; +A338;YI SYLLABLE SSOP;Lo;0;L;;;;;N;;;;; +A339;YI SYLLABLE SSEX;Lo;0;L;;;;;N;;;;; +A33A;YI SYLLABLE SSE;Lo;0;L;;;;;N;;;;; +A33B;YI SYLLABLE SSEP;Lo;0;L;;;;;N;;;;; +A33C;YI SYLLABLE SSUT;Lo;0;L;;;;;N;;;;; +A33D;YI SYLLABLE SSUX;Lo;0;L;;;;;N;;;;; +A33E;YI SYLLABLE SSU;Lo;0;L;;;;;N;;;;; +A33F;YI SYLLABLE SSUP;Lo;0;L;;;;;N;;;;; +A340;YI SYLLABLE SSYT;Lo;0;L;;;;;N;;;;; +A341;YI SYLLABLE SSYX;Lo;0;L;;;;;N;;;;; +A342;YI SYLLABLE SSY;Lo;0;L;;;;;N;;;;; +A343;YI SYLLABLE SSYP;Lo;0;L;;;;;N;;;;; +A344;YI SYLLABLE SSYRX;Lo;0;L;;;;;N;;;;; +A345;YI SYLLABLE SSYR;Lo;0;L;;;;;N;;;;; +A346;YI SYLLABLE ZHAT;Lo;0;L;;;;;N;;;;; +A347;YI SYLLABLE ZHAX;Lo;0;L;;;;;N;;;;; +A348;YI SYLLABLE ZHA;Lo;0;L;;;;;N;;;;; +A349;YI SYLLABLE ZHAP;Lo;0;L;;;;;N;;;;; +A34A;YI SYLLABLE ZHUOX;Lo;0;L;;;;;N;;;;; +A34B;YI SYLLABLE ZHUO;Lo;0;L;;;;;N;;;;; +A34C;YI SYLLABLE ZHUOP;Lo;0;L;;;;;N;;;;; +A34D;YI SYLLABLE ZHOT;Lo;0;L;;;;;N;;;;; +A34E;YI SYLLABLE ZHOX;Lo;0;L;;;;;N;;;;; +A34F;YI SYLLABLE ZHO;Lo;0;L;;;;;N;;;;; +A350;YI SYLLABLE ZHOP;Lo;0;L;;;;;N;;;;; +A351;YI SYLLABLE ZHET;Lo;0;L;;;;;N;;;;; +A352;YI SYLLABLE ZHEX;Lo;0;L;;;;;N;;;;; +A353;YI SYLLABLE ZHE;Lo;0;L;;;;;N;;;;; +A354;YI SYLLABLE ZHEP;Lo;0;L;;;;;N;;;;; +A355;YI SYLLABLE ZHUT;Lo;0;L;;;;;N;;;;; +A356;YI SYLLABLE ZHUX;Lo;0;L;;;;;N;;;;; +A357;YI SYLLABLE ZHU;Lo;0;L;;;;;N;;;;; +A358;YI SYLLABLE ZHUP;Lo;0;L;;;;;N;;;;; +A359;YI SYLLABLE ZHURX;Lo;0;L;;;;;N;;;;; +A35A;YI SYLLABLE ZHUR;Lo;0;L;;;;;N;;;;; +A35B;YI SYLLABLE ZHYT;Lo;0;L;;;;;N;;;;; +A35C;YI SYLLABLE ZHYX;Lo;0;L;;;;;N;;;;; +A35D;YI SYLLABLE ZHY;Lo;0;L;;;;;N;;;;; +A35E;YI SYLLABLE ZHYP;Lo;0;L;;;;;N;;;;; +A35F;YI SYLLABLE ZHYRX;Lo;0;L;;;;;N;;;;; +A360;YI SYLLABLE ZHYR;Lo;0;L;;;;;N;;;;; +A361;YI SYLLABLE CHAT;Lo;0;L;;;;;N;;;;; +A362;YI SYLLABLE CHAX;Lo;0;L;;;;;N;;;;; +A363;YI SYLLABLE CHA;Lo;0;L;;;;;N;;;;; +A364;YI SYLLABLE CHAP;Lo;0;L;;;;;N;;;;; +A365;YI SYLLABLE CHUOT;Lo;0;L;;;;;N;;;;; +A366;YI SYLLABLE CHUOX;Lo;0;L;;;;;N;;;;; +A367;YI SYLLABLE CHUO;Lo;0;L;;;;;N;;;;; +A368;YI SYLLABLE CHUOP;Lo;0;L;;;;;N;;;;; +A369;YI SYLLABLE CHOT;Lo;0;L;;;;;N;;;;; +A36A;YI SYLLABLE CHOX;Lo;0;L;;;;;N;;;;; +A36B;YI SYLLABLE CHO;Lo;0;L;;;;;N;;;;; +A36C;YI SYLLABLE CHOP;Lo;0;L;;;;;N;;;;; +A36D;YI SYLLABLE CHET;Lo;0;L;;;;;N;;;;; +A36E;YI SYLLABLE CHEX;Lo;0;L;;;;;N;;;;; +A36F;YI SYLLABLE CHE;Lo;0;L;;;;;N;;;;; +A370;YI SYLLABLE CHEP;Lo;0;L;;;;;N;;;;; +A371;YI SYLLABLE CHUX;Lo;0;L;;;;;N;;;;; +A372;YI SYLLABLE CHU;Lo;0;L;;;;;N;;;;; +A373;YI SYLLABLE CHUP;Lo;0;L;;;;;N;;;;; +A374;YI SYLLABLE CHURX;Lo;0;L;;;;;N;;;;; +A375;YI SYLLABLE CHUR;Lo;0;L;;;;;N;;;;; +A376;YI SYLLABLE CHYT;Lo;0;L;;;;;N;;;;; +A377;YI SYLLABLE CHYX;Lo;0;L;;;;;N;;;;; +A378;YI SYLLABLE CHY;Lo;0;L;;;;;N;;;;; +A379;YI SYLLABLE CHYP;Lo;0;L;;;;;N;;;;; +A37A;YI SYLLABLE CHYRX;Lo;0;L;;;;;N;;;;; +A37B;YI SYLLABLE CHYR;Lo;0;L;;;;;N;;;;; +A37C;YI SYLLABLE RRAX;Lo;0;L;;;;;N;;;;; +A37D;YI SYLLABLE RRA;Lo;0;L;;;;;N;;;;; +A37E;YI SYLLABLE RRUOX;Lo;0;L;;;;;N;;;;; +A37F;YI SYLLABLE RRUO;Lo;0;L;;;;;N;;;;; +A380;YI SYLLABLE RROT;Lo;0;L;;;;;N;;;;; +A381;YI SYLLABLE RROX;Lo;0;L;;;;;N;;;;; +A382;YI SYLLABLE RRO;Lo;0;L;;;;;N;;;;; +A383;YI SYLLABLE RROP;Lo;0;L;;;;;N;;;;; +A384;YI SYLLABLE RRET;Lo;0;L;;;;;N;;;;; +A385;YI SYLLABLE RREX;Lo;0;L;;;;;N;;;;; +A386;YI SYLLABLE RRE;Lo;0;L;;;;;N;;;;; +A387;YI SYLLABLE RREP;Lo;0;L;;;;;N;;;;; +A388;YI SYLLABLE RRUT;Lo;0;L;;;;;N;;;;; +A389;YI SYLLABLE RRUX;Lo;0;L;;;;;N;;;;; +A38A;YI SYLLABLE RRU;Lo;0;L;;;;;N;;;;; +A38B;YI SYLLABLE RRUP;Lo;0;L;;;;;N;;;;; +A38C;YI SYLLABLE RRURX;Lo;0;L;;;;;N;;;;; +A38D;YI SYLLABLE RRUR;Lo;0;L;;;;;N;;;;; +A38E;YI SYLLABLE RRYT;Lo;0;L;;;;;N;;;;; +A38F;YI SYLLABLE RRYX;Lo;0;L;;;;;N;;;;; +A390;YI SYLLABLE RRY;Lo;0;L;;;;;N;;;;; +A391;YI SYLLABLE RRYP;Lo;0;L;;;;;N;;;;; +A392;YI SYLLABLE RRYRX;Lo;0;L;;;;;N;;;;; +A393;YI SYLLABLE RRYR;Lo;0;L;;;;;N;;;;; +A394;YI SYLLABLE NRAT;Lo;0;L;;;;;N;;;;; +A395;YI SYLLABLE NRAX;Lo;0;L;;;;;N;;;;; +A396;YI SYLLABLE NRA;Lo;0;L;;;;;N;;;;; +A397;YI SYLLABLE NRAP;Lo;0;L;;;;;N;;;;; +A398;YI SYLLABLE NROX;Lo;0;L;;;;;N;;;;; +A399;YI SYLLABLE NRO;Lo;0;L;;;;;N;;;;; +A39A;YI SYLLABLE NROP;Lo;0;L;;;;;N;;;;; +A39B;YI SYLLABLE NRET;Lo;0;L;;;;;N;;;;; +A39C;YI SYLLABLE NREX;Lo;0;L;;;;;N;;;;; +A39D;YI SYLLABLE NRE;Lo;0;L;;;;;N;;;;; +A39E;YI SYLLABLE NREP;Lo;0;L;;;;;N;;;;; +A39F;YI SYLLABLE NRUT;Lo;0;L;;;;;N;;;;; +A3A0;YI SYLLABLE NRUX;Lo;0;L;;;;;N;;;;; +A3A1;YI SYLLABLE NRU;Lo;0;L;;;;;N;;;;; +A3A2;YI SYLLABLE NRUP;Lo;0;L;;;;;N;;;;; +A3A3;YI SYLLABLE NRURX;Lo;0;L;;;;;N;;;;; +A3A4;YI SYLLABLE NRUR;Lo;0;L;;;;;N;;;;; +A3A5;YI SYLLABLE NRYT;Lo;0;L;;;;;N;;;;; +A3A6;YI SYLLABLE NRYX;Lo;0;L;;;;;N;;;;; +A3A7;YI SYLLABLE NRY;Lo;0;L;;;;;N;;;;; +A3A8;YI SYLLABLE NRYP;Lo;0;L;;;;;N;;;;; +A3A9;YI SYLLABLE NRYRX;Lo;0;L;;;;;N;;;;; +A3AA;YI SYLLABLE NRYR;Lo;0;L;;;;;N;;;;; +A3AB;YI SYLLABLE SHAT;Lo;0;L;;;;;N;;;;; +A3AC;YI SYLLABLE SHAX;Lo;0;L;;;;;N;;;;; +A3AD;YI SYLLABLE SHA;Lo;0;L;;;;;N;;;;; +A3AE;YI SYLLABLE SHAP;Lo;0;L;;;;;N;;;;; +A3AF;YI SYLLABLE SHUOX;Lo;0;L;;;;;N;;;;; +A3B0;YI SYLLABLE SHUO;Lo;0;L;;;;;N;;;;; +A3B1;YI SYLLABLE SHUOP;Lo;0;L;;;;;N;;;;; +A3B2;YI SYLLABLE SHOT;Lo;0;L;;;;;N;;;;; +A3B3;YI SYLLABLE SHOX;Lo;0;L;;;;;N;;;;; +A3B4;YI SYLLABLE SHO;Lo;0;L;;;;;N;;;;; +A3B5;YI SYLLABLE SHOP;Lo;0;L;;;;;N;;;;; +A3B6;YI SYLLABLE SHET;Lo;0;L;;;;;N;;;;; +A3B7;YI SYLLABLE SHEX;Lo;0;L;;;;;N;;;;; +A3B8;YI SYLLABLE SHE;Lo;0;L;;;;;N;;;;; +A3B9;YI SYLLABLE SHEP;Lo;0;L;;;;;N;;;;; +A3BA;YI SYLLABLE SHUT;Lo;0;L;;;;;N;;;;; +A3BB;YI SYLLABLE SHUX;Lo;0;L;;;;;N;;;;; +A3BC;YI SYLLABLE SHU;Lo;0;L;;;;;N;;;;; +A3BD;YI SYLLABLE SHUP;Lo;0;L;;;;;N;;;;; +A3BE;YI SYLLABLE SHURX;Lo;0;L;;;;;N;;;;; +A3BF;YI SYLLABLE SHUR;Lo;0;L;;;;;N;;;;; +A3C0;YI SYLLABLE SHYT;Lo;0;L;;;;;N;;;;; +A3C1;YI SYLLABLE SHYX;Lo;0;L;;;;;N;;;;; +A3C2;YI SYLLABLE SHY;Lo;0;L;;;;;N;;;;; +A3C3;YI SYLLABLE SHYP;Lo;0;L;;;;;N;;;;; +A3C4;YI SYLLABLE SHYRX;Lo;0;L;;;;;N;;;;; +A3C5;YI SYLLABLE SHYR;Lo;0;L;;;;;N;;;;; +A3C6;YI SYLLABLE RAT;Lo;0;L;;;;;N;;;;; +A3C7;YI SYLLABLE RAX;Lo;0;L;;;;;N;;;;; +A3C8;YI SYLLABLE RA;Lo;0;L;;;;;N;;;;; +A3C9;YI SYLLABLE RAP;Lo;0;L;;;;;N;;;;; +A3CA;YI SYLLABLE RUOX;Lo;0;L;;;;;N;;;;; +A3CB;YI SYLLABLE RUO;Lo;0;L;;;;;N;;;;; +A3CC;YI SYLLABLE RUOP;Lo;0;L;;;;;N;;;;; +A3CD;YI SYLLABLE ROT;Lo;0;L;;;;;N;;;;; +A3CE;YI SYLLABLE ROX;Lo;0;L;;;;;N;;;;; +A3CF;YI SYLLABLE RO;Lo;0;L;;;;;N;;;;; +A3D0;YI SYLLABLE ROP;Lo;0;L;;;;;N;;;;; +A3D1;YI SYLLABLE REX;Lo;0;L;;;;;N;;;;; +A3D2;YI SYLLABLE RE;Lo;0;L;;;;;N;;;;; +A3D3;YI SYLLABLE REP;Lo;0;L;;;;;N;;;;; +A3D4;YI SYLLABLE RUT;Lo;0;L;;;;;N;;;;; +A3D5;YI SYLLABLE RUX;Lo;0;L;;;;;N;;;;; +A3D6;YI SYLLABLE RU;Lo;0;L;;;;;N;;;;; +A3D7;YI SYLLABLE RUP;Lo;0;L;;;;;N;;;;; +A3D8;YI SYLLABLE RURX;Lo;0;L;;;;;N;;;;; +A3D9;YI SYLLABLE RUR;Lo;0;L;;;;;N;;;;; +A3DA;YI SYLLABLE RYT;Lo;0;L;;;;;N;;;;; +A3DB;YI SYLLABLE RYX;Lo;0;L;;;;;N;;;;; +A3DC;YI SYLLABLE RY;Lo;0;L;;;;;N;;;;; +A3DD;YI SYLLABLE RYP;Lo;0;L;;;;;N;;;;; +A3DE;YI SYLLABLE RYRX;Lo;0;L;;;;;N;;;;; +A3DF;YI SYLLABLE RYR;Lo;0;L;;;;;N;;;;; +A3E0;YI SYLLABLE JIT;Lo;0;L;;;;;N;;;;; +A3E1;YI SYLLABLE JIX;Lo;0;L;;;;;N;;;;; +A3E2;YI SYLLABLE JI;Lo;0;L;;;;;N;;;;; +A3E3;YI SYLLABLE JIP;Lo;0;L;;;;;N;;;;; +A3E4;YI SYLLABLE JIET;Lo;0;L;;;;;N;;;;; +A3E5;YI SYLLABLE JIEX;Lo;0;L;;;;;N;;;;; +A3E6;YI SYLLABLE JIE;Lo;0;L;;;;;N;;;;; +A3E7;YI SYLLABLE JIEP;Lo;0;L;;;;;N;;;;; +A3E8;YI SYLLABLE JUOT;Lo;0;L;;;;;N;;;;; +A3E9;YI SYLLABLE JUOX;Lo;0;L;;;;;N;;;;; +A3EA;YI SYLLABLE JUO;Lo;0;L;;;;;N;;;;; +A3EB;YI SYLLABLE JUOP;Lo;0;L;;;;;N;;;;; +A3EC;YI SYLLABLE JOT;Lo;0;L;;;;;N;;;;; +A3ED;YI SYLLABLE JOX;Lo;0;L;;;;;N;;;;; +A3EE;YI SYLLABLE JO;Lo;0;L;;;;;N;;;;; +A3EF;YI SYLLABLE JOP;Lo;0;L;;;;;N;;;;; +A3F0;YI SYLLABLE JUT;Lo;0;L;;;;;N;;;;; +A3F1;YI SYLLABLE JUX;Lo;0;L;;;;;N;;;;; +A3F2;YI SYLLABLE JU;Lo;0;L;;;;;N;;;;; +A3F3;YI SYLLABLE JUP;Lo;0;L;;;;;N;;;;; +A3F4;YI SYLLABLE JURX;Lo;0;L;;;;;N;;;;; +A3F5;YI SYLLABLE JUR;Lo;0;L;;;;;N;;;;; +A3F6;YI SYLLABLE JYT;Lo;0;L;;;;;N;;;;; +A3F7;YI SYLLABLE JYX;Lo;0;L;;;;;N;;;;; +A3F8;YI SYLLABLE JY;Lo;0;L;;;;;N;;;;; +A3F9;YI SYLLABLE JYP;Lo;0;L;;;;;N;;;;; +A3FA;YI SYLLABLE JYRX;Lo;0;L;;;;;N;;;;; +A3FB;YI SYLLABLE JYR;Lo;0;L;;;;;N;;;;; +A3FC;YI SYLLABLE QIT;Lo;0;L;;;;;N;;;;; +A3FD;YI SYLLABLE QIX;Lo;0;L;;;;;N;;;;; +A3FE;YI SYLLABLE QI;Lo;0;L;;;;;N;;;;; +A3FF;YI SYLLABLE QIP;Lo;0;L;;;;;N;;;;; +A400;YI SYLLABLE QIET;Lo;0;L;;;;;N;;;;; +A401;YI SYLLABLE QIEX;Lo;0;L;;;;;N;;;;; +A402;YI SYLLABLE QIE;Lo;0;L;;;;;N;;;;; +A403;YI SYLLABLE QIEP;Lo;0;L;;;;;N;;;;; +A404;YI SYLLABLE QUOT;Lo;0;L;;;;;N;;;;; +A405;YI SYLLABLE QUOX;Lo;0;L;;;;;N;;;;; +A406;YI SYLLABLE QUO;Lo;0;L;;;;;N;;;;; +A407;YI SYLLABLE QUOP;Lo;0;L;;;;;N;;;;; +A408;YI SYLLABLE QOT;Lo;0;L;;;;;N;;;;; +A409;YI SYLLABLE QOX;Lo;0;L;;;;;N;;;;; +A40A;YI SYLLABLE QO;Lo;0;L;;;;;N;;;;; +A40B;YI SYLLABLE QOP;Lo;0;L;;;;;N;;;;; +A40C;YI SYLLABLE QUT;Lo;0;L;;;;;N;;;;; +A40D;YI SYLLABLE QUX;Lo;0;L;;;;;N;;;;; +A40E;YI SYLLABLE QU;Lo;0;L;;;;;N;;;;; +A40F;YI SYLLABLE QUP;Lo;0;L;;;;;N;;;;; +A410;YI SYLLABLE QURX;Lo;0;L;;;;;N;;;;; +A411;YI SYLLABLE QUR;Lo;0;L;;;;;N;;;;; +A412;YI SYLLABLE QYT;Lo;0;L;;;;;N;;;;; +A413;YI SYLLABLE QYX;Lo;0;L;;;;;N;;;;; +A414;YI SYLLABLE QY;Lo;0;L;;;;;N;;;;; +A415;YI SYLLABLE QYP;Lo;0;L;;;;;N;;;;; +A416;YI SYLLABLE QYRX;Lo;0;L;;;;;N;;;;; +A417;YI SYLLABLE QYR;Lo;0;L;;;;;N;;;;; +A418;YI SYLLABLE JJIT;Lo;0;L;;;;;N;;;;; +A419;YI SYLLABLE JJIX;Lo;0;L;;;;;N;;;;; +A41A;YI SYLLABLE JJI;Lo;0;L;;;;;N;;;;; +A41B;YI SYLLABLE JJIP;Lo;0;L;;;;;N;;;;; +A41C;YI SYLLABLE JJIET;Lo;0;L;;;;;N;;;;; +A41D;YI SYLLABLE JJIEX;Lo;0;L;;;;;N;;;;; +A41E;YI SYLLABLE JJIE;Lo;0;L;;;;;N;;;;; +A41F;YI SYLLABLE JJIEP;Lo;0;L;;;;;N;;;;; +A420;YI SYLLABLE JJUOX;Lo;0;L;;;;;N;;;;; +A421;YI SYLLABLE JJUO;Lo;0;L;;;;;N;;;;; +A422;YI SYLLABLE JJUOP;Lo;0;L;;;;;N;;;;; +A423;YI SYLLABLE JJOT;Lo;0;L;;;;;N;;;;; +A424;YI SYLLABLE JJOX;Lo;0;L;;;;;N;;;;; +A425;YI SYLLABLE JJO;Lo;0;L;;;;;N;;;;; +A426;YI SYLLABLE JJOP;Lo;0;L;;;;;N;;;;; +A427;YI SYLLABLE JJUT;Lo;0;L;;;;;N;;;;; +A428;YI SYLLABLE JJUX;Lo;0;L;;;;;N;;;;; +A429;YI SYLLABLE JJU;Lo;0;L;;;;;N;;;;; +A42A;YI SYLLABLE JJUP;Lo;0;L;;;;;N;;;;; +A42B;YI SYLLABLE JJURX;Lo;0;L;;;;;N;;;;; +A42C;YI SYLLABLE JJUR;Lo;0;L;;;;;N;;;;; +A42D;YI SYLLABLE JJYT;Lo;0;L;;;;;N;;;;; +A42E;YI SYLLABLE JJYX;Lo;0;L;;;;;N;;;;; +A42F;YI SYLLABLE JJY;Lo;0;L;;;;;N;;;;; +A430;YI SYLLABLE JJYP;Lo;0;L;;;;;N;;;;; +A431;YI SYLLABLE NJIT;Lo;0;L;;;;;N;;;;; +A432;YI SYLLABLE NJIX;Lo;0;L;;;;;N;;;;; +A433;YI SYLLABLE NJI;Lo;0;L;;;;;N;;;;; +A434;YI SYLLABLE NJIP;Lo;0;L;;;;;N;;;;; +A435;YI SYLLABLE NJIET;Lo;0;L;;;;;N;;;;; +A436;YI SYLLABLE NJIEX;Lo;0;L;;;;;N;;;;; +A437;YI SYLLABLE NJIE;Lo;0;L;;;;;N;;;;; +A438;YI SYLLABLE NJIEP;Lo;0;L;;;;;N;;;;; +A439;YI SYLLABLE NJUOX;Lo;0;L;;;;;N;;;;; +A43A;YI SYLLABLE NJUO;Lo;0;L;;;;;N;;;;; +A43B;YI SYLLABLE NJOT;Lo;0;L;;;;;N;;;;; +A43C;YI SYLLABLE NJOX;Lo;0;L;;;;;N;;;;; +A43D;YI SYLLABLE NJO;Lo;0;L;;;;;N;;;;; +A43E;YI SYLLABLE NJOP;Lo;0;L;;;;;N;;;;; +A43F;YI SYLLABLE NJUX;Lo;0;L;;;;;N;;;;; +A440;YI SYLLABLE NJU;Lo;0;L;;;;;N;;;;; +A441;YI SYLLABLE NJUP;Lo;0;L;;;;;N;;;;; +A442;YI SYLLABLE NJURX;Lo;0;L;;;;;N;;;;; +A443;YI SYLLABLE NJUR;Lo;0;L;;;;;N;;;;; +A444;YI SYLLABLE NJYT;Lo;0;L;;;;;N;;;;; +A445;YI SYLLABLE NJYX;Lo;0;L;;;;;N;;;;; +A446;YI SYLLABLE NJY;Lo;0;L;;;;;N;;;;; +A447;YI SYLLABLE NJYP;Lo;0;L;;;;;N;;;;; +A448;YI SYLLABLE NJYRX;Lo;0;L;;;;;N;;;;; +A449;YI SYLLABLE NJYR;Lo;0;L;;;;;N;;;;; +A44A;YI SYLLABLE NYIT;Lo;0;L;;;;;N;;;;; +A44B;YI SYLLABLE NYIX;Lo;0;L;;;;;N;;;;; +A44C;YI SYLLABLE NYI;Lo;0;L;;;;;N;;;;; +A44D;YI SYLLABLE NYIP;Lo;0;L;;;;;N;;;;; +A44E;YI SYLLABLE NYIET;Lo;0;L;;;;;N;;;;; +A44F;YI SYLLABLE NYIEX;Lo;0;L;;;;;N;;;;; +A450;YI SYLLABLE NYIE;Lo;0;L;;;;;N;;;;; +A451;YI SYLLABLE NYIEP;Lo;0;L;;;;;N;;;;; +A452;YI SYLLABLE NYUOX;Lo;0;L;;;;;N;;;;; +A453;YI SYLLABLE NYUO;Lo;0;L;;;;;N;;;;; +A454;YI SYLLABLE NYUOP;Lo;0;L;;;;;N;;;;; +A455;YI SYLLABLE NYOT;Lo;0;L;;;;;N;;;;; +A456;YI SYLLABLE NYOX;Lo;0;L;;;;;N;;;;; +A457;YI SYLLABLE NYO;Lo;0;L;;;;;N;;;;; +A458;YI SYLLABLE NYOP;Lo;0;L;;;;;N;;;;; +A459;YI SYLLABLE NYUT;Lo;0;L;;;;;N;;;;; +A45A;YI SYLLABLE NYUX;Lo;0;L;;;;;N;;;;; +A45B;YI SYLLABLE NYU;Lo;0;L;;;;;N;;;;; +A45C;YI SYLLABLE NYUP;Lo;0;L;;;;;N;;;;; +A45D;YI SYLLABLE XIT;Lo;0;L;;;;;N;;;;; +A45E;YI SYLLABLE XIX;Lo;0;L;;;;;N;;;;; +A45F;YI SYLLABLE XI;Lo;0;L;;;;;N;;;;; +A460;YI SYLLABLE XIP;Lo;0;L;;;;;N;;;;; +A461;YI SYLLABLE XIET;Lo;0;L;;;;;N;;;;; +A462;YI SYLLABLE XIEX;Lo;0;L;;;;;N;;;;; +A463;YI SYLLABLE XIE;Lo;0;L;;;;;N;;;;; +A464;YI SYLLABLE XIEP;Lo;0;L;;;;;N;;;;; +A465;YI SYLLABLE XUOX;Lo;0;L;;;;;N;;;;; +A466;YI SYLLABLE XUO;Lo;0;L;;;;;N;;;;; +A467;YI SYLLABLE XOT;Lo;0;L;;;;;N;;;;; +A468;YI SYLLABLE XOX;Lo;0;L;;;;;N;;;;; +A469;YI SYLLABLE XO;Lo;0;L;;;;;N;;;;; +A46A;YI SYLLABLE XOP;Lo;0;L;;;;;N;;;;; +A46B;YI SYLLABLE XYT;Lo;0;L;;;;;N;;;;; +A46C;YI SYLLABLE XYX;Lo;0;L;;;;;N;;;;; +A46D;YI SYLLABLE XY;Lo;0;L;;;;;N;;;;; +A46E;YI SYLLABLE XYP;Lo;0;L;;;;;N;;;;; +A46F;YI SYLLABLE XYRX;Lo;0;L;;;;;N;;;;; +A470;YI SYLLABLE XYR;Lo;0;L;;;;;N;;;;; +A471;YI SYLLABLE YIT;Lo;0;L;;;;;N;;;;; +A472;YI SYLLABLE YIX;Lo;0;L;;;;;N;;;;; +A473;YI SYLLABLE YI;Lo;0;L;;;;;N;;;;; +A474;YI SYLLABLE YIP;Lo;0;L;;;;;N;;;;; +A475;YI SYLLABLE YIET;Lo;0;L;;;;;N;;;;; +A476;YI SYLLABLE YIEX;Lo;0;L;;;;;N;;;;; +A477;YI SYLLABLE YIE;Lo;0;L;;;;;N;;;;; +A478;YI SYLLABLE YIEP;Lo;0;L;;;;;N;;;;; +A479;YI SYLLABLE YUOT;Lo;0;L;;;;;N;;;;; +A47A;YI SYLLABLE YUOX;Lo;0;L;;;;;N;;;;; +A47B;YI SYLLABLE YUO;Lo;0;L;;;;;N;;;;; +A47C;YI SYLLABLE YUOP;Lo;0;L;;;;;N;;;;; +A47D;YI SYLLABLE YOT;Lo;0;L;;;;;N;;;;; +A47E;YI SYLLABLE YOX;Lo;0;L;;;;;N;;;;; +A47F;YI SYLLABLE YO;Lo;0;L;;;;;N;;;;; +A480;YI SYLLABLE YOP;Lo;0;L;;;;;N;;;;; +A481;YI SYLLABLE YUT;Lo;0;L;;;;;N;;;;; +A482;YI SYLLABLE YUX;Lo;0;L;;;;;N;;;;; +A483;YI SYLLABLE YU;Lo;0;L;;;;;N;;;;; +A484;YI SYLLABLE YUP;Lo;0;L;;;;;N;;;;; +A485;YI SYLLABLE YURX;Lo;0;L;;;;;N;;;;; +A486;YI SYLLABLE YUR;Lo;0;L;;;;;N;;;;; +A487;YI SYLLABLE YYT;Lo;0;L;;;;;N;;;;; +A488;YI SYLLABLE YYX;Lo;0;L;;;;;N;;;;; +A489;YI SYLLABLE YY;Lo;0;L;;;;;N;;;;; +A48A;YI SYLLABLE YYP;Lo;0;L;;;;;N;;;;; +A48B;YI SYLLABLE YYRX;Lo;0;L;;;;;N;;;;; +A48C;YI SYLLABLE YYR;Lo;0;L;;;;;N;;;;; +A490;YI RADICAL QOT;So;0;ON;;;;;N;;;;; +A491;YI RADICAL LI;So;0;ON;;;;;N;;;;; +A492;YI RADICAL KIT;So;0;ON;;;;;N;;;;; +A493;YI RADICAL NYIP;So;0;ON;;;;;N;;;;; +A494;YI RADICAL CYP;So;0;ON;;;;;N;;;;; +A495;YI RADICAL SSI;So;0;ON;;;;;N;;;;; +A496;YI RADICAL GGOP;So;0;ON;;;;;N;;;;; +A497;YI RADICAL GEP;So;0;ON;;;;;N;;;;; +A498;YI RADICAL MI;So;0;ON;;;;;N;;;;; +A499;YI RADICAL HXIT;So;0;ON;;;;;N;;;;; +A49A;YI RADICAL LYR;So;0;ON;;;;;N;;;;; +A49B;YI RADICAL BBUT;So;0;ON;;;;;N;;;;; +A49C;YI RADICAL MOP;So;0;ON;;;;;N;;;;; +A49D;YI RADICAL YO;So;0;ON;;;;;N;;;;; +A49E;YI RADICAL PUT;So;0;ON;;;;;N;;;;; +A49F;YI RADICAL HXUO;So;0;ON;;;;;N;;;;; +A4A0;YI RADICAL TAT;So;0;ON;;;;;N;;;;; +A4A1;YI RADICAL GA;So;0;ON;;;;;N;;;;; +A4A2;YI RADICAL ZUP;So;0;ON;;;;;N;;;;; +A4A3;YI RADICAL CYT;So;0;ON;;;;;N;;;;; +A4A4;YI RADICAL DDUR;So;0;ON;;;;;N;;;;; +A4A5;YI RADICAL BUR;So;0;ON;;;;;N;;;;; +A4A6;YI RADICAL GGUO;So;0;ON;;;;;N;;;;; +A4A7;YI RADICAL NYOP;So;0;ON;;;;;N;;;;; +A4A8;YI RADICAL TU;So;0;ON;;;;;N;;;;; +A4A9;YI RADICAL OP;So;0;ON;;;;;N;;;;; +A4AA;YI RADICAL JJUT;So;0;ON;;;;;N;;;;; +A4AB;YI RADICAL ZOT;So;0;ON;;;;;N;;;;; +A4AC;YI RADICAL PYT;So;0;ON;;;;;N;;;;; +A4AD;YI RADICAL HMO;So;0;ON;;;;;N;;;;; +A4AE;YI RADICAL YIT;So;0;ON;;;;;N;;;;; +A4AF;YI RADICAL VUR;So;0;ON;;;;;N;;;;; +A4B0;YI RADICAL SHY;So;0;ON;;;;;N;;;;; +A4B1;YI RADICAL VEP;So;0;ON;;;;;N;;;;; +A4B2;YI RADICAL ZA;So;0;ON;;;;;N;;;;; +A4B3;YI RADICAL JO;So;0;ON;;;;;N;;;;; +A4B4;YI RADICAL NZUP;So;0;ON;;;;;N;;;;; +A4B5;YI RADICAL JJY;So;0;ON;;;;;N;;;;; +A4B6;YI RADICAL GOT;So;0;ON;;;;;N;;;;; +A4B7;YI RADICAL JJIE;So;0;ON;;;;;N;;;;; +A4B8;YI RADICAL WO;So;0;ON;;;;;N;;;;; +A4B9;YI RADICAL DU;So;0;ON;;;;;N;;;;; +A4BA;YI RADICAL SHUR;So;0;ON;;;;;N;;;;; +A4BB;YI RADICAL LIE;So;0;ON;;;;;N;;;;; +A4BC;YI RADICAL CY;So;0;ON;;;;;N;;;;; +A4BD;YI RADICAL CUOP;So;0;ON;;;;;N;;;;; +A4BE;YI RADICAL CIP;So;0;ON;;;;;N;;;;; +A4BF;YI RADICAL HXOP;So;0;ON;;;;;N;;;;; +A4C0;YI RADICAL SHAT;So;0;ON;;;;;N;;;;; +A4C1;YI RADICAL ZUR;So;0;ON;;;;;N;;;;; +A4C2;YI RADICAL SHOP;So;0;ON;;;;;N;;;;; +A4C3;YI RADICAL CHE;So;0;ON;;;;;N;;;;; +A4C4;YI RADICAL ZZIET;So;0;ON;;;;;N;;;;; +A4C5;YI RADICAL NBIE;So;0;ON;;;;;N;;;;; +A4C6;YI RADICAL KE;So;0;ON;;;;;N;;;;; +A4D0;LISU LETTER BA;Lo;0;L;;;;;N;;;;; +A4D1;LISU LETTER PA;Lo;0;L;;;;;N;;;;; +A4D2;LISU LETTER PHA;Lo;0;L;;;;;N;;;;; +A4D3;LISU LETTER DA;Lo;0;L;;;;;N;;;;; +A4D4;LISU LETTER TA;Lo;0;L;;;;;N;;;;; +A4D5;LISU LETTER THA;Lo;0;L;;;;;N;;;;; +A4D6;LISU LETTER GA;Lo;0;L;;;;;N;;;;; +A4D7;LISU LETTER KA;Lo;0;L;;;;;N;;;;; +A4D8;LISU LETTER KHA;Lo;0;L;;;;;N;;;;; +A4D9;LISU LETTER JA;Lo;0;L;;;;;N;;;;; +A4DA;LISU LETTER CA;Lo;0;L;;;;;N;;;;; +A4DB;LISU LETTER CHA;Lo;0;L;;;;;N;;;;; +A4DC;LISU LETTER DZA;Lo;0;L;;;;;N;;;;; +A4DD;LISU LETTER TSA;Lo;0;L;;;;;N;;;;; +A4DE;LISU LETTER TSHA;Lo;0;L;;;;;N;;;;; +A4DF;LISU LETTER MA;Lo;0;L;;;;;N;;;;; +A4E0;LISU LETTER NA;Lo;0;L;;;;;N;;;;; +A4E1;LISU LETTER LA;Lo;0;L;;;;;N;;;;; +A4E2;LISU LETTER SA;Lo;0;L;;;;;N;;;;; +A4E3;LISU LETTER ZHA;Lo;0;L;;;;;N;;;;; +A4E4;LISU LETTER ZA;Lo;0;L;;;;;N;;;;; +A4E5;LISU LETTER NGA;Lo;0;L;;;;;N;;;;; +A4E6;LISU LETTER HA;Lo;0;L;;;;;N;;;;; +A4E7;LISU LETTER XA;Lo;0;L;;;;;N;;;;; +A4E8;LISU LETTER HHA;Lo;0;L;;;;;N;;;;; +A4E9;LISU LETTER FA;Lo;0;L;;;;;N;;;;; +A4EA;LISU LETTER WA;Lo;0;L;;;;;N;;;;; +A4EB;LISU LETTER SHA;Lo;0;L;;;;;N;;;;; +A4EC;LISU LETTER YA;Lo;0;L;;;;;N;;;;; +A4ED;LISU LETTER GHA;Lo;0;L;;;;;N;;;;; +A4EE;LISU LETTER A;Lo;0;L;;;;;N;;;;; +A4EF;LISU LETTER AE;Lo;0;L;;;;;N;;;;; +A4F0;LISU LETTER E;Lo;0;L;;;;;N;;;;; +A4F1;LISU LETTER EU;Lo;0;L;;;;;N;;;;; +A4F2;LISU LETTER I;Lo;0;L;;;;;N;;;;; +A4F3;LISU LETTER O;Lo;0;L;;;;;N;;;;; +A4F4;LISU LETTER U;Lo;0;L;;;;;N;;;;; +A4F5;LISU LETTER UE;Lo;0;L;;;;;N;;;;; +A4F6;LISU LETTER UH;Lo;0;L;;;;;N;;;;; +A4F7;LISU LETTER OE;Lo;0;L;;;;;N;;;;; +A4F8;LISU LETTER TONE MYA TI;Lm;0;L;;;;;N;;;;; +A4F9;LISU LETTER TONE NA PO;Lm;0;L;;;;;N;;;;; +A4FA;LISU LETTER TONE MYA CYA;Lm;0;L;;;;;N;;;;; +A4FB;LISU LETTER TONE MYA BO;Lm;0;L;;;;;N;;;;; +A4FC;LISU LETTER TONE MYA NA;Lm;0;L;;;;;N;;;;; +A4FD;LISU LETTER TONE MYA JEU;Lm;0;L;;;;;N;;;;; +A4FE;LISU PUNCTUATION COMMA;Po;0;L;;;;;N;;;;; +A4FF;LISU PUNCTUATION FULL STOP;Po;0;L;;;;;N;;;;; +A500;VAI SYLLABLE EE;Lo;0;L;;;;;N;;;;; +A501;VAI SYLLABLE EEN;Lo;0;L;;;;;N;;;;; +A502;VAI SYLLABLE HEE;Lo;0;L;;;;;N;;;;; +A503;VAI SYLLABLE WEE;Lo;0;L;;;;;N;;;;; +A504;VAI SYLLABLE WEEN;Lo;0;L;;;;;N;;;;; +A505;VAI SYLLABLE PEE;Lo;0;L;;;;;N;;;;; +A506;VAI SYLLABLE BHEE;Lo;0;L;;;;;N;;;;; +A507;VAI SYLLABLE BEE;Lo;0;L;;;;;N;;;;; +A508;VAI SYLLABLE MBEE;Lo;0;L;;;;;N;;;;; +A509;VAI SYLLABLE KPEE;Lo;0;L;;;;;N;;;;; +A50A;VAI SYLLABLE MGBEE;Lo;0;L;;;;;N;;;;; +A50B;VAI SYLLABLE GBEE;Lo;0;L;;;;;N;;;;; +A50C;VAI SYLLABLE FEE;Lo;0;L;;;;;N;;;;; +A50D;VAI SYLLABLE VEE;Lo;0;L;;;;;N;;;;; +A50E;VAI SYLLABLE TEE;Lo;0;L;;;;;N;;;;; +A50F;VAI SYLLABLE THEE;Lo;0;L;;;;;N;;;;; +A510;VAI SYLLABLE DHEE;Lo;0;L;;;;;N;;;;; +A511;VAI SYLLABLE DHHEE;Lo;0;L;;;;;N;;;;; +A512;VAI SYLLABLE LEE;Lo;0;L;;;;;N;;;;; +A513;VAI SYLLABLE REE;Lo;0;L;;;;;N;;;;; +A514;VAI SYLLABLE DEE;Lo;0;L;;;;;N;;;;; +A515;VAI SYLLABLE NDEE;Lo;0;L;;;;;N;;;;; +A516;VAI SYLLABLE SEE;Lo;0;L;;;;;N;;;;; +A517;VAI SYLLABLE SHEE;Lo;0;L;;;;;N;;;;; +A518;VAI SYLLABLE ZEE;Lo;0;L;;;;;N;;;;; +A519;VAI SYLLABLE ZHEE;Lo;0;L;;;;;N;;;;; +A51A;VAI SYLLABLE CEE;Lo;0;L;;;;;N;;;;; +A51B;VAI SYLLABLE JEE;Lo;0;L;;;;;N;;;;; +A51C;VAI SYLLABLE NJEE;Lo;0;L;;;;;N;;;;; +A51D;VAI SYLLABLE YEE;Lo;0;L;;;;;N;;;;; +A51E;VAI SYLLABLE KEE;Lo;0;L;;;;;N;;;;; +A51F;VAI SYLLABLE NGGEE;Lo;0;L;;;;;N;;;;; +A520;VAI SYLLABLE GEE;Lo;0;L;;;;;N;;;;; +A521;VAI SYLLABLE MEE;Lo;0;L;;;;;N;;;;; +A522;VAI SYLLABLE NEE;Lo;0;L;;;;;N;;;;; +A523;VAI SYLLABLE NYEE;Lo;0;L;;;;;N;;;;; +A524;VAI SYLLABLE I;Lo;0;L;;;;;N;;;;; +A525;VAI SYLLABLE IN;Lo;0;L;;;;;N;;;;; +A526;VAI SYLLABLE HI;Lo;0;L;;;;;N;;;;; +A527;VAI SYLLABLE HIN;Lo;0;L;;;;;N;;;;; +A528;VAI SYLLABLE WI;Lo;0;L;;;;;N;;;;; +A529;VAI SYLLABLE WIN;Lo;0;L;;;;;N;;;;; +A52A;VAI SYLLABLE PI;Lo;0;L;;;;;N;;;;; +A52B;VAI SYLLABLE BHI;Lo;0;L;;;;;N;;;;; +A52C;VAI SYLLABLE BI;Lo;0;L;;;;;N;;;;; +A52D;VAI SYLLABLE MBI;Lo;0;L;;;;;N;;;;; +A52E;VAI SYLLABLE KPI;Lo;0;L;;;;;N;;;;; +A52F;VAI SYLLABLE MGBI;Lo;0;L;;;;;N;;;;; +A530;VAI SYLLABLE GBI;Lo;0;L;;;;;N;;;;; +A531;VAI SYLLABLE FI;Lo;0;L;;;;;N;;;;; +A532;VAI SYLLABLE VI;Lo;0;L;;;;;N;;;;; +A533;VAI SYLLABLE TI;Lo;0;L;;;;;N;;;;; +A534;VAI SYLLABLE THI;Lo;0;L;;;;;N;;;;; +A535;VAI SYLLABLE DHI;Lo;0;L;;;;;N;;;;; +A536;VAI SYLLABLE DHHI;Lo;0;L;;;;;N;;;;; +A537;VAI SYLLABLE LI;Lo;0;L;;;;;N;;;;; +A538;VAI SYLLABLE RI;Lo;0;L;;;;;N;;;;; +A539;VAI SYLLABLE DI;Lo;0;L;;;;;N;;;;; +A53A;VAI SYLLABLE NDI;Lo;0;L;;;;;N;;;;; +A53B;VAI SYLLABLE SI;Lo;0;L;;;;;N;;;;; +A53C;VAI SYLLABLE SHI;Lo;0;L;;;;;N;;;;; +A53D;VAI SYLLABLE ZI;Lo;0;L;;;;;N;;;;; +A53E;VAI SYLLABLE ZHI;Lo;0;L;;;;;N;;;;; +A53F;VAI SYLLABLE CI;Lo;0;L;;;;;N;;;;; +A540;VAI SYLLABLE JI;Lo;0;L;;;;;N;;;;; +A541;VAI SYLLABLE NJI;Lo;0;L;;;;;N;;;;; +A542;VAI SYLLABLE YI;Lo;0;L;;;;;N;;;;; +A543;VAI SYLLABLE KI;Lo;0;L;;;;;N;;;;; +A544;VAI SYLLABLE NGGI;Lo;0;L;;;;;N;;;;; +A545;VAI SYLLABLE GI;Lo;0;L;;;;;N;;;;; +A546;VAI SYLLABLE MI;Lo;0;L;;;;;N;;;;; +A547;VAI SYLLABLE NI;Lo;0;L;;;;;N;;;;; +A548;VAI SYLLABLE NYI;Lo;0;L;;;;;N;;;;; +A549;VAI SYLLABLE A;Lo;0;L;;;;;N;;;;; +A54A;VAI SYLLABLE AN;Lo;0;L;;;;;N;;;;; +A54B;VAI SYLLABLE NGAN;Lo;0;L;;;;;N;;;;; +A54C;VAI SYLLABLE HA;Lo;0;L;;;;;N;;;;; +A54D;VAI SYLLABLE HAN;Lo;0;L;;;;;N;;;;; +A54E;VAI SYLLABLE WA;Lo;0;L;;;;;N;;;;; +A54F;VAI SYLLABLE WAN;Lo;0;L;;;;;N;;;;; +A550;VAI SYLLABLE PA;Lo;0;L;;;;;N;;;;; +A551;VAI SYLLABLE BHA;Lo;0;L;;;;;N;;;;; +A552;VAI SYLLABLE BA;Lo;0;L;;;;;N;;;;; +A553;VAI SYLLABLE MBA;Lo;0;L;;;;;N;;;;; +A554;VAI SYLLABLE KPA;Lo;0;L;;;;;N;;;;; +A555;VAI SYLLABLE KPAN;Lo;0;L;;;;;N;;;;; +A556;VAI SYLLABLE MGBA;Lo;0;L;;;;;N;;;;; +A557;VAI SYLLABLE GBA;Lo;0;L;;;;;N;;;;; +A558;VAI SYLLABLE FA;Lo;0;L;;;;;N;;;;; +A559;VAI SYLLABLE VA;Lo;0;L;;;;;N;;;;; +A55A;VAI SYLLABLE TA;Lo;0;L;;;;;N;;;;; +A55B;VAI SYLLABLE THA;Lo;0;L;;;;;N;;;;; +A55C;VAI SYLLABLE DHA;Lo;0;L;;;;;N;;;;; +A55D;VAI SYLLABLE DHHA;Lo;0;L;;;;;N;;;;; +A55E;VAI SYLLABLE LA;Lo;0;L;;;;;N;;;;; +A55F;VAI SYLLABLE RA;Lo;0;L;;;;;N;;;;; +A560;VAI SYLLABLE DA;Lo;0;L;;;;;N;;;;; +A561;VAI SYLLABLE NDA;Lo;0;L;;;;;N;;;;; +A562;VAI SYLLABLE SA;Lo;0;L;;;;;N;;;;; +A563;VAI SYLLABLE SHA;Lo;0;L;;;;;N;;;;; +A564;VAI SYLLABLE ZA;Lo;0;L;;;;;N;;;;; +A565;VAI SYLLABLE ZHA;Lo;0;L;;;;;N;;;;; +A566;VAI SYLLABLE CA;Lo;0;L;;;;;N;;;;; +A567;VAI SYLLABLE JA;Lo;0;L;;;;;N;;;;; +A568;VAI SYLLABLE NJA;Lo;0;L;;;;;N;;;;; +A569;VAI SYLLABLE YA;Lo;0;L;;;;;N;;;;; +A56A;VAI SYLLABLE KA;Lo;0;L;;;;;N;;;;; +A56B;VAI SYLLABLE KAN;Lo;0;L;;;;;N;;;;; +A56C;VAI SYLLABLE NGGA;Lo;0;L;;;;;N;;;;; +A56D;VAI SYLLABLE GA;Lo;0;L;;;;;N;;;;; +A56E;VAI SYLLABLE MA;Lo;0;L;;;;;N;;;;; +A56F;VAI SYLLABLE NA;Lo;0;L;;;;;N;;;;; +A570;VAI SYLLABLE NYA;Lo;0;L;;;;;N;;;;; +A571;VAI SYLLABLE OO;Lo;0;L;;;;;N;;;;; +A572;VAI SYLLABLE OON;Lo;0;L;;;;;N;;;;; +A573;VAI SYLLABLE HOO;Lo;0;L;;;;;N;;;;; +A574;VAI SYLLABLE WOO;Lo;0;L;;;;;N;;;;; +A575;VAI SYLLABLE WOON;Lo;0;L;;;;;N;;;;; +A576;VAI SYLLABLE POO;Lo;0;L;;;;;N;;;;; +A577;VAI SYLLABLE BHOO;Lo;0;L;;;;;N;;;;; +A578;VAI SYLLABLE BOO;Lo;0;L;;;;;N;;;;; +A579;VAI SYLLABLE MBOO;Lo;0;L;;;;;N;;;;; +A57A;VAI SYLLABLE KPOO;Lo;0;L;;;;;N;;;;; +A57B;VAI SYLLABLE MGBOO;Lo;0;L;;;;;N;;;;; +A57C;VAI SYLLABLE GBOO;Lo;0;L;;;;;N;;;;; +A57D;VAI SYLLABLE FOO;Lo;0;L;;;;;N;;;;; +A57E;VAI SYLLABLE VOO;Lo;0;L;;;;;N;;;;; +A57F;VAI SYLLABLE TOO;Lo;0;L;;;;;N;;;;; +A580;VAI SYLLABLE THOO;Lo;0;L;;;;;N;;;;; +A581;VAI SYLLABLE DHOO;Lo;0;L;;;;;N;;;;; +A582;VAI SYLLABLE DHHOO;Lo;0;L;;;;;N;;;;; +A583;VAI SYLLABLE LOO;Lo;0;L;;;;;N;;;;; +A584;VAI SYLLABLE ROO;Lo;0;L;;;;;N;;;;; +A585;VAI SYLLABLE DOO;Lo;0;L;;;;;N;;;;; +A586;VAI SYLLABLE NDOO;Lo;0;L;;;;;N;;;;; +A587;VAI SYLLABLE SOO;Lo;0;L;;;;;N;;;;; +A588;VAI SYLLABLE SHOO;Lo;0;L;;;;;N;;;;; +A589;VAI SYLLABLE ZOO;Lo;0;L;;;;;N;;;;; +A58A;VAI SYLLABLE ZHOO;Lo;0;L;;;;;N;;;;; +A58B;VAI SYLLABLE COO;Lo;0;L;;;;;N;;;;; +A58C;VAI SYLLABLE JOO;Lo;0;L;;;;;N;;;;; +A58D;VAI SYLLABLE NJOO;Lo;0;L;;;;;N;;;;; +A58E;VAI SYLLABLE YOO;Lo;0;L;;;;;N;;;;; +A58F;VAI SYLLABLE KOO;Lo;0;L;;;;;N;;;;; +A590;VAI SYLLABLE NGGOO;Lo;0;L;;;;;N;;;;; +A591;VAI SYLLABLE GOO;Lo;0;L;;;;;N;;;;; +A592;VAI SYLLABLE MOO;Lo;0;L;;;;;N;;;;; +A593;VAI SYLLABLE NOO;Lo;0;L;;;;;N;;;;; +A594;VAI SYLLABLE NYOO;Lo;0;L;;;;;N;;;;; +A595;VAI SYLLABLE U;Lo;0;L;;;;;N;;;;; +A596;VAI SYLLABLE UN;Lo;0;L;;;;;N;;;;; +A597;VAI SYLLABLE HU;Lo;0;L;;;;;N;;;;; +A598;VAI SYLLABLE HUN;Lo;0;L;;;;;N;;;;; +A599;VAI SYLLABLE WU;Lo;0;L;;;;;N;;;;; +A59A;VAI SYLLABLE WUN;Lo;0;L;;;;;N;;;;; +A59B;VAI SYLLABLE PU;Lo;0;L;;;;;N;;;;; +A59C;VAI SYLLABLE BHU;Lo;0;L;;;;;N;;;;; +A59D;VAI SYLLABLE BU;Lo;0;L;;;;;N;;;;; +A59E;VAI SYLLABLE MBU;Lo;0;L;;;;;N;;;;; +A59F;VAI SYLLABLE KPU;Lo;0;L;;;;;N;;;;; +A5A0;VAI SYLLABLE MGBU;Lo;0;L;;;;;N;;;;; +A5A1;VAI SYLLABLE GBU;Lo;0;L;;;;;N;;;;; +A5A2;VAI SYLLABLE FU;Lo;0;L;;;;;N;;;;; +A5A3;VAI SYLLABLE VU;Lo;0;L;;;;;N;;;;; +A5A4;VAI SYLLABLE TU;Lo;0;L;;;;;N;;;;; +A5A5;VAI SYLLABLE THU;Lo;0;L;;;;;N;;;;; +A5A6;VAI SYLLABLE DHU;Lo;0;L;;;;;N;;;;; +A5A7;VAI SYLLABLE DHHU;Lo;0;L;;;;;N;;;;; +A5A8;VAI SYLLABLE LU;Lo;0;L;;;;;N;;;;; +A5A9;VAI SYLLABLE RU;Lo;0;L;;;;;N;;;;; +A5AA;VAI SYLLABLE DU;Lo;0;L;;;;;N;;;;; +A5AB;VAI SYLLABLE NDU;Lo;0;L;;;;;N;;;;; +A5AC;VAI SYLLABLE SU;Lo;0;L;;;;;N;;;;; +A5AD;VAI SYLLABLE SHU;Lo;0;L;;;;;N;;;;; +A5AE;VAI SYLLABLE ZU;Lo;0;L;;;;;N;;;;; +A5AF;VAI SYLLABLE ZHU;Lo;0;L;;;;;N;;;;; +A5B0;VAI SYLLABLE CU;Lo;0;L;;;;;N;;;;; +A5B1;VAI SYLLABLE JU;Lo;0;L;;;;;N;;;;; +A5B2;VAI SYLLABLE NJU;Lo;0;L;;;;;N;;;;; +A5B3;VAI SYLLABLE YU;Lo;0;L;;;;;N;;;;; +A5B4;VAI SYLLABLE KU;Lo;0;L;;;;;N;;;;; +A5B5;VAI SYLLABLE NGGU;Lo;0;L;;;;;N;;;;; +A5B6;VAI SYLLABLE GU;Lo;0;L;;;;;N;;;;; +A5B7;VAI SYLLABLE MU;Lo;0;L;;;;;N;;;;; +A5B8;VAI SYLLABLE NU;Lo;0;L;;;;;N;;;;; +A5B9;VAI SYLLABLE NYU;Lo;0;L;;;;;N;;;;; +A5BA;VAI SYLLABLE O;Lo;0;L;;;;;N;;;;; +A5BB;VAI SYLLABLE ON;Lo;0;L;;;;;N;;;;; +A5BC;VAI SYLLABLE NGON;Lo;0;L;;;;;N;;;;; +A5BD;VAI SYLLABLE HO;Lo;0;L;;;;;N;;;;; +A5BE;VAI SYLLABLE HON;Lo;0;L;;;;;N;;;;; +A5BF;VAI SYLLABLE WO;Lo;0;L;;;;;N;;;;; +A5C0;VAI SYLLABLE WON;Lo;0;L;;;;;N;;;;; +A5C1;VAI SYLLABLE PO;Lo;0;L;;;;;N;;;;; +A5C2;VAI SYLLABLE BHO;Lo;0;L;;;;;N;;;;; +A5C3;VAI SYLLABLE BO;Lo;0;L;;;;;N;;;;; +A5C4;VAI SYLLABLE MBO;Lo;0;L;;;;;N;;;;; +A5C5;VAI SYLLABLE KPO;Lo;0;L;;;;;N;;;;; +A5C6;VAI SYLLABLE MGBO;Lo;0;L;;;;;N;;;;; +A5C7;VAI SYLLABLE GBO;Lo;0;L;;;;;N;;;;; +A5C8;VAI SYLLABLE GBON;Lo;0;L;;;;;N;;;;; +A5C9;VAI SYLLABLE FO;Lo;0;L;;;;;N;;;;; +A5CA;VAI SYLLABLE VO;Lo;0;L;;;;;N;;;;; +A5CB;VAI SYLLABLE TO;Lo;0;L;;;;;N;;;;; +A5CC;VAI SYLLABLE THO;Lo;0;L;;;;;N;;;;; +A5CD;VAI SYLLABLE DHO;Lo;0;L;;;;;N;;;;; +A5CE;VAI SYLLABLE DHHO;Lo;0;L;;;;;N;;;;; +A5CF;VAI SYLLABLE LO;Lo;0;L;;;;;N;;;;; +A5D0;VAI SYLLABLE RO;Lo;0;L;;;;;N;;;;; +A5D1;VAI SYLLABLE DO;Lo;0;L;;;;;N;;;;; +A5D2;VAI SYLLABLE NDO;Lo;0;L;;;;;N;;;;; +A5D3;VAI SYLLABLE SO;Lo;0;L;;;;;N;;;;; +A5D4;VAI SYLLABLE SHO;Lo;0;L;;;;;N;;;;; +A5D5;VAI SYLLABLE ZO;Lo;0;L;;;;;N;;;;; +A5D6;VAI SYLLABLE ZHO;Lo;0;L;;;;;N;;;;; +A5D7;VAI SYLLABLE CO;Lo;0;L;;;;;N;;;;; +A5D8;VAI SYLLABLE JO;Lo;0;L;;;;;N;;;;; +A5D9;VAI SYLLABLE NJO;Lo;0;L;;;;;N;;;;; +A5DA;VAI SYLLABLE YO;Lo;0;L;;;;;N;;;;; +A5DB;VAI SYLLABLE KO;Lo;0;L;;;;;N;;;;; +A5DC;VAI SYLLABLE NGGO;Lo;0;L;;;;;N;;;;; +A5DD;VAI SYLLABLE GO;Lo;0;L;;;;;N;;;;; +A5DE;VAI SYLLABLE MO;Lo;0;L;;;;;N;;;;; +A5DF;VAI SYLLABLE NO;Lo;0;L;;;;;N;;;;; +A5E0;VAI SYLLABLE NYO;Lo;0;L;;;;;N;;;;; +A5E1;VAI SYLLABLE E;Lo;0;L;;;;;N;;;;; +A5E2;VAI SYLLABLE EN;Lo;0;L;;;;;N;;;;; +A5E3;VAI SYLLABLE NGEN;Lo;0;L;;;;;N;;;;; +A5E4;VAI SYLLABLE HE;Lo;0;L;;;;;N;;;;; +A5E5;VAI SYLLABLE HEN;Lo;0;L;;;;;N;;;;; +A5E6;VAI SYLLABLE WE;Lo;0;L;;;;;N;;;;; +A5E7;VAI SYLLABLE WEN;Lo;0;L;;;;;N;;;;; +A5E8;VAI SYLLABLE PE;Lo;0;L;;;;;N;;;;; +A5E9;VAI SYLLABLE BHE;Lo;0;L;;;;;N;;;;; +A5EA;VAI SYLLABLE BE;Lo;0;L;;;;;N;;;;; +A5EB;VAI SYLLABLE MBE;Lo;0;L;;;;;N;;;;; +A5EC;VAI SYLLABLE KPE;Lo;0;L;;;;;N;;;;; +A5ED;VAI SYLLABLE KPEN;Lo;0;L;;;;;N;;;;; +A5EE;VAI SYLLABLE MGBE;Lo;0;L;;;;;N;;;;; +A5EF;VAI SYLLABLE GBE;Lo;0;L;;;;;N;;;;; +A5F0;VAI SYLLABLE GBEN;Lo;0;L;;;;;N;;;;; +A5F1;VAI SYLLABLE FE;Lo;0;L;;;;;N;;;;; +A5F2;VAI SYLLABLE VE;Lo;0;L;;;;;N;;;;; +A5F3;VAI SYLLABLE TE;Lo;0;L;;;;;N;;;;; +A5F4;VAI SYLLABLE THE;Lo;0;L;;;;;N;;;;; +A5F5;VAI SYLLABLE DHE;Lo;0;L;;;;;N;;;;; +A5F6;VAI SYLLABLE DHHE;Lo;0;L;;;;;N;;;;; +A5F7;VAI SYLLABLE LE;Lo;0;L;;;;;N;;;;; +A5F8;VAI SYLLABLE RE;Lo;0;L;;;;;N;;;;; +A5F9;VAI SYLLABLE DE;Lo;0;L;;;;;N;;;;; +A5FA;VAI SYLLABLE NDE;Lo;0;L;;;;;N;;;;; +A5FB;VAI SYLLABLE SE;Lo;0;L;;;;;N;;;;; +A5FC;VAI SYLLABLE SHE;Lo;0;L;;;;;N;;;;; +A5FD;VAI SYLLABLE ZE;Lo;0;L;;;;;N;;;;; +A5FE;VAI SYLLABLE ZHE;Lo;0;L;;;;;N;;;;; +A5FF;VAI SYLLABLE CE;Lo;0;L;;;;;N;;;;; +A600;VAI SYLLABLE JE;Lo;0;L;;;;;N;;;;; +A601;VAI SYLLABLE NJE;Lo;0;L;;;;;N;;;;; +A602;VAI SYLLABLE YE;Lo;0;L;;;;;N;;;;; +A603;VAI SYLLABLE KE;Lo;0;L;;;;;N;;;;; +A604;VAI SYLLABLE NGGE;Lo;0;L;;;;;N;;;;; +A605;VAI SYLLABLE NGGEN;Lo;0;L;;;;;N;;;;; +A606;VAI SYLLABLE GE;Lo;0;L;;;;;N;;;;; +A607;VAI SYLLABLE GEN;Lo;0;L;;;;;N;;;;; +A608;VAI SYLLABLE ME;Lo;0;L;;;;;N;;;;; +A609;VAI SYLLABLE NE;Lo;0;L;;;;;N;;;;; +A60A;VAI SYLLABLE NYE;Lo;0;L;;;;;N;;;;; +A60B;VAI SYLLABLE NG;Lo;0;L;;;;;N;;;;; +A60C;VAI SYLLABLE LENGTHENER;Lm;0;L;;;;;N;;;;; +A60D;VAI COMMA;Po;0;ON;;;;;N;;;;; +A60E;VAI FULL STOP;Po;0;ON;;;;;N;;;;; +A60F;VAI QUESTION MARK;Po;0;ON;;;;;N;;;;; +A610;VAI SYLLABLE NDOLE FA;Lo;0;L;;;;;N;;;;; +A611;VAI SYLLABLE NDOLE KA;Lo;0;L;;;;;N;;;;; +A612;VAI SYLLABLE NDOLE SOO;Lo;0;L;;;;;N;;;;; +A613;VAI SYMBOL FEENG;Lo;0;L;;;;;N;;;;; +A614;VAI SYMBOL KEENG;Lo;0;L;;;;;N;;;;; +A615;VAI SYMBOL TING;Lo;0;L;;;;;N;;;;; +A616;VAI SYMBOL NII;Lo;0;L;;;;;N;;;;; +A617;VAI SYMBOL BANG;Lo;0;L;;;;;N;;;;; +A618;VAI SYMBOL FAA;Lo;0;L;;;;;N;;;;; +A619;VAI SYMBOL TAA;Lo;0;L;;;;;N;;;;; +A61A;VAI SYMBOL DANG;Lo;0;L;;;;;N;;;;; +A61B;VAI SYMBOL DOONG;Lo;0;L;;;;;N;;;;; +A61C;VAI SYMBOL KUNG;Lo;0;L;;;;;N;;;;; +A61D;VAI SYMBOL TONG;Lo;0;L;;;;;N;;;;; +A61E;VAI SYMBOL DO-O;Lo;0;L;;;;;N;;;;; +A61F;VAI SYMBOL JONG;Lo;0;L;;;;;N;;;;; +A620;VAI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +A621;VAI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +A622;VAI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +A623;VAI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +A624;VAI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +A625;VAI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +A626;VAI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +A627;VAI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +A628;VAI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +A629;VAI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +A62A;VAI SYLLABLE NDOLE MA;Lo;0;L;;;;;N;;;;; +A62B;VAI SYLLABLE NDOLE DO;Lo;0;L;;;;;N;;;;; +A640;CYRILLIC CAPITAL LETTER ZEMLYA;Lu;0;L;;;;;N;;;;A641; +A641;CYRILLIC SMALL LETTER ZEMLYA;Ll;0;L;;;;;N;;;A640;;A640 +A642;CYRILLIC CAPITAL LETTER DZELO;Lu;0;L;;;;;N;;;;A643; +A643;CYRILLIC SMALL LETTER DZELO;Ll;0;L;;;;;N;;;A642;;A642 +A644;CYRILLIC CAPITAL LETTER REVERSED DZE;Lu;0;L;;;;;N;;;;A645; +A645;CYRILLIC SMALL LETTER REVERSED DZE;Ll;0;L;;;;;N;;;A644;;A644 +A646;CYRILLIC CAPITAL LETTER IOTA;Lu;0;L;;;;;N;;;;A647; +A647;CYRILLIC SMALL LETTER IOTA;Ll;0;L;;;;;N;;;A646;;A646 +A648;CYRILLIC CAPITAL LETTER DJERV;Lu;0;L;;;;;N;;;;A649; +A649;CYRILLIC SMALL LETTER DJERV;Ll;0;L;;;;;N;;;A648;;A648 +A64A;CYRILLIC CAPITAL LETTER MONOGRAPH UK;Lu;0;L;;;;;N;;;;A64B; +A64B;CYRILLIC SMALL LETTER MONOGRAPH UK;Ll;0;L;;;;;N;;;A64A;;A64A +A64C;CYRILLIC CAPITAL LETTER BROAD OMEGA;Lu;0;L;;;;;N;;;;A64D; +A64D;CYRILLIC SMALL LETTER BROAD OMEGA;Ll;0;L;;;;;N;;;A64C;;A64C +A64E;CYRILLIC CAPITAL LETTER NEUTRAL YER;Lu;0;L;;;;;N;;;;A64F; +A64F;CYRILLIC SMALL LETTER NEUTRAL YER;Ll;0;L;;;;;N;;;A64E;;A64E +A650;CYRILLIC CAPITAL LETTER YERU WITH BACK YER;Lu;0;L;;;;;N;;;;A651; +A651;CYRILLIC SMALL LETTER YERU WITH BACK YER;Ll;0;L;;;;;N;;;A650;;A650 +A652;CYRILLIC CAPITAL LETTER IOTIFIED YAT;Lu;0;L;;;;;N;;;;A653; +A653;CYRILLIC SMALL LETTER IOTIFIED YAT;Ll;0;L;;;;;N;;;A652;;A652 +A654;CYRILLIC CAPITAL LETTER REVERSED YU;Lu;0;L;;;;;N;;;;A655; +A655;CYRILLIC SMALL LETTER REVERSED YU;Ll;0;L;;;;;N;;;A654;;A654 +A656;CYRILLIC CAPITAL LETTER IOTIFIED A;Lu;0;L;;;;;N;;;;A657; +A657;CYRILLIC SMALL LETTER IOTIFIED A;Ll;0;L;;;;;N;;;A656;;A656 +A658;CYRILLIC CAPITAL LETTER CLOSED LITTLE YUS;Lu;0;L;;;;;N;;;;A659; +A659;CYRILLIC SMALL LETTER CLOSED LITTLE YUS;Ll;0;L;;;;;N;;;A658;;A658 +A65A;CYRILLIC CAPITAL LETTER BLENDED YUS;Lu;0;L;;;;;N;;;;A65B; +A65B;CYRILLIC SMALL LETTER BLENDED YUS;Ll;0;L;;;;;N;;;A65A;;A65A +A65C;CYRILLIC CAPITAL LETTER IOTIFIED CLOSED LITTLE YUS;Lu;0;L;;;;;N;;;;A65D; +A65D;CYRILLIC SMALL LETTER IOTIFIED CLOSED LITTLE YUS;Ll;0;L;;;;;N;;;A65C;;A65C +A65E;CYRILLIC CAPITAL LETTER YN;Lu;0;L;;;;;N;;;;A65F; +A65F;CYRILLIC SMALL LETTER YN;Ll;0;L;;;;;N;;;A65E;;A65E +A660;CYRILLIC CAPITAL LETTER REVERSED TSE;Lu;0;L;;;;;N;;;;A661; +A661;CYRILLIC SMALL LETTER REVERSED TSE;Ll;0;L;;;;;N;;;A660;;A660 +A662;CYRILLIC CAPITAL LETTER SOFT DE;Lu;0;L;;;;;N;;;;A663; +A663;CYRILLIC SMALL LETTER SOFT DE;Ll;0;L;;;;;N;;;A662;;A662 +A664;CYRILLIC CAPITAL LETTER SOFT EL;Lu;0;L;;;;;N;;;;A665; +A665;CYRILLIC SMALL LETTER SOFT EL;Ll;0;L;;;;;N;;;A664;;A664 +A666;CYRILLIC CAPITAL LETTER SOFT EM;Lu;0;L;;;;;N;;;;A667; +A667;CYRILLIC SMALL LETTER SOFT EM;Ll;0;L;;;;;N;;;A666;;A666 +A668;CYRILLIC CAPITAL LETTER MONOCULAR O;Lu;0;L;;;;;N;;;;A669; +A669;CYRILLIC SMALL LETTER MONOCULAR O;Ll;0;L;;;;;N;;;A668;;A668 +A66A;CYRILLIC CAPITAL LETTER BINOCULAR O;Lu;0;L;;;;;N;;;;A66B; +A66B;CYRILLIC SMALL LETTER BINOCULAR O;Ll;0;L;;;;;N;;;A66A;;A66A +A66C;CYRILLIC CAPITAL LETTER DOUBLE MONOCULAR O;Lu;0;L;;;;;N;;;;A66D; +A66D;CYRILLIC SMALL LETTER DOUBLE MONOCULAR O;Ll;0;L;;;;;N;;;A66C;;A66C +A66E;CYRILLIC LETTER MULTIOCULAR O;Lo;0;L;;;;;N;;;;; +A66F;COMBINING CYRILLIC VZMET;Mn;230;NSM;;;;;N;;;;; +A670;COMBINING CYRILLIC TEN MILLIONS SIGN;Me;0;NSM;;;;;N;;;;; +A671;COMBINING CYRILLIC HUNDRED MILLIONS SIGN;Me;0;NSM;;;;;N;;;;; +A672;COMBINING CYRILLIC THOUSAND MILLIONS SIGN;Me;0;NSM;;;;;N;;;;; +A673;SLAVONIC ASTERISK;Po;0;ON;;;;;N;;;;; +A674;COMBINING CYRILLIC LETTER UKRAINIAN IE;Mn;230;NSM;;;;;N;;;;; +A675;COMBINING CYRILLIC LETTER I;Mn;230;NSM;;;;;N;;;;; +A676;COMBINING CYRILLIC LETTER YI;Mn;230;NSM;;;;;N;;;;; +A677;COMBINING CYRILLIC LETTER U;Mn;230;NSM;;;;;N;;;;; +A678;COMBINING CYRILLIC LETTER HARD SIGN;Mn;230;NSM;;;;;N;;;;; +A679;COMBINING CYRILLIC LETTER YERU;Mn;230;NSM;;;;;N;;;;; +A67A;COMBINING CYRILLIC LETTER SOFT SIGN;Mn;230;NSM;;;;;N;;;;; +A67B;COMBINING CYRILLIC LETTER OMEGA;Mn;230;NSM;;;;;N;;;;; +A67C;COMBINING CYRILLIC KAVYKA;Mn;230;NSM;;;;;N;;;;; +A67D;COMBINING CYRILLIC PAYEROK;Mn;230;NSM;;;;;N;;;;; +A67E;CYRILLIC KAVYKA;Po;0;ON;;;;;N;;;;; +A67F;CYRILLIC PAYEROK;Lm;0;ON;;;;;N;;;;; +A680;CYRILLIC CAPITAL LETTER DWE;Lu;0;L;;;;;N;;;;A681; +A681;CYRILLIC SMALL LETTER DWE;Ll;0;L;;;;;N;;;A680;;A680 +A682;CYRILLIC CAPITAL LETTER DZWE;Lu;0;L;;;;;N;;;;A683; +A683;CYRILLIC SMALL LETTER DZWE;Ll;0;L;;;;;N;;;A682;;A682 +A684;CYRILLIC CAPITAL LETTER ZHWE;Lu;0;L;;;;;N;;;;A685; +A685;CYRILLIC SMALL LETTER ZHWE;Ll;0;L;;;;;N;;;A684;;A684 +A686;CYRILLIC CAPITAL LETTER CCHE;Lu;0;L;;;;;N;;;;A687; +A687;CYRILLIC SMALL LETTER CCHE;Ll;0;L;;;;;N;;;A686;;A686 +A688;CYRILLIC CAPITAL LETTER DZZE;Lu;0;L;;;;;N;;;;A689; +A689;CYRILLIC SMALL LETTER DZZE;Ll;0;L;;;;;N;;;A688;;A688 +A68A;CYRILLIC CAPITAL LETTER TE WITH MIDDLE HOOK;Lu;0;L;;;;;N;;;;A68B; +A68B;CYRILLIC SMALL LETTER TE WITH MIDDLE HOOK;Ll;0;L;;;;;N;;;A68A;;A68A +A68C;CYRILLIC CAPITAL LETTER TWE;Lu;0;L;;;;;N;;;;A68D; +A68D;CYRILLIC SMALL LETTER TWE;Ll;0;L;;;;;N;;;A68C;;A68C +A68E;CYRILLIC CAPITAL LETTER TSWE;Lu;0;L;;;;;N;;;;A68F; +A68F;CYRILLIC SMALL LETTER TSWE;Ll;0;L;;;;;N;;;A68E;;A68E +A690;CYRILLIC CAPITAL LETTER TSSE;Lu;0;L;;;;;N;;;;A691; +A691;CYRILLIC SMALL LETTER TSSE;Ll;0;L;;;;;N;;;A690;;A690 +A692;CYRILLIC CAPITAL LETTER TCHE;Lu;0;L;;;;;N;;;;A693; +A693;CYRILLIC SMALL LETTER TCHE;Ll;0;L;;;;;N;;;A692;;A692 +A694;CYRILLIC CAPITAL LETTER HWE;Lu;0;L;;;;;N;;;;A695; +A695;CYRILLIC SMALL LETTER HWE;Ll;0;L;;;;;N;;;A694;;A694 +A696;CYRILLIC CAPITAL LETTER SHWE;Lu;0;L;;;;;N;;;;A697; +A697;CYRILLIC SMALL LETTER SHWE;Ll;0;L;;;;;N;;;A696;;A696 +A698;CYRILLIC CAPITAL LETTER DOUBLE O;Lu;0;L;;;;;N;;;;A699; +A699;CYRILLIC SMALL LETTER DOUBLE O;Ll;0;L;;;;;N;;;A698;;A698 +A69A;CYRILLIC CAPITAL LETTER CROSSED O;Lu;0;L;;;;;N;;;;A69B; +A69B;CYRILLIC SMALL LETTER CROSSED O;Ll;0;L;;;;;N;;;A69A;;A69A +A69C;MODIFIER LETTER CYRILLIC HARD SIGN;Lm;0;L;<super> 044A;;;;N;;;;; +A69D;MODIFIER LETTER CYRILLIC SOFT SIGN;Lm;0;L;<super> 044C;;;;N;;;;; +A69E;COMBINING CYRILLIC LETTER EF;Mn;230;NSM;;;;;N;;;;; +A69F;COMBINING CYRILLIC LETTER IOTIFIED E;Mn;230;NSM;;;;;N;;;;; +A6A0;BAMUM LETTER A;Lo;0;L;;;;;N;;;;; +A6A1;BAMUM LETTER KA;Lo;0;L;;;;;N;;;;; +A6A2;BAMUM LETTER U;Lo;0;L;;;;;N;;;;; +A6A3;BAMUM LETTER KU;Lo;0;L;;;;;N;;;;; +A6A4;BAMUM LETTER EE;Lo;0;L;;;;;N;;;;; +A6A5;BAMUM LETTER REE;Lo;0;L;;;;;N;;;;; +A6A6;BAMUM LETTER TAE;Lo;0;L;;;;;N;;;;; +A6A7;BAMUM LETTER O;Lo;0;L;;;;;N;;;;; +A6A8;BAMUM LETTER NYI;Lo;0;L;;;;;N;;;;; +A6A9;BAMUM LETTER I;Lo;0;L;;;;;N;;;;; +A6AA;BAMUM LETTER LA;Lo;0;L;;;;;N;;;;; +A6AB;BAMUM LETTER PA;Lo;0;L;;;;;N;;;;; +A6AC;BAMUM LETTER RII;Lo;0;L;;;;;N;;;;; +A6AD;BAMUM LETTER RIEE;Lo;0;L;;;;;N;;;;; +A6AE;BAMUM LETTER LEEEE;Lo;0;L;;;;;N;;;;; +A6AF;BAMUM LETTER MEEEE;Lo;0;L;;;;;N;;;;; +A6B0;BAMUM LETTER TAA;Lo;0;L;;;;;N;;;;; +A6B1;BAMUM LETTER NDAA;Lo;0;L;;;;;N;;;;; +A6B2;BAMUM LETTER NJAEM;Lo;0;L;;;;;N;;;;; +A6B3;BAMUM LETTER M;Lo;0;L;;;;;N;;;;; +A6B4;BAMUM LETTER SUU;Lo;0;L;;;;;N;;;;; +A6B5;BAMUM LETTER MU;Lo;0;L;;;;;N;;;;; +A6B6;BAMUM LETTER SHII;Lo;0;L;;;;;N;;;;; +A6B7;BAMUM LETTER SI;Lo;0;L;;;;;N;;;;; +A6B8;BAMUM LETTER SHEUX;Lo;0;L;;;;;N;;;;; +A6B9;BAMUM LETTER SEUX;Lo;0;L;;;;;N;;;;; +A6BA;BAMUM LETTER KYEE;Lo;0;L;;;;;N;;;;; +A6BB;BAMUM LETTER KET;Lo;0;L;;;;;N;;;;; +A6BC;BAMUM LETTER NUAE;Lo;0;L;;;;;N;;;;; +A6BD;BAMUM LETTER NU;Lo;0;L;;;;;N;;;;; +A6BE;BAMUM LETTER NJUAE;Lo;0;L;;;;;N;;;;; +A6BF;BAMUM LETTER YOQ;Lo;0;L;;;;;N;;;;; +A6C0;BAMUM LETTER SHU;Lo;0;L;;;;;N;;;;; +A6C1;BAMUM LETTER YUQ;Lo;0;L;;;;;N;;;;; +A6C2;BAMUM LETTER YA;Lo;0;L;;;;;N;;;;; +A6C3;BAMUM LETTER NSHA;Lo;0;L;;;;;N;;;;; +A6C4;BAMUM LETTER KEUX;Lo;0;L;;;;;N;;;;; +A6C5;BAMUM LETTER PEUX;Lo;0;L;;;;;N;;;;; +A6C6;BAMUM LETTER NJEE;Lo;0;L;;;;;N;;;;; +A6C7;BAMUM LETTER NTEE;Lo;0;L;;;;;N;;;;; +A6C8;BAMUM LETTER PUE;Lo;0;L;;;;;N;;;;; +A6C9;BAMUM LETTER WUE;Lo;0;L;;;;;N;;;;; +A6CA;BAMUM LETTER PEE;Lo;0;L;;;;;N;;;;; +A6CB;BAMUM LETTER FEE;Lo;0;L;;;;;N;;;;; +A6CC;BAMUM LETTER RU;Lo;0;L;;;;;N;;;;; +A6CD;BAMUM LETTER LU;Lo;0;L;;;;;N;;;;; +A6CE;BAMUM LETTER MI;Lo;0;L;;;;;N;;;;; +A6CF;BAMUM LETTER NI;Lo;0;L;;;;;N;;;;; +A6D0;BAMUM LETTER REUX;Lo;0;L;;;;;N;;;;; +A6D1;BAMUM LETTER RAE;Lo;0;L;;;;;N;;;;; +A6D2;BAMUM LETTER KEN;Lo;0;L;;;;;N;;;;; +A6D3;BAMUM LETTER NGKWAEN;Lo;0;L;;;;;N;;;;; +A6D4;BAMUM LETTER NGGA;Lo;0;L;;;;;N;;;;; +A6D5;BAMUM LETTER NGA;Lo;0;L;;;;;N;;;;; +A6D6;BAMUM LETTER SHO;Lo;0;L;;;;;N;;;;; +A6D7;BAMUM LETTER PUAE;Lo;0;L;;;;;N;;;;; +A6D8;BAMUM LETTER FU;Lo;0;L;;;;;N;;;;; +A6D9;BAMUM LETTER FOM;Lo;0;L;;;;;N;;;;; +A6DA;BAMUM LETTER WA;Lo;0;L;;;;;N;;;;; +A6DB;BAMUM LETTER NA;Lo;0;L;;;;;N;;;;; +A6DC;BAMUM LETTER LI;Lo;0;L;;;;;N;;;;; +A6DD;BAMUM LETTER PI;Lo;0;L;;;;;N;;;;; +A6DE;BAMUM LETTER LOQ;Lo;0;L;;;;;N;;;;; +A6DF;BAMUM LETTER KO;Lo;0;L;;;;;N;;;;; +A6E0;BAMUM LETTER MBEN;Lo;0;L;;;;;N;;;;; +A6E1;BAMUM LETTER REN;Lo;0;L;;;;;N;;;;; +A6E2;BAMUM LETTER MEN;Lo;0;L;;;;;N;;;;; +A6E3;BAMUM LETTER MA;Lo;0;L;;;;;N;;;;; +A6E4;BAMUM LETTER TI;Lo;0;L;;;;;N;;;;; +A6E5;BAMUM LETTER KI;Lo;0;L;;;;;N;;;;; +A6E6;BAMUM LETTER MO;Nl;0;L;;;;1;N;;;;; +A6E7;BAMUM LETTER MBAA;Nl;0;L;;;;2;N;;;;; +A6E8;BAMUM LETTER TET;Nl;0;L;;;;3;N;;;;; +A6E9;BAMUM LETTER KPA;Nl;0;L;;;;4;N;;;;; +A6EA;BAMUM LETTER TEN;Nl;0;L;;;;5;N;;;;; +A6EB;BAMUM LETTER NTUU;Nl;0;L;;;;6;N;;;;; +A6EC;BAMUM LETTER SAMBA;Nl;0;L;;;;7;N;;;;; +A6ED;BAMUM LETTER FAAMAE;Nl;0;L;;;;8;N;;;;; +A6EE;BAMUM LETTER KOVUU;Nl;0;L;;;;9;N;;;;; +A6EF;BAMUM LETTER KOGHOM;Nl;0;L;;;;0;N;;;;; +A6F0;BAMUM COMBINING MARK KOQNDON;Mn;230;NSM;;;;;N;;;;; +A6F1;BAMUM COMBINING MARK TUKWENTIS;Mn;230;NSM;;;;;N;;;;; +A6F2;BAMUM NJAEMLI;Po;0;L;;;;;N;;;;; +A6F3;BAMUM FULL STOP;Po;0;L;;;;;N;;;;; +A6F4;BAMUM COLON;Po;0;L;;;;;N;;;;; +A6F5;BAMUM COMMA;Po;0;L;;;;;N;;;;; +A6F6;BAMUM SEMICOLON;Po;0;L;;;;;N;;;;; +A6F7;BAMUM QUESTION MARK;Po;0;L;;;;;N;;;;; +A700;MODIFIER LETTER CHINESE TONE YIN PING;Sk;0;ON;;;;;N;;;;; +A701;MODIFIER LETTER CHINESE TONE YANG PING;Sk;0;ON;;;;;N;;;;; +A702;MODIFIER LETTER CHINESE TONE YIN SHANG;Sk;0;ON;;;;;N;;;;; +A703;MODIFIER LETTER CHINESE TONE YANG SHANG;Sk;0;ON;;;;;N;;;;; +A704;MODIFIER LETTER CHINESE TONE YIN QU;Sk;0;ON;;;;;N;;;;; +A705;MODIFIER LETTER CHINESE TONE YANG QU;Sk;0;ON;;;;;N;;;;; +A706;MODIFIER LETTER CHINESE TONE YIN RU;Sk;0;ON;;;;;N;;;;; +A707;MODIFIER LETTER CHINESE TONE YANG RU;Sk;0;ON;;;;;N;;;;; +A708;MODIFIER LETTER EXTRA-HIGH DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;; +A709;MODIFIER LETTER HIGH DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;; +A70A;MODIFIER LETTER MID DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;; +A70B;MODIFIER LETTER LOW DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;; +A70C;MODIFIER LETTER EXTRA-LOW DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;; +A70D;MODIFIER LETTER EXTRA-HIGH DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A70E;MODIFIER LETTER HIGH DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A70F;MODIFIER LETTER MID DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A710;MODIFIER LETTER LOW DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A711;MODIFIER LETTER EXTRA-LOW DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A712;MODIFIER LETTER EXTRA-HIGH LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A713;MODIFIER LETTER HIGH LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A714;MODIFIER LETTER MID LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A715;MODIFIER LETTER LOW LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A716;MODIFIER LETTER EXTRA-LOW LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;; +A717;MODIFIER LETTER DOT VERTICAL BAR;Lm;0;ON;;;;;N;;;;; +A718;MODIFIER LETTER DOT SLASH;Lm;0;ON;;;;;N;;;;; +A719;MODIFIER LETTER DOT HORIZONTAL BAR;Lm;0;ON;;;;;N;;;;; +A71A;MODIFIER LETTER LOWER RIGHT CORNER ANGLE;Lm;0;ON;;;;;N;;;;; +A71B;MODIFIER LETTER RAISED UP ARROW;Lm;0;ON;;;;;N;;;;; +A71C;MODIFIER LETTER RAISED DOWN ARROW;Lm;0;ON;;;;;N;;;;; +A71D;MODIFIER LETTER RAISED EXCLAMATION MARK;Lm;0;ON;;;;;N;;;;; +A71E;MODIFIER LETTER RAISED INVERTED EXCLAMATION MARK;Lm;0;ON;;;;;N;;;;; +A71F;MODIFIER LETTER LOW INVERTED EXCLAMATION MARK;Lm;0;ON;;;;;N;;;;; +A720;MODIFIER LETTER STRESS AND HIGH TONE;Sk;0;ON;;;;;N;;;;; +A721;MODIFIER LETTER STRESS AND LOW TONE;Sk;0;ON;;;;;N;;;;; +A722;LATIN CAPITAL LETTER EGYPTOLOGICAL ALEF;Lu;0;L;;;;;N;;;;A723; +A723;LATIN SMALL LETTER EGYPTOLOGICAL ALEF;Ll;0;L;;;;;N;;;A722;;A722 +A724;LATIN CAPITAL LETTER EGYPTOLOGICAL AIN;Lu;0;L;;;;;N;;;;A725; +A725;LATIN SMALL LETTER EGYPTOLOGICAL AIN;Ll;0;L;;;;;N;;;A724;;A724 +A726;LATIN CAPITAL LETTER HENG;Lu;0;L;;;;;N;;;;A727; +A727;LATIN SMALL LETTER HENG;Ll;0;L;;;;;N;;;A726;;A726 +A728;LATIN CAPITAL LETTER TZ;Lu;0;L;;;;;N;;;;A729; +A729;LATIN SMALL LETTER TZ;Ll;0;L;;;;;N;;;A728;;A728 +A72A;LATIN CAPITAL LETTER TRESILLO;Lu;0;L;;;;;N;;;;A72B; +A72B;LATIN SMALL LETTER TRESILLO;Ll;0;L;;;;;N;;;A72A;;A72A +A72C;LATIN CAPITAL LETTER CUATRILLO;Lu;0;L;;;;;N;;;;A72D; +A72D;LATIN SMALL LETTER CUATRILLO;Ll;0;L;;;;;N;;;A72C;;A72C +A72E;LATIN CAPITAL LETTER CUATRILLO WITH COMMA;Lu;0;L;;;;;N;;;;A72F; +A72F;LATIN SMALL LETTER CUATRILLO WITH COMMA;Ll;0;L;;;;;N;;;A72E;;A72E +A730;LATIN LETTER SMALL CAPITAL F;Ll;0;L;;;;;N;;;;; +A731;LATIN LETTER SMALL CAPITAL S;Ll;0;L;;;;;N;;;;; +A732;LATIN CAPITAL LETTER AA;Lu;0;L;;;;;N;;;;A733; +A733;LATIN SMALL LETTER AA;Ll;0;L;;;;;N;;;A732;;A732 +A734;LATIN CAPITAL LETTER AO;Lu;0;L;;;;;N;;;;A735; +A735;LATIN SMALL LETTER AO;Ll;0;L;;;;;N;;;A734;;A734 +A736;LATIN CAPITAL LETTER AU;Lu;0;L;;;;;N;;;;A737; +A737;LATIN SMALL LETTER AU;Ll;0;L;;;;;N;;;A736;;A736 +A738;LATIN CAPITAL LETTER AV;Lu;0;L;;;;;N;;;;A739; +A739;LATIN SMALL LETTER AV;Ll;0;L;;;;;N;;;A738;;A738 +A73A;LATIN CAPITAL LETTER AV WITH HORIZONTAL BAR;Lu;0;L;;;;;N;;;;A73B; +A73B;LATIN SMALL LETTER AV WITH HORIZONTAL BAR;Ll;0;L;;;;;N;;;A73A;;A73A +A73C;LATIN CAPITAL LETTER AY;Lu;0;L;;;;;N;;;;A73D; +A73D;LATIN SMALL LETTER AY;Ll;0;L;;;;;N;;;A73C;;A73C +A73E;LATIN CAPITAL LETTER REVERSED C WITH DOT;Lu;0;L;;;;;N;;;;A73F; +A73F;LATIN SMALL LETTER REVERSED C WITH DOT;Ll;0;L;;;;;N;;;A73E;;A73E +A740;LATIN CAPITAL LETTER K WITH STROKE;Lu;0;L;;;;;N;;;;A741; +A741;LATIN SMALL LETTER K WITH STROKE;Ll;0;L;;;;;N;;;A740;;A740 +A742;LATIN CAPITAL LETTER K WITH DIAGONAL STROKE;Lu;0;L;;;;;N;;;;A743; +A743;LATIN SMALL LETTER K WITH DIAGONAL STROKE;Ll;0;L;;;;;N;;;A742;;A742 +A744;LATIN CAPITAL LETTER K WITH STROKE AND DIAGONAL STROKE;Lu;0;L;;;;;N;;;;A745; +A745;LATIN SMALL LETTER K WITH STROKE AND DIAGONAL STROKE;Ll;0;L;;;;;N;;;A744;;A744 +A746;LATIN CAPITAL LETTER BROKEN L;Lu;0;L;;;;;N;;;;A747; +A747;LATIN SMALL LETTER BROKEN L;Ll;0;L;;;;;N;;;A746;;A746 +A748;LATIN CAPITAL LETTER L WITH HIGH STROKE;Lu;0;L;;;;;N;;;;A749; +A749;LATIN SMALL LETTER L WITH HIGH STROKE;Ll;0;L;;;;;N;;;A748;;A748 +A74A;LATIN CAPITAL LETTER O WITH LONG STROKE OVERLAY;Lu;0;L;;;;;N;;;;A74B; +A74B;LATIN SMALL LETTER O WITH LONG STROKE OVERLAY;Ll;0;L;;;;;N;;;A74A;;A74A +A74C;LATIN CAPITAL LETTER O WITH LOOP;Lu;0;L;;;;;N;;;;A74D; +A74D;LATIN SMALL LETTER O WITH LOOP;Ll;0;L;;;;;N;;;A74C;;A74C +A74E;LATIN CAPITAL LETTER OO;Lu;0;L;;;;;N;;;;A74F; +A74F;LATIN SMALL LETTER OO;Ll;0;L;;;;;N;;;A74E;;A74E +A750;LATIN CAPITAL LETTER P WITH STROKE THROUGH DESCENDER;Lu;0;L;;;;;N;;;;A751; +A751;LATIN SMALL LETTER P WITH STROKE THROUGH DESCENDER;Ll;0;L;;;;;N;;;A750;;A750 +A752;LATIN CAPITAL LETTER P WITH FLOURISH;Lu;0;L;;;;;N;;;;A753; +A753;LATIN SMALL LETTER P WITH FLOURISH;Ll;0;L;;;;;N;;;A752;;A752 +A754;LATIN CAPITAL LETTER P WITH SQUIRREL TAIL;Lu;0;L;;;;;N;;;;A755; +A755;LATIN SMALL LETTER P WITH SQUIRREL TAIL;Ll;0;L;;;;;N;;;A754;;A754 +A756;LATIN CAPITAL LETTER Q WITH STROKE THROUGH DESCENDER;Lu;0;L;;;;;N;;;;A757; +A757;LATIN SMALL LETTER Q WITH STROKE THROUGH DESCENDER;Ll;0;L;;;;;N;;;A756;;A756 +A758;LATIN CAPITAL LETTER Q WITH DIAGONAL STROKE;Lu;0;L;;;;;N;;;;A759; +A759;LATIN SMALL LETTER Q WITH DIAGONAL STROKE;Ll;0;L;;;;;N;;;A758;;A758 +A75A;LATIN CAPITAL LETTER R ROTUNDA;Lu;0;L;;;;;N;;;;A75B; +A75B;LATIN SMALL LETTER R ROTUNDA;Ll;0;L;;;;;N;;;A75A;;A75A +A75C;LATIN CAPITAL LETTER RUM ROTUNDA;Lu;0;L;;;;;N;;;;A75D; +A75D;LATIN SMALL LETTER RUM ROTUNDA;Ll;0;L;;;;;N;;;A75C;;A75C +A75E;LATIN CAPITAL LETTER V WITH DIAGONAL STROKE;Lu;0;L;;;;;N;;;;A75F; +A75F;LATIN SMALL LETTER V WITH DIAGONAL STROKE;Ll;0;L;;;;;N;;;A75E;;A75E +A760;LATIN CAPITAL LETTER VY;Lu;0;L;;;;;N;;;;A761; +A761;LATIN SMALL LETTER VY;Ll;0;L;;;;;N;;;A760;;A760 +A762;LATIN CAPITAL LETTER VISIGOTHIC Z;Lu;0;L;;;;;N;;;;A763; +A763;LATIN SMALL LETTER VISIGOTHIC Z;Ll;0;L;;;;;N;;;A762;;A762 +A764;LATIN CAPITAL LETTER THORN WITH STROKE;Lu;0;L;;;;;N;;;;A765; +A765;LATIN SMALL LETTER THORN WITH STROKE;Ll;0;L;;;;;N;;;A764;;A764 +A766;LATIN CAPITAL LETTER THORN WITH STROKE THROUGH DESCENDER;Lu;0;L;;;;;N;;;;A767; +A767;LATIN SMALL LETTER THORN WITH STROKE THROUGH DESCENDER;Ll;0;L;;;;;N;;;A766;;A766 +A768;LATIN CAPITAL LETTER VEND;Lu;0;L;;;;;N;;;;A769; +A769;LATIN SMALL LETTER VEND;Ll;0;L;;;;;N;;;A768;;A768 +A76A;LATIN CAPITAL LETTER ET;Lu;0;L;;;;;N;;;;A76B; +A76B;LATIN SMALL LETTER ET;Ll;0;L;;;;;N;;;A76A;;A76A +A76C;LATIN CAPITAL LETTER IS;Lu;0;L;;;;;N;;;;A76D; +A76D;LATIN SMALL LETTER IS;Ll;0;L;;;;;N;;;A76C;;A76C +A76E;LATIN CAPITAL LETTER CON;Lu;0;L;;;;;N;;;;A76F; +A76F;LATIN SMALL LETTER CON;Ll;0;L;;;;;N;;;A76E;;A76E +A770;MODIFIER LETTER US;Lm;0;L;<super> A76F;;;;N;;;;; +A771;LATIN SMALL LETTER DUM;Ll;0;L;;;;;N;;;;; +A772;LATIN SMALL LETTER LUM;Ll;0;L;;;;;N;;;;; +A773;LATIN SMALL LETTER MUM;Ll;0;L;;;;;N;;;;; +A774;LATIN SMALL LETTER NUM;Ll;0;L;;;;;N;;;;; +A775;LATIN SMALL LETTER RUM;Ll;0;L;;;;;N;;;;; +A776;LATIN LETTER SMALL CAPITAL RUM;Ll;0;L;;;;;N;;;;; +A777;LATIN SMALL LETTER TUM;Ll;0;L;;;;;N;;;;; +A778;LATIN SMALL LETTER UM;Ll;0;L;;;;;N;;;;; +A779;LATIN CAPITAL LETTER INSULAR D;Lu;0;L;;;;;N;;;;A77A; +A77A;LATIN SMALL LETTER INSULAR D;Ll;0;L;;;;;N;;;A779;;A779 +A77B;LATIN CAPITAL LETTER INSULAR F;Lu;0;L;;;;;N;;;;A77C; +A77C;LATIN SMALL LETTER INSULAR F;Ll;0;L;;;;;N;;;A77B;;A77B +A77D;LATIN CAPITAL LETTER INSULAR G;Lu;0;L;;;;;N;;;;1D79; +A77E;LATIN CAPITAL LETTER TURNED INSULAR G;Lu;0;L;;;;;N;;;;A77F; +A77F;LATIN SMALL LETTER TURNED INSULAR G;Ll;0;L;;;;;N;;;A77E;;A77E +A780;LATIN CAPITAL LETTER TURNED L;Lu;0;L;;;;;N;;;;A781; +A781;LATIN SMALL LETTER TURNED L;Ll;0;L;;;;;N;;;A780;;A780 +A782;LATIN CAPITAL LETTER INSULAR R;Lu;0;L;;;;;N;;;;A783; +A783;LATIN SMALL LETTER INSULAR R;Ll;0;L;;;;;N;;;A782;;A782 +A784;LATIN CAPITAL LETTER INSULAR S;Lu;0;L;;;;;N;;;;A785; +A785;LATIN SMALL LETTER INSULAR S;Ll;0;L;;;;;N;;;A784;;A784 +A786;LATIN CAPITAL LETTER INSULAR T;Lu;0;L;;;;;N;;;;A787; +A787;LATIN SMALL LETTER INSULAR T;Ll;0;L;;;;;N;;;A786;;A786 +A788;MODIFIER LETTER LOW CIRCUMFLEX ACCENT;Lm;0;ON;;;;;N;;;;; +A789;MODIFIER LETTER COLON;Sk;0;L;;;;;N;;;;; +A78A;MODIFIER LETTER SHORT EQUALS SIGN;Sk;0;L;;;;;N;;;;; +A78B;LATIN CAPITAL LETTER SALTILLO;Lu;0;L;;;;;N;;;;A78C; +A78C;LATIN SMALL LETTER SALTILLO;Ll;0;L;;;;;N;;;A78B;;A78B +A78D;LATIN CAPITAL LETTER TURNED H;Lu;0;L;;;;;N;;;;0265; +A78E;LATIN SMALL LETTER L WITH RETROFLEX HOOK AND BELT;Ll;0;L;;;;;N;;;;; +A78F;LATIN LETTER SINOLOGICAL DOT;Lo;0;L;;;;;N;;;;; +A790;LATIN CAPITAL LETTER N WITH DESCENDER;Lu;0;L;;;;;N;;;;A791; +A791;LATIN SMALL LETTER N WITH DESCENDER;Ll;0;L;;;;;N;;;A790;;A790 +A792;LATIN CAPITAL LETTER C WITH BAR;Lu;0;L;;;;;N;;;;A793; +A793;LATIN SMALL LETTER C WITH BAR;Ll;0;L;;;;;N;;;A792;;A792 +A794;LATIN SMALL LETTER C WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +A795;LATIN SMALL LETTER H WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;; +A796;LATIN CAPITAL LETTER B WITH FLOURISH;Lu;0;L;;;;;N;;;;A797; +A797;LATIN SMALL LETTER B WITH FLOURISH;Ll;0;L;;;;;N;;;A796;;A796 +A798;LATIN CAPITAL LETTER F WITH STROKE;Lu;0;L;;;;;N;;;;A799; +A799;LATIN SMALL LETTER F WITH STROKE;Ll;0;L;;;;;N;;;A798;;A798 +A79A;LATIN CAPITAL LETTER VOLAPUK AE;Lu;0;L;;;;;N;;;;A79B; +A79B;LATIN SMALL LETTER VOLAPUK AE;Ll;0;L;;;;;N;;;A79A;;A79A +A79C;LATIN CAPITAL LETTER VOLAPUK OE;Lu;0;L;;;;;N;;;;A79D; +A79D;LATIN SMALL LETTER VOLAPUK OE;Ll;0;L;;;;;N;;;A79C;;A79C +A79E;LATIN CAPITAL LETTER VOLAPUK UE;Lu;0;L;;;;;N;;;;A79F; +A79F;LATIN SMALL LETTER VOLAPUK UE;Ll;0;L;;;;;N;;;A79E;;A79E +A7A0;LATIN CAPITAL LETTER G WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A1; +A7A1;LATIN SMALL LETTER G WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A0;;A7A0 +A7A2;LATIN CAPITAL LETTER K WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A3; +A7A3;LATIN SMALL LETTER K WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A2;;A7A2 +A7A4;LATIN CAPITAL LETTER N WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A5; +A7A5;LATIN SMALL LETTER N WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A4;;A7A4 +A7A6;LATIN CAPITAL LETTER R WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A7; +A7A7;LATIN SMALL LETTER R WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A6;;A7A6 +A7A8;LATIN CAPITAL LETTER S WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A9; +A7A9;LATIN SMALL LETTER S WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A8;;A7A8 +A7AA;LATIN CAPITAL LETTER H WITH HOOK;Lu;0;L;;;;;N;;;;0266; +A7AB;LATIN CAPITAL LETTER REVERSED OPEN E;Lu;0;L;;;;;N;;;;025C; +A7AC;LATIN CAPITAL LETTER SCRIPT G;Lu;0;L;;;;;N;;;;0261; +A7AD;LATIN CAPITAL LETTER L WITH BELT;Lu;0;L;;;;;N;;;;026C; +A7AE;LATIN CAPITAL LETTER SMALL CAPITAL I;Lu;0;L;;;;;N;;;;026A; +A7B0;LATIN CAPITAL LETTER TURNED K;Lu;0;L;;;;;N;;;;029E; +A7B1;LATIN CAPITAL LETTER TURNED T;Lu;0;L;;;;;N;;;;0287; +A7B2;LATIN CAPITAL LETTER J WITH CROSSED-TAIL;Lu;0;L;;;;;N;;;;029D; +A7B3;LATIN CAPITAL LETTER CHI;Lu;0;L;;;;;N;;;;AB53; +A7B4;LATIN CAPITAL LETTER BETA;Lu;0;L;;;;;N;;;;A7B5; +A7B5;LATIN SMALL LETTER BETA;Ll;0;L;;;;;N;;;A7B4;;A7B4 +A7B6;LATIN CAPITAL LETTER OMEGA;Lu;0;L;;;;;N;;;;A7B7; +A7B7;LATIN SMALL LETTER OMEGA;Ll;0;L;;;;;N;;;A7B6;;A7B6 +A7F7;LATIN EPIGRAPHIC LETTER SIDEWAYS I;Lo;0;L;;;;;N;;;;; +A7F8;MODIFIER LETTER CAPITAL H WITH STROKE;Lm;0;L;<super> 0126;;;;N;;;;; +A7F9;MODIFIER LETTER SMALL LIGATURE OE;Lm;0;L;<super> 0153;;;;N;;;;; +A7FA;LATIN LETTER SMALL CAPITAL TURNED M;Ll;0;L;;;;;N;;;;; +A7FB;LATIN EPIGRAPHIC LETTER REVERSED F;Lo;0;L;;;;;N;;;;; +A7FC;LATIN EPIGRAPHIC LETTER REVERSED P;Lo;0;L;;;;;N;;;;; +A7FD;LATIN EPIGRAPHIC LETTER INVERTED M;Lo;0;L;;;;;N;;;;; +A7FE;LATIN EPIGRAPHIC LETTER I LONGA;Lo;0;L;;;;;N;;;;; +A7FF;LATIN EPIGRAPHIC LETTER ARCHAIC M;Lo;0;L;;;;;N;;;;; +A800;SYLOTI NAGRI LETTER A;Lo;0;L;;;;;N;;;;; +A801;SYLOTI NAGRI LETTER I;Lo;0;L;;;;;N;;;;; +A802;SYLOTI NAGRI SIGN DVISVARA;Mn;0;NSM;;;;;N;;;;; +A803;SYLOTI NAGRI LETTER U;Lo;0;L;;;;;N;;;;; +A804;SYLOTI NAGRI LETTER E;Lo;0;L;;;;;N;;;;; +A805;SYLOTI NAGRI LETTER O;Lo;0;L;;;;;N;;;;; +A806;SYLOTI NAGRI SIGN HASANTA;Mn;9;NSM;;;;;N;;;;; +A807;SYLOTI NAGRI LETTER KO;Lo;0;L;;;;;N;;;;; +A808;SYLOTI NAGRI LETTER KHO;Lo;0;L;;;;;N;;;;; +A809;SYLOTI NAGRI LETTER GO;Lo;0;L;;;;;N;;;;; +A80A;SYLOTI NAGRI LETTER GHO;Lo;0;L;;;;;N;;;;; +A80B;SYLOTI NAGRI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +A80C;SYLOTI NAGRI LETTER CO;Lo;0;L;;;;;N;;;;; +A80D;SYLOTI NAGRI LETTER CHO;Lo;0;L;;;;;N;;;;; +A80E;SYLOTI NAGRI LETTER JO;Lo;0;L;;;;;N;;;;; +A80F;SYLOTI NAGRI LETTER JHO;Lo;0;L;;;;;N;;;;; +A810;SYLOTI NAGRI LETTER TTO;Lo;0;L;;;;;N;;;;; +A811;SYLOTI NAGRI LETTER TTHO;Lo;0;L;;;;;N;;;;; +A812;SYLOTI NAGRI LETTER DDO;Lo;0;L;;;;;N;;;;; +A813;SYLOTI NAGRI LETTER DDHO;Lo;0;L;;;;;N;;;;; +A814;SYLOTI NAGRI LETTER TO;Lo;0;L;;;;;N;;;;; +A815;SYLOTI NAGRI LETTER THO;Lo;0;L;;;;;N;;;;; +A816;SYLOTI NAGRI LETTER DO;Lo;0;L;;;;;N;;;;; +A817;SYLOTI NAGRI LETTER DHO;Lo;0;L;;;;;N;;;;; +A818;SYLOTI NAGRI LETTER NO;Lo;0;L;;;;;N;;;;; +A819;SYLOTI NAGRI LETTER PO;Lo;0;L;;;;;N;;;;; +A81A;SYLOTI NAGRI LETTER PHO;Lo;0;L;;;;;N;;;;; +A81B;SYLOTI NAGRI LETTER BO;Lo;0;L;;;;;N;;;;; +A81C;SYLOTI NAGRI LETTER BHO;Lo;0;L;;;;;N;;;;; +A81D;SYLOTI NAGRI LETTER MO;Lo;0;L;;;;;N;;;;; +A81E;SYLOTI NAGRI LETTER RO;Lo;0;L;;;;;N;;;;; +A81F;SYLOTI NAGRI LETTER LO;Lo;0;L;;;;;N;;;;; +A820;SYLOTI NAGRI LETTER RRO;Lo;0;L;;;;;N;;;;; +A821;SYLOTI NAGRI LETTER SO;Lo;0;L;;;;;N;;;;; +A822;SYLOTI NAGRI LETTER HO;Lo;0;L;;;;;N;;;;; +A823;SYLOTI NAGRI VOWEL SIGN A;Mc;0;L;;;;;N;;;;; +A824;SYLOTI NAGRI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +A825;SYLOTI NAGRI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +A826;SYLOTI NAGRI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +A827;SYLOTI NAGRI VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +A828;SYLOTI NAGRI POETRY MARK-1;So;0;ON;;;;;N;;;;; +A829;SYLOTI NAGRI POETRY MARK-2;So;0;ON;;;;;N;;;;; +A82A;SYLOTI NAGRI POETRY MARK-3;So;0;ON;;;;;N;;;;; +A82B;SYLOTI NAGRI POETRY MARK-4;So;0;ON;;;;;N;;;;; +A830;NORTH INDIC FRACTION ONE QUARTER;No;0;L;;;;1/4;N;;;;; +A831;NORTH INDIC FRACTION ONE HALF;No;0;L;;;;1/2;N;;;;; +A832;NORTH INDIC FRACTION THREE QUARTERS;No;0;L;;;;3/4;N;;;;; +A833;NORTH INDIC FRACTION ONE SIXTEENTH;No;0;L;;;;1/16;N;;;;; +A834;NORTH INDIC FRACTION ONE EIGHTH;No;0;L;;;;1/8;N;;;;; +A835;NORTH INDIC FRACTION THREE SIXTEENTHS;No;0;L;;;;3/16;N;;;;; +A836;NORTH INDIC QUARTER MARK;So;0;L;;;;;N;;;;; +A837;NORTH INDIC PLACEHOLDER MARK;So;0;L;;;;;N;;;;; +A838;NORTH INDIC RUPEE MARK;Sc;0;ET;;;;;N;;;;; +A839;NORTH INDIC QUANTITY MARK;So;0;ET;;;;;N;;;;; +A840;PHAGS-PA LETTER KA;Lo;0;L;;;;;N;;;;; +A841;PHAGS-PA LETTER KHA;Lo;0;L;;;;;N;;;;; +A842;PHAGS-PA LETTER GA;Lo;0;L;;;;;N;;;;; +A843;PHAGS-PA LETTER NGA;Lo;0;L;;;;;N;;;;; +A844;PHAGS-PA LETTER CA;Lo;0;L;;;;;N;;;;; +A845;PHAGS-PA LETTER CHA;Lo;0;L;;;;;N;;;;; +A846;PHAGS-PA LETTER JA;Lo;0;L;;;;;N;;;;; +A847;PHAGS-PA LETTER NYA;Lo;0;L;;;;;N;;;;; +A848;PHAGS-PA LETTER TA;Lo;0;L;;;;;N;;;;; +A849;PHAGS-PA LETTER THA;Lo;0;L;;;;;N;;;;; +A84A;PHAGS-PA LETTER DA;Lo;0;L;;;;;N;;;;; +A84B;PHAGS-PA LETTER NA;Lo;0;L;;;;;N;;;;; +A84C;PHAGS-PA LETTER PA;Lo;0;L;;;;;N;;;;; +A84D;PHAGS-PA LETTER PHA;Lo;0;L;;;;;N;;;;; +A84E;PHAGS-PA LETTER BA;Lo;0;L;;;;;N;;;;; +A84F;PHAGS-PA LETTER MA;Lo;0;L;;;;;N;;;;; +A850;PHAGS-PA LETTER TSA;Lo;0;L;;;;;N;;;;; +A851;PHAGS-PA LETTER TSHA;Lo;0;L;;;;;N;;;;; +A852;PHAGS-PA LETTER DZA;Lo;0;L;;;;;N;;;;; +A853;PHAGS-PA LETTER WA;Lo;0;L;;;;;N;;;;; +A854;PHAGS-PA LETTER ZHA;Lo;0;L;;;;;N;;;;; +A855;PHAGS-PA LETTER ZA;Lo;0;L;;;;;N;;;;; +A856;PHAGS-PA LETTER SMALL A;Lo;0;L;;;;;N;;;;; +A857;PHAGS-PA LETTER YA;Lo;0;L;;;;;N;;;;; +A858;PHAGS-PA LETTER RA;Lo;0;L;;;;;N;;;;; +A859;PHAGS-PA LETTER LA;Lo;0;L;;;;;N;;;;; +A85A;PHAGS-PA LETTER SHA;Lo;0;L;;;;;N;;;;; +A85B;PHAGS-PA LETTER SA;Lo;0;L;;;;;N;;;;; +A85C;PHAGS-PA LETTER HA;Lo;0;L;;;;;N;;;;; +A85D;PHAGS-PA LETTER A;Lo;0;L;;;;;N;;;;; +A85E;PHAGS-PA LETTER I;Lo;0;L;;;;;N;;;;; +A85F;PHAGS-PA LETTER U;Lo;0;L;;;;;N;;;;; +A860;PHAGS-PA LETTER E;Lo;0;L;;;;;N;;;;; +A861;PHAGS-PA LETTER O;Lo;0;L;;;;;N;;;;; +A862;PHAGS-PA LETTER QA;Lo;0;L;;;;;N;;;;; +A863;PHAGS-PA LETTER XA;Lo;0;L;;;;;N;;;;; +A864;PHAGS-PA LETTER FA;Lo;0;L;;;;;N;;;;; +A865;PHAGS-PA LETTER GGA;Lo;0;L;;;;;N;;;;; +A866;PHAGS-PA LETTER EE;Lo;0;L;;;;;N;;;;; +A867;PHAGS-PA SUBJOINED LETTER WA;Lo;0;L;;;;;N;;;;; +A868;PHAGS-PA SUBJOINED LETTER YA;Lo;0;L;;;;;N;;;;; +A869;PHAGS-PA LETTER TTA;Lo;0;L;;;;;N;;;;; +A86A;PHAGS-PA LETTER TTHA;Lo;0;L;;;;;N;;;;; +A86B;PHAGS-PA LETTER DDA;Lo;0;L;;;;;N;;;;; +A86C;PHAGS-PA LETTER NNA;Lo;0;L;;;;;N;;;;; +A86D;PHAGS-PA LETTER ALTERNATE YA;Lo;0;L;;;;;N;;;;; +A86E;PHAGS-PA LETTER VOICELESS SHA;Lo;0;L;;;;;N;;;;; +A86F;PHAGS-PA LETTER VOICED HA;Lo;0;L;;;;;N;;;;; +A870;PHAGS-PA LETTER ASPIRATED FA;Lo;0;L;;;;;N;;;;; +A871;PHAGS-PA SUBJOINED LETTER RA;Lo;0;L;;;;;N;;;;; +A872;PHAGS-PA SUPERFIXED LETTER RA;Lo;0;L;;;;;N;;;;; +A873;PHAGS-PA LETTER CANDRABINDU;Lo;0;L;;;;;N;;;;; +A874;PHAGS-PA SINGLE HEAD MARK;Po;0;ON;;;;;N;;;;; +A875;PHAGS-PA DOUBLE HEAD MARK;Po;0;ON;;;;;N;;;;; +A876;PHAGS-PA MARK SHAD;Po;0;ON;;;;;N;;;;; +A877;PHAGS-PA MARK DOUBLE SHAD;Po;0;ON;;;;;N;;;;; +A880;SAURASHTRA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +A881;SAURASHTRA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +A882;SAURASHTRA LETTER A;Lo;0;L;;;;;N;;;;; +A883;SAURASHTRA LETTER AA;Lo;0;L;;;;;N;;;;; +A884;SAURASHTRA LETTER I;Lo;0;L;;;;;N;;;;; +A885;SAURASHTRA LETTER II;Lo;0;L;;;;;N;;;;; +A886;SAURASHTRA LETTER U;Lo;0;L;;;;;N;;;;; +A887;SAURASHTRA LETTER UU;Lo;0;L;;;;;N;;;;; +A888;SAURASHTRA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +A889;SAURASHTRA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +A88A;SAURASHTRA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +A88B;SAURASHTRA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +A88C;SAURASHTRA LETTER E;Lo;0;L;;;;;N;;;;; +A88D;SAURASHTRA LETTER EE;Lo;0;L;;;;;N;;;;; +A88E;SAURASHTRA LETTER AI;Lo;0;L;;;;;N;;;;; +A88F;SAURASHTRA LETTER O;Lo;0;L;;;;;N;;;;; +A890;SAURASHTRA LETTER OO;Lo;0;L;;;;;N;;;;; +A891;SAURASHTRA LETTER AU;Lo;0;L;;;;;N;;;;; +A892;SAURASHTRA LETTER KA;Lo;0;L;;;;;N;;;;; +A893;SAURASHTRA LETTER KHA;Lo;0;L;;;;;N;;;;; +A894;SAURASHTRA LETTER GA;Lo;0;L;;;;;N;;;;; +A895;SAURASHTRA LETTER GHA;Lo;0;L;;;;;N;;;;; +A896;SAURASHTRA LETTER NGA;Lo;0;L;;;;;N;;;;; +A897;SAURASHTRA LETTER CA;Lo;0;L;;;;;N;;;;; +A898;SAURASHTRA LETTER CHA;Lo;0;L;;;;;N;;;;; +A899;SAURASHTRA LETTER JA;Lo;0;L;;;;;N;;;;; +A89A;SAURASHTRA LETTER JHA;Lo;0;L;;;;;N;;;;; +A89B;SAURASHTRA LETTER NYA;Lo;0;L;;;;;N;;;;; +A89C;SAURASHTRA LETTER TTA;Lo;0;L;;;;;N;;;;; +A89D;SAURASHTRA LETTER TTHA;Lo;0;L;;;;;N;;;;; +A89E;SAURASHTRA LETTER DDA;Lo;0;L;;;;;N;;;;; +A89F;SAURASHTRA LETTER DDHA;Lo;0;L;;;;;N;;;;; +A8A0;SAURASHTRA LETTER NNA;Lo;0;L;;;;;N;;;;; +A8A1;SAURASHTRA LETTER TA;Lo;0;L;;;;;N;;;;; +A8A2;SAURASHTRA LETTER THA;Lo;0;L;;;;;N;;;;; +A8A3;SAURASHTRA LETTER DA;Lo;0;L;;;;;N;;;;; +A8A4;SAURASHTRA LETTER DHA;Lo;0;L;;;;;N;;;;; +A8A5;SAURASHTRA LETTER NA;Lo;0;L;;;;;N;;;;; +A8A6;SAURASHTRA LETTER PA;Lo;0;L;;;;;N;;;;; +A8A7;SAURASHTRA LETTER PHA;Lo;0;L;;;;;N;;;;; +A8A8;SAURASHTRA LETTER BA;Lo;0;L;;;;;N;;;;; +A8A9;SAURASHTRA LETTER BHA;Lo;0;L;;;;;N;;;;; +A8AA;SAURASHTRA LETTER MA;Lo;0;L;;;;;N;;;;; +A8AB;SAURASHTRA LETTER YA;Lo;0;L;;;;;N;;;;; +A8AC;SAURASHTRA LETTER RA;Lo;0;L;;;;;N;;;;; +A8AD;SAURASHTRA LETTER LA;Lo;0;L;;;;;N;;;;; +A8AE;SAURASHTRA LETTER VA;Lo;0;L;;;;;N;;;;; +A8AF;SAURASHTRA LETTER SHA;Lo;0;L;;;;;N;;;;; +A8B0;SAURASHTRA LETTER SSA;Lo;0;L;;;;;N;;;;; +A8B1;SAURASHTRA LETTER SA;Lo;0;L;;;;;N;;;;; +A8B2;SAURASHTRA LETTER HA;Lo;0;L;;;;;N;;;;; +A8B3;SAURASHTRA LETTER LLA;Lo;0;L;;;;;N;;;;; +A8B4;SAURASHTRA CONSONANT SIGN HAARU;Mc;0;L;;;;;N;;;;; +A8B5;SAURASHTRA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +A8B6;SAURASHTRA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +A8B7;SAURASHTRA VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +A8B8;SAURASHTRA VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +A8B9;SAURASHTRA VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +A8BA;SAURASHTRA VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;; +A8BB;SAURASHTRA VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;; +A8BC;SAURASHTRA VOWEL SIGN VOCALIC L;Mc;0;L;;;;;N;;;;; +A8BD;SAURASHTRA VOWEL SIGN VOCALIC LL;Mc;0;L;;;;;N;;;;; +A8BE;SAURASHTRA VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +A8BF;SAURASHTRA VOWEL SIGN EE;Mc;0;L;;;;;N;;;;; +A8C0;SAURASHTRA VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +A8C1;SAURASHTRA VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +A8C2;SAURASHTRA VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +A8C3;SAURASHTRA VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +A8C4;SAURASHTRA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +A8C5;SAURASHTRA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +A8CE;SAURASHTRA DANDA;Po;0;L;;;;;N;;;;; +A8CF;SAURASHTRA DOUBLE DANDA;Po;0;L;;;;;N;;;;; +A8D0;SAURASHTRA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +A8D1;SAURASHTRA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +A8D2;SAURASHTRA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +A8D3;SAURASHTRA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +A8D4;SAURASHTRA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +A8D5;SAURASHTRA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +A8D6;SAURASHTRA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +A8D7;SAURASHTRA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +A8D8;SAURASHTRA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +A8D9;SAURASHTRA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +A8E0;COMBINING DEVANAGARI DIGIT ZERO;Mn;230;NSM;;;;;N;;;;; +A8E1;COMBINING DEVANAGARI DIGIT ONE;Mn;230;NSM;;;;;N;;;;; +A8E2;COMBINING DEVANAGARI DIGIT TWO;Mn;230;NSM;;;;;N;;;;; +A8E3;COMBINING DEVANAGARI DIGIT THREE;Mn;230;NSM;;;;;N;;;;; +A8E4;COMBINING DEVANAGARI DIGIT FOUR;Mn;230;NSM;;;;;N;;;;; +A8E5;COMBINING DEVANAGARI DIGIT FIVE;Mn;230;NSM;;;;;N;;;;; +A8E6;COMBINING DEVANAGARI DIGIT SIX;Mn;230;NSM;;;;;N;;;;; +A8E7;COMBINING DEVANAGARI DIGIT SEVEN;Mn;230;NSM;;;;;N;;;;; +A8E8;COMBINING DEVANAGARI DIGIT EIGHT;Mn;230;NSM;;;;;N;;;;; +A8E9;COMBINING DEVANAGARI DIGIT NINE;Mn;230;NSM;;;;;N;;;;; +A8EA;COMBINING DEVANAGARI LETTER A;Mn;230;NSM;;;;;N;;;;; +A8EB;COMBINING DEVANAGARI LETTER U;Mn;230;NSM;;;;;N;;;;; +A8EC;COMBINING DEVANAGARI LETTER KA;Mn;230;NSM;;;;;N;;;;; +A8ED;COMBINING DEVANAGARI LETTER NA;Mn;230;NSM;;;;;N;;;;; +A8EE;COMBINING DEVANAGARI LETTER PA;Mn;230;NSM;;;;;N;;;;; +A8EF;COMBINING DEVANAGARI LETTER RA;Mn;230;NSM;;;;;N;;;;; +A8F0;COMBINING DEVANAGARI LETTER VI;Mn;230;NSM;;;;;N;;;;; +A8F1;COMBINING DEVANAGARI SIGN AVAGRAHA;Mn;230;NSM;;;;;N;;;;; +A8F2;DEVANAGARI SIGN SPACING CANDRABINDU;Lo;0;L;;;;;N;;;;; +A8F3;DEVANAGARI SIGN CANDRABINDU VIRAMA;Lo;0;L;;;;;N;;;;; +A8F4;DEVANAGARI SIGN DOUBLE CANDRABINDU VIRAMA;Lo;0;L;;;;;N;;;;; +A8F5;DEVANAGARI SIGN CANDRABINDU TWO;Lo;0;L;;;;;N;;;;; +A8F6;DEVANAGARI SIGN CANDRABINDU THREE;Lo;0;L;;;;;N;;;;; +A8F7;DEVANAGARI SIGN CANDRABINDU AVAGRAHA;Lo;0;L;;;;;N;;;;; +A8F8;DEVANAGARI SIGN PUSHPIKA;Po;0;L;;;;;N;;;;; +A8F9;DEVANAGARI GAP FILLER;Po;0;L;;;;;N;;;;; +A8FA;DEVANAGARI CARET;Po;0;L;;;;;N;;;;; +A8FB;DEVANAGARI HEADSTROKE;Lo;0;L;;;;;N;;;;; +A8FC;DEVANAGARI SIGN SIDDHAM;Po;0;L;;;;;N;;;;; +A8FD;DEVANAGARI JAIN OM;Lo;0;L;;;;;N;;;;; +A900;KAYAH LI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +A901;KAYAH LI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +A902;KAYAH LI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +A903;KAYAH LI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +A904;KAYAH LI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +A905;KAYAH LI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +A906;KAYAH LI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +A907;KAYAH LI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +A908;KAYAH LI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +A909;KAYAH LI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +A90A;KAYAH LI LETTER KA;Lo;0;L;;;;;N;;;;; +A90B;KAYAH LI LETTER KHA;Lo;0;L;;;;;N;;;;; +A90C;KAYAH LI LETTER GA;Lo;0;L;;;;;N;;;;; +A90D;KAYAH LI LETTER NGA;Lo;0;L;;;;;N;;;;; +A90E;KAYAH LI LETTER SA;Lo;0;L;;;;;N;;;;; +A90F;KAYAH LI LETTER SHA;Lo;0;L;;;;;N;;;;; +A910;KAYAH LI LETTER ZA;Lo;0;L;;;;;N;;;;; +A911;KAYAH LI LETTER NYA;Lo;0;L;;;;;N;;;;; +A912;KAYAH LI LETTER TA;Lo;0;L;;;;;N;;;;; +A913;KAYAH LI LETTER HTA;Lo;0;L;;;;;N;;;;; +A914;KAYAH LI LETTER NA;Lo;0;L;;;;;N;;;;; +A915;KAYAH LI LETTER PA;Lo;0;L;;;;;N;;;;; +A916;KAYAH LI LETTER PHA;Lo;0;L;;;;;N;;;;; +A917;KAYAH LI LETTER MA;Lo;0;L;;;;;N;;;;; +A918;KAYAH LI LETTER DA;Lo;0;L;;;;;N;;;;; +A919;KAYAH LI LETTER BA;Lo;0;L;;;;;N;;;;; +A91A;KAYAH LI LETTER RA;Lo;0;L;;;;;N;;;;; +A91B;KAYAH LI LETTER YA;Lo;0;L;;;;;N;;;;; +A91C;KAYAH LI LETTER LA;Lo;0;L;;;;;N;;;;; +A91D;KAYAH LI LETTER WA;Lo;0;L;;;;;N;;;;; +A91E;KAYAH LI LETTER THA;Lo;0;L;;;;;N;;;;; +A91F;KAYAH LI LETTER HA;Lo;0;L;;;;;N;;;;; +A920;KAYAH LI LETTER VA;Lo;0;L;;;;;N;;;;; +A921;KAYAH LI LETTER CA;Lo;0;L;;;;;N;;;;; +A922;KAYAH LI LETTER A;Lo;0;L;;;;;N;;;;; +A923;KAYAH LI LETTER OE;Lo;0;L;;;;;N;;;;; +A924;KAYAH LI LETTER I;Lo;0;L;;;;;N;;;;; +A925;KAYAH LI LETTER OO;Lo;0;L;;;;;N;;;;; +A926;KAYAH LI VOWEL UE;Mn;0;NSM;;;;;N;;;;; +A927;KAYAH LI VOWEL E;Mn;0;NSM;;;;;N;;;;; +A928;KAYAH LI VOWEL U;Mn;0;NSM;;;;;N;;;;; +A929;KAYAH LI VOWEL EE;Mn;0;NSM;;;;;N;;;;; +A92A;KAYAH LI VOWEL O;Mn;0;NSM;;;;;N;;;;; +A92B;KAYAH LI TONE PLOPHU;Mn;220;NSM;;;;;N;;;;; +A92C;KAYAH LI TONE CALYA;Mn;220;NSM;;;;;N;;;;; +A92D;KAYAH LI TONE CALYA PLOPHU;Mn;220;NSM;;;;;N;;;;; +A92E;KAYAH LI SIGN CWI;Po;0;L;;;;;N;;;;; +A92F;KAYAH LI SIGN SHYA;Po;0;L;;;;;N;;;;; +A930;REJANG LETTER KA;Lo;0;L;;;;;N;;;;; +A931;REJANG LETTER GA;Lo;0;L;;;;;N;;;;; +A932;REJANG LETTER NGA;Lo;0;L;;;;;N;;;;; +A933;REJANG LETTER TA;Lo;0;L;;;;;N;;;;; +A934;REJANG LETTER DA;Lo;0;L;;;;;N;;;;; +A935;REJANG LETTER NA;Lo;0;L;;;;;N;;;;; +A936;REJANG LETTER PA;Lo;0;L;;;;;N;;;;; +A937;REJANG LETTER BA;Lo;0;L;;;;;N;;;;; +A938;REJANG LETTER MA;Lo;0;L;;;;;N;;;;; +A939;REJANG LETTER CA;Lo;0;L;;;;;N;;;;; +A93A;REJANG LETTER JA;Lo;0;L;;;;;N;;;;; +A93B;REJANG LETTER NYA;Lo;0;L;;;;;N;;;;; +A93C;REJANG LETTER SA;Lo;0;L;;;;;N;;;;; +A93D;REJANG LETTER RA;Lo;0;L;;;;;N;;;;; +A93E;REJANG LETTER LA;Lo;0;L;;;;;N;;;;; +A93F;REJANG LETTER YA;Lo;0;L;;;;;N;;;;; +A940;REJANG LETTER WA;Lo;0;L;;;;;N;;;;; +A941;REJANG LETTER HA;Lo;0;L;;;;;N;;;;; +A942;REJANG LETTER MBA;Lo;0;L;;;;;N;;;;; +A943;REJANG LETTER NGGA;Lo;0;L;;;;;N;;;;; +A944;REJANG LETTER NDA;Lo;0;L;;;;;N;;;;; +A945;REJANG LETTER NYJA;Lo;0;L;;;;;N;;;;; +A946;REJANG LETTER A;Lo;0;L;;;;;N;;;;; +A947;REJANG VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +A948;REJANG VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +A949;REJANG VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +A94A;REJANG VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +A94B;REJANG VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +A94C;REJANG VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +A94D;REJANG VOWEL SIGN EU;Mn;0;NSM;;;;;N;;;;; +A94E;REJANG VOWEL SIGN EA;Mn;0;NSM;;;;;N;;;;; +A94F;REJANG CONSONANT SIGN NG;Mn;0;NSM;;;;;N;;;;; +A950;REJANG CONSONANT SIGN N;Mn;0;NSM;;;;;N;;;;; +A951;REJANG CONSONANT SIGN R;Mn;0;NSM;;;;;N;;;;; +A952;REJANG CONSONANT SIGN H;Mc;0;L;;;;;N;;;;; +A953;REJANG VIRAMA;Mc;9;L;;;;;N;;;;; +A95F;REJANG SECTION MARK;Po;0;L;;;;;N;;;;; +A960;HANGUL CHOSEONG TIKEUT-MIEUM;Lo;0;L;;;;;N;;;;; +A961;HANGUL CHOSEONG TIKEUT-PIEUP;Lo;0;L;;;;;N;;;;; +A962;HANGUL CHOSEONG TIKEUT-SIOS;Lo;0;L;;;;;N;;;;; +A963;HANGUL CHOSEONG TIKEUT-CIEUC;Lo;0;L;;;;;N;;;;; +A964;HANGUL CHOSEONG RIEUL-KIYEOK;Lo;0;L;;;;;N;;;;; +A965;HANGUL CHOSEONG RIEUL-SSANGKIYEOK;Lo;0;L;;;;;N;;;;; +A966;HANGUL CHOSEONG RIEUL-TIKEUT;Lo;0;L;;;;;N;;;;; +A967;HANGUL CHOSEONG RIEUL-SSANGTIKEUT;Lo;0;L;;;;;N;;;;; +A968;HANGUL CHOSEONG RIEUL-MIEUM;Lo;0;L;;;;;N;;;;; +A969;HANGUL CHOSEONG RIEUL-PIEUP;Lo;0;L;;;;;N;;;;; +A96A;HANGUL CHOSEONG RIEUL-SSANGPIEUP;Lo;0;L;;;;;N;;;;; +A96B;HANGUL CHOSEONG RIEUL-KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;; +A96C;HANGUL CHOSEONG RIEUL-SIOS;Lo;0;L;;;;;N;;;;; +A96D;HANGUL CHOSEONG RIEUL-CIEUC;Lo;0;L;;;;;N;;;;; +A96E;HANGUL CHOSEONG RIEUL-KHIEUKH;Lo;0;L;;;;;N;;;;; +A96F;HANGUL CHOSEONG MIEUM-KIYEOK;Lo;0;L;;;;;N;;;;; +A970;HANGUL CHOSEONG MIEUM-TIKEUT;Lo;0;L;;;;;N;;;;; +A971;HANGUL CHOSEONG MIEUM-SIOS;Lo;0;L;;;;;N;;;;; +A972;HANGUL CHOSEONG PIEUP-SIOS-THIEUTH;Lo;0;L;;;;;N;;;;; +A973;HANGUL CHOSEONG PIEUP-KHIEUKH;Lo;0;L;;;;;N;;;;; +A974;HANGUL CHOSEONG PIEUP-HIEUH;Lo;0;L;;;;;N;;;;; +A975;HANGUL CHOSEONG SSANGSIOS-PIEUP;Lo;0;L;;;;;N;;;;; +A976;HANGUL CHOSEONG IEUNG-RIEUL;Lo;0;L;;;;;N;;;;; +A977;HANGUL CHOSEONG IEUNG-HIEUH;Lo;0;L;;;;;N;;;;; +A978;HANGUL CHOSEONG SSANGCIEUC-HIEUH;Lo;0;L;;;;;N;;;;; +A979;HANGUL CHOSEONG SSANGTHIEUTH;Lo;0;L;;;;;N;;;;; +A97A;HANGUL CHOSEONG PHIEUPH-HIEUH;Lo;0;L;;;;;N;;;;; +A97B;HANGUL CHOSEONG HIEUH-SIOS;Lo;0;L;;;;;N;;;;; +A97C;HANGUL CHOSEONG SSANGYEORINHIEUH;Lo;0;L;;;;;N;;;;; +A980;JAVANESE SIGN PANYANGGA;Mn;0;NSM;;;;;N;;;;; +A981;JAVANESE SIGN CECAK;Mn;0;NSM;;;;;N;;;;; +A982;JAVANESE SIGN LAYAR;Mn;0;NSM;;;;;N;;;;; +A983;JAVANESE SIGN WIGNYAN;Mc;0;L;;;;;N;;;;; +A984;JAVANESE LETTER A;Lo;0;L;;;;;N;;;;; +A985;JAVANESE LETTER I KAWI;Lo;0;L;;;;;N;;;;; +A986;JAVANESE LETTER I;Lo;0;L;;;;;N;;;;; +A987;JAVANESE LETTER II;Lo;0;L;;;;;N;;;;; +A988;JAVANESE LETTER U;Lo;0;L;;;;;N;;;;; +A989;JAVANESE LETTER PA CEREK;Lo;0;L;;;;;N;;;;; +A98A;JAVANESE LETTER NGA LELET;Lo;0;L;;;;;N;;;;; +A98B;JAVANESE LETTER NGA LELET RASWADI;Lo;0;L;;;;;N;;;;; +A98C;JAVANESE LETTER E;Lo;0;L;;;;;N;;;;; +A98D;JAVANESE LETTER AI;Lo;0;L;;;;;N;;;;; +A98E;JAVANESE LETTER O;Lo;0;L;;;;;N;;;;; +A98F;JAVANESE LETTER KA;Lo;0;L;;;;;N;;;;; +A990;JAVANESE LETTER KA SASAK;Lo;0;L;;;;;N;;;;; +A991;JAVANESE LETTER KA MURDA;Lo;0;L;;;;;N;;;;; +A992;JAVANESE LETTER GA;Lo;0;L;;;;;N;;;;; +A993;JAVANESE LETTER GA MURDA;Lo;0;L;;;;;N;;;;; +A994;JAVANESE LETTER NGA;Lo;0;L;;;;;N;;;;; +A995;JAVANESE LETTER CA;Lo;0;L;;;;;N;;;;; +A996;JAVANESE LETTER CA MURDA;Lo;0;L;;;;;N;;;;; +A997;JAVANESE LETTER JA;Lo;0;L;;;;;N;;;;; +A998;JAVANESE LETTER NYA MURDA;Lo;0;L;;;;;N;;;;; +A999;JAVANESE LETTER JA MAHAPRANA;Lo;0;L;;;;;N;;;;; +A99A;JAVANESE LETTER NYA;Lo;0;L;;;;;N;;;;; +A99B;JAVANESE LETTER TTA;Lo;0;L;;;;;N;;;;; +A99C;JAVANESE LETTER TTA MAHAPRANA;Lo;0;L;;;;;N;;;;; +A99D;JAVANESE LETTER DDA;Lo;0;L;;;;;N;;;;; +A99E;JAVANESE LETTER DDA MAHAPRANA;Lo;0;L;;;;;N;;;;; +A99F;JAVANESE LETTER NA MURDA;Lo;0;L;;;;;N;;;;; +A9A0;JAVANESE LETTER TA;Lo;0;L;;;;;N;;;;; +A9A1;JAVANESE LETTER TA MURDA;Lo;0;L;;;;;N;;;;; +A9A2;JAVANESE LETTER DA;Lo;0;L;;;;;N;;;;; +A9A3;JAVANESE LETTER DA MAHAPRANA;Lo;0;L;;;;;N;;;;; +A9A4;JAVANESE LETTER NA;Lo;0;L;;;;;N;;;;; +A9A5;JAVANESE LETTER PA;Lo;0;L;;;;;N;;;;; +A9A6;JAVANESE LETTER PA MURDA;Lo;0;L;;;;;N;;;;; +A9A7;JAVANESE LETTER BA;Lo;0;L;;;;;N;;;;; +A9A8;JAVANESE LETTER BA MURDA;Lo;0;L;;;;;N;;;;; +A9A9;JAVANESE LETTER MA;Lo;0;L;;;;;N;;;;; +A9AA;JAVANESE LETTER YA;Lo;0;L;;;;;N;;;;; +A9AB;JAVANESE LETTER RA;Lo;0;L;;;;;N;;;;; +A9AC;JAVANESE LETTER RA AGUNG;Lo;0;L;;;;;N;;;;; +A9AD;JAVANESE LETTER LA;Lo;0;L;;;;;N;;;;; +A9AE;JAVANESE LETTER WA;Lo;0;L;;;;;N;;;;; +A9AF;JAVANESE LETTER SA MURDA;Lo;0;L;;;;;N;;;;; +A9B0;JAVANESE LETTER SA MAHAPRANA;Lo;0;L;;;;;N;;;;; +A9B1;JAVANESE LETTER SA;Lo;0;L;;;;;N;;;;; +A9B2;JAVANESE LETTER HA;Lo;0;L;;;;;N;;;;; +A9B3;JAVANESE SIGN CECAK TELU;Mn;7;NSM;;;;;N;;;;; +A9B4;JAVANESE VOWEL SIGN TARUNG;Mc;0;L;;;;;N;;;;; +A9B5;JAVANESE VOWEL SIGN TOLONG;Mc;0;L;;;;;N;;;;; +A9B6;JAVANESE VOWEL SIGN WULU;Mn;0;NSM;;;;;N;;;;; +A9B7;JAVANESE VOWEL SIGN WULU MELIK;Mn;0;NSM;;;;;N;;;;; +A9B8;JAVANESE VOWEL SIGN SUKU;Mn;0;NSM;;;;;N;;;;; +A9B9;JAVANESE VOWEL SIGN SUKU MENDUT;Mn;0;NSM;;;;;N;;;;; +A9BA;JAVANESE VOWEL SIGN TALING;Mc;0;L;;;;;N;;;;; +A9BB;JAVANESE VOWEL SIGN DIRGA MURE;Mc;0;L;;;;;N;;;;; +A9BC;JAVANESE VOWEL SIGN PEPET;Mn;0;NSM;;;;;N;;;;; +A9BD;JAVANESE CONSONANT SIGN KERET;Mc;0;L;;;;;N;;;;; +A9BE;JAVANESE CONSONANT SIGN PENGKAL;Mc;0;L;;;;;N;;;;; +A9BF;JAVANESE CONSONANT SIGN CAKRA;Mc;0;L;;;;;N;;;;; +A9C0;JAVANESE PANGKON;Mc;9;L;;;;;N;;;;; +A9C1;JAVANESE LEFT RERENGGAN;Po;0;L;;;;;N;;;;; +A9C2;JAVANESE RIGHT RERENGGAN;Po;0;L;;;;;N;;;;; +A9C3;JAVANESE PADA ANDAP;Po;0;L;;;;;N;;;;; +A9C4;JAVANESE PADA MADYA;Po;0;L;;;;;N;;;;; +A9C5;JAVANESE PADA LUHUR;Po;0;L;;;;;N;;;;; +A9C6;JAVANESE PADA WINDU;Po;0;L;;;;;N;;;;; +A9C7;JAVANESE PADA PANGKAT;Po;0;L;;;;;N;;;;; +A9C8;JAVANESE PADA LINGSA;Po;0;L;;;;;N;;;;; +A9C9;JAVANESE PADA LUNGSI;Po;0;L;;;;;N;;;;; +A9CA;JAVANESE PADA ADEG;Po;0;L;;;;;N;;;;; +A9CB;JAVANESE PADA ADEG ADEG;Po;0;L;;;;;N;;;;; +A9CC;JAVANESE PADA PISELEH;Po;0;L;;;;;N;;;;; +A9CD;JAVANESE TURNED PADA PISELEH;Po;0;L;;;;;N;;;;; +A9CF;JAVANESE PANGRANGKEP;Lm;0;L;;;;;N;;;;; +A9D0;JAVANESE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +A9D1;JAVANESE DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +A9D2;JAVANESE DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +A9D3;JAVANESE DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +A9D4;JAVANESE DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +A9D5;JAVANESE DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +A9D6;JAVANESE DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +A9D7;JAVANESE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +A9D8;JAVANESE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +A9D9;JAVANESE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +A9DE;JAVANESE PADA TIRTA TUMETES;Po;0;L;;;;;N;;;;; +A9DF;JAVANESE PADA ISEN-ISEN;Po;0;L;;;;;N;;;;; +A9E0;MYANMAR LETTER SHAN GHA;Lo;0;L;;;;;N;;;;; +A9E1;MYANMAR LETTER SHAN CHA;Lo;0;L;;;;;N;;;;; +A9E2;MYANMAR LETTER SHAN JHA;Lo;0;L;;;;;N;;;;; +A9E3;MYANMAR LETTER SHAN NNA;Lo;0;L;;;;;N;;;;; +A9E4;MYANMAR LETTER SHAN BHA;Lo;0;L;;;;;N;;;;; +A9E5;MYANMAR SIGN SHAN SAW;Mn;0;NSM;;;;;N;;;;; +A9E6;MYANMAR MODIFIER LETTER SHAN REDUPLICATION;Lm;0;L;;;;;N;;;;; +A9E7;MYANMAR LETTER TAI LAING NYA;Lo;0;L;;;;;N;;;;; +A9E8;MYANMAR LETTER TAI LAING FA;Lo;0;L;;;;;N;;;;; +A9E9;MYANMAR LETTER TAI LAING GA;Lo;0;L;;;;;N;;;;; +A9EA;MYANMAR LETTER TAI LAING GHA;Lo;0;L;;;;;N;;;;; +A9EB;MYANMAR LETTER TAI LAING JA;Lo;0;L;;;;;N;;;;; +A9EC;MYANMAR LETTER TAI LAING JHA;Lo;0;L;;;;;N;;;;; +A9ED;MYANMAR LETTER TAI LAING DDA;Lo;0;L;;;;;N;;;;; +A9EE;MYANMAR LETTER TAI LAING DDHA;Lo;0;L;;;;;N;;;;; +A9EF;MYANMAR LETTER TAI LAING NNA;Lo;0;L;;;;;N;;;;; +A9F0;MYANMAR TAI LAING DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +A9F1;MYANMAR TAI LAING DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +A9F2;MYANMAR TAI LAING DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +A9F3;MYANMAR TAI LAING DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +A9F4;MYANMAR TAI LAING DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +A9F5;MYANMAR TAI LAING DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +A9F6;MYANMAR TAI LAING DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +A9F7;MYANMAR TAI LAING DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +A9F8;MYANMAR TAI LAING DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +A9F9;MYANMAR TAI LAING DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +A9FA;MYANMAR LETTER TAI LAING LLA;Lo;0;L;;;;;N;;;;; +A9FB;MYANMAR LETTER TAI LAING DA;Lo;0;L;;;;;N;;;;; +A9FC;MYANMAR LETTER TAI LAING DHA;Lo;0;L;;;;;N;;;;; +A9FD;MYANMAR LETTER TAI LAING BA;Lo;0;L;;;;;N;;;;; +A9FE;MYANMAR LETTER TAI LAING BHA;Lo;0;L;;;;;N;;;;; +AA00;CHAM LETTER A;Lo;0;L;;;;;N;;;;; +AA01;CHAM LETTER I;Lo;0;L;;;;;N;;;;; +AA02;CHAM LETTER U;Lo;0;L;;;;;N;;;;; +AA03;CHAM LETTER E;Lo;0;L;;;;;N;;;;; +AA04;CHAM LETTER AI;Lo;0;L;;;;;N;;;;; +AA05;CHAM LETTER O;Lo;0;L;;;;;N;;;;; +AA06;CHAM LETTER KA;Lo;0;L;;;;;N;;;;; +AA07;CHAM LETTER KHA;Lo;0;L;;;;;N;;;;; +AA08;CHAM LETTER GA;Lo;0;L;;;;;N;;;;; +AA09;CHAM LETTER GHA;Lo;0;L;;;;;N;;;;; +AA0A;CHAM LETTER NGUE;Lo;0;L;;;;;N;;;;; +AA0B;CHAM LETTER NGA;Lo;0;L;;;;;N;;;;; +AA0C;CHAM LETTER CHA;Lo;0;L;;;;;N;;;;; +AA0D;CHAM LETTER CHHA;Lo;0;L;;;;;N;;;;; +AA0E;CHAM LETTER JA;Lo;0;L;;;;;N;;;;; +AA0F;CHAM LETTER JHA;Lo;0;L;;;;;N;;;;; +AA10;CHAM LETTER NHUE;Lo;0;L;;;;;N;;;;; +AA11;CHAM LETTER NHA;Lo;0;L;;;;;N;;;;; +AA12;CHAM LETTER NHJA;Lo;0;L;;;;;N;;;;; +AA13;CHAM LETTER TA;Lo;0;L;;;;;N;;;;; +AA14;CHAM LETTER THA;Lo;0;L;;;;;N;;;;; +AA15;CHAM LETTER DA;Lo;0;L;;;;;N;;;;; +AA16;CHAM LETTER DHA;Lo;0;L;;;;;N;;;;; +AA17;CHAM LETTER NUE;Lo;0;L;;;;;N;;;;; +AA18;CHAM LETTER NA;Lo;0;L;;;;;N;;;;; +AA19;CHAM LETTER DDA;Lo;0;L;;;;;N;;;;; +AA1A;CHAM LETTER PA;Lo;0;L;;;;;N;;;;; +AA1B;CHAM LETTER PPA;Lo;0;L;;;;;N;;;;; +AA1C;CHAM LETTER PHA;Lo;0;L;;;;;N;;;;; +AA1D;CHAM LETTER BA;Lo;0;L;;;;;N;;;;; +AA1E;CHAM LETTER BHA;Lo;0;L;;;;;N;;;;; +AA1F;CHAM LETTER MUE;Lo;0;L;;;;;N;;;;; +AA20;CHAM LETTER MA;Lo;0;L;;;;;N;;;;; +AA21;CHAM LETTER BBA;Lo;0;L;;;;;N;;;;; +AA22;CHAM LETTER YA;Lo;0;L;;;;;N;;;;; +AA23;CHAM LETTER RA;Lo;0;L;;;;;N;;;;; +AA24;CHAM LETTER LA;Lo;0;L;;;;;N;;;;; +AA25;CHAM LETTER VA;Lo;0;L;;;;;N;;;;; +AA26;CHAM LETTER SSA;Lo;0;L;;;;;N;;;;; +AA27;CHAM LETTER SA;Lo;0;L;;;;;N;;;;; +AA28;CHAM LETTER HA;Lo;0;L;;;;;N;;;;; +AA29;CHAM VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +AA2A;CHAM VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +AA2B;CHAM VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +AA2C;CHAM VOWEL SIGN EI;Mn;0;NSM;;;;;N;;;;; +AA2D;CHAM VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +AA2E;CHAM VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;; +AA2F;CHAM VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +AA30;CHAM VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +AA31;CHAM VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +AA32;CHAM VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +AA33;CHAM CONSONANT SIGN YA;Mc;0;L;;;;;N;;;;; +AA34;CHAM CONSONANT SIGN RA;Mc;0;L;;;;;N;;;;; +AA35;CHAM CONSONANT SIGN LA;Mn;0;NSM;;;;;N;;;;; +AA36;CHAM CONSONANT SIGN WA;Mn;0;NSM;;;;;N;;;;; +AA40;CHAM LETTER FINAL K;Lo;0;L;;;;;N;;;;; +AA41;CHAM LETTER FINAL G;Lo;0;L;;;;;N;;;;; +AA42;CHAM LETTER FINAL NG;Lo;0;L;;;;;N;;;;; +AA43;CHAM CONSONANT SIGN FINAL NG;Mn;0;NSM;;;;;N;;;;; +AA44;CHAM LETTER FINAL CH;Lo;0;L;;;;;N;;;;; +AA45;CHAM LETTER FINAL T;Lo;0;L;;;;;N;;;;; +AA46;CHAM LETTER FINAL N;Lo;0;L;;;;;N;;;;; +AA47;CHAM LETTER FINAL P;Lo;0;L;;;;;N;;;;; +AA48;CHAM LETTER FINAL Y;Lo;0;L;;;;;N;;;;; +AA49;CHAM LETTER FINAL R;Lo;0;L;;;;;N;;;;; +AA4A;CHAM LETTER FINAL L;Lo;0;L;;;;;N;;;;; +AA4B;CHAM LETTER FINAL SS;Lo;0;L;;;;;N;;;;; +AA4C;CHAM CONSONANT SIGN FINAL M;Mn;0;NSM;;;;;N;;;;; +AA4D;CHAM CONSONANT SIGN FINAL H;Mc;0;L;;;;;N;;;;; +AA50;CHAM DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +AA51;CHAM DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +AA52;CHAM DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +AA53;CHAM DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +AA54;CHAM DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +AA55;CHAM DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +AA56;CHAM DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +AA57;CHAM DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +AA58;CHAM DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +AA59;CHAM DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +AA5C;CHAM PUNCTUATION SPIRAL;Po;0;L;;;;;N;;;;; +AA5D;CHAM PUNCTUATION DANDA;Po;0;L;;;;;N;;;;; +AA5E;CHAM PUNCTUATION DOUBLE DANDA;Po;0;L;;;;;N;;;;; +AA5F;CHAM PUNCTUATION TRIPLE DANDA;Po;0;L;;;;;N;;;;; +AA60;MYANMAR LETTER KHAMTI GA;Lo;0;L;;;;;N;;;;; +AA61;MYANMAR LETTER KHAMTI CA;Lo;0;L;;;;;N;;;;; +AA62;MYANMAR LETTER KHAMTI CHA;Lo;0;L;;;;;N;;;;; +AA63;MYANMAR LETTER KHAMTI JA;Lo;0;L;;;;;N;;;;; +AA64;MYANMAR LETTER KHAMTI JHA;Lo;0;L;;;;;N;;;;; +AA65;MYANMAR LETTER KHAMTI NYA;Lo;0;L;;;;;N;;;;; +AA66;MYANMAR LETTER KHAMTI TTA;Lo;0;L;;;;;N;;;;; +AA67;MYANMAR LETTER KHAMTI TTHA;Lo;0;L;;;;;N;;;;; +AA68;MYANMAR LETTER KHAMTI DDA;Lo;0;L;;;;;N;;;;; +AA69;MYANMAR LETTER KHAMTI DDHA;Lo;0;L;;;;;N;;;;; +AA6A;MYANMAR LETTER KHAMTI DHA;Lo;0;L;;;;;N;;;;; +AA6B;MYANMAR LETTER KHAMTI NA;Lo;0;L;;;;;N;;;;; +AA6C;MYANMAR LETTER KHAMTI SA;Lo;0;L;;;;;N;;;;; +AA6D;MYANMAR LETTER KHAMTI HA;Lo;0;L;;;;;N;;;;; +AA6E;MYANMAR LETTER KHAMTI HHA;Lo;0;L;;;;;N;;;;; +AA6F;MYANMAR LETTER KHAMTI FA;Lo;0;L;;;;;N;;;;; +AA70;MYANMAR MODIFIER LETTER KHAMTI REDUPLICATION;Lm;0;L;;;;;N;;;;; +AA71;MYANMAR LETTER KHAMTI XA;Lo;0;L;;;;;N;;;;; +AA72;MYANMAR LETTER KHAMTI ZA;Lo;0;L;;;;;N;;;;; +AA73;MYANMAR LETTER KHAMTI RA;Lo;0;L;;;;;N;;;;; +AA74;MYANMAR LOGOGRAM KHAMTI OAY;Lo;0;L;;;;;N;;;;; +AA75;MYANMAR LOGOGRAM KHAMTI QN;Lo;0;L;;;;;N;;;;; +AA76;MYANMAR LOGOGRAM KHAMTI HM;Lo;0;L;;;;;N;;;;; +AA77;MYANMAR SYMBOL AITON EXCLAMATION;So;0;L;;;;;N;;;;; +AA78;MYANMAR SYMBOL AITON ONE;So;0;L;;;;;N;;;;; +AA79;MYANMAR SYMBOL AITON TWO;So;0;L;;;;;N;;;;; +AA7A;MYANMAR LETTER AITON RA;Lo;0;L;;;;;N;;;;; +AA7B;MYANMAR SIGN PAO KAREN TONE;Mc;0;L;;;;;N;;;;; +AA7C;MYANMAR SIGN TAI LAING TONE-2;Mn;0;NSM;;;;;N;;;;; +AA7D;MYANMAR SIGN TAI LAING TONE-5;Mc;0;L;;;;;N;;;;; +AA7E;MYANMAR LETTER SHWE PALAUNG CHA;Lo;0;L;;;;;N;;;;; +AA7F;MYANMAR LETTER SHWE PALAUNG SHA;Lo;0;L;;;;;N;;;;; +AA80;TAI VIET LETTER LOW KO;Lo;0;L;;;;;N;;;;; +AA81;TAI VIET LETTER HIGH KO;Lo;0;L;;;;;N;;;;; +AA82;TAI VIET LETTER LOW KHO;Lo;0;L;;;;;N;;;;; +AA83;TAI VIET LETTER HIGH KHO;Lo;0;L;;;;;N;;;;; +AA84;TAI VIET LETTER LOW KHHO;Lo;0;L;;;;;N;;;;; +AA85;TAI VIET LETTER HIGH KHHO;Lo;0;L;;;;;N;;;;; +AA86;TAI VIET LETTER LOW GO;Lo;0;L;;;;;N;;;;; +AA87;TAI VIET LETTER HIGH GO;Lo;0;L;;;;;N;;;;; +AA88;TAI VIET LETTER LOW NGO;Lo;0;L;;;;;N;;;;; +AA89;TAI VIET LETTER HIGH NGO;Lo;0;L;;;;;N;;;;; +AA8A;TAI VIET LETTER LOW CO;Lo;0;L;;;;;N;;;;; +AA8B;TAI VIET LETTER HIGH CO;Lo;0;L;;;;;N;;;;; +AA8C;TAI VIET LETTER LOW CHO;Lo;0;L;;;;;N;;;;; +AA8D;TAI VIET LETTER HIGH CHO;Lo;0;L;;;;;N;;;;; +AA8E;TAI VIET LETTER LOW SO;Lo;0;L;;;;;N;;;;; +AA8F;TAI VIET LETTER HIGH SO;Lo;0;L;;;;;N;;;;; +AA90;TAI VIET LETTER LOW NYO;Lo;0;L;;;;;N;;;;; +AA91;TAI VIET LETTER HIGH NYO;Lo;0;L;;;;;N;;;;; +AA92;TAI VIET LETTER LOW DO;Lo;0;L;;;;;N;;;;; +AA93;TAI VIET LETTER HIGH DO;Lo;0;L;;;;;N;;;;; +AA94;TAI VIET LETTER LOW TO;Lo;0;L;;;;;N;;;;; +AA95;TAI VIET LETTER HIGH TO;Lo;0;L;;;;;N;;;;; +AA96;TAI VIET LETTER LOW THO;Lo;0;L;;;;;N;;;;; +AA97;TAI VIET LETTER HIGH THO;Lo;0;L;;;;;N;;;;; +AA98;TAI VIET LETTER LOW NO;Lo;0;L;;;;;N;;;;; +AA99;TAI VIET LETTER HIGH NO;Lo;0;L;;;;;N;;;;; +AA9A;TAI VIET LETTER LOW BO;Lo;0;L;;;;;N;;;;; +AA9B;TAI VIET LETTER HIGH BO;Lo;0;L;;;;;N;;;;; +AA9C;TAI VIET LETTER LOW PO;Lo;0;L;;;;;N;;;;; +AA9D;TAI VIET LETTER HIGH PO;Lo;0;L;;;;;N;;;;; +AA9E;TAI VIET LETTER LOW PHO;Lo;0;L;;;;;N;;;;; +AA9F;TAI VIET LETTER HIGH PHO;Lo;0;L;;;;;N;;;;; +AAA0;TAI VIET LETTER LOW FO;Lo;0;L;;;;;N;;;;; +AAA1;TAI VIET LETTER HIGH FO;Lo;0;L;;;;;N;;;;; +AAA2;TAI VIET LETTER LOW MO;Lo;0;L;;;;;N;;;;; +AAA3;TAI VIET LETTER HIGH MO;Lo;0;L;;;;;N;;;;; +AAA4;TAI VIET LETTER LOW YO;Lo;0;L;;;;;N;;;;; +AAA5;TAI VIET LETTER HIGH YO;Lo;0;L;;;;;N;;;;; +AAA6;TAI VIET LETTER LOW RO;Lo;0;L;;;;;N;;;;; +AAA7;TAI VIET LETTER HIGH RO;Lo;0;L;;;;;N;;;;; +AAA8;TAI VIET LETTER LOW LO;Lo;0;L;;;;;N;;;;; +AAA9;TAI VIET LETTER HIGH LO;Lo;0;L;;;;;N;;;;; +AAAA;TAI VIET LETTER LOW VO;Lo;0;L;;;;;N;;;;; +AAAB;TAI VIET LETTER HIGH VO;Lo;0;L;;;;;N;;;;; +AAAC;TAI VIET LETTER LOW HO;Lo;0;L;;;;;N;;;;; +AAAD;TAI VIET LETTER HIGH HO;Lo;0;L;;;;;N;;;;; +AAAE;TAI VIET LETTER LOW O;Lo;0;L;;;;;N;;;;; +AAAF;TAI VIET LETTER HIGH O;Lo;0;L;;;;;N;;;;; +AAB0;TAI VIET MAI KANG;Mn;230;NSM;;;;;N;;;;; +AAB1;TAI VIET VOWEL AA;Lo;0;L;;;;;N;;;;; +AAB2;TAI VIET VOWEL I;Mn;230;NSM;;;;;N;;;;; +AAB3;TAI VIET VOWEL UE;Mn;230;NSM;;;;;N;;;;; +AAB4;TAI VIET VOWEL U;Mn;220;NSM;;;;;N;;;;; +AAB5;TAI VIET VOWEL E;Lo;0;L;;;;;N;;;;; +AAB6;TAI VIET VOWEL O;Lo;0;L;;;;;N;;;;; +AAB7;TAI VIET MAI KHIT;Mn;230;NSM;;;;;N;;;;; +AAB8;TAI VIET VOWEL IA;Mn;230;NSM;;;;;N;;;;; +AAB9;TAI VIET VOWEL UEA;Lo;0;L;;;;;N;;;;; +AABA;TAI VIET VOWEL UA;Lo;0;L;;;;;N;;;;; +AABB;TAI VIET VOWEL AUE;Lo;0;L;;;;;N;;;;; +AABC;TAI VIET VOWEL AY;Lo;0;L;;;;;N;;;;; +AABD;TAI VIET VOWEL AN;Lo;0;L;;;;;N;;;;; +AABE;TAI VIET VOWEL AM;Mn;230;NSM;;;;;N;;;;; +AABF;TAI VIET TONE MAI EK;Mn;230;NSM;;;;;N;;;;; +AAC0;TAI VIET TONE MAI NUENG;Lo;0;L;;;;;N;;;;; +AAC1;TAI VIET TONE MAI THO;Mn;230;NSM;;;;;N;;;;; +AAC2;TAI VIET TONE MAI SONG;Lo;0;L;;;;;N;;;;; +AADB;TAI VIET SYMBOL KON;Lo;0;L;;;;;N;;;;; +AADC;TAI VIET SYMBOL NUENG;Lo;0;L;;;;;N;;;;; +AADD;TAI VIET SYMBOL SAM;Lm;0;L;;;;;N;;;;; +AADE;TAI VIET SYMBOL HO HOI;Po;0;L;;;;;N;;;;; +AADF;TAI VIET SYMBOL KOI KOI;Po;0;L;;;;;N;;;;; +AAE0;MEETEI MAYEK LETTER E;Lo;0;L;;;;;N;;;;; +AAE1;MEETEI MAYEK LETTER O;Lo;0;L;;;;;N;;;;; +AAE2;MEETEI MAYEK LETTER CHA;Lo;0;L;;;;;N;;;;; +AAE3;MEETEI MAYEK LETTER NYA;Lo;0;L;;;;;N;;;;; +AAE4;MEETEI MAYEK LETTER TTA;Lo;0;L;;;;;N;;;;; +AAE5;MEETEI MAYEK LETTER TTHA;Lo;0;L;;;;;N;;;;; +AAE6;MEETEI MAYEK LETTER DDA;Lo;0;L;;;;;N;;;;; +AAE7;MEETEI MAYEK LETTER DDHA;Lo;0;L;;;;;N;;;;; +AAE8;MEETEI MAYEK LETTER NNA;Lo;0;L;;;;;N;;;;; +AAE9;MEETEI MAYEK LETTER SHA;Lo;0;L;;;;;N;;;;; +AAEA;MEETEI MAYEK LETTER SSA;Lo;0;L;;;;;N;;;;; +AAEB;MEETEI MAYEK VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +AAEC;MEETEI MAYEK VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +AAED;MEETEI MAYEK VOWEL SIGN AAI;Mn;0;NSM;;;;;N;;;;; +AAEE;MEETEI MAYEK VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +AAEF;MEETEI MAYEK VOWEL SIGN AAU;Mc;0;L;;;;;N;;;;; +AAF0;MEETEI MAYEK CHEIKHAN;Po;0;L;;;;;N;;;;; +AAF1;MEETEI MAYEK AHANG KHUDAM;Po;0;L;;;;;N;;;;; +AAF2;MEETEI MAYEK ANJI;Lo;0;L;;;;;N;;;;; +AAF3;MEETEI MAYEK SYLLABLE REPETITION MARK;Lm;0;L;;;;;N;;;;; +AAF4;MEETEI MAYEK WORD REPETITION MARK;Lm;0;L;;;;;N;;;;; +AAF5;MEETEI MAYEK VOWEL SIGN VISARGA;Mc;0;L;;;;;N;;;;; +AAF6;MEETEI MAYEK VIRAMA;Mn;9;NSM;;;;;N;;;;; +AB01;ETHIOPIC SYLLABLE TTHU;Lo;0;L;;;;;N;;;;; +AB02;ETHIOPIC SYLLABLE TTHI;Lo;0;L;;;;;N;;;;; +AB03;ETHIOPIC SYLLABLE TTHAA;Lo;0;L;;;;;N;;;;; +AB04;ETHIOPIC SYLLABLE TTHEE;Lo;0;L;;;;;N;;;;; +AB05;ETHIOPIC SYLLABLE TTHE;Lo;0;L;;;;;N;;;;; +AB06;ETHIOPIC SYLLABLE TTHO;Lo;0;L;;;;;N;;;;; +AB09;ETHIOPIC SYLLABLE DDHU;Lo;0;L;;;;;N;;;;; +AB0A;ETHIOPIC SYLLABLE DDHI;Lo;0;L;;;;;N;;;;; +AB0B;ETHIOPIC SYLLABLE DDHAA;Lo;0;L;;;;;N;;;;; +AB0C;ETHIOPIC SYLLABLE DDHEE;Lo;0;L;;;;;N;;;;; +AB0D;ETHIOPIC SYLLABLE DDHE;Lo;0;L;;;;;N;;;;; +AB0E;ETHIOPIC SYLLABLE DDHO;Lo;0;L;;;;;N;;;;; +AB11;ETHIOPIC SYLLABLE DZU;Lo;0;L;;;;;N;;;;; +AB12;ETHIOPIC SYLLABLE DZI;Lo;0;L;;;;;N;;;;; +AB13;ETHIOPIC SYLLABLE DZAA;Lo;0;L;;;;;N;;;;; +AB14;ETHIOPIC SYLLABLE DZEE;Lo;0;L;;;;;N;;;;; +AB15;ETHIOPIC SYLLABLE DZE;Lo;0;L;;;;;N;;;;; +AB16;ETHIOPIC SYLLABLE DZO;Lo;0;L;;;;;N;;;;; +AB20;ETHIOPIC SYLLABLE CCHHA;Lo;0;L;;;;;N;;;;; +AB21;ETHIOPIC SYLLABLE CCHHU;Lo;0;L;;;;;N;;;;; +AB22;ETHIOPIC SYLLABLE CCHHI;Lo;0;L;;;;;N;;;;; +AB23;ETHIOPIC SYLLABLE CCHHAA;Lo;0;L;;;;;N;;;;; +AB24;ETHIOPIC SYLLABLE CCHHEE;Lo;0;L;;;;;N;;;;; +AB25;ETHIOPIC SYLLABLE CCHHE;Lo;0;L;;;;;N;;;;; +AB26;ETHIOPIC SYLLABLE CCHHO;Lo;0;L;;;;;N;;;;; +AB28;ETHIOPIC SYLLABLE BBA;Lo;0;L;;;;;N;;;;; +AB29;ETHIOPIC SYLLABLE BBU;Lo;0;L;;;;;N;;;;; +AB2A;ETHIOPIC SYLLABLE BBI;Lo;0;L;;;;;N;;;;; +AB2B;ETHIOPIC SYLLABLE BBAA;Lo;0;L;;;;;N;;;;; +AB2C;ETHIOPIC SYLLABLE BBEE;Lo;0;L;;;;;N;;;;; +AB2D;ETHIOPIC SYLLABLE BBE;Lo;0;L;;;;;N;;;;; +AB2E;ETHIOPIC SYLLABLE BBO;Lo;0;L;;;;;N;;;;; +AB30;LATIN SMALL LETTER BARRED ALPHA;Ll;0;L;;;;;N;;;;; +AB31;LATIN SMALL LETTER A REVERSED-SCHWA;Ll;0;L;;;;;N;;;;; +AB32;LATIN SMALL LETTER BLACKLETTER E;Ll;0;L;;;;;N;;;;; +AB33;LATIN SMALL LETTER BARRED E;Ll;0;L;;;;;N;;;;; +AB34;LATIN SMALL LETTER E WITH FLOURISH;Ll;0;L;;;;;N;;;;; +AB35;LATIN SMALL LETTER LENIS F;Ll;0;L;;;;;N;;;;; +AB36;LATIN SMALL LETTER SCRIPT G WITH CROSSED-TAIL;Ll;0;L;;;;;N;;;;; +AB37;LATIN SMALL LETTER L WITH INVERTED LAZY S;Ll;0;L;;;;;N;;;;; +AB38;LATIN SMALL LETTER L WITH DOUBLE MIDDLE TILDE;Ll;0;L;;;;;N;;;;; +AB39;LATIN SMALL LETTER L WITH MIDDLE RING;Ll;0;L;;;;;N;;;;; +AB3A;LATIN SMALL LETTER M WITH CROSSED-TAIL;Ll;0;L;;;;;N;;;;; +AB3B;LATIN SMALL LETTER N WITH CROSSED-TAIL;Ll;0;L;;;;;N;;;;; +AB3C;LATIN SMALL LETTER ENG WITH CROSSED-TAIL;Ll;0;L;;;;;N;;;;; +AB3D;LATIN SMALL LETTER BLACKLETTER O;Ll;0;L;;;;;N;;;;; +AB3E;LATIN SMALL LETTER BLACKLETTER O WITH STROKE;Ll;0;L;;;;;N;;;;; +AB3F;LATIN SMALL LETTER OPEN O WITH STROKE;Ll;0;L;;;;;N;;;;; +AB40;LATIN SMALL LETTER INVERTED OE;Ll;0;L;;;;;N;;;;; +AB41;LATIN SMALL LETTER TURNED OE WITH STROKE;Ll;0;L;;;;;N;;;;; +AB42;LATIN SMALL LETTER TURNED OE WITH HORIZONTAL STROKE;Ll;0;L;;;;;N;;;;; +AB43;LATIN SMALL LETTER TURNED O OPEN-O;Ll;0;L;;;;;N;;;;; +AB44;LATIN SMALL LETTER TURNED O OPEN-O WITH STROKE;Ll;0;L;;;;;N;;;;; +AB45;LATIN SMALL LETTER STIRRUP R;Ll;0;L;;;;;N;;;;; +AB46;LATIN LETTER SMALL CAPITAL R WITH RIGHT LEG;Ll;0;L;;;;;N;;;;; +AB47;LATIN SMALL LETTER R WITHOUT HANDLE;Ll;0;L;;;;;N;;;;; +AB48;LATIN SMALL LETTER DOUBLE R;Ll;0;L;;;;;N;;;;; +AB49;LATIN SMALL LETTER R WITH CROSSED-TAIL;Ll;0;L;;;;;N;;;;; +AB4A;LATIN SMALL LETTER DOUBLE R WITH CROSSED-TAIL;Ll;0;L;;;;;N;;;;; +AB4B;LATIN SMALL LETTER SCRIPT R;Ll;0;L;;;;;N;;;;; +AB4C;LATIN SMALL LETTER SCRIPT R WITH RING;Ll;0;L;;;;;N;;;;; +AB4D;LATIN SMALL LETTER BASELINE ESH;Ll;0;L;;;;;N;;;;; +AB4E;LATIN SMALL LETTER U WITH SHORT RIGHT LEG;Ll;0;L;;;;;N;;;;; +AB4F;LATIN SMALL LETTER U BAR WITH SHORT RIGHT LEG;Ll;0;L;;;;;N;;;;; +AB50;LATIN SMALL LETTER UI;Ll;0;L;;;;;N;;;;; +AB51;LATIN SMALL LETTER TURNED UI;Ll;0;L;;;;;N;;;;; +AB52;LATIN SMALL LETTER U WITH LEFT HOOK;Ll;0;L;;;;;N;;;;; +AB53;LATIN SMALL LETTER CHI;Ll;0;L;;;;;N;;;A7B3;;A7B3 +AB54;LATIN SMALL LETTER CHI WITH LOW RIGHT RING;Ll;0;L;;;;;N;;;;; +AB55;LATIN SMALL LETTER CHI WITH LOW LEFT SERIF;Ll;0;L;;;;;N;;;;; +AB56;LATIN SMALL LETTER X WITH LOW RIGHT RING;Ll;0;L;;;;;N;;;;; +AB57;LATIN SMALL LETTER X WITH LONG LEFT LEG;Ll;0;L;;;;;N;;;;; +AB58;LATIN SMALL LETTER X WITH LONG LEFT LEG AND LOW RIGHT RING;Ll;0;L;;;;;N;;;;; +AB59;LATIN SMALL LETTER X WITH LONG LEFT LEG WITH SERIF;Ll;0;L;;;;;N;;;;; +AB5A;LATIN SMALL LETTER Y WITH SHORT RIGHT LEG;Ll;0;L;;;;;N;;;;; +AB5B;MODIFIER BREVE WITH INVERTED BREVE;Sk;0;L;;;;;N;;;;; +AB5C;MODIFIER LETTER SMALL HENG;Lm;0;L;<super> A727;;;;N;;;;; +AB5D;MODIFIER LETTER SMALL L WITH INVERTED LAZY S;Lm;0;L;<super> AB37;;;;N;;;;; +AB5E;MODIFIER LETTER SMALL L WITH MIDDLE TILDE;Lm;0;L;<super> 026B;;;;N;;;;; +AB5F;MODIFIER LETTER SMALL U WITH LEFT HOOK;Lm;0;L;<super> AB52;;;;N;;;;; +AB60;LATIN SMALL LETTER SAKHA YAT;Ll;0;L;;;;;N;;;;; +AB61;LATIN SMALL LETTER IOTIFIED E;Ll;0;L;;;;;N;;;;; +AB62;LATIN SMALL LETTER OPEN OE;Ll;0;L;;;;;N;;;;; +AB63;LATIN SMALL LETTER UO;Ll;0;L;;;;;N;;;;; +AB64;LATIN SMALL LETTER INVERTED ALPHA;Ll;0;L;;;;;N;;;;; +AB65;GREEK LETTER SMALL CAPITAL OMEGA;Ll;0;L;;;;;N;;;;; +AB70;CHEROKEE SMALL LETTER A;Ll;0;L;;;;;N;;;13A0;;13A0 +AB71;CHEROKEE SMALL LETTER E;Ll;0;L;;;;;N;;;13A1;;13A1 +AB72;CHEROKEE SMALL LETTER I;Ll;0;L;;;;;N;;;13A2;;13A2 +AB73;CHEROKEE SMALL LETTER O;Ll;0;L;;;;;N;;;13A3;;13A3 +AB74;CHEROKEE SMALL LETTER U;Ll;0;L;;;;;N;;;13A4;;13A4 +AB75;CHEROKEE SMALL LETTER V;Ll;0;L;;;;;N;;;13A5;;13A5 +AB76;CHEROKEE SMALL LETTER GA;Ll;0;L;;;;;N;;;13A6;;13A6 +AB77;CHEROKEE SMALL LETTER KA;Ll;0;L;;;;;N;;;13A7;;13A7 +AB78;CHEROKEE SMALL LETTER GE;Ll;0;L;;;;;N;;;13A8;;13A8 +AB79;CHEROKEE SMALL LETTER GI;Ll;0;L;;;;;N;;;13A9;;13A9 +AB7A;CHEROKEE SMALL LETTER GO;Ll;0;L;;;;;N;;;13AA;;13AA +AB7B;CHEROKEE SMALL LETTER GU;Ll;0;L;;;;;N;;;13AB;;13AB +AB7C;CHEROKEE SMALL LETTER GV;Ll;0;L;;;;;N;;;13AC;;13AC +AB7D;CHEROKEE SMALL LETTER HA;Ll;0;L;;;;;N;;;13AD;;13AD +AB7E;CHEROKEE SMALL LETTER HE;Ll;0;L;;;;;N;;;13AE;;13AE +AB7F;CHEROKEE SMALL LETTER HI;Ll;0;L;;;;;N;;;13AF;;13AF +AB80;CHEROKEE SMALL LETTER HO;Ll;0;L;;;;;N;;;13B0;;13B0 +AB81;CHEROKEE SMALL LETTER HU;Ll;0;L;;;;;N;;;13B1;;13B1 +AB82;CHEROKEE SMALL LETTER HV;Ll;0;L;;;;;N;;;13B2;;13B2 +AB83;CHEROKEE SMALL LETTER LA;Ll;0;L;;;;;N;;;13B3;;13B3 +AB84;CHEROKEE SMALL LETTER LE;Ll;0;L;;;;;N;;;13B4;;13B4 +AB85;CHEROKEE SMALL LETTER LI;Ll;0;L;;;;;N;;;13B5;;13B5 +AB86;CHEROKEE SMALL LETTER LO;Ll;0;L;;;;;N;;;13B6;;13B6 +AB87;CHEROKEE SMALL LETTER LU;Ll;0;L;;;;;N;;;13B7;;13B7 +AB88;CHEROKEE SMALL LETTER LV;Ll;0;L;;;;;N;;;13B8;;13B8 +AB89;CHEROKEE SMALL LETTER MA;Ll;0;L;;;;;N;;;13B9;;13B9 +AB8A;CHEROKEE SMALL LETTER ME;Ll;0;L;;;;;N;;;13BA;;13BA +AB8B;CHEROKEE SMALL LETTER MI;Ll;0;L;;;;;N;;;13BB;;13BB +AB8C;CHEROKEE SMALL LETTER MO;Ll;0;L;;;;;N;;;13BC;;13BC +AB8D;CHEROKEE SMALL LETTER MU;Ll;0;L;;;;;N;;;13BD;;13BD +AB8E;CHEROKEE SMALL LETTER NA;Ll;0;L;;;;;N;;;13BE;;13BE +AB8F;CHEROKEE SMALL LETTER HNA;Ll;0;L;;;;;N;;;13BF;;13BF +AB90;CHEROKEE SMALL LETTER NAH;Ll;0;L;;;;;N;;;13C0;;13C0 +AB91;CHEROKEE SMALL LETTER NE;Ll;0;L;;;;;N;;;13C1;;13C1 +AB92;CHEROKEE SMALL LETTER NI;Ll;0;L;;;;;N;;;13C2;;13C2 +AB93;CHEROKEE SMALL LETTER NO;Ll;0;L;;;;;N;;;13C3;;13C3 +AB94;CHEROKEE SMALL LETTER NU;Ll;0;L;;;;;N;;;13C4;;13C4 +AB95;CHEROKEE SMALL LETTER NV;Ll;0;L;;;;;N;;;13C5;;13C5 +AB96;CHEROKEE SMALL LETTER QUA;Ll;0;L;;;;;N;;;13C6;;13C6 +AB97;CHEROKEE SMALL LETTER QUE;Ll;0;L;;;;;N;;;13C7;;13C7 +AB98;CHEROKEE SMALL LETTER QUI;Ll;0;L;;;;;N;;;13C8;;13C8 +AB99;CHEROKEE SMALL LETTER QUO;Ll;0;L;;;;;N;;;13C9;;13C9 +AB9A;CHEROKEE SMALL LETTER QUU;Ll;0;L;;;;;N;;;13CA;;13CA +AB9B;CHEROKEE SMALL LETTER QUV;Ll;0;L;;;;;N;;;13CB;;13CB +AB9C;CHEROKEE SMALL LETTER SA;Ll;0;L;;;;;N;;;13CC;;13CC +AB9D;CHEROKEE SMALL LETTER S;Ll;0;L;;;;;N;;;13CD;;13CD +AB9E;CHEROKEE SMALL LETTER SE;Ll;0;L;;;;;N;;;13CE;;13CE +AB9F;CHEROKEE SMALL LETTER SI;Ll;0;L;;;;;N;;;13CF;;13CF +ABA0;CHEROKEE SMALL LETTER SO;Ll;0;L;;;;;N;;;13D0;;13D0 +ABA1;CHEROKEE SMALL LETTER SU;Ll;0;L;;;;;N;;;13D1;;13D1 +ABA2;CHEROKEE SMALL LETTER SV;Ll;0;L;;;;;N;;;13D2;;13D2 +ABA3;CHEROKEE SMALL LETTER DA;Ll;0;L;;;;;N;;;13D3;;13D3 +ABA4;CHEROKEE SMALL LETTER TA;Ll;0;L;;;;;N;;;13D4;;13D4 +ABA5;CHEROKEE SMALL LETTER DE;Ll;0;L;;;;;N;;;13D5;;13D5 +ABA6;CHEROKEE SMALL LETTER TE;Ll;0;L;;;;;N;;;13D6;;13D6 +ABA7;CHEROKEE SMALL LETTER DI;Ll;0;L;;;;;N;;;13D7;;13D7 +ABA8;CHEROKEE SMALL LETTER TI;Ll;0;L;;;;;N;;;13D8;;13D8 +ABA9;CHEROKEE SMALL LETTER DO;Ll;0;L;;;;;N;;;13D9;;13D9 +ABAA;CHEROKEE SMALL LETTER DU;Ll;0;L;;;;;N;;;13DA;;13DA +ABAB;CHEROKEE SMALL LETTER DV;Ll;0;L;;;;;N;;;13DB;;13DB +ABAC;CHEROKEE SMALL LETTER DLA;Ll;0;L;;;;;N;;;13DC;;13DC +ABAD;CHEROKEE SMALL LETTER TLA;Ll;0;L;;;;;N;;;13DD;;13DD +ABAE;CHEROKEE SMALL LETTER TLE;Ll;0;L;;;;;N;;;13DE;;13DE +ABAF;CHEROKEE SMALL LETTER TLI;Ll;0;L;;;;;N;;;13DF;;13DF +ABB0;CHEROKEE SMALL LETTER TLO;Ll;0;L;;;;;N;;;13E0;;13E0 +ABB1;CHEROKEE SMALL LETTER TLU;Ll;0;L;;;;;N;;;13E1;;13E1 +ABB2;CHEROKEE SMALL LETTER TLV;Ll;0;L;;;;;N;;;13E2;;13E2 +ABB3;CHEROKEE SMALL LETTER TSA;Ll;0;L;;;;;N;;;13E3;;13E3 +ABB4;CHEROKEE SMALL LETTER TSE;Ll;0;L;;;;;N;;;13E4;;13E4 +ABB5;CHEROKEE SMALL LETTER TSI;Ll;0;L;;;;;N;;;13E5;;13E5 +ABB6;CHEROKEE SMALL LETTER TSO;Ll;0;L;;;;;N;;;13E6;;13E6 +ABB7;CHEROKEE SMALL LETTER TSU;Ll;0;L;;;;;N;;;13E7;;13E7 +ABB8;CHEROKEE SMALL LETTER TSV;Ll;0;L;;;;;N;;;13E8;;13E8 +ABB9;CHEROKEE SMALL LETTER WA;Ll;0;L;;;;;N;;;13E9;;13E9 +ABBA;CHEROKEE SMALL LETTER WE;Ll;0;L;;;;;N;;;13EA;;13EA +ABBB;CHEROKEE SMALL LETTER WI;Ll;0;L;;;;;N;;;13EB;;13EB +ABBC;CHEROKEE SMALL LETTER WO;Ll;0;L;;;;;N;;;13EC;;13EC +ABBD;CHEROKEE SMALL LETTER WU;Ll;0;L;;;;;N;;;13ED;;13ED +ABBE;CHEROKEE SMALL LETTER WV;Ll;0;L;;;;;N;;;13EE;;13EE +ABBF;CHEROKEE SMALL LETTER YA;Ll;0;L;;;;;N;;;13EF;;13EF +ABC0;MEETEI MAYEK LETTER KOK;Lo;0;L;;;;;N;;;;; +ABC1;MEETEI MAYEK LETTER SAM;Lo;0;L;;;;;N;;;;; +ABC2;MEETEI MAYEK LETTER LAI;Lo;0;L;;;;;N;;;;; +ABC3;MEETEI MAYEK LETTER MIT;Lo;0;L;;;;;N;;;;; +ABC4;MEETEI MAYEK LETTER PA;Lo;0;L;;;;;N;;;;; +ABC5;MEETEI MAYEK LETTER NA;Lo;0;L;;;;;N;;;;; +ABC6;MEETEI MAYEK LETTER CHIL;Lo;0;L;;;;;N;;;;; +ABC7;MEETEI MAYEK LETTER TIL;Lo;0;L;;;;;N;;;;; +ABC8;MEETEI MAYEK LETTER KHOU;Lo;0;L;;;;;N;;;;; +ABC9;MEETEI MAYEK LETTER NGOU;Lo;0;L;;;;;N;;;;; +ABCA;MEETEI MAYEK LETTER THOU;Lo;0;L;;;;;N;;;;; +ABCB;MEETEI MAYEK LETTER WAI;Lo;0;L;;;;;N;;;;; +ABCC;MEETEI MAYEK LETTER YANG;Lo;0;L;;;;;N;;;;; +ABCD;MEETEI MAYEK LETTER HUK;Lo;0;L;;;;;N;;;;; +ABCE;MEETEI MAYEK LETTER UN;Lo;0;L;;;;;N;;;;; +ABCF;MEETEI MAYEK LETTER I;Lo;0;L;;;;;N;;;;; +ABD0;MEETEI MAYEK LETTER PHAM;Lo;0;L;;;;;N;;;;; +ABD1;MEETEI MAYEK LETTER ATIYA;Lo;0;L;;;;;N;;;;; +ABD2;MEETEI MAYEK LETTER GOK;Lo;0;L;;;;;N;;;;; +ABD3;MEETEI MAYEK LETTER JHAM;Lo;0;L;;;;;N;;;;; +ABD4;MEETEI MAYEK LETTER RAI;Lo;0;L;;;;;N;;;;; +ABD5;MEETEI MAYEK LETTER BA;Lo;0;L;;;;;N;;;;; +ABD6;MEETEI MAYEK LETTER JIL;Lo;0;L;;;;;N;;;;; +ABD7;MEETEI MAYEK LETTER DIL;Lo;0;L;;;;;N;;;;; +ABD8;MEETEI MAYEK LETTER GHOU;Lo;0;L;;;;;N;;;;; +ABD9;MEETEI MAYEK LETTER DHOU;Lo;0;L;;;;;N;;;;; +ABDA;MEETEI MAYEK LETTER BHAM;Lo;0;L;;;;;N;;;;; +ABDB;MEETEI MAYEK LETTER KOK LONSUM;Lo;0;L;;;;;N;;;;; +ABDC;MEETEI MAYEK LETTER LAI LONSUM;Lo;0;L;;;;;N;;;;; +ABDD;MEETEI MAYEK LETTER MIT LONSUM;Lo;0;L;;;;;N;;;;; +ABDE;MEETEI MAYEK LETTER PA LONSUM;Lo;0;L;;;;;N;;;;; +ABDF;MEETEI MAYEK LETTER NA LONSUM;Lo;0;L;;;;;N;;;;; +ABE0;MEETEI MAYEK LETTER TIL LONSUM;Lo;0;L;;;;;N;;;;; +ABE1;MEETEI MAYEK LETTER NGOU LONSUM;Lo;0;L;;;;;N;;;;; +ABE2;MEETEI MAYEK LETTER I LONSUM;Lo;0;L;;;;;N;;;;; +ABE3;MEETEI MAYEK VOWEL SIGN ONAP;Mc;0;L;;;;;N;;;;; +ABE4;MEETEI MAYEK VOWEL SIGN INAP;Mc;0;L;;;;;N;;;;; +ABE5;MEETEI MAYEK VOWEL SIGN ANAP;Mn;0;NSM;;;;;N;;;;; +ABE6;MEETEI MAYEK VOWEL SIGN YENAP;Mc;0;L;;;;;N;;;;; +ABE7;MEETEI MAYEK VOWEL SIGN SOUNAP;Mc;0;L;;;;;N;;;;; +ABE8;MEETEI MAYEK VOWEL SIGN UNAP;Mn;0;NSM;;;;;N;;;;; +ABE9;MEETEI MAYEK VOWEL SIGN CHEINAP;Mc;0;L;;;;;N;;;;; +ABEA;MEETEI MAYEK VOWEL SIGN NUNG;Mc;0;L;;;;;N;;;;; +ABEB;MEETEI MAYEK CHEIKHEI;Po;0;L;;;;;N;;;;; +ABEC;MEETEI MAYEK LUM IYEK;Mc;0;L;;;;;N;;;;; +ABED;MEETEI MAYEK APUN IYEK;Mn;9;NSM;;;;;N;;;;; +ABF0;MEETEI MAYEK DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +ABF1;MEETEI MAYEK DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +ABF2;MEETEI MAYEK DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +ABF3;MEETEI MAYEK DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +ABF4;MEETEI MAYEK DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +ABF5;MEETEI MAYEK DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +ABF6;MEETEI MAYEK DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +ABF7;MEETEI MAYEK DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +ABF8;MEETEI MAYEK DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +ABF9;MEETEI MAYEK DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +AC00;<Hangul Syllable, First>;Lo;0;L;;;;;N;;;;; +D7A3;<Hangul Syllable, Last>;Lo;0;L;;;;;N;;;;; +D7B0;HANGUL JUNGSEONG O-YEO;Lo;0;L;;;;;N;;;;; +D7B1;HANGUL JUNGSEONG O-O-I;Lo;0;L;;;;;N;;;;; +D7B2;HANGUL JUNGSEONG YO-A;Lo;0;L;;;;;N;;;;; +D7B3;HANGUL JUNGSEONG YO-AE;Lo;0;L;;;;;N;;;;; +D7B4;HANGUL JUNGSEONG YO-EO;Lo;0;L;;;;;N;;;;; +D7B5;HANGUL JUNGSEONG U-YEO;Lo;0;L;;;;;N;;;;; +D7B6;HANGUL JUNGSEONG U-I-I;Lo;0;L;;;;;N;;;;; +D7B7;HANGUL JUNGSEONG YU-AE;Lo;0;L;;;;;N;;;;; +D7B8;HANGUL JUNGSEONG YU-O;Lo;0;L;;;;;N;;;;; +D7B9;HANGUL JUNGSEONG EU-A;Lo;0;L;;;;;N;;;;; +D7BA;HANGUL JUNGSEONG EU-EO;Lo;0;L;;;;;N;;;;; +D7BB;HANGUL JUNGSEONG EU-E;Lo;0;L;;;;;N;;;;; +D7BC;HANGUL JUNGSEONG EU-O;Lo;0;L;;;;;N;;;;; +D7BD;HANGUL JUNGSEONG I-YA-O;Lo;0;L;;;;;N;;;;; +D7BE;HANGUL JUNGSEONG I-YAE;Lo;0;L;;;;;N;;;;; +D7BF;HANGUL JUNGSEONG I-YEO;Lo;0;L;;;;;N;;;;; +D7C0;HANGUL JUNGSEONG I-YE;Lo;0;L;;;;;N;;;;; +D7C1;HANGUL JUNGSEONG I-O-I;Lo;0;L;;;;;N;;;;; +D7C2;HANGUL JUNGSEONG I-YO;Lo;0;L;;;;;N;;;;; +D7C3;HANGUL JUNGSEONG I-YU;Lo;0;L;;;;;N;;;;; +D7C4;HANGUL JUNGSEONG I-I;Lo;0;L;;;;;N;;;;; +D7C5;HANGUL JUNGSEONG ARAEA-A;Lo;0;L;;;;;N;;;;; +D7C6;HANGUL JUNGSEONG ARAEA-E;Lo;0;L;;;;;N;;;;; +D7CB;HANGUL JONGSEONG NIEUN-RIEUL;Lo;0;L;;;;;N;;;;; +D7CC;HANGUL JONGSEONG NIEUN-CHIEUCH;Lo;0;L;;;;;N;;;;; +D7CD;HANGUL JONGSEONG SSANGTIKEUT;Lo;0;L;;;;;N;;;;; +D7CE;HANGUL JONGSEONG SSANGTIKEUT-PIEUP;Lo;0;L;;;;;N;;;;; +D7CF;HANGUL JONGSEONG TIKEUT-PIEUP;Lo;0;L;;;;;N;;;;; +D7D0;HANGUL JONGSEONG TIKEUT-SIOS;Lo;0;L;;;;;N;;;;; +D7D1;HANGUL JONGSEONG TIKEUT-SIOS-KIYEOK;Lo;0;L;;;;;N;;;;; +D7D2;HANGUL JONGSEONG TIKEUT-CIEUC;Lo;0;L;;;;;N;;;;; +D7D3;HANGUL JONGSEONG TIKEUT-CHIEUCH;Lo;0;L;;;;;N;;;;; +D7D4;HANGUL JONGSEONG TIKEUT-THIEUTH;Lo;0;L;;;;;N;;;;; +D7D5;HANGUL JONGSEONG RIEUL-SSANGKIYEOK;Lo;0;L;;;;;N;;;;; +D7D6;HANGUL JONGSEONG RIEUL-KIYEOK-HIEUH;Lo;0;L;;;;;N;;;;; +D7D7;HANGUL JONGSEONG SSANGRIEUL-KHIEUKH;Lo;0;L;;;;;N;;;;; +D7D8;HANGUL JONGSEONG RIEUL-MIEUM-HIEUH;Lo;0;L;;;;;N;;;;; +D7D9;HANGUL JONGSEONG RIEUL-PIEUP-TIKEUT;Lo;0;L;;;;;N;;;;; +D7DA;HANGUL JONGSEONG RIEUL-PIEUP-PHIEUPH;Lo;0;L;;;;;N;;;;; +D7DB;HANGUL JONGSEONG RIEUL-YESIEUNG;Lo;0;L;;;;;N;;;;; +D7DC;HANGUL JONGSEONG RIEUL-YEORINHIEUH-HIEUH;Lo;0;L;;;;;N;;;;; +D7DD;HANGUL JONGSEONG KAPYEOUNRIEUL;Lo;0;L;;;;;N;;;;; +D7DE;HANGUL JONGSEONG MIEUM-NIEUN;Lo;0;L;;;;;N;;;;; +D7DF;HANGUL JONGSEONG MIEUM-SSANGNIEUN;Lo;0;L;;;;;N;;;;; +D7E0;HANGUL JONGSEONG SSANGMIEUM;Lo;0;L;;;;;N;;;;; +D7E1;HANGUL JONGSEONG MIEUM-PIEUP-SIOS;Lo;0;L;;;;;N;;;;; +D7E2;HANGUL JONGSEONG MIEUM-CIEUC;Lo;0;L;;;;;N;;;;; +D7E3;HANGUL JONGSEONG PIEUP-TIKEUT;Lo;0;L;;;;;N;;;;; +D7E4;HANGUL JONGSEONG PIEUP-RIEUL-PHIEUPH;Lo;0;L;;;;;N;;;;; +D7E5;HANGUL JONGSEONG PIEUP-MIEUM;Lo;0;L;;;;;N;;;;; +D7E6;HANGUL JONGSEONG SSANGPIEUP;Lo;0;L;;;;;N;;;;; +D7E7;HANGUL JONGSEONG PIEUP-SIOS-TIKEUT;Lo;0;L;;;;;N;;;;; +D7E8;HANGUL JONGSEONG PIEUP-CIEUC;Lo;0;L;;;;;N;;;;; +D7E9;HANGUL JONGSEONG PIEUP-CHIEUCH;Lo;0;L;;;;;N;;;;; +D7EA;HANGUL JONGSEONG SIOS-MIEUM;Lo;0;L;;;;;N;;;;; +D7EB;HANGUL JONGSEONG SIOS-KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;; +D7EC;HANGUL JONGSEONG SSANGSIOS-KIYEOK;Lo;0;L;;;;;N;;;;; +D7ED;HANGUL JONGSEONG SSANGSIOS-TIKEUT;Lo;0;L;;;;;N;;;;; +D7EE;HANGUL JONGSEONG SIOS-PANSIOS;Lo;0;L;;;;;N;;;;; +D7EF;HANGUL JONGSEONG SIOS-CIEUC;Lo;0;L;;;;;N;;;;; +D7F0;HANGUL JONGSEONG SIOS-CHIEUCH;Lo;0;L;;;;;N;;;;; +D7F1;HANGUL JONGSEONG SIOS-THIEUTH;Lo;0;L;;;;;N;;;;; +D7F2;HANGUL JONGSEONG SIOS-HIEUH;Lo;0;L;;;;;N;;;;; +D7F3;HANGUL JONGSEONG PANSIOS-PIEUP;Lo;0;L;;;;;N;;;;; +D7F4;HANGUL JONGSEONG PANSIOS-KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;; +D7F5;HANGUL JONGSEONG YESIEUNG-MIEUM;Lo;0;L;;;;;N;;;;; +D7F6;HANGUL JONGSEONG YESIEUNG-HIEUH;Lo;0;L;;;;;N;;;;; +D7F7;HANGUL JONGSEONG CIEUC-PIEUP;Lo;0;L;;;;;N;;;;; +D7F8;HANGUL JONGSEONG CIEUC-SSANGPIEUP;Lo;0;L;;;;;N;;;;; +D7F9;HANGUL JONGSEONG SSANGCIEUC;Lo;0;L;;;;;N;;;;; +D7FA;HANGUL JONGSEONG PHIEUPH-SIOS;Lo;0;L;;;;;N;;;;; +D7FB;HANGUL JONGSEONG PHIEUPH-THIEUTH;Lo;0;L;;;;;N;;;;; +D800;<Non Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;; +DB7F;<Non Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;; +DB80;<Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;; +DBFF;<Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;; +DC00;<Low Surrogate, First>;Cs;0;L;;;;;N;;;;; +DFFF;<Low Surrogate, Last>;Cs;0;L;;;;;N;;;;; +E000;<Private Use, First>;Co;0;L;;;;;N;;;;; +F8FF;<Private Use, Last>;Co;0;L;;;;;N;;;;; +F900;CJK COMPATIBILITY IDEOGRAPH-F900;Lo;0;L;8C48;;;;N;;;;; +F901;CJK COMPATIBILITY IDEOGRAPH-F901;Lo;0;L;66F4;;;;N;;;;; +F902;CJK COMPATIBILITY IDEOGRAPH-F902;Lo;0;L;8ECA;;;;N;;;;; +F903;CJK COMPATIBILITY IDEOGRAPH-F903;Lo;0;L;8CC8;;;;N;;;;; +F904;CJK COMPATIBILITY IDEOGRAPH-F904;Lo;0;L;6ED1;;;;N;;;;; +F905;CJK COMPATIBILITY IDEOGRAPH-F905;Lo;0;L;4E32;;;;N;;;;; +F906;CJK COMPATIBILITY IDEOGRAPH-F906;Lo;0;L;53E5;;;;N;;;;; +F907;CJK COMPATIBILITY IDEOGRAPH-F907;Lo;0;L;9F9C;;;;N;;;;; +F908;CJK COMPATIBILITY IDEOGRAPH-F908;Lo;0;L;9F9C;;;;N;;;;; +F909;CJK COMPATIBILITY IDEOGRAPH-F909;Lo;0;L;5951;;;;N;;;;; +F90A;CJK COMPATIBILITY IDEOGRAPH-F90A;Lo;0;L;91D1;;;;N;;;;; +F90B;CJK COMPATIBILITY IDEOGRAPH-F90B;Lo;0;L;5587;;;;N;;;;; +F90C;CJK COMPATIBILITY IDEOGRAPH-F90C;Lo;0;L;5948;;;;N;;;;; +F90D;CJK COMPATIBILITY IDEOGRAPH-F90D;Lo;0;L;61F6;;;;N;;;;; +F90E;CJK COMPATIBILITY IDEOGRAPH-F90E;Lo;0;L;7669;;;;N;;;;; +F90F;CJK COMPATIBILITY IDEOGRAPH-F90F;Lo;0;L;7F85;;;;N;;;;; +F910;CJK COMPATIBILITY IDEOGRAPH-F910;Lo;0;L;863F;;;;N;;;;; +F911;CJK COMPATIBILITY IDEOGRAPH-F911;Lo;0;L;87BA;;;;N;;;;; +F912;CJK COMPATIBILITY IDEOGRAPH-F912;Lo;0;L;88F8;;;;N;;;;; +F913;CJK COMPATIBILITY IDEOGRAPH-F913;Lo;0;L;908F;;;;N;;;;; +F914;CJK COMPATIBILITY IDEOGRAPH-F914;Lo;0;L;6A02;;;;N;;;;; +F915;CJK COMPATIBILITY IDEOGRAPH-F915;Lo;0;L;6D1B;;;;N;;;;; +F916;CJK COMPATIBILITY IDEOGRAPH-F916;Lo;0;L;70D9;;;;N;;;;; +F917;CJK COMPATIBILITY IDEOGRAPH-F917;Lo;0;L;73DE;;;;N;;;;; +F918;CJK COMPATIBILITY IDEOGRAPH-F918;Lo;0;L;843D;;;;N;;;;; +F919;CJK COMPATIBILITY IDEOGRAPH-F919;Lo;0;L;916A;;;;N;;;;; +F91A;CJK COMPATIBILITY IDEOGRAPH-F91A;Lo;0;L;99F1;;;;N;;;;; +F91B;CJK COMPATIBILITY IDEOGRAPH-F91B;Lo;0;L;4E82;;;;N;;;;; +F91C;CJK COMPATIBILITY IDEOGRAPH-F91C;Lo;0;L;5375;;;;N;;;;; +F91D;CJK COMPATIBILITY IDEOGRAPH-F91D;Lo;0;L;6B04;;;;N;;;;; +F91E;CJK COMPATIBILITY IDEOGRAPH-F91E;Lo;0;L;721B;;;;N;;;;; +F91F;CJK COMPATIBILITY IDEOGRAPH-F91F;Lo;0;L;862D;;;;N;;;;; +F920;CJK COMPATIBILITY IDEOGRAPH-F920;Lo;0;L;9E1E;;;;N;;;;; +F921;CJK COMPATIBILITY IDEOGRAPH-F921;Lo;0;L;5D50;;;;N;;;;; +F922;CJK COMPATIBILITY IDEOGRAPH-F922;Lo;0;L;6FEB;;;;N;;;;; +F923;CJK COMPATIBILITY IDEOGRAPH-F923;Lo;0;L;85CD;;;;N;;;;; +F924;CJK COMPATIBILITY IDEOGRAPH-F924;Lo;0;L;8964;;;;N;;;;; +F925;CJK COMPATIBILITY IDEOGRAPH-F925;Lo;0;L;62C9;;;;N;;;;; +F926;CJK COMPATIBILITY IDEOGRAPH-F926;Lo;0;L;81D8;;;;N;;;;; +F927;CJK COMPATIBILITY IDEOGRAPH-F927;Lo;0;L;881F;;;;N;;;;; +F928;CJK COMPATIBILITY IDEOGRAPH-F928;Lo;0;L;5ECA;;;;N;;;;; +F929;CJK COMPATIBILITY IDEOGRAPH-F929;Lo;0;L;6717;;;;N;;;;; +F92A;CJK COMPATIBILITY IDEOGRAPH-F92A;Lo;0;L;6D6A;;;;N;;;;; +F92B;CJK COMPATIBILITY IDEOGRAPH-F92B;Lo;0;L;72FC;;;;N;;;;; +F92C;CJK COMPATIBILITY IDEOGRAPH-F92C;Lo;0;L;90CE;;;;N;;;;; +F92D;CJK COMPATIBILITY IDEOGRAPH-F92D;Lo;0;L;4F86;;;;N;;;;; +F92E;CJK COMPATIBILITY IDEOGRAPH-F92E;Lo;0;L;51B7;;;;N;;;;; +F92F;CJK COMPATIBILITY IDEOGRAPH-F92F;Lo;0;L;52DE;;;;N;;;;; +F930;CJK COMPATIBILITY IDEOGRAPH-F930;Lo;0;L;64C4;;;;N;;;;; +F931;CJK COMPATIBILITY IDEOGRAPH-F931;Lo;0;L;6AD3;;;;N;;;;; +F932;CJK COMPATIBILITY IDEOGRAPH-F932;Lo;0;L;7210;;;;N;;;;; +F933;CJK COMPATIBILITY IDEOGRAPH-F933;Lo;0;L;76E7;;;;N;;;;; +F934;CJK COMPATIBILITY IDEOGRAPH-F934;Lo;0;L;8001;;;;N;;;;; +F935;CJK COMPATIBILITY IDEOGRAPH-F935;Lo;0;L;8606;;;;N;;;;; +F936;CJK COMPATIBILITY IDEOGRAPH-F936;Lo;0;L;865C;;;;N;;;;; +F937;CJK COMPATIBILITY IDEOGRAPH-F937;Lo;0;L;8DEF;;;;N;;;;; +F938;CJK COMPATIBILITY IDEOGRAPH-F938;Lo;0;L;9732;;;;N;;;;; +F939;CJK COMPATIBILITY IDEOGRAPH-F939;Lo;0;L;9B6F;;;;N;;;;; +F93A;CJK COMPATIBILITY IDEOGRAPH-F93A;Lo;0;L;9DFA;;;;N;;;;; +F93B;CJK COMPATIBILITY IDEOGRAPH-F93B;Lo;0;L;788C;;;;N;;;;; +F93C;CJK COMPATIBILITY IDEOGRAPH-F93C;Lo;0;L;797F;;;;N;;;;; +F93D;CJK COMPATIBILITY IDEOGRAPH-F93D;Lo;0;L;7DA0;;;;N;;;;; +F93E;CJK COMPATIBILITY IDEOGRAPH-F93E;Lo;0;L;83C9;;;;N;;;;; +F93F;CJK COMPATIBILITY IDEOGRAPH-F93F;Lo;0;L;9304;;;;N;;;;; +F940;CJK COMPATIBILITY IDEOGRAPH-F940;Lo;0;L;9E7F;;;;N;;;;; +F941;CJK COMPATIBILITY IDEOGRAPH-F941;Lo;0;L;8AD6;;;;N;;;;; +F942;CJK COMPATIBILITY IDEOGRAPH-F942;Lo;0;L;58DF;;;;N;;;;; +F943;CJK COMPATIBILITY IDEOGRAPH-F943;Lo;0;L;5F04;;;;N;;;;; +F944;CJK COMPATIBILITY IDEOGRAPH-F944;Lo;0;L;7C60;;;;N;;;;; +F945;CJK COMPATIBILITY IDEOGRAPH-F945;Lo;0;L;807E;;;;N;;;;; +F946;CJK COMPATIBILITY IDEOGRAPH-F946;Lo;0;L;7262;;;;N;;;;; +F947;CJK COMPATIBILITY IDEOGRAPH-F947;Lo;0;L;78CA;;;;N;;;;; +F948;CJK COMPATIBILITY IDEOGRAPH-F948;Lo;0;L;8CC2;;;;N;;;;; +F949;CJK COMPATIBILITY IDEOGRAPH-F949;Lo;0;L;96F7;;;;N;;;;; +F94A;CJK COMPATIBILITY IDEOGRAPH-F94A;Lo;0;L;58D8;;;;N;;;;; +F94B;CJK COMPATIBILITY IDEOGRAPH-F94B;Lo;0;L;5C62;;;;N;;;;; +F94C;CJK COMPATIBILITY IDEOGRAPH-F94C;Lo;0;L;6A13;;;;N;;;;; +F94D;CJK COMPATIBILITY IDEOGRAPH-F94D;Lo;0;L;6DDA;;;;N;;;;; +F94E;CJK COMPATIBILITY IDEOGRAPH-F94E;Lo;0;L;6F0F;;;;N;;;;; +F94F;CJK COMPATIBILITY IDEOGRAPH-F94F;Lo;0;L;7D2F;;;;N;;;;; +F950;CJK COMPATIBILITY IDEOGRAPH-F950;Lo;0;L;7E37;;;;N;;;;; +F951;CJK COMPATIBILITY IDEOGRAPH-F951;Lo;0;L;964B;;;;N;;;;; +F952;CJK COMPATIBILITY IDEOGRAPH-F952;Lo;0;L;52D2;;;;N;;;;; +F953;CJK COMPATIBILITY IDEOGRAPH-F953;Lo;0;L;808B;;;;N;;;;; +F954;CJK COMPATIBILITY IDEOGRAPH-F954;Lo;0;L;51DC;;;;N;;;;; +F955;CJK COMPATIBILITY IDEOGRAPH-F955;Lo;0;L;51CC;;;;N;;;;; +F956;CJK COMPATIBILITY IDEOGRAPH-F956;Lo;0;L;7A1C;;;;N;;;;; +F957;CJK COMPATIBILITY IDEOGRAPH-F957;Lo;0;L;7DBE;;;;N;;;;; +F958;CJK COMPATIBILITY IDEOGRAPH-F958;Lo;0;L;83F1;;;;N;;;;; +F959;CJK COMPATIBILITY IDEOGRAPH-F959;Lo;0;L;9675;;;;N;;;;; +F95A;CJK COMPATIBILITY IDEOGRAPH-F95A;Lo;0;L;8B80;;;;N;;;;; +F95B;CJK COMPATIBILITY IDEOGRAPH-F95B;Lo;0;L;62CF;;;;N;;;;; +F95C;CJK COMPATIBILITY IDEOGRAPH-F95C;Lo;0;L;6A02;;;;N;;;;; +F95D;CJK COMPATIBILITY IDEOGRAPH-F95D;Lo;0;L;8AFE;;;;N;;;;; +F95E;CJK COMPATIBILITY IDEOGRAPH-F95E;Lo;0;L;4E39;;;;N;;;;; +F95F;CJK COMPATIBILITY IDEOGRAPH-F95F;Lo;0;L;5BE7;;;;N;;;;; +F960;CJK COMPATIBILITY IDEOGRAPH-F960;Lo;0;L;6012;;;;N;;;;; +F961;CJK COMPATIBILITY IDEOGRAPH-F961;Lo;0;L;7387;;;;N;;;;; +F962;CJK COMPATIBILITY IDEOGRAPH-F962;Lo;0;L;7570;;;;N;;;;; +F963;CJK COMPATIBILITY IDEOGRAPH-F963;Lo;0;L;5317;;;;N;;;;; +F964;CJK COMPATIBILITY IDEOGRAPH-F964;Lo;0;L;78FB;;;;N;;;;; +F965;CJK COMPATIBILITY IDEOGRAPH-F965;Lo;0;L;4FBF;;;;N;;;;; +F966;CJK COMPATIBILITY IDEOGRAPH-F966;Lo;0;L;5FA9;;;;N;;;;; +F967;CJK COMPATIBILITY IDEOGRAPH-F967;Lo;0;L;4E0D;;;;N;;;;; +F968;CJK COMPATIBILITY IDEOGRAPH-F968;Lo;0;L;6CCC;;;;N;;;;; +F969;CJK COMPATIBILITY IDEOGRAPH-F969;Lo;0;L;6578;;;;N;;;;; +F96A;CJK COMPATIBILITY IDEOGRAPH-F96A;Lo;0;L;7D22;;;;N;;;;; +F96B;CJK COMPATIBILITY IDEOGRAPH-F96B;Lo;0;L;53C3;;;3;N;;;;; +F96C;CJK COMPATIBILITY IDEOGRAPH-F96C;Lo;0;L;585E;;;;N;;;;; +F96D;CJK COMPATIBILITY IDEOGRAPH-F96D;Lo;0;L;7701;;;;N;;;;; +F96E;CJK COMPATIBILITY IDEOGRAPH-F96E;Lo;0;L;8449;;;;N;;;;; +F96F;CJK COMPATIBILITY IDEOGRAPH-F96F;Lo;0;L;8AAA;;;;N;;;;; +F970;CJK COMPATIBILITY IDEOGRAPH-F970;Lo;0;L;6BBA;;;;N;;;;; +F971;CJK COMPATIBILITY IDEOGRAPH-F971;Lo;0;L;8FB0;;;;N;;;;; +F972;CJK COMPATIBILITY IDEOGRAPH-F972;Lo;0;L;6C88;;;;N;;;;; +F973;CJK COMPATIBILITY IDEOGRAPH-F973;Lo;0;L;62FE;;;10;N;;;;; +F974;CJK COMPATIBILITY IDEOGRAPH-F974;Lo;0;L;82E5;;;;N;;;;; +F975;CJK COMPATIBILITY IDEOGRAPH-F975;Lo;0;L;63A0;;;;N;;;;; +F976;CJK COMPATIBILITY IDEOGRAPH-F976;Lo;0;L;7565;;;;N;;;;; +F977;CJK COMPATIBILITY IDEOGRAPH-F977;Lo;0;L;4EAE;;;;N;;;;; +F978;CJK COMPATIBILITY IDEOGRAPH-F978;Lo;0;L;5169;;;2;N;;;;; +F979;CJK COMPATIBILITY IDEOGRAPH-F979;Lo;0;L;51C9;;;;N;;;;; +F97A;CJK COMPATIBILITY IDEOGRAPH-F97A;Lo;0;L;6881;;;;N;;;;; +F97B;CJK COMPATIBILITY IDEOGRAPH-F97B;Lo;0;L;7CE7;;;;N;;;;; +F97C;CJK COMPATIBILITY IDEOGRAPH-F97C;Lo;0;L;826F;;;;N;;;;; +F97D;CJK COMPATIBILITY IDEOGRAPH-F97D;Lo;0;L;8AD2;;;;N;;;;; +F97E;CJK COMPATIBILITY IDEOGRAPH-F97E;Lo;0;L;91CF;;;;N;;;;; +F97F;CJK COMPATIBILITY IDEOGRAPH-F97F;Lo;0;L;52F5;;;;N;;;;; +F980;CJK COMPATIBILITY IDEOGRAPH-F980;Lo;0;L;5442;;;;N;;;;; +F981;CJK COMPATIBILITY IDEOGRAPH-F981;Lo;0;L;5973;;;;N;;;;; +F982;CJK COMPATIBILITY IDEOGRAPH-F982;Lo;0;L;5EEC;;;;N;;;;; +F983;CJK COMPATIBILITY IDEOGRAPH-F983;Lo;0;L;65C5;;;;N;;;;; +F984;CJK COMPATIBILITY IDEOGRAPH-F984;Lo;0;L;6FFE;;;;N;;;;; +F985;CJK COMPATIBILITY IDEOGRAPH-F985;Lo;0;L;792A;;;;N;;;;; +F986;CJK COMPATIBILITY IDEOGRAPH-F986;Lo;0;L;95AD;;;;N;;;;; +F987;CJK COMPATIBILITY IDEOGRAPH-F987;Lo;0;L;9A6A;;;;N;;;;; +F988;CJK COMPATIBILITY IDEOGRAPH-F988;Lo;0;L;9E97;;;;N;;;;; +F989;CJK COMPATIBILITY IDEOGRAPH-F989;Lo;0;L;9ECE;;;;N;;;;; +F98A;CJK COMPATIBILITY IDEOGRAPH-F98A;Lo;0;L;529B;;;;N;;;;; +F98B;CJK COMPATIBILITY IDEOGRAPH-F98B;Lo;0;L;66C6;;;;N;;;;; +F98C;CJK COMPATIBILITY IDEOGRAPH-F98C;Lo;0;L;6B77;;;;N;;;;; +F98D;CJK COMPATIBILITY IDEOGRAPH-F98D;Lo;0;L;8F62;;;;N;;;;; +F98E;CJK COMPATIBILITY IDEOGRAPH-F98E;Lo;0;L;5E74;;;;N;;;;; +F98F;CJK COMPATIBILITY IDEOGRAPH-F98F;Lo;0;L;6190;;;;N;;;;; +F990;CJK COMPATIBILITY IDEOGRAPH-F990;Lo;0;L;6200;;;;N;;;;; +F991;CJK COMPATIBILITY IDEOGRAPH-F991;Lo;0;L;649A;;;;N;;;;; +F992;CJK COMPATIBILITY IDEOGRAPH-F992;Lo;0;L;6F23;;;;N;;;;; +F993;CJK COMPATIBILITY IDEOGRAPH-F993;Lo;0;L;7149;;;;N;;;;; +F994;CJK COMPATIBILITY IDEOGRAPH-F994;Lo;0;L;7489;;;;N;;;;; +F995;CJK COMPATIBILITY IDEOGRAPH-F995;Lo;0;L;79CA;;;;N;;;;; +F996;CJK COMPATIBILITY IDEOGRAPH-F996;Lo;0;L;7DF4;;;;N;;;;; +F997;CJK COMPATIBILITY IDEOGRAPH-F997;Lo;0;L;806F;;;;N;;;;; +F998;CJK COMPATIBILITY IDEOGRAPH-F998;Lo;0;L;8F26;;;;N;;;;; +F999;CJK COMPATIBILITY IDEOGRAPH-F999;Lo;0;L;84EE;;;;N;;;;; +F99A;CJK COMPATIBILITY IDEOGRAPH-F99A;Lo;0;L;9023;;;;N;;;;; +F99B;CJK COMPATIBILITY IDEOGRAPH-F99B;Lo;0;L;934A;;;;N;;;;; +F99C;CJK COMPATIBILITY IDEOGRAPH-F99C;Lo;0;L;5217;;;;N;;;;; +F99D;CJK COMPATIBILITY IDEOGRAPH-F99D;Lo;0;L;52A3;;;;N;;;;; +F99E;CJK COMPATIBILITY IDEOGRAPH-F99E;Lo;0;L;54BD;;;;N;;;;; +F99F;CJK COMPATIBILITY IDEOGRAPH-F99F;Lo;0;L;70C8;;;;N;;;;; +F9A0;CJK COMPATIBILITY IDEOGRAPH-F9A0;Lo;0;L;88C2;;;;N;;;;; +F9A1;CJK COMPATIBILITY IDEOGRAPH-F9A1;Lo;0;L;8AAA;;;;N;;;;; +F9A2;CJK COMPATIBILITY IDEOGRAPH-F9A2;Lo;0;L;5EC9;;;;N;;;;; +F9A3;CJK COMPATIBILITY IDEOGRAPH-F9A3;Lo;0;L;5FF5;;;;N;;;;; +F9A4;CJK COMPATIBILITY IDEOGRAPH-F9A4;Lo;0;L;637B;;;;N;;;;; +F9A5;CJK COMPATIBILITY IDEOGRAPH-F9A5;Lo;0;L;6BAE;;;;N;;;;; +F9A6;CJK COMPATIBILITY IDEOGRAPH-F9A6;Lo;0;L;7C3E;;;;N;;;;; +F9A7;CJK COMPATIBILITY IDEOGRAPH-F9A7;Lo;0;L;7375;;;;N;;;;; +F9A8;CJK COMPATIBILITY IDEOGRAPH-F9A8;Lo;0;L;4EE4;;;;N;;;;; +F9A9;CJK COMPATIBILITY IDEOGRAPH-F9A9;Lo;0;L;56F9;;;;N;;;;; +F9AA;CJK COMPATIBILITY IDEOGRAPH-F9AA;Lo;0;L;5BE7;;;;N;;;;; +F9AB;CJK COMPATIBILITY IDEOGRAPH-F9AB;Lo;0;L;5DBA;;;;N;;;;; +F9AC;CJK COMPATIBILITY IDEOGRAPH-F9AC;Lo;0;L;601C;;;;N;;;;; +F9AD;CJK COMPATIBILITY IDEOGRAPH-F9AD;Lo;0;L;73B2;;;;N;;;;; +F9AE;CJK COMPATIBILITY IDEOGRAPH-F9AE;Lo;0;L;7469;;;;N;;;;; +F9AF;CJK COMPATIBILITY IDEOGRAPH-F9AF;Lo;0;L;7F9A;;;;N;;;;; +F9B0;CJK COMPATIBILITY IDEOGRAPH-F9B0;Lo;0;L;8046;;;;N;;;;; +F9B1;CJK COMPATIBILITY IDEOGRAPH-F9B1;Lo;0;L;9234;;;;N;;;;; +F9B2;CJK COMPATIBILITY IDEOGRAPH-F9B2;Lo;0;L;96F6;;;0;N;;;;; +F9B3;CJK COMPATIBILITY IDEOGRAPH-F9B3;Lo;0;L;9748;;;;N;;;;; +F9B4;CJK COMPATIBILITY IDEOGRAPH-F9B4;Lo;0;L;9818;;;;N;;;;; +F9B5;CJK COMPATIBILITY IDEOGRAPH-F9B5;Lo;0;L;4F8B;;;;N;;;;; +F9B6;CJK COMPATIBILITY IDEOGRAPH-F9B6;Lo;0;L;79AE;;;;N;;;;; +F9B7;CJK COMPATIBILITY IDEOGRAPH-F9B7;Lo;0;L;91B4;;;;N;;;;; +F9B8;CJK COMPATIBILITY IDEOGRAPH-F9B8;Lo;0;L;96B8;;;;N;;;;; +F9B9;CJK COMPATIBILITY IDEOGRAPH-F9B9;Lo;0;L;60E1;;;;N;;;;; +F9BA;CJK COMPATIBILITY IDEOGRAPH-F9BA;Lo;0;L;4E86;;;;N;;;;; +F9BB;CJK COMPATIBILITY IDEOGRAPH-F9BB;Lo;0;L;50DA;;;;N;;;;; +F9BC;CJK COMPATIBILITY IDEOGRAPH-F9BC;Lo;0;L;5BEE;;;;N;;;;; +F9BD;CJK COMPATIBILITY IDEOGRAPH-F9BD;Lo;0;L;5C3F;;;;N;;;;; +F9BE;CJK COMPATIBILITY IDEOGRAPH-F9BE;Lo;0;L;6599;;;;N;;;;; +F9BF;CJK COMPATIBILITY IDEOGRAPH-F9BF;Lo;0;L;6A02;;;;N;;;;; +F9C0;CJK COMPATIBILITY IDEOGRAPH-F9C0;Lo;0;L;71CE;;;;N;;;;; +F9C1;CJK COMPATIBILITY IDEOGRAPH-F9C1;Lo;0;L;7642;;;;N;;;;; +F9C2;CJK COMPATIBILITY IDEOGRAPH-F9C2;Lo;0;L;84FC;;;;N;;;;; +F9C3;CJK COMPATIBILITY IDEOGRAPH-F9C3;Lo;0;L;907C;;;;N;;;;; +F9C4;CJK COMPATIBILITY IDEOGRAPH-F9C4;Lo;0;L;9F8D;;;;N;;;;; +F9C5;CJK COMPATIBILITY IDEOGRAPH-F9C5;Lo;0;L;6688;;;;N;;;;; +F9C6;CJK COMPATIBILITY IDEOGRAPH-F9C6;Lo;0;L;962E;;;;N;;;;; +F9C7;CJK COMPATIBILITY IDEOGRAPH-F9C7;Lo;0;L;5289;;;;N;;;;; +F9C8;CJK COMPATIBILITY IDEOGRAPH-F9C8;Lo;0;L;677B;;;;N;;;;; +F9C9;CJK COMPATIBILITY IDEOGRAPH-F9C9;Lo;0;L;67F3;;;;N;;;;; +F9CA;CJK COMPATIBILITY IDEOGRAPH-F9CA;Lo;0;L;6D41;;;;N;;;;; +F9CB;CJK COMPATIBILITY IDEOGRAPH-F9CB;Lo;0;L;6E9C;;;;N;;;;; +F9CC;CJK COMPATIBILITY IDEOGRAPH-F9CC;Lo;0;L;7409;;;;N;;;;; +F9CD;CJK COMPATIBILITY IDEOGRAPH-F9CD;Lo;0;L;7559;;;;N;;;;; +F9CE;CJK COMPATIBILITY IDEOGRAPH-F9CE;Lo;0;L;786B;;;;N;;;;; +F9CF;CJK COMPATIBILITY IDEOGRAPH-F9CF;Lo;0;L;7D10;;;;N;;;;; +F9D0;CJK COMPATIBILITY IDEOGRAPH-F9D0;Lo;0;L;985E;;;;N;;;;; +F9D1;CJK COMPATIBILITY IDEOGRAPH-F9D1;Lo;0;L;516D;;;6;N;;;;; +F9D2;CJK COMPATIBILITY IDEOGRAPH-F9D2;Lo;0;L;622E;;;;N;;;;; +F9D3;CJK COMPATIBILITY IDEOGRAPH-F9D3;Lo;0;L;9678;;;6;N;;;;; +F9D4;CJK COMPATIBILITY IDEOGRAPH-F9D4;Lo;0;L;502B;;;;N;;;;; +F9D5;CJK COMPATIBILITY IDEOGRAPH-F9D5;Lo;0;L;5D19;;;;N;;;;; +F9D6;CJK COMPATIBILITY IDEOGRAPH-F9D6;Lo;0;L;6DEA;;;;N;;;;; +F9D7;CJK COMPATIBILITY IDEOGRAPH-F9D7;Lo;0;L;8F2A;;;;N;;;;; +F9D8;CJK COMPATIBILITY IDEOGRAPH-F9D8;Lo;0;L;5F8B;;;;N;;;;; +F9D9;CJK COMPATIBILITY IDEOGRAPH-F9D9;Lo;0;L;6144;;;;N;;;;; +F9DA;CJK COMPATIBILITY IDEOGRAPH-F9DA;Lo;0;L;6817;;;;N;;;;; +F9DB;CJK COMPATIBILITY IDEOGRAPH-F9DB;Lo;0;L;7387;;;;N;;;;; +F9DC;CJK COMPATIBILITY IDEOGRAPH-F9DC;Lo;0;L;9686;;;;N;;;;; +F9DD;CJK COMPATIBILITY IDEOGRAPH-F9DD;Lo;0;L;5229;;;;N;;;;; +F9DE;CJK COMPATIBILITY IDEOGRAPH-F9DE;Lo;0;L;540F;;;;N;;;;; +F9DF;CJK COMPATIBILITY IDEOGRAPH-F9DF;Lo;0;L;5C65;;;;N;;;;; +F9E0;CJK COMPATIBILITY IDEOGRAPH-F9E0;Lo;0;L;6613;;;;N;;;;; +F9E1;CJK COMPATIBILITY IDEOGRAPH-F9E1;Lo;0;L;674E;;;;N;;;;; +F9E2;CJK COMPATIBILITY IDEOGRAPH-F9E2;Lo;0;L;68A8;;;;N;;;;; +F9E3;CJK COMPATIBILITY IDEOGRAPH-F9E3;Lo;0;L;6CE5;;;;N;;;;; +F9E4;CJK COMPATIBILITY IDEOGRAPH-F9E4;Lo;0;L;7406;;;;N;;;;; +F9E5;CJK COMPATIBILITY IDEOGRAPH-F9E5;Lo;0;L;75E2;;;;N;;;;; +F9E6;CJK COMPATIBILITY IDEOGRAPH-F9E6;Lo;0;L;7F79;;;;N;;;;; +F9E7;CJK COMPATIBILITY IDEOGRAPH-F9E7;Lo;0;L;88CF;;;;N;;;;; +F9E8;CJK COMPATIBILITY IDEOGRAPH-F9E8;Lo;0;L;88E1;;;;N;;;;; +F9E9;CJK COMPATIBILITY IDEOGRAPH-F9E9;Lo;0;L;91CC;;;;N;;;;; +F9EA;CJK COMPATIBILITY IDEOGRAPH-F9EA;Lo;0;L;96E2;;;;N;;;;; +F9EB;CJK COMPATIBILITY IDEOGRAPH-F9EB;Lo;0;L;533F;;;;N;;;;; +F9EC;CJK COMPATIBILITY IDEOGRAPH-F9EC;Lo;0;L;6EBA;;;;N;;;;; +F9ED;CJK COMPATIBILITY IDEOGRAPH-F9ED;Lo;0;L;541D;;;;N;;;;; +F9EE;CJK COMPATIBILITY IDEOGRAPH-F9EE;Lo;0;L;71D0;;;;N;;;;; +F9EF;CJK COMPATIBILITY IDEOGRAPH-F9EF;Lo;0;L;7498;;;;N;;;;; +F9F0;CJK COMPATIBILITY IDEOGRAPH-F9F0;Lo;0;L;85FA;;;;N;;;;; +F9F1;CJK COMPATIBILITY IDEOGRAPH-F9F1;Lo;0;L;96A3;;;;N;;;;; +F9F2;CJK COMPATIBILITY IDEOGRAPH-F9F2;Lo;0;L;9C57;;;;N;;;;; +F9F3;CJK COMPATIBILITY IDEOGRAPH-F9F3;Lo;0;L;9E9F;;;;N;;;;; +F9F4;CJK COMPATIBILITY IDEOGRAPH-F9F4;Lo;0;L;6797;;;;N;;;;; +F9F5;CJK COMPATIBILITY IDEOGRAPH-F9F5;Lo;0;L;6DCB;;;;N;;;;; +F9F6;CJK COMPATIBILITY IDEOGRAPH-F9F6;Lo;0;L;81E8;;;;N;;;;; +F9F7;CJK COMPATIBILITY IDEOGRAPH-F9F7;Lo;0;L;7ACB;;;;N;;;;; +F9F8;CJK COMPATIBILITY IDEOGRAPH-F9F8;Lo;0;L;7B20;;;;N;;;;; +F9F9;CJK COMPATIBILITY IDEOGRAPH-F9F9;Lo;0;L;7C92;;;;N;;;;; +F9FA;CJK COMPATIBILITY IDEOGRAPH-F9FA;Lo;0;L;72C0;;;;N;;;;; +F9FB;CJK COMPATIBILITY IDEOGRAPH-F9FB;Lo;0;L;7099;;;;N;;;;; +F9FC;CJK COMPATIBILITY IDEOGRAPH-F9FC;Lo;0;L;8B58;;;;N;;;;; +F9FD;CJK COMPATIBILITY IDEOGRAPH-F9FD;Lo;0;L;4EC0;;;10;N;;;;; +F9FE;CJK COMPATIBILITY IDEOGRAPH-F9FE;Lo;0;L;8336;;;;N;;;;; +F9FF;CJK COMPATIBILITY IDEOGRAPH-F9FF;Lo;0;L;523A;;;;N;;;;; +FA00;CJK COMPATIBILITY IDEOGRAPH-FA00;Lo;0;L;5207;;;;N;;;;; +FA01;CJK COMPATIBILITY IDEOGRAPH-FA01;Lo;0;L;5EA6;;;;N;;;;; +FA02;CJK COMPATIBILITY IDEOGRAPH-FA02;Lo;0;L;62D3;;;;N;;;;; +FA03;CJK COMPATIBILITY IDEOGRAPH-FA03;Lo;0;L;7CD6;;;;N;;;;; +FA04;CJK COMPATIBILITY IDEOGRAPH-FA04;Lo;0;L;5B85;;;;N;;;;; +FA05;CJK COMPATIBILITY IDEOGRAPH-FA05;Lo;0;L;6D1E;;;;N;;;;; +FA06;CJK COMPATIBILITY IDEOGRAPH-FA06;Lo;0;L;66B4;;;;N;;;;; +FA07;CJK COMPATIBILITY IDEOGRAPH-FA07;Lo;0;L;8F3B;;;;N;;;;; +FA08;CJK COMPATIBILITY IDEOGRAPH-FA08;Lo;0;L;884C;;;;N;;;;; +FA09;CJK COMPATIBILITY IDEOGRAPH-FA09;Lo;0;L;964D;;;;N;;;;; +FA0A;CJK COMPATIBILITY IDEOGRAPH-FA0A;Lo;0;L;898B;;;;N;;;;; +FA0B;CJK COMPATIBILITY IDEOGRAPH-FA0B;Lo;0;L;5ED3;;;;N;;;;; +FA0C;CJK COMPATIBILITY IDEOGRAPH-FA0C;Lo;0;L;5140;;;;N;;;;; +FA0D;CJK COMPATIBILITY IDEOGRAPH-FA0D;Lo;0;L;55C0;;;;N;;;;; +FA0E;CJK COMPATIBILITY IDEOGRAPH-FA0E;Lo;0;L;;;;;N;;;;; +FA0F;CJK COMPATIBILITY IDEOGRAPH-FA0F;Lo;0;L;;;;;N;;;;; +FA10;CJK COMPATIBILITY IDEOGRAPH-FA10;Lo;0;L;585A;;;;N;;;;; +FA11;CJK COMPATIBILITY IDEOGRAPH-FA11;Lo;0;L;;;;;N;;;;; +FA12;CJK COMPATIBILITY IDEOGRAPH-FA12;Lo;0;L;6674;;;;N;;;;; +FA13;CJK COMPATIBILITY IDEOGRAPH-FA13;Lo;0;L;;;;;N;;;;; +FA14;CJK COMPATIBILITY IDEOGRAPH-FA14;Lo;0;L;;;;;N;;;;; +FA15;CJK COMPATIBILITY IDEOGRAPH-FA15;Lo;0;L;51DE;;;;N;;;;; +FA16;CJK COMPATIBILITY IDEOGRAPH-FA16;Lo;0;L;732A;;;;N;;;;; +FA17;CJK COMPATIBILITY IDEOGRAPH-FA17;Lo;0;L;76CA;;;;N;;;;; +FA18;CJK COMPATIBILITY IDEOGRAPH-FA18;Lo;0;L;793C;;;;N;;;;; +FA19;CJK COMPATIBILITY IDEOGRAPH-FA19;Lo;0;L;795E;;;;N;;;;; +FA1A;CJK COMPATIBILITY IDEOGRAPH-FA1A;Lo;0;L;7965;;;;N;;;;; +FA1B;CJK COMPATIBILITY IDEOGRAPH-FA1B;Lo;0;L;798F;;;;N;;;;; +FA1C;CJK COMPATIBILITY IDEOGRAPH-FA1C;Lo;0;L;9756;;;;N;;;;; +FA1D;CJK COMPATIBILITY IDEOGRAPH-FA1D;Lo;0;L;7CBE;;;;N;;;;; +FA1E;CJK COMPATIBILITY IDEOGRAPH-FA1E;Lo;0;L;7FBD;;;;N;;;;; +FA1F;CJK COMPATIBILITY IDEOGRAPH-FA1F;Lo;0;L;;;;;N;;;;; +FA20;CJK COMPATIBILITY IDEOGRAPH-FA20;Lo;0;L;8612;;;;N;;;;; +FA21;CJK COMPATIBILITY IDEOGRAPH-FA21;Lo;0;L;;;;;N;;;;; +FA22;CJK COMPATIBILITY IDEOGRAPH-FA22;Lo;0;L;8AF8;;;;N;;;;; +FA23;CJK COMPATIBILITY IDEOGRAPH-FA23;Lo;0;L;;;;;N;;;;; +FA24;CJK COMPATIBILITY IDEOGRAPH-FA24;Lo;0;L;;;;;N;;;;; +FA25;CJK COMPATIBILITY IDEOGRAPH-FA25;Lo;0;L;9038;;;;N;;;;; +FA26;CJK COMPATIBILITY IDEOGRAPH-FA26;Lo;0;L;90FD;;;;N;;;;; +FA27;CJK COMPATIBILITY IDEOGRAPH-FA27;Lo;0;L;;;;;N;;;;; +FA28;CJK COMPATIBILITY IDEOGRAPH-FA28;Lo;0;L;;;;;N;;;;; +FA29;CJK COMPATIBILITY IDEOGRAPH-FA29;Lo;0;L;;;;;N;;;;; +FA2A;CJK COMPATIBILITY IDEOGRAPH-FA2A;Lo;0;L;98EF;;;;N;;;;; +FA2B;CJK COMPATIBILITY IDEOGRAPH-FA2B;Lo;0;L;98FC;;;;N;;;;; +FA2C;CJK COMPATIBILITY IDEOGRAPH-FA2C;Lo;0;L;9928;;;;N;;;;; +FA2D;CJK COMPATIBILITY IDEOGRAPH-FA2D;Lo;0;L;9DB4;;;;N;;;;; +FA2E;CJK COMPATIBILITY IDEOGRAPH-FA2E;Lo;0;L;90DE;;;;N;;;;; +FA2F;CJK COMPATIBILITY IDEOGRAPH-FA2F;Lo;0;L;96B7;;;;N;;;;; +FA30;CJK COMPATIBILITY IDEOGRAPH-FA30;Lo;0;L;4FAE;;;;N;;;;; +FA31;CJK COMPATIBILITY IDEOGRAPH-FA31;Lo;0;L;50E7;;;;N;;;;; +FA32;CJK COMPATIBILITY IDEOGRAPH-FA32;Lo;0;L;514D;;;;N;;;;; +FA33;CJK COMPATIBILITY IDEOGRAPH-FA33;Lo;0;L;52C9;;;;N;;;;; +FA34;CJK COMPATIBILITY IDEOGRAPH-FA34;Lo;0;L;52E4;;;;N;;;;; +FA35;CJK COMPATIBILITY IDEOGRAPH-FA35;Lo;0;L;5351;;;;N;;;;; +FA36;CJK COMPATIBILITY IDEOGRAPH-FA36;Lo;0;L;559D;;;;N;;;;; +FA37;CJK COMPATIBILITY IDEOGRAPH-FA37;Lo;0;L;5606;;;;N;;;;; +FA38;CJK COMPATIBILITY IDEOGRAPH-FA38;Lo;0;L;5668;;;;N;;;;; +FA39;CJK COMPATIBILITY IDEOGRAPH-FA39;Lo;0;L;5840;;;;N;;;;; +FA3A;CJK COMPATIBILITY IDEOGRAPH-FA3A;Lo;0;L;58A8;;;;N;;;;; +FA3B;CJK COMPATIBILITY IDEOGRAPH-FA3B;Lo;0;L;5C64;;;;N;;;;; +FA3C;CJK COMPATIBILITY IDEOGRAPH-FA3C;Lo;0;L;5C6E;;;;N;;;;; +FA3D;CJK COMPATIBILITY IDEOGRAPH-FA3D;Lo;0;L;6094;;;;N;;;;; +FA3E;CJK COMPATIBILITY IDEOGRAPH-FA3E;Lo;0;L;6168;;;;N;;;;; +FA3F;CJK COMPATIBILITY IDEOGRAPH-FA3F;Lo;0;L;618E;;;;N;;;;; +FA40;CJK COMPATIBILITY IDEOGRAPH-FA40;Lo;0;L;61F2;;;;N;;;;; +FA41;CJK COMPATIBILITY IDEOGRAPH-FA41;Lo;0;L;654F;;;;N;;;;; +FA42;CJK COMPATIBILITY IDEOGRAPH-FA42;Lo;0;L;65E2;;;;N;;;;; +FA43;CJK COMPATIBILITY IDEOGRAPH-FA43;Lo;0;L;6691;;;;N;;;;; +FA44;CJK COMPATIBILITY IDEOGRAPH-FA44;Lo;0;L;6885;;;;N;;;;; +FA45;CJK COMPATIBILITY IDEOGRAPH-FA45;Lo;0;L;6D77;;;;N;;;;; +FA46;CJK COMPATIBILITY IDEOGRAPH-FA46;Lo;0;L;6E1A;;;;N;;;;; +FA47;CJK COMPATIBILITY IDEOGRAPH-FA47;Lo;0;L;6F22;;;;N;;;;; +FA48;CJK COMPATIBILITY IDEOGRAPH-FA48;Lo;0;L;716E;;;;N;;;;; +FA49;CJK COMPATIBILITY IDEOGRAPH-FA49;Lo;0;L;722B;;;;N;;;;; +FA4A;CJK COMPATIBILITY IDEOGRAPH-FA4A;Lo;0;L;7422;;;;N;;;;; +FA4B;CJK COMPATIBILITY IDEOGRAPH-FA4B;Lo;0;L;7891;;;;N;;;;; +FA4C;CJK COMPATIBILITY IDEOGRAPH-FA4C;Lo;0;L;793E;;;;N;;;;; +FA4D;CJK COMPATIBILITY IDEOGRAPH-FA4D;Lo;0;L;7949;;;;N;;;;; +FA4E;CJK COMPATIBILITY IDEOGRAPH-FA4E;Lo;0;L;7948;;;;N;;;;; +FA4F;CJK COMPATIBILITY IDEOGRAPH-FA4F;Lo;0;L;7950;;;;N;;;;; +FA50;CJK COMPATIBILITY IDEOGRAPH-FA50;Lo;0;L;7956;;;;N;;;;; +FA51;CJK COMPATIBILITY IDEOGRAPH-FA51;Lo;0;L;795D;;;;N;;;;; +FA52;CJK COMPATIBILITY IDEOGRAPH-FA52;Lo;0;L;798D;;;;N;;;;; +FA53;CJK COMPATIBILITY IDEOGRAPH-FA53;Lo;0;L;798E;;;;N;;;;; +FA54;CJK COMPATIBILITY IDEOGRAPH-FA54;Lo;0;L;7A40;;;;N;;;;; +FA55;CJK COMPATIBILITY IDEOGRAPH-FA55;Lo;0;L;7A81;;;;N;;;;; +FA56;CJK COMPATIBILITY IDEOGRAPH-FA56;Lo;0;L;7BC0;;;;N;;;;; +FA57;CJK COMPATIBILITY IDEOGRAPH-FA57;Lo;0;L;7DF4;;;;N;;;;; +FA58;CJK COMPATIBILITY IDEOGRAPH-FA58;Lo;0;L;7E09;;;;N;;;;; +FA59;CJK COMPATIBILITY IDEOGRAPH-FA59;Lo;0;L;7E41;;;;N;;;;; +FA5A;CJK COMPATIBILITY IDEOGRAPH-FA5A;Lo;0;L;7F72;;;;N;;;;; +FA5B;CJK COMPATIBILITY IDEOGRAPH-FA5B;Lo;0;L;8005;;;;N;;;;; +FA5C;CJK COMPATIBILITY IDEOGRAPH-FA5C;Lo;0;L;81ED;;;;N;;;;; +FA5D;CJK COMPATIBILITY IDEOGRAPH-FA5D;Lo;0;L;8279;;;;N;;;;; +FA5E;CJK COMPATIBILITY IDEOGRAPH-FA5E;Lo;0;L;8279;;;;N;;;;; +FA5F;CJK COMPATIBILITY IDEOGRAPH-FA5F;Lo;0;L;8457;;;;N;;;;; +FA60;CJK COMPATIBILITY IDEOGRAPH-FA60;Lo;0;L;8910;;;;N;;;;; +FA61;CJK COMPATIBILITY IDEOGRAPH-FA61;Lo;0;L;8996;;;;N;;;;; +FA62;CJK COMPATIBILITY IDEOGRAPH-FA62;Lo;0;L;8B01;;;;N;;;;; +FA63;CJK COMPATIBILITY IDEOGRAPH-FA63;Lo;0;L;8B39;;;;N;;;;; +FA64;CJK COMPATIBILITY IDEOGRAPH-FA64;Lo;0;L;8CD3;;;;N;;;;; +FA65;CJK COMPATIBILITY IDEOGRAPH-FA65;Lo;0;L;8D08;;;;N;;;;; +FA66;CJK COMPATIBILITY IDEOGRAPH-FA66;Lo;0;L;8FB6;;;;N;;;;; +FA67;CJK COMPATIBILITY IDEOGRAPH-FA67;Lo;0;L;9038;;;;N;;;;; +FA68;CJK COMPATIBILITY IDEOGRAPH-FA68;Lo;0;L;96E3;;;;N;;;;; +FA69;CJK COMPATIBILITY IDEOGRAPH-FA69;Lo;0;L;97FF;;;;N;;;;; +FA6A;CJK COMPATIBILITY IDEOGRAPH-FA6A;Lo;0;L;983B;;;;N;;;;; +FA6B;CJK COMPATIBILITY IDEOGRAPH-FA6B;Lo;0;L;6075;;;;N;;;;; +FA6C;CJK COMPATIBILITY IDEOGRAPH-FA6C;Lo;0;L;242EE;;;;N;;;;; +FA6D;CJK COMPATIBILITY IDEOGRAPH-FA6D;Lo;0;L;8218;;;;N;;;;; +FA70;CJK COMPATIBILITY IDEOGRAPH-FA70;Lo;0;L;4E26;;;;N;;;;; +FA71;CJK COMPATIBILITY IDEOGRAPH-FA71;Lo;0;L;51B5;;;;N;;;;; +FA72;CJK COMPATIBILITY IDEOGRAPH-FA72;Lo;0;L;5168;;;;N;;;;; +FA73;CJK COMPATIBILITY IDEOGRAPH-FA73;Lo;0;L;4F80;;;;N;;;;; +FA74;CJK COMPATIBILITY IDEOGRAPH-FA74;Lo;0;L;5145;;;;N;;;;; +FA75;CJK COMPATIBILITY IDEOGRAPH-FA75;Lo;0;L;5180;;;;N;;;;; +FA76;CJK COMPATIBILITY IDEOGRAPH-FA76;Lo;0;L;52C7;;;;N;;;;; +FA77;CJK COMPATIBILITY IDEOGRAPH-FA77;Lo;0;L;52FA;;;;N;;;;; +FA78;CJK COMPATIBILITY IDEOGRAPH-FA78;Lo;0;L;559D;;;;N;;;;; +FA79;CJK COMPATIBILITY IDEOGRAPH-FA79;Lo;0;L;5555;;;;N;;;;; +FA7A;CJK COMPATIBILITY IDEOGRAPH-FA7A;Lo;0;L;5599;;;;N;;;;; +FA7B;CJK COMPATIBILITY IDEOGRAPH-FA7B;Lo;0;L;55E2;;;;N;;;;; +FA7C;CJK COMPATIBILITY IDEOGRAPH-FA7C;Lo;0;L;585A;;;;N;;;;; +FA7D;CJK COMPATIBILITY IDEOGRAPH-FA7D;Lo;0;L;58B3;;;;N;;;;; +FA7E;CJK COMPATIBILITY IDEOGRAPH-FA7E;Lo;0;L;5944;;;;N;;;;; +FA7F;CJK COMPATIBILITY IDEOGRAPH-FA7F;Lo;0;L;5954;;;;N;;;;; +FA80;CJK COMPATIBILITY IDEOGRAPH-FA80;Lo;0;L;5A62;;;;N;;;;; +FA81;CJK COMPATIBILITY IDEOGRAPH-FA81;Lo;0;L;5B28;;;;N;;;;; +FA82;CJK COMPATIBILITY IDEOGRAPH-FA82;Lo;0;L;5ED2;;;;N;;;;; +FA83;CJK COMPATIBILITY IDEOGRAPH-FA83;Lo;0;L;5ED9;;;;N;;;;; +FA84;CJK COMPATIBILITY IDEOGRAPH-FA84;Lo;0;L;5F69;;;;N;;;;; +FA85;CJK COMPATIBILITY IDEOGRAPH-FA85;Lo;0;L;5FAD;;;;N;;;;; +FA86;CJK COMPATIBILITY IDEOGRAPH-FA86;Lo;0;L;60D8;;;;N;;;;; +FA87;CJK COMPATIBILITY IDEOGRAPH-FA87;Lo;0;L;614E;;;;N;;;;; +FA88;CJK COMPATIBILITY IDEOGRAPH-FA88;Lo;0;L;6108;;;;N;;;;; +FA89;CJK COMPATIBILITY IDEOGRAPH-FA89;Lo;0;L;618E;;;;N;;;;; +FA8A;CJK COMPATIBILITY IDEOGRAPH-FA8A;Lo;0;L;6160;;;;N;;;;; +FA8B;CJK COMPATIBILITY IDEOGRAPH-FA8B;Lo;0;L;61F2;;;;N;;;;; +FA8C;CJK COMPATIBILITY IDEOGRAPH-FA8C;Lo;0;L;6234;;;;N;;;;; +FA8D;CJK COMPATIBILITY IDEOGRAPH-FA8D;Lo;0;L;63C4;;;;N;;;;; +FA8E;CJK COMPATIBILITY IDEOGRAPH-FA8E;Lo;0;L;641C;;;;N;;;;; +FA8F;CJK COMPATIBILITY IDEOGRAPH-FA8F;Lo;0;L;6452;;;;N;;;;; +FA90;CJK COMPATIBILITY IDEOGRAPH-FA90;Lo;0;L;6556;;;;N;;;;; +FA91;CJK COMPATIBILITY IDEOGRAPH-FA91;Lo;0;L;6674;;;;N;;;;; +FA92;CJK COMPATIBILITY IDEOGRAPH-FA92;Lo;0;L;6717;;;;N;;;;; +FA93;CJK COMPATIBILITY IDEOGRAPH-FA93;Lo;0;L;671B;;;;N;;;;; +FA94;CJK COMPATIBILITY IDEOGRAPH-FA94;Lo;0;L;6756;;;;N;;;;; +FA95;CJK COMPATIBILITY IDEOGRAPH-FA95;Lo;0;L;6B79;;;;N;;;;; +FA96;CJK COMPATIBILITY IDEOGRAPH-FA96;Lo;0;L;6BBA;;;;N;;;;; +FA97;CJK COMPATIBILITY IDEOGRAPH-FA97;Lo;0;L;6D41;;;;N;;;;; +FA98;CJK COMPATIBILITY IDEOGRAPH-FA98;Lo;0;L;6EDB;;;;N;;;;; +FA99;CJK COMPATIBILITY IDEOGRAPH-FA99;Lo;0;L;6ECB;;;;N;;;;; +FA9A;CJK COMPATIBILITY IDEOGRAPH-FA9A;Lo;0;L;6F22;;;;N;;;;; +FA9B;CJK COMPATIBILITY IDEOGRAPH-FA9B;Lo;0;L;701E;;;;N;;;;; +FA9C;CJK COMPATIBILITY IDEOGRAPH-FA9C;Lo;0;L;716E;;;;N;;;;; +FA9D;CJK COMPATIBILITY IDEOGRAPH-FA9D;Lo;0;L;77A7;;;;N;;;;; +FA9E;CJK COMPATIBILITY IDEOGRAPH-FA9E;Lo;0;L;7235;;;;N;;;;; +FA9F;CJK COMPATIBILITY IDEOGRAPH-FA9F;Lo;0;L;72AF;;;;N;;;;; +FAA0;CJK COMPATIBILITY IDEOGRAPH-FAA0;Lo;0;L;732A;;;;N;;;;; +FAA1;CJK COMPATIBILITY IDEOGRAPH-FAA1;Lo;0;L;7471;;;;N;;;;; +FAA2;CJK COMPATIBILITY IDEOGRAPH-FAA2;Lo;0;L;7506;;;;N;;;;; +FAA3;CJK COMPATIBILITY IDEOGRAPH-FAA3;Lo;0;L;753B;;;;N;;;;; +FAA4;CJK COMPATIBILITY IDEOGRAPH-FAA4;Lo;0;L;761D;;;;N;;;;; +FAA5;CJK COMPATIBILITY IDEOGRAPH-FAA5;Lo;0;L;761F;;;;N;;;;; +FAA6;CJK COMPATIBILITY IDEOGRAPH-FAA6;Lo;0;L;76CA;;;;N;;;;; +FAA7;CJK COMPATIBILITY IDEOGRAPH-FAA7;Lo;0;L;76DB;;;;N;;;;; +FAA8;CJK COMPATIBILITY IDEOGRAPH-FAA8;Lo;0;L;76F4;;;;N;;;;; +FAA9;CJK COMPATIBILITY IDEOGRAPH-FAA9;Lo;0;L;774A;;;;N;;;;; +FAAA;CJK COMPATIBILITY IDEOGRAPH-FAAA;Lo;0;L;7740;;;;N;;;;; +FAAB;CJK COMPATIBILITY IDEOGRAPH-FAAB;Lo;0;L;78CC;;;;N;;;;; +FAAC;CJK COMPATIBILITY IDEOGRAPH-FAAC;Lo;0;L;7AB1;;;;N;;;;; +FAAD;CJK COMPATIBILITY IDEOGRAPH-FAAD;Lo;0;L;7BC0;;;;N;;;;; +FAAE;CJK COMPATIBILITY IDEOGRAPH-FAAE;Lo;0;L;7C7B;;;;N;;;;; +FAAF;CJK COMPATIBILITY IDEOGRAPH-FAAF;Lo;0;L;7D5B;;;;N;;;;; +FAB0;CJK COMPATIBILITY IDEOGRAPH-FAB0;Lo;0;L;7DF4;;;;N;;;;; +FAB1;CJK COMPATIBILITY IDEOGRAPH-FAB1;Lo;0;L;7F3E;;;;N;;;;; +FAB2;CJK COMPATIBILITY IDEOGRAPH-FAB2;Lo;0;L;8005;;;;N;;;;; +FAB3;CJK COMPATIBILITY IDEOGRAPH-FAB3;Lo;0;L;8352;;;;N;;;;; +FAB4;CJK COMPATIBILITY IDEOGRAPH-FAB4;Lo;0;L;83EF;;;;N;;;;; +FAB5;CJK COMPATIBILITY IDEOGRAPH-FAB5;Lo;0;L;8779;;;;N;;;;; +FAB6;CJK COMPATIBILITY IDEOGRAPH-FAB6;Lo;0;L;8941;;;;N;;;;; +FAB7;CJK COMPATIBILITY IDEOGRAPH-FAB7;Lo;0;L;8986;;;;N;;;;; +FAB8;CJK COMPATIBILITY IDEOGRAPH-FAB8;Lo;0;L;8996;;;;N;;;;; +FAB9;CJK COMPATIBILITY IDEOGRAPH-FAB9;Lo;0;L;8ABF;;;;N;;;;; +FABA;CJK COMPATIBILITY IDEOGRAPH-FABA;Lo;0;L;8AF8;;;;N;;;;; +FABB;CJK COMPATIBILITY IDEOGRAPH-FABB;Lo;0;L;8ACB;;;;N;;;;; +FABC;CJK COMPATIBILITY IDEOGRAPH-FABC;Lo;0;L;8B01;;;;N;;;;; +FABD;CJK COMPATIBILITY IDEOGRAPH-FABD;Lo;0;L;8AFE;;;;N;;;;; +FABE;CJK COMPATIBILITY IDEOGRAPH-FABE;Lo;0;L;8AED;;;;N;;;;; +FABF;CJK COMPATIBILITY IDEOGRAPH-FABF;Lo;0;L;8B39;;;;N;;;;; +FAC0;CJK COMPATIBILITY IDEOGRAPH-FAC0;Lo;0;L;8B8A;;;;N;;;;; +FAC1;CJK COMPATIBILITY IDEOGRAPH-FAC1;Lo;0;L;8D08;;;;N;;;;; +FAC2;CJK COMPATIBILITY IDEOGRAPH-FAC2;Lo;0;L;8F38;;;;N;;;;; +FAC3;CJK COMPATIBILITY IDEOGRAPH-FAC3;Lo;0;L;9072;;;;N;;;;; +FAC4;CJK COMPATIBILITY IDEOGRAPH-FAC4;Lo;0;L;9199;;;;N;;;;; +FAC5;CJK COMPATIBILITY IDEOGRAPH-FAC5;Lo;0;L;9276;;;;N;;;;; +FAC6;CJK COMPATIBILITY IDEOGRAPH-FAC6;Lo;0;L;967C;;;;N;;;;; +FAC7;CJK COMPATIBILITY IDEOGRAPH-FAC7;Lo;0;L;96E3;;;;N;;;;; +FAC8;CJK COMPATIBILITY IDEOGRAPH-FAC8;Lo;0;L;9756;;;;N;;;;; +FAC9;CJK COMPATIBILITY IDEOGRAPH-FAC9;Lo;0;L;97DB;;;;N;;;;; +FACA;CJK COMPATIBILITY IDEOGRAPH-FACA;Lo;0;L;97FF;;;;N;;;;; +FACB;CJK COMPATIBILITY IDEOGRAPH-FACB;Lo;0;L;980B;;;;N;;;;; +FACC;CJK COMPATIBILITY IDEOGRAPH-FACC;Lo;0;L;983B;;;;N;;;;; +FACD;CJK COMPATIBILITY IDEOGRAPH-FACD;Lo;0;L;9B12;;;;N;;;;; +FACE;CJK COMPATIBILITY IDEOGRAPH-FACE;Lo;0;L;9F9C;;;;N;;;;; +FACF;CJK COMPATIBILITY IDEOGRAPH-FACF;Lo;0;L;2284A;;;;N;;;;; +FAD0;CJK COMPATIBILITY IDEOGRAPH-FAD0;Lo;0;L;22844;;;;N;;;;; +FAD1;CJK COMPATIBILITY IDEOGRAPH-FAD1;Lo;0;L;233D5;;;;N;;;;; +FAD2;CJK COMPATIBILITY IDEOGRAPH-FAD2;Lo;0;L;3B9D;;;;N;;;;; +FAD3;CJK COMPATIBILITY IDEOGRAPH-FAD3;Lo;0;L;4018;;;;N;;;;; +FAD4;CJK COMPATIBILITY IDEOGRAPH-FAD4;Lo;0;L;4039;;;;N;;;;; +FAD5;CJK COMPATIBILITY IDEOGRAPH-FAD5;Lo;0;L;25249;;;;N;;;;; +FAD6;CJK COMPATIBILITY IDEOGRAPH-FAD6;Lo;0;L;25CD0;;;;N;;;;; +FAD7;CJK COMPATIBILITY IDEOGRAPH-FAD7;Lo;0;L;27ED3;;;;N;;;;; +FAD8;CJK COMPATIBILITY IDEOGRAPH-FAD8;Lo;0;L;9F43;;;;N;;;;; +FAD9;CJK COMPATIBILITY IDEOGRAPH-FAD9;Lo;0;L;9F8E;;;;N;;;;; +FB00;LATIN SMALL LIGATURE FF;Ll;0;L;<compat> 0066 0066;;;;N;;;;; +FB01;LATIN SMALL LIGATURE FI;Ll;0;L;<compat> 0066 0069;;;;N;;;;; +FB02;LATIN SMALL LIGATURE FL;Ll;0;L;<compat> 0066 006C;;;;N;;;;; +FB03;LATIN SMALL LIGATURE FFI;Ll;0;L;<compat> 0066 0066 0069;;;;N;;;;; +FB04;LATIN SMALL LIGATURE FFL;Ll;0;L;<compat> 0066 0066 006C;;;;N;;;;; +FB05;LATIN SMALL LIGATURE LONG S T;Ll;0;L;<compat> 017F 0074;;;;N;;;;; +FB06;LATIN SMALL LIGATURE ST;Ll;0;L;<compat> 0073 0074;;;;N;;;;; +FB13;ARMENIAN SMALL LIGATURE MEN NOW;Ll;0;L;<compat> 0574 0576;;;;N;;;;; +FB14;ARMENIAN SMALL LIGATURE MEN ECH;Ll;0;L;<compat> 0574 0565;;;;N;;;;; +FB15;ARMENIAN SMALL LIGATURE MEN INI;Ll;0;L;<compat> 0574 056B;;;;N;;;;; +FB16;ARMENIAN SMALL LIGATURE VEW NOW;Ll;0;L;<compat> 057E 0576;;;;N;;;;; +FB17;ARMENIAN SMALL LIGATURE MEN XEH;Ll;0;L;<compat> 0574 056D;;;;N;;;;; +FB1D;HEBREW LETTER YOD WITH HIRIQ;Lo;0;R;05D9 05B4;;;;N;;;;; +FB1E;HEBREW POINT JUDEO-SPANISH VARIKA;Mn;26;NSM;;;;;N;HEBREW POINT VARIKA;;;; +FB1F;HEBREW LIGATURE YIDDISH YOD YOD PATAH;Lo;0;R;05F2 05B7;;;;N;;;;; +FB20;HEBREW LETTER ALTERNATIVE AYIN;Lo;0;R;<font> 05E2;;;;N;;;;; +FB21;HEBREW LETTER WIDE ALEF;Lo;0;R;<font> 05D0;;;;N;;;;; +FB22;HEBREW LETTER WIDE DALET;Lo;0;R;<font> 05D3;;;;N;;;;; +FB23;HEBREW LETTER WIDE HE;Lo;0;R;<font> 05D4;;;;N;;;;; +FB24;HEBREW LETTER WIDE KAF;Lo;0;R;<font> 05DB;;;;N;;;;; +FB25;HEBREW LETTER WIDE LAMED;Lo;0;R;<font> 05DC;;;;N;;;;; +FB26;HEBREW LETTER WIDE FINAL MEM;Lo;0;R;<font> 05DD;;;;N;;;;; +FB27;HEBREW LETTER WIDE RESH;Lo;0;R;<font> 05E8;;;;N;;;;; +FB28;HEBREW LETTER WIDE TAV;Lo;0;R;<font> 05EA;;;;N;;;;; +FB29;HEBREW LETTER ALTERNATIVE PLUS SIGN;Sm;0;ES;<font> 002B;;;;N;;;;; +FB2A;HEBREW LETTER SHIN WITH SHIN DOT;Lo;0;R;05E9 05C1;;;;N;;;;; +FB2B;HEBREW LETTER SHIN WITH SIN DOT;Lo;0;R;05E9 05C2;;;;N;;;;; +FB2C;HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT;Lo;0;R;FB49 05C1;;;;N;;;;; +FB2D;HEBREW LETTER SHIN WITH DAGESH AND SIN DOT;Lo;0;R;FB49 05C2;;;;N;;;;; +FB2E;HEBREW LETTER ALEF WITH PATAH;Lo;0;R;05D0 05B7;;;;N;;;;; +FB2F;HEBREW LETTER ALEF WITH QAMATS;Lo;0;R;05D0 05B8;;;;N;;;;; +FB30;HEBREW LETTER ALEF WITH MAPIQ;Lo;0;R;05D0 05BC;;;;N;;;;; +FB31;HEBREW LETTER BET WITH DAGESH;Lo;0;R;05D1 05BC;;;;N;;;;; +FB32;HEBREW LETTER GIMEL WITH DAGESH;Lo;0;R;05D2 05BC;;;;N;;;;; +FB33;HEBREW LETTER DALET WITH DAGESH;Lo;0;R;05D3 05BC;;;;N;;;;; +FB34;HEBREW LETTER HE WITH MAPIQ;Lo;0;R;05D4 05BC;;;;N;;;;; +FB35;HEBREW LETTER VAV WITH DAGESH;Lo;0;R;05D5 05BC;;;;N;;;;; +FB36;HEBREW LETTER ZAYIN WITH DAGESH;Lo;0;R;05D6 05BC;;;;N;;;;; +FB38;HEBREW LETTER TET WITH DAGESH;Lo;0;R;05D8 05BC;;;;N;;;;; +FB39;HEBREW LETTER YOD WITH DAGESH;Lo;0;R;05D9 05BC;;;;N;;;;; +FB3A;HEBREW LETTER FINAL KAF WITH DAGESH;Lo;0;R;05DA 05BC;;;;N;;;;; +FB3B;HEBREW LETTER KAF WITH DAGESH;Lo;0;R;05DB 05BC;;;;N;;;;; +FB3C;HEBREW LETTER LAMED WITH DAGESH;Lo;0;R;05DC 05BC;;;;N;;;;; +FB3E;HEBREW LETTER MEM WITH DAGESH;Lo;0;R;05DE 05BC;;;;N;;;;; +FB40;HEBREW LETTER NUN WITH DAGESH;Lo;0;R;05E0 05BC;;;;N;;;;; +FB41;HEBREW LETTER SAMEKH WITH DAGESH;Lo;0;R;05E1 05BC;;;;N;;;;; +FB43;HEBREW LETTER FINAL PE WITH DAGESH;Lo;0;R;05E3 05BC;;;;N;;;;; +FB44;HEBREW LETTER PE WITH DAGESH;Lo;0;R;05E4 05BC;;;;N;;;;; +FB46;HEBREW LETTER TSADI WITH DAGESH;Lo;0;R;05E6 05BC;;;;N;;;;; +FB47;HEBREW LETTER QOF WITH DAGESH;Lo;0;R;05E7 05BC;;;;N;;;;; +FB48;HEBREW LETTER RESH WITH DAGESH;Lo;0;R;05E8 05BC;;;;N;;;;; +FB49;HEBREW LETTER SHIN WITH DAGESH;Lo;0;R;05E9 05BC;;;;N;;;;; +FB4A;HEBREW LETTER TAV WITH DAGESH;Lo;0;R;05EA 05BC;;;;N;;;;; +FB4B;HEBREW LETTER VAV WITH HOLAM;Lo;0;R;05D5 05B9;;;;N;;;;; +FB4C;HEBREW LETTER BET WITH RAFE;Lo;0;R;05D1 05BF;;;;N;;;;; +FB4D;HEBREW LETTER KAF WITH RAFE;Lo;0;R;05DB 05BF;;;;N;;;;; +FB4E;HEBREW LETTER PE WITH RAFE;Lo;0;R;05E4 05BF;;;;N;;;;; +FB4F;HEBREW LIGATURE ALEF LAMED;Lo;0;R;<compat> 05D0 05DC;;;;N;;;;; +FB50;ARABIC LETTER ALEF WASLA ISOLATED FORM;Lo;0;AL;<isolated> 0671;;;;N;;;;; +FB51;ARABIC LETTER ALEF WASLA FINAL FORM;Lo;0;AL;<final> 0671;;;;N;;;;; +FB52;ARABIC LETTER BEEH ISOLATED FORM;Lo;0;AL;<isolated> 067B;;;;N;;;;; +FB53;ARABIC LETTER BEEH FINAL FORM;Lo;0;AL;<final> 067B;;;;N;;;;; +FB54;ARABIC LETTER BEEH INITIAL FORM;Lo;0;AL;<initial> 067B;;;;N;;;;; +FB55;ARABIC LETTER BEEH MEDIAL FORM;Lo;0;AL;<medial> 067B;;;;N;;;;; +FB56;ARABIC LETTER PEH ISOLATED FORM;Lo;0;AL;<isolated> 067E;;;;N;;;;; +FB57;ARABIC LETTER PEH FINAL FORM;Lo;0;AL;<final> 067E;;;;N;;;;; +FB58;ARABIC LETTER PEH INITIAL FORM;Lo;0;AL;<initial> 067E;;;;N;;;;; +FB59;ARABIC LETTER PEH MEDIAL FORM;Lo;0;AL;<medial> 067E;;;;N;;;;; +FB5A;ARABIC LETTER BEHEH ISOLATED FORM;Lo;0;AL;<isolated> 0680;;;;N;;;;; +FB5B;ARABIC LETTER BEHEH FINAL FORM;Lo;0;AL;<final> 0680;;;;N;;;;; +FB5C;ARABIC LETTER BEHEH INITIAL FORM;Lo;0;AL;<initial> 0680;;;;N;;;;; +FB5D;ARABIC LETTER BEHEH MEDIAL FORM;Lo;0;AL;<medial> 0680;;;;N;;;;; +FB5E;ARABIC LETTER TTEHEH ISOLATED FORM;Lo;0;AL;<isolated> 067A;;;;N;;;;; +FB5F;ARABIC LETTER TTEHEH FINAL FORM;Lo;0;AL;<final> 067A;;;;N;;;;; +FB60;ARABIC LETTER TTEHEH INITIAL FORM;Lo;0;AL;<initial> 067A;;;;N;;;;; +FB61;ARABIC LETTER TTEHEH MEDIAL FORM;Lo;0;AL;<medial> 067A;;;;N;;;;; +FB62;ARABIC LETTER TEHEH ISOLATED FORM;Lo;0;AL;<isolated> 067F;;;;N;;;;; +FB63;ARABIC LETTER TEHEH FINAL FORM;Lo;0;AL;<final> 067F;;;;N;;;;; +FB64;ARABIC LETTER TEHEH INITIAL FORM;Lo;0;AL;<initial> 067F;;;;N;;;;; +FB65;ARABIC LETTER TEHEH MEDIAL FORM;Lo;0;AL;<medial> 067F;;;;N;;;;; +FB66;ARABIC LETTER TTEH ISOLATED FORM;Lo;0;AL;<isolated> 0679;;;;N;;;;; +FB67;ARABIC LETTER TTEH FINAL FORM;Lo;0;AL;<final> 0679;;;;N;;;;; +FB68;ARABIC LETTER TTEH INITIAL FORM;Lo;0;AL;<initial> 0679;;;;N;;;;; +FB69;ARABIC LETTER TTEH MEDIAL FORM;Lo;0;AL;<medial> 0679;;;;N;;;;; +FB6A;ARABIC LETTER VEH ISOLATED FORM;Lo;0;AL;<isolated> 06A4;;;;N;;;;; +FB6B;ARABIC LETTER VEH FINAL FORM;Lo;0;AL;<final> 06A4;;;;N;;;;; +FB6C;ARABIC LETTER VEH INITIAL FORM;Lo;0;AL;<initial> 06A4;;;;N;;;;; +FB6D;ARABIC LETTER VEH MEDIAL FORM;Lo;0;AL;<medial> 06A4;;;;N;;;;; +FB6E;ARABIC LETTER PEHEH ISOLATED FORM;Lo;0;AL;<isolated> 06A6;;;;N;;;;; +FB6F;ARABIC LETTER PEHEH FINAL FORM;Lo;0;AL;<final> 06A6;;;;N;;;;; +FB70;ARABIC LETTER PEHEH INITIAL FORM;Lo;0;AL;<initial> 06A6;;;;N;;;;; +FB71;ARABIC LETTER PEHEH MEDIAL FORM;Lo;0;AL;<medial> 06A6;;;;N;;;;; +FB72;ARABIC LETTER DYEH ISOLATED FORM;Lo;0;AL;<isolated> 0684;;;;N;;;;; +FB73;ARABIC LETTER DYEH FINAL FORM;Lo;0;AL;<final> 0684;;;;N;;;;; +FB74;ARABIC LETTER DYEH INITIAL FORM;Lo;0;AL;<initial> 0684;;;;N;;;;; +FB75;ARABIC LETTER DYEH MEDIAL FORM;Lo;0;AL;<medial> 0684;;;;N;;;;; +FB76;ARABIC LETTER NYEH ISOLATED FORM;Lo;0;AL;<isolated> 0683;;;;N;;;;; +FB77;ARABIC LETTER NYEH FINAL FORM;Lo;0;AL;<final> 0683;;;;N;;;;; +FB78;ARABIC LETTER NYEH INITIAL FORM;Lo;0;AL;<initial> 0683;;;;N;;;;; +FB79;ARABIC LETTER NYEH MEDIAL FORM;Lo;0;AL;<medial> 0683;;;;N;;;;; +FB7A;ARABIC LETTER TCHEH ISOLATED FORM;Lo;0;AL;<isolated> 0686;;;;N;;;;; +FB7B;ARABIC LETTER TCHEH FINAL FORM;Lo;0;AL;<final> 0686;;;;N;;;;; +FB7C;ARABIC LETTER TCHEH INITIAL FORM;Lo;0;AL;<initial> 0686;;;;N;;;;; +FB7D;ARABIC LETTER TCHEH MEDIAL FORM;Lo;0;AL;<medial> 0686;;;;N;;;;; +FB7E;ARABIC LETTER TCHEHEH ISOLATED FORM;Lo;0;AL;<isolated> 0687;;;;N;;;;; +FB7F;ARABIC LETTER TCHEHEH FINAL FORM;Lo;0;AL;<final> 0687;;;;N;;;;; +FB80;ARABIC LETTER TCHEHEH INITIAL FORM;Lo;0;AL;<initial> 0687;;;;N;;;;; +FB81;ARABIC LETTER TCHEHEH MEDIAL FORM;Lo;0;AL;<medial> 0687;;;;N;;;;; +FB82;ARABIC LETTER DDAHAL ISOLATED FORM;Lo;0;AL;<isolated> 068D;;;;N;;;;; +FB83;ARABIC LETTER DDAHAL FINAL FORM;Lo;0;AL;<final> 068D;;;;N;;;;; +FB84;ARABIC LETTER DAHAL ISOLATED FORM;Lo;0;AL;<isolated> 068C;;;;N;;;;; +FB85;ARABIC LETTER DAHAL FINAL FORM;Lo;0;AL;<final> 068C;;;;N;;;;; +FB86;ARABIC LETTER DUL ISOLATED FORM;Lo;0;AL;<isolated> 068E;;;;N;;;;; +FB87;ARABIC LETTER DUL FINAL FORM;Lo;0;AL;<final> 068E;;;;N;;;;; +FB88;ARABIC LETTER DDAL ISOLATED FORM;Lo;0;AL;<isolated> 0688;;;;N;;;;; +FB89;ARABIC LETTER DDAL FINAL FORM;Lo;0;AL;<final> 0688;;;;N;;;;; +FB8A;ARABIC LETTER JEH ISOLATED FORM;Lo;0;AL;<isolated> 0698;;;;N;;;;; +FB8B;ARABIC LETTER JEH FINAL FORM;Lo;0;AL;<final> 0698;;;;N;;;;; +FB8C;ARABIC LETTER RREH ISOLATED FORM;Lo;0;AL;<isolated> 0691;;;;N;;;;; +FB8D;ARABIC LETTER RREH FINAL FORM;Lo;0;AL;<final> 0691;;;;N;;;;; +FB8E;ARABIC LETTER KEHEH ISOLATED FORM;Lo;0;AL;<isolated> 06A9;;;;N;;;;; +FB8F;ARABIC LETTER KEHEH FINAL FORM;Lo;0;AL;<final> 06A9;;;;N;;;;; +FB90;ARABIC LETTER KEHEH INITIAL FORM;Lo;0;AL;<initial> 06A9;;;;N;;;;; +FB91;ARABIC LETTER KEHEH MEDIAL FORM;Lo;0;AL;<medial> 06A9;;;;N;;;;; +FB92;ARABIC LETTER GAF ISOLATED FORM;Lo;0;AL;<isolated> 06AF;;;;N;;;;; +FB93;ARABIC LETTER GAF FINAL FORM;Lo;0;AL;<final> 06AF;;;;N;;;;; +FB94;ARABIC LETTER GAF INITIAL FORM;Lo;0;AL;<initial> 06AF;;;;N;;;;; +FB95;ARABIC LETTER GAF MEDIAL FORM;Lo;0;AL;<medial> 06AF;;;;N;;;;; +FB96;ARABIC LETTER GUEH ISOLATED FORM;Lo;0;AL;<isolated> 06B3;;;;N;;;;; +FB97;ARABIC LETTER GUEH FINAL FORM;Lo;0;AL;<final> 06B3;;;;N;;;;; +FB98;ARABIC LETTER GUEH INITIAL FORM;Lo;0;AL;<initial> 06B3;;;;N;;;;; +FB99;ARABIC LETTER GUEH MEDIAL FORM;Lo;0;AL;<medial> 06B3;;;;N;;;;; +FB9A;ARABIC LETTER NGOEH ISOLATED FORM;Lo;0;AL;<isolated> 06B1;;;;N;;;;; +FB9B;ARABIC LETTER NGOEH FINAL FORM;Lo;0;AL;<final> 06B1;;;;N;;;;; +FB9C;ARABIC LETTER NGOEH INITIAL FORM;Lo;0;AL;<initial> 06B1;;;;N;;;;; +FB9D;ARABIC LETTER NGOEH MEDIAL FORM;Lo;0;AL;<medial> 06B1;;;;N;;;;; +FB9E;ARABIC LETTER NOON GHUNNA ISOLATED FORM;Lo;0;AL;<isolated> 06BA;;;;N;;;;; +FB9F;ARABIC LETTER NOON GHUNNA FINAL FORM;Lo;0;AL;<final> 06BA;;;;N;;;;; +FBA0;ARABIC LETTER RNOON ISOLATED FORM;Lo;0;AL;<isolated> 06BB;;;;N;;;;; +FBA1;ARABIC LETTER RNOON FINAL FORM;Lo;0;AL;<final> 06BB;;;;N;;;;; +FBA2;ARABIC LETTER RNOON INITIAL FORM;Lo;0;AL;<initial> 06BB;;;;N;;;;; +FBA3;ARABIC LETTER RNOON MEDIAL FORM;Lo;0;AL;<medial> 06BB;;;;N;;;;; +FBA4;ARABIC LETTER HEH WITH YEH ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 06C0;;;;N;;;;; +FBA5;ARABIC LETTER HEH WITH YEH ABOVE FINAL FORM;Lo;0;AL;<final> 06C0;;;;N;;;;; +FBA6;ARABIC LETTER HEH GOAL ISOLATED FORM;Lo;0;AL;<isolated> 06C1;;;;N;;;;; +FBA7;ARABIC LETTER HEH GOAL FINAL FORM;Lo;0;AL;<final> 06C1;;;;N;;;;; +FBA8;ARABIC LETTER HEH GOAL INITIAL FORM;Lo;0;AL;<initial> 06C1;;;;N;;;;; +FBA9;ARABIC LETTER HEH GOAL MEDIAL FORM;Lo;0;AL;<medial> 06C1;;;;N;;;;; +FBAA;ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM;Lo;0;AL;<isolated> 06BE;;;;N;;;;; +FBAB;ARABIC LETTER HEH DOACHASHMEE FINAL FORM;Lo;0;AL;<final> 06BE;;;;N;;;;; +FBAC;ARABIC LETTER HEH DOACHASHMEE INITIAL FORM;Lo;0;AL;<initial> 06BE;;;;N;;;;; +FBAD;ARABIC LETTER HEH DOACHASHMEE MEDIAL FORM;Lo;0;AL;<medial> 06BE;;;;N;;;;; +FBAE;ARABIC LETTER YEH BARREE ISOLATED FORM;Lo;0;AL;<isolated> 06D2;;;;N;;;;; +FBAF;ARABIC LETTER YEH BARREE FINAL FORM;Lo;0;AL;<final> 06D2;;;;N;;;;; +FBB0;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 06D3;;;;N;;;;; +FBB1;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 06D3;;;;N;;;;; +FBB2;ARABIC SYMBOL DOT ABOVE;Sk;0;AL;;;;;N;;;;; +FBB3;ARABIC SYMBOL DOT BELOW;Sk;0;AL;;;;;N;;;;; +FBB4;ARABIC SYMBOL TWO DOTS ABOVE;Sk;0;AL;;;;;N;;;;; +FBB5;ARABIC SYMBOL TWO DOTS BELOW;Sk;0;AL;;;;;N;;;;; +FBB6;ARABIC SYMBOL THREE DOTS ABOVE;Sk;0;AL;;;;;N;;;;; +FBB7;ARABIC SYMBOL THREE DOTS BELOW;Sk;0;AL;;;;;N;;;;; +FBB8;ARABIC SYMBOL THREE DOTS POINTING DOWNWARDS ABOVE;Sk;0;AL;;;;;N;;;;; +FBB9;ARABIC SYMBOL THREE DOTS POINTING DOWNWARDS BELOW;Sk;0;AL;;;;;N;;;;; +FBBA;ARABIC SYMBOL FOUR DOTS ABOVE;Sk;0;AL;;;;;N;;;;; +FBBB;ARABIC SYMBOL FOUR DOTS BELOW;Sk;0;AL;;;;;N;;;;; +FBBC;ARABIC SYMBOL DOUBLE VERTICAL BAR BELOW;Sk;0;AL;;;;;N;;;;; +FBBD;ARABIC SYMBOL TWO DOTS VERTICALLY ABOVE;Sk;0;AL;;;;;N;;;;; +FBBE;ARABIC SYMBOL TWO DOTS VERTICALLY BELOW;Sk;0;AL;;;;;N;;;;; +FBBF;ARABIC SYMBOL RING;Sk;0;AL;;;;;N;;;;; +FBC0;ARABIC SYMBOL SMALL TAH ABOVE;Sk;0;AL;;;;;N;;;;; +FBC1;ARABIC SYMBOL SMALL TAH BELOW;Sk;0;AL;;;;;N;;;;; +FBD3;ARABIC LETTER NG ISOLATED FORM;Lo;0;AL;<isolated> 06AD;;;;N;;;;; +FBD4;ARABIC LETTER NG FINAL FORM;Lo;0;AL;<final> 06AD;;;;N;;;;; +FBD5;ARABIC LETTER NG INITIAL FORM;Lo;0;AL;<initial> 06AD;;;;N;;;;; +FBD6;ARABIC LETTER NG MEDIAL FORM;Lo;0;AL;<medial> 06AD;;;;N;;;;; +FBD7;ARABIC LETTER U ISOLATED FORM;Lo;0;AL;<isolated> 06C7;;;;N;;;;; +FBD8;ARABIC LETTER U FINAL FORM;Lo;0;AL;<final> 06C7;;;;N;;;;; +FBD9;ARABIC LETTER OE ISOLATED FORM;Lo;0;AL;<isolated> 06C6;;;;N;;;;; +FBDA;ARABIC LETTER OE FINAL FORM;Lo;0;AL;<final> 06C6;;;;N;;;;; +FBDB;ARABIC LETTER YU ISOLATED FORM;Lo;0;AL;<isolated> 06C8;;;;N;;;;; +FBDC;ARABIC LETTER YU FINAL FORM;Lo;0;AL;<final> 06C8;;;;N;;;;; +FBDD;ARABIC LETTER U WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0677;;;;N;;;;; +FBDE;ARABIC LETTER VE ISOLATED FORM;Lo;0;AL;<isolated> 06CB;;;;N;;;;; +FBDF;ARABIC LETTER VE FINAL FORM;Lo;0;AL;<final> 06CB;;;;N;;;;; +FBE0;ARABIC LETTER KIRGHIZ OE ISOLATED FORM;Lo;0;AL;<isolated> 06C5;;;;N;;;;; +FBE1;ARABIC LETTER KIRGHIZ OE FINAL FORM;Lo;0;AL;<final> 06C5;;;;N;;;;; +FBE2;ARABIC LETTER KIRGHIZ YU ISOLATED FORM;Lo;0;AL;<isolated> 06C9;;;;N;;;;; +FBE3;ARABIC LETTER KIRGHIZ YU FINAL FORM;Lo;0;AL;<final> 06C9;;;;N;;;;; +FBE4;ARABIC LETTER E ISOLATED FORM;Lo;0;AL;<isolated> 06D0;;;;N;;;;; +FBE5;ARABIC LETTER E FINAL FORM;Lo;0;AL;<final> 06D0;;;;N;;;;; +FBE6;ARABIC LETTER E INITIAL FORM;Lo;0;AL;<initial> 06D0;;;;N;;;;; +FBE7;ARABIC LETTER E MEDIAL FORM;Lo;0;AL;<medial> 06D0;;;;N;;;;; +FBE8;ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA INITIAL FORM;Lo;0;AL;<initial> 0649;;;;N;;;;; +FBE9;ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA MEDIAL FORM;Lo;0;AL;<medial> 0649;;;;N;;;;; +FBEA;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0626 0627;;;;N;;;;; +FBEB;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF FINAL FORM;Lo;0;AL;<final> 0626 0627;;;;N;;;;; +FBEC;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH AE ISOLATED FORM;Lo;0;AL;<isolated> 0626 06D5;;;;N;;;;; +FBED;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH AE FINAL FORM;Lo;0;AL;<final> 0626 06D5;;;;N;;;;; +FBEE;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH WAW ISOLATED FORM;Lo;0;AL;<isolated> 0626 0648;;;;N;;;;; +FBEF;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH WAW FINAL FORM;Lo;0;AL;<final> 0626 0648;;;;N;;;;; +FBF0;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH U ISOLATED FORM;Lo;0;AL;<isolated> 0626 06C7;;;;N;;;;; +FBF1;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH U FINAL FORM;Lo;0;AL;<final> 0626 06C7;;;;N;;;;; +FBF2;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH OE ISOLATED FORM;Lo;0;AL;<isolated> 0626 06C6;;;;N;;;;; +FBF3;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH OE FINAL FORM;Lo;0;AL;<final> 0626 06C6;;;;N;;;;; +FBF4;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YU ISOLATED FORM;Lo;0;AL;<isolated> 0626 06C8;;;;N;;;;; +FBF5;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YU FINAL FORM;Lo;0;AL;<final> 0626 06C8;;;;N;;;;; +FBF6;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E ISOLATED FORM;Lo;0;AL;<isolated> 0626 06D0;;;;N;;;;; +FBF7;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E FINAL FORM;Lo;0;AL;<final> 0626 06D0;;;;N;;;;; +FBF8;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E INITIAL FORM;Lo;0;AL;<initial> 0626 06D0;;;;N;;;;; +FBF9;ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0626 0649;;;;N;;;;; +FBFA;ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0626 0649;;;;N;;;;; +FBFB;ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA INITIAL FORM;Lo;0;AL;<initial> 0626 0649;;;;N;;;;; +FBFC;ARABIC LETTER FARSI YEH ISOLATED FORM;Lo;0;AL;<isolated> 06CC;;;;N;;;;; +FBFD;ARABIC LETTER FARSI YEH FINAL FORM;Lo;0;AL;<final> 06CC;;;;N;;;;; +FBFE;ARABIC LETTER FARSI YEH INITIAL FORM;Lo;0;AL;<initial> 06CC;;;;N;;;;; +FBFF;ARABIC LETTER FARSI YEH MEDIAL FORM;Lo;0;AL;<medial> 06CC;;;;N;;;;; +FC00;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0626 062C;;;;N;;;;; +FC01;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0626 062D;;;;N;;;;; +FC02;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0626 0645;;;;N;;;;; +FC03;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0626 0649;;;;N;;;;; +FC04;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0626 064A;;;;N;;;;; +FC05;ARABIC LIGATURE BEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0628 062C;;;;N;;;;; +FC06;ARABIC LIGATURE BEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0628 062D;;;;N;;;;; +FC07;ARABIC LIGATURE BEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0628 062E;;;;N;;;;; +FC08;ARABIC LIGATURE BEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0628 0645;;;;N;;;;; +FC09;ARABIC LIGATURE BEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0628 0649;;;;N;;;;; +FC0A;ARABIC LIGATURE BEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0628 064A;;;;N;;;;; +FC0B;ARABIC LIGATURE TEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062A 062C;;;;N;;;;; +FC0C;ARABIC LIGATURE TEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 062A 062D;;;;N;;;;; +FC0D;ARABIC LIGATURE TEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 062A 062E;;;;N;;;;; +FC0E;ARABIC LIGATURE TEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062A 0645;;;;N;;;;; +FC0F;ARABIC LIGATURE TEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062A 0649;;;;N;;;;; +FC10;ARABIC LIGATURE TEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062A 064A;;;;N;;;;; +FC11;ARABIC LIGATURE THEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062B 062C;;;;N;;;;; +FC12;ARABIC LIGATURE THEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062B 0645;;;;N;;;;; +FC13;ARABIC LIGATURE THEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062B 0649;;;;N;;;;; +FC14;ARABIC LIGATURE THEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062B 064A;;;;N;;;;; +FC15;ARABIC LIGATURE JEEM WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 062C 062D;;;;N;;;;; +FC16;ARABIC LIGATURE JEEM WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062C 0645;;;;N;;;;; +FC17;ARABIC LIGATURE HAH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062D 062C;;;;N;;;;; +FC18;ARABIC LIGATURE HAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062D 0645;;;;N;;;;; +FC19;ARABIC LIGATURE KHAH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062E 062C;;;;N;;;;; +FC1A;ARABIC LIGATURE KHAH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 062E 062D;;;;N;;;;; +FC1B;ARABIC LIGATURE KHAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062E 0645;;;;N;;;;; +FC1C;ARABIC LIGATURE SEEN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0633 062C;;;;N;;;;; +FC1D;ARABIC LIGATURE SEEN WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0633 062D;;;;N;;;;; +FC1E;ARABIC LIGATURE SEEN WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0633 062E;;;;N;;;;; +FC1F;ARABIC LIGATURE SEEN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0633 0645;;;;N;;;;; +FC20;ARABIC LIGATURE SAD WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0635 062D;;;;N;;;;; +FC21;ARABIC LIGATURE SAD WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0635 0645;;;;N;;;;; +FC22;ARABIC LIGATURE DAD WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0636 062C;;;;N;;;;; +FC23;ARABIC LIGATURE DAD WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0636 062D;;;;N;;;;; +FC24;ARABIC LIGATURE DAD WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0636 062E;;;;N;;;;; +FC25;ARABIC LIGATURE DAD WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0636 0645;;;;N;;;;; +FC26;ARABIC LIGATURE TAH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0637 062D;;;;N;;;;; +FC27;ARABIC LIGATURE TAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0637 0645;;;;N;;;;; +FC28;ARABIC LIGATURE ZAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0638 0645;;;;N;;;;; +FC29;ARABIC LIGATURE AIN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0639 062C;;;;N;;;;; +FC2A;ARABIC LIGATURE AIN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0639 0645;;;;N;;;;; +FC2B;ARABIC LIGATURE GHAIN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 063A 062C;;;;N;;;;; +FC2C;ARABIC LIGATURE GHAIN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 063A 0645;;;;N;;;;; +FC2D;ARABIC LIGATURE FEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0641 062C;;;;N;;;;; +FC2E;ARABIC LIGATURE FEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0641 062D;;;;N;;;;; +FC2F;ARABIC LIGATURE FEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0641 062E;;;;N;;;;; +FC30;ARABIC LIGATURE FEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0641 0645;;;;N;;;;; +FC31;ARABIC LIGATURE FEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0641 0649;;;;N;;;;; +FC32;ARABIC LIGATURE FEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0641 064A;;;;N;;;;; +FC33;ARABIC LIGATURE QAF WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0642 062D;;;;N;;;;; +FC34;ARABIC LIGATURE QAF WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0642 0645;;;;N;;;;; +FC35;ARABIC LIGATURE QAF WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0642 0649;;;;N;;;;; +FC36;ARABIC LIGATURE QAF WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0642 064A;;;;N;;;;; +FC37;ARABIC LIGATURE KAF WITH ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0643 0627;;;;N;;;;; +FC38;ARABIC LIGATURE KAF WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0643 062C;;;;N;;;;; +FC39;ARABIC LIGATURE KAF WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0643 062D;;;;N;;;;; +FC3A;ARABIC LIGATURE KAF WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0643 062E;;;;N;;;;; +FC3B;ARABIC LIGATURE KAF WITH LAM ISOLATED FORM;Lo;0;AL;<isolated> 0643 0644;;;;N;;;;; +FC3C;ARABIC LIGATURE KAF WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0643 0645;;;;N;;;;; +FC3D;ARABIC LIGATURE KAF WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0643 0649;;;;N;;;;; +FC3E;ARABIC LIGATURE KAF WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0643 064A;;;;N;;;;; +FC3F;ARABIC LIGATURE LAM WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0644 062C;;;;N;;;;; +FC40;ARABIC LIGATURE LAM WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0644 062D;;;;N;;;;; +FC41;ARABIC LIGATURE LAM WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0644 062E;;;;N;;;;; +FC42;ARABIC LIGATURE LAM WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0644 0645;;;;N;;;;; +FC43;ARABIC LIGATURE LAM WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0644 0649;;;;N;;;;; +FC44;ARABIC LIGATURE LAM WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0644 064A;;;;N;;;;; +FC45;ARABIC LIGATURE MEEM WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0645 062C;;;;N;;;;; +FC46;ARABIC LIGATURE MEEM WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0645 062D;;;;N;;;;; +FC47;ARABIC LIGATURE MEEM WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0645 062E;;;;N;;;;; +FC48;ARABIC LIGATURE MEEM WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0645 0645;;;;N;;;;; +FC49;ARABIC LIGATURE MEEM WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0645 0649;;;;N;;;;; +FC4A;ARABIC LIGATURE MEEM WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0645 064A;;;;N;;;;; +FC4B;ARABIC LIGATURE NOON WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0646 062C;;;;N;;;;; +FC4C;ARABIC LIGATURE NOON WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0646 062D;;;;N;;;;; +FC4D;ARABIC LIGATURE NOON WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0646 062E;;;;N;;;;; +FC4E;ARABIC LIGATURE NOON WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0646 0645;;;;N;;;;; +FC4F;ARABIC LIGATURE NOON WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0646 0649;;;;N;;;;; +FC50;ARABIC LIGATURE NOON WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0646 064A;;;;N;;;;; +FC51;ARABIC LIGATURE HEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0647 062C;;;;N;;;;; +FC52;ARABIC LIGATURE HEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0647 0645;;;;N;;;;; +FC53;ARABIC LIGATURE HEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0647 0649;;;;N;;;;; +FC54;ARABIC LIGATURE HEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0647 064A;;;;N;;;;; +FC55;ARABIC LIGATURE YEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 064A 062C;;;;N;;;;; +FC56;ARABIC LIGATURE YEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 064A 062D;;;;N;;;;; +FC57;ARABIC LIGATURE YEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 064A 062E;;;;N;;;;; +FC58;ARABIC LIGATURE YEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 064A 0645;;;;N;;;;; +FC59;ARABIC LIGATURE YEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 064A 0649;;;;N;;;;; +FC5A;ARABIC LIGATURE YEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 064A 064A;;;;N;;;;; +FC5B;ARABIC LIGATURE THAL WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0630 0670;;;;N;;;;; +FC5C;ARABIC LIGATURE REH WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0631 0670;;;;N;;;;; +FC5D;ARABIC LIGATURE ALEF MAKSURA WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0649 0670;;;;N;;;;; +FC5E;ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064C 0651;;;;N;;;;; +FC5F;ARABIC LIGATURE SHADDA WITH KASRATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064D 0651;;;;N;;;;; +FC60;ARABIC LIGATURE SHADDA WITH FATHA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064E 0651;;;;N;;;;; +FC61;ARABIC LIGATURE SHADDA WITH DAMMA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064F 0651;;;;N;;;;; +FC62;ARABIC LIGATURE SHADDA WITH KASRA ISOLATED FORM;Lo;0;AL;<isolated> 0020 0650 0651;;;;N;;;;; +FC63;ARABIC LIGATURE SHADDA WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0020 0651 0670;;;;N;;;;; +FC64;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH REH FINAL FORM;Lo;0;AL;<final> 0626 0631;;;;N;;;;; +FC65;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ZAIN FINAL FORM;Lo;0;AL;<final> 0626 0632;;;;N;;;;; +FC66;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM FINAL FORM;Lo;0;AL;<final> 0626 0645;;;;N;;;;; +FC67;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH NOON FINAL FORM;Lo;0;AL;<final> 0626 0646;;;;N;;;;; +FC68;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0626 0649;;;;N;;;;; +FC69;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YEH FINAL FORM;Lo;0;AL;<final> 0626 064A;;;;N;;;;; +FC6A;ARABIC LIGATURE BEH WITH REH FINAL FORM;Lo;0;AL;<final> 0628 0631;;;;N;;;;; +FC6B;ARABIC LIGATURE BEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 0628 0632;;;;N;;;;; +FC6C;ARABIC LIGATURE BEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0628 0645;;;;N;;;;; +FC6D;ARABIC LIGATURE BEH WITH NOON FINAL FORM;Lo;0;AL;<final> 0628 0646;;;;N;;;;; +FC6E;ARABIC LIGATURE BEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0628 0649;;;;N;;;;; +FC6F;ARABIC LIGATURE BEH WITH YEH FINAL FORM;Lo;0;AL;<final> 0628 064A;;;;N;;;;; +FC70;ARABIC LIGATURE TEH WITH REH FINAL FORM;Lo;0;AL;<final> 062A 0631;;;;N;;;;; +FC71;ARABIC LIGATURE TEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 062A 0632;;;;N;;;;; +FC72;ARABIC LIGATURE TEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 062A 0645;;;;N;;;;; +FC73;ARABIC LIGATURE TEH WITH NOON FINAL FORM;Lo;0;AL;<final> 062A 0646;;;;N;;;;; +FC74;ARABIC LIGATURE TEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 0649;;;;N;;;;; +FC75;ARABIC LIGATURE TEH WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 064A;;;;N;;;;; +FC76;ARABIC LIGATURE THEH WITH REH FINAL FORM;Lo;0;AL;<final> 062B 0631;;;;N;;;;; +FC77;ARABIC LIGATURE THEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 062B 0632;;;;N;;;;; +FC78;ARABIC LIGATURE THEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 062B 0645;;;;N;;;;; +FC79;ARABIC LIGATURE THEH WITH NOON FINAL FORM;Lo;0;AL;<final> 062B 0646;;;;N;;;;; +FC7A;ARABIC LIGATURE THEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062B 0649;;;;N;;;;; +FC7B;ARABIC LIGATURE THEH WITH YEH FINAL FORM;Lo;0;AL;<final> 062B 064A;;;;N;;;;; +FC7C;ARABIC LIGATURE FEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0641 0649;;;;N;;;;; +FC7D;ARABIC LIGATURE FEH WITH YEH FINAL FORM;Lo;0;AL;<final> 0641 064A;;;;N;;;;; +FC7E;ARABIC LIGATURE QAF WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0642 0649;;;;N;;;;; +FC7F;ARABIC LIGATURE QAF WITH YEH FINAL FORM;Lo;0;AL;<final> 0642 064A;;;;N;;;;; +FC80;ARABIC LIGATURE KAF WITH ALEF FINAL FORM;Lo;0;AL;<final> 0643 0627;;;;N;;;;; +FC81;ARABIC LIGATURE KAF WITH LAM FINAL FORM;Lo;0;AL;<final> 0643 0644;;;;N;;;;; +FC82;ARABIC LIGATURE KAF WITH MEEM FINAL FORM;Lo;0;AL;<final> 0643 0645;;;;N;;;;; +FC83;ARABIC LIGATURE KAF WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0643 0649;;;;N;;;;; +FC84;ARABIC LIGATURE KAF WITH YEH FINAL FORM;Lo;0;AL;<final> 0643 064A;;;;N;;;;; +FC85;ARABIC LIGATURE LAM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 0645;;;;N;;;;; +FC86;ARABIC LIGATURE LAM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0644 0649;;;;N;;;;; +FC87;ARABIC LIGATURE LAM WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 064A;;;;N;;;;; +FC88;ARABIC LIGATURE MEEM WITH ALEF FINAL FORM;Lo;0;AL;<final> 0645 0627;;;;N;;;;; +FC89;ARABIC LIGATURE MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0645 0645;;;;N;;;;; +FC8A;ARABIC LIGATURE NOON WITH REH FINAL FORM;Lo;0;AL;<final> 0646 0631;;;;N;;;;; +FC8B;ARABIC LIGATURE NOON WITH ZAIN FINAL FORM;Lo;0;AL;<final> 0646 0632;;;;N;;;;; +FC8C;ARABIC LIGATURE NOON WITH MEEM FINAL FORM;Lo;0;AL;<final> 0646 0645;;;;N;;;;; +FC8D;ARABIC LIGATURE NOON WITH NOON FINAL FORM;Lo;0;AL;<final> 0646 0646;;;;N;;;;; +FC8E;ARABIC LIGATURE NOON WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 0649;;;;N;;;;; +FC8F;ARABIC LIGATURE NOON WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 064A;;;;N;;;;; +FC90;ARABIC LIGATURE ALEF MAKSURA WITH SUPERSCRIPT ALEF FINAL FORM;Lo;0;AL;<final> 0649 0670;;;;N;;;;; +FC91;ARABIC LIGATURE YEH WITH REH FINAL FORM;Lo;0;AL;<final> 064A 0631;;;;N;;;;; +FC92;ARABIC LIGATURE YEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 064A 0632;;;;N;;;;; +FC93;ARABIC LIGATURE YEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 064A 0645;;;;N;;;;; +FC94;ARABIC LIGATURE YEH WITH NOON FINAL FORM;Lo;0;AL;<final> 064A 0646;;;;N;;;;; +FC95;ARABIC LIGATURE YEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 064A 0649;;;;N;;;;; +FC96;ARABIC LIGATURE YEH WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 064A;;;;N;;;;; +FC97;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0626 062C;;;;N;;;;; +FC98;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0626 062D;;;;N;;;;; +FC99;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0626 062E;;;;N;;;;; +FC9A;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0626 0645;;;;N;;;;; +FC9B;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0626 0647;;;;N;;;;; +FC9C;ARABIC LIGATURE BEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0628 062C;;;;N;;;;; +FC9D;ARABIC LIGATURE BEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0628 062D;;;;N;;;;; +FC9E;ARABIC LIGATURE BEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0628 062E;;;;N;;;;; +FC9F;ARABIC LIGATURE BEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0628 0645;;;;N;;;;; +FCA0;ARABIC LIGATURE BEH WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0628 0647;;;;N;;;;; +FCA1;ARABIC LIGATURE TEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062C;;;;N;;;;; +FCA2;ARABIC LIGATURE TEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062A 062D;;;;N;;;;; +FCA3;ARABIC LIGATURE TEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 062A 062E;;;;N;;;;; +FCA4;ARABIC LIGATURE TEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 0645;;;;N;;;;; +FCA5;ARABIC LIGATURE TEH WITH HEH INITIAL FORM;Lo;0;AL;<initial> 062A 0647;;;;N;;;;; +FCA6;ARABIC LIGATURE THEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062B 0645;;;;N;;;;; +FCA7;ARABIC LIGATURE JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062C 062D;;;;N;;;;; +FCA8;ARABIC LIGATURE JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062C 0645;;;;N;;;;; +FCA9;ARABIC LIGATURE HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062D 062C;;;;N;;;;; +FCAA;ARABIC LIGATURE HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062D 0645;;;;N;;;;; +FCAB;ARABIC LIGATURE KHAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062E 062C;;;;N;;;;; +FCAC;ARABIC LIGATURE KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062E 0645;;;;N;;;;; +FCAD;ARABIC LIGATURE SEEN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0633 062C;;;;N;;;;; +FCAE;ARABIC LIGATURE SEEN WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0633 062D;;;;N;;;;; +FCAF;ARABIC LIGATURE SEEN WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0633 062E;;;;N;;;;; +FCB0;ARABIC LIGATURE SEEN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0633 0645;;;;N;;;;; +FCB1;ARABIC LIGATURE SAD WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0635 062D;;;;N;;;;; +FCB2;ARABIC LIGATURE SAD WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0635 062E;;;;N;;;;; +FCB3;ARABIC LIGATURE SAD WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0635 0645;;;;N;;;;; +FCB4;ARABIC LIGATURE DAD WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0636 062C;;;;N;;;;; +FCB5;ARABIC LIGATURE DAD WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0636 062D;;;;N;;;;; +FCB6;ARABIC LIGATURE DAD WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0636 062E;;;;N;;;;; +FCB7;ARABIC LIGATURE DAD WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0636 0645;;;;N;;;;; +FCB8;ARABIC LIGATURE TAH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0637 062D;;;;N;;;;; +FCB9;ARABIC LIGATURE ZAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0638 0645;;;;N;;;;; +FCBA;ARABIC LIGATURE AIN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0639 062C;;;;N;;;;; +FCBB;ARABIC LIGATURE AIN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0639 0645;;;;N;;;;; +FCBC;ARABIC LIGATURE GHAIN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 063A 062C;;;;N;;;;; +FCBD;ARABIC LIGATURE GHAIN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 063A 0645;;;;N;;;;; +FCBE;ARABIC LIGATURE FEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0641 062C;;;;N;;;;; +FCBF;ARABIC LIGATURE FEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0641 062D;;;;N;;;;; +FCC0;ARABIC LIGATURE FEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0641 062E;;;;N;;;;; +FCC1;ARABIC LIGATURE FEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0641 0645;;;;N;;;;; +FCC2;ARABIC LIGATURE QAF WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0642 062D;;;;N;;;;; +FCC3;ARABIC LIGATURE QAF WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0642 0645;;;;N;;;;; +FCC4;ARABIC LIGATURE KAF WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0643 062C;;;;N;;;;; +FCC5;ARABIC LIGATURE KAF WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0643 062D;;;;N;;;;; +FCC6;ARABIC LIGATURE KAF WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0643 062E;;;;N;;;;; +FCC7;ARABIC LIGATURE KAF WITH LAM INITIAL FORM;Lo;0;AL;<initial> 0643 0644;;;;N;;;;; +FCC8;ARABIC LIGATURE KAF WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0643 0645;;;;N;;;;; +FCC9;ARABIC LIGATURE LAM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062C;;;;N;;;;; +FCCA;ARABIC LIGATURE LAM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0644 062D;;;;N;;;;; +FCCB;ARABIC LIGATURE LAM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0644 062E;;;;N;;;;; +FCCC;ARABIC LIGATURE LAM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 0645;;;;N;;;;; +FCCD;ARABIC LIGATURE LAM WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0644 0647;;;;N;;;;; +FCCE;ARABIC LIGATURE MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062C;;;;N;;;;; +FCCF;ARABIC LIGATURE MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0645 062D;;;;N;;;;; +FCD0;ARABIC LIGATURE MEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0645 062E;;;;N;;;;; +FCD1;ARABIC LIGATURE MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 0645;;;;N;;;;; +FCD2;ARABIC LIGATURE NOON WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0646 062C;;;;N;;;;; +FCD3;ARABIC LIGATURE NOON WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0646 062D;;;;N;;;;; +FCD4;ARABIC LIGATURE NOON WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0646 062E;;;;N;;;;; +FCD5;ARABIC LIGATURE NOON WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0646 0645;;;;N;;;;; +FCD6;ARABIC LIGATURE NOON WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0646 0647;;;;N;;;;; +FCD7;ARABIC LIGATURE HEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0647 062C;;;;N;;;;; +FCD8;ARABIC LIGATURE HEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0647 0645;;;;N;;;;; +FCD9;ARABIC LIGATURE HEH WITH SUPERSCRIPT ALEF INITIAL FORM;Lo;0;AL;<initial> 0647 0670;;;;N;;;;; +FCDA;ARABIC LIGATURE YEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 064A 062C;;;;N;;;;; +FCDB;ARABIC LIGATURE YEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 064A 062D;;;;N;;;;; +FCDC;ARABIC LIGATURE YEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 064A 062E;;;;N;;;;; +FCDD;ARABIC LIGATURE YEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 064A 0645;;;;N;;;;; +FCDE;ARABIC LIGATURE YEH WITH HEH INITIAL FORM;Lo;0;AL;<initial> 064A 0647;;;;N;;;;; +FCDF;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0626 0645;;;;N;;;;; +FCE0;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0626 0647;;;;N;;;;; +FCE1;ARABIC LIGATURE BEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0628 0645;;;;N;;;;; +FCE2;ARABIC LIGATURE BEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0628 0647;;;;N;;;;; +FCE3;ARABIC LIGATURE TEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 062A 0645;;;;N;;;;; +FCE4;ARABIC LIGATURE TEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 062A 0647;;;;N;;;;; +FCE5;ARABIC LIGATURE THEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 062B 0645;;;;N;;;;; +FCE6;ARABIC LIGATURE THEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 062B 0647;;;;N;;;;; +FCE7;ARABIC LIGATURE SEEN WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0633 0645;;;;N;;;;; +FCE8;ARABIC LIGATURE SEEN WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0633 0647;;;;N;;;;; +FCE9;ARABIC LIGATURE SHEEN WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0634 0645;;;;N;;;;; +FCEA;ARABIC LIGATURE SHEEN WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0634 0647;;;;N;;;;; +FCEB;ARABIC LIGATURE KAF WITH LAM MEDIAL FORM;Lo;0;AL;<medial> 0643 0644;;;;N;;;;; +FCEC;ARABIC LIGATURE KAF WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0643 0645;;;;N;;;;; +FCED;ARABIC LIGATURE LAM WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0644 0645;;;;N;;;;; +FCEE;ARABIC LIGATURE NOON WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0646 0645;;;;N;;;;; +FCEF;ARABIC LIGATURE NOON WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0646 0647;;;;N;;;;; +FCF0;ARABIC LIGATURE YEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 064A 0645;;;;N;;;;; +FCF1;ARABIC LIGATURE YEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 064A 0647;;;;N;;;;; +FCF2;ARABIC LIGATURE SHADDA WITH FATHA MEDIAL FORM;Lo;0;AL;<medial> 0640 064E 0651;;;;N;;;;; +FCF3;ARABIC LIGATURE SHADDA WITH DAMMA MEDIAL FORM;Lo;0;AL;<medial> 0640 064F 0651;;;;N;;;;; +FCF4;ARABIC LIGATURE SHADDA WITH KASRA MEDIAL FORM;Lo;0;AL;<medial> 0640 0650 0651;;;;N;;;;; +FCF5;ARABIC LIGATURE TAH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0637 0649;;;;N;;;;; +FCF6;ARABIC LIGATURE TAH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0637 064A;;;;N;;;;; +FCF7;ARABIC LIGATURE AIN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0639 0649;;;;N;;;;; +FCF8;ARABIC LIGATURE AIN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0639 064A;;;;N;;;;; +FCF9;ARABIC LIGATURE GHAIN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 063A 0649;;;;N;;;;; +FCFA;ARABIC LIGATURE GHAIN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 063A 064A;;;;N;;;;; +FCFB;ARABIC LIGATURE SEEN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0633 0649;;;;N;;;;; +FCFC;ARABIC LIGATURE SEEN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0633 064A;;;;N;;;;; +FCFD;ARABIC LIGATURE SHEEN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0634 0649;;;;N;;;;; +FCFE;ARABIC LIGATURE SHEEN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0634 064A;;;;N;;;;; +FCFF;ARABIC LIGATURE HAH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062D 0649;;;;N;;;;; +FD00;ARABIC LIGATURE HAH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062D 064A;;;;N;;;;; +FD01;ARABIC LIGATURE JEEM WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062C 0649;;;;N;;;;; +FD02;ARABIC LIGATURE JEEM WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062C 064A;;;;N;;;;; +FD03;ARABIC LIGATURE KHAH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062E 0649;;;;N;;;;; +FD04;ARABIC LIGATURE KHAH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062E 064A;;;;N;;;;; +FD05;ARABIC LIGATURE SAD WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0635 0649;;;;N;;;;; +FD06;ARABIC LIGATURE SAD WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0635 064A;;;;N;;;;; +FD07;ARABIC LIGATURE DAD WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0636 0649;;;;N;;;;; +FD08;ARABIC LIGATURE DAD WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0636 064A;;;;N;;;;; +FD09;ARABIC LIGATURE SHEEN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0634 062C;;;;N;;;;; +FD0A;ARABIC LIGATURE SHEEN WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0634 062D;;;;N;;;;; +FD0B;ARABIC LIGATURE SHEEN WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0634 062E;;;;N;;;;; +FD0C;ARABIC LIGATURE SHEEN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0634 0645;;;;N;;;;; +FD0D;ARABIC LIGATURE SHEEN WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0634 0631;;;;N;;;;; +FD0E;ARABIC LIGATURE SEEN WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0633 0631;;;;N;;;;; +FD0F;ARABIC LIGATURE SAD WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0635 0631;;;;N;;;;; +FD10;ARABIC LIGATURE DAD WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0636 0631;;;;N;;;;; +FD11;ARABIC LIGATURE TAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0637 0649;;;;N;;;;; +FD12;ARABIC LIGATURE TAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0637 064A;;;;N;;;;; +FD13;ARABIC LIGATURE AIN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0639 0649;;;;N;;;;; +FD14;ARABIC LIGATURE AIN WITH YEH FINAL FORM;Lo;0;AL;<final> 0639 064A;;;;N;;;;; +FD15;ARABIC LIGATURE GHAIN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 063A 0649;;;;N;;;;; +FD16;ARABIC LIGATURE GHAIN WITH YEH FINAL FORM;Lo;0;AL;<final> 063A 064A;;;;N;;;;; +FD17;ARABIC LIGATURE SEEN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0633 0649;;;;N;;;;; +FD18;ARABIC LIGATURE SEEN WITH YEH FINAL FORM;Lo;0;AL;<final> 0633 064A;;;;N;;;;; +FD19;ARABIC LIGATURE SHEEN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0634 0649;;;;N;;;;; +FD1A;ARABIC LIGATURE SHEEN WITH YEH FINAL FORM;Lo;0;AL;<final> 0634 064A;;;;N;;;;; +FD1B;ARABIC LIGATURE HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062D 0649;;;;N;;;;; +FD1C;ARABIC LIGATURE HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062D 064A;;;;N;;;;; +FD1D;ARABIC LIGATURE JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062C 0649;;;;N;;;;; +FD1E;ARABIC LIGATURE JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062C 064A;;;;N;;;;; +FD1F;ARABIC LIGATURE KHAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062E 0649;;;;N;;;;; +FD20;ARABIC LIGATURE KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062E 064A;;;;N;;;;; +FD21;ARABIC LIGATURE SAD WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0635 0649;;;;N;;;;; +FD22;ARABIC LIGATURE SAD WITH YEH FINAL FORM;Lo;0;AL;<final> 0635 064A;;;;N;;;;; +FD23;ARABIC LIGATURE DAD WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0636 0649;;;;N;;;;; +FD24;ARABIC LIGATURE DAD WITH YEH FINAL FORM;Lo;0;AL;<final> 0636 064A;;;;N;;;;; +FD25;ARABIC LIGATURE SHEEN WITH JEEM FINAL FORM;Lo;0;AL;<final> 0634 062C;;;;N;;;;; +FD26;ARABIC LIGATURE SHEEN WITH HAH FINAL FORM;Lo;0;AL;<final> 0634 062D;;;;N;;;;; +FD27;ARABIC LIGATURE SHEEN WITH KHAH FINAL FORM;Lo;0;AL;<final> 0634 062E;;;;N;;;;; +FD28;ARABIC LIGATURE SHEEN WITH MEEM FINAL FORM;Lo;0;AL;<final> 0634 0645;;;;N;;;;; +FD29;ARABIC LIGATURE SHEEN WITH REH FINAL FORM;Lo;0;AL;<final> 0634 0631;;;;N;;;;; +FD2A;ARABIC LIGATURE SEEN WITH REH FINAL FORM;Lo;0;AL;<final> 0633 0631;;;;N;;;;; +FD2B;ARABIC LIGATURE SAD WITH REH FINAL FORM;Lo;0;AL;<final> 0635 0631;;;;N;;;;; +FD2C;ARABIC LIGATURE DAD WITH REH FINAL FORM;Lo;0;AL;<final> 0636 0631;;;;N;;;;; +FD2D;ARABIC LIGATURE SHEEN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0634 062C;;;;N;;;;; +FD2E;ARABIC LIGATURE SHEEN WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0634 062D;;;;N;;;;; +FD2F;ARABIC LIGATURE SHEEN WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0634 062E;;;;N;;;;; +FD30;ARABIC LIGATURE SHEEN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0634 0645;;;;N;;;;; +FD31;ARABIC LIGATURE SEEN WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0633 0647;;;;N;;;;; +FD32;ARABIC LIGATURE SHEEN WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0634 0647;;;;N;;;;; +FD33;ARABIC LIGATURE TAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0637 0645;;;;N;;;;; +FD34;ARABIC LIGATURE SEEN WITH JEEM MEDIAL FORM;Lo;0;AL;<medial> 0633 062C;;;;N;;;;; +FD35;ARABIC LIGATURE SEEN WITH HAH MEDIAL FORM;Lo;0;AL;<medial> 0633 062D;;;;N;;;;; +FD36;ARABIC LIGATURE SEEN WITH KHAH MEDIAL FORM;Lo;0;AL;<medial> 0633 062E;;;;N;;;;; +FD37;ARABIC LIGATURE SHEEN WITH JEEM MEDIAL FORM;Lo;0;AL;<medial> 0634 062C;;;;N;;;;; +FD38;ARABIC LIGATURE SHEEN WITH HAH MEDIAL FORM;Lo;0;AL;<medial> 0634 062D;;;;N;;;;; +FD39;ARABIC LIGATURE SHEEN WITH KHAH MEDIAL FORM;Lo;0;AL;<medial> 0634 062E;;;;N;;;;; +FD3A;ARABIC LIGATURE TAH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0637 0645;;;;N;;;;; +FD3B;ARABIC LIGATURE ZAH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0638 0645;;;;N;;;;; +FD3C;ARABIC LIGATURE ALEF WITH FATHATAN FINAL FORM;Lo;0;AL;<final> 0627 064B;;;;N;;;;; +FD3D;ARABIC LIGATURE ALEF WITH FATHATAN ISOLATED FORM;Lo;0;AL;<isolated> 0627 064B;;;;N;;;;; +FD3E;ORNATE LEFT PARENTHESIS;Pe;0;ON;;;;;N;;;;; +FD3F;ORNATE RIGHT PARENTHESIS;Ps;0;ON;;;;;N;;;;; +FD50;ARABIC LIGATURE TEH WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062C 0645;;;;N;;;;; +FD51;ARABIC LIGATURE TEH WITH HAH WITH JEEM FINAL FORM;Lo;0;AL;<final> 062A 062D 062C;;;;N;;;;; +FD52;ARABIC LIGATURE TEH WITH HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062D 062C;;;;N;;;;; +FD53;ARABIC LIGATURE TEH WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062D 0645;;;;N;;;;; +FD54;ARABIC LIGATURE TEH WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062E 0645;;;;N;;;;; +FD55;ARABIC LIGATURE TEH WITH MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062A 0645 062C;;;;N;;;;; +FD56;ARABIC LIGATURE TEH WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062A 0645 062D;;;;N;;;;; +FD57;ARABIC LIGATURE TEH WITH MEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 062A 0645 062E;;;;N;;;;; +FD58;ARABIC LIGATURE JEEM WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 062C 0645 062D;;;;N;;;;; +FD59;ARABIC LIGATURE JEEM WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062C 0645 062D;;;;N;;;;; +FD5A;ARABIC LIGATURE HAH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062D 0645 064A;;;;N;;;;; +FD5B;ARABIC LIGATURE HAH WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062D 0645 0649;;;;N;;;;; +FD5C;ARABIC LIGATURE SEEN WITH HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0633 062D 062C;;;;N;;;;; +FD5D;ARABIC LIGATURE SEEN WITH JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0633 062C 062D;;;;N;;;;; +FD5E;ARABIC LIGATURE SEEN WITH JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0633 062C 0649;;;;N;;;;; +FD5F;ARABIC LIGATURE SEEN WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0633 0645 062D;;;;N;;;;; +FD60;ARABIC LIGATURE SEEN WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0633 0645 062D;;;;N;;;;; +FD61;ARABIC LIGATURE SEEN WITH MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0633 0645 062C;;;;N;;;;; +FD62;ARABIC LIGATURE SEEN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0633 0645 0645;;;;N;;;;; +FD63;ARABIC LIGATURE SEEN WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0633 0645 0645;;;;N;;;;; +FD64;ARABIC LIGATURE SAD WITH HAH WITH HAH FINAL FORM;Lo;0;AL;<final> 0635 062D 062D;;;;N;;;;; +FD65;ARABIC LIGATURE SAD WITH HAH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0635 062D 062D;;;;N;;;;; +FD66;ARABIC LIGATURE SAD WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0635 0645 0645;;;;N;;;;; +FD67;ARABIC LIGATURE SHEEN WITH HAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0634 062D 0645;;;;N;;;;; +FD68;ARABIC LIGATURE SHEEN WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0634 062D 0645;;;;N;;;;; +FD69;ARABIC LIGATURE SHEEN WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0634 062C 064A;;;;N;;;;; +FD6A;ARABIC LIGATURE SHEEN WITH MEEM WITH KHAH FINAL FORM;Lo;0;AL;<final> 0634 0645 062E;;;;N;;;;; +FD6B;ARABIC LIGATURE SHEEN WITH MEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0634 0645 062E;;;;N;;;;; +FD6C;ARABIC LIGATURE SHEEN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0634 0645 0645;;;;N;;;;; +FD6D;ARABIC LIGATURE SHEEN WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0634 0645 0645;;;;N;;;;; +FD6E;ARABIC LIGATURE DAD WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0636 062D 0649;;;;N;;;;; +FD6F;ARABIC LIGATURE DAD WITH KHAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0636 062E 0645;;;;N;;;;; +FD70;ARABIC LIGATURE DAD WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0636 062E 0645;;;;N;;;;; +FD71;ARABIC LIGATURE TAH WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0637 0645 062D;;;;N;;;;; +FD72;ARABIC LIGATURE TAH WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0637 0645 062D;;;;N;;;;; +FD73;ARABIC LIGATURE TAH WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0637 0645 0645;;;;N;;;;; +FD74;ARABIC LIGATURE TAH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0637 0645 064A;;;;N;;;;; +FD75;ARABIC LIGATURE AIN WITH JEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0639 062C 0645;;;;N;;;;; +FD76;ARABIC LIGATURE AIN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0639 0645 0645;;;;N;;;;; +FD77;ARABIC LIGATURE AIN WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0639 0645 0645;;;;N;;;;; +FD78;ARABIC LIGATURE AIN WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0639 0645 0649;;;;N;;;;; +FD79;ARABIC LIGATURE GHAIN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 063A 0645 0645;;;;N;;;;; +FD7A;ARABIC LIGATURE GHAIN WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 063A 0645 064A;;;;N;;;;; +FD7B;ARABIC LIGATURE GHAIN WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 063A 0645 0649;;;;N;;;;; +FD7C;ARABIC LIGATURE FEH WITH KHAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0641 062E 0645;;;;N;;;;; +FD7D;ARABIC LIGATURE FEH WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0641 062E 0645;;;;N;;;;; +FD7E;ARABIC LIGATURE QAF WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0642 0645 062D;;;;N;;;;; +FD7F;ARABIC LIGATURE QAF WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0642 0645 0645;;;;N;;;;; +FD80;ARABIC LIGATURE LAM WITH HAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 062D 0645;;;;N;;;;; +FD81;ARABIC LIGATURE LAM WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 062D 064A;;;;N;;;;; +FD82;ARABIC LIGATURE LAM WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0644 062D 0649;;;;N;;;;; +FD83;ARABIC LIGATURE LAM WITH JEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062C 062C;;;;N;;;;; +FD84;ARABIC LIGATURE LAM WITH JEEM WITH JEEM FINAL FORM;Lo;0;AL;<final> 0644 062C 062C;;;;N;;;;; +FD85;ARABIC LIGATURE LAM WITH KHAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 062E 0645;;;;N;;;;; +FD86;ARABIC LIGATURE LAM WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062E 0645;;;;N;;;;; +FD87;ARABIC LIGATURE LAM WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0644 0645 062D;;;;N;;;;; +FD88;ARABIC LIGATURE LAM WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0644 0645 062D;;;;N;;;;; +FD89;ARABIC LIGATURE MEEM WITH HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062D 062C;;;;N;;;;; +FD8A;ARABIC LIGATURE MEEM WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062D 0645;;;;N;;;;; +FD8B;ARABIC LIGATURE MEEM WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 062D 064A;;;;N;;;;; +FD8C;ARABIC LIGATURE MEEM WITH JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0645 062C 062D;;;;N;;;;; +FD8D;ARABIC LIGATURE MEEM WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062C 0645;;;;N;;;;; +FD8E;ARABIC LIGATURE MEEM WITH KHAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062E 062C;;;;N;;;;; +FD8F;ARABIC LIGATURE MEEM WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062E 0645;;;;N;;;;; +FD92;ARABIC LIGATURE MEEM WITH JEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0645 062C 062E;;;;N;;;;; +FD93;ARABIC LIGATURE HEH WITH MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0647 0645 062C;;;;N;;;;; +FD94;ARABIC LIGATURE HEH WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0647 0645 0645;;;;N;;;;; +FD95;ARABIC LIGATURE NOON WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0646 062D 0645;;;;N;;;;; +FD96;ARABIC LIGATURE NOON WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 062D 0649;;;;N;;;;; +FD97;ARABIC LIGATURE NOON WITH JEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0646 062C 0645;;;;N;;;;; +FD98;ARABIC LIGATURE NOON WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0646 062C 0645;;;;N;;;;; +FD99;ARABIC LIGATURE NOON WITH JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 062C 0649;;;;N;;;;; +FD9A;ARABIC LIGATURE NOON WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 0645 064A;;;;N;;;;; +FD9B;ARABIC LIGATURE NOON WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 0645 0649;;;;N;;;;; +FD9C;ARABIC LIGATURE YEH WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 064A 0645 0645;;;;N;;;;; +FD9D;ARABIC LIGATURE YEH WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 064A 0645 0645;;;;N;;;;; +FD9E;ARABIC LIGATURE BEH WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0628 062E 064A;;;;N;;;;; +FD9F;ARABIC LIGATURE TEH WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 062C 064A;;;;N;;;;; +FDA0;ARABIC LIGATURE TEH WITH JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 062C 0649;;;;N;;;;; +FDA1;ARABIC LIGATURE TEH WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 062E 064A;;;;N;;;;; +FDA2;ARABIC LIGATURE TEH WITH KHAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 062E 0649;;;;N;;;;; +FDA3;ARABIC LIGATURE TEH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 0645 064A;;;;N;;;;; +FDA4;ARABIC LIGATURE TEH WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 0645 0649;;;;N;;;;; +FDA5;ARABIC LIGATURE JEEM WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062C 0645 064A;;;;N;;;;; +FDA6;ARABIC LIGATURE JEEM WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062C 062D 0649;;;;N;;;;; +FDA7;ARABIC LIGATURE JEEM WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062C 0645 0649;;;;N;;;;; +FDA8;ARABIC LIGATURE SEEN WITH KHAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0633 062E 0649;;;;N;;;;; +FDA9;ARABIC LIGATURE SAD WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0635 062D 064A;;;;N;;;;; +FDAA;ARABIC LIGATURE SHEEN WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0634 062D 064A;;;;N;;;;; +FDAB;ARABIC LIGATURE DAD WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0636 062D 064A;;;;N;;;;; +FDAC;ARABIC LIGATURE LAM WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 062C 064A;;;;N;;;;; +FDAD;ARABIC LIGATURE LAM WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 0645 064A;;;;N;;;;; +FDAE;ARABIC LIGATURE YEH WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 062D 064A;;;;N;;;;; +FDAF;ARABIC LIGATURE YEH WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 062C 064A;;;;N;;;;; +FDB0;ARABIC LIGATURE YEH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 0645 064A;;;;N;;;;; +FDB1;ARABIC LIGATURE MEEM WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 0645 064A;;;;N;;;;; +FDB2;ARABIC LIGATURE QAF WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0642 0645 064A;;;;N;;;;; +FDB3;ARABIC LIGATURE NOON WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 062D 064A;;;;N;;;;; +FDB4;ARABIC LIGATURE QAF WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0642 0645 062D;;;;N;;;;; +FDB5;ARABIC LIGATURE LAM WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062D 0645;;;;N;;;;; +FDB6;ARABIC LIGATURE AIN WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0639 0645 064A;;;;N;;;;; +FDB7;ARABIC LIGATURE KAF WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0643 0645 064A;;;;N;;;;; +FDB8;ARABIC LIGATURE NOON WITH JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0646 062C 062D;;;;N;;;;; +FDB9;ARABIC LIGATURE MEEM WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 062E 064A;;;;N;;;;; +FDBA;ARABIC LIGATURE LAM WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062C 0645;;;;N;;;;; +FDBB;ARABIC LIGATURE KAF WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0643 0645 0645;;;;N;;;;; +FDBC;ARABIC LIGATURE LAM WITH JEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 062C 0645;;;;N;;;;; +FDBD;ARABIC LIGATURE NOON WITH JEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0646 062C 062D;;;;N;;;;; +FDBE;ARABIC LIGATURE JEEM WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062C 062D 064A;;;;N;;;;; +FDBF;ARABIC LIGATURE HAH WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062D 062C 064A;;;;N;;;;; +FDC0;ARABIC LIGATURE MEEM WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 062C 064A;;;;N;;;;; +FDC1;ARABIC LIGATURE FEH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0641 0645 064A;;;;N;;;;; +FDC2;ARABIC LIGATURE BEH WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0628 062D 064A;;;;N;;;;; +FDC3;ARABIC LIGATURE KAF WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0643 0645 0645;;;;N;;;;; +FDC4;ARABIC LIGATURE AIN WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0639 062C 0645;;;;N;;;;; +FDC5;ARABIC LIGATURE SAD WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0635 0645 0645;;;;N;;;;; +FDC6;ARABIC LIGATURE SEEN WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0633 062E 064A;;;;N;;;;; +FDC7;ARABIC LIGATURE NOON WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 062C 064A;;;;N;;;;; +FDF0;ARABIC LIGATURE SALLA USED AS KORANIC STOP SIGN ISOLATED FORM;Lo;0;AL;<isolated> 0635 0644 06D2;;;;N;;;;; +FDF1;ARABIC LIGATURE QALA USED AS KORANIC STOP SIGN ISOLATED FORM;Lo;0;AL;<isolated> 0642 0644 06D2;;;;N;;;;; +FDF2;ARABIC LIGATURE ALLAH ISOLATED FORM;Lo;0;AL;<isolated> 0627 0644 0644 0647;;;;N;;;;; +FDF3;ARABIC LIGATURE AKBAR ISOLATED FORM;Lo;0;AL;<isolated> 0627 0643 0628 0631;;;;N;;;;; +FDF4;ARABIC LIGATURE MOHAMMAD ISOLATED FORM;Lo;0;AL;<isolated> 0645 062D 0645 062F;;;;N;;;;; +FDF5;ARABIC LIGATURE SALAM ISOLATED FORM;Lo;0;AL;<isolated> 0635 0644 0639 0645;;;;N;;;;; +FDF6;ARABIC LIGATURE RASOUL ISOLATED FORM;Lo;0;AL;<isolated> 0631 0633 0648 0644;;;;N;;;;; +FDF7;ARABIC LIGATURE ALAYHE ISOLATED FORM;Lo;0;AL;<isolated> 0639 0644 064A 0647;;;;N;;;;; +FDF8;ARABIC LIGATURE WASALLAM ISOLATED FORM;Lo;0;AL;<isolated> 0648 0633 0644 0645;;;;N;;;;; +FDF9;ARABIC LIGATURE SALLA ISOLATED FORM;Lo;0;AL;<isolated> 0635 0644 0649;;;;N;;;;; +FDFA;ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM;Lo;0;AL;<isolated> 0635 0644 0649 0020 0627 0644 0644 0647 0020 0639 0644 064A 0647 0020 0648 0633 0644 0645;;;;N;ARABIC LETTER SALLALLAHOU ALAYHE WASALLAM;;;; +FDFB;ARABIC LIGATURE JALLAJALALOUHOU;Lo;0;AL;<isolated> 062C 0644 0020 062C 0644 0627 0644 0647;;;;N;ARABIC LETTER JALLAJALALOUHOU;;;; +FDFC;RIAL SIGN;Sc;0;AL;<isolated> 0631 06CC 0627 0644;;;;N;;;;; +FDFD;ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM;So;0;ON;;;;;N;;;;; +FE00;VARIATION SELECTOR-1;Mn;0;NSM;;;;;N;;;;; +FE01;VARIATION SELECTOR-2;Mn;0;NSM;;;;;N;;;;; +FE02;VARIATION SELECTOR-3;Mn;0;NSM;;;;;N;;;;; +FE03;VARIATION SELECTOR-4;Mn;0;NSM;;;;;N;;;;; +FE04;VARIATION SELECTOR-5;Mn;0;NSM;;;;;N;;;;; +FE05;VARIATION SELECTOR-6;Mn;0;NSM;;;;;N;;;;; +FE06;VARIATION SELECTOR-7;Mn;0;NSM;;;;;N;;;;; +FE07;VARIATION SELECTOR-8;Mn;0;NSM;;;;;N;;;;; +FE08;VARIATION SELECTOR-9;Mn;0;NSM;;;;;N;;;;; +FE09;VARIATION SELECTOR-10;Mn;0;NSM;;;;;N;;;;; +FE0A;VARIATION SELECTOR-11;Mn;0;NSM;;;;;N;;;;; +FE0B;VARIATION SELECTOR-12;Mn;0;NSM;;;;;N;;;;; +FE0C;VARIATION SELECTOR-13;Mn;0;NSM;;;;;N;;;;; +FE0D;VARIATION SELECTOR-14;Mn;0;NSM;;;;;N;;;;; +FE0E;VARIATION SELECTOR-15;Mn;0;NSM;;;;;N;;;;; +FE0F;VARIATION SELECTOR-16;Mn;0;NSM;;;;;N;;;;; +FE10;PRESENTATION FORM FOR VERTICAL COMMA;Po;0;ON;<vertical> 002C;;;;N;;;;; +FE11;PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA;Po;0;ON;<vertical> 3001;;;;N;;;;; +FE12;PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP;Po;0;ON;<vertical> 3002;;;;N;;;;; +FE13;PRESENTATION FORM FOR VERTICAL COLON;Po;0;ON;<vertical> 003A;;;;N;;;;; +FE14;PRESENTATION FORM FOR VERTICAL SEMICOLON;Po;0;ON;<vertical> 003B;;;;N;;;;; +FE15;PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK;Po;0;ON;<vertical> 0021;;;;N;;;;; +FE16;PRESENTATION FORM FOR VERTICAL QUESTION MARK;Po;0;ON;<vertical> 003F;;;;N;;;;; +FE17;PRESENTATION FORM FOR VERTICAL LEFT WHITE LENTICULAR BRACKET;Ps;0;ON;<vertical> 3016;;;;N;;;;; +FE18;PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRAKCET;Pe;0;ON;<vertical> 3017;;;;N;;;;; +FE19;PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS;Po;0;ON;<vertical> 2026;;;;N;;;;; +FE20;COMBINING LIGATURE LEFT HALF;Mn;230;NSM;;;;;N;;;;; +FE21;COMBINING LIGATURE RIGHT HALF;Mn;230;NSM;;;;;N;;;;; +FE22;COMBINING DOUBLE TILDE LEFT HALF;Mn;230;NSM;;;;;N;;;;; +FE23;COMBINING DOUBLE TILDE RIGHT HALF;Mn;230;NSM;;;;;N;;;;; +FE24;COMBINING MACRON LEFT HALF;Mn;230;NSM;;;;;N;;;;; +FE25;COMBINING MACRON RIGHT HALF;Mn;230;NSM;;;;;N;;;;; +FE26;COMBINING CONJOINING MACRON;Mn;230;NSM;;;;;N;;;;; +FE27;COMBINING LIGATURE LEFT HALF BELOW;Mn;220;NSM;;;;;N;;;;; +FE28;COMBINING LIGATURE RIGHT HALF BELOW;Mn;220;NSM;;;;;N;;;;; +FE29;COMBINING TILDE LEFT HALF BELOW;Mn;220;NSM;;;;;N;;;;; +FE2A;COMBINING TILDE RIGHT HALF BELOW;Mn;220;NSM;;;;;N;;;;; +FE2B;COMBINING MACRON LEFT HALF BELOW;Mn;220;NSM;;;;;N;;;;; +FE2C;COMBINING MACRON RIGHT HALF BELOW;Mn;220;NSM;;;;;N;;;;; +FE2D;COMBINING CONJOINING MACRON BELOW;Mn;220;NSM;;;;;N;;;;; +FE2E;COMBINING CYRILLIC TITLO LEFT HALF;Mn;230;NSM;;;;;N;;;;; +FE2F;COMBINING CYRILLIC TITLO RIGHT HALF;Mn;230;NSM;;;;;N;;;;; +FE30;PRESENTATION FORM FOR VERTICAL TWO DOT LEADER;Po;0;ON;<vertical> 2025;;;;N;GLYPH FOR VERTICAL TWO DOT LEADER;;;; +FE31;PRESENTATION FORM FOR VERTICAL EM DASH;Pd;0;ON;<vertical> 2014;;;;N;GLYPH FOR VERTICAL EM DASH;;;; +FE32;PRESENTATION FORM FOR VERTICAL EN DASH;Pd;0;ON;<vertical> 2013;;;;N;GLYPH FOR VERTICAL EN DASH;;;; +FE33;PRESENTATION FORM FOR VERTICAL LOW LINE;Pc;0;ON;<vertical> 005F;;;;N;GLYPH FOR VERTICAL SPACING UNDERSCORE;;;; +FE34;PRESENTATION FORM FOR VERTICAL WAVY LOW LINE;Pc;0;ON;<vertical> 005F;;;;N;GLYPH FOR VERTICAL SPACING WAVY UNDERSCORE;;;; +FE35;PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS;Ps;0;ON;<vertical> 0028;;;;N;GLYPH FOR VERTICAL OPENING PARENTHESIS;;;; +FE36;PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS;Pe;0;ON;<vertical> 0029;;;;N;GLYPH FOR VERTICAL CLOSING PARENTHESIS;;;; +FE37;PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET;Ps;0;ON;<vertical> 007B;;;;N;GLYPH FOR VERTICAL OPENING CURLY BRACKET;;;; +FE38;PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET;Pe;0;ON;<vertical> 007D;;;;N;GLYPH FOR VERTICAL CLOSING CURLY BRACKET;;;; +FE39;PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET;Ps;0;ON;<vertical> 3014;;;;N;GLYPH FOR VERTICAL OPENING TORTOISE SHELL BRACKET;;;; +FE3A;PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET;Pe;0;ON;<vertical> 3015;;;;N;GLYPH FOR VERTICAL CLOSING TORTOISE SHELL BRACKET;;;; +FE3B;PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET;Ps;0;ON;<vertical> 3010;;;;N;GLYPH FOR VERTICAL OPENING BLACK LENTICULAR BRACKET;;;; +FE3C;PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET;Pe;0;ON;<vertical> 3011;;;;N;GLYPH FOR VERTICAL CLOSING BLACK LENTICULAR BRACKET;;;; +FE3D;PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;<vertical> 300A;;;;N;GLYPH FOR VERTICAL OPENING DOUBLE ANGLE BRACKET;;;; +FE3E;PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;<vertical> 300B;;;;N;GLYPH FOR VERTICAL CLOSING DOUBLE ANGLE BRACKET;;;; +FE3F;PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET;Ps;0;ON;<vertical> 3008;;;;N;GLYPH FOR VERTICAL OPENING ANGLE BRACKET;;;; +FE40;PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET;Pe;0;ON;<vertical> 3009;;;;N;GLYPH FOR VERTICAL CLOSING ANGLE BRACKET;;;; +FE41;PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET;Ps;0;ON;<vertical> 300C;;;;N;GLYPH FOR VERTICAL OPENING CORNER BRACKET;;;; +FE42;PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET;Pe;0;ON;<vertical> 300D;;;;N;GLYPH FOR VERTICAL CLOSING CORNER BRACKET;;;; +FE43;PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET;Ps;0;ON;<vertical> 300E;;;;N;GLYPH FOR VERTICAL OPENING WHITE CORNER BRACKET;;;; +FE44;PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET;Pe;0;ON;<vertical> 300F;;;;N;GLYPH FOR VERTICAL CLOSING WHITE CORNER BRACKET;;;; +FE45;SESAME DOT;Po;0;ON;;;;;N;;;;; +FE46;WHITE SESAME DOT;Po;0;ON;;;;;N;;;;; +FE47;PRESENTATION FORM FOR VERTICAL LEFT SQUARE BRACKET;Ps;0;ON;<vertical> 005B;;;;N;;;;; +FE48;PRESENTATION FORM FOR VERTICAL RIGHT SQUARE BRACKET;Pe;0;ON;<vertical> 005D;;;;N;;;;; +FE49;DASHED OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING DASHED OVERSCORE;;;; +FE4A;CENTRELINE OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING CENTERLINE OVERSCORE;;;; +FE4B;WAVY OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING WAVY OVERSCORE;;;; +FE4C;DOUBLE WAVY OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING DOUBLE WAVY OVERSCORE;;;; +FE4D;DASHED LOW LINE;Pc;0;ON;<compat> 005F;;;;N;SPACING DASHED UNDERSCORE;;;; +FE4E;CENTRELINE LOW LINE;Pc;0;ON;<compat> 005F;;;;N;SPACING CENTERLINE UNDERSCORE;;;; +FE4F;WAVY LOW LINE;Pc;0;ON;<compat> 005F;;;;N;SPACING WAVY UNDERSCORE;;;; +FE50;SMALL COMMA;Po;0;CS;<small> 002C;;;;N;;;;; +FE51;SMALL IDEOGRAPHIC COMMA;Po;0;ON;<small> 3001;;;;N;;;;; +FE52;SMALL FULL STOP;Po;0;CS;<small> 002E;;;;N;SMALL PERIOD;;;; +FE54;SMALL SEMICOLON;Po;0;ON;<small> 003B;;;;N;;;;; +FE55;SMALL COLON;Po;0;CS;<small> 003A;;;;N;;;;; +FE56;SMALL QUESTION MARK;Po;0;ON;<small> 003F;;;;N;;;;; +FE57;SMALL EXCLAMATION MARK;Po;0;ON;<small> 0021;;;;N;;;;; +FE58;SMALL EM DASH;Pd;0;ON;<small> 2014;;;;N;;;;; +FE59;SMALL LEFT PARENTHESIS;Ps;0;ON;<small> 0028;;;;Y;SMALL OPENING PARENTHESIS;;;; +FE5A;SMALL RIGHT PARENTHESIS;Pe;0;ON;<small> 0029;;;;Y;SMALL CLOSING PARENTHESIS;;;; +FE5B;SMALL LEFT CURLY BRACKET;Ps;0;ON;<small> 007B;;;;Y;SMALL OPENING CURLY BRACKET;;;; +FE5C;SMALL RIGHT CURLY BRACKET;Pe;0;ON;<small> 007D;;;;Y;SMALL CLOSING CURLY BRACKET;;;; +FE5D;SMALL LEFT TORTOISE SHELL BRACKET;Ps;0;ON;<small> 3014;;;;Y;SMALL OPENING TORTOISE SHELL BRACKET;;;; +FE5E;SMALL RIGHT TORTOISE SHELL BRACKET;Pe;0;ON;<small> 3015;;;;Y;SMALL CLOSING TORTOISE SHELL BRACKET;;;; +FE5F;SMALL NUMBER SIGN;Po;0;ET;<small> 0023;;;;N;;;;; +FE60;SMALL AMPERSAND;Po;0;ON;<small> 0026;;;;N;;;;; +FE61;SMALL ASTERISK;Po;0;ON;<small> 002A;;;;N;;;;; +FE62;SMALL PLUS SIGN;Sm;0;ES;<small> 002B;;;;N;;;;; +FE63;SMALL HYPHEN-MINUS;Pd;0;ES;<small> 002D;;;;N;;;;; +FE64;SMALL LESS-THAN SIGN;Sm;0;ON;<small> 003C;;;;Y;;;;; +FE65;SMALL GREATER-THAN SIGN;Sm;0;ON;<small> 003E;;;;Y;;;;; +FE66;SMALL EQUALS SIGN;Sm;0;ON;<small> 003D;;;;N;;;;; +FE68;SMALL REVERSE SOLIDUS;Po;0;ON;<small> 005C;;;;N;SMALL BACKSLASH;;;; +FE69;SMALL DOLLAR SIGN;Sc;0;ET;<small> 0024;;;;N;;;;; +FE6A;SMALL PERCENT SIGN;Po;0;ET;<small> 0025;;;;N;;;;; +FE6B;SMALL COMMERCIAL AT;Po;0;ON;<small> 0040;;;;N;;;;; +FE70;ARABIC FATHATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064B;;;;N;ARABIC SPACING FATHATAN;;;; +FE71;ARABIC TATWEEL WITH FATHATAN ABOVE;Lo;0;AL;<medial> 0640 064B;;;;N;ARABIC FATHATAN ON TATWEEL;;;; +FE72;ARABIC DAMMATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064C;;;;N;ARABIC SPACING DAMMATAN;;;; +FE73;ARABIC TAIL FRAGMENT;Lo;0;AL;;;;;N;;;;; +FE74;ARABIC KASRATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064D;;;;N;ARABIC SPACING KASRATAN;;;; +FE76;ARABIC FATHA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064E;;;;N;ARABIC SPACING FATHAH;;;; +FE77;ARABIC FATHA MEDIAL FORM;Lo;0;AL;<medial> 0640 064E;;;;N;ARABIC FATHAH ON TATWEEL;;;; +FE78;ARABIC DAMMA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064F;;;;N;ARABIC SPACING DAMMAH;;;; +FE79;ARABIC DAMMA MEDIAL FORM;Lo;0;AL;<medial> 0640 064F;;;;N;ARABIC DAMMAH ON TATWEEL;;;; +FE7A;ARABIC KASRA ISOLATED FORM;Lo;0;AL;<isolated> 0020 0650;;;;N;ARABIC SPACING KASRAH;;;; +FE7B;ARABIC KASRA MEDIAL FORM;Lo;0;AL;<medial> 0640 0650;;;;N;ARABIC KASRAH ON TATWEEL;;;; +FE7C;ARABIC SHADDA ISOLATED FORM;Lo;0;AL;<isolated> 0020 0651;;;;N;ARABIC SPACING SHADDAH;;;; +FE7D;ARABIC SHADDA MEDIAL FORM;Lo;0;AL;<medial> 0640 0651;;;;N;ARABIC SHADDAH ON TATWEEL;;;; +FE7E;ARABIC SUKUN ISOLATED FORM;Lo;0;AL;<isolated> 0020 0652;;;;N;ARABIC SPACING SUKUN;;;; +FE7F;ARABIC SUKUN MEDIAL FORM;Lo;0;AL;<medial> 0640 0652;;;;N;ARABIC SUKUN ON TATWEEL;;;; +FE80;ARABIC LETTER HAMZA ISOLATED FORM;Lo;0;AL;<isolated> 0621;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH;;;; +FE81;ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0622;;;;N;GLYPH FOR ISOLATE ARABIC MADDAH ON ALEF;;;; +FE82;ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM;Lo;0;AL;<final> 0622;;;;N;GLYPH FOR FINAL ARABIC MADDAH ON ALEF;;;; +FE83;ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0623;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON ALEF;;;; +FE84;ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0623;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON ALEF;;;; +FE85;ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0624;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON WAW;;;; +FE86;ARABIC LETTER WAW WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0624;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON WAW;;;; +FE87;ARABIC LETTER ALEF WITH HAMZA BELOW ISOLATED FORM;Lo;0;AL;<isolated> 0625;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH UNDER ALEF;;;; +FE88;ARABIC LETTER ALEF WITH HAMZA BELOW FINAL FORM;Lo;0;AL;<final> 0625;;;;N;GLYPH FOR FINAL ARABIC HAMZAH UNDER ALEF;;;; +FE89;ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0626;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON YA;;;; +FE8A;ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0626;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON YA;;;; +FE8B;ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM;Lo;0;AL;<initial> 0626;;;;N;GLYPH FOR INITIAL ARABIC HAMZAH ON YA;;;; +FE8C;ARABIC LETTER YEH WITH HAMZA ABOVE MEDIAL FORM;Lo;0;AL;<medial> 0626;;;;N;GLYPH FOR MEDIAL ARABIC HAMZAH ON YA;;;; +FE8D;ARABIC LETTER ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0627;;;;N;GLYPH FOR ISOLATE ARABIC ALEF;;;; +FE8E;ARABIC LETTER ALEF FINAL FORM;Lo;0;AL;<final> 0627;;;;N;GLYPH FOR FINAL ARABIC ALEF;;;; +FE8F;ARABIC LETTER BEH ISOLATED FORM;Lo;0;AL;<isolated> 0628;;;;N;GLYPH FOR ISOLATE ARABIC BAA;;;; +FE90;ARABIC LETTER BEH FINAL FORM;Lo;0;AL;<final> 0628;;;;N;GLYPH FOR FINAL ARABIC BAA;;;; +FE91;ARABIC LETTER BEH INITIAL FORM;Lo;0;AL;<initial> 0628;;;;N;GLYPH FOR INITIAL ARABIC BAA;;;; +FE92;ARABIC LETTER BEH MEDIAL FORM;Lo;0;AL;<medial> 0628;;;;N;GLYPH FOR MEDIAL ARABIC BAA;;;; +FE93;ARABIC LETTER TEH MARBUTA ISOLATED FORM;Lo;0;AL;<isolated> 0629;;;;N;GLYPH FOR ISOLATE ARABIC TAA MARBUTAH;;;; +FE94;ARABIC LETTER TEH MARBUTA FINAL FORM;Lo;0;AL;<final> 0629;;;;N;GLYPH FOR FINAL ARABIC TAA MARBUTAH;;;; +FE95;ARABIC LETTER TEH ISOLATED FORM;Lo;0;AL;<isolated> 062A;;;;N;GLYPH FOR ISOLATE ARABIC TAA;;;; +FE96;ARABIC LETTER TEH FINAL FORM;Lo;0;AL;<final> 062A;;;;N;GLYPH FOR FINAL ARABIC TAA;;;; +FE97;ARABIC LETTER TEH INITIAL FORM;Lo;0;AL;<initial> 062A;;;;N;GLYPH FOR INITIAL ARABIC TAA;;;; +FE98;ARABIC LETTER TEH MEDIAL FORM;Lo;0;AL;<medial> 062A;;;;N;GLYPH FOR MEDIAL ARABIC TAA;;;; +FE99;ARABIC LETTER THEH ISOLATED FORM;Lo;0;AL;<isolated> 062B;;;;N;GLYPH FOR ISOLATE ARABIC THAA;;;; +FE9A;ARABIC LETTER THEH FINAL FORM;Lo;0;AL;<final> 062B;;;;N;GLYPH FOR FINAL ARABIC THAA;;;; +FE9B;ARABIC LETTER THEH INITIAL FORM;Lo;0;AL;<initial> 062B;;;;N;GLYPH FOR INITIAL ARABIC THAA;;;; +FE9C;ARABIC LETTER THEH MEDIAL FORM;Lo;0;AL;<medial> 062B;;;;N;GLYPH FOR MEDIAL ARABIC THAA;;;; +FE9D;ARABIC LETTER JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062C;;;;N;GLYPH FOR ISOLATE ARABIC JEEM;;;; +FE9E;ARABIC LETTER JEEM FINAL FORM;Lo;0;AL;<final> 062C;;;;N;GLYPH FOR FINAL ARABIC JEEM;;;; +FE9F;ARABIC LETTER JEEM INITIAL FORM;Lo;0;AL;<initial> 062C;;;;N;GLYPH FOR INITIAL ARABIC JEEM;;;; +FEA0;ARABIC LETTER JEEM MEDIAL FORM;Lo;0;AL;<medial> 062C;;;;N;GLYPH FOR MEDIAL ARABIC JEEM;;;; +FEA1;ARABIC LETTER HAH ISOLATED FORM;Lo;0;AL;<isolated> 062D;;;;N;GLYPH FOR ISOLATE ARABIC HAA;;;; +FEA2;ARABIC LETTER HAH FINAL FORM;Lo;0;AL;<final> 062D;;;;N;GLYPH FOR FINAL ARABIC HAA;;;; +FEA3;ARABIC LETTER HAH INITIAL FORM;Lo;0;AL;<initial> 062D;;;;N;GLYPH FOR INITIAL ARABIC HAA;;;; +FEA4;ARABIC LETTER HAH MEDIAL FORM;Lo;0;AL;<medial> 062D;;;;N;GLYPH FOR MEDIAL ARABIC HAA;;;; +FEA5;ARABIC LETTER KHAH ISOLATED FORM;Lo;0;AL;<isolated> 062E;;;;N;GLYPH FOR ISOLATE ARABIC KHAA;;;; +FEA6;ARABIC LETTER KHAH FINAL FORM;Lo;0;AL;<final> 062E;;;;N;GLYPH FOR FINAL ARABIC KHAA;;;; +FEA7;ARABIC LETTER KHAH INITIAL FORM;Lo;0;AL;<initial> 062E;;;;N;GLYPH FOR INITIAL ARABIC KHAA;;;; +FEA8;ARABIC LETTER KHAH MEDIAL FORM;Lo;0;AL;<medial> 062E;;;;N;GLYPH FOR MEDIAL ARABIC KHAA;;;; +FEA9;ARABIC LETTER DAL ISOLATED FORM;Lo;0;AL;<isolated> 062F;;;;N;GLYPH FOR ISOLATE ARABIC DAL;;;; +FEAA;ARABIC LETTER DAL FINAL FORM;Lo;0;AL;<final> 062F;;;;N;GLYPH FOR FINAL ARABIC DAL;;;; +FEAB;ARABIC LETTER THAL ISOLATED FORM;Lo;0;AL;<isolated> 0630;;;;N;GLYPH FOR ISOLATE ARABIC THAL;;;; +FEAC;ARABIC LETTER THAL FINAL FORM;Lo;0;AL;<final> 0630;;;;N;GLYPH FOR FINAL ARABIC THAL;;;; +FEAD;ARABIC LETTER REH ISOLATED FORM;Lo;0;AL;<isolated> 0631;;;;N;GLYPH FOR ISOLATE ARABIC RA;;;; +FEAE;ARABIC LETTER REH FINAL FORM;Lo;0;AL;<final> 0631;;;;N;GLYPH FOR FINAL ARABIC RA;;;; +FEAF;ARABIC LETTER ZAIN ISOLATED FORM;Lo;0;AL;<isolated> 0632;;;;N;GLYPH FOR ISOLATE ARABIC ZAIN;;;; +FEB0;ARABIC LETTER ZAIN FINAL FORM;Lo;0;AL;<final> 0632;;;;N;GLYPH FOR FINAL ARABIC ZAIN;;;; +FEB1;ARABIC LETTER SEEN ISOLATED FORM;Lo;0;AL;<isolated> 0633;;;;N;GLYPH FOR ISOLATE ARABIC SEEN;;;; +FEB2;ARABIC LETTER SEEN FINAL FORM;Lo;0;AL;<final> 0633;;;;N;GLYPH FOR FINAL ARABIC SEEN;;;; +FEB3;ARABIC LETTER SEEN INITIAL FORM;Lo;0;AL;<initial> 0633;;;;N;GLYPH FOR INITIAL ARABIC SEEN;;;; +FEB4;ARABIC LETTER SEEN MEDIAL FORM;Lo;0;AL;<medial> 0633;;;;N;GLYPH FOR MEDIAL ARABIC SEEN;;;; +FEB5;ARABIC LETTER SHEEN ISOLATED FORM;Lo;0;AL;<isolated> 0634;;;;N;GLYPH FOR ISOLATE ARABIC SHEEN;;;; +FEB6;ARABIC LETTER SHEEN FINAL FORM;Lo;0;AL;<final> 0634;;;;N;GLYPH FOR FINAL ARABIC SHEEN;;;; +FEB7;ARABIC LETTER SHEEN INITIAL FORM;Lo;0;AL;<initial> 0634;;;;N;GLYPH FOR INITIAL ARABIC SHEEN;;;; +FEB8;ARABIC LETTER SHEEN MEDIAL FORM;Lo;0;AL;<medial> 0634;;;;N;GLYPH FOR MEDIAL ARABIC SHEEN;;;; +FEB9;ARABIC LETTER SAD ISOLATED FORM;Lo;0;AL;<isolated> 0635;;;;N;GLYPH FOR ISOLATE ARABIC SAD;;;; +FEBA;ARABIC LETTER SAD FINAL FORM;Lo;0;AL;<final> 0635;;;;N;GLYPH FOR FINAL ARABIC SAD;;;; +FEBB;ARABIC LETTER SAD INITIAL FORM;Lo;0;AL;<initial> 0635;;;;N;GLYPH FOR INITIAL ARABIC SAD;;;; +FEBC;ARABIC LETTER SAD MEDIAL FORM;Lo;0;AL;<medial> 0635;;;;N;GLYPH FOR MEDIAL ARABIC SAD;;;; +FEBD;ARABIC LETTER DAD ISOLATED FORM;Lo;0;AL;<isolated> 0636;;;;N;GLYPH FOR ISOLATE ARABIC DAD;;;; +FEBE;ARABIC LETTER DAD FINAL FORM;Lo;0;AL;<final> 0636;;;;N;GLYPH FOR FINAL ARABIC DAD;;;; +FEBF;ARABIC LETTER DAD INITIAL FORM;Lo;0;AL;<initial> 0636;;;;N;GLYPH FOR INITIAL ARABIC DAD;;;; +FEC0;ARABIC LETTER DAD MEDIAL FORM;Lo;0;AL;<medial> 0636;;;;N;GLYPH FOR MEDIAL ARABIC DAD;;;; +FEC1;ARABIC LETTER TAH ISOLATED FORM;Lo;0;AL;<isolated> 0637;;;;N;GLYPH FOR ISOLATE ARABIC TAH;;;; +FEC2;ARABIC LETTER TAH FINAL FORM;Lo;0;AL;<final> 0637;;;;N;GLYPH FOR FINAL ARABIC TAH;;;; +FEC3;ARABIC LETTER TAH INITIAL FORM;Lo;0;AL;<initial> 0637;;;;N;GLYPH FOR INITIAL ARABIC TAH;;;; +FEC4;ARABIC LETTER TAH MEDIAL FORM;Lo;0;AL;<medial> 0637;;;;N;GLYPH FOR MEDIAL ARABIC TAH;;;; +FEC5;ARABIC LETTER ZAH ISOLATED FORM;Lo;0;AL;<isolated> 0638;;;;N;GLYPH FOR ISOLATE ARABIC DHAH;;;; +FEC6;ARABIC LETTER ZAH FINAL FORM;Lo;0;AL;<final> 0638;;;;N;GLYPH FOR FINAL ARABIC DHAH;;;; +FEC7;ARABIC LETTER ZAH INITIAL FORM;Lo;0;AL;<initial> 0638;;;;N;GLYPH FOR INITIAL ARABIC DHAH;;;; +FEC8;ARABIC LETTER ZAH MEDIAL FORM;Lo;0;AL;<medial> 0638;;;;N;GLYPH FOR MEDIAL ARABIC DHAH;;;; +FEC9;ARABIC LETTER AIN ISOLATED FORM;Lo;0;AL;<isolated> 0639;;;;N;GLYPH FOR ISOLATE ARABIC AIN;;;; +FECA;ARABIC LETTER AIN FINAL FORM;Lo;0;AL;<final> 0639;;;;N;GLYPH FOR FINAL ARABIC AIN;;;; +FECB;ARABIC LETTER AIN INITIAL FORM;Lo;0;AL;<initial> 0639;;;;N;GLYPH FOR INITIAL ARABIC AIN;;;; +FECC;ARABIC LETTER AIN MEDIAL FORM;Lo;0;AL;<medial> 0639;;;;N;GLYPH FOR MEDIAL ARABIC AIN;;;; +FECD;ARABIC LETTER GHAIN ISOLATED FORM;Lo;0;AL;<isolated> 063A;;;;N;GLYPH FOR ISOLATE ARABIC GHAIN;;;; +FECE;ARABIC LETTER GHAIN FINAL FORM;Lo;0;AL;<final> 063A;;;;N;GLYPH FOR FINAL ARABIC GHAIN;;;; +FECF;ARABIC LETTER GHAIN INITIAL FORM;Lo;0;AL;<initial> 063A;;;;N;GLYPH FOR INITIAL ARABIC GHAIN;;;; +FED0;ARABIC LETTER GHAIN MEDIAL FORM;Lo;0;AL;<medial> 063A;;;;N;GLYPH FOR MEDIAL ARABIC GHAIN;;;; +FED1;ARABIC LETTER FEH ISOLATED FORM;Lo;0;AL;<isolated> 0641;;;;N;GLYPH FOR ISOLATE ARABIC FA;;;; +FED2;ARABIC LETTER FEH FINAL FORM;Lo;0;AL;<final> 0641;;;;N;GLYPH FOR FINAL ARABIC FA;;;; +FED3;ARABIC LETTER FEH INITIAL FORM;Lo;0;AL;<initial> 0641;;;;N;GLYPH FOR INITIAL ARABIC FA;;;; +FED4;ARABIC LETTER FEH MEDIAL FORM;Lo;0;AL;<medial> 0641;;;;N;GLYPH FOR MEDIAL ARABIC FA;;;; +FED5;ARABIC LETTER QAF ISOLATED FORM;Lo;0;AL;<isolated> 0642;;;;N;GLYPH FOR ISOLATE ARABIC QAF;;;; +FED6;ARABIC LETTER QAF FINAL FORM;Lo;0;AL;<final> 0642;;;;N;GLYPH FOR FINAL ARABIC QAF;;;; +FED7;ARABIC LETTER QAF INITIAL FORM;Lo;0;AL;<initial> 0642;;;;N;GLYPH FOR INITIAL ARABIC QAF;;;; +FED8;ARABIC LETTER QAF MEDIAL FORM;Lo;0;AL;<medial> 0642;;;;N;GLYPH FOR MEDIAL ARABIC QAF;;;; +FED9;ARABIC LETTER KAF ISOLATED FORM;Lo;0;AL;<isolated> 0643;;;;N;GLYPH FOR ISOLATE ARABIC CAF;;;; +FEDA;ARABIC LETTER KAF FINAL FORM;Lo;0;AL;<final> 0643;;;;N;GLYPH FOR FINAL ARABIC CAF;;;; +FEDB;ARABIC LETTER KAF INITIAL FORM;Lo;0;AL;<initial> 0643;;;;N;GLYPH FOR INITIAL ARABIC CAF;;;; +FEDC;ARABIC LETTER KAF MEDIAL FORM;Lo;0;AL;<medial> 0643;;;;N;GLYPH FOR MEDIAL ARABIC CAF;;;; +FEDD;ARABIC LETTER LAM ISOLATED FORM;Lo;0;AL;<isolated> 0644;;;;N;GLYPH FOR ISOLATE ARABIC LAM;;;; +FEDE;ARABIC LETTER LAM FINAL FORM;Lo;0;AL;<final> 0644;;;;N;GLYPH FOR FINAL ARABIC LAM;;;; +FEDF;ARABIC LETTER LAM INITIAL FORM;Lo;0;AL;<initial> 0644;;;;N;GLYPH FOR INITIAL ARABIC LAM;;;; +FEE0;ARABIC LETTER LAM MEDIAL FORM;Lo;0;AL;<medial> 0644;;;;N;GLYPH FOR MEDIAL ARABIC LAM;;;; +FEE1;ARABIC LETTER MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0645;;;;N;GLYPH FOR ISOLATE ARABIC MEEM;;;; +FEE2;ARABIC LETTER MEEM FINAL FORM;Lo;0;AL;<final> 0645;;;;N;GLYPH FOR FINAL ARABIC MEEM;;;; +FEE3;ARABIC LETTER MEEM INITIAL FORM;Lo;0;AL;<initial> 0645;;;;N;GLYPH FOR INITIAL ARABIC MEEM;;;; +FEE4;ARABIC LETTER MEEM MEDIAL FORM;Lo;0;AL;<medial> 0645;;;;N;GLYPH FOR MEDIAL ARABIC MEEM;;;; +FEE5;ARABIC LETTER NOON ISOLATED FORM;Lo;0;AL;<isolated> 0646;;;;N;GLYPH FOR ISOLATE ARABIC NOON;;;; +FEE6;ARABIC LETTER NOON FINAL FORM;Lo;0;AL;<final> 0646;;;;N;GLYPH FOR FINAL ARABIC NOON;;;; +FEE7;ARABIC LETTER NOON INITIAL FORM;Lo;0;AL;<initial> 0646;;;;N;GLYPH FOR INITIAL ARABIC NOON;;;; +FEE8;ARABIC LETTER NOON MEDIAL FORM;Lo;0;AL;<medial> 0646;;;;N;GLYPH FOR MEDIAL ARABIC NOON;;;; +FEE9;ARABIC LETTER HEH ISOLATED FORM;Lo;0;AL;<isolated> 0647;;;;N;GLYPH FOR ISOLATE ARABIC HA;;;; +FEEA;ARABIC LETTER HEH FINAL FORM;Lo;0;AL;<final> 0647;;;;N;GLYPH FOR FINAL ARABIC HA;;;; +FEEB;ARABIC LETTER HEH INITIAL FORM;Lo;0;AL;<initial> 0647;;;;N;GLYPH FOR INITIAL ARABIC HA;;;; +FEEC;ARABIC LETTER HEH MEDIAL FORM;Lo;0;AL;<medial> 0647;;;;N;GLYPH FOR MEDIAL ARABIC HA;;;; +FEED;ARABIC LETTER WAW ISOLATED FORM;Lo;0;AL;<isolated> 0648;;;;N;GLYPH FOR ISOLATE ARABIC WAW;;;; +FEEE;ARABIC LETTER WAW FINAL FORM;Lo;0;AL;<final> 0648;;;;N;GLYPH FOR FINAL ARABIC WAW;;;; +FEEF;ARABIC LETTER ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0649;;;;N;GLYPH FOR ISOLATE ARABIC ALEF MAQSURAH;;;; +FEF0;ARABIC LETTER ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0649;;;;N;GLYPH FOR FINAL ARABIC ALEF MAQSURAH;;;; +FEF1;ARABIC LETTER YEH ISOLATED FORM;Lo;0;AL;<isolated> 064A;;;;N;GLYPH FOR ISOLATE ARABIC YA;;;; +FEF2;ARABIC LETTER YEH FINAL FORM;Lo;0;AL;<final> 064A;;;;N;GLYPH FOR FINAL ARABIC YA;;;; +FEF3;ARABIC LETTER YEH INITIAL FORM;Lo;0;AL;<initial> 064A;;;;N;GLYPH FOR INITIAL ARABIC YA;;;; +FEF4;ARABIC LETTER YEH MEDIAL FORM;Lo;0;AL;<medial> 064A;;;;N;GLYPH FOR MEDIAL ARABIC YA;;;; +FEF5;ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0644 0622;;;;N;GLYPH FOR ISOLATE ARABIC MADDAH ON LIGATURE LAM ALEF;;;; +FEF6;ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM;Lo;0;AL;<final> 0644 0622;;;;N;GLYPH FOR FINAL ARABIC MADDAH ON LIGATURE LAM ALEF;;;; +FEF7;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0644 0623;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON LIGATURE LAM ALEF;;;; +FEF8;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0644 0623;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON LIGATURE LAM ALEF;;;; +FEF9;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM;Lo;0;AL;<isolated> 0644 0625;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH UNDER LIGATURE LAM ALEF;;;; +FEFA;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW FINAL FORM;Lo;0;AL;<final> 0644 0625;;;;N;GLYPH FOR FINAL ARABIC HAMZAH UNDER LIGATURE LAM ALEF;;;; +FEFB;ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0644 0627;;;;N;GLYPH FOR ISOLATE ARABIC LIGATURE LAM ALEF;;;; +FEFC;ARABIC LIGATURE LAM WITH ALEF FINAL FORM;Lo;0;AL;<final> 0644 0627;;;;N;GLYPH FOR FINAL ARABIC LIGATURE LAM ALEF;;;; +FEFF;ZERO WIDTH NO-BREAK SPACE;Cf;0;BN;;;;;N;BYTE ORDER MARK;;;; +FF01;FULLWIDTH EXCLAMATION MARK;Po;0;ON;<wide> 0021;;;;N;;;;; +FF02;FULLWIDTH QUOTATION MARK;Po;0;ON;<wide> 0022;;;;N;;;;; +FF03;FULLWIDTH NUMBER SIGN;Po;0;ET;<wide> 0023;;;;N;;;;; +FF04;FULLWIDTH DOLLAR SIGN;Sc;0;ET;<wide> 0024;;;;N;;;;; +FF05;FULLWIDTH PERCENT SIGN;Po;0;ET;<wide> 0025;;;;N;;;;; +FF06;FULLWIDTH AMPERSAND;Po;0;ON;<wide> 0026;;;;N;;;;; +FF07;FULLWIDTH APOSTROPHE;Po;0;ON;<wide> 0027;;;;N;;;;; +FF08;FULLWIDTH LEFT PARENTHESIS;Ps;0;ON;<wide> 0028;;;;Y;FULLWIDTH OPENING PARENTHESIS;;;; +FF09;FULLWIDTH RIGHT PARENTHESIS;Pe;0;ON;<wide> 0029;;;;Y;FULLWIDTH CLOSING PARENTHESIS;;;; +FF0A;FULLWIDTH ASTERISK;Po;0;ON;<wide> 002A;;;;N;;;;; +FF0B;FULLWIDTH PLUS SIGN;Sm;0;ES;<wide> 002B;;;;N;;;;; +FF0C;FULLWIDTH COMMA;Po;0;CS;<wide> 002C;;;;N;;;;; +FF0D;FULLWIDTH HYPHEN-MINUS;Pd;0;ES;<wide> 002D;;;;N;;;;; +FF0E;FULLWIDTH FULL STOP;Po;0;CS;<wide> 002E;;;;N;FULLWIDTH PERIOD;;;; +FF0F;FULLWIDTH SOLIDUS;Po;0;CS;<wide> 002F;;;;N;FULLWIDTH SLASH;;;; +FF10;FULLWIDTH DIGIT ZERO;Nd;0;EN;<wide> 0030;0;0;0;N;;;;; +FF11;FULLWIDTH DIGIT ONE;Nd;0;EN;<wide> 0031;1;1;1;N;;;;; +FF12;FULLWIDTH DIGIT TWO;Nd;0;EN;<wide> 0032;2;2;2;N;;;;; +FF13;FULLWIDTH DIGIT THREE;Nd;0;EN;<wide> 0033;3;3;3;N;;;;; +FF14;FULLWIDTH DIGIT FOUR;Nd;0;EN;<wide> 0034;4;4;4;N;;;;; +FF15;FULLWIDTH DIGIT FIVE;Nd;0;EN;<wide> 0035;5;5;5;N;;;;; +FF16;FULLWIDTH DIGIT SIX;Nd;0;EN;<wide> 0036;6;6;6;N;;;;; +FF17;FULLWIDTH DIGIT SEVEN;Nd;0;EN;<wide> 0037;7;7;7;N;;;;; +FF18;FULLWIDTH DIGIT EIGHT;Nd;0;EN;<wide> 0038;8;8;8;N;;;;; +FF19;FULLWIDTH DIGIT NINE;Nd;0;EN;<wide> 0039;9;9;9;N;;;;; +FF1A;FULLWIDTH COLON;Po;0;CS;<wide> 003A;;;;N;;;;; +FF1B;FULLWIDTH SEMICOLON;Po;0;ON;<wide> 003B;;;;N;;;;; +FF1C;FULLWIDTH LESS-THAN SIGN;Sm;0;ON;<wide> 003C;;;;Y;;;;; +FF1D;FULLWIDTH EQUALS SIGN;Sm;0;ON;<wide> 003D;;;;N;;;;; +FF1E;FULLWIDTH GREATER-THAN SIGN;Sm;0;ON;<wide> 003E;;;;Y;;;;; +FF1F;FULLWIDTH QUESTION MARK;Po;0;ON;<wide> 003F;;;;N;;;;; +FF20;FULLWIDTH COMMERCIAL AT;Po;0;ON;<wide> 0040;;;;N;;;;; +FF21;FULLWIDTH LATIN CAPITAL LETTER A;Lu;0;L;<wide> 0041;;;;N;;;;FF41; +FF22;FULLWIDTH LATIN CAPITAL LETTER B;Lu;0;L;<wide> 0042;;;;N;;;;FF42; +FF23;FULLWIDTH LATIN CAPITAL LETTER C;Lu;0;L;<wide> 0043;;;;N;;;;FF43; +FF24;FULLWIDTH LATIN CAPITAL LETTER D;Lu;0;L;<wide> 0044;;;;N;;;;FF44; +FF25;FULLWIDTH LATIN CAPITAL LETTER E;Lu;0;L;<wide> 0045;;;;N;;;;FF45; +FF26;FULLWIDTH LATIN CAPITAL LETTER F;Lu;0;L;<wide> 0046;;;;N;;;;FF46; +FF27;FULLWIDTH LATIN CAPITAL LETTER G;Lu;0;L;<wide> 0047;;;;N;;;;FF47; +FF28;FULLWIDTH LATIN CAPITAL LETTER H;Lu;0;L;<wide> 0048;;;;N;;;;FF48; +FF29;FULLWIDTH LATIN CAPITAL LETTER I;Lu;0;L;<wide> 0049;;;;N;;;;FF49; +FF2A;FULLWIDTH LATIN CAPITAL LETTER J;Lu;0;L;<wide> 004A;;;;N;;;;FF4A; +FF2B;FULLWIDTH LATIN CAPITAL LETTER K;Lu;0;L;<wide> 004B;;;;N;;;;FF4B; +FF2C;FULLWIDTH LATIN CAPITAL LETTER L;Lu;0;L;<wide> 004C;;;;N;;;;FF4C; +FF2D;FULLWIDTH LATIN CAPITAL LETTER M;Lu;0;L;<wide> 004D;;;;N;;;;FF4D; +FF2E;FULLWIDTH LATIN CAPITAL LETTER N;Lu;0;L;<wide> 004E;;;;N;;;;FF4E; +FF2F;FULLWIDTH LATIN CAPITAL LETTER O;Lu;0;L;<wide> 004F;;;;N;;;;FF4F; +FF30;FULLWIDTH LATIN CAPITAL LETTER P;Lu;0;L;<wide> 0050;;;;N;;;;FF50; +FF31;FULLWIDTH LATIN CAPITAL LETTER Q;Lu;0;L;<wide> 0051;;;;N;;;;FF51; +FF32;FULLWIDTH LATIN CAPITAL LETTER R;Lu;0;L;<wide> 0052;;;;N;;;;FF52; +FF33;FULLWIDTH LATIN CAPITAL LETTER S;Lu;0;L;<wide> 0053;;;;N;;;;FF53; +FF34;FULLWIDTH LATIN CAPITAL LETTER T;Lu;0;L;<wide> 0054;;;;N;;;;FF54; +FF35;FULLWIDTH LATIN CAPITAL LETTER U;Lu;0;L;<wide> 0055;;;;N;;;;FF55; +FF36;FULLWIDTH LATIN CAPITAL LETTER V;Lu;0;L;<wide> 0056;;;;N;;;;FF56; +FF37;FULLWIDTH LATIN CAPITAL LETTER W;Lu;0;L;<wide> 0057;;;;N;;;;FF57; +FF38;FULLWIDTH LATIN CAPITAL LETTER X;Lu;0;L;<wide> 0058;;;;N;;;;FF58; +FF39;FULLWIDTH LATIN CAPITAL LETTER Y;Lu;0;L;<wide> 0059;;;;N;;;;FF59; +FF3A;FULLWIDTH LATIN CAPITAL LETTER Z;Lu;0;L;<wide> 005A;;;;N;;;;FF5A; +FF3B;FULLWIDTH LEFT SQUARE BRACKET;Ps;0;ON;<wide> 005B;;;;Y;FULLWIDTH OPENING SQUARE BRACKET;;;; +FF3C;FULLWIDTH REVERSE SOLIDUS;Po;0;ON;<wide> 005C;;;;N;FULLWIDTH BACKSLASH;;;; +FF3D;FULLWIDTH RIGHT SQUARE BRACKET;Pe;0;ON;<wide> 005D;;;;Y;FULLWIDTH CLOSING SQUARE BRACKET;;;; +FF3E;FULLWIDTH CIRCUMFLEX ACCENT;Sk;0;ON;<wide> 005E;;;;N;FULLWIDTH SPACING CIRCUMFLEX;;;; +FF3F;FULLWIDTH LOW LINE;Pc;0;ON;<wide> 005F;;;;N;FULLWIDTH SPACING UNDERSCORE;;;; +FF40;FULLWIDTH GRAVE ACCENT;Sk;0;ON;<wide> 0060;;;;N;FULLWIDTH SPACING GRAVE;;;; +FF41;FULLWIDTH LATIN SMALL LETTER A;Ll;0;L;<wide> 0061;;;;N;;;FF21;;FF21 +FF42;FULLWIDTH LATIN SMALL LETTER B;Ll;0;L;<wide> 0062;;;;N;;;FF22;;FF22 +FF43;FULLWIDTH LATIN SMALL LETTER C;Ll;0;L;<wide> 0063;;;;N;;;FF23;;FF23 +FF44;FULLWIDTH LATIN SMALL LETTER D;Ll;0;L;<wide> 0064;;;;N;;;FF24;;FF24 +FF45;FULLWIDTH LATIN SMALL LETTER E;Ll;0;L;<wide> 0065;;;;N;;;FF25;;FF25 +FF46;FULLWIDTH LATIN SMALL LETTER F;Ll;0;L;<wide> 0066;;;;N;;;FF26;;FF26 +FF47;FULLWIDTH LATIN SMALL LETTER G;Ll;0;L;<wide> 0067;;;;N;;;FF27;;FF27 +FF48;FULLWIDTH LATIN SMALL LETTER H;Ll;0;L;<wide> 0068;;;;N;;;FF28;;FF28 +FF49;FULLWIDTH LATIN SMALL LETTER I;Ll;0;L;<wide> 0069;;;;N;;;FF29;;FF29 +FF4A;FULLWIDTH LATIN SMALL LETTER J;Ll;0;L;<wide> 006A;;;;N;;;FF2A;;FF2A +FF4B;FULLWIDTH LATIN SMALL LETTER K;Ll;0;L;<wide> 006B;;;;N;;;FF2B;;FF2B +FF4C;FULLWIDTH LATIN SMALL LETTER L;Ll;0;L;<wide> 006C;;;;N;;;FF2C;;FF2C +FF4D;FULLWIDTH LATIN SMALL LETTER M;Ll;0;L;<wide> 006D;;;;N;;;FF2D;;FF2D +FF4E;FULLWIDTH LATIN SMALL LETTER N;Ll;0;L;<wide> 006E;;;;N;;;FF2E;;FF2E +FF4F;FULLWIDTH LATIN SMALL LETTER O;Ll;0;L;<wide> 006F;;;;N;;;FF2F;;FF2F +FF50;FULLWIDTH LATIN SMALL LETTER P;Ll;0;L;<wide> 0070;;;;N;;;FF30;;FF30 +FF51;FULLWIDTH LATIN SMALL LETTER Q;Ll;0;L;<wide> 0071;;;;N;;;FF31;;FF31 +FF52;FULLWIDTH LATIN SMALL LETTER R;Ll;0;L;<wide> 0072;;;;N;;;FF32;;FF32 +FF53;FULLWIDTH LATIN SMALL LETTER S;Ll;0;L;<wide> 0073;;;;N;;;FF33;;FF33 +FF54;FULLWIDTH LATIN SMALL LETTER T;Ll;0;L;<wide> 0074;;;;N;;;FF34;;FF34 +FF55;FULLWIDTH LATIN SMALL LETTER U;Ll;0;L;<wide> 0075;;;;N;;;FF35;;FF35 +FF56;FULLWIDTH LATIN SMALL LETTER V;Ll;0;L;<wide> 0076;;;;N;;;FF36;;FF36 +FF57;FULLWIDTH LATIN SMALL LETTER W;Ll;0;L;<wide> 0077;;;;N;;;FF37;;FF37 +FF58;FULLWIDTH LATIN SMALL LETTER X;Ll;0;L;<wide> 0078;;;;N;;;FF38;;FF38 +FF59;FULLWIDTH LATIN SMALL LETTER Y;Ll;0;L;<wide> 0079;;;;N;;;FF39;;FF39 +FF5A;FULLWIDTH LATIN SMALL LETTER Z;Ll;0;L;<wide> 007A;;;;N;;;FF3A;;FF3A +FF5B;FULLWIDTH LEFT CURLY BRACKET;Ps;0;ON;<wide> 007B;;;;Y;FULLWIDTH OPENING CURLY BRACKET;;;; +FF5C;FULLWIDTH VERTICAL LINE;Sm;0;ON;<wide> 007C;;;;N;FULLWIDTH VERTICAL BAR;;;; +FF5D;FULLWIDTH RIGHT CURLY BRACKET;Pe;0;ON;<wide> 007D;;;;Y;FULLWIDTH CLOSING CURLY BRACKET;;;; +FF5E;FULLWIDTH TILDE;Sm;0;ON;<wide> 007E;;;;N;FULLWIDTH SPACING TILDE;;;; +FF5F;FULLWIDTH LEFT WHITE PARENTHESIS;Ps;0;ON;<wide> 2985;;;;Y;;;;; +FF60;FULLWIDTH RIGHT WHITE PARENTHESIS;Pe;0;ON;<wide> 2986;;;;Y;;;;; +FF61;HALFWIDTH IDEOGRAPHIC FULL STOP;Po;0;ON;<narrow> 3002;;;;N;HALFWIDTH IDEOGRAPHIC PERIOD;;;; +FF62;HALFWIDTH LEFT CORNER BRACKET;Ps;0;ON;<narrow> 300C;;;;Y;HALFWIDTH OPENING CORNER BRACKET;;;; +FF63;HALFWIDTH RIGHT CORNER BRACKET;Pe;0;ON;<narrow> 300D;;;;Y;HALFWIDTH CLOSING CORNER BRACKET;;;; +FF64;HALFWIDTH IDEOGRAPHIC COMMA;Po;0;ON;<narrow> 3001;;;;N;;;;; +FF65;HALFWIDTH KATAKANA MIDDLE DOT;Po;0;ON;<narrow> 30FB;;;;N;;;;; +FF66;HALFWIDTH KATAKANA LETTER WO;Lo;0;L;<narrow> 30F2;;;;N;;;;; +FF67;HALFWIDTH KATAKANA LETTER SMALL A;Lo;0;L;<narrow> 30A1;;;;N;;;;; +FF68;HALFWIDTH KATAKANA LETTER SMALL I;Lo;0;L;<narrow> 30A3;;;;N;;;;; +FF69;HALFWIDTH KATAKANA LETTER SMALL U;Lo;0;L;<narrow> 30A5;;;;N;;;;; +FF6A;HALFWIDTH KATAKANA LETTER SMALL E;Lo;0;L;<narrow> 30A7;;;;N;;;;; +FF6B;HALFWIDTH KATAKANA LETTER SMALL O;Lo;0;L;<narrow> 30A9;;;;N;;;;; +FF6C;HALFWIDTH KATAKANA LETTER SMALL YA;Lo;0;L;<narrow> 30E3;;;;N;;;;; +FF6D;HALFWIDTH KATAKANA LETTER SMALL YU;Lo;0;L;<narrow> 30E5;;;;N;;;;; +FF6E;HALFWIDTH KATAKANA LETTER SMALL YO;Lo;0;L;<narrow> 30E7;;;;N;;;;; +FF6F;HALFWIDTH KATAKANA LETTER SMALL TU;Lo;0;L;<narrow> 30C3;;;;N;;;;; +FF70;HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK;Lm;0;L;<narrow> 30FC;;;;N;;;;; +FF71;HALFWIDTH KATAKANA LETTER A;Lo;0;L;<narrow> 30A2;;;;N;;;;; +FF72;HALFWIDTH KATAKANA LETTER I;Lo;0;L;<narrow> 30A4;;;;N;;;;; +FF73;HALFWIDTH KATAKANA LETTER U;Lo;0;L;<narrow> 30A6;;;;N;;;;; +FF74;HALFWIDTH KATAKANA LETTER E;Lo;0;L;<narrow> 30A8;;;;N;;;;; +FF75;HALFWIDTH KATAKANA LETTER O;Lo;0;L;<narrow> 30AA;;;;N;;;;; +FF76;HALFWIDTH KATAKANA LETTER KA;Lo;0;L;<narrow> 30AB;;;;N;;;;; +FF77;HALFWIDTH KATAKANA LETTER KI;Lo;0;L;<narrow> 30AD;;;;N;;;;; +FF78;HALFWIDTH KATAKANA LETTER KU;Lo;0;L;<narrow> 30AF;;;;N;;;;; +FF79;HALFWIDTH KATAKANA LETTER KE;Lo;0;L;<narrow> 30B1;;;;N;;;;; +FF7A;HALFWIDTH KATAKANA LETTER KO;Lo;0;L;<narrow> 30B3;;;;N;;;;; +FF7B;HALFWIDTH KATAKANA LETTER SA;Lo;0;L;<narrow> 30B5;;;;N;;;;; +FF7C;HALFWIDTH KATAKANA LETTER SI;Lo;0;L;<narrow> 30B7;;;;N;;;;; +FF7D;HALFWIDTH KATAKANA LETTER SU;Lo;0;L;<narrow> 30B9;;;;N;;;;; +FF7E;HALFWIDTH KATAKANA LETTER SE;Lo;0;L;<narrow> 30BB;;;;N;;;;; +FF7F;HALFWIDTH KATAKANA LETTER SO;Lo;0;L;<narrow> 30BD;;;;N;;;;; +FF80;HALFWIDTH KATAKANA LETTER TA;Lo;0;L;<narrow> 30BF;;;;N;;;;; +FF81;HALFWIDTH KATAKANA LETTER TI;Lo;0;L;<narrow> 30C1;;;;N;;;;; +FF82;HALFWIDTH KATAKANA LETTER TU;Lo;0;L;<narrow> 30C4;;;;N;;;;; +FF83;HALFWIDTH KATAKANA LETTER TE;Lo;0;L;<narrow> 30C6;;;;N;;;;; +FF84;HALFWIDTH KATAKANA LETTER TO;Lo;0;L;<narrow> 30C8;;;;N;;;;; +FF85;HALFWIDTH KATAKANA LETTER NA;Lo;0;L;<narrow> 30CA;;;;N;;;;; +FF86;HALFWIDTH KATAKANA LETTER NI;Lo;0;L;<narrow> 30CB;;;;N;;;;; +FF87;HALFWIDTH KATAKANA LETTER NU;Lo;0;L;<narrow> 30CC;;;;N;;;;; +FF88;HALFWIDTH KATAKANA LETTER NE;Lo;0;L;<narrow> 30CD;;;;N;;;;; +FF89;HALFWIDTH KATAKANA LETTER NO;Lo;0;L;<narrow> 30CE;;;;N;;;;; +FF8A;HALFWIDTH KATAKANA LETTER HA;Lo;0;L;<narrow> 30CF;;;;N;;;;; +FF8B;HALFWIDTH KATAKANA LETTER HI;Lo;0;L;<narrow> 30D2;;;;N;;;;; +FF8C;HALFWIDTH KATAKANA LETTER HU;Lo;0;L;<narrow> 30D5;;;;N;;;;; +FF8D;HALFWIDTH KATAKANA LETTER HE;Lo;0;L;<narrow> 30D8;;;;N;;;;; +FF8E;HALFWIDTH KATAKANA LETTER HO;Lo;0;L;<narrow> 30DB;;;;N;;;;; +FF8F;HALFWIDTH KATAKANA LETTER MA;Lo;0;L;<narrow> 30DE;;;;N;;;;; +FF90;HALFWIDTH KATAKANA LETTER MI;Lo;0;L;<narrow> 30DF;;;;N;;;;; +FF91;HALFWIDTH KATAKANA LETTER MU;Lo;0;L;<narrow> 30E0;;;;N;;;;; +FF92;HALFWIDTH KATAKANA LETTER ME;Lo;0;L;<narrow> 30E1;;;;N;;;;; +FF93;HALFWIDTH KATAKANA LETTER MO;Lo;0;L;<narrow> 30E2;;;;N;;;;; +FF94;HALFWIDTH KATAKANA LETTER YA;Lo;0;L;<narrow> 30E4;;;;N;;;;; +FF95;HALFWIDTH KATAKANA LETTER YU;Lo;0;L;<narrow> 30E6;;;;N;;;;; +FF96;HALFWIDTH KATAKANA LETTER YO;Lo;0;L;<narrow> 30E8;;;;N;;;;; +FF97;HALFWIDTH KATAKANA LETTER RA;Lo;0;L;<narrow> 30E9;;;;N;;;;; +FF98;HALFWIDTH KATAKANA LETTER RI;Lo;0;L;<narrow> 30EA;;;;N;;;;; +FF99;HALFWIDTH KATAKANA LETTER RU;Lo;0;L;<narrow> 30EB;;;;N;;;;; +FF9A;HALFWIDTH KATAKANA LETTER RE;Lo;0;L;<narrow> 30EC;;;;N;;;;; +FF9B;HALFWIDTH KATAKANA LETTER RO;Lo;0;L;<narrow> 30ED;;;;N;;;;; +FF9C;HALFWIDTH KATAKANA LETTER WA;Lo;0;L;<narrow> 30EF;;;;N;;;;; +FF9D;HALFWIDTH KATAKANA LETTER N;Lo;0;L;<narrow> 30F3;;;;N;;;;; +FF9E;HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;;;; +FF9F;HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;;;; +FFA0;HALFWIDTH HANGUL FILLER;Lo;0;L;<narrow> 3164;;;;N;HALFWIDTH HANGUL CAE OM;;;; +FFA1;HALFWIDTH HANGUL LETTER KIYEOK;Lo;0;L;<narrow> 3131;;;;N;HALFWIDTH HANGUL LETTER GIYEOG;;;; +FFA2;HALFWIDTH HANGUL LETTER SSANGKIYEOK;Lo;0;L;<narrow> 3132;;;;N;HALFWIDTH HANGUL LETTER SSANG GIYEOG;;;; +FFA3;HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;; +FFA4;HALFWIDTH HANGUL LETTER NIEUN;Lo;0;L;<narrow> 3134;;;;N;;;;; +FFA5;HALFWIDTH HANGUL LETTER NIEUN-CIEUC;Lo;0;L;<narrow> 3135;;;;N;HALFWIDTH HANGUL LETTER NIEUN JIEUJ;;;; +FFA6;HALFWIDTH HANGUL LETTER NIEUN-HIEUH;Lo;0;L;<narrow> 3136;;;;N;HALFWIDTH HANGUL LETTER NIEUN HIEUH;;;; +FFA7;HALFWIDTH HANGUL LETTER TIKEUT;Lo;0;L;<narrow> 3137;;;;N;HALFWIDTH HANGUL LETTER DIGEUD;;;; +FFA8;HALFWIDTH HANGUL LETTER SSANGTIKEUT;Lo;0;L;<narrow> 3138;;;;N;HALFWIDTH HANGUL LETTER SSANG DIGEUD;;;; +FFA9;HALFWIDTH HANGUL LETTER RIEUL;Lo;0;L;<narrow> 3139;;;;N;HALFWIDTH HANGUL LETTER LIEUL;;;; +FFAA;HALFWIDTH HANGUL LETTER RIEUL-KIYEOK;Lo;0;L;<narrow> 313A;;;;N;HALFWIDTH HANGUL LETTER LIEUL GIYEOG;;;; +FFAB;HALFWIDTH HANGUL LETTER RIEUL-MIEUM;Lo;0;L;<narrow> 313B;;;;N;HALFWIDTH HANGUL LETTER LIEUL MIEUM;;;; +FFAC;HALFWIDTH HANGUL LETTER RIEUL-PIEUP;Lo;0;L;<narrow> 313C;;;;N;HALFWIDTH HANGUL LETTER LIEUL BIEUB;;;; +FFAD;HALFWIDTH HANGUL LETTER RIEUL-SIOS;Lo;0;L;<narrow> 313D;;;;N;HALFWIDTH HANGUL LETTER LIEUL SIOS;;;; +FFAE;HALFWIDTH HANGUL LETTER RIEUL-THIEUTH;Lo;0;L;<narrow> 313E;;;;N;HALFWIDTH HANGUL LETTER LIEUL TIEUT;;;; +FFAF;HALFWIDTH HANGUL LETTER RIEUL-PHIEUPH;Lo;0;L;<narrow> 313F;;;;N;HALFWIDTH HANGUL LETTER LIEUL PIEUP;;;; +FFB0;HALFWIDTH HANGUL LETTER RIEUL-HIEUH;Lo;0;L;<narrow> 3140;;;;N;HALFWIDTH HANGUL LETTER LIEUL HIEUH;;;; +FFB1;HALFWIDTH HANGUL LETTER MIEUM;Lo;0;L;<narrow> 3141;;;;N;;;;; +FFB2;HALFWIDTH HANGUL LETTER PIEUP;Lo;0;L;<narrow> 3142;;;;N;HALFWIDTH HANGUL LETTER BIEUB;;;; +FFB3;HALFWIDTH HANGUL LETTER SSANGPIEUP;Lo;0;L;<narrow> 3143;;;;N;HALFWIDTH HANGUL LETTER SSANG BIEUB;;;; +FFB4;HALFWIDTH HANGUL LETTER PIEUP-SIOS;Lo;0;L;<narrow> 3144;;;;N;HALFWIDTH HANGUL LETTER BIEUB SIOS;;;; +FFB5;HALFWIDTH HANGUL LETTER SIOS;Lo;0;L;<narrow> 3145;;;;N;;;;; +FFB6;HALFWIDTH HANGUL LETTER SSANGSIOS;Lo;0;L;<narrow> 3146;;;;N;HALFWIDTH HANGUL LETTER SSANG SIOS;;;; +FFB7;HALFWIDTH HANGUL LETTER IEUNG;Lo;0;L;<narrow> 3147;;;;N;;;;; +FFB8;HALFWIDTH HANGUL LETTER CIEUC;Lo;0;L;<narrow> 3148;;;;N;HALFWIDTH HANGUL LETTER JIEUJ;;;; +FFB9;HALFWIDTH HANGUL LETTER SSANGCIEUC;Lo;0;L;<narrow> 3149;;;;N;HALFWIDTH HANGUL LETTER SSANG JIEUJ;;;; +FFBA;HALFWIDTH HANGUL LETTER CHIEUCH;Lo;0;L;<narrow> 314A;;;;N;HALFWIDTH HANGUL LETTER CIEUC;;;; +FFBB;HALFWIDTH HANGUL LETTER KHIEUKH;Lo;0;L;<narrow> 314B;;;;N;HALFWIDTH HANGUL LETTER KIYEOK;;;; +FFBC;HALFWIDTH HANGUL LETTER THIEUTH;Lo;0;L;<narrow> 314C;;;;N;HALFWIDTH HANGUL LETTER TIEUT;;;; +FFBD;HALFWIDTH HANGUL LETTER PHIEUPH;Lo;0;L;<narrow> 314D;;;;N;HALFWIDTH HANGUL LETTER PIEUP;;;; +FFBE;HALFWIDTH HANGUL LETTER HIEUH;Lo;0;L;<narrow> 314E;;;;N;;;;; +FFC2;HALFWIDTH HANGUL LETTER A;Lo;0;L;<narrow> 314F;;;;N;;;;; +FFC3;HALFWIDTH HANGUL LETTER AE;Lo;0;L;<narrow> 3150;;;;N;;;;; +FFC4;HALFWIDTH HANGUL LETTER YA;Lo;0;L;<narrow> 3151;;;;N;;;;; +FFC5;HALFWIDTH HANGUL LETTER YAE;Lo;0;L;<narrow> 3152;;;;N;;;;; +FFC6;HALFWIDTH HANGUL LETTER EO;Lo;0;L;<narrow> 3153;;;;N;;;;; +FFC7;HALFWIDTH HANGUL LETTER E;Lo;0;L;<narrow> 3154;;;;N;;;;; +FFCA;HALFWIDTH HANGUL LETTER YEO;Lo;0;L;<narrow> 3155;;;;N;;;;; +FFCB;HALFWIDTH HANGUL LETTER YE;Lo;0;L;<narrow> 3156;;;;N;;;;; +FFCC;HALFWIDTH HANGUL LETTER O;Lo;0;L;<narrow> 3157;;;;N;;;;; +FFCD;HALFWIDTH HANGUL LETTER WA;Lo;0;L;<narrow> 3158;;;;N;;;;; +FFCE;HALFWIDTH HANGUL LETTER WAE;Lo;0;L;<narrow> 3159;;;;N;;;;; +FFCF;HALFWIDTH HANGUL LETTER OE;Lo;0;L;<narrow> 315A;;;;N;;;;; +FFD2;HALFWIDTH HANGUL LETTER YO;Lo;0;L;<narrow> 315B;;;;N;;;;; +FFD3;HALFWIDTH HANGUL LETTER U;Lo;0;L;<narrow> 315C;;;;N;;;;; +FFD4;HALFWIDTH HANGUL LETTER WEO;Lo;0;L;<narrow> 315D;;;;N;;;;; +FFD5;HALFWIDTH HANGUL LETTER WE;Lo;0;L;<narrow> 315E;;;;N;;;;; +FFD6;HALFWIDTH HANGUL LETTER WI;Lo;0;L;<narrow> 315F;;;;N;;;;; +FFD7;HALFWIDTH HANGUL LETTER YU;Lo;0;L;<narrow> 3160;;;;N;;;;; +FFDA;HALFWIDTH HANGUL LETTER EU;Lo;0;L;<narrow> 3161;;;;N;;;;; +FFDB;HALFWIDTH HANGUL LETTER YI;Lo;0;L;<narrow> 3162;;;;N;;;;; +FFDC;HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;; +FFE0;FULLWIDTH CENT SIGN;Sc;0;ET;<wide> 00A2;;;;N;;;;; +FFE1;FULLWIDTH POUND SIGN;Sc;0;ET;<wide> 00A3;;;;N;;;;; +FFE2;FULLWIDTH NOT SIGN;Sm;0;ON;<wide> 00AC;;;;N;;;;; +FFE3;FULLWIDTH MACRON;Sk;0;ON;<wide> 00AF;;;;N;FULLWIDTH SPACING MACRON;;;; +FFE4;FULLWIDTH BROKEN BAR;So;0;ON;<wide> 00A6;;;;N;FULLWIDTH BROKEN VERTICAL BAR;;;; +FFE5;FULLWIDTH YEN SIGN;Sc;0;ET;<wide> 00A5;;;;N;;;;; +FFE6;FULLWIDTH WON SIGN;Sc;0;ET;<wide> 20A9;;;;N;;;;; +FFE8;HALFWIDTH FORMS LIGHT VERTICAL;So;0;ON;<narrow> 2502;;;;N;;;;; +FFE9;HALFWIDTH LEFTWARDS ARROW;Sm;0;ON;<narrow> 2190;;;;N;;;;; +FFEA;HALFWIDTH UPWARDS ARROW;Sm;0;ON;<narrow> 2191;;;;N;;;;; +FFEB;HALFWIDTH RIGHTWARDS ARROW;Sm;0;ON;<narrow> 2192;;;;N;;;;; +FFEC;HALFWIDTH DOWNWARDS ARROW;Sm;0;ON;<narrow> 2193;;;;N;;;;; +FFED;HALFWIDTH BLACK SQUARE;So;0;ON;<narrow> 25A0;;;;N;;;;; +FFEE;HALFWIDTH WHITE CIRCLE;So;0;ON;<narrow> 25CB;;;;N;;;;; +FFF9;INTERLINEAR ANNOTATION ANCHOR;Cf;0;ON;;;;;N;;;;; +FFFA;INTERLINEAR ANNOTATION SEPARATOR;Cf;0;ON;;;;;N;;;;; +FFFB;INTERLINEAR ANNOTATION TERMINATOR;Cf;0;ON;;;;;N;;;;; +FFFC;OBJECT REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; +FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;; +10000;LINEAR B SYLLABLE B008 A;Lo;0;L;;;;;N;;;;; +10001;LINEAR B SYLLABLE B038 E;Lo;0;L;;;;;N;;;;; +10002;LINEAR B SYLLABLE B028 I;Lo;0;L;;;;;N;;;;; +10003;LINEAR B SYLLABLE B061 O;Lo;0;L;;;;;N;;;;; +10004;LINEAR B SYLLABLE B010 U;Lo;0;L;;;;;N;;;;; +10005;LINEAR B SYLLABLE B001 DA;Lo;0;L;;;;;N;;;;; +10006;LINEAR B SYLLABLE B045 DE;Lo;0;L;;;;;N;;;;; +10007;LINEAR B SYLLABLE B007 DI;Lo;0;L;;;;;N;;;;; +10008;LINEAR B SYLLABLE B014 DO;Lo;0;L;;;;;N;;;;; +10009;LINEAR B SYLLABLE B051 DU;Lo;0;L;;;;;N;;;;; +1000A;LINEAR B SYLLABLE B057 JA;Lo;0;L;;;;;N;;;;; +1000B;LINEAR B SYLLABLE B046 JE;Lo;0;L;;;;;N;;;;; +1000D;LINEAR B SYLLABLE B036 JO;Lo;0;L;;;;;N;;;;; +1000E;LINEAR B SYLLABLE B065 JU;Lo;0;L;;;;;N;;;;; +1000F;LINEAR B SYLLABLE B077 KA;Lo;0;L;;;;;N;;;;; +10010;LINEAR B SYLLABLE B044 KE;Lo;0;L;;;;;N;;;;; +10011;LINEAR B SYLLABLE B067 KI;Lo;0;L;;;;;N;;;;; +10012;LINEAR B SYLLABLE B070 KO;Lo;0;L;;;;;N;;;;; +10013;LINEAR B SYLLABLE B081 KU;Lo;0;L;;;;;N;;;;; +10014;LINEAR B SYLLABLE B080 MA;Lo;0;L;;;;;N;;;;; +10015;LINEAR B SYLLABLE B013 ME;Lo;0;L;;;;;N;;;;; +10016;LINEAR B SYLLABLE B073 MI;Lo;0;L;;;;;N;;;;; +10017;LINEAR B SYLLABLE B015 MO;Lo;0;L;;;;;N;;;;; +10018;LINEAR B SYLLABLE B023 MU;Lo;0;L;;;;;N;;;;; +10019;LINEAR B SYLLABLE B006 NA;Lo;0;L;;;;;N;;;;; +1001A;LINEAR B SYLLABLE B024 NE;Lo;0;L;;;;;N;;;;; +1001B;LINEAR B SYLLABLE B030 NI;Lo;0;L;;;;;N;;;;; +1001C;LINEAR B SYLLABLE B052 NO;Lo;0;L;;;;;N;;;;; +1001D;LINEAR B SYLLABLE B055 NU;Lo;0;L;;;;;N;;;;; +1001E;LINEAR B SYLLABLE B003 PA;Lo;0;L;;;;;N;;;;; +1001F;LINEAR B SYLLABLE B072 PE;Lo;0;L;;;;;N;;;;; +10020;LINEAR B SYLLABLE B039 PI;Lo;0;L;;;;;N;;;;; +10021;LINEAR B SYLLABLE B011 PO;Lo;0;L;;;;;N;;;;; +10022;LINEAR B SYLLABLE B050 PU;Lo;0;L;;;;;N;;;;; +10023;LINEAR B SYLLABLE B016 QA;Lo;0;L;;;;;N;;;;; +10024;LINEAR B SYLLABLE B078 QE;Lo;0;L;;;;;N;;;;; +10025;LINEAR B SYLLABLE B021 QI;Lo;0;L;;;;;N;;;;; +10026;LINEAR B SYLLABLE B032 QO;Lo;0;L;;;;;N;;;;; +10028;LINEAR B SYLLABLE B060 RA;Lo;0;L;;;;;N;;;;; +10029;LINEAR B SYLLABLE B027 RE;Lo;0;L;;;;;N;;;;; +1002A;LINEAR B SYLLABLE B053 RI;Lo;0;L;;;;;N;;;;; +1002B;LINEAR B SYLLABLE B002 RO;Lo;0;L;;;;;N;;;;; +1002C;LINEAR B SYLLABLE B026 RU;Lo;0;L;;;;;N;;;;; +1002D;LINEAR B SYLLABLE B031 SA;Lo;0;L;;;;;N;;;;; +1002E;LINEAR B SYLLABLE B009 SE;Lo;0;L;;;;;N;;;;; +1002F;LINEAR B SYLLABLE B041 SI;Lo;0;L;;;;;N;;;;; +10030;LINEAR B SYLLABLE B012 SO;Lo;0;L;;;;;N;;;;; +10031;LINEAR B SYLLABLE B058 SU;Lo;0;L;;;;;N;;;;; +10032;LINEAR B SYLLABLE B059 TA;Lo;0;L;;;;;N;;;;; +10033;LINEAR B SYLLABLE B004 TE;Lo;0;L;;;;;N;;;;; +10034;LINEAR B SYLLABLE B037 TI;Lo;0;L;;;;;N;;;;; +10035;LINEAR B SYLLABLE B005 TO;Lo;0;L;;;;;N;;;;; +10036;LINEAR B SYLLABLE B069 TU;Lo;0;L;;;;;N;;;;; +10037;LINEAR B SYLLABLE B054 WA;Lo;0;L;;;;;N;;;;; +10038;LINEAR B SYLLABLE B075 WE;Lo;0;L;;;;;N;;;;; +10039;LINEAR B SYLLABLE B040 WI;Lo;0;L;;;;;N;;;;; +1003A;LINEAR B SYLLABLE B042 WO;Lo;0;L;;;;;N;;;;; +1003C;LINEAR B SYLLABLE B017 ZA;Lo;0;L;;;;;N;;;;; +1003D;LINEAR B SYLLABLE B074 ZE;Lo;0;L;;;;;N;;;;; +1003F;LINEAR B SYLLABLE B020 ZO;Lo;0;L;;;;;N;;;;; +10040;LINEAR B SYLLABLE B025 A2;Lo;0;L;;;;;N;;;;; +10041;LINEAR B SYLLABLE B043 A3;Lo;0;L;;;;;N;;;;; +10042;LINEAR B SYLLABLE B085 AU;Lo;0;L;;;;;N;;;;; +10043;LINEAR B SYLLABLE B071 DWE;Lo;0;L;;;;;N;;;;; +10044;LINEAR B SYLLABLE B090 DWO;Lo;0;L;;;;;N;;;;; +10045;LINEAR B SYLLABLE B048 NWA;Lo;0;L;;;;;N;;;;; +10046;LINEAR B SYLLABLE B029 PU2;Lo;0;L;;;;;N;;;;; +10047;LINEAR B SYLLABLE B062 PTE;Lo;0;L;;;;;N;;;;; +10048;LINEAR B SYLLABLE B076 RA2;Lo;0;L;;;;;N;;;;; +10049;LINEAR B SYLLABLE B033 RA3;Lo;0;L;;;;;N;;;;; +1004A;LINEAR B SYLLABLE B068 RO2;Lo;0;L;;;;;N;;;;; +1004B;LINEAR B SYLLABLE B066 TA2;Lo;0;L;;;;;N;;;;; +1004C;LINEAR B SYLLABLE B087 TWE;Lo;0;L;;;;;N;;;;; +1004D;LINEAR B SYLLABLE B091 TWO;Lo;0;L;;;;;N;;;;; +10050;LINEAR B SYMBOL B018;Lo;0;L;;;;;N;;;;; +10051;LINEAR B SYMBOL B019;Lo;0;L;;;;;N;;;;; +10052;LINEAR B SYMBOL B022;Lo;0;L;;;;;N;;;;; +10053;LINEAR B SYMBOL B034;Lo;0;L;;;;;N;;;;; +10054;LINEAR B SYMBOL B047;Lo;0;L;;;;;N;;;;; +10055;LINEAR B SYMBOL B049;Lo;0;L;;;;;N;;;;; +10056;LINEAR B SYMBOL B056;Lo;0;L;;;;;N;;;;; +10057;LINEAR B SYMBOL B063;Lo;0;L;;;;;N;;;;; +10058;LINEAR B SYMBOL B064;Lo;0;L;;;;;N;;;;; +10059;LINEAR B SYMBOL B079;Lo;0;L;;;;;N;;;;; +1005A;LINEAR B SYMBOL B082;Lo;0;L;;;;;N;;;;; +1005B;LINEAR B SYMBOL B083;Lo;0;L;;;;;N;;;;; +1005C;LINEAR B SYMBOL B086;Lo;0;L;;;;;N;;;;; +1005D;LINEAR B SYMBOL B089;Lo;0;L;;;;;N;;;;; +10080;LINEAR B IDEOGRAM B100 MAN;Lo;0;L;;;;;N;;;;; +10081;LINEAR B IDEOGRAM B102 WOMAN;Lo;0;L;;;;;N;;;;; +10082;LINEAR B IDEOGRAM B104 DEER;Lo;0;L;;;;;N;;;;; +10083;LINEAR B IDEOGRAM B105 EQUID;Lo;0;L;;;;;N;;;;; +10084;LINEAR B IDEOGRAM B105F MARE;Lo;0;L;;;;;N;;;;; +10085;LINEAR B IDEOGRAM B105M STALLION;Lo;0;L;;;;;N;;;;; +10086;LINEAR B IDEOGRAM B106F EWE;Lo;0;L;;;;;N;;;;; +10087;LINEAR B IDEOGRAM B106M RAM;Lo;0;L;;;;;N;;;;; +10088;LINEAR B IDEOGRAM B107F SHE-GOAT;Lo;0;L;;;;;N;;;;; +10089;LINEAR B IDEOGRAM B107M HE-GOAT;Lo;0;L;;;;;N;;;;; +1008A;LINEAR B IDEOGRAM B108F SOW;Lo;0;L;;;;;N;;;;; +1008B;LINEAR B IDEOGRAM B108M BOAR;Lo;0;L;;;;;N;;;;; +1008C;LINEAR B IDEOGRAM B109F COW;Lo;0;L;;;;;N;;;;; +1008D;LINEAR B IDEOGRAM B109M BULL;Lo;0;L;;;;;N;;;;; +1008E;LINEAR B IDEOGRAM B120 WHEAT;Lo;0;L;;;;;N;;;;; +1008F;LINEAR B IDEOGRAM B121 BARLEY;Lo;0;L;;;;;N;;;;; +10090;LINEAR B IDEOGRAM B122 OLIVE;Lo;0;L;;;;;N;;;;; +10091;LINEAR B IDEOGRAM B123 SPICE;Lo;0;L;;;;;N;;;;; +10092;LINEAR B IDEOGRAM B125 CYPERUS;Lo;0;L;;;;;N;;;;; +10093;LINEAR B MONOGRAM B127 KAPO;Lo;0;L;;;;;N;;;;; +10094;LINEAR B MONOGRAM B128 KANAKO;Lo;0;L;;;;;N;;;;; +10095;LINEAR B IDEOGRAM B130 OIL;Lo;0;L;;;;;N;;;;; +10096;LINEAR B IDEOGRAM B131 WINE;Lo;0;L;;;;;N;;;;; +10097;LINEAR B IDEOGRAM B132;Lo;0;L;;;;;N;;;;; +10098;LINEAR B MONOGRAM B133 AREPA;Lo;0;L;;;;;N;;;;; +10099;LINEAR B MONOGRAM B135 MERI;Lo;0;L;;;;;N;;;;; +1009A;LINEAR B IDEOGRAM B140 BRONZE;Lo;0;L;;;;;N;;;;; +1009B;LINEAR B IDEOGRAM B141 GOLD;Lo;0;L;;;;;N;;;;; +1009C;LINEAR B IDEOGRAM B142;Lo;0;L;;;;;N;;;;; +1009D;LINEAR B IDEOGRAM B145 WOOL;Lo;0;L;;;;;N;;;;; +1009E;LINEAR B IDEOGRAM B146;Lo;0;L;;;;;N;;;;; +1009F;LINEAR B IDEOGRAM B150;Lo;0;L;;;;;N;;;;; +100A0;LINEAR B IDEOGRAM B151 HORN;Lo;0;L;;;;;N;;;;; +100A1;LINEAR B IDEOGRAM B152;Lo;0;L;;;;;N;;;;; +100A2;LINEAR B IDEOGRAM B153;Lo;0;L;;;;;N;;;;; +100A3;LINEAR B IDEOGRAM B154;Lo;0;L;;;;;N;;;;; +100A4;LINEAR B MONOGRAM B156 TURO2;Lo;0;L;;;;;N;;;;; +100A5;LINEAR B IDEOGRAM B157;Lo;0;L;;;;;N;;;;; +100A6;LINEAR B IDEOGRAM B158;Lo;0;L;;;;;N;;;;; +100A7;LINEAR B IDEOGRAM B159 CLOTH;Lo;0;L;;;;;N;;;;; +100A8;LINEAR B IDEOGRAM B160;Lo;0;L;;;;;N;;;;; +100A9;LINEAR B IDEOGRAM B161;Lo;0;L;;;;;N;;;;; +100AA;LINEAR B IDEOGRAM B162 GARMENT;Lo;0;L;;;;;N;;;;; +100AB;LINEAR B IDEOGRAM B163 ARMOUR;Lo;0;L;;;;;N;;;;; +100AC;LINEAR B IDEOGRAM B164;Lo;0;L;;;;;N;;;;; +100AD;LINEAR B IDEOGRAM B165;Lo;0;L;;;;;N;;;;; +100AE;LINEAR B IDEOGRAM B166;Lo;0;L;;;;;N;;;;; +100AF;LINEAR B IDEOGRAM B167;Lo;0;L;;;;;N;;;;; +100B0;LINEAR B IDEOGRAM B168;Lo;0;L;;;;;N;;;;; +100B1;LINEAR B IDEOGRAM B169;Lo;0;L;;;;;N;;;;; +100B2;LINEAR B IDEOGRAM B170;Lo;0;L;;;;;N;;;;; +100B3;LINEAR B IDEOGRAM B171;Lo;0;L;;;;;N;;;;; +100B4;LINEAR B IDEOGRAM B172;Lo;0;L;;;;;N;;;;; +100B5;LINEAR B IDEOGRAM B173 MONTH;Lo;0;L;;;;;N;;;;; +100B6;LINEAR B IDEOGRAM B174;Lo;0;L;;;;;N;;;;; +100B7;LINEAR B IDEOGRAM B176 TREE;Lo;0;L;;;;;N;;;;; +100B8;LINEAR B IDEOGRAM B177;Lo;0;L;;;;;N;;;;; +100B9;LINEAR B IDEOGRAM B178;Lo;0;L;;;;;N;;;;; +100BA;LINEAR B IDEOGRAM B179;Lo;0;L;;;;;N;;;;; +100BB;LINEAR B IDEOGRAM B180;Lo;0;L;;;;;N;;;;; +100BC;LINEAR B IDEOGRAM B181;Lo;0;L;;;;;N;;;;; +100BD;LINEAR B IDEOGRAM B182;Lo;0;L;;;;;N;;;;; +100BE;LINEAR B IDEOGRAM B183;Lo;0;L;;;;;N;;;;; +100BF;LINEAR B IDEOGRAM B184;Lo;0;L;;;;;N;;;;; +100C0;LINEAR B IDEOGRAM B185;Lo;0;L;;;;;N;;;;; +100C1;LINEAR B IDEOGRAM B189;Lo;0;L;;;;;N;;;;; +100C2;LINEAR B IDEOGRAM B190;Lo;0;L;;;;;N;;;;; +100C3;LINEAR B IDEOGRAM B191 HELMET;Lo;0;L;;;;;N;;;;; +100C4;LINEAR B IDEOGRAM B220 FOOTSTOOL;Lo;0;L;;;;;N;;;;; +100C5;LINEAR B IDEOGRAM B225 BATHTUB;Lo;0;L;;;;;N;;;;; +100C6;LINEAR B IDEOGRAM B230 SPEAR;Lo;0;L;;;;;N;;;;; +100C7;LINEAR B IDEOGRAM B231 ARROW;Lo;0;L;;;;;N;;;;; +100C8;LINEAR B IDEOGRAM B232;Lo;0;L;;;;;N;;;;; +100C9;LINEAR B IDEOGRAM B233 SWORD;Lo;0;L;;;;;N;;;;; +100CA;LINEAR B IDEOGRAM B234;Lo;0;L;;;;;N;;;;; +100CB;LINEAR B IDEOGRAM B236;Lo;0;L;;;;;N;;;;; +100CC;LINEAR B IDEOGRAM B240 WHEELED CHARIOT;Lo;0;L;;;;;N;;;;; +100CD;LINEAR B IDEOGRAM B241 CHARIOT;Lo;0;L;;;;;N;;;;; +100CE;LINEAR B IDEOGRAM B242 CHARIOT FRAME;Lo;0;L;;;;;N;;;;; +100CF;LINEAR B IDEOGRAM B243 WHEEL;Lo;0;L;;;;;N;;;;; +100D0;LINEAR B IDEOGRAM B245;Lo;0;L;;;;;N;;;;; +100D1;LINEAR B IDEOGRAM B246;Lo;0;L;;;;;N;;;;; +100D2;LINEAR B MONOGRAM B247 DIPTE;Lo;0;L;;;;;N;;;;; +100D3;LINEAR B IDEOGRAM B248;Lo;0;L;;;;;N;;;;; +100D4;LINEAR B IDEOGRAM B249;Lo;0;L;;;;;N;;;;; +100D5;LINEAR B IDEOGRAM B251;Lo;0;L;;;;;N;;;;; +100D6;LINEAR B IDEOGRAM B252;Lo;0;L;;;;;N;;;;; +100D7;LINEAR B IDEOGRAM B253;Lo;0;L;;;;;N;;;;; +100D8;LINEAR B IDEOGRAM B254 DART;Lo;0;L;;;;;N;;;;; +100D9;LINEAR B IDEOGRAM B255;Lo;0;L;;;;;N;;;;; +100DA;LINEAR B IDEOGRAM B256;Lo;0;L;;;;;N;;;;; +100DB;LINEAR B IDEOGRAM B257;Lo;0;L;;;;;N;;;;; +100DC;LINEAR B IDEOGRAM B258;Lo;0;L;;;;;N;;;;; +100DD;LINEAR B IDEOGRAM B259;Lo;0;L;;;;;N;;;;; +100DE;LINEAR B IDEOGRAM VESSEL B155;Lo;0;L;;;;;N;;;;; +100DF;LINEAR B IDEOGRAM VESSEL B200;Lo;0;L;;;;;N;;;;; +100E0;LINEAR B IDEOGRAM VESSEL B201;Lo;0;L;;;;;N;;;;; +100E1;LINEAR B IDEOGRAM VESSEL B202;Lo;0;L;;;;;N;;;;; +100E2;LINEAR B IDEOGRAM VESSEL B203;Lo;0;L;;;;;N;;;;; +100E3;LINEAR B IDEOGRAM VESSEL B204;Lo;0;L;;;;;N;;;;; +100E4;LINEAR B IDEOGRAM VESSEL B205;Lo;0;L;;;;;N;;;;; +100E5;LINEAR B IDEOGRAM VESSEL B206;Lo;0;L;;;;;N;;;;; +100E6;LINEAR B IDEOGRAM VESSEL B207;Lo;0;L;;;;;N;;;;; +100E7;LINEAR B IDEOGRAM VESSEL B208;Lo;0;L;;;;;N;;;;; +100E8;LINEAR B IDEOGRAM VESSEL B209;Lo;0;L;;;;;N;;;;; +100E9;LINEAR B IDEOGRAM VESSEL B210;Lo;0;L;;;;;N;;;;; +100EA;LINEAR B IDEOGRAM VESSEL B211;Lo;0;L;;;;;N;;;;; +100EB;LINEAR B IDEOGRAM VESSEL B212;Lo;0;L;;;;;N;;;;; +100EC;LINEAR B IDEOGRAM VESSEL B213;Lo;0;L;;;;;N;;;;; +100ED;LINEAR B IDEOGRAM VESSEL B214;Lo;0;L;;;;;N;;;;; +100EE;LINEAR B IDEOGRAM VESSEL B215;Lo;0;L;;;;;N;;;;; +100EF;LINEAR B IDEOGRAM VESSEL B216;Lo;0;L;;;;;N;;;;; +100F0;LINEAR B IDEOGRAM VESSEL B217;Lo;0;L;;;;;N;;;;; +100F1;LINEAR B IDEOGRAM VESSEL B218;Lo;0;L;;;;;N;;;;; +100F2;LINEAR B IDEOGRAM VESSEL B219;Lo;0;L;;;;;N;;;;; +100F3;LINEAR B IDEOGRAM VESSEL B221;Lo;0;L;;;;;N;;;;; +100F4;LINEAR B IDEOGRAM VESSEL B222;Lo;0;L;;;;;N;;;;; +100F5;LINEAR B IDEOGRAM VESSEL B226;Lo;0;L;;;;;N;;;;; +100F6;LINEAR B IDEOGRAM VESSEL B227;Lo;0;L;;;;;N;;;;; +100F7;LINEAR B IDEOGRAM VESSEL B228;Lo;0;L;;;;;N;;;;; +100F8;LINEAR B IDEOGRAM VESSEL B229;Lo;0;L;;;;;N;;;;; +100F9;LINEAR B IDEOGRAM VESSEL B250;Lo;0;L;;;;;N;;;;; +100FA;LINEAR B IDEOGRAM VESSEL B305;Lo;0;L;;;;;N;;;;; +10100;AEGEAN WORD SEPARATOR LINE;Po;0;L;;;;;N;;;;; +10101;AEGEAN WORD SEPARATOR DOT;Po;0;ON;;;;;N;;;;; +10102;AEGEAN CHECK MARK;Po;0;L;;;;;N;;;;; +10107;AEGEAN NUMBER ONE;No;0;L;;;;1;N;;;;; +10108;AEGEAN NUMBER TWO;No;0;L;;;;2;N;;;;; +10109;AEGEAN NUMBER THREE;No;0;L;;;;3;N;;;;; +1010A;AEGEAN NUMBER FOUR;No;0;L;;;;4;N;;;;; +1010B;AEGEAN NUMBER FIVE;No;0;L;;;;5;N;;;;; +1010C;AEGEAN NUMBER SIX;No;0;L;;;;6;N;;;;; +1010D;AEGEAN NUMBER SEVEN;No;0;L;;;;7;N;;;;; +1010E;AEGEAN NUMBER EIGHT;No;0;L;;;;8;N;;;;; +1010F;AEGEAN NUMBER NINE;No;0;L;;;;9;N;;;;; +10110;AEGEAN NUMBER TEN;No;0;L;;;;10;N;;;;; +10111;AEGEAN NUMBER TWENTY;No;0;L;;;;20;N;;;;; +10112;AEGEAN NUMBER THIRTY;No;0;L;;;;30;N;;;;; +10113;AEGEAN NUMBER FORTY;No;0;L;;;;40;N;;;;; +10114;AEGEAN NUMBER FIFTY;No;0;L;;;;50;N;;;;; +10115;AEGEAN NUMBER SIXTY;No;0;L;;;;60;N;;;;; +10116;AEGEAN NUMBER SEVENTY;No;0;L;;;;70;N;;;;; +10117;AEGEAN NUMBER EIGHTY;No;0;L;;;;80;N;;;;; +10118;AEGEAN NUMBER NINETY;No;0;L;;;;90;N;;;;; +10119;AEGEAN NUMBER ONE HUNDRED;No;0;L;;;;100;N;;;;; +1011A;AEGEAN NUMBER TWO HUNDRED;No;0;L;;;;200;N;;;;; +1011B;AEGEAN NUMBER THREE HUNDRED;No;0;L;;;;300;N;;;;; +1011C;AEGEAN NUMBER FOUR HUNDRED;No;0;L;;;;400;N;;;;; +1011D;AEGEAN NUMBER FIVE HUNDRED;No;0;L;;;;500;N;;;;; +1011E;AEGEAN NUMBER SIX HUNDRED;No;0;L;;;;600;N;;;;; +1011F;AEGEAN NUMBER SEVEN HUNDRED;No;0;L;;;;700;N;;;;; +10120;AEGEAN NUMBER EIGHT HUNDRED;No;0;L;;;;800;N;;;;; +10121;AEGEAN NUMBER NINE HUNDRED;No;0;L;;;;900;N;;;;; +10122;AEGEAN NUMBER ONE THOUSAND;No;0;L;;;;1000;N;;;;; +10123;AEGEAN NUMBER TWO THOUSAND;No;0;L;;;;2000;N;;;;; +10124;AEGEAN NUMBER THREE THOUSAND;No;0;L;;;;3000;N;;;;; +10125;AEGEAN NUMBER FOUR THOUSAND;No;0;L;;;;4000;N;;;;; +10126;AEGEAN NUMBER FIVE THOUSAND;No;0;L;;;;5000;N;;;;; +10127;AEGEAN NUMBER SIX THOUSAND;No;0;L;;;;6000;N;;;;; +10128;AEGEAN NUMBER SEVEN THOUSAND;No;0;L;;;;7000;N;;;;; +10129;AEGEAN NUMBER EIGHT THOUSAND;No;0;L;;;;8000;N;;;;; +1012A;AEGEAN NUMBER NINE THOUSAND;No;0;L;;;;9000;N;;;;; +1012B;AEGEAN NUMBER TEN THOUSAND;No;0;L;;;;10000;N;;;;; +1012C;AEGEAN NUMBER TWENTY THOUSAND;No;0;L;;;;20000;N;;;;; +1012D;AEGEAN NUMBER THIRTY THOUSAND;No;0;L;;;;30000;N;;;;; +1012E;AEGEAN NUMBER FORTY THOUSAND;No;0;L;;;;40000;N;;;;; +1012F;AEGEAN NUMBER FIFTY THOUSAND;No;0;L;;;;50000;N;;;;; +10130;AEGEAN NUMBER SIXTY THOUSAND;No;0;L;;;;60000;N;;;;; +10131;AEGEAN NUMBER SEVENTY THOUSAND;No;0;L;;;;70000;N;;;;; +10132;AEGEAN NUMBER EIGHTY THOUSAND;No;0;L;;;;80000;N;;;;; +10133;AEGEAN NUMBER NINETY THOUSAND;No;0;L;;;;90000;N;;;;; +10137;AEGEAN WEIGHT BASE UNIT;So;0;L;;;;;N;;;;; +10138;AEGEAN WEIGHT FIRST SUBUNIT;So;0;L;;;;;N;;;;; +10139;AEGEAN WEIGHT SECOND SUBUNIT;So;0;L;;;;;N;;;;; +1013A;AEGEAN WEIGHT THIRD SUBUNIT;So;0;L;;;;;N;;;;; +1013B;AEGEAN WEIGHT FOURTH SUBUNIT;So;0;L;;;;;N;;;;; +1013C;AEGEAN DRY MEASURE FIRST SUBUNIT;So;0;L;;;;;N;;;;; +1013D;AEGEAN LIQUID MEASURE FIRST SUBUNIT;So;0;L;;;;;N;;;;; +1013E;AEGEAN MEASURE SECOND SUBUNIT;So;0;L;;;;;N;;;;; +1013F;AEGEAN MEASURE THIRD SUBUNIT;So;0;L;;;;;N;;;;; +10140;GREEK ACROPHONIC ATTIC ONE QUARTER;Nl;0;ON;;;;1/4;N;;;;; +10141;GREEK ACROPHONIC ATTIC ONE HALF;Nl;0;ON;;;;1/2;N;;;;; +10142;GREEK ACROPHONIC ATTIC ONE DRACHMA;Nl;0;ON;;;;1;N;;;;; +10143;GREEK ACROPHONIC ATTIC FIVE;Nl;0;ON;;;;5;N;;;;; +10144;GREEK ACROPHONIC ATTIC FIFTY;Nl;0;ON;;;;50;N;;;;; +10145;GREEK ACROPHONIC ATTIC FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;; +10146;GREEK ACROPHONIC ATTIC FIVE THOUSAND;Nl;0;ON;;;;5000;N;;;;; +10147;GREEK ACROPHONIC ATTIC FIFTY THOUSAND;Nl;0;ON;;;;50000;N;;;;; +10148;GREEK ACROPHONIC ATTIC FIVE TALENTS;Nl;0;ON;;;;5;N;;;;; +10149;GREEK ACROPHONIC ATTIC TEN TALENTS;Nl;0;ON;;;;10;N;;;;; +1014A;GREEK ACROPHONIC ATTIC FIFTY TALENTS;Nl;0;ON;;;;50;N;;;;; +1014B;GREEK ACROPHONIC ATTIC ONE HUNDRED TALENTS;Nl;0;ON;;;;100;N;;;;; +1014C;GREEK ACROPHONIC ATTIC FIVE HUNDRED TALENTS;Nl;0;ON;;;;500;N;;;;; +1014D;GREEK ACROPHONIC ATTIC ONE THOUSAND TALENTS;Nl;0;ON;;;;1000;N;;;;; +1014E;GREEK ACROPHONIC ATTIC FIVE THOUSAND TALENTS;Nl;0;ON;;;;5000;N;;;;; +1014F;GREEK ACROPHONIC ATTIC FIVE STATERS;Nl;0;ON;;;;5;N;;;;; +10150;GREEK ACROPHONIC ATTIC TEN STATERS;Nl;0;ON;;;;10;N;;;;; +10151;GREEK ACROPHONIC ATTIC FIFTY STATERS;Nl;0;ON;;;;50;N;;;;; +10152;GREEK ACROPHONIC ATTIC ONE HUNDRED STATERS;Nl;0;ON;;;;100;N;;;;; +10153;GREEK ACROPHONIC ATTIC FIVE HUNDRED STATERS;Nl;0;ON;;;;500;N;;;;; +10154;GREEK ACROPHONIC ATTIC ONE THOUSAND STATERS;Nl;0;ON;;;;1000;N;;;;; +10155;GREEK ACROPHONIC ATTIC TEN THOUSAND STATERS;Nl;0;ON;;;;10000;N;;;;; +10156;GREEK ACROPHONIC ATTIC FIFTY THOUSAND STATERS;Nl;0;ON;;;;50000;N;;;;; +10157;GREEK ACROPHONIC ATTIC TEN MNAS;Nl;0;ON;;;;10;N;;;;; +10158;GREEK ACROPHONIC HERAEUM ONE PLETHRON;Nl;0;ON;;;;1;N;;;;; +10159;GREEK ACROPHONIC THESPIAN ONE;Nl;0;ON;;;;1;N;;;;; +1015A;GREEK ACROPHONIC HERMIONIAN ONE;Nl;0;ON;;;;1;N;;;;; +1015B;GREEK ACROPHONIC EPIDAUREAN TWO;Nl;0;ON;;;;2;N;;;;; +1015C;GREEK ACROPHONIC THESPIAN TWO;Nl;0;ON;;;;2;N;;;;; +1015D;GREEK ACROPHONIC CYRENAIC TWO DRACHMAS;Nl;0;ON;;;;2;N;;;;; +1015E;GREEK ACROPHONIC EPIDAUREAN TWO DRACHMAS;Nl;0;ON;;;;2;N;;;;; +1015F;GREEK ACROPHONIC TROEZENIAN FIVE;Nl;0;ON;;;;5;N;;;;; +10160;GREEK ACROPHONIC TROEZENIAN TEN;Nl;0;ON;;;;10;N;;;;; +10161;GREEK ACROPHONIC TROEZENIAN TEN ALTERNATE FORM;Nl;0;ON;;;;10;N;;;;; +10162;GREEK ACROPHONIC HERMIONIAN TEN;Nl;0;ON;;;;10;N;;;;; +10163;GREEK ACROPHONIC MESSENIAN TEN;Nl;0;ON;;;;10;N;;;;; +10164;GREEK ACROPHONIC THESPIAN TEN;Nl;0;ON;;;;10;N;;;;; +10165;GREEK ACROPHONIC THESPIAN THIRTY;Nl;0;ON;;;;30;N;;;;; +10166;GREEK ACROPHONIC TROEZENIAN FIFTY;Nl;0;ON;;;;50;N;;;;; +10167;GREEK ACROPHONIC TROEZENIAN FIFTY ALTERNATE FORM;Nl;0;ON;;;;50;N;;;;; +10168;GREEK ACROPHONIC HERMIONIAN FIFTY;Nl;0;ON;;;;50;N;;;;; +10169;GREEK ACROPHONIC THESPIAN FIFTY;Nl;0;ON;;;;50;N;;;;; +1016A;GREEK ACROPHONIC THESPIAN ONE HUNDRED;Nl;0;ON;;;;100;N;;;;; +1016B;GREEK ACROPHONIC THESPIAN THREE HUNDRED;Nl;0;ON;;;;300;N;;;;; +1016C;GREEK ACROPHONIC EPIDAUREAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;; +1016D;GREEK ACROPHONIC TROEZENIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;; +1016E;GREEK ACROPHONIC THESPIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;; +1016F;GREEK ACROPHONIC CARYSTIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;; +10170;GREEK ACROPHONIC NAXIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;; +10171;GREEK ACROPHONIC THESPIAN ONE THOUSAND;Nl;0;ON;;;;1000;N;;;;; +10172;GREEK ACROPHONIC THESPIAN FIVE THOUSAND;Nl;0;ON;;;;5000;N;;;;; +10173;GREEK ACROPHONIC DELPHIC FIVE MNAS;Nl;0;ON;;;;5;N;;;;; +10174;GREEK ACROPHONIC STRATIAN FIFTY MNAS;Nl;0;ON;;;;50;N;;;;; +10175;GREEK ONE HALF SIGN;No;0;ON;;;;1/2;N;;;;; +10176;GREEK ONE HALF SIGN ALTERNATE FORM;No;0;ON;;;;1/2;N;;;;; +10177;GREEK TWO THIRDS SIGN;No;0;ON;;;;2/3;N;;;;; +10178;GREEK THREE QUARTERS SIGN;No;0;ON;;;;3/4;N;;;;; +10179;GREEK YEAR SIGN;So;0;ON;;;;;N;;;;; +1017A;GREEK TALENT SIGN;So;0;ON;;;;;N;;;;; +1017B;GREEK DRACHMA SIGN;So;0;ON;;;;;N;;;;; +1017C;GREEK OBOL SIGN;So;0;ON;;;;;N;;;;; +1017D;GREEK TWO OBOLS SIGN;So;0;ON;;;;;N;;;;; +1017E;GREEK THREE OBOLS SIGN;So;0;ON;;;;;N;;;;; +1017F;GREEK FOUR OBOLS SIGN;So;0;ON;;;;;N;;;;; +10180;GREEK FIVE OBOLS SIGN;So;0;ON;;;;;N;;;;; +10181;GREEK METRETES SIGN;So;0;ON;;;;;N;;;;; +10182;GREEK KYATHOS BASE SIGN;So;0;ON;;;;;N;;;;; +10183;GREEK LITRA SIGN;So;0;ON;;;;;N;;;;; +10184;GREEK OUNKIA SIGN;So;0;ON;;;;;N;;;;; +10185;GREEK XESTES SIGN;So;0;ON;;;;;N;;;;; +10186;GREEK ARTABE SIGN;So;0;ON;;;;;N;;;;; +10187;GREEK AROURA SIGN;So;0;ON;;;;;N;;;;; +10188;GREEK GRAMMA SIGN;So;0;ON;;;;;N;;;;; +10189;GREEK TRYBLION BASE SIGN;So;0;ON;;;;;N;;;;; +1018A;GREEK ZERO SIGN;No;0;ON;;;;0;N;;;;; +1018B;GREEK ONE QUARTER SIGN;No;0;ON;;;;1/4;N;;;;; +1018C;GREEK SINUSOID SIGN;So;0;ON;;;;;N;;;;; +1018D;GREEK INDICTION SIGN;So;0;L;;;;;N;;;;; +1018E;NOMISMA SIGN;So;0;L;;;;;N;;;;; +10190;ROMAN SEXTANS SIGN;So;0;ON;;;;;N;;;;; +10191;ROMAN UNCIA SIGN;So;0;ON;;;;;N;;;;; +10192;ROMAN SEMUNCIA SIGN;So;0;ON;;;;;N;;;;; +10193;ROMAN SEXTULA SIGN;So;0;ON;;;;;N;;;;; +10194;ROMAN DIMIDIA SEXTULA SIGN;So;0;ON;;;;;N;;;;; +10195;ROMAN SILIQUA SIGN;So;0;ON;;;;;N;;;;; +10196;ROMAN DENARIUS SIGN;So;0;ON;;;;;N;;;;; +10197;ROMAN QUINARIUS SIGN;So;0;ON;;;;;N;;;;; +10198;ROMAN SESTERTIUS SIGN;So;0;ON;;;;;N;;;;; +10199;ROMAN DUPONDIUS SIGN;So;0;ON;;;;;N;;;;; +1019A;ROMAN AS SIGN;So;0;ON;;;;;N;;;;; +1019B;ROMAN CENTURIAL SIGN;So;0;ON;;;;;N;;;;; +101A0;GREEK SYMBOL TAU RHO;So;0;ON;;;;;N;;;;; +101D0;PHAISTOS DISC SIGN PEDESTRIAN;So;0;L;;;;;N;;;;; +101D1;PHAISTOS DISC SIGN PLUMED HEAD;So;0;L;;;;;N;;;;; +101D2;PHAISTOS DISC SIGN TATTOOED HEAD;So;0;L;;;;;N;;;;; +101D3;PHAISTOS DISC SIGN CAPTIVE;So;0;L;;;;;N;;;;; +101D4;PHAISTOS DISC SIGN CHILD;So;0;L;;;;;N;;;;; +101D5;PHAISTOS DISC SIGN WOMAN;So;0;L;;;;;N;;;;; +101D6;PHAISTOS DISC SIGN HELMET;So;0;L;;;;;N;;;;; +101D7;PHAISTOS DISC SIGN GAUNTLET;So;0;L;;;;;N;;;;; +101D8;PHAISTOS DISC SIGN TIARA;So;0;L;;;;;N;;;;; +101D9;PHAISTOS DISC SIGN ARROW;So;0;L;;;;;N;;;;; +101DA;PHAISTOS DISC SIGN BOW;So;0;L;;;;;N;;;;; +101DB;PHAISTOS DISC SIGN SHIELD;So;0;L;;;;;N;;;;; +101DC;PHAISTOS DISC SIGN CLUB;So;0;L;;;;;N;;;;; +101DD;PHAISTOS DISC SIGN MANACLES;So;0;L;;;;;N;;;;; +101DE;PHAISTOS DISC SIGN MATTOCK;So;0;L;;;;;N;;;;; +101DF;PHAISTOS DISC SIGN SAW;So;0;L;;;;;N;;;;; +101E0;PHAISTOS DISC SIGN LID;So;0;L;;;;;N;;;;; +101E1;PHAISTOS DISC SIGN BOOMERANG;So;0;L;;;;;N;;;;; +101E2;PHAISTOS DISC SIGN CARPENTRY PLANE;So;0;L;;;;;N;;;;; +101E3;PHAISTOS DISC SIGN DOLIUM;So;0;L;;;;;N;;;;; +101E4;PHAISTOS DISC SIGN COMB;So;0;L;;;;;N;;;;; +101E5;PHAISTOS DISC SIGN SLING;So;0;L;;;;;N;;;;; +101E6;PHAISTOS DISC SIGN COLUMN;So;0;L;;;;;N;;;;; +101E7;PHAISTOS DISC SIGN BEEHIVE;So;0;L;;;;;N;;;;; +101E8;PHAISTOS DISC SIGN SHIP;So;0;L;;;;;N;;;;; +101E9;PHAISTOS DISC SIGN HORN;So;0;L;;;;;N;;;;; +101EA;PHAISTOS DISC SIGN HIDE;So;0;L;;;;;N;;;;; +101EB;PHAISTOS DISC SIGN BULLS LEG;So;0;L;;;;;N;;;;; +101EC;PHAISTOS DISC SIGN CAT;So;0;L;;;;;N;;;;; +101ED;PHAISTOS DISC SIGN RAM;So;0;L;;;;;N;;;;; +101EE;PHAISTOS DISC SIGN EAGLE;So;0;L;;;;;N;;;;; +101EF;PHAISTOS DISC SIGN DOVE;So;0;L;;;;;N;;;;; +101F0;PHAISTOS DISC SIGN TUNNY;So;0;L;;;;;N;;;;; +101F1;PHAISTOS DISC SIGN BEE;So;0;L;;;;;N;;;;; +101F2;PHAISTOS DISC SIGN PLANE TREE;So;0;L;;;;;N;;;;; +101F3;PHAISTOS DISC SIGN VINE;So;0;L;;;;;N;;;;; +101F4;PHAISTOS DISC SIGN PAPYRUS;So;0;L;;;;;N;;;;; +101F5;PHAISTOS DISC SIGN ROSETTE;So;0;L;;;;;N;;;;; +101F6;PHAISTOS DISC SIGN LILY;So;0;L;;;;;N;;;;; +101F7;PHAISTOS DISC SIGN OX BACK;So;0;L;;;;;N;;;;; +101F8;PHAISTOS DISC SIGN FLUTE;So;0;L;;;;;N;;;;; +101F9;PHAISTOS DISC SIGN GRATER;So;0;L;;;;;N;;;;; +101FA;PHAISTOS DISC SIGN STRAINER;So;0;L;;;;;N;;;;; +101FB;PHAISTOS DISC SIGN SMALL AXE;So;0;L;;;;;N;;;;; +101FC;PHAISTOS DISC SIGN WAVY BAND;So;0;L;;;;;N;;;;; +101FD;PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE;Mn;220;NSM;;;;;N;;;;; +10280;LYCIAN LETTER A;Lo;0;L;;;;;N;;;;; +10281;LYCIAN LETTER E;Lo;0;L;;;;;N;;;;; +10282;LYCIAN LETTER B;Lo;0;L;;;;;N;;;;; +10283;LYCIAN LETTER BH;Lo;0;L;;;;;N;;;;; +10284;LYCIAN LETTER G;Lo;0;L;;;;;N;;;;; +10285;LYCIAN LETTER D;Lo;0;L;;;;;N;;;;; +10286;LYCIAN LETTER I;Lo;0;L;;;;;N;;;;; +10287;LYCIAN LETTER W;Lo;0;L;;;;;N;;;;; +10288;LYCIAN LETTER Z;Lo;0;L;;;;;N;;;;; +10289;LYCIAN LETTER TH;Lo;0;L;;;;;N;;;;; +1028A;LYCIAN LETTER J;Lo;0;L;;;;;N;;;;; +1028B;LYCIAN LETTER K;Lo;0;L;;;;;N;;;;; +1028C;LYCIAN LETTER Q;Lo;0;L;;;;;N;;;;; +1028D;LYCIAN LETTER L;Lo;0;L;;;;;N;;;;; +1028E;LYCIAN LETTER M;Lo;0;L;;;;;N;;;;; +1028F;LYCIAN LETTER N;Lo;0;L;;;;;N;;;;; +10290;LYCIAN LETTER MM;Lo;0;L;;;;;N;;;;; +10291;LYCIAN LETTER NN;Lo;0;L;;;;;N;;;;; +10292;LYCIAN LETTER U;Lo;0;L;;;;;N;;;;; +10293;LYCIAN LETTER P;Lo;0;L;;;;;N;;;;; +10294;LYCIAN LETTER KK;Lo;0;L;;;;;N;;;;; +10295;LYCIAN LETTER R;Lo;0;L;;;;;N;;;;; +10296;LYCIAN LETTER S;Lo;0;L;;;;;N;;;;; +10297;LYCIAN LETTER T;Lo;0;L;;;;;N;;;;; +10298;LYCIAN LETTER TT;Lo;0;L;;;;;N;;;;; +10299;LYCIAN LETTER AN;Lo;0;L;;;;;N;;;;; +1029A;LYCIAN LETTER EN;Lo;0;L;;;;;N;;;;; +1029B;LYCIAN LETTER H;Lo;0;L;;;;;N;;;;; +1029C;LYCIAN LETTER X;Lo;0;L;;;;;N;;;;; +102A0;CARIAN LETTER A;Lo;0;L;;;;;N;;;;; +102A1;CARIAN LETTER P2;Lo;0;L;;;;;N;;;;; +102A2;CARIAN LETTER D;Lo;0;L;;;;;N;;;;; +102A3;CARIAN LETTER L;Lo;0;L;;;;;N;;;;; +102A4;CARIAN LETTER UUU;Lo;0;L;;;;;N;;;;; +102A5;CARIAN LETTER R;Lo;0;L;;;;;N;;;;; +102A6;CARIAN LETTER LD;Lo;0;L;;;;;N;;;;; +102A7;CARIAN LETTER A2;Lo;0;L;;;;;N;;;;; +102A8;CARIAN LETTER Q;Lo;0;L;;;;;N;;;;; +102A9;CARIAN LETTER B;Lo;0;L;;;;;N;;;;; +102AA;CARIAN LETTER M;Lo;0;L;;;;;N;;;;; +102AB;CARIAN LETTER O;Lo;0;L;;;;;N;;;;; +102AC;CARIAN LETTER D2;Lo;0;L;;;;;N;;;;; +102AD;CARIAN LETTER T;Lo;0;L;;;;;N;;;;; +102AE;CARIAN LETTER SH;Lo;0;L;;;;;N;;;;; +102AF;CARIAN LETTER SH2;Lo;0;L;;;;;N;;;;; +102B0;CARIAN LETTER S;Lo;0;L;;;;;N;;;;; +102B1;CARIAN LETTER C-18;Lo;0;L;;;;;N;;;;; +102B2;CARIAN LETTER U;Lo;0;L;;;;;N;;;;; +102B3;CARIAN LETTER NN;Lo;0;L;;;;;N;;;;; +102B4;CARIAN LETTER X;Lo;0;L;;;;;N;;;;; +102B5;CARIAN LETTER N;Lo;0;L;;;;;N;;;;; +102B6;CARIAN LETTER TT2;Lo;0;L;;;;;N;;;;; +102B7;CARIAN LETTER P;Lo;0;L;;;;;N;;;;; +102B8;CARIAN LETTER SS;Lo;0;L;;;;;N;;;;; +102B9;CARIAN LETTER I;Lo;0;L;;;;;N;;;;; +102BA;CARIAN LETTER E;Lo;0;L;;;;;N;;;;; +102BB;CARIAN LETTER UUUU;Lo;0;L;;;;;N;;;;; +102BC;CARIAN LETTER K;Lo;0;L;;;;;N;;;;; +102BD;CARIAN LETTER K2;Lo;0;L;;;;;N;;;;; +102BE;CARIAN LETTER ND;Lo;0;L;;;;;N;;;;; +102BF;CARIAN LETTER UU;Lo;0;L;;;;;N;;;;; +102C0;CARIAN LETTER G;Lo;0;L;;;;;N;;;;; +102C1;CARIAN LETTER G2;Lo;0;L;;;;;N;;;;; +102C2;CARIAN LETTER ST;Lo;0;L;;;;;N;;;;; +102C3;CARIAN LETTER ST2;Lo;0;L;;;;;N;;;;; +102C4;CARIAN LETTER NG;Lo;0;L;;;;;N;;;;; +102C5;CARIAN LETTER II;Lo;0;L;;;;;N;;;;; +102C6;CARIAN LETTER C-39;Lo;0;L;;;;;N;;;;; +102C7;CARIAN LETTER TT;Lo;0;L;;;;;N;;;;; +102C8;CARIAN LETTER UUU2;Lo;0;L;;;;;N;;;;; +102C9;CARIAN LETTER RR;Lo;0;L;;;;;N;;;;; +102CA;CARIAN LETTER MB;Lo;0;L;;;;;N;;;;; +102CB;CARIAN LETTER MB2;Lo;0;L;;;;;N;;;;; +102CC;CARIAN LETTER MB3;Lo;0;L;;;;;N;;;;; +102CD;CARIAN LETTER MB4;Lo;0;L;;;;;N;;;;; +102CE;CARIAN LETTER LD2;Lo;0;L;;;;;N;;;;; +102CF;CARIAN LETTER E2;Lo;0;L;;;;;N;;;;; +102D0;CARIAN LETTER UUU3;Lo;0;L;;;;;N;;;;; +102E0;COPTIC EPACT THOUSANDS MARK;Mn;220;NSM;;;;;N;;;;; +102E1;COPTIC EPACT DIGIT ONE;No;0;EN;;;;1;N;;;;; +102E2;COPTIC EPACT DIGIT TWO;No;0;EN;;;;2;N;;;;; +102E3;COPTIC EPACT DIGIT THREE;No;0;EN;;;;3;N;;;;; +102E4;COPTIC EPACT DIGIT FOUR;No;0;EN;;;;4;N;;;;; +102E5;COPTIC EPACT DIGIT FIVE;No;0;EN;;;;5;N;;;;; +102E6;COPTIC EPACT DIGIT SIX;No;0;EN;;;;6;N;;;;; +102E7;COPTIC EPACT DIGIT SEVEN;No;0;EN;;;;7;N;;;;; +102E8;COPTIC EPACT DIGIT EIGHT;No;0;EN;;;;8;N;;;;; +102E9;COPTIC EPACT DIGIT NINE;No;0;EN;;;;9;N;;;;; +102EA;COPTIC EPACT NUMBER TEN;No;0;EN;;;;10;N;;;;; +102EB;COPTIC EPACT NUMBER TWENTY;No;0;EN;;;;20;N;;;;; +102EC;COPTIC EPACT NUMBER THIRTY;No;0;EN;;;;30;N;;;;; +102ED;COPTIC EPACT NUMBER FORTY;No;0;EN;;;;40;N;;;;; +102EE;COPTIC EPACT NUMBER FIFTY;No;0;EN;;;;50;N;;;;; +102EF;COPTIC EPACT NUMBER SIXTY;No;0;EN;;;;60;N;;;;; +102F0;COPTIC EPACT NUMBER SEVENTY;No;0;EN;;;;70;N;;;;; +102F1;COPTIC EPACT NUMBER EIGHTY;No;0;EN;;;;80;N;;;;; +102F2;COPTIC EPACT NUMBER NINETY;No;0;EN;;;;90;N;;;;; +102F3;COPTIC EPACT NUMBER ONE HUNDRED;No;0;EN;;;;100;N;;;;; +102F4;COPTIC EPACT NUMBER TWO HUNDRED;No;0;EN;;;;200;N;;;;; +102F5;COPTIC EPACT NUMBER THREE HUNDRED;No;0;EN;;;;300;N;;;;; +102F6;COPTIC EPACT NUMBER FOUR HUNDRED;No;0;EN;;;;400;N;;;;; +102F7;COPTIC EPACT NUMBER FIVE HUNDRED;No;0;EN;;;;500;N;;;;; +102F8;COPTIC EPACT NUMBER SIX HUNDRED;No;0;EN;;;;600;N;;;;; +102F9;COPTIC EPACT NUMBER SEVEN HUNDRED;No;0;EN;;;;700;N;;;;; +102FA;COPTIC EPACT NUMBER EIGHT HUNDRED;No;0;EN;;;;800;N;;;;; +102FB;COPTIC EPACT NUMBER NINE HUNDRED;No;0;EN;;;;900;N;;;;; +10300;OLD ITALIC LETTER A;Lo;0;L;;;;;N;;;;; +10301;OLD ITALIC LETTER BE;Lo;0;L;;;;;N;;;;; +10302;OLD ITALIC LETTER KE;Lo;0;L;;;;;N;;;;; +10303;OLD ITALIC LETTER DE;Lo;0;L;;;;;N;;;;; +10304;OLD ITALIC LETTER E;Lo;0;L;;;;;N;;;;; +10305;OLD ITALIC LETTER VE;Lo;0;L;;;;;N;;;;; +10306;OLD ITALIC LETTER ZE;Lo;0;L;;;;;N;;;;; +10307;OLD ITALIC LETTER HE;Lo;0;L;;;;;N;;;;; +10308;OLD ITALIC LETTER THE;Lo;0;L;;;;;N;;;;; +10309;OLD ITALIC LETTER I;Lo;0;L;;;;;N;;;;; +1030A;OLD ITALIC LETTER KA;Lo;0;L;;;;;N;;;;; +1030B;OLD ITALIC LETTER EL;Lo;0;L;;;;;N;;;;; +1030C;OLD ITALIC LETTER EM;Lo;0;L;;;;;N;;;;; +1030D;OLD ITALIC LETTER EN;Lo;0;L;;;;;N;;;;; +1030E;OLD ITALIC LETTER ESH;Lo;0;L;;;;;N;;;;; +1030F;OLD ITALIC LETTER O;Lo;0;L;;;;;N;;;;; +10310;OLD ITALIC LETTER PE;Lo;0;L;;;;;N;;;;; +10311;OLD ITALIC LETTER SHE;Lo;0;L;;;;;N;;;;; +10312;OLD ITALIC LETTER KU;Lo;0;L;;;;;N;;;;; +10313;OLD ITALIC LETTER ER;Lo;0;L;;;;;N;;;;; +10314;OLD ITALIC LETTER ES;Lo;0;L;;;;;N;;;;; +10315;OLD ITALIC LETTER TE;Lo;0;L;;;;;N;;;;; +10316;OLD ITALIC LETTER U;Lo;0;L;;;;;N;;;;; +10317;OLD ITALIC LETTER EKS;Lo;0;L;;;;;N;;;;; +10318;OLD ITALIC LETTER PHE;Lo;0;L;;;;;N;;;;; +10319;OLD ITALIC LETTER KHE;Lo;0;L;;;;;N;;;;; +1031A;OLD ITALIC LETTER EF;Lo;0;L;;;;;N;;;;; +1031B;OLD ITALIC LETTER ERS;Lo;0;L;;;;;N;;;;; +1031C;OLD ITALIC LETTER CHE;Lo;0;L;;;;;N;;;;; +1031D;OLD ITALIC LETTER II;Lo;0;L;;;;;N;;;;; +1031E;OLD ITALIC LETTER UU;Lo;0;L;;;;;N;;;;; +1031F;OLD ITALIC LETTER ESS;Lo;0;L;;;;;N;;;;; +10320;OLD ITALIC NUMERAL ONE;No;0;L;;;;1;N;;;;; +10321;OLD ITALIC NUMERAL FIVE;No;0;L;;;;5;N;;;;; +10322;OLD ITALIC NUMERAL TEN;No;0;L;;;;10;N;;;;; +10323;OLD ITALIC NUMERAL FIFTY;No;0;L;;;;50;N;;;;; +1032D;OLD ITALIC LETTER YE;Lo;0;L;;;;;N;;;;; +1032E;OLD ITALIC LETTER NORTHERN TSE;Lo;0;L;;;;;N;;;;; +1032F;OLD ITALIC LETTER SOUTHERN TSE;Lo;0;L;;;;;N;;;;; +10330;GOTHIC LETTER AHSA;Lo;0;L;;;;;N;;;;; +10331;GOTHIC LETTER BAIRKAN;Lo;0;L;;;;;N;;;;; +10332;GOTHIC LETTER GIBA;Lo;0;L;;;;;N;;;;; +10333;GOTHIC LETTER DAGS;Lo;0;L;;;;;N;;;;; +10334;GOTHIC LETTER AIHVUS;Lo;0;L;;;;;N;;;;; +10335;GOTHIC LETTER QAIRTHRA;Lo;0;L;;;;;N;;;;; +10336;GOTHIC LETTER IUJA;Lo;0;L;;;;;N;;;;; +10337;GOTHIC LETTER HAGL;Lo;0;L;;;;;N;;;;; +10338;GOTHIC LETTER THIUTH;Lo;0;L;;;;;N;;;;; +10339;GOTHIC LETTER EIS;Lo;0;L;;;;;N;;;;; +1033A;GOTHIC LETTER KUSMA;Lo;0;L;;;;;N;;;;; +1033B;GOTHIC LETTER LAGUS;Lo;0;L;;;;;N;;;;; +1033C;GOTHIC LETTER MANNA;Lo;0;L;;;;;N;;;;; +1033D;GOTHIC LETTER NAUTHS;Lo;0;L;;;;;N;;;;; +1033E;GOTHIC LETTER JER;Lo;0;L;;;;;N;;;;; +1033F;GOTHIC LETTER URUS;Lo;0;L;;;;;N;;;;; +10340;GOTHIC LETTER PAIRTHRA;Lo;0;L;;;;;N;;;;; +10341;GOTHIC LETTER NINETY;Nl;0;L;;;;90;N;;;;; +10342;GOTHIC LETTER RAIDA;Lo;0;L;;;;;N;;;;; +10343;GOTHIC LETTER SAUIL;Lo;0;L;;;;;N;;;;; +10344;GOTHIC LETTER TEIWS;Lo;0;L;;;;;N;;;;; +10345;GOTHIC LETTER WINJA;Lo;0;L;;;;;N;;;;; +10346;GOTHIC LETTER FAIHU;Lo;0;L;;;;;N;;;;; +10347;GOTHIC LETTER IGGWS;Lo;0;L;;;;;N;;;;; +10348;GOTHIC LETTER HWAIR;Lo;0;L;;;;;N;;;;; +10349;GOTHIC LETTER OTHAL;Lo;0;L;;;;;N;;;;; +1034A;GOTHIC LETTER NINE HUNDRED;Nl;0;L;;;;900;N;;;;; +10350;OLD PERMIC LETTER AN;Lo;0;L;;;;;N;;;;; +10351;OLD PERMIC LETTER BUR;Lo;0;L;;;;;N;;;;; +10352;OLD PERMIC LETTER GAI;Lo;0;L;;;;;N;;;;; +10353;OLD PERMIC LETTER DOI;Lo;0;L;;;;;N;;;;; +10354;OLD PERMIC LETTER E;Lo;0;L;;;;;N;;;;; +10355;OLD PERMIC LETTER ZHOI;Lo;0;L;;;;;N;;;;; +10356;OLD PERMIC LETTER DZHOI;Lo;0;L;;;;;N;;;;; +10357;OLD PERMIC LETTER ZATA;Lo;0;L;;;;;N;;;;; +10358;OLD PERMIC LETTER DZITA;Lo;0;L;;;;;N;;;;; +10359;OLD PERMIC LETTER I;Lo;0;L;;;;;N;;;;; +1035A;OLD PERMIC LETTER KOKE;Lo;0;L;;;;;N;;;;; +1035B;OLD PERMIC LETTER LEI;Lo;0;L;;;;;N;;;;; +1035C;OLD PERMIC LETTER MENOE;Lo;0;L;;;;;N;;;;; +1035D;OLD PERMIC LETTER NENOE;Lo;0;L;;;;;N;;;;; +1035E;OLD PERMIC LETTER VOOI;Lo;0;L;;;;;N;;;;; +1035F;OLD PERMIC LETTER PEEI;Lo;0;L;;;;;N;;;;; +10360;OLD PERMIC LETTER REI;Lo;0;L;;;;;N;;;;; +10361;OLD PERMIC LETTER SII;Lo;0;L;;;;;N;;;;; +10362;OLD PERMIC LETTER TAI;Lo;0;L;;;;;N;;;;; +10363;OLD PERMIC LETTER U;Lo;0;L;;;;;N;;;;; +10364;OLD PERMIC LETTER CHERY;Lo;0;L;;;;;N;;;;; +10365;OLD PERMIC LETTER SHOOI;Lo;0;L;;;;;N;;;;; +10366;OLD PERMIC LETTER SHCHOOI;Lo;0;L;;;;;N;;;;; +10367;OLD PERMIC LETTER YRY;Lo;0;L;;;;;N;;;;; +10368;OLD PERMIC LETTER YERU;Lo;0;L;;;;;N;;;;; +10369;OLD PERMIC LETTER O;Lo;0;L;;;;;N;;;;; +1036A;OLD PERMIC LETTER OO;Lo;0;L;;;;;N;;;;; +1036B;OLD PERMIC LETTER EF;Lo;0;L;;;;;N;;;;; +1036C;OLD PERMIC LETTER HA;Lo;0;L;;;;;N;;;;; +1036D;OLD PERMIC LETTER TSIU;Lo;0;L;;;;;N;;;;; +1036E;OLD PERMIC LETTER VER;Lo;0;L;;;;;N;;;;; +1036F;OLD PERMIC LETTER YER;Lo;0;L;;;;;N;;;;; +10370;OLD PERMIC LETTER YERI;Lo;0;L;;;;;N;;;;; +10371;OLD PERMIC LETTER YAT;Lo;0;L;;;;;N;;;;; +10372;OLD PERMIC LETTER IE;Lo;0;L;;;;;N;;;;; +10373;OLD PERMIC LETTER YU;Lo;0;L;;;;;N;;;;; +10374;OLD PERMIC LETTER YA;Lo;0;L;;;;;N;;;;; +10375;OLD PERMIC LETTER IA;Lo;0;L;;;;;N;;;;; +10376;COMBINING OLD PERMIC LETTER AN;Mn;230;NSM;;;;;N;;;;; +10377;COMBINING OLD PERMIC LETTER DOI;Mn;230;NSM;;;;;N;;;;; +10378;COMBINING OLD PERMIC LETTER ZATA;Mn;230;NSM;;;;;N;;;;; +10379;COMBINING OLD PERMIC LETTER NENOE;Mn;230;NSM;;;;;N;;;;; +1037A;COMBINING OLD PERMIC LETTER SII;Mn;230;NSM;;;;;N;;;;; +10380;UGARITIC LETTER ALPA;Lo;0;L;;;;;N;;;;; +10381;UGARITIC LETTER BETA;Lo;0;L;;;;;N;;;;; +10382;UGARITIC LETTER GAMLA;Lo;0;L;;;;;N;;;;; +10383;UGARITIC LETTER KHA;Lo;0;L;;;;;N;;;;; +10384;UGARITIC LETTER DELTA;Lo;0;L;;;;;N;;;;; +10385;UGARITIC LETTER HO;Lo;0;L;;;;;N;;;;; +10386;UGARITIC LETTER WO;Lo;0;L;;;;;N;;;;; +10387;UGARITIC LETTER ZETA;Lo;0;L;;;;;N;;;;; +10388;UGARITIC LETTER HOTA;Lo;0;L;;;;;N;;;;; +10389;UGARITIC LETTER TET;Lo;0;L;;;;;N;;;;; +1038A;UGARITIC LETTER YOD;Lo;0;L;;;;;N;;;;; +1038B;UGARITIC LETTER KAF;Lo;0;L;;;;;N;;;;; +1038C;UGARITIC LETTER SHIN;Lo;0;L;;;;;N;;;;; +1038D;UGARITIC LETTER LAMDA;Lo;0;L;;;;;N;;;;; +1038E;UGARITIC LETTER MEM;Lo;0;L;;;;;N;;;;; +1038F;UGARITIC LETTER DHAL;Lo;0;L;;;;;N;;;;; +10390;UGARITIC LETTER NUN;Lo;0;L;;;;;N;;;;; +10391;UGARITIC LETTER ZU;Lo;0;L;;;;;N;;;;; +10392;UGARITIC LETTER SAMKA;Lo;0;L;;;;;N;;;;; +10393;UGARITIC LETTER AIN;Lo;0;L;;;;;N;;;;; +10394;UGARITIC LETTER PU;Lo;0;L;;;;;N;;;;; +10395;UGARITIC LETTER SADE;Lo;0;L;;;;;N;;;;; +10396;UGARITIC LETTER QOPA;Lo;0;L;;;;;N;;;;; +10397;UGARITIC LETTER RASHA;Lo;0;L;;;;;N;;;;; +10398;UGARITIC LETTER THANNA;Lo;0;L;;;;;N;;;;; +10399;UGARITIC LETTER GHAIN;Lo;0;L;;;;;N;;;;; +1039A;UGARITIC LETTER TO;Lo;0;L;;;;;N;;;;; +1039B;UGARITIC LETTER I;Lo;0;L;;;;;N;;;;; +1039C;UGARITIC LETTER U;Lo;0;L;;;;;N;;;;; +1039D;UGARITIC LETTER SSU;Lo;0;L;;;;;N;;;;; +1039F;UGARITIC WORD DIVIDER;Po;0;L;;;;;N;;;;; +103A0;OLD PERSIAN SIGN A;Lo;0;L;;;;;N;;;;; +103A1;OLD PERSIAN SIGN I;Lo;0;L;;;;;N;;;;; +103A2;OLD PERSIAN SIGN U;Lo;0;L;;;;;N;;;;; +103A3;OLD PERSIAN SIGN KA;Lo;0;L;;;;;N;;;;; +103A4;OLD PERSIAN SIGN KU;Lo;0;L;;;;;N;;;;; +103A5;OLD PERSIAN SIGN GA;Lo;0;L;;;;;N;;;;; +103A6;OLD PERSIAN SIGN GU;Lo;0;L;;;;;N;;;;; +103A7;OLD PERSIAN SIGN XA;Lo;0;L;;;;;N;;;;; +103A8;OLD PERSIAN SIGN CA;Lo;0;L;;;;;N;;;;; +103A9;OLD PERSIAN SIGN JA;Lo;0;L;;;;;N;;;;; +103AA;OLD PERSIAN SIGN JI;Lo;0;L;;;;;N;;;;; +103AB;OLD PERSIAN SIGN TA;Lo;0;L;;;;;N;;;;; +103AC;OLD PERSIAN SIGN TU;Lo;0;L;;;;;N;;;;; +103AD;OLD PERSIAN SIGN DA;Lo;0;L;;;;;N;;;;; +103AE;OLD PERSIAN SIGN DI;Lo;0;L;;;;;N;;;;; +103AF;OLD PERSIAN SIGN DU;Lo;0;L;;;;;N;;;;; +103B0;OLD PERSIAN SIGN THA;Lo;0;L;;;;;N;;;;; +103B1;OLD PERSIAN SIGN PA;Lo;0;L;;;;;N;;;;; +103B2;OLD PERSIAN SIGN BA;Lo;0;L;;;;;N;;;;; +103B3;OLD PERSIAN SIGN FA;Lo;0;L;;;;;N;;;;; +103B4;OLD PERSIAN SIGN NA;Lo;0;L;;;;;N;;;;; +103B5;OLD PERSIAN SIGN NU;Lo;0;L;;;;;N;;;;; +103B6;OLD PERSIAN SIGN MA;Lo;0;L;;;;;N;;;;; +103B7;OLD PERSIAN SIGN MI;Lo;0;L;;;;;N;;;;; +103B8;OLD PERSIAN SIGN MU;Lo;0;L;;;;;N;;;;; +103B9;OLD PERSIAN SIGN YA;Lo;0;L;;;;;N;;;;; +103BA;OLD PERSIAN SIGN VA;Lo;0;L;;;;;N;;;;; +103BB;OLD PERSIAN SIGN VI;Lo;0;L;;;;;N;;;;; +103BC;OLD PERSIAN SIGN RA;Lo;0;L;;;;;N;;;;; +103BD;OLD PERSIAN SIGN RU;Lo;0;L;;;;;N;;;;; +103BE;OLD PERSIAN SIGN LA;Lo;0;L;;;;;N;;;;; +103BF;OLD PERSIAN SIGN SA;Lo;0;L;;;;;N;;;;; +103C0;OLD PERSIAN SIGN ZA;Lo;0;L;;;;;N;;;;; +103C1;OLD PERSIAN SIGN SHA;Lo;0;L;;;;;N;;;;; +103C2;OLD PERSIAN SIGN SSA;Lo;0;L;;;;;N;;;;; +103C3;OLD PERSIAN SIGN HA;Lo;0;L;;;;;N;;;;; +103C8;OLD PERSIAN SIGN AURAMAZDAA;Lo;0;L;;;;;N;;;;; +103C9;OLD PERSIAN SIGN AURAMAZDAA-2;Lo;0;L;;;;;N;;;;; +103CA;OLD PERSIAN SIGN AURAMAZDAAHA;Lo;0;L;;;;;N;;;;; +103CB;OLD PERSIAN SIGN XSHAAYATHIYA;Lo;0;L;;;;;N;;;;; +103CC;OLD PERSIAN SIGN DAHYAAUSH;Lo;0;L;;;;;N;;;;; +103CD;OLD PERSIAN SIGN DAHYAAUSH-2;Lo;0;L;;;;;N;;;;; +103CE;OLD PERSIAN SIGN BAGA;Lo;0;L;;;;;N;;;;; +103CF;OLD PERSIAN SIGN BUUMISH;Lo;0;L;;;;;N;;;;; +103D0;OLD PERSIAN WORD DIVIDER;Po;0;L;;;;;N;;;;; +103D1;OLD PERSIAN NUMBER ONE;Nl;0;L;;;;1;N;;;;; +103D2;OLD PERSIAN NUMBER TWO;Nl;0;L;;;;2;N;;;;; +103D3;OLD PERSIAN NUMBER TEN;Nl;0;L;;;;10;N;;;;; +103D4;OLD PERSIAN NUMBER TWENTY;Nl;0;L;;;;20;N;;;;; +103D5;OLD PERSIAN NUMBER HUNDRED;Nl;0;L;;;;100;N;;;;; +10400;DESERET CAPITAL LETTER LONG I;Lu;0;L;;;;;N;;;;10428; +10401;DESERET CAPITAL LETTER LONG E;Lu;0;L;;;;;N;;;;10429; +10402;DESERET CAPITAL LETTER LONG A;Lu;0;L;;;;;N;;;;1042A; +10403;DESERET CAPITAL LETTER LONG AH;Lu;0;L;;;;;N;;;;1042B; +10404;DESERET CAPITAL LETTER LONG O;Lu;0;L;;;;;N;;;;1042C; +10405;DESERET CAPITAL LETTER LONG OO;Lu;0;L;;;;;N;;;;1042D; +10406;DESERET CAPITAL LETTER SHORT I;Lu;0;L;;;;;N;;;;1042E; +10407;DESERET CAPITAL LETTER SHORT E;Lu;0;L;;;;;N;;;;1042F; +10408;DESERET CAPITAL LETTER SHORT A;Lu;0;L;;;;;N;;;;10430; +10409;DESERET CAPITAL LETTER SHORT AH;Lu;0;L;;;;;N;;;;10431; +1040A;DESERET CAPITAL LETTER SHORT O;Lu;0;L;;;;;N;;;;10432; +1040B;DESERET CAPITAL LETTER SHORT OO;Lu;0;L;;;;;N;;;;10433; +1040C;DESERET CAPITAL LETTER AY;Lu;0;L;;;;;N;;;;10434; +1040D;DESERET CAPITAL LETTER OW;Lu;0;L;;;;;N;;;;10435; +1040E;DESERET CAPITAL LETTER WU;Lu;0;L;;;;;N;;;;10436; +1040F;DESERET CAPITAL LETTER YEE;Lu;0;L;;;;;N;;;;10437; +10410;DESERET CAPITAL LETTER H;Lu;0;L;;;;;N;;;;10438; +10411;DESERET CAPITAL LETTER PEE;Lu;0;L;;;;;N;;;;10439; +10412;DESERET CAPITAL LETTER BEE;Lu;0;L;;;;;N;;;;1043A; +10413;DESERET CAPITAL LETTER TEE;Lu;0;L;;;;;N;;;;1043B; +10414;DESERET CAPITAL LETTER DEE;Lu;0;L;;;;;N;;;;1043C; +10415;DESERET CAPITAL LETTER CHEE;Lu;0;L;;;;;N;;;;1043D; +10416;DESERET CAPITAL LETTER JEE;Lu;0;L;;;;;N;;;;1043E; +10417;DESERET CAPITAL LETTER KAY;Lu;0;L;;;;;N;;;;1043F; +10418;DESERET CAPITAL LETTER GAY;Lu;0;L;;;;;N;;;;10440; +10419;DESERET CAPITAL LETTER EF;Lu;0;L;;;;;N;;;;10441; +1041A;DESERET CAPITAL LETTER VEE;Lu;0;L;;;;;N;;;;10442; +1041B;DESERET CAPITAL LETTER ETH;Lu;0;L;;;;;N;;;;10443; +1041C;DESERET CAPITAL LETTER THEE;Lu;0;L;;;;;N;;;;10444; +1041D;DESERET CAPITAL LETTER ES;Lu;0;L;;;;;N;;;;10445; +1041E;DESERET CAPITAL LETTER ZEE;Lu;0;L;;;;;N;;;;10446; +1041F;DESERET CAPITAL LETTER ESH;Lu;0;L;;;;;N;;;;10447; +10420;DESERET CAPITAL LETTER ZHEE;Lu;0;L;;;;;N;;;;10448; +10421;DESERET CAPITAL LETTER ER;Lu;0;L;;;;;N;;;;10449; +10422;DESERET CAPITAL LETTER EL;Lu;0;L;;;;;N;;;;1044A; +10423;DESERET CAPITAL LETTER EM;Lu;0;L;;;;;N;;;;1044B; +10424;DESERET CAPITAL LETTER EN;Lu;0;L;;;;;N;;;;1044C; +10425;DESERET CAPITAL LETTER ENG;Lu;0;L;;;;;N;;;;1044D; +10426;DESERET CAPITAL LETTER OI;Lu;0;L;;;;;N;;;;1044E; +10427;DESERET CAPITAL LETTER EW;Lu;0;L;;;;;N;;;;1044F; +10428;DESERET SMALL LETTER LONG I;Ll;0;L;;;;;N;;;10400;;10400 +10429;DESERET SMALL LETTER LONG E;Ll;0;L;;;;;N;;;10401;;10401 +1042A;DESERET SMALL LETTER LONG A;Ll;0;L;;;;;N;;;10402;;10402 +1042B;DESERET SMALL LETTER LONG AH;Ll;0;L;;;;;N;;;10403;;10403 +1042C;DESERET SMALL LETTER LONG O;Ll;0;L;;;;;N;;;10404;;10404 +1042D;DESERET SMALL LETTER LONG OO;Ll;0;L;;;;;N;;;10405;;10405 +1042E;DESERET SMALL LETTER SHORT I;Ll;0;L;;;;;N;;;10406;;10406 +1042F;DESERET SMALL LETTER SHORT E;Ll;0;L;;;;;N;;;10407;;10407 +10430;DESERET SMALL LETTER SHORT A;Ll;0;L;;;;;N;;;10408;;10408 +10431;DESERET SMALL LETTER SHORT AH;Ll;0;L;;;;;N;;;10409;;10409 +10432;DESERET SMALL LETTER SHORT O;Ll;0;L;;;;;N;;;1040A;;1040A +10433;DESERET SMALL LETTER SHORT OO;Ll;0;L;;;;;N;;;1040B;;1040B +10434;DESERET SMALL LETTER AY;Ll;0;L;;;;;N;;;1040C;;1040C +10435;DESERET SMALL LETTER OW;Ll;0;L;;;;;N;;;1040D;;1040D +10436;DESERET SMALL LETTER WU;Ll;0;L;;;;;N;;;1040E;;1040E +10437;DESERET SMALL LETTER YEE;Ll;0;L;;;;;N;;;1040F;;1040F +10438;DESERET SMALL LETTER H;Ll;0;L;;;;;N;;;10410;;10410 +10439;DESERET SMALL LETTER PEE;Ll;0;L;;;;;N;;;10411;;10411 +1043A;DESERET SMALL LETTER BEE;Ll;0;L;;;;;N;;;10412;;10412 +1043B;DESERET SMALL LETTER TEE;Ll;0;L;;;;;N;;;10413;;10413 +1043C;DESERET SMALL LETTER DEE;Ll;0;L;;;;;N;;;10414;;10414 +1043D;DESERET SMALL LETTER CHEE;Ll;0;L;;;;;N;;;10415;;10415 +1043E;DESERET SMALL LETTER JEE;Ll;0;L;;;;;N;;;10416;;10416 +1043F;DESERET SMALL LETTER KAY;Ll;0;L;;;;;N;;;10417;;10417 +10440;DESERET SMALL LETTER GAY;Ll;0;L;;;;;N;;;10418;;10418 +10441;DESERET SMALL LETTER EF;Ll;0;L;;;;;N;;;10419;;10419 +10442;DESERET SMALL LETTER VEE;Ll;0;L;;;;;N;;;1041A;;1041A +10443;DESERET SMALL LETTER ETH;Ll;0;L;;;;;N;;;1041B;;1041B +10444;DESERET SMALL LETTER THEE;Ll;0;L;;;;;N;;;1041C;;1041C +10445;DESERET SMALL LETTER ES;Ll;0;L;;;;;N;;;1041D;;1041D +10446;DESERET SMALL LETTER ZEE;Ll;0;L;;;;;N;;;1041E;;1041E +10447;DESERET SMALL LETTER ESH;Ll;0;L;;;;;N;;;1041F;;1041F +10448;DESERET SMALL LETTER ZHEE;Ll;0;L;;;;;N;;;10420;;10420 +10449;DESERET SMALL LETTER ER;Ll;0;L;;;;;N;;;10421;;10421 +1044A;DESERET SMALL LETTER EL;Ll;0;L;;;;;N;;;10422;;10422 +1044B;DESERET SMALL LETTER EM;Ll;0;L;;;;;N;;;10423;;10423 +1044C;DESERET SMALL LETTER EN;Ll;0;L;;;;;N;;;10424;;10424 +1044D;DESERET SMALL LETTER ENG;Ll;0;L;;;;;N;;;10425;;10425 +1044E;DESERET SMALL LETTER OI;Ll;0;L;;;;;N;;;10426;;10426 +1044F;DESERET SMALL LETTER EW;Ll;0;L;;;;;N;;;10427;;10427 +10450;SHAVIAN LETTER PEEP;Lo;0;L;;;;;N;;;;; +10451;SHAVIAN LETTER TOT;Lo;0;L;;;;;N;;;;; +10452;SHAVIAN LETTER KICK;Lo;0;L;;;;;N;;;;; +10453;SHAVIAN LETTER FEE;Lo;0;L;;;;;N;;;;; +10454;SHAVIAN LETTER THIGH;Lo;0;L;;;;;N;;;;; +10455;SHAVIAN LETTER SO;Lo;0;L;;;;;N;;;;; +10456;SHAVIAN LETTER SURE;Lo;0;L;;;;;N;;;;; +10457;SHAVIAN LETTER CHURCH;Lo;0;L;;;;;N;;;;; +10458;SHAVIAN LETTER YEA;Lo;0;L;;;;;N;;;;; +10459;SHAVIAN LETTER HUNG;Lo;0;L;;;;;N;;;;; +1045A;SHAVIAN LETTER BIB;Lo;0;L;;;;;N;;;;; +1045B;SHAVIAN LETTER DEAD;Lo;0;L;;;;;N;;;;; +1045C;SHAVIAN LETTER GAG;Lo;0;L;;;;;N;;;;; +1045D;SHAVIAN LETTER VOW;Lo;0;L;;;;;N;;;;; +1045E;SHAVIAN LETTER THEY;Lo;0;L;;;;;N;;;;; +1045F;SHAVIAN LETTER ZOO;Lo;0;L;;;;;N;;;;; +10460;SHAVIAN LETTER MEASURE;Lo;0;L;;;;;N;;;;; +10461;SHAVIAN LETTER JUDGE;Lo;0;L;;;;;N;;;;; +10462;SHAVIAN LETTER WOE;Lo;0;L;;;;;N;;;;; +10463;SHAVIAN LETTER HA-HA;Lo;0;L;;;;;N;;;;; +10464;SHAVIAN LETTER LOLL;Lo;0;L;;;;;N;;;;; +10465;SHAVIAN LETTER MIME;Lo;0;L;;;;;N;;;;; +10466;SHAVIAN LETTER IF;Lo;0;L;;;;;N;;;;; +10467;SHAVIAN LETTER EGG;Lo;0;L;;;;;N;;;;; +10468;SHAVIAN LETTER ASH;Lo;0;L;;;;;N;;;;; +10469;SHAVIAN LETTER ADO;Lo;0;L;;;;;N;;;;; +1046A;SHAVIAN LETTER ON;Lo;0;L;;;;;N;;;;; +1046B;SHAVIAN LETTER WOOL;Lo;0;L;;;;;N;;;;; +1046C;SHAVIAN LETTER OUT;Lo;0;L;;;;;N;;;;; +1046D;SHAVIAN LETTER AH;Lo;0;L;;;;;N;;;;; +1046E;SHAVIAN LETTER ROAR;Lo;0;L;;;;;N;;;;; +1046F;SHAVIAN LETTER NUN;Lo;0;L;;;;;N;;;;; +10470;SHAVIAN LETTER EAT;Lo;0;L;;;;;N;;;;; +10471;SHAVIAN LETTER AGE;Lo;0;L;;;;;N;;;;; +10472;SHAVIAN LETTER ICE;Lo;0;L;;;;;N;;;;; +10473;SHAVIAN LETTER UP;Lo;0;L;;;;;N;;;;; +10474;SHAVIAN LETTER OAK;Lo;0;L;;;;;N;;;;; +10475;SHAVIAN LETTER OOZE;Lo;0;L;;;;;N;;;;; +10476;SHAVIAN LETTER OIL;Lo;0;L;;;;;N;;;;; +10477;SHAVIAN LETTER AWE;Lo;0;L;;;;;N;;;;; +10478;SHAVIAN LETTER ARE;Lo;0;L;;;;;N;;;;; +10479;SHAVIAN LETTER OR;Lo;0;L;;;;;N;;;;; +1047A;SHAVIAN LETTER AIR;Lo;0;L;;;;;N;;;;; +1047B;SHAVIAN LETTER ERR;Lo;0;L;;;;;N;;;;; +1047C;SHAVIAN LETTER ARRAY;Lo;0;L;;;;;N;;;;; +1047D;SHAVIAN LETTER EAR;Lo;0;L;;;;;N;;;;; +1047E;SHAVIAN LETTER IAN;Lo;0;L;;;;;N;;;;; +1047F;SHAVIAN LETTER YEW;Lo;0;L;;;;;N;;;;; +10480;OSMANYA LETTER ALEF;Lo;0;L;;;;;N;;;;; +10481;OSMANYA LETTER BA;Lo;0;L;;;;;N;;;;; +10482;OSMANYA LETTER TA;Lo;0;L;;;;;N;;;;; +10483;OSMANYA LETTER JA;Lo;0;L;;;;;N;;;;; +10484;OSMANYA LETTER XA;Lo;0;L;;;;;N;;;;; +10485;OSMANYA LETTER KHA;Lo;0;L;;;;;N;;;;; +10486;OSMANYA LETTER DEEL;Lo;0;L;;;;;N;;;;; +10487;OSMANYA LETTER RA;Lo;0;L;;;;;N;;;;; +10488;OSMANYA LETTER SA;Lo;0;L;;;;;N;;;;; +10489;OSMANYA LETTER SHIIN;Lo;0;L;;;;;N;;;;; +1048A;OSMANYA LETTER DHA;Lo;0;L;;;;;N;;;;; +1048B;OSMANYA LETTER CAYN;Lo;0;L;;;;;N;;;;; +1048C;OSMANYA LETTER GA;Lo;0;L;;;;;N;;;;; +1048D;OSMANYA LETTER FA;Lo;0;L;;;;;N;;;;; +1048E;OSMANYA LETTER QAAF;Lo;0;L;;;;;N;;;;; +1048F;OSMANYA LETTER KAAF;Lo;0;L;;;;;N;;;;; +10490;OSMANYA LETTER LAAN;Lo;0;L;;;;;N;;;;; +10491;OSMANYA LETTER MIIN;Lo;0;L;;;;;N;;;;; +10492;OSMANYA LETTER NUUN;Lo;0;L;;;;;N;;;;; +10493;OSMANYA LETTER WAW;Lo;0;L;;;;;N;;;;; +10494;OSMANYA LETTER HA;Lo;0;L;;;;;N;;;;; +10495;OSMANYA LETTER YA;Lo;0;L;;;;;N;;;;; +10496;OSMANYA LETTER A;Lo;0;L;;;;;N;;;;; +10497;OSMANYA LETTER E;Lo;0;L;;;;;N;;;;; +10498;OSMANYA LETTER I;Lo;0;L;;;;;N;;;;; +10499;OSMANYA LETTER O;Lo;0;L;;;;;N;;;;; +1049A;OSMANYA LETTER U;Lo;0;L;;;;;N;;;;; +1049B;OSMANYA LETTER AA;Lo;0;L;;;;;N;;;;; +1049C;OSMANYA LETTER EE;Lo;0;L;;;;;N;;;;; +1049D;OSMANYA LETTER OO;Lo;0;L;;;;;N;;;;; +104A0;OSMANYA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +104A1;OSMANYA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +104A2;OSMANYA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +104A3;OSMANYA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +104A4;OSMANYA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +104A5;OSMANYA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +104A6;OSMANYA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +104A7;OSMANYA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +104A8;OSMANYA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +104A9;OSMANYA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +104B0;OSAGE CAPITAL LETTER A;Lu;0;L;;;;;N;;;;104D8; +104B1;OSAGE CAPITAL LETTER AI;Lu;0;L;;;;;N;;;;104D9; +104B2;OSAGE CAPITAL LETTER AIN;Lu;0;L;;;;;N;;;;104DA; +104B3;OSAGE CAPITAL LETTER AH;Lu;0;L;;;;;N;;;;104DB; +104B4;OSAGE CAPITAL LETTER BRA;Lu;0;L;;;;;N;;;;104DC; +104B5;OSAGE CAPITAL LETTER CHA;Lu;0;L;;;;;N;;;;104DD; +104B6;OSAGE CAPITAL LETTER EHCHA;Lu;0;L;;;;;N;;;;104DE; +104B7;OSAGE CAPITAL LETTER E;Lu;0;L;;;;;N;;;;104DF; +104B8;OSAGE CAPITAL LETTER EIN;Lu;0;L;;;;;N;;;;104E0; +104B9;OSAGE CAPITAL LETTER HA;Lu;0;L;;;;;N;;;;104E1; +104BA;OSAGE CAPITAL LETTER HYA;Lu;0;L;;;;;N;;;;104E2; +104BB;OSAGE CAPITAL LETTER I;Lu;0;L;;;;;N;;;;104E3; +104BC;OSAGE CAPITAL LETTER KA;Lu;0;L;;;;;N;;;;104E4; +104BD;OSAGE CAPITAL LETTER EHKA;Lu;0;L;;;;;N;;;;104E5; +104BE;OSAGE CAPITAL LETTER KYA;Lu;0;L;;;;;N;;;;104E6; +104BF;OSAGE CAPITAL LETTER LA;Lu;0;L;;;;;N;;;;104E7; +104C0;OSAGE CAPITAL LETTER MA;Lu;0;L;;;;;N;;;;104E8; +104C1;OSAGE CAPITAL LETTER NA;Lu;0;L;;;;;N;;;;104E9; +104C2;OSAGE CAPITAL LETTER O;Lu;0;L;;;;;N;;;;104EA; +104C3;OSAGE CAPITAL LETTER OIN;Lu;0;L;;;;;N;;;;104EB; +104C4;OSAGE CAPITAL LETTER PA;Lu;0;L;;;;;N;;;;104EC; +104C5;OSAGE CAPITAL LETTER EHPA;Lu;0;L;;;;;N;;;;104ED; +104C6;OSAGE CAPITAL LETTER SA;Lu;0;L;;;;;N;;;;104EE; +104C7;OSAGE CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;104EF; +104C8;OSAGE CAPITAL LETTER TA;Lu;0;L;;;;;N;;;;104F0; +104C9;OSAGE CAPITAL LETTER EHTA;Lu;0;L;;;;;N;;;;104F1; +104CA;OSAGE CAPITAL LETTER TSA;Lu;0;L;;;;;N;;;;104F2; +104CB;OSAGE CAPITAL LETTER EHTSA;Lu;0;L;;;;;N;;;;104F3; +104CC;OSAGE CAPITAL LETTER TSHA;Lu;0;L;;;;;N;;;;104F4; +104CD;OSAGE CAPITAL LETTER DHA;Lu;0;L;;;;;N;;;;104F5; +104CE;OSAGE CAPITAL LETTER U;Lu;0;L;;;;;N;;;;104F6; +104CF;OSAGE CAPITAL LETTER WA;Lu;0;L;;;;;N;;;;104F7; +104D0;OSAGE CAPITAL LETTER KHA;Lu;0;L;;;;;N;;;;104F8; +104D1;OSAGE CAPITAL LETTER GHA;Lu;0;L;;;;;N;;;;104F9; +104D2;OSAGE CAPITAL LETTER ZA;Lu;0;L;;;;;N;;;;104FA; +104D3;OSAGE CAPITAL LETTER ZHA;Lu;0;L;;;;;N;;;;104FB; +104D8;OSAGE SMALL LETTER A;Ll;0;L;;;;;N;;;104B0;;104B0 +104D9;OSAGE SMALL LETTER AI;Ll;0;L;;;;;N;;;104B1;;104B1 +104DA;OSAGE SMALL LETTER AIN;Ll;0;L;;;;;N;;;104B2;;104B2 +104DB;OSAGE SMALL LETTER AH;Ll;0;L;;;;;N;;;104B3;;104B3 +104DC;OSAGE SMALL LETTER BRA;Ll;0;L;;;;;N;;;104B4;;104B4 +104DD;OSAGE SMALL LETTER CHA;Ll;0;L;;;;;N;;;104B5;;104B5 +104DE;OSAGE SMALL LETTER EHCHA;Ll;0;L;;;;;N;;;104B6;;104B6 +104DF;OSAGE SMALL LETTER E;Ll;0;L;;;;;N;;;104B7;;104B7 +104E0;OSAGE SMALL LETTER EIN;Ll;0;L;;;;;N;;;104B8;;104B8 +104E1;OSAGE SMALL LETTER HA;Ll;0;L;;;;;N;;;104B9;;104B9 +104E2;OSAGE SMALL LETTER HYA;Ll;0;L;;;;;N;;;104BA;;104BA +104E3;OSAGE SMALL LETTER I;Ll;0;L;;;;;N;;;104BB;;104BB +104E4;OSAGE SMALL LETTER KA;Ll;0;L;;;;;N;;;104BC;;104BC +104E5;OSAGE SMALL LETTER EHKA;Ll;0;L;;;;;N;;;104BD;;104BD +104E6;OSAGE SMALL LETTER KYA;Ll;0;L;;;;;N;;;104BE;;104BE +104E7;OSAGE SMALL LETTER LA;Ll;0;L;;;;;N;;;104BF;;104BF +104E8;OSAGE SMALL LETTER MA;Ll;0;L;;;;;N;;;104C0;;104C0 +104E9;OSAGE SMALL LETTER NA;Ll;0;L;;;;;N;;;104C1;;104C1 +104EA;OSAGE SMALL LETTER O;Ll;0;L;;;;;N;;;104C2;;104C2 +104EB;OSAGE SMALL LETTER OIN;Ll;0;L;;;;;N;;;104C3;;104C3 +104EC;OSAGE SMALL LETTER PA;Ll;0;L;;;;;N;;;104C4;;104C4 +104ED;OSAGE SMALL LETTER EHPA;Ll;0;L;;;;;N;;;104C5;;104C5 +104EE;OSAGE SMALL LETTER SA;Ll;0;L;;;;;N;;;104C6;;104C6 +104EF;OSAGE SMALL LETTER SHA;Ll;0;L;;;;;N;;;104C7;;104C7 +104F0;OSAGE SMALL LETTER TA;Ll;0;L;;;;;N;;;104C8;;104C8 +104F1;OSAGE SMALL LETTER EHTA;Ll;0;L;;;;;N;;;104C9;;104C9 +104F2;OSAGE SMALL LETTER TSA;Ll;0;L;;;;;N;;;104CA;;104CA +104F3;OSAGE SMALL LETTER EHTSA;Ll;0;L;;;;;N;;;104CB;;104CB +104F4;OSAGE SMALL LETTER TSHA;Ll;0;L;;;;;N;;;104CC;;104CC +104F5;OSAGE SMALL LETTER DHA;Ll;0;L;;;;;N;;;104CD;;104CD +104F6;OSAGE SMALL LETTER U;Ll;0;L;;;;;N;;;104CE;;104CE +104F7;OSAGE SMALL LETTER WA;Ll;0;L;;;;;N;;;104CF;;104CF +104F8;OSAGE SMALL LETTER KHA;Ll;0;L;;;;;N;;;104D0;;104D0 +104F9;OSAGE SMALL LETTER GHA;Ll;0;L;;;;;N;;;104D1;;104D1 +104FA;OSAGE SMALL LETTER ZA;Ll;0;L;;;;;N;;;104D2;;104D2 +104FB;OSAGE SMALL LETTER ZHA;Ll;0;L;;;;;N;;;104D3;;104D3 +10500;ELBASAN LETTER A;Lo;0;L;;;;;N;;;;; +10501;ELBASAN LETTER BE;Lo;0;L;;;;;N;;;;; +10502;ELBASAN LETTER CE;Lo;0;L;;;;;N;;;;; +10503;ELBASAN LETTER CHE;Lo;0;L;;;;;N;;;;; +10504;ELBASAN LETTER DE;Lo;0;L;;;;;N;;;;; +10505;ELBASAN LETTER NDE;Lo;0;L;;;;;N;;;;; +10506;ELBASAN LETTER DHE;Lo;0;L;;;;;N;;;;; +10507;ELBASAN LETTER EI;Lo;0;L;;;;;N;;;;; +10508;ELBASAN LETTER E;Lo;0;L;;;;;N;;;;; +10509;ELBASAN LETTER FE;Lo;0;L;;;;;N;;;;; +1050A;ELBASAN LETTER GE;Lo;0;L;;;;;N;;;;; +1050B;ELBASAN LETTER GJE;Lo;0;L;;;;;N;;;;; +1050C;ELBASAN LETTER HE;Lo;0;L;;;;;N;;;;; +1050D;ELBASAN LETTER I;Lo;0;L;;;;;N;;;;; +1050E;ELBASAN LETTER JE;Lo;0;L;;;;;N;;;;; +1050F;ELBASAN LETTER KE;Lo;0;L;;;;;N;;;;; +10510;ELBASAN LETTER LE;Lo;0;L;;;;;N;;;;; +10511;ELBASAN LETTER LLE;Lo;0;L;;;;;N;;;;; +10512;ELBASAN LETTER ME;Lo;0;L;;;;;N;;;;; +10513;ELBASAN LETTER NE;Lo;0;L;;;;;N;;;;; +10514;ELBASAN LETTER NA;Lo;0;L;;;;;N;;;;; +10515;ELBASAN LETTER NJE;Lo;0;L;;;;;N;;;;; +10516;ELBASAN LETTER O;Lo;0;L;;;;;N;;;;; +10517;ELBASAN LETTER PE;Lo;0;L;;;;;N;;;;; +10518;ELBASAN LETTER QE;Lo;0;L;;;;;N;;;;; +10519;ELBASAN LETTER RE;Lo;0;L;;;;;N;;;;; +1051A;ELBASAN LETTER RRE;Lo;0;L;;;;;N;;;;; +1051B;ELBASAN LETTER SE;Lo;0;L;;;;;N;;;;; +1051C;ELBASAN LETTER SHE;Lo;0;L;;;;;N;;;;; +1051D;ELBASAN LETTER TE;Lo;0;L;;;;;N;;;;; +1051E;ELBASAN LETTER THE;Lo;0;L;;;;;N;;;;; +1051F;ELBASAN LETTER U;Lo;0;L;;;;;N;;;;; +10520;ELBASAN LETTER VE;Lo;0;L;;;;;N;;;;; +10521;ELBASAN LETTER XE;Lo;0;L;;;;;N;;;;; +10522;ELBASAN LETTER Y;Lo;0;L;;;;;N;;;;; +10523;ELBASAN LETTER ZE;Lo;0;L;;;;;N;;;;; +10524;ELBASAN LETTER ZHE;Lo;0;L;;;;;N;;;;; +10525;ELBASAN LETTER GHE;Lo;0;L;;;;;N;;;;; +10526;ELBASAN LETTER GHAMMA;Lo;0;L;;;;;N;;;;; +10527;ELBASAN LETTER KHE;Lo;0;L;;;;;N;;;;; +10530;CAUCASIAN ALBANIAN LETTER ALT;Lo;0;L;;;;;N;;;;; +10531;CAUCASIAN ALBANIAN LETTER BET;Lo;0;L;;;;;N;;;;; +10532;CAUCASIAN ALBANIAN LETTER GIM;Lo;0;L;;;;;N;;;;; +10533;CAUCASIAN ALBANIAN LETTER DAT;Lo;0;L;;;;;N;;;;; +10534;CAUCASIAN ALBANIAN LETTER EB;Lo;0;L;;;;;N;;;;; +10535;CAUCASIAN ALBANIAN LETTER ZARL;Lo;0;L;;;;;N;;;;; +10536;CAUCASIAN ALBANIAN LETTER EYN;Lo;0;L;;;;;N;;;;; +10537;CAUCASIAN ALBANIAN LETTER ZHIL;Lo;0;L;;;;;N;;;;; +10538;CAUCASIAN ALBANIAN LETTER TAS;Lo;0;L;;;;;N;;;;; +10539;CAUCASIAN ALBANIAN LETTER CHA;Lo;0;L;;;;;N;;;;; +1053A;CAUCASIAN ALBANIAN LETTER YOWD;Lo;0;L;;;;;N;;;;; +1053B;CAUCASIAN ALBANIAN LETTER ZHA;Lo;0;L;;;;;N;;;;; +1053C;CAUCASIAN ALBANIAN LETTER IRB;Lo;0;L;;;;;N;;;;; +1053D;CAUCASIAN ALBANIAN LETTER SHA;Lo;0;L;;;;;N;;;;; +1053E;CAUCASIAN ALBANIAN LETTER LAN;Lo;0;L;;;;;N;;;;; +1053F;CAUCASIAN ALBANIAN LETTER INYA;Lo;0;L;;;;;N;;;;; +10540;CAUCASIAN ALBANIAN LETTER XEYN;Lo;0;L;;;;;N;;;;; +10541;CAUCASIAN ALBANIAN LETTER DYAN;Lo;0;L;;;;;N;;;;; +10542;CAUCASIAN ALBANIAN LETTER CAR;Lo;0;L;;;;;N;;;;; +10543;CAUCASIAN ALBANIAN LETTER JHOX;Lo;0;L;;;;;N;;;;; +10544;CAUCASIAN ALBANIAN LETTER KAR;Lo;0;L;;;;;N;;;;; +10545;CAUCASIAN ALBANIAN LETTER LYIT;Lo;0;L;;;;;N;;;;; +10546;CAUCASIAN ALBANIAN LETTER HEYT;Lo;0;L;;;;;N;;;;; +10547;CAUCASIAN ALBANIAN LETTER QAY;Lo;0;L;;;;;N;;;;; +10548;CAUCASIAN ALBANIAN LETTER AOR;Lo;0;L;;;;;N;;;;; +10549;CAUCASIAN ALBANIAN LETTER CHOY;Lo;0;L;;;;;N;;;;; +1054A;CAUCASIAN ALBANIAN LETTER CHI;Lo;0;L;;;;;N;;;;; +1054B;CAUCASIAN ALBANIAN LETTER CYAY;Lo;0;L;;;;;N;;;;; +1054C;CAUCASIAN ALBANIAN LETTER MAQ;Lo;0;L;;;;;N;;;;; +1054D;CAUCASIAN ALBANIAN LETTER QAR;Lo;0;L;;;;;N;;;;; +1054E;CAUCASIAN ALBANIAN LETTER NOWC;Lo;0;L;;;;;N;;;;; +1054F;CAUCASIAN ALBANIAN LETTER DZYAY;Lo;0;L;;;;;N;;;;; +10550;CAUCASIAN ALBANIAN LETTER SHAK;Lo;0;L;;;;;N;;;;; +10551;CAUCASIAN ALBANIAN LETTER JAYN;Lo;0;L;;;;;N;;;;; +10552;CAUCASIAN ALBANIAN LETTER ON;Lo;0;L;;;;;N;;;;; +10553;CAUCASIAN ALBANIAN LETTER TYAY;Lo;0;L;;;;;N;;;;; +10554;CAUCASIAN ALBANIAN LETTER FAM;Lo;0;L;;;;;N;;;;; +10555;CAUCASIAN ALBANIAN LETTER DZAY;Lo;0;L;;;;;N;;;;; +10556;CAUCASIAN ALBANIAN LETTER CHAT;Lo;0;L;;;;;N;;;;; +10557;CAUCASIAN ALBANIAN LETTER PEN;Lo;0;L;;;;;N;;;;; +10558;CAUCASIAN ALBANIAN LETTER GHEYS;Lo;0;L;;;;;N;;;;; +10559;CAUCASIAN ALBANIAN LETTER RAT;Lo;0;L;;;;;N;;;;; +1055A;CAUCASIAN ALBANIAN LETTER SEYK;Lo;0;L;;;;;N;;;;; +1055B;CAUCASIAN ALBANIAN LETTER VEYZ;Lo;0;L;;;;;N;;;;; +1055C;CAUCASIAN ALBANIAN LETTER TIWR;Lo;0;L;;;;;N;;;;; +1055D;CAUCASIAN ALBANIAN LETTER SHOY;Lo;0;L;;;;;N;;;;; +1055E;CAUCASIAN ALBANIAN LETTER IWN;Lo;0;L;;;;;N;;;;; +1055F;CAUCASIAN ALBANIAN LETTER CYAW;Lo;0;L;;;;;N;;;;; +10560;CAUCASIAN ALBANIAN LETTER CAYN;Lo;0;L;;;;;N;;;;; +10561;CAUCASIAN ALBANIAN LETTER YAYD;Lo;0;L;;;;;N;;;;; +10562;CAUCASIAN ALBANIAN LETTER PIWR;Lo;0;L;;;;;N;;;;; +10563;CAUCASIAN ALBANIAN LETTER KIW;Lo;0;L;;;;;N;;;;; +1056F;CAUCASIAN ALBANIAN CITATION MARK;Po;0;L;;;;;N;;;;; +10600;LINEAR A SIGN AB001;Lo;0;L;;;;;N;;;;; +10601;LINEAR A SIGN AB002;Lo;0;L;;;;;N;;;;; +10602;LINEAR A SIGN AB003;Lo;0;L;;;;;N;;;;; +10603;LINEAR A SIGN AB004;Lo;0;L;;;;;N;;;;; +10604;LINEAR A SIGN AB005;Lo;0;L;;;;;N;;;;; +10605;LINEAR A SIGN AB006;Lo;0;L;;;;;N;;;;; +10606;LINEAR A SIGN AB007;Lo;0;L;;;;;N;;;;; +10607;LINEAR A SIGN AB008;Lo;0;L;;;;;N;;;;; +10608;LINEAR A SIGN AB009;Lo;0;L;;;;;N;;;;; +10609;LINEAR A SIGN AB010;Lo;0;L;;;;;N;;;;; +1060A;LINEAR A SIGN AB011;Lo;0;L;;;;;N;;;;; +1060B;LINEAR A SIGN AB013;Lo;0;L;;;;;N;;;;; +1060C;LINEAR A SIGN AB016;Lo;0;L;;;;;N;;;;; +1060D;LINEAR A SIGN AB017;Lo;0;L;;;;;N;;;;; +1060E;LINEAR A SIGN AB020;Lo;0;L;;;;;N;;;;; +1060F;LINEAR A SIGN AB021;Lo;0;L;;;;;N;;;;; +10610;LINEAR A SIGN AB021F;Lo;0;L;;;;;N;;;;; +10611;LINEAR A SIGN AB021M;Lo;0;L;;;;;N;;;;; +10612;LINEAR A SIGN AB022;Lo;0;L;;;;;N;;;;; +10613;LINEAR A SIGN AB022F;Lo;0;L;;;;;N;;;;; +10614;LINEAR A SIGN AB022M;Lo;0;L;;;;;N;;;;; +10615;LINEAR A SIGN AB023;Lo;0;L;;;;;N;;;;; +10616;LINEAR A SIGN AB023M;Lo;0;L;;;;;N;;;;; +10617;LINEAR A SIGN AB024;Lo;0;L;;;;;N;;;;; +10618;LINEAR A SIGN AB026;Lo;0;L;;;;;N;;;;; +10619;LINEAR A SIGN AB027;Lo;0;L;;;;;N;;;;; +1061A;LINEAR A SIGN AB028;Lo;0;L;;;;;N;;;;; +1061B;LINEAR A SIGN A028B;Lo;0;L;;;;;N;;;;; +1061C;LINEAR A SIGN AB029;Lo;0;L;;;;;N;;;;; +1061D;LINEAR A SIGN AB030;Lo;0;L;;;;;N;;;;; +1061E;LINEAR A SIGN AB031;Lo;0;L;;;;;N;;;;; +1061F;LINEAR A SIGN AB034;Lo;0;L;;;;;N;;;;; +10620;LINEAR A SIGN AB037;Lo;0;L;;;;;N;;;;; +10621;LINEAR A SIGN AB038;Lo;0;L;;;;;N;;;;; +10622;LINEAR A SIGN AB039;Lo;0;L;;;;;N;;;;; +10623;LINEAR A SIGN AB040;Lo;0;L;;;;;N;;;;; +10624;LINEAR A SIGN AB041;Lo;0;L;;;;;N;;;;; +10625;LINEAR A SIGN AB044;Lo;0;L;;;;;N;;;;; +10626;LINEAR A SIGN AB045;Lo;0;L;;;;;N;;;;; +10627;LINEAR A SIGN AB046;Lo;0;L;;;;;N;;;;; +10628;LINEAR A SIGN AB047;Lo;0;L;;;;;N;;;;; +10629;LINEAR A SIGN AB048;Lo;0;L;;;;;N;;;;; +1062A;LINEAR A SIGN AB049;Lo;0;L;;;;;N;;;;; +1062B;LINEAR A SIGN AB050;Lo;0;L;;;;;N;;;;; +1062C;LINEAR A SIGN AB051;Lo;0;L;;;;;N;;;;; +1062D;LINEAR A SIGN AB053;Lo;0;L;;;;;N;;;;; +1062E;LINEAR A SIGN AB054;Lo;0;L;;;;;N;;;;; +1062F;LINEAR A SIGN AB055;Lo;0;L;;;;;N;;;;; +10630;LINEAR A SIGN AB056;Lo;0;L;;;;;N;;;;; +10631;LINEAR A SIGN AB057;Lo;0;L;;;;;N;;;;; +10632;LINEAR A SIGN AB058;Lo;0;L;;;;;N;;;;; +10633;LINEAR A SIGN AB059;Lo;0;L;;;;;N;;;;; +10634;LINEAR A SIGN AB060;Lo;0;L;;;;;N;;;;; +10635;LINEAR A SIGN AB061;Lo;0;L;;;;;N;;;;; +10636;LINEAR A SIGN AB065;Lo;0;L;;;;;N;;;;; +10637;LINEAR A SIGN AB066;Lo;0;L;;;;;N;;;;; +10638;LINEAR A SIGN AB067;Lo;0;L;;;;;N;;;;; +10639;LINEAR A SIGN AB069;Lo;0;L;;;;;N;;;;; +1063A;LINEAR A SIGN AB070;Lo;0;L;;;;;N;;;;; +1063B;LINEAR A SIGN AB073;Lo;0;L;;;;;N;;;;; +1063C;LINEAR A SIGN AB074;Lo;0;L;;;;;N;;;;; +1063D;LINEAR A SIGN AB076;Lo;0;L;;;;;N;;;;; +1063E;LINEAR A SIGN AB077;Lo;0;L;;;;;N;;;;; +1063F;LINEAR A SIGN AB078;Lo;0;L;;;;;N;;;;; +10640;LINEAR A SIGN AB079;Lo;0;L;;;;;N;;;;; +10641;LINEAR A SIGN AB080;Lo;0;L;;;;;N;;;;; +10642;LINEAR A SIGN AB081;Lo;0;L;;;;;N;;;;; +10643;LINEAR A SIGN AB082;Lo;0;L;;;;;N;;;;; +10644;LINEAR A SIGN AB085;Lo;0;L;;;;;N;;;;; +10645;LINEAR A SIGN AB086;Lo;0;L;;;;;N;;;;; +10646;LINEAR A SIGN AB087;Lo;0;L;;;;;N;;;;; +10647;LINEAR A SIGN A100-102;Lo;0;L;;;;;N;;;;; +10648;LINEAR A SIGN AB118;Lo;0;L;;;;;N;;;;; +10649;LINEAR A SIGN AB120;Lo;0;L;;;;;N;;;;; +1064A;LINEAR A SIGN A120B;Lo;0;L;;;;;N;;;;; +1064B;LINEAR A SIGN AB122;Lo;0;L;;;;;N;;;;; +1064C;LINEAR A SIGN AB123;Lo;0;L;;;;;N;;;;; +1064D;LINEAR A SIGN AB131A;Lo;0;L;;;;;N;;;;; +1064E;LINEAR A SIGN AB131B;Lo;0;L;;;;;N;;;;; +1064F;LINEAR A SIGN A131C;Lo;0;L;;;;;N;;;;; +10650;LINEAR A SIGN AB164;Lo;0;L;;;;;N;;;;; +10651;LINEAR A SIGN AB171;Lo;0;L;;;;;N;;;;; +10652;LINEAR A SIGN AB180;Lo;0;L;;;;;N;;;;; +10653;LINEAR A SIGN AB188;Lo;0;L;;;;;N;;;;; +10654;LINEAR A SIGN AB191;Lo;0;L;;;;;N;;;;; +10655;LINEAR A SIGN A301;Lo;0;L;;;;;N;;;;; +10656;LINEAR A SIGN A302;Lo;0;L;;;;;N;;;;; +10657;LINEAR A SIGN A303;Lo;0;L;;;;;N;;;;; +10658;LINEAR A SIGN A304;Lo;0;L;;;;;N;;;;; +10659;LINEAR A SIGN A305;Lo;0;L;;;;;N;;;;; +1065A;LINEAR A SIGN A306;Lo;0;L;;;;;N;;;;; +1065B;LINEAR A SIGN A307;Lo;0;L;;;;;N;;;;; +1065C;LINEAR A SIGN A308;Lo;0;L;;;;;N;;;;; +1065D;LINEAR A SIGN A309A;Lo;0;L;;;;;N;;;;; +1065E;LINEAR A SIGN A309B;Lo;0;L;;;;;N;;;;; +1065F;LINEAR A SIGN A309C;Lo;0;L;;;;;N;;;;; +10660;LINEAR A SIGN A310;Lo;0;L;;;;;N;;;;; +10661;LINEAR A SIGN A311;Lo;0;L;;;;;N;;;;; +10662;LINEAR A SIGN A312;Lo;0;L;;;;;N;;;;; +10663;LINEAR A SIGN A313A;Lo;0;L;;;;;N;;;;; +10664;LINEAR A SIGN A313B;Lo;0;L;;;;;N;;;;; +10665;LINEAR A SIGN A313C;Lo;0;L;;;;;N;;;;; +10666;LINEAR A SIGN A314;Lo;0;L;;;;;N;;;;; +10667;LINEAR A SIGN A315;Lo;0;L;;;;;N;;;;; +10668;LINEAR A SIGN A316;Lo;0;L;;;;;N;;;;; +10669;LINEAR A SIGN A317;Lo;0;L;;;;;N;;;;; +1066A;LINEAR A SIGN A318;Lo;0;L;;;;;N;;;;; +1066B;LINEAR A SIGN A319;Lo;0;L;;;;;N;;;;; +1066C;LINEAR A SIGN A320;Lo;0;L;;;;;N;;;;; +1066D;LINEAR A SIGN A321;Lo;0;L;;;;;N;;;;; +1066E;LINEAR A SIGN A322;Lo;0;L;;;;;N;;;;; +1066F;LINEAR A SIGN A323;Lo;0;L;;;;;N;;;;; +10670;LINEAR A SIGN A324;Lo;0;L;;;;;N;;;;; +10671;LINEAR A SIGN A325;Lo;0;L;;;;;N;;;;; +10672;LINEAR A SIGN A326;Lo;0;L;;;;;N;;;;; +10673;LINEAR A SIGN A327;Lo;0;L;;;;;N;;;;; +10674;LINEAR A SIGN A328;Lo;0;L;;;;;N;;;;; +10675;LINEAR A SIGN A329;Lo;0;L;;;;;N;;;;; +10676;LINEAR A SIGN A330;Lo;0;L;;;;;N;;;;; +10677;LINEAR A SIGN A331;Lo;0;L;;;;;N;;;;; +10678;LINEAR A SIGN A332;Lo;0;L;;;;;N;;;;; +10679;LINEAR A SIGN A333;Lo;0;L;;;;;N;;;;; +1067A;LINEAR A SIGN A334;Lo;0;L;;;;;N;;;;; +1067B;LINEAR A SIGN A335;Lo;0;L;;;;;N;;;;; +1067C;LINEAR A SIGN A336;Lo;0;L;;;;;N;;;;; +1067D;LINEAR A SIGN A337;Lo;0;L;;;;;N;;;;; +1067E;LINEAR A SIGN A338;Lo;0;L;;;;;N;;;;; +1067F;LINEAR A SIGN A339;Lo;0;L;;;;;N;;;;; +10680;LINEAR A SIGN A340;Lo;0;L;;;;;N;;;;; +10681;LINEAR A SIGN A341;Lo;0;L;;;;;N;;;;; +10682;LINEAR A SIGN A342;Lo;0;L;;;;;N;;;;; +10683;LINEAR A SIGN A343;Lo;0;L;;;;;N;;;;; +10684;LINEAR A SIGN A344;Lo;0;L;;;;;N;;;;; +10685;LINEAR A SIGN A345;Lo;0;L;;;;;N;;;;; +10686;LINEAR A SIGN A346;Lo;0;L;;;;;N;;;;; +10687;LINEAR A SIGN A347;Lo;0;L;;;;;N;;;;; +10688;LINEAR A SIGN A348;Lo;0;L;;;;;N;;;;; +10689;LINEAR A SIGN A349;Lo;0;L;;;;;N;;;;; +1068A;LINEAR A SIGN A350;Lo;0;L;;;;;N;;;;; +1068B;LINEAR A SIGN A351;Lo;0;L;;;;;N;;;;; +1068C;LINEAR A SIGN A352;Lo;0;L;;;;;N;;;;; +1068D;LINEAR A SIGN A353;Lo;0;L;;;;;N;;;;; +1068E;LINEAR A SIGN A354;Lo;0;L;;;;;N;;;;; +1068F;LINEAR A SIGN A355;Lo;0;L;;;;;N;;;;; +10690;LINEAR A SIGN A356;Lo;0;L;;;;;N;;;;; +10691;LINEAR A SIGN A357;Lo;0;L;;;;;N;;;;; +10692;LINEAR A SIGN A358;Lo;0;L;;;;;N;;;;; +10693;LINEAR A SIGN A359;Lo;0;L;;;;;N;;;;; +10694;LINEAR A SIGN A360;Lo;0;L;;;;;N;;;;; +10695;LINEAR A SIGN A361;Lo;0;L;;;;;N;;;;; +10696;LINEAR A SIGN A362;Lo;0;L;;;;;N;;;;; +10697;LINEAR A SIGN A363;Lo;0;L;;;;;N;;;;; +10698;LINEAR A SIGN A364;Lo;0;L;;;;;N;;;;; +10699;LINEAR A SIGN A365;Lo;0;L;;;;;N;;;;; +1069A;LINEAR A SIGN A366;Lo;0;L;;;;;N;;;;; +1069B;LINEAR A SIGN A367;Lo;0;L;;;;;N;;;;; +1069C;LINEAR A SIGN A368;Lo;0;L;;;;;N;;;;; +1069D;LINEAR A SIGN A369;Lo;0;L;;;;;N;;;;; +1069E;LINEAR A SIGN A370;Lo;0;L;;;;;N;;;;; +1069F;LINEAR A SIGN A371;Lo;0;L;;;;;N;;;;; +106A0;LINEAR A SIGN A400-VAS;Lo;0;L;;;;;N;;;;; +106A1;LINEAR A SIGN A401-VAS;Lo;0;L;;;;;N;;;;; +106A2;LINEAR A SIGN A402-VAS;Lo;0;L;;;;;N;;;;; +106A3;LINEAR A SIGN A403-VAS;Lo;0;L;;;;;N;;;;; +106A4;LINEAR A SIGN A404-VAS;Lo;0;L;;;;;N;;;;; +106A5;LINEAR A SIGN A405-VAS;Lo;0;L;;;;;N;;;;; +106A6;LINEAR A SIGN A406-VAS;Lo;0;L;;;;;N;;;;; +106A7;LINEAR A SIGN A407-VAS;Lo;0;L;;;;;N;;;;; +106A8;LINEAR A SIGN A408-VAS;Lo;0;L;;;;;N;;;;; +106A9;LINEAR A SIGN A409-VAS;Lo;0;L;;;;;N;;;;; +106AA;LINEAR A SIGN A410-VAS;Lo;0;L;;;;;N;;;;; +106AB;LINEAR A SIGN A411-VAS;Lo;0;L;;;;;N;;;;; +106AC;LINEAR A SIGN A412-VAS;Lo;0;L;;;;;N;;;;; +106AD;LINEAR A SIGN A413-VAS;Lo;0;L;;;;;N;;;;; +106AE;LINEAR A SIGN A414-VAS;Lo;0;L;;;;;N;;;;; +106AF;LINEAR A SIGN A415-VAS;Lo;0;L;;;;;N;;;;; +106B0;LINEAR A SIGN A416-VAS;Lo;0;L;;;;;N;;;;; +106B1;LINEAR A SIGN A417-VAS;Lo;0;L;;;;;N;;;;; +106B2;LINEAR A SIGN A418-VAS;Lo;0;L;;;;;N;;;;; +106B3;LINEAR A SIGN A501;Lo;0;L;;;;;N;;;;; +106B4;LINEAR A SIGN A502;Lo;0;L;;;;;N;;;;; +106B5;LINEAR A SIGN A503;Lo;0;L;;;;;N;;;;; +106B6;LINEAR A SIGN A504;Lo;0;L;;;;;N;;;;; +106B7;LINEAR A SIGN A505;Lo;0;L;;;;;N;;;;; +106B8;LINEAR A SIGN A506;Lo;0;L;;;;;N;;;;; +106B9;LINEAR A SIGN A508;Lo;0;L;;;;;N;;;;; +106BA;LINEAR A SIGN A509;Lo;0;L;;;;;N;;;;; +106BB;LINEAR A SIGN A510;Lo;0;L;;;;;N;;;;; +106BC;LINEAR A SIGN A511;Lo;0;L;;;;;N;;;;; +106BD;LINEAR A SIGN A512;Lo;0;L;;;;;N;;;;; +106BE;LINEAR A SIGN A513;Lo;0;L;;;;;N;;;;; +106BF;LINEAR A SIGN A515;Lo;0;L;;;;;N;;;;; +106C0;LINEAR A SIGN A516;Lo;0;L;;;;;N;;;;; +106C1;LINEAR A SIGN A520;Lo;0;L;;;;;N;;;;; +106C2;LINEAR A SIGN A521;Lo;0;L;;;;;N;;;;; +106C3;LINEAR A SIGN A523;Lo;0;L;;;;;N;;;;; +106C4;LINEAR A SIGN A524;Lo;0;L;;;;;N;;;;; +106C5;LINEAR A SIGN A525;Lo;0;L;;;;;N;;;;; +106C6;LINEAR A SIGN A526;Lo;0;L;;;;;N;;;;; +106C7;LINEAR A SIGN A527;Lo;0;L;;;;;N;;;;; +106C8;LINEAR A SIGN A528;Lo;0;L;;;;;N;;;;; +106C9;LINEAR A SIGN A529;Lo;0;L;;;;;N;;;;; +106CA;LINEAR A SIGN A530;Lo;0;L;;;;;N;;;;; +106CB;LINEAR A SIGN A531;Lo;0;L;;;;;N;;;;; +106CC;LINEAR A SIGN A532;Lo;0;L;;;;;N;;;;; +106CD;LINEAR A SIGN A534;Lo;0;L;;;;;N;;;;; +106CE;LINEAR A SIGN A535;Lo;0;L;;;;;N;;;;; +106CF;LINEAR A SIGN A536;Lo;0;L;;;;;N;;;;; +106D0;LINEAR A SIGN A537;Lo;0;L;;;;;N;;;;; +106D1;LINEAR A SIGN A538;Lo;0;L;;;;;N;;;;; +106D2;LINEAR A SIGN A539;Lo;0;L;;;;;N;;;;; +106D3;LINEAR A SIGN A540;Lo;0;L;;;;;N;;;;; +106D4;LINEAR A SIGN A541;Lo;0;L;;;;;N;;;;; +106D5;LINEAR A SIGN A542;Lo;0;L;;;;;N;;;;; +106D6;LINEAR A SIGN A545;Lo;0;L;;;;;N;;;;; +106D7;LINEAR A SIGN A547;Lo;0;L;;;;;N;;;;; +106D8;LINEAR A SIGN A548;Lo;0;L;;;;;N;;;;; +106D9;LINEAR A SIGN A549;Lo;0;L;;;;;N;;;;; +106DA;LINEAR A SIGN A550;Lo;0;L;;;;;N;;;;; +106DB;LINEAR A SIGN A551;Lo;0;L;;;;;N;;;;; +106DC;LINEAR A SIGN A552;Lo;0;L;;;;;N;;;;; +106DD;LINEAR A SIGN A553;Lo;0;L;;;;;N;;;;; +106DE;LINEAR A SIGN A554;Lo;0;L;;;;;N;;;;; +106DF;LINEAR A SIGN A555;Lo;0;L;;;;;N;;;;; +106E0;LINEAR A SIGN A556;Lo;0;L;;;;;N;;;;; +106E1;LINEAR A SIGN A557;Lo;0;L;;;;;N;;;;; +106E2;LINEAR A SIGN A559;Lo;0;L;;;;;N;;;;; +106E3;LINEAR A SIGN A563;Lo;0;L;;;;;N;;;;; +106E4;LINEAR A SIGN A564;Lo;0;L;;;;;N;;;;; +106E5;LINEAR A SIGN A565;Lo;0;L;;;;;N;;;;; +106E6;LINEAR A SIGN A566;Lo;0;L;;;;;N;;;;; +106E7;LINEAR A SIGN A568;Lo;0;L;;;;;N;;;;; +106E8;LINEAR A SIGN A569;Lo;0;L;;;;;N;;;;; +106E9;LINEAR A SIGN A570;Lo;0;L;;;;;N;;;;; +106EA;LINEAR A SIGN A571;Lo;0;L;;;;;N;;;;; +106EB;LINEAR A SIGN A572;Lo;0;L;;;;;N;;;;; +106EC;LINEAR A SIGN A573;Lo;0;L;;;;;N;;;;; +106ED;LINEAR A SIGN A574;Lo;0;L;;;;;N;;;;; +106EE;LINEAR A SIGN A575;Lo;0;L;;;;;N;;;;; +106EF;LINEAR A SIGN A576;Lo;0;L;;;;;N;;;;; +106F0;LINEAR A SIGN A577;Lo;0;L;;;;;N;;;;; +106F1;LINEAR A SIGN A578;Lo;0;L;;;;;N;;;;; +106F2;LINEAR A SIGN A579;Lo;0;L;;;;;N;;;;; +106F3;LINEAR A SIGN A580;Lo;0;L;;;;;N;;;;; +106F4;LINEAR A SIGN A581;Lo;0;L;;;;;N;;;;; +106F5;LINEAR A SIGN A582;Lo;0;L;;;;;N;;;;; +106F6;LINEAR A SIGN A583;Lo;0;L;;;;;N;;;;; +106F7;LINEAR A SIGN A584;Lo;0;L;;;;;N;;;;; +106F8;LINEAR A SIGN A585;Lo;0;L;;;;;N;;;;; +106F9;LINEAR A SIGN A586;Lo;0;L;;;;;N;;;;; +106FA;LINEAR A SIGN A587;Lo;0;L;;;;;N;;;;; +106FB;LINEAR A SIGN A588;Lo;0;L;;;;;N;;;;; +106FC;LINEAR A SIGN A589;Lo;0;L;;;;;N;;;;; +106FD;LINEAR A SIGN A591;Lo;0;L;;;;;N;;;;; +106FE;LINEAR A SIGN A592;Lo;0;L;;;;;N;;;;; +106FF;LINEAR A SIGN A594;Lo;0;L;;;;;N;;;;; +10700;LINEAR A SIGN A595;Lo;0;L;;;;;N;;;;; +10701;LINEAR A SIGN A596;Lo;0;L;;;;;N;;;;; +10702;LINEAR A SIGN A598;Lo;0;L;;;;;N;;;;; +10703;LINEAR A SIGN A600;Lo;0;L;;;;;N;;;;; +10704;LINEAR A SIGN A601;Lo;0;L;;;;;N;;;;; +10705;LINEAR A SIGN A602;Lo;0;L;;;;;N;;;;; +10706;LINEAR A SIGN A603;Lo;0;L;;;;;N;;;;; +10707;LINEAR A SIGN A604;Lo;0;L;;;;;N;;;;; +10708;LINEAR A SIGN A606;Lo;0;L;;;;;N;;;;; +10709;LINEAR A SIGN A608;Lo;0;L;;;;;N;;;;; +1070A;LINEAR A SIGN A609;Lo;0;L;;;;;N;;;;; +1070B;LINEAR A SIGN A610;Lo;0;L;;;;;N;;;;; +1070C;LINEAR A SIGN A611;Lo;0;L;;;;;N;;;;; +1070D;LINEAR A SIGN A612;Lo;0;L;;;;;N;;;;; +1070E;LINEAR A SIGN A613;Lo;0;L;;;;;N;;;;; +1070F;LINEAR A SIGN A614;Lo;0;L;;;;;N;;;;; +10710;LINEAR A SIGN A615;Lo;0;L;;;;;N;;;;; +10711;LINEAR A SIGN A616;Lo;0;L;;;;;N;;;;; +10712;LINEAR A SIGN A617;Lo;0;L;;;;;N;;;;; +10713;LINEAR A SIGN A618;Lo;0;L;;;;;N;;;;; +10714;LINEAR A SIGN A619;Lo;0;L;;;;;N;;;;; +10715;LINEAR A SIGN A620;Lo;0;L;;;;;N;;;;; +10716;LINEAR A SIGN A621;Lo;0;L;;;;;N;;;;; +10717;LINEAR A SIGN A622;Lo;0;L;;;;;N;;;;; +10718;LINEAR A SIGN A623;Lo;0;L;;;;;N;;;;; +10719;LINEAR A SIGN A624;Lo;0;L;;;;;N;;;;; +1071A;LINEAR A SIGN A626;Lo;0;L;;;;;N;;;;; +1071B;LINEAR A SIGN A627;Lo;0;L;;;;;N;;;;; +1071C;LINEAR A SIGN A628;Lo;0;L;;;;;N;;;;; +1071D;LINEAR A SIGN A629;Lo;0;L;;;;;N;;;;; +1071E;LINEAR A SIGN A634;Lo;0;L;;;;;N;;;;; +1071F;LINEAR A SIGN A637;Lo;0;L;;;;;N;;;;; +10720;LINEAR A SIGN A638;Lo;0;L;;;;;N;;;;; +10721;LINEAR A SIGN A640;Lo;0;L;;;;;N;;;;; +10722;LINEAR A SIGN A642;Lo;0;L;;;;;N;;;;; +10723;LINEAR A SIGN A643;Lo;0;L;;;;;N;;;;; +10724;LINEAR A SIGN A644;Lo;0;L;;;;;N;;;;; +10725;LINEAR A SIGN A645;Lo;0;L;;;;;N;;;;; +10726;LINEAR A SIGN A646;Lo;0;L;;;;;N;;;;; +10727;LINEAR A SIGN A648;Lo;0;L;;;;;N;;;;; +10728;LINEAR A SIGN A649;Lo;0;L;;;;;N;;;;; +10729;LINEAR A SIGN A651;Lo;0;L;;;;;N;;;;; +1072A;LINEAR A SIGN A652;Lo;0;L;;;;;N;;;;; +1072B;LINEAR A SIGN A653;Lo;0;L;;;;;N;;;;; +1072C;LINEAR A SIGN A654;Lo;0;L;;;;;N;;;;; +1072D;LINEAR A SIGN A655;Lo;0;L;;;;;N;;;;; +1072E;LINEAR A SIGN A656;Lo;0;L;;;;;N;;;;; +1072F;LINEAR A SIGN A657;Lo;0;L;;;;;N;;;;; +10730;LINEAR A SIGN A658;Lo;0;L;;;;;N;;;;; +10731;LINEAR A SIGN A659;Lo;0;L;;;;;N;;;;; +10732;LINEAR A SIGN A660;Lo;0;L;;;;;N;;;;; +10733;LINEAR A SIGN A661;Lo;0;L;;;;;N;;;;; +10734;LINEAR A SIGN A662;Lo;0;L;;;;;N;;;;; +10735;LINEAR A SIGN A663;Lo;0;L;;;;;N;;;;; +10736;LINEAR A SIGN A664;Lo;0;L;;;;;N;;;;; +10740;LINEAR A SIGN A701 A;Lo;0;L;;;;;N;;;;; +10741;LINEAR A SIGN A702 B;Lo;0;L;;;;;N;;;;; +10742;LINEAR A SIGN A703 D;Lo;0;L;;;;;N;;;;; +10743;LINEAR A SIGN A704 E;Lo;0;L;;;;;N;;;;; +10744;LINEAR A SIGN A705 F;Lo;0;L;;;;;N;;;;; +10745;LINEAR A SIGN A706 H;Lo;0;L;;;;;N;;;;; +10746;LINEAR A SIGN A707 J;Lo;0;L;;;;;N;;;;; +10747;LINEAR A SIGN A708 K;Lo;0;L;;;;;N;;;;; +10748;LINEAR A SIGN A709 L;Lo;0;L;;;;;N;;;;; +10749;LINEAR A SIGN A709-2 L2;Lo;0;L;;;;;N;;;;; +1074A;LINEAR A SIGN A709-3 L3;Lo;0;L;;;;;N;;;;; +1074B;LINEAR A SIGN A709-4 L4;Lo;0;L;;;;;N;;;;; +1074C;LINEAR A SIGN A709-6 L6;Lo;0;L;;;;;N;;;;; +1074D;LINEAR A SIGN A710 W;Lo;0;L;;;;;N;;;;; +1074E;LINEAR A SIGN A711 X;Lo;0;L;;;;;N;;;;; +1074F;LINEAR A SIGN A712 Y;Lo;0;L;;;;;N;;;;; +10750;LINEAR A SIGN A713 OMEGA;Lo;0;L;;;;;N;;;;; +10751;LINEAR A SIGN A714 ABB;Lo;0;L;;;;;N;;;;; +10752;LINEAR A SIGN A715 BB;Lo;0;L;;;;;N;;;;; +10753;LINEAR A SIGN A717 DD;Lo;0;L;;;;;N;;;;; +10754;LINEAR A SIGN A726 EYYY;Lo;0;L;;;;;N;;;;; +10755;LINEAR A SIGN A732 JE;Lo;0;L;;;;;N;;;;; +10760;LINEAR A SIGN A800;Lo;0;L;;;;;N;;;;; +10761;LINEAR A SIGN A801;Lo;0;L;;;;;N;;;;; +10762;LINEAR A SIGN A802;Lo;0;L;;;;;N;;;;; +10763;LINEAR A SIGN A803;Lo;0;L;;;;;N;;;;; +10764;LINEAR A SIGN A804;Lo;0;L;;;;;N;;;;; +10765;LINEAR A SIGN A805;Lo;0;L;;;;;N;;;;; +10766;LINEAR A SIGN A806;Lo;0;L;;;;;N;;;;; +10767;LINEAR A SIGN A807;Lo;0;L;;;;;N;;;;; +10800;CYPRIOT SYLLABLE A;Lo;0;R;;;;;N;;;;; +10801;CYPRIOT SYLLABLE E;Lo;0;R;;;;;N;;;;; +10802;CYPRIOT SYLLABLE I;Lo;0;R;;;;;N;;;;; +10803;CYPRIOT SYLLABLE O;Lo;0;R;;;;;N;;;;; +10804;CYPRIOT SYLLABLE U;Lo;0;R;;;;;N;;;;; +10805;CYPRIOT SYLLABLE JA;Lo;0;R;;;;;N;;;;; +10808;CYPRIOT SYLLABLE JO;Lo;0;R;;;;;N;;;;; +1080A;CYPRIOT SYLLABLE KA;Lo;0;R;;;;;N;;;;; +1080B;CYPRIOT SYLLABLE KE;Lo;0;R;;;;;N;;;;; +1080C;CYPRIOT SYLLABLE KI;Lo;0;R;;;;;N;;;;; +1080D;CYPRIOT SYLLABLE KO;Lo;0;R;;;;;N;;;;; +1080E;CYPRIOT SYLLABLE KU;Lo;0;R;;;;;N;;;;; +1080F;CYPRIOT SYLLABLE LA;Lo;0;R;;;;;N;;;;; +10810;CYPRIOT SYLLABLE LE;Lo;0;R;;;;;N;;;;; +10811;CYPRIOT SYLLABLE LI;Lo;0;R;;;;;N;;;;; +10812;CYPRIOT SYLLABLE LO;Lo;0;R;;;;;N;;;;; +10813;CYPRIOT SYLLABLE LU;Lo;0;R;;;;;N;;;;; +10814;CYPRIOT SYLLABLE MA;Lo;0;R;;;;;N;;;;; +10815;CYPRIOT SYLLABLE ME;Lo;0;R;;;;;N;;;;; +10816;CYPRIOT SYLLABLE MI;Lo;0;R;;;;;N;;;;; +10817;CYPRIOT SYLLABLE MO;Lo;0;R;;;;;N;;;;; +10818;CYPRIOT SYLLABLE MU;Lo;0;R;;;;;N;;;;; +10819;CYPRIOT SYLLABLE NA;Lo;0;R;;;;;N;;;;; +1081A;CYPRIOT SYLLABLE NE;Lo;0;R;;;;;N;;;;; +1081B;CYPRIOT SYLLABLE NI;Lo;0;R;;;;;N;;;;; +1081C;CYPRIOT SYLLABLE NO;Lo;0;R;;;;;N;;;;; +1081D;CYPRIOT SYLLABLE NU;Lo;0;R;;;;;N;;;;; +1081E;CYPRIOT SYLLABLE PA;Lo;0;R;;;;;N;;;;; +1081F;CYPRIOT SYLLABLE PE;Lo;0;R;;;;;N;;;;; +10820;CYPRIOT SYLLABLE PI;Lo;0;R;;;;;N;;;;; +10821;CYPRIOT SYLLABLE PO;Lo;0;R;;;;;N;;;;; +10822;CYPRIOT SYLLABLE PU;Lo;0;R;;;;;N;;;;; +10823;CYPRIOT SYLLABLE RA;Lo;0;R;;;;;N;;;;; +10824;CYPRIOT SYLLABLE RE;Lo;0;R;;;;;N;;;;; +10825;CYPRIOT SYLLABLE RI;Lo;0;R;;;;;N;;;;; +10826;CYPRIOT SYLLABLE RO;Lo;0;R;;;;;N;;;;; +10827;CYPRIOT SYLLABLE RU;Lo;0;R;;;;;N;;;;; +10828;CYPRIOT SYLLABLE SA;Lo;0;R;;;;;N;;;;; +10829;CYPRIOT SYLLABLE SE;Lo;0;R;;;;;N;;;;; +1082A;CYPRIOT SYLLABLE SI;Lo;0;R;;;;;N;;;;; +1082B;CYPRIOT SYLLABLE SO;Lo;0;R;;;;;N;;;;; +1082C;CYPRIOT SYLLABLE SU;Lo;0;R;;;;;N;;;;; +1082D;CYPRIOT SYLLABLE TA;Lo;0;R;;;;;N;;;;; +1082E;CYPRIOT SYLLABLE TE;Lo;0;R;;;;;N;;;;; +1082F;CYPRIOT SYLLABLE TI;Lo;0;R;;;;;N;;;;; +10830;CYPRIOT SYLLABLE TO;Lo;0;R;;;;;N;;;;; +10831;CYPRIOT SYLLABLE TU;Lo;0;R;;;;;N;;;;; +10832;CYPRIOT SYLLABLE WA;Lo;0;R;;;;;N;;;;; +10833;CYPRIOT SYLLABLE WE;Lo;0;R;;;;;N;;;;; +10834;CYPRIOT SYLLABLE WI;Lo;0;R;;;;;N;;;;; +10835;CYPRIOT SYLLABLE WO;Lo;0;R;;;;;N;;;;; +10837;CYPRIOT SYLLABLE XA;Lo;0;R;;;;;N;;;;; +10838;CYPRIOT SYLLABLE XE;Lo;0;R;;;;;N;;;;; +1083C;CYPRIOT SYLLABLE ZA;Lo;0;R;;;;;N;;;;; +1083F;CYPRIOT SYLLABLE ZO;Lo;0;R;;;;;N;;;;; +10840;IMPERIAL ARAMAIC LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10841;IMPERIAL ARAMAIC LETTER BETH;Lo;0;R;;;;;N;;;;; +10842;IMPERIAL ARAMAIC LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10843;IMPERIAL ARAMAIC LETTER DALETH;Lo;0;R;;;;;N;;;;; +10844;IMPERIAL ARAMAIC LETTER HE;Lo;0;R;;;;;N;;;;; +10845;IMPERIAL ARAMAIC LETTER WAW;Lo;0;R;;;;;N;;;;; +10846;IMPERIAL ARAMAIC LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +10847;IMPERIAL ARAMAIC LETTER HETH;Lo;0;R;;;;;N;;;;; +10848;IMPERIAL ARAMAIC LETTER TETH;Lo;0;R;;;;;N;;;;; +10849;IMPERIAL ARAMAIC LETTER YODH;Lo;0;R;;;;;N;;;;; +1084A;IMPERIAL ARAMAIC LETTER KAPH;Lo;0;R;;;;;N;;;;; +1084B;IMPERIAL ARAMAIC LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +1084C;IMPERIAL ARAMAIC LETTER MEM;Lo;0;R;;;;;N;;;;; +1084D;IMPERIAL ARAMAIC LETTER NUN;Lo;0;R;;;;;N;;;;; +1084E;IMPERIAL ARAMAIC LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +1084F;IMPERIAL ARAMAIC LETTER AYIN;Lo;0;R;;;;;N;;;;; +10850;IMPERIAL ARAMAIC LETTER PE;Lo;0;R;;;;;N;;;;; +10851;IMPERIAL ARAMAIC LETTER SADHE;Lo;0;R;;;;;N;;;;; +10852;IMPERIAL ARAMAIC LETTER QOPH;Lo;0;R;;;;;N;;;;; +10853;IMPERIAL ARAMAIC LETTER RESH;Lo;0;R;;;;;N;;;;; +10854;IMPERIAL ARAMAIC LETTER SHIN;Lo;0;R;;;;;N;;;;; +10855;IMPERIAL ARAMAIC LETTER TAW;Lo;0;R;;;;;N;;;;; +10857;IMPERIAL ARAMAIC SECTION SIGN;Po;0;R;;;;;N;;;;; +10858;IMPERIAL ARAMAIC NUMBER ONE;No;0;R;;;;1;N;;;;; +10859;IMPERIAL ARAMAIC NUMBER TWO;No;0;R;;;;2;N;;;;; +1085A;IMPERIAL ARAMAIC NUMBER THREE;No;0;R;;;;3;N;;;;; +1085B;IMPERIAL ARAMAIC NUMBER TEN;No;0;R;;;;10;N;;;;; +1085C;IMPERIAL ARAMAIC NUMBER TWENTY;No;0;R;;;;20;N;;;;; +1085D;IMPERIAL ARAMAIC NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +1085E;IMPERIAL ARAMAIC NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;; +1085F;IMPERIAL ARAMAIC NUMBER TEN THOUSAND;No;0;R;;;;10000;N;;;;; +10860;PALMYRENE LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10861;PALMYRENE LETTER BETH;Lo;0;R;;;;;N;;;;; +10862;PALMYRENE LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10863;PALMYRENE LETTER DALETH;Lo;0;R;;;;;N;;;;; +10864;PALMYRENE LETTER HE;Lo;0;R;;;;;N;;;;; +10865;PALMYRENE LETTER WAW;Lo;0;R;;;;;N;;;;; +10866;PALMYRENE LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +10867;PALMYRENE LETTER HETH;Lo;0;R;;;;;N;;;;; +10868;PALMYRENE LETTER TETH;Lo;0;R;;;;;N;;;;; +10869;PALMYRENE LETTER YODH;Lo;0;R;;;;;N;;;;; +1086A;PALMYRENE LETTER KAPH;Lo;0;R;;;;;N;;;;; +1086B;PALMYRENE LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +1086C;PALMYRENE LETTER MEM;Lo;0;R;;;;;N;;;;; +1086D;PALMYRENE LETTER FINAL NUN;Lo;0;R;;;;;N;;;;; +1086E;PALMYRENE LETTER NUN;Lo;0;R;;;;;N;;;;; +1086F;PALMYRENE LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10870;PALMYRENE LETTER AYIN;Lo;0;R;;;;;N;;;;; +10871;PALMYRENE LETTER PE;Lo;0;R;;;;;N;;;;; +10872;PALMYRENE LETTER SADHE;Lo;0;R;;;;;N;;;;; +10873;PALMYRENE LETTER QOPH;Lo;0;R;;;;;N;;;;; +10874;PALMYRENE LETTER RESH;Lo;0;R;;;;;N;;;;; +10875;PALMYRENE LETTER SHIN;Lo;0;R;;;;;N;;;;; +10876;PALMYRENE LETTER TAW;Lo;0;R;;;;;N;;;;; +10877;PALMYRENE LEFT-POINTING FLEURON;So;0;R;;;;;N;;;;; +10878;PALMYRENE RIGHT-POINTING FLEURON;So;0;R;;;;;N;;;;; +10879;PALMYRENE NUMBER ONE;No;0;R;;;;1;N;;;;; +1087A;PALMYRENE NUMBER TWO;No;0;R;;;;2;N;;;;; +1087B;PALMYRENE NUMBER THREE;No;0;R;;;;3;N;;;;; +1087C;PALMYRENE NUMBER FOUR;No;0;R;;;;4;N;;;;; +1087D;PALMYRENE NUMBER FIVE;No;0;R;;;;5;N;;;;; +1087E;PALMYRENE NUMBER TEN;No;0;R;;;;10;N;;;;; +1087F;PALMYRENE NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10880;NABATAEAN LETTER FINAL ALEPH;Lo;0;R;;;;;N;;;;; +10881;NABATAEAN LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10882;NABATAEAN LETTER FINAL BETH;Lo;0;R;;;;;N;;;;; +10883;NABATAEAN LETTER BETH;Lo;0;R;;;;;N;;;;; +10884;NABATAEAN LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10885;NABATAEAN LETTER DALETH;Lo;0;R;;;;;N;;;;; +10886;NABATAEAN LETTER FINAL HE;Lo;0;R;;;;;N;;;;; +10887;NABATAEAN LETTER HE;Lo;0;R;;;;;N;;;;; +10888;NABATAEAN LETTER WAW;Lo;0;R;;;;;N;;;;; +10889;NABATAEAN LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +1088A;NABATAEAN LETTER HETH;Lo;0;R;;;;;N;;;;; +1088B;NABATAEAN LETTER TETH;Lo;0;R;;;;;N;;;;; +1088C;NABATAEAN LETTER FINAL YODH;Lo;0;R;;;;;N;;;;; +1088D;NABATAEAN LETTER YODH;Lo;0;R;;;;;N;;;;; +1088E;NABATAEAN LETTER FINAL KAPH;Lo;0;R;;;;;N;;;;; +1088F;NABATAEAN LETTER KAPH;Lo;0;R;;;;;N;;;;; +10890;NABATAEAN LETTER FINAL LAMEDH;Lo;0;R;;;;;N;;;;; +10891;NABATAEAN LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +10892;NABATAEAN LETTER FINAL MEM;Lo;0;R;;;;;N;;;;; +10893;NABATAEAN LETTER MEM;Lo;0;R;;;;;N;;;;; +10894;NABATAEAN LETTER FINAL NUN;Lo;0;R;;;;;N;;;;; +10895;NABATAEAN LETTER NUN;Lo;0;R;;;;;N;;;;; +10896;NABATAEAN LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10897;NABATAEAN LETTER AYIN;Lo;0;R;;;;;N;;;;; +10898;NABATAEAN LETTER PE;Lo;0;R;;;;;N;;;;; +10899;NABATAEAN LETTER SADHE;Lo;0;R;;;;;N;;;;; +1089A;NABATAEAN LETTER QOPH;Lo;0;R;;;;;N;;;;; +1089B;NABATAEAN LETTER RESH;Lo;0;R;;;;;N;;;;; +1089C;NABATAEAN LETTER FINAL SHIN;Lo;0;R;;;;;N;;;;; +1089D;NABATAEAN LETTER SHIN;Lo;0;R;;;;;N;;;;; +1089E;NABATAEAN LETTER TAW;Lo;0;R;;;;;N;;;;; +108A7;NABATAEAN NUMBER ONE;No;0;R;;;;1;N;;;;; +108A8;NABATAEAN NUMBER TWO;No;0;R;;;;2;N;;;;; +108A9;NABATAEAN NUMBER THREE;No;0;R;;;;3;N;;;;; +108AA;NABATAEAN NUMBER FOUR;No;0;R;;;;4;N;;;;; +108AB;NABATAEAN CRUCIFORM NUMBER FOUR;No;0;R;;;;4;N;;;;; +108AC;NABATAEAN NUMBER FIVE;No;0;R;;;;5;N;;;;; +108AD;NABATAEAN NUMBER TEN;No;0;R;;;;10;N;;;;; +108AE;NABATAEAN NUMBER TWENTY;No;0;R;;;;20;N;;;;; +108AF;NABATAEAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +108E0;HATRAN LETTER ALEPH;Lo;0;R;;;;;N;;;;; +108E1;HATRAN LETTER BETH;Lo;0;R;;;;;N;;;;; +108E2;HATRAN LETTER GIMEL;Lo;0;R;;;;;N;;;;; +108E3;HATRAN LETTER DALETH-RESH;Lo;0;R;;;;;N;;;;; +108E4;HATRAN LETTER HE;Lo;0;R;;;;;N;;;;; +108E5;HATRAN LETTER WAW;Lo;0;R;;;;;N;;;;; +108E6;HATRAN LETTER ZAYN;Lo;0;R;;;;;N;;;;; +108E7;HATRAN LETTER HETH;Lo;0;R;;;;;N;;;;; +108E8;HATRAN LETTER TETH;Lo;0;R;;;;;N;;;;; +108E9;HATRAN LETTER YODH;Lo;0;R;;;;;N;;;;; +108EA;HATRAN LETTER KAPH;Lo;0;R;;;;;N;;;;; +108EB;HATRAN LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +108EC;HATRAN LETTER MEM;Lo;0;R;;;;;N;;;;; +108ED;HATRAN LETTER NUN;Lo;0;R;;;;;N;;;;; +108EE;HATRAN LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +108EF;HATRAN LETTER AYN;Lo;0;R;;;;;N;;;;; +108F0;HATRAN LETTER PE;Lo;0;R;;;;;N;;;;; +108F1;HATRAN LETTER SADHE;Lo;0;R;;;;;N;;;;; +108F2;HATRAN LETTER QOPH;Lo;0;R;;;;;N;;;;; +108F4;HATRAN LETTER SHIN;Lo;0;R;;;;;N;;;;; +108F5;HATRAN LETTER TAW;Lo;0;R;;;;;N;;;;; +108FB;HATRAN NUMBER ONE;No;0;R;;;;1;N;;;;; +108FC;HATRAN NUMBER FIVE;No;0;R;;;;5;N;;;;; +108FD;HATRAN NUMBER TEN;No;0;R;;;;10;N;;;;; +108FE;HATRAN NUMBER TWENTY;No;0;R;;;;20;N;;;;; +108FF;HATRAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10900;PHOENICIAN LETTER ALF;Lo;0;R;;;;;N;;;;; +10901;PHOENICIAN LETTER BET;Lo;0;R;;;;;N;;;;; +10902;PHOENICIAN LETTER GAML;Lo;0;R;;;;;N;;;;; +10903;PHOENICIAN LETTER DELT;Lo;0;R;;;;;N;;;;; +10904;PHOENICIAN LETTER HE;Lo;0;R;;;;;N;;;;; +10905;PHOENICIAN LETTER WAU;Lo;0;R;;;;;N;;;;; +10906;PHOENICIAN LETTER ZAI;Lo;0;R;;;;;N;;;;; +10907;PHOENICIAN LETTER HET;Lo;0;R;;;;;N;;;;; +10908;PHOENICIAN LETTER TET;Lo;0;R;;;;;N;;;;; +10909;PHOENICIAN LETTER YOD;Lo;0;R;;;;;N;;;;; +1090A;PHOENICIAN LETTER KAF;Lo;0;R;;;;;N;;;;; +1090B;PHOENICIAN LETTER LAMD;Lo;0;R;;;;;N;;;;; +1090C;PHOENICIAN LETTER MEM;Lo;0;R;;;;;N;;;;; +1090D;PHOENICIAN LETTER NUN;Lo;0;R;;;;;N;;;;; +1090E;PHOENICIAN LETTER SEMK;Lo;0;R;;;;;N;;;;; +1090F;PHOENICIAN LETTER AIN;Lo;0;R;;;;;N;;;;; +10910;PHOENICIAN LETTER PE;Lo;0;R;;;;;N;;;;; +10911;PHOENICIAN LETTER SADE;Lo;0;R;;;;;N;;;;; +10912;PHOENICIAN LETTER QOF;Lo;0;R;;;;;N;;;;; +10913;PHOENICIAN LETTER ROSH;Lo;0;R;;;;;N;;;;; +10914;PHOENICIAN LETTER SHIN;Lo;0;R;;;;;N;;;;; +10915;PHOENICIAN LETTER TAU;Lo;0;R;;;;;N;;;;; +10916;PHOENICIAN NUMBER ONE;No;0;R;;;;1;N;;;;; +10917;PHOENICIAN NUMBER TEN;No;0;R;;;;10;N;;;;; +10918;PHOENICIAN NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10919;PHOENICIAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +1091A;PHOENICIAN NUMBER TWO;No;0;R;;;;2;N;;;;; +1091B;PHOENICIAN NUMBER THREE;No;0;R;;;;3;N;;;;; +1091F;PHOENICIAN WORD SEPARATOR;Po;0;ON;;;;;N;;;;; +10920;LYDIAN LETTER A;Lo;0;R;;;;;N;;;;; +10921;LYDIAN LETTER B;Lo;0;R;;;;;N;;;;; +10922;LYDIAN LETTER G;Lo;0;R;;;;;N;;;;; +10923;LYDIAN LETTER D;Lo;0;R;;;;;N;;;;; +10924;LYDIAN LETTER E;Lo;0;R;;;;;N;;;;; +10925;LYDIAN LETTER V;Lo;0;R;;;;;N;;;;; +10926;LYDIAN LETTER I;Lo;0;R;;;;;N;;;;; +10927;LYDIAN LETTER Y;Lo;0;R;;;;;N;;;;; +10928;LYDIAN LETTER K;Lo;0;R;;;;;N;;;;; +10929;LYDIAN LETTER L;Lo;0;R;;;;;N;;;;; +1092A;LYDIAN LETTER M;Lo;0;R;;;;;N;;;;; +1092B;LYDIAN LETTER N;Lo;0;R;;;;;N;;;;; +1092C;LYDIAN LETTER O;Lo;0;R;;;;;N;;;;; +1092D;LYDIAN LETTER R;Lo;0;R;;;;;N;;;;; +1092E;LYDIAN LETTER SS;Lo;0;R;;;;;N;;;;; +1092F;LYDIAN LETTER T;Lo;0;R;;;;;N;;;;; +10930;LYDIAN LETTER U;Lo;0;R;;;;;N;;;;; +10931;LYDIAN LETTER F;Lo;0;R;;;;;N;;;;; +10932;LYDIAN LETTER Q;Lo;0;R;;;;;N;;;;; +10933;LYDIAN LETTER S;Lo;0;R;;;;;N;;;;; +10934;LYDIAN LETTER TT;Lo;0;R;;;;;N;;;;; +10935;LYDIAN LETTER AN;Lo;0;R;;;;;N;;;;; +10936;LYDIAN LETTER EN;Lo;0;R;;;;;N;;;;; +10937;LYDIAN LETTER LY;Lo;0;R;;;;;N;;;;; +10938;LYDIAN LETTER NN;Lo;0;R;;;;;N;;;;; +10939;LYDIAN LETTER C;Lo;0;R;;;;;N;;;;; +1093F;LYDIAN TRIANGULAR MARK;Po;0;R;;;;;N;;;;; +10980;MEROITIC HIEROGLYPHIC LETTER A;Lo;0;R;;;;;N;;;;; +10981;MEROITIC HIEROGLYPHIC LETTER E;Lo;0;R;;;;;N;;;;; +10982;MEROITIC HIEROGLYPHIC LETTER I;Lo;0;R;;;;;N;;;;; +10983;MEROITIC HIEROGLYPHIC LETTER O;Lo;0;R;;;;;N;;;;; +10984;MEROITIC HIEROGLYPHIC LETTER YA;Lo;0;R;;;;;N;;;;; +10985;MEROITIC HIEROGLYPHIC LETTER WA;Lo;0;R;;;;;N;;;;; +10986;MEROITIC HIEROGLYPHIC LETTER BA;Lo;0;R;;;;;N;;;;; +10987;MEROITIC HIEROGLYPHIC LETTER BA-2;Lo;0;R;;;;;N;;;;; +10988;MEROITIC HIEROGLYPHIC LETTER PA;Lo;0;R;;;;;N;;;;; +10989;MEROITIC HIEROGLYPHIC LETTER MA;Lo;0;R;;;;;N;;;;; +1098A;MEROITIC HIEROGLYPHIC LETTER NA;Lo;0;R;;;;;N;;;;; +1098B;MEROITIC HIEROGLYPHIC LETTER NA-2;Lo;0;R;;;;;N;;;;; +1098C;MEROITIC HIEROGLYPHIC LETTER NE;Lo;0;R;;;;;N;;;;; +1098D;MEROITIC HIEROGLYPHIC LETTER NE-2;Lo;0;R;;;;;N;;;;; +1098E;MEROITIC HIEROGLYPHIC LETTER RA;Lo;0;R;;;;;N;;;;; +1098F;MEROITIC HIEROGLYPHIC LETTER RA-2;Lo;0;R;;;;;N;;;;; +10990;MEROITIC HIEROGLYPHIC LETTER LA;Lo;0;R;;;;;N;;;;; +10991;MEROITIC HIEROGLYPHIC LETTER KHA;Lo;0;R;;;;;N;;;;; +10992;MEROITIC HIEROGLYPHIC LETTER HHA;Lo;0;R;;;;;N;;;;; +10993;MEROITIC HIEROGLYPHIC LETTER SA;Lo;0;R;;;;;N;;;;; +10994;MEROITIC HIEROGLYPHIC LETTER SA-2;Lo;0;R;;;;;N;;;;; +10995;MEROITIC HIEROGLYPHIC LETTER SE;Lo;0;R;;;;;N;;;;; +10996;MEROITIC HIEROGLYPHIC LETTER KA;Lo;0;R;;;;;N;;;;; +10997;MEROITIC HIEROGLYPHIC LETTER QA;Lo;0;R;;;;;N;;;;; +10998;MEROITIC HIEROGLYPHIC LETTER TA;Lo;0;R;;;;;N;;;;; +10999;MEROITIC HIEROGLYPHIC LETTER TA-2;Lo;0;R;;;;;N;;;;; +1099A;MEROITIC HIEROGLYPHIC LETTER TE;Lo;0;R;;;;;N;;;;; +1099B;MEROITIC HIEROGLYPHIC LETTER TE-2;Lo;0;R;;;;;N;;;;; +1099C;MEROITIC HIEROGLYPHIC LETTER TO;Lo;0;R;;;;;N;;;;; +1099D;MEROITIC HIEROGLYPHIC LETTER DA;Lo;0;R;;;;;N;;;;; +1099E;MEROITIC HIEROGLYPHIC SYMBOL VIDJ;Lo;0;R;;;;;N;;;;; +1099F;MEROITIC HIEROGLYPHIC SYMBOL VIDJ-2;Lo;0;R;;;;;N;;;;; +109A0;MEROITIC CURSIVE LETTER A;Lo;0;R;;;;;N;;;;; +109A1;MEROITIC CURSIVE LETTER E;Lo;0;R;;;;;N;;;;; +109A2;MEROITIC CURSIVE LETTER I;Lo;0;R;;;;;N;;;;; +109A3;MEROITIC CURSIVE LETTER O;Lo;0;R;;;;;N;;;;; +109A4;MEROITIC CURSIVE LETTER YA;Lo;0;R;;;;;N;;;;; +109A5;MEROITIC CURSIVE LETTER WA;Lo;0;R;;;;;N;;;;; +109A6;MEROITIC CURSIVE LETTER BA;Lo;0;R;;;;;N;;;;; +109A7;MEROITIC CURSIVE LETTER PA;Lo;0;R;;;;;N;;;;; +109A8;MEROITIC CURSIVE LETTER MA;Lo;0;R;;;;;N;;;;; +109A9;MEROITIC CURSIVE LETTER NA;Lo;0;R;;;;;N;;;;; +109AA;MEROITIC CURSIVE LETTER NE;Lo;0;R;;;;;N;;;;; +109AB;MEROITIC CURSIVE LETTER RA;Lo;0;R;;;;;N;;;;; +109AC;MEROITIC CURSIVE LETTER LA;Lo;0;R;;;;;N;;;;; +109AD;MEROITIC CURSIVE LETTER KHA;Lo;0;R;;;;;N;;;;; +109AE;MEROITIC CURSIVE LETTER HHA;Lo;0;R;;;;;N;;;;; +109AF;MEROITIC CURSIVE LETTER SA;Lo;0;R;;;;;N;;;;; +109B0;MEROITIC CURSIVE LETTER ARCHAIC SA;Lo;0;R;;;;;N;;;;; +109B1;MEROITIC CURSIVE LETTER SE;Lo;0;R;;;;;N;;;;; +109B2;MEROITIC CURSIVE LETTER KA;Lo;0;R;;;;;N;;;;; +109B3;MEROITIC CURSIVE LETTER QA;Lo;0;R;;;;;N;;;;; +109B4;MEROITIC CURSIVE LETTER TA;Lo;0;R;;;;;N;;;;; +109B5;MEROITIC CURSIVE LETTER TE;Lo;0;R;;;;;N;;;;; +109B6;MEROITIC CURSIVE LETTER TO;Lo;0;R;;;;;N;;;;; +109B7;MEROITIC CURSIVE LETTER DA;Lo;0;R;;;;;N;;;;; +109BC;MEROITIC CURSIVE FRACTION ELEVEN TWELFTHS;No;0;R;;;;11/12;N;;;;; +109BD;MEROITIC CURSIVE FRACTION ONE HALF;No;0;R;;;;1/2;N;;;;; +109BE;MEROITIC CURSIVE LOGOGRAM RMT;Lo;0;R;;;;;N;;;;; +109BF;MEROITIC CURSIVE LOGOGRAM IMN;Lo;0;R;;;;;N;;;;; +109C0;MEROITIC CURSIVE NUMBER ONE;No;0;R;;;;1;N;;;;; +109C1;MEROITIC CURSIVE NUMBER TWO;No;0;R;;;;2;N;;;;; +109C2;MEROITIC CURSIVE NUMBER THREE;No;0;R;;;;3;N;;;;; +109C3;MEROITIC CURSIVE NUMBER FOUR;No;0;R;;;;4;N;;;;; +109C4;MEROITIC CURSIVE NUMBER FIVE;No;0;R;;;;5;N;;;;; +109C5;MEROITIC CURSIVE NUMBER SIX;No;0;R;;;;6;N;;;;; +109C6;MEROITIC CURSIVE NUMBER SEVEN;No;0;R;;;;7;N;;;;; +109C7;MEROITIC CURSIVE NUMBER EIGHT;No;0;R;;;;8;N;;;;; +109C8;MEROITIC CURSIVE NUMBER NINE;No;0;R;;;;9;N;;;;; +109C9;MEROITIC CURSIVE NUMBER TEN;No;0;R;;;;10;N;;;;; +109CA;MEROITIC CURSIVE NUMBER TWENTY;No;0;R;;;;20;N;;;;; +109CB;MEROITIC CURSIVE NUMBER THIRTY;No;0;R;;;;30;N;;;;; +109CC;MEROITIC CURSIVE NUMBER FORTY;No;0;R;;;;40;N;;;;; +109CD;MEROITIC CURSIVE NUMBER FIFTY;No;0;R;;;;50;N;;;;; +109CE;MEROITIC CURSIVE NUMBER SIXTY;No;0;R;;;;60;N;;;;; +109CF;MEROITIC CURSIVE NUMBER SEVENTY;No;0;R;;;;70;N;;;;; +109D2;MEROITIC CURSIVE NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +109D3;MEROITIC CURSIVE NUMBER TWO HUNDRED;No;0;R;;;;200;N;;;;; +109D4;MEROITIC CURSIVE NUMBER THREE HUNDRED;No;0;R;;;;300;N;;;;; +109D5;MEROITIC CURSIVE NUMBER FOUR HUNDRED;No;0;R;;;;400;N;;;;; +109D6;MEROITIC CURSIVE NUMBER FIVE HUNDRED;No;0;R;;;;500;N;;;;; +109D7;MEROITIC CURSIVE NUMBER SIX HUNDRED;No;0;R;;;;600;N;;;;; +109D8;MEROITIC CURSIVE NUMBER SEVEN HUNDRED;No;0;R;;;;700;N;;;;; +109D9;MEROITIC CURSIVE NUMBER EIGHT HUNDRED;No;0;R;;;;800;N;;;;; +109DA;MEROITIC CURSIVE NUMBER NINE HUNDRED;No;0;R;;;;900;N;;;;; +109DB;MEROITIC CURSIVE NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;; +109DC;MEROITIC CURSIVE NUMBER TWO THOUSAND;No;0;R;;;;2000;N;;;;; +109DD;MEROITIC CURSIVE NUMBER THREE THOUSAND;No;0;R;;;;3000;N;;;;; +109DE;MEROITIC CURSIVE NUMBER FOUR THOUSAND;No;0;R;;;;4000;N;;;;; +109DF;MEROITIC CURSIVE NUMBER FIVE THOUSAND;No;0;R;;;;5000;N;;;;; +109E0;MEROITIC CURSIVE NUMBER SIX THOUSAND;No;0;R;;;;6000;N;;;;; +109E1;MEROITIC CURSIVE NUMBER SEVEN THOUSAND;No;0;R;;;;7000;N;;;;; +109E2;MEROITIC CURSIVE NUMBER EIGHT THOUSAND;No;0;R;;;;8000;N;;;;; +109E3;MEROITIC CURSIVE NUMBER NINE THOUSAND;No;0;R;;;;9000;N;;;;; +109E4;MEROITIC CURSIVE NUMBER TEN THOUSAND;No;0;R;;;;10000;N;;;;; +109E5;MEROITIC CURSIVE NUMBER TWENTY THOUSAND;No;0;R;;;;20000;N;;;;; +109E6;MEROITIC CURSIVE NUMBER THIRTY THOUSAND;No;0;R;;;;30000;N;;;;; +109E7;MEROITIC CURSIVE NUMBER FORTY THOUSAND;No;0;R;;;;40000;N;;;;; +109E8;MEROITIC CURSIVE NUMBER FIFTY THOUSAND;No;0;R;;;;50000;N;;;;; +109E9;MEROITIC CURSIVE NUMBER SIXTY THOUSAND;No;0;R;;;;60000;N;;;;; +109EA;MEROITIC CURSIVE NUMBER SEVENTY THOUSAND;No;0;R;;;;70000;N;;;;; +109EB;MEROITIC CURSIVE NUMBER EIGHTY THOUSAND;No;0;R;;;;80000;N;;;;; +109EC;MEROITIC CURSIVE NUMBER NINETY THOUSAND;No;0;R;;;;90000;N;;;;; +109ED;MEROITIC CURSIVE NUMBER ONE HUNDRED THOUSAND;No;0;R;;;;100000;N;;;;; +109EE;MEROITIC CURSIVE NUMBER TWO HUNDRED THOUSAND;No;0;R;;;;200000;N;;;;; +109EF;MEROITIC CURSIVE NUMBER THREE HUNDRED THOUSAND;No;0;R;;;;300000;N;;;;; +109F0;MEROITIC CURSIVE NUMBER FOUR HUNDRED THOUSAND;No;0;R;;;;400000;N;;;;; +109F1;MEROITIC CURSIVE NUMBER FIVE HUNDRED THOUSAND;No;0;R;;;;500000;N;;;;; +109F2;MEROITIC CURSIVE NUMBER SIX HUNDRED THOUSAND;No;0;R;;;;600000;N;;;;; +109F3;MEROITIC CURSIVE NUMBER SEVEN HUNDRED THOUSAND;No;0;R;;;;700000;N;;;;; +109F4;MEROITIC CURSIVE NUMBER EIGHT HUNDRED THOUSAND;No;0;R;;;;800000;N;;;;; +109F5;MEROITIC CURSIVE NUMBER NINE HUNDRED THOUSAND;No;0;R;;;;900000;N;;;;; +109F6;MEROITIC CURSIVE FRACTION ONE TWELFTH;No;0;R;;;;1/12;N;;;;; +109F7;MEROITIC CURSIVE FRACTION TWO TWELFTHS;No;0;R;;;;2/12;N;;;;; +109F8;MEROITIC CURSIVE FRACTION THREE TWELFTHS;No;0;R;;;;3/12;N;;;;; +109F9;MEROITIC CURSIVE FRACTION FOUR TWELFTHS;No;0;R;;;;4/12;N;;;;; +109FA;MEROITIC CURSIVE FRACTION FIVE TWELFTHS;No;0;R;;;;5/12;N;;;;; +109FB;MEROITIC CURSIVE FRACTION SIX TWELFTHS;No;0;R;;;;6/12;N;;;;; +109FC;MEROITIC CURSIVE FRACTION SEVEN TWELFTHS;No;0;R;;;;7/12;N;;;;; +109FD;MEROITIC CURSIVE FRACTION EIGHT TWELFTHS;No;0;R;;;;8/12;N;;;;; +109FE;MEROITIC CURSIVE FRACTION NINE TWELFTHS;No;0;R;;;;9/12;N;;;;; +109FF;MEROITIC CURSIVE FRACTION TEN TWELFTHS;No;0;R;;;;10/12;N;;;;; +10A00;KHAROSHTHI LETTER A;Lo;0;R;;;;;N;;;;; +10A01;KHAROSHTHI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +10A02;KHAROSHTHI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +10A03;KHAROSHTHI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +10A05;KHAROSHTHI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +10A06;KHAROSHTHI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +10A0C;KHAROSHTHI VOWEL LENGTH MARK;Mn;0;NSM;;;;;N;;;;; +10A0D;KHAROSHTHI SIGN DOUBLE RING BELOW;Mn;220;NSM;;;;;N;;;;; +10A0E;KHAROSHTHI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +10A0F;KHAROSHTHI SIGN VISARGA;Mn;230;NSM;;;;;N;;;;; +10A10;KHAROSHTHI LETTER KA;Lo;0;R;;;;;N;;;;; +10A11;KHAROSHTHI LETTER KHA;Lo;0;R;;;;;N;;;;; +10A12;KHAROSHTHI LETTER GA;Lo;0;R;;;;;N;;;;; +10A13;KHAROSHTHI LETTER GHA;Lo;0;R;;;;;N;;;;; +10A15;KHAROSHTHI LETTER CA;Lo;0;R;;;;;N;;;;; +10A16;KHAROSHTHI LETTER CHA;Lo;0;R;;;;;N;;;;; +10A17;KHAROSHTHI LETTER JA;Lo;0;R;;;;;N;;;;; +10A19;KHAROSHTHI LETTER NYA;Lo;0;R;;;;;N;;;;; +10A1A;KHAROSHTHI LETTER TTA;Lo;0;R;;;;;N;;;;; +10A1B;KHAROSHTHI LETTER TTHA;Lo;0;R;;;;;N;;;;; +10A1C;KHAROSHTHI LETTER DDA;Lo;0;R;;;;;N;;;;; +10A1D;KHAROSHTHI LETTER DDHA;Lo;0;R;;;;;N;;;;; +10A1E;KHAROSHTHI LETTER NNA;Lo;0;R;;;;;N;;;;; +10A1F;KHAROSHTHI LETTER TA;Lo;0;R;;;;;N;;;;; +10A20;KHAROSHTHI LETTER THA;Lo;0;R;;;;;N;;;;; +10A21;KHAROSHTHI LETTER DA;Lo;0;R;;;;;N;;;;; +10A22;KHAROSHTHI LETTER DHA;Lo;0;R;;;;;N;;;;; +10A23;KHAROSHTHI LETTER NA;Lo;0;R;;;;;N;;;;; +10A24;KHAROSHTHI LETTER PA;Lo;0;R;;;;;N;;;;; +10A25;KHAROSHTHI LETTER PHA;Lo;0;R;;;;;N;;;;; +10A26;KHAROSHTHI LETTER BA;Lo;0;R;;;;;N;;;;; +10A27;KHAROSHTHI LETTER BHA;Lo;0;R;;;;;N;;;;; +10A28;KHAROSHTHI LETTER MA;Lo;0;R;;;;;N;;;;; +10A29;KHAROSHTHI LETTER YA;Lo;0;R;;;;;N;;;;; +10A2A;KHAROSHTHI LETTER RA;Lo;0;R;;;;;N;;;;; +10A2B;KHAROSHTHI LETTER LA;Lo;0;R;;;;;N;;;;; +10A2C;KHAROSHTHI LETTER VA;Lo;0;R;;;;;N;;;;; +10A2D;KHAROSHTHI LETTER SHA;Lo;0;R;;;;;N;;;;; +10A2E;KHAROSHTHI LETTER SSA;Lo;0;R;;;;;N;;;;; +10A2F;KHAROSHTHI LETTER SA;Lo;0;R;;;;;N;;;;; +10A30;KHAROSHTHI LETTER ZA;Lo;0;R;;;;;N;;;;; +10A31;KHAROSHTHI LETTER HA;Lo;0;R;;;;;N;;;;; +10A32;KHAROSHTHI LETTER KKA;Lo;0;R;;;;;N;;;;; +10A33;KHAROSHTHI LETTER TTTHA;Lo;0;R;;;;;N;;;;; +10A38;KHAROSHTHI SIGN BAR ABOVE;Mn;230;NSM;;;;;N;;;;; +10A39;KHAROSHTHI SIGN CAUDA;Mn;1;NSM;;;;;N;;;;; +10A3A;KHAROSHTHI SIGN DOT BELOW;Mn;220;NSM;;;;;N;;;;; +10A3F;KHAROSHTHI VIRAMA;Mn;9;NSM;;;;;N;;;;; +10A40;KHAROSHTHI DIGIT ONE;No;0;R;;;1;1;N;;;;; +10A41;KHAROSHTHI DIGIT TWO;No;0;R;;;2;2;N;;;;; +10A42;KHAROSHTHI DIGIT THREE;No;0;R;;;3;3;N;;;;; +10A43;KHAROSHTHI DIGIT FOUR;No;0;R;;;4;4;N;;;;; +10A44;KHAROSHTHI NUMBER TEN;No;0;R;;;;10;N;;;;; +10A45;KHAROSHTHI NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10A46;KHAROSHTHI NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10A47;KHAROSHTHI NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;; +10A50;KHAROSHTHI PUNCTUATION DOT;Po;0;R;;;;;N;;;;; +10A51;KHAROSHTHI PUNCTUATION SMALL CIRCLE;Po;0;R;;;;;N;;;;; +10A52;KHAROSHTHI PUNCTUATION CIRCLE;Po;0;R;;;;;N;;;;; +10A53;KHAROSHTHI PUNCTUATION CRESCENT BAR;Po;0;R;;;;;N;;;;; +10A54;KHAROSHTHI PUNCTUATION MANGALAM;Po;0;R;;;;;N;;;;; +10A55;KHAROSHTHI PUNCTUATION LOTUS;Po;0;R;;;;;N;;;;; +10A56;KHAROSHTHI PUNCTUATION DANDA;Po;0;R;;;;;N;;;;; +10A57;KHAROSHTHI PUNCTUATION DOUBLE DANDA;Po;0;R;;;;;N;;;;; +10A58;KHAROSHTHI PUNCTUATION LINES;Po;0;R;;;;;N;;;;; +10A60;OLD SOUTH ARABIAN LETTER HE;Lo;0;R;;;;;N;;;;; +10A61;OLD SOUTH ARABIAN LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +10A62;OLD SOUTH ARABIAN LETTER HETH;Lo;0;R;;;;;N;;;;; +10A63;OLD SOUTH ARABIAN LETTER MEM;Lo;0;R;;;;;N;;;;; +10A64;OLD SOUTH ARABIAN LETTER QOPH;Lo;0;R;;;;;N;;;;; +10A65;OLD SOUTH ARABIAN LETTER WAW;Lo;0;R;;;;;N;;;;; +10A66;OLD SOUTH ARABIAN LETTER SHIN;Lo;0;R;;;;;N;;;;; +10A67;OLD SOUTH ARABIAN LETTER RESH;Lo;0;R;;;;;N;;;;; +10A68;OLD SOUTH ARABIAN LETTER BETH;Lo;0;R;;;;;N;;;;; +10A69;OLD SOUTH ARABIAN LETTER TAW;Lo;0;R;;;;;N;;;;; +10A6A;OLD SOUTH ARABIAN LETTER SAT;Lo;0;R;;;;;N;;;;; +10A6B;OLD SOUTH ARABIAN LETTER KAPH;Lo;0;R;;;;;N;;;;; +10A6C;OLD SOUTH ARABIAN LETTER NUN;Lo;0;R;;;;;N;;;;; +10A6D;OLD SOUTH ARABIAN LETTER KHETH;Lo;0;R;;;;;N;;;;; +10A6E;OLD SOUTH ARABIAN LETTER SADHE;Lo;0;R;;;;;N;;;;; +10A6F;OLD SOUTH ARABIAN LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10A70;OLD SOUTH ARABIAN LETTER FE;Lo;0;R;;;;;N;;;;; +10A71;OLD SOUTH ARABIAN LETTER ALEF;Lo;0;R;;;;;N;;;;; +10A72;OLD SOUTH ARABIAN LETTER AYN;Lo;0;R;;;;;N;;;;; +10A73;OLD SOUTH ARABIAN LETTER DHADHE;Lo;0;R;;;;;N;;;;; +10A74;OLD SOUTH ARABIAN LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10A75;OLD SOUTH ARABIAN LETTER DALETH;Lo;0;R;;;;;N;;;;; +10A76;OLD SOUTH ARABIAN LETTER GHAYN;Lo;0;R;;;;;N;;;;; +10A77;OLD SOUTH ARABIAN LETTER TETH;Lo;0;R;;;;;N;;;;; +10A78;OLD SOUTH ARABIAN LETTER ZAYN;Lo;0;R;;;;;N;;;;; +10A79;OLD SOUTH ARABIAN LETTER DHALETH;Lo;0;R;;;;;N;;;;; +10A7A;OLD SOUTH ARABIAN LETTER YODH;Lo;0;R;;;;;N;;;;; +10A7B;OLD SOUTH ARABIAN LETTER THAW;Lo;0;R;;;;;N;;;;; +10A7C;OLD SOUTH ARABIAN LETTER THETH;Lo;0;R;;;;;N;;;;; +10A7D;OLD SOUTH ARABIAN NUMBER ONE;No;0;R;;;;1;N;;;;; +10A7E;OLD SOUTH ARABIAN NUMBER FIFTY;No;0;R;;;;50;N;;;;; +10A7F;OLD SOUTH ARABIAN NUMERIC INDICATOR;Po;0;R;;;;;N;;;;; +10A80;OLD NORTH ARABIAN LETTER HEH;Lo;0;R;;;;;N;;;;; +10A81;OLD NORTH ARABIAN LETTER LAM;Lo;0;R;;;;;N;;;;; +10A82;OLD NORTH ARABIAN LETTER HAH;Lo;0;R;;;;;N;;;;; +10A83;OLD NORTH ARABIAN LETTER MEEM;Lo;0;R;;;;;N;;;;; +10A84;OLD NORTH ARABIAN LETTER QAF;Lo;0;R;;;;;N;;;;; +10A85;OLD NORTH ARABIAN LETTER WAW;Lo;0;R;;;;;N;;;;; +10A86;OLD NORTH ARABIAN LETTER ES-2;Lo;0;R;;;;;N;;;;; +10A87;OLD NORTH ARABIAN LETTER REH;Lo;0;R;;;;;N;;;;; +10A88;OLD NORTH ARABIAN LETTER BEH;Lo;0;R;;;;;N;;;;; +10A89;OLD NORTH ARABIAN LETTER TEH;Lo;0;R;;;;;N;;;;; +10A8A;OLD NORTH ARABIAN LETTER ES-1;Lo;0;R;;;;;N;;;;; +10A8B;OLD NORTH ARABIAN LETTER KAF;Lo;0;R;;;;;N;;;;; +10A8C;OLD NORTH ARABIAN LETTER NOON;Lo;0;R;;;;;N;;;;; +10A8D;OLD NORTH ARABIAN LETTER KHAH;Lo;0;R;;;;;N;;;;; +10A8E;OLD NORTH ARABIAN LETTER SAD;Lo;0;R;;;;;N;;;;; +10A8F;OLD NORTH ARABIAN LETTER ES-3;Lo;0;R;;;;;N;;;;; +10A90;OLD NORTH ARABIAN LETTER FEH;Lo;0;R;;;;;N;;;;; +10A91;OLD NORTH ARABIAN LETTER ALEF;Lo;0;R;;;;;N;;;;; +10A92;OLD NORTH ARABIAN LETTER AIN;Lo;0;R;;;;;N;;;;; +10A93;OLD NORTH ARABIAN LETTER DAD;Lo;0;R;;;;;N;;;;; +10A94;OLD NORTH ARABIAN LETTER GEEM;Lo;0;R;;;;;N;;;;; +10A95;OLD NORTH ARABIAN LETTER DAL;Lo;0;R;;;;;N;;;;; +10A96;OLD NORTH ARABIAN LETTER GHAIN;Lo;0;R;;;;;N;;;;; +10A97;OLD NORTH ARABIAN LETTER TAH;Lo;0;R;;;;;N;;;;; +10A98;OLD NORTH ARABIAN LETTER ZAIN;Lo;0;R;;;;;N;;;;; +10A99;OLD NORTH ARABIAN LETTER THAL;Lo;0;R;;;;;N;;;;; +10A9A;OLD NORTH ARABIAN LETTER YEH;Lo;0;R;;;;;N;;;;; +10A9B;OLD NORTH ARABIAN LETTER THEH;Lo;0;R;;;;;N;;;;; +10A9C;OLD NORTH ARABIAN LETTER ZAH;Lo;0;R;;;;;N;;;;; +10A9D;OLD NORTH ARABIAN NUMBER ONE;No;0;R;;;;1;N;;;;; +10A9E;OLD NORTH ARABIAN NUMBER TEN;No;0;R;;;;10;N;;;;; +10A9F;OLD NORTH ARABIAN NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10AC0;MANICHAEAN LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10AC1;MANICHAEAN LETTER BETH;Lo;0;R;;;;;N;;;;; +10AC2;MANICHAEAN LETTER BHETH;Lo;0;R;;;;;N;;;;; +10AC3;MANICHAEAN LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10AC4;MANICHAEAN LETTER GHIMEL;Lo;0;R;;;;;N;;;;; +10AC5;MANICHAEAN LETTER DALETH;Lo;0;R;;;;;N;;;;; +10AC6;MANICHAEAN LETTER HE;Lo;0;R;;;;;N;;;;; +10AC7;MANICHAEAN LETTER WAW;Lo;0;R;;;;;N;;;;; +10AC8;MANICHAEAN SIGN UD;So;0;R;;;;;N;;;;; +10AC9;MANICHAEAN LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +10ACA;MANICHAEAN LETTER ZHAYIN;Lo;0;R;;;;;N;;;;; +10ACB;MANICHAEAN LETTER JAYIN;Lo;0;R;;;;;N;;;;; +10ACC;MANICHAEAN LETTER JHAYIN;Lo;0;R;;;;;N;;;;; +10ACD;MANICHAEAN LETTER HETH;Lo;0;R;;;;;N;;;;; +10ACE;MANICHAEAN LETTER TETH;Lo;0;R;;;;;N;;;;; +10ACF;MANICHAEAN LETTER YODH;Lo;0;R;;;;;N;;;;; +10AD0;MANICHAEAN LETTER KAPH;Lo;0;R;;;;;N;;;;; +10AD1;MANICHAEAN LETTER XAPH;Lo;0;R;;;;;N;;;;; +10AD2;MANICHAEAN LETTER KHAPH;Lo;0;R;;;;;N;;;;; +10AD3;MANICHAEAN LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +10AD4;MANICHAEAN LETTER DHAMEDH;Lo;0;R;;;;;N;;;;; +10AD5;MANICHAEAN LETTER THAMEDH;Lo;0;R;;;;;N;;;;; +10AD6;MANICHAEAN LETTER MEM;Lo;0;R;;;;;N;;;;; +10AD7;MANICHAEAN LETTER NUN;Lo;0;R;;;;;N;;;;; +10AD8;MANICHAEAN LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10AD9;MANICHAEAN LETTER AYIN;Lo;0;R;;;;;N;;;;; +10ADA;MANICHAEAN LETTER AAYIN;Lo;0;R;;;;;N;;;;; +10ADB;MANICHAEAN LETTER PE;Lo;0;R;;;;;N;;;;; +10ADC;MANICHAEAN LETTER FE;Lo;0;R;;;;;N;;;;; +10ADD;MANICHAEAN LETTER SADHE;Lo;0;R;;;;;N;;;;; +10ADE;MANICHAEAN LETTER QOPH;Lo;0;R;;;;;N;;;;; +10ADF;MANICHAEAN LETTER XOPH;Lo;0;R;;;;;N;;;;; +10AE0;MANICHAEAN LETTER QHOPH;Lo;0;R;;;;;N;;;;; +10AE1;MANICHAEAN LETTER RESH;Lo;0;R;;;;;N;;;;; +10AE2;MANICHAEAN LETTER SHIN;Lo;0;R;;;;;N;;;;; +10AE3;MANICHAEAN LETTER SSHIN;Lo;0;R;;;;;N;;;;; +10AE4;MANICHAEAN LETTER TAW;Lo;0;R;;;;;N;;;;; +10AE5;MANICHAEAN ABBREVIATION MARK ABOVE;Mn;230;NSM;;;;;N;;;;; +10AE6;MANICHAEAN ABBREVIATION MARK BELOW;Mn;220;NSM;;;;;N;;;;; +10AEB;MANICHAEAN NUMBER ONE;No;0;R;;;;1;N;;;;; +10AEC;MANICHAEAN NUMBER FIVE;No;0;R;;;;5;N;;;;; +10AED;MANICHAEAN NUMBER TEN;No;0;R;;;;10;N;;;;; +10AEE;MANICHAEAN NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10AEF;MANICHAEAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10AF0;MANICHAEAN PUNCTUATION STAR;Po;0;R;;;;;N;;;;; +10AF1;MANICHAEAN PUNCTUATION FLEURON;Po;0;R;;;;;N;;;;; +10AF2;MANICHAEAN PUNCTUATION DOUBLE DOT WITHIN DOT;Po;0;R;;;;;N;;;;; +10AF3;MANICHAEAN PUNCTUATION DOT WITHIN DOT;Po;0;R;;;;;N;;;;; +10AF4;MANICHAEAN PUNCTUATION DOT;Po;0;R;;;;;N;;;;; +10AF5;MANICHAEAN PUNCTUATION TWO DOTS;Po;0;R;;;;;N;;;;; +10AF6;MANICHAEAN PUNCTUATION LINE FILLER;Po;0;R;;;;;N;;;;; +10B00;AVESTAN LETTER A;Lo;0;R;;;;;N;;;;; +10B01;AVESTAN LETTER AA;Lo;0;R;;;;;N;;;;; +10B02;AVESTAN LETTER AO;Lo;0;R;;;;;N;;;;; +10B03;AVESTAN LETTER AAO;Lo;0;R;;;;;N;;;;; +10B04;AVESTAN LETTER AN;Lo;0;R;;;;;N;;;;; +10B05;AVESTAN LETTER AAN;Lo;0;R;;;;;N;;;;; +10B06;AVESTAN LETTER AE;Lo;0;R;;;;;N;;;;; +10B07;AVESTAN LETTER AEE;Lo;0;R;;;;;N;;;;; +10B08;AVESTAN LETTER E;Lo;0;R;;;;;N;;;;; +10B09;AVESTAN LETTER EE;Lo;0;R;;;;;N;;;;; +10B0A;AVESTAN LETTER O;Lo;0;R;;;;;N;;;;; +10B0B;AVESTAN LETTER OO;Lo;0;R;;;;;N;;;;; +10B0C;AVESTAN LETTER I;Lo;0;R;;;;;N;;;;; +10B0D;AVESTAN LETTER II;Lo;0;R;;;;;N;;;;; +10B0E;AVESTAN LETTER U;Lo;0;R;;;;;N;;;;; +10B0F;AVESTAN LETTER UU;Lo;0;R;;;;;N;;;;; +10B10;AVESTAN LETTER KE;Lo;0;R;;;;;N;;;;; +10B11;AVESTAN LETTER XE;Lo;0;R;;;;;N;;;;; +10B12;AVESTAN LETTER XYE;Lo;0;R;;;;;N;;;;; +10B13;AVESTAN LETTER XVE;Lo;0;R;;;;;N;;;;; +10B14;AVESTAN LETTER GE;Lo;0;R;;;;;N;;;;; +10B15;AVESTAN LETTER GGE;Lo;0;R;;;;;N;;;;; +10B16;AVESTAN LETTER GHE;Lo;0;R;;;;;N;;;;; +10B17;AVESTAN LETTER CE;Lo;0;R;;;;;N;;;;; +10B18;AVESTAN LETTER JE;Lo;0;R;;;;;N;;;;; +10B19;AVESTAN LETTER TE;Lo;0;R;;;;;N;;;;; +10B1A;AVESTAN LETTER THE;Lo;0;R;;;;;N;;;;; +10B1B;AVESTAN LETTER DE;Lo;0;R;;;;;N;;;;; +10B1C;AVESTAN LETTER DHE;Lo;0;R;;;;;N;;;;; +10B1D;AVESTAN LETTER TTE;Lo;0;R;;;;;N;;;;; +10B1E;AVESTAN LETTER PE;Lo;0;R;;;;;N;;;;; +10B1F;AVESTAN LETTER FE;Lo;0;R;;;;;N;;;;; +10B20;AVESTAN LETTER BE;Lo;0;R;;;;;N;;;;; +10B21;AVESTAN LETTER BHE;Lo;0;R;;;;;N;;;;; +10B22;AVESTAN LETTER NGE;Lo;0;R;;;;;N;;;;; +10B23;AVESTAN LETTER NGYE;Lo;0;R;;;;;N;;;;; +10B24;AVESTAN LETTER NGVE;Lo;0;R;;;;;N;;;;; +10B25;AVESTAN LETTER NE;Lo;0;R;;;;;N;;;;; +10B26;AVESTAN LETTER NYE;Lo;0;R;;;;;N;;;;; +10B27;AVESTAN LETTER NNE;Lo;0;R;;;;;N;;;;; +10B28;AVESTAN LETTER ME;Lo;0;R;;;;;N;;;;; +10B29;AVESTAN LETTER HME;Lo;0;R;;;;;N;;;;; +10B2A;AVESTAN LETTER YYE;Lo;0;R;;;;;N;;;;; +10B2B;AVESTAN LETTER YE;Lo;0;R;;;;;N;;;;; +10B2C;AVESTAN LETTER VE;Lo;0;R;;;;;N;;;;; +10B2D;AVESTAN LETTER RE;Lo;0;R;;;;;N;;;;; +10B2E;AVESTAN LETTER LE;Lo;0;R;;;;;N;;;;; +10B2F;AVESTAN LETTER SE;Lo;0;R;;;;;N;;;;; +10B30;AVESTAN LETTER ZE;Lo;0;R;;;;;N;;;;; +10B31;AVESTAN LETTER SHE;Lo;0;R;;;;;N;;;;; +10B32;AVESTAN LETTER ZHE;Lo;0;R;;;;;N;;;;; +10B33;AVESTAN LETTER SHYE;Lo;0;R;;;;;N;;;;; +10B34;AVESTAN LETTER SSHE;Lo;0;R;;;;;N;;;;; +10B35;AVESTAN LETTER HE;Lo;0;R;;;;;N;;;;; +10B39;AVESTAN ABBREVIATION MARK;Po;0;ON;;;;;N;;;;; +10B3A;TINY TWO DOTS OVER ONE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +10B3B;SMALL TWO DOTS OVER ONE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +10B3C;LARGE TWO DOTS OVER ONE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;; +10B3D;LARGE ONE DOT OVER TWO DOTS PUNCTUATION;Po;0;ON;;;;;N;;;;; +10B3E;LARGE TWO RINGS OVER ONE RING PUNCTUATION;Po;0;ON;;;;;N;;;;; +10B3F;LARGE ONE RING OVER TWO RINGS PUNCTUATION;Po;0;ON;;;;;N;;;;; +10B40;INSCRIPTIONAL PARTHIAN LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10B41;INSCRIPTIONAL PARTHIAN LETTER BETH;Lo;0;R;;;;;N;;;;; +10B42;INSCRIPTIONAL PARTHIAN LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10B43;INSCRIPTIONAL PARTHIAN LETTER DALETH;Lo;0;R;;;;;N;;;;; +10B44;INSCRIPTIONAL PARTHIAN LETTER HE;Lo;0;R;;;;;N;;;;; +10B45;INSCRIPTIONAL PARTHIAN LETTER WAW;Lo;0;R;;;;;N;;;;; +10B46;INSCRIPTIONAL PARTHIAN LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +10B47;INSCRIPTIONAL PARTHIAN LETTER HETH;Lo;0;R;;;;;N;;;;; +10B48;INSCRIPTIONAL PARTHIAN LETTER TETH;Lo;0;R;;;;;N;;;;; +10B49;INSCRIPTIONAL PARTHIAN LETTER YODH;Lo;0;R;;;;;N;;;;; +10B4A;INSCRIPTIONAL PARTHIAN LETTER KAPH;Lo;0;R;;;;;N;;;;; +10B4B;INSCRIPTIONAL PARTHIAN LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +10B4C;INSCRIPTIONAL PARTHIAN LETTER MEM;Lo;0;R;;;;;N;;;;; +10B4D;INSCRIPTIONAL PARTHIAN LETTER NUN;Lo;0;R;;;;;N;;;;; +10B4E;INSCRIPTIONAL PARTHIAN LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10B4F;INSCRIPTIONAL PARTHIAN LETTER AYIN;Lo;0;R;;;;;N;;;;; +10B50;INSCRIPTIONAL PARTHIAN LETTER PE;Lo;0;R;;;;;N;;;;; +10B51;INSCRIPTIONAL PARTHIAN LETTER SADHE;Lo;0;R;;;;;N;;;;; +10B52;INSCRIPTIONAL PARTHIAN LETTER QOPH;Lo;0;R;;;;;N;;;;; +10B53;INSCRIPTIONAL PARTHIAN LETTER RESH;Lo;0;R;;;;;N;;;;; +10B54;INSCRIPTIONAL PARTHIAN LETTER SHIN;Lo;0;R;;;;;N;;;;; +10B55;INSCRIPTIONAL PARTHIAN LETTER TAW;Lo;0;R;;;;;N;;;;; +10B58;INSCRIPTIONAL PARTHIAN NUMBER ONE;No;0;R;;;;1;N;;;;; +10B59;INSCRIPTIONAL PARTHIAN NUMBER TWO;No;0;R;;;;2;N;;;;; +10B5A;INSCRIPTIONAL PARTHIAN NUMBER THREE;No;0;R;;;;3;N;;;;; +10B5B;INSCRIPTIONAL PARTHIAN NUMBER FOUR;No;0;R;;;;4;N;;;;; +10B5C;INSCRIPTIONAL PARTHIAN NUMBER TEN;No;0;R;;;;10;N;;;;; +10B5D;INSCRIPTIONAL PARTHIAN NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10B5E;INSCRIPTIONAL PARTHIAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10B5F;INSCRIPTIONAL PARTHIAN NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;; +10B60;INSCRIPTIONAL PAHLAVI LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10B61;INSCRIPTIONAL PAHLAVI LETTER BETH;Lo;0;R;;;;;N;;;;; +10B62;INSCRIPTIONAL PAHLAVI LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10B63;INSCRIPTIONAL PAHLAVI LETTER DALETH;Lo;0;R;;;;;N;;;;; +10B64;INSCRIPTIONAL PAHLAVI LETTER HE;Lo;0;R;;;;;N;;;;; +10B65;INSCRIPTIONAL PAHLAVI LETTER WAW-AYIN-RESH;Lo;0;R;;;;;N;;;;; +10B66;INSCRIPTIONAL PAHLAVI LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +10B67;INSCRIPTIONAL PAHLAVI LETTER HETH;Lo;0;R;;;;;N;;;;; +10B68;INSCRIPTIONAL PAHLAVI LETTER TETH;Lo;0;R;;;;;N;;;;; +10B69;INSCRIPTIONAL PAHLAVI LETTER YODH;Lo;0;R;;;;;N;;;;; +10B6A;INSCRIPTIONAL PAHLAVI LETTER KAPH;Lo;0;R;;;;;N;;;;; +10B6B;INSCRIPTIONAL PAHLAVI LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +10B6C;INSCRIPTIONAL PAHLAVI LETTER MEM-QOPH;Lo;0;R;;;;;N;;;;; +10B6D;INSCRIPTIONAL PAHLAVI LETTER NUN;Lo;0;R;;;;;N;;;;; +10B6E;INSCRIPTIONAL PAHLAVI LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10B6F;INSCRIPTIONAL PAHLAVI LETTER PE;Lo;0;R;;;;;N;;;;; +10B70;INSCRIPTIONAL PAHLAVI LETTER SADHE;Lo;0;R;;;;;N;;;;; +10B71;INSCRIPTIONAL PAHLAVI LETTER SHIN;Lo;0;R;;;;;N;;;;; +10B72;INSCRIPTIONAL PAHLAVI LETTER TAW;Lo;0;R;;;;;N;;;;; +10B78;INSCRIPTIONAL PAHLAVI NUMBER ONE;No;0;R;;;;1;N;;;;; +10B79;INSCRIPTIONAL PAHLAVI NUMBER TWO;No;0;R;;;;2;N;;;;; +10B7A;INSCRIPTIONAL PAHLAVI NUMBER THREE;No;0;R;;;;3;N;;;;; +10B7B;INSCRIPTIONAL PAHLAVI NUMBER FOUR;No;0;R;;;;4;N;;;;; +10B7C;INSCRIPTIONAL PAHLAVI NUMBER TEN;No;0;R;;;;10;N;;;;; +10B7D;INSCRIPTIONAL PAHLAVI NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10B7E;INSCRIPTIONAL PAHLAVI NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10B7F;INSCRIPTIONAL PAHLAVI NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;; +10B80;PSALTER PAHLAVI LETTER ALEPH;Lo;0;R;;;;;N;;;;; +10B81;PSALTER PAHLAVI LETTER BETH;Lo;0;R;;;;;N;;;;; +10B82;PSALTER PAHLAVI LETTER GIMEL;Lo;0;R;;;;;N;;;;; +10B83;PSALTER PAHLAVI LETTER DALETH;Lo;0;R;;;;;N;;;;; +10B84;PSALTER PAHLAVI LETTER HE;Lo;0;R;;;;;N;;;;; +10B85;PSALTER PAHLAVI LETTER WAW-AYIN-RESH;Lo;0;R;;;;;N;;;;; +10B86;PSALTER PAHLAVI LETTER ZAYIN;Lo;0;R;;;;;N;;;;; +10B87;PSALTER PAHLAVI LETTER HETH;Lo;0;R;;;;;N;;;;; +10B88;PSALTER PAHLAVI LETTER YODH;Lo;0;R;;;;;N;;;;; +10B89;PSALTER PAHLAVI LETTER KAPH;Lo;0;R;;;;;N;;;;; +10B8A;PSALTER PAHLAVI LETTER LAMEDH;Lo;0;R;;;;;N;;;;; +10B8B;PSALTER PAHLAVI LETTER MEM-QOPH;Lo;0;R;;;;;N;;;;; +10B8C;PSALTER PAHLAVI LETTER NUN;Lo;0;R;;;;;N;;;;; +10B8D;PSALTER PAHLAVI LETTER SAMEKH;Lo;0;R;;;;;N;;;;; +10B8E;PSALTER PAHLAVI LETTER PE;Lo;0;R;;;;;N;;;;; +10B8F;PSALTER PAHLAVI LETTER SADHE;Lo;0;R;;;;;N;;;;; +10B90;PSALTER PAHLAVI LETTER SHIN;Lo;0;R;;;;;N;;;;; +10B91;PSALTER PAHLAVI LETTER TAW;Lo;0;R;;;;;N;;;;; +10B99;PSALTER PAHLAVI SECTION MARK;Po;0;R;;;;;N;;;;; +10B9A;PSALTER PAHLAVI TURNED SECTION MARK;Po;0;R;;;;;N;;;;; +10B9B;PSALTER PAHLAVI FOUR DOTS WITH CROSS;Po;0;R;;;;;N;;;;; +10B9C;PSALTER PAHLAVI FOUR DOTS WITH DOT;Po;0;R;;;;;N;;;;; +10BA9;PSALTER PAHLAVI NUMBER ONE;No;0;R;;;;1;N;;;;; +10BAA;PSALTER PAHLAVI NUMBER TWO;No;0;R;;;;2;N;;;;; +10BAB;PSALTER PAHLAVI NUMBER THREE;No;0;R;;;;3;N;;;;; +10BAC;PSALTER PAHLAVI NUMBER FOUR;No;0;R;;;;4;N;;;;; +10BAD;PSALTER PAHLAVI NUMBER TEN;No;0;R;;;;10;N;;;;; +10BAE;PSALTER PAHLAVI NUMBER TWENTY;No;0;R;;;;20;N;;;;; +10BAF;PSALTER PAHLAVI NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10C00;OLD TURKIC LETTER ORKHON A;Lo;0;R;;;;;N;;;;; +10C01;OLD TURKIC LETTER YENISEI A;Lo;0;R;;;;;N;;;;; +10C02;OLD TURKIC LETTER YENISEI AE;Lo;0;R;;;;;N;;;;; +10C03;OLD TURKIC LETTER ORKHON I;Lo;0;R;;;;;N;;;;; +10C04;OLD TURKIC LETTER YENISEI I;Lo;0;R;;;;;N;;;;; +10C05;OLD TURKIC LETTER YENISEI E;Lo;0;R;;;;;N;;;;; +10C06;OLD TURKIC LETTER ORKHON O;Lo;0;R;;;;;N;;;;; +10C07;OLD TURKIC LETTER ORKHON OE;Lo;0;R;;;;;N;;;;; +10C08;OLD TURKIC LETTER YENISEI OE;Lo;0;R;;;;;N;;;;; +10C09;OLD TURKIC LETTER ORKHON AB;Lo;0;R;;;;;N;;;;; +10C0A;OLD TURKIC LETTER YENISEI AB;Lo;0;R;;;;;N;;;;; +10C0B;OLD TURKIC LETTER ORKHON AEB;Lo;0;R;;;;;N;;;;; +10C0C;OLD TURKIC LETTER YENISEI AEB;Lo;0;R;;;;;N;;;;; +10C0D;OLD TURKIC LETTER ORKHON AG;Lo;0;R;;;;;N;;;;; +10C0E;OLD TURKIC LETTER YENISEI AG;Lo;0;R;;;;;N;;;;; +10C0F;OLD TURKIC LETTER ORKHON AEG;Lo;0;R;;;;;N;;;;; +10C10;OLD TURKIC LETTER YENISEI AEG;Lo;0;R;;;;;N;;;;; +10C11;OLD TURKIC LETTER ORKHON AD;Lo;0;R;;;;;N;;;;; +10C12;OLD TURKIC LETTER YENISEI AD;Lo;0;R;;;;;N;;;;; +10C13;OLD TURKIC LETTER ORKHON AED;Lo;0;R;;;;;N;;;;; +10C14;OLD TURKIC LETTER ORKHON EZ;Lo;0;R;;;;;N;;;;; +10C15;OLD TURKIC LETTER YENISEI EZ;Lo;0;R;;;;;N;;;;; +10C16;OLD TURKIC LETTER ORKHON AY;Lo;0;R;;;;;N;;;;; +10C17;OLD TURKIC LETTER YENISEI AY;Lo;0;R;;;;;N;;;;; +10C18;OLD TURKIC LETTER ORKHON AEY;Lo;0;R;;;;;N;;;;; +10C19;OLD TURKIC LETTER YENISEI AEY;Lo;0;R;;;;;N;;;;; +10C1A;OLD TURKIC LETTER ORKHON AEK;Lo;0;R;;;;;N;;;;; +10C1B;OLD TURKIC LETTER YENISEI AEK;Lo;0;R;;;;;N;;;;; +10C1C;OLD TURKIC LETTER ORKHON OEK;Lo;0;R;;;;;N;;;;; +10C1D;OLD TURKIC LETTER YENISEI OEK;Lo;0;R;;;;;N;;;;; +10C1E;OLD TURKIC LETTER ORKHON AL;Lo;0;R;;;;;N;;;;; +10C1F;OLD TURKIC LETTER YENISEI AL;Lo;0;R;;;;;N;;;;; +10C20;OLD TURKIC LETTER ORKHON AEL;Lo;0;R;;;;;N;;;;; +10C21;OLD TURKIC LETTER ORKHON ELT;Lo;0;R;;;;;N;;;;; +10C22;OLD TURKIC LETTER ORKHON EM;Lo;0;R;;;;;N;;;;; +10C23;OLD TURKIC LETTER ORKHON AN;Lo;0;R;;;;;N;;;;; +10C24;OLD TURKIC LETTER ORKHON AEN;Lo;0;R;;;;;N;;;;; +10C25;OLD TURKIC LETTER YENISEI AEN;Lo;0;R;;;;;N;;;;; +10C26;OLD TURKIC LETTER ORKHON ENT;Lo;0;R;;;;;N;;;;; +10C27;OLD TURKIC LETTER YENISEI ENT;Lo;0;R;;;;;N;;;;; +10C28;OLD TURKIC LETTER ORKHON ENC;Lo;0;R;;;;;N;;;;; +10C29;OLD TURKIC LETTER YENISEI ENC;Lo;0;R;;;;;N;;;;; +10C2A;OLD TURKIC LETTER ORKHON ENY;Lo;0;R;;;;;N;;;;; +10C2B;OLD TURKIC LETTER YENISEI ENY;Lo;0;R;;;;;N;;;;; +10C2C;OLD TURKIC LETTER YENISEI ANG;Lo;0;R;;;;;N;;;;; +10C2D;OLD TURKIC LETTER ORKHON ENG;Lo;0;R;;;;;N;;;;; +10C2E;OLD TURKIC LETTER YENISEI AENG;Lo;0;R;;;;;N;;;;; +10C2F;OLD TURKIC LETTER ORKHON EP;Lo;0;R;;;;;N;;;;; +10C30;OLD TURKIC LETTER ORKHON OP;Lo;0;R;;;;;N;;;;; +10C31;OLD TURKIC LETTER ORKHON IC;Lo;0;R;;;;;N;;;;; +10C32;OLD TURKIC LETTER ORKHON EC;Lo;0;R;;;;;N;;;;; +10C33;OLD TURKIC LETTER YENISEI EC;Lo;0;R;;;;;N;;;;; +10C34;OLD TURKIC LETTER ORKHON AQ;Lo;0;R;;;;;N;;;;; +10C35;OLD TURKIC LETTER YENISEI AQ;Lo;0;R;;;;;N;;;;; +10C36;OLD TURKIC LETTER ORKHON IQ;Lo;0;R;;;;;N;;;;; +10C37;OLD TURKIC LETTER YENISEI IQ;Lo;0;R;;;;;N;;;;; +10C38;OLD TURKIC LETTER ORKHON OQ;Lo;0;R;;;;;N;;;;; +10C39;OLD TURKIC LETTER YENISEI OQ;Lo;0;R;;;;;N;;;;; +10C3A;OLD TURKIC LETTER ORKHON AR;Lo;0;R;;;;;N;;;;; +10C3B;OLD TURKIC LETTER YENISEI AR;Lo;0;R;;;;;N;;;;; +10C3C;OLD TURKIC LETTER ORKHON AER;Lo;0;R;;;;;N;;;;; +10C3D;OLD TURKIC LETTER ORKHON AS;Lo;0;R;;;;;N;;;;; +10C3E;OLD TURKIC LETTER ORKHON AES;Lo;0;R;;;;;N;;;;; +10C3F;OLD TURKIC LETTER ORKHON ASH;Lo;0;R;;;;;N;;;;; +10C40;OLD TURKIC LETTER YENISEI ASH;Lo;0;R;;;;;N;;;;; +10C41;OLD TURKIC LETTER ORKHON ESH;Lo;0;R;;;;;N;;;;; +10C42;OLD TURKIC LETTER YENISEI ESH;Lo;0;R;;;;;N;;;;; +10C43;OLD TURKIC LETTER ORKHON AT;Lo;0;R;;;;;N;;;;; +10C44;OLD TURKIC LETTER YENISEI AT;Lo;0;R;;;;;N;;;;; +10C45;OLD TURKIC LETTER ORKHON AET;Lo;0;R;;;;;N;;;;; +10C46;OLD TURKIC LETTER YENISEI AET;Lo;0;R;;;;;N;;;;; +10C47;OLD TURKIC LETTER ORKHON OT;Lo;0;R;;;;;N;;;;; +10C48;OLD TURKIC LETTER ORKHON BASH;Lo;0;R;;;;;N;;;;; +10C80;OLD HUNGARIAN CAPITAL LETTER A;Lu;0;R;;;;;N;;;;10CC0; +10C81;OLD HUNGARIAN CAPITAL LETTER AA;Lu;0;R;;;;;N;;;;10CC1; +10C82;OLD HUNGARIAN CAPITAL LETTER EB;Lu;0;R;;;;;N;;;;10CC2; +10C83;OLD HUNGARIAN CAPITAL LETTER AMB;Lu;0;R;;;;;N;;;;10CC3; +10C84;OLD HUNGARIAN CAPITAL LETTER EC;Lu;0;R;;;;;N;;;;10CC4; +10C85;OLD HUNGARIAN CAPITAL LETTER ENC;Lu;0;R;;;;;N;;;;10CC5; +10C86;OLD HUNGARIAN CAPITAL LETTER ECS;Lu;0;R;;;;;N;;;;10CC6; +10C87;OLD HUNGARIAN CAPITAL LETTER ED;Lu;0;R;;;;;N;;;;10CC7; +10C88;OLD HUNGARIAN CAPITAL LETTER AND;Lu;0;R;;;;;N;;;;10CC8; +10C89;OLD HUNGARIAN CAPITAL LETTER E;Lu;0;R;;;;;N;;;;10CC9; +10C8A;OLD HUNGARIAN CAPITAL LETTER CLOSE E;Lu;0;R;;;;;N;;;;10CCA; +10C8B;OLD HUNGARIAN CAPITAL LETTER EE;Lu;0;R;;;;;N;;;;10CCB; +10C8C;OLD HUNGARIAN CAPITAL LETTER EF;Lu;0;R;;;;;N;;;;10CCC; +10C8D;OLD HUNGARIAN CAPITAL LETTER EG;Lu;0;R;;;;;N;;;;10CCD; +10C8E;OLD HUNGARIAN CAPITAL LETTER EGY;Lu;0;R;;;;;N;;;;10CCE; +10C8F;OLD HUNGARIAN CAPITAL LETTER EH;Lu;0;R;;;;;N;;;;10CCF; +10C90;OLD HUNGARIAN CAPITAL LETTER I;Lu;0;R;;;;;N;;;;10CD0; +10C91;OLD HUNGARIAN CAPITAL LETTER II;Lu;0;R;;;;;N;;;;10CD1; +10C92;OLD HUNGARIAN CAPITAL LETTER EJ;Lu;0;R;;;;;N;;;;10CD2; +10C93;OLD HUNGARIAN CAPITAL LETTER EK;Lu;0;R;;;;;N;;;;10CD3; +10C94;OLD HUNGARIAN CAPITAL LETTER AK;Lu;0;R;;;;;N;;;;10CD4; +10C95;OLD HUNGARIAN CAPITAL LETTER UNK;Lu;0;R;;;;;N;;;;10CD5; +10C96;OLD HUNGARIAN CAPITAL LETTER EL;Lu;0;R;;;;;N;;;;10CD6; +10C97;OLD HUNGARIAN CAPITAL LETTER ELY;Lu;0;R;;;;;N;;;;10CD7; +10C98;OLD HUNGARIAN CAPITAL LETTER EM;Lu;0;R;;;;;N;;;;10CD8; +10C99;OLD HUNGARIAN CAPITAL LETTER EN;Lu;0;R;;;;;N;;;;10CD9; +10C9A;OLD HUNGARIAN CAPITAL LETTER ENY;Lu;0;R;;;;;N;;;;10CDA; +10C9B;OLD HUNGARIAN CAPITAL LETTER O;Lu;0;R;;;;;N;;;;10CDB; +10C9C;OLD HUNGARIAN CAPITAL LETTER OO;Lu;0;R;;;;;N;;;;10CDC; +10C9D;OLD HUNGARIAN CAPITAL LETTER NIKOLSBURG OE;Lu;0;R;;;;;N;;;;10CDD; +10C9E;OLD HUNGARIAN CAPITAL LETTER RUDIMENTA OE;Lu;0;R;;;;;N;;;;10CDE; +10C9F;OLD HUNGARIAN CAPITAL LETTER OEE;Lu;0;R;;;;;N;;;;10CDF; +10CA0;OLD HUNGARIAN CAPITAL LETTER EP;Lu;0;R;;;;;N;;;;10CE0; +10CA1;OLD HUNGARIAN CAPITAL LETTER EMP;Lu;0;R;;;;;N;;;;10CE1; +10CA2;OLD HUNGARIAN CAPITAL LETTER ER;Lu;0;R;;;;;N;;;;10CE2; +10CA3;OLD HUNGARIAN CAPITAL LETTER SHORT ER;Lu;0;R;;;;;N;;;;10CE3; +10CA4;OLD HUNGARIAN CAPITAL LETTER ES;Lu;0;R;;;;;N;;;;10CE4; +10CA5;OLD HUNGARIAN CAPITAL LETTER ESZ;Lu;0;R;;;;;N;;;;10CE5; +10CA6;OLD HUNGARIAN CAPITAL LETTER ET;Lu;0;R;;;;;N;;;;10CE6; +10CA7;OLD HUNGARIAN CAPITAL LETTER ENT;Lu;0;R;;;;;N;;;;10CE7; +10CA8;OLD HUNGARIAN CAPITAL LETTER ETY;Lu;0;R;;;;;N;;;;10CE8; +10CA9;OLD HUNGARIAN CAPITAL LETTER ECH;Lu;0;R;;;;;N;;;;10CE9; +10CAA;OLD HUNGARIAN CAPITAL LETTER U;Lu;0;R;;;;;N;;;;10CEA; +10CAB;OLD HUNGARIAN CAPITAL LETTER UU;Lu;0;R;;;;;N;;;;10CEB; +10CAC;OLD HUNGARIAN CAPITAL LETTER NIKOLSBURG UE;Lu;0;R;;;;;N;;;;10CEC; +10CAD;OLD HUNGARIAN CAPITAL LETTER RUDIMENTA UE;Lu;0;R;;;;;N;;;;10CED; +10CAE;OLD HUNGARIAN CAPITAL LETTER EV;Lu;0;R;;;;;N;;;;10CEE; +10CAF;OLD HUNGARIAN CAPITAL LETTER EZ;Lu;0;R;;;;;N;;;;10CEF; +10CB0;OLD HUNGARIAN CAPITAL LETTER EZS;Lu;0;R;;;;;N;;;;10CF0; +10CB1;OLD HUNGARIAN CAPITAL LETTER ENT-SHAPED SIGN;Lu;0;R;;;;;N;;;;10CF1; +10CB2;OLD HUNGARIAN CAPITAL LETTER US;Lu;0;R;;;;;N;;;;10CF2; +10CC0;OLD HUNGARIAN SMALL LETTER A;Ll;0;R;;;;;N;;;10C80;;10C80 +10CC1;OLD HUNGARIAN SMALL LETTER AA;Ll;0;R;;;;;N;;;10C81;;10C81 +10CC2;OLD HUNGARIAN SMALL LETTER EB;Ll;0;R;;;;;N;;;10C82;;10C82 +10CC3;OLD HUNGARIAN SMALL LETTER AMB;Ll;0;R;;;;;N;;;10C83;;10C83 +10CC4;OLD HUNGARIAN SMALL LETTER EC;Ll;0;R;;;;;N;;;10C84;;10C84 +10CC5;OLD HUNGARIAN SMALL LETTER ENC;Ll;0;R;;;;;N;;;10C85;;10C85 +10CC6;OLD HUNGARIAN SMALL LETTER ECS;Ll;0;R;;;;;N;;;10C86;;10C86 +10CC7;OLD HUNGARIAN SMALL LETTER ED;Ll;0;R;;;;;N;;;10C87;;10C87 +10CC8;OLD HUNGARIAN SMALL LETTER AND;Ll;0;R;;;;;N;;;10C88;;10C88 +10CC9;OLD HUNGARIAN SMALL LETTER E;Ll;0;R;;;;;N;;;10C89;;10C89 +10CCA;OLD HUNGARIAN SMALL LETTER CLOSE E;Ll;0;R;;;;;N;;;10C8A;;10C8A +10CCB;OLD HUNGARIAN SMALL LETTER EE;Ll;0;R;;;;;N;;;10C8B;;10C8B +10CCC;OLD HUNGARIAN SMALL LETTER EF;Ll;0;R;;;;;N;;;10C8C;;10C8C +10CCD;OLD HUNGARIAN SMALL LETTER EG;Ll;0;R;;;;;N;;;10C8D;;10C8D +10CCE;OLD HUNGARIAN SMALL LETTER EGY;Ll;0;R;;;;;N;;;10C8E;;10C8E +10CCF;OLD HUNGARIAN SMALL LETTER EH;Ll;0;R;;;;;N;;;10C8F;;10C8F +10CD0;OLD HUNGARIAN SMALL LETTER I;Ll;0;R;;;;;N;;;10C90;;10C90 +10CD1;OLD HUNGARIAN SMALL LETTER II;Ll;0;R;;;;;N;;;10C91;;10C91 +10CD2;OLD HUNGARIAN SMALL LETTER EJ;Ll;0;R;;;;;N;;;10C92;;10C92 +10CD3;OLD HUNGARIAN SMALL LETTER EK;Ll;0;R;;;;;N;;;10C93;;10C93 +10CD4;OLD HUNGARIAN SMALL LETTER AK;Ll;0;R;;;;;N;;;10C94;;10C94 +10CD5;OLD HUNGARIAN SMALL LETTER UNK;Ll;0;R;;;;;N;;;10C95;;10C95 +10CD6;OLD HUNGARIAN SMALL LETTER EL;Ll;0;R;;;;;N;;;10C96;;10C96 +10CD7;OLD HUNGARIAN SMALL LETTER ELY;Ll;0;R;;;;;N;;;10C97;;10C97 +10CD8;OLD HUNGARIAN SMALL LETTER EM;Ll;0;R;;;;;N;;;10C98;;10C98 +10CD9;OLD HUNGARIAN SMALL LETTER EN;Ll;0;R;;;;;N;;;10C99;;10C99 +10CDA;OLD HUNGARIAN SMALL LETTER ENY;Ll;0;R;;;;;N;;;10C9A;;10C9A +10CDB;OLD HUNGARIAN SMALL LETTER O;Ll;0;R;;;;;N;;;10C9B;;10C9B +10CDC;OLD HUNGARIAN SMALL LETTER OO;Ll;0;R;;;;;N;;;10C9C;;10C9C +10CDD;OLD HUNGARIAN SMALL LETTER NIKOLSBURG OE;Ll;0;R;;;;;N;;;10C9D;;10C9D +10CDE;OLD HUNGARIAN SMALL LETTER RUDIMENTA OE;Ll;0;R;;;;;N;;;10C9E;;10C9E +10CDF;OLD HUNGARIAN SMALL LETTER OEE;Ll;0;R;;;;;N;;;10C9F;;10C9F +10CE0;OLD HUNGARIAN SMALL LETTER EP;Ll;0;R;;;;;N;;;10CA0;;10CA0 +10CE1;OLD HUNGARIAN SMALL LETTER EMP;Ll;0;R;;;;;N;;;10CA1;;10CA1 +10CE2;OLD HUNGARIAN SMALL LETTER ER;Ll;0;R;;;;;N;;;10CA2;;10CA2 +10CE3;OLD HUNGARIAN SMALL LETTER SHORT ER;Ll;0;R;;;;;N;;;10CA3;;10CA3 +10CE4;OLD HUNGARIAN SMALL LETTER ES;Ll;0;R;;;;;N;;;10CA4;;10CA4 +10CE5;OLD HUNGARIAN SMALL LETTER ESZ;Ll;0;R;;;;;N;;;10CA5;;10CA5 +10CE6;OLD HUNGARIAN SMALL LETTER ET;Ll;0;R;;;;;N;;;10CA6;;10CA6 +10CE7;OLD HUNGARIAN SMALL LETTER ENT;Ll;0;R;;;;;N;;;10CA7;;10CA7 +10CE8;OLD HUNGARIAN SMALL LETTER ETY;Ll;0;R;;;;;N;;;10CA8;;10CA8 +10CE9;OLD HUNGARIAN SMALL LETTER ECH;Ll;0;R;;;;;N;;;10CA9;;10CA9 +10CEA;OLD HUNGARIAN SMALL LETTER U;Ll;0;R;;;;;N;;;10CAA;;10CAA +10CEB;OLD HUNGARIAN SMALL LETTER UU;Ll;0;R;;;;;N;;;10CAB;;10CAB +10CEC;OLD HUNGARIAN SMALL LETTER NIKOLSBURG UE;Ll;0;R;;;;;N;;;10CAC;;10CAC +10CED;OLD HUNGARIAN SMALL LETTER RUDIMENTA UE;Ll;0;R;;;;;N;;;10CAD;;10CAD +10CEE;OLD HUNGARIAN SMALL LETTER EV;Ll;0;R;;;;;N;;;10CAE;;10CAE +10CEF;OLD HUNGARIAN SMALL LETTER EZ;Ll;0;R;;;;;N;;;10CAF;;10CAF +10CF0;OLD HUNGARIAN SMALL LETTER EZS;Ll;0;R;;;;;N;;;10CB0;;10CB0 +10CF1;OLD HUNGARIAN SMALL LETTER ENT-SHAPED SIGN;Ll;0;R;;;;;N;;;10CB1;;10CB1 +10CF2;OLD HUNGARIAN SMALL LETTER US;Ll;0;R;;;;;N;;;10CB2;;10CB2 +10CFA;OLD HUNGARIAN NUMBER ONE;No;0;R;;;;1;N;;;;; +10CFB;OLD HUNGARIAN NUMBER FIVE;No;0;R;;;;5;N;;;;; +10CFC;OLD HUNGARIAN NUMBER TEN;No;0;R;;;;10;N;;;;; +10CFD;OLD HUNGARIAN NUMBER FIFTY;No;0;R;;;;50;N;;;;; +10CFE;OLD HUNGARIAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;; +10CFF;OLD HUNGARIAN NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;; +10E60;RUMI DIGIT ONE;No;0;AN;;;1;1;N;;;;; +10E61;RUMI DIGIT TWO;No;0;AN;;;2;2;N;;;;; +10E62;RUMI DIGIT THREE;No;0;AN;;;3;3;N;;;;; +10E63;RUMI DIGIT FOUR;No;0;AN;;;4;4;N;;;;; +10E64;RUMI DIGIT FIVE;No;0;AN;;;5;5;N;;;;; +10E65;RUMI DIGIT SIX;No;0;AN;;;6;6;N;;;;; +10E66;RUMI DIGIT SEVEN;No;0;AN;;;7;7;N;;;;; +10E67;RUMI DIGIT EIGHT;No;0;AN;;;8;8;N;;;;; +10E68;RUMI DIGIT NINE;No;0;AN;;;9;9;N;;;;; +10E69;RUMI NUMBER TEN;No;0;AN;;;;10;N;;;;; +10E6A;RUMI NUMBER TWENTY;No;0;AN;;;;20;N;;;;; +10E6B;RUMI NUMBER THIRTY;No;0;AN;;;;30;N;;;;; +10E6C;RUMI NUMBER FORTY;No;0;AN;;;;40;N;;;;; +10E6D;RUMI NUMBER FIFTY;No;0;AN;;;;50;N;;;;; +10E6E;RUMI NUMBER SIXTY;No;0;AN;;;;60;N;;;;; +10E6F;RUMI NUMBER SEVENTY;No;0;AN;;;;70;N;;;;; +10E70;RUMI NUMBER EIGHTY;No;0;AN;;;;80;N;;;;; +10E71;RUMI NUMBER NINETY;No;0;AN;;;;90;N;;;;; +10E72;RUMI NUMBER ONE HUNDRED;No;0;AN;;;;100;N;;;;; +10E73;RUMI NUMBER TWO HUNDRED;No;0;AN;;;;200;N;;;;; +10E74;RUMI NUMBER THREE HUNDRED;No;0;AN;;;;300;N;;;;; +10E75;RUMI NUMBER FOUR HUNDRED;No;0;AN;;;;400;N;;;;; +10E76;RUMI NUMBER FIVE HUNDRED;No;0;AN;;;;500;N;;;;; +10E77;RUMI NUMBER SIX HUNDRED;No;0;AN;;;;600;N;;;;; +10E78;RUMI NUMBER SEVEN HUNDRED;No;0;AN;;;;700;N;;;;; +10E79;RUMI NUMBER EIGHT HUNDRED;No;0;AN;;;;800;N;;;;; +10E7A;RUMI NUMBER NINE HUNDRED;No;0;AN;;;;900;N;;;;; +10E7B;RUMI FRACTION ONE HALF;No;0;AN;;;;1/2;N;;;;; +10E7C;RUMI FRACTION ONE QUARTER;No;0;AN;;;;1/4;N;;;;; +10E7D;RUMI FRACTION ONE THIRD;No;0;AN;;;;1/3;N;;;;; +10E7E;RUMI FRACTION TWO THIRDS;No;0;AN;;;;2/3;N;;;;; +11000;BRAHMI SIGN CANDRABINDU;Mc;0;L;;;;;N;;;;; +11001;BRAHMI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11002;BRAHMI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11003;BRAHMI SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;; +11004;BRAHMI SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;; +11005;BRAHMI LETTER A;Lo;0;L;;;;;N;;;;; +11006;BRAHMI LETTER AA;Lo;0;L;;;;;N;;;;; +11007;BRAHMI LETTER I;Lo;0;L;;;;;N;;;;; +11008;BRAHMI LETTER II;Lo;0;L;;;;;N;;;;; +11009;BRAHMI LETTER U;Lo;0;L;;;;;N;;;;; +1100A;BRAHMI LETTER UU;Lo;0;L;;;;;N;;;;; +1100B;BRAHMI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +1100C;BRAHMI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +1100D;BRAHMI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +1100E;BRAHMI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1100F;BRAHMI LETTER E;Lo;0;L;;;;;N;;;;; +11010;BRAHMI LETTER AI;Lo;0;L;;;;;N;;;;; +11011;BRAHMI LETTER O;Lo;0;L;;;;;N;;;;; +11012;BRAHMI LETTER AU;Lo;0;L;;;;;N;;;;; +11013;BRAHMI LETTER KA;Lo;0;L;;;;;N;;;;; +11014;BRAHMI LETTER KHA;Lo;0;L;;;;;N;;;;; +11015;BRAHMI LETTER GA;Lo;0;L;;;;;N;;;;; +11016;BRAHMI LETTER GHA;Lo;0;L;;;;;N;;;;; +11017;BRAHMI LETTER NGA;Lo;0;L;;;;;N;;;;; +11018;BRAHMI LETTER CA;Lo;0;L;;;;;N;;;;; +11019;BRAHMI LETTER CHA;Lo;0;L;;;;;N;;;;; +1101A;BRAHMI LETTER JA;Lo;0;L;;;;;N;;;;; +1101B;BRAHMI LETTER JHA;Lo;0;L;;;;;N;;;;; +1101C;BRAHMI LETTER NYA;Lo;0;L;;;;;N;;;;; +1101D;BRAHMI LETTER TTA;Lo;0;L;;;;;N;;;;; +1101E;BRAHMI LETTER TTHA;Lo;0;L;;;;;N;;;;; +1101F;BRAHMI LETTER DDA;Lo;0;L;;;;;N;;;;; +11020;BRAHMI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11021;BRAHMI LETTER NNA;Lo;0;L;;;;;N;;;;; +11022;BRAHMI LETTER TA;Lo;0;L;;;;;N;;;;; +11023;BRAHMI LETTER THA;Lo;0;L;;;;;N;;;;; +11024;BRAHMI LETTER DA;Lo;0;L;;;;;N;;;;; +11025;BRAHMI LETTER DHA;Lo;0;L;;;;;N;;;;; +11026;BRAHMI LETTER NA;Lo;0;L;;;;;N;;;;; +11027;BRAHMI LETTER PA;Lo;0;L;;;;;N;;;;; +11028;BRAHMI LETTER PHA;Lo;0;L;;;;;N;;;;; +11029;BRAHMI LETTER BA;Lo;0;L;;;;;N;;;;; +1102A;BRAHMI LETTER BHA;Lo;0;L;;;;;N;;;;; +1102B;BRAHMI LETTER MA;Lo;0;L;;;;;N;;;;; +1102C;BRAHMI LETTER YA;Lo;0;L;;;;;N;;;;; +1102D;BRAHMI LETTER RA;Lo;0;L;;;;;N;;;;; +1102E;BRAHMI LETTER LA;Lo;0;L;;;;;N;;;;; +1102F;BRAHMI LETTER VA;Lo;0;L;;;;;N;;;;; +11030;BRAHMI LETTER SHA;Lo;0;L;;;;;N;;;;; +11031;BRAHMI LETTER SSA;Lo;0;L;;;;;N;;;;; +11032;BRAHMI LETTER SA;Lo;0;L;;;;;N;;;;; +11033;BRAHMI LETTER HA;Lo;0;L;;;;;N;;;;; +11034;BRAHMI LETTER LLA;Lo;0;L;;;;;N;;;;; +11035;BRAHMI LETTER OLD TAMIL LLLA;Lo;0;L;;;;;N;;;;; +11036;BRAHMI LETTER OLD TAMIL RRA;Lo;0;L;;;;;N;;;;; +11037;BRAHMI LETTER OLD TAMIL NNNA;Lo;0;L;;;;;N;;;;; +11038;BRAHMI VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +11039;BRAHMI VOWEL SIGN BHATTIPROLU AA;Mn;0;NSM;;;;;N;;;;; +1103A;BRAHMI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +1103B;BRAHMI VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +1103C;BRAHMI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1103D;BRAHMI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +1103E;BRAHMI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +1103F;BRAHMI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +11040;BRAHMI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +11041;BRAHMI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +11042;BRAHMI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11043;BRAHMI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11044;BRAHMI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11045;BRAHMI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +11046;BRAHMI VIRAMA;Mn;9;NSM;;;;;N;;;;; +11047;BRAHMI DANDA;Po;0;L;;;;;N;;;;; +11048;BRAHMI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +11049;BRAHMI PUNCTUATION DOT;Po;0;L;;;;;N;;;;; +1104A;BRAHMI PUNCTUATION DOUBLE DOT;Po;0;L;;;;;N;;;;; +1104B;BRAHMI PUNCTUATION LINE;Po;0;L;;;;;N;;;;; +1104C;BRAHMI PUNCTUATION CRESCENT BAR;Po;0;L;;;;;N;;;;; +1104D;BRAHMI PUNCTUATION LOTUS;Po;0;L;;;;;N;;;;; +11052;BRAHMI NUMBER ONE;No;0;ON;;;1;1;N;;;;; +11053;BRAHMI NUMBER TWO;No;0;ON;;;2;2;N;;;;; +11054;BRAHMI NUMBER THREE;No;0;ON;;;3;3;N;;;;; +11055;BRAHMI NUMBER FOUR;No;0;ON;;;4;4;N;;;;; +11056;BRAHMI NUMBER FIVE;No;0;ON;;;5;5;N;;;;; +11057;BRAHMI NUMBER SIX;No;0;ON;;;6;6;N;;;;; +11058;BRAHMI NUMBER SEVEN;No;0;ON;;;7;7;N;;;;; +11059;BRAHMI NUMBER EIGHT;No;0;ON;;;8;8;N;;;;; +1105A;BRAHMI NUMBER NINE;No;0;ON;;;9;9;N;;;;; +1105B;BRAHMI NUMBER TEN;No;0;ON;;;;10;N;;;;; +1105C;BRAHMI NUMBER TWENTY;No;0;ON;;;;20;N;;;;; +1105D;BRAHMI NUMBER THIRTY;No;0;ON;;;;30;N;;;;; +1105E;BRAHMI NUMBER FORTY;No;0;ON;;;;40;N;;;;; +1105F;BRAHMI NUMBER FIFTY;No;0;ON;;;;50;N;;;;; +11060;BRAHMI NUMBER SIXTY;No;0;ON;;;;60;N;;;;; +11061;BRAHMI NUMBER SEVENTY;No;0;ON;;;;70;N;;;;; +11062;BRAHMI NUMBER EIGHTY;No;0;ON;;;;80;N;;;;; +11063;BRAHMI NUMBER NINETY;No;0;ON;;;;90;N;;;;; +11064;BRAHMI NUMBER ONE HUNDRED;No;0;ON;;;;100;N;;;;; +11065;BRAHMI NUMBER ONE THOUSAND;No;0;ON;;;;1000;N;;;;; +11066;BRAHMI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11067;BRAHMI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11068;BRAHMI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11069;BRAHMI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1106A;BRAHMI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1106B;BRAHMI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1106C;BRAHMI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1106D;BRAHMI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1106E;BRAHMI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1106F;BRAHMI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1107F;BRAHMI NUMBER JOINER;Mn;9;NSM;;;;;N;;;;; +11080;KAITHI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11081;KAITHI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11082;KAITHI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11083;KAITHI LETTER A;Lo;0;L;;;;;N;;;;; +11084;KAITHI LETTER AA;Lo;0;L;;;;;N;;;;; +11085;KAITHI LETTER I;Lo;0;L;;;;;N;;;;; +11086;KAITHI LETTER II;Lo;0;L;;;;;N;;;;; +11087;KAITHI LETTER U;Lo;0;L;;;;;N;;;;; +11088;KAITHI LETTER UU;Lo;0;L;;;;;N;;;;; +11089;KAITHI LETTER E;Lo;0;L;;;;;N;;;;; +1108A;KAITHI LETTER AI;Lo;0;L;;;;;N;;;;; +1108B;KAITHI LETTER O;Lo;0;L;;;;;N;;;;; +1108C;KAITHI LETTER AU;Lo;0;L;;;;;N;;;;; +1108D;KAITHI LETTER KA;Lo;0;L;;;;;N;;;;; +1108E;KAITHI LETTER KHA;Lo;0;L;;;;;N;;;;; +1108F;KAITHI LETTER GA;Lo;0;L;;;;;N;;;;; +11090;KAITHI LETTER GHA;Lo;0;L;;;;;N;;;;; +11091;KAITHI LETTER NGA;Lo;0;L;;;;;N;;;;; +11092;KAITHI LETTER CA;Lo;0;L;;;;;N;;;;; +11093;KAITHI LETTER CHA;Lo;0;L;;;;;N;;;;; +11094;KAITHI LETTER JA;Lo;0;L;;;;;N;;;;; +11095;KAITHI LETTER JHA;Lo;0;L;;;;;N;;;;; +11096;KAITHI LETTER NYA;Lo;0;L;;;;;N;;;;; +11097;KAITHI LETTER TTA;Lo;0;L;;;;;N;;;;; +11098;KAITHI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11099;KAITHI LETTER DDA;Lo;0;L;;;;;N;;;;; +1109A;KAITHI LETTER DDDHA;Lo;0;L;11099 110BA;;;;N;;;;; +1109B;KAITHI LETTER DDHA;Lo;0;L;;;;;N;;;;; +1109C;KAITHI LETTER RHA;Lo;0;L;1109B 110BA;;;;N;;;;; +1109D;KAITHI LETTER NNA;Lo;0;L;;;;;N;;;;; +1109E;KAITHI LETTER TA;Lo;0;L;;;;;N;;;;; +1109F;KAITHI LETTER THA;Lo;0;L;;;;;N;;;;; +110A0;KAITHI LETTER DA;Lo;0;L;;;;;N;;;;; +110A1;KAITHI LETTER DHA;Lo;0;L;;;;;N;;;;; +110A2;KAITHI LETTER NA;Lo;0;L;;;;;N;;;;; +110A3;KAITHI LETTER PA;Lo;0;L;;;;;N;;;;; +110A4;KAITHI LETTER PHA;Lo;0;L;;;;;N;;;;; +110A5;KAITHI LETTER BA;Lo;0;L;;;;;N;;;;; +110A6;KAITHI LETTER BHA;Lo;0;L;;;;;N;;;;; +110A7;KAITHI LETTER MA;Lo;0;L;;;;;N;;;;; +110A8;KAITHI LETTER YA;Lo;0;L;;;;;N;;;;; +110A9;KAITHI LETTER RA;Lo;0;L;;;;;N;;;;; +110AA;KAITHI LETTER LA;Lo;0;L;;;;;N;;;;; +110AB;KAITHI LETTER VA;Lo;0;L;110A5 110BA;;;;N;;;;; +110AC;KAITHI LETTER SHA;Lo;0;L;;;;;N;;;;; +110AD;KAITHI LETTER SSA;Lo;0;L;;;;;N;;;;; +110AE;KAITHI LETTER SA;Lo;0;L;;;;;N;;;;; +110AF;KAITHI LETTER HA;Lo;0;L;;;;;N;;;;; +110B0;KAITHI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +110B1;KAITHI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +110B2;KAITHI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +110B3;KAITHI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +110B4;KAITHI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +110B5;KAITHI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +110B6;KAITHI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +110B7;KAITHI VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +110B8;KAITHI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +110B9;KAITHI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +110BA;KAITHI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +110BB;KAITHI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +110BC;KAITHI ENUMERATION SIGN;Po;0;L;;;;;N;;;;; +110BD;KAITHI NUMBER SIGN;Cf;0;L;;;;;N;;;;; +110BE;KAITHI SECTION MARK;Po;0;L;;;;;N;;;;; +110BF;KAITHI DOUBLE SECTION MARK;Po;0;L;;;;;N;;;;; +110C0;KAITHI DANDA;Po;0;L;;;;;N;;;;; +110C1;KAITHI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +110D0;SORA SOMPENG LETTER SAH;Lo;0;L;;;;;N;;;;; +110D1;SORA SOMPENG LETTER TAH;Lo;0;L;;;;;N;;;;; +110D2;SORA SOMPENG LETTER BAH;Lo;0;L;;;;;N;;;;; +110D3;SORA SOMPENG LETTER CAH;Lo;0;L;;;;;N;;;;; +110D4;SORA SOMPENG LETTER DAH;Lo;0;L;;;;;N;;;;; +110D5;SORA SOMPENG LETTER GAH;Lo;0;L;;;;;N;;;;; +110D6;SORA SOMPENG LETTER MAH;Lo;0;L;;;;;N;;;;; +110D7;SORA SOMPENG LETTER NGAH;Lo;0;L;;;;;N;;;;; +110D8;SORA SOMPENG LETTER LAH;Lo;0;L;;;;;N;;;;; +110D9;SORA SOMPENG LETTER NAH;Lo;0;L;;;;;N;;;;; +110DA;SORA SOMPENG LETTER VAH;Lo;0;L;;;;;N;;;;; +110DB;SORA SOMPENG LETTER PAH;Lo;0;L;;;;;N;;;;; +110DC;SORA SOMPENG LETTER YAH;Lo;0;L;;;;;N;;;;; +110DD;SORA SOMPENG LETTER RAH;Lo;0;L;;;;;N;;;;; +110DE;SORA SOMPENG LETTER HAH;Lo;0;L;;;;;N;;;;; +110DF;SORA SOMPENG LETTER KAH;Lo;0;L;;;;;N;;;;; +110E0;SORA SOMPENG LETTER JAH;Lo;0;L;;;;;N;;;;; +110E1;SORA SOMPENG LETTER NYAH;Lo;0;L;;;;;N;;;;; +110E2;SORA SOMPENG LETTER AH;Lo;0;L;;;;;N;;;;; +110E3;SORA SOMPENG LETTER EEH;Lo;0;L;;;;;N;;;;; +110E4;SORA SOMPENG LETTER IH;Lo;0;L;;;;;N;;;;; +110E5;SORA SOMPENG LETTER UH;Lo;0;L;;;;;N;;;;; +110E6;SORA SOMPENG LETTER OH;Lo;0;L;;;;;N;;;;; +110E7;SORA SOMPENG LETTER EH;Lo;0;L;;;;;N;;;;; +110E8;SORA SOMPENG LETTER MAE;Lo;0;L;;;;;N;;;;; +110F0;SORA SOMPENG DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +110F1;SORA SOMPENG DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +110F2;SORA SOMPENG DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +110F3;SORA SOMPENG DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +110F4;SORA SOMPENG DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +110F5;SORA SOMPENG DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +110F6;SORA SOMPENG DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +110F7;SORA SOMPENG DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +110F8;SORA SOMPENG DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +110F9;SORA SOMPENG DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11100;CHAKMA SIGN CANDRABINDU;Mn;230;NSM;;;;;N;;;;; +11101;CHAKMA SIGN ANUSVARA;Mn;230;NSM;;;;;N;;;;; +11102;CHAKMA SIGN VISARGA;Mn;230;NSM;;;;;N;;;;; +11103;CHAKMA LETTER AA;Lo;0;L;;;;;N;;;;; +11104;CHAKMA LETTER I;Lo;0;L;;;;;N;;;;; +11105;CHAKMA LETTER U;Lo;0;L;;;;;N;;;;; +11106;CHAKMA LETTER E;Lo;0;L;;;;;N;;;;; +11107;CHAKMA LETTER KAA;Lo;0;L;;;;;N;;;;; +11108;CHAKMA LETTER KHAA;Lo;0;L;;;;;N;;;;; +11109;CHAKMA LETTER GAA;Lo;0;L;;;;;N;;;;; +1110A;CHAKMA LETTER GHAA;Lo;0;L;;;;;N;;;;; +1110B;CHAKMA LETTER NGAA;Lo;0;L;;;;;N;;;;; +1110C;CHAKMA LETTER CAA;Lo;0;L;;;;;N;;;;; +1110D;CHAKMA LETTER CHAA;Lo;0;L;;;;;N;;;;; +1110E;CHAKMA LETTER JAA;Lo;0;L;;;;;N;;;;; +1110F;CHAKMA LETTER JHAA;Lo;0;L;;;;;N;;;;; +11110;CHAKMA LETTER NYAA;Lo;0;L;;;;;N;;;;; +11111;CHAKMA LETTER TTAA;Lo;0;L;;;;;N;;;;; +11112;CHAKMA LETTER TTHAA;Lo;0;L;;;;;N;;;;; +11113;CHAKMA LETTER DDAA;Lo;0;L;;;;;N;;;;; +11114;CHAKMA LETTER DDHAA;Lo;0;L;;;;;N;;;;; +11115;CHAKMA LETTER NNAA;Lo;0;L;;;;;N;;;;; +11116;CHAKMA LETTER TAA;Lo;0;L;;;;;N;;;;; +11117;CHAKMA LETTER THAA;Lo;0;L;;;;;N;;;;; +11118;CHAKMA LETTER DAA;Lo;0;L;;;;;N;;;;; +11119;CHAKMA LETTER DHAA;Lo;0;L;;;;;N;;;;; +1111A;CHAKMA LETTER NAA;Lo;0;L;;;;;N;;;;; +1111B;CHAKMA LETTER PAA;Lo;0;L;;;;;N;;;;; +1111C;CHAKMA LETTER PHAA;Lo;0;L;;;;;N;;;;; +1111D;CHAKMA LETTER BAA;Lo;0;L;;;;;N;;;;; +1111E;CHAKMA LETTER BHAA;Lo;0;L;;;;;N;;;;; +1111F;CHAKMA LETTER MAA;Lo;0;L;;;;;N;;;;; +11120;CHAKMA LETTER YYAA;Lo;0;L;;;;;N;;;;; +11121;CHAKMA LETTER YAA;Lo;0;L;;;;;N;;;;; +11122;CHAKMA LETTER RAA;Lo;0;L;;;;;N;;;;; +11123;CHAKMA LETTER LAA;Lo;0;L;;;;;N;;;;; +11124;CHAKMA LETTER WAA;Lo;0;L;;;;;N;;;;; +11125;CHAKMA LETTER SAA;Lo;0;L;;;;;N;;;;; +11126;CHAKMA LETTER HAA;Lo;0;L;;;;;N;;;;; +11127;CHAKMA VOWEL SIGN A;Mn;0;NSM;;;;;N;;;;; +11128;CHAKMA VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11129;CHAKMA VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +1112A;CHAKMA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +1112B;CHAKMA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +1112C;CHAKMA VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +1112D;CHAKMA VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +1112E;CHAKMA VOWEL SIGN O;Mn;0;NSM;11131 11127;;;;N;;;;; +1112F;CHAKMA VOWEL SIGN AU;Mn;0;NSM;11132 11127;;;;N;;;;; +11130;CHAKMA VOWEL SIGN OI;Mn;0;NSM;;;;;N;;;;; +11131;CHAKMA O MARK;Mn;0;NSM;;;;;N;;;;; +11132;CHAKMA AU MARK;Mn;0;NSM;;;;;N;;;;; +11133;CHAKMA VIRAMA;Mn;9;NSM;;;;;N;;;;; +11134;CHAKMA MAAYYAA;Mn;9;NSM;;;;;N;;;;; +11136;CHAKMA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11137;CHAKMA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11138;CHAKMA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11139;CHAKMA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +1113A;CHAKMA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +1113B;CHAKMA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +1113C;CHAKMA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +1113D;CHAKMA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +1113E;CHAKMA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +1113F;CHAKMA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11140;CHAKMA SECTION MARK;Po;0;L;;;;;N;;;;; +11141;CHAKMA DANDA;Po;0;L;;;;;N;;;;; +11142;CHAKMA DOUBLE DANDA;Po;0;L;;;;;N;;;;; +11143;CHAKMA QUESTION MARK;Po;0;L;;;;;N;;;;; +11150;MAHAJANI LETTER A;Lo;0;L;;;;;N;;;;; +11151;MAHAJANI LETTER I;Lo;0;L;;;;;N;;;;; +11152;MAHAJANI LETTER U;Lo;0;L;;;;;N;;;;; +11153;MAHAJANI LETTER E;Lo;0;L;;;;;N;;;;; +11154;MAHAJANI LETTER O;Lo;0;L;;;;;N;;;;; +11155;MAHAJANI LETTER KA;Lo;0;L;;;;;N;;;;; +11156;MAHAJANI LETTER KHA;Lo;0;L;;;;;N;;;;; +11157;MAHAJANI LETTER GA;Lo;0;L;;;;;N;;;;; +11158;MAHAJANI LETTER GHA;Lo;0;L;;;;;N;;;;; +11159;MAHAJANI LETTER CA;Lo;0;L;;;;;N;;;;; +1115A;MAHAJANI LETTER CHA;Lo;0;L;;;;;N;;;;; +1115B;MAHAJANI LETTER JA;Lo;0;L;;;;;N;;;;; +1115C;MAHAJANI LETTER JHA;Lo;0;L;;;;;N;;;;; +1115D;MAHAJANI LETTER NYA;Lo;0;L;;;;;N;;;;; +1115E;MAHAJANI LETTER TTA;Lo;0;L;;;;;N;;;;; +1115F;MAHAJANI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11160;MAHAJANI LETTER DDA;Lo;0;L;;;;;N;;;;; +11161;MAHAJANI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11162;MAHAJANI LETTER NNA;Lo;0;L;;;;;N;;;;; +11163;MAHAJANI LETTER TA;Lo;0;L;;;;;N;;;;; +11164;MAHAJANI LETTER THA;Lo;0;L;;;;;N;;;;; +11165;MAHAJANI LETTER DA;Lo;0;L;;;;;N;;;;; +11166;MAHAJANI LETTER DHA;Lo;0;L;;;;;N;;;;; +11167;MAHAJANI LETTER NA;Lo;0;L;;;;;N;;;;; +11168;MAHAJANI LETTER PA;Lo;0;L;;;;;N;;;;; +11169;MAHAJANI LETTER PHA;Lo;0;L;;;;;N;;;;; +1116A;MAHAJANI LETTER BA;Lo;0;L;;;;;N;;;;; +1116B;MAHAJANI LETTER BHA;Lo;0;L;;;;;N;;;;; +1116C;MAHAJANI LETTER MA;Lo;0;L;;;;;N;;;;; +1116D;MAHAJANI LETTER RA;Lo;0;L;;;;;N;;;;; +1116E;MAHAJANI LETTER LA;Lo;0;L;;;;;N;;;;; +1116F;MAHAJANI LETTER VA;Lo;0;L;;;;;N;;;;; +11170;MAHAJANI LETTER SA;Lo;0;L;;;;;N;;;;; +11171;MAHAJANI LETTER HA;Lo;0;L;;;;;N;;;;; +11172;MAHAJANI LETTER RRA;Lo;0;L;;;;;N;;;;; +11173;MAHAJANI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +11174;MAHAJANI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +11175;MAHAJANI SECTION MARK;Po;0;L;;;;;N;;;;; +11176;MAHAJANI LIGATURE SHRI;Lo;0;L;;;;;N;;;;; +11180;SHARADA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11181;SHARADA SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11182;SHARADA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11183;SHARADA LETTER A;Lo;0;L;;;;;N;;;;; +11184;SHARADA LETTER AA;Lo;0;L;;;;;N;;;;; +11185;SHARADA LETTER I;Lo;0;L;;;;;N;;;;; +11186;SHARADA LETTER II;Lo;0;L;;;;;N;;;;; +11187;SHARADA LETTER U;Lo;0;L;;;;;N;;;;; +11188;SHARADA LETTER UU;Lo;0;L;;;;;N;;;;; +11189;SHARADA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +1118A;SHARADA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +1118B;SHARADA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +1118C;SHARADA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1118D;SHARADA LETTER E;Lo;0;L;;;;;N;;;;; +1118E;SHARADA LETTER AI;Lo;0;L;;;;;N;;;;; +1118F;SHARADA LETTER O;Lo;0;L;;;;;N;;;;; +11190;SHARADA LETTER AU;Lo;0;L;;;;;N;;;;; +11191;SHARADA LETTER KA;Lo;0;L;;;;;N;;;;; +11192;SHARADA LETTER KHA;Lo;0;L;;;;;N;;;;; +11193;SHARADA LETTER GA;Lo;0;L;;;;;N;;;;; +11194;SHARADA LETTER GHA;Lo;0;L;;;;;N;;;;; +11195;SHARADA LETTER NGA;Lo;0;L;;;;;N;;;;; +11196;SHARADA LETTER CA;Lo;0;L;;;;;N;;;;; +11197;SHARADA LETTER CHA;Lo;0;L;;;;;N;;;;; +11198;SHARADA LETTER JA;Lo;0;L;;;;;N;;;;; +11199;SHARADA LETTER JHA;Lo;0;L;;;;;N;;;;; +1119A;SHARADA LETTER NYA;Lo;0;L;;;;;N;;;;; +1119B;SHARADA LETTER TTA;Lo;0;L;;;;;N;;;;; +1119C;SHARADA LETTER TTHA;Lo;0;L;;;;;N;;;;; +1119D;SHARADA LETTER DDA;Lo;0;L;;;;;N;;;;; +1119E;SHARADA LETTER DDHA;Lo;0;L;;;;;N;;;;; +1119F;SHARADA LETTER NNA;Lo;0;L;;;;;N;;;;; +111A0;SHARADA LETTER TA;Lo;0;L;;;;;N;;;;; +111A1;SHARADA LETTER THA;Lo;0;L;;;;;N;;;;; +111A2;SHARADA LETTER DA;Lo;0;L;;;;;N;;;;; +111A3;SHARADA LETTER DHA;Lo;0;L;;;;;N;;;;; +111A4;SHARADA LETTER NA;Lo;0;L;;;;;N;;;;; +111A5;SHARADA LETTER PA;Lo;0;L;;;;;N;;;;; +111A6;SHARADA LETTER PHA;Lo;0;L;;;;;N;;;;; +111A7;SHARADA LETTER BA;Lo;0;L;;;;;N;;;;; +111A8;SHARADA LETTER BHA;Lo;0;L;;;;;N;;;;; +111A9;SHARADA LETTER MA;Lo;0;L;;;;;N;;;;; +111AA;SHARADA LETTER YA;Lo;0;L;;;;;N;;;;; +111AB;SHARADA LETTER RA;Lo;0;L;;;;;N;;;;; +111AC;SHARADA LETTER LA;Lo;0;L;;;;;N;;;;; +111AD;SHARADA LETTER LLA;Lo;0;L;;;;;N;;;;; +111AE;SHARADA LETTER VA;Lo;0;L;;;;;N;;;;; +111AF;SHARADA LETTER SHA;Lo;0;L;;;;;N;;;;; +111B0;SHARADA LETTER SSA;Lo;0;L;;;;;N;;;;; +111B1;SHARADA LETTER SA;Lo;0;L;;;;;N;;;;; +111B2;SHARADA LETTER HA;Lo;0;L;;;;;N;;;;; +111B3;SHARADA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +111B4;SHARADA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +111B5;SHARADA VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +111B6;SHARADA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +111B7;SHARADA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +111B8;SHARADA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +111B9;SHARADA VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +111BA;SHARADA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +111BB;SHARADA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +111BC;SHARADA VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +111BD;SHARADA VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +111BE;SHARADA VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +111BF;SHARADA VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +111C0;SHARADA SIGN VIRAMA;Mc;9;L;;;;;N;;;;; +111C1;SHARADA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +111C2;SHARADA SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;; +111C3;SHARADA SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;; +111C4;SHARADA OM;Lo;0;L;;;;;N;;;;; +111C5;SHARADA DANDA;Po;0;L;;;;;N;;;;; +111C6;SHARADA DOUBLE DANDA;Po;0;L;;;;;N;;;;; +111C7;SHARADA ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +111C8;SHARADA SEPARATOR;Po;0;L;;;;;N;;;;; +111C9;SHARADA SANDHI MARK;Po;0;L;;;;;N;;;;; +111CA;SHARADA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +111CB;SHARADA VOWEL MODIFIER MARK;Mn;0;NSM;;;;;N;;;;; +111CC;SHARADA EXTRA SHORT VOWEL MARK;Mn;0;NSM;;;;;N;;;;; +111CD;SHARADA SUTRA MARK;Po;0;L;;;;;N;;;;; +111D0;SHARADA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +111D1;SHARADA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +111D2;SHARADA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +111D3;SHARADA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +111D4;SHARADA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +111D5;SHARADA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +111D6;SHARADA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +111D7;SHARADA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +111D8;SHARADA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +111D9;SHARADA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +111DA;SHARADA EKAM;Lo;0;L;;;;;N;;;;; +111DB;SHARADA SIGN SIDDHAM;Po;0;L;;;;;N;;;;; +111DC;SHARADA HEADSTROKE;Lo;0;L;;;;;N;;;;; +111DD;SHARADA CONTINUATION SIGN;Po;0;L;;;;;N;;;;; +111DE;SHARADA SECTION MARK-1;Po;0;L;;;;;N;;;;; +111DF;SHARADA SECTION MARK-2;Po;0;L;;;;;N;;;;; +111E1;SINHALA ARCHAIC DIGIT ONE;No;0;L;;;;1;N;;;;; +111E2;SINHALA ARCHAIC DIGIT TWO;No;0;L;;;;2;N;;;;; +111E3;SINHALA ARCHAIC DIGIT THREE;No;0;L;;;;3;N;;;;; +111E4;SINHALA ARCHAIC DIGIT FOUR;No;0;L;;;;4;N;;;;; +111E5;SINHALA ARCHAIC DIGIT FIVE;No;0;L;;;;5;N;;;;; +111E6;SINHALA ARCHAIC DIGIT SIX;No;0;L;;;;6;N;;;;; +111E7;SINHALA ARCHAIC DIGIT SEVEN;No;0;L;;;;7;N;;;;; +111E8;SINHALA ARCHAIC DIGIT EIGHT;No;0;L;;;;8;N;;;;; +111E9;SINHALA ARCHAIC DIGIT NINE;No;0;L;;;;9;N;;;;; +111EA;SINHALA ARCHAIC NUMBER TEN;No;0;L;;;;10;N;;;;; +111EB;SINHALA ARCHAIC NUMBER TWENTY;No;0;L;;;;20;N;;;;; +111EC;SINHALA ARCHAIC NUMBER THIRTY;No;0;L;;;;30;N;;;;; +111ED;SINHALA ARCHAIC NUMBER FORTY;No;0;L;;;;40;N;;;;; +111EE;SINHALA ARCHAIC NUMBER FIFTY;No;0;L;;;;50;N;;;;; +111EF;SINHALA ARCHAIC NUMBER SIXTY;No;0;L;;;;60;N;;;;; +111F0;SINHALA ARCHAIC NUMBER SEVENTY;No;0;L;;;;70;N;;;;; +111F1;SINHALA ARCHAIC NUMBER EIGHTY;No;0;L;;;;80;N;;;;; +111F2;SINHALA ARCHAIC NUMBER NINETY;No;0;L;;;;90;N;;;;; +111F3;SINHALA ARCHAIC NUMBER ONE HUNDRED;No;0;L;;;;100;N;;;;; +111F4;SINHALA ARCHAIC NUMBER ONE THOUSAND;No;0;L;;;;1000;N;;;;; +11200;KHOJKI LETTER A;Lo;0;L;;;;;N;;;;; +11201;KHOJKI LETTER AA;Lo;0;L;;;;;N;;;;; +11202;KHOJKI LETTER I;Lo;0;L;;;;;N;;;;; +11203;KHOJKI LETTER U;Lo;0;L;;;;;N;;;;; +11204;KHOJKI LETTER E;Lo;0;L;;;;;N;;;;; +11205;KHOJKI LETTER AI;Lo;0;L;;;;;N;;;;; +11206;KHOJKI LETTER O;Lo;0;L;;;;;N;;;;; +11207;KHOJKI LETTER AU;Lo;0;L;;;;;N;;;;; +11208;KHOJKI LETTER KA;Lo;0;L;;;;;N;;;;; +11209;KHOJKI LETTER KHA;Lo;0;L;;;;;N;;;;; +1120A;KHOJKI LETTER GA;Lo;0;L;;;;;N;;;;; +1120B;KHOJKI LETTER GGA;Lo;0;L;;;;;N;;;;; +1120C;KHOJKI LETTER GHA;Lo;0;L;;;;;N;;;;; +1120D;KHOJKI LETTER NGA;Lo;0;L;;;;;N;;;;; +1120E;KHOJKI LETTER CA;Lo;0;L;;;;;N;;;;; +1120F;KHOJKI LETTER CHA;Lo;0;L;;;;;N;;;;; +11210;KHOJKI LETTER JA;Lo;0;L;;;;;N;;;;; +11211;KHOJKI LETTER JJA;Lo;0;L;;;;;N;;;;; +11213;KHOJKI LETTER NYA;Lo;0;L;;;;;N;;;;; +11214;KHOJKI LETTER TTA;Lo;0;L;;;;;N;;;;; +11215;KHOJKI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11216;KHOJKI LETTER DDA;Lo;0;L;;;;;N;;;;; +11217;KHOJKI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11218;KHOJKI LETTER NNA;Lo;0;L;;;;;N;;;;; +11219;KHOJKI LETTER TA;Lo;0;L;;;;;N;;;;; +1121A;KHOJKI LETTER THA;Lo;0;L;;;;;N;;;;; +1121B;KHOJKI LETTER DA;Lo;0;L;;;;;N;;;;; +1121C;KHOJKI LETTER DDDA;Lo;0;L;;;;;N;;;;; +1121D;KHOJKI LETTER DHA;Lo;0;L;;;;;N;;;;; +1121E;KHOJKI LETTER NA;Lo;0;L;;;;;N;;;;; +1121F;KHOJKI LETTER PA;Lo;0;L;;;;;N;;;;; +11220;KHOJKI LETTER PHA;Lo;0;L;;;;;N;;;;; +11221;KHOJKI LETTER BA;Lo;0;L;;;;;N;;;;; +11222;KHOJKI LETTER BBA;Lo;0;L;;;;;N;;;;; +11223;KHOJKI LETTER BHA;Lo;0;L;;;;;N;;;;; +11224;KHOJKI LETTER MA;Lo;0;L;;;;;N;;;;; +11225;KHOJKI LETTER YA;Lo;0;L;;;;;N;;;;; +11226;KHOJKI LETTER RA;Lo;0;L;;;;;N;;;;; +11227;KHOJKI LETTER LA;Lo;0;L;;;;;N;;;;; +11228;KHOJKI LETTER VA;Lo;0;L;;;;;N;;;;; +11229;KHOJKI LETTER SA;Lo;0;L;;;;;N;;;;; +1122A;KHOJKI LETTER HA;Lo;0;L;;;;;N;;;;; +1122B;KHOJKI LETTER LLA;Lo;0;L;;;;;N;;;;; +1122C;KHOJKI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +1122D;KHOJKI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +1122E;KHOJKI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +1122F;KHOJKI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11230;KHOJKI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11231;KHOJKI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11232;KHOJKI VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +11233;KHOJKI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11234;KHOJKI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11235;KHOJKI SIGN VIRAMA;Mc;9;L;;;;;N;;;;; +11236;KHOJKI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +11237;KHOJKI SIGN SHADDA;Mn;0;NSM;;;;;N;;;;; +11238;KHOJKI DANDA;Po;0;L;;;;;N;;;;; +11239;KHOJKI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +1123A;KHOJKI WORD SEPARATOR;Po;0;L;;;;;N;;;;; +1123B;KHOJKI SECTION MARK;Po;0;L;;;;;N;;;;; +1123C;KHOJKI DOUBLE SECTION MARK;Po;0;L;;;;;N;;;;; +1123D;KHOJKI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +1123E;KHOJKI SIGN SUKUN;Mn;0;NSM;;;;;N;;;;; +11280;MULTANI LETTER A;Lo;0;L;;;;;N;;;;; +11281;MULTANI LETTER I;Lo;0;L;;;;;N;;;;; +11282;MULTANI LETTER U;Lo;0;L;;;;;N;;;;; +11283;MULTANI LETTER E;Lo;0;L;;;;;N;;;;; +11284;MULTANI LETTER KA;Lo;0;L;;;;;N;;;;; +11285;MULTANI LETTER KHA;Lo;0;L;;;;;N;;;;; +11286;MULTANI LETTER GA;Lo;0;L;;;;;N;;;;; +11288;MULTANI LETTER GHA;Lo;0;L;;;;;N;;;;; +1128A;MULTANI LETTER CA;Lo;0;L;;;;;N;;;;; +1128B;MULTANI LETTER CHA;Lo;0;L;;;;;N;;;;; +1128C;MULTANI LETTER JA;Lo;0;L;;;;;N;;;;; +1128D;MULTANI LETTER JJA;Lo;0;L;;;;;N;;;;; +1128F;MULTANI LETTER NYA;Lo;0;L;;;;;N;;;;; +11290;MULTANI LETTER TTA;Lo;0;L;;;;;N;;;;; +11291;MULTANI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11292;MULTANI LETTER DDA;Lo;0;L;;;;;N;;;;; +11293;MULTANI LETTER DDDA;Lo;0;L;;;;;N;;;;; +11294;MULTANI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11295;MULTANI LETTER NNA;Lo;0;L;;;;;N;;;;; +11296;MULTANI LETTER TA;Lo;0;L;;;;;N;;;;; +11297;MULTANI LETTER THA;Lo;0;L;;;;;N;;;;; +11298;MULTANI LETTER DA;Lo;0;L;;;;;N;;;;; +11299;MULTANI LETTER DHA;Lo;0;L;;;;;N;;;;; +1129A;MULTANI LETTER NA;Lo;0;L;;;;;N;;;;; +1129B;MULTANI LETTER PA;Lo;0;L;;;;;N;;;;; +1129C;MULTANI LETTER PHA;Lo;0;L;;;;;N;;;;; +1129D;MULTANI LETTER BA;Lo;0;L;;;;;N;;;;; +1129F;MULTANI LETTER BHA;Lo;0;L;;;;;N;;;;; +112A0;MULTANI LETTER MA;Lo;0;L;;;;;N;;;;; +112A1;MULTANI LETTER YA;Lo;0;L;;;;;N;;;;; +112A2;MULTANI LETTER RA;Lo;0;L;;;;;N;;;;; +112A3;MULTANI LETTER LA;Lo;0;L;;;;;N;;;;; +112A4;MULTANI LETTER VA;Lo;0;L;;;;;N;;;;; +112A5;MULTANI LETTER SA;Lo;0;L;;;;;N;;;;; +112A6;MULTANI LETTER HA;Lo;0;L;;;;;N;;;;; +112A7;MULTANI LETTER RRA;Lo;0;L;;;;;N;;;;; +112A8;MULTANI LETTER RHA;Lo;0;L;;;;;N;;;;; +112A9;MULTANI SECTION MARK;Po;0;L;;;;;N;;;;; +112B0;KHUDAWADI LETTER A;Lo;0;L;;;;;N;;;;; +112B1;KHUDAWADI LETTER AA;Lo;0;L;;;;;N;;;;; +112B2;KHUDAWADI LETTER I;Lo;0;L;;;;;N;;;;; +112B3;KHUDAWADI LETTER II;Lo;0;L;;;;;N;;;;; +112B4;KHUDAWADI LETTER U;Lo;0;L;;;;;N;;;;; +112B5;KHUDAWADI LETTER UU;Lo;0;L;;;;;N;;;;; +112B6;KHUDAWADI LETTER E;Lo;0;L;;;;;N;;;;; +112B7;KHUDAWADI LETTER AI;Lo;0;L;;;;;N;;;;; +112B8;KHUDAWADI LETTER O;Lo;0;L;;;;;N;;;;; +112B9;KHUDAWADI LETTER AU;Lo;0;L;;;;;N;;;;; +112BA;KHUDAWADI LETTER KA;Lo;0;L;;;;;N;;;;; +112BB;KHUDAWADI LETTER KHA;Lo;0;L;;;;;N;;;;; +112BC;KHUDAWADI LETTER GA;Lo;0;L;;;;;N;;;;; +112BD;KHUDAWADI LETTER GGA;Lo;0;L;;;;;N;;;;; +112BE;KHUDAWADI LETTER GHA;Lo;0;L;;;;;N;;;;; +112BF;KHUDAWADI LETTER NGA;Lo;0;L;;;;;N;;;;; +112C0;KHUDAWADI LETTER CA;Lo;0;L;;;;;N;;;;; +112C1;KHUDAWADI LETTER CHA;Lo;0;L;;;;;N;;;;; +112C2;KHUDAWADI LETTER JA;Lo;0;L;;;;;N;;;;; +112C3;KHUDAWADI LETTER JJA;Lo;0;L;;;;;N;;;;; +112C4;KHUDAWADI LETTER JHA;Lo;0;L;;;;;N;;;;; +112C5;KHUDAWADI LETTER NYA;Lo;0;L;;;;;N;;;;; +112C6;KHUDAWADI LETTER TTA;Lo;0;L;;;;;N;;;;; +112C7;KHUDAWADI LETTER TTHA;Lo;0;L;;;;;N;;;;; +112C8;KHUDAWADI LETTER DDA;Lo;0;L;;;;;N;;;;; +112C9;KHUDAWADI LETTER DDDA;Lo;0;L;;;;;N;;;;; +112CA;KHUDAWADI LETTER RRA;Lo;0;L;;;;;N;;;;; +112CB;KHUDAWADI LETTER DDHA;Lo;0;L;;;;;N;;;;; +112CC;KHUDAWADI LETTER NNA;Lo;0;L;;;;;N;;;;; +112CD;KHUDAWADI LETTER TA;Lo;0;L;;;;;N;;;;; +112CE;KHUDAWADI LETTER THA;Lo;0;L;;;;;N;;;;; +112CF;KHUDAWADI LETTER DA;Lo;0;L;;;;;N;;;;; +112D0;KHUDAWADI LETTER DHA;Lo;0;L;;;;;N;;;;; +112D1;KHUDAWADI LETTER NA;Lo;0;L;;;;;N;;;;; +112D2;KHUDAWADI LETTER PA;Lo;0;L;;;;;N;;;;; +112D3;KHUDAWADI LETTER PHA;Lo;0;L;;;;;N;;;;; +112D4;KHUDAWADI LETTER BA;Lo;0;L;;;;;N;;;;; +112D5;KHUDAWADI LETTER BBA;Lo;0;L;;;;;N;;;;; +112D6;KHUDAWADI LETTER BHA;Lo;0;L;;;;;N;;;;; +112D7;KHUDAWADI LETTER MA;Lo;0;L;;;;;N;;;;; +112D8;KHUDAWADI LETTER YA;Lo;0;L;;;;;N;;;;; +112D9;KHUDAWADI LETTER RA;Lo;0;L;;;;;N;;;;; +112DA;KHUDAWADI LETTER LA;Lo;0;L;;;;;N;;;;; +112DB;KHUDAWADI LETTER VA;Lo;0;L;;;;;N;;;;; +112DC;KHUDAWADI LETTER SHA;Lo;0;L;;;;;N;;;;; +112DD;KHUDAWADI LETTER SA;Lo;0;L;;;;;N;;;;; +112DE;KHUDAWADI LETTER HA;Lo;0;L;;;;;N;;;;; +112DF;KHUDAWADI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +112E0;KHUDAWADI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +112E1;KHUDAWADI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +112E2;KHUDAWADI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +112E3;KHUDAWADI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +112E4;KHUDAWADI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +112E5;KHUDAWADI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +112E6;KHUDAWADI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +112E7;KHUDAWADI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +112E8;KHUDAWADI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +112E9;KHUDAWADI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +112EA;KHUDAWADI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +112F0;KHUDAWADI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +112F1;KHUDAWADI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +112F2;KHUDAWADI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +112F3;KHUDAWADI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +112F4;KHUDAWADI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +112F5;KHUDAWADI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +112F6;KHUDAWADI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +112F7;KHUDAWADI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +112F8;KHUDAWADI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +112F9;KHUDAWADI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11300;GRANTHA SIGN COMBINING ANUSVARA ABOVE;Mn;0;NSM;;;;;N;;;;; +11301;GRANTHA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11302;GRANTHA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;; +11303;GRANTHA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11305;GRANTHA LETTER A;Lo;0;L;;;;;N;;;;; +11306;GRANTHA LETTER AA;Lo;0;L;;;;;N;;;;; +11307;GRANTHA LETTER I;Lo;0;L;;;;;N;;;;; +11308;GRANTHA LETTER II;Lo;0;L;;;;;N;;;;; +11309;GRANTHA LETTER U;Lo;0;L;;;;;N;;;;; +1130A;GRANTHA LETTER UU;Lo;0;L;;;;;N;;;;; +1130B;GRANTHA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +1130C;GRANTHA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +1130F;GRANTHA LETTER EE;Lo;0;L;;;;;N;;;;; +11310;GRANTHA LETTER AI;Lo;0;L;;;;;N;;;;; +11313;GRANTHA LETTER OO;Lo;0;L;;;;;N;;;;; +11314;GRANTHA LETTER AU;Lo;0;L;;;;;N;;;;; +11315;GRANTHA LETTER KA;Lo;0;L;;;;;N;;;;; +11316;GRANTHA LETTER KHA;Lo;0;L;;;;;N;;;;; +11317;GRANTHA LETTER GA;Lo;0;L;;;;;N;;;;; +11318;GRANTHA LETTER GHA;Lo;0;L;;;;;N;;;;; +11319;GRANTHA LETTER NGA;Lo;0;L;;;;;N;;;;; +1131A;GRANTHA LETTER CA;Lo;0;L;;;;;N;;;;; +1131B;GRANTHA LETTER CHA;Lo;0;L;;;;;N;;;;; +1131C;GRANTHA LETTER JA;Lo;0;L;;;;;N;;;;; +1131D;GRANTHA LETTER JHA;Lo;0;L;;;;;N;;;;; +1131E;GRANTHA LETTER NYA;Lo;0;L;;;;;N;;;;; +1131F;GRANTHA LETTER TTA;Lo;0;L;;;;;N;;;;; +11320;GRANTHA LETTER TTHA;Lo;0;L;;;;;N;;;;; +11321;GRANTHA LETTER DDA;Lo;0;L;;;;;N;;;;; +11322;GRANTHA LETTER DDHA;Lo;0;L;;;;;N;;;;; +11323;GRANTHA LETTER NNA;Lo;0;L;;;;;N;;;;; +11324;GRANTHA LETTER TA;Lo;0;L;;;;;N;;;;; +11325;GRANTHA LETTER THA;Lo;0;L;;;;;N;;;;; +11326;GRANTHA LETTER DA;Lo;0;L;;;;;N;;;;; +11327;GRANTHA LETTER DHA;Lo;0;L;;;;;N;;;;; +11328;GRANTHA LETTER NA;Lo;0;L;;;;;N;;;;; +1132A;GRANTHA LETTER PA;Lo;0;L;;;;;N;;;;; +1132B;GRANTHA LETTER PHA;Lo;0;L;;;;;N;;;;; +1132C;GRANTHA LETTER BA;Lo;0;L;;;;;N;;;;; +1132D;GRANTHA LETTER BHA;Lo;0;L;;;;;N;;;;; +1132E;GRANTHA LETTER MA;Lo;0;L;;;;;N;;;;; +1132F;GRANTHA LETTER YA;Lo;0;L;;;;;N;;;;; +11330;GRANTHA LETTER RA;Lo;0;L;;;;;N;;;;; +11332;GRANTHA LETTER LA;Lo;0;L;;;;;N;;;;; +11333;GRANTHA LETTER LLA;Lo;0;L;;;;;N;;;;; +11335;GRANTHA LETTER VA;Lo;0;L;;;;;N;;;;; +11336;GRANTHA LETTER SHA;Lo;0;L;;;;;N;;;;; +11337;GRANTHA LETTER SSA;Lo;0;L;;;;;N;;;;; +11338;GRANTHA LETTER SA;Lo;0;L;;;;;N;;;;; +11339;GRANTHA LETTER HA;Lo;0;L;;;;;N;;;;; +1133C;GRANTHA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +1133D;GRANTHA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +1133E;GRANTHA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +1133F;GRANTHA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +11340;GRANTHA VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +11341;GRANTHA VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +11342;GRANTHA VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +11343;GRANTHA VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;; +11344;GRANTHA VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;; +11347;GRANTHA VOWEL SIGN EE;Mc;0;L;;;;;N;;;;; +11348;GRANTHA VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +1134B;GRANTHA VOWEL SIGN OO;Mc;0;L;11347 1133E;;;;N;;;;; +1134C;GRANTHA VOWEL SIGN AU;Mc;0;L;11347 11357;;;;N;;;;; +1134D;GRANTHA SIGN VIRAMA;Mc;9;L;;;;;N;;;;; +11350;GRANTHA OM;Lo;0;L;;;;;N;;;;; +11357;GRANTHA AU LENGTH MARK;Mc;0;L;;;;;N;;;;; +1135D;GRANTHA SIGN PLUTA;Lo;0;L;;;;;N;;;;; +1135E;GRANTHA LETTER VEDIC ANUSVARA;Lo;0;L;;;;;N;;;;; +1135F;GRANTHA LETTER VEDIC DOUBLE ANUSVARA;Lo;0;L;;;;;N;;;;; +11360;GRANTHA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11361;GRANTHA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +11362;GRANTHA VOWEL SIGN VOCALIC L;Mc;0;L;;;;;N;;;;; +11363;GRANTHA VOWEL SIGN VOCALIC LL;Mc;0;L;;;;;N;;;;; +11366;COMBINING GRANTHA DIGIT ZERO;Mn;230;NSM;;;;;N;;;;; +11367;COMBINING GRANTHA DIGIT ONE;Mn;230;NSM;;;;;N;;;;; +11368;COMBINING GRANTHA DIGIT TWO;Mn;230;NSM;;;;;N;;;;; +11369;COMBINING GRANTHA DIGIT THREE;Mn;230;NSM;;;;;N;;;;; +1136A;COMBINING GRANTHA DIGIT FOUR;Mn;230;NSM;;;;;N;;;;; +1136B;COMBINING GRANTHA DIGIT FIVE;Mn;230;NSM;;;;;N;;;;; +1136C;COMBINING GRANTHA DIGIT SIX;Mn;230;NSM;;;;;N;;;;; +11370;COMBINING GRANTHA LETTER A;Mn;230;NSM;;;;;N;;;;; +11371;COMBINING GRANTHA LETTER KA;Mn;230;NSM;;;;;N;;;;; +11372;COMBINING GRANTHA LETTER NA;Mn;230;NSM;;;;;N;;;;; +11373;COMBINING GRANTHA LETTER VI;Mn;230;NSM;;;;;N;;;;; +11374;COMBINING GRANTHA LETTER PA;Mn;230;NSM;;;;;N;;;;; +11400;NEWA LETTER A;Lo;0;L;;;;;N;;;;; +11401;NEWA LETTER AA;Lo;0;L;;;;;N;;;;; +11402;NEWA LETTER I;Lo;0;L;;;;;N;;;;; +11403;NEWA LETTER II;Lo;0;L;;;;;N;;;;; +11404;NEWA LETTER U;Lo;0;L;;;;;N;;;;; +11405;NEWA LETTER UU;Lo;0;L;;;;;N;;;;; +11406;NEWA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11407;NEWA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11408;NEWA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +11409;NEWA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1140A;NEWA LETTER E;Lo;0;L;;;;;N;;;;; +1140B;NEWA LETTER AI;Lo;0;L;;;;;N;;;;; +1140C;NEWA LETTER O;Lo;0;L;;;;;N;;;;; +1140D;NEWA LETTER AU;Lo;0;L;;;;;N;;;;; +1140E;NEWA LETTER KA;Lo;0;L;;;;;N;;;;; +1140F;NEWA LETTER KHA;Lo;0;L;;;;;N;;;;; +11410;NEWA LETTER GA;Lo;0;L;;;;;N;;;;; +11411;NEWA LETTER GHA;Lo;0;L;;;;;N;;;;; +11412;NEWA LETTER NGA;Lo;0;L;;;;;N;;;;; +11413;NEWA LETTER NGHA;Lo;0;L;;;;;N;;;;; +11414;NEWA LETTER CA;Lo;0;L;;;;;N;;;;; +11415;NEWA LETTER CHA;Lo;0;L;;;;;N;;;;; +11416;NEWA LETTER JA;Lo;0;L;;;;;N;;;;; +11417;NEWA LETTER JHA;Lo;0;L;;;;;N;;;;; +11418;NEWA LETTER NYA;Lo;0;L;;;;;N;;;;; +11419;NEWA LETTER NYHA;Lo;0;L;;;;;N;;;;; +1141A;NEWA LETTER TTA;Lo;0;L;;;;;N;;;;; +1141B;NEWA LETTER TTHA;Lo;0;L;;;;;N;;;;; +1141C;NEWA LETTER DDA;Lo;0;L;;;;;N;;;;; +1141D;NEWA LETTER DDHA;Lo;0;L;;;;;N;;;;; +1141E;NEWA LETTER NNA;Lo;0;L;;;;;N;;;;; +1141F;NEWA LETTER TA;Lo;0;L;;;;;N;;;;; +11420;NEWA LETTER THA;Lo;0;L;;;;;N;;;;; +11421;NEWA LETTER DA;Lo;0;L;;;;;N;;;;; +11422;NEWA LETTER DHA;Lo;0;L;;;;;N;;;;; +11423;NEWA LETTER NA;Lo;0;L;;;;;N;;;;; +11424;NEWA LETTER NHA;Lo;0;L;;;;;N;;;;; +11425;NEWA LETTER PA;Lo;0;L;;;;;N;;;;; +11426;NEWA LETTER PHA;Lo;0;L;;;;;N;;;;; +11427;NEWA LETTER BA;Lo;0;L;;;;;N;;;;; +11428;NEWA LETTER BHA;Lo;0;L;;;;;N;;;;; +11429;NEWA LETTER MA;Lo;0;L;;;;;N;;;;; +1142A;NEWA LETTER MHA;Lo;0;L;;;;;N;;;;; +1142B;NEWA LETTER YA;Lo;0;L;;;;;N;;;;; +1142C;NEWA LETTER RA;Lo;0;L;;;;;N;;;;; +1142D;NEWA LETTER RHA;Lo;0;L;;;;;N;;;;; +1142E;NEWA LETTER LA;Lo;0;L;;;;;N;;;;; +1142F;NEWA LETTER LHA;Lo;0;L;;;;;N;;;;; +11430;NEWA LETTER WA;Lo;0;L;;;;;N;;;;; +11431;NEWA LETTER SHA;Lo;0;L;;;;;N;;;;; +11432;NEWA LETTER SSA;Lo;0;L;;;;;N;;;;; +11433;NEWA LETTER SA;Lo;0;L;;;;;N;;;;; +11434;NEWA LETTER HA;Lo;0;L;;;;;N;;;;; +11435;NEWA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +11436;NEWA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +11437;NEWA VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +11438;NEWA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11439;NEWA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +1143A;NEWA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +1143B;NEWA VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +1143C;NEWA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +1143D;NEWA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +1143E;NEWA VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +1143F;NEWA VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11440;NEWA VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +11441;NEWA VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11442;NEWA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +11443;NEWA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11444;NEWA SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11445;NEWA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11446;NEWA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +11447;NEWA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +11448;NEWA SIGN FINAL ANUSVARA;Lo;0;L;;;;;N;;;;; +11449;NEWA OM;Lo;0;L;;;;;N;;;;; +1144A;NEWA SIDDHI;Lo;0;L;;;;;N;;;;; +1144B;NEWA DANDA;Po;0;L;;;;;N;;;;; +1144C;NEWA DOUBLE DANDA;Po;0;L;;;;;N;;;;; +1144D;NEWA COMMA;Po;0;L;;;;;N;;;;; +1144E;NEWA GAP FILLER;Po;0;L;;;;;N;;;;; +1144F;NEWA ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +11450;NEWA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11451;NEWA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11452;NEWA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11453;NEWA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11454;NEWA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11455;NEWA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11456;NEWA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11457;NEWA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11458;NEWA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11459;NEWA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1145B;NEWA PLACEHOLDER MARK;Po;0;L;;;;;N;;;;; +1145D;NEWA INSERTION SIGN;Po;0;L;;;;;N;;;;; +11480;TIRHUTA ANJI;Lo;0;L;;;;;N;;;;; +11481;TIRHUTA LETTER A;Lo;0;L;;;;;N;;;;; +11482;TIRHUTA LETTER AA;Lo;0;L;;;;;N;;;;; +11483;TIRHUTA LETTER I;Lo;0;L;;;;;N;;;;; +11484;TIRHUTA LETTER II;Lo;0;L;;;;;N;;;;; +11485;TIRHUTA LETTER U;Lo;0;L;;;;;N;;;;; +11486;TIRHUTA LETTER UU;Lo;0;L;;;;;N;;;;; +11487;TIRHUTA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11488;TIRHUTA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11489;TIRHUTA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +1148A;TIRHUTA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1148B;TIRHUTA LETTER E;Lo;0;L;;;;;N;;;;; +1148C;TIRHUTA LETTER AI;Lo;0;L;;;;;N;;;;; +1148D;TIRHUTA LETTER O;Lo;0;L;;;;;N;;;;; +1148E;TIRHUTA LETTER AU;Lo;0;L;;;;;N;;;;; +1148F;TIRHUTA LETTER KA;Lo;0;L;;;;;N;;;;; +11490;TIRHUTA LETTER KHA;Lo;0;L;;;;;N;;;;; +11491;TIRHUTA LETTER GA;Lo;0;L;;;;;N;;;;; +11492;TIRHUTA LETTER GHA;Lo;0;L;;;;;N;;;;; +11493;TIRHUTA LETTER NGA;Lo;0;L;;;;;N;;;;; +11494;TIRHUTA LETTER CA;Lo;0;L;;;;;N;;;;; +11495;TIRHUTA LETTER CHA;Lo;0;L;;;;;N;;;;; +11496;TIRHUTA LETTER JA;Lo;0;L;;;;;N;;;;; +11497;TIRHUTA LETTER JHA;Lo;0;L;;;;;N;;;;; +11498;TIRHUTA LETTER NYA;Lo;0;L;;;;;N;;;;; +11499;TIRHUTA LETTER TTA;Lo;0;L;;;;;N;;;;; +1149A;TIRHUTA LETTER TTHA;Lo;0;L;;;;;N;;;;; +1149B;TIRHUTA LETTER DDA;Lo;0;L;;;;;N;;;;; +1149C;TIRHUTA LETTER DDHA;Lo;0;L;;;;;N;;;;; +1149D;TIRHUTA LETTER NNA;Lo;0;L;;;;;N;;;;; +1149E;TIRHUTA LETTER TA;Lo;0;L;;;;;N;;;;; +1149F;TIRHUTA LETTER THA;Lo;0;L;;;;;N;;;;; +114A0;TIRHUTA LETTER DA;Lo;0;L;;;;;N;;;;; +114A1;TIRHUTA LETTER DHA;Lo;0;L;;;;;N;;;;; +114A2;TIRHUTA LETTER NA;Lo;0;L;;;;;N;;;;; +114A3;TIRHUTA LETTER PA;Lo;0;L;;;;;N;;;;; +114A4;TIRHUTA LETTER PHA;Lo;0;L;;;;;N;;;;; +114A5;TIRHUTA LETTER BA;Lo;0;L;;;;;N;;;;; +114A6;TIRHUTA LETTER BHA;Lo;0;L;;;;;N;;;;; +114A7;TIRHUTA LETTER MA;Lo;0;L;;;;;N;;;;; +114A8;TIRHUTA LETTER YA;Lo;0;L;;;;;N;;;;; +114A9;TIRHUTA LETTER RA;Lo;0;L;;;;;N;;;;; +114AA;TIRHUTA LETTER LA;Lo;0;L;;;;;N;;;;; +114AB;TIRHUTA LETTER VA;Lo;0;L;;;;;N;;;;; +114AC;TIRHUTA LETTER SHA;Lo;0;L;;;;;N;;;;; +114AD;TIRHUTA LETTER SSA;Lo;0;L;;;;;N;;;;; +114AE;TIRHUTA LETTER SA;Lo;0;L;;;;;N;;;;; +114AF;TIRHUTA LETTER HA;Lo;0;L;;;;;N;;;;; +114B0;TIRHUTA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +114B1;TIRHUTA VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +114B2;TIRHUTA VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +114B3;TIRHUTA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +114B4;TIRHUTA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +114B5;TIRHUTA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +114B6;TIRHUTA VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +114B7;TIRHUTA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +114B8;TIRHUTA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +114B9;TIRHUTA VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +114BA;TIRHUTA VOWEL SIGN SHORT E;Mn;0;NSM;;;;;N;;;;; +114BB;TIRHUTA VOWEL SIGN AI;Mc;0;L;114B9 114BA;;;;N;;;;; +114BC;TIRHUTA VOWEL SIGN O;Mc;0;L;114B9 114B0;;;;N;;;;; +114BD;TIRHUTA VOWEL SIGN SHORT O;Mc;0;L;;;;;N;;;;; +114BE;TIRHUTA VOWEL SIGN AU;Mc;0;L;114B9 114BD;;;;N;;;;; +114BF;TIRHUTA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +114C0;TIRHUTA SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +114C1;TIRHUTA SIGN VISARGA;Mc;0;L;;;;;N;;;;; +114C2;TIRHUTA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +114C3;TIRHUTA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +114C4;TIRHUTA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +114C5;TIRHUTA GVANG;Lo;0;L;;;;;N;;;;; +114C6;TIRHUTA ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +114C7;TIRHUTA OM;Lo;0;L;;;;;N;;;;; +114D0;TIRHUTA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +114D1;TIRHUTA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +114D2;TIRHUTA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +114D3;TIRHUTA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +114D4;TIRHUTA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +114D5;TIRHUTA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +114D6;TIRHUTA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +114D7;TIRHUTA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +114D8;TIRHUTA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +114D9;TIRHUTA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11580;SIDDHAM LETTER A;Lo;0;L;;;;;N;;;;; +11581;SIDDHAM LETTER AA;Lo;0;L;;;;;N;;;;; +11582;SIDDHAM LETTER I;Lo;0;L;;;;;N;;;;; +11583;SIDDHAM LETTER II;Lo;0;L;;;;;N;;;;; +11584;SIDDHAM LETTER U;Lo;0;L;;;;;N;;;;; +11585;SIDDHAM LETTER UU;Lo;0;L;;;;;N;;;;; +11586;SIDDHAM LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11587;SIDDHAM LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11588;SIDDHAM LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +11589;SIDDHAM LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1158A;SIDDHAM LETTER E;Lo;0;L;;;;;N;;;;; +1158B;SIDDHAM LETTER AI;Lo;0;L;;;;;N;;;;; +1158C;SIDDHAM LETTER O;Lo;0;L;;;;;N;;;;; +1158D;SIDDHAM LETTER AU;Lo;0;L;;;;;N;;;;; +1158E;SIDDHAM LETTER KA;Lo;0;L;;;;;N;;;;; +1158F;SIDDHAM LETTER KHA;Lo;0;L;;;;;N;;;;; +11590;SIDDHAM LETTER GA;Lo;0;L;;;;;N;;;;; +11591;SIDDHAM LETTER GHA;Lo;0;L;;;;;N;;;;; +11592;SIDDHAM LETTER NGA;Lo;0;L;;;;;N;;;;; +11593;SIDDHAM LETTER CA;Lo;0;L;;;;;N;;;;; +11594;SIDDHAM LETTER CHA;Lo;0;L;;;;;N;;;;; +11595;SIDDHAM LETTER JA;Lo;0;L;;;;;N;;;;; +11596;SIDDHAM LETTER JHA;Lo;0;L;;;;;N;;;;; +11597;SIDDHAM LETTER NYA;Lo;0;L;;;;;N;;;;; +11598;SIDDHAM LETTER TTA;Lo;0;L;;;;;N;;;;; +11599;SIDDHAM LETTER TTHA;Lo;0;L;;;;;N;;;;; +1159A;SIDDHAM LETTER DDA;Lo;0;L;;;;;N;;;;; +1159B;SIDDHAM LETTER DDHA;Lo;0;L;;;;;N;;;;; +1159C;SIDDHAM LETTER NNA;Lo;0;L;;;;;N;;;;; +1159D;SIDDHAM LETTER TA;Lo;0;L;;;;;N;;;;; +1159E;SIDDHAM LETTER THA;Lo;0;L;;;;;N;;;;; +1159F;SIDDHAM LETTER DA;Lo;0;L;;;;;N;;;;; +115A0;SIDDHAM LETTER DHA;Lo;0;L;;;;;N;;;;; +115A1;SIDDHAM LETTER NA;Lo;0;L;;;;;N;;;;; +115A2;SIDDHAM LETTER PA;Lo;0;L;;;;;N;;;;; +115A3;SIDDHAM LETTER PHA;Lo;0;L;;;;;N;;;;; +115A4;SIDDHAM LETTER BA;Lo;0;L;;;;;N;;;;; +115A5;SIDDHAM LETTER BHA;Lo;0;L;;;;;N;;;;; +115A6;SIDDHAM LETTER MA;Lo;0;L;;;;;N;;;;; +115A7;SIDDHAM LETTER YA;Lo;0;L;;;;;N;;;;; +115A8;SIDDHAM LETTER RA;Lo;0;L;;;;;N;;;;; +115A9;SIDDHAM LETTER LA;Lo;0;L;;;;;N;;;;; +115AA;SIDDHAM LETTER VA;Lo;0;L;;;;;N;;;;; +115AB;SIDDHAM LETTER SHA;Lo;0;L;;;;;N;;;;; +115AC;SIDDHAM LETTER SSA;Lo;0;L;;;;;N;;;;; +115AD;SIDDHAM LETTER SA;Lo;0;L;;;;;N;;;;; +115AE;SIDDHAM LETTER HA;Lo;0;L;;;;;N;;;;; +115AF;SIDDHAM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +115B0;SIDDHAM VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +115B1;SIDDHAM VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +115B2;SIDDHAM VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +115B3;SIDDHAM VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +115B4;SIDDHAM VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +115B5;SIDDHAM VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +115B8;SIDDHAM VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +115B9;SIDDHAM VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +115BA;SIDDHAM VOWEL SIGN O;Mc;0;L;115B8 115AF;;;;N;;;;; +115BB;SIDDHAM VOWEL SIGN AU;Mc;0;L;115B9 115AF;;;;N;;;;; +115BC;SIDDHAM SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +115BD;SIDDHAM SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +115BE;SIDDHAM SIGN VISARGA;Mc;0;L;;;;;N;;;;; +115BF;SIDDHAM SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +115C0;SIDDHAM SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +115C1;SIDDHAM SIGN SIDDHAM;Po;0;L;;;;;N;;;;; +115C2;SIDDHAM DANDA;Po;0;L;;;;;N;;;;; +115C3;SIDDHAM DOUBLE DANDA;Po;0;L;;;;;N;;;;; +115C4;SIDDHAM SEPARATOR DOT;Po;0;L;;;;;N;;;;; +115C5;SIDDHAM SEPARATOR BAR;Po;0;L;;;;;N;;;;; +115C6;SIDDHAM REPETITION MARK-1;Po;0;L;;;;;N;;;;; +115C7;SIDDHAM REPETITION MARK-2;Po;0;L;;;;;N;;;;; +115C8;SIDDHAM REPETITION MARK-3;Po;0;L;;;;;N;;;;; +115C9;SIDDHAM END OF TEXT MARK;Po;0;L;;;;;N;;;;; +115CA;SIDDHAM SECTION MARK WITH TRIDENT AND U-SHAPED ORNAMENTS;Po;0;L;;;;;N;;;;; +115CB;SIDDHAM SECTION MARK WITH TRIDENT AND DOTTED CRESCENTS;Po;0;L;;;;;N;;;;; +115CC;SIDDHAM SECTION MARK WITH RAYS AND DOTTED CRESCENTS;Po;0;L;;;;;N;;;;; +115CD;SIDDHAM SECTION MARK WITH RAYS AND DOTTED DOUBLE CRESCENTS;Po;0;L;;;;;N;;;;; +115CE;SIDDHAM SECTION MARK WITH RAYS AND DOTTED TRIPLE CRESCENTS;Po;0;L;;;;;N;;;;; +115CF;SIDDHAM SECTION MARK DOUBLE RING;Po;0;L;;;;;N;;;;; +115D0;SIDDHAM SECTION MARK DOUBLE RING WITH RAYS;Po;0;L;;;;;N;;;;; +115D1;SIDDHAM SECTION MARK WITH DOUBLE CRESCENTS;Po;0;L;;;;;N;;;;; +115D2;SIDDHAM SECTION MARK WITH TRIPLE CRESCENTS;Po;0;L;;;;;N;;;;; +115D3;SIDDHAM SECTION MARK WITH QUADRUPLE CRESCENTS;Po;0;L;;;;;N;;;;; +115D4;SIDDHAM SECTION MARK WITH SEPTUPLE CRESCENTS;Po;0;L;;;;;N;;;;; +115D5;SIDDHAM SECTION MARK WITH CIRCLES AND RAYS;Po;0;L;;;;;N;;;;; +115D6;SIDDHAM SECTION MARK WITH CIRCLES AND TWO ENCLOSURES;Po;0;L;;;;;N;;;;; +115D7;SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES;Po;0;L;;;;;N;;;;; +115D8;SIDDHAM LETTER THREE-CIRCLE ALTERNATE I;Lo;0;L;;;;;N;;;;; +115D9;SIDDHAM LETTER TWO-CIRCLE ALTERNATE I;Lo;0;L;;;;;N;;;;; +115DA;SIDDHAM LETTER TWO-CIRCLE ALTERNATE II;Lo;0;L;;;;;N;;;;; +115DB;SIDDHAM LETTER ALTERNATE U;Lo;0;L;;;;;N;;;;; +115DC;SIDDHAM VOWEL SIGN ALTERNATE U;Mn;0;NSM;;;;;N;;;;; +115DD;SIDDHAM VOWEL SIGN ALTERNATE UU;Mn;0;NSM;;;;;N;;;;; +11600;MODI LETTER A;Lo;0;L;;;;;N;;;;; +11601;MODI LETTER AA;Lo;0;L;;;;;N;;;;; +11602;MODI LETTER I;Lo;0;L;;;;;N;;;;; +11603;MODI LETTER II;Lo;0;L;;;;;N;;;;; +11604;MODI LETTER U;Lo;0;L;;;;;N;;;;; +11605;MODI LETTER UU;Lo;0;L;;;;;N;;;;; +11606;MODI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11607;MODI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11608;MODI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +11609;MODI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;; +1160A;MODI LETTER E;Lo;0;L;;;;;N;;;;; +1160B;MODI LETTER AI;Lo;0;L;;;;;N;;;;; +1160C;MODI LETTER O;Lo;0;L;;;;;N;;;;; +1160D;MODI LETTER AU;Lo;0;L;;;;;N;;;;; +1160E;MODI LETTER KA;Lo;0;L;;;;;N;;;;; +1160F;MODI LETTER KHA;Lo;0;L;;;;;N;;;;; +11610;MODI LETTER GA;Lo;0;L;;;;;N;;;;; +11611;MODI LETTER GHA;Lo;0;L;;;;;N;;;;; +11612;MODI LETTER NGA;Lo;0;L;;;;;N;;;;; +11613;MODI LETTER CA;Lo;0;L;;;;;N;;;;; +11614;MODI LETTER CHA;Lo;0;L;;;;;N;;;;; +11615;MODI LETTER JA;Lo;0;L;;;;;N;;;;; +11616;MODI LETTER JHA;Lo;0;L;;;;;N;;;;; +11617;MODI LETTER NYA;Lo;0;L;;;;;N;;;;; +11618;MODI LETTER TTA;Lo;0;L;;;;;N;;;;; +11619;MODI LETTER TTHA;Lo;0;L;;;;;N;;;;; +1161A;MODI LETTER DDA;Lo;0;L;;;;;N;;;;; +1161B;MODI LETTER DDHA;Lo;0;L;;;;;N;;;;; +1161C;MODI LETTER NNA;Lo;0;L;;;;;N;;;;; +1161D;MODI LETTER TA;Lo;0;L;;;;;N;;;;; +1161E;MODI LETTER THA;Lo;0;L;;;;;N;;;;; +1161F;MODI LETTER DA;Lo;0;L;;;;;N;;;;; +11620;MODI LETTER DHA;Lo;0;L;;;;;N;;;;; +11621;MODI LETTER NA;Lo;0;L;;;;;N;;;;; +11622;MODI LETTER PA;Lo;0;L;;;;;N;;;;; +11623;MODI LETTER PHA;Lo;0;L;;;;;N;;;;; +11624;MODI LETTER BA;Lo;0;L;;;;;N;;;;; +11625;MODI LETTER BHA;Lo;0;L;;;;;N;;;;; +11626;MODI LETTER MA;Lo;0;L;;;;;N;;;;; +11627;MODI LETTER YA;Lo;0;L;;;;;N;;;;; +11628;MODI LETTER RA;Lo;0;L;;;;;N;;;;; +11629;MODI LETTER LA;Lo;0;L;;;;;N;;;;; +1162A;MODI LETTER VA;Lo;0;L;;;;;N;;;;; +1162B;MODI LETTER SHA;Lo;0;L;;;;;N;;;;; +1162C;MODI LETTER SSA;Lo;0;L;;;;;N;;;;; +1162D;MODI LETTER SA;Lo;0;L;;;;;N;;;;; +1162E;MODI LETTER HA;Lo;0;L;;;;;N;;;;; +1162F;MODI LETTER LLA;Lo;0;L;;;;;N;;;;; +11630;MODI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +11631;MODI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +11632;MODI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +11633;MODI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11634;MODI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +11635;MODI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11636;MODI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +11637;MODI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +11638;MODI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;; +11639;MODI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +1163A;MODI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +1163B;MODI VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +1163C;MODI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +1163D;MODI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +1163E;MODI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +1163F;MODI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +11640;MODI SIGN ARDHACANDRA;Mn;0;NSM;;;;;N;;;;; +11641;MODI DANDA;Po;0;L;;;;;N;;;;; +11642;MODI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +11643;MODI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;; +11644;MODI SIGN HUVA;Lo;0;L;;;;;N;;;;; +11650;MODI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11651;MODI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11652;MODI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11653;MODI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11654;MODI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11655;MODI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11656;MODI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11657;MODI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11658;MODI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11659;MODI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11660;MONGOLIAN BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11661;MONGOLIAN ROTATED BIRGA;Po;0;ON;;;;;N;;;;; +11662;MONGOLIAN DOUBLE BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11663;MONGOLIAN TRIPLE BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11664;MONGOLIAN BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11665;MONGOLIAN ROTATED BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +11666;MONGOLIAN ROTATED BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11667;MONGOLIAN INVERTED BIRGA;Po;0;ON;;;;;N;;;;; +11668;MONGOLIAN INVERTED BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11669;MONGOLIAN SWIRL BIRGA;Po;0;ON;;;;;N;;;;; +1166A;MONGOLIAN SWIRL BIRGA WITH ORNAMENT;Po;0;ON;;;;;N;;;;; +1166B;MONGOLIAN SWIRL BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +1166C;MONGOLIAN TURNED SWIRL BIRGA WITH DOUBLE ORNAMENT;Po;0;ON;;;;;N;;;;; +11680;TAKRI LETTER A;Lo;0;L;;;;;N;;;;; +11681;TAKRI LETTER AA;Lo;0;L;;;;;N;;;;; +11682;TAKRI LETTER I;Lo;0;L;;;;;N;;;;; +11683;TAKRI LETTER II;Lo;0;L;;;;;N;;;;; +11684;TAKRI LETTER U;Lo;0;L;;;;;N;;;;; +11685;TAKRI LETTER UU;Lo;0;L;;;;;N;;;;; +11686;TAKRI LETTER E;Lo;0;L;;;;;N;;;;; +11687;TAKRI LETTER AI;Lo;0;L;;;;;N;;;;; +11688;TAKRI LETTER O;Lo;0;L;;;;;N;;;;; +11689;TAKRI LETTER AU;Lo;0;L;;;;;N;;;;; +1168A;TAKRI LETTER KA;Lo;0;L;;;;;N;;;;; +1168B;TAKRI LETTER KHA;Lo;0;L;;;;;N;;;;; +1168C;TAKRI LETTER GA;Lo;0;L;;;;;N;;;;; +1168D;TAKRI LETTER GHA;Lo;0;L;;;;;N;;;;; +1168E;TAKRI LETTER NGA;Lo;0;L;;;;;N;;;;; +1168F;TAKRI LETTER CA;Lo;0;L;;;;;N;;;;; +11690;TAKRI LETTER CHA;Lo;0;L;;;;;N;;;;; +11691;TAKRI LETTER JA;Lo;0;L;;;;;N;;;;; +11692;TAKRI LETTER JHA;Lo;0;L;;;;;N;;;;; +11693;TAKRI LETTER NYA;Lo;0;L;;;;;N;;;;; +11694;TAKRI LETTER TTA;Lo;0;L;;;;;N;;;;; +11695;TAKRI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11696;TAKRI LETTER DDA;Lo;0;L;;;;;N;;;;; +11697;TAKRI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11698;TAKRI LETTER NNA;Lo;0;L;;;;;N;;;;; +11699;TAKRI LETTER TA;Lo;0;L;;;;;N;;;;; +1169A;TAKRI LETTER THA;Lo;0;L;;;;;N;;;;; +1169B;TAKRI LETTER DA;Lo;0;L;;;;;N;;;;; +1169C;TAKRI LETTER DHA;Lo;0;L;;;;;N;;;;; +1169D;TAKRI LETTER NA;Lo;0;L;;;;;N;;;;; +1169E;TAKRI LETTER PA;Lo;0;L;;;;;N;;;;; +1169F;TAKRI LETTER PHA;Lo;0;L;;;;;N;;;;; +116A0;TAKRI LETTER BA;Lo;0;L;;;;;N;;;;; +116A1;TAKRI LETTER BHA;Lo;0;L;;;;;N;;;;; +116A2;TAKRI LETTER MA;Lo;0;L;;;;;N;;;;; +116A3;TAKRI LETTER YA;Lo;0;L;;;;;N;;;;; +116A4;TAKRI LETTER RA;Lo;0;L;;;;;N;;;;; +116A5;TAKRI LETTER LA;Lo;0;L;;;;;N;;;;; +116A6;TAKRI LETTER VA;Lo;0;L;;;;;N;;;;; +116A7;TAKRI LETTER SHA;Lo;0;L;;;;;N;;;;; +116A8;TAKRI LETTER SA;Lo;0;L;;;;;N;;;;; +116A9;TAKRI LETTER HA;Lo;0;L;;;;;N;;;;; +116AA;TAKRI LETTER RRA;Lo;0;L;;;;;N;;;;; +116AB;TAKRI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +116AC;TAKRI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +116AD;TAKRI VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +116AE;TAKRI VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +116AF;TAKRI VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +116B0;TAKRI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +116B1;TAKRI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +116B2;TAKRI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +116B3;TAKRI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +116B4;TAKRI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +116B5;TAKRI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +116B6;TAKRI SIGN VIRAMA;Mc;9;L;;;;;N;;;;; +116B7;TAKRI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +116C0;TAKRI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +116C1;TAKRI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +116C2;TAKRI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +116C3;TAKRI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +116C4;TAKRI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +116C5;TAKRI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +116C6;TAKRI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +116C7;TAKRI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +116C8;TAKRI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +116C9;TAKRI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11700;AHOM LETTER KA;Lo;0;L;;;;;N;;;;; +11701;AHOM LETTER KHA;Lo;0;L;;;;;N;;;;; +11702;AHOM LETTER NGA;Lo;0;L;;;;;N;;;;; +11703;AHOM LETTER NA;Lo;0;L;;;;;N;;;;; +11704;AHOM LETTER TA;Lo;0;L;;;;;N;;;;; +11705;AHOM LETTER ALTERNATE TA;Lo;0;L;;;;;N;;;;; +11706;AHOM LETTER PA;Lo;0;L;;;;;N;;;;; +11707;AHOM LETTER PHA;Lo;0;L;;;;;N;;;;; +11708;AHOM LETTER BA;Lo;0;L;;;;;N;;;;; +11709;AHOM LETTER MA;Lo;0;L;;;;;N;;;;; +1170A;AHOM LETTER JA;Lo;0;L;;;;;N;;;;; +1170B;AHOM LETTER CHA;Lo;0;L;;;;;N;;;;; +1170C;AHOM LETTER THA;Lo;0;L;;;;;N;;;;; +1170D;AHOM LETTER RA;Lo;0;L;;;;;N;;;;; +1170E;AHOM LETTER LA;Lo;0;L;;;;;N;;;;; +1170F;AHOM LETTER SA;Lo;0;L;;;;;N;;;;; +11710;AHOM LETTER NYA;Lo;0;L;;;;;N;;;;; +11711;AHOM LETTER HA;Lo;0;L;;;;;N;;;;; +11712;AHOM LETTER A;Lo;0;L;;;;;N;;;;; +11713;AHOM LETTER DA;Lo;0;L;;;;;N;;;;; +11714;AHOM LETTER DHA;Lo;0;L;;;;;N;;;;; +11715;AHOM LETTER GA;Lo;0;L;;;;;N;;;;; +11716;AHOM LETTER ALTERNATE GA;Lo;0;L;;;;;N;;;;; +11717;AHOM LETTER GHA;Lo;0;L;;;;;N;;;;; +11718;AHOM LETTER BHA;Lo;0;L;;;;;N;;;;; +11719;AHOM LETTER JHA;Lo;0;L;;;;;N;;;;; +1171D;AHOM CONSONANT SIGN MEDIAL LA;Mn;0;NSM;;;;;N;;;;; +1171E;AHOM CONSONANT SIGN MEDIAL RA;Mn;0;NSM;;;;;N;;;;; +1171F;AHOM CONSONANT SIGN MEDIAL LIGATING RA;Mn;0;NSM;;;;;N;;;;; +11720;AHOM VOWEL SIGN A;Mc;0;L;;;;;N;;;;; +11721;AHOM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +11722;AHOM VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11723;AHOM VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +11724;AHOM VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11725;AHOM VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +11726;AHOM VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +11727;AHOM VOWEL SIGN AW;Mn;0;NSM;;;;;N;;;;; +11728;AHOM VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11729;AHOM VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +1172A;AHOM VOWEL SIGN AM;Mn;0;NSM;;;;;N;;;;; +1172B;AHOM SIGN KILLER;Mn;9;NSM;;;;;N;;;;; +11730;AHOM DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11731;AHOM DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11732;AHOM DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11733;AHOM DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11734;AHOM DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11735;AHOM DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11736;AHOM DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11737;AHOM DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11738;AHOM DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11739;AHOM DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +1173A;AHOM NUMBER TEN;No;0;L;;;;10;N;;;;; +1173B;AHOM NUMBER TWENTY;No;0;L;;;;20;N;;;;; +1173C;AHOM SIGN SMALL SECTION;Po;0;L;;;;;N;;;;; +1173D;AHOM SIGN SECTION;Po;0;L;;;;;N;;;;; +1173E;AHOM SIGN RULAI;Po;0;L;;;;;N;;;;; +1173F;AHOM SYMBOL VI;So;0;L;;;;;N;;;;; +118A0;WARANG CITI CAPITAL LETTER NGAA;Lu;0;L;;;;;N;;;;118C0; +118A1;WARANG CITI CAPITAL LETTER A;Lu;0;L;;;;;N;;;;118C1; +118A2;WARANG CITI CAPITAL LETTER WI;Lu;0;L;;;;;N;;;;118C2; +118A3;WARANG CITI CAPITAL LETTER YU;Lu;0;L;;;;;N;;;;118C3; +118A4;WARANG CITI CAPITAL LETTER YA;Lu;0;L;;;;;N;;;;118C4; +118A5;WARANG CITI CAPITAL LETTER YO;Lu;0;L;;;;;N;;;;118C5; +118A6;WARANG CITI CAPITAL LETTER II;Lu;0;L;;;;;N;;;;118C6; +118A7;WARANG CITI CAPITAL LETTER UU;Lu;0;L;;;;;N;;;;118C7; +118A8;WARANG CITI CAPITAL LETTER E;Lu;0;L;;;;;N;;;;118C8; +118A9;WARANG CITI CAPITAL LETTER O;Lu;0;L;;;;;N;;;;118C9; +118AA;WARANG CITI CAPITAL LETTER ANG;Lu;0;L;;;;;N;;;;118CA; +118AB;WARANG CITI CAPITAL LETTER GA;Lu;0;L;;;;;N;;;;118CB; +118AC;WARANG CITI CAPITAL LETTER KO;Lu;0;L;;;;;N;;;;118CC; +118AD;WARANG CITI CAPITAL LETTER ENY;Lu;0;L;;;;;N;;;;118CD; +118AE;WARANG CITI CAPITAL LETTER YUJ;Lu;0;L;;;;;N;;;;118CE; +118AF;WARANG CITI CAPITAL LETTER UC;Lu;0;L;;;;;N;;;;118CF; +118B0;WARANG CITI CAPITAL LETTER ENN;Lu;0;L;;;;;N;;;;118D0; +118B1;WARANG CITI CAPITAL LETTER ODD;Lu;0;L;;;;;N;;;;118D1; +118B2;WARANG CITI CAPITAL LETTER TTE;Lu;0;L;;;;;N;;;;118D2; +118B3;WARANG CITI CAPITAL LETTER NUNG;Lu;0;L;;;;;N;;;;118D3; +118B4;WARANG CITI CAPITAL LETTER DA;Lu;0;L;;;;;N;;;;118D4; +118B5;WARANG CITI CAPITAL LETTER AT;Lu;0;L;;;;;N;;;;118D5; +118B6;WARANG CITI CAPITAL LETTER AM;Lu;0;L;;;;;N;;;;118D6; +118B7;WARANG CITI CAPITAL LETTER BU;Lu;0;L;;;;;N;;;;118D7; +118B8;WARANG CITI CAPITAL LETTER PU;Lu;0;L;;;;;N;;;;118D8; +118B9;WARANG CITI CAPITAL LETTER HIYO;Lu;0;L;;;;;N;;;;118D9; +118BA;WARANG CITI CAPITAL LETTER HOLO;Lu;0;L;;;;;N;;;;118DA; +118BB;WARANG CITI CAPITAL LETTER HORR;Lu;0;L;;;;;N;;;;118DB; +118BC;WARANG CITI CAPITAL LETTER HAR;Lu;0;L;;;;;N;;;;118DC; +118BD;WARANG CITI CAPITAL LETTER SSUU;Lu;0;L;;;;;N;;;;118DD; +118BE;WARANG CITI CAPITAL LETTER SII;Lu;0;L;;;;;N;;;;118DE; +118BF;WARANG CITI CAPITAL LETTER VIYO;Lu;0;L;;;;;N;;;;118DF; +118C0;WARANG CITI SMALL LETTER NGAA;Ll;0;L;;;;;N;;;118A0;;118A0 +118C1;WARANG CITI SMALL LETTER A;Ll;0;L;;;;;N;;;118A1;;118A1 +118C2;WARANG CITI SMALL LETTER WI;Ll;0;L;;;;;N;;;118A2;;118A2 +118C3;WARANG CITI SMALL LETTER YU;Ll;0;L;;;;;N;;;118A3;;118A3 +118C4;WARANG CITI SMALL LETTER YA;Ll;0;L;;;;;N;;;118A4;;118A4 +118C5;WARANG CITI SMALL LETTER YO;Ll;0;L;;;;;N;;;118A5;;118A5 +118C6;WARANG CITI SMALL LETTER II;Ll;0;L;;;;;N;;;118A6;;118A6 +118C7;WARANG CITI SMALL LETTER UU;Ll;0;L;;;;;N;;;118A7;;118A7 +118C8;WARANG CITI SMALL LETTER E;Ll;0;L;;;;;N;;;118A8;;118A8 +118C9;WARANG CITI SMALL LETTER O;Ll;0;L;;;;;N;;;118A9;;118A9 +118CA;WARANG CITI SMALL LETTER ANG;Ll;0;L;;;;;N;;;118AA;;118AA +118CB;WARANG CITI SMALL LETTER GA;Ll;0;L;;;;;N;;;118AB;;118AB +118CC;WARANG CITI SMALL LETTER KO;Ll;0;L;;;;;N;;;118AC;;118AC +118CD;WARANG CITI SMALL LETTER ENY;Ll;0;L;;;;;N;;;118AD;;118AD +118CE;WARANG CITI SMALL LETTER YUJ;Ll;0;L;;;;;N;;;118AE;;118AE +118CF;WARANG CITI SMALL LETTER UC;Ll;0;L;;;;;N;;;118AF;;118AF +118D0;WARANG CITI SMALL LETTER ENN;Ll;0;L;;;;;N;;;118B0;;118B0 +118D1;WARANG CITI SMALL LETTER ODD;Ll;0;L;;;;;N;;;118B1;;118B1 +118D2;WARANG CITI SMALL LETTER TTE;Ll;0;L;;;;;N;;;118B2;;118B2 +118D3;WARANG CITI SMALL LETTER NUNG;Ll;0;L;;;;;N;;;118B3;;118B3 +118D4;WARANG CITI SMALL LETTER DA;Ll;0;L;;;;;N;;;118B4;;118B4 +118D5;WARANG CITI SMALL LETTER AT;Ll;0;L;;;;;N;;;118B5;;118B5 +118D6;WARANG CITI SMALL LETTER AM;Ll;0;L;;;;;N;;;118B6;;118B6 +118D7;WARANG CITI SMALL LETTER BU;Ll;0;L;;;;;N;;;118B7;;118B7 +118D8;WARANG CITI SMALL LETTER PU;Ll;0;L;;;;;N;;;118B8;;118B8 +118D9;WARANG CITI SMALL LETTER HIYO;Ll;0;L;;;;;N;;;118B9;;118B9 +118DA;WARANG CITI SMALL LETTER HOLO;Ll;0;L;;;;;N;;;118BA;;118BA +118DB;WARANG CITI SMALL LETTER HORR;Ll;0;L;;;;;N;;;118BB;;118BB +118DC;WARANG CITI SMALL LETTER HAR;Ll;0;L;;;;;N;;;118BC;;118BC +118DD;WARANG CITI SMALL LETTER SSUU;Ll;0;L;;;;;N;;;118BD;;118BD +118DE;WARANG CITI SMALL LETTER SII;Ll;0;L;;;;;N;;;118BE;;118BE +118DF;WARANG CITI SMALL LETTER VIYO;Ll;0;L;;;;;N;;;118BF;;118BF +118E0;WARANG CITI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +118E1;WARANG CITI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +118E2;WARANG CITI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +118E3;WARANG CITI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +118E4;WARANG CITI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +118E5;WARANG CITI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +118E6;WARANG CITI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +118E7;WARANG CITI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +118E8;WARANG CITI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +118E9;WARANG CITI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +118EA;WARANG CITI NUMBER TEN;No;0;L;;;;10;N;;;;; +118EB;WARANG CITI NUMBER TWENTY;No;0;L;;;;20;N;;;;; +118EC;WARANG CITI NUMBER THIRTY;No;0;L;;;;30;N;;;;; +118ED;WARANG CITI NUMBER FORTY;No;0;L;;;;40;N;;;;; +118EE;WARANG CITI NUMBER FIFTY;No;0;L;;;;50;N;;;;; +118EF;WARANG CITI NUMBER SIXTY;No;0;L;;;;60;N;;;;; +118F0;WARANG CITI NUMBER SEVENTY;No;0;L;;;;70;N;;;;; +118F1;WARANG CITI NUMBER EIGHTY;No;0;L;;;;80;N;;;;; +118F2;WARANG CITI NUMBER NINETY;No;0;L;;;;90;N;;;;; +118FF;WARANG CITI OM;Lo;0;L;;;;;N;;;;; +11A00;ZANABAZAR SQUARE LETTER A;Lo;0;L;;;;;N;;;;; +11A01;ZANABAZAR SQUARE VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11A02;ZANABAZAR SQUARE VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +11A03;ZANABAZAR SQUARE VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11A04;ZANABAZAR SQUARE VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11A05;ZANABAZAR SQUARE VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;; +11A06;ZANABAZAR SQUARE VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11A07;ZANABAZAR SQUARE VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +11A08;ZANABAZAR SQUARE VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11A09;ZANABAZAR SQUARE VOWEL SIGN REVERSED I;Mn;0;NSM;;;;;N;;;;; +11A0A;ZANABAZAR SQUARE VOWEL LENGTH MARK;Mn;0;NSM;;;;;N;;;;; +11A0B;ZANABAZAR SQUARE LETTER KA;Lo;0;L;;;;;N;;;;; +11A0C;ZANABAZAR SQUARE LETTER KHA;Lo;0;L;;;;;N;;;;; +11A0D;ZANABAZAR SQUARE LETTER GA;Lo;0;L;;;;;N;;;;; +11A0E;ZANABAZAR SQUARE LETTER GHA;Lo;0;L;;;;;N;;;;; +11A0F;ZANABAZAR SQUARE LETTER NGA;Lo;0;L;;;;;N;;;;; +11A10;ZANABAZAR SQUARE LETTER CA;Lo;0;L;;;;;N;;;;; +11A11;ZANABAZAR SQUARE LETTER CHA;Lo;0;L;;;;;N;;;;; +11A12;ZANABAZAR SQUARE LETTER JA;Lo;0;L;;;;;N;;;;; +11A13;ZANABAZAR SQUARE LETTER NYA;Lo;0;L;;;;;N;;;;; +11A14;ZANABAZAR SQUARE LETTER TTA;Lo;0;L;;;;;N;;;;; +11A15;ZANABAZAR SQUARE LETTER TTHA;Lo;0;L;;;;;N;;;;; +11A16;ZANABAZAR SQUARE LETTER DDA;Lo;0;L;;;;;N;;;;; +11A17;ZANABAZAR SQUARE LETTER DDHA;Lo;0;L;;;;;N;;;;; +11A18;ZANABAZAR SQUARE LETTER NNA;Lo;0;L;;;;;N;;;;; +11A19;ZANABAZAR SQUARE LETTER TA;Lo;0;L;;;;;N;;;;; +11A1A;ZANABAZAR SQUARE LETTER THA;Lo;0;L;;;;;N;;;;; +11A1B;ZANABAZAR SQUARE LETTER DA;Lo;0;L;;;;;N;;;;; +11A1C;ZANABAZAR SQUARE LETTER DHA;Lo;0;L;;;;;N;;;;; +11A1D;ZANABAZAR SQUARE LETTER NA;Lo;0;L;;;;;N;;;;; +11A1E;ZANABAZAR SQUARE LETTER PA;Lo;0;L;;;;;N;;;;; +11A1F;ZANABAZAR SQUARE LETTER PHA;Lo;0;L;;;;;N;;;;; +11A20;ZANABAZAR SQUARE LETTER BA;Lo;0;L;;;;;N;;;;; +11A21;ZANABAZAR SQUARE LETTER BHA;Lo;0;L;;;;;N;;;;; +11A22;ZANABAZAR SQUARE LETTER MA;Lo;0;L;;;;;N;;;;; +11A23;ZANABAZAR SQUARE LETTER TSA;Lo;0;L;;;;;N;;;;; +11A24;ZANABAZAR SQUARE LETTER TSHA;Lo;0;L;;;;;N;;;;; +11A25;ZANABAZAR SQUARE LETTER DZA;Lo;0;L;;;;;N;;;;; +11A26;ZANABAZAR SQUARE LETTER DZHA;Lo;0;L;;;;;N;;;;; +11A27;ZANABAZAR SQUARE LETTER ZHA;Lo;0;L;;;;;N;;;;; +11A28;ZANABAZAR SQUARE LETTER ZA;Lo;0;L;;;;;N;;;;; +11A29;ZANABAZAR SQUARE LETTER -A;Lo;0;L;;;;;N;;;;; +11A2A;ZANABAZAR SQUARE LETTER YA;Lo;0;L;;;;;N;;;;; +11A2B;ZANABAZAR SQUARE LETTER RA;Lo;0;L;;;;;N;;;;; +11A2C;ZANABAZAR SQUARE LETTER LA;Lo;0;L;;;;;N;;;;; +11A2D;ZANABAZAR SQUARE LETTER VA;Lo;0;L;;;;;N;;;;; +11A2E;ZANABAZAR SQUARE LETTER SHA;Lo;0;L;;;;;N;;;;; +11A2F;ZANABAZAR SQUARE LETTER SSA;Lo;0;L;;;;;N;;;;; +11A30;ZANABAZAR SQUARE LETTER SA;Lo;0;L;;;;;N;;;;; +11A31;ZANABAZAR SQUARE LETTER HA;Lo;0;L;;;;;N;;;;; +11A32;ZANABAZAR SQUARE LETTER KSSA;Lo;0;L;;;;;N;;;;; +11A33;ZANABAZAR SQUARE FINAL CONSONANT MARK;Mn;0;NSM;;;;;N;;;;; +11A34;ZANABAZAR SQUARE SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;; +11A35;ZANABAZAR SQUARE SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11A36;ZANABAZAR SQUARE SIGN CANDRABINDU WITH ORNAMENT;Mn;0;NSM;;;;;N;;;;; +11A37;ZANABAZAR SQUARE SIGN CANDRA WITH ORNAMENT;Mn;0;NSM;;;;;N;;;;; +11A38;ZANABAZAR SQUARE SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11A39;ZANABAZAR SQUARE SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11A3A;ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA;Lo;0;L;;;;;N;;;;; +11A3B;ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA;Mn;0;NSM;;;;;N;;;;; +11A3C;ZANABAZAR SQUARE CLUSTER-FINAL LETTER RA;Mn;0;NSM;;;;;N;;;;; +11A3D;ZANABAZAR SQUARE CLUSTER-FINAL LETTER LA;Mn;0;NSM;;;;;N;;;;; +11A3E;ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA;Mn;0;NSM;;;;;N;;;;; +11A3F;ZANABAZAR SQUARE INITIAL HEAD MARK;Po;0;L;;;;;N;;;;; +11A40;ZANABAZAR SQUARE CLOSING HEAD MARK;Po;0;L;;;;;N;;;;; +11A41;ZANABAZAR SQUARE MARK TSHEG;Po;0;L;;;;;N;;;;; +11A42;ZANABAZAR SQUARE MARK SHAD;Po;0;L;;;;;N;;;;; +11A43;ZANABAZAR SQUARE MARK DOUBLE SHAD;Po;0;L;;;;;N;;;;; +11A44;ZANABAZAR SQUARE MARK LONG TSHEG;Po;0;L;;;;;N;;;;; +11A45;ZANABAZAR SQUARE INITIAL DOUBLE-LINED HEAD MARK;Po;0;L;;;;;N;;;;; +11A46;ZANABAZAR SQUARE CLOSING DOUBLE-LINED HEAD MARK;Po;0;L;;;;;N;;;;; +11A47;ZANABAZAR SQUARE SUBJOINER;Mn;9;NSM;;;;;N;;;;; +11A50;SOYOMBO LETTER A;Lo;0;L;;;;;N;;;;; +11A51;SOYOMBO VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11A52;SOYOMBO VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;; +11A53;SOYOMBO VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11A54;SOYOMBO VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11A55;SOYOMBO VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11A56;SOYOMBO VOWEL SIGN OE;Mn;0;NSM;;;;;N;;;;; +11A57;SOYOMBO VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +11A58;SOYOMBO VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +11A59;SOYOMBO VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11A5A;SOYOMBO VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +11A5B;SOYOMBO VOWEL LENGTH MARK;Mn;0;NSM;;;;;N;;;;; +11A5C;SOYOMBO LETTER KA;Lo;0;L;;;;;N;;;;; +11A5D;SOYOMBO LETTER KHA;Lo;0;L;;;;;N;;;;; +11A5E;SOYOMBO LETTER GA;Lo;0;L;;;;;N;;;;; +11A5F;SOYOMBO LETTER GHA;Lo;0;L;;;;;N;;;;; +11A60;SOYOMBO LETTER NGA;Lo;0;L;;;;;N;;;;; +11A61;SOYOMBO LETTER CA;Lo;0;L;;;;;N;;;;; +11A62;SOYOMBO LETTER CHA;Lo;0;L;;;;;N;;;;; +11A63;SOYOMBO LETTER JA;Lo;0;L;;;;;N;;;;; +11A64;SOYOMBO LETTER JHA;Lo;0;L;;;;;N;;;;; +11A65;SOYOMBO LETTER NYA;Lo;0;L;;;;;N;;;;; +11A66;SOYOMBO LETTER TTA;Lo;0;L;;;;;N;;;;; +11A67;SOYOMBO LETTER TTHA;Lo;0;L;;;;;N;;;;; +11A68;SOYOMBO LETTER DDA;Lo;0;L;;;;;N;;;;; +11A69;SOYOMBO LETTER DDHA;Lo;0;L;;;;;N;;;;; +11A6A;SOYOMBO LETTER NNA;Lo;0;L;;;;;N;;;;; +11A6B;SOYOMBO LETTER TA;Lo;0;L;;;;;N;;;;; +11A6C;SOYOMBO LETTER THA;Lo;0;L;;;;;N;;;;; +11A6D;SOYOMBO LETTER DA;Lo;0;L;;;;;N;;;;; +11A6E;SOYOMBO LETTER DHA;Lo;0;L;;;;;N;;;;; +11A6F;SOYOMBO LETTER NA;Lo;0;L;;;;;N;;;;; +11A70;SOYOMBO LETTER PA;Lo;0;L;;;;;N;;;;; +11A71;SOYOMBO LETTER PHA;Lo;0;L;;;;;N;;;;; +11A72;SOYOMBO LETTER BA;Lo;0;L;;;;;N;;;;; +11A73;SOYOMBO LETTER BHA;Lo;0;L;;;;;N;;;;; +11A74;SOYOMBO LETTER MA;Lo;0;L;;;;;N;;;;; +11A75;SOYOMBO LETTER TSA;Lo;0;L;;;;;N;;;;; +11A76;SOYOMBO LETTER TSHA;Lo;0;L;;;;;N;;;;; +11A77;SOYOMBO LETTER DZA;Lo;0;L;;;;;N;;;;; +11A78;SOYOMBO LETTER ZHA;Lo;0;L;;;;;N;;;;; +11A79;SOYOMBO LETTER ZA;Lo;0;L;;;;;N;;;;; +11A7A;SOYOMBO LETTER -A;Lo;0;L;;;;;N;;;;; +11A7B;SOYOMBO LETTER YA;Lo;0;L;;;;;N;;;;; +11A7C;SOYOMBO LETTER RA;Lo;0;L;;;;;N;;;;; +11A7D;SOYOMBO LETTER LA;Lo;0;L;;;;;N;;;;; +11A7E;SOYOMBO LETTER VA;Lo;0;L;;;;;N;;;;; +11A7F;SOYOMBO LETTER SHA;Lo;0;L;;;;;N;;;;; +11A80;SOYOMBO LETTER SSA;Lo;0;L;;;;;N;;;;; +11A81;SOYOMBO LETTER SA;Lo;0;L;;;;;N;;;;; +11A82;SOYOMBO LETTER HA;Lo;0;L;;;;;N;;;;; +11A83;SOYOMBO LETTER KSSA;Lo;0;L;;;;;N;;;;; +11A86;SOYOMBO CLUSTER-INITIAL LETTER RA;Lo;0;L;;;;;N;;;;; +11A87;SOYOMBO CLUSTER-INITIAL LETTER LA;Lo;0;L;;;;;N;;;;; +11A88;SOYOMBO CLUSTER-INITIAL LETTER SHA;Lo;0;L;;;;;N;;;;; +11A89;SOYOMBO CLUSTER-INITIAL LETTER SA;Lo;0;L;;;;;N;;;;; +11A8A;SOYOMBO FINAL CONSONANT SIGN G;Mn;0;NSM;;;;;N;;;;; +11A8B;SOYOMBO FINAL CONSONANT SIGN K;Mn;0;NSM;;;;;N;;;;; +11A8C;SOYOMBO FINAL CONSONANT SIGN NG;Mn;0;NSM;;;;;N;;;;; +11A8D;SOYOMBO FINAL CONSONANT SIGN D;Mn;0;NSM;;;;;N;;;;; +11A8E;SOYOMBO FINAL CONSONANT SIGN N;Mn;0;NSM;;;;;N;;;;; +11A8F;SOYOMBO FINAL CONSONANT SIGN B;Mn;0;NSM;;;;;N;;;;; +11A90;SOYOMBO FINAL CONSONANT SIGN M;Mn;0;NSM;;;;;N;;;;; +11A91;SOYOMBO FINAL CONSONANT SIGN R;Mn;0;NSM;;;;;N;;;;; +11A92;SOYOMBO FINAL CONSONANT SIGN L;Mn;0;NSM;;;;;N;;;;; +11A93;SOYOMBO FINAL CONSONANT SIGN SH;Mn;0;NSM;;;;;N;;;;; +11A94;SOYOMBO FINAL CONSONANT SIGN S;Mn;0;NSM;;;;;N;;;;; +11A95;SOYOMBO FINAL CONSONANT SIGN -A;Mn;0;NSM;;;;;N;;;;; +11A96;SOYOMBO SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11A97;SOYOMBO SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11A98;SOYOMBO GEMINATION MARK;Mn;0;NSM;;;;;N;;;;; +11A99;SOYOMBO SUBJOINER;Mn;9;NSM;;;;;N;;;;; +11A9A;SOYOMBO MARK TSHEG;Po;0;L;;;;;N;;;;; +11A9B;SOYOMBO MARK SHAD;Po;0;L;;;;;N;;;;; +11A9C;SOYOMBO MARK DOUBLE SHAD;Po;0;L;;;;;N;;;;; +11A9E;SOYOMBO HEAD MARK WITH MOON AND SUN AND TRIPLE FLAME;Po;0;L;;;;;N;;;;; +11A9F;SOYOMBO HEAD MARK WITH MOON AND SUN AND FLAME;Po;0;L;;;;;N;;;;; +11AA0;SOYOMBO HEAD MARK WITH MOON AND SUN;Po;0;L;;;;;N;;;;; +11AA1;SOYOMBO TERMINAL MARK-1;Po;0;L;;;;;N;;;;; +11AA2;SOYOMBO TERMINAL MARK-2;Po;0;L;;;;;N;;;;; +11AC0;PAU CIN HAU LETTER PA;Lo;0;L;;;;;N;;;;; +11AC1;PAU CIN HAU LETTER KA;Lo;0;L;;;;;N;;;;; +11AC2;PAU CIN HAU LETTER LA;Lo;0;L;;;;;N;;;;; +11AC3;PAU CIN HAU LETTER MA;Lo;0;L;;;;;N;;;;; +11AC4;PAU CIN HAU LETTER DA;Lo;0;L;;;;;N;;;;; +11AC5;PAU CIN HAU LETTER ZA;Lo;0;L;;;;;N;;;;; +11AC6;PAU CIN HAU LETTER VA;Lo;0;L;;;;;N;;;;; +11AC7;PAU CIN HAU LETTER NGA;Lo;0;L;;;;;N;;;;; +11AC8;PAU CIN HAU LETTER HA;Lo;0;L;;;;;N;;;;; +11AC9;PAU CIN HAU LETTER GA;Lo;0;L;;;;;N;;;;; +11ACA;PAU CIN HAU LETTER KHA;Lo;0;L;;;;;N;;;;; +11ACB;PAU CIN HAU LETTER SA;Lo;0;L;;;;;N;;;;; +11ACC;PAU CIN HAU LETTER BA;Lo;0;L;;;;;N;;;;; +11ACD;PAU CIN HAU LETTER CA;Lo;0;L;;;;;N;;;;; +11ACE;PAU CIN HAU LETTER TA;Lo;0;L;;;;;N;;;;; +11ACF;PAU CIN HAU LETTER THA;Lo;0;L;;;;;N;;;;; +11AD0;PAU CIN HAU LETTER NA;Lo;0;L;;;;;N;;;;; +11AD1;PAU CIN HAU LETTER PHA;Lo;0;L;;;;;N;;;;; +11AD2;PAU CIN HAU LETTER RA;Lo;0;L;;;;;N;;;;; +11AD3;PAU CIN HAU LETTER FA;Lo;0;L;;;;;N;;;;; +11AD4;PAU CIN HAU LETTER CHA;Lo;0;L;;;;;N;;;;; +11AD5;PAU CIN HAU LETTER A;Lo;0;L;;;;;N;;;;; +11AD6;PAU CIN HAU LETTER E;Lo;0;L;;;;;N;;;;; +11AD7;PAU CIN HAU LETTER I;Lo;0;L;;;;;N;;;;; +11AD8;PAU CIN HAU LETTER O;Lo;0;L;;;;;N;;;;; +11AD9;PAU CIN HAU LETTER U;Lo;0;L;;;;;N;;;;; +11ADA;PAU CIN HAU LETTER UA;Lo;0;L;;;;;N;;;;; +11ADB;PAU CIN HAU LETTER IA;Lo;0;L;;;;;N;;;;; +11ADC;PAU CIN HAU LETTER FINAL P;Lo;0;L;;;;;N;;;;; +11ADD;PAU CIN HAU LETTER FINAL K;Lo;0;L;;;;;N;;;;; +11ADE;PAU CIN HAU LETTER FINAL T;Lo;0;L;;;;;N;;;;; +11ADF;PAU CIN HAU LETTER FINAL M;Lo;0;L;;;;;N;;;;; +11AE0;PAU CIN HAU LETTER FINAL N;Lo;0;L;;;;;N;;;;; +11AE1;PAU CIN HAU LETTER FINAL L;Lo;0;L;;;;;N;;;;; +11AE2;PAU CIN HAU LETTER FINAL W;Lo;0;L;;;;;N;;;;; +11AE3;PAU CIN HAU LETTER FINAL NG;Lo;0;L;;;;;N;;;;; +11AE4;PAU CIN HAU LETTER FINAL Y;Lo;0;L;;;;;N;;;;; +11AE5;PAU CIN HAU RISING TONE LONG;Lo;0;L;;;;;N;;;;; +11AE6;PAU CIN HAU RISING TONE;Lo;0;L;;;;;N;;;;; +11AE7;PAU CIN HAU SANDHI GLOTTAL STOP;Lo;0;L;;;;;N;;;;; +11AE8;PAU CIN HAU RISING TONE LONG FINAL;Lo;0;L;;;;;N;;;;; +11AE9;PAU CIN HAU RISING TONE FINAL;Lo;0;L;;;;;N;;;;; +11AEA;PAU CIN HAU SANDHI GLOTTAL STOP FINAL;Lo;0;L;;;;;N;;;;; +11AEB;PAU CIN HAU SANDHI TONE LONG;Lo;0;L;;;;;N;;;;; +11AEC;PAU CIN HAU SANDHI TONE;Lo;0;L;;;;;N;;;;; +11AED;PAU CIN HAU SANDHI TONE LONG FINAL;Lo;0;L;;;;;N;;;;; +11AEE;PAU CIN HAU SANDHI TONE FINAL;Lo;0;L;;;;;N;;;;; +11AEF;PAU CIN HAU MID-LEVEL TONE;Lo;0;L;;;;;N;;;;; +11AF0;PAU CIN HAU GLOTTAL STOP VARIANT;Lo;0;L;;;;;N;;;;; +11AF1;PAU CIN HAU MID-LEVEL TONE LONG FINAL;Lo;0;L;;;;;N;;;;; +11AF2;PAU CIN HAU MID-LEVEL TONE FINAL;Lo;0;L;;;;;N;;;;; +11AF3;PAU CIN HAU LOW-FALLING TONE LONG;Lo;0;L;;;;;N;;;;; +11AF4;PAU CIN HAU LOW-FALLING TONE;Lo;0;L;;;;;N;;;;; +11AF5;PAU CIN HAU GLOTTAL STOP;Lo;0;L;;;;;N;;;;; +11AF6;PAU CIN HAU LOW-FALLING TONE LONG FINAL;Lo;0;L;;;;;N;;;;; +11AF7;PAU CIN HAU LOW-FALLING TONE FINAL;Lo;0;L;;;;;N;;;;; +11AF8;PAU CIN HAU GLOTTAL STOP FINAL;Lo;0;L;;;;;N;;;;; +11C00;BHAIKSUKI LETTER A;Lo;0;L;;;;;N;;;;; +11C01;BHAIKSUKI LETTER AA;Lo;0;L;;;;;N;;;;; +11C02;BHAIKSUKI LETTER I;Lo;0;L;;;;;N;;;;; +11C03;BHAIKSUKI LETTER II;Lo;0;L;;;;;N;;;;; +11C04;BHAIKSUKI LETTER U;Lo;0;L;;;;;N;;;;; +11C05;BHAIKSUKI LETTER UU;Lo;0;L;;;;;N;;;;; +11C06;BHAIKSUKI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;; +11C07;BHAIKSUKI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;; +11C08;BHAIKSUKI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;; +11C0A;BHAIKSUKI LETTER E;Lo;0;L;;;;;N;;;;; +11C0B;BHAIKSUKI LETTER AI;Lo;0;L;;;;;N;;;;; +11C0C;BHAIKSUKI LETTER O;Lo;0;L;;;;;N;;;;; +11C0D;BHAIKSUKI LETTER AU;Lo;0;L;;;;;N;;;;; +11C0E;BHAIKSUKI LETTER KA;Lo;0;L;;;;;N;;;;; +11C0F;BHAIKSUKI LETTER KHA;Lo;0;L;;;;;N;;;;; +11C10;BHAIKSUKI LETTER GA;Lo;0;L;;;;;N;;;;; +11C11;BHAIKSUKI LETTER GHA;Lo;0;L;;;;;N;;;;; +11C12;BHAIKSUKI LETTER NGA;Lo;0;L;;;;;N;;;;; +11C13;BHAIKSUKI LETTER CA;Lo;0;L;;;;;N;;;;; +11C14;BHAIKSUKI LETTER CHA;Lo;0;L;;;;;N;;;;; +11C15;BHAIKSUKI LETTER JA;Lo;0;L;;;;;N;;;;; +11C16;BHAIKSUKI LETTER JHA;Lo;0;L;;;;;N;;;;; +11C17;BHAIKSUKI LETTER NYA;Lo;0;L;;;;;N;;;;; +11C18;BHAIKSUKI LETTER TTA;Lo;0;L;;;;;N;;;;; +11C19;BHAIKSUKI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11C1A;BHAIKSUKI LETTER DDA;Lo;0;L;;;;;N;;;;; +11C1B;BHAIKSUKI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11C1C;BHAIKSUKI LETTER NNA;Lo;0;L;;;;;N;;;;; +11C1D;BHAIKSUKI LETTER TA;Lo;0;L;;;;;N;;;;; +11C1E;BHAIKSUKI LETTER THA;Lo;0;L;;;;;N;;;;; +11C1F;BHAIKSUKI LETTER DA;Lo;0;L;;;;;N;;;;; +11C20;BHAIKSUKI LETTER DHA;Lo;0;L;;;;;N;;;;; +11C21;BHAIKSUKI LETTER NA;Lo;0;L;;;;;N;;;;; +11C22;BHAIKSUKI LETTER PA;Lo;0;L;;;;;N;;;;; +11C23;BHAIKSUKI LETTER PHA;Lo;0;L;;;;;N;;;;; +11C24;BHAIKSUKI LETTER BA;Lo;0;L;;;;;N;;;;; +11C25;BHAIKSUKI LETTER BHA;Lo;0;L;;;;;N;;;;; +11C26;BHAIKSUKI LETTER MA;Lo;0;L;;;;;N;;;;; +11C27;BHAIKSUKI LETTER YA;Lo;0;L;;;;;N;;;;; +11C28;BHAIKSUKI LETTER RA;Lo;0;L;;;;;N;;;;; +11C29;BHAIKSUKI LETTER LA;Lo;0;L;;;;;N;;;;; +11C2A;BHAIKSUKI LETTER VA;Lo;0;L;;;;;N;;;;; +11C2B;BHAIKSUKI LETTER SHA;Lo;0;L;;;;;N;;;;; +11C2C;BHAIKSUKI LETTER SSA;Lo;0;L;;;;;N;;;;; +11C2D;BHAIKSUKI LETTER SA;Lo;0;L;;;;;N;;;;; +11C2E;BHAIKSUKI LETTER HA;Lo;0;L;;;;;N;;;;; +11C2F;BHAIKSUKI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +11C30;BHAIKSUKI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11C31;BHAIKSUKI VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +11C32;BHAIKSUKI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11C33;BHAIKSUKI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +11C34;BHAIKSUKI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11C35;BHAIKSUKI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;; +11C36;BHAIKSUKI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;; +11C38;BHAIKSUKI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11C39;BHAIKSUKI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11C3A;BHAIKSUKI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11C3B;BHAIKSUKI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +11C3C;BHAIKSUKI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11C3D;BHAIKSUKI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11C3E;BHAIKSUKI SIGN VISARGA;Mc;0;L;;;;;N;;;;; +11C3F;BHAIKSUKI SIGN VIRAMA;Mn;9;L;;;;;N;;;;; +11C40;BHAIKSUKI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;; +11C41;BHAIKSUKI DANDA;Po;0;L;;;;;N;;;;; +11C42;BHAIKSUKI DOUBLE DANDA;Po;0;L;;;;;N;;;;; +11C43;BHAIKSUKI WORD SEPARATOR;Po;0;L;;;;;N;;;;; +11C44;BHAIKSUKI GAP FILLER-1;Po;0;L;;;;;N;;;;; +11C45;BHAIKSUKI GAP FILLER-2;Po;0;L;;;;;N;;;;; +11C50;BHAIKSUKI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11C51;BHAIKSUKI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11C52;BHAIKSUKI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11C53;BHAIKSUKI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11C54;BHAIKSUKI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11C55;BHAIKSUKI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11C56;BHAIKSUKI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11C57;BHAIKSUKI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11C58;BHAIKSUKI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11C59;BHAIKSUKI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +11C5A;BHAIKSUKI NUMBER ONE;No;0;L;;;;1;N;;;;; +11C5B;BHAIKSUKI NUMBER TWO;No;0;L;;;;2;N;;;;; +11C5C;BHAIKSUKI NUMBER THREE;No;0;L;;;;3;N;;;;; +11C5D;BHAIKSUKI NUMBER FOUR;No;0;L;;;;4;N;;;;; +11C5E;BHAIKSUKI NUMBER FIVE;No;0;L;;;;5;N;;;;; +11C5F;BHAIKSUKI NUMBER SIX;No;0;L;;;;6;N;;;;; +11C60;BHAIKSUKI NUMBER SEVEN;No;0;L;;;;7;N;;;;; +11C61;BHAIKSUKI NUMBER EIGHT;No;0;L;;;;8;N;;;;; +11C62;BHAIKSUKI NUMBER NINE;No;0;L;;;;9;N;;;;; +11C63;BHAIKSUKI NUMBER TEN;No;0;L;;;;10;N;;;;; +11C64;BHAIKSUKI NUMBER TWENTY;No;0;L;;;;20;N;;;;; +11C65;BHAIKSUKI NUMBER THIRTY;No;0;L;;;;30;N;;;;; +11C66;BHAIKSUKI NUMBER FORTY;No;0;L;;;;40;N;;;;; +11C67;BHAIKSUKI NUMBER FIFTY;No;0;L;;;;50;N;;;;; +11C68;BHAIKSUKI NUMBER SIXTY;No;0;L;;;;60;N;;;;; +11C69;BHAIKSUKI NUMBER SEVENTY;No;0;L;;;;70;N;;;;; +11C6A;BHAIKSUKI NUMBER EIGHTY;No;0;L;;;;80;N;;;;; +11C6B;BHAIKSUKI NUMBER NINETY;No;0;L;;;;90;N;;;;; +11C6C;BHAIKSUKI HUNDREDS UNIT MARK;No;0;L;;;;100;N;;;;; +11C70;MARCHEN HEAD MARK;Po;0;L;;;;;N;;;;; +11C71;MARCHEN MARK SHAD;Po;0;L;;;;;N;;;;; +11C72;MARCHEN LETTER KA;Lo;0;L;;;;;N;;;;; +11C73;MARCHEN LETTER KHA;Lo;0;L;;;;;N;;;;; +11C74;MARCHEN LETTER GA;Lo;0;L;;;;;N;;;;; +11C75;MARCHEN LETTER NGA;Lo;0;L;;;;;N;;;;; +11C76;MARCHEN LETTER CA;Lo;0;L;;;;;N;;;;; +11C77;MARCHEN LETTER CHA;Lo;0;L;;;;;N;;;;; +11C78;MARCHEN LETTER JA;Lo;0;L;;;;;N;;;;; +11C79;MARCHEN LETTER NYA;Lo;0;L;;;;;N;;;;; +11C7A;MARCHEN LETTER TA;Lo;0;L;;;;;N;;;;; +11C7B;MARCHEN LETTER THA;Lo;0;L;;;;;N;;;;; +11C7C;MARCHEN LETTER DA;Lo;0;L;;;;;N;;;;; +11C7D;MARCHEN LETTER NA;Lo;0;L;;;;;N;;;;; +11C7E;MARCHEN LETTER PA;Lo;0;L;;;;;N;;;;; +11C7F;MARCHEN LETTER PHA;Lo;0;L;;;;;N;;;;; +11C80;MARCHEN LETTER BA;Lo;0;L;;;;;N;;;;; +11C81;MARCHEN LETTER MA;Lo;0;L;;;;;N;;;;; +11C82;MARCHEN LETTER TSA;Lo;0;L;;;;;N;;;;; +11C83;MARCHEN LETTER TSHA;Lo;0;L;;;;;N;;;;; +11C84;MARCHEN LETTER DZA;Lo;0;L;;;;;N;;;;; +11C85;MARCHEN LETTER WA;Lo;0;L;;;;;N;;;;; +11C86;MARCHEN LETTER ZHA;Lo;0;L;;;;;N;;;;; +11C87;MARCHEN LETTER ZA;Lo;0;L;;;;;N;;;;; +11C88;MARCHEN LETTER -A;Lo;0;L;;;;;N;;;;; +11C89;MARCHEN LETTER YA;Lo;0;L;;;;;N;;;;; +11C8A;MARCHEN LETTER RA;Lo;0;L;;;;;N;;;;; +11C8B;MARCHEN LETTER LA;Lo;0;L;;;;;N;;;;; +11C8C;MARCHEN LETTER SHA;Lo;0;L;;;;;N;;;;; +11C8D;MARCHEN LETTER SA;Lo;0;L;;;;;N;;;;; +11C8E;MARCHEN LETTER HA;Lo;0;L;;;;;N;;;;; +11C8F;MARCHEN LETTER A;Lo;0;L;;;;;N;;;;; +11C92;MARCHEN SUBJOINED LETTER KA;Mn;0;NSM;;;;;N;;;;; +11C93;MARCHEN SUBJOINED LETTER KHA;Mn;0;NSM;;;;;N;;;;; +11C94;MARCHEN SUBJOINED LETTER GA;Mn;0;NSM;;;;;N;;;;; +11C95;MARCHEN SUBJOINED LETTER NGA;Mn;0;NSM;;;;;N;;;;; +11C96;MARCHEN SUBJOINED LETTER CA;Mn;0;NSM;;;;;N;;;;; +11C97;MARCHEN SUBJOINED LETTER CHA;Mn;0;NSM;;;;;N;;;;; +11C98;MARCHEN SUBJOINED LETTER JA;Mn;0;NSM;;;;;N;;;;; +11C99;MARCHEN SUBJOINED LETTER NYA;Mn;0;NSM;;;;;N;;;;; +11C9A;MARCHEN SUBJOINED LETTER TA;Mn;0;NSM;;;;;N;;;;; +11C9B;MARCHEN SUBJOINED LETTER THA;Mn;0;NSM;;;;;N;;;;; +11C9C;MARCHEN SUBJOINED LETTER DA;Mn;0;NSM;;;;;N;;;;; +11C9D;MARCHEN SUBJOINED LETTER NA;Mn;0;NSM;;;;;N;;;;; +11C9E;MARCHEN SUBJOINED LETTER PA;Mn;0;NSM;;;;;N;;;;; +11C9F;MARCHEN SUBJOINED LETTER PHA;Mn;0;NSM;;;;;N;;;;; +11CA0;MARCHEN SUBJOINED LETTER BA;Mn;0;NSM;;;;;N;;;;; +11CA1;MARCHEN SUBJOINED LETTER MA;Mn;0;NSM;;;;;N;;;;; +11CA2;MARCHEN SUBJOINED LETTER TSA;Mn;0;NSM;;;;;N;;;;; +11CA3;MARCHEN SUBJOINED LETTER TSHA;Mn;0;NSM;;;;;N;;;;; +11CA4;MARCHEN SUBJOINED LETTER DZA;Mn;0;NSM;;;;;N;;;;; +11CA5;MARCHEN SUBJOINED LETTER WA;Mn;0;NSM;;;;;N;;;;; +11CA6;MARCHEN SUBJOINED LETTER ZHA;Mn;0;NSM;;;;;N;;;;; +11CA7;MARCHEN SUBJOINED LETTER ZA;Mn;0;NSM;;;;;N;;;;; +11CA9;MARCHEN SUBJOINED LETTER YA;Mc;0;L;;;;;N;;;;; +11CAA;MARCHEN SUBJOINED LETTER RA;Mn;0;NSM;;;;;N;;;;; +11CAB;MARCHEN SUBJOINED LETTER LA;Mn;0;NSM;;;;;N;;;;; +11CAC;MARCHEN SUBJOINED LETTER SHA;Mn;0;NSM;;;;;N;;;;; +11CAD;MARCHEN SUBJOINED LETTER SA;Mn;0;NSM;;;;;N;;;;; +11CAE;MARCHEN SUBJOINED LETTER HA;Mn;0;NSM;;;;;N;;;;; +11CAF;MARCHEN SUBJOINED LETTER A;Mn;0;NSM;;;;;N;;;;; +11CB0;MARCHEN VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +11CB1;MARCHEN VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +11CB2;MARCHEN VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11CB3;MARCHEN VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11CB4;MARCHEN VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +11CB5;MARCHEN SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11CB6;MARCHEN SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;; +11D00;MASARAM GONDI LETTER A;Lo;0;L;;;;;N;;;;; +11D01;MASARAM GONDI LETTER AA;Lo;0;L;;;;;N;;;;; +11D02;MASARAM GONDI LETTER I;Lo;0;L;;;;;N;;;;; +11D03;MASARAM GONDI LETTER II;Lo;0;L;;;;;N;;;;; +11D04;MASARAM GONDI LETTER U;Lo;0;L;;;;;N;;;;; +11D05;MASARAM GONDI LETTER UU;Lo;0;L;;;;;N;;;;; +11D06;MASARAM GONDI LETTER E;Lo;0;L;;;;;N;;;;; +11D08;MASARAM GONDI LETTER AI;Lo;0;L;;;;;N;;;;; +11D09;MASARAM GONDI LETTER O;Lo;0;L;;;;;N;;;;; +11D0B;MASARAM GONDI LETTER AU;Lo;0;L;;;;;N;;;;; +11D0C;MASARAM GONDI LETTER KA;Lo;0;L;;;;;N;;;;; +11D0D;MASARAM GONDI LETTER KHA;Lo;0;L;;;;;N;;;;; +11D0E;MASARAM GONDI LETTER GA;Lo;0;L;;;;;N;;;;; +11D0F;MASARAM GONDI LETTER GHA;Lo;0;L;;;;;N;;;;; +11D10;MASARAM GONDI LETTER NGA;Lo;0;L;;;;;N;;;;; +11D11;MASARAM GONDI LETTER CA;Lo;0;L;;;;;N;;;;; +11D12;MASARAM GONDI LETTER CHA;Lo;0;L;;;;;N;;;;; +11D13;MASARAM GONDI LETTER JA;Lo;0;L;;;;;N;;;;; +11D14;MASARAM GONDI LETTER JHA;Lo;0;L;;;;;N;;;;; +11D15;MASARAM GONDI LETTER NYA;Lo;0;L;;;;;N;;;;; +11D16;MASARAM GONDI LETTER TTA;Lo;0;L;;;;;N;;;;; +11D17;MASARAM GONDI LETTER TTHA;Lo;0;L;;;;;N;;;;; +11D18;MASARAM GONDI LETTER DDA;Lo;0;L;;;;;N;;;;; +11D19;MASARAM GONDI LETTER DDHA;Lo;0;L;;;;;N;;;;; +11D1A;MASARAM GONDI LETTER NNA;Lo;0;L;;;;;N;;;;; +11D1B;MASARAM GONDI LETTER TA;Lo;0;L;;;;;N;;;;; +11D1C;MASARAM GONDI LETTER THA;Lo;0;L;;;;;N;;;;; +11D1D;MASARAM GONDI LETTER DA;Lo;0;L;;;;;N;;;;; +11D1E;MASARAM GONDI LETTER DHA;Lo;0;L;;;;;N;;;;; +11D1F;MASARAM GONDI LETTER NA;Lo;0;L;;;;;N;;;;; +11D20;MASARAM GONDI LETTER PA;Lo;0;L;;;;;N;;;;; +11D21;MASARAM GONDI LETTER PHA;Lo;0;L;;;;;N;;;;; +11D22;MASARAM GONDI LETTER BA;Lo;0;L;;;;;N;;;;; +11D23;MASARAM GONDI LETTER BHA;Lo;0;L;;;;;N;;;;; +11D24;MASARAM GONDI LETTER MA;Lo;0;L;;;;;N;;;;; +11D25;MASARAM GONDI LETTER YA;Lo;0;L;;;;;N;;;;; +11D26;MASARAM GONDI LETTER RA;Lo;0;L;;;;;N;;;;; +11D27;MASARAM GONDI LETTER LA;Lo;0;L;;;;;N;;;;; +11D28;MASARAM GONDI LETTER VA;Lo;0;L;;;;;N;;;;; +11D29;MASARAM GONDI LETTER SHA;Lo;0;L;;;;;N;;;;; +11D2A;MASARAM GONDI LETTER SSA;Lo;0;L;;;;;N;;;;; +11D2B;MASARAM GONDI LETTER SA;Lo;0;L;;;;;N;;;;; +11D2C;MASARAM GONDI LETTER HA;Lo;0;L;;;;;N;;;;; +11D2D;MASARAM GONDI LETTER LLA;Lo;0;L;;;;;N;;;;; +11D2E;MASARAM GONDI LETTER KSSA;Lo;0;L;;;;;N;;;;; +11D2F;MASARAM GONDI LETTER JNYA;Lo;0;L;;;;;N;;;;; +11D30;MASARAM GONDI LETTER TRA;Lo;0;L;;;;;N;;;;; +11D31;MASARAM GONDI VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;; +11D32;MASARAM GONDI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;; +11D33;MASARAM GONDI VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;; +11D34;MASARAM GONDI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;; +11D35;MASARAM GONDI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;; +11D36;MASARAM GONDI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;; +11D3A;MASARAM GONDI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;; +11D3C;MASARAM GONDI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;; +11D3D;MASARAM GONDI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;; +11D3F;MASARAM GONDI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;; +11D40;MASARAM GONDI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;; +11D41;MASARAM GONDI SIGN VISARGA;Mn;0;NSM;;;;;N;;;;; +11D42;MASARAM GONDI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;; +11D43;MASARAM GONDI SIGN CANDRA;Mn;0;NSM;;;;;N;;;;; +11D44;MASARAM GONDI SIGN HALANTA;Mn;9;NSM;;;;;N;;;;; +11D45;MASARAM GONDI VIRAMA;Mn;9;NSM;;;;;N;;;;; +11D46;MASARAM GONDI REPHA;Lo;0;L;;;;;N;;;;; +11D47;MASARAM GONDI RA-KARA;Mn;0;NSM;;;;;N;;;;; +11D50;MASARAM GONDI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +11D51;MASARAM GONDI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +11D52;MASARAM GONDI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +11D53;MASARAM GONDI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +11D54;MASARAM GONDI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +11D55;MASARAM GONDI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +11D56;MASARAM GONDI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +11D57;MASARAM GONDI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +11D58;MASARAM GONDI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +11D59;MASARAM GONDI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +12000;CUNEIFORM SIGN A;Lo;0;L;;;;;N;;;;; +12001;CUNEIFORM SIGN A TIMES A;Lo;0;L;;;;;N;;;;; +12002;CUNEIFORM SIGN A TIMES BAD;Lo;0;L;;;;;N;;;;; +12003;CUNEIFORM SIGN A TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +12004;CUNEIFORM SIGN A TIMES HA;Lo;0;L;;;;;N;;;;; +12005;CUNEIFORM SIGN A TIMES IGI;Lo;0;L;;;;;N;;;;; +12006;CUNEIFORM SIGN A TIMES LAGAR GUNU;Lo;0;L;;;;;N;;;;; +12007;CUNEIFORM SIGN A TIMES MUSH;Lo;0;L;;;;;N;;;;; +12008;CUNEIFORM SIGN A TIMES SAG;Lo;0;L;;;;;N;;;;; +12009;CUNEIFORM SIGN A2;Lo;0;L;;;;;N;;;;; +1200A;CUNEIFORM SIGN AB;Lo;0;L;;;;;N;;;;; +1200B;CUNEIFORM SIGN AB TIMES ASH2;Lo;0;L;;;;;N;;;;; +1200C;CUNEIFORM SIGN AB TIMES DUN3 GUNU;Lo;0;L;;;;;N;;;;; +1200D;CUNEIFORM SIGN AB TIMES GAL;Lo;0;L;;;;;N;;;;; +1200E;CUNEIFORM SIGN AB TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +1200F;CUNEIFORM SIGN AB TIMES HA;Lo;0;L;;;;;N;;;;; +12010;CUNEIFORM SIGN AB TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +12011;CUNEIFORM SIGN AB TIMES IMIN;Lo;0;L;;;;;N;;;;; +12012;CUNEIFORM SIGN AB TIMES LAGAB;Lo;0;L;;;;;N;;;;; +12013;CUNEIFORM SIGN AB TIMES SHESH;Lo;0;L;;;;;N;;;;; +12014;CUNEIFORM SIGN AB TIMES U PLUS U PLUS U;Lo;0;L;;;;;N;;;;; +12015;CUNEIFORM SIGN AB GUNU;Lo;0;L;;;;;N;;;;; +12016;CUNEIFORM SIGN AB2;Lo;0;L;;;;;N;;;;; +12017;CUNEIFORM SIGN AB2 TIMES BALAG;Lo;0;L;;;;;N;;;;; +12018;CUNEIFORM SIGN AB2 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +12019;CUNEIFORM SIGN AB2 TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;; +1201A;CUNEIFORM SIGN AB2 TIMES SHA3;Lo;0;L;;;;;N;;;;; +1201B;CUNEIFORM SIGN AB2 TIMES TAK4;Lo;0;L;;;;;N;;;;; +1201C;CUNEIFORM SIGN AD;Lo;0;L;;;;;N;;;;; +1201D;CUNEIFORM SIGN AK;Lo;0;L;;;;;N;;;;; +1201E;CUNEIFORM SIGN AK TIMES ERIN2;Lo;0;L;;;;;N;;;;; +1201F;CUNEIFORM SIGN AK TIMES SHITA PLUS GISH;Lo;0;L;;;;;N;;;;; +12020;CUNEIFORM SIGN AL;Lo;0;L;;;;;N;;;;; +12021;CUNEIFORM SIGN AL TIMES AL;Lo;0;L;;;;;N;;;;; +12022;CUNEIFORM SIGN AL TIMES DIM2;Lo;0;L;;;;;N;;;;; +12023;CUNEIFORM SIGN AL TIMES GISH;Lo;0;L;;;;;N;;;;; +12024;CUNEIFORM SIGN AL TIMES HA;Lo;0;L;;;;;N;;;;; +12025;CUNEIFORM SIGN AL TIMES KAD3;Lo;0;L;;;;;N;;;;; +12026;CUNEIFORM SIGN AL TIMES KI;Lo;0;L;;;;;N;;;;; +12027;CUNEIFORM SIGN AL TIMES SHE;Lo;0;L;;;;;N;;;;; +12028;CUNEIFORM SIGN AL TIMES USH;Lo;0;L;;;;;N;;;;; +12029;CUNEIFORM SIGN ALAN;Lo;0;L;;;;;N;;;;; +1202A;CUNEIFORM SIGN ALEPH;Lo;0;L;;;;;N;;;;; +1202B;CUNEIFORM SIGN AMAR;Lo;0;L;;;;;N;;;;; +1202C;CUNEIFORM SIGN AMAR TIMES SHE;Lo;0;L;;;;;N;;;;; +1202D;CUNEIFORM SIGN AN;Lo;0;L;;;;;N;;;;; +1202E;CUNEIFORM SIGN AN OVER AN;Lo;0;L;;;;;N;;;;; +1202F;CUNEIFORM SIGN AN THREE TIMES;Lo;0;L;;;;;N;;;;; +12030;CUNEIFORM SIGN AN PLUS NAGA OPPOSING AN PLUS NAGA;Lo;0;L;;;;;N;;;;; +12031;CUNEIFORM SIGN AN PLUS NAGA SQUARED;Lo;0;L;;;;;N;;;;; +12032;CUNEIFORM SIGN ANSHE;Lo;0;L;;;;;N;;;;; +12033;CUNEIFORM SIGN APIN;Lo;0;L;;;;;N;;;;; +12034;CUNEIFORM SIGN ARAD;Lo;0;L;;;;;N;;;;; +12035;CUNEIFORM SIGN ARAD TIMES KUR;Lo;0;L;;;;;N;;;;; +12036;CUNEIFORM SIGN ARKAB;Lo;0;L;;;;;N;;;;; +12037;CUNEIFORM SIGN ASAL2;Lo;0;L;;;;;N;;;;; +12038;CUNEIFORM SIGN ASH;Lo;0;L;;;;;N;;;;; +12039;CUNEIFORM SIGN ASH ZIDA TENU;Lo;0;L;;;;;N;;;;; +1203A;CUNEIFORM SIGN ASH KABA TENU;Lo;0;L;;;;;N;;;;; +1203B;CUNEIFORM SIGN ASH OVER ASH TUG2 OVER TUG2 TUG2 OVER TUG2 PAP;Lo;0;L;;;;;N;;;;; +1203C;CUNEIFORM SIGN ASH OVER ASH OVER ASH;Lo;0;L;;;;;N;;;;; +1203D;CUNEIFORM SIGN ASH OVER ASH OVER ASH CROSSING ASH OVER ASH OVER ASH;Lo;0;L;;;;;N;;;;; +1203E;CUNEIFORM SIGN ASH2;Lo;0;L;;;;;N;;;;; +1203F;CUNEIFORM SIGN ASHGAB;Lo;0;L;;;;;N;;;;; +12040;CUNEIFORM SIGN BA;Lo;0;L;;;;;N;;;;; +12041;CUNEIFORM SIGN BAD;Lo;0;L;;;;;N;;;;; +12042;CUNEIFORM SIGN BAG3;Lo;0;L;;;;;N;;;;; +12043;CUNEIFORM SIGN BAHAR2;Lo;0;L;;;;;N;;;;; +12044;CUNEIFORM SIGN BAL;Lo;0;L;;;;;N;;;;; +12045;CUNEIFORM SIGN BAL OVER BAL;Lo;0;L;;;;;N;;;;; +12046;CUNEIFORM SIGN BALAG;Lo;0;L;;;;;N;;;;; +12047;CUNEIFORM SIGN BAR;Lo;0;L;;;;;N;;;;; +12048;CUNEIFORM SIGN BARA2;Lo;0;L;;;;;N;;;;; +12049;CUNEIFORM SIGN BI;Lo;0;L;;;;;N;;;;; +1204A;CUNEIFORM SIGN BI TIMES A;Lo;0;L;;;;;N;;;;; +1204B;CUNEIFORM SIGN BI TIMES GAR;Lo;0;L;;;;;N;;;;; +1204C;CUNEIFORM SIGN BI TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +1204D;CUNEIFORM SIGN BU;Lo;0;L;;;;;N;;;;; +1204E;CUNEIFORM SIGN BU OVER BU AB;Lo;0;L;;;;;N;;;;; +1204F;CUNEIFORM SIGN BU OVER BU UN;Lo;0;L;;;;;N;;;;; +12050;CUNEIFORM SIGN BU CROSSING BU;Lo;0;L;;;;;N;;;;; +12051;CUNEIFORM SIGN BULUG;Lo;0;L;;;;;N;;;;; +12052;CUNEIFORM SIGN BULUG OVER BULUG;Lo;0;L;;;;;N;;;;; +12053;CUNEIFORM SIGN BUR;Lo;0;L;;;;;N;;;;; +12054;CUNEIFORM SIGN BUR2;Lo;0;L;;;;;N;;;;; +12055;CUNEIFORM SIGN DA;Lo;0;L;;;;;N;;;;; +12056;CUNEIFORM SIGN DAG;Lo;0;L;;;;;N;;;;; +12057;CUNEIFORM SIGN DAG KISIM5 TIMES A PLUS MASH;Lo;0;L;;;;;N;;;;; +12058;CUNEIFORM SIGN DAG KISIM5 TIMES AMAR;Lo;0;L;;;;;N;;;;; +12059;CUNEIFORM SIGN DAG KISIM5 TIMES BALAG;Lo;0;L;;;;;N;;;;; +1205A;CUNEIFORM SIGN DAG KISIM5 TIMES BI;Lo;0;L;;;;;N;;;;; +1205B;CUNEIFORM SIGN DAG KISIM5 TIMES GA;Lo;0;L;;;;;N;;;;; +1205C;CUNEIFORM SIGN DAG KISIM5 TIMES GA PLUS MASH;Lo;0;L;;;;;N;;;;; +1205D;CUNEIFORM SIGN DAG KISIM5 TIMES GI;Lo;0;L;;;;;N;;;;; +1205E;CUNEIFORM SIGN DAG KISIM5 TIMES GIR2;Lo;0;L;;;;;N;;;;; +1205F;CUNEIFORM SIGN DAG KISIM5 TIMES GUD;Lo;0;L;;;;;N;;;;; +12060;CUNEIFORM SIGN DAG KISIM5 TIMES HA;Lo;0;L;;;;;N;;;;; +12061;CUNEIFORM SIGN DAG KISIM5 TIMES IR;Lo;0;L;;;;;N;;;;; +12062;CUNEIFORM SIGN DAG KISIM5 TIMES IR PLUS LU;Lo;0;L;;;;;N;;;;; +12063;CUNEIFORM SIGN DAG KISIM5 TIMES KAK;Lo;0;L;;;;;N;;;;; +12064;CUNEIFORM SIGN DAG KISIM5 TIMES LA;Lo;0;L;;;;;N;;;;; +12065;CUNEIFORM SIGN DAG KISIM5 TIMES LU;Lo;0;L;;;;;N;;;;; +12066;CUNEIFORM SIGN DAG KISIM5 TIMES LU PLUS MASH2;Lo;0;L;;;;;N;;;;; +12067;CUNEIFORM SIGN DAG KISIM5 TIMES LUM;Lo;0;L;;;;;N;;;;; +12068;CUNEIFORM SIGN DAG KISIM5 TIMES NE;Lo;0;L;;;;;N;;;;; +12069;CUNEIFORM SIGN DAG KISIM5 TIMES PAP PLUS PAP;Lo;0;L;;;;;N;;;;; +1206A;CUNEIFORM SIGN DAG KISIM5 TIMES SI;Lo;0;L;;;;;N;;;;; +1206B;CUNEIFORM SIGN DAG KISIM5 TIMES TAK4;Lo;0;L;;;;;N;;;;; +1206C;CUNEIFORM SIGN DAG KISIM5 TIMES U2 PLUS GIR2;Lo;0;L;;;;;N;;;;; +1206D;CUNEIFORM SIGN DAG KISIM5 TIMES USH;Lo;0;L;;;;;N;;;;; +1206E;CUNEIFORM SIGN DAM;Lo;0;L;;;;;N;;;;; +1206F;CUNEIFORM SIGN DAR;Lo;0;L;;;;;N;;;;; +12070;CUNEIFORM SIGN DARA3;Lo;0;L;;;;;N;;;;; +12071;CUNEIFORM SIGN DARA4;Lo;0;L;;;;;N;;;;; +12072;CUNEIFORM SIGN DI;Lo;0;L;;;;;N;;;;; +12073;CUNEIFORM SIGN DIB;Lo;0;L;;;;;N;;;;; +12074;CUNEIFORM SIGN DIM;Lo;0;L;;;;;N;;;;; +12075;CUNEIFORM SIGN DIM TIMES SHE;Lo;0;L;;;;;N;;;;; +12076;CUNEIFORM SIGN DIM2;Lo;0;L;;;;;N;;;;; +12077;CUNEIFORM SIGN DIN;Lo;0;L;;;;;N;;;;; +12078;CUNEIFORM SIGN DIN KASKAL U GUNU DISH;Lo;0;L;;;;;N;;;;; +12079;CUNEIFORM SIGN DISH;Lo;0;L;;;;;N;;;;; +1207A;CUNEIFORM SIGN DU;Lo;0;L;;;;;N;;;;; +1207B;CUNEIFORM SIGN DU OVER DU;Lo;0;L;;;;;N;;;;; +1207C;CUNEIFORM SIGN DU GUNU;Lo;0;L;;;;;N;;;;; +1207D;CUNEIFORM SIGN DU SHESHIG;Lo;0;L;;;;;N;;;;; +1207E;CUNEIFORM SIGN DUB;Lo;0;L;;;;;N;;;;; +1207F;CUNEIFORM SIGN DUB TIMES ESH2;Lo;0;L;;;;;N;;;;; +12080;CUNEIFORM SIGN DUB2;Lo;0;L;;;;;N;;;;; +12081;CUNEIFORM SIGN DUG;Lo;0;L;;;;;N;;;;; +12082;CUNEIFORM SIGN DUGUD;Lo;0;L;;;;;N;;;;; +12083;CUNEIFORM SIGN DUH;Lo;0;L;;;;;N;;;;; +12084;CUNEIFORM SIGN DUN;Lo;0;L;;;;;N;;;;; +12085;CUNEIFORM SIGN DUN3;Lo;0;L;;;;;N;;;;; +12086;CUNEIFORM SIGN DUN3 GUNU;Lo;0;L;;;;;N;;;;; +12087;CUNEIFORM SIGN DUN3 GUNU GUNU;Lo;0;L;;;;;N;;;;; +12088;CUNEIFORM SIGN DUN4;Lo;0;L;;;;;N;;;;; +12089;CUNEIFORM SIGN DUR2;Lo;0;L;;;;;N;;;;; +1208A;CUNEIFORM SIGN E;Lo;0;L;;;;;N;;;;; +1208B;CUNEIFORM SIGN E TIMES PAP;Lo;0;L;;;;;N;;;;; +1208C;CUNEIFORM SIGN E OVER E NUN OVER NUN;Lo;0;L;;;;;N;;;;; +1208D;CUNEIFORM SIGN E2;Lo;0;L;;;;;N;;;;; +1208E;CUNEIFORM SIGN E2 TIMES A PLUS HA PLUS DA;Lo;0;L;;;;;N;;;;; +1208F;CUNEIFORM SIGN E2 TIMES GAR;Lo;0;L;;;;;N;;;;; +12090;CUNEIFORM SIGN E2 TIMES MI;Lo;0;L;;;;;N;;;;; +12091;CUNEIFORM SIGN E2 TIMES SAL;Lo;0;L;;;;;N;;;;; +12092;CUNEIFORM SIGN E2 TIMES SHE;Lo;0;L;;;;;N;;;;; +12093;CUNEIFORM SIGN E2 TIMES U;Lo;0;L;;;;;N;;;;; +12094;CUNEIFORM SIGN EDIN;Lo;0;L;;;;;N;;;;; +12095;CUNEIFORM SIGN EGIR;Lo;0;L;;;;;N;;;;; +12096;CUNEIFORM SIGN EL;Lo;0;L;;;;;N;;;;; +12097;CUNEIFORM SIGN EN;Lo;0;L;;;;;N;;;;; +12098;CUNEIFORM SIGN EN TIMES GAN2;Lo;0;L;;;;;N;;;;; +12099;CUNEIFORM SIGN EN TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +1209A;CUNEIFORM SIGN EN TIMES ME;Lo;0;L;;;;;N;;;;; +1209B;CUNEIFORM SIGN EN CROSSING EN;Lo;0;L;;;;;N;;;;; +1209C;CUNEIFORM SIGN EN OPPOSING EN;Lo;0;L;;;;;N;;;;; +1209D;CUNEIFORM SIGN EN SQUARED;Lo;0;L;;;;;N;;;;; +1209E;CUNEIFORM SIGN EREN;Lo;0;L;;;;;N;;;;; +1209F;CUNEIFORM SIGN ERIN2;Lo;0;L;;;;;N;;;;; +120A0;CUNEIFORM SIGN ESH2;Lo;0;L;;;;;N;;;;; +120A1;CUNEIFORM SIGN EZEN;Lo;0;L;;;;;N;;;;; +120A2;CUNEIFORM SIGN EZEN TIMES A;Lo;0;L;;;;;N;;;;; +120A3;CUNEIFORM SIGN EZEN TIMES A PLUS LAL;Lo;0;L;;;;;N;;;;; +120A4;CUNEIFORM SIGN EZEN TIMES A PLUS LAL TIMES LAL;Lo;0;L;;;;;N;;;;; +120A5;CUNEIFORM SIGN EZEN TIMES AN;Lo;0;L;;;;;N;;;;; +120A6;CUNEIFORM SIGN EZEN TIMES BAD;Lo;0;L;;;;;N;;;;; +120A7;CUNEIFORM SIGN EZEN TIMES DUN3 GUNU;Lo;0;L;;;;;N;;;;; +120A8;CUNEIFORM SIGN EZEN TIMES DUN3 GUNU GUNU;Lo;0;L;;;;;N;;;;; +120A9;CUNEIFORM SIGN EZEN TIMES HA;Lo;0;L;;;;;N;;;;; +120AA;CUNEIFORM SIGN EZEN TIMES HA GUNU;Lo;0;L;;;;;N;;;;; +120AB;CUNEIFORM SIGN EZEN TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +120AC;CUNEIFORM SIGN EZEN TIMES KASKAL;Lo;0;L;;;;;N;;;;; +120AD;CUNEIFORM SIGN EZEN TIMES KASKAL SQUARED;Lo;0;L;;;;;N;;;;; +120AE;CUNEIFORM SIGN EZEN TIMES KU3;Lo;0;L;;;;;N;;;;; +120AF;CUNEIFORM SIGN EZEN TIMES LA;Lo;0;L;;;;;N;;;;; +120B0;CUNEIFORM SIGN EZEN TIMES LAL TIMES LAL;Lo;0;L;;;;;N;;;;; +120B1;CUNEIFORM SIGN EZEN TIMES LI;Lo;0;L;;;;;N;;;;; +120B2;CUNEIFORM SIGN EZEN TIMES LU;Lo;0;L;;;;;N;;;;; +120B3;CUNEIFORM SIGN EZEN TIMES U2;Lo;0;L;;;;;N;;;;; +120B4;CUNEIFORM SIGN EZEN TIMES UD;Lo;0;L;;;;;N;;;;; +120B5;CUNEIFORM SIGN GA;Lo;0;L;;;;;N;;;;; +120B6;CUNEIFORM SIGN GA GUNU;Lo;0;L;;;;;N;;;;; +120B7;CUNEIFORM SIGN GA2;Lo;0;L;;;;;N;;;;; +120B8;CUNEIFORM SIGN GA2 TIMES A PLUS DA PLUS HA;Lo;0;L;;;;;N;;;;; +120B9;CUNEIFORM SIGN GA2 TIMES A PLUS HA;Lo;0;L;;;;;N;;;;; +120BA;CUNEIFORM SIGN GA2 TIMES A PLUS IGI;Lo;0;L;;;;;N;;;;; +120BB;CUNEIFORM SIGN GA2 TIMES AB2 TENU PLUS TAB;Lo;0;L;;;;;N;;;;; +120BC;CUNEIFORM SIGN GA2 TIMES AN;Lo;0;L;;;;;N;;;;; +120BD;CUNEIFORM SIGN GA2 TIMES ASH;Lo;0;L;;;;;N;;;;; +120BE;CUNEIFORM SIGN GA2 TIMES ASH2 PLUS GAL;Lo;0;L;;;;;N;;;;; +120BF;CUNEIFORM SIGN GA2 TIMES BAD;Lo;0;L;;;;;N;;;;; +120C0;CUNEIFORM SIGN GA2 TIMES BAR PLUS RA;Lo;0;L;;;;;N;;;;; +120C1;CUNEIFORM SIGN GA2 TIMES BUR;Lo;0;L;;;;;N;;;;; +120C2;CUNEIFORM SIGN GA2 TIMES BUR PLUS RA;Lo;0;L;;;;;N;;;;; +120C3;CUNEIFORM SIGN GA2 TIMES DA;Lo;0;L;;;;;N;;;;; +120C4;CUNEIFORM SIGN GA2 TIMES DI;Lo;0;L;;;;;N;;;;; +120C5;CUNEIFORM SIGN GA2 TIMES DIM TIMES SHE;Lo;0;L;;;;;N;;;;; +120C6;CUNEIFORM SIGN GA2 TIMES DUB;Lo;0;L;;;;;N;;;;; +120C7;CUNEIFORM SIGN GA2 TIMES EL;Lo;0;L;;;;;N;;;;; +120C8;CUNEIFORM SIGN GA2 TIMES EL PLUS LA;Lo;0;L;;;;;N;;;;; +120C9;CUNEIFORM SIGN GA2 TIMES EN;Lo;0;L;;;;;N;;;;; +120CA;CUNEIFORM SIGN GA2 TIMES EN TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +120CB;CUNEIFORM SIGN GA2 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +120CC;CUNEIFORM SIGN GA2 TIMES GAR;Lo;0;L;;;;;N;;;;; +120CD;CUNEIFORM SIGN GA2 TIMES GI;Lo;0;L;;;;;N;;;;; +120CE;CUNEIFORM SIGN GA2 TIMES GI4;Lo;0;L;;;;;N;;;;; +120CF;CUNEIFORM SIGN GA2 TIMES GI4 PLUS A;Lo;0;L;;;;;N;;;;; +120D0;CUNEIFORM SIGN GA2 TIMES GIR2 PLUS SU;Lo;0;L;;;;;N;;;;; +120D1;CUNEIFORM SIGN GA2 TIMES HA PLUS LU PLUS ESH2;Lo;0;L;;;;;N;;;;; +120D2;CUNEIFORM SIGN GA2 TIMES HAL;Lo;0;L;;;;;N;;;;; +120D3;CUNEIFORM SIGN GA2 TIMES HAL PLUS LA;Lo;0;L;;;;;N;;;;; +120D4;CUNEIFORM SIGN GA2 TIMES HI PLUS LI;Lo;0;L;;;;;N;;;;; +120D5;CUNEIFORM SIGN GA2 TIMES HUB2;Lo;0;L;;;;;N;;;;; +120D6;CUNEIFORM SIGN GA2 TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +120D7;CUNEIFORM SIGN GA2 TIMES ISH PLUS HU PLUS ASH;Lo;0;L;;;;;N;;;;; +120D8;CUNEIFORM SIGN GA2 TIMES KAK;Lo;0;L;;;;;N;;;;; +120D9;CUNEIFORM SIGN GA2 TIMES KASKAL;Lo;0;L;;;;;N;;;;; +120DA;CUNEIFORM SIGN GA2 TIMES KID;Lo;0;L;;;;;N;;;;; +120DB;CUNEIFORM SIGN GA2 TIMES KID PLUS LAL;Lo;0;L;;;;;N;;;;; +120DC;CUNEIFORM SIGN GA2 TIMES KU3 PLUS AN;Lo;0;L;;;;;N;;;;; +120DD;CUNEIFORM SIGN GA2 TIMES LA;Lo;0;L;;;;;N;;;;; +120DE;CUNEIFORM SIGN GA2 TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;; +120DF;CUNEIFORM SIGN GA2 TIMES MI;Lo;0;L;;;;;N;;;;; +120E0;CUNEIFORM SIGN GA2 TIMES NUN;Lo;0;L;;;;;N;;;;; +120E1;CUNEIFORM SIGN GA2 TIMES NUN OVER NUN;Lo;0;L;;;;;N;;;;; +120E2;CUNEIFORM SIGN GA2 TIMES PA;Lo;0;L;;;;;N;;;;; +120E3;CUNEIFORM SIGN GA2 TIMES SAL;Lo;0;L;;;;;N;;;;; +120E4;CUNEIFORM SIGN GA2 TIMES SAR;Lo;0;L;;;;;N;;;;; +120E5;CUNEIFORM SIGN GA2 TIMES SHE;Lo;0;L;;;;;N;;;;; +120E6;CUNEIFORM SIGN GA2 TIMES SHE PLUS TUR;Lo;0;L;;;;;N;;;;; +120E7;CUNEIFORM SIGN GA2 TIMES SHID;Lo;0;L;;;;;N;;;;; +120E8;CUNEIFORM SIGN GA2 TIMES SUM;Lo;0;L;;;;;N;;;;; +120E9;CUNEIFORM SIGN GA2 TIMES TAK4;Lo;0;L;;;;;N;;;;; +120EA;CUNEIFORM SIGN GA2 TIMES U;Lo;0;L;;;;;N;;;;; +120EB;CUNEIFORM SIGN GA2 TIMES UD;Lo;0;L;;;;;N;;;;; +120EC;CUNEIFORM SIGN GA2 TIMES UD PLUS DU;Lo;0;L;;;;;N;;;;; +120ED;CUNEIFORM SIGN GA2 OVER GA2;Lo;0;L;;;;;N;;;;; +120EE;CUNEIFORM SIGN GABA;Lo;0;L;;;;;N;;;;; +120EF;CUNEIFORM SIGN GABA CROSSING GABA;Lo;0;L;;;;;N;;;;; +120F0;CUNEIFORM SIGN GAD;Lo;0;L;;;;;N;;;;; +120F1;CUNEIFORM SIGN GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;; +120F2;CUNEIFORM SIGN GAL;Lo;0;L;;;;;N;;;;; +120F3;CUNEIFORM SIGN GAL GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;; +120F4;CUNEIFORM SIGN GALAM;Lo;0;L;;;;;N;;;;; +120F5;CUNEIFORM SIGN GAM;Lo;0;L;;;;;N;;;;; +120F6;CUNEIFORM SIGN GAN;Lo;0;L;;;;;N;;;;; +120F7;CUNEIFORM SIGN GAN2;Lo;0;L;;;;;N;;;;; +120F8;CUNEIFORM SIGN GAN2 TENU;Lo;0;L;;;;;N;;;;; +120F9;CUNEIFORM SIGN GAN2 OVER GAN2;Lo;0;L;;;;;N;;;;; +120FA;CUNEIFORM SIGN GAN2 CROSSING GAN2;Lo;0;L;;;;;N;;;;; +120FB;CUNEIFORM SIGN GAR;Lo;0;L;;;;;N;;;;; +120FC;CUNEIFORM SIGN GAR3;Lo;0;L;;;;;N;;;;; +120FD;CUNEIFORM SIGN GASHAN;Lo;0;L;;;;;N;;;;; +120FE;CUNEIFORM SIGN GESHTIN;Lo;0;L;;;;;N;;;;; +120FF;CUNEIFORM SIGN GESHTIN TIMES KUR;Lo;0;L;;;;;N;;;;; +12100;CUNEIFORM SIGN GI;Lo;0;L;;;;;N;;;;; +12101;CUNEIFORM SIGN GI TIMES E;Lo;0;L;;;;;N;;;;; +12102;CUNEIFORM SIGN GI TIMES U;Lo;0;L;;;;;N;;;;; +12103;CUNEIFORM SIGN GI CROSSING GI;Lo;0;L;;;;;N;;;;; +12104;CUNEIFORM SIGN GI4;Lo;0;L;;;;;N;;;;; +12105;CUNEIFORM SIGN GI4 OVER GI4;Lo;0;L;;;;;N;;;;; +12106;CUNEIFORM SIGN GI4 CROSSING GI4;Lo;0;L;;;;;N;;;;; +12107;CUNEIFORM SIGN GIDIM;Lo;0;L;;;;;N;;;;; +12108;CUNEIFORM SIGN GIR2;Lo;0;L;;;;;N;;;;; +12109;CUNEIFORM SIGN GIR2 GUNU;Lo;0;L;;;;;N;;;;; +1210A;CUNEIFORM SIGN GIR3;Lo;0;L;;;;;N;;;;; +1210B;CUNEIFORM SIGN GIR3 TIMES A PLUS IGI;Lo;0;L;;;;;N;;;;; +1210C;CUNEIFORM SIGN GIR3 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +1210D;CUNEIFORM SIGN GIR3 TIMES IGI;Lo;0;L;;;;;N;;;;; +1210E;CUNEIFORM SIGN GIR3 TIMES LU PLUS IGI;Lo;0;L;;;;;N;;;;; +1210F;CUNEIFORM SIGN GIR3 TIMES PA;Lo;0;L;;;;;N;;;;; +12110;CUNEIFORM SIGN GISAL;Lo;0;L;;;;;N;;;;; +12111;CUNEIFORM SIGN GISH;Lo;0;L;;;;;N;;;;; +12112;CUNEIFORM SIGN GISH CROSSING GISH;Lo;0;L;;;;;N;;;;; +12113;CUNEIFORM SIGN GISH TIMES BAD;Lo;0;L;;;;;N;;;;; +12114;CUNEIFORM SIGN GISH TIMES TAK4;Lo;0;L;;;;;N;;;;; +12115;CUNEIFORM SIGN GISH TENU;Lo;0;L;;;;;N;;;;; +12116;CUNEIFORM SIGN GU;Lo;0;L;;;;;N;;;;; +12117;CUNEIFORM SIGN GU CROSSING GU;Lo;0;L;;;;;N;;;;; +12118;CUNEIFORM SIGN GU2;Lo;0;L;;;;;N;;;;; +12119;CUNEIFORM SIGN GU2 TIMES KAK;Lo;0;L;;;;;N;;;;; +1211A;CUNEIFORM SIGN GU2 TIMES KAK TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +1211B;CUNEIFORM SIGN GU2 TIMES NUN;Lo;0;L;;;;;N;;;;; +1211C;CUNEIFORM SIGN GU2 TIMES SAL PLUS TUG2;Lo;0;L;;;;;N;;;;; +1211D;CUNEIFORM SIGN GU2 GUNU;Lo;0;L;;;;;N;;;;; +1211E;CUNEIFORM SIGN GUD;Lo;0;L;;;;;N;;;;; +1211F;CUNEIFORM SIGN GUD TIMES A PLUS KUR;Lo;0;L;;;;;N;;;;; +12120;CUNEIFORM SIGN GUD TIMES KUR;Lo;0;L;;;;;N;;;;; +12121;CUNEIFORM SIGN GUD OVER GUD LUGAL;Lo;0;L;;;;;N;;;;; +12122;CUNEIFORM SIGN GUL;Lo;0;L;;;;;N;;;;; +12123;CUNEIFORM SIGN GUM;Lo;0;L;;;;;N;;;;; +12124;CUNEIFORM SIGN GUM TIMES SHE;Lo;0;L;;;;;N;;;;; +12125;CUNEIFORM SIGN GUR;Lo;0;L;;;;;N;;;;; +12126;CUNEIFORM SIGN GUR7;Lo;0;L;;;;;N;;;;; +12127;CUNEIFORM SIGN GURUN;Lo;0;L;;;;;N;;;;; +12128;CUNEIFORM SIGN GURUSH;Lo;0;L;;;;;N;;;;; +12129;CUNEIFORM SIGN HA;Lo;0;L;;;;;N;;;;; +1212A;CUNEIFORM SIGN HA TENU;Lo;0;L;;;;;N;;;;; +1212B;CUNEIFORM SIGN HA GUNU;Lo;0;L;;;;;N;;;;; +1212C;CUNEIFORM SIGN HAL;Lo;0;L;;;;;N;;;;; +1212D;CUNEIFORM SIGN HI;Lo;0;L;;;;;N;;;;; +1212E;CUNEIFORM SIGN HI TIMES ASH;Lo;0;L;;;;;N;;;;; +1212F;CUNEIFORM SIGN HI TIMES ASH2;Lo;0;L;;;;;N;;;;; +12130;CUNEIFORM SIGN HI TIMES BAD;Lo;0;L;;;;;N;;;;; +12131;CUNEIFORM SIGN HI TIMES DISH;Lo;0;L;;;;;N;;;;; +12132;CUNEIFORM SIGN HI TIMES GAD;Lo;0;L;;;;;N;;;;; +12133;CUNEIFORM SIGN HI TIMES KIN;Lo;0;L;;;;;N;;;;; +12134;CUNEIFORM SIGN HI TIMES NUN;Lo;0;L;;;;;N;;;;; +12135;CUNEIFORM SIGN HI TIMES SHE;Lo;0;L;;;;;N;;;;; +12136;CUNEIFORM SIGN HI TIMES U;Lo;0;L;;;;;N;;;;; +12137;CUNEIFORM SIGN HU;Lo;0;L;;;;;N;;;;; +12138;CUNEIFORM SIGN HUB2;Lo;0;L;;;;;N;;;;; +12139;CUNEIFORM SIGN HUB2 TIMES AN;Lo;0;L;;;;;N;;;;; +1213A;CUNEIFORM SIGN HUB2 TIMES HAL;Lo;0;L;;;;;N;;;;; +1213B;CUNEIFORM SIGN HUB2 TIMES KASKAL;Lo;0;L;;;;;N;;;;; +1213C;CUNEIFORM SIGN HUB2 TIMES LISH;Lo;0;L;;;;;N;;;;; +1213D;CUNEIFORM SIGN HUB2 TIMES UD;Lo;0;L;;;;;N;;;;; +1213E;CUNEIFORM SIGN HUL2;Lo;0;L;;;;;N;;;;; +1213F;CUNEIFORM SIGN I;Lo;0;L;;;;;N;;;;; +12140;CUNEIFORM SIGN I A;Lo;0;L;;;;;N;;;;; +12141;CUNEIFORM SIGN IB;Lo;0;L;;;;;N;;;;; +12142;CUNEIFORM SIGN IDIM;Lo;0;L;;;;;N;;;;; +12143;CUNEIFORM SIGN IDIM OVER IDIM BUR;Lo;0;L;;;;;N;;;;; +12144;CUNEIFORM SIGN IDIM OVER IDIM SQUARED;Lo;0;L;;;;;N;;;;; +12145;CUNEIFORM SIGN IG;Lo;0;L;;;;;N;;;;; +12146;CUNEIFORM SIGN IGI;Lo;0;L;;;;;N;;;;; +12147;CUNEIFORM SIGN IGI DIB;Lo;0;L;;;;;N;;;;; +12148;CUNEIFORM SIGN IGI RI;Lo;0;L;;;;;N;;;;; +12149;CUNEIFORM SIGN IGI OVER IGI SHIR OVER SHIR UD OVER UD;Lo;0;L;;;;;N;;;;; +1214A;CUNEIFORM SIGN IGI GUNU;Lo;0;L;;;;;N;;;;; +1214B;CUNEIFORM SIGN IL;Lo;0;L;;;;;N;;;;; +1214C;CUNEIFORM SIGN IL TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +1214D;CUNEIFORM SIGN IL2;Lo;0;L;;;;;N;;;;; +1214E;CUNEIFORM SIGN IM;Lo;0;L;;;;;N;;;;; +1214F;CUNEIFORM SIGN IM TIMES TAK4;Lo;0;L;;;;;N;;;;; +12150;CUNEIFORM SIGN IM CROSSING IM;Lo;0;L;;;;;N;;;;; +12151;CUNEIFORM SIGN IM OPPOSING IM;Lo;0;L;;;;;N;;;;; +12152;CUNEIFORM SIGN IM SQUARED;Lo;0;L;;;;;N;;;;; +12153;CUNEIFORM SIGN IMIN;Lo;0;L;;;;;N;;;;; +12154;CUNEIFORM SIGN IN;Lo;0;L;;;;;N;;;;; +12155;CUNEIFORM SIGN IR;Lo;0;L;;;;;N;;;;; +12156;CUNEIFORM SIGN ISH;Lo;0;L;;;;;N;;;;; +12157;CUNEIFORM SIGN KA;Lo;0;L;;;;;N;;;;; +12158;CUNEIFORM SIGN KA TIMES A;Lo;0;L;;;;;N;;;;; +12159;CUNEIFORM SIGN KA TIMES AD;Lo;0;L;;;;;N;;;;; +1215A;CUNEIFORM SIGN KA TIMES AD PLUS KU3;Lo;0;L;;;;;N;;;;; +1215B;CUNEIFORM SIGN KA TIMES ASH2;Lo;0;L;;;;;N;;;;; +1215C;CUNEIFORM SIGN KA TIMES BAD;Lo;0;L;;;;;N;;;;; +1215D;CUNEIFORM SIGN KA TIMES BALAG;Lo;0;L;;;;;N;;;;; +1215E;CUNEIFORM SIGN KA TIMES BAR;Lo;0;L;;;;;N;;;;; +1215F;CUNEIFORM SIGN KA TIMES BI;Lo;0;L;;;;;N;;;;; +12160;CUNEIFORM SIGN KA TIMES ERIN2;Lo;0;L;;;;;N;;;;; +12161;CUNEIFORM SIGN KA TIMES ESH2;Lo;0;L;;;;;N;;;;; +12162;CUNEIFORM SIGN KA TIMES GA;Lo;0;L;;;;;N;;;;; +12163;CUNEIFORM SIGN KA TIMES GAL;Lo;0;L;;;;;N;;;;; +12164;CUNEIFORM SIGN KA TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +12165;CUNEIFORM SIGN KA TIMES GAR;Lo;0;L;;;;;N;;;;; +12166;CUNEIFORM SIGN KA TIMES GAR PLUS SHA3 PLUS A;Lo;0;L;;;;;N;;;;; +12167;CUNEIFORM SIGN KA TIMES GI;Lo;0;L;;;;;N;;;;; +12168;CUNEIFORM SIGN KA TIMES GIR2;Lo;0;L;;;;;N;;;;; +12169;CUNEIFORM SIGN KA TIMES GISH PLUS SAR;Lo;0;L;;;;;N;;;;; +1216A;CUNEIFORM SIGN KA TIMES GISH CROSSING GISH;Lo;0;L;;;;;N;;;;; +1216B;CUNEIFORM SIGN KA TIMES GU;Lo;0;L;;;;;N;;;;; +1216C;CUNEIFORM SIGN KA TIMES GUR7;Lo;0;L;;;;;N;;;;; +1216D;CUNEIFORM SIGN KA TIMES IGI;Lo;0;L;;;;;N;;;;; +1216E;CUNEIFORM SIGN KA TIMES IM;Lo;0;L;;;;;N;;;;; +1216F;CUNEIFORM SIGN KA TIMES KAK;Lo;0;L;;;;;N;;;;; +12170;CUNEIFORM SIGN KA TIMES KI;Lo;0;L;;;;;N;;;;; +12171;CUNEIFORM SIGN KA TIMES KID;Lo;0;L;;;;;N;;;;; +12172;CUNEIFORM SIGN KA TIMES LI;Lo;0;L;;;;;N;;;;; +12173;CUNEIFORM SIGN KA TIMES LU;Lo;0;L;;;;;N;;;;; +12174;CUNEIFORM SIGN KA TIMES ME;Lo;0;L;;;;;N;;;;; +12175;CUNEIFORM SIGN KA TIMES ME PLUS DU;Lo;0;L;;;;;N;;;;; +12176;CUNEIFORM SIGN KA TIMES ME PLUS GI;Lo;0;L;;;;;N;;;;; +12177;CUNEIFORM SIGN KA TIMES ME PLUS TE;Lo;0;L;;;;;N;;;;; +12178;CUNEIFORM SIGN KA TIMES MI;Lo;0;L;;;;;N;;;;; +12179;CUNEIFORM SIGN KA TIMES MI PLUS NUNUZ;Lo;0;L;;;;;N;;;;; +1217A;CUNEIFORM SIGN KA TIMES NE;Lo;0;L;;;;;N;;;;; +1217B;CUNEIFORM SIGN KA TIMES NUN;Lo;0;L;;;;;N;;;;; +1217C;CUNEIFORM SIGN KA TIMES PI;Lo;0;L;;;;;N;;;;; +1217D;CUNEIFORM SIGN KA TIMES RU;Lo;0;L;;;;;N;;;;; +1217E;CUNEIFORM SIGN KA TIMES SA;Lo;0;L;;;;;N;;;;; +1217F;CUNEIFORM SIGN KA TIMES SAR;Lo;0;L;;;;;N;;;;; +12180;CUNEIFORM SIGN KA TIMES SHA;Lo;0;L;;;;;N;;;;; +12181;CUNEIFORM SIGN KA TIMES SHE;Lo;0;L;;;;;N;;;;; +12182;CUNEIFORM SIGN KA TIMES SHID;Lo;0;L;;;;;N;;;;; +12183;CUNEIFORM SIGN KA TIMES SHU;Lo;0;L;;;;;N;;;;; +12184;CUNEIFORM SIGN KA TIMES SIG;Lo;0;L;;;;;N;;;;; +12185;CUNEIFORM SIGN KA TIMES SUHUR;Lo;0;L;;;;;N;;;;; +12186;CUNEIFORM SIGN KA TIMES TAR;Lo;0;L;;;;;N;;;;; +12187;CUNEIFORM SIGN KA TIMES U;Lo;0;L;;;;;N;;;;; +12188;CUNEIFORM SIGN KA TIMES U2;Lo;0;L;;;;;N;;;;; +12189;CUNEIFORM SIGN KA TIMES UD;Lo;0;L;;;;;N;;;;; +1218A;CUNEIFORM SIGN KA TIMES UMUM TIMES PA;Lo;0;L;;;;;N;;;;; +1218B;CUNEIFORM SIGN KA TIMES USH;Lo;0;L;;;;;N;;;;; +1218C;CUNEIFORM SIGN KA TIMES ZI;Lo;0;L;;;;;N;;;;; +1218D;CUNEIFORM SIGN KA2;Lo;0;L;;;;;N;;;;; +1218E;CUNEIFORM SIGN KA2 CROSSING KA2;Lo;0;L;;;;;N;;;;; +1218F;CUNEIFORM SIGN KAB;Lo;0;L;;;;;N;;;;; +12190;CUNEIFORM SIGN KAD2;Lo;0;L;;;;;N;;;;; +12191;CUNEIFORM SIGN KAD3;Lo;0;L;;;;;N;;;;; +12192;CUNEIFORM SIGN KAD4;Lo;0;L;;;;;N;;;;; +12193;CUNEIFORM SIGN KAD5;Lo;0;L;;;;;N;;;;; +12194;CUNEIFORM SIGN KAD5 OVER KAD5;Lo;0;L;;;;;N;;;;; +12195;CUNEIFORM SIGN KAK;Lo;0;L;;;;;N;;;;; +12196;CUNEIFORM SIGN KAK TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +12197;CUNEIFORM SIGN KAL;Lo;0;L;;;;;N;;;;; +12198;CUNEIFORM SIGN KAL TIMES BAD;Lo;0;L;;;;;N;;;;; +12199;CUNEIFORM SIGN KAL CROSSING KAL;Lo;0;L;;;;;N;;;;; +1219A;CUNEIFORM SIGN KAM2;Lo;0;L;;;;;N;;;;; +1219B;CUNEIFORM SIGN KAM4;Lo;0;L;;;;;N;;;;; +1219C;CUNEIFORM SIGN KASKAL;Lo;0;L;;;;;N;;;;; +1219D;CUNEIFORM SIGN KASKAL LAGAB TIMES U OVER LAGAB TIMES U;Lo;0;L;;;;;N;;;;; +1219E;CUNEIFORM SIGN KASKAL OVER KASKAL LAGAB TIMES U OVER LAGAB TIMES U;Lo;0;L;;;;;N;;;;; +1219F;CUNEIFORM SIGN KESH2;Lo;0;L;;;;;N;;;;; +121A0;CUNEIFORM SIGN KI;Lo;0;L;;;;;N;;;;; +121A1;CUNEIFORM SIGN KI TIMES BAD;Lo;0;L;;;;;N;;;;; +121A2;CUNEIFORM SIGN KI TIMES U;Lo;0;L;;;;;N;;;;; +121A3;CUNEIFORM SIGN KI TIMES UD;Lo;0;L;;;;;N;;;;; +121A4;CUNEIFORM SIGN KID;Lo;0;L;;;;;N;;;;; +121A5;CUNEIFORM SIGN KIN;Lo;0;L;;;;;N;;;;; +121A6;CUNEIFORM SIGN KISAL;Lo;0;L;;;;;N;;;;; +121A7;CUNEIFORM SIGN KISH;Lo;0;L;;;;;N;;;;; +121A8;CUNEIFORM SIGN KISIM5;Lo;0;L;;;;;N;;;;; +121A9;CUNEIFORM SIGN KISIM5 OVER KISIM5;Lo;0;L;;;;;N;;;;; +121AA;CUNEIFORM SIGN KU;Lo;0;L;;;;;N;;;;; +121AB;CUNEIFORM SIGN KU OVER HI TIMES ASH2 KU OVER HI TIMES ASH2;Lo;0;L;;;;;N;;;;; +121AC;CUNEIFORM SIGN KU3;Lo;0;L;;;;;N;;;;; +121AD;CUNEIFORM SIGN KU4;Lo;0;L;;;;;N;;;;; +121AE;CUNEIFORM SIGN KU4 VARIANT FORM;Lo;0;L;;;;;N;;;;; +121AF;CUNEIFORM SIGN KU7;Lo;0;L;;;;;N;;;;; +121B0;CUNEIFORM SIGN KUL;Lo;0;L;;;;;N;;;;; +121B1;CUNEIFORM SIGN KUL GUNU;Lo;0;L;;;;;N;;;;; +121B2;CUNEIFORM SIGN KUN;Lo;0;L;;;;;N;;;;; +121B3;CUNEIFORM SIGN KUR;Lo;0;L;;;;;N;;;;; +121B4;CUNEIFORM SIGN KUR OPPOSING KUR;Lo;0;L;;;;;N;;;;; +121B5;CUNEIFORM SIGN KUSHU2;Lo;0;L;;;;;N;;;;; +121B6;CUNEIFORM SIGN KWU318;Lo;0;L;;;;;N;;;;; +121B7;CUNEIFORM SIGN LA;Lo;0;L;;;;;N;;;;; +121B8;CUNEIFORM SIGN LAGAB;Lo;0;L;;;;;N;;;;; +121B9;CUNEIFORM SIGN LAGAB TIMES A;Lo;0;L;;;;;N;;;;; +121BA;CUNEIFORM SIGN LAGAB TIMES A PLUS DA PLUS HA;Lo;0;L;;;;;N;;;;; +121BB;CUNEIFORM SIGN LAGAB TIMES A PLUS GAR;Lo;0;L;;;;;N;;;;; +121BC;CUNEIFORM SIGN LAGAB TIMES A PLUS LAL;Lo;0;L;;;;;N;;;;; +121BD;CUNEIFORM SIGN LAGAB TIMES AL;Lo;0;L;;;;;N;;;;; +121BE;CUNEIFORM SIGN LAGAB TIMES AN;Lo;0;L;;;;;N;;;;; +121BF;CUNEIFORM SIGN LAGAB TIMES ASH ZIDA TENU;Lo;0;L;;;;;N;;;;; +121C0;CUNEIFORM SIGN LAGAB TIMES BAD;Lo;0;L;;;;;N;;;;; +121C1;CUNEIFORM SIGN LAGAB TIMES BI;Lo;0;L;;;;;N;;;;; +121C2;CUNEIFORM SIGN LAGAB TIMES DAR;Lo;0;L;;;;;N;;;;; +121C3;CUNEIFORM SIGN LAGAB TIMES EN;Lo;0;L;;;;;N;;;;; +121C4;CUNEIFORM SIGN LAGAB TIMES GA;Lo;0;L;;;;;N;;;;; +121C5;CUNEIFORM SIGN LAGAB TIMES GAR;Lo;0;L;;;;;N;;;;; +121C6;CUNEIFORM SIGN LAGAB TIMES GUD;Lo;0;L;;;;;N;;;;; +121C7;CUNEIFORM SIGN LAGAB TIMES GUD PLUS GUD;Lo;0;L;;;;;N;;;;; +121C8;CUNEIFORM SIGN LAGAB TIMES HA;Lo;0;L;;;;;N;;;;; +121C9;CUNEIFORM SIGN LAGAB TIMES HAL;Lo;0;L;;;;;N;;;;; +121CA;CUNEIFORM SIGN LAGAB TIMES HI TIMES NUN;Lo;0;L;;;;;N;;;;; +121CB;CUNEIFORM SIGN LAGAB TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +121CC;CUNEIFORM SIGN LAGAB TIMES IM;Lo;0;L;;;;;N;;;;; +121CD;CUNEIFORM SIGN LAGAB TIMES IM PLUS HA;Lo;0;L;;;;;N;;;;; +121CE;CUNEIFORM SIGN LAGAB TIMES IM PLUS LU;Lo;0;L;;;;;N;;;;; +121CF;CUNEIFORM SIGN LAGAB TIMES KI;Lo;0;L;;;;;N;;;;; +121D0;CUNEIFORM SIGN LAGAB TIMES KIN;Lo;0;L;;;;;N;;;;; +121D1;CUNEIFORM SIGN LAGAB TIMES KU3;Lo;0;L;;;;;N;;;;; +121D2;CUNEIFORM SIGN LAGAB TIMES KUL;Lo;0;L;;;;;N;;;;; +121D3;CUNEIFORM SIGN LAGAB TIMES KUL PLUS HI PLUS A;Lo;0;L;;;;;N;;;;; +121D4;CUNEIFORM SIGN LAGAB TIMES LAGAB;Lo;0;L;;;;;N;;;;; +121D5;CUNEIFORM SIGN LAGAB TIMES LISH;Lo;0;L;;;;;N;;;;; +121D6;CUNEIFORM SIGN LAGAB TIMES LU;Lo;0;L;;;;;N;;;;; +121D7;CUNEIFORM SIGN LAGAB TIMES LUL;Lo;0;L;;;;;N;;;;; +121D8;CUNEIFORM SIGN LAGAB TIMES ME;Lo;0;L;;;;;N;;;;; +121D9;CUNEIFORM SIGN LAGAB TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;; +121DA;CUNEIFORM SIGN LAGAB TIMES MUSH;Lo;0;L;;;;;N;;;;; +121DB;CUNEIFORM SIGN LAGAB TIMES NE;Lo;0;L;;;;;N;;;;; +121DC;CUNEIFORM SIGN LAGAB TIMES SHE PLUS SUM;Lo;0;L;;;;;N;;;;; +121DD;CUNEIFORM SIGN LAGAB TIMES SHITA PLUS GISH PLUS ERIN2;Lo;0;L;;;;;N;;;;; +121DE;CUNEIFORM SIGN LAGAB TIMES SHITA PLUS GISH TENU;Lo;0;L;;;;;N;;;;; +121DF;CUNEIFORM SIGN LAGAB TIMES SHU2;Lo;0;L;;;;;N;;;;; +121E0;CUNEIFORM SIGN LAGAB TIMES SHU2 PLUS SHU2;Lo;0;L;;;;;N;;;;; +121E1;CUNEIFORM SIGN LAGAB TIMES SUM;Lo;0;L;;;;;N;;;;; +121E2;CUNEIFORM SIGN LAGAB TIMES TAG;Lo;0;L;;;;;N;;;;; +121E3;CUNEIFORM SIGN LAGAB TIMES TAK4;Lo;0;L;;;;;N;;;;; +121E4;CUNEIFORM SIGN LAGAB TIMES TE PLUS A PLUS SU PLUS NA;Lo;0;L;;;;;N;;;;; +121E5;CUNEIFORM SIGN LAGAB TIMES U;Lo;0;L;;;;;N;;;;; +121E6;CUNEIFORM SIGN LAGAB TIMES U PLUS A;Lo;0;L;;;;;N;;;;; +121E7;CUNEIFORM SIGN LAGAB TIMES U PLUS U PLUS U;Lo;0;L;;;;;N;;;;; +121E8;CUNEIFORM SIGN LAGAB TIMES U2 PLUS ASH;Lo;0;L;;;;;N;;;;; +121E9;CUNEIFORM SIGN LAGAB TIMES UD;Lo;0;L;;;;;N;;;;; +121EA;CUNEIFORM SIGN LAGAB TIMES USH;Lo;0;L;;;;;N;;;;; +121EB;CUNEIFORM SIGN LAGAB SQUARED;Lo;0;L;;;;;N;;;;; +121EC;CUNEIFORM SIGN LAGAR;Lo;0;L;;;;;N;;;;; +121ED;CUNEIFORM SIGN LAGAR TIMES SHE;Lo;0;L;;;;;N;;;;; +121EE;CUNEIFORM SIGN LAGAR TIMES SHE PLUS SUM;Lo;0;L;;;;;N;;;;; +121EF;CUNEIFORM SIGN LAGAR GUNU;Lo;0;L;;;;;N;;;;; +121F0;CUNEIFORM SIGN LAGAR GUNU OVER LAGAR GUNU SHE;Lo;0;L;;;;;N;;;;; +121F1;CUNEIFORM SIGN LAHSHU;Lo;0;L;;;;;N;;;;; +121F2;CUNEIFORM SIGN LAL;Lo;0;L;;;;;N;;;;; +121F3;CUNEIFORM SIGN LAL TIMES LAL;Lo;0;L;;;;;N;;;;; +121F4;CUNEIFORM SIGN LAM;Lo;0;L;;;;;N;;;;; +121F5;CUNEIFORM SIGN LAM TIMES KUR;Lo;0;L;;;;;N;;;;; +121F6;CUNEIFORM SIGN LAM TIMES KUR PLUS RU;Lo;0;L;;;;;N;;;;; +121F7;CUNEIFORM SIGN LI;Lo;0;L;;;;;N;;;;; +121F8;CUNEIFORM SIGN LIL;Lo;0;L;;;;;N;;;;; +121F9;CUNEIFORM SIGN LIMMU2;Lo;0;L;;;;;N;;;;; +121FA;CUNEIFORM SIGN LISH;Lo;0;L;;;;;N;;;;; +121FB;CUNEIFORM SIGN LU;Lo;0;L;;;;;N;;;;; +121FC;CUNEIFORM SIGN LU TIMES BAD;Lo;0;L;;;;;N;;;;; +121FD;CUNEIFORM SIGN LU2;Lo;0;L;;;;;N;;;;; +121FE;CUNEIFORM SIGN LU2 TIMES AL;Lo;0;L;;;;;N;;;;; +121FF;CUNEIFORM SIGN LU2 TIMES BAD;Lo;0;L;;;;;N;;;;; +12200;CUNEIFORM SIGN LU2 TIMES ESH2;Lo;0;L;;;;;N;;;;; +12201;CUNEIFORM SIGN LU2 TIMES ESH2 TENU;Lo;0;L;;;;;N;;;;; +12202;CUNEIFORM SIGN LU2 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +12203;CUNEIFORM SIGN LU2 TIMES HI TIMES BAD;Lo;0;L;;;;;N;;;;; +12204;CUNEIFORM SIGN LU2 TIMES IM;Lo;0;L;;;;;N;;;;; +12205;CUNEIFORM SIGN LU2 TIMES KAD2;Lo;0;L;;;;;N;;;;; +12206;CUNEIFORM SIGN LU2 TIMES KAD3;Lo;0;L;;;;;N;;;;; +12207;CUNEIFORM SIGN LU2 TIMES KAD3 PLUS ASH;Lo;0;L;;;;;N;;;;; +12208;CUNEIFORM SIGN LU2 TIMES KI;Lo;0;L;;;;;N;;;;; +12209;CUNEIFORM SIGN LU2 TIMES LA PLUS ASH;Lo;0;L;;;;;N;;;;; +1220A;CUNEIFORM SIGN LU2 TIMES LAGAB;Lo;0;L;;;;;N;;;;; +1220B;CUNEIFORM SIGN LU2 TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;; +1220C;CUNEIFORM SIGN LU2 TIMES NE;Lo;0;L;;;;;N;;;;; +1220D;CUNEIFORM SIGN LU2 TIMES NU;Lo;0;L;;;;;N;;;;; +1220E;CUNEIFORM SIGN LU2 TIMES SI PLUS ASH;Lo;0;L;;;;;N;;;;; +1220F;CUNEIFORM SIGN LU2 TIMES SIK2 PLUS BU;Lo;0;L;;;;;N;;;;; +12210;CUNEIFORM SIGN LU2 TIMES TUG2;Lo;0;L;;;;;N;;;;; +12211;CUNEIFORM SIGN LU2 TENU;Lo;0;L;;;;;N;;;;; +12212;CUNEIFORM SIGN LU2 CROSSING LU2;Lo;0;L;;;;;N;;;;; +12213;CUNEIFORM SIGN LU2 OPPOSING LU2;Lo;0;L;;;;;N;;;;; +12214;CUNEIFORM SIGN LU2 SQUARED;Lo;0;L;;;;;N;;;;; +12215;CUNEIFORM SIGN LU2 SHESHIG;Lo;0;L;;;;;N;;;;; +12216;CUNEIFORM SIGN LU3;Lo;0;L;;;;;N;;;;; +12217;CUNEIFORM SIGN LUGAL;Lo;0;L;;;;;N;;;;; +12218;CUNEIFORM SIGN LUGAL OVER LUGAL;Lo;0;L;;;;;N;;;;; +12219;CUNEIFORM SIGN LUGAL OPPOSING LUGAL;Lo;0;L;;;;;N;;;;; +1221A;CUNEIFORM SIGN LUGAL SHESHIG;Lo;0;L;;;;;N;;;;; +1221B;CUNEIFORM SIGN LUH;Lo;0;L;;;;;N;;;;; +1221C;CUNEIFORM SIGN LUL;Lo;0;L;;;;;N;;;;; +1221D;CUNEIFORM SIGN LUM;Lo;0;L;;;;;N;;;;; +1221E;CUNEIFORM SIGN LUM OVER LUM;Lo;0;L;;;;;N;;;;; +1221F;CUNEIFORM SIGN LUM OVER LUM GAR OVER GAR;Lo;0;L;;;;;N;;;;; +12220;CUNEIFORM SIGN MA;Lo;0;L;;;;;N;;;;; +12221;CUNEIFORM SIGN MA TIMES TAK4;Lo;0;L;;;;;N;;;;; +12222;CUNEIFORM SIGN MA GUNU;Lo;0;L;;;;;N;;;;; +12223;CUNEIFORM SIGN MA2;Lo;0;L;;;;;N;;;;; +12224;CUNEIFORM SIGN MAH;Lo;0;L;;;;;N;;;;; +12225;CUNEIFORM SIGN MAR;Lo;0;L;;;;;N;;;;; +12226;CUNEIFORM SIGN MASH;Lo;0;L;;;;;N;;;;; +12227;CUNEIFORM SIGN MASH2;Lo;0;L;;;;;N;;;;; +12228;CUNEIFORM SIGN ME;Lo;0;L;;;;;N;;;;; +12229;CUNEIFORM SIGN MES;Lo;0;L;;;;;N;;;;; +1222A;CUNEIFORM SIGN MI;Lo;0;L;;;;;N;;;;; +1222B;CUNEIFORM SIGN MIN;Lo;0;L;;;;;N;;;;; +1222C;CUNEIFORM SIGN MU;Lo;0;L;;;;;N;;;;; +1222D;CUNEIFORM SIGN MU OVER MU;Lo;0;L;;;;;N;;;;; +1222E;CUNEIFORM SIGN MUG;Lo;0;L;;;;;N;;;;; +1222F;CUNEIFORM SIGN MUG GUNU;Lo;0;L;;;;;N;;;;; +12230;CUNEIFORM SIGN MUNSUB;Lo;0;L;;;;;N;;;;; +12231;CUNEIFORM SIGN MURGU2;Lo;0;L;;;;;N;;;;; +12232;CUNEIFORM SIGN MUSH;Lo;0;L;;;;;N;;;;; +12233;CUNEIFORM SIGN MUSH TIMES A;Lo;0;L;;;;;N;;;;; +12234;CUNEIFORM SIGN MUSH TIMES KUR;Lo;0;L;;;;;N;;;;; +12235;CUNEIFORM SIGN MUSH TIMES ZA;Lo;0;L;;;;;N;;;;; +12236;CUNEIFORM SIGN MUSH OVER MUSH;Lo;0;L;;;;;N;;;;; +12237;CUNEIFORM SIGN MUSH OVER MUSH TIMES A PLUS NA;Lo;0;L;;;;;N;;;;; +12238;CUNEIFORM SIGN MUSH CROSSING MUSH;Lo;0;L;;;;;N;;;;; +12239;CUNEIFORM SIGN MUSH3;Lo;0;L;;;;;N;;;;; +1223A;CUNEIFORM SIGN MUSH3 TIMES A;Lo;0;L;;;;;N;;;;; +1223B;CUNEIFORM SIGN MUSH3 TIMES A PLUS DI;Lo;0;L;;;;;N;;;;; +1223C;CUNEIFORM SIGN MUSH3 TIMES DI;Lo;0;L;;;;;N;;;;; +1223D;CUNEIFORM SIGN MUSH3 GUNU;Lo;0;L;;;;;N;;;;; +1223E;CUNEIFORM SIGN NA;Lo;0;L;;;;;N;;;;; +1223F;CUNEIFORM SIGN NA2;Lo;0;L;;;;;N;;;;; +12240;CUNEIFORM SIGN NAGA;Lo;0;L;;;;;N;;;;; +12241;CUNEIFORM SIGN NAGA INVERTED;Lo;0;L;;;;;N;;;;; +12242;CUNEIFORM SIGN NAGA TIMES SHU TENU;Lo;0;L;;;;;N;;;;; +12243;CUNEIFORM SIGN NAGA OPPOSING NAGA;Lo;0;L;;;;;N;;;;; +12244;CUNEIFORM SIGN NAGAR;Lo;0;L;;;;;N;;;;; +12245;CUNEIFORM SIGN NAM NUTILLU;Lo;0;L;;;;;N;;;;; +12246;CUNEIFORM SIGN NAM;Lo;0;L;;;;;N;;;;; +12247;CUNEIFORM SIGN NAM2;Lo;0;L;;;;;N;;;;; +12248;CUNEIFORM SIGN NE;Lo;0;L;;;;;N;;;;; +12249;CUNEIFORM SIGN NE TIMES A;Lo;0;L;;;;;N;;;;; +1224A;CUNEIFORM SIGN NE TIMES UD;Lo;0;L;;;;;N;;;;; +1224B;CUNEIFORM SIGN NE SHESHIG;Lo;0;L;;;;;N;;;;; +1224C;CUNEIFORM SIGN NI;Lo;0;L;;;;;N;;;;; +1224D;CUNEIFORM SIGN NI TIMES E;Lo;0;L;;;;;N;;;;; +1224E;CUNEIFORM SIGN NI2;Lo;0;L;;;;;N;;;;; +1224F;CUNEIFORM SIGN NIM;Lo;0;L;;;;;N;;;;; +12250;CUNEIFORM SIGN NIM TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +12251;CUNEIFORM SIGN NIM TIMES GAR PLUS GAN2 TENU;Lo;0;L;;;;;N;;;;; +12252;CUNEIFORM SIGN NINDA2;Lo;0;L;;;;;N;;;;; +12253;CUNEIFORM SIGN NINDA2 TIMES AN;Lo;0;L;;;;;N;;;;; +12254;CUNEIFORM SIGN NINDA2 TIMES ASH;Lo;0;L;;;;;N;;;;; +12255;CUNEIFORM SIGN NINDA2 TIMES ASH PLUS ASH;Lo;0;L;;;;;N;;;;; +12256;CUNEIFORM SIGN NINDA2 TIMES GUD;Lo;0;L;;;;;N;;;;; +12257;CUNEIFORM SIGN NINDA2 TIMES ME PLUS GAN2 TENU;Lo;0;L;;;;;N;;;;; +12258;CUNEIFORM SIGN NINDA2 TIMES NE;Lo;0;L;;;;;N;;;;; +12259;CUNEIFORM SIGN NINDA2 TIMES NUN;Lo;0;L;;;;;N;;;;; +1225A;CUNEIFORM SIGN NINDA2 TIMES SHE;Lo;0;L;;;;;N;;;;; +1225B;CUNEIFORM SIGN NINDA2 TIMES SHE PLUS A AN;Lo;0;L;;;;;N;;;;; +1225C;CUNEIFORM SIGN NINDA2 TIMES SHE PLUS ASH;Lo;0;L;;;;;N;;;;; +1225D;CUNEIFORM SIGN NINDA2 TIMES SHE PLUS ASH PLUS ASH;Lo;0;L;;;;;N;;;;; +1225E;CUNEIFORM SIGN NINDA2 TIMES U2 PLUS ASH;Lo;0;L;;;;;N;;;;; +1225F;CUNEIFORM SIGN NINDA2 TIMES USH;Lo;0;L;;;;;N;;;;; +12260;CUNEIFORM SIGN NISAG;Lo;0;L;;;;;N;;;;; +12261;CUNEIFORM SIGN NU;Lo;0;L;;;;;N;;;;; +12262;CUNEIFORM SIGN NU11;Lo;0;L;;;;;N;;;;; +12263;CUNEIFORM SIGN NUN;Lo;0;L;;;;;N;;;;; +12264;CUNEIFORM SIGN NUN LAGAR TIMES GAR;Lo;0;L;;;;;N;;;;; +12265;CUNEIFORM SIGN NUN LAGAR TIMES MASH;Lo;0;L;;;;;N;;;;; +12266;CUNEIFORM SIGN NUN LAGAR TIMES SAL;Lo;0;L;;;;;N;;;;; +12267;CUNEIFORM SIGN NUN LAGAR TIMES SAL OVER NUN LAGAR TIMES SAL;Lo;0;L;;;;;N;;;;; +12268;CUNEIFORM SIGN NUN LAGAR TIMES USH;Lo;0;L;;;;;N;;;;; +12269;CUNEIFORM SIGN NUN TENU;Lo;0;L;;;;;N;;;;; +1226A;CUNEIFORM SIGN NUN OVER NUN;Lo;0;L;;;;;N;;;;; +1226B;CUNEIFORM SIGN NUN CROSSING NUN;Lo;0;L;;;;;N;;;;; +1226C;CUNEIFORM SIGN NUN CROSSING NUN LAGAR OVER LAGAR;Lo;0;L;;;;;N;;;;; +1226D;CUNEIFORM SIGN NUNUZ;Lo;0;L;;;;;N;;;;; +1226E;CUNEIFORM SIGN NUNUZ AB2 TIMES ASHGAB;Lo;0;L;;;;;N;;;;; +1226F;CUNEIFORM SIGN NUNUZ AB2 TIMES BI;Lo;0;L;;;;;N;;;;; +12270;CUNEIFORM SIGN NUNUZ AB2 TIMES DUG;Lo;0;L;;;;;N;;;;; +12271;CUNEIFORM SIGN NUNUZ AB2 TIMES GUD;Lo;0;L;;;;;N;;;;; +12272;CUNEIFORM SIGN NUNUZ AB2 TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +12273;CUNEIFORM SIGN NUNUZ AB2 TIMES KAD3;Lo;0;L;;;;;N;;;;; +12274;CUNEIFORM SIGN NUNUZ AB2 TIMES LA;Lo;0;L;;;;;N;;;;; +12275;CUNEIFORM SIGN NUNUZ AB2 TIMES NE;Lo;0;L;;;;;N;;;;; +12276;CUNEIFORM SIGN NUNUZ AB2 TIMES SILA3;Lo;0;L;;;;;N;;;;; +12277;CUNEIFORM SIGN NUNUZ AB2 TIMES U2;Lo;0;L;;;;;N;;;;; +12278;CUNEIFORM SIGN NUNUZ KISIM5 TIMES BI;Lo;0;L;;;;;N;;;;; +12279;CUNEIFORM SIGN NUNUZ KISIM5 TIMES BI U;Lo;0;L;;;;;N;;;;; +1227A;CUNEIFORM SIGN PA;Lo;0;L;;;;;N;;;;; +1227B;CUNEIFORM SIGN PAD;Lo;0;L;;;;;N;;;;; +1227C;CUNEIFORM SIGN PAN;Lo;0;L;;;;;N;;;;; +1227D;CUNEIFORM SIGN PAP;Lo;0;L;;;;;N;;;;; +1227E;CUNEIFORM SIGN PESH2;Lo;0;L;;;;;N;;;;; +1227F;CUNEIFORM SIGN PI;Lo;0;L;;;;;N;;;;; +12280;CUNEIFORM SIGN PI TIMES A;Lo;0;L;;;;;N;;;;; +12281;CUNEIFORM SIGN PI TIMES AB;Lo;0;L;;;;;N;;;;; +12282;CUNEIFORM SIGN PI TIMES BI;Lo;0;L;;;;;N;;;;; +12283;CUNEIFORM SIGN PI TIMES BU;Lo;0;L;;;;;N;;;;; +12284;CUNEIFORM SIGN PI TIMES E;Lo;0;L;;;;;N;;;;; +12285;CUNEIFORM SIGN PI TIMES I;Lo;0;L;;;;;N;;;;; +12286;CUNEIFORM SIGN PI TIMES IB;Lo;0;L;;;;;N;;;;; +12287;CUNEIFORM SIGN PI TIMES U;Lo;0;L;;;;;N;;;;; +12288;CUNEIFORM SIGN PI TIMES U2;Lo;0;L;;;;;N;;;;; +12289;CUNEIFORM SIGN PI CROSSING PI;Lo;0;L;;;;;N;;;;; +1228A;CUNEIFORM SIGN PIRIG;Lo;0;L;;;;;N;;;;; +1228B;CUNEIFORM SIGN PIRIG TIMES KAL;Lo;0;L;;;;;N;;;;; +1228C;CUNEIFORM SIGN PIRIG TIMES UD;Lo;0;L;;;;;N;;;;; +1228D;CUNEIFORM SIGN PIRIG TIMES ZA;Lo;0;L;;;;;N;;;;; +1228E;CUNEIFORM SIGN PIRIG OPPOSING PIRIG;Lo;0;L;;;;;N;;;;; +1228F;CUNEIFORM SIGN RA;Lo;0;L;;;;;N;;;;; +12290;CUNEIFORM SIGN RAB;Lo;0;L;;;;;N;;;;; +12291;CUNEIFORM SIGN RI;Lo;0;L;;;;;N;;;;; +12292;CUNEIFORM SIGN RU;Lo;0;L;;;;;N;;;;; +12293;CUNEIFORM SIGN SA;Lo;0;L;;;;;N;;;;; +12294;CUNEIFORM SIGN SAG NUTILLU;Lo;0;L;;;;;N;;;;; +12295;CUNEIFORM SIGN SAG;Lo;0;L;;;;;N;;;;; +12296;CUNEIFORM SIGN SAG TIMES A;Lo;0;L;;;;;N;;;;; +12297;CUNEIFORM SIGN SAG TIMES DU;Lo;0;L;;;;;N;;;;; +12298;CUNEIFORM SIGN SAG TIMES DUB;Lo;0;L;;;;;N;;;;; +12299;CUNEIFORM SIGN SAG TIMES HA;Lo;0;L;;;;;N;;;;; +1229A;CUNEIFORM SIGN SAG TIMES KAK;Lo;0;L;;;;;N;;;;; +1229B;CUNEIFORM SIGN SAG TIMES KUR;Lo;0;L;;;;;N;;;;; +1229C;CUNEIFORM SIGN SAG TIMES LUM;Lo;0;L;;;;;N;;;;; +1229D;CUNEIFORM SIGN SAG TIMES MI;Lo;0;L;;;;;N;;;;; +1229E;CUNEIFORM SIGN SAG TIMES NUN;Lo;0;L;;;;;N;;;;; +1229F;CUNEIFORM SIGN SAG TIMES SAL;Lo;0;L;;;;;N;;;;; +122A0;CUNEIFORM SIGN SAG TIMES SHID;Lo;0;L;;;;;N;;;;; +122A1;CUNEIFORM SIGN SAG TIMES TAB;Lo;0;L;;;;;N;;;;; +122A2;CUNEIFORM SIGN SAG TIMES U2;Lo;0;L;;;;;N;;;;; +122A3;CUNEIFORM SIGN SAG TIMES UB;Lo;0;L;;;;;N;;;;; +122A4;CUNEIFORM SIGN SAG TIMES UM;Lo;0;L;;;;;N;;;;; +122A5;CUNEIFORM SIGN SAG TIMES UR;Lo;0;L;;;;;N;;;;; +122A6;CUNEIFORM SIGN SAG TIMES USH;Lo;0;L;;;;;N;;;;; +122A7;CUNEIFORM SIGN SAG OVER SAG;Lo;0;L;;;;;N;;;;; +122A8;CUNEIFORM SIGN SAG GUNU;Lo;0;L;;;;;N;;;;; +122A9;CUNEIFORM SIGN SAL;Lo;0;L;;;;;N;;;;; +122AA;CUNEIFORM SIGN SAL LAGAB TIMES ASH2;Lo;0;L;;;;;N;;;;; +122AB;CUNEIFORM SIGN SANGA2;Lo;0;L;;;;;N;;;;; +122AC;CUNEIFORM SIGN SAR;Lo;0;L;;;;;N;;;;; +122AD;CUNEIFORM SIGN SHA;Lo;0;L;;;;;N;;;;; +122AE;CUNEIFORM SIGN SHA3;Lo;0;L;;;;;N;;;;; +122AF;CUNEIFORM SIGN SHA3 TIMES A;Lo;0;L;;;;;N;;;;; +122B0;CUNEIFORM SIGN SHA3 TIMES BAD;Lo;0;L;;;;;N;;;;; +122B1;CUNEIFORM SIGN SHA3 TIMES GISH;Lo;0;L;;;;;N;;;;; +122B2;CUNEIFORM SIGN SHA3 TIMES NE;Lo;0;L;;;;;N;;;;; +122B3;CUNEIFORM SIGN SHA3 TIMES SHU2;Lo;0;L;;;;;N;;;;; +122B4;CUNEIFORM SIGN SHA3 TIMES TUR;Lo;0;L;;;;;N;;;;; +122B5;CUNEIFORM SIGN SHA3 TIMES U;Lo;0;L;;;;;N;;;;; +122B6;CUNEIFORM SIGN SHA3 TIMES U PLUS A;Lo;0;L;;;;;N;;;;; +122B7;CUNEIFORM SIGN SHA6;Lo;0;L;;;;;N;;;;; +122B8;CUNEIFORM SIGN SHAB6;Lo;0;L;;;;;N;;;;; +122B9;CUNEIFORM SIGN SHAR2;Lo;0;L;;;;;N;;;;; +122BA;CUNEIFORM SIGN SHE;Lo;0;L;;;;;N;;;;; +122BB;CUNEIFORM SIGN SHE HU;Lo;0;L;;;;;N;;;;; +122BC;CUNEIFORM SIGN SHE OVER SHE GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;; +122BD;CUNEIFORM SIGN SHE OVER SHE TAB OVER TAB GAR OVER GAR;Lo;0;L;;;;;N;;;;; +122BE;CUNEIFORM SIGN SHEG9;Lo;0;L;;;;;N;;;;; +122BF;CUNEIFORM SIGN SHEN;Lo;0;L;;;;;N;;;;; +122C0;CUNEIFORM SIGN SHESH;Lo;0;L;;;;;N;;;;; +122C1;CUNEIFORM SIGN SHESH2;Lo;0;L;;;;;N;;;;; +122C2;CUNEIFORM SIGN SHESHLAM;Lo;0;L;;;;;N;;;;; +122C3;CUNEIFORM SIGN SHID;Lo;0;L;;;;;N;;;;; +122C4;CUNEIFORM SIGN SHID TIMES A;Lo;0;L;;;;;N;;;;; +122C5;CUNEIFORM SIGN SHID TIMES IM;Lo;0;L;;;;;N;;;;; +122C6;CUNEIFORM SIGN SHIM;Lo;0;L;;;;;N;;;;; +122C7;CUNEIFORM SIGN SHIM TIMES A;Lo;0;L;;;;;N;;;;; +122C8;CUNEIFORM SIGN SHIM TIMES BAL;Lo;0;L;;;;;N;;;;; +122C9;CUNEIFORM SIGN SHIM TIMES BULUG;Lo;0;L;;;;;N;;;;; +122CA;CUNEIFORM SIGN SHIM TIMES DIN;Lo;0;L;;;;;N;;;;; +122CB;CUNEIFORM SIGN SHIM TIMES GAR;Lo;0;L;;;;;N;;;;; +122CC;CUNEIFORM SIGN SHIM TIMES IGI;Lo;0;L;;;;;N;;;;; +122CD;CUNEIFORM SIGN SHIM TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +122CE;CUNEIFORM SIGN SHIM TIMES KUSHU2;Lo;0;L;;;;;N;;;;; +122CF;CUNEIFORM SIGN SHIM TIMES LUL;Lo;0;L;;;;;N;;;;; +122D0;CUNEIFORM SIGN SHIM TIMES MUG;Lo;0;L;;;;;N;;;;; +122D1;CUNEIFORM SIGN SHIM TIMES SAL;Lo;0;L;;;;;N;;;;; +122D2;CUNEIFORM SIGN SHINIG;Lo;0;L;;;;;N;;;;; +122D3;CUNEIFORM SIGN SHIR;Lo;0;L;;;;;N;;;;; +122D4;CUNEIFORM SIGN SHIR TENU;Lo;0;L;;;;;N;;;;; +122D5;CUNEIFORM SIGN SHIR OVER SHIR BUR OVER BUR;Lo;0;L;;;;;N;;;;; +122D6;CUNEIFORM SIGN SHITA;Lo;0;L;;;;;N;;;;; +122D7;CUNEIFORM SIGN SHU;Lo;0;L;;;;;N;;;;; +122D8;CUNEIFORM SIGN SHU OVER INVERTED SHU;Lo;0;L;;;;;N;;;;; +122D9;CUNEIFORM SIGN SHU2;Lo;0;L;;;;;N;;;;; +122DA;CUNEIFORM SIGN SHUBUR;Lo;0;L;;;;;N;;;;; +122DB;CUNEIFORM SIGN SI;Lo;0;L;;;;;N;;;;; +122DC;CUNEIFORM SIGN SI GUNU;Lo;0;L;;;;;N;;;;; +122DD;CUNEIFORM SIGN SIG;Lo;0;L;;;;;N;;;;; +122DE;CUNEIFORM SIGN SIG4;Lo;0;L;;;;;N;;;;; +122DF;CUNEIFORM SIGN SIG4 OVER SIG4 SHU2;Lo;0;L;;;;;N;;;;; +122E0;CUNEIFORM SIGN SIK2;Lo;0;L;;;;;N;;;;; +122E1;CUNEIFORM SIGN SILA3;Lo;0;L;;;;;N;;;;; +122E2;CUNEIFORM SIGN SU;Lo;0;L;;;;;N;;;;; +122E3;CUNEIFORM SIGN SU OVER SU;Lo;0;L;;;;;N;;;;; +122E4;CUNEIFORM SIGN SUD;Lo;0;L;;;;;N;;;;; +122E5;CUNEIFORM SIGN SUD2;Lo;0;L;;;;;N;;;;; +122E6;CUNEIFORM SIGN SUHUR;Lo;0;L;;;;;N;;;;; +122E7;CUNEIFORM SIGN SUM;Lo;0;L;;;;;N;;;;; +122E8;CUNEIFORM SIGN SUMASH;Lo;0;L;;;;;N;;;;; +122E9;CUNEIFORM SIGN SUR;Lo;0;L;;;;;N;;;;; +122EA;CUNEIFORM SIGN SUR9;Lo;0;L;;;;;N;;;;; +122EB;CUNEIFORM SIGN TA;Lo;0;L;;;;;N;;;;; +122EC;CUNEIFORM SIGN TA ASTERISK;Lo;0;L;;;;;N;;;;; +122ED;CUNEIFORM SIGN TA TIMES HI;Lo;0;L;;;;;N;;;;; +122EE;CUNEIFORM SIGN TA TIMES MI;Lo;0;L;;;;;N;;;;; +122EF;CUNEIFORM SIGN TA GUNU;Lo;0;L;;;;;N;;;;; +122F0;CUNEIFORM SIGN TAB;Lo;0;L;;;;;N;;;;; +122F1;CUNEIFORM SIGN TAB OVER TAB NI OVER NI DISH OVER DISH;Lo;0;L;;;;;N;;;;; +122F2;CUNEIFORM SIGN TAB SQUARED;Lo;0;L;;;;;N;;;;; +122F3;CUNEIFORM SIGN TAG;Lo;0;L;;;;;N;;;;; +122F4;CUNEIFORM SIGN TAG TIMES BI;Lo;0;L;;;;;N;;;;; +122F5;CUNEIFORM SIGN TAG TIMES GUD;Lo;0;L;;;;;N;;;;; +122F6;CUNEIFORM SIGN TAG TIMES SHE;Lo;0;L;;;;;N;;;;; +122F7;CUNEIFORM SIGN TAG TIMES SHU;Lo;0;L;;;;;N;;;;; +122F8;CUNEIFORM SIGN TAG TIMES TUG2;Lo;0;L;;;;;N;;;;; +122F9;CUNEIFORM SIGN TAG TIMES UD;Lo;0;L;;;;;N;;;;; +122FA;CUNEIFORM SIGN TAK4;Lo;0;L;;;;;N;;;;; +122FB;CUNEIFORM SIGN TAR;Lo;0;L;;;;;N;;;;; +122FC;CUNEIFORM SIGN TE;Lo;0;L;;;;;N;;;;; +122FD;CUNEIFORM SIGN TE GUNU;Lo;0;L;;;;;N;;;;; +122FE;CUNEIFORM SIGN TI;Lo;0;L;;;;;N;;;;; +122FF;CUNEIFORM SIGN TI TENU;Lo;0;L;;;;;N;;;;; +12300;CUNEIFORM SIGN TIL;Lo;0;L;;;;;N;;;;; +12301;CUNEIFORM SIGN TIR;Lo;0;L;;;;;N;;;;; +12302;CUNEIFORM SIGN TIR TIMES TAK4;Lo;0;L;;;;;N;;;;; +12303;CUNEIFORM SIGN TIR OVER TIR;Lo;0;L;;;;;N;;;;; +12304;CUNEIFORM SIGN TIR OVER TIR GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;; +12305;CUNEIFORM SIGN TU;Lo;0;L;;;;;N;;;;; +12306;CUNEIFORM SIGN TUG2;Lo;0;L;;;;;N;;;;; +12307;CUNEIFORM SIGN TUK;Lo;0;L;;;;;N;;;;; +12308;CUNEIFORM SIGN TUM;Lo;0;L;;;;;N;;;;; +12309;CUNEIFORM SIGN TUR;Lo;0;L;;;;;N;;;;; +1230A;CUNEIFORM SIGN TUR OVER TUR ZA OVER ZA;Lo;0;L;;;;;N;;;;; +1230B;CUNEIFORM SIGN U;Lo;0;L;;;;;N;;;;; +1230C;CUNEIFORM SIGN U GUD;Lo;0;L;;;;;N;;;;; +1230D;CUNEIFORM SIGN U U U;Lo;0;L;;;;;N;;;;; +1230E;CUNEIFORM SIGN U OVER U PA OVER PA GAR OVER GAR;Lo;0;L;;;;;N;;;;; +1230F;CUNEIFORM SIGN U OVER U SUR OVER SUR;Lo;0;L;;;;;N;;;;; +12310;CUNEIFORM SIGN U OVER U U REVERSED OVER U REVERSED;Lo;0;L;;;;;N;;;;; +12311;CUNEIFORM SIGN U2;Lo;0;L;;;;;N;;;;; +12312;CUNEIFORM SIGN UB;Lo;0;L;;;;;N;;;;; +12313;CUNEIFORM SIGN UD;Lo;0;L;;;;;N;;;;; +12314;CUNEIFORM SIGN UD KUSHU2;Lo;0;L;;;;;N;;;;; +12315;CUNEIFORM SIGN UD TIMES BAD;Lo;0;L;;;;;N;;;;; +12316;CUNEIFORM SIGN UD TIMES MI;Lo;0;L;;;;;N;;;;; +12317;CUNEIFORM SIGN UD TIMES U PLUS U PLUS U;Lo;0;L;;;;;N;;;;; +12318;CUNEIFORM SIGN UD TIMES U PLUS U PLUS U GUNU;Lo;0;L;;;;;N;;;;; +12319;CUNEIFORM SIGN UD GUNU;Lo;0;L;;;;;N;;;;; +1231A;CUNEIFORM SIGN UD SHESHIG;Lo;0;L;;;;;N;;;;; +1231B;CUNEIFORM SIGN UD SHESHIG TIMES BAD;Lo;0;L;;;;;N;;;;; +1231C;CUNEIFORM SIGN UDUG;Lo;0;L;;;;;N;;;;; +1231D;CUNEIFORM SIGN UM;Lo;0;L;;;;;N;;;;; +1231E;CUNEIFORM SIGN UM TIMES LAGAB;Lo;0;L;;;;;N;;;;; +1231F;CUNEIFORM SIGN UM TIMES ME PLUS DA;Lo;0;L;;;;;N;;;;; +12320;CUNEIFORM SIGN UM TIMES SHA3;Lo;0;L;;;;;N;;;;; +12321;CUNEIFORM SIGN UM TIMES U;Lo;0;L;;;;;N;;;;; +12322;CUNEIFORM SIGN UMBIN;Lo;0;L;;;;;N;;;;; +12323;CUNEIFORM SIGN UMUM;Lo;0;L;;;;;N;;;;; +12324;CUNEIFORM SIGN UMUM TIMES KASKAL;Lo;0;L;;;;;N;;;;; +12325;CUNEIFORM SIGN UMUM TIMES PA;Lo;0;L;;;;;N;;;;; +12326;CUNEIFORM SIGN UN;Lo;0;L;;;;;N;;;;; +12327;CUNEIFORM SIGN UN GUNU;Lo;0;L;;;;;N;;;;; +12328;CUNEIFORM SIGN UR;Lo;0;L;;;;;N;;;;; +12329;CUNEIFORM SIGN UR CROSSING UR;Lo;0;L;;;;;N;;;;; +1232A;CUNEIFORM SIGN UR SHESHIG;Lo;0;L;;;;;N;;;;; +1232B;CUNEIFORM SIGN UR2;Lo;0;L;;;;;N;;;;; +1232C;CUNEIFORM SIGN UR2 TIMES A PLUS HA;Lo;0;L;;;;;N;;;;; +1232D;CUNEIFORM SIGN UR2 TIMES A PLUS NA;Lo;0;L;;;;;N;;;;; +1232E;CUNEIFORM SIGN UR2 TIMES AL;Lo;0;L;;;;;N;;;;; +1232F;CUNEIFORM SIGN UR2 TIMES HA;Lo;0;L;;;;;N;;;;; +12330;CUNEIFORM SIGN UR2 TIMES NUN;Lo;0;L;;;;;N;;;;; +12331;CUNEIFORM SIGN UR2 TIMES U2;Lo;0;L;;;;;N;;;;; +12332;CUNEIFORM SIGN UR2 TIMES U2 PLUS ASH;Lo;0;L;;;;;N;;;;; +12333;CUNEIFORM SIGN UR2 TIMES U2 PLUS BI;Lo;0;L;;;;;N;;;;; +12334;CUNEIFORM SIGN UR4;Lo;0;L;;;;;N;;;;; +12335;CUNEIFORM SIGN URI;Lo;0;L;;;;;N;;;;; +12336;CUNEIFORM SIGN URI3;Lo;0;L;;;;;N;;;;; +12337;CUNEIFORM SIGN URU;Lo;0;L;;;;;N;;;;; +12338;CUNEIFORM SIGN URU TIMES A;Lo;0;L;;;;;N;;;;; +12339;CUNEIFORM SIGN URU TIMES ASHGAB;Lo;0;L;;;;;N;;;;; +1233A;CUNEIFORM SIGN URU TIMES BAR;Lo;0;L;;;;;N;;;;; +1233B;CUNEIFORM SIGN URU TIMES DUN;Lo;0;L;;;;;N;;;;; +1233C;CUNEIFORM SIGN URU TIMES GA;Lo;0;L;;;;;N;;;;; +1233D;CUNEIFORM SIGN URU TIMES GAL;Lo;0;L;;;;;N;;;;; +1233E;CUNEIFORM SIGN URU TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +1233F;CUNEIFORM SIGN URU TIMES GAR;Lo;0;L;;;;;N;;;;; +12340;CUNEIFORM SIGN URU TIMES GU;Lo;0;L;;;;;N;;;;; +12341;CUNEIFORM SIGN URU TIMES HA;Lo;0;L;;;;;N;;;;; +12342;CUNEIFORM SIGN URU TIMES IGI;Lo;0;L;;;;;N;;;;; +12343;CUNEIFORM SIGN URU TIMES IM;Lo;0;L;;;;;N;;;;; +12344;CUNEIFORM SIGN URU TIMES ISH;Lo;0;L;;;;;N;;;;; +12345;CUNEIFORM SIGN URU TIMES KI;Lo;0;L;;;;;N;;;;; +12346;CUNEIFORM SIGN URU TIMES LUM;Lo;0;L;;;;;N;;;;; +12347;CUNEIFORM SIGN URU TIMES MIN;Lo;0;L;;;;;N;;;;; +12348;CUNEIFORM SIGN URU TIMES PA;Lo;0;L;;;;;N;;;;; +12349;CUNEIFORM SIGN URU TIMES SHE;Lo;0;L;;;;;N;;;;; +1234A;CUNEIFORM SIGN URU TIMES SIG4;Lo;0;L;;;;;N;;;;; +1234B;CUNEIFORM SIGN URU TIMES TU;Lo;0;L;;;;;N;;;;; +1234C;CUNEIFORM SIGN URU TIMES U PLUS GUD;Lo;0;L;;;;;N;;;;; +1234D;CUNEIFORM SIGN URU TIMES UD;Lo;0;L;;;;;N;;;;; +1234E;CUNEIFORM SIGN URU TIMES URUDA;Lo;0;L;;;;;N;;;;; +1234F;CUNEIFORM SIGN URUDA;Lo;0;L;;;;;N;;;;; +12350;CUNEIFORM SIGN URUDA TIMES U;Lo;0;L;;;;;N;;;;; +12351;CUNEIFORM SIGN USH;Lo;0;L;;;;;N;;;;; +12352;CUNEIFORM SIGN USH TIMES A;Lo;0;L;;;;;N;;;;; +12353;CUNEIFORM SIGN USH TIMES KU;Lo;0;L;;;;;N;;;;; +12354;CUNEIFORM SIGN USH TIMES KUR;Lo;0;L;;;;;N;;;;; +12355;CUNEIFORM SIGN USH TIMES TAK4;Lo;0;L;;;;;N;;;;; +12356;CUNEIFORM SIGN USHX;Lo;0;L;;;;;N;;;;; +12357;CUNEIFORM SIGN USH2;Lo;0;L;;;;;N;;;;; +12358;CUNEIFORM SIGN USHUMX;Lo;0;L;;;;;N;;;;; +12359;CUNEIFORM SIGN UTUKI;Lo;0;L;;;;;N;;;;; +1235A;CUNEIFORM SIGN UZ3;Lo;0;L;;;;;N;;;;; +1235B;CUNEIFORM SIGN UZ3 TIMES KASKAL;Lo;0;L;;;;;N;;;;; +1235C;CUNEIFORM SIGN UZU;Lo;0;L;;;;;N;;;;; +1235D;CUNEIFORM SIGN ZA;Lo;0;L;;;;;N;;;;; +1235E;CUNEIFORM SIGN ZA TENU;Lo;0;L;;;;;N;;;;; +1235F;CUNEIFORM SIGN ZA SQUARED TIMES KUR;Lo;0;L;;;;;N;;;;; +12360;CUNEIFORM SIGN ZAG;Lo;0;L;;;;;N;;;;; +12361;CUNEIFORM SIGN ZAMX;Lo;0;L;;;;;N;;;;; +12362;CUNEIFORM SIGN ZE2;Lo;0;L;;;;;N;;;;; +12363;CUNEIFORM SIGN ZI;Lo;0;L;;;;;N;;;;; +12364;CUNEIFORM SIGN ZI OVER ZI;Lo;0;L;;;;;N;;;;; +12365;CUNEIFORM SIGN ZI3;Lo;0;L;;;;;N;;;;; +12366;CUNEIFORM SIGN ZIB;Lo;0;L;;;;;N;;;;; +12367;CUNEIFORM SIGN ZIB KABA TENU;Lo;0;L;;;;;N;;;;; +12368;CUNEIFORM SIGN ZIG;Lo;0;L;;;;;N;;;;; +12369;CUNEIFORM SIGN ZIZ2;Lo;0;L;;;;;N;;;;; +1236A;CUNEIFORM SIGN ZU;Lo;0;L;;;;;N;;;;; +1236B;CUNEIFORM SIGN ZU5;Lo;0;L;;;;;N;;;;; +1236C;CUNEIFORM SIGN ZU5 TIMES A;Lo;0;L;;;;;N;;;;; +1236D;CUNEIFORM SIGN ZUBUR;Lo;0;L;;;;;N;;;;; +1236E;CUNEIFORM SIGN ZUM;Lo;0;L;;;;;N;;;;; +1236F;CUNEIFORM SIGN KAP ELAMITE;Lo;0;L;;;;;N;;;;; +12370;CUNEIFORM SIGN AB TIMES NUN;Lo;0;L;;;;;N;;;;; +12371;CUNEIFORM SIGN AB2 TIMES A;Lo;0;L;;;;;N;;;;; +12372;CUNEIFORM SIGN AMAR TIMES KUG;Lo;0;L;;;;;N;;;;; +12373;CUNEIFORM SIGN DAG KISIM5 TIMES U2 PLUS MASH;Lo;0;L;;;;;N;;;;; +12374;CUNEIFORM SIGN DAG3;Lo;0;L;;;;;N;;;;; +12375;CUNEIFORM SIGN DISH PLUS SHU;Lo;0;L;;;;;N;;;;; +12376;CUNEIFORM SIGN DUB TIMES SHE;Lo;0;L;;;;;N;;;;; +12377;CUNEIFORM SIGN EZEN TIMES GUD;Lo;0;L;;;;;N;;;;; +12378;CUNEIFORM SIGN EZEN TIMES SHE;Lo;0;L;;;;;N;;;;; +12379;CUNEIFORM SIGN GA2 TIMES AN PLUS KAK PLUS A;Lo;0;L;;;;;N;;;;; +1237A;CUNEIFORM SIGN GA2 TIMES ASH2;Lo;0;L;;;;;N;;;;; +1237B;CUNEIFORM SIGN GE22;Lo;0;L;;;;;N;;;;; +1237C;CUNEIFORM SIGN GIG;Lo;0;L;;;;;N;;;;; +1237D;CUNEIFORM SIGN HUSH;Lo;0;L;;;;;N;;;;; +1237E;CUNEIFORM SIGN KA TIMES ANSHE;Lo;0;L;;;;;N;;;;; +1237F;CUNEIFORM SIGN KA TIMES ASH3;Lo;0;L;;;;;N;;;;; +12380;CUNEIFORM SIGN KA TIMES GISH;Lo;0;L;;;;;N;;;;; +12381;CUNEIFORM SIGN KA TIMES GUD;Lo;0;L;;;;;N;;;;; +12382;CUNEIFORM SIGN KA TIMES HI TIMES ASH2;Lo;0;L;;;;;N;;;;; +12383;CUNEIFORM SIGN KA TIMES LUM;Lo;0;L;;;;;N;;;;; +12384;CUNEIFORM SIGN KA TIMES PA;Lo;0;L;;;;;N;;;;; +12385;CUNEIFORM SIGN KA TIMES SHUL;Lo;0;L;;;;;N;;;;; +12386;CUNEIFORM SIGN KA TIMES TU;Lo;0;L;;;;;N;;;;; +12387;CUNEIFORM SIGN KA TIMES UR2;Lo;0;L;;;;;N;;;;; +12388;CUNEIFORM SIGN LAGAB TIMES GI;Lo;0;L;;;;;N;;;;; +12389;CUNEIFORM SIGN LU2 SHESHIG TIMES BAD;Lo;0;L;;;;;N;;;;; +1238A;CUNEIFORM SIGN LU2 TIMES ESH2 PLUS LAL;Lo;0;L;;;;;N;;;;; +1238B;CUNEIFORM SIGN LU2 TIMES SHU;Lo;0;L;;;;;N;;;;; +1238C;CUNEIFORM SIGN MESH;Lo;0;L;;;;;N;;;;; +1238D;CUNEIFORM SIGN MUSH3 TIMES ZA;Lo;0;L;;;;;N;;;;; +1238E;CUNEIFORM SIGN NA4;Lo;0;L;;;;;N;;;;; +1238F;CUNEIFORM SIGN NIN;Lo;0;L;;;;;N;;;;; +12390;CUNEIFORM SIGN NIN9;Lo;0;L;;;;;N;;;;; +12391;CUNEIFORM SIGN NINDA2 TIMES BAL;Lo;0;L;;;;;N;;;;; +12392;CUNEIFORM SIGN NINDA2 TIMES GI;Lo;0;L;;;;;N;;;;; +12393;CUNEIFORM SIGN NU11 ROTATED NINETY DEGREES;Lo;0;L;;;;;N;;;;; +12394;CUNEIFORM SIGN PESH2 ASTERISK;Lo;0;L;;;;;N;;;;; +12395;CUNEIFORM SIGN PIR2;Lo;0;L;;;;;N;;;;; +12396;CUNEIFORM SIGN SAG TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +12397;CUNEIFORM SIGN TI2;Lo;0;L;;;;;N;;;;; +12398;CUNEIFORM SIGN UM TIMES ME;Lo;0;L;;;;;N;;;;; +12399;CUNEIFORM SIGN U U;Lo;0;L;;;;;N;;;;; +12400;CUNEIFORM NUMERIC SIGN TWO ASH;Nl;0;L;;;;2;N;;;;; +12401;CUNEIFORM NUMERIC SIGN THREE ASH;Nl;0;L;;;;3;N;;;;; +12402;CUNEIFORM NUMERIC SIGN FOUR ASH;Nl;0;L;;;;4;N;;;;; +12403;CUNEIFORM NUMERIC SIGN FIVE ASH;Nl;0;L;;;;5;N;;;;; +12404;CUNEIFORM NUMERIC SIGN SIX ASH;Nl;0;L;;;;6;N;;;;; +12405;CUNEIFORM NUMERIC SIGN SEVEN ASH;Nl;0;L;;;;7;N;;;;; +12406;CUNEIFORM NUMERIC SIGN EIGHT ASH;Nl;0;L;;;;8;N;;;;; +12407;CUNEIFORM NUMERIC SIGN NINE ASH;Nl;0;L;;;;9;N;;;;; +12408;CUNEIFORM NUMERIC SIGN THREE DISH;Nl;0;L;;;;3;N;;;;; +12409;CUNEIFORM NUMERIC SIGN FOUR DISH;Nl;0;L;;;;4;N;;;;; +1240A;CUNEIFORM NUMERIC SIGN FIVE DISH;Nl;0;L;;;;5;N;;;;; +1240B;CUNEIFORM NUMERIC SIGN SIX DISH;Nl;0;L;;;;6;N;;;;; +1240C;CUNEIFORM NUMERIC SIGN SEVEN DISH;Nl;0;L;;;;7;N;;;;; +1240D;CUNEIFORM NUMERIC SIGN EIGHT DISH;Nl;0;L;;;;8;N;;;;; +1240E;CUNEIFORM NUMERIC SIGN NINE DISH;Nl;0;L;;;;9;N;;;;; +1240F;CUNEIFORM NUMERIC SIGN FOUR U;Nl;0;L;;;;4;N;;;;; +12410;CUNEIFORM NUMERIC SIGN FIVE U;Nl;0;L;;;;5;N;;;;; +12411;CUNEIFORM NUMERIC SIGN SIX U;Nl;0;L;;;;6;N;;;;; +12412;CUNEIFORM NUMERIC SIGN SEVEN U;Nl;0;L;;;;7;N;;;;; +12413;CUNEIFORM NUMERIC SIGN EIGHT U;Nl;0;L;;;;8;N;;;;; +12414;CUNEIFORM NUMERIC SIGN NINE U;Nl;0;L;;;;9;N;;;;; +12415;CUNEIFORM NUMERIC SIGN ONE GESH2;Nl;0;L;;;;1;N;;;;; +12416;CUNEIFORM NUMERIC SIGN TWO GESH2;Nl;0;L;;;;2;N;;;;; +12417;CUNEIFORM NUMERIC SIGN THREE GESH2;Nl;0;L;;;;3;N;;;;; +12418;CUNEIFORM NUMERIC SIGN FOUR GESH2;Nl;0;L;;;;4;N;;;;; +12419;CUNEIFORM NUMERIC SIGN FIVE GESH2;Nl;0;L;;;;5;N;;;;; +1241A;CUNEIFORM NUMERIC SIGN SIX GESH2;Nl;0;L;;;;6;N;;;;; +1241B;CUNEIFORM NUMERIC SIGN SEVEN GESH2;Nl;0;L;;;;7;N;;;;; +1241C;CUNEIFORM NUMERIC SIGN EIGHT GESH2;Nl;0;L;;;;8;N;;;;; +1241D;CUNEIFORM NUMERIC SIGN NINE GESH2;Nl;0;L;;;;9;N;;;;; +1241E;CUNEIFORM NUMERIC SIGN ONE GESHU;Nl;0;L;;;;1;N;;;;; +1241F;CUNEIFORM NUMERIC SIGN TWO GESHU;Nl;0;L;;;;2;N;;;;; +12420;CUNEIFORM NUMERIC SIGN THREE GESHU;Nl;0;L;;;;3;N;;;;; +12421;CUNEIFORM NUMERIC SIGN FOUR GESHU;Nl;0;L;;;;4;N;;;;; +12422;CUNEIFORM NUMERIC SIGN FIVE GESHU;Nl;0;L;;;;5;N;;;;; +12423;CUNEIFORM NUMERIC SIGN TWO SHAR2;Nl;0;L;;;;2;N;;;;; +12424;CUNEIFORM NUMERIC SIGN THREE SHAR2;Nl;0;L;;;;3;N;;;;; +12425;CUNEIFORM NUMERIC SIGN THREE SHAR2 VARIANT FORM;Nl;0;L;;;;3;N;;;;; +12426;CUNEIFORM NUMERIC SIGN FOUR SHAR2;Nl;0;L;;;;4;N;;;;; +12427;CUNEIFORM NUMERIC SIGN FIVE SHAR2;Nl;0;L;;;;5;N;;;;; +12428;CUNEIFORM NUMERIC SIGN SIX SHAR2;Nl;0;L;;;;6;N;;;;; +12429;CUNEIFORM NUMERIC SIGN SEVEN SHAR2;Nl;0;L;;;;7;N;;;;; +1242A;CUNEIFORM NUMERIC SIGN EIGHT SHAR2;Nl;0;L;;;;8;N;;;;; +1242B;CUNEIFORM NUMERIC SIGN NINE SHAR2;Nl;0;L;;;;9;N;;;;; +1242C;CUNEIFORM NUMERIC SIGN ONE SHARU;Nl;0;L;;;;1;N;;;;; +1242D;CUNEIFORM NUMERIC SIGN TWO SHARU;Nl;0;L;;;;2;N;;;;; +1242E;CUNEIFORM NUMERIC SIGN THREE SHARU;Nl;0;L;;;;3;N;;;;; +1242F;CUNEIFORM NUMERIC SIGN THREE SHARU VARIANT FORM;Nl;0;L;;;;3;N;;;;; +12430;CUNEIFORM NUMERIC SIGN FOUR SHARU;Nl;0;L;;;;4;N;;;;; +12431;CUNEIFORM NUMERIC SIGN FIVE SHARU;Nl;0;L;;;;5;N;;;;; +12432;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS DISH;Nl;0;L;;;;216000;N;;;;; +12433;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS MIN;Nl;0;L;;;;432000;N;;;;; +12434;CUNEIFORM NUMERIC SIGN ONE BURU;Nl;0;L;;;;1;N;;;;; +12435;CUNEIFORM NUMERIC SIGN TWO BURU;Nl;0;L;;;;2;N;;;;; +12436;CUNEIFORM NUMERIC SIGN THREE BURU;Nl;0;L;;;;3;N;;;;; +12437;CUNEIFORM NUMERIC SIGN THREE BURU VARIANT FORM;Nl;0;L;;;;3;N;;;;; +12438;CUNEIFORM NUMERIC SIGN FOUR BURU;Nl;0;L;;;;4;N;;;;; +12439;CUNEIFORM NUMERIC SIGN FIVE BURU;Nl;0;L;;;;5;N;;;;; +1243A;CUNEIFORM NUMERIC SIGN THREE VARIANT FORM ESH16;Nl;0;L;;;;3;N;;;;; +1243B;CUNEIFORM NUMERIC SIGN THREE VARIANT FORM ESH21;Nl;0;L;;;;3;N;;;;; +1243C;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU;Nl;0;L;;;;4;N;;;;; +1243D;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU4;Nl;0;L;;;;4;N;;;;; +1243E;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU A;Nl;0;L;;;;4;N;;;;; +1243F;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU B;Nl;0;L;;;;4;N;;;;; +12440;CUNEIFORM NUMERIC SIGN SIX VARIANT FORM ASH9;Nl;0;L;;;;6;N;;;;; +12441;CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN3;Nl;0;L;;;;7;N;;;;; +12442;CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN A;Nl;0;L;;;;7;N;;;;; +12443;CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN B;Nl;0;L;;;;7;N;;;;; +12444;CUNEIFORM NUMERIC SIGN EIGHT VARIANT FORM USSU;Nl;0;L;;;;8;N;;;;; +12445;CUNEIFORM NUMERIC SIGN EIGHT VARIANT FORM USSU3;Nl;0;L;;;;8;N;;;;; +12446;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU;Nl;0;L;;;;9;N;;;;; +12447;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU3;Nl;0;L;;;;9;N;;;;; +12448;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU4;Nl;0;L;;;;9;N;;;;; +12449;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU A;Nl;0;L;;;;9;N;;;;; +1244A;CUNEIFORM NUMERIC SIGN TWO ASH TENU;Nl;0;L;;;;2;N;;;;; +1244B;CUNEIFORM NUMERIC SIGN THREE ASH TENU;Nl;0;L;;;;3;N;;;;; +1244C;CUNEIFORM NUMERIC SIGN FOUR ASH TENU;Nl;0;L;;;;4;N;;;;; +1244D;CUNEIFORM NUMERIC SIGN FIVE ASH TENU;Nl;0;L;;;;5;N;;;;; +1244E;CUNEIFORM NUMERIC SIGN SIX ASH TENU;Nl;0;L;;;;6;N;;;;; +1244F;CUNEIFORM NUMERIC SIGN ONE BAN2;Nl;0;L;;;;1;N;;;;; +12450;CUNEIFORM NUMERIC SIGN TWO BAN2;Nl;0;L;;;;2;N;;;;; +12451;CUNEIFORM NUMERIC SIGN THREE BAN2;Nl;0;L;;;;3;N;;;;; +12452;CUNEIFORM NUMERIC SIGN FOUR BAN2;Nl;0;L;;;;4;N;;;;; +12453;CUNEIFORM NUMERIC SIGN FOUR BAN2 VARIANT FORM;Nl;0;L;;;;4;N;;;;; +12454;CUNEIFORM NUMERIC SIGN FIVE BAN2;Nl;0;L;;;;5;N;;;;; +12455;CUNEIFORM NUMERIC SIGN FIVE BAN2 VARIANT FORM;Nl;0;L;;;;5;N;;;;; +12456;CUNEIFORM NUMERIC SIGN NIGIDAMIN;Nl;0;L;;;;2;N;;;;; +12457;CUNEIFORM NUMERIC SIGN NIGIDAESH;Nl;0;L;;;;3;N;;;;; +12458;CUNEIFORM NUMERIC SIGN ONE ESHE3;Nl;0;L;;;;1;N;;;;; +12459;CUNEIFORM NUMERIC SIGN TWO ESHE3;Nl;0;L;;;;2;N;;;;; +1245A;CUNEIFORM NUMERIC SIGN ONE THIRD DISH;Nl;0;L;;;;1/3;N;;;;; +1245B;CUNEIFORM NUMERIC SIGN TWO THIRDS DISH;Nl;0;L;;;;2/3;N;;;;; +1245C;CUNEIFORM NUMERIC SIGN FIVE SIXTHS DISH;Nl;0;L;;;;5/6;N;;;;; +1245D;CUNEIFORM NUMERIC SIGN ONE THIRD VARIANT FORM A;Nl;0;L;;;;1/3;N;;;;; +1245E;CUNEIFORM NUMERIC SIGN TWO THIRDS VARIANT FORM A;Nl;0;L;;;;2/3;N;;;;; +1245F;CUNEIFORM NUMERIC SIGN ONE EIGHTH ASH;Nl;0;L;;;;1/8;N;;;;; +12460;CUNEIFORM NUMERIC SIGN ONE QUARTER ASH;Nl;0;L;;;;1/4;N;;;;; +12461;CUNEIFORM NUMERIC SIGN OLD ASSYRIAN ONE SIXTH;Nl;0;L;;;;1/6;N;;;;; +12462;CUNEIFORM NUMERIC SIGN OLD ASSYRIAN ONE QUARTER;Nl;0;L;;;;1/4;N;;;;; +12463;CUNEIFORM NUMERIC SIGN ONE QUARTER GUR;Nl;0;L;;;;1/4;N;;;;; +12464;CUNEIFORM NUMERIC SIGN ONE HALF GUR;Nl;0;L;;;;1/2;N;;;;; +12465;CUNEIFORM NUMERIC SIGN ELAMITE ONE THIRD;Nl;0;L;;;;1/3;N;;;;; +12466;CUNEIFORM NUMERIC SIGN ELAMITE TWO THIRDS;Nl;0;L;;;;2/3;N;;;;; +12467;CUNEIFORM NUMERIC SIGN ELAMITE FORTY;Nl;0;L;;;;40;N;;;;; +12468;CUNEIFORM NUMERIC SIGN ELAMITE FIFTY;Nl;0;L;;;;50;N;;;;; +12469;CUNEIFORM NUMERIC SIGN FOUR U VARIANT FORM;Nl;0;L;;;;4;N;;;;; +1246A;CUNEIFORM NUMERIC SIGN FIVE U VARIANT FORM;Nl;0;L;;;;5;N;;;;; +1246B;CUNEIFORM NUMERIC SIGN SIX U VARIANT FORM;Nl;0;L;;;;6;N;;;;; +1246C;CUNEIFORM NUMERIC SIGN SEVEN U VARIANT FORM;Nl;0;L;;;;7;N;;;;; +1246D;CUNEIFORM NUMERIC SIGN EIGHT U VARIANT FORM;Nl;0;L;;;;8;N;;;;; +1246E;CUNEIFORM NUMERIC SIGN NINE U VARIANT FORM;Nl;0;L;;;;9;N;;;;; +12470;CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER;Po;0;L;;;;;N;;;;; +12471;CUNEIFORM PUNCTUATION SIGN VERTICAL COLON;Po;0;L;;;;;N;;;;; +12472;CUNEIFORM PUNCTUATION SIGN DIAGONAL COLON;Po;0;L;;;;;N;;;;; +12473;CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON;Po;0;L;;;;;N;;;;; +12474;CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON;Po;0;L;;;;;N;;;;; +12480;CUNEIFORM SIGN AB TIMES NUN TENU;Lo;0;L;;;;;N;;;;; +12481;CUNEIFORM SIGN AB TIMES SHU2;Lo;0;L;;;;;N;;;;; +12482;CUNEIFORM SIGN AD TIMES ESH2;Lo;0;L;;;;;N;;;;; +12483;CUNEIFORM SIGN BAD TIMES DISH TENU;Lo;0;L;;;;;N;;;;; +12484;CUNEIFORM SIGN BAHAR2 TIMES AB2;Lo;0;L;;;;;N;;;;; +12485;CUNEIFORM SIGN BAHAR2 TIMES NI;Lo;0;L;;;;;N;;;;; +12486;CUNEIFORM SIGN BAHAR2 TIMES ZA;Lo;0;L;;;;;N;;;;; +12487;CUNEIFORM SIGN BU OVER BU TIMES NA2;Lo;0;L;;;;;N;;;;; +12488;CUNEIFORM SIGN DA TIMES TAK4;Lo;0;L;;;;;N;;;;; +12489;CUNEIFORM SIGN DAG TIMES KUR;Lo;0;L;;;;;N;;;;; +1248A;CUNEIFORM SIGN DIM TIMES IGI;Lo;0;L;;;;;N;;;;; +1248B;CUNEIFORM SIGN DIM TIMES U U U;Lo;0;L;;;;;N;;;;; +1248C;CUNEIFORM SIGN DIM2 TIMES UD;Lo;0;L;;;;;N;;;;; +1248D;CUNEIFORM SIGN DUG TIMES ANSHE;Lo;0;L;;;;;N;;;;; +1248E;CUNEIFORM SIGN DUG TIMES ASH;Lo;0;L;;;;;N;;;;; +1248F;CUNEIFORM SIGN DUG TIMES ASH AT LEFT;Lo;0;L;;;;;N;;;;; +12490;CUNEIFORM SIGN DUG TIMES DIN;Lo;0;L;;;;;N;;;;; +12491;CUNEIFORM SIGN DUG TIMES DUN;Lo;0;L;;;;;N;;;;; +12492;CUNEIFORM SIGN DUG TIMES ERIN2;Lo;0;L;;;;;N;;;;; +12493;CUNEIFORM SIGN DUG TIMES GA;Lo;0;L;;;;;N;;;;; +12494;CUNEIFORM SIGN DUG TIMES GI;Lo;0;L;;;;;N;;;;; +12495;CUNEIFORM SIGN DUG TIMES GIR2 GUNU;Lo;0;L;;;;;N;;;;; +12496;CUNEIFORM SIGN DUG TIMES GISH;Lo;0;L;;;;;N;;;;; +12497;CUNEIFORM SIGN DUG TIMES HA;Lo;0;L;;;;;N;;;;; +12498;CUNEIFORM SIGN DUG TIMES HI;Lo;0;L;;;;;N;;;;; +12499;CUNEIFORM SIGN DUG TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +1249A;CUNEIFORM SIGN DUG TIMES KASKAL;Lo;0;L;;;;;N;;;;; +1249B;CUNEIFORM SIGN DUG TIMES KUR;Lo;0;L;;;;;N;;;;; +1249C;CUNEIFORM SIGN DUG TIMES KUSHU2;Lo;0;L;;;;;N;;;;; +1249D;CUNEIFORM SIGN DUG TIMES KUSHU2 PLUS KASKAL;Lo;0;L;;;;;N;;;;; +1249E;CUNEIFORM SIGN DUG TIMES LAK-020;Lo;0;L;;;;;N;;;;; +1249F;CUNEIFORM SIGN DUG TIMES LAM;Lo;0;L;;;;;N;;;;; +124A0;CUNEIFORM SIGN DUG TIMES LAM TIMES KUR;Lo;0;L;;;;;N;;;;; +124A1;CUNEIFORM SIGN DUG TIMES LUH PLUS GISH;Lo;0;L;;;;;N;;;;; +124A2;CUNEIFORM SIGN DUG TIMES MASH;Lo;0;L;;;;;N;;;;; +124A3;CUNEIFORM SIGN DUG TIMES MES;Lo;0;L;;;;;N;;;;; +124A4;CUNEIFORM SIGN DUG TIMES MI;Lo;0;L;;;;;N;;;;; +124A5;CUNEIFORM SIGN DUG TIMES NI;Lo;0;L;;;;;N;;;;; +124A6;CUNEIFORM SIGN DUG TIMES PI;Lo;0;L;;;;;N;;;;; +124A7;CUNEIFORM SIGN DUG TIMES SHE;Lo;0;L;;;;;N;;;;; +124A8;CUNEIFORM SIGN DUG TIMES SI GUNU;Lo;0;L;;;;;N;;;;; +124A9;CUNEIFORM SIGN E2 TIMES KUR;Lo;0;L;;;;;N;;;;; +124AA;CUNEIFORM SIGN E2 TIMES PAP;Lo;0;L;;;;;N;;;;; +124AB;CUNEIFORM SIGN ERIN2 X;Lo;0;L;;;;;N;;;;; +124AC;CUNEIFORM SIGN ESH2 CROSSING ESH2;Lo;0;L;;;;;N;;;;; +124AD;CUNEIFORM SIGN EZEN SHESHIG TIMES ASH;Lo;0;L;;;;;N;;;;; +124AE;CUNEIFORM SIGN EZEN SHESHIG TIMES HI;Lo;0;L;;;;;N;;;;; +124AF;CUNEIFORM SIGN EZEN SHESHIG TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +124B0;CUNEIFORM SIGN EZEN SHESHIG TIMES LA;Lo;0;L;;;;;N;;;;; +124B1;CUNEIFORM SIGN EZEN SHESHIG TIMES LAL;Lo;0;L;;;;;N;;;;; +124B2;CUNEIFORM SIGN EZEN SHESHIG TIMES ME;Lo;0;L;;;;;N;;;;; +124B3;CUNEIFORM SIGN EZEN SHESHIG TIMES MES;Lo;0;L;;;;;N;;;;; +124B4;CUNEIFORM SIGN EZEN SHESHIG TIMES SU;Lo;0;L;;;;;N;;;;; +124B5;CUNEIFORM SIGN EZEN TIMES SU;Lo;0;L;;;;;N;;;;; +124B6;CUNEIFORM SIGN GA2 TIMES BAHAR2;Lo;0;L;;;;;N;;;;; +124B7;CUNEIFORM SIGN GA2 TIMES DIM GUNU;Lo;0;L;;;;;N;;;;; +124B8;CUNEIFORM SIGN GA2 TIMES DUG TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +124B9;CUNEIFORM SIGN GA2 TIMES DUG TIMES KASKAL;Lo;0;L;;;;;N;;;;; +124BA;CUNEIFORM SIGN GA2 TIMES EREN;Lo;0;L;;;;;N;;;;; +124BB;CUNEIFORM SIGN GA2 TIMES GA;Lo;0;L;;;;;N;;;;; +124BC;CUNEIFORM SIGN GA2 TIMES GAR PLUS DI;Lo;0;L;;;;;N;;;;; +124BD;CUNEIFORM SIGN GA2 TIMES GAR PLUS NE;Lo;0;L;;;;;N;;;;; +124BE;CUNEIFORM SIGN GA2 TIMES HA PLUS A;Lo;0;L;;;;;N;;;;; +124BF;CUNEIFORM SIGN GA2 TIMES KUSHU2 PLUS KASKAL;Lo;0;L;;;;;N;;;;; +124C0;CUNEIFORM SIGN GA2 TIMES LAM;Lo;0;L;;;;;N;;;;; +124C1;CUNEIFORM SIGN GA2 TIMES LAM TIMES KUR;Lo;0;L;;;;;N;;;;; +124C2;CUNEIFORM SIGN GA2 TIMES LUH;Lo;0;L;;;;;N;;;;; +124C3;CUNEIFORM SIGN GA2 TIMES MUSH;Lo;0;L;;;;;N;;;;; +124C4;CUNEIFORM SIGN GA2 TIMES NE;Lo;0;L;;;;;N;;;;; +124C5;CUNEIFORM SIGN GA2 TIMES NE PLUS E2;Lo;0;L;;;;;N;;;;; +124C6;CUNEIFORM SIGN GA2 TIMES NE PLUS GI;Lo;0;L;;;;;N;;;;; +124C7;CUNEIFORM SIGN GA2 TIMES SHIM;Lo;0;L;;;;;N;;;;; +124C8;CUNEIFORM SIGN GA2 TIMES ZIZ2;Lo;0;L;;;;;N;;;;; +124C9;CUNEIFORM SIGN GABA ROTATED NINETY DEGREES;Lo;0;L;;;;;N;;;;; +124CA;CUNEIFORM SIGN GESHTIN TIMES U;Lo;0;L;;;;;N;;;;; +124CB;CUNEIFORM SIGN GISH TIMES GISH CROSSING GISH;Lo;0;L;;;;;N;;;;; +124CC;CUNEIFORM SIGN GU2 TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +124CD;CUNEIFORM SIGN GUD PLUS GISH TIMES TAK4;Lo;0;L;;;;;N;;;;; +124CE;CUNEIFORM SIGN HA TENU GUNU;Lo;0;L;;;;;N;;;;; +124CF;CUNEIFORM SIGN HI TIMES ASH OVER HI TIMES ASH;Lo;0;L;;;;;N;;;;; +124D0;CUNEIFORM SIGN KA TIMES BU;Lo;0;L;;;;;N;;;;; +124D1;CUNEIFORM SIGN KA TIMES KA;Lo;0;L;;;;;N;;;;; +124D2;CUNEIFORM SIGN KA TIMES U U U;Lo;0;L;;;;;N;;;;; +124D3;CUNEIFORM SIGN KA TIMES UR;Lo;0;L;;;;;N;;;;; +124D4;CUNEIFORM SIGN LAGAB TIMES ZU OVER ZU;Lo;0;L;;;;;N;;;;; +124D5;CUNEIFORM SIGN LAK-003;Lo;0;L;;;;;N;;;;; +124D6;CUNEIFORM SIGN LAK-021;Lo;0;L;;;;;N;;;;; +124D7;CUNEIFORM SIGN LAK-025;Lo;0;L;;;;;N;;;;; +124D8;CUNEIFORM SIGN LAK-030;Lo;0;L;;;;;N;;;;; +124D9;CUNEIFORM SIGN LAK-050;Lo;0;L;;;;;N;;;;; +124DA;CUNEIFORM SIGN LAK-051;Lo;0;L;;;;;N;;;;; +124DB;CUNEIFORM SIGN LAK-062;Lo;0;L;;;;;N;;;;; +124DC;CUNEIFORM SIGN LAK-079 OVER LAK-079 GUNU;Lo;0;L;;;;;N;;;;; +124DD;CUNEIFORM SIGN LAK-080;Lo;0;L;;;;;N;;;;; +124DE;CUNEIFORM SIGN LAK-081 OVER LAK-081;Lo;0;L;;;;;N;;;;; +124DF;CUNEIFORM SIGN LAK-092;Lo;0;L;;;;;N;;;;; +124E0;CUNEIFORM SIGN LAK-130;Lo;0;L;;;;;N;;;;; +124E1;CUNEIFORM SIGN LAK-142;Lo;0;L;;;;;N;;;;; +124E2;CUNEIFORM SIGN LAK-210;Lo;0;L;;;;;N;;;;; +124E3;CUNEIFORM SIGN LAK-219;Lo;0;L;;;;;N;;;;; +124E4;CUNEIFORM SIGN LAK-220;Lo;0;L;;;;;N;;;;; +124E5;CUNEIFORM SIGN LAK-225;Lo;0;L;;;;;N;;;;; +124E6;CUNEIFORM SIGN LAK-228;Lo;0;L;;;;;N;;;;; +124E7;CUNEIFORM SIGN LAK-238;Lo;0;L;;;;;N;;;;; +124E8;CUNEIFORM SIGN LAK-265;Lo;0;L;;;;;N;;;;; +124E9;CUNEIFORM SIGN LAK-266;Lo;0;L;;;;;N;;;;; +124EA;CUNEIFORM SIGN LAK-343;Lo;0;L;;;;;N;;;;; +124EB;CUNEIFORM SIGN LAK-347;Lo;0;L;;;;;N;;;;; +124EC;CUNEIFORM SIGN LAK-348;Lo;0;L;;;;;N;;;;; +124ED;CUNEIFORM SIGN LAK-383;Lo;0;L;;;;;N;;;;; +124EE;CUNEIFORM SIGN LAK-384;Lo;0;L;;;;;N;;;;; +124EF;CUNEIFORM SIGN LAK-390;Lo;0;L;;;;;N;;;;; +124F0;CUNEIFORM SIGN LAK-441;Lo;0;L;;;;;N;;;;; +124F1;CUNEIFORM SIGN LAK-449;Lo;0;L;;;;;N;;;;; +124F2;CUNEIFORM SIGN LAK-449 TIMES GU;Lo;0;L;;;;;N;;;;; +124F3;CUNEIFORM SIGN LAK-449 TIMES IGI;Lo;0;L;;;;;N;;;;; +124F4;CUNEIFORM SIGN LAK-449 TIMES PAP PLUS LU3;Lo;0;L;;;;;N;;;;; +124F5;CUNEIFORM SIGN LAK-449 TIMES PAP PLUS PAP PLUS LU3;Lo;0;L;;;;;N;;;;; +124F6;CUNEIFORM SIGN LAK-449 TIMES U2 PLUS BA;Lo;0;L;;;;;N;;;;; +124F7;CUNEIFORM SIGN LAK-450;Lo;0;L;;;;;N;;;;; +124F8;CUNEIFORM SIGN LAK-457;Lo;0;L;;;;;N;;;;; +124F9;CUNEIFORM SIGN LAK-470;Lo;0;L;;;;;N;;;;; +124FA;CUNEIFORM SIGN LAK-483;Lo;0;L;;;;;N;;;;; +124FB;CUNEIFORM SIGN LAK-490;Lo;0;L;;;;;N;;;;; +124FC;CUNEIFORM SIGN LAK-492;Lo;0;L;;;;;N;;;;; +124FD;CUNEIFORM SIGN LAK-493;Lo;0;L;;;;;N;;;;; +124FE;CUNEIFORM SIGN LAK-495;Lo;0;L;;;;;N;;;;; +124FF;CUNEIFORM SIGN LAK-550;Lo;0;L;;;;;N;;;;; +12500;CUNEIFORM SIGN LAK-608;Lo;0;L;;;;;N;;;;; +12501;CUNEIFORM SIGN LAK-617;Lo;0;L;;;;;N;;;;; +12502;CUNEIFORM SIGN LAK-617 TIMES ASH;Lo;0;L;;;;;N;;;;; +12503;CUNEIFORM SIGN LAK-617 TIMES BAD;Lo;0;L;;;;;N;;;;; +12504;CUNEIFORM SIGN LAK-617 TIMES DUN3 GUNU GUNU;Lo;0;L;;;;;N;;;;; +12505;CUNEIFORM SIGN LAK-617 TIMES KU3;Lo;0;L;;;;;N;;;;; +12506;CUNEIFORM SIGN LAK-617 TIMES LA;Lo;0;L;;;;;N;;;;; +12507;CUNEIFORM SIGN LAK-617 TIMES TAR;Lo;0;L;;;;;N;;;;; +12508;CUNEIFORM SIGN LAK-617 TIMES TE;Lo;0;L;;;;;N;;;;; +12509;CUNEIFORM SIGN LAK-617 TIMES U2;Lo;0;L;;;;;N;;;;; +1250A;CUNEIFORM SIGN LAK-617 TIMES UD;Lo;0;L;;;;;N;;;;; +1250B;CUNEIFORM SIGN LAK-617 TIMES URUDA;Lo;0;L;;;;;N;;;;; +1250C;CUNEIFORM SIGN LAK-636;Lo;0;L;;;;;N;;;;; +1250D;CUNEIFORM SIGN LAK-648;Lo;0;L;;;;;N;;;;; +1250E;CUNEIFORM SIGN LAK-648 TIMES DUB;Lo;0;L;;;;;N;;;;; +1250F;CUNEIFORM SIGN LAK-648 TIMES GA;Lo;0;L;;;;;N;;;;; +12510;CUNEIFORM SIGN LAK-648 TIMES IGI;Lo;0;L;;;;;N;;;;; +12511;CUNEIFORM SIGN LAK-648 TIMES IGI GUNU;Lo;0;L;;;;;N;;;;; +12512;CUNEIFORM SIGN LAK-648 TIMES NI;Lo;0;L;;;;;N;;;;; +12513;CUNEIFORM SIGN LAK-648 TIMES PAP PLUS PAP PLUS LU3;Lo;0;L;;;;;N;;;;; +12514;CUNEIFORM SIGN LAK-648 TIMES SHESH PLUS KI;Lo;0;L;;;;;N;;;;; +12515;CUNEIFORM SIGN LAK-648 TIMES UD;Lo;0;L;;;;;N;;;;; +12516;CUNEIFORM SIGN LAK-648 TIMES URUDA;Lo;0;L;;;;;N;;;;; +12517;CUNEIFORM SIGN LAK-724;Lo;0;L;;;;;N;;;;; +12518;CUNEIFORM SIGN LAK-749;Lo;0;L;;;;;N;;;;; +12519;CUNEIFORM SIGN LU2 GUNU TIMES ASH;Lo;0;L;;;;;N;;;;; +1251A;CUNEIFORM SIGN LU2 TIMES DISH;Lo;0;L;;;;;N;;;;; +1251B;CUNEIFORM SIGN LU2 TIMES HAL;Lo;0;L;;;;;N;;;;; +1251C;CUNEIFORM SIGN LU2 TIMES PAP;Lo;0;L;;;;;N;;;;; +1251D;CUNEIFORM SIGN LU2 TIMES PAP PLUS PAP PLUS LU3;Lo;0;L;;;;;N;;;;; +1251E;CUNEIFORM SIGN LU2 TIMES TAK4;Lo;0;L;;;;;N;;;;; +1251F;CUNEIFORM SIGN MI PLUS ZA7;Lo;0;L;;;;;N;;;;; +12520;CUNEIFORM SIGN MUSH OVER MUSH TIMES GA;Lo;0;L;;;;;N;;;;; +12521;CUNEIFORM SIGN MUSH OVER MUSH TIMES KAK;Lo;0;L;;;;;N;;;;; +12522;CUNEIFORM SIGN NINDA2 TIMES DIM GUNU;Lo;0;L;;;;;N;;;;; +12523;CUNEIFORM SIGN NINDA2 TIMES GISH;Lo;0;L;;;;;N;;;;; +12524;CUNEIFORM SIGN NINDA2 TIMES GUL;Lo;0;L;;;;;N;;;;; +12525;CUNEIFORM SIGN NINDA2 TIMES HI;Lo;0;L;;;;;N;;;;; +12526;CUNEIFORM SIGN NINDA2 TIMES KESH2;Lo;0;L;;;;;N;;;;; +12527;CUNEIFORM SIGN NINDA2 TIMES LAK-050;Lo;0;L;;;;;N;;;;; +12528;CUNEIFORM SIGN NINDA2 TIMES MASH;Lo;0;L;;;;;N;;;;; +12529;CUNEIFORM SIGN NINDA2 TIMES PAP PLUS PAP;Lo;0;L;;;;;N;;;;; +1252A;CUNEIFORM SIGN NINDA2 TIMES U;Lo;0;L;;;;;N;;;;; +1252B;CUNEIFORM SIGN NINDA2 TIMES U PLUS U;Lo;0;L;;;;;N;;;;; +1252C;CUNEIFORM SIGN NINDA2 TIMES URUDA;Lo;0;L;;;;;N;;;;; +1252D;CUNEIFORM SIGN SAG GUNU TIMES HA;Lo;0;L;;;;;N;;;;; +1252E;CUNEIFORM SIGN SAG TIMES EN;Lo;0;L;;;;;N;;;;; +1252F;CUNEIFORM SIGN SAG TIMES SHE AT LEFT;Lo;0;L;;;;;N;;;;; +12530;CUNEIFORM SIGN SAG TIMES TAK4;Lo;0;L;;;;;N;;;;; +12531;CUNEIFORM SIGN SHA6 TENU;Lo;0;L;;;;;N;;;;; +12532;CUNEIFORM SIGN SHE OVER SHE;Lo;0;L;;;;;N;;;;; +12533;CUNEIFORM SIGN SHE PLUS HUB2;Lo;0;L;;;;;N;;;;; +12534;CUNEIFORM SIGN SHE PLUS NAM2;Lo;0;L;;;;;N;;;;; +12535;CUNEIFORM SIGN SHE PLUS SAR;Lo;0;L;;;;;N;;;;; +12536;CUNEIFORM SIGN SHU2 PLUS DUG TIMES NI;Lo;0;L;;;;;N;;;;; +12537;CUNEIFORM SIGN SHU2 PLUS E2 TIMES AN;Lo;0;L;;;;;N;;;;; +12538;CUNEIFORM SIGN SI TIMES TAK4;Lo;0;L;;;;;N;;;;; +12539;CUNEIFORM SIGN TAK4 PLUS SAG;Lo;0;L;;;;;N;;;;; +1253A;CUNEIFORM SIGN TUM TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;; +1253B;CUNEIFORM SIGN TUM TIMES THREE DISH;Lo;0;L;;;;;N;;;;; +1253C;CUNEIFORM SIGN UR2 INVERTED;Lo;0;L;;;;;N;;;;; +1253D;CUNEIFORM SIGN UR2 TIMES UD;Lo;0;L;;;;;N;;;;; +1253E;CUNEIFORM SIGN URU TIMES DARA3;Lo;0;L;;;;;N;;;;; +1253F;CUNEIFORM SIGN URU TIMES LAK-668;Lo;0;L;;;;;N;;;;; +12540;CUNEIFORM SIGN URU TIMES LU3;Lo;0;L;;;;;N;;;;; +12541;CUNEIFORM SIGN ZA7;Lo;0;L;;;;;N;;;;; +12542;CUNEIFORM SIGN ZU OVER ZU PLUS SAR;Lo;0;L;;;;;N;;;;; +12543;CUNEIFORM SIGN ZU5 TIMES THREE DISH TENU;Lo;0;L;;;;;N;;;;; +13000;EGYPTIAN HIEROGLYPH A001;Lo;0;L;;;;;N;;;;; +13001;EGYPTIAN HIEROGLYPH A002;Lo;0;L;;;;;N;;;;; +13002;EGYPTIAN HIEROGLYPH A003;Lo;0;L;;;;;N;;;;; +13003;EGYPTIAN HIEROGLYPH A004;Lo;0;L;;;;;N;;;;; +13004;EGYPTIAN HIEROGLYPH A005;Lo;0;L;;;;;N;;;;; +13005;EGYPTIAN HIEROGLYPH A005A;Lo;0;L;;;;;N;;;;; +13006;EGYPTIAN HIEROGLYPH A006;Lo;0;L;;;;;N;;;;; +13007;EGYPTIAN HIEROGLYPH A006A;Lo;0;L;;;;;N;;;;; +13008;EGYPTIAN HIEROGLYPH A006B;Lo;0;L;;;;;N;;;;; +13009;EGYPTIAN HIEROGLYPH A007;Lo;0;L;;;;;N;;;;; +1300A;EGYPTIAN HIEROGLYPH A008;Lo;0;L;;;;;N;;;;; +1300B;EGYPTIAN HIEROGLYPH A009;Lo;0;L;;;;;N;;;;; +1300C;EGYPTIAN HIEROGLYPH A010;Lo;0;L;;;;;N;;;;; +1300D;EGYPTIAN HIEROGLYPH A011;Lo;0;L;;;;;N;;;;; +1300E;EGYPTIAN HIEROGLYPH A012;Lo;0;L;;;;;N;;;;; +1300F;EGYPTIAN HIEROGLYPH A013;Lo;0;L;;;;;N;;;;; +13010;EGYPTIAN HIEROGLYPH A014;Lo;0;L;;;;;N;;;;; +13011;EGYPTIAN HIEROGLYPH A014A;Lo;0;L;;;;;N;;;;; +13012;EGYPTIAN HIEROGLYPH A015;Lo;0;L;;;;;N;;;;; +13013;EGYPTIAN HIEROGLYPH A016;Lo;0;L;;;;;N;;;;; +13014;EGYPTIAN HIEROGLYPH A017;Lo;0;L;;;;;N;;;;; +13015;EGYPTIAN HIEROGLYPH A017A;Lo;0;L;;;;;N;;;;; +13016;EGYPTIAN HIEROGLYPH A018;Lo;0;L;;;;;N;;;;; +13017;EGYPTIAN HIEROGLYPH A019;Lo;0;L;;;;;N;;;;; +13018;EGYPTIAN HIEROGLYPH A020;Lo;0;L;;;;;N;;;;; +13019;EGYPTIAN HIEROGLYPH A021;Lo;0;L;;;;;N;;;;; +1301A;EGYPTIAN HIEROGLYPH A022;Lo;0;L;;;;;N;;;;; +1301B;EGYPTIAN HIEROGLYPH A023;Lo;0;L;;;;;N;;;;; +1301C;EGYPTIAN HIEROGLYPH A024;Lo;0;L;;;;;N;;;;; +1301D;EGYPTIAN HIEROGLYPH A025;Lo;0;L;;;;;N;;;;; +1301E;EGYPTIAN HIEROGLYPH A026;Lo;0;L;;;;;N;;;;; +1301F;EGYPTIAN HIEROGLYPH A027;Lo;0;L;;;;;N;;;;; +13020;EGYPTIAN HIEROGLYPH A028;Lo;0;L;;;;;N;;;;; +13021;EGYPTIAN HIEROGLYPH A029;Lo;0;L;;;;;N;;;;; +13022;EGYPTIAN HIEROGLYPH A030;Lo;0;L;;;;;N;;;;; +13023;EGYPTIAN HIEROGLYPH A031;Lo;0;L;;;;;N;;;;; +13024;EGYPTIAN HIEROGLYPH A032;Lo;0;L;;;;;N;;;;; +13025;EGYPTIAN HIEROGLYPH A032A;Lo;0;L;;;;;N;;;;; +13026;EGYPTIAN HIEROGLYPH A033;Lo;0;L;;;;;N;;;;; +13027;EGYPTIAN HIEROGLYPH A034;Lo;0;L;;;;;N;;;;; +13028;EGYPTIAN HIEROGLYPH A035;Lo;0;L;;;;;N;;;;; +13029;EGYPTIAN HIEROGLYPH A036;Lo;0;L;;;;;N;;;;; +1302A;EGYPTIAN HIEROGLYPH A037;Lo;0;L;;;;;N;;;;; +1302B;EGYPTIAN HIEROGLYPH A038;Lo;0;L;;;;;N;;;;; +1302C;EGYPTIAN HIEROGLYPH A039;Lo;0;L;;;;;N;;;;; +1302D;EGYPTIAN HIEROGLYPH A040;Lo;0;L;;;;;N;;;;; +1302E;EGYPTIAN HIEROGLYPH A040A;Lo;0;L;;;;;N;;;;; +1302F;EGYPTIAN HIEROGLYPH A041;Lo;0;L;;;;;N;;;;; +13030;EGYPTIAN HIEROGLYPH A042;Lo;0;L;;;;;N;;;;; +13031;EGYPTIAN HIEROGLYPH A042A;Lo;0;L;;;;;N;;;;; +13032;EGYPTIAN HIEROGLYPH A043;Lo;0;L;;;;;N;;;;; +13033;EGYPTIAN HIEROGLYPH A043A;Lo;0;L;;;;;N;;;;; +13034;EGYPTIAN HIEROGLYPH A044;Lo;0;L;;;;;N;;;;; +13035;EGYPTIAN HIEROGLYPH A045;Lo;0;L;;;;;N;;;;; +13036;EGYPTIAN HIEROGLYPH A045A;Lo;0;L;;;;;N;;;;; +13037;EGYPTIAN HIEROGLYPH A046;Lo;0;L;;;;;N;;;;; +13038;EGYPTIAN HIEROGLYPH A047;Lo;0;L;;;;;N;;;;; +13039;EGYPTIAN HIEROGLYPH A048;Lo;0;L;;;;;N;;;;; +1303A;EGYPTIAN HIEROGLYPH A049;Lo;0;L;;;;;N;;;;; +1303B;EGYPTIAN HIEROGLYPH A050;Lo;0;L;;;;;N;;;;; +1303C;EGYPTIAN HIEROGLYPH A051;Lo;0;L;;;;;N;;;;; +1303D;EGYPTIAN HIEROGLYPH A052;Lo;0;L;;;;;N;;;;; +1303E;EGYPTIAN HIEROGLYPH A053;Lo;0;L;;;;;N;;;;; +1303F;EGYPTIAN HIEROGLYPH A054;Lo;0;L;;;;;N;;;;; +13040;EGYPTIAN HIEROGLYPH A055;Lo;0;L;;;;;N;;;;; +13041;EGYPTIAN HIEROGLYPH A056;Lo;0;L;;;;;N;;;;; +13042;EGYPTIAN HIEROGLYPH A057;Lo;0;L;;;;;N;;;;; +13043;EGYPTIAN HIEROGLYPH A058;Lo;0;L;;;;;N;;;;; +13044;EGYPTIAN HIEROGLYPH A059;Lo;0;L;;;;;N;;;;; +13045;EGYPTIAN HIEROGLYPH A060;Lo;0;L;;;;;N;;;;; +13046;EGYPTIAN HIEROGLYPH A061;Lo;0;L;;;;;N;;;;; +13047;EGYPTIAN HIEROGLYPH A062;Lo;0;L;;;;;N;;;;; +13048;EGYPTIAN HIEROGLYPH A063;Lo;0;L;;;;;N;;;;; +13049;EGYPTIAN HIEROGLYPH A064;Lo;0;L;;;;;N;;;;; +1304A;EGYPTIAN HIEROGLYPH A065;Lo;0;L;;;;;N;;;;; +1304B;EGYPTIAN HIEROGLYPH A066;Lo;0;L;;;;;N;;;;; +1304C;EGYPTIAN HIEROGLYPH A067;Lo;0;L;;;;;N;;;;; +1304D;EGYPTIAN HIEROGLYPH A068;Lo;0;L;;;;;N;;;;; +1304E;EGYPTIAN HIEROGLYPH A069;Lo;0;L;;;;;N;;;;; +1304F;EGYPTIAN HIEROGLYPH A070;Lo;0;L;;;;;N;;;;; +13050;EGYPTIAN HIEROGLYPH B001;Lo;0;L;;;;;N;;;;; +13051;EGYPTIAN HIEROGLYPH B002;Lo;0;L;;;;;N;;;;; +13052;EGYPTIAN HIEROGLYPH B003;Lo;0;L;;;;;N;;;;; +13053;EGYPTIAN HIEROGLYPH B004;Lo;0;L;;;;;N;;;;; +13054;EGYPTIAN HIEROGLYPH B005;Lo;0;L;;;;;N;;;;; +13055;EGYPTIAN HIEROGLYPH B005A;Lo;0;L;;;;;N;;;;; +13056;EGYPTIAN HIEROGLYPH B006;Lo;0;L;;;;;N;;;;; +13057;EGYPTIAN HIEROGLYPH B007;Lo;0;L;;;;;N;;;;; +13058;EGYPTIAN HIEROGLYPH B008;Lo;0;L;;;;;N;;;;; +13059;EGYPTIAN HIEROGLYPH B009;Lo;0;L;;;;;N;;;;; +1305A;EGYPTIAN HIEROGLYPH C001;Lo;0;L;;;;;N;;;;; +1305B;EGYPTIAN HIEROGLYPH C002;Lo;0;L;;;;;N;;;;; +1305C;EGYPTIAN HIEROGLYPH C002A;Lo;0;L;;;;;N;;;;; +1305D;EGYPTIAN HIEROGLYPH C002B;Lo;0;L;;;;;N;;;;; +1305E;EGYPTIAN HIEROGLYPH C002C;Lo;0;L;;;;;N;;;;; +1305F;EGYPTIAN HIEROGLYPH C003;Lo;0;L;;;;;N;;;;; +13060;EGYPTIAN HIEROGLYPH C004;Lo;0;L;;;;;N;;;;; +13061;EGYPTIAN HIEROGLYPH C005;Lo;0;L;;;;;N;;;;; +13062;EGYPTIAN HIEROGLYPH C006;Lo;0;L;;;;;N;;;;; +13063;EGYPTIAN HIEROGLYPH C007;Lo;0;L;;;;;N;;;;; +13064;EGYPTIAN HIEROGLYPH C008;Lo;0;L;;;;;N;;;;; +13065;EGYPTIAN HIEROGLYPH C009;Lo;0;L;;;;;N;;;;; +13066;EGYPTIAN HIEROGLYPH C010;Lo;0;L;;;;;N;;;;; +13067;EGYPTIAN HIEROGLYPH C010A;Lo;0;L;;;;;N;;;;; +13068;EGYPTIAN HIEROGLYPH C011;Lo;0;L;;;;;N;;;;; +13069;EGYPTIAN HIEROGLYPH C012;Lo;0;L;;;;;N;;;;; +1306A;EGYPTIAN HIEROGLYPH C013;Lo;0;L;;;;;N;;;;; +1306B;EGYPTIAN HIEROGLYPH C014;Lo;0;L;;;;;N;;;;; +1306C;EGYPTIAN HIEROGLYPH C015;Lo;0;L;;;;;N;;;;; +1306D;EGYPTIAN HIEROGLYPH C016;Lo;0;L;;;;;N;;;;; +1306E;EGYPTIAN HIEROGLYPH C017;Lo;0;L;;;;;N;;;;; +1306F;EGYPTIAN HIEROGLYPH C018;Lo;0;L;;;;;N;;;;; +13070;EGYPTIAN HIEROGLYPH C019;Lo;0;L;;;;;N;;;;; +13071;EGYPTIAN HIEROGLYPH C020;Lo;0;L;;;;;N;;;;; +13072;EGYPTIAN HIEROGLYPH C021;Lo;0;L;;;;;N;;;;; +13073;EGYPTIAN HIEROGLYPH C022;Lo;0;L;;;;;N;;;;; +13074;EGYPTIAN HIEROGLYPH C023;Lo;0;L;;;;;N;;;;; +13075;EGYPTIAN HIEROGLYPH C024;Lo;0;L;;;;;N;;;;; +13076;EGYPTIAN HIEROGLYPH D001;Lo;0;L;;;;;N;;;;; +13077;EGYPTIAN HIEROGLYPH D002;Lo;0;L;;;;;N;;;;; +13078;EGYPTIAN HIEROGLYPH D003;Lo;0;L;;;;;N;;;;; +13079;EGYPTIAN HIEROGLYPH D004;Lo;0;L;;;;;N;;;;; +1307A;EGYPTIAN HIEROGLYPH D005;Lo;0;L;;;;;N;;;;; +1307B;EGYPTIAN HIEROGLYPH D006;Lo;0;L;;;;;N;;;;; +1307C;EGYPTIAN HIEROGLYPH D007;Lo;0;L;;;;;N;;;;; +1307D;EGYPTIAN HIEROGLYPH D008;Lo;0;L;;;;;N;;;;; +1307E;EGYPTIAN HIEROGLYPH D008A;Lo;0;L;;;;;N;;;;; +1307F;EGYPTIAN HIEROGLYPH D009;Lo;0;L;;;;;N;;;;; +13080;EGYPTIAN HIEROGLYPH D010;Lo;0;L;;;;;N;;;;; +13081;EGYPTIAN HIEROGLYPH D011;Lo;0;L;;;;;N;;;;; +13082;EGYPTIAN HIEROGLYPH D012;Lo;0;L;;;;;N;;;;; +13083;EGYPTIAN HIEROGLYPH D013;Lo;0;L;;;;;N;;;;; +13084;EGYPTIAN HIEROGLYPH D014;Lo;0;L;;;;;N;;;;; +13085;EGYPTIAN HIEROGLYPH D015;Lo;0;L;;;;;N;;;;; +13086;EGYPTIAN HIEROGLYPH D016;Lo;0;L;;;;;N;;;;; +13087;EGYPTIAN HIEROGLYPH D017;Lo;0;L;;;;;N;;;;; +13088;EGYPTIAN HIEROGLYPH D018;Lo;0;L;;;;;N;;;;; +13089;EGYPTIAN HIEROGLYPH D019;Lo;0;L;;;;;N;;;;; +1308A;EGYPTIAN HIEROGLYPH D020;Lo;0;L;;;;;N;;;;; +1308B;EGYPTIAN HIEROGLYPH D021;Lo;0;L;;;;;N;;;;; +1308C;EGYPTIAN HIEROGLYPH D022;Lo;0;L;;;;;N;;;;; +1308D;EGYPTIAN HIEROGLYPH D023;Lo;0;L;;;;;N;;;;; +1308E;EGYPTIAN HIEROGLYPH D024;Lo;0;L;;;;;N;;;;; +1308F;EGYPTIAN HIEROGLYPH D025;Lo;0;L;;;;;N;;;;; +13090;EGYPTIAN HIEROGLYPH D026;Lo;0;L;;;;;N;;;;; +13091;EGYPTIAN HIEROGLYPH D027;Lo;0;L;;;;;N;;;;; +13092;EGYPTIAN HIEROGLYPH D027A;Lo;0;L;;;;;N;;;;; +13093;EGYPTIAN HIEROGLYPH D028;Lo;0;L;;;;;N;;;;; +13094;EGYPTIAN HIEROGLYPH D029;Lo;0;L;;;;;N;;;;; +13095;EGYPTIAN HIEROGLYPH D030;Lo;0;L;;;;;N;;;;; +13096;EGYPTIAN HIEROGLYPH D031;Lo;0;L;;;;;N;;;;; +13097;EGYPTIAN HIEROGLYPH D031A;Lo;0;L;;;;;N;;;;; +13098;EGYPTIAN HIEROGLYPH D032;Lo;0;L;;;;;N;;;;; +13099;EGYPTIAN HIEROGLYPH D033;Lo;0;L;;;;;N;;;;; +1309A;EGYPTIAN HIEROGLYPH D034;Lo;0;L;;;;;N;;;;; +1309B;EGYPTIAN HIEROGLYPH D034A;Lo;0;L;;;;;N;;;;; +1309C;EGYPTIAN HIEROGLYPH D035;Lo;0;L;;;;;N;;;;; +1309D;EGYPTIAN HIEROGLYPH D036;Lo;0;L;;;;;N;;;;; +1309E;EGYPTIAN HIEROGLYPH D037;Lo;0;L;;;;;N;;;;; +1309F;EGYPTIAN HIEROGLYPH D038;Lo;0;L;;;;;N;;;;; +130A0;EGYPTIAN HIEROGLYPH D039;Lo;0;L;;;;;N;;;;; +130A1;EGYPTIAN HIEROGLYPH D040;Lo;0;L;;;;;N;;;;; +130A2;EGYPTIAN HIEROGLYPH D041;Lo;0;L;;;;;N;;;;; +130A3;EGYPTIAN HIEROGLYPH D042;Lo;0;L;;;;;N;;;;; +130A4;EGYPTIAN HIEROGLYPH D043;Lo;0;L;;;;;N;;;;; +130A5;EGYPTIAN HIEROGLYPH D044;Lo;0;L;;;;;N;;;;; +130A6;EGYPTIAN HIEROGLYPH D045;Lo;0;L;;;;;N;;;;; +130A7;EGYPTIAN HIEROGLYPH D046;Lo;0;L;;;;;N;;;;; +130A8;EGYPTIAN HIEROGLYPH D046A;Lo;0;L;;;;;N;;;;; +130A9;EGYPTIAN HIEROGLYPH D047;Lo;0;L;;;;;N;;;;; +130AA;EGYPTIAN HIEROGLYPH D048;Lo;0;L;;;;;N;;;;; +130AB;EGYPTIAN HIEROGLYPH D048A;Lo;0;L;;;;;N;;;;; +130AC;EGYPTIAN HIEROGLYPH D049;Lo;0;L;;;;;N;;;;; +130AD;EGYPTIAN HIEROGLYPH D050;Lo;0;L;;;;;N;;;;; +130AE;EGYPTIAN HIEROGLYPH D050A;Lo;0;L;;;;;N;;;;; +130AF;EGYPTIAN HIEROGLYPH D050B;Lo;0;L;;;;;N;;;;; +130B0;EGYPTIAN HIEROGLYPH D050C;Lo;0;L;;;;;N;;;;; +130B1;EGYPTIAN HIEROGLYPH D050D;Lo;0;L;;;;;N;;;;; +130B2;EGYPTIAN HIEROGLYPH D050E;Lo;0;L;;;;;N;;;;; +130B3;EGYPTIAN HIEROGLYPH D050F;Lo;0;L;;;;;N;;;;; +130B4;EGYPTIAN HIEROGLYPH D050G;Lo;0;L;;;;;N;;;;; +130B5;EGYPTIAN HIEROGLYPH D050H;Lo;0;L;;;;;N;;;;; +130B6;EGYPTIAN HIEROGLYPH D050I;Lo;0;L;;;;;N;;;;; +130B7;EGYPTIAN HIEROGLYPH D051;Lo;0;L;;;;;N;;;;; +130B8;EGYPTIAN HIEROGLYPH D052;Lo;0;L;;;;;N;;;;; +130B9;EGYPTIAN HIEROGLYPH D052A;Lo;0;L;;;;;N;;;;; +130BA;EGYPTIAN HIEROGLYPH D053;Lo;0;L;;;;;N;;;;; +130BB;EGYPTIAN HIEROGLYPH D054;Lo;0;L;;;;;N;;;;; +130BC;EGYPTIAN HIEROGLYPH D054A;Lo;0;L;;;;;N;;;;; +130BD;EGYPTIAN HIEROGLYPH D055;Lo;0;L;;;;;N;;;;; +130BE;EGYPTIAN HIEROGLYPH D056;Lo;0;L;;;;;N;;;;; +130BF;EGYPTIAN HIEROGLYPH D057;Lo;0;L;;;;;N;;;;; +130C0;EGYPTIAN HIEROGLYPH D058;Lo;0;L;;;;;N;;;;; +130C1;EGYPTIAN HIEROGLYPH D059;Lo;0;L;;;;;N;;;;; +130C2;EGYPTIAN HIEROGLYPH D060;Lo;0;L;;;;;N;;;;; +130C3;EGYPTIAN HIEROGLYPH D061;Lo;0;L;;;;;N;;;;; +130C4;EGYPTIAN HIEROGLYPH D062;Lo;0;L;;;;;N;;;;; +130C5;EGYPTIAN HIEROGLYPH D063;Lo;0;L;;;;;N;;;;; +130C6;EGYPTIAN HIEROGLYPH D064;Lo;0;L;;;;;N;;;;; +130C7;EGYPTIAN HIEROGLYPH D065;Lo;0;L;;;;;N;;;;; +130C8;EGYPTIAN HIEROGLYPH D066;Lo;0;L;;;;;N;;;;; +130C9;EGYPTIAN HIEROGLYPH D067;Lo;0;L;;;;;N;;;;; +130CA;EGYPTIAN HIEROGLYPH D067A;Lo;0;L;;;;;N;;;;; +130CB;EGYPTIAN HIEROGLYPH D067B;Lo;0;L;;;;;N;;;;; +130CC;EGYPTIAN HIEROGLYPH D067C;Lo;0;L;;;;;N;;;;; +130CD;EGYPTIAN HIEROGLYPH D067D;Lo;0;L;;;;;N;;;;; +130CE;EGYPTIAN HIEROGLYPH D067E;Lo;0;L;;;;;N;;;;; +130CF;EGYPTIAN HIEROGLYPH D067F;Lo;0;L;;;;;N;;;;; +130D0;EGYPTIAN HIEROGLYPH D067G;Lo;0;L;;;;;N;;;;; +130D1;EGYPTIAN HIEROGLYPH D067H;Lo;0;L;;;;;N;;;;; +130D2;EGYPTIAN HIEROGLYPH E001;Lo;0;L;;;;;N;;;;; +130D3;EGYPTIAN HIEROGLYPH E002;Lo;0;L;;;;;N;;;;; +130D4;EGYPTIAN HIEROGLYPH E003;Lo;0;L;;;;;N;;;;; +130D5;EGYPTIAN HIEROGLYPH E004;Lo;0;L;;;;;N;;;;; +130D6;EGYPTIAN HIEROGLYPH E005;Lo;0;L;;;;;N;;;;; +130D7;EGYPTIAN HIEROGLYPH E006;Lo;0;L;;;;;N;;;;; +130D8;EGYPTIAN HIEROGLYPH E007;Lo;0;L;;;;;N;;;;; +130D9;EGYPTIAN HIEROGLYPH E008;Lo;0;L;;;;;N;;;;; +130DA;EGYPTIAN HIEROGLYPH E008A;Lo;0;L;;;;;N;;;;; +130DB;EGYPTIAN HIEROGLYPH E009;Lo;0;L;;;;;N;;;;; +130DC;EGYPTIAN HIEROGLYPH E009A;Lo;0;L;;;;;N;;;;; +130DD;EGYPTIAN HIEROGLYPH E010;Lo;0;L;;;;;N;;;;; +130DE;EGYPTIAN HIEROGLYPH E011;Lo;0;L;;;;;N;;;;; +130DF;EGYPTIAN HIEROGLYPH E012;Lo;0;L;;;;;N;;;;; +130E0;EGYPTIAN HIEROGLYPH E013;Lo;0;L;;;;;N;;;;; +130E1;EGYPTIAN HIEROGLYPH E014;Lo;0;L;;;;;N;;;;; +130E2;EGYPTIAN HIEROGLYPH E015;Lo;0;L;;;;;N;;;;; +130E3;EGYPTIAN HIEROGLYPH E016;Lo;0;L;;;;;N;;;;; +130E4;EGYPTIAN HIEROGLYPH E016A;Lo;0;L;;;;;N;;;;; +130E5;EGYPTIAN HIEROGLYPH E017;Lo;0;L;;;;;N;;;;; +130E6;EGYPTIAN HIEROGLYPH E017A;Lo;0;L;;;;;N;;;;; +130E7;EGYPTIAN HIEROGLYPH E018;Lo;0;L;;;;;N;;;;; +130E8;EGYPTIAN HIEROGLYPH E019;Lo;0;L;;;;;N;;;;; +130E9;EGYPTIAN HIEROGLYPH E020;Lo;0;L;;;;;N;;;;; +130EA;EGYPTIAN HIEROGLYPH E020A;Lo;0;L;;;;;N;;;;; +130EB;EGYPTIAN HIEROGLYPH E021;Lo;0;L;;;;;N;;;;; +130EC;EGYPTIAN HIEROGLYPH E022;Lo;0;L;;;;;N;;;;; +130ED;EGYPTIAN HIEROGLYPH E023;Lo;0;L;;;;;N;;;;; +130EE;EGYPTIAN HIEROGLYPH E024;Lo;0;L;;;;;N;;;;; +130EF;EGYPTIAN HIEROGLYPH E025;Lo;0;L;;;;;N;;;;; +130F0;EGYPTIAN HIEROGLYPH E026;Lo;0;L;;;;;N;;;;; +130F1;EGYPTIAN HIEROGLYPH E027;Lo;0;L;;;;;N;;;;; +130F2;EGYPTIAN HIEROGLYPH E028;Lo;0;L;;;;;N;;;;; +130F3;EGYPTIAN HIEROGLYPH E028A;Lo;0;L;;;;;N;;;;; +130F4;EGYPTIAN HIEROGLYPH E029;Lo;0;L;;;;;N;;;;; +130F5;EGYPTIAN HIEROGLYPH E030;Lo;0;L;;;;;N;;;;; +130F6;EGYPTIAN HIEROGLYPH E031;Lo;0;L;;;;;N;;;;; +130F7;EGYPTIAN HIEROGLYPH E032;Lo;0;L;;;;;N;;;;; +130F8;EGYPTIAN HIEROGLYPH E033;Lo;0;L;;;;;N;;;;; +130F9;EGYPTIAN HIEROGLYPH E034;Lo;0;L;;;;;N;;;;; +130FA;EGYPTIAN HIEROGLYPH E034A;Lo;0;L;;;;;N;;;;; +130FB;EGYPTIAN HIEROGLYPH E036;Lo;0;L;;;;;N;;;;; +130FC;EGYPTIAN HIEROGLYPH E037;Lo;0;L;;;;;N;;;;; +130FD;EGYPTIAN HIEROGLYPH E038;Lo;0;L;;;;;N;;;;; +130FE;EGYPTIAN HIEROGLYPH F001;Lo;0;L;;;;;N;;;;; +130FF;EGYPTIAN HIEROGLYPH F001A;Lo;0;L;;;;;N;;;;; +13100;EGYPTIAN HIEROGLYPH F002;Lo;0;L;;;;;N;;;;; +13101;EGYPTIAN HIEROGLYPH F003;Lo;0;L;;;;;N;;;;; +13102;EGYPTIAN HIEROGLYPH F004;Lo;0;L;;;;;N;;;;; +13103;EGYPTIAN HIEROGLYPH F005;Lo;0;L;;;;;N;;;;; +13104;EGYPTIAN HIEROGLYPH F006;Lo;0;L;;;;;N;;;;; +13105;EGYPTIAN HIEROGLYPH F007;Lo;0;L;;;;;N;;;;; +13106;EGYPTIAN HIEROGLYPH F008;Lo;0;L;;;;;N;;;;; +13107;EGYPTIAN HIEROGLYPH F009;Lo;0;L;;;;;N;;;;; +13108;EGYPTIAN HIEROGLYPH F010;Lo;0;L;;;;;N;;;;; +13109;EGYPTIAN HIEROGLYPH F011;Lo;0;L;;;;;N;;;;; +1310A;EGYPTIAN HIEROGLYPH F012;Lo;0;L;;;;;N;;;;; +1310B;EGYPTIAN HIEROGLYPH F013;Lo;0;L;;;;;N;;;;; +1310C;EGYPTIAN HIEROGLYPH F013A;Lo;0;L;;;;;N;;;;; +1310D;EGYPTIAN HIEROGLYPH F014;Lo;0;L;;;;;N;;;;; +1310E;EGYPTIAN HIEROGLYPH F015;Lo;0;L;;;;;N;;;;; +1310F;EGYPTIAN HIEROGLYPH F016;Lo;0;L;;;;;N;;;;; +13110;EGYPTIAN HIEROGLYPH F017;Lo;0;L;;;;;N;;;;; +13111;EGYPTIAN HIEROGLYPH F018;Lo;0;L;;;;;N;;;;; +13112;EGYPTIAN HIEROGLYPH F019;Lo;0;L;;;;;N;;;;; +13113;EGYPTIAN HIEROGLYPH F020;Lo;0;L;;;;;N;;;;; +13114;EGYPTIAN HIEROGLYPH F021;Lo;0;L;;;;;N;;;;; +13115;EGYPTIAN HIEROGLYPH F021A;Lo;0;L;;;;;N;;;;; +13116;EGYPTIAN HIEROGLYPH F022;Lo;0;L;;;;;N;;;;; +13117;EGYPTIAN HIEROGLYPH F023;Lo;0;L;;;;;N;;;;; +13118;EGYPTIAN HIEROGLYPH F024;Lo;0;L;;;;;N;;;;; +13119;EGYPTIAN HIEROGLYPH F025;Lo;0;L;;;;;N;;;;; +1311A;EGYPTIAN HIEROGLYPH F026;Lo;0;L;;;;;N;;;;; +1311B;EGYPTIAN HIEROGLYPH F027;Lo;0;L;;;;;N;;;;; +1311C;EGYPTIAN HIEROGLYPH F028;Lo;0;L;;;;;N;;;;; +1311D;EGYPTIAN HIEROGLYPH F029;Lo;0;L;;;;;N;;;;; +1311E;EGYPTIAN HIEROGLYPH F030;Lo;0;L;;;;;N;;;;; +1311F;EGYPTIAN HIEROGLYPH F031;Lo;0;L;;;;;N;;;;; +13120;EGYPTIAN HIEROGLYPH F031A;Lo;0;L;;;;;N;;;;; +13121;EGYPTIAN HIEROGLYPH F032;Lo;0;L;;;;;N;;;;; +13122;EGYPTIAN HIEROGLYPH F033;Lo;0;L;;;;;N;;;;; +13123;EGYPTIAN HIEROGLYPH F034;Lo;0;L;;;;;N;;;;; +13124;EGYPTIAN HIEROGLYPH F035;Lo;0;L;;;;;N;;;;; +13125;EGYPTIAN HIEROGLYPH F036;Lo;0;L;;;;;N;;;;; +13126;EGYPTIAN HIEROGLYPH F037;Lo;0;L;;;;;N;;;;; +13127;EGYPTIAN HIEROGLYPH F037A;Lo;0;L;;;;;N;;;;; +13128;EGYPTIAN HIEROGLYPH F038;Lo;0;L;;;;;N;;;;; +13129;EGYPTIAN HIEROGLYPH F038A;Lo;0;L;;;;;N;;;;; +1312A;EGYPTIAN HIEROGLYPH F039;Lo;0;L;;;;;N;;;;; +1312B;EGYPTIAN HIEROGLYPH F040;Lo;0;L;;;;;N;;;;; +1312C;EGYPTIAN HIEROGLYPH F041;Lo;0;L;;;;;N;;;;; +1312D;EGYPTIAN HIEROGLYPH F042;Lo;0;L;;;;;N;;;;; +1312E;EGYPTIAN HIEROGLYPH F043;Lo;0;L;;;;;N;;;;; +1312F;EGYPTIAN HIEROGLYPH F044;Lo;0;L;;;;;N;;;;; +13130;EGYPTIAN HIEROGLYPH F045;Lo;0;L;;;;;N;;;;; +13131;EGYPTIAN HIEROGLYPH F045A;Lo;0;L;;;;;N;;;;; +13132;EGYPTIAN HIEROGLYPH F046;Lo;0;L;;;;;N;;;;; +13133;EGYPTIAN HIEROGLYPH F046A;Lo;0;L;;;;;N;;;;; +13134;EGYPTIAN HIEROGLYPH F047;Lo;0;L;;;;;N;;;;; +13135;EGYPTIAN HIEROGLYPH F047A;Lo;0;L;;;;;N;;;;; +13136;EGYPTIAN HIEROGLYPH F048;Lo;0;L;;;;;N;;;;; +13137;EGYPTIAN HIEROGLYPH F049;Lo;0;L;;;;;N;;;;; +13138;EGYPTIAN HIEROGLYPH F050;Lo;0;L;;;;;N;;;;; +13139;EGYPTIAN HIEROGLYPH F051;Lo;0;L;;;;;N;;;;; +1313A;EGYPTIAN HIEROGLYPH F051A;Lo;0;L;;;;;N;;;;; +1313B;EGYPTIAN HIEROGLYPH F051B;Lo;0;L;;;;;N;;;;; +1313C;EGYPTIAN HIEROGLYPH F051C;Lo;0;L;;;;;N;;;;; +1313D;EGYPTIAN HIEROGLYPH F052;Lo;0;L;;;;;N;;;;; +1313E;EGYPTIAN HIEROGLYPH F053;Lo;0;L;;;;;N;;;;; +1313F;EGYPTIAN HIEROGLYPH G001;Lo;0;L;;;;;N;;;;; +13140;EGYPTIAN HIEROGLYPH G002;Lo;0;L;;;;;N;;;;; +13141;EGYPTIAN HIEROGLYPH G003;Lo;0;L;;;;;N;;;;; +13142;EGYPTIAN HIEROGLYPH G004;Lo;0;L;;;;;N;;;;; +13143;EGYPTIAN HIEROGLYPH G005;Lo;0;L;;;;;N;;;;; +13144;EGYPTIAN HIEROGLYPH G006;Lo;0;L;;;;;N;;;;; +13145;EGYPTIAN HIEROGLYPH G006A;Lo;0;L;;;;;N;;;;; +13146;EGYPTIAN HIEROGLYPH G007;Lo;0;L;;;;;N;;;;; +13147;EGYPTIAN HIEROGLYPH G007A;Lo;0;L;;;;;N;;;;; +13148;EGYPTIAN HIEROGLYPH G007B;Lo;0;L;;;;;N;;;;; +13149;EGYPTIAN HIEROGLYPH G008;Lo;0;L;;;;;N;;;;; +1314A;EGYPTIAN HIEROGLYPH G009;Lo;0;L;;;;;N;;;;; +1314B;EGYPTIAN HIEROGLYPH G010;Lo;0;L;;;;;N;;;;; +1314C;EGYPTIAN HIEROGLYPH G011;Lo;0;L;;;;;N;;;;; +1314D;EGYPTIAN HIEROGLYPH G011A;Lo;0;L;;;;;N;;;;; +1314E;EGYPTIAN HIEROGLYPH G012;Lo;0;L;;;;;N;;;;; +1314F;EGYPTIAN HIEROGLYPH G013;Lo;0;L;;;;;N;;;;; +13150;EGYPTIAN HIEROGLYPH G014;Lo;0;L;;;;;N;;;;; +13151;EGYPTIAN HIEROGLYPH G015;Lo;0;L;;;;;N;;;;; +13152;EGYPTIAN HIEROGLYPH G016;Lo;0;L;;;;;N;;;;; +13153;EGYPTIAN HIEROGLYPH G017;Lo;0;L;;;;;N;;;;; +13154;EGYPTIAN HIEROGLYPH G018;Lo;0;L;;;;;N;;;;; +13155;EGYPTIAN HIEROGLYPH G019;Lo;0;L;;;;;N;;;;; +13156;EGYPTIAN HIEROGLYPH G020;Lo;0;L;;;;;N;;;;; +13157;EGYPTIAN HIEROGLYPH G020A;Lo;0;L;;;;;N;;;;; +13158;EGYPTIAN HIEROGLYPH G021;Lo;0;L;;;;;N;;;;; +13159;EGYPTIAN HIEROGLYPH G022;Lo;0;L;;;;;N;;;;; +1315A;EGYPTIAN HIEROGLYPH G023;Lo;0;L;;;;;N;;;;; +1315B;EGYPTIAN HIEROGLYPH G024;Lo;0;L;;;;;N;;;;; +1315C;EGYPTIAN HIEROGLYPH G025;Lo;0;L;;;;;N;;;;; +1315D;EGYPTIAN HIEROGLYPH G026;Lo;0;L;;;;;N;;;;; +1315E;EGYPTIAN HIEROGLYPH G026A;Lo;0;L;;;;;N;;;;; +1315F;EGYPTIAN HIEROGLYPH G027;Lo;0;L;;;;;N;;;;; +13160;EGYPTIAN HIEROGLYPH G028;Lo;0;L;;;;;N;;;;; +13161;EGYPTIAN HIEROGLYPH G029;Lo;0;L;;;;;N;;;;; +13162;EGYPTIAN HIEROGLYPH G030;Lo;0;L;;;;;N;;;;; +13163;EGYPTIAN HIEROGLYPH G031;Lo;0;L;;;;;N;;;;; +13164;EGYPTIAN HIEROGLYPH G032;Lo;0;L;;;;;N;;;;; +13165;EGYPTIAN HIEROGLYPH G033;Lo;0;L;;;;;N;;;;; +13166;EGYPTIAN HIEROGLYPH G034;Lo;0;L;;;;;N;;;;; +13167;EGYPTIAN HIEROGLYPH G035;Lo;0;L;;;;;N;;;;; +13168;EGYPTIAN HIEROGLYPH G036;Lo;0;L;;;;;N;;;;; +13169;EGYPTIAN HIEROGLYPH G036A;Lo;0;L;;;;;N;;;;; +1316A;EGYPTIAN HIEROGLYPH G037;Lo;0;L;;;;;N;;;;; +1316B;EGYPTIAN HIEROGLYPH G037A;Lo;0;L;;;;;N;;;;; +1316C;EGYPTIAN HIEROGLYPH G038;Lo;0;L;;;;;N;;;;; +1316D;EGYPTIAN HIEROGLYPH G039;Lo;0;L;;;;;N;;;;; +1316E;EGYPTIAN HIEROGLYPH G040;Lo;0;L;;;;;N;;;;; +1316F;EGYPTIAN HIEROGLYPH G041;Lo;0;L;;;;;N;;;;; +13170;EGYPTIAN HIEROGLYPH G042;Lo;0;L;;;;;N;;;;; +13171;EGYPTIAN HIEROGLYPH G043;Lo;0;L;;;;;N;;;;; +13172;EGYPTIAN HIEROGLYPH G043A;Lo;0;L;;;;;N;;;;; +13173;EGYPTIAN HIEROGLYPH G044;Lo;0;L;;;;;N;;;;; +13174;EGYPTIAN HIEROGLYPH G045;Lo;0;L;;;;;N;;;;; +13175;EGYPTIAN HIEROGLYPH G045A;Lo;0;L;;;;;N;;;;; +13176;EGYPTIAN HIEROGLYPH G046;Lo;0;L;;;;;N;;;;; +13177;EGYPTIAN HIEROGLYPH G047;Lo;0;L;;;;;N;;;;; +13178;EGYPTIAN HIEROGLYPH G048;Lo;0;L;;;;;N;;;;; +13179;EGYPTIAN HIEROGLYPH G049;Lo;0;L;;;;;N;;;;; +1317A;EGYPTIAN HIEROGLYPH G050;Lo;0;L;;;;;N;;;;; +1317B;EGYPTIAN HIEROGLYPH G051;Lo;0;L;;;;;N;;;;; +1317C;EGYPTIAN HIEROGLYPH G052;Lo;0;L;;;;;N;;;;; +1317D;EGYPTIAN HIEROGLYPH G053;Lo;0;L;;;;;N;;;;; +1317E;EGYPTIAN HIEROGLYPH G054;Lo;0;L;;;;;N;;;;; +1317F;EGYPTIAN HIEROGLYPH H001;Lo;0;L;;;;;N;;;;; +13180;EGYPTIAN HIEROGLYPH H002;Lo;0;L;;;;;N;;;;; +13181;EGYPTIAN HIEROGLYPH H003;Lo;0;L;;;;;N;;;;; +13182;EGYPTIAN HIEROGLYPH H004;Lo;0;L;;;;;N;;;;; +13183;EGYPTIAN HIEROGLYPH H005;Lo;0;L;;;;;N;;;;; +13184;EGYPTIAN HIEROGLYPH H006;Lo;0;L;;;;;N;;;;; +13185;EGYPTIAN HIEROGLYPH H006A;Lo;0;L;;;;;N;;;;; +13186;EGYPTIAN HIEROGLYPH H007;Lo;0;L;;;;;N;;;;; +13187;EGYPTIAN HIEROGLYPH H008;Lo;0;L;;;;;N;;;;; +13188;EGYPTIAN HIEROGLYPH I001;Lo;0;L;;;;;N;;;;; +13189;EGYPTIAN HIEROGLYPH I002;Lo;0;L;;;;;N;;;;; +1318A;EGYPTIAN HIEROGLYPH I003;Lo;0;L;;;;;N;;;;; +1318B;EGYPTIAN HIEROGLYPH I004;Lo;0;L;;;;;N;;;;; +1318C;EGYPTIAN HIEROGLYPH I005;Lo;0;L;;;;;N;;;;; +1318D;EGYPTIAN HIEROGLYPH I005A;Lo;0;L;;;;;N;;;;; +1318E;EGYPTIAN HIEROGLYPH I006;Lo;0;L;;;;;N;;;;; +1318F;EGYPTIAN HIEROGLYPH I007;Lo;0;L;;;;;N;;;;; +13190;EGYPTIAN HIEROGLYPH I008;Lo;0;L;;;;;N;;;;; +13191;EGYPTIAN HIEROGLYPH I009;Lo;0;L;;;;;N;;;;; +13192;EGYPTIAN HIEROGLYPH I009A;Lo;0;L;;;;;N;;;;; +13193;EGYPTIAN HIEROGLYPH I010;Lo;0;L;;;;;N;;;;; +13194;EGYPTIAN HIEROGLYPH I010A;Lo;0;L;;;;;N;;;;; +13195;EGYPTIAN HIEROGLYPH I011;Lo;0;L;;;;;N;;;;; +13196;EGYPTIAN HIEROGLYPH I011A;Lo;0;L;;;;;N;;;;; +13197;EGYPTIAN HIEROGLYPH I012;Lo;0;L;;;;;N;;;;; +13198;EGYPTIAN HIEROGLYPH I013;Lo;0;L;;;;;N;;;;; +13199;EGYPTIAN HIEROGLYPH I014;Lo;0;L;;;;;N;;;;; +1319A;EGYPTIAN HIEROGLYPH I015;Lo;0;L;;;;;N;;;;; +1319B;EGYPTIAN HIEROGLYPH K001;Lo;0;L;;;;;N;;;;; +1319C;EGYPTIAN HIEROGLYPH K002;Lo;0;L;;;;;N;;;;; +1319D;EGYPTIAN HIEROGLYPH K003;Lo;0;L;;;;;N;;;;; +1319E;EGYPTIAN HIEROGLYPH K004;Lo;0;L;;;;;N;;;;; +1319F;EGYPTIAN HIEROGLYPH K005;Lo;0;L;;;;;N;;;;; +131A0;EGYPTIAN HIEROGLYPH K006;Lo;0;L;;;;;N;;;;; +131A1;EGYPTIAN HIEROGLYPH K007;Lo;0;L;;;;;N;;;;; +131A2;EGYPTIAN HIEROGLYPH K008;Lo;0;L;;;;;N;;;;; +131A3;EGYPTIAN HIEROGLYPH L001;Lo;0;L;;;;;N;;;;; +131A4;EGYPTIAN HIEROGLYPH L002;Lo;0;L;;;;;N;;;;; +131A5;EGYPTIAN HIEROGLYPH L002A;Lo;0;L;;;;;N;;;;; +131A6;EGYPTIAN HIEROGLYPH L003;Lo;0;L;;;;;N;;;;; +131A7;EGYPTIAN HIEROGLYPH L004;Lo;0;L;;;;;N;;;;; +131A8;EGYPTIAN HIEROGLYPH L005;Lo;0;L;;;;;N;;;;; +131A9;EGYPTIAN HIEROGLYPH L006;Lo;0;L;;;;;N;;;;; +131AA;EGYPTIAN HIEROGLYPH L006A;Lo;0;L;;;;;N;;;;; +131AB;EGYPTIAN HIEROGLYPH L007;Lo;0;L;;;;;N;;;;; +131AC;EGYPTIAN HIEROGLYPH L008;Lo;0;L;;;;;N;;;;; +131AD;EGYPTIAN HIEROGLYPH M001;Lo;0;L;;;;;N;;;;; +131AE;EGYPTIAN HIEROGLYPH M001A;Lo;0;L;;;;;N;;;;; +131AF;EGYPTIAN HIEROGLYPH M001B;Lo;0;L;;;;;N;;;;; +131B0;EGYPTIAN HIEROGLYPH M002;Lo;0;L;;;;;N;;;;; +131B1;EGYPTIAN HIEROGLYPH M003;Lo;0;L;;;;;N;;;;; +131B2;EGYPTIAN HIEROGLYPH M003A;Lo;0;L;;;;;N;;;;; +131B3;EGYPTIAN HIEROGLYPH M004;Lo;0;L;;;;;N;;;;; +131B4;EGYPTIAN HIEROGLYPH M005;Lo;0;L;;;;;N;;;;; +131B5;EGYPTIAN HIEROGLYPH M006;Lo;0;L;;;;;N;;;;; +131B6;EGYPTIAN HIEROGLYPH M007;Lo;0;L;;;;;N;;;;; +131B7;EGYPTIAN HIEROGLYPH M008;Lo;0;L;;;;;N;;;;; +131B8;EGYPTIAN HIEROGLYPH M009;Lo;0;L;;;;;N;;;;; +131B9;EGYPTIAN HIEROGLYPH M010;Lo;0;L;;;;;N;;;;; +131BA;EGYPTIAN HIEROGLYPH M010A;Lo;0;L;;;;;N;;;;; +131BB;EGYPTIAN HIEROGLYPH M011;Lo;0;L;;;;;N;;;;; +131BC;EGYPTIAN HIEROGLYPH M012;Lo;0;L;;;;;N;;;;; +131BD;EGYPTIAN HIEROGLYPH M012A;Lo;0;L;;;;;N;;;;; +131BE;EGYPTIAN HIEROGLYPH M012B;Lo;0;L;;;;;N;;;;; +131BF;EGYPTIAN HIEROGLYPH M012C;Lo;0;L;;;;;N;;;;; +131C0;EGYPTIAN HIEROGLYPH M012D;Lo;0;L;;;;;N;;;;; +131C1;EGYPTIAN HIEROGLYPH M012E;Lo;0;L;;;;;N;;;;; +131C2;EGYPTIAN HIEROGLYPH M012F;Lo;0;L;;;;;N;;;;; +131C3;EGYPTIAN HIEROGLYPH M012G;Lo;0;L;;;;;N;;;;; +131C4;EGYPTIAN HIEROGLYPH M012H;Lo;0;L;;;;;N;;;;; +131C5;EGYPTIAN HIEROGLYPH M013;Lo;0;L;;;;;N;;;;; +131C6;EGYPTIAN HIEROGLYPH M014;Lo;0;L;;;;;N;;;;; +131C7;EGYPTIAN HIEROGLYPH M015;Lo;0;L;;;;;N;;;;; +131C8;EGYPTIAN HIEROGLYPH M015A;Lo;0;L;;;;;N;;;;; +131C9;EGYPTIAN HIEROGLYPH M016;Lo;0;L;;;;;N;;;;; +131CA;EGYPTIAN HIEROGLYPH M016A;Lo;0;L;;;;;N;;;;; +131CB;EGYPTIAN HIEROGLYPH M017;Lo;0;L;;;;;N;;;;; +131CC;EGYPTIAN HIEROGLYPH M017A;Lo;0;L;;;;;N;;;;; +131CD;EGYPTIAN HIEROGLYPH M018;Lo;0;L;;;;;N;;;;; +131CE;EGYPTIAN HIEROGLYPH M019;Lo;0;L;;;;;N;;;;; +131CF;EGYPTIAN HIEROGLYPH M020;Lo;0;L;;;;;N;;;;; +131D0;EGYPTIAN HIEROGLYPH M021;Lo;0;L;;;;;N;;;;; +131D1;EGYPTIAN HIEROGLYPH M022;Lo;0;L;;;;;N;;;;; +131D2;EGYPTIAN HIEROGLYPH M022A;Lo;0;L;;;;;N;;;;; +131D3;EGYPTIAN HIEROGLYPH M023;Lo;0;L;;;;;N;;;;; +131D4;EGYPTIAN HIEROGLYPH M024;Lo;0;L;;;;;N;;;;; +131D5;EGYPTIAN HIEROGLYPH M024A;Lo;0;L;;;;;N;;;;; +131D6;EGYPTIAN HIEROGLYPH M025;Lo;0;L;;;;;N;;;;; +131D7;EGYPTIAN HIEROGLYPH M026;Lo;0;L;;;;;N;;;;; +131D8;EGYPTIAN HIEROGLYPH M027;Lo;0;L;;;;;N;;;;; +131D9;EGYPTIAN HIEROGLYPH M028;Lo;0;L;;;;;N;;;;; +131DA;EGYPTIAN HIEROGLYPH M028A;Lo;0;L;;;;;N;;;;; +131DB;EGYPTIAN HIEROGLYPH M029;Lo;0;L;;;;;N;;;;; +131DC;EGYPTIAN HIEROGLYPH M030;Lo;0;L;;;;;N;;;;; +131DD;EGYPTIAN HIEROGLYPH M031;Lo;0;L;;;;;N;;;;; +131DE;EGYPTIAN HIEROGLYPH M031A;Lo;0;L;;;;;N;;;;; +131DF;EGYPTIAN HIEROGLYPH M032;Lo;0;L;;;;;N;;;;; +131E0;EGYPTIAN HIEROGLYPH M033;Lo;0;L;;;;;N;;;;; +131E1;EGYPTIAN HIEROGLYPH M033A;Lo;0;L;;;;;N;;;;; +131E2;EGYPTIAN HIEROGLYPH M033B;Lo;0;L;;;;;N;;;;; +131E3;EGYPTIAN HIEROGLYPH M034;Lo;0;L;;;;;N;;;;; +131E4;EGYPTIAN HIEROGLYPH M035;Lo;0;L;;;;;N;;;;; +131E5;EGYPTIAN HIEROGLYPH M036;Lo;0;L;;;;;N;;;;; +131E6;EGYPTIAN HIEROGLYPH M037;Lo;0;L;;;;;N;;;;; +131E7;EGYPTIAN HIEROGLYPH M038;Lo;0;L;;;;;N;;;;; +131E8;EGYPTIAN HIEROGLYPH M039;Lo;0;L;;;;;N;;;;; +131E9;EGYPTIAN HIEROGLYPH M040;Lo;0;L;;;;;N;;;;; +131EA;EGYPTIAN HIEROGLYPH M040A;Lo;0;L;;;;;N;;;;; +131EB;EGYPTIAN HIEROGLYPH M041;Lo;0;L;;;;;N;;;;; +131EC;EGYPTIAN HIEROGLYPH M042;Lo;0;L;;;;;N;;;;; +131ED;EGYPTIAN HIEROGLYPH M043;Lo;0;L;;;;;N;;;;; +131EE;EGYPTIAN HIEROGLYPH M044;Lo;0;L;;;;;N;;;;; +131EF;EGYPTIAN HIEROGLYPH N001;Lo;0;L;;;;;N;;;;; +131F0;EGYPTIAN HIEROGLYPH N002;Lo;0;L;;;;;N;;;;; +131F1;EGYPTIAN HIEROGLYPH N003;Lo;0;L;;;;;N;;;;; +131F2;EGYPTIAN HIEROGLYPH N004;Lo;0;L;;;;;N;;;;; +131F3;EGYPTIAN HIEROGLYPH N005;Lo;0;L;;;;;N;;;;; +131F4;EGYPTIAN HIEROGLYPH N006;Lo;0;L;;;;;N;;;;; +131F5;EGYPTIAN HIEROGLYPH N007;Lo;0;L;;;;;N;;;;; +131F6;EGYPTIAN HIEROGLYPH N008;Lo;0;L;;;;;N;;;;; +131F7;EGYPTIAN HIEROGLYPH N009;Lo;0;L;;;;;N;;;;; +131F8;EGYPTIAN HIEROGLYPH N010;Lo;0;L;;;;;N;;;;; +131F9;EGYPTIAN HIEROGLYPH N011;Lo;0;L;;;;;N;;;;; +131FA;EGYPTIAN HIEROGLYPH N012;Lo;0;L;;;;;N;;;;; +131FB;EGYPTIAN HIEROGLYPH N013;Lo;0;L;;;;;N;;;;; +131FC;EGYPTIAN HIEROGLYPH N014;Lo;0;L;;;;;N;;;;; +131FD;EGYPTIAN HIEROGLYPH N015;Lo;0;L;;;;;N;;;;; +131FE;EGYPTIAN HIEROGLYPH N016;Lo;0;L;;;;;N;;;;; +131FF;EGYPTIAN HIEROGLYPH N017;Lo;0;L;;;;;N;;;;; +13200;EGYPTIAN HIEROGLYPH N018;Lo;0;L;;;;;N;;;;; +13201;EGYPTIAN HIEROGLYPH N018A;Lo;0;L;;;;;N;;;;; +13202;EGYPTIAN HIEROGLYPH N018B;Lo;0;L;;;;;N;;;;; +13203;EGYPTIAN HIEROGLYPH N019;Lo;0;L;;;;;N;;;;; +13204;EGYPTIAN HIEROGLYPH N020;Lo;0;L;;;;;N;;;;; +13205;EGYPTIAN HIEROGLYPH N021;Lo;0;L;;;;;N;;;;; +13206;EGYPTIAN HIEROGLYPH N022;Lo;0;L;;;;;N;;;;; +13207;EGYPTIAN HIEROGLYPH N023;Lo;0;L;;;;;N;;;;; +13208;EGYPTIAN HIEROGLYPH N024;Lo;0;L;;;;;N;;;;; +13209;EGYPTIAN HIEROGLYPH N025;Lo;0;L;;;;;N;;;;; +1320A;EGYPTIAN HIEROGLYPH N025A;Lo;0;L;;;;;N;;;;; +1320B;EGYPTIAN HIEROGLYPH N026;Lo;0;L;;;;;N;;;;; +1320C;EGYPTIAN HIEROGLYPH N027;Lo;0;L;;;;;N;;;;; +1320D;EGYPTIAN HIEROGLYPH N028;Lo;0;L;;;;;N;;;;; +1320E;EGYPTIAN HIEROGLYPH N029;Lo;0;L;;;;;N;;;;; +1320F;EGYPTIAN HIEROGLYPH N030;Lo;0;L;;;;;N;;;;; +13210;EGYPTIAN HIEROGLYPH N031;Lo;0;L;;;;;N;;;;; +13211;EGYPTIAN HIEROGLYPH N032;Lo;0;L;;;;;N;;;;; +13212;EGYPTIAN HIEROGLYPH N033;Lo;0;L;;;;;N;;;;; +13213;EGYPTIAN HIEROGLYPH N033A;Lo;0;L;;;;;N;;;;; +13214;EGYPTIAN HIEROGLYPH N034;Lo;0;L;;;;;N;;;;; +13215;EGYPTIAN HIEROGLYPH N034A;Lo;0;L;;;;;N;;;;; +13216;EGYPTIAN HIEROGLYPH N035;Lo;0;L;;;;;N;;;;; +13217;EGYPTIAN HIEROGLYPH N035A;Lo;0;L;;;;;N;;;;; +13218;EGYPTIAN HIEROGLYPH N036;Lo;0;L;;;;;N;;;;; +13219;EGYPTIAN HIEROGLYPH N037;Lo;0;L;;;;;N;;;;; +1321A;EGYPTIAN HIEROGLYPH N037A;Lo;0;L;;;;;N;;;;; +1321B;EGYPTIAN HIEROGLYPH N038;Lo;0;L;;;;;N;;;;; +1321C;EGYPTIAN HIEROGLYPH N039;Lo;0;L;;;;;N;;;;; +1321D;EGYPTIAN HIEROGLYPH N040;Lo;0;L;;;;;N;;;;; +1321E;EGYPTIAN HIEROGLYPH N041;Lo;0;L;;;;;N;;;;; +1321F;EGYPTIAN HIEROGLYPH N042;Lo;0;L;;;;;N;;;;; +13220;EGYPTIAN HIEROGLYPH NL001;Lo;0;L;;;;;N;;;;; +13221;EGYPTIAN HIEROGLYPH NL002;Lo;0;L;;;;;N;;;;; +13222;EGYPTIAN HIEROGLYPH NL003;Lo;0;L;;;;;N;;;;; +13223;EGYPTIAN HIEROGLYPH NL004;Lo;0;L;;;;;N;;;;; +13224;EGYPTIAN HIEROGLYPH NL005;Lo;0;L;;;;;N;;;;; +13225;EGYPTIAN HIEROGLYPH NL005A;Lo;0;L;;;;;N;;;;; +13226;EGYPTIAN HIEROGLYPH NL006;Lo;0;L;;;;;N;;;;; +13227;EGYPTIAN HIEROGLYPH NL007;Lo;0;L;;;;;N;;;;; +13228;EGYPTIAN HIEROGLYPH NL008;Lo;0;L;;;;;N;;;;; +13229;EGYPTIAN HIEROGLYPH NL009;Lo;0;L;;;;;N;;;;; +1322A;EGYPTIAN HIEROGLYPH NL010;Lo;0;L;;;;;N;;;;; +1322B;EGYPTIAN HIEROGLYPH NL011;Lo;0;L;;;;;N;;;;; +1322C;EGYPTIAN HIEROGLYPH NL012;Lo;0;L;;;;;N;;;;; +1322D;EGYPTIAN HIEROGLYPH NL013;Lo;0;L;;;;;N;;;;; +1322E;EGYPTIAN HIEROGLYPH NL014;Lo;0;L;;;;;N;;;;; +1322F;EGYPTIAN HIEROGLYPH NL015;Lo;0;L;;;;;N;;;;; +13230;EGYPTIAN HIEROGLYPH NL016;Lo;0;L;;;;;N;;;;; +13231;EGYPTIAN HIEROGLYPH NL017;Lo;0;L;;;;;N;;;;; +13232;EGYPTIAN HIEROGLYPH NL017A;Lo;0;L;;;;;N;;;;; +13233;EGYPTIAN HIEROGLYPH NL018;Lo;0;L;;;;;N;;;;; +13234;EGYPTIAN HIEROGLYPH NL019;Lo;0;L;;;;;N;;;;; +13235;EGYPTIAN HIEROGLYPH NL020;Lo;0;L;;;;;N;;;;; +13236;EGYPTIAN HIEROGLYPH NU001;Lo;0;L;;;;;N;;;;; +13237;EGYPTIAN HIEROGLYPH NU002;Lo;0;L;;;;;N;;;;; +13238;EGYPTIAN HIEROGLYPH NU003;Lo;0;L;;;;;N;;;;; +13239;EGYPTIAN HIEROGLYPH NU004;Lo;0;L;;;;;N;;;;; +1323A;EGYPTIAN HIEROGLYPH NU005;Lo;0;L;;;;;N;;;;; +1323B;EGYPTIAN HIEROGLYPH NU006;Lo;0;L;;;;;N;;;;; +1323C;EGYPTIAN HIEROGLYPH NU007;Lo;0;L;;;;;N;;;;; +1323D;EGYPTIAN HIEROGLYPH NU008;Lo;0;L;;;;;N;;;;; +1323E;EGYPTIAN HIEROGLYPH NU009;Lo;0;L;;;;;N;;;;; +1323F;EGYPTIAN HIEROGLYPH NU010;Lo;0;L;;;;;N;;;;; +13240;EGYPTIAN HIEROGLYPH NU010A;Lo;0;L;;;;;N;;;;; +13241;EGYPTIAN HIEROGLYPH NU011;Lo;0;L;;;;;N;;;;; +13242;EGYPTIAN HIEROGLYPH NU011A;Lo;0;L;;;;;N;;;;; +13243;EGYPTIAN HIEROGLYPH NU012;Lo;0;L;;;;;N;;;;; +13244;EGYPTIAN HIEROGLYPH NU013;Lo;0;L;;;;;N;;;;; +13245;EGYPTIAN HIEROGLYPH NU014;Lo;0;L;;;;;N;;;;; +13246;EGYPTIAN HIEROGLYPH NU015;Lo;0;L;;;;;N;;;;; +13247;EGYPTIAN HIEROGLYPH NU016;Lo;0;L;;;;;N;;;;; +13248;EGYPTIAN HIEROGLYPH NU017;Lo;0;L;;;;;N;;;;; +13249;EGYPTIAN HIEROGLYPH NU018;Lo;0;L;;;;;N;;;;; +1324A;EGYPTIAN HIEROGLYPH NU018A;Lo;0;L;;;;;N;;;;; +1324B;EGYPTIAN HIEROGLYPH NU019;Lo;0;L;;;;;N;;;;; +1324C;EGYPTIAN HIEROGLYPH NU020;Lo;0;L;;;;;N;;;;; +1324D;EGYPTIAN HIEROGLYPH NU021;Lo;0;L;;;;;N;;;;; +1324E;EGYPTIAN HIEROGLYPH NU022;Lo;0;L;;;;;N;;;;; +1324F;EGYPTIAN HIEROGLYPH NU022A;Lo;0;L;;;;;N;;;;; +13250;EGYPTIAN HIEROGLYPH O001;Lo;0;L;;;;;N;;;;; +13251;EGYPTIAN HIEROGLYPH O001A;Lo;0;L;;;;;N;;;;; +13252;EGYPTIAN HIEROGLYPH O002;Lo;0;L;;;;;N;;;;; +13253;EGYPTIAN HIEROGLYPH O003;Lo;0;L;;;;;N;;;;; +13254;EGYPTIAN HIEROGLYPH O004;Lo;0;L;;;;;N;;;;; +13255;EGYPTIAN HIEROGLYPH O005;Lo;0;L;;;;;N;;;;; +13256;EGYPTIAN HIEROGLYPH O005A;Lo;0;L;;;;;N;;;;; +13257;EGYPTIAN HIEROGLYPH O006;Lo;0;L;;;;;N;;;;; +13258;EGYPTIAN HIEROGLYPH O006A;Lo;0;L;;;;;N;;;;; +13259;EGYPTIAN HIEROGLYPH O006B;Lo;0;L;;;;;N;;;;; +1325A;EGYPTIAN HIEROGLYPH O006C;Lo;0;L;;;;;N;;;;; +1325B;EGYPTIAN HIEROGLYPH O006D;Lo;0;L;;;;;N;;;;; +1325C;EGYPTIAN HIEROGLYPH O006E;Lo;0;L;;;;;N;;;;; +1325D;EGYPTIAN HIEROGLYPH O006F;Lo;0;L;;;;;N;;;;; +1325E;EGYPTIAN HIEROGLYPH O007;Lo;0;L;;;;;N;;;;; +1325F;EGYPTIAN HIEROGLYPH O008;Lo;0;L;;;;;N;;;;; +13260;EGYPTIAN HIEROGLYPH O009;Lo;0;L;;;;;N;;;;; +13261;EGYPTIAN HIEROGLYPH O010;Lo;0;L;;;;;N;;;;; +13262;EGYPTIAN HIEROGLYPH O010A;Lo;0;L;;;;;N;;;;; +13263;EGYPTIAN HIEROGLYPH O010B;Lo;0;L;;;;;N;;;;; +13264;EGYPTIAN HIEROGLYPH O010C;Lo;0;L;;;;;N;;;;; +13265;EGYPTIAN HIEROGLYPH O011;Lo;0;L;;;;;N;;;;; +13266;EGYPTIAN HIEROGLYPH O012;Lo;0;L;;;;;N;;;;; +13267;EGYPTIAN HIEROGLYPH O013;Lo;0;L;;;;;N;;;;; +13268;EGYPTIAN HIEROGLYPH O014;Lo;0;L;;;;;N;;;;; +13269;EGYPTIAN HIEROGLYPH O015;Lo;0;L;;;;;N;;;;; +1326A;EGYPTIAN HIEROGLYPH O016;Lo;0;L;;;;;N;;;;; +1326B;EGYPTIAN HIEROGLYPH O017;Lo;0;L;;;;;N;;;;; +1326C;EGYPTIAN HIEROGLYPH O018;Lo;0;L;;;;;N;;;;; +1326D;EGYPTIAN HIEROGLYPH O019;Lo;0;L;;;;;N;;;;; +1326E;EGYPTIAN HIEROGLYPH O019A;Lo;0;L;;;;;N;;;;; +1326F;EGYPTIAN HIEROGLYPH O020;Lo;0;L;;;;;N;;;;; +13270;EGYPTIAN HIEROGLYPH O020A;Lo;0;L;;;;;N;;;;; +13271;EGYPTIAN HIEROGLYPH O021;Lo;0;L;;;;;N;;;;; +13272;EGYPTIAN HIEROGLYPH O022;Lo;0;L;;;;;N;;;;; +13273;EGYPTIAN HIEROGLYPH O023;Lo;0;L;;;;;N;;;;; +13274;EGYPTIAN HIEROGLYPH O024;Lo;0;L;;;;;N;;;;; +13275;EGYPTIAN HIEROGLYPH O024A;Lo;0;L;;;;;N;;;;; +13276;EGYPTIAN HIEROGLYPH O025;Lo;0;L;;;;;N;;;;; +13277;EGYPTIAN HIEROGLYPH O025A;Lo;0;L;;;;;N;;;;; +13278;EGYPTIAN HIEROGLYPH O026;Lo;0;L;;;;;N;;;;; +13279;EGYPTIAN HIEROGLYPH O027;Lo;0;L;;;;;N;;;;; +1327A;EGYPTIAN HIEROGLYPH O028;Lo;0;L;;;;;N;;;;; +1327B;EGYPTIAN HIEROGLYPH O029;Lo;0;L;;;;;N;;;;; +1327C;EGYPTIAN HIEROGLYPH O029A;Lo;0;L;;;;;N;;;;; +1327D;EGYPTIAN HIEROGLYPH O030;Lo;0;L;;;;;N;;;;; +1327E;EGYPTIAN HIEROGLYPH O030A;Lo;0;L;;;;;N;;;;; +1327F;EGYPTIAN HIEROGLYPH O031;Lo;0;L;;;;;N;;;;; +13280;EGYPTIAN HIEROGLYPH O032;Lo;0;L;;;;;N;;;;; +13281;EGYPTIAN HIEROGLYPH O033;Lo;0;L;;;;;N;;;;; +13282;EGYPTIAN HIEROGLYPH O033A;Lo;0;L;;;;;N;;;;; +13283;EGYPTIAN HIEROGLYPH O034;Lo;0;L;;;;;N;;;;; +13284;EGYPTIAN HIEROGLYPH O035;Lo;0;L;;;;;N;;;;; +13285;EGYPTIAN HIEROGLYPH O036;Lo;0;L;;;;;N;;;;; +13286;EGYPTIAN HIEROGLYPH O036A;Lo;0;L;;;;;N;;;;; +13287;EGYPTIAN HIEROGLYPH O036B;Lo;0;L;;;;;N;;;;; +13288;EGYPTIAN HIEROGLYPH O036C;Lo;0;L;;;;;N;;;;; +13289;EGYPTIAN HIEROGLYPH O036D;Lo;0;L;;;;;N;;;;; +1328A;EGYPTIAN HIEROGLYPH O037;Lo;0;L;;;;;N;;;;; +1328B;EGYPTIAN HIEROGLYPH O038;Lo;0;L;;;;;N;;;;; +1328C;EGYPTIAN HIEROGLYPH O039;Lo;0;L;;;;;N;;;;; +1328D;EGYPTIAN HIEROGLYPH O040;Lo;0;L;;;;;N;;;;; +1328E;EGYPTIAN HIEROGLYPH O041;Lo;0;L;;;;;N;;;;; +1328F;EGYPTIAN HIEROGLYPH O042;Lo;0;L;;;;;N;;;;; +13290;EGYPTIAN HIEROGLYPH O043;Lo;0;L;;;;;N;;;;; +13291;EGYPTIAN HIEROGLYPH O044;Lo;0;L;;;;;N;;;;; +13292;EGYPTIAN HIEROGLYPH O045;Lo;0;L;;;;;N;;;;; +13293;EGYPTIAN HIEROGLYPH O046;Lo;0;L;;;;;N;;;;; +13294;EGYPTIAN HIEROGLYPH O047;Lo;0;L;;;;;N;;;;; +13295;EGYPTIAN HIEROGLYPH O048;Lo;0;L;;;;;N;;;;; +13296;EGYPTIAN HIEROGLYPH O049;Lo;0;L;;;;;N;;;;; +13297;EGYPTIAN HIEROGLYPH O050;Lo;0;L;;;;;N;;;;; +13298;EGYPTIAN HIEROGLYPH O050A;Lo;0;L;;;;;N;;;;; +13299;EGYPTIAN HIEROGLYPH O050B;Lo;0;L;;;;;N;;;;; +1329A;EGYPTIAN HIEROGLYPH O051;Lo;0;L;;;;;N;;;;; +1329B;EGYPTIAN HIEROGLYPH P001;Lo;0;L;;;;;N;;;;; +1329C;EGYPTIAN HIEROGLYPH P001A;Lo;0;L;;;;;N;;;;; +1329D;EGYPTIAN HIEROGLYPH P002;Lo;0;L;;;;;N;;;;; +1329E;EGYPTIAN HIEROGLYPH P003;Lo;0;L;;;;;N;;;;; +1329F;EGYPTIAN HIEROGLYPH P003A;Lo;0;L;;;;;N;;;;; +132A0;EGYPTIAN HIEROGLYPH P004;Lo;0;L;;;;;N;;;;; +132A1;EGYPTIAN HIEROGLYPH P005;Lo;0;L;;;;;N;;;;; +132A2;EGYPTIAN HIEROGLYPH P006;Lo;0;L;;;;;N;;;;; +132A3;EGYPTIAN HIEROGLYPH P007;Lo;0;L;;;;;N;;;;; +132A4;EGYPTIAN HIEROGLYPH P008;Lo;0;L;;;;;N;;;;; +132A5;EGYPTIAN HIEROGLYPH P009;Lo;0;L;;;;;N;;;;; +132A6;EGYPTIAN HIEROGLYPH P010;Lo;0;L;;;;;N;;;;; +132A7;EGYPTIAN HIEROGLYPH P011;Lo;0;L;;;;;N;;;;; +132A8;EGYPTIAN HIEROGLYPH Q001;Lo;0;L;;;;;N;;;;; +132A9;EGYPTIAN HIEROGLYPH Q002;Lo;0;L;;;;;N;;;;; +132AA;EGYPTIAN HIEROGLYPH Q003;Lo;0;L;;;;;N;;;;; +132AB;EGYPTIAN HIEROGLYPH Q004;Lo;0;L;;;;;N;;;;; +132AC;EGYPTIAN HIEROGLYPH Q005;Lo;0;L;;;;;N;;;;; +132AD;EGYPTIAN HIEROGLYPH Q006;Lo;0;L;;;;;N;;;;; +132AE;EGYPTIAN HIEROGLYPH Q007;Lo;0;L;;;;;N;;;;; +132AF;EGYPTIAN HIEROGLYPH R001;Lo;0;L;;;;;N;;;;; +132B0;EGYPTIAN HIEROGLYPH R002;Lo;0;L;;;;;N;;;;; +132B1;EGYPTIAN HIEROGLYPH R002A;Lo;0;L;;;;;N;;;;; +132B2;EGYPTIAN HIEROGLYPH R003;Lo;0;L;;;;;N;;;;; +132B3;EGYPTIAN HIEROGLYPH R003A;Lo;0;L;;;;;N;;;;; +132B4;EGYPTIAN HIEROGLYPH R003B;Lo;0;L;;;;;N;;;;; +132B5;EGYPTIAN HIEROGLYPH R004;Lo;0;L;;;;;N;;;;; +132B6;EGYPTIAN HIEROGLYPH R005;Lo;0;L;;;;;N;;;;; +132B7;EGYPTIAN HIEROGLYPH R006;Lo;0;L;;;;;N;;;;; +132B8;EGYPTIAN HIEROGLYPH R007;Lo;0;L;;;;;N;;;;; +132B9;EGYPTIAN HIEROGLYPH R008;Lo;0;L;;;;;N;;;;; +132BA;EGYPTIAN HIEROGLYPH R009;Lo;0;L;;;;;N;;;;; +132BB;EGYPTIAN HIEROGLYPH R010;Lo;0;L;;;;;N;;;;; +132BC;EGYPTIAN HIEROGLYPH R010A;Lo;0;L;;;;;N;;;;; +132BD;EGYPTIAN HIEROGLYPH R011;Lo;0;L;;;;;N;;;;; +132BE;EGYPTIAN HIEROGLYPH R012;Lo;0;L;;;;;N;;;;; +132BF;EGYPTIAN HIEROGLYPH R013;Lo;0;L;;;;;N;;;;; +132C0;EGYPTIAN HIEROGLYPH R014;Lo;0;L;;;;;N;;;;; +132C1;EGYPTIAN HIEROGLYPH R015;Lo;0;L;;;;;N;;;;; +132C2;EGYPTIAN HIEROGLYPH R016;Lo;0;L;;;;;N;;;;; +132C3;EGYPTIAN HIEROGLYPH R016A;Lo;0;L;;;;;N;;;;; +132C4;EGYPTIAN HIEROGLYPH R017;Lo;0;L;;;;;N;;;;; +132C5;EGYPTIAN HIEROGLYPH R018;Lo;0;L;;;;;N;;;;; +132C6;EGYPTIAN HIEROGLYPH R019;Lo;0;L;;;;;N;;;;; +132C7;EGYPTIAN HIEROGLYPH R020;Lo;0;L;;;;;N;;;;; +132C8;EGYPTIAN HIEROGLYPH R021;Lo;0;L;;;;;N;;;;; +132C9;EGYPTIAN HIEROGLYPH R022;Lo;0;L;;;;;N;;;;; +132CA;EGYPTIAN HIEROGLYPH R023;Lo;0;L;;;;;N;;;;; +132CB;EGYPTIAN HIEROGLYPH R024;Lo;0;L;;;;;N;;;;; +132CC;EGYPTIAN HIEROGLYPH R025;Lo;0;L;;;;;N;;;;; +132CD;EGYPTIAN HIEROGLYPH R026;Lo;0;L;;;;;N;;;;; +132CE;EGYPTIAN HIEROGLYPH R027;Lo;0;L;;;;;N;;;;; +132CF;EGYPTIAN HIEROGLYPH R028;Lo;0;L;;;;;N;;;;; +132D0;EGYPTIAN HIEROGLYPH R029;Lo;0;L;;;;;N;;;;; +132D1;EGYPTIAN HIEROGLYPH S001;Lo;0;L;;;;;N;;;;; +132D2;EGYPTIAN HIEROGLYPH S002;Lo;0;L;;;;;N;;;;; +132D3;EGYPTIAN HIEROGLYPH S002A;Lo;0;L;;;;;N;;;;; +132D4;EGYPTIAN HIEROGLYPH S003;Lo;0;L;;;;;N;;;;; +132D5;EGYPTIAN HIEROGLYPH S004;Lo;0;L;;;;;N;;;;; +132D6;EGYPTIAN HIEROGLYPH S005;Lo;0;L;;;;;N;;;;; +132D7;EGYPTIAN HIEROGLYPH S006;Lo;0;L;;;;;N;;;;; +132D8;EGYPTIAN HIEROGLYPH S006A;Lo;0;L;;;;;N;;;;; +132D9;EGYPTIAN HIEROGLYPH S007;Lo;0;L;;;;;N;;;;; +132DA;EGYPTIAN HIEROGLYPH S008;Lo;0;L;;;;;N;;;;; +132DB;EGYPTIAN HIEROGLYPH S009;Lo;0;L;;;;;N;;;;; +132DC;EGYPTIAN HIEROGLYPH S010;Lo;0;L;;;;;N;;;;; +132DD;EGYPTIAN HIEROGLYPH S011;Lo;0;L;;;;;N;;;;; +132DE;EGYPTIAN HIEROGLYPH S012;Lo;0;L;;;;;N;;;;; +132DF;EGYPTIAN HIEROGLYPH S013;Lo;0;L;;;;;N;;;;; +132E0;EGYPTIAN HIEROGLYPH S014;Lo;0;L;;;;;N;;;;; +132E1;EGYPTIAN HIEROGLYPH S014A;Lo;0;L;;;;;N;;;;; +132E2;EGYPTIAN HIEROGLYPH S014B;Lo;0;L;;;;;N;;;;; +132E3;EGYPTIAN HIEROGLYPH S015;Lo;0;L;;;;;N;;;;; +132E4;EGYPTIAN HIEROGLYPH S016;Lo;0;L;;;;;N;;;;; +132E5;EGYPTIAN HIEROGLYPH S017;Lo;0;L;;;;;N;;;;; +132E6;EGYPTIAN HIEROGLYPH S017A;Lo;0;L;;;;;N;;;;; +132E7;EGYPTIAN HIEROGLYPH S018;Lo;0;L;;;;;N;;;;; +132E8;EGYPTIAN HIEROGLYPH S019;Lo;0;L;;;;;N;;;;; +132E9;EGYPTIAN HIEROGLYPH S020;Lo;0;L;;;;;N;;;;; +132EA;EGYPTIAN HIEROGLYPH S021;Lo;0;L;;;;;N;;;;; +132EB;EGYPTIAN HIEROGLYPH S022;Lo;0;L;;;;;N;;;;; +132EC;EGYPTIAN HIEROGLYPH S023;Lo;0;L;;;;;N;;;;; +132ED;EGYPTIAN HIEROGLYPH S024;Lo;0;L;;;;;N;;;;; +132EE;EGYPTIAN HIEROGLYPH S025;Lo;0;L;;;;;N;;;;; +132EF;EGYPTIAN HIEROGLYPH S026;Lo;0;L;;;;;N;;;;; +132F0;EGYPTIAN HIEROGLYPH S026A;Lo;0;L;;;;;N;;;;; +132F1;EGYPTIAN HIEROGLYPH S026B;Lo;0;L;;;;;N;;;;; +132F2;EGYPTIAN HIEROGLYPH S027;Lo;0;L;;;;;N;;;;; +132F3;EGYPTIAN HIEROGLYPH S028;Lo;0;L;;;;;N;;;;; +132F4;EGYPTIAN HIEROGLYPH S029;Lo;0;L;;;;;N;;;;; +132F5;EGYPTIAN HIEROGLYPH S030;Lo;0;L;;;;;N;;;;; +132F6;EGYPTIAN HIEROGLYPH S031;Lo;0;L;;;;;N;;;;; +132F7;EGYPTIAN HIEROGLYPH S032;Lo;0;L;;;;;N;;;;; +132F8;EGYPTIAN HIEROGLYPH S033;Lo;0;L;;;;;N;;;;; +132F9;EGYPTIAN HIEROGLYPH S034;Lo;0;L;;;;;N;;;;; +132FA;EGYPTIAN HIEROGLYPH S035;Lo;0;L;;;;;N;;;;; +132FB;EGYPTIAN HIEROGLYPH S035A;Lo;0;L;;;;;N;;;;; +132FC;EGYPTIAN HIEROGLYPH S036;Lo;0;L;;;;;N;;;;; +132FD;EGYPTIAN HIEROGLYPH S037;Lo;0;L;;;;;N;;;;; +132FE;EGYPTIAN HIEROGLYPH S038;Lo;0;L;;;;;N;;;;; +132FF;EGYPTIAN HIEROGLYPH S039;Lo;0;L;;;;;N;;;;; +13300;EGYPTIAN HIEROGLYPH S040;Lo;0;L;;;;;N;;;;; +13301;EGYPTIAN HIEROGLYPH S041;Lo;0;L;;;;;N;;;;; +13302;EGYPTIAN HIEROGLYPH S042;Lo;0;L;;;;;N;;;;; +13303;EGYPTIAN HIEROGLYPH S043;Lo;0;L;;;;;N;;;;; +13304;EGYPTIAN HIEROGLYPH S044;Lo;0;L;;;;;N;;;;; +13305;EGYPTIAN HIEROGLYPH S045;Lo;0;L;;;;;N;;;;; +13306;EGYPTIAN HIEROGLYPH S046;Lo;0;L;;;;;N;;;;; +13307;EGYPTIAN HIEROGLYPH T001;Lo;0;L;;;;;N;;;;; +13308;EGYPTIAN HIEROGLYPH T002;Lo;0;L;;;;;N;;;;; +13309;EGYPTIAN HIEROGLYPH T003;Lo;0;L;;;;;N;;;;; +1330A;EGYPTIAN HIEROGLYPH T003A;Lo;0;L;;;;;N;;;;; +1330B;EGYPTIAN HIEROGLYPH T004;Lo;0;L;;;;;N;;;;; +1330C;EGYPTIAN HIEROGLYPH T005;Lo;0;L;;;;;N;;;;; +1330D;EGYPTIAN HIEROGLYPH T006;Lo;0;L;;;;;N;;;;; +1330E;EGYPTIAN HIEROGLYPH T007;Lo;0;L;;;;;N;;;;; +1330F;EGYPTIAN HIEROGLYPH T007A;Lo;0;L;;;;;N;;;;; +13310;EGYPTIAN HIEROGLYPH T008;Lo;0;L;;;;;N;;;;; +13311;EGYPTIAN HIEROGLYPH T008A;Lo;0;L;;;;;N;;;;; +13312;EGYPTIAN HIEROGLYPH T009;Lo;0;L;;;;;N;;;;; +13313;EGYPTIAN HIEROGLYPH T009A;Lo;0;L;;;;;N;;;;; +13314;EGYPTIAN HIEROGLYPH T010;Lo;0;L;;;;;N;;;;; +13315;EGYPTIAN HIEROGLYPH T011;Lo;0;L;;;;;N;;;;; +13316;EGYPTIAN HIEROGLYPH T011A;Lo;0;L;;;;;N;;;;; +13317;EGYPTIAN HIEROGLYPH T012;Lo;0;L;;;;;N;;;;; +13318;EGYPTIAN HIEROGLYPH T013;Lo;0;L;;;;;N;;;;; +13319;EGYPTIAN HIEROGLYPH T014;Lo;0;L;;;;;N;;;;; +1331A;EGYPTIAN HIEROGLYPH T015;Lo;0;L;;;;;N;;;;; +1331B;EGYPTIAN HIEROGLYPH T016;Lo;0;L;;;;;N;;;;; +1331C;EGYPTIAN HIEROGLYPH T016A;Lo;0;L;;;;;N;;;;; +1331D;EGYPTIAN HIEROGLYPH T017;Lo;0;L;;;;;N;;;;; +1331E;EGYPTIAN HIEROGLYPH T018;Lo;0;L;;;;;N;;;;; +1331F;EGYPTIAN HIEROGLYPH T019;Lo;0;L;;;;;N;;;;; +13320;EGYPTIAN HIEROGLYPH T020;Lo;0;L;;;;;N;;;;; +13321;EGYPTIAN HIEROGLYPH T021;Lo;0;L;;;;;N;;;;; +13322;EGYPTIAN HIEROGLYPH T022;Lo;0;L;;;;;N;;;;; +13323;EGYPTIAN HIEROGLYPH T023;Lo;0;L;;;;;N;;;;; +13324;EGYPTIAN HIEROGLYPH T024;Lo;0;L;;;;;N;;;;; +13325;EGYPTIAN HIEROGLYPH T025;Lo;0;L;;;;;N;;;;; +13326;EGYPTIAN HIEROGLYPH T026;Lo;0;L;;;;;N;;;;; +13327;EGYPTIAN HIEROGLYPH T027;Lo;0;L;;;;;N;;;;; +13328;EGYPTIAN HIEROGLYPH T028;Lo;0;L;;;;;N;;;;; +13329;EGYPTIAN HIEROGLYPH T029;Lo;0;L;;;;;N;;;;; +1332A;EGYPTIAN HIEROGLYPH T030;Lo;0;L;;;;;N;;;;; +1332B;EGYPTIAN HIEROGLYPH T031;Lo;0;L;;;;;N;;;;; +1332C;EGYPTIAN HIEROGLYPH T032;Lo;0;L;;;;;N;;;;; +1332D;EGYPTIAN HIEROGLYPH T032A;Lo;0;L;;;;;N;;;;; +1332E;EGYPTIAN HIEROGLYPH T033;Lo;0;L;;;;;N;;;;; +1332F;EGYPTIAN HIEROGLYPH T033A;Lo;0;L;;;;;N;;;;; +13330;EGYPTIAN HIEROGLYPH T034;Lo;0;L;;;;;N;;;;; +13331;EGYPTIAN HIEROGLYPH T035;Lo;0;L;;;;;N;;;;; +13332;EGYPTIAN HIEROGLYPH T036;Lo;0;L;;;;;N;;;;; +13333;EGYPTIAN HIEROGLYPH U001;Lo;0;L;;;;;N;;;;; +13334;EGYPTIAN HIEROGLYPH U002;Lo;0;L;;;;;N;;;;; +13335;EGYPTIAN HIEROGLYPH U003;Lo;0;L;;;;;N;;;;; +13336;EGYPTIAN HIEROGLYPH U004;Lo;0;L;;;;;N;;;;; +13337;EGYPTIAN HIEROGLYPH U005;Lo;0;L;;;;;N;;;;; +13338;EGYPTIAN HIEROGLYPH U006;Lo;0;L;;;;;N;;;;; +13339;EGYPTIAN HIEROGLYPH U006A;Lo;0;L;;;;;N;;;;; +1333A;EGYPTIAN HIEROGLYPH U006B;Lo;0;L;;;;;N;;;;; +1333B;EGYPTIAN HIEROGLYPH U007;Lo;0;L;;;;;N;;;;; +1333C;EGYPTIAN HIEROGLYPH U008;Lo;0;L;;;;;N;;;;; +1333D;EGYPTIAN HIEROGLYPH U009;Lo;0;L;;;;;N;;;;; +1333E;EGYPTIAN HIEROGLYPH U010;Lo;0;L;;;;;N;;;;; +1333F;EGYPTIAN HIEROGLYPH U011;Lo;0;L;;;;;N;;;;; +13340;EGYPTIAN HIEROGLYPH U012;Lo;0;L;;;;;N;;;;; +13341;EGYPTIAN HIEROGLYPH U013;Lo;0;L;;;;;N;;;;; +13342;EGYPTIAN HIEROGLYPH U014;Lo;0;L;;;;;N;;;;; +13343;EGYPTIAN HIEROGLYPH U015;Lo;0;L;;;;;N;;;;; +13344;EGYPTIAN HIEROGLYPH U016;Lo;0;L;;;;;N;;;;; +13345;EGYPTIAN HIEROGLYPH U017;Lo;0;L;;;;;N;;;;; +13346;EGYPTIAN HIEROGLYPH U018;Lo;0;L;;;;;N;;;;; +13347;EGYPTIAN HIEROGLYPH U019;Lo;0;L;;;;;N;;;;; +13348;EGYPTIAN HIEROGLYPH U020;Lo;0;L;;;;;N;;;;; +13349;EGYPTIAN HIEROGLYPH U021;Lo;0;L;;;;;N;;;;; +1334A;EGYPTIAN HIEROGLYPH U022;Lo;0;L;;;;;N;;;;; +1334B;EGYPTIAN HIEROGLYPH U023;Lo;0;L;;;;;N;;;;; +1334C;EGYPTIAN HIEROGLYPH U023A;Lo;0;L;;;;;N;;;;; +1334D;EGYPTIAN HIEROGLYPH U024;Lo;0;L;;;;;N;;;;; +1334E;EGYPTIAN HIEROGLYPH U025;Lo;0;L;;;;;N;;;;; +1334F;EGYPTIAN HIEROGLYPH U026;Lo;0;L;;;;;N;;;;; +13350;EGYPTIAN HIEROGLYPH U027;Lo;0;L;;;;;N;;;;; +13351;EGYPTIAN HIEROGLYPH U028;Lo;0;L;;;;;N;;;;; +13352;EGYPTIAN HIEROGLYPH U029;Lo;0;L;;;;;N;;;;; +13353;EGYPTIAN HIEROGLYPH U029A;Lo;0;L;;;;;N;;;;; +13354;EGYPTIAN HIEROGLYPH U030;Lo;0;L;;;;;N;;;;; +13355;EGYPTIAN HIEROGLYPH U031;Lo;0;L;;;;;N;;;;; +13356;EGYPTIAN HIEROGLYPH U032;Lo;0;L;;;;;N;;;;; +13357;EGYPTIAN HIEROGLYPH U032A;Lo;0;L;;;;;N;;;;; +13358;EGYPTIAN HIEROGLYPH U033;Lo;0;L;;;;;N;;;;; +13359;EGYPTIAN HIEROGLYPH U034;Lo;0;L;;;;;N;;;;; +1335A;EGYPTIAN HIEROGLYPH U035;Lo;0;L;;;;;N;;;;; +1335B;EGYPTIAN HIEROGLYPH U036;Lo;0;L;;;;;N;;;;; +1335C;EGYPTIAN HIEROGLYPH U037;Lo;0;L;;;;;N;;;;; +1335D;EGYPTIAN HIEROGLYPH U038;Lo;0;L;;;;;N;;;;; +1335E;EGYPTIAN HIEROGLYPH U039;Lo;0;L;;;;;N;;;;; +1335F;EGYPTIAN HIEROGLYPH U040;Lo;0;L;;;;;N;;;;; +13360;EGYPTIAN HIEROGLYPH U041;Lo;0;L;;;;;N;;;;; +13361;EGYPTIAN HIEROGLYPH U042;Lo;0;L;;;;;N;;;;; +13362;EGYPTIAN HIEROGLYPH V001;Lo;0;L;;;;;N;;;;; +13363;EGYPTIAN HIEROGLYPH V001A;Lo;0;L;;;;;N;;;;; +13364;EGYPTIAN HIEROGLYPH V001B;Lo;0;L;;;;;N;;;;; +13365;EGYPTIAN HIEROGLYPH V001C;Lo;0;L;;;;;N;;;;; +13366;EGYPTIAN HIEROGLYPH V001D;Lo;0;L;;;;;N;;;;; +13367;EGYPTIAN HIEROGLYPH V001E;Lo;0;L;;;;;N;;;;; +13368;EGYPTIAN HIEROGLYPH V001F;Lo;0;L;;;;;N;;;;; +13369;EGYPTIAN HIEROGLYPH V001G;Lo;0;L;;;;;N;;;;; +1336A;EGYPTIAN HIEROGLYPH V001H;Lo;0;L;;;;;N;;;;; +1336B;EGYPTIAN HIEROGLYPH V001I;Lo;0;L;;;;;N;;;;; +1336C;EGYPTIAN HIEROGLYPH V002;Lo;0;L;;;;;N;;;;; +1336D;EGYPTIAN HIEROGLYPH V002A;Lo;0;L;;;;;N;;;;; +1336E;EGYPTIAN HIEROGLYPH V003;Lo;0;L;;;;;N;;;;; +1336F;EGYPTIAN HIEROGLYPH V004;Lo;0;L;;;;;N;;;;; +13370;EGYPTIAN HIEROGLYPH V005;Lo;0;L;;;;;N;;;;; +13371;EGYPTIAN HIEROGLYPH V006;Lo;0;L;;;;;N;;;;; +13372;EGYPTIAN HIEROGLYPH V007;Lo;0;L;;;;;N;;;;; +13373;EGYPTIAN HIEROGLYPH V007A;Lo;0;L;;;;;N;;;;; +13374;EGYPTIAN HIEROGLYPH V007B;Lo;0;L;;;;;N;;;;; +13375;EGYPTIAN HIEROGLYPH V008;Lo;0;L;;;;;N;;;;; +13376;EGYPTIAN HIEROGLYPH V009;Lo;0;L;;;;;N;;;;; +13377;EGYPTIAN HIEROGLYPH V010;Lo;0;L;;;;;N;;;;; +13378;EGYPTIAN HIEROGLYPH V011;Lo;0;L;;;;;N;;;;; +13379;EGYPTIAN HIEROGLYPH V011A;Lo;0;L;;;;;N;;;;; +1337A;EGYPTIAN HIEROGLYPH V011B;Lo;0;L;;;;;N;;;;; +1337B;EGYPTIAN HIEROGLYPH V011C;Lo;0;L;;;;;N;;;;; +1337C;EGYPTIAN HIEROGLYPH V012;Lo;0;L;;;;;N;;;;; +1337D;EGYPTIAN HIEROGLYPH V012A;Lo;0;L;;;;;N;;;;; +1337E;EGYPTIAN HIEROGLYPH V012B;Lo;0;L;;;;;N;;;;; +1337F;EGYPTIAN HIEROGLYPH V013;Lo;0;L;;;;;N;;;;; +13380;EGYPTIAN HIEROGLYPH V014;Lo;0;L;;;;;N;;;;; +13381;EGYPTIAN HIEROGLYPH V015;Lo;0;L;;;;;N;;;;; +13382;EGYPTIAN HIEROGLYPH V016;Lo;0;L;;;;;N;;;;; +13383;EGYPTIAN HIEROGLYPH V017;Lo;0;L;;;;;N;;;;; +13384;EGYPTIAN HIEROGLYPH V018;Lo;0;L;;;;;N;;;;; +13385;EGYPTIAN HIEROGLYPH V019;Lo;0;L;;;;;N;;;;; +13386;EGYPTIAN HIEROGLYPH V020;Lo;0;L;;;;;N;;;;; +13387;EGYPTIAN HIEROGLYPH V020A;Lo;0;L;;;;;N;;;;; +13388;EGYPTIAN HIEROGLYPH V020B;Lo;0;L;;;;;N;;;;; +13389;EGYPTIAN HIEROGLYPH V020C;Lo;0;L;;;;;N;;;;; +1338A;EGYPTIAN HIEROGLYPH V020D;Lo;0;L;;;;;N;;;;; +1338B;EGYPTIAN HIEROGLYPH V020E;Lo;0;L;;;;;N;;;;; +1338C;EGYPTIAN HIEROGLYPH V020F;Lo;0;L;;;;;N;;;;; +1338D;EGYPTIAN HIEROGLYPH V020G;Lo;0;L;;;;;N;;;;; +1338E;EGYPTIAN HIEROGLYPH V020H;Lo;0;L;;;;;N;;;;; +1338F;EGYPTIAN HIEROGLYPH V020I;Lo;0;L;;;;;N;;;;; +13390;EGYPTIAN HIEROGLYPH V020J;Lo;0;L;;;;;N;;;;; +13391;EGYPTIAN HIEROGLYPH V020K;Lo;0;L;;;;;N;;;;; +13392;EGYPTIAN HIEROGLYPH V020L;Lo;0;L;;;;;N;;;;; +13393;EGYPTIAN HIEROGLYPH V021;Lo;0;L;;;;;N;;;;; +13394;EGYPTIAN HIEROGLYPH V022;Lo;0;L;;;;;N;;;;; +13395;EGYPTIAN HIEROGLYPH V023;Lo;0;L;;;;;N;;;;; +13396;EGYPTIAN HIEROGLYPH V023A;Lo;0;L;;;;;N;;;;; +13397;EGYPTIAN HIEROGLYPH V024;Lo;0;L;;;;;N;;;;; +13398;EGYPTIAN HIEROGLYPH V025;Lo;0;L;;;;;N;;;;; +13399;EGYPTIAN HIEROGLYPH V026;Lo;0;L;;;;;N;;;;; +1339A;EGYPTIAN HIEROGLYPH V027;Lo;0;L;;;;;N;;;;; +1339B;EGYPTIAN HIEROGLYPH V028;Lo;0;L;;;;;N;;;;; +1339C;EGYPTIAN HIEROGLYPH V028A;Lo;0;L;;;;;N;;;;; +1339D;EGYPTIAN HIEROGLYPH V029;Lo;0;L;;;;;N;;;;; +1339E;EGYPTIAN HIEROGLYPH V029A;Lo;0;L;;;;;N;;;;; +1339F;EGYPTIAN HIEROGLYPH V030;Lo;0;L;;;;;N;;;;; +133A0;EGYPTIAN HIEROGLYPH V030A;Lo;0;L;;;;;N;;;;; +133A1;EGYPTIAN HIEROGLYPH V031;Lo;0;L;;;;;N;;;;; +133A2;EGYPTIAN HIEROGLYPH V031A;Lo;0;L;;;;;N;;;;; +133A3;EGYPTIAN HIEROGLYPH V032;Lo;0;L;;;;;N;;;;; +133A4;EGYPTIAN HIEROGLYPH V033;Lo;0;L;;;;;N;;;;; +133A5;EGYPTIAN HIEROGLYPH V033A;Lo;0;L;;;;;N;;;;; +133A6;EGYPTIAN HIEROGLYPH V034;Lo;0;L;;;;;N;;;;; +133A7;EGYPTIAN HIEROGLYPH V035;Lo;0;L;;;;;N;;;;; +133A8;EGYPTIAN HIEROGLYPH V036;Lo;0;L;;;;;N;;;;; +133A9;EGYPTIAN HIEROGLYPH V037;Lo;0;L;;;;;N;;;;; +133AA;EGYPTIAN HIEROGLYPH V037A;Lo;0;L;;;;;N;;;;; +133AB;EGYPTIAN HIEROGLYPH V038;Lo;0;L;;;;;N;;;;; +133AC;EGYPTIAN HIEROGLYPH V039;Lo;0;L;;;;;N;;;;; +133AD;EGYPTIAN HIEROGLYPH V040;Lo;0;L;;;;;N;;;;; +133AE;EGYPTIAN HIEROGLYPH V040A;Lo;0;L;;;;;N;;;;; +133AF;EGYPTIAN HIEROGLYPH W001;Lo;0;L;;;;;N;;;;; +133B0;EGYPTIAN HIEROGLYPH W002;Lo;0;L;;;;;N;;;;; +133B1;EGYPTIAN HIEROGLYPH W003;Lo;0;L;;;;;N;;;;; +133B2;EGYPTIAN HIEROGLYPH W003A;Lo;0;L;;;;;N;;;;; +133B3;EGYPTIAN HIEROGLYPH W004;Lo;0;L;;;;;N;;;;; +133B4;EGYPTIAN HIEROGLYPH W005;Lo;0;L;;;;;N;;;;; +133B5;EGYPTIAN HIEROGLYPH W006;Lo;0;L;;;;;N;;;;; +133B6;EGYPTIAN HIEROGLYPH W007;Lo;0;L;;;;;N;;;;; +133B7;EGYPTIAN HIEROGLYPH W008;Lo;0;L;;;;;N;;;;; +133B8;EGYPTIAN HIEROGLYPH W009;Lo;0;L;;;;;N;;;;; +133B9;EGYPTIAN HIEROGLYPH W009A;Lo;0;L;;;;;N;;;;; +133BA;EGYPTIAN HIEROGLYPH W010;Lo;0;L;;;;;N;;;;; +133BB;EGYPTIAN HIEROGLYPH W010A;Lo;0;L;;;;;N;;;;; +133BC;EGYPTIAN HIEROGLYPH W011;Lo;0;L;;;;;N;;;;; +133BD;EGYPTIAN HIEROGLYPH W012;Lo;0;L;;;;;N;;;;; +133BE;EGYPTIAN HIEROGLYPH W013;Lo;0;L;;;;;N;;;;; +133BF;EGYPTIAN HIEROGLYPH W014;Lo;0;L;;;;;N;;;;; +133C0;EGYPTIAN HIEROGLYPH W014A;Lo;0;L;;;;;N;;;;; +133C1;EGYPTIAN HIEROGLYPH W015;Lo;0;L;;;;;N;;;;; +133C2;EGYPTIAN HIEROGLYPH W016;Lo;0;L;;;;;N;;;;; +133C3;EGYPTIAN HIEROGLYPH W017;Lo;0;L;;;;;N;;;;; +133C4;EGYPTIAN HIEROGLYPH W017A;Lo;0;L;;;;;N;;;;; +133C5;EGYPTIAN HIEROGLYPH W018;Lo;0;L;;;;;N;;;;; +133C6;EGYPTIAN HIEROGLYPH W018A;Lo;0;L;;;;;N;;;;; +133C7;EGYPTIAN HIEROGLYPH W019;Lo;0;L;;;;;N;;;;; +133C8;EGYPTIAN HIEROGLYPH W020;Lo;0;L;;;;;N;;;;; +133C9;EGYPTIAN HIEROGLYPH W021;Lo;0;L;;;;;N;;;;; +133CA;EGYPTIAN HIEROGLYPH W022;Lo;0;L;;;;;N;;;;; +133CB;EGYPTIAN HIEROGLYPH W023;Lo;0;L;;;;;N;;;;; +133CC;EGYPTIAN HIEROGLYPH W024;Lo;0;L;;;;;N;;;;; +133CD;EGYPTIAN HIEROGLYPH W024A;Lo;0;L;;;;;N;;;;; +133CE;EGYPTIAN HIEROGLYPH W025;Lo;0;L;;;;;N;;;;; +133CF;EGYPTIAN HIEROGLYPH X001;Lo;0;L;;;;;N;;;;; +133D0;EGYPTIAN HIEROGLYPH X002;Lo;0;L;;;;;N;;;;; +133D1;EGYPTIAN HIEROGLYPH X003;Lo;0;L;;;;;N;;;;; +133D2;EGYPTIAN HIEROGLYPH X004;Lo;0;L;;;;;N;;;;; +133D3;EGYPTIAN HIEROGLYPH X004A;Lo;0;L;;;;;N;;;;; +133D4;EGYPTIAN HIEROGLYPH X004B;Lo;0;L;;;;;N;;;;; +133D5;EGYPTIAN HIEROGLYPH X005;Lo;0;L;;;;;N;;;;; +133D6;EGYPTIAN HIEROGLYPH X006;Lo;0;L;;;;;N;;;;; +133D7;EGYPTIAN HIEROGLYPH X006A;Lo;0;L;;;;;N;;;;; +133D8;EGYPTIAN HIEROGLYPH X007;Lo;0;L;;;;;N;;;;; +133D9;EGYPTIAN HIEROGLYPH X008;Lo;0;L;;;;;N;;;;; +133DA;EGYPTIAN HIEROGLYPH X008A;Lo;0;L;;;;;N;;;;; +133DB;EGYPTIAN HIEROGLYPH Y001;Lo;0;L;;;;;N;;;;; +133DC;EGYPTIAN HIEROGLYPH Y001A;Lo;0;L;;;;;N;;;;; +133DD;EGYPTIAN HIEROGLYPH Y002;Lo;0;L;;;;;N;;;;; +133DE;EGYPTIAN HIEROGLYPH Y003;Lo;0;L;;;;;N;;;;; +133DF;EGYPTIAN HIEROGLYPH Y004;Lo;0;L;;;;;N;;;;; +133E0;EGYPTIAN HIEROGLYPH Y005;Lo;0;L;;;;;N;;;;; +133E1;EGYPTIAN HIEROGLYPH Y006;Lo;0;L;;;;;N;;;;; +133E2;EGYPTIAN HIEROGLYPH Y007;Lo;0;L;;;;;N;;;;; +133E3;EGYPTIAN HIEROGLYPH Y008;Lo;0;L;;;;;N;;;;; +133E4;EGYPTIAN HIEROGLYPH Z001;Lo;0;L;;;;;N;;;;; +133E5;EGYPTIAN HIEROGLYPH Z002;Lo;0;L;;;;;N;;;;; +133E6;EGYPTIAN HIEROGLYPH Z002A;Lo;0;L;;;;;N;;;;; +133E7;EGYPTIAN HIEROGLYPH Z002B;Lo;0;L;;;;;N;;;;; +133E8;EGYPTIAN HIEROGLYPH Z002C;Lo;0;L;;;;;N;;;;; +133E9;EGYPTIAN HIEROGLYPH Z002D;Lo;0;L;;;;;N;;;;; +133EA;EGYPTIAN HIEROGLYPH Z003;Lo;0;L;;;;;N;;;;; +133EB;EGYPTIAN HIEROGLYPH Z003A;Lo;0;L;;;;;N;;;;; +133EC;EGYPTIAN HIEROGLYPH Z003B;Lo;0;L;;;;;N;;;;; +133ED;EGYPTIAN HIEROGLYPH Z004;Lo;0;L;;;;;N;;;;; +133EE;EGYPTIAN HIEROGLYPH Z004A;Lo;0;L;;;;;N;;;;; +133EF;EGYPTIAN HIEROGLYPH Z005;Lo;0;L;;;;;N;;;;; +133F0;EGYPTIAN HIEROGLYPH Z005A;Lo;0;L;;;;;N;;;;; +133F1;EGYPTIAN HIEROGLYPH Z006;Lo;0;L;;;;;N;;;;; +133F2;EGYPTIAN HIEROGLYPH Z007;Lo;0;L;;;;;N;;;;; +133F3;EGYPTIAN HIEROGLYPH Z008;Lo;0;L;;;;;N;;;;; +133F4;EGYPTIAN HIEROGLYPH Z009;Lo;0;L;;;;;N;;;;; +133F5;EGYPTIAN HIEROGLYPH Z010;Lo;0;L;;;;;N;;;;; +133F6;EGYPTIAN HIEROGLYPH Z011;Lo;0;L;;;;;N;;;;; +133F7;EGYPTIAN HIEROGLYPH Z012;Lo;0;L;;;;;N;;;;; +133F8;EGYPTIAN HIEROGLYPH Z013;Lo;0;L;;;;;N;;;;; +133F9;EGYPTIAN HIEROGLYPH Z014;Lo;0;L;;;;;N;;;;; +133FA;EGYPTIAN HIEROGLYPH Z015;Lo;0;L;;;;;N;;;;; +133FB;EGYPTIAN HIEROGLYPH Z015A;Lo;0;L;;;;;N;;;;; +133FC;EGYPTIAN HIEROGLYPH Z015B;Lo;0;L;;;;;N;;;;; +133FD;EGYPTIAN HIEROGLYPH Z015C;Lo;0;L;;;;;N;;;;; +133FE;EGYPTIAN HIEROGLYPH Z015D;Lo;0;L;;;;;N;;;;; +133FF;EGYPTIAN HIEROGLYPH Z015E;Lo;0;L;;;;;N;;;;; +13400;EGYPTIAN HIEROGLYPH Z015F;Lo;0;L;;;;;N;;;;; +13401;EGYPTIAN HIEROGLYPH Z015G;Lo;0;L;;;;;N;;;;; +13402;EGYPTIAN HIEROGLYPH Z015H;Lo;0;L;;;;;N;;;;; +13403;EGYPTIAN HIEROGLYPH Z015I;Lo;0;L;;;;;N;;;;; +13404;EGYPTIAN HIEROGLYPH Z016;Lo;0;L;;;;;N;;;;; +13405;EGYPTIAN HIEROGLYPH Z016A;Lo;0;L;;;;;N;;;;; +13406;EGYPTIAN HIEROGLYPH Z016B;Lo;0;L;;;;;N;;;;; +13407;EGYPTIAN HIEROGLYPH Z016C;Lo;0;L;;;;;N;;;;; +13408;EGYPTIAN HIEROGLYPH Z016D;Lo;0;L;;;;;N;;;;; +13409;EGYPTIAN HIEROGLYPH Z016E;Lo;0;L;;;;;N;;;;; +1340A;EGYPTIAN HIEROGLYPH Z016F;Lo;0;L;;;;;N;;;;; +1340B;EGYPTIAN HIEROGLYPH Z016G;Lo;0;L;;;;;N;;;;; +1340C;EGYPTIAN HIEROGLYPH Z016H;Lo;0;L;;;;;N;;;;; +1340D;EGYPTIAN HIEROGLYPH AA001;Lo;0;L;;;;;N;;;;; +1340E;EGYPTIAN HIEROGLYPH AA002;Lo;0;L;;;;;N;;;;; +1340F;EGYPTIAN HIEROGLYPH AA003;Lo;0;L;;;;;N;;;;; +13410;EGYPTIAN HIEROGLYPH AA004;Lo;0;L;;;;;N;;;;; +13411;EGYPTIAN HIEROGLYPH AA005;Lo;0;L;;;;;N;;;;; +13412;EGYPTIAN HIEROGLYPH AA006;Lo;0;L;;;;;N;;;;; +13413;EGYPTIAN HIEROGLYPH AA007;Lo;0;L;;;;;N;;;;; +13414;EGYPTIAN HIEROGLYPH AA007A;Lo;0;L;;;;;N;;;;; +13415;EGYPTIAN HIEROGLYPH AA007B;Lo;0;L;;;;;N;;;;; +13416;EGYPTIAN HIEROGLYPH AA008;Lo;0;L;;;;;N;;;;; +13417;EGYPTIAN HIEROGLYPH AA009;Lo;0;L;;;;;N;;;;; +13418;EGYPTIAN HIEROGLYPH AA010;Lo;0;L;;;;;N;;;;; +13419;EGYPTIAN HIEROGLYPH AA011;Lo;0;L;;;;;N;;;;; +1341A;EGYPTIAN HIEROGLYPH AA012;Lo;0;L;;;;;N;;;;; +1341B;EGYPTIAN HIEROGLYPH AA013;Lo;0;L;;;;;N;;;;; +1341C;EGYPTIAN HIEROGLYPH AA014;Lo;0;L;;;;;N;;;;; +1341D;EGYPTIAN HIEROGLYPH AA015;Lo;0;L;;;;;N;;;;; +1341E;EGYPTIAN HIEROGLYPH AA016;Lo;0;L;;;;;N;;;;; +1341F;EGYPTIAN HIEROGLYPH AA017;Lo;0;L;;;;;N;;;;; +13420;EGYPTIAN HIEROGLYPH AA018;Lo;0;L;;;;;N;;;;; +13421;EGYPTIAN HIEROGLYPH AA019;Lo;0;L;;;;;N;;;;; +13422;EGYPTIAN HIEROGLYPH AA020;Lo;0;L;;;;;N;;;;; +13423;EGYPTIAN HIEROGLYPH AA021;Lo;0;L;;;;;N;;;;; +13424;EGYPTIAN HIEROGLYPH AA022;Lo;0;L;;;;;N;;;;; +13425;EGYPTIAN HIEROGLYPH AA023;Lo;0;L;;;;;N;;;;; +13426;EGYPTIAN HIEROGLYPH AA024;Lo;0;L;;;;;N;;;;; +13427;EGYPTIAN HIEROGLYPH AA025;Lo;0;L;;;;;N;;;;; +13428;EGYPTIAN HIEROGLYPH AA026;Lo;0;L;;;;;N;;;;; +13429;EGYPTIAN HIEROGLYPH AA027;Lo;0;L;;;;;N;;;;; +1342A;EGYPTIAN HIEROGLYPH AA028;Lo;0;L;;;;;N;;;;; +1342B;EGYPTIAN HIEROGLYPH AA029;Lo;0;L;;;;;N;;;;; +1342C;EGYPTIAN HIEROGLYPH AA030;Lo;0;L;;;;;N;;;;; +1342D;EGYPTIAN HIEROGLYPH AA031;Lo;0;L;;;;;N;;;;; +1342E;EGYPTIAN HIEROGLYPH AA032;Lo;0;L;;;;;N;;;;; +14400;ANATOLIAN HIEROGLYPH A001;Lo;0;L;;;;;N;;;;; +14401;ANATOLIAN HIEROGLYPH A002;Lo;0;L;;;;;N;;;;; +14402;ANATOLIAN HIEROGLYPH A003;Lo;0;L;;;;;N;;;;; +14403;ANATOLIAN HIEROGLYPH A004;Lo;0;L;;;;;N;;;;; +14404;ANATOLIAN HIEROGLYPH A005;Lo;0;L;;;;;N;;;;; +14405;ANATOLIAN HIEROGLYPH A006;Lo;0;L;;;;;N;;;;; +14406;ANATOLIAN HIEROGLYPH A007;Lo;0;L;;;;;N;;;;; +14407;ANATOLIAN HIEROGLYPH A008;Lo;0;L;;;;;N;;;;; +14408;ANATOLIAN HIEROGLYPH A009;Lo;0;L;;;;;N;;;;; +14409;ANATOLIAN HIEROGLYPH A010;Lo;0;L;;;;;N;;;;; +1440A;ANATOLIAN HIEROGLYPH A010A;Lo;0;L;;;;;N;;;;; +1440B;ANATOLIAN HIEROGLYPH A011;Lo;0;L;;;;;N;;;;; +1440C;ANATOLIAN HIEROGLYPH A012;Lo;0;L;;;;;N;;;;; +1440D;ANATOLIAN HIEROGLYPH A013;Lo;0;L;;;;;N;;;;; +1440E;ANATOLIAN HIEROGLYPH A014;Lo;0;L;;;;;N;;;;; +1440F;ANATOLIAN HIEROGLYPH A015;Lo;0;L;;;;;N;;;;; +14410;ANATOLIAN HIEROGLYPH A016;Lo;0;L;;;;;N;;;;; +14411;ANATOLIAN HIEROGLYPH A017;Lo;0;L;;;;;N;;;;; +14412;ANATOLIAN HIEROGLYPH A018;Lo;0;L;;;;;N;;;;; +14413;ANATOLIAN HIEROGLYPH A019;Lo;0;L;;;;;N;;;;; +14414;ANATOLIAN HIEROGLYPH A020;Lo;0;L;;;;;N;;;;; +14415;ANATOLIAN HIEROGLYPH A021;Lo;0;L;;;;;N;;;;; +14416;ANATOLIAN HIEROGLYPH A022;Lo;0;L;;;;;N;;;;; +14417;ANATOLIAN HIEROGLYPH A023;Lo;0;L;;;;;N;;;;; +14418;ANATOLIAN HIEROGLYPH A024;Lo;0;L;;;;;N;;;;; +14419;ANATOLIAN HIEROGLYPH A025;Lo;0;L;;;;;N;;;;; +1441A;ANATOLIAN HIEROGLYPH A026;Lo;0;L;;;;;N;;;;; +1441B;ANATOLIAN HIEROGLYPH A026A;Lo;0;L;;;;;N;;;;; +1441C;ANATOLIAN HIEROGLYPH A027;Lo;0;L;;;;;N;;;;; +1441D;ANATOLIAN HIEROGLYPH A028;Lo;0;L;;;;;N;;;;; +1441E;ANATOLIAN HIEROGLYPH A029;Lo;0;L;;;;;N;;;;; +1441F;ANATOLIAN HIEROGLYPH A030;Lo;0;L;;;;;N;;;;; +14420;ANATOLIAN HIEROGLYPH A031;Lo;0;L;;;;;N;;;;; +14421;ANATOLIAN HIEROGLYPH A032;Lo;0;L;;;;;N;;;;; +14422;ANATOLIAN HIEROGLYPH A033;Lo;0;L;;;;;N;;;;; +14423;ANATOLIAN HIEROGLYPH A034;Lo;0;L;;;;;N;;;;; +14424;ANATOLIAN HIEROGLYPH A035;Lo;0;L;;;;;N;;;;; +14425;ANATOLIAN HIEROGLYPH A036;Lo;0;L;;;;;N;;;;; +14426;ANATOLIAN HIEROGLYPH A037;Lo;0;L;;;;;N;;;;; +14427;ANATOLIAN HIEROGLYPH A038;Lo;0;L;;;;;N;;;;; +14428;ANATOLIAN HIEROGLYPH A039;Lo;0;L;;;;;N;;;;; +14429;ANATOLIAN HIEROGLYPH A039A;Lo;0;L;;;;;N;;;;; +1442A;ANATOLIAN HIEROGLYPH A040;Lo;0;L;;;;;N;;;;; +1442B;ANATOLIAN HIEROGLYPH A041;Lo;0;L;;;;;N;;;;; +1442C;ANATOLIAN HIEROGLYPH A041A;Lo;0;L;;;;;N;;;;; +1442D;ANATOLIAN HIEROGLYPH A042;Lo;0;L;;;;;N;;;;; +1442E;ANATOLIAN HIEROGLYPH A043;Lo;0;L;;;;;N;;;;; +1442F;ANATOLIAN HIEROGLYPH A044;Lo;0;L;;;;;N;;;;; +14430;ANATOLIAN HIEROGLYPH A045;Lo;0;L;;;;;N;;;;; +14431;ANATOLIAN HIEROGLYPH A045A;Lo;0;L;;;;;N;;;;; +14432;ANATOLIAN HIEROGLYPH A046;Lo;0;L;;;;;N;;;;; +14433;ANATOLIAN HIEROGLYPH A046A;Lo;0;L;;;;;N;;;;; +14434;ANATOLIAN HIEROGLYPH A046B;Lo;0;L;;;;;N;;;;; +14435;ANATOLIAN HIEROGLYPH A047;Lo;0;L;;;;;N;;;;; +14436;ANATOLIAN HIEROGLYPH A048;Lo;0;L;;;;;N;;;;; +14437;ANATOLIAN HIEROGLYPH A049;Lo;0;L;;;;;N;;;;; +14438;ANATOLIAN HIEROGLYPH A050;Lo;0;L;;;;;N;;;;; +14439;ANATOLIAN HIEROGLYPH A051;Lo;0;L;;;;;N;;;;; +1443A;ANATOLIAN HIEROGLYPH A052;Lo;0;L;;;;;N;;;;; +1443B;ANATOLIAN HIEROGLYPH A053;Lo;0;L;;;;;N;;;;; +1443C;ANATOLIAN HIEROGLYPH A054;Lo;0;L;;;;;N;;;;; +1443D;ANATOLIAN HIEROGLYPH A055;Lo;0;L;;;;;N;;;;; +1443E;ANATOLIAN HIEROGLYPH A056;Lo;0;L;;;;;N;;;;; +1443F;ANATOLIAN HIEROGLYPH A057;Lo;0;L;;;;;N;;;;; +14440;ANATOLIAN HIEROGLYPH A058;Lo;0;L;;;;;N;;;;; +14441;ANATOLIAN HIEROGLYPH A059;Lo;0;L;;;;;N;;;;; +14442;ANATOLIAN HIEROGLYPH A060;Lo;0;L;;;;;N;;;;; +14443;ANATOLIAN HIEROGLYPH A061;Lo;0;L;;;;;N;;;;; +14444;ANATOLIAN HIEROGLYPH A062;Lo;0;L;;;;;N;;;;; +14445;ANATOLIAN HIEROGLYPH A063;Lo;0;L;;;;;N;;;;; +14446;ANATOLIAN HIEROGLYPH A064;Lo;0;L;;;;;N;;;;; +14447;ANATOLIAN HIEROGLYPH A065;Lo;0;L;;;;;N;;;;; +14448;ANATOLIAN HIEROGLYPH A066;Lo;0;L;;;;;N;;;;; +14449;ANATOLIAN HIEROGLYPH A066A;Lo;0;L;;;;;N;;;;; +1444A;ANATOLIAN HIEROGLYPH A066B;Lo;0;L;;;;;N;;;;; +1444B;ANATOLIAN HIEROGLYPH A066C;Lo;0;L;;;;;N;;;;; +1444C;ANATOLIAN HIEROGLYPH A067;Lo;0;L;;;;;N;;;;; +1444D;ANATOLIAN HIEROGLYPH A068;Lo;0;L;;;;;N;;;;; +1444E;ANATOLIAN HIEROGLYPH A069;Lo;0;L;;;;;N;;;;; +1444F;ANATOLIAN HIEROGLYPH A070;Lo;0;L;;;;;N;;;;; +14450;ANATOLIAN HIEROGLYPH A071;Lo;0;L;;;;;N;;;;; +14451;ANATOLIAN HIEROGLYPH A072;Lo;0;L;;;;;N;;;;; +14452;ANATOLIAN HIEROGLYPH A073;Lo;0;L;;;;;N;;;;; +14453;ANATOLIAN HIEROGLYPH A074;Lo;0;L;;;;;N;;;;; +14454;ANATOLIAN HIEROGLYPH A075;Lo;0;L;;;;;N;;;;; +14455;ANATOLIAN HIEROGLYPH A076;Lo;0;L;;;;;N;;;;; +14456;ANATOLIAN HIEROGLYPH A077;Lo;0;L;;;;;N;;;;; +14457;ANATOLIAN HIEROGLYPH A078;Lo;0;L;;;;;N;;;;; +14458;ANATOLIAN HIEROGLYPH A079;Lo;0;L;;;;;N;;;;; +14459;ANATOLIAN HIEROGLYPH A080;Lo;0;L;;;;;N;;;;; +1445A;ANATOLIAN HIEROGLYPH A081;Lo;0;L;;;;;N;;;;; +1445B;ANATOLIAN HIEROGLYPH A082;Lo;0;L;;;;;N;;;;; +1445C;ANATOLIAN HIEROGLYPH A083;Lo;0;L;;;;;N;;;;; +1445D;ANATOLIAN HIEROGLYPH A084;Lo;0;L;;;;;N;;;;; +1445E;ANATOLIAN HIEROGLYPH A085;Lo;0;L;;;;;N;;;;; +1445F;ANATOLIAN HIEROGLYPH A086;Lo;0;L;;;;;N;;;;; +14460;ANATOLIAN HIEROGLYPH A087;Lo;0;L;;;;;N;;;;; +14461;ANATOLIAN HIEROGLYPH A088;Lo;0;L;;;;;N;;;;; +14462;ANATOLIAN HIEROGLYPH A089;Lo;0;L;;;;;N;;;;; +14463;ANATOLIAN HIEROGLYPH A090;Lo;0;L;;;;;N;;;;; +14464;ANATOLIAN HIEROGLYPH A091;Lo;0;L;;;;;N;;;;; +14465;ANATOLIAN HIEROGLYPH A092;Lo;0;L;;;;;N;;;;; +14466;ANATOLIAN HIEROGLYPH A093;Lo;0;L;;;;;N;;;;; +14467;ANATOLIAN HIEROGLYPH A094;Lo;0;L;;;;;N;;;;; +14468;ANATOLIAN HIEROGLYPH A095;Lo;0;L;;;;;N;;;;; +14469;ANATOLIAN HIEROGLYPH A096;Lo;0;L;;;;;N;;;;; +1446A;ANATOLIAN HIEROGLYPH A097;Lo;0;L;;;;;N;;;;; +1446B;ANATOLIAN HIEROGLYPH A097A;Lo;0;L;;;;;N;;;;; +1446C;ANATOLIAN HIEROGLYPH A098;Lo;0;L;;;;;N;;;;; +1446D;ANATOLIAN HIEROGLYPH A098A;Lo;0;L;;;;;N;;;;; +1446E;ANATOLIAN HIEROGLYPH A099;Lo;0;L;;;;;N;;;;; +1446F;ANATOLIAN HIEROGLYPH A100;Lo;0;L;;;;;N;;;;; +14470;ANATOLIAN HIEROGLYPH A100A;Lo;0;L;;;;;N;;;;; +14471;ANATOLIAN HIEROGLYPH A101;Lo;0;L;;;;;N;;;;; +14472;ANATOLIAN HIEROGLYPH A101A;Lo;0;L;;;;;N;;;;; +14473;ANATOLIAN HIEROGLYPH A102;Lo;0;L;;;;;N;;;;; +14474;ANATOLIAN HIEROGLYPH A102A;Lo;0;L;;;;;N;;;;; +14475;ANATOLIAN HIEROGLYPH A103;Lo;0;L;;;;;N;;;;; +14476;ANATOLIAN HIEROGLYPH A104;Lo;0;L;;;;;N;;;;; +14477;ANATOLIAN HIEROGLYPH A104A;Lo;0;L;;;;;N;;;;; +14478;ANATOLIAN HIEROGLYPH A104B;Lo;0;L;;;;;N;;;;; +14479;ANATOLIAN HIEROGLYPH A104C;Lo;0;L;;;;;N;;;;; +1447A;ANATOLIAN HIEROGLYPH A105;Lo;0;L;;;;;N;;;;; +1447B;ANATOLIAN HIEROGLYPH A105A;Lo;0;L;;;;;N;;;;; +1447C;ANATOLIAN HIEROGLYPH A105B;Lo;0;L;;;;;N;;;;; +1447D;ANATOLIAN HIEROGLYPH A106;Lo;0;L;;;;;N;;;;; +1447E;ANATOLIAN HIEROGLYPH A107;Lo;0;L;;;;;N;;;;; +1447F;ANATOLIAN HIEROGLYPH A107A;Lo;0;L;;;;;N;;;;; +14480;ANATOLIAN HIEROGLYPH A107B;Lo;0;L;;;;;N;;;;; +14481;ANATOLIAN HIEROGLYPH A107C;Lo;0;L;;;;;N;;;;; +14482;ANATOLIAN HIEROGLYPH A108;Lo;0;L;;;;;N;;;;; +14483;ANATOLIAN HIEROGLYPH A109;Lo;0;L;;;;;N;;;;; +14484;ANATOLIAN HIEROGLYPH A110;Lo;0;L;;;;;N;;;;; +14485;ANATOLIAN HIEROGLYPH A110A;Lo;0;L;;;;;N;;;;; +14486;ANATOLIAN HIEROGLYPH A110B;Lo;0;L;;;;;N;;;;; +14487;ANATOLIAN HIEROGLYPH A111;Lo;0;L;;;;;N;;;;; +14488;ANATOLIAN HIEROGLYPH A112;Lo;0;L;;;;;N;;;;; +14489;ANATOLIAN HIEROGLYPH A113;Lo;0;L;;;;;N;;;;; +1448A;ANATOLIAN HIEROGLYPH A114;Lo;0;L;;;;;N;;;;; +1448B;ANATOLIAN HIEROGLYPH A115;Lo;0;L;;;;;N;;;;; +1448C;ANATOLIAN HIEROGLYPH A115A;Lo;0;L;;;;;N;;;;; +1448D;ANATOLIAN HIEROGLYPH A116;Lo;0;L;;;;;N;;;;; +1448E;ANATOLIAN HIEROGLYPH A117;Lo;0;L;;;;;N;;;;; +1448F;ANATOLIAN HIEROGLYPH A118;Lo;0;L;;;;;N;;;;; +14490;ANATOLIAN HIEROGLYPH A119;Lo;0;L;;;;;N;;;;; +14491;ANATOLIAN HIEROGLYPH A120;Lo;0;L;;;;;N;;;;; +14492;ANATOLIAN HIEROGLYPH A121;Lo;0;L;;;;;N;;;;; +14493;ANATOLIAN HIEROGLYPH A122;Lo;0;L;;;;;N;;;;; +14494;ANATOLIAN HIEROGLYPH A123;Lo;0;L;;;;;N;;;;; +14495;ANATOLIAN HIEROGLYPH A124;Lo;0;L;;;;;N;;;;; +14496;ANATOLIAN HIEROGLYPH A125;Lo;0;L;;;;;N;;;;; +14497;ANATOLIAN HIEROGLYPH A125A;Lo;0;L;;;;;N;;;;; +14498;ANATOLIAN HIEROGLYPH A126;Lo;0;L;;;;;N;;;;; +14499;ANATOLIAN HIEROGLYPH A127;Lo;0;L;;;;;N;;;;; +1449A;ANATOLIAN HIEROGLYPH A128;Lo;0;L;;;;;N;;;;; +1449B;ANATOLIAN HIEROGLYPH A129;Lo;0;L;;;;;N;;;;; +1449C;ANATOLIAN HIEROGLYPH A130;Lo;0;L;;;;;N;;;;; +1449D;ANATOLIAN HIEROGLYPH A131;Lo;0;L;;;;;N;;;;; +1449E;ANATOLIAN HIEROGLYPH A132;Lo;0;L;;;;;N;;;;; +1449F;ANATOLIAN HIEROGLYPH A133;Lo;0;L;;;;;N;;;;; +144A0;ANATOLIAN HIEROGLYPH A134;Lo;0;L;;;;;N;;;;; +144A1;ANATOLIAN HIEROGLYPH A135;Lo;0;L;;;;;N;;;;; +144A2;ANATOLIAN HIEROGLYPH A135A;Lo;0;L;;;;;N;;;;; +144A3;ANATOLIAN HIEROGLYPH A136;Lo;0;L;;;;;N;;;;; +144A4;ANATOLIAN HIEROGLYPH A137;Lo;0;L;;;;;N;;;;; +144A5;ANATOLIAN HIEROGLYPH A138;Lo;0;L;;;;;N;;;;; +144A6;ANATOLIAN HIEROGLYPH A139;Lo;0;L;;;;;N;;;;; +144A7;ANATOLIAN HIEROGLYPH A140;Lo;0;L;;;;;N;;;;; +144A8;ANATOLIAN HIEROGLYPH A141;Lo;0;L;;;;;N;;;;; +144A9;ANATOLIAN HIEROGLYPH A142;Lo;0;L;;;;;N;;;;; +144AA;ANATOLIAN HIEROGLYPH A143;Lo;0;L;;;;;N;;;;; +144AB;ANATOLIAN HIEROGLYPH A144;Lo;0;L;;;;;N;;;;; +144AC;ANATOLIAN HIEROGLYPH A145;Lo;0;L;;;;;N;;;;; +144AD;ANATOLIAN HIEROGLYPH A146;Lo;0;L;;;;;N;;;;; +144AE;ANATOLIAN HIEROGLYPH A147;Lo;0;L;;;;;N;;;;; +144AF;ANATOLIAN HIEROGLYPH A148;Lo;0;L;;;;;N;;;;; +144B0;ANATOLIAN HIEROGLYPH A149;Lo;0;L;;;;;N;;;;; +144B1;ANATOLIAN HIEROGLYPH A150;Lo;0;L;;;;;N;;;;; +144B2;ANATOLIAN HIEROGLYPH A151;Lo;0;L;;;;;N;;;;; +144B3;ANATOLIAN HIEROGLYPH A152;Lo;0;L;;;;;N;;;;; +144B4;ANATOLIAN HIEROGLYPH A153;Lo;0;L;;;;;N;;;;; +144B5;ANATOLIAN HIEROGLYPH A154;Lo;0;L;;;;;N;;;;; +144B6;ANATOLIAN HIEROGLYPH A155;Lo;0;L;;;;;N;;;;; +144B7;ANATOLIAN HIEROGLYPH A156;Lo;0;L;;;;;N;;;;; +144B8;ANATOLIAN HIEROGLYPH A157;Lo;0;L;;;;;N;;;;; +144B9;ANATOLIAN HIEROGLYPH A158;Lo;0;L;;;;;N;;;;; +144BA;ANATOLIAN HIEROGLYPH A159;Lo;0;L;;;;;N;;;;; +144BB;ANATOLIAN HIEROGLYPH A160;Lo;0;L;;;;;N;;;;; +144BC;ANATOLIAN HIEROGLYPH A161;Lo;0;L;;;;;N;;;;; +144BD;ANATOLIAN HIEROGLYPH A162;Lo;0;L;;;;;N;;;;; +144BE;ANATOLIAN HIEROGLYPH A163;Lo;0;L;;;;;N;;;;; +144BF;ANATOLIAN HIEROGLYPH A164;Lo;0;L;;;;;N;;;;; +144C0;ANATOLIAN HIEROGLYPH A165;Lo;0;L;;;;;N;;;;; +144C1;ANATOLIAN HIEROGLYPH A166;Lo;0;L;;;;;N;;;;; +144C2;ANATOLIAN HIEROGLYPH A167;Lo;0;L;;;;;N;;;;; +144C3;ANATOLIAN HIEROGLYPH A168;Lo;0;L;;;;;N;;;;; +144C4;ANATOLIAN HIEROGLYPH A169;Lo;0;L;;;;;N;;;;; +144C5;ANATOLIAN HIEROGLYPH A170;Lo;0;L;;;;;N;;;;; +144C6;ANATOLIAN HIEROGLYPH A171;Lo;0;L;;;;;N;;;;; +144C7;ANATOLIAN HIEROGLYPH A172;Lo;0;L;;;;;N;;;;; +144C8;ANATOLIAN HIEROGLYPH A173;Lo;0;L;;;;;N;;;;; +144C9;ANATOLIAN HIEROGLYPH A174;Lo;0;L;;;;;N;;;;; +144CA;ANATOLIAN HIEROGLYPH A175;Lo;0;L;;;;;N;;;;; +144CB;ANATOLIAN HIEROGLYPH A176;Lo;0;L;;;;;N;;;;; +144CC;ANATOLIAN HIEROGLYPH A177;Lo;0;L;;;;;N;;;;; +144CD;ANATOLIAN HIEROGLYPH A178;Lo;0;L;;;;;N;;;;; +144CE;ANATOLIAN HIEROGLYPH A179;Lo;0;L;;;;;N;;;;; +144CF;ANATOLIAN HIEROGLYPH A180;Lo;0;L;;;;;N;;;;; +144D0;ANATOLIAN HIEROGLYPH A181;Lo;0;L;;;;;N;;;;; +144D1;ANATOLIAN HIEROGLYPH A182;Lo;0;L;;;;;N;;;;; +144D2;ANATOLIAN HIEROGLYPH A183;Lo;0;L;;;;;N;;;;; +144D3;ANATOLIAN HIEROGLYPH A184;Lo;0;L;;;;;N;;;;; +144D4;ANATOLIAN HIEROGLYPH A185;Lo;0;L;;;;;N;;;;; +144D5;ANATOLIAN HIEROGLYPH A186;Lo;0;L;;;;;N;;;;; +144D6;ANATOLIAN HIEROGLYPH A187;Lo;0;L;;;;;N;;;;; +144D7;ANATOLIAN HIEROGLYPH A188;Lo;0;L;;;;;N;;;;; +144D8;ANATOLIAN HIEROGLYPH A189;Lo;0;L;;;;;N;;;;; +144D9;ANATOLIAN HIEROGLYPH A190;Lo;0;L;;;;;N;;;;; +144DA;ANATOLIAN HIEROGLYPH A191;Lo;0;L;;;;;N;;;;; +144DB;ANATOLIAN HIEROGLYPH A192;Lo;0;L;;;;;N;;;;; +144DC;ANATOLIAN HIEROGLYPH A193;Lo;0;L;;;;;N;;;;; +144DD;ANATOLIAN HIEROGLYPH A194;Lo;0;L;;;;;N;;;;; +144DE;ANATOLIAN HIEROGLYPH A195;Lo;0;L;;;;;N;;;;; +144DF;ANATOLIAN HIEROGLYPH A196;Lo;0;L;;;;;N;;;;; +144E0;ANATOLIAN HIEROGLYPH A197;Lo;0;L;;;;;N;;;;; +144E1;ANATOLIAN HIEROGLYPH A198;Lo;0;L;;;;;N;;;;; +144E2;ANATOLIAN HIEROGLYPH A199;Lo;0;L;;;;;N;;;;; +144E3;ANATOLIAN HIEROGLYPH A200;Lo;0;L;;;;;N;;;;; +144E4;ANATOLIAN HIEROGLYPH A201;Lo;0;L;;;;;N;;;;; +144E5;ANATOLIAN HIEROGLYPH A202;Lo;0;L;;;;;N;;;;; +144E6;ANATOLIAN HIEROGLYPH A202A;Lo;0;L;;;;;N;;;;; +144E7;ANATOLIAN HIEROGLYPH A202B;Lo;0;L;;;;;N;;;;; +144E8;ANATOLIAN HIEROGLYPH A203;Lo;0;L;;;;;N;;;;; +144E9;ANATOLIAN HIEROGLYPH A204;Lo;0;L;;;;;N;;;;; +144EA;ANATOLIAN HIEROGLYPH A205;Lo;0;L;;;;;N;;;;; +144EB;ANATOLIAN HIEROGLYPH A206;Lo;0;L;;;;;N;;;;; +144EC;ANATOLIAN HIEROGLYPH A207;Lo;0;L;;;;;N;;;;; +144ED;ANATOLIAN HIEROGLYPH A207A;Lo;0;L;;;;;N;;;;; +144EE;ANATOLIAN HIEROGLYPH A208;Lo;0;L;;;;;N;;;;; +144EF;ANATOLIAN HIEROGLYPH A209;Lo;0;L;;;;;N;;;;; +144F0;ANATOLIAN HIEROGLYPH A209A;Lo;0;L;;;;;N;;;;; +144F1;ANATOLIAN HIEROGLYPH A210;Lo;0;L;;;;;N;;;;; +144F2;ANATOLIAN HIEROGLYPH A211;Lo;0;L;;;;;N;;;;; +144F3;ANATOLIAN HIEROGLYPH A212;Lo;0;L;;;;;N;;;;; +144F4;ANATOLIAN HIEROGLYPH A213;Lo;0;L;;;;;N;;;;; +144F5;ANATOLIAN HIEROGLYPH A214;Lo;0;L;;;;;N;;;;; +144F6;ANATOLIAN HIEROGLYPH A215;Lo;0;L;;;;;N;;;;; +144F7;ANATOLIAN HIEROGLYPH A215A;Lo;0;L;;;;;N;;;;; +144F8;ANATOLIAN HIEROGLYPH A216;Lo;0;L;;;;;N;;;;; +144F9;ANATOLIAN HIEROGLYPH A216A;Lo;0;L;;;;;N;;;;; +144FA;ANATOLIAN HIEROGLYPH A217;Lo;0;L;;;;;N;;;;; +144FB;ANATOLIAN HIEROGLYPH A218;Lo;0;L;;;;;N;;;;; +144FC;ANATOLIAN HIEROGLYPH A219;Lo;0;L;;;;;N;;;;; +144FD;ANATOLIAN HIEROGLYPH A220;Lo;0;L;;;;;N;;;;; +144FE;ANATOLIAN HIEROGLYPH A221;Lo;0;L;;;;;N;;;;; +144FF;ANATOLIAN HIEROGLYPH A222;Lo;0;L;;;;;N;;;;; +14500;ANATOLIAN HIEROGLYPH A223;Lo;0;L;;;;;N;;;;; +14501;ANATOLIAN HIEROGLYPH A224;Lo;0;L;;;;;N;;;;; +14502;ANATOLIAN HIEROGLYPH A225;Lo;0;L;;;;;N;;;;; +14503;ANATOLIAN HIEROGLYPH A226;Lo;0;L;;;;;N;;;;; +14504;ANATOLIAN HIEROGLYPH A227;Lo;0;L;;;;;N;;;;; +14505;ANATOLIAN HIEROGLYPH A227A;Lo;0;L;;;;;N;;;;; +14506;ANATOLIAN HIEROGLYPH A228;Lo;0;L;;;;;N;;;;; +14507;ANATOLIAN HIEROGLYPH A229;Lo;0;L;;;;;N;;;;; +14508;ANATOLIAN HIEROGLYPH A230;Lo;0;L;;;;;N;;;;; +14509;ANATOLIAN HIEROGLYPH A231;Lo;0;L;;;;;N;;;;; +1450A;ANATOLIAN HIEROGLYPH A232;Lo;0;L;;;;;N;;;;; +1450B;ANATOLIAN HIEROGLYPH A233;Lo;0;L;;;;;N;;;;; +1450C;ANATOLIAN HIEROGLYPH A234;Lo;0;L;;;;;N;;;;; +1450D;ANATOLIAN HIEROGLYPH A235;Lo;0;L;;;;;N;;;;; +1450E;ANATOLIAN HIEROGLYPH A236;Lo;0;L;;;;;N;;;;; +1450F;ANATOLIAN HIEROGLYPH A237;Lo;0;L;;;;;N;;;;; +14510;ANATOLIAN HIEROGLYPH A238;Lo;0;L;;;;;N;;;;; +14511;ANATOLIAN HIEROGLYPH A239;Lo;0;L;;;;;N;;;;; +14512;ANATOLIAN HIEROGLYPH A240;Lo;0;L;;;;;N;;;;; +14513;ANATOLIAN HIEROGLYPH A241;Lo;0;L;;;;;N;;;;; +14514;ANATOLIAN HIEROGLYPH A242;Lo;0;L;;;;;N;;;;; +14515;ANATOLIAN HIEROGLYPH A243;Lo;0;L;;;;;N;;;;; +14516;ANATOLIAN HIEROGLYPH A244;Lo;0;L;;;;;N;;;;; +14517;ANATOLIAN HIEROGLYPH A245;Lo;0;L;;;;;N;;;;; +14518;ANATOLIAN HIEROGLYPH A246;Lo;0;L;;;;;N;;;;; +14519;ANATOLIAN HIEROGLYPH A247;Lo;0;L;;;;;N;;;;; +1451A;ANATOLIAN HIEROGLYPH A248;Lo;0;L;;;;;N;;;;; +1451B;ANATOLIAN HIEROGLYPH A249;Lo;0;L;;;;;N;;;;; +1451C;ANATOLIAN HIEROGLYPH A250;Lo;0;L;;;;;N;;;;; +1451D;ANATOLIAN HIEROGLYPH A251;Lo;0;L;;;;;N;;;;; +1451E;ANATOLIAN HIEROGLYPH A252;Lo;0;L;;;;;N;;;;; +1451F;ANATOLIAN HIEROGLYPH A253;Lo;0;L;;;;;N;;;;; +14520;ANATOLIAN HIEROGLYPH A254;Lo;0;L;;;;;N;;;;; +14521;ANATOLIAN HIEROGLYPH A255;Lo;0;L;;;;;N;;;;; +14522;ANATOLIAN HIEROGLYPH A256;Lo;0;L;;;;;N;;;;; +14523;ANATOLIAN HIEROGLYPH A257;Lo;0;L;;;;;N;;;;; +14524;ANATOLIAN HIEROGLYPH A258;Lo;0;L;;;;;N;;;;; +14525;ANATOLIAN HIEROGLYPH A259;Lo;0;L;;;;;N;;;;; +14526;ANATOLIAN HIEROGLYPH A260;Lo;0;L;;;;;N;;;;; +14527;ANATOLIAN HIEROGLYPH A261;Lo;0;L;;;;;N;;;;; +14528;ANATOLIAN HIEROGLYPH A262;Lo;0;L;;;;;N;;;;; +14529;ANATOLIAN HIEROGLYPH A263;Lo;0;L;;;;;N;;;;; +1452A;ANATOLIAN HIEROGLYPH A264;Lo;0;L;;;;;N;;;;; +1452B;ANATOLIAN HIEROGLYPH A265;Lo;0;L;;;;;N;;;;; +1452C;ANATOLIAN HIEROGLYPH A266;Lo;0;L;;;;;N;;;;; +1452D;ANATOLIAN HIEROGLYPH A267;Lo;0;L;;;;;N;;;;; +1452E;ANATOLIAN HIEROGLYPH A267A;Lo;0;L;;;;;N;;;;; +1452F;ANATOLIAN HIEROGLYPH A268;Lo;0;L;;;;;N;;;;; +14530;ANATOLIAN HIEROGLYPH A269;Lo;0;L;;;;;N;;;;; +14531;ANATOLIAN HIEROGLYPH A270;Lo;0;L;;;;;N;;;;; +14532;ANATOLIAN HIEROGLYPH A271;Lo;0;L;;;;;N;;;;; +14533;ANATOLIAN HIEROGLYPH A272;Lo;0;L;;;;;N;;;;; +14534;ANATOLIAN HIEROGLYPH A273;Lo;0;L;;;;;N;;;;; +14535;ANATOLIAN HIEROGLYPH A274;Lo;0;L;;;;;N;;;;; +14536;ANATOLIAN HIEROGLYPH A275;Lo;0;L;;;;;N;;;;; +14537;ANATOLIAN HIEROGLYPH A276;Lo;0;L;;;;;N;;;;; +14538;ANATOLIAN HIEROGLYPH A277;Lo;0;L;;;;;N;;;;; +14539;ANATOLIAN HIEROGLYPH A278;Lo;0;L;;;;;N;;;;; +1453A;ANATOLIAN HIEROGLYPH A279;Lo;0;L;;;;;N;;;;; +1453B;ANATOLIAN HIEROGLYPH A280;Lo;0;L;;;;;N;;;;; +1453C;ANATOLIAN HIEROGLYPH A281;Lo;0;L;;;;;N;;;;; +1453D;ANATOLIAN HIEROGLYPH A282;Lo;0;L;;;;;N;;;;; +1453E;ANATOLIAN HIEROGLYPH A283;Lo;0;L;;;;;N;;;;; +1453F;ANATOLIAN HIEROGLYPH A284;Lo;0;L;;;;;N;;;;; +14540;ANATOLIAN HIEROGLYPH A285;Lo;0;L;;;;;N;;;;; +14541;ANATOLIAN HIEROGLYPH A286;Lo;0;L;;;;;N;;;;; +14542;ANATOLIAN HIEROGLYPH A287;Lo;0;L;;;;;N;;;;; +14543;ANATOLIAN HIEROGLYPH A288;Lo;0;L;;;;;N;;;;; +14544;ANATOLIAN HIEROGLYPH A289;Lo;0;L;;;;;N;;;;; +14545;ANATOLIAN HIEROGLYPH A289A;Lo;0;L;;;;;N;;;;; +14546;ANATOLIAN HIEROGLYPH A290;Lo;0;L;;;;;N;;;;; +14547;ANATOLIAN HIEROGLYPH A291;Lo;0;L;;;;;N;;;;; +14548;ANATOLIAN HIEROGLYPH A292;Lo;0;L;;;;;N;;;;; +14549;ANATOLIAN HIEROGLYPH A293;Lo;0;L;;;;;N;;;;; +1454A;ANATOLIAN HIEROGLYPH A294;Lo;0;L;;;;;N;;;;; +1454B;ANATOLIAN HIEROGLYPH A294A;Lo;0;L;;;;;N;;;;; +1454C;ANATOLIAN HIEROGLYPH A295;Lo;0;L;;;;;N;;;;; +1454D;ANATOLIAN HIEROGLYPH A296;Lo;0;L;;;;;N;;;;; +1454E;ANATOLIAN HIEROGLYPH A297;Lo;0;L;;;;;N;;;;; +1454F;ANATOLIAN HIEROGLYPH A298;Lo;0;L;;;;;N;;;;; +14550;ANATOLIAN HIEROGLYPH A299;Lo;0;L;;;;;N;;;;; +14551;ANATOLIAN HIEROGLYPH A299A;Lo;0;L;;;;;N;;;;; +14552;ANATOLIAN HIEROGLYPH A300;Lo;0;L;;;;;N;;;;; +14553;ANATOLIAN HIEROGLYPH A301;Lo;0;L;;;;;N;;;;; +14554;ANATOLIAN HIEROGLYPH A302;Lo;0;L;;;;;N;;;;; +14555;ANATOLIAN HIEROGLYPH A303;Lo;0;L;;;;;N;;;;; +14556;ANATOLIAN HIEROGLYPH A304;Lo;0;L;;;;;N;;;;; +14557;ANATOLIAN HIEROGLYPH A305;Lo;0;L;;;;;N;;;;; +14558;ANATOLIAN HIEROGLYPH A306;Lo;0;L;;;;;N;;;;; +14559;ANATOLIAN HIEROGLYPH A307;Lo;0;L;;;;;N;;;;; +1455A;ANATOLIAN HIEROGLYPH A308;Lo;0;L;;;;;N;;;;; +1455B;ANATOLIAN HIEROGLYPH A309;Lo;0;L;;;;;N;;;;; +1455C;ANATOLIAN HIEROGLYPH A309A;Lo;0;L;;;;;N;;;;; +1455D;ANATOLIAN HIEROGLYPH A310;Lo;0;L;;;;;N;;;;; +1455E;ANATOLIAN HIEROGLYPH A311;Lo;0;L;;;;;N;;;;; +1455F;ANATOLIAN HIEROGLYPH A312;Lo;0;L;;;;;N;;;;; +14560;ANATOLIAN HIEROGLYPH A313;Lo;0;L;;;;;N;;;;; +14561;ANATOLIAN HIEROGLYPH A314;Lo;0;L;;;;;N;;;;; +14562;ANATOLIAN HIEROGLYPH A315;Lo;0;L;;;;;N;;;;; +14563;ANATOLIAN HIEROGLYPH A316;Lo;0;L;;;;;N;;;;; +14564;ANATOLIAN HIEROGLYPH A317;Lo;0;L;;;;;N;;;;; +14565;ANATOLIAN HIEROGLYPH A318;Lo;0;L;;;;;N;;;;; +14566;ANATOLIAN HIEROGLYPH A319;Lo;0;L;;;;;N;;;;; +14567;ANATOLIAN HIEROGLYPH A320;Lo;0;L;;;;;N;;;;; +14568;ANATOLIAN HIEROGLYPH A321;Lo;0;L;;;;;N;;;;; +14569;ANATOLIAN HIEROGLYPH A322;Lo;0;L;;;;;N;;;;; +1456A;ANATOLIAN HIEROGLYPH A323;Lo;0;L;;;;;N;;;;; +1456B;ANATOLIAN HIEROGLYPH A324;Lo;0;L;;;;;N;;;;; +1456C;ANATOLIAN HIEROGLYPH A325;Lo;0;L;;;;;N;;;;; +1456D;ANATOLIAN HIEROGLYPH A326;Lo;0;L;;;;;N;;;;; +1456E;ANATOLIAN HIEROGLYPH A327;Lo;0;L;;;;;N;;;;; +1456F;ANATOLIAN HIEROGLYPH A328;Lo;0;L;;;;;N;;;;; +14570;ANATOLIAN HIEROGLYPH A329;Lo;0;L;;;;;N;;;;; +14571;ANATOLIAN HIEROGLYPH A329A;Lo;0;L;;;;;N;;;;; +14572;ANATOLIAN HIEROGLYPH A330;Lo;0;L;;;;;N;;;;; +14573;ANATOLIAN HIEROGLYPH A331;Lo;0;L;;;;;N;;;;; +14574;ANATOLIAN HIEROGLYPH A332A;Lo;0;L;;;;;N;;;;; +14575;ANATOLIAN HIEROGLYPH A332B;Lo;0;L;;;;;N;;;;; +14576;ANATOLIAN HIEROGLYPH A332C;Lo;0;L;;;;;N;;;;; +14577;ANATOLIAN HIEROGLYPH A333;Lo;0;L;;;;;N;;;;; +14578;ANATOLIAN HIEROGLYPH A334;Lo;0;L;;;;;N;;;;; +14579;ANATOLIAN HIEROGLYPH A335;Lo;0;L;;;;;N;;;;; +1457A;ANATOLIAN HIEROGLYPH A336;Lo;0;L;;;;;N;;;;; +1457B;ANATOLIAN HIEROGLYPH A336A;Lo;0;L;;;;;N;;;;; +1457C;ANATOLIAN HIEROGLYPH A336B;Lo;0;L;;;;;N;;;;; +1457D;ANATOLIAN HIEROGLYPH A336C;Lo;0;L;;;;;N;;;;; +1457E;ANATOLIAN HIEROGLYPH A337;Lo;0;L;;;;;N;;;;; +1457F;ANATOLIAN HIEROGLYPH A338;Lo;0;L;;;;;N;;;;; +14580;ANATOLIAN HIEROGLYPH A339;Lo;0;L;;;;;N;;;;; +14581;ANATOLIAN HIEROGLYPH A340;Lo;0;L;;;;;N;;;;; +14582;ANATOLIAN HIEROGLYPH A341;Lo;0;L;;;;;N;;;;; +14583;ANATOLIAN HIEROGLYPH A342;Lo;0;L;;;;;N;;;;; +14584;ANATOLIAN HIEROGLYPH A343;Lo;0;L;;;;;N;;;;; +14585;ANATOLIAN HIEROGLYPH A344;Lo;0;L;;;;;N;;;;; +14586;ANATOLIAN HIEROGLYPH A345;Lo;0;L;;;;;N;;;;; +14587;ANATOLIAN HIEROGLYPH A346;Lo;0;L;;;;;N;;;;; +14588;ANATOLIAN HIEROGLYPH A347;Lo;0;L;;;;;N;;;;; +14589;ANATOLIAN HIEROGLYPH A348;Lo;0;L;;;;;N;;;;; +1458A;ANATOLIAN HIEROGLYPH A349;Lo;0;L;;;;;N;;;;; +1458B;ANATOLIAN HIEROGLYPH A350;Lo;0;L;;;;;N;;;;; +1458C;ANATOLIAN HIEROGLYPH A351;Lo;0;L;;;;;N;;;;; +1458D;ANATOLIAN HIEROGLYPH A352;Lo;0;L;;;;;N;;;;; +1458E;ANATOLIAN HIEROGLYPH A353;Lo;0;L;;;;;N;;;;; +1458F;ANATOLIAN HIEROGLYPH A354;Lo;0;L;;;;;N;;;;; +14590;ANATOLIAN HIEROGLYPH A355;Lo;0;L;;;;;N;;;;; +14591;ANATOLIAN HIEROGLYPH A356;Lo;0;L;;;;;N;;;;; +14592;ANATOLIAN HIEROGLYPH A357;Lo;0;L;;;;;N;;;;; +14593;ANATOLIAN HIEROGLYPH A358;Lo;0;L;;;;;N;;;;; +14594;ANATOLIAN HIEROGLYPH A359;Lo;0;L;;;;;N;;;;; +14595;ANATOLIAN HIEROGLYPH A359A;Lo;0;L;;;;;N;;;;; +14596;ANATOLIAN HIEROGLYPH A360;Lo;0;L;;;;;N;;;;; +14597;ANATOLIAN HIEROGLYPH A361;Lo;0;L;;;;;N;;;;; +14598;ANATOLIAN HIEROGLYPH A362;Lo;0;L;;;;;N;;;;; +14599;ANATOLIAN HIEROGLYPH A363;Lo;0;L;;;;;N;;;;; +1459A;ANATOLIAN HIEROGLYPH A364;Lo;0;L;;;;;N;;;;; +1459B;ANATOLIAN HIEROGLYPH A364A;Lo;0;L;;;;;N;;;;; +1459C;ANATOLIAN HIEROGLYPH A365;Lo;0;L;;;;;N;;;;; +1459D;ANATOLIAN HIEROGLYPH A366;Lo;0;L;;;;;N;;;;; +1459E;ANATOLIAN HIEROGLYPH A367;Lo;0;L;;;;;N;;;;; +1459F;ANATOLIAN HIEROGLYPH A368;Lo;0;L;;;;;N;;;;; +145A0;ANATOLIAN HIEROGLYPH A368A;Lo;0;L;;;;;N;;;;; +145A1;ANATOLIAN HIEROGLYPH A369;Lo;0;L;;;;;N;;;;; +145A2;ANATOLIAN HIEROGLYPH A370;Lo;0;L;;;;;N;;;;; +145A3;ANATOLIAN HIEROGLYPH A371;Lo;0;L;;;;;N;;;;; +145A4;ANATOLIAN HIEROGLYPH A371A;Lo;0;L;;;;;N;;;;; +145A5;ANATOLIAN HIEROGLYPH A372;Lo;0;L;;;;;N;;;;; +145A6;ANATOLIAN HIEROGLYPH A373;Lo;0;L;;;;;N;;;;; +145A7;ANATOLIAN HIEROGLYPH A374;Lo;0;L;;;;;N;;;;; +145A8;ANATOLIAN HIEROGLYPH A375;Lo;0;L;;;;;N;;;;; +145A9;ANATOLIAN HIEROGLYPH A376;Lo;0;L;;;;;N;;;;; +145AA;ANATOLIAN HIEROGLYPH A377;Lo;0;L;;;;;N;;;;; +145AB;ANATOLIAN HIEROGLYPH A378;Lo;0;L;;;;;N;;;;; +145AC;ANATOLIAN HIEROGLYPH A379;Lo;0;L;;;;;N;;;;; +145AD;ANATOLIAN HIEROGLYPH A380;Lo;0;L;;;;;N;;;;; +145AE;ANATOLIAN HIEROGLYPH A381;Lo;0;L;;;;;N;;;;; +145AF;ANATOLIAN HIEROGLYPH A381A;Lo;0;L;;;;;N;;;;; +145B0;ANATOLIAN HIEROGLYPH A382;Lo;0;L;;;;;N;;;;; +145B1;ANATOLIAN HIEROGLYPH A383 RA OR RI;Lo;0;L;;;;;N;;;;; +145B2;ANATOLIAN HIEROGLYPH A383A;Lo;0;L;;;;;N;;;;; +145B3;ANATOLIAN HIEROGLYPH A384;Lo;0;L;;;;;N;;;;; +145B4;ANATOLIAN HIEROGLYPH A385;Lo;0;L;;;;;N;;;;; +145B5;ANATOLIAN HIEROGLYPH A386;Lo;0;L;;;;;N;;;;; +145B6;ANATOLIAN HIEROGLYPH A386A;Lo;0;L;;;;;N;;;;; +145B7;ANATOLIAN HIEROGLYPH A387;Lo;0;L;;;;;N;;;;; +145B8;ANATOLIAN HIEROGLYPH A388;Lo;0;L;;;;;N;;;;; +145B9;ANATOLIAN HIEROGLYPH A389;Lo;0;L;;;;;N;;;;; +145BA;ANATOLIAN HIEROGLYPH A390;Lo;0;L;;;;;N;;;;; +145BB;ANATOLIAN HIEROGLYPH A391;Lo;0;L;;;;;N;;;;; +145BC;ANATOLIAN HIEROGLYPH A392;Lo;0;L;;;;;N;;;;; +145BD;ANATOLIAN HIEROGLYPH A393 EIGHT;Lo;0;L;;;;;N;;;;; +145BE;ANATOLIAN HIEROGLYPH A394;Lo;0;L;;;;;N;;;;; +145BF;ANATOLIAN HIEROGLYPH A395;Lo;0;L;;;;;N;;;;; +145C0;ANATOLIAN HIEROGLYPH A396;Lo;0;L;;;;;N;;;;; +145C1;ANATOLIAN HIEROGLYPH A397;Lo;0;L;;;;;N;;;;; +145C2;ANATOLIAN HIEROGLYPH A398;Lo;0;L;;;;;N;;;;; +145C3;ANATOLIAN HIEROGLYPH A399;Lo;0;L;;;;;N;;;;; +145C4;ANATOLIAN HIEROGLYPH A400;Lo;0;L;;;;;N;;;;; +145C5;ANATOLIAN HIEROGLYPH A401;Lo;0;L;;;;;N;;;;; +145C6;ANATOLIAN HIEROGLYPH A402;Lo;0;L;;;;;N;;;;; +145C7;ANATOLIAN HIEROGLYPH A403;Lo;0;L;;;;;N;;;;; +145C8;ANATOLIAN HIEROGLYPH A404;Lo;0;L;;;;;N;;;;; +145C9;ANATOLIAN HIEROGLYPH A405;Lo;0;L;;;;;N;;;;; +145CA;ANATOLIAN HIEROGLYPH A406;Lo;0;L;;;;;N;;;;; +145CB;ANATOLIAN HIEROGLYPH A407;Lo;0;L;;;;;N;;;;; +145CC;ANATOLIAN HIEROGLYPH A408;Lo;0;L;;;;;N;;;;; +145CD;ANATOLIAN HIEROGLYPH A409;Lo;0;L;;;;;N;;;;; +145CE;ANATOLIAN HIEROGLYPH A410 BEGIN LOGOGRAM MARK;Lo;0;L;;;;;N;;;;; +145CF;ANATOLIAN HIEROGLYPH A410A END LOGOGRAM MARK;Lo;0;L;;;;;N;;;;; +145D0;ANATOLIAN HIEROGLYPH A411;Lo;0;L;;;;;N;;;;; +145D1;ANATOLIAN HIEROGLYPH A412;Lo;0;L;;;;;N;;;;; +145D2;ANATOLIAN HIEROGLYPH A413;Lo;0;L;;;;;N;;;;; +145D3;ANATOLIAN HIEROGLYPH A414;Lo;0;L;;;;;N;;;;; +145D4;ANATOLIAN HIEROGLYPH A415;Lo;0;L;;;;;N;;;;; +145D5;ANATOLIAN HIEROGLYPH A416;Lo;0;L;;;;;N;;;;; +145D6;ANATOLIAN HIEROGLYPH A417;Lo;0;L;;;;;N;;;;; +145D7;ANATOLIAN HIEROGLYPH A418;Lo;0;L;;;;;N;;;;; +145D8;ANATOLIAN HIEROGLYPH A419;Lo;0;L;;;;;N;;;;; +145D9;ANATOLIAN HIEROGLYPH A420;Lo;0;L;;;;;N;;;;; +145DA;ANATOLIAN HIEROGLYPH A421;Lo;0;L;;;;;N;;;;; +145DB;ANATOLIAN HIEROGLYPH A422;Lo;0;L;;;;;N;;;;; +145DC;ANATOLIAN HIEROGLYPH A423;Lo;0;L;;;;;N;;;;; +145DD;ANATOLIAN HIEROGLYPH A424;Lo;0;L;;;;;N;;;;; +145DE;ANATOLIAN HIEROGLYPH A425;Lo;0;L;;;;;N;;;;; +145DF;ANATOLIAN HIEROGLYPH A426;Lo;0;L;;;;;N;;;;; +145E0;ANATOLIAN HIEROGLYPH A427;Lo;0;L;;;;;N;;;;; +145E1;ANATOLIAN HIEROGLYPH A428;Lo;0;L;;;;;N;;;;; +145E2;ANATOLIAN HIEROGLYPH A429;Lo;0;L;;;;;N;;;;; +145E3;ANATOLIAN HIEROGLYPH A430;Lo;0;L;;;;;N;;;;; +145E4;ANATOLIAN HIEROGLYPH A431;Lo;0;L;;;;;N;;;;; +145E5;ANATOLIAN HIEROGLYPH A432;Lo;0;L;;;;;N;;;;; +145E6;ANATOLIAN HIEROGLYPH A433;Lo;0;L;;;;;N;;;;; +145E7;ANATOLIAN HIEROGLYPH A434;Lo;0;L;;;;;N;;;;; +145E8;ANATOLIAN HIEROGLYPH A435;Lo;0;L;;;;;N;;;;; +145E9;ANATOLIAN HIEROGLYPH A436;Lo;0;L;;;;;N;;;;; +145EA;ANATOLIAN HIEROGLYPH A437;Lo;0;L;;;;;N;;;;; +145EB;ANATOLIAN HIEROGLYPH A438;Lo;0;L;;;;;N;;;;; +145EC;ANATOLIAN HIEROGLYPH A439;Lo;0;L;;;;;N;;;;; +145ED;ANATOLIAN HIEROGLYPH A440;Lo;0;L;;;;;N;;;;; +145EE;ANATOLIAN HIEROGLYPH A441;Lo;0;L;;;;;N;;;;; +145EF;ANATOLIAN HIEROGLYPH A442;Lo;0;L;;;;;N;;;;; +145F0;ANATOLIAN HIEROGLYPH A443;Lo;0;L;;;;;N;;;;; +145F1;ANATOLIAN HIEROGLYPH A444;Lo;0;L;;;;;N;;;;; +145F2;ANATOLIAN HIEROGLYPH A445;Lo;0;L;;;;;N;;;;; +145F3;ANATOLIAN HIEROGLYPH A446;Lo;0;L;;;;;N;;;;; +145F4;ANATOLIAN HIEROGLYPH A447;Lo;0;L;;;;;N;;;;; +145F5;ANATOLIAN HIEROGLYPH A448;Lo;0;L;;;;;N;;;;; +145F6;ANATOLIAN HIEROGLYPH A449;Lo;0;L;;;;;N;;;;; +145F7;ANATOLIAN HIEROGLYPH A450;Lo;0;L;;;;;N;;;;; +145F8;ANATOLIAN HIEROGLYPH A450A;Lo;0;L;;;;;N;;;;; +145F9;ANATOLIAN HIEROGLYPH A451;Lo;0;L;;;;;N;;;;; +145FA;ANATOLIAN HIEROGLYPH A452;Lo;0;L;;;;;N;;;;; +145FB;ANATOLIAN HIEROGLYPH A453;Lo;0;L;;;;;N;;;;; +145FC;ANATOLIAN HIEROGLYPH A454;Lo;0;L;;;;;N;;;;; +145FD;ANATOLIAN HIEROGLYPH A455;Lo;0;L;;;;;N;;;;; +145FE;ANATOLIAN HIEROGLYPH A456;Lo;0;L;;;;;N;;;;; +145FF;ANATOLIAN HIEROGLYPH A457;Lo;0;L;;;;;N;;;;; +14600;ANATOLIAN HIEROGLYPH A457A;Lo;0;L;;;;;N;;;;; +14601;ANATOLIAN HIEROGLYPH A458;Lo;0;L;;;;;N;;;;; +14602;ANATOLIAN HIEROGLYPH A459;Lo;0;L;;;;;N;;;;; +14603;ANATOLIAN HIEROGLYPH A460;Lo;0;L;;;;;N;;;;; +14604;ANATOLIAN HIEROGLYPH A461;Lo;0;L;;;;;N;;;;; +14605;ANATOLIAN HIEROGLYPH A462;Lo;0;L;;;;;N;;;;; +14606;ANATOLIAN HIEROGLYPH A463;Lo;0;L;;;;;N;;;;; +14607;ANATOLIAN HIEROGLYPH A464;Lo;0;L;;;;;N;;;;; +14608;ANATOLIAN HIEROGLYPH A465;Lo;0;L;;;;;N;;;;; +14609;ANATOLIAN HIEROGLYPH A466;Lo;0;L;;;;;N;;;;; +1460A;ANATOLIAN HIEROGLYPH A467;Lo;0;L;;;;;N;;;;; +1460B;ANATOLIAN HIEROGLYPH A468;Lo;0;L;;;;;N;;;;; +1460C;ANATOLIAN HIEROGLYPH A469;Lo;0;L;;;;;N;;;;; +1460D;ANATOLIAN HIEROGLYPH A470;Lo;0;L;;;;;N;;;;; +1460E;ANATOLIAN HIEROGLYPH A471;Lo;0;L;;;;;N;;;;; +1460F;ANATOLIAN HIEROGLYPH A472;Lo;0;L;;;;;N;;;;; +14610;ANATOLIAN HIEROGLYPH A473;Lo;0;L;;;;;N;;;;; +14611;ANATOLIAN HIEROGLYPH A474;Lo;0;L;;;;;N;;;;; +14612;ANATOLIAN HIEROGLYPH A475;Lo;0;L;;;;;N;;;;; +14613;ANATOLIAN HIEROGLYPH A476;Lo;0;L;;;;;N;;;;; +14614;ANATOLIAN HIEROGLYPH A477;Lo;0;L;;;;;N;;;;; +14615;ANATOLIAN HIEROGLYPH A478;Lo;0;L;;;;;N;;;;; +14616;ANATOLIAN HIEROGLYPH A479;Lo;0;L;;;;;N;;;;; +14617;ANATOLIAN HIEROGLYPH A480;Lo;0;L;;;;;N;;;;; +14618;ANATOLIAN HIEROGLYPH A481;Lo;0;L;;;;;N;;;;; +14619;ANATOLIAN HIEROGLYPH A482;Lo;0;L;;;;;N;;;;; +1461A;ANATOLIAN HIEROGLYPH A483;Lo;0;L;;;;;N;;;;; +1461B;ANATOLIAN HIEROGLYPH A484;Lo;0;L;;;;;N;;;;; +1461C;ANATOLIAN HIEROGLYPH A485;Lo;0;L;;;;;N;;;;; +1461D;ANATOLIAN HIEROGLYPH A486;Lo;0;L;;;;;N;;;;; +1461E;ANATOLIAN HIEROGLYPH A487;Lo;0;L;;;;;N;;;;; +1461F;ANATOLIAN HIEROGLYPH A488;Lo;0;L;;;;;N;;;;; +14620;ANATOLIAN HIEROGLYPH A489;Lo;0;L;;;;;N;;;;; +14621;ANATOLIAN HIEROGLYPH A490;Lo;0;L;;;;;N;;;;; +14622;ANATOLIAN HIEROGLYPH A491;Lo;0;L;;;;;N;;;;; +14623;ANATOLIAN HIEROGLYPH A492;Lo;0;L;;;;;N;;;;; +14624;ANATOLIAN HIEROGLYPH A493;Lo;0;L;;;;;N;;;;; +14625;ANATOLIAN HIEROGLYPH A494;Lo;0;L;;;;;N;;;;; +14626;ANATOLIAN HIEROGLYPH A495;Lo;0;L;;;;;N;;;;; +14627;ANATOLIAN HIEROGLYPH A496;Lo;0;L;;;;;N;;;;; +14628;ANATOLIAN HIEROGLYPH A497;Lo;0;L;;;;;N;;;;; +14629;ANATOLIAN HIEROGLYPH A501;Lo;0;L;;;;;N;;;;; +1462A;ANATOLIAN HIEROGLYPH A502;Lo;0;L;;;;;N;;;;; +1462B;ANATOLIAN HIEROGLYPH A503;Lo;0;L;;;;;N;;;;; +1462C;ANATOLIAN HIEROGLYPH A504;Lo;0;L;;;;;N;;;;; +1462D;ANATOLIAN HIEROGLYPH A505;Lo;0;L;;;;;N;;;;; +1462E;ANATOLIAN HIEROGLYPH A506;Lo;0;L;;;;;N;;;;; +1462F;ANATOLIAN HIEROGLYPH A507;Lo;0;L;;;;;N;;;;; +14630;ANATOLIAN HIEROGLYPH A508;Lo;0;L;;;;;N;;;;; +14631;ANATOLIAN HIEROGLYPH A509;Lo;0;L;;;;;N;;;;; +14632;ANATOLIAN HIEROGLYPH A510;Lo;0;L;;;;;N;;;;; +14633;ANATOLIAN HIEROGLYPH A511;Lo;0;L;;;;;N;;;;; +14634;ANATOLIAN HIEROGLYPH A512;Lo;0;L;;;;;N;;;;; +14635;ANATOLIAN HIEROGLYPH A513;Lo;0;L;;;;;N;;;;; +14636;ANATOLIAN HIEROGLYPH A514;Lo;0;L;;;;;N;;;;; +14637;ANATOLIAN HIEROGLYPH A515;Lo;0;L;;;;;N;;;;; +14638;ANATOLIAN HIEROGLYPH A516;Lo;0;L;;;;;N;;;;; +14639;ANATOLIAN HIEROGLYPH A517;Lo;0;L;;;;;N;;;;; +1463A;ANATOLIAN HIEROGLYPH A518;Lo;0;L;;;;;N;;;;; +1463B;ANATOLIAN HIEROGLYPH A519;Lo;0;L;;;;;N;;;;; +1463C;ANATOLIAN HIEROGLYPH A520;Lo;0;L;;;;;N;;;;; +1463D;ANATOLIAN HIEROGLYPH A521;Lo;0;L;;;;;N;;;;; +1463E;ANATOLIAN HIEROGLYPH A522;Lo;0;L;;;;;N;;;;; +1463F;ANATOLIAN HIEROGLYPH A523;Lo;0;L;;;;;N;;;;; +14640;ANATOLIAN HIEROGLYPH A524;Lo;0;L;;;;;N;;;;; +14641;ANATOLIAN HIEROGLYPH A525;Lo;0;L;;;;;N;;;;; +14642;ANATOLIAN HIEROGLYPH A526;Lo;0;L;;;;;N;;;;; +14643;ANATOLIAN HIEROGLYPH A527;Lo;0;L;;;;;N;;;;; +14644;ANATOLIAN HIEROGLYPH A528;Lo;0;L;;;;;N;;;;; +14645;ANATOLIAN HIEROGLYPH A529;Lo;0;L;;;;;N;;;;; +14646;ANATOLIAN HIEROGLYPH A530;Lo;0;L;;;;;N;;;;; +16800;BAMUM LETTER PHASE-A NGKUE MFON;Lo;0;L;;;;;N;;;;; +16801;BAMUM LETTER PHASE-A GBIEE FON;Lo;0;L;;;;;N;;;;; +16802;BAMUM LETTER PHASE-A PON MFON PIPAEMGBIEE;Lo;0;L;;;;;N;;;;; +16803;BAMUM LETTER PHASE-A PON MFON PIPAEMBA;Lo;0;L;;;;;N;;;;; +16804;BAMUM LETTER PHASE-A NAA MFON;Lo;0;L;;;;;N;;;;; +16805;BAMUM LETTER PHASE-A SHUENSHUET;Lo;0;L;;;;;N;;;;; +16806;BAMUM LETTER PHASE-A TITA MFON;Lo;0;L;;;;;N;;;;; +16807;BAMUM LETTER PHASE-A NZA MFON;Lo;0;L;;;;;N;;;;; +16808;BAMUM LETTER PHASE-A SHINDA PA NJI;Lo;0;L;;;;;N;;;;; +16809;BAMUM LETTER PHASE-A PON PA NJI PIPAEMGBIEE;Lo;0;L;;;;;N;;;;; +1680A;BAMUM LETTER PHASE-A PON PA NJI PIPAEMBA;Lo;0;L;;;;;N;;;;; +1680B;BAMUM LETTER PHASE-A MAEMBGBIEE;Lo;0;L;;;;;N;;;;; +1680C;BAMUM LETTER PHASE-A TU MAEMBA;Lo;0;L;;;;;N;;;;; +1680D;BAMUM LETTER PHASE-A NGANGU;Lo;0;L;;;;;N;;;;; +1680E;BAMUM LETTER PHASE-A MAEMVEUX;Lo;0;L;;;;;N;;;;; +1680F;BAMUM LETTER PHASE-A MANSUAE;Lo;0;L;;;;;N;;;;; +16810;BAMUM LETTER PHASE-A MVEUAENGAM;Lo;0;L;;;;;N;;;;; +16811;BAMUM LETTER PHASE-A SEUNYAM;Lo;0;L;;;;;N;;;;; +16812;BAMUM LETTER PHASE-A NTOQPEN;Lo;0;L;;;;;N;;;;; +16813;BAMUM LETTER PHASE-A KEUKEUTNDA;Lo;0;L;;;;;N;;;;; +16814;BAMUM LETTER PHASE-A NKINDI;Lo;0;L;;;;;N;;;;; +16815;BAMUM LETTER PHASE-A SUU;Lo;0;L;;;;;N;;;;; +16816;BAMUM LETTER PHASE-A NGKUENZEUM;Lo;0;L;;;;;N;;;;; +16817;BAMUM LETTER PHASE-A LAPAQ;Lo;0;L;;;;;N;;;;; +16818;BAMUM LETTER PHASE-A LET KUT;Lo;0;L;;;;;N;;;;; +16819;BAMUM LETTER PHASE-A NTAP MFAA;Lo;0;L;;;;;N;;;;; +1681A;BAMUM LETTER PHASE-A MAEKEUP;Lo;0;L;;;;;N;;;;; +1681B;BAMUM LETTER PHASE-A PASHAE;Lo;0;L;;;;;N;;;;; +1681C;BAMUM LETTER PHASE-A GHEUAERAE;Lo;0;L;;;;;N;;;;; +1681D;BAMUM LETTER PHASE-A PAMSHAE;Lo;0;L;;;;;N;;;;; +1681E;BAMUM LETTER PHASE-A MON NGGEUAET;Lo;0;L;;;;;N;;;;; +1681F;BAMUM LETTER PHASE-A NZUN MEUT;Lo;0;L;;;;;N;;;;; +16820;BAMUM LETTER PHASE-A U YUQ NAE;Lo;0;L;;;;;N;;;;; +16821;BAMUM LETTER PHASE-A GHEUAEGHEUAE;Lo;0;L;;;;;N;;;;; +16822;BAMUM LETTER PHASE-A NTAP NTAA;Lo;0;L;;;;;N;;;;; +16823;BAMUM LETTER PHASE-A SISA;Lo;0;L;;;;;N;;;;; +16824;BAMUM LETTER PHASE-A MGBASA;Lo;0;L;;;;;N;;;;; +16825;BAMUM LETTER PHASE-A MEUNJOMNDEUQ;Lo;0;L;;;;;N;;;;; +16826;BAMUM LETTER PHASE-A MOOMPUQ;Lo;0;L;;;;;N;;;;; +16827;BAMUM LETTER PHASE-A KAFA;Lo;0;L;;;;;N;;;;; +16828;BAMUM LETTER PHASE-A PA LEERAEWA;Lo;0;L;;;;;N;;;;; +16829;BAMUM LETTER PHASE-A NDA LEERAEWA;Lo;0;L;;;;;N;;;;; +1682A;BAMUM LETTER PHASE-A PET;Lo;0;L;;;;;N;;;;; +1682B;BAMUM LETTER PHASE-A MAEMKPEN;Lo;0;L;;;;;N;;;;; +1682C;BAMUM LETTER PHASE-A NIKA;Lo;0;L;;;;;N;;;;; +1682D;BAMUM LETTER PHASE-A PUP;Lo;0;L;;;;;N;;;;; +1682E;BAMUM LETTER PHASE-A TUAEP;Lo;0;L;;;;;N;;;;; +1682F;BAMUM LETTER PHASE-A LUAEP;Lo;0;L;;;;;N;;;;; +16830;BAMUM LETTER PHASE-A SONJAM;Lo;0;L;;;;;N;;;;; +16831;BAMUM LETTER PHASE-A TEUTEUWEN;Lo;0;L;;;;;N;;;;; +16832;BAMUM LETTER PHASE-A MAENYI;Lo;0;L;;;;;N;;;;; +16833;BAMUM LETTER PHASE-A KET;Lo;0;L;;;;;N;;;;; +16834;BAMUM LETTER PHASE-A NDAANGGEUAET;Lo;0;L;;;;;N;;;;; +16835;BAMUM LETTER PHASE-A KUOQ;Lo;0;L;;;;;N;;;;; +16836;BAMUM LETTER PHASE-A MOOMEUT;Lo;0;L;;;;;N;;;;; +16837;BAMUM LETTER PHASE-A SHUM;Lo;0;L;;;;;N;;;;; +16838;BAMUM LETTER PHASE-A LOMMAE;Lo;0;L;;;;;N;;;;; +16839;BAMUM LETTER PHASE-A FIRI;Lo;0;L;;;;;N;;;;; +1683A;BAMUM LETTER PHASE-A ROM;Lo;0;L;;;;;N;;;;; +1683B;BAMUM LETTER PHASE-A KPOQ;Lo;0;L;;;;;N;;;;; +1683C;BAMUM LETTER PHASE-A SOQ;Lo;0;L;;;;;N;;;;; +1683D;BAMUM LETTER PHASE-A MAP PIEET;Lo;0;L;;;;;N;;;;; +1683E;BAMUM LETTER PHASE-A SHIRAE;Lo;0;L;;;;;N;;;;; +1683F;BAMUM LETTER PHASE-A NTAP;Lo;0;L;;;;;N;;;;; +16840;BAMUM LETTER PHASE-A SHOQ NSHUT YUM;Lo;0;L;;;;;N;;;;; +16841;BAMUM LETTER PHASE-A NYIT MONGKEUAEQ;Lo;0;L;;;;;N;;;;; +16842;BAMUM LETTER PHASE-A PAARAE;Lo;0;L;;;;;N;;;;; +16843;BAMUM LETTER PHASE-A NKAARAE;Lo;0;L;;;;;N;;;;; +16844;BAMUM LETTER PHASE-A UNKNOWN;Lo;0;L;;;;;N;;;;; +16845;BAMUM LETTER PHASE-A NGGEN;Lo;0;L;;;;;N;;;;; +16846;BAMUM LETTER PHASE-A MAESI;Lo;0;L;;;;;N;;;;; +16847;BAMUM LETTER PHASE-A NJAM;Lo;0;L;;;;;N;;;;; +16848;BAMUM LETTER PHASE-A MBANYI;Lo;0;L;;;;;N;;;;; +16849;BAMUM LETTER PHASE-A NYET;Lo;0;L;;;;;N;;;;; +1684A;BAMUM LETTER PHASE-A TEUAEN;Lo;0;L;;;;;N;;;;; +1684B;BAMUM LETTER PHASE-A SOT;Lo;0;L;;;;;N;;;;; +1684C;BAMUM LETTER PHASE-A PAAM;Lo;0;L;;;;;N;;;;; +1684D;BAMUM LETTER PHASE-A NSHIEE;Lo;0;L;;;;;N;;;;; +1684E;BAMUM LETTER PHASE-A MAEM;Lo;0;L;;;;;N;;;;; +1684F;BAMUM LETTER PHASE-A NYI;Lo;0;L;;;;;N;;;;; +16850;BAMUM LETTER PHASE-A KAQ;Lo;0;L;;;;;N;;;;; +16851;BAMUM LETTER PHASE-A NSHA;Lo;0;L;;;;;N;;;;; +16852;BAMUM LETTER PHASE-A VEE;Lo;0;L;;;;;N;;;;; +16853;BAMUM LETTER PHASE-A LU;Lo;0;L;;;;;N;;;;; +16854;BAMUM LETTER PHASE-A NEN;Lo;0;L;;;;;N;;;;; +16855;BAMUM LETTER PHASE-A NAQ;Lo;0;L;;;;;N;;;;; +16856;BAMUM LETTER PHASE-A MBAQ;Lo;0;L;;;;;N;;;;; +16857;BAMUM LETTER PHASE-B NSHUET;Lo;0;L;;;;;N;;;;; +16858;BAMUM LETTER PHASE-B TU MAEMGBIEE;Lo;0;L;;;;;N;;;;; +16859;BAMUM LETTER PHASE-B SIEE;Lo;0;L;;;;;N;;;;; +1685A;BAMUM LETTER PHASE-B SET TU;Lo;0;L;;;;;N;;;;; +1685B;BAMUM LETTER PHASE-B LOM NTEUM;Lo;0;L;;;;;N;;;;; +1685C;BAMUM LETTER PHASE-B MBA MAELEE;Lo;0;L;;;;;N;;;;; +1685D;BAMUM LETTER PHASE-B KIEEM;Lo;0;L;;;;;N;;;;; +1685E;BAMUM LETTER PHASE-B YEURAE;Lo;0;L;;;;;N;;;;; +1685F;BAMUM LETTER PHASE-B MBAARAE;Lo;0;L;;;;;N;;;;; +16860;BAMUM LETTER PHASE-B KAM;Lo;0;L;;;;;N;;;;; +16861;BAMUM LETTER PHASE-B PEESHI;Lo;0;L;;;;;N;;;;; +16862;BAMUM LETTER PHASE-B YAFU LEERAEWA;Lo;0;L;;;;;N;;;;; +16863;BAMUM LETTER PHASE-B LAM NSHUT NYAM;Lo;0;L;;;;;N;;;;; +16864;BAMUM LETTER PHASE-B NTIEE SHEUOQ;Lo;0;L;;;;;N;;;;; +16865;BAMUM LETTER PHASE-B NDU NJAA;Lo;0;L;;;;;N;;;;; +16866;BAMUM LETTER PHASE-B GHEUGHEUAEM;Lo;0;L;;;;;N;;;;; +16867;BAMUM LETTER PHASE-B PIT;Lo;0;L;;;;;N;;;;; +16868;BAMUM LETTER PHASE-B TU NSIEE;Lo;0;L;;;;;N;;;;; +16869;BAMUM LETTER PHASE-B SHET NJAQ;Lo;0;L;;;;;N;;;;; +1686A;BAMUM LETTER PHASE-B SHEUAEQTU;Lo;0;L;;;;;N;;;;; +1686B;BAMUM LETTER PHASE-B MFON TEUAEQ;Lo;0;L;;;;;N;;;;; +1686C;BAMUM LETTER PHASE-B MBIT MBAAKET;Lo;0;L;;;;;N;;;;; +1686D;BAMUM LETTER PHASE-B NYI NTEUM;Lo;0;L;;;;;N;;;;; +1686E;BAMUM LETTER PHASE-B KEUPUQ;Lo;0;L;;;;;N;;;;; +1686F;BAMUM LETTER PHASE-B GHEUGHEN;Lo;0;L;;;;;N;;;;; +16870;BAMUM LETTER PHASE-B KEUYEUX;Lo;0;L;;;;;N;;;;; +16871;BAMUM LETTER PHASE-B LAANAE;Lo;0;L;;;;;N;;;;; +16872;BAMUM LETTER PHASE-B PARUM;Lo;0;L;;;;;N;;;;; +16873;BAMUM LETTER PHASE-B VEUM;Lo;0;L;;;;;N;;;;; +16874;BAMUM LETTER PHASE-B NGKINDI MVOP;Lo;0;L;;;;;N;;;;; +16875;BAMUM LETTER PHASE-B NGGEU MBU;Lo;0;L;;;;;N;;;;; +16876;BAMUM LETTER PHASE-B WUAET;Lo;0;L;;;;;N;;;;; +16877;BAMUM LETTER PHASE-B SAKEUAE;Lo;0;L;;;;;N;;;;; +16878;BAMUM LETTER PHASE-B TAAM;Lo;0;L;;;;;N;;;;; +16879;BAMUM LETTER PHASE-B MEUQ;Lo;0;L;;;;;N;;;;; +1687A;BAMUM LETTER PHASE-B NGGUOQ;Lo;0;L;;;;;N;;;;; +1687B;BAMUM LETTER PHASE-B NGGUOQ LARGE;Lo;0;L;;;;;N;;;;; +1687C;BAMUM LETTER PHASE-B MFIYAQ;Lo;0;L;;;;;N;;;;; +1687D;BAMUM LETTER PHASE-B SUE;Lo;0;L;;;;;N;;;;; +1687E;BAMUM LETTER PHASE-B MBEURI;Lo;0;L;;;;;N;;;;; +1687F;BAMUM LETTER PHASE-B MONTIEEN;Lo;0;L;;;;;N;;;;; +16880;BAMUM LETTER PHASE-B NYAEMAE;Lo;0;L;;;;;N;;;;; +16881;BAMUM LETTER PHASE-B PUNGAAM;Lo;0;L;;;;;N;;;;; +16882;BAMUM LETTER PHASE-B MEUT NGGEET;Lo;0;L;;;;;N;;;;; +16883;BAMUM LETTER PHASE-B FEUX;Lo;0;L;;;;;N;;;;; +16884;BAMUM LETTER PHASE-B MBUOQ;Lo;0;L;;;;;N;;;;; +16885;BAMUM LETTER PHASE-B FEE;Lo;0;L;;;;;N;;;;; +16886;BAMUM LETTER PHASE-B KEUAEM;Lo;0;L;;;;;N;;;;; +16887;BAMUM LETTER PHASE-B MA NJEUAENA;Lo;0;L;;;;;N;;;;; +16888;BAMUM LETTER PHASE-B MA NJUQA;Lo;0;L;;;;;N;;;;; +16889;BAMUM LETTER PHASE-B LET;Lo;0;L;;;;;N;;;;; +1688A;BAMUM LETTER PHASE-B NGGAAM;Lo;0;L;;;;;N;;;;; +1688B;BAMUM LETTER PHASE-B NSEN;Lo;0;L;;;;;N;;;;; +1688C;BAMUM LETTER PHASE-B MA;Lo;0;L;;;;;N;;;;; +1688D;BAMUM LETTER PHASE-B KIQ;Lo;0;L;;;;;N;;;;; +1688E;BAMUM LETTER PHASE-B NGOM;Lo;0;L;;;;;N;;;;; +1688F;BAMUM LETTER PHASE-C NGKUE MAEMBA;Lo;0;L;;;;;N;;;;; +16890;BAMUM LETTER PHASE-C NZA;Lo;0;L;;;;;N;;;;; +16891;BAMUM LETTER PHASE-C YUM;Lo;0;L;;;;;N;;;;; +16892;BAMUM LETTER PHASE-C WANGKUOQ;Lo;0;L;;;;;N;;;;; +16893;BAMUM LETTER PHASE-C NGGEN;Lo;0;L;;;;;N;;;;; +16894;BAMUM LETTER PHASE-C NDEUAEREE;Lo;0;L;;;;;N;;;;; +16895;BAMUM LETTER PHASE-C NGKAQ;Lo;0;L;;;;;N;;;;; +16896;BAMUM LETTER PHASE-C GHARAE;Lo;0;L;;;;;N;;;;; +16897;BAMUM LETTER PHASE-C MBEEKEET;Lo;0;L;;;;;N;;;;; +16898;BAMUM LETTER PHASE-C GBAYI;Lo;0;L;;;;;N;;;;; +16899;BAMUM LETTER PHASE-C NYIR MKPARAQ MEUN;Lo;0;L;;;;;N;;;;; +1689A;BAMUM LETTER PHASE-C NTU MBIT;Lo;0;L;;;;;N;;;;; +1689B;BAMUM LETTER PHASE-C MBEUM;Lo;0;L;;;;;N;;;;; +1689C;BAMUM LETTER PHASE-C PIRIEEN;Lo;0;L;;;;;N;;;;; +1689D;BAMUM LETTER PHASE-C NDOMBU;Lo;0;L;;;;;N;;;;; +1689E;BAMUM LETTER PHASE-C MBAA CABBAGE-TREE;Lo;0;L;;;;;N;;;;; +1689F;BAMUM LETTER PHASE-C KEUSHEUAEP;Lo;0;L;;;;;N;;;;; +168A0;BAMUM LETTER PHASE-C GHAP;Lo;0;L;;;;;N;;;;; +168A1;BAMUM LETTER PHASE-C KEUKAQ;Lo;0;L;;;;;N;;;;; +168A2;BAMUM LETTER PHASE-C YU MUOMAE;Lo;0;L;;;;;N;;;;; +168A3;BAMUM LETTER PHASE-C NZEUM;Lo;0;L;;;;;N;;;;; +168A4;BAMUM LETTER PHASE-C MBUE;Lo;0;L;;;;;N;;;;; +168A5;BAMUM LETTER PHASE-C NSEUAEN;Lo;0;L;;;;;N;;;;; +168A6;BAMUM LETTER PHASE-C MBIT;Lo;0;L;;;;;N;;;;; +168A7;BAMUM LETTER PHASE-C YEUQ;Lo;0;L;;;;;N;;;;; +168A8;BAMUM LETTER PHASE-C KPARAQ;Lo;0;L;;;;;N;;;;; +168A9;BAMUM LETTER PHASE-C KAA;Lo;0;L;;;;;N;;;;; +168AA;BAMUM LETTER PHASE-C SEUX;Lo;0;L;;;;;N;;;;; +168AB;BAMUM LETTER PHASE-C NDIDA;Lo;0;L;;;;;N;;;;; +168AC;BAMUM LETTER PHASE-C TAASHAE;Lo;0;L;;;;;N;;;;; +168AD;BAMUM LETTER PHASE-C NJUEQ;Lo;0;L;;;;;N;;;;; +168AE;BAMUM LETTER PHASE-C TITA YUE;Lo;0;L;;;;;N;;;;; +168AF;BAMUM LETTER PHASE-C SUAET;Lo;0;L;;;;;N;;;;; +168B0;BAMUM LETTER PHASE-C NGGUAEN NYAM;Lo;0;L;;;;;N;;;;; +168B1;BAMUM LETTER PHASE-C VEUX;Lo;0;L;;;;;N;;;;; +168B2;BAMUM LETTER PHASE-C NANSANAQ;Lo;0;L;;;;;N;;;;; +168B3;BAMUM LETTER PHASE-C MA KEUAERI;Lo;0;L;;;;;N;;;;; +168B4;BAMUM LETTER PHASE-C NTAA;Lo;0;L;;;;;N;;;;; +168B5;BAMUM LETTER PHASE-C NGGUON;Lo;0;L;;;;;N;;;;; +168B6;BAMUM LETTER PHASE-C LAP;Lo;0;L;;;;;N;;;;; +168B7;BAMUM LETTER PHASE-C MBIRIEEN;Lo;0;L;;;;;N;;;;; +168B8;BAMUM LETTER PHASE-C MGBASAQ;Lo;0;L;;;;;N;;;;; +168B9;BAMUM LETTER PHASE-C NTEUNGBA;Lo;0;L;;;;;N;;;;; +168BA;BAMUM LETTER PHASE-C TEUTEUX;Lo;0;L;;;;;N;;;;; +168BB;BAMUM LETTER PHASE-C NGGUM;Lo;0;L;;;;;N;;;;; +168BC;BAMUM LETTER PHASE-C FUE;Lo;0;L;;;;;N;;;;; +168BD;BAMUM LETTER PHASE-C NDEUT;Lo;0;L;;;;;N;;;;; +168BE;BAMUM LETTER PHASE-C NSA;Lo;0;L;;;;;N;;;;; +168BF;BAMUM LETTER PHASE-C NSHAQ;Lo;0;L;;;;;N;;;;; +168C0;BAMUM LETTER PHASE-C BUNG;Lo;0;L;;;;;N;;;;; +168C1;BAMUM LETTER PHASE-C VEUAEPEN;Lo;0;L;;;;;N;;;;; +168C2;BAMUM LETTER PHASE-C MBERAE;Lo;0;L;;;;;N;;;;; +168C3;BAMUM LETTER PHASE-C RU;Lo;0;L;;;;;N;;;;; +168C4;BAMUM LETTER PHASE-C NJAEM;Lo;0;L;;;;;N;;;;; +168C5;BAMUM LETTER PHASE-C LAM;Lo;0;L;;;;;N;;;;; +168C6;BAMUM LETTER PHASE-C TITUAEP;Lo;0;L;;;;;N;;;;; +168C7;BAMUM LETTER PHASE-C NSUOT NGOM;Lo;0;L;;;;;N;;;;; +168C8;BAMUM LETTER PHASE-C NJEEEE;Lo;0;L;;;;;N;;;;; +168C9;BAMUM LETTER PHASE-C KET;Lo;0;L;;;;;N;;;;; +168CA;BAMUM LETTER PHASE-C NGGU;Lo;0;L;;;;;N;;;;; +168CB;BAMUM LETTER PHASE-C MAESI;Lo;0;L;;;;;N;;;;; +168CC;BAMUM LETTER PHASE-C MBUAEM;Lo;0;L;;;;;N;;;;; +168CD;BAMUM LETTER PHASE-C LU;Lo;0;L;;;;;N;;;;; +168CE;BAMUM LETTER PHASE-C KUT;Lo;0;L;;;;;N;;;;; +168CF;BAMUM LETTER PHASE-C NJAM;Lo;0;L;;;;;N;;;;; +168D0;BAMUM LETTER PHASE-C NGOM;Lo;0;L;;;;;N;;;;; +168D1;BAMUM LETTER PHASE-C WUP;Lo;0;L;;;;;N;;;;; +168D2;BAMUM LETTER PHASE-C NGGUEET;Lo;0;L;;;;;N;;;;; +168D3;BAMUM LETTER PHASE-C NSOM;Lo;0;L;;;;;N;;;;; +168D4;BAMUM LETTER PHASE-C NTEN;Lo;0;L;;;;;N;;;;; +168D5;BAMUM LETTER PHASE-C KUOP NKAARAE;Lo;0;L;;;;;N;;;;; +168D6;BAMUM LETTER PHASE-C NSUN;Lo;0;L;;;;;N;;;;; +168D7;BAMUM LETTER PHASE-C NDAM;Lo;0;L;;;;;N;;;;; +168D8;BAMUM LETTER PHASE-C MA NSIEE;Lo;0;L;;;;;N;;;;; +168D9;BAMUM LETTER PHASE-C YAA;Lo;0;L;;;;;N;;;;; +168DA;BAMUM LETTER PHASE-C NDAP;Lo;0;L;;;;;N;;;;; +168DB;BAMUM LETTER PHASE-C SHUEQ;Lo;0;L;;;;;N;;;;; +168DC;BAMUM LETTER PHASE-C SETFON;Lo;0;L;;;;;N;;;;; +168DD;BAMUM LETTER PHASE-C MBI;Lo;0;L;;;;;N;;;;; +168DE;BAMUM LETTER PHASE-C MAEMBA;Lo;0;L;;;;;N;;;;; +168DF;BAMUM LETTER PHASE-C MBANYI;Lo;0;L;;;;;N;;;;; +168E0;BAMUM LETTER PHASE-C KEUSEUX;Lo;0;L;;;;;N;;;;; +168E1;BAMUM LETTER PHASE-C MBEUX;Lo;0;L;;;;;N;;;;; +168E2;BAMUM LETTER PHASE-C KEUM;Lo;0;L;;;;;N;;;;; +168E3;BAMUM LETTER PHASE-C MBAA PICKET;Lo;0;L;;;;;N;;;;; +168E4;BAMUM LETTER PHASE-C YUWOQ;Lo;0;L;;;;;N;;;;; +168E5;BAMUM LETTER PHASE-C NJEUX;Lo;0;L;;;;;N;;;;; +168E6;BAMUM LETTER PHASE-C MIEE;Lo;0;L;;;;;N;;;;; +168E7;BAMUM LETTER PHASE-C MUAE;Lo;0;L;;;;;N;;;;; +168E8;BAMUM LETTER PHASE-C SHIQ;Lo;0;L;;;;;N;;;;; +168E9;BAMUM LETTER PHASE-C KEN LAW;Lo;0;L;;;;;N;;;;; +168EA;BAMUM LETTER PHASE-C KEN FATIGUE;Lo;0;L;;;;;N;;;;; +168EB;BAMUM LETTER PHASE-C NGAQ;Lo;0;L;;;;;N;;;;; +168EC;BAMUM LETTER PHASE-C NAQ;Lo;0;L;;;;;N;;;;; +168ED;BAMUM LETTER PHASE-C LIQ;Lo;0;L;;;;;N;;;;; +168EE;BAMUM LETTER PHASE-C PIN;Lo;0;L;;;;;N;;;;; +168EF;BAMUM LETTER PHASE-C PEN;Lo;0;L;;;;;N;;;;; +168F0;BAMUM LETTER PHASE-C TET;Lo;0;L;;;;;N;;;;; +168F1;BAMUM LETTER PHASE-D MBUO;Lo;0;L;;;;;N;;;;; +168F2;BAMUM LETTER PHASE-D WAP;Lo;0;L;;;;;N;;;;; +168F3;BAMUM LETTER PHASE-D NJI;Lo;0;L;;;;;N;;;;; +168F4;BAMUM LETTER PHASE-D MFON;Lo;0;L;;;;;N;;;;; +168F5;BAMUM LETTER PHASE-D NJIEE;Lo;0;L;;;;;N;;;;; +168F6;BAMUM LETTER PHASE-D LIEE;Lo;0;L;;;;;N;;;;; +168F7;BAMUM LETTER PHASE-D NJEUT;Lo;0;L;;;;;N;;;;; +168F8;BAMUM LETTER PHASE-D NSHEE;Lo;0;L;;;;;N;;;;; +168F9;BAMUM LETTER PHASE-D NGGAAMAE;Lo;0;L;;;;;N;;;;; +168FA;BAMUM LETTER PHASE-D NYAM;Lo;0;L;;;;;N;;;;; +168FB;BAMUM LETTER PHASE-D WUAEN;Lo;0;L;;;;;N;;;;; +168FC;BAMUM LETTER PHASE-D NGKUN;Lo;0;L;;;;;N;;;;; +168FD;BAMUM LETTER PHASE-D SHEE;Lo;0;L;;;;;N;;;;; +168FE;BAMUM LETTER PHASE-D NGKAP;Lo;0;L;;;;;N;;;;; +168FF;BAMUM LETTER PHASE-D KEUAETMEUN;Lo;0;L;;;;;N;;;;; +16900;BAMUM LETTER PHASE-D TEUT;Lo;0;L;;;;;N;;;;; +16901;BAMUM LETTER PHASE-D SHEUAE;Lo;0;L;;;;;N;;;;; +16902;BAMUM LETTER PHASE-D NJAP;Lo;0;L;;;;;N;;;;; +16903;BAMUM LETTER PHASE-D SUE;Lo;0;L;;;;;N;;;;; +16904;BAMUM LETTER PHASE-D KET;Lo;0;L;;;;;N;;;;; +16905;BAMUM LETTER PHASE-D YAEMMAE;Lo;0;L;;;;;N;;;;; +16906;BAMUM LETTER PHASE-D KUOM;Lo;0;L;;;;;N;;;;; +16907;BAMUM LETTER PHASE-D SAP;Lo;0;L;;;;;N;;;;; +16908;BAMUM LETTER PHASE-D MFEUT;Lo;0;L;;;;;N;;;;; +16909;BAMUM LETTER PHASE-D NDEUX;Lo;0;L;;;;;N;;;;; +1690A;BAMUM LETTER PHASE-D MALEERI;Lo;0;L;;;;;N;;;;; +1690B;BAMUM LETTER PHASE-D MEUT;Lo;0;L;;;;;N;;;;; +1690C;BAMUM LETTER PHASE-D SEUAEQ;Lo;0;L;;;;;N;;;;; +1690D;BAMUM LETTER PHASE-D YEN;Lo;0;L;;;;;N;;;;; +1690E;BAMUM LETTER PHASE-D NJEUAEM;Lo;0;L;;;;;N;;;;; +1690F;BAMUM LETTER PHASE-D KEUOT MBUAE;Lo;0;L;;;;;N;;;;; +16910;BAMUM LETTER PHASE-D NGKEURI;Lo;0;L;;;;;N;;;;; +16911;BAMUM LETTER PHASE-D TU;Lo;0;L;;;;;N;;;;; +16912;BAMUM LETTER PHASE-D GHAA;Lo;0;L;;;;;N;;;;; +16913;BAMUM LETTER PHASE-D NGKYEE;Lo;0;L;;;;;N;;;;; +16914;BAMUM LETTER PHASE-D FEUFEUAET;Lo;0;L;;;;;N;;;;; +16915;BAMUM LETTER PHASE-D NDEE;Lo;0;L;;;;;N;;;;; +16916;BAMUM LETTER PHASE-D MGBOFUM;Lo;0;L;;;;;N;;;;; +16917;BAMUM LETTER PHASE-D LEUAEP;Lo;0;L;;;;;N;;;;; +16918;BAMUM LETTER PHASE-D NDON;Lo;0;L;;;;;N;;;;; +16919;BAMUM LETTER PHASE-D MONI;Lo;0;L;;;;;N;;;;; +1691A;BAMUM LETTER PHASE-D MGBEUN;Lo;0;L;;;;;N;;;;; +1691B;BAMUM LETTER PHASE-D PUUT;Lo;0;L;;;;;N;;;;; +1691C;BAMUM LETTER PHASE-D MGBIEE;Lo;0;L;;;;;N;;;;; +1691D;BAMUM LETTER PHASE-D MFO;Lo;0;L;;;;;N;;;;; +1691E;BAMUM LETTER PHASE-D LUM;Lo;0;L;;;;;N;;;;; +1691F;BAMUM LETTER PHASE-D NSIEEP;Lo;0;L;;;;;N;;;;; +16920;BAMUM LETTER PHASE-D MBAA;Lo;0;L;;;;;N;;;;; +16921;BAMUM LETTER PHASE-D KWAET;Lo;0;L;;;;;N;;;;; +16922;BAMUM LETTER PHASE-D NYET;Lo;0;L;;;;;N;;;;; +16923;BAMUM LETTER PHASE-D TEUAEN;Lo;0;L;;;;;N;;;;; +16924;BAMUM LETTER PHASE-D SOT;Lo;0;L;;;;;N;;;;; +16925;BAMUM LETTER PHASE-D YUWOQ;Lo;0;L;;;;;N;;;;; +16926;BAMUM LETTER PHASE-D KEUM;Lo;0;L;;;;;N;;;;; +16927;BAMUM LETTER PHASE-D RAEM;Lo;0;L;;;;;N;;;;; +16928;BAMUM LETTER PHASE-D TEEEE;Lo;0;L;;;;;N;;;;; +16929;BAMUM LETTER PHASE-D NGKEUAEQ;Lo;0;L;;;;;N;;;;; +1692A;BAMUM LETTER PHASE-D MFEUAE;Lo;0;L;;;;;N;;;;; +1692B;BAMUM LETTER PHASE-D NSIEET;Lo;0;L;;;;;N;;;;; +1692C;BAMUM LETTER PHASE-D KEUP;Lo;0;L;;;;;N;;;;; +1692D;BAMUM LETTER PHASE-D PIP;Lo;0;L;;;;;N;;;;; +1692E;BAMUM LETTER PHASE-D PEUTAE;Lo;0;L;;;;;N;;;;; +1692F;BAMUM LETTER PHASE-D NYUE;Lo;0;L;;;;;N;;;;; +16930;BAMUM LETTER PHASE-D LET;Lo;0;L;;;;;N;;;;; +16931;BAMUM LETTER PHASE-D NGGAAM;Lo;0;L;;;;;N;;;;; +16932;BAMUM LETTER PHASE-D MFIEE;Lo;0;L;;;;;N;;;;; +16933;BAMUM LETTER PHASE-D NGGWAEN;Lo;0;L;;;;;N;;;;; +16934;BAMUM LETTER PHASE-D YUOM;Lo;0;L;;;;;N;;;;; +16935;BAMUM LETTER PHASE-D PAP;Lo;0;L;;;;;N;;;;; +16936;BAMUM LETTER PHASE-D YUOP;Lo;0;L;;;;;N;;;;; +16937;BAMUM LETTER PHASE-D NDAM;Lo;0;L;;;;;N;;;;; +16938;BAMUM LETTER PHASE-D NTEUM;Lo;0;L;;;;;N;;;;; +16939;BAMUM LETTER PHASE-D SUAE;Lo;0;L;;;;;N;;;;; +1693A;BAMUM LETTER PHASE-D KUN;Lo;0;L;;;;;N;;;;; +1693B;BAMUM LETTER PHASE-D NGGEUX;Lo;0;L;;;;;N;;;;; +1693C;BAMUM LETTER PHASE-D NGKIEE;Lo;0;L;;;;;N;;;;; +1693D;BAMUM LETTER PHASE-D TUOT;Lo;0;L;;;;;N;;;;; +1693E;BAMUM LETTER PHASE-D MEUN;Lo;0;L;;;;;N;;;;; +1693F;BAMUM LETTER PHASE-D KUQ;Lo;0;L;;;;;N;;;;; +16940;BAMUM LETTER PHASE-D NSUM;Lo;0;L;;;;;N;;;;; +16941;BAMUM LETTER PHASE-D TEUN;Lo;0;L;;;;;N;;;;; +16942;BAMUM LETTER PHASE-D MAENJET;Lo;0;L;;;;;N;;;;; +16943;BAMUM LETTER PHASE-D NGGAP;Lo;0;L;;;;;N;;;;; +16944;BAMUM LETTER PHASE-D LEUM;Lo;0;L;;;;;N;;;;; +16945;BAMUM LETTER PHASE-D NGGUOM;Lo;0;L;;;;;N;;;;; +16946;BAMUM LETTER PHASE-D NSHUT;Lo;0;L;;;;;N;;;;; +16947;BAMUM LETTER PHASE-D NJUEQ;Lo;0;L;;;;;N;;;;; +16948;BAMUM LETTER PHASE-D GHEUAE;Lo;0;L;;;;;N;;;;; +16949;BAMUM LETTER PHASE-D KU;Lo;0;L;;;;;N;;;;; +1694A;BAMUM LETTER PHASE-D REN OLD;Lo;0;L;;;;;N;;;;; +1694B;BAMUM LETTER PHASE-D TAE;Lo;0;L;;;;;N;;;;; +1694C;BAMUM LETTER PHASE-D TOQ;Lo;0;L;;;;;N;;;;; +1694D;BAMUM LETTER PHASE-D NYI;Lo;0;L;;;;;N;;;;; +1694E;BAMUM LETTER PHASE-D RII;Lo;0;L;;;;;N;;;;; +1694F;BAMUM LETTER PHASE-D LEEEE;Lo;0;L;;;;;N;;;;; +16950;BAMUM LETTER PHASE-D MEEEE;Lo;0;L;;;;;N;;;;; +16951;BAMUM LETTER PHASE-D M;Lo;0;L;;;;;N;;;;; +16952;BAMUM LETTER PHASE-D SUU;Lo;0;L;;;;;N;;;;; +16953;BAMUM LETTER PHASE-D MU;Lo;0;L;;;;;N;;;;; +16954;BAMUM LETTER PHASE-D SHII;Lo;0;L;;;;;N;;;;; +16955;BAMUM LETTER PHASE-D SHEUX;Lo;0;L;;;;;N;;;;; +16956;BAMUM LETTER PHASE-D KYEE;Lo;0;L;;;;;N;;;;; +16957;BAMUM LETTER PHASE-D NU;Lo;0;L;;;;;N;;;;; +16958;BAMUM LETTER PHASE-D SHU;Lo;0;L;;;;;N;;;;; +16959;BAMUM LETTER PHASE-D NTEE;Lo;0;L;;;;;N;;;;; +1695A;BAMUM LETTER PHASE-D PEE;Lo;0;L;;;;;N;;;;; +1695B;BAMUM LETTER PHASE-D NI;Lo;0;L;;;;;N;;;;; +1695C;BAMUM LETTER PHASE-D SHOQ;Lo;0;L;;;;;N;;;;; +1695D;BAMUM LETTER PHASE-D PUQ;Lo;0;L;;;;;N;;;;; +1695E;BAMUM LETTER PHASE-D MVOP;Lo;0;L;;;;;N;;;;; +1695F;BAMUM LETTER PHASE-D LOQ;Lo;0;L;;;;;N;;;;; +16960;BAMUM LETTER PHASE-D REN MUCH;Lo;0;L;;;;;N;;;;; +16961;BAMUM LETTER PHASE-D TI;Lo;0;L;;;;;N;;;;; +16962;BAMUM LETTER PHASE-D NTUU;Lo;0;L;;;;;N;;;;; +16963;BAMUM LETTER PHASE-D MBAA SEVEN;Lo;0;L;;;;;N;;;;; +16964;BAMUM LETTER PHASE-D SAQ;Lo;0;L;;;;;N;;;;; +16965;BAMUM LETTER PHASE-D FAA;Lo;0;L;;;;;N;;;;; +16966;BAMUM LETTER PHASE-E NDAP;Lo;0;L;;;;;N;;;;; +16967;BAMUM LETTER PHASE-E TOON;Lo;0;L;;;;;N;;;;; +16968;BAMUM LETTER PHASE-E MBEUM;Lo;0;L;;;;;N;;;;; +16969;BAMUM LETTER PHASE-E LAP;Lo;0;L;;;;;N;;;;; +1696A;BAMUM LETTER PHASE-E VOM;Lo;0;L;;;;;N;;;;; +1696B;BAMUM LETTER PHASE-E LOON;Lo;0;L;;;;;N;;;;; +1696C;BAMUM LETTER PHASE-E PAA;Lo;0;L;;;;;N;;;;; +1696D;BAMUM LETTER PHASE-E SOM;Lo;0;L;;;;;N;;;;; +1696E;BAMUM LETTER PHASE-E RAQ;Lo;0;L;;;;;N;;;;; +1696F;BAMUM LETTER PHASE-E NSHUOP;Lo;0;L;;;;;N;;;;; +16970;BAMUM LETTER PHASE-E NDUN;Lo;0;L;;;;;N;;;;; +16971;BAMUM LETTER PHASE-E PUAE;Lo;0;L;;;;;N;;;;; +16972;BAMUM LETTER PHASE-E TAM;Lo;0;L;;;;;N;;;;; +16973;BAMUM LETTER PHASE-E NGKA;Lo;0;L;;;;;N;;;;; +16974;BAMUM LETTER PHASE-E KPEUX;Lo;0;L;;;;;N;;;;; +16975;BAMUM LETTER PHASE-E WUO;Lo;0;L;;;;;N;;;;; +16976;BAMUM LETTER PHASE-E SEE;Lo;0;L;;;;;N;;;;; +16977;BAMUM LETTER PHASE-E NGGEUAET;Lo;0;L;;;;;N;;;;; +16978;BAMUM LETTER PHASE-E PAAM;Lo;0;L;;;;;N;;;;; +16979;BAMUM LETTER PHASE-E TOO;Lo;0;L;;;;;N;;;;; +1697A;BAMUM LETTER PHASE-E KUOP;Lo;0;L;;;;;N;;;;; +1697B;BAMUM LETTER PHASE-E LOM;Lo;0;L;;;;;N;;;;; +1697C;BAMUM LETTER PHASE-E NSHIEE;Lo;0;L;;;;;N;;;;; +1697D;BAMUM LETTER PHASE-E NGOP;Lo;0;L;;;;;N;;;;; +1697E;BAMUM LETTER PHASE-E MAEM;Lo;0;L;;;;;N;;;;; +1697F;BAMUM LETTER PHASE-E NGKEUX;Lo;0;L;;;;;N;;;;; +16980;BAMUM LETTER PHASE-E NGOQ;Lo;0;L;;;;;N;;;;; +16981;BAMUM LETTER PHASE-E NSHUE;Lo;0;L;;;;;N;;;;; +16982;BAMUM LETTER PHASE-E RIMGBA;Lo;0;L;;;;;N;;;;; +16983;BAMUM LETTER PHASE-E NJEUX;Lo;0;L;;;;;N;;;;; +16984;BAMUM LETTER PHASE-E PEEM;Lo;0;L;;;;;N;;;;; +16985;BAMUM LETTER PHASE-E SAA;Lo;0;L;;;;;N;;;;; +16986;BAMUM LETTER PHASE-E NGGURAE;Lo;0;L;;;;;N;;;;; +16987;BAMUM LETTER PHASE-E MGBA;Lo;0;L;;;;;N;;;;; +16988;BAMUM LETTER PHASE-E GHEUX;Lo;0;L;;;;;N;;;;; +16989;BAMUM LETTER PHASE-E NGKEUAEM;Lo;0;L;;;;;N;;;;; +1698A;BAMUM LETTER PHASE-E NJAEMLI;Lo;0;L;;;;;N;;;;; +1698B;BAMUM LETTER PHASE-E MAP;Lo;0;L;;;;;N;;;;; +1698C;BAMUM LETTER PHASE-E LOOT;Lo;0;L;;;;;N;;;;; +1698D;BAMUM LETTER PHASE-E NGGEEEE;Lo;0;L;;;;;N;;;;; +1698E;BAMUM LETTER PHASE-E NDIQ;Lo;0;L;;;;;N;;;;; +1698F;BAMUM LETTER PHASE-E TAEN NTEUM;Lo;0;L;;;;;N;;;;; +16990;BAMUM LETTER PHASE-E SET;Lo;0;L;;;;;N;;;;; +16991;BAMUM LETTER PHASE-E PUM;Lo;0;L;;;;;N;;;;; +16992;BAMUM LETTER PHASE-E NDAA SOFTNESS;Lo;0;L;;;;;N;;;;; +16993;BAMUM LETTER PHASE-E NGGUAESHAE NYAM;Lo;0;L;;;;;N;;;;; +16994;BAMUM LETTER PHASE-E YIEE;Lo;0;L;;;;;N;;;;; +16995;BAMUM LETTER PHASE-E GHEUN;Lo;0;L;;;;;N;;;;; +16996;BAMUM LETTER PHASE-E TUAE;Lo;0;L;;;;;N;;;;; +16997;BAMUM LETTER PHASE-E YEUAE;Lo;0;L;;;;;N;;;;; +16998;BAMUM LETTER PHASE-E PO;Lo;0;L;;;;;N;;;;; +16999;BAMUM LETTER PHASE-E TUMAE;Lo;0;L;;;;;N;;;;; +1699A;BAMUM LETTER PHASE-E KEUAE;Lo;0;L;;;;;N;;;;; +1699B;BAMUM LETTER PHASE-E SUAEN;Lo;0;L;;;;;N;;;;; +1699C;BAMUM LETTER PHASE-E TEUAEQ;Lo;0;L;;;;;N;;;;; +1699D;BAMUM LETTER PHASE-E VEUAE;Lo;0;L;;;;;N;;;;; +1699E;BAMUM LETTER PHASE-E WEUX;Lo;0;L;;;;;N;;;;; +1699F;BAMUM LETTER PHASE-E LAAM;Lo;0;L;;;;;N;;;;; +169A0;BAMUM LETTER PHASE-E PU;Lo;0;L;;;;;N;;;;; +169A1;BAMUM LETTER PHASE-E TAAQ;Lo;0;L;;;;;N;;;;; +169A2;BAMUM LETTER PHASE-E GHAAMAE;Lo;0;L;;;;;N;;;;; +169A3;BAMUM LETTER PHASE-E NGEUREUT;Lo;0;L;;;;;N;;;;; +169A4;BAMUM LETTER PHASE-E SHEUAEQ;Lo;0;L;;;;;N;;;;; +169A5;BAMUM LETTER PHASE-E MGBEN;Lo;0;L;;;;;N;;;;; +169A6;BAMUM LETTER PHASE-E MBEE;Lo;0;L;;;;;N;;;;; +169A7;BAMUM LETTER PHASE-E NZAQ;Lo;0;L;;;;;N;;;;; +169A8;BAMUM LETTER PHASE-E NKOM;Lo;0;L;;;;;N;;;;; +169A9;BAMUM LETTER PHASE-E GBET;Lo;0;L;;;;;N;;;;; +169AA;BAMUM LETTER PHASE-E TUM;Lo;0;L;;;;;N;;;;; +169AB;BAMUM LETTER PHASE-E KUET;Lo;0;L;;;;;N;;;;; +169AC;BAMUM LETTER PHASE-E YAP;Lo;0;L;;;;;N;;;;; +169AD;BAMUM LETTER PHASE-E NYI CLEAVER;Lo;0;L;;;;;N;;;;; +169AE;BAMUM LETTER PHASE-E YIT;Lo;0;L;;;;;N;;;;; +169AF;BAMUM LETTER PHASE-E MFEUQ;Lo;0;L;;;;;N;;;;; +169B0;BAMUM LETTER PHASE-E NDIAQ;Lo;0;L;;;;;N;;;;; +169B1;BAMUM LETTER PHASE-E PIEEQ;Lo;0;L;;;;;N;;;;; +169B2;BAMUM LETTER PHASE-E YUEQ;Lo;0;L;;;;;N;;;;; +169B3;BAMUM LETTER PHASE-E LEUAEM;Lo;0;L;;;;;N;;;;; +169B4;BAMUM LETTER PHASE-E FUE;Lo;0;L;;;;;N;;;;; +169B5;BAMUM LETTER PHASE-E GBEUX;Lo;0;L;;;;;N;;;;; +169B6;BAMUM LETTER PHASE-E NGKUP;Lo;0;L;;;;;N;;;;; +169B7;BAMUM LETTER PHASE-E KET;Lo;0;L;;;;;N;;;;; +169B8;BAMUM LETTER PHASE-E MAE;Lo;0;L;;;;;N;;;;; +169B9;BAMUM LETTER PHASE-E NGKAAMI;Lo;0;L;;;;;N;;;;; +169BA;BAMUM LETTER PHASE-E GHET;Lo;0;L;;;;;N;;;;; +169BB;BAMUM LETTER PHASE-E FA;Lo;0;L;;;;;N;;;;; +169BC;BAMUM LETTER PHASE-E NTUM;Lo;0;L;;;;;N;;;;; +169BD;BAMUM LETTER PHASE-E PEUT;Lo;0;L;;;;;N;;;;; +169BE;BAMUM LETTER PHASE-E YEUM;Lo;0;L;;;;;N;;;;; +169BF;BAMUM LETTER PHASE-E NGGEUAE;Lo;0;L;;;;;N;;;;; +169C0;BAMUM LETTER PHASE-E NYI BETWEEN;Lo;0;L;;;;;N;;;;; +169C1;BAMUM LETTER PHASE-E NZUQ;Lo;0;L;;;;;N;;;;; +169C2;BAMUM LETTER PHASE-E POON;Lo;0;L;;;;;N;;;;; +169C3;BAMUM LETTER PHASE-E MIEE;Lo;0;L;;;;;N;;;;; +169C4;BAMUM LETTER PHASE-E FUET;Lo;0;L;;;;;N;;;;; +169C5;BAMUM LETTER PHASE-E NAE;Lo;0;L;;;;;N;;;;; +169C6;BAMUM LETTER PHASE-E MUAE;Lo;0;L;;;;;N;;;;; +169C7;BAMUM LETTER PHASE-E GHEUAE;Lo;0;L;;;;;N;;;;; +169C8;BAMUM LETTER PHASE-E FU I;Lo;0;L;;;;;N;;;;; +169C9;BAMUM LETTER PHASE-E MVI;Lo;0;L;;;;;N;;;;; +169CA;BAMUM LETTER PHASE-E PUAQ;Lo;0;L;;;;;N;;;;; +169CB;BAMUM LETTER PHASE-E NGKUM;Lo;0;L;;;;;N;;;;; +169CC;BAMUM LETTER PHASE-E KUT;Lo;0;L;;;;;N;;;;; +169CD;BAMUM LETTER PHASE-E PIET;Lo;0;L;;;;;N;;;;; +169CE;BAMUM LETTER PHASE-E NTAP;Lo;0;L;;;;;N;;;;; +169CF;BAMUM LETTER PHASE-E YEUAET;Lo;0;L;;;;;N;;;;; +169D0;BAMUM LETTER PHASE-E NGGUP;Lo;0;L;;;;;N;;;;; +169D1;BAMUM LETTER PHASE-E PA PEOPLE;Lo;0;L;;;;;N;;;;; +169D2;BAMUM LETTER PHASE-E FU CALL;Lo;0;L;;;;;N;;;;; +169D3;BAMUM LETTER PHASE-E FOM;Lo;0;L;;;;;N;;;;; +169D4;BAMUM LETTER PHASE-E NJEE;Lo;0;L;;;;;N;;;;; +169D5;BAMUM LETTER PHASE-E A;Lo;0;L;;;;;N;;;;; +169D6;BAMUM LETTER PHASE-E TOQ;Lo;0;L;;;;;N;;;;; +169D7;BAMUM LETTER PHASE-E O;Lo;0;L;;;;;N;;;;; +169D8;BAMUM LETTER PHASE-E I;Lo;0;L;;;;;N;;;;; +169D9;BAMUM LETTER PHASE-E LAQ;Lo;0;L;;;;;N;;;;; +169DA;BAMUM LETTER PHASE-E PA PLURAL;Lo;0;L;;;;;N;;;;; +169DB;BAMUM LETTER PHASE-E TAA;Lo;0;L;;;;;N;;;;; +169DC;BAMUM LETTER PHASE-E TAQ;Lo;0;L;;;;;N;;;;; +169DD;BAMUM LETTER PHASE-E NDAA MY HOUSE;Lo;0;L;;;;;N;;;;; +169DE;BAMUM LETTER PHASE-E SHIQ;Lo;0;L;;;;;N;;;;; +169DF;BAMUM LETTER PHASE-E YEUX;Lo;0;L;;;;;N;;;;; +169E0;BAMUM LETTER PHASE-E NGUAE;Lo;0;L;;;;;N;;;;; +169E1;BAMUM LETTER PHASE-E YUAEN;Lo;0;L;;;;;N;;;;; +169E2;BAMUM LETTER PHASE-E YOQ SWIMMING;Lo;0;L;;;;;N;;;;; +169E3;BAMUM LETTER PHASE-E YOQ COVER;Lo;0;L;;;;;N;;;;; +169E4;BAMUM LETTER PHASE-E YUQ;Lo;0;L;;;;;N;;;;; +169E5;BAMUM LETTER PHASE-E YUN;Lo;0;L;;;;;N;;;;; +169E6;BAMUM LETTER PHASE-E KEUX;Lo;0;L;;;;;N;;;;; +169E7;BAMUM LETTER PHASE-E PEUX;Lo;0;L;;;;;N;;;;; +169E8;BAMUM LETTER PHASE-E NJEE EPOCH;Lo;0;L;;;;;N;;;;; +169E9;BAMUM LETTER PHASE-E PUE;Lo;0;L;;;;;N;;;;; +169EA;BAMUM LETTER PHASE-E WUE;Lo;0;L;;;;;N;;;;; +169EB;BAMUM LETTER PHASE-E FEE;Lo;0;L;;;;;N;;;;; +169EC;BAMUM LETTER PHASE-E VEE;Lo;0;L;;;;;N;;;;; +169ED;BAMUM LETTER PHASE-E LU;Lo;0;L;;;;;N;;;;; +169EE;BAMUM LETTER PHASE-E MI;Lo;0;L;;;;;N;;;;; +169EF;BAMUM LETTER PHASE-E REUX;Lo;0;L;;;;;N;;;;; +169F0;BAMUM LETTER PHASE-E RAE;Lo;0;L;;;;;N;;;;; +169F1;BAMUM LETTER PHASE-E NGUAET;Lo;0;L;;;;;N;;;;; +169F2;BAMUM LETTER PHASE-E NGA;Lo;0;L;;;;;N;;;;; +169F3;BAMUM LETTER PHASE-E SHO;Lo;0;L;;;;;N;;;;; +169F4;BAMUM LETTER PHASE-E SHOQ;Lo;0;L;;;;;N;;;;; +169F5;BAMUM LETTER PHASE-E FU REMEDY;Lo;0;L;;;;;N;;;;; +169F6;BAMUM LETTER PHASE-E NA;Lo;0;L;;;;;N;;;;; +169F7;BAMUM LETTER PHASE-E PI;Lo;0;L;;;;;N;;;;; +169F8;BAMUM LETTER PHASE-E LOQ;Lo;0;L;;;;;N;;;;; +169F9;BAMUM LETTER PHASE-E KO;Lo;0;L;;;;;N;;;;; +169FA;BAMUM LETTER PHASE-E MEN;Lo;0;L;;;;;N;;;;; +169FB;BAMUM LETTER PHASE-E MA;Lo;0;L;;;;;N;;;;; +169FC;BAMUM LETTER PHASE-E MAQ;Lo;0;L;;;;;N;;;;; +169FD;BAMUM LETTER PHASE-E TEU;Lo;0;L;;;;;N;;;;; +169FE;BAMUM LETTER PHASE-E KI;Lo;0;L;;;;;N;;;;; +169FF;BAMUM LETTER PHASE-E MON;Lo;0;L;;;;;N;;;;; +16A00;BAMUM LETTER PHASE-E TEN;Lo;0;L;;;;;N;;;;; +16A01;BAMUM LETTER PHASE-E FAQ;Lo;0;L;;;;;N;;;;; +16A02;BAMUM LETTER PHASE-E GHOM;Lo;0;L;;;;;N;;;;; +16A03;BAMUM LETTER PHASE-F KA;Lo;0;L;;;;;N;;;;; +16A04;BAMUM LETTER PHASE-F U;Lo;0;L;;;;;N;;;;; +16A05;BAMUM LETTER PHASE-F KU;Lo;0;L;;;;;N;;;;; +16A06;BAMUM LETTER PHASE-F EE;Lo;0;L;;;;;N;;;;; +16A07;BAMUM LETTER PHASE-F REE;Lo;0;L;;;;;N;;;;; +16A08;BAMUM LETTER PHASE-F TAE;Lo;0;L;;;;;N;;;;; +16A09;BAMUM LETTER PHASE-F NYI;Lo;0;L;;;;;N;;;;; +16A0A;BAMUM LETTER PHASE-F LA;Lo;0;L;;;;;N;;;;; +16A0B;BAMUM LETTER PHASE-F RII;Lo;0;L;;;;;N;;;;; +16A0C;BAMUM LETTER PHASE-F RIEE;Lo;0;L;;;;;N;;;;; +16A0D;BAMUM LETTER PHASE-F MEEEE;Lo;0;L;;;;;N;;;;; +16A0E;BAMUM LETTER PHASE-F TAA;Lo;0;L;;;;;N;;;;; +16A0F;BAMUM LETTER PHASE-F NDAA;Lo;0;L;;;;;N;;;;; +16A10;BAMUM LETTER PHASE-F NJAEM;Lo;0;L;;;;;N;;;;; +16A11;BAMUM LETTER PHASE-F M;Lo;0;L;;;;;N;;;;; +16A12;BAMUM LETTER PHASE-F SUU;Lo;0;L;;;;;N;;;;; +16A13;BAMUM LETTER PHASE-F SHII;Lo;0;L;;;;;N;;;;; +16A14;BAMUM LETTER PHASE-F SI;Lo;0;L;;;;;N;;;;; +16A15;BAMUM LETTER PHASE-F SEUX;Lo;0;L;;;;;N;;;;; +16A16;BAMUM LETTER PHASE-F KYEE;Lo;0;L;;;;;N;;;;; +16A17;BAMUM LETTER PHASE-F KET;Lo;0;L;;;;;N;;;;; +16A18;BAMUM LETTER PHASE-F NUAE;Lo;0;L;;;;;N;;;;; +16A19;BAMUM LETTER PHASE-F NU;Lo;0;L;;;;;N;;;;; +16A1A;BAMUM LETTER PHASE-F NJUAE;Lo;0;L;;;;;N;;;;; +16A1B;BAMUM LETTER PHASE-F YOQ;Lo;0;L;;;;;N;;;;; +16A1C;BAMUM LETTER PHASE-F SHU;Lo;0;L;;;;;N;;;;; +16A1D;BAMUM LETTER PHASE-F YA;Lo;0;L;;;;;N;;;;; +16A1E;BAMUM LETTER PHASE-F NSHA;Lo;0;L;;;;;N;;;;; +16A1F;BAMUM LETTER PHASE-F PEUX;Lo;0;L;;;;;N;;;;; +16A20;BAMUM LETTER PHASE-F NTEE;Lo;0;L;;;;;N;;;;; +16A21;BAMUM LETTER PHASE-F WUE;Lo;0;L;;;;;N;;;;; +16A22;BAMUM LETTER PHASE-F PEE;Lo;0;L;;;;;N;;;;; +16A23;BAMUM LETTER PHASE-F RU;Lo;0;L;;;;;N;;;;; +16A24;BAMUM LETTER PHASE-F NI;Lo;0;L;;;;;N;;;;; +16A25;BAMUM LETTER PHASE-F REUX;Lo;0;L;;;;;N;;;;; +16A26;BAMUM LETTER PHASE-F KEN;Lo;0;L;;;;;N;;;;; +16A27;BAMUM LETTER PHASE-F NGKWAEN;Lo;0;L;;;;;N;;;;; +16A28;BAMUM LETTER PHASE-F NGGA;Lo;0;L;;;;;N;;;;; +16A29;BAMUM LETTER PHASE-F SHO;Lo;0;L;;;;;N;;;;; +16A2A;BAMUM LETTER PHASE-F PUAE;Lo;0;L;;;;;N;;;;; +16A2B;BAMUM LETTER PHASE-F FOM;Lo;0;L;;;;;N;;;;; +16A2C;BAMUM LETTER PHASE-F WA;Lo;0;L;;;;;N;;;;; +16A2D;BAMUM LETTER PHASE-F LI;Lo;0;L;;;;;N;;;;; +16A2E;BAMUM LETTER PHASE-F LOQ;Lo;0;L;;;;;N;;;;; +16A2F;BAMUM LETTER PHASE-F KO;Lo;0;L;;;;;N;;;;; +16A30;BAMUM LETTER PHASE-F MBEN;Lo;0;L;;;;;N;;;;; +16A31;BAMUM LETTER PHASE-F REN;Lo;0;L;;;;;N;;;;; +16A32;BAMUM LETTER PHASE-F MA;Lo;0;L;;;;;N;;;;; +16A33;BAMUM LETTER PHASE-F MO;Lo;0;L;;;;;N;;;;; +16A34;BAMUM LETTER PHASE-F MBAA;Lo;0;L;;;;;N;;;;; +16A35;BAMUM LETTER PHASE-F TET;Lo;0;L;;;;;N;;;;; +16A36;BAMUM LETTER PHASE-F KPA;Lo;0;L;;;;;N;;;;; +16A37;BAMUM LETTER PHASE-F SAMBA;Lo;0;L;;;;;N;;;;; +16A38;BAMUM LETTER PHASE-F VUEQ;Lo;0;L;;;;;N;;;;; +16A40;MRO LETTER TA;Lo;0;L;;;;;N;;;;; +16A41;MRO LETTER NGI;Lo;0;L;;;;;N;;;;; +16A42;MRO LETTER YO;Lo;0;L;;;;;N;;;;; +16A43;MRO LETTER MIM;Lo;0;L;;;;;N;;;;; +16A44;MRO LETTER BA;Lo;0;L;;;;;N;;;;; +16A45;MRO LETTER DA;Lo;0;L;;;;;N;;;;; +16A46;MRO LETTER A;Lo;0;L;;;;;N;;;;; +16A47;MRO LETTER PHI;Lo;0;L;;;;;N;;;;; +16A48;MRO LETTER KHAI;Lo;0;L;;;;;N;;;;; +16A49;MRO LETTER HAO;Lo;0;L;;;;;N;;;;; +16A4A;MRO LETTER DAI;Lo;0;L;;;;;N;;;;; +16A4B;MRO LETTER CHU;Lo;0;L;;;;;N;;;;; +16A4C;MRO LETTER KEAAE;Lo;0;L;;;;;N;;;;; +16A4D;MRO LETTER OL;Lo;0;L;;;;;N;;;;; +16A4E;MRO LETTER MAEM;Lo;0;L;;;;;N;;;;; +16A4F;MRO LETTER NIN;Lo;0;L;;;;;N;;;;; +16A50;MRO LETTER PA;Lo;0;L;;;;;N;;;;; +16A51;MRO LETTER OO;Lo;0;L;;;;;N;;;;; +16A52;MRO LETTER O;Lo;0;L;;;;;N;;;;; +16A53;MRO LETTER RO;Lo;0;L;;;;;N;;;;; +16A54;MRO LETTER SHI;Lo;0;L;;;;;N;;;;; +16A55;MRO LETTER THEA;Lo;0;L;;;;;N;;;;; +16A56;MRO LETTER EA;Lo;0;L;;;;;N;;;;; +16A57;MRO LETTER WA;Lo;0;L;;;;;N;;;;; +16A58;MRO LETTER E;Lo;0;L;;;;;N;;;;; +16A59;MRO LETTER KO;Lo;0;L;;;;;N;;;;; +16A5A;MRO LETTER LAN;Lo;0;L;;;;;N;;;;; +16A5B;MRO LETTER LA;Lo;0;L;;;;;N;;;;; +16A5C;MRO LETTER HAI;Lo;0;L;;;;;N;;;;; +16A5D;MRO LETTER RI;Lo;0;L;;;;;N;;;;; +16A5E;MRO LETTER TEK;Lo;0;L;;;;;N;;;;; +16A60;MRO DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +16A61;MRO DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +16A62;MRO DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +16A63;MRO DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +16A64;MRO DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +16A65;MRO DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +16A66;MRO DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +16A67;MRO DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +16A68;MRO DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +16A69;MRO DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +16A6E;MRO DANDA;Po;0;L;;;;;N;;;;; +16A6F;MRO DOUBLE DANDA;Po;0;L;;;;;N;;;;; +16AD0;BASSA VAH LETTER ENNI;Lo;0;L;;;;;N;;;;; +16AD1;BASSA VAH LETTER KA;Lo;0;L;;;;;N;;;;; +16AD2;BASSA VAH LETTER SE;Lo;0;L;;;;;N;;;;; +16AD3;BASSA VAH LETTER FA;Lo;0;L;;;;;N;;;;; +16AD4;BASSA VAH LETTER MBE;Lo;0;L;;;;;N;;;;; +16AD5;BASSA VAH LETTER YIE;Lo;0;L;;;;;N;;;;; +16AD6;BASSA VAH LETTER GAH;Lo;0;L;;;;;N;;;;; +16AD7;BASSA VAH LETTER DHII;Lo;0;L;;;;;N;;;;; +16AD8;BASSA VAH LETTER KPAH;Lo;0;L;;;;;N;;;;; +16AD9;BASSA VAH LETTER JO;Lo;0;L;;;;;N;;;;; +16ADA;BASSA VAH LETTER HWAH;Lo;0;L;;;;;N;;;;; +16ADB;BASSA VAH LETTER WA;Lo;0;L;;;;;N;;;;; +16ADC;BASSA VAH LETTER ZO;Lo;0;L;;;;;N;;;;; +16ADD;BASSA VAH LETTER GBU;Lo;0;L;;;;;N;;;;; +16ADE;BASSA VAH LETTER DO;Lo;0;L;;;;;N;;;;; +16ADF;BASSA VAH LETTER CE;Lo;0;L;;;;;N;;;;; +16AE0;BASSA VAH LETTER UWU;Lo;0;L;;;;;N;;;;; +16AE1;BASSA VAH LETTER TO;Lo;0;L;;;;;N;;;;; +16AE2;BASSA VAH LETTER BA;Lo;0;L;;;;;N;;;;; +16AE3;BASSA VAH LETTER VU;Lo;0;L;;;;;N;;;;; +16AE4;BASSA VAH LETTER YEIN;Lo;0;L;;;;;N;;;;; +16AE5;BASSA VAH LETTER PA;Lo;0;L;;;;;N;;;;; +16AE6;BASSA VAH LETTER WADDA;Lo;0;L;;;;;N;;;;; +16AE7;BASSA VAH LETTER A;Lo;0;L;;;;;N;;;;; +16AE8;BASSA VAH LETTER O;Lo;0;L;;;;;N;;;;; +16AE9;BASSA VAH LETTER OO;Lo;0;L;;;;;N;;;;; +16AEA;BASSA VAH LETTER U;Lo;0;L;;;;;N;;;;; +16AEB;BASSA VAH LETTER EE;Lo;0;L;;;;;N;;;;; +16AEC;BASSA VAH LETTER E;Lo;0;L;;;;;N;;;;; +16AED;BASSA VAH LETTER I;Lo;0;L;;;;;N;;;;; +16AF0;BASSA VAH COMBINING HIGH TONE;Mn;1;NSM;;;;;N;;;;; +16AF1;BASSA VAH COMBINING LOW TONE;Mn;1;NSM;;;;;N;;;;; +16AF2;BASSA VAH COMBINING MID TONE;Mn;1;NSM;;;;;N;;;;; +16AF3;BASSA VAH COMBINING LOW-MID TONE;Mn;1;NSM;;;;;N;;;;; +16AF4;BASSA VAH COMBINING HIGH-LOW TONE;Mn;1;NSM;;;;;N;;;;; +16AF5;BASSA VAH FULL STOP;Po;0;L;;;;;N;;;;; +16B00;PAHAWH HMONG VOWEL KEEB;Lo;0;L;;;;;N;;;;; +16B01;PAHAWH HMONG VOWEL KEEV;Lo;0;L;;;;;N;;;;; +16B02;PAHAWH HMONG VOWEL KIB;Lo;0;L;;;;;N;;;;; +16B03;PAHAWH HMONG VOWEL KIV;Lo;0;L;;;;;N;;;;; +16B04;PAHAWH HMONG VOWEL KAUB;Lo;0;L;;;;;N;;;;; +16B05;PAHAWH HMONG VOWEL KAUV;Lo;0;L;;;;;N;;;;; +16B06;PAHAWH HMONG VOWEL KUB;Lo;0;L;;;;;N;;;;; +16B07;PAHAWH HMONG VOWEL KUV;Lo;0;L;;;;;N;;;;; +16B08;PAHAWH HMONG VOWEL KEB;Lo;0;L;;;;;N;;;;; +16B09;PAHAWH HMONG VOWEL KEV;Lo;0;L;;;;;N;;;;; +16B0A;PAHAWH HMONG VOWEL KAIB;Lo;0;L;;;;;N;;;;; +16B0B;PAHAWH HMONG VOWEL KAIV;Lo;0;L;;;;;N;;;;; +16B0C;PAHAWH HMONG VOWEL KOOB;Lo;0;L;;;;;N;;;;; +16B0D;PAHAWH HMONG VOWEL KOOV;Lo;0;L;;;;;N;;;;; +16B0E;PAHAWH HMONG VOWEL KAWB;Lo;0;L;;;;;N;;;;; +16B0F;PAHAWH HMONG VOWEL KAWV;Lo;0;L;;;;;N;;;;; +16B10;PAHAWH HMONG VOWEL KUAB;Lo;0;L;;;;;N;;;;; +16B11;PAHAWH HMONG VOWEL KUAV;Lo;0;L;;;;;N;;;;; +16B12;PAHAWH HMONG VOWEL KOB;Lo;0;L;;;;;N;;;;; +16B13;PAHAWH HMONG VOWEL KOV;Lo;0;L;;;;;N;;;;; +16B14;PAHAWH HMONG VOWEL KIAB;Lo;0;L;;;;;N;;;;; +16B15;PAHAWH HMONG VOWEL KIAV;Lo;0;L;;;;;N;;;;; +16B16;PAHAWH HMONG VOWEL KAB;Lo;0;L;;;;;N;;;;; +16B17;PAHAWH HMONG VOWEL KAV;Lo;0;L;;;;;N;;;;; +16B18;PAHAWH HMONG VOWEL KWB;Lo;0;L;;;;;N;;;;; +16B19;PAHAWH HMONG VOWEL KWV;Lo;0;L;;;;;N;;;;; +16B1A;PAHAWH HMONG VOWEL KAAB;Lo;0;L;;;;;N;;;;; +16B1B;PAHAWH HMONG VOWEL KAAV;Lo;0;L;;;;;N;;;;; +16B1C;PAHAWH HMONG CONSONANT VAU;Lo;0;L;;;;;N;;;;; +16B1D;PAHAWH HMONG CONSONANT NTSAU;Lo;0;L;;;;;N;;;;; +16B1E;PAHAWH HMONG CONSONANT LAU;Lo;0;L;;;;;N;;;;; +16B1F;PAHAWH HMONG CONSONANT HAU;Lo;0;L;;;;;N;;;;; +16B20;PAHAWH HMONG CONSONANT NLAU;Lo;0;L;;;;;N;;;;; +16B21;PAHAWH HMONG CONSONANT RAU;Lo;0;L;;;;;N;;;;; +16B22;PAHAWH HMONG CONSONANT NKAU;Lo;0;L;;;;;N;;;;; +16B23;PAHAWH HMONG CONSONANT QHAU;Lo;0;L;;;;;N;;;;; +16B24;PAHAWH HMONG CONSONANT YAU;Lo;0;L;;;;;N;;;;; +16B25;PAHAWH HMONG CONSONANT HLAU;Lo;0;L;;;;;N;;;;; +16B26;PAHAWH HMONG CONSONANT MAU;Lo;0;L;;;;;N;;;;; +16B27;PAHAWH HMONG CONSONANT CHAU;Lo;0;L;;;;;N;;;;; +16B28;PAHAWH HMONG CONSONANT NCHAU;Lo;0;L;;;;;N;;;;; +16B29;PAHAWH HMONG CONSONANT HNAU;Lo;0;L;;;;;N;;;;; +16B2A;PAHAWH HMONG CONSONANT PLHAU;Lo;0;L;;;;;N;;;;; +16B2B;PAHAWH HMONG CONSONANT NTHAU;Lo;0;L;;;;;N;;;;; +16B2C;PAHAWH HMONG CONSONANT NAU;Lo;0;L;;;;;N;;;;; +16B2D;PAHAWH HMONG CONSONANT AU;Lo;0;L;;;;;N;;;;; +16B2E;PAHAWH HMONG CONSONANT XAU;Lo;0;L;;;;;N;;;;; +16B2F;PAHAWH HMONG CONSONANT CAU;Lo;0;L;;;;;N;;;;; +16B30;PAHAWH HMONG MARK CIM TUB;Mn;230;NSM;;;;;N;;;;; +16B31;PAHAWH HMONG MARK CIM SO;Mn;230;NSM;;;;;N;;;;; +16B32;PAHAWH HMONG MARK CIM KES;Mn;230;NSM;;;;;N;;;;; +16B33;PAHAWH HMONG MARK CIM KHAV;Mn;230;NSM;;;;;N;;;;; +16B34;PAHAWH HMONG MARK CIM SUAM;Mn;230;NSM;;;;;N;;;;; +16B35;PAHAWH HMONG MARK CIM HOM;Mn;230;NSM;;;;;N;;;;; +16B36;PAHAWH HMONG MARK CIM TAUM;Mn;230;NSM;;;;;N;;;;; +16B37;PAHAWH HMONG SIGN VOS THOM;Po;0;L;;;;;N;;;;; +16B38;PAHAWH HMONG SIGN VOS TSHAB CEEB;Po;0;L;;;;;N;;;;; +16B39;PAHAWH HMONG SIGN CIM CHEEM;Po;0;L;;;;;N;;;;; +16B3A;PAHAWH HMONG SIGN VOS THIAB;Po;0;L;;;;;N;;;;; +16B3B;PAHAWH HMONG SIGN VOS FEEM;Po;0;L;;;;;N;;;;; +16B3C;PAHAWH HMONG SIGN XYEEM NTXIV;So;0;L;;;;;N;;;;; +16B3D;PAHAWH HMONG SIGN XYEEM RHO;So;0;L;;;;;N;;;;; +16B3E;PAHAWH HMONG SIGN XYEEM TOV;So;0;L;;;;;N;;;;; +16B3F;PAHAWH HMONG SIGN XYEEM FAIB;So;0;L;;;;;N;;;;; +16B40;PAHAWH HMONG SIGN VOS SEEV;Lm;0;L;;;;;N;;;;; +16B41;PAHAWH HMONG SIGN MEEJ SUAB;Lm;0;L;;;;;N;;;;; +16B42;PAHAWH HMONG SIGN VOS NRUA;Lm;0;L;;;;;N;;;;; +16B43;PAHAWH HMONG SIGN IB YAM;Lm;0;L;;;;;N;;;;; +16B44;PAHAWH HMONG SIGN XAUS;Po;0;L;;;;;N;;;;; +16B45;PAHAWH HMONG SIGN CIM TSOV ROG;So;0;L;;;;;N;;;;; +16B50;PAHAWH HMONG DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;; +16B51;PAHAWH HMONG DIGIT ONE;Nd;0;L;;1;1;1;N;;;;; +16B52;PAHAWH HMONG DIGIT TWO;Nd;0;L;;2;2;2;N;;;;; +16B53;PAHAWH HMONG DIGIT THREE;Nd;0;L;;3;3;3;N;;;;; +16B54;PAHAWH HMONG DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;; +16B55;PAHAWH HMONG DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;; +16B56;PAHAWH HMONG DIGIT SIX;Nd;0;L;;6;6;6;N;;;;; +16B57;PAHAWH HMONG DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;; +16B58;PAHAWH HMONG DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;; +16B59;PAHAWH HMONG DIGIT NINE;Nd;0;L;;9;9;9;N;;;;; +16B5B;PAHAWH HMONG NUMBER TENS;No;0;L;;;;10;N;;;;; +16B5C;PAHAWH HMONG NUMBER HUNDREDS;No;0;L;;;;100;N;;;;; +16B5D;PAHAWH HMONG NUMBER TEN THOUSANDS;No;0;L;;;;10000;N;;;;; +16B5E;PAHAWH HMONG NUMBER MILLIONS;No;0;L;;;;1000000;N;;;;; +16B5F;PAHAWH HMONG NUMBER HUNDRED MILLIONS;No;0;L;;;;100000000;N;;;;; +16B60;PAHAWH HMONG NUMBER TEN BILLIONS;No;0;L;;;;10000000000;N;;;;; +16B61;PAHAWH HMONG NUMBER TRILLIONS;No;0;L;;;;1000000000000;N;;;;; +16B63;PAHAWH HMONG SIGN VOS LUB;Lo;0;L;;;;;N;;;;; +16B64;PAHAWH HMONG SIGN XYOO;Lo;0;L;;;;;N;;;;; +16B65;PAHAWH HMONG SIGN HLI;Lo;0;L;;;;;N;;;;; +16B66;PAHAWH HMONG SIGN THIRD-STAGE HLI;Lo;0;L;;;;;N;;;;; +16B67;PAHAWH HMONG SIGN ZWJ THAJ;Lo;0;L;;;;;N;;;;; +16B68;PAHAWH HMONG SIGN HNUB;Lo;0;L;;;;;N;;;;; +16B69;PAHAWH HMONG SIGN NQIG;Lo;0;L;;;;;N;;;;; +16B6A;PAHAWH HMONG SIGN XIAB;Lo;0;L;;;;;N;;;;; +16B6B;PAHAWH HMONG SIGN NTUJ;Lo;0;L;;;;;N;;;;; +16B6C;PAHAWH HMONG SIGN AV;Lo;0;L;;;;;N;;;;; +16B6D;PAHAWH HMONG SIGN TXHEEJ CEEV;Lo;0;L;;;;;N;;;;; +16B6E;PAHAWH HMONG SIGN MEEJ TSEEB;Lo;0;L;;;;;N;;;;; +16B6F;PAHAWH HMONG SIGN TAU;Lo;0;L;;;;;N;;;;; +16B70;PAHAWH HMONG SIGN LOS;Lo;0;L;;;;;N;;;;; +16B71;PAHAWH HMONG SIGN MUS;Lo;0;L;;;;;N;;;;; +16B72;PAHAWH HMONG SIGN CIM HAIS LUS NTOG NTOG;Lo;0;L;;;;;N;;;;; +16B73;PAHAWH HMONG SIGN CIM CUAM TSHOOJ;Lo;0;L;;;;;N;;;;; +16B74;PAHAWH HMONG SIGN CIM TXWV;Lo;0;L;;;;;N;;;;; +16B75;PAHAWH HMONG SIGN CIM TXWV CHWV;Lo;0;L;;;;;N;;;;; +16B76;PAHAWH HMONG SIGN CIM PUB DAWB;Lo;0;L;;;;;N;;;;; +16B77;PAHAWH HMONG SIGN CIM NRES TOS;Lo;0;L;;;;;N;;;;; +16B7D;PAHAWH HMONG CLAN SIGN TSHEEJ;Lo;0;L;;;;;N;;;;; +16B7E;PAHAWH HMONG CLAN SIGN YEEG;Lo;0;L;;;;;N;;;;; +16B7F;PAHAWH HMONG CLAN SIGN LIS;Lo;0;L;;;;;N;;;;; +16B80;PAHAWH HMONG CLAN SIGN LAUJ;Lo;0;L;;;;;N;;;;; +16B81;PAHAWH HMONG CLAN SIGN XYOOJ;Lo;0;L;;;;;N;;;;; +16B82;PAHAWH HMONG CLAN SIGN KOO;Lo;0;L;;;;;N;;;;; +16B83;PAHAWH HMONG CLAN SIGN HAWJ;Lo;0;L;;;;;N;;;;; +16B84;PAHAWH HMONG CLAN SIGN MUAS;Lo;0;L;;;;;N;;;;; +16B85;PAHAWH HMONG CLAN SIGN THOJ;Lo;0;L;;;;;N;;;;; +16B86;PAHAWH HMONG CLAN SIGN TSAB;Lo;0;L;;;;;N;;;;; +16B87;PAHAWH HMONG CLAN SIGN PHAB;Lo;0;L;;;;;N;;;;; +16B88;PAHAWH HMONG CLAN SIGN KHAB;Lo;0;L;;;;;N;;;;; +16B89;PAHAWH HMONG CLAN SIGN HAM;Lo;0;L;;;;;N;;;;; +16B8A;PAHAWH HMONG CLAN SIGN VAJ;Lo;0;L;;;;;N;;;;; +16B8B;PAHAWH HMONG CLAN SIGN FAJ;Lo;0;L;;;;;N;;;;; +16B8C;PAHAWH HMONG CLAN SIGN YAJ;Lo;0;L;;;;;N;;;;; +16B8D;PAHAWH HMONG CLAN SIGN TSWB;Lo;0;L;;;;;N;;;;; +16B8E;PAHAWH HMONG CLAN SIGN KWM;Lo;0;L;;;;;N;;;;; +16B8F;PAHAWH HMONG CLAN SIGN VWJ;Lo;0;L;;;;;N;;;;; +16F00;MIAO LETTER PA;Lo;0;L;;;;;N;;;;; +16F01;MIAO LETTER BA;Lo;0;L;;;;;N;;;;; +16F02;MIAO LETTER YI PA;Lo;0;L;;;;;N;;;;; +16F03;MIAO LETTER PLA;Lo;0;L;;;;;N;;;;; +16F04;MIAO LETTER MA;Lo;0;L;;;;;N;;;;; +16F05;MIAO LETTER MHA;Lo;0;L;;;;;N;;;;; +16F06;MIAO LETTER ARCHAIC MA;Lo;0;L;;;;;N;;;;; +16F07;MIAO LETTER FA;Lo;0;L;;;;;N;;;;; +16F08;MIAO LETTER VA;Lo;0;L;;;;;N;;;;; +16F09;MIAO LETTER VFA;Lo;0;L;;;;;N;;;;; +16F0A;MIAO LETTER TA;Lo;0;L;;;;;N;;;;; +16F0B;MIAO LETTER DA;Lo;0;L;;;;;N;;;;; +16F0C;MIAO LETTER YI TTA;Lo;0;L;;;;;N;;;;; +16F0D;MIAO LETTER YI TA;Lo;0;L;;;;;N;;;;; +16F0E;MIAO LETTER TTA;Lo;0;L;;;;;N;;;;; +16F0F;MIAO LETTER DDA;Lo;0;L;;;;;N;;;;; +16F10;MIAO LETTER NA;Lo;0;L;;;;;N;;;;; +16F11;MIAO LETTER NHA;Lo;0;L;;;;;N;;;;; +16F12;MIAO LETTER YI NNA;Lo;0;L;;;;;N;;;;; +16F13;MIAO LETTER ARCHAIC NA;Lo;0;L;;;;;N;;;;; +16F14;MIAO LETTER NNA;Lo;0;L;;;;;N;;;;; +16F15;MIAO LETTER NNHA;Lo;0;L;;;;;N;;;;; +16F16;MIAO LETTER LA;Lo;0;L;;;;;N;;;;; +16F17;MIAO LETTER LYA;Lo;0;L;;;;;N;;;;; +16F18;MIAO LETTER LHA;Lo;0;L;;;;;N;;;;; +16F19;MIAO LETTER LHYA;Lo;0;L;;;;;N;;;;; +16F1A;MIAO LETTER TLHA;Lo;0;L;;;;;N;;;;; +16F1B;MIAO LETTER DLHA;Lo;0;L;;;;;N;;;;; +16F1C;MIAO LETTER TLHYA;Lo;0;L;;;;;N;;;;; +16F1D;MIAO LETTER DLHYA;Lo;0;L;;;;;N;;;;; +16F1E;MIAO LETTER KA;Lo;0;L;;;;;N;;;;; +16F1F;MIAO LETTER GA;Lo;0;L;;;;;N;;;;; +16F20;MIAO LETTER YI KA;Lo;0;L;;;;;N;;;;; +16F21;MIAO LETTER QA;Lo;0;L;;;;;N;;;;; +16F22;MIAO LETTER QGA;Lo;0;L;;;;;N;;;;; +16F23;MIAO LETTER NGA;Lo;0;L;;;;;N;;;;; +16F24;MIAO LETTER NGHA;Lo;0;L;;;;;N;;;;; +16F25;MIAO LETTER ARCHAIC NGA;Lo;0;L;;;;;N;;;;; +16F26;MIAO LETTER HA;Lo;0;L;;;;;N;;;;; +16F27;MIAO LETTER XA;Lo;0;L;;;;;N;;;;; +16F28;MIAO LETTER GHA;Lo;0;L;;;;;N;;;;; +16F29;MIAO LETTER GHHA;Lo;0;L;;;;;N;;;;; +16F2A;MIAO LETTER TSSA;Lo;0;L;;;;;N;;;;; +16F2B;MIAO LETTER DZZA;Lo;0;L;;;;;N;;;;; +16F2C;MIAO LETTER NYA;Lo;0;L;;;;;N;;;;; +16F2D;MIAO LETTER NYHA;Lo;0;L;;;;;N;;;;; +16F2E;MIAO LETTER TSHA;Lo;0;L;;;;;N;;;;; +16F2F;MIAO LETTER DZHA;Lo;0;L;;;;;N;;;;; +16F30;MIAO LETTER YI TSHA;Lo;0;L;;;;;N;;;;; +16F31;MIAO LETTER YI DZHA;Lo;0;L;;;;;N;;;;; +16F32;MIAO LETTER REFORMED TSHA;Lo;0;L;;;;;N;;;;; +16F33;MIAO LETTER SHA;Lo;0;L;;;;;N;;;;; +16F34;MIAO LETTER SSA;Lo;0;L;;;;;N;;;;; +16F35;MIAO LETTER ZHA;Lo;0;L;;;;;N;;;;; +16F36;MIAO LETTER ZSHA;Lo;0;L;;;;;N;;;;; +16F37;MIAO LETTER TSA;Lo;0;L;;;;;N;;;;; +16F38;MIAO LETTER DZA;Lo;0;L;;;;;N;;;;; +16F39;MIAO LETTER YI TSA;Lo;0;L;;;;;N;;;;; +16F3A;MIAO LETTER SA;Lo;0;L;;;;;N;;;;; +16F3B;MIAO LETTER ZA;Lo;0;L;;;;;N;;;;; +16F3C;MIAO LETTER ZSA;Lo;0;L;;;;;N;;;;; +16F3D;MIAO LETTER ZZA;Lo;0;L;;;;;N;;;;; +16F3E;MIAO LETTER ZZSA;Lo;0;L;;;;;N;;;;; +16F3F;MIAO LETTER ARCHAIC ZZA;Lo;0;L;;;;;N;;;;; +16F40;MIAO LETTER ZZYA;Lo;0;L;;;;;N;;;;; +16F41;MIAO LETTER ZZSYA;Lo;0;L;;;;;N;;;;; +16F42;MIAO LETTER WA;Lo;0;L;;;;;N;;;;; +16F43;MIAO LETTER AH;Lo;0;L;;;;;N;;;;; +16F44;MIAO LETTER HHA;Lo;0;L;;;;;N;;;;; +16F50;MIAO LETTER NASALIZATION;Lo;0;L;;;;;N;;;;; +16F51;MIAO SIGN ASPIRATION;Mc;0;L;;;;;N;;;;; +16F52;MIAO SIGN REFORMED VOICING;Mc;0;L;;;;;N;;;;; +16F53;MIAO SIGN REFORMED ASPIRATION;Mc;0;L;;;;;N;;;;; +16F54;MIAO VOWEL SIGN A;Mc;0;L;;;;;N;;;;; +16F55;MIAO VOWEL SIGN AA;Mc;0;L;;;;;N;;;;; +16F56;MIAO VOWEL SIGN AHH;Mc;0;L;;;;;N;;;;; +16F57;MIAO VOWEL SIGN AN;Mc;0;L;;;;;N;;;;; +16F58;MIAO VOWEL SIGN ANG;Mc;0;L;;;;;N;;;;; +16F59;MIAO VOWEL SIGN O;Mc;0;L;;;;;N;;;;; +16F5A;MIAO VOWEL SIGN OO;Mc;0;L;;;;;N;;;;; +16F5B;MIAO VOWEL SIGN WO;Mc;0;L;;;;;N;;;;; +16F5C;MIAO VOWEL SIGN W;Mc;0;L;;;;;N;;;;; +16F5D;MIAO VOWEL SIGN E;Mc;0;L;;;;;N;;;;; +16F5E;MIAO VOWEL SIGN EN;Mc;0;L;;;;;N;;;;; +16F5F;MIAO VOWEL SIGN ENG;Mc;0;L;;;;;N;;;;; +16F60;MIAO VOWEL SIGN OEY;Mc;0;L;;;;;N;;;;; +16F61;MIAO VOWEL SIGN I;Mc;0;L;;;;;N;;;;; +16F62;MIAO VOWEL SIGN IA;Mc;0;L;;;;;N;;;;; +16F63;MIAO VOWEL SIGN IAN;Mc;0;L;;;;;N;;;;; +16F64;MIAO VOWEL SIGN IANG;Mc;0;L;;;;;N;;;;; +16F65;MIAO VOWEL SIGN IO;Mc;0;L;;;;;N;;;;; +16F66;MIAO VOWEL SIGN IE;Mc;0;L;;;;;N;;;;; +16F67;MIAO VOWEL SIGN II;Mc;0;L;;;;;N;;;;; +16F68;MIAO VOWEL SIGN IU;Mc;0;L;;;;;N;;;;; +16F69;MIAO VOWEL SIGN ING;Mc;0;L;;;;;N;;;;; +16F6A;MIAO VOWEL SIGN U;Mc;0;L;;;;;N;;;;; +16F6B;MIAO VOWEL SIGN UA;Mc;0;L;;;;;N;;;;; +16F6C;MIAO VOWEL SIGN UAN;Mc;0;L;;;;;N;;;;; +16F6D;MIAO VOWEL SIGN UANG;Mc;0;L;;;;;N;;;;; +16F6E;MIAO VOWEL SIGN UU;Mc;0;L;;;;;N;;;;; +16F6F;MIAO VOWEL SIGN UEI;Mc;0;L;;;;;N;;;;; +16F70;MIAO VOWEL SIGN UNG;Mc;0;L;;;;;N;;;;; +16F71;MIAO VOWEL SIGN Y;Mc;0;L;;;;;N;;;;; +16F72;MIAO VOWEL SIGN YI;Mc;0;L;;;;;N;;;;; +16F73;MIAO VOWEL SIGN AE;Mc;0;L;;;;;N;;;;; +16F74;MIAO VOWEL SIGN AEE;Mc;0;L;;;;;N;;;;; +16F75;MIAO VOWEL SIGN ERR;Mc;0;L;;;;;N;;;;; +16F76;MIAO VOWEL SIGN ROUNDED ERR;Mc;0;L;;;;;N;;;;; +16F77;MIAO VOWEL SIGN ER;Mc;0;L;;;;;N;;;;; +16F78;MIAO VOWEL SIGN ROUNDED ER;Mc;0;L;;;;;N;;;;; +16F79;MIAO VOWEL SIGN AI;Mc;0;L;;;;;N;;;;; +16F7A;MIAO VOWEL SIGN EI;Mc;0;L;;;;;N;;;;; +16F7B;MIAO VOWEL SIGN AU;Mc;0;L;;;;;N;;;;; +16F7C;MIAO VOWEL SIGN OU;Mc;0;L;;;;;N;;;;; +16F7D;MIAO VOWEL SIGN N;Mc;0;L;;;;;N;;;;; +16F7E;MIAO VOWEL SIGN NG;Mc;0;L;;;;;N;;;;; +16F8F;MIAO TONE RIGHT;Mn;0;NSM;;;;;N;;;;; +16F90;MIAO TONE TOP RIGHT;Mn;0;NSM;;;;;N;;;;; +16F91;MIAO TONE ABOVE;Mn;0;NSM;;;;;N;;;;; +16F92;MIAO TONE BELOW;Mn;0;NSM;;;;;N;;;;; +16F93;MIAO LETTER TONE-2;Lm;0;L;;;;;N;;;;; +16F94;MIAO LETTER TONE-3;Lm;0;L;;;;;N;;;;; +16F95;MIAO LETTER TONE-4;Lm;0;L;;;;;N;;;;; +16F96;MIAO LETTER TONE-5;Lm;0;L;;;;;N;;;;; +16F97;MIAO LETTER TONE-6;Lm;0;L;;;;;N;;;;; +16F98;MIAO LETTER TONE-7;Lm;0;L;;;;;N;;;;; +16F99;MIAO LETTER TONE-8;Lm;0;L;;;;;N;;;;; +16F9A;MIAO LETTER REFORMED TONE-1;Lm;0;L;;;;;N;;;;; +16F9B;MIAO LETTER REFORMED TONE-2;Lm;0;L;;;;;N;;;;; +16F9C;MIAO LETTER REFORMED TONE-4;Lm;0;L;;;;;N;;;;; +16F9D;MIAO LETTER REFORMED TONE-5;Lm;0;L;;;;;N;;;;; +16F9E;MIAO LETTER REFORMED TONE-6;Lm;0;L;;;;;N;;;;; +16F9F;MIAO LETTER REFORMED TONE-8;Lm;0;L;;;;;N;;;;; +16FE0;TANGUT ITERATION MARK;Lm;0;L;;;;;N;;;;; +16FE1;NUSHU ITERATION MARK;Lm;0;L;;;;;N;;;;; +17000;<Tangut Ideograph, First>;Lo;0;L;;;;;N;;;;; +187EC;<Tangut Ideograph, Last>;Lo;0;L;;;;;N;;;;; +18800;TANGUT COMPONENT-001;Lo;0;L;;;;;N;;;;; +18801;TANGUT COMPONENT-002;Lo;0;L;;;;;N;;;;; +18802;TANGUT COMPONENT-003;Lo;0;L;;;;;N;;;;; +18803;TANGUT COMPONENT-004;Lo;0;L;;;;;N;;;;; +18804;TANGUT COMPONENT-005;Lo;0;L;;;;;N;;;;; +18805;TANGUT COMPONENT-006;Lo;0;L;;;;;N;;;;; +18806;TANGUT COMPONENT-007;Lo;0;L;;;;;N;;;;; +18807;TANGUT COMPONENT-008;Lo;0;L;;;;;N;;;;; +18808;TANGUT COMPONENT-009;Lo;0;L;;;;;N;;;;; +18809;TANGUT COMPONENT-010;Lo;0;L;;;;;N;;;;; +1880A;TANGUT COMPONENT-011;Lo;0;L;;;;;N;;;;; +1880B;TANGUT COMPONENT-012;Lo;0;L;;;;;N;;;;; +1880C;TANGUT COMPONENT-013;Lo;0;L;;;;;N;;;;; +1880D;TANGUT COMPONENT-014;Lo;0;L;;;;;N;;;;; +1880E;TANGUT COMPONENT-015;Lo;0;L;;;;;N;;;;; +1880F;TANGUT COMPONENT-016;Lo;0;L;;;;;N;;;;; +18810;TANGUT COMPONENT-017;Lo;0;L;;;;;N;;;;; +18811;TANGUT COMPONENT-018;Lo;0;L;;;;;N;;;;; +18812;TANGUT COMPONENT-019;Lo;0;L;;;;;N;;;;; +18813;TANGUT COMPONENT-020;Lo;0;L;;;;;N;;;;; +18814;TANGUT COMPONENT-021;Lo;0;L;;;;;N;;;;; +18815;TANGUT COMPONENT-022;Lo;0;L;;;;;N;;;;; +18816;TANGUT COMPONENT-023;Lo;0;L;;;;;N;;;;; +18817;TANGUT COMPONENT-024;Lo;0;L;;;;;N;;;;; +18818;TANGUT COMPONENT-025;Lo;0;L;;;;;N;;;;; +18819;TANGUT COMPONENT-026;Lo;0;L;;;;;N;;;;; +1881A;TANGUT COMPONENT-027;Lo;0;L;;;;;N;;;;; +1881B;TANGUT COMPONENT-028;Lo;0;L;;;;;N;;;;; +1881C;TANGUT COMPONENT-029;Lo;0;L;;;;;N;;;;; +1881D;TANGUT COMPONENT-030;Lo;0;L;;;;;N;;;;; +1881E;TANGUT COMPONENT-031;Lo;0;L;;;;;N;;;;; +1881F;TANGUT COMPONENT-032;Lo;0;L;;;;;N;;;;; +18820;TANGUT COMPONENT-033;Lo;0;L;;;;;N;;;;; +18821;TANGUT COMPONENT-034;Lo;0;L;;;;;N;;;;; +18822;TANGUT COMPONENT-035;Lo;0;L;;;;;N;;;;; +18823;TANGUT COMPONENT-036;Lo;0;L;;;;;N;;;;; +18824;TANGUT COMPONENT-037;Lo;0;L;;;;;N;;;;; +18825;TANGUT COMPONENT-038;Lo;0;L;;;;;N;;;;; +18826;TANGUT COMPONENT-039;Lo;0;L;;;;;N;;;;; +18827;TANGUT COMPONENT-040;Lo;0;L;;;;;N;;;;; +18828;TANGUT COMPONENT-041;Lo;0;L;;;;;N;;;;; +18829;TANGUT COMPONENT-042;Lo;0;L;;;;;N;;;;; +1882A;TANGUT COMPONENT-043;Lo;0;L;;;;;N;;;;; +1882B;TANGUT COMPONENT-044;Lo;0;L;;;;;N;;;;; +1882C;TANGUT COMPONENT-045;Lo;0;L;;;;;N;;;;; +1882D;TANGUT COMPONENT-046;Lo;0;L;;;;;N;;;;; +1882E;TANGUT COMPONENT-047;Lo;0;L;;;;;N;;;;; +1882F;TANGUT COMPONENT-048;Lo;0;L;;;;;N;;;;; +18830;TANGUT COMPONENT-049;Lo;0;L;;;;;N;;;;; +18831;TANGUT COMPONENT-050;Lo;0;L;;;;;N;;;;; +18832;TANGUT COMPONENT-051;Lo;0;L;;;;;N;;;;; +18833;TANGUT COMPONENT-052;Lo;0;L;;;;;N;;;;; +18834;TANGUT COMPONENT-053;Lo;0;L;;;;;N;;;;; +18835;TANGUT COMPONENT-054;Lo;0;L;;;;;N;;;;; +18836;TANGUT COMPONENT-055;Lo;0;L;;;;;N;;;;; +18837;TANGUT COMPONENT-056;Lo;0;L;;;;;N;;;;; +18838;TANGUT COMPONENT-057;Lo;0;L;;;;;N;;;;; +18839;TANGUT COMPONENT-058;Lo;0;L;;;;;N;;;;; +1883A;TANGUT COMPONENT-059;Lo;0;L;;;;;N;;;;; +1883B;TANGUT COMPONENT-060;Lo;0;L;;;;;N;;;;; +1883C;TANGUT COMPONENT-061;Lo;0;L;;;;;N;;;;; +1883D;TANGUT COMPONENT-062;Lo;0;L;;;;;N;;;;; +1883E;TANGUT COMPONENT-063;Lo;0;L;;;;;N;;;;; +1883F;TANGUT COMPONENT-064;Lo;0;L;;;;;N;;;;; +18840;TANGUT COMPONENT-065;Lo;0;L;;;;;N;;;;; +18841;TANGUT COMPONENT-066;Lo;0;L;;;;;N;;;;; +18842;TANGUT COMPONENT-067;Lo;0;L;;;;;N;;;;; +18843;TANGUT COMPONENT-068;Lo;0;L;;;;;N;;;;; +18844;TANGUT COMPONENT-069;Lo;0;L;;;;;N;;;;; +18845;TANGUT COMPONENT-070;Lo;0;L;;;;;N;;;;; +18846;TANGUT COMPONENT-071;Lo;0;L;;;;;N;;;;; +18847;TANGUT COMPONENT-072;Lo;0;L;;;;;N;;;;; +18848;TANGUT COMPONENT-073;Lo;0;L;;;;;N;;;;; +18849;TANGUT COMPONENT-074;Lo;0;L;;;;;N;;;;; +1884A;TANGUT COMPONENT-075;Lo;0;L;;;;;N;;;;; +1884B;TANGUT COMPONENT-076;Lo;0;L;;;;;N;;;;; +1884C;TANGUT COMPONENT-077;Lo;0;L;;;;;N;;;;; +1884D;TANGUT COMPONENT-078;Lo;0;L;;;;;N;;;;; +1884E;TANGUT COMPONENT-079;Lo;0;L;;;;;N;;;;; +1884F;TANGUT COMPONENT-080;Lo;0;L;;;;;N;;;;; +18850;TANGUT COMPONENT-081;Lo;0;L;;;;;N;;;;; +18851;TANGUT COMPONENT-082;Lo;0;L;;;;;N;;;;; +18852;TANGUT COMPONENT-083;Lo;0;L;;;;;N;;;;; +18853;TANGUT COMPONENT-084;Lo;0;L;;;;;N;;;;; +18854;TANGUT COMPONENT-085;Lo;0;L;;;;;N;;;;; +18855;TANGUT COMPONENT-086;Lo;0;L;;;;;N;;;;; +18856;TANGUT COMPONENT-087;Lo;0;L;;;;;N;;;;; +18857;TANGUT COMPONENT-088;Lo;0;L;;;;;N;;;;; +18858;TANGUT COMPONENT-089;Lo;0;L;;;;;N;;;;; +18859;TANGUT COMPONENT-090;Lo;0;L;;;;;N;;;;; +1885A;TANGUT COMPONENT-091;Lo;0;L;;;;;N;;;;; +1885B;TANGUT COMPONENT-092;Lo;0;L;;;;;N;;;;; +1885C;TANGUT COMPONENT-093;Lo;0;L;;;;;N;;;;; +1885D;TANGUT COMPONENT-094;Lo;0;L;;;;;N;;;;; +1885E;TANGUT COMPONENT-095;Lo;0;L;;;;;N;;;;; +1885F;TANGUT COMPONENT-096;Lo;0;L;;;;;N;;;;; +18860;TANGUT COMPONENT-097;Lo;0;L;;;;;N;;;;; +18861;TANGUT COMPONENT-098;Lo;0;L;;;;;N;;;;; +18862;TANGUT COMPONENT-099;Lo;0;L;;;;;N;;;;; +18863;TANGUT COMPONENT-100;Lo;0;L;;;;;N;;;;; +18864;TANGUT COMPONENT-101;Lo;0;L;;;;;N;;;;; +18865;TANGUT COMPONENT-102;Lo;0;L;;;;;N;;;;; +18866;TANGUT COMPONENT-103;Lo;0;L;;;;;N;;;;; +18867;TANGUT COMPONENT-104;Lo;0;L;;;;;N;;;;; +18868;TANGUT COMPONENT-105;Lo;0;L;;;;;N;;;;; +18869;TANGUT COMPONENT-106;Lo;0;L;;;;;N;;;;; +1886A;TANGUT COMPONENT-107;Lo;0;L;;;;;N;;;;; +1886B;TANGUT COMPONENT-108;Lo;0;L;;;;;N;;;;; +1886C;TANGUT COMPONENT-109;Lo;0;L;;;;;N;;;;; +1886D;TANGUT COMPONENT-110;Lo;0;L;;;;;N;;;;; +1886E;TANGUT COMPONENT-111;Lo;0;L;;;;;N;;;;; +1886F;TANGUT COMPONENT-112;Lo;0;L;;;;;N;;;;; +18870;TANGUT COMPONENT-113;Lo;0;L;;;;;N;;;;; +18871;TANGUT COMPONENT-114;Lo;0;L;;;;;N;;;;; +18872;TANGUT COMPONENT-115;Lo;0;L;;;;;N;;;;; +18873;TANGUT COMPONENT-116;Lo;0;L;;;;;N;;;;; +18874;TANGUT COMPONENT-117;Lo;0;L;;;;;N;;;;; +18875;TANGUT COMPONENT-118;Lo;0;L;;;;;N;;;;; +18876;TANGUT COMPONENT-119;Lo;0;L;;;;;N;;;;; +18877;TANGUT COMPONENT-120;Lo;0;L;;;;;N;;;;; +18878;TANGUT COMPONENT-121;Lo;0;L;;;;;N;;;;; +18879;TANGUT COMPONENT-122;Lo;0;L;;;;;N;;;;; +1887A;TANGUT COMPONENT-123;Lo;0;L;;;;;N;;;;; +1887B;TANGUT COMPONENT-124;Lo;0;L;;;;;N;;;;; +1887C;TANGUT COMPONENT-125;Lo;0;L;;;;;N;;;;; +1887D;TANGUT COMPONENT-126;Lo;0;L;;;;;N;;;;; +1887E;TANGUT COMPONENT-127;Lo;0;L;;;;;N;;;;; +1887F;TANGUT COMPONENT-128;Lo;0;L;;;;;N;;;;; +18880;TANGUT COMPONENT-129;Lo;0;L;;;;;N;;;;; +18881;TANGUT COMPONENT-130;Lo;0;L;;;;;N;;;;; +18882;TANGUT COMPONENT-131;Lo;0;L;;;;;N;;;;; +18883;TANGUT COMPONENT-132;Lo;0;L;;;;;N;;;;; +18884;TANGUT COMPONENT-133;Lo;0;L;;;;;N;;;;; +18885;TANGUT COMPONENT-134;Lo;0;L;;;;;N;;;;; +18886;TANGUT COMPONENT-135;Lo;0;L;;;;;N;;;;; +18887;TANGUT COMPONENT-136;Lo;0;L;;;;;N;;;;; +18888;TANGUT COMPONENT-137;Lo;0;L;;;;;N;;;;; +18889;TANGUT COMPONENT-138;Lo;0;L;;;;;N;;;;; +1888A;TANGUT COMPONENT-139;Lo;0;L;;;;;N;;;;; +1888B;TANGUT COMPONENT-140;Lo;0;L;;;;;N;;;;; +1888C;TANGUT COMPONENT-141;Lo;0;L;;;;;N;;;;; +1888D;TANGUT COMPONENT-142;Lo;0;L;;;;;N;;;;; +1888E;TANGUT COMPONENT-143;Lo;0;L;;;;;N;;;;; +1888F;TANGUT COMPONENT-144;Lo;0;L;;;;;N;;;;; +18890;TANGUT COMPONENT-145;Lo;0;L;;;;;N;;;;; +18891;TANGUT COMPONENT-146;Lo;0;L;;;;;N;;;;; +18892;TANGUT COMPONENT-147;Lo;0;L;;;;;N;;;;; +18893;TANGUT COMPONENT-148;Lo;0;L;;;;;N;;;;; +18894;TANGUT COMPONENT-149;Lo;0;L;;;;;N;;;;; +18895;TANGUT COMPONENT-150;Lo;0;L;;;;;N;;;;; +18896;TANGUT COMPONENT-151;Lo;0;L;;;;;N;;;;; +18897;TANGUT COMPONENT-152;Lo;0;L;;;;;N;;;;; +18898;TANGUT COMPONENT-153;Lo;0;L;;;;;N;;;;; +18899;TANGUT COMPONENT-154;Lo;0;L;;;;;N;;;;; +1889A;TANGUT COMPONENT-155;Lo;0;L;;;;;N;;;;; +1889B;TANGUT COMPONENT-156;Lo;0;L;;;;;N;;;;; +1889C;TANGUT COMPONENT-157;Lo;0;L;;;;;N;;;;; +1889D;TANGUT COMPONENT-158;Lo;0;L;;;;;N;;;;; +1889E;TANGUT COMPONENT-159;Lo;0;L;;;;;N;;;;; +1889F;TANGUT COMPONENT-160;Lo;0;L;;;;;N;;;;; +188A0;TANGUT COMPONENT-161;Lo;0;L;;;;;N;;;;; +188A1;TANGUT COMPONENT-162;Lo;0;L;;;;;N;;;;; +188A2;TANGUT COMPONENT-163;Lo;0;L;;;;;N;;;;; +188A3;TANGUT COMPONENT-164;Lo;0;L;;;;;N;;;;; +188A4;TANGUT COMPONENT-165;Lo;0;L;;;;;N;;;;; +188A5;TANGUT COMPONENT-166;Lo;0;L;;;;;N;;;;; +188A6;TANGUT COMPONENT-167;Lo;0;L;;;;;N;;;;; +188A7;TANGUT COMPONENT-168;Lo;0;L;;;;;N;;;;; +188A8;TANGUT COMPONENT-169;Lo;0;L;;;;;N;;;;; +188A9;TANGUT COMPONENT-170;Lo;0;L;;;;;N;;;;; +188AA;TANGUT COMPONENT-171;Lo;0;L;;;;;N;;;;; +188AB;TANGUT COMPONENT-172;Lo;0;L;;;;;N;;;;; +188AC;TANGUT COMPONENT-173;Lo;0;L;;;;;N;;;;; +188AD;TANGUT COMPONENT-174;Lo;0;L;;;;;N;;;;; +188AE;TANGUT COMPONENT-175;Lo;0;L;;;;;N;;;;; +188AF;TANGUT COMPONENT-176;Lo;0;L;;;;;N;;;;; +188B0;TANGUT COMPONENT-177;Lo;0;L;;;;;N;;;;; +188B1;TANGUT COMPONENT-178;Lo;0;L;;;;;N;;;;; +188B2;TANGUT COMPONENT-179;Lo;0;L;;;;;N;;;;; +188B3;TANGUT COMPONENT-180;Lo;0;L;;;;;N;;;;; +188B4;TANGUT COMPONENT-181;Lo;0;L;;;;;N;;;;; +188B5;TANGUT COMPONENT-182;Lo;0;L;;;;;N;;;;; +188B6;TANGUT COMPONENT-183;Lo;0;L;;;;;N;;;;; +188B7;TANGUT COMPONENT-184;Lo;0;L;;;;;N;;;;; +188B8;TANGUT COMPONENT-185;Lo;0;L;;;;;N;;;;; +188B9;TANGUT COMPONENT-186;Lo;0;L;;;;;N;;;;; +188BA;TANGUT COMPONENT-187;Lo;0;L;;;;;N;;;;; +188BB;TANGUT COMPONENT-188;Lo;0;L;;;;;N;;;;; +188BC;TANGUT COMPONENT-189;Lo;0;L;;;;;N;;;;; +188BD;TANGUT COMPONENT-190;Lo;0;L;;;;;N;;;;; +188BE;TANGUT COMPONENT-191;Lo;0;L;;;;;N;;;;; +188BF;TANGUT COMPONENT-192;Lo;0;L;;;;;N;;;;; +188C0;TANGUT COMPONENT-193;Lo;0;L;;;;;N;;;;; +188C1;TANGUT COMPONENT-194;Lo;0;L;;;;;N;;;;; +188C2;TANGUT COMPONENT-195;Lo;0;L;;;;;N;;;;; +188C3;TANGUT COMPONENT-196;Lo;0;L;;;;;N;;;;; +188C4;TANGUT COMPONENT-197;Lo;0;L;;;;;N;;;;; +188C5;TANGUT COMPONENT-198;Lo;0;L;;;;;N;;;;; +188C6;TANGUT COMPONENT-199;Lo;0;L;;;;;N;;;;; +188C7;TANGUT COMPONENT-200;Lo;0;L;;;;;N;;;;; +188C8;TANGUT COMPONENT-201;Lo;0;L;;;;;N;;;;; +188C9;TANGUT COMPONENT-202;Lo;0;L;;;;;N;;;;; +188CA;TANGUT COMPONENT-203;Lo;0;L;;;;;N;;;;; +188CB;TANGUT COMPONENT-204;Lo;0;L;;;;;N;;;;; +188CC;TANGUT COMPONENT-205;Lo;0;L;;;;;N;;;;; +188CD;TANGUT COMPONENT-206;Lo;0;L;;;;;N;;;;; +188CE;TANGUT COMPONENT-207;Lo;0;L;;;;;N;;;;; +188CF;TANGUT COMPONENT-208;Lo;0;L;;;;;N;;;;; +188D0;TANGUT COMPONENT-209;Lo;0;L;;;;;N;;;;; +188D1;TANGUT COMPONENT-210;Lo;0;L;;;;;N;;;;; +188D2;TANGUT COMPONENT-211;Lo;0;L;;;;;N;;;;; +188D3;TANGUT COMPONENT-212;Lo;0;L;;;;;N;;;;; +188D4;TANGUT COMPONENT-213;Lo;0;L;;;;;N;;;;; +188D5;TANGUT COMPONENT-214;Lo;0;L;;;;;N;;;;; +188D6;TANGUT COMPONENT-215;Lo;0;L;;;;;N;;;;; +188D7;TANGUT COMPONENT-216;Lo;0;L;;;;;N;;;;; +188D8;TANGUT COMPONENT-217;Lo;0;L;;;;;N;;;;; +188D9;TANGUT COMPONENT-218;Lo;0;L;;;;;N;;;;; +188DA;TANGUT COMPONENT-219;Lo;0;L;;;;;N;;;;; +188DB;TANGUT COMPONENT-220;Lo;0;L;;;;;N;;;;; +188DC;TANGUT COMPONENT-221;Lo;0;L;;;;;N;;;;; +188DD;TANGUT COMPONENT-222;Lo;0;L;;;;;N;;;;; +188DE;TANGUT COMPONENT-223;Lo;0;L;;;;;N;;;;; +188DF;TANGUT COMPONENT-224;Lo;0;L;;;;;N;;;;; +188E0;TANGUT COMPONENT-225;Lo;0;L;;;;;N;;;;; +188E1;TANGUT COMPONENT-226;Lo;0;L;;;;;N;;;;; +188E2;TANGUT COMPONENT-227;Lo;0;L;;;;;N;;;;; +188E3;TANGUT COMPONENT-228;Lo;0;L;;;;;N;;;;; +188E4;TANGUT COMPONENT-229;Lo;0;L;;;;;N;;;;; +188E5;TANGUT COMPONENT-230;Lo;0;L;;;;;N;;;;; +188E6;TANGUT COMPONENT-231;Lo;0;L;;;;;N;;;;; +188E7;TANGUT COMPONENT-232;Lo;0;L;;;;;N;;;;; +188E8;TANGUT COMPONENT-233;Lo;0;L;;;;;N;;;;; +188E9;TANGUT COMPONENT-234;Lo;0;L;;;;;N;;;;; +188EA;TANGUT COMPONENT-235;Lo;0;L;;;;;N;;;;; +188EB;TANGUT COMPONENT-236;Lo;0;L;;;;;N;;;;; +188EC;TANGUT COMPONENT-237;Lo;0;L;;;;;N;;;;; +188ED;TANGUT COMPONENT-238;Lo;0;L;;;;;N;;;;; +188EE;TANGUT COMPONENT-239;Lo;0;L;;;;;N;;;;; +188EF;TANGUT COMPONENT-240;Lo;0;L;;;;;N;;;;; +188F0;TANGUT COMPONENT-241;Lo;0;L;;;;;N;;;;; +188F1;TANGUT COMPONENT-242;Lo;0;L;;;;;N;;;;; +188F2;TANGUT COMPONENT-243;Lo;0;L;;;;;N;;;;; +188F3;TANGUT COMPONENT-244;Lo;0;L;;;;;N;;;;; +188F4;TANGUT COMPONENT-245;Lo;0;L;;;;;N;;;;; +188F5;TANGUT COMPONENT-246;Lo;0;L;;;;;N;;;;; +188F6;TANGUT COMPONENT-247;Lo;0;L;;;;;N;;;;; +188F7;TANGUT COMPONENT-248;Lo;0;L;;;;;N;;;;; +188F8;TANGUT COMPONENT-249;Lo;0;L;;;;;N;;;;; +188F9;TANGUT COMPONENT-250;Lo;0;L;;;;;N;;;;; +188FA;TANGUT COMPONENT-251;Lo;0;L;;;;;N;;;;; +188FB;TANGUT COMPONENT-252;Lo;0;L;;;;;N;;;;; +188FC;TANGUT COMPONENT-253;Lo;0;L;;;;;N;;;;; +188FD;TANGUT COMPONENT-254;Lo;0;L;;;;;N;;;;; +188FE;TANGUT COMPONENT-255;Lo;0;L;;;;;N;;;;; +188FF;TANGUT COMPONENT-256;Lo;0;L;;;;;N;;;;; +18900;TANGUT COMPONENT-257;Lo;0;L;;;;;N;;;;; +18901;TANGUT COMPONENT-258;Lo;0;L;;;;;N;;;;; +18902;TANGUT COMPONENT-259;Lo;0;L;;;;;N;;;;; +18903;TANGUT COMPONENT-260;Lo;0;L;;;;;N;;;;; +18904;TANGUT COMPONENT-261;Lo;0;L;;;;;N;;;;; +18905;TANGUT COMPONENT-262;Lo;0;L;;;;;N;;;;; +18906;TANGUT COMPONENT-263;Lo;0;L;;;;;N;;;;; +18907;TANGUT COMPONENT-264;Lo;0;L;;;;;N;;;;; +18908;TANGUT COMPONENT-265;Lo;0;L;;;;;N;;;;; +18909;TANGUT COMPONENT-266;Lo;0;L;;;;;N;;;;; +1890A;TANGUT COMPONENT-267;Lo;0;L;;;;;N;;;;; +1890B;TANGUT COMPONENT-268;Lo;0;L;;;;;N;;;;; +1890C;TANGUT COMPONENT-269;Lo;0;L;;;;;N;;;;; +1890D;TANGUT COMPONENT-270;Lo;0;L;;;;;N;;;;; +1890E;TANGUT COMPONENT-271;Lo;0;L;;;;;N;;;;; +1890F;TANGUT COMPONENT-272;Lo;0;L;;;;;N;;;;; +18910;TANGUT COMPONENT-273;Lo;0;L;;;;;N;;;;; +18911;TANGUT COMPONENT-274;Lo;0;L;;;;;N;;;;; +18912;TANGUT COMPONENT-275;Lo;0;L;;;;;N;;;;; +18913;TANGUT COMPONENT-276;Lo;0;L;;;;;N;;;;; +18914;TANGUT COMPONENT-277;Lo;0;L;;;;;N;;;;; +18915;TANGUT COMPONENT-278;Lo;0;L;;;;;N;;;;; +18916;TANGUT COMPONENT-279;Lo;0;L;;;;;N;;;;; +18917;TANGUT COMPONENT-280;Lo;0;L;;;;;N;;;;; +18918;TANGUT COMPONENT-281;Lo;0;L;;;;;N;;;;; +18919;TANGUT COMPONENT-282;Lo;0;L;;;;;N;;;;; +1891A;TANGUT COMPONENT-283;Lo;0;L;;;;;N;;;;; +1891B;TANGUT COMPONENT-284;Lo;0;L;;;;;N;;;;; +1891C;TANGUT COMPONENT-285;Lo;0;L;;;;;N;;;;; +1891D;TANGUT COMPONENT-286;Lo;0;L;;;;;N;;;;; +1891E;TANGUT COMPONENT-287;Lo;0;L;;;;;N;;;;; +1891F;TANGUT COMPONENT-288;Lo;0;L;;;;;N;;;;; +18920;TANGUT COMPONENT-289;Lo;0;L;;;;;N;;;;; +18921;TANGUT COMPONENT-290;Lo;0;L;;;;;N;;;;; +18922;TANGUT COMPONENT-291;Lo;0;L;;;;;N;;;;; +18923;TANGUT COMPONENT-292;Lo;0;L;;;;;N;;;;; +18924;TANGUT COMPONENT-293;Lo;0;L;;;;;N;;;;; +18925;TANGUT COMPONENT-294;Lo;0;L;;;;;N;;;;; +18926;TANGUT COMPONENT-295;Lo;0;L;;;;;N;;;;; +18927;TANGUT COMPONENT-296;Lo;0;L;;;;;N;;;;; +18928;TANGUT COMPONENT-297;Lo;0;L;;;;;N;;;;; +18929;TANGUT COMPONENT-298;Lo;0;L;;;;;N;;;;; +1892A;TANGUT COMPONENT-299;Lo;0;L;;;;;N;;;;; +1892B;TANGUT COMPONENT-300;Lo;0;L;;;;;N;;;;; +1892C;TANGUT COMPONENT-301;Lo;0;L;;;;;N;;;;; +1892D;TANGUT COMPONENT-302;Lo;0;L;;;;;N;;;;; +1892E;TANGUT COMPONENT-303;Lo;0;L;;;;;N;;;;; +1892F;TANGUT COMPONENT-304;Lo;0;L;;;;;N;;;;; +18930;TANGUT COMPONENT-305;Lo;0;L;;;;;N;;;;; +18931;TANGUT COMPONENT-306;Lo;0;L;;;;;N;;;;; +18932;TANGUT COMPONENT-307;Lo;0;L;;;;;N;;;;; +18933;TANGUT COMPONENT-308;Lo;0;L;;;;;N;;;;; +18934;TANGUT COMPONENT-309;Lo;0;L;;;;;N;;;;; +18935;TANGUT COMPONENT-310;Lo;0;L;;;;;N;;;;; +18936;TANGUT COMPONENT-311;Lo;0;L;;;;;N;;;;; +18937;TANGUT COMPONENT-312;Lo;0;L;;;;;N;;;;; +18938;TANGUT COMPONENT-313;Lo;0;L;;;;;N;;;;; +18939;TANGUT COMPONENT-314;Lo;0;L;;;;;N;;;;; +1893A;TANGUT COMPONENT-315;Lo;0;L;;;;;N;;;;; +1893B;TANGUT COMPONENT-316;Lo;0;L;;;;;N;;;;; +1893C;TANGUT COMPONENT-317;Lo;0;L;;;;;N;;;;; +1893D;TANGUT COMPONENT-318;Lo;0;L;;;;;N;;;;; +1893E;TANGUT COMPONENT-319;Lo;0;L;;;;;N;;;;; +1893F;TANGUT COMPONENT-320;Lo;0;L;;;;;N;;;;; +18940;TANGUT COMPONENT-321;Lo;0;L;;;;;N;;;;; +18941;TANGUT COMPONENT-322;Lo;0;L;;;;;N;;;;; +18942;TANGUT COMPONENT-323;Lo;0;L;;;;;N;;;;; +18943;TANGUT COMPONENT-324;Lo;0;L;;;;;N;;;;; +18944;TANGUT COMPONENT-325;Lo;0;L;;;;;N;;;;; +18945;TANGUT COMPONENT-326;Lo;0;L;;;;;N;;;;; +18946;TANGUT COMPONENT-327;Lo;0;L;;;;;N;;;;; +18947;TANGUT COMPONENT-328;Lo;0;L;;;;;N;;;;; +18948;TANGUT COMPONENT-329;Lo;0;L;;;;;N;;;;; +18949;TANGUT COMPONENT-330;Lo;0;L;;;;;N;;;;; +1894A;TANGUT COMPONENT-331;Lo;0;L;;;;;N;;;;; +1894B;TANGUT COMPONENT-332;Lo;0;L;;;;;N;;;;; +1894C;TANGUT COMPONENT-333;Lo;0;L;;;;;N;;;;; +1894D;TANGUT COMPONENT-334;Lo;0;L;;;;;N;;;;; +1894E;TANGUT COMPONENT-335;Lo;0;L;;;;;N;;;;; +1894F;TANGUT COMPONENT-336;Lo;0;L;;;;;N;;;;; +18950;TANGUT COMPONENT-337;Lo;0;L;;;;;N;;;;; +18951;TANGUT COMPONENT-338;Lo;0;L;;;;;N;;;;; +18952;TANGUT COMPONENT-339;Lo;0;L;;;;;N;;;;; +18953;TANGUT COMPONENT-340;Lo;0;L;;;;;N;;;;; +18954;TANGUT COMPONENT-341;Lo;0;L;;;;;N;;;;; +18955;TANGUT COMPONENT-342;Lo;0;L;;;;;N;;;;; +18956;TANGUT COMPONENT-343;Lo;0;L;;;;;N;;;;; +18957;TANGUT COMPONENT-344;Lo;0;L;;;;;N;;;;; +18958;TANGUT COMPONENT-345;Lo;0;L;;;;;N;;;;; +18959;TANGUT COMPONENT-346;Lo;0;L;;;;;N;;;;; +1895A;TANGUT COMPONENT-347;Lo;0;L;;;;;N;;;;; +1895B;TANGUT COMPONENT-348;Lo;0;L;;;;;N;;;;; +1895C;TANGUT COMPONENT-349;Lo;0;L;;;;;N;;;;; +1895D;TANGUT COMPONENT-350;Lo;0;L;;;;;N;;;;; +1895E;TANGUT COMPONENT-351;Lo;0;L;;;;;N;;;;; +1895F;TANGUT COMPONENT-352;Lo;0;L;;;;;N;;;;; +18960;TANGUT COMPONENT-353;Lo;0;L;;;;;N;;;;; +18961;TANGUT COMPONENT-354;Lo;0;L;;;;;N;;;;; +18962;TANGUT COMPONENT-355;Lo;0;L;;;;;N;;;;; +18963;TANGUT COMPONENT-356;Lo;0;L;;;;;N;;;;; +18964;TANGUT COMPONENT-357;Lo;0;L;;;;;N;;;;; +18965;TANGUT COMPONENT-358;Lo;0;L;;;;;N;;;;; +18966;TANGUT COMPONENT-359;Lo;0;L;;;;;N;;;;; +18967;TANGUT COMPONENT-360;Lo;0;L;;;;;N;;;;; +18968;TANGUT COMPONENT-361;Lo;0;L;;;;;N;;;;; +18969;TANGUT COMPONENT-362;Lo;0;L;;;;;N;;;;; +1896A;TANGUT COMPONENT-363;Lo;0;L;;;;;N;;;;; +1896B;TANGUT COMPONENT-364;Lo;0;L;;;;;N;;;;; +1896C;TANGUT COMPONENT-365;Lo;0;L;;;;;N;;;;; +1896D;TANGUT COMPONENT-366;Lo;0;L;;;;;N;;;;; +1896E;TANGUT COMPONENT-367;Lo;0;L;;;;;N;;;;; +1896F;TANGUT COMPONENT-368;Lo;0;L;;;;;N;;;;; +18970;TANGUT COMPONENT-369;Lo;0;L;;;;;N;;;;; +18971;TANGUT COMPONENT-370;Lo;0;L;;;;;N;;;;; +18972;TANGUT COMPONENT-371;Lo;0;L;;;;;N;;;;; +18973;TANGUT COMPONENT-372;Lo;0;L;;;;;N;;;;; +18974;TANGUT COMPONENT-373;Lo;0;L;;;;;N;;;;; +18975;TANGUT COMPONENT-374;Lo;0;L;;;;;N;;;;; +18976;TANGUT COMPONENT-375;Lo;0;L;;;;;N;;;;; +18977;TANGUT COMPONENT-376;Lo;0;L;;;;;N;;;;; +18978;TANGUT COMPONENT-377;Lo;0;L;;;;;N;;;;; +18979;TANGUT COMPONENT-378;Lo;0;L;;;;;N;;;;; +1897A;TANGUT COMPONENT-379;Lo;0;L;;;;;N;;;;; +1897B;TANGUT COMPONENT-380;Lo;0;L;;;;;N;;;;; +1897C;TANGUT COMPONENT-381;Lo;0;L;;;;;N;;;;; +1897D;TANGUT COMPONENT-382;Lo;0;L;;;;;N;;;;; +1897E;TANGUT COMPONENT-383;Lo;0;L;;;;;N;;;;; +1897F;TANGUT COMPONENT-384;Lo;0;L;;;;;N;;;;; +18980;TANGUT COMPONENT-385;Lo;0;L;;;;;N;;;;; +18981;TANGUT COMPONENT-386;Lo;0;L;;;;;N;;;;; +18982;TANGUT COMPONENT-387;Lo;0;L;;;;;N;;;;; +18983;TANGUT COMPONENT-388;Lo;0;L;;;;;N;;;;; +18984;TANGUT COMPONENT-389;Lo;0;L;;;;;N;;;;; +18985;TANGUT COMPONENT-390;Lo;0;L;;;;;N;;;;; +18986;TANGUT COMPONENT-391;Lo;0;L;;;;;N;;;;; +18987;TANGUT COMPONENT-392;Lo;0;L;;;;;N;;;;; +18988;TANGUT COMPONENT-393;Lo;0;L;;;;;N;;;;; +18989;TANGUT COMPONENT-394;Lo;0;L;;;;;N;;;;; +1898A;TANGUT COMPONENT-395;Lo;0;L;;;;;N;;;;; +1898B;TANGUT COMPONENT-396;Lo;0;L;;;;;N;;;;; +1898C;TANGUT COMPONENT-397;Lo;0;L;;;;;N;;;;; +1898D;TANGUT COMPONENT-398;Lo;0;L;;;;;N;;;;; +1898E;TANGUT COMPONENT-399;Lo;0;L;;;;;N;;;;; +1898F;TANGUT COMPONENT-400;Lo;0;L;;;;;N;;;;; +18990;TANGUT COMPONENT-401;Lo;0;L;;;;;N;;;;; +18991;TANGUT COMPONENT-402;Lo;0;L;;;;;N;;;;; +18992;TANGUT COMPONENT-403;Lo;0;L;;;;;N;;;;; +18993;TANGUT COMPONENT-404;Lo;0;L;;;;;N;;;;; +18994;TANGUT COMPONENT-405;Lo;0;L;;;;;N;;;;; +18995;TANGUT COMPONENT-406;Lo;0;L;;;;;N;;;;; +18996;TANGUT COMPONENT-407;Lo;0;L;;;;;N;;;;; +18997;TANGUT COMPONENT-408;Lo;0;L;;;;;N;;;;; +18998;TANGUT COMPONENT-409;Lo;0;L;;;;;N;;;;; +18999;TANGUT COMPONENT-410;Lo;0;L;;;;;N;;;;; +1899A;TANGUT COMPONENT-411;Lo;0;L;;;;;N;;;;; +1899B;TANGUT COMPONENT-412;Lo;0;L;;;;;N;;;;; +1899C;TANGUT COMPONENT-413;Lo;0;L;;;;;N;;;;; +1899D;TANGUT COMPONENT-414;Lo;0;L;;;;;N;;;;; +1899E;TANGUT COMPONENT-415;Lo;0;L;;;;;N;;;;; +1899F;TANGUT COMPONENT-416;Lo;0;L;;;;;N;;;;; +189A0;TANGUT COMPONENT-417;Lo;0;L;;;;;N;;;;; +189A1;TANGUT COMPONENT-418;Lo;0;L;;;;;N;;;;; +189A2;TANGUT COMPONENT-419;Lo;0;L;;;;;N;;;;; +189A3;TANGUT COMPONENT-420;Lo;0;L;;;;;N;;;;; +189A4;TANGUT COMPONENT-421;Lo;0;L;;;;;N;;;;; +189A5;TANGUT COMPONENT-422;Lo;0;L;;;;;N;;;;; +189A6;TANGUT COMPONENT-423;Lo;0;L;;;;;N;;;;; +189A7;TANGUT COMPONENT-424;Lo;0;L;;;;;N;;;;; +189A8;TANGUT COMPONENT-425;Lo;0;L;;;;;N;;;;; +189A9;TANGUT COMPONENT-426;Lo;0;L;;;;;N;;;;; +189AA;TANGUT COMPONENT-427;Lo;0;L;;;;;N;;;;; +189AB;TANGUT COMPONENT-428;Lo;0;L;;;;;N;;;;; +189AC;TANGUT COMPONENT-429;Lo;0;L;;;;;N;;;;; +189AD;TANGUT COMPONENT-430;Lo;0;L;;;;;N;;;;; +189AE;TANGUT COMPONENT-431;Lo;0;L;;;;;N;;;;; +189AF;TANGUT COMPONENT-432;Lo;0;L;;;;;N;;;;; +189B0;TANGUT COMPONENT-433;Lo;0;L;;;;;N;;;;; +189B1;TANGUT COMPONENT-434;Lo;0;L;;;;;N;;;;; +189B2;TANGUT COMPONENT-435;Lo;0;L;;;;;N;;;;; +189B3;TANGUT COMPONENT-436;Lo;0;L;;;;;N;;;;; +189B4;TANGUT COMPONENT-437;Lo;0;L;;;;;N;;;;; +189B5;TANGUT COMPONENT-438;Lo;0;L;;;;;N;;;;; +189B6;TANGUT COMPONENT-439;Lo;0;L;;;;;N;;;;; +189B7;TANGUT COMPONENT-440;Lo;0;L;;;;;N;;;;; +189B8;TANGUT COMPONENT-441;Lo;0;L;;;;;N;;;;; +189B9;TANGUT COMPONENT-442;Lo;0;L;;;;;N;;;;; +189BA;TANGUT COMPONENT-443;Lo;0;L;;;;;N;;;;; +189BB;TANGUT COMPONENT-444;Lo;0;L;;;;;N;;;;; +189BC;TANGUT COMPONENT-445;Lo;0;L;;;;;N;;;;; +189BD;TANGUT COMPONENT-446;Lo;0;L;;;;;N;;;;; +189BE;TANGUT COMPONENT-447;Lo;0;L;;;;;N;;;;; +189BF;TANGUT COMPONENT-448;Lo;0;L;;;;;N;;;;; +189C0;TANGUT COMPONENT-449;Lo;0;L;;;;;N;;;;; +189C1;TANGUT COMPONENT-450;Lo;0;L;;;;;N;;;;; +189C2;TANGUT COMPONENT-451;Lo;0;L;;;;;N;;;;; +189C3;TANGUT COMPONENT-452;Lo;0;L;;;;;N;;;;; +189C4;TANGUT COMPONENT-453;Lo;0;L;;;;;N;;;;; +189C5;TANGUT COMPONENT-454;Lo;0;L;;;;;N;;;;; +189C6;TANGUT COMPONENT-455;Lo;0;L;;;;;N;;;;; +189C7;TANGUT COMPONENT-456;Lo;0;L;;;;;N;;;;; +189C8;TANGUT COMPONENT-457;Lo;0;L;;;;;N;;;;; +189C9;TANGUT COMPONENT-458;Lo;0;L;;;;;N;;;;; +189CA;TANGUT COMPONENT-459;Lo;0;L;;;;;N;;;;; +189CB;TANGUT COMPONENT-460;Lo;0;L;;;;;N;;;;; +189CC;TANGUT COMPONENT-461;Lo;0;L;;;;;N;;;;; +189CD;TANGUT COMPONENT-462;Lo;0;L;;;;;N;;;;; +189CE;TANGUT COMPONENT-463;Lo;0;L;;;;;N;;;;; +189CF;TANGUT COMPONENT-464;Lo;0;L;;;;;N;;;;; +189D0;TANGUT COMPONENT-465;Lo;0;L;;;;;N;;;;; +189D1;TANGUT COMPONENT-466;Lo;0;L;;;;;N;;;;; +189D2;TANGUT COMPONENT-467;Lo;0;L;;;;;N;;;;; +189D3;TANGUT COMPONENT-468;Lo;0;L;;;;;N;;;;; +189D4;TANGUT COMPONENT-469;Lo;0;L;;;;;N;;;;; +189D5;TANGUT COMPONENT-470;Lo;0;L;;;;;N;;;;; +189D6;TANGUT COMPONENT-471;Lo;0;L;;;;;N;;;;; +189D7;TANGUT COMPONENT-472;Lo;0;L;;;;;N;;;;; +189D8;TANGUT COMPONENT-473;Lo;0;L;;;;;N;;;;; +189D9;TANGUT COMPONENT-474;Lo;0;L;;;;;N;;;;; +189DA;TANGUT COMPONENT-475;Lo;0;L;;;;;N;;;;; +189DB;TANGUT COMPONENT-476;Lo;0;L;;;;;N;;;;; +189DC;TANGUT COMPONENT-477;Lo;0;L;;;;;N;;;;; +189DD;TANGUT COMPONENT-478;Lo;0;L;;;;;N;;;;; +189DE;TANGUT COMPONENT-479;Lo;0;L;;;;;N;;;;; +189DF;TANGUT COMPONENT-480;Lo;0;L;;;;;N;;;;; +189E0;TANGUT COMPONENT-481;Lo;0;L;;;;;N;;;;; +189E1;TANGUT COMPONENT-482;Lo;0;L;;;;;N;;;;; +189E2;TANGUT COMPONENT-483;Lo;0;L;;;;;N;;;;; +189E3;TANGUT COMPONENT-484;Lo;0;L;;;;;N;;;;; +189E4;TANGUT COMPONENT-485;Lo;0;L;;;;;N;;;;; +189E5;TANGUT COMPONENT-486;Lo;0;L;;;;;N;;;;; +189E6;TANGUT COMPONENT-487;Lo;0;L;;;;;N;;;;; +189E7;TANGUT COMPONENT-488;Lo;0;L;;;;;N;;;;; +189E8;TANGUT COMPONENT-489;Lo;0;L;;;;;N;;;;; +189E9;TANGUT COMPONENT-490;Lo;0;L;;;;;N;;;;; +189EA;TANGUT COMPONENT-491;Lo;0;L;;;;;N;;;;; +189EB;TANGUT COMPONENT-492;Lo;0;L;;;;;N;;;;; +189EC;TANGUT COMPONENT-493;Lo;0;L;;;;;N;;;;; +189ED;TANGUT COMPONENT-494;Lo;0;L;;;;;N;;;;; +189EE;TANGUT COMPONENT-495;Lo;0;L;;;;;N;;;;; +189EF;TANGUT COMPONENT-496;Lo;0;L;;;;;N;;;;; +189F0;TANGUT COMPONENT-497;Lo;0;L;;;;;N;;;;; +189F1;TANGUT COMPONENT-498;Lo;0;L;;;;;N;;;;; +189F2;TANGUT COMPONENT-499;Lo;0;L;;;;;N;;;;; +189F3;TANGUT COMPONENT-500;Lo;0;L;;;;;N;;;;; +189F4;TANGUT COMPONENT-501;Lo;0;L;;;;;N;;;;; +189F5;TANGUT COMPONENT-502;Lo;0;L;;;;;N;;;;; +189F6;TANGUT COMPONENT-503;Lo;0;L;;;;;N;;;;; +189F7;TANGUT COMPONENT-504;Lo;0;L;;;;;N;;;;; +189F8;TANGUT COMPONENT-505;Lo;0;L;;;;;N;;;;; +189F9;TANGUT COMPONENT-506;Lo;0;L;;;;;N;;;;; +189FA;TANGUT COMPONENT-507;Lo;0;L;;;;;N;;;;; +189FB;TANGUT COMPONENT-508;Lo;0;L;;;;;N;;;;; +189FC;TANGUT COMPONENT-509;Lo;0;L;;;;;N;;;;; +189FD;TANGUT COMPONENT-510;Lo;0;L;;;;;N;;;;; +189FE;TANGUT COMPONENT-511;Lo;0;L;;;;;N;;;;; +189FF;TANGUT COMPONENT-512;Lo;0;L;;;;;N;;;;; +18A00;TANGUT COMPONENT-513;Lo;0;L;;;;;N;;;;; +18A01;TANGUT COMPONENT-514;Lo;0;L;;;;;N;;;;; +18A02;TANGUT COMPONENT-515;Lo;0;L;;;;;N;;;;; +18A03;TANGUT COMPONENT-516;Lo;0;L;;;;;N;;;;; +18A04;TANGUT COMPONENT-517;Lo;0;L;;;;;N;;;;; +18A05;TANGUT COMPONENT-518;Lo;0;L;;;;;N;;;;; +18A06;TANGUT COMPONENT-519;Lo;0;L;;;;;N;;;;; +18A07;TANGUT COMPONENT-520;Lo;0;L;;;;;N;;;;; +18A08;TANGUT COMPONENT-521;Lo;0;L;;;;;N;;;;; +18A09;TANGUT COMPONENT-522;Lo;0;L;;;;;N;;;;; +18A0A;TANGUT COMPONENT-523;Lo;0;L;;;;;N;;;;; +18A0B;TANGUT COMPONENT-524;Lo;0;L;;;;;N;;;;; +18A0C;TANGUT COMPONENT-525;Lo;0;L;;;;;N;;;;; +18A0D;TANGUT COMPONENT-526;Lo;0;L;;;;;N;;;;; +18A0E;TANGUT COMPONENT-527;Lo;0;L;;;;;N;;;;; +18A0F;TANGUT COMPONENT-528;Lo;0;L;;;;;N;;;;; +18A10;TANGUT COMPONENT-529;Lo;0;L;;;;;N;;;;; +18A11;TANGUT COMPONENT-530;Lo;0;L;;;;;N;;;;; +18A12;TANGUT COMPONENT-531;Lo;0;L;;;;;N;;;;; +18A13;TANGUT COMPONENT-532;Lo;0;L;;;;;N;;;;; +18A14;TANGUT COMPONENT-533;Lo;0;L;;;;;N;;;;; +18A15;TANGUT COMPONENT-534;Lo;0;L;;;;;N;;;;; +18A16;TANGUT COMPONENT-535;Lo;0;L;;;;;N;;;;; +18A17;TANGUT COMPONENT-536;Lo;0;L;;;;;N;;;;; +18A18;TANGUT COMPONENT-537;Lo;0;L;;;;;N;;;;; +18A19;TANGUT COMPONENT-538;Lo;0;L;;;;;N;;;;; +18A1A;TANGUT COMPONENT-539;Lo;0;L;;;;;N;;;;; +18A1B;TANGUT COMPONENT-540;Lo;0;L;;;;;N;;;;; +18A1C;TANGUT COMPONENT-541;Lo;0;L;;;;;N;;;;; +18A1D;TANGUT COMPONENT-542;Lo;0;L;;;;;N;;;;; +18A1E;TANGUT COMPONENT-543;Lo;0;L;;;;;N;;;;; +18A1F;TANGUT COMPONENT-544;Lo;0;L;;;;;N;;;;; +18A20;TANGUT COMPONENT-545;Lo;0;L;;;;;N;;;;; +18A21;TANGUT COMPONENT-546;Lo;0;L;;;;;N;;;;; +18A22;TANGUT COMPONENT-547;Lo;0;L;;;;;N;;;;; +18A23;TANGUT COMPONENT-548;Lo;0;L;;;;;N;;;;; +18A24;TANGUT COMPONENT-549;Lo;0;L;;;;;N;;;;; +18A25;TANGUT COMPONENT-550;Lo;0;L;;;;;N;;;;; +18A26;TANGUT COMPONENT-551;Lo;0;L;;;;;N;;;;; +18A27;TANGUT COMPONENT-552;Lo;0;L;;;;;N;;;;; +18A28;TANGUT COMPONENT-553;Lo;0;L;;;;;N;;;;; +18A29;TANGUT COMPONENT-554;Lo;0;L;;;;;N;;;;; +18A2A;TANGUT COMPONENT-555;Lo;0;L;;;;;N;;;;; +18A2B;TANGUT COMPONENT-556;Lo;0;L;;;;;N;;;;; +18A2C;TANGUT COMPONENT-557;Lo;0;L;;;;;N;;;;; +18A2D;TANGUT COMPONENT-558;Lo;0;L;;;;;N;;;;; +18A2E;TANGUT COMPONENT-559;Lo;0;L;;;;;N;;;;; +18A2F;TANGUT COMPONENT-560;Lo;0;L;;;;;N;;;;; +18A30;TANGUT COMPONENT-561;Lo;0;L;;;;;N;;;;; +18A31;TANGUT COMPONENT-562;Lo;0;L;;;;;N;;;;; +18A32;TANGUT COMPONENT-563;Lo;0;L;;;;;N;;;;; +18A33;TANGUT COMPONENT-564;Lo;0;L;;;;;N;;;;; +18A34;TANGUT COMPONENT-565;Lo;0;L;;;;;N;;;;; +18A35;TANGUT COMPONENT-566;Lo;0;L;;;;;N;;;;; +18A36;TANGUT COMPONENT-567;Lo;0;L;;;;;N;;;;; +18A37;TANGUT COMPONENT-568;Lo;0;L;;;;;N;;;;; +18A38;TANGUT COMPONENT-569;Lo;0;L;;;;;N;;;;; +18A39;TANGUT COMPONENT-570;Lo;0;L;;;;;N;;;;; +18A3A;TANGUT COMPONENT-571;Lo;0;L;;;;;N;;;;; +18A3B;TANGUT COMPONENT-572;Lo;0;L;;;;;N;;;;; +18A3C;TANGUT COMPONENT-573;Lo;0;L;;;;;N;;;;; +18A3D;TANGUT COMPONENT-574;Lo;0;L;;;;;N;;;;; +18A3E;TANGUT COMPONENT-575;Lo;0;L;;;;;N;;;;; +18A3F;TANGUT COMPONENT-576;Lo;0;L;;;;;N;;;;; +18A40;TANGUT COMPONENT-577;Lo;0;L;;;;;N;;;;; +18A41;TANGUT COMPONENT-578;Lo;0;L;;;;;N;;;;; +18A42;TANGUT COMPONENT-579;Lo;0;L;;;;;N;;;;; +18A43;TANGUT COMPONENT-580;Lo;0;L;;;;;N;;;;; +18A44;TANGUT COMPONENT-581;Lo;0;L;;;;;N;;;;; +18A45;TANGUT COMPONENT-582;Lo;0;L;;;;;N;;;;; +18A46;TANGUT COMPONENT-583;Lo;0;L;;;;;N;;;;; +18A47;TANGUT COMPONENT-584;Lo;0;L;;;;;N;;;;; +18A48;TANGUT COMPONENT-585;Lo;0;L;;;;;N;;;;; +18A49;TANGUT COMPONENT-586;Lo;0;L;;;;;N;;;;; +18A4A;TANGUT COMPONENT-587;Lo;0;L;;;;;N;;;;; +18A4B;TANGUT COMPONENT-588;Lo;0;L;;;;;N;;;;; +18A4C;TANGUT COMPONENT-589;Lo;0;L;;;;;N;;;;; +18A4D;TANGUT COMPONENT-590;Lo;0;L;;;;;N;;;;; +18A4E;TANGUT COMPONENT-591;Lo;0;L;;;;;N;;;;; +18A4F;TANGUT COMPONENT-592;Lo;0;L;;;;;N;;;;; +18A50;TANGUT COMPONENT-593;Lo;0;L;;;;;N;;;;; +18A51;TANGUT COMPONENT-594;Lo;0;L;;;;;N;;;;; +18A52;TANGUT COMPONENT-595;Lo;0;L;;;;;N;;;;; +18A53;TANGUT COMPONENT-596;Lo;0;L;;;;;N;;;;; +18A54;TANGUT COMPONENT-597;Lo;0;L;;;;;N;;;;; +18A55;TANGUT COMPONENT-598;Lo;0;L;;;;;N;;;;; +18A56;TANGUT COMPONENT-599;Lo;0;L;;;;;N;;;;; +18A57;TANGUT COMPONENT-600;Lo;0;L;;;;;N;;;;; +18A58;TANGUT COMPONENT-601;Lo;0;L;;;;;N;;;;; +18A59;TANGUT COMPONENT-602;Lo;0;L;;;;;N;;;;; +18A5A;TANGUT COMPONENT-603;Lo;0;L;;;;;N;;;;; +18A5B;TANGUT COMPONENT-604;Lo;0;L;;;;;N;;;;; +18A5C;TANGUT COMPONENT-605;Lo;0;L;;;;;N;;;;; +18A5D;TANGUT COMPONENT-606;Lo;0;L;;;;;N;;;;; +18A5E;TANGUT COMPONENT-607;Lo;0;L;;;;;N;;;;; +18A5F;TANGUT COMPONENT-608;Lo;0;L;;;;;N;;;;; +18A60;TANGUT COMPONENT-609;Lo;0;L;;;;;N;;;;; +18A61;TANGUT COMPONENT-610;Lo;0;L;;;;;N;;;;; +18A62;TANGUT COMPONENT-611;Lo;0;L;;;;;N;;;;; +18A63;TANGUT COMPONENT-612;Lo;0;L;;;;;N;;;;; +18A64;TANGUT COMPONENT-613;Lo;0;L;;;;;N;;;;; +18A65;TANGUT COMPONENT-614;Lo;0;L;;;;;N;;;;; +18A66;TANGUT COMPONENT-615;Lo;0;L;;;;;N;;;;; +18A67;TANGUT COMPONENT-616;Lo;0;L;;;;;N;;;;; +18A68;TANGUT COMPONENT-617;Lo;0;L;;;;;N;;;;; +18A69;TANGUT COMPONENT-618;Lo;0;L;;;;;N;;;;; +18A6A;TANGUT COMPONENT-619;Lo;0;L;;;;;N;;;;; +18A6B;TANGUT COMPONENT-620;Lo;0;L;;;;;N;;;;; +18A6C;TANGUT COMPONENT-621;Lo;0;L;;;;;N;;;;; +18A6D;TANGUT COMPONENT-622;Lo;0;L;;;;;N;;;;; +18A6E;TANGUT COMPONENT-623;Lo;0;L;;;;;N;;;;; +18A6F;TANGUT COMPONENT-624;Lo;0;L;;;;;N;;;;; +18A70;TANGUT COMPONENT-625;Lo;0;L;;;;;N;;;;; +18A71;TANGUT COMPONENT-626;Lo;0;L;;;;;N;;;;; +18A72;TANGUT COMPONENT-627;Lo;0;L;;;;;N;;;;; +18A73;TANGUT COMPONENT-628;Lo;0;L;;;;;N;;;;; +18A74;TANGUT COMPONENT-629;Lo;0;L;;;;;N;;;;; +18A75;TANGUT COMPONENT-630;Lo;0;L;;;;;N;;;;; +18A76;TANGUT COMPONENT-631;Lo;0;L;;;;;N;;;;; +18A77;TANGUT COMPONENT-632;Lo;0;L;;;;;N;;;;; +18A78;TANGUT COMPONENT-633;Lo;0;L;;;;;N;;;;; +18A79;TANGUT COMPONENT-634;Lo;0;L;;;;;N;;;;; +18A7A;TANGUT COMPONENT-635;Lo;0;L;;;;;N;;;;; +18A7B;TANGUT COMPONENT-636;Lo;0;L;;;;;N;;;;; +18A7C;TANGUT COMPONENT-637;Lo;0;L;;;;;N;;;;; +18A7D;TANGUT COMPONENT-638;Lo;0;L;;;;;N;;;;; +18A7E;TANGUT COMPONENT-639;Lo;0;L;;;;;N;;;;; +18A7F;TANGUT COMPONENT-640;Lo;0;L;;;;;N;;;;; +18A80;TANGUT COMPONENT-641;Lo;0;L;;;;;N;;;;; +18A81;TANGUT COMPONENT-642;Lo;0;L;;;;;N;;;;; +18A82;TANGUT COMPONENT-643;Lo;0;L;;;;;N;;;;; +18A83;TANGUT COMPONENT-644;Lo;0;L;;;;;N;;;;; +18A84;TANGUT COMPONENT-645;Lo;0;L;;;;;N;;;;; +18A85;TANGUT COMPONENT-646;Lo;0;L;;;;;N;;;;; +18A86;TANGUT COMPONENT-647;Lo;0;L;;;;;N;;;;; +18A87;TANGUT COMPONENT-648;Lo;0;L;;;;;N;;;;; +18A88;TANGUT COMPONENT-649;Lo;0;L;;;;;N;;;;; +18A89;TANGUT COMPONENT-650;Lo;0;L;;;;;N;;;;; +18A8A;TANGUT COMPONENT-651;Lo;0;L;;;;;N;;;;; +18A8B;TANGUT COMPONENT-652;Lo;0;L;;;;;N;;;;; +18A8C;TANGUT COMPONENT-653;Lo;0;L;;;;;N;;;;; +18A8D;TANGUT COMPONENT-654;Lo;0;L;;;;;N;;;;; +18A8E;TANGUT COMPONENT-655;Lo;0;L;;;;;N;;;;; +18A8F;TANGUT COMPONENT-656;Lo;0;L;;;;;N;;;;; +18A90;TANGUT COMPONENT-657;Lo;0;L;;;;;N;;;;; +18A91;TANGUT COMPONENT-658;Lo;0;L;;;;;N;;;;; +18A92;TANGUT COMPONENT-659;Lo;0;L;;;;;N;;;;; +18A93;TANGUT COMPONENT-660;Lo;0;L;;;;;N;;;;; +18A94;TANGUT COMPONENT-661;Lo;0;L;;;;;N;;;;; +18A95;TANGUT COMPONENT-662;Lo;0;L;;;;;N;;;;; +18A96;TANGUT COMPONENT-663;Lo;0;L;;;;;N;;;;; +18A97;TANGUT COMPONENT-664;Lo;0;L;;;;;N;;;;; +18A98;TANGUT COMPONENT-665;Lo;0;L;;;;;N;;;;; +18A99;TANGUT COMPONENT-666;Lo;0;L;;;;;N;;;;; +18A9A;TANGUT COMPONENT-667;Lo;0;L;;;;;N;;;;; +18A9B;TANGUT COMPONENT-668;Lo;0;L;;;;;N;;;;; +18A9C;TANGUT COMPONENT-669;Lo;0;L;;;;;N;;;;; +18A9D;TANGUT COMPONENT-670;Lo;0;L;;;;;N;;;;; +18A9E;TANGUT COMPONENT-671;Lo;0;L;;;;;N;;;;; +18A9F;TANGUT COMPONENT-672;Lo;0;L;;;;;N;;;;; +18AA0;TANGUT COMPONENT-673;Lo;0;L;;;;;N;;;;; +18AA1;TANGUT COMPONENT-674;Lo;0;L;;;;;N;;;;; +18AA2;TANGUT COMPONENT-675;Lo;0;L;;;;;N;;;;; +18AA3;TANGUT COMPONENT-676;Lo;0;L;;;;;N;;;;; +18AA4;TANGUT COMPONENT-677;Lo;0;L;;;;;N;;;;; +18AA5;TANGUT COMPONENT-678;Lo;0;L;;;;;N;;;;; +18AA6;TANGUT COMPONENT-679;Lo;0;L;;;;;N;;;;; +18AA7;TANGUT COMPONENT-680;Lo;0;L;;;;;N;;;;; +18AA8;TANGUT COMPONENT-681;Lo;0;L;;;;;N;;;;; +18AA9;TANGUT COMPONENT-682;Lo;0;L;;;;;N;;;;; +18AAA;TANGUT COMPONENT-683;Lo;0;L;;;;;N;;;;; +18AAB;TANGUT COMPONENT-684;Lo;0;L;;;;;N;;;;; +18AAC;TANGUT COMPONENT-685;Lo;0;L;;;;;N;;;;; +18AAD;TANGUT COMPONENT-686;Lo;0;L;;;;;N;;;;; +18AAE;TANGUT COMPONENT-687;Lo;0;L;;;;;N;;;;; +18AAF;TANGUT COMPONENT-688;Lo;0;L;;;;;N;;;;; +18AB0;TANGUT COMPONENT-689;Lo;0;L;;;;;N;;;;; +18AB1;TANGUT COMPONENT-690;Lo;0;L;;;;;N;;;;; +18AB2;TANGUT COMPONENT-691;Lo;0;L;;;;;N;;;;; +18AB3;TANGUT COMPONENT-692;Lo;0;L;;;;;N;;;;; +18AB4;TANGUT COMPONENT-693;Lo;0;L;;;;;N;;;;; +18AB5;TANGUT COMPONENT-694;Lo;0;L;;;;;N;;;;; +18AB6;TANGUT COMPONENT-695;Lo;0;L;;;;;N;;;;; +18AB7;TANGUT COMPONENT-696;Lo;0;L;;;;;N;;;;; +18AB8;TANGUT COMPONENT-697;Lo;0;L;;;;;N;;;;; +18AB9;TANGUT COMPONENT-698;Lo;0;L;;;;;N;;;;; +18ABA;TANGUT COMPONENT-699;Lo;0;L;;;;;N;;;;; +18ABB;TANGUT COMPONENT-700;Lo;0;L;;;;;N;;;;; +18ABC;TANGUT COMPONENT-701;Lo;0;L;;;;;N;;;;; +18ABD;TANGUT COMPONENT-702;Lo;0;L;;;;;N;;;;; +18ABE;TANGUT COMPONENT-703;Lo;0;L;;;;;N;;;;; +18ABF;TANGUT COMPONENT-704;Lo;0;L;;;;;N;;;;; +18AC0;TANGUT COMPONENT-705;Lo;0;L;;;;;N;;;;; +18AC1;TANGUT COMPONENT-706;Lo;0;L;;;;;N;;;;; +18AC2;TANGUT COMPONENT-707;Lo;0;L;;;;;N;;;;; +18AC3;TANGUT COMPONENT-708;Lo;0;L;;;;;N;;;;; +18AC4;TANGUT COMPONENT-709;Lo;0;L;;;;;N;;;;; +18AC5;TANGUT COMPONENT-710;Lo;0;L;;;;;N;;;;; +18AC6;TANGUT COMPONENT-711;Lo;0;L;;;;;N;;;;; +18AC7;TANGUT COMPONENT-712;Lo;0;L;;;;;N;;;;; +18AC8;TANGUT COMPONENT-713;Lo;0;L;;;;;N;;;;; +18AC9;TANGUT COMPONENT-714;Lo;0;L;;;;;N;;;;; +18ACA;TANGUT COMPONENT-715;Lo;0;L;;;;;N;;;;; +18ACB;TANGUT COMPONENT-716;Lo;0;L;;;;;N;;;;; +18ACC;TANGUT COMPONENT-717;Lo;0;L;;;;;N;;;;; +18ACD;TANGUT COMPONENT-718;Lo;0;L;;;;;N;;;;; +18ACE;TANGUT COMPONENT-719;Lo;0;L;;;;;N;;;;; +18ACF;TANGUT COMPONENT-720;Lo;0;L;;;;;N;;;;; +18AD0;TANGUT COMPONENT-721;Lo;0;L;;;;;N;;;;; +18AD1;TANGUT COMPONENT-722;Lo;0;L;;;;;N;;;;; +18AD2;TANGUT COMPONENT-723;Lo;0;L;;;;;N;;;;; +18AD3;TANGUT COMPONENT-724;Lo;0;L;;;;;N;;;;; +18AD4;TANGUT COMPONENT-725;Lo;0;L;;;;;N;;;;; +18AD5;TANGUT COMPONENT-726;Lo;0;L;;;;;N;;;;; +18AD6;TANGUT COMPONENT-727;Lo;0;L;;;;;N;;;;; +18AD7;TANGUT COMPONENT-728;Lo;0;L;;;;;N;;;;; +18AD8;TANGUT COMPONENT-729;Lo;0;L;;;;;N;;;;; +18AD9;TANGUT COMPONENT-730;Lo;0;L;;;;;N;;;;; +18ADA;TANGUT COMPONENT-731;Lo;0;L;;;;;N;;;;; +18ADB;TANGUT COMPONENT-732;Lo;0;L;;;;;N;;;;; +18ADC;TANGUT COMPONENT-733;Lo;0;L;;;;;N;;;;; +18ADD;TANGUT COMPONENT-734;Lo;0;L;;;;;N;;;;; +18ADE;TANGUT COMPONENT-735;Lo;0;L;;;;;N;;;;; +18ADF;TANGUT COMPONENT-736;Lo;0;L;;;;;N;;;;; +18AE0;TANGUT COMPONENT-737;Lo;0;L;;;;;N;;;;; +18AE1;TANGUT COMPONENT-738;Lo;0;L;;;;;N;;;;; +18AE2;TANGUT COMPONENT-739;Lo;0;L;;;;;N;;;;; +18AE3;TANGUT COMPONENT-740;Lo;0;L;;;;;N;;;;; +18AE4;TANGUT COMPONENT-741;Lo;0;L;;;;;N;;;;; +18AE5;TANGUT COMPONENT-742;Lo;0;L;;;;;N;;;;; +18AE6;TANGUT COMPONENT-743;Lo;0;L;;;;;N;;;;; +18AE7;TANGUT COMPONENT-744;Lo;0;L;;;;;N;;;;; +18AE8;TANGUT COMPONENT-745;Lo;0;L;;;;;N;;;;; +18AE9;TANGUT COMPONENT-746;Lo;0;L;;;;;N;;;;; +18AEA;TANGUT COMPONENT-747;Lo;0;L;;;;;N;;;;; +18AEB;TANGUT COMPONENT-748;Lo;0;L;;;;;N;;;;; +18AEC;TANGUT COMPONENT-749;Lo;0;L;;;;;N;;;;; +18AED;TANGUT COMPONENT-750;Lo;0;L;;;;;N;;;;; +18AEE;TANGUT COMPONENT-751;Lo;0;L;;;;;N;;;;; +18AEF;TANGUT COMPONENT-752;Lo;0;L;;;;;N;;;;; +18AF0;TANGUT COMPONENT-753;Lo;0;L;;;;;N;;;;; +18AF1;TANGUT COMPONENT-754;Lo;0;L;;;;;N;;;;; +18AF2;TANGUT COMPONENT-755;Lo;0;L;;;;;N;;;;; +1B000;KATAKANA LETTER ARCHAIC E;Lo;0;L;;;;;N;;;;; +1B001;HIRAGANA LETTER ARCHAIC YE;Lo;0;L;;;;;N;;;;; +1B002;HENTAIGANA LETTER A-1;Lo;0;L;;;;;N;;;;; +1B003;HENTAIGANA LETTER A-2;Lo;0;L;;;;;N;;;;; +1B004;HENTAIGANA LETTER A-3;Lo;0;L;;;;;N;;;;; +1B005;HENTAIGANA LETTER A-WO;Lo;0;L;;;;;N;;;;; +1B006;HENTAIGANA LETTER I-1;Lo;0;L;;;;;N;;;;; +1B007;HENTAIGANA LETTER I-2;Lo;0;L;;;;;N;;;;; +1B008;HENTAIGANA LETTER I-3;Lo;0;L;;;;;N;;;;; +1B009;HENTAIGANA LETTER I-4;Lo;0;L;;;;;N;;;;; +1B00A;HENTAIGANA LETTER U-1;Lo;0;L;;;;;N;;;;; +1B00B;HENTAIGANA LETTER U-2;Lo;0;L;;;;;N;;;;; +1B00C;HENTAIGANA LETTER U-3;Lo;0;L;;;;;N;;;;; +1B00D;HENTAIGANA LETTER U-4;Lo;0;L;;;;;N;;;;; +1B00E;HENTAIGANA LETTER U-5;Lo;0;L;;;;;N;;;;; +1B00F;HENTAIGANA LETTER E-2;Lo;0;L;;;;;N;;;;; +1B010;HENTAIGANA LETTER E-3;Lo;0;L;;;;;N;;;;; +1B011;HENTAIGANA LETTER E-4;Lo;0;L;;;;;N;;;;; +1B012;HENTAIGANA LETTER E-5;Lo;0;L;;;;;N;;;;; +1B013;HENTAIGANA LETTER E-6;Lo;0;L;;;;;N;;;;; +1B014;HENTAIGANA LETTER O-1;Lo;0;L;;;;;N;;;;; +1B015;HENTAIGANA LETTER O-2;Lo;0;L;;;;;N;;;;; +1B016;HENTAIGANA LETTER O-3;Lo;0;L;;;;;N;;;;; +1B017;HENTAIGANA LETTER KA-1;Lo;0;L;;;;;N;;;;; +1B018;HENTAIGANA LETTER KA-2;Lo;0;L;;;;;N;;;;; +1B019;HENTAIGANA LETTER KA-3;Lo;0;L;;;;;N;;;;; +1B01A;HENTAIGANA LETTER KA-4;Lo;0;L;;;;;N;;;;; +1B01B;HENTAIGANA LETTER KA-5;Lo;0;L;;;;;N;;;;; +1B01C;HENTAIGANA LETTER KA-6;Lo;0;L;;;;;N;;;;; +1B01D;HENTAIGANA LETTER KA-7;Lo;0;L;;;;;N;;;;; +1B01E;HENTAIGANA LETTER KA-8;Lo;0;L;;;;;N;;;;; +1B01F;HENTAIGANA LETTER KA-9;Lo;0;L;;;;;N;;;;; +1B020;HENTAIGANA LETTER KA-10;Lo;0;L;;;;;N;;;;; +1B021;HENTAIGANA LETTER KA-11;Lo;0;L;;;;;N;;;;; +1B022;HENTAIGANA LETTER KA-KE;Lo;0;L;;;;;N;;;;; +1B023;HENTAIGANA LETTER KI-1;Lo;0;L;;;;;N;;;;; +1B024;HENTAIGANA LETTER KI-2;Lo;0;L;;;;;N;;;;; +1B025;HENTAIGANA LETTER KI-3;Lo;0;L;;;;;N;;;;; +1B026;HENTAIGANA LETTER KI-4;Lo;0;L;;;;;N;;;;; +1B027;HENTAIGANA LETTER KI-5;Lo;0;L;;;;;N;;;;; +1B028;HENTAIGANA LETTER KI-6;Lo;0;L;;;;;N;;;;; +1B029;HENTAIGANA LETTER KI-7;Lo;0;L;;;;;N;;;;; +1B02A;HENTAIGANA LETTER KI-8;Lo;0;L;;;;;N;;;;; +1B02B;HENTAIGANA LETTER KU-1;Lo;0;L;;;;;N;;;;; +1B02C;HENTAIGANA LETTER KU-2;Lo;0;L;;;;;N;;;;; +1B02D;HENTAIGANA LETTER KU-3;Lo;0;L;;;;;N;;;;; +1B02E;HENTAIGANA LETTER KU-4;Lo;0;L;;;;;N;;;;; +1B02F;HENTAIGANA LETTER KU-5;Lo;0;L;;;;;N;;;;; +1B030;HENTAIGANA LETTER KU-6;Lo;0;L;;;;;N;;;;; +1B031;HENTAIGANA LETTER KU-7;Lo;0;L;;;;;N;;;;; +1B032;HENTAIGANA LETTER KE-1;Lo;0;L;;;;;N;;;;; +1B033;HENTAIGANA LETTER KE-2;Lo;0;L;;;;;N;;;;; +1B034;HENTAIGANA LETTER KE-3;Lo;0;L;;;;;N;;;;; +1B035;HENTAIGANA LETTER KE-4;Lo;0;L;;;;;N;;;;; +1B036;HENTAIGANA LETTER KE-5;Lo;0;L;;;;;N;;;;; +1B037;HENTAIGANA LETTER KE-6;Lo;0;L;;;;;N;;;;; +1B038;HENTAIGANA LETTER KO-1;Lo;0;L;;;;;N;;;;; +1B039;HENTAIGANA LETTER KO-2;Lo;0;L;;;;;N;;;;; +1B03A;HENTAIGANA LETTER KO-3;Lo;0;L;;;;;N;;;;; +1B03B;HENTAIGANA LETTER KO-KI;Lo;0;L;;;;;N;;;;; +1B03C;HENTAIGANA LETTER SA-1;Lo;0;L;;;;;N;;;;; +1B03D;HENTAIGANA LETTER SA-2;Lo;0;L;;;;;N;;;;; +1B03E;HENTAIGANA LETTER SA-3;Lo;0;L;;;;;N;;;;; +1B03F;HENTAIGANA LETTER SA-4;Lo;0;L;;;;;N;;;;; +1B040;HENTAIGANA LETTER SA-5;Lo;0;L;;;;;N;;;;; +1B041;HENTAIGANA LETTER SA-6;Lo;0;L;;;;;N;;;;; +1B042;HENTAIGANA LETTER SA-7;Lo;0;L;;;;;N;;;;; +1B043;HENTAIGANA LETTER SA-8;Lo;0;L;;;;;N;;;;; +1B044;HENTAIGANA LETTER SI-1;Lo;0;L;;;;;N;;;;; +1B045;HENTAIGANA LETTER SI-2;Lo;0;L;;;;;N;;;;; +1B046;HENTAIGANA LETTER SI-3;Lo;0;L;;;;;N;;;;; +1B047;HENTAIGANA LETTER SI-4;Lo;0;L;;;;;N;;;;; +1B048;HENTAIGANA LETTER SI-5;Lo;0;L;;;;;N;;;;; +1B049;HENTAIGANA LETTER SI-6;Lo;0;L;;;;;N;;;;; +1B04A;HENTAIGANA LETTER SU-1;Lo;0;L;;;;;N;;;;; +1B04B;HENTAIGANA LETTER SU-2;Lo;0;L;;;;;N;;;;; +1B04C;HENTAIGANA LETTER SU-3;Lo;0;L;;;;;N;;;;; +1B04D;HENTAIGANA LETTER SU-4;Lo;0;L;;;;;N;;;;; +1B04E;HENTAIGANA LETTER SU-5;Lo;0;L;;;;;N;;;;; +1B04F;HENTAIGANA LETTER SU-6;Lo;0;L;;;;;N;;;;; +1B050;HENTAIGANA LETTER SU-7;Lo;0;L;;;;;N;;;;; +1B051;HENTAIGANA LETTER SU-8;Lo;0;L;;;;;N;;;;; +1B052;HENTAIGANA LETTER SE-1;Lo;0;L;;;;;N;;;;; +1B053;HENTAIGANA LETTER SE-2;Lo;0;L;;;;;N;;;;; +1B054;HENTAIGANA LETTER SE-3;Lo;0;L;;;;;N;;;;; +1B055;HENTAIGANA LETTER SE-4;Lo;0;L;;;;;N;;;;; +1B056;HENTAIGANA LETTER SE-5;Lo;0;L;;;;;N;;;;; +1B057;HENTAIGANA LETTER SO-1;Lo;0;L;;;;;N;;;;; +1B058;HENTAIGANA LETTER SO-2;Lo;0;L;;;;;N;;;;; +1B059;HENTAIGANA LETTER SO-3;Lo;0;L;;;;;N;;;;; +1B05A;HENTAIGANA LETTER SO-4;Lo;0;L;;;;;N;;;;; +1B05B;HENTAIGANA LETTER SO-5;Lo;0;L;;;;;N;;;;; +1B05C;HENTAIGANA LETTER SO-6;Lo;0;L;;;;;N;;;;; +1B05D;HENTAIGANA LETTER SO-7;Lo;0;L;;;;;N;;;;; +1B05E;HENTAIGANA LETTER TA-1;Lo;0;L;;;;;N;;;;; +1B05F;HENTAIGANA LETTER TA-2;Lo;0;L;;;;;N;;;;; +1B060;HENTAIGANA LETTER TA-3;Lo;0;L;;;;;N;;;;; +1B061;HENTAIGANA LETTER TA-4;Lo;0;L;;;;;N;;;;; +1B062;HENTAIGANA LETTER TI-1;Lo;0;L;;;;;N;;;;; +1B063;HENTAIGANA LETTER TI-2;Lo;0;L;;;;;N;;;;; +1B064;HENTAIGANA LETTER TI-3;Lo;0;L;;;;;N;;;;; +1B065;HENTAIGANA LETTER TI-4;Lo;0;L;;;;;N;;;;; +1B066;HENTAIGANA LETTER TI-5;Lo;0;L;;;;;N;;;;; +1B067;HENTAIGANA LETTER TI-6;Lo;0;L;;;;;N;;;;; +1B068;HENTAIGANA LETTER TI-7;Lo;0;L;;;;;N;;;;; +1B069;HENTAIGANA LETTER TU-1;Lo;0;L;;;;;N;;;;; +1B06A;HENTAIGANA LETTER TU-2;Lo;0;L;;;;;N;;;;; +1B06B;HENTAIGANA LETTER TU-3;Lo;0;L;;;;;N;;;;; +1B06C;HENTAIGANA LETTER TU-4;Lo;0;L;;;;;N;;;;; +1B06D;HENTAIGANA LETTER TU-TO;Lo;0;L;;;;;N;;;;; +1B06E;HENTAIGANA LETTER TE-1;Lo;0;L;;;;;N;;;;; +1B06F;HENTAIGANA LETTER TE-2;Lo;0;L;;;;;N;;;;; +1B070;HENTAIGANA LETTER TE-3;Lo;0;L;;;;;N;;;;; +1B071;HENTAIGANA LETTER TE-4;Lo;0;L;;;;;N;;;;; +1B072;HENTAIGANA LETTER TE-5;Lo;0;L;;;;;N;;;;; +1B073;HENTAIGANA LETTER TE-6;Lo;0;L;;;;;N;;;;; +1B074;HENTAIGANA LETTER TE-7;Lo;0;L;;;;;N;;;;; +1B075;HENTAIGANA LETTER TE-8;Lo;0;L;;;;;N;;;;; +1B076;HENTAIGANA LETTER TE-9;Lo;0;L;;;;;N;;;;; +1B077;HENTAIGANA LETTER TO-1;Lo;0;L;;;;;N;;;;; +1B078;HENTAIGANA LETTER TO-2;Lo;0;L;;;;;N;;;;; +1B079;HENTAIGANA LETTER TO-3;Lo;0;L;;;;;N;;;;; +1B07A;HENTAIGANA LETTER TO-4;Lo;0;L;;;;;N;;;;; +1B07B;HENTAIGANA LETTER TO-5;Lo;0;L;;;;;N;;;;; +1B07C;HENTAIGANA LETTER TO-6;Lo;0;L;;;;;N;;;;; +1B07D;HENTAIGANA LETTER TO-RA;Lo;0;L;;;;;N;;;;; +1B07E;HENTAIGANA LETTER NA-1;Lo;0;L;;;;;N;;;;; +1B07F;HENTAIGANA LETTER NA-2;Lo;0;L;;;;;N;;;;; +1B080;HENTAIGANA LETTER NA-3;Lo;0;L;;;;;N;;;;; +1B081;HENTAIGANA LETTER NA-4;Lo;0;L;;;;;N;;;;; +1B082;HENTAIGANA LETTER NA-5;Lo;0;L;;;;;N;;;;; +1B083;HENTAIGANA LETTER NA-6;Lo;0;L;;;;;N;;;;; +1B084;HENTAIGANA LETTER NA-7;Lo;0;L;;;;;N;;;;; +1B085;HENTAIGANA LETTER NA-8;Lo;0;L;;;;;N;;;;; +1B086;HENTAIGANA LETTER NA-9;Lo;0;L;;;;;N;;;;; +1B087;HENTAIGANA LETTER NI-1;Lo;0;L;;;;;N;;;;; +1B088;HENTAIGANA LETTER NI-2;Lo;0;L;;;;;N;;;;; +1B089;HENTAIGANA LETTER NI-3;Lo;0;L;;;;;N;;;;; +1B08A;HENTAIGANA LETTER NI-4;Lo;0;L;;;;;N;;;;; +1B08B;HENTAIGANA LETTER NI-5;Lo;0;L;;;;;N;;;;; +1B08C;HENTAIGANA LETTER NI-6;Lo;0;L;;;;;N;;;;; +1B08D;HENTAIGANA LETTER NI-7;Lo;0;L;;;;;N;;;;; +1B08E;HENTAIGANA LETTER NI-TE;Lo;0;L;;;;;N;;;;; +1B08F;HENTAIGANA LETTER NU-1;Lo;0;L;;;;;N;;;;; +1B090;HENTAIGANA LETTER NU-2;Lo;0;L;;;;;N;;;;; +1B091;HENTAIGANA LETTER NU-3;Lo;0;L;;;;;N;;;;; +1B092;HENTAIGANA LETTER NE-1;Lo;0;L;;;;;N;;;;; +1B093;HENTAIGANA LETTER NE-2;Lo;0;L;;;;;N;;;;; +1B094;HENTAIGANA LETTER NE-3;Lo;0;L;;;;;N;;;;; +1B095;HENTAIGANA LETTER NE-4;Lo;0;L;;;;;N;;;;; +1B096;HENTAIGANA LETTER NE-5;Lo;0;L;;;;;N;;;;; +1B097;HENTAIGANA LETTER NE-6;Lo;0;L;;;;;N;;;;; +1B098;HENTAIGANA LETTER NE-KO;Lo;0;L;;;;;N;;;;; +1B099;HENTAIGANA LETTER NO-1;Lo;0;L;;;;;N;;;;; +1B09A;HENTAIGANA LETTER NO-2;Lo;0;L;;;;;N;;;;; +1B09B;HENTAIGANA LETTER NO-3;Lo;0;L;;;;;N;;;;; +1B09C;HENTAIGANA LETTER NO-4;Lo;0;L;;;;;N;;;;; +1B09D;HENTAIGANA LETTER NO-5;Lo;0;L;;;;;N;;;;; +1B09E;HENTAIGANA LETTER HA-1;Lo;0;L;;;;;N;;;;; +1B09F;HENTAIGANA LETTER HA-2;Lo;0;L;;;;;N;;;;; +1B0A0;HENTAIGANA LETTER HA-3;Lo;0;L;;;;;N;;;;; +1B0A1;HENTAIGANA LETTER HA-4;Lo;0;L;;;;;N;;;;; +1B0A2;HENTAIGANA LETTER HA-5;Lo;0;L;;;;;N;;;;; +1B0A3;HENTAIGANA LETTER HA-6;Lo;0;L;;;;;N;;;;; +1B0A4;HENTAIGANA LETTER HA-7;Lo;0;L;;;;;N;;;;; +1B0A5;HENTAIGANA LETTER HA-8;Lo;0;L;;;;;N;;;;; +1B0A6;HENTAIGANA LETTER HA-9;Lo;0;L;;;;;N;;;;; +1B0A7;HENTAIGANA LETTER HA-10;Lo;0;L;;;;;N;;;;; +1B0A8;HENTAIGANA LETTER HA-11;Lo;0;L;;;;;N;;;;; +1B0A9;HENTAIGANA LETTER HI-1;Lo;0;L;;;;;N;;;;; +1B0AA;HENTAIGANA LETTER HI-2;Lo;0;L;;;;;N;;;;; +1B0AB;HENTAIGANA LETTER HI-3;Lo;0;L;;;;;N;;;;; +1B0AC;HENTAIGANA LETTER HI-4;Lo;0;L;;;;;N;;;;; +1B0AD;HENTAIGANA LETTER HI-5;Lo;0;L;;;;;N;;;;; +1B0AE;HENTAIGANA LETTER HI-6;Lo;0;L;;;;;N;;;;; +1B0AF;HENTAIGANA LETTER HI-7;Lo;0;L;;;;;N;;;;; +1B0B0;HENTAIGANA LETTER HU-1;Lo;0;L;;;;;N;;;;; +1B0B1;HENTAIGANA LETTER HU-2;Lo;0;L;;;;;N;;;;; +1B0B2;HENTAIGANA LETTER HU-3;Lo;0;L;;;;;N;;;;; +1B0B3;HENTAIGANA LETTER HE-1;Lo;0;L;;;;;N;;;;; +1B0B4;HENTAIGANA LETTER HE-2;Lo;0;L;;;;;N;;;;; +1B0B5;HENTAIGANA LETTER HE-3;Lo;0;L;;;;;N;;;;; +1B0B6;HENTAIGANA LETTER HE-4;Lo;0;L;;;;;N;;;;; +1B0B7;HENTAIGANA LETTER HE-5;Lo;0;L;;;;;N;;;;; +1B0B8;HENTAIGANA LETTER HE-6;Lo;0;L;;;;;N;;;;; +1B0B9;HENTAIGANA LETTER HE-7;Lo;0;L;;;;;N;;;;; +1B0BA;HENTAIGANA LETTER HO-1;Lo;0;L;;;;;N;;;;; +1B0BB;HENTAIGANA LETTER HO-2;Lo;0;L;;;;;N;;;;; +1B0BC;HENTAIGANA LETTER HO-3;Lo;0;L;;;;;N;;;;; +1B0BD;HENTAIGANA LETTER HO-4;Lo;0;L;;;;;N;;;;; +1B0BE;HENTAIGANA LETTER HO-5;Lo;0;L;;;;;N;;;;; +1B0BF;HENTAIGANA LETTER HO-6;Lo;0;L;;;;;N;;;;; +1B0C0;HENTAIGANA LETTER HO-7;Lo;0;L;;;;;N;;;;; +1B0C1;HENTAIGANA LETTER HO-8;Lo;0;L;;;;;N;;;;; +1B0C2;HENTAIGANA LETTER MA-1;Lo;0;L;;;;;N;;;;; +1B0C3;HENTAIGANA LETTER MA-2;Lo;0;L;;;;;N;;;;; +1B0C4;HENTAIGANA LETTER MA-3;Lo;0;L;;;;;N;;;;; +1B0C5;HENTAIGANA LETTER MA-4;Lo;0;L;;;;;N;;;;; +1B0C6;HENTAIGANA LETTER MA-5;Lo;0;L;;;;;N;;;;; +1B0C7;HENTAIGANA LETTER MA-6;Lo;0;L;;;;;N;;;;; +1B0C8;HENTAIGANA LETTER MA-7;Lo;0;L;;;;;N;;;;; +1B0C9;HENTAIGANA LETTER MI-1;Lo;0;L;;;;;N;;;;; +1B0CA;HENTAIGANA LETTER MI-2;Lo;0;L;;;;;N;;;;; +1B0CB;HENTAIGANA LETTER MI-3;Lo;0;L;;;;;N;;;;; +1B0CC;HENTAIGANA LETTER MI-4;Lo;0;L;;;;;N;;;;; +1B0CD;HENTAIGANA LETTER MI-5;Lo;0;L;;;;;N;;;;; +1B0CE;HENTAIGANA LETTER MI-6;Lo;0;L;;;;;N;;;;; +1B0CF;HENTAIGANA LETTER MI-7;Lo;0;L;;;;;N;;;;; +1B0D0;HENTAIGANA LETTER MU-1;Lo;0;L;;;;;N;;;;; +1B0D1;HENTAIGANA LETTER MU-2;Lo;0;L;;;;;N;;;;; +1B0D2;HENTAIGANA LETTER MU-3;Lo;0;L;;;;;N;;;;; +1B0D3;HENTAIGANA LETTER MU-4;Lo;0;L;;;;;N;;;;; +1B0D4;HENTAIGANA LETTER ME-1;Lo;0;L;;;;;N;;;;; +1B0D5;HENTAIGANA LETTER ME-2;Lo;0;L;;;;;N;;;;; +1B0D6;HENTAIGANA LETTER ME-MA;Lo;0;L;;;;;N;;;;; +1B0D7;HENTAIGANA LETTER MO-1;Lo;0;L;;;;;N;;;;; +1B0D8;HENTAIGANA LETTER MO-2;Lo;0;L;;;;;N;;;;; +1B0D9;HENTAIGANA LETTER MO-3;Lo;0;L;;;;;N;;;;; +1B0DA;HENTAIGANA LETTER MO-4;Lo;0;L;;;;;N;;;;; +1B0DB;HENTAIGANA LETTER MO-5;Lo;0;L;;;;;N;;;;; +1B0DC;HENTAIGANA LETTER MO-6;Lo;0;L;;;;;N;;;;; +1B0DD;HENTAIGANA LETTER YA-1;Lo;0;L;;;;;N;;;;; +1B0DE;HENTAIGANA LETTER YA-2;Lo;0;L;;;;;N;;;;; +1B0DF;HENTAIGANA LETTER YA-3;Lo;0;L;;;;;N;;;;; +1B0E0;HENTAIGANA LETTER YA-4;Lo;0;L;;;;;N;;;;; +1B0E1;HENTAIGANA LETTER YA-5;Lo;0;L;;;;;N;;;;; +1B0E2;HENTAIGANA LETTER YA-YO;Lo;0;L;;;;;N;;;;; +1B0E3;HENTAIGANA LETTER YU-1;Lo;0;L;;;;;N;;;;; +1B0E4;HENTAIGANA LETTER YU-2;Lo;0;L;;;;;N;;;;; +1B0E5;HENTAIGANA LETTER YU-3;Lo;0;L;;;;;N;;;;; +1B0E6;HENTAIGANA LETTER YU-4;Lo;0;L;;;;;N;;;;; +1B0E7;HENTAIGANA LETTER YO-1;Lo;0;L;;;;;N;;;;; +1B0E8;HENTAIGANA LETTER YO-2;Lo;0;L;;;;;N;;;;; +1B0E9;HENTAIGANA LETTER YO-3;Lo;0;L;;;;;N;;;;; +1B0EA;HENTAIGANA LETTER YO-4;Lo;0;L;;;;;N;;;;; +1B0EB;HENTAIGANA LETTER YO-5;Lo;0;L;;;;;N;;;;; +1B0EC;HENTAIGANA LETTER YO-6;Lo;0;L;;;;;N;;;;; +1B0ED;HENTAIGANA LETTER RA-1;Lo;0;L;;;;;N;;;;; +1B0EE;HENTAIGANA LETTER RA-2;Lo;0;L;;;;;N;;;;; +1B0EF;HENTAIGANA LETTER RA-3;Lo;0;L;;;;;N;;;;; +1B0F0;HENTAIGANA LETTER RA-4;Lo;0;L;;;;;N;;;;; +1B0F1;HENTAIGANA LETTER RI-1;Lo;0;L;;;;;N;;;;; +1B0F2;HENTAIGANA LETTER RI-2;Lo;0;L;;;;;N;;;;; +1B0F3;HENTAIGANA LETTER RI-3;Lo;0;L;;;;;N;;;;; +1B0F4;HENTAIGANA LETTER RI-4;Lo;0;L;;;;;N;;;;; +1B0F5;HENTAIGANA LETTER RI-5;Lo;0;L;;;;;N;;;;; +1B0F6;HENTAIGANA LETTER RI-6;Lo;0;L;;;;;N;;;;; +1B0F7;HENTAIGANA LETTER RI-7;Lo;0;L;;;;;N;;;;; +1B0F8;HENTAIGANA LETTER RU-1;Lo;0;L;;;;;N;;;;; +1B0F9;HENTAIGANA LETTER RU-2;Lo;0;L;;;;;N;;;;; +1B0FA;HENTAIGANA LETTER RU-3;Lo;0;L;;;;;N;;;;; +1B0FB;HENTAIGANA LETTER RU-4;Lo;0;L;;;;;N;;;;; +1B0FC;HENTAIGANA LETTER RU-5;Lo;0;L;;;;;N;;;;; +1B0FD;HENTAIGANA LETTER RU-6;Lo;0;L;;;;;N;;;;; +1B0FE;HENTAIGANA LETTER RE-1;Lo;0;L;;;;;N;;;;; +1B0FF;HENTAIGANA LETTER RE-2;Lo;0;L;;;;;N;;;;; +1B100;HENTAIGANA LETTER RE-3;Lo;0;L;;;;;N;;;;; +1B101;HENTAIGANA LETTER RE-4;Lo;0;L;;;;;N;;;;; +1B102;HENTAIGANA LETTER RO-1;Lo;0;L;;;;;N;;;;; +1B103;HENTAIGANA LETTER RO-2;Lo;0;L;;;;;N;;;;; +1B104;HENTAIGANA LETTER RO-3;Lo;0;L;;;;;N;;;;; +1B105;HENTAIGANA LETTER RO-4;Lo;0;L;;;;;N;;;;; +1B106;HENTAIGANA LETTER RO-5;Lo;0;L;;;;;N;;;;; +1B107;HENTAIGANA LETTER RO-6;Lo;0;L;;;;;N;;;;; +1B108;HENTAIGANA LETTER WA-1;Lo;0;L;;;;;N;;;;; +1B109;HENTAIGANA LETTER WA-2;Lo;0;L;;;;;N;;;;; +1B10A;HENTAIGANA LETTER WA-3;Lo;0;L;;;;;N;;;;; +1B10B;HENTAIGANA LETTER WA-4;Lo;0;L;;;;;N;;;;; +1B10C;HENTAIGANA LETTER WA-5;Lo;0;L;;;;;N;;;;; +1B10D;HENTAIGANA LETTER WI-1;Lo;0;L;;;;;N;;;;; +1B10E;HENTAIGANA LETTER WI-2;Lo;0;L;;;;;N;;;;; +1B10F;HENTAIGANA LETTER WI-3;Lo;0;L;;;;;N;;;;; +1B110;HENTAIGANA LETTER WI-4;Lo;0;L;;;;;N;;;;; +1B111;HENTAIGANA LETTER WI-5;Lo;0;L;;;;;N;;;;; +1B112;HENTAIGANA LETTER WE-1;Lo;0;L;;;;;N;;;;; +1B113;HENTAIGANA LETTER WE-2;Lo;0;L;;;;;N;;;;; +1B114;HENTAIGANA LETTER WE-3;Lo;0;L;;;;;N;;;;; +1B115;HENTAIGANA LETTER WE-4;Lo;0;L;;;;;N;;;;; +1B116;HENTAIGANA LETTER WO-1;Lo;0;L;;;;;N;;;;; +1B117;HENTAIGANA LETTER WO-2;Lo;0;L;;;;;N;;;;; +1B118;HENTAIGANA LETTER WO-3;Lo;0;L;;;;;N;;;;; +1B119;HENTAIGANA LETTER WO-4;Lo;0;L;;;;;N;;;;; +1B11A;HENTAIGANA LETTER WO-5;Lo;0;L;;;;;N;;;;; +1B11B;HENTAIGANA LETTER WO-6;Lo;0;L;;;;;N;;;;; +1B11C;HENTAIGANA LETTER WO-7;Lo;0;L;;;;;N;;;;; +1B11D;HENTAIGANA LETTER N-MU-MO-1;Lo;0;L;;;;;N;;;;; +1B11E;HENTAIGANA LETTER N-MU-MO-2;Lo;0;L;;;;;N;;;;; +1B170;NUSHU CHARACTER-1B170;Lo;0;L;;;;;N;;;;; +1B171;NUSHU CHARACTER-1B171;Lo;0;L;;;;;N;;;;; +1B172;NUSHU CHARACTER-1B172;Lo;0;L;;;;;N;;;;; +1B173;NUSHU CHARACTER-1B173;Lo;0;L;;;;;N;;;;; +1B174;NUSHU CHARACTER-1B174;Lo;0;L;;;;;N;;;;; +1B175;NUSHU CHARACTER-1B175;Lo;0;L;;;;;N;;;;; +1B176;NUSHU CHARACTER-1B176;Lo;0;L;;;;;N;;;;; +1B177;NUSHU CHARACTER-1B177;Lo;0;L;;;;;N;;;;; +1B178;NUSHU CHARACTER-1B178;Lo;0;L;;;;;N;;;;; +1B179;NUSHU CHARACTER-1B179;Lo;0;L;;;;;N;;;;; +1B17A;NUSHU CHARACTER-1B17A;Lo;0;L;;;;;N;;;;; +1B17B;NUSHU CHARACTER-1B17B;Lo;0;L;;;;;N;;;;; +1B17C;NUSHU CHARACTER-1B17C;Lo;0;L;;;;;N;;;;; +1B17D;NUSHU CHARACTER-1B17D;Lo;0;L;;;;;N;;;;; +1B17E;NUSHU CHARACTER-1B17E;Lo;0;L;;;;;N;;;;; +1B17F;NUSHU CHARACTER-1B17F;Lo;0;L;;;;;N;;;;; +1B180;NUSHU CHARACTER-1B180;Lo;0;L;;;;;N;;;;; +1B181;NUSHU CHARACTER-1B181;Lo;0;L;;;;;N;;;;; +1B182;NUSHU CHARACTER-1B182;Lo;0;L;;;;;N;;;;; +1B183;NUSHU CHARACTER-1B183;Lo;0;L;;;;;N;;;;; +1B184;NUSHU CHARACTER-1B184;Lo;0;L;;;;;N;;;;; +1B185;NUSHU CHARACTER-1B185;Lo;0;L;;;;;N;;;;; +1B186;NUSHU CHARACTER-1B186;Lo;0;L;;;;;N;;;;; +1B187;NUSHU CHARACTER-1B187;Lo;0;L;;;;;N;;;;; +1B188;NUSHU CHARACTER-1B188;Lo;0;L;;;;;N;;;;; +1B189;NUSHU CHARACTER-1B189;Lo;0;L;;;;;N;;;;; +1B18A;NUSHU CHARACTER-1B18A;Lo;0;L;;;;;N;;;;; +1B18B;NUSHU CHARACTER-1B18B;Lo;0;L;;;;;N;;;;; +1B18C;NUSHU CHARACTER-1B18C;Lo;0;L;;;;;N;;;;; +1B18D;NUSHU CHARACTER-1B18D;Lo;0;L;;;;;N;;;;; +1B18E;NUSHU CHARACTER-1B18E;Lo;0;L;;;;;N;;;;; +1B18F;NUSHU CHARACTER-1B18F;Lo;0;L;;;;;N;;;;; +1B190;NUSHU CHARACTER-1B190;Lo;0;L;;;;;N;;;;; +1B191;NUSHU CHARACTER-1B191;Lo;0;L;;;;;N;;;;; +1B192;NUSHU CHARACTER-1B192;Lo;0;L;;;;;N;;;;; +1B193;NUSHU CHARACTER-1B193;Lo;0;L;;;;;N;;;;; +1B194;NUSHU CHARACTER-1B194;Lo;0;L;;;;;N;;;;; +1B195;NUSHU CHARACTER-1B195;Lo;0;L;;;;;N;;;;; +1B196;NUSHU CHARACTER-1B196;Lo;0;L;;;;;N;;;;; +1B197;NUSHU CHARACTER-1B197;Lo;0;L;;;;;N;;;;; +1B198;NUSHU CHARACTER-1B198;Lo;0;L;;;;;N;;;;; +1B199;NUSHU CHARACTER-1B199;Lo;0;L;;;;;N;;;;; +1B19A;NUSHU CHARACTER-1B19A;Lo;0;L;;;;;N;;;;; +1B19B;NUSHU CHARACTER-1B19B;Lo;0;L;;;;;N;;;;; +1B19C;NUSHU CHARACTER-1B19C;Lo;0;L;;;;;N;;;;; +1B19D;NUSHU CHARACTER-1B19D;Lo;0;L;;;;;N;;;;; +1B19E;NUSHU CHARACTER-1B19E;Lo;0;L;;;;;N;;;;; +1B19F;NUSHU CHARACTER-1B19F;Lo;0;L;;;;;N;;;;; +1B1A0;NUSHU CHARACTER-1B1A0;Lo;0;L;;;;;N;;;;; +1B1A1;NUSHU CHARACTER-1B1A1;Lo;0;L;;;;;N;;;;; +1B1A2;NUSHU CHARACTER-1B1A2;Lo;0;L;;;;;N;;;;; +1B1A3;NUSHU CHARACTER-1B1A3;Lo;0;L;;;;;N;;;;; +1B1A4;NUSHU CHARACTER-1B1A4;Lo;0;L;;;;;N;;;;; +1B1A5;NUSHU CHARACTER-1B1A5;Lo;0;L;;;;;N;;;;; +1B1A6;NUSHU CHARACTER-1B1A6;Lo;0;L;;;;;N;;;;; +1B1A7;NUSHU CHARACTER-1B1A7;Lo;0;L;;;;;N;;;;; +1B1A8;NUSHU CHARACTER-1B1A8;Lo;0;L;;;;;N;;;;; +1B1A9;NUSHU CHARACTER-1B1A9;Lo;0;L;;;;;N;;;;; +1B1AA;NUSHU CHARACTER-1B1AA;Lo;0;L;;;;;N;;;;; +1B1AB;NUSHU CHARACTER-1B1AB;Lo;0;L;;;;;N;;;;; +1B1AC;NUSHU CHARACTER-1B1AC;Lo;0;L;;;;;N;;;;; +1B1AD;NUSHU CHARACTER-1B1AD;Lo;0;L;;;;;N;;;;; +1B1AE;NUSHU CHARACTER-1B1AE;Lo;0;L;;;;;N;;;;; +1B1AF;NUSHU CHARACTER-1B1AF;Lo;0;L;;;;;N;;;;; +1B1B0;NUSHU CHARACTER-1B1B0;Lo;0;L;;;;;N;;;;; +1B1B1;NUSHU CHARACTER-1B1B1;Lo;0;L;;;;;N;;;;; +1B1B2;NUSHU CHARACTER-1B1B2;Lo;0;L;;;;;N;;;;; +1B1B3;NUSHU CHARACTER-1B1B3;Lo;0;L;;;;;N;;;;; +1B1B4;NUSHU CHARACTER-1B1B4;Lo;0;L;;;;;N;;;;; +1B1B5;NUSHU CHARACTER-1B1B5;Lo;0;L;;;;;N;;;;; +1B1B6;NUSHU CHARACTER-1B1B6;Lo;0;L;;;;;N;;;;; +1B1B7;NUSHU CHARACTER-1B1B7;Lo;0;L;;;;;N;;;;; +1B1B8;NUSHU CHARACTER-1B1B8;Lo;0;L;;;;;N;;;;; +1B1B9;NUSHU CHARACTER-1B1B9;Lo;0;L;;;;;N;;;;; +1B1BA;NUSHU CHARACTER-1B1BA;Lo;0;L;;;;;N;;;;; +1B1BB;NUSHU CHARACTER-1B1BB;Lo;0;L;;;;;N;;;;; +1B1BC;NUSHU CHARACTER-1B1BC;Lo;0;L;;;;;N;;;;; +1B1BD;NUSHU CHARACTER-1B1BD;Lo;0;L;;;;;N;;;;; +1B1BE;NUSHU CHARACTER-1B1BE;Lo;0;L;;;;;N;;;;; +1B1BF;NUSHU CHARACTER-1B1BF;Lo;0;L;;;;;N;;;;; +1B1C0;NUSHU CHARACTER-1B1C0;Lo;0;L;;;;;N;;;;; +1B1C1;NUSHU CHARACTER-1B1C1;Lo;0;L;;;;;N;;;;; +1B1C2;NUSHU CHARACTER-1B1C2;Lo;0;L;;;;;N;;;;; +1B1C3;NUSHU CHARACTER-1B1C3;Lo;0;L;;;;;N;;;;; +1B1C4;NUSHU CHARACTER-1B1C4;Lo;0;L;;;;;N;;;;; +1B1C5;NUSHU CHARACTER-1B1C5;Lo;0;L;;;;;N;;;;; +1B1C6;NUSHU CHARACTER-1B1C6;Lo;0;L;;;;;N;;;;; +1B1C7;NUSHU CHARACTER-1B1C7;Lo;0;L;;;;;N;;;;; +1B1C8;NUSHU CHARACTER-1B1C8;Lo;0;L;;;;;N;;;;; +1B1C9;NUSHU CHARACTER-1B1C9;Lo;0;L;;;;;N;;;;; +1B1CA;NUSHU CHARACTER-1B1CA;Lo;0;L;;;;;N;;;;; +1B1CB;NUSHU CHARACTER-1B1CB;Lo;0;L;;;;;N;;;;; +1B1CC;NUSHU CHARACTER-1B1CC;Lo;0;L;;;;;N;;;;; +1B1CD;NUSHU CHARACTER-1B1CD;Lo;0;L;;;;;N;;;;; +1B1CE;NUSHU CHARACTER-1B1CE;Lo;0;L;;;;;N;;;;; +1B1CF;NUSHU CHARACTER-1B1CF;Lo;0;L;;;;;N;;;;; +1B1D0;NUSHU CHARACTER-1B1D0;Lo;0;L;;;;;N;;;;; +1B1D1;NUSHU CHARACTER-1B1D1;Lo;0;L;;;;;N;;;;; +1B1D2;NUSHU CHARACTER-1B1D2;Lo;0;L;;;;;N;;;;; +1B1D3;NUSHU CHARACTER-1B1D3;Lo;0;L;;;;;N;;;;; +1B1D4;NUSHU CHARACTER-1B1D4;Lo;0;L;;;;;N;;;;; +1B1D5;NUSHU CHARACTER-1B1D5;Lo;0;L;;;;;N;;;;; +1B1D6;NUSHU CHARACTER-1B1D6;Lo;0;L;;;;;N;;;;; +1B1D7;NUSHU CHARACTER-1B1D7;Lo;0;L;;;;;N;;;;; +1B1D8;NUSHU CHARACTER-1B1D8;Lo;0;L;;;;;N;;;;; +1B1D9;NUSHU CHARACTER-1B1D9;Lo;0;L;;;;;N;;;;; +1B1DA;NUSHU CHARACTER-1B1DA;Lo;0;L;;;;;N;;;;; +1B1DB;NUSHU CHARACTER-1B1DB;Lo;0;L;;;;;N;;;;; +1B1DC;NUSHU CHARACTER-1B1DC;Lo;0;L;;;;;N;;;;; +1B1DD;NUSHU CHARACTER-1B1DD;Lo;0;L;;;;;N;;;;; +1B1DE;NUSHU CHARACTER-1B1DE;Lo;0;L;;;;;N;;;;; +1B1DF;NUSHU CHARACTER-1B1DF;Lo;0;L;;;;;N;;;;; +1B1E0;NUSHU CHARACTER-1B1E0;Lo;0;L;;;;;N;;;;; +1B1E1;NUSHU CHARACTER-1B1E1;Lo;0;L;;;;;N;;;;; +1B1E2;NUSHU CHARACTER-1B1E2;Lo;0;L;;;;;N;;;;; +1B1E3;NUSHU CHARACTER-1B1E3;Lo;0;L;;;;;N;;;;; +1B1E4;NUSHU CHARACTER-1B1E4;Lo;0;L;;;;;N;;;;; +1B1E5;NUSHU CHARACTER-1B1E5;Lo;0;L;;;;;N;;;;; +1B1E6;NUSHU CHARACTER-1B1E6;Lo;0;L;;;;;N;;;;; +1B1E7;NUSHU CHARACTER-1B1E7;Lo;0;L;;;;;N;;;;; +1B1E8;NUSHU CHARACTER-1B1E8;Lo;0;L;;;;;N;;;;; +1B1E9;NUSHU CHARACTER-1B1E9;Lo;0;L;;;;;N;;;;; +1B1EA;NUSHU CHARACTER-1B1EA;Lo;0;L;;;;;N;;;;; +1B1EB;NUSHU CHARACTER-1B1EB;Lo;0;L;;;;;N;;;;; +1B1EC;NUSHU CHARACTER-1B1EC;Lo;0;L;;;;;N;;;;; +1B1ED;NUSHU CHARACTER-1B1ED;Lo;0;L;;;;;N;;;;; +1B1EE;NUSHU CHARACTER-1B1EE;Lo;0;L;;;;;N;;;;; +1B1EF;NUSHU CHARACTER-1B1EF;Lo;0;L;;;;;N;;;;; +1B1F0;NUSHU CHARACTER-1B1F0;Lo;0;L;;;;;N;;;;; +1B1F1;NUSHU CHARACTER-1B1F1;Lo;0;L;;;;;N;;;;; +1B1F2;NUSHU CHARACTER-1B1F2;Lo;0;L;;;;;N;;;;; +1B1F3;NUSHU CHARACTER-1B1F3;Lo;0;L;;;;;N;;;;; +1B1F4;NUSHU CHARACTER-1B1F4;Lo;0;L;;;;;N;;;;; +1B1F5;NUSHU CHARACTER-1B1F5;Lo;0;L;;;;;N;;;;; +1B1F6;NUSHU CHARACTER-1B1F6;Lo;0;L;;;;;N;;;;; +1B1F7;NUSHU CHARACTER-1B1F7;Lo;0;L;;;;;N;;;;; +1B1F8;NUSHU CHARACTER-1B1F8;Lo;0;L;;;;;N;;;;; +1B1F9;NUSHU CHARACTER-1B1F9;Lo;0;L;;;;;N;;;;; +1B1FA;NUSHU CHARACTER-1B1FA;Lo;0;L;;;;;N;;;;; +1B1FB;NUSHU CHARACTER-1B1FB;Lo;0;L;;;;;N;;;;; +1B1FC;NUSHU CHARACTER-1B1FC;Lo;0;L;;;;;N;;;;; +1B1FD;NUSHU CHARACTER-1B1FD;Lo;0;L;;;;;N;;;;; +1B1FE;NUSHU CHARACTER-1B1FE;Lo;0;L;;;;;N;;;;; +1B1FF;NUSHU CHARACTER-1B1FF;Lo;0;L;;;;;N;;;;; +1B200;NUSHU CHARACTER-1B200;Lo;0;L;;;;;N;;;;; +1B201;NUSHU CHARACTER-1B201;Lo;0;L;;;;;N;;;;; +1B202;NUSHU CHARACTER-1B202;Lo;0;L;;;;;N;;;;; +1B203;NUSHU CHARACTER-1B203;Lo;0;L;;;;;N;;;;; +1B204;NUSHU CHARACTER-1B204;Lo;0;L;;;;;N;;;;; +1B205;NUSHU CHARACTER-1B205;Lo;0;L;;;;;N;;;;; +1B206;NUSHU CHARACTER-1B206;Lo;0;L;;;;;N;;;;; +1B207;NUSHU CHARACTER-1B207;Lo;0;L;;;;;N;;;;; +1B208;NUSHU CHARACTER-1B208;Lo;0;L;;;;;N;;;;; +1B209;NUSHU CHARACTER-1B209;Lo;0;L;;;;;N;;;;; +1B20A;NUSHU CHARACTER-1B20A;Lo;0;L;;;;;N;;;;; +1B20B;NUSHU CHARACTER-1B20B;Lo;0;L;;;;;N;;;;; +1B20C;NUSHU CHARACTER-1B20C;Lo;0;L;;;;;N;;;;; +1B20D;NUSHU CHARACTER-1B20D;Lo;0;L;;;;;N;;;;; +1B20E;NUSHU CHARACTER-1B20E;Lo;0;L;;;;;N;;;;; +1B20F;NUSHU CHARACTER-1B20F;Lo;0;L;;;;;N;;;;; +1B210;NUSHU CHARACTER-1B210;Lo;0;L;;;;;N;;;;; +1B211;NUSHU CHARACTER-1B211;Lo;0;L;;;;;N;;;;; +1B212;NUSHU CHARACTER-1B212;Lo;0;L;;;;;N;;;;; +1B213;NUSHU CHARACTER-1B213;Lo;0;L;;;;;N;;;;; +1B214;NUSHU CHARACTER-1B214;Lo;0;L;;;;;N;;;;; +1B215;NUSHU CHARACTER-1B215;Lo;0;L;;;;;N;;;;; +1B216;NUSHU CHARACTER-1B216;Lo;0;L;;;;;N;;;;; +1B217;NUSHU CHARACTER-1B217;Lo;0;L;;;;;N;;;;; +1B218;NUSHU CHARACTER-1B218;Lo;0;L;;;;;N;;;;; +1B219;NUSHU CHARACTER-1B219;Lo;0;L;;;;;N;;;;; +1B21A;NUSHU CHARACTER-1B21A;Lo;0;L;;;;;N;;;;; +1B21B;NUSHU CHARACTER-1B21B;Lo;0;L;;;;;N;;;;; +1B21C;NUSHU CHARACTER-1B21C;Lo;0;L;;;;;N;;;;; +1B21D;NUSHU CHARACTER-1B21D;Lo;0;L;;;;;N;;;;; +1B21E;NUSHU CHARACTER-1B21E;Lo;0;L;;;;;N;;;;; +1B21F;NUSHU CHARACTER-1B21F;Lo;0;L;;;;;N;;;;; +1B220;NUSHU CHARACTER-1B220;Lo;0;L;;;;;N;;;;; +1B221;NUSHU CHARACTER-1B221;Lo;0;L;;;;;N;;;;; +1B222;NUSHU CHARACTER-1B222;Lo;0;L;;;;;N;;;;; +1B223;NUSHU CHARACTER-1B223;Lo;0;L;;;;;N;;;;; +1B224;NUSHU CHARACTER-1B224;Lo;0;L;;;;;N;;;;; +1B225;NUSHU CHARACTER-1B225;Lo;0;L;;;;;N;;;;; +1B226;NUSHU CHARACTER-1B226;Lo;0;L;;;;;N;;;;; +1B227;NUSHU CHARACTER-1B227;Lo;0;L;;;;;N;;;;; +1B228;NUSHU CHARACTER-1B228;Lo;0;L;;;;;N;;;;; +1B229;NUSHU CHARACTER-1B229;Lo;0;L;;;;;N;;;;; +1B22A;NUSHU CHARACTER-1B22A;Lo;0;L;;;;;N;;;;; +1B22B;NUSHU CHARACTER-1B22B;Lo;0;L;;;;;N;;;;; +1B22C;NUSHU CHARACTER-1B22C;Lo;0;L;;;;;N;;;;; +1B22D;NUSHU CHARACTER-1B22D;Lo;0;L;;;;;N;;;;; +1B22E;NUSHU CHARACTER-1B22E;Lo;0;L;;;;;N;;;;; +1B22F;NUSHU CHARACTER-1B22F;Lo;0;L;;;;;N;;;;; +1B230;NUSHU CHARACTER-1B230;Lo;0;L;;;;;N;;;;; +1B231;NUSHU CHARACTER-1B231;Lo;0;L;;;;;N;;;;; +1B232;NUSHU CHARACTER-1B232;Lo;0;L;;;;;N;;;;; +1B233;NUSHU CHARACTER-1B233;Lo;0;L;;;;;N;;;;; +1B234;NUSHU CHARACTER-1B234;Lo;0;L;;;;;N;;;;; +1B235;NUSHU CHARACTER-1B235;Lo;0;L;;;;;N;;;;; +1B236;NUSHU CHARACTER-1B236;Lo;0;L;;;;;N;;;;; +1B237;NUSHU CHARACTER-1B237;Lo;0;L;;;;;N;;;;; +1B238;NUSHU CHARACTER-1B238;Lo;0;L;;;;;N;;;;; +1B239;NUSHU CHARACTER-1B239;Lo;0;L;;;;;N;;;;; +1B23A;NUSHU CHARACTER-1B23A;Lo;0;L;;;;;N;;;;; +1B23B;NUSHU CHARACTER-1B23B;Lo;0;L;;;;;N;;;;; +1B23C;NUSHU CHARACTER-1B23C;Lo;0;L;;;;;N;;;;; +1B23D;NUSHU CHARACTER-1B23D;Lo;0;L;;;;;N;;;;; +1B23E;NUSHU CHARACTER-1B23E;Lo;0;L;;;;;N;;;;; +1B23F;NUSHU CHARACTER-1B23F;Lo;0;L;;;;;N;;;;; +1B240;NUSHU CHARACTER-1B240;Lo;0;L;;;;;N;;;;; +1B241;NUSHU CHARACTER-1B241;Lo;0;L;;;;;N;;;;; +1B242;NUSHU CHARACTER-1B242;Lo;0;L;;;;;N;;;;; +1B243;NUSHU CHARACTER-1B243;Lo;0;L;;;;;N;;;;; +1B244;NUSHU CHARACTER-1B244;Lo;0;L;;;;;N;;;;; +1B245;NUSHU CHARACTER-1B245;Lo;0;L;;;;;N;;;;; +1B246;NUSHU CHARACTER-1B246;Lo;0;L;;;;;N;;;;; +1B247;NUSHU CHARACTER-1B247;Lo;0;L;;;;;N;;;;; +1B248;NUSHU CHARACTER-1B248;Lo;0;L;;;;;N;;;;; +1B249;NUSHU CHARACTER-1B249;Lo;0;L;;;;;N;;;;; +1B24A;NUSHU CHARACTER-1B24A;Lo;0;L;;;;;N;;;;; +1B24B;NUSHU CHARACTER-1B24B;Lo;0;L;;;;;N;;;;; +1B24C;NUSHU CHARACTER-1B24C;Lo;0;L;;;;;N;;;;; +1B24D;NUSHU CHARACTER-1B24D;Lo;0;L;;;;;N;;;;; +1B24E;NUSHU CHARACTER-1B24E;Lo;0;L;;;;;N;;;;; +1B24F;NUSHU CHARACTER-1B24F;Lo;0;L;;;;;N;;;;; +1B250;NUSHU CHARACTER-1B250;Lo;0;L;;;;;N;;;;; +1B251;NUSHU CHARACTER-1B251;Lo;0;L;;;;;N;;;;; +1B252;NUSHU CHARACTER-1B252;Lo;0;L;;;;;N;;;;; +1B253;NUSHU CHARACTER-1B253;Lo;0;L;;;;;N;;;;; +1B254;NUSHU CHARACTER-1B254;Lo;0;L;;;;;N;;;;; +1B255;NUSHU CHARACTER-1B255;Lo;0;L;;;;;N;;;;; +1B256;NUSHU CHARACTER-1B256;Lo;0;L;;;;;N;;;;; +1B257;NUSHU CHARACTER-1B257;Lo;0;L;;;;;N;;;;; +1B258;NUSHU CHARACTER-1B258;Lo;0;L;;;;;N;;;;; +1B259;NUSHU CHARACTER-1B259;Lo;0;L;;;;;N;;;;; +1B25A;NUSHU CHARACTER-1B25A;Lo;0;L;;;;;N;;;;; +1B25B;NUSHU CHARACTER-1B25B;Lo;0;L;;;;;N;;;;; +1B25C;NUSHU CHARACTER-1B25C;Lo;0;L;;;;;N;;;;; +1B25D;NUSHU CHARACTER-1B25D;Lo;0;L;;;;;N;;;;; +1B25E;NUSHU CHARACTER-1B25E;Lo;0;L;;;;;N;;;;; +1B25F;NUSHU CHARACTER-1B25F;Lo;0;L;;;;;N;;;;; +1B260;NUSHU CHARACTER-1B260;Lo;0;L;;;;;N;;;;; +1B261;NUSHU CHARACTER-1B261;Lo;0;L;;;;;N;;;;; +1B262;NUSHU CHARACTER-1B262;Lo;0;L;;;;;N;;;;; +1B263;NUSHU CHARACTER-1B263;Lo;0;L;;;;;N;;;;; +1B264;NUSHU CHARACTER-1B264;Lo;0;L;;;;;N;;;;; +1B265;NUSHU CHARACTER-1B265;Lo;0;L;;;;;N;;;;; +1B266;NUSHU CHARACTER-1B266;Lo;0;L;;;;;N;;;;; +1B267;NUSHU CHARACTER-1B267;Lo;0;L;;;;;N;;;;; +1B268;NUSHU CHARACTER-1B268;Lo;0;L;;;;;N;;;;; +1B269;NUSHU CHARACTER-1B269;Lo;0;L;;;;;N;;;;; +1B26A;NUSHU CHARACTER-1B26A;Lo;0;L;;;;;N;;;;; +1B26B;NUSHU CHARACTER-1B26B;Lo;0;L;;;;;N;;;;; +1B26C;NUSHU CHARACTER-1B26C;Lo;0;L;;;;;N;;;;; +1B26D;NUSHU CHARACTER-1B26D;Lo;0;L;;;;;N;;;;; +1B26E;NUSHU CHARACTER-1B26E;Lo;0;L;;;;;N;;;;; +1B26F;NUSHU CHARACTER-1B26F;Lo;0;L;;;;;N;;;;; +1B270;NUSHU CHARACTER-1B270;Lo;0;L;;;;;N;;;;; +1B271;NUSHU CHARACTER-1B271;Lo;0;L;;;;;N;;;;; +1B272;NUSHU CHARACTER-1B272;Lo;0;L;;;;;N;;;;; +1B273;NUSHU CHARACTER-1B273;Lo;0;L;;;;;N;;;;; +1B274;NUSHU CHARACTER-1B274;Lo;0;L;;;;;N;;;;; +1B275;NUSHU CHARACTER-1B275;Lo;0;L;;;;;N;;;;; +1B276;NUSHU CHARACTER-1B276;Lo;0;L;;;;;N;;;;; +1B277;NUSHU CHARACTER-1B277;Lo;0;L;;;;;N;;;;; +1B278;NUSHU CHARACTER-1B278;Lo;0;L;;;;;N;;;;; +1B279;NUSHU CHARACTER-1B279;Lo;0;L;;;;;N;;;;; +1B27A;NUSHU CHARACTER-1B27A;Lo;0;L;;;;;N;;;;; +1B27B;NUSHU CHARACTER-1B27B;Lo;0;L;;;;;N;;;;; +1B27C;NUSHU CHARACTER-1B27C;Lo;0;L;;;;;N;;;;; +1B27D;NUSHU CHARACTER-1B27D;Lo;0;L;;;;;N;;;;; +1B27E;NUSHU CHARACTER-1B27E;Lo;0;L;;;;;N;;;;; +1B27F;NUSHU CHARACTER-1B27F;Lo;0;L;;;;;N;;;;; +1B280;NUSHU CHARACTER-1B280;Lo;0;L;;;;;N;;;;; +1B281;NUSHU CHARACTER-1B281;Lo;0;L;;;;;N;;;;; +1B282;NUSHU CHARACTER-1B282;Lo;0;L;;;;;N;;;;; +1B283;NUSHU CHARACTER-1B283;Lo;0;L;;;;;N;;;;; +1B284;NUSHU CHARACTER-1B284;Lo;0;L;;;;;N;;;;; +1B285;NUSHU CHARACTER-1B285;Lo;0;L;;;;;N;;;;; +1B286;NUSHU CHARACTER-1B286;Lo;0;L;;;;;N;;;;; +1B287;NUSHU CHARACTER-1B287;Lo;0;L;;;;;N;;;;; +1B288;NUSHU CHARACTER-1B288;Lo;0;L;;;;;N;;;;; +1B289;NUSHU CHARACTER-1B289;Lo;0;L;;;;;N;;;;; +1B28A;NUSHU CHARACTER-1B28A;Lo;0;L;;;;;N;;;;; +1B28B;NUSHU CHARACTER-1B28B;Lo;0;L;;;;;N;;;;; +1B28C;NUSHU CHARACTER-1B28C;Lo;0;L;;;;;N;;;;; +1B28D;NUSHU CHARACTER-1B28D;Lo;0;L;;;;;N;;;;; +1B28E;NUSHU CHARACTER-1B28E;Lo;0;L;;;;;N;;;;; +1B28F;NUSHU CHARACTER-1B28F;Lo;0;L;;;;;N;;;;; +1B290;NUSHU CHARACTER-1B290;Lo;0;L;;;;;N;;;;; +1B291;NUSHU CHARACTER-1B291;Lo;0;L;;;;;N;;;;; +1B292;NUSHU CHARACTER-1B292;Lo;0;L;;;;;N;;;;; +1B293;NUSHU CHARACTER-1B293;Lo;0;L;;;;;N;;;;; +1B294;NUSHU CHARACTER-1B294;Lo;0;L;;;;;N;;;;; +1B295;NUSHU CHARACTER-1B295;Lo;0;L;;;;;N;;;;; +1B296;NUSHU CHARACTER-1B296;Lo;0;L;;;;;N;;;;; +1B297;NUSHU CHARACTER-1B297;Lo;0;L;;;;;N;;;;; +1B298;NUSHU CHARACTER-1B298;Lo;0;L;;;;;N;;;;; +1B299;NUSHU CHARACTER-1B299;Lo;0;L;;;;;N;;;;; +1B29A;NUSHU CHARACTER-1B29A;Lo;0;L;;;;;N;;;;; +1B29B;NUSHU CHARACTER-1B29B;Lo;0;L;;;;;N;;;;; +1B29C;NUSHU CHARACTER-1B29C;Lo;0;L;;;;;N;;;;; +1B29D;NUSHU CHARACTER-1B29D;Lo;0;L;;;;;N;;;;; +1B29E;NUSHU CHARACTER-1B29E;Lo;0;L;;;;;N;;;;; +1B29F;NUSHU CHARACTER-1B29F;Lo;0;L;;;;;N;;;;; +1B2A0;NUSHU CHARACTER-1B2A0;Lo;0;L;;;;;N;;;;; +1B2A1;NUSHU CHARACTER-1B2A1;Lo;0;L;;;;;N;;;;; +1B2A2;NUSHU CHARACTER-1B2A2;Lo;0;L;;;;;N;;;;; +1B2A3;NUSHU CHARACTER-1B2A3;Lo;0;L;;;;;N;;;;; +1B2A4;NUSHU CHARACTER-1B2A4;Lo;0;L;;;;;N;;;;; +1B2A5;NUSHU CHARACTER-1B2A5;Lo;0;L;;;;;N;;;;; +1B2A6;NUSHU CHARACTER-1B2A6;Lo;0;L;;;;;N;;;;; +1B2A7;NUSHU CHARACTER-1B2A7;Lo;0;L;;;;;N;;;;; +1B2A8;NUSHU CHARACTER-1B2A8;Lo;0;L;;;;;N;;;;; +1B2A9;NUSHU CHARACTER-1B2A9;Lo;0;L;;;;;N;;;;; +1B2AA;NUSHU CHARACTER-1B2AA;Lo;0;L;;;;;N;;;;; +1B2AB;NUSHU CHARACTER-1B2AB;Lo;0;L;;;;;N;;;;; +1B2AC;NUSHU CHARACTER-1B2AC;Lo;0;L;;;;;N;;;;; +1B2AD;NUSHU CHARACTER-1B2AD;Lo;0;L;;;;;N;;;;; +1B2AE;NUSHU CHARACTER-1B2AE;Lo;0;L;;;;;N;;;;; +1B2AF;NUSHU CHARACTER-1B2AF;Lo;0;L;;;;;N;;;;; +1B2B0;NUSHU CHARACTER-1B2B0;Lo;0;L;;;;;N;;;;; +1B2B1;NUSHU CHARACTER-1B2B1;Lo;0;L;;;;;N;;;;; +1B2B2;NUSHU CHARACTER-1B2B2;Lo;0;L;;;;;N;;;;; +1B2B3;NUSHU CHARACTER-1B2B3;Lo;0;L;;;;;N;;;;; +1B2B4;NUSHU CHARACTER-1B2B4;Lo;0;L;;;;;N;;;;; +1B2B5;NUSHU CHARACTER-1B2B5;Lo;0;L;;;;;N;;;;; +1B2B6;NUSHU CHARACTER-1B2B6;Lo;0;L;;;;;N;;;;; +1B2B7;NUSHU CHARACTER-1B2B7;Lo;0;L;;;;;N;;;;; +1B2B8;NUSHU CHARACTER-1B2B8;Lo;0;L;;;;;N;;;;; +1B2B9;NUSHU CHARACTER-1B2B9;Lo;0;L;;;;;N;;;;; +1B2BA;NUSHU CHARACTER-1B2BA;Lo;0;L;;;;;N;;;;; +1B2BB;NUSHU CHARACTER-1B2BB;Lo;0;L;;;;;N;;;;; +1B2BC;NUSHU CHARACTER-1B2BC;Lo;0;L;;;;;N;;;;; +1B2BD;NUSHU CHARACTER-1B2BD;Lo;0;L;;;;;N;;;;; +1B2BE;NUSHU CHARACTER-1B2BE;Lo;0;L;;;;;N;;;;; +1B2BF;NUSHU CHARACTER-1B2BF;Lo;0;L;;;;;N;;;;; +1B2C0;NUSHU CHARACTER-1B2C0;Lo;0;L;;;;;N;;;;; +1B2C1;NUSHU CHARACTER-1B2C1;Lo;0;L;;;;;N;;;;; +1B2C2;NUSHU CHARACTER-1B2C2;Lo;0;L;;;;;N;;;;; +1B2C3;NUSHU CHARACTER-1B2C3;Lo;0;L;;;;;N;;;;; +1B2C4;NUSHU CHARACTER-1B2C4;Lo;0;L;;;;;N;;;;; +1B2C5;NUSHU CHARACTER-1B2C5;Lo;0;L;;;;;N;;;;; +1B2C6;NUSHU CHARACTER-1B2C6;Lo;0;L;;;;;N;;;;; +1B2C7;NUSHU CHARACTER-1B2C7;Lo;0;L;;;;;N;;;;; +1B2C8;NUSHU CHARACTER-1B2C8;Lo;0;L;;;;;N;;;;; +1B2C9;NUSHU CHARACTER-1B2C9;Lo;0;L;;;;;N;;;;; +1B2CA;NUSHU CHARACTER-1B2CA;Lo;0;L;;;;;N;;;;; +1B2CB;NUSHU CHARACTER-1B2CB;Lo;0;L;;;;;N;;;;; +1B2CC;NUSHU CHARACTER-1B2CC;Lo;0;L;;;;;N;;;;; +1B2CD;NUSHU CHARACTER-1B2CD;Lo;0;L;;;;;N;;;;; +1B2CE;NUSHU CHARACTER-1B2CE;Lo;0;L;;;;;N;;;;; +1B2CF;NUSHU CHARACTER-1B2CF;Lo;0;L;;;;;N;;;;; +1B2D0;NUSHU CHARACTER-1B2D0;Lo;0;L;;;;;N;;;;; +1B2D1;NUSHU CHARACTER-1B2D1;Lo;0;L;;;;;N;;;;; +1B2D2;NUSHU CHARACTER-1B2D2;Lo;0;L;;;;;N;;;;; +1B2D3;NUSHU CHARACTER-1B2D3;Lo;0;L;;;;;N;;;;; +1B2D4;NUSHU CHARACTER-1B2D4;Lo;0;L;;;;;N;;;;; +1B2D5;NUSHU CHARACTER-1B2D5;Lo;0;L;;;;;N;;;;; +1B2D6;NUSHU CHARACTER-1B2D6;Lo;0;L;;;;;N;;;;; +1B2D7;NUSHU CHARACTER-1B2D7;Lo;0;L;;;;;N;;;;; +1B2D8;NUSHU CHARACTER-1B2D8;Lo;0;L;;;;;N;;;;; +1B2D9;NUSHU CHARACTER-1B2D9;Lo;0;L;;;;;N;;;;; +1B2DA;NUSHU CHARACTER-1B2DA;Lo;0;L;;;;;N;;;;; +1B2DB;NUSHU CHARACTER-1B2DB;Lo;0;L;;;;;N;;;;; +1B2DC;NUSHU CHARACTER-1B2DC;Lo;0;L;;;;;N;;;;; +1B2DD;NUSHU CHARACTER-1B2DD;Lo;0;L;;;;;N;;;;; +1B2DE;NUSHU CHARACTER-1B2DE;Lo;0;L;;;;;N;;;;; +1B2DF;NUSHU CHARACTER-1B2DF;Lo;0;L;;;;;N;;;;; +1B2E0;NUSHU CHARACTER-1B2E0;Lo;0;L;;;;;N;;;;; +1B2E1;NUSHU CHARACTER-1B2E1;Lo;0;L;;;;;N;;;;; +1B2E2;NUSHU CHARACTER-1B2E2;Lo;0;L;;;;;N;;;;; +1B2E3;NUSHU CHARACTER-1B2E3;Lo;0;L;;;;;N;;;;; +1B2E4;NUSHU CHARACTER-1B2E4;Lo;0;L;;;;;N;;;;; +1B2E5;NUSHU CHARACTER-1B2E5;Lo;0;L;;;;;N;;;;; +1B2E6;NUSHU CHARACTER-1B2E6;Lo;0;L;;;;;N;;;;; +1B2E7;NUSHU CHARACTER-1B2E7;Lo;0;L;;;;;N;;;;; +1B2E8;NUSHU CHARACTER-1B2E8;Lo;0;L;;;;;N;;;;; +1B2E9;NUSHU CHARACTER-1B2E9;Lo;0;L;;;;;N;;;;; +1B2EA;NUSHU CHARACTER-1B2EA;Lo;0;L;;;;;N;;;;; +1B2EB;NUSHU CHARACTER-1B2EB;Lo;0;L;;;;;N;;;;; +1B2EC;NUSHU CHARACTER-1B2EC;Lo;0;L;;;;;N;;;;; +1B2ED;NUSHU CHARACTER-1B2ED;Lo;0;L;;;;;N;;;;; +1B2EE;NUSHU CHARACTER-1B2EE;Lo;0;L;;;;;N;;;;; +1B2EF;NUSHU CHARACTER-1B2EF;Lo;0;L;;;;;N;;;;; +1B2F0;NUSHU CHARACTER-1B2F0;Lo;0;L;;;;;N;;;;; +1B2F1;NUSHU CHARACTER-1B2F1;Lo;0;L;;;;;N;;;;; +1B2F2;NUSHU CHARACTER-1B2F2;Lo;0;L;;;;;N;;;;; +1B2F3;NUSHU CHARACTER-1B2F3;Lo;0;L;;;;;N;;;;; +1B2F4;NUSHU CHARACTER-1B2F4;Lo;0;L;;;;;N;;;;; +1B2F5;NUSHU CHARACTER-1B2F5;Lo;0;L;;;;;N;;;;; +1B2F6;NUSHU CHARACTER-1B2F6;Lo;0;L;;;;;N;;;;; +1B2F7;NUSHU CHARACTER-1B2F7;Lo;0;L;;;;;N;;;;; +1B2F8;NUSHU CHARACTER-1B2F8;Lo;0;L;;;;;N;;;;; +1B2F9;NUSHU CHARACTER-1B2F9;Lo;0;L;;;;;N;;;;; +1B2FA;NUSHU CHARACTER-1B2FA;Lo;0;L;;;;;N;;;;; +1B2FB;NUSHU CHARACTER-1B2FB;Lo;0;L;;;;;N;;;;; +1BC00;DUPLOYAN LETTER H;Lo;0;L;;;;;N;;;;; +1BC01;DUPLOYAN LETTER X;Lo;0;L;;;;;N;;;;; +1BC02;DUPLOYAN LETTER P;Lo;0;L;;;;;N;;;;; +1BC03;DUPLOYAN LETTER T;Lo;0;L;;;;;N;;;;; +1BC04;DUPLOYAN LETTER F;Lo;0;L;;;;;N;;;;; +1BC05;DUPLOYAN LETTER K;Lo;0;L;;;;;N;;;;; +1BC06;DUPLOYAN LETTER L;Lo;0;L;;;;;N;;;;; +1BC07;DUPLOYAN LETTER B;Lo;0;L;;;;;N;;;;; +1BC08;DUPLOYAN LETTER D;Lo;0;L;;;;;N;;;;; +1BC09;DUPLOYAN LETTER V;Lo;0;L;;;;;N;;;;; +1BC0A;DUPLOYAN LETTER G;Lo;0;L;;;;;N;;;;; +1BC0B;DUPLOYAN LETTER R;Lo;0;L;;;;;N;;;;; +1BC0C;DUPLOYAN LETTER P N;Lo;0;L;;;;;N;;;;; +1BC0D;DUPLOYAN LETTER D S;Lo;0;L;;;;;N;;;;; +1BC0E;DUPLOYAN LETTER F N;Lo;0;L;;;;;N;;;;; +1BC0F;DUPLOYAN LETTER K M;Lo;0;L;;;;;N;;;;; +1BC10;DUPLOYAN LETTER R S;Lo;0;L;;;;;N;;;;; +1BC11;DUPLOYAN LETTER TH;Lo;0;L;;;;;N;;;;; +1BC12;DUPLOYAN LETTER SLOAN DH;Lo;0;L;;;;;N;;;;; +1BC13;DUPLOYAN LETTER DH;Lo;0;L;;;;;N;;;;; +1BC14;DUPLOYAN LETTER KK;Lo;0;L;;;;;N;;;;; +1BC15;DUPLOYAN LETTER SLOAN J;Lo;0;L;;;;;N;;;;; +1BC16;DUPLOYAN LETTER HL;Lo;0;L;;;;;N;;;;; +1BC17;DUPLOYAN LETTER LH;Lo;0;L;;;;;N;;;;; +1BC18;DUPLOYAN LETTER RH;Lo;0;L;;;;;N;;;;; +1BC19;DUPLOYAN LETTER M;Lo;0;L;;;;;N;;;;; +1BC1A;DUPLOYAN LETTER N;Lo;0;L;;;;;N;;;;; +1BC1B;DUPLOYAN LETTER J;Lo;0;L;;;;;N;;;;; +1BC1C;DUPLOYAN LETTER S;Lo;0;L;;;;;N;;;;; +1BC1D;DUPLOYAN LETTER M N;Lo;0;L;;;;;N;;;;; +1BC1E;DUPLOYAN LETTER N M;Lo;0;L;;;;;N;;;;; +1BC1F;DUPLOYAN LETTER J M;Lo;0;L;;;;;N;;;;; +1BC20;DUPLOYAN LETTER S J;Lo;0;L;;;;;N;;;;; +1BC21;DUPLOYAN LETTER M WITH DOT;Lo;0;L;;;;;N;;;;; +1BC22;DUPLOYAN LETTER N WITH DOT;Lo;0;L;;;;;N;;;;; +1BC23;DUPLOYAN LETTER J WITH DOT;Lo;0;L;;;;;N;;;;; +1BC24;DUPLOYAN LETTER J WITH DOTS INSIDE AND ABOVE;Lo;0;L;;;;;N;;;;; +1BC25;DUPLOYAN LETTER S WITH DOT;Lo;0;L;;;;;N;;;;; +1BC26;DUPLOYAN LETTER S WITH DOT BELOW;Lo;0;L;;;;;N;;;;; +1BC27;DUPLOYAN LETTER M S;Lo;0;L;;;;;N;;;;; +1BC28;DUPLOYAN LETTER N S;Lo;0;L;;;;;N;;;;; +1BC29;DUPLOYAN LETTER J S;Lo;0;L;;;;;N;;;;; +1BC2A;DUPLOYAN LETTER S S;Lo;0;L;;;;;N;;;;; +1BC2B;DUPLOYAN LETTER M N S;Lo;0;L;;;;;N;;;;; +1BC2C;DUPLOYAN LETTER N M S;Lo;0;L;;;;;N;;;;; +1BC2D;DUPLOYAN LETTER J M S;Lo;0;L;;;;;N;;;;; +1BC2E;DUPLOYAN LETTER S J S;Lo;0;L;;;;;N;;;;; +1BC2F;DUPLOYAN LETTER J S WITH DOT;Lo;0;L;;;;;N;;;;; +1BC30;DUPLOYAN LETTER J N;Lo;0;L;;;;;N;;;;; +1BC31;DUPLOYAN LETTER J N S;Lo;0;L;;;;;N;;;;; +1BC32;DUPLOYAN LETTER S T;Lo;0;L;;;;;N;;;;; +1BC33;DUPLOYAN LETTER S T R;Lo;0;L;;;;;N;;;;; +1BC34;DUPLOYAN LETTER S P;Lo;0;L;;;;;N;;;;; +1BC35;DUPLOYAN LETTER S P R;Lo;0;L;;;;;N;;;;; +1BC36;DUPLOYAN LETTER T S;Lo;0;L;;;;;N;;;;; +1BC37;DUPLOYAN LETTER T R S;Lo;0;L;;;;;N;;;;; +1BC38;DUPLOYAN LETTER W;Lo;0;L;;;;;N;;;;; +1BC39;DUPLOYAN LETTER WH;Lo;0;L;;;;;N;;;;; +1BC3A;DUPLOYAN LETTER W R;Lo;0;L;;;;;N;;;;; +1BC3B;DUPLOYAN LETTER S N;Lo;0;L;;;;;N;;;;; +1BC3C;DUPLOYAN LETTER S M;Lo;0;L;;;;;N;;;;; +1BC3D;DUPLOYAN LETTER K R S;Lo;0;L;;;;;N;;;;; +1BC3E;DUPLOYAN LETTER G R S;Lo;0;L;;;;;N;;;;; +1BC3F;DUPLOYAN LETTER S K;Lo;0;L;;;;;N;;;;; +1BC40;DUPLOYAN LETTER S K R;Lo;0;L;;;;;N;;;;; +1BC41;DUPLOYAN LETTER A;Lo;0;L;;;;;N;;;;; +1BC42;DUPLOYAN LETTER SLOAN OW;Lo;0;L;;;;;N;;;;; +1BC43;DUPLOYAN LETTER OA;Lo;0;L;;;;;N;;;;; +1BC44;DUPLOYAN LETTER O;Lo;0;L;;;;;N;;;;; +1BC45;DUPLOYAN LETTER AOU;Lo;0;L;;;;;N;;;;; +1BC46;DUPLOYAN LETTER I;Lo;0;L;;;;;N;;;;; +1BC47;DUPLOYAN LETTER E;Lo;0;L;;;;;N;;;;; +1BC48;DUPLOYAN LETTER IE;Lo;0;L;;;;;N;;;;; +1BC49;DUPLOYAN LETTER SHORT I;Lo;0;L;;;;;N;;;;; +1BC4A;DUPLOYAN LETTER UI;Lo;0;L;;;;;N;;;;; +1BC4B;DUPLOYAN LETTER EE;Lo;0;L;;;;;N;;;;; +1BC4C;DUPLOYAN LETTER SLOAN EH;Lo;0;L;;;;;N;;;;; +1BC4D;DUPLOYAN LETTER ROMANIAN I;Lo;0;L;;;;;N;;;;; +1BC4E;DUPLOYAN LETTER SLOAN EE;Lo;0;L;;;;;N;;;;; +1BC4F;DUPLOYAN LETTER LONG I;Lo;0;L;;;;;N;;;;; +1BC50;DUPLOYAN LETTER YE;Lo;0;L;;;;;N;;;;; +1BC51;DUPLOYAN LETTER U;Lo;0;L;;;;;N;;;;; +1BC52;DUPLOYAN LETTER EU;Lo;0;L;;;;;N;;;;; +1BC53;DUPLOYAN LETTER XW;Lo;0;L;;;;;N;;;;; +1BC54;DUPLOYAN LETTER U N;Lo;0;L;;;;;N;;;;; +1BC55;DUPLOYAN LETTER LONG U;Lo;0;L;;;;;N;;;;; +1BC56;DUPLOYAN LETTER ROMANIAN U;Lo;0;L;;;;;N;;;;; +1BC57;DUPLOYAN LETTER UH;Lo;0;L;;;;;N;;;;; +1BC58;DUPLOYAN LETTER SLOAN U;Lo;0;L;;;;;N;;;;; +1BC59;DUPLOYAN LETTER OOH;Lo;0;L;;;;;N;;;;; +1BC5A;DUPLOYAN LETTER OW;Lo;0;L;;;;;N;;;;; +1BC5B;DUPLOYAN LETTER OU;Lo;0;L;;;;;N;;;;; +1BC5C;DUPLOYAN LETTER WA;Lo;0;L;;;;;N;;;;; +1BC5D;DUPLOYAN LETTER WO;Lo;0;L;;;;;N;;;;; +1BC5E;DUPLOYAN LETTER WI;Lo;0;L;;;;;N;;;;; +1BC5F;DUPLOYAN LETTER WEI;Lo;0;L;;;;;N;;;;; +1BC60;DUPLOYAN LETTER WOW;Lo;0;L;;;;;N;;;;; +1BC61;DUPLOYAN LETTER NASAL U;Lo;0;L;;;;;N;;;;; +1BC62;DUPLOYAN LETTER NASAL O;Lo;0;L;;;;;N;;;;; +1BC63;DUPLOYAN LETTER NASAL I;Lo;0;L;;;;;N;;;;; +1BC64;DUPLOYAN LETTER NASAL A;Lo;0;L;;;;;N;;;;; +1BC65;DUPLOYAN LETTER PERNIN AN;Lo;0;L;;;;;N;;;;; +1BC66;DUPLOYAN LETTER PERNIN AM;Lo;0;L;;;;;N;;;;; +1BC67;DUPLOYAN LETTER SLOAN EN;Lo;0;L;;;;;N;;;;; +1BC68;DUPLOYAN LETTER SLOAN AN;Lo;0;L;;;;;N;;;;; +1BC69;DUPLOYAN LETTER SLOAN ON;Lo;0;L;;;;;N;;;;; +1BC6A;DUPLOYAN LETTER VOCALIC M;Lo;0;L;;;;;N;;;;; +1BC70;DUPLOYAN AFFIX LEFT HORIZONTAL SECANT;Lo;0;L;;;;;N;;;;; +1BC71;DUPLOYAN AFFIX MID HORIZONTAL SECANT;Lo;0;L;;;;;N;;;;; +1BC72;DUPLOYAN AFFIX RIGHT HORIZONTAL SECANT;Lo;0;L;;;;;N;;;;; +1BC73;DUPLOYAN AFFIX LOW VERTICAL SECANT;Lo;0;L;;;;;N;;;;; +1BC74;DUPLOYAN AFFIX MID VERTICAL SECANT;Lo;0;L;;;;;N;;;;; +1BC75;DUPLOYAN AFFIX HIGH VERTICAL SECANT;Lo;0;L;;;;;N;;;;; +1BC76;DUPLOYAN AFFIX ATTACHED SECANT;Lo;0;L;;;;;N;;;;; +1BC77;DUPLOYAN AFFIX ATTACHED LEFT-TO-RIGHT SECANT;Lo;0;L;;;;;N;;;;; +1BC78;DUPLOYAN AFFIX ATTACHED TANGENT;Lo;0;L;;;;;N;;;;; +1BC79;DUPLOYAN AFFIX ATTACHED TAIL;Lo;0;L;;;;;N;;;;; +1BC7A;DUPLOYAN AFFIX ATTACHED E HOOK;Lo;0;L;;;;;N;;;;; +1BC7B;DUPLOYAN AFFIX ATTACHED I HOOK;Lo;0;L;;;;;N;;;;; +1BC7C;DUPLOYAN AFFIX ATTACHED TANGENT HOOK;Lo;0;L;;;;;N;;;;; +1BC80;DUPLOYAN AFFIX HIGH ACUTE;Lo;0;L;;;;;N;;;;; +1BC81;DUPLOYAN AFFIX HIGH TIGHT ACUTE;Lo;0;L;;;;;N;;;;; +1BC82;DUPLOYAN AFFIX HIGH GRAVE;Lo;0;L;;;;;N;;;;; +1BC83;DUPLOYAN AFFIX HIGH LONG GRAVE;Lo;0;L;;;;;N;;;;; +1BC84;DUPLOYAN AFFIX HIGH DOT;Lo;0;L;;;;;N;;;;; +1BC85;DUPLOYAN AFFIX HIGH CIRCLE;Lo;0;L;;;;;N;;;;; +1BC86;DUPLOYAN AFFIX HIGH LINE;Lo;0;L;;;;;N;;;;; +1BC87;DUPLOYAN AFFIX HIGH WAVE;Lo;0;L;;;;;N;;;;; +1BC88;DUPLOYAN AFFIX HIGH VERTICAL;Lo;0;L;;;;;N;;;;; +1BC90;DUPLOYAN AFFIX LOW ACUTE;Lo;0;L;;;;;N;;;;; +1BC91;DUPLOYAN AFFIX LOW TIGHT ACUTE;Lo;0;L;;;;;N;;;;; +1BC92;DUPLOYAN AFFIX LOW GRAVE;Lo;0;L;;;;;N;;;;; +1BC93;DUPLOYAN AFFIX LOW LONG GRAVE;Lo;0;L;;;;;N;;;;; +1BC94;DUPLOYAN AFFIX LOW DOT;Lo;0;L;;;;;N;;;;; +1BC95;DUPLOYAN AFFIX LOW CIRCLE;Lo;0;L;;;;;N;;;;; +1BC96;DUPLOYAN AFFIX LOW LINE;Lo;0;L;;;;;N;;;;; +1BC97;DUPLOYAN AFFIX LOW WAVE;Lo;0;L;;;;;N;;;;; +1BC98;DUPLOYAN AFFIX LOW VERTICAL;Lo;0;L;;;;;N;;;;; +1BC99;DUPLOYAN AFFIX LOW ARROW;Lo;0;L;;;;;N;;;;; +1BC9C;DUPLOYAN SIGN O WITH CROSS;So;0;L;;;;;N;;;;; +1BC9D;DUPLOYAN THICK LETTER SELECTOR;Mn;0;NSM;;;;;N;;;;; +1BC9E;DUPLOYAN DOUBLE MARK;Mn;1;NSM;;;;;N;;;;; +1BC9F;DUPLOYAN PUNCTUATION CHINOOK FULL STOP;Po;0;L;;;;;N;;;;; +1BCA0;SHORTHAND FORMAT LETTER OVERLAP;Cf;0;BN;;;;;N;;;;; +1BCA1;SHORTHAND FORMAT CONTINUING OVERLAP;Cf;0;BN;;;;;N;;;;; +1BCA2;SHORTHAND FORMAT DOWN STEP;Cf;0;BN;;;;;N;;;;; +1BCA3;SHORTHAND FORMAT UP STEP;Cf;0;BN;;;;;N;;;;; +1D000;BYZANTINE MUSICAL SYMBOL PSILI;So;0;L;;;;;N;;;;; +1D001;BYZANTINE MUSICAL SYMBOL DASEIA;So;0;L;;;;;N;;;;; +1D002;BYZANTINE MUSICAL SYMBOL PERISPOMENI;So;0;L;;;;;N;;;;; +1D003;BYZANTINE MUSICAL SYMBOL OXEIA EKFONITIKON;So;0;L;;;;;N;;;;; +1D004;BYZANTINE MUSICAL SYMBOL OXEIA DIPLI;So;0;L;;;;;N;;;;; +1D005;BYZANTINE MUSICAL SYMBOL VAREIA EKFONITIKON;So;0;L;;;;;N;;;;; +1D006;BYZANTINE MUSICAL SYMBOL VAREIA DIPLI;So;0;L;;;;;N;;;;; +1D007;BYZANTINE MUSICAL SYMBOL KATHISTI;So;0;L;;;;;N;;;;; +1D008;BYZANTINE MUSICAL SYMBOL SYRMATIKI;So;0;L;;;;;N;;;;; +1D009;BYZANTINE MUSICAL SYMBOL PARAKLITIKI;So;0;L;;;;;N;;;;; +1D00A;BYZANTINE MUSICAL SYMBOL YPOKRISIS;So;0;L;;;;;N;;;;; +1D00B;BYZANTINE MUSICAL SYMBOL YPOKRISIS DIPLI;So;0;L;;;;;N;;;;; +1D00C;BYZANTINE MUSICAL SYMBOL KREMASTI;So;0;L;;;;;N;;;;; +1D00D;BYZANTINE MUSICAL SYMBOL APESO EKFONITIKON;So;0;L;;;;;N;;;;; +1D00E;BYZANTINE MUSICAL SYMBOL EXO EKFONITIKON;So;0;L;;;;;N;;;;; +1D00F;BYZANTINE MUSICAL SYMBOL TELEIA;So;0;L;;;;;N;;;;; +1D010;BYZANTINE MUSICAL SYMBOL KENTIMATA;So;0;L;;;;;N;;;;; +1D011;BYZANTINE MUSICAL SYMBOL APOSTROFOS;So;0;L;;;;;N;;;;; +1D012;BYZANTINE MUSICAL SYMBOL APOSTROFOS DIPLI;So;0;L;;;;;N;;;;; +1D013;BYZANTINE MUSICAL SYMBOL SYNEVMA;So;0;L;;;;;N;;;;; +1D014;BYZANTINE MUSICAL SYMBOL THITA;So;0;L;;;;;N;;;;; +1D015;BYZANTINE MUSICAL SYMBOL OLIGON ARCHAION;So;0;L;;;;;N;;;;; +1D016;BYZANTINE MUSICAL SYMBOL GORGON ARCHAION;So;0;L;;;;;N;;;;; +1D017;BYZANTINE MUSICAL SYMBOL PSILON;So;0;L;;;;;N;;;;; +1D018;BYZANTINE MUSICAL SYMBOL CHAMILON;So;0;L;;;;;N;;;;; +1D019;BYZANTINE MUSICAL SYMBOL VATHY;So;0;L;;;;;N;;;;; +1D01A;BYZANTINE MUSICAL SYMBOL ISON ARCHAION;So;0;L;;;;;N;;;;; +1D01B;BYZANTINE MUSICAL SYMBOL KENTIMA ARCHAION;So;0;L;;;;;N;;;;; +1D01C;BYZANTINE MUSICAL SYMBOL KENTIMATA ARCHAION;So;0;L;;;;;N;;;;; +1D01D;BYZANTINE MUSICAL SYMBOL SAXIMATA;So;0;L;;;;;N;;;;; +1D01E;BYZANTINE MUSICAL SYMBOL PARICHON;So;0;L;;;;;N;;;;; +1D01F;BYZANTINE MUSICAL SYMBOL STAVROS APODEXIA;So;0;L;;;;;N;;;;; +1D020;BYZANTINE MUSICAL SYMBOL OXEIAI ARCHAION;So;0;L;;;;;N;;;;; +1D021;BYZANTINE MUSICAL SYMBOL VAREIAI ARCHAION;So;0;L;;;;;N;;;;; +1D022;BYZANTINE MUSICAL SYMBOL APODERMA ARCHAION;So;0;L;;;;;N;;;;; +1D023;BYZANTINE MUSICAL SYMBOL APOTHEMA;So;0;L;;;;;N;;;;; +1D024;BYZANTINE MUSICAL SYMBOL KLASMA;So;0;L;;;;;N;;;;; +1D025;BYZANTINE MUSICAL SYMBOL REVMA;So;0;L;;;;;N;;;;; +1D026;BYZANTINE MUSICAL SYMBOL PIASMA ARCHAION;So;0;L;;;;;N;;;;; +1D027;BYZANTINE MUSICAL SYMBOL TINAGMA;So;0;L;;;;;N;;;;; +1D028;BYZANTINE MUSICAL SYMBOL ANATRICHISMA;So;0;L;;;;;N;;;;; +1D029;BYZANTINE MUSICAL SYMBOL SEISMA;So;0;L;;;;;N;;;;; +1D02A;BYZANTINE MUSICAL SYMBOL SYNAGMA ARCHAION;So;0;L;;;;;N;;;;; +1D02B;BYZANTINE MUSICAL SYMBOL SYNAGMA META STAVROU;So;0;L;;;;;N;;;;; +1D02C;BYZANTINE MUSICAL SYMBOL OYRANISMA ARCHAION;So;0;L;;;;;N;;;;; +1D02D;BYZANTINE MUSICAL SYMBOL THEMA;So;0;L;;;;;N;;;;; +1D02E;BYZANTINE MUSICAL SYMBOL LEMOI;So;0;L;;;;;N;;;;; +1D02F;BYZANTINE MUSICAL SYMBOL DYO;So;0;L;;;;;N;;;;; +1D030;BYZANTINE MUSICAL SYMBOL TRIA;So;0;L;;;;;N;;;;; +1D031;BYZANTINE MUSICAL SYMBOL TESSERA;So;0;L;;;;;N;;;;; +1D032;BYZANTINE MUSICAL SYMBOL KRATIMATA;So;0;L;;;;;N;;;;; +1D033;BYZANTINE MUSICAL SYMBOL APESO EXO NEO;So;0;L;;;;;N;;;;; +1D034;BYZANTINE MUSICAL SYMBOL FTHORA ARCHAION;So;0;L;;;;;N;;;;; +1D035;BYZANTINE MUSICAL SYMBOL IMIFTHORA;So;0;L;;;;;N;;;;; +1D036;BYZANTINE MUSICAL SYMBOL TROMIKON ARCHAION;So;0;L;;;;;N;;;;; +1D037;BYZANTINE MUSICAL SYMBOL KATAVA TROMIKON;So;0;L;;;;;N;;;;; +1D038;BYZANTINE MUSICAL SYMBOL PELASTON;So;0;L;;;;;N;;;;; +1D039;BYZANTINE MUSICAL SYMBOL PSIFISTON;So;0;L;;;;;N;;;;; +1D03A;BYZANTINE MUSICAL SYMBOL KONTEVMA;So;0;L;;;;;N;;;;; +1D03B;BYZANTINE MUSICAL SYMBOL CHOREVMA ARCHAION;So;0;L;;;;;N;;;;; +1D03C;BYZANTINE MUSICAL SYMBOL RAPISMA;So;0;L;;;;;N;;;;; +1D03D;BYZANTINE MUSICAL SYMBOL PARAKALESMA ARCHAION;So;0;L;;;;;N;;;;; +1D03E;BYZANTINE MUSICAL SYMBOL PARAKLITIKI ARCHAION;So;0;L;;;;;N;;;;; +1D03F;BYZANTINE MUSICAL SYMBOL ICHADIN;So;0;L;;;;;N;;;;; +1D040;BYZANTINE MUSICAL SYMBOL NANA;So;0;L;;;;;N;;;;; +1D041;BYZANTINE MUSICAL SYMBOL PETASMA;So;0;L;;;;;N;;;;; +1D042;BYZANTINE MUSICAL SYMBOL KONTEVMA ALLO;So;0;L;;;;;N;;;;; +1D043;BYZANTINE MUSICAL SYMBOL TROMIKON ALLO;So;0;L;;;;;N;;;;; +1D044;BYZANTINE MUSICAL SYMBOL STRAGGISMATA;So;0;L;;;;;N;;;;; +1D045;BYZANTINE MUSICAL SYMBOL GRONTHISMATA;So;0;L;;;;;N;;;;; +1D046;BYZANTINE MUSICAL SYMBOL ISON NEO;So;0;L;;;;;N;;;;; +1D047;BYZANTINE MUSICAL SYMBOL OLIGON NEO;So;0;L;;;;;N;;;;; +1D048;BYZANTINE MUSICAL SYMBOL OXEIA NEO;So;0;L;;;;;N;;;;; +1D049;BYZANTINE MUSICAL SYMBOL PETASTI;So;0;L;;;;;N;;;;; +1D04A;BYZANTINE MUSICAL SYMBOL KOUFISMA;So;0;L;;;;;N;;;;; +1D04B;BYZANTINE MUSICAL SYMBOL PETASTOKOUFISMA;So;0;L;;;;;N;;;;; +1D04C;BYZANTINE MUSICAL SYMBOL KRATIMOKOUFISMA;So;0;L;;;;;N;;;;; +1D04D;BYZANTINE MUSICAL SYMBOL PELASTON NEO;So;0;L;;;;;N;;;;; +1D04E;BYZANTINE MUSICAL SYMBOL KENTIMATA NEO ANO;So;0;L;;;;;N;;;;; +1D04F;BYZANTINE MUSICAL SYMBOL KENTIMA NEO ANO;So;0;L;;;;;N;;;;; +1D050;BYZANTINE MUSICAL SYMBOL YPSILI;So;0;L;;;;;N;;;;; +1D051;BYZANTINE MUSICAL SYMBOL APOSTROFOS NEO;So;0;L;;;;;N;;;;; +1D052;BYZANTINE MUSICAL SYMBOL APOSTROFOI SYNDESMOS NEO;So;0;L;;;;;N;;;;; +1D053;BYZANTINE MUSICAL SYMBOL YPORROI;So;0;L;;;;;N;;;;; +1D054;BYZANTINE MUSICAL SYMBOL KRATIMOYPORROON;So;0;L;;;;;N;;;;; +1D055;BYZANTINE MUSICAL SYMBOL ELAFRON;So;0;L;;;;;N;;;;; +1D056;BYZANTINE MUSICAL SYMBOL CHAMILI;So;0;L;;;;;N;;;;; +1D057;BYZANTINE MUSICAL SYMBOL MIKRON ISON;So;0;L;;;;;N;;;;; +1D058;BYZANTINE MUSICAL SYMBOL VAREIA NEO;So;0;L;;;;;N;;;;; +1D059;BYZANTINE MUSICAL SYMBOL PIASMA NEO;So;0;L;;;;;N;;;;; +1D05A;BYZANTINE MUSICAL SYMBOL PSIFISTON NEO;So;0;L;;;;;N;;;;; +1D05B;BYZANTINE MUSICAL SYMBOL OMALON;So;0;L;;;;;N;;;;; +1D05C;BYZANTINE MUSICAL SYMBOL ANTIKENOMA;So;0;L;;;;;N;;;;; +1D05D;BYZANTINE MUSICAL SYMBOL LYGISMA;So;0;L;;;;;N;;;;; +1D05E;BYZANTINE MUSICAL SYMBOL PARAKLITIKI NEO;So;0;L;;;;;N;;;;; +1D05F;BYZANTINE MUSICAL SYMBOL PARAKALESMA NEO;So;0;L;;;;;N;;;;; +1D060;BYZANTINE MUSICAL SYMBOL ETERON PARAKALESMA;So;0;L;;;;;N;;;;; +1D061;BYZANTINE MUSICAL SYMBOL KYLISMA;So;0;L;;;;;N;;;;; +1D062;BYZANTINE MUSICAL SYMBOL ANTIKENOKYLISMA;So;0;L;;;;;N;;;;; +1D063;BYZANTINE MUSICAL SYMBOL TROMIKON NEO;So;0;L;;;;;N;;;;; +1D064;BYZANTINE MUSICAL SYMBOL EKSTREPTON;So;0;L;;;;;N;;;;; +1D065;BYZANTINE MUSICAL SYMBOL SYNAGMA NEO;So;0;L;;;;;N;;;;; +1D066;BYZANTINE MUSICAL SYMBOL SYRMA;So;0;L;;;;;N;;;;; +1D067;BYZANTINE MUSICAL SYMBOL CHOREVMA NEO;So;0;L;;;;;N;;;;; +1D068;BYZANTINE MUSICAL SYMBOL EPEGERMA;So;0;L;;;;;N;;;;; +1D069;BYZANTINE MUSICAL SYMBOL SEISMA NEO;So;0;L;;;;;N;;;;; +1D06A;BYZANTINE MUSICAL SYMBOL XIRON KLASMA;So;0;L;;;;;N;;;;; +1D06B;BYZANTINE MUSICAL SYMBOL TROMIKOPSIFISTON;So;0;L;;;;;N;;;;; +1D06C;BYZANTINE MUSICAL SYMBOL PSIFISTOLYGISMA;So;0;L;;;;;N;;;;; +1D06D;BYZANTINE MUSICAL SYMBOL TROMIKOLYGISMA;So;0;L;;;;;N;;;;; +1D06E;BYZANTINE MUSICAL SYMBOL TROMIKOPARAKALESMA;So;0;L;;;;;N;;;;; +1D06F;BYZANTINE MUSICAL SYMBOL PSIFISTOPARAKALESMA;So;0;L;;;;;N;;;;; +1D070;BYZANTINE MUSICAL SYMBOL TROMIKOSYNAGMA;So;0;L;;;;;N;;;;; +1D071;BYZANTINE MUSICAL SYMBOL PSIFISTOSYNAGMA;So;0;L;;;;;N;;;;; +1D072;BYZANTINE MUSICAL SYMBOL GORGOSYNTHETON;So;0;L;;;;;N;;;;; +1D073;BYZANTINE MUSICAL SYMBOL ARGOSYNTHETON;So;0;L;;;;;N;;;;; +1D074;BYZANTINE MUSICAL SYMBOL ETERON ARGOSYNTHETON;So;0;L;;;;;N;;;;; +1D075;BYZANTINE MUSICAL SYMBOL OYRANISMA NEO;So;0;L;;;;;N;;;;; +1D076;BYZANTINE MUSICAL SYMBOL THEMATISMOS ESO;So;0;L;;;;;N;;;;; +1D077;BYZANTINE MUSICAL SYMBOL THEMATISMOS EXO;So;0;L;;;;;N;;;;; +1D078;BYZANTINE MUSICAL SYMBOL THEMA APLOUN;So;0;L;;;;;N;;;;; +1D079;BYZANTINE MUSICAL SYMBOL THES KAI APOTHES;So;0;L;;;;;N;;;;; +1D07A;BYZANTINE MUSICAL SYMBOL KATAVASMA;So;0;L;;;;;N;;;;; +1D07B;BYZANTINE MUSICAL SYMBOL ENDOFONON;So;0;L;;;;;N;;;;; +1D07C;BYZANTINE MUSICAL SYMBOL YFEN KATO;So;0;L;;;;;N;;;;; +1D07D;BYZANTINE MUSICAL SYMBOL YFEN ANO;So;0;L;;;;;N;;;;; +1D07E;BYZANTINE MUSICAL SYMBOL STAVROS;So;0;L;;;;;N;;;;; +1D07F;BYZANTINE MUSICAL SYMBOL KLASMA ANO;So;0;L;;;;;N;;;;; +1D080;BYZANTINE MUSICAL SYMBOL DIPLI ARCHAION;So;0;L;;;;;N;;;;; +1D081;BYZANTINE MUSICAL SYMBOL KRATIMA ARCHAION;So;0;L;;;;;N;;;;; +1D082;BYZANTINE MUSICAL SYMBOL KRATIMA ALLO;So;0;L;;;;;N;;;;; +1D083;BYZANTINE MUSICAL SYMBOL KRATIMA NEO;So;0;L;;;;;N;;;;; +1D084;BYZANTINE MUSICAL SYMBOL APODERMA NEO;So;0;L;;;;;N;;;;; +1D085;BYZANTINE MUSICAL SYMBOL APLI;So;0;L;;;;;N;;;;; +1D086;BYZANTINE MUSICAL SYMBOL DIPLI;So;0;L;;;;;N;;;;; +1D087;BYZANTINE MUSICAL SYMBOL TRIPLI;So;0;L;;;;;N;;;;; +1D088;BYZANTINE MUSICAL SYMBOL TETRAPLI;So;0;L;;;;;N;;;;; +1D089;BYZANTINE MUSICAL SYMBOL KORONIS;So;0;L;;;;;N;;;;; +1D08A;BYZANTINE MUSICAL SYMBOL LEIMMA ENOS CHRONOU;So;0;L;;;;;N;;;;; +1D08B;BYZANTINE MUSICAL SYMBOL LEIMMA DYO CHRONON;So;0;L;;;;;N;;;;; +1D08C;BYZANTINE MUSICAL SYMBOL LEIMMA TRION CHRONON;So;0;L;;;;;N;;;;; +1D08D;BYZANTINE MUSICAL SYMBOL LEIMMA TESSARON CHRONON;So;0;L;;;;;N;;;;; +1D08E;BYZANTINE MUSICAL SYMBOL LEIMMA IMISEOS CHRONOU;So;0;L;;;;;N;;;;; +1D08F;BYZANTINE MUSICAL SYMBOL GORGON NEO ANO;So;0;L;;;;;N;;;;; +1D090;BYZANTINE MUSICAL SYMBOL GORGON PARESTIGMENON ARISTERA;So;0;L;;;;;N;;;;; +1D091;BYZANTINE MUSICAL SYMBOL GORGON PARESTIGMENON DEXIA;So;0;L;;;;;N;;;;; +1D092;BYZANTINE MUSICAL SYMBOL DIGORGON;So;0;L;;;;;N;;;;; +1D093;BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON ARISTERA KATO;So;0;L;;;;;N;;;;; +1D094;BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON ARISTERA ANO;So;0;L;;;;;N;;;;; +1D095;BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON DEXIA;So;0;L;;;;;N;;;;; +1D096;BYZANTINE MUSICAL SYMBOL TRIGORGON;So;0;L;;;;;N;;;;; +1D097;BYZANTINE MUSICAL SYMBOL ARGON;So;0;L;;;;;N;;;;; +1D098;BYZANTINE MUSICAL SYMBOL IMIDIARGON;So;0;L;;;;;N;;;;; +1D099;BYZANTINE MUSICAL SYMBOL DIARGON;So;0;L;;;;;N;;;;; +1D09A;BYZANTINE MUSICAL SYMBOL AGOGI POLI ARGI;So;0;L;;;;;N;;;;; +1D09B;BYZANTINE MUSICAL SYMBOL AGOGI ARGOTERI;So;0;L;;;;;N;;;;; +1D09C;BYZANTINE MUSICAL SYMBOL AGOGI ARGI;So;0;L;;;;;N;;;;; +1D09D;BYZANTINE MUSICAL SYMBOL AGOGI METRIA;So;0;L;;;;;N;;;;; +1D09E;BYZANTINE MUSICAL SYMBOL AGOGI MESI;So;0;L;;;;;N;;;;; +1D09F;BYZANTINE MUSICAL SYMBOL AGOGI GORGI;So;0;L;;;;;N;;;;; +1D0A0;BYZANTINE MUSICAL SYMBOL AGOGI GORGOTERI;So;0;L;;;;;N;;;;; +1D0A1;BYZANTINE MUSICAL SYMBOL AGOGI POLI GORGI;So;0;L;;;;;N;;;;; +1D0A2;BYZANTINE MUSICAL SYMBOL MARTYRIA PROTOS ICHOS;So;0;L;;;;;N;;;;; +1D0A3;BYZANTINE MUSICAL SYMBOL MARTYRIA ALLI PROTOS ICHOS;So;0;L;;;;;N;;;;; +1D0A4;BYZANTINE MUSICAL SYMBOL MARTYRIA DEYTEROS ICHOS;So;0;L;;;;;N;;;;; +1D0A5;BYZANTINE MUSICAL SYMBOL MARTYRIA ALLI DEYTEROS ICHOS;So;0;L;;;;;N;;;;; +1D0A6;BYZANTINE MUSICAL SYMBOL MARTYRIA TRITOS ICHOS;So;0;L;;;;;N;;;;; +1D0A7;BYZANTINE MUSICAL SYMBOL MARTYRIA TRIFONIAS;So;0;L;;;;;N;;;;; +1D0A8;BYZANTINE MUSICAL SYMBOL MARTYRIA TETARTOS ICHOS;So;0;L;;;;;N;;;;; +1D0A9;BYZANTINE MUSICAL SYMBOL MARTYRIA TETARTOS LEGETOS ICHOS;So;0;L;;;;;N;;;;; +1D0AA;BYZANTINE MUSICAL SYMBOL MARTYRIA LEGETOS ICHOS;So;0;L;;;;;N;;;;; +1D0AB;BYZANTINE MUSICAL SYMBOL MARTYRIA PLAGIOS ICHOS;So;0;L;;;;;N;;;;; +1D0AC;BYZANTINE MUSICAL SYMBOL ISAKIA TELOUS ICHIMATOS;So;0;L;;;;;N;;;;; +1D0AD;BYZANTINE MUSICAL SYMBOL APOSTROFOI TELOUS ICHIMATOS;So;0;L;;;;;N;;;;; +1D0AE;BYZANTINE MUSICAL SYMBOL FANEROSIS TETRAFONIAS;So;0;L;;;;;N;;;;; +1D0AF;BYZANTINE MUSICAL SYMBOL FANEROSIS MONOFONIAS;So;0;L;;;;;N;;;;; +1D0B0;BYZANTINE MUSICAL SYMBOL FANEROSIS DIFONIAS;So;0;L;;;;;N;;;;; +1D0B1;BYZANTINE MUSICAL SYMBOL MARTYRIA VARYS ICHOS;So;0;L;;;;;N;;;;; +1D0B2;BYZANTINE MUSICAL SYMBOL MARTYRIA PROTOVARYS ICHOS;So;0;L;;;;;N;;;;; +1D0B3;BYZANTINE MUSICAL SYMBOL MARTYRIA PLAGIOS TETARTOS ICHOS;So;0;L;;;;;N;;;;; +1D0B4;BYZANTINE MUSICAL SYMBOL GORTHMIKON N APLOUN;So;0;L;;;;;N;;;;; +1D0B5;BYZANTINE MUSICAL SYMBOL GORTHMIKON N DIPLOUN;So;0;L;;;;;N;;;;; +1D0B6;BYZANTINE MUSICAL SYMBOL ENARXIS KAI FTHORA VOU;So;0;L;;;;;N;;;;; +1D0B7;BYZANTINE MUSICAL SYMBOL IMIFONON;So;0;L;;;;;N;;;;; +1D0B8;BYZANTINE MUSICAL SYMBOL IMIFTHORON;So;0;L;;;;;N;;;;; +1D0B9;BYZANTINE MUSICAL SYMBOL FTHORA ARCHAION DEYTEROU ICHOU;So;0;L;;;;;N;;;;; +1D0BA;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI PA;So;0;L;;;;;N;;;;; +1D0BB;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NANA;So;0;L;;;;;N;;;;; +1D0BC;BYZANTINE MUSICAL SYMBOL FTHORA NAOS ICHOS;So;0;L;;;;;N;;;;; +1D0BD;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI DI;So;0;L;;;;;N;;;;; +1D0BE;BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON DIATONON DI;So;0;L;;;;;N;;;;; +1D0BF;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI KE;So;0;L;;;;;N;;;;; +1D0C0;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI ZO;So;0;L;;;;;N;;;;; +1D0C1;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NI KATO;So;0;L;;;;;N;;;;; +1D0C2;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NI ANO;So;0;L;;;;;N;;;;; +1D0C3;BYZANTINE MUSICAL SYMBOL FTHORA MALAKON CHROMA DIFONIAS;So;0;L;;;;;N;;;;; +1D0C4;BYZANTINE MUSICAL SYMBOL FTHORA MALAKON CHROMA MONOFONIAS;So;0;L;;;;;N;;;;; +1D0C5;BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS;So;0;L;;;;;N;;;;; +1D0C6;BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA SYNAFI;So;0;L;;;;;N;;;;; +1D0C7;BYZANTINE MUSICAL SYMBOL FTHORA NENANO;So;0;L;;;;;N;;;;; +1D0C8;BYZANTINE MUSICAL SYMBOL CHROA ZYGOS;So;0;L;;;;;N;;;;; +1D0C9;BYZANTINE MUSICAL SYMBOL CHROA KLITON;So;0;L;;;;;N;;;;; +1D0CA;BYZANTINE MUSICAL SYMBOL CHROA SPATHI;So;0;L;;;;;N;;;;; +1D0CB;BYZANTINE MUSICAL SYMBOL FTHORA I YFESIS TETARTIMORION;So;0;L;;;;;N;;;;; +1D0CC;BYZANTINE MUSICAL SYMBOL FTHORA ENARMONIOS ANTIFONIA;So;0;L;;;;;N;;;;; +1D0CD;BYZANTINE MUSICAL SYMBOL YFESIS TRITIMORION;So;0;L;;;;;N;;;;; +1D0CE;BYZANTINE MUSICAL SYMBOL DIESIS TRITIMORION;So;0;L;;;;;N;;;;; +1D0CF;BYZANTINE MUSICAL SYMBOL DIESIS TETARTIMORION;So;0;L;;;;;N;;;;; +1D0D0;BYZANTINE MUSICAL SYMBOL DIESIS APLI DYO DODEKATA;So;0;L;;;;;N;;;;; +1D0D1;BYZANTINE MUSICAL SYMBOL DIESIS MONOGRAMMOS TESSERA DODEKATA;So;0;L;;;;;N;;;;; +1D0D2;BYZANTINE MUSICAL SYMBOL DIESIS DIGRAMMOS EX DODEKATA;So;0;L;;;;;N;;;;; +1D0D3;BYZANTINE MUSICAL SYMBOL DIESIS TRIGRAMMOS OKTO DODEKATA;So;0;L;;;;;N;;;;; +1D0D4;BYZANTINE MUSICAL SYMBOL YFESIS APLI DYO DODEKATA;So;0;L;;;;;N;;;;; +1D0D5;BYZANTINE MUSICAL SYMBOL YFESIS MONOGRAMMOS TESSERA DODEKATA;So;0;L;;;;;N;;;;; +1D0D6;BYZANTINE MUSICAL SYMBOL YFESIS DIGRAMMOS EX DODEKATA;So;0;L;;;;;N;;;;; +1D0D7;BYZANTINE MUSICAL SYMBOL YFESIS TRIGRAMMOS OKTO DODEKATA;So;0;L;;;;;N;;;;; +1D0D8;BYZANTINE MUSICAL SYMBOL GENIKI DIESIS;So;0;L;;;;;N;;;;; +1D0D9;BYZANTINE MUSICAL SYMBOL GENIKI YFESIS;So;0;L;;;;;N;;;;; +1D0DA;BYZANTINE MUSICAL SYMBOL DIASTOLI APLI MIKRI;So;0;L;;;;;N;;;;; +1D0DB;BYZANTINE MUSICAL SYMBOL DIASTOLI APLI MEGALI;So;0;L;;;;;N;;;;; +1D0DC;BYZANTINE MUSICAL SYMBOL DIASTOLI DIPLI;So;0;L;;;;;N;;;;; +1D0DD;BYZANTINE MUSICAL SYMBOL DIASTOLI THESEOS;So;0;L;;;;;N;;;;; +1D0DE;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS;So;0;L;;;;;N;;;;; +1D0DF;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS DISIMOU;So;0;L;;;;;N;;;;; +1D0E0;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS TRISIMOU;So;0;L;;;;;N;;;;; +1D0E1;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS TETRASIMOU;So;0;L;;;;;N;;;;; +1D0E2;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS;So;0;L;;;;;N;;;;; +1D0E3;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS DISIMOU;So;0;L;;;;;N;;;;; +1D0E4;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS TRISIMOU;So;0;L;;;;;N;;;;; +1D0E5;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS TETRASIMOU;So;0;L;;;;;N;;;;; +1D0E6;BYZANTINE MUSICAL SYMBOL DIGRAMMA GG;So;0;L;;;;;N;;;;; +1D0E7;BYZANTINE MUSICAL SYMBOL DIFTOGGOS OU;So;0;L;;;;;N;;;;; +1D0E8;BYZANTINE MUSICAL SYMBOL STIGMA;So;0;L;;;;;N;;;;; +1D0E9;BYZANTINE MUSICAL SYMBOL ARKTIKO PA;So;0;L;;;;;N;;;;; +1D0EA;BYZANTINE MUSICAL SYMBOL ARKTIKO VOU;So;0;L;;;;;N;;;;; +1D0EB;BYZANTINE MUSICAL SYMBOL ARKTIKO GA;So;0;L;;;;;N;;;;; +1D0EC;BYZANTINE MUSICAL SYMBOL ARKTIKO DI;So;0;L;;;;;N;;;;; +1D0ED;BYZANTINE MUSICAL SYMBOL ARKTIKO KE;So;0;L;;;;;N;;;;; +1D0EE;BYZANTINE MUSICAL SYMBOL ARKTIKO ZO;So;0;L;;;;;N;;;;; +1D0EF;BYZANTINE MUSICAL SYMBOL ARKTIKO NI;So;0;L;;;;;N;;;;; +1D0F0;BYZANTINE MUSICAL SYMBOL KENTIMATA NEO MESO;So;0;L;;;;;N;;;;; +1D0F1;BYZANTINE MUSICAL SYMBOL KENTIMA NEO MESO;So;0;L;;;;;N;;;;; +1D0F2;BYZANTINE MUSICAL SYMBOL KENTIMATA NEO KATO;So;0;L;;;;;N;;;;; +1D0F3;BYZANTINE MUSICAL SYMBOL KENTIMA NEO KATO;So;0;L;;;;;N;;;;; +1D0F4;BYZANTINE MUSICAL SYMBOL KLASMA KATO;So;0;L;;;;;N;;;;; +1D0F5;BYZANTINE MUSICAL SYMBOL GORGON NEO KATO;So;0;L;;;;;N;;;;; +1D100;MUSICAL SYMBOL SINGLE BARLINE;So;0;L;;;;;N;;;;; +1D101;MUSICAL SYMBOL DOUBLE BARLINE;So;0;L;;;;;N;;;;; +1D102;MUSICAL SYMBOL FINAL BARLINE;So;0;L;;;;;N;;;;; +1D103;MUSICAL SYMBOL REVERSE FINAL BARLINE;So;0;L;;;;;N;;;;; +1D104;MUSICAL SYMBOL DASHED BARLINE;So;0;L;;;;;N;;;;; +1D105;MUSICAL SYMBOL SHORT BARLINE;So;0;L;;;;;N;;;;; +1D106;MUSICAL SYMBOL LEFT REPEAT SIGN;So;0;L;;;;;N;;;;; +1D107;MUSICAL SYMBOL RIGHT REPEAT SIGN;So;0;L;;;;;N;;;;; +1D108;MUSICAL SYMBOL REPEAT DOTS;So;0;L;;;;;N;;;;; +1D109;MUSICAL SYMBOL DAL SEGNO;So;0;L;;;;;N;;;;; +1D10A;MUSICAL SYMBOL DA CAPO;So;0;L;;;;;N;;;;; +1D10B;MUSICAL SYMBOL SEGNO;So;0;L;;;;;N;;;;; +1D10C;MUSICAL SYMBOL CODA;So;0;L;;;;;N;;;;; +1D10D;MUSICAL SYMBOL REPEATED FIGURE-1;So;0;L;;;;;N;;;;; +1D10E;MUSICAL SYMBOL REPEATED FIGURE-2;So;0;L;;;;;N;;;;; +1D10F;MUSICAL SYMBOL REPEATED FIGURE-3;So;0;L;;;;;N;;;;; +1D110;MUSICAL SYMBOL FERMATA;So;0;L;;;;;N;;;;; +1D111;MUSICAL SYMBOL FERMATA BELOW;So;0;L;;;;;N;;;;; +1D112;MUSICAL SYMBOL BREATH MARK;So;0;L;;;;;N;;;;; +1D113;MUSICAL SYMBOL CAESURA;So;0;L;;;;;N;;;;; +1D114;MUSICAL SYMBOL BRACE;So;0;L;;;;;N;;;;; +1D115;MUSICAL SYMBOL BRACKET;So;0;L;;;;;N;;;;; +1D116;MUSICAL SYMBOL ONE-LINE STAFF;So;0;L;;;;;N;;;;; +1D117;MUSICAL SYMBOL TWO-LINE STAFF;So;0;L;;;;;N;;;;; +1D118;MUSICAL SYMBOL THREE-LINE STAFF;So;0;L;;;;;N;;;;; +1D119;MUSICAL SYMBOL FOUR-LINE STAFF;So;0;L;;;;;N;;;;; +1D11A;MUSICAL SYMBOL FIVE-LINE STAFF;So;0;L;;;;;N;;;;; +1D11B;MUSICAL SYMBOL SIX-LINE STAFF;So;0;L;;;;;N;;;;; +1D11C;MUSICAL SYMBOL SIX-STRING FRETBOARD;So;0;L;;;;;N;;;;; +1D11D;MUSICAL SYMBOL FOUR-STRING FRETBOARD;So;0;L;;;;;N;;;;; +1D11E;MUSICAL SYMBOL G CLEF;So;0;L;;;;;N;;;;; +1D11F;MUSICAL SYMBOL G CLEF OTTAVA ALTA;So;0;L;;;;;N;;;;; +1D120;MUSICAL SYMBOL G CLEF OTTAVA BASSA;So;0;L;;;;;N;;;;; +1D121;MUSICAL SYMBOL C CLEF;So;0;L;;;;;N;;;;; +1D122;MUSICAL SYMBOL F CLEF;So;0;L;;;;;N;;;;; +1D123;MUSICAL SYMBOL F CLEF OTTAVA ALTA;So;0;L;;;;;N;;;;; +1D124;MUSICAL SYMBOL F CLEF OTTAVA BASSA;So;0;L;;;;;N;;;;; +1D125;MUSICAL SYMBOL DRUM CLEF-1;So;0;L;;;;;N;;;;; +1D126;MUSICAL SYMBOL DRUM CLEF-2;So;0;L;;;;;N;;;;; +1D129;MUSICAL SYMBOL MULTIPLE MEASURE REST;So;0;L;;;;;N;;;;; +1D12A;MUSICAL SYMBOL DOUBLE SHARP;So;0;L;;;;;N;;;;; +1D12B;MUSICAL SYMBOL DOUBLE FLAT;So;0;L;;;;;N;;;;; +1D12C;MUSICAL SYMBOL FLAT UP;So;0;L;;;;;N;;;;; +1D12D;MUSICAL SYMBOL FLAT DOWN;So;0;L;;;;;N;;;;; +1D12E;MUSICAL SYMBOL NATURAL UP;So;0;L;;;;;N;;;;; +1D12F;MUSICAL SYMBOL NATURAL DOWN;So;0;L;;;;;N;;;;; +1D130;MUSICAL SYMBOL SHARP UP;So;0;L;;;;;N;;;;; +1D131;MUSICAL SYMBOL SHARP DOWN;So;0;L;;;;;N;;;;; +1D132;MUSICAL SYMBOL QUARTER TONE SHARP;So;0;L;;;;;N;;;;; +1D133;MUSICAL SYMBOL QUARTER TONE FLAT;So;0;L;;;;;N;;;;; +1D134;MUSICAL SYMBOL COMMON TIME;So;0;L;;;;;N;;;;; +1D135;MUSICAL SYMBOL CUT TIME;So;0;L;;;;;N;;;;; +1D136;MUSICAL SYMBOL OTTAVA ALTA;So;0;L;;;;;N;;;;; +1D137;MUSICAL SYMBOL OTTAVA BASSA;So;0;L;;;;;N;;;;; +1D138;MUSICAL SYMBOL QUINDICESIMA ALTA;So;0;L;;;;;N;;;;; +1D139;MUSICAL SYMBOL QUINDICESIMA BASSA;So;0;L;;;;;N;;;;; +1D13A;MUSICAL SYMBOL MULTI REST;So;0;L;;;;;N;;;;; +1D13B;MUSICAL SYMBOL WHOLE REST;So;0;L;;;;;N;;;;; +1D13C;MUSICAL SYMBOL HALF REST;So;0;L;;;;;N;;;;; +1D13D;MUSICAL SYMBOL QUARTER REST;So;0;L;;;;;N;;;;; +1D13E;MUSICAL SYMBOL EIGHTH REST;So;0;L;;;;;N;;;;; +1D13F;MUSICAL SYMBOL SIXTEENTH REST;So;0;L;;;;;N;;;;; +1D140;MUSICAL SYMBOL THIRTY-SECOND REST;So;0;L;;;;;N;;;;; +1D141;MUSICAL SYMBOL SIXTY-FOURTH REST;So;0;L;;;;;N;;;;; +1D142;MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH REST;So;0;L;;;;;N;;;;; +1D143;MUSICAL SYMBOL X NOTEHEAD;So;0;L;;;;;N;;;;; +1D144;MUSICAL SYMBOL PLUS NOTEHEAD;So;0;L;;;;;N;;;;; +1D145;MUSICAL SYMBOL CIRCLE X NOTEHEAD;So;0;L;;;;;N;;;;; +1D146;MUSICAL SYMBOL SQUARE NOTEHEAD WHITE;So;0;L;;;;;N;;;;; +1D147;MUSICAL SYMBOL SQUARE NOTEHEAD BLACK;So;0;L;;;;;N;;;;; +1D148;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP WHITE;So;0;L;;;;;N;;;;; +1D149;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP BLACK;So;0;L;;;;;N;;;;; +1D14A;MUSICAL SYMBOL TRIANGLE NOTEHEAD LEFT WHITE;So;0;L;;;;;N;;;;; +1D14B;MUSICAL SYMBOL TRIANGLE NOTEHEAD LEFT BLACK;So;0;L;;;;;N;;;;; +1D14C;MUSICAL SYMBOL TRIANGLE NOTEHEAD RIGHT WHITE;So;0;L;;;;;N;;;;; +1D14D;MUSICAL SYMBOL TRIANGLE NOTEHEAD RIGHT BLACK;So;0;L;;;;;N;;;;; +1D14E;MUSICAL SYMBOL TRIANGLE NOTEHEAD DOWN WHITE;So;0;L;;;;;N;;;;; +1D14F;MUSICAL SYMBOL TRIANGLE NOTEHEAD DOWN BLACK;So;0;L;;;;;N;;;;; +1D150;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP RIGHT WHITE;So;0;L;;;;;N;;;;; +1D151;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP RIGHT BLACK;So;0;L;;;;;N;;;;; +1D152;MUSICAL SYMBOL MOON NOTEHEAD WHITE;So;0;L;;;;;N;;;;; +1D153;MUSICAL SYMBOL MOON NOTEHEAD BLACK;So;0;L;;;;;N;;;;; +1D154;MUSICAL SYMBOL TRIANGLE-ROUND NOTEHEAD DOWN WHITE;So;0;L;;;;;N;;;;; +1D155;MUSICAL SYMBOL TRIANGLE-ROUND NOTEHEAD DOWN BLACK;So;0;L;;;;;N;;;;; +1D156;MUSICAL SYMBOL PARENTHESIS NOTEHEAD;So;0;L;;;;;N;;;;; +1D157;MUSICAL SYMBOL VOID NOTEHEAD;So;0;L;;;;;N;;;;; +1D158;MUSICAL SYMBOL NOTEHEAD BLACK;So;0;L;;;;;N;;;;; +1D159;MUSICAL SYMBOL NULL NOTEHEAD;So;0;L;;;;;N;;;;; +1D15A;MUSICAL SYMBOL CLUSTER NOTEHEAD WHITE;So;0;L;;;;;N;;;;; +1D15B;MUSICAL SYMBOL CLUSTER NOTEHEAD BLACK;So;0;L;;;;;N;;;;; +1D15C;MUSICAL SYMBOL BREVE;So;0;L;;;;;N;;;;; +1D15D;MUSICAL SYMBOL WHOLE NOTE;So;0;L;;;;;N;;;;; +1D15E;MUSICAL SYMBOL HALF NOTE;So;0;L;1D157 1D165;;;;N;;;;; +1D15F;MUSICAL SYMBOL QUARTER NOTE;So;0;L;1D158 1D165;;;;N;;;;; +1D160;MUSICAL SYMBOL EIGHTH NOTE;So;0;L;1D15F 1D16E;;;;N;;;;; +1D161;MUSICAL SYMBOL SIXTEENTH NOTE;So;0;L;1D15F 1D16F;;;;N;;;;; +1D162;MUSICAL SYMBOL THIRTY-SECOND NOTE;So;0;L;1D15F 1D170;;;;N;;;;; +1D163;MUSICAL SYMBOL SIXTY-FOURTH NOTE;So;0;L;1D15F 1D171;;;;N;;;;; +1D164;MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH NOTE;So;0;L;1D15F 1D172;;;;N;;;;; +1D165;MUSICAL SYMBOL COMBINING STEM;Mc;216;L;;;;;N;;;;; +1D166;MUSICAL SYMBOL COMBINING SPRECHGESANG STEM;Mc;216;L;;;;;N;;;;; +1D167;MUSICAL SYMBOL COMBINING TREMOLO-1;Mn;1;NSM;;;;;N;;;;; +1D168;MUSICAL SYMBOL COMBINING TREMOLO-2;Mn;1;NSM;;;;;N;;;;; +1D169;MUSICAL SYMBOL COMBINING TREMOLO-3;Mn;1;NSM;;;;;N;;;;; +1D16A;MUSICAL SYMBOL FINGERED TREMOLO-1;So;0;L;;;;;N;;;;; +1D16B;MUSICAL SYMBOL FINGERED TREMOLO-2;So;0;L;;;;;N;;;;; +1D16C;MUSICAL SYMBOL FINGERED TREMOLO-3;So;0;L;;;;;N;;;;; +1D16D;MUSICAL SYMBOL COMBINING AUGMENTATION DOT;Mc;226;L;;;;;N;;;;; +1D16E;MUSICAL SYMBOL COMBINING FLAG-1;Mc;216;L;;;;;N;;;;; +1D16F;MUSICAL SYMBOL COMBINING FLAG-2;Mc;216;L;;;;;N;;;;; +1D170;MUSICAL SYMBOL COMBINING FLAG-3;Mc;216;L;;;;;N;;;;; +1D171;MUSICAL SYMBOL COMBINING FLAG-4;Mc;216;L;;;;;N;;;;; +1D172;MUSICAL SYMBOL COMBINING FLAG-5;Mc;216;L;;;;;N;;;;; +1D173;MUSICAL SYMBOL BEGIN BEAM;Cf;0;BN;;;;;N;;;;; +1D174;MUSICAL SYMBOL END BEAM;Cf;0;BN;;;;;N;;;;; +1D175;MUSICAL SYMBOL BEGIN TIE;Cf;0;BN;;;;;N;;;;; +1D176;MUSICAL SYMBOL END TIE;Cf;0;BN;;;;;N;;;;; +1D177;MUSICAL SYMBOL BEGIN SLUR;Cf;0;BN;;;;;N;;;;; +1D178;MUSICAL SYMBOL END SLUR;Cf;0;BN;;;;;N;;;;; +1D179;MUSICAL SYMBOL BEGIN PHRASE;Cf;0;BN;;;;;N;;;;; +1D17A;MUSICAL SYMBOL END PHRASE;Cf;0;BN;;;;;N;;;;; +1D17B;MUSICAL SYMBOL COMBINING ACCENT;Mn;220;NSM;;;;;N;;;;; +1D17C;MUSICAL SYMBOL COMBINING STACCATO;Mn;220;NSM;;;;;N;;;;; +1D17D;MUSICAL SYMBOL COMBINING TENUTO;Mn;220;NSM;;;;;N;;;;; +1D17E;MUSICAL SYMBOL COMBINING STACCATISSIMO;Mn;220;NSM;;;;;N;;;;; +1D17F;MUSICAL SYMBOL COMBINING MARCATO;Mn;220;NSM;;;;;N;;;;; +1D180;MUSICAL SYMBOL COMBINING MARCATO-STACCATO;Mn;220;NSM;;;;;N;;;;; +1D181;MUSICAL SYMBOL COMBINING ACCENT-STACCATO;Mn;220;NSM;;;;;N;;;;; +1D182;MUSICAL SYMBOL COMBINING LOURE;Mn;220;NSM;;;;;N;;;;; +1D183;MUSICAL SYMBOL ARPEGGIATO UP;So;0;L;;;;;N;;;;; +1D184;MUSICAL SYMBOL ARPEGGIATO DOWN;So;0;L;;;;;N;;;;; +1D185;MUSICAL SYMBOL COMBINING DOIT;Mn;230;NSM;;;;;N;;;;; +1D186;MUSICAL SYMBOL COMBINING RIP;Mn;230;NSM;;;;;N;;;;; +1D187;MUSICAL SYMBOL COMBINING FLIP;Mn;230;NSM;;;;;N;;;;; +1D188;MUSICAL SYMBOL COMBINING SMEAR;Mn;230;NSM;;;;;N;;;;; +1D189;MUSICAL SYMBOL COMBINING BEND;Mn;230;NSM;;;;;N;;;;; +1D18A;MUSICAL SYMBOL COMBINING DOUBLE TONGUE;Mn;220;NSM;;;;;N;;;;; +1D18B;MUSICAL SYMBOL COMBINING TRIPLE TONGUE;Mn;220;NSM;;;;;N;;;;; +1D18C;MUSICAL SYMBOL RINFORZANDO;So;0;L;;;;;N;;;;; +1D18D;MUSICAL SYMBOL SUBITO;So;0;L;;;;;N;;;;; +1D18E;MUSICAL SYMBOL Z;So;0;L;;;;;N;;;;; +1D18F;MUSICAL SYMBOL PIANO;So;0;L;;;;;N;;;;; +1D190;MUSICAL SYMBOL MEZZO;So;0;L;;;;;N;;;;; +1D191;MUSICAL SYMBOL FORTE;So;0;L;;;;;N;;;;; +1D192;MUSICAL SYMBOL CRESCENDO;So;0;L;;;;;N;;;;; +1D193;MUSICAL SYMBOL DECRESCENDO;So;0;L;;;;;N;;;;; +1D194;MUSICAL SYMBOL GRACE NOTE SLASH;So;0;L;;;;;N;;;;; +1D195;MUSICAL SYMBOL GRACE NOTE NO SLASH;So;0;L;;;;;N;;;;; +1D196;MUSICAL SYMBOL TR;So;0;L;;;;;N;;;;; +1D197;MUSICAL SYMBOL TURN;So;0;L;;;;;N;;;;; +1D198;MUSICAL SYMBOL INVERTED TURN;So;0;L;;;;;N;;;;; +1D199;MUSICAL SYMBOL TURN SLASH;So;0;L;;;;;N;;;;; +1D19A;MUSICAL SYMBOL TURN UP;So;0;L;;;;;N;;;;; +1D19B;MUSICAL SYMBOL ORNAMENT STROKE-1;So;0;L;;;;;N;;;;; +1D19C;MUSICAL SYMBOL ORNAMENT STROKE-2;So;0;L;;;;;N;;;;; +1D19D;MUSICAL SYMBOL ORNAMENT STROKE-3;So;0;L;;;;;N;;;;; +1D19E;MUSICAL SYMBOL ORNAMENT STROKE-4;So;0;L;;;;;N;;;;; +1D19F;MUSICAL SYMBOL ORNAMENT STROKE-5;So;0;L;;;;;N;;;;; +1D1A0;MUSICAL SYMBOL ORNAMENT STROKE-6;So;0;L;;;;;N;;;;; +1D1A1;MUSICAL SYMBOL ORNAMENT STROKE-7;So;0;L;;;;;N;;;;; +1D1A2;MUSICAL SYMBOL ORNAMENT STROKE-8;So;0;L;;;;;N;;;;; +1D1A3;MUSICAL SYMBOL ORNAMENT STROKE-9;So;0;L;;;;;N;;;;; +1D1A4;MUSICAL SYMBOL ORNAMENT STROKE-10;So;0;L;;;;;N;;;;; +1D1A5;MUSICAL SYMBOL ORNAMENT STROKE-11;So;0;L;;;;;N;;;;; +1D1A6;MUSICAL SYMBOL HAUPTSTIMME;So;0;L;;;;;N;;;;; +1D1A7;MUSICAL SYMBOL NEBENSTIMME;So;0;L;;;;;N;;;;; +1D1A8;MUSICAL SYMBOL END OF STIMME;So;0;L;;;;;N;;;;; +1D1A9;MUSICAL SYMBOL DEGREE SLASH;So;0;L;;;;;N;;;;; +1D1AA;MUSICAL SYMBOL COMBINING DOWN BOW;Mn;230;NSM;;;;;N;;;;; +1D1AB;MUSICAL SYMBOL COMBINING UP BOW;Mn;230;NSM;;;;;N;;;;; +1D1AC;MUSICAL SYMBOL COMBINING HARMONIC;Mn;230;NSM;;;;;N;;;;; +1D1AD;MUSICAL SYMBOL COMBINING SNAP PIZZICATO;Mn;230;NSM;;;;;N;;;;; +1D1AE;MUSICAL SYMBOL PEDAL MARK;So;0;L;;;;;N;;;;; +1D1AF;MUSICAL SYMBOL PEDAL UP MARK;So;0;L;;;;;N;;;;; +1D1B0;MUSICAL SYMBOL HALF PEDAL MARK;So;0;L;;;;;N;;;;; +1D1B1;MUSICAL SYMBOL GLISSANDO UP;So;0;L;;;;;N;;;;; +1D1B2;MUSICAL SYMBOL GLISSANDO DOWN;So;0;L;;;;;N;;;;; +1D1B3;MUSICAL SYMBOL WITH FINGERNAILS;So;0;L;;;;;N;;;;; +1D1B4;MUSICAL SYMBOL DAMP;So;0;L;;;;;N;;;;; +1D1B5;MUSICAL SYMBOL DAMP ALL;So;0;L;;;;;N;;;;; +1D1B6;MUSICAL SYMBOL MAXIMA;So;0;L;;;;;N;;;;; +1D1B7;MUSICAL SYMBOL LONGA;So;0;L;;;;;N;;;;; +1D1B8;MUSICAL SYMBOL BREVIS;So;0;L;;;;;N;;;;; +1D1B9;MUSICAL SYMBOL SEMIBREVIS WHITE;So;0;L;;;;;N;;;;; +1D1BA;MUSICAL SYMBOL SEMIBREVIS BLACK;So;0;L;;;;;N;;;;; +1D1BB;MUSICAL SYMBOL MINIMA;So;0;L;1D1B9 1D165;;;;N;;;;; +1D1BC;MUSICAL SYMBOL MINIMA BLACK;So;0;L;1D1BA 1D165;;;;N;;;;; +1D1BD;MUSICAL SYMBOL SEMIMINIMA WHITE;So;0;L;1D1BB 1D16E;;;;N;;;;; +1D1BE;MUSICAL SYMBOL SEMIMINIMA BLACK;So;0;L;1D1BC 1D16E;;;;N;;;;; +1D1BF;MUSICAL SYMBOL FUSA WHITE;So;0;L;1D1BB 1D16F;;;;N;;;;; +1D1C0;MUSICAL SYMBOL FUSA BLACK;So;0;L;1D1BC 1D16F;;;;N;;;;; +1D1C1;MUSICAL SYMBOL LONGA PERFECTA REST;So;0;L;;;;;N;;;;; +1D1C2;MUSICAL SYMBOL LONGA IMPERFECTA REST;So;0;L;;;;;N;;;;; +1D1C3;MUSICAL SYMBOL BREVIS REST;So;0;L;;;;;N;;;;; +1D1C4;MUSICAL SYMBOL SEMIBREVIS REST;So;0;L;;;;;N;;;;; +1D1C5;MUSICAL SYMBOL MINIMA REST;So;0;L;;;;;N;;;;; +1D1C6;MUSICAL SYMBOL SEMIMINIMA REST;So;0;L;;;;;N;;;;; +1D1C7;MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE PERFECTA;So;0;L;;;;;N;;;;; +1D1C8;MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE IMPERFECTA;So;0;L;;;;;N;;;;; +1D1C9;MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE PERFECTA DIMINUTION-1;So;0;L;;;;;N;;;;; +1D1CA;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE PERFECTA;So;0;L;;;;;N;;;;; +1D1CB;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA;So;0;L;;;;;N;;;;; +1D1CC;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-1;So;0;L;;;;;N;;;;; +1D1CD;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-2;So;0;L;;;;;N;;;;; +1D1CE;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-3;So;0;L;;;;;N;;;;; +1D1CF;MUSICAL SYMBOL CROIX;So;0;L;;;;;N;;;;; +1D1D0;MUSICAL SYMBOL GREGORIAN C CLEF;So;0;L;;;;;N;;;;; +1D1D1;MUSICAL SYMBOL GREGORIAN F CLEF;So;0;L;;;;;N;;;;; +1D1D2;MUSICAL SYMBOL SQUARE B;So;0;L;;;;;N;;;;; +1D1D3;MUSICAL SYMBOL VIRGA;So;0;L;;;;;N;;;;; +1D1D4;MUSICAL SYMBOL PODATUS;So;0;L;;;;;N;;;;; +1D1D5;MUSICAL SYMBOL CLIVIS;So;0;L;;;;;N;;;;; +1D1D6;MUSICAL SYMBOL SCANDICUS;So;0;L;;;;;N;;;;; +1D1D7;MUSICAL SYMBOL CLIMACUS;So;0;L;;;;;N;;;;; +1D1D8;MUSICAL SYMBOL TORCULUS;So;0;L;;;;;N;;;;; +1D1D9;MUSICAL SYMBOL PORRECTUS;So;0;L;;;;;N;;;;; +1D1DA;MUSICAL SYMBOL PORRECTUS FLEXUS;So;0;L;;;;;N;;;;; +1D1DB;MUSICAL SYMBOL SCANDICUS FLEXUS;So;0;L;;;;;N;;;;; +1D1DC;MUSICAL SYMBOL TORCULUS RESUPINUS;So;0;L;;;;;N;;;;; +1D1DD;MUSICAL SYMBOL PES SUBPUNCTIS;So;0;L;;;;;N;;;;; +1D1DE;MUSICAL SYMBOL KIEVAN C CLEF;So;0;L;;;;;N;;;;; +1D1DF;MUSICAL SYMBOL KIEVAN END OF PIECE;So;0;L;;;;;N;;;;; +1D1E0;MUSICAL SYMBOL KIEVAN FINAL NOTE;So;0;L;;;;;N;;;;; +1D1E1;MUSICAL SYMBOL KIEVAN RECITATIVE MARK;So;0;L;;;;;N;;;;; +1D1E2;MUSICAL SYMBOL KIEVAN WHOLE NOTE;So;0;L;;;;;N;;;;; +1D1E3;MUSICAL SYMBOL KIEVAN HALF NOTE;So;0;L;;;;;N;;;;; +1D1E4;MUSICAL SYMBOL KIEVAN QUARTER NOTE STEM DOWN;So;0;L;;;;;N;;;;; +1D1E5;MUSICAL SYMBOL KIEVAN QUARTER NOTE STEM UP;So;0;L;;;;;N;;;;; +1D1E6;MUSICAL SYMBOL KIEVAN EIGHTH NOTE STEM DOWN;So;0;L;;;;;N;;;;; +1D1E7;MUSICAL SYMBOL KIEVAN EIGHTH NOTE STEM UP;So;0;L;;;;;N;;;;; +1D1E8;MUSICAL SYMBOL KIEVAN FLAT SIGN;So;0;L;;;;;N;;;;; +1D200;GREEK VOCAL NOTATION SYMBOL-1;So;0;ON;;;;;N;;;;; +1D201;GREEK VOCAL NOTATION SYMBOL-2;So;0;ON;;;;;N;;;;; +1D202;GREEK VOCAL NOTATION SYMBOL-3;So;0;ON;;;;;N;;;;; +1D203;GREEK VOCAL NOTATION SYMBOL-4;So;0;ON;;;;;N;;;;; +1D204;GREEK VOCAL NOTATION SYMBOL-5;So;0;ON;;;;;N;;;;; +1D205;GREEK VOCAL NOTATION SYMBOL-6;So;0;ON;;;;;N;;;;; +1D206;GREEK VOCAL NOTATION SYMBOL-7;So;0;ON;;;;;N;;;;; +1D207;GREEK VOCAL NOTATION SYMBOL-8;So;0;ON;;;;;N;;;;; +1D208;GREEK VOCAL NOTATION SYMBOL-9;So;0;ON;;;;;N;;;;; +1D209;GREEK VOCAL NOTATION SYMBOL-10;So;0;ON;;;;;N;;;;; +1D20A;GREEK VOCAL NOTATION SYMBOL-11;So;0;ON;;;;;N;;;;; +1D20B;GREEK VOCAL NOTATION SYMBOL-12;So;0;ON;;;;;N;;;;; +1D20C;GREEK VOCAL NOTATION SYMBOL-13;So;0;ON;;;;;N;;;;; +1D20D;GREEK VOCAL NOTATION SYMBOL-14;So;0;ON;;;;;N;;;;; +1D20E;GREEK VOCAL NOTATION SYMBOL-15;So;0;ON;;;;;N;;;;; +1D20F;GREEK VOCAL NOTATION SYMBOL-16;So;0;ON;;;;;N;;;;; +1D210;GREEK VOCAL NOTATION SYMBOL-17;So;0;ON;;;;;N;;;;; +1D211;GREEK VOCAL NOTATION SYMBOL-18;So;0;ON;;;;;N;;;;; +1D212;GREEK VOCAL NOTATION SYMBOL-19;So;0;ON;;;;;N;;;;; +1D213;GREEK VOCAL NOTATION SYMBOL-20;So;0;ON;;;;;N;;;;; +1D214;GREEK VOCAL NOTATION SYMBOL-21;So;0;ON;;;;;N;;;;; +1D215;GREEK VOCAL NOTATION SYMBOL-22;So;0;ON;;;;;N;;;;; +1D216;GREEK VOCAL NOTATION SYMBOL-23;So;0;ON;;;;;N;;;;; +1D217;GREEK VOCAL NOTATION SYMBOL-24;So;0;ON;;;;;N;;;;; +1D218;GREEK VOCAL NOTATION SYMBOL-50;So;0;ON;;;;;N;;;;; +1D219;GREEK VOCAL NOTATION SYMBOL-51;So;0;ON;;;;;N;;;;; +1D21A;GREEK VOCAL NOTATION SYMBOL-52;So;0;ON;;;;;N;;;;; +1D21B;GREEK VOCAL NOTATION SYMBOL-53;So;0;ON;;;;;N;;;;; +1D21C;GREEK VOCAL NOTATION SYMBOL-54;So;0;ON;;;;;N;;;;; +1D21D;GREEK INSTRUMENTAL NOTATION SYMBOL-1;So;0;ON;;;;;N;;;;; +1D21E;GREEK INSTRUMENTAL NOTATION SYMBOL-2;So;0;ON;;;;;N;;;;; +1D21F;GREEK INSTRUMENTAL NOTATION SYMBOL-4;So;0;ON;;;;;N;;;;; +1D220;GREEK INSTRUMENTAL NOTATION SYMBOL-5;So;0;ON;;;;;N;;;;; +1D221;GREEK INSTRUMENTAL NOTATION SYMBOL-7;So;0;ON;;;;;N;;;;; +1D222;GREEK INSTRUMENTAL NOTATION SYMBOL-8;So;0;ON;;;;;N;;;;; +1D223;GREEK INSTRUMENTAL NOTATION SYMBOL-11;So;0;ON;;;;;N;;;;; +1D224;GREEK INSTRUMENTAL NOTATION SYMBOL-12;So;0;ON;;;;;N;;;;; +1D225;GREEK INSTRUMENTAL NOTATION SYMBOL-13;So;0;ON;;;;;N;;;;; +1D226;GREEK INSTRUMENTAL NOTATION SYMBOL-14;So;0;ON;;;;;N;;;;; +1D227;GREEK INSTRUMENTAL NOTATION SYMBOL-17;So;0;ON;;;;;N;;;;; +1D228;GREEK INSTRUMENTAL NOTATION SYMBOL-18;So;0;ON;;;;;N;;;;; +1D229;GREEK INSTRUMENTAL NOTATION SYMBOL-19;So;0;ON;;;;;N;;;;; +1D22A;GREEK INSTRUMENTAL NOTATION SYMBOL-23;So;0;ON;;;;;N;;;;; +1D22B;GREEK INSTRUMENTAL NOTATION SYMBOL-24;So;0;ON;;;;;N;;;;; +1D22C;GREEK INSTRUMENTAL NOTATION SYMBOL-25;So;0;ON;;;;;N;;;;; +1D22D;GREEK INSTRUMENTAL NOTATION SYMBOL-26;So;0;ON;;;;;N;;;;; +1D22E;GREEK INSTRUMENTAL NOTATION SYMBOL-27;So;0;ON;;;;;N;;;;; +1D22F;GREEK INSTRUMENTAL NOTATION SYMBOL-29;So;0;ON;;;;;N;;;;; +1D230;GREEK INSTRUMENTAL NOTATION SYMBOL-30;So;0;ON;;;;;N;;;;; +1D231;GREEK INSTRUMENTAL NOTATION SYMBOL-32;So;0;ON;;;;;N;;;;; +1D232;GREEK INSTRUMENTAL NOTATION SYMBOL-36;So;0;ON;;;;;N;;;;; +1D233;GREEK INSTRUMENTAL NOTATION SYMBOL-37;So;0;ON;;;;;N;;;;; +1D234;GREEK INSTRUMENTAL NOTATION SYMBOL-38;So;0;ON;;;;;N;;;;; +1D235;GREEK INSTRUMENTAL NOTATION SYMBOL-39;So;0;ON;;;;;N;;;;; +1D236;GREEK INSTRUMENTAL NOTATION SYMBOL-40;So;0;ON;;;;;N;;;;; +1D237;GREEK INSTRUMENTAL NOTATION SYMBOL-42;So;0;ON;;;;;N;;;;; +1D238;GREEK INSTRUMENTAL NOTATION SYMBOL-43;So;0;ON;;;;;N;;;;; +1D239;GREEK INSTRUMENTAL NOTATION SYMBOL-45;So;0;ON;;;;;N;;;;; +1D23A;GREEK INSTRUMENTAL NOTATION SYMBOL-47;So;0;ON;;;;;N;;;;; +1D23B;GREEK INSTRUMENTAL NOTATION SYMBOL-48;So;0;ON;;;;;N;;;;; +1D23C;GREEK INSTRUMENTAL NOTATION SYMBOL-49;So;0;ON;;;;;N;;;;; +1D23D;GREEK INSTRUMENTAL NOTATION SYMBOL-50;So;0;ON;;;;;N;;;;; +1D23E;GREEK INSTRUMENTAL NOTATION SYMBOL-51;So;0;ON;;;;;N;;;;; +1D23F;GREEK INSTRUMENTAL NOTATION SYMBOL-52;So;0;ON;;;;;N;;;;; +1D240;GREEK INSTRUMENTAL NOTATION SYMBOL-53;So;0;ON;;;;;N;;;;; +1D241;GREEK INSTRUMENTAL NOTATION SYMBOL-54;So;0;ON;;;;;N;;;;; +1D242;COMBINING GREEK MUSICAL TRISEME;Mn;230;NSM;;;;;N;;;;; +1D243;COMBINING GREEK MUSICAL TETRASEME;Mn;230;NSM;;;;;N;;;;; +1D244;COMBINING GREEK MUSICAL PENTASEME;Mn;230;NSM;;;;;N;;;;; +1D245;GREEK MUSICAL LEIMMA;So;0;ON;;;;;N;;;;; +1D300;MONOGRAM FOR EARTH;So;0;ON;;;;;N;;;;; +1D301;DIGRAM FOR HEAVENLY EARTH;So;0;ON;;;;;N;;;;; +1D302;DIGRAM FOR HUMAN EARTH;So;0;ON;;;;;N;;;;; +1D303;DIGRAM FOR EARTHLY HEAVEN;So;0;ON;;;;;N;;;;; +1D304;DIGRAM FOR EARTHLY HUMAN;So;0;ON;;;;;N;;;;; +1D305;DIGRAM FOR EARTH;So;0;ON;;;;;N;;;;; +1D306;TETRAGRAM FOR CENTRE;So;0;ON;;;;;N;;;;; +1D307;TETRAGRAM FOR FULL CIRCLE;So;0;ON;;;;;N;;;;; +1D308;TETRAGRAM FOR MIRED;So;0;ON;;;;;N;;;;; +1D309;TETRAGRAM FOR BARRIER;So;0;ON;;;;;N;;;;; +1D30A;TETRAGRAM FOR KEEPING SMALL;So;0;ON;;;;;N;;;;; +1D30B;TETRAGRAM FOR CONTRARIETY;So;0;ON;;;;;N;;;;; +1D30C;TETRAGRAM FOR ASCENT;So;0;ON;;;;;N;;;;; +1D30D;TETRAGRAM FOR OPPOSITION;So;0;ON;;;;;N;;;;; +1D30E;TETRAGRAM FOR BRANCHING OUT;So;0;ON;;;;;N;;;;; +1D30F;TETRAGRAM FOR DEFECTIVENESS OR DISTORTION;So;0;ON;;;;;N;;;;; +1D310;TETRAGRAM FOR DIVERGENCE;So;0;ON;;;;;N;;;;; +1D311;TETRAGRAM FOR YOUTHFULNESS;So;0;ON;;;;;N;;;;; +1D312;TETRAGRAM FOR INCREASE;So;0;ON;;;;;N;;;;; +1D313;TETRAGRAM FOR PENETRATION;So;0;ON;;;;;N;;;;; +1D314;TETRAGRAM FOR REACH;So;0;ON;;;;;N;;;;; +1D315;TETRAGRAM FOR CONTACT;So;0;ON;;;;;N;;;;; +1D316;TETRAGRAM FOR HOLDING BACK;So;0;ON;;;;;N;;;;; +1D317;TETRAGRAM FOR WAITING;So;0;ON;;;;;N;;;;; +1D318;TETRAGRAM FOR FOLLOWING;So;0;ON;;;;;N;;;;; +1D319;TETRAGRAM FOR ADVANCE;So;0;ON;;;;;N;;;;; +1D31A;TETRAGRAM FOR RELEASE;So;0;ON;;;;;N;;;;; +1D31B;TETRAGRAM FOR RESISTANCE;So;0;ON;;;;;N;;;;; +1D31C;TETRAGRAM FOR EASE;So;0;ON;;;;;N;;;;; +1D31D;TETRAGRAM FOR JOY;So;0;ON;;;;;N;;;;; +1D31E;TETRAGRAM FOR CONTENTION;So;0;ON;;;;;N;;;;; +1D31F;TETRAGRAM FOR ENDEAVOUR;So;0;ON;;;;;N;;;;; +1D320;TETRAGRAM FOR DUTIES;So;0;ON;;;;;N;;;;; +1D321;TETRAGRAM FOR CHANGE;So;0;ON;;;;;N;;;;; +1D322;TETRAGRAM FOR DECISIVENESS;So;0;ON;;;;;N;;;;; +1D323;TETRAGRAM FOR BOLD RESOLUTION;So;0;ON;;;;;N;;;;; +1D324;TETRAGRAM FOR PACKING;So;0;ON;;;;;N;;;;; +1D325;TETRAGRAM FOR LEGION;So;0;ON;;;;;N;;;;; +1D326;TETRAGRAM FOR CLOSENESS;So;0;ON;;;;;N;;;;; +1D327;TETRAGRAM FOR KINSHIP;So;0;ON;;;;;N;;;;; +1D328;TETRAGRAM FOR GATHERING;So;0;ON;;;;;N;;;;; +1D329;TETRAGRAM FOR STRENGTH;So;0;ON;;;;;N;;;;; +1D32A;TETRAGRAM FOR PURITY;So;0;ON;;;;;N;;;;; +1D32B;TETRAGRAM FOR FULLNESS;So;0;ON;;;;;N;;;;; +1D32C;TETRAGRAM FOR RESIDENCE;So;0;ON;;;;;N;;;;; +1D32D;TETRAGRAM FOR LAW OR MODEL;So;0;ON;;;;;N;;;;; +1D32E;TETRAGRAM FOR RESPONSE;So;0;ON;;;;;N;;;;; +1D32F;TETRAGRAM FOR GOING TO MEET;So;0;ON;;;;;N;;;;; +1D330;TETRAGRAM FOR ENCOUNTERS;So;0;ON;;;;;N;;;;; +1D331;TETRAGRAM FOR STOVE;So;0;ON;;;;;N;;;;; +1D332;TETRAGRAM FOR GREATNESS;So;0;ON;;;;;N;;;;; +1D333;TETRAGRAM FOR ENLARGEMENT;So;0;ON;;;;;N;;;;; +1D334;TETRAGRAM FOR PATTERN;So;0;ON;;;;;N;;;;; +1D335;TETRAGRAM FOR RITUAL;So;0;ON;;;;;N;;;;; +1D336;TETRAGRAM FOR FLIGHT;So;0;ON;;;;;N;;;;; +1D337;TETRAGRAM FOR VASTNESS OR WASTING;So;0;ON;;;;;N;;;;; +1D338;TETRAGRAM FOR CONSTANCY;So;0;ON;;;;;N;;;;; +1D339;TETRAGRAM FOR MEASURE;So;0;ON;;;;;N;;;;; +1D33A;TETRAGRAM FOR ETERNITY;So;0;ON;;;;;N;;;;; +1D33B;TETRAGRAM FOR UNITY;So;0;ON;;;;;N;;;;; +1D33C;TETRAGRAM FOR DIMINISHMENT;So;0;ON;;;;;N;;;;; +1D33D;TETRAGRAM FOR CLOSED MOUTH;So;0;ON;;;;;N;;;;; +1D33E;TETRAGRAM FOR GUARDEDNESS;So;0;ON;;;;;N;;;;; +1D33F;TETRAGRAM FOR GATHERING IN;So;0;ON;;;;;N;;;;; +1D340;TETRAGRAM FOR MASSING;So;0;ON;;;;;N;;;;; +1D341;TETRAGRAM FOR ACCUMULATION;So;0;ON;;;;;N;;;;; +1D342;TETRAGRAM FOR EMBELLISHMENT;So;0;ON;;;;;N;;;;; +1D343;TETRAGRAM FOR DOUBT;So;0;ON;;;;;N;;;;; +1D344;TETRAGRAM FOR WATCH;So;0;ON;;;;;N;;;;; +1D345;TETRAGRAM FOR SINKING;So;0;ON;;;;;N;;;;; +1D346;TETRAGRAM FOR INNER;So;0;ON;;;;;N;;;;; +1D347;TETRAGRAM FOR DEPARTURE;So;0;ON;;;;;N;;;;; +1D348;TETRAGRAM FOR DARKENING;So;0;ON;;;;;N;;;;; +1D349;TETRAGRAM FOR DIMMING;So;0;ON;;;;;N;;;;; +1D34A;TETRAGRAM FOR EXHAUSTION;So;0;ON;;;;;N;;;;; +1D34B;TETRAGRAM FOR SEVERANCE;So;0;ON;;;;;N;;;;; +1D34C;TETRAGRAM FOR STOPPAGE;So;0;ON;;;;;N;;;;; +1D34D;TETRAGRAM FOR HARDNESS;So;0;ON;;;;;N;;;;; +1D34E;TETRAGRAM FOR COMPLETION;So;0;ON;;;;;N;;;;; +1D34F;TETRAGRAM FOR CLOSURE;So;0;ON;;;;;N;;;;; +1D350;TETRAGRAM FOR FAILURE;So;0;ON;;;;;N;;;;; +1D351;TETRAGRAM FOR AGGRAVATION;So;0;ON;;;;;N;;;;; +1D352;TETRAGRAM FOR COMPLIANCE;So;0;ON;;;;;N;;;;; +1D353;TETRAGRAM FOR ON THE VERGE;So;0;ON;;;;;N;;;;; +1D354;TETRAGRAM FOR DIFFICULTIES;So;0;ON;;;;;N;;;;; +1D355;TETRAGRAM FOR LABOURING;So;0;ON;;;;;N;;;;; +1D356;TETRAGRAM FOR FOSTERING;So;0;ON;;;;;N;;;;; +1D360;COUNTING ROD UNIT DIGIT ONE;No;0;L;;;;1;N;;;;; +1D361;COUNTING ROD UNIT DIGIT TWO;No;0;L;;;;2;N;;;;; +1D362;COUNTING ROD UNIT DIGIT THREE;No;0;L;;;;3;N;;;;; +1D363;COUNTING ROD UNIT DIGIT FOUR;No;0;L;;;;4;N;;;;; +1D364;COUNTING ROD UNIT DIGIT FIVE;No;0;L;;;;5;N;;;;; +1D365;COUNTING ROD UNIT DIGIT SIX;No;0;L;;;;6;N;;;;; +1D366;COUNTING ROD UNIT DIGIT SEVEN;No;0;L;;;;7;N;;;;; +1D367;COUNTING ROD UNIT DIGIT EIGHT;No;0;L;;;;8;N;;;;; +1D368;COUNTING ROD UNIT DIGIT NINE;No;0;L;;;;9;N;;;;; +1D369;COUNTING ROD TENS DIGIT ONE;No;0;L;;;;10;N;;;;; +1D36A;COUNTING ROD TENS DIGIT TWO;No;0;L;;;;20;N;;;;; +1D36B;COUNTING ROD TENS DIGIT THREE;No;0;L;;;;30;N;;;;; +1D36C;COUNTING ROD TENS DIGIT FOUR;No;0;L;;;;40;N;;;;; +1D36D;COUNTING ROD TENS DIGIT FIVE;No;0;L;;;;50;N;;;;; +1D36E;COUNTING ROD TENS DIGIT SIX;No;0;L;;;;60;N;;;;; +1D36F;COUNTING ROD TENS DIGIT SEVEN;No;0;L;;;;70;N;;;;; +1D370;COUNTING ROD TENS DIGIT EIGHT;No;0;L;;;;80;N;;;;; +1D371;COUNTING ROD TENS DIGIT NINE;No;0;L;;;;90;N;;;;; +1D400;MATHEMATICAL BOLD CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D401;MATHEMATICAL BOLD CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D402;MATHEMATICAL BOLD CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D403;MATHEMATICAL BOLD CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D404;MATHEMATICAL BOLD CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D405;MATHEMATICAL BOLD CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D406;MATHEMATICAL BOLD CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D407;MATHEMATICAL BOLD CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D408;MATHEMATICAL BOLD CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D409;MATHEMATICAL BOLD CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D40A;MATHEMATICAL BOLD CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D40B;MATHEMATICAL BOLD CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D40C;MATHEMATICAL BOLD CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D40D;MATHEMATICAL BOLD CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D40E;MATHEMATICAL BOLD CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D40F;MATHEMATICAL BOLD CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D410;MATHEMATICAL BOLD CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D411;MATHEMATICAL BOLD CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D412;MATHEMATICAL BOLD CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D413;MATHEMATICAL BOLD CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D414;MATHEMATICAL BOLD CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D415;MATHEMATICAL BOLD CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D416;MATHEMATICAL BOLD CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D417;MATHEMATICAL BOLD CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D418;MATHEMATICAL BOLD CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D419;MATHEMATICAL BOLD CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D41A;MATHEMATICAL BOLD SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D41B;MATHEMATICAL BOLD SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D41C;MATHEMATICAL BOLD SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D41D;MATHEMATICAL BOLD SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D41E;MATHEMATICAL BOLD SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D41F;MATHEMATICAL BOLD SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D420;MATHEMATICAL BOLD SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D421;MATHEMATICAL BOLD SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D422;MATHEMATICAL BOLD SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D423;MATHEMATICAL BOLD SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D424;MATHEMATICAL BOLD SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D425;MATHEMATICAL BOLD SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D426;MATHEMATICAL BOLD SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D427;MATHEMATICAL BOLD SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D428;MATHEMATICAL BOLD SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D429;MATHEMATICAL BOLD SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D42A;MATHEMATICAL BOLD SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D42B;MATHEMATICAL BOLD SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D42C;MATHEMATICAL BOLD SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D42D;MATHEMATICAL BOLD SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D42E;MATHEMATICAL BOLD SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D42F;MATHEMATICAL BOLD SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D430;MATHEMATICAL BOLD SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D431;MATHEMATICAL BOLD SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D432;MATHEMATICAL BOLD SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D433;MATHEMATICAL BOLD SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D434;MATHEMATICAL ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D435;MATHEMATICAL ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D436;MATHEMATICAL ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D437;MATHEMATICAL ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D438;MATHEMATICAL ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D439;MATHEMATICAL ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D43A;MATHEMATICAL ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D43B;MATHEMATICAL ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D43C;MATHEMATICAL ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D43D;MATHEMATICAL ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D43E;MATHEMATICAL ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D43F;MATHEMATICAL ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D440;MATHEMATICAL ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D441;MATHEMATICAL ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D442;MATHEMATICAL ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D443;MATHEMATICAL ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D444;MATHEMATICAL ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D445;MATHEMATICAL ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D446;MATHEMATICAL ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D447;MATHEMATICAL ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D448;MATHEMATICAL ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D449;MATHEMATICAL ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D44A;MATHEMATICAL ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D44B;MATHEMATICAL ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D44C;MATHEMATICAL ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D44D;MATHEMATICAL ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D44E;MATHEMATICAL ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D44F;MATHEMATICAL ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D450;MATHEMATICAL ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D451;MATHEMATICAL ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D452;MATHEMATICAL ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D453;MATHEMATICAL ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D454;MATHEMATICAL ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D456;MATHEMATICAL ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D457;MATHEMATICAL ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D458;MATHEMATICAL ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D459;MATHEMATICAL ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D45A;MATHEMATICAL ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D45B;MATHEMATICAL ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D45C;MATHEMATICAL ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D45D;MATHEMATICAL ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D45E;MATHEMATICAL ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D45F;MATHEMATICAL ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D460;MATHEMATICAL ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D461;MATHEMATICAL ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D462;MATHEMATICAL ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D463;MATHEMATICAL ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D464;MATHEMATICAL ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D465;MATHEMATICAL ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D466;MATHEMATICAL ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D467;MATHEMATICAL ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D468;MATHEMATICAL BOLD ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D469;MATHEMATICAL BOLD ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D46A;MATHEMATICAL BOLD ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D46B;MATHEMATICAL BOLD ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D46C;MATHEMATICAL BOLD ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D46D;MATHEMATICAL BOLD ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D46E;MATHEMATICAL BOLD ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D46F;MATHEMATICAL BOLD ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D470;MATHEMATICAL BOLD ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D471;MATHEMATICAL BOLD ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D472;MATHEMATICAL BOLD ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D473;MATHEMATICAL BOLD ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D474;MATHEMATICAL BOLD ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D475;MATHEMATICAL BOLD ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D476;MATHEMATICAL BOLD ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D477;MATHEMATICAL BOLD ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D478;MATHEMATICAL BOLD ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D479;MATHEMATICAL BOLD ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D47A;MATHEMATICAL BOLD ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D47B;MATHEMATICAL BOLD ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D47C;MATHEMATICAL BOLD ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D47D;MATHEMATICAL BOLD ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D47E;MATHEMATICAL BOLD ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D47F;MATHEMATICAL BOLD ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D480;MATHEMATICAL BOLD ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D481;MATHEMATICAL BOLD ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D482;MATHEMATICAL BOLD ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D483;MATHEMATICAL BOLD ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D484;MATHEMATICAL BOLD ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D485;MATHEMATICAL BOLD ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D486;MATHEMATICAL BOLD ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D487;MATHEMATICAL BOLD ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D488;MATHEMATICAL BOLD ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D489;MATHEMATICAL BOLD ITALIC SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D48A;MATHEMATICAL BOLD ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D48B;MATHEMATICAL BOLD ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D48C;MATHEMATICAL BOLD ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D48D;MATHEMATICAL BOLD ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D48E;MATHEMATICAL BOLD ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D48F;MATHEMATICAL BOLD ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D490;MATHEMATICAL BOLD ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D491;MATHEMATICAL BOLD ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D492;MATHEMATICAL BOLD ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D493;MATHEMATICAL BOLD ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D494;MATHEMATICAL BOLD ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D495;MATHEMATICAL BOLD ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D496;MATHEMATICAL BOLD ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D497;MATHEMATICAL BOLD ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D498;MATHEMATICAL BOLD ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D499;MATHEMATICAL BOLD ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D49A;MATHEMATICAL BOLD ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D49B;MATHEMATICAL BOLD ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D49C;MATHEMATICAL SCRIPT CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D49E;MATHEMATICAL SCRIPT CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D49F;MATHEMATICAL SCRIPT CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D4A2;MATHEMATICAL SCRIPT CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D4A5;MATHEMATICAL SCRIPT CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D4A6;MATHEMATICAL SCRIPT CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D4A9;MATHEMATICAL SCRIPT CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D4AA;MATHEMATICAL SCRIPT CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D4AB;MATHEMATICAL SCRIPT CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D4AC;MATHEMATICAL SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D4AE;MATHEMATICAL SCRIPT CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D4AF;MATHEMATICAL SCRIPT CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D4B0;MATHEMATICAL SCRIPT CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D4B1;MATHEMATICAL SCRIPT CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D4B2;MATHEMATICAL SCRIPT CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D4B3;MATHEMATICAL SCRIPT CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D4B4;MATHEMATICAL SCRIPT CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D4B5;MATHEMATICAL SCRIPT CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D4B6;MATHEMATICAL SCRIPT SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D4B7;MATHEMATICAL SCRIPT SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D4B8;MATHEMATICAL SCRIPT SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D4B9;MATHEMATICAL SCRIPT SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D4BB;MATHEMATICAL SCRIPT SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D4BD;MATHEMATICAL SCRIPT SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D4BE;MATHEMATICAL SCRIPT SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D4BF;MATHEMATICAL SCRIPT SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D4C0;MATHEMATICAL SCRIPT SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D4C1;MATHEMATICAL SCRIPT SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D4C2;MATHEMATICAL SCRIPT SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D4C3;MATHEMATICAL SCRIPT SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D4C5;MATHEMATICAL SCRIPT SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D4C6;MATHEMATICAL SCRIPT SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D4C7;MATHEMATICAL SCRIPT SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D4C8;MATHEMATICAL SCRIPT SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D4C9;MATHEMATICAL SCRIPT SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D4CA;MATHEMATICAL SCRIPT SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D4CB;MATHEMATICAL SCRIPT SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D4CC;MATHEMATICAL SCRIPT SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D4CD;MATHEMATICAL SCRIPT SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D4CE;MATHEMATICAL SCRIPT SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D4CF;MATHEMATICAL SCRIPT SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D4D0;MATHEMATICAL BOLD SCRIPT CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D4D1;MATHEMATICAL BOLD SCRIPT CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D4D2;MATHEMATICAL BOLD SCRIPT CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D4D3;MATHEMATICAL BOLD SCRIPT CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D4D4;MATHEMATICAL BOLD SCRIPT CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D4D5;MATHEMATICAL BOLD SCRIPT CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D4D6;MATHEMATICAL BOLD SCRIPT CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D4D7;MATHEMATICAL BOLD SCRIPT CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D4D8;MATHEMATICAL BOLD SCRIPT CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D4D9;MATHEMATICAL BOLD SCRIPT CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D4DA;MATHEMATICAL BOLD SCRIPT CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D4DB;MATHEMATICAL BOLD SCRIPT CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D4DC;MATHEMATICAL BOLD SCRIPT CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D4DD;MATHEMATICAL BOLD SCRIPT CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D4DE;MATHEMATICAL BOLD SCRIPT CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D4DF;MATHEMATICAL BOLD SCRIPT CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D4E0;MATHEMATICAL BOLD SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D4E1;MATHEMATICAL BOLD SCRIPT CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D4E2;MATHEMATICAL BOLD SCRIPT CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D4E3;MATHEMATICAL BOLD SCRIPT CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D4E4;MATHEMATICAL BOLD SCRIPT CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D4E5;MATHEMATICAL BOLD SCRIPT CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D4E6;MATHEMATICAL BOLD SCRIPT CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D4E7;MATHEMATICAL BOLD SCRIPT CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D4E8;MATHEMATICAL BOLD SCRIPT CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D4E9;MATHEMATICAL BOLD SCRIPT CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D4EA;MATHEMATICAL BOLD SCRIPT SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D4EB;MATHEMATICAL BOLD SCRIPT SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D4EC;MATHEMATICAL BOLD SCRIPT SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D4ED;MATHEMATICAL BOLD SCRIPT SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D4EE;MATHEMATICAL BOLD SCRIPT SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D4EF;MATHEMATICAL BOLD SCRIPT SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D4F0;MATHEMATICAL BOLD SCRIPT SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D4F1;MATHEMATICAL BOLD SCRIPT SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D4F2;MATHEMATICAL BOLD SCRIPT SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D4F3;MATHEMATICAL BOLD SCRIPT SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D4F4;MATHEMATICAL BOLD SCRIPT SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D4F5;MATHEMATICAL BOLD SCRIPT SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D4F6;MATHEMATICAL BOLD SCRIPT SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D4F7;MATHEMATICAL BOLD SCRIPT SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D4F8;MATHEMATICAL BOLD SCRIPT SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D4F9;MATHEMATICAL BOLD SCRIPT SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D4FA;MATHEMATICAL BOLD SCRIPT SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D4FB;MATHEMATICAL BOLD SCRIPT SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D4FC;MATHEMATICAL BOLD SCRIPT SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D4FD;MATHEMATICAL BOLD SCRIPT SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D4FE;MATHEMATICAL BOLD SCRIPT SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D4FF;MATHEMATICAL BOLD SCRIPT SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D500;MATHEMATICAL BOLD SCRIPT SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D501;MATHEMATICAL BOLD SCRIPT SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D502;MATHEMATICAL BOLD SCRIPT SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D503;MATHEMATICAL BOLD SCRIPT SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D504;MATHEMATICAL FRAKTUR CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D505;MATHEMATICAL FRAKTUR CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D507;MATHEMATICAL FRAKTUR CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D508;MATHEMATICAL FRAKTUR CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D509;MATHEMATICAL FRAKTUR CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D50A;MATHEMATICAL FRAKTUR CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D50D;MATHEMATICAL FRAKTUR CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D50E;MATHEMATICAL FRAKTUR CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D50F;MATHEMATICAL FRAKTUR CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D510;MATHEMATICAL FRAKTUR CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D511;MATHEMATICAL FRAKTUR CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D512;MATHEMATICAL FRAKTUR CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D513;MATHEMATICAL FRAKTUR CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D514;MATHEMATICAL FRAKTUR CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D516;MATHEMATICAL FRAKTUR CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D517;MATHEMATICAL FRAKTUR CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D518;MATHEMATICAL FRAKTUR CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D519;MATHEMATICAL FRAKTUR CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D51A;MATHEMATICAL FRAKTUR CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D51B;MATHEMATICAL FRAKTUR CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D51C;MATHEMATICAL FRAKTUR CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D51E;MATHEMATICAL FRAKTUR SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D51F;MATHEMATICAL FRAKTUR SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D520;MATHEMATICAL FRAKTUR SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D521;MATHEMATICAL FRAKTUR SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D522;MATHEMATICAL FRAKTUR SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D523;MATHEMATICAL FRAKTUR SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D524;MATHEMATICAL FRAKTUR SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D525;MATHEMATICAL FRAKTUR SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D526;MATHEMATICAL FRAKTUR SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D527;MATHEMATICAL FRAKTUR SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D528;MATHEMATICAL FRAKTUR SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D529;MATHEMATICAL FRAKTUR SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D52A;MATHEMATICAL FRAKTUR SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D52B;MATHEMATICAL FRAKTUR SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D52C;MATHEMATICAL FRAKTUR SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D52D;MATHEMATICAL FRAKTUR SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D52E;MATHEMATICAL FRAKTUR SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D52F;MATHEMATICAL FRAKTUR SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D530;MATHEMATICAL FRAKTUR SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D531;MATHEMATICAL FRAKTUR SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D532;MATHEMATICAL FRAKTUR SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D533;MATHEMATICAL FRAKTUR SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D534;MATHEMATICAL FRAKTUR SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D535;MATHEMATICAL FRAKTUR SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D536;MATHEMATICAL FRAKTUR SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D537;MATHEMATICAL FRAKTUR SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D538;MATHEMATICAL DOUBLE-STRUCK CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D539;MATHEMATICAL DOUBLE-STRUCK CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D53B;MATHEMATICAL DOUBLE-STRUCK CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D53C;MATHEMATICAL DOUBLE-STRUCK CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D53D;MATHEMATICAL DOUBLE-STRUCK CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D53E;MATHEMATICAL DOUBLE-STRUCK CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D540;MATHEMATICAL DOUBLE-STRUCK CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D541;MATHEMATICAL DOUBLE-STRUCK CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D542;MATHEMATICAL DOUBLE-STRUCK CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D543;MATHEMATICAL DOUBLE-STRUCK CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D544;MATHEMATICAL DOUBLE-STRUCK CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D546;MATHEMATICAL DOUBLE-STRUCK CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D54A;MATHEMATICAL DOUBLE-STRUCK CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D54B;MATHEMATICAL DOUBLE-STRUCK CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D54C;MATHEMATICAL DOUBLE-STRUCK CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D54D;MATHEMATICAL DOUBLE-STRUCK CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D54E;MATHEMATICAL DOUBLE-STRUCK CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D54F;MATHEMATICAL DOUBLE-STRUCK CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D550;MATHEMATICAL DOUBLE-STRUCK CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D552;MATHEMATICAL DOUBLE-STRUCK SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D553;MATHEMATICAL DOUBLE-STRUCK SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D554;MATHEMATICAL DOUBLE-STRUCK SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D555;MATHEMATICAL DOUBLE-STRUCK SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D556;MATHEMATICAL DOUBLE-STRUCK SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D557;MATHEMATICAL DOUBLE-STRUCK SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D558;MATHEMATICAL DOUBLE-STRUCK SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D559;MATHEMATICAL DOUBLE-STRUCK SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D55A;MATHEMATICAL DOUBLE-STRUCK SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D55B;MATHEMATICAL DOUBLE-STRUCK SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D55C;MATHEMATICAL DOUBLE-STRUCK SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D55D;MATHEMATICAL DOUBLE-STRUCK SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D55E;MATHEMATICAL DOUBLE-STRUCK SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D55F;MATHEMATICAL DOUBLE-STRUCK SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D560;MATHEMATICAL DOUBLE-STRUCK SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D561;MATHEMATICAL DOUBLE-STRUCK SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D562;MATHEMATICAL DOUBLE-STRUCK SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D563;MATHEMATICAL DOUBLE-STRUCK SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D564;MATHEMATICAL DOUBLE-STRUCK SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D565;MATHEMATICAL DOUBLE-STRUCK SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D566;MATHEMATICAL DOUBLE-STRUCK SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D567;MATHEMATICAL DOUBLE-STRUCK SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D568;MATHEMATICAL DOUBLE-STRUCK SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D569;MATHEMATICAL DOUBLE-STRUCK SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D56A;MATHEMATICAL DOUBLE-STRUCK SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D56B;MATHEMATICAL DOUBLE-STRUCK SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D56C;MATHEMATICAL BOLD FRAKTUR CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D56D;MATHEMATICAL BOLD FRAKTUR CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D56E;MATHEMATICAL BOLD FRAKTUR CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D56F;MATHEMATICAL BOLD FRAKTUR CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D570;MATHEMATICAL BOLD FRAKTUR CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D571;MATHEMATICAL BOLD FRAKTUR CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D572;MATHEMATICAL BOLD FRAKTUR CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D573;MATHEMATICAL BOLD FRAKTUR CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D574;MATHEMATICAL BOLD FRAKTUR CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D575;MATHEMATICAL BOLD FRAKTUR CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D576;MATHEMATICAL BOLD FRAKTUR CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D577;MATHEMATICAL BOLD FRAKTUR CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D578;MATHEMATICAL BOLD FRAKTUR CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D579;MATHEMATICAL BOLD FRAKTUR CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D57A;MATHEMATICAL BOLD FRAKTUR CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D57B;MATHEMATICAL BOLD FRAKTUR CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D57C;MATHEMATICAL BOLD FRAKTUR CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D57D;MATHEMATICAL BOLD FRAKTUR CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D57E;MATHEMATICAL BOLD FRAKTUR CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D57F;MATHEMATICAL BOLD FRAKTUR CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D580;MATHEMATICAL BOLD FRAKTUR CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D581;MATHEMATICAL BOLD FRAKTUR CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D582;MATHEMATICAL BOLD FRAKTUR CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D583;MATHEMATICAL BOLD FRAKTUR CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D584;MATHEMATICAL BOLD FRAKTUR CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D585;MATHEMATICAL BOLD FRAKTUR CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D586;MATHEMATICAL BOLD FRAKTUR SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D587;MATHEMATICAL BOLD FRAKTUR SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D588;MATHEMATICAL BOLD FRAKTUR SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D589;MATHEMATICAL BOLD FRAKTUR SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D58A;MATHEMATICAL BOLD FRAKTUR SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D58B;MATHEMATICAL BOLD FRAKTUR SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D58C;MATHEMATICAL BOLD FRAKTUR SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D58D;MATHEMATICAL BOLD FRAKTUR SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D58E;MATHEMATICAL BOLD FRAKTUR SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D58F;MATHEMATICAL BOLD FRAKTUR SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D590;MATHEMATICAL BOLD FRAKTUR SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D591;MATHEMATICAL BOLD FRAKTUR SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D592;MATHEMATICAL BOLD FRAKTUR SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D593;MATHEMATICAL BOLD FRAKTUR SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D594;MATHEMATICAL BOLD FRAKTUR SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D595;MATHEMATICAL BOLD FRAKTUR SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D596;MATHEMATICAL BOLD FRAKTUR SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D597;MATHEMATICAL BOLD FRAKTUR SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D598;MATHEMATICAL BOLD FRAKTUR SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D599;MATHEMATICAL BOLD FRAKTUR SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D59A;MATHEMATICAL BOLD FRAKTUR SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D59B;MATHEMATICAL BOLD FRAKTUR SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D59C;MATHEMATICAL BOLD FRAKTUR SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D59D;MATHEMATICAL BOLD FRAKTUR SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D59E;MATHEMATICAL BOLD FRAKTUR SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D59F;MATHEMATICAL BOLD FRAKTUR SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D5A0;MATHEMATICAL SANS-SERIF CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D5A1;MATHEMATICAL SANS-SERIF CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D5A2;MATHEMATICAL SANS-SERIF CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D5A3;MATHEMATICAL SANS-SERIF CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D5A4;MATHEMATICAL SANS-SERIF CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D5A5;MATHEMATICAL SANS-SERIF CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D5A6;MATHEMATICAL SANS-SERIF CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D5A7;MATHEMATICAL SANS-SERIF CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D5A8;MATHEMATICAL SANS-SERIF CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D5A9;MATHEMATICAL SANS-SERIF CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D5AA;MATHEMATICAL SANS-SERIF CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D5AB;MATHEMATICAL SANS-SERIF CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D5AC;MATHEMATICAL SANS-SERIF CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D5AD;MATHEMATICAL SANS-SERIF CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D5AE;MATHEMATICAL SANS-SERIF CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D5AF;MATHEMATICAL SANS-SERIF CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D5B0;MATHEMATICAL SANS-SERIF CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D5B1;MATHEMATICAL SANS-SERIF CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D5B2;MATHEMATICAL SANS-SERIF CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D5B3;MATHEMATICAL SANS-SERIF CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D5B4;MATHEMATICAL SANS-SERIF CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D5B5;MATHEMATICAL SANS-SERIF CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D5B6;MATHEMATICAL SANS-SERIF CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D5B7;MATHEMATICAL SANS-SERIF CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D5B8;MATHEMATICAL SANS-SERIF CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D5B9;MATHEMATICAL SANS-SERIF CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D5BA;MATHEMATICAL SANS-SERIF SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D5BB;MATHEMATICAL SANS-SERIF SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D5BC;MATHEMATICAL SANS-SERIF SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D5BD;MATHEMATICAL SANS-SERIF SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D5BE;MATHEMATICAL SANS-SERIF SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D5BF;MATHEMATICAL SANS-SERIF SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D5C0;MATHEMATICAL SANS-SERIF SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D5C1;MATHEMATICAL SANS-SERIF SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D5C2;MATHEMATICAL SANS-SERIF SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D5C3;MATHEMATICAL SANS-SERIF SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D5C4;MATHEMATICAL SANS-SERIF SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D5C5;MATHEMATICAL SANS-SERIF SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D5C6;MATHEMATICAL SANS-SERIF SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D5C7;MATHEMATICAL SANS-SERIF SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D5C8;MATHEMATICAL SANS-SERIF SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D5C9;MATHEMATICAL SANS-SERIF SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D5CA;MATHEMATICAL SANS-SERIF SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D5CB;MATHEMATICAL SANS-SERIF SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D5CC;MATHEMATICAL SANS-SERIF SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D5CD;MATHEMATICAL SANS-SERIF SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D5CE;MATHEMATICAL SANS-SERIF SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D5CF;MATHEMATICAL SANS-SERIF SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D5D0;MATHEMATICAL SANS-SERIF SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D5D1;MATHEMATICAL SANS-SERIF SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D5D2;MATHEMATICAL SANS-SERIF SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D5D3;MATHEMATICAL SANS-SERIF SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D5D4;MATHEMATICAL SANS-SERIF BOLD CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D5D5;MATHEMATICAL SANS-SERIF BOLD CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D5D6;MATHEMATICAL SANS-SERIF BOLD CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D5D7;MATHEMATICAL SANS-SERIF BOLD CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D5D8;MATHEMATICAL SANS-SERIF BOLD CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D5D9;MATHEMATICAL SANS-SERIF BOLD CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D5DA;MATHEMATICAL SANS-SERIF BOLD CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D5DB;MATHEMATICAL SANS-SERIF BOLD CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D5DC;MATHEMATICAL SANS-SERIF BOLD CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D5DD;MATHEMATICAL SANS-SERIF BOLD CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D5DE;MATHEMATICAL SANS-SERIF BOLD CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D5DF;MATHEMATICAL SANS-SERIF BOLD CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D5E0;MATHEMATICAL SANS-SERIF BOLD CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D5E1;MATHEMATICAL SANS-SERIF BOLD CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D5E2;MATHEMATICAL SANS-SERIF BOLD CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D5E3;MATHEMATICAL SANS-SERIF BOLD CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D5E4;MATHEMATICAL SANS-SERIF BOLD CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D5E5;MATHEMATICAL SANS-SERIF BOLD CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D5E6;MATHEMATICAL SANS-SERIF BOLD CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D5E7;MATHEMATICAL SANS-SERIF BOLD CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D5E8;MATHEMATICAL SANS-SERIF BOLD CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D5E9;MATHEMATICAL SANS-SERIF BOLD CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D5EA;MATHEMATICAL SANS-SERIF BOLD CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D5EB;MATHEMATICAL SANS-SERIF BOLD CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D5EC;MATHEMATICAL SANS-SERIF BOLD CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D5ED;MATHEMATICAL SANS-SERIF BOLD CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D5EE;MATHEMATICAL SANS-SERIF BOLD SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D5EF;MATHEMATICAL SANS-SERIF BOLD SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D5F0;MATHEMATICAL SANS-SERIF BOLD SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D5F1;MATHEMATICAL SANS-SERIF BOLD SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D5F2;MATHEMATICAL SANS-SERIF BOLD SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D5F3;MATHEMATICAL SANS-SERIF BOLD SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D5F4;MATHEMATICAL SANS-SERIF BOLD SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D5F5;MATHEMATICAL SANS-SERIF BOLD SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D5F6;MATHEMATICAL SANS-SERIF BOLD SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D5F7;MATHEMATICAL SANS-SERIF BOLD SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D5F8;MATHEMATICAL SANS-SERIF BOLD SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D5F9;MATHEMATICAL SANS-SERIF BOLD SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D5FA;MATHEMATICAL SANS-SERIF BOLD SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D5FB;MATHEMATICAL SANS-SERIF BOLD SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D5FC;MATHEMATICAL SANS-SERIF BOLD SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D5FD;MATHEMATICAL SANS-SERIF BOLD SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D5FE;MATHEMATICAL SANS-SERIF BOLD SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D5FF;MATHEMATICAL SANS-SERIF BOLD SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D600;MATHEMATICAL SANS-SERIF BOLD SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D601;MATHEMATICAL SANS-SERIF BOLD SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D602;MATHEMATICAL SANS-SERIF BOLD SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D603;MATHEMATICAL SANS-SERIF BOLD SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D604;MATHEMATICAL SANS-SERIF BOLD SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D605;MATHEMATICAL SANS-SERIF BOLD SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D606;MATHEMATICAL SANS-SERIF BOLD SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D607;MATHEMATICAL SANS-SERIF BOLD SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D608;MATHEMATICAL SANS-SERIF ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D609;MATHEMATICAL SANS-SERIF ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D60A;MATHEMATICAL SANS-SERIF ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D60B;MATHEMATICAL SANS-SERIF ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D60C;MATHEMATICAL SANS-SERIF ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D60D;MATHEMATICAL SANS-SERIF ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D60E;MATHEMATICAL SANS-SERIF ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D60F;MATHEMATICAL SANS-SERIF ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D610;MATHEMATICAL SANS-SERIF ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D611;MATHEMATICAL SANS-SERIF ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D612;MATHEMATICAL SANS-SERIF ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D613;MATHEMATICAL SANS-SERIF ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D614;MATHEMATICAL SANS-SERIF ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D615;MATHEMATICAL SANS-SERIF ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D616;MATHEMATICAL SANS-SERIF ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D617;MATHEMATICAL SANS-SERIF ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D618;MATHEMATICAL SANS-SERIF ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D619;MATHEMATICAL SANS-SERIF ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D61A;MATHEMATICAL SANS-SERIF ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D61B;MATHEMATICAL SANS-SERIF ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D61C;MATHEMATICAL SANS-SERIF ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D61D;MATHEMATICAL SANS-SERIF ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D61E;MATHEMATICAL SANS-SERIF ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D61F;MATHEMATICAL SANS-SERIF ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D620;MATHEMATICAL SANS-SERIF ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D621;MATHEMATICAL SANS-SERIF ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D622;MATHEMATICAL SANS-SERIF ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D623;MATHEMATICAL SANS-SERIF ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D624;MATHEMATICAL SANS-SERIF ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D625;MATHEMATICAL SANS-SERIF ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D626;MATHEMATICAL SANS-SERIF ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D627;MATHEMATICAL SANS-SERIF ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D628;MATHEMATICAL SANS-SERIF ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D629;MATHEMATICAL SANS-SERIF ITALIC SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D62A;MATHEMATICAL SANS-SERIF ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D62B;MATHEMATICAL SANS-SERIF ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D62C;MATHEMATICAL SANS-SERIF ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D62D;MATHEMATICAL SANS-SERIF ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D62E;MATHEMATICAL SANS-SERIF ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D62F;MATHEMATICAL SANS-SERIF ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D630;MATHEMATICAL SANS-SERIF ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D631;MATHEMATICAL SANS-SERIF ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D632;MATHEMATICAL SANS-SERIF ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D633;MATHEMATICAL SANS-SERIF ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D634;MATHEMATICAL SANS-SERIF ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D635;MATHEMATICAL SANS-SERIF ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D636;MATHEMATICAL SANS-SERIF ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D637;MATHEMATICAL SANS-SERIF ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D638;MATHEMATICAL SANS-SERIF ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D639;MATHEMATICAL SANS-SERIF ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D63A;MATHEMATICAL SANS-SERIF ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D63B;MATHEMATICAL SANS-SERIF ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D63C;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D63D;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D63E;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D63F;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D640;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D641;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D642;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D643;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D644;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D645;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D646;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D647;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D648;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D649;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D64A;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D64B;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D64C;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D64D;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D64E;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D64F;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D650;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D651;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D652;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D653;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D654;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D655;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D656;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D657;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D658;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D659;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D65A;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D65B;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D65C;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D65D;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D65E;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D65F;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D660;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D661;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D662;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D663;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D664;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D665;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D666;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D667;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D668;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D669;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D66A;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D66B;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D66C;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D66D;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D66E;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D66F;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D670;MATHEMATICAL MONOSPACE CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;; +1D671;MATHEMATICAL MONOSPACE CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;; +1D672;MATHEMATICAL MONOSPACE CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;; +1D673;MATHEMATICAL MONOSPACE CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;; +1D674;MATHEMATICAL MONOSPACE CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;; +1D675;MATHEMATICAL MONOSPACE CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;; +1D676;MATHEMATICAL MONOSPACE CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;; +1D677;MATHEMATICAL MONOSPACE CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;; +1D678;MATHEMATICAL MONOSPACE CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;; +1D679;MATHEMATICAL MONOSPACE CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;; +1D67A;MATHEMATICAL MONOSPACE CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;; +1D67B;MATHEMATICAL MONOSPACE CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;; +1D67C;MATHEMATICAL MONOSPACE CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;; +1D67D;MATHEMATICAL MONOSPACE CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;; +1D67E;MATHEMATICAL MONOSPACE CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;; +1D67F;MATHEMATICAL MONOSPACE CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;; +1D680;MATHEMATICAL MONOSPACE CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;; +1D681;MATHEMATICAL MONOSPACE CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;; +1D682;MATHEMATICAL MONOSPACE CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;; +1D683;MATHEMATICAL MONOSPACE CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;; +1D684;MATHEMATICAL MONOSPACE CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;; +1D685;MATHEMATICAL MONOSPACE CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;; +1D686;MATHEMATICAL MONOSPACE CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;; +1D687;MATHEMATICAL MONOSPACE CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;; +1D688;MATHEMATICAL MONOSPACE CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;; +1D689;MATHEMATICAL MONOSPACE CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;; +1D68A;MATHEMATICAL MONOSPACE SMALL A;Ll;0;L;<font> 0061;;;;N;;;;; +1D68B;MATHEMATICAL MONOSPACE SMALL B;Ll;0;L;<font> 0062;;;;N;;;;; +1D68C;MATHEMATICAL MONOSPACE SMALL C;Ll;0;L;<font> 0063;;;;N;;;;; +1D68D;MATHEMATICAL MONOSPACE SMALL D;Ll;0;L;<font> 0064;;;;N;;;;; +1D68E;MATHEMATICAL MONOSPACE SMALL E;Ll;0;L;<font> 0065;;;;N;;;;; +1D68F;MATHEMATICAL MONOSPACE SMALL F;Ll;0;L;<font> 0066;;;;N;;;;; +1D690;MATHEMATICAL MONOSPACE SMALL G;Ll;0;L;<font> 0067;;;;N;;;;; +1D691;MATHEMATICAL MONOSPACE SMALL H;Ll;0;L;<font> 0068;;;;N;;;;; +1D692;MATHEMATICAL MONOSPACE SMALL I;Ll;0;L;<font> 0069;;;;N;;;;; +1D693;MATHEMATICAL MONOSPACE SMALL J;Ll;0;L;<font> 006A;;;;N;;;;; +1D694;MATHEMATICAL MONOSPACE SMALL K;Ll;0;L;<font> 006B;;;;N;;;;; +1D695;MATHEMATICAL MONOSPACE SMALL L;Ll;0;L;<font> 006C;;;;N;;;;; +1D696;MATHEMATICAL MONOSPACE SMALL M;Ll;0;L;<font> 006D;;;;N;;;;; +1D697;MATHEMATICAL MONOSPACE SMALL N;Ll;0;L;<font> 006E;;;;N;;;;; +1D698;MATHEMATICAL MONOSPACE SMALL O;Ll;0;L;<font> 006F;;;;N;;;;; +1D699;MATHEMATICAL MONOSPACE SMALL P;Ll;0;L;<font> 0070;;;;N;;;;; +1D69A;MATHEMATICAL MONOSPACE SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;; +1D69B;MATHEMATICAL MONOSPACE SMALL R;Ll;0;L;<font> 0072;;;;N;;;;; +1D69C;MATHEMATICAL MONOSPACE SMALL S;Ll;0;L;<font> 0073;;;;N;;;;; +1D69D;MATHEMATICAL MONOSPACE SMALL T;Ll;0;L;<font> 0074;;;;N;;;;; +1D69E;MATHEMATICAL MONOSPACE SMALL U;Ll;0;L;<font> 0075;;;;N;;;;; +1D69F;MATHEMATICAL MONOSPACE SMALL V;Ll;0;L;<font> 0076;;;;N;;;;; +1D6A0;MATHEMATICAL MONOSPACE SMALL W;Ll;0;L;<font> 0077;;;;N;;;;; +1D6A1;MATHEMATICAL MONOSPACE SMALL X;Ll;0;L;<font> 0078;;;;N;;;;; +1D6A2;MATHEMATICAL MONOSPACE SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;; +1D6A3;MATHEMATICAL MONOSPACE SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;; +1D6A4;MATHEMATICAL ITALIC SMALL DOTLESS I;Ll;0;L;<font> 0131;;;;N;;;;; +1D6A5;MATHEMATICAL ITALIC SMALL DOTLESS J;Ll;0;L;<font> 0237;;;;N;;;;; +1D6A8;MATHEMATICAL BOLD CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;; +1D6A9;MATHEMATICAL BOLD CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;; +1D6AA;MATHEMATICAL BOLD CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;; +1D6AB;MATHEMATICAL BOLD CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;; +1D6AC;MATHEMATICAL BOLD CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;; +1D6AD;MATHEMATICAL BOLD CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;; +1D6AE;MATHEMATICAL BOLD CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;; +1D6AF;MATHEMATICAL BOLD CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;; +1D6B0;MATHEMATICAL BOLD CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;; +1D6B1;MATHEMATICAL BOLD CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;; +1D6B2;MATHEMATICAL BOLD CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;; +1D6B3;MATHEMATICAL BOLD CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;; +1D6B4;MATHEMATICAL BOLD CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;; +1D6B5;MATHEMATICAL BOLD CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;; +1D6B6;MATHEMATICAL BOLD CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;; +1D6B7;MATHEMATICAL BOLD CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;; +1D6B8;MATHEMATICAL BOLD CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;; +1D6B9;MATHEMATICAL BOLD CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;; +1D6BA;MATHEMATICAL BOLD CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;; +1D6BB;MATHEMATICAL BOLD CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;; +1D6BC;MATHEMATICAL BOLD CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;; +1D6BD;MATHEMATICAL BOLD CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;; +1D6BE;MATHEMATICAL BOLD CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;; +1D6BF;MATHEMATICAL BOLD CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;; +1D6C0;MATHEMATICAL BOLD CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;; +1D6C1;MATHEMATICAL BOLD NABLA;Sm;0;L;<font> 2207;;;;N;;;;; +1D6C2;MATHEMATICAL BOLD SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;; +1D6C3;MATHEMATICAL BOLD SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;; +1D6C4;MATHEMATICAL BOLD SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;; +1D6C5;MATHEMATICAL BOLD SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;; +1D6C6;MATHEMATICAL BOLD SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;; +1D6C7;MATHEMATICAL BOLD SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;; +1D6C8;MATHEMATICAL BOLD SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;; +1D6C9;MATHEMATICAL BOLD SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;; +1D6CA;MATHEMATICAL BOLD SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;; +1D6CB;MATHEMATICAL BOLD SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;; +1D6CC;MATHEMATICAL BOLD SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;; +1D6CD;MATHEMATICAL BOLD SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;; +1D6CE;MATHEMATICAL BOLD SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;; +1D6CF;MATHEMATICAL BOLD SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;; +1D6D0;MATHEMATICAL BOLD SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;; +1D6D1;MATHEMATICAL BOLD SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;; +1D6D2;MATHEMATICAL BOLD SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;; +1D6D3;MATHEMATICAL BOLD SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;; +1D6D4;MATHEMATICAL BOLD SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;; +1D6D5;MATHEMATICAL BOLD SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;; +1D6D6;MATHEMATICAL BOLD SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;; +1D6D7;MATHEMATICAL BOLD SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;; +1D6D8;MATHEMATICAL BOLD SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;; +1D6D9;MATHEMATICAL BOLD SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;; +1D6DA;MATHEMATICAL BOLD SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;; +1D6DB;MATHEMATICAL BOLD PARTIAL DIFFERENTIAL;Sm;0;ON;<font> 2202;;;;Y;;;;; +1D6DC;MATHEMATICAL BOLD EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;; +1D6DD;MATHEMATICAL BOLD THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;; +1D6DE;MATHEMATICAL BOLD KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;; +1D6DF;MATHEMATICAL BOLD PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;; +1D6E0;MATHEMATICAL BOLD RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;; +1D6E1;MATHEMATICAL BOLD PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;; +1D6E2;MATHEMATICAL ITALIC CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;; +1D6E3;MATHEMATICAL ITALIC CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;; +1D6E4;MATHEMATICAL ITALIC CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;; +1D6E5;MATHEMATICAL ITALIC CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;; +1D6E6;MATHEMATICAL ITALIC CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;; +1D6E7;MATHEMATICAL ITALIC CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;; +1D6E8;MATHEMATICAL ITALIC CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;; +1D6E9;MATHEMATICAL ITALIC CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;; +1D6EA;MATHEMATICAL ITALIC CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;; +1D6EB;MATHEMATICAL ITALIC CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;; +1D6EC;MATHEMATICAL ITALIC CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;; +1D6ED;MATHEMATICAL ITALIC CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;; +1D6EE;MATHEMATICAL ITALIC CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;; +1D6EF;MATHEMATICAL ITALIC CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;; +1D6F0;MATHEMATICAL ITALIC CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;; +1D6F1;MATHEMATICAL ITALIC CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;; +1D6F2;MATHEMATICAL ITALIC CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;; +1D6F3;MATHEMATICAL ITALIC CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;; +1D6F4;MATHEMATICAL ITALIC CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;; +1D6F5;MATHEMATICAL ITALIC CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;; +1D6F6;MATHEMATICAL ITALIC CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;; +1D6F7;MATHEMATICAL ITALIC CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;; +1D6F8;MATHEMATICAL ITALIC CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;; +1D6F9;MATHEMATICAL ITALIC CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;; +1D6FA;MATHEMATICAL ITALIC CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;; +1D6FB;MATHEMATICAL ITALIC NABLA;Sm;0;L;<font> 2207;;;;N;;;;; +1D6FC;MATHEMATICAL ITALIC SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;; +1D6FD;MATHEMATICAL ITALIC SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;; +1D6FE;MATHEMATICAL ITALIC SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;; +1D6FF;MATHEMATICAL ITALIC SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;; +1D700;MATHEMATICAL ITALIC SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;; +1D701;MATHEMATICAL ITALIC SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;; +1D702;MATHEMATICAL ITALIC SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;; +1D703;MATHEMATICAL ITALIC SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;; +1D704;MATHEMATICAL ITALIC SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;; +1D705;MATHEMATICAL ITALIC SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;; +1D706;MATHEMATICAL ITALIC SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;; +1D707;MATHEMATICAL ITALIC SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;; +1D708;MATHEMATICAL ITALIC SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;; +1D709;MATHEMATICAL ITALIC SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;; +1D70A;MATHEMATICAL ITALIC SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;; +1D70B;MATHEMATICAL ITALIC SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;; +1D70C;MATHEMATICAL ITALIC SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;; +1D70D;MATHEMATICAL ITALIC SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;; +1D70E;MATHEMATICAL ITALIC SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;; +1D70F;MATHEMATICAL ITALIC SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;; +1D710;MATHEMATICAL ITALIC SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;; +1D711;MATHEMATICAL ITALIC SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;; +1D712;MATHEMATICAL ITALIC SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;; +1D713;MATHEMATICAL ITALIC SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;; +1D714;MATHEMATICAL ITALIC SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;; +1D715;MATHEMATICAL ITALIC PARTIAL DIFFERENTIAL;Sm;0;ON;<font> 2202;;;;Y;;;;; +1D716;MATHEMATICAL ITALIC EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;; +1D717;MATHEMATICAL ITALIC THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;; +1D718;MATHEMATICAL ITALIC KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;; +1D719;MATHEMATICAL ITALIC PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;; +1D71A;MATHEMATICAL ITALIC RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;; +1D71B;MATHEMATICAL ITALIC PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;; +1D71C;MATHEMATICAL BOLD ITALIC CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;; +1D71D;MATHEMATICAL BOLD ITALIC CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;; +1D71E;MATHEMATICAL BOLD ITALIC CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;; +1D71F;MATHEMATICAL BOLD ITALIC CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;; +1D720;MATHEMATICAL BOLD ITALIC CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;; +1D721;MATHEMATICAL BOLD ITALIC CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;; +1D722;MATHEMATICAL BOLD ITALIC CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;; +1D723;MATHEMATICAL BOLD ITALIC CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;; +1D724;MATHEMATICAL BOLD ITALIC CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;; +1D725;MATHEMATICAL BOLD ITALIC CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;; +1D726;MATHEMATICAL BOLD ITALIC CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;; +1D727;MATHEMATICAL BOLD ITALIC CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;; +1D728;MATHEMATICAL BOLD ITALIC CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;; +1D729;MATHEMATICAL BOLD ITALIC CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;; +1D72A;MATHEMATICAL BOLD ITALIC CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;; +1D72B;MATHEMATICAL BOLD ITALIC CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;; +1D72C;MATHEMATICAL BOLD ITALIC CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;; +1D72D;MATHEMATICAL BOLD ITALIC CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;; +1D72E;MATHEMATICAL BOLD ITALIC CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;; +1D72F;MATHEMATICAL BOLD ITALIC CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;; +1D730;MATHEMATICAL BOLD ITALIC CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;; +1D731;MATHEMATICAL BOLD ITALIC CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;; +1D732;MATHEMATICAL BOLD ITALIC CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;; +1D733;MATHEMATICAL BOLD ITALIC CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;; +1D734;MATHEMATICAL BOLD ITALIC CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;; +1D735;MATHEMATICAL BOLD ITALIC NABLA;Sm;0;L;<font> 2207;;;;N;;;;; +1D736;MATHEMATICAL BOLD ITALIC SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;; +1D737;MATHEMATICAL BOLD ITALIC SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;; +1D738;MATHEMATICAL BOLD ITALIC SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;; +1D739;MATHEMATICAL BOLD ITALIC SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;; +1D73A;MATHEMATICAL BOLD ITALIC SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;; +1D73B;MATHEMATICAL BOLD ITALIC SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;; +1D73C;MATHEMATICAL BOLD ITALIC SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;; +1D73D;MATHEMATICAL BOLD ITALIC SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;; +1D73E;MATHEMATICAL BOLD ITALIC SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;; +1D73F;MATHEMATICAL BOLD ITALIC SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;; +1D740;MATHEMATICAL BOLD ITALIC SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;; +1D741;MATHEMATICAL BOLD ITALIC SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;; +1D742;MATHEMATICAL BOLD ITALIC SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;; +1D743;MATHEMATICAL BOLD ITALIC SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;; +1D744;MATHEMATICAL BOLD ITALIC SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;; +1D745;MATHEMATICAL BOLD ITALIC SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;; +1D746;MATHEMATICAL BOLD ITALIC SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;; +1D747;MATHEMATICAL BOLD ITALIC SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;; +1D748;MATHEMATICAL BOLD ITALIC SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;; +1D749;MATHEMATICAL BOLD ITALIC SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;; +1D74A;MATHEMATICAL BOLD ITALIC SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;; +1D74B;MATHEMATICAL BOLD ITALIC SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;; +1D74C;MATHEMATICAL BOLD ITALIC SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;; +1D74D;MATHEMATICAL BOLD ITALIC SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;; +1D74E;MATHEMATICAL BOLD ITALIC SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;; +1D74F;MATHEMATICAL BOLD ITALIC PARTIAL DIFFERENTIAL;Sm;0;ON;<font> 2202;;;;Y;;;;; +1D750;MATHEMATICAL BOLD ITALIC EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;; +1D751;MATHEMATICAL BOLD ITALIC THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;; +1D752;MATHEMATICAL BOLD ITALIC KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;; +1D753;MATHEMATICAL BOLD ITALIC PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;; +1D754;MATHEMATICAL BOLD ITALIC RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;; +1D755;MATHEMATICAL BOLD ITALIC PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;; +1D756;MATHEMATICAL SANS-SERIF BOLD CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;; +1D757;MATHEMATICAL SANS-SERIF BOLD CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;; +1D758;MATHEMATICAL SANS-SERIF BOLD CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;; +1D759;MATHEMATICAL SANS-SERIF BOLD CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;; +1D75A;MATHEMATICAL SANS-SERIF BOLD CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;; +1D75B;MATHEMATICAL SANS-SERIF BOLD CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;; +1D75C;MATHEMATICAL SANS-SERIF BOLD CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;; +1D75D;MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;; +1D75E;MATHEMATICAL SANS-SERIF BOLD CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;; +1D75F;MATHEMATICAL SANS-SERIF BOLD CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;; +1D760;MATHEMATICAL SANS-SERIF BOLD CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;; +1D761;MATHEMATICAL SANS-SERIF BOLD CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;; +1D762;MATHEMATICAL SANS-SERIF BOLD CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;; +1D763;MATHEMATICAL SANS-SERIF BOLD CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;; +1D764;MATHEMATICAL SANS-SERIF BOLD CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;; +1D765;MATHEMATICAL SANS-SERIF BOLD CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;; +1D766;MATHEMATICAL SANS-SERIF BOLD CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;; +1D767;MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;; +1D768;MATHEMATICAL SANS-SERIF BOLD CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;; +1D769;MATHEMATICAL SANS-SERIF BOLD CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;; +1D76A;MATHEMATICAL SANS-SERIF BOLD CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;; +1D76B;MATHEMATICAL SANS-SERIF BOLD CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;; +1D76C;MATHEMATICAL SANS-SERIF BOLD CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;; +1D76D;MATHEMATICAL SANS-SERIF BOLD CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;; +1D76E;MATHEMATICAL SANS-SERIF BOLD CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;; +1D76F;MATHEMATICAL SANS-SERIF BOLD NABLA;Sm;0;L;<font> 2207;;;;N;;;;; +1D770;MATHEMATICAL SANS-SERIF BOLD SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;; +1D771;MATHEMATICAL SANS-SERIF BOLD SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;; +1D772;MATHEMATICAL SANS-SERIF BOLD SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;; +1D773;MATHEMATICAL SANS-SERIF BOLD SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;; +1D774;MATHEMATICAL SANS-SERIF BOLD SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;; +1D775;MATHEMATICAL SANS-SERIF BOLD SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;; +1D776;MATHEMATICAL SANS-SERIF BOLD SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;; +1D777;MATHEMATICAL SANS-SERIF BOLD SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;; +1D778;MATHEMATICAL SANS-SERIF BOLD SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;; +1D779;MATHEMATICAL SANS-SERIF BOLD SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;; +1D77A;MATHEMATICAL SANS-SERIF BOLD SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;; +1D77B;MATHEMATICAL SANS-SERIF BOLD SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;; +1D77C;MATHEMATICAL SANS-SERIF BOLD SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;; +1D77D;MATHEMATICAL SANS-SERIF BOLD SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;; +1D77E;MATHEMATICAL SANS-SERIF BOLD SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;; +1D77F;MATHEMATICAL SANS-SERIF BOLD SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;; +1D780;MATHEMATICAL SANS-SERIF BOLD SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;; +1D781;MATHEMATICAL SANS-SERIF BOLD SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;; +1D782;MATHEMATICAL SANS-SERIF BOLD SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;; +1D783;MATHEMATICAL SANS-SERIF BOLD SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;; +1D784;MATHEMATICAL SANS-SERIF BOLD SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;; +1D785;MATHEMATICAL SANS-SERIF BOLD SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;; +1D786;MATHEMATICAL SANS-SERIF BOLD SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;; +1D787;MATHEMATICAL SANS-SERIF BOLD SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;; +1D788;MATHEMATICAL SANS-SERIF BOLD SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;; +1D789;MATHEMATICAL SANS-SERIF BOLD PARTIAL DIFFERENTIAL;Sm;0;ON;<font> 2202;;;;Y;;;;; +1D78A;MATHEMATICAL SANS-SERIF BOLD EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;; +1D78B;MATHEMATICAL SANS-SERIF BOLD THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;; +1D78C;MATHEMATICAL SANS-SERIF BOLD KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;; +1D78D;MATHEMATICAL SANS-SERIF BOLD PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;; +1D78E;MATHEMATICAL SANS-SERIF BOLD RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;; +1D78F;MATHEMATICAL SANS-SERIF BOLD PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;; +1D790;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;; +1D791;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;; +1D792;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;; +1D793;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;; +1D794;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;; +1D795;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;; +1D796;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;; +1D797;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;; +1D798;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;; +1D799;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;; +1D79A;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;; +1D79B;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;; +1D79C;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;; +1D79D;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;; +1D79E;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;; +1D79F;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;; +1D7A0;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;; +1D7A1;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;; +1D7A2;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;; +1D7A3;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;; +1D7A4;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;; +1D7A5;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;; +1D7A6;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;; +1D7A7;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;; +1D7A8;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;; +1D7A9;MATHEMATICAL SANS-SERIF BOLD ITALIC NABLA;Sm;0;L;<font> 2207;;;;N;;;;; +1D7AA;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;; +1D7AB;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;; +1D7AC;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;; +1D7AD;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;; +1D7AE;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;; +1D7AF;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;; +1D7B0;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;; +1D7B1;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;; +1D7B2;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;; +1D7B3;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;; +1D7B4;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;; +1D7B5;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;; +1D7B6;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;; +1D7B7;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;; +1D7B8;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;; +1D7B9;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;; +1D7BA;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;; +1D7BB;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;; +1D7BC;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;; +1D7BD;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;; +1D7BE;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;; +1D7BF;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;; +1D7C0;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;; +1D7C1;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;; +1D7C2;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;; +1D7C3;MATHEMATICAL SANS-SERIF BOLD ITALIC PARTIAL DIFFERENTIAL;Sm;0;ON;<font> 2202;;;;Y;;;;; +1D7C4;MATHEMATICAL SANS-SERIF BOLD ITALIC EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;; +1D7C5;MATHEMATICAL SANS-SERIF BOLD ITALIC THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;; +1D7C6;MATHEMATICAL SANS-SERIF BOLD ITALIC KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;; +1D7C7;MATHEMATICAL SANS-SERIF BOLD ITALIC PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;; +1D7C8;MATHEMATICAL SANS-SERIF BOLD ITALIC RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;; +1D7C9;MATHEMATICAL SANS-SERIF BOLD ITALIC PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;; +1D7CA;MATHEMATICAL BOLD CAPITAL DIGAMMA;Lu;0;L;<font> 03DC;;;;N;;;;; +1D7CB;MATHEMATICAL BOLD SMALL DIGAMMA;Ll;0;L;<font> 03DD;;;;N;;;;; +1D7CE;MATHEMATICAL BOLD DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;; +1D7CF;MATHEMATICAL BOLD DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;; +1D7D0;MATHEMATICAL BOLD DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;; +1D7D1;MATHEMATICAL BOLD DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;; +1D7D2;MATHEMATICAL BOLD DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;; +1D7D3;MATHEMATICAL BOLD DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;; +1D7D4;MATHEMATICAL BOLD DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;; +1D7D5;MATHEMATICAL BOLD DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;; +1D7D6;MATHEMATICAL BOLD DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;; +1D7D7;MATHEMATICAL BOLD DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;; +1D7D8;MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;; +1D7D9;MATHEMATICAL DOUBLE-STRUCK DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;; +1D7DA;MATHEMATICAL DOUBLE-STRUCK DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;; +1D7DB;MATHEMATICAL DOUBLE-STRUCK DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;; +1D7DC;MATHEMATICAL DOUBLE-STRUCK DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;; +1D7DD;MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;; +1D7DE;MATHEMATICAL DOUBLE-STRUCK DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;; +1D7DF;MATHEMATICAL DOUBLE-STRUCK DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;; +1D7E0;MATHEMATICAL DOUBLE-STRUCK DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;; +1D7E1;MATHEMATICAL DOUBLE-STRUCK DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;; +1D7E2;MATHEMATICAL SANS-SERIF DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;; +1D7E3;MATHEMATICAL SANS-SERIF DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;; +1D7E4;MATHEMATICAL SANS-SERIF DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;; +1D7E5;MATHEMATICAL SANS-SERIF DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;; +1D7E6;MATHEMATICAL SANS-SERIF DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;; +1D7E7;MATHEMATICAL SANS-SERIF DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;; +1D7E8;MATHEMATICAL SANS-SERIF DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;; +1D7E9;MATHEMATICAL SANS-SERIF DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;; +1D7EA;MATHEMATICAL SANS-SERIF DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;; +1D7EB;MATHEMATICAL SANS-SERIF DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;; +1D7EC;MATHEMATICAL SANS-SERIF BOLD DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;; +1D7ED;MATHEMATICAL SANS-SERIF BOLD DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;; +1D7EE;MATHEMATICAL SANS-SERIF BOLD DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;; +1D7EF;MATHEMATICAL SANS-SERIF BOLD DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;; +1D7F0;MATHEMATICAL SANS-SERIF BOLD DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;; +1D7F1;MATHEMATICAL SANS-SERIF BOLD DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;; +1D7F2;MATHEMATICAL SANS-SERIF BOLD DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;; +1D7F3;MATHEMATICAL SANS-SERIF BOLD DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;; +1D7F4;MATHEMATICAL SANS-SERIF BOLD DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;; +1D7F5;MATHEMATICAL SANS-SERIF BOLD DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;; +1D7F6;MATHEMATICAL MONOSPACE DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;; +1D7F7;MATHEMATICAL MONOSPACE DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;; +1D7F8;MATHEMATICAL MONOSPACE DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;; +1D7F9;MATHEMATICAL MONOSPACE DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;; +1D7FA;MATHEMATICAL MONOSPACE DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;; +1D7FB;MATHEMATICAL MONOSPACE DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;; +1D7FC;MATHEMATICAL MONOSPACE DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;; +1D7FD;MATHEMATICAL MONOSPACE DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;; +1D7FE;MATHEMATICAL MONOSPACE DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;; +1D7FF;MATHEMATICAL MONOSPACE DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;; +1D800;SIGNWRITING HAND-FIST INDEX;So;0;L;;;;;N;;;;; +1D801;SIGNWRITING HAND-CIRCLE INDEX;So;0;L;;;;;N;;;;; +1D802;SIGNWRITING HAND-CUP INDEX;So;0;L;;;;;N;;;;; +1D803;SIGNWRITING HAND-OVAL INDEX;So;0;L;;;;;N;;;;; +1D804;SIGNWRITING HAND-HINGE INDEX;So;0;L;;;;;N;;;;; +1D805;SIGNWRITING HAND-ANGLE INDEX;So;0;L;;;;;N;;;;; +1D806;SIGNWRITING HAND-FIST INDEX BENT;So;0;L;;;;;N;;;;; +1D807;SIGNWRITING HAND-CIRCLE INDEX BENT;So;0;L;;;;;N;;;;; +1D808;SIGNWRITING HAND-FIST THUMB UNDER INDEX BENT;So;0;L;;;;;N;;;;; +1D809;SIGNWRITING HAND-FIST INDEX RAISED KNUCKLE;So;0;L;;;;;N;;;;; +1D80A;SIGNWRITING HAND-FIST INDEX CUPPED;So;0;L;;;;;N;;;;; +1D80B;SIGNWRITING HAND-FIST INDEX HINGED;So;0;L;;;;;N;;;;; +1D80C;SIGNWRITING HAND-FIST INDEX HINGED LOW;So;0;L;;;;;N;;;;; +1D80D;SIGNWRITING HAND-CIRCLE INDEX HINGE;So;0;L;;;;;N;;;;; +1D80E;SIGNWRITING HAND-FIST INDEX MIDDLE;So;0;L;;;;;N;;;;; +1D80F;SIGNWRITING HAND-CIRCLE INDEX MIDDLE;So;0;L;;;;;N;;;;; +1D810;SIGNWRITING HAND-FIST INDEX MIDDLE BENT;So;0;L;;;;;N;;;;; +1D811;SIGNWRITING HAND-FIST INDEX MIDDLE RAISED KNUCKLES;So;0;L;;;;;N;;;;; +1D812;SIGNWRITING HAND-FIST INDEX MIDDLE HINGED;So;0;L;;;;;N;;;;; +1D813;SIGNWRITING HAND-FIST INDEX UP MIDDLE HINGED;So;0;L;;;;;N;;;;; +1D814;SIGNWRITING HAND-FIST INDEX HINGED MIDDLE UP;So;0;L;;;;;N;;;;; +1D815;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED;So;0;L;;;;;N;;;;; +1D816;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED INDEX BENT;So;0;L;;;;;N;;;;; +1D817;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED MIDDLE BENT;So;0;L;;;;;N;;;;; +1D818;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED CUPPED;So;0;L;;;;;N;;;;; +1D819;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED HINGED;So;0;L;;;;;N;;;;; +1D81A;SIGNWRITING HAND-FIST INDEX MIDDLE CROSSED;So;0;L;;;;;N;;;;; +1D81B;SIGNWRITING HAND-CIRCLE INDEX MIDDLE CROSSED;So;0;L;;;;;N;;;;; +1D81C;SIGNWRITING HAND-FIST MIDDLE BENT OVER INDEX;So;0;L;;;;;N;;;;; +1D81D;SIGNWRITING HAND-FIST INDEX BENT OVER MIDDLE;So;0;L;;;;;N;;;;; +1D81E;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB;So;0;L;;;;;N;;;;; +1D81F;SIGNWRITING HAND-CIRCLE INDEX MIDDLE THUMB;So;0;L;;;;;N;;;;; +1D820;SIGNWRITING HAND-FIST INDEX MIDDLE STRAIGHT THUMB BENT;So;0;L;;;;;N;;;;; +1D821;SIGNWRITING HAND-FIST INDEX MIDDLE BENT THUMB STRAIGHT;So;0;L;;;;;N;;;;; +1D822;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB BENT;So;0;L;;;;;N;;;;; +1D823;SIGNWRITING HAND-FIST INDEX MIDDLE HINGED SPREAD THUMB SIDE;So;0;L;;;;;N;;;;; +1D824;SIGNWRITING HAND-FIST INDEX UP MIDDLE HINGED THUMB SIDE;So;0;L;;;;;N;;;;; +1D825;SIGNWRITING HAND-FIST INDEX UP MIDDLE HINGED THUMB CONJOINED;So;0;L;;;;;N;;;;; +1D826;SIGNWRITING HAND-FIST INDEX HINGED MIDDLE UP THUMB SIDE;So;0;L;;;;;N;;;;; +1D827;SIGNWRITING HAND-FIST INDEX MIDDLE UP SPREAD THUMB FORWARD;So;0;L;;;;;N;;;;; +1D828;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB CUPPED;So;0;L;;;;;N;;;;; +1D829;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB CIRCLED;So;0;L;;;;;N;;;;; +1D82A;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB HOOKED;So;0;L;;;;;N;;;;; +1D82B;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB HINGED;So;0;L;;;;;N;;;;; +1D82C;SIGNWRITING HAND-FIST THUMB BETWEEN INDEX MIDDLE STRAIGHT;So;0;L;;;;;N;;;;; +1D82D;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED THUMB SIDE;So;0;L;;;;;N;;;;; +1D82E;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED THUMB SIDE CONJOINED;So;0;L;;;;;N;;;;; +1D82F;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED THUMB SIDE BENT;So;0;L;;;;;N;;;;; +1D830;SIGNWRITING HAND-FIST MIDDLE THUMB HOOKED INDEX UP;So;0;L;;;;;N;;;;; +1D831;SIGNWRITING HAND-FIST INDEX THUMB HOOKED MIDDLE UP;So;0;L;;;;;N;;;;; +1D832;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED HINGED THUMB SIDE;So;0;L;;;;;N;;;;; +1D833;SIGNWRITING HAND-FIST INDEX MIDDLE CROSSED THUMB SIDE;So;0;L;;;;;N;;;;; +1D834;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED THUMB FORWARD;So;0;L;;;;;N;;;;; +1D835;SIGNWRITING HAND-FIST INDEX MIDDLE CONJOINED CUPPED THUMB FORWARD;So;0;L;;;;;N;;;;; +1D836;SIGNWRITING HAND-FIST MIDDLE THUMB CUPPED INDEX UP;So;0;L;;;;;N;;;;; +1D837;SIGNWRITING HAND-FIST INDEX THUMB CUPPED MIDDLE UP;So;0;L;;;;;N;;;;; +1D838;SIGNWRITING HAND-FIST MIDDLE THUMB CIRCLED INDEX UP;So;0;L;;;;;N;;;;; +1D839;SIGNWRITING HAND-FIST MIDDLE THUMB CIRCLED INDEX HINGED;So;0;L;;;;;N;;;;; +1D83A;SIGNWRITING HAND-FIST INDEX THUMB ANGLED OUT MIDDLE UP;So;0;L;;;;;N;;;;; +1D83B;SIGNWRITING HAND-FIST INDEX THUMB ANGLED IN MIDDLE UP;So;0;L;;;;;N;;;;; +1D83C;SIGNWRITING HAND-FIST INDEX THUMB CIRCLED MIDDLE UP;So;0;L;;;;;N;;;;; +1D83D;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB CONJOINED HINGED;So;0;L;;;;;N;;;;; +1D83E;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB ANGLED OUT;So;0;L;;;;;N;;;;; +1D83F;SIGNWRITING HAND-FIST INDEX MIDDLE THUMB ANGLED;So;0;L;;;;;N;;;;; +1D840;SIGNWRITING HAND-FIST MIDDLE THUMB ANGLED OUT INDEX UP;So;0;L;;;;;N;;;;; +1D841;SIGNWRITING HAND-FIST MIDDLE THUMB ANGLED OUT INDEX CROSSED;So;0;L;;;;;N;;;;; +1D842;SIGNWRITING HAND-FIST MIDDLE THUMB ANGLED INDEX UP;So;0;L;;;;;N;;;;; +1D843;SIGNWRITING HAND-FIST INDEX THUMB HOOKED MIDDLE HINGED;So;0;L;;;;;N;;;;; +1D844;SIGNWRITING HAND-FLAT FOUR FINGERS;So;0;L;;;;;N;;;;; +1D845;SIGNWRITING HAND-FLAT FOUR FINGERS BENT;So;0;L;;;;;N;;;;; +1D846;SIGNWRITING HAND-FLAT FOUR FINGERS HINGED;So;0;L;;;;;N;;;;; +1D847;SIGNWRITING HAND-FLAT FOUR FINGERS CONJOINED;So;0;L;;;;;N;;;;; +1D848;SIGNWRITING HAND-FLAT FOUR FINGERS CONJOINED SPLIT;So;0;L;;;;;N;;;;; +1D849;SIGNWRITING HAND-CLAW FOUR FINGERS CONJOINED;So;0;L;;;;;N;;;;; +1D84A;SIGNWRITING HAND-FIST FOUR FINGERS CONJOINED BENT;So;0;L;;;;;N;;;;; +1D84B;SIGNWRITING HAND-HINGE FOUR FINGERS CONJOINED;So;0;L;;;;;N;;;;; +1D84C;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD;So;0;L;;;;;N;;;;; +1D84D;SIGNWRITING HAND-FLAT HEEL FIVE FINGERS SPREAD;So;0;L;;;;;N;;;;; +1D84E;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD FOUR BENT;So;0;L;;;;;N;;;;; +1D84F;SIGNWRITING HAND-FLAT HEEL FIVE FINGERS SPREAD FOUR BENT;So;0;L;;;;;N;;;;; +1D850;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD BENT;So;0;L;;;;;N;;;;; +1D851;SIGNWRITING HAND-FLAT HEEL FIVE FINGERS SPREAD BENT;So;0;L;;;;;N;;;;; +1D852;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD THUMB FORWARD;So;0;L;;;;;N;;;;; +1D853;SIGNWRITING HAND-CUP FIVE FINGERS SPREAD;So;0;L;;;;;N;;;;; +1D854;SIGNWRITING HAND-CUP FIVE FINGERS SPREAD OPEN;So;0;L;;;;;N;;;;; +1D855;SIGNWRITING HAND-HINGE FIVE FINGERS SPREAD OPEN;So;0;L;;;;;N;;;;; +1D856;SIGNWRITING HAND-OVAL FIVE FINGERS SPREAD;So;0;L;;;;;N;;;;; +1D857;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD HINGED;So;0;L;;;;;N;;;;; +1D858;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD HINGED THUMB SIDE;So;0;L;;;;;N;;;;; +1D859;SIGNWRITING HAND-FLAT FIVE FINGERS SPREAD HINGED NO THUMB;So;0;L;;;;;N;;;;; +1D85A;SIGNWRITING HAND-FLAT;So;0;L;;;;;N;;;;; +1D85B;SIGNWRITING HAND-FLAT BETWEEN PALM FACINGS;So;0;L;;;;;N;;;;; +1D85C;SIGNWRITING HAND-FLAT HEEL;So;0;L;;;;;N;;;;; +1D85D;SIGNWRITING HAND-FLAT THUMB SIDE;So;0;L;;;;;N;;;;; +1D85E;SIGNWRITING HAND-FLAT HEEL THUMB SIDE;So;0;L;;;;;N;;;;; +1D85F;SIGNWRITING HAND-FLAT THUMB BENT;So;0;L;;;;;N;;;;; +1D860;SIGNWRITING HAND-FLAT THUMB FORWARD;So;0;L;;;;;N;;;;; +1D861;SIGNWRITING HAND-FLAT SPLIT INDEX THUMB SIDE;So;0;L;;;;;N;;;;; +1D862;SIGNWRITING HAND-FLAT SPLIT CENTRE;So;0;L;;;;;N;;;;; +1D863;SIGNWRITING HAND-FLAT SPLIT CENTRE THUMB SIDE;So;0;L;;;;;N;;;;; +1D864;SIGNWRITING HAND-FLAT SPLIT CENTRE THUMB SIDE BENT;So;0;L;;;;;N;;;;; +1D865;SIGNWRITING HAND-FLAT SPLIT LITTLE;So;0;L;;;;;N;;;;; +1D866;SIGNWRITING HAND-CLAW;So;0;L;;;;;N;;;;; +1D867;SIGNWRITING HAND-CLAW THUMB SIDE;So;0;L;;;;;N;;;;; +1D868;SIGNWRITING HAND-CLAW NO THUMB;So;0;L;;;;;N;;;;; +1D869;SIGNWRITING HAND-CLAW THUMB FORWARD;So;0;L;;;;;N;;;;; +1D86A;SIGNWRITING HAND-HOOK CURLICUE;So;0;L;;;;;N;;;;; +1D86B;SIGNWRITING HAND-HOOK;So;0;L;;;;;N;;;;; +1D86C;SIGNWRITING HAND-CUP OPEN;So;0;L;;;;;N;;;;; +1D86D;SIGNWRITING HAND-CUP;So;0;L;;;;;N;;;;; +1D86E;SIGNWRITING HAND-CUP OPEN THUMB SIDE;So;0;L;;;;;N;;;;; +1D86F;SIGNWRITING HAND-CUP THUMB SIDE;So;0;L;;;;;N;;;;; +1D870;SIGNWRITING HAND-CUP OPEN NO THUMB;So;0;L;;;;;N;;;;; +1D871;SIGNWRITING HAND-CUP NO THUMB;So;0;L;;;;;N;;;;; +1D872;SIGNWRITING HAND-CUP OPEN THUMB FORWARD;So;0;L;;;;;N;;;;; +1D873;SIGNWRITING HAND-CUP THUMB FORWARD;So;0;L;;;;;N;;;;; +1D874;SIGNWRITING HAND-CURLICUE OPEN;So;0;L;;;;;N;;;;; +1D875;SIGNWRITING HAND-CURLICUE;So;0;L;;;;;N;;;;; +1D876;SIGNWRITING HAND-CIRCLE;So;0;L;;;;;N;;;;; +1D877;SIGNWRITING HAND-OVAL;So;0;L;;;;;N;;;;; +1D878;SIGNWRITING HAND-OVAL THUMB SIDE;So;0;L;;;;;N;;;;; +1D879;SIGNWRITING HAND-OVAL NO THUMB;So;0;L;;;;;N;;;;; +1D87A;SIGNWRITING HAND-OVAL THUMB FORWARD;So;0;L;;;;;N;;;;; +1D87B;SIGNWRITING HAND-HINGE OPEN;So;0;L;;;;;N;;;;; +1D87C;SIGNWRITING HAND-HINGE OPEN THUMB FORWARD;So;0;L;;;;;N;;;;; +1D87D;SIGNWRITING HAND-HINGE;So;0;L;;;;;N;;;;; +1D87E;SIGNWRITING HAND-HINGE SMALL;So;0;L;;;;;N;;;;; +1D87F;SIGNWRITING HAND-HINGE OPEN THUMB SIDE;So;0;L;;;;;N;;;;; +1D880;SIGNWRITING HAND-HINGE THUMB SIDE;So;0;L;;;;;N;;;;; +1D881;SIGNWRITING HAND-HINGE OPEN NO THUMB;So;0;L;;;;;N;;;;; +1D882;SIGNWRITING HAND-HINGE NO THUMB;So;0;L;;;;;N;;;;; +1D883;SIGNWRITING HAND-HINGE THUMB SIDE TOUCHING INDEX;So;0;L;;;;;N;;;;; +1D884;SIGNWRITING HAND-HINGE THUMB BETWEEN MIDDLE RING;So;0;L;;;;;N;;;;; +1D885;SIGNWRITING HAND-ANGLE;So;0;L;;;;;N;;;;; +1D886;SIGNWRITING HAND-FIST INDEX MIDDLE RING;So;0;L;;;;;N;;;;; +1D887;SIGNWRITING HAND-CIRCLE INDEX MIDDLE RING;So;0;L;;;;;N;;;;; +1D888;SIGNWRITING HAND-HINGE INDEX MIDDLE RING;So;0;L;;;;;N;;;;; +1D889;SIGNWRITING HAND-ANGLE INDEX MIDDLE RING;So;0;L;;;;;N;;;;; +1D88A;SIGNWRITING HAND-HINGE LITTLE;So;0;L;;;;;N;;;;; +1D88B;SIGNWRITING HAND-FIST INDEX MIDDLE RING BENT;So;0;L;;;;;N;;;;; +1D88C;SIGNWRITING HAND-FIST INDEX MIDDLE RING CONJOINED;So;0;L;;;;;N;;;;; +1D88D;SIGNWRITING HAND-HINGE INDEX MIDDLE RING CONJOINED;So;0;L;;;;;N;;;;; +1D88E;SIGNWRITING HAND-FIST LITTLE DOWN;So;0;L;;;;;N;;;;; +1D88F;SIGNWRITING HAND-FIST LITTLE DOWN RIPPLE STRAIGHT;So;0;L;;;;;N;;;;; +1D890;SIGNWRITING HAND-FIST LITTLE DOWN RIPPLE CURVED;So;0;L;;;;;N;;;;; +1D891;SIGNWRITING HAND-FIST LITTLE DOWN OTHERS CIRCLED;So;0;L;;;;;N;;;;; +1D892;SIGNWRITING HAND-FIST LITTLE UP;So;0;L;;;;;N;;;;; +1D893;SIGNWRITING HAND-FIST THUMB UNDER LITTLE UP;So;0;L;;;;;N;;;;; +1D894;SIGNWRITING HAND-CIRCLE LITTLE UP;So;0;L;;;;;N;;;;; +1D895;SIGNWRITING HAND-OVAL LITTLE UP;So;0;L;;;;;N;;;;; +1D896;SIGNWRITING HAND-ANGLE LITTLE UP;So;0;L;;;;;N;;;;; +1D897;SIGNWRITING HAND-FIST LITTLE RAISED KNUCKLE;So;0;L;;;;;N;;;;; +1D898;SIGNWRITING HAND-FIST LITTLE BENT;So;0;L;;;;;N;;;;; +1D899;SIGNWRITING HAND-FIST LITTLE TOUCHES THUMB;So;0;L;;;;;N;;;;; +1D89A;SIGNWRITING HAND-FIST LITTLE THUMB;So;0;L;;;;;N;;;;; +1D89B;SIGNWRITING HAND-HINGE LITTLE THUMB;So;0;L;;;;;N;;;;; +1D89C;SIGNWRITING HAND-FIST LITTLE INDEX THUMB;So;0;L;;;;;N;;;;; +1D89D;SIGNWRITING HAND-HINGE LITTLE INDEX THUMB;So;0;L;;;;;N;;;;; +1D89E;SIGNWRITING HAND-ANGLE LITTLE INDEX THUMB INDEX THUMB OUT;So;0;L;;;;;N;;;;; +1D89F;SIGNWRITING HAND-ANGLE LITTLE INDEX THUMB INDEX THUMB;So;0;L;;;;;N;;;;; +1D8A0;SIGNWRITING HAND-FIST LITTLE INDEX;So;0;L;;;;;N;;;;; +1D8A1;SIGNWRITING HAND-CIRCLE LITTLE INDEX;So;0;L;;;;;N;;;;; +1D8A2;SIGNWRITING HAND-HINGE LITTLE INDEX;So;0;L;;;;;N;;;;; +1D8A3;SIGNWRITING HAND-ANGLE LITTLE INDEX;So;0;L;;;;;N;;;;; +1D8A4;SIGNWRITING HAND-FIST INDEX MIDDLE LITTLE;So;0;L;;;;;N;;;;; +1D8A5;SIGNWRITING HAND-CIRCLE INDEX MIDDLE LITTLE;So;0;L;;;;;N;;;;; +1D8A6;SIGNWRITING HAND-HINGE INDEX MIDDLE LITTLE;So;0;L;;;;;N;;;;; +1D8A7;SIGNWRITING HAND-HINGE RING;So;0;L;;;;;N;;;;; +1D8A8;SIGNWRITING HAND-ANGLE INDEX MIDDLE LITTLE;So;0;L;;;;;N;;;;; +1D8A9;SIGNWRITING HAND-FIST INDEX MIDDLE CROSS LITTLE;So;0;L;;;;;N;;;;; +1D8AA;SIGNWRITING HAND-CIRCLE INDEX MIDDLE CROSS LITTLE;So;0;L;;;;;N;;;;; +1D8AB;SIGNWRITING HAND-FIST RING DOWN;So;0;L;;;;;N;;;;; +1D8AC;SIGNWRITING HAND-HINGE RING DOWN INDEX THUMB HOOK MIDDLE;So;0;L;;;;;N;;;;; +1D8AD;SIGNWRITING HAND-ANGLE RING DOWN MIDDLE THUMB INDEX CROSS;So;0;L;;;;;N;;;;; +1D8AE;SIGNWRITING HAND-FIST RING UP;So;0;L;;;;;N;;;;; +1D8AF;SIGNWRITING HAND-FIST RING RAISED KNUCKLE;So;0;L;;;;;N;;;;; +1D8B0;SIGNWRITING HAND-FIST RING LITTLE;So;0;L;;;;;N;;;;; +1D8B1;SIGNWRITING HAND-CIRCLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8B2;SIGNWRITING HAND-OVAL RING LITTLE;So;0;L;;;;;N;;;;; +1D8B3;SIGNWRITING HAND-ANGLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8B4;SIGNWRITING HAND-FIST RING MIDDLE;So;0;L;;;;;N;;;;; +1D8B5;SIGNWRITING HAND-FIST RING MIDDLE CONJOINED;So;0;L;;;;;N;;;;; +1D8B6;SIGNWRITING HAND-FIST RING MIDDLE RAISED KNUCKLES;So;0;L;;;;;N;;;;; +1D8B7;SIGNWRITING HAND-FIST RING INDEX;So;0;L;;;;;N;;;;; +1D8B8;SIGNWRITING HAND-FIST RING THUMB;So;0;L;;;;;N;;;;; +1D8B9;SIGNWRITING HAND-HOOK RING THUMB;So;0;L;;;;;N;;;;; +1D8BA;SIGNWRITING HAND-FIST INDEX RING LITTLE;So;0;L;;;;;N;;;;; +1D8BB;SIGNWRITING HAND-CIRCLE INDEX RING LITTLE;So;0;L;;;;;N;;;;; +1D8BC;SIGNWRITING HAND-CURLICUE INDEX RING LITTLE ON;So;0;L;;;;;N;;;;; +1D8BD;SIGNWRITING HAND-HOOK INDEX RING LITTLE OUT;So;0;L;;;;;N;;;;; +1D8BE;SIGNWRITING HAND-HOOK INDEX RING LITTLE IN;So;0;L;;;;;N;;;;; +1D8BF;SIGNWRITING HAND-HOOK INDEX RING LITTLE UNDER;So;0;L;;;;;N;;;;; +1D8C0;SIGNWRITING HAND-CUP INDEX RING LITTLE;So;0;L;;;;;N;;;;; +1D8C1;SIGNWRITING HAND-HINGE INDEX RING LITTLE;So;0;L;;;;;N;;;;; +1D8C2;SIGNWRITING HAND-ANGLE INDEX RING LITTLE OUT;So;0;L;;;;;N;;;;; +1D8C3;SIGNWRITING HAND-ANGLE INDEX RING LITTLE;So;0;L;;;;;N;;;;; +1D8C4;SIGNWRITING HAND-FIST MIDDLE DOWN;So;0;L;;;;;N;;;;; +1D8C5;SIGNWRITING HAND-HINGE MIDDLE;So;0;L;;;;;N;;;;; +1D8C6;SIGNWRITING HAND-FIST MIDDLE UP;So;0;L;;;;;N;;;;; +1D8C7;SIGNWRITING HAND-CIRCLE MIDDLE UP;So;0;L;;;;;N;;;;; +1D8C8;SIGNWRITING HAND-FIST MIDDLE RAISED KNUCKLE;So;0;L;;;;;N;;;;; +1D8C9;SIGNWRITING HAND-FIST MIDDLE UP THUMB SIDE;So;0;L;;;;;N;;;;; +1D8CA;SIGNWRITING HAND-HOOK MIDDLE THUMB;So;0;L;;;;;N;;;;; +1D8CB;SIGNWRITING HAND-FIST MIDDLE THUMB LITTLE;So;0;L;;;;;N;;;;; +1D8CC;SIGNWRITING HAND-FIST MIDDLE LITTLE;So;0;L;;;;;N;;;;; +1D8CD;SIGNWRITING HAND-FIST MIDDLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8CE;SIGNWRITING HAND-CIRCLE MIDDLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8CF;SIGNWRITING HAND-CURLICUE MIDDLE RING LITTLE ON;So;0;L;;;;;N;;;;; +1D8D0;SIGNWRITING HAND-CUP MIDDLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8D1;SIGNWRITING HAND-HINGE MIDDLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8D2;SIGNWRITING HAND-ANGLE MIDDLE RING LITTLE OUT;So;0;L;;;;;N;;;;; +1D8D3;SIGNWRITING HAND-ANGLE MIDDLE RING LITTLE IN;So;0;L;;;;;N;;;;; +1D8D4;SIGNWRITING HAND-ANGLE MIDDLE RING LITTLE;So;0;L;;;;;N;;;;; +1D8D5;SIGNWRITING HAND-CIRCLE MIDDLE RING LITTLE BENT;So;0;L;;;;;N;;;;; +1D8D6;SIGNWRITING HAND-CLAW MIDDLE RING LITTLE CONJOINED;So;0;L;;;;;N;;;;; +1D8D7;SIGNWRITING HAND-CLAW MIDDLE RING LITTLE CONJOINED SIDE;So;0;L;;;;;N;;;;; +1D8D8;SIGNWRITING HAND-HOOK MIDDLE RING LITTLE CONJOINED OUT;So;0;L;;;;;N;;;;; +1D8D9;SIGNWRITING HAND-HOOK MIDDLE RING LITTLE CONJOINED IN;So;0;L;;;;;N;;;;; +1D8DA;SIGNWRITING HAND-HOOK MIDDLE RING LITTLE CONJOINED;So;0;L;;;;;N;;;;; +1D8DB;SIGNWRITING HAND-HINGE INDEX HINGED;So;0;L;;;;;N;;;;; +1D8DC;SIGNWRITING HAND-FIST INDEX THUMB SIDE;So;0;L;;;;;N;;;;; +1D8DD;SIGNWRITING HAND-HINGE INDEX THUMB SIDE;So;0;L;;;;;N;;;;; +1D8DE;SIGNWRITING HAND-FIST INDEX THUMB SIDE THUMB DIAGONAL;So;0;L;;;;;N;;;;; +1D8DF;SIGNWRITING HAND-FIST INDEX THUMB SIDE THUMB CONJOINED;So;0;L;;;;;N;;;;; +1D8E0;SIGNWRITING HAND-FIST INDEX THUMB SIDE THUMB BENT;So;0;L;;;;;N;;;;; +1D8E1;SIGNWRITING HAND-FIST INDEX THUMB SIDE INDEX BENT;So;0;L;;;;;N;;;;; +1D8E2;SIGNWRITING HAND-FIST INDEX THUMB SIDE BOTH BENT;So;0;L;;;;;N;;;;; +1D8E3;SIGNWRITING HAND-FIST INDEX THUMB SIDE INDEX HINGE;So;0;L;;;;;N;;;;; +1D8E4;SIGNWRITING HAND-FIST INDEX THUMB FORWARD INDEX STRAIGHT;So;0;L;;;;;N;;;;; +1D8E5;SIGNWRITING HAND-FIST INDEX THUMB FORWARD INDEX BENT;So;0;L;;;;;N;;;;; +1D8E6;SIGNWRITING HAND-FIST INDEX THUMB HOOK;So;0;L;;;;;N;;;;; +1D8E7;SIGNWRITING HAND-FIST INDEX THUMB CURLICUE;So;0;L;;;;;N;;;;; +1D8E8;SIGNWRITING HAND-FIST INDEX THUMB CURVE THUMB INSIDE;So;0;L;;;;;N;;;;; +1D8E9;SIGNWRITING HAND-CLAW INDEX THUMB CURVE THUMB INSIDE;So;0;L;;;;;N;;;;; +1D8EA;SIGNWRITING HAND-FIST INDEX THUMB CURVE THUMB UNDER;So;0;L;;;;;N;;;;; +1D8EB;SIGNWRITING HAND-FIST INDEX THUMB CIRCLE;So;0;L;;;;;N;;;;; +1D8EC;SIGNWRITING HAND-CUP INDEX THUMB;So;0;L;;;;;N;;;;; +1D8ED;SIGNWRITING HAND-CUP INDEX THUMB OPEN;So;0;L;;;;;N;;;;; +1D8EE;SIGNWRITING HAND-HINGE INDEX THUMB OPEN;So;0;L;;;;;N;;;;; +1D8EF;SIGNWRITING HAND-HINGE INDEX THUMB LARGE;So;0;L;;;;;N;;;;; +1D8F0;SIGNWRITING HAND-HINGE INDEX THUMB;So;0;L;;;;;N;;;;; +1D8F1;SIGNWRITING HAND-HINGE INDEX THUMB SMALL;So;0;L;;;;;N;;;;; +1D8F2;SIGNWRITING HAND-ANGLE INDEX THUMB OUT;So;0;L;;;;;N;;;;; +1D8F3;SIGNWRITING HAND-ANGLE INDEX THUMB IN;So;0;L;;;;;N;;;;; +1D8F4;SIGNWRITING HAND-ANGLE INDEX THUMB;So;0;L;;;;;N;;;;; +1D8F5;SIGNWRITING HAND-FIST THUMB;So;0;L;;;;;N;;;;; +1D8F6;SIGNWRITING HAND-FIST THUMB HEEL;So;0;L;;;;;N;;;;; +1D8F7;SIGNWRITING HAND-FIST THUMB SIDE DIAGONAL;So;0;L;;;;;N;;;;; +1D8F8;SIGNWRITING HAND-FIST THUMB SIDE CONJOINED;So;0;L;;;;;N;;;;; +1D8F9;SIGNWRITING HAND-FIST THUMB SIDE BENT;So;0;L;;;;;N;;;;; +1D8FA;SIGNWRITING HAND-FIST THUMB FORWARD;So;0;L;;;;;N;;;;; +1D8FB;SIGNWRITING HAND-FIST THUMB BETWEEN INDEX MIDDLE;So;0;L;;;;;N;;;;; +1D8FC;SIGNWRITING HAND-FIST THUMB BETWEEN MIDDLE RING;So;0;L;;;;;N;;;;; +1D8FD;SIGNWRITING HAND-FIST THUMB BETWEEN RING LITTLE;So;0;L;;;;;N;;;;; +1D8FE;SIGNWRITING HAND-FIST THUMB UNDER TWO FINGERS;So;0;L;;;;;N;;;;; +1D8FF;SIGNWRITING HAND-FIST THUMB OVER TWO FINGERS;So;0;L;;;;;N;;;;; +1D900;SIGNWRITING HAND-FIST THUMB UNDER THREE FINGERS;So;0;L;;;;;N;;;;; +1D901;SIGNWRITING HAND-FIST THUMB UNDER FOUR FINGERS;So;0;L;;;;;N;;;;; +1D902;SIGNWRITING HAND-FIST THUMB OVER FOUR RAISED KNUCKLES;So;0;L;;;;;N;;;;; +1D903;SIGNWRITING HAND-FIST;So;0;L;;;;;N;;;;; +1D904;SIGNWRITING HAND-FIST HEEL;So;0;L;;;;;N;;;;; +1D905;SIGNWRITING TOUCH SINGLE;So;0;L;;;;;N;;;;; +1D906;SIGNWRITING TOUCH MULTIPLE;So;0;L;;;;;N;;;;; +1D907;SIGNWRITING TOUCH BETWEEN;So;0;L;;;;;N;;;;; +1D908;SIGNWRITING GRASP SINGLE;So;0;L;;;;;N;;;;; +1D909;SIGNWRITING GRASP MULTIPLE;So;0;L;;;;;N;;;;; +1D90A;SIGNWRITING GRASP BETWEEN;So;0;L;;;;;N;;;;; +1D90B;SIGNWRITING STRIKE SINGLE;So;0;L;;;;;N;;;;; +1D90C;SIGNWRITING STRIKE MULTIPLE;So;0;L;;;;;N;;;;; +1D90D;SIGNWRITING STRIKE BETWEEN;So;0;L;;;;;N;;;;; +1D90E;SIGNWRITING BRUSH SINGLE;So;0;L;;;;;N;;;;; +1D90F;SIGNWRITING BRUSH MULTIPLE;So;0;L;;;;;N;;;;; +1D910;SIGNWRITING BRUSH BETWEEN;So;0;L;;;;;N;;;;; +1D911;SIGNWRITING RUB SINGLE;So;0;L;;;;;N;;;;; +1D912;SIGNWRITING RUB MULTIPLE;So;0;L;;;;;N;;;;; +1D913;SIGNWRITING RUB BETWEEN;So;0;L;;;;;N;;;;; +1D914;SIGNWRITING SURFACE SYMBOLS;So;0;L;;;;;N;;;;; +1D915;SIGNWRITING SURFACE BETWEEN;So;0;L;;;;;N;;;;; +1D916;SIGNWRITING SQUEEZE LARGE SINGLE;So;0;L;;;;;N;;;;; +1D917;SIGNWRITING SQUEEZE SMALL SINGLE;So;0;L;;;;;N;;;;; +1D918;SIGNWRITING SQUEEZE LARGE MULTIPLE;So;0;L;;;;;N;;;;; +1D919;SIGNWRITING SQUEEZE SMALL MULTIPLE;So;0;L;;;;;N;;;;; +1D91A;SIGNWRITING SQUEEZE SEQUENTIAL;So;0;L;;;;;N;;;;; +1D91B;SIGNWRITING FLICK LARGE SINGLE;So;0;L;;;;;N;;;;; +1D91C;SIGNWRITING FLICK SMALL SINGLE;So;0;L;;;;;N;;;;; +1D91D;SIGNWRITING FLICK LARGE MULTIPLE;So;0;L;;;;;N;;;;; +1D91E;SIGNWRITING FLICK SMALL MULTIPLE;So;0;L;;;;;N;;;;; +1D91F;SIGNWRITING FLICK SEQUENTIAL;So;0;L;;;;;N;;;;; +1D920;SIGNWRITING SQUEEZE FLICK ALTERNATING;So;0;L;;;;;N;;;;; +1D921;SIGNWRITING MOVEMENT-HINGE UP DOWN LARGE;So;0;L;;;;;N;;;;; +1D922;SIGNWRITING MOVEMENT-HINGE UP DOWN SMALL;So;0;L;;;;;N;;;;; +1D923;SIGNWRITING MOVEMENT-HINGE UP SEQUENTIAL;So;0;L;;;;;N;;;;; +1D924;SIGNWRITING MOVEMENT-HINGE DOWN SEQUENTIAL;So;0;L;;;;;N;;;;; +1D925;SIGNWRITING MOVEMENT-HINGE UP DOWN ALTERNATING LARGE;So;0;L;;;;;N;;;;; +1D926;SIGNWRITING MOVEMENT-HINGE UP DOWN ALTERNATING SMALL;So;0;L;;;;;N;;;;; +1D927;SIGNWRITING MOVEMENT-HINGE SIDE TO SIDE SCISSORS;So;0;L;;;;;N;;;;; +1D928;SIGNWRITING MOVEMENT-WALLPLANE FINGER CONTACT;So;0;L;;;;;N;;;;; +1D929;SIGNWRITING MOVEMENT-FLOORPLANE FINGER CONTACT;So;0;L;;;;;N;;;;; +1D92A;SIGNWRITING MOVEMENT-WALLPLANE SINGLE STRAIGHT SMALL;So;0;L;;;;;N;;;;; +1D92B;SIGNWRITING MOVEMENT-WALLPLANE SINGLE STRAIGHT MEDIUM;So;0;L;;;;;N;;;;; +1D92C;SIGNWRITING MOVEMENT-WALLPLANE SINGLE STRAIGHT LARGE;So;0;L;;;;;N;;;;; +1D92D;SIGNWRITING MOVEMENT-WALLPLANE SINGLE STRAIGHT LARGEST;So;0;L;;;;;N;;;;; +1D92E;SIGNWRITING MOVEMENT-WALLPLANE SINGLE WRIST FLEX;So;0;L;;;;;N;;;;; +1D92F;SIGNWRITING MOVEMENT-WALLPLANE DOUBLE STRAIGHT;So;0;L;;;;;N;;;;; +1D930;SIGNWRITING MOVEMENT-WALLPLANE DOUBLE WRIST FLEX;So;0;L;;;;;N;;;;; +1D931;SIGNWRITING MOVEMENT-WALLPLANE DOUBLE ALTERNATING;So;0;L;;;;;N;;;;; +1D932;SIGNWRITING MOVEMENT-WALLPLANE DOUBLE ALTERNATING WRIST FLEX;So;0;L;;;;;N;;;;; +1D933;SIGNWRITING MOVEMENT-WALLPLANE CROSS;So;0;L;;;;;N;;;;; +1D934;SIGNWRITING MOVEMENT-WALLPLANE TRIPLE STRAIGHT MOVEMENT;So;0;L;;;;;N;;;;; +1D935;SIGNWRITING MOVEMENT-WALLPLANE TRIPLE WRIST FLEX;So;0;L;;;;;N;;;;; +1D936;SIGNWRITING MOVEMENT-WALLPLANE TRIPLE ALTERNATING;So;0;L;;;;;N;;;;; +1D937;SIGNWRITING MOVEMENT-WALLPLANE TRIPLE ALTERNATING WRIST FLEX;So;0;L;;;;;N;;;;; +1D938;SIGNWRITING MOVEMENT-WALLPLANE BEND SMALL;So;0;L;;;;;N;;;;; +1D939;SIGNWRITING MOVEMENT-WALLPLANE BEND MEDIUM;So;0;L;;;;;N;;;;; +1D93A;SIGNWRITING MOVEMENT-WALLPLANE BEND LARGE;So;0;L;;;;;N;;;;; +1D93B;SIGNWRITING MOVEMENT-WALLPLANE CORNER SMALL;So;0;L;;;;;N;;;;; +1D93C;SIGNWRITING MOVEMENT-WALLPLANE CORNER MEDIUM;So;0;L;;;;;N;;;;; +1D93D;SIGNWRITING MOVEMENT-WALLPLANE CORNER LARGE;So;0;L;;;;;N;;;;; +1D93E;SIGNWRITING MOVEMENT-WALLPLANE CORNER ROTATION;So;0;L;;;;;N;;;;; +1D93F;SIGNWRITING MOVEMENT-WALLPLANE CHECK SMALL;So;0;L;;;;;N;;;;; +1D940;SIGNWRITING MOVEMENT-WALLPLANE CHECK MEDIUM;So;0;L;;;;;N;;;;; +1D941;SIGNWRITING MOVEMENT-WALLPLANE CHECK LARGE;So;0;L;;;;;N;;;;; +1D942;SIGNWRITING MOVEMENT-WALLPLANE BOX SMALL;So;0;L;;;;;N;;;;; +1D943;SIGNWRITING MOVEMENT-WALLPLANE BOX MEDIUM;So;0;L;;;;;N;;;;; +1D944;SIGNWRITING MOVEMENT-WALLPLANE BOX LARGE;So;0;L;;;;;N;;;;; +1D945;SIGNWRITING MOVEMENT-WALLPLANE ZIGZAG SMALL;So;0;L;;;;;N;;;;; +1D946;SIGNWRITING MOVEMENT-WALLPLANE ZIGZAG MEDIUM;So;0;L;;;;;N;;;;; +1D947;SIGNWRITING MOVEMENT-WALLPLANE ZIGZAG LARGE;So;0;L;;;;;N;;;;; +1D948;SIGNWRITING MOVEMENT-WALLPLANE PEAKS SMALL;So;0;L;;;;;N;;;;; +1D949;SIGNWRITING MOVEMENT-WALLPLANE PEAKS MEDIUM;So;0;L;;;;;N;;;;; +1D94A;SIGNWRITING MOVEMENT-WALLPLANE PEAKS LARGE;So;0;L;;;;;N;;;;; +1D94B;SIGNWRITING TRAVEL-WALLPLANE ROTATION-WALLPLANE SINGLE;So;0;L;;;;;N;;;;; +1D94C;SIGNWRITING TRAVEL-WALLPLANE ROTATION-WALLPLANE DOUBLE;So;0;L;;;;;N;;;;; +1D94D;SIGNWRITING TRAVEL-WALLPLANE ROTATION-WALLPLANE ALTERNATING;So;0;L;;;;;N;;;;; +1D94E;SIGNWRITING TRAVEL-WALLPLANE ROTATION-FLOORPLANE SINGLE;So;0;L;;;;;N;;;;; +1D94F;SIGNWRITING TRAVEL-WALLPLANE ROTATION-FLOORPLANE DOUBLE;So;0;L;;;;;N;;;;; +1D950;SIGNWRITING TRAVEL-WALLPLANE ROTATION-FLOORPLANE ALTERNATING;So;0;L;;;;;N;;;;; +1D951;SIGNWRITING TRAVEL-WALLPLANE SHAKING;So;0;L;;;;;N;;;;; +1D952;SIGNWRITING TRAVEL-WALLPLANE ARM SPIRAL SINGLE;So;0;L;;;;;N;;;;; +1D953;SIGNWRITING TRAVEL-WALLPLANE ARM SPIRAL DOUBLE;So;0;L;;;;;N;;;;; +1D954;SIGNWRITING TRAVEL-WALLPLANE ARM SPIRAL TRIPLE;So;0;L;;;;;N;;;;; +1D955;SIGNWRITING MOVEMENT-DIAGONAL AWAY SMALL;So;0;L;;;;;N;;;;; +1D956;SIGNWRITING MOVEMENT-DIAGONAL AWAY MEDIUM;So;0;L;;;;;N;;;;; +1D957;SIGNWRITING MOVEMENT-DIAGONAL AWAY LARGE;So;0;L;;;;;N;;;;; +1D958;SIGNWRITING MOVEMENT-DIAGONAL AWAY LARGEST;So;0;L;;;;;N;;;;; +1D959;SIGNWRITING MOVEMENT-DIAGONAL TOWARDS SMALL;So;0;L;;;;;N;;;;; +1D95A;SIGNWRITING MOVEMENT-DIAGONAL TOWARDS MEDIUM;So;0;L;;;;;N;;;;; +1D95B;SIGNWRITING MOVEMENT-DIAGONAL TOWARDS LARGE;So;0;L;;;;;N;;;;; +1D95C;SIGNWRITING MOVEMENT-DIAGONAL TOWARDS LARGEST;So;0;L;;;;;N;;;;; +1D95D;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN AWAY SMALL;So;0;L;;;;;N;;;;; +1D95E;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN AWAY MEDIUM;So;0;L;;;;;N;;;;; +1D95F;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN AWAY LARGE;So;0;L;;;;;N;;;;; +1D960;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN AWAY LARGEST;So;0;L;;;;;N;;;;; +1D961;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN TOWARDS SMALL;So;0;L;;;;;N;;;;; +1D962;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN TOWARDS MEDIUM;So;0;L;;;;;N;;;;; +1D963;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN TOWARDS LARGE;So;0;L;;;;;N;;;;; +1D964;SIGNWRITING MOVEMENT-DIAGONAL BETWEEN TOWARDS LARGEST;So;0;L;;;;;N;;;;; +1D965;SIGNWRITING MOVEMENT-FLOORPLANE SINGLE STRAIGHT SMALL;So;0;L;;;;;N;;;;; +1D966;SIGNWRITING MOVEMENT-FLOORPLANE SINGLE STRAIGHT MEDIUM;So;0;L;;;;;N;;;;; +1D967;SIGNWRITING MOVEMENT-FLOORPLANE SINGLE STRAIGHT LARGE;So;0;L;;;;;N;;;;; +1D968;SIGNWRITING MOVEMENT-FLOORPLANE SINGLE STRAIGHT LARGEST;So;0;L;;;;;N;;;;; +1D969;SIGNWRITING MOVEMENT-FLOORPLANE SINGLE WRIST FLEX;So;0;L;;;;;N;;;;; +1D96A;SIGNWRITING MOVEMENT-FLOORPLANE DOUBLE STRAIGHT;So;0;L;;;;;N;;;;; +1D96B;SIGNWRITING MOVEMENT-FLOORPLANE DOUBLE WRIST FLEX;So;0;L;;;;;N;;;;; +1D96C;SIGNWRITING MOVEMENT-FLOORPLANE DOUBLE ALTERNATING;So;0;L;;;;;N;;;;; +1D96D;SIGNWRITING MOVEMENT-FLOORPLANE DOUBLE ALTERNATING WRIST FLEX;So;0;L;;;;;N;;;;; +1D96E;SIGNWRITING MOVEMENT-FLOORPLANE CROSS;So;0;L;;;;;N;;;;; +1D96F;SIGNWRITING MOVEMENT-FLOORPLANE TRIPLE STRAIGHT MOVEMENT;So;0;L;;;;;N;;;;; +1D970;SIGNWRITING MOVEMENT-FLOORPLANE TRIPLE WRIST FLEX;So;0;L;;;;;N;;;;; +1D971;SIGNWRITING MOVEMENT-FLOORPLANE TRIPLE ALTERNATING MOVEMENT;So;0;L;;;;;N;;;;; +1D972;SIGNWRITING MOVEMENT-FLOORPLANE TRIPLE ALTERNATING WRIST FLEX;So;0;L;;;;;N;;;;; +1D973;SIGNWRITING MOVEMENT-FLOORPLANE BEND;So;0;L;;;;;N;;;;; +1D974;SIGNWRITING MOVEMENT-FLOORPLANE CORNER SMALL;So;0;L;;;;;N;;;;; +1D975;SIGNWRITING MOVEMENT-FLOORPLANE CORNER MEDIUM;So;0;L;;;;;N;;;;; +1D976;SIGNWRITING MOVEMENT-FLOORPLANE CORNER LARGE;So;0;L;;;;;N;;;;; +1D977;SIGNWRITING MOVEMENT-FLOORPLANE CHECK;So;0;L;;;;;N;;;;; +1D978;SIGNWRITING MOVEMENT-FLOORPLANE BOX SMALL;So;0;L;;;;;N;;;;; +1D979;SIGNWRITING MOVEMENT-FLOORPLANE BOX MEDIUM;So;0;L;;;;;N;;;;; +1D97A;SIGNWRITING MOVEMENT-FLOORPLANE BOX LARGE;So;0;L;;;;;N;;;;; +1D97B;SIGNWRITING MOVEMENT-FLOORPLANE ZIGZAG SMALL;So;0;L;;;;;N;;;;; +1D97C;SIGNWRITING MOVEMENT-FLOORPLANE ZIGZAG MEDIUM;So;0;L;;;;;N;;;;; +1D97D;SIGNWRITING MOVEMENT-FLOORPLANE ZIGZAG LARGE;So;0;L;;;;;N;;;;; +1D97E;SIGNWRITING MOVEMENT-FLOORPLANE PEAKS SMALL;So;0;L;;;;;N;;;;; +1D97F;SIGNWRITING MOVEMENT-FLOORPLANE PEAKS MEDIUM;So;0;L;;;;;N;;;;; +1D980;SIGNWRITING MOVEMENT-FLOORPLANE PEAKS LARGE;So;0;L;;;;;N;;;;; +1D981;SIGNWRITING TRAVEL-FLOORPLANE ROTATION-FLOORPLANE SINGLE;So;0;L;;;;;N;;;;; +1D982;SIGNWRITING TRAVEL-FLOORPLANE ROTATION-FLOORPLANE DOUBLE;So;0;L;;;;;N;;;;; +1D983;SIGNWRITING TRAVEL-FLOORPLANE ROTATION-FLOORPLANE ALTERNATING;So;0;L;;;;;N;;;;; +1D984;SIGNWRITING TRAVEL-FLOORPLANE ROTATION-WALLPLANE SINGLE;So;0;L;;;;;N;;;;; +1D985;SIGNWRITING TRAVEL-FLOORPLANE ROTATION-WALLPLANE DOUBLE;So;0;L;;;;;N;;;;; +1D986;SIGNWRITING TRAVEL-FLOORPLANE ROTATION-WALLPLANE ALTERNATING;So;0;L;;;;;N;;;;; +1D987;SIGNWRITING TRAVEL-FLOORPLANE SHAKING;So;0;L;;;;;N;;;;; +1D988;SIGNWRITING MOVEMENT-WALLPLANE CURVE QUARTER SMALL;So;0;L;;;;;N;;;;; +1D989;SIGNWRITING MOVEMENT-WALLPLANE CURVE QUARTER MEDIUM;So;0;L;;;;;N;;;;; +1D98A;SIGNWRITING MOVEMENT-WALLPLANE CURVE QUARTER LARGE;So;0;L;;;;;N;;;;; +1D98B;SIGNWRITING MOVEMENT-WALLPLANE CURVE QUARTER LARGEST;So;0;L;;;;;N;;;;; +1D98C;SIGNWRITING MOVEMENT-WALLPLANE CURVE HALF-CIRCLE SMALL;So;0;L;;;;;N;;;;; +1D98D;SIGNWRITING MOVEMENT-WALLPLANE CURVE HALF-CIRCLE MEDIUM;So;0;L;;;;;N;;;;; +1D98E;SIGNWRITING MOVEMENT-WALLPLANE CURVE HALF-CIRCLE LARGE;So;0;L;;;;;N;;;;; +1D98F;SIGNWRITING MOVEMENT-WALLPLANE CURVE HALF-CIRCLE LARGEST;So;0;L;;;;;N;;;;; +1D990;SIGNWRITING MOVEMENT-WALLPLANE CURVE THREE-QUARTER CIRCLE SMALL;So;0;L;;;;;N;;;;; +1D991;SIGNWRITING MOVEMENT-WALLPLANE CURVE THREE-QUARTER CIRCLE MEDIUM;So;0;L;;;;;N;;;;; +1D992;SIGNWRITING MOVEMENT-WALLPLANE HUMP SMALL;So;0;L;;;;;N;;;;; +1D993;SIGNWRITING MOVEMENT-WALLPLANE HUMP MEDIUM;So;0;L;;;;;N;;;;; +1D994;SIGNWRITING MOVEMENT-WALLPLANE HUMP LARGE;So;0;L;;;;;N;;;;; +1D995;SIGNWRITING MOVEMENT-WALLPLANE LOOP SMALL;So;0;L;;;;;N;;;;; +1D996;SIGNWRITING MOVEMENT-WALLPLANE LOOP MEDIUM;So;0;L;;;;;N;;;;; +1D997;SIGNWRITING MOVEMENT-WALLPLANE LOOP LARGE;So;0;L;;;;;N;;;;; +1D998;SIGNWRITING MOVEMENT-WALLPLANE LOOP SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D999;SIGNWRITING MOVEMENT-WALLPLANE WAVE CURVE DOUBLE SMALL;So;0;L;;;;;N;;;;; +1D99A;SIGNWRITING MOVEMENT-WALLPLANE WAVE CURVE DOUBLE MEDIUM;So;0;L;;;;;N;;;;; +1D99B;SIGNWRITING MOVEMENT-WALLPLANE WAVE CURVE DOUBLE LARGE;So;0;L;;;;;N;;;;; +1D99C;SIGNWRITING MOVEMENT-WALLPLANE WAVE CURVE TRIPLE SMALL;So;0;L;;;;;N;;;;; +1D99D;SIGNWRITING MOVEMENT-WALLPLANE WAVE CURVE TRIPLE MEDIUM;So;0;L;;;;;N;;;;; +1D99E;SIGNWRITING MOVEMENT-WALLPLANE WAVE CURVE TRIPLE LARGE;So;0;L;;;;;N;;;;; +1D99F;SIGNWRITING MOVEMENT-WALLPLANE CURVE THEN STRAIGHT;So;0;L;;;;;N;;;;; +1D9A0;SIGNWRITING MOVEMENT-WALLPLANE CURVED CROSS SMALL;So;0;L;;;;;N;;;;; +1D9A1;SIGNWRITING MOVEMENT-WALLPLANE CURVED CROSS MEDIUM;So;0;L;;;;;N;;;;; +1D9A2;SIGNWRITING ROTATION-WALLPLANE SINGLE;So;0;L;;;;;N;;;;; +1D9A3;SIGNWRITING ROTATION-WALLPLANE DOUBLE;So;0;L;;;;;N;;;;; +1D9A4;SIGNWRITING ROTATION-WALLPLANE ALTERNATE;So;0;L;;;;;N;;;;; +1D9A5;SIGNWRITING MOVEMENT-WALLPLANE SHAKING;So;0;L;;;;;N;;;;; +1D9A6;SIGNWRITING MOVEMENT-WALLPLANE CURVE HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9A7;SIGNWRITING MOVEMENT-WALLPLANE HUMP HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9A8;SIGNWRITING MOVEMENT-WALLPLANE LOOP HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9A9;SIGNWRITING MOVEMENT-WALLPLANE WAVE HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9AA;SIGNWRITING ROTATION-WALLPLANE SINGLE HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9AB;SIGNWRITING ROTATION-WALLPLANE DOUBLE HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9AC;SIGNWRITING ROTATION-WALLPLANE ALTERNATING HITTING FRONT WALL;So;0;L;;;;;N;;;;; +1D9AD;SIGNWRITING MOVEMENT-WALLPLANE CURVE HITTING CHEST;So;0;L;;;;;N;;;;; +1D9AE;SIGNWRITING MOVEMENT-WALLPLANE HUMP HITTING CHEST;So;0;L;;;;;N;;;;; +1D9AF;SIGNWRITING MOVEMENT-WALLPLANE LOOP HITTING CHEST;So;0;L;;;;;N;;;;; +1D9B0;SIGNWRITING MOVEMENT-WALLPLANE WAVE HITTING CHEST;So;0;L;;;;;N;;;;; +1D9B1;SIGNWRITING ROTATION-WALLPLANE SINGLE HITTING CHEST;So;0;L;;;;;N;;;;; +1D9B2;SIGNWRITING ROTATION-WALLPLANE DOUBLE HITTING CHEST;So;0;L;;;;;N;;;;; +1D9B3;SIGNWRITING ROTATION-WALLPLANE ALTERNATING HITTING CHEST;So;0;L;;;;;N;;;;; +1D9B4;SIGNWRITING MOVEMENT-WALLPLANE WAVE DIAGONAL PATH SMALL;So;0;L;;;;;N;;;;; +1D9B5;SIGNWRITING MOVEMENT-WALLPLANE WAVE DIAGONAL PATH MEDIUM;So;0;L;;;;;N;;;;; +1D9B6;SIGNWRITING MOVEMENT-WALLPLANE WAVE DIAGONAL PATH LARGE;So;0;L;;;;;N;;;;; +1D9B7;SIGNWRITING MOVEMENT-FLOORPLANE CURVE HITTING CEILING SMALL;So;0;L;;;;;N;;;;; +1D9B8;SIGNWRITING MOVEMENT-FLOORPLANE CURVE HITTING CEILING LARGE;So;0;L;;;;;N;;;;; +1D9B9;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING CEILING SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D9BA;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING CEILING LARGE DOUBLE;So;0;L;;;;;N;;;;; +1D9BB;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING CEILING SMALL TRIPLE;So;0;L;;;;;N;;;;; +1D9BC;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING CEILING LARGE TRIPLE;So;0;L;;;;;N;;;;; +1D9BD;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING CEILING SMALL SINGLE;So;0;L;;;;;N;;;;; +1D9BE;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING CEILING LARGE SINGLE;So;0;L;;;;;N;;;;; +1D9BF;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING CEILING SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D9C0;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING CEILING LARGE DOUBLE;So;0;L;;;;;N;;;;; +1D9C1;SIGNWRITING MOVEMENT-FLOORPLANE WAVE HITTING CEILING SMALL;So;0;L;;;;;N;;;;; +1D9C2;SIGNWRITING MOVEMENT-FLOORPLANE WAVE HITTING CEILING LARGE;So;0;L;;;;;N;;;;; +1D9C3;SIGNWRITING ROTATION-FLOORPLANE SINGLE HITTING CEILING;So;0;L;;;;;N;;;;; +1D9C4;SIGNWRITING ROTATION-FLOORPLANE DOUBLE HITTING CEILING;So;0;L;;;;;N;;;;; +1D9C5;SIGNWRITING ROTATION-FLOORPLANE ALTERNATING HITTING CEILING;So;0;L;;;;;N;;;;; +1D9C6;SIGNWRITING MOVEMENT-FLOORPLANE CURVE HITTING FLOOR SMALL;So;0;L;;;;;N;;;;; +1D9C7;SIGNWRITING MOVEMENT-FLOORPLANE CURVE HITTING FLOOR LARGE;So;0;L;;;;;N;;;;; +1D9C8;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING FLOOR SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D9C9;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING FLOOR LARGE DOUBLE;So;0;L;;;;;N;;;;; +1D9CA;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING FLOOR TRIPLE SMALL TRIPLE;So;0;L;;;;;N;;;;; +1D9CB;SIGNWRITING MOVEMENT-FLOORPLANE HUMP HITTING FLOOR TRIPLE LARGE TRIPLE;So;0;L;;;;;N;;;;; +1D9CC;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING FLOOR SMALL SINGLE;So;0;L;;;;;N;;;;; +1D9CD;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING FLOOR LARGE SINGLE;So;0;L;;;;;N;;;;; +1D9CE;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING FLOOR SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D9CF;SIGNWRITING MOVEMENT-FLOORPLANE LOOP HITTING FLOOR LARGE DOUBLE;So;0;L;;;;;N;;;;; +1D9D0;SIGNWRITING MOVEMENT-FLOORPLANE WAVE HITTING FLOOR SMALL;So;0;L;;;;;N;;;;; +1D9D1;SIGNWRITING MOVEMENT-FLOORPLANE WAVE HITTING FLOOR LARGE;So;0;L;;;;;N;;;;; +1D9D2;SIGNWRITING ROTATION-FLOORPLANE SINGLE HITTING FLOOR;So;0;L;;;;;N;;;;; +1D9D3;SIGNWRITING ROTATION-FLOORPLANE DOUBLE HITTING FLOOR;So;0;L;;;;;N;;;;; +1D9D4;SIGNWRITING ROTATION-FLOORPLANE ALTERNATING HITTING FLOOR;So;0;L;;;;;N;;;;; +1D9D5;SIGNWRITING MOVEMENT-FLOORPLANE CURVE SMALL;So;0;L;;;;;N;;;;; +1D9D6;SIGNWRITING MOVEMENT-FLOORPLANE CURVE MEDIUM;So;0;L;;;;;N;;;;; +1D9D7;SIGNWRITING MOVEMENT-FLOORPLANE CURVE LARGE;So;0;L;;;;;N;;;;; +1D9D8;SIGNWRITING MOVEMENT-FLOORPLANE CURVE LARGEST;So;0;L;;;;;N;;;;; +1D9D9;SIGNWRITING MOVEMENT-FLOORPLANE CURVE COMBINED;So;0;L;;;;;N;;;;; +1D9DA;SIGNWRITING MOVEMENT-FLOORPLANE HUMP SMALL;So;0;L;;;;;N;;;;; +1D9DB;SIGNWRITING MOVEMENT-FLOORPLANE LOOP SMALL;So;0;L;;;;;N;;;;; +1D9DC;SIGNWRITING MOVEMENT-FLOORPLANE WAVE SNAKE;So;0;L;;;;;N;;;;; +1D9DD;SIGNWRITING MOVEMENT-FLOORPLANE WAVE SMALL;So;0;L;;;;;N;;;;; +1D9DE;SIGNWRITING MOVEMENT-FLOORPLANE WAVE LARGE;So;0;L;;;;;N;;;;; +1D9DF;SIGNWRITING ROTATION-FLOORPLANE SINGLE;So;0;L;;;;;N;;;;; +1D9E0;SIGNWRITING ROTATION-FLOORPLANE DOUBLE;So;0;L;;;;;N;;;;; +1D9E1;SIGNWRITING ROTATION-FLOORPLANE ALTERNATING;So;0;L;;;;;N;;;;; +1D9E2;SIGNWRITING MOVEMENT-FLOORPLANE SHAKING PARALLEL;So;0;L;;;;;N;;;;; +1D9E3;SIGNWRITING MOVEMENT-WALLPLANE ARM CIRCLE SMALL SINGLE;So;0;L;;;;;N;;;;; +1D9E4;SIGNWRITING MOVEMENT-WALLPLANE ARM CIRCLE MEDIUM SINGLE;So;0;L;;;;;N;;;;; +1D9E5;SIGNWRITING MOVEMENT-WALLPLANE ARM CIRCLE SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D9E6;SIGNWRITING MOVEMENT-WALLPLANE ARM CIRCLE MEDIUM DOUBLE;So;0;L;;;;;N;;;;; +1D9E7;SIGNWRITING MOVEMENT-FLOORPLANE ARM CIRCLE HITTING WALL SMALL SINGLE;So;0;L;;;;;N;;;;; +1D9E8;SIGNWRITING MOVEMENT-FLOORPLANE ARM CIRCLE HITTING WALL MEDIUM SINGLE;So;0;L;;;;;N;;;;; +1D9E9;SIGNWRITING MOVEMENT-FLOORPLANE ARM CIRCLE HITTING WALL LARGE SINGLE;So;0;L;;;;;N;;;;; +1D9EA;SIGNWRITING MOVEMENT-FLOORPLANE ARM CIRCLE HITTING WALL SMALL DOUBLE;So;0;L;;;;;N;;;;; +1D9EB;SIGNWRITING MOVEMENT-FLOORPLANE ARM CIRCLE HITTING WALL MEDIUM DOUBLE;So;0;L;;;;;N;;;;; +1D9EC;SIGNWRITING MOVEMENT-FLOORPLANE ARM CIRCLE HITTING WALL LARGE DOUBLE;So;0;L;;;;;N;;;;; +1D9ED;SIGNWRITING MOVEMENT-WALLPLANE WRIST CIRCLE FRONT SINGLE;So;0;L;;;;;N;;;;; +1D9EE;SIGNWRITING MOVEMENT-WALLPLANE WRIST CIRCLE FRONT DOUBLE;So;0;L;;;;;N;;;;; +1D9EF;SIGNWRITING MOVEMENT-FLOORPLANE WRIST CIRCLE HITTING WALL SINGLE;So;0;L;;;;;N;;;;; +1D9F0;SIGNWRITING MOVEMENT-FLOORPLANE WRIST CIRCLE HITTING WALL DOUBLE;So;0;L;;;;;N;;;;; +1D9F1;SIGNWRITING MOVEMENT-WALLPLANE FINGER CIRCLES SINGLE;So;0;L;;;;;N;;;;; +1D9F2;SIGNWRITING MOVEMENT-WALLPLANE FINGER CIRCLES DOUBLE;So;0;L;;;;;N;;;;; +1D9F3;SIGNWRITING MOVEMENT-FLOORPLANE FINGER CIRCLES HITTING WALL SINGLE;So;0;L;;;;;N;;;;; +1D9F4;SIGNWRITING MOVEMENT-FLOORPLANE FINGER CIRCLES HITTING WALL DOUBLE;So;0;L;;;;;N;;;;; +1D9F5;SIGNWRITING DYNAMIC ARROWHEAD SMALL;So;0;L;;;;;N;;;;; +1D9F6;SIGNWRITING DYNAMIC ARROWHEAD LARGE;So;0;L;;;;;N;;;;; +1D9F7;SIGNWRITING DYNAMIC FAST;So;0;L;;;;;N;;;;; +1D9F8;SIGNWRITING DYNAMIC SLOW;So;0;L;;;;;N;;;;; +1D9F9;SIGNWRITING DYNAMIC TENSE;So;0;L;;;;;N;;;;; +1D9FA;SIGNWRITING DYNAMIC RELAXED;So;0;L;;;;;N;;;;; +1D9FB;SIGNWRITING DYNAMIC SIMULTANEOUS;So;0;L;;;;;N;;;;; +1D9FC;SIGNWRITING DYNAMIC SIMULTANEOUS ALTERNATING;So;0;L;;;;;N;;;;; +1D9FD;SIGNWRITING DYNAMIC EVERY OTHER TIME;So;0;L;;;;;N;;;;; +1D9FE;SIGNWRITING DYNAMIC GRADUAL;So;0;L;;;;;N;;;;; +1D9FF;SIGNWRITING HEAD;So;0;L;;;;;N;;;;; +1DA00;SIGNWRITING HEAD RIM;Mn;0;NSM;;;;;N;;;;; +1DA01;SIGNWRITING HEAD MOVEMENT-WALLPLANE STRAIGHT;Mn;0;NSM;;;;;N;;;;; +1DA02;SIGNWRITING HEAD MOVEMENT-WALLPLANE TILT;Mn;0;NSM;;;;;N;;;;; +1DA03;SIGNWRITING HEAD MOVEMENT-FLOORPLANE STRAIGHT;Mn;0;NSM;;;;;N;;;;; +1DA04;SIGNWRITING HEAD MOVEMENT-WALLPLANE CURVE;Mn;0;NSM;;;;;N;;;;; +1DA05;SIGNWRITING HEAD MOVEMENT-FLOORPLANE CURVE;Mn;0;NSM;;;;;N;;;;; +1DA06;SIGNWRITING HEAD MOVEMENT CIRCLE;Mn;0;NSM;;;;;N;;;;; +1DA07;SIGNWRITING FACE DIRECTION POSITION NOSE FORWARD TILTING;Mn;0;NSM;;;;;N;;;;; +1DA08;SIGNWRITING FACE DIRECTION POSITION NOSE UP OR DOWN;Mn;0;NSM;;;;;N;;;;; +1DA09;SIGNWRITING FACE DIRECTION POSITION NOSE UP OR DOWN TILTING;Mn;0;NSM;;;;;N;;;;; +1DA0A;SIGNWRITING EYEBROWS STRAIGHT UP;Mn;0;NSM;;;;;N;;;;; +1DA0B;SIGNWRITING EYEBROWS STRAIGHT NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA0C;SIGNWRITING EYEBROWS STRAIGHT DOWN;Mn;0;NSM;;;;;N;;;;; +1DA0D;SIGNWRITING DREAMY EYEBROWS NEUTRAL DOWN;Mn;0;NSM;;;;;N;;;;; +1DA0E;SIGNWRITING DREAMY EYEBROWS DOWN NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA0F;SIGNWRITING DREAMY EYEBROWS UP NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA10;SIGNWRITING DREAMY EYEBROWS NEUTRAL UP;Mn;0;NSM;;;;;N;;;;; +1DA11;SIGNWRITING FOREHEAD NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA12;SIGNWRITING FOREHEAD CONTACT;Mn;0;NSM;;;;;N;;;;; +1DA13;SIGNWRITING FOREHEAD WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA14;SIGNWRITING EYES OPEN;Mn;0;NSM;;;;;N;;;;; +1DA15;SIGNWRITING EYES SQUEEZED;Mn;0;NSM;;;;;N;;;;; +1DA16;SIGNWRITING EYES CLOSED;Mn;0;NSM;;;;;N;;;;; +1DA17;SIGNWRITING EYE BLINK SINGLE;Mn;0;NSM;;;;;N;;;;; +1DA18;SIGNWRITING EYE BLINK MULTIPLE;Mn;0;NSM;;;;;N;;;;; +1DA19;SIGNWRITING EYES HALF OPEN;Mn;0;NSM;;;;;N;;;;; +1DA1A;SIGNWRITING EYES WIDE OPEN;Mn;0;NSM;;;;;N;;;;; +1DA1B;SIGNWRITING EYES HALF CLOSED;Mn;0;NSM;;;;;N;;;;; +1DA1C;SIGNWRITING EYES WIDENING MOVEMENT;Mn;0;NSM;;;;;N;;;;; +1DA1D;SIGNWRITING EYE WINK;Mn;0;NSM;;;;;N;;;;; +1DA1E;SIGNWRITING EYELASHES UP;Mn;0;NSM;;;;;N;;;;; +1DA1F;SIGNWRITING EYELASHES DOWN;Mn;0;NSM;;;;;N;;;;; +1DA20;SIGNWRITING EYELASHES FLUTTERING;Mn;0;NSM;;;;;N;;;;; +1DA21;SIGNWRITING EYEGAZE-WALLPLANE STRAIGHT;Mn;0;NSM;;;;;N;;;;; +1DA22;SIGNWRITING EYEGAZE-WALLPLANE STRAIGHT DOUBLE;Mn;0;NSM;;;;;N;;;;; +1DA23;SIGNWRITING EYEGAZE-WALLPLANE STRAIGHT ALTERNATING;Mn;0;NSM;;;;;N;;;;; +1DA24;SIGNWRITING EYEGAZE-FLOORPLANE STRAIGHT;Mn;0;NSM;;;;;N;;;;; +1DA25;SIGNWRITING EYEGAZE-FLOORPLANE STRAIGHT DOUBLE;Mn;0;NSM;;;;;N;;;;; +1DA26;SIGNWRITING EYEGAZE-FLOORPLANE STRAIGHT ALTERNATING;Mn;0;NSM;;;;;N;;;;; +1DA27;SIGNWRITING EYEGAZE-WALLPLANE CURVED;Mn;0;NSM;;;;;N;;;;; +1DA28;SIGNWRITING EYEGAZE-FLOORPLANE CURVED;Mn;0;NSM;;;;;N;;;;; +1DA29;SIGNWRITING EYEGAZE-WALLPLANE CIRCLING;Mn;0;NSM;;;;;N;;;;; +1DA2A;SIGNWRITING CHEEKS PUFFED;Mn;0;NSM;;;;;N;;;;; +1DA2B;SIGNWRITING CHEEKS NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA2C;SIGNWRITING CHEEKS SUCKED;Mn;0;NSM;;;;;N;;;;; +1DA2D;SIGNWRITING TENSE CHEEKS HIGH;Mn;0;NSM;;;;;N;;;;; +1DA2E;SIGNWRITING TENSE CHEEKS MIDDLE;Mn;0;NSM;;;;;N;;;;; +1DA2F;SIGNWRITING TENSE CHEEKS LOW;Mn;0;NSM;;;;;N;;;;; +1DA30;SIGNWRITING EARS;Mn;0;NSM;;;;;N;;;;; +1DA31;SIGNWRITING NOSE NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA32;SIGNWRITING NOSE CONTACT;Mn;0;NSM;;;;;N;;;;; +1DA33;SIGNWRITING NOSE WRINKLES;Mn;0;NSM;;;;;N;;;;; +1DA34;SIGNWRITING NOSE WIGGLES;Mn;0;NSM;;;;;N;;;;; +1DA35;SIGNWRITING AIR BLOWING OUT;Mn;0;NSM;;;;;N;;;;; +1DA36;SIGNWRITING AIR SUCKING IN;Mn;0;NSM;;;;;N;;;;; +1DA37;SIGNWRITING AIR BLOW SMALL ROTATIONS;So;0;L;;;;;N;;;;; +1DA38;SIGNWRITING AIR SUCK SMALL ROTATIONS;So;0;L;;;;;N;;;;; +1DA39;SIGNWRITING BREATH INHALE;So;0;L;;;;;N;;;;; +1DA3A;SIGNWRITING BREATH EXHALE;So;0;L;;;;;N;;;;; +1DA3B;SIGNWRITING MOUTH CLOSED NEUTRAL;Mn;0;NSM;;;;;N;;;;; +1DA3C;SIGNWRITING MOUTH CLOSED FORWARD;Mn;0;NSM;;;;;N;;;;; +1DA3D;SIGNWRITING MOUTH CLOSED CONTACT;Mn;0;NSM;;;;;N;;;;; +1DA3E;SIGNWRITING MOUTH SMILE;Mn;0;NSM;;;;;N;;;;; +1DA3F;SIGNWRITING MOUTH SMILE WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA40;SIGNWRITING MOUTH SMILE OPEN;Mn;0;NSM;;;;;N;;;;; +1DA41;SIGNWRITING MOUTH FROWN;Mn;0;NSM;;;;;N;;;;; +1DA42;SIGNWRITING MOUTH FROWN WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA43;SIGNWRITING MOUTH FROWN OPEN;Mn;0;NSM;;;;;N;;;;; +1DA44;SIGNWRITING MOUTH OPEN CIRCLE;Mn;0;NSM;;;;;N;;;;; +1DA45;SIGNWRITING MOUTH OPEN FORWARD;Mn;0;NSM;;;;;N;;;;; +1DA46;SIGNWRITING MOUTH OPEN WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA47;SIGNWRITING MOUTH OPEN OVAL;Mn;0;NSM;;;;;N;;;;; +1DA48;SIGNWRITING MOUTH OPEN OVAL WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA49;SIGNWRITING MOUTH OPEN OVAL YAWN;Mn;0;NSM;;;;;N;;;;; +1DA4A;SIGNWRITING MOUTH OPEN RECTANGLE;Mn;0;NSM;;;;;N;;;;; +1DA4B;SIGNWRITING MOUTH OPEN RECTANGLE WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA4C;SIGNWRITING MOUTH OPEN RECTANGLE YAWN;Mn;0;NSM;;;;;N;;;;; +1DA4D;SIGNWRITING MOUTH KISS;Mn;0;NSM;;;;;N;;;;; +1DA4E;SIGNWRITING MOUTH KISS FORWARD;Mn;0;NSM;;;;;N;;;;; +1DA4F;SIGNWRITING MOUTH KISS WRINKLED;Mn;0;NSM;;;;;N;;;;; +1DA50;SIGNWRITING MOUTH TENSE;Mn;0;NSM;;;;;N;;;;; +1DA51;SIGNWRITING MOUTH TENSE FORWARD;Mn;0;NSM;;;;;N;;;;; +1DA52;SIGNWRITING MOUTH TENSE SUCKED;Mn;0;NSM;;;;;N;;;;; +1DA53;SIGNWRITING LIPS PRESSED TOGETHER;Mn;0;NSM;;;;;N;;;;; +1DA54;SIGNWRITING LIP LOWER OVER UPPER;Mn;0;NSM;;;;;N;;;;; +1DA55;SIGNWRITING LIP UPPER OVER LOWER;Mn;0;NSM;;;;;N;;;;; +1DA56;SIGNWRITING MOUTH CORNERS;Mn;0;NSM;;;;;N;;;;; +1DA57;SIGNWRITING MOUTH WRINKLES SINGLE;Mn;0;NSM;;;;;N;;;;; +1DA58;SIGNWRITING MOUTH WRINKLES DOUBLE;Mn;0;NSM;;;;;N;;;;; +1DA59;SIGNWRITING TONGUE STICKING OUT FAR;Mn;0;NSM;;;;;N;;;;; +1DA5A;SIGNWRITING TONGUE LICKING LIPS;Mn;0;NSM;;;;;N;;;;; +1DA5B;SIGNWRITING TONGUE TIP BETWEEN LIPS;Mn;0;NSM;;;;;N;;;;; +1DA5C;SIGNWRITING TONGUE TIP TOUCHING INSIDE MOUTH;Mn;0;NSM;;;;;N;;;;; +1DA5D;SIGNWRITING TONGUE INSIDE MOUTH RELAXED;Mn;0;NSM;;;;;N;;;;; +1DA5E;SIGNWRITING TONGUE MOVES AGAINST CHEEK;Mn;0;NSM;;;;;N;;;;; +1DA5F;SIGNWRITING TONGUE CENTRE STICKING OUT;Mn;0;NSM;;;;;N;;;;; +1DA60;SIGNWRITING TONGUE CENTRE INSIDE MOUTH;Mn;0;NSM;;;;;N;;;;; +1DA61;SIGNWRITING TEETH;Mn;0;NSM;;;;;N;;;;; +1DA62;SIGNWRITING TEETH MOVEMENT;Mn;0;NSM;;;;;N;;;;; +1DA63;SIGNWRITING TEETH ON TONGUE;Mn;0;NSM;;;;;N;;;;; +1DA64;SIGNWRITING TEETH ON TONGUE MOVEMENT;Mn;0;NSM;;;;;N;;;;; +1DA65;SIGNWRITING TEETH ON LIPS;Mn;0;NSM;;;;;N;;;;; +1DA66;SIGNWRITING TEETH ON LIPS MOVEMENT;Mn;0;NSM;;;;;N;;;;; +1DA67;SIGNWRITING TEETH BITE LIPS;Mn;0;NSM;;;;;N;;;;; +1DA68;SIGNWRITING MOVEMENT-WALLPLANE JAW;Mn;0;NSM;;;;;N;;;;; +1DA69;SIGNWRITING MOVEMENT-FLOORPLANE JAW;Mn;0;NSM;;;;;N;;;;; +1DA6A;SIGNWRITING NECK;Mn;0;NSM;;;;;N;;;;; +1DA6B;SIGNWRITING HAIR;Mn;0;NSM;;;;;N;;;;; +1DA6C;SIGNWRITING EXCITEMENT;Mn;0;NSM;;;;;N;;;;; +1DA6D;SIGNWRITING SHOULDER HIP SPINE;So;0;L;;;;;N;;;;; +1DA6E;SIGNWRITING SHOULDER HIP POSITIONS;So;0;L;;;;;N;;;;; +1DA6F;SIGNWRITING WALLPLANE SHOULDER HIP MOVE;So;0;L;;;;;N;;;;; +1DA70;SIGNWRITING FLOORPLANE SHOULDER HIP MOVE;So;0;L;;;;;N;;;;; +1DA71;SIGNWRITING SHOULDER TILTING FROM WAIST;So;0;L;;;;;N;;;;; +1DA72;SIGNWRITING TORSO-WALLPLANE STRAIGHT STRETCH;So;0;L;;;;;N;;;;; +1DA73;SIGNWRITING TORSO-WALLPLANE CURVED BEND;So;0;L;;;;;N;;;;; +1DA74;SIGNWRITING TORSO-FLOORPLANE TWISTING;So;0;L;;;;;N;;;;; +1DA75;SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS;Mn;0;NSM;;;;;N;;;;; +1DA76;SIGNWRITING LIMB COMBINATION;So;0;L;;;;;N;;;;; +1DA77;SIGNWRITING LIMB LENGTH-1;So;0;L;;;;;N;;;;; +1DA78;SIGNWRITING LIMB LENGTH-2;So;0;L;;;;;N;;;;; +1DA79;SIGNWRITING LIMB LENGTH-3;So;0;L;;;;;N;;;;; +1DA7A;SIGNWRITING LIMB LENGTH-4;So;0;L;;;;;N;;;;; +1DA7B;SIGNWRITING LIMB LENGTH-5;So;0;L;;;;;N;;;;; +1DA7C;SIGNWRITING LIMB LENGTH-6;So;0;L;;;;;N;;;;; +1DA7D;SIGNWRITING LIMB LENGTH-7;So;0;L;;;;;N;;;;; +1DA7E;SIGNWRITING FINGER;So;0;L;;;;;N;;;;; +1DA7F;SIGNWRITING LOCATION-WALLPLANE SPACE;So;0;L;;;;;N;;;;; +1DA80;SIGNWRITING LOCATION-FLOORPLANE SPACE;So;0;L;;;;;N;;;;; +1DA81;SIGNWRITING LOCATION HEIGHT;So;0;L;;;;;N;;;;; +1DA82;SIGNWRITING LOCATION WIDTH;So;0;L;;;;;N;;;;; +1DA83;SIGNWRITING LOCATION DEPTH;So;0;L;;;;;N;;;;; +1DA84;SIGNWRITING LOCATION HEAD NECK;Mn;0;NSM;;;;;N;;;;; +1DA85;SIGNWRITING LOCATION TORSO;So;0;L;;;;;N;;;;; +1DA86;SIGNWRITING LOCATION LIMBS DIGITS;So;0;L;;;;;N;;;;; +1DA87;SIGNWRITING COMMA;Po;0;L;;;;;N;;;;; +1DA88;SIGNWRITING FULL STOP;Po;0;L;;;;;N;;;;; +1DA89;SIGNWRITING SEMICOLON;Po;0;L;;;;;N;;;;; +1DA8A;SIGNWRITING COLON;Po;0;L;;;;;N;;;;; +1DA8B;SIGNWRITING PARENTHESIS;Po;0;L;;;;;N;;;;; +1DA9B;SIGNWRITING FILL MODIFIER-2;Mn;0;NSM;;;;;N;;;;; +1DA9C;SIGNWRITING FILL MODIFIER-3;Mn;0;NSM;;;;;N;;;;; +1DA9D;SIGNWRITING FILL MODIFIER-4;Mn;0;NSM;;;;;N;;;;; +1DA9E;SIGNWRITING FILL MODIFIER-5;Mn;0;NSM;;;;;N;;;;; +1DA9F;SIGNWRITING FILL MODIFIER-6;Mn;0;NSM;;;;;N;;;;; +1DAA1;SIGNWRITING ROTATION MODIFIER-2;Mn;0;NSM;;;;;N;;;;; +1DAA2;SIGNWRITING ROTATION MODIFIER-3;Mn;0;NSM;;;;;N;;;;; +1DAA3;SIGNWRITING ROTATION MODIFIER-4;Mn;0;NSM;;;;;N;;;;; +1DAA4;SIGNWRITING ROTATION MODIFIER-5;Mn;0;NSM;;;;;N;;;;; +1DAA5;SIGNWRITING ROTATION MODIFIER-6;Mn;0;NSM;;;;;N;;;;; +1DAA6;SIGNWRITING ROTATION MODIFIER-7;Mn;0;NSM;;;;;N;;;;; +1DAA7;SIGNWRITING ROTATION MODIFIER-8;Mn;0;NSM;;;;;N;;;;; +1DAA8;SIGNWRITING ROTATION MODIFIER-9;Mn;0;NSM;;;;;N;;;;; +1DAA9;SIGNWRITING ROTATION MODIFIER-10;Mn;0;NSM;;;;;N;;;;; +1DAAA;SIGNWRITING ROTATION MODIFIER-11;Mn;0;NSM;;;;;N;;;;; +1DAAB;SIGNWRITING ROTATION MODIFIER-12;Mn;0;NSM;;;;;N;;;;; +1DAAC;SIGNWRITING ROTATION MODIFIER-13;Mn;0;NSM;;;;;N;;;;; +1DAAD;SIGNWRITING ROTATION MODIFIER-14;Mn;0;NSM;;;;;N;;;;; +1DAAE;SIGNWRITING ROTATION MODIFIER-15;Mn;0;NSM;;;;;N;;;;; +1DAAF;SIGNWRITING ROTATION MODIFIER-16;Mn;0;NSM;;;;;N;;;;; +1E000;COMBINING GLAGOLITIC LETTER AZU;Mn;230;NSM;;;;;N;;;;; +1E001;COMBINING GLAGOLITIC LETTER BUKY;Mn;230;NSM;;;;;N;;;;; +1E002;COMBINING GLAGOLITIC LETTER VEDE;Mn;230;NSM;;;;;N;;;;; +1E003;COMBINING GLAGOLITIC LETTER GLAGOLI;Mn;230;NSM;;;;;N;;;;; +1E004;COMBINING GLAGOLITIC LETTER DOBRO;Mn;230;NSM;;;;;N;;;;; +1E005;COMBINING GLAGOLITIC LETTER YESTU;Mn;230;NSM;;;;;N;;;;; +1E006;COMBINING GLAGOLITIC LETTER ZHIVETE;Mn;230;NSM;;;;;N;;;;; +1E008;COMBINING GLAGOLITIC LETTER ZEMLJA;Mn;230;NSM;;;;;N;;;;; +1E009;COMBINING GLAGOLITIC LETTER IZHE;Mn;230;NSM;;;;;N;;;;; +1E00A;COMBINING GLAGOLITIC LETTER INITIAL IZHE;Mn;230;NSM;;;;;N;;;;; +1E00B;COMBINING GLAGOLITIC LETTER I;Mn;230;NSM;;;;;N;;;;; +1E00C;COMBINING GLAGOLITIC LETTER DJERVI;Mn;230;NSM;;;;;N;;;;; +1E00D;COMBINING GLAGOLITIC LETTER KAKO;Mn;230;NSM;;;;;N;;;;; +1E00E;COMBINING GLAGOLITIC LETTER LJUDIJE;Mn;230;NSM;;;;;N;;;;; +1E00F;COMBINING GLAGOLITIC LETTER MYSLITE;Mn;230;NSM;;;;;N;;;;; +1E010;COMBINING GLAGOLITIC LETTER NASHI;Mn;230;NSM;;;;;N;;;;; +1E011;COMBINING GLAGOLITIC LETTER ONU;Mn;230;NSM;;;;;N;;;;; +1E012;COMBINING GLAGOLITIC LETTER POKOJI;Mn;230;NSM;;;;;N;;;;; +1E013;COMBINING GLAGOLITIC LETTER RITSI;Mn;230;NSM;;;;;N;;;;; +1E014;COMBINING GLAGOLITIC LETTER SLOVO;Mn;230;NSM;;;;;N;;;;; +1E015;COMBINING GLAGOLITIC LETTER TVRIDO;Mn;230;NSM;;;;;N;;;;; +1E016;COMBINING GLAGOLITIC LETTER UKU;Mn;230;NSM;;;;;N;;;;; +1E017;COMBINING GLAGOLITIC LETTER FRITU;Mn;230;NSM;;;;;N;;;;; +1E018;COMBINING GLAGOLITIC LETTER HERU;Mn;230;NSM;;;;;N;;;;; +1E01B;COMBINING GLAGOLITIC LETTER SHTA;Mn;230;NSM;;;;;N;;;;; +1E01C;COMBINING GLAGOLITIC LETTER TSI;Mn;230;NSM;;;;;N;;;;; +1E01D;COMBINING GLAGOLITIC LETTER CHRIVI;Mn;230;NSM;;;;;N;;;;; +1E01E;COMBINING GLAGOLITIC LETTER SHA;Mn;230;NSM;;;;;N;;;;; +1E01F;COMBINING GLAGOLITIC LETTER YERU;Mn;230;NSM;;;;;N;;;;; +1E020;COMBINING GLAGOLITIC LETTER YERI;Mn;230;NSM;;;;;N;;;;; +1E021;COMBINING GLAGOLITIC LETTER YATI;Mn;230;NSM;;;;;N;;;;; +1E023;COMBINING GLAGOLITIC LETTER YU;Mn;230;NSM;;;;;N;;;;; +1E024;COMBINING GLAGOLITIC LETTER SMALL YUS;Mn;230;NSM;;;;;N;;;;; +1E026;COMBINING GLAGOLITIC LETTER YO;Mn;230;NSM;;;;;N;;;;; +1E027;COMBINING GLAGOLITIC LETTER IOTATED SMALL YUS;Mn;230;NSM;;;;;N;;;;; +1E028;COMBINING GLAGOLITIC LETTER BIG YUS;Mn;230;NSM;;;;;N;;;;; +1E029;COMBINING GLAGOLITIC LETTER IOTATED BIG YUS;Mn;230;NSM;;;;;N;;;;; +1E02A;COMBINING GLAGOLITIC LETTER FITA;Mn;230;NSM;;;;;N;;;;; +1E800;MENDE KIKAKUI SYLLABLE M001 KI;Lo;0;R;;;;;N;;;;; +1E801;MENDE KIKAKUI SYLLABLE M002 KA;Lo;0;R;;;;;N;;;;; +1E802;MENDE KIKAKUI SYLLABLE M003 KU;Lo;0;R;;;;;N;;;;; +1E803;MENDE KIKAKUI SYLLABLE M065 KEE;Lo;0;R;;;;;N;;;;; +1E804;MENDE KIKAKUI SYLLABLE M095 KE;Lo;0;R;;;;;N;;;;; +1E805;MENDE KIKAKUI SYLLABLE M076 KOO;Lo;0;R;;;;;N;;;;; +1E806;MENDE KIKAKUI SYLLABLE M048 KO;Lo;0;R;;;;;N;;;;; +1E807;MENDE KIKAKUI SYLLABLE M179 KUA;Lo;0;R;;;;;N;;;;; +1E808;MENDE KIKAKUI SYLLABLE M004 WI;Lo;0;R;;;;;N;;;;; +1E809;MENDE KIKAKUI SYLLABLE M005 WA;Lo;0;R;;;;;N;;;;; +1E80A;MENDE KIKAKUI SYLLABLE M006 WU;Lo;0;R;;;;;N;;;;; +1E80B;MENDE KIKAKUI SYLLABLE M126 WEE;Lo;0;R;;;;;N;;;;; +1E80C;MENDE KIKAKUI SYLLABLE M118 WE;Lo;0;R;;;;;N;;;;; +1E80D;MENDE KIKAKUI SYLLABLE M114 WOO;Lo;0;R;;;;;N;;;;; +1E80E;MENDE KIKAKUI SYLLABLE M045 WO;Lo;0;R;;;;;N;;;;; +1E80F;MENDE KIKAKUI SYLLABLE M194 WUI;Lo;0;R;;;;;N;;;;; +1E810;MENDE KIKAKUI SYLLABLE M143 WEI;Lo;0;R;;;;;N;;;;; +1E811;MENDE KIKAKUI SYLLABLE M061 WVI;Lo;0;R;;;;;N;;;;; +1E812;MENDE KIKAKUI SYLLABLE M049 WVA;Lo;0;R;;;;;N;;;;; +1E813;MENDE KIKAKUI SYLLABLE M139 WVE;Lo;0;R;;;;;N;;;;; +1E814;MENDE KIKAKUI SYLLABLE M007 MIN;Lo;0;R;;;;;N;;;;; +1E815;MENDE KIKAKUI SYLLABLE M008 MAN;Lo;0;R;;;;;N;;;;; +1E816;MENDE KIKAKUI SYLLABLE M009 MUN;Lo;0;R;;;;;N;;;;; +1E817;MENDE KIKAKUI SYLLABLE M059 MEN;Lo;0;R;;;;;N;;;;; +1E818;MENDE KIKAKUI SYLLABLE M094 MON;Lo;0;R;;;;;N;;;;; +1E819;MENDE KIKAKUI SYLLABLE M154 MUAN;Lo;0;R;;;;;N;;;;; +1E81A;MENDE KIKAKUI SYLLABLE M189 MUEN;Lo;0;R;;;;;N;;;;; +1E81B;MENDE KIKAKUI SYLLABLE M010 BI;Lo;0;R;;;;;N;;;;; +1E81C;MENDE KIKAKUI SYLLABLE M011 BA;Lo;0;R;;;;;N;;;;; +1E81D;MENDE KIKAKUI SYLLABLE M012 BU;Lo;0;R;;;;;N;;;;; +1E81E;MENDE KIKAKUI SYLLABLE M150 BEE;Lo;0;R;;;;;N;;;;; +1E81F;MENDE KIKAKUI SYLLABLE M097 BE;Lo;0;R;;;;;N;;;;; +1E820;MENDE KIKAKUI SYLLABLE M103 BOO;Lo;0;R;;;;;N;;;;; +1E821;MENDE KIKAKUI SYLLABLE M138 BO;Lo;0;R;;;;;N;;;;; +1E822;MENDE KIKAKUI SYLLABLE M013 I;Lo;0;R;;;;;N;;;;; +1E823;MENDE KIKAKUI SYLLABLE M014 A;Lo;0;R;;;;;N;;;;; +1E824;MENDE KIKAKUI SYLLABLE M015 U;Lo;0;R;;;;;N;;;;; +1E825;MENDE KIKAKUI SYLLABLE M163 EE;Lo;0;R;;;;;N;;;;; +1E826;MENDE KIKAKUI SYLLABLE M100 E;Lo;0;R;;;;;N;;;;; +1E827;MENDE KIKAKUI SYLLABLE M165 OO;Lo;0;R;;;;;N;;;;; +1E828;MENDE KIKAKUI SYLLABLE M147 O;Lo;0;R;;;;;N;;;;; +1E829;MENDE KIKAKUI SYLLABLE M137 EI;Lo;0;R;;;;;N;;;;; +1E82A;MENDE KIKAKUI SYLLABLE M131 IN;Lo;0;R;;;;;N;;;;; +1E82B;MENDE KIKAKUI SYLLABLE M135 IN;Lo;0;R;;;;;N;;;;; +1E82C;MENDE KIKAKUI SYLLABLE M195 AN;Lo;0;R;;;;;N;;;;; +1E82D;MENDE KIKAKUI SYLLABLE M178 EN;Lo;0;R;;;;;N;;;;; +1E82E;MENDE KIKAKUI SYLLABLE M019 SI;Lo;0;R;;;;;N;;;;; +1E82F;MENDE KIKAKUI SYLLABLE M020 SA;Lo;0;R;;;;;N;;;;; +1E830;MENDE KIKAKUI SYLLABLE M021 SU;Lo;0;R;;;;;N;;;;; +1E831;MENDE KIKAKUI SYLLABLE M162 SEE;Lo;0;R;;;;;N;;;;; +1E832;MENDE KIKAKUI SYLLABLE M116 SE;Lo;0;R;;;;;N;;;;; +1E833;MENDE KIKAKUI SYLLABLE M136 SOO;Lo;0;R;;;;;N;;;;; +1E834;MENDE KIKAKUI SYLLABLE M079 SO;Lo;0;R;;;;;N;;;;; +1E835;MENDE KIKAKUI SYLLABLE M196 SIA;Lo;0;R;;;;;N;;;;; +1E836;MENDE KIKAKUI SYLLABLE M025 LI;Lo;0;R;;;;;N;;;;; +1E837;MENDE KIKAKUI SYLLABLE M026 LA;Lo;0;R;;;;;N;;;;; +1E838;MENDE KIKAKUI SYLLABLE M027 LU;Lo;0;R;;;;;N;;;;; +1E839;MENDE KIKAKUI SYLLABLE M084 LEE;Lo;0;R;;;;;N;;;;; +1E83A;MENDE KIKAKUI SYLLABLE M073 LE;Lo;0;R;;;;;N;;;;; +1E83B;MENDE KIKAKUI SYLLABLE M054 LOO;Lo;0;R;;;;;N;;;;; +1E83C;MENDE KIKAKUI SYLLABLE M153 LO;Lo;0;R;;;;;N;;;;; +1E83D;MENDE KIKAKUI SYLLABLE M110 LONG LE;Lo;0;R;;;;;N;;;;; +1E83E;MENDE KIKAKUI SYLLABLE M016 DI;Lo;0;R;;;;;N;;;;; +1E83F;MENDE KIKAKUI SYLLABLE M017 DA;Lo;0;R;;;;;N;;;;; +1E840;MENDE KIKAKUI SYLLABLE M018 DU;Lo;0;R;;;;;N;;;;; +1E841;MENDE KIKAKUI SYLLABLE M089 DEE;Lo;0;R;;;;;N;;;;; +1E842;MENDE KIKAKUI SYLLABLE M180 DOO;Lo;0;R;;;;;N;;;;; +1E843;MENDE KIKAKUI SYLLABLE M181 DO;Lo;0;R;;;;;N;;;;; +1E844;MENDE KIKAKUI SYLLABLE M022 TI;Lo;0;R;;;;;N;;;;; +1E845;MENDE KIKAKUI SYLLABLE M023 TA;Lo;0;R;;;;;N;;;;; +1E846;MENDE KIKAKUI SYLLABLE M024 TU;Lo;0;R;;;;;N;;;;; +1E847;MENDE KIKAKUI SYLLABLE M091 TEE;Lo;0;R;;;;;N;;;;; +1E848;MENDE KIKAKUI SYLLABLE M055 TE;Lo;0;R;;;;;N;;;;; +1E849;MENDE KIKAKUI SYLLABLE M104 TOO;Lo;0;R;;;;;N;;;;; +1E84A;MENDE KIKAKUI SYLLABLE M069 TO;Lo;0;R;;;;;N;;;;; +1E84B;MENDE KIKAKUI SYLLABLE M028 JI;Lo;0;R;;;;;N;;;;; +1E84C;MENDE KIKAKUI SYLLABLE M029 JA;Lo;0;R;;;;;N;;;;; +1E84D;MENDE KIKAKUI SYLLABLE M030 JU;Lo;0;R;;;;;N;;;;; +1E84E;MENDE KIKAKUI SYLLABLE M157 JEE;Lo;0;R;;;;;N;;;;; +1E84F;MENDE KIKAKUI SYLLABLE M113 JE;Lo;0;R;;;;;N;;;;; +1E850;MENDE KIKAKUI SYLLABLE M160 JOO;Lo;0;R;;;;;N;;;;; +1E851;MENDE KIKAKUI SYLLABLE M063 JO;Lo;0;R;;;;;N;;;;; +1E852;MENDE KIKAKUI SYLLABLE M175 LONG JO;Lo;0;R;;;;;N;;;;; +1E853;MENDE KIKAKUI SYLLABLE M031 YI;Lo;0;R;;;;;N;;;;; +1E854;MENDE KIKAKUI SYLLABLE M032 YA;Lo;0;R;;;;;N;;;;; +1E855;MENDE KIKAKUI SYLLABLE M033 YU;Lo;0;R;;;;;N;;;;; +1E856;MENDE KIKAKUI SYLLABLE M109 YEE;Lo;0;R;;;;;N;;;;; +1E857;MENDE KIKAKUI SYLLABLE M080 YE;Lo;0;R;;;;;N;;;;; +1E858;MENDE KIKAKUI SYLLABLE M141 YOO;Lo;0;R;;;;;N;;;;; +1E859;MENDE KIKAKUI SYLLABLE M121 YO;Lo;0;R;;;;;N;;;;; +1E85A;MENDE KIKAKUI SYLLABLE M034 FI;Lo;0;R;;;;;N;;;;; +1E85B;MENDE KIKAKUI SYLLABLE M035 FA;Lo;0;R;;;;;N;;;;; +1E85C;MENDE KIKAKUI SYLLABLE M036 FU;Lo;0;R;;;;;N;;;;; +1E85D;MENDE KIKAKUI SYLLABLE M078 FEE;Lo;0;R;;;;;N;;;;; +1E85E;MENDE KIKAKUI SYLLABLE M075 FE;Lo;0;R;;;;;N;;;;; +1E85F;MENDE KIKAKUI SYLLABLE M133 FOO;Lo;0;R;;;;;N;;;;; +1E860;MENDE KIKAKUI SYLLABLE M088 FO;Lo;0;R;;;;;N;;;;; +1E861;MENDE KIKAKUI SYLLABLE M197 FUA;Lo;0;R;;;;;N;;;;; +1E862;MENDE KIKAKUI SYLLABLE M101 FAN;Lo;0;R;;;;;N;;;;; +1E863;MENDE KIKAKUI SYLLABLE M037 NIN;Lo;0;R;;;;;N;;;;; +1E864;MENDE KIKAKUI SYLLABLE M038 NAN;Lo;0;R;;;;;N;;;;; +1E865;MENDE KIKAKUI SYLLABLE M039 NUN;Lo;0;R;;;;;N;;;;; +1E866;MENDE KIKAKUI SYLLABLE M117 NEN;Lo;0;R;;;;;N;;;;; +1E867;MENDE KIKAKUI SYLLABLE M169 NON;Lo;0;R;;;;;N;;;;; +1E868;MENDE KIKAKUI SYLLABLE M176 HI;Lo;0;R;;;;;N;;;;; +1E869;MENDE KIKAKUI SYLLABLE M041 HA;Lo;0;R;;;;;N;;;;; +1E86A;MENDE KIKAKUI SYLLABLE M186 HU;Lo;0;R;;;;;N;;;;; +1E86B;MENDE KIKAKUI SYLLABLE M040 HEE;Lo;0;R;;;;;N;;;;; +1E86C;MENDE KIKAKUI SYLLABLE M096 HE;Lo;0;R;;;;;N;;;;; +1E86D;MENDE KIKAKUI SYLLABLE M042 HOO;Lo;0;R;;;;;N;;;;; +1E86E;MENDE KIKAKUI SYLLABLE M140 HO;Lo;0;R;;;;;N;;;;; +1E86F;MENDE KIKAKUI SYLLABLE M083 HEEI;Lo;0;R;;;;;N;;;;; +1E870;MENDE KIKAKUI SYLLABLE M128 HOOU;Lo;0;R;;;;;N;;;;; +1E871;MENDE KIKAKUI SYLLABLE M053 HIN;Lo;0;R;;;;;N;;;;; +1E872;MENDE KIKAKUI SYLLABLE M130 HAN;Lo;0;R;;;;;N;;;;; +1E873;MENDE KIKAKUI SYLLABLE M087 HUN;Lo;0;R;;;;;N;;;;; +1E874;MENDE KIKAKUI SYLLABLE M052 HEN;Lo;0;R;;;;;N;;;;; +1E875;MENDE KIKAKUI SYLLABLE M193 HON;Lo;0;R;;;;;N;;;;; +1E876;MENDE KIKAKUI SYLLABLE M046 HUAN;Lo;0;R;;;;;N;;;;; +1E877;MENDE KIKAKUI SYLLABLE M090 NGGI;Lo;0;R;;;;;N;;;;; +1E878;MENDE KIKAKUI SYLLABLE M043 NGGA;Lo;0;R;;;;;N;;;;; +1E879;MENDE KIKAKUI SYLLABLE M082 NGGU;Lo;0;R;;;;;N;;;;; +1E87A;MENDE KIKAKUI SYLLABLE M115 NGGEE;Lo;0;R;;;;;N;;;;; +1E87B;MENDE KIKAKUI SYLLABLE M146 NGGE;Lo;0;R;;;;;N;;;;; +1E87C;MENDE KIKAKUI SYLLABLE M156 NGGOO;Lo;0;R;;;;;N;;;;; +1E87D;MENDE KIKAKUI SYLLABLE M120 NGGO;Lo;0;R;;;;;N;;;;; +1E87E;MENDE KIKAKUI SYLLABLE M159 NGGAA;Lo;0;R;;;;;N;;;;; +1E87F;MENDE KIKAKUI SYLLABLE M127 NGGUA;Lo;0;R;;;;;N;;;;; +1E880;MENDE KIKAKUI SYLLABLE M086 LONG NGGE;Lo;0;R;;;;;N;;;;; +1E881;MENDE KIKAKUI SYLLABLE M106 LONG NGGOO;Lo;0;R;;;;;N;;;;; +1E882;MENDE KIKAKUI SYLLABLE M183 LONG NGGO;Lo;0;R;;;;;N;;;;; +1E883;MENDE KIKAKUI SYLLABLE M155 GI;Lo;0;R;;;;;N;;;;; +1E884;MENDE KIKAKUI SYLLABLE M111 GA;Lo;0;R;;;;;N;;;;; +1E885;MENDE KIKAKUI SYLLABLE M168 GU;Lo;0;R;;;;;N;;;;; +1E886;MENDE KIKAKUI SYLLABLE M190 GEE;Lo;0;R;;;;;N;;;;; +1E887;MENDE KIKAKUI SYLLABLE M166 GUEI;Lo;0;R;;;;;N;;;;; +1E888;MENDE KIKAKUI SYLLABLE M167 GUAN;Lo;0;R;;;;;N;;;;; +1E889;MENDE KIKAKUI SYLLABLE M184 NGEN;Lo;0;R;;;;;N;;;;; +1E88A;MENDE KIKAKUI SYLLABLE M057 NGON;Lo;0;R;;;;;N;;;;; +1E88B;MENDE KIKAKUI SYLLABLE M177 NGUAN;Lo;0;R;;;;;N;;;;; +1E88C;MENDE KIKAKUI SYLLABLE M068 PI;Lo;0;R;;;;;N;;;;; +1E88D;MENDE KIKAKUI SYLLABLE M099 PA;Lo;0;R;;;;;N;;;;; +1E88E;MENDE KIKAKUI SYLLABLE M050 PU;Lo;0;R;;;;;N;;;;; +1E88F;MENDE KIKAKUI SYLLABLE M081 PEE;Lo;0;R;;;;;N;;;;; +1E890;MENDE KIKAKUI SYLLABLE M051 PE;Lo;0;R;;;;;N;;;;; +1E891;MENDE KIKAKUI SYLLABLE M102 POO;Lo;0;R;;;;;N;;;;; +1E892;MENDE KIKAKUI SYLLABLE M066 PO;Lo;0;R;;;;;N;;;;; +1E893;MENDE KIKAKUI SYLLABLE M145 MBI;Lo;0;R;;;;;N;;;;; +1E894;MENDE KIKAKUI SYLLABLE M062 MBA;Lo;0;R;;;;;N;;;;; +1E895;MENDE KIKAKUI SYLLABLE M122 MBU;Lo;0;R;;;;;N;;;;; +1E896;MENDE KIKAKUI SYLLABLE M047 MBEE;Lo;0;R;;;;;N;;;;; +1E897;MENDE KIKAKUI SYLLABLE M188 MBEE;Lo;0;R;;;;;N;;;;; +1E898;MENDE KIKAKUI SYLLABLE M072 MBE;Lo;0;R;;;;;N;;;;; +1E899;MENDE KIKAKUI SYLLABLE M172 MBOO;Lo;0;R;;;;;N;;;;; +1E89A;MENDE KIKAKUI SYLLABLE M174 MBO;Lo;0;R;;;;;N;;;;; +1E89B;MENDE KIKAKUI SYLLABLE M187 MBUU;Lo;0;R;;;;;N;;;;; +1E89C;MENDE KIKAKUI SYLLABLE M161 LONG MBE;Lo;0;R;;;;;N;;;;; +1E89D;MENDE KIKAKUI SYLLABLE M105 LONG MBOO;Lo;0;R;;;;;N;;;;; +1E89E;MENDE KIKAKUI SYLLABLE M142 LONG MBO;Lo;0;R;;;;;N;;;;; +1E89F;MENDE KIKAKUI SYLLABLE M132 KPI;Lo;0;R;;;;;N;;;;; +1E8A0;MENDE KIKAKUI SYLLABLE M092 KPA;Lo;0;R;;;;;N;;;;; +1E8A1;MENDE KIKAKUI SYLLABLE M074 KPU;Lo;0;R;;;;;N;;;;; +1E8A2;MENDE KIKAKUI SYLLABLE M044 KPEE;Lo;0;R;;;;;N;;;;; +1E8A3;MENDE KIKAKUI SYLLABLE M108 KPE;Lo;0;R;;;;;N;;;;; +1E8A4;MENDE KIKAKUI SYLLABLE M112 KPOO;Lo;0;R;;;;;N;;;;; +1E8A5;MENDE KIKAKUI SYLLABLE M158 KPO;Lo;0;R;;;;;N;;;;; +1E8A6;MENDE KIKAKUI SYLLABLE M124 GBI;Lo;0;R;;;;;N;;;;; +1E8A7;MENDE KIKAKUI SYLLABLE M056 GBA;Lo;0;R;;;;;N;;;;; +1E8A8;MENDE KIKAKUI SYLLABLE M148 GBU;Lo;0;R;;;;;N;;;;; +1E8A9;MENDE KIKAKUI SYLLABLE M093 GBEE;Lo;0;R;;;;;N;;;;; +1E8AA;MENDE KIKAKUI SYLLABLE M107 GBE;Lo;0;R;;;;;N;;;;; +1E8AB;MENDE KIKAKUI SYLLABLE M071 GBOO;Lo;0;R;;;;;N;;;;; +1E8AC;MENDE KIKAKUI SYLLABLE M070 GBO;Lo;0;R;;;;;N;;;;; +1E8AD;MENDE KIKAKUI SYLLABLE M171 RA;Lo;0;R;;;;;N;;;;; +1E8AE;MENDE KIKAKUI SYLLABLE M123 NDI;Lo;0;R;;;;;N;;;;; +1E8AF;MENDE KIKAKUI SYLLABLE M129 NDA;Lo;0;R;;;;;N;;;;; +1E8B0;MENDE KIKAKUI SYLLABLE M125 NDU;Lo;0;R;;;;;N;;;;; +1E8B1;MENDE KIKAKUI SYLLABLE M191 NDEE;Lo;0;R;;;;;N;;;;; +1E8B2;MENDE KIKAKUI SYLLABLE M119 NDE;Lo;0;R;;;;;N;;;;; +1E8B3;MENDE KIKAKUI SYLLABLE M067 NDOO;Lo;0;R;;;;;N;;;;; +1E8B4;MENDE KIKAKUI SYLLABLE M064 NDO;Lo;0;R;;;;;N;;;;; +1E8B5;MENDE KIKAKUI SYLLABLE M152 NJA;Lo;0;R;;;;;N;;;;; +1E8B6;MENDE KIKAKUI SYLLABLE M192 NJU;Lo;0;R;;;;;N;;;;; +1E8B7;MENDE KIKAKUI SYLLABLE M149 NJEE;Lo;0;R;;;;;N;;;;; +1E8B8;MENDE KIKAKUI SYLLABLE M134 NJOO;Lo;0;R;;;;;N;;;;; +1E8B9;MENDE KIKAKUI SYLLABLE M182 VI;Lo;0;R;;;;;N;;;;; +1E8BA;MENDE KIKAKUI SYLLABLE M185 VA;Lo;0;R;;;;;N;;;;; +1E8BB;MENDE KIKAKUI SYLLABLE M151 VU;Lo;0;R;;;;;N;;;;; +1E8BC;MENDE KIKAKUI SYLLABLE M173 VEE;Lo;0;R;;;;;N;;;;; +1E8BD;MENDE KIKAKUI SYLLABLE M085 VE;Lo;0;R;;;;;N;;;;; +1E8BE;MENDE KIKAKUI SYLLABLE M144 VOO;Lo;0;R;;;;;N;;;;; +1E8BF;MENDE KIKAKUI SYLLABLE M077 VO;Lo;0;R;;;;;N;;;;; +1E8C0;MENDE KIKAKUI SYLLABLE M164 NYIN;Lo;0;R;;;;;N;;;;; +1E8C1;MENDE KIKAKUI SYLLABLE M058 NYAN;Lo;0;R;;;;;N;;;;; +1E8C2;MENDE KIKAKUI SYLLABLE M170 NYUN;Lo;0;R;;;;;N;;;;; +1E8C3;MENDE KIKAKUI SYLLABLE M098 NYEN;Lo;0;R;;;;;N;;;;; +1E8C4;MENDE KIKAKUI SYLLABLE M060 NYON;Lo;0;R;;;;;N;;;;; +1E8C7;MENDE KIKAKUI DIGIT ONE;No;0;R;;;;1;N;;;;; +1E8C8;MENDE KIKAKUI DIGIT TWO;No;0;R;;;;2;N;;;;; +1E8C9;MENDE KIKAKUI DIGIT THREE;No;0;R;;;;3;N;;;;; +1E8CA;MENDE KIKAKUI DIGIT FOUR;No;0;R;;;;4;N;;;;; +1E8CB;MENDE KIKAKUI DIGIT FIVE;No;0;R;;;;5;N;;;;; +1E8CC;MENDE KIKAKUI DIGIT SIX;No;0;R;;;;6;N;;;;; +1E8CD;MENDE KIKAKUI DIGIT SEVEN;No;0;R;;;;7;N;;;;; +1E8CE;MENDE KIKAKUI DIGIT EIGHT;No;0;R;;;;8;N;;;;; +1E8CF;MENDE KIKAKUI DIGIT NINE;No;0;R;;;;9;N;;;;; +1E8D0;MENDE KIKAKUI COMBINING NUMBER TEENS;Mn;220;NSM;;;;;N;;;;; +1E8D1;MENDE KIKAKUI COMBINING NUMBER TENS;Mn;220;NSM;;;;;N;;;;; +1E8D2;MENDE KIKAKUI COMBINING NUMBER HUNDREDS;Mn;220;NSM;;;;;N;;;;; +1E8D3;MENDE KIKAKUI COMBINING NUMBER THOUSANDS;Mn;220;NSM;;;;;N;;;;; +1E8D4;MENDE KIKAKUI COMBINING NUMBER TEN THOUSANDS;Mn;220;NSM;;;;;N;;;;; +1E8D5;MENDE KIKAKUI COMBINING NUMBER HUNDRED THOUSANDS;Mn;220;NSM;;;;;N;;;;; +1E8D6;MENDE KIKAKUI COMBINING NUMBER MILLIONS;Mn;220;NSM;;;;;N;;;;; +1E900;ADLAM CAPITAL LETTER ALIF;Lu;0;R;;;;;N;;;;1E922; +1E901;ADLAM CAPITAL LETTER DAALI;Lu;0;R;;;;;N;;;;1E923; +1E902;ADLAM CAPITAL LETTER LAAM;Lu;0;R;;;;;N;;;;1E924; +1E903;ADLAM CAPITAL LETTER MIIM;Lu;0;R;;;;;N;;;;1E925; +1E904;ADLAM CAPITAL LETTER BA;Lu;0;R;;;;;N;;;;1E926; +1E905;ADLAM CAPITAL LETTER SINNYIIYHE;Lu;0;R;;;;;N;;;;1E927; +1E906;ADLAM CAPITAL LETTER PE;Lu;0;R;;;;;N;;;;1E928; +1E907;ADLAM CAPITAL LETTER BHE;Lu;0;R;;;;;N;;;;1E929; +1E908;ADLAM CAPITAL LETTER RA;Lu;0;R;;;;;N;;;;1E92A; +1E909;ADLAM CAPITAL LETTER E;Lu;0;R;;;;;N;;;;1E92B; +1E90A;ADLAM CAPITAL LETTER FA;Lu;0;R;;;;;N;;;;1E92C; +1E90B;ADLAM CAPITAL LETTER I;Lu;0;R;;;;;N;;;;1E92D; +1E90C;ADLAM CAPITAL LETTER O;Lu;0;R;;;;;N;;;;1E92E; +1E90D;ADLAM CAPITAL LETTER DHA;Lu;0;R;;;;;N;;;;1E92F; +1E90E;ADLAM CAPITAL LETTER YHE;Lu;0;R;;;;;N;;;;1E930; +1E90F;ADLAM CAPITAL LETTER WAW;Lu;0;R;;;;;N;;;;1E931; +1E910;ADLAM CAPITAL LETTER NUN;Lu;0;R;;;;;N;;;;1E932; +1E911;ADLAM CAPITAL LETTER KAF;Lu;0;R;;;;;N;;;;1E933; +1E912;ADLAM CAPITAL LETTER YA;Lu;0;R;;;;;N;;;;1E934; +1E913;ADLAM CAPITAL LETTER U;Lu;0;R;;;;;N;;;;1E935; +1E914;ADLAM CAPITAL LETTER JIIM;Lu;0;R;;;;;N;;;;1E936; +1E915;ADLAM CAPITAL LETTER CHI;Lu;0;R;;;;;N;;;;1E937; +1E916;ADLAM CAPITAL LETTER HA;Lu;0;R;;;;;N;;;;1E938; +1E917;ADLAM CAPITAL LETTER QAAF;Lu;0;R;;;;;N;;;;1E939; +1E918;ADLAM CAPITAL LETTER GA;Lu;0;R;;;;;N;;;;1E93A; +1E919;ADLAM CAPITAL LETTER NYA;Lu;0;R;;;;;N;;;;1E93B; +1E91A;ADLAM CAPITAL LETTER TU;Lu;0;R;;;;;N;;;;1E93C; +1E91B;ADLAM CAPITAL LETTER NHA;Lu;0;R;;;;;N;;;;1E93D; +1E91C;ADLAM CAPITAL LETTER VA;Lu;0;R;;;;;N;;;;1E93E; +1E91D;ADLAM CAPITAL LETTER KHA;Lu;0;R;;;;;N;;;;1E93F; +1E91E;ADLAM CAPITAL LETTER GBE;Lu;0;R;;;;;N;;;;1E940; +1E91F;ADLAM CAPITAL LETTER ZAL;Lu;0;R;;;;;N;;;;1E941; +1E920;ADLAM CAPITAL LETTER KPO;Lu;0;R;;;;;N;;;;1E942; +1E921;ADLAM CAPITAL LETTER SHA;Lu;0;R;;;;;N;;;;1E943; +1E922;ADLAM SMALL LETTER ALIF;Ll;0;R;;;;;N;;;1E900;;1E900 +1E923;ADLAM SMALL LETTER DAALI;Ll;0;R;;;;;N;;;1E901;;1E901 +1E924;ADLAM SMALL LETTER LAAM;Ll;0;R;;;;;N;;;1E902;;1E902 +1E925;ADLAM SMALL LETTER MIIM;Ll;0;R;;;;;N;;;1E903;;1E903 +1E926;ADLAM SMALL LETTER BA;Ll;0;R;;;;;N;;;1E904;;1E904 +1E927;ADLAM SMALL LETTER SINNYIIYHE;Ll;0;R;;;;;N;;;1E905;;1E905 +1E928;ADLAM SMALL LETTER PE;Ll;0;R;;;;;N;;;1E906;;1E906 +1E929;ADLAM SMALL LETTER BHE;Ll;0;R;;;;;N;;;1E907;;1E907 +1E92A;ADLAM SMALL LETTER RA;Ll;0;R;;;;;N;;;1E908;;1E908 +1E92B;ADLAM SMALL LETTER E;Ll;0;R;;;;;N;;;1E909;;1E909 +1E92C;ADLAM SMALL LETTER FA;Ll;0;R;;;;;N;;;1E90A;;1E90A +1E92D;ADLAM SMALL LETTER I;Ll;0;R;;;;;N;;;1E90B;;1E90B +1E92E;ADLAM SMALL LETTER O;Ll;0;R;;;;;N;;;1E90C;;1E90C +1E92F;ADLAM SMALL LETTER DHA;Ll;0;R;;;;;N;;;1E90D;;1E90D +1E930;ADLAM SMALL LETTER YHE;Ll;0;R;;;;;N;;;1E90E;;1E90E +1E931;ADLAM SMALL LETTER WAW;Ll;0;R;;;;;N;;;1E90F;;1E90F +1E932;ADLAM SMALL LETTER NUN;Ll;0;R;;;;;N;;;1E910;;1E910 +1E933;ADLAM SMALL LETTER KAF;Ll;0;R;;;;;N;;;1E911;;1E911 +1E934;ADLAM SMALL LETTER YA;Ll;0;R;;;;;N;;;1E912;;1E912 +1E935;ADLAM SMALL LETTER U;Ll;0;R;;;;;N;;;1E913;;1E913 +1E936;ADLAM SMALL LETTER JIIM;Ll;0;R;;;;;N;;;1E914;;1E914 +1E937;ADLAM SMALL LETTER CHI;Ll;0;R;;;;;N;;;1E915;;1E915 +1E938;ADLAM SMALL LETTER HA;Ll;0;R;;;;;N;;;1E916;;1E916 +1E939;ADLAM SMALL LETTER QAAF;Ll;0;R;;;;;N;;;1E917;;1E917 +1E93A;ADLAM SMALL LETTER GA;Ll;0;R;;;;;N;;;1E918;;1E918 +1E93B;ADLAM SMALL LETTER NYA;Ll;0;R;;;;;N;;;1E919;;1E919 +1E93C;ADLAM SMALL LETTER TU;Ll;0;R;;;;;N;;;1E91A;;1E91A +1E93D;ADLAM SMALL LETTER NHA;Ll;0;R;;;;;N;;;1E91B;;1E91B +1E93E;ADLAM SMALL LETTER VA;Ll;0;R;;;;;N;;;1E91C;;1E91C +1E93F;ADLAM SMALL LETTER KHA;Ll;0;R;;;;;N;;;1E91D;;1E91D +1E940;ADLAM SMALL LETTER GBE;Ll;0;R;;;;;N;;;1E91E;;1E91E +1E941;ADLAM SMALL LETTER ZAL;Ll;0;R;;;;;N;;;1E91F;;1E91F +1E942;ADLAM SMALL LETTER KPO;Ll;0;R;;;;;N;;;1E920;;1E920 +1E943;ADLAM SMALL LETTER SHA;Ll;0;R;;;;;N;;;1E921;;1E921 +1E944;ADLAM ALIF LENGTHENER;Mn;230;NSM;;;;;N;;;;; +1E945;ADLAM VOWEL LENGTHENER;Mn;230;NSM;;;;;N;;;;; +1E946;ADLAM GEMINATION MARK;Mn;230;NSM;;;;;N;;;;; +1E947;ADLAM HAMZA;Mn;230;NSM;;;;;N;;;;; +1E948;ADLAM CONSONANT MODIFIER;Mn;230;NSM;;;;;N;;;;; +1E949;ADLAM GEMINATE CONSONANT MODIFIER;Mn;230;NSM;;;;;N;;;;; +1E94A;ADLAM NUKTA;Mn;7;NSM;;;;;N;;;;; +1E950;ADLAM DIGIT ZERO;Nd;0;R;;0;0;0;N;;;;; +1E951;ADLAM DIGIT ONE;Nd;0;R;;1;1;1;N;;;;; +1E952;ADLAM DIGIT TWO;Nd;0;R;;2;2;2;N;;;;; +1E953;ADLAM DIGIT THREE;Nd;0;R;;3;3;3;N;;;;; +1E954;ADLAM DIGIT FOUR;Nd;0;R;;4;4;4;N;;;;; +1E955;ADLAM DIGIT FIVE;Nd;0;R;;5;5;5;N;;;;; +1E956;ADLAM DIGIT SIX;Nd;0;R;;6;6;6;N;;;;; +1E957;ADLAM DIGIT SEVEN;Nd;0;R;;7;7;7;N;;;;; +1E958;ADLAM DIGIT EIGHT;Nd;0;R;;8;8;8;N;;;;; +1E959;ADLAM DIGIT NINE;Nd;0;R;;9;9;9;N;;;;; +1E95E;ADLAM INITIAL EXCLAMATION MARK;Po;0;R;;;;;N;;;;; +1E95F;ADLAM INITIAL QUESTION MARK;Po;0;R;;;;;N;;;;; +1EE00;ARABIC MATHEMATICAL ALEF;Lo;0;AL;<font> 0627;;;;N;;;;; +1EE01;ARABIC MATHEMATICAL BEH;Lo;0;AL;<font> 0628;;;;N;;;;; +1EE02;ARABIC MATHEMATICAL JEEM;Lo;0;AL;<font> 062C;;;;N;;;;; +1EE03;ARABIC MATHEMATICAL DAL;Lo;0;AL;<font> 062F;;;;N;;;;; +1EE05;ARABIC MATHEMATICAL WAW;Lo;0;AL;<font> 0648;;;;N;;;;; +1EE06;ARABIC MATHEMATICAL ZAIN;Lo;0;AL;<font> 0632;;;;N;;;;; +1EE07;ARABIC MATHEMATICAL HAH;Lo;0;AL;<font> 062D;;;;N;;;;; +1EE08;ARABIC MATHEMATICAL TAH;Lo;0;AL;<font> 0637;;;;N;;;;; +1EE09;ARABIC MATHEMATICAL YEH;Lo;0;AL;<font> 064A;;;;N;;;;; +1EE0A;ARABIC MATHEMATICAL KAF;Lo;0;AL;<font> 0643;;;;N;;;;; +1EE0B;ARABIC MATHEMATICAL LAM;Lo;0;AL;<font> 0644;;;;N;;;;; +1EE0C;ARABIC MATHEMATICAL MEEM;Lo;0;AL;<font> 0645;;;;N;;;;; +1EE0D;ARABIC MATHEMATICAL NOON;Lo;0;AL;<font> 0646;;;;N;;;;; +1EE0E;ARABIC MATHEMATICAL SEEN;Lo;0;AL;<font> 0633;;;;N;;;;; +1EE0F;ARABIC MATHEMATICAL AIN;Lo;0;AL;<font> 0639;;;;N;;;;; +1EE10;ARABIC MATHEMATICAL FEH;Lo;0;AL;<font> 0641;;;;N;;;;; +1EE11;ARABIC MATHEMATICAL SAD;Lo;0;AL;<font> 0635;;;;N;;;;; +1EE12;ARABIC MATHEMATICAL QAF;Lo;0;AL;<font> 0642;;;;N;;;;; +1EE13;ARABIC MATHEMATICAL REH;Lo;0;AL;<font> 0631;;;;N;;;;; +1EE14;ARABIC MATHEMATICAL SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;; +1EE15;ARABIC MATHEMATICAL TEH;Lo;0;AL;<font> 062A;;;;N;;;;; +1EE16;ARABIC MATHEMATICAL THEH;Lo;0;AL;<font> 062B;;;;N;;;;; +1EE17;ARABIC MATHEMATICAL KHAH;Lo;0;AL;<font> 062E;;;;N;;;;; +1EE18;ARABIC MATHEMATICAL THAL;Lo;0;AL;<font> 0630;;;;N;;;;; +1EE19;ARABIC MATHEMATICAL DAD;Lo;0;AL;<font> 0636;;;;N;;;;; +1EE1A;ARABIC MATHEMATICAL ZAH;Lo;0;AL;<font> 0638;;;;N;;;;; +1EE1B;ARABIC MATHEMATICAL GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;; +1EE1C;ARABIC MATHEMATICAL DOTLESS BEH;Lo;0;AL;<font> 066E;;;;N;;;;; +1EE1D;ARABIC MATHEMATICAL DOTLESS NOON;Lo;0;AL;<font> 06BA;;;;N;;;;; +1EE1E;ARABIC MATHEMATICAL DOTLESS FEH;Lo;0;AL;<font> 06A1;;;;N;;;;; +1EE1F;ARABIC MATHEMATICAL DOTLESS QAF;Lo;0;AL;<font> 066F;;;;N;;;;; +1EE21;ARABIC MATHEMATICAL INITIAL BEH;Lo;0;AL;<font> 0628;;;;N;;;;; +1EE22;ARABIC MATHEMATICAL INITIAL JEEM;Lo;0;AL;<font> 062C;;;;N;;;;; +1EE24;ARABIC MATHEMATICAL INITIAL HEH;Lo;0;AL;<font> 0647;;;;N;;;;; +1EE27;ARABIC MATHEMATICAL INITIAL HAH;Lo;0;AL;<font> 062D;;;;N;;;;; +1EE29;ARABIC MATHEMATICAL INITIAL YEH;Lo;0;AL;<font> 064A;;;;N;;;;; +1EE2A;ARABIC MATHEMATICAL INITIAL KAF;Lo;0;AL;<font> 0643;;;;N;;;;; +1EE2B;ARABIC MATHEMATICAL INITIAL LAM;Lo;0;AL;<font> 0644;;;;N;;;;; +1EE2C;ARABIC MATHEMATICAL INITIAL MEEM;Lo;0;AL;<font> 0645;;;;N;;;;; +1EE2D;ARABIC MATHEMATICAL INITIAL NOON;Lo;0;AL;<font> 0646;;;;N;;;;; +1EE2E;ARABIC MATHEMATICAL INITIAL SEEN;Lo;0;AL;<font> 0633;;;;N;;;;; +1EE2F;ARABIC MATHEMATICAL INITIAL AIN;Lo;0;AL;<font> 0639;;;;N;;;;; +1EE30;ARABIC MATHEMATICAL INITIAL FEH;Lo;0;AL;<font> 0641;;;;N;;;;; +1EE31;ARABIC MATHEMATICAL INITIAL SAD;Lo;0;AL;<font> 0635;;;;N;;;;; +1EE32;ARABIC MATHEMATICAL INITIAL QAF;Lo;0;AL;<font> 0642;;;;N;;;;; +1EE34;ARABIC MATHEMATICAL INITIAL SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;; +1EE35;ARABIC MATHEMATICAL INITIAL TEH;Lo;0;AL;<font> 062A;;;;N;;;;; +1EE36;ARABIC MATHEMATICAL INITIAL THEH;Lo;0;AL;<font> 062B;;;;N;;;;; +1EE37;ARABIC MATHEMATICAL INITIAL KHAH;Lo;0;AL;<font> 062E;;;;N;;;;; +1EE39;ARABIC MATHEMATICAL INITIAL DAD;Lo;0;AL;<font> 0636;;;;N;;;;; +1EE3B;ARABIC MATHEMATICAL INITIAL GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;; +1EE42;ARABIC MATHEMATICAL TAILED JEEM;Lo;0;AL;<font> 062C;;;;N;;;;; +1EE47;ARABIC MATHEMATICAL TAILED HAH;Lo;0;AL;<font> 062D;;;;N;;;;; +1EE49;ARABIC MATHEMATICAL TAILED YEH;Lo;0;AL;<font> 064A;;;;N;;;;; +1EE4B;ARABIC MATHEMATICAL TAILED LAM;Lo;0;AL;<font> 0644;;;;N;;;;; +1EE4D;ARABIC MATHEMATICAL TAILED NOON;Lo;0;AL;<font> 0646;;;;N;;;;; +1EE4E;ARABIC MATHEMATICAL TAILED SEEN;Lo;0;AL;<font> 0633;;;;N;;;;; +1EE4F;ARABIC MATHEMATICAL TAILED AIN;Lo;0;AL;<font> 0639;;;;N;;;;; +1EE51;ARABIC MATHEMATICAL TAILED SAD;Lo;0;AL;<font> 0635;;;;N;;;;; +1EE52;ARABIC MATHEMATICAL TAILED QAF;Lo;0;AL;<font> 0642;;;;N;;;;; +1EE54;ARABIC MATHEMATICAL TAILED SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;; +1EE57;ARABIC MATHEMATICAL TAILED KHAH;Lo;0;AL;<font> 062E;;;;N;;;;; +1EE59;ARABIC MATHEMATICAL TAILED DAD;Lo;0;AL;<font> 0636;;;;N;;;;; +1EE5B;ARABIC MATHEMATICAL TAILED GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;; +1EE5D;ARABIC MATHEMATICAL TAILED DOTLESS NOON;Lo;0;AL;<font> 06BA;;;;N;;;;; +1EE5F;ARABIC MATHEMATICAL TAILED DOTLESS QAF;Lo;0;AL;<font> 066F;;;;N;;;;; +1EE61;ARABIC MATHEMATICAL STRETCHED BEH;Lo;0;AL;<font> 0628;;;;N;;;;; +1EE62;ARABIC MATHEMATICAL STRETCHED JEEM;Lo;0;AL;<font> 062C;;;;N;;;;; +1EE64;ARABIC MATHEMATICAL STRETCHED HEH;Lo;0;AL;<font> 0647;;;;N;;;;; +1EE67;ARABIC MATHEMATICAL STRETCHED HAH;Lo;0;AL;<font> 062D;;;;N;;;;; +1EE68;ARABIC MATHEMATICAL STRETCHED TAH;Lo;0;AL;<font> 0637;;;;N;;;;; +1EE69;ARABIC MATHEMATICAL STRETCHED YEH;Lo;0;AL;<font> 064A;;;;N;;;;; +1EE6A;ARABIC MATHEMATICAL STRETCHED KAF;Lo;0;AL;<font> 0643;;;;N;;;;; +1EE6C;ARABIC MATHEMATICAL STRETCHED MEEM;Lo;0;AL;<font> 0645;;;;N;;;;; +1EE6D;ARABIC MATHEMATICAL STRETCHED NOON;Lo;0;AL;<font> 0646;;;;N;;;;; +1EE6E;ARABIC MATHEMATICAL STRETCHED SEEN;Lo;0;AL;<font> 0633;;;;N;;;;; +1EE6F;ARABIC MATHEMATICAL STRETCHED AIN;Lo;0;AL;<font> 0639;;;;N;;;;; +1EE70;ARABIC MATHEMATICAL STRETCHED FEH;Lo;0;AL;<font> 0641;;;;N;;;;; +1EE71;ARABIC MATHEMATICAL STRETCHED SAD;Lo;0;AL;<font> 0635;;;;N;;;;; +1EE72;ARABIC MATHEMATICAL STRETCHED QAF;Lo;0;AL;<font> 0642;;;;N;;;;; +1EE74;ARABIC MATHEMATICAL STRETCHED SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;; +1EE75;ARABIC MATHEMATICAL STRETCHED TEH;Lo;0;AL;<font> 062A;;;;N;;;;; +1EE76;ARABIC MATHEMATICAL STRETCHED THEH;Lo;0;AL;<font> 062B;;;;N;;;;; +1EE77;ARABIC MATHEMATICAL STRETCHED KHAH;Lo;0;AL;<font> 062E;;;;N;;;;; +1EE79;ARABIC MATHEMATICAL STRETCHED DAD;Lo;0;AL;<font> 0636;;;;N;;;;; +1EE7A;ARABIC MATHEMATICAL STRETCHED ZAH;Lo;0;AL;<font> 0638;;;;N;;;;; +1EE7B;ARABIC MATHEMATICAL STRETCHED GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;; +1EE7C;ARABIC MATHEMATICAL STRETCHED DOTLESS BEH;Lo;0;AL;<font> 066E;;;;N;;;;; +1EE7E;ARABIC MATHEMATICAL STRETCHED DOTLESS FEH;Lo;0;AL;<font> 06A1;;;;N;;;;; +1EE80;ARABIC MATHEMATICAL LOOPED ALEF;Lo;0;AL;<font> 0627;;;;N;;;;; +1EE81;ARABIC MATHEMATICAL LOOPED BEH;Lo;0;AL;<font> 0628;;;;N;;;;; +1EE82;ARABIC MATHEMATICAL LOOPED JEEM;Lo;0;AL;<font> 062C;;;;N;;;;; +1EE83;ARABIC MATHEMATICAL LOOPED DAL;Lo;0;AL;<font> 062F;;;;N;;;;; +1EE84;ARABIC MATHEMATICAL LOOPED HEH;Lo;0;AL;<font> 0647;;;;N;;;;; +1EE85;ARABIC MATHEMATICAL LOOPED WAW;Lo;0;AL;<font> 0648;;;;N;;;;; +1EE86;ARABIC MATHEMATICAL LOOPED ZAIN;Lo;0;AL;<font> 0632;;;;N;;;;; +1EE87;ARABIC MATHEMATICAL LOOPED HAH;Lo;0;AL;<font> 062D;;;;N;;;;; +1EE88;ARABIC MATHEMATICAL LOOPED TAH;Lo;0;AL;<font> 0637;;;;N;;;;; +1EE89;ARABIC MATHEMATICAL LOOPED YEH;Lo;0;AL;<font> 064A;;;;N;;;;; +1EE8B;ARABIC MATHEMATICAL LOOPED LAM;Lo;0;AL;<font> 0644;;;;N;;;;; +1EE8C;ARABIC MATHEMATICAL LOOPED MEEM;Lo;0;AL;<font> 0645;;;;N;;;;; +1EE8D;ARABIC MATHEMATICAL LOOPED NOON;Lo;0;AL;<font> 0646;;;;N;;;;; +1EE8E;ARABIC MATHEMATICAL LOOPED SEEN;Lo;0;AL;<font> 0633;;;;N;;;;; +1EE8F;ARABIC MATHEMATICAL LOOPED AIN;Lo;0;AL;<font> 0639;;;;N;;;;; +1EE90;ARABIC MATHEMATICAL LOOPED FEH;Lo;0;AL;<font> 0641;;;;N;;;;; +1EE91;ARABIC MATHEMATICAL LOOPED SAD;Lo;0;AL;<font> 0635;;;;N;;;;; +1EE92;ARABIC MATHEMATICAL LOOPED QAF;Lo;0;AL;<font> 0642;;;;N;;;;; +1EE93;ARABIC MATHEMATICAL LOOPED REH;Lo;0;AL;<font> 0631;;;;N;;;;; +1EE94;ARABIC MATHEMATICAL LOOPED SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;; +1EE95;ARABIC MATHEMATICAL LOOPED TEH;Lo;0;AL;<font> 062A;;;;N;;;;; +1EE96;ARABIC MATHEMATICAL LOOPED THEH;Lo;0;AL;<font> 062B;;;;N;;;;; +1EE97;ARABIC MATHEMATICAL LOOPED KHAH;Lo;0;AL;<font> 062E;;;;N;;;;; +1EE98;ARABIC MATHEMATICAL LOOPED THAL;Lo;0;AL;<font> 0630;;;;N;;;;; +1EE99;ARABIC MATHEMATICAL LOOPED DAD;Lo;0;AL;<font> 0636;;;;N;;;;; +1EE9A;ARABIC MATHEMATICAL LOOPED ZAH;Lo;0;AL;<font> 0638;;;;N;;;;; +1EE9B;ARABIC MATHEMATICAL LOOPED GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;; +1EEA1;ARABIC MATHEMATICAL DOUBLE-STRUCK BEH;Lo;0;AL;<font> 0628;;;;N;;;;; +1EEA2;ARABIC MATHEMATICAL DOUBLE-STRUCK JEEM;Lo;0;AL;<font> 062C;;;;N;;;;; +1EEA3;ARABIC MATHEMATICAL DOUBLE-STRUCK DAL;Lo;0;AL;<font> 062F;;;;N;;;;; +1EEA5;ARABIC MATHEMATICAL DOUBLE-STRUCK WAW;Lo;0;AL;<font> 0648;;;;N;;;;; +1EEA6;ARABIC MATHEMATICAL DOUBLE-STRUCK ZAIN;Lo;0;AL;<font> 0632;;;;N;;;;; +1EEA7;ARABIC MATHEMATICAL DOUBLE-STRUCK HAH;Lo;0;AL;<font> 062D;;;;N;;;;; +1EEA8;ARABIC MATHEMATICAL DOUBLE-STRUCK TAH;Lo;0;AL;<font> 0637;;;;N;;;;; +1EEA9;ARABIC MATHEMATICAL DOUBLE-STRUCK YEH;Lo;0;AL;<font> 064A;;;;N;;;;; +1EEAB;ARABIC MATHEMATICAL DOUBLE-STRUCK LAM;Lo;0;AL;<font> 0644;;;;N;;;;; +1EEAC;ARABIC MATHEMATICAL DOUBLE-STRUCK MEEM;Lo;0;AL;<font> 0645;;;;N;;;;; +1EEAD;ARABIC MATHEMATICAL DOUBLE-STRUCK NOON;Lo;0;AL;<font> 0646;;;;N;;;;; +1EEAE;ARABIC MATHEMATICAL DOUBLE-STRUCK SEEN;Lo;0;AL;<font> 0633;;;;N;;;;; +1EEAF;ARABIC MATHEMATICAL DOUBLE-STRUCK AIN;Lo;0;AL;<font> 0639;;;;N;;;;; +1EEB0;ARABIC MATHEMATICAL DOUBLE-STRUCK FEH;Lo;0;AL;<font> 0641;;;;N;;;;; +1EEB1;ARABIC MATHEMATICAL DOUBLE-STRUCK SAD;Lo;0;AL;<font> 0635;;;;N;;;;; +1EEB2;ARABIC MATHEMATICAL DOUBLE-STRUCK QAF;Lo;0;AL;<font> 0642;;;;N;;;;; +1EEB3;ARABIC MATHEMATICAL DOUBLE-STRUCK REH;Lo;0;AL;<font> 0631;;;;N;;;;; +1EEB4;ARABIC MATHEMATICAL DOUBLE-STRUCK SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;; +1EEB5;ARABIC MATHEMATICAL DOUBLE-STRUCK TEH;Lo;0;AL;<font> 062A;;;;N;;;;; +1EEB6;ARABIC MATHEMATICAL DOUBLE-STRUCK THEH;Lo;0;AL;<font> 062B;;;;N;;;;; +1EEB7;ARABIC MATHEMATICAL DOUBLE-STRUCK KHAH;Lo;0;AL;<font> 062E;;;;N;;;;; +1EEB8;ARABIC MATHEMATICAL DOUBLE-STRUCK THAL;Lo;0;AL;<font> 0630;;;;N;;;;; +1EEB9;ARABIC MATHEMATICAL DOUBLE-STRUCK DAD;Lo;0;AL;<font> 0636;;;;N;;;;; +1EEBA;ARABIC MATHEMATICAL DOUBLE-STRUCK ZAH;Lo;0;AL;<font> 0638;;;;N;;;;; +1EEBB;ARABIC MATHEMATICAL DOUBLE-STRUCK GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;; +1EEF0;ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL;Sm;0;ON;;;;;N;;;;; +1EEF1;ARABIC MATHEMATICAL OPERATOR HAH WITH DAL;Sm;0;ON;;;;;N;;;;; +1F000;MAHJONG TILE EAST WIND;So;0;ON;;;;;N;;;;; +1F001;MAHJONG TILE SOUTH WIND;So;0;ON;;;;;N;;;;; +1F002;MAHJONG TILE WEST WIND;So;0;ON;;;;;N;;;;; +1F003;MAHJONG TILE NORTH WIND;So;0;ON;;;;;N;;;;; +1F004;MAHJONG TILE RED DRAGON;So;0;ON;;;;;N;;;;; +1F005;MAHJONG TILE GREEN DRAGON;So;0;ON;;;;;N;;;;; +1F006;MAHJONG TILE WHITE DRAGON;So;0;ON;;;;;N;;;;; +1F007;MAHJONG TILE ONE OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F008;MAHJONG TILE TWO OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F009;MAHJONG TILE THREE OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F00A;MAHJONG TILE FOUR OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F00B;MAHJONG TILE FIVE OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F00C;MAHJONG TILE SIX OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F00D;MAHJONG TILE SEVEN OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F00E;MAHJONG TILE EIGHT OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F00F;MAHJONG TILE NINE OF CHARACTERS;So;0;ON;;;;;N;;;;; +1F010;MAHJONG TILE ONE OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F011;MAHJONG TILE TWO OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F012;MAHJONG TILE THREE OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F013;MAHJONG TILE FOUR OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F014;MAHJONG TILE FIVE OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F015;MAHJONG TILE SIX OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F016;MAHJONG TILE SEVEN OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F017;MAHJONG TILE EIGHT OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F018;MAHJONG TILE NINE OF BAMBOOS;So;0;ON;;;;;N;;;;; +1F019;MAHJONG TILE ONE OF CIRCLES;So;0;ON;;;;;N;;;;; +1F01A;MAHJONG TILE TWO OF CIRCLES;So;0;ON;;;;;N;;;;; +1F01B;MAHJONG TILE THREE OF CIRCLES;So;0;ON;;;;;N;;;;; +1F01C;MAHJONG TILE FOUR OF CIRCLES;So;0;ON;;;;;N;;;;; +1F01D;MAHJONG TILE FIVE OF CIRCLES;So;0;ON;;;;;N;;;;; +1F01E;MAHJONG TILE SIX OF CIRCLES;So;0;ON;;;;;N;;;;; +1F01F;MAHJONG TILE SEVEN OF CIRCLES;So;0;ON;;;;;N;;;;; +1F020;MAHJONG TILE EIGHT OF CIRCLES;So;0;ON;;;;;N;;;;; +1F021;MAHJONG TILE NINE OF CIRCLES;So;0;ON;;;;;N;;;;; +1F022;MAHJONG TILE PLUM;So;0;ON;;;;;N;;;;; +1F023;MAHJONG TILE ORCHID;So;0;ON;;;;;N;;;;; +1F024;MAHJONG TILE BAMBOO;So;0;ON;;;;;N;;;;; +1F025;MAHJONG TILE CHRYSANTHEMUM;So;0;ON;;;;;N;;;;; +1F026;MAHJONG TILE SPRING;So;0;ON;;;;;N;;;;; +1F027;MAHJONG TILE SUMMER;So;0;ON;;;;;N;;;;; +1F028;MAHJONG TILE AUTUMN;So;0;ON;;;;;N;;;;; +1F029;MAHJONG TILE WINTER;So;0;ON;;;;;N;;;;; +1F02A;MAHJONG TILE JOKER;So;0;ON;;;;;N;;;;; +1F02B;MAHJONG TILE BACK;So;0;ON;;;;;N;;;;; +1F030;DOMINO TILE HORIZONTAL BACK;So;0;ON;;;;;N;;;;; +1F031;DOMINO TILE HORIZONTAL-00-00;So;0;ON;;;;;N;;;;; +1F032;DOMINO TILE HORIZONTAL-00-01;So;0;ON;;;;;N;;;;; +1F033;DOMINO TILE HORIZONTAL-00-02;So;0;ON;;;;;N;;;;; +1F034;DOMINO TILE HORIZONTAL-00-03;So;0;ON;;;;;N;;;;; +1F035;DOMINO TILE HORIZONTAL-00-04;So;0;ON;;;;;N;;;;; +1F036;DOMINO TILE HORIZONTAL-00-05;So;0;ON;;;;;N;;;;; +1F037;DOMINO TILE HORIZONTAL-00-06;So;0;ON;;;;;N;;;;; +1F038;DOMINO TILE HORIZONTAL-01-00;So;0;ON;;;;;N;;;;; +1F039;DOMINO TILE HORIZONTAL-01-01;So;0;ON;;;;;N;;;;; +1F03A;DOMINO TILE HORIZONTAL-01-02;So;0;ON;;;;;N;;;;; +1F03B;DOMINO TILE HORIZONTAL-01-03;So;0;ON;;;;;N;;;;; +1F03C;DOMINO TILE HORIZONTAL-01-04;So;0;ON;;;;;N;;;;; +1F03D;DOMINO TILE HORIZONTAL-01-05;So;0;ON;;;;;N;;;;; +1F03E;DOMINO TILE HORIZONTAL-01-06;So;0;ON;;;;;N;;;;; +1F03F;DOMINO TILE HORIZONTAL-02-00;So;0;ON;;;;;N;;;;; +1F040;DOMINO TILE HORIZONTAL-02-01;So;0;ON;;;;;N;;;;; +1F041;DOMINO TILE HORIZONTAL-02-02;So;0;ON;;;;;N;;;;; +1F042;DOMINO TILE HORIZONTAL-02-03;So;0;ON;;;;;N;;;;; +1F043;DOMINO TILE HORIZONTAL-02-04;So;0;ON;;;;;N;;;;; +1F044;DOMINO TILE HORIZONTAL-02-05;So;0;ON;;;;;N;;;;; +1F045;DOMINO TILE HORIZONTAL-02-06;So;0;ON;;;;;N;;;;; +1F046;DOMINO TILE HORIZONTAL-03-00;So;0;ON;;;;;N;;;;; +1F047;DOMINO TILE HORIZONTAL-03-01;So;0;ON;;;;;N;;;;; +1F048;DOMINO TILE HORIZONTAL-03-02;So;0;ON;;;;;N;;;;; +1F049;DOMINO TILE HORIZONTAL-03-03;So;0;ON;;;;;N;;;;; +1F04A;DOMINO TILE HORIZONTAL-03-04;So;0;ON;;;;;N;;;;; +1F04B;DOMINO TILE HORIZONTAL-03-05;So;0;ON;;;;;N;;;;; +1F04C;DOMINO TILE HORIZONTAL-03-06;So;0;ON;;;;;N;;;;; +1F04D;DOMINO TILE HORIZONTAL-04-00;So;0;ON;;;;;N;;;;; +1F04E;DOMINO TILE HORIZONTAL-04-01;So;0;ON;;;;;N;;;;; +1F04F;DOMINO TILE HORIZONTAL-04-02;So;0;ON;;;;;N;;;;; +1F050;DOMINO TILE HORIZONTAL-04-03;So;0;ON;;;;;N;;;;; +1F051;DOMINO TILE HORIZONTAL-04-04;So;0;ON;;;;;N;;;;; +1F052;DOMINO TILE HORIZONTAL-04-05;So;0;ON;;;;;N;;;;; +1F053;DOMINO TILE HORIZONTAL-04-06;So;0;ON;;;;;N;;;;; +1F054;DOMINO TILE HORIZONTAL-05-00;So;0;ON;;;;;N;;;;; +1F055;DOMINO TILE HORIZONTAL-05-01;So;0;ON;;;;;N;;;;; +1F056;DOMINO TILE HORIZONTAL-05-02;So;0;ON;;;;;N;;;;; +1F057;DOMINO TILE HORIZONTAL-05-03;So;0;ON;;;;;N;;;;; +1F058;DOMINO TILE HORIZONTAL-05-04;So;0;ON;;;;;N;;;;; +1F059;DOMINO TILE HORIZONTAL-05-05;So;0;ON;;;;;N;;;;; +1F05A;DOMINO TILE HORIZONTAL-05-06;So;0;ON;;;;;N;;;;; +1F05B;DOMINO TILE HORIZONTAL-06-00;So;0;ON;;;;;N;;;;; +1F05C;DOMINO TILE HORIZONTAL-06-01;So;0;ON;;;;;N;;;;; +1F05D;DOMINO TILE HORIZONTAL-06-02;So;0;ON;;;;;N;;;;; +1F05E;DOMINO TILE HORIZONTAL-06-03;So;0;ON;;;;;N;;;;; +1F05F;DOMINO TILE HORIZONTAL-06-04;So;0;ON;;;;;N;;;;; +1F060;DOMINO TILE HORIZONTAL-06-05;So;0;ON;;;;;N;;;;; +1F061;DOMINO TILE HORIZONTAL-06-06;So;0;ON;;;;;N;;;;; +1F062;DOMINO TILE VERTICAL BACK;So;0;ON;;;;;N;;;;; +1F063;DOMINO TILE VERTICAL-00-00;So;0;ON;;;;;N;;;;; +1F064;DOMINO TILE VERTICAL-00-01;So;0;ON;;;;;N;;;;; +1F065;DOMINO TILE VERTICAL-00-02;So;0;ON;;;;;N;;;;; +1F066;DOMINO TILE VERTICAL-00-03;So;0;ON;;;;;N;;;;; +1F067;DOMINO TILE VERTICAL-00-04;So;0;ON;;;;;N;;;;; +1F068;DOMINO TILE VERTICAL-00-05;So;0;ON;;;;;N;;;;; +1F069;DOMINO TILE VERTICAL-00-06;So;0;ON;;;;;N;;;;; +1F06A;DOMINO TILE VERTICAL-01-00;So;0;ON;;;;;N;;;;; +1F06B;DOMINO TILE VERTICAL-01-01;So;0;ON;;;;;N;;;;; +1F06C;DOMINO TILE VERTICAL-01-02;So;0;ON;;;;;N;;;;; +1F06D;DOMINO TILE VERTICAL-01-03;So;0;ON;;;;;N;;;;; +1F06E;DOMINO TILE VERTICAL-01-04;So;0;ON;;;;;N;;;;; +1F06F;DOMINO TILE VERTICAL-01-05;So;0;ON;;;;;N;;;;; +1F070;DOMINO TILE VERTICAL-01-06;So;0;ON;;;;;N;;;;; +1F071;DOMINO TILE VERTICAL-02-00;So;0;ON;;;;;N;;;;; +1F072;DOMINO TILE VERTICAL-02-01;So;0;ON;;;;;N;;;;; +1F073;DOMINO TILE VERTICAL-02-02;So;0;ON;;;;;N;;;;; +1F074;DOMINO TILE VERTICAL-02-03;So;0;ON;;;;;N;;;;; +1F075;DOMINO TILE VERTICAL-02-04;So;0;ON;;;;;N;;;;; +1F076;DOMINO TILE VERTICAL-02-05;So;0;ON;;;;;N;;;;; +1F077;DOMINO TILE VERTICAL-02-06;So;0;ON;;;;;N;;;;; +1F078;DOMINO TILE VERTICAL-03-00;So;0;ON;;;;;N;;;;; +1F079;DOMINO TILE VERTICAL-03-01;So;0;ON;;;;;N;;;;; +1F07A;DOMINO TILE VERTICAL-03-02;So;0;ON;;;;;N;;;;; +1F07B;DOMINO TILE VERTICAL-03-03;So;0;ON;;;;;N;;;;; +1F07C;DOMINO TILE VERTICAL-03-04;So;0;ON;;;;;N;;;;; +1F07D;DOMINO TILE VERTICAL-03-05;So;0;ON;;;;;N;;;;; +1F07E;DOMINO TILE VERTICAL-03-06;So;0;ON;;;;;N;;;;; +1F07F;DOMINO TILE VERTICAL-04-00;So;0;ON;;;;;N;;;;; +1F080;DOMINO TILE VERTICAL-04-01;So;0;ON;;;;;N;;;;; +1F081;DOMINO TILE VERTICAL-04-02;So;0;ON;;;;;N;;;;; +1F082;DOMINO TILE VERTICAL-04-03;So;0;ON;;;;;N;;;;; +1F083;DOMINO TILE VERTICAL-04-04;So;0;ON;;;;;N;;;;; +1F084;DOMINO TILE VERTICAL-04-05;So;0;ON;;;;;N;;;;; +1F085;DOMINO TILE VERTICAL-04-06;So;0;ON;;;;;N;;;;; +1F086;DOMINO TILE VERTICAL-05-00;So;0;ON;;;;;N;;;;; +1F087;DOMINO TILE VERTICAL-05-01;So;0;ON;;;;;N;;;;; +1F088;DOMINO TILE VERTICAL-05-02;So;0;ON;;;;;N;;;;; +1F089;DOMINO TILE VERTICAL-05-03;So;0;ON;;;;;N;;;;; +1F08A;DOMINO TILE VERTICAL-05-04;So;0;ON;;;;;N;;;;; +1F08B;DOMINO TILE VERTICAL-05-05;So;0;ON;;;;;N;;;;; +1F08C;DOMINO TILE VERTICAL-05-06;So;0;ON;;;;;N;;;;; +1F08D;DOMINO TILE VERTICAL-06-00;So;0;ON;;;;;N;;;;; +1F08E;DOMINO TILE VERTICAL-06-01;So;0;ON;;;;;N;;;;; +1F08F;DOMINO TILE VERTICAL-06-02;So;0;ON;;;;;N;;;;; +1F090;DOMINO TILE VERTICAL-06-03;So;0;ON;;;;;N;;;;; +1F091;DOMINO TILE VERTICAL-06-04;So;0;ON;;;;;N;;;;; +1F092;DOMINO TILE VERTICAL-06-05;So;0;ON;;;;;N;;;;; +1F093;DOMINO TILE VERTICAL-06-06;So;0;ON;;;;;N;;;;; +1F0A0;PLAYING CARD BACK;So;0;ON;;;;;N;;;;; +1F0A1;PLAYING CARD ACE OF SPADES;So;0;ON;;;;;N;;;;; +1F0A2;PLAYING CARD TWO OF SPADES;So;0;ON;;;;;N;;;;; +1F0A3;PLAYING CARD THREE OF SPADES;So;0;ON;;;;;N;;;;; +1F0A4;PLAYING CARD FOUR OF SPADES;So;0;ON;;;;;N;;;;; +1F0A5;PLAYING CARD FIVE OF SPADES;So;0;ON;;;;;N;;;;; +1F0A6;PLAYING CARD SIX OF SPADES;So;0;ON;;;;;N;;;;; +1F0A7;PLAYING CARD SEVEN OF SPADES;So;0;ON;;;;;N;;;;; +1F0A8;PLAYING CARD EIGHT OF SPADES;So;0;ON;;;;;N;;;;; +1F0A9;PLAYING CARD NINE OF SPADES;So;0;ON;;;;;N;;;;; +1F0AA;PLAYING CARD TEN OF SPADES;So;0;ON;;;;;N;;;;; +1F0AB;PLAYING CARD JACK OF SPADES;So;0;ON;;;;;N;;;;; +1F0AC;PLAYING CARD KNIGHT OF SPADES;So;0;ON;;;;;N;;;;; +1F0AD;PLAYING CARD QUEEN OF SPADES;So;0;ON;;;;;N;;;;; +1F0AE;PLAYING CARD KING OF SPADES;So;0;ON;;;;;N;;;;; +1F0B1;PLAYING CARD ACE OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B2;PLAYING CARD TWO OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B3;PLAYING CARD THREE OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B4;PLAYING CARD FOUR OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B5;PLAYING CARD FIVE OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B6;PLAYING CARD SIX OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B7;PLAYING CARD SEVEN OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B8;PLAYING CARD EIGHT OF HEARTS;So;0;ON;;;;;N;;;;; +1F0B9;PLAYING CARD NINE OF HEARTS;So;0;ON;;;;;N;;;;; +1F0BA;PLAYING CARD TEN OF HEARTS;So;0;ON;;;;;N;;;;; +1F0BB;PLAYING CARD JACK OF HEARTS;So;0;ON;;;;;N;;;;; +1F0BC;PLAYING CARD KNIGHT OF HEARTS;So;0;ON;;;;;N;;;;; +1F0BD;PLAYING CARD QUEEN OF HEARTS;So;0;ON;;;;;N;;;;; +1F0BE;PLAYING CARD KING OF HEARTS;So;0;ON;;;;;N;;;;; +1F0BF;PLAYING CARD RED JOKER;So;0;ON;;;;;N;;;;; +1F0C1;PLAYING CARD ACE OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C2;PLAYING CARD TWO OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C3;PLAYING CARD THREE OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C4;PLAYING CARD FOUR OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C5;PLAYING CARD FIVE OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C6;PLAYING CARD SIX OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C7;PLAYING CARD SEVEN OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C8;PLAYING CARD EIGHT OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0C9;PLAYING CARD NINE OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0CA;PLAYING CARD TEN OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0CB;PLAYING CARD JACK OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0CC;PLAYING CARD KNIGHT OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0CD;PLAYING CARD QUEEN OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0CE;PLAYING CARD KING OF DIAMONDS;So;0;ON;;;;;N;;;;; +1F0CF;PLAYING CARD BLACK JOKER;So;0;ON;;;;;N;;;;; +1F0D1;PLAYING CARD ACE OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D2;PLAYING CARD TWO OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D3;PLAYING CARD THREE OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D4;PLAYING CARD FOUR OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D5;PLAYING CARD FIVE OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D6;PLAYING CARD SIX OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D7;PLAYING CARD SEVEN OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D8;PLAYING CARD EIGHT OF CLUBS;So;0;ON;;;;;N;;;;; +1F0D9;PLAYING CARD NINE OF CLUBS;So;0;ON;;;;;N;;;;; +1F0DA;PLAYING CARD TEN OF CLUBS;So;0;ON;;;;;N;;;;; +1F0DB;PLAYING CARD JACK OF CLUBS;So;0;ON;;;;;N;;;;; +1F0DC;PLAYING CARD KNIGHT OF CLUBS;So;0;ON;;;;;N;;;;; +1F0DD;PLAYING CARD QUEEN OF CLUBS;So;0;ON;;;;;N;;;;; +1F0DE;PLAYING CARD KING OF CLUBS;So;0;ON;;;;;N;;;;; +1F0DF;PLAYING CARD WHITE JOKER;So;0;ON;;;;;N;;;;; +1F0E0;PLAYING CARD FOOL;So;0;ON;;;;;N;;;;; +1F0E1;PLAYING CARD TRUMP-1;So;0;ON;;;;;N;;;;; +1F0E2;PLAYING CARD TRUMP-2;So;0;ON;;;;;N;;;;; +1F0E3;PLAYING CARD TRUMP-3;So;0;ON;;;;;N;;;;; +1F0E4;PLAYING CARD TRUMP-4;So;0;ON;;;;;N;;;;; +1F0E5;PLAYING CARD TRUMP-5;So;0;ON;;;;;N;;;;; +1F0E6;PLAYING CARD TRUMP-6;So;0;ON;;;;;N;;;;; +1F0E7;PLAYING CARD TRUMP-7;So;0;ON;;;;;N;;;;; +1F0E8;PLAYING CARD TRUMP-8;So;0;ON;;;;;N;;;;; +1F0E9;PLAYING CARD TRUMP-9;So;0;ON;;;;;N;;;;; +1F0EA;PLAYING CARD TRUMP-10;So;0;ON;;;;;N;;;;; +1F0EB;PLAYING CARD TRUMP-11;So;0;ON;;;;;N;;;;; +1F0EC;PLAYING CARD TRUMP-12;So;0;ON;;;;;N;;;;; +1F0ED;PLAYING CARD TRUMP-13;So;0;ON;;;;;N;;;;; +1F0EE;PLAYING CARD TRUMP-14;So;0;ON;;;;;N;;;;; +1F0EF;PLAYING CARD TRUMP-15;So;0;ON;;;;;N;;;;; +1F0F0;PLAYING CARD TRUMP-16;So;0;ON;;;;;N;;;;; +1F0F1;PLAYING CARD TRUMP-17;So;0;ON;;;;;N;;;;; +1F0F2;PLAYING CARD TRUMP-18;So;0;ON;;;;;N;;;;; +1F0F3;PLAYING CARD TRUMP-19;So;0;ON;;;;;N;;;;; +1F0F4;PLAYING CARD TRUMP-20;So;0;ON;;;;;N;;;;; +1F0F5;PLAYING CARD TRUMP-21;So;0;ON;;;;;N;;;;; +1F100;DIGIT ZERO FULL STOP;No;0;EN;<compat> 0030 002E;;0;0;N;;;;; +1F101;DIGIT ZERO COMMA;No;0;EN;<compat> 0030 002C;;0;0;N;;;;; +1F102;DIGIT ONE COMMA;No;0;EN;<compat> 0031 002C;;1;1;N;;;;; +1F103;DIGIT TWO COMMA;No;0;EN;<compat> 0032 002C;;2;2;N;;;;; +1F104;DIGIT THREE COMMA;No;0;EN;<compat> 0033 002C;;3;3;N;;;;; +1F105;DIGIT FOUR COMMA;No;0;EN;<compat> 0034 002C;;4;4;N;;;;; +1F106;DIGIT FIVE COMMA;No;0;EN;<compat> 0035 002C;;5;5;N;;;;; +1F107;DIGIT SIX COMMA;No;0;EN;<compat> 0036 002C;;6;6;N;;;;; +1F108;DIGIT SEVEN COMMA;No;0;EN;<compat> 0037 002C;;7;7;N;;;;; +1F109;DIGIT EIGHT COMMA;No;0;EN;<compat> 0038 002C;;8;8;N;;;;; +1F10A;DIGIT NINE COMMA;No;0;EN;<compat> 0039 002C;;9;9;N;;;;; +1F10B;DINGBAT CIRCLED SANS-SERIF DIGIT ZERO;No;0;ON;;;;0;N;;;;; +1F10C;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ZERO;No;0;ON;;;;0;N;;;;; +1F110;PARENTHESIZED LATIN CAPITAL LETTER A;So;0;L;<compat> 0028 0041 0029;;;;N;;;;; +1F111;PARENTHESIZED LATIN CAPITAL LETTER B;So;0;L;<compat> 0028 0042 0029;;;;N;;;;; +1F112;PARENTHESIZED LATIN CAPITAL LETTER C;So;0;L;<compat> 0028 0043 0029;;;;N;;;;; +1F113;PARENTHESIZED LATIN CAPITAL LETTER D;So;0;L;<compat> 0028 0044 0029;;;;N;;;;; +1F114;PARENTHESIZED LATIN CAPITAL LETTER E;So;0;L;<compat> 0028 0045 0029;;;;N;;;;; +1F115;PARENTHESIZED LATIN CAPITAL LETTER F;So;0;L;<compat> 0028 0046 0029;;;;N;;;;; +1F116;PARENTHESIZED LATIN CAPITAL LETTER G;So;0;L;<compat> 0028 0047 0029;;;;N;;;;; +1F117;PARENTHESIZED LATIN CAPITAL LETTER H;So;0;L;<compat> 0028 0048 0029;;;;N;;;;; +1F118;PARENTHESIZED LATIN CAPITAL LETTER I;So;0;L;<compat> 0028 0049 0029;;;;N;;;;; +1F119;PARENTHESIZED LATIN CAPITAL LETTER J;So;0;L;<compat> 0028 004A 0029;;;;N;;;;; +1F11A;PARENTHESIZED LATIN CAPITAL LETTER K;So;0;L;<compat> 0028 004B 0029;;;;N;;;;; +1F11B;PARENTHESIZED LATIN CAPITAL LETTER L;So;0;L;<compat> 0028 004C 0029;;;;N;;;;; +1F11C;PARENTHESIZED LATIN CAPITAL LETTER M;So;0;L;<compat> 0028 004D 0029;;;;N;;;;; +1F11D;PARENTHESIZED LATIN CAPITAL LETTER N;So;0;L;<compat> 0028 004E 0029;;;;N;;;;; +1F11E;PARENTHESIZED LATIN CAPITAL LETTER O;So;0;L;<compat> 0028 004F 0029;;;;N;;;;; +1F11F;PARENTHESIZED LATIN CAPITAL LETTER P;So;0;L;<compat> 0028 0050 0029;;;;N;;;;; +1F120;PARENTHESIZED LATIN CAPITAL LETTER Q;So;0;L;<compat> 0028 0051 0029;;;;N;;;;; +1F121;PARENTHESIZED LATIN CAPITAL LETTER R;So;0;L;<compat> 0028 0052 0029;;;;N;;;;; +1F122;PARENTHESIZED LATIN CAPITAL LETTER S;So;0;L;<compat> 0028 0053 0029;;;;N;;;;; +1F123;PARENTHESIZED LATIN CAPITAL LETTER T;So;0;L;<compat> 0028 0054 0029;;;;N;;;;; +1F124;PARENTHESIZED LATIN CAPITAL LETTER U;So;0;L;<compat> 0028 0055 0029;;;;N;;;;; +1F125;PARENTHESIZED LATIN CAPITAL LETTER V;So;0;L;<compat> 0028 0056 0029;;;;N;;;;; +1F126;PARENTHESIZED LATIN CAPITAL LETTER W;So;0;L;<compat> 0028 0057 0029;;;;N;;;;; +1F127;PARENTHESIZED LATIN CAPITAL LETTER X;So;0;L;<compat> 0028 0058 0029;;;;N;;;;; +1F128;PARENTHESIZED LATIN CAPITAL LETTER Y;So;0;L;<compat> 0028 0059 0029;;;;N;;;;; +1F129;PARENTHESIZED LATIN CAPITAL LETTER Z;So;0;L;<compat> 0028 005A 0029;;;;N;;;;; +1F12A;TORTOISE SHELL BRACKETED LATIN CAPITAL LETTER S;So;0;L;<compat> 3014 0053 3015;;;;N;;;;; +1F12B;CIRCLED ITALIC LATIN CAPITAL LETTER C;So;0;L;<circle> 0043;;;;N;;;;; +1F12C;CIRCLED ITALIC LATIN CAPITAL LETTER R;So;0;L;<circle> 0052;;;;N;;;;; +1F12D;CIRCLED CD;So;0;L;<circle> 0043 0044;;;;N;;;;; +1F12E;CIRCLED WZ;So;0;L;<circle> 0057 005A;;;;N;;;;; +1F130;SQUARED LATIN CAPITAL LETTER A;So;0;L;<square> 0041;;;;N;;;;; +1F131;SQUARED LATIN CAPITAL LETTER B;So;0;L;<square> 0042;;;;N;;;;; +1F132;SQUARED LATIN CAPITAL LETTER C;So;0;L;<square> 0043;;;;N;;;;; +1F133;SQUARED LATIN CAPITAL LETTER D;So;0;L;<square> 0044;;;;N;;;;; +1F134;SQUARED LATIN CAPITAL LETTER E;So;0;L;<square> 0045;;;;N;;;;; +1F135;SQUARED LATIN CAPITAL LETTER F;So;0;L;<square> 0046;;;;N;;;;; +1F136;SQUARED LATIN CAPITAL LETTER G;So;0;L;<square> 0047;;;;N;;;;; +1F137;SQUARED LATIN CAPITAL LETTER H;So;0;L;<square> 0048;;;;N;;;;; +1F138;SQUARED LATIN CAPITAL LETTER I;So;0;L;<square> 0049;;;;N;;;;; +1F139;SQUARED LATIN CAPITAL LETTER J;So;0;L;<square> 004A;;;;N;;;;; +1F13A;SQUARED LATIN CAPITAL LETTER K;So;0;L;<square> 004B;;;;N;;;;; +1F13B;SQUARED LATIN CAPITAL LETTER L;So;0;L;<square> 004C;;;;N;;;;; +1F13C;SQUARED LATIN CAPITAL LETTER M;So;0;L;<square> 004D;;;;N;;;;; +1F13D;SQUARED LATIN CAPITAL LETTER N;So;0;L;<square> 004E;;;;N;;;;; +1F13E;SQUARED LATIN CAPITAL LETTER O;So;0;L;<square> 004F;;;;N;;;;; +1F13F;SQUARED LATIN CAPITAL LETTER P;So;0;L;<square> 0050;;;;N;;;;; +1F140;SQUARED LATIN CAPITAL LETTER Q;So;0;L;<square> 0051;;;;N;;;;; +1F141;SQUARED LATIN CAPITAL LETTER R;So;0;L;<square> 0052;;;;N;;;;; +1F142;SQUARED LATIN CAPITAL LETTER S;So;0;L;<square> 0053;;;;N;;;;; +1F143;SQUARED LATIN CAPITAL LETTER T;So;0;L;<square> 0054;;;;N;;;;; +1F144;SQUARED LATIN CAPITAL LETTER U;So;0;L;<square> 0055;;;;N;;;;; +1F145;SQUARED LATIN CAPITAL LETTER V;So;0;L;<square> 0056;;;;N;;;;; +1F146;SQUARED LATIN CAPITAL LETTER W;So;0;L;<square> 0057;;;;N;;;;; +1F147;SQUARED LATIN CAPITAL LETTER X;So;0;L;<square> 0058;;;;N;;;;; +1F148;SQUARED LATIN CAPITAL LETTER Y;So;0;L;<square> 0059;;;;N;;;;; +1F149;SQUARED LATIN CAPITAL LETTER Z;So;0;L;<square> 005A;;;;N;;;;; +1F14A;SQUARED HV;So;0;L;<square> 0048 0056;;;;N;;;;; +1F14B;SQUARED MV;So;0;L;<square> 004D 0056;;;;N;;;;; +1F14C;SQUARED SD;So;0;L;<square> 0053 0044;;;;N;;;;; +1F14D;SQUARED SS;So;0;L;<square> 0053 0053;;;;N;;;;; +1F14E;SQUARED PPV;So;0;L;<square> 0050 0050 0056;;;;N;;;;; +1F14F;SQUARED WC;So;0;L;<square> 0057 0043;;;;N;;;;; +1F150;NEGATIVE CIRCLED LATIN CAPITAL LETTER A;So;0;L;;;;;N;;;;; +1F151;NEGATIVE CIRCLED LATIN CAPITAL LETTER B;So;0;L;;;;;N;;;;; +1F152;NEGATIVE CIRCLED LATIN CAPITAL LETTER C;So;0;L;;;;;N;;;;; +1F153;NEGATIVE CIRCLED LATIN CAPITAL LETTER D;So;0;L;;;;;N;;;;; +1F154;NEGATIVE CIRCLED LATIN CAPITAL LETTER E;So;0;L;;;;;N;;;;; +1F155;NEGATIVE CIRCLED LATIN CAPITAL LETTER F;So;0;L;;;;;N;;;;; +1F156;NEGATIVE CIRCLED LATIN CAPITAL LETTER G;So;0;L;;;;;N;;;;; +1F157;NEGATIVE CIRCLED LATIN CAPITAL LETTER H;So;0;L;;;;;N;;;;; +1F158;NEGATIVE CIRCLED LATIN CAPITAL LETTER I;So;0;L;;;;;N;;;;; +1F159;NEGATIVE CIRCLED LATIN CAPITAL LETTER J;So;0;L;;;;;N;;;;; +1F15A;NEGATIVE CIRCLED LATIN CAPITAL LETTER K;So;0;L;;;;;N;;;;; +1F15B;NEGATIVE CIRCLED LATIN CAPITAL LETTER L;So;0;L;;;;;N;;;;; +1F15C;NEGATIVE CIRCLED LATIN CAPITAL LETTER M;So;0;L;;;;;N;;;;; +1F15D;NEGATIVE CIRCLED LATIN CAPITAL LETTER N;So;0;L;;;;;N;;;;; +1F15E;NEGATIVE CIRCLED LATIN CAPITAL LETTER O;So;0;L;;;;;N;;;;; +1F15F;NEGATIVE CIRCLED LATIN CAPITAL LETTER P;So;0;L;;;;;N;;;;; +1F160;NEGATIVE CIRCLED LATIN CAPITAL LETTER Q;So;0;L;;;;;N;;;;; +1F161;NEGATIVE CIRCLED LATIN CAPITAL LETTER R;So;0;L;;;;;N;;;;; +1F162;NEGATIVE CIRCLED LATIN CAPITAL LETTER S;So;0;L;;;;;N;;;;; +1F163;NEGATIVE CIRCLED LATIN CAPITAL LETTER T;So;0;L;;;;;N;;;;; +1F164;NEGATIVE CIRCLED LATIN CAPITAL LETTER U;So;0;L;;;;;N;;;;; +1F165;NEGATIVE CIRCLED LATIN CAPITAL LETTER V;So;0;L;;;;;N;;;;; +1F166;NEGATIVE CIRCLED LATIN CAPITAL LETTER W;So;0;L;;;;;N;;;;; +1F167;NEGATIVE CIRCLED LATIN CAPITAL LETTER X;So;0;L;;;;;N;;;;; +1F168;NEGATIVE CIRCLED LATIN CAPITAL LETTER Y;So;0;L;;;;;N;;;;; +1F169;NEGATIVE CIRCLED LATIN CAPITAL LETTER Z;So;0;L;;;;;N;;;;; +1F16A;RAISED MC SIGN;So;0;ON;<super> 004D 0043;;;;N;;;;; +1F16B;RAISED MD SIGN;So;0;ON;<super> 004D 0044;;;;N;;;;; +1F170;NEGATIVE SQUARED LATIN CAPITAL LETTER A;So;0;L;;;;;N;;;;; +1F171;NEGATIVE SQUARED LATIN CAPITAL LETTER B;So;0;L;;;;;N;;;;; +1F172;NEGATIVE SQUARED LATIN CAPITAL LETTER C;So;0;L;;;;;N;;;;; +1F173;NEGATIVE SQUARED LATIN CAPITAL LETTER D;So;0;L;;;;;N;;;;; +1F174;NEGATIVE SQUARED LATIN CAPITAL LETTER E;So;0;L;;;;;N;;;;; +1F175;NEGATIVE SQUARED LATIN CAPITAL LETTER F;So;0;L;;;;;N;;;;; +1F176;NEGATIVE SQUARED LATIN CAPITAL LETTER G;So;0;L;;;;;N;;;;; +1F177;NEGATIVE SQUARED LATIN CAPITAL LETTER H;So;0;L;;;;;N;;;;; +1F178;NEGATIVE SQUARED LATIN CAPITAL LETTER I;So;0;L;;;;;N;;;;; +1F179;NEGATIVE SQUARED LATIN CAPITAL LETTER J;So;0;L;;;;;N;;;;; +1F17A;NEGATIVE SQUARED LATIN CAPITAL LETTER K;So;0;L;;;;;N;;;;; +1F17B;NEGATIVE SQUARED LATIN CAPITAL LETTER L;So;0;L;;;;;N;;;;; +1F17C;NEGATIVE SQUARED LATIN CAPITAL LETTER M;So;0;L;;;;;N;;;;; +1F17D;NEGATIVE SQUARED LATIN CAPITAL LETTER N;So;0;L;;;;;N;;;;; +1F17E;NEGATIVE SQUARED LATIN CAPITAL LETTER O;So;0;L;;;;;N;;;;; +1F17F;NEGATIVE SQUARED LATIN CAPITAL LETTER P;So;0;L;;;;;N;;;;; +1F180;NEGATIVE SQUARED LATIN CAPITAL LETTER Q;So;0;L;;;;;N;;;;; +1F181;NEGATIVE SQUARED LATIN CAPITAL LETTER R;So;0;L;;;;;N;;;;; +1F182;NEGATIVE SQUARED LATIN CAPITAL LETTER S;So;0;L;;;;;N;;;;; +1F183;NEGATIVE SQUARED LATIN CAPITAL LETTER T;So;0;L;;;;;N;;;;; +1F184;NEGATIVE SQUARED LATIN CAPITAL LETTER U;So;0;L;;;;;N;;;;; +1F185;NEGATIVE SQUARED LATIN CAPITAL LETTER V;So;0;L;;;;;N;;;;; +1F186;NEGATIVE SQUARED LATIN CAPITAL LETTER W;So;0;L;;;;;N;;;;; +1F187;NEGATIVE SQUARED LATIN CAPITAL LETTER X;So;0;L;;;;;N;;;;; +1F188;NEGATIVE SQUARED LATIN CAPITAL LETTER Y;So;0;L;;;;;N;;;;; +1F189;NEGATIVE SQUARED LATIN CAPITAL LETTER Z;So;0;L;;;;;N;;;;; +1F18A;CROSSED NEGATIVE SQUARED LATIN CAPITAL LETTER P;So;0;L;;;;;N;;;;; +1F18B;NEGATIVE SQUARED IC;So;0;L;;;;;N;;;;; +1F18C;NEGATIVE SQUARED PA;So;0;L;;;;;N;;;;; +1F18D;NEGATIVE SQUARED SA;So;0;L;;;;;N;;;;; +1F18E;NEGATIVE SQUARED AB;So;0;L;;;;;N;;;;; +1F18F;NEGATIVE SQUARED WC;So;0;L;;;;;N;;;;; +1F190;SQUARE DJ;So;0;L;<square> 0044 004A;;;;N;;;;; +1F191;SQUARED CL;So;0;L;;;;;N;;;;; +1F192;SQUARED COOL;So;0;L;;;;;N;;;;; +1F193;SQUARED FREE;So;0;L;;;;;N;;;;; +1F194;SQUARED ID;So;0;L;;;;;N;;;;; +1F195;SQUARED NEW;So;0;L;;;;;N;;;;; +1F196;SQUARED NG;So;0;L;;;;;N;;;;; +1F197;SQUARED OK;So;0;L;;;;;N;;;;; +1F198;SQUARED SOS;So;0;L;;;;;N;;;;; +1F199;SQUARED UP WITH EXCLAMATION MARK;So;0;L;;;;;N;;;;; +1F19A;SQUARED VS;So;0;L;;;;;N;;;;; +1F19B;SQUARED THREE D;So;0;L;;;;;N;;;;; +1F19C;SQUARED SECOND SCREEN;So;0;L;;;;;N;;;;; +1F19D;SQUARED TWO K;So;0;L;;;;;N;;;;; +1F19E;SQUARED FOUR K;So;0;L;;;;;N;;;;; +1F19F;SQUARED EIGHT K;So;0;L;;;;;N;;;;; +1F1A0;SQUARED FIVE POINT ONE;So;0;L;;;;;N;;;;; +1F1A1;SQUARED SEVEN POINT ONE;So;0;L;;;;;N;;;;; +1F1A2;SQUARED TWENTY-TWO POINT TWO;So;0;L;;;;;N;;;;; +1F1A3;SQUARED SIXTY P;So;0;L;;;;;N;;;;; +1F1A4;SQUARED ONE HUNDRED TWENTY P;So;0;L;;;;;N;;;;; +1F1A5;SQUARED LATIN SMALL LETTER D;So;0;L;;;;;N;;;;; +1F1A6;SQUARED HC;So;0;L;;;;;N;;;;; +1F1A7;SQUARED HDR;So;0;L;;;;;N;;;;; +1F1A8;SQUARED HI-RES;So;0;L;;;;;N;;;;; +1F1A9;SQUARED LOSSLESS;So;0;L;;;;;N;;;;; +1F1AA;SQUARED SHV;So;0;L;;;;;N;;;;; +1F1AB;SQUARED UHD;So;0;L;;;;;N;;;;; +1F1AC;SQUARED VOD;So;0;L;;;;;N;;;;; +1F1E6;REGIONAL INDICATOR SYMBOL LETTER A;So;0;L;;;;;N;;;;; +1F1E7;REGIONAL INDICATOR SYMBOL LETTER B;So;0;L;;;;;N;;;;; +1F1E8;REGIONAL INDICATOR SYMBOL LETTER C;So;0;L;;;;;N;;;;; +1F1E9;REGIONAL INDICATOR SYMBOL LETTER D;So;0;L;;;;;N;;;;; +1F1EA;REGIONAL INDICATOR SYMBOL LETTER E;So;0;L;;;;;N;;;;; +1F1EB;REGIONAL INDICATOR SYMBOL LETTER F;So;0;L;;;;;N;;;;; +1F1EC;REGIONAL INDICATOR SYMBOL LETTER G;So;0;L;;;;;N;;;;; +1F1ED;REGIONAL INDICATOR SYMBOL LETTER H;So;0;L;;;;;N;;;;; +1F1EE;REGIONAL INDICATOR SYMBOL LETTER I;So;0;L;;;;;N;;;;; +1F1EF;REGIONAL INDICATOR SYMBOL LETTER J;So;0;L;;;;;N;;;;; +1F1F0;REGIONAL INDICATOR SYMBOL LETTER K;So;0;L;;;;;N;;;;; +1F1F1;REGIONAL INDICATOR SYMBOL LETTER L;So;0;L;;;;;N;;;;; +1F1F2;REGIONAL INDICATOR SYMBOL LETTER M;So;0;L;;;;;N;;;;; +1F1F3;REGIONAL INDICATOR SYMBOL LETTER N;So;0;L;;;;;N;;;;; +1F1F4;REGIONAL INDICATOR SYMBOL LETTER O;So;0;L;;;;;N;;;;; +1F1F5;REGIONAL INDICATOR SYMBOL LETTER P;So;0;L;;;;;N;;;;; +1F1F6;REGIONAL INDICATOR SYMBOL LETTER Q;So;0;L;;;;;N;;;;; +1F1F7;REGIONAL INDICATOR SYMBOL LETTER R;So;0;L;;;;;N;;;;; +1F1F8;REGIONAL INDICATOR SYMBOL LETTER S;So;0;L;;;;;N;;;;; +1F1F9;REGIONAL INDICATOR SYMBOL LETTER T;So;0;L;;;;;N;;;;; +1F1FA;REGIONAL INDICATOR SYMBOL LETTER U;So;0;L;;;;;N;;;;; +1F1FB;REGIONAL INDICATOR SYMBOL LETTER V;So;0;L;;;;;N;;;;; +1F1FC;REGIONAL INDICATOR SYMBOL LETTER W;So;0;L;;;;;N;;;;; +1F1FD;REGIONAL INDICATOR SYMBOL LETTER X;So;0;L;;;;;N;;;;; +1F1FE;REGIONAL INDICATOR SYMBOL LETTER Y;So;0;L;;;;;N;;;;; +1F1FF;REGIONAL INDICATOR SYMBOL LETTER Z;So;0;L;;;;;N;;;;; +1F200;SQUARE HIRAGANA HOKA;So;0;L;<square> 307B 304B;;;;N;;;;; +1F201;SQUARED KATAKANA KOKO;So;0;L;<square> 30B3 30B3;;;;N;;;;; +1F202;SQUARED KATAKANA SA;So;0;L;<square> 30B5;;;;N;;;;; +1F210;SQUARED CJK UNIFIED IDEOGRAPH-624B;So;0;L;<square> 624B;;;;N;;;;; +1F211;SQUARED CJK UNIFIED IDEOGRAPH-5B57;So;0;L;<square> 5B57;;;;N;;;;; +1F212;SQUARED CJK UNIFIED IDEOGRAPH-53CC;So;0;L;<square> 53CC;;;;N;;;;; +1F213;SQUARED KATAKANA DE;So;0;L;<square> 30C7;;;;N;;;;; +1F214;SQUARED CJK UNIFIED IDEOGRAPH-4E8C;So;0;L;<square> 4E8C;;;;N;;;;; +1F215;SQUARED CJK UNIFIED IDEOGRAPH-591A;So;0;L;<square> 591A;;;;N;;;;; +1F216;SQUARED CJK UNIFIED IDEOGRAPH-89E3;So;0;L;<square> 89E3;;;;N;;;;; +1F217;SQUARED CJK UNIFIED IDEOGRAPH-5929;So;0;L;<square> 5929;;;;N;;;;; +1F218;SQUARED CJK UNIFIED IDEOGRAPH-4EA4;So;0;L;<square> 4EA4;;;;N;;;;; +1F219;SQUARED CJK UNIFIED IDEOGRAPH-6620;So;0;L;<square> 6620;;;;N;;;;; +1F21A;SQUARED CJK UNIFIED IDEOGRAPH-7121;So;0;L;<square> 7121;;;;N;;;;; +1F21B;SQUARED CJK UNIFIED IDEOGRAPH-6599;So;0;L;<square> 6599;;;;N;;;;; +1F21C;SQUARED CJK UNIFIED IDEOGRAPH-524D;So;0;L;<square> 524D;;;;N;;;;; +1F21D;SQUARED CJK UNIFIED IDEOGRAPH-5F8C;So;0;L;<square> 5F8C;;;;N;;;;; +1F21E;SQUARED CJK UNIFIED IDEOGRAPH-518D;So;0;L;<square> 518D;;;;N;;;;; +1F21F;SQUARED CJK UNIFIED IDEOGRAPH-65B0;So;0;L;<square> 65B0;;;;N;;;;; +1F220;SQUARED CJK UNIFIED IDEOGRAPH-521D;So;0;L;<square> 521D;;;;N;;;;; +1F221;SQUARED CJK UNIFIED IDEOGRAPH-7D42;So;0;L;<square> 7D42;;;;N;;;;; +1F222;SQUARED CJK UNIFIED IDEOGRAPH-751F;So;0;L;<square> 751F;;;;N;;;;; +1F223;SQUARED CJK UNIFIED IDEOGRAPH-8CA9;So;0;L;<square> 8CA9;;;;N;;;;; +1F224;SQUARED CJK UNIFIED IDEOGRAPH-58F0;So;0;L;<square> 58F0;;;;N;;;;; +1F225;SQUARED CJK UNIFIED IDEOGRAPH-5439;So;0;L;<square> 5439;;;;N;;;;; +1F226;SQUARED CJK UNIFIED IDEOGRAPH-6F14;So;0;L;<square> 6F14;;;;N;;;;; +1F227;SQUARED CJK UNIFIED IDEOGRAPH-6295;So;0;L;<square> 6295;;;;N;;;;; +1F228;SQUARED CJK UNIFIED IDEOGRAPH-6355;So;0;L;<square> 6355;;;;N;;;;; +1F229;SQUARED CJK UNIFIED IDEOGRAPH-4E00;So;0;L;<square> 4E00;;;;N;;;;; +1F22A;SQUARED CJK UNIFIED IDEOGRAPH-4E09;So;0;L;<square> 4E09;;;;N;;;;; +1F22B;SQUARED CJK UNIFIED IDEOGRAPH-904A;So;0;L;<square> 904A;;;;N;;;;; +1F22C;SQUARED CJK UNIFIED IDEOGRAPH-5DE6;So;0;L;<square> 5DE6;;;;N;;;;; +1F22D;SQUARED CJK UNIFIED IDEOGRAPH-4E2D;So;0;L;<square> 4E2D;;;;N;;;;; +1F22E;SQUARED CJK UNIFIED IDEOGRAPH-53F3;So;0;L;<square> 53F3;;;;N;;;;; +1F22F;SQUARED CJK UNIFIED IDEOGRAPH-6307;So;0;L;<square> 6307;;;;N;;;;; +1F230;SQUARED CJK UNIFIED IDEOGRAPH-8D70;So;0;L;<square> 8D70;;;;N;;;;; +1F231;SQUARED CJK UNIFIED IDEOGRAPH-6253;So;0;L;<square> 6253;;;;N;;;;; +1F232;SQUARED CJK UNIFIED IDEOGRAPH-7981;So;0;L;<square> 7981;;;;N;;;;; +1F233;SQUARED CJK UNIFIED IDEOGRAPH-7A7A;So;0;L;<square> 7A7A;;;;N;;;;; +1F234;SQUARED CJK UNIFIED IDEOGRAPH-5408;So;0;L;<square> 5408;;;;N;;;;; +1F235;SQUARED CJK UNIFIED IDEOGRAPH-6E80;So;0;L;<square> 6E80;;;;N;;;;; +1F236;SQUARED CJK UNIFIED IDEOGRAPH-6709;So;0;L;<square> 6709;;;;N;;;;; +1F237;SQUARED CJK UNIFIED IDEOGRAPH-6708;So;0;L;<square> 6708;;;;N;;;;; +1F238;SQUARED CJK UNIFIED IDEOGRAPH-7533;So;0;L;<square> 7533;;;;N;;;;; +1F239;SQUARED CJK UNIFIED IDEOGRAPH-5272;So;0;L;<square> 5272;;;;N;;;;; +1F23A;SQUARED CJK UNIFIED IDEOGRAPH-55B6;So;0;L;<square> 55B6;;;;N;;;;; +1F23B;SQUARED CJK UNIFIED IDEOGRAPH-914D;So;0;L;<square> 914D;;;;N;;;;; +1F240;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-672C;So;0;L;<compat> 3014 672C 3015;;;;N;;;;; +1F241;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-4E09;So;0;L;<compat> 3014 4E09 3015;;;;N;;;;; +1F242;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-4E8C;So;0;L;<compat> 3014 4E8C 3015;;;;N;;;;; +1F243;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-5B89;So;0;L;<compat> 3014 5B89 3015;;;;N;;;;; +1F244;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-70B9;So;0;L;<compat> 3014 70B9 3015;;;;N;;;;; +1F245;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6253;So;0;L;<compat> 3014 6253 3015;;;;N;;;;; +1F246;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-76D7;So;0;L;<compat> 3014 76D7 3015;;;;N;;;;; +1F247;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-52DD;So;0;L;<compat> 3014 52DD 3015;;;;N;;;;; +1F248;TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557;So;0;L;<compat> 3014 6557 3015;;;;N;;;;; +1F250;CIRCLED IDEOGRAPH ADVANTAGE;So;0;L;<circle> 5F97;;;;N;;;;; +1F251;CIRCLED IDEOGRAPH ACCEPT;So;0;L;<circle> 53EF;;;;N;;;;; +1F260;ROUNDED SYMBOL FOR FU;So;0;ON;;;;;N;;;;; +1F261;ROUNDED SYMBOL FOR LU;So;0;ON;;;;;N;;;;; +1F262;ROUNDED SYMBOL FOR SHOU;So;0;ON;;;;;N;;;;; +1F263;ROUNDED SYMBOL FOR XI;So;0;ON;;;;;N;;;;; +1F264;ROUNDED SYMBOL FOR SHUANGXI;So;0;ON;;;;;N;;;;; +1F265;ROUNDED SYMBOL FOR CAI;So;0;ON;;;;;N;;;;; +1F300;CYCLONE;So;0;ON;;;;;N;;;;; +1F301;FOGGY;So;0;ON;;;;;N;;;;; +1F302;CLOSED UMBRELLA;So;0;ON;;;;;N;;;;; +1F303;NIGHT WITH STARS;So;0;ON;;;;;N;;;;; +1F304;SUNRISE OVER MOUNTAINS;So;0;ON;;;;;N;;;;; +1F305;SUNRISE;So;0;ON;;;;;N;;;;; +1F306;CITYSCAPE AT DUSK;So;0;ON;;;;;N;;;;; +1F307;SUNSET OVER BUILDINGS;So;0;ON;;;;;N;;;;; +1F308;RAINBOW;So;0;ON;;;;;N;;;;; +1F309;BRIDGE AT NIGHT;So;0;ON;;;;;N;;;;; +1F30A;WATER WAVE;So;0;ON;;;;;N;;;;; +1F30B;VOLCANO;So;0;ON;;;;;N;;;;; +1F30C;MILKY WAY;So;0;ON;;;;;N;;;;; +1F30D;EARTH GLOBE EUROPE-AFRICA;So;0;ON;;;;;N;;;;; +1F30E;EARTH GLOBE AMERICAS;So;0;ON;;;;;N;;;;; +1F30F;EARTH GLOBE ASIA-AUSTRALIA;So;0;ON;;;;;N;;;;; +1F310;GLOBE WITH MERIDIANS;So;0;ON;;;;;N;;;;; +1F311;NEW MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F312;WAXING CRESCENT MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F313;FIRST QUARTER MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F314;WAXING GIBBOUS MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F315;FULL MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F316;WANING GIBBOUS MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F317;LAST QUARTER MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F318;WANING CRESCENT MOON SYMBOL;So;0;ON;;;;;N;;;;; +1F319;CRESCENT MOON;So;0;ON;;;;;N;;;;; +1F31A;NEW MOON WITH FACE;So;0;ON;;;;;N;;;;; +1F31B;FIRST QUARTER MOON WITH FACE;So;0;ON;;;;;N;;;;; +1F31C;LAST QUARTER MOON WITH FACE;So;0;ON;;;;;N;;;;; +1F31D;FULL MOON WITH FACE;So;0;ON;;;;;N;;;;; +1F31E;SUN WITH FACE;So;0;ON;;;;;N;;;;; +1F31F;GLOWING STAR;So;0;ON;;;;;N;;;;; +1F320;SHOOTING STAR;So;0;ON;;;;;N;;;;; +1F321;THERMOMETER;So;0;ON;;;;;N;;;;; +1F322;BLACK DROPLET;So;0;ON;;;;;N;;;;; +1F323;WHITE SUN;So;0;ON;;;;;N;;;;; +1F324;WHITE SUN WITH SMALL CLOUD;So;0;ON;;;;;N;;;;; +1F325;WHITE SUN BEHIND CLOUD;So;0;ON;;;;;N;;;;; +1F326;WHITE SUN BEHIND CLOUD WITH RAIN;So;0;ON;;;;;N;;;;; +1F327;CLOUD WITH RAIN;So;0;ON;;;;;N;;;;; +1F328;CLOUD WITH SNOW;So;0;ON;;;;;N;;;;; +1F329;CLOUD WITH LIGHTNING;So;0;ON;;;;;N;;;;; +1F32A;CLOUD WITH TORNADO;So;0;ON;;;;;N;;;;; +1F32B;FOG;So;0;ON;;;;;N;;;;; +1F32C;WIND BLOWING FACE;So;0;ON;;;;;N;;;;; +1F32D;HOT DOG;So;0;ON;;;;;N;;;;; +1F32E;TACO;So;0;ON;;;;;N;;;;; +1F32F;BURRITO;So;0;ON;;;;;N;;;;; +1F330;CHESTNUT;So;0;ON;;;;;N;;;;; +1F331;SEEDLING;So;0;ON;;;;;N;;;;; +1F332;EVERGREEN TREE;So;0;ON;;;;;N;;;;; +1F333;DECIDUOUS TREE;So;0;ON;;;;;N;;;;; +1F334;PALM TREE;So;0;ON;;;;;N;;;;; +1F335;CACTUS;So;0;ON;;;;;N;;;;; +1F336;HOT PEPPER;So;0;ON;;;;;N;;;;; +1F337;TULIP;So;0;ON;;;;;N;;;;; +1F338;CHERRY BLOSSOM;So;0;ON;;;;;N;;;;; +1F339;ROSE;So;0;ON;;;;;N;;;;; +1F33A;HIBISCUS;So;0;ON;;;;;N;;;;; +1F33B;SUNFLOWER;So;0;ON;;;;;N;;;;; +1F33C;BLOSSOM;So;0;ON;;;;;N;;;;; +1F33D;EAR OF MAIZE;So;0;ON;;;;;N;;;;; +1F33E;EAR OF RICE;So;0;ON;;;;;N;;;;; +1F33F;HERB;So;0;ON;;;;;N;;;;; +1F340;FOUR LEAF CLOVER;So;0;ON;;;;;N;;;;; +1F341;MAPLE LEAF;So;0;ON;;;;;N;;;;; +1F342;FALLEN LEAF;So;0;ON;;;;;N;;;;; +1F343;LEAF FLUTTERING IN WIND;So;0;ON;;;;;N;;;;; +1F344;MUSHROOM;So;0;ON;;;;;N;;;;; +1F345;TOMATO;So;0;ON;;;;;N;;;;; +1F346;AUBERGINE;So;0;ON;;;;;N;;;;; +1F347;GRAPES;So;0;ON;;;;;N;;;;; +1F348;MELON;So;0;ON;;;;;N;;;;; +1F349;WATERMELON;So;0;ON;;;;;N;;;;; +1F34A;TANGERINE;So;0;ON;;;;;N;;;;; +1F34B;LEMON;So;0;ON;;;;;N;;;;; +1F34C;BANANA;So;0;ON;;;;;N;;;;; +1F34D;PINEAPPLE;So;0;ON;;;;;N;;;;; +1F34E;RED APPLE;So;0;ON;;;;;N;;;;; +1F34F;GREEN APPLE;So;0;ON;;;;;N;;;;; +1F350;PEAR;So;0;ON;;;;;N;;;;; +1F351;PEACH;So;0;ON;;;;;N;;;;; +1F352;CHERRIES;So;0;ON;;;;;N;;;;; +1F353;STRAWBERRY;So;0;ON;;;;;N;;;;; +1F354;HAMBURGER;So;0;ON;;;;;N;;;;; +1F355;SLICE OF PIZZA;So;0;ON;;;;;N;;;;; +1F356;MEAT ON BONE;So;0;ON;;;;;N;;;;; +1F357;POULTRY LEG;So;0;ON;;;;;N;;;;; +1F358;RICE CRACKER;So;0;ON;;;;;N;;;;; +1F359;RICE BALL;So;0;ON;;;;;N;;;;; +1F35A;COOKED RICE;So;0;ON;;;;;N;;;;; +1F35B;CURRY AND RICE;So;0;ON;;;;;N;;;;; +1F35C;STEAMING BOWL;So;0;ON;;;;;N;;;;; +1F35D;SPAGHETTI;So;0;ON;;;;;N;;;;; +1F35E;BREAD;So;0;ON;;;;;N;;;;; +1F35F;FRENCH FRIES;So;0;ON;;;;;N;;;;; +1F360;ROASTED SWEET POTATO;So;0;ON;;;;;N;;;;; +1F361;DANGO;So;0;ON;;;;;N;;;;; +1F362;ODEN;So;0;ON;;;;;N;;;;; +1F363;SUSHI;So;0;ON;;;;;N;;;;; +1F364;FRIED SHRIMP;So;0;ON;;;;;N;;;;; +1F365;FISH CAKE WITH SWIRL DESIGN;So;0;ON;;;;;N;;;;; +1F366;SOFT ICE CREAM;So;0;ON;;;;;N;;;;; +1F367;SHAVED ICE;So;0;ON;;;;;N;;;;; +1F368;ICE CREAM;So;0;ON;;;;;N;;;;; +1F369;DOUGHNUT;So;0;ON;;;;;N;;;;; +1F36A;COOKIE;So;0;ON;;;;;N;;;;; +1F36B;CHOCOLATE BAR;So;0;ON;;;;;N;;;;; +1F36C;CANDY;So;0;ON;;;;;N;;;;; +1F36D;LOLLIPOP;So;0;ON;;;;;N;;;;; +1F36E;CUSTARD;So;0;ON;;;;;N;;;;; +1F36F;HONEY POT;So;0;ON;;;;;N;;;;; +1F370;SHORTCAKE;So;0;ON;;;;;N;;;;; +1F371;BENTO BOX;So;0;ON;;;;;N;;;;; +1F372;POT OF FOOD;So;0;ON;;;;;N;;;;; +1F373;COOKING;So;0;ON;;;;;N;;;;; +1F374;FORK AND KNIFE;So;0;ON;;;;;N;;;;; +1F375;TEACUP WITHOUT HANDLE;So;0;ON;;;;;N;;;;; +1F376;SAKE BOTTLE AND CUP;So;0;ON;;;;;N;;;;; +1F377;WINE GLASS;So;0;ON;;;;;N;;;;; +1F378;COCKTAIL GLASS;So;0;ON;;;;;N;;;;; +1F379;TROPICAL DRINK;So;0;ON;;;;;N;;;;; +1F37A;BEER MUG;So;0;ON;;;;;N;;;;; +1F37B;CLINKING BEER MUGS;So;0;ON;;;;;N;;;;; +1F37C;BABY BOTTLE;So;0;ON;;;;;N;;;;; +1F37D;FORK AND KNIFE WITH PLATE;So;0;ON;;;;;N;;;;; +1F37E;BOTTLE WITH POPPING CORK;So;0;ON;;;;;N;;;;; +1F37F;POPCORN;So;0;ON;;;;;N;;;;; +1F380;RIBBON;So;0;ON;;;;;N;;;;; +1F381;WRAPPED PRESENT;So;0;ON;;;;;N;;;;; +1F382;BIRTHDAY CAKE;So;0;ON;;;;;N;;;;; +1F383;JACK-O-LANTERN;So;0;ON;;;;;N;;;;; +1F384;CHRISTMAS TREE;So;0;ON;;;;;N;;;;; +1F385;FATHER CHRISTMAS;So;0;ON;;;;;N;;;;; +1F386;FIREWORKS;So;0;ON;;;;;N;;;;; +1F387;FIREWORK SPARKLER;So;0;ON;;;;;N;;;;; +1F388;BALLOON;So;0;ON;;;;;N;;;;; +1F389;PARTY POPPER;So;0;ON;;;;;N;;;;; +1F38A;CONFETTI BALL;So;0;ON;;;;;N;;;;; +1F38B;TANABATA TREE;So;0;ON;;;;;N;;;;; +1F38C;CROSSED FLAGS;So;0;ON;;;;;N;;;;; +1F38D;PINE DECORATION;So;0;ON;;;;;N;;;;; +1F38E;JAPANESE DOLLS;So;0;ON;;;;;N;;;;; +1F38F;CARP STREAMER;So;0;ON;;;;;N;;;;; +1F390;WIND CHIME;So;0;ON;;;;;N;;;;; +1F391;MOON VIEWING CEREMONY;So;0;ON;;;;;N;;;;; +1F392;SCHOOL SATCHEL;So;0;ON;;;;;N;;;;; +1F393;GRADUATION CAP;So;0;ON;;;;;N;;;;; +1F394;HEART WITH TIP ON THE LEFT;So;0;ON;;;;;N;;;;; +1F395;BOUQUET OF FLOWERS;So;0;ON;;;;;N;;;;; +1F396;MILITARY MEDAL;So;0;ON;;;;;N;;;;; +1F397;REMINDER RIBBON;So;0;ON;;;;;N;;;;; +1F398;MUSICAL KEYBOARD WITH JACKS;So;0;ON;;;;;N;;;;; +1F399;STUDIO MICROPHONE;So;0;ON;;;;;N;;;;; +1F39A;LEVEL SLIDER;So;0;ON;;;;;N;;;;; +1F39B;CONTROL KNOBS;So;0;ON;;;;;N;;;;; +1F39C;BEAMED ASCENDING MUSICAL NOTES;So;0;ON;;;;;N;;;;; +1F39D;BEAMED DESCENDING MUSICAL NOTES;So;0;ON;;;;;N;;;;; +1F39E;FILM FRAMES;So;0;ON;;;;;N;;;;; +1F39F;ADMISSION TICKETS;So;0;ON;;;;;N;;;;; +1F3A0;CAROUSEL HORSE;So;0;ON;;;;;N;;;;; +1F3A1;FERRIS WHEEL;So;0;ON;;;;;N;;;;; +1F3A2;ROLLER COASTER;So;0;ON;;;;;N;;;;; +1F3A3;FISHING POLE AND FISH;So;0;ON;;;;;N;;;;; +1F3A4;MICROPHONE;So;0;ON;;;;;N;;;;; +1F3A5;MOVIE CAMERA;So;0;ON;;;;;N;;;;; +1F3A6;CINEMA;So;0;ON;;;;;N;;;;; +1F3A7;HEADPHONE;So;0;ON;;;;;N;;;;; +1F3A8;ARTIST PALETTE;So;0;ON;;;;;N;;;;; +1F3A9;TOP HAT;So;0;ON;;;;;N;;;;; +1F3AA;CIRCUS TENT;So;0;ON;;;;;N;;;;; +1F3AB;TICKET;So;0;ON;;;;;N;;;;; +1F3AC;CLAPPER BOARD;So;0;ON;;;;;N;;;;; +1F3AD;PERFORMING ARTS;So;0;ON;;;;;N;;;;; +1F3AE;VIDEO GAME;So;0;ON;;;;;N;;;;; +1F3AF;DIRECT HIT;So;0;ON;;;;;N;;;;; +1F3B0;SLOT MACHINE;So;0;ON;;;;;N;;;;; +1F3B1;BILLIARDS;So;0;ON;;;;;N;;;;; +1F3B2;GAME DIE;So;0;ON;;;;;N;;;;; +1F3B3;BOWLING;So;0;ON;;;;;N;;;;; +1F3B4;FLOWER PLAYING CARDS;So;0;ON;;;;;N;;;;; +1F3B5;MUSICAL NOTE;So;0;ON;;;;;N;;;;; +1F3B6;MULTIPLE MUSICAL NOTES;So;0;ON;;;;;N;;;;; +1F3B7;SAXOPHONE;So;0;ON;;;;;N;;;;; +1F3B8;GUITAR;So;0;ON;;;;;N;;;;; +1F3B9;MUSICAL KEYBOARD;So;0;ON;;;;;N;;;;; +1F3BA;TRUMPET;So;0;ON;;;;;N;;;;; +1F3BB;VIOLIN;So;0;ON;;;;;N;;;;; +1F3BC;MUSICAL SCORE;So;0;ON;;;;;N;;;;; +1F3BD;RUNNING SHIRT WITH SASH;So;0;ON;;;;;N;;;;; +1F3BE;TENNIS RACQUET AND BALL;So;0;ON;;;;;N;;;;; +1F3BF;SKI AND SKI BOOT;So;0;ON;;;;;N;;;;; +1F3C0;BASKETBALL AND HOOP;So;0;ON;;;;;N;;;;; +1F3C1;CHEQUERED FLAG;So;0;ON;;;;;N;;;;; +1F3C2;SNOWBOARDER;So;0;ON;;;;;N;;;;; +1F3C3;RUNNER;So;0;ON;;;;;N;;;;; +1F3C4;SURFER;So;0;ON;;;;;N;;;;; +1F3C5;SPORTS MEDAL;So;0;ON;;;;;N;;;;; +1F3C6;TROPHY;So;0;ON;;;;;N;;;;; +1F3C7;HORSE RACING;So;0;ON;;;;;N;;;;; +1F3C8;AMERICAN FOOTBALL;So;0;ON;;;;;N;;;;; +1F3C9;RUGBY FOOTBALL;So;0;ON;;;;;N;;;;; +1F3CA;SWIMMER;So;0;ON;;;;;N;;;;; +1F3CB;WEIGHT LIFTER;So;0;ON;;;;;N;;;;; +1F3CC;GOLFER;So;0;ON;;;;;N;;;;; +1F3CD;RACING MOTORCYCLE;So;0;ON;;;;;N;;;;; +1F3CE;RACING CAR;So;0;ON;;;;;N;;;;; +1F3CF;CRICKET BAT AND BALL;So;0;ON;;;;;N;;;;; +1F3D0;VOLLEYBALL;So;0;ON;;;;;N;;;;; +1F3D1;FIELD HOCKEY STICK AND BALL;So;0;ON;;;;;N;;;;; +1F3D2;ICE HOCKEY STICK AND PUCK;So;0;ON;;;;;N;;;;; +1F3D3;TABLE TENNIS PADDLE AND BALL;So;0;ON;;;;;N;;;;; +1F3D4;SNOW CAPPED MOUNTAIN;So;0;ON;;;;;N;;;;; +1F3D5;CAMPING;So;0;ON;;;;;N;;;;; +1F3D6;BEACH WITH UMBRELLA;So;0;ON;;;;;N;;;;; +1F3D7;BUILDING CONSTRUCTION;So;0;ON;;;;;N;;;;; +1F3D8;HOUSE BUILDINGS;So;0;ON;;;;;N;;;;; +1F3D9;CITYSCAPE;So;0;ON;;;;;N;;;;; +1F3DA;DERELICT HOUSE BUILDING;So;0;ON;;;;;N;;;;; +1F3DB;CLASSICAL BUILDING;So;0;ON;;;;;N;;;;; +1F3DC;DESERT;So;0;ON;;;;;N;;;;; +1F3DD;DESERT ISLAND;So;0;ON;;;;;N;;;;; +1F3DE;NATIONAL PARK;So;0;ON;;;;;N;;;;; +1F3DF;STADIUM;So;0;ON;;;;;N;;;;; +1F3E0;HOUSE BUILDING;So;0;ON;;;;;N;;;;; +1F3E1;HOUSE WITH GARDEN;So;0;ON;;;;;N;;;;; +1F3E2;OFFICE BUILDING;So;0;ON;;;;;N;;;;; +1F3E3;JAPANESE POST OFFICE;So;0;ON;;;;;N;;;;; +1F3E4;EUROPEAN POST OFFICE;So;0;ON;;;;;N;;;;; +1F3E5;HOSPITAL;So;0;ON;;;;;N;;;;; +1F3E6;BANK;So;0;ON;;;;;N;;;;; +1F3E7;AUTOMATED TELLER MACHINE;So;0;ON;;;;;N;;;;; +1F3E8;HOTEL;So;0;ON;;;;;N;;;;; +1F3E9;LOVE HOTEL;So;0;ON;;;;;N;;;;; +1F3EA;CONVENIENCE STORE;So;0;ON;;;;;N;;;;; +1F3EB;SCHOOL;So;0;ON;;;;;N;;;;; +1F3EC;DEPARTMENT STORE;So;0;ON;;;;;N;;;;; +1F3ED;FACTORY;So;0;ON;;;;;N;;;;; +1F3EE;IZAKAYA LANTERN;So;0;ON;;;;;N;;;;; +1F3EF;JAPANESE CASTLE;So;0;ON;;;;;N;;;;; +1F3F0;EUROPEAN CASTLE;So;0;ON;;;;;N;;;;; +1F3F1;WHITE PENNANT;So;0;ON;;;;;N;;;;; +1F3F2;BLACK PENNANT;So;0;ON;;;;;N;;;;; +1F3F3;WAVING WHITE FLAG;So;0;ON;;;;;N;;;;; +1F3F4;WAVING BLACK FLAG;So;0;ON;;;;;N;;;;; +1F3F5;ROSETTE;So;0;ON;;;;;N;;;;; +1F3F6;BLACK ROSETTE;So;0;ON;;;;;N;;;;; +1F3F7;LABEL;So;0;ON;;;;;N;;;;; +1F3F8;BADMINTON RACQUET AND SHUTTLECOCK;So;0;ON;;;;;N;;;;; +1F3F9;BOW AND ARROW;So;0;ON;;;;;N;;;;; +1F3FA;AMPHORA;So;0;ON;;;;;N;;;;; +1F3FB;EMOJI MODIFIER FITZPATRICK TYPE-1-2;Sk;0;ON;;;;;N;;;;; +1F3FC;EMOJI MODIFIER FITZPATRICK TYPE-3;Sk;0;ON;;;;;N;;;;; +1F3FD;EMOJI MODIFIER FITZPATRICK TYPE-4;Sk;0;ON;;;;;N;;;;; +1F3FE;EMOJI MODIFIER FITZPATRICK TYPE-5;Sk;0;ON;;;;;N;;;;; +1F3FF;EMOJI MODIFIER FITZPATRICK TYPE-6;Sk;0;ON;;;;;N;;;;; +1F400;RAT;So;0;ON;;;;;N;;;;; +1F401;MOUSE;So;0;ON;;;;;N;;;;; +1F402;OX;So;0;ON;;;;;N;;;;; +1F403;WATER BUFFALO;So;0;ON;;;;;N;;;;; +1F404;COW;So;0;ON;;;;;N;;;;; +1F405;TIGER;So;0;ON;;;;;N;;;;; +1F406;LEOPARD;So;0;ON;;;;;N;;;;; +1F407;RABBIT;So;0;ON;;;;;N;;;;; +1F408;CAT;So;0;ON;;;;;N;;;;; +1F409;DRAGON;So;0;ON;;;;;N;;;;; +1F40A;CROCODILE;So;0;ON;;;;;N;;;;; +1F40B;WHALE;So;0;ON;;;;;N;;;;; +1F40C;SNAIL;So;0;ON;;;;;N;;;;; +1F40D;SNAKE;So;0;ON;;;;;N;;;;; +1F40E;HORSE;So;0;ON;;;;;N;;;;; +1F40F;RAM;So;0;ON;;;;;N;;;;; +1F410;GOAT;So;0;ON;;;;;N;;;;; +1F411;SHEEP;So;0;ON;;;;;N;;;;; +1F412;MONKEY;So;0;ON;;;;;N;;;;; +1F413;ROOSTER;So;0;ON;;;;;N;;;;; +1F414;CHICKEN;So;0;ON;;;;;N;;;;; +1F415;DOG;So;0;ON;;;;;N;;;;; +1F416;PIG;So;0;ON;;;;;N;;;;; +1F417;BOAR;So;0;ON;;;;;N;;;;; +1F418;ELEPHANT;So;0;ON;;;;;N;;;;; +1F419;OCTOPUS;So;0;ON;;;;;N;;;;; +1F41A;SPIRAL SHELL;So;0;ON;;;;;N;;;;; +1F41B;BUG;So;0;ON;;;;;N;;;;; +1F41C;ANT;So;0;ON;;;;;N;;;;; +1F41D;HONEYBEE;So;0;ON;;;;;N;;;;; +1F41E;LADY BEETLE;So;0;ON;;;;;N;;;;; +1F41F;FISH;So;0;ON;;;;;N;;;;; +1F420;TROPICAL FISH;So;0;ON;;;;;N;;;;; +1F421;BLOWFISH;So;0;ON;;;;;N;;;;; +1F422;TURTLE;So;0;ON;;;;;N;;;;; +1F423;HATCHING CHICK;So;0;ON;;;;;N;;;;; +1F424;BABY CHICK;So;0;ON;;;;;N;;;;; +1F425;FRONT-FACING BABY CHICK;So;0;ON;;;;;N;;;;; +1F426;BIRD;So;0;ON;;;;;N;;;;; +1F427;PENGUIN;So;0;ON;;;;;N;;;;; +1F428;KOALA;So;0;ON;;;;;N;;;;; +1F429;POODLE;So;0;ON;;;;;N;;;;; +1F42A;DROMEDARY CAMEL;So;0;ON;;;;;N;;;;; +1F42B;BACTRIAN CAMEL;So;0;ON;;;;;N;;;;; +1F42C;DOLPHIN;So;0;ON;;;;;N;;;;; +1F42D;MOUSE FACE;So;0;ON;;;;;N;;;;; +1F42E;COW FACE;So;0;ON;;;;;N;;;;; +1F42F;TIGER FACE;So;0;ON;;;;;N;;;;; +1F430;RABBIT FACE;So;0;ON;;;;;N;;;;; +1F431;CAT FACE;So;0;ON;;;;;N;;;;; +1F432;DRAGON FACE;So;0;ON;;;;;N;;;;; +1F433;SPOUTING WHALE;So;0;ON;;;;;N;;;;; +1F434;HORSE FACE;So;0;ON;;;;;N;;;;; +1F435;MONKEY FACE;So;0;ON;;;;;N;;;;; +1F436;DOG FACE;So;0;ON;;;;;N;;;;; +1F437;PIG FACE;So;0;ON;;;;;N;;;;; +1F438;FROG FACE;So;0;ON;;;;;N;;;;; +1F439;HAMSTER FACE;So;0;ON;;;;;N;;;;; +1F43A;WOLF FACE;So;0;ON;;;;;N;;;;; +1F43B;BEAR FACE;So;0;ON;;;;;N;;;;; +1F43C;PANDA FACE;So;0;ON;;;;;N;;;;; +1F43D;PIG NOSE;So;0;ON;;;;;N;;;;; +1F43E;PAW PRINTS;So;0;ON;;;;;N;;;;; +1F43F;CHIPMUNK;So;0;ON;;;;;N;;;;; +1F440;EYES;So;0;ON;;;;;N;;;;; +1F441;EYE;So;0;ON;;;;;N;;;;; +1F442;EAR;So;0;ON;;;;;N;;;;; +1F443;NOSE;So;0;ON;;;;;N;;;;; +1F444;MOUTH;So;0;ON;;;;;N;;;;; +1F445;TONGUE;So;0;ON;;;;;N;;;;; +1F446;WHITE UP POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F447;WHITE DOWN POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F448;WHITE LEFT POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F449;WHITE RIGHT POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F44A;FISTED HAND SIGN;So;0;ON;;;;;N;;;;; +1F44B;WAVING HAND SIGN;So;0;ON;;;;;N;;;;; +1F44C;OK HAND SIGN;So;0;ON;;;;;N;;;;; +1F44D;THUMBS UP SIGN;So;0;ON;;;;;N;;;;; +1F44E;THUMBS DOWN SIGN;So;0;ON;;;;;N;;;;; +1F44F;CLAPPING HANDS SIGN;So;0;ON;;;;;N;;;;; +1F450;OPEN HANDS SIGN;So;0;ON;;;;;N;;;;; +1F451;CROWN;So;0;ON;;;;;N;;;;; +1F452;WOMANS HAT;So;0;ON;;;;;N;;;;; +1F453;EYEGLASSES;So;0;ON;;;;;N;;;;; +1F454;NECKTIE;So;0;ON;;;;;N;;;;; +1F455;T-SHIRT;So;0;ON;;;;;N;;;;; +1F456;JEANS;So;0;ON;;;;;N;;;;; +1F457;DRESS;So;0;ON;;;;;N;;;;; +1F458;KIMONO;So;0;ON;;;;;N;;;;; +1F459;BIKINI;So;0;ON;;;;;N;;;;; +1F45A;WOMANS CLOTHES;So;0;ON;;;;;N;;;;; +1F45B;PURSE;So;0;ON;;;;;N;;;;; +1F45C;HANDBAG;So;0;ON;;;;;N;;;;; +1F45D;POUCH;So;0;ON;;;;;N;;;;; +1F45E;MANS SHOE;So;0;ON;;;;;N;;;;; +1F45F;ATHLETIC SHOE;So;0;ON;;;;;N;;;;; +1F460;HIGH-HEELED SHOE;So;0;ON;;;;;N;;;;; +1F461;WOMANS SANDAL;So;0;ON;;;;;N;;;;; +1F462;WOMANS BOOTS;So;0;ON;;;;;N;;;;; +1F463;FOOTPRINTS;So;0;ON;;;;;N;;;;; +1F464;BUST IN SILHOUETTE;So;0;ON;;;;;N;;;;; +1F465;BUSTS IN SILHOUETTE;So;0;ON;;;;;N;;;;; +1F466;BOY;So;0;ON;;;;;N;;;;; +1F467;GIRL;So;0;ON;;;;;N;;;;; +1F468;MAN;So;0;ON;;;;;N;;;;; +1F469;WOMAN;So;0;ON;;;;;N;;;;; +1F46A;FAMILY;So;0;ON;;;;;N;;;;; +1F46B;MAN AND WOMAN HOLDING HANDS;So;0;ON;;;;;N;;;;; +1F46C;TWO MEN HOLDING HANDS;So;0;ON;;;;;N;;;;; +1F46D;TWO WOMEN HOLDING HANDS;So;0;ON;;;;;N;;;;; +1F46E;POLICE OFFICER;So;0;ON;;;;;N;;;;; +1F46F;WOMAN WITH BUNNY EARS;So;0;ON;;;;;N;;;;; +1F470;BRIDE WITH VEIL;So;0;ON;;;;;N;;;;; +1F471;PERSON WITH BLOND HAIR;So;0;ON;;;;;N;;;;; +1F472;MAN WITH GUA PI MAO;So;0;ON;;;;;N;;;;; +1F473;MAN WITH TURBAN;So;0;ON;;;;;N;;;;; +1F474;OLDER MAN;So;0;ON;;;;;N;;;;; +1F475;OLDER WOMAN;So;0;ON;;;;;N;;;;; +1F476;BABY;So;0;ON;;;;;N;;;;; +1F477;CONSTRUCTION WORKER;So;0;ON;;;;;N;;;;; +1F478;PRINCESS;So;0;ON;;;;;N;;;;; +1F479;JAPANESE OGRE;So;0;ON;;;;;N;;;;; +1F47A;JAPANESE GOBLIN;So;0;ON;;;;;N;;;;; +1F47B;GHOST;So;0;ON;;;;;N;;;;; +1F47C;BABY ANGEL;So;0;ON;;;;;N;;;;; +1F47D;EXTRATERRESTRIAL ALIEN;So;0;ON;;;;;N;;;;; +1F47E;ALIEN MONSTER;So;0;ON;;;;;N;;;;; +1F47F;IMP;So;0;ON;;;;;N;;;;; +1F480;SKULL;So;0;ON;;;;;N;;;;; +1F481;INFORMATION DESK PERSON;So;0;ON;;;;;N;;;;; +1F482;GUARDSMAN;So;0;ON;;;;;N;;;;; +1F483;DANCER;So;0;ON;;;;;N;;;;; +1F484;LIPSTICK;So;0;ON;;;;;N;;;;; +1F485;NAIL POLISH;So;0;ON;;;;;N;;;;; +1F486;FACE MASSAGE;So;0;ON;;;;;N;;;;; +1F487;HAIRCUT;So;0;ON;;;;;N;;;;; +1F488;BARBER POLE;So;0;ON;;;;;N;;;;; +1F489;SYRINGE;So;0;ON;;;;;N;;;;; +1F48A;PILL;So;0;ON;;;;;N;;;;; +1F48B;KISS MARK;So;0;ON;;;;;N;;;;; +1F48C;LOVE LETTER;So;0;ON;;;;;N;;;;; +1F48D;RING;So;0;ON;;;;;N;;;;; +1F48E;GEM STONE;So;0;ON;;;;;N;;;;; +1F48F;KISS;So;0;ON;;;;;N;;;;; +1F490;BOUQUET;So;0;ON;;;;;N;;;;; +1F491;COUPLE WITH HEART;So;0;ON;;;;;N;;;;; +1F492;WEDDING;So;0;ON;;;;;N;;;;; +1F493;BEATING HEART;So;0;ON;;;;;N;;;;; +1F494;BROKEN HEART;So;0;ON;;;;;N;;;;; +1F495;TWO HEARTS;So;0;ON;;;;;N;;;;; +1F496;SPARKLING HEART;So;0;ON;;;;;N;;;;; +1F497;GROWING HEART;So;0;ON;;;;;N;;;;; +1F498;HEART WITH ARROW;So;0;ON;;;;;N;;;;; +1F499;BLUE HEART;So;0;ON;;;;;N;;;;; +1F49A;GREEN HEART;So;0;ON;;;;;N;;;;; +1F49B;YELLOW HEART;So;0;ON;;;;;N;;;;; +1F49C;PURPLE HEART;So;0;ON;;;;;N;;;;; +1F49D;HEART WITH RIBBON;So;0;ON;;;;;N;;;;; +1F49E;REVOLVING HEARTS;So;0;ON;;;;;N;;;;; +1F49F;HEART DECORATION;So;0;ON;;;;;N;;;;; +1F4A0;DIAMOND SHAPE WITH A DOT INSIDE;So;0;ON;;;;;N;;;;; +1F4A1;ELECTRIC LIGHT BULB;So;0;ON;;;;;N;;;;; +1F4A2;ANGER SYMBOL;So;0;ON;;;;;N;;;;; +1F4A3;BOMB;So;0;ON;;;;;N;;;;; +1F4A4;SLEEPING SYMBOL;So;0;ON;;;;;N;;;;; +1F4A5;COLLISION SYMBOL;So;0;ON;;;;;N;;;;; +1F4A6;SPLASHING SWEAT SYMBOL;So;0;ON;;;;;N;;;;; +1F4A7;DROPLET;So;0;ON;;;;;N;;;;; +1F4A8;DASH SYMBOL;So;0;ON;;;;;N;;;;; +1F4A9;PILE OF POO;So;0;ON;;;;;N;;;;; +1F4AA;FLEXED BICEPS;So;0;ON;;;;;N;;;;; +1F4AB;DIZZY SYMBOL;So;0;ON;;;;;N;;;;; +1F4AC;SPEECH BALLOON;So;0;ON;;;;;N;;;;; +1F4AD;THOUGHT BALLOON;So;0;ON;;;;;N;;;;; +1F4AE;WHITE FLOWER;So;0;ON;;;;;N;;;;; +1F4AF;HUNDRED POINTS SYMBOL;So;0;ON;;;;;N;;;;; +1F4B0;MONEY BAG;So;0;ON;;;;;N;;;;; +1F4B1;CURRENCY EXCHANGE;So;0;ON;;;;;N;;;;; +1F4B2;HEAVY DOLLAR SIGN;So;0;ON;;;;;N;;;;; +1F4B3;CREDIT CARD;So;0;ON;;;;;N;;;;; +1F4B4;BANKNOTE WITH YEN SIGN;So;0;ON;;;;;N;;;;; +1F4B5;BANKNOTE WITH DOLLAR SIGN;So;0;ON;;;;;N;;;;; +1F4B6;BANKNOTE WITH EURO SIGN;So;0;ON;;;;;N;;;;; +1F4B7;BANKNOTE WITH POUND SIGN;So;0;ON;;;;;N;;;;; +1F4B8;MONEY WITH WINGS;So;0;ON;;;;;N;;;;; +1F4B9;CHART WITH UPWARDS TREND AND YEN SIGN;So;0;ON;;;;;N;;;;; +1F4BA;SEAT;So;0;ON;;;;;N;;;;; +1F4BB;PERSONAL COMPUTER;So;0;ON;;;;;N;;;;; +1F4BC;BRIEFCASE;So;0;ON;;;;;N;;;;; +1F4BD;MINIDISC;So;0;ON;;;;;N;;;;; +1F4BE;FLOPPY DISK;So;0;ON;;;;;N;;;;; +1F4BF;OPTICAL DISC;So;0;ON;;;;;N;;;;; +1F4C0;DVD;So;0;ON;;;;;N;;;;; +1F4C1;FILE FOLDER;So;0;ON;;;;;N;;;;; +1F4C2;OPEN FILE FOLDER;So;0;ON;;;;;N;;;;; +1F4C3;PAGE WITH CURL;So;0;ON;;;;;N;;;;; +1F4C4;PAGE FACING UP;So;0;ON;;;;;N;;;;; +1F4C5;CALENDAR;So;0;ON;;;;;N;;;;; +1F4C6;TEAR-OFF CALENDAR;So;0;ON;;;;;N;;;;; +1F4C7;CARD INDEX;So;0;ON;;;;;N;;;;; +1F4C8;CHART WITH UPWARDS TREND;So;0;ON;;;;;N;;;;; +1F4C9;CHART WITH DOWNWARDS TREND;So;0;ON;;;;;N;;;;; +1F4CA;BAR CHART;So;0;ON;;;;;N;;;;; +1F4CB;CLIPBOARD;So;0;ON;;;;;N;;;;; +1F4CC;PUSHPIN;So;0;ON;;;;;N;;;;; +1F4CD;ROUND PUSHPIN;So;0;ON;;;;;N;;;;; +1F4CE;PAPERCLIP;So;0;ON;;;;;N;;;;; +1F4CF;STRAIGHT RULER;So;0;ON;;;;;N;;;;; +1F4D0;TRIANGULAR RULER;So;0;ON;;;;;N;;;;; +1F4D1;BOOKMARK TABS;So;0;ON;;;;;N;;;;; +1F4D2;LEDGER;So;0;ON;;;;;N;;;;; +1F4D3;NOTEBOOK;So;0;ON;;;;;N;;;;; +1F4D4;NOTEBOOK WITH DECORATIVE COVER;So;0;ON;;;;;N;;;;; +1F4D5;CLOSED BOOK;So;0;ON;;;;;N;;;;; +1F4D6;OPEN BOOK;So;0;ON;;;;;N;;;;; +1F4D7;GREEN BOOK;So;0;ON;;;;;N;;;;; +1F4D8;BLUE BOOK;So;0;ON;;;;;N;;;;; +1F4D9;ORANGE BOOK;So;0;ON;;;;;N;;;;; +1F4DA;BOOKS;So;0;ON;;;;;N;;;;; +1F4DB;NAME BADGE;So;0;ON;;;;;N;;;;; +1F4DC;SCROLL;So;0;ON;;;;;N;;;;; +1F4DD;MEMO;So;0;ON;;;;;N;;;;; +1F4DE;TELEPHONE RECEIVER;So;0;ON;;;;;N;;;;; +1F4DF;PAGER;So;0;ON;;;;;N;;;;; +1F4E0;FAX MACHINE;So;0;ON;;;;;N;;;;; +1F4E1;SATELLITE ANTENNA;So;0;ON;;;;;N;;;;; +1F4E2;PUBLIC ADDRESS LOUDSPEAKER;So;0;ON;;;;;N;;;;; +1F4E3;CHEERING MEGAPHONE;So;0;ON;;;;;N;;;;; +1F4E4;OUTBOX TRAY;So;0;ON;;;;;N;;;;; +1F4E5;INBOX TRAY;So;0;ON;;;;;N;;;;; +1F4E6;PACKAGE;So;0;ON;;;;;N;;;;; +1F4E7;E-MAIL SYMBOL;So;0;ON;;;;;N;;;;; +1F4E8;INCOMING ENVELOPE;So;0;ON;;;;;N;;;;; +1F4E9;ENVELOPE WITH DOWNWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;; +1F4EA;CLOSED MAILBOX WITH LOWERED FLAG;So;0;ON;;;;;N;;;;; +1F4EB;CLOSED MAILBOX WITH RAISED FLAG;So;0;ON;;;;;N;;;;; +1F4EC;OPEN MAILBOX WITH RAISED FLAG;So;0;ON;;;;;N;;;;; +1F4ED;OPEN MAILBOX WITH LOWERED FLAG;So;0;ON;;;;;N;;;;; +1F4EE;POSTBOX;So;0;ON;;;;;N;;;;; +1F4EF;POSTAL HORN;So;0;ON;;;;;N;;;;; +1F4F0;NEWSPAPER;So;0;ON;;;;;N;;;;; +1F4F1;MOBILE PHONE;So;0;ON;;;;;N;;;;; +1F4F2;MOBILE PHONE WITH RIGHTWARDS ARROW AT LEFT;So;0;ON;;;;;N;;;;; +1F4F3;VIBRATION MODE;So;0;ON;;;;;N;;;;; +1F4F4;MOBILE PHONE OFF;So;0;ON;;;;;N;;;;; +1F4F5;NO MOBILE PHONES;So;0;ON;;;;;N;;;;; +1F4F6;ANTENNA WITH BARS;So;0;ON;;;;;N;;;;; +1F4F7;CAMERA;So;0;ON;;;;;N;;;;; +1F4F8;CAMERA WITH FLASH;So;0;ON;;;;;N;;;;; +1F4F9;VIDEO CAMERA;So;0;ON;;;;;N;;;;; +1F4FA;TELEVISION;So;0;ON;;;;;N;;;;; +1F4FB;RADIO;So;0;ON;;;;;N;;;;; +1F4FC;VIDEOCASSETTE;So;0;ON;;;;;N;;;;; +1F4FD;FILM PROJECTOR;So;0;ON;;;;;N;;;;; +1F4FE;PORTABLE STEREO;So;0;ON;;;;;N;;;;; +1F4FF;PRAYER BEADS;So;0;ON;;;;;N;;;;; +1F500;TWISTED RIGHTWARDS ARROWS;So;0;ON;;;;;N;;;;; +1F501;CLOCKWISE RIGHTWARDS AND LEFTWARDS OPEN CIRCLE ARROWS;So;0;ON;;;;;N;;;;; +1F502;CLOCKWISE RIGHTWARDS AND LEFTWARDS OPEN CIRCLE ARROWS WITH CIRCLED ONE OVERLAY;So;0;ON;;;;;N;;;;; +1F503;CLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS;So;0;ON;;;;;N;;;;; +1F504;ANTICLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS;So;0;ON;;;;;N;;;;; +1F505;LOW BRIGHTNESS SYMBOL;So;0;ON;;;;;N;;;;; +1F506;HIGH BRIGHTNESS SYMBOL;So;0;ON;;;;;N;;;;; +1F507;SPEAKER WITH CANCELLATION STROKE;So;0;ON;;;;;N;;;;; +1F508;SPEAKER;So;0;ON;;;;;N;;;;; +1F509;SPEAKER WITH ONE SOUND WAVE;So;0;ON;;;;;N;;;;; +1F50A;SPEAKER WITH THREE SOUND WAVES;So;0;ON;;;;;N;;;;; +1F50B;BATTERY;So;0;ON;;;;;N;;;;; +1F50C;ELECTRIC PLUG;So;0;ON;;;;;N;;;;; +1F50D;LEFT-POINTING MAGNIFYING GLASS;So;0;ON;;;;;N;;;;; +1F50E;RIGHT-POINTING MAGNIFYING GLASS;So;0;ON;;;;;N;;;;; +1F50F;LOCK WITH INK PEN;So;0;ON;;;;;N;;;;; +1F510;CLOSED LOCK WITH KEY;So;0;ON;;;;;N;;;;; +1F511;KEY;So;0;ON;;;;;N;;;;; +1F512;LOCK;So;0;ON;;;;;N;;;;; +1F513;OPEN LOCK;So;0;ON;;;;;N;;;;; +1F514;BELL;So;0;ON;;;;;N;;;;; +1F515;BELL WITH CANCELLATION STROKE;So;0;ON;;;;;N;;;;; +1F516;BOOKMARK;So;0;ON;;;;;N;;;;; +1F517;LINK SYMBOL;So;0;ON;;;;;N;;;;; +1F518;RADIO BUTTON;So;0;ON;;;;;N;;;;; +1F519;BACK WITH LEFTWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;; +1F51A;END WITH LEFTWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;; +1F51B;ON WITH EXCLAMATION MARK WITH LEFT RIGHT ARROW ABOVE;So;0;ON;;;;;N;;;;; +1F51C;SOON WITH RIGHTWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;; +1F51D;TOP WITH UPWARDS ARROW ABOVE;So;0;ON;;;;;N;;;;; +1F51E;NO ONE UNDER EIGHTEEN SYMBOL;So;0;ON;;;;;N;;;;; +1F51F;KEYCAP TEN;So;0;ON;;;;;N;;;;; +1F520;INPUT SYMBOL FOR LATIN CAPITAL LETTERS;So;0;ON;;;;;N;;;;; +1F521;INPUT SYMBOL FOR LATIN SMALL LETTERS;So;0;ON;;;;;N;;;;; +1F522;INPUT SYMBOL FOR NUMBERS;So;0;ON;;;;;N;;;;; +1F523;INPUT SYMBOL FOR SYMBOLS;So;0;ON;;;;;N;;;;; +1F524;INPUT SYMBOL FOR LATIN LETTERS;So;0;ON;;;;;N;;;;; +1F525;FIRE;So;0;ON;;;;;N;;;;; +1F526;ELECTRIC TORCH;So;0;ON;;;;;N;;;;; +1F527;WRENCH;So;0;ON;;;;;N;;;;; +1F528;HAMMER;So;0;ON;;;;;N;;;;; +1F529;NUT AND BOLT;So;0;ON;;;;;N;;;;; +1F52A;HOCHO;So;0;ON;;;;;N;;;;; +1F52B;PISTOL;So;0;ON;;;;;N;;;;; +1F52C;MICROSCOPE;So;0;ON;;;;;N;;;;; +1F52D;TELESCOPE;So;0;ON;;;;;N;;;;; +1F52E;CRYSTAL BALL;So;0;ON;;;;;N;;;;; +1F52F;SIX POINTED STAR WITH MIDDLE DOT;So;0;ON;;;;;N;;;;; +1F530;JAPANESE SYMBOL FOR BEGINNER;So;0;ON;;;;;N;;;;; +1F531;TRIDENT EMBLEM;So;0;ON;;;;;N;;;;; +1F532;BLACK SQUARE BUTTON;So;0;ON;;;;;N;;;;; +1F533;WHITE SQUARE BUTTON;So;0;ON;;;;;N;;;;; +1F534;LARGE RED CIRCLE;So;0;ON;;;;;N;;;;; +1F535;LARGE BLUE CIRCLE;So;0;ON;;;;;N;;;;; +1F536;LARGE ORANGE DIAMOND;So;0;ON;;;;;N;;;;; +1F537;LARGE BLUE DIAMOND;So;0;ON;;;;;N;;;;; +1F538;SMALL ORANGE DIAMOND;So;0;ON;;;;;N;;;;; +1F539;SMALL BLUE DIAMOND;So;0;ON;;;;;N;;;;; +1F53A;UP-POINTING RED TRIANGLE;So;0;ON;;;;;N;;;;; +1F53B;DOWN-POINTING RED TRIANGLE;So;0;ON;;;;;N;;;;; +1F53C;UP-POINTING SMALL RED TRIANGLE;So;0;ON;;;;;N;;;;; +1F53D;DOWN-POINTING SMALL RED TRIANGLE;So;0;ON;;;;;N;;;;; +1F53E;LOWER RIGHT SHADOWED WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F53F;UPPER RIGHT SHADOWED WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F540;CIRCLED CROSS POMMEE;So;0;ON;;;;;N;;;;; +1F541;CROSS POMMEE WITH HALF-CIRCLE BELOW;So;0;ON;;;;;N;;;;; +1F542;CROSS POMMEE;So;0;ON;;;;;N;;;;; +1F543;NOTCHED LEFT SEMICIRCLE WITH THREE DOTS;So;0;ON;;;;;N;;;;; +1F544;NOTCHED RIGHT SEMICIRCLE WITH THREE DOTS;So;0;ON;;;;;N;;;;; +1F545;SYMBOL FOR MARKS CHAPTER;So;0;ON;;;;;N;;;;; +1F546;WHITE LATIN CROSS;So;0;ON;;;;;N;;;;; +1F547;HEAVY LATIN CROSS;So;0;ON;;;;;N;;;;; +1F548;CELTIC CROSS;So;0;ON;;;;;N;;;;; +1F549;OM SYMBOL;So;0;ON;;;;;N;;;;; +1F54A;DOVE OF PEACE;So;0;ON;;;;;N;;;;; +1F54B;KAABA;So;0;ON;;;;;N;;;;; +1F54C;MOSQUE;So;0;ON;;;;;N;;;;; +1F54D;SYNAGOGUE;So;0;ON;;;;;N;;;;; +1F54E;MENORAH WITH NINE BRANCHES;So;0;ON;;;;;N;;;;; +1F54F;BOWL OF HYGIEIA;So;0;ON;;;;;N;;;;; +1F550;CLOCK FACE ONE OCLOCK;So;0;ON;;;;;N;;;;; +1F551;CLOCK FACE TWO OCLOCK;So;0;ON;;;;;N;;;;; +1F552;CLOCK FACE THREE OCLOCK;So;0;ON;;;;;N;;;;; +1F553;CLOCK FACE FOUR OCLOCK;So;0;ON;;;;;N;;;;; +1F554;CLOCK FACE FIVE OCLOCK;So;0;ON;;;;;N;;;;; +1F555;CLOCK FACE SIX OCLOCK;So;0;ON;;;;;N;;;;; +1F556;CLOCK FACE SEVEN OCLOCK;So;0;ON;;;;;N;;;;; +1F557;CLOCK FACE EIGHT OCLOCK;So;0;ON;;;;;N;;;;; +1F558;CLOCK FACE NINE OCLOCK;So;0;ON;;;;;N;;;;; +1F559;CLOCK FACE TEN OCLOCK;So;0;ON;;;;;N;;;;; +1F55A;CLOCK FACE ELEVEN OCLOCK;So;0;ON;;;;;N;;;;; +1F55B;CLOCK FACE TWELVE OCLOCK;So;0;ON;;;;;N;;;;; +1F55C;CLOCK FACE ONE-THIRTY;So;0;ON;;;;;N;;;;; +1F55D;CLOCK FACE TWO-THIRTY;So;0;ON;;;;;N;;;;; +1F55E;CLOCK FACE THREE-THIRTY;So;0;ON;;;;;N;;;;; +1F55F;CLOCK FACE FOUR-THIRTY;So;0;ON;;;;;N;;;;; +1F560;CLOCK FACE FIVE-THIRTY;So;0;ON;;;;;N;;;;; +1F561;CLOCK FACE SIX-THIRTY;So;0;ON;;;;;N;;;;; +1F562;CLOCK FACE SEVEN-THIRTY;So;0;ON;;;;;N;;;;; +1F563;CLOCK FACE EIGHT-THIRTY;So;0;ON;;;;;N;;;;; +1F564;CLOCK FACE NINE-THIRTY;So;0;ON;;;;;N;;;;; +1F565;CLOCK FACE TEN-THIRTY;So;0;ON;;;;;N;;;;; +1F566;CLOCK FACE ELEVEN-THIRTY;So;0;ON;;;;;N;;;;; +1F567;CLOCK FACE TWELVE-THIRTY;So;0;ON;;;;;N;;;;; +1F568;RIGHT SPEAKER;So;0;ON;;;;;N;;;;; +1F569;RIGHT SPEAKER WITH ONE SOUND WAVE;So;0;ON;;;;;N;;;;; +1F56A;RIGHT SPEAKER WITH THREE SOUND WAVES;So;0;ON;;;;;N;;;;; +1F56B;BULLHORN;So;0;ON;;;;;N;;;;; +1F56C;BULLHORN WITH SOUND WAVES;So;0;ON;;;;;N;;;;; +1F56D;RINGING BELL;So;0;ON;;;;;N;;;;; +1F56E;BOOK;So;0;ON;;;;;N;;;;; +1F56F;CANDLE;So;0;ON;;;;;N;;;;; +1F570;MANTELPIECE CLOCK;So;0;ON;;;;;N;;;;; +1F571;BLACK SKULL AND CROSSBONES;So;0;ON;;;;;N;;;;; +1F572;NO PIRACY;So;0;ON;;;;;N;;;;; +1F573;HOLE;So;0;ON;;;;;N;;;;; +1F574;MAN IN BUSINESS SUIT LEVITATING;So;0;ON;;;;;N;;;;; +1F575;SLEUTH OR SPY;So;0;ON;;;;;N;;;;; +1F576;DARK SUNGLASSES;So;0;ON;;;;;N;;;;; +1F577;SPIDER;So;0;ON;;;;;N;;;;; +1F578;SPIDER WEB;So;0;ON;;;;;N;;;;; +1F579;JOYSTICK;So;0;ON;;;;;N;;;;; +1F57A;MAN DANCING;So;0;ON;;;;;N;;;;; +1F57B;LEFT HAND TELEPHONE RECEIVER;So;0;ON;;;;;N;;;;; +1F57C;TELEPHONE RECEIVER WITH PAGE;So;0;ON;;;;;N;;;;; +1F57D;RIGHT HAND TELEPHONE RECEIVER;So;0;ON;;;;;N;;;;; +1F57E;WHITE TOUCHTONE TELEPHONE;So;0;ON;;;;;N;;;;; +1F57F;BLACK TOUCHTONE TELEPHONE;So;0;ON;;;;;N;;;;; +1F580;TELEPHONE ON TOP OF MODEM;So;0;ON;;;;;N;;;;; +1F581;CLAMSHELL MOBILE PHONE;So;0;ON;;;;;N;;;;; +1F582;BACK OF ENVELOPE;So;0;ON;;;;;N;;;;; +1F583;STAMPED ENVELOPE;So;0;ON;;;;;N;;;;; +1F584;ENVELOPE WITH LIGHTNING;So;0;ON;;;;;N;;;;; +1F585;FLYING ENVELOPE;So;0;ON;;;;;N;;;;; +1F586;PEN OVER STAMPED ENVELOPE;So;0;ON;;;;;N;;;;; +1F587;LINKED PAPERCLIPS;So;0;ON;;;;;N;;;;; +1F588;BLACK PUSHPIN;So;0;ON;;;;;N;;;;; +1F589;LOWER LEFT PENCIL;So;0;ON;;;;;N;;;;; +1F58A;LOWER LEFT BALLPOINT PEN;So;0;ON;;;;;N;;;;; +1F58B;LOWER LEFT FOUNTAIN PEN;So;0;ON;;;;;N;;;;; +1F58C;LOWER LEFT PAINTBRUSH;So;0;ON;;;;;N;;;;; +1F58D;LOWER LEFT CRAYON;So;0;ON;;;;;N;;;;; +1F58E;LEFT WRITING HAND;So;0;ON;;;;;N;;;;; +1F58F;TURNED OK HAND SIGN;So;0;ON;;;;;N;;;;; +1F590;RAISED HAND WITH FINGERS SPLAYED;So;0;ON;;;;;N;;;;; +1F591;REVERSED RAISED HAND WITH FINGERS SPLAYED;So;0;ON;;;;;N;;;;; +1F592;REVERSED THUMBS UP SIGN;So;0;ON;;;;;N;;;;; +1F593;REVERSED THUMBS DOWN SIGN;So;0;ON;;;;;N;;;;; +1F594;REVERSED VICTORY HAND;So;0;ON;;;;;N;;;;; +1F595;REVERSED HAND WITH MIDDLE FINGER EXTENDED;So;0;ON;;;;;N;;;;; +1F596;RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS;So;0;ON;;;;;N;;;;; +1F597;WHITE DOWN POINTING LEFT HAND INDEX;So;0;ON;;;;;N;;;;; +1F598;SIDEWAYS WHITE LEFT POINTING INDEX;So;0;ON;;;;;N;;;;; +1F599;SIDEWAYS WHITE RIGHT POINTING INDEX;So;0;ON;;;;;N;;;;; +1F59A;SIDEWAYS BLACK LEFT POINTING INDEX;So;0;ON;;;;;N;;;;; +1F59B;SIDEWAYS BLACK RIGHT POINTING INDEX;So;0;ON;;;;;N;;;;; +1F59C;BLACK LEFT POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F59D;BLACK RIGHT POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F59E;SIDEWAYS WHITE UP POINTING INDEX;So;0;ON;;;;;N;;;;; +1F59F;SIDEWAYS WHITE DOWN POINTING INDEX;So;0;ON;;;;;N;;;;; +1F5A0;SIDEWAYS BLACK UP POINTING INDEX;So;0;ON;;;;;N;;;;; +1F5A1;SIDEWAYS BLACK DOWN POINTING INDEX;So;0;ON;;;;;N;;;;; +1F5A2;BLACK UP POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F5A3;BLACK DOWN POINTING BACKHAND INDEX;So;0;ON;;;;;N;;;;; +1F5A4;BLACK HEART;So;0;ON;;;;;N;;;;; +1F5A5;DESKTOP COMPUTER;So;0;ON;;;;;N;;;;; +1F5A6;KEYBOARD AND MOUSE;So;0;ON;;;;;N;;;;; +1F5A7;THREE NETWORKED COMPUTERS;So;0;ON;;;;;N;;;;; +1F5A8;PRINTER;So;0;ON;;;;;N;;;;; +1F5A9;POCKET CALCULATOR;So;0;ON;;;;;N;;;;; +1F5AA;BLACK HARD SHELL FLOPPY DISK;So;0;ON;;;;;N;;;;; +1F5AB;WHITE HARD SHELL FLOPPY DISK;So;0;ON;;;;;N;;;;; +1F5AC;SOFT SHELL FLOPPY DISK;So;0;ON;;;;;N;;;;; +1F5AD;TAPE CARTRIDGE;So;0;ON;;;;;N;;;;; +1F5AE;WIRED KEYBOARD;So;0;ON;;;;;N;;;;; +1F5AF;ONE BUTTON MOUSE;So;0;ON;;;;;N;;;;; +1F5B0;TWO BUTTON MOUSE;So;0;ON;;;;;N;;;;; +1F5B1;THREE BUTTON MOUSE;So;0;ON;;;;;N;;;;; +1F5B2;TRACKBALL;So;0;ON;;;;;N;;;;; +1F5B3;OLD PERSONAL COMPUTER;So;0;ON;;;;;N;;;;; +1F5B4;HARD DISK;So;0;ON;;;;;N;;;;; +1F5B5;SCREEN;So;0;ON;;;;;N;;;;; +1F5B6;PRINTER ICON;So;0;ON;;;;;N;;;;; +1F5B7;FAX ICON;So;0;ON;;;;;N;;;;; +1F5B8;OPTICAL DISC ICON;So;0;ON;;;;;N;;;;; +1F5B9;DOCUMENT WITH TEXT;So;0;ON;;;;;N;;;;; +1F5BA;DOCUMENT WITH TEXT AND PICTURE;So;0;ON;;;;;N;;;;; +1F5BB;DOCUMENT WITH PICTURE;So;0;ON;;;;;N;;;;; +1F5BC;FRAME WITH PICTURE;So;0;ON;;;;;N;;;;; +1F5BD;FRAME WITH TILES;So;0;ON;;;;;N;;;;; +1F5BE;FRAME WITH AN X;So;0;ON;;;;;N;;;;; +1F5BF;BLACK FOLDER;So;0;ON;;;;;N;;;;; +1F5C0;FOLDER;So;0;ON;;;;;N;;;;; +1F5C1;OPEN FOLDER;So;0;ON;;;;;N;;;;; +1F5C2;CARD INDEX DIVIDERS;So;0;ON;;;;;N;;;;; +1F5C3;CARD FILE BOX;So;0;ON;;;;;N;;;;; +1F5C4;FILE CABINET;So;0;ON;;;;;N;;;;; +1F5C5;EMPTY NOTE;So;0;ON;;;;;N;;;;; +1F5C6;EMPTY NOTE PAGE;So;0;ON;;;;;N;;;;; +1F5C7;EMPTY NOTE PAD;So;0;ON;;;;;N;;;;; +1F5C8;NOTE;So;0;ON;;;;;N;;;;; +1F5C9;NOTE PAGE;So;0;ON;;;;;N;;;;; +1F5CA;NOTE PAD;So;0;ON;;;;;N;;;;; +1F5CB;EMPTY DOCUMENT;So;0;ON;;;;;N;;;;; +1F5CC;EMPTY PAGE;So;0;ON;;;;;N;;;;; +1F5CD;EMPTY PAGES;So;0;ON;;;;;N;;;;; +1F5CE;DOCUMENT;So;0;ON;;;;;N;;;;; +1F5CF;PAGE;So;0;ON;;;;;N;;;;; +1F5D0;PAGES;So;0;ON;;;;;N;;;;; +1F5D1;WASTEBASKET;So;0;ON;;;;;N;;;;; +1F5D2;SPIRAL NOTE PAD;So;0;ON;;;;;N;;;;; +1F5D3;SPIRAL CALENDAR PAD;So;0;ON;;;;;N;;;;; +1F5D4;DESKTOP WINDOW;So;0;ON;;;;;N;;;;; +1F5D5;MINIMIZE;So;0;ON;;;;;N;;;;; +1F5D6;MAXIMIZE;So;0;ON;;;;;N;;;;; +1F5D7;OVERLAP;So;0;ON;;;;;N;;;;; +1F5D8;CLOCKWISE RIGHT AND LEFT SEMICIRCLE ARROWS;So;0;ON;;;;;N;;;;; +1F5D9;CANCELLATION X;So;0;ON;;;;;N;;;;; +1F5DA;INCREASE FONT SIZE SYMBOL;So;0;ON;;;;;N;;;;; +1F5DB;DECREASE FONT SIZE SYMBOL;So;0;ON;;;;;N;;;;; +1F5DC;COMPRESSION;So;0;ON;;;;;N;;;;; +1F5DD;OLD KEY;So;0;ON;;;;;N;;;;; +1F5DE;ROLLED-UP NEWSPAPER;So;0;ON;;;;;N;;;;; +1F5DF;PAGE WITH CIRCLED TEXT;So;0;ON;;;;;N;;;;; +1F5E0;STOCK CHART;So;0;ON;;;;;N;;;;; +1F5E1;DAGGER KNIFE;So;0;ON;;;;;N;;;;; +1F5E2;LIPS;So;0;ON;;;;;N;;;;; +1F5E3;SPEAKING HEAD IN SILHOUETTE;So;0;ON;;;;;N;;;;; +1F5E4;THREE RAYS ABOVE;So;0;ON;;;;;N;;;;; +1F5E5;THREE RAYS BELOW;So;0;ON;;;;;N;;;;; +1F5E6;THREE RAYS LEFT;So;0;ON;;;;;N;;;;; +1F5E7;THREE RAYS RIGHT;So;0;ON;;;;;N;;;;; +1F5E8;LEFT SPEECH BUBBLE;So;0;ON;;;;;N;;;;; +1F5E9;RIGHT SPEECH BUBBLE;So;0;ON;;;;;N;;;;; +1F5EA;TWO SPEECH BUBBLES;So;0;ON;;;;;N;;;;; +1F5EB;THREE SPEECH BUBBLES;So;0;ON;;;;;N;;;;; +1F5EC;LEFT THOUGHT BUBBLE;So;0;ON;;;;;N;;;;; +1F5ED;RIGHT THOUGHT BUBBLE;So;0;ON;;;;;N;;;;; +1F5EE;LEFT ANGER BUBBLE;So;0;ON;;;;;N;;;;; +1F5EF;RIGHT ANGER BUBBLE;So;0;ON;;;;;N;;;;; +1F5F0;MOOD BUBBLE;So;0;ON;;;;;N;;;;; +1F5F1;LIGHTNING MOOD BUBBLE;So;0;ON;;;;;N;;;;; +1F5F2;LIGHTNING MOOD;So;0;ON;;;;;N;;;;; +1F5F3;BALLOT BOX WITH BALLOT;So;0;ON;;;;;N;;;;; +1F5F4;BALLOT SCRIPT X;So;0;ON;;;;;N;;;;; +1F5F5;BALLOT BOX WITH SCRIPT X;So;0;ON;;;;;N;;;;; +1F5F6;BALLOT BOLD SCRIPT X;So;0;ON;;;;;N;;;;; +1F5F7;BALLOT BOX WITH BOLD SCRIPT X;So;0;ON;;;;;N;;;;; +1F5F8;LIGHT CHECK MARK;So;0;ON;;;;;N;;;;; +1F5F9;BALLOT BOX WITH BOLD CHECK;So;0;ON;;;;;N;;;;; +1F5FA;WORLD MAP;So;0;ON;;;;;N;;;;; +1F5FB;MOUNT FUJI;So;0;ON;;;;;N;;;;; +1F5FC;TOKYO TOWER;So;0;ON;;;;;N;;;;; +1F5FD;STATUE OF LIBERTY;So;0;ON;;;;;N;;;;; +1F5FE;SILHOUETTE OF JAPAN;So;0;ON;;;;;N;;;;; +1F5FF;MOYAI;So;0;ON;;;;;N;;;;; +1F600;GRINNING FACE;So;0;ON;;;;;N;;;;; +1F601;GRINNING FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;; +1F602;FACE WITH TEARS OF JOY;So;0;ON;;;;;N;;;;; +1F603;SMILING FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;; +1F604;SMILING FACE WITH OPEN MOUTH AND SMILING EYES;So;0;ON;;;;;N;;;;; +1F605;SMILING FACE WITH OPEN MOUTH AND COLD SWEAT;So;0;ON;;;;;N;;;;; +1F606;SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES;So;0;ON;;;;;N;;;;; +1F607;SMILING FACE WITH HALO;So;0;ON;;;;;N;;;;; +1F608;SMILING FACE WITH HORNS;So;0;ON;;;;;N;;;;; +1F609;WINKING FACE;So;0;ON;;;;;N;;;;; +1F60A;SMILING FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;; +1F60B;FACE SAVOURING DELICIOUS FOOD;So;0;ON;;;;;N;;;;; +1F60C;RELIEVED FACE;So;0;ON;;;;;N;;;;; +1F60D;SMILING FACE WITH HEART-SHAPED EYES;So;0;ON;;;;;N;;;;; +1F60E;SMILING FACE WITH SUNGLASSES;So;0;ON;;;;;N;;;;; +1F60F;SMIRKING FACE;So;0;ON;;;;;N;;;;; +1F610;NEUTRAL FACE;So;0;ON;;;;;N;;;;; +1F611;EXPRESSIONLESS FACE;So;0;ON;;;;;N;;;;; +1F612;UNAMUSED FACE;So;0;ON;;;;;N;;;;; +1F613;FACE WITH COLD SWEAT;So;0;ON;;;;;N;;;;; +1F614;PENSIVE FACE;So;0;ON;;;;;N;;;;; +1F615;CONFUSED FACE;So;0;ON;;;;;N;;;;; +1F616;CONFOUNDED FACE;So;0;ON;;;;;N;;;;; +1F617;KISSING FACE;So;0;ON;;;;;N;;;;; +1F618;FACE THROWING A KISS;So;0;ON;;;;;N;;;;; +1F619;KISSING FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;; +1F61A;KISSING FACE WITH CLOSED EYES;So;0;ON;;;;;N;;;;; +1F61B;FACE WITH STUCK-OUT TONGUE;So;0;ON;;;;;N;;;;; +1F61C;FACE WITH STUCK-OUT TONGUE AND WINKING EYE;So;0;ON;;;;;N;;;;; +1F61D;FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES;So;0;ON;;;;;N;;;;; +1F61E;DISAPPOINTED FACE;So;0;ON;;;;;N;;;;; +1F61F;WORRIED FACE;So;0;ON;;;;;N;;;;; +1F620;ANGRY FACE;So;0;ON;;;;;N;;;;; +1F621;POUTING FACE;So;0;ON;;;;;N;;;;; +1F622;CRYING FACE;So;0;ON;;;;;N;;;;; +1F623;PERSEVERING FACE;So;0;ON;;;;;N;;;;; +1F624;FACE WITH LOOK OF TRIUMPH;So;0;ON;;;;;N;;;;; +1F625;DISAPPOINTED BUT RELIEVED FACE;So;0;ON;;;;;N;;;;; +1F626;FROWNING FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;; +1F627;ANGUISHED FACE;So;0;ON;;;;;N;;;;; +1F628;FEARFUL FACE;So;0;ON;;;;;N;;;;; +1F629;WEARY FACE;So;0;ON;;;;;N;;;;; +1F62A;SLEEPY FACE;So;0;ON;;;;;N;;;;; +1F62B;TIRED FACE;So;0;ON;;;;;N;;;;; +1F62C;GRIMACING FACE;So;0;ON;;;;;N;;;;; +1F62D;LOUDLY CRYING FACE;So;0;ON;;;;;N;;;;; +1F62E;FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;; +1F62F;HUSHED FACE;So;0;ON;;;;;N;;;;; +1F630;FACE WITH OPEN MOUTH AND COLD SWEAT;So;0;ON;;;;;N;;;;; +1F631;FACE SCREAMING IN FEAR;So;0;ON;;;;;N;;;;; +1F632;ASTONISHED FACE;So;0;ON;;;;;N;;;;; +1F633;FLUSHED FACE;So;0;ON;;;;;N;;;;; +1F634;SLEEPING FACE;So;0;ON;;;;;N;;;;; +1F635;DIZZY FACE;So;0;ON;;;;;N;;;;; +1F636;FACE WITHOUT MOUTH;So;0;ON;;;;;N;;;;; +1F637;FACE WITH MEDICAL MASK;So;0;ON;;;;;N;;;;; +1F638;GRINNING CAT FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;; +1F639;CAT FACE WITH TEARS OF JOY;So;0;ON;;;;;N;;;;; +1F63A;SMILING CAT FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;; +1F63B;SMILING CAT FACE WITH HEART-SHAPED EYES;So;0;ON;;;;;N;;;;; +1F63C;CAT FACE WITH WRY SMILE;So;0;ON;;;;;N;;;;; +1F63D;KISSING CAT FACE WITH CLOSED EYES;So;0;ON;;;;;N;;;;; +1F63E;POUTING CAT FACE;So;0;ON;;;;;N;;;;; +1F63F;CRYING CAT FACE;So;0;ON;;;;;N;;;;; +1F640;WEARY CAT FACE;So;0;ON;;;;;N;;;;; +1F641;SLIGHTLY FROWNING FACE;So;0;ON;;;;;N;;;;; +1F642;SLIGHTLY SMILING FACE;So;0;ON;;;;;N;;;;; +1F643;UPSIDE-DOWN FACE;So;0;ON;;;;;N;;;;; +1F644;FACE WITH ROLLING EYES;So;0;ON;;;;;N;;;;; +1F645;FACE WITH NO GOOD GESTURE;So;0;ON;;;;;N;;;;; +1F646;FACE WITH OK GESTURE;So;0;ON;;;;;N;;;;; +1F647;PERSON BOWING DEEPLY;So;0;ON;;;;;N;;;;; +1F648;SEE-NO-EVIL MONKEY;So;0;ON;;;;;N;;;;; +1F649;HEAR-NO-EVIL MONKEY;So;0;ON;;;;;N;;;;; +1F64A;SPEAK-NO-EVIL MONKEY;So;0;ON;;;;;N;;;;; +1F64B;HAPPY PERSON RAISING ONE HAND;So;0;ON;;;;;N;;;;; +1F64C;PERSON RAISING BOTH HANDS IN CELEBRATION;So;0;ON;;;;;N;;;;; +1F64D;PERSON FROWNING;So;0;ON;;;;;N;;;;; +1F64E;PERSON WITH POUTING FACE;So;0;ON;;;;;N;;;;; +1F64F;PERSON WITH FOLDED HANDS;So;0;ON;;;;;N;;;;; +1F650;NORTH WEST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F651;SOUTH WEST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F652;NORTH EAST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F653;SOUTH EAST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F654;TURNED NORTH WEST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F655;TURNED SOUTH WEST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F656;TURNED NORTH EAST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F657;TURNED SOUTH EAST POINTING LEAF;So;0;ON;;;;;N;;;;; +1F658;NORTH WEST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F659;SOUTH WEST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F65A;NORTH EAST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F65B;SOUTH EAST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F65C;HEAVY NORTH WEST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F65D;HEAVY SOUTH WEST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F65E;HEAVY NORTH EAST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F65F;HEAVY SOUTH EAST POINTING VINE LEAF;So;0;ON;;;;;N;;;;; +1F660;NORTH WEST POINTING BUD;So;0;ON;;;;;N;;;;; +1F661;SOUTH WEST POINTING BUD;So;0;ON;;;;;N;;;;; +1F662;NORTH EAST POINTING BUD;So;0;ON;;;;;N;;;;; +1F663;SOUTH EAST POINTING BUD;So;0;ON;;;;;N;;;;; +1F664;HEAVY NORTH WEST POINTING BUD;So;0;ON;;;;;N;;;;; +1F665;HEAVY SOUTH WEST POINTING BUD;So;0;ON;;;;;N;;;;; +1F666;HEAVY NORTH EAST POINTING BUD;So;0;ON;;;;;N;;;;; +1F667;HEAVY SOUTH EAST POINTING BUD;So;0;ON;;;;;N;;;;; +1F668;HOLLOW QUILT SQUARE ORNAMENT;So;0;ON;;;;;N;;;;; +1F669;HOLLOW QUILT SQUARE ORNAMENT IN BLACK SQUARE;So;0;ON;;;;;N;;;;; +1F66A;SOLID QUILT SQUARE ORNAMENT;So;0;ON;;;;;N;;;;; +1F66B;SOLID QUILT SQUARE ORNAMENT IN BLACK SQUARE;So;0;ON;;;;;N;;;;; +1F66C;LEFTWARDS ROCKET;So;0;ON;;;;;N;;;;; +1F66D;UPWARDS ROCKET;So;0;ON;;;;;N;;;;; +1F66E;RIGHTWARDS ROCKET;So;0;ON;;;;;N;;;;; +1F66F;DOWNWARDS ROCKET;So;0;ON;;;;;N;;;;; +1F670;SCRIPT LIGATURE ET ORNAMENT;So;0;ON;;;;;N;;;;; +1F671;HEAVY SCRIPT LIGATURE ET ORNAMENT;So;0;ON;;;;;N;;;;; +1F672;LIGATURE OPEN ET ORNAMENT;So;0;ON;;;;;N;;;;; +1F673;HEAVY LIGATURE OPEN ET ORNAMENT;So;0;ON;;;;;N;;;;; +1F674;HEAVY AMPERSAND ORNAMENT;So;0;ON;;;;;N;;;;; +1F675;SWASH AMPERSAND ORNAMENT;So;0;ON;;;;;N;;;;; +1F676;SANS-SERIF HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +1F677;SANS-SERIF HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +1F678;SANS-SERIF HEAVY LOW DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;; +1F679;HEAVY INTERROBANG ORNAMENT;So;0;ON;;;;;N;;;;; +1F67A;SANS-SERIF INTERROBANG ORNAMENT;So;0;ON;;;;;N;;;;; +1F67B;HEAVY SANS-SERIF INTERROBANG ORNAMENT;So;0;ON;;;;;N;;;;; +1F67C;VERY HEAVY SOLIDUS;So;0;ON;;;;;N;;;;; +1F67D;VERY HEAVY REVERSE SOLIDUS;So;0;ON;;;;;N;;;;; +1F67E;CHECKER BOARD;So;0;ON;;;;;N;;;;; +1F67F;REVERSE CHECKER BOARD;So;0;ON;;;;;N;;;;; +1F680;ROCKET;So;0;ON;;;;;N;;;;; +1F681;HELICOPTER;So;0;ON;;;;;N;;;;; +1F682;STEAM LOCOMOTIVE;So;0;ON;;;;;N;;;;; +1F683;RAILWAY CAR;So;0;ON;;;;;N;;;;; +1F684;HIGH-SPEED TRAIN;So;0;ON;;;;;N;;;;; +1F685;HIGH-SPEED TRAIN WITH BULLET NOSE;So;0;ON;;;;;N;;;;; +1F686;TRAIN;So;0;ON;;;;;N;;;;; +1F687;METRO;So;0;ON;;;;;N;;;;; +1F688;LIGHT RAIL;So;0;ON;;;;;N;;;;; +1F689;STATION;So;0;ON;;;;;N;;;;; +1F68A;TRAM;So;0;ON;;;;;N;;;;; +1F68B;TRAM CAR;So;0;ON;;;;;N;;;;; +1F68C;BUS;So;0;ON;;;;;N;;;;; +1F68D;ONCOMING BUS;So;0;ON;;;;;N;;;;; +1F68E;TROLLEYBUS;So;0;ON;;;;;N;;;;; +1F68F;BUS STOP;So;0;ON;;;;;N;;;;; +1F690;MINIBUS;So;0;ON;;;;;N;;;;; +1F691;AMBULANCE;So;0;ON;;;;;N;;;;; +1F692;FIRE ENGINE;So;0;ON;;;;;N;;;;; +1F693;POLICE CAR;So;0;ON;;;;;N;;;;; +1F694;ONCOMING POLICE CAR;So;0;ON;;;;;N;;;;; +1F695;TAXI;So;0;ON;;;;;N;;;;; +1F696;ONCOMING TAXI;So;0;ON;;;;;N;;;;; +1F697;AUTOMOBILE;So;0;ON;;;;;N;;;;; +1F698;ONCOMING AUTOMOBILE;So;0;ON;;;;;N;;;;; +1F699;RECREATIONAL VEHICLE;So;0;ON;;;;;N;;;;; +1F69A;DELIVERY TRUCK;So;0;ON;;;;;N;;;;; +1F69B;ARTICULATED LORRY;So;0;ON;;;;;N;;;;; +1F69C;TRACTOR;So;0;ON;;;;;N;;;;; +1F69D;MONORAIL;So;0;ON;;;;;N;;;;; +1F69E;MOUNTAIN RAILWAY;So;0;ON;;;;;N;;;;; +1F69F;SUSPENSION RAILWAY;So;0;ON;;;;;N;;;;; +1F6A0;MOUNTAIN CABLEWAY;So;0;ON;;;;;N;;;;; +1F6A1;AERIAL TRAMWAY;So;0;ON;;;;;N;;;;; +1F6A2;SHIP;So;0;ON;;;;;N;;;;; +1F6A3;ROWBOAT;So;0;ON;;;;;N;;;;; +1F6A4;SPEEDBOAT;So;0;ON;;;;;N;;;;; +1F6A5;HORIZONTAL TRAFFIC LIGHT;So;0;ON;;;;;N;;;;; +1F6A6;VERTICAL TRAFFIC LIGHT;So;0;ON;;;;;N;;;;; +1F6A7;CONSTRUCTION SIGN;So;0;ON;;;;;N;;;;; +1F6A8;POLICE CARS REVOLVING LIGHT;So;0;ON;;;;;N;;;;; +1F6A9;TRIANGULAR FLAG ON POST;So;0;ON;;;;;N;;;;; +1F6AA;DOOR;So;0;ON;;;;;N;;;;; +1F6AB;NO ENTRY SIGN;So;0;ON;;;;;N;;;;; +1F6AC;SMOKING SYMBOL;So;0;ON;;;;;N;;;;; +1F6AD;NO SMOKING SYMBOL;So;0;ON;;;;;N;;;;; +1F6AE;PUT LITTER IN ITS PLACE SYMBOL;So;0;ON;;;;;N;;;;; +1F6AF;DO NOT LITTER SYMBOL;So;0;ON;;;;;N;;;;; +1F6B0;POTABLE WATER SYMBOL;So;0;ON;;;;;N;;;;; +1F6B1;NON-POTABLE WATER SYMBOL;So;0;ON;;;;;N;;;;; +1F6B2;BICYCLE;So;0;ON;;;;;N;;;;; +1F6B3;NO BICYCLES;So;0;ON;;;;;N;;;;; +1F6B4;BICYCLIST;So;0;ON;;;;;N;;;;; +1F6B5;MOUNTAIN BICYCLIST;So;0;ON;;;;;N;;;;; +1F6B6;PEDESTRIAN;So;0;ON;;;;;N;;;;; +1F6B7;NO PEDESTRIANS;So;0;ON;;;;;N;;;;; +1F6B8;CHILDREN CROSSING;So;0;ON;;;;;N;;;;; +1F6B9;MENS SYMBOL;So;0;ON;;;;;N;;;;; +1F6BA;WOMENS SYMBOL;So;0;ON;;;;;N;;;;; +1F6BB;RESTROOM;So;0;ON;;;;;N;;;;; +1F6BC;BABY SYMBOL;So;0;ON;;;;;N;;;;; +1F6BD;TOILET;So;0;ON;;;;;N;;;;; +1F6BE;WATER CLOSET;So;0;ON;;;;;N;;;;; +1F6BF;SHOWER;So;0;ON;;;;;N;;;;; +1F6C0;BATH;So;0;ON;;;;;N;;;;; +1F6C1;BATHTUB;So;0;ON;;;;;N;;;;; +1F6C2;PASSPORT CONTROL;So;0;ON;;;;;N;;;;; +1F6C3;CUSTOMS;So;0;ON;;;;;N;;;;; +1F6C4;BAGGAGE CLAIM;So;0;ON;;;;;N;;;;; +1F6C5;LEFT LUGGAGE;So;0;ON;;;;;N;;;;; +1F6C6;TRIANGLE WITH ROUNDED CORNERS;So;0;ON;;;;;N;;;;; +1F6C7;PROHIBITED SIGN;So;0;ON;;;;;N;;;;; +1F6C8;CIRCLED INFORMATION SOURCE;So;0;ON;;;;;N;;;;; +1F6C9;BOYS SYMBOL;So;0;ON;;;;;N;;;;; +1F6CA;GIRLS SYMBOL;So;0;ON;;;;;N;;;;; +1F6CB;COUCH AND LAMP;So;0;ON;;;;;N;;;;; +1F6CC;SLEEPING ACCOMMODATION;So;0;ON;;;;;N;;;;; +1F6CD;SHOPPING BAGS;So;0;ON;;;;;N;;;;; +1F6CE;BELLHOP BELL;So;0;ON;;;;;N;;;;; +1F6CF;BED;So;0;ON;;;;;N;;;;; +1F6D0;PLACE OF WORSHIP;So;0;ON;;;;;N;;;;; +1F6D1;OCTAGONAL SIGN;So;0;ON;;;;;N;;;;; +1F6D2;SHOPPING TROLLEY;So;0;ON;;;;;N;;;;; +1F6D3;STUPA;So;0;ON;;;;;N;;;;; +1F6D4;PAGODA;So;0;ON;;;;;N;;;;; +1F6E0;HAMMER AND WRENCH;So;0;ON;;;;;N;;;;; +1F6E1;SHIELD;So;0;ON;;;;;N;;;;; +1F6E2;OIL DRUM;So;0;ON;;;;;N;;;;; +1F6E3;MOTORWAY;So;0;ON;;;;;N;;;;; +1F6E4;RAILWAY TRACK;So;0;ON;;;;;N;;;;; +1F6E5;MOTOR BOAT;So;0;ON;;;;;N;;;;; +1F6E6;UP-POINTING MILITARY AIRPLANE;So;0;ON;;;;;N;;;;; +1F6E7;UP-POINTING AIRPLANE;So;0;ON;;;;;N;;;;; +1F6E8;UP-POINTING SMALL AIRPLANE;So;0;ON;;;;;N;;;;; +1F6E9;SMALL AIRPLANE;So;0;ON;;;;;N;;;;; +1F6EA;NORTHEAST-POINTING AIRPLANE;So;0;ON;;;;;N;;;;; +1F6EB;AIRPLANE DEPARTURE;So;0;ON;;;;;N;;;;; +1F6EC;AIRPLANE ARRIVING;So;0;ON;;;;;N;;;;; +1F6F0;SATELLITE;So;0;ON;;;;;N;;;;; +1F6F1;ONCOMING FIRE ENGINE;So;0;ON;;;;;N;;;;; +1F6F2;DIESEL LOCOMOTIVE;So;0;ON;;;;;N;;;;; +1F6F3;PASSENGER SHIP;So;0;ON;;;;;N;;;;; +1F6F4;SCOOTER;So;0;ON;;;;;N;;;;; +1F6F5;MOTOR SCOOTER;So;0;ON;;;;;N;;;;; +1F6F6;CANOE;So;0;ON;;;;;N;;;;; +1F6F7;SLED;So;0;ON;;;;;N;;;;; +1F6F8;FLYING SAUCER;So;0;ON;;;;;N;;;;; +1F700;ALCHEMICAL SYMBOL FOR QUINTESSENCE;So;0;ON;;;;;N;;;;; +1F701;ALCHEMICAL SYMBOL FOR AIR;So;0;ON;;;;;N;;;;; +1F702;ALCHEMICAL SYMBOL FOR FIRE;So;0;ON;;;;;N;;;;; +1F703;ALCHEMICAL SYMBOL FOR EARTH;So;0;ON;;;;;N;;;;; +1F704;ALCHEMICAL SYMBOL FOR WATER;So;0;ON;;;;;N;;;;; +1F705;ALCHEMICAL SYMBOL FOR AQUAFORTIS;So;0;ON;;;;;N;;;;; +1F706;ALCHEMICAL SYMBOL FOR AQUA REGIA;So;0;ON;;;;;N;;;;; +1F707;ALCHEMICAL SYMBOL FOR AQUA REGIA-2;So;0;ON;;;;;N;;;;; +1F708;ALCHEMICAL SYMBOL FOR AQUA VITAE;So;0;ON;;;;;N;;;;; +1F709;ALCHEMICAL SYMBOL FOR AQUA VITAE-2;So;0;ON;;;;;N;;;;; +1F70A;ALCHEMICAL SYMBOL FOR VINEGAR;So;0;ON;;;;;N;;;;; +1F70B;ALCHEMICAL SYMBOL FOR VINEGAR-2;So;0;ON;;;;;N;;;;; +1F70C;ALCHEMICAL SYMBOL FOR VINEGAR-3;So;0;ON;;;;;N;;;;; +1F70D;ALCHEMICAL SYMBOL FOR SULFUR;So;0;ON;;;;;N;;;;; +1F70E;ALCHEMICAL SYMBOL FOR PHILOSOPHERS SULFUR;So;0;ON;;;;;N;;;;; +1F70F;ALCHEMICAL SYMBOL FOR BLACK SULFUR;So;0;ON;;;;;N;;;;; +1F710;ALCHEMICAL SYMBOL FOR MERCURY SUBLIMATE;So;0;ON;;;;;N;;;;; +1F711;ALCHEMICAL SYMBOL FOR MERCURY SUBLIMATE-2;So;0;ON;;;;;N;;;;; +1F712;ALCHEMICAL SYMBOL FOR MERCURY SUBLIMATE-3;So;0;ON;;;;;N;;;;; +1F713;ALCHEMICAL SYMBOL FOR CINNABAR;So;0;ON;;;;;N;;;;; +1F714;ALCHEMICAL SYMBOL FOR SALT;So;0;ON;;;;;N;;;;; +1F715;ALCHEMICAL SYMBOL FOR NITRE;So;0;ON;;;;;N;;;;; +1F716;ALCHEMICAL SYMBOL FOR VITRIOL;So;0;ON;;;;;N;;;;; +1F717;ALCHEMICAL SYMBOL FOR VITRIOL-2;So;0;ON;;;;;N;;;;; +1F718;ALCHEMICAL SYMBOL FOR ROCK SALT;So;0;ON;;;;;N;;;;; +1F719;ALCHEMICAL SYMBOL FOR ROCK SALT-2;So;0;ON;;;;;N;;;;; +1F71A;ALCHEMICAL SYMBOL FOR GOLD;So;0;ON;;;;;N;;;;; +1F71B;ALCHEMICAL SYMBOL FOR SILVER;So;0;ON;;;;;N;;;;; +1F71C;ALCHEMICAL SYMBOL FOR IRON ORE;So;0;ON;;;;;N;;;;; +1F71D;ALCHEMICAL SYMBOL FOR IRON ORE-2;So;0;ON;;;;;N;;;;; +1F71E;ALCHEMICAL SYMBOL FOR CROCUS OF IRON;So;0;ON;;;;;N;;;;; +1F71F;ALCHEMICAL SYMBOL FOR REGULUS OF IRON;So;0;ON;;;;;N;;;;; +1F720;ALCHEMICAL SYMBOL FOR COPPER ORE;So;0;ON;;;;;N;;;;; +1F721;ALCHEMICAL SYMBOL FOR IRON-COPPER ORE;So;0;ON;;;;;N;;;;; +1F722;ALCHEMICAL SYMBOL FOR SUBLIMATE OF COPPER;So;0;ON;;;;;N;;;;; +1F723;ALCHEMICAL SYMBOL FOR CROCUS OF COPPER;So;0;ON;;;;;N;;;;; +1F724;ALCHEMICAL SYMBOL FOR CROCUS OF COPPER-2;So;0;ON;;;;;N;;;;; +1F725;ALCHEMICAL SYMBOL FOR COPPER ANTIMONIATE;So;0;ON;;;;;N;;;;; +1F726;ALCHEMICAL SYMBOL FOR SALT OF COPPER ANTIMONIATE;So;0;ON;;;;;N;;;;; +1F727;ALCHEMICAL SYMBOL FOR SUBLIMATE OF SALT OF COPPER;So;0;ON;;;;;N;;;;; +1F728;ALCHEMICAL SYMBOL FOR VERDIGRIS;So;0;ON;;;;;N;;;;; +1F729;ALCHEMICAL SYMBOL FOR TIN ORE;So;0;ON;;;;;N;;;;; +1F72A;ALCHEMICAL SYMBOL FOR LEAD ORE;So;0;ON;;;;;N;;;;; +1F72B;ALCHEMICAL SYMBOL FOR ANTIMONY ORE;So;0;ON;;;;;N;;;;; +1F72C;ALCHEMICAL SYMBOL FOR SUBLIMATE OF ANTIMONY;So;0;ON;;;;;N;;;;; +1F72D;ALCHEMICAL SYMBOL FOR SALT OF ANTIMONY;So;0;ON;;;;;N;;;;; +1F72E;ALCHEMICAL SYMBOL FOR SUBLIMATE OF SALT OF ANTIMONY;So;0;ON;;;;;N;;;;; +1F72F;ALCHEMICAL SYMBOL FOR VINEGAR OF ANTIMONY;So;0;ON;;;;;N;;;;; +1F730;ALCHEMICAL SYMBOL FOR REGULUS OF ANTIMONY;So;0;ON;;;;;N;;;;; +1F731;ALCHEMICAL SYMBOL FOR REGULUS OF ANTIMONY-2;So;0;ON;;;;;N;;;;; +1F732;ALCHEMICAL SYMBOL FOR REGULUS;So;0;ON;;;;;N;;;;; +1F733;ALCHEMICAL SYMBOL FOR REGULUS-2;So;0;ON;;;;;N;;;;; +1F734;ALCHEMICAL SYMBOL FOR REGULUS-3;So;0;ON;;;;;N;;;;; +1F735;ALCHEMICAL SYMBOL FOR REGULUS-4;So;0;ON;;;;;N;;;;; +1F736;ALCHEMICAL SYMBOL FOR ALKALI;So;0;ON;;;;;N;;;;; +1F737;ALCHEMICAL SYMBOL FOR ALKALI-2;So;0;ON;;;;;N;;;;; +1F738;ALCHEMICAL SYMBOL FOR MARCASITE;So;0;ON;;;;;N;;;;; +1F739;ALCHEMICAL SYMBOL FOR SAL-AMMONIAC;So;0;ON;;;;;N;;;;; +1F73A;ALCHEMICAL SYMBOL FOR ARSENIC;So;0;ON;;;;;N;;;;; +1F73B;ALCHEMICAL SYMBOL FOR REALGAR;So;0;ON;;;;;N;;;;; +1F73C;ALCHEMICAL SYMBOL FOR REALGAR-2;So;0;ON;;;;;N;;;;; +1F73D;ALCHEMICAL SYMBOL FOR AURIPIGMENT;So;0;ON;;;;;N;;;;; +1F73E;ALCHEMICAL SYMBOL FOR BISMUTH ORE;So;0;ON;;;;;N;;;;; +1F73F;ALCHEMICAL SYMBOL FOR TARTAR;So;0;ON;;;;;N;;;;; +1F740;ALCHEMICAL SYMBOL FOR TARTAR-2;So;0;ON;;;;;N;;;;; +1F741;ALCHEMICAL SYMBOL FOR QUICK LIME;So;0;ON;;;;;N;;;;; +1F742;ALCHEMICAL SYMBOL FOR BORAX;So;0;ON;;;;;N;;;;; +1F743;ALCHEMICAL SYMBOL FOR BORAX-2;So;0;ON;;;;;N;;;;; +1F744;ALCHEMICAL SYMBOL FOR BORAX-3;So;0;ON;;;;;N;;;;; +1F745;ALCHEMICAL SYMBOL FOR ALUM;So;0;ON;;;;;N;;;;; +1F746;ALCHEMICAL SYMBOL FOR OIL;So;0;ON;;;;;N;;;;; +1F747;ALCHEMICAL SYMBOL FOR SPIRIT;So;0;ON;;;;;N;;;;; +1F748;ALCHEMICAL SYMBOL FOR TINCTURE;So;0;ON;;;;;N;;;;; +1F749;ALCHEMICAL SYMBOL FOR GUM;So;0;ON;;;;;N;;;;; +1F74A;ALCHEMICAL SYMBOL FOR WAX;So;0;ON;;;;;N;;;;; +1F74B;ALCHEMICAL SYMBOL FOR POWDER;So;0;ON;;;;;N;;;;; +1F74C;ALCHEMICAL SYMBOL FOR CALX;So;0;ON;;;;;N;;;;; +1F74D;ALCHEMICAL SYMBOL FOR TUTTY;So;0;ON;;;;;N;;;;; +1F74E;ALCHEMICAL SYMBOL FOR CAPUT MORTUUM;So;0;ON;;;;;N;;;;; +1F74F;ALCHEMICAL SYMBOL FOR SCEPTER OF JOVE;So;0;ON;;;;;N;;;;; +1F750;ALCHEMICAL SYMBOL FOR CADUCEUS;So;0;ON;;;;;N;;;;; +1F751;ALCHEMICAL SYMBOL FOR TRIDENT;So;0;ON;;;;;N;;;;; +1F752;ALCHEMICAL SYMBOL FOR STARRED TRIDENT;So;0;ON;;;;;N;;;;; +1F753;ALCHEMICAL SYMBOL FOR LODESTONE;So;0;ON;;;;;N;;;;; +1F754;ALCHEMICAL SYMBOL FOR SOAP;So;0;ON;;;;;N;;;;; +1F755;ALCHEMICAL SYMBOL FOR URINE;So;0;ON;;;;;N;;;;; +1F756;ALCHEMICAL SYMBOL FOR HORSE DUNG;So;0;ON;;;;;N;;;;; +1F757;ALCHEMICAL SYMBOL FOR ASHES;So;0;ON;;;;;N;;;;; +1F758;ALCHEMICAL SYMBOL FOR POT ASHES;So;0;ON;;;;;N;;;;; +1F759;ALCHEMICAL SYMBOL FOR BRICK;So;0;ON;;;;;N;;;;; +1F75A;ALCHEMICAL SYMBOL FOR POWDERED BRICK;So;0;ON;;;;;N;;;;; +1F75B;ALCHEMICAL SYMBOL FOR AMALGAM;So;0;ON;;;;;N;;;;; +1F75C;ALCHEMICAL SYMBOL FOR STRATUM SUPER STRATUM;So;0;ON;;;;;N;;;;; +1F75D;ALCHEMICAL SYMBOL FOR STRATUM SUPER STRATUM-2;So;0;ON;;;;;N;;;;; +1F75E;ALCHEMICAL SYMBOL FOR SUBLIMATION;So;0;ON;;;;;N;;;;; +1F75F;ALCHEMICAL SYMBOL FOR PRECIPITATE;So;0;ON;;;;;N;;;;; +1F760;ALCHEMICAL SYMBOL FOR DISTILL;So;0;ON;;;;;N;;;;; +1F761;ALCHEMICAL SYMBOL FOR DISSOLVE;So;0;ON;;;;;N;;;;; +1F762;ALCHEMICAL SYMBOL FOR DISSOLVE-2;So;0;ON;;;;;N;;;;; +1F763;ALCHEMICAL SYMBOL FOR PURIFY;So;0;ON;;;;;N;;;;; +1F764;ALCHEMICAL SYMBOL FOR PUTREFACTION;So;0;ON;;;;;N;;;;; +1F765;ALCHEMICAL SYMBOL FOR CRUCIBLE;So;0;ON;;;;;N;;;;; +1F766;ALCHEMICAL SYMBOL FOR CRUCIBLE-2;So;0;ON;;;;;N;;;;; +1F767;ALCHEMICAL SYMBOL FOR CRUCIBLE-3;So;0;ON;;;;;N;;;;; +1F768;ALCHEMICAL SYMBOL FOR CRUCIBLE-4;So;0;ON;;;;;N;;;;; +1F769;ALCHEMICAL SYMBOL FOR CRUCIBLE-5;So;0;ON;;;;;N;;;;; +1F76A;ALCHEMICAL SYMBOL FOR ALEMBIC;So;0;ON;;;;;N;;;;; +1F76B;ALCHEMICAL SYMBOL FOR BATH OF MARY;So;0;ON;;;;;N;;;;; +1F76C;ALCHEMICAL SYMBOL FOR BATH OF VAPOURS;So;0;ON;;;;;N;;;;; +1F76D;ALCHEMICAL SYMBOL FOR RETORT;So;0;ON;;;;;N;;;;; +1F76E;ALCHEMICAL SYMBOL FOR HOUR;So;0;ON;;;;;N;;;;; +1F76F;ALCHEMICAL SYMBOL FOR NIGHT;So;0;ON;;;;;N;;;;; +1F770;ALCHEMICAL SYMBOL FOR DAY-NIGHT;So;0;ON;;;;;N;;;;; +1F771;ALCHEMICAL SYMBOL FOR MONTH;So;0;ON;;;;;N;;;;; +1F772;ALCHEMICAL SYMBOL FOR HALF DRAM;So;0;ON;;;;;N;;;;; +1F773;ALCHEMICAL SYMBOL FOR HALF OUNCE;So;0;ON;;;;;N;;;;; +1F780;BLACK LEFT-POINTING ISOSCELES RIGHT TRIANGLE;So;0;ON;;;;;N;;;;; +1F781;BLACK UP-POINTING ISOSCELES RIGHT TRIANGLE;So;0;ON;;;;;N;;;;; +1F782;BLACK RIGHT-POINTING ISOSCELES RIGHT TRIANGLE;So;0;ON;;;;;N;;;;; +1F783;BLACK DOWN-POINTING ISOSCELES RIGHT TRIANGLE;So;0;ON;;;;;N;;;;; +1F784;BLACK SLIGHTLY SMALL CIRCLE;So;0;ON;;;;;N;;;;; +1F785;MEDIUM BOLD WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F786;BOLD WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F787;HEAVY WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F788;VERY HEAVY WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F789;EXTREMELY HEAVY WHITE CIRCLE;So;0;ON;;;;;N;;;;; +1F78A;WHITE CIRCLE CONTAINING BLACK SMALL CIRCLE;So;0;ON;;;;;N;;;;; +1F78B;ROUND TARGET;So;0;ON;;;;;N;;;;; +1F78C;BLACK TINY SQUARE;So;0;ON;;;;;N;;;;; +1F78D;BLACK SLIGHTLY SMALL SQUARE;So;0;ON;;;;;N;;;;; +1F78E;LIGHT WHITE SQUARE;So;0;ON;;;;;N;;;;; +1F78F;MEDIUM WHITE SQUARE;So;0;ON;;;;;N;;;;; +1F790;BOLD WHITE SQUARE;So;0;ON;;;;;N;;;;; +1F791;HEAVY WHITE SQUARE;So;0;ON;;;;;N;;;;; +1F792;VERY HEAVY WHITE SQUARE;So;0;ON;;;;;N;;;;; +1F793;EXTREMELY HEAVY WHITE SQUARE;So;0;ON;;;;;N;;;;; +1F794;WHITE SQUARE CONTAINING BLACK VERY SMALL SQUARE;So;0;ON;;;;;N;;;;; +1F795;WHITE SQUARE CONTAINING BLACK MEDIUM SQUARE;So;0;ON;;;;;N;;;;; +1F796;SQUARE TARGET;So;0;ON;;;;;N;;;;; +1F797;BLACK TINY DIAMOND;So;0;ON;;;;;N;;;;; +1F798;BLACK VERY SMALL DIAMOND;So;0;ON;;;;;N;;;;; +1F799;BLACK MEDIUM SMALL DIAMOND;So;0;ON;;;;;N;;;;; +1F79A;WHITE DIAMOND CONTAINING BLACK VERY SMALL DIAMOND;So;0;ON;;;;;N;;;;; +1F79B;WHITE DIAMOND CONTAINING BLACK MEDIUM DIAMOND;So;0;ON;;;;;N;;;;; +1F79C;DIAMOND TARGET;So;0;ON;;;;;N;;;;; +1F79D;BLACK TINY LOZENGE;So;0;ON;;;;;N;;;;; +1F79E;BLACK VERY SMALL LOZENGE;So;0;ON;;;;;N;;;;; +1F79F;BLACK MEDIUM SMALL LOZENGE;So;0;ON;;;;;N;;;;; +1F7A0;WHITE LOZENGE CONTAINING BLACK SMALL LOZENGE;So;0;ON;;;;;N;;;;; +1F7A1;THIN GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A2;LIGHT GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A3;MEDIUM GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A4;BOLD GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A5;VERY BOLD GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A6;VERY HEAVY GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A7;EXTREMELY HEAVY GREEK CROSS;So;0;ON;;;;;N;;;;; +1F7A8;THIN SALTIRE;So;0;ON;;;;;N;;;;; +1F7A9;LIGHT SALTIRE;So;0;ON;;;;;N;;;;; +1F7AA;MEDIUM SALTIRE;So;0;ON;;;;;N;;;;; +1F7AB;BOLD SALTIRE;So;0;ON;;;;;N;;;;; +1F7AC;HEAVY SALTIRE;So;0;ON;;;;;N;;;;; +1F7AD;VERY HEAVY SALTIRE;So;0;ON;;;;;N;;;;; +1F7AE;EXTREMELY HEAVY SALTIRE;So;0;ON;;;;;N;;;;; +1F7AF;LIGHT FIVE SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B0;MEDIUM FIVE SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B1;BOLD FIVE SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B2;HEAVY FIVE SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B3;VERY HEAVY FIVE SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B4;EXTREMELY HEAVY FIVE SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B5;LIGHT SIX SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B6;MEDIUM SIX SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B7;BOLD SIX SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B8;HEAVY SIX SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7B9;VERY HEAVY SIX SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7BA;EXTREMELY HEAVY SIX SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7BB;LIGHT EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7BC;MEDIUM EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7BD;BOLD EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7BE;HEAVY EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7BF;VERY HEAVY EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;; +1F7C0;LIGHT THREE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7C1;MEDIUM THREE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7C2;THREE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7C3;MEDIUM THREE POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +1F7C4;LIGHT FOUR POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7C5;MEDIUM FOUR POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7C6;FOUR POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7C7;MEDIUM FOUR POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +1F7C8;REVERSE LIGHT FOUR POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +1F7C9;LIGHT FIVE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7CA;HEAVY FIVE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7CB;MEDIUM SIX POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7CC;HEAVY SIX POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7CD;SIX POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +1F7CE;MEDIUM EIGHT POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7CF;HEAVY EIGHT POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7D0;VERY HEAVY EIGHT POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7D1;HEAVY EIGHT POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +1F7D2;LIGHT TWELVE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7D3;HEAVY TWELVE POINTED BLACK STAR;So;0;ON;;;;;N;;;;; +1F7D4;HEAVY TWELVE POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;; +1F800;LEFTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F801;UPWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F802;RIGHTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F803;DOWNWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F804;LEFTWARDS ARROW WITH MEDIUM TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F805;UPWARDS ARROW WITH MEDIUM TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F806;RIGHTWARDS ARROW WITH MEDIUM TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F807;DOWNWARDS ARROW WITH MEDIUM TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F808;LEFTWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F809;UPWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F80A;RIGHTWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F80B;DOWNWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F810;LEFTWARDS ARROW WITH SMALL EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F811;UPWARDS ARROW WITH SMALL EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F812;RIGHTWARDS ARROW WITH SMALL EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F813;DOWNWARDS ARROW WITH SMALL EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F814;LEFTWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F815;UPWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F816;RIGHTWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F817;DOWNWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F818;HEAVY LEFTWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F819;HEAVY UPWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F81A;HEAVY RIGHTWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F81B;HEAVY DOWNWARDS ARROW WITH EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F81C;HEAVY LEFTWARDS ARROW WITH LARGE EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F81D;HEAVY UPWARDS ARROW WITH LARGE EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F81E;HEAVY RIGHTWARDS ARROW WITH LARGE EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F81F;HEAVY DOWNWARDS ARROW WITH LARGE EQUILATERAL ARROWHEAD;So;0;ON;;;;;N;;;;; +1F820;LEFTWARDS TRIANGLE-HEADED ARROW WITH NARROW SHAFT;So;0;ON;;;;;N;;;;; +1F821;UPWARDS TRIANGLE-HEADED ARROW WITH NARROW SHAFT;So;0;ON;;;;;N;;;;; +1F822;RIGHTWARDS TRIANGLE-HEADED ARROW WITH NARROW SHAFT;So;0;ON;;;;;N;;;;; +1F823;DOWNWARDS TRIANGLE-HEADED ARROW WITH NARROW SHAFT;So;0;ON;;;;;N;;;;; +1F824;LEFTWARDS TRIANGLE-HEADED ARROW WITH MEDIUM SHAFT;So;0;ON;;;;;N;;;;; +1F825;UPWARDS TRIANGLE-HEADED ARROW WITH MEDIUM SHAFT;So;0;ON;;;;;N;;;;; +1F826;RIGHTWARDS TRIANGLE-HEADED ARROW WITH MEDIUM SHAFT;So;0;ON;;;;;N;;;;; +1F827;DOWNWARDS TRIANGLE-HEADED ARROW WITH MEDIUM SHAFT;So;0;ON;;;;;N;;;;; +1F828;LEFTWARDS TRIANGLE-HEADED ARROW WITH BOLD SHAFT;So;0;ON;;;;;N;;;;; +1F829;UPWARDS TRIANGLE-HEADED ARROW WITH BOLD SHAFT;So;0;ON;;;;;N;;;;; +1F82A;RIGHTWARDS TRIANGLE-HEADED ARROW WITH BOLD SHAFT;So;0;ON;;;;;N;;;;; +1F82B;DOWNWARDS TRIANGLE-HEADED ARROW WITH BOLD SHAFT;So;0;ON;;;;;N;;;;; +1F82C;LEFTWARDS TRIANGLE-HEADED ARROW WITH HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F82D;UPWARDS TRIANGLE-HEADED ARROW WITH HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F82E;RIGHTWARDS TRIANGLE-HEADED ARROW WITH HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F82F;DOWNWARDS TRIANGLE-HEADED ARROW WITH HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F830;LEFTWARDS TRIANGLE-HEADED ARROW WITH VERY HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F831;UPWARDS TRIANGLE-HEADED ARROW WITH VERY HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F832;RIGHTWARDS TRIANGLE-HEADED ARROW WITH VERY HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F833;DOWNWARDS TRIANGLE-HEADED ARROW WITH VERY HEAVY SHAFT;So;0;ON;;;;;N;;;;; +1F834;LEFTWARDS FINGER-POST ARROW;So;0;ON;;;;;N;;;;; +1F835;UPWARDS FINGER-POST ARROW;So;0;ON;;;;;N;;;;; +1F836;RIGHTWARDS FINGER-POST ARROW;So;0;ON;;;;;N;;;;; +1F837;DOWNWARDS FINGER-POST ARROW;So;0;ON;;;;;N;;;;; +1F838;LEFTWARDS SQUARED ARROW;So;0;ON;;;;;N;;;;; +1F839;UPWARDS SQUARED ARROW;So;0;ON;;;;;N;;;;; +1F83A;RIGHTWARDS SQUARED ARROW;So;0;ON;;;;;N;;;;; +1F83B;DOWNWARDS SQUARED ARROW;So;0;ON;;;;;N;;;;; +1F83C;LEFTWARDS COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F83D;UPWARDS COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F83E;RIGHTWARDS COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F83F;DOWNWARDS COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F840;LEFTWARDS HEAVY COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F841;UPWARDS HEAVY COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F842;RIGHTWARDS HEAVY COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F843;DOWNWARDS HEAVY COMPRESSED ARROW;So;0;ON;;;;;N;;;;; +1F844;LEFTWARDS HEAVY ARROW;So;0;ON;;;;;N;;;;; +1F845;UPWARDS HEAVY ARROW;So;0;ON;;;;;N;;;;; +1F846;RIGHTWARDS HEAVY ARROW;So;0;ON;;;;;N;;;;; +1F847;DOWNWARDS HEAVY ARROW;So;0;ON;;;;;N;;;;; +1F850;LEFTWARDS SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F851;UPWARDS SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F852;RIGHTWARDS SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F853;DOWNWARDS SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F854;NORTH WEST SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F855;NORTH EAST SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F856;SOUTH EAST SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F857;SOUTH WEST SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F858;LEFT RIGHT SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F859;UP DOWN SANS-SERIF ARROW;So;0;ON;;;;;N;;;;; +1F860;WIDE-HEADED LEFTWARDS LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F861;WIDE-HEADED UPWARDS LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F862;WIDE-HEADED RIGHTWARDS LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F863;WIDE-HEADED DOWNWARDS LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F864;WIDE-HEADED NORTH WEST LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F865;WIDE-HEADED NORTH EAST LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F866;WIDE-HEADED SOUTH EAST LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F867;WIDE-HEADED SOUTH WEST LIGHT BARB ARROW;So;0;ON;;;;;N;;;;; +1F868;WIDE-HEADED LEFTWARDS BARB ARROW;So;0;ON;;;;;N;;;;; +1F869;WIDE-HEADED UPWARDS BARB ARROW;So;0;ON;;;;;N;;;;; +1F86A;WIDE-HEADED RIGHTWARDS BARB ARROW;So;0;ON;;;;;N;;;;; +1F86B;WIDE-HEADED DOWNWARDS BARB ARROW;So;0;ON;;;;;N;;;;; +1F86C;WIDE-HEADED NORTH WEST BARB ARROW;So;0;ON;;;;;N;;;;; +1F86D;WIDE-HEADED NORTH EAST BARB ARROW;So;0;ON;;;;;N;;;;; +1F86E;WIDE-HEADED SOUTH EAST BARB ARROW;So;0;ON;;;;;N;;;;; +1F86F;WIDE-HEADED SOUTH WEST BARB ARROW;So;0;ON;;;;;N;;;;; +1F870;WIDE-HEADED LEFTWARDS MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F871;WIDE-HEADED UPWARDS MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F872;WIDE-HEADED RIGHTWARDS MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F873;WIDE-HEADED DOWNWARDS MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F874;WIDE-HEADED NORTH WEST MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F875;WIDE-HEADED NORTH EAST MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F876;WIDE-HEADED SOUTH EAST MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F877;WIDE-HEADED SOUTH WEST MEDIUM BARB ARROW;So;0;ON;;;;;N;;;;; +1F878;WIDE-HEADED LEFTWARDS HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F879;WIDE-HEADED UPWARDS HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F87A;WIDE-HEADED RIGHTWARDS HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F87B;WIDE-HEADED DOWNWARDS HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F87C;WIDE-HEADED NORTH WEST HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F87D;WIDE-HEADED NORTH EAST HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F87E;WIDE-HEADED SOUTH EAST HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F87F;WIDE-HEADED SOUTH WEST HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F880;WIDE-HEADED LEFTWARDS VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F881;WIDE-HEADED UPWARDS VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F882;WIDE-HEADED RIGHTWARDS VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F883;WIDE-HEADED DOWNWARDS VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F884;WIDE-HEADED NORTH WEST VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F885;WIDE-HEADED NORTH EAST VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F886;WIDE-HEADED SOUTH EAST VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F887;WIDE-HEADED SOUTH WEST VERY HEAVY BARB ARROW;So;0;ON;;;;;N;;;;; +1F890;LEFTWARDS TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F891;UPWARDS TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F892;RIGHTWARDS TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F893;DOWNWARDS TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F894;LEFTWARDS WHITE ARROW WITHIN TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F895;UPWARDS WHITE ARROW WITHIN TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F896;RIGHTWARDS WHITE ARROW WITHIN TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F897;DOWNWARDS WHITE ARROW WITHIN TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;; +1F898;LEFTWARDS ARROW WITH NOTCHED TAIL;So;0;ON;;;;;N;;;;; +1F899;UPWARDS ARROW WITH NOTCHED TAIL;So;0;ON;;;;;N;;;;; +1F89A;RIGHTWARDS ARROW WITH NOTCHED TAIL;So;0;ON;;;;;N;;;;; +1F89B;DOWNWARDS ARROW WITH NOTCHED TAIL;So;0;ON;;;;;N;;;;; +1F89C;HEAVY ARROW SHAFT WIDTH ONE;So;0;ON;;;;;N;;;;; +1F89D;HEAVY ARROW SHAFT WIDTH TWO THIRDS;So;0;ON;;;;;N;;;;; +1F89E;HEAVY ARROW SHAFT WIDTH ONE HALF;So;0;ON;;;;;N;;;;; +1F89F;HEAVY ARROW SHAFT WIDTH ONE THIRD;So;0;ON;;;;;N;;;;; +1F8A0;LEFTWARDS BOTTOM-SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A1;RIGHTWARDS BOTTOM SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A2;LEFTWARDS TOP SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A3;RIGHTWARDS TOP SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A4;LEFTWARDS LEFT-SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A5;RIGHTWARDS RIGHT-SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A6;LEFTWARDS RIGHT-SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A7;RIGHTWARDS LEFT-SHADED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A8;LEFTWARDS BACK-TILTED SHADOWED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8A9;RIGHTWARDS BACK-TILTED SHADOWED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8AA;LEFTWARDS FRONT-TILTED SHADOWED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8AB;RIGHTWARDS FRONT-TILTED SHADOWED WHITE ARROW;So;0;ON;;;;;N;;;;; +1F8AC;WHITE ARROW SHAFT WIDTH ONE;So;0;ON;;;;;N;;;;; +1F8AD;WHITE ARROW SHAFT WIDTH TWO THIRDS;So;0;ON;;;;;N;;;;; +1F900;CIRCLED CROSS FORMEE WITH FOUR DOTS;So;0;ON;;;;;N;;;;; +1F901;CIRCLED CROSS FORMEE WITH TWO DOTS;So;0;ON;;;;;N;;;;; +1F902;CIRCLED CROSS FORMEE;So;0;ON;;;;;N;;;;; +1F903;LEFT HALF CIRCLE WITH FOUR DOTS;So;0;ON;;;;;N;;;;; +1F904;LEFT HALF CIRCLE WITH THREE DOTS;So;0;ON;;;;;N;;;;; +1F905;LEFT HALF CIRCLE WITH TWO DOTS;So;0;ON;;;;;N;;;;; +1F906;LEFT HALF CIRCLE WITH DOT;So;0;ON;;;;;N;;;;; +1F907;LEFT HALF CIRCLE;So;0;ON;;;;;N;;;;; +1F908;DOWNWARD FACING HOOK;So;0;ON;;;;;N;;;;; +1F909;DOWNWARD FACING NOTCHED HOOK;So;0;ON;;;;;N;;;;; +1F90A;DOWNWARD FACING HOOK WITH DOT;So;0;ON;;;;;N;;;;; +1F90B;DOWNWARD FACING NOTCHED HOOK WITH DOT;So;0;ON;;;;;N;;;;; +1F910;ZIPPER-MOUTH FACE;So;0;ON;;;;;N;;;;; +1F911;MONEY-MOUTH FACE;So;0;ON;;;;;N;;;;; +1F912;FACE WITH THERMOMETER;So;0;ON;;;;;N;;;;; +1F913;NERD FACE;So;0;ON;;;;;N;;;;; +1F914;THINKING FACE;So;0;ON;;;;;N;;;;; +1F915;FACE WITH HEAD-BANDAGE;So;0;ON;;;;;N;;;;; +1F916;ROBOT FACE;So;0;ON;;;;;N;;;;; +1F917;HUGGING FACE;So;0;ON;;;;;N;;;;; +1F918;SIGN OF THE HORNS;So;0;ON;;;;;N;;;;; +1F919;CALL ME HAND;So;0;ON;;;;;N;;;;; +1F91A;RAISED BACK OF HAND;So;0;ON;;;;;N;;;;; +1F91B;LEFT-FACING FIST;So;0;ON;;;;;N;;;;; +1F91C;RIGHT-FACING FIST;So;0;ON;;;;;N;;;;; +1F91D;HANDSHAKE;So;0;ON;;;;;N;;;;; +1F91E;HAND WITH INDEX AND MIDDLE FINGERS CROSSED;So;0;ON;;;;;N;;;;; +1F91F;I LOVE YOU HAND SIGN;So;0;ON;;;;;N;;;;; +1F920;FACE WITH COWBOY HAT;So;0;ON;;;;;N;;;;; +1F921;CLOWN FACE;So;0;ON;;;;;N;;;;; +1F922;NAUSEATED FACE;So;0;ON;;;;;N;;;;; +1F923;ROLLING ON THE FLOOR LAUGHING;So;0;ON;;;;;N;;;;; +1F924;DROOLING FACE;So;0;ON;;;;;N;;;;; +1F925;LYING FACE;So;0;ON;;;;;N;;;;; +1F926;FACE PALM;So;0;ON;;;;;N;;;;; +1F927;SNEEZING FACE;So;0;ON;;;;;N;;;;; +1F928;FACE WITH ONE EYEBROW RAISED;So;0;ON;;;;;N;;;;; +1F929;GRINNING FACE WITH STAR EYES;So;0;ON;;;;;N;;;;; +1F92A;GRINNING FACE WITH ONE LARGE AND ONE SMALL EYE;So;0;ON;;;;;N;;;;; +1F92B;FACE WITH FINGER COVERING CLOSED LIPS;So;0;ON;;;;;N;;;;; +1F92C;SERIOUS FACE WITH SYMBOLS COVERING MOUTH;So;0;ON;;;;;N;;;;; +1F92D;SMILING FACE WITH SMILING EYES AND HAND COVERING MOUTH;So;0;ON;;;;;N;;;;; +1F92E;FACE WITH OPEN MOUTH VOMITING;So;0;ON;;;;;N;;;;; +1F92F;SHOCKED FACE WITH EXPLODING HEAD;So;0;ON;;;;;N;;;;; +1F930;PREGNANT WOMAN;So;0;ON;;;;;N;;;;; +1F931;BREAST-FEEDING;So;0;ON;;;;;N;;;;; +1F932;PALMS UP TOGETHER;So;0;ON;;;;;N;;;;; +1F933;SELFIE;So;0;ON;;;;;N;;;;; +1F934;PRINCE;So;0;ON;;;;;N;;;;; +1F935;MAN IN TUXEDO;So;0;ON;;;;;N;;;;; +1F936;MOTHER CHRISTMAS;So;0;ON;;;;;N;;;;; +1F937;SHRUG;So;0;ON;;;;;N;;;;; +1F938;PERSON DOING CARTWHEEL;So;0;ON;;;;;N;;;;; +1F939;JUGGLING;So;0;ON;;;;;N;;;;; +1F93A;FENCER;So;0;ON;;;;;N;;;;; +1F93B;MODERN PENTATHLON;So;0;ON;;;;;N;;;;; +1F93C;WRESTLERS;So;0;ON;;;;;N;;;;; +1F93D;WATER POLO;So;0;ON;;;;;N;;;;; +1F93E;HANDBALL;So;0;ON;;;;;N;;;;; +1F940;WILTED FLOWER;So;0;ON;;;;;N;;;;; +1F941;DRUM WITH DRUMSTICKS;So;0;ON;;;;;N;;;;; +1F942;CLINKING GLASSES;So;0;ON;;;;;N;;;;; +1F943;TUMBLER GLASS;So;0;ON;;;;;N;;;;; +1F944;SPOON;So;0;ON;;;;;N;;;;; +1F945;GOAL NET;So;0;ON;;;;;N;;;;; +1F946;RIFLE;So;0;ON;;;;;N;;;;; +1F947;FIRST PLACE MEDAL;So;0;ON;;;;;N;;;;; +1F948;SECOND PLACE MEDAL;So;0;ON;;;;;N;;;;; +1F949;THIRD PLACE MEDAL;So;0;ON;;;;;N;;;;; +1F94A;BOXING GLOVE;So;0;ON;;;;;N;;;;; +1F94B;MARTIAL ARTS UNIFORM;So;0;ON;;;;;N;;;;; +1F94C;CURLING STONE;So;0;ON;;;;;N;;;;; +1F950;CROISSANT;So;0;ON;;;;;N;;;;; +1F951;AVOCADO;So;0;ON;;;;;N;;;;; +1F952;CUCUMBER;So;0;ON;;;;;N;;;;; +1F953;BACON;So;0;ON;;;;;N;;;;; +1F954;POTATO;So;0;ON;;;;;N;;;;; +1F955;CARROT;So;0;ON;;;;;N;;;;; +1F956;BAGUETTE BREAD;So;0;ON;;;;;N;;;;; +1F957;GREEN SALAD;So;0;ON;;;;;N;;;;; +1F958;SHALLOW PAN OF FOOD;So;0;ON;;;;;N;;;;; +1F959;STUFFED FLATBREAD;So;0;ON;;;;;N;;;;; +1F95A;EGG;So;0;ON;;;;;N;;;;; +1F95B;GLASS OF MILK;So;0;ON;;;;;N;;;;; +1F95C;PEANUTS;So;0;ON;;;;;N;;;;; +1F95D;KIWIFRUIT;So;0;ON;;;;;N;;;;; +1F95E;PANCAKES;So;0;ON;;;;;N;;;;; +1F95F;DUMPLING;So;0;ON;;;;;N;;;;; +1F960;FORTUNE COOKIE;So;0;ON;;;;;N;;;;; +1F961;TAKEOUT BOX;So;0;ON;;;;;N;;;;; +1F962;CHOPSTICKS;So;0;ON;;;;;N;;;;; +1F963;BOWL WITH SPOON;So;0;ON;;;;;N;;;;; +1F964;CUP WITH STRAW;So;0;ON;;;;;N;;;;; +1F965;COCONUT;So;0;ON;;;;;N;;;;; +1F966;BROCCOLI;So;0;ON;;;;;N;;;;; +1F967;PIE;So;0;ON;;;;;N;;;;; +1F968;PRETZEL;So;0;ON;;;;;N;;;;; +1F969;CUT OF MEAT;So;0;ON;;;;;N;;;;; +1F96A;SANDWICH;So;0;ON;;;;;N;;;;; +1F96B;CANNED FOOD;So;0;ON;;;;;N;;;;; +1F980;CRAB;So;0;ON;;;;;N;;;;; +1F981;LION FACE;So;0;ON;;;;;N;;;;; +1F982;SCORPION;So;0;ON;;;;;N;;;;; +1F983;TURKEY;So;0;ON;;;;;N;;;;; +1F984;UNICORN FACE;So;0;ON;;;;;N;;;;; +1F985;EAGLE;So;0;ON;;;;;N;;;;; +1F986;DUCK;So;0;ON;;;;;N;;;;; +1F987;BAT;So;0;ON;;;;;N;;;;; +1F988;SHARK;So;0;ON;;;;;N;;;;; +1F989;OWL;So;0;ON;;;;;N;;;;; +1F98A;FOX FACE;So;0;ON;;;;;N;;;;; +1F98B;BUTTERFLY;So;0;ON;;;;;N;;;;; +1F98C;DEER;So;0;ON;;;;;N;;;;; +1F98D;GORILLA;So;0;ON;;;;;N;;;;; +1F98E;LIZARD;So;0;ON;;;;;N;;;;; +1F98F;RHINOCEROS;So;0;ON;;;;;N;;;;; +1F990;SHRIMP;So;0;ON;;;;;N;;;;; +1F991;SQUID;So;0;ON;;;;;N;;;;; +1F992;GIRAFFE FACE;So;0;ON;;;;;N;;;;; +1F993;ZEBRA FACE;So;0;ON;;;;;N;;;;; +1F994;HEDGEHOG;So;0;ON;;;;;N;;;;; +1F995;SAUROPOD;So;0;ON;;;;;N;;;;; +1F996;T-REX;So;0;ON;;;;;N;;;;; +1F997;CRICKET;So;0;ON;;;;;N;;;;; +1F9C0;CHEESE WEDGE;So;0;ON;;;;;N;;;;; +1F9D0;FACE WITH MONOCLE;So;0;ON;;;;;N;;;;; +1F9D1;ADULT;So;0;ON;;;;;N;;;;; +1F9D2;CHILD;So;0;ON;;;;;N;;;;; +1F9D3;OLDER ADULT;So;0;ON;;;;;N;;;;; +1F9D4;BEARDED PERSON;So;0;ON;;;;;N;;;;; +1F9D5;PERSON WITH HEADSCARF;So;0;ON;;;;;N;;;;; +1F9D6;PERSON IN STEAMY ROOM;So;0;ON;;;;;N;;;;; +1F9D7;PERSON CLIMBING;So;0;ON;;;;;N;;;;; +1F9D8;PERSON IN LOTUS POSITION;So;0;ON;;;;;N;;;;; +1F9D9;MAGE;So;0;ON;;;;;N;;;;; +1F9DA;FAIRY;So;0;ON;;;;;N;;;;; +1F9DB;VAMPIRE;So;0;ON;;;;;N;;;;; +1F9DC;MERPERSON;So;0;ON;;;;;N;;;;; +1F9DD;ELF;So;0;ON;;;;;N;;;;; +1F9DE;GENIE;So;0;ON;;;;;N;;;;; +1F9DF;ZOMBIE;So;0;ON;;;;;N;;;;; +1F9E0;BRAIN;So;0;ON;;;;;N;;;;; +1F9E1;ORANGE HEART;So;0;ON;;;;;N;;;;; +1F9E2;BILLED CAP;So;0;ON;;;;;N;;;;; +1F9E3;SCARF;So;0;ON;;;;;N;;;;; +1F9E4;GLOVES;So;0;ON;;;;;N;;;;; +1F9E5;COAT;So;0;ON;;;;;N;;;;; +1F9E6;SOCKS;So;0;ON;;;;;N;;;;; +20000;<CJK Ideograph Extension B, First>;Lo;0;L;;;;;N;;;;; +2A6D6;<CJK Ideograph Extension B, Last>;Lo;0;L;;;;;N;;;;; +2A700;<CJK Ideograph Extension C, First>;Lo;0;L;;;;;N;;;;; +2B734;<CJK Ideograph Extension C, Last>;Lo;0;L;;;;;N;;;;; +2B740;<CJK Ideograph Extension D, First>;Lo;0;L;;;;;N;;;;; +2B81D;<CJK Ideograph Extension D, Last>;Lo;0;L;;;;;N;;;;; +2B820;<CJK Ideograph Extension E, First>;Lo;0;L;;;;;N;;;;; +2CEA1;<CJK Ideograph Extension E, Last>;Lo;0;L;;;;;N;;;;; +2CEB0;<CJK Ideograph Extension F, First>;Lo;0;L;;;;;N;;;;; +2EBE0;<CJK Ideograph Extension F, Last>;Lo;0;L;;;;;N;;;;; +2F800;CJK COMPATIBILITY IDEOGRAPH-2F800;Lo;0;L;4E3D;;;;N;;;;; +2F801;CJK COMPATIBILITY IDEOGRAPH-2F801;Lo;0;L;4E38;;;;N;;;;; +2F802;CJK COMPATIBILITY IDEOGRAPH-2F802;Lo;0;L;4E41;;;;N;;;;; +2F803;CJK COMPATIBILITY IDEOGRAPH-2F803;Lo;0;L;20122;;;;N;;;;; +2F804;CJK COMPATIBILITY IDEOGRAPH-2F804;Lo;0;L;4F60;;;;N;;;;; +2F805;CJK COMPATIBILITY IDEOGRAPH-2F805;Lo;0;L;4FAE;;;;N;;;;; +2F806;CJK COMPATIBILITY IDEOGRAPH-2F806;Lo;0;L;4FBB;;;;N;;;;; +2F807;CJK COMPATIBILITY IDEOGRAPH-2F807;Lo;0;L;5002;;;;N;;;;; +2F808;CJK COMPATIBILITY IDEOGRAPH-2F808;Lo;0;L;507A;;;;N;;;;; +2F809;CJK COMPATIBILITY IDEOGRAPH-2F809;Lo;0;L;5099;;;;N;;;;; +2F80A;CJK COMPATIBILITY IDEOGRAPH-2F80A;Lo;0;L;50E7;;;;N;;;;; +2F80B;CJK COMPATIBILITY IDEOGRAPH-2F80B;Lo;0;L;50CF;;;;N;;;;; +2F80C;CJK COMPATIBILITY IDEOGRAPH-2F80C;Lo;0;L;349E;;;;N;;;;; +2F80D;CJK COMPATIBILITY IDEOGRAPH-2F80D;Lo;0;L;2063A;;;;N;;;;; +2F80E;CJK COMPATIBILITY IDEOGRAPH-2F80E;Lo;0;L;514D;;;;N;;;;; +2F80F;CJK COMPATIBILITY IDEOGRAPH-2F80F;Lo;0;L;5154;;;;N;;;;; +2F810;CJK COMPATIBILITY IDEOGRAPH-2F810;Lo;0;L;5164;;;;N;;;;; +2F811;CJK COMPATIBILITY IDEOGRAPH-2F811;Lo;0;L;5177;;;;N;;;;; +2F812;CJK COMPATIBILITY IDEOGRAPH-2F812;Lo;0;L;2051C;;;;N;;;;; +2F813;CJK COMPATIBILITY IDEOGRAPH-2F813;Lo;0;L;34B9;;;;N;;;;; +2F814;CJK COMPATIBILITY IDEOGRAPH-2F814;Lo;0;L;5167;;;;N;;;;; +2F815;CJK COMPATIBILITY IDEOGRAPH-2F815;Lo;0;L;518D;;;;N;;;;; +2F816;CJK COMPATIBILITY IDEOGRAPH-2F816;Lo;0;L;2054B;;;;N;;;;; +2F817;CJK COMPATIBILITY IDEOGRAPH-2F817;Lo;0;L;5197;;;;N;;;;; +2F818;CJK COMPATIBILITY IDEOGRAPH-2F818;Lo;0;L;51A4;;;;N;;;;; +2F819;CJK COMPATIBILITY IDEOGRAPH-2F819;Lo;0;L;4ECC;;;;N;;;;; +2F81A;CJK COMPATIBILITY IDEOGRAPH-2F81A;Lo;0;L;51AC;;;;N;;;;; +2F81B;CJK COMPATIBILITY IDEOGRAPH-2F81B;Lo;0;L;51B5;;;;N;;;;; +2F81C;CJK COMPATIBILITY IDEOGRAPH-2F81C;Lo;0;L;291DF;;;;N;;;;; +2F81D;CJK COMPATIBILITY IDEOGRAPH-2F81D;Lo;0;L;51F5;;;;N;;;;; +2F81E;CJK COMPATIBILITY IDEOGRAPH-2F81E;Lo;0;L;5203;;;;N;;;;; +2F81F;CJK COMPATIBILITY IDEOGRAPH-2F81F;Lo;0;L;34DF;;;;N;;;;; +2F820;CJK COMPATIBILITY IDEOGRAPH-2F820;Lo;0;L;523B;;;;N;;;;; +2F821;CJK COMPATIBILITY IDEOGRAPH-2F821;Lo;0;L;5246;;;;N;;;;; +2F822;CJK COMPATIBILITY IDEOGRAPH-2F822;Lo;0;L;5272;;;;N;;;;; +2F823;CJK COMPATIBILITY IDEOGRAPH-2F823;Lo;0;L;5277;;;;N;;;;; +2F824;CJK COMPATIBILITY IDEOGRAPH-2F824;Lo;0;L;3515;;;;N;;;;; +2F825;CJK COMPATIBILITY IDEOGRAPH-2F825;Lo;0;L;52C7;;;;N;;;;; +2F826;CJK COMPATIBILITY IDEOGRAPH-2F826;Lo;0;L;52C9;;;;N;;;;; +2F827;CJK COMPATIBILITY IDEOGRAPH-2F827;Lo;0;L;52E4;;;;N;;;;; +2F828;CJK COMPATIBILITY IDEOGRAPH-2F828;Lo;0;L;52FA;;;;N;;;;; +2F829;CJK COMPATIBILITY IDEOGRAPH-2F829;Lo;0;L;5305;;;;N;;;;; +2F82A;CJK COMPATIBILITY IDEOGRAPH-2F82A;Lo;0;L;5306;;;;N;;;;; +2F82B;CJK COMPATIBILITY IDEOGRAPH-2F82B;Lo;0;L;5317;;;;N;;;;; +2F82C;CJK COMPATIBILITY IDEOGRAPH-2F82C;Lo;0;L;5349;;;;N;;;;; +2F82D;CJK COMPATIBILITY IDEOGRAPH-2F82D;Lo;0;L;5351;;;;N;;;;; +2F82E;CJK COMPATIBILITY IDEOGRAPH-2F82E;Lo;0;L;535A;;;;N;;;;; +2F82F;CJK COMPATIBILITY IDEOGRAPH-2F82F;Lo;0;L;5373;;;;N;;;;; +2F830;CJK COMPATIBILITY IDEOGRAPH-2F830;Lo;0;L;537D;;;;N;;;;; +2F831;CJK COMPATIBILITY IDEOGRAPH-2F831;Lo;0;L;537F;;;;N;;;;; +2F832;CJK COMPATIBILITY IDEOGRAPH-2F832;Lo;0;L;537F;;;;N;;;;; +2F833;CJK COMPATIBILITY IDEOGRAPH-2F833;Lo;0;L;537F;;;;N;;;;; +2F834;CJK COMPATIBILITY IDEOGRAPH-2F834;Lo;0;L;20A2C;;;;N;;;;; +2F835;CJK COMPATIBILITY IDEOGRAPH-2F835;Lo;0;L;7070;;;;N;;;;; +2F836;CJK COMPATIBILITY IDEOGRAPH-2F836;Lo;0;L;53CA;;;;N;;;;; +2F837;CJK COMPATIBILITY IDEOGRAPH-2F837;Lo;0;L;53DF;;;;N;;;;; +2F838;CJK COMPATIBILITY IDEOGRAPH-2F838;Lo;0;L;20B63;;;;N;;;;; +2F839;CJK COMPATIBILITY IDEOGRAPH-2F839;Lo;0;L;53EB;;;;N;;;;; +2F83A;CJK COMPATIBILITY IDEOGRAPH-2F83A;Lo;0;L;53F1;;;;N;;;;; +2F83B;CJK COMPATIBILITY IDEOGRAPH-2F83B;Lo;0;L;5406;;;;N;;;;; +2F83C;CJK COMPATIBILITY IDEOGRAPH-2F83C;Lo;0;L;549E;;;;N;;;;; +2F83D;CJK COMPATIBILITY IDEOGRAPH-2F83D;Lo;0;L;5438;;;;N;;;;; +2F83E;CJK COMPATIBILITY IDEOGRAPH-2F83E;Lo;0;L;5448;;;;N;;;;; +2F83F;CJK COMPATIBILITY IDEOGRAPH-2F83F;Lo;0;L;5468;;;;N;;;;; +2F840;CJK COMPATIBILITY IDEOGRAPH-2F840;Lo;0;L;54A2;;;;N;;;;; +2F841;CJK COMPATIBILITY IDEOGRAPH-2F841;Lo;0;L;54F6;;;;N;;;;; +2F842;CJK COMPATIBILITY IDEOGRAPH-2F842;Lo;0;L;5510;;;;N;;;;; +2F843;CJK COMPATIBILITY IDEOGRAPH-2F843;Lo;0;L;5553;;;;N;;;;; +2F844;CJK COMPATIBILITY IDEOGRAPH-2F844;Lo;0;L;5563;;;;N;;;;; +2F845;CJK COMPATIBILITY IDEOGRAPH-2F845;Lo;0;L;5584;;;;N;;;;; +2F846;CJK COMPATIBILITY IDEOGRAPH-2F846;Lo;0;L;5584;;;;N;;;;; +2F847;CJK COMPATIBILITY IDEOGRAPH-2F847;Lo;0;L;5599;;;;N;;;;; +2F848;CJK COMPATIBILITY IDEOGRAPH-2F848;Lo;0;L;55AB;;;;N;;;;; +2F849;CJK COMPATIBILITY IDEOGRAPH-2F849;Lo;0;L;55B3;;;;N;;;;; +2F84A;CJK COMPATIBILITY IDEOGRAPH-2F84A;Lo;0;L;55C2;;;;N;;;;; +2F84B;CJK COMPATIBILITY IDEOGRAPH-2F84B;Lo;0;L;5716;;;;N;;;;; +2F84C;CJK COMPATIBILITY IDEOGRAPH-2F84C;Lo;0;L;5606;;;;N;;;;; +2F84D;CJK COMPATIBILITY IDEOGRAPH-2F84D;Lo;0;L;5717;;;;N;;;;; +2F84E;CJK COMPATIBILITY IDEOGRAPH-2F84E;Lo;0;L;5651;;;;N;;;;; +2F84F;CJK COMPATIBILITY IDEOGRAPH-2F84F;Lo;0;L;5674;;;;N;;;;; +2F850;CJK COMPATIBILITY IDEOGRAPH-2F850;Lo;0;L;5207;;;;N;;;;; +2F851;CJK COMPATIBILITY IDEOGRAPH-2F851;Lo;0;L;58EE;;;;N;;;;; +2F852;CJK COMPATIBILITY IDEOGRAPH-2F852;Lo;0;L;57CE;;;;N;;;;; +2F853;CJK COMPATIBILITY IDEOGRAPH-2F853;Lo;0;L;57F4;;;;N;;;;; +2F854;CJK COMPATIBILITY IDEOGRAPH-2F854;Lo;0;L;580D;;;;N;;;;; +2F855;CJK COMPATIBILITY IDEOGRAPH-2F855;Lo;0;L;578B;;;;N;;;;; +2F856;CJK COMPATIBILITY IDEOGRAPH-2F856;Lo;0;L;5832;;;;N;;;;; +2F857;CJK COMPATIBILITY IDEOGRAPH-2F857;Lo;0;L;5831;;;;N;;;;; +2F858;CJK COMPATIBILITY IDEOGRAPH-2F858;Lo;0;L;58AC;;;;N;;;;; +2F859;CJK COMPATIBILITY IDEOGRAPH-2F859;Lo;0;L;214E4;;;;N;;;;; +2F85A;CJK COMPATIBILITY IDEOGRAPH-2F85A;Lo;0;L;58F2;;;;N;;;;; +2F85B;CJK COMPATIBILITY IDEOGRAPH-2F85B;Lo;0;L;58F7;;;;N;;;;; +2F85C;CJK COMPATIBILITY IDEOGRAPH-2F85C;Lo;0;L;5906;;;;N;;;;; +2F85D;CJK COMPATIBILITY IDEOGRAPH-2F85D;Lo;0;L;591A;;;;N;;;;; +2F85E;CJK COMPATIBILITY IDEOGRAPH-2F85E;Lo;0;L;5922;;;;N;;;;; +2F85F;CJK COMPATIBILITY IDEOGRAPH-2F85F;Lo;0;L;5962;;;;N;;;;; +2F860;CJK COMPATIBILITY IDEOGRAPH-2F860;Lo;0;L;216A8;;;;N;;;;; +2F861;CJK COMPATIBILITY IDEOGRAPH-2F861;Lo;0;L;216EA;;;;N;;;;; +2F862;CJK COMPATIBILITY IDEOGRAPH-2F862;Lo;0;L;59EC;;;;N;;;;; +2F863;CJK COMPATIBILITY IDEOGRAPH-2F863;Lo;0;L;5A1B;;;;N;;;;; +2F864;CJK COMPATIBILITY IDEOGRAPH-2F864;Lo;0;L;5A27;;;;N;;;;; +2F865;CJK COMPATIBILITY IDEOGRAPH-2F865;Lo;0;L;59D8;;;;N;;;;; +2F866;CJK COMPATIBILITY IDEOGRAPH-2F866;Lo;0;L;5A66;;;;N;;;;; +2F867;CJK COMPATIBILITY IDEOGRAPH-2F867;Lo;0;L;36EE;;;;N;;;;; +2F868;CJK COMPATIBILITY IDEOGRAPH-2F868;Lo;0;L;36FC;;;;N;;;;; +2F869;CJK COMPATIBILITY IDEOGRAPH-2F869;Lo;0;L;5B08;;;;N;;;;; +2F86A;CJK COMPATIBILITY IDEOGRAPH-2F86A;Lo;0;L;5B3E;;;;N;;;;; +2F86B;CJK COMPATIBILITY IDEOGRAPH-2F86B;Lo;0;L;5B3E;;;;N;;;;; +2F86C;CJK COMPATIBILITY IDEOGRAPH-2F86C;Lo;0;L;219C8;;;;N;;;;; +2F86D;CJK COMPATIBILITY IDEOGRAPH-2F86D;Lo;0;L;5BC3;;;;N;;;;; +2F86E;CJK COMPATIBILITY IDEOGRAPH-2F86E;Lo;0;L;5BD8;;;;N;;;;; +2F86F;CJK COMPATIBILITY IDEOGRAPH-2F86F;Lo;0;L;5BE7;;;;N;;;;; +2F870;CJK COMPATIBILITY IDEOGRAPH-2F870;Lo;0;L;5BF3;;;;N;;;;; +2F871;CJK COMPATIBILITY IDEOGRAPH-2F871;Lo;0;L;21B18;;;;N;;;;; +2F872;CJK COMPATIBILITY IDEOGRAPH-2F872;Lo;0;L;5BFF;;;;N;;;;; +2F873;CJK COMPATIBILITY IDEOGRAPH-2F873;Lo;0;L;5C06;;;;N;;;;; +2F874;CJK COMPATIBILITY IDEOGRAPH-2F874;Lo;0;L;5F53;;;;N;;;;; +2F875;CJK COMPATIBILITY IDEOGRAPH-2F875;Lo;0;L;5C22;;;;N;;;;; +2F876;CJK COMPATIBILITY IDEOGRAPH-2F876;Lo;0;L;3781;;;;N;;;;; +2F877;CJK COMPATIBILITY IDEOGRAPH-2F877;Lo;0;L;5C60;;;;N;;;;; +2F878;CJK COMPATIBILITY IDEOGRAPH-2F878;Lo;0;L;5C6E;;;;N;;;;; +2F879;CJK COMPATIBILITY IDEOGRAPH-2F879;Lo;0;L;5CC0;;;;N;;;;; +2F87A;CJK COMPATIBILITY IDEOGRAPH-2F87A;Lo;0;L;5C8D;;;;N;;;;; +2F87B;CJK COMPATIBILITY IDEOGRAPH-2F87B;Lo;0;L;21DE4;;;;N;;;;; +2F87C;CJK COMPATIBILITY IDEOGRAPH-2F87C;Lo;0;L;5D43;;;;N;;;;; +2F87D;CJK COMPATIBILITY IDEOGRAPH-2F87D;Lo;0;L;21DE6;;;;N;;;;; +2F87E;CJK COMPATIBILITY IDEOGRAPH-2F87E;Lo;0;L;5D6E;;;;N;;;;; +2F87F;CJK COMPATIBILITY IDEOGRAPH-2F87F;Lo;0;L;5D6B;;;;N;;;;; +2F880;CJK COMPATIBILITY IDEOGRAPH-2F880;Lo;0;L;5D7C;;;;N;;;;; +2F881;CJK COMPATIBILITY IDEOGRAPH-2F881;Lo;0;L;5DE1;;;;N;;;;; +2F882;CJK COMPATIBILITY IDEOGRAPH-2F882;Lo;0;L;5DE2;;;;N;;;;; +2F883;CJK COMPATIBILITY IDEOGRAPH-2F883;Lo;0;L;382F;;;;N;;;;; +2F884;CJK COMPATIBILITY IDEOGRAPH-2F884;Lo;0;L;5DFD;;;;N;;;;; +2F885;CJK COMPATIBILITY IDEOGRAPH-2F885;Lo;0;L;5E28;;;;N;;;;; +2F886;CJK COMPATIBILITY IDEOGRAPH-2F886;Lo;0;L;5E3D;;;;N;;;;; +2F887;CJK COMPATIBILITY IDEOGRAPH-2F887;Lo;0;L;5E69;;;;N;;;;; +2F888;CJK COMPATIBILITY IDEOGRAPH-2F888;Lo;0;L;3862;;;;N;;;;; +2F889;CJK COMPATIBILITY IDEOGRAPH-2F889;Lo;0;L;22183;;;;N;;;;; +2F88A;CJK COMPATIBILITY IDEOGRAPH-2F88A;Lo;0;L;387C;;;;N;;;;; +2F88B;CJK COMPATIBILITY IDEOGRAPH-2F88B;Lo;0;L;5EB0;;;;N;;;;; +2F88C;CJK COMPATIBILITY IDEOGRAPH-2F88C;Lo;0;L;5EB3;;;;N;;;;; +2F88D;CJK COMPATIBILITY IDEOGRAPH-2F88D;Lo;0;L;5EB6;;;;N;;;;; +2F88E;CJK COMPATIBILITY IDEOGRAPH-2F88E;Lo;0;L;5ECA;;;;N;;;;; +2F88F;CJK COMPATIBILITY IDEOGRAPH-2F88F;Lo;0;L;2A392;;;;N;;;;; +2F890;CJK COMPATIBILITY IDEOGRAPH-2F890;Lo;0;L;5EFE;;;9;N;;;;; +2F891;CJK COMPATIBILITY IDEOGRAPH-2F891;Lo;0;L;22331;;;;N;;;;; +2F892;CJK COMPATIBILITY IDEOGRAPH-2F892;Lo;0;L;22331;;;;N;;;;; +2F893;CJK COMPATIBILITY IDEOGRAPH-2F893;Lo;0;L;8201;;;;N;;;;; +2F894;CJK COMPATIBILITY IDEOGRAPH-2F894;Lo;0;L;5F22;;;;N;;;;; +2F895;CJK COMPATIBILITY IDEOGRAPH-2F895;Lo;0;L;5F22;;;;N;;;;; +2F896;CJK COMPATIBILITY IDEOGRAPH-2F896;Lo;0;L;38C7;;;;N;;;;; +2F897;CJK COMPATIBILITY IDEOGRAPH-2F897;Lo;0;L;232B8;;;;N;;;;; +2F898;CJK COMPATIBILITY IDEOGRAPH-2F898;Lo;0;L;261DA;;;;N;;;;; +2F899;CJK COMPATIBILITY IDEOGRAPH-2F899;Lo;0;L;5F62;;;;N;;;;; +2F89A;CJK COMPATIBILITY IDEOGRAPH-2F89A;Lo;0;L;5F6B;;;;N;;;;; +2F89B;CJK COMPATIBILITY IDEOGRAPH-2F89B;Lo;0;L;38E3;;;;N;;;;; +2F89C;CJK COMPATIBILITY IDEOGRAPH-2F89C;Lo;0;L;5F9A;;;;N;;;;; +2F89D;CJK COMPATIBILITY IDEOGRAPH-2F89D;Lo;0;L;5FCD;;;;N;;;;; +2F89E;CJK COMPATIBILITY IDEOGRAPH-2F89E;Lo;0;L;5FD7;;;;N;;;;; +2F89F;CJK COMPATIBILITY IDEOGRAPH-2F89F;Lo;0;L;5FF9;;;;N;;;;; +2F8A0;CJK COMPATIBILITY IDEOGRAPH-2F8A0;Lo;0;L;6081;;;;N;;;;; +2F8A1;CJK COMPATIBILITY IDEOGRAPH-2F8A1;Lo;0;L;393A;;;;N;;;;; +2F8A2;CJK COMPATIBILITY IDEOGRAPH-2F8A2;Lo;0;L;391C;;;;N;;;;; +2F8A3;CJK COMPATIBILITY IDEOGRAPH-2F8A3;Lo;0;L;6094;;;;N;;;;; +2F8A4;CJK COMPATIBILITY IDEOGRAPH-2F8A4;Lo;0;L;226D4;;;;N;;;;; +2F8A5;CJK COMPATIBILITY IDEOGRAPH-2F8A5;Lo;0;L;60C7;;;;N;;;;; +2F8A6;CJK COMPATIBILITY IDEOGRAPH-2F8A6;Lo;0;L;6148;;;;N;;;;; +2F8A7;CJK COMPATIBILITY IDEOGRAPH-2F8A7;Lo;0;L;614C;;;;N;;;;; +2F8A8;CJK COMPATIBILITY IDEOGRAPH-2F8A8;Lo;0;L;614E;;;;N;;;;; +2F8A9;CJK COMPATIBILITY IDEOGRAPH-2F8A9;Lo;0;L;614C;;;;N;;;;; +2F8AA;CJK COMPATIBILITY IDEOGRAPH-2F8AA;Lo;0;L;617A;;;;N;;;;; +2F8AB;CJK COMPATIBILITY IDEOGRAPH-2F8AB;Lo;0;L;618E;;;;N;;;;; +2F8AC;CJK COMPATIBILITY IDEOGRAPH-2F8AC;Lo;0;L;61B2;;;;N;;;;; +2F8AD;CJK COMPATIBILITY IDEOGRAPH-2F8AD;Lo;0;L;61A4;;;;N;;;;; +2F8AE;CJK COMPATIBILITY IDEOGRAPH-2F8AE;Lo;0;L;61AF;;;;N;;;;; +2F8AF;CJK COMPATIBILITY IDEOGRAPH-2F8AF;Lo;0;L;61DE;;;;N;;;;; +2F8B0;CJK COMPATIBILITY IDEOGRAPH-2F8B0;Lo;0;L;61F2;;;;N;;;;; +2F8B1;CJK COMPATIBILITY IDEOGRAPH-2F8B1;Lo;0;L;61F6;;;;N;;;;; +2F8B2;CJK COMPATIBILITY IDEOGRAPH-2F8B2;Lo;0;L;6210;;;;N;;;;; +2F8B3;CJK COMPATIBILITY IDEOGRAPH-2F8B3;Lo;0;L;621B;;;;N;;;;; +2F8B4;CJK COMPATIBILITY IDEOGRAPH-2F8B4;Lo;0;L;625D;;;;N;;;;; +2F8B5;CJK COMPATIBILITY IDEOGRAPH-2F8B5;Lo;0;L;62B1;;;;N;;;;; +2F8B6;CJK COMPATIBILITY IDEOGRAPH-2F8B6;Lo;0;L;62D4;;;;N;;;;; +2F8B7;CJK COMPATIBILITY IDEOGRAPH-2F8B7;Lo;0;L;6350;;;;N;;;;; +2F8B8;CJK COMPATIBILITY IDEOGRAPH-2F8B8;Lo;0;L;22B0C;;;;N;;;;; +2F8B9;CJK COMPATIBILITY IDEOGRAPH-2F8B9;Lo;0;L;633D;;;;N;;;;; +2F8BA;CJK COMPATIBILITY IDEOGRAPH-2F8BA;Lo;0;L;62FC;;;;N;;;;; +2F8BB;CJK COMPATIBILITY IDEOGRAPH-2F8BB;Lo;0;L;6368;;;;N;;;;; +2F8BC;CJK COMPATIBILITY IDEOGRAPH-2F8BC;Lo;0;L;6383;;;;N;;;;; +2F8BD;CJK COMPATIBILITY IDEOGRAPH-2F8BD;Lo;0;L;63E4;;;;N;;;;; +2F8BE;CJK COMPATIBILITY IDEOGRAPH-2F8BE;Lo;0;L;22BF1;;;;N;;;;; +2F8BF;CJK COMPATIBILITY IDEOGRAPH-2F8BF;Lo;0;L;6422;;;;N;;;;; +2F8C0;CJK COMPATIBILITY IDEOGRAPH-2F8C0;Lo;0;L;63C5;;;;N;;;;; +2F8C1;CJK COMPATIBILITY IDEOGRAPH-2F8C1;Lo;0;L;63A9;;;;N;;;;; +2F8C2;CJK COMPATIBILITY IDEOGRAPH-2F8C2;Lo;0;L;3A2E;;;;N;;;;; +2F8C3;CJK COMPATIBILITY IDEOGRAPH-2F8C3;Lo;0;L;6469;;;;N;;;;; +2F8C4;CJK COMPATIBILITY IDEOGRAPH-2F8C4;Lo;0;L;647E;;;;N;;;;; +2F8C5;CJK COMPATIBILITY IDEOGRAPH-2F8C5;Lo;0;L;649D;;;;N;;;;; +2F8C6;CJK COMPATIBILITY IDEOGRAPH-2F8C6;Lo;0;L;6477;;;;N;;;;; +2F8C7;CJK COMPATIBILITY IDEOGRAPH-2F8C7;Lo;0;L;3A6C;;;;N;;;;; +2F8C8;CJK COMPATIBILITY IDEOGRAPH-2F8C8;Lo;0;L;654F;;;;N;;;;; +2F8C9;CJK COMPATIBILITY IDEOGRAPH-2F8C9;Lo;0;L;656C;;;;N;;;;; +2F8CA;CJK COMPATIBILITY IDEOGRAPH-2F8CA;Lo;0;L;2300A;;;;N;;;;; +2F8CB;CJK COMPATIBILITY IDEOGRAPH-2F8CB;Lo;0;L;65E3;;;;N;;;;; +2F8CC;CJK COMPATIBILITY IDEOGRAPH-2F8CC;Lo;0;L;66F8;;;;N;;;;; +2F8CD;CJK COMPATIBILITY IDEOGRAPH-2F8CD;Lo;0;L;6649;;;;N;;;;; +2F8CE;CJK COMPATIBILITY IDEOGRAPH-2F8CE;Lo;0;L;3B19;;;;N;;;;; +2F8CF;CJK COMPATIBILITY IDEOGRAPH-2F8CF;Lo;0;L;6691;;;;N;;;;; +2F8D0;CJK COMPATIBILITY IDEOGRAPH-2F8D0;Lo;0;L;3B08;;;;N;;;;; +2F8D1;CJK COMPATIBILITY IDEOGRAPH-2F8D1;Lo;0;L;3AE4;;;;N;;;;; +2F8D2;CJK COMPATIBILITY IDEOGRAPH-2F8D2;Lo;0;L;5192;;;;N;;;;; +2F8D3;CJK COMPATIBILITY IDEOGRAPH-2F8D3;Lo;0;L;5195;;;;N;;;;; +2F8D4;CJK COMPATIBILITY IDEOGRAPH-2F8D4;Lo;0;L;6700;;;;N;;;;; +2F8D5;CJK COMPATIBILITY IDEOGRAPH-2F8D5;Lo;0;L;669C;;;;N;;;;; +2F8D6;CJK COMPATIBILITY IDEOGRAPH-2F8D6;Lo;0;L;80AD;;;;N;;;;; +2F8D7;CJK COMPATIBILITY IDEOGRAPH-2F8D7;Lo;0;L;43D9;;;;N;;;;; +2F8D8;CJK COMPATIBILITY IDEOGRAPH-2F8D8;Lo;0;L;6717;;;;N;;;;; +2F8D9;CJK COMPATIBILITY IDEOGRAPH-2F8D9;Lo;0;L;671B;;;;N;;;;; +2F8DA;CJK COMPATIBILITY IDEOGRAPH-2F8DA;Lo;0;L;6721;;;;N;;;;; +2F8DB;CJK COMPATIBILITY IDEOGRAPH-2F8DB;Lo;0;L;675E;;;;N;;;;; +2F8DC;CJK COMPATIBILITY IDEOGRAPH-2F8DC;Lo;0;L;6753;;;;N;;;;; +2F8DD;CJK COMPATIBILITY IDEOGRAPH-2F8DD;Lo;0;L;233C3;;;;N;;;;; +2F8DE;CJK COMPATIBILITY IDEOGRAPH-2F8DE;Lo;0;L;3B49;;;;N;;;;; +2F8DF;CJK COMPATIBILITY IDEOGRAPH-2F8DF;Lo;0;L;67FA;;;;N;;;;; +2F8E0;CJK COMPATIBILITY IDEOGRAPH-2F8E0;Lo;0;L;6785;;;;N;;;;; +2F8E1;CJK COMPATIBILITY IDEOGRAPH-2F8E1;Lo;0;L;6852;;;;N;;;;; +2F8E2;CJK COMPATIBILITY IDEOGRAPH-2F8E2;Lo;0;L;6885;;;;N;;;;; +2F8E3;CJK COMPATIBILITY IDEOGRAPH-2F8E3;Lo;0;L;2346D;;;;N;;;;; +2F8E4;CJK COMPATIBILITY IDEOGRAPH-2F8E4;Lo;0;L;688E;;;;N;;;;; +2F8E5;CJK COMPATIBILITY IDEOGRAPH-2F8E5;Lo;0;L;681F;;;;N;;;;; +2F8E6;CJK COMPATIBILITY IDEOGRAPH-2F8E6;Lo;0;L;6914;;;;N;;;;; +2F8E7;CJK COMPATIBILITY IDEOGRAPH-2F8E7;Lo;0;L;3B9D;;;;N;;;;; +2F8E8;CJK COMPATIBILITY IDEOGRAPH-2F8E8;Lo;0;L;6942;;;;N;;;;; +2F8E9;CJK COMPATIBILITY IDEOGRAPH-2F8E9;Lo;0;L;69A3;;;;N;;;;; +2F8EA;CJK COMPATIBILITY IDEOGRAPH-2F8EA;Lo;0;L;69EA;;;;N;;;;; +2F8EB;CJK COMPATIBILITY IDEOGRAPH-2F8EB;Lo;0;L;6AA8;;;;N;;;;; +2F8EC;CJK COMPATIBILITY IDEOGRAPH-2F8EC;Lo;0;L;236A3;;;;N;;;;; +2F8ED;CJK COMPATIBILITY IDEOGRAPH-2F8ED;Lo;0;L;6ADB;;;;N;;;;; +2F8EE;CJK COMPATIBILITY IDEOGRAPH-2F8EE;Lo;0;L;3C18;;;;N;;;;; +2F8EF;CJK COMPATIBILITY IDEOGRAPH-2F8EF;Lo;0;L;6B21;;;;N;;;;; +2F8F0;CJK COMPATIBILITY IDEOGRAPH-2F8F0;Lo;0;L;238A7;;;;N;;;;; +2F8F1;CJK COMPATIBILITY IDEOGRAPH-2F8F1;Lo;0;L;6B54;;;;N;;;;; +2F8F2;CJK COMPATIBILITY IDEOGRAPH-2F8F2;Lo;0;L;3C4E;;;;N;;;;; +2F8F3;CJK COMPATIBILITY IDEOGRAPH-2F8F3;Lo;0;L;6B72;;;;N;;;;; +2F8F4;CJK COMPATIBILITY IDEOGRAPH-2F8F4;Lo;0;L;6B9F;;;;N;;;;; +2F8F5;CJK COMPATIBILITY IDEOGRAPH-2F8F5;Lo;0;L;6BBA;;;;N;;;;; +2F8F6;CJK COMPATIBILITY IDEOGRAPH-2F8F6;Lo;0;L;6BBB;;;;N;;;;; +2F8F7;CJK COMPATIBILITY IDEOGRAPH-2F8F7;Lo;0;L;23A8D;;;;N;;;;; +2F8F8;CJK COMPATIBILITY IDEOGRAPH-2F8F8;Lo;0;L;21D0B;;;;N;;;;; +2F8F9;CJK COMPATIBILITY IDEOGRAPH-2F8F9;Lo;0;L;23AFA;;;;N;;;;; +2F8FA;CJK COMPATIBILITY IDEOGRAPH-2F8FA;Lo;0;L;6C4E;;;;N;;;;; +2F8FB;CJK COMPATIBILITY IDEOGRAPH-2F8FB;Lo;0;L;23CBC;;;;N;;;;; +2F8FC;CJK COMPATIBILITY IDEOGRAPH-2F8FC;Lo;0;L;6CBF;;;;N;;;;; +2F8FD;CJK COMPATIBILITY IDEOGRAPH-2F8FD;Lo;0;L;6CCD;;;;N;;;;; +2F8FE;CJK COMPATIBILITY IDEOGRAPH-2F8FE;Lo;0;L;6C67;;;;N;;;;; +2F8FF;CJK COMPATIBILITY IDEOGRAPH-2F8FF;Lo;0;L;6D16;;;;N;;;;; +2F900;CJK COMPATIBILITY IDEOGRAPH-2F900;Lo;0;L;6D3E;;;;N;;;;; +2F901;CJK COMPATIBILITY IDEOGRAPH-2F901;Lo;0;L;6D77;;;;N;;;;; +2F902;CJK COMPATIBILITY IDEOGRAPH-2F902;Lo;0;L;6D41;;;;N;;;;; +2F903;CJK COMPATIBILITY IDEOGRAPH-2F903;Lo;0;L;6D69;;;;N;;;;; +2F904;CJK COMPATIBILITY IDEOGRAPH-2F904;Lo;0;L;6D78;;;;N;;;;; +2F905;CJK COMPATIBILITY IDEOGRAPH-2F905;Lo;0;L;6D85;;;;N;;;;; +2F906;CJK COMPATIBILITY IDEOGRAPH-2F906;Lo;0;L;23D1E;;;;N;;;;; +2F907;CJK COMPATIBILITY IDEOGRAPH-2F907;Lo;0;L;6D34;;;;N;;;;; +2F908;CJK COMPATIBILITY IDEOGRAPH-2F908;Lo;0;L;6E2F;;;;N;;;;; +2F909;CJK COMPATIBILITY IDEOGRAPH-2F909;Lo;0;L;6E6E;;;;N;;;;; +2F90A;CJK COMPATIBILITY IDEOGRAPH-2F90A;Lo;0;L;3D33;;;;N;;;;; +2F90B;CJK COMPATIBILITY IDEOGRAPH-2F90B;Lo;0;L;6ECB;;;;N;;;;; +2F90C;CJK COMPATIBILITY IDEOGRAPH-2F90C;Lo;0;L;6EC7;;;;N;;;;; +2F90D;CJK COMPATIBILITY IDEOGRAPH-2F90D;Lo;0;L;23ED1;;;;N;;;;; +2F90E;CJK COMPATIBILITY IDEOGRAPH-2F90E;Lo;0;L;6DF9;;;;N;;;;; +2F90F;CJK COMPATIBILITY IDEOGRAPH-2F90F;Lo;0;L;6F6E;;;;N;;;;; +2F910;CJK COMPATIBILITY IDEOGRAPH-2F910;Lo;0;L;23F5E;;;;N;;;;; +2F911;CJK COMPATIBILITY IDEOGRAPH-2F911;Lo;0;L;23F8E;;;;N;;;;; +2F912;CJK COMPATIBILITY IDEOGRAPH-2F912;Lo;0;L;6FC6;;;;N;;;;; +2F913;CJK COMPATIBILITY IDEOGRAPH-2F913;Lo;0;L;7039;;;;N;;;;; +2F914;CJK COMPATIBILITY IDEOGRAPH-2F914;Lo;0;L;701E;;;;N;;;;; +2F915;CJK COMPATIBILITY IDEOGRAPH-2F915;Lo;0;L;701B;;;;N;;;;; +2F916;CJK COMPATIBILITY IDEOGRAPH-2F916;Lo;0;L;3D96;;;;N;;;;; +2F917;CJK COMPATIBILITY IDEOGRAPH-2F917;Lo;0;L;704A;;;;N;;;;; +2F918;CJK COMPATIBILITY IDEOGRAPH-2F918;Lo;0;L;707D;;;;N;;;;; +2F919;CJK COMPATIBILITY IDEOGRAPH-2F919;Lo;0;L;7077;;;;N;;;;; +2F91A;CJK COMPATIBILITY IDEOGRAPH-2F91A;Lo;0;L;70AD;;;;N;;;;; +2F91B;CJK COMPATIBILITY IDEOGRAPH-2F91B;Lo;0;L;20525;;;;N;;;;; +2F91C;CJK COMPATIBILITY IDEOGRAPH-2F91C;Lo;0;L;7145;;;;N;;;;; +2F91D;CJK COMPATIBILITY IDEOGRAPH-2F91D;Lo;0;L;24263;;;;N;;;;; +2F91E;CJK COMPATIBILITY IDEOGRAPH-2F91E;Lo;0;L;719C;;;;N;;;;; +2F91F;CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo;0;L;243AB;;;;N;;;;; +2F920;CJK COMPATIBILITY IDEOGRAPH-2F920;Lo;0;L;7228;;;;N;;;;; +2F921;CJK COMPATIBILITY IDEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;; +2F922;CJK COMPATIBILITY IDEOGRAPH-2F922;Lo;0;L;7250;;;;N;;;;; +2F923;CJK COMPATIBILITY IDEOGRAPH-2F923;Lo;0;L;24608;;;;N;;;;; +2F924;CJK COMPATIBILITY IDEOGRAPH-2F924;Lo;0;L;7280;;;;N;;;;; +2F925;CJK COMPATIBILITY IDEOGRAPH-2F925;Lo;0;L;7295;;;;N;;;;; +2F926;CJK COMPATIBILITY IDEOGRAPH-2F926;Lo;0;L;24735;;;;N;;;;; +2F927;CJK COMPATIBILITY IDEOGRAPH-2F927;Lo;0;L;24814;;;;N;;;;; +2F928;CJK COMPATIBILITY IDEOGRAPH-2F928;Lo;0;L;737A;;;;N;;;;; +2F929;CJK COMPATIBILITY IDEOGRAPH-2F929;Lo;0;L;738B;;;;N;;;;; +2F92A;CJK COMPATIBILITY IDEOGRAPH-2F92A;Lo;0;L;3EAC;;;;N;;;;; +2F92B;CJK COMPATIBILITY IDEOGRAPH-2F92B;Lo;0;L;73A5;;;;N;;;;; +2F92C;CJK COMPATIBILITY IDEOGRAPH-2F92C;Lo;0;L;3EB8;;;;N;;;;; +2F92D;CJK COMPATIBILITY IDEOGRAPH-2F92D;Lo;0;L;3EB8;;;;N;;;;; +2F92E;CJK COMPATIBILITY IDEOGRAPH-2F92E;Lo;0;L;7447;;;;N;;;;; +2F92F;CJK COMPATIBILITY IDEOGRAPH-2F92F;Lo;0;L;745C;;;;N;;;;; +2F930;CJK COMPATIBILITY IDEOGRAPH-2F930;Lo;0;L;7471;;;;N;;;;; +2F931;CJK COMPATIBILITY IDEOGRAPH-2F931;Lo;0;L;7485;;;;N;;;;; +2F932;CJK COMPATIBILITY IDEOGRAPH-2F932;Lo;0;L;74CA;;;;N;;;;; +2F933;CJK COMPATIBILITY IDEOGRAPH-2F933;Lo;0;L;3F1B;;;;N;;;;; +2F934;CJK COMPATIBILITY IDEOGRAPH-2F934;Lo;0;L;7524;;;;N;;;;; +2F935;CJK COMPATIBILITY IDEOGRAPH-2F935;Lo;0;L;24C36;;;;N;;;;; +2F936;CJK COMPATIBILITY IDEOGRAPH-2F936;Lo;0;L;753E;;;;N;;;;; +2F937;CJK COMPATIBILITY IDEOGRAPH-2F937;Lo;0;L;24C92;;;;N;;;;; +2F938;CJK COMPATIBILITY IDEOGRAPH-2F938;Lo;0;L;7570;;;;N;;;;; +2F939;CJK COMPATIBILITY IDEOGRAPH-2F939;Lo;0;L;2219F;;;;N;;;;; +2F93A;CJK COMPATIBILITY IDEOGRAPH-2F93A;Lo;0;L;7610;;;;N;;;;; +2F93B;CJK COMPATIBILITY IDEOGRAPH-2F93B;Lo;0;L;24FA1;;;;N;;;;; +2F93C;CJK COMPATIBILITY IDEOGRAPH-2F93C;Lo;0;L;24FB8;;;;N;;;;; +2F93D;CJK COMPATIBILITY IDEOGRAPH-2F93D;Lo;0;L;25044;;;;N;;;;; +2F93E;CJK COMPATIBILITY IDEOGRAPH-2F93E;Lo;0;L;3FFC;;;;N;;;;; +2F93F;CJK COMPATIBILITY IDEOGRAPH-2F93F;Lo;0;L;4008;;;;N;;;;; +2F940;CJK COMPATIBILITY IDEOGRAPH-2F940;Lo;0;L;76F4;;;;N;;;;; +2F941;CJK COMPATIBILITY IDEOGRAPH-2F941;Lo;0;L;250F3;;;;N;;;;; +2F942;CJK COMPATIBILITY IDEOGRAPH-2F942;Lo;0;L;250F2;;;;N;;;;; +2F943;CJK COMPATIBILITY IDEOGRAPH-2F943;Lo;0;L;25119;;;;N;;;;; +2F944;CJK COMPATIBILITY IDEOGRAPH-2F944;Lo;0;L;25133;;;;N;;;;; +2F945;CJK COMPATIBILITY IDEOGRAPH-2F945;Lo;0;L;771E;;;;N;;;;; +2F946;CJK COMPATIBILITY IDEOGRAPH-2F946;Lo;0;L;771F;;;;N;;;;; +2F947;CJK COMPATIBILITY IDEOGRAPH-2F947;Lo;0;L;771F;;;;N;;;;; +2F948;CJK COMPATIBILITY IDEOGRAPH-2F948;Lo;0;L;774A;;;;N;;;;; +2F949;CJK COMPATIBILITY IDEOGRAPH-2F949;Lo;0;L;4039;;;;N;;;;; +2F94A;CJK COMPATIBILITY IDEOGRAPH-2F94A;Lo;0;L;778B;;;;N;;;;; +2F94B;CJK COMPATIBILITY IDEOGRAPH-2F94B;Lo;0;L;4046;;;;N;;;;; +2F94C;CJK COMPATIBILITY IDEOGRAPH-2F94C;Lo;0;L;4096;;;;N;;;;; +2F94D;CJK COMPATIBILITY IDEOGRAPH-2F94D;Lo;0;L;2541D;;;;N;;;;; +2F94E;CJK COMPATIBILITY IDEOGRAPH-2F94E;Lo;0;L;784E;;;;N;;;;; +2F94F;CJK COMPATIBILITY IDEOGRAPH-2F94F;Lo;0;L;788C;;;;N;;;;; +2F950;CJK COMPATIBILITY IDEOGRAPH-2F950;Lo;0;L;78CC;;;;N;;;;; +2F951;CJK COMPATIBILITY IDEOGRAPH-2F951;Lo;0;L;40E3;;;;N;;;;; +2F952;CJK COMPATIBILITY IDEOGRAPH-2F952;Lo;0;L;25626;;;;N;;;;; +2F953;CJK COMPATIBILITY IDEOGRAPH-2F953;Lo;0;L;7956;;;;N;;;;; +2F954;CJK COMPATIBILITY IDEOGRAPH-2F954;Lo;0;L;2569A;;;;N;;;;; +2F955;CJK COMPATIBILITY IDEOGRAPH-2F955;Lo;0;L;256C5;;;;N;;;;; +2F956;CJK COMPATIBILITY IDEOGRAPH-2F956;Lo;0;L;798F;;;;N;;;;; +2F957;CJK COMPATIBILITY IDEOGRAPH-2F957;Lo;0;L;79EB;;;;N;;;;; +2F958;CJK COMPATIBILITY IDEOGRAPH-2F958;Lo;0;L;412F;;;;N;;;;; +2F959;CJK COMPATIBILITY IDEOGRAPH-2F959;Lo;0;L;7A40;;;;N;;;;; +2F95A;CJK COMPATIBILITY IDEOGRAPH-2F95A;Lo;0;L;7A4A;;;;N;;;;; +2F95B;CJK COMPATIBILITY IDEOGRAPH-2F95B;Lo;0;L;7A4F;;;;N;;;;; +2F95C;CJK COMPATIBILITY IDEOGRAPH-2F95C;Lo;0;L;2597C;;;;N;;;;; +2F95D;CJK COMPATIBILITY IDEOGRAPH-2F95D;Lo;0;L;25AA7;;;;N;;;;; +2F95E;CJK COMPATIBILITY IDEOGRAPH-2F95E;Lo;0;L;25AA7;;;;N;;;;; +2F95F;CJK COMPATIBILITY IDEOGRAPH-2F95F;Lo;0;L;7AEE;;;;N;;;;; +2F960;CJK COMPATIBILITY IDEOGRAPH-2F960;Lo;0;L;4202;;;;N;;;;; +2F961;CJK COMPATIBILITY IDEOGRAPH-2F961;Lo;0;L;25BAB;;;;N;;;;; +2F962;CJK COMPATIBILITY IDEOGRAPH-2F962;Lo;0;L;7BC6;;;;N;;;;; +2F963;CJK COMPATIBILITY IDEOGRAPH-2F963;Lo;0;L;7BC9;;;;N;;;;; +2F964;CJK COMPATIBILITY IDEOGRAPH-2F964;Lo;0;L;4227;;;;N;;;;; +2F965;CJK COMPATIBILITY IDEOGRAPH-2F965;Lo;0;L;25C80;;;;N;;;;; +2F966;CJK COMPATIBILITY IDEOGRAPH-2F966;Lo;0;L;7CD2;;;;N;;;;; +2F967;CJK COMPATIBILITY IDEOGRAPH-2F967;Lo;0;L;42A0;;;;N;;;;; +2F968;CJK COMPATIBILITY IDEOGRAPH-2F968;Lo;0;L;7CE8;;;;N;;;;; +2F969;CJK COMPATIBILITY IDEOGRAPH-2F969;Lo;0;L;7CE3;;;;N;;;;; +2F96A;CJK COMPATIBILITY IDEOGRAPH-2F96A;Lo;0;L;7D00;;;;N;;;;; +2F96B;CJK COMPATIBILITY IDEOGRAPH-2F96B;Lo;0;L;25F86;;;;N;;;;; +2F96C;CJK COMPATIBILITY IDEOGRAPH-2F96C;Lo;0;L;7D63;;;;N;;;;; +2F96D;CJK COMPATIBILITY IDEOGRAPH-2F96D;Lo;0;L;4301;;;;N;;;;; +2F96E;CJK COMPATIBILITY IDEOGRAPH-2F96E;Lo;0;L;7DC7;;;;N;;;;; +2F96F;CJK COMPATIBILITY IDEOGRAPH-2F96F;Lo;0;L;7E02;;;;N;;;;; +2F970;CJK COMPATIBILITY IDEOGRAPH-2F970;Lo;0;L;7E45;;;;N;;;;; +2F971;CJK COMPATIBILITY IDEOGRAPH-2F971;Lo;0;L;4334;;;;N;;;;; +2F972;CJK COMPATIBILITY IDEOGRAPH-2F972;Lo;0;L;26228;;;;N;;;;; +2F973;CJK COMPATIBILITY IDEOGRAPH-2F973;Lo;0;L;26247;;;;N;;;;; +2F974;CJK COMPATIBILITY IDEOGRAPH-2F974;Lo;0;L;4359;;;;N;;;;; +2F975;CJK COMPATIBILITY IDEOGRAPH-2F975;Lo;0;L;262D9;;;;N;;;;; +2F976;CJK COMPATIBILITY IDEOGRAPH-2F976;Lo;0;L;7F7A;;;;N;;;;; +2F977;CJK COMPATIBILITY IDEOGRAPH-2F977;Lo;0;L;2633E;;;;N;;;;; +2F978;CJK COMPATIBILITY IDEOGRAPH-2F978;Lo;0;L;7F95;;;;N;;;;; +2F979;CJK COMPATIBILITY IDEOGRAPH-2F979;Lo;0;L;7FFA;;;;N;;;;; +2F97A;CJK COMPATIBILITY IDEOGRAPH-2F97A;Lo;0;L;8005;;;;N;;;;; +2F97B;CJK COMPATIBILITY IDEOGRAPH-2F97B;Lo;0;L;264DA;;;;N;;;;; +2F97C;CJK COMPATIBILITY IDEOGRAPH-2F97C;Lo;0;L;26523;;;;N;;;;; +2F97D;CJK COMPATIBILITY IDEOGRAPH-2F97D;Lo;0;L;8060;;;;N;;;;; +2F97E;CJK COMPATIBILITY IDEOGRAPH-2F97E;Lo;0;L;265A8;;;;N;;;;; +2F97F;CJK COMPATIBILITY IDEOGRAPH-2F97F;Lo;0;L;8070;;;;N;;;;; +2F980;CJK COMPATIBILITY IDEOGRAPH-2F980;Lo;0;L;2335F;;;;N;;;;; +2F981;CJK COMPATIBILITY IDEOGRAPH-2F981;Lo;0;L;43D5;;;;N;;;;; +2F982;CJK COMPATIBILITY IDEOGRAPH-2F982;Lo;0;L;80B2;;;;N;;;;; +2F983;CJK COMPATIBILITY IDEOGRAPH-2F983;Lo;0;L;8103;;;;N;;;;; +2F984;CJK COMPATIBILITY IDEOGRAPH-2F984;Lo;0;L;440B;;;;N;;;;; +2F985;CJK COMPATIBILITY IDEOGRAPH-2F985;Lo;0;L;813E;;;;N;;;;; +2F986;CJK COMPATIBILITY IDEOGRAPH-2F986;Lo;0;L;5AB5;;;;N;;;;; +2F987;CJK COMPATIBILITY IDEOGRAPH-2F987;Lo;0;L;267A7;;;;N;;;;; +2F988;CJK COMPATIBILITY IDEOGRAPH-2F988;Lo;0;L;267B5;;;;N;;;;; +2F989;CJK COMPATIBILITY IDEOGRAPH-2F989;Lo;0;L;23393;;;;N;;;;; +2F98A;CJK COMPATIBILITY IDEOGRAPH-2F98A;Lo;0;L;2339C;;;;N;;;;; +2F98B;CJK COMPATIBILITY IDEOGRAPH-2F98B;Lo;0;L;8201;;;;N;;;;; +2F98C;CJK COMPATIBILITY IDEOGRAPH-2F98C;Lo;0;L;8204;;;;N;;;;; +2F98D;CJK COMPATIBILITY IDEOGRAPH-2F98D;Lo;0;L;8F9E;;;;N;;;;; +2F98E;CJK COMPATIBILITY IDEOGRAPH-2F98E;Lo;0;L;446B;;;;N;;;;; +2F98F;CJK COMPATIBILITY IDEOGRAPH-2F98F;Lo;0;L;8291;;;;N;;;;; +2F990;CJK COMPATIBILITY IDEOGRAPH-2F990;Lo;0;L;828B;;;;N;;;;; +2F991;CJK COMPATIBILITY IDEOGRAPH-2F991;Lo;0;L;829D;;;;N;;;;; +2F992;CJK COMPATIBILITY IDEOGRAPH-2F992;Lo;0;L;52B3;;;;N;;;;; +2F993;CJK COMPATIBILITY IDEOGRAPH-2F993;Lo;0;L;82B1;;;;N;;;;; +2F994;CJK COMPATIBILITY IDEOGRAPH-2F994;Lo;0;L;82B3;;;;N;;;;; +2F995;CJK COMPATIBILITY IDEOGRAPH-2F995;Lo;0;L;82BD;;;;N;;;;; +2F996;CJK COMPATIBILITY IDEOGRAPH-2F996;Lo;0;L;82E6;;;;N;;;;; +2F997;CJK COMPATIBILITY IDEOGRAPH-2F997;Lo;0;L;26B3C;;;;N;;;;; +2F998;CJK COMPATIBILITY IDEOGRAPH-2F998;Lo;0;L;82E5;;;;N;;;;; +2F999;CJK COMPATIBILITY IDEOGRAPH-2F999;Lo;0;L;831D;;;;N;;;;; +2F99A;CJK COMPATIBILITY IDEOGRAPH-2F99A;Lo;0;L;8363;;;;N;;;;; +2F99B;CJK COMPATIBILITY IDEOGRAPH-2F99B;Lo;0;L;83AD;;;;N;;;;; +2F99C;CJK COMPATIBILITY IDEOGRAPH-2F99C;Lo;0;L;8323;;;;N;;;;; +2F99D;CJK COMPATIBILITY IDEOGRAPH-2F99D;Lo;0;L;83BD;;;;N;;;;; +2F99E;CJK COMPATIBILITY IDEOGRAPH-2F99E;Lo;0;L;83E7;;;;N;;;;; +2F99F;CJK COMPATIBILITY IDEOGRAPH-2F99F;Lo;0;L;8457;;;;N;;;;; +2F9A0;CJK COMPATIBILITY IDEOGRAPH-2F9A0;Lo;0;L;8353;;;;N;;;;; +2F9A1;CJK COMPATIBILITY IDEOGRAPH-2F9A1;Lo;0;L;83CA;;;;N;;;;; +2F9A2;CJK COMPATIBILITY IDEOGRAPH-2F9A2;Lo;0;L;83CC;;;;N;;;;; +2F9A3;CJK COMPATIBILITY IDEOGRAPH-2F9A3;Lo;0;L;83DC;;;;N;;;;; +2F9A4;CJK COMPATIBILITY IDEOGRAPH-2F9A4;Lo;0;L;26C36;;;;N;;;;; +2F9A5;CJK COMPATIBILITY IDEOGRAPH-2F9A5;Lo;0;L;26D6B;;;;N;;;;; +2F9A6;CJK COMPATIBILITY IDEOGRAPH-2F9A6;Lo;0;L;26CD5;;;;N;;;;; +2F9A7;CJK COMPATIBILITY IDEOGRAPH-2F9A7;Lo;0;L;452B;;;;N;;;;; +2F9A8;CJK COMPATIBILITY IDEOGRAPH-2F9A8;Lo;0;L;84F1;;;;N;;;;; +2F9A9;CJK COMPATIBILITY IDEOGRAPH-2F9A9;Lo;0;L;84F3;;;;N;;;;; +2F9AA;CJK COMPATIBILITY IDEOGRAPH-2F9AA;Lo;0;L;8516;;;;N;;;;; +2F9AB;CJK COMPATIBILITY IDEOGRAPH-2F9AB;Lo;0;L;273CA;;;;N;;;;; +2F9AC;CJK COMPATIBILITY IDEOGRAPH-2F9AC;Lo;0;L;8564;;;;N;;;;; +2F9AD;CJK COMPATIBILITY IDEOGRAPH-2F9AD;Lo;0;L;26F2C;;;;N;;;;; +2F9AE;CJK COMPATIBILITY IDEOGRAPH-2F9AE;Lo;0;L;455D;;;;N;;;;; +2F9AF;CJK COMPATIBILITY IDEOGRAPH-2F9AF;Lo;0;L;4561;;;;N;;;;; +2F9B0;CJK COMPATIBILITY IDEOGRAPH-2F9B0;Lo;0;L;26FB1;;;;N;;;;; +2F9B1;CJK COMPATIBILITY IDEOGRAPH-2F9B1;Lo;0;L;270D2;;;;N;;;;; +2F9B2;CJK COMPATIBILITY IDEOGRAPH-2F9B2;Lo;0;L;456B;;;;N;;;;; +2F9B3;CJK COMPATIBILITY IDEOGRAPH-2F9B3;Lo;0;L;8650;;;;N;;;;; +2F9B4;CJK COMPATIBILITY IDEOGRAPH-2F9B4;Lo;0;L;865C;;;;N;;;;; +2F9B5;CJK COMPATIBILITY IDEOGRAPH-2F9B5;Lo;0;L;8667;;;;N;;;;; +2F9B6;CJK COMPATIBILITY IDEOGRAPH-2F9B6;Lo;0;L;8669;;;;N;;;;; +2F9B7;CJK COMPATIBILITY IDEOGRAPH-2F9B7;Lo;0;L;86A9;;;;N;;;;; +2F9B8;CJK COMPATIBILITY IDEOGRAPH-2F9B8;Lo;0;L;8688;;;;N;;;;; +2F9B9;CJK COMPATIBILITY IDEOGRAPH-2F9B9;Lo;0;L;870E;;;;N;;;;; +2F9BA;CJK COMPATIBILITY IDEOGRAPH-2F9BA;Lo;0;L;86E2;;;;N;;;;; +2F9BB;CJK COMPATIBILITY IDEOGRAPH-2F9BB;Lo;0;L;8779;;;;N;;;;; +2F9BC;CJK COMPATIBILITY IDEOGRAPH-2F9BC;Lo;0;L;8728;;;;N;;;;; +2F9BD;CJK COMPATIBILITY IDEOGRAPH-2F9BD;Lo;0;L;876B;;;;N;;;;; +2F9BE;CJK COMPATIBILITY IDEOGRAPH-2F9BE;Lo;0;L;8786;;;;N;;;;; +2F9BF;CJK COMPATIBILITY IDEOGRAPH-2F9BF;Lo;0;L;45D7;;;;N;;;;; +2F9C0;CJK COMPATIBILITY IDEOGRAPH-2F9C0;Lo;0;L;87E1;;;;N;;;;; +2F9C1;CJK COMPATIBILITY IDEOGRAPH-2F9C1;Lo;0;L;8801;;;;N;;;;; +2F9C2;CJK COMPATIBILITY IDEOGRAPH-2F9C2;Lo;0;L;45F9;;;;N;;;;; +2F9C3;CJK COMPATIBILITY IDEOGRAPH-2F9C3;Lo;0;L;8860;;;;N;;;;; +2F9C4;CJK COMPATIBILITY IDEOGRAPH-2F9C4;Lo;0;L;8863;;;;N;;;;; +2F9C5;CJK COMPATIBILITY IDEOGRAPH-2F9C5;Lo;0;L;27667;;;;N;;;;; +2F9C6;CJK COMPATIBILITY IDEOGRAPH-2F9C6;Lo;0;L;88D7;;;;N;;;;; +2F9C7;CJK COMPATIBILITY IDEOGRAPH-2F9C7;Lo;0;L;88DE;;;;N;;;;; +2F9C8;CJK COMPATIBILITY IDEOGRAPH-2F9C8;Lo;0;L;4635;;;;N;;;;; +2F9C9;CJK COMPATIBILITY IDEOGRAPH-2F9C9;Lo;0;L;88FA;;;;N;;;;; +2F9CA;CJK COMPATIBILITY IDEOGRAPH-2F9CA;Lo;0;L;34BB;;;;N;;;;; +2F9CB;CJK COMPATIBILITY IDEOGRAPH-2F9CB;Lo;0;L;278AE;;;;N;;;;; +2F9CC;CJK COMPATIBILITY IDEOGRAPH-2F9CC;Lo;0;L;27966;;;;N;;;;; +2F9CD;CJK COMPATIBILITY IDEOGRAPH-2F9CD;Lo;0;L;46BE;;;;N;;;;; +2F9CE;CJK COMPATIBILITY IDEOGRAPH-2F9CE;Lo;0;L;46C7;;;;N;;;;; +2F9CF;CJK COMPATIBILITY IDEOGRAPH-2F9CF;Lo;0;L;8AA0;;;;N;;;;; +2F9D0;CJK COMPATIBILITY IDEOGRAPH-2F9D0;Lo;0;L;8AED;;;;N;;;;; +2F9D1;CJK COMPATIBILITY IDEOGRAPH-2F9D1;Lo;0;L;8B8A;;;;N;;;;; +2F9D2;CJK COMPATIBILITY IDEOGRAPH-2F9D2;Lo;0;L;8C55;;;;N;;;;; +2F9D3;CJK COMPATIBILITY IDEOGRAPH-2F9D3;Lo;0;L;27CA8;;;;N;;;;; +2F9D4;CJK COMPATIBILITY IDEOGRAPH-2F9D4;Lo;0;L;8CAB;;;;N;;;;; +2F9D5;CJK COMPATIBILITY IDEOGRAPH-2F9D5;Lo;0;L;8CC1;;;;N;;;;; +2F9D6;CJK COMPATIBILITY IDEOGRAPH-2F9D6;Lo;0;L;8D1B;;;;N;;;;; +2F9D7;CJK COMPATIBILITY IDEOGRAPH-2F9D7;Lo;0;L;8D77;;;;N;;;;; +2F9D8;CJK COMPATIBILITY IDEOGRAPH-2F9D8;Lo;0;L;27F2F;;;;N;;;;; +2F9D9;CJK COMPATIBILITY IDEOGRAPH-2F9D9;Lo;0;L;20804;;;;N;;;;; +2F9DA;CJK COMPATIBILITY IDEOGRAPH-2F9DA;Lo;0;L;8DCB;;;;N;;;;; +2F9DB;CJK COMPATIBILITY IDEOGRAPH-2F9DB;Lo;0;L;8DBC;;;;N;;;;; +2F9DC;CJK COMPATIBILITY IDEOGRAPH-2F9DC;Lo;0;L;8DF0;;;;N;;;;; +2F9DD;CJK COMPATIBILITY IDEOGRAPH-2F9DD;Lo;0;L;208DE;;;;N;;;;; +2F9DE;CJK COMPATIBILITY IDEOGRAPH-2F9DE;Lo;0;L;8ED4;;;;N;;;;; +2F9DF;CJK COMPATIBILITY IDEOGRAPH-2F9DF;Lo;0;L;8F38;;;;N;;;;; +2F9E0;CJK COMPATIBILITY IDEOGRAPH-2F9E0;Lo;0;L;285D2;;;;N;;;;; +2F9E1;CJK COMPATIBILITY IDEOGRAPH-2F9E1;Lo;0;L;285ED;;;;N;;;;; +2F9E2;CJK COMPATIBILITY IDEOGRAPH-2F9E2;Lo;0;L;9094;;;;N;;;;; +2F9E3;CJK COMPATIBILITY IDEOGRAPH-2F9E3;Lo;0;L;90F1;;;;N;;;;; +2F9E4;CJK COMPATIBILITY IDEOGRAPH-2F9E4;Lo;0;L;9111;;;;N;;;;; +2F9E5;CJK COMPATIBILITY IDEOGRAPH-2F9E5;Lo;0;L;2872E;;;;N;;;;; +2F9E6;CJK COMPATIBILITY IDEOGRAPH-2F9E6;Lo;0;L;911B;;;;N;;;;; +2F9E7;CJK COMPATIBILITY IDEOGRAPH-2F9E7;Lo;0;L;9238;;;;N;;;;; +2F9E8;CJK COMPATIBILITY IDEOGRAPH-2F9E8;Lo;0;L;92D7;;;;N;;;;; +2F9E9;CJK COMPATIBILITY IDEOGRAPH-2F9E9;Lo;0;L;92D8;;;;N;;;;; +2F9EA;CJK COMPATIBILITY IDEOGRAPH-2F9EA;Lo;0;L;927C;;;;N;;;;; +2F9EB;CJK COMPATIBILITY IDEOGRAPH-2F9EB;Lo;0;L;93F9;;;;N;;;;; +2F9EC;CJK COMPATIBILITY IDEOGRAPH-2F9EC;Lo;0;L;9415;;;;N;;;;; +2F9ED;CJK COMPATIBILITY IDEOGRAPH-2F9ED;Lo;0;L;28BFA;;;;N;;;;; +2F9EE;CJK COMPATIBILITY IDEOGRAPH-2F9EE;Lo;0;L;958B;;;;N;;;;; +2F9EF;CJK COMPATIBILITY IDEOGRAPH-2F9EF;Lo;0;L;4995;;;;N;;;;; +2F9F0;CJK COMPATIBILITY IDEOGRAPH-2F9F0;Lo;0;L;95B7;;;;N;;;;; +2F9F1;CJK COMPATIBILITY IDEOGRAPH-2F9F1;Lo;0;L;28D77;;;;N;;;;; +2F9F2;CJK COMPATIBILITY IDEOGRAPH-2F9F2;Lo;0;L;49E6;;;;N;;;;; +2F9F3;CJK COMPATIBILITY IDEOGRAPH-2F9F3;Lo;0;L;96C3;;;;N;;;;; +2F9F4;CJK COMPATIBILITY IDEOGRAPH-2F9F4;Lo;0;L;5DB2;;;;N;;;;; +2F9F5;CJK COMPATIBILITY IDEOGRAPH-2F9F5;Lo;0;L;9723;;;;N;;;;; +2F9F6;CJK COMPATIBILITY IDEOGRAPH-2F9F6;Lo;0;L;29145;;;;N;;;;; +2F9F7;CJK COMPATIBILITY IDEOGRAPH-2F9F7;Lo;0;L;2921A;;;;N;;;;; +2F9F8;CJK COMPATIBILITY IDEOGRAPH-2F9F8;Lo;0;L;4A6E;;;;N;;;;; +2F9F9;CJK COMPATIBILITY IDEOGRAPH-2F9F9;Lo;0;L;4A76;;;;N;;;;; +2F9FA;CJK COMPATIBILITY IDEOGRAPH-2F9FA;Lo;0;L;97E0;;;;N;;;;; +2F9FB;CJK COMPATIBILITY IDEOGRAPH-2F9FB;Lo;0;L;2940A;;;;N;;;;; +2F9FC;CJK COMPATIBILITY IDEOGRAPH-2F9FC;Lo;0;L;4AB2;;;;N;;;;; +2F9FD;CJK COMPATIBILITY IDEOGRAPH-2F9FD;Lo;0;L;29496;;;;N;;;;; +2F9FE;CJK COMPATIBILITY IDEOGRAPH-2F9FE;Lo;0;L;980B;;;;N;;;;; +2F9FF;CJK COMPATIBILITY IDEOGRAPH-2F9FF;Lo;0;L;980B;;;;N;;;;; +2FA00;CJK COMPATIBILITY IDEOGRAPH-2FA00;Lo;0;L;9829;;;;N;;;;; +2FA01;CJK COMPATIBILITY IDEOGRAPH-2FA01;Lo;0;L;295B6;;;;N;;;;; +2FA02;CJK COMPATIBILITY IDEOGRAPH-2FA02;Lo;0;L;98E2;;;;N;;;;; +2FA03;CJK COMPATIBILITY IDEOGRAPH-2FA03;Lo;0;L;4B33;;;;N;;;;; +2FA04;CJK COMPATIBILITY IDEOGRAPH-2FA04;Lo;0;L;9929;;;;N;;;;; +2FA05;CJK COMPATIBILITY IDEOGRAPH-2FA05;Lo;0;L;99A7;;;;N;;;;; +2FA06;CJK COMPATIBILITY IDEOGRAPH-2FA06;Lo;0;L;99C2;;;;N;;;;; +2FA07;CJK COMPATIBILITY IDEOGRAPH-2FA07;Lo;0;L;99FE;;;;N;;;;; +2FA08;CJK COMPATIBILITY IDEOGRAPH-2FA08;Lo;0;L;4BCE;;;;N;;;;; +2FA09;CJK COMPATIBILITY IDEOGRAPH-2FA09;Lo;0;L;29B30;;;;N;;;;; +2FA0A;CJK COMPATIBILITY IDEOGRAPH-2FA0A;Lo;0;L;9B12;;;;N;;;;; +2FA0B;CJK COMPATIBILITY IDEOGRAPH-2FA0B;Lo;0;L;9C40;;;;N;;;;; +2FA0C;CJK COMPATIBILITY IDEOGRAPH-2FA0C;Lo;0;L;9CFD;;;;N;;;;; +2FA0D;CJK COMPATIBILITY IDEOGRAPH-2FA0D;Lo;0;L;4CCE;;;;N;;;;; +2FA0E;CJK COMPATIBILITY IDEOGRAPH-2FA0E;Lo;0;L;4CED;;;;N;;;;; +2FA0F;CJK COMPATIBILITY IDEOGRAPH-2FA0F;Lo;0;L;9D67;;;;N;;;;; +2FA10;CJK COMPATIBILITY IDEOGRAPH-2FA10;Lo;0;L;2A0CE;;;;N;;;;; +2FA11;CJK COMPATIBILITY IDEOGRAPH-2FA11;Lo;0;L;4CF8;;;;N;;;;; +2FA12;CJK COMPATIBILITY IDEOGRAPH-2FA12;Lo;0;L;2A105;;;;N;;;;; +2FA13;CJK COMPATIBILITY IDEOGRAPH-2FA13;Lo;0;L;2A20E;;;;N;;;;; +2FA14;CJK COMPATIBILITY IDEOGRAPH-2FA14;Lo;0;L;2A291;;;;N;;;;; +2FA15;CJK COMPATIBILITY IDEOGRAPH-2FA15;Lo;0;L;9EBB;;;;N;;;;; +2FA16;CJK COMPATIBILITY IDEOGRAPH-2FA16;Lo;0;L;4D56;;;;N;;;;; +2FA17;CJK COMPATIBILITY IDEOGRAPH-2FA17;Lo;0;L;9EF9;;;;N;;;;; +2FA18;CJK COMPATIBILITY IDEOGRAPH-2FA18;Lo;0;L;9EFE;;;;N;;;;; +2FA19;CJK COMPATIBILITY IDEOGRAPH-2FA19;Lo;0;L;9F05;;;;N;;;;; +2FA1A;CJK COMPATIBILITY IDEOGRAPH-2FA1A;Lo;0;L;9F0F;;;;N;;;;; +2FA1B;CJK COMPATIBILITY IDEOGRAPH-2FA1B;Lo;0;L;9F16;;;;N;;;;; +2FA1C;CJK COMPATIBILITY IDEOGRAPH-2FA1C;Lo;0;L;9F3B;;;;N;;;;; +2FA1D;CJK COMPATIBILITY IDEOGRAPH-2FA1D;Lo;0;L;2A600;;;;N;;;;; +E0001;LANGUAGE TAG;Cf;0;BN;;;;;N;;;;; +E0020;TAG SPACE;Cf;0;BN;;;;;N;;;;; +E0021;TAG EXCLAMATION MARK;Cf;0;BN;;;;;N;;;;; +E0022;TAG QUOTATION MARK;Cf;0;BN;;;;;N;;;;; +E0023;TAG NUMBER SIGN;Cf;0;BN;;;;;N;;;;; +E0024;TAG DOLLAR SIGN;Cf;0;BN;;;;;N;;;;; +E0025;TAG PERCENT SIGN;Cf;0;BN;;;;;N;;;;; +E0026;TAG AMPERSAND;Cf;0;BN;;;;;N;;;;; +E0027;TAG APOSTROPHE;Cf;0;BN;;;;;N;;;;; +E0028;TAG LEFT PARENTHESIS;Cf;0;BN;;;;;N;;;;; +E0029;TAG RIGHT PARENTHESIS;Cf;0;BN;;;;;N;;;;; +E002A;TAG ASTERISK;Cf;0;BN;;;;;N;;;;; +E002B;TAG PLUS SIGN;Cf;0;BN;;;;;N;;;;; +E002C;TAG COMMA;Cf;0;BN;;;;;N;;;;; +E002D;TAG HYPHEN-MINUS;Cf;0;BN;;;;;N;;;;; +E002E;TAG FULL STOP;Cf;0;BN;;;;;N;;;;; +E002F;TAG SOLIDUS;Cf;0;BN;;;;;N;;;;; +E0030;TAG DIGIT ZERO;Cf;0;BN;;;;;N;;;;; +E0031;TAG DIGIT ONE;Cf;0;BN;;;;;N;;;;; +E0032;TAG DIGIT TWO;Cf;0;BN;;;;;N;;;;; +E0033;TAG DIGIT THREE;Cf;0;BN;;;;;N;;;;; +E0034;TAG DIGIT FOUR;Cf;0;BN;;;;;N;;;;; +E0035;TAG DIGIT FIVE;Cf;0;BN;;;;;N;;;;; +E0036;TAG DIGIT SIX;Cf;0;BN;;;;;N;;;;; +E0037;TAG DIGIT SEVEN;Cf;0;BN;;;;;N;;;;; +E0038;TAG DIGIT EIGHT;Cf;0;BN;;;;;N;;;;; +E0039;TAG DIGIT NINE;Cf;0;BN;;;;;N;;;;; +E003A;TAG COLON;Cf;0;BN;;;;;N;;;;; +E003B;TAG SEMICOLON;Cf;0;BN;;;;;N;;;;; +E003C;TAG LESS-THAN SIGN;Cf;0;BN;;;;;N;;;;; +E003D;TAG EQUALS SIGN;Cf;0;BN;;;;;N;;;;; +E003E;TAG GREATER-THAN SIGN;Cf;0;BN;;;;;N;;;;; +E003F;TAG QUESTION MARK;Cf;0;BN;;;;;N;;;;; +E0040;TAG COMMERCIAL AT;Cf;0;BN;;;;;N;;;;; +E0041;TAG LATIN CAPITAL LETTER A;Cf;0;BN;;;;;N;;;;; +E0042;TAG LATIN CAPITAL LETTER B;Cf;0;BN;;;;;N;;;;; +E0043;TAG LATIN CAPITAL LETTER C;Cf;0;BN;;;;;N;;;;; +E0044;TAG LATIN CAPITAL LETTER D;Cf;0;BN;;;;;N;;;;; +E0045;TAG LATIN CAPITAL LETTER E;Cf;0;BN;;;;;N;;;;; +E0046;TAG LATIN CAPITAL LETTER F;Cf;0;BN;;;;;N;;;;; +E0047;TAG LATIN CAPITAL LETTER G;Cf;0;BN;;;;;N;;;;; +E0048;TAG LATIN CAPITAL LETTER H;Cf;0;BN;;;;;N;;;;; +E0049;TAG LATIN CAPITAL LETTER I;Cf;0;BN;;;;;N;;;;; +E004A;TAG LATIN CAPITAL LETTER J;Cf;0;BN;;;;;N;;;;; +E004B;TAG LATIN CAPITAL LETTER K;Cf;0;BN;;;;;N;;;;; +E004C;TAG LATIN CAPITAL LETTER L;Cf;0;BN;;;;;N;;;;; +E004D;TAG LATIN CAPITAL LETTER M;Cf;0;BN;;;;;N;;;;; +E004E;TAG LATIN CAPITAL LETTER N;Cf;0;BN;;;;;N;;;;; +E004F;TAG LATIN CAPITAL LETTER O;Cf;0;BN;;;;;N;;;;; +E0050;TAG LATIN CAPITAL LETTER P;Cf;0;BN;;;;;N;;;;; +E0051;TAG LATIN CAPITAL LETTER Q;Cf;0;BN;;;;;N;;;;; +E0052;TAG LATIN CAPITAL LETTER R;Cf;0;BN;;;;;N;;;;; +E0053;TAG LATIN CAPITAL LETTER S;Cf;0;BN;;;;;N;;;;; +E0054;TAG LATIN CAPITAL LETTER T;Cf;0;BN;;;;;N;;;;; +E0055;TAG LATIN CAPITAL LETTER U;Cf;0;BN;;;;;N;;;;; +E0056;TAG LATIN CAPITAL LETTER V;Cf;0;BN;;;;;N;;;;; +E0057;TAG LATIN CAPITAL LETTER W;Cf;0;BN;;;;;N;;;;; +E0058;TAG LATIN CAPITAL LETTER X;Cf;0;BN;;;;;N;;;;; +E0059;TAG LATIN CAPITAL LETTER Y;Cf;0;BN;;;;;N;;;;; +E005A;TAG LATIN CAPITAL LETTER Z;Cf;0;BN;;;;;N;;;;; +E005B;TAG LEFT SQUARE BRACKET;Cf;0;BN;;;;;N;;;;; +E005C;TAG REVERSE SOLIDUS;Cf;0;BN;;;;;N;;;;; +E005D;TAG RIGHT SQUARE BRACKET;Cf;0;BN;;;;;N;;;;; +E005E;TAG CIRCUMFLEX ACCENT;Cf;0;BN;;;;;N;;;;; +E005F;TAG LOW LINE;Cf;0;BN;;;;;N;;;;; +E0060;TAG GRAVE ACCENT;Cf;0;BN;;;;;N;;;;; +E0061;TAG LATIN SMALL LETTER A;Cf;0;BN;;;;;N;;;;; +E0062;TAG LATIN SMALL LETTER B;Cf;0;BN;;;;;N;;;;; +E0063;TAG LATIN SMALL LETTER C;Cf;0;BN;;;;;N;;;;; +E0064;TAG LATIN SMALL LETTER D;Cf;0;BN;;;;;N;;;;; +E0065;TAG LATIN SMALL LETTER E;Cf;0;BN;;;;;N;;;;; +E0066;TAG LATIN SMALL LETTER F;Cf;0;BN;;;;;N;;;;; +E0067;TAG LATIN SMALL LETTER G;Cf;0;BN;;;;;N;;;;; +E0068;TAG LATIN SMALL LETTER H;Cf;0;BN;;;;;N;;;;; +E0069;TAG LATIN SMALL LETTER I;Cf;0;BN;;;;;N;;;;; +E006A;TAG LATIN SMALL LETTER J;Cf;0;BN;;;;;N;;;;; +E006B;TAG LATIN SMALL LETTER K;Cf;0;BN;;;;;N;;;;; +E006C;TAG LATIN SMALL LETTER L;Cf;0;BN;;;;;N;;;;; +E006D;TAG LATIN SMALL LETTER M;Cf;0;BN;;;;;N;;;;; +E006E;TAG LATIN SMALL LETTER N;Cf;0;BN;;;;;N;;;;; +E006F;TAG LATIN SMALL LETTER O;Cf;0;BN;;;;;N;;;;; +E0070;TAG LATIN SMALL LETTER P;Cf;0;BN;;;;;N;;;;; +E0071;TAG LATIN SMALL LETTER Q;Cf;0;BN;;;;;N;;;;; +E0072;TAG LATIN SMALL LETTER R;Cf;0;BN;;;;;N;;;;; +E0073;TAG LATIN SMALL LETTER S;Cf;0;BN;;;;;N;;;;; +E0074;TAG LATIN SMALL LETTER T;Cf;0;BN;;;;;N;;;;; +E0075;TAG LATIN SMALL LETTER U;Cf;0;BN;;;;;N;;;;; +E0076;TAG LATIN SMALL LETTER V;Cf;0;BN;;;;;N;;;;; +E0077;TAG LATIN SMALL LETTER W;Cf;0;BN;;;;;N;;;;; +E0078;TAG LATIN SMALL LETTER X;Cf;0;BN;;;;;N;;;;; +E0079;TAG LATIN SMALL LETTER Y;Cf;0;BN;;;;;N;;;;; +E007A;TAG LATIN SMALL LETTER Z;Cf;0;BN;;;;;N;;;;; +E007B;TAG LEFT CURLY BRACKET;Cf;0;BN;;;;;N;;;;; +E007C;TAG VERTICAL LINE;Cf;0;BN;;;;;N;;;;; +E007D;TAG RIGHT CURLY BRACKET;Cf;0;BN;;;;;N;;;;; +E007E;TAG TILDE;Cf;0;BN;;;;;N;;;;; +E007F;CANCEL TAG;Cf;0;BN;;;;;N;;;;; +E0100;VARIATION SELECTOR-17;Mn;0;NSM;;;;;N;;;;; +E0101;VARIATION SELECTOR-18;Mn;0;NSM;;;;;N;;;;; +E0102;VARIATION SELECTOR-19;Mn;0;NSM;;;;;N;;;;; +E0103;VARIATION SELECTOR-20;Mn;0;NSM;;;;;N;;;;; +E0104;VARIATION SELECTOR-21;Mn;0;NSM;;;;;N;;;;; +E0105;VARIATION SELECTOR-22;Mn;0;NSM;;;;;N;;;;; +E0106;VARIATION SELECTOR-23;Mn;0;NSM;;;;;N;;;;; +E0107;VARIATION SELECTOR-24;Mn;0;NSM;;;;;N;;;;; +E0108;VARIATION SELECTOR-25;Mn;0;NSM;;;;;N;;;;; +E0109;VARIATION SELECTOR-26;Mn;0;NSM;;;;;N;;;;; +E010A;VARIATION SELECTOR-27;Mn;0;NSM;;;;;N;;;;; +E010B;VARIATION SELECTOR-28;Mn;0;NSM;;;;;N;;;;; +E010C;VARIATION SELECTOR-29;Mn;0;NSM;;;;;N;;;;; +E010D;VARIATION SELECTOR-30;Mn;0;NSM;;;;;N;;;;; +E010E;VARIATION SELECTOR-31;Mn;0;NSM;;;;;N;;;;; +E010F;VARIATION SELECTOR-32;Mn;0;NSM;;;;;N;;;;; +E0110;VARIATION SELECTOR-33;Mn;0;NSM;;;;;N;;;;; +E0111;VARIATION SELECTOR-34;Mn;0;NSM;;;;;N;;;;; +E0112;VARIATION SELECTOR-35;Mn;0;NSM;;;;;N;;;;; +E0113;VARIATION SELECTOR-36;Mn;0;NSM;;;;;N;;;;; +E0114;VARIATION SELECTOR-37;Mn;0;NSM;;;;;N;;;;; +E0115;VARIATION SELECTOR-38;Mn;0;NSM;;;;;N;;;;; +E0116;VARIATION SELECTOR-39;Mn;0;NSM;;;;;N;;;;; +E0117;VARIATION SELECTOR-40;Mn;0;NSM;;;;;N;;;;; +E0118;VARIATION SELECTOR-41;Mn;0;NSM;;;;;N;;;;; +E0119;VARIATION SELECTOR-42;Mn;0;NSM;;;;;N;;;;; +E011A;VARIATION SELECTOR-43;Mn;0;NSM;;;;;N;;;;; +E011B;VARIATION SELECTOR-44;Mn;0;NSM;;;;;N;;;;; +E011C;VARIATION SELECTOR-45;Mn;0;NSM;;;;;N;;;;; +E011D;VARIATION SELECTOR-46;Mn;0;NSM;;;;;N;;;;; +E011E;VARIATION SELECTOR-47;Mn;0;NSM;;;;;N;;;;; +E011F;VARIATION SELECTOR-48;Mn;0;NSM;;;;;N;;;;; +E0120;VARIATION SELECTOR-49;Mn;0;NSM;;;;;N;;;;; +E0121;VARIATION SELECTOR-50;Mn;0;NSM;;;;;N;;;;; +E0122;VARIATION SELECTOR-51;Mn;0;NSM;;;;;N;;;;; +E0123;VARIATION SELECTOR-52;Mn;0;NSM;;;;;N;;;;; +E0124;VARIATION SELECTOR-53;Mn;0;NSM;;;;;N;;;;; +E0125;VARIATION SELECTOR-54;Mn;0;NSM;;;;;N;;;;; +E0126;VARIATION SELECTOR-55;Mn;0;NSM;;;;;N;;;;; +E0127;VARIATION SELECTOR-56;Mn;0;NSM;;;;;N;;;;; +E0128;VARIATION SELECTOR-57;Mn;0;NSM;;;;;N;;;;; +E0129;VARIATION SELECTOR-58;Mn;0;NSM;;;;;N;;;;; +E012A;VARIATION SELECTOR-59;Mn;0;NSM;;;;;N;;;;; +E012B;VARIATION SELECTOR-60;Mn;0;NSM;;;;;N;;;;; +E012C;VARIATION SELECTOR-61;Mn;0;NSM;;;;;N;;;;; +E012D;VARIATION SELECTOR-62;Mn;0;NSM;;;;;N;;;;; +E012E;VARIATION SELECTOR-63;Mn;0;NSM;;;;;N;;;;; +E012F;VARIATION SELECTOR-64;Mn;0;NSM;;;;;N;;;;; +E0130;VARIATION SELECTOR-65;Mn;0;NSM;;;;;N;;;;; +E0131;VARIATION SELECTOR-66;Mn;0;NSM;;;;;N;;;;; +E0132;VARIATION SELECTOR-67;Mn;0;NSM;;;;;N;;;;; +E0133;VARIATION SELECTOR-68;Mn;0;NSM;;;;;N;;;;; +E0134;VARIATION SELECTOR-69;Mn;0;NSM;;;;;N;;;;; +E0135;VARIATION SELECTOR-70;Mn;0;NSM;;;;;N;;;;; +E0136;VARIATION SELECTOR-71;Mn;0;NSM;;;;;N;;;;; +E0137;VARIATION SELECTOR-72;Mn;0;NSM;;;;;N;;;;; +E0138;VARIATION SELECTOR-73;Mn;0;NSM;;;;;N;;;;; +E0139;VARIATION SELECTOR-74;Mn;0;NSM;;;;;N;;;;; +E013A;VARIATION SELECTOR-75;Mn;0;NSM;;;;;N;;;;; +E013B;VARIATION SELECTOR-76;Mn;0;NSM;;;;;N;;;;; +E013C;VARIATION SELECTOR-77;Mn;0;NSM;;;;;N;;;;; +E013D;VARIATION SELECTOR-78;Mn;0;NSM;;;;;N;;;;; +E013E;VARIATION SELECTOR-79;Mn;0;NSM;;;;;N;;;;; +E013F;VARIATION SELECTOR-80;Mn;0;NSM;;;;;N;;;;; +E0140;VARIATION SELECTOR-81;Mn;0;NSM;;;;;N;;;;; +E0141;VARIATION SELECTOR-82;Mn;0;NSM;;;;;N;;;;; +E0142;VARIATION SELECTOR-83;Mn;0;NSM;;;;;N;;;;; +E0143;VARIATION SELECTOR-84;Mn;0;NSM;;;;;N;;;;; +E0144;VARIATION SELECTOR-85;Mn;0;NSM;;;;;N;;;;; +E0145;VARIATION SELECTOR-86;Mn;0;NSM;;;;;N;;;;; +E0146;VARIATION SELECTOR-87;Mn;0;NSM;;;;;N;;;;; +E0147;VARIATION SELECTOR-88;Mn;0;NSM;;;;;N;;;;; +E0148;VARIATION SELECTOR-89;Mn;0;NSM;;;;;N;;;;; +E0149;VARIATION SELECTOR-90;Mn;0;NSM;;;;;N;;;;; +E014A;VARIATION SELECTOR-91;Mn;0;NSM;;;;;N;;;;; +E014B;VARIATION SELECTOR-92;Mn;0;NSM;;;;;N;;;;; +E014C;VARIATION SELECTOR-93;Mn;0;NSM;;;;;N;;;;; +E014D;VARIATION SELECTOR-94;Mn;0;NSM;;;;;N;;;;; +E014E;VARIATION SELECTOR-95;Mn;0;NSM;;;;;N;;;;; +E014F;VARIATION SELECTOR-96;Mn;0;NSM;;;;;N;;;;; +E0150;VARIATION SELECTOR-97;Mn;0;NSM;;;;;N;;;;; +E0151;VARIATION SELECTOR-98;Mn;0;NSM;;;;;N;;;;; +E0152;VARIATION SELECTOR-99;Mn;0;NSM;;;;;N;;;;; +E0153;VARIATION SELECTOR-100;Mn;0;NSM;;;;;N;;;;; +E0154;VARIATION SELECTOR-101;Mn;0;NSM;;;;;N;;;;; +E0155;VARIATION SELECTOR-102;Mn;0;NSM;;;;;N;;;;; +E0156;VARIATION SELECTOR-103;Mn;0;NSM;;;;;N;;;;; +E0157;VARIATION SELECTOR-104;Mn;0;NSM;;;;;N;;;;; +E0158;VARIATION SELECTOR-105;Mn;0;NSM;;;;;N;;;;; +E0159;VARIATION SELECTOR-106;Mn;0;NSM;;;;;N;;;;; +E015A;VARIATION SELECTOR-107;Mn;0;NSM;;;;;N;;;;; +E015B;VARIATION SELECTOR-108;Mn;0;NSM;;;;;N;;;;; +E015C;VARIATION SELECTOR-109;Mn;0;NSM;;;;;N;;;;; +E015D;VARIATION SELECTOR-110;Mn;0;NSM;;;;;N;;;;; +E015E;VARIATION SELECTOR-111;Mn;0;NSM;;;;;N;;;;; +E015F;VARIATION SELECTOR-112;Mn;0;NSM;;;;;N;;;;; +E0160;VARIATION SELECTOR-113;Mn;0;NSM;;;;;N;;;;; +E0161;VARIATION SELECTOR-114;Mn;0;NSM;;;;;N;;;;; +E0162;VARIATION SELECTOR-115;Mn;0;NSM;;;;;N;;;;; +E0163;VARIATION SELECTOR-116;Mn;0;NSM;;;;;N;;;;; +E0164;VARIATION SELECTOR-117;Mn;0;NSM;;;;;N;;;;; +E0165;VARIATION SELECTOR-118;Mn;0;NSM;;;;;N;;;;; +E0166;VARIATION SELECTOR-119;Mn;0;NSM;;;;;N;;;;; +E0167;VARIATION SELECTOR-120;Mn;0;NSM;;;;;N;;;;; +E0168;VARIATION SELECTOR-121;Mn;0;NSM;;;;;N;;;;; +E0169;VARIATION SELECTOR-122;Mn;0;NSM;;;;;N;;;;; +E016A;VARIATION SELECTOR-123;Mn;0;NSM;;;;;N;;;;; +E016B;VARIATION SELECTOR-124;Mn;0;NSM;;;;;N;;;;; +E016C;VARIATION SELECTOR-125;Mn;0;NSM;;;;;N;;;;; +E016D;VARIATION SELECTOR-126;Mn;0;NSM;;;;;N;;;;; +E016E;VARIATION SELECTOR-127;Mn;0;NSM;;;;;N;;;;; +E016F;VARIATION SELECTOR-128;Mn;0;NSM;;;;;N;;;;; +E0170;VARIATION SELECTOR-129;Mn;0;NSM;;;;;N;;;;; +E0171;VARIATION SELECTOR-130;Mn;0;NSM;;;;;N;;;;; +E0172;VARIATION SELECTOR-131;Mn;0;NSM;;;;;N;;;;; +E0173;VARIATION SELECTOR-132;Mn;0;NSM;;;;;N;;;;; +E0174;VARIATION SELECTOR-133;Mn;0;NSM;;;;;N;;;;; +E0175;VARIATION SELECTOR-134;Mn;0;NSM;;;;;N;;;;; +E0176;VARIATION SELECTOR-135;Mn;0;NSM;;;;;N;;;;; +E0177;VARIATION SELECTOR-136;Mn;0;NSM;;;;;N;;;;; +E0178;VARIATION SELECTOR-137;Mn;0;NSM;;;;;N;;;;; +E0179;VARIATION SELECTOR-138;Mn;0;NSM;;;;;N;;;;; +E017A;VARIATION SELECTOR-139;Mn;0;NSM;;;;;N;;;;; +E017B;VARIATION SELECTOR-140;Mn;0;NSM;;;;;N;;;;; +E017C;VARIATION SELECTOR-141;Mn;0;NSM;;;;;N;;;;; +E017D;VARIATION SELECTOR-142;Mn;0;NSM;;;;;N;;;;; +E017E;VARIATION SELECTOR-143;Mn;0;NSM;;;;;N;;;;; +E017F;VARIATION SELECTOR-144;Mn;0;NSM;;;;;N;;;;; +E0180;VARIATION SELECTOR-145;Mn;0;NSM;;;;;N;;;;; +E0181;VARIATION SELECTOR-146;Mn;0;NSM;;;;;N;;;;; +E0182;VARIATION SELECTOR-147;Mn;0;NSM;;;;;N;;;;; +E0183;VARIATION SELECTOR-148;Mn;0;NSM;;;;;N;;;;; +E0184;VARIATION SELECTOR-149;Mn;0;NSM;;;;;N;;;;; +E0185;VARIATION SELECTOR-150;Mn;0;NSM;;;;;N;;;;; +E0186;VARIATION SELECTOR-151;Mn;0;NSM;;;;;N;;;;; +E0187;VARIATION SELECTOR-152;Mn;0;NSM;;;;;N;;;;; +E0188;VARIATION SELECTOR-153;Mn;0;NSM;;;;;N;;;;; +E0189;VARIATION SELECTOR-154;Mn;0;NSM;;;;;N;;;;; +E018A;VARIATION SELECTOR-155;Mn;0;NSM;;;;;N;;;;; +E018B;VARIATION SELECTOR-156;Mn;0;NSM;;;;;N;;;;; +E018C;VARIATION SELECTOR-157;Mn;0;NSM;;;;;N;;;;; +E018D;VARIATION SELECTOR-158;Mn;0;NSM;;;;;N;;;;; +E018E;VARIATION SELECTOR-159;Mn;0;NSM;;;;;N;;;;; +E018F;VARIATION SELECTOR-160;Mn;0;NSM;;;;;N;;;;; +E0190;VARIATION SELECTOR-161;Mn;0;NSM;;;;;N;;;;; +E0191;VARIATION SELECTOR-162;Mn;0;NSM;;;;;N;;;;; +E0192;VARIATION SELECTOR-163;Mn;0;NSM;;;;;N;;;;; +E0193;VARIATION SELECTOR-164;Mn;0;NSM;;;;;N;;;;; +E0194;VARIATION SELECTOR-165;Mn;0;NSM;;;;;N;;;;; +E0195;VARIATION SELECTOR-166;Mn;0;NSM;;;;;N;;;;; +E0196;VARIATION SELECTOR-167;Mn;0;NSM;;;;;N;;;;; +E0197;VARIATION SELECTOR-168;Mn;0;NSM;;;;;N;;;;; +E0198;VARIATION SELECTOR-169;Mn;0;NSM;;;;;N;;;;; +E0199;VARIATION SELECTOR-170;Mn;0;NSM;;;;;N;;;;; +E019A;VARIATION SELECTOR-171;Mn;0;NSM;;;;;N;;;;; +E019B;VARIATION SELECTOR-172;Mn;0;NSM;;;;;N;;;;; +E019C;VARIATION SELECTOR-173;Mn;0;NSM;;;;;N;;;;; +E019D;VARIATION SELECTOR-174;Mn;0;NSM;;;;;N;;;;; +E019E;VARIATION SELECTOR-175;Mn;0;NSM;;;;;N;;;;; +E019F;VARIATION SELECTOR-176;Mn;0;NSM;;;;;N;;;;; +E01A0;VARIATION SELECTOR-177;Mn;0;NSM;;;;;N;;;;; +E01A1;VARIATION SELECTOR-178;Mn;0;NSM;;;;;N;;;;; +E01A2;VARIATION SELECTOR-179;Mn;0;NSM;;;;;N;;;;; +E01A3;VARIATION SELECTOR-180;Mn;0;NSM;;;;;N;;;;; +E01A4;VARIATION SELECTOR-181;Mn;0;NSM;;;;;N;;;;; +E01A5;VARIATION SELECTOR-182;Mn;0;NSM;;;;;N;;;;; +E01A6;VARIATION SELECTOR-183;Mn;0;NSM;;;;;N;;;;; +E01A7;VARIATION SELECTOR-184;Mn;0;NSM;;;;;N;;;;; +E01A8;VARIATION SELECTOR-185;Mn;0;NSM;;;;;N;;;;; +E01A9;VARIATION SELECTOR-186;Mn;0;NSM;;;;;N;;;;; +E01AA;VARIATION SELECTOR-187;Mn;0;NSM;;;;;N;;;;; +E01AB;VARIATION SELECTOR-188;Mn;0;NSM;;;;;N;;;;; +E01AC;VARIATION SELECTOR-189;Mn;0;NSM;;;;;N;;;;; +E01AD;VARIATION SELECTOR-190;Mn;0;NSM;;;;;N;;;;; +E01AE;VARIATION SELECTOR-191;Mn;0;NSM;;;;;N;;;;; +E01AF;VARIATION SELECTOR-192;Mn;0;NSM;;;;;N;;;;; +E01B0;VARIATION SELECTOR-193;Mn;0;NSM;;;;;N;;;;; +E01B1;VARIATION SELECTOR-194;Mn;0;NSM;;;;;N;;;;; +E01B2;VARIATION SELECTOR-195;Mn;0;NSM;;;;;N;;;;; +E01B3;VARIATION SELECTOR-196;Mn;0;NSM;;;;;N;;;;; +E01B4;VARIATION SELECTOR-197;Mn;0;NSM;;;;;N;;;;; +E01B5;VARIATION SELECTOR-198;Mn;0;NSM;;;;;N;;;;; +E01B6;VARIATION SELECTOR-199;Mn;0;NSM;;;;;N;;;;; +E01B7;VARIATION SELECTOR-200;Mn;0;NSM;;;;;N;;;;; +E01B8;VARIATION SELECTOR-201;Mn;0;NSM;;;;;N;;;;; +E01B9;VARIATION SELECTOR-202;Mn;0;NSM;;;;;N;;;;; +E01BA;VARIATION SELECTOR-203;Mn;0;NSM;;;;;N;;;;; +E01BB;VARIATION SELECTOR-204;Mn;0;NSM;;;;;N;;;;; +E01BC;VARIATION SELECTOR-205;Mn;0;NSM;;;;;N;;;;; +E01BD;VARIATION SELECTOR-206;Mn;0;NSM;;;;;N;;;;; +E01BE;VARIATION SELECTOR-207;Mn;0;NSM;;;;;N;;;;; +E01BF;VARIATION SELECTOR-208;Mn;0;NSM;;;;;N;;;;; +E01C0;VARIATION SELECTOR-209;Mn;0;NSM;;;;;N;;;;; +E01C1;VARIATION SELECTOR-210;Mn;0;NSM;;;;;N;;;;; +E01C2;VARIATION SELECTOR-211;Mn;0;NSM;;;;;N;;;;; +E01C3;VARIATION SELECTOR-212;Mn;0;NSM;;;;;N;;;;; +E01C4;VARIATION SELECTOR-213;Mn;0;NSM;;;;;N;;;;; +E01C5;VARIATION SELECTOR-214;Mn;0;NSM;;;;;N;;;;; +E01C6;VARIATION SELECTOR-215;Mn;0;NSM;;;;;N;;;;; +E01C7;VARIATION SELECTOR-216;Mn;0;NSM;;;;;N;;;;; +E01C8;VARIATION SELECTOR-217;Mn;0;NSM;;;;;N;;;;; +E01C9;VARIATION SELECTOR-218;Mn;0;NSM;;;;;N;;;;; +E01CA;VARIATION SELECTOR-219;Mn;0;NSM;;;;;N;;;;; +E01CB;VARIATION SELECTOR-220;Mn;0;NSM;;;;;N;;;;; +E01CC;VARIATION SELECTOR-221;Mn;0;NSM;;;;;N;;;;; +E01CD;VARIATION SELECTOR-222;Mn;0;NSM;;;;;N;;;;; +E01CE;VARIATION SELECTOR-223;Mn;0;NSM;;;;;N;;;;; +E01CF;VARIATION SELECTOR-224;Mn;0;NSM;;;;;N;;;;; +E01D0;VARIATION SELECTOR-225;Mn;0;NSM;;;;;N;;;;; +E01D1;VARIATION SELECTOR-226;Mn;0;NSM;;;;;N;;;;; +E01D2;VARIATION SELECTOR-227;Mn;0;NSM;;;;;N;;;;; +E01D3;VARIATION SELECTOR-228;Mn;0;NSM;;;;;N;;;;; +E01D4;VARIATION SELECTOR-229;Mn;0;NSM;;;;;N;;;;; +E01D5;VARIATION SELECTOR-230;Mn;0;NSM;;;;;N;;;;; +E01D6;VARIATION SELECTOR-231;Mn;0;NSM;;;;;N;;;;; +E01D7;VARIATION SELECTOR-232;Mn;0;NSM;;;;;N;;;;; +E01D8;VARIATION SELECTOR-233;Mn;0;NSM;;;;;N;;;;; +E01D9;VARIATION SELECTOR-234;Mn;0;NSM;;;;;N;;;;; +E01DA;VARIATION SELECTOR-235;Mn;0;NSM;;;;;N;;;;; +E01DB;VARIATION SELECTOR-236;Mn;0;NSM;;;;;N;;;;; +E01DC;VARIATION SELECTOR-237;Mn;0;NSM;;;;;N;;;;; +E01DD;VARIATION SELECTOR-238;Mn;0;NSM;;;;;N;;;;; +E01DE;VARIATION SELECTOR-239;Mn;0;NSM;;;;;N;;;;; +E01DF;VARIATION SELECTOR-240;Mn;0;NSM;;;;;N;;;;; +E01E0;VARIATION SELECTOR-241;Mn;0;NSM;;;;;N;;;;; +E01E1;VARIATION SELECTOR-242;Mn;0;NSM;;;;;N;;;;; +E01E2;VARIATION SELECTOR-243;Mn;0;NSM;;;;;N;;;;; +E01E3;VARIATION SELECTOR-244;Mn;0;NSM;;;;;N;;;;; +E01E4;VARIATION SELECTOR-245;Mn;0;NSM;;;;;N;;;;; +E01E5;VARIATION SELECTOR-246;Mn;0;NSM;;;;;N;;;;; +E01E6;VARIATION SELECTOR-247;Mn;0;NSM;;;;;N;;;;; +E01E7;VARIATION SELECTOR-248;Mn;0;NSM;;;;;N;;;;; +E01E8;VARIATION SELECTOR-249;Mn;0;NSM;;;;;N;;;;; +E01E9;VARIATION SELECTOR-250;Mn;0;NSM;;;;;N;;;;; +E01EA;VARIATION SELECTOR-251;Mn;0;NSM;;;;;N;;;;; +E01EB;VARIATION SELECTOR-252;Mn;0;NSM;;;;;N;;;;; +E01EC;VARIATION SELECTOR-253;Mn;0;NSM;;;;;N;;;;; +E01ED;VARIATION SELECTOR-254;Mn;0;NSM;;;;;N;;;;; +E01EE;VARIATION SELECTOR-255;Mn;0;NSM;;;;;N;;;;; +E01EF;VARIATION SELECTOR-256;Mn;0;NSM;;;;;N;;;;; +F0000;<Plane 15 Private Use, First>;Co;0;L;;;;;N;;;;; +FFFFD;<Plane 15 Private Use, Last>;Co;0;L;;;;;N;;;;; +100000;<Plane 16 Private Use, First>;Co;0;L;;;;;N;;;;; +10FFFD;<Plane 16 Private Use, Last>;Co;0;L;;;;;N;;;;; diff --git a/test/jdk/java/lang/Character/UnicodeSpec.java b/test/jdk/java/lang/Character/UnicodeSpec.java new file mode 100644 index 00000000000..1c0af1e67e9 --- /dev/null +++ b/test/jdk/java/lang/Character/UnicodeSpec.java @@ -0,0 +1,756 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.File; +import java.util.regex.Pattern; +import java.util.ArrayList; + +/** + * The UnicodeSpec class provides a way to read in Unicode character + * properties from a Unicode data file. One instance of class UnicodeSpec + * holds a decoded version of one line of the data file. The file may + * be obtained from www.unicode.org. The method readSpecFile returns an array + * of UnicodeSpec objects. + * + * @author Guy Steele + * @author John O'Conner + */ + +public class UnicodeSpec { + + public UnicodeSpec() { + this(0xffff); + } + + public UnicodeSpec(int codePoint) { + this.codePoint = codePoint; + generalCategory = UNASSIGNED; + bidiCategory = DIRECTIONALITY_UNDEFINED; + mirrored = false; + titleMap = 0xFFFF; + upperMap = 0xFFFF; + lowerMap = 0xFFFF; + decimalValue = -1; + digitValue = -1; + numericValue = ""; + oldName = null; + comment = null; + name = null; + } + + public String toString() { + StringBuffer result = new StringBuffer(hex6(codePoint)); + if (getUpperMap() != 0xffff) { + result.append(", upper=").append(hex6(upperMap)); + } + if (getLowerMap() != 0xffff) { + result.append(", lower=").append(hex6(lowerMap)); + } + if (getTitleMap() != 0xffff) { + result.append(", title=").append(hex6(titleMap)); + } + return result.toString(); + } + + static String hex4(int n) { + String q = Long.toHexString(n & 0xFFFF).toUpperCase(); + return "0000".substring(Math.min(4, q.length())) + q; + } + + static String hex6(int n) { + String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase(); + return "000000".substring(Math.min(6, str.length())) + str; + + } + + + /** + * Given one line of a Unicode data file as a String, parse the line + * and return a UnicodeSpec object that contains the same character information. + * + * @param s a line of the Unicode data file to be parsed + * @return a UnicodeSpec object, or null if the parsing process failed for some reason + */ + public static UnicodeSpec parse(String s) { + UnicodeSpec spec = null; + String[] tokens = null; + + try { + tokens = tokenSeparator.split(s, REQUIRED_FIELDS); + spec = new UnicodeSpec(); + spec.setCodePoint(parseCodePoint(tokens[FIELD_VALUE])); + spec.setName(parseName(tokens[FIELD_NAME])); + spec.setGeneralCategory(parseGeneralCategory(tokens[FIELD_CATEGORY])); + spec.setBidiCategory(parseBidiCategory(tokens[FIELD_BIDI])); + spec.setCombiningClass(parseCombiningClass(tokens[FIELD_CLASS])); + spec.setDecomposition(parseDecomposition(tokens[FIELD_DECOMPOSITION])); + spec.setDecimalValue(parseDecimalValue(tokens[FIELD_DECIMAL])); + spec.setDigitValue(parseDigitValue(tokens[FIELD_DIGIT])); + spec.setNumericValue(parseNumericValue(tokens[FIELD_NUMERIC])); + spec.setMirrored(parseMirrored(tokens[FIELD_MIRRORED])); + spec.setOldName(parseOldName(tokens[FIELD_OLDNAME])); + spec.setComment(parseComment(tokens[FIELD_COMMENT])); + spec.setUpperMap(parseUpperMap(tokens[FIELD_UPPERCASE])); + spec.setLowerMap(parseLowerMap(tokens[FIELD_LOWERCASE])); + spec.setTitleMap(parseTitleMap(tokens[FIELD_TITLECASE])); + } + catch(Exception e) { + spec = null; + System.out.println("Error parsing spec line."); + } + return spec; + } + + /** + * Parse the codePoint attribute for a Unicode character. If the parse succeeds, + * the codePoint field of this UnicodeSpec object is updated and false is returned. + * + * The codePoint attribute should be a four-digit hexadecimal integer. + * + * @param s the codePoint attribute extracted from a line of the Unicode data file + * @return code point if successful + * @exception NumberFormatException if unable to parse argument + */ + public static int parseCodePoint(String s) throws NumberFormatException { + return Integer.parseInt(s, 16); + } + + public static String parseName(String s) throws Exception { + if (s==null) throw new Exception("Cannot parse name."); + return s; + } + + public static byte parseGeneralCategory(String s) throws Exception { + byte category = GENERAL_CATEGORY_COUNT; + + for (byte x=0; x<generalCategoryList.length; x++) { + if (s.equals(generalCategoryList[x][SHORT])) { + category = x; + break; + } + } + if (category >= GENERAL_CATEGORY_COUNT) { + throw new Exception("Could not parse general category."); + } + return category; + } + + public static byte parseBidiCategory(String s) throws Exception { + byte category = DIRECTIONALITY_CATEGORY_COUNT; + + for (byte x=0; x<bidiCategoryList.length; x++) { + if (s.equals(bidiCategoryList[x][SHORT])) { + category = x; + break; + } + } + if (category >= DIRECTIONALITY_CATEGORY_COUNT) { + throw new Exception("Could not parse bidi category."); + } + return category; + } + + + /** + * Parse the combining attribute for a Unicode character. If there is a combining + * attribute and the parse succeeds, then the hasCombining field is set to true, + * the combining field of this UnicodeSpec object is updated, and false is returned. + * If the combining attribute is an empty string, the parse succeeds but the + * hasCombining field is set to false. (and false is returned). + * + * The combining attribute, if any, should be a nonnegative decimal integer. + * + * @param s the combining attribute extracted from a line of the Unicode data file + * @return the combining class value if any, -1 if property not defined + * @exception Exception if can't parse the combining class + */ + + public static int parseCombiningClass(String s) throws Exception { + int combining = -1; + if (s.length()>0) { + combining = Integer.parseInt(s, 10); + } + return combining; + } + + /** + * Parse the decomposition attribute for a Unicode character. If the parse succeeds, + * the decomposition field of this UnicodeSpec object is updated and false is returned. + * + * The decomposition attribute is complicated; for now, it is treated as a string. + * + * @param s the decomposition attribute extracted from a line of the Unicode data file + * @return true if the parse failed; otherwise false + */ + + public static String parseDecomposition(String s) throws Exception { + if (s==null) throw new Exception("Cannot parse decomposition."); + return s; + } + + + /** + * Parse the decimal value attribute for a Unicode character. If there is a decimal value + * attribute and the parse succeeds, then the hasDecimalValue field is set to true, + * the decimalValue field of this UnicodeSpec object is updated, and false is returned. + * If the decimal value attribute is an empty string, the parse succeeds but the + * hasDecimalValue field is set to false. (and false is returned). + * + * The decimal value attribute, if any, should be a nonnegative decimal integer. + * + * @param s the decimal value attribute extracted from a line of the Unicode data file + * @return the decimal value as an int, -1 if no decimal value defined + * @exception NumberFormatException if the parse fails + */ + public static int parseDecimalValue(String s) throws NumberFormatException { + int value = -1; + + if (s.length() > 0) { + value = Integer.parseInt(s, 10); + } + return value; + } + + /** + * Parse the digit value attribute for a Unicode character. If there is a digit value + * attribute and the parse succeeds, then the hasDigitValue field is set to true, + * the digitValue field of this UnicodeSpec object is updated, and false is returned. + * If the digit value attribute is an empty string, the parse succeeds but the + * hasDigitValue field is set to false. (and false is returned). + * + * The digit value attribute, if any, should be a nonnegative decimal integer. + * + * @param s the digit value attribute extracted from a line of the Unicode data file + * @return the digit value as an non-negative int, or -1 if no digit property defined + * @exception NumberFormatException if the parse fails + */ + public static int parseDigitValue(String s) throws NumberFormatException { + int value = -1; + + if (s.length() > 0) { + value = Integer.parseInt(s, 10); + } + return value; + } + + public static String parseNumericValue(String s) throws Exception { + if (s == null) throw new Exception("Cannot parse numeric value."); + return s; + } + + public static String parseComment(String s) throws Exception { + if (s == null) throw new Exception("Cannot parse comment."); + return s; + } + + public static boolean parseMirrored(String s) throws Exception { + boolean mirrored; + if (s.length() == 1) { + if (s.charAt(0) == 'Y') {mirrored = true;} + else if (s.charAt(0) == 'N') {mirrored = false;} + else {throw new Exception("Cannot parse mirrored property.");} + } + else { throw new Exception("Cannot parse mirrored property.");} + return mirrored; + } + + public static String parseOldName(String s) throws Exception { + if (s == null) throw new Exception("Cannot parse old name"); + return s; + } + + /** + * Parse the uppercase mapping attribute for a Unicode character. If there is a uppercase + * mapping attribute and the parse succeeds, then the hasUpperMap field is set to true, + * the upperMap field of this UnicodeSpec object is updated, and false is returned. + * If the uppercase mapping attribute is an empty string, the parse succeeds but the + * hasUpperMap field is set to false. (and false is returned). + * + * The uppercase mapping attribute should be a four-digit hexadecimal integer. + * + * @param s the uppercase mapping attribute extracted from a line of the Unicode data file + * @return uppercase char if defined, \uffff otherwise + * @exception NumberFormatException if parse fails + */ + public static int parseUpperMap(String s) throws NumberFormatException { + int upperCase = 0xFFFF; + + if (s.length() >= 4) { + upperCase = Integer.parseInt(s, 16); + } + else if (s.length() != 0) { + throw new NumberFormatException(); + } + return upperCase; + } + + /** + * Parse the lowercase mapping attribute for a Unicode character. If there is a lowercase + * mapping attribute and the parse succeeds, then the hasLowerMap field is set to true, + * the lowerMap field of this UnicodeSpec object is updated, and false is returned. + * If the lowercase mapping attribute is an empty string, the parse succeeds but the + * hasLowerMap field is set to false. (and false is returned). + * + * The lowercase mapping attribute should be a four-digit hexadecimal integer. + * + * @param s the lowercase mapping attribute extracted from a line of the Unicode data file + * @return lowercase char mapping if defined, \uFFFF otherwise + * @exception NumberFormatException if parse fails + */ + public static int parseLowerMap(String s) throws NumberFormatException { + int lowerCase = 0xFFFF; + + if (s.length() >= 4) { + lowerCase = Integer.parseInt(s, 16); + } + else if (s.length() != 0) { + throw new NumberFormatException(); + } + return lowerCase; + } + + /** + * Parse the titlecase mapping attribute for a Unicode character. If there is a titlecase + * mapping attribute and the parse succeeds, then the hasTitleMap field is set to true, + * the titleMap field of this UnicodeSpec object is updated, and false is returned. + * If the titlecase mapping attribute is an empty string, the parse succeeds but the + * hasTitleMap field is set to false. (and false is returned). + * + * The titlecase mapping attribute should be a four-digit hexadecimal integer. + * + * @param s the titlecase mapping attribute extracted from a line of the Unicode data file + * @return title case char mapping if defined, \uFFFF otherwise + * @exception NumberFormatException if parse fails + */ + public static int parseTitleMap(String s) throws NumberFormatException { + int titleCase = 0xFFFF; + + if (s.length() >= 4) { + titleCase = Integer.parseInt(s, 16); + } + else if (s.length() != 0) { + throw new NumberFormatException(); + } + return titleCase; + } + + /** + * Read and parse a Unicode data file. + * + * @param file a file specifying the Unicode data file to be read + * @return an array of UnicodeSpec objects, one for each line of the + * Unicode data file that could be successfully parsed as + * specifying Unicode character attributes + */ + + public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException { + ArrayList<UnicodeSpec> list = new ArrayList<>(3000); + UnicodeSpec[] result = null; + int count = 0; + BufferedReader f = new BufferedReader(new FileReader(file)); + String line = null; + loop: + while(true) { + try { + line = f.readLine(); + } + catch (IOException e) { + break loop; + } + if (line == null) break loop; + UnicodeSpec item = parse(line.trim()); + int specPlane = item.getCodePoint() >>> 16; + if (specPlane < plane) continue; + if (specPlane > plane) break; + + if (item != null) { + list.add(item); + } + } + result = new UnicodeSpec[list.size()]; + list.toArray(result); + return result; + } + + void setCodePoint(int value) { + codePoint = value; + } + + /** + * Return the code point in this Unicode specification + * @return the char code point representing by the specification + */ + public int getCodePoint() { + return codePoint; + } + + void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + void setGeneralCategory(byte category) { + generalCategory = category; + } + + public byte getGeneralCategory() { + return generalCategory; + } + + void setBidiCategory(byte category) { + bidiCategory = category; + } + + public byte getBidiCategory() { + return bidiCategory; + } + + void setCombiningClass(int combiningClass) { + this.combiningClass = combiningClass; + } + + public int getCombiningClass() { + return combiningClass; + } + + void setDecomposition(String decomposition) { + this.decomposition = decomposition; + } + + public String getDecomposition() { + return decomposition; + } + + void setDecimalValue(int value) { + decimalValue = value; + } + + public int getDecimalValue() { + return decimalValue; + } + + public boolean isDecimalValue() { + return decimalValue != -1; + } + + void setDigitValue(int value) { + digitValue = value; + } + + public int getDigitValue() { + return digitValue; + } + + public boolean isDigitValue() { + return digitValue != -1; + } + + void setNumericValue(String value) { + numericValue = value; + } + + public String getNumericValue() { + return numericValue; + } + + public boolean isNumericValue() { + return numericValue.length() > 0; + } + + void setMirrored(boolean value) { + mirrored = value; + } + + public boolean isMirrored() { + return mirrored; + } + + void setOldName(String name) { + oldName = name; + } + + public String getOldName() { + return oldName; + } + + void setComment(String comment) { + this.comment = comment; + } + + public String getComment() { + return comment; + } + + void setUpperMap(int ch) { + upperMap = ch; + }; + + public int getUpperMap() { + return upperMap; + } + + public boolean hasUpperMap() { + return upperMap != 0xffff; + } + + void setLowerMap(int ch) { + lowerMap = ch; + } + + public int getLowerMap() { + return lowerMap; + } + + public boolean hasLowerMap() { + return lowerMap != 0xffff; + } + + void setTitleMap(int ch) { + titleMap = ch; + } + + public int getTitleMap() { + return titleMap; + } + + public boolean hasTitleMap() { + return titleMap != 0xffff; + } + + int codePoint; // the characters UTF-32 code value + String name; // the ASCII name + byte generalCategory; // general category, available via Characte.getType() + byte bidiCategory; // available via Character.getBidiType() + int combiningClass; // not used in Character + String decomposition; // not used in Character + int decimalValue; // decimal digit value + int digitValue; // not all digits are decimal + String numericValue; // numeric value if digit or non-digit + boolean mirrored; // + String oldName; + String comment; + int upperMap; + int lowerMap; + int titleMap; + + // this is the number of fields in one line of the UnicodeData.txt file + // each field is separated by a semicolon (a token) + static final int REQUIRED_FIELDS = 15; + + /** + * General category types + * To preserve compatibility, these values cannot be changed + */ + public static final byte + UNASSIGNED = 0, // Cn normative + UPPERCASE_LETTER = 1, // Lu normative + LOWERCASE_LETTER = 2, // Ll normative + TITLECASE_LETTER = 3, // Lt normative + MODIFIER_LETTER = 4, // Lm normative + OTHER_LETTER = 5, // Lo normative + NON_SPACING_MARK = 6, // Mn informative + ENCLOSING_MARK = 7, // Me informative + COMBINING_SPACING_MARK = 8, // Mc normative + DECIMAL_DIGIT_NUMBER = 9, // Nd normative + LETTER_NUMBER = 10, // Nl normative + OTHER_NUMBER = 11, // No normative + SPACE_SEPARATOR = 12, // Zs normative + LINE_SEPARATOR = 13, // Zl normative + PARAGRAPH_SEPARATOR = 14, // Zp normative + CONTROL = 15, // Cc normative + FORMAT = 16, // Cf normative + // 17 is unused for no apparent reason, + // but must preserve forward compatibility + PRIVATE_USE = 18, // Co normative + SURROGATE = 19, // Cs normative + DASH_PUNCTUATION = 20, // Pd informative + START_PUNCTUATION = 21, // Ps informative + END_PUNCTUATION = 22, // Pe informative + CONNECTOR_PUNCTUATION = 23, // Pc informative + OTHER_PUNCTUATION = 24, // Po informative + MATH_SYMBOL = 25, // Sm informative + CURRENCY_SYMBOL = 26, // Sc informative + MODIFIER_SYMBOL = 27, // Sk informative + OTHER_SYMBOL = 28, // So informative + INITIAL_QUOTE_PUNCTUATION = 29, // Pi informative + FINAL_QUOTE_PUNCTUATION = 30, // Pf informative + + // this value is only used in the character generation tool + // it can change to accommodate the addition of new categories. + GENERAL_CATEGORY_COUNT = 31; // sentinel value + + static final byte SHORT = 0, LONG = 1; + // general category type strings + // NOTE: The order of this category array is dependent on the assignment of + // category constants above. We want to access this array using constants above. + // [][SHORT] is the SHORT name, [][LONG] is the LONG name + static final String[][] generalCategoryList = { + {"Cn", "UNASSIGNED"}, + {"Lu", "UPPERCASE_LETTER"}, + {"Ll", "LOWERCASE_LETTER"}, + {"Lt", "TITLECASE_LETTER"}, + {"Lm", "MODIFIER_LETTER"}, + {"Lo", "OTHER_LETTER"}, + {"Mn", "NON_SPACING_MARK"}, + {"Me", "ENCLOSING_MARK"}, + {"Mc", "COMBINING_SPACING_MARK"}, + {"Nd", "DECIMAL_DIGIT_NUMBER"}, + {"Nl", "LETTER_NUMBER"}, + {"No", "OTHER_NUMBER"}, + {"Zs", "SPACE_SEPARATOR"}, + {"Zl", "LINE_SEPARATOR"}, + {"Zp", "PARAGRAPH_SEPARATOR"}, + {"Cc", "CONTROL"}, + {"Cf", "FORMAT"}, + {"xx", "unused"}, + {"Co", "PRIVATE_USE"}, + {"Cs", "SURROGATE"}, + {"Pd", "DASH_PUNCTUATION"}, + {"Ps", "START_PUNCTUATION"}, + {"Pe", "END_PUNCTUATION"}, + {"Pc", "CONNECTOR_PUNCTUATION"}, + {"Po", "OTHER_PUNCTUATION"}, + {"Sm", "MATH_SYMBOL"}, + {"Sc", "CURRENCY_SYMBOL"}, + {"Sk", "MODIFIER_SYMBOL"}, + {"So", "OTHER_SYMBOL"}, + {"Pi", "INITIAL_QUOTE_PUNCTUATION"}, + {"Pf", "FINAL_QUOTE_PUNCTUATION"} + }; + + /** + * Bidirectional categories + */ + public static final byte + DIRECTIONALITY_UNDEFINED = -1, + // Strong category + DIRECTIONALITY_LEFT_TO_RIGHT = 0, // L + DIRECTIONALITY_RIGHT_TO_LEFT = 1, // R + DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2, // AL + // Weak category + DIRECTIONALITY_EUROPEAN_NUMBER = 3, // EN + DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4, // ES + DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5, // ET + DIRECTIONALITY_ARABIC_NUMBER = 6, // AN + DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7, // CS + DIRECTIONALITY_NONSPACING_MARK = 8, // NSM + DIRECTIONALITY_BOUNDARY_NEUTRAL = 9, // BN + // Neutral category + DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10, // B + DIRECTIONALITY_SEGMENT_SEPARATOR = 11, // S + DIRECTIONALITY_WHITESPACE = 12, // WS + DIRECTIONALITY_OTHER_NEUTRALS = 13, // ON + + DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14, // LRE + DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15, // LRO + DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16, // RLE + DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17, // RLO + DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18, // PDF + + DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE = 19, // LRI + DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE = 20, // RLI + DIRECTIONALITY_FIRST_STRONG_ISOLATE = 21, // FSI + DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE = 22, // PDI + + DIRECTIONALITY_CATEGORY_COUNT = 23; // sentinel value + + // If changes are made to the above bidi category assignments, this + // list of bidi category names must be changed to keep their order in synch. + // Access this list using the bidi category constants above. + static final String[][] bidiCategoryList = { + {"L", "DIRECTIONALITY_LEFT_TO_RIGHT"}, + {"R", "DIRECTIONALITY_RIGHT_TO_LEFT"}, + {"AL", "DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC"}, + {"EN", "DIRECTIONALITY_EUROPEAN_NUMBER"}, + {"ES", "DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR"}, + {"ET", "DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR"}, + {"AN", "DIRECTIONALITY_ARABIC_NUMBER"}, + {"CS", "DIRECTIONALITY_COMMON_NUMBER_SEPARATOR"}, + {"NSM", "DIRECTIONALITY_NONSPACING_MARK"}, + {"BN", "DIRECTIONALITY_BOUNDARY_NEUTRAL"}, + {"B", "DIRECTIONALITY_PARAGRAPH_SEPARATOR"}, + {"S", "DIRECTIONALITY_SEGMENT_SEPARATOR"}, + {"WS", "DIRECTIONALITY_WHITESPACE"}, + {"ON", "DIRECTIONALITY_OTHER_NEUTRALS"}, + {"LRE", "DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING"}, + {"LRO", "DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE"}, + {"RLE", "DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING"}, + {"RLO", "DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE"}, + {"PDF", "DIRECTIONALITY_POP_DIRECTIONAL_FORMAT"}, + {"LRI", "DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE"}, + {"RLI", "DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE"}, + {"FSI", "DIRECTIONALITY_FIRST_STRONG_ISOLATE"}, + {"PDI", "DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE"}, + + }; + + // Unicode specification lines have fields in this order. + static final byte + FIELD_VALUE = 0, + FIELD_NAME = 1, + FIELD_CATEGORY = 2, + FIELD_CLASS = 3, + FIELD_BIDI = 4, + FIELD_DECOMPOSITION = 5, + FIELD_DECIMAL = 6, + FIELD_DIGIT = 7, + FIELD_NUMERIC = 8, + FIELD_MIRRORED = 9, + FIELD_OLDNAME = 10, + FIELD_COMMENT = 11, + FIELD_UPPERCASE = 12, + FIELD_LOWERCASE = 13, + FIELD_TITLECASE = 14; + + static final Pattern tokenSeparator = Pattern.compile(";"); + + public static void main(String[] args) { + UnicodeSpec[] spec = null; + if (args.length == 2 ) { + try { + File file = new File(args[0]); + int plane = Integer.parseInt(args[1]); + spec = UnicodeSpec.readSpecFile(file, plane); + System.out.println("UnicodeSpec[" + spec.length + "]:"); + for (int x=0; x<spec.length; x++) { + System.out.println(spec[x].toString()); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/test/jdk/java/lang/Character/charprop00.bin b/test/jdk/java/lang/Character/charprop00.bin new file mode 100644 index 00000000000..fb3f2658b3a Binary files /dev/null and b/test/jdk/java/lang/Character/charprop00.bin differ diff --git a/test/jdk/java/lang/Character/charprop01.bin b/test/jdk/java/lang/Character/charprop01.bin new file mode 100644 index 00000000000..15ea910bfd2 Binary files /dev/null and b/test/jdk/java/lang/Character/charprop01.bin differ diff --git a/test/jdk/java/lang/Character/charprop02.bin b/test/jdk/java/lang/Character/charprop02.bin new file mode 100644 index 00000000000..2493ad18a28 Binary files /dev/null and b/test/jdk/java/lang/Character/charprop02.bin differ diff --git a/test/jdk/java/lang/Character/charprop03.bin b/test/jdk/java/lang/Character/charprop03.bin new file mode 100644 index 00000000000..cfc4d35c898 Binary files /dev/null and b/test/jdk/java/lang/Character/charprop03.bin differ diff --git a/test/jdk/java/lang/Character/charprop0E.bin b/test/jdk/java/lang/Character/charprop0E.bin new file mode 100644 index 00000000000..14af6cda2d6 Binary files /dev/null and b/test/jdk/java/lang/Character/charprop0E.bin differ diff --git a/test/jdk/java/lang/Character/charprop0F.bin b/test/jdk/java/lang/Character/charprop0F.bin new file mode 100644 index 00000000000..3d86c4f8937 Binary files /dev/null and b/test/jdk/java/lang/Character/charprop0F.bin differ diff --git a/test/jdk/java/lang/Character/charprop10.bin b/test/jdk/java/lang/Character/charprop10.bin new file mode 100644 index 00000000000..91bcc3ce8c8 Binary files /dev/null and b/test/jdk/java/lang/Character/charprop10.bin differ diff --git a/test/jdk/java/lang/String/SpecialCasingTest.java b/test/jdk/java/lang/String/SpecialCasingTest.java new file mode 100644 index 00000000000..55575346949 --- /dev/null +++ b/test/jdk/java/lang/String/SpecialCasingTest.java @@ -0,0 +1,354 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4397357 6565620 6959267 7070436 7198195 8041791 8032446 8072600 + * @summary Confirm special case mappings are handled correctly. + */ + +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.StringTokenizer; + +public class SpecialCasingTest { + + private static boolean err = false; + + // Locales which are used for testing + private static List<Locale> locales = new ArrayList<>(); + static { + locales.add(new Locale("az", "")); + locales.addAll(java.util.Arrays.asList(Locale.getAvailableLocales())); + } + + // Default locale + private static String defaultLang; + + // True if the default language is az, lt, or tr which has locale-specific + // mappings. + private static boolean specificLocale; + + // Additional test cases + // Pseudo-locales which are used here: + // L1: locales other than lt + // L2: locales other than az and tr + // L3: locales other than az, lt and tr + private static final String[] additionalTestData = { + // Format: + // <code>; <lower>; <title>; <upper>; (<condition_list>) + + // Counterpart of Final_Sigma test case + // 03A3; 03C2; 03A3; 03A3; Final_Sigma + "03A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma1", + "03A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma2", + + // Counterpart of After_Soft_Dotted test case + // 0307; 0307; ; ; lt After_Soft_Dotted + "0307; 0307; 0307; 0307; L1 After_Soft_Dotted", + "0307; 0307; 0307; 0307; lt SunSpecific_Not_After_Soft_Dotted", + "0307; 0307; 0307; 0307; L1 SunSpecific_Not_After_Soft_Dotted", + + // Counterpart of More_Above test cases + // 0049; 0069 0307; 0049; 0049; lt More_Above + "0049; 0131 ; 0049; 0049; az More_Above", + "0049; 0131 ; 0049; 0049; tr More_Above", + "0049; 0069 ; 0049; 0049; L3 More_Above", + "0049; 0069 ; 0049; 0049; lt SunSpecific_Not_More_Above", + "0049; 0131 ; 0049; 0049; az SunSpecific_Not_More_Above", + "0049; 0131 ; 0049; 0049; tr SunSpecific_Not_More_Above", + "0049; 0069 ; 0049; 0049; L3 SunSpecific_Not_More_Above", + // 004A; 006A 0307; 004A; 004A; lt More_Above + "004A; 006A ; 004A; 004A; L1 More_Above", + "004A; 006A ; 004A; 004A; lt SunSpecific_Not_More_Above", + "004A; 006A ; 004A; 004A; L1 SunSpecific_Not_More_Above", + // 012E; 012F 0307; 012E; 012E; lt More_Above + "012E; 012F ; 012E; 012E; L1 More_Above", + "012E; 012F ; 012E; 012E; lt SunSpecific_Not_More_Above", + "012E; 012F ; 012E; 012E; L1 SunSpecific_Not_More_Above", + + // Counterpart of After_I test cases + // 0307; ; 0307; 0307; tr After_I + // 0307; ; 0307; 0307; az After_I + "0307; 0307 0307; 0307; 0307; lt After_I", + "0307; 0307 ; 0307; 0307; L3 After_I", + "0307; 0307 ; 0307; 0307; tr SunSpecific_Not_After_I", + "0307; 0307 ; 0307; 0307; az SunSpecific_Not_After_I", + "0307; 0307 ; 0307; 0307; L2 SunSpecific_Not_After_I", + + // Counterpart of Not_Before_Dot test cases + // 0049; 0131 ; 0049; 0049; tr Not_Before_Dot + // 0049; 0131 ; 0049; 0049; az Not_Before_Dot + "0049; 0069 ; 0049; 0049; L2 Not_Before_Dot", + "0049; 0069 ; 0049; 0049; tr SunSpecific_Before_Dot", + "0049; 0069 ; 0049; 0049; az SunSpecific_Before_Dot", + "0049; 0069 0307 0307; 0049; 0049; lt SunSpecific_Before_Dot", + "0049; 0069 0307 ; 0049; 0049; L3 SunSpecific_Before_Dot", + }; + + public static void main (String[] args) { + SpecialCasingTest specialCasingTest = new SpecialCasingTest(); + specialCasingTest.test(); + } + + private void test () { + Locale defaultLocale = Locale.getDefault(); + BufferedReader in = null; + + try { + int locale_num = locales.size(); + for (int l = 0; l < locale_num; l++) { + Locale locale = locales.get(l); + Locale.setDefault(locale); + System.out.println("Testing on " + locale + " locale...."); + + defaultLang = locale.getLanguage(); + if (defaultLang.equals("az") || + defaultLang.equals("lt") || + defaultLang.equals("tr")) { + specificLocale = true; + } else { + specificLocale = false; + } + in = Files.newBufferedReader(Paths.get(System.getProperty("test.src.path"), "..", "/Character/SpecialCasing.txt") + .toRealPath()); + String line; + while ((line = in.readLine()) != null) { + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } + test(line); + } + in.close(); + in = null; + System.out.println("Testing with Sun original data...."); + for (String additionalTestData1 : additionalTestData) { + test(additionalTestData1); + } + } + } + catch (IOException e) { + err = true; + e.printStackTrace(); + } + finally { + if (in != null) { + try { + in.close(); + } + catch (IOException e) { + } + } + Locale.setDefault(defaultLocale); + if (err) { + throw new RuntimeException("SpecialCasingTest failed."); + } else { + System.out.println("*** SpecialCasingTest passed."); + } + } + } + + private void test(String line) { + int index = line.indexOf('#'); + if (index != -1) { + line = line.substring(0, index); + } + + String lang = null; + String condition = null; + String[] fields = line.split("; "); + + for (int i = 0; i < 4; i++) { + if (fields[i].length() != 0) { + fields[i] = convert(fields[i]); + } + } + if (fields.length != 4) { + StringTokenizer st = new StringTokenizer(fields[4]); + + while (st.hasMoreTokens()) { + String token = st.nextToken(); + + if (token.equals("Final_Sigma")) { + condition = "Final Sigma"; + fields[0] = "Abc" + fields[0]; + fields[1] = "abc" + fields[1]; + fields[3] = "ABC" + fields[3]; + } else if (token.equals("SunSpecific_Not_Final_Sigma1")) { + condition = "*Sun Specific* Not Final Sigma 1"; + fields[0] = "Abc" + fields[0] + "xyz"; + fields[1] = "abc" + fields[1] + "xyz"; + fields[3] = "ABC" + fields[3] + "XYZ"; + } else if (token.equals("SunSpecific_Not_Final_Sigma2")) { + condition = "*Sun Specific* Not Final Sigma 2"; + } else if (token.equals("After_Soft_Dotted")) { + condition = "After Soft-Dotted"; + fields[0] = "\u1E2D" + fields[0]; + fields[1] = "\u1E2D" + fields[1]; + fields[3] = "\u1E2C" + fields[3]; + } else if (token.equals("SunSpecific_Not_After_Soft_Dotted")) { + condition = "*Sun Specific* Not After Soft-Dotted"; + fields[0] = "Dot" + fields[0]; + fields[1] = "dot" + fields[1]; + fields[3] = "DOT" + fields[3]; + } else if (token.equals("More_Above")) { + condition = "More Above"; + fields[0] = fields[0] + "\u0306"; + fields[1] = fields[1] + "\u0306"; + fields[3] = fields[3] + "\u0306"; + } else if (token.equals("SunSpecific_Not_More_Above")) { + condition = "*Sun Specific* Not More Above"; + fields[0] = fields[0] + "breve"; + fields[1] = fields[1] + "breve"; + fields[3] = fields[3] + "BREVE"; + } else if (token.equals("After_I")) { + condition = "After I"; + fields[0] = "I" + fields[0]; + fields[1] = "i" + fields[1]; + fields[3] = "I" + fields[3]; + } else if (token.equals("SunSpecific_Not_After_I")) { + condition = "*Sun Specific* Not After I"; + fields[0] = "A" + fields[0]; + fields[1] = "a" + fields[1]; + fields[3] = "A" + fields[3]; + } else if (token.equals("Not_Before_Dot")) { + condition = "Not Before Dot"; + fields[0] = fields[0] + "Z"; + fields[1] = fields[1] + "z"; + fields[3] = fields[3] + "Z"; + } else if (token.equals("SunSpecific_Before_Dot")) { + condition = "*Sun Specific* Before Dot"; + fields[0] = fields[0] + "\u0307"; + fields[3] = fields[3] + "\u0307"; + } else if (token.length() == 2) { + lang = token; + + if (lang.equals("L1")) { + if (defaultLang.equals("lt")) { + lang = "en"; + } else { + lang = defaultLang; + } + } else if (lang.equals("L2")) { + if (defaultLang.equals("az") || + defaultLang.equals("tr")) { + lang = "en"; + } else { + lang = defaultLang; + } + } else if (lang.equals("L3")) { + if (defaultLang.equals("az") || + defaultLang.equals("lt") || + defaultLang.equals("tr")) { + lang = "en"; + } else { + lang = defaultLang; + } + // I want to have another test case here for double-check. + // Current implementation for Character and String considers + // only az, lt, and tr locales. I want to detect if other + // locales are specified. + } else if (!lang.equals("az") && + !lang.equals("lt") && + !lang.equals("tr")) { + throw new RuntimeException("Unsupported locale: " + + lang + ". It may need to be considered in ConditionalSpecialCasing.java. Please confirm."); + } + } else { + throw new RuntimeException("Unknown condition: " + token); + } + } + } else if (fields[0].equals("\u0130")) { + // special case for \u0130 + if (defaultLang.equals("az") || + defaultLang.equals("tr")) { + lang = "en"; + } else { + lang = defaultLang; + } + } + testLowerCase(fields[0], fields[1], lang, condition); + testUpperCase(fields[0], fields[3], lang, condition); + } + + private void testLowerCase(String orig, String expected, + String lang, String condition) { + String got = (lang == null) ? + orig.toLowerCase() : orig.toLowerCase(new Locale(lang, "")); + + if (!expected.equals(got)) { + err = true; + System.err.println("toLowerCase(lang=" + lang + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected) + + ((condition == null) ? "" : ("\n under condition(" + + condition + ")"))); + } + } + + private void testUpperCase(String orig, String expected, + String lang, String condition) { + String got = (lang == null) ? + orig.toUpperCase() : orig.toUpperCase(new Locale(lang, "")); + + if (!expected.equals(got)) { + err = true; + System.err.println("toUpperCase(lang=" + lang + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected) + + ((condition == null) ? "" : ("\n under condition(" + + condition + ")"))); + } + } + StringBuilder sb = new StringBuilder(); + + private String convert(String str) { + sb.setLength(0); + + String[] tokens = str.split(" "); + for (String token : tokens) { + sb.append((char) Integer.parseInt(token, 16)); + } + return sb.toString(); + } + + private String toString(String str) { + sb.setLength(0); + + int len = str.length(); + for (int i = 0; i < len; i++) { + sb.append("0x").append(Integer.toHexString(str.charAt(i)).toUpperCase()).append(" "); + } + return sb.toString(); + } + +} diff --git a/test/jdk/java/lang/String/UnicodeCasingTest.java b/test/jdk/java/lang/String/UnicodeCasingTest.java new file mode 100644 index 00000000000..a148b975ec0 --- /dev/null +++ b/test/jdk/java/lang/String/UnicodeCasingTest.java @@ -0,0 +1,233 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4397357 6565620 6959267 7070436 7198195 8032446 8072600 + * @summary Confirm normal case mappings are handled correctly. + * @run main/timeout=200 UnicodeCasingTest + */ + +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Locale; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UnicodeCasingTest { + + private static boolean err = false; + + // Locales which are used for testing + private static List<Locale> locales = new ArrayList<>(); + static { + locales.add(new Locale("az", "")); + locales.addAll(java.util.Arrays.asList(Locale.getAvailableLocales())); + } + + // Default locale + private static String defaultLang; + + // List for Unicode characters whose mappings are included in + // SpecialCasing.txt and mappings in UnicodeData.txt isn't applicable. + private static Map<String, String> excludeList = new HashMap<>(); + + public static void main(String[] args) { + UnicodeCasingTest specialCasingTest = new UnicodeCasingTest(); + specialCasingTest.test(); + } + + private void test() { + Locale defaultLocale = Locale.getDefault(); + BufferedReader in = null; + try { + // First, we create exlude lists of characters whose mappings exist + // in SpecialCasing.txt and mapping rules in UnicodeData.txt aren't + // applicable. + in = Files.newBufferedReader(Paths.get(System.getProperty("test.src.path"), "..", "/Character/SpecialCasing.txt") + .toRealPath()); + String line; + while ((line = in.readLine()) != null) { + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } + updateExcludeList(line); + } + in.close(); + in = null; + int locale_num = locales.size(); + for (int l = 0; l < locale_num; l++) { + Locale locale = locales.get(l); + Locale.setDefault(locale); + defaultLang = locale.getLanguage(); +// System.out.println("Testing on " + locale + " locale...."); + System.err.println("Testing on " + locale + " locale...."); + in = Files.newBufferedReader(Paths.get(System.getProperty("test.src.path"), "..", "/Character/UnicodeData.txt") + .toRealPath()); + while ((line = in.readLine()) != null) { + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } + test(line); + } + in.close(); + in = null; + } + } + catch (IOException e) { + err = true; + e.printStackTrace(); + } + finally { + if (in != null) { + try { + in.close(); + } + catch (IOException e) { + } + } + + Locale.setDefault(defaultLocale); + + if (err) { + throw new RuntimeException("UnicodeCasingTest failed."); + } else { + System.out.println("*** UnicodeCasingTest passed."); + } + } + } + + private void updateExcludeList(String line) { + int index = line.indexOf('#'); + if (index != -1) { + line = line.substring(0, index); + } + + String lang = null; + String condition = null; + String[] fields = line.split("; "); + + // If the given character is mapped to multiple characters under the + // normal condition, add it to the exclude list. + if (fields.length == 4) { + excludeList.put(fields[0], "all"); + } else if (fields.length == 5) { + if (fields[4].length() == 2) { /// locale + if (excludeList.get(fields[0]) == null) { + excludeList.put(fields[0], fields[4]); + } + } + } + } + + private void test(String line) { + String[] fields = line.split(";", 15); + String orig = convert(fields[0]); + + String lang = excludeList.get(fields[0]); + if (!"all".equals(lang) && !defaultLang.equals(lang)) { + if (fields[12].length() == 0) { + testUpperCase(orig, convert(fields[0])); + } else { + testUpperCase(orig, convert(fields[12])); + } + + if (fields[13].length() == 0) { + testLowerCase(orig, convert(fields[0])); + } else { + testLowerCase(orig, convert(fields[13])); + } + } + } + + private void testUpperCase(String orig, String expected) { + String got = orig.toUpperCase(); + + // Ugly workaround for special mappings for az and tr locales.... + if (orig.equals("\u0069") && + (defaultLang.equals("az") || defaultLang.equals("tr"))) { + expected = "\u0130"; + } + + if (!expected.equals(got)) { + err = true; + System.err.println("toUpperCase(" + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected)); + } + } + + private void testLowerCase(String orig, String expected) { + String got = orig.toLowerCase(); + // Ugly workaround for special mappings for az and tr locales.... + if (orig.equals("\u0049") && + (defaultLang.equals("az") || defaultLang.equals("tr"))) { + expected = "\u0131"; + } + + if (!expected.equals(got)) { + err = true; + System.err.println("toLowerCase(" + + ") failed.\n\tOriginal: " + toString(orig) + + "\n\tGot: " + toString(got) + + "\n\tExpected: " + toString(expected)); + } + } + + StringBuilder sb = new StringBuilder(); + + private String convert(String str) { + sb.setLength(0); + + String[] tokens = str.split(" "); + for (String token : tokens) { + int j = Integer.parseInt(token, 16); + if (j < Character.MIN_SUPPLEMENTARY_CODE_POINT) { + sb.append((char)j); + } else { + sb.append(Character.toChars(j)); + } + } + + return sb.toString(); + } + + private String toString(String str) { + sb.setLength(0); + + int len = str.length(); + for (int i = 0; i < len; i++) { + sb.append("0x").append(Integer.toHexString(str.charAt(i)).toUpperCase()).append(" "); + } + + return sb.toString(); + } + +} diff --git a/test/jdk/java/lang/invoke/I4Special.jcod b/test/jdk/java/lang/invoke/I4Special.jcod deleted file mode 100644 index a54aa5d753f..00000000000 --- a/test/jdk/java/lang/invoke/I4Special.jcod +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ - -// invokeDirect is modified to use invokespecial instead of invokevirtual - -class SpecialInterfaceCall$I4 { - 0xCAFEBABE; - 0; // minor version - 55; // version - [] { // Constant Pool - ; // first element is empty - Method #3 #13; // #1 - class #15; // #2 - class #16; // #3 - class #17; // #4 - Utf8 "invokeDirect"; // #5 - Utf8 "I4"; // #6 - Utf8 "InnerClasses"; // #7 - Utf8 "(LSpecialInterfaceCall$I4;)V"; // #8 - Utf8 "Code"; // #9 - Utf8 "LineNumberTable"; // #10 - Utf8 "SourceFile"; // #11 - Utf8 "SpecialInterfaceCall.java"; // #12 - NameAndType #19 #20; // #13 - class #21; // #14 - Utf8 "SpecialInterfaceCall$I4"; // #15 - Utf8 "java/lang/Object"; // #16 - Utf8 "SpecialInterfaceCall$I1"; // #17 - Utf8 "I1"; // #18 - Utf8 "toString"; // #19 - Utf8 "()Ljava/lang/String;"; // #20 - Utf8 "SpecialInterfaceCall"; // #21 - } // Constant Pool - - 0x0600; // access - #2;// this_cpx - #3;// super_cpx - - [] { // Interfaces - #4; - } // Interfaces - - [] { // fields - } // fields - - [] { // methods - { // Member - 0x0009; // access - #5; // name_cpx - #8; // sig_cpx - [] { // Attributes - Attr(#9) { // Code - 1; // max_stack - 2; // max_locals - Bytes[]{ -// 0x2AB600014CB1; - 0x2AB700014CB1; // invokespecial - }; - [] { // Traps - } // end Traps - [] { // Attributes - Attr(#10) { // LineNumberTable - [] { // LineNumberTable - 0 77; - 5 78; - } - } // end LineNumberTable - } // Attributes - } // end Code - } // Attributes - } // Member - } // methods - - [] { // Attributes - Attr(#11) { // SourceFile - #12; - } // end SourceFile - ; - Attr(#7) { // InnerClasses - [] { // InnerClasses - #2 #14 #6 1544; - #4 #14 #18 1544; - } - } // end InnerClasses - } // Attributes -} // end class SpecialInterfaceCall$I4 diff --git a/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java b/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java new file mode 100644 index 00000000000..6b816f89c11 --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java @@ -0,0 +1,138 @@ +/* + * 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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesAsCollectorTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesAsCollectorTest + */ + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodType; +import java.util.Arrays; + +import static org.junit.Assert.*; + +public class MethodHandlesAsCollectorTest extends MethodHandlesTest { + + @Test // SLOW + public void testAsCollector() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testAsCollector0); + CodeCacheOverflowProcessor.runMHTest(this::testAsCollector1); + } + + public void testAsCollector0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("asCollector"); + for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { + if (verbosity >= 3) + System.out.println("asCollector "+argType); + for (int nargs = 0; nargs < 50; nargs++) { + if (CAN_TEST_LIGHTLY && nargs > 11) break; + for (int pos = 0; pos <= nargs; pos++) { + if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; + if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) + continue; + testAsCollector(argType, pos, nargs); + } + } + } + } + + public void testAsCollector(Class<?> argType, int pos, int nargs) throws Throwable { + countTest(); + // fake up a MH with the same type as the desired adapter: + MethodHandle fake = varargsArray(nargs); + fake = changeArgTypes(fake, argType); + MethodType newType = fake.type(); + Object[] args = randomArgs(newType.parameterArray()); + // here is what should happen: + Object[] collectedArgs = Arrays.copyOfRange(args, 0, pos+1); + collectedArgs[pos] = Arrays.copyOfRange(args, pos, args.length); + // here is the MH which will witness the collected argument tail: + MethodHandle target = varargsArray(pos+1); + target = changeArgTypes(target, 0, pos, argType); + target = changeArgTypes(target, pos, pos+1, Object[].class); + if (verbosity >= 3) + System.out.println("collect from "+Arrays.asList(args)+" ["+pos+".."+nargs+"]"); + MethodHandle result = target.asCollector(Object[].class, nargs-pos).asType(newType); + Object[] returnValue = (Object[]) result.invokeWithArguments(args); + assertArrayEquals(collectedArgs, returnValue); + } + + public void testAsCollector1() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("asCollector/pos"); + for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { + if (verbosity >= 3) + System.out.println("asCollector/pos "+argType); + for (int nargs = 0; nargs < 50; nargs++) { + if (CAN_TEST_LIGHTLY && nargs > 11) break; + for (int pos = 0; pos <= nargs; pos++) { + if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; + if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) + continue; + for (int coll = 1; coll < nargs - pos; ++coll) { + if (coll > 4 && coll != 7 && coll != 11 && coll != 20 && coll < nargs - pos - 4) continue; + testAsCollector(argType, pos, coll, nargs); + } + } + } + } + } + + public void testAsCollector(Class<?> argType, int pos, int collect, int nargs) throws Throwable { + countTest(); + // fake up a MH with the same type as the desired adapter: + MethodHandle fake = varargsArray(nargs); + fake = changeArgTypes(fake, argType); + MethodType newType = fake.type(); + Object[] args = randomArgs(newType.parameterArray()); + // here is what should happen: + // new arg list has "collect" less arguments, but one extra for collected arguments array + int collectedLength = nargs-(collect-1); + Object[] collectedArgs = new Object[collectedLength]; + System.arraycopy(args, 0, collectedArgs, 0, pos); + collectedArgs[pos] = Arrays.copyOfRange(args, pos, pos+collect); + System.arraycopy(args, pos+collect, collectedArgs, pos+1, args.length-(pos+collect)); + // here is the MH which will witness the collected argument part (not tail!): + MethodHandle target = varargsArray(collectedLength); + target = changeArgTypes(target, 0, pos, argType); + target = changeArgTypes(target, pos, pos+1, Object[].class); + target = changeArgTypes(target, pos+1, collectedLength, argType); + if (verbosity >= 3) + System.out.println("collect "+collect+" from "+Arrays.asList(args)+" ["+pos+".."+(pos+collect)+"["); + MethodHandle result = target.asCollector(pos, Object[].class, collect).asType(newType); + Object[] returnValue = (Object[]) result.invokeWithArguments(args); + assertArrayEquals(collectedArgs, returnValue); + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java b/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java new file mode 100644 index 00000000000..479bd2d14db --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java @@ -0,0 +1,157 @@ +/* + * 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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesCastFailureTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesCastFailureTest + */ + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + +import static org.junit.Assert.*; + +public class MethodHandlesCastFailureTest extends MethodHandlesTest { + + @Test // SLOW + public void testCastFailure() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testCastFailure0); + } + + public void testCastFailure0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("testCastFailure"); + testCastFailure("cast/argument", 11000); + if (CAN_TEST_LIGHTLY) return; + testCastFailure("unbox/argument", 11000); + testCastFailure("cast/return", 11000); + testCastFailure("unbox/return", 11000); + } + + static class Surprise { + public MethodHandle asMethodHandle() { + return VALUE.bindTo(this); + } + Object value(Object x) { + trace("value", x); + if (boo != null) return boo; + return x; + } + Object boo; + void boo(Object x) { boo = x; } + + static void trace(String x, Object y) { + if (verbosity > 8) System.out.println(x+"="+y); + } + static Object refIdentity(Object x) { trace("ref.x", x); return x; } + static Integer boxIdentity(Integer x) { trace("box.x", x); return x; } + static int intIdentity(int x) { trace("int.x", x); return x; } + static MethodHandle VALUE, REF_IDENTITY, BOX_IDENTITY, INT_IDENTITY; + static { + try { + VALUE = PRIVATE.findVirtual( + Surprise.class, "value", + MethodType.methodType(Object.class, Object.class)); + REF_IDENTITY = PRIVATE.findStatic( + Surprise.class, "refIdentity", + MethodType.methodType(Object.class, Object.class)); + BOX_IDENTITY = PRIVATE.findStatic( + Surprise.class, "boxIdentity", + MethodType.methodType(Integer.class, Integer.class)); + INT_IDENTITY = PRIVATE.findStatic( + Surprise.class, "intIdentity", + MethodType.methodType(int.class, int.class)); + } catch (NoSuchMethodException | IllegalAccessException ex) { + throw new RuntimeException(ex); + } + } + } + + @SuppressWarnings("ConvertToStringSwitch") + void testCastFailure(String mode, int okCount) throws Throwable { + countTest(false); + if (verbosity > 2) System.out.println("mode="+mode); + Surprise boo = new Surprise(); + MethodHandle identity = Surprise.REF_IDENTITY, surprise0 = boo.asMethodHandle(), surprise = surprise0; + if (mode.endsWith("/return")) { + if (mode.equals("unbox/return")) { + // fail on return to ((Integer)surprise).intValue + surprise = surprise.asType(MethodType.methodType(int.class, Object.class)); + identity = identity.asType(MethodType.methodType(int.class, Object.class)); + } else if (mode.equals("cast/return")) { + // fail on return to (Integer)surprise + surprise = surprise.asType(MethodType.methodType(Integer.class, Object.class)); + identity = identity.asType(MethodType.methodType(Integer.class, Object.class)); + } + } else if (mode.endsWith("/argument")) { + MethodHandle callee = null; + if (mode.equals("unbox/argument")) { + // fail on handing surprise to int argument + callee = Surprise.INT_IDENTITY; + } else if (mode.equals("cast/argument")) { + // fail on handing surprise to Integer argument + callee = Surprise.BOX_IDENTITY; + } + if (callee != null) { + callee = callee.asType(MethodType.genericMethodType(1)); + surprise = MethodHandles.filterArguments(callee, 0, surprise); + identity = MethodHandles.filterArguments(callee, 0, identity); + } + } + assertNotSame(mode, surprise, surprise0); + identity = identity.asType(MethodType.genericMethodType(1)); + surprise = surprise.asType(MethodType.genericMethodType(1)); + Object x = 42; + for (int i = 0; i < okCount; i++) { + Object y = identity.invokeExact(x); + assertEquals(x, y); + Object z = surprise.invokeExact(x); + assertEquals(x, z); + } + boo.boo("Boo!"); + Object y = identity.invokeExact(x); + assertEquals(x, y); + try { + Object z = surprise.invokeExact(x); + System.out.println("Failed to throw; got z="+z); + assertTrue(false); + } catch (ClassCastException ex) { + if (verbosity > 2) + System.out.println("caught "+ex); + if (verbosity > 3) + ex.printStackTrace(System.out); + assertTrue(true); // all is well + } + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java new file mode 100644 index 00000000000..cd859c8809a --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java @@ -0,0 +1,2122 @@ +/* + * 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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesGeneralTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesGeneralTest + */ + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; +import test.java.lang.invoke.remote.RemoteExample; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandleProxies; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.WrongMethodTypeException; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.UndeclaredThrowableException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Formatter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static java.lang.invoke.MethodType.methodType; +import static org.junit.Assert.*; + +public class MethodHandlesGeneralTest extends MethodHandlesTest { + + @Test + public void testFirst() throws Throwable { + verbosity += 9; + try { + // left blank for debugging + } finally { printCounts(); verbosity -= 9; } + } + + @Test + public void testFindStatic() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindStatic0); + } + + public void testFindStatic0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findStatic"); + testFindStatic(PubExample.class, void.class, "s0"); + testFindStatic(Example.class, void.class, "s0"); + testFindStatic(Example.class, void.class, "pkg_s0"); + testFindStatic(Example.class, void.class, "pri_s0"); + testFindStatic(Example.class, void.class, "pro_s0"); + testFindStatic(PubExample.class, void.class, "Pub/pro_s0"); + + testFindStatic(Example.class, Object.class, "s1", Object.class); + testFindStatic(Example.class, Object.class, "s2", int.class); + testFindStatic(Example.class, Object.class, "s3", long.class); + testFindStatic(Example.class, Object.class, "s4", int.class, int.class); + testFindStatic(Example.class, Object.class, "s5", long.class, int.class); + testFindStatic(Example.class, Object.class, "s6", int.class, long.class); + testFindStatic(Example.class, Object.class, "s7", float.class, double.class); + + testFindStatic(false, PRIVATE, Example.class, void.class, "bogus"); + testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", int.class); + testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", Void.class); + testFindStatic(false, PRIVATE, Example.class, void.class, "v0"); + } + + void testFindStatic(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testFindStatic((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params); + } + } + + void testFindStatic(Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + testFindStatic(true, lookup, defc, ret, name, params); + } + + void testFindStatic(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + MethodHandle target = null; + Exception noAccess = null; + try { + if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); + target = maybeMoveIn(lookup, defc).findStatic(defc, methodName, type); + } catch (ReflectiveOperationException ex) { + noAccess = ex; + assertExceptionClass( + (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) + ? NoSuchMethodException.class + : IllegalAccessException.class, + noAccess); + if (verbosity >= 5) ex.printStackTrace(System.out); + } + if (verbosity >= 3) + System.out.println("findStatic "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(type, target.type()); + assertNameStringContains(target, methodName); + Object[] args = randomArgs(params); + printCalled(target, name, args); + target.invokeWithArguments(args); + assertCalled(name, args); + if (verbosity >= 1) + System.out.print(':'); + } + + @Test + public void testFindVirtual() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindVirtual0); + } + + public void testFindVirtual0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findVirtual"); + testFindVirtual(Example.class, void.class, "v0"); + testFindVirtual(Example.class, void.class, "pkg_v0"); + testFindVirtual(Example.class, void.class, "pri_v0"); + testFindVirtual(Example.class, Object.class, "v1", Object.class); + testFindVirtual(Example.class, Object.class, "v2", Object.class, Object.class); + testFindVirtual(Example.class, Object.class, "v2", Object.class, int.class); + testFindVirtual(Example.class, Object.class, "v2", int.class, Object.class); + testFindVirtual(Example.class, Object.class, "v2", int.class, int.class); + testFindVirtual(Example.class, void.class, "pro_v0"); + testFindVirtual(PubExample.class, void.class, "Pub/pro_v0"); + + testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus"); + testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", int.class); + testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", Void.class); + testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "s0"); + + // test dispatch + testFindVirtual(SubExample.class, SubExample.class, void.class, "Sub/v0"); + testFindVirtual(SubExample.class, Example.class, void.class, "Sub/v0"); + testFindVirtual(SubExample.class, IntExample.class, void.class, "Sub/v0"); + testFindVirtual(SubExample.class, SubExample.class, void.class, "Sub/pkg_v0"); + testFindVirtual(SubExample.class, Example.class, void.class, "Sub/pkg_v0"); + testFindVirtual(Example.class, IntExample.class, void.class, "v0"); + testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0"); + } + + @Test + public void testFindVirtualClone() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindVirtualClone0); + } + + public void testFindVirtualClone0() throws Throwable { + if (CAN_SKIP_WORKING) return; + // test some ad hoc system methods + testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone"); + + // ##### FIXME - disable tests for clone until we figure out how they should work with modules + + /* + testFindVirtual(true, PUBLIC, Object[].class, Object.class, "clone"); + testFindVirtual(true, PUBLIC, int[].class, Object.class, "clone"); + for (Class<?> cls : new Class<?>[]{ boolean[].class, long[].class, float[].class, char[].class }) + testFindVirtual(true, PUBLIC, cls, Object.class, "clone"); + */ + } + + void testFindVirtual(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + Class<?> rcvc = defc; + testFindVirtual(rcvc, defc, ret, name, params); + } + + void testFindVirtual(Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testFindVirtual((Boolean)ac[0], (Lookup)ac[1], rcvc, defc, ret, name, params); + } + } + + void testFindVirtual(Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + testFindVirtual(true, lookup, rcvc, defc, ret, name, params); + } + + void testFindVirtual(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + testFindVirtual(positive, lookup, defc, defc, ret, name, params); + } + + void testFindVirtual(boolean positive, Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + MethodHandle target = null; + Exception noAccess = null; + try { + if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); + target = maybeMoveIn(lookup, defc).findVirtual(defc, methodName, type); + } catch (ReflectiveOperationException ex) { + noAccess = ex; + assertExceptionClass( + (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) + ? NoSuchMethodException.class + : IllegalAccessException.class, + noAccess); + if (verbosity >= 5) ex.printStackTrace(System.out); + } + if (verbosity >= 3) + System.out.println("findVirtual "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + Class<?> selfc = defc; + // predict receiver type narrowing: + if (lookup == SUBCLASS && + name.contains("pro_") && + selfc.isAssignableFrom(lookup.lookupClass())) { + selfc = lookup.lookupClass(); + if (name.startsWith("Pub/")) name = "Rem/"+name.substring(4); + } + Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)selfc), params); + MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf); + assertEquals(typeWithSelf, target.type()); + assertNameStringContains(target, methodName); + Object[] argsWithSelf = randomArgs(paramsWithSelf); + if (selfc.isAssignableFrom(rcvc) && rcvc != selfc) argsWithSelf[0] = randomArg(rcvc); + printCalled(target, name, argsWithSelf); + Object res = target.invokeWithArguments(argsWithSelf); + if (Example.class.isAssignableFrom(defc) || IntExample.class.isAssignableFrom(defc)) { + assertCalled(name, argsWithSelf); + } else if (name.equals("clone")) { + // Ad hoc method call outside Example. For Object[].clone. + printCalled(target, name, argsWithSelf); + assertEquals(MethodType.methodType(Object.class, rcvc), target.type()); + Object orig = argsWithSelf[0]; + assertEquals(orig.getClass(), res.getClass()); + if (res instanceof Object[]) + assertArrayEquals((Object[])res, (Object[])argsWithSelf[0]); + assert(Arrays.deepEquals(new Object[]{res}, new Object[]{argsWithSelf[0]})); + } else { + assert(false) : Arrays.asList(positive, lookup, rcvc, defc, ret, name, deepToString(params)); + } + if (verbosity >= 1) + System.out.print(':'); + } + + @Test + public void testFindSpecial() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindSpecial0); + } + + public void testFindSpecial0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findSpecial"); + testFindSpecial(SubExample.class, Example.class, void.class, false, "v0"); + testFindSpecial(SubExample.class, Example.class, void.class, false, "pkg_v0"); + testFindSpecial(RemoteExample.class, PubExample.class, void.class, false, "Pub/pro_v0"); + testFindSpecial(Example.class, IntExample.class, void.class, true, "vd"); + // Do some negative testing: + for (Lookup lookup : new Lookup[]{ PRIVATE, EXAMPLE, PACKAGE, PUBLIC }) { + testFindSpecial(false, lookup, Object.class, Example.class, void.class, "v0"); + testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "bogus"); + testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", int.class); + testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", Void.class); + testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "s0"); + testFindSpecial(false, lookup, Example.class, IntExample.class, void.class, "v0"); + } + } + + void testFindSpecial(Class<?> specialCaller, + Class<?> defc, Class<?> ret, boolean dflt, String name, Class<?>... params) throws Throwable { + if (specialCaller == RemoteExample.class) { + testFindSpecial(false, EXAMPLE, specialCaller, defc, ret, name, params); + testFindSpecial(false, PRIVATE, specialCaller, defc, ret, name, params); + testFindSpecial(false, PACKAGE, specialCaller, defc, ret, name, params); + testFindSpecial(true, SUBCLASS, specialCaller, defc, ret, name, params); + testFindSpecial(false, PUBLIC, specialCaller, defc, ret, name, params); + return; + } + testFindSpecial(true, EXAMPLE, specialCaller, defc, ret, name, params); + testFindSpecial(true, PRIVATE, specialCaller, defc, ret, name, params); + testFindSpecial(false || dflt, PACKAGE, specialCaller, defc, ret, name, params); + testFindSpecial(false, SUBCLASS, specialCaller, defc, ret, name, params); + testFindSpecial(false, PUBLIC, specialCaller, defc, ret, name, params); + } + + void testFindSpecial(boolean positive, Lookup lookup, Class<?> specialCaller, + Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + Lookup specialLookup = maybeMoveIn(lookup, specialCaller); + boolean specialAccessOK = (specialLookup.lookupClass() == specialCaller && + (specialLookup.lookupModes() & Lookup.PRIVATE) != 0); + MethodHandle target = null; + Exception noAccess = null; + try { + if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); + if (verbosity >= 5) System.out.println(" lookup => "+specialLookup); + target = specialLookup.findSpecial(defc, methodName, type, specialCaller); + } catch (ReflectiveOperationException ex) { + noAccess = ex; + assertExceptionClass( + (!specialAccessOK) // this check should happen first + ? IllegalAccessException.class + : (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) + ? NoSuchMethodException.class + : IllegalAccessException.class, + noAccess); + if (verbosity >= 5) ex.printStackTrace(System.out); + } + if (verbosity >= 3) + System.out.println("findSpecial from "+specialCaller.getName()+" to "+defc.getName()+"."+name+"/"+type+" => "+target + +(target == null ? "" : target.type()) + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(specialCaller, target.type().parameterType(0)); + assertEquals(type, target.type().dropParameterTypes(0,1)); + Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)specialCaller), params); + MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf); + assertNameStringContains(target, methodName); + Object[] args = randomArgs(paramsWithSelf); + printCalled(target, name, args); + target.invokeWithArguments(args); + assertCalled(name, args); + } + + @Test + public void testFindConstructor() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindConstructor0); + } + + public void testFindConstructor0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findConstructor"); + testFindConstructor(true, EXAMPLE, Example.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class, int.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class, long.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class, float.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class, double.class); + testFindConstructor(true, EXAMPLE, Example.class, String.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class, int.class, int.class); + testFindConstructor(true, EXAMPLE, Example.class, int.class, int.class, int.class, int.class); + } + + void testFindConstructor(boolean positive, Lookup lookup, + Class<?> defc, Class<?>... params) throws Throwable { + countTest(positive); + MethodType type = MethodType.methodType(void.class, params); + MethodHandle target = null; + Exception noAccess = null; + try { + if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" <init>"+type); + target = lookup.findConstructor(defc, type); + } catch (ReflectiveOperationException ex) { + noAccess = ex; + assertTrue(noAccess.getClass().getName(), noAccess instanceof IllegalAccessException); + } + if (verbosity >= 3) + System.out.println("findConstructor "+defc.getName()+".<init>/"+type+" => "+target + +(target == null ? "" : target.type()) + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(type.changeReturnType(defc), target.type()); + Object[] args = randomArgs(params); + printCalled(target, defc.getSimpleName(), args); + Object obj = target.invokeWithArguments(args); + if (!(defc == Example.class && params.length < 2)) + assertCalled(defc.getSimpleName()+".<init>", args); + assertTrue("instance of "+defc.getName(), defc.isInstance(obj)); + } + + @Test + public void testBind() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testBind0); + } + + public void testBind0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("bind"); + testBind(Example.class, void.class, "v0"); + testBind(Example.class, void.class, "pkg_v0"); + testBind(Example.class, void.class, "pri_v0"); + testBind(Example.class, Object.class, "v1", Object.class); + testBind(Example.class, Object.class, "v2", Object.class, Object.class); + testBind(Example.class, Object.class, "v2", Object.class, int.class); + testBind(Example.class, Object.class, "v2", int.class, Object.class); + testBind(Example.class, Object.class, "v2", int.class, int.class); + testBind(false, PRIVATE, Example.class, void.class, "bogus"); + testBind(false, PRIVATE, Example.class, void.class, "<init>", int.class); + testBind(false, PRIVATE, Example.class, void.class, "<init>", Void.class); + testBind(SubExample.class, void.class, "Sub/v0"); + testBind(SubExample.class, void.class, "Sub/pkg_v0"); + testBind(IntExample.Impl.class, void.class, "Int/v0"); + } + + void testBind(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testBind((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params); + } + } + + void testBind(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + Object receiver = randomArg(defc); + MethodHandle target = null; + Exception noAccess = null; + try { + if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); + target = maybeMoveIn(lookup, defc).bind(receiver, methodName, type); + } catch (ReflectiveOperationException ex) { + noAccess = ex; + assertExceptionClass( + (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) + ? NoSuchMethodException.class + : IllegalAccessException.class, + noAccess); + if (verbosity >= 5) ex.printStackTrace(System.out); + } + if (verbosity >= 3) + System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(type, target.type()); + Object[] args = randomArgs(params); + printCalled(target, name, args); + target.invokeWithArguments(args); + Object[] argsWithReceiver = cat(array(Object[].class, receiver), args); + assertCalled(name, argsWithReceiver); + if (verbosity >= 1) + System.out.print(':'); + } + + @Test + public void testUnreflect() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflect0); + } + + public void testUnreflect0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("unreflect"); + testUnreflect(Example.class, true, void.class, "s0"); + testUnreflect(Example.class, true, void.class, "pro_s0"); + testUnreflect(Example.class, true, void.class, "pkg_s0"); + testUnreflect(Example.class, true, void.class, "pri_s0"); + + testUnreflect(Example.class, true, Object.class, "s1", Object.class); + testUnreflect(Example.class, true, Object.class, "s2", int.class); + testUnreflect(Example.class, true, Object.class, "s3", long.class); + testUnreflect(Example.class, true, Object.class, "s4", int.class, int.class); + testUnreflect(Example.class, true, Object.class, "s5", long.class, int.class); + testUnreflect(Example.class, true, Object.class, "s6", int.class, long.class); + + testUnreflect(Example.class, false, void.class, "v0"); + testUnreflect(Example.class, false, void.class, "pkg_v0"); + testUnreflect(Example.class, false, void.class, "pri_v0"); + testUnreflect(Example.class, false, Object.class, "v1", Object.class); + testUnreflect(Example.class, false, Object.class, "v2", Object.class, Object.class); + testUnreflect(Example.class, false, Object.class, "v2", Object.class, int.class); + testUnreflect(Example.class, false, Object.class, "v2", int.class, Object.class); + testUnreflect(Example.class, false, Object.class, "v2", int.class, int.class); + + // Test a public final member in another package: + testUnreflect(RemoteExample.class, false, void.class, "Rem/fin_v0"); + } + + void testUnreflect(Class<?> defc, boolean isStatic, Class<?> ret, String name, Class<?>... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, (isStatic ? null : defc), ret, name, params); + } + } + + void testUnreflect(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params); + } + } + + void testUnreflectMaybeSpecial(Class<?> specialCaller, + boolean positive, Lookup lookup, + Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + Lookup specialLookup = (specialCaller != null ? maybeMoveIn(lookup, specialCaller) : null); + boolean specialAccessOK = (specialCaller != null && + specialLookup.lookupClass() == specialCaller && + (specialLookup.lookupModes() & Lookup.PRIVATE) != 0); + Method rmethod = defc.getDeclaredMethod(methodName, params); + MethodHandle target = null; + Exception noAccess = null; + boolean isStatic = (rcvc == null); + boolean isSpecial = (specialCaller != null); + try { + if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); + if (isSpecial) + target = specialLookup.unreflectSpecial(rmethod, specialCaller); + else + target = maybeMoveIn(lookup, defc).unreflect(rmethod); + } catch (ReflectiveOperationException ex) { + noAccess = ex; + assertExceptionClass( + IllegalAccessException.class, // NSME is impossible, since it was already reflected + noAccess); + if (verbosity >= 5) ex.printStackTrace(System.out); + } + if (verbosity >= 3) + System.out.println("unreflect"+(isSpecial?"Special":"")+" "+defc.getName()+"."+name+"/"+type + +(!isSpecial ? "" : " specialCaller="+specialCaller) + +( isStatic ? "" : " receiver="+rcvc) + +" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(isStatic, Modifier.isStatic(rmethod.getModifiers())); + Class<?>[] paramsMaybeWithSelf = params; + if (!isStatic) { + paramsMaybeWithSelf = cat(array(Class[].class, (Class)rcvc), params); + } + MethodType typeMaybeWithSelf = MethodType.methodType(ret, paramsMaybeWithSelf); + if (isStatic) { + assertEquals(typeMaybeWithSelf, target.type()); + } else { + if (isSpecial) + assertEquals(specialCaller, target.type().parameterType(0)); + else + assertEquals(defc, target.type().parameterType(0)); + assertEquals(typeMaybeWithSelf, target.type().changeParameterType(0, rcvc)); + } + Object[] argsMaybeWithSelf = randomArgs(paramsMaybeWithSelf); + printCalled(target, name, argsMaybeWithSelf); + target.invokeWithArguments(argsMaybeWithSelf); + assertCalled(name, argsMaybeWithSelf); + if (verbosity >= 1) + System.out.print(':'); + } + + void testUnreflectSpecial(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable { + for (Object[] ac : accessCases(defc, name, true)) { + Class<?> specialCaller = rcvc; + testUnreflectMaybeSpecial(specialCaller, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params); + } + } + + @Test + public void testUnreflectSpecial() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSpecial0); + } + + public void testUnreflectSpecial0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("unreflectSpecial"); + testUnreflectSpecial(Example.class, Example.class, void.class, "v0"); + testUnreflectSpecial(Example.class, SubExample.class, void.class, "v0"); + testUnreflectSpecial(Example.class, Example.class, void.class, "pkg_v0"); + testUnreflectSpecial(Example.class, SubExample.class, void.class, "pkg_v0"); + testUnreflectSpecial(Example.class, Example.class, Object.class, "v2", int.class, int.class); + testUnreflectSpecial(Example.class, SubExample.class, Object.class, "v2", int.class, int.class); + testUnreflectMaybeSpecial(Example.class, false, PRIVATE, Example.class, Example.class, void.class, "s0"); + } + + @Test + public void testUnreflectGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflectGetter0); + } + + public void testUnreflectGetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("unreflectGetter"); + testGetter(TEST_UNREFLECT); + } + + @Test + public void testFindGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindGetter0); + } + + public void testFindGetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findGetter"); + testGetter(TEST_FIND_FIELD); + testGetter(TEST_FIND_FIELD | TEST_BOUND); + } + + @Test + public void testFindStaticGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindStaticGetter0); + } + + public void testFindStaticGetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findStaticGetter"); + testGetter(TEST_FIND_STATIC); + } + + public void testGetter(int testMode) throws Throwable { + Lookup lookup = PRIVATE; // FIXME: test more lookups than this one + for (Object[] c : HasFields.CASES) { + boolean positive = (c[1] != Error.class); + testGetter(positive, lookup, c[0], c[1], testMode); + if (positive) + testGetter(positive, lookup, c[0], c[1], testMode | TEST_NPE); + } + testGetter(true, lookup, + new Object[]{ true, System.class, "out", java.io.PrintStream.class }, + System.out, testMode); + for (int isStaticN = 0; isStaticN <= 1; isStaticN++) { + testGetter(false, lookup, + new Object[]{ (isStaticN != 0), System.class, "bogus", char.class }, + null, testMode); + } + } + + public void testGetter(boolean positive, MethodHandles.Lookup lookup, + Object fieldRef, Object value, int testMode) throws Throwable { + testAccessor(positive, lookup, fieldRef, value, testMode); + } + + public void testAccessor(boolean positive0, MethodHandles.Lookup lookup, + Object fieldRef, Object value, int testMode0) throws Throwable { + if (verbosity >= 4) + System.out.println("testAccessor"+Arrays.deepToString(new Object[]{positive0, lookup, fieldRef, value, testMode0})); + boolean isGetter = ((testMode0 & TEST_SETTER) == 0); + boolean doBound = ((testMode0 & TEST_BOUND) != 0); + boolean testNPE = ((testMode0 & TEST_NPE) != 0); + int testMode = testMode0 & ~(TEST_SETTER | TEST_BOUND | TEST_NPE); + boolean positive = positive0 && !testNPE; + boolean isStatic; + Class<?> fclass; + String fname; + Class<?> ftype; + Field f = (fieldRef instanceof Field ? (Field)fieldRef : null); + if (f != null) { + isStatic = Modifier.isStatic(f.getModifiers()); + fclass = f.getDeclaringClass(); + fname = f.getName(); + ftype = f.getType(); + } else { + Object[] scnt = (Object[]) fieldRef; + isStatic = (Boolean) scnt[0]; + fclass = (Class<?>) scnt[1]; + fname = (String) scnt[2]; + ftype = (Class<?>) scnt[3]; + try { + f = fclass.getDeclaredField(fname); + } catch (ReflectiveOperationException ex) { + f = null; + } + } + if (!testModeMatches(testMode, isStatic)) return; + if (f == null && testMode == TEST_UNREFLECT) return; + if (testNPE && isStatic) return; + countTest(positive); + MethodType expType; + if (isGetter) + expType = MethodType.methodType(ftype, HasFields.class); + else + expType = MethodType.methodType(void.class, HasFields.class, ftype); + if (isStatic) expType = expType.dropParameterTypes(0, 1); + Exception noAccess = null; + MethodHandle mh; + try { + switch (testMode0 & ~(TEST_BOUND | TEST_NPE)) { + case TEST_UNREFLECT: mh = lookup.unreflectGetter(f); break; + case TEST_FIND_FIELD: mh = lookup.findGetter(fclass, fname, ftype); break; + case TEST_FIND_STATIC: mh = lookup.findStaticGetter(fclass, fname, ftype); break; + case TEST_SETTER| + TEST_UNREFLECT: mh = lookup.unreflectSetter(f); break; + case TEST_SETTER| + TEST_FIND_FIELD: mh = lookup.findSetter(fclass, fname, ftype); break; + case TEST_SETTER| + TEST_FIND_STATIC: mh = lookup.findStaticSetter(fclass, fname, ftype); break; + default: + throw new InternalError("testMode="+testMode); + } + } catch (ReflectiveOperationException ex) { + mh = null; + noAccess = ex; + assertExceptionClass( + (fname.contains("bogus")) + ? NoSuchFieldException.class + : IllegalAccessException.class, + noAccess); + if (verbosity >= 5) ex.printStackTrace(System.out); + } + if (verbosity >= 3) + System.out.println("find"+(isStatic?"Static":"")+(isGetter?"Getter":"Setter")+" "+fclass.getName()+"."+fname+"/"+ftype + +" => "+mh + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && !testNPE && noAccess != null) throw new RuntimeException(noAccess); + assertEquals(positive0 ? "positive test" : "negative test erroneously passed", positive0, mh != null); + if (!positive && !testNPE) return; // negative access test failed as expected + assertEquals((isStatic ? 0 : 1)+(isGetter ? 0 : 1), mh.type().parameterCount()); + + + assertSame(mh.type(), expType); + //assertNameStringContains(mh, fname); // This does not hold anymore with LFs + HasFields fields = new HasFields(); + HasFields fieldsForMH = fields; + if (testNPE) fieldsForMH = null; // perturb MH argument to elicit expected error + if (doBound) + mh = mh.bindTo(fieldsForMH); + Object sawValue; + Class<?> vtype = ftype; + if (ftype != int.class) vtype = Object.class; + if (isGetter) { + mh = mh.asType(mh.type().generic() + .changeReturnType(vtype)); + } else { + int last = mh.type().parameterCount() - 1; + mh = mh.asType(mh.type().generic() + .changeReturnType(void.class) + .changeParameterType(last, vtype)); + } + if (f != null && f.getDeclaringClass() == HasFields.class) { + assertEquals(f.get(fields), value); // clean to start with + } + Throwable caughtEx = null; + if (isGetter) { + Object expValue = value; + for (int i = 0; i <= 1; i++) { + sawValue = null; // make DA rules happy under try/catch + try { + if (isStatic || doBound) { + if (ftype == int.class) + sawValue = (int) mh.invokeExact(); // do these exactly + else + sawValue = mh.invokeExact(); + } else { + if (ftype == int.class) + sawValue = (int) mh.invokeExact((Object) fieldsForMH); + else + sawValue = mh.invokeExact((Object) fieldsForMH); + } + } catch (RuntimeException ex) { + if (ex instanceof NullPointerException && testNPE) { + caughtEx = ex; + break; + } + } + assertEquals(sawValue, expValue); + if (f != null && f.getDeclaringClass() == HasFields.class + && !Modifier.isFinal(f.getModifiers())) { + Object random = randomArg(ftype); + f.set(fields, random); + expValue = random; + } else { + break; + } + } + } else { + for (int i = 0; i <= 1; i++) { + Object putValue = randomArg(ftype); + try { + if (isStatic || doBound) { + if (ftype == int.class) + mh.invokeExact((int)putValue); // do these exactly + else + mh.invokeExact(putValue); + } else { + if (ftype == int.class) + mh.invokeExact((Object) fieldsForMH, (int)putValue); + else + mh.invokeExact((Object) fieldsForMH, putValue); + } + } catch (RuntimeException ex) { + if (ex instanceof NullPointerException && testNPE) { + caughtEx = ex; + break; + } + } + if (f != null && f.getDeclaringClass() == HasFields.class) { + assertEquals(f.get(fields), putValue); + } + } + } + if (f != null && f.getDeclaringClass() == HasFields.class) { + f.set(fields, value); // put it back + } + if (testNPE) { + if (caughtEx == null || !(caughtEx instanceof NullPointerException)) + throw new RuntimeException("failed to catch NPE exception"+(caughtEx == null ? " (caughtEx=null)" : ""), caughtEx); + caughtEx = null; // nullify expected exception + } + if (caughtEx != null) { + throw new RuntimeException("unexpected exception", caughtEx); + } + } + + @Test + public void testUnreflectSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSetter0); + } + + public void testUnreflectSetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("unreflectSetter"); + testSetter(TEST_UNREFLECT); + } + + @Test + public void testFindSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindSetter0); + } + + public void testFindSetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findSetter"); + testSetter(TEST_FIND_FIELD); + testSetter(TEST_FIND_FIELD | TEST_BOUND); + } + + @Test + public void testFindStaticSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindStaticSetter0); + } + + public void testFindStaticSetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findStaticSetter"); + testSetter(TEST_FIND_STATIC); + } + + public void testSetter(int testMode) throws Throwable { + Lookup lookup = PRIVATE; // FIXME: test more lookups than this one + startTest("unreflectSetter"); + for (Object[] c : HasFields.CASES) { + boolean positive = (c[1] != Error.class); + testSetter(positive, lookup, c[0], c[1], testMode); + if (positive) + testSetter(positive, lookup, c[0], c[1], testMode | TEST_NPE); + } + for (int isStaticN = 0; isStaticN <= 1; isStaticN++) { + testSetter(false, lookup, + new Object[]{ (isStaticN != 0), System.class, "bogus", char.class }, + null, testMode); + } + } + + public void testSetter(boolean positive, MethodHandles.Lookup lookup, + Object fieldRef, Object value, int testMode) throws Throwable { + testAccessor(positive, lookup, fieldRef, value, testMode | TEST_SETTER); + } + + @Test + public void testArrayElementGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testArrayElementGetter0); + } + + public void testArrayElementGetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("arrayElementGetter"); + testArrayElementGetterSetter(false); + } + + @Test + public void testArrayElementSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testArrayElementSetter0); + } + + public void testArrayElementSetter0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("arrayElementSetter"); + testArrayElementGetterSetter(true); + } + + private static final int TEST_ARRAY_NONE = 0, TEST_ARRAY_NPE = 1, TEST_ARRAY_OOB = 2, TEST_ARRAY_ASE = 3; + + public void testArrayElementGetterSetter(boolean testSetter) throws Throwable { + testArrayElementGetterSetter(testSetter, TEST_ARRAY_NONE); + } + + @Test + public void testArrayElementErrors() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testArrayElementErrors0); + } + + public void testArrayElementErrors0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("arrayElementErrors"); + testArrayElementGetterSetter(false, TEST_ARRAY_NPE); + testArrayElementGetterSetter(true, TEST_ARRAY_NPE); + testArrayElementGetterSetter(false, TEST_ARRAY_OOB); + testArrayElementGetterSetter(true, TEST_ARRAY_OOB); + testArrayElementGetterSetter(new Object[10], true, TEST_ARRAY_ASE); + testArrayElementGetterSetter(new Example[10], true, TEST_ARRAY_ASE); + testArrayElementGetterSetter(new IntExample[10], true, TEST_ARRAY_ASE); + } + + public void testArrayElementGetterSetter(boolean testSetter, int negTest) throws Throwable { + testArrayElementGetterSetter(new String[10], testSetter, negTest); + testArrayElementGetterSetter(new Iterable<?>[10], testSetter, negTest); + testArrayElementGetterSetter(new Example[10], testSetter, negTest); + testArrayElementGetterSetter(new IntExample[10], testSetter, negTest); + testArrayElementGetterSetter(new Object[10], testSetter, negTest); + testArrayElementGetterSetter(new boolean[10], testSetter, negTest); + testArrayElementGetterSetter(new byte[10], testSetter, negTest); + testArrayElementGetterSetter(new char[10], testSetter, negTest); + testArrayElementGetterSetter(new short[10], testSetter, negTest); + testArrayElementGetterSetter(new int[10], testSetter, negTest); + testArrayElementGetterSetter(new float[10], testSetter, negTest); + testArrayElementGetterSetter(new long[10], testSetter, negTest); + testArrayElementGetterSetter(new double[10], testSetter, negTest); + } + + public void testArrayElementGetterSetter(Object array, boolean testSetter, int negTest) throws Throwable { + boolean positive = (negTest == TEST_ARRAY_NONE); + int length = Array.getLength(array); + Class<?> arrayType = array.getClass(); + Class<?> elemType = arrayType.getComponentType(); + Object arrayToMH = array; + // this stanza allows negative tests to make argument perturbations: + switch (negTest) { + case TEST_ARRAY_NPE: + arrayToMH = null; + break; + case TEST_ARRAY_OOB: + assert(length > 0); + arrayToMH = Array.newInstance(elemType, 0); + break; + case TEST_ARRAY_ASE: + assert(testSetter && !elemType.isPrimitive()); + if (elemType == Object.class) + arrayToMH = new StringBuffer[length]; // very random subclass of Object! + else if (elemType == Example.class) + arrayToMH = new SubExample[length]; + else if (elemType == IntExample.class) + arrayToMH = new SubIntExample[length]; + else + return; // can't make an ArrayStoreException test + assert(arrayType.isInstance(arrayToMH)) + : Arrays.asList(arrayType, arrayToMH.getClass(), testSetter, negTest); + break; + } + countTest(positive); + if (verbosity > 2) System.out.println("array type = "+array.getClass().getComponentType().getName()+"["+length+"]"+(positive ? "" : " negative test #"+negTest+" using "+Arrays.deepToString(new Object[]{arrayToMH}))); + MethodType expType = !testSetter + ? MethodType.methodType(elemType, arrayType, int.class) + : MethodType.methodType(void.class, arrayType, int.class, elemType); + MethodHandle mh = !testSetter + ? MethodHandles.arrayElementGetter(arrayType) + : MethodHandles.arrayElementSetter(arrayType); + assertSame(mh.type(), expType); + if (elemType != int.class && elemType != boolean.class) { + MethodType gtype = mh.type().generic().changeParameterType(1, int.class); + if (testSetter) gtype = gtype.changeReturnType(void.class); + mh = mh.asType(gtype); + } + Object sawValue, expValue; + List<Object> model = array2list(array); + Throwable caughtEx = null; + for (int i = 0; i < length; i++) { + // update array element + Object random = randomArg(elemType); + model.set(i, random); + if (testSetter) { + try { + if (elemType == int.class) + mh.invokeExact((int[]) arrayToMH, i, (int)random); + else if (elemType == boolean.class) + mh.invokeExact((boolean[]) arrayToMH, i, (boolean)random); + else + mh.invokeExact(arrayToMH, i, random); + } catch (RuntimeException ex) { + caughtEx = ex; + break; + } + assertEquals(model, array2list(array)); + } else { + Array.set(array, i, random); + } + if (verbosity >= 5) { + List<Object> array2list = array2list(array); + System.out.println("a["+i+"]="+random+" => "+array2list); + if (!array2list.equals(model)) + System.out.println("*** != "+model); + } + // observe array element + sawValue = Array.get(array, i); + if (!testSetter) { + expValue = sawValue; + try { + if (elemType == int.class) + sawValue = (int) mh.invokeExact((int[]) arrayToMH, i); + else if (elemType == boolean.class) + sawValue = (boolean) mh.invokeExact((boolean[]) arrayToMH, i); + else + sawValue = mh.invokeExact(arrayToMH, i); + } catch (RuntimeException ex) { + caughtEx = ex; + break; + } + assertEquals(sawValue, expValue); + assertEquals(model, array2list(array)); + } + } + if (!positive) { + if (caughtEx == null) + throw new RuntimeException("failed to catch exception for negTest="+negTest); + // test the kind of exception + Class<?> reqType = null; + switch (negTest) { + case TEST_ARRAY_ASE: reqType = ArrayStoreException.class; break; + case TEST_ARRAY_OOB: reqType = ArrayIndexOutOfBoundsException.class; break; + case TEST_ARRAY_NPE: reqType = NullPointerException.class; break; + default: assert(false); + } + if (reqType.isInstance(caughtEx)) { + caughtEx = null; // nullify expected exception + } + } + if (caughtEx != null) { + throw new RuntimeException("unexpected exception", caughtEx); + } + } + + List<Object> array2list(Object array) { + int length = Array.getLength(array); + ArrayList<Object> model = new ArrayList<>(length); + for (int i = 0; i < length; i++) + model.add(Array.get(array, i)); + return model; + } + + @Test + public void testConvertArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testConvertArguments0); + } + + public void testConvertArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("convertArguments"); + testConvert(Callee.ofType(1), null, "id", int.class); + testConvert(Callee.ofType(1), null, "id", String.class); + testConvert(Callee.ofType(1), null, "id", Integer.class); + testConvert(Callee.ofType(1), null, "id", short.class); + testConvert(Callee.ofType(1), null, "id", char.class); + testConvert(Callee.ofType(1), null, "id", byte.class); + } + + void testConvert(MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable { + testConvert(true, id, rtype, name, params); + } + + void testConvert(boolean positive, + MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable { + countTest(positive); + MethodType idType = id.type(); + if (rtype == null) rtype = idType.returnType(); + for (int i = 0; i < params.length; i++) { + if (params[i] == null) params[i] = idType.parameterType(i); + } + // simulate the pairwise conversion + MethodType newType = MethodType.methodType(rtype, params); + Object[] args = randomArgs(newType.parameterArray()); + Object[] convArgs = args.clone(); + for (int i = 0; i < args.length; i++) { + Class<?> src = newType.parameterType(i); + Class<?> dst = idType.parameterType(i); + if (src != dst) + convArgs[i] = castToWrapper(convArgs[i], dst); + } + Object convResult = id.invokeWithArguments(convArgs); + { + Class<?> dst = newType.returnType(); + Class<?> src = idType.returnType(); + if (src != dst) + convResult = castToWrapper(convResult, dst); + } + MethodHandle target = null; + RuntimeException error = null; + try { + target = id.asType(newType); + } catch (WrongMethodTypeException ex) { + error = ex; + } + if (verbosity >= 3) + System.out.println("convert "+id+ " to "+newType+" => "+target + +(error == null ? "" : " !! "+error)); + if (positive && error != null) throw error; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(newType, target.type()); + printCalled(target, id.toString(), args); + Object result = target.invokeWithArguments(args); + assertCalled(name, convArgs); + assertEquals(convResult, result); + if (verbosity >= 1) + System.out.print(':'); + } + + @Test + public void testVarargsCollector() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testVarargsCollector0); + } + + public void testVarargsCollector0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("varargsCollector"); + MethodHandle vac0 = PRIVATE.findStatic(MethodHandlesTest.class, "called", + MethodType.methodType(Object.class, String.class, Object[].class)); + vac0 = vac0.bindTo("vac"); + MethodHandle vac = vac0.asVarargsCollector(Object[].class); + testConvert(true, vac.asType(MethodType.genericMethodType(0)), null, "vac"); + testConvert(true, vac.asType(MethodType.genericMethodType(0)), null, "vac"); + for (Class<?> at : new Class<?>[] { Object.class, String.class, Integer.class }) { + testConvert(true, vac.asType(MethodType.genericMethodType(1)), null, "vac", at); + testConvert(true, vac.asType(MethodType.genericMethodType(2)), null, "vac", at, at); + } + } + + @Test + public void testFilterReturnValue() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFilterReturnValue0); + } + + public void testFilterReturnValue0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("filterReturnValue"); + Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass(); + assertTrue(List.class.isAssignableFrom(classOfVCList)); + for (int nargs = 0; nargs <= 3; nargs++) { + for (Class<?> rtype : new Class<?>[] { Object.class, + List.class, + int.class, + byte.class, + long.class, + CharSequence.class, + String.class }) { + testFilterReturnValue(nargs, rtype); + } + } + } + + void testFilterReturnValue(int nargs, Class<?> rtype) throws Throwable { + countTest(); + MethodHandle target = varargsList(nargs, rtype); + MethodHandle filter; + if (List.class.isAssignableFrom(rtype) || rtype.isAssignableFrom(List.class)) + filter = varargsList(1); // add another layer of list-ness + else + filter = MethodHandles.identity(rtype); + filter = filter.asType(MethodType.methodType(target.type().returnType(), rtype)); + Object[] argsToPass = randomArgs(nargs, Object.class); + if (verbosity >= 3) + System.out.println("filter "+target+" to "+rtype.getSimpleName()+" with "+filter); + MethodHandle target2 = MethodHandles.filterReturnValue(target, filter); + if (verbosity >= 4) + System.out.println("filtered target: "+target2); + // Simulate expected effect of filter on return value: + Object unfiltered = target.invokeWithArguments(argsToPass); + Object expected = filter.invokeWithArguments(unfiltered); + if (verbosity >= 4) + System.out.println("unfiltered: "+unfiltered+" : "+unfiltered.getClass().getSimpleName()); + if (verbosity >= 4) + System.out.println("expected: "+expected+" : "+expected.getClass().getSimpleName()); + Object result = target2.invokeWithArguments(argsToPass); + if (verbosity >= 3) + System.out.println("result: "+result+" : "+result.getClass().getSimpleName()); + if (!expected.equals(result)) + System.out.println("*** fail at n/rt = "+nargs+"/"+rtype.getSimpleName()+": "+ + Arrays.asList(argsToPass)+" => "+result+" != "+expected); + assertEquals(expected, result); + } + + @Test + public void testFilterArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFilterArguments0); + } + + public void testFilterArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("filterArguments"); + for (int nargs = 1; nargs <= 6; nargs++) { + for (int pos = 0; pos < nargs; pos++) { + testFilterArguments(nargs, pos); + } + } + } + + void testFilterArguments(int nargs, int pos) throws Throwable { + countTest(); + MethodHandle target = varargsList(nargs); + MethodHandle filter = varargsList(1); + filter = filter.asType(filter.type().generic()); + Object[] argsToPass = randomArgs(nargs, Object.class); + if (verbosity >= 3) + System.out.println("filter "+target+" at "+pos+" with "+filter); + MethodHandle target2 = MethodHandles.filterArguments(target, pos, filter); + // Simulate expected effect of filter on arglist: + Object[] filteredArgs = argsToPass.clone(); + filteredArgs[pos] = filter.invokeExact(filteredArgs[pos]); + List<Object> expected = Arrays.asList(filteredArgs); + Object result = target2.invokeWithArguments(argsToPass); + if (verbosity >= 3) + System.out.println("result: "+result); + if (!expected.equals(result)) + System.out.println("*** fail at n/p = "+nargs+"/"+pos+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected); + assertEquals(expected, result); + } + + @Test + public void testCollectArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testCollectArguments0); + } + + public void testCollectArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("collectArguments"); + testFoldOrCollectArguments(true, false); + } + + @Test + public void testFoldArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFoldArguments0); + CodeCacheOverflowProcessor.runMHTest(this::testFoldArguments1); + } + + public void testFoldArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("foldArguments"); + testFoldOrCollectArguments(false, false); + } + + public void testFoldArguments1() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("foldArguments/pos"); + testFoldOrCollectArguments(false, true); + } + + void testFoldOrCollectArguments(boolean isCollect, boolean withFoldPos) throws Throwable { + assert !(isCollect && withFoldPos); // exclude illegal argument combination + for (Class<?> lastType : new Class<?>[]{ Object.class, String.class, int.class }) { + for (Class<?> collectType : new Class<?>[]{ Object.class, String.class, int.class, void.class }) { + int maxArity = 10; + if (collectType != String.class) maxArity = 5; + if (lastType != Object.class) maxArity = 4; + for (int nargs = 0; nargs <= maxArity; nargs++) { + ArrayList<Class<?>> argTypes = new ArrayList<>(Collections.nCopies(nargs, Object.class)); + int maxMix = 20; + if (collectType != Object.class) maxMix = 0; + Map<Object,Integer> argTypesSeen = new HashMap<>(); + for (int mix = 0; mix <= maxMix; mix++) { + if (!mixArgs(argTypes, mix, argTypesSeen)) continue; + for (int collect = 0; collect <= nargs; collect++) { + for (int pos = 0; pos <= nargs - collect; pos++) { + testFoldOrCollectArguments(argTypes, pos, collect, collectType, lastType, isCollect, withFoldPos); + } + } + } + } + } + } + } + + boolean mixArgs(List<Class<?>> argTypes, int mix, Map<Object,Integer> argTypesSeen) { + assert(mix >= 0); + if (mix == 0) return true; // no change + if ((mix >>> argTypes.size()) != 0) return false; + for (int i = 0; i < argTypes.size(); i++) { + if (i >= 31) break; + boolean bit = (mix & (1 << i)) != 0; + if (bit) { + Class<?> type = argTypes.get(i); + if (type == Object.class) + type = String.class; + else if (type == String.class) + type = int.class; + else + type = Object.class; + argTypes.set(i, type); + } + } + Integer prev = argTypesSeen.put(new ArrayList<>(argTypes), mix); + if (prev != null) { + if (verbosity >= 4) System.out.println("mix "+prev+" repeated "+mix+": "+argTypes); + return false; + } + if (verbosity >= 3) System.out.println("mix "+mix+" = "+argTypes); + return true; + } + + void testFoldOrCollectArguments(List<Class<?>> argTypes, // argument types minus the inserted combineType + int pos, int fold, // position and length of the folded arguments + Class<?> combineType, // type returned from the combiner + Class<?> lastType, // type returned from the target + boolean isCollect, + boolean withFoldPos) throws Throwable { + int nargs = argTypes.size(); + if (pos != 0 && !isCollect && !withFoldPos) return; // test MethodHandles.foldArguments(MH,MH) only for pos=0 + countTest(); + List<Class<?>> combineArgTypes = argTypes.subList(pos, pos + fold); + List<Class<?>> targetArgTypes = new ArrayList<>(argTypes); + if (isCollect) // does target see arg[pos..pos+cc-1]? + targetArgTypes.subList(pos, pos + fold).clear(); + if (combineType != void.class) + targetArgTypes.add(pos, combineType); + MethodHandle target = varargsList(targetArgTypes, lastType); + MethodHandle combine = varargsList(combineArgTypes, combineType); + List<Object> argsToPass = Arrays.asList(randomArgs(argTypes)); + if (verbosity >= 3) + System.out.println((isCollect ? "collect" : "fold")+" "+target+" with "+combine); + MethodHandle target2; + if (isCollect) + target2 = MethodHandles.collectArguments(target, pos, combine); + else + target2 = withFoldPos ? MethodHandles.foldArguments(target, pos, combine) : MethodHandles.foldArguments(target, combine); + // Simulate expected effect of combiner on arglist: + List<Object> expectedList = new ArrayList<>(argsToPass); + List<Object> argsToFold = expectedList.subList(pos, pos + fold); + if (verbosity >= 3) + System.out.println((isCollect ? "collect" : "fold")+": "+argsToFold+" into "+target2); + Object foldedArgs = combine.invokeWithArguments(argsToFold); + if (isCollect) + argsToFold.clear(); + if (combineType != void.class) + argsToFold.add(0, foldedArgs); + Object result = target2.invokeWithArguments(argsToPass); + if (verbosity >= 3) + System.out.println("result: "+result); + Object expected = target.invokeWithArguments(expectedList); + if (!expected.equals(result)) + System.out.println("*** fail at n/p/f = "+nargs+"/"+pos+"/"+fold+": "+argsToPass+" => "+result+" != "+expected); + assertEquals(expected, result); + } + + @Test + public void testDropArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testDropArguments0); + } + + public void testDropArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("dropArguments"); + for (int nargs = 0; nargs <= 4; nargs++) { + for (int drop = 1; drop <= 4; drop++) { + for (int pos = 0; pos <= nargs; pos++) { + testDropArguments(nargs, pos, drop); + } + } + } + } + + void testDropArguments(int nargs, int pos, int drop) throws Throwable { + countTest(); + MethodHandle target = varargsArray(nargs); + Object[] args = randomArgs(target.type().parameterArray()); + MethodHandle target2 = MethodHandles.dropArguments(target, pos, + Collections.nCopies(drop, Object.class).toArray(new Class<?>[0])); + List<Object> resList = Arrays.asList(args); + List<Object> argsToDrop = new ArrayList<>(resList); + for (int i = drop; i > 0; i--) { + argsToDrop.add(pos, "blort#"+i); + } + Object res2 = target2.invokeWithArguments(argsToDrop); + Object res2List = Arrays.asList((Object[])res2); + //if (!resList.equals(res2List)) + // System.out.println("*** fail at n/p/d = "+nargs+"/"+pos+"/"+drop+": "+argsToDrop+" => "+res2List); + assertEquals(resList, res2List); + } + + @Test + public void testGuardWithTest() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testGuardWithTest0); + } + + public void testGuardWithTest0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("guardWithTest"); + for (int nargs = 0; nargs <= 50; nargs++) { + if (CAN_TEST_LIGHTLY && nargs > 7) break; + testGuardWithTest(nargs, Object.class); + testGuardWithTest(nargs, String.class); + } + } + + void testGuardWithTest(int nargs, Class<?> argClass) throws Throwable { + testGuardWithTest(nargs, 0, argClass); + if (nargs <= 5 || nargs % 10 == 3) { + for (int testDrops = 1; testDrops <= nargs; testDrops++) + testGuardWithTest(nargs, testDrops, argClass); + } + } + + void testGuardWithTest(int nargs, int testDrops, Class<?> argClass) throws Throwable { + countTest(); + int nargs1 = Math.min(3, nargs); + MethodHandle test = PRIVATE.findVirtual(Object.class, "equals", MethodType.methodType(boolean.class, Object.class)); + MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "targetIfEquals", MethodType.genericMethodType(nargs1)); + MethodHandle fallback = PRIVATE.findStatic(MethodHandlesTest.class, "fallbackIfNotEquals", MethodType.genericMethodType(nargs1)); + while (test.type().parameterCount() > nargs) + // 0: test = constant(MISSING_ARG.equals(MISSING_ARG)) + // 1: test = lambda (_) MISSING_ARG.equals(_) + test = MethodHandles.insertArguments(test, 0, MISSING_ARG); + if (argClass != Object.class) { + test = changeArgTypes(test, argClass); + target = changeArgTypes(target, argClass); + fallback = changeArgTypes(fallback, argClass); + } + int testArgs = nargs - testDrops; + assert(testArgs >= 0); + test = addTrailingArgs(test, Math.min(testArgs, nargs), argClass); + target = addTrailingArgs(target, nargs, argClass); + fallback = addTrailingArgs(fallback, nargs, argClass); + Object[][] argLists = { + { }, + { "foo" }, { MethodHandlesTest.MISSING_ARG }, + { "foo", "foo" }, { "foo", "bar" }, + { "foo", "foo", "baz" }, { "foo", "bar", "baz" } + }; + for (Object[] argList : argLists) { + Object[] argList1 = argList; + if (argList.length != nargs) { + if (argList.length != nargs1) continue; + argList1 = Arrays.copyOf(argList, nargs); + Arrays.fill(argList1, nargs1, nargs, MethodHandlesTest.MISSING_ARG_2); + } + MethodHandle test1 = test; + if (test1.type().parameterCount() > testArgs) { + int pc = test1.type().parameterCount(); + test1 = MethodHandles.insertArguments(test, testArgs, Arrays.copyOfRange(argList1, testArgs, pc)); + } + MethodHandle mh = MethodHandles.guardWithTest(test1, target, fallback); + assertEquals(target.type(), mh.type()); + boolean equals; + switch (nargs) { + case 0: equals = true; break; + case 1: equals = MethodHandlesTest.MISSING_ARG.equals(argList[0]); break; + default: equals = argList[0].equals(argList[1]); break; + } + String willCall = (equals ? "targetIfEquals" : "fallbackIfNotEquals"); + if (verbosity >= 3) + System.out.println(logEntry(willCall, argList)); + Object result = mh.invokeWithArguments(argList1); + assertCalled(willCall, argList); + } + } + + @Test + public void testGenericLoopCombinator() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testGenericLoopCombinator0); + } + + public void testGenericLoopCombinator0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("loop"); + // Test as follows: + // * Have an increasing number of loop-local state. Local state type diversity grows with the number. + // * Initializers set the starting value of loop-local state from the corresponding loop argument. + // * For each local state element, there is a predicate - for all state combinations, exercise all predicates. + // * Steps modify each local state element in each iteration. + // * Finalizers group all local state elements into a resulting array. Verify end values. + // * Exercise both pre- and post-checked loops. + // Local state types, start values, predicates, and steps: + // * int a, 0, a < 7, a = a + 1 + // * double b, 7.0, b > 0.5, b = b / 2.0 + // * String c, "start", c.length <= 9, c = c + a + final Class<?>[] argTypes = new Class<?>[] {int.class, double.class, String.class}; + final Object[][] args = new Object[][] { + new Object[]{0 }, + new Object[]{0, 7.0 }, + new Object[]{0, 7.0, "start"} + }; + // These are the expected final state tuples for argument type tuple / predicate combinations, for pre- and + // post-checked loops: + final Object[][] preCheckedResults = new Object[][] { + new Object[]{7 }, // (int) / int + new Object[]{7, 0.0546875 }, // (int,double) / int + new Object[]{5, 0.4375 }, // (int,double) / double + new Object[]{7, 0.0546875, "start1234567"}, // (int,double,String) / int + new Object[]{5, 0.4375, "start1234" }, // (int,double,String) / double + new Object[]{6, 0.109375, "start12345" } // (int,double,String) / String + }; + final Object[][] postCheckedResults = new Object[][] { + new Object[]{7 }, // (int) / int + new Object[]{7, 0.109375 }, // (int,double) / int + new Object[]{4, 0.4375 }, // (int,double) / double + new Object[]{7, 0.109375, "start123456"}, // (int,double,String) / int + new Object[]{4, 0.4375, "start123" }, // (int,double,String) / double + new Object[]{5, 0.21875, "start12345" } // (int,double,String) / String + }; + final Lookup l = MethodHandles.lookup(); + final Class<?> MHT = MethodHandlesTest.class; + final Class<?> B = boolean.class; + final Class<?> I = int.class; + final Class<?> D = double.class; + final Class<?> S = String.class; + final MethodHandle hip = l.findStatic(MHT, "loopIntPred", methodType(B, I)); + final MethodHandle hdp = l.findStatic(MHT, "loopDoublePred", methodType(B, I, D)); + final MethodHandle hsp = l.findStatic(MHT, "loopStringPred", methodType(B, I, D, S)); + final MethodHandle his = l.findStatic(MHT, "loopIntStep", methodType(I, I)); + final MethodHandle hds = l.findStatic(MHT, "loopDoubleStep", methodType(D, I, D)); + final MethodHandle hss = l.findStatic(MHT, "loopStringStep", methodType(S, I, D, S)); + final MethodHandle[] preds = new MethodHandle[] {hip, hdp, hsp}; + final MethodHandle[] steps = new MethodHandle[] {his, hds, hss}; + for (int nargs = 1, useResultsStart = 0; nargs <= argTypes.length; useResultsStart += nargs++) { + Class<?>[] useArgTypes = Arrays.copyOf(argTypes, nargs, Class[].class); + MethodHandle[] usePreds = Arrays.copyOf(preds, nargs, MethodHandle[].class); + MethodHandle[] useSteps = Arrays.copyOf(steps, nargs, MethodHandle[].class); + Object[] useArgs = args[nargs - 1]; + Object[][] usePreCheckedResults = new Object[nargs][]; + Object[][] usePostCheckedResults = new Object[nargs][]; + System.arraycopy(preCheckedResults, useResultsStart, usePreCheckedResults, 0, nargs); + System.arraycopy(postCheckedResults, useResultsStart, usePostCheckedResults, 0, nargs); + testGenericLoopCombinator(nargs, useArgTypes, usePreds, useSteps, useArgs, usePreCheckedResults, + usePostCheckedResults); + } + } + + void testGenericLoopCombinator(int nargs, Class<?>[] argTypes, MethodHandle[] preds, MethodHandle[] steps, + Object[] args, Object[][] preCheckedResults, Object[][] postCheckedResults) + throws Throwable { + List<Class<?>> lArgTypes = Arrays.asList(argTypes); + // Predicate and step handles are passed in as arguments, initializer and finalizer handles are constructed here + // from the available information. + MethodHandle[] inits = new MethodHandle[nargs]; + for (int i = 0; i < nargs; ++i) { + MethodHandle h; + // Initializers are meant to return whatever they are passed at a given argument position. This means that + // additional arguments may have to be appended and prepended. + h = MethodHandles.identity(argTypes[i]); + if (i < nargs - 1) { + h = MethodHandles.dropArguments(h, 1, lArgTypes.subList(i + 1, nargs)); + } + if (i > 0) { + h = MethodHandles.dropArguments(h, 0, lArgTypes.subList(0, i)); + } + inits[i] = h; + } + // Finalizers are all meant to collect all of the loop-local state in a single array and return that. Local + // state is passed before the loop args. Construct such a finalizer by first taking a varargsArray collector for + // the number of local state arguments, and then appending the loop args as to-be-dropped arguments. + MethodHandle[] finis = new MethodHandle[nargs]; + MethodHandle genericFini = MethodHandles.dropArguments( + varargsArray(nargs).asType(methodType(Object[].class, lArgTypes)), nargs, lArgTypes); + Arrays.fill(finis, genericFini); + // The predicate and step handles' signatures need to be extended. They currently just accept local state args; + // append possibly missing local state args and loop args using dropArguments. + for (int i = 0; i < nargs; ++i) { + List<Class<?>> additionalLocalStateArgTypes = lArgTypes.subList(i + 1, nargs); + preds[i] = MethodHandles.dropArguments( + MethodHandles.dropArguments(preds[i], i + 1, additionalLocalStateArgTypes), nargs, lArgTypes); + steps[i] = MethodHandles.dropArguments( + MethodHandles.dropArguments(steps[i], i + 1, additionalLocalStateArgTypes), nargs, lArgTypes); + } + // Iterate over all of the predicates, using only one of them at a time. + for (int i = 0; i < nargs; ++i) { + MethodHandle[] usePreds; + if (nargs == 1) { + usePreds = preds; + } else { + // Create an all-null preds array, and only use one predicate in this iteration. The null entries will + // be substituted with true predicates by the loop combinator. + usePreds = new MethodHandle[nargs]; + usePreds[i] = preds[i]; + } + // Go for it. + if (verbosity >= 3) { + System.out.println("calling loop for argument types " + lArgTypes + " with predicate at index " + i); + if (verbosity >= 5) { + System.out.println("predicates: " + Arrays.asList(usePreds)); + } + } + MethodHandle[] preInits = new MethodHandle[nargs + 1]; + MethodHandle[] prePreds = new MethodHandle[nargs + 1]; + MethodHandle[] preSteps = new MethodHandle[nargs + 1]; + MethodHandle[] preFinis = new MethodHandle[nargs + 1]; + System.arraycopy(inits, 0, preInits, 1, nargs); + System.arraycopy(usePreds, 0, prePreds, 0, nargs); // preds are offset by 1 for pre-checked loops + System.arraycopy(steps, 0, preSteps, 1, nargs); + System.arraycopy(finis, 0, preFinis, 0, nargs); // finis are also offset by 1 for pre-checked loops + // Convert to clause-major form. + MethodHandle[][] preClauses = new MethodHandle[nargs + 1][4]; + MethodHandle[][] postClauses = new MethodHandle[nargs][4]; + toClauseMajor(preClauses, preInits, preSteps, prePreds, preFinis); + toClauseMajor(postClauses, inits, steps, usePreds, finis); + MethodHandle pre = MethodHandles.loop(preClauses); + MethodHandle post = MethodHandles.loop(postClauses); + if (verbosity >= 6) { + System.out.println("pre-handle: " + pre); + } + Object[] preResults = (Object[]) pre.invokeWithArguments(args); + if (verbosity >= 4) { + System.out.println("pre-checked: expected " + Arrays.asList(preCheckedResults[i]) + ", actual " + + Arrays.asList(preResults)); + } + if (verbosity >= 6) { + System.out.println("post-handle: " + post); + } + Object[] postResults = (Object[]) post.invokeWithArguments(args); + if (verbosity >= 4) { + System.out.println("post-checked: expected " + Arrays.asList(postCheckedResults[i]) + ", actual " + + Arrays.asList(postResults)); + } + assertArrayEquals(preCheckedResults[i], preResults); + assertArrayEquals(postCheckedResults[i], postResults); + } + } + + static void toClauseMajor(MethodHandle[][] clauses, MethodHandle[] init, MethodHandle[] step, MethodHandle[] pred, MethodHandle[] fini) { + for (int i = 0; i < clauses.length; ++i) { + clauses[i][0] = init[i]; + clauses[i][1] = step[i]; + clauses[i][2] = pred[i]; + clauses[i][3] = fini[i]; + } + } + + @Test + public void testThrowException() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testThrowException0); + } + + public void testThrowException0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("throwException"); + testThrowException(int.class, new ClassCastException("testing")); + testThrowException(void.class, new java.io.IOException("testing")); + testThrowException(String.class, new LinkageError("testing")); + } + + void testThrowException(Class<?> returnType, Throwable thrown) throws Throwable { + countTest(); + Class<? extends Throwable> exType = thrown.getClass(); + MethodHandle target = MethodHandles.throwException(returnType, exType); + //System.out.println("throwing with "+target+" : "+thrown); + MethodType expectedType = MethodType.methodType(returnType, exType); + assertEquals(expectedType, target.type()); + target = target.asType(target.type().generic()); + Throwable caught = null; + try { + Object res = target.invokeExact((Object) thrown); + fail("got "+res+" instead of throwing "+thrown); + } catch (Throwable ex) { + if (ex != thrown) { + if (ex instanceof Error) throw (Error)ex; + if (ex instanceof RuntimeException) throw (RuntimeException)ex; + } + caught = ex; + } + assertSame(thrown, caught); + } + + @Test + public void testTryFinally() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testTryFinally0); + } + + public void testTryFinally0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("tryFinally"); + String inputMessage = "returned"; + String augmentedMessage = "augmented"; + String thrownMessage = "thrown"; + String rethrownMessage = "rethrown"; + // Test these cases: + // * target returns, cleanup passes through + // * target returns, cleanup augments + // * target throws, cleanup augments and returns + // * target throws, cleanup augments and rethrows + MethodHandle target = MethodHandles.identity(String.class); + MethodHandle targetThrow = MethodHandles.dropArguments( + MethodHandles.throwException(String.class, Exception.class).bindTo(new Exception(thrownMessage)), 0, String.class); + MethodHandle cleanupPassThrough = MethodHandles.dropArguments(MethodHandles.identity(String.class), 0, + Throwable.class, String.class); + MethodHandle cleanupAugment = MethodHandles.dropArguments(MethodHandles.constant(String.class, augmentedMessage), + 0, Throwable.class, String.class, String.class); + MethodHandle cleanupCatch = MethodHandles.dropArguments(MethodHandles.constant(String.class, thrownMessage), 0, + Throwable.class, String.class, String.class); + MethodHandle cleanupThrow = MethodHandles.dropArguments(MethodHandles.throwException(String.class, Exception.class). + bindTo(new Exception(rethrownMessage)), 0, Throwable.class, String.class, String.class); + testTryFinally(target, cleanupPassThrough, inputMessage, inputMessage, false); + testTryFinally(target, cleanupAugment, inputMessage, augmentedMessage, false); + testTryFinally(targetThrow, cleanupCatch, inputMessage, thrownMessage, true); + testTryFinally(targetThrow, cleanupThrow, inputMessage, rethrownMessage, true); + // Test the same cases as above for void targets and cleanups. + MethodHandles.Lookup lookup = MethodHandles.lookup(); + Class<?> C = this.getClass(); + MethodType targetType = methodType(void.class, String[].class); + MethodType cleanupType = methodType(void.class, Throwable.class, String[].class); + MethodHandle vtarget = lookup.findStatic(C, "vtarget", targetType); + MethodHandle vtargetThrow = lookup.findStatic(C, "vtargetThrow", targetType); + MethodHandle vcleanupPassThrough = lookup.findStatic(C, "vcleanupPassThrough", cleanupType); + MethodHandle vcleanupAugment = lookup.findStatic(C, "vcleanupAugment", cleanupType); + MethodHandle vcleanupCatch = lookup.findStatic(C, "vcleanupCatch", cleanupType); + MethodHandle vcleanupThrow = lookup.findStatic(C, "vcleanupThrow", cleanupType); + testTryFinally(vtarget, vcleanupPassThrough, inputMessage, inputMessage, false); + testTryFinally(vtarget, vcleanupAugment, inputMessage, augmentedMessage, false); + testTryFinally(vtargetThrow, vcleanupCatch, inputMessage, thrownMessage, true); + testTryFinally(vtargetThrow, vcleanupThrow, inputMessage, rethrownMessage, true); + } + + void testTryFinally(MethodHandle target, MethodHandle cleanup, String input, String msg, boolean mustCatch) + throws Throwable { + countTest(); + MethodHandle tf = MethodHandles.tryFinally(target, cleanup); + String result = null; + boolean isVoid = target.type().returnType() == void.class; + String[] argArray = new String[]{input}; + try { + if (isVoid) { + tf.invoke(argArray); + } else { + result = (String) tf.invoke(input); + } + } catch (Throwable t) { + assertTrue(mustCatch); + assertEquals(msg, t.getMessage()); + return; + } + assertFalse(mustCatch); + if (isVoid) { + assertEquals(msg, argArray[0]); + } else { + assertEquals(msg, result); + } + } + + @Test + public void testAsInterfaceInstance() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testAsInterfaceInstance0); + } + + public void testAsInterfaceInstance0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("asInterfaceInstance"); + Lookup lookup = MethodHandles.lookup(); + // test typical case: Runnable.run + { + countTest(); + if (verbosity >= 2) System.out.println("Runnable"); + MethodType mt = MethodType.methodType(void.class); + MethodHandle mh = lookup.findStatic(MethodHandlesGeneralTest.class, "runForRunnable", mt); + Runnable proxy = MethodHandleProxies.asInterfaceInstance(Runnable.class, mh); + proxy.run(); + assertCalled("runForRunnable"); + } + // well known single-name overloaded interface: Appendable.append + { + countTest(); + if (verbosity >= 2) System.out.println("Appendable"); + ArrayList<List<?>> appendResults = new ArrayList<>(); + MethodHandle append = lookup.bind(appendResults, "add", MethodType.methodType(boolean.class, Object.class)); + append = append.asType(MethodType.methodType(void.class, List.class)); // specialize the type + MethodHandle asList = lookup.findStatic(Arrays.class, "asList", MethodType.methodType(List.class, Object[].class)); + MethodHandle mh = MethodHandles.filterReturnValue(asList, append).asVarargsCollector(Object[].class); + Appendable proxy = MethodHandleProxies.asInterfaceInstance(Appendable.class, mh); + proxy.append("one"); + proxy.append("two", 3, 4); + proxy.append('5'); + assertEquals(Arrays.asList(Arrays.asList("one"), + Arrays.asList("two", 3, 4), + Arrays.asList('5')), + appendResults); + if (verbosity >= 3) System.out.println("appendResults="+appendResults); + appendResults.clear(); + Formatter formatter = new Formatter(proxy); + String fmt = "foo str=%s char='%c' num=%d"; + Object[] fmtArgs = { "str!", 'C', 42 }; + String expect = String.format(fmt, fmtArgs); + formatter.format(fmt, fmtArgs); + String actual = ""; + if (verbosity >= 3) System.out.println("appendResults="+appendResults); + for (List<?> l : appendResults) { + Object x = l.get(0); + switch (l.size()) { + case 1: actual += x; continue; + case 3: actual += ((String)x).substring((int)(Object)l.get(1), (int)(Object)l.get(2)); continue; + } + actual += l; + } + if (verbosity >= 3) System.out.println("expect="+expect); + if (verbosity >= 3) System.out.println("actual="+actual); + assertEquals(expect, actual); + } + // test case of an single name which is overloaded: Fooable.foo(...) + { + if (verbosity >= 2) System.out.println("Fooable"); + MethodHandle mh = lookup.findStatic(MethodHandlesGeneralTest.class, "fooForFooable", + MethodType.methodType(Object.class, String.class, Object[].class)); + Fooable proxy = MethodHandleProxies.asInterfaceInstance(Fooable.class, mh); + for (Method m : Fooable.class.getDeclaredMethods()) { + countTest(); + assertSame("foo", m.getName()); + if (verbosity > 3) + System.out.println("calling "+m); + MethodHandle invoker = lookup.unreflect(m); + MethodType mt = invoker.type(); + Class<?>[] types = mt.parameterArray(); + types[0] = int.class; // placeholder + Object[] args = randomArgs(types); + args[0] = proxy; + if (verbosity > 3) + System.out.println("calling "+m+" on "+Arrays.asList(args)); + Object result = invoker.invokeWithArguments(args); + if (verbosity > 4) + System.out.println("result = "+result); + String name = "fooForFooable/"+args[1]; + Object[] argTail = Arrays.copyOfRange(args, 2, args.length); + assertCalled(name, argTail); + assertEquals(result, logEntry(name, argTail)); + } + } + // test processing of thrown exceptions: + for (Throwable ex : new Throwable[] { new NullPointerException("ok"), + new InternalError("ok"), + new Throwable("fail"), + new Exception("fail"), + new MyCheckedException() + }) { + MethodHandle mh = MethodHandles.throwException(void.class, Throwable.class); + mh = MethodHandles.insertArguments(mh, 0, ex); + WillThrow proxy = MethodHandleProxies.asInterfaceInstance(WillThrow.class, mh); + try { + countTest(); + proxy.willThrow(); + System.out.println("Failed to throw: "+ex); + assertTrue(false); + } catch (Throwable ex1) { + if (verbosity > 3) { + System.out.println("throw "+ex); + System.out.println("catch "+(ex == ex1 ? "UNWRAPPED" : ex1)); + } + if (ex instanceof RuntimeException || + ex instanceof Error) { + assertSame("must pass unchecked exception out without wrapping", ex, ex1); + } else if (ex instanceof MyCheckedException) { + assertSame("must pass declared exception out without wrapping", ex, ex1); + } else { + assertNotSame("must pass undeclared checked exception with wrapping", ex, ex1); + if (!(ex1 instanceof UndeclaredThrowableException) || ex1.getCause() != ex) { + ex1.printStackTrace(System.out); + } + assertSame(ex, ex1.getCause()); + UndeclaredThrowableException utex = (UndeclaredThrowableException) ex1; + } + } + } + // Test error checking on bad interfaces: + for (Class<?> nonSMI : new Class<?>[] { Object.class, + String.class, + CharSequence.class, + java.io.Serializable.class, + PrivateRunnable.class, + Example.class }) { + if (verbosity > 2) System.out.println(nonSMI.getName()); + try { + countTest(false); + MethodHandleProxies.asInterfaceInstance(nonSMI, varargsArray(0)); + assertTrue("Failed to throw on "+nonSMI.getName(), false); + } catch (IllegalArgumentException ex) { + if (verbosity > 2) System.out.println(nonSMI.getSimpleName()+": "+ex); + // Object: java.lang.IllegalArgumentException: + // not a public interface: java.lang.Object + // String: java.lang.IllegalArgumentException: + // not a public interface: java.lang.String + // CharSequence: java.lang.IllegalArgumentException: + // not a single-method interface: java.lang.CharSequence + // Serializable: java.lang.IllegalArgumentException: + // not a single-method interface: java.io.Serializable + // PrivateRunnable: java.lang.IllegalArgumentException: + // not a public interface: test.java.lang.invoke.MethodHandlesTest$PrivateRunnable + // Example: java.lang.IllegalArgumentException: + // not a public interface: test.java.lang.invoke.MethodHandlesTest$Example + } + } + // Test error checking on interfaces with the wrong method type: + for (Class<?> intfc : new Class<?>[] { Runnable.class /*arity 0*/, + Fooable.class /*arity 1 & 2*/ }) { + int badArity = 1; // known to be incompatible + if (verbosity > 2) System.out.println(intfc.getName()); + try { + countTest(false); + MethodHandleProxies.asInterfaceInstance(intfc, varargsArray(badArity)); + assertTrue("Failed to throw on "+intfc.getName(), false); + } catch (WrongMethodTypeException ex) { + if (verbosity > 2) System.out.println(intfc.getSimpleName()+": "+ex); + // Runnable: java.lang.invoke.WrongMethodTypeException: + // cannot convert MethodHandle(Object)Object[] to ()void + // Fooable: java.lang.invoke.WrongMethodTypeException: + // cannot convert MethodHandle(Object)Object[] to (Object,String)Object + } + } + } + + @Test + public void testInterfaceCast() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testInterfaceCast0); + } + + public void testInterfaceCast0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("interfaceCast"); + assert( (((Object)"foo") instanceof CharSequence)); + assert(!(((Object)"foo") instanceof Iterable)); + for (MethodHandle mh : new MethodHandle[]{ + MethodHandles.identity(String.class), + MethodHandles.identity(CharSequence.class), + MethodHandles.identity(Iterable.class) + }) { + if (verbosity > 0) System.out.println("-- mh = "+mh); + for (Class<?> ctype : new Class<?>[]{ + Object.class, String.class, CharSequence.class, + Number.class, Iterable.class + }) { + if (verbosity > 0) System.out.println("---- ctype = "+ctype.getName()); + // doret docast + testInterfaceCast(mh, ctype, false, false); + testInterfaceCast(mh, ctype, true, false); + testInterfaceCast(mh, ctype, false, true); + testInterfaceCast(mh, ctype, true, true); + } + } + } + + private static Class<?> i2o(Class<?> c) { + return (c.isInterface() ? Object.class : c); + } + + public void testInterfaceCast(MethodHandle mh, Class<?> ctype, + boolean doret, boolean docast) throws Throwable { + MethodHandle mh0 = mh; + if (verbosity > 1) + System.out.println("mh="+mh+", ctype="+ctype.getName()+", doret="+doret+", docast="+docast); + String normalRetVal = "normal return value"; + MethodType mt = mh.type(); + MethodType mt0 = mt; + if (doret) mt = mt.changeReturnType(ctype); + else mt = mt.changeParameterType(0, ctype); + if (docast) mh = MethodHandles.explicitCastArguments(mh, mt); + else mh = mh.asType(mt); + assertEquals(mt, mh.type()); + MethodType mt1 = mt; + // this bit is needed to make the interface types disappear for invokeWithArguments: + mh = MethodHandles.explicitCastArguments(mh, mt.generic()); + Class<?>[] step = { + mt1.parameterType(0), // param as passed to mh at first + mt0.parameterType(0), // param after incoming cast + mt0.returnType(), // return value before cast + mt1.returnType(), // return value after outgoing cast + }; + // where might a checkCast occur? + boolean[] checkCast = new boolean[step.length]; + // the string value must pass each step without causing an exception + if (!docast) { + if (!doret) { + if (step[0] != step[1]) + checkCast[1] = true; // incoming value is cast + } else { + if (step[2] != step[3]) + checkCast[3] = true; // outgoing value is cast + } + } + boolean expectFail = false; + for (int i = 0; i < step.length; i++) { + Class<?> c = step[i]; + if (!checkCast[i]) c = i2o(c); + if (!c.isInstance(normalRetVal)) { + if (verbosity > 3) + System.out.println("expect failure at step "+i+" in "+Arrays.toString(step)+Arrays.toString(checkCast)); + expectFail = true; + break; + } + } + countTest(!expectFail); + if (verbosity > 2) + System.out.println("expectFail="+expectFail+", mt="+mt); + Object res; + try { + res = mh.invokeWithArguments(normalRetVal); + } catch (Exception ex) { + res = ex; + } + boolean sawFail = !(res instanceof String); + if (sawFail != expectFail) { + System.out.println("*** testInterfaceCast: mh0 = "+mh0); + System.out.println(" retype using "+(docast ? "explicitCastArguments" : "asType")+" to "+mt+" => "+mh); + System.out.println(" call returned "+res); + System.out.println(" expected "+(expectFail ? "an exception" : normalRetVal)); + } + if (!expectFail) { + assertFalse(res.toString(), sawFail); + assertEquals(normalRetVal, res); + } else { + assertTrue(res.toString(), sawFail); + } + } + + static Example userMethod(Object o, String s, int i) { + called("userMethod", o, s, i); + return null; + } + + @Test + public void testUserClassInSignature() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUserClassInSignature0); + } + + public void testUserClassInSignature0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("testUserClassInSignature"); + Lookup lookup = MethodHandles.lookup(); + String name; MethodType mt; MethodHandle mh; + Object[] args; + + // Try a static method. + name = "userMethod"; + mt = MethodType.methodType(Example.class, Object.class, String.class, int.class); + mh = lookup.findStatic(lookup.lookupClass(), name, mt); + assertEquals(mt, mh.type()); + assertEquals(Example.class, mh.type().returnType()); + args = randomArgs(mh.type().parameterArray()); + mh.invokeWithArguments(args); + assertCalled(name, args); + + // Try a virtual method. + name = "v2"; + mt = MethodType.methodType(Object.class, Object.class, int.class); + mh = lookup.findVirtual(Example.class, name, mt); + assertEquals(mt, mh.type().dropParameterTypes(0,1)); + assertTrue(mh.type().parameterList().contains(Example.class)); + args = randomArgs(mh.type().parameterArray()); + mh.invokeWithArguments(args); + assertCalled(name, args); + } + + static void runForRunnable() { + called("runForRunnable"); + } + + public interface Fooable { + // overloads: + Object foo(Object x, String y); + List<?> foo(String x, int y); + Object foo(String x); + } + + static Object fooForFooable(String x, Object... y) { + return called("fooForFooable/"+x, y); + } + + @SuppressWarnings("serial") // not really a public API, just a test case + public static class MyCheckedException extends Exception { + } + + public interface WillThrow { + void willThrow() throws MyCheckedException; + } + + /*non-public*/ interface PrivateRunnable { + public void run(); + } + + @Test + public void testRunnableProxy() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testRunnableProxy0); + } + + public void testRunnableProxy0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("testRunnableProxy"); + MethodHandles.Lookup lookup = MethodHandles.lookup(); + MethodHandle run = lookup.findStatic(lookup.lookupClass(), "runForRunnable", MethodType.methodType(void.class)); + Runnable r = MethodHandleProxies.asInterfaceInstance(Runnable.class, run); + testRunnableProxy(r); + assertCalled("runForRunnable"); + } + + private static void testRunnableProxy(Runnable r) { + //7058630: JSR 292 method handle proxy violates contract for Object methods + r.run(); + Object o = r; + r = null; + boolean eq = (o == o); + int hc = System.identityHashCode(o); + String st = o.getClass().getName() + "@" + Integer.toHexString(hc); + Object expect = Arrays.asList(st, eq, hc); + if (verbosity >= 2) System.out.println("expect st/eq/hc = "+expect); + Object actual = Arrays.asList(o.toString(), o.equals(o), o.hashCode()); + if (verbosity >= 2) System.out.println("actual st/eq/hc = "+actual); + assertEquals(expect, actual); + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java b/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java new file mode 100644 index 00000000000..a40876c6206 --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java @@ -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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesInsertArgumentsTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesInsertArgumentsTest + */ + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.*; + +public class MethodHandlesInsertArgumentsTest extends MethodHandlesTest { + + @Test // SLOW + public void testInsertArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testInsertArguments0); + } + + public void testInsertArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("insertArguments"); + for (int nargs = 0; nargs < 50; nargs++) { + if (CAN_TEST_LIGHTLY && nargs > 11) break; + for (int ins = 0; ins <= nargs; ins++) { + if (nargs > 10 && ins > 4 && ins < nargs-4 && ins % 10 != 3) + continue; + for (int pos = 0; pos <= nargs; pos++) { + if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) + continue; + if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; + testInsertArguments(nargs, pos, ins); + } + } + } + } + + void testInsertArguments(int nargs, int pos, int ins) throws Throwable { + countTest(); + MethodHandle target = varargsArray(nargs + ins); + Object[] args = randomArgs(target.type().parameterArray()); + List<Object> resList = Arrays.asList(args); + List<Object> argsToPass = new ArrayList<>(resList); + List<Object> argsToInsert = argsToPass.subList(pos, pos + ins); + if (verbosity >= 3) + System.out.println("insert: "+argsToInsert+" @"+pos+" into "+target); + @SuppressWarnings("cast") // cast to spread Object... is helpful + MethodHandle target2 = MethodHandles.insertArguments(target, pos, + (Object[]/*...*/) argsToInsert.toArray()); + argsToInsert.clear(); // remove from argsToInsert + Object res2 = target2.invokeWithArguments(argsToPass); + Object res2List = Arrays.asList((Object[])res2); + if (verbosity >= 3) + System.out.println("result: "+res2List); + assertEquals(resList, res2List); + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java b/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java new file mode 100644 index 00000000000..589881a2b9f --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java @@ -0,0 +1,222 @@ +/* + * 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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesInvokersTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesInvokersTest + */ + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; + +import java.lang.invoke.CallSite; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.MutableCallSite; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.junit.Assert.*; + +public class MethodHandlesInvokersTest extends MethodHandlesTest { + + @Test // SLOW + public void testInvokers() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testInvokers0); + } + + public void testInvokers0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker"); + // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker + Set<MethodType> done = new HashSet<>(); + for (int i = 0; i <= 6; i++) { + if (CAN_TEST_LIGHTLY && i > 3) break; + MethodType gtype = MethodType.genericMethodType(i); + for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { + for (int j = -1; j < i; j++) { + MethodType type = gtype; + if (j < 0) + type = type.changeReturnType(argType); + else if (argType == void.class) + continue; + else + type = type.changeParameterType(j, argType); + if (done.add(type)) + testInvokersWithCatch(type); + MethodType vtype = type.changeReturnType(void.class); + if (done.add(vtype)) + testInvokersWithCatch(vtype); + } + } + } + } + + public void testInvokersWithCatch(MethodType type) throws Throwable { + try { + testInvokers(type); + } catch (Throwable ex) { + System.out.println("*** testInvokers on "+type+" => "); + ex.printStackTrace(System.out); + } + } + + public void testInvokers(MethodType type) throws Throwable { + if (verbosity >= 3) + System.out.println("test invokers for "+type); + int nargs = type.parameterCount(); + boolean testRetCode = type.returnType() != void.class; + MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "invokee", + MethodType.genericMethodType(0, true)); + assertTrue(target.isVarargsCollector()); + target = target.asType(type); + Object[] args = randomArgs(type.parameterArray()); + List<Object> targetPlusArgs = new ArrayList<>(Arrays.asList(args)); + targetPlusArgs.add(0, target); + int code = (Integer) invokee(args); + Object log = logEntry("invokee", args); + assertEquals(log.hashCode(), code); + assertCalled("invokee", args); + MethodHandle inv; + Object result; + // exact invoker + countTest(); + calledLog.clear(); + inv = MethodHandles.exactInvoker(type); + result = inv.invokeWithArguments(targetPlusArgs); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + // generic invoker + countTest(); + inv = MethodHandles.invoker(type); + if (nargs <= 3 && type == type.generic()) { + calledLog.clear(); + switch (nargs) { + case 0: + result = inv.invokeExact(target); + break; + case 1: + result = inv.invokeExact(target, args[0]); + break; + case 2: + result = inv.invokeExact(target, args[0], args[1]); + break; + case 3: + result = inv.invokeExact(target, args[0], args[1], args[2]); + break; + } + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + calledLog.clear(); + result = inv.invokeWithArguments(targetPlusArgs); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + // varargs invoker #0 + calledLog.clear(); + inv = MethodHandles.spreadInvoker(type, 0); + if (type.returnType() == Object.class) { + result = inv.invokeExact(target, args); + } else if (type.returnType() == void.class) { + result = null; inv.invokeExact(target, args); + } else { + result = inv.invokeWithArguments(target, (Object) args); + } + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + if (nargs >= 1 && type == type.generic()) { + // varargs invoker #1 + calledLog.clear(); + inv = MethodHandles.spreadInvoker(type, 1); + result = inv.invokeExact(target, args[0], Arrays.copyOfRange(args, 1, nargs)); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + if (nargs >= 2 && type == type.generic()) { + // varargs invoker #2 + calledLog.clear(); + inv = MethodHandles.spreadInvoker(type, 2); + result = inv.invokeExact(target, args[0], args[1], Arrays.copyOfRange(args, 2, nargs)); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + if (nargs >= 3 && type == type.generic()) { + // varargs invoker #3 + calledLog.clear(); + inv = MethodHandles.spreadInvoker(type, 3); + result = inv.invokeExact(target, args[0], args[1], args[2], Arrays.copyOfRange(args, 3, nargs)); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + for (int k = 0; k <= nargs; k++) { + // varargs invoker #0..N + if (CAN_TEST_LIGHTLY && (k > 1 || k < nargs - 1)) continue; + countTest(); + calledLog.clear(); + inv = MethodHandles.spreadInvoker(type, k); + MethodType expType = (type.dropParameterTypes(k, nargs) + .appendParameterTypes(Object[].class) + .insertParameterTypes(0, MethodHandle.class)); + assertEquals(expType, inv.type()); + List<Object> targetPlusVarArgs = new ArrayList<>(targetPlusArgs); + List<Object> tailList = targetPlusVarArgs.subList(1+k, 1+nargs); + Object[] tail = tailList.toArray(); + tailList.clear(); tailList.add(tail); + result = inv.invokeWithArguments(targetPlusVarArgs); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + + // dynamic invoker + countTest(); + CallSite site = new MutableCallSite(type); + inv = site.dynamicInvoker(); + + // see if we get the result of the original target: + try { + result = inv.invokeWithArguments(args); + assertTrue("should not reach here", false); + } catch (IllegalStateException ex) { + String msg = ex.getMessage(); + assertTrue(msg, msg.contains("site")); + } + + // set new target after invoker is created, to make sure we track target + site.setTarget(target); + calledLog.clear(); + result = inv.invokeWithArguments(args); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java b/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java new file mode 100644 index 00000000000..912a2b9256c --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java @@ -0,0 +1,194 @@ +/* + * 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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesPermuteArgumentsTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesPermuteArgumentsTest + */ + + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.util.Arrays; + +import static org.junit.Assert.*; + +public class MethodHandlesPermuteArgumentsTest extends MethodHandlesTest { + + @Test // SLOW + public void testPermuteArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testPermuteArguments0); + } + + public void testPermuteArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("permuteArguments"); + testPermuteArguments(4, Integer.class, 2, long.class, 6); + if (CAN_TEST_LIGHTLY) return; + testPermuteArguments(4, Integer.class, 2, String.class, 0); + testPermuteArguments(6, Integer.class, 0, null, 30); + } + + public void testPermuteArguments(int max, Class<?> type1, int t2c, Class<?> type2, int dilution) throws Throwable { + if (verbosity >= 2) + System.out.println("permuteArguments "+max+"*"+type1.getName() + +(t2c==0?"":"/"+t2c+"*"+type2.getName()) + +(dilution > 0 ? " with dilution "+dilution : "")); + int t2pos = t2c == 0 ? 0 : 1; + for (int inargs = t2pos+1; inargs <= max; inargs++) { + Class<?>[] types = new Class<?>[inargs]; + Arrays.fill(types, type1); + if (t2c != 0) { + // Fill in a middle range with type2: + Arrays.fill(types, t2pos, Math.min(t2pos+t2c, inargs), type2); + } + Object[] args = randomArgs(types); + int numcases = 1; + for (int outargs = 0; outargs <= max; outargs++) { + if (outargs - inargs >= MAX_ARG_INCREASE) continue; + int casStep = dilution + 1; + // Avoid some common factors: + while ((casStep > 2 && casStep % 2 == 0 && inargs % 2 == 0) || + (casStep > 3 && casStep % 3 == 0 && inargs % 3 == 0)) + casStep++; + testPermuteArguments(args, types, outargs, numcases, casStep); + numcases *= inargs; + if (CAN_TEST_LIGHTLY && outargs < max-2) continue; + if (dilution > 10 && outargs >= 4) { + if (CAN_TEST_LIGHTLY) continue; + int[] reorder = new int[outargs]; + // Do some special patterns, which we probably missed. + // Replication of a single argument or argument pair. + for (int i = 0; i < inargs; i++) { + Arrays.fill(reorder, i); + testPermuteArguments(args, types, reorder); + for (int d = 1; d <= 2; d++) { + if (i + d >= inargs) continue; + for (int j = 1; j < outargs; j += 2) + reorder[j] += 1; + testPermuteArguments(args, types, reorder); + testPermuteArguments(args, types, reverse(reorder)); + } + } + // Repetition of a sequence of 3 or more arguments. + for (int i = 1; i < inargs; i++) { + for (int len = 3; len <= inargs; len++) { + for (int j = 0; j < outargs; j++) + reorder[j] = (i + (j % len)) % inargs; + testPermuteArguments(args, types, reorder); + testPermuteArguments(args, types, reverse(reorder)); + } + } + } + } + } + } + + public void testPermuteArguments(Object[] args, Class<?>[] types, + int outargs, int numcases, int casStep) throws Throwable { + int inargs = args.length; + int[] reorder = new int[outargs]; + for (int cas = 0; cas < numcases; cas += casStep) { + for (int i = 0, c = cas; i < outargs; i++) { + reorder[i] = c % inargs; + c /= inargs; + } + if (CAN_TEST_LIGHTLY && outargs >= 3 && + (reorder[0] == reorder[1] || reorder[1] == reorder[2])) + continue; + testPermuteArguments(args, types, reorder); + } + } + + static int[] reverse(int[] reorder) { + reorder = reorder.clone(); + for (int i = 0, imax = reorder.length / 2; i < imax; i++) { + int j = reorder.length - 1 - i; + int tem = reorder[i]; + reorder[i] = reorder[j]; + reorder[j] = tem; + } + return reorder; + } + + void testPermuteArguments(Object[] args, Class<?>[] types, int[] reorder) throws Throwable { + countTest(); + if (args == null && types == null) { + int max = 0; + for (int j : reorder) { + if (max < j) max = j; + } + args = randomArgs(max+1, Integer.class); + } + if (args == null) { + args = randomArgs(types); + } + if (types == null) { + types = new Class<?>[args.length]; + for (int i = 0; i < args.length; i++) + types[i] = args[i].getClass(); + } + int inargs = args.length, outargs = reorder.length; + assertTrue(inargs == types.length); + if (verbosity >= 3) + System.out.println("permuteArguments "+Arrays.toString(reorder)); + Object[] permArgs = new Object[outargs]; + Class<?>[] permTypes = new Class<?>[outargs]; + for (int i = 0; i < outargs; i++) { + permArgs[i] = args[reorder[i]]; + permTypes[i] = types[reorder[i]]; + } + if (verbosity >= 4) { + System.out.println("in args: "+Arrays.asList(args)); + System.out.println("out args: "+Arrays.asList(permArgs)); + System.out.println("in types: "+Arrays.asList(types)); + System.out.println("out types: "+Arrays.asList(permTypes)); + } + MethodType inType = MethodType.methodType(Object.class, types); + MethodType outType = MethodType.methodType(Object.class, permTypes); + MethodHandle target = varargsList(outargs).asType(outType); + MethodHandle newTarget = MethodHandles.permuteArguments(target, inType, reorder); + if (verbosity >= 5) System.out.println("newTarget = "+newTarget); + Object result = newTarget.invokeWithArguments(args); + Object expected = Arrays.asList(permArgs); + if (!expected.equals(result)) { + System.out.println("*** failed permuteArguments "+Arrays.toString(reorder)+ + " types="+Arrays.asList(types)); + System.out.println("in args: "+Arrays.asList(args)); + System.out.println("out args: "+expected); + System.out.println("bad args: "+result); + } + assertEquals(expected, result); + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java b/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java new file mode 100644 index 00000000000..b0b6f4a3d3e --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java @@ -0,0 +1,210 @@ +/* + * 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 unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /java/lang/invoke/common + * @compile MethodHandlesTest.java MethodHandlesSpreadArgumentsTest.java remote/RemoteExample.java + * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions + * -XX:-VerifyDependencies + * -esa + * test.java.lang.invoke.MethodHandlesSpreadArgumentsTest + */ + +package test.java.lang.invoke; + +import org.junit.*; +import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.*; + +public class MethodHandlesSpreadArgumentsTest extends MethodHandlesTest { + + @Test // SLOW + public void testSpreadArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testSpreadArguments0); + CodeCacheOverflowProcessor.runMHTest(this::testSpreadArguments1); + } + + public void testSpreadArguments0() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("spreadArguments"); + for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { + if (verbosity >= 3) + System.out.println("spreadArguments "+argType); + Class<?> arrayType = java.lang.reflect.Array.newInstance(argType, 0).getClass(); + for (int nargs = 0; nargs < 50; nargs++) { + if (CAN_TEST_LIGHTLY && nargs > 11) break; + for (int pos = 0; pos <= nargs; pos++) { + if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; + if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) + continue; + testSpreadArguments(argType, arrayType, pos, nargs); + } + } + } + } + + public void testSpreadArguments(Class<?> argType, Class<?> arrayType, int pos, int nargs) throws Throwable { + countTest(); + MethodHandle target2 = varargsArray(arrayType, nargs); + MethodHandle target = target2.asType(target2.type().generic()); + if (verbosity >= 3) + System.out.println("spread into "+target2+" ["+pos+".."+nargs+"]"); + Object[] args = randomArgs(target2.type().parameterArray()); + // make sure the target does what we think it does: + checkTarget(argType, pos, nargs, target, args); + List<Class<?>> newParams = new ArrayList<>(target2.type().parameterList()); + { // modify newParams in place + List<Class<?>> spreadParams = newParams.subList(pos, nargs); + spreadParams.clear(); spreadParams.add(arrayType); + } + MethodType newType = MethodType.methodType(arrayType, newParams); + MethodHandle result = target2.asSpreader(arrayType, nargs-pos); + assert(result.type() == newType) : Arrays.asList(result, newType); + result = result.asType(newType.generic()); + Object returnValue; + if (pos == 0) { + Object args2 = ValueConversions.changeArrayType(arrayType, Arrays.copyOfRange(args, pos, args.length)); + returnValue = result.invokeExact(args2); + } else { + Object[] args1 = Arrays.copyOfRange(args, 0, pos+1); + args1[pos] = ValueConversions.changeArrayType(arrayType, Arrays.copyOfRange(args, pos, args.length)); + returnValue = result.invokeWithArguments(args1); + } + checkReturnValue(argType, args, result, returnValue); + } + + public void testSpreadArguments1() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("spreadArguments/pos"); + for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { + if (verbosity >= 3) + System.out.println("spreadArguments "+argType); + Class<?> arrayType = java.lang.reflect.Array.newInstance(argType, 0).getClass(); + for (int nargs = 0; nargs < 50; nargs++) { + if (CAN_TEST_LIGHTLY && nargs > 11) break; + for (int pos = 0; pos <= nargs; pos++) { + if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; + if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) + continue; + for (int spr = 1; spr < nargs - pos; ++spr) { + if (spr > 4 && spr != 7 && spr != 11 && spr != 20 && spr < nargs - pos - 4) continue; + testSpreadArguments(argType, arrayType, pos, spr, nargs); + } + } + } + } + } + + public void testSpreadArguments(Class<?> argType, Class<?> arrayType, + int pos, int spread, int nargs) throws Throwable { + countTest(); + MethodHandle target2 = varargsArray(arrayType, nargs); + MethodHandle target = target2.asType(target2.type().generic()); + if (verbosity >= 3) + System.out.println("spread into " + target2 + " [" + pos + ".." + (pos + spread) + "["); + Object[] args = randomArgs(target2.type().parameterArray()); + // make sure the target does what we think it does: + checkTarget(argType, pos, nargs, target, args); + List<Class<?>> newParams = new ArrayList<>(target2.type().parameterList()); + { // modify newParams in place + List<Class<?>> spreadParams = newParams.subList(pos, pos + spread); + spreadParams.clear(); + spreadParams.add(arrayType); + } + MethodType newType = MethodType.methodType(arrayType, newParams); + MethodHandle result = target2.asSpreader(pos, arrayType, spread); + assert (result.type() == newType) : Arrays.asList(result, newType); + result = result.asType(newType.generic()); + // args1 has nargs-spread entries, plus one for the to-be-spread array + int args1Length = nargs - (spread - 1); + Object[] args1 = new Object[args1Length]; + System.arraycopy(args, 0, args1, 0, pos); + args1[pos] = ValueConversions.changeArrayType(arrayType, Arrays.copyOfRange(args, pos, pos + spread)); + System.arraycopy(args, pos + spread, args1, pos + 1, nargs - spread - pos); + Object returnValue = result.invokeWithArguments(args1); + checkReturnValue(argType, args, result, returnValue); + } + + private static void checkTarget(Class<?> argType, int pos, int nargs, + MethodHandle target, Object[] args) throws Throwable { + if (pos == 0 && nargs < 5 && !argType.isPrimitive()) { + Object[] check = (Object[]) target.invokeWithArguments(args); + assertArrayEquals(args, check); + switch (nargs) { + case 0: + check = (Object[]) (Object) target.invokeExact(); + assertArrayEquals(args, check); + break; + case 1: + check = (Object[]) (Object) target.invokeExact(args[0]); + assertArrayEquals(args, check); + break; + case 2: + check = (Object[]) (Object) target.invokeExact(args[0], args[1]); + assertArrayEquals(args, check); + break; + } + } + } + + private static void checkReturnValue(Class<?> argType, Object[] args, MethodHandle result, Object returnValue) { + String argstr = Arrays.toString(args); + if (!argType.isPrimitive()) { + Object[] rv = (Object[]) returnValue; + String rvs = Arrays.toString(rv); + if (!Arrays.equals(args, rv)) { + System.out.println("method: "+result); + System.out.println("expected: "+argstr); + System.out.println("returned: "+rvs); + assertArrayEquals(args, rv); + } + } else if (argType == int.class) { + String rvs = Arrays.toString((int[]) returnValue); + if (!argstr.equals(rvs)) { + System.out.println("method: "+result); + System.out.println("expected: "+argstr); + System.out.println("returned: "+rvs); + assertEquals(argstr, rvs); + } + } else if (argType == long.class) { + String rvs = Arrays.toString((long[]) returnValue); + if (!argstr.equals(rvs)) { + System.out.println("method: "+result); + System.out.println("expected: "+argstr); + System.out.println("returned: "+rvs); + assertEquals(argstr, rvs); + } + } else { + // cannot test... + } + } + +} diff --git a/test/jdk/java/lang/invoke/MethodHandlesTest.java b/test/jdk/java/lang/invoke/MethodHandlesTest.java index cc3d30d39ed..314d2a27fee 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -21,57 +21,36 @@ * questions. */ -/* @test - * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common - * @compile MethodHandlesTest.java remote/RemoteExample.java - * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions - * -XX:-VerifyDependencies - * -esa - * test.java.lang.invoke.MethodHandlesTest - */ - package test.java.lang.invoke; import org.junit.*; -import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; import test.java.lang.invoke.remote.RemoteExample; -import java.lang.invoke.CallSite; import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandleProxies; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; import java.lang.invoke.MethodType; -import java.lang.invoke.MutableCallSite; -import java.lang.invoke.WrongMethodTypeException; import java.lang.reflect.Array; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Formatter; -import java.util.HashMap; -import java.util.HashSet; import java.util.List; -import java.util.Map; -import java.util.Set; -import static java.lang.invoke.MethodType.methodType; import static org.junit.Assert.*; /** * * @author jrose */ -public class MethodHandlesTest { +public abstract class MethodHandlesTest { + static final Class<?> THIS_CLASS = MethodHandlesTest.class; // How much output? static int verbosity = 0; + static { String vstr = System.getProperty(THIS_CLASS.getSimpleName()+".verbosity"); if (vstr == null) @@ -83,6 +62,7 @@ public class MethodHandlesTest { // a particular new, non-working test. Tests which are known to // work (or have recently worked) test this flag and return on true. static final boolean CAN_SKIP_WORKING; + static { String vstr = System.getProperty(THIS_CLASS.getSimpleName()+".CAN_SKIP_WORKING"); if (vstr == null) @@ -94,21 +74,12 @@ public class MethodHandlesTest { // This might be useful with -Xcomp stress tests that compile all method handles. static boolean CAN_TEST_LIGHTLY = Boolean.getBoolean(THIS_CLASS.getName()+".CAN_TEST_LIGHTLY"); - @Test - public void testFirst() throws Throwable { - verbosity += 9; try { - // left blank for debugging - } finally { printCounts(); verbosity -= 9; } - } - static final int MAX_ARG_INCREASE = 3; - public MethodHandlesTest() { - } - String testName; static int allPosTests, allNegTests; int posTests, negTests; + @After public void printCounts() { if (verbosity >= 2 && (posTests | negTests) != 0) { @@ -120,11 +91,14 @@ public class MethodHandlesTest { posTests = negTests = 0; } } + void countTest(boolean positive) { if (positive) ++posTests; else ++negTests; } + void countTest() { countTest(true); } + void startTest(String name) { if (testName != null) printCounts(); if (verbosity >= 1) @@ -151,14 +125,17 @@ public class MethodHandlesTest { } static List<Object> calledLog = new ArrayList<>(); + static Object logEntry(String name, Object... args) { return Arrays.asList(name, Arrays.asList(args)); } + public static Object called(String name, Object... args) { Object entry = logEntry(name, args); calledLog.add(entry); return entry; } + static void assertCalled(String name, Object... args) { Object expected = logEntry(name, args); Object actual = calledLog.get(calledLog.size() - 1); @@ -170,10 +147,12 @@ public class MethodHandlesTest { System.out.println("act. types: "+getClasses(actual)); assertEquals("previous method call", expected, actual); } + static void printCalled(MethodHandle target, String name, Object... args) { if (verbosity >= 3) System.out.println("calling MH="+target+" to "+name+deepToString(args)); } + static String deepToString(Object x) { if (x == null) return "null"; if (x instanceof Collection) @@ -228,6 +207,7 @@ public class MethodHandlesTest { TEN_BILLION = (10*1000*1000*1000), // scale factor to reach upper 32 bits INITIAL_ARG_VAL = ONE_MILLION << 1; // <<1 makes space for sign bit; static long nextArgVal; + static long nextArg(boolean moreBits) { long val = nextArgVal++; long sign = -(val & 1); // alternate signs @@ -240,11 +220,13 @@ public class MethodHandlesTest { val += (val % ONE_MILLION) * TEN_BILLION; return val ^ sign; } + static int nextArg() { // Produce a 32-bit result something like ONE_MILLION+(smallint). // Example: 1_000_042. return (int) nextArg(false); } + static long nextArg(Class<?> kind) { if (kind == long.class || kind == Long.class || kind == double.class || kind == Double.class) @@ -260,12 +242,12 @@ public class MethodHandlesTest { if (wrap != null) { return wrap; } -// import sun.invoke.util.Wrapper; -// Wrapper wrap = Wrapper.forBasicType(dst); -// if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst)) -// wrap = Wrapper.forWrapperType(dst); -// if (wrap != Wrapper.OBJECT) -// return wrap.wrap(nextArg++); + //import sun.invoke.util.Wrapper; + //Wrapper wrap = Wrapper.forBasicType(dst); + //if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst)) + // wrap = Wrapper.forWrapperType(dst); + // if (wrap != Wrapper.OBJECT) + // return wrap.wrap(nextArg++); if (param.isInterface()) { for (Class<?> c : param.getClasses()) { if (param.isAssignableFrom(c) && !c.isInterface()) @@ -289,18 +271,21 @@ public class MethodHandlesTest { } return null; // random class not Object, String, Integer, etc. } + static Object[] randomArgs(Class<?>... params) { Object[] args = new Object[params.length]; for (int i = 0; i < args.length; i++) args[i] = randomArg(params[i]); return args; } + static Object[] randomArgs(int nargs, Class<?> param) { Object[] args = new Object[nargs]; for (int i = 0; i < args.length; i++) args[i] = randomArg(param); return args; } + static Object[] randomArgs(List<Class<?>> params) { return randomArgs(params.toArray(new Class<?>[params.size()])); } @@ -309,6 +294,7 @@ public class MethodHandlesTest { static <T, E extends T> T[] array(Class<T[]> atype, E... a) { return Arrays.copyOf(a, a.length, atype); } + @SafeVarargs @SuppressWarnings("varargs") static <T> T[] cat(T[] a, T... b) { int alen = a.length, blen = b.length; @@ -317,6 +303,7 @@ public class MethodHandlesTest { System.arraycopy(b, 0, c, alen, blen); return c; } + static Integer[] boxAll(int... vx) { Integer[] res = new Integer[vx.length]; for (int i = 0; i < res.length; i++) { @@ -324,6 +311,7 @@ public class MethodHandlesTest { } return res; } + static Object getClasses(Object x) { if (x == null) return x; if (x instanceof String) return x; // keep the name @@ -341,13 +329,16 @@ public class MethodHandlesTest { static MethodHandle varargsList(int arity) { return ValueConversions.varargsList(arity); } + /** Return lambda(arg...[arity]) { Arrays.asList(arg...) } */ static MethodHandle varargsArray(int arity) { return ValueConversions.varargsArray(arity); } + static MethodHandle varargsArray(Class<?> arrayType, int arity) { return ValueConversions.varargsArray(arrayType, arity); } + /** Variation of varargsList, but with the given rtype. */ static MethodHandle varargsList(int arity, Class<?> rtype) { MethodHandle list = varargsList(arity); @@ -374,11 +365,13 @@ public class MethodHandlesTest { } return list.asType(listType); } + /** Variation of varargsList, but with the given ptypes and rtype. */ static MethodHandle varargsList(List<Class<?>> ptypes, Class<?> rtype) { MethodHandle list = varargsList(ptypes.size(), rtype); return list.asType(MethodType.methodType(rtype, ptypes)); } + private static MethodHandle LIST_TO_STRING, LIST_TO_INT; private static String listToString(List<?> x) { return x.toString(); } private static int listToInt(List<?> x) { return x.toString().hashCode(); } @@ -386,6 +379,7 @@ public class MethodHandlesTest { static MethodHandle changeArgTypes(MethodHandle target, Class<?> argType) { return changeArgTypes(target, 0, 999, argType); } + static MethodHandle changeArgTypes(MethodHandle target, int beg, int end, Class<?> argType) { MethodType targetType = target.type(); @@ -395,6 +389,7 @@ public class MethodHandlesTest { MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes); return target.asType(ttype2); } + static MethodHandle addTrailingArgs(MethodHandle target, int nargs, Class<?> argClass) { int targetLen = target.type().parameterCount(); int extra = (nargs - targetLen); @@ -456,6 +451,7 @@ public class MethodHandlesTest { static final Lookup EXAMPLE = MethodHandles.lookup(); // for testing findSpecial } + static final Lookup EXAMPLE = Example.EXAMPLE; public static class PubExample extends Example { public PubExample() { this("PubExample"); } @@ -463,6 +459,7 @@ public class MethodHandlesTest { protected void pro_v0() { called("Pub/pro_v0", this); } protected static void pro_s0() { called("Pub/pro_s0"); } } + static class SubExample extends Example { @Override public void v0() { called("Sub/v0", this); } @Override void pkg_v0() { called("Sub/pkg_v0", this); } @@ -470,6 +467,7 @@ public class MethodHandlesTest { private SubExample(int x) { called("<init>", this, x); } public SubExample() { super("SubExample#"+nextArg()); } } + public static interface IntExample { public void v0(); public default void vd() { called("vd", this); } @@ -480,14 +478,15 @@ public class MethodHandlesTest { @Override public String toString() { return name; } } } + static interface SubIntExample extends IntExample { } static final Object[][][] ACCESS_CASES = { { { false, PUBLIC }, { false, SUBCLASS }, { false, PACKAGE }, { false, PRIVATE }, { false, EXAMPLE } }, //[0]: all false - { { false, PUBLIC }, { false, SUBCLASS }, { false, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[1]: only PRIVATE - { { false, PUBLIC }, { false, SUBCLASS }, { true, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[2]: PUBLIC false - { { false, PUBLIC }, { true, SUBCLASS }, { true, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[3]: subclass OK - { { true, PUBLIC }, { true, SUBCLASS }, { true, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[4]: all true + { { false, PUBLIC }, { false, SUBCLASS }, { false, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[1]: only PRIVATE + { { false, PUBLIC }, { false, SUBCLASS }, { true, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[2]: PUBLIC false + { { false, PUBLIC }, { true, SUBCLASS }, { true, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[3]: subclass OK + { { true, PUBLIC }, { true, SUBCLASS }, { true, PACKAGE }, { true, PRIVATE }, { true, EXAMPLE } }, //[4]: all true }; static Object[][] accessCases(Class<?> defc, String name, boolean isSpecial) { @@ -510,6 +509,7 @@ public class MethodHandlesTest { cases = Arrays.copyOfRange(cases, 0, cases.length-1); return cases; } + static Object[][] accessCases(Class<?> defc, String name) { return accessCases(defc, name, false); } @@ -524,77 +524,6 @@ public class MethodHandlesTest { /** Is findVirtual (etc.) of "<init<" supposed to elicit a NoSuchMethodException? */ static final boolean INIT_REF_CAUSES_NSME = true; - @Test - public void testFindStatic() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindStatic0); - } - - public void testFindStatic0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findStatic"); - testFindStatic(PubExample.class, void.class, "s0"); - testFindStatic(Example.class, void.class, "s0"); - testFindStatic(Example.class, void.class, "pkg_s0"); - testFindStatic(Example.class, void.class, "pri_s0"); - testFindStatic(Example.class, void.class, "pro_s0"); - testFindStatic(PubExample.class, void.class, "Pub/pro_s0"); - - testFindStatic(Example.class, Object.class, "s1", Object.class); - testFindStatic(Example.class, Object.class, "s2", int.class); - testFindStatic(Example.class, Object.class, "s3", long.class); - testFindStatic(Example.class, Object.class, "s4", int.class, int.class); - testFindStatic(Example.class, Object.class, "s5", long.class, int.class); - testFindStatic(Example.class, Object.class, "s6", int.class, long.class); - testFindStatic(Example.class, Object.class, "s7", float.class, double.class); - - testFindStatic(false, PRIVATE, Example.class, void.class, "bogus"); - testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", int.class); - testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", Void.class); - testFindStatic(false, PRIVATE, Example.class, void.class, "v0"); - } - - void testFindStatic(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - for (Object[] ac : accessCases(defc, name)) { - testFindStatic((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params); - } - } - void testFindStatic(Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - testFindStatic(true, lookup, defc, ret, name, params); - } - void testFindStatic(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - countTest(positive); - String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo - MethodType type = MethodType.methodType(ret, params); - MethodHandle target = null; - Exception noAccess = null; - try { - if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); - target = maybeMoveIn(lookup, defc).findStatic(defc, methodName, type); - } catch (ReflectiveOperationException ex) { - noAccess = ex; - assertExceptionClass( - (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) - ? NoSuchMethodException.class - : IllegalAccessException.class, - noAccess); - if (verbosity >= 5) ex.printStackTrace(System.out); - } - if (verbosity >= 3) - System.out.println("findStatic "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && noAccess != null) throw noAccess; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - assertEquals(type, target.type()); - assertNameStringContains(target, methodName); - Object[] args = randomArgs(params); - printCalled(target, name, args); - target.invokeWithArguments(args); - assertCalled(name, args); - if (verbosity >= 1) - System.out.print(':'); - } - static void assertExceptionClass(Class<? extends Throwable> expected, Throwable actual) { if (expected.isInstance(actual)) return; @@ -615,454 +544,6 @@ public class MethodHandlesTest { assertEquals(s, x); } - @Test - public void testFindVirtual() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindVirtual0); - } - - public void testFindVirtual0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findVirtual"); - testFindVirtual(Example.class, void.class, "v0"); - testFindVirtual(Example.class, void.class, "pkg_v0"); - testFindVirtual(Example.class, void.class, "pri_v0"); - testFindVirtual(Example.class, Object.class, "v1", Object.class); - testFindVirtual(Example.class, Object.class, "v2", Object.class, Object.class); - testFindVirtual(Example.class, Object.class, "v2", Object.class, int.class); - testFindVirtual(Example.class, Object.class, "v2", int.class, Object.class); - testFindVirtual(Example.class, Object.class, "v2", int.class, int.class); - testFindVirtual(Example.class, void.class, "pro_v0"); - testFindVirtual(PubExample.class, void.class, "Pub/pro_v0"); - - testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus"); - testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", int.class); - testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", Void.class); - testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "s0"); - - // test dispatch - testFindVirtual(SubExample.class, SubExample.class, void.class, "Sub/v0"); - testFindVirtual(SubExample.class, Example.class, void.class, "Sub/v0"); - testFindVirtual(SubExample.class, IntExample.class, void.class, "Sub/v0"); - testFindVirtual(SubExample.class, SubExample.class, void.class, "Sub/pkg_v0"); - testFindVirtual(SubExample.class, Example.class, void.class, "Sub/pkg_v0"); - testFindVirtual(Example.class, IntExample.class, void.class, "v0"); - testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0"); - } - - @Test - public void testFindVirtualClone() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindVirtualClone0); - } - - public void testFindVirtualClone0() throws Throwable { - if (CAN_SKIP_WORKING) return; - // test some ad hoc system methods - testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone"); - - // ##### FIXME - disable tests for clone until we figure out how they should work with modules - - /* - testFindVirtual(true, PUBLIC, Object[].class, Object.class, "clone"); - testFindVirtual(true, PUBLIC, int[].class, Object.class, "clone"); - for (Class<?> cls : new Class<?>[]{ boolean[].class, long[].class, float[].class, char[].class }) - testFindVirtual(true, PUBLIC, cls, Object.class, "clone"); - */ - } - - void testFindVirtual(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - Class<?> rcvc = defc; - testFindVirtual(rcvc, defc, ret, name, params); - } - void testFindVirtual(Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - for (Object[] ac : accessCases(defc, name)) { - testFindVirtual((Boolean)ac[0], (Lookup)ac[1], rcvc, defc, ret, name, params); - } - } - void testFindVirtual(Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - testFindVirtual(true, lookup, rcvc, defc, ret, name, params); - } - void testFindVirtual(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - testFindVirtual(positive, lookup, defc, defc, ret, name, params); - } - void testFindVirtual(boolean positive, Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - countTest(positive); - String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo - MethodType type = MethodType.methodType(ret, params); - MethodHandle target = null; - Exception noAccess = null; - try { - if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); - target = maybeMoveIn(lookup, defc).findVirtual(defc, methodName, type); - } catch (ReflectiveOperationException ex) { - noAccess = ex; - assertExceptionClass( - (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) - ? NoSuchMethodException.class - : IllegalAccessException.class, - noAccess); - if (verbosity >= 5) ex.printStackTrace(System.out); - } - if (verbosity >= 3) - System.out.println("findVirtual "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && noAccess != null) throw noAccess; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - Class<?> selfc = defc; - // predict receiver type narrowing: - if (lookup == SUBCLASS && - name.contains("pro_") && - selfc.isAssignableFrom(lookup.lookupClass())) { - selfc = lookup.lookupClass(); - if (name.startsWith("Pub/")) name = "Rem/"+name.substring(4); - } - Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)selfc), params); - MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf); - assertEquals(typeWithSelf, target.type()); - assertNameStringContains(target, methodName); - Object[] argsWithSelf = randomArgs(paramsWithSelf); - if (selfc.isAssignableFrom(rcvc) && rcvc != selfc) argsWithSelf[0] = randomArg(rcvc); - printCalled(target, name, argsWithSelf); - Object res = target.invokeWithArguments(argsWithSelf); - if (Example.class.isAssignableFrom(defc) || IntExample.class.isAssignableFrom(defc)) { - assertCalled(name, argsWithSelf); - } else if (name.equals("clone")) { - // Ad hoc method call outside Example. For Object[].clone. - printCalled(target, name, argsWithSelf); - assertEquals(MethodType.methodType(Object.class, rcvc), target.type()); - Object orig = argsWithSelf[0]; - assertEquals(orig.getClass(), res.getClass()); - if (res instanceof Object[]) - assertArrayEquals((Object[])res, (Object[])argsWithSelf[0]); - assert(Arrays.deepEquals(new Object[]{res}, new Object[]{argsWithSelf[0]})); - } else { - assert(false) : Arrays.asList(positive, lookup, rcvc, defc, ret, name, deepToString(params)); - } - if (verbosity >= 1) - System.out.print(':'); - } - - @Test - public void testFindSpecial() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindSpecial0); - } - - public void testFindSpecial0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findSpecial"); - testFindSpecial(SubExample.class, Example.class, void.class, false, "v0"); - testFindSpecial(SubExample.class, Example.class, void.class, false, "pkg_v0"); - testFindSpecial(RemoteExample.class, PubExample.class, void.class, false, "Pub/pro_v0"); - testFindSpecial(Example.class, IntExample.class, void.class, true, "vd"); - // Do some negative testing: - for (Lookup lookup : new Lookup[]{ PRIVATE, EXAMPLE, PACKAGE, PUBLIC }) { - testFindSpecial(false, lookup, Object.class, Example.class, void.class, "v0"); - testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "bogus"); - testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", int.class); - testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", Void.class); - testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "s0"); - testFindSpecial(false, lookup, Example.class, IntExample.class, void.class, "v0"); - } - } - - void testFindSpecial(Class<?> specialCaller, - Class<?> defc, Class<?> ret, boolean dflt, String name, Class<?>... params) throws Throwable { - if (specialCaller == RemoteExample.class) { - testFindSpecial(false, EXAMPLE, specialCaller, defc, ret, name, params); - testFindSpecial(false, PRIVATE, specialCaller, defc, ret, name, params); - testFindSpecial(false, PACKAGE, specialCaller, defc, ret, name, params); - testFindSpecial(true, SUBCLASS, specialCaller, defc, ret, name, params); - testFindSpecial(false, PUBLIC, specialCaller, defc, ret, name, params); - return; - } - testFindSpecial(true, EXAMPLE, specialCaller, defc, ret, name, params); - testFindSpecial(true, PRIVATE, specialCaller, defc, ret, name, params); - testFindSpecial(false || dflt, PACKAGE, specialCaller, defc, ret, name, params); - testFindSpecial(false, SUBCLASS, specialCaller, defc, ret, name, params); - testFindSpecial(false, PUBLIC, specialCaller, defc, ret, name, params); - } - void testFindSpecial(boolean positive, Lookup lookup, Class<?> specialCaller, - Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - countTest(positive); - String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo - MethodType type = MethodType.methodType(ret, params); - Lookup specialLookup = maybeMoveIn(lookup, specialCaller); - boolean specialAccessOK = (specialLookup.lookupClass() == specialCaller && - (specialLookup.lookupModes() & Lookup.PRIVATE) != 0); - MethodHandle target = null; - Exception noAccess = null; - try { - if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); - if (verbosity >= 5) System.out.println(" lookup => "+specialLookup); - target = specialLookup.findSpecial(defc, methodName, type, specialCaller); - } catch (ReflectiveOperationException ex) { - noAccess = ex; - assertExceptionClass( - (!specialAccessOK) // this check should happen first - ? IllegalAccessException.class - : (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) - ? NoSuchMethodException.class - : IllegalAccessException.class, - noAccess); - if (verbosity >= 5) ex.printStackTrace(System.out); - } - if (verbosity >= 3) - System.out.println("findSpecial from "+specialCaller.getName()+" to "+defc.getName()+"."+name+"/"+type+" => "+target - +(target == null ? "" : target.type()) - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && noAccess != null) throw noAccess; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - assertEquals(specialCaller, target.type().parameterType(0)); - assertEquals(type, target.type().dropParameterTypes(0,1)); - Class<?>[] paramsWithSelf = cat(array(Class[].class, (Class)specialCaller), params); - MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf); - assertNameStringContains(target, methodName); - Object[] args = randomArgs(paramsWithSelf); - printCalled(target, name, args); - target.invokeWithArguments(args); - assertCalled(name, args); - } - - @Test - public void testFindConstructor() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindConstructor0); - } - - public void testFindConstructor0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findConstructor"); - testFindConstructor(true, EXAMPLE, Example.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class, int.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class, long.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class, float.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class, double.class); - testFindConstructor(true, EXAMPLE, Example.class, String.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class, int.class, int.class); - testFindConstructor(true, EXAMPLE, Example.class, int.class, int.class, int.class, int.class); - } - void testFindConstructor(boolean positive, Lookup lookup, - Class<?> defc, Class<?>... params) throws Throwable { - countTest(positive); - MethodType type = MethodType.methodType(void.class, params); - MethodHandle target = null; - Exception noAccess = null; - try { - if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" <init>"+type); - target = lookup.findConstructor(defc, type); - } catch (ReflectiveOperationException ex) { - noAccess = ex; - assertTrue(noAccess.getClass().getName(), noAccess instanceof IllegalAccessException); - } - if (verbosity >= 3) - System.out.println("findConstructor "+defc.getName()+".<init>/"+type+" => "+target - +(target == null ? "" : target.type()) - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && noAccess != null) throw noAccess; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - assertEquals(type.changeReturnType(defc), target.type()); - Object[] args = randomArgs(params); - printCalled(target, defc.getSimpleName(), args); - Object obj = target.invokeWithArguments(args); - if (!(defc == Example.class && params.length < 2)) - assertCalled(defc.getSimpleName()+".<init>", args); - assertTrue("instance of "+defc.getName(), defc.isInstance(obj)); - } - - @Test - public void testBind() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testBind0); - } - - public void testBind0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("bind"); - testBind(Example.class, void.class, "v0"); - testBind(Example.class, void.class, "pkg_v0"); - testBind(Example.class, void.class, "pri_v0"); - testBind(Example.class, Object.class, "v1", Object.class); - testBind(Example.class, Object.class, "v2", Object.class, Object.class); - testBind(Example.class, Object.class, "v2", Object.class, int.class); - testBind(Example.class, Object.class, "v2", int.class, Object.class); - testBind(Example.class, Object.class, "v2", int.class, int.class); - testBind(false, PRIVATE, Example.class, void.class, "bogus"); - testBind(false, PRIVATE, Example.class, void.class, "<init>", int.class); - testBind(false, PRIVATE, Example.class, void.class, "<init>", Void.class); - testBind(SubExample.class, void.class, "Sub/v0"); - testBind(SubExample.class, void.class, "Sub/pkg_v0"); - testBind(IntExample.Impl.class, void.class, "Int/v0"); - } - - void testBind(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - for (Object[] ac : accessCases(defc, name)) { - testBind((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params); - } - } - - void testBind(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable { - countTest(positive); - String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo - MethodType type = MethodType.methodType(ret, params); - Object receiver = randomArg(defc); - MethodHandle target = null; - Exception noAccess = null; - try { - if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); - target = maybeMoveIn(lookup, defc).bind(receiver, methodName, type); - } catch (ReflectiveOperationException ex) { - noAccess = ex; - assertExceptionClass( - (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>")) - ? NoSuchMethodException.class - : IllegalAccessException.class, - noAccess); - if (verbosity >= 5) ex.printStackTrace(System.out); - } - if (verbosity >= 3) - System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && noAccess != null) throw noAccess; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - assertEquals(type, target.type()); - Object[] args = randomArgs(params); - printCalled(target, name, args); - target.invokeWithArguments(args); - Object[] argsWithReceiver = cat(array(Object[].class, receiver), args); - assertCalled(name, argsWithReceiver); - if (verbosity >= 1) - System.out.print(':'); - } - - @Test - public void testUnreflect() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testUnreflect0); - } - - public void testUnreflect0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("unreflect"); - testUnreflect(Example.class, true, void.class, "s0"); - testUnreflect(Example.class, true, void.class, "pro_s0"); - testUnreflect(Example.class, true, void.class, "pkg_s0"); - testUnreflect(Example.class, true, void.class, "pri_s0"); - - testUnreflect(Example.class, true, Object.class, "s1", Object.class); - testUnreflect(Example.class, true, Object.class, "s2", int.class); - testUnreflect(Example.class, true, Object.class, "s3", long.class); - testUnreflect(Example.class, true, Object.class, "s4", int.class, int.class); - testUnreflect(Example.class, true, Object.class, "s5", long.class, int.class); - testUnreflect(Example.class, true, Object.class, "s6", int.class, long.class); - - testUnreflect(Example.class, false, void.class, "v0"); - testUnreflect(Example.class, false, void.class, "pkg_v0"); - testUnreflect(Example.class, false, void.class, "pri_v0"); - testUnreflect(Example.class, false, Object.class, "v1", Object.class); - testUnreflect(Example.class, false, Object.class, "v2", Object.class, Object.class); - testUnreflect(Example.class, false, Object.class, "v2", Object.class, int.class); - testUnreflect(Example.class, false, Object.class, "v2", int.class, Object.class); - testUnreflect(Example.class, false, Object.class, "v2", int.class, int.class); - - // Test a public final member in another package: - testUnreflect(RemoteExample.class, false, void.class, "Rem/fin_v0"); - } - - void testUnreflect(Class<?> defc, boolean isStatic, Class<?> ret, String name, Class<?>... params) throws Throwable { - for (Object[] ac : accessCases(defc, name)) { - testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, (isStatic ? null : defc), ret, name, params); - } - } - void testUnreflect(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable { - for (Object[] ac : accessCases(defc, name)) { - testUnreflectMaybeSpecial(null, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params); - } - } - void testUnreflectMaybeSpecial(Class<?> specialCaller, - boolean positive, Lookup lookup, - Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable { - countTest(positive); - String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo - MethodType type = MethodType.methodType(ret, params); - Lookup specialLookup = (specialCaller != null ? maybeMoveIn(lookup, specialCaller) : null); - boolean specialAccessOK = (specialCaller != null && - specialLookup.lookupClass() == specialCaller && - (specialLookup.lookupModes() & Lookup.PRIVATE) != 0); - Method rmethod = defc.getDeclaredMethod(methodName, params); - MethodHandle target = null; - Exception noAccess = null; - boolean isStatic = (rcvc == null); - boolean isSpecial = (specialCaller != null); - try { - if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type); - if (isSpecial) - target = specialLookup.unreflectSpecial(rmethod, specialCaller); - else - target = maybeMoveIn(lookup, defc).unreflect(rmethod); - } catch (ReflectiveOperationException ex) { - noAccess = ex; - assertExceptionClass( - IllegalAccessException.class, // NSME is impossible, since it was already reflected - noAccess); - if (verbosity >= 5) ex.printStackTrace(System.out); - } - if (verbosity >= 3) - System.out.println("unreflect"+(isSpecial?"Special":"")+" "+defc.getName()+"."+name+"/"+type - +(!isSpecial ? "" : " specialCaller="+specialCaller) - +( isStatic ? "" : " receiver="+rcvc) - +" => "+target - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && noAccess != null) throw noAccess; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - assertEquals(isStatic, Modifier.isStatic(rmethod.getModifiers())); - Class<?>[] paramsMaybeWithSelf = params; - if (!isStatic) { - paramsMaybeWithSelf = cat(array(Class[].class, (Class)rcvc), params); - } - MethodType typeMaybeWithSelf = MethodType.methodType(ret, paramsMaybeWithSelf); - if (isStatic) { - assertEquals(typeMaybeWithSelf, target.type()); - } else { - if (isSpecial) - assertEquals(specialCaller, target.type().parameterType(0)); - else - assertEquals(defc, target.type().parameterType(0)); - assertEquals(typeMaybeWithSelf, target.type().changeParameterType(0, rcvc)); - } - Object[] argsMaybeWithSelf = randomArgs(paramsMaybeWithSelf); - printCalled(target, name, argsMaybeWithSelf); - target.invokeWithArguments(argsMaybeWithSelf); - assertCalled(name, argsMaybeWithSelf); - if (verbosity >= 1) - System.out.print(':'); - } - - void testUnreflectSpecial(Class<?> defc, Class<?> rcvc, Class<?> ret, String name, Class<?>... params) throws Throwable { - for (Object[] ac : accessCases(defc, name, true)) { - Class<?> specialCaller = rcvc; - testUnreflectMaybeSpecial(specialCaller, (Boolean)ac[0], (Lookup)ac[1], defc, rcvc, ret, name, params); - } - } - - @Test - public void testUnreflectSpecial() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSpecial0); - } - - public void testUnreflectSpecial0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("unreflectSpecial"); - testUnreflectSpecial(Example.class, Example.class, void.class, "v0"); - testUnreflectSpecial(Example.class, SubExample.class, void.class, "v0"); - testUnreflectSpecial(Example.class, Example.class, void.class, "pkg_v0"); - testUnreflectSpecial(Example.class, SubExample.class, void.class, "pkg_v0"); - testUnreflectSpecial(Example.class, Example.class, Object.class, "v2", int.class, int.class); - testUnreflectSpecial(Example.class, SubExample.class, Object.class, "v2", int.class, int.class); - testUnreflectMaybeSpecial(Example.class, false, PRIVATE, Example.class, Example.class, void.class, "s0"); - } - public static class HasFields { boolean fZ = false; byte fB = (byte)'B'; @@ -1133,6 +614,7 @@ public class MethodHandlesTest { } static final int TEST_UNREFLECT = 1, TEST_FIND_FIELD = 2, TEST_FIND_STATIC = 3, TEST_SETTER = 0x10, TEST_BOUND = 0x20, TEST_NPE = 0x40; + static boolean testModeMatches(int testMode, boolean isStatic) { switch (testMode) { case TEST_FIND_STATIC: return isStatic; @@ -1142,467 +624,6 @@ public class MethodHandlesTest { throw new InternalError("testMode="+testMode); } - @Test - public void testUnreflectGetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testUnreflectGetter0); - } - - public void testUnreflectGetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("unreflectGetter"); - testGetter(TEST_UNREFLECT); - } - - @Test - public void testFindGetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindGetter0); - } - - public void testFindGetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findGetter"); - testGetter(TEST_FIND_FIELD); - testGetter(TEST_FIND_FIELD | TEST_BOUND); - } - - @Test - public void testFindStaticGetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindStaticGetter0); - } - - public void testFindStaticGetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findStaticGetter"); - testGetter(TEST_FIND_STATIC); - } - - public void testGetter(int testMode) throws Throwable { - Lookup lookup = PRIVATE; // FIXME: test more lookups than this one - for (Object[] c : HasFields.CASES) { - boolean positive = (c[1] != Error.class); - testGetter(positive, lookup, c[0], c[1], testMode); - if (positive) - testGetter(positive, lookup, c[0], c[1], testMode | TEST_NPE); - } - testGetter(true, lookup, - new Object[]{ true, System.class, "out", java.io.PrintStream.class }, - System.out, testMode); - for (int isStaticN = 0; isStaticN <= 1; isStaticN++) { - testGetter(false, lookup, - new Object[]{ (isStaticN != 0), System.class, "bogus", char.class }, - null, testMode); - } - } - public void testGetter(boolean positive, MethodHandles.Lookup lookup, - Object fieldRef, Object value, int testMode) throws Throwable { - testAccessor(positive, lookup, fieldRef, value, testMode); - } - - public void testAccessor(boolean positive0, MethodHandles.Lookup lookup, - Object fieldRef, Object value, int testMode0) throws Throwable { - if (verbosity >= 4) - System.out.println("testAccessor"+Arrays.deepToString(new Object[]{positive0, lookup, fieldRef, value, testMode0})); - boolean isGetter = ((testMode0 & TEST_SETTER) == 0); - boolean doBound = ((testMode0 & TEST_BOUND) != 0); - boolean testNPE = ((testMode0 & TEST_NPE) != 0); - int testMode = testMode0 & ~(TEST_SETTER | TEST_BOUND | TEST_NPE); - boolean positive = positive0 && !testNPE; - boolean isStatic; - Class<?> fclass; - String fname; - Class<?> ftype; - Field f = (fieldRef instanceof Field ? (Field)fieldRef : null); - if (f != null) { - isStatic = Modifier.isStatic(f.getModifiers()); - fclass = f.getDeclaringClass(); - fname = f.getName(); - ftype = f.getType(); - } else { - Object[] scnt = (Object[]) fieldRef; - isStatic = (Boolean) scnt[0]; - fclass = (Class<?>) scnt[1]; - fname = (String) scnt[2]; - ftype = (Class<?>) scnt[3]; - try { - f = fclass.getDeclaredField(fname); - } catch (ReflectiveOperationException ex) { - f = null; - } - } - if (!testModeMatches(testMode, isStatic)) return; - if (f == null && testMode == TEST_UNREFLECT) return; - if (testNPE && isStatic) return; - countTest(positive); - MethodType expType; - if (isGetter) - expType = MethodType.methodType(ftype, HasFields.class); - else - expType = MethodType.methodType(void.class, HasFields.class, ftype); - if (isStatic) expType = expType.dropParameterTypes(0, 1); - Exception noAccess = null; - MethodHandle mh; - try { - switch (testMode0 & ~(TEST_BOUND | TEST_NPE)) { - case TEST_UNREFLECT: mh = lookup.unreflectGetter(f); break; - case TEST_FIND_FIELD: mh = lookup.findGetter(fclass, fname, ftype); break; - case TEST_FIND_STATIC: mh = lookup.findStaticGetter(fclass, fname, ftype); break; - case TEST_SETTER| - TEST_UNREFLECT: mh = lookup.unreflectSetter(f); break; - case TEST_SETTER| - TEST_FIND_FIELD: mh = lookup.findSetter(fclass, fname, ftype); break; - case TEST_SETTER| - TEST_FIND_STATIC: mh = lookup.findStaticSetter(fclass, fname, ftype); break; - default: - throw new InternalError("testMode="+testMode); - } - } catch (ReflectiveOperationException ex) { - mh = null; - noAccess = ex; - assertExceptionClass( - (fname.contains("bogus")) - ? NoSuchFieldException.class - : IllegalAccessException.class, - noAccess); - if (verbosity >= 5) ex.printStackTrace(System.out); - } - if (verbosity >= 3) - System.out.println("find"+(isStatic?"Static":"")+(isGetter?"Getter":"Setter")+" "+fclass.getName()+"."+fname+"/"+ftype - +" => "+mh - +(noAccess == null ? "" : " !! "+noAccess)); - if (positive && !testNPE && noAccess != null) throw new RuntimeException(noAccess); - assertEquals(positive0 ? "positive test" : "negative test erroneously passed", positive0, mh != null); - if (!positive && !testNPE) return; // negative access test failed as expected - assertEquals((isStatic ? 0 : 1)+(isGetter ? 0 : 1), mh.type().parameterCount()); - - - assertSame(mh.type(), expType); - //assertNameStringContains(mh, fname); // This does not hold anymore with LFs - HasFields fields = new HasFields(); - HasFields fieldsForMH = fields; - if (testNPE) fieldsForMH = null; // perturb MH argument to elicit expected error - if (doBound) - mh = mh.bindTo(fieldsForMH); - Object sawValue; - Class<?> vtype = ftype; - if (ftype != int.class) vtype = Object.class; - if (isGetter) { - mh = mh.asType(mh.type().generic() - .changeReturnType(vtype)); - } else { - int last = mh.type().parameterCount() - 1; - mh = mh.asType(mh.type().generic() - .changeReturnType(void.class) - .changeParameterType(last, vtype)); - } - if (f != null && f.getDeclaringClass() == HasFields.class) { - assertEquals(f.get(fields), value); // clean to start with - } - Throwable caughtEx = null; - if (isGetter) { - Object expValue = value; - for (int i = 0; i <= 1; i++) { - sawValue = null; // make DA rules happy under try/catch - try { - if (isStatic || doBound) { - if (ftype == int.class) - sawValue = (int) mh.invokeExact(); // do these exactly - else - sawValue = mh.invokeExact(); - } else { - if (ftype == int.class) - sawValue = (int) mh.invokeExact((Object) fieldsForMH); - else - sawValue = mh.invokeExact((Object) fieldsForMH); - } - } catch (RuntimeException ex) { - if (ex instanceof NullPointerException && testNPE) { - caughtEx = ex; - break; - } - } - assertEquals(sawValue, expValue); - if (f != null && f.getDeclaringClass() == HasFields.class - && !Modifier.isFinal(f.getModifiers())) { - Object random = randomArg(ftype); - f.set(fields, random); - expValue = random; - } else { - break; - } - } - } else { - for (int i = 0; i <= 1; i++) { - Object putValue = randomArg(ftype); - try { - if (isStatic || doBound) { - if (ftype == int.class) - mh.invokeExact((int)putValue); // do these exactly - else - mh.invokeExact(putValue); - } else { - if (ftype == int.class) - mh.invokeExact((Object) fieldsForMH, (int)putValue); - else - mh.invokeExact((Object) fieldsForMH, putValue); - } - } catch (RuntimeException ex) { - if (ex instanceof NullPointerException && testNPE) { - caughtEx = ex; - break; - } - } - if (f != null && f.getDeclaringClass() == HasFields.class) { - assertEquals(f.get(fields), putValue); - } - } - } - if (f != null && f.getDeclaringClass() == HasFields.class) { - f.set(fields, value); // put it back - } - if (testNPE) { - if (caughtEx == null || !(caughtEx instanceof NullPointerException)) - throw new RuntimeException("failed to catch NPE exception"+(caughtEx == null ? " (caughtEx=null)" : ""), caughtEx); - caughtEx = null; // nullify expected exception - } - if (caughtEx != null) { - throw new RuntimeException("unexpected exception", caughtEx); - } - } - - @Test - public void testUnreflectSetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSetter0); - } - - public void testUnreflectSetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("unreflectSetter"); - testSetter(TEST_UNREFLECT); - } - - @Test - public void testFindSetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindSetter0); - } - - public void testFindSetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findSetter"); - testSetter(TEST_FIND_FIELD); - testSetter(TEST_FIND_FIELD | TEST_BOUND); - } - - @Test - public void testFindStaticSetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFindStaticSetter0); - } - - public void testFindStaticSetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("findStaticSetter"); - testSetter(TEST_FIND_STATIC); - } - - public void testSetter(int testMode) throws Throwable { - Lookup lookup = PRIVATE; // FIXME: test more lookups than this one - startTest("unreflectSetter"); - for (Object[] c : HasFields.CASES) { - boolean positive = (c[1] != Error.class); - testSetter(positive, lookup, c[0], c[1], testMode); - if (positive) - testSetter(positive, lookup, c[0], c[1], testMode | TEST_NPE); - } - for (int isStaticN = 0; isStaticN <= 1; isStaticN++) { - testSetter(false, lookup, - new Object[]{ (isStaticN != 0), System.class, "bogus", char.class }, - null, testMode); - } - } - public void testSetter(boolean positive, MethodHandles.Lookup lookup, - Object fieldRef, Object value, int testMode) throws Throwable { - testAccessor(positive, lookup, fieldRef, value, testMode | TEST_SETTER); - } - - @Test - public void testArrayElementGetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testArrayElementGetter0); - } - - public void testArrayElementGetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("arrayElementGetter"); - testArrayElementGetterSetter(false); - } - - @Test - public void testArrayElementSetter() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testArrayElementSetter0); - } - - public void testArrayElementSetter0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("arrayElementSetter"); - testArrayElementGetterSetter(true); - } - - private static final int TEST_ARRAY_NONE = 0, TEST_ARRAY_NPE = 1, TEST_ARRAY_OOB = 2, TEST_ARRAY_ASE = 3; - - public void testArrayElementGetterSetter(boolean testSetter) throws Throwable { - testArrayElementGetterSetter(testSetter, TEST_ARRAY_NONE); - } - - @Test - public void testArrayElementErrors() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testArrayElementErrors0); - } - - public void testArrayElementErrors0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("arrayElementErrors"); - testArrayElementGetterSetter(false, TEST_ARRAY_NPE); - testArrayElementGetterSetter(true, TEST_ARRAY_NPE); - testArrayElementGetterSetter(false, TEST_ARRAY_OOB); - testArrayElementGetterSetter(true, TEST_ARRAY_OOB); - testArrayElementGetterSetter(new Object[10], true, TEST_ARRAY_ASE); - testArrayElementGetterSetter(new Example[10], true, TEST_ARRAY_ASE); - testArrayElementGetterSetter(new IntExample[10], true, TEST_ARRAY_ASE); - } - - public void testArrayElementGetterSetter(boolean testSetter, int negTest) throws Throwable { - testArrayElementGetterSetter(new String[10], testSetter, negTest); - testArrayElementGetterSetter(new Iterable<?>[10], testSetter, negTest); - testArrayElementGetterSetter(new Example[10], testSetter, negTest); - testArrayElementGetterSetter(new IntExample[10], testSetter, negTest); - testArrayElementGetterSetter(new Object[10], testSetter, negTest); - testArrayElementGetterSetter(new boolean[10], testSetter, negTest); - testArrayElementGetterSetter(new byte[10], testSetter, negTest); - testArrayElementGetterSetter(new char[10], testSetter, negTest); - testArrayElementGetterSetter(new short[10], testSetter, negTest); - testArrayElementGetterSetter(new int[10], testSetter, negTest); - testArrayElementGetterSetter(new float[10], testSetter, negTest); - testArrayElementGetterSetter(new long[10], testSetter, negTest); - testArrayElementGetterSetter(new double[10], testSetter, negTest); - } - - public void testArrayElementGetterSetter(Object array, boolean testSetter, int negTest) throws Throwable { - boolean positive = (negTest == TEST_ARRAY_NONE); - int length = java.lang.reflect.Array.getLength(array); - Class<?> arrayType = array.getClass(); - Class<?> elemType = arrayType.getComponentType(); - Object arrayToMH = array; - // this stanza allows negative tests to make argument perturbations: - switch (negTest) { - case TEST_ARRAY_NPE: - arrayToMH = null; - break; - case TEST_ARRAY_OOB: - assert(length > 0); - arrayToMH = java.lang.reflect.Array.newInstance(elemType, 0); - break; - case TEST_ARRAY_ASE: - assert(testSetter && !elemType.isPrimitive()); - if (elemType == Object.class) - arrayToMH = new StringBuffer[length]; // very random subclass of Object! - else if (elemType == Example.class) - arrayToMH = new SubExample[length]; - else if (elemType == IntExample.class) - arrayToMH = new SubIntExample[length]; - else - return; // can't make an ArrayStoreException test - assert(arrayType.isInstance(arrayToMH)) - : Arrays.asList(arrayType, arrayToMH.getClass(), testSetter, negTest); - break; - } - countTest(positive); - if (verbosity > 2) System.out.println("array type = "+array.getClass().getComponentType().getName()+"["+length+"]"+(positive ? "" : " negative test #"+negTest+" using "+Arrays.deepToString(new Object[]{arrayToMH}))); - MethodType expType = !testSetter - ? MethodType.methodType(elemType, arrayType, int.class) - : MethodType.methodType(void.class, arrayType, int.class, elemType); - MethodHandle mh = !testSetter - ? MethodHandles.arrayElementGetter(arrayType) - : MethodHandles.arrayElementSetter(arrayType); - assertSame(mh.type(), expType); - if (elemType != int.class && elemType != boolean.class) { - MethodType gtype = mh.type().generic().changeParameterType(1, int.class); - if (testSetter) gtype = gtype.changeReturnType(void.class); - mh = mh.asType(gtype); - } - Object sawValue, expValue; - List<Object> model = array2list(array); - Throwable caughtEx = null; - for (int i = 0; i < length; i++) { - // update array element - Object random = randomArg(elemType); - model.set(i, random); - if (testSetter) { - try { - if (elemType == int.class) - mh.invokeExact((int[]) arrayToMH, i, (int)random); - else if (elemType == boolean.class) - mh.invokeExact((boolean[]) arrayToMH, i, (boolean)random); - else - mh.invokeExact(arrayToMH, i, random); - } catch (RuntimeException ex) { - caughtEx = ex; - break; - } - assertEquals(model, array2list(array)); - } else { - Array.set(array, i, random); - } - if (verbosity >= 5) { - List<Object> array2list = array2list(array); - System.out.println("a["+i+"]="+random+" => "+array2list); - if (!array2list.equals(model)) - System.out.println("*** != "+model); - } - // observe array element - sawValue = Array.get(array, i); - if (!testSetter) { - expValue = sawValue; - try { - if (elemType == int.class) - sawValue = (int) mh.invokeExact((int[]) arrayToMH, i); - else if (elemType == boolean.class) - sawValue = (boolean) mh.invokeExact((boolean[]) arrayToMH, i); - else - sawValue = mh.invokeExact(arrayToMH, i); - } catch (RuntimeException ex) { - caughtEx = ex; - break; - } - assertEquals(sawValue, expValue); - assertEquals(model, array2list(array)); - } - } - if (!positive) { - if (caughtEx == null) - throw new RuntimeException("failed to catch exception for negTest="+negTest); - // test the kind of exception - Class<?> reqType = null; - switch (negTest) { - case TEST_ARRAY_ASE: reqType = ArrayStoreException.class; break; - case TEST_ARRAY_OOB: reqType = ArrayIndexOutOfBoundsException.class; break; - case TEST_ARRAY_NPE: reqType = NullPointerException.class; break; - default: assert(false); - } - if (reqType.isInstance(caughtEx)) { - caughtEx = null; // nullify expected exception - } - } - if (caughtEx != null) { - throw new RuntimeException("unexpected exception", caughtEx); - } - } - - List<Object> array2list(Object array) { - int length = Array.getLength(array); - ArrayList<Object> model = new ArrayList<>(length); - for (int i = 0; i < length; i++) - model.add(Array.get(array, i)); - return model; - } - static class Callee { static Object id() { return called("id"); } static Object id(Object x) { return called("id", x); } @@ -1634,1252 +655,86 @@ public class MethodHandlesTest { } } - @Test - public void testConvertArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testConvertArguments0); - } - - public void testConvertArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("convertArguments"); - testConvert(Callee.ofType(1), null, "id", int.class); - testConvert(Callee.ofType(1), null, "id", String.class); - testConvert(Callee.ofType(1), null, "id", Integer.class); - testConvert(Callee.ofType(1), null, "id", short.class); - testConvert(Callee.ofType(1), null, "id", char.class); - testConvert(Callee.ofType(1), null, "id", byte.class); - } - - void testConvert(MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable { - testConvert(true, id, rtype, name, params); - } - - void testConvert(boolean positive, - MethodHandle id, Class<?> rtype, String name, Class<?>... params) throws Throwable { - countTest(positive); - MethodType idType = id.type(); - if (rtype == null) rtype = idType.returnType(); - for (int i = 0; i < params.length; i++) { - if (params[i] == null) params[i] = idType.parameterType(i); - } - // simulate the pairwise conversion - MethodType newType = MethodType.methodType(rtype, params); - Object[] args = randomArgs(newType.parameterArray()); - Object[] convArgs = args.clone(); - for (int i = 0; i < args.length; i++) { - Class<?> src = newType.parameterType(i); - Class<?> dst = idType.parameterType(i); - if (src != dst) - convArgs[i] = castToWrapper(convArgs[i], dst); - } - Object convResult = id.invokeWithArguments(convArgs); - { - Class<?> dst = newType.returnType(); - Class<?> src = idType.returnType(); - if (src != dst) - convResult = castToWrapper(convResult, dst); - } - MethodHandle target = null; - RuntimeException error = null; - try { - target = id.asType(newType); - } catch (WrongMethodTypeException ex) { - error = ex; - } - if (verbosity >= 3) - System.out.println("convert "+id+ " to "+newType+" => "+target - +(error == null ? "" : " !! "+error)); - if (positive && error != null) throw error; - assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); - if (!positive) return; // negative test failed as expected - assertEquals(newType, target.type()); - printCalled(target, id.toString(), args); - Object result = target.invokeWithArguments(args); - assertCalled(name, convArgs); - assertEquals(convResult, result); - if (verbosity >= 1) - System.out.print(':'); - } - - @Test - public void testVarargsCollector() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testVarargsCollector0); - } - - public void testVarargsCollector0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("varargsCollector"); - MethodHandle vac0 = PRIVATE.findStatic(MethodHandlesTest.class, "called", - MethodType.methodType(Object.class, String.class, Object[].class)); - vac0 = vac0.bindTo("vac"); - MethodHandle vac = vac0.asVarargsCollector(Object[].class); - testConvert(true, vac.asType(MethodType.genericMethodType(0)), null, "vac"); - testConvert(true, vac.asType(MethodType.genericMethodType(0)), null, "vac"); - for (Class<?> at : new Class<?>[] { Object.class, String.class, Integer.class }) { - testConvert(true, vac.asType(MethodType.genericMethodType(1)), null, "vac", at); - testConvert(true, vac.asType(MethodType.genericMethodType(2)), null, "vac", at, at); - } - } - - @Test // SLOW - public void testPermuteArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testPermuteArguments0); - } - - public void testPermuteArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("permuteArguments"); - testPermuteArguments(4, Integer.class, 2, long.class, 6); - if (CAN_TEST_LIGHTLY) return; - testPermuteArguments(4, Integer.class, 2, String.class, 0); - testPermuteArguments(6, Integer.class, 0, null, 30); - } - public void testPermuteArguments(int max, Class<?> type1, int t2c, Class<?> type2, int dilution) throws Throwable { - if (verbosity >= 2) - System.out.println("permuteArguments "+max+"*"+type1.getName() - +(t2c==0?"":"/"+t2c+"*"+type2.getName()) - +(dilution > 0 ? " with dilution "+dilution : "")); - int t2pos = t2c == 0 ? 0 : 1; - for (int inargs = t2pos+1; inargs <= max; inargs++) { - Class<?>[] types = new Class<?>[inargs]; - Arrays.fill(types, type1); - if (t2c != 0) { - // Fill in a middle range with type2: - Arrays.fill(types, t2pos, Math.min(t2pos+t2c, inargs), type2); - } - Object[] args = randomArgs(types); - int numcases = 1; - for (int outargs = 0; outargs <= max; outargs++) { - if (outargs - inargs >= MAX_ARG_INCREASE) continue; - int casStep = dilution + 1; - // Avoid some common factors: - while ((casStep > 2 && casStep % 2 == 0 && inargs % 2 == 0) || - (casStep > 3 && casStep % 3 == 0 && inargs % 3 == 0)) - casStep++; - testPermuteArguments(args, types, outargs, numcases, casStep); - numcases *= inargs; - if (CAN_TEST_LIGHTLY && outargs < max-2) continue; - if (dilution > 10 && outargs >= 4) { - if (CAN_TEST_LIGHTLY) continue; - int[] reorder = new int[outargs]; - // Do some special patterns, which we probably missed. - // Replication of a single argument or argument pair. - for (int i = 0; i < inargs; i++) { - Arrays.fill(reorder, i); - testPermuteArguments(args, types, reorder); - for (int d = 1; d <= 2; d++) { - if (i + d >= inargs) continue; - for (int j = 1; j < outargs; j += 2) - reorder[j] += 1; - testPermuteArguments(args, types, reorder); - testPermuteArguments(args, types, reverse(reorder)); - } - } - // Repetition of a sequence of 3 or more arguments. - for (int i = 1; i < inargs; i++) { - for (int len = 3; len <= inargs; len++) { - for (int j = 0; j < outargs; j++) - reorder[j] = (i + (j % len)) % inargs; - testPermuteArguments(args, types, reorder); - testPermuteArguments(args, types, reverse(reorder)); - } - } - } - } - } - } - - public void testPermuteArguments(Object[] args, Class<?>[] types, - int outargs, int numcases, int casStep) throws Throwable { - int inargs = args.length; - int[] reorder = new int[outargs]; - for (int cas = 0; cas < numcases; cas += casStep) { - for (int i = 0, c = cas; i < outargs; i++) { - reorder[i] = c % inargs; - c /= inargs; - } - if (CAN_TEST_LIGHTLY && outargs >= 3 && (reorder[0] == reorder[1] || reorder[1] == reorder[2])) continue; - testPermuteArguments(args, types, reorder); - } - } - - static int[] reverse(int[] reorder) { - reorder = reorder.clone(); - for (int i = 0, imax = reorder.length / 2; i < imax; i++) { - int j = reorder.length - 1 - i; - int tem = reorder[i]; - reorder[i] = reorder[j]; - reorder[j] = tem; - } - return reorder; - } - - void testPermuteArguments(Object[] args, Class<?>[] types, int[] reorder) throws Throwable { - countTest(); - if (args == null && types == null) { - int max = 0; - for (int j : reorder) { - if (max < j) max = j; - } - args = randomArgs(max+1, Integer.class); - } - if (args == null) { - args = randomArgs(types); - } - if (types == null) { - types = new Class<?>[args.length]; - for (int i = 0; i < args.length; i++) - types[i] = args[i].getClass(); - } - int inargs = args.length, outargs = reorder.length; - assertTrue(inargs == types.length); - if (verbosity >= 3) - System.out.println("permuteArguments "+Arrays.toString(reorder)); - Object[] permArgs = new Object[outargs]; - Class<?>[] permTypes = new Class<?>[outargs]; - for (int i = 0; i < outargs; i++) { - permArgs[i] = args[reorder[i]]; - permTypes[i] = types[reorder[i]]; - } - if (verbosity >= 4) { - System.out.println("in args: "+Arrays.asList(args)); - System.out.println("out args: "+Arrays.asList(permArgs)); - System.out.println("in types: "+Arrays.asList(types)); - System.out.println("out types: "+Arrays.asList(permTypes)); - } - MethodType inType = MethodType.methodType(Object.class, types); - MethodType outType = MethodType.methodType(Object.class, permTypes); - MethodHandle target = varargsList(outargs).asType(outType); - MethodHandle newTarget = MethodHandles.permuteArguments(target, inType, reorder); - if (verbosity >= 5) System.out.println("newTarget = "+newTarget); - Object result = newTarget.invokeWithArguments(args); - Object expected = Arrays.asList(permArgs); - if (!expected.equals(result)) { - System.out.println("*** failed permuteArguments "+Arrays.toString(reorder)+" types="+Arrays.asList(types)); - System.out.println("in args: "+Arrays.asList(args)); - System.out.println("out args: "+expected); - System.out.println("bad args: "+result); - } - assertEquals(expected, result); - } - - - @Test // SLOW - public void testSpreadArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testSpreadArguments0); - CodeCacheOverflowProcessor.runMHTest(this::testSpreadArguments1); - } - - public void testSpreadArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("spreadArguments"); - for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { - if (verbosity >= 3) - System.out.println("spreadArguments "+argType); - Class<?> arrayType = java.lang.reflect.Array.newInstance(argType, 0).getClass(); - for (int nargs = 0; nargs < 50; nargs++) { - if (CAN_TEST_LIGHTLY && nargs > 11) break; - for (int pos = 0; pos <= nargs; pos++) { - if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; - if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) - continue; - testSpreadArguments(argType, arrayType, pos, nargs); - } - } - } - } - public void testSpreadArguments(Class<?> argType, Class<?> arrayType, int pos, int nargs) throws Throwable { - countTest(); - MethodHandle target2 = varargsArray(arrayType, nargs); - MethodHandle target = target2.asType(target2.type().generic()); - if (verbosity >= 3) - System.out.println("spread into "+target2+" ["+pos+".."+nargs+"]"); - Object[] args = randomArgs(target2.type().parameterArray()); - // make sure the target does what we think it does: - checkTarget(argType, pos, nargs, target, args); - List<Class<?>> newParams = new ArrayList<>(target2.type().parameterList()); - { // modify newParams in place - List<Class<?>> spreadParams = newParams.subList(pos, nargs); - spreadParams.clear(); spreadParams.add(arrayType); - } - MethodType newType = MethodType.methodType(arrayType, newParams); - MethodHandle result = target2.asSpreader(arrayType, nargs-pos); - assert(result.type() == newType) : Arrays.asList(result, newType); - result = result.asType(newType.generic()); - Object returnValue; - if (pos == 0) { - Object args2 = ValueConversions.changeArrayType(arrayType, Arrays.copyOfRange(args, pos, args.length)); - returnValue = result.invokeExact(args2); - } else { - Object[] args1 = Arrays.copyOfRange(args, 0, pos+1); - args1[pos] = ValueConversions.changeArrayType(arrayType, Arrays.copyOfRange(args, pos, args.length)); - returnValue = result.invokeWithArguments(args1); - } - checkReturnValue(argType, args, result, returnValue); - } - public void testSpreadArguments1() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("spreadArguments/pos"); - for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { - if (verbosity >= 3) - System.out.println("spreadArguments "+argType); - Class<?> arrayType = java.lang.reflect.Array.newInstance(argType, 0).getClass(); - for (int nargs = 0; nargs < 50; nargs++) { - if (CAN_TEST_LIGHTLY && nargs > 11) break; - for (int pos = 0; pos <= nargs; pos++) { - if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; - if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) - continue; - for (int spr = 1; spr < nargs - pos; ++spr) { - if (spr > 4 && spr != 7 && spr != 11 && spr != 20 && spr < nargs - pos - 4) continue; - testSpreadArguments(argType, arrayType, pos, spr, nargs); - } - } - } - } - } - public void testSpreadArguments(Class<?> argType, Class<?> arrayType, int pos, int spread, int nargs) throws Throwable { - countTest(); - MethodHandle target2 = varargsArray(arrayType, nargs); - MethodHandle target = target2.asType(target2.type().generic()); - if (verbosity >= 3) - System.out.println("spread into " + target2 + " [" + pos + ".." + (pos + spread) + "["); - Object[] args = randomArgs(target2.type().parameterArray()); - // make sure the target does what we think it does: - checkTarget(argType, pos, nargs, target, args); - List<Class<?>> newParams = new ArrayList<>(target2.type().parameterList()); - { // modify newParams in place - List<Class<?>> spreadParams = newParams.subList(pos, pos + spread); - spreadParams.clear(); - spreadParams.add(arrayType); - } - MethodType newType = MethodType.methodType(arrayType, newParams); - MethodHandle result = target2.asSpreader(pos, arrayType, spread); - assert (result.type() == newType) : Arrays.asList(result, newType); - result = result.asType(newType.generic()); - // args1 has nargs-spread entries, plus one for the to-be-spread array - int args1Length = nargs - (spread - 1); - Object[] args1 = new Object[args1Length]; - System.arraycopy(args, 0, args1, 0, pos); - args1[pos] = ValueConversions.changeArrayType(arrayType, Arrays.copyOfRange(args, pos, pos + spread)); - System.arraycopy(args, pos + spread, args1, pos + 1, nargs - spread - pos); - Object returnValue = result.invokeWithArguments(args1); - checkReturnValue(argType, args, result, returnValue); - } - private static void checkTarget(Class<?> argType, int pos, int nargs, MethodHandle target, Object[] args) throws Throwable { - if (pos == 0 && nargs < 5 && !argType.isPrimitive()) { - Object[] check = (Object[]) target.invokeWithArguments(args); - assertArrayEquals(args, check); - switch (nargs) { - case 0: - check = (Object[]) (Object) target.invokeExact(); - assertArrayEquals(args, check); - break; - case 1: - check = (Object[]) (Object) target.invokeExact(args[0]); - assertArrayEquals(args, check); - break; - case 2: - check = (Object[]) (Object) target.invokeExact(args[0], args[1]); - assertArrayEquals(args, check); - break; - } - } - } - private static void checkReturnValue(Class<?> argType, Object[] args, MethodHandle result, Object returnValue) { - String argstr = Arrays.toString(args); - if (!argType.isPrimitive()) { - Object[] rv = (Object[]) returnValue; - String rvs = Arrays.toString(rv); - if (!Arrays.equals(args, rv)) { - System.out.println("method: "+result); - System.out.println("expected: "+argstr); - System.out.println("returned: "+rvs); - assertArrayEquals(args, rv); - } - } else if (argType == int.class) { - String rvs = Arrays.toString((int[]) returnValue); - if (!argstr.equals(rvs)) { - System.out.println("method: "+result); - System.out.println("expected: "+argstr); - System.out.println("returned: "+rvs); - assertEquals(argstr, rvs); - } - } else if (argType == long.class) { - String rvs = Arrays.toString((long[]) returnValue); - if (!argstr.equals(rvs)) { - System.out.println("method: "+result); - System.out.println("expected: "+argstr); - System.out.println("returned: "+rvs); - assertEquals(argstr, rvs); - } - } else { - // cannot test... - } - } - - @Test // SLOW - public void testAsCollector() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testAsCollector0); - CodeCacheOverflowProcessor.runMHTest(this::testAsCollector1); - } - - public void testAsCollector0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("asCollector"); - for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { - if (verbosity >= 3) - System.out.println("asCollector "+argType); - for (int nargs = 0; nargs < 50; nargs++) { - if (CAN_TEST_LIGHTLY && nargs > 11) break; - for (int pos = 0; pos <= nargs; pos++) { - if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; - if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) - continue; - testAsCollector(argType, pos, nargs); - } - } - } - } - public void testAsCollector(Class<?> argType, int pos, int nargs) throws Throwable { - countTest(); - // fake up a MH with the same type as the desired adapter: - MethodHandle fake = varargsArray(nargs); - fake = changeArgTypes(fake, argType); - MethodType newType = fake.type(); - Object[] args = randomArgs(newType.parameterArray()); - // here is what should happen: - Object[] collectedArgs = Arrays.copyOfRange(args, 0, pos+1); - collectedArgs[pos] = Arrays.copyOfRange(args, pos, args.length); - // here is the MH which will witness the collected argument tail: - MethodHandle target = varargsArray(pos+1); - target = changeArgTypes(target, 0, pos, argType); - target = changeArgTypes(target, pos, pos+1, Object[].class); - if (verbosity >= 3) - System.out.println("collect from "+Arrays.asList(args)+" ["+pos+".."+nargs+"]"); - MethodHandle result = target.asCollector(Object[].class, nargs-pos).asType(newType); - Object[] returnValue = (Object[]) result.invokeWithArguments(args); -// assertTrue(returnValue.length == pos+1 && returnValue[pos] instanceof Object[]); -// returnValue[pos] = Arrays.asList((Object[]) returnValue[pos]); -// collectedArgs[pos] = Arrays.asList((Object[]) collectedArgs[pos]); - assertArrayEquals(collectedArgs, returnValue); - } - public void testAsCollector1() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("asCollector/pos"); - for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { - if (verbosity >= 3) - System.out.println("asCollector/pos "+argType); - for (int nargs = 0; nargs < 50; nargs++) { - if (CAN_TEST_LIGHTLY && nargs > 11) break; - for (int pos = 0; pos <= nargs; pos++) { - if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; - if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) - continue; - for (int coll = 1; coll < nargs - pos; ++coll) { - if (coll > 4 && coll != 7 && coll != 11 && coll != 20 && coll < nargs - pos - 4) continue; - testAsCollector(argType, pos, coll, nargs); - } - } - } - } - } - public void testAsCollector(Class<?> argType, int pos, int collect, int nargs) throws Throwable { - countTest(); - // fake up a MH with the same type as the desired adapter: - MethodHandle fake = varargsArray(nargs); - fake = changeArgTypes(fake, argType); - MethodType newType = fake.type(); - Object[] args = randomArgs(newType.parameterArray()); - // here is what should happen: - // new arg list has "collect" less arguments, but one extra for collected arguments array - int collectedLength = nargs-(collect-1); - Object[] collectedArgs = new Object[collectedLength]; - System.arraycopy(args, 0, collectedArgs, 0, pos); - collectedArgs[pos] = Arrays.copyOfRange(args, pos, pos+collect); - System.arraycopy(args, pos+collect, collectedArgs, pos+1, args.length-(pos+collect)); - // here is the MH which will witness the collected argument part (not tail!): - MethodHandle target = varargsArray(collectedLength); - target = changeArgTypes(target, 0, pos, argType); - target = changeArgTypes(target, pos, pos+1, Object[].class); - target = changeArgTypes(target, pos+1, collectedLength, argType); - if (verbosity >= 3) - System.out.println("collect "+collect+" from "+Arrays.asList(args)+" ["+pos+".."+(pos+collect)+"["); - MethodHandle result = target.asCollector(pos, Object[].class, collect).asType(newType); - Object[] returnValue = (Object[]) result.invokeWithArguments(args); - assertArrayEquals(collectedArgs, returnValue); - } - - @Test // SLOW - public void testInsertArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testInsertArguments0); - } - - public void testInsertArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("insertArguments"); - for (int nargs = 0; nargs < 50; nargs++) { - if (CAN_TEST_LIGHTLY && nargs > 11) break; - for (int ins = 0; ins <= nargs; ins++) { - if (nargs > 10 && ins > 4 && ins < nargs-4 && ins % 10 != 3) - continue; - for (int pos = 0; pos <= nargs; pos++) { - if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3) - continue; - if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2) continue; - testInsertArguments(nargs, pos, ins); - } - } - } - } - - void testInsertArguments(int nargs, int pos, int ins) throws Throwable { - countTest(); - MethodHandle target = varargsArray(nargs + ins); - Object[] args = randomArgs(target.type().parameterArray()); - List<Object> resList = Arrays.asList(args); - List<Object> argsToPass = new ArrayList<>(resList); - List<Object> argsToInsert = argsToPass.subList(pos, pos + ins); - if (verbosity >= 3) - System.out.println("insert: "+argsToInsert+" @"+pos+" into "+target); - @SuppressWarnings("cast") // cast to spread Object... is helpful - MethodHandle target2 = MethodHandles.insertArguments(target, pos, - (Object[]/*...*/) argsToInsert.toArray()); - argsToInsert.clear(); // remove from argsToInsert - Object res2 = target2.invokeWithArguments(argsToPass); - Object res2List = Arrays.asList((Object[])res2); - if (verbosity >= 3) - System.out.println("result: "+res2List); - //if (!resList.equals(res2List)) - // System.out.println("*** fail at n/p/i = "+nargs+"/"+pos+"/"+ins+": "+resList+" => "+res2List); - assertEquals(resList, res2List); - } - - @Test - public void testFilterReturnValue() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFilterReturnValue0); - } - - public void testFilterReturnValue0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("filterReturnValue"); - Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass(); - assertTrue(List.class.isAssignableFrom(classOfVCList)); - for (int nargs = 0; nargs <= 3; nargs++) { - for (Class<?> rtype : new Class<?>[] { Object.class, - List.class, - int.class, - byte.class, - long.class, - CharSequence.class, - String.class }) { - testFilterReturnValue(nargs, rtype); - } - } - } - - void testFilterReturnValue(int nargs, Class<?> rtype) throws Throwable { - countTest(); - MethodHandle target = varargsList(nargs, rtype); - MethodHandle filter; - if (List.class.isAssignableFrom(rtype) || rtype.isAssignableFrom(List.class)) - filter = varargsList(1); // add another layer of list-ness - else - filter = MethodHandles.identity(rtype); - filter = filter.asType(MethodType.methodType(target.type().returnType(), rtype)); - Object[] argsToPass = randomArgs(nargs, Object.class); - if (verbosity >= 3) - System.out.println("filter "+target+" to "+rtype.getSimpleName()+" with "+filter); - MethodHandle target2 = MethodHandles.filterReturnValue(target, filter); - if (verbosity >= 4) - System.out.println("filtered target: "+target2); - // Simulate expected effect of filter on return value: - Object unfiltered = target.invokeWithArguments(argsToPass); - Object expected = filter.invokeWithArguments(unfiltered); - if (verbosity >= 4) - System.out.println("unfiltered: "+unfiltered+" : "+unfiltered.getClass().getSimpleName()); - if (verbosity >= 4) - System.out.println("expected: "+expected+" : "+expected.getClass().getSimpleName()); - Object result = target2.invokeWithArguments(argsToPass); - if (verbosity >= 3) - System.out.println("result: "+result+" : "+result.getClass().getSimpleName()); - if (!expected.equals(result)) - System.out.println("*** fail at n/rt = "+nargs+"/"+rtype.getSimpleName()+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected); - assertEquals(expected, result); - } - - @Test - public void testFilterArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFilterArguments0); - } - - public void testFilterArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("filterArguments"); - for (int nargs = 1; nargs <= 6; nargs++) { - for (int pos = 0; pos < nargs; pos++) { - testFilterArguments(nargs, pos); - } - } - } - - void testFilterArguments(int nargs, int pos) throws Throwable { - countTest(); - MethodHandle target = varargsList(nargs); - MethodHandle filter = varargsList(1); - filter = filter.asType(filter.type().generic()); - Object[] argsToPass = randomArgs(nargs, Object.class); - if (verbosity >= 3) - System.out.println("filter "+target+" at "+pos+" with "+filter); - MethodHandle target2 = MethodHandles.filterArguments(target, pos, filter); - // Simulate expected effect of filter on arglist: - Object[] filteredArgs = argsToPass.clone(); - filteredArgs[pos] = filter.invokeExact(filteredArgs[pos]); - List<Object> expected = Arrays.asList(filteredArgs); - Object result = target2.invokeWithArguments(argsToPass); - if (verbosity >= 3) - System.out.println("result: "+result); - if (!expected.equals(result)) - System.out.println("*** fail at n/p = "+nargs+"/"+pos+": "+Arrays.asList(argsToPass)+" => "+result+" != "+expected); - assertEquals(expected, result); - } - - @Test - public void testCollectArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testCollectArguments0); - } - - public void testCollectArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("collectArguments"); - testFoldOrCollectArguments(true, false); - } - - @Test - public void testFoldArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testFoldArguments0); - CodeCacheOverflowProcessor.runMHTest(this::testFoldArguments1); - } - - public void testFoldArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("foldArguments"); - testFoldOrCollectArguments(false, false); - } - - public void testFoldArguments1() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("foldArguments/pos"); - testFoldOrCollectArguments(false, true); - } - - void testFoldOrCollectArguments(boolean isCollect, boolean withFoldPos) throws Throwable { - assert !(isCollect && withFoldPos); // exclude illegal argument combination - for (Class<?> lastType : new Class<?>[]{ Object.class, String.class, int.class }) { - for (Class<?> collectType : new Class<?>[]{ Object.class, String.class, int.class, void.class }) { - int maxArity = 10; - if (collectType != String.class) maxArity = 5; - if (lastType != Object.class) maxArity = 4; - for (int nargs = 0; nargs <= maxArity; nargs++) { - ArrayList<Class<?>> argTypes = new ArrayList<>(Collections.nCopies(nargs, Object.class)); - int maxMix = 20; - if (collectType != Object.class) maxMix = 0; - Map<Object,Integer> argTypesSeen = new HashMap<>(); - for (int mix = 0; mix <= maxMix; mix++) { - if (!mixArgs(argTypes, mix, argTypesSeen)) continue; - for (int collect = 0; collect <= nargs; collect++) { - for (int pos = 0; pos <= nargs - collect; pos++) { - testFoldOrCollectArguments(argTypes, pos, collect, collectType, lastType, isCollect, withFoldPos); - } - } - } - } - } - } - } - - boolean mixArgs(List<Class<?>> argTypes, int mix, Map<Object,Integer> argTypesSeen) { - assert(mix >= 0); - if (mix == 0) return true; // no change - if ((mix >>> argTypes.size()) != 0) return false; - for (int i = 0; i < argTypes.size(); i++) { - if (i >= 31) break; - boolean bit = (mix & (1 << i)) != 0; - if (bit) { - Class<?> type = argTypes.get(i); - if (type == Object.class) - type = String.class; - else if (type == String.class) - type = int.class; - else - type = Object.class; - argTypes.set(i, type); - } - } - Integer prev = argTypesSeen.put(new ArrayList<>(argTypes), mix); - if (prev != null) { - if (verbosity >= 4) System.out.println("mix "+prev+" repeated "+mix+": "+argTypes); - return false; - } - if (verbosity >= 3) System.out.println("mix "+mix+" = "+argTypes); - return true; - } - - void testFoldOrCollectArguments(List<Class<?>> argTypes, // argument types minus the inserted combineType - int pos, int fold, // position and length of the folded arguments - Class<?> combineType, // type returned from the combiner - Class<?> lastType, // type returned from the target - boolean isCollect, - boolean withFoldPos) throws Throwable { - int nargs = argTypes.size(); - if (pos != 0 && !isCollect && !withFoldPos) return; // test MethodHandles.foldArguments(MH,MH) only for pos=0 - countTest(); - List<Class<?>> combineArgTypes = argTypes.subList(pos, pos + fold); - List<Class<?>> targetArgTypes = new ArrayList<>(argTypes); - if (isCollect) // does target see arg[pos..pos+cc-1]? - targetArgTypes.subList(pos, pos + fold).clear(); - if (combineType != void.class) - targetArgTypes.add(pos, combineType); - MethodHandle target = varargsList(targetArgTypes, lastType); - MethodHandle combine = varargsList(combineArgTypes, combineType); - List<Object> argsToPass = Arrays.asList(randomArgs(argTypes)); - if (verbosity >= 3) - System.out.println((isCollect ? "collect" : "fold")+" "+target+" with "+combine); - MethodHandle target2; - if (isCollect) - target2 = MethodHandles.collectArguments(target, pos, combine); - else - target2 = withFoldPos ? MethodHandles.foldArguments(target, pos, combine) : MethodHandles.foldArguments(target, combine); - // Simulate expected effect of combiner on arglist: - List<Object> expectedList = new ArrayList<>(argsToPass); - List<Object> argsToFold = expectedList.subList(pos, pos + fold); - if (verbosity >= 3) - System.out.println((isCollect ? "collect" : "fold")+": "+argsToFold+" into "+target2); - Object foldedArgs = combine.invokeWithArguments(argsToFold); - if (isCollect) - argsToFold.clear(); - if (combineType != void.class) - argsToFold.add(0, foldedArgs); - Object result = target2.invokeWithArguments(argsToPass); - if (verbosity >= 3) - System.out.println("result: "+result); - Object expected = target.invokeWithArguments(expectedList); - if (!expected.equals(result)) - System.out.println("*** fail at n/p/f = "+nargs+"/"+pos+"/"+fold+": "+argsToPass+" => "+result+" != "+expected); - assertEquals(expected, result); - } - - @Test - public void testDropArguments() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testDropArguments0); - } - - public void testDropArguments0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("dropArguments"); - for (int nargs = 0; nargs <= 4; nargs++) { - for (int drop = 1; drop <= 4; drop++) { - for (int pos = 0; pos <= nargs; pos++) { - testDropArguments(nargs, pos, drop); - } - } - } - } - - void testDropArguments(int nargs, int pos, int drop) throws Throwable { - countTest(); - MethodHandle target = varargsArray(nargs); - Object[] args = randomArgs(target.type().parameterArray()); - MethodHandle target2 = MethodHandles.dropArguments(target, pos, - Collections.nCopies(drop, Object.class).toArray(new Class<?>[0])); - List<Object> resList = Arrays.asList(args); - List<Object> argsToDrop = new ArrayList<>(resList); - for (int i = drop; i > 0; i--) { - argsToDrop.add(pos, "blort#"+i); - } - Object res2 = target2.invokeWithArguments(argsToDrop); - Object res2List = Arrays.asList((Object[])res2); - //if (!resList.equals(res2List)) - // System.out.println("*** fail at n/p/d = "+nargs+"/"+pos+"/"+drop+": "+argsToDrop+" => "+res2List); - assertEquals(resList, res2List); - } - - @Test // SLOW - public void testInvokers() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testInvokers0); - } - - public void testInvokers0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker"); - // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker - Set<MethodType> done = new HashSet<>(); - for (int i = 0; i <= 6; i++) { - if (CAN_TEST_LIGHTLY && i > 3) break; - MethodType gtype = MethodType.genericMethodType(i); - for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { - for (int j = -1; j < i; j++) { - MethodType type = gtype; - if (j < 0) - type = type.changeReturnType(argType); - else if (argType == void.class) - continue; - else - type = type.changeParameterType(j, argType); - if (done.add(type)) - testInvokersWithCatch(type); - MethodType vtype = type.changeReturnType(void.class); - if (done.add(vtype)) - testInvokersWithCatch(vtype); - } - } - } - } - - public void testInvokersWithCatch(MethodType type) throws Throwable { - try { - testInvokers(type); - } catch (Throwable ex) { - System.out.println("*** testInvokers on "+type+" => "); - ex.printStackTrace(System.out); - } - } - public void testInvokers(MethodType type) throws Throwable { - if (verbosity >= 3) - System.out.println("test invokers for "+type); - int nargs = type.parameterCount(); - boolean testRetCode = type.returnType() != void.class; - MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "invokee", - MethodType.genericMethodType(0, true)); - assertTrue(target.isVarargsCollector()); - target = target.asType(type); - Object[] args = randomArgs(type.parameterArray()); - List<Object> targetPlusArgs = new ArrayList<>(Arrays.asList(args)); - targetPlusArgs.add(0, target); - int code = (Integer) invokee(args); - Object log = logEntry("invokee", args); - assertEquals(log.hashCode(), code); - assertCalled("invokee", args); - MethodHandle inv; - Object result; - // exact invoker - countTest(); - calledLog.clear(); - inv = MethodHandles.exactInvoker(type); - result = inv.invokeWithArguments(targetPlusArgs); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - // generic invoker - countTest(); - inv = MethodHandles.invoker(type); - if (nargs <= 3 && type == type.generic()) { - calledLog.clear(); - switch (nargs) { - case 0: - result = inv.invokeExact(target); - break; - case 1: - result = inv.invokeExact(target, args[0]); - break; - case 2: - result = inv.invokeExact(target, args[0], args[1]); - break; - case 3: - result = inv.invokeExact(target, args[0], args[1], args[2]); - break; - } - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - } - calledLog.clear(); - result = inv.invokeWithArguments(targetPlusArgs); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - // varargs invoker #0 - calledLog.clear(); - inv = MethodHandles.spreadInvoker(type, 0); - if (type.returnType() == Object.class) { - result = inv.invokeExact(target, args); - } else if (type.returnType() == void.class) { - result = null; inv.invokeExact(target, args); - } else { - result = inv.invokeWithArguments(target, (Object) args); - } - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - if (nargs >= 1 && type == type.generic()) { - // varargs invoker #1 - calledLog.clear(); - inv = MethodHandles.spreadInvoker(type, 1); - result = inv.invokeExact(target, args[0], Arrays.copyOfRange(args, 1, nargs)); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - } - if (nargs >= 2 && type == type.generic()) { - // varargs invoker #2 - calledLog.clear(); - inv = MethodHandles.spreadInvoker(type, 2); - result = inv.invokeExact(target, args[0], args[1], Arrays.copyOfRange(args, 2, nargs)); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - } - if (nargs >= 3 && type == type.generic()) { - // varargs invoker #3 - calledLog.clear(); - inv = MethodHandles.spreadInvoker(type, 3); - result = inv.invokeExact(target, args[0], args[1], args[2], Arrays.copyOfRange(args, 3, nargs)); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - } - for (int k = 0; k <= nargs; k++) { - // varargs invoker #0..N - if (CAN_TEST_LIGHTLY && (k > 1 || k < nargs - 1)) continue; - countTest(); - calledLog.clear(); - inv = MethodHandles.spreadInvoker(type, k); - MethodType expType = (type.dropParameterTypes(k, nargs) - .appendParameterTypes(Object[].class) - .insertParameterTypes(0, MethodHandle.class)); - assertEquals(expType, inv.type()); - List<Object> targetPlusVarArgs = new ArrayList<>(targetPlusArgs); - List<Object> tailList = targetPlusVarArgs.subList(1+k, 1+nargs); - Object[] tail = tailList.toArray(); - tailList.clear(); tailList.add(tail); - result = inv.invokeWithArguments(targetPlusVarArgs); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - } - - // dynamic invoker - countTest(); - CallSite site = new MutableCallSite(type); - inv = site.dynamicInvoker(); - - // see if we get the result of the original target: - try { - result = inv.invokeWithArguments(args); - assertTrue("should not reach here", false); - } catch (IllegalStateException ex) { - String msg = ex.getMessage(); - assertTrue(msg, msg.contains("site")); - } - - // set new target after invoker is created, to make sure we track target - site.setTarget(target); - calledLog.clear(); - result = inv.invokeWithArguments(args); - if (testRetCode) assertEquals(code, result); - assertCalled("invokee", args); - } - static Object invokee(Object... args) { return called("invokee", args).hashCode(); } - private static final String MISSING_ARG = "missingArg"; - private static final String MISSING_ARG_2 = "missingArg#2"; + protected static final String MISSING_ARG = "missingArg"; + protected static final String MISSING_ARG_2 = "missingArg#2"; + static Object targetIfEquals() { return called("targetIfEquals"); } + static Object fallbackIfNotEquals() { return called("fallbackIfNotEquals"); } + static Object targetIfEquals(Object x) { assertEquals(x, MISSING_ARG); return called("targetIfEquals", x); } + static Object fallbackIfNotEquals(Object x) { assertFalse(x.toString(), x.equals(MISSING_ARG)); return called("fallbackIfNotEquals", x); } + static Object targetIfEquals(Object x, Object y) { assertEquals(x, y); return called("targetIfEquals", x, y); } + static Object fallbackIfNotEquals(Object x, Object y) { assertFalse(x.toString(), x.equals(y)); return called("fallbackIfNotEquals", x, y); } + static Object targetIfEquals(Object x, Object y, Object z) { assertEquals(x, y); return called("targetIfEquals", x, y, z); } + static Object fallbackIfNotEquals(Object x, Object y, Object z) { assertFalse(x.toString(), x.equals(y)); return called("fallbackIfNotEquals", x, y, z); } - @Test - public void testGuardWithTest() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testGuardWithTest0); - } - - public void testGuardWithTest0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("guardWithTest"); - for (int nargs = 0; nargs <= 50; nargs++) { - if (CAN_TEST_LIGHTLY && nargs > 7) break; - testGuardWithTest(nargs, Object.class); - testGuardWithTest(nargs, String.class); - } - } - void testGuardWithTest(int nargs, Class<?> argClass) throws Throwable { - testGuardWithTest(nargs, 0, argClass); - if (nargs <= 5 || nargs % 10 == 3) { - for (int testDrops = 1; testDrops <= nargs; testDrops++) - testGuardWithTest(nargs, testDrops, argClass); - } - } - void testGuardWithTest(int nargs, int testDrops, Class<?> argClass) throws Throwable { - countTest(); - int nargs1 = Math.min(3, nargs); - MethodHandle test = PRIVATE.findVirtual(Object.class, "equals", MethodType.methodType(boolean.class, Object.class)); - MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "targetIfEquals", MethodType.genericMethodType(nargs1)); - MethodHandle fallback = PRIVATE.findStatic(MethodHandlesTest.class, "fallbackIfNotEquals", MethodType.genericMethodType(nargs1)); - while (test.type().parameterCount() > nargs) - // 0: test = constant(MISSING_ARG.equals(MISSING_ARG)) - // 1: test = lambda (_) MISSING_ARG.equals(_) - test = MethodHandles.insertArguments(test, 0, MISSING_ARG); - if (argClass != Object.class) { - test = changeArgTypes(test, argClass); - target = changeArgTypes(target, argClass); - fallback = changeArgTypes(fallback, argClass); - } - int testArgs = nargs - testDrops; - assert(testArgs >= 0); - test = addTrailingArgs(test, Math.min(testArgs, nargs), argClass); - target = addTrailingArgs(target, nargs, argClass); - fallback = addTrailingArgs(fallback, nargs, argClass); - Object[][] argLists = { - { }, - { "foo" }, { MISSING_ARG }, - { "foo", "foo" }, { "foo", "bar" }, - { "foo", "foo", "baz" }, { "foo", "bar", "baz" } - }; - for (Object[] argList : argLists) { - Object[] argList1 = argList; - if (argList.length != nargs) { - if (argList.length != nargs1) continue; - argList1 = Arrays.copyOf(argList, nargs); - Arrays.fill(argList1, nargs1, nargs, MISSING_ARG_2); - } - MethodHandle test1 = test; - if (test1.type().parameterCount() > testArgs) { - int pc = test1.type().parameterCount(); - test1 = MethodHandles.insertArguments(test, testArgs, Arrays.copyOfRange(argList1, testArgs, pc)); - } - MethodHandle mh = MethodHandles.guardWithTest(test1, target, fallback); - assertEquals(target.type(), mh.type()); - boolean equals; - switch (nargs) { - case 0: equals = true; break; - case 1: equals = MISSING_ARG.equals(argList[0]); break; - default: equals = argList[0].equals(argList[1]); break; - } - String willCall = (equals ? "targetIfEquals" : "fallbackIfNotEquals"); - if (verbosity >= 3) - System.out.println(logEntry(willCall, argList)); - Object result = mh.invokeWithArguments(argList1); - assertCalled(willCall, argList); - } - } - - @Test - public void testGenericLoopCombinator() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testGenericLoopCombinator0); - } - public void testGenericLoopCombinator0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("loop"); - // Test as follows: - // * Have an increasing number of loop-local state. Local state type diversity grows with the number. - // * Initializers set the starting value of loop-local state from the corresponding loop argument. - // * For each local state element, there is a predicate - for all state combinations, exercise all predicates. - // * Steps modify each local state element in each iteration. - // * Finalizers group all local state elements into a resulting array. Verify end values. - // * Exercise both pre- and post-checked loops. - // Local state types, start values, predicates, and steps: - // * int a, 0, a < 7, a = a + 1 - // * double b, 7.0, b > 0.5, b = b / 2.0 - // * String c, "start", c.length <= 9, c = c + a - final Class<?>[] argTypes = new Class<?>[] {int.class, double.class, String.class}; - final Object[][] args = new Object[][] { - new Object[]{0 }, - new Object[]{0, 7.0 }, - new Object[]{0, 7.0, "start"} - }; - // These are the expected final state tuples for argument type tuple / predicate combinations, for pre- and - // post-checked loops: - final Object[][] preCheckedResults = new Object[][] { - new Object[]{7 }, // (int) / int - new Object[]{7, 0.0546875 }, // (int,double) / int - new Object[]{5, 0.4375 }, // (int,double) / double - new Object[]{7, 0.0546875, "start1234567"}, // (int,double,String) / int - new Object[]{5, 0.4375, "start1234" }, // (int,double,String) / double - new Object[]{6, 0.109375, "start12345" } // (int,double,String) / String - }; - final Object[][] postCheckedResults = new Object[][] { - new Object[]{7 }, // (int) / int - new Object[]{7, 0.109375 }, // (int,double) / int - new Object[]{4, 0.4375 }, // (int,double) / double - new Object[]{7, 0.109375, "start123456"}, // (int,double,String) / int - new Object[]{4, 0.4375, "start123" }, // (int,double,String) / double - new Object[]{5, 0.21875, "start12345" } // (int,double,String) / String - }; - final Lookup l = MethodHandles.lookup(); - final Class<?> MHT = MethodHandlesTest.class; - final Class<?> B = boolean.class; - final Class<?> I = int.class; - final Class<?> D = double.class; - final Class<?> S = String.class; - final MethodHandle hip = l.findStatic(MHT, "loopIntPred", methodType(B, I)); - final MethodHandle hdp = l.findStatic(MHT, "loopDoublePred", methodType(B, I, D)); - final MethodHandle hsp = l.findStatic(MHT, "loopStringPred", methodType(B, I, D, S)); - final MethodHandle his = l.findStatic(MHT, "loopIntStep", methodType(I, I)); - final MethodHandle hds = l.findStatic(MHT, "loopDoubleStep", methodType(D, I, D)); - final MethodHandle hss = l.findStatic(MHT, "loopStringStep", methodType(S, I, D, S)); - final MethodHandle[] preds = new MethodHandle[] {hip, hdp, hsp}; - final MethodHandle[] steps = new MethodHandle[] {his, hds, hss}; - for (int nargs = 1, useResultsStart = 0; nargs <= argTypes.length; useResultsStart += nargs++) { - Class<?>[] useArgTypes = Arrays.copyOf(argTypes, nargs, Class[].class); - MethodHandle[] usePreds = Arrays.copyOf(preds, nargs, MethodHandle[].class); - MethodHandle[] useSteps = Arrays.copyOf(steps, nargs, MethodHandle[].class); - Object[] useArgs = args[nargs - 1]; - Object[][] usePreCheckedResults = new Object[nargs][]; - Object[][] usePostCheckedResults = new Object[nargs][]; - System.arraycopy(preCheckedResults, useResultsStart, usePreCheckedResults, 0, nargs); - System.arraycopy(postCheckedResults, useResultsStart, usePostCheckedResults, 0, nargs); - testGenericLoopCombinator(nargs, useArgTypes, usePreds, useSteps, useArgs, usePreCheckedResults, - usePostCheckedResults); - } - } - void testGenericLoopCombinator(int nargs, Class<?>[] argTypes, MethodHandle[] preds, MethodHandle[] steps, - Object[] args, Object[][] preCheckedResults, Object[][] postCheckedResults) - throws Throwable { - List<Class<?>> lArgTypes = Arrays.asList(argTypes); - // Predicate and step handles are passed in as arguments, initializer and finalizer handles are constructed here - // from the available information. - MethodHandle[] inits = new MethodHandle[nargs]; - for (int i = 0; i < nargs; ++i) { - MethodHandle h; - // Initializers are meant to return whatever they are passed at a given argument position. This means that - // additional arguments may have to be appended and prepended. - h = MethodHandles.identity(argTypes[i]); - if (i < nargs - 1) { - h = MethodHandles.dropArguments(h, 1, lArgTypes.subList(i + 1, nargs)); - } - if (i > 0) { - h = MethodHandles.dropArguments(h, 0, lArgTypes.subList(0, i)); - } - inits[i] = h; - } - // Finalizers are all meant to collect all of the loop-local state in a single array and return that. Local - // state is passed before the loop args. Construct such a finalizer by first taking a varargsArray collector for - // the number of local state arguments, and then appending the loop args as to-be-dropped arguments. - MethodHandle[] finis = new MethodHandle[nargs]; - MethodHandle genericFini = MethodHandles.dropArguments( - varargsArray(nargs).asType(methodType(Object[].class, lArgTypes)), nargs, lArgTypes); - Arrays.fill(finis, genericFini); - // The predicate and step handles' signatures need to be extended. They currently just accept local state args; - // append possibly missing local state args and loop args using dropArguments. - for (int i = 0; i < nargs; ++i) { - List<Class<?>> additionalLocalStateArgTypes = lArgTypes.subList(i + 1, nargs); - preds[i] = MethodHandles.dropArguments( - MethodHandles.dropArguments(preds[i], i + 1, additionalLocalStateArgTypes), nargs, lArgTypes); - steps[i] = MethodHandles.dropArguments( - MethodHandles.dropArguments(steps[i], i + 1, additionalLocalStateArgTypes), nargs, lArgTypes); - } - // Iterate over all of the predicates, using only one of them at a time. - for (int i = 0; i < nargs; ++i) { - MethodHandle[] usePreds; - if (nargs == 1) { - usePreds = preds; - } else { - // Create an all-null preds array, and only use one predicate in this iteration. The null entries will - // be substituted with true predicates by the loop combinator. - usePreds = new MethodHandle[nargs]; - usePreds[i] = preds[i]; - } - // Go for it. - if (verbosity >= 3) { - System.out.println("calling loop for argument types " + lArgTypes + " with predicate at index " + i); - if (verbosity >= 5) { - System.out.println("predicates: " + Arrays.asList(usePreds)); - } - } - MethodHandle[] preInits = new MethodHandle[nargs + 1]; - MethodHandle[] prePreds = new MethodHandle[nargs + 1]; - MethodHandle[] preSteps = new MethodHandle[nargs + 1]; - MethodHandle[] preFinis = new MethodHandle[nargs + 1]; - System.arraycopy(inits, 0, preInits, 1, nargs); - System.arraycopy(usePreds, 0, prePreds, 0, nargs); // preds are offset by 1 for pre-checked loops - System.arraycopy(steps, 0, preSteps, 1, nargs); - System.arraycopy(finis, 0, preFinis, 0, nargs); // finis are also offset by 1 for pre-checked loops - // Convert to clause-major form. - MethodHandle[][] preClauses = new MethodHandle[nargs + 1][4]; - MethodHandle[][] postClauses = new MethodHandle[nargs][4]; - toClauseMajor(preClauses, preInits, preSteps, prePreds, preFinis); - toClauseMajor(postClauses, inits, steps, usePreds, finis); - MethodHandle pre = MethodHandles.loop(preClauses); - MethodHandle post = MethodHandles.loop(postClauses); - if (verbosity >= 6) { - System.out.println("pre-handle: " + pre); - } - Object[] preResults = (Object[]) pre.invokeWithArguments(args); - if (verbosity >= 4) { - System.out.println("pre-checked: expected " + Arrays.asList(preCheckedResults[i]) + ", actual " + - Arrays.asList(preResults)); - } - if (verbosity >= 6) { - System.out.println("post-handle: " + post); - } - Object[] postResults = (Object[]) post.invokeWithArguments(args); - if (verbosity >= 4) { - System.out.println("post-checked: expected " + Arrays.asList(postCheckedResults[i]) + ", actual " + - Arrays.asList(postResults)); - } - assertArrayEquals(preCheckedResults[i], preResults); - assertArrayEquals(postCheckedResults[i], postResults); - } - } - static void toClauseMajor(MethodHandle[][] clauses, MethodHandle[] init, MethodHandle[] step, MethodHandle[] pred, MethodHandle[] fini) { - for (int i = 0; i < clauses.length; ++i) { - clauses[i][0] = init[i]; - clauses[i][1] = step[i]; - clauses[i][2] = pred[i]; - clauses[i][3] = fini[i]; - } - } static boolean loopIntPred(int a) { if (verbosity >= 5) { System.out.println("int pred " + a + " -> " + (a < 7)); } return a < 7; } + static boolean loopDoublePred(int a, double b) { if (verbosity >= 5) { System.out.println("double pred (a=" + a + ") " + b + " -> " + (b > 0.5)); } return b > 0.5; } + static boolean loopStringPred(int a, double b, String c) { if (verbosity >= 5) { System.out.println("String pred (a=" + a + ",b=" + b + ") " + c + " -> " + (c.length() <= 9)); } return c.length() <= 9; } + static int loopIntStep(int a) { if (verbosity >= 5) { System.out.println("int step " + a + " -> " + (a + 1)); } return a + 1; } + static double loopDoubleStep(int a, double b) { if (verbosity >= 5) { System.out.println("double step (a=" + a + ") " + b + " -> " + (b / 2.0)); } return b / 2.0; } + static String loopStringStep(int a, double b, String c) { if (verbosity >= 5) { System.out.println("String step (a=" + a + ",b=" + b + ") " + c + " -> " + (c + a)); @@ -2887,603 +742,33 @@ public class MethodHandlesTest { return c + a; } - @Test - public void testThrowException() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testThrowException0); - } - - public void testThrowException0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("throwException"); - testThrowException(int.class, new ClassCastException("testing")); - testThrowException(void.class, new java.io.IOException("testing")); - testThrowException(String.class, new LinkageError("testing")); - } - - void testThrowException(Class<?> returnType, Throwable thrown) throws Throwable { - countTest(); - Class<? extends Throwable> exType = thrown.getClass(); - MethodHandle target = MethodHandles.throwException(returnType, exType); - //System.out.println("throwing with "+target+" : "+thrown); - MethodType expectedType = MethodType.methodType(returnType, exType); - assertEquals(expectedType, target.type()); - target = target.asType(target.type().generic()); - Throwable caught = null; - try { - Object res = target.invokeExact((Object) thrown); - fail("got "+res+" instead of throwing "+thrown); - } catch (Throwable ex) { - if (ex != thrown) { - if (ex instanceof Error) throw (Error)ex; - if (ex instanceof RuntimeException) throw (RuntimeException)ex; - } - caught = ex; - } - assertSame(thrown, caught); - } - - @Test - public void testTryFinally() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testTryFinally0); - } - public void testTryFinally0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("tryFinally"); - String inputMessage = "returned"; - String augmentedMessage = "augmented"; - String thrownMessage = "thrown"; - String rethrownMessage = "rethrown"; - // Test these cases: - // * target returns, cleanup passes through - // * target returns, cleanup augments - // * target throws, cleanup augments and returns - // * target throws, cleanup augments and rethrows - MethodHandle target = MethodHandles.identity(String.class); - MethodHandle targetThrow = MethodHandles.dropArguments( - MethodHandles.throwException(String.class, Exception.class).bindTo(new Exception(thrownMessage)), 0, String.class); - MethodHandle cleanupPassThrough = MethodHandles.dropArguments(MethodHandles.identity(String.class), 0, - Throwable.class, String.class); - MethodHandle cleanupAugment = MethodHandles.dropArguments(MethodHandles.constant(String.class, augmentedMessage), - 0, Throwable.class, String.class, String.class); - MethodHandle cleanupCatch = MethodHandles.dropArguments(MethodHandles.constant(String.class, thrownMessage), 0, - Throwable.class, String.class, String.class); - MethodHandle cleanupThrow = MethodHandles.dropArguments(MethodHandles.throwException(String.class, Exception.class). - bindTo(new Exception(rethrownMessage)), 0, Throwable.class, String.class, String.class); - testTryFinally(target, cleanupPassThrough, inputMessage, inputMessage, false); - testTryFinally(target, cleanupAugment, inputMessage, augmentedMessage, false); - testTryFinally(targetThrow, cleanupCatch, inputMessage, thrownMessage, true); - testTryFinally(targetThrow, cleanupThrow, inputMessage, rethrownMessage, true); - // Test the same cases as above for void targets and cleanups. - MethodHandles.Lookup lookup = MethodHandles.lookup(); - Class<?> C = this.getClass(); - MethodType targetType = methodType(void.class, String[].class); - MethodType cleanupType = methodType(void.class, Throwable.class, String[].class); - MethodHandle vtarget = lookup.findStatic(C, "vtarget", targetType); - MethodHandle vtargetThrow = lookup.findStatic(C, "vtargetThrow", targetType); - MethodHandle vcleanupPassThrough = lookup.findStatic(C, "vcleanupPassThrough", cleanupType); - MethodHandle vcleanupAugment = lookup.findStatic(C, "vcleanupAugment", cleanupType); - MethodHandle vcleanupCatch = lookup.findStatic(C, "vcleanupCatch", cleanupType); - MethodHandle vcleanupThrow = lookup.findStatic(C, "vcleanupThrow", cleanupType); - testTryFinally(vtarget, vcleanupPassThrough, inputMessage, inputMessage, false); - testTryFinally(vtarget, vcleanupAugment, inputMessage, augmentedMessage, false); - testTryFinally(vtargetThrow, vcleanupCatch, inputMessage, thrownMessage, true); - testTryFinally(vtargetThrow, vcleanupThrow, inputMessage, rethrownMessage, true); - } - void testTryFinally(MethodHandle target, MethodHandle cleanup, String input, String msg, boolean mustCatch) - throws Throwable { - countTest(); - MethodHandle tf = MethodHandles.tryFinally(target, cleanup); - String result = null; - boolean isVoid = target.type().returnType() == void.class; - String[] argArray = new String[]{input}; - try { - if (isVoid) { - tf.invoke(argArray); - } else { - result = (String) tf.invoke(input); - } - } catch (Throwable t) { - assertTrue(mustCatch); - assertEquals(msg, t.getMessage()); - return; - } - assertFalse(mustCatch); - if (isVoid) { - assertEquals(msg, argArray[0]); - } else { - assertEquals(msg, result); - } - } static void vtarget(String[] a) { // naught, akin to identity } + static void vtargetThrow(String[] a) throws Exception { throw new Exception("thrown"); } + static void vcleanupPassThrough(Throwable t, String[] a) { assertNull(t); // naught, akin to identity } + static void vcleanupAugment(Throwable t, String[] a) { assertNull(t); a[0] = "augmented"; } + static void vcleanupCatch(Throwable t, String[] a) { assertNotNull(t); a[0] = "caught"; } + static void vcleanupThrow(Throwable t, String[] a) throws Exception { assertNotNull(t); throw new Exception("rethrown"); } - - @Test - public void testInterfaceCast() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testInterfaceCast0); - } - - public void testInterfaceCast0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("interfaceCast"); - assert( (((Object)"foo") instanceof CharSequence)); - assert(!(((Object)"foo") instanceof Iterable)); - for (MethodHandle mh : new MethodHandle[]{ - MethodHandles.identity(String.class), - MethodHandles.identity(CharSequence.class), - MethodHandles.identity(Iterable.class) - }) { - if (verbosity > 0) System.out.println("-- mh = "+mh); - for (Class<?> ctype : new Class<?>[]{ - Object.class, String.class, CharSequence.class, - Number.class, Iterable.class - }) { - if (verbosity > 0) System.out.println("---- ctype = "+ctype.getName()); - // doret docast - testInterfaceCast(mh, ctype, false, false); - testInterfaceCast(mh, ctype, true, false); - testInterfaceCast(mh, ctype, false, true); - testInterfaceCast(mh, ctype, true, true); - } - } - } - private static Class<?> i2o(Class<?> c) { - return (c.isInterface() ? Object.class : c); - } - public void testInterfaceCast(MethodHandle mh, Class<?> ctype, - boolean doret, boolean docast) throws Throwable { - MethodHandle mh0 = mh; - if (verbosity > 1) - System.out.println("mh="+mh+", ctype="+ctype.getName()+", doret="+doret+", docast="+docast); - String normalRetVal = "normal return value"; - MethodType mt = mh.type(); - MethodType mt0 = mt; - if (doret) mt = mt.changeReturnType(ctype); - else mt = mt.changeParameterType(0, ctype); - if (docast) mh = MethodHandles.explicitCastArguments(mh, mt); - else mh = mh.asType(mt); - assertEquals(mt, mh.type()); - MethodType mt1 = mt; - // this bit is needed to make the interface types disappear for invokeWithArguments: - mh = MethodHandles.explicitCastArguments(mh, mt.generic()); - Class<?>[] step = { - mt1.parameterType(0), // param as passed to mh at first - mt0.parameterType(0), // param after incoming cast - mt0.returnType(), // return value before cast - mt1.returnType(), // return value after outgoing cast - }; - // where might a checkCast occur? - boolean[] checkCast = new boolean[step.length]; - // the string value must pass each step without causing an exception - if (!docast) { - if (!doret) { - if (step[0] != step[1]) - checkCast[1] = true; // incoming value is cast - } else { - if (step[2] != step[3]) - checkCast[3] = true; // outgoing value is cast - } - } - boolean expectFail = false; - for (int i = 0; i < step.length; i++) { - Class<?> c = step[i]; - if (!checkCast[i]) c = i2o(c); - if (!c.isInstance(normalRetVal)) { - if (verbosity > 3) - System.out.println("expect failure at step "+i+" in "+Arrays.toString(step)+Arrays.toString(checkCast)); - expectFail = true; - break; - } - } - countTest(!expectFail); - if (verbosity > 2) - System.out.println("expectFail="+expectFail+", mt="+mt); - Object res; - try { - res = mh.invokeWithArguments(normalRetVal); - } catch (Exception ex) { - res = ex; - } - boolean sawFail = !(res instanceof String); - if (sawFail != expectFail) { - System.out.println("*** testInterfaceCast: mh0 = "+mh0); - System.out.println(" retype using "+(docast ? "explicitCastArguments" : "asType")+" to "+mt+" => "+mh); - System.out.println(" call returned "+res); - System.out.println(" expected "+(expectFail ? "an exception" : normalRetVal)); - } - if (!expectFail) { - assertFalse(res.toString(), sawFail); - assertEquals(normalRetVal, res); - } else { - assertTrue(res.toString(), sawFail); - } - } - - @Test // SLOW - public void testCastFailure() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testCastFailure0); - } - - public void testCastFailure0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("testCastFailure"); - testCastFailure("cast/argument", 11000); - if (CAN_TEST_LIGHTLY) return; - testCastFailure("unbox/argument", 11000); - testCastFailure("cast/return", 11000); - testCastFailure("unbox/return", 11000); - } - - static class Surprise { - public MethodHandle asMethodHandle() { - return VALUE.bindTo(this); - } - Object value(Object x) { - trace("value", x); - if (boo != null) return boo; - return x; - } - Object boo; - void boo(Object x) { boo = x; } - - static void trace(String x, Object y) { - if (verbosity > 8) System.out.println(x+"="+y); - } - static Object refIdentity(Object x) { trace("ref.x", x); return x; } - static Integer boxIdentity(Integer x) { trace("box.x", x); return x; } - static int intIdentity(int x) { trace("int.x", x); return x; } - static MethodHandle VALUE, REF_IDENTITY, BOX_IDENTITY, INT_IDENTITY; - static { - try { - VALUE = PRIVATE.findVirtual( - Surprise.class, "value", - MethodType.methodType(Object.class, Object.class)); - REF_IDENTITY = PRIVATE.findStatic( - Surprise.class, "refIdentity", - MethodType.methodType(Object.class, Object.class)); - BOX_IDENTITY = PRIVATE.findStatic( - Surprise.class, "boxIdentity", - MethodType.methodType(Integer.class, Integer.class)); - INT_IDENTITY = PRIVATE.findStatic( - Surprise.class, "intIdentity", - MethodType.methodType(int.class, int.class)); - } catch (NoSuchMethodException | IllegalAccessException ex) { - throw new RuntimeException(ex); - } - } - } - - @SuppressWarnings("ConvertToStringSwitch") - void testCastFailure(String mode, int okCount) throws Throwable { - countTest(false); - if (verbosity > 2) System.out.println("mode="+mode); - Surprise boo = new Surprise(); - MethodHandle identity = Surprise.REF_IDENTITY, surprise0 = boo.asMethodHandle(), surprise = surprise0; - if (mode.endsWith("/return")) { - if (mode.equals("unbox/return")) { - // fail on return to ((Integer)surprise).intValue - surprise = surprise.asType(MethodType.methodType(int.class, Object.class)); - identity = identity.asType(MethodType.methodType(int.class, Object.class)); - } else if (mode.equals("cast/return")) { - // fail on return to (Integer)surprise - surprise = surprise.asType(MethodType.methodType(Integer.class, Object.class)); - identity = identity.asType(MethodType.methodType(Integer.class, Object.class)); - } - } else if (mode.endsWith("/argument")) { - MethodHandle callee = null; - if (mode.equals("unbox/argument")) { - // fail on handing surprise to int argument - callee = Surprise.INT_IDENTITY; - } else if (mode.equals("cast/argument")) { - // fail on handing surprise to Integer argument - callee = Surprise.BOX_IDENTITY; - } - if (callee != null) { - callee = callee.asType(MethodType.genericMethodType(1)); - surprise = MethodHandles.filterArguments(callee, 0, surprise); - identity = MethodHandles.filterArguments(callee, 0, identity); - } - } - assertNotSame(mode, surprise, surprise0); - identity = identity.asType(MethodType.genericMethodType(1)); - surprise = surprise.asType(MethodType.genericMethodType(1)); - Object x = 42; - for (int i = 0; i < okCount; i++) { - Object y = identity.invokeExact(x); - assertEquals(x, y); - Object z = surprise.invokeExact(x); - assertEquals(x, z); - } - boo.boo("Boo!"); - Object y = identity.invokeExact(x); - assertEquals(x, y); - try { - Object z = surprise.invokeExact(x); - System.out.println("Failed to throw; got z="+z); - assertTrue(false); - } catch (ClassCastException ex) { - if (verbosity > 2) - System.out.println("caught "+ex); - if (verbosity > 3) - ex.printStackTrace(System.out); - assertTrue(true); // all is well - } - } - - static Example userMethod(Object o, String s, int i) { - called("userMethod", o, s, i); - return null; - } - - @Test - public void testUserClassInSignature() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testUserClassInSignature0); - } - - public void testUserClassInSignature0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("testUserClassInSignature"); - Lookup lookup = MethodHandles.lookup(); - String name; MethodType mt; MethodHandle mh; - Object[] args; - - // Try a static method. - name = "userMethod"; - mt = MethodType.methodType(Example.class, Object.class, String.class, int.class); - mh = lookup.findStatic(lookup.lookupClass(), name, mt); - assertEquals(mt, mh.type()); - assertEquals(Example.class, mh.type().returnType()); - args = randomArgs(mh.type().parameterArray()); - mh.invokeWithArguments(args); - assertCalled(name, args); - - // Try a virtual method. - name = "v2"; - mt = MethodType.methodType(Object.class, Object.class, int.class); - mh = lookup.findVirtual(Example.class, name, mt); - assertEquals(mt, mh.type().dropParameterTypes(0,1)); - assertTrue(mh.type().parameterList().contains(Example.class)); - args = randomArgs(mh.type().parameterArray()); - mh.invokeWithArguments(args); - assertCalled(name, args); - } - - static void runForRunnable() { - called("runForRunnable"); - } - public interface Fooable { - // overloads: - Object foo(Object x, String y); - List<?> foo(String x, int y); - Object foo(String x); - } - static Object fooForFooable(String x, Object... y) { - return called("fooForFooable/"+x, y); - } - @SuppressWarnings("serial") // not really a public API, just a test case - public static class MyCheckedException extends Exception { - } - public interface WillThrow { - void willThrow() throws MyCheckedException; - } - /*non-public*/ interface PrivateRunnable { - public void run(); - } - - @Test - public void testAsInterfaceInstance() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testAsInterfaceInstance0); - } - - public void testAsInterfaceInstance0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("asInterfaceInstance"); - Lookup lookup = MethodHandles.lookup(); - // test typical case: Runnable.run - { - countTest(); - if (verbosity >= 2) System.out.println("Runnable"); - MethodType mt = MethodType.methodType(void.class); - MethodHandle mh = lookup.findStatic(MethodHandlesTest.class, "runForRunnable", mt); - Runnable proxy = MethodHandleProxies.asInterfaceInstance(Runnable.class, mh); - proxy.run(); - assertCalled("runForRunnable"); - } - // well known single-name overloaded interface: Appendable.append - { - countTest(); - if (verbosity >= 2) System.out.println("Appendable"); - ArrayList<List<?>> appendResults = new ArrayList<>(); - MethodHandle append = lookup.bind(appendResults, "add", MethodType.methodType(boolean.class, Object.class)); - append = append.asType(MethodType.methodType(void.class, List.class)); // specialize the type - MethodHandle asList = lookup.findStatic(Arrays.class, "asList", MethodType.methodType(List.class, Object[].class)); - MethodHandle mh = MethodHandles.filterReturnValue(asList, append).asVarargsCollector(Object[].class); - Appendable proxy = MethodHandleProxies.asInterfaceInstance(Appendable.class, mh); - proxy.append("one"); - proxy.append("two", 3, 4); - proxy.append('5'); - assertEquals(Arrays.asList(Arrays.asList("one"), - Arrays.asList("two", 3, 4), - Arrays.asList('5')), - appendResults); - if (verbosity >= 3) System.out.println("appendResults="+appendResults); - appendResults.clear(); - Formatter formatter = new Formatter(proxy); - String fmt = "foo str=%s char='%c' num=%d"; - Object[] fmtArgs = { "str!", 'C', 42 }; - String expect = String.format(fmt, fmtArgs); - formatter.format(fmt, fmtArgs); - String actual = ""; - if (verbosity >= 3) System.out.println("appendResults="+appendResults); - for (List<?> l : appendResults) { - Object x = l.get(0); - switch (l.size()) { - case 1: actual += x; continue; - case 3: actual += ((String)x).substring((int)(Object)l.get(1), (int)(Object)l.get(2)); continue; - } - actual += l; - } - if (verbosity >= 3) System.out.println("expect="+expect); - if (verbosity >= 3) System.out.println("actual="+actual); - assertEquals(expect, actual); - } - // test case of an single name which is overloaded: Fooable.foo(...) - { - if (verbosity >= 2) System.out.println("Fooable"); - MethodHandle mh = lookup.findStatic(MethodHandlesTest.class, "fooForFooable", - MethodType.methodType(Object.class, String.class, Object[].class)); - Fooable proxy = MethodHandleProxies.asInterfaceInstance(Fooable.class, mh); - for (Method m : Fooable.class.getDeclaredMethods()) { - countTest(); - assertSame("foo", m.getName()); - if (verbosity > 3) - System.out.println("calling "+m); - MethodHandle invoker = lookup.unreflect(m); - MethodType mt = invoker.type(); - Class<?>[] types = mt.parameterArray(); - types[0] = int.class; // placeholder - Object[] args = randomArgs(types); - args[0] = proxy; - if (verbosity > 3) - System.out.println("calling "+m+" on "+Arrays.asList(args)); - Object result = invoker.invokeWithArguments(args); - if (verbosity > 4) - System.out.println("result = "+result); - String name = "fooForFooable/"+args[1]; - Object[] argTail = Arrays.copyOfRange(args, 2, args.length); - assertCalled(name, argTail); - assertEquals(result, logEntry(name, argTail)); - } - } - // test processing of thrown exceptions: - for (Throwable ex : new Throwable[] { new NullPointerException("ok"), - new InternalError("ok"), - new Throwable("fail"), - new Exception("fail"), - new MyCheckedException() - }) { - MethodHandle mh = MethodHandles.throwException(void.class, Throwable.class); - mh = MethodHandles.insertArguments(mh, 0, ex); - WillThrow proxy = MethodHandleProxies.asInterfaceInstance(WillThrow.class, mh); - try { - countTest(); - proxy.willThrow(); - System.out.println("Failed to throw: "+ex); - assertTrue(false); - } catch (Throwable ex1) { - if (verbosity > 3) { - System.out.println("throw "+ex); - System.out.println("catch "+(ex == ex1 ? "UNWRAPPED" : ex1)); - } - if (ex instanceof RuntimeException || - ex instanceof Error) { - assertSame("must pass unchecked exception out without wrapping", ex, ex1); - } else if (ex instanceof MyCheckedException) { - assertSame("must pass declared exception out without wrapping", ex, ex1); - } else { - assertNotSame("must pass undeclared checked exception with wrapping", ex, ex1); - if (!(ex1 instanceof UndeclaredThrowableException) || ex1.getCause() != ex) { - ex1.printStackTrace(System.out); - } - assertSame(ex, ex1.getCause()); - UndeclaredThrowableException utex = (UndeclaredThrowableException) ex1; - } - } - } - // Test error checking on bad interfaces: - for (Class<?> nonSMI : new Class<?>[] { Object.class, - String.class, - CharSequence.class, - java.io.Serializable.class, - PrivateRunnable.class, - Example.class }) { - if (verbosity > 2) System.out.println(nonSMI.getName()); - try { - countTest(false); - MethodHandleProxies.asInterfaceInstance(nonSMI, varargsArray(0)); - assertTrue("Failed to throw on "+nonSMI.getName(), false); - } catch (IllegalArgumentException ex) { - if (verbosity > 2) System.out.println(nonSMI.getSimpleName()+": "+ex); - // Object: java.lang.IllegalArgumentException: - // not a public interface: java.lang.Object - // String: java.lang.IllegalArgumentException: - // not a public interface: java.lang.String - // CharSequence: java.lang.IllegalArgumentException: - // not a single-method interface: java.lang.CharSequence - // Serializable: java.lang.IllegalArgumentException: - // not a single-method interface: java.io.Serializable - // PrivateRunnable: java.lang.IllegalArgumentException: - // not a public interface: test.java.lang.invoke.MethodHandlesTest$PrivateRunnable - // Example: java.lang.IllegalArgumentException: - // not a public interface: test.java.lang.invoke.MethodHandlesTest$Example - } - } - // Test error checking on interfaces with the wrong method type: - for (Class<?> intfc : new Class<?>[] { Runnable.class /*arity 0*/, - Fooable.class /*arity 1 & 2*/ }) { - int badArity = 1; // known to be incompatible - if (verbosity > 2) System.out.println(intfc.getName()); - try { - countTest(false); - MethodHandleProxies.asInterfaceInstance(intfc, varargsArray(badArity)); - assertTrue("Failed to throw on "+intfc.getName(), false); - } catch (WrongMethodTypeException ex) { - if (verbosity > 2) System.out.println(intfc.getSimpleName()+": "+ex); - // Runnable: java.lang.invoke.WrongMethodTypeException: - // cannot convert MethodHandle(Object)Object[] to ()void - // Fooable: java.lang.invoke.WrongMethodTypeException: - // cannot convert MethodHandle(Object)Object[] to (Object,String)Object - } - } - } - - @Test - public void testRunnableProxy() throws Throwable { - CodeCacheOverflowProcessor.runMHTest(this::testRunnableProxy0); - } - - public void testRunnableProxy0() throws Throwable { - if (CAN_SKIP_WORKING) return; - startTest("testRunnableProxy"); - MethodHandles.Lookup lookup = MethodHandles.lookup(); - MethodHandle run = lookup.findStatic(lookup.lookupClass(), "runForRunnable", MethodType.methodType(void.class)); - Runnable r = MethodHandleProxies.asInterfaceInstance(Runnable.class, run); - testRunnableProxy(r); - assertCalled("runForRunnable"); - } - private static void testRunnableProxy(Runnable r) { - //7058630: JSR 292 method handle proxy violates contract for Object methods - r.run(); - Object o = r; - r = null; - boolean eq = (o == o); - int hc = System.identityHashCode(o); - String st = o.getClass().getName() + "@" + Integer.toHexString(hc); - Object expect = Arrays.asList(st, eq, hc); - if (verbosity >= 2) System.out.println("expect st/eq/hc = "+expect); - Object actual = Arrays.asList(o.toString(), o.equals(o), o.hashCode()); - if (verbosity >= 2) System.out.println("actual st/eq/hc = "+actual); - assertEquals(expect, actual); - } } // Local abbreviated copy of sun.invoke.util.ValueConversions // This guy tests access from outside the same package member, but inside @@ -3521,6 +806,7 @@ class ValueConversions { Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + static MethodHandle[] makeArrays() { ArrayList<MethodHandle> arrays = new ArrayList<>(); MethodHandles.Lookup lookup = IMPL_LOOKUP; @@ -3540,6 +826,7 @@ class ValueConversions { assertTrue(arrays.size() == 11); // current number of methods return arrays.toArray(new MethodHandle[0]); } + static final MethodHandle[] ARRAYS = makeArrays(); /** Return a method handle that takes the indicated number of Object @@ -3550,6 +837,7 @@ class ValueConversions { return ARRAYS[nargs]; return MethodHandles.identity(Object[].class).asCollector(Object[].class, nargs); } + public static MethodHandle varargsArray(Class<?> arrayType, int nargs) { Class<?> elemType = arrayType.getComponentType(); MethodType vaType = MethodType.methodType(arrayType, Collections.<Class<?>>nCopies(nargs, elemType)); @@ -3558,6 +846,7 @@ class ValueConversions { mh = MethodHandles.filterReturnValue(mh, CHANGE_ARRAY_TYPE.bindTo(arrayType)); return mh.asType(vaType); } + static Object changeArrayType(Class<?> arrayType, Object[] a) { Class<?> elemType = arrayType.getComponentType(); if (!elemType.isPrimitive()) @@ -3567,6 +856,7 @@ class ValueConversions { java.lang.reflect.Array.set(b, i, a[i]); return b; } + private static final MethodHandle CHANGE_ARRAY_TYPE; static { try { @@ -3610,6 +900,7 @@ class ValueConversions { Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + static MethodHandle[] makeLists() { ArrayList<MethodHandle> lists = new ArrayList<>(); MethodHandles.Lookup lookup = IMPL_LOOKUP; @@ -3629,8 +920,10 @@ class ValueConversions { assertTrue(lists.size() == 11); // current number of methods return lists.toArray(new MethodHandle[0]); } + static final MethodHandle[] LISTS = makeLists(); static final MethodHandle AS_LIST; + static { try { AS_LIST = IMPL_LOOKUP.findStatic(Arrays.class, "asList", MethodType.methodType(List.class, Object[].class)); diff --git a/test/jdk/java/lang/invoke/SpecialInterfaceCall.java b/test/jdk/java/lang/invoke/SpecialInterfaceCall.java index e651845344b..a67546426c3 100644 --- a/test/jdk/java/lang/invoke/SpecialInterfaceCall.java +++ b/test/jdk/java/lang/invoke/SpecialInterfaceCall.java @@ -26,11 +26,9 @@ * @bug 8200167 * @summary Test direct and MethodHandle access to interface methods using invokespecial semantics * @compile SpecialInterfaceCall.java - * @compile I4Special.jcod + * @compile SpecialInterfaceCallI4.jasm * @run main/othervm -Xint SpecialInterfaceCall * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1 SpecialInterfaceCall - * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=2 SpecialInterfaceCall - * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=3 SpecialInterfaceCall * @run main/othervm -Xbatch -XX:-TieredCompilation SpecialInterfaceCall */ @@ -62,6 +60,12 @@ public class SpecialInterfaceCall { // to Object.toString String s = (String) mh_I1_toString_from_I2.invokeExact(i); } + // special case of invoking a final Object method via an interface + static void invokeSpecialObjectFinalMH(I2 i) throws Throwable { + // emulates invokespecial of I1.getClass on i, which resolves + // to Object.getClass + Class<?> c = (Class<?>) mh_I1_getClass_from_I2.invokeExact(i); + } } interface I3 extends I2 { // Must take an I3 here rather than I2 else we get @@ -72,11 +76,17 @@ public class SpecialInterfaceCall { mh_I2_pub_m_from_I3.invokeExact(i); } } - // This interface acts like I2 but we define a directInvoke method + // This interface acts like I2 but we define directInvoke* methods // that we will rewrite the bytecode of to use invokespecial + // (see SpecialInterfaceCallI4.jasm). interface I4 extends I1 { static void invokeDirect(I4 i) { - String s = i.toString(); + // invokeSpecial Object.toString() + throw new Error("Class file for I4 is not overwritten"); + } + static void invokeDirectFinal(I4 i) { + // invokeSpecial Object.getClass() - final method + throw new Error("Class file for I4 is not overwritten"); } } @@ -102,6 +112,10 @@ public class SpecialInterfaceCall { // This MH acts likes an invokespecial of I1.toString from I2 static final MethodHandle mh_I1_toString_from_I2; + + // This MH acts likes an invokespecial of I1.getClass from I2 + static final MethodHandle mh_I1_getClass_from_I2; + static { try { MethodType mt = MethodType.methodType(void.class); @@ -113,6 +127,9 @@ public class SpecialInterfaceCall { mt = MethodType.methodType(String.class); mh_I1_toString_from_I2 = lookup.findSpecial(I1.class, "toString", mt, I2.class); + mt = MethodType.methodType(Class.class); + mh_I1_getClass_from_I2 = lookup.findSpecial(I1.class, "getClass", mt, I2.class); + } catch (Throwable e) { throw new Error(e); } @@ -123,10 +140,15 @@ public class SpecialInterfaceCall { shouldNotThrow(() -> I2.invokeDirect(new C3())); shouldNotThrow(() -> I2.invokeSpecialMH(new C2())); shouldNotThrow(() -> I2.invokeSpecialMH(new C3())); + shouldNotThrow(() -> I2.invokeSpecialObjectMH(new C2())); + shouldNotThrow(() -> I2.invokeSpecialObjectMH(new C3())); + shouldNotThrow(() -> I2.invokeSpecialObjectFinalMH(new C2())); + shouldNotThrow(() -> I2.invokeSpecialObjectFinalMH(new C3())); shouldNotThrow(() -> I3.invokeSpecialMH(new C3())); shouldNotThrow(() -> I4.invokeDirect(new C4())); + shouldNotThrow(() -> I4.invokeDirectFinal(new C4())); } static void runNegativeTests() { @@ -146,8 +168,12 @@ public class SpecialInterfaceCall { shouldThrowICCE(() -> I3.invokeSpecialMH(unsafeCastI3(new C2()))); System.out.println("ICCE I4.invokeDirect C1"); shouldThrowIAE(() -> I4.invokeDirect(unsafeCastI4(new C1()))); + System.out.println("ICCE I4.invokeDirectFinal C1"); + shouldThrowIAE(() -> I4.invokeDirectFinal(unsafeCastI4(new C1()))); System.out.println("ICCE I2.invokeObjectMH C1"); shouldThrowICCE(() -> I2.invokeSpecialObjectMH(unsafeCastI2(new C1()))); + System.out.println("ICCE I2.invokeObjectFinalMH C1"); + shouldThrowICCE(() -> I2.invokeSpecialObjectFinalMH(unsafeCastI2(new C1()))); } @@ -250,5 +276,4 @@ public class SpecialInterfaceCall { throw new Error(e); } } - } diff --git a/test/jdk/java/lang/invoke/SpecialInterfaceCallI4.jasm b/test/jdk/java/lang/invoke/SpecialInterfaceCallI4.jasm new file mode 100644 index 00000000000..24a02ccd1ee --- /dev/null +++ b/test/jdk/java/lang/invoke/SpecialInterfaceCallI4.jasm @@ -0,0 +1,49 @@ +/* + * 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. + */ + +// invokeDirect is modified to use invokespecial instead of invokevirtual + +interface SpecialInterfaceCall$I4 implements SpecialInterfaceCall$I1 + version 55:0 +{ + public static Method invokeDirect:"(LSpecialInterfaceCall$I4;)V" + stack 1 locals 2 + { + aload_0; + invokespecial Method java/lang/Object.toString:"()Ljava/lang/String;"; + astore_1; + return; + } + + public static Method invokeDirectFinal:"(LSpecialInterfaceCall$I4;)V" + stack 1 locals 2 + { + aload_0; + invokespecial Method java/lang/Object.getClass:"()Ljava/lang/Class;"; + astore_1; + return; + } + static abstract interface InnerClass I4=class SpecialInterfaceCall$I4 of class SpecialInterfaceCall; + static abstract interface InnerClass I1=class SpecialInterfaceCall$I1 of class SpecialInterfaceCall; + +} // end Class SpecialInterfaceCall$I4 diff --git a/test/jdk/java/rmi/Naming/LookupIPv6.java b/test/jdk/java/rmi/Naming/LookupIPv6.java index ea8d7d451e1..4db080b977a 100644 --- a/test/jdk/java/rmi/Naming/LookupIPv6.java +++ b/test/jdk/java/rmi/Naming/LookupIPv6.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -30,16 +30,16 @@ * java.rmi/sun.rmi.server * java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport.tcp - * @build TestLibrary + * @build RegistryVM * @run main/othervm -Djava.net.preferIPv6Addresses=true LookupIPv6 */ +import java.io.Serializable; import java.net.InetAddress; import java.net.Inet6Address; import java.net.MalformedURLException; import java.rmi.Naming; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; +import java.rmi.Remote; public class LookupIPv6 { public static void main(String[] args) throws Exception { @@ -67,19 +67,21 @@ public class LookupIPv6 { * an Inet6Address since this test is run with * -Djava.net.preferIPv6Addresses=true. */ - int port = TestLibrary.getUnusedRandomPort(); InetAddress localAddr = InetAddress.getAllByName(null)[0]; if (localAddr instanceof Inet6Address) { System.out.println("IPv6 detected"); - Registry reg; + RegistryVM rvm = RegistryVM.createRegistryVM(); try { - reg = LocateRegistry.createRegistry(port); - } catch (Exception ex) { - reg = LocateRegistry.getRegistry(); + rvm.start(); + String name = String.format("rmi://[%s]:%d/foo", + localAddr.getHostAddress(), rvm.getPort()); + Naming.rebind(name, new R()); + Naming.lookup(name); + } finally { + rvm.cleanup(); } - reg.rebind("foo", reg); - Naming.lookup(String.format("rmi://[%s]:%d/foo", - localAddr.getHostAddress(), port)); } } + + private static class R implements Remote, Serializable { } } diff --git a/test/jdk/java/security/KeyAgreement/KeyAgreementTest.java b/test/jdk/java/security/KeyAgreement/KeyAgreementTest.java new file mode 100644 index 00000000000..8f705abd772 --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/KeyAgreementTest.java @@ -0,0 +1,154 @@ +/* + * 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 + * @bug 4936763 8184359 + * @summary KeyAgreement Test with all supported algorithms from JCE. + * Arguments order <KeyExchangeAlgorithm> <KeyGenAlgorithm> <Provider> + * It removes com/sun/crypto/provider/KeyAgreement/DHGenSecretKey.java + * as the same functionality for DiffieHellman is covered along with + * this test file was covered before with JDK-4936763. + * @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true KeyAgreementTest + * DiffieHellman DH SunJCE + * @run main KeyAgreementTest ECDH EC SunEC + * @run main KeyAgreementTest XDH XDH SunEC + */ +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.spec.NamedParameterSpec; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.ECGenParameterSpec; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.crypto.KeyAgreement; +import javax.crypto.spec.DHGenParameterSpec; + +public class KeyAgreementTest { + + public static void main(String[] args) throws Exception { + + String kaAlgo = args[0]; + String kpgAlgo = args[1]; + String provider = args[2]; + AlgoSpec aSpec = AlgoSpec.valueOf(AlgoSpec.class, kaAlgo); + List<AlgorithmParameterSpec> specs = aSpec.getAlgorithmParameterSpecs(); + for (AlgorithmParameterSpec spec : specs) { + testKeyAgreement(provider, kaAlgo, kpgAlgo, spec); + } + } + + /** + * Generate AlgorithmParameterSpec using all possible supported curve for + * KeyExchangeAlgorithm. + */ + private enum AlgoSpec { + // EC curve supported for KeyGeneration can found between intersection + // of curves define in + // "java.base/share/classes/sun/security/util/CurveDB.java" + // and + // "jdk.crypto.ec/share/native/libsunec/impl/ecdecode.c" + ECDH( + // SEC2 prime curves + "secp112r1", "secp112r2", "secp128r1", "secp128r2", "secp160k1", + "secp160r1", "secp192k1", "secp192r1", "secp224k1", "secp224r1", + "secp256k1", "secp256r1", "secp384r1", "secp521r1", + // ANSI X9.62 prime curves + "X9.62 prime192v2", "X9.62 prime192v3", "X9.62 prime239v1", + "X9.62 prime239v2", "X9.62 prime239v3", + // SEC2 binary curves + "sect113r1", "sect113r2", "sect131r1", "sect131r2", "sect163k1", + "sect163r1", "sect163r2", "sect193r1", "sect193r2", "sect233k1", + "sect233r1", "sect239k1", "sect283k1", "sect283r1", "sect409k1", + "sect409r1", "sect571k1", "sect571r1", + // ANSI X9.62 binary curves + "X9.62 c2tnb191v1", "X9.62 c2tnb191v2", "X9.62 c2tnb191v3", + "X9.62 c2tnb239v1", "X9.62 c2tnb239v2", "X9.62 c2tnb239v3", + "X9.62 c2tnb359v1", "X9.62 c2tnb431r1" + ), + XDH("X25519", "X448"), + // There is no curve for DiffieHellman + DiffieHellman(new String[]{}); + + private final List<AlgorithmParameterSpec> specs = new ArrayList<>(); + + private AlgoSpec(String... curves) { + // Generate AlgorithmParameterSpec for each KeyExchangeAlgorithm + for (String crv : curves) { + switch (this.name()) { + case "ECDH": + specs.add(new ECGenParameterSpec(crv)); + break; + case "XDH": + specs.add(new NamedParameterSpec(crv)); + break; + case "DiffieHellman": + specs.add(new DHGenParameterSpec(512, 64)); + break; + default: + throw new RuntimeException("Invalid Algo name " + + this.name()); + } + } + } + + public List<AlgorithmParameterSpec> getAlgorithmParameterSpecs() { + return this.specs; + } + } + + /** + * Perform KeyAgreement operation using native as well as JCE provider. + */ + private static void testKeyAgreement(String provider, String kaAlgo, + String kpgAlgo, AlgorithmParameterSpec spec) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgo, provider); + kpg.initialize(spec); + KeyPair kp1 = kpg.generateKeyPair(); + KeyPair kp2 = kpg.generateKeyPair(); + + // Uses KeyAgreement based on Provider search order. + KeyAgreement ka1 = KeyAgreement.getInstance(kaAlgo); + ka1.init(kp1.getPrivate()); + ka1.doPhase(kp2.getPublic(), true); + byte[] secret1 = ka1.generateSecret(); + + // Uses SunJCE provider + KeyAgreement ka2 = KeyAgreement.getInstance(kaAlgo, provider); + ka2.init(kp2.getPrivate()); + ka2.doPhase(kp1.getPublic(), true); + // Keeping the legacy generateSecret method for DiffieHellman as it was + // defined in removed Test file from JDK-4936763, + // com/sun/crypto/provider/KeyAgreement/DHGenSecretKey.java. + byte[] secret2 = "DiffieHellman".equals(kaAlgo) + ? ka2.generateSecret("AES").getEncoded() : ka2.generateSecret(); + + // With related keypairs, each provider should generate same + // KeyAgreement secret. + if (!Arrays.equals(secret1, secret2)) { + throw new Exception("KeyAgreement secret mismatch."); + } + } +} diff --git a/test/jdk/java/security/KeyAgreement/KeySizeTest.java b/test/jdk/java/security/KeyAgreement/KeySizeTest.java new file mode 100644 index 00000000000..fede5726754 --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/KeySizeTest.java @@ -0,0 +1,238 @@ +/* + * 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 + * @bug 8184359 + * @summary KeyLength support test for DiffieHellman, EC, XDH. + * Arguments order <KeyExchangeAlgorithm> <Provider> <KeyGenAlgorithm> <keyLen> + * @library /test/lib + * @build jdk.test.lib.Convert + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 512 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 768 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 832 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 1024 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 2048 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 3072 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 4096 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 6144 + * @run main KeySizeTest DiffieHellman SunJCE DiffieHellman 8192 + * @run main KeySizeTest ECDH SunEC EC 128 + * @run main KeySizeTest ECDH SunEC EC 192 + * @run main KeySizeTest ECDH SunEC EC 256 + * @run main KeySizeTest XDH SunEC XDH 255 + * @run main KeySizeTest XDH SunEC XDH 448 + */ +import java.math.BigInteger; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.interfaces.ECPrivateKey; +import java.security.interfaces.ECPublicKey; +import java.security.interfaces.XECPrivateKey; +import java.security.interfaces.XECPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.security.spec.NamedParameterSpec; +import java.util.Arrays; +import javax.crypto.KeyAgreement; +import javax.crypto.interfaces.DHPrivateKey; +import javax.crypto.interfaces.DHPublicKey; +import jdk.test.lib.Convert; + +public class KeySizeTest { + + public static void main(String[] args) throws Exception { + + String kaAlgo = args[0]; + String provider = args[1]; + String kpgAlgo = args[2]; + int keySize = Integer.parseInt(args[3]); + testKeyAgreement(provider, kaAlgo, kpgAlgo, keySize); + } + + /** + * Perform KeyAgreement operation. + */ + private static void testKeyAgreement(String provider, String kaAlgo, + String kpgAlgo, int keySize) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgo, provider); + kpg.initialize(keySize); + KeyPair kp = kpg.generateKeyPair(); + // Test standard Key attributes. + testKeyAttributes(provider, kpgAlgo, kp, keySize); + // Test KeyAgreement. + KeyAgreement ka = KeyAgreement.getInstance(kaAlgo, provider); + ka.init(kp.getPrivate()); + ka.doPhase(kp.getPublic(), true); + ka.generateSecret(); + } + + /** + * Test standard Key attributes. + */ + private static void testKeyAttributes(String provider, String kpgAlgo, + KeyPair kp, int keySize) throws Exception { + + KeyFactory kf = KeyFactory.getInstance(kpgAlgo, provider); + switch (kpgAlgo) { + case "DiffieHellman": + // Verify PrivateKey attributes. + DHPrivateKey dhPri = (DHPrivateKey) kp.getPrivate(); + BigInteger p = dhPri.getParams().getP(); + if (p.bitLength() != keySize) { + throw new Exception(String.format("Invalid modulus size: " + + "%s/%s", p.bitLength(), keySize)); + } + if (!p.isProbablePrime(128)) { + throw new Exception("The modulus is composite!"); + } + PKCS8EncodedKeySpec dhPriSpec + = new PKCS8EncodedKeySpec(dhPri.getEncoded()); + DHPrivateKey dhPriDecod + = (DHPrivateKey) kf.generatePrivate(dhPriSpec); + equals(dhPri.getX(), dhPriDecod.getX()); + equals(dhPri.getFormat(), dhPriDecod.getFormat()); + equals(dhPri.getEncoded(), dhPriDecod.getEncoded()); + equals(dhPri.getParams().getG(), dhPriDecod.getParams().getG()); + equals(dhPri.getParams().getL(), dhPriDecod.getParams().getL()); + equals(dhPri.getParams().getP(), dhPriDecod.getParams().getP()); + + // Verify PublicKey attributes. + DHPublicKey dhPub = (DHPublicKey) kp.getPublic(); + p = dhPub.getParams().getP(); + if (p.bitLength() != keySize) { + throw new Exception(String.format("Invalid modulus size: " + + "%s/%s", p.bitLength(), keySize)); + } + X509EncodedKeySpec dhPubSpec + = new X509EncodedKeySpec(dhPub.getEncoded()); + DHPublicKey dhPubDecod + = (DHPublicKey) kf.generatePublic(dhPubSpec); + equals(dhPub.getY(), dhPubDecod.getY()); + equals(dhPub.getFormat(), dhPubDecod.getFormat()); + equals(dhPub.getEncoded(), dhPubDecod.getEncoded()); + equals(dhPub.getParams().getG(), dhPubDecod.getParams().getG()); + equals(dhPub.getParams().getL(), dhPubDecod.getParams().getL()); + equals(dhPub.getParams().getP(), dhPubDecod.getParams().getP()); + + BigInteger left = BigInteger.ONE; + BigInteger right = p.subtract(BigInteger.ONE); + BigInteger x = dhPri.getX(); + if ((x.compareTo(left) <= 0) || (x.compareTo(right) >= 0)) { + throw new Exception( + "X outside range [2, p - 2]: x: " + x + " p: " + p); + } + BigInteger y = dhPub.getY(); + if ((y.compareTo(left) <= 0) || (y.compareTo(right) >= 0)) { + throw new Exception( + "Y outside range [2, p - 2]: x: " + x + " p: " + p); + } + break; + case "EC": + // Verify PrivateKey attributes. + ECPrivateKey ecPriv = (ECPrivateKey) kp.getPrivate(); + PKCS8EncodedKeySpec ecPriSpec + = new PKCS8EncodedKeySpec(ecPriv.getEncoded()); + ECPrivateKey ecPriDecod + = (ECPrivateKey) kf.generatePrivate(ecPriSpec); + equals(ecPriv.getS(), ecPriDecod.getS()); + equals(ecPriv.getFormat(), ecPriDecod.getFormat()); + equals(ecPriv.getEncoded(), ecPriDecod.getEncoded()); + equals(ecPriv.getParams().getCofactor(), + ecPriDecod.getParams().getCofactor()); + equals(ecPriv.getParams().getCurve(), + ecPriDecod.getParams().getCurve()); + equals(ecPriv.getParams().getGenerator(), + ecPriDecod.getParams().getGenerator()); + equals(ecPriv.getParams().getOrder(), + ecPriDecod.getParams().getOrder()); + + // Verify PublicKey attributes. + ECPublicKey ecPub = (ECPublicKey) kp.getPublic(); + X509EncodedKeySpec ecPubSpec + = new X509EncodedKeySpec(ecPub.getEncoded()); + ECPublicKey ecPubDecod + = (ECPublicKey) kf.generatePublic(ecPubSpec); + equals(ecPub.getW(), ecPubDecod.getW()); + equals(ecPub.getFormat(), ecPubDecod.getFormat()); + equals(ecPub.getEncoded(), ecPubDecod.getEncoded()); + equals(ecPub.getParams().getCofactor(), + ecPubDecod.getParams().getCofactor()); + equals(ecPub.getParams().getCurve(), + ecPubDecod.getParams().getCurve()); + equals(ecPub.getParams().getGenerator(), + ecPubDecod.getParams().getGenerator()); + equals(ecPub.getParams().getOrder(), + ecPubDecod.getParams().getOrder()); + break; + case "XDH": + // Verify PrivateKey attributes. + XECPrivateKey xdhPri = (XECPrivateKey) kp.getPrivate(); + PKCS8EncodedKeySpec xdhPriSpec + = new PKCS8EncodedKeySpec(xdhPri.getEncoded()); + XECPrivateKey xdhPriDec + = (XECPrivateKey) kf.generatePrivate(xdhPriSpec); + equals(xdhPri.getScalar().get(), xdhPriDec.getScalar().get()); + equals(xdhPri.getFormat(), xdhPriDec.getFormat()); + equals(xdhPri.getEncoded(), xdhPriDec.getEncoded()); + equals(((NamedParameterSpec) xdhPri.getParams()).getName(), + ((NamedParameterSpec) xdhPriDec.getParams()).getName()); + + // Verify PublicKey attributes. + XECPublicKey xdhPub = (XECPublicKey) kp.getPublic(); + X509EncodedKeySpec xdhPubSpec + = new X509EncodedKeySpec(xdhPub.getEncoded()); + XECPublicKey xdhPubDec + = (XECPublicKey) kf.generatePublic(xdhPubSpec); + equals(xdhPub.getU(), xdhPubDec.getU()); + equals(xdhPub.getFormat(), xdhPubDec.getFormat()); + equals(xdhPub.getEncoded(), xdhPubDec.getEncoded()); + equals(((NamedParameterSpec) xdhPub.getParams()).getName(), + ((NamedParameterSpec) xdhPubDec.getParams()).getName()); + break; + default: + throw new RuntimeException("Invalid Algo name " + kpgAlgo); + } + } + + private static boolean equals(Object actual, Object expected) { + boolean equals = actual.equals(expected); + if (!equals) { + throw new RuntimeException(String.format("Actual: %s, Expected: %s", + actual, expected)); + } + return equals; + } + + private static boolean equals(byte[] actual, byte[] expected) { + boolean equals = Arrays.equals(actual, expected); + if (!equals) { + throw new RuntimeException(String.format("Actual array: %s, " + + "Expected array:%s", Convert.byteArrayToHexString(actual), + Convert.byteArrayToHexString(expected))); + } + return equals; + } +} diff --git a/test/jdk/java/security/KeyAgreement/KeySpecTest.java b/test/jdk/java/security/KeyAgreement/KeySpecTest.java new file mode 100644 index 00000000000..1e8742dd796 --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/KeySpecTest.java @@ -0,0 +1,316 @@ +/* + * 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 + * @bug 8184359 + * @summary Standard tests on KeySpec, KeyFactory, KeyPairs and Keys. + * Arguments order <KeyExchangeAlgorithm> <Provider> <KeyGenAlgorithm> <Curve*> + * @run main KeySpecTest DiffieHellman SunJCE DiffieHellman + * @run main KeySpecTest ECDH SunEC EC + * @run main KeySpecTest XDH SunEC XDH X25519 + * @run main KeySpecTest XDH SunEC XDH X448 + */ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.ECPrivateKeySpec; +import java.security.spec.ECPublicKeySpec; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.security.spec.NamedParameterSpec; +import java.security.spec.XECPublicKeySpec; +import java.security.spec.XECPrivateKeySpec; +import java.security.spec.KeySpec; +import java.util.ArrayList; +import java.util.List; +import java.util.Arrays; +import javax.crypto.KeyAgreement; +import javax.crypto.spec.DHPrivateKeySpec; +import javax.crypto.spec.DHPublicKeySpec; + +public class KeySpecTest { + + public static void main(String[] args) throws Exception { + + String kaAlgo = args[0]; + String provider = args[1]; + String kpgAlgo = args[2]; + KeyPair kp = genKeyPair(provider, kpgAlgo, + (args.length > 3) ? args[3] : kpgAlgo); + testKeySpecs(provider, kaAlgo, kpgAlgo, kp); + testEncodedKeySpecs(provider, kaAlgo, kpgAlgo, kp); + } + + /** + * Generate keyPair based on KeyPairGenerator algorithm. + */ + private static KeyPair genKeyPair(String provider, String kpgAlgo, + String kpgInit) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgo, provider); + switch (kpgInit) { + case "DiffieHellman": + kpg.initialize(512); + break; + case "EC": + kpg.initialize(256); + break; + case "X25519": + kpg.initialize(255); + break; + case "X448": + kpg.initialize(448); + break; + default: + throw new RuntimeException("Invalid Algo name " + kpgInit); + } + return kpg.generateKeyPair(); + } + + /** + * Standard Test with Keys and the one generated through Spec. + */ + private static void testKeySpecs(String provider, String kaAlgo, + String kpgAlgo, KeyPair kp) throws Exception { + + KeyFactory kf = KeyFactory.getInstance(kpgAlgo, provider); + // For each public KeySpec supported by KeyPairGenerator + for (Class pubSpecType + : getCompatibleKeySpecs(kpgAlgo, KeyType.PUBLIC)) { + //For each private KeySpec supported by KeyPairGenerator + for (Class priSpecType + : getCompatibleKeySpecs(kpgAlgo, KeyType.PRIVATE)) { + // Transform original PublicKey through KeySpec + KeySpec pubSpec = kf.getKeySpec(kp.getPublic(), pubSpecType); + PublicKey pubKey = kf.generatePublic(pubSpec); + // Transform original PrivateKey through KeySpec + KeySpec priSpec = kf.getKeySpec(kp.getPrivate(), priSpecType); + PrivateKey priKey = kf.generatePrivate(priSpec); + + // Test the keys are equal after transformation through KeySpec. + testKeyEquals(kp, pubKey, priKey); + // Test the keys are serializable. + testSerialize(kp); + // Test Parameter name. + if (!kaAlgo.equals("DiffieHellman")) { + testParamName(priSpec, pubSpec); + } + // Compare KeyAgreement secret generated from original keys + // and by the keys after transformed through KeySpec. + if (!Arrays.equals(getKeyAgreementSecret(provider, kaAlgo, + kp.getPublic(), kp.getPrivate()), + getKeyAgreementSecret(provider, kaAlgo, + pubKey, priKey))) { + throw new RuntimeException("KeyAgreement secret mismatch."); + } + } + } + } + + /** + * Standard Test with Keys and the one generated from encoded bytes. + */ + private static void testEncodedKeySpecs(String provider, String kaAlgo, + String kpgAlgo, KeyPair kp) throws Exception { + + KeyFactory kf = KeyFactory.getInstance(kpgAlgo, provider); + PKCS8EncodedKeySpec priSpec + = new PKCS8EncodedKeySpec(kp.getPrivate().getEncoded()); + PrivateKey priKey = kf.generatePrivate(priSpec); + + X509EncodedKeySpec pubSpec + = new X509EncodedKeySpec(kp.getPublic().getEncoded()); + PublicKey pubKey = kf.generatePublic(pubSpec); + + // Test the keys are equal after transformation through KeySpec. + testKeyEquals(kp, pubKey, priKey); + // Test the keys are serializable. + testSerialize(kp); + // Test Parameter name. + if (!kaAlgo.equals("DiffieHellman")) { + testParamName(priSpec, pubSpec); + } + // Compare KeyAgreement secret generated from original keys + // and by the keys after transformed through KeySpec. + if (!Arrays.equals(getKeyAgreementSecret(provider, kaAlgo, + kp.getPublic(), kp.getPrivate()), + getKeyAgreementSecret(provider, kaAlgo, pubKey, priKey))) { + throw new RuntimeException("KeyAgreement secret mismatch."); + } + } + + private enum KeyType { + PUBLIC, PRIVATE; + } + + /** + * Provides Compatible KeySpec Type list for KeyPairGenerator algorithm. + */ + private static List<Class> getCompatibleKeySpecs(String kpgAlgo, + KeyType type) { + + List<Class> specs = new ArrayList<>(); + switch (kpgAlgo) { + case "DiffieHellman": + if (type == KeyType.PUBLIC) { + return Arrays.asList(X509EncodedKeySpec.class, + DHPublicKeySpec.class); + } else { + return Arrays.asList(PKCS8EncodedKeySpec.class, + DHPrivateKeySpec.class); + } + case "EC": + if (type == KeyType.PUBLIC) { + return Arrays.asList(X509EncodedKeySpec.class, + ECPublicKeySpec.class); + } else { + return Arrays.asList(PKCS8EncodedKeySpec.class, + ECPrivateKeySpec.class); + } + case "XDH": + if (type == KeyType.PUBLIC) { + return Arrays.asList(X509EncodedKeySpec.class, + XECPublicKeySpec.class); + } else { + return Arrays.asList(PKCS8EncodedKeySpec.class, + XECPrivateKeySpec.class); + } + } + return specs; + } + + /** + * Generate KeyAgreement Secret. + */ + private static byte[] getKeyAgreementSecret(String provider, String kaAlgo, + PublicKey pubKey, PrivateKey priKey) throws Exception { + + KeyAgreement ka = KeyAgreement.getInstance(kaAlgo, provider); + ka.init(priKey); + ka.doPhase(pubKey, true); + return ka.generateSecret(); + } + + /** + * Compare original KeyPair with transformed ones. + */ + private static void testKeyEquals(KeyPair kp, PublicKey pubKey, + PrivateKey priKey) { + + if (!kp.getPrivate().equals(priKey) + && kp.getPrivate().hashCode() != priKey.hashCode()) { + throw new RuntimeException("PrivateKey is not equal with PrivateKey" + + " generated through KeySpec"); + } + if (!kp.getPublic().equals(pubKey) + && kp.getPublic().hashCode() != pubKey.hashCode()) { + throw new RuntimeException("PublicKey is not equal with PublicKey" + + " generated through KeySpec"); + } + } + + /** + * Compare the parameter names of Public/Private KeySpec from a pair. + */ + private static void testParamName(KeySpec priSpec, KeySpec pubSpec) { + + if (priSpec instanceof XECPrivateKeySpec + && pubSpec instanceof XECPublicKeySpec) { + if (((NamedParameterSpec) ((XECPrivateKeySpec) priSpec) + .getParams()).getName() + != ((NamedParameterSpec) ((XECPublicKeySpec) pubSpec) + .getParams()).getName()) { + throw new RuntimeException("Curve name mismatch found"); + } + } + } + + /** + * Test serialization of KeyPair and Keys it holds. + */ + private static void testSerialize(KeyPair keyPair) throws Exception { + + // Verify Serialized PrivateKey instance. + if (!keyPair.getPrivate().equals( + deserializedCopy(keyPair.getPrivate(), PrivateKey.class))) { + throw new RuntimeException("PrivateKey is not equal with PrivateKey" + + " generated through Serialization"); + } + // Verify Serialized PublicKey instance. + if (!keyPair.getPublic().equals( + deserializedCopy(keyPair.getPublic(), PublicKey.class))) { + throw new RuntimeException("PublicKey is not equal with PublicKey" + + " generated through Serialization"); + } + // Verify Serialized KeyPair instance. + KeyPair copy = deserializedCopy(keyPair, KeyPair.class); + if (!keyPair.getPrivate().equals(copy.getPrivate())) { + throw new RuntimeException("PrivateKey is not equal with PrivateKey" + + " generated through Serialized KeyPair"); + } + if (!keyPair.getPublic().equals(copy.getPublic())) { + throw new RuntimeException("PublicKey is not equal with PublicKey" + + " generated through Serialized KeyPair"); + } + } + + private static <T extends Object> T deserializedCopy(T orig, Class<T> type) + throws IOException, ClassNotFoundException { + return deserialize(serialize(orig), type); + } + + /** + * Deserialize the Key object. + */ + private static <T extends Object> T deserialize(byte[] serialized, + Class<T> type) throws IOException, ClassNotFoundException { + + T key = null; + try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized); + ObjectInputStream ois = new ObjectInputStream(bis)) { + key = (T) ois.readObject(); + } + return key; + } + + /** + * Serialize the given Key object. + */ + private static <T extends Object> byte[] serialize(T key) + throws IOException { + + try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos)) { + oos.writeObject(key); + return bos.toByteArray(); + } + } +} diff --git a/test/jdk/java/security/KeyAgreement/MultiThreadTest.java b/test/jdk/java/security/KeyAgreement/MultiThreadTest.java new file mode 100644 index 00000000000..f53572a10b5 --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/MultiThreadTest.java @@ -0,0 +1,150 @@ +/* + * 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 + * @bug 8184359 + * @summary KeyPairGenerator Test with multiple threads. + * Arguments order <KeyExchangeAlgorithm> <Provider> <KeyGenAlgorithm> <Curve*> + * @run main MultiThreadTest DiffieHellman SunJCE DiffieHellman + * @run main MultiThreadTest ECDH SunEC EC + * @run main MultiThreadTest XDH SunEC XDH X25519 + * @run main MultiThreadTest XDH SunEC XDH X448 + */ +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.util.Arrays; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import javax.crypto.KeyAgreement; + +/** + * This test targets KeyPairGenerator API related issue in a multi threaded + * context. + */ +public class MultiThreadTest { + + // Tested a shared KeyPairGenerator with 100 number of threads. + private static final int THREAD_COUNT = 100; + + public static void main(String[] args) throws Exception { + + String kaAlgo = args[0]; + String provider = args[1]; + String kpgAlgo = args[2]; + KeyPairGenerator kpg = genKeyGenerator(provider, kpgAlgo, + (args.length > 3) ? args[3] : kpgAlgo); + new MultiThreadTest().runTest(provider, kaAlgo, kpg); + } + + /** + * Initialize KeyPairGenerator based on different algorithm names. + */ + private static KeyPairGenerator genKeyGenerator(String provider, + String kpgAlgo, String kpgInit) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgo, provider); + switch (kpgInit) { + case "DiffieHellman": + kpg.initialize(512); + break; + case "EC": + kpg.initialize(256); + break; + case "X25519": + kpg.initialize(255); + break; + case "X448": + kpg.initialize(448); + break; + default: + throw new RuntimeException("Invalid Algo name " + kpgInit); + } + return kpg; + } + + private void runTest(String provider, String kaAlgo, KeyPairGenerator kpg) + throws Exception { + + ExecutorService executor = null; + try { + executor = Executors.newCachedThreadPool(new ThreadFactory() { + @Override + public Thread newThread(Runnable r) { + Thread t = Executors.defaultThreadFactory().newThread(r); + t.setDaemon(true); + return t; + } + }); + CountDownLatch latch = new CountDownLatch(THREAD_COUNT); + + for (int i = 0; i < THREAD_COUNT; i++) { + executor.execute(new Runnable() { + @Override + public void run() { + try { + testKeyAgreement(provider, kaAlgo, kpg); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Indicate a task completed. + latch.countDown(); + } + } + }); + } + // Wait till all tasks get complete. + latch.await(); + } finally { + if (executor != null) { + executor.shutdown(); + } + } + } + + /** + * Perform KeyAgreement operation with a shared KeyPairGenerator instance. + */ + private static void testKeyAgreement(String provider, String kaAlgo, + KeyPairGenerator kpg) throws Exception { + + KeyPair kp1 = kpg.generateKeyPair(); + KeyPair kp2 = kpg.generateKeyPair(); + + KeyAgreement ka1 = KeyAgreement.getInstance(kaAlgo, provider); + ka1.init(kp1.getPrivate()); + ka1.doPhase(kp2.getPublic(), true); + byte[] secret1 = ka1.generateSecret(); + KeyAgreement ka2 = KeyAgreement.getInstance(kaAlgo, provider); + ka2.init(kp2.getPrivate()); + ka2.doPhase(kp1.getPublic(), true); + byte[] secret2 = ka2.generateSecret(); + + // With related keypairs, generated KeyAgreement secret should be same. + if (!Arrays.equals(secret1, secret2)) { + throw new Exception("KeyAgreement secret mismatch."); + } + } +} diff --git a/test/jdk/java/security/KeyAgreement/NegativeTest.java b/test/jdk/java/security/KeyAgreement/NegativeTest.java new file mode 100644 index 00000000000..2e797e1ac5c --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/NegativeTest.java @@ -0,0 +1,408 @@ +/* + * 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 + * @bug 8200219 + * @summary Negative tests for Key related Test with DiffieHellman, ECDH, XDH. + * It Tests, + * Use modified encoding while generating Public/Private Keys + * Short, long, unsupported keysize + * Invalid Algo names including Null + * Invalid provider names including Null + * Invalid curve names + * Invalid spec usage + * Arguments order <KeyExchangeAlgorithm> <Provider> <KeyGenAlgorithm> + * <keySize> <Curve*> + * @library /test/lib + * @build jdk.test.lib.Convert + * @run main NegativeTest DiffieHellman SunJCE DiffieHellman 1024 + * @run main NegativeTest ECDH SunEC EC 256 + * @run main NegativeTest XDH SunEC XDH 255 X25519 + * @run main NegativeTest XDH SunEC XDH 448 X448 + */ +import java.math.BigInteger; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidParameterException; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.Security; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.NamedParameterSpec; +import java.security.spec.KeySpec; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.security.spec.XECPrivateKeySpec; +import java.security.spec.XECPublicKeySpec; +import java.util.Arrays; +import javax.crypto.KeyAgreement; +import jdk.test.lib.Convert; + +public class NegativeTest { + + public static void main(String[] args) throws Exception { + + String kaAlgo = args[0]; + String provider = args[1]; + String kpgAlgo = args[2]; + int keySize = Integer.parseInt(args[3]); + String kpgInit = (args.length > 4) ? args[4] : args[2]; + testModifiedKeyEncodingTest(provider, kpgAlgo, kpgInit); + testInvalidKeyLen(provider, kaAlgo, kpgAlgo, kpgInit); + testInvalidKpgAlgo(provider, kaAlgo, keySize); + testInvalidKaAlgo(provider, kpgAlgo, keySize); + testInvalidProvider(kaAlgo, kpgAlgo, keySize); + if (!kaAlgo.equals("DiffieHellman")) { + testNamedParameter(provider, kpgAlgo); + } + if (kaAlgo.equals("XDH")) { + testInvalidSpec(provider, kpgAlgo, kpgInit); + testInCompatibleSpec(provider, kpgAlgo, kpgInit); + } + } + + /** + * Generate keyPair based on KeyPairGenerator algorithm. + */ + private static KeyPair genKeyPair(String provider, String kpgAlgo, + String kpgInit) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgo, + Security.getProvider(provider)); + switch (kpgInit) { + case "DiffieHellman": + kpg.initialize(512); + break; + case "EC": + kpg.initialize(256); + break; + case "X25519": + kpg.initialize(255); + break; + case "X448": + kpg.initialize(448); + break; + default: + throw new RuntimeException("Invalid Algo name " + kpgInit); + } + return kpg.generateKeyPair(); + } + + private static void testModifiedKeyEncodingTest(String provider, + String kpgAlgo, String kpgInit) throws Exception { + + KeyFactory kf = KeyFactory.getInstance(kpgAlgo, provider); + KeyPair kp = genKeyPair(provider, kpgAlgo, kpgInit); + // Test modified PrivateKey encoding + byte[] encoded = kp.getPrivate().getEncoded(); + byte[] modified = modifyEncoded(encoded); + PKCS8EncodedKeySpec priSpec = new PKCS8EncodedKeySpec(modified); + try { + // Generate PrivateKey with modified encoding + kf.generatePrivate(priSpec); + throw new RuntimeException( + "testModifiedKeyTest should fail but passed."); + } catch (InvalidKeySpecException e) { + System.out.printf("Expected InvalidKeySpecException for invalid " + + "PrivateKey %s%n and modified encoding: %s, %s%n", + Convert.byteArrayToHexString(encoded), + Convert.byteArrayToHexString(modified), e.getMessage()); + } + // Test modified PublicKey encoding + encoded = kp.getPublic().getEncoded(); + modified = modifyEncoded(encoded); + X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(modified); + try { + // Generate PublicKey with modified encoding + kf.generatePublic(pubSpec); + throw new RuntimeException( + "testModifiedKeyTest should fail but passed."); + } catch (InvalidKeySpecException e) { + System.out.printf("Expected InvalidKeySpecException for invalid " + + "PublicKey %s%n and modified encoding: %s, %s%n", + Convert.byteArrayToHexString(encoded), + Convert.byteArrayToHexString(modified), e.getMessage()); + } + } + + /** + * Test with all Invalid key length. + */ + private static void testInvalidKeyLen(String provider, String kaAlgo, + String kpgAlgo, String kpgInit) throws Exception { + + for (int keySize : selectInvalidKeylength(kpgInit)) { + try { + startKeyAgreement(provider, kaAlgo, kpgAlgo, keySize); + throw new RuntimeException( + "testInvalidKeyLen should fail but passed."); + } catch (InvalidParameterException e) { + System.out.printf("Expected InvalidParameterException for " + + "keyLength: %s, %s%n", keySize, e.getMessage()); + } + } + } + + /** + * Test with all Invalid KeyPairGenerator algorithms. + */ + private static void testInvalidKpgAlgo(String provider, String algo, + int keySize) throws Exception { + + for (String kpgAlgo : new String[]{null, " ", "", "NoSuchAlgorithm"}) { + try { + startKeyAgreement(provider, algo, kpgAlgo, keySize); + throw new RuntimeException( + "testInvalidKpgAlgo should fail but passed."); + } catch (NoSuchAlgorithmException e) { + System.out.printf("Expected NoSuchAlgorithmException for " + + "KeyAgreement algo: %s, %s%n", + kpgAlgo, e.getMessage()); + } catch (NullPointerException e) { + if (kpgAlgo == null) { + System.out.printf("Expected NullPointerException for " + + "KeyPairGenerator algo: %s, %s%n", + kpgAlgo, e.getMessage()); + continue; + } + throw new RuntimeException( + "Unknown failure in testInvalidKpgAlgo."); + } + } + } + + /** + * Test with all Invalid KeyAgreement algorithms. + */ + private static void testInvalidKaAlgo(String provider, String kpgAlgo, + int keySize) throws Exception { + + for (String algo : new String[]{null, " ", "", "NoSuchAlgorithm"}) { + try { + startKeyAgreement(provider, algo, kpgAlgo, keySize); + throw new RuntimeException( + "testInvalidKaAlgo should fail but passed."); + } catch (NoSuchAlgorithmException e) { + System.out.printf("Expected NoSuchAlgorithmException for " + + "KeyAgreement algo: %s, %s%n", algo, e.getMessage()); + } catch (NullPointerException e) { + if (algo == null) { + System.out.printf("Expected NullPointerException for " + + "KeyAgreement algo: %s, %s%n", + algo, e.getMessage()); + continue; + } + throw new RuntimeException( + "Unknown failure in testInvalidKaAlgo."); + } + } + } + + /** + * Test with all Invalid Provider names. + */ + private static void testInvalidProvider(String kaAlgo, String kpgAlgo, + int keySize) throws Exception { + + for (String provider : new String[]{null, " ", "", "NoSuchProvider"}) { + try { + startKeyAgreement(provider, kaAlgo, kpgAlgo, keySize); + throw new RuntimeException( + "testInvalidProvider should fail but passed."); + } catch (NoSuchProviderException e) { + System.out.printf("Expected NoSuchProviderException for " + + "Provider: %s, %s%n", provider, e.getMessage()); + } catch (IllegalArgumentException e) { + System.out.printf("Expected IllegalArgumentException for " + + "Provider: %s, %s%n", provider, e.getMessage()); + } + } + } + + /** + * Test for (in)valid curve names as argument to NamedParameterSpec + */ + private static void testNamedParameter(String provider, String kpgAlgo) + throws Exception { + + for (String name : new String[]{null, " ", "", "NoSuchCurve"}) { + try { + NamedParameterSpec spec = new NamedParameterSpec(name); + KeyPairGenerator kpg + = KeyPairGenerator.getInstance(kpgAlgo, provider); + kpg.initialize(spec); + kpg.generateKeyPair(); + throw new RuntimeException( + "testNamedParameter should fail but passed."); + } catch (NullPointerException e) { + if (name == null) { + System.out.printf("Expected NullPointerException for " + + "NamedParameterSpec name: %s, %s%n", + name, e.getMessage()); + continue; + } + throw new RuntimeException( + "Unknown failure in testNamedParameter."); + } catch (InvalidAlgorithmParameterException e) { + System.out.printf("Expected InvalidAlgorithmParameterException" + + " for NamedParameterSpec name: %s, %s%n", + name, e.getMessage()); + } + } + } + + /** + * Test to generate Public/Private keys using (in)valid coordinate/scalar. + */ + private static void testInvalidSpec(String provider, + String kpgAlgo, String curve) throws Exception { + + NamedParameterSpec spec = new NamedParameterSpec(curve); + KeyFactory kf = KeyFactory.getInstance(kpgAlgo, provider); + int validLen = curve.equalsIgnoreCase("X448") ? 56 : 32; + for (byte[] scalarBytes : new byte[][]{null, new byte[]{}, + new byte[32], new byte[56], new byte[65535]}) { + try { + KeySpec privateSpec = new XECPrivateKeySpec(spec, scalarBytes); + kf.generatePrivate(privateSpec); + if (scalarBytes.length != validLen) { + throw new RuntimeException(String.format("testInvalidSpec " + + "should fail but passed when Scalar bytes length " + + "!= %s for curve %s", validLen, curve)); + } + } catch (NullPointerException e) { + if (scalarBytes == null) { + System.out.printf("Expected NullPointerException for " + + "scalar: %s, %s%n", scalarBytes, e.getMessage()); + continue; + } + throw new RuntimeException(e); + } catch (InvalidKeySpecException e) { + if (scalarBytes.length != validLen) { + System.out.printf("Expected InvalidKeySpecException for " + + "scalar length %s and curve %s: %s%n", + scalarBytes.length, curve, e.getMessage()); + continue; + } + throw new RuntimeException(e); + } + } + for (BigInteger coordinate : new BigInteger[]{null, BigInteger.ZERO, + BigInteger.ONE, new BigInteger("2").pow(255), + new BigInteger("2").pow(448)}) { + try { + KeySpec publicSpec = new XECPublicKeySpec(spec, coordinate); + kf.generatePublic(publicSpec); + } catch (NullPointerException e) { + if (coordinate == null) { + System.out.printf("Expected NullPointerException for " + + "coordinate : %s, %s%n", coordinate, + e.getMessage()); + continue; + } + throw new RuntimeException(e); + } + } + } + + private static void testInCompatibleSpec(String provider, + String kpgAlgo, String curve) throws Exception { + + int validLen = curve.equalsIgnoreCase("X448") ? 56 : 32; + NamedParameterSpec spec = new NamedParameterSpec(curve); + KeyFactory kf = KeyFactory.getInstance(kpgAlgo, provider); + KeySpec privateSpec = new XECPrivateKeySpec(spec, new byte[validLen]); + KeySpec publicSpec = new XECPublicKeySpec(spec, BigInteger.ONE); + try { + kf.generatePrivate(publicSpec); + throw new RuntimeException( + "testInCompatibleSpec should fail but passed."); + } catch (InvalidKeySpecException e) { + System.out.printf("Expected XECPublicKeySpec to XECPrivateKeySpec :" + + " %s%n", e.getMessage()); + } + try { + kf.generatePublic(privateSpec); + throw new RuntimeException( + "testInCompatibleSpec should fail but passed."); + } catch (InvalidKeySpecException e) { + System.out.printf("Expected XECPrivateKeySpec to XECPublicKeySpec :" + + " %s%n", e.getMessage()); + } + } + + /** + * Perform KeyAgreement operation. + */ + private static void startKeyAgreement(String provider, String kaAlgo, + String kpgAlgo, int keySize) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgo, provider); + kpg.initialize(keySize); + KeyPair kp = kpg.generateKeyPair(); + KeyAgreement ka = KeyAgreement.getInstance(kaAlgo, provider); + ka.init(kp.getPrivate()); + ka.doPhase(kp.getPublic(), true); + ka.generateSecret(); + } + + /** + * Return manipulated encoded bytes. + */ + private static byte[] modifyEncoded(byte[] encoded) { + + byte[] copy = Arrays.copyOf(encoded, encoded.length); + for (int i = 0; i < copy.length; i++) { + copy[i] = (byte) ~copy[i]; + } + return copy; + } + + /** + * Select invalid key sizes for different Key generation algorithms. + */ + private static int[] selectInvalidKeylength(String kpgInit) { + + int[] keySize = new int[]{}; + switch (kpgInit) { + case "DiffieHellman": + keySize = new int[]{256, 513, 1023, 2176, 4032, 6400, 8200}; + break; + case "EC": + keySize = new int[]{100, 300}; + break; + case "X25519": + keySize = new int[]{100, 300}; + break; + case "X448": + keySize = new int[]{100, 500}; + break; + default: + throw new RuntimeException("Invalid Algo name " + kpgInit); + } + return keySize; + } +} diff --git a/test/jdk/sun/security/ec/xec/TestXDH.java b/test/jdk/sun/security/ec/xec/TestXDH.java new file mode 100644 index 00000000000..135a469cba3 --- /dev/null +++ b/test/jdk/sun/security/ec/xec/TestXDH.java @@ -0,0 +1,490 @@ +/* + * 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 + * @bug 8171277 + * @summary Test XDH key agreement + * @library /test/lib + * @build jdk.test.lib.Convert + * @run main TestXDH + */ + +import java.security.*; +import java.security.spec.*; +import javax.crypto.*; +import java.util.Arrays; +import java.math.BigInteger; +import jdk.test.lib.Convert; + +public class TestXDH { + + public static void main(String[] args) throws Exception { + + runBasicTests(); + runKAT(); + runSmallOrderTest(); + runNonCanonicalTest(); + runCurveMixTest(); + } + + private static void runBasicTests() throws Exception { + runBasicTest("XDH", null); + runBasicTest("XDH", 255); + runBasicTest("XDH", 448); + runBasicTest("XDH", "X25519"); + runBasicTest("XDH", "X448"); + runBasicTest("X25519", null); + runBasicTest("X448", null); + runBasicTest("1.3.101.110", null); + runBasicTest("1.3.101.111", null); + runBasicTest("OID.1.3.101.110", null); + runBasicTest("OID.1.3.101.111", null); + } + + private static void runBasicTest(String name, Object param) + throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(name); + if (param instanceof Integer) { + kpg.initialize((Integer) param); + } else if (param instanceof String) { + kpg.initialize(new NamedParameterSpec((String) param)); + } + KeyPair kp = kpg.generateKeyPair(); + + KeyAgreement ka = KeyAgreement.getInstance(name); + ka.init(kp.getPrivate()); + ka.doPhase(kp.getPublic(), true); + + byte[] secret = ka.generateSecret(); + + KeyFactory kf = KeyFactory.getInstance(name); + // Test with X509 and PKCS8 key specs + X509EncodedKeySpec pubSpec = + kf.getKeySpec(kp.getPublic(), X509EncodedKeySpec.class); + PKCS8EncodedKeySpec priSpec = + kf.getKeySpec(kp.getPrivate(), PKCS8EncodedKeySpec.class); + + PublicKey pubKey = kf.generatePublic(pubSpec); + PrivateKey priKey = kf.generatePrivate(priSpec); + + ka.init(priKey); + ka.doPhase(pubKey, true); + byte[] secret2 = ka.generateSecret(); + if (!Arrays.equals(secret, secret2)) { + throw new RuntimeException("Arrays not equal"); + } + + // test with XDH key specs + XECPublicKeySpec xdhPublic = + kf.getKeySpec(kp.getPublic(), XECPublicKeySpec.class); + XECPrivateKeySpec xdhPrivate = + kf.getKeySpec(kp.getPrivate(), XECPrivateKeySpec.class); + PublicKey pubKey2 = kf.generatePublic(xdhPublic); + PrivateKey priKey2 = kf.generatePrivate(xdhPrivate); + ka.init(priKey2); + ka.doPhase(pubKey2, true); + byte[] secret3 = ka.generateSecret(); + if (!Arrays.equals(secret, secret3)) { + throw new RuntimeException("Arrays not equal"); + } + } + + private static void runSmallOrderTest() throws Exception { + // Ensure that small-order points are rejected + + // X25519 + // 0 + testSmallOrder( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000"); + // 1 and -1 + testSmallOrder( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "0100000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000"); + testSmallOrder( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f", + "0000000000000000000000000000000000000000000000000000000000000000"); + + // order 8 points + testSmallOrder( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f1157", + "0000000000000000000000000000000000000000000000000000000000000000"); + testSmallOrder( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800", + "0000000000000000000000000000000000000000000000000000000000000000"); + + // X448 + // 0 + testSmallOrder( + "X448", + "9A8F4925D1519F5775CF46B04B5800D4EE9EE8BAE8BC5565D498C28DD9C9BA" + + "F574A9419744897391006382A6F127AB1D9AC2D8C0A598726B", + "00000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000"); + // 1 and -1 + testSmallOrder( + "X448", + "9A8F4925D1519F5775CF46B04B5800D4EE9EE8BAE8BC5565D498C28DD9C9BA" + + "F574A9419744897391006382A6F127AB1D9AC2D8C0A598726B", + "01000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000"); + testSmallOrder( + "X448", + "9A8F4925D1519F5775CF46B04B5800D4EE9EE8BAE8BC5565D498C28DD9C9BAF" + + "574A9419744897391006382A6F127AB1D9AC2D8C0A598726B", + "fefffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff" + + "fffffffffffffffffffffffffffffffffffffffffffffffff", + "000000000000000000000000000000000000000000000000000000000000000" + + "0000000000000000000000000000000000000000000000000"); + } + + private static void testSmallOrder(String name, String a_pri, + String b_pub, String result) throws Exception { + + try { + runDiffieHellmanTest(name, a_pri, b_pub, result); + } catch (InvalidKeyException ex) { + return; + } + + throw new RuntimeException("No exception on small-order point"); + } + + private static void runNonCanonicalTest() throws Exception { + // Test non-canonical values + + // high bit of public key set + // X25519 + runDiffieHellmanTest( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "DE9EDB7D7B7DC1B4D35B61C2ECE435373F8343C85B78674DADFC7E146F882B8F", + "954e472439316f118ae158b65619eecff9e6bcf51ab29add66f3fd088681e233"); + + runDiffieHellmanTest( + "302e020100300706032b656e0500042077076d0a7318a57d3c16c17251b266" + + "45df4c2f87ebc0992ab177fba51db92c2a", + "302c300706032b656e0500032100de9edb7d7b7dc1b4d35b61c2ece435373f" + + "8343c85b78674dadfc7e146f882b8f", + "954e472439316f118ae158b65619eecff9e6bcf51ab29add66f3fd088681e233"); + + // large public key + + // X25519 + // public key value is 2^255-2 + runDiffieHellmanTest( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F", + "81a02a45014594332261085128959869fc0540c6b12380f51db4b41380de2c2c"); + + runDiffieHellmanTest( + "302e020100300706032b656e0500042077076d0a7318a57d3c16c17251b266" + + "45df4c2f87ebc0992ab177fba51db92c2a", + "302c300706032b656e0500032100FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + + "FFFFFFFFFFFFFFFFFFFFFFFFFFFF7F", + "81a02a45014594332261085128959869fc0540c6b12380f51db4b41380de2c2c"); + + // X448 + // public key value is 2^448-2 + runDiffieHellmanTest( + "X448", + "9A8F4925D1519F5775CF46B04B5800D4EE9EE8BAE8BC5565D498C28DD9C9BA" + + "F574A9419744897391006382A6F127AB1D9AC2D8C0A598726B", + "FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", + "66e2e682b1f8e68c809f1bb3e406bd826921d9c1a5bfbfcbab7ae72feecee6" + + "3660eabd54934f3382061d17607f581a90bdac917a064959fb"); + + runDiffieHellmanTest( + "3046020100300706032B656F050004389A8F4925D1519F5775CF46B04B5800" + + "D4EE9EE8BAE8BC5565D498C28DD9C9BAF574A9419744897391006382A6F127" + + "AB1D9AC2D8C0A598726B", + "3044300706032B656F0500033900FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + + "FFFFFFFFFFFFFFFF", + "66e2e682b1f8e68c809f1bb3e406bd826921d9c1a5bfbfcbab7ae72feecee6" + + "3660eabd54934f3382061d17607f581a90bdac917a064959fb"); + + } + + private static void runKAT() throws Exception { + // Test both sides of the key exchange using vectors in RFC 7748 + + // X25519 + // raw + runDiffieHellmanTest( + "X25519", + "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", + "DE9EDB7D7B7DC1B4D35B61C2ECE435373F8343C85B78674DADFC7E146F882B4F", + "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742"); + + runDiffieHellmanTest( + "X25519", + "5DAB087E624A8A4B79E17F8B83800EE66F3BB1292618B6FD1C2F8B27FF88E0EB", + "8520F0098930A754748B7DDCB43EF75A0DBF3A0D26381AF4EBA4A98EAA9B4E6A", + "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742"); + + // encoded + runDiffieHellmanTest( + "302E020100300706032B656E0500042077076D0A7318A57D3C16C17251B266" + + "45DF4C2F87EBC0992AB177FBA51DB92C2A", + "302C300706032B656E0500032100DE9EDB7D7B7DC1B4D35B61C2ECE435373F" + + "8343C85B78674DADFC7E146F882B4F", + "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742"); + + runDiffieHellmanTest( + "302E020100300706032B656E050004205DAB087E624A8A4B79E17F8B83800E" + + "E66F3BB1292618B6FD1C2F8B27FF88E0EB", + "302C300706032B656E05000321008520F0098930A754748B7DDCB43EF75A0D" + + "BF3A0D26381AF4EBA4A98EAA9B4E6A", + "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742"); + + // X448 + //raw + runDiffieHellmanTest( + "X448", + "9A8F4925D1519F5775CF46B04B5800D4EE9EE8BAE8BC5565D498C28DD9C9BA" + + "F574A9419744897391006382A6F127AB1D9AC2D8C0A598726B", + "3EB7A829B0CD20F5BCFC0B599B6FECCF6DA4627107BDB0D4F345B43027D8B9" + + "72FC3E34FB4232A13CA706DCB57AEC3DAE07BDC1C67BF33609", + "07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b" + + "56fd2464c335543936521c24403085d59a449a5037514a879d"); + + runDiffieHellmanTest( + "X448", + "1C306A7AC2A0E2E0990B294470CBA339E6453772B075811D8FAD0D1D6927C1" + + "20BB5EE8972B0D3E21374C9C921B09D1B0366F10B65173992D", + "9B08F7CC31B7E3E67D22D5AEA121074A273BD2B83DE09C63FAA73D2C22C5D9" + + "BBC836647241D953D40C5B12DA88120D53177F80E532C41FA0", + "07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b" + + "56fd2464c335543936521c24403085d59a449a5037514a879d"); + + //encoded + runDiffieHellmanTest( + "3046020100300706032B656F050004389A8F4925D1519F5775CF46B04B5800" + + "D4EE9EE8BAE8BC5565D498C28DD9C9BAF574A9419744897391006382A6F127" + + "AB1D9AC2D8C0A598726B", + "3044300706032B656F05000339003EB7A829B0CD20F5BCFC0B599B6FECCF6D" + + "A4627107BDB0D4F345B43027D8B972FC3E34FB4232A13CA706DCB57AEC3DAE" + + "07BDC1C67BF33609", + "07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b" + + "56fd2464c335543936521c24403085d59a449a5037514a879d"); + + runDiffieHellmanTest( + "3046020100300706032B656F050004381C306A7AC2A0E2E0990B294470CBA3" + + "39E6453772B075811D8FAD0D1D6927C120BB5EE8972B0D3E21374C9C921B09" + + "D1B0366F10B65173992D", + "3044300706032B656F05000339009B08F7CC31B7E3E67D22D5AEA121074A27" + + "3BD2B83DE09C63FAA73D2C22C5D9BBC836647241D953D40C5B12DA88120D53" + + "177F80E532C41FA0", + "07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b" + + "56fd2464c335543936521c24403085d59a449a5037514a879d"); + } + + private static void runDiffieHellmanTest(String a_pri, + String b_pub, String result) throws Exception { + + KeyFactory kf = KeyFactory.getInstance("XDH"); + byte[] a_pri_ba = Convert.hexStringToByteArray(a_pri); + KeySpec privateSpec = new PKCS8EncodedKeySpec(a_pri_ba); + PrivateKey privateKey = kf.generatePrivate(privateSpec); + byte[] b_pub_ba = Convert.hexStringToByteArray(b_pub); + KeySpec publicSpec = new X509EncodedKeySpec(b_pub_ba); + PublicKey publicKey = kf.generatePublic(publicSpec); + + KeyAgreement ka = KeyAgreement.getInstance("XDH"); + ka.init(privateKey); + ka.doPhase(publicKey, true); + + byte[] sharedSecret = ka.generateSecret(); + byte[] expectedResult = Convert.hexStringToByteArray(result); + if (!Arrays.equals(sharedSecret, expectedResult)) { + throw new RuntimeException("fail: expected=" + result + ", actual=" + + Convert.byteArrayToHexString(sharedSecret)); + } + + } + + private static void runDiffieHellmanTest(String curveName, String a_pri, + String b_pub, String result) throws Exception { + + NamedParameterSpec paramSpec = new NamedParameterSpec(curveName); + KeyFactory kf = KeyFactory.getInstance("XDH"); + KeySpec privateSpec = new XECPrivateKeySpec(paramSpec, + Convert.hexStringToByteArray(a_pri)); + PrivateKey privateKey = kf.generatePrivate(privateSpec); + boolean clearHighBit = curveName.equals("X25519"); + KeySpec publicSpec = new XECPublicKeySpec(paramSpec, + Convert.hexStringToBigInteger(clearHighBit, b_pub)); + PublicKey publicKey = kf.generatePublic(publicSpec); + + byte[] encodedPrivateKey = privateKey.getEncoded(); + System.out.println("Encoded private: " + + Convert.byteArrayToHexString(encodedPrivateKey)); + byte[] encodedPublicKey = publicKey.getEncoded(); + System.out.println("Encoded public: " + + Convert.byteArrayToHexString(encodedPublicKey)); + + KeyAgreement ka = KeyAgreement.getInstance("XDH"); + ka.init(privateKey); + ka.doPhase(publicKey, true); + + byte[] sharedSecret = ka.generateSecret(); + byte[] expectedResult = Convert.hexStringToByteArray(result); + if (!Arrays.equals(sharedSecret, expectedResult)) { + throw new RuntimeException("fail: expected=" + result + ", actual=" + + Convert.byteArrayToHexString(sharedSecret)); + } + } + + /* + * Ensure that SunEC rejects parameters/points for the wrong curve + * when the algorithm ID for a specific curve is specified. + */ + private static void runCurveMixTest() throws Exception { + runCurveMixTest("SunEC", "X25519", 448); + runCurveMixTest("SunEC", "X25519", "X448"); + runCurveMixTest("SunEC", "X448", 255); + runCurveMixTest("SunEC", "X448", "X25519"); + } + + private static void runCurveMixTest(String providerName, String name, + Object param) throws Exception { + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(name, + providerName); + + try { + if (param instanceof Integer) { + kpg.initialize((Integer) param); + } else if (param instanceof String) { + kpg.initialize(new NamedParameterSpec((String) param)); + } + throw new RuntimeException(name + " KeyPairGenerator accepted " + + param.toString() + " parameters"); + } catch (InvalidParameterException ex) { + // expected + } + + // the rest of the test uses the parameter as an algorithm name to + // produce keys + if (param instanceof Integer) { + return; + } + String otherName = (String) param; + KeyPairGenerator otherKpg = KeyPairGenerator.getInstance(otherName, + providerName); + KeyPair otherKp = otherKpg.generateKeyPair(); + + // ensure the KeyFactory rejects incorrect keys + KeyFactory kf = KeyFactory.getInstance(name, providerName); + try { + kf.getKeySpec(otherKp.getPublic(), XECPublicKeySpec.class); + throw new RuntimeException(name + " KeyFactory accepted " + + param.toString() + " key"); + } catch (InvalidKeySpecException ex) { + // expected + } + try { + kf.getKeySpec(otherKp.getPrivate(), XECPrivateKeySpec.class); + throw new RuntimeException(name + " KeyFactory accepted " + + param.toString() + " key"); + } catch (InvalidKeySpecException ex) { + // expected + } + + try { + kf.translateKey(otherKp.getPublic()); + throw new RuntimeException(name + " KeyFactory accepted " + + param.toString() + " key"); + } catch (InvalidKeyException ex) { + // expected + } + try { + kf.translateKey(otherKp.getPrivate()); + throw new RuntimeException(name + " KeyFactory accepted " + + param.toString() + " key"); + } catch (InvalidKeyException ex) { + // expected + } + + KeyFactory otherKf = KeyFactory.getInstance(otherName, providerName); + XECPublicKeySpec otherPubSpec = otherKf.getKeySpec(otherKp.getPublic(), + XECPublicKeySpec.class); + try { + kf.generatePublic(otherPubSpec); + throw new RuntimeException(name + " KeyFactory accepted " + + param.toString() + " key"); + } catch (InvalidKeySpecException ex) { + // expected + } + XECPrivateKeySpec otherPriSpec = + otherKf.getKeySpec(otherKp.getPrivate(), XECPrivateKeySpec.class); + try { + kf.generatePrivate(otherPriSpec); + throw new RuntimeException(name + " KeyFactory accepted " + + param.toString() + " key"); + } catch (InvalidKeySpecException ex) { + // expected + } + + // ensure the KeyAgreement rejects incorrect keys + KeyAgreement ka = KeyAgreement.getInstance(name, providerName); + try { + ka.init(otherKp.getPrivate()); + throw new RuntimeException(name + " KeyAgreement accepted " + + param.toString() + " key"); + } catch (InvalidKeyException ex) { + // expected + } + KeyPair kp = kpg.generateKeyPair(); + ka.init(kp.getPrivate()); + try { + // This should always be rejected because it doesn't match the key + // passed to init, but it is tested here for good measure. + ka.doPhase(otherKp.getPublic(), true); + throw new RuntimeException(name + " KeyAgreement accepted " + + param.toString() + " key"); + } catch (InvalidKeyException ex) { + // expected + } + } +} + diff --git a/test/jdk/sun/security/ec/xec/TestXECOps.java b/test/jdk/sun/security/ec/xec/TestXECOps.java new file mode 100644 index 00000000000..58f175391df --- /dev/null +++ b/test/jdk/sun/security/ec/xec/TestXECOps.java @@ -0,0 +1,130 @@ +/* + * 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 + * @bug 8171277 + * @summary Test XEC curve operations + * @modules jdk.crypto.ec/sun.security.ec + * @library /test/lib + * @build jdk.test.lib.Convert + * @run main TestXECOps + */ + +import sun.security.ec.*; +import java.util.*; +import jdk.test.lib.Convert; + +// Test vectors are from RFC 7748 + +public class TestXECOps { + + public static void main(String[] args) { + TestXECOps m = new TestXECOps(); + + m.runTest("X25519", + "a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4", + "e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c", + "c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552"); + + m.runTest("X25519", + "4b66e9d4d1b4673c5ad22691957d6af5c11b6421e0ea01d42ca4169e7918ba0d", + "e5210f12786811d3f4b7959d0538ae2c31dbe7106fc03c3efc4cd549c715a493", + "95cbde9476e8907d7aade45cb4b873f88b595a68799fa152e6f8f7647aac7957"); + + m.runDiffieHellmanTest("X25519", + "77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a", + "5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb", + "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742"); + + + m.runTest("X448", + "3d262fddf9ec8e88495266fea19a34d28882acef045104d0d1aae121700a77" + + "9c984c24f8cdd78fbff44943eba368f54b29259a4f1c600ad3", + "06fce640fa3487bfda5f6cf2d5263f8aad88334cbd07437f020f08f9814dc0" + + "31ddbdc38c19c6da2583fa5429db94ada18aa7a7fb4ef8a086", + "ce3e4ff95a60dc6697da1db1d85e6afbdf79b50a2412d7546d5f239fe14fba" + + "adeb445fc66a01b0779d98223961111e21766282f73dd96b6f"); + + m.runTest("X448", + "203d494428b8399352665ddca42f9de8fef600908e0d461cb021f8c538345d" + + "d77c3e4806e25f46d3315c44e0a5b4371282dd2c8d5be3095f", + "0fbcc2f993cd56d3305b0b7d9e55d4c1a8fb5dbb52f8e9a1e9b6201b165d01" + + "5894e56c4d3570bee52fe205e28a78b91cdfbde71ce8d157db", + "884a02576239ff7a2f2f63b2db6a9ff37047ac13568e1e30fe63c4a7ad1b3e" + + "e3a5700df34321d62077e63633c575c1c954514e99da7c179d"); + + m.runDiffieHellmanTest("X448", + "9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28dd9c9ba" + + "f574a9419744897391006382a6f127ab1d9ac2d8c0a598726b", + "1c306a7ac2a0e2e0990b294470cba339e6453772b075811d8fad0d1d6927c1" + + "20bb5ee8972b0d3e21374c9c921b09d1b0366f10b65173992d", + "07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b" + + "56fd2464c335543936521c24403085d59a449a5037514a879d"); + } + + private void runDiffieHellmanTest(String opName, String a_str, + String b_str, String result_str) { + + XECParameters settings = XECParameters.getByName(opName).get(); + XECOperations ops = new XECOperations(settings); + + byte[] basePoint = Convert.byteToByteArray(settings.getBasePoint(), + settings.getBytes()); + byte[] a = Convert.hexStringToByteArray(a_str); + byte[] b = Convert.hexStringToByteArray(b_str); + byte[] expectedResult = Convert.hexStringToByteArray(result_str); + + byte[] a_copy = Arrays.copyOf(a, a.length); + byte[] b_copy = Arrays.copyOf(b, b.length); + byte[] basePoint_copy = Arrays.copyOf(basePoint, basePoint.length); + + byte[] resultA = ops.encodedPointMultiply(b, + ops.encodedPointMultiply(a, basePoint)); + byte[] resultB = ops.encodedPointMultiply(a_copy, + ops.encodedPointMultiply(b_copy, basePoint_copy)); + if (!Arrays.equals(resultA, expectedResult)) { + throw new RuntimeException("fail"); + } + if (!Arrays.equals(resultB, expectedResult)) { + throw new RuntimeException("fail"); + } + } + + private void runTest(String opName, String k_in_str, + String u_in_str, String u_out_str) { + + byte[] k_in = Convert.hexStringToByteArray(k_in_str); + byte[] u_in = Convert.hexStringToByteArray(u_in_str); + byte[] u_out_expected = Convert.hexStringToByteArray(u_out_str); + + XECParameters settings = XECParameters.getByName(opName).get(); + XECOperations ops = new XECOperations(settings); + byte[] u_out = ops.encodedPointMultiply(k_in, u_in); + + if (!Arrays.equals(u_out, u_out_expected)) { + throw new RuntimeException("fail"); + } + } +} + diff --git a/test/jdk/sun/security/ec/xec/X25519.iter b/test/jdk/sun/security/ec/xec/X25519.iter new file mode 100644 index 00000000000..239b2cb0cb1 --- /dev/null +++ b/test/jdk/sun/security/ec/xec/X25519.iter @@ -0,0 +1,2002 @@ +0,k,0900000000000000000000000000000000000000000000000000000000000000 +0,u,0900000000000000000000000000000000000000000000000000000000000000 +1000,k,684CF59BA83309552800EF566F2F4D3C1C3887C49360E3875F2EB94D99532C51 +1000,u,E4BA7DF230E7574D397D88E1E18069D405DD71C6A286086DDA6CC54D04F69A18 +2000,k,DBAF93A66BBE098551040FBEA14B5FF3EF4DF696F1A55BB44749265DCDF5DE3D +2000,u,2611734027FED424184FAC583DAFDA42CB089655DE50C84BB703EC8E98A50B10 +3000,k,CE14DEA80A92A944C215915A4ABEE253B2FBA7ED7874EBB0AF34F903D397BA33 +3000,u,1BCC668626936CCBE8890F4442EDF3FEC2A72E7689B4C00075C6BB102321F647 +4000,k,1A8C16163A394975E98CAA730CDEF215778684AC3D19A249D4487B1763A97B49 +4000,u,D50599172794263E7D35A3096867074042C643D82F2A835476A75F1387FE8E5E +5000,k,90ACA1C8DAB080CCCF82D3E972F2DBAC319E1A1424A77852A8B57A5957458353 +5000,u,29C4B177223CB60BA995EE2F5E3E556DEFE3D79743FE2D83B2ADA17DA1B85D1A +6000,k,BCFF817ACA4621993B9927C2E6F8FE9C2A292842001DACFAE358CC47A40B166D +6000,u,18D50EF8C25F117F4A5B54282FA52BB4C76BDAAF9E7B175EA4B21C22219BD74E +7000,k,7087B0343D6A878E498541516BA953EF83D956A2FE25D54F792FCEDDD52C1365 +7000,u,C7B11D99ADA1E5C9F49BE5728BB67CF6A29095DB6B1588D9E6D6FF8DA0AD5757 +8000,k,1D94A1C031421A883CE8767563946FEA343806D035B1705DC042BB2068A29311 +8000,u,5CC6ED6699ECFCD97D1C7198F828431AAB8AF1DBF628A5F7959B384AC01EE75C +9000,k,AF982B810595122705E73AFE142C16946C74FB2DB13E46AB928A0F431049612B +9000,u,7CDFFBCA7286187233C7D62ACE0FD09500595197D309E2DA7F324D767955A263 +10000,k,2C125A20F639D504A7703D2E223C79A79DE48C4EE8C23379AA19A62ECD211815 +10000,u,6ACC9309A5CC14E183DC85DC8C836A0CA2877A753AFBBDE0CF93A86303EA4E7C +11000,k,C4E6F26C29C5B0EBB6AF8424B52A3A344D4CC1C88688BE30DE470C8365D4F172 +11000,u,C6164460467B405E3070F0875C5CFFFB0B2EA45C35D7180F6B50AEBDE9E4A833 +12000,k,5E4B725BFE2E1D9B28DD63C94EF4316E0BD8E573265929716F2AD2A1224A7E60 +12000,u,FFE119058D2C17DBB54A62ACB2019C3F979D0093FAABE9C13512D272F04FBE3D +13000,k,C89B8104D3A34752054FF5388CA29D16F774FAAD089F7F420D3DE3580C82852E +13000,u,5269E0A26661DB2BBFD5617E1C69F38DC01D5668E8D19C08AFD36ADAA07FB911 +14000,k,83D255FAEFD850EC7DA5472607250FEC1E2ABAD0B155E7C7472E5F5F23556A3A +14000,u,0A7D73FFDA2AA9B986A07A1823BA412F5ACFBF1D01E3DA7E93502ACE5D862264 +15000,k,EA0E0194B81C833B2DCBC095837E38C5F73EE9E6A628DDDECBB441894B299E7E +15000,u,9F5BA6574A39F46D0912910D03D38279A511591A7D788F185A1915A77AFD0723 +16000,k,05E8938C734A5A17D1B61902C98C5DAFEB1A380489DE253B83B2626DEEDD7325 +16000,u,D5DA6049A9CA1DA64BC5239AD53BD3D20489EB9427CF8628E95C44BC6FF20162 +17000,k,C2EF62DF60959AB818E24FAFAFDF986206EB70C236973E3F2FAFD176CFDFDB32 +17000,u,AD41989C464001732C8840784264DCA13081035F2AA6D06059A0EDA14D486644 +18000,k,26B58D28F6E5320C09EE471A68EFDD0EF48DB378B776DD2D337567ED6405073A +18000,u,24061DBCB41E42A82BAF92EA526CE28B9B33E71C9825C014397DF6791C28EE01 +19000,k,825251693275AE5E523743061C31AACBFB90A17CD206DF1AE3D07DE11D031C32 +19000,u,697305DDB3C2A15C5255BCE0E59CD203FE274DA8FF9EDD9D0E0E4EEFEFD95240 +20000,k,D4AB9827C52324822CC439FFA27107B9824569EBCFAC15BD490F732F90E0B13A +20000,u,7072DDE149F9852704AFF14D64E438B89D6C00724E524D8FB31B6EE11079667F +21000,k,1A5111535180DF903E723CBD64C7C960AC3491F6BA0620E0283395FE60AC9F0B +21000,u,E77127E3657A4989BBDE6D7D923304AF58B3DD3DE376542D5D88835BF2DB6104 +22000,k,CC18D1C57D0E7FD8B8F977FF1BDBCD957FF9CA0FC87635A5ABF39DFFF6D7D538 +22000,u,C8C16D8086D4EC46AB4E198672050DA1D7CE645031F8FCD76313181BAB66844C +23000,k,FA716F22996C9B1ABF7B0F5511289198B32CBA05266BC684B3B73EFEE9272A6F +23000,u,566812D78EC7B648CCAF21FA36C1553B2672A5E66E5F233BF2D69E1BB84ADB03 +24000,k,460C0430698422EF91D1E66DF4812F3F561B5539D453DEE0DDB97D00E143CD7F +24000,u,94F86BC176145A4CA1774B12398956D1B3926C46FC3992808B564CA9531CFB1B +25000,k,3D2318858E8F4068C51BE1FF0BCF7752BEE04E91D147597B4FF3AAC2301EFB3A +25000,u,1F6F66591E2D5ED239E1CB94EBE39D4118757D1355394519700F6CD47DF53826 +26000,k,D10C565CF35C183381EA9F2FA7DC953A517970F63401D79F979A47FA38B0DD28 +26000,u,1E3D11E601614D5472352133CF684560FF9962CBF88911B5D439E2A00D8D9807 +27000,k,D736F4E57270CA7C88B89BD351EF603AC6036D43303BBAA81D252A484380DF02 +27000,u,9FAD30E3B3DD8A1818B8698D219B6E81641BADDD3B614F0610AA11DB01C55F06 +28000,k,40C4E27F8C31E513B16B105DB6D565DE590B2CEEEF1D461B3807C38F100C0C45 +28000,u,C1ABD6DCD238F50ECD656561C6154148C6B5B40D99C0584FDEA6872BC6F8A935 +29000,k,E04C7CEE2145E25B828048995C9EEEA93739524ADDF2269D915BAB8CD31E352D +29000,u,A48DFE1499ACB3EEF428BC538401C697BC8EBFA213786A9D028D9182309C2C09 +30000,k,7BEC00362BE91E93D3157888A7A69D6AAF56DCD31703C64629C07FE1CAD6A769 +30000,u,3A8E96AA2FBF376E8E84437E6AE29721485866E92AA2011D5E7857BBF2E7714B +31000,k,B2AD33A0062E8B0210FD0B9466C4E69855C42DA8CDEB51839FFB205C247FF810 +31000,u,12E3A58CED72FF896678ED067911979871F01FC0F825BF50303CB7B893680B46 +32000,k,7767AD25FB29AB74585C798383911A1AB8EABA96CFD2B7C49CF38DF75631E565 +32000,u,1DBCB69D897C2DF04413529BDD1ED957D3FE3C09DC0B7BDC935541A99E4C9A35 +33000,k,E0D9BB103F2C311AC1A12D657AE48EC995048EDE3617332FD588932ACA7ECD7A +33000,u,6422DEB8AFBE10C82C1BD59DE5A1C008E7C7788AC1586A836E48C232A8FAF97B +34000,k,47ED96A302CC9026F63907308A4701195B5205C936E90F605003C648546C1774 +34000,u,29DD859788D2D5C9C0B9EC4DB787DC499711D3A0E15F487F45AC59216865324F +35000,k,53C4039E42479CA8F4325363C5E6D001C38F6644598EE89E4A001B1EB987480D +35000,u,049F7707038BD7ED081DE2BFA476B27AFFA96F6CE68DF3B30BCBBB164E77632A +36000,k,57776ECD6439E18A904A4B6E499AE12D80B3CA0C18B3C98B4647768FC7190D0A +36000,u,016F35C5C89F01BAC3217222CB37AA21297282A2AF647209A48CC1233D37044D +37000,k,6F322C979C44EAF6713912F64EA3DCCCFB96A7E56CA8FF377272D6BA1C4CD418 +37000,u,C2D59C3BD6F85E5C28C585478B778EAAE2F3E700BB5248AC09BA3FA811B7EF2C +38000,k,99E258131078603922C705C6CE9F731C3CDF51F41F838A2DDD771FDF13B30B1A +38000,u,F6CB3493075223B49ECB18BAEB16267CE34E8BC9189FC705DFEB8746329FB25C +39000,k,9DAE24C03BC0D602166608E9E71AA3059601660DDBBA2577920EB345AB8EF354 +39000,u,247C4617ACC6434F7CB3A0CB6B6202F0CFEEC6A2F157B3EAFD4B813418DD206A +40000,k,3355456F77EADB57CF1A4B5ACFCDC04079CDAA25A780E4CF49F4B5A1EE97A476 +40000,u,46BDE8169C0079FB6B39288CF3F07FFD9AD2D0A3B3DB0DD83C7C6666168AAC15 +41000,k,6E6ED2B1FF4F0D4C3BCC146767398517A3A6B5A1B0ECEE9509DD38407C725716 +41000,u,230FAE801154F9035FC6641902F14B7CA06095975D0A3148F685A7F804E94C6C +42000,k,55E911DC3BD54AA3F1CA6065CF8D25C7D07C9E4FB4BAA8CFDF4D4F33C81BF74F +42000,u,07D4BDA4DB042EE7BD1BE3BA823CD90C49AED986AB667FAA5B0BE3B76DFA3B0D +43000,k,CF19918515842FEB774E685671157A3F9DE4794FA96F89EFF954C6D1AAB2981B +43000,u,9DE722697FD40F7C74DE44BB85C22C78E475D4A9B38F98A6C5AD245CCF28DB7D +44000,k,CCA2BE3CC8E1A01F6533D847C99843E18FCAF9CD0EB9605C46B5481DB0376207 +44000,u,3BF0A66E59F277F721D052C400CC798271D521B69880F94A7EFED33624B02D78 +45000,k,3182A4666FB1A70281792F98B829F2FD7C40379833536EFA6F513FD2EEC8760B +45000,u,0BAC348AD6A7DACC520822D23038333B1108FE76B7C7782B5616A8F1251E047A +46000,k,5CDD71E8BB2F7542566C6E42CD45E3E7CDB9238BAA4E96461E1F5C9B035F1405 +46000,u,B11D53A0DD18B2FF5A5AB0082F8471809B996E8565BF4B61D4AFF141EE2F1D47 +47000,k,69DBFBD1FAD63A15D34F3CABD5B4CBF42AA9C29F3D27A1CD2C568BB5E6E39559 +47000,u,852F7F6A41413ABA1E0188FD328988F952BBA7298023B8BEBD3233329F23AE46 +48000,k,A2A6184A1DEC235A4D1A1795C8BA0E8C186C2335D67A75973868CAD11EEC363B +48000,u,89F441E56333107CDFDEC5DE38FB31DBA5A7C5FC59961838CA5B50A0DE659F4A +49000,k,D827CA567E6ED98E761823A8E02DF2C03A3CB403F27DE427A424338C6866497A +49000,u,4E9B5A2E2031EA4D964CB8BE0617CC0F669B6D528D199EC48FF1E6314A5E996C +50000,k,1670488F039B8DE4310A4D66AC713C9A59FE4E1375E38BED432D5AC232A18676 +50000,u,7FD865D809E8E47F308C68BCCBF2CA9451EAF49319CCB2FE362C83FC5C11C743 +51000,k,41D9A07A8A2E9B403F8577C67565EF6DAD4862ED0FE8469B8742185EE333F377 +51000,u,A07535E8BC108A135C0CC9441CD38F44DB89A24B66A5C8396713401F2F60545A +52000,k,594D0199A47A45A2F447D722053E2DE8B30E1A234EDF3AB56F7721787F5B3E68 +52000,u,D686D468AA9BC461CED3864E3E99694B9C893BF421AA31771FB3F811E0A2E863 +53000,k,39015CBF722FC40E4C4174C0E2D3010A5D844E8747F7034674EF4F6DB36D860E +53000,u,B6F96213A32591B26EE7E925C578513A82146FDD756A18904E2F223F63908433 +54000,k,E7B84E0ADBB5FDD8CBB7C3760DD7B3A239424E74DCCF3BD3EEDE8E834D69F707 +54000,u,55EDAF4587E8F64B8F47A74490D4E1B3F51F62904C8EFB1E8C0154CBB3F8FC12 +55000,k,5E308C20E59BF534312A6814290009CB38FBC2A3E5B9CE0133FCD4F23EC8457B +55000,u,125E06B78416F05664E7896BF9A0DE40D2B49A04B537D220E8FF3209FB1E0169 +56000,k,AA3B9ABBD0CEEEA33BC20999556C5CA45D4C564FBCEFBF98F20BFF4D8DBF8970 +56000,u,F2481EC74E6D93358EB0F260412437B282AB035DD34465DE88A19D8929E93254 +57000,k,D90BF9BB2DCCBDDD1AC55CE7B09590EE45C54C0B55C9A9F5BC18232E7759D80C +57000,u,8DB1286CACAEF34FB19CBA7068265B4E2DE6C90B0DB98C5DA4695AAA9FAA864F +58000,k,AD9D880CE60264C715AF696A389D609C64C27AC064F58631F4C2165E5FB8E62F +58000,u,852BD6F572E7A828DD777E7A423FBAB25E1F32DFC9603852A2CD2ED7C714735B +59000,k,24A2E5BE4F1D2908984E62D324EAAFC748C3B339C9DB893C40261C515109A815 +59000,u,917CFB5DE8258C989ECA0F1C47D35ED93F6D5ED7CD82E1A963E3A7F5E1499802 +60000,k,C3837E8A9EBDB1CB53A8A22B5E0813AF948692FD0B6E12CBA8DE6720DA31752A +60000,u,5226429B3505C6763B97F95F4DD4668400FD754D0471569190596D8E4B963274 +61000,k,1A8B466BAD74C0BD61FD40604692364BF6F80F70611E10939888B63917AD690F +61000,u,DCB93232378B30CD996536D385DC196248D2A2F232E6148A1827C399ECBEAB32 +62000,k,7729594689384016C678A1C2776A7C9BAD1BFB448FEECE549707570B011D7E25 +62000,u,E13406D64DEAD6EA75DF3BCC869A7C83A12A502237BD858AB4C31740FD2CCB63 +63000,k,D6A2B9E6BEEA5DBA89552480C4CC25B3CDA8F160DFBC2D01DE92D4F61D36DC46 +63000,u,6026354144B74F2DDD52D0B5C64629F1929A0B6E261F5D9D915CD8BB98F9301A +64000,k,0944798F67950748E231EA78285E5D43C6034B557A6486288400DD83CC840521 +64000,u,4359D36946AF525931B37A61895521644F14655299EDEF22E92BD15E20BEA11A +65000,k,512454D18396A744612E61F6AE4F0642ADBF34BB1A727037B489A51ACB3F396C +65000,u,4B102C3615964024B50FBAA5884D5876312AD60F02681B2E892B1B83315BCC3E +66000,k,BDB47EF6BF2DAF2985B8D22F767EEBCD8B91E6C9B27FF23FEDE528E412B22A6D +66000,u,970028923DA15BD75DF19D435A93C771A6FDBE18890652AD5DF968731FCABA35 +67000,k,75991576E82058347E0FEC4AEB319D40929CBB3200C859D7B5C2BD9ED0DD383D +67000,u,EDFBA1B230E802C2FAE53E8B8A3FCAE8D739330BE8811E56EFB3BE85D4256F02 +68000,k,2A965836CEBB7138008A470393B2F37C635326B7E8DF7DB894114E19E294E905 +68000,u,48A66EBBF1F0030E0B98C9E9E56B4CCB2D35477B7E4B6055BE3448004BF0921F +69000,k,99C080CB7CBF4E803284083EE02623045535671367E5E6DB170C4C9FDF07605A +69000,u,BA3AED98D637D99FBE6BB03CEA6AF9D29ED3D7EFE7245A9CDD43B689CB2A3C5D +70000,k,56B5FE84D2432D649C00A5E1CB2F7CDAC2E4C2754D49EB80AA77E239838BBA23 +70000,u,20D0B187CDC6B97247422E9349BD155EC5BD55CDC992BAEA60225704626C0D77 +71000,k,8E4BC06B142D5F4438655CA2944777DE7A06F10B0FC31EC36716825EB678C50E +71000,u,DAE1AC0DAC80364B7960F03155B3A5B81885F2DAADA89CBB1BE894AEF48D4C34 +72000,k,1515A390FAC8B37ABA600D62D93465F57AF80D4D2A64F8AF4BBE46EC7C14682D +72000,u,BCECEC2B80CC74393D2640DD3C6E92A003E78626D919BBF25B3D9153B5DF2277 +73000,k,2190845A178A117D4A13C9192B047C1DA399DA826E60BB732DC16CBB2020E655 +73000,u,F64E9CB66BADB712E1FA219E7E3A281E896A0B0EB4AC53F205CAEC180A079418 +74000,k,C218BBBE5E6783E43B82E8354602E2A852E217AFECF701686345F62662204F18 +74000,u,2E85BC5F3D20F40567B04113E3309F49A0E8CF9FB9EC5A4BBA328D74A82C6131 +75000,k,3456B940880EAE561031ECCF0516495434BC02C77F641C308C1F5D8ED0FBB813 +75000,u,874435971C8EF0565B4CDA5690F8306601E67DCC09CE216FACEEB00C0393FE71 +76000,k,ECED5E21BB7AC4B719176FAFDE65E90727C46E6B422758D3FEB97B15BEE3152B +76000,u,BF0D98ABE680D1781EE51B16A1BDA5F1A99DABD1963C9CACB803552023174511 +77000,k,6D9F2384CE504DF4B67E2394958F087FDEE070F5C73671FA4A1E1AD8704BCA5B +77000,u,1C3CC7713907E9FC8EACF48676A131B9DCF79DF3CA56EA72EC231C570C030D2D +78000,k,61F7389E665FA57DF529BE08D958CABA6E1FF730BA93FC5D5F677BD60487BD4A +78000,u,10F8F735D23AEAE9DE83F324D54A9C0CA030A9E6D1A3754C4905E993060AC03F +79000,k,1087F8B7CD345164943CA995A895321B9F47D97D26A3BC321AE652ECDA81433B +79000,u,5C1DE67529C3A145433436054493E17C164E984A4AFEB24A4DB21BF70FD02B62 +80000,k,D82E9FAE3F6F9F8674AB20C5D1FF204A2F39E3F46BC6F3D6E0299E6EF4A0707D +80000,u,B7C9D2D56B9D1B692164EE82CDC06E22FCA56C50CC506704D63F51F36191283C +81000,k,7022A6DAC0EC0B8157BD7BBFC4B5639B026E139C88D0BC10F9D336BF58628E0D +81000,u,6923B80BA00181C79A5DFAF2E30EC396BEDB210BE92D812451F824652D937A1D +82000,k,4CB8CDAE80A8A63EE6024A44A965CE414AC343F11F102BEEB9FBCB950358227A +82000,u,6D3166CA1F6703DA0C181D873F87542D7BD3863AEA1AB826F54738C64A495918 +83000,k,64F3B4892DAEA7F237FEB9233DB504BCCB5C3F696BB8997D74DA7A6636646D58 +83000,u,A0DBBB2F53FD4EC76E9C2B845EE5C41BF615BD9B8D5B9D230F4FB696D56A320B +84000,k,B66E2B87B30A4DBD803D7E6CF27C80981D149FBBB4A6489147AB93F362825553 +84000,u,2FA45E24D13781E79AC25D33EF9878206D904E8A36A9E6B5EA652C81589DD233 +85000,k,E8961108853C11B6428C5B7C7DDD94E80F5A752ABE0658CB31A1A7B3437DAD6F +85000,u,B0CACF772890B6428C23406D2228CAE171BCFA5F0696BAC6AED0594E52993468 +86000,k,47854F1CB0C9582CD0FC903B282F597BFD2347A26F74C35CAFEB727F84F81A6F +86000,u,9C7ED575787C1D9882070AC3B8374575BEC33B06ECD9DBE835811BDDA0EB7734 +87000,k,E127EF63813FE0BAB0BE7DCF57EF0DC8CF22750257A56F726105761B5400752C +87000,u,252BFDDC3E61903F9EED3110543B3BE8D48E3C8378C67687CD132A55D924C45C +88000,k,C238456092AA788B80DB0B49F676834496386B5E101B7C9DC52394658887E933 +88000,u,098D844AF222CB5D7455A3326FE96B74B837E4BE8E478F7D66E3D89EC6EEE862 +89000,k,F71BED16476B1C0142BEE96EA28C4C4531E7ED5E17294BB8C36D329D93CC8509 +89000,u,AAF8E47856A9070D4DBBFBE8BB2532355459EC649AD9BD5A9FCACD829ED1E20D +90000,k,594BFC44E59E093EAFF191B2213FFBEECC11B86F3A99D6BBBF6E7B04C83FFC75 +90000,u,5C9A9489F64832D4C465456FEFFF545F4B06A5E36BE2EB9DA0431772DF6E976C +91000,k,2C4565F3EAB68E93A9D88AE17C8CF82B7AAAB88D184867CD9B0BA3D6DCA0A859 +91000,u,784BCD70F52645C190EDB095822F549DD01C08266F6BB18C0E6EF90B9F376D7D +92000,k,E130D55CA100A809423C6B07AA43BD32906BB102CD7915AE16541055CDF3571D +92000,u,31E2BE333664769E33BFD323802F35C4DA50DA4771BD55171E1820E0AACCE32F +93000,k,7B7CA1DE6ED5883776F5D7D23C701259B505643CA73F8FC37E1BFBA3E1E4C31A +93000,u,C0064E1F4E6937BB6E15F440DE8D6518FCFAC0BBC83520448116E69EF68C4503 +94000,k,672D6157F57429E734B62655F89FDA8FECAFAF8FD680B640289499F473E2947D +94000,u,DC9693725D7C27D78518BDC9C1DB31120C6BC147AE4A92153E99B54A53277001 +95000,k,20E324148EDE19A6CB1FE79854EADF81CC893D3E3CFCCB7F5210142CAFBF6844 +95000,u,EAC38B042F246C33DBDC5341F6ACA985C6F4138ABD4D0DA88BE33F7C17BF4F5E +96000,k,1B6DD33A4D7A442B2EFC86365165DEEE48440952EA4628F1FECAC54244039440 +96000,u,1BE7ABA79AF1695F66109CD06C652B8420AD3F8C7F112946A871297DC8EE3F63 +97000,k,9EC88ADD1BD17C1F5DD0F8D66404118EFABC040E9FCBE3D0C2C80B6C5471D25B +97000,u,09F48BDD69F68D59DBEA177101DC79BEA438C4259BB278D302D8B052A3EF0766 +98000,k,F683B4432899A130C3E2537EBB5F51DF4AA9E76923B474FDA07C41CDA2CC904D +98000,u,A9C1CC5918F4408B9600AE466CCF20722E7D7D3B47E62D1A2ED19748A7422737 +99000,k,6A9CC95849379F9AF97A8B52FACBBCAA77FC668562B3BEDE487B20893F72164B +99000,u,ED755781CE6E4C143F82C4CD16EBB38D162E6C1515D7CE89598038682D2FBD77 +100000,k,58698A8C126B120405697D7B449257F249ED4EBD8B3E5478FBF6A23C7FF17529 +100000,u,BC41FCED43BC8050CBAC264C413175B97D043CF9D1477A2F18BBC36687E2276E +101000,k,55AEDFE326A5379114FE47098DBFEE50CD2E4E2910E91ACEC9475C1EB396E308 +101000,u,84C93CBCF7BD1177DFAC136C02E9E6D540EC9EEFE7FD94263AA33F7F55EA2B46 +102000,k,6BB209724357F641A9886EFC1ACE0415D5FA9C654813BD927EAF48E5BBE2774A +102000,u,C2A880B8B0DEDD2787DAAB8405D367C5C66BCF894DB63F7DC080B70450737C29 +103000,k,7CFFFD12304E346E8F319E6162E0A56D6130460FF813DC257FF8663011FFB47D +103000,u,EB5D06A20250A56E6DCF4E54A24D07A8D32A9320F4C9DD0ED2E7CC7F49F4616C +104000,k,609CF91D0A5CE81547841A179139363B294C73246AB53CD3B3660BFBE6BFE034 +104000,u,0547D6694F9ABE2E41B443877ED990A24E7C3D4175A39A6ECC76790DAE3BAF62 +105000,k,F62E7D6A3A0DCF3F467F48E3565C411B2C00CB237BDC4668947C74D96627B946 +105000,u,F9DDFACC6AA93188BD504E244F82C674562EF5B581652BE909AA35DDCC511F3B +106000,k,0A469CDB734D596639BE93B22C83EBA52FB36C806AEDB80422ECE12079B3B267 +106000,u,8F2AEC9EBCCF282EAAE270E58F1F579B31DA7ACD82FF31981F21180CD352EE39 +107000,k,3CC78899D528A6830FB9695D9CC0022A6821277441EF3856999A9F5D6AF32945 +107000,u,6293AA53092A584E9179CD86DE39B211ED91C1EF69815D2C49897CCE29AA8A46 +108000,k,CD48CCBB30F2B321DEA5A52C473C5A2D94E4E8FF6308554CFDFB66C8CB4FA763 +108000,u,3F96C469F3EC2BC8F48C32CF0BF7D4B5C8C2163FC6C8B4DEE9D51BA3EEC07A75 +109000,k,746C4EFED958D0FBAA152F32CE89D47DD50FDA699E82D4EBFDC6E46E85471826 +109000,u,71672B4EA648790C0C589762F7C7A2572D1273C8655B986DCB498665DE737249 +110000,k,68480BDCA4BB97143D2804CDFE243620ACA83D607E2A72BF7255E9F2764E9C7C +110000,u,104677450A3032E0AF7BF084AB136C85EE5E93A77A739BCBA0D3839AF5D26932 +111000,k,FE32B2A585878493698AA22EDB898886A1BBAE16A2C10289401FCF9A6DB4FD5E +111000,u,F7B6427BA2A9F2D68B8BBA42C1FBD4A36C8CF751933A9078D8999EC8BDDFCC51 +112000,k,BB1B056873C344D1A982BB5AE4AAD767B685011CC287D0FC38209108C6CA5411 +112000,u,3D3A3680D0A71E0D5A14006CE3751C8CCC6E570C9D35FDF9135A3AF19126406B +113000,k,CC4C65C17F2BB2F1C14AE066E7A88E8A0B6F2C545E1FEB83584B7DDD2B49271C +113000,u,69D7469C45C868B6E1A4B1F3734C43062D8EE327C87A36D349CC22C62C8C3936 +114000,k,067D9D282CC76CE93B6EEFC112DFB2398767B48CB4B67AC64983D3D538A4EF02 +114000,u,9CAD8BD8D5AE41EF5B80C4E7204B1361DEB2F38274448FB3D1CF6937B538991E +115000,k,4E86F6383BFB01313FF84239F2CD491DFBEF54E9F8EE9B59BEC8568E5D2B3745 +115000,u,7713F87A23E8FB4EAE836FBB7750A458786BE32EE421046A42852ADC27F3F528 +116000,k,99B8CE336C718B92F068E34A928326689679B99DD871DB290E46D6F283FAA477 +116000,u,66E221AABEC4CB843490ADA04C64D6AE7ECF9D70AF5DCBE925B4ABA978CEC44A +117000,k,04858FA45AAA5E806B5044256B7A3F274DDF7CB4AB0A2FD46D4F874525359B07 +117000,u,D55B0AC9DA95A3A53D3418CB3F4235794FA84C27F913052060FF300BEA55094C +118000,k,4447483E3E8AB2942ECADEDA0362F2BA548FD847DE27141403A742DB7DD1FA74 +118000,u,BE748636C3AC0D450F77B179B0E0E4FC7503FC4BB42B656438A21102808EB572 +119000,k,EB2F125BF60C320BA40361B39F29BBE400CF0B56275623C380516C20EF9B6E34 +119000,u,0DC627AC6957198E36D54A9E7381D4D3688DFE569BB05078C6B3AEAAD77A1933 +120000,k,A80BAC80AD01B888638BB60F3003DA6C10A9322658C35F346A7DA119EFA4835C +120000,u,5D36DC34AF3BE11813C062D58FEE11170696D8B661D361201C5A0E354254EE56 +121000,k,37AD1CF225DDFAD78EB120E48F948C4F3C138EECDE19603FC6BFBD7F43EFAE44 +121000,u,6831D37A6A9CA32FEA2C18E308AFC9B69AD55C1463A1B41A8BBA86B2293E5031 +122000,k,CF44E1B7F425CCC2BFFFA7492027AFD092252D9BB39523DBE2FC1331117DCD48 +122000,u,311F3D85BEA8C0E7E89E075C52DAB1A20AE481E084C1C672742D70A82E0F786E +123000,k,43E7585E535250D2A5C93FC737CDA0436501A51FE924E932E82A80A3CCE79B7D +123000,u,BF377A17F4EF16059655608D37EBE25A6B2FB44BA2260A53DCF306842F2D555F +124000,k,189938D1A9F248A436BC1F1BC2737CCA88DA3281BC7ACF332CED6BA4F9A8E201 +124000,u,C96DC9A4A9607EC18E1208265F3C260EC1369FEEBBF8BD575D7305804918B917 +125000,k,DA7A1454EF8295172F03A6AB5E0EA745DE89FEC2A87773FA111AE6D5C874031C +125000,u,DA21AB9B27A62786F42F73E0691C5B69410543F1046C32E0298721ED0F15740F +126000,k,D23B20FA3B55ED567C9F91537D5F977C53E903A1C17BA848BADFBDE787CD3D24 +126000,u,99E457C31EE73FE0B60C9BD87427A0FB05B701DAAC2386B1E98AFDF78D8E6B35 +127000,k,53E93FDB40D098BAEC38D6FD8C15DB6ACC49ED12C49203BD10EBAD71D7231B7D +127000,u,7015D4D3A25593F6AD8B78B8AAB1469BB7A88A9089F06950D9760C9567723C5A +128000,k,FA4CBE819FAE3575C171DE481DDC2F0C1655A697E62CD749EB294A3C610E9654 +128000,u,767CA68A655003AC61368B0F6536AF7AA2F54D7DFD0F0F15EBE9E904CD851F34 +129000,k,4AE8A2782CC60EBC8A9B8A3BA58BC6CADF9567CEB181691F17C4FCA1D96FF61C +129000,u,B1D1CBF6630293D2C081B4955CB6D9D7F66E83B18DC22E8532F18F856D890254 +130000,k,365038A918BF7F3F7DD69B4008A2941BF49EDD1BA0C8F7E515AEFA0CD1432D3B +130000,u,06D73DB1698379FB6AEA47B9B7E3D9345D94C2DAA8BE54E0B8736053CBB62472 +131000,k,C87433D70696372F30B52C2172A7276EFBD470B2DB5C990B3C59201F2D56C846 +131000,u,229D3BC617A05427B4C4A8EE302EB7AECC45BDE970E168AF259C8F41A48DD13C +132000,k,0300FFE1CEFB30928F76C84113429D319C355DC951C24B5DA6AB8F4638BFE715 +132000,u,255F174A918B217A945C14794CC8768C0A887FBC26AB8EDB00FB4D16006AE628 +133000,k,C72D083EED37B4CBCC1D44C88CC101435BF8D62306B470547B62B655C034AE12 +133000,u,6FCD28026F826E193CBF91F65DBE05D32FB4D6CAEEA7501DD06404C76D6EDA34 +134000,k,D3C83AB32A36FB102B5A69FAEBAC206D287455CCC9BEB8FB84E577CB68A7903F +134000,u,18B1DDD20A52D0D1EBDF973917A174FA5DEEF591E445F2A322ACD121FBDCF07D +135000,k,A19B2BD57C79280FF6C677B2C01293B74BAE28CE0F39111402D412EF8D8E1226 +135000,u,24FD05876ACDB84C83EE4DA01AFBE82B935AE626721619120FB3DAE27F5E1676 +136000,k,2CFF8F105327CA38C1E0E364DA33335D50D7981937C8F11C9A4AC9D23A687E2A +136000,u,01DDC5347D77E5D3783E8035F285C7270A7E74582C6251A36D67EAA54DBCE67C +137000,k,7DA2BB0A5F6E2E1A044BDDF91CF5FB9708BC3C3A9E311847986125242DB83449 +137000,u,643C29608F0CAFF1A4FA3B05C011B9C6479C50A464A53179D969427D0170B774 +138000,k,D2294682F8A23B639F37672237C64F428566986BCE635ED9208120A7EE463823 +138000,u,184B968EDE1B5096BFF612F672693C4916C238FA36F56FEE9D4A31BAB3A15A2C +139000,k,8B51CFF5449D35F9A3F391CC14D16034A1C5083155AF8E1612C929CB0BAE5375 +139000,u,26827B6F41817D7C454401C669CBE90CCC816065DE4210E624050A9DBA96FC27 +140000,k,5CB3F2B4E990FBC757F1C4860CE72C3613E00CC677BF7B2CAB92AFF5C812E42C +140000,u,1E90CFD8ABC9D50D42B3676EB55E42D22B0C3EB9E155F272A316505412ED2432 +141000,k,87003B20E6A165CDD8640BADE909B504C2DC8498EC12867946D5DA69BCB4D150 +141000,u,6AD2D8D57A3D2DF138904E4724A1E7E781D9A6107A62397B8C3B4E2FA110CF28 +142000,k,2A43D5E3BBFD2C8A70C357B8D55D77A08EED0C4029B9F3709F76188365C8A51D +142000,u,7C9437099954E6C654AA1DEA49F9680E896252228D2141BF2C6EBCB8FD7A9D4D +143000,k,599D15B664E1DE125B99ABC0FB03219779B37A16EDB4504375E34F0586020B4C +143000,u,CF4E148CF44FA92337D43E6A5CA1F43FEFE7DB0902834DB010BC4900DBE2695B +144000,k,C4419C6ECE557B35897628C94209A777D8586D48DDEA8FED38C141755FB4F10A +144000,u,E7D6983AFF5CE9577036E95C1DF9BCAFD8B58D244EE4269BD74977B500AF290C +145000,k,EAF9A0446BD206B02C1583A85815AF497E760467E755ADDFE5AD61C748E0390C +145000,u,41B458A4A2FACD38E801962A2E579770C2FC0FAE5BE088C630C5BC5222C7923F +146000,k,0A045AA2B8C588A3BC23B8385E5093DBA156D6B790887826CA0339178E716C2B +146000,u,974F6524FD1AD63823999F951D1EB4C1CB4E8D1B74E6A1D8E478348C25204C63 +147000,k,D36D2055A12C633F5B225621D235B6510321651645516E4905F8513DF6CC4712 +147000,u,C3176F8703F6E43F04C312F864DC503388E9B67414437D52BEC2301F519E4C68 +148000,k,2C945F6F3DC6B768D89C9A3CB313F624126580BC044AEC8696CB27C87273C153 +148000,u,107734686F6AEC5640AA8620EC02C79EA3DE9F30DB0F201BED0793133D8B8A6E +149000,k,A671CE3B6D14D66281F40CAB902377FA3540AF40B8F2BE7CED8E901FE218754E +149000,u,9B92CD1BAFCFAA5AD016EF9663C9E63343D756DFC94766013023F10411676B64 +150000,k,513D4B5C920466E1C189E4EB8D79B4AE5B01960346A3687CE819E5F613B7472F +150000,u,81ABBC4BA6BA67B7574CD82C1394EEF68CA1D2F9AB7A0F8C2DB1464EDAC38E2C +151000,k,BE665ACEC5D3862F97E1AC8A883F42B6C7341F83DB5F81FC3D7AB2A9E9CCAC01 +151000,u,2DB471326CEE91249C93B364334A764C00A0B95B8EDAA558ED17842047DBD57F +152000,k,9CE108FDFFFA4091651D7C059FB86BB132F8C595CA09F6EC3E53E0B4FD2B6239 +152000,u,A9C27530C50EAC350C7CAA3014EA1F07CFF9A08FEA0E02A5AD71CA51EE899307 +153000,k,A34539DA1DA3C40C8EF0E24AE2E2D97299870E6E5D84ABC55707662A66B5B87C +153000,u,C8398963586DF81AF7E05F3E83061EA6F123CCAD2E38BAF48ABC367D55EF5369 +154000,k,7F0C60C3B0CD6F5D1044370315663F525F56D09D0D6B5DE99E216139E347AC2B +154000,u,C65DAB966122BC807DE16676B23F83FB4FD060321BFFDCFC84256D41A82E8811 +155000,k,B7C21F498E0F60B1C8E0AC3DD77126ED79A9083431AB0B14AEFC3BF5D798764F +155000,u,F2F9FAECB9FFB43E11B18015B5EE33126F448117D8D37E78A3474D302B01C74B +156000,k,6AA8AE9D95CBC79243913B157882626EA65936C793149D8DF0F3F9DFFC335355 +156000,u,B4441E231EFD67C78C5602C2C2E449BD13B72A56E28ABE36E6BECE6D11D95B12 +157000,k,3D02236481005CFBB119F285498CD219428C804CAD69A9260D5F1E27B8581D6F +157000,u,683BC8AC28CECFFC2E7CF76E5A4C8D83A7D5683D4BA497C64C1FF9B10269EC39 +158000,k,E9B0F4D55FA8799F5F5E2141E14F0CC54591EBA760EED5A6681C37E54815C43B +158000,u,94ECBD9CF6A627B84E63F8199AA0DFB0D9A1AFF962F662C7758138CD527BD057 +159000,k,50A9C41BB0962718E4A175BCBAA8330D95B5A1F63D2FDD879308C217088E615A +159000,u,4353A37BBE85D3CBB314CF9B83B9072A484A73641D9D57212C165C373DFD3B4F +160000,k,8B8FF168804955D221B35805D980BDE39C9ECE6272ECEC5A3924BBE548FA7155 +160000,u,B5BB0FF9E0BFEEB6B984BF16A260B7691D9DC9EAC41C1D7D235E22FF707DF317 +161000,k,830630FE37AD40F0DF0D96CD8684391168A673FB1789FD63FCF82BA51E6D811C +161000,u,475AF4FFDD5910E8CAF47B644D0B51B9312712ED32E6C54360733114ECAB5758 +162000,k,C4177FF02CB2734CE7775AC492BC099F1457B98966527EEE2BF61BE54ACD7F1E +162000,u,AF516AC629E31B63CBA37CA07FBAE9DCE9E00685C3A4F6D54296387C465F7712 +163000,k,9D9ACF9090773B575A043A6E60B907CA1203DAEB1C4F9A131C1FF98A7B293C40 +163000,u,E5145324CACF7F67F522CE0BE7217D81F5911A73A952792F692A3E00DAADBF07 +164000,k,62C9E828B14E7AA34C440C1D10EB5BA493837EAB9E7BF26F1FBCC5EEB4B9FD3F +164000,u,73F98651FF0D978FFAE281A7AA22F670F754AE6244D0E3576942651F7E6F7976 +165000,k,9325091A3627C21E03D76F306E4A59FB185AB1EAE0252B6C77761D6F4402447B +165000,u,92F8DF4E8B536F948B301F8375F9F847BC280760DCF84B5DBFE484CFFCA76A38 +166000,k,9665399BE8C4815977BD0D5EF8B54F5E6F00111ACD0CD57B2180C3AADCDAB174 +166000,u,DADE449B3D26A9872E67397564329476010D7389399DED9F97ACA622F008E023 +167000,k,BD8806592DF9C9BB580E701C02BDAED9E67AC311B89BEE443FD116B7E609323F +167000,u,026A9F73E39B8543BEEBED91E4A2D86FE5747AB77F8F14C3AC63442B9D696503 +168000,k,40ADE84769CE5CA1A674523A79879EECE6F2225748A2B7F3C9DDFEF48ADDCE6E +168000,u,BE7716B2D424948CDA1A0EAB22CDF0E09892AFA9CF0DC09B8BA755D45CFF6901 +169000,k,F3FF4549716F378CCEAD5E214BED54F7FCE88D1EE2154D2EF983A192C69B4134 +169000,u,A4371FB2E56C5E3544D5F8B64D2007256CEA9BD9E018056579936512EF44B07A +170000,k,C21AA18577495A5326048B1F8016BE68D4AF64026FE1E665A5D58FB912C92B1D +170000,u,BBA4BE4AA20DA3B5DAEBCC7A052E96A2EFE071D476726FAA06FF30D603D17D27 +171000,k,EAE4DCE83C06E494C5DBFCD298C02B2FAD49EBBF3B0D1ECFEC19767379696C2C +171000,u,073F60AC2E76CD037F4E504DF9C1569EF8136F3F33D0F5C61AA2C80F50070E5A +172000,k,14F73DAE4AC1E4F63059C54D8EC4A9A974647AC4E5F3214526A522308365F613 +172000,u,28C7139880FA0334988502FBF8F1CE186611C9EF88284BA67AA06C7AE8C4BB2B +173000,k,7471F57248589BDCD9A99D0344898884E2EE4E7A1C14896F8AD9C2CAB5119D4F +173000,u,6B7D0DC9B3902314FD1874189E46043B5C1F22B6B8F46C35F3ACAFEF2CD18B74 +174000,k,E4E59F637439D624C8E596055B8CF97FBAE76D1D8DF91873747259845632AE73 +174000,u,E897B81E5D8DDBE135E8795AED74762CB7C447759E6FE578EF3FAC3DB4D9C02E +175000,k,8204EEE0B81C6F5512EBC55187D127D585F3DBA8B0F89587752F3BF1EE42B903 +175000,u,B104DE66329DBEAC0B60A184E0CECCBBE20B9F8DEE31F51E75B41E4A2439782A +176000,k,3448939E2B2C02585453175100D6742A22F6FB1EA457C074EA1238949449A440 +176000,u,991FFF01700495BF95F8C5C420826DD12E7903FF5B667F18F5901761EEF66266 +177000,k,4A99E2B683C048780D0EE3C2F3AA4BF5ADBF35A202935A61582E870A38B9A03B +177000,u,C5F2EBCA310856D78646459C55ECB470A26724243BD7EE0BE0F812478903E76B +178000,k,3A22BDBB63D575EC921F0741A408194C052AADCD9C52FA71AB378622F1CD303B +178000,u,86A606D9CD79A0EB66AAFA66DC80C3B96C05F468054A91B61EFFB53F30A1255A +179000,k,B0E46245C75633924C2368DD52FDB463658E82265BDF653AB0AC6DA5245EF917 +179000,u,5197598DD3F8D53F5EFE3700BA37474B7F223B79EA105A3C1A85E869F58F5D0A +180000,k,9B09520F8FD123F992478652E25D4E1519499102FACFD92F53AE3C4787A40914 +180000,u,43F98E350E5B3C85A9E63BFD4C71D0D65029C36F15336943879C59CFA1E44926 +181000,k,672D2E522C2A7C22E326C1D22B171B4BB771907CB87F71FEA4D7D91D3C70BB64 +181000,u,0A223EBA8076AD21E8CA20B4C38641ADA1F3986F06FB1DB2D2E418622F33A35B +182000,k,3975960FCA6B3B3442FA0A3E71D460211C17114DCF296C14A780F8F92EFDC51C +182000,u,6F4F97B5883164BE295D16EB6CB7084EFF9DDBA4F264BB348911C0D2D2BAE84D +183000,k,D53DB0BD1A5B7B97B92D80E0FFE10B74BA54B9CECBB067614CEB9CF64BCCC458 +183000,u,8AA2E7634C585D7B12E02E0FA09865A52BF83222016E939846BB149C0305B031 +184000,k,07700651BADED0338D6150F5FC8E0A9A119D8D5C539EDAD979E7C053853D9152 +184000,u,CFF7687DDF08D7686A37E80C4CF5EA3269DBD9D9277231D529762757F5BC4D70 +185000,k,BD6CDB2537F7C249FF78040265D5E96F356B12130AEDFB5F2D350F8E844C3B73 +185000,u,D70B1A45B279478594B83C98842B39831413593D4437125E40226FB39E8C6268 +186000,k,9ADBEC956CB5644BC2E65C1E8BCD9C93990C918379AA8309156106EBE5B4E217 +186000,u,38FA6EBB39305DCE7E877E21EF845FC0EEC862536B46AD67C7A6A0CCCCAAEC63 +187000,k,AF98A80BAE732523ADB975296301AD071E5B5905D9BC7A8425910281A7BADA4F +187000,u,C61E1AEDCC29347ACECC6624204E25B7413FC9544D14EF76C473F8FF26819A2F +188000,k,80F253F08183F654D8DE87C55A4DF2841DBFC3EC472FB9FA56313ADD4BFAD617 +188000,u,2A375640210A72B26AD9CF809C328DC65DC94922B5F8998EECE6A1C4D5638B3E +189000,k,AF367CE65F2A9F6D443B716719F067313A39DEDACE893AAF9D0D92A53454A70B +189000,u,96E077ECB7F891B2699BBD1AE2C25BCAC370A2258F4735836C4F00930A9F4F64 +190000,k,CC60F4B404D7E2E35FA508735673B277597BB321E106B9FD32C811226D9CBF16 +190000,u,1BF234C04E66819721B1BC3A077EBD36627A3DD2CBCE3D595C92B981186D6D36 +191000,k,A78CFEC9C650D85E343A6B3B71CDA706CEB602E6CBF31BF9E481EBA45A26CF58 +191000,u,AB506C20C43978E3A7A2F888826BDDE2710211C6DD198D17F09AD861CCCAA737 +192000,k,F5C6009C83EB4622C070CE01315CA062ED499E7A1E15F1A142B0BF73DC7E0672 +192000,u,151FC2B135AD9530AD49445382B3630256D1C2B54F02C22E8876CB7CACBF227D +193000,k,A69F69E61220C3F2A554661E54D948D3AEBD1F1E4AF6F3730A6E27E3265E2046 +193000,u,2B183C6CBAF63E3CCEB7C27B5635BAF8AAC14BD3714AFC5C522A2D89273DAF1F +194000,k,56A7E0DA3D4B143D91418C21145F16BC2C9A62922AE674E6F861D272B0E4AA2D +194000,u,37CCFBFAEABFBA21216BDABC9979EA3C2A9D82554CC4BB84D47EEF7634E42766 +195000,k,4A41D2E2A0C5C7A8C419A25C9EF5F696E6562778C2B460BF2D854783DA691806 +195000,u,BC3A1EDDD48CECB9A4D1106025EF02E31D4FE3980C1E5D27A6A8D7E67C505954 +196000,k,6E2985EDB0BF111A33D58414199709DD653D2C14C1DA43F9EC17F874BB3D7C7E +196000,u,56690AF9919E6DCC1690E0AEDB452E653189052647BC39FC541B15000E0F6A5A +197000,k,9199B2347D13621CB2AA1DFBB7300495D043D3CE9FFCFF3764B08A591108D616 +197000,u,03DABDC3B9651C398B47E1A5C9F4294F72A1B7909DCD11A33EE12A3AB55A8D30 +198000,k,42E01381E96619AC84ED3BA3E40D7512E3C539D49674A7596EDB0B4827309052 +198000,u,9FC911FF3B5124FE3524DB1412C7283032A80FE9C05BE6F6B733F8E417871045 +199000,k,7F1A3C6BC3E07A06C5F69A6455E8E20ED3C87A10C20A3484A2A284A0E19C0829 +199000,u,F11E3282DDF9B527A9BE51DF8141BF41A0873622410858FA4E75722A58D43F36 +200000,k,B63B8F318E9CC1BA05780A1BF6C9DD15BC76C815843528BB35037B55D75AB10E +200000,u,B7FC08ECFB6E3CEB02C6B2B3FD6EC166CA18C247C5CB3EB30F0009FBD6B01142 +201000,k,2CCE2121007DD870C0FD365009534D37C9F9044AF98C282EED4E4B0EA01CC479 +201000,u,87F71845C4190D091DBF7F806AAA1DD03875482AC5F2CE106C16FF43F1F5AF5B +202000,k,03FCCA9205E5E4916481E8286B5994B89994D043A55C1BEBE9029A50D6EF1410 +202000,u,013C614A238127BDBC9B0C6983272C103F335C25BE2227B141AF881E52AE225D +203000,k,90CDDC1F9D9DDB27FDEC852B2D1974CF28FBF8BB62C3B43C526F217E54D98A0E +203000,u,64C48C0BBF545F7E482F2E2EF2372F04862E5D17C1D85116E7F0795FEFCCD61A +204000,k,09C94F697A8D48E19C67C39097F81BB15B4BED656E8D6363FC605011611B8459 +204000,u,C63C3B5EBE3298BF809B5C80D5051F215D88113B9F48EE69CBBDCEE77CAD4E2C +205000,k,01A76A67CA3FD18DB52C8B42DE84357EE808837E5CB0CA283EC459EAEAE20E76 +205000,u,5ACD908273B58F2646861984AC3F519ABDBCF9B18DFB9C219A0292612A0C0F71 +206000,k,096998DAFC484D4E2C01FDC7D35A2234C38B171CE62F12C1A1A144F9F6DE4E57 +206000,u,15490809CFE4CE30F4D620E4C2E97583F9DF1662104DE5984DE6626B38064D2A +207000,k,28A6B948448D40F33A3A4C08EFC36DB0C659FE9C69EBDD87DD11A0838917905A +207000,u,A5B3109533FA6FC0228883600F945E2005FCD365F2FCECAC543237644CE6014B +208000,k,FA736DB6FDACC56D6DD8C838139BAD0D25ED0F36025E18F55B782E959F014840 +208000,u,18E5B3570D9EAD24D2676BC0E3B06E5C7DD45A78448C82580AA17525557FD85A +209000,k,BC2E5968DAB0829CBB5D6227640F4D959BB2B6AC12CD1B3CC87DCA3CF3EFED49 +209000,u,1803264E8B8B31BF6C898DBF4977DBFB296769B719E1E879FC60E66DEDC0785D +210000,k,C070839C145090681893AB21BACF68083333FDF50740AD23B41A992B46133E44 +210000,u,D20AF8606F595B57D495626A48824BDC869E5C4B5C8A48A21E9BB9700E4A9747 +211000,k,D4D7E4C33301FFF893C3523EC6835B5628ADD0757C80627876C402EC6556CC3A +211000,u,46B41B1976CAC300B5067406BF07E24DF4F0211A66B93434034CE48DAACE1D09 +212000,k,32A2385E42AB539C159DC75B942EFA9581535803027B1C4FFEEAF0A0FE782013 +212000,u,B547315D20B8F514E94795CCB9830831D6271C95D8046188BF136E7111C42378 +213000,k,435E0C8D257BF10E1286219202D0240EE2B874AA1B8B283DF30351BFBC4B7F0A +213000,u,D3E32E33D4490ACFF92C13673635AE88B8D9DD719F909E41E636E0C9715CFA6A +214000,k,4A3AD28F438FFBD62741DDB05DB5ACF44070384D29BF94E2457843103E9FBE69 +214000,u,8356383477236E929BCF9103A82DC00B440308FE01BC4B2CF3181B1D68249750 +215000,k,0BF48B9E5612FD4592D573B7B669210646FA18E9FD0A2DD1305E760159664850 +215000,u,7B742C5810EEF9DCD84F4FC454E3C098F98CBBA0CF0A066460A870DDEE61BC17 +216000,k,A26EDB0D6BE4D2E9AE0A71354C5F8EE4064B682F2A3D5D210C21972013A7C42E +216000,u,538A7B760D00FDEE5F1C73A29353F71856180CCCED69666C7FF40573C3DDE637 +217000,k,BAD300785E366A3E38A3CEC73E8C515DAAB0DD886E58818BB58EEF44378F8D3B +217000,u,8927D2399590CDFE9943DB7485924A12AC39E8A041375DA6E984BF3002E4A504 +218000,k,9BCC52A887C96809740EAAD46C3729286E46203034D68DC803489E80AF60B068 +218000,u,7EEA6AFD17602F70A0DA2115448152BE6F26B503B76ACFB403E4442528F4E948 +219000,k,50F507AED2CD37A7B96A1D15EB5889D2C29183A39F2DA7DBACBF0645A91B8C24 +219000,u,795ED350E832852A1CF58078666AF3CFFF8AA14CBD3EFE22DA24B8F513B8651A +220000,k,E0FF07A09E8589CDA01B81214AFDC859880547D272B08CAF13A71CA4A7B89C67 +220000,u,9589A697C0CB63B1A91791E21BB66951260103B7929E3FA8B78662175D65A272 +221000,k,261F954ED5B16116734D0F14487A852668EEEFF3858DA655050C3C1062330E40 +221000,u,DBD6FC0E36F79B000E12E58E3645EDED9F0D602BE10F13CD25B278C69B66CD5D +222000,k,3873DFB1C176427257A95C0FD9BBFD0EDD75F7F860778289FE69414BE8CC594D +222000,u,D982237F2DC0FD964E3F363DF075A4A7A71B826C24BB9913BB2ED485E3BDEC29 +223000,k,582416509A9311E21A44F8B7E45D28E3493A64B9E723D75FCD90377D8F9BEA74 +223000,u,15C1FE32056FE5B2B79E40182373EC63E7501C39E44C603ECD3C5A74C6664922 +224000,k,27427E928B86ADF99811CBAF8956E55BA7A6C9B8B07E93DFF0AC4712F0D74631 +224000,u,D7A57FCFF2658D2621AFCC19ED5977F885CF44955A933BD935DC938B479C364F +225000,k,B075DE2888DC322C02E3601DB465C42267AAF0EF322124866580BFE45A348329 +225000,u,49F69CDCD443694B34435412353EB9CDD2B59B970DF7A7E6E08D9AB0EACBE116 +226000,k,241CF317478B7D4745168C63F504982B4C621AD61303A94D7F0AC7F00DC64B66 +226000,u,CB2A93009CC21A21B3B519EEB7AD919B739A382D5BE5D9C61BC21E8A8F644E2C +227000,k,2B8BBF79C1001472193BCE69E7808C16F2CCFA737034993265808FF4AA061417 +227000,u,35E63339819EB0CEF9DAE5B41CB7C03A9653D1863986B885C139B3D1297B1A38 +228000,k,D2101CE4791B596C24AE9B5B96CD894A79DF0884E5D1C4CF1F054A124EA3197E +228000,u,D3A3E857FF3678C918D89136097961851439CED340A79090F9623FC52853D807 +229000,k,8D55D138C8177960680C2C74F93D320B84FD29E9233BEBA6C10A0A9FF7960402 +229000,u,8E5967661CD01E183BFD41B092602608AE66D5EAD4A082C32D0529B5CB733C35 +230000,k,9527310F505FF349D2F3F72DEE0F98149FE92044E130E524992ACF42F5F4BE02 +230000,u,514AAE0B1D81848233C0556843EAE80FE72179AC5683EAB14515A2FA59458B60 +231000,k,519A02B5E563ACA7447DF57C3F330C9E21F15DB453CAA8FE1A39CFD0045F4638 +231000,u,31BAA9C1CAB0F2E144BF0AD4262CE347626624596016213FF29B54D50180B510 +232000,k,DF029C99EB8498B43247C6DDB3414432D6DF21E2B8B2280E46BC98C44BEE7F52 +232000,u,21051A5C8951A1DFF511B59CC713AF4576B4C3EF45EBD50653CAFF488A26DC0C +233000,k,B48C5D208066DDF474E6CA315313E2BA9283988D486AA10D0A54F84908803E63 +233000,u,EE0A0091D0ADEC67413650CDBDBF81E8C7D450866D63A5B7C71C4FC00F5A902D +234000,k,1DC505E16C6772BC3178EA7569626761137D59E903022BF49834B964BD804B42 +234000,u,B73BCB09233AB6EC84867D45B96E8B45160E7903A7C2A144F41106A0BA57D02A +235000,k,F082B376BD705A4356195CB54B02A624715BAB2C86D5A569844504E66CEE411E +235000,u,4D020DE650CC64F1FF40D2F7418FC84BFB94FC302EE6425C13101933EC76571A +236000,k,28D4ACA1A583487B93874BD236DEECE7218048C9106FE67836BB830128FBAE27 +236000,u,11475A279D9D33EB56BE29BA8E95F3B3496471211067192F8A58D452C2411150 +237000,k,052A0A5ADBC540ECA58EE4971C729D4EBAD2642D9333D27CD0AF987D0F167125 +237000,u,70A227AC19B61CE2B5803E0006D571BFA95D258D935FF2FD07034ACE2068E876 +238000,k,4DEE94CB58573EE87F71E6375B2EAB5B709BFD3FDA310110A26A3BDF23C77743 +238000,u,DA80A63CA6A63BEB33CEE54F5BB9E8BDC14A52A0332CE598E2123EDBA70F8205 +239000,k,EB607DE46F8A7EDB7D9AF7C129E37FFC18BB9E19008E43FE18D9D2D09FB9E35D +239000,u,32F522FB9DCCFD601937813EB7FF5BCB51A7759352F2A185DED67B995B68EF48 +240000,k,FC2AB2039C1E3AE0A9934C70F9843D3EC2171BD5EC33B883F2DD19032E8B4453 +240000,u,5944B3DDF4FBED4043E474BB5862E25A511A124F95B93689E66DA3D0E81C2A0C +241000,k,9AEC610FB028DB65D0417D298051D46B19352AD5EC8C51E1CBD24D9834AFDE41 +241000,u,3328F920399B5608E2B5182BD1EDFB137615E792DE91812CF288A7D482A2667D +242000,k,D82A697676EB1CB49A0BE3E6902B4785D0C610CDF275B2C0924128D74C5D0A5A +242000,u,1B9927EAC00E054C8C7A1603DE17223204A8F13E55F3A192670B5F92CA85A915 +243000,k,64CCE8C8C13EC639563EFEA4055925ABAEA6B98C23B21BE971F28C18863FE439 +243000,u,F1D370DC548240131D87D96026115AD07F107ECC48DB50C2DA2BBE326CF84E11 +244000,k,F7827E939B9231A7D3445994C41DA73A16AD8CA28F4DEE7CFF5D3D6ECEFEAE27 +244000,u,E2685E590787C8ED4F793BAD47B19360CCBA4B0B0174361E43A4B92F6B483E70 +245000,k,B20E2D8F1EB42A6A3B844504A365761B00A21F3F935568135B0E6FBE85EC733D +245000,u,7E8753A6F85CAC1E0C039EC5CB68097DC77F27D8E7230500DCCA494DDE1D7215 +246000,k,82E0A6F6A375AB8BCEA7EDB68C3F088ADF3D992F17664DD3CA53C8E6650F2E0E +246000,u,D57D45602A5FE551B630FC7322BF92C4CAD230589741C27C0CF633649D049C20 +247000,k,6A802BD2CEE9697541D1D5C034EA4827AEAA82E56D195FD40B94F2D0CD351F67 +247000,u,FE648867AFAFC8BC0E71C2424A8A39F87CBF897EE96D6C1803F36828F3064342 +248000,k,4AF0AD1442EA02DF6D06045E023FD64F48EBE8E0CAE9B60A0C254F65ACC5FB38 +248000,u,CFEEECDF32C53C6542D4BFE85E9750BB5990B302E1C25822241F7AE90065625A +249000,k,2769CBAB9DAE225546161E138C28F6BE6CB9433608FB0F499BB838D80BC90F5B +249000,u,5B5A2F6A7C2E4825FFE8086995ABE078C226E9642995FC49467E6D300DA39B3E +250000,k,4E9DEFFA7715D1254D7103B5B92D78AC6D93CD9B9A5830327FAC1D574240CE3D +250000,u,03A8650BEEDA5F60812932513BB6501911B23AA90C33A3EDAEF51D9329836B6C +251000,k,18A5464598E3ABF5E413F44757190361DC4F43EAF32321961325199513699102 +251000,u,19D84212A92D11B3D154AC600C94803D5B7C6D6079100C00267E45D840F8A85E +252000,k,B42EC21CAEC890B058AAD7F325FC89A5E1259738198E62E4CBFD87429CA0EA5E +252000,u,24A07B777C4BB5D824EEA666EE98ADC28629B87780E8723D83EB5BCB78819753 +253000,k,5A80F1963508A0817A0D4A25A64B84517D7AED5FFCFF3A4C5BC6DB6297629059 +253000,u,1AEF75F211F8C0967C58681401FDE965F2BBF8561D87DA79B4D2AA5D41BC363F +254000,k,2A2E45A367E1CD2E39043070276D1703C9A3AB5CA3E257E1AD37EA260B0EBF3A +254000,u,F167C86A2BCAF18EDC2CA0921562A0A4420D5E2E3D4629EB95BADE17BF946560 +255000,k,1A53D6E944585EDB35019A245715B25FF7F2EF79205411ED69BC5BDE638A1A66 +255000,u,C4C24FEEA3EEDDB4A1DD47F389B754612143B91E76EF3B1B2488FF760D7F9C71 +256000,k,4FFAD37D302B0D3C49D2A55E5DAA6CD7F034155203C1BD5B1D4270EEC4FCC96F +256000,u,A2BCB92BE056B85C94C0106EF9C4540DD65EF95B7DD2C4DD96BB88E43571CA1F +257000,k,C889260BF0D12489FEB541ECDD9E73485FA4A00EAC882C77735FAB53252DE529 +257000,u,5F27DCCE28DC312C5841765ABEC91197F4A7DB878A4C7C4D1D569DDE5D24B529 +258000,k,BE28B9AB0D653B028C580CB1684603A42835BBC5DBAECD050D21C4F9E51A3228 +258000,u,935B742D945B6590ABFF3E05CC5D6AC50032C8DE970CDFEC6D3CF2141DCA2B2E +259000,k,0EDA5D89761A7EED38568DFF25F7B67548718A85829A4ECE45554D903127F743 +259000,u,A1377FA65A4499A6F0E056C3192058FDA1794CDA2127440A16D163032DE08123 +260000,k,BD50E95149499E6A41C2559AFBB89FFC1DD6281CBA4103960F750CD9FD8C327A +260000,u,05746132E7C149F9C3D14DC2E4286E9B982143C5249F989200B9B35B4599713A +261000,k,99077C1D43C58D81A8AB5E8303DBA1963F6943D75E9B0A71D117FABB03E2562D +261000,u,781B714FA1034F107AF58F70007688449257C227BCE27963F7970FEEEBD5A00B +262000,k,5C77E3090F09083B430BAFE16949E01C70149CB4C5F7F910023D728A8DBDCA78 +262000,u,8BB784418FB4966ED04171B9EC9807270666725F9ECB360FE794C7FB1ECFBD0A +263000,k,63D4813C970D87CB5EB5641DCCF4FCD8B727CFF176B8E8810ED94C2C1E6DEE36 +263000,u,45F56AD77AB871E750CDB5A848A2D2C961B97CBD4C68BBA1B15B4F778CC3123E +264000,k,207A726F6112313E9067D194F89A6E0431FA1124267856A171E88ACFD3C10312 +264000,u,F336ED31B145C08C3BFED4213C7EF044E5BF5E0BB8F33357AE98E600B5B7BC16 +265000,k,E2034F83F6DDBF8B5A83FA7CC3220DD9D48CC3E70CB3341BAB756DB005D98B2B +265000,u,C49982E868C0F5B3095963D716D85A89BDA9C978F33668DA7A3C6C12A603B204 +266000,k,91117DA4331A568AC876A025DF63731FA4554D6FF0066CEBC5C5D1F08204E00A +266000,u,31C0887ABFDFFF4DEBD0F01F820E1E75CC6CF0677F778B321029D9C39BE3CD55 +267000,k,9A35189BB69BA7C3ECD4FC58961902F00CCDE1EA9405C0A99B838A9B478D251A +267000,u,BA4E196B20D454DDEC8C8653957CF5986FDA7BC1BDFEF2B233B68A4AB07DFD2A +268000,k,7685464B04F9A8C668CF60518460C75CB096342E86BB2B66A2365EC79E571609 +268000,u,A3483A39D90778672BD295AF5E1DA8C9180711C2A27C0EB7206DF51D402FB955 +269000,k,A291B24B5D4A55A371C2AE2CC8EB0E9B8D3ABE1017A13C5E2246C1DA704FA535 +269000,u,4666D951E2A6182C110B1CBAFB06F32F314AC028035BFBB4044F9DED3E769932 +270000,k,A995E37603FBC08F316808820670F7D9CEE71EB18133B4D45D185B23247DCF7A +270000,u,147415EA747C75B67865D8993B6F01630C3F9660554B8491A15655C9CCA7410E +271000,k,E3F9B29FB312768D1927D02A4D2D3CE29C86E7C70145117BF8F45C3457127A44 +271000,u,9750EF50599B6EECC2CB3FA44FA7701A81F4790AF9A9F8A1B3235E4378ECCD5A +272000,k,8CDCC7804CFA808BC5D5EA79B72FD874E983D54D64976DC9D18AE92DDB21FA43 +272000,u,F704C65BD8E5E1E06475B8B6B4D4E27230DE7131AD9564F468121E07F449AD7D +273000,k,A9A9A4FFF3D8895CE29815609C3E1BC1AA2D279B48C730E7C872BCCE090AFA72 +273000,u,B0D5BD57B62B7081D89A443D2FC891D20808B3D671E6B28DAA03213A432B3758 +274000,k,45A2028B04F7C663157E1A9EC488EEF45A93B1463B5CE6CE1F01CB1CFA9DCF1B +274000,u,BC695D0FEC17BBD65D16097A060446BB86A3C4676B5E7511BA709EA57EA70E51 +275000,k,F7A107A812BA669DF105EAC684C9D0FCEAC3B84FBC6F2A04F4A1204D47EEA35E +275000,u,7B4F7C4A06613ECFC45D588E8B4A4ADB76B34EB4EAAD444C5EB3E01B2489F567 +276000,k,194105B61DAB0FE34E746997A23AFF07DC138BC0D47E48E58B9001C9B369E533 +276000,u,E4719E304AC60C293D99B696920D049863E9B418BC1FE2E6F92CA3729B958F3D +277000,k,1471B8814E89B47F407D7A3C5E7DC21C1791636A7576931EA09AD7EFFC27104D +277000,u,F64B346342A64BDCB60152BDC27210E68B2660228E8A7CF4315710B51088FC23 +278000,k,F1DA97C9587ACD6DB6B90EEADE15E25A6E878B835989A8B1BF318C914DCA3911 +278000,u,F32E395595C84DE10A8FAB651F80DA7863AA790FB0F6E9FC1D1EAD6E3033D158 +279000,k,DC67CC600454E32CC66708EB96187D744CE7DA6E57DBB8728ADA61A26CDA0E23 +279000,u,69953E3B472C8828EC9675D17EBBFB48FDBDA6BF7BD8F694AEF49252B15D8C27 +280000,k,7FE4473739A690AE7A71EB2F0C552F65A794A8FE27D25366A5BDC5AABD28C125 +280000,u,9FEE4E00A5A44887CFC3561CE1F104124DCFBD3E91FE1CFB9465E476389BF022 +281000,k,19458A3AC26456D506D0F1CE962BC847D8B39AF9185AC66F887003D99845BB2E +281000,u,A7E3E585B65790A89B24AE9B5A22094243245C2BC5E76916E31CDFD354DAAD4F +282000,k,7B5B29FF2DD48720FF5D6F3D432DAC7C631C418AB6DF64DD2915960DF9AADA02 +282000,u,D4F64CA22135052A4B74E4DB7134B1B4D26E60E83282B170D3B8827E587AEB77 +283000,k,838C13800950097052EF3A1200A62B1125BA98AC866153E8C0857BBE351E8A4B +283000,u,B8534604FAF0327D2D1A3BDD5C68CFD935987BDB7DE7AFD2D38CA9087F4A1655 +284000,k,280BA42A45EC7560CC79B87911C110CE2D9E1AC102883291E31AD0D2128CCE2E +284000,u,057278065073F4F3D34061FD7163920FDBF604F467EC473B055103C627ECBC49 +285000,k,36948D635FB41F092D9F209BD1C5D8EA0C6153CFFB7CAF3E7ED138315EBA8A3F +285000,u,E2BFA75FD7CEE3A74B92F77F9B1F2D543B85B0F8B351297AD6342D39FBFBB11F +286000,k,4E3E82AC9C2A0A63EF8FCC8E9AD613847640CEBA11ABE926FD13797DF7EED275 +286000,u,5AF081CF9DE61A9E1249CC12011C52F8093C11D8BA9EC24740F02E852CDA8916 +287000,k,58BA905FB33D74249A83A4E24999ED33C71F262ED113E38CADB8DA705372F46A +287000,u,1BFF425F95506BD704E9C2EDAB2D3B0A04A8A6A2093548F2A1AE8B61FDEF162E +288000,k,DD3F57C3576E13728CB2BEDABC2C45D1553563403608B97062124796A3739203 +288000,u,B471E01159BD5BABC90E92A97B62341689AC513A2AEB7134FD71A79BD3B97D4C +289000,k,53FCE055798C8685FB6CA1D67ABADB7E178B8FC5BDA4BB36201381ABACFE3632 +289000,u,520F38842BE19EAA167139478A478DCE9F81AD3DF3D865D28E83BB912C57AC16 +290000,k,745EDB1E10486A0BBAFBCF8DE33254EE842BC1723F552644A3598FE974BFD419 +290000,u,EE13FF07FBDA10C499330751A3EFD0CF2F87F9CB7E216C62BACEFD984A57ED66 +291000,k,C7B7B59E831D44C1409F893A019D8B4D004AFF8BD5F88907349F2532140F653F +291000,u,7798C911280424B1B90FEEC86CE2249DD37228C8352C9EB5585799A8BD088103 +292000,k,47FEB66D367974212A40AA8E23289AD1C7BB2E524E58502FD2FC09EB76528977 +292000,u,7BA9C152CB28999F5454561B47CA70B539A378EDABA81B87259A580D72882621 +293000,k,B6A0776C7F09D7721333E72E203D23B32A19B565D08DE8E96E6AE9FE3537D071 +293000,u,85E0FFEC325D0A2E95353B12BCCA194040C6EE1BF34D9906D52EBE6BDA134721 +294000,k,7C43D1CAE4A3EFB1FA769C610BC09DA31A9D0480CF58881D2DB1E679BD6A500C +294000,u,7094621E543E0C2459379869593D6CDBFD701DD08905AA0306E675EE46537977 +295000,k,D3344E88A3251F7A3CE712E251ECB6DA1CDB7B66D1C345CB61D7338AC0A96D34 +295000,u,1F2ACFDDC4DC285E04C2CFCECBF05B294F93ABA13AD08994058CB5549FE59D49 +296000,k,DFAF4095F73D5F84E34E5C4DC18EA3BFDA55019217429FFE87DCECC61A6B2E75 +296000,u,B213E86C9878A3F81A68DEF5F39F05DDB4204653A6978AC9D2D70461EF03685C +297000,k,5F9DE98B8A925F54A5D76CA11B77DA35A3184297931BF899C00CF344F6A6F260 +297000,u,EA45A140ACA824CF7A1FD0D3BCB6A95AFE61FE5E82431FECF00A9329FF582F2D +298000,k,4D574D4341AE50F2E72B370C4965B2788AFEF847AF10F897F2F55693ED7C0F75 +298000,u,D4012D29326DFA636122F3DB0C82D2AD0F4FF3DA48D9757FFCED3E1F90205F78 +299000,k,A12A487186D6B35177F92581D21E073C2D11DDE4251329D5B7B57E7F95561A3E +299000,u,C7F40667828E9C8A85565D52E44B909F43CEC1E176514F50B8A931540F8AA008 +300000,k,8259F6EF04FE78595095D1670F06DE1811D906A8C4D84A29DDDC34678EA42474 +300000,u,151F2544D9992D0DB398AFAD8B54971405BCAE03DBE492A5D3F62F4867CA702F +301000,k,3CE204C282EC27EB8D2A74516F012638511100EEF8C2D7418CA6FE9948341856 +301000,u,EDC736660CD5D799332FDE354A43CEE73BC41A870363A0107E03A58D66E25C39 +302000,k,0C88C9E1B79FFF6A6E8E3F62CAB2C8DF1C9B8F38F06B2097333DD7A9A7615852 +302000,u,229B316AD8E529BDCE8FBFF6F40ACF62157CAE9F439CB638E1435994341DCE13 +303000,k,AB9D378BDC3CA2EEE63D5FE0E1020AEAC9A4DF441F41E9BDD9A78A393B86DA72 +303000,u,D28732D9CF06C873B540F8CCE47AA60E545940CFFB54C28051439B5A5E62A91D +304000,k,947E806FDBF2DABAB2FE248823286D1428F2AFE2DB7E956CC4FFD002AA5D6212 +304000,u,10D92F4A5CF3B2456CCE72344062DECD5BCC14695DEDC05A4341A2F75896B021 +305000,k,E6A914446B111FB9CD3F1E382A9E394B0D1CE2DB497B9B26ECA4EDA5D3175428 +305000,u,C8FDEA152827805F6CC2C34AF0C9AE7BCB3EB17A7B0668655244F7BD11D40B12 +306000,k,82669C826FC92B9221D969BC8DA31690909EB0624EB83CD27BCDB81BF6469E4D +306000,u,7CED7D31D8A992A8571F348C3F93C550A02D5EE957AE45792743801781B63654 +307000,k,D9D86CFE18BD62885075CB23602D6668DA51291F6B62DB18C77A847557B1E856 +307000,u,3D7CF72F3E3E612FA0A6F543047E87C59A5A4549D7AF18FC1981F778E8E77700 +308000,k,C192751140C595006B5AAEEB169D194FDC4166816452BE82B5B4FC80F18AF378 +308000,u,FCFC18483017CBCEB0316193F05FF0349AAC5303B005860CB0BF3BD5C1DAEC27 +309000,k,E68896B08D50ED51CCBC54C9845D4EC813EA1FBE1B6DC4EA163C1DA2AB9C227C +309000,u,B638C1DA81BA10876ED410C76FBAEEF667A2A572DECF76D00B040E4688E2D628 +310000,k,A6EBB79352F555480A4FB5B3EF67FC6D9BC75B7CEFCC72EBF55F90D60E9B0253 +310000,u,D1AB0569B7055F4A8A67FFF749D48DC4CFF8B427C5997E18579E7EB12E14AF65 +311000,k,20C8453CF0387BA029FB4AA3C8A251D5CAB8623C7BFF67AC7928C1DD82355048 +311000,u,6DA56D1DF208C2B66D997166ABBD40CAB3E1609ED80CB17A70FEE38002D5326A +312000,k,CC857D65B5B432F9B7996086EA809B456AD6EB010396F0A925A66895C480054E +312000,u,A8B3919BA3C612A078D14DA553E94CD2B1CB050FB82715AC99DFD0D1586CC647 +313000,k,9FA558E8766286DFDE8BC57C023A61B891666D0C948BC28BA244EE86475E9522 +313000,u,C489CEE9B9BB10D0D23EE07D5644519288D11CA2DFD01800ACAEDA16B1ECAC4F +314000,k,D81B78124B1E3109034E724AC742D645B8C3DFD3ACDE717D5CF8E996EAB4C671 +314000,u,DBD54ECF9B0FDCBF817F5EDD0C1C87752FD7401B69C80E08549659681511400C +315000,k,DC7DE3EE2FEBB5145C7966CF7D487AF23C0952793BFDFC9CD6B4864D76F80459 +315000,u,F3AA6DF11B0F6F5C36C0950F781517E02811A1681C756DE7D00FA40C58D8A33C +316000,k,FD7BF265D7C1D0C88CB35470798C863FCC98B990190557B9F1E85F0A75D68E48 +316000,u,975BA6193EE7E354B7FD66758A5C5ECE792561344F96B9E287F10A9007488443 +317000,k,14AABAA3919E63E8FAFF33EC6DEA99C39345DE0A160AF3A24947D8888F5E8B07 +317000,u,04F427437B97954AEDF18E44DBAC09F410B72414000CE5D20BA1DE794AFF7E57 +318000,k,230A60DD17A950A56EC564CB190D6C2D5C7C598D9305AD8C82CCEC74431E5020 +318000,u,91075622D48ABFCEF1C1D28CEEC774299D546AAF2E73FE195D1C19CDF7915134 +319000,k,C8338F41D7C53A3BFAC7179B5758956109BB9EF85DEF017A4969AF1A69809158 +319000,u,2B14FAC2438EC96A3483C41772362568ED0CC099A45B4A5C08352A5D40C77D63 +320000,k,0FB640EE1279CC3A95B99D2077255440E4D75E90DFE9E81E8F772027A6026E6F +320000,u,B6052092BD634CAF442CC59FFFA06692014B5B885DD8E2C39064209C223F3B4D +321000,k,73A772D7CBE9E0A24DE5D39608B3DAF4E578B21F0F4192AAB4FFC5E01C50C814 +321000,u,C492811A9915415022F72D068FB84B854FC6257FB6B60F1B151FC22361844B0E +322000,k,CD6730993BAC7676EEE0B0C37FFD4EC61AA1352E9A9CC3209FF99DB74DB3FC5A +322000,u,12E64005A64F19A1298F2FB7EA6486BF69483F391DEE9DF7571565406D8C5449 +323000,k,143CFD41D3B4AF99B269CB196D19E31CB13845A8B7E24560A6E19A51FE0C4A33 +323000,u,25AD1C205FBD7A0F404DF40FE995C6D8DEFD9297C9EA1EF785D58D504466FF26 +324000,k,455D2AD18000D66EEE5BE3C520D8DEAD10854EAA4E3F2DC9AB4D52F686833465 +324000,u,832187B2157001A43A7DC3A7EA9B22F26FBF22B1F31876D6C7319D8230B05D05 +325000,k,D50F0F88042A1F73084CCF3DD41F3E2A675ECD3E2568022004FA238399536740 +325000,u,215A09E55B4EFEC5D18459338C003F08A1049F992E9C6CB53DF639FC70AC2564 +326000,k,39D3A26CCC20FF8F25C7149C62768AF6E00C312932019CACAEAA30EAF7AB4161 +326000,u,464A102E5263128DAE1B840F71DCD85F1BC015615EF7AABEE5B6F28CE637042D +327000,k,1ADEB33F1E8E9B5221DE2CF6083517B513BFA296AED9C79282AB440359AC174B +327000,u,4F28158B585B77D315A464DF4F64210E25252F43EB1D9C4C003EF793DEE0AE42 +328000,k,4E9DB1DAD99805307A7AE341D96C9FF17C87EEBF5A63F3455979A9BF0EAAA179 +328000,u,74525E008F63EA7F0EB3BC13A80335A1C5BCAE75BBE1F14A365ED73E3D31851F +329000,k,ABA6C486BA852189C9244B4D64A31F50583FDF55D6F8581F7EA931F290904214 +329000,u,28258F375FFA6D7F76101AA2F71116FACACA9F17900AA5B5C25D41522249025F +330000,k,152D4D8D38C44185D21B0A13F414FD624B817B92E785EF202A5D3E73AEB9242D +330000,u,42D708E4956A7B561CBDAB4EEF704114500D9BB83D3BB6521FB40963D31B944C +331000,k,78C7F3D1398723EAA4B646D232BEC0C86A6FA1B1E5679E0D008F38ACFD66247F +331000,u,74D0DD39285EB2B112123691487ABBB1B0515E3CA1C87F1845F207E99B64CB1D +332000,k,CA5EF2D33227004361CE6486FE6BAA5301D7D39707171FE7703244E199D4E94A +332000,u,3CDFE64C909225667B66562C522D35A2F76B4C63126E5C5A40F7EBFF4DB91D29 +333000,k,D644F347F840AE69D7044CB38C91BC320FF81BBEEBA83D041CF50F237433DF48 +333000,u,2039E3598C0D8807F6690731D929FD56A5720A1948BD40C2C42530CFB8EAAC0F +334000,k,6C7E1C31A74C58303DD4857FDC0F239CDCA0C3B5FC1CFA224D7312400F868175 +334000,u,32EF4AD78881A62AC2CF2A2919B5BF107374CAD3FCB1F45933D52FE72DF0AB38 +335000,k,E00A3F1A2B2AFFE76F479C1CE33400B1DE2381249B1FA82F2D9DB57E2B36752E +335000,u,5A261D2E9EABEB54724C8A4ED116694EFB719590A7F1BD225A1EC35364E85674 +336000,k,CF3860006EA6DD7E60DBACBB24D6C9EF0613FA015CAAFAA1E53CAAEAE3578267 +336000,u,9F296365C63F69DC5BE1E253E62A9CC25F752D8335A614DD544823C973407940 +337000,k,F4A4195769C26EA2F901DFA1005BCCA629C620044EE2371FDBD8CB02546B1D22 +337000,u,70F810940E88CE2ADE2E72379822AC4A12870A90AAC595731D569DF2012C2A5D +338000,k,CF4527E23F95BF99E3822309F30FDC1B7DACBAFE7C1F28CD5EA39990D8F4AF21 +338000,u,A436472A45173A4760015871AA17D09A978F18871DF33FEC3094AAAFF49B4257 +339000,k,889361BB14D1C0FBA612F122F9F01788B451C28892432BB328B7E13E422E8109 +339000,u,70FFA24F7B2865AB5EFD204F45B903954CEAB00AE427F19B8B19B63ACDACA77E +340000,k,45EF1D5DA0E32C9E11F4F0C68C2160F836664A1602AD653A56DB56752B266C5E +340000,u,6897D0190D1DC57A5E1239AFF9BBCA15CD0060FDA4A099DC1036997E4A0E3F3D +341000,k,CD461076731D8EBABDB96B69A34A229CFBBFB39E8B95B93F852675BF72E48940 +341000,u,E16D0C9BE3BA8B6081FD0990F768D88DDA90D82336740A8949073715E4443727 +342000,k,2E2992A9645D3BE3C962004519833AF50FA33215CF07DA27263907F3680F7217 +342000,u,CB318E20C5332226B2BF8F1FE6DF30F9AED5548345A2C801BDB820BAF3B9E277 +343000,k,752F610FA67D34AC7CDDB9CE3CFBFCDE7875E40F23D5FC4ADE05226B8B46BE6B +343000,u,ED8E63191296F40047ADD029D048A128063B1A5E74BD66B3DF1D00661DB7B411 +344000,k,90AB47F78184EE5E36CDF9927B9020D5DC79E7484AC58F3C41200AE695748A65 +344000,u,D1DBAB5FFA7CC47C50E0CC069BD2CC9779AE4F95E039A97230981AB5F7F1F34D +345000,k,95EFCCB68BCB32336365980A304387847DAE6753DA2745230712C8495526434D +345000,u,ECE71BDA0E9A296FE953EF926312AABB3E94D4029B955504EE13D4536B2F4D73 +346000,k,6C3691DF42394F0E49C7CDD8E3241112BCAA9BF455ADC9474FDF45182E19FD30 +346000,u,B14B6D6F3768D9BE0CFE54B529E42749DD6C20447433FC47556567823604D04E +347000,k,8EADA94B067AA32FB09623764E5A14AC7CB3C56E649A6E866FF83837F7FDEC34 +347000,u,65A5A55EF204E78CEB7691F010E071EEF868498A1C1225247D6C8BD89A386978 +348000,k,7587614F2D0705B869DC2F07C56C04FDFBFBD3093F6AC4FEFD018741D046365B +348000,u,4A198353AB83069FDFB49ABA4A77C07928A03AEE39AD32757720850FEA63A16F +349000,k,D1B9E7ACEDC3E9D388EF59E86169FFFF9C2BA923ECE4EE286033E396D6EDC657 +349000,u,EE9C40FC5F3B2D69677C5FDABB66A8A69F2319D4765EF55F0FDC6EA360B90770 +350000,k,F7DA5474B40AB557034D62FFB10D672BD257671837DDAD8163CB7AF6F4813103 +350000,u,F2CD62888201B692DD9C805667E232EC2FF0F16AD2CBB48743B83C02BD93D56F +351000,k,68606EF1457455EDE804F9C3355CFEDBAD4DDC9E1FC9624D1F1D4904ADEB8C7F +351000,u,4EC63C6689B9282F417C03CD4FFEAC87AA5287BB4108CE985C9CD7EC1A82DB11 +352000,k,977E353B18ED809294E0219C14B4E6B158A092369D34357C0324DF1A6D057F50 +352000,u,8726F7F2313134B6D1BFDF9F1BAB6A07D11DA77B19D9455983BF54361AFBC64B +353000,k,609F6B34B469FE1A7359FDA3882D1FFEBBFBE0D5E237C96884084C3A54397850 +353000,u,3DD2E68D325CBB20DE89013F3E768FB2E75DCA8A8F2CB3D152D016E7DD393B1E +354000,k,91DFB60455E8D964E884E66198061431F577FAEEE06479F23760FC9EBC0C262D +354000,u,A0BE3520553F8A872170EF3309C1FF1FF74C614B3F07AE393F5B7639E3E3180B +355000,k,52E7B04578F0742DEFFAAE72D4EC37388D65ACFEDFFA8135600D9B0BEE7BC533 +355000,u,5ADCAA4C013EBF886B021C6BA1779BA7E749E5D57A37E236F0EEE4328D15E540 +356000,k,4117E13F2AFFE5460D64AF61BEF6B8DF64733BBF9A208DEC79FE2A64EAA94604 +356000,u,589C1E347DA75F989A32FFD8366E4121978255A581779AB1F8690E7F0E524966 +357000,k,549EC893AFFF2D54AAF613FDA3CA873384094055F07037CC8F9E36D63D844911 +357000,u,F99082A9BD163154848DB023CF379A67717592A5E755D69FAA14250785EBD531 +358000,k,DE895D5660ABDCEC7204D8DE0F7603502DE5632E4F4FB76E4BCCEAA904D19E3F +358000,u,2889673061ECDA6DB666A1BAF5149EEA3A733313F2DEDDDA5C3A66E8AF69D23A +359000,k,5B443F0CC132E38D683CAF65D8409F008349FD8FF9FC8F48ABFB1AAA7DC69262 +359000,u,D4990FDD7C2F54697E4B6D4B433F62E7D0C9BDB7DFFC93039D778A7A4DBA2725 +360000,k,DA9D6550AAD6DB24BF9996544CC13871D8FD5DAA82AE8982B575A8A8F4FAE861 +360000,u,954F1EE456B8F2DB104FFB0F7199DD5B0A7C9605E00748489CFA902A7A537E14 +361000,k,42CFCBDC7880E1D5DC9D06ABB7F11BBD5839ADE8DAD4698F89081C439BD46E32 +361000,u,E6059E6EF95073FF818030618357CBC63632D3B4FE61C07FFAD8920FC8ADB37E +362000,k,B6096401A9D0AF383E57493E19F04B10410241B644E8782A7CC63D6C1F069532 +362000,u,4190B9DF6AF054941320C2ECCD58A7215508B30C72B4B0BF921D582AD3BED505 +363000,k,C57BA8012D3C2042120D95D55F555E54DA212C25550EA3A11A4CB3415625053E +363000,u,3F0BBCA4AA1B33E6833000C7FC9349DCB11E4CBBC5327E07D5C89EBFCB33C515 +364000,k,04B80BCACA940229DE62367648F9D9BF1DF03D7B8B4BD4FFCB6CDDAC44776D4B +364000,u,E5CC517AC43410294EF54C817621F46710BFEEE7A26A5270E62B59775BB82961 +365000,k,48EB11E5D66A99E4781A98464E5830527E1BB3CEDECAA4A7F66ACA6370BDB300 +365000,u,B040331CF271159FF57D001570FD33B065051F7BD2AC46A92E632E0F9275A00F +366000,k,399784535BE153993C3FD72992C898C6B60CE55831EE0248DB8C84342B0A580F +366000,u,908B30F995DE2AA6EC6C2D21EA36699F29DE61518DF9638B493F18D0D5FD5645 +367000,k,8B050A9A3CB8B73A386BED9290FC254064BD3F84605E7AD75D80C7BE271F723B +367000,u,B4B0BA9C6AF0C9E33EF0B317E9691380C87B3FA3913124EACE420F4C55F72E2C +368000,k,72BC973D4495D534B28738F7D00EB039CEBBE8A72845C823837872BEBD03BF02 +368000,u,152585AA8365566A48F99C34C296F4D9B496F4558A7D65FE4A8C11DAC950C464 +369000,k,FD204A9BF621B6AE48CC541B72AF8445042974F147847FAA54A66086A932EC70 +369000,u,1FDA6B5D7145E50C8D90022888417DE91CA19F9641BFB867F602F7C68EFC134A +370000,k,7AC78516F6C1648CD331FD9E2B9302E6A341E47105FB64786A7A3065EF24C101 +370000,u,6F54ECAD469A4F21656C33BD9DA5CDBDF0ACD99BADD8DDD1CD8AD6B995713568 +371000,k,2588AD06B9667EC7FD18601800AA74C2EAAD3D5721A2A1202DF13222E1B23405 +371000,u,2819D5FC422869E6D9259CD4443C51234E516958054711038E2C1882885D7E5F +372000,k,773A2A1629D12773BD4F0278E5932F762660213154E1E6DE9959932DF860843A +372000,u,F87B634C3EFB2665E0EDA620A87CFF906C85FCEC311AD54A63774CBD7BECAE5B +373000,k,9B81EA5ED38A53A3AD8908E8E5D533A2CB7395121255136BFAE3A39D98D35362 +373000,u,8A2E5D1C800D671016ABB50F3C79FB7109F92B11B9A1629A10696B0131441304 +374000,k,4836230452F4B8BC9418BE1B30EAC0DC579D3852DD9CEACA4743256BFC56D61C +374000,u,E19DCB24FBFBE3D1A1241FBA4AE6B63A2006156A6642ED78FB36B441A3072867 +375000,k,B0E391CEBB6110536A2B7F5A58DD18D136DF9D8BE706C2C8FC06BA6B01639277 +375000,u,FF746A5D5A609889C6D4FE937F858612B283E3EB6255C0951B6546E62E44AF1A +376000,k,04E9D72D9AEE107107631BFE7690C353F8DFC76A98615D7E8A748BC06EE1B628 +376000,u,EABC99FC0F0B052DC11A672F5ECB572366A851207FB6FC0DFBD63FEC1CCBDB64 +377000,k,9C9B1CA6BB03E4ECF425133C5401460F489F51185166721B0BD1F3AB65983212 +377000,u,BD79B12B34F3D070C45BC3F515AED4CE8FE82E85EC90EAD4D36B82FF6E0B6D23 +378000,k,926468B67BF349D67EE0A04FD313C5BE620CD7156705A0EF899D46A3B7BAC106 +378000,u,1FAE8B0861CB74743A31DA88A9B3E1679182ABF2BA298B6C374C1C174DE8817C +379000,k,F5C1D003CA1FC6993E7916512EE6B8A7E4A6123B05D753236AB535FFBFAAB353 +379000,u,95D21E0C577BD211D54E524C7F17C5E5D076100111F5858A59398B61664BD714 +380000,k,1B3DA8A9A6181711744D37EB512E4C02895F5D871E673ACCF0AAB927C7C99057 +380000,u,73B2F03FA6ABCEA52D3EB457D28068B104D5F480DA9996DDD5805055DC4EA017 +381000,k,DAD9DA3D483B99C742DD28C738AAFF1160B66C26D65ECC8FED0FE9871D15306F +381000,u,CA445506FAF13502931072E59504AA50477FAE98A2945EDF5235C6B64E0AA919 +382000,k,D4E52907F5D3755AF2F9EFA8507EA1963D57E3F8C65196AE361253BCAC600277 +382000,u,C79D28F1E683242BEA66A321CE108AB1C5742E3401D8DE1BE350B80C63843C46 +383000,k,52B27B196D5DA932123C644C4C5FED090485D925F3608B0351B36D4BDAC1D275 +383000,u,377F6383E4675A3E601F130C24FDAA112CB306F9D9C60161FD8BFA0260344226 +384000,k,2479E9A9EC66E2591EC5E90C0F0627C72C0266468A2D8DAAA51F2F8A0EFCC939 +384000,u,0660EC89ABA1FA0015B4F35CE08090CE8FDA48CEB2A9C947F6186F748A812969 +385000,k,450C411854FAFB36A713EDCC03248B00C4886D3333662253D192D3B4A1816812 +385000,u,174A59940B8F3CEC55C63BD56C3366A202BE77097B0630C3569B55DC7AF00425 +386000,k,C711B866088916555B04D2174530F289B6A33E01A1A2375A4A48709E09CF833C +386000,u,286DE4D2B549EAE19151526E848F5C5E078687C3FCA1CC53F552AF5C51183250 +387000,k,56417F6154E4D34DD938A374AA7BF48C0F20E317E8D4393B2061B67BBD92012B +387000,u,28D2CED88A9662A5E40BD4911D1EC929C474FFC2F42FA0175ABA948DA05C6800 +388000,k,C0AC8F3924BFC9D6B5D560CFD66D323DE3C2A304465DB8DC6BC5DAE22EAA484A +388000,u,78D0121F5806DF07F3A66393988172193963E974B8BED83607099676F5EB1430 +389000,k,4200A8584264FCB9ECFB8C7FFD2523F9D36727A44685A1D27CC305BA916E3B5C +389000,u,D85FB1C3413482FC972FEA8E257E0BA6335EBAF9D5DB861A7AB4CC3407BD5C0E +390000,k,18402269F605683A6EADEEEBD04FCC4CE6F588AF8BCA03415F2E5AB19EB2CD4D +390000,u,3ABD2FD54FC340C7028AF863982022297AC0E3866210984475C1263D7E518910 +391000,k,AF271420ABE7A8EE378BA9606216CF8977D743F24AED141F438D64F18F82B307 +391000,u,49F34B874FFCB85B7D1C89F8F6D1D415BEA1260EF7E923B9258C7031D1C4386A +392000,k,FA5FC8FD5D249AA62DB0B9F1E498001B8878B5B5AC379351C63D76690D89D67C +392000,u,73914603A0629E7AF15B933C4EFA29C4268B314A7E535142AB40AE7C686CA15C +393000,k,A7CA7555500D2BDD876B9B5711CA17C214EFF05D107B12AA767BB77CF7E6881B +393000,u,BDD247895393D2536D50286011A37BF639CA77436F73BF41F2F710562D16C13A +394000,k,12707B79AA2A3CE0E75C638A7C5F4CF587102CD5D3AE21B7A23F02A58146E01B +394000,u,81B907E40F3A73D5F28CDB503134C2BDBAAFC95B3A21F98BEA067DE303BA4971 +395000,k,73791741F7F5C634F12C06EB1ACB051DB17A6266EB25EE61059DEA52C82A656A +395000,u,00AFA4A9989B797D1CC6F7F228B9621BF848FB5A8011099868419F9736C2DC27 +396000,k,FB6324DBAF722B4AD868B8686C2868EA46E7D1EB0D227F90B5B7839CFAA3603C +396000,u,22C64FFC3A57E13AACBCADFE2936115A3FF200605AD4263BCC894DBC0060D610 +397000,k,5DFBB34B194C939B70C2457E43F18536F27FD85314A070A18BFB6478C77CEE26 +397000,u,09A7D58E48D3D55FC079B28AEB57301C09D5C0807118A8C74D2B41177C731776 +398000,k,22C5F31E96D021E11057DBB4083A2713153F201533A833ED8AC168F9CE17D56A +398000,u,D88F610EA7EC0D377E6BE3B187D0E31EEF1B0F36879ACBFBE9AD98B6330B901E +399000,k,520FC34338BCDDA47709C00F8EB92271F10C5B9AA580789F99C696B694F8395E +399000,u,6F107F1136353B468A27E858303297C1FC09B450FB5DD2A5183E7DBD93B13C7D +400000,k,EFF2FC9C6496A11F932A1AD6649647E886AE1AAB005AA740D896DC672ED72464 +400000,u,DD9A6224CB4A562F7D81B946DA006F119C2DC143160C55B6C43ADBCEBB890C42 +401000,k,BD3BDDAAC31ECD2D4E249DFF88750BB70309AD1B57EAE1229A7BD58A88816807 +401000,u,104905838E6A41F98FCF9F9D0146CA1B9EC0701447B2B672BFD5F5CF57C29341 +402000,k,E4E95C5F18A0B99E387FDB418A1CC5CD7BCAB487C4501DC3C4548C9507E40D2C +402000,u,7CB83A580444A347F4DBBD1E09ED4684B858F0D925DA3BEBD44A537D8A0F102C +403000,k,FD47E44B64BA270B14563AB1E627472EC7FEC7E7B3C65D80026BD11B3B36A916 +403000,u,504EA18CB2460AD72235C3456E645936D60ACC3C775F1FBB1C227554DD7CB217 +404000,k,7E86D6140C55EE1641AA0845D82B728FFD394CDD86753C9DAA94676B746DFF49 +404000,u,4D98B136DB183F57848C84912824E9F2459E0692DA1E8EDF0A2621089278D63C +405000,k,964F8A80B984B343C9B0AC94F9D8AF3CB67A6C4EEFA7F3B2A158A0685DEF3C6E +405000,u,8ECB9E1FD0C05310DBA3AB51219288F5921F9E2CB1B890491F0B4B43378A050E +406000,k,D07A1779D3D4A733D3AEE69583806D096D45CABF8BD2991AC7F7E89E31B2DF4A +406000,u,5755FF1E004CB7823827C3F0DAB8900914F5E37520A5121A7E1AFD331518590A +407000,k,350C338AE1DE99E4459729BE364AF7043113D898A11D4EBF6B0CE8234BFEAC12 +407000,u,CEAD681158452B50A6AE2BD9FB9AF3601AF5E3C4E76BA922BE4D29BA2B8A0A15 +408000,k,5692EC0847988EC6D22FC0D64A2AF49DB6B561A0004A08E23727032DAF73B80B +408000,u,5FA4BDA2B10BA51A27CB3FF93C4055C1D064B777F966319CF28C25E28D33B15C +409000,k,6CEEFB850BB4A9538443D222D840EE391241EFA1CF336B685108A7D49FD1DB47 +409000,u,F8CFDD097AFE80FBF8F080B924358A944FD1828FD19C245946C128112D053218 +410000,k,3ADA62FE3E69027F4C05CC061BD8271D11B34F0551AB0DA602B884AA573AC237 +410000,u,7FCB1B28007AB0432C306E1B747FA8960440A68B1A0988845234EFA251C8856D +411000,k,A79E1CCC6D08044750351D8328033E18BE83E3B49212F05D4DCAC2CECEE7BE1C +411000,u,C78E229A18CCC976ECC6A735533C8643C70265EABCCDD99B174E6D0324FDAD3F +412000,k,E6AEE457DF8E45EBC93E9FE62FAD3A96C0256C7FE4D73CB288B9F64B26C3C273 +412000,u,2D831D712E5CC28D545CE4E2E41EB732A4531096B6BBCD65A90B59B196CCB162 +413000,k,D3C729EDD87B8196AA5FA71595D83E7BFAEAD5C955EA4F34F4FC81DB21D8BA5F +413000,u,3ED43D861EA315EA636D24075F39DD47BF004AE8B940098468EBB8921424D47C +414000,k,AFD0A57428BFE8000F67451A39C044EA8910345919FF7ADA26D5CCB19FE90615 +414000,u,BD86602C24D0EB3A9E48C147EDEBFF40F6725D72E2CAC60DC7D0A70689F1353D +415000,k,C6F32C8DDDB50220AA9E48F883D4467BE657116FFFCC8A20572322EECA57CF17 +415000,u,E3512FD03BB7BD6C0A3DCC0538D2F1DF7620F27B24E8E230283CC2C45245F811 +416000,k,5465EAD38FE256D22709F2CA12B8E481E5641FE4CA56E26BACE9E28F5E452F70 +416000,u,A74D4AB3D1D4A8A538A7B0A06ABFFD9015E739801CB5B3CA278CEFD995A04127 +417000,k,74AB2CAD92D1A6A4A621D424F81601ACAF0E383AD6B99ACECE8D0597B75B6914 +417000,u,C752A797636CEF5B847EDDFF2CAF28B19D420A88AC7F3772CBD5EA8F32C39F32 +418000,k,21B06CDD0CE0BA785CA5267EA8E69E86F377CD712614F17788B3248A6DB52607 +418000,u,09E50D2513CD52D1C2DA24B2CE7098BBF3FAF559C65DDAE84D9C868483896F1F +419000,k,CC62BE892099A6F1C9F3BBEA4029FC100DB922B9547716D9F01FDE06D0210F24 +419000,u,CA0EB887EDE6C699EDC4720DBE7E331DD17B853D5610AD34AE95BC4BFF064577 +420000,k,96783061F83983B3BA5DBB2E830DE20408ABBC53A678FD4A9693D0DB96A25E46 +420000,u,E876633E885BABDF7B88BE900CBD0F37100357DFF9DCC560274E29B7966F7258 +421000,k,61FCC6F99F53DBA8834892256FBE93DD1CFF80A0DD9CA5CAB268F3E219549C43 +421000,u,C5FE81313D2D7940581DCE8C66E6C25522AFC915078BE072A8000B67E430D23C +422000,k,A81A0FCD97450455AE402346A63743CB6528A1D8A25B4B419E2DFE3BB03C363B +422000,u,76B3E04D58CB0ABDC7A006E2E2B62069CE59995DE7050C3EEF894C5E698BC95B +423000,k,F61DE54ACAEB48C3169373F5A28A9F43114B9A4BC23FD891D2A261315F527708 +423000,u,A6B7AF05DD56332FFF6A44DFAB7F58E4EA1CD332D8DE134430C7E13E771D0E3D +424000,k,CFE299605E8A32CB30385204F50F956EF1D10CC9675CB0ED6F34D39B85C1AE0B +424000,u,355CE462589A66307E63EB4FD4D10E329493DD7EE35888F601ED8570E55EDD7E +425000,k,45387266BD45B11C25CF96A6AAF49FCD326DB4975719B16376E8D2DDD197031D +425000,u,9A32247DE374A992DC13C2784D2D9F66DB5B34E883E298234A8118E333742450 +426000,k,EB17BB60E3FC4BC71C507DF8D243DCFE1A1E8402349866EAC4147048CFADC85A +426000,u,BB5361C2818D544A87D589ADAAEA545B3F70FB1CC253BA985D86073FE2FA324E +427000,k,988A86E7148FA956714FF7E14E5FD53AE81F8FD46F2DB4E5B409217A0A8AE718 +427000,u,9D44AED1E604DA1FFC8AE26C027C0D9BDEC998C33519040C5E440AC8321D587C +428000,k,7300524270512D4E4F2E2FB12F3E5F263513C05594A2E44081F15268E6A67F19 +428000,u,1774A5465141536CD532FEA6BE5145C3A54132A468C1ACA4271DEF73BA0AFE19 +429000,k,00640867EC725CDAF31D1CAE3FBA2258A355B06DD36305A8BC86FF084EEF354D +429000,u,CD1442643612024399B64EAE5F9342AFEB32BE0CB6AC7296569653E4971FEA04 +430000,k,C0615E1233CB4CF22DCA07FDE7236CE281C0E574F7E49034BBF07E1A7A335B76 +430000,u,BAB7C0632D2A00C7E21B0DCBE7D47B5C9BD4CC409FFE59502EB85A6FA6AFAC75 +431000,k,2CA6A2E6B57235A685D26A95A96C9C2C824755E17720109C6858E9D00B5C763F +431000,u,FB8E77FC707B21E53D6E176C06EA855E0797A07292DB41910AC468CDFA601C37 +432000,k,481E20F59A5C8942E6B98C131B86F93481C5CD85B1011F7C8AB21168CD99FA5B +432000,u,9FA10FBF2A853081121A53D06D45894EBD394D9B335FC7CF0CB5E7B362962A7B +433000,k,5718AA66E52E8DB96EB5ABE8C2D398C46768C3392243BE6A91EE6B2BCA50411B +433000,u,D69FF1C411C6B08B04A95F01DC9543721EEAD81D55F93B5ABF673E3AF133C428 +434000,k,685735D485A5846AC185882647E37A124BF5D88A4AC739E2B0A0C3A6A1AA0B10 +434000,u,036CE4E41581B505426C4061785A9AA8F4D8D9D75BC25091164272D3540E0F55 +435000,k,D41E0C2A4C3A06A31E495EF1676C652AAA9501B7F0A9587DAE52278D7DA0EB00 +435000,u,C5BA2E4E887BC1D8C32F0301FAE07A8DFBDB3FEC4F6366A43A13FD89FED4F01A +436000,k,3C6AD9861918AB72EA92BF79CA370E950CDD3AD4A3D81B0CA957373AF9F77306 +436000,u,8BF11F7F83D913BF83A9AC1950A6F0C25AF0EFE97ECAB96469C82C2F1D177234 +437000,k,1A67630015943D04620FA94E644DD628CE583B623A76E1528938B1BF23F5962B +437000,u,3FB2BA783C3A7C3461F79C4567405DF5AA91D2B81E408DFCA3711829FE103F61 +438000,k,3620736CCA364A892E771BBECE5C413496342A3BFE388DDE8CA61E848C17A859 +438000,u,10956A5E5EE40BBA5C1313F7DE5001AAC6C0EDAC72A2C783DCFEF55767B25678 +439000,k,F4A64CDD89F0FD170E8A8A6F377DF6211C651313F1C709947BEAD66592B1145B +439000,u,9A37674F02EF58372AE8361A952E5E55344FDC7F25F3A201F1E5A6FC630CAF22 +440000,k,18E48620AFB9FA03FF0B8DC72BB0900AC31C441BA8CDED1C618D3A8322EBA171 +440000,u,98274DF4E87385FF1F13537B23B1D2DF83FD4892A32A7E10D22C3A5742327D33 +441000,k,724B80BC7532CC85025C1450D5D5C2DD221FD56B27B88371ACCAF247D24D2A73 +441000,u,1D785061A2A758F64347A19CA40979A8CF2DD3DC6A70A76E19CE85F358A54E5D +442000,k,72AAE83582F0BA53E4A8934719666DE2D20F763A9B0F0B0957F15A14391E0718 +442000,u,990BA6A8FAE5FE6A410FF9BCEC420A5F9ED7DC71187164E24441F716BD6DA76C +443000,k,35D8C5B9A4A07FEDE70D6A24D09848D2B4BEA21BE242616078573ECA69AAEF10 +443000,u,F7840A1B74193FAA56C6947775B2CC1C3D81C8468F17ECB13DEFA6FF944EB410 +444000,k,DE9FFE48FAC046C44532BC6159BCBEBCF0343A1BD4223ADDFF2161C2451E8E24 +444000,u,8E418E69FE016B92817184E9318BACF33E0A6529C003A0FBFE965F03EE768A18 +445000,k,F4E3B451780790831764AEE199F8B9C758AD18BD25110B0684B6E56E8802E642 +445000,u,01179538947B06CD8C7E61870EB18A445C46F52B9270FC6AAA21118A8577E04F +446000,k,6502C79F37C897FE7E36C2E96445FF699D67CC19BC7F25F8A623BF83F64CFF36 +446000,u,BEA54C8201CBB0B0CDB27BC586C0593D12C5C84C553C15C8623B11977318C802 +447000,k,ABBC53A545F331E2F2B0F605B262BCC4C7B10E6D8F32627515FFE4520071C469 +447000,u,530BA80C28E2B91B40ACE8DD8FBA724F3DFB2A21414E28A2A0717DC717DAEC66 +448000,k,5116B3CC5F378ADCBD5A4E61C4F31A6203EA594E9E9B4C0EED8C47A3B4F2F709 +448000,u,D2653E8BBAA60BA9C53F3189E6438D4AE724875FD5A1D03346646A29B111E81F +449000,k,865A3349E8D659916D87FE850256AF789CBAF5A0AE29326278D70DA042F81545 +449000,u,E23D6AF538D3A53DE3A71B797737B8F13D68D1D8DD9C1056962E9620A04E5F51 +450000,k,CB377C67F617930BC057B8A29BED4D52538709802889FB165EABF42F04C44750 +450000,u,B16F0C60264A00B1B3D8FCF15271A6238A1A11F8B4AB7AC807652B9A28CD2E69 +451000,k,43DB43290AE9844FF155A84A19A9CF1AD60878B4F28E3EAC1D74C0B05B81BF2B +451000,u,3983648101C31D2B866C24D070E2DDC9683B44E1F88055A332A52804DCAB272B +452000,k,E18B11080F5860A1061EBABBC6687360C64F9A27D01ECD5F24466A926C946100 +452000,u,F840DA219FD816476DE4A7A16AF051D0C03D60544F777AA279DF1A6EBE59A302 +453000,k,0A37BA97E99C11358B87BAE99834F014ACE970F5312D728149F732177A81D37A +453000,u,0B21FAD28161C6D4B10A02D08D074538D571031BBA07C4D5528F2E3F1BDC742B +454000,k,8CD8FEA77C788D0E1690F90BD681218BC20153D9B767272471216EB31416B010 +454000,u,AC3091FF2413B9D901EC22414C3F9CE776C3654A2007415C15E2C17DF6531578 +455000,k,118626AEFC3E0453D2B9443F84379F03AB6E978EA84B9A9772E11DF4F2951641 +455000,u,63264767C09281FD326646859BF67C68A0C0757644A6D60F60677238F0E54835 +456000,k,13AEB5EBF742F7A59439DA37B1030E50024801B816D325C65038E3AE298C6C0C +456000,u,D080160ED4AE468404396D3EC660A1439AB161522238B7D14DEDBD0B2AE32A74 +457000,k,64DDDAEDBB75AEE69BA9F2DFEDCDB1E04DF7D5CCC821D11A5C0E4D8B27570674 +457000,u,1EA8EAADC50AE8E4981A536A51E3E708B0081309743225D29AADFBA9B0B34175 +458000,k,E3BF4620E1D0518EC96F76CAB7CDF185F45B01303E4EA2442707126ADEE20E32 +458000,u,AAF582233D11BACC46F65362FA188003977E55BC3E720BE8F23EC6621189115A +459000,k,DEB5DB7AF8153CABFEDBC4166C4B43E04D51D3AE14AD899F1A02C162409F685C +459000,u,F4012C32900AE8361C9E9AB4D1EF2B0D8AEA869934C91F7430E8D4920A9F2274 +460000,k,9E8598AF47EA5D7E637BB4D944D52474052B061BBAFD75DBBFBA6F10BEF4B872 +460000,u,FBD7659FD1D372ADCC97AD64BFA1CEE32A8BBED307B7A087341F172C81A63003 +461000,k,9E8CF739932594EB26DB7BD40AE8C22F48623C7FA860935F0436BB896646234E +461000,u,0AAD907D6DB5A7399F27FDA7DE1938C8ED55A9C6492E484D92942F837ED8F274 +462000,k,6CA79F6C8539302F516FF765D90CD8A775AF17C06B61EEC77B240691FB8A3A2B +462000,u,00361B8EB5C424C02392D2AB20751892C732142B8E82EA43D90389CCFAEB5A54 +463000,k,FD1269D0F8F7C4E7805D61E1B493E23BC013493DF7C08D02074A5E8C3B357C49 +463000,u,13951574CA01D4C10D5D486F74032B0E33A9D4EEA1658D0ADDC5F06667917F7E +464000,k,2B8653A0363423F91E94CA4377FAA68DEFCBF30F8CDD316DA0E40EB859025633 +464000,u,E4C5EAE4BAA90AADB5F97CA773EFACF721A43076D085E8C596B3A9E934D0D42A +465000,k,0DD3867EAC954D325B19278AA455D1A06BA49401BD9D20B30A7E4784549D2B10 +465000,u,1A8F3953E8828D8F123F9BC1C4437ACE6DBDB08878EF20AE338F0FC15B470B4C +466000,k,B5CF019F14780CAE1D69276EA8EA96D4DCE2DCFE35F3BFFA1DDE60D219662541 +466000,u,9B7192FCF14AA741F3ABBC71660715CA9BB17214D2E0AF614B9EE65EE8189368 +467000,k,78E8130E07E5C0A49E8E94573622D7ED29AA530228A8D44CF6E87C11A168B64F +467000,u,1B23EAB848CCE206FB05C02D72A1A14D2C13C639BF583D722DB87EF319E4394E +468000,k,362D047978D4B6E281337FA7E943B16CC58D327962C2AAE58B3E84AC159E066A +468000,u,A795E02AB22D74E999412A4C400E8D04B5CE1A088FEA97C97686FD59B83B8A02 +469000,k,26FBC48A173B865C714093E33B844B38031651C7C642D81EB47E68589A1A046B +469000,u,23CA92136E2608DC2F8CA9C94BF79BC1C3D496CF75D84A7C729CEC6C1D2FF724 +470000,k,695BA09816AAFFCBDCE296D244E928D4ED09137615E54F8E570DD2409BBF0931 +470000,u,8BC80E3FFD7CBA7E5441D0514487D2AE23F2C8BAE0D6FF949192D3D71AE36535 +471000,k,7EA693E04991B057FA00A029B3938BDAC0E5D07761FF1E9963442469921FAF0C +471000,u,C2062D5586EA3CAF6CE2D7970919A5AF8F81AD432872EBDB7A88E5EBAC7FDA35 +472000,k,6946C1BBE7AE768E2DB580C15386132E88B3073226D41E9906D7A9F085BAAE78 +472000,u,8018BDC6348FB284FBF159DF8C51CB551D37C4F049FF0C772BF8BBB0B8575B2C +473000,k,6D3FE996FF580BD3833F9285C140658E0ADC2FE26047C55B13705DB82B03BA03 +473000,u,B57B9DCAF7543D3B5943B5943CD510467C35E5242B9D12E44E89FEA448414A27 +474000,k,0CE0207B79B23A6F766829C850D4C84D581C3F3BD5920848C21BF21902081701 +474000,u,E1E0FB72AD3C1966498DB4B527F55B1FFEE4196A14116A165F96CFC648183911 +475000,k,854C759A86666088A9BEE7FABACBA76EC09E1C617E4DE540F40B4DBE67813B24 +475000,u,9A4DDCA9B3B04DEB709B3D8EB840BFD2130CF76F8033445EA4BC80EBE4CDF053 +476000,k,089778927462709F70868C04FA9F06882AE85953249954B99AA998EC9B4C8661 +476000,u,88FC4118ADD4ED4E3A1D5C98DF9514AFD57880A05767F1481F2893A700F8EF20 +477000,k,091358ED14B1BAFD230952DE7F368B5D679706A5F3EC639C67CFBE9A2FC02567 +477000,u,24615DE66FA830BA9D4E81C6E79C6097411785123F642A01BE9D547C3F695D54 +478000,k,51ED06C93A865FD8CC183241EDBC35E7DFDC73297CEA7D200F50C98ED6C44D4F +478000,u,4C4E58500F2759B963529EDF31F2C7EB58403ED5E7A9751F1CA31F0B9AE10453 +479000,k,D5F36B7DDB69FBE3A86E79F93040CA7DDB907AD4820020B6C02F467CBB02D503 +479000,u,80F5042DB9049626789FD39483073345FB5C83F9F302EE5C35908E2D2FA8DD2D +480000,k,475CDF043B8DF64205A4FF3F3EF3A2978F709AF3E984E0F7C63B9C3943CBDE6F +480000,u,3645661B16EBFD3D411CF6BCBCFAB3FD7F0E9F5C7DF2ED59D8D948A045CE1270 +481000,k,03D9C24C2F8D81C9AA6B5CE6FE744EDECC105F20F01035ED2ACD07F7D0390348 +481000,u,B9BBBA902D5DC1120E05F2B3CB3F342755E27D5F2A66956FECAEBB8774133569 +482000,k,464B5750D694255D64CDBF49274292DB0A2AA55153BF0337607AF73222C9A408 +482000,u,41145398FAB1337F21FE09326D0C9926781D9CFD16E02E3E114629BC4491D260 +483000,k,913A2091528A7937DCB3D305BFC542E9B48FD2C07BEED040EE0D246BAF771C05 +483000,u,31F924CCE22A69FE487707735ED2F966991B83D26D6D9341CAF28E5C2EF97848 +484000,k,7839DB5199F21BAD42918DE9E7AB5983B5DA3000009FAB90DB7ADD4515ED0D77 +484000,u,FD5318AA9BA1C23366F3926A349B69092E4E5D1D39865FE83C42D04D5B728D08 +485000,k,2D3F2CB14752B8E5F798582726D2F8BBAB340D43C65B9EF7C610F3CDFE81632E +485000,u,56E60FFD9BA4ED055381A5E2C6130CAC48A5A52AD89499BEAB0E9AFC5889217C +486000,k,E41633FB5EB31E9BE3FB011C7C4CE47ACE3A3B956CF22C5DC0D57B150B86CA0B +486000,u,881FA416A821000AF077CB537BFC1AB937E8AB08EF37FCE26B1EF54EA78F7454 +487000,k,AC7C1F1C7B97F71916A56024F8D739B7BC2E187D0FF515AA2224810B9EF76930 +487000,u,BF80F9A14A2FB61C469FA2272E5856554CB01FA74123CC586C907EFA4284754F +488000,k,262510532412B2491944D1692E40E6BE1B7A35E603EC68375E6AAEC82A6E7A53 +488000,u,5E39E1ED9913F79B4D6A42BB7168CAD622FE10BE4C1A0E3705DC811A6B5C5264 +489000,k,209AB02B154485A5F1D2F43B1F5822D60A7870AE3F9A1D07454B5D10DB28A662 +489000,u,442121483369FAE5B86B855FA634B86FE93348B9271701BFFECE83A9D57DAB18 +490000,k,C72A8DABE218D21E05C967A8CFCEC3956CE9AF57268406DCC426D9C56025E574 +490000,u,A1238093AAD444D1A51BE6AE6290621722BA4EDED002D625A2D5AE5BDBBD9A2D +491000,k,74E0F499553B27836446D056AC986CDF827CB8C7E823D5D0BE3B68BE7006175B +491000,u,7786CD85B31DFBFFE60756842A1C328B5BE84528CF0FC976FDF6435BD626D352 +492000,k,7EE63B66A01926BE67BB03BF34309AB8BCEE31C971482BA6D126283A58967534 +492000,u,818F9DD6FDFF1C039ED440EB382AC076C532D69D4CF6C0A66BEC0EE3D00BC318 +493000,k,AAC1CA6D2E2C7E9A478267CCC1D86CF6688704BD729F6F65F8F8BC3F07D94E47 +493000,u,D5791AFDB21F89C5A67E4742BBFDAB2F27D92EAE9F4563B5B9CDB064A6AA3C08 +494000,k,CCAE6BF5F8929BA22F5AF0D18DDEFC6C8986805576B1534DE9274EAD1DEA0E38 +494000,u,0A6547364F9D95F0C1ECA428B3229F52214F7E649606599336BF6285EEC5347F +495000,k,070C467AA087602026EC5AFAE79A542C2D6F7DBE487FD268E5EF92AB95091E75 +495000,u,F3CB498DE87A9E5112D04950B3079AF8D279E2049E40BFE83EB6D3498F3B1F78 +496000,k,83022ED0C8A106B12E7C123337F1C718306042491616583B3C44FEB3AA72320E +496000,u,234302B2FE6FDE97BD00BD9C6068E1FB81466DAF1C7B002683F9ED09C022A17C +497000,k,976931437AD786B2424C4F0898FDB792F126BC29A05904948DAD18269669E838 +497000,u,0B1C2F495B3D8D996485FDE55778A057ED1B4D4E8C7F2172279D5B8A9CD74621 +498000,k,06030FBE1C51B0EFD52628E6053B0D94D5F451354D6158581CEE1408D88ED042 +498000,u,88C851ACF5D4C866A215172CB14DC1A6796C9E7EBB88C6BCD50BF01B52EAAD09 +499000,k,98E46BD58563109FA3E3CFD9F2E5FC95CF6F303E1FF90A6BEE6130E85F2ED71E +499000,u,E30871128D1C80E400E9BB08DB4CE51BCDAB19E9CF510BF582497ED4B311DA11 +500000,k,EF134A6BC887E43772479C9D3EEFF8FCF5F079BF50F38C3EBFA159A391A97616 +500000,u,1F47A3AAE82EA65758BB66A0D59F7F0DB5614763C5CC4D2A5F7291E1FE67280A +501000,k,5B5036E4942FB08A1223E4C17A3E8535BFC3E1272B20B1EFDC3C63C556FA7F17 +501000,u,331DD0C35F5B9682114C99CF41010AE8F5B61FC4802E09823A640C8F42F40C2D +502000,k,5760979FF00AFC0D63C69AA7C6FADDBCB89234504486288C122A36DFA00FA243 +502000,u,B7F5EEAA42AC8275DA1C1AB5F5904AC2E0695A2CEB9D0379AE2843EAA3CB107D +503000,k,583F78D6577652E79567060D79870C5941841F76EE31DAEED79B21BE2A3C6F65 +503000,u,CEF1DC834E2731519E22054107384C32BB878D9F5395BFF123DB7F30DC4D5774 +504000,k,17BD73125170BF75225E1DED13F7D33EB72B7ACADB476390D5946E02B9326A40 +504000,u,A12CBF8ACC681F3CBE8A60A8A77FF27A5AD1EFA4A8AB804AA9D5D9E67598C447 +505000,k,4FE76F1A0FC0EE0471DC18D0942D86EC0807871DF723E647FADE181A72424012 +505000,u,E0F5DE24BECF77E0297DBC159A08AA914F98F5B48A0C68EB814AC71C8F239B54 +506000,k,F78E21B6E65AB795B862C22B994FF8EC6A33EC2A19AD99E1627950F5E3839071 +506000,u,30DC99910169DAA1D45438A7FB7EECEAF0552940016034CE8CC19895CEF39819 +507000,k,8A0349BB7E7BA0B22D55BC6F061EC607AABFB6F44A5D86D14A34CB67B8409563 +507000,u,5607C4B148EAB98FF56E8616F5F94E0B6781933BD13A5B2AF17924C429E54708 +508000,k,295DF4ED6475C2444352A76AC4CD03A158991EA250515BF4E79AEE8B004EAE43 +508000,u,D77DBA5B4F1D77AB13D433EBE240F14146FC2824DF04D26DC6099BAE4AEFEE5B +509000,k,9370DFA83F70588668CF2173B4B0BD8E69BFAF4DA6E62F3F60241FC2AE555F39 +509000,u,F6F45517F1E74E892E4A54C1B561997F5E826DCB495D519AEA08EDFE9B9BBC3E +510000,k,4DD8317EE3905EDC1D694D105BE27D628F82EF3151449FE5710DDB7F15732E7F +510000,u,263D2B14BFED4241AD787857DF33163FDAF263B77DA0BD9AAF215CB0CA73457A +511000,k,79C1B1F7B7BC76389528701DC01B005EBFFF13C5D0926A5E724834A4F1516D50 +511000,u,46047F95244DD35164EE914CCCC8A91B85ED33C52B309BD3CD3D6AEC23EE2928 +512000,k,0907F260C114B27F1FA32B8C4F1FA131AE69600C526530991DC626D168C21A00 +512000,u,9422C9BC1DA41FD2C5B6356E7C458C66A5BE4B54AA16689675B1E8283A7DA774 +513000,k,BDAECDA9A144497138255D4E2663E44C05929B2064BB8D5BC080C5AADF8F1C50 +513000,u,258D50B9F719D85D949733FACD5CC26949AAC698F19566883EF72630C9197347 +514000,k,60886B7DC35A9274D617A7762681C146BADCEF4A3665716D52E17601A134AC3A +514000,u,03CD00B550E728534AD4E442D498AB5A4610BAC2156A3210318DDD0B296FA22C +515000,k,AD8C45889D3AA035C20F2DE70AC87BDA6ED634457A08AD0B130FBF4EE6275109 +515000,u,A8DEE1B1A437648CABBE142D67B693D89F109924F736814387BAF405C2498A2E +516000,k,26A234BC802E410A7E36ADA729E8590A4E1D3B06B0179A1626142F3C01D88F74 +516000,u,19D8EB3FE104E003F6C1C82A09D4F02AC6834545525689A780F1D432B97C8530 +517000,k,82A5F5B97B8E54D496FACD8E18BD33DAEE38613F962A3071BC30C0D30659AE68 +517000,u,FCFB9BEFD8E69F45AA1DF2D029F46032420051F0BB68E01147206AD3E0E52925 +518000,k,81E8133CB8C3157D9BE1C4644729F2B5BB3CD0C970E80F6CA656B5F4AA156C26 +518000,u,F21CB594FA81A8299B4ECE167DC29816D613B28A8CEBB2D2750C4AADBFF31178 +519000,k,966D5C812F730DAAAC28FF39958AB25A40D7F67935259A21ED69D08631815D17 +519000,u,291337DD780D042640E372632945CF4E5E4B561EC4B2423D596C68EDD356E326 +520000,k,9EF76924E166488F5FBEB17244FA857E3BFDA534198C29F5A0EDDC821388146F +520000,u,55F8E5A6D29CF1586007624CD8C21D66AC9B4EDED72D7B4F0711B96EC9678F4A +521000,k,490C40503D499687C35FDC9C8B5E32F85A1EBE52A490FABC020EE3FF838A7528 +521000,u,392E1C2DCD8C5B7F65D06EEDB14D33CF739EFDDC5FBA0C5B65ECB6CDA0EB7A0D +522000,k,53A1D4DC3B18D7B69CA03A8A358FEE017FE249BE2F5A4FEDD6B2A8525B72CB07 +522000,u,367BEA7218C76536BA56B6355C9983ED609A53D3B678D06418700170330AC570 +523000,k,281BDE895BC175F986E48C6236D4C5FDF5D1FD69FF75FC356661EC8230C50F04 +523000,u,70FD0FEBBB26C529BC3E81BD46B692CE237B41921251991965B2811C2835BD45 +524000,k,F9AFB8405A66FEDBC887DF005D1987817E54FD02D312F187D12B2A59FC1C3A54 +524000,u,7FE2789413421883DE45BBF8596087E9C25084219441ACD106FE1EEA3F5DD203 +525000,k,DC5E3AF638CC03F5BC2015280ED808411038E09B0CF53A50569B0E15C7B17F3A +525000,u,ACB837DF22F8CAA8422C62071EA7723755873E74B4D7AAA484A1CAF986A8A646 +526000,k,2A0CF5D5321D1C7A1EB4C483157609049FB5E48BCA5E6981CA47728B9853226A +526000,u,E08A21E5C481EE36EFE87ED55880710731851DA3870CE625D85FC695395B7917 +527000,k,1B59AF3A0FF292617E81E7CBC9E44426955631B005B5A2BD36A0B69743508C74 +527000,u,9C549D772CF1BA5D8E1259B24161858C8AFC8B22A3BD6EC93F2F36B9A7E2990C +528000,k,EB27AD80BA2A427D945160B0EC2306CBC3666530960BF226D27475371947015D +528000,u,BEABE09A8A291282B1EF9D13C31D6796085D4C3D3F6A50BB11D93B8022B96413 +529000,k,E6BC3E82651C3DF03FF9655901BD74B8A9D23E777B43AF15E8F3F8FC2A97735F +529000,u,155C45888977AC6D2D43D5E16CB44FAEFCBD15B437A90E0677FC5736475BCA5E +530000,k,B797B3849E08A72444C3A6938CFE277C57600AAB9435B722AB777BF9C4D0567A +530000,u,81C237277F8D64BE1AD29B776C7B2C51BD1774DF9EC2ED280E8F73F8DF5EFB6F +531000,k,E8F2ECB86CB7B43124B40C916CF408CFFBCF4E1FA0049CC1B1462F804D92801F +531000,u,540777C085AEFD3D45080483604C5E9F648CD893970B286D8119281E3BFC8F1A +532000,k,CAA8E0CACA37B23CB610BF5B02D5C02BDD000C02BA58D0142032AA0734BBAE6D +532000,u,42B93C17B81066B9B16BBD7CDBC3313EDDCE773B3D5AFFC806F5AE567C719931 +533000,k,F9F07D9814EEEF4CE9B606D9DA7043A46BACDB4BEC3BB3D023499FB730AFCE44 +533000,u,665F8AD1446AC9FB63450858F5CF7CF3D55DEE390F1EADABE12DF0240EB5B711 +534000,k,AAF173BF7A02A2C153ACD14DF534015087049F0203CD57F583525E8054338D67 +534000,u,54BD48F50CB2CA82601D4189EE9B6B8AFC3D69A70F29C900F643DF49D9BF0230 +535000,k,1245DB2F7818B6C250B5AAA093D5FCE4615D1D1543BF416C56C3A75FE2348C57 +535000,u,D54AF47260EDB4CAC05118292EB0ADBCCD64F7F24206D01B18FAFBD55F516E1C +536000,k,BE57832923EC704751A21FA2666C4CBB999BE346D28318F1C51F7FDF1E3C2C55 +536000,u,D022111C337E1714E5D9C08D76782A2010422BA59EF86F0235DAB74F39304436 +537000,k,FAB78F48AA11B88541FEFF5E3A5A20987D8BCF03134754E1D2FFC9E99A9C5803 +537000,u,81F3EADDD1A61A9826E40D7F5D91F308490B4B6D0329A91E921C0B5C557BF87A +538000,k,7A9B027DF2058515327C7B5FCBBE2ED6B25A78639D00428299DC858BDE3B4F4D +538000,u,2A989905CBEB77B09C3E28652A67188445CB5E2492958C5248FD2D9068D6D978 +539000,k,3EC04382C1B4C9EC66277B9AEBC2748A3619E2A1AD456E69C400C3288508303A +539000,u,7E46A7AE6E3D10D4B580F915A409F098FFAD99B87DABF938581272CF2799263A +540000,k,A2EE30613FA27A647CA36300CBFF2D3807B0DDF1D5C2947E767BABF7621E2F3B +540000,u,35651D21213B8D8E6A0198235E5D3E0A0D5EAC1B0BE1C5D21CD974BA4632B850 +541000,k,9CC43C92B446155EDB79D8EC50455D5F31D17A8138DB543C6D039A7DB1455978 +541000,u,262D4A6D302FB8FC163B4081EFC8942A848DB47D6F133EB2A28E63CD46403826 +542000,k,0FF726FBC4AAD34C6194E7053BD20308DADA31E812F3CB1ABBF65CF01D4A560A +542000,u,E108A97B817082D8B2E9CE128F0BE457BCA78CB6EE48568F3370593C5C8ACC7D +543000,k,E48167AD76512B8AC8219F0E397D6FE6EC42A19E16B738E49ADF46768D80D05B +543000,u,16C66CDEA4F2C7F7EC4BCCF1D48A34DA89EFA31B2F4D47145C744C13B7902971 +544000,k,00B04CC1F0D22AFB6EFFB7E7100402309AE263E0D65ABBF87EEAB19A2F7DA922 +544000,u,18BADC8A62F725CFA9415DEDA28B207D4597D7C4345B978972F7872664170420 +545000,k,DC7542C3685185FCC12C50F82B6A8221FDE8D2283567C06CB9EA7B541959BA38 +545000,u,30F4E488CF53C66FE249046B1F608EA16A4C5018261C7AFC9C68BA4FC97E1576 +546000,k,8B56B595009683A90C6CCEBC8BA0226A106C107EC5F58D382F7B7DCB7CE9986B +546000,u,04D696A818DE695C4A565F101C0FA9DE2B856CB0DB4E25285E0B7CBCFDDA5049 +547000,k,69139CD583826282698903FCDCB2230E103E07973BC29C5664809054660DBA4E +547000,u,C04EE5C2189D9E0CC1143BBA133971DAD889AB6AF98C6180D55369DE17F9FD03 +548000,k,A7ACE2852BFD46C02F810F4FAD63B27B53F797F90AC1D897B2A9070FA8A33650 +548000,u,182F788639A109419CB6D7163558D829599B33D04BF426D4158AD8FA29F01104 +549000,k,B2941174D162A28146165EEF37A67305EA402692BB51EE21F9834B76759E2C17 +549000,u,FDF301522829121247C39C7627DB55300949C19F2B5ADDE8174442978D2B3934 +550000,k,9750F4E2A8535FABB12C27E4C72C3368E4ACBE91BBD92ADD43A3E95BCD42B723 +550000,u,717B8A1646A2ABF9D376AE1D1333E97488E37E21ABE3584DADB0DAC6A433FF20 +551000,k,F85A8416C418F2EDB508820521DB18301BD195684FBACCCDB915FE106B6EC953 +551000,u,3543C838FC698DD2E43AD543C4E0AE2E6F23ED98D9A6B51AFFEDB9621A576264 +552000,k,11CB1A99BF23D4805739FD443FEAF0175BF45FA70AEAF61D5BCD02CF41465274 +552000,u,6ABAC61DC5CDED08162DA16EA0D099807976496FD26CDE3EDDB8ACDE76CEE865 +553000,k,AA02A20D86E3A68CD19B3517D12342D1BB0A58DF59D11624B9B1AE5771E40965 +553000,u,A967CC1BD5A30BF27230B8549D0A435AC3EFA94E7A84664FFE91FD746C1D4F20 +554000,k,2AF83F41EF47C5BB4501A664B54722F1D1D79C07FF5929625C5E27B4B942D245 +554000,u,DB5D936526AD0E5401A499832C1EE57D74CCA4A5857E1A62E1D0091B312D5210 +555000,k,E77A18F0E67994200CDDFED8FDF0504018B44203D4E6C201E15D05E5E59CDF11 +555000,u,BB98D2C188BE31D238D0D1278D9330D1A7AB970257F286C3866028BA57DD4423 +556000,k,1CA841F662DA7E5B78CB46A198536379515C37C5CFA6444B88B55B401431FB02 +556000,u,E3D4672AF366A88142256A9FF7B6A623462625E74E7CB80057E37B39EE68244B +557000,k,AE9D06E9F536FBC210EF32D9120A3787073CC056652A6765ECC42EB859C46929 +557000,u,90DDC359FBB759209A0484AD6C04E2C598FE9542E8CE3E4298B4687270EFCE42 +558000,k,7F3257AA873F93ACD81C7B6BEF3A0E10516B768361D963E53D272BBE04F7EF71 +558000,u,5EA2CB0F848242FD15D101C8E29673B6C5FD47E93B42675A7AB45CA7EBE86204 +559000,k,C5412E7AB88112A654A9A2B69D3F2F9B58C1EAEC5DD6C1E17D5FBFB4E77E7D0B +559000,u,200940B0C705BFDC143FB91974123E1F9B79D0EC24A16FCCEA3E4D1081FF184E +560000,k,16F8F26868DBEE3ED303AFEC685BA6ACCEFE967EE0E213C1661CB0017D69FD0E +560000,u,C4C8C95C149B9B8FA8AE79ACF40F76F02D85B7F630580B39030F8C8C83416D22 +561000,k,D66B388256E6E1DF63C7FB46C38360C19D04592ABD5478E2B3CBF3BFE745A125 +561000,u,D621FF9A30D4282BC7B2B0561B554AF21EA9CFACC56F4DEF84072728CC9DF53E +562000,k,A9E1E3C154C738BDBC891656719EF98EF8B1DCD83936C7370C8D068619C7A402 +562000,u,A5CB2C6F912291DFDD18365CF6E07A4BAF11527B7B8558818FA64734CFE2265D +563000,k,0079E70073305166571900019E76ABAF040BF1D2DC3EDEC0487CD846A5641726 +563000,u,9D0E08A7EC313FF8FE50F66C690430EB4BDA98C3F6BEF84A4230FCA7192C3F02 +564000,k,09BD653421BCE7D0B8F608F4CED00B2BE544D477DFA2F585CC87F81F2A7DEA12 +564000,u,95E250E0EBF4F04196E26C6BEB73A98163E7BC5E33B07FEF5294C89A38A4D538 +565000,k,B386D938A823B0459C520401248ED2B4540BBE4EF22FACB5C0F0229DAB6B5B21 +565000,u,474F353762BA22F4A855F909EDCF326D32E7B637E024E7B30F186812DAF7A85C +566000,k,15F4699416FD6387999D97511B89272AB0BC64D6723FC549746824C097D4C23E +566000,u,D8F06CACA6C671B8A3B72DC2E7744790759013C3227B84A2E6FBA6C95296F045 +567000,k,838273BC6F1A8F231319382911CDBF00B18C621AC7FA56B22BB0C5C9C9D0A10B +567000,u,0CAA9E530E4F2B1A2923F8057B81A28CC5B6973777A8FBCB42755B2942184F2E +568000,k,A32D9DE8B97241F7F8B9C233D72667568600EE1304B9E5377A30194D8005240A +568000,u,143507F51EADA650C376D53D44C1A0C1EC2E32C558FED0BA891D49ECDAFA7871 +569000,k,B846253AA1BFA6601E65C457015BB04AF7733D7B81E4181D6396A759422FF434 +569000,u,391CCB945011BCC03943EE5AEFBBF07726B73BF82C9D105B0E1E036A810B6410 +570000,k,7D0B442B4FAFA8894A7AD11E30EF85954827329285A01A57D639793EB716355F +570000,u,110DF9FB79844E78EBBD824D5715F37E689527D62A79D62EBF71F085603DFE16 +571000,k,700EC77742E32AE1512507B094FF1926FCABF0C77F79A54AC47C0774BDDCFE37 +571000,u,3A7881DE565DCB280BB04D56EBDA6CD164B28F75BEF82A6D66FBBC3101EB575B +572000,k,7F387F3B8AC58B2AFE702AB64B0A5E677377287D0F7FB981C9AC5A4B833D8269 +572000,u,A3BB957DBAE86BBA14BC2545D6CB13682F101C2D41027D498ABB1D0A466BBF4E +573000,k,9EBF556EA323F2ABE7F8685D970340E464491C0AEE91A7D5069EF3A0B6338539 +573000,u,AA6487C8CEB44408461C0A2BFD37EFCD09BBB419D2C82ED2F05EA0F7A505F32C +574000,k,6D62E00C3F1D2019ED5CD3BE8410C6B1F5F8A14DAF993A78152D1E4C03A3B577 +574000,u,4BFB957812AEBC5E5302692CC8AE747117222BCA2257F9A1D0A14CF3A23D520D +575000,k,32D808E4C88EFDDB65948B6C7CF8086B17F9AE8B33AF63DEFDDFED6ACC373E18 +575000,u,81FAD986BE28F2DBB96D7C24FD71CFD266305C5C2C73382068FE2AAE4D96CA6F +576000,k,C9E7C174B463B119F031F933233A504EC74C421998E28DAFC8069B64CE9DE07D +576000,u,0D4B7B29091FDA81542EA089A747B3CB830437979D0685A77375A3F2743B7570 +577000,k,850B91FCCB806B9F73306A8D81E368B6F690C74C7D334ADA93A47C4CA3CB3249 +577000,u,92C762310CF929550DC2E6159A7FEF0C4744A7CA22218D85D20005C61C2CFA3E +578000,k,39CABA7D88E485AF7B411FF9F12FEC91738E372D7D6DBA453AF8A5C4EBA56961 +578000,u,0EDF16C55F30FDF3D438C9A1A49DA7F1E3679CF13917AB517446D5E396F1AC72 +579000,k,E012F44B8A109A4C28E5326E9C93B079E7FDD6091B8252CFB4CE49E6B309287D +579000,u,607D9B1427E708CB46123B5ABDEEEE5C41E27E7823B24DC8DBBF82405D658137 +580000,k,38DBEC6BA1248911ADB4C81D6B20ECD2663A3467E780BCB5971586C19C305213 +580000,u,C068597989DCE313B09DB2BE33A6A66B435E7E0E775AF0BD4D7E81913196B631 +581000,k,F8C3582E68362892158F387F5F2BFBFC22143AB9CC6C84B568AAF0355F216964 +581000,u,AC765257766605EB1A1232792109D0264B09E42DF7D3ECD5549B838F4B9A8230 +582000,k,99336C10D27817C590F6589B5F19FA33396955D345E2A45C417C41B3E281D86A +582000,u,04D5CCBE72AD0CAC506CFC9905474A5C9185B30AD40263F7F59A3F436393627E +583000,k,C6624DA378382CBA6147CEC8935DD9BA5D5EFF9C4C8470F0A8F830B967F01A2B +583000,u,F387CB110024F310DAAF1472142E831836C6862C8E4BBAF2D0AF341C96FB2E27 +584000,k,5FC44EF7D44020A40CD67B353AD8252DFF790DB3B984560D135FD3B791518E38 +584000,u,A4CE6B0A6A2A9CC5EF84EC242485EB848520F9212C7FE01DDFC7E789DB596369 +585000,k,A3E2E48076C57B1FAFC93E281E3955609F972956EA9083DD2CC8725E31023B4B +585000,u,1045141D0F8F63B70DF1AD00BCA1154CD720F0306894CBD435139D881D2F2F39 +586000,k,573B923B41F74343BD1069104796511EE580D976A743B47A0C66C4F626F5F316 +586000,u,B2E10FA60F97D732C7D01C8E1B0C3433F6126174B8C0F73DDA9F685B600F3E73 +587000,k,D56C60CC9646A4899888A6B17EE0687DB18993E27C5A8BD3F50914055F7F2E21 +587000,u,034B0A06187854BF59E9AF061D9BF256934F6D13B2C7633E2314EB7F58C80262 +588000,k,34DD55CCFA56B5B7C2337E72EE49277B676E6F98F38EAB911DE1985128E11053 +588000,u,C08CABB5B5712A41E052E460B17DB5E7D8C6185FFD4997E90DD70AA29AC3A46D +589000,k,725C3371EA1EBA50CC44D2CB1EA1E35DD164035F31EBA8AB850C44470C6E1042 +589000,u,74F252967C1DC7DC8F893591E39E8C6EE26BFB351E074B8B01B5DA6EF2BD482C +590000,k,2B39673E2F66E26EDE71E25C30F10F35D066E017134E7D1284C4BEAF4DA12B4C +590000,u,78D11B4C0227B174B275801A215943A829683FC3F0EDFD5D5AE92C9AE7B44950 +591000,k,3DA8D00565B9BF728AD3B4F770BB0B9EDC0154C16B9C7E01267C9CA2E2281877 +591000,u,D8C2B12750BB9AD491F86F23CAD55396178FAA820ABB0605DC7357ABEC2A2877 +592000,k,E80F850E2775F4D6704975A065CFBC9366AC6E3DDDBAE64F965CBAEDD5E1B97A +592000,u,2C45973EB71DF310CA009AE20EAF1B07DF81E0993760C5F51ECEDA17C8C32632 +593000,k,F130CA219CE77488C528C98F1092E642B2A7170833E3A131826E141316B41210 +593000,u,26F37E44196C98B1E6AD349B66BE9B05A3CD3316A3526E68AE8CE214F73CD920 +594000,k,C4D85E6A7CBF1F38D132A9E5C2E5391FB6B594EB283AE52D8AB169857F660C2B +594000,u,EB98E6C28AE6ED1AAD64F28FF9CA5A40D75F1084A6C807BBA1BC911FF1CEB43B +595000,k,023F87A5E3E2C054D92F6E98FABFCBDBE2CBA093DF1FA89031CCACE92731E931 +595000,u,5D6D817AE7C65C5166317CBA659F1365A4D297892EB07FD46C1EB4D9A90A7B1C +596000,k,200F51ED56CA61FB8B3AD9FAE07FE6043FC16E6696EB849D4ABDD84D8E8D905E +596000,u,4DA74A2C91EE88B37AF7E433F3AC568A9CA2C3435AE0F15F917115FE8CA83659 +597000,k,5CF80EBD4301785D163E8EA3B69721F6A58C0386708C1A76378CDD5FCC91675D +597000,u,622B40416552BA8A6655DA19D2EB0779F7670006AC9A78E2B9B773467BDF0E3D +598000,k,39E2BE6B194E520456C2D58EA72302B3DF730D34E8C93E86774DA331AEDFF059 +598000,u,0FB2EA9FD22F34B92E28A894444757C984EEE565D0D2FEB6BE0B84FC1035984D +599000,k,8612E349B09C3B84ABFF09F29E5BAA3461C38740027F682465AE63DB8DAA4303 +599000,u,EB5815347EB3714AE89AD12DAD24214FCBC6D32C433C9E2AAC01A3D89257387F +600000,k,93796B663F1034AB975DA7BD025AF25367FE3A57874E746BC91239D842F56A2A +600000,u,A3116C53C4B1774DB95798A929D2C8411321C0CEAC11C30BDB02ACF485892258 +601000,k,32A68AF2E4FED47C0DE539234F8DE80F0EFD325C885F8F7230FD0817A522AE44 +601000,u,76909D9CB7A673A49B955428F56CFE558FBFFE73EEC34CB4C133F04C309EB419 +602000,k,ECAC668491C6CF3701B998BB16A1754358EFBD7A9B916C7DA3F5A0B5339D0563 +602000,u,F93F4F5BE3557905B95886ED3795BC8B1F63890AF099EBF009A5BE4930D2BF7D +603000,k,0D325AF0DA797F1D7E31649CBD27B087DFA1383E8966F777DE0C952B3A52966C +603000,u,30976E4BBAC642158A13E72A0DFFBBA4A83FCF2BD955F04BF2CD85DAA30F9B75 +604000,k,887753C94930D4E760AE3A245D145F0534891B196AB4BC74BA7049813F4A5A5D +604000,u,5E81AB9B881243A84198C583643F5061A467485826DBD24015506968419D7756 +605000,k,3530026A386A2CE2287DE0211E26E1239826943F97C354F3C896ECF73F33E778 +605000,u,CFC50208774489134A81A26F51E33E82919384775CEDAC215DBF35B416D3490A +606000,k,3A03859649665CB2EB43A739C70935632D4117C9F19E05EAE814B97DF35BFB24 +606000,u,3191897F00201A88C10E350084D835B4DCBB1200101F1D2096431C47467F2753 +607000,k,F586700488912B7DE7EBA33A7242DD2AE99F79BD6F2B8D40F6E47BBAB7DAEE67 +607000,u,4378CE37A62916E29A5A3100EE95C4308D2A6B6ABA387B3E0F8E08A50CE1A904 +608000,k,16283AE234B155906EB3F27653F057604D279C87C949D8AFB31FA78FF7201A06 +608000,u,4000D027BA04E8A0DCD398D89684D63BD48476A3ACB66138FEF798E756C74951 +609000,k,5EC245FB13D33DC174A11254FD146C8F7139126E02AD6FA991E07BF4DA4A7358 +609000,u,3436BC85C7383E31F2BA6CD0030BB77B89975264F467E45DB3C4ADA5A8722826 +610000,k,708F60CC3AE0949437DAC5E342FD05F333CEC986AE0EC5C730BB35318FBDE07E +610000,u,467B0EA49CFFE0DD4B20963A1FA613D51882CEB3E9F886F36E53C36F414DE775 +611000,k,13121ECD2338E79E3AF76B381C01C0263DB75B0D802EB2A2064666C97E65FE1E +611000,u,56971C2FB666519951D3BDF1415978153E52CE16375BCFAFBC692E050F63890A +612000,k,7B4F191761B2765E7699C0F53110177C4D922FCF1ACB365E4EB15C0A36042A4D +612000,u,89DEE44E4BD81C78847B0B7212E5973A72F6856AE61BBE96206B48BEEB7BEE02 +613000,k,884E2948C0BCF94D4707B0249D0D018208037933BE418FC8C5F2B77F8CBE794C +613000,u,4201F080D24AF802A2F4BB50105C0B0BE6D945F3853328AD878FCF5F5B9B205B +614000,k,327CB1FFCFC905566A925CF04D89A6AD981B954DFB2A209318D2B0EF52A0B672 +614000,u,175E7720251A14E3E88545937E42327416FB10B6B68C582CF50788B5F6653009 +615000,k,27ED14F737FDDE0D5E49F7757DC96A70828BF0C862B21B42E2158C51C233FD21 +615000,u,BDD0108BC2053E1ABA1CDE0EEDBC05388DD20C05BFCE76F51FC4CFB2FE618543 +616000,k,BA0CF3AB41E0820D24D8C8D19EA52D4976176F5AD1EE956736380D05A1470B5A +616000,u,4C1AB8BBC59A8E40C9EB64DAFDD4BF5FC007EEB3863EBE71A3FE454E9BA24157 +617000,k,7293131BBF13A076C0C1DC0BC3DB0ABBCAA48A52C0C2F0BCBA82C78A305D2879 +617000,u,D8CE01A797EC83FD34D11B54E4D1D14652CF8D3F34EC8F3E21C780DA655D9230 +618000,k,1528ED0302B84157C121211080983FAD405D2DF5DCED47D9A3F9E8BE32FDCE2F +618000,u,6D7A80122966B7B805AE12E63834967DDD77A84BE583245F9EA2A58F5F0C9D4D +619000,k,FF50C3362AADE9A5478AA7F01C4FEE7CB942C9BB4CA9F0528CF90FBBC1549813 +619000,u,1A6CD31B2F7D2539003F9F9A9A00A4D00FF2BF8B480BA364695E741C930B4F0D +620000,k,EAB6F7C69305C86BA9F569DFA7B7005BFF3F399BE6CCA607E1F8E3388F01EE1D +620000,u,529E0944FBA44AF980D523E2E1CCA54DCB0EBB1B0B3FCE823A45D19AEFCCA31C +621000,k,DD3464B0A0AE2C55E3D11A9D4B29AC2844069B45C3DAF176103FCA6B8C500B00 +621000,u,97F7BCFB394D403E037A99BC574CE7E52B91B46A9BA3387139770A93B035477A +622000,k,57D610D42EF0CBAD89A81B5AD9EFCA8A0D56BFD8B3993CD08E22234154A30F76 +622000,u,61F972C99B3BEDB26651ADF74B9ED0CA36031DA76259229DC0DF72EA80386A1E +623000,k,F3A9F6C2212BFECDDA39232E9C5B9A76CF0BB73ABF2F733AC8ECAD00AC0EA45A +623000,u,3B5E93A7AF7C937E8369AE8C796B810934323DBE1007E097B734743B3636E178 +624000,k,7848D6D515AA265B343E0BB001A5E53503FAE9B11ACB0803C4768FDA3828884F +624000,u,F516C7FCB2C216A87F8BA8ADD5DF37F1E9FD22B994CAA4FC5101091E2C2B0D42 +625000,k,182B4DB208E3E2E27C82F13EB0EA8C6B5FA2F6A7AF1612DF7E66F13595BC2425 +625000,u,2B9BC74C282DDCA379D4CDC8B9921990F0A29A80585721DCFE4A248CF28C9E26 +626000,k,23E85A989B12FBBA69AB81F90E999891347A2657B4021DE41A84B3B30DE2CA43 +626000,u,75310DB38CBE060678976E0A36EB72330C9FA58786E406DD574CAEC70879CA2C +627000,k,EB3E24A01271C72B59A2318B4224BF43EE3FB9BA1C93023CED1915449AD2F240 +627000,u,EC2C72A3C9F4648C005137D52C0270F0AC99F6610C7E5B775DCDA2EDF31F9F3F +628000,k,B170008FB7FF0B37F27CFDF7DA99111178C0E9E10EFBB639194878462AC39A07 +628000,u,1411212EB2F631FB33B7D732CA34B753ED4F73FD2A3243B76C05CB397E710B2E +629000,k,ABF1A16CEAA2BC9A120C93C0A71BE634DE76C66DAFB5808827EE13D78DCD122D +629000,u,AA4AC4F37E7D8BC2684EA5F1D609266BC1C4B82DCE9477F756CF5FE1451F0F1B +630000,k,7F6ACE8223152CA7B8ABC865F3CECCFAB85BADBCAA07B11165101395094B7813 +630000,u,75B62823ECBB259812E83551FDF12F0B88B25DA871F35A324B1F8E5F24BED11D +631000,k,AE8818E0781E5C38817731D4D983DFA43C552456D4597DA6BC6058C66B842150 +631000,u,EE7E03215F5C0963E10FEE3C823F33AF00A7BE3755235A1BC3E36EDF28CF974A +632000,k,CE55BBFA816AEFF3F5EBEC602DCA86AFA14DC2F3CE16548F0852DA1DF586DA4B +632000,u,2CD33C677D7B9FF699FBEABEF2039AB7500DA6BED8CCE180AD78E9C01DFAED32 +633000,k,AA02E4BA19BC34F63060A50D4F1D2FCDB5BCDC883CFDF9F24AA434B8FD234F7C +633000,u,4A71AD6D12384EEC152F4956C2DB08BA55230409D879685DA7902C4D2DA59E2F +634000,k,D1222906353362491599B05843F2DBB19A3C4FE371501A50161F087D3AEFEE01 +634000,u,FAA4547C55DE2FB1652AFC7DB56509D11F1ED0D3FA713BFB75099E3173B2F24E +635000,k,54992D2F344133C77CF1614E5E3780DF7C0727FB343A2B520669E45ED4D4DE4A +635000,u,2DBD250A210B3C9700ED36674FC3D02C62967DF8711BCDA42B926A8465C90E75 +636000,k,7E8A1B7AA2DFD893131CDAEBF343354B55A705F69C51C2BCDB6F936690617D5E +636000,u,976B9A4CBEFD403F13E372E93B379A1877A4CF882B9C525A72ECE25878979D0A +637000,k,FF56B4B2458FBCE91F506E46A9C6360822E6F49F4BEEF8BC33A1436EAD4EE066 +637000,u,C05367436B9D71910C68F96F91C008AA72A46A10CEFAF20E6F3567664959F473 +638000,k,9CB46039F26B90F72F54B2ED85DCEF0AB50913131F992AE272B173313B1E826C +638000,u,ACA7BCAF4E9A8904C577A466874E12347C36AFCB0C84A05E5645C0CC8F1F4B44 +639000,k,A422BBA3E8DACBA146ACB0A88A7A5119BD9A60507776392D758B3F0DCB65391E +639000,u,122BBF3CDE4001D61C0515C65953E8B8444F5A968BAB3997225203D5B066AF5F +640000,k,01EA7F58240F313B6A339B9A063420332CBC4A6D064A87ADB920C601615AF11E +640000,u,A88632DDFF0A81B3C8BE68A368E620F2046970419305C1F48FDAB5F2CAF4931D +641000,k,6DAC0F0996220F3C9B3E9741F8C2DE6FA6FC49CC26D4D0B90A291B1682877020 +641000,u,BCC36EBB45B813FA0D2B5DDDE6A0E739D24A00872E6FC23E4E147B02BAC1CD01 +642000,k,022F167AAA86F1BBAF74186E1431F1504ED0DB577AFF5AD05C5413CCF3F73347 +642000,u,669845279B3CD5141ECA6AF36F8A75B699ECB611FB6F05260DDBCB9A36A4D76A +643000,k,BB5B7ED332F09542A91594321F087C5FEA62011180351F8979CE467A530DE45F +643000,u,E86966A18F1C6A6E46CF091CDB4E29ED137350A9A4CC819184B0A1AAA1F2B943 +644000,k,F2360F9AA8BE553ABB088FD192489543E150989AC7990214116D8824ECD3494D +644000,u,821A21DFF3CD805B3D469640BBB047480908B7FF197F8C283F68D628DE49EA50 +645000,k,E6B2DCC6696CA20FF5566433E100FCC562B582F752D9F5E53BFCFC2BFF0CAF1C +645000,u,6E83BCF47BC8A66CD3A51781DB15C95F652BF2982052DA97CE179D611F059946 +646000,k,85336C6A34E8F33931DB52A1349D1B894AEF91C403C591C60D7ABE4D06F19956 +646000,u,BDE3FA6E433B11A58A097B11FC08862B2D2DF0AB08890BA93CFF65D9E6A6CF67 +647000,k,022604AEBAC5C0C5680F81D8A0DEFD5CC59299C928E249CEF4388A949492322D +647000,u,D6432871E498741F48DACE3BA4C6A5305983FC1E63F19CB7AE3552B4008D045A +648000,k,0EFB79BC23865ACC05256AF03C9337873750712A4E94279B516D54793461BB39 +648000,u,CB066AF559670731AD98D0163FDCF9F67F21AF04335061B913F5658BE7D7533C +649000,k,94B9BCE6C9E81298E70E271547F213091DCB9E24EC0A0F7CF9C042F3FDC96B5D +649000,u,A5170A641C410FA13BD52CCF4AF3841EF0CA2A47D0CDFD276495A4CB6F5D9B7B +650000,k,D24BABBBEC464E030D06FA1CF7BC7DBB1B7E1A9E8F81C1424AA8A3D08F88FC60 +650000,u,F62EF3B2332AE75BEB22E4798BB3F75D55C2A09DDF7816C34D5FFF8E5053B743 +651000,k,90FE1057B9080872BA2EB9B4D66A4BAA80EBF34B3E82157E7F87C56B843FF02A +651000,u,3AAA5CFC7253DC0D7A9832BAFCF50E62B9E522602EFD55A15059ED7D0B235871 +652000,k,FF3A5CD390BE0DAF3E693175E1E6EE4E3F0DB4AB5195D683ABBF54E26646923C +652000,u,FDC32B25964BD996C1DB7A667099C144F635B0B8546D316851F1588E23972E19 +653000,k,06E5260CE89284A6F5F0CE9972ED51C9D21311BECAC314D477884D56C6B53018 +653000,u,EDAB5CE167A90CCD3DC6F930C6D58E1DE5D7D23B3E7BDF040A4D4505C4FD7C33 +654000,k,1241B56A5B182C46914BCBB5A1328B04C4BE8E5387D361A805C074E2E408461E +654000,u,CBAA1326C566A0320ABBA916DB52FD161E4FA1AE7C0FD7371D0D36BF6423804D +655000,k,4D0C0E75FDE222C0672E9AAB01DFBE5D222AC600F74DC534447636817090091F +655000,u,176551FA34D45BA812D4375F808DD2605F46EE9ACCB398DE66F3ADBA357F0605 +656000,k,B13C48123AA0B0047F3DD5E00C97B26D1FDC5CEFABD995BE5D879AB8B5E88160 +656000,u,E8640A1094B7CF4EDC41C566F402563EB9DF9AE1FF6A32FA19C6CC1512D9A23E +657000,k,D389C355F174C961CFB922F6DA81B7B1AAF51AFF677A475719A1516B412D7C73 +657000,u,557EC3F45386D3AAD322BFBF623DD8C7105C0FEA3CC750342D49AB22512AD441 +658000,k,FA1672EC9E37DC01E9F1B92DF05C4BDDAB70053ECD98ECFBD262D0F2B04ED755 +658000,u,341EF8B59D86EA5915E70CE7CE3DD00954365D73B379B0B6782BBF2180F92E2B +659000,k,D75E634F59DE0CB6BFF1D2A1572A23592A6187B2F9C221D230D305B786EC3073 +659000,u,C6A399EEC4DCF0D3AE955FB305B2C6339503ECCE45A42255C13875213E314F13 +660000,k,FBD60EE8EA9516A2D0F00C4D690D6FD6DB284C186516DA7953CFD0F0FA8D8440 +660000,u,248E3ECB7663B7BD8B83F6E9A46A00DB28B09F35F4D68B3E3700612111825924 +661000,k,9A0939BDF4749FDEE9D852B3C21B82A54771B66CB2936FFE322300136CB37F0A +661000,u,D368FAECFCB92C1BD87E3EBA348FECF3C2E66C7F0DD1510C5F23CF2D26ABE205 +662000,k,2DF0014921D55BDFBE217CDCA3A6AEA90E3C1513673C0C02126B557928279710 +662000,u,DCAF69C097DC8D9636A6A64983E4B05DAD23683A62ACA45AC695488AF4EE4A4F +663000,k,05A51B80B190DBB34275D26145B54158371C182C78B370B87BD6FA2DD069853B +663000,u,C0EC52AF5932AF8E70D2266E3B74C097EC6588037429D9533988265F61FD054C +664000,k,F2D3CA647901E0EDE6C1E41F4C4D8C7736858DAF1493F89C140D81AEF032CA37 +664000,u,B02DB37EB9C9BC46257CD40B0C4F54CDD3CE89E2F8A8EB7FD0685083CCC64E6B +665000,k,71314082D2724DA3BED766820C18044D6E812887A306E30B3E124DE87A48695E +665000,u,8F38B12DC0F1F758C8306283C9503C86D95CD7023771D9A89E174D939CEDFA13 +666000,k,FAF3579510DF3010884BD04C2AA0A32431AD851A14443646680943B7104C770C +666000,u,079EC4F6B32570C93265B154A6C99E99146526A8A9D12F1F4DF3543D116BEB1D +667000,k,93A084140EAA138ED2CEFA058D64E1E465B1CBC9DC2472CBF99EF0BCABC52443 +667000,u,8D0CB8F770329E13E9C448977CAC0A6A728CC362EEE48FFC429C27F859A17828 +668000,k,39224CF53395F3FA82FA4599291C2D18E40FB6EB89CB7FE5FB3A33F4E3FE7D7E +668000,u,EBD0C799625EC6F737247742F1D7D59A9D6B5D9164B271AB3A3E4E0D941E1D30 +669000,k,C7ADC16922EB85C7D6369ECBC7796B6AAABE89CD36AD7BA9509458F47DB67760 +669000,u,6A40CADEA682F9F05EAE3E5CF33769FD61D29A91BFF2BD9E2ECC32415B30B929 +670000,k,8FA189832D83EEBBC69913045C72C7A77D756C9EE9C19C5E5D747342ECEBE432 +670000,u,6C91CB3EDEA3B3FD3EFFBA5EAF7DACEA2D40B133F107295AB262E74325D8D621 +671000,k,03004FD209350F2075F81E89F4CF6EA2998D30FB8B186ACD6233D80ADCBBF42D +671000,u,41BA9779E325125FD24BFBCCB0B19424936F441C79DA28BD58B19FB5FFBD5D70 +672000,k,338B1E9163A7773397A34D83BD6780FD6B6526FBF8F302A19B4DFAC04221A351 +672000,u,B46C563434593F84C5C9983B029FA7D1F130AE6F2BEF366FD984AD7B7540F722 +673000,k,821009610C850DDCCE6FF470B108C3A2351278961BD2406DEF7DB20C52CBF569 +673000,u,085D9A9C94162ADB19DE73DAE36BF7FC0E864D87ED2E1631CB6BB43C2461E449 +674000,k,7EDD4879C00E0ADFA0E54B624819512D04E9E4638A19FC73332B4F57A550BB3C +674000,u,369F6750123E9447AA5607F340719CDD17E42B6FD4F082254DF9C53BC517494E +675000,k,D34F88AE72FE4ECFC2A99A23BF0C140DCDEC95EF2C135C34291762BD4311FC05 +675000,u,79D83BE1947610EE5B07DA48CEDCE7DBF99ED528E8753D3C1C0C47B59E10533C +676000,k,E189520FDA9FA874716D56B92CF42C84223A48DF55EC2F33C443C6AC0CE18B47 +676000,u,E4974DBCDC773297E14626721A4CB9BC7BA1B149B37FB790CC0F05B968BFD365 +677000,k,FE83C5AE2B18C4F8F91F3A2732D395E740D5DAB7342AD95B372FCEFCCCAEAB73 +677000,u,92FA33E38D1A6DE7D7A455F6B7A1EABD02EEEAC1531DBE0E223141727F7F2338 +678000,k,8AA0ED2A64E2C5F8CB173680E6C6FC5AF985F7F52B1356DD53096E0F15A43E68 +678000,u,4D874718EB38B0C823F9D907663FA040341FA60BC951D849D0DE3E341BF23B6C +679000,k,B095B9108B57210F92BEB3D8094821245E39F115A24A5C894607D2F37F6A485F +679000,u,142EAA6CB52E3487BF92C3B89D6E6089B64F3D4B2CA2BAFFCFBC9C1E56A27E3D +680000,k,95757D57871A8D2286BAD17C6DC40A057667AF7D54146FA463CEF7ECFCBAD333 +680000,u,83B8D6CFA6550944657F80F898C4A0D1A003979A29847D6BE12AA54A8A56A92D +681000,k,5530A01E94488DD6977710EDB7006424020B6DF9C98DFE53428AA4CC06AC3E72 +681000,u,D3EDCE204B4E345C983DB65861EFBEEE8022ECFA88AA9BC30997FF6184EEE530 +682000,k,6016FAB38944208457DBE0CE863C72E9FFDF32D1D1DF5C2646A67C5D7AE47070 +682000,u,95F0B77520A939BCDFF3B435A9EB580602709C6E29A8E956C68955D4D83D4B0F +683000,k,163CDFEC29452463957DF40C5FB14771CFE3C6A743049BF50212003F1A9A1E0B +683000,u,F3C22BCBB83C4EE56A751CA2A4794576503902B2411AB011B374594C1FED010C +684000,k,CF683B56FD51B3E44757998ADFE9C1EFF4ABED020C382649A4FA268DE9109833 +684000,u,E1FE11AB96F7102FDE3B904B2FCED73D39C796C66BD4ED1BCBF8AE77DB6AD059 +685000,k,F2C84183FDA1833E8C2499E2812686A4F066CAAA9A21F66CBC61372097EE6F53 +685000,u,EC0BAC41DDDECF70AD1310471E55E6AA2BDF76DC3119F9C7144C0B41E9739241 +686000,k,3D1E62E9671EA75714266FD88D4A75D293BF69E92E96C6C0CAAD2EC3A13D6C33 +686000,u,D30EE7C5D88109EE124E0E8BC3D0BDA82994FEE745122B2518BC184DD154363F +687000,k,F8C3D9F4A39285585C782400B7AA22F332A4956C7C65900BA0BA445C2A0F4701 +687000,u,0EB2283A0148920141D9A8C6C179F5B90F5CA9623882974552C24E22A3BCE431 +688000,k,1E23A2B8113AC144724B41800129FF19CD485A3959FB4707D391B9E7B2F59D28 +688000,u,1D5950096824EDB7DD4ACD1E89184E523CCE4E20947CE1CBB8B2A71914656822 +689000,k,15D3B37A058CA69003A165E0DD6EBC760A1F982D0AEF272F324E1284D177B164 +689000,u,A81B02D9961245FE864BFFF2786E557FACAC528347CFD7BF34A14D27D8942B66 +690000,k,59DBFF3C577D5EFFB60E55E794FAA8DBF32A56F7BC22A5BDE955B9B6929DC253 +690000,u,09892C3EF5F81174901BB9BF284DFC81DF5BCB5002896CCD5B1D8B8D12134B5C +691000,k,CB49B30390E242AD8B42B6B7A221099B83FA891130C8102BADE823C69CDC2D5A +691000,u,FF0A68E3B255934C7C91421F8D2A7280863A3B8504139B84C009B5A7A872D25C +692000,k,5AAB5BE1AEC08961174AD434DF5D7C6C97DE0BB5ECB56DA8024590A38AFF7E46 +692000,u,ADC50A19C83F270DBD5F44CF87644EF2687242DD3725B55F45A7FF8F451A591E +693000,k,FADE2EAECB95C716BE3E677DC5B615A1E05B07F6DD8CC0BCFBA42CC3E54FBA1C +693000,u,201E836B71761956400217AC280EEED48F58CFF8A03F602F5799228C070F504C +694000,k,DCF733E049F05172D390CBEACAF3BA86593A425B7CBA70303859D7F4E84AFD4C +694000,u,2E4543EAD86A82069528E1E7EB473FF5D36F0C92CC65DF38AE55A38530DA3841 +695000,k,BAA2C8A00476C4EFF656629113132A26C819811FC6FBCD837145762E70C9EC17 +695000,u,BF7A96346A37F5B409CBB5AE900CFEF11C784D4394B62ACF2C243711F5A68D75 +696000,k,3BD5C25C51E5BDB8C05A6EF6321A60AF720302F118F417DBEE7DDF3EC80A352A +696000,u,C36DF80930D8C46E0AC51ABC82392DF0460F39AADDDD515FD036CD5A4B6CE816 +697000,k,4A8138ECD218131C17AFA344241F17493E956F1252DAAD30D9679F0CAEEE430B +697000,u,E2E52687295DA9C35698C9884CBCB65C296D754B9517751A09983FCD7F851916 +698000,k,63253F8242CF62B6EF81CD8AE37320808BDAB03B7AE86489516FDCBD92A9D367 +698000,u,A1260F2DC5A3B0E0A0023DE4D4A6D78F0041260CF345960DD11FB23B30D22E3A +699000,k,D295D012B3389798EA029B8A542B3DC64510BF31F0FB7921347FF7CB2029AF1C +699000,u,1725724B96195EB83617C83D5E0E5FEDFFCFE58DC5588D22458D64923B45653B +700000,k,937E2EC1AC8166024DF9A474A52337CB23F9BE7B42AE313E3AE350D58FCC7500 +700000,u,2E1FA477658654B45EE8CA5F93A466E0B03C814053820F73BDE96A1A381E3444 +701000,k,364A362BDA2A3FA5DE7B726FEF07F9025FEE56918D46FE9004FDB8A9F934193F +701000,u,4D43AF2CB49CFBC0B3E3B42A4E56A9FB131645F3552D87D0EABECD249CBC206D +702000,k,B0C6592687416584A181167322352A3C02B3CA410BCED11EF2D5378B68B8940F +702000,u,1E431265443A50460F366834BED34B58381DD2AB55F2274B18350CC65AE2C813 +703000,k,70412FC3BC749D06C9BF1E3505679BFD7D011E6F2440F2BA7880E318A0102542 +703000,u,735D457A27E31A71747B2E447183ACA3872F529B57E44B000760C3A138F78178 +704000,k,10D9559832380EF41FDBCE0B78B25A229B782EE603DD211522D237234CFBAC34 +704000,u,D7FEA8C8BEB62C746FB6430CB1B5ADE2C99409E88C1860C2FF45DA31DBF9F438 +705000,k,6C700C3A4C0D6D35224DEB78732076EED7967BC8220E168CC856D3BD4F41A761 +705000,u,693C5AB4F2A4D6F2D951041ECB1CBF58BA8EDE66058922CF839BDE9413373E28 +706000,k,FE257B5459E247F9FF7C497BF97DA7120FFF33462280CB1FBE9F0087B035B675 +706000,u,0C6B2335F2F5E5E95EFDC392C30657BCD7B9C6AC857C541E5895890909253D47 +707000,k,ABA5CD74E01973A5595517EBCD46C01DA5990112DF96EA319DA59EB43C86FD1E +707000,u,2C10A944CE7D0B14B2588D9F6D39EB9A0FCC24039384C281B6728484A34DDE42 +708000,k,1508E68B873F58B795C94704667E416E9097C890CE61F7E107E835F21ACD5B6B +708000,u,EDCBA3599966C151264F5E787F6D5846B1243D0E1FD89B2074D106FECB510F07 +709000,k,4210BB822FB71DA9F5EE54ABFE919BADC956BB5BCB0D1FFEE03F3255E7BE123D +709000,u,135E057BA8F34A02D17CE0B93527C30D94B0933BA29AFEE2FC26B8550655EE59 +710000,k,F507FBC3D6B5427E778C2D31B2B24CB7952EF4FD5F6C346EFFE72D5B4A019631 +710000,u,2B8099CA703C0974D7F5CC1F9F954A7A6484CDB0BA03A4DE5C63C8F13DB8E739 +711000,k,125F0D109653B2269F3B3FAD9E43CE4E37607DEACE8FB97FA73D9C6FD2C4F76F +711000,u,EBFAFC21032392D5E2BA215B7B7EE8C5D09F315D8AF94696997F37CC9A2CF66A +712000,k,A9A8B259193B4558483A547085E5F81A87DE1531B4357A4CD4B08F5DFBB8D139 +712000,u,F68D9893ACFA46D940A54F1E6A2AC752A752B5C96960089A18F6D5AA7C251D34 +713000,k,6A01645A9776172C130BB13832D82B90141302E07D865D69F23103368332A10D +713000,u,34E464E05DD05CDD3E0518142BEA8E310AFB3062B8EEE18861E3CF5CA8F96035 +714000,k,B9B5C91E6C6CF9553B01BCB9D7BD80E41B7B5E13C09BA3AC9DE38A26B2041A68 +714000,u,4F51F9029707526C63AFB473EEFF7358ADD8702B542E8E416D0106C4DFA1F42F +715000,k,6630C8C630CA6168EAE46C0B9D6C20B5522DDC4CE4985BCE608E05D89D68203C +715000,u,D2F51212AC20358DC8E75988A1A0E87DFE6BB6AF9E20CC7E59CE4B7041014D58 +716000,k,931BB668BE40D6062686C3559E915D22D7BA1C9E576E72E9B7B374C9D26C0A45 +716000,u,DA8FB1AEA8D7339803F87A654C90D38137E77587C1B6C4585C57BFB9D5423E38 +717000,k,B3E351AD6CCBF9769E1483E92AB72F9F7DE096F9F6E4A3BD07C5B44EE5CC612C +717000,u,72043356722BC22213E0F805017B4AF4E92EDBCDAAB1800F9DD6A8A2C7ABD82F +718000,k,875C41272D982505EFF0EA8B7A3562904BA4BD4F8AC45E4DF76BB185DB26DD46 +718000,u,67D0F3E10273B2B90AC087712C847A4C2E60D034307BA65AEAF896E4A631BC2F +719000,k,46B02EB33FB12164945F825A9B10100BDAC209A36C9865228B6FF7244CABB73C +719000,u,61ED2264951EB99ED630227079D9D99A63B216087CCD7679597FA9DF613EBE6F +720000,k,27E97DECEFB6936A510A5747DF45FE1CCBC276761BA6E571B3F7325D17AB0C6E +720000,u,36B6A482008F74A13E214E2BEB29FD7E184B13591773135DF756821A77E7A151 +721000,k,BB7EE54730DBE70DFEE272C4E25D72FDC822C4FC771AA4413E08F8D018E47C16 +721000,u,2F09E9EDA72055F960582B85462A9EEA9E6DF9F4220E2C1DAA98F5B8538AF654 +722000,k,A10E91FC04AC32C3E763381D0B9491CD7E2E14D03A8EA2563D28A6D068273622 +722000,u,643E90A70978C8EF8E9F39AF174E30B3BEB8C4456DE3DC3B89DFD3D880D98D52 +723000,k,FFCC4007BCDC2D80DF630A7D490A317CD089EF0D1CA50CDCA7A8A3E1C418BC44 +723000,u,223293A90916FC42AD1A1085BC6C267AE7F46F871A12883C3997C969E41EC907 +724000,k,42761E50221F0C2CA757E66368013E6D8FFB450281BC4225820AF45FC9870408 +724000,u,B651964784281B1D0BB71347C40066DDE9BE47A0DC03F0E299D02C9581AE6D19 +725000,k,65711B58B4B268F4D82F13DCF3DEF25A2D7A449C1A52A55B348FA26DDC3DC556 +725000,u,E4939EF942818CAB0D82D2FA0CB490272A4AD8EF2AB3D6D6EFE6FD19D35BB608 +726000,k,6B0D7F8F133D2AFF688ABF196C50891C21446D5C58FA84FDD8C550C0BD201738 +726000,u,9D15924949EB120193C4955BE0632F38BB00A80AB6814339AC25A5477A882F6C +727000,k,7CE3A8DB31501E1E67B5307D1ECA8CCDEBC9734E041B5E0C79947E1041C3AA66 +727000,u,25FF72CEEE428EAED85CEA1D0D57CC56ED1732CEE337A66B327235CDE4578F5A +728000,k,22509B0F1F240207DD3560DB2B05E5B2DB4C8B1A17F7ACA75ACF7147331D843C +728000,u,9AB290C035EE25B5AE83DC23EF01B66FB4FFF994248403DD4CE3D5E5080C352F +729000,k,5C64A4DC5F4F590E6766CCFD198EA68C7DC8175FFE9151AC7ADE06F1A7D75F36 +729000,u,90A8ECF67D907DD4BE1CBE4ED63E7653FA1C14664A87E75A94EDC8F9752E2E3C +730000,k,3D9E443D1A5CA72F5A91CEEEC7F5FD84C4171E881F52DD698E1BDA8DCED2205B +730000,u,6BA7B8E93325AFA9F88628F737718FB474175BECDA702C0F52A5C217F3C11D35 +731000,k,AC01F8A71150F8735436EB410C487D57B630303E1EA6D387D47F7A78B70F720E +731000,u,354E468AD7E8A443E952D05B97024243A718AE232EE481C52CBD597F50948112 +732000,k,6AA6F6D50125D1C08B6C21E376BD69FB64446DD7EB2AB2C2D0229AADCE74F32E +732000,u,F3366FE32281EEB7ABC48CD1B59E7D18ADF6EE93FB69C1F2C15C5B09B55CBE18 +733000,k,77A4A595846777971B41D4CE5F80F00C60A46C5ADADC588145836B4BDBB48672 +733000,u,5AA99F83B8543779A31628E595980F564D6ADE268631F37B60B5FDF5106D1566 +734000,k,CAC90B3CA6D5206366C24CEFBFFEE151B3579EFED4E3BE454780BF553E896B3B +734000,u,E664C54FC9DA63801EAF91F4D854F2D7423F3EBBA5E745A3D44157404B17C820 +735000,k,3360883F89D799506CCE6295DD9565D80F6A12ABA9722E84608C0A309F3C4C36 +735000,u,E9C1A8B7DEC6F9E07FBC74172A186F1C9C3FCB21D7885EF5FAA2C2CC838D8008 +736000,k,33FA162B99BE3F435EC8641B2A5E0E95C7EE3A4009D5C8024EEBF73708941834 +736000,u,3B303329431CF594ED6156E902E0EB196EF73EE546BF63DF8639E32E7DFCF820 +737000,k,8B071F40C4EFEEE3671F6BABC263B7CF166D0463570EE6C5356A79F44DEF5E1C +737000,u,7BC85A8A23DF0895FD4CEBFC3882AEAF3B89F103525369613BFDE3A454FBCB64 +738000,k,90040BE8DE246F834C7F919E05F86025295B94137C5EC02697E87B92AD31613F +738000,u,A057D103F5DDE0873BECFCFAF588538924D33623064790225D8D53F395016236 +739000,k,5D1C47816DC4866600439167414DF7FAE11ED489C53E3CAAB1BA673DB67D0032 +739000,u,9D2CD9B454B0D5897808B827E33403983CF6DE0C4EB9F2DEE4783DDDC3F63274 +740000,k,4E58DEE8605EBB8B96A9DF3010AA68A2A5D4A6005ECDA42E2C7224943DE08B6B +740000,u,8CB9095DC3AACA8E264221AEB8B834A9D801E31992AFC620D5477EC7CB197908 +741000,k,55A591A0DD1F4FA5DA74555D646512D0ACC77B7E22ED2531ECDF605A449D6A6D +741000,u,88DC6A281969B2D36AC468A6DA4D3CF40DB1339A3F22D19A23545ACDDE69905E +742000,k,1F8671B53E3D95A1E8C7BE8326702EC483309668926D3469DE474AF7CE40EA6A +742000,u,E96C4AEC2BCF84EFD5C70BF637BCDC819F711297A4BA65E67DC2C192967B802A +743000,k,6A3CE60496E96B1D159A635F7741FFA8592F7937B750FD1FA5965D032DC69A2A +743000,u,2EA5B8CFCA4569FE96E8BC365AAF4F83BB7734B36721786DFE6AC78D80CA6629 +744000,k,A05508ACBB56F39066E5CA096CB37F6065C80786AC8AE80A4A77D3416614D406 +744000,u,33BF79A0E7AC3CB9B1771A0F5FF65C6B030C5072154450D25A02302FFAB1B712 +745000,k,D27D811A57F8F3DD2E1C0127846F19B5F266118958C58150AB9C5C012CB77840 +745000,u,C51429C5F6EF908A69FE495F003B050F5736E169F166F84BF92899BDE9DB560F +746000,k,FB9C8F2AF1FBC504C840ACD1A54161BF40C1FC0801AB0F1090A899DF2C68E033 +746000,u,59C43A2B86946F00B6CBED63FE0E59E4801A1587A3AC2382F2F37D9FB8F6D463 +747000,k,7DC55E0A1743515E2AE2DEC36D635F300B3C54CA2E2FF58C16CA636AC2C07455 +747000,u,A687016DA311D54713706FDF950CD64BE0DE2ACA576C020B1904A5A0E3B89B50 +748000,k,028FED2B81F2CEEE0F89F502151B9C2B7F27CE06265DD161D7AF4B75CAC21175 +748000,u,6EFD692B441FEB5C0177236488462A449E175F44A4290EE1277A69DB52C3D60F +749000,k,49307449B36DB9D11BDFEC6F6B9C35849BE8AC88B587D837D10A60E9F9920E1E +749000,u,AE872C220A428838083E86FABAC094869D9D8D78F9D802A16E30AC4A0579E703 +750000,k,AB10496F084FACBAAA7297B198B6E8B8B6638BBFA4FF031BF6C6A8C12057B91B +750000,u,82CB8468AC1925C145A4B61BF54FC1939CE62044DC0B9C50DE901268AB90B134 +751000,k,CC27D47F53B65AA3DF98602DE0FD48503DE8B3F739FD592A5DEE857E00528576 +751000,u,948E5055A96CD4817587CA130ADE720DEF5C4C1A5CACD51CB12F98BC9CEBB709 +752000,k,A03F531B47D47C1E17C7CD176FAD6C9672B54186ACD4A7BAE582E8079C207345 +752000,u,92BD91F1F744E6397059CB153393F6DEFDCB432725BC6C0354DC0323879A347C +753000,k,6083FA646EB11BE4F507003C415BE26DFE8A98236EF78CA3026E8B743964E56C +753000,u,B9912D0FAD578E3F22883758A427A548BBC2596B300D2702D8BC2DD44FA91F1D +754000,k,C899238974FD41D210657266050427535EAE56DC30EE6ECF25FC2B75F1D1DD1C +754000,u,056AC1E730E86914C6B8E34FE9B889D5039BAAFA2EB9FC77AF32621330CDC904 +755000,k,70ACB789495F46A535452FF68D65B9B9ACF19906223D78679BB9875E7C2EFB5A +755000,u,4003839492C5569F09225B8EA9607DE0711CE5C678BF6730F8B9A8030567EA2A +756000,k,41990E9CD618A365681728C099CF4D2187E619860FAB8B67F35E3A351DB57529 +756000,u,937309D32D60B38EE333A02EE89470A934A050BFFDCE7EB5C94E83F0898F824C +757000,k,011AC27F69EC5974348CC1DB00A46064A25B4CCC37BFF41B14FBA9483CF58253 +757000,u,BD3FD13A56DA58975E9CD6801186BB3B118E681D9BF4AEEC8C065F4DEC82BF5F +758000,k,D68A8B2EA010E0DBE662E61FE8094A7E1B892B9ED046115071716E23D747BE61 +758000,u,E34340A599D6F25C0DCB03AD7EA0F168738B286ADCB6F8AB0D7A0DCEFB5D4916 +759000,k,601ACCA85E834F917A25DD349E25CC2355F0E8072C173C9DB9DD7E18387FB75F +759000,u,83C8AD59E7D3D0C87DACAE040A0B5DB98B17B73D06FBBA6D8FAAA85E61E45908 +760000,k,315EBAF59723D5C9EC4EE5FFAE1441C2ECFFC835D127F6CAF36AE4DF36180A26 +760000,u,2704B275E6A8A155AB277814664160E8A8FAD42325991F62D8417B7F7B57E746 +761000,k,DFEA7659F0BB1527ED622762AFCDEBE8C4C87B6A21E69964457F2A4FF47C9235 +761000,u,18926F76443D74BE416FDC5B565BAA1FB79CC4E233304478EE33C90C0C1B6953 +762000,k,BA65596B1EFEEBB7F8A443843A8C7F90003F74358238848458A59C11CE19AE11 +762000,u,A8C9E68D0EC43453818E84664D2ECC988D584B92C317688FC63B5C6F5C733425 +763000,k,A92DCACB48442FEB07F3B21998E52C447666830D013DEDD11AA0DFEAF75A9410 +763000,u,45DD83C27C5046398C391D675190C7D470A94D877E7DFDEDC50C092609E29B02 +764000,k,62B2E7F0271C07B332D687314AC150EB9C561647C614DC348B1A60D48F2B6063 +764000,u,6D90C28411937FF02B324DE164105ED2F1B5FCE17C57C99B9A6115B7D8382218 +765000,k,48EEDA1CAFCE99F1BDEA08B93026AFB87A307CC20EE35DCE0FFBD4070B29845A +765000,u,378A16C5677731DD4F956B4052A59BD0582A1263B3A3A3B7CC33F3CB07D7575E +766000,k,1A171AE1BEE4337C6A192C5A0FD02A86A27B16108860B0EC4D2EB6499A8F9F2B +766000,u,25C07D92CC4DF9DEE61D84D0C48B6C301743EC5567DA5126D63177635767623B +767000,k,F69161D368B80B2F087EB3116529B67095D1D6ADDF33EF4C2028CF4C9CCF8B4A +767000,u,F9F4C8BACC27C538AE5BB9FAFD6826CFCAAA85C05707FCE567E1BFB2409A135D +768000,k,7675EBA1964DDCE283110A6CB97E63C53BE3CBD193E8795801A0C0DB1593A655 +768000,u,0A0276350460722024CC3C58E645F4731B37A8538D8C9D4103D1CEAA07EF0A35 +769000,k,3C426022C7EFEAE2817C5EA7DE74C075BF0CEEE8290F2A8523EB61F964714674 +769000,u,36294D836782CD6677558B3C328DA93788FA4FCECB519C0B4FBBDF8D68D69806 +770000,k,EE270864D1BD1C9470E18450D9B2C1494824D03D7D557445404AB93C5C102322 +770000,u,333E9246D502517385CF8768B270B1E2691DF60BD0F9735394ED3EEEAA0DA366 +771000,k,FFDE69BDED73741398165202367D02F90D57CC44A194F667C7BB68BA5CE1451F +771000,u,033E65819A8E72B796D21418397CDAA2BD339DBB0D76E04D78692E5F1B3DEA19 +772000,k,E0BC530862FB7CACF8B0D6C5D9AF5EFA64AF58E0C5FA7788EFE317E0E1695A43 +772000,u,0362B20550055C3AD00D9B03BE78D5271F5C1CC60F0AE46416B103F4E7DE103F +773000,k,D2DDA856094B3F379C21930F4E312EEDBD4EB6FB604EF9370CCF822218F5CB4F +773000,u,C4D78F44FBB5B7F12CFAF261DC3D2F85BBA2021CBE9CA43675AF6A77A1352320 +774000,k,74C754617DACFDBD227BF7B3C8B1B5A420BF4A688019EC1B63FAF3234F156903 +774000,u,1B689AF8BF47373732357275321BEAB16BDC524D39542774B81EA60393AD2A03 +775000,k,AACCFDEEF68A1569E5D79FB67FC3B7C93EB1DA4EE504C497561D1FCAA338E566 +775000,u,64B192A1D92784F7B9A6674FBD5290C7B9C1BC1B4778BB12C230BD172393E605 +776000,k,ABE9B6E2E83DED1526DFE2C17C172FFF0B70D685F1A26AF24E44E30D4FB07174 +776000,u,D2FC439D3E8306537638375ED04E3396FB7AB88FA037F5DD37888CDEF8976E36 +777000,k,EDD5568F8754E62465158B6642406FCC120CCED96E771E8009A45E4A28B1FC7B +777000,u,8BA824269F80CB93CAB7234324E5AF17CFC6A075ED1209805E1F04D91128FE77 +778000,k,DFAA016B05EC3A9FE7265CB674478EBFD1A99AC2264B8C2BA6A523A8A6505E0C +778000,u,B126D4C335BE2F28539C398CFF10DDE1BF86EA09DD76A8C234FDF56D78831842 +779000,k,ABF77C7AB9C0FBB47286C718096F957885994169F91D445C883021CED022C607 +779000,u,4D7170F705E6EC425B91FDCF2393AECB52956A33D1997FC1382B1934B02E9D07 +780000,k,3C3AABFB9036DD3D02EF4410647DAE46C8886D50CA3D866E22E787E46DF1BB37 +780000,u,06B0A789C5CD50CB94CF172CD63E36620C96B6B9783D29EE2799992589A49E0F +781000,k,C6C84DC54932AF6A5F7741EF664ECE7E2817C8C5065CE966FDCBD5E1556AF250 +781000,u,B105F55C645B90750BB84652D5D8611C384D025B1F641EE11C8CA2E41A5FDB02 +782000,k,42DD480400B4CD54F208FA1F319301935C1D88B16E99502887527537F07F1664 +782000,u,C94F1A9E01344DF90DB547D6E7BDDA7774534D439F5B16095D1756F720F18458 +783000,k,C82EDE4630E6DAA8ED8CF47947C5DA756A243136A9853F18BE7D6F792C08A326 +783000,u,56CF4D65AEFFD7C592F98BFDB567E4B2D7464E46A2D23094D4199D29220BB94A +784000,k,F382A0E4AA9D112428A1DFC7691F632A8BC6D6DE870BC1FF6EE8EA2449383665 +784000,u,E3BB1106DE42ECA495E8F7AAF0A7372F1DE2FC697D7AC2D9EB8DA358B7618A22 +785000,k,C8B4D59D68705CCDB013875F783511DDCE25AB65C33D5EFFBD0DD8503CE42806 +785000,u,1E36CC35E03295B0B8C2216EE29D7D1571BE7CEC5E0DED355B06464AD5481D01 +786000,k,A424B74B55121D1C873D50BEC20AE51E080D308D5153F07E19996BFBA1F59078 +786000,u,D29C51E6B75CDB8A6F0DB06BCC9CB8ECDB79A3B3A875826523A28CA58D947811 +787000,k,6CC9BA48F95354F826012580B20FC7CFE794914DA556BBCD3B36660C46C8BD38 +787000,u,FB0A592E27227826F9CFBA106D402B394509310381A1A04EABA1C1D0D0417470 +788000,k,45C1E805F945E11E3408CBD8138A77BE3C0C22720B149475A7BA45B3B4649D78 +788000,u,7FB847C4C845E2C956C93147DD91DF55D5AD79A936641B5C4E6062849D2C574B +789000,k,757C0DE228FD7B557ACF63AE09B776745393865037F50F576639C903D4675C0A +789000,u,150C97B1DDF631814B5F0376306B6D4F4937CD3A419F32D4FBE318354A7B2436 +790000,k,F19D72B87C7AC131EB11ABBB652E4C46B81C44FFF87E192B1EF3529F97E18D6B +790000,u,6AA8C5E0050E3AF2AEFF675C7776A907793129C0CF281D37CCA061424AC1FB0F +791000,k,60791D7EED222D95044E311F8BF9861C83EE4C2016C281E31C78D35EE93EBD7B +791000,u,3F94B830B8B829EA1228616ABB866A2903865C0FCBA573128886C6BEB0C5AA1D +792000,k,B015359F179A566C59602B5080281DBE9A0115CACE95EFD82C0E0CD0CFAAD81D +792000,u,877D3C6DA1A3F442F0FDE5648DAD18748426523FA7F9A36F124BB240D00A7626 +793000,k,2BA07AB522D644612454009AB1EDF16C07EB6A65E7A07C8BF3A52B99CC7F9870 +793000,u,39ED943A2120799BCC58DFF1CB09EA54567493654476D1262CD89664DD83AE5D +794000,k,A5AAE015FCF736CD0960EEDCA0BB868B4FF2342E4DF8CA4FF8F98B966916BE48 +794000,u,4D207B903729E1E7AEC22C18093E615EF45BC3C7FA57526D672932ABCBE7A123 +795000,k,2A2634937E1FEE6FE55BEB3FB71590D8EF6C281A364A800FAA0A069A95117560 +795000,u,3E4B392365CDA73DA63CB24184EEB015AC9AB6E9EEBD510498A880FC36E0E42B +796000,k,3330014B724D0F1ACFBE279F794A0856C16F1B75C65651EA10AEB8127F1F3243 +796000,u,51DB18FE67FC3465A4B76646723FEA2487CDFE0B6924B5CD4801E6AD6D17013A +797000,k,C6D46E6F8116D0011835800B41D220D224DFC7F9BEC7405E02C633BD42825815 +797000,u,74BB8D437669F5E240F9A5444FF83840B9259EF26401810C9EDD9BA072993A1B +798000,k,D024FD0759D2EC4CC76F7BD213FEB73BA63CDE1ADFB36F3B0DA63B6A72161509 +798000,u,7AB77694B7DECA2753C0D7CBD92D3FBBB2352D67251A6E7C94C4B1D6A0438D3B +799000,k,8DE79538FB375FC1EF266417D03B7D6E5BE6D1F64AF5ABA88991E82962A1B501 +799000,u,D37BB6AF1118AE37902D58EDA15E9A0945625A1D4DC78AD5DF5596FF59B31F15 +800000,k,55750F77672C9D3FEC85C42EF4E02E2BCBA0A587A0A90936687F9F8D68867544 +800000,u,48289E9F296DF6A838CB35E8DB3F905275B801C0C4C7D176DDCAD205C7E07013 +801000,k,E995FD7D30C08EE9A92A7F02E65EF1F80E48A94C8C7B3ED1E7F893B6E9119709 +801000,u,D823E672532C1B0460368B9000A9B0B47C6E5C9E7200EBFFA4B2C52EE6D1ED44 +802000,k,DA13B05FFDFA94B5FD76C900568FCA95D105266481B0600DF8405A88CCE4E22D +802000,u,5C4BBC501CB7FAD509D468AE234955FEA29FBBE15DAA465D03C0FDF2500FDA32 +803000,k,D6230627ABA0BF7430D55FD965BD73180F15CFC4FD58A9FD41925712EFE8755F +803000,u,C1B4E26E1021A402884136E5DD310FFB3FDFF70A98999190634B50975D47812E +804000,k,A9C9C9D422417EADF0B0A0825070AD070BC24C8032BDC33E4A0B5E5B17238404 +804000,u,6FBA3F89584FF8894F90EA2D0152F3079FE16F24987C646A1C4651367FF68A35 +805000,k,E36D401E371723D6C39E419BC48B28038FDD0F4419CEEFE2E21AF343271E9721 +805000,u,B8795D439D91CF7BE097BF17F6742F6F81037346A5039D2E9A82EAADB7F88E07 +806000,k,3C48955008BDA0C71BB01661F73720B87DA48551FD10086883A6DD604AFD125B +806000,u,747345448B9E9DE042726921042BAEB6F8958483FD5FE1EFD971549F5DDE566D +807000,k,91F4F76BB336F2A29FF6BBEEC8AFB3DAD19C27965169AB65494E2047D3B5E155 +807000,u,D95785E9D7C9FDD1FAE55C581E9B94931A5D914ADB874F226F41E18A96E18C4C +808000,k,DDE7C320B19BD6C6E5E51335BE5C0CE494E357D581893228B240AAB5A0C66E5C +808000,u,B46F77B1D447C8B5DBD81031E6AB8D5015761FAA29111DF21B183ACD0876B315 +809000,k,E1429F6973CF286795F97A08D474AE6E33D3C95FAD375A06F1547E2AE0E9F239 +809000,u,4170115B7E5BCEAF055A73C3C3F66139B6AFDCC2C5E9B3922BFC3E60220B3675 +810000,k,C5312FE30BE3C6FA7E9209E10ED57CEFACCD0339183980D1C48EB6EE859D9002 +810000,u,62F9BD5511C43DC79B5BCC00BB3D7F6C9B9870B84FDA5144212FB19AAED47C67 +811000,k,7299A085FEC804A3EDF5E847BB95B6FCC6F131A7276CAB2BD5B7EFEF1903D315 +811000,u,EAE7B5992A4A1C47A035A89BA0524EB08E8DA5B0A83AE7614CA98685FFB65B3C +812000,k,B773118FA32AFB3DAABC624E22E0A3FFB715635B6BA22385E53490A19CFD0A24 +812000,u,C518CF8A8C8F01EB720446D7984E31D04556C1272BC2DBD50A59C5FF54E9721C +813000,k,1D541486F2841B775048B48CF907203951B533C15DE5425A7F78FAD0E731DA5A +813000,u,4F6CD4DE7CB4AF1E89ADAA49A9C5BC26D7BA32C0DC208DBC327F44A6778D3920 +814000,k,908A2E991F538EE00278636B04AE32B1B43B69229D0F29A5A0D45AC3C8E30546 +814000,u,74B8566AB34128CF227363F7935455885888D6971F5144BF0594CDC63768964E +815000,k,164AC1298BE55A8D522678007910A7117B4A5972868A4F4E8A64BA98F69A9131 +815000,u,B8B55E32A3646886F43708004618DFC492B4E3F3DEC368864809557EE16D8714 +816000,k,500F189CFEF5745158094989452454F7A5BA6B5D1FF37E29A3D06713F27A553C +816000,u,FCAEEE177EE3A262DC9C898E2108B101B3F615F6A64887D1F2B0B659DB96A242 +817000,k,2BF6BC3BFA0550D24B1E425A85553D2957CE3B048FB45A78BF8C743A0D144253 +817000,u,453E9C01C5A91E62B428E194DC4F54A6BF44208470E13FC244529BD84E628751 +818000,k,95C5BE3AAB12C2CAB7B6BE8704EC0197823D0660440A7BEBF1C54347B59F0764 +818000,u,1E35BDD306673667833EC730995182801AFB56023607CD7036A09DF61ABE2A0D +819000,k,D31F6F0C3DEA4F5E5BB21F5A6E301FFB141C0951FAF5D7948EBF35D181831112 +819000,u,172CDE193C7B479E523AE1B905DE2305B5EBB13ECA503DE5FCEB5A0F8946D931 +820000,k,56F0B673E30CBEE3626B6FD4D07B4B63EA703356FA8CDDC7599AA0DD24CE4833 +820000,u,DD440D08E2CC17985E26DDC5850B9BA1C410525364052037143C5D61AB9E260A +821000,k,82A1AA0363D56620A814DE1A4DB7E8BA712E3E8A984D3681496ED9A674493006 +821000,u,76364464FFBB8AD3BFBC2DA1CDCADA626C463B294D6BE08AB7153967FF20B968 +822000,k,4D5D8791C90E4F421232B04C03FAE6C8C0A9DAEBA1CC5EE1A04636D022665846 +822000,u,664136C7D3D329BF54F6B55AEA6A263406E40936304339C577FC9747BCFDF97C +823000,k,4C397ED43712CF094E14DDB7E094194B2D7FBEF894EC5ADCD1EBB1ADD4AEA27B +823000,u,EC91E948E631FFF7A8440E07F996DA218226A336634B5743EBA875CCCA4AA439 +824000,k,475C243E7C26D19E434F1868670261DCA9B7AB619AAC3FF9470C9913BA946615 +824000,u,2190F5A8FE60DB2B951BB8260C716F59FCC7805C58CBA5E90535CDBAD9488C0F +825000,k,A09B06BB1A8579F6EE1445DA511EC232032A73B756CA9071883D69D832747355 +825000,u,CFEACACE73F895A06C61447F5301479D2A3B347289AA74844BC6250B0A745C5C +826000,k,2454E2E45AB8BB5829DF4FC6014096F92508E765645A21C1400F6A712CED500A +826000,u,7D6B2D9BED7DDC4A81D18B010D79BE5944EFD7061EA11F84CA9B90D5450A3E18 +827000,k,8F3BDBC1A833096BEFD73D7F87688E2551D39B358B754CA7BCF6454ECE7B422D +827000,u,7FFA69C621F519A1E9E4E836FD91A5066F069F535CFD65E38A579742995E4334 +828000,k,C7B10F5E0AB6605B59799272C2F6EC8FB01036369E46F850E819B9B32E5EE455 +828000,u,0C567CA781CFA001D8559DDFD7827E4810E6A9642626EB9AF4CF7C476A08212D +829000,k,AC3CB15062297331EA0E278BFFAAFF40577144B5E4761196C5CDE3E8EF728A37 +829000,u,9BF64F734869A3F043841B0B7F9B9699E3DCBBA175607F2A3AD5082C1BF7975C +830000,k,6307727D341541439533DDFD294CE636F1F7C9ECB94DA8522624517B627C704E +830000,u,3B1937989DC3BC1CBC3D473447E40BEF0E8780C97B8376F83016891983C59E18 +831000,k,8711712A16E9E6A74AFDE0A6936970C4742D19958F35DB321A725599C7C2445C +831000,u,7A8B6179E828D7A1D0B35E477164F2FEFD207C7472DDAB10429178A6E76FC927 +832000,k,5D545F078A29ACD08626ECC4BC4B0432C1EFD30E3EE6D0A74DCAE71B677A4516 +832000,u,93C2BF4C8124C6E1767AF4EC1DB1F1765FD1FA61CD111D374AD54FBABB3BF878 +833000,k,0AA88EB88EE6092E76DA6C6D1819246930802897E41C17ABE3FB13BDA6C81F17 +833000,u,F3D9B9F908E7CB3C3698C2A0510F3BC92BE9D9846F16DEF3510944C98703A842 +834000,k,7C97DC46E206BE610BF51FD099F455C1BB7F7BD860B03072BF14E6D6F7DB2626 +834000,u,D4C19B8D8987E461E0EB7DD1020A2884E0AE6E972CBC1667E6C0446EB199EA48 +835000,k,9F0FFD5AE0B43D917FC296E977504A57ADE2004A9ACD5478370FD75D1A8A7220 +835000,u,251D7C6B403C939BF2A47F28A22F377F8706FFC92B466EE790D630F5C461F82E +836000,k,A021048B2FC37B962A25F899342CF7F4A707CD0C98C440D1B03DDB326893AD73 +836000,u,48BDC628CC4E7E6D0003136BBBB90C64109EC577133E2AAC9E9C82A984890442 +837000,k,E774B10ABB3E1FD9DEA0F69DF2D10B218736ED1191E399FF5509289918801760 +837000,u,DA10B033C94FF2D717322F4646813E4251277C3FD5B2A0E21C29F9443CDA910F +838000,k,E29A248621B7991C8AB7E9B2F994D41B2D88F766118E2F6218DDE40B734D081F +838000,u,D542647B12D0A3991F962A46691FD9B6BA6D4DA397090212837929F13815811F +839000,k,CBC575CDA7EEEF5CF13A5A90D4B4085A48C2B5E3EC28CD180FF29B4181710077 +839000,u,5A5178B9AF9D6CA81EA639B2F6B2C5BEA7668336186986BDDF962C6E943A481B +840000,k,64E9CF7C2DA1159078A7BBB9284DA2FD00DA641891A5CA7A9797395505B99C75 +840000,u,C81826CAA259566E919AF277BF003D9777A161C07418A952140529B95181C25E +841000,k,8AFAE8F718D60C7A237BBA8E8193ADEE7AA47C0F9DEF8BD88F8517D848221B07 +841000,u,C2D71FBFEBAAD50ABA1908AD38B662974F0B537B1577A0AA8CC2BBE32438AA33 +842000,k,618053712CF638922BB003535583EAA54A9F2238C0CFA5DD589D1E6337533774 +842000,u,EA85FE7F0BBD231485AF8D624AEE58F41E5C7DFBD9E0820ED85E64965A53A54B +843000,k,3888B0743E09B2081907BF4C833C0A4E265F6928AF55A719480EADAA775B6B40 +843000,u,748D198B95C85A7F2929A82F80B8DA62FC9277963D4B9AAF30F0B486EE282251 +844000,k,CBF816BF1BB138ADA7A1F99E63D71CA73153CC84B1A38836FC210A0859AA647B +844000,u,D3AE9CAFBCFBEA15AA4B4F2FEDFC43EBEA09BA36873E18E62EBCA31CA8411B00 +845000,k,E477F5167F4305B1162A2625CC7871C5C935EFE9833AC9A730900C1286F4ED63 +845000,u,7FB4A38A9F4FD367C6014FDE4747A3340DBBDFD2AA761CE4EB7883F9AE7A1D0C +846000,k,272E7C4A8B763D5A0ED76F3B3FBE0539DA6A4F9BDE8BFBF0D4E6BC15193B5131 +846000,u,3384503263C514CF9606DDE4C43252A95CFC48F2FA1B067A5F07AF1666394059 +847000,k,CB74D0CC11A36093CFC007CD89C40912056A9535F8D42FBD647098F5F4FFA326 +847000,u,B2B436AFDA48BAC7DCC05C58276CBBC61A4E396E02FE4F5E68D3555443CFD92A +848000,k,3D0BCAF5B788A1C18C16AC8DA2C468834EEE2A40894EC836C0FFBC7E743A5A58 +848000,u,E522B44650829D735885A9256A4F64A12E46632E53AECA3162A2E338EB22C03D +849000,k,3D19A19C3FC4B55E8DCD89BCC584EE983DDF910FA667F234CC9616E34F485F53 +849000,u,ADD2D26EE5C7432D716C311ED692039F2135BD19ACF608E4E52F2AF9EFA6C415 +850000,k,7C060A8815379868695ED1C7F351995A2A4DFE88354EE9257A5A8991A3E12E3E +850000,u,893AC0A5269F36BD1D99AA20D25A49B48766E40AC1BA40B0DA02673BC68E4D68 +851000,k,72526537CE6926CAB55312E8C4F638CC9E1581652B3073385B00570B7F97EC68 +851000,u,739C0D7B4D5032D30C5D45014BF04067A11C725746FEA30E96B989464849C15C +852000,k,B9F94663ECBBF6506EC58C605A36A0BD7AD4AFF5E60501B48CBFC8D73C087D1D +852000,u,7CDCDDA8700A5A7568F250CB511417179868A4D4DBB3B9924149EA48E3F44D31 +853000,k,830FEDAC5CA7E5A09F09D1057F8B6298F7803467848658B9278A38171EEBCB49 +853000,u,ECAEDE95BE638D5BBDBFB1AB607B061220B7C8E3CE6FF5D467AE3A5CF45CBE49 +854000,k,93B5F33E82F48F318A901A03BE3A9E88C3BBBE66610A6604D51F60CC0A13F157 +854000,u,28792C4B8F441B3330B38B44A936831AA78525FF09653C1F68219C5DAF631160 +855000,k,AA4C5A776AA2D3CA524A8242327C36872FE2D500F1595437524C0E71A5311447 +855000,u,4717A9D79F2E1367A9CFB1E7CA7847989C7C1C65E4B7DACB280C9BC225EB2603 +856000,k,161F2940D8DCCAF9B674A3E8C271D4A59F52F129B167C1EFD7177D31DF528C64 +856000,u,D1F638183BC30E69CC6E945933C2A45C62BACE1B366656046F0E3C77FB254C72 +857000,k,F52A1900409957E7896A0360D9C98EA1CAD8298A52A8576B0446373FC62DB231 +857000,u,B1053AC0CB181A7003E5403BD4E83770E6300E9AF503D799069CAAE1F1CA3D05 +858000,k,1D16821B87C5F5903C42A94A6D4F3F2ABFA68121FBE0F02E6075D26E79C3CE7E +858000,u,F58DA1372B4980374B60DDC83B95930EE987A1D0EC7D698A4B647CBC6FB2135C +859000,k,F08948E4331EF447DD77A11865D5189891977D702A5D66422B8BC62F795EC463 +859000,u,381EC3A2C442B1170ACEA52EEC93F9410BD99ACCFDA3618479D260BCE7FBAC0F +860000,k,790D4018482DCBFD093F1D69757CB1A7A6634FDC8FB21EF377C75AB23DA64D49 +860000,u,49935FDB4795192784C1577F1B82AB9C54D8FE127AA8B54F30985CA9D9B16378 +861000,k,3640B94E2E19835FC5B461B449CFD1C4B697D7384FA0D8D16CDFD9809E8ADD20 +861000,u,2C4331292A725CE46B10E7CDAD9AC4026116D685EBFE089A3A0E5D26D3FBAF00 +862000,k,DCFD5EBE92FCE8EDB72ED2DF8F3F2E3D2BAB986891D044A7862A7C1512E8FF2C +862000,u,7C798BC6AEA7A90A8A25A06EEE667CAF85DBF3B7C58E579F80566E333E411746 +863000,k,2C8A4A8FAA4F69DFD80031542B8D7673600BB3919C50F938A34971E7B4FC9878 +863000,u,BB85BE310545C7598AAFADFA13D05B3D531AC55BC8C46961404CEA65CC628038 +864000,k,474A86432F8139F6D75CC875396B396868A2C4E0C6542E9210170D4C3274A835 +864000,u,D3FF79B5AA72C6BA6033377993EBE4A87666C2ACC963B8C12655BC669F10F16C +865000,k,4267B9DADF807436A6B7DCF864FC562F4C9C12E13D44997C2C957CC3C0612B44 +865000,u,C3CCBDAC414CF078E1F4B1DF8A35BDE8F7F203DEB4B5ADBFFE0ADFCD3167483D +866000,k,A2E571AEF70B17F2E76CE2ABE5BC5A5F7AE10D86E3213C59EDD5D33C36CC9C15 +866000,u,BA57CAB4411F6703BAEE056FB4E816C7D2E906496D8CC13EEABA61AD6BBC0F0E +867000,k,FD95AD1DE7E7D476FF9FA5C934A5F541D817CC3DF9F5C3085324EDFA8432456E +867000,u,D172DD2BD6BDA9DF47BF6F5A0663614D5EC6DCA6A43FAD1B07E5C191F335AB37 +868000,k,1C5DB93D167AADDE90A0CB384CBC6677E420DC4486FD9719111276491567193E +868000,u,E9F2C0EF98F2BDB60B65AB8C5E4F13B1A86C0E7C984CBBCB52F959E872E23767 +869000,k,A7AC7FC49FF153BFB2F5FCBF0561DF8F98A57D638D4F6B1A73DA1924CFC3A151 +869000,u,8E84F046B9A4F3FED8C86E6520864BFE537660157EB74E24485788578F3C346A +870000,k,94902242570668F4CA9D010A13CC923D77E085520684ECA32218EAA2617A6475 +870000,u,92129A8D806EC18B590E165C3C85D4029833829A71C3E5F955CD44DD7C072D19 +871000,k,D61175719C3649D8652FDD6DC248B5F42203E61F59EFC05F9E31C47647987D5C +871000,u,1D32E09FB130E7C00BCEA2DFC18577021A0A58AE69AAECF0178E0D789118FD7C +872000,k,E49111051329FB7EC3718E88AC0F934FA3BCA597EF822418AE4F04949086163D +872000,u,D99514D82F885B326D1B151CCDB2B4A9B98B475E63ECF7471B00E4D8D237CA43 +873000,k,F5A68B398EB3450CA1E313430BFBF3C3D06DE8F9842D41D9288DB8C4FBB17519 +873000,u,735C65C4E5FB707A59058C5CA5CEC98107759DDDF1441C20DDAE09B07063B864 +874000,k,EA494343159DFDD9978B39F6F0C56C163C5388D4A57957F9DA18CFD6F91D036B +874000,u,A86C17A415D70F007F1034C91E629B1FA30B23038F9ECD4C7B3F5C104242EC57 +875000,k,850222B8CA96ED42057CD28D2DFB7FE1081CAFD8A726BC0C1F191638BFD7B100 +875000,u,DB1C5BB0300D2393164265AA25D2CEB1C465CE18527664CC7A073D7134ED1A7B +876000,k,005C6A299009748FA53BA548DC2986C47A441752451FF63443BA9F3ACAF5806D +876000,u,B5813C83FB9342BA04459D7A5E3134B33F47F87D18046310496AF79D33B5097D +877000,k,641928EA064E3FB6A14B3986BBE5D34F5E5E627BD05DF02B433D72E51F18707A +877000,u,A20F1B753081237CA6E025BBAC7583227ECAF61F0C8FB043BA8DD7FB2D654818 +878000,k,DD19C42859CB0495E1FF705C68219F7E89D3C9030D841B3390080991A8D2E253 +878000,u,F6B638BEA4C71A71DBF022817AFA6F6CA258D5A63E507376E96730172D665070 +879000,k,FAB8191624822C440D0B52E98430CD88F2266343E36729EA9CC9EEDD7434CF63 +879000,u,7134922706AE044B2805146E04C11E00D4B7AC1DF0D710260B20AD76DFCA623E +880000,k,84FC88C9B3ADF167F26D2410E33183965FBEC1BE62418CDA0A8A9BC668D0B026 +880000,u,DDB3E1BB88D97A8136A0DA0286287CDA55FFE20B14492E1770A3A3F32AAF1F7D +881000,k,ACF323A28145F1D3105B1FA75CB0B33B9FD762AF2B8AF50C891B48EA49BDBC32 +881000,u,86C9A9F54DF3B41111114953E58C3C6EA87B57EBCDBD5B6A61B2E85B50599E2A +882000,k,9CF15D934E7D8A384291EF06C6A1570E92D79E9A79C5F703769C1AAA13ECC805 +882000,u,82F7456ECED2BC0671E054360B5D4D50AC28DC3B265DFF99101B4168559D2960 +883000,k,B82C16C6784717C44741082DA697324886F1C3437776FDB8555180E203134924 +883000,u,68DC9A888ADEC6358CD3EA651F675400384B29AB7E5488B234DB4ADAA4A5B04C +884000,k,6CEC44903A3C16848FD0CD9297847161C6B3753ECDAF66D6A764DC23A965546E +884000,u,7FF2175C58306B25170BEC96970B4E19659319588EF7D674899106FD7F488D75 +885000,k,B2DEAD3ED06866F1672EA9B7E2203B8FA8F51CDA73B14862D684821D6838576A +885000,u,B16290BFEB5DAEA78EFECF4EA8637265934D8F93F4885E70D91E84905AEEBC01 +886000,k,C7A1986E9E9D7756DEB18B2EC405AACA770F2EB72BACEF527C3E01C280D0E239 +886000,u,1A3E5489037D49197275557D7CEB918A64EDFB73117894C303AACF2D42C57745 +887000,k,AF2C81BAA63EC8F6E14580FFFF8A0462CBC5E8B5735CADE7A83C8543D787AB31 +887000,u,0AC95025155EA23DF33269C2C5931B5C1E29594FB177C91474DF51DA64CF311E +888000,k,686341D3DA00873FBA3F2B6260C5CEC766C15EDED1DBBF13B01DEFBD84EFED67 +888000,u,D7CDDA5861BA080B88C1D86ADABE4F62AE11D07B87C91C90831A7047E40BCF77 +889000,k,44A3255120E5EB0FA2EFB2CA10E1E9133B6A1411DB55B3BA41A4F3B470A25D1B +889000,u,1701BDFD44B4CD0C68078E201BE09D6BD7098D74F7D25E64B87BE616F4F87618 +890000,k,5DE75FF6863F62BB6A138E270ABE837608D088C067885BC56947C22F688CF854 +890000,u,485B37E555EF71ABB0AD2A0C34A2B24D4EAAD542E884357A252628DE85D6DA38 +891000,k,AC2AC2D03351FE9FB4C957A32E90254C0B21AA955CA4163EC4B66E9633948558 +891000,u,C61DCD9C0BB9D2F03B9325546F829C1FCBD8F9C319DCDF4F1E23386284FCD518 +892000,k,E54CA4C5BBF25F6833DDF7A098FAED351DDE309912946C263BDD428A649B2230 +892000,u,6477CB666F7BEAFFC3806D29BFE8024BFE80886FFDE18EFB7A5B222AE93BFC51 +893000,k,B3852C43B679D726F4D1E0447DEA920D8AA69FD72B3D130E6C6A560C7D10365E +893000,u,AA2D848999C7C933C08A50726AFA63CE3CF7D6FB16B076C7943924EB7561B536 +894000,k,1F37539D805BE94D43F418D360613237A5C61ACA49EAD69B68BC34E81B204D52 +894000,u,97ED616B51BD27769BD5EDB222F9AC261D0197C5DCDAE33F44603918E19CB337 +895000,k,1F516B22A2CE4F538814FBC6549FD875A404353B70DDAFCC6D9B24A46438693E +895000,u,C7CE271A196D77D312C51166E7D112A7878A27BDDCF4B8359BB3827BC737B506 +896000,k,BFF99DA907870CBFE13D78C852737B480A3F3CEC48A5451471FF1D07F1F9594C +896000,u,5D01D4B1F70250C9ADF8A41FEADAFDE8AA8983C2355ECE11F2DAC6AC92786238 +897000,k,7691D6BD9F9B5E07876EC8D4719074D3548130C0FAC2AD3D8DACE725D941B846 +897000,u,17A9075C9D4948CC81873AFE92954935011487750B0C265A1DDA070885138617 +898000,k,060C414FA7C5BE851A01580B97B143E02D801AF5C8A0AAC8D6AD5C2358261F2D +898000,u,0BD830BED821F2D9A66A72A376AFC09CB6EB02BA5E72ACC4863EB0C629D0FA2B +899000,k,927FBEF0D692CBD2F32267C772DA752347295FA0E9936F9F7A5BA5F36F153622 +899000,u,1442565766B50E37960F76ADD78050D39D25F2F15D9EBB61205E35C904FB8F7E +900000,k,03AB9C057B018E0FBE51517040B739110E12B45880E73D1EC70D0592EC1A3B71 +900000,u,5BD6FD4AAC82C92A3BA7A545AEFA5F844BA879A9784C0F873CEE59CA10EAD944 +901000,k,6E66718073C56A4FBA5B8AFA83F46FD2C6C7586B305C10E82CF087D6651FCF23 +901000,u,897B0597EACDFFBC38DD018EEE07FBC5D03F45A4553F34D864E76189855FFB65 +902000,k,F2CFBC889002E0AD7EF0C239221D5083AE20D63FA97DB17A43A2F96FCC831B42 +902000,u,5BBAB8F4C10F8FE76479FFE103F79972AB9754F27E607488EA4DB60FDDFA9379 +903000,k,14E24011641748D0EDCF192459FA6CBBB72B61035259143D83679B68E4811D5E +903000,u,731BD997ADA0C9D45C6EBAF0FD33F805305E10675F18D1E158494D6CB410721A +904000,k,9034F4CB644A7E3318BEF086F9F1E28600350533ADCBE571F6BCF73D1D8C6320 +904000,u,6EBC7E4BEE7F1EBF3016F827C3631436469230A34E6A0420D424B0424391D42D +905000,k,B57D60BD272898942185102F52FCD8F9E8D0A552E6E586171E3B6E649E52A95E +905000,u,810C105EC6821A44028ABE7CBDD8A430EC3145FB4AA9FCE81A863C952AF2FE79 +906000,k,BDC04E09DBD302C026CC134CC026091FC9D57111BBC15C80087C553A81C1A41E +906000,u,6686267A439F2A51FE4801374234ADFFDFE8B2F96F13C7FC8933214E8C4E700E +907000,k,20AD54984932DD3B5021AE39E6CF96341D0F9A562A36AB6BC6878ABB1DAF7E7E +907000,u,E6901956770D86D2A74FD4C9DD4BE0EB05B7C19366D692ADA7A084460A539659 +908000,k,5D645B35FA4E0FBA2393A4B394C449DE6973E841E6C83439B215A75BBD4BAC4F +908000,u,784CBBF8300FEDB6B1A986E566EA3393040832DF6DCC64AF4B69659B912BDC5D +909000,k,4F17847FC18124D1CE2CF29C2E372CBE954560D1BE6CC03CEF34EC1C185F583A +909000,u,5A155D2E584FE76D7F24DAFB19C4D4498A3AF0B6D1915B66F02E7702F0D1D713 +910000,k,A4AB21FFFD8EDE595F4DA9F9AB6B25E0982C84A66415D7A3C8BBBA297057E216 +910000,u,799D90E38FFF188109B12B1CC442286D033EC6990374BCB7D9F2D08C70A5E27C +911000,k,342628590390604ED02629DF277BC0F530621CBDD8714470C5A028DF23E6F845 +911000,u,1AA00944658240AADC256F6704A0963229926057F94C50DB9FC7FDE7551EEB19 +912000,k,BB6CC83927EDBCAE711425A037E907FE42C7FE54704EB267184420B6CB6F5547 +912000,u,01EF39C213C961A24833BF8C2E2633CF8CAF3D46659F00235C6A9DDCC374DC02 +913000,k,2AB298FA090B252BA8717E6E9144AC850994850269527B1F98C17EE1C959A919 +913000,u,225C70F6AC1F59F8948D3A044D66BA1DDC421F5CBB9201F4DFC3EB4BB1A61D42 +914000,k,D721C61238228D4407EC3AA983BB64AE4081FB9E073E7D2BE90C82192FAD3435 +914000,u,84F9C7BE798778C47B45C9FFE9715F1D8B1CF41EBEF11B9AB3C7F1B72745996F +915000,k,64752C3F4FBD8E7F8C44F29541261E628656A38225A1138CC018A1697F7E7B4B +915000,u,F4CA1628736D3D9B7DF7DEFBDD4F2EC51B9954C4BF36AECF320A2A85B668AE60 +916000,k,C2FC7FF1FAC26EC2396E3403EFB1D201F2E69A827AABCAD43CA24290146DB56C +916000,u,E616459468CC53E1D8CD90E6FDC0E88E8B4083483BB7C01E96B003586928297F +917000,k,2E06EF3A49FC29C84BBE999852084639C221FEAE56F016A7F63EA4B5B5AEFB20 +917000,u,2464616CD05F58B33F0A9AC2A454B18E7FAD1226315201D87B0C32FC629A8070 +918000,k,D60812051DEE1078C699A181E96B0ED0E4D7022D2DD4FAFA2B3EB26F9102463C +918000,u,1C87CB3FEA86E436246B65F952F3A239CD37EE7B47AB7EEA9A4100D96818227B +919000,k,214E8E3667CE3C02CA0936B77F0693EE87EC599DF552F3106AE332420EA38466 +919000,u,8AF527B3DF5EABD51049C8BE65836FF9EA85015B15BF921865D5355A2D775024 +920000,k,973AA963174CF3F7B87677E0BD325746F3F2A7CA1223BAE286C13F32F65CC977 +920000,u,88BFA8D48A35D000180D1F08CAFD144AE1FD77734D8ADBB082D17A676C6B303C +921000,k,CD373926FA620FAB0F278BE01F98F46715B8BBF7E4266DC76B2CDF452A7FE222 +921000,u,26B7B3BCA4CA0DD22837B13FCDD07E2C126071BB19CCEF9315FDD2FDDD602B3A +922000,k,00AAE2582CC51B00D01A7B803AD294C3BD1E89C9181DA8829D397853AEBD8943 +922000,u,61410CE2731FBF624991E1CAFA2BE5C65D781440302C919A52A69CEC2B8EE20C +923000,k,426E6F29EE46FDEDDFFF0FE607B6F9446678C81A02ACB6B9C17D1D4EADB1864D +923000,u,7E6C35B5F84F58E07F3511D4CE03D0D7422A0A5C2000FE3F0024F5CCF593E163 +924000,k,B21B63319C8978C14676F20A96D1F7FC924B34966FB09ADA19F10FA6B42DB45C +924000,u,6EA2CEFBF44B1B9B423EEE0D6A1C26B9E2869F25E344E5420E90FF82DF791737 +925000,k,9A6978921697BD1D673DED6B48105FD5B2A8FC30CD9E9768ABF6EEFDA4902953 +925000,u,A9C1C99DCDAD16BCAEAD2542C66B62D8E949ACCA7666CE2DF3C47810DF27B914 +926000,k,7D7B0826C9F71F322BC121A24BF5458D02A4830F8F229D1AB707B0250F9F6C1C +926000,u,69C152367A26D47568D98035D0033395D51FA02278286822D775739B146C9453 +927000,k,4719A1E4B3F7C0D48315885854BD342306E3FAB12877011460255C7062C34E7B +927000,u,7EDFE2C217ADA2B4733011D17A60B32193DE1DB77CFA5C29229A4D27826D2728 +928000,k,EE885073B715F180E872541750393F8748FCA67478C821AE737BF8306755B469 +928000,u,C014F7B7053388C4EDC5CB669887077CBC74FA7F288DF5856DB3D6CA758C982B +929000,k,434606F7B724AEC9889F1DD3CC088BDA9F807849E0D9582452BD63C23F109C61 +929000,u,4C508E708C72F53A2DC42423FE36939D082074B25DFC24ECA38DF28CC25DC32B +930000,k,69A4180252A7D6B6051D6FD3AECE7B8366DBEC97C3D10733D34BC95A4953AB13 +930000,u,CD5683A21A690D8864D49C2517D22C3CCCE40D1139BAF8B8FF555D6D30E11001 +931000,k,C3899B577217BDCE8D6A54918347912B36B0062BE4B736A792F0841E80771A46 +931000,u,75EB89B2F734D1BB21323B60E2CFAB348A8CB5A8B21102CEB571D36E320DED72 +932000,k,185D88B3784F49CDEFFCEC184AF2F7AA716FEA0D54E94C9A44BBA4B6E4B33F72 +932000,u,FD1EA4EFF688BF9560483E21C5572751DFA55D15673C475E29E3E70FBEB80210 +933000,k,6C6ECD1C10C8A3512F5DD102A8FA02A6BAFEA98D997E937157B82AB832239E36 +933000,u,232B69E56A91003F52F03974119A710012252AA143571E9A77230B6C0027645F +934000,k,C9A1D78C3543C7EB0BE4A61B98F3116D3C367EA8874D42C63C4E3D3AB1916311 +934000,u,F48F9DBFFC2FDE41FF700EFB89D9D059456811BF1795E7755B47F862100C8F17 +935000,k,88655B34AD51D90FB24422961353FA828C8E92F07B8A51166BE1D1428C311343 +935000,u,027F3CD18B12676C67A8DF0BBF0C1C914BC369D8C569024EBD2FABB797919936 +936000,k,F9D6A392FC766DA43649692542C39A120BE800DACBACC5D30584D6616F31860A +936000,u,A0FBAA5B77A77401BDE73ACF82526A2F3A6E28614B1C15336385700AE1B5401C +937000,k,F088182CA36BAB32636A74FC5AB7B8D43186716A6CB72A92473DEBAD9F493744 +937000,u,4855C77D3865F34E44854B7761D5EA5FB751D6D5ADB0B4CC63E4B69D6EA6ED61 +938000,k,8B65C5BE1CC61FCCC200AD323A9FD2D1739269911FB604087FD33CFB73785114 +938000,u,DB1B93DF918517DBF7B510CA3F7FBE471A3F82886150CCD946A45C96EE24062B +939000,k,6174419A33C56EE1D7C914BCB47C13782DE634B10D2A6658CE8FBB4131EEF513 +939000,u,0B8ACFDC66EE2B17EAE937670AF000103A7DFD06AA4374E0F4CBC5FA31B9545E +940000,k,487D349BA6DEAF808808421D42323545CD1C804B177B8EC90C1F2CC232554615 +940000,u,7611E311E0BE3418619D62A672E919D3E209D1D0DBA72B0227E9CBC45A620E1B +941000,k,335AB61635ABC84C1982F4F06FD436811008E0DEF701CA11D7EBE3A1B93B314E +941000,u,FBCF1A721F922396AB6DE3BFA9B4EB41546F35137362E6A1BD35C8E5FDF5BF22 +942000,k,1E606BE46C1BA84E248BB3C3D46876D9B8268C1EEAE45A0C052D6825E0062330 +942000,u,401F15151CCF6C739615181395C4951E4400B65259AA11F0470824AAFD26BE35 +943000,k,F3651FBF6765986DF3B510613239B0F51D0BBC85D0BF4637E00A9A6DA2212E17 +943000,u,DEB50733FA5201D882926218B1F1481CEDF6DF418CD36A50076475A7A0199B5A +944000,k,A3D5B85FCD9B559E0848A9C0C2F91DE10979AE34A84BFA0C277A80435A119E73 +944000,u,E5E3A09B2B7F2A2038A178DA506A688BF33621DAB530C9BB9D8CF0D182C71169 +945000,k,159FEB00A2C2CBC0949DFFE242A3B18CD458106BD8A0C716A0EE2AF3D21BFA62 +945000,u,8F4F6EB646192AA302E7C3D2FE58A181E101B7F750834ADCC3E82028A2B48063 +946000,k,F95FA8B26FB738C812D25664E5AA9CCC7AC0564FB6DC0252CB79866BCF99FC47 +946000,u,8BB82FD1C3E5DD815881A43FD22B87A3A0D8DBA88B55141C4084DE3314D77E11 +947000,k,84B6D9DC897CC1AB5EDEF65F8D414E87CC7163FFA07043C4EB0F87007A6A406D +947000,u,7404F6352AB50F266BFCA3FF08F82836430934FBEE605F80B36E27C422076627 +948000,k,39860B98D8642A6E0245773C91F2AD2D8115500927E90CC7EDC105EA1501E83F +948000,u,87AD3D7EE48C3D80874138E54BEBC7B007C174B976A75B7FAC7F8BDB4579520D +949000,k,1456941A2B8DCADD301D6828368296CCF6911C21C270E3DCBDC485A36D075E39 +949000,u,33ADE6057113864650B73645382C5427A9C9D04B3F594702EE6BA3B98D2F4450 +950000,k,8BE69B12B1442715354D34894802EB5DDE90102575FEB8BDE5C2186279ABA642 +950000,u,85D6B4DE7EAE203DF667BD9973861AEAC6706C9C6FA897DF6A715C67E34B491E +951000,k,4BE0520E3E6015A535C58DADEE8585A24E1FB225E83072D5EDEDB16006693568 +951000,u,62608E7BDDEC03242A679110F2C4C8AEFFBB8ED1606F4B62E06B939BBDFBA552 +952000,k,A4E67228BE764C8F718A6035D95BE76F18BE73590C36CC4379EF6D083BB6F472 +952000,u,A7F868B73CCA6362627BCBEFA02A3680D40473354D35F962527A201A8EE1DE78 +953000,k,B588898C46B922F1C29CB1CE2D2842F31494A55DB7646D98148E909BBA99E838 +953000,u,FA2AD88DB50B9D653C58A2D9E8F295F730CBC70049B224C957E2328C1FBD8819 +954000,k,1BC46AA57C61816C5C362E4CAEA0306837B301A57930ADF3005DC47EAACD7860 +954000,u,E79DE5A3ACF4D1EEA2239004A5E103D4F38C659F5ECBFC94A42BE3B7DC0EC624 +955000,k,D86E2ACAF5AF3B53715FFA190B059C878E47A578558F338E88CD38A92FF96A76 +955000,u,5E390EF3650286A78B95B6DC0A79D85B6DD8DC2EEFE7382AA05E1370811CF866 +956000,k,F715835D6E771B17F74E67822315673C2C190CD5A7AC6C9128CFD2E099285B3F +956000,u,14ABFD7267C0CE229C6B0B80406B981B78A3BF30B720F45D4CE2C32347D23F44 +957000,k,C87CA041C86C96ED1BBB5595A39DB39358AB943768E0591597D2D7D010688838 +957000,u,306E43B59415DF62D6D7B11D7A35F74D60C426D9C30354CCADCE0AFA19548A42 +958000,k,BF4829D8541ECFEC5F4FAAE93746C4DBD2FF41C1F0292C3EB1EAD08AD07D7A32 +958000,u,CF76E7654D2F02A20EC161B636F9F518522F788902AF397D57DEAD5576118B7F +959000,k,48AAA751CCF391EDE1C7F12725E5308D28550BB01B1F050807AC55EF1A282514 +959000,u,F59912C060CD36703D701F6C026D5E7E457702486887BB1660DEECE9F161927A +960000,k,7AEDCEAC1F084FE7DD8DAB9516908B4B90DB2681297E49CC1B221FF1E90D800F +960000,u,0204D594DF6E714C3A28D15757943131700BA0F31DB2FA08DAFAC6A99257E82B +961000,k,6C1FDF3D8E6707B7573C9157738CD1EE6F394977CB4F4AA38F5531E6B83ADA4B +961000,u,F761E87DC9836225C5A837D11F409A3DD6880CA314F291B0B531E3ACC0333E63 +962000,k,0C9BF951E8C04E93E95F89EEC0143B224147DCFF14288E23CF1A6717F97C2D51 +962000,u,3BDCAA2A734F3035FCAAA1A4C8A52B79E8A69DFE54690790C1AB714668B44D60 +963000,k,01352BE13F25448737B3AACD63FF9A70E9C12377C951C13014AFD61130028A59 +963000,u,13E71F2AE605501E4401C9C8B2607DE54F7CCDA3914676AAF2598FFB9821A741 +964000,k,DBD130E5F6D94EBB9A237B6152D73FB14D90B5C98B316466043C9BE79E05A86D +964000,u,890C57BB402C47062E2CCC2B3B3CB9FFA0967DB654675DD20EAA35BAA6F99B71 +965000,k,E216E19D098E9AC2C70050C82B066461B5A546F5EE8D6EBE55A20C115121C242 +965000,u,D4DDCF5ACB670148D74499E6C669022BA4D5CE5A0470316DD812B03C5F2FDA46 +966000,k,FC486E49D078B73AA6AF7908630E35105C8AFB30EE9E3FFA591E190BE9A7683F +966000,u,41C5AC29A6EC2BC4BD0F6F9999F1915CDAEF06A005A31B1FFEC6B31AE34C116A +967000,k,31A47A24AC4EA3E028F8E52C2A7633187320F2DAE2FCB8A418E0937F6D1CA304 +967000,u,9245BA871F1C696BE12EE0191AE337587E69F2510C3FBE673D8C86AB0023343F +968000,k,482500A5872B4ECF499DB3263A9B0B4656159A889AABB9DED086C297E5056027 +968000,u,C241D5ACC66AEBF0ED1FFF33F29E3B97CBA7CD6352630ACE400BFA3846158438 +969000,k,A47D92B0E2F17A39D40AFC09038212BF90AF995AE8C1F61D82512DE8AA66A558 +969000,u,FA3DE555E91E77D33523474B16B38D0159FC2B7B49E68C20C1145980874E7561 +970000,k,16BDC3324325751A18F6BC9B292B941258F9417850888972E2EE56B294B1C216 +970000,u,80D7D76939B25398B6469D4F4324A3E11E065DA85B054FCAE6EDD099D07FAF19 +971000,k,BAA584169C3BCBC2FD5DE56FD16BD03C65308BAEC5EA62C63E84D399656B902A +971000,u,AC7190CD421E3D262DD3A84AC82681CC4445FCF427720B23973A841A54792E39 +972000,k,C51A848CC6E5536F31DD10FB442469BC2BE9985A7A2C50D337563B00957F9A3F +972000,u,A512BDC8AAEB4697D39704A19C21E55D8E7650887E41665F18F6D1E972402362 +973000,k,AB22007B1C09A968D5B0989A11EE697C5F5C679180C06F8873CCBF15B5177507 +973000,u,F664C4C2F14E15395809991BF811534BE226C07520688FEB17407648CB7B9F52 +974000,k,B5862FE471ED0BEAFECBEEF6A1D59C0C295890265555C8E236A12A3BBBEC214B +974000,u,35588EF9E8EAF8A8797DC5093024060FF01D4C91DC2C07694A79D58575D3C30A +975000,k,C693953E1567837E4A2949CC7B8695E74EA6230594AD83C5880F282042D7DA24 +975000,u,6A2D65401902C21A4DD55CBFA03545CC0106985FFCF173A74EBA73D65A313E13 +976000,k,D5AB8B40C3EBFEF1CCE4AE9B11DA82D3D37DA27A44ED0595FAA5A35C811EF37C +976000,u,5954A2CF863B3D80893D466F2CF40980767327A30A0C356D971545A42A4DDD7D +977000,k,0ABF8185A72B5A46A87E3EE45915F21608FDBE4ED2A300055CFF199F0AB61570 +977000,u,5E4DB274FF246E3369456D5D2C82ADA5A6B22E03C66EE6199315AC1613FD510D +978000,k,7AA62EC7CBCE2CC34DBF48231F0BBC0044B1B14E0AABAA19647B98C98508632D +978000,u,D53931F9CEC9D0C12D9341EB5B7108B0D5D64AF6EAEDED948452B7F59DCCDF0C +979000,k,7F4CC9954F3145B3AD63BDC436EDF70DDDA546099598A71F258C617A4C7E3F49 +979000,u,FFFF4011830132BBD0CFB3F874FDFFDF403121388880C5E5FB5EFB1778FC6A34 +980000,k,5CC0F16BCB87241ADA368B175BFE635D0E1176199F0554BF87655E5A0CD17508 +980000,u,C144FEE75A4A00E5167DE938D6FBC9BE8482E6D2E533781CADFB81441CBE595F +981000,k,0F9FB2213AFC87A404288D001CA3EC2B6A56732E57381E307201DEAB937B0903 +981000,u,212E9982C158648A75896409C78B184055EA727DD4B187BAA0D5FF7317657F73 +982000,k,3EE7B4B18BD15F09E3F9EB837EA5D8B03E6E0D30C1A189DCDE611AB0D326A857 +982000,u,8C71475EEC94F1ECE7807EB30F8C9D6EA77320E641D5041A4EB77E8DF6F7BE7B +983000,k,7943A2D5985315DB94ADD6BE0395806C10DC3DD11EFC068AF38D46E989217F29 +983000,u,E2825E58C6A3386E0EF704425C6588EFC71FB4B2FCCF366D6AF32AE36D54995F +984000,k,28C11B18B31DCB78E04F4D2EE93572D6EE3B08B570ACA75A38BC1E30EBB17436 +984000,u,4274BA7D5EE34493CBE7FC2EE608585AF206F8ED0A0340A177EDB15CED744748 +985000,k,3C8E514211FBFB4182D0C4EF487AE263C0A9604E97BB90E04BF241F8EE1CAC26 +985000,u,E36D7E3572D4BE292DDD5ACF19A722412DB4ADFE8E5FF4D45CC6C6924FD3220E +986000,k,33DD2DB97783A196E7374D90DB75DBDCAE4F797C78C0B3C717BA9643A14B7477 +986000,u,4EA2F1C5DCD817CED5184F0CECA5CA878661A5844349E76E16BE572BA0DDBD24 +987000,k,56A69891DCED11E6BC25A6A9EBA59124D57B3059E477EA7CFB6BF7DEF0F65939 +987000,u,A37EBB47A1B79206E3D6B9984FD0490998B052DEC3BB5ED485C4334B2DD24965 +988000,k,4A87C7C91320024D8AAE5AF344A4A6BAD8057916AEACDC7543211E0CC839DB01 +988000,u,96FBDA1FB99CDC8C47D3E8BA0767FA3280B3BCD4BD78F1AAFA7075A1DCD40C34 +989000,k,DD2BE18EFCAA493614D841AE2D120F6D8424766C36A3176990E45884F4D50819 +989000,u,08989B10FEBEC25B0C62200A31937CFEE195001D34F8B2B6EDF524DE4634B018 +990000,k,C9F1775A99940B1EEBC59A5A513A2AE94C5342089D83CAAF1272C40D2FD2742C +990000,u,A3DE2790039CB360A78805909891A9CB04A889DC32100B5E15C8499AF55C2363 +991000,k,FBDE2B18A67EEB30F7B1BB017951B1440212BB6E30D5737E8E9E590C082D626D +991000,u,BBD9932FFB38808F53A1964F965C34A05C56BFA1EEAE3745D88C183BA3CB1241 +992000,k,406B4148FDCAA46309E0D592609E9A7E16412A610841690EBC5F23EA0AC01B3B +992000,u,B047A874681C09E4ACCBF01660E0B0ECA439D2CF95EE6B2F42633A3F8C80D30A +993000,k,67B7D1F31F660C998DE57C0881E7B6145BA9FBC332C83E9FBF4E2C68C1EA523D +993000,u,F7FE1519B65BBDAD9DDA247ADB77CF97C5468EE5C5A9B175617DEC50BF02117F +994000,k,D8DFE4796EC9DD962DAA76B42DE33D102B5EBC4F74DA519C8A1BD61AFF211B07 +994000,u,C5024B02088690CD9014B97329C715EA380905134690578DC8959112A4DC8E1F +995000,k,3B2693169C564F9432E316306EB9BDBCAE982B21921441B589E1638E41446046 +995000,u,EF755967040A6A3E1C29C27A5449386B42E8C7C95839247CFCDAE91FA942E97B +996000,k,73E1B88B0660462D8D40877E9E682B0FF84ADAA8312D933FC5C0388AAE344002 +996000,u,F21C3206C73D2C4BDE98C0A3C037986D8CB66BC6965A6E502CD0BAAF9B31AF0B +997000,k,DD0CABE418D443854364B73A27698909016E3BF67D087DE3F2864E27EC59D008 +997000,u,B296A5A8DB14EBF7DB856C813E7BC961C083FF9C0CA91D16291BA95AFD03DA47 +998000,k,0CEF31A301BE3C38A2F30CA1BB07EA7AF2B20466B9775A905CC3851A2AB4E27C +998000,u,CEF176617398F7A9D9445E132513DC9A7D78D4608501DF0846B05DEB8F190E39 +999000,k,F7015F8F47FC24143A782347C8FA04FFE119C85D6C896ACBA82072D7844E9210 +999000,u,6A7FFE1C87BDA9D2CE0A2130B6C19B2DBB35EA3CA8DDFA65FE4238A3C2802F44 +1000000,k,7C3911E0AB2586FD864497297E575E6F3BC601C0883C30DF5F4DD2D24F665424 +1000000,u,DC05988D881A30B30040D3192EDD8DC2DFB5CCB212649422C1D7371676B45B2E diff --git a/test/jdk/sun/security/ec/xec/X448.iter b/test/jdk/sun/security/ec/xec/X448.iter new file mode 100644 index 00000000000..b5f773e2a21 --- /dev/null +++ b/test/jdk/sun/security/ec/xec/X448.iter @@ -0,0 +1,2002 @@ +0,k,0500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0,u,0500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1000,k,AA3B4749D55B9DAF1E5B00288826C467274CE3EBBDD5C17B975E09D4AF6C67CF10D087202DB88286E2B79FCEEA3EC353EF54FAA26E219F38 +1000,u,11F1326FB3E434B8F7F5ABC6882697B39188CBC91A990C2C7A9EC41ADE3DEF4F2D1E3D4AFA53F6EA7538768FBE0077080FE1B6A4242B2984 +2000,k,7D088ACF29FB1A4BA5AE49826F4974770B7AD2F316CB4401233EF944E08C179642B388CE916E8D3FC3649F75B38831DA756CF5F1C518CE14 +2000,u,3C6CADC5CB0787F3D5DFF388FBE5100EE90E54298A57F2295D374F866F3F11B05D310827DC4D88CFAD71AA0DD409A52F9192FAD25A759531 +3000,k,0DCAD9363AF9151EA0F760F59AEECD17C6689E37439E61633F28D3DBCB8A679C75EE6BB932E6B459C39F4F28BB5328B4633684C56FD0377D +3000,u,2721C8741E1DF0BD16117BFE94661F645D58BCD4D1E6E83DCF7D5A2F4E5D6CCA673C25975065873C8CE02C4C84393CD2F8121451F9646B7E +4000,k,38028CC9A4E29D274FFA0BEDAD8499EA968EBE423B486EAC9CE60C250207437A4456456F820169FAF06D3EBA912FC3731CA94C49F91EE47C +4000,u,A11BE8CB1CF219C9EFFA63DFA4AD82F726F05AA68BBFACA2945CE3537EA0849154DE14AF8B0CE482056E40FC1E565706E047A22452D771D4 +5000,k,8EEB26619DF3A2E5AF823E8CC9ACB925469C7B0F495CED6306E628401D0226D3776E9141283E3B049656717D64AF4C2F58338A5D26CD2AB3 +5000,u,00021B7968CCFC703F575CF4AF05137E8528DED6C148CD945FC12894DD3812ECA6C66460F073881A9D22337832A2E95876A383AF0290B496 +6000,k,078154C0D27606651DA6350D5FF905FB6D0C9C411EB55643E385A9A2591326FB845C27C56E4824C9D99E3AF46EB8867CD4FCE24E7F3A5C15 +6000,u,F343F6DEC527BA0DB0A01DB92A5A71BA5AB41AD7591FD549FFAEB31BB0C4A87E938ABD1B6DDB14C0DE263CD944FCDCF625414E6B232A6223 +7000,k,52D3291414B7BA76C8A75DDFDFD4381ABD274B3E13735BECFF9A95CBB106BD8DAA8E6336258800003FB7C21FA680DBCFF983DA234C093C76 +7000,u,E2E02ABA8505F2EEF0D25AAA24AC0554949DC1441D3E035E6BCB0D0A4BF9A208C2333EBCBA281F548C7957C076A50D50053F72CD2E299CA4 +8000,k,ECDA4D9E9E52BD0696E3D48CD09A5ECB345DD663D17507FD371410E1ABC8952774EF3550D7EAF9386037B1CF07BF75B128B3D3575A56E94F +8000,u,06B7848FE505B8370283A52743087606C9BCB604CA31865DB1124C303F812081A3B42D0954E40EB38CEABDC13022B1EAF15C616DDA75BED7 +9000,k,D172DDC185A5EC19FDB6FAD16600D2C706C5C68629E50175E791CD8A7F5520BF61A90B831B79F10B4C710A252AD0EEF86FD9DF8BAF522356 +9000,u,F9C47BEC7BEC936AB72AE70C027581C9754DCA77084C26FF5B396E8F0A8B3A524BEF9835F8C815B17D123F6F1F91813AB7464DD327417A25 +10000,k,D8D36C7E154FDD4BD2733F1F6038891928A94C8F9F8DD6A1D02BCFE027E320C5F2008F7B4C37B3AFF357EC7DD884C2D43681F1AE73675C11 +10000,u,CAECA6A3AF262B7D123A6D85344F0901E34A0ED1EC0B653B59EDA0D4917702A7F035A896E253BA6F71812404D20D80B2C99397A329381E12 +11000,k,A4196A64A9F85B9924F0603950C5766927A8F777ECC40B2E3A3C2A3FDDF0F92C6B83F548AC67A7102796A7EF27B73DA8B7297A155597E6F7 +11000,u,A25C2D0DDDC5A526DE8D0CA12C5C07E333718469454AA0D2930963AD8ACBDA19CAEEE65873FE31677DFDA43EF02AE8F0D28706F87CBE591D +12000,k,399F5217280740B9C9E5FA01DA9D4356282F3B59111B412B2B3D42DCF36DBF05947ADB4424FD06210A2909331928C9A9A7ED148730A6D5CE +12000,u,410ED2FBEC143F2AFDA569D86E59BA3DD115950C1AD55376CD14342D549BF33FEED4CC02BA300BF8ABB7F20FD4AD60763CAAD822BD53F0D7 +13000,k,02D20FC9FAE331B0055EDB4AA56FC3049DEB328BBDD90343A7BC86DD40D4BABA54CF1D3892AD29F699BF042C1C5711135C6FA4A3653291D7 +13000,u,D78D1FEFAAD54C2497637E19B9BFEE17CCE7EF7D592B76D1BED659A4B624B0D54D7174A3249C2A2C93F1D82AFA89E9662EC480299F55837D +14000,k,04D828FD828A3DAE719B9A26787DA5E157DAA76949674A81DFAEEED791396ADC9D5189183DE054348E1B997505AB7E4E15D56312D1F05A5A +14000,u,103DC760EFE70E4FF0B46A12785596598233E7FA38C67620C22E22218559C9C6C608559ADF86DFF155D6CA051B907B371F6E8EDA379E448C +15000,k,895716F1FB3DE4189E52BF5FCB720DC74D67F9D542AB6995E819A9CD43FB5436FC0DD81B6012AC35EECF621C179C19713C176D6935C9848C +15000,u,903F3BDD2D375EA654B9868ED6B98633193C4B5011D05098FA00BC6EADEE92028E38545D0E6037B2DB474147D1080FB868443A298659640B +16000,k,D0B6EB1F0DAB551C4092DAB496F36CD8142DFB86C60201D5CDF6B4853F400F42F4739FA8DE393DE2B8DFEF8A4EB608430430C61328412B28 +16000,u,B8DD596E127B9AD49668880AE43CB1B5740C4010203FCB99858BB23DCFD6AC362A3ADB4219C3C0B1A433415718E8597E0A9595942E36A3E7 +17000,k,2A0C84D2ECDBE820AD189C320FDF48612D00A408C2A881750FFB090B43D43F1FFAE953BEDF3164F35A659A0192935D00F2D588B6DCC3C941 +17000,u,EA4C97B205E9C449FD6B5129AF6CD87A4AB9ECA6307BB409BD23F0D91596F3DDC194210CEB2BE4B4B72679BA2EC84C611A93DE2C2D4B021F +18000,k,783EF0C6CFEDC67669DE983FBFA327575F2CFAD94BD5CA35A22A84A15DD3663471D8F1D002945FD6F8D898C38EF6AE3A38704014E325D375 +18000,u,61599E580D1A48A9AA6CC2D01DD2A4897B059D4F31850879EFD74C2E2844F85F2CD93E4C3A096B43093C6406741243031A7D301035B78745 +19000,k,19EB3C3504843BCF8C411E87E57B3475AC2FD695EB05B4D147AEA2E85A63D5B24ABA376546D70C5C3BDD6047DDD77307EBB824432EEACFD0 +19000,u,0BA457C986106C0C0A0E551FA09AE65B832A106F9C1412FFB22609A183E18B4B85AF94CCEA0B885BE6212CCAD4283BC9A9DF9057CD8826D9 +20000,k,F8E5B654C465EB1C5292F0E0964E4ECD0F837484CE6C9DE7BFB8494E4D3AB3FA466DAB502AD0ADC503CCBFFC188933C4C348CC57629EFCD7 +20000,u,06341FF68E7AA52BD622297BF7FE0BCE3F2D82480C2B3A53C9D5D603B8B26A85B44E3E753E42E42F22DD67137F2F46760E59F8161605C965 +21000,k,81300BF98F89335613141447481C9D9DEA5A231FAE201E10993B8080CEEC256A95A5D95DBBF0A588AC1F34F1AAA92914EE53CC673225D0E0 +21000,u,8C7F15F95DEC77331341B769367F4559729724ECDB7E1FCCB04A7BDBAFB2A497C29DDA929A107CFEA4FFDBC9D9524D6DA49BF773DED9FE6C +22000,k,E6C78D2322248958B4E6B836CB420DD59BE408E9CAA8C27055035138E904EC76E24319023FA75812E82DA3208216B84F4741CA5041A40000 +22000,u,7E9E09FB3E390A64E61368975C64D1EE7BF2ACDF36C7003FCF98710299D21EBBBB934373A4032CEABA0A7DE76A0A25ECD8F5C1B8E8DDA282 +23000,k,0E6B7C4871E3550F50038C1127237E975795FA66C0AB0C3F94EDC268BA360DF5A82329D64212638278351B7DFB4DF707681F4BAC83DFB154 +23000,u,13406745537FDE5AF0B3DECA7466F1592D7556D231E19769005A71A0457B145A021D5A11FBF4DE6B7F8E0CA1B5E3C4F1757D6FE6E41CBE8F +24000,k,07A4C0AFD3ABC2AA0DBDF21915EB898A176149BCAE4A45537664F03E9805199E15851EB468E691B94380E70B432B8DB4C47840870CFFD715 +24000,u,D3787E16C0776B8DC6CF18C49EE62403F8A377F20A68D1A77363EC2EF7BD93F51F09AD56414F0647C01B34C169885ECA1BBC7C7DEF67E255 +25000,k,DE7C7BA166D2E7223857A511DFCEBDBDA70C337AC316111EFAD57AAB5F515AE0AF5D8F4E9CAB88C79C90BF55CE6302E75DA3AD0BB8678F17 +25000,u,BD138421784D5A7BC0D95590BFE1153B047F9A3359F994563B7F67FB79FCB0759E662752E87E18BA25152D845D6E7D68A1F091EAF272DD44 +26000,k,7F733AB28F49E718968375E88AD336018C9A77000DCE6986A7728B54CAA839DB75B42F7C752324AF3BCAA7B55746CC9B2EFD96BD1036BB3D +26000,u,CEF7C45A7FAA60C797733FCE8C76B6095FB5D6C887B499CFBE1A0C2BF6FE4C41D47D0F159F3106752BF7C60D873B46983C4B286F69595FE1 +27000,k,AC6D448BD1A755616C06ACA3676195EF9B40E99FBEA50880C44D7403B2AF66A8ADF95403C07344E53C4251F3256B2523A2502EDB2A75341C +27000,u,9B788F943ACE2C3B9C7EF2D07FE1CCB058E2803BD37F622EFB9310457965C888715892BC0DBC3DB3A08E5AD7021DF793980C38FA9AE9C783 +28000,k,143D9B5D122775057A6DF0F29F7E2CC00DD43519512ECB31DC333367E06FC4C00A764E5D0753E13FC55C15AE267312135BA3FDB37C36A0CF +28000,u,839E020B0CF32E7D4D6E85D806C6C8266EA3AD689A72D05244404779B9133D63437CB71E68D300534519EDAD714FC234183E5D45F6083931 +29000,k,FB80DA2CB835284669398C7EABEEA8455E5D0CD48F33A138D45FEFD85A6942CBAC424B5ECCF808D73BFFE9689170D9F39B38760F93213D17 +29000,u,AB7131B1410E0B683E947FD88D50C96FD6039D939FA3004DC7C5B826295B091071CF4B85316E87F76825C85724D0DB4ABBC0ECBB552D14CD +30000,k,7D09CD83B20926367BB4A77B2475A5C1DC2DF0BF3155AF98AF049072CA000349B1105C764C1733E1BA680D2C4F2439F434BA319156DF21D0 +30000,u,1CF019AE668C88BD3985DC20962A32F86D089638B4FAF542D7B047A75D00DE446BAA2F0A146DCD20A4E4C3B334DC506234E28FEB3952F5A6 +31000,k,4ECB38C75664C34D061FE6576706999FF364703C71FD80C7897B5F386446A06CC5DB3C5B8F7F9551EACD3DB6ACA44EBB44A6B982E376E7DC +31000,u,E03E854A016A549DA5BD54B49ECC10AFA94BD270831AB1D2085E7432CDDB7C0ACD60F0DBAA25D5F77E6801E57AC5FB10849163B88514337B +32000,k,9921985B1C26B21AE07FDB26E11F64BFBD1224A4A91355E53D171CE50854F8D4B2129E3194C022DD88BC36C781EFF112D217EA59701D66A3 +32000,u,0E4DB5EC8780EB0F7E7969FE77D59845B84B10363DC83B0C0712E2C404D5F69779398029695E33FAA90BF9CD54747F240A92497D6F036B1D +33000,k,73B1D40422663FAFDA10122DAF20A85CA2AADA4ACA01ED0160D51F0D873C67A06A3E748C7EDE68211D6A9CFA9356234671A6801BD4746806 +33000,u,CB3F20B5C9E164F91415196D3C3C3A2C037A546F0C3896805D45326F61EFAB1C3BD11309D378BA507706147D05581E76D30D65BF576C2C26 +34000,k,135DEAACB25819EA57EB54A015D8CE060546322958B35CD7545D4D43B84BC8496FD8EB9E9458E1843187C700102E13D87F62DFA9D452D6FB +34000,u,0E77FE2B46FFB5E8C1D2230DA84E833BFD778B2D82B3E6561D804B8B8D6A0240C1E126F677E015565C2F89DFD5DB4237EB7249140E602647 +35000,k,373A8833D00A21E06D751008CC4799EBAA7DA4B9B9CE800E1AD8445928DA5906430BED8665B07F9689A8CA57549250EB9D2FE501E7A52507 +35000,u,2075B16305BCD90AF3F2CD9D990BBEAA53B89C2D300DC9C3675C4F4F7DA51E5A9C1DEFE57487276CD1C8F5B4D1A6F0EBDB9748D545E8D938 +36000,k,7145C9F8BDD079F25708B6654A42764078324525E0D550B9AE85730F6FEC8DFD4FD005CBDC0F734E0E42F4A0A31E09FB3AD05E8F36121897 +36000,u,2D8365560B0AF5B173022D9BE712DE69233C95990980618FDECE6D92C1E2AF6FDDC93E688A66E8BC060F659F39AD54712147F88138E27F6E +37000,k,03F63B397ECFD859BEC7B4746113966C2E0CF8EBFCE226B828DD4A84F0FB41D86BA2C313B6E04BC21171EF0EA6F034905AAC82AC5BEE477A +37000,u,F6CD0D9781504293D09A3C3CE90622BDB777EB6E8F512E9AB8E514B2D6D83BF87C1B355F62F47F4D1D636107ECBE514818C5EF6AFD315939 +38000,k,E6B11C65B8CCA9D8EEFFEA995FABBA687B0272CCA194B0E2132624B321A186767905BA77C8EDE5A2CBC153D4E41D7EEA1E8A695E13F8780D +38000,u,9601F8BB0F08E309B5CE56E2925F90278687DB1678D6719350B88BCBE3B46AE69E9DC845ED554855808C9DC93B99F08AD0E70B98C00331C8 +39000,k,61BB4C6E7F03C84F3396965558E268024746E141D1EF008CCCFDF9BC4A9C249AC1985F19C298B1F0ECFD15E006EFF559FC3B97ED49DB2213 +39000,u,AF3A4FE2894A7AF4733B8E25BB45350FCC8EF1B919423C0FE2EA10AF6EBF94A5A66A2AF7C6A53F9D134B1ABA088C23557BCE8E4DC1396CD2 +40000,k,BF38C703197E001E98C706C6A197B86C006B8E406311D6FB8CDEE6F719ABB0FA733B3076F3A941F7E289B548EC6FBF9818989A99EC732490 +40000,u,35D7D46D4B0D8CF9555824363EF5207A04F6D23532F094661848DA7F546228212024DFCC8DADEF3E83A6B46688A8F47C35F5C49075BE99B4 +41000,k,E3920811B5FF4DC9B741AC6B9F25501CA5B7CD787094865AE311A5EE781824271AC894B48766089052EF9D57FB518B6153E41765E91DDF01 +41000,u,AFCC5433551E580BCA168D23E480D9416FD027DB09BBDDD18BD66940B5444777767198447A220325F7A59C7BC860C2A64D72EF24FD693C22 +42000,k,0BCC15563F959B3E0733E8149D74675B7189644178F6220D63F90699D402DD88563BABBEBEE161175257F0B6242D084A9BFF15E791BD0F5F +42000,u,7E2A02C2D8AACF6A6A5D9CE42AE1A4089475CC1E66446539952998E15A7BE7DA0579A6AE6D5BB521A209F6A536F91AAC0D7A85BC44EAFAAF +43000,k,9A7D0A1AB8BE47E1AB5A485733497282C3F006A51F22445FFE56B0DDCC11F345F7105595C517E47A5CE55C59878824B27CA5884D3BE0EA0E +43000,u,813708EA64AFC1EDF950C2461049E7C322F8626A026D7050F5142B665FC441637AC55AEA41C59E6D6BBD4A7124A52561CF4CFBF8A2A7E86F +44000,k,93FE5375FE3DBB147EF7EE010907F73F898CB2C3970F98186133F9BF535A3B2E62BB74D0F3C8149F681C7C7CC244B04A65A0664A50D58F96 +44000,u,FC96043DF2CEA17C8AF3970652FC47A297A6A815BBC46183AFDEAC9FBB41B6B01426A5497523700A0822E24EA8706177ED62D66BE1DB57DA +45000,k,D8CD0B7E894B5E60C4E1D5F04C46D371DB9099096FA2859E38542E06D2565A31FD2DC06D134EA5840CE5E4BE0A7C5A0A6EF3771392CF130A +45000,u,230B522274AB424AD92C0F18978A72F516015708B2ABC72342AB174A8E6E68F2D0F081DF554940A92C12A80D5A1D354462DA54D5469F0448 +46000,k,2DF7DDACAC320867BD503CD93602ABA2FCA1D68C7AE4E29B9DD685C1C925E9059432D5BE01D364AC403D0CCE08F74BB41B7ECD4CE7884025 +46000,u,5E92540E2C91E4D332DEE37582B4408223580E095F8AA0E60772A32889E7DE5410DB909EBFD55EA799B8B91EB641C975356242E60A0837F3 +47000,k,BA1CF289ADD1DBE69B275C4FF8C4EDF7334D94BDA7BDE674F40D73158C64C833663A63FD0D71DE0C41ACCA55602EBBE370CA1460C7CBD954 +47000,u,1EA32EF97639E23570D959C770181AB5EFB8679CDA61E5AD808B77E47C97ACD4A58AD06FB97597670D7D19F1990B66F5C658BF7AA4B1D084 +48000,k,4DD1023A61F5DE11E8398EF900416FB631AFF53BA1BB7AE4D62AB02DD7402A4338ACBD860C9C9DC901363DC481277926C2A2705356B9A884 +48000,u,699966CB1AD307CFC618252ADACFB8EFC9E22BB1512E90325C0ACCC7090690806BB704F2AB2B9F0E1C9AEA773ED620F837BD3F9EF5D1F341 +49000,k,61E234180A2062514BA735802BF4D9E5F04B2B20A90AC8DDDEC98D2153C88236C4BE612020ACAA2E8DAFC661B462767E9C3F647EE070B74E +49000,u,3A78849FD3E2FA28D8B729903F2C4555AFA5A33D7BDD78C4A0A4C0EC77FB458C2A5B3F8C349F04FAF46541A1B91DFE7C108680B0439A3089 +50000,k,FEDEC067BB4617D630838E775AEC5D4BE05FFF626A25606F735476F93F7BC4581D3BE79EFF49F4157A72669AD3326C80BE0E87C86B78FF5F +50000,u,D9B50753F95A323821AEAFD4DD6FF91DD6ADB643BA5817FA2978DC871B5DAECB511E1752A03EA41204E0F6BCE28FDDF568BE7FFA3C057854 +51000,k,7C99C4B606C8A826D607B04CDEB59461B338C18D47B1A7CB91099CB162691932033E82A453593BC4D96C7904451F7CE307F653E1DFE4BEE5 +51000,u,4CEE426402A208BB83EEEBEB20058EBFF0D0BFFA0F60F9AC71F4D2325A39B342886181114F1F5CD2531AE0986535AB3BAC86EEDDF45D7E3F +52000,k,133D2D2DA0ECE820225F6AAED9593018D7EAF3AFE72D524041C1C69FC4702E6AC7CCCC0E34E9A581AA777E759702CBCB05015EAC4E33A17D +52000,u,05DE90B9781BD9B74FC1597A2FD86CA92D79E536446340A744702094A9093CAD79C5504AB9E90F01245D761F8CA4CD7FAAF133FF2B28C9A6 +53000,k,161E667CA9D2F370FFB6791A58BA7D3C71B85A22119A980D09D07D73C720ECA49222FE2BF55F31D9BC1DA6C6FEA308EBAB5B1DD9394A27EC +53000,u,933D496C12BD9746CD1A3154C5DE4248E203104CAB4139BF2111CF0570664D16367B7C38361FB281CEC72F2A540F9ADB93924D5B74E0B3B0 +54000,k,E90F5C4FBFB116F295ED0383D760AB5A4E2F3C57879F1F3252F39953B43F4DFFE134A6B7FD56B89A31883FBA192B8CE36D108F1C44760345 +54000,u,0E5C96AA3897E4D8A4422E50DEEF23B42D7E400890FA48B497AB8F88DEA7E85A01F4949FC997BDD04FE5418EF1024CEA83AE5EBE77EAD166 +55000,k,E3B01EB635AE9C80F7E49140FAC222D9EFB68A427401AD7293493C15A98BE5D5622F276C7815B57947258DC5C3B589F24BCE6FE229F859D5 +55000,u,028F0B86399C3E10DE3D3A14F2B4D79E0D28175D23268D0B0FC150879705263025A2C20A340A3EF7A8769305238AE1316B45CFA184C92F67 +56000,k,38F1589BA779ADCD5C476CB625E530FADB98E12636C62F2057720DBF2380264E13D07DD99E63B283EB6D7F77AFFD369009F99562F86ED7DE +56000,u,4E5BA1F182254DF43B9223E350B53980267E7FECB65ACA5D6AA55C81642F83D6369CDFA37F0B53CBD142C18FD4CA2C831D4FF6E0F43B9A61 +57000,k,DD3D44AD5BD97FF3A637CD84793FB0EEA2511443AA545161355CC4CBFE9F10C9A67E8729D3CBDECE80BB1DF45DBBF7F14C08B4BE211BDC38 +57000,u,DC27A60A6CB5C37027DF7FDD7E071AEF714769F2BE7E7461BF5267F0C4A65D409F7C64B069236BD40EB8C5244975E56D6A97324F3125F206 +58000,k,FFD4B7C2ECAC00929207C951D41565E3E1CBF93103B2F5EC505E27AA58E01D6E3D35F902AEBCF4F446DF22D46E6FF9F4A05E0D10BB2630B9 +58000,u,E5075B6BC2ED93C12A0C6B9518AE247A08D2CFE533546926D80EAF48F02DFBE41F6FD0FAA9C267474017AF9F291BE5D1B5714EF207301CC3 +59000,k,02B21D01DBCD1E45DC4C0C5F17E04E25CEBA39C28216DDB341E578C96CE825AEFF42C4765629E9260FE47BC8DBCD6D16C4641731C8A05AAD +59000,u,220CAFAA6675C57D71DA684E04B80D80ED062C51C657EC4A70F8EB21F1FF4A15AEBD26FB1CF9D08484820596393C7845EDF2FD605209B0FD +60000,k,330BD5E64998ADF94E47D5844267EC7B5C49D162542C2527ED84407057D08E696991322760A30D909B208D7FB7977B5879F8AD1E06434658 +60000,u,49C9DA729E92E9961A82207D820E34D756ECC2F635D43B4A9947D85C697B7DE27A9BEDA4819BBFCEE540F20B456FC5D0470BF21543C28F04 +61000,k,5D946EC29A7CE42940481EE9029395830BA8A6FC64480AE1099271EFD6C2461413DD7F15F67D0A084FBA76FD0CDAB6969A615901984D9FCB +61000,u,7291CA7AD14830C70E19FD7FAAF6965459A375F67866ABFC0061BFAE5E92A9916750C2D10E1FB1245B905ABAC28A16EC7FEB8642D9A5746E +62000,k,BDEC42199242662F346A04A61D1F1064D6AF73CC17EB44FFC81C8D8870E40696C71E604DECF070C46F33C5A441B81CE8E4A7EF295CA8151C +62000,u,3FFAA71D6CFAEB8B1CF6FC641E2893FB9F634925D3BF5A8F486763568A5AED5282725F86561578C5F24ADA9E2B414748E38A8276DE00B97C +63000,k,3381892684FFF47E52635F8C5388B401C2BE8B3E3E0B4062770AA072F5B6D6092256C9B40FC23B700987AF3969CE822B260F831182D2FC3F +63000,u,6DEB0388A091A1100A7021512536A9542301CC980C372A9931F8DA4A000D8EA4F0EDE5832E028AF514EC043B8D2C9B315923BC50D6C9E84E +64000,k,574C3BE4E4B1D835CB01179CB85598527BF2B9FB318404CDE765FD693303008DFDC10C4D5B88B7612B6110389713EEDBBD506BBBB6AA5169 +64000,u,0F37F519C6BD9010CF0225B88BAD1C10172CEF5AB3347B5D1D536681B09B336A5C0EE005696CBD3840EECF6526BDB02FA2F5C24CC0D7792C +65000,k,2406B6609AB0B49F69CED9590348772C7641A5A1FB4AD159756878CF9C168846B2A840752D17888BD10D21ED026768C2AC42F69A271F3980 +65000,u,8A042D84A3D063DBD977CBCCA885AD0C250F4044D6C04811AF3287044A93CEC087FFABBFC236AA94F4ED99697D28B1CA738CA4A35D68F7C9 +66000,k,7B710513A87EEED24EDCB9A4D898EEFFC7FD5A47AEE15E2132C6564D8C6A6AA74E44F2FACD0451CEE62049A2EE950DD074ED9F2FD0971894 +66000,u,D9DF2EB6FA3989B46810C6A691DBE1796AE89D1F435FF022FD435F612431B044C503E3766533F71337D94A84BEA5B85D447348436752AE21 +67000,k,49F7931FE46E9C50789D2EA65D84CE6A396FB97EA156170F24E74FCDBFB03129D959E77F497014D186FE0FB28E960603744B90F7F7E73C18 +67000,u,9DFEE2C872091E005B7C5E0BF6D4A6100DA99042EC0BA343A84C0C7C9104401E054FF2B506FF37CFA1C6CD769DD8B591AFE46238C501211E +68000,k,8C64AFF10FEE69DD129F7BF26567E09A0EFA6C880DC4A9E11F3B3EB0BCC9EF3FF9DFE635EDB7FAD7EFA7C227E0E69B8795AF0A1F27BCB20F +68000,u,A8869CF17C528BBD5A73181504142D778B206CBF38ECA0CB19D8B0A67041AFDB279CC41978346B22381ECFE1715F0BF11E278ED32ECD3715 +69000,k,FE0FE249A7C68ECFEC7C5EEC7E40BC504CF3B2EFCDE5F104EE1CAE794E2EBF146CD9BA5ECEE340C128D40436E45F9507F9D3233858941FFF +69000,u,DF92A6210815E99FE63CF54875B4C3393AF7BD78A87ABCB0E5F1B33D5CE51845410BCEE51B563C2471E4257CA8D4D9B4201E3F9DAC6285F9 +70000,k,0F129441A4E5505935DEE9A336127A688CCB5A307233FDE59B5250AEE647A6BFA8E6ED09B62590DF1E4FDF6BAFBB00A59CED5A5EF0CB049B +70000,u,B6B4164BB349DB6C89F3E6EDF802C89B5590817C6442B50929F5696779018533E008C47640FCE3E30D3DD66FCB56D06DC23A870F04B557CB +71000,k,4F7904D10CF0CC3D169A22F216F9FB5177A192BF59D7E1F43D8C7D3D0CCAAADC5D00C825536441ED531B9DE55428A203E01CF23A4F9F123F +71000,u,8C7AFF2E72AD0B365BDE9317E72F22976F8AD7440DEEAAA773B30A57D8EE216DD68C79DBE58EFCD49D76C315713B044DB81D1B58A5C26DF2 +72000,k,CBB55C60770E557FF8F479C6EAF9F2D94031E629CC570330017E3695A3EDC886A63858A0FCEFE6A19098D1E573DC7FA533610397F925FD5D +72000,u,BBF86A54B15EE38C7572C792B487E70C4738E3FEB4E66A86F6288EFBFED7166FEDEC6646A9065743CA52CABD0722807D56935892C649D0BB +73000,k,EDFDCD8E2679DABC56B383763C5302B67F9902F69AF06707C1ABBB20B95EB098A0207528C38EBBDE7DD2BBEAB5BD80A90205785639A37F7A +73000,u,1BBDB2331FD60AB670BC89728E45DC365680C2D45538C1C0E4A31644E954F53C85724E0405FC27812EBFC55B88937645A96865593B1562CE +74000,k,C87747C63B131A97F217108BDAD86D24BB67A914ABDE7D122B5CA271192B46ED90F11AC81252AEE969C6564DB7A5CB61BC9A5DFA6E24362B +74000,u,FFE68ECE7B359400EE04DCE663432E5A3DA72736EE526EFA4507076072F7A435D13200EEC436F529BCCB052764578BFE37488CD313B0D6F7 +75000,k,BD196A98956D3C90BAB72A7CCF8F3761BE2B6D8AEF8B3E7B2F786355E2AE118D06C5B976F1A90F99ED450F99E2F6CE8BE8E9C00854848556 +75000,u,86C6FD99F5BEB57AFCB16F452E89B69B192D34C9679E60093CFA5D61BF8F615CD1727EDD4BDDA1AC42559AA53E6190B78D57F00DB61A290A +76000,k,5B080D855E76D6039D8B5F6E4E725531B45755F294FBE5CC1D6E01020F6B116FE5B36344B90D5DFA04267341EE5B7335B577086C56B68096 +76000,u,BBE652DFED487F4667094AEBAF191AD0EA8F769576609E2C322E056A4C058AA2D37C0255D69019ABC7CECE965ADFE36614F384918A02A6E9 +77000,k,813F3BFB41F5ED30DA1A28D8C0D2F4E0747E6699FFB6DEFE05F774F7C8EE1626FD66E16A3814DA29B42B063C6BFDD0F6F0A781A54707AFF9 +77000,u,1851DCBBCDE31A5A7FD399CA28662313D80B4224BE843E54667BFA13D1E4B6E1EBE60969C2FB2631CC5D712815F46FFBFCB714B9B33CE3E6 +78000,k,E94B5B9F113FAAA851C7F588552FC0C68A32EAF682B7BE8E90736F3F6F67D618D6350941E1C085D47676F12F1CB52E436D478A831DEAE979 +78000,u,1D61FFA94FE80F03997025BC02F816478CBF6A5E0BFF4EE4E5F8364CDB9B1A3C49EE1DF1725CA5A58A17130BE5106CF9A681C2F5EB4B0924 +79000,k,8F65DA910ADFC7473FCEEAB729AB1C9674F5302E590911C8ECDD9A689FF4CB53B62E93852AFBE369D02845B5EE05EA0DE7F5A06086933DF5 +79000,u,C9F60DC7CC0E369E69223A3F18CF3D5FEEA9F9D3198F32110B7661C89BE9F744AACA99DDA2A4DE6B55DE0F7078BF58E4EF4020F221E72A96 +80000,k,4531D1D2AD9BBCDEAD3BB9568422348A233B6AB11D02D84E642A19B08675A3AABA28B7F54E7BE0F239FF354BDFDF8EE08BE74B2B7CE1AC46 +80000,u,0AFC9B3576D9B6151E1AA22F8137F95C4BBBE957EF12C339ED524AB8028A94FAC4107CD3ABD7DF6975CF375499ACE1ED35A718AEAE1A323A +81000,k,02E1DFD148014EEEFFFEA5D65B25E6CB475763B287210493B7A62BD8795621356DB56E073E460E1C95A61210A566EB201A9CE3750F7C0A84 +81000,u,68F6697ACA7F54FF4D3A2FAF2FCB137B196D3335FAC3A4752A61CB8F752800B2B2DCF0D9B94F9D8BB9664FCD0D864C8E115D6EBA82D76099 +82000,k,ABACEF14C8F76EFB59B9D05CD632A7C955C5F5DD23C22CC35FD2C51725CF789F9CFCBEF645F88B5AEEC6507D9D3F4DCC27F25B00768D096A +82000,u,CF1C21719AD02296935096EF536806C5A96CAFCAB088B22A2028E01C20F26A05666244ABF9E2DF25187BE5547E23784E2439797061DD49BD +83000,k,EB12637967E3E1B268774CF3E60FC6191E502368983856F59DE7ECDD182FAD243C2AB4FC1BC38AAC8FBA4EF2ACCA8D30D1653BCF52D4DA51 +83000,u,EB28F0C9053EE94F66CD9F1B79E78B33DB2C65296FD529A0D2D893258A19DA4F194FDE6860CBBF41E8B7DF2E457D7DD449A4E68AEE516983 +84000,k,00D2F613085A8C204C5D7752070D34A1B5644A6D63C4AD3402BFCF178D79D5B66C9BF3A7D08ADA8819717436DA46B8D5FB9C5E6B8AAD422A +84000,u,AE274A2DC79AFC8C9F1E103DEB980EECF43AB3290663F3DD95BD7B0D2475164C9A95D07028A05D650F93BDD2F20FC069305F02D7AE393FC8 +85000,k,AFFAAEC199F0BFB74E87F1256BE81B2CD59809717A313A6AE0683F24F15C8F03187CE3885DAEEB16C5903AC3B3DEF3E9AB833BF98A5878A7 +85000,u,99D0C82B9AF8BFB4A8B28C1F0679F2D4FCE0F31AF224FBF57236946E16FDC98A0986A58C7E5ED6269D652BC1E9FB25D3CB63D995EFB19C9B +86000,k,8BF8D92F7F96C813A88EB04B7FD1FFD441B20B62837D5F61C7E299C4AED7E11BD4753A311BC21263AEB1CAA1B771883E91DD3254FC0D27D6 +86000,u,F032AA6543297A78DB46062C35183080A721D481B6C98C01CAD39B758D70F3CB516406F07F46CDA627F8A4F116D335667682B9C5763A9D43 +87000,k,D1FD60CEF794B81BC2CE1BE9936BFFB5AAA6C84A3BDF337F3B2B1FB1560F61FAACBA819AC15B24B23359962C70DD72BC5B79A6B9C7E62C50 +87000,u,53B3DF35D9FABD7E647533A7F2625DABCAF1E6764F53598C2787EDD9D34E13AA9C57D46C64CA8CE4F54A7170B9712E162D96F446166D18D9 +88000,k,D409288314210F46F1D5EAF17BF6A007398C9B4209F244B65133BF1ACC708B92C7AAC27CD147F1A68239CA1EEB6357D62918F32467446D0E +88000,u,336006677895F9B45E69A0C0F0078C1E8F9F08659088E6E2DA175C9AD12004BB594143AD85CAB1538AABC19FE6B0818F0E12A6F6CA386627 +89000,k,4071438CAD5853956C5813BEE0FBF4200C93A36DDE09C2E5BC1EACCF366894A6CA8E0EDE13D9F5C0E90820CFD79AE64575963ED6B6F04C75 +89000,u,A2500DF2F7D444E64E50D692AF6D9A73B3F160E30F90B8DF624846F108EE29517043CDD37D0757AE9209E01C62B131445B1AE7ADDC3E1455 +90000,k,E2036DEDE9E1E3EF286E4CBE42F47D01C68A93B0852757BA10BEB90E795BCB7CCB92AA91DE5B1872762FB2D08B3A0F02EAB27ED83134DEC8 +90000,u,D6EBD6B963DFA134A3DB2868D2547AE960C9EAFD08F2ECBEA8736B537C9BA284C94F1409C400E06E7A750A85F3413B90DB1E4AEB2079F618 +91000,k,3D19F6B80D0DE7929A4270AE7CF4CB21E4A28834547425A753C3E59B9C1C028CA6244EB6509230DB95EB21FC12AEAC2D72224EC7817ECEFF +91000,u,1C5D8CE997D7325CE4E7F4C7E2DD36D7A643FBC190FD924A382FFCB25473E127F7829AEA6623A1BC065858FB5DEB236559B0884C464D0634 +92000,k,CA628EC9A14F2B5914A7C70F6447B50B926D3B82E3FCDDFBB5919E794F8DB8F107ACD6A5CE2AC0E41371B12AD60137498E1C690C214DE1B0 +92000,u,1835A9603ACB7DF04FE3A316A7A38FAE743C4D60CA49653E8C1F08240F0D7D45509CBCF595F7E2AC4BA78B61E99E1AFA451ACAD715F5DB44 +93000,k,FB11241D87B3D6F9F9A0FE9678B5E6707C66D35603E3DB1719C52DC827F66EA3ECC96263CD2C237B31E02305141FB54698AE1F2E6B94E53C +93000,u,7051DE04E3BEB954B06A3404006AABE8350273C4C679C6D41229FD424D03B589D63CEB18A4591DB8CDE1AEBA4D30BA8ED155BC717D99E40B +94000,k,596AE8F405E06E49DFEA242F4415B21701C230053B17969FF7A1D125B479AE6202125D178C5FACB5285912F2F17DD173E21D954E694630E4 +94000,u,E664DDB502A79ED2B4D80474AC7F9D714B99E22D62875305246F3D113503B06C6DF744D8E9BA0FC52CB5147370FA6EC64F79FFA25FAA57DF +95000,k,278BA0F0338F58B27F160E087DC4D9BCA99D86233F143AA6D8416143BE0E181AADDA710E45DE409865D8D48782E5FC42868E18C448206A45 +95000,u,155EFCC39C4DA0F50A0CFBE21C362F333886D24149CD937607CDF105E6A0CF3D04E8FAC8BD030BED502B44FE35DA801174DEC4313191DC5A +96000,k,05180478578E2A5171DFF43735004C49C4747498D004CAC733E3CD85416CCCF2D0937E63391C29903A93F815D068D9CF12E010536732EB9D +96000,u,3C0AD764804EB95DDC4932C843695A700938EB329FCC02D62C205D2563FE1454D746DA9A59BDF666CC2CC3FCE560CF4EB27382856756CC21 +97000,k,81CC5B7CF20BE73750350B469F3712AD9C01BF54164A97C5EB4EEC9AC4A94DBF2CAE5C444F8E7CC52A1A7385DFEB167ADB85E60CEDDE7C97 +97000,u,AA96359C7BE181B7D09D4C525FC8170345DA184846E48CAA68B58E5E5837E36D911E4AE7FCD99B0DA7950A49A4311D557215AE5F295B980D +98000,k,90A1D2C50A78E70F80ADEE785A45E24F6F7F5AB4C301B381857F71BA0B18ED223B040E91D12D3573D6D35F2C4CABF3150042AE7BD7497CD7 +98000,u,B953FFB95E0E7F12F5BD825F9A1DE19B5D0CFD5B00453A86E878B066B093D84DE2C2073EEA51ED8EA84D79E85DBDBEE93C465C9E88C23A72 +99000,k,9307050B39BCBC77E8A107D01CB0F83D6DFE521D2AD40AC2C65A02DDBB3A4E2859E57139EADFF48378ACFB545AAEA68B21A334E758EB5D58 +99000,u,2849FE248D5722AECE349DE2272FD03472AE59144F6B58896B73C0DAFB97528037A597ECA2BBD68F68A2573585260697B5ABEDE0A3AE1A13 +100000,k,48DC17EBA89DE7B6F0D60CDC50034FB5CD0285A7638F9597806B0016DE4110CBD658401C428835794B3D64C4BD074274B0A5BD43E1E1D1FA +100000,u,22FB490E3AB738C9E6A89D99FA9EF438B952446A3DB90874E08C7C64E67642A2D9A359D2B6EEFB5EA7553D52A03E8CF078D34D2CC972E6DF +101000,k,84594FBAB21A825EEAF161288C5A969D02D2C92AC347B152A02C87BCBC41B068F12F23112B20B987DA9DB73474930EA920EC03511C54F7D7 +101000,u,C8193E00426F373091A20F479C3CE46C5DDEB5E3B3999B59141EBB66EC28FB089803C1F23E997DE1301ED571BFED626EEF96FE913569283B +102000,k,C24EDD23573DF9EE7544EF213AA1E1065E87911C7BF70ABC8A2A25C59795DD38ECC5107A2B0A3B2235858B6A6784F2237EE9EC320AFB1458 +102000,u,E3FAC3D08EF30FC872E32644910C9D9364044F8CA778194B5FC5A530D1C49D11118A3A91121D0883E550B595D2194CBAFDDDA2CE7CA2FE55 +103000,k,F210F157BA1686C8DD8BF619C9CB9BA902C51339F307F4094CC24C6CADC9FB739B8A3AC7A581CD8D711C949FCAD67433984BFF521ED9799C +103000,u,D7CDA13089F1FEE3AB4AEA8328040A029A74E6E4841FAEAF5742E0ABDB59F3B089818ABDBC52A62B50AEF4E5666FFC3C22225C457205E4DC +104000,k,2051D8BDC2982AA6F84C499FF94825904781B12B4BFCCF21158A989148A0A270645181AE7542F4C248C7178972DB6FC808E4AF0CF81771CE +104000,u,8D0BD0D8CAC5B39F3DCFF54A9A0E9BD7AD8EEFF49082EAD64694F9984CDB465E188FE715DD9F309CC3052BE4E8D183B724456F3823B8B2E4 +105000,k,415157D2384A0EE599DAD6CACF73E1FD3F58811223DBB8D73E3C02DA7988089D544A93E7D284C22F3B2D015ACA0AD2A9F02C11168DDE2BDF +105000,u,692597ED787BD83A8DC296579172AA0BC0286B5FA7F8AD733FC215854FD1E2F54652B2A7B78A6329F6559672A38AC2241BD94036F69847FE +106000,k,22DB85DBE41DC1A741F2568DE11609ADFB7F75FC81A86565D45AF7C6A3F0EE2935D25180585026C308C163B86CFC4D2C4D9442E6DDCC825A +106000,u,097690DB6CC198018C4F6365304D3253C0751CD10A24698ABF5BF7BA2D3505E68126A7A9DE3F737CF8A8F68AD26AD69D5057E7FFAC60B4F6 +107000,k,B59D69327750559E5930DDC9D6479C1F5214DA2EAC093BB2BB3367AE0F6ABB6C4E6E6602EBD99F5EE341214C82F95698C0936B8B6839BEC0 +107000,u,8A529CD858567656DCAFBE7F9B8F3919E1FEA3C0BDDFF547369A84F2DE7BD0E10C932A9F18E2E18AB291836AFCBB0103C80FFFF1D88DC477 +108000,k,D6C5ADF56516F3F2FA1A54B6D71E8D08FD5AFA594186267C3CBE523135473FAEE22E17A27EE868643D1C8C671DF9A6A9104AB0EF52EE21F9 +108000,u,9975D1D36079F3D79FA42B2401F6A472116C964F640600D40811156F110E5AAA00D4BA57F3DD503A2F550D2A1CB089F97E9B3F0D632EC619 +109000,k,92B43F84599D592B51E0B1A99EED938600279DD85A1777759B3678CE745CBBE35EA12871F5FDF42F3D33F823FD2D3234EF79AF1570B03E28 +109000,u,28EC54FA8D0CF8ED7161487685BFFB7030BF9B2671EF2CCBDBB0985CFED45ED15D89B2F4C4AD02424D42BCFF0925DD55991C84CDC72E60DC +110000,k,B205BF66B2C40C633A560A283B686C4C5FC5F817869AF82A61ADF2AAC1D26D88CD00E26C1762E5F4EED6486BB5FDB9ED1BAF3E8ED2F27EB2 +110000,u,F35D7A88892EF7222010C4B0217D42E4D912D2F481CA2A7EC9C1865CA07CD93F194882C2FD45B33C10E7F424F3EF9ECF5891E3347F4FEA96 +111000,k,3BC39F28C13A58A48964C654647FB30E477E6133466DD594F3D4097AF16004564D87B5033D922C683573F7A12E550914B5BAE7A455BDBA82 +111000,u,F2F9C07735DB221145CA6955C19AB0895EB30F393FBDDB59D5DF9E596555104B5943C7EAB703E25EE33FB6E6B2F8F2F700355F6ABB623042 +112000,k,82F0B0C78CC91F37B585D81B3024EA6B47A50D13DD1AFDEBCB1A35EF4060EC37741D1319DCF4BC35CE538F6814E553FD952E1F65B272050E +112000,u,D2AEB383C96C542BC93156B7D0A730812927F1E95F055BDE662A659319D185F3162F3C34736BBB6EF4DF7832670E397444C5CC23AD9BD96B +113000,k,ED6CC36C13697A844601DD4BDFA502BB01C58CD201A4EE67B269519107A71A54581DC1039A776BE39070D0FE00097695E7AD8D4D0C3E90A3 +113000,u,AF064E0B21EE0C5DD6242B893379311B1B6A33420844813908FC8F1692279B764564F2441D0433D5ABEAED04691CE047618B483727DC0DC2 +114000,k,22FFF5865BA411372DE8A7240B0EF9AA37B7FA0ACDCB32CD4588A8C711D9A34F12400D9ABCD2244AE08CCA528A3F8FE0ACBC2A3D747F6742 +114000,u,99194BCD94CEE4B282A64703FA778328533F6928F6690AACE1914EEE593D480BE6C3F755D7C13E73E30F27D977903F586C2ACA351527EEE1 +115000,k,E452179EF80735FD73A41F5429DB1F5AA03CCB895F492B0B487469B438366A989B07AD2AFEE9407C14D9B68FF0EFC53C3970CF3A6C7A088D +115000,u,D546B85C441C5A23837F9A5C796237CB8363A213AC375FAE6B63B211DEDF37B0F2C5125D327455142AF336932BC3F3E8AF273375D6DEB6BC +116000,k,A617FDFE463636DDADDE4263F7642D7ED5690C624646A1A9102E694C1087F4B0318F46F251E20EFE30CD23776283E11515857964532EF2FC +116000,u,F72AE90E19B450D813F883C075362EFCA33487F2B523E7783442C15B4AB330D6DE129A9AD6C12C1A7A4831019E45C6DCFED917F5C723C55A +117000,k,91F43EDD42E2792D109E3707A8149E3743F1B5983EFEA5B8463F293C9E73A681827F60FB4EC0DBA98CDBA42E0408C4AE622D7343EAB33EEE +117000,u,99C9590F210AAB95B47BCD5C8AC3DA8AA0324E9C42EA31DD0860575AC55AB90E7E8228E759B8F54F05E362B079D81AC137E1C73B8C60A95E +118000,k,5D7163842E549D393F1D939BBB58AE6D89A2C84879DFE21F43C12ACB67198D8A26AB02E6FBEFD5DA28A39570B88BD97CFFE0A7A54C61EC35 +118000,u,80B362D542F06909D1B27A0B45CD67F9A606A6AFAD8E0E64297A997E3C18EE561E21E3DE87CDA038161A6F546B45662512C1A8C5EE754612 +119000,k,33649F19F9BF00610C0AF7059C77D337FC14AD2E3B1D5FF27D4F051B07395638654102E51ABAB4A6E0E822C206A21DF2BFE3AC2FE60CB937 +119000,u,20E9CFB023014F999E373EFAEF297981F2A699529D08E21E088ED5DD0E783C18F781128C1DC2AC1E686D4BE484B20D12F5F5F17135DA2D49 +120000,k,A39485D9E33F8608451C5281F7CAB01BFFAA5BF638515FE7C9ECECADF09E000239A2F85872A0DDE4F4DC484DB7FB5ABD3E78E1D824CDE947 +120000,u,CF94779B8CF0C963C1AAEB23D0B83220BA398ED70F96BCDDEF99FDC5E4E93EFAE165153D862F6453DC3460A8D2FFEE6399C39421177C1CC0 +121000,k,449BA28BDEF1B5FDC0F0CEDEE319E0C81F0FF1049A095363416B2F71ABF23B0056EB87E0DF50FD3DFEA1860140332B270242CA9E3A6ECE05 +121000,u,CD2C4FEAD8AE70F42CAAD8D5FDD91145DFF583248B4CC12343B44176FE55447B2038A40D8742C5385A7BEE3E4780F02B98F6DBC98E6C97DA +122000,k,85204E4F09EC0E6073B8AF92EC6C2B2916C2DAFB0A95F8D3A660F57CA447C43D032C818B36A552A0087DB5EF9AB96797BE066313458D2D7C +122000,u,CF1E1AB67829C9FD2C8C270BAB4E82038B47469590733BAB91325F9C44203D8426F21280DBBCCE671656CA474D64D0E29D450ABB30836043 +123000,k,ABD257808C26946EED9875FA5A88F7AC2ECD2B2D06BA95C25152AF79B688A2400A72A31123FBC19D9866634BF0C8A8E405C889B3237F3FA0 +123000,u,D91BCF6612ECD224FDF27C6B7647241D9579102A1DFEC039F7B9E3798B1919F0B7CAB95038FB6739AEAE4D67A6849A720A8131AC2C2AAE4A +124000,k,02F4CF67497E279252ADD80D609CA5329B94306D8C898029CEA1A2657A976B51F83FB8CAC9B99E5FAE17E51C7DD9137F1AD3C19F970820C6 +124000,u,EAEB4640B4DFEEE0115B589D82014CE09BB15994EE5C71EF1737BC22C9D8600757F377F1A8142AE0ED10C3AF0C31839530F37902DB563F36 +125000,k,1831DFD2AD13EFECB913C582F4BD9DCBB8E7E613FD4E824C69E767F8A68DE0AEDAD87C9538CA3B00BDFE3FC2F6845373E2DF844214A694E3 +125000,u,FEC5D6BB277A5694F22489BBCF96215282EF18DDA51E63A76FEA39C5A4ACB65A56196AFD80633606864A4423DAE96E880393A0E8A2B400E9 +126000,k,2C696EE8A6AEEFDA73FDC241B72D8D1FF83487319FA80C3CF603C506B747C3B78570846954C41C160857F6FB2D17F170957718C6F518C782 +126000,u,43BF0FC2D402C7389EB6ACF873FDA8B330EAA02D9832F837149DFD5BEE7FA96038741F06A6313905275CDE5A15CDDC7D70257468EB6F364C +127000,k,85EA268E1E3BD6CE792BB8A9F5E534C3CF268EE2BB6C53E495C17F4F1876583F82D6DBD55D6634DCE3D89197080D5F42C8B6E043F8A6DFB6 +127000,u,9F1341FEB6591DA2A9330FBE434225541341F24C877447A16C35C9BDF8022A668B502F16797AE50A785304AED491FE5196910B397DD7ECD1 +128000,k,D80924874AECA8546332D1AD7014C0F23A2559EEC3CA4E054A119C9C017E583417DC704041E15B8113A467353248EB401E6B4A3F0398DE81 +128000,u,86A24A7849E37701875E3997702C262EDFEDC8BC6DBBDD4286F0B559136EAA536BB33B4E8C3F1DABF05B9A5AADDC4EBCFAB602D516A73925 +129000,k,E1563AE0DED2A974365BD354E3EC9AB8A569806F5FA012E2957E2FE2504B9508D73BEFDBD04675451ACC7E5B4C5A3FF1F5F8E61CA857AF4F +129000,u,2A1280F063E10D7FC8D249E8F8275F960BD4F63170EC4F259F506218CC85FEBDF3CB37FCAA0726BA3F480C42832712573FFCE5894E3206E8 +130000,k,35A1808AE06FC004E2F1C16729E37C195B49CD231207146901B8DF159B47A3280FCC0CAF886B89D0415A1A5F924C5EBDA6E1D38FA8CDAC4A +130000,u,B584B4140DBC04DF475EC47410D77C80E44AF767004CDA11872D84195944F532DBD68396F592FB392EDB797A9EAA3F1819B00F4DC7DD8843 +131000,k,618C9C5D9348405CC7FE9B6B618EE54D2624A61CAFACB7DCA1313167C1AA0B26576FA859143611844014E8752BC94A1B6DFCD9BC18A96774 +131000,u,4EF19DFBE2659EED365B270CB6742D68208EF668D762DD03F5239FC5261F3753E29C6FB8E777C19D8536B1B5804786D6FF29492555FEF2CC +132000,k,5F70708399AD48E4D5EF65EE932B06B7A1753871BB1705B5C80A109BF73017C12FB637B37B5CEA846A85A17182572BDCD0A7CE8E667FE903 +132000,u,73265EF47BA3070C9EB0C1B8618FD02A6C8BF4528E92F231665E351FF0EFCE47FE41E62B17AEC4501FE286291C1405C30861F63F595C52B0 +133000,k,65563B2AF423C159E1736C34E5EB5A57613AA987BF7B0E68827A1530A72A5A63726AD8FBA0872E456617B4B47E9A43A4EE817DE39C711D12 +133000,u,D9682A5D46C25E2B309956BE21B5F4EC53C9EB8E73A3B27B3368CC9FF9063B972651284906C0487A2A147EB35BFB6F1804C47D17AF0196F8 +134000,k,121F6E3DE521C1A2F00112227FC9BA6A2DF9D7449F2D88FC11FDE39D16ACD72948B4BD63EA4DF03A0C13683B2DD97CE0BF9AA7E5D4F988B9 +134000,u,F0F47FDAABAD36A63B273312DED6E5E8D07334E224157C5157D1A36A82283867949E1AC430544F99BCA6BD0C570DC2001EFE974F71B37E1B +135000,k,4D9D8DC8D5F799612ED4A9211944C61DFB76AA9A80D65B211DBB1CF5840D9C483BD390B3C179E8059CD9773A3BCD9EC3E160E19F5697BAB9 +135000,u,9780BD6408210AEF84D91E791D987497CEDFA579B229906F20AB49FB1B33480B1A07426AAF1662B374F6E1334E7B1F8E9C9086D1325DD727 +136000,k,34E891ACDD8CD1861A9C6F1BDDD2F415D044E438CED4C29E93E090EC5955B0E550B333F2D4A7EB1E6B320418820241BDB95FCFBA60E3467B +136000,u,E5548ECF3B8715A1C5936B2F998A21D00EA7422C021343E8840F5CCF4554E8A599B8B75D1D9E41649E77BE835AE98BFFEEA5E9BE38898F72 +137000,k,D2DE3B1A9597BF02E560C94A4D5789B19295254353443DF20D804DFCF7C621F93F5584C49BB39F3D6EA261DCD0FD1AD66D58C1B4D457FDE5 +137000,u,72226B74A7D459609C394517025D506B4A22BCE1B8A452E48D7F3F6851A891680EDB6B84689C1E3D15B79783529F062E556325310D29EE5A +138000,k,B237FF18F0FCF773AD10DF545A0F6C38B8F9F34C238B3BA40A661B0FF45C5CCC1CA7837D22353A86DDE795C52172D789F1060891DA5F0FC7 +138000,u,E2F903874770F07BFB941CC0B1FE7CF40A0C8002C208F0369FF2E5576E00CE128E8E43FEE26B4E61E3788D8366B210A83123B791A71225C9 +139000,k,07183B05692B1D7D85B593E0454511FA54185987335C9C30D806872E462EACE540062BAD085B4B857CD2F2A55211755022D176BC3919CD58 +139000,u,F31477CC44795EDDD24D2165466E4751EA4056D4FA0C78350F4FA78678ABEE658D35197DE419DE7095E8118918EE0FD0F0E85B63374E24AF +140000,k,6D6AE4FA4FA320EFF2599B5D23ECBA5EC21E88BDEF2D8D866971EFB6E24BBF9D4D6B8CE47BD4766B841B58402E1AC5F1B39791BCB6A1D285 +140000,u,A4A046D8C2D562F68473B15ADCBB70F3D70442C7AB1AB21D262ED9AC50F2A7614C22FA994382950365B23DE1ECB1D7BFFFBBF4638CC346BC +141000,k,80FE0C759AAD6EF7C781E822E8955065C029D14C73E4234B7C22E72FE7AA8DA026E4945F48F1A8455C19CE23DA1F68EAAFF15414B57710F4 +141000,u,24BF43635037349D6C5B7E74BB0D472FA7FAF39796C2D6C806A27D7B362C0E9396243D62248B0D86E4400EABF217934FA35ACE3BA69E50A3 +142000,k,9A81CC474BD0F98A5F20FC5E653E5C2D7B04EEBDB3B79ADE7041EB8A2293865CE2C9912131B7BF7BD4E45F1B3437460B6F83E9C0B460C6E0 +142000,u,A7C9717456A69F399A0950F2943A7BB26ED50CF58E418BA6FE23A148568FB5B63D9F4F70645EDCE0E8A655E07DCC93C3889DEACD0209B1D5 +143000,k,A06623A08DC9A66109D141E43CA32751E4B64D557041A4970B033D2CEBFD508A01D3B41CF8B2AEF94D57EAD53A8D075E2020EA82DF827271 +143000,u,41DD8C63308D76F10C2586F7D2FCFDF117DD3CD4C9BCB1A6CA93A229F3AF67C0B37A545065EB9F4E1FE81B95BEC2E75E8A302C1E0CA3719C +144000,k,2D1292AD214253248EE0360096AC4594751789694DD9ED4A1CE5E73461CF861E22C0A08C53742DCD711D59BD8EC6A970CCE2ADF56408BDE0 +144000,u,B2AA77773569E79ACF28FB9ADFDC107CAB34A1F0FF37A5C892E35E8D39C9E3D2DA8E7B61B6D139508A939D2E9D3DBE250355A69E98474249 +145000,k,528D4EF878BDB277C2765D0BC9C4CAC20AF8B00C9DDF100DA3BF234A5B7858E4C9DEDCCC1FC36CA940987824C8316987DA0F216F98E72EDA +145000,u,C44DC59DB903F77720CF0622E19C8A75E2900E7009D89EC114A98C3819609ADCA8708C0E323A0C040A83B9E287FAD6507E1F056973696483 +146000,k,9A0F198BE84BE66BE5FD8EE3BE3C76EE30FBD95372DD64BA6D5C0A540E0A737E2DB885E1B681911D0990E2E282A72E42FACC126985A4926D +146000,u,374E4D6B67EC2681A987EA2901D07332804F434507C4CDC4C62C450972125990E587FC63BDCFBD32CBAFE0AB25B2B4FDD7EEB358547C16C5 +147000,k,D978C469A6450CECC834470A92EE51203461D1DEBD262B6FBE56707330B3FE4B08A0238450FC9AF6BF7018CEAF69AD821C58A3DE67F29513 +147000,u,D9BED9BF687B755367E38C0B06F7D3C992FA3D7F6B3D75C8E6A96731A8BE9EBAC38620B9B7472A262522052FE5670C535B5016EF9F4B7788 +148000,k,818CDA1F13F314A21557C9A43B06FAE40F8D3F9BD7889C23C69D4FD8B88723F2EBC7A295A9F4A506C5A3D3255ABC194C3B2C209E0647F3E8 +148000,u,CFD5027D2E9A5D1F4C6249C8520AE8AF464E036F07DD581D6F7786AE3C68700DBCDBF5402359FCBF0B6ECE665376ED96DF13BC558FECBBFE +149000,k,B7629B89A948BB867D882CBB831F16A86B107A9DB4AA0476F5BF8DAC3A4F7F2383DABBD8041D82186AC26CD4DB69335CA1F130F85CEDD0CA +149000,u,75BCCD8194EA2817B7C98BBAC35157B72219FDE466BEB0EA881DDD3E0BFEE7D41BC326364197A0A89E7E92FFDDF516AE671F5EBC344315CE +150000,k,E4BC5308F539F1BC2B58D166C08A7F1E00053D835BC128B61DB116AF41A150A39E11DE1CD0C9C8EE9D3297457A32BE961292A579296C6460 +150000,u,159C7CF61F21AF154122402032F5638BA7CD31F31CB6D70223FBC830164B5A612C7CE4004A9D1B565071CF22D2DC5C7D21D8749598892F10 +151000,k,0804123A2696C61F424BB7DA30497536D27E96B7C7B07FD90FC4909FA4142AB739A4C294AEE8C8C22BBE608D9A784C172B40F5CAC554B20B +151000,u,DB1E69A70A820C6FE1B359EBC8535AC559E2EBF29FD9228D3853EE5D5E2FCBF5765228DBBB3DDFE6CB256B72D2E9977AB63BA74FB7C92525 +152000,k,21CB58A894DD08668A705C84B7EACB7EECBB7D043C202ED79FDEA52C9F04F54E40D4C30082FEB04513DC8C648B0E0F74EAC87C7ABA645E2C +152000,u,B89C5C0BA5A97528CB9F6F05860CD62BBD82A36B83082D8533001293CEBE607E2617974D099093115B09F77B4F25BC626D459E22B3AB3652 +153000,k,027A648F30A512C11D8277C4AE6512FF501638E46081717B4AA72D57E8B5ED4357FEFF8BAC78847BD079289E421A3B6CE26A43976236B8E3 +153000,u,2AF57FA09ECC04421544F35055C641775F74BC98BC6D3BC78093FECE102D3BF4253B9F46AA55A1DAF3CE907EA6F60EFDBF8FA3018D8C5548 +154000,k,2201FCC406C92F8EC962E4462EC07CAEC7FC2AE766388B20867105BE59F0C427864258D5D7D05D68E12B4A82CD6847975A830B70CC52807E +154000,u,B67B8B591F861BE8B8EC3A3AB1D156B6140F8EF770576FBE36F9E1640B6BEFCE100ED3B65371D93A347F8D05811E4478C796185FE4809CF9 +155000,k,45E34F45687E2DF0F543F1D90A0AFAFFC8FC7CA01CB3ABAF39326999ADF5BFB667C52293E170CE251F35DD1AA7AB8AFFFE8117D9F0D18B5A +155000,u,64C93BBD5EBC128705DB967DBBC4382A440F201F19A12CB04CE71242BB1288BBEA5E635C107A15B4146E2BA3D053F20BB2F26E03EC1A29F9 +156000,k,0CEFC2EA0FADE47591F02082D8F8FAC93AF67972C2C021A4F76A9175EBB03912AC861000652C1FC5254FDFEE8BFA60D8E83F103EFA12AFBB +156000,u,B40E1A13FF08A0694CEDACD3A9D9DA3117277FCAE8AF8AD2FCAB182374682F3A88D62B9FC6750716266CAC3364C296E6F56ACD8229BDFE8B +157000,k,2AF843335F61CFC455387D4FF64F535D30CC61365FC5FD652381483169A362B4FDD747AEEAFC9CDE81109D4007EEAD0E132884117A3890A0 +157000,u,7E83FCFC1521DFDF70679442A5FC415592E1FFACFB2B5EFCB62BD519FEC0CFF8203EC39582B8A6487EE1C5B40CAB92E471E827A8B438E981 +158000,k,81D51725C9C5F64D4AAE0F3FC341A943B1A82E0B5CA9E6C1E36D74F5215144805AEE43C4A2F1BBB1A4959EB8D9656470DFCC07BAC9DC84A0 +158000,u,28E74A6CC3FBD742429CCBF88148F96B61DE41C54362B666345F8A4A9592CE186539FB31F106757C4300617DCC77221F165B5190AB4E8796 +159000,k,0282D32DB3589E79A7386F3ECFE4F1C6DBE8DB50824BA729D467B9026516493E07069684B8B192AEE4608EE3B1B8703289E2B353ADE36709 +159000,u,EB6253CA896DB3A87AE0F966B543E132951600A4ECE4631B912F9E0003B39838B8AC5CCF6C37EC3C47F2568B4CB9230B030EB1FC97C81EA3 +160000,k,BD4FB6C1ACABD591C4B1CAE360CD356C0A5B9B8F59355C3C2EC4B1178A74C4933DB6EED1D74F5F3A689B9DCC864C2B018C95BDCB283A33E4 +160000,u,20E64E37BD3024C0EC8F7653E43E7AABDF7375CE40C9E1F9CE483CAA8C7269630E6CD0824285BB4D60BDA42DDEDFB3169D87424CEFE31205 +161000,k,9795A357BE6B20BFF89359C705CD23A2AE845D89B90BFD619FCD7AF4909500471242641D16149F25C64400C5DEF29939A26AA85E1C1513EA +161000,u,426DD7FB376C4049E3A4099199A63C88CC2316EE0E5EA89EE19A1D6333FD3C296460AF699D4DC60AA7C274ED6A7997DE97C1C280273FE946 +162000,k,18E1362A5158B3C7D1CF70A48E6264F1B220D53790CDBC0A5AF2DBE1EBCEDE7A0DBC0DC6E49BC241CD21A1CD8912B52EC176A197B27B8F8A +162000,u,0C9FA13A9FBE1DD8E1E28CF599ACC2705BD27CA63271E483F6ED11A087445042CC0651181E787D1E4EBCA232CA6998D7CB494E704675E37A +163000,k,2E1955615C03C95FB07A7C70354B98CEAC41CD2951713168825DEF54E65C7A0A863D461E1ACDF85A974513FA1B849C8295CB0BE76A81AA6A +163000,u,0B55122194A97E6AB3172AFDB713187E3388CFBB94CBB6C3B037AC53B3AE6EA7A184ABB1863762A42BC2FD5C406235445A40EF09F5E0E163 +164000,k,4E51DB2D8DBA1588E0D03E86948DAD8340AE07CE0ABFB8B115DA0D4F4B9ECF0E7BF6B4CF3F96AEB0FA4AAD2BBC92144F536F212F18687FCD +164000,u,60B2C5BF03D511625C83A2F8E1FD0E8AA9F84CF743D935FC9F5A6312F49689A705C243C75DAFC992DF52EEAD1B79D392AF53007AB1D5344A +165000,k,E7262A3AA3F608EBA6022C5572C2A87EF87FEAE12A856D69642EFDE88338C8A64AE8671A513AD73E4EAB8F3498FB06DAD362815E83A8D8F2 +165000,u,7B562C1C1F33346D59D9A65F611589327776CBF8CDF7CED5085187C5414385F4A20C20BCA75FEB0D992C0C02A0021849E2FBF87FDDBAB85B +166000,k,A07C4343193D34DD4DFE1DFF7B516C52DD6F401A734863AD7297158E741733DE95E0EB65CE08CF6EBC36E10D03DAB5CBF04B6B0A4F1E731C +166000,u,E3DF441621E297018CB6C12EB7CEE52C0BEAAD8A76EE2AC9666CC7D268C03BE1BDABB901DD9AC8FE06732904047BCAB5234826DB257FAE58 +167000,k,07807AB7C3D199488F62B6971F71EE4459BD4579437427B90615C77E501A556615C316749CEFBEE8BFE2AD3AC85B8C2806C40AFB551914E6 +167000,u,A55C569E162F755409727C0A72E6214969B5D3960D18D402D6E685BFAF0A41139D2772FB8498E16B68173296848B8E183A16E4571EEA47FA +168000,k,B11502C956D82591B13F3B12BF4CB0696343484D8EB57717F2AB4839CA815B8A88C2750FBC9DE7064C9691F8144605F572E933BF0D3D7238 +168000,u,0F9B86A850EABD351BEDF66C6A65336DD2E6CF5BA532A17F0EA9F2DF5D06D26D95C051994827844AB71209A7B4D69824CCEA03A98B18EABB +169000,k,4486AB3202FFC2F74B48525F5CFE81DA180CE2811E5A37E38C091D00C0366A3C0BF4AB8521E33C18EDC98D4F50B598E2C6323AE1332BADBE +169000,u,0744BD9189D57EDF2502487D19A7925972A6CFEE7DDA40E8659E05861637D579CDC82046268A8FF2D6D0A6667C29A83A189D40B50DCAC7CB +170000,k,90FC4764F27369D92574F437552910BB10B33050CD5853AC5DE29A271E0BC25271913FB09F7996AC82BD592FA180256FE9D137C17556B1E8 +170000,u,CBAFEA26159B80D8BBABA43CC876D3397B02E5F077A4A38402D162B6260C26A30948A4108E3DEDD2BFF19F6745911BDBAC925B9A604B5303 +171000,k,5AF98F8186C284078CCA2B8EBA9EDE3D95332B495032B5D0247C1FE1A827A9AA008E7A676FB45D6207C9EE166B7D886B3D3580B91491F3F2 +171000,u,59C9F0BD9DA8EBABDBD2C90461F9183FA6B2BEA4214A62FB8B9357665452BE73D1683BE62A2C7B376F0E321419ABEFB26DE9E8C0A6CF4AAE +172000,k,285EE16D697BF0C536BDA18721884B92AE2DE92694AE3A65DEC0910D80BF90F840AC041F249F6FF5320A7DD54EB07B496B640082650001CA +172000,u,A4D812973112F9B9E1B536EB278577FBA287AD592EE9AA877FA9B0490E61E32545F404C32A0D3E04C2C06371DA71F8557ED3397A159B402D +173000,k,B6E4434191DCF28C9CD273844D74D33B56A5646AFFD10D7BE7ED62D76FD5FB0B36F357474CBFC739D336ED4EC8396DC8B482A3F169E05513 +173000,u,6F2F1D8C317FE97B8758457F2F99D3EF71E71AD7D5596E8C66B6BD136C78D99172B332D07887915EF23DE9C8654CA72A46F9F67906DE6DC7 +174000,k,54D725CB6AB17A177130D81F18BB858EBAC458506A3654676F00879379151D9F19473E1D75AE84CD2500D80440613AE528E56E45637DFAE1 +174000,u,A4B216F374892E15923C12A66967843722D3ECF5954E75E2E0D87A418918515B99CF53AFE7F9DC9126B7E720237D643EDB5CB4898171716F +175000,k,AF3F0FE01EA5A00E68C56C101E059288C87AD8609C96A1DA056B851407C9410FF06096403001B07E90E4B77FC5101ACD82E56DA10E7947E3 +175000,u,A85EC574EC6FFE5C4F14BB1FEB5230F21700CDC2C4389A6FF47DC6D3E630C6CA796CBC532EB0B695A8F33C8C7F6F9C5890515BEE3B66C32C +176000,k,13FED87D38C519E5B9C910E6A572477E43E3D92F480352C27BD83FC998113AB0D4155D9BC5810B60739D6F6448F72F841FFA3C9D34A88B55 +176000,u,1AAEE5C1A4A822DDC801DB55A3B7754A1B4C5046316A3F72E24A78893520368493D0F4E7A586291181CD3B27B1F7CB880725E98E3B8DC1E8 +177000,k,B7D7FEBF5BACC14925FB4887FA69400926A2965F215D214D295BE9A0C54842A499E5EF92745CEE9062F2506D5068D7BE689CF64E570F7F89 +177000,u,AC500E2A37EFBEBF147EB27B42700FDFBA294C41F66E89536B70879E43BF3BC38A2CBEB58C0B40CCED8EF3E177CC61A446E9C6F8B9635125 +178000,k,3878717639DA7800BFD823A8F1D3A27963BADEC708445B4E4B1A8423E191D81B5223956454FF422AB39D25120EE74649E0386476BA85D164 +178000,u,88D6D2C8F57AD064A5480DB2023802FDB33C6C103E437DE430A70D8C2C47023B1FC59A063F3592B4E4C98848B2E07B41B9D09A0C07CD86FA +179000,k,76ECDD7A71073405E62B74F9B32ACCB965C42D9DDF6BA326F3F8E08541B8780BDC78D24C85BFE74943B24E4BCAC73945639461B31646EF8C +179000,u,A5768E94BABD5CC9E96D1B5F5C33E8E1E7B0545C1F2FFFB9C737874FE78683AA1484AEA74AB66D0B21A53F60E7ACBCB615BBFB5D2EEFE505 +180000,k,F5934B5F81F47CADB1F5C53DCAEE5C581B4AC484BD86CA1487F47B6705239FD45BB8C8E23BA91D88FA4E0C10CDC0E429FB0CE3D08AAA4369 +180000,u,AF1948440EB004C78F5DEFB260B6C4DDBA6B5A25FF9313962C66A423943E01C817E32E26FB71AFCD2BEC7D472C2890FB2EF792A77FA9D944 +181000,k,AE5405897FF31648C4616FE6848C1E3C0760D39B80C1200D31750F81474AD1A95C0AE15C045187886C689B333CA20FD4B4A6F8766F6DD8E9 +181000,u,9AC426C79B3B33A14D0B793F7609E8363A145B01B44102B02D825A193976C425E464FB789FFB5D822A3CD7982654E5236150F81B56C44D5F +182000,k,B158F73932EE7A379BB52F66D9E4949AAE7EB15D2D6BCA9F109B38575CB54998CB067C56DDA25C9D14C9DA863478E41CD23DF2F46A59EEBC +182000,u,90FF7F846455F736DE8EF0225A64B3AD57E06832E16013ED70BD0D64FDF67A9B5359ED9F65C18123EB35B9C1B49D6BDE5EE01C9CA4611295 +183000,k,11579EE9EF3DB7F6F8D4A5C1EEFD46A0E867D82420DD02BA42D97094056BE31429132A3D1AD5A7E525522593C6E6FDFE6EACAF956D67210D +183000,u,04ED6991863F6877C2642D6A812479920649C144A1C58845DCC6C2F37DBDFBB0303F3B50B18AF1FB068FDF05B39AAF1F6654EDBEDBD78A39 +184000,k,FB37504533CB2D666FCA558C2EA9D35B4B11222F5C87A40D06545ACF5A687735EA0A41A98608CEAB337071372511D5E59F43C8F0540D5B8B +184000,u,33B22053D3C1CB6A3FDBF037A9A53CE66540776939CCDBEC75340FD8A3DEDB30BCFB2C80A6D21DE7541251C70B5AAFFFB1D7D88D6BEACB0D +185000,k,2AEDB81BEDE2F281E384084AE9DDBABDF8C1E9F7B564C05AFD6131B19C11D054674DCA22D557CF3D73D4A573EEE687127C88C2FB6BE65B84 +185000,u,2F5E2ED7721CF895D9A6ED1200F07FF83AAB5420A99A925AA4BD6E85C39B14C5F4DC21A6535187BF73B50A2094F4CDB6F2DB697309F8F0D8 +186000,k,1DC44F21F2B46A54C17801815B75926C1B04842D9BCD42D4427DF54EE541C29624E51C3D901BD78BD9E425F38B74D46FFC681C1F523A0641 +186000,u,5D5E1F54203DAE423EB81D3A825E9168C4457BB9F0B23EA2EA2E86ACFC2031428423CF2553D863697E7528E3E2CA88D19EDC09A54452836D +187000,k,323E5DB391D5EA28D4E737DA20C591466AACE3FBE8AD4BE8DB6901D67F0A08AD0B7F5291D328061EE2A510775378A5E05CD92232C0003BE3 +187000,u,83C05E37FB16942EB37B64DF05765E0DA38C1D7ADBB23BC474686DFB8A3B060C9E7229667F87222362E825D6956B660FA8BA6C92A4375213 +188000,k,E1019A0443B11452223AE7F0DDCAFAC3D44F07E6486DA99D80D8DF017334DB42DE4EF5F231A3D79A687292AFBDB5BF70840B04C087B4D2EB +188000,u,62920FC7866787B6EF38A12D3D9065A233E0068ADCBB73DD537360F82F55179B88347C75DEF77002029E36C7D0B2E8A2468ACC84D1D70879 +189000,k,4232862192FB7281E07FA5AB2038E548FCE5E877B1E18EBC59569B5F63BABB79B1FC60FB4116D196FA635631ED3885D40DF94D2557C95B56 +189000,u,BC666A9AED8094D55F3234B34EEBDBEF304907D3BD29BA5F58A71D689D7FD4BC693874AD68213509D82653D5F39866F1ECB86DE9D156911A +190000,k,0B320F0741730941741A27434A5134C88EA1C98724E249EA0A54246D08C26B78AD21A6C87B014250159395DA26C4E311B4E7E0C566E1CE4B +190000,u,93F548CCEA2D44DCDB9F939154ED61679E24B71AF8899B94449AC724A4CB01B3CCEDCFBA4AAE79E16D062083CDF110BA8375F143CEC0B22E +191000,k,0EB949154DF3A177DF3DB6FA495B7EF5805999FA5374D4B76C1C0EBD5937505297A131A3D60C9D61491CC9705A515C351923D22B6C16BF34 +191000,u,7D13B59451B3472D36D63824107A4EC2C917ECAAA4292429E45973E81FE808A71B8BD5D8D3A4572C712C4CC3C7FDEA51230A8905F95EFB0D +192000,k,64E2480E371BBEE778426B03103B7CD8CCF9E92CA523FD44710AD918271BC7EDCC0B6CEE4BF2C23D8AD2FC3FD2A08E2B0003F3E81FAD791A +192000,u,8A16D1FCE89BCA62F0451CE4410E1BDCB23197302761F62850C7E15ED2844168F9A24E70F89AA15D3444EAD715E9F2486722781E1D74A61D +193000,k,25A3D2DFFE12DF8356296D86BBAEAD34D2EEA8293D5151CEF4E485F05E1E7F02CD2243E8AAECBBB3DDD20BE67A416266BC354C715007F16F +193000,u,CF5CBDBB2081975E48349E8EB3DB67F048B846FFF481CF5FF274774D2850549F77B28F5CF9BCC69FE97831CD0A02103E949EFA858CDFBD39 +194000,k,1C3490B9CD04EE16865459465E6F2C35CE1C906316301080C3B96A90AD2FC5B1F1496348077C6FA56BA3ECFF50BBE1D73580D65F4F62430D +194000,u,AF25C2E14DFF46DAB5D8C71B8DC0279A318ACAE2B2A05A46002493D74C4E64A01C0237A5BE6F65B7E13D4D709F0E636F2FB762B8D48FF8E7 +195000,k,F1C0C301E26DE6BAE0C7B953527FF4D3313E2D41E5FE91FF71E89B3E7EA2427A918B603C18B2DC89A13CA732BF7B87CFD2358B452AE0CF7E +195000,u,BE4D059A6E7FCCA38C89ACE31C6F18C6270D78BCB1A8AADA92953BB99D7C02490B1C372B9381B94B560FDB198182B7BC5CE44AB202273331 +196000,k,2B04C2C29988E1DF3AEA1BD1C5709C4DD15B92CE74A372FE82C8F0F53656F9999D251709C8DFB615D78377B0CA825108284060AE42572D10 +196000,u,12474A421742679E814E887123442090A19E219B95C9431A9E16B85877A862FC877E9B2AC44A8C537306A8F78E4AFF39FFAED5C0324F5A57 +197000,k,F2C5F4D6C65D3E4BF1A5B4A9AD0210FF4E7C25A16DEFC0A4AD47548C2EAAB3A4DB167D8CD23D12EAAD5DE7C3BEBA804E37D3CD4457DE5482 +197000,u,1A35C9640560667B26F64EC1523331639115AA65791DA9B0CCC254CDE39905504FC3A422ED1A095F9A5B753E25E9B05FC9863D70C7D56FE2 +198000,k,368912E0C4363BEBD31DE28E8DFCC3F28335C42FEF709C0B4FE1EA04CB0B510D89D21099BD375CBFB939F1B9A5598F05546BDD0FAEFAC844 +198000,u,5D92BF8B74CB2FC6434169D72F261988D2B8E880C597D0941D0F6A93A49A6674BBAD9B915A2BA1881E535E00FA50C6BEB9526D4AE43CA8ED +199000,k,3608F9D031B3CB887DF58B19DD5BE9C1683A9718F0A8486691DC4E432AD91E54BDF29A41D31FBE2321388A6D2B553F010357731D4805B7ED +199000,u,BAD823816589ED01C4D7D7AD7E2D5CA5A5AE57D51475DC1EDBC6669742C05C50A58FC7A3E1EE16EFF4490E6B486262069963650A640B98E7 +200000,k,E86697A7D9C44EBEA5AF18C0D21C593BB4364257263C425B3351F7F68CFF3F5E847121610F92EF5D3A5773825A5E4E5B00EE7F7F107F7EE9 +200000,u,EAAE462D502E411810E74AF6AC0F228192F377C8CBFB83FE6BB42C3986B3A255253619F271B3C60B3462EF1EFE868CD95DBC5E66F28CC2B5 +201000,k,E1F3015283F249B5F443433205E854A5E073062FBF6B650BDF3069293E01BB3BEF328AABC1E68922C942B83CE546829DE5315FBAD998E367 +201000,u,5E06F23028EF3374A729EC7D71EFE121CFA7CA2C8B2100490F7674157615B4E4BC820DEEF86C7C60999A90A050913544A0429B9307F93263 +202000,k,709241235933B2B882A10AE66FF5BCDE39E12500B23F5E5738DC35D1385A2A0607B9C5C20E28E1002F4FC4F73052ED676B88FA453D5A12DC +202000,u,9AEE86889B2E669F6B9507FC986671ADCC14EA17984FC2D98296823F86A38083AB17EB277B50A8AE2E43CABCEAEA282DA50F8A496D7323BC +203000,k,986E0981DC70E4FCCCA524F0A4EDEF45DE4E56339A2A24ED3398E3D99A97F95FE48A5AA781DCBE6FB8E82276E3DA7C1C8252BBCCE6A5FFCE +203000,u,8513888844D835EBE427C9974B7333E0F2D3645727951C868CCFD6E607E9B4E4F4F75561FA6FA4319AEFFB86F403F81A79155A963E5C2663 +204000,k,DBC4789DFD69F6FECA7462E1A68F8D60867A78C1A802AB1033DF122BACF1B1E43295C337B200AEBDF70802A3AB9859D0D5E84FB8C0284B90 +204000,u,BD63941A34856E409B2944A56117BC3FE307B4CF9B02A1CC3FF8A2A5885A89A86B9A8647ED0D05B4D5510DAD2F1E6F2D8D887F5A12AF0A52 +205000,k,8743B3D203A823C9B712A8843448D6B920214CB07E8DCBB65F851D4844672B2AEA3ACBF31CA669F0F3E1FE744BE2C61370DDB5507284F4B5 +205000,u,F91D18A8487FACDF2B5D5AC5CFB6E45500E86E7D8E53412987ACAE7E81BE24A4A1994778D6638F3711FCD34C997363E7B2E698C4F129CF56 +206000,k,1ACD7BE623630D608A68B278E7A0646F60DC9168CD30013FD9598DE341B14F21CD51B9A78695190096048073AB16A7D4D2E9D1B85E5261CD +206000,u,D101F798194B92D9FEFCDE69E75D0F0BA7AE2262BB06405521A3626C94EBE943ACB3FBC27D73D2868D4704639518D7846D7D6E1389C68905 +207000,k,BD2E39D0285D84698F7B6896DB39570FB4510BD96611BEBC69B7D42A4A8A5277E917A1B13168C07C0103E3BAF8DF0FD84B069A0E6150F4E1 +207000,u,A6D8556CD04F6FB8E189D4CE2F2DD91E9CD2DA43C1A21E25EDB60757FD11A44074542F9C2583CC67E48E340BD62A21F3079BD19B4CCA6D47 +208000,k,C74510257E007FFF3791861AB0193D2C12BBAE0B8D982777A7BC950C6C0990282F73AC142A34B13A2B9245C623E27E3CC29423F9F5B1D147 +208000,u,DB826E1423F917F3FFB8F3B1A26829224DCBAFB44EA42FCA342922CC430EAD2EAE5AC9F1EF399A5127F8F902181E5C31E703EAD6073676F7 +209000,k,54AE305C884DD5033542A8B212D420786D95C653425ED6BC1BE3DB92D0655F3F8B790EBF8DD82E0233059E51E6B896346B825D13356897A4 +209000,u,1E7BC4138A6FD0D47F733538EFB90CA465A628A470D95F836BFEF9F494704FFBEF2265606D2FD5254002BBB2A109D4E6680FD7E75A2EF72F +210000,k,D1C07858B0A9BECD03970E00521598480E2BB6ADF78D90504E474CAA0801855ABD1CE946F7B001F9CC4135E57BF47DB1AFF6833599C32209 +210000,u,2DDA272429E19FB8730BBA92D48BBAC8F363B2083EDF964949F5299B349E2293692D0522F76448E573FA564D9BB6AE29FB74E9C51FC87452 +211000,k,0EF32C7FBFAC0351F2EE1BC3B6005EF339B6EB1B07FE1B2BD41DC755B9FD9B8DB87BCCC47CB320898AF440B773FD3A367BF85C5F9AE06413 +211000,u,B802C441D216348F394852384CBEC4DB2C9AB01B3653BA30F3DA38F30C52DFFA72690A868A7A46F6164F486109053B7FAACC4E747ADD9BB8 +212000,k,AA899FBA31DD21790ABF49A81F857C28CAB37332C28AF09511267D6D40087632073B454186BAFF6B7DA2364374DE116E1CE06B0F46143F60 +212000,u,74F900D263D75014242805C6469B27A513FB2C14E4676E263FBDBC28CE997AFBCAF1FEB4792439406B3D362FC959BE9007745E427A8826B0 +213000,k,5E5432E8A98E10B4AB03A5A840ED704681CEFA7AB5C6D4ACCA1F730175968AE399BCBCE52A4247049E2B2E558899AE85D02694209D8BA327 +213000,u,42DFC4CF62C806B4ADD47030BBA00A2D966B542E0BA09B2F1C5E3963A9C1202B9BDC1AACE24D8B58A53BEA0EAC9C348CB0F318F4E25F7B02 +214000,k,F317BA915FBA5BA256CBFAECF34B5A8B2E19CF06102DD0EEA163A40A65F42257FA0A6F5B4008624A30C3D1BAA17D53B662FA60E01BA9C63B +214000,u,63A028087EE7ED6FC6B0E8C0DED89F984F61A5D35455796A0D4046C1B362C3C51B82599CA3838F703986EC32801BA3E05BF22DDDABB8ADB9 +215000,k,3569443DA289DC96A4AC4908A7B2752629AA8A2A44BAB000149E418C168D0272F5B5ECDB1A287641AED3451A4D3735C5B5D14EF1BFD7E8C9 +215000,u,DB7A39B66986EDBC776D071329CD34D14B12734C3EEF3C5AA307EFFDAEAA957457EE9947E84F5082D59D477A4AEDB068A9D0E6845663E37F +216000,k,FEEB8C5DFF744D1D1ACF2E4E5934E1B040C03C1D6CD33FAF9F0653FCD7EB3F67704950AA5DB587B26FC9C489BFA7B0705190532860C91F54 +216000,u,7E671FAFC4EC13AE74A647126DFFC8102A00F08EC51BA48010120F03F781D08F734DA9764875566DD7D4AF00802B2F06F715C1B8E9E24DBE +217000,k,BA795F4955AC4F9A5CA555B153DE35CF8F4FE387AC9D7240420E6B7C98DDF7E60976D85EC2440C092C1F0971CF006FD1CD3E10697241FB13 +217000,u,46DD6F35922E4B01647DC9D04199963C7120FF3A506DED854F576661EE7266870C4DBBE374011E31ED9ACF978E3F2DFA1EDE5260D552D861 +218000,k,32799617DCA2EB06DE796C1DB1C08562AE12438C0E0E2A105756FC4BD0D487F6DE041231433EF20BFF694668A3D7FFC8E785C77A9270199F +218000,u,55BE2C15F7232159C971718B74C1C15020B1BC18EF944DF909D32188D51CED16CBB8FF43DC94B1F51CE48F89C9352764BDB7A48207C3BE2C +219000,k,A492557053025E52010EC1C9D317553A95E5FDA2B3FE4D9CDCAB6A5607C866E09FC284EEDD5AFC778F9CD4C7EA9C530E9C155DD3BE4FD556 +219000,u,353E518B340473BAA28A6588E39F0FA7A1857A4BBC0747E3E89FCBBF78D4263C477B18B751DDA7F0CB25D8066066C1B12BC6F4BB0C6B54C2 +220000,k,F31EA6D466D865A418A63E9C307DF347B498E218E8CD2AA03742EE6264E57A99892BC1667731CD690173C02623FA50E88E64ACC78DA00F2A +220000,u,DEC680C676C882F1CBE732FCF70F72970A1BD363450E4D2D24C1DB034CDE9445F9CA4D8B77743BBF79F70AE629BC4BA0374756076E751744 +221000,k,A6E0D01D62A4E2A6CD93E9CFC93DE44B26382C779C475124F8BBD6DDE312918746B38380D35AC0F35DBBD360A3B8E5484A6AC9870DBCD5D5 +221000,u,79069D3208B661E40E6E52B36ECEB98A4B0B0514A0E20E2F3B8BA9AA8A926032215655C1B48FE85FF164B96C4BF7FF812F71761D07C7CC2A +222000,k,0D6A112CCCD4AB8AC670166C292CC3E4DF1BBA7A586764C3ED1E1FC32A2ED7BEAB4ACCE31EBF1572358226FB97F93A3F84EE150AB8997E6D +222000,u,0158502B6005994196BEF68151637CFC2465362DF355265C1510CE9E7356BA948D9FE2132D4BE70DC665841E1A9FCB50E40D400B5BAE25DC +223000,k,8A85933FA53C58EA7B29BAABBF459BCF0EBF42A0B56702A4CF53D585F50C91342B30BF9C5DB61EFFDB08F706277615ABA2934E7D83B25197 +223000,u,1511D7DD3A2BEF2A5DFC2A92F050D0C9C036A0B4663B32972B2016301A0C938E95DF14A169620716A3A6019370DCC4BA2CFC7023FABC3029 +224000,k,B30B3BE5ABC6325BE1F427C01D604FA330317A43C4DED4D8051449AC728652CF93471F0E178FCC6FF3B0425689599F738F5B61FC0758B9D6 +224000,u,CBF95909ACDBCA49AE62C779E6DCAA144278B2BBFA97FB83823B6C71D0CB413D0C2EFE4207009A5F3017E65C7412DEF5FB064B86597AFF06 +225000,k,5879942BE18B24990ED31C24E4FE503BBB3B3DE4532A12185645C6741B92686EFF2C0BF21616D82B4423F404627CC4847AB6454AD3273CBF +225000,u,857F3DE72C8685AFFE5AF6F1C0AB3FCD80635314C2E75FD0631F76CEE285089E57F74706EC1BBC737A1FF6842578916F49473B09A797486C +226000,k,E3D15CC07552C6E7106992D8275F4F89508602F4435BFA868F9734B3A1EBD6DEAD94ACAFEF36A5DB0C009D859A2E8B05AE48946D00B3648E +226000,u,C73BDC0CC247F995A2FE2E2982046F428CAC5E67ABD799E6DA8714B73DEA8E6BC734616F5405BB9CDE77E1F7D914D83B55786592096D8A21 +227000,k,A89BEF53340E552B15D6149937FCB7F12D804A3EC12111C60A5B92EC0D29D42E8023562E38D53A2924A8EB492C66C760D8742297091F8791 +227000,u,0B75BFC2BF2B18E58E06581E78E2B56888CA1478DC7E4D83DA86B9E0CA7FD803D492D80589366331B256A35C9ACF4643BCACDAF26601EB9A +228000,k,1298DD37DE39E877284FBB2B3FA87EDA642ED3475B6ABFEE5201BCC7AEADEF546F427557096F1C2FAFFC417DCE74228A0DE54F468F3EFDF2 +228000,u,DB9CEADB3EA1F03CE76699898D531F7D42A336F1E0D841B0185E7F40A6D2078EB9CAD707D3FCBB8F1F74497917CF7C7743E64C6974F332DA +229000,k,1A3B04E58BA7301EED450C2F7905A1D0B52DAC9B029411D7ED0BE461304033E3C9F693DE28AF75E964001AD791CD327A7FEDA50CBF139066 +229000,u,CA29E677DEEA377960E5CABB84ECADF4153D8DC1D86C7FC2A343B468308085BFF4FD6CE6BCE23E2D3C05F0A66FD7BC9FE525131A32F9401D +230000,k,3EBAA617A6F20CB389F5DBDE06937BA4F92EDC1510CBF2EAD17477D1BBF7F26FCAFACA45199A7F25AFA5036A46CBDD796464F583811583F0 +230000,u,DE47D6EAE35E9BCDF012521209A48141F00212E22D5161D554B8938676571F1EEA492A647DE51A290333014A79EA9206402823342B7C2E0A +231000,k,FB753E0F331B2A13134DA2C978CC3C315B74C5D66EEB5CC66B712134F08FA9736A0ED92E5B2217FC5CC79EF3D12ABA5FE734F059F684ED48 +231000,u,A72FEC08B3DF6FBAC16BF6BCFC48175E68B668AD8616950276C61DF5A23B58E3091F57BBF757A78DE61B2B1E7417BA5B0A62AD6FD36343CB +232000,k,7709E7CEDD5E1C0A56192E8DB238E7C4FACE2266C876C130470330B912C096078B22E25A710585710CE468ACC63828D58434C109C0AAC884 +232000,u,165E84E3A37A599C52424053CCC25509950692965DA41E6B8600D566B6A1D123D84DC0CE074519672CEE229DDAE64C5BA00415D41FC0A9BD +233000,k,8EEA8D299A64A371D7E895307675983A09800A896A0D1CA191EE255A82CADC0A88ACFC0EF87EE2C99187B19814CBD51C287844519D4EB46D +233000,u,C5C61172074B25D9F7887D49B91E5398184D187F74525163935762FB6997ACCEA2A06C2FCE8C1F00809796085EFA5D37AF2B929C2AD33FD5 +234000,k,5FBB122F5F84970059042EE179AEFE09C38378292D44C92414635AEFD466440A4302F0AF8C92B96780967ED75E29A440D89164A37D060891 +234000,u,C33117AFBB60A7FE7D87DCD51B494A844D28652DC9C3F1EEC552364B75031DF0F5637A2895567F9ADAE962C081D49637795798C7BFA335C6 +235000,k,5C236A6C29E52B1DB8F533D61E73D0AAD0EBCBF794E9535441EC36D7D145EF9F524A18590AAA2647E4CFB9BBE78D9E359D489ABE4D4C3292 +235000,u,5CCF6B3BE68D269AA94A54F6E600ADB76C0FB25E1F0CCE3BCBDD1EC984A32EE8789BE0E9228A93777FAA92AA6D75E0BF61AD2066C2A074DD +236000,k,5C66900315BA358454505E42BE04731DF56E94DF1B39A006E8709EB05B9A999B1B305A3EDED91193D5EA4C33E4F416A3FFA4BBCEF3C10E3A +236000,u,D1DD376E81088D944C9F73051FA950813E5C0FA233217FE1E17783004D681448FAC74254A68D0C6AEBF2194ADB4211871D2328CD8CBA4B9E +237000,k,F84B60269DF33F2483F11C33F82B0B81DF89AE2DB9E798ED75D4FC2B5556EFEC6EE5891EC2791591F05C2FB573405398A2A7C10663DFF4F6 +237000,u,31AB66EE9CBA1CA06C6DE44D22D661DD706831763405DBF71732CF35846294B9F55ED846DD5865EBD32F6B76F6CC766969DB4A577F2FE3C8 +238000,k,809F73AAF264DB731BAF78B5C05E4BBBB6A053FE869E96407F2E7087403CF1DCF3B2418D7EB35005E40B9594CD17D20DE49FFAE34B5C12CB +238000,u,24A2FB5BEE895B2AEB712A174115839D997522CD2474DB8189B6D5D062AF3E70E06A20AE2634545CB340E3637B5057CD4CF275759A8CE67D +239000,k,A0FC15A152C072EEEA43C09C23ABCD24963B1DDE2B6B6DE8D585BB1481BA17E9638090F50BFE082FC460667E5526C610B75CF805200E97B2 +239000,u,D9F585EFE8441FDC96C0F412A392629BA5653A3CF1FF00BC5FD5D0B0727E5725EFAD68BD0E37E0C6D5CFA0BBFE9106A6023175A53D6E14A7 +240000,k,F89C5C2084017399E531980DF3F33E4AEA7F52895E48DE89018E3F8416BB8BEF682D4597F1E9BC4B0D4C7ABBA4CFBA248EF9C57E09E0E826 +240000,u,BC03169043B65EBF3DF9A7D2F2CA98638C014EFC49C918904C424E3A0EB884F9B5A8F09AE4F7BD180A91070B2FB9F6B614103F873D6F44F8 +241000,k,5A4A11A395FA1E0BFCD22794BC449A3B47DC8F35A708AEB8CD0E91917E7EF297D4DB5F86125C763C8DA3DAA5459BEF735308337B8002ACEC +241000,u,45AA7B2C938AAB6E0BD69B173E47EC1E9B0BD94C8F440B349A3F1A754E579336FA77C0E6D6E7236241DC513403307EBFC54B8E175C61DAE3 +242000,k,6D908C903FDA6E426A3401D0BCA24AD7CF0B4694C4C21CCF3DE25A8AF7C2D6AE3AF3FA43BFEB84CEB34F8770A883F41A110925D465ED5ADA +242000,u,D775035463E4BB2EA83E41F428DD008002D4CF036CDDE9EE79DD764846FB9343DF1D4C246B7140DECFD61BF34AE0664D4ED30E5DE6511426 +243000,k,0911D8F061BFF0A1439BC83B97D7773CF893B256329455989B840D7574C4132E4C393AA11B351F0E61AFA07F1C3C79A2E0AEBA6A9878CF7B +243000,u,C4253165A9884A65A69F134BA993FB6CBECFA66CA26ACA30D716547717183A189CE810F3970AFE0553E35D4836681941CFDA475539355945 +244000,k,8B4D854FF08C0513E548399ABD675E6214826DF3E687C70CDCEF3560A631B237CAC0A3454E8106BD03D5CDF3B7F349DD7F4F0A9BD04825B2 +244000,u,20E3BB8734C0D8CAFBE9BAC3A71A25D8FAC5CD4E5B7516C547764A7F0F856F0B3BE3E0060AD45E098A8EEE307885355E88A4767C0F1926B9 +245000,k,2D6EEDED9C81C4F23A54D20DD8D0AB4DCFB7A8BAB3AE68D79B7252976343628290AF784E7C6850CA713F5CEA2E8A782070BC207DCB51F580 +245000,u,5637DAA7454E99397DB2CA4778589C90C61DF0EA49904876E42739F4874198EA64A5DCC8CCEBC7226ACD4AFC3FDEA24A4F1E5D5528B85324 +246000,k,13697F437223331DD778A5ACAD04B6B61089A4E61EE269282A21B0235137282F3EC53B83EFA66DD682E5912C02342245FB051DB9EB370F36 +246000,u,E2EED30EC9011A0154B92FE08184EC1F934D979D0F03C581E30E79E9B9A82BAA240AECC9C46825B02CF547B2D91FA7CE39E3AE415564F3AB +247000,k,67D9BC9F86A54CAC8EAB15315A2204073C2462C565FC82B41FF3E323B58B91B2C854C955139942EFDA7EACB6CB2EC081364554C161ADAC7E +247000,u,50AFEC5BD33D807563E8B1D8F9485582BB04B95E7B7804060DA9C2A3CB8436995EF97D21E3873BA91B3DAABFEFA8013B0B44C9F21CAF99C1 +248000,k,8C2D4DEA940D58B86D0DDDE708B2A41E0566112055866CE9AC544B519E463F58587C39E9867FEB1C4B86908EDF255BB0FD1B6595FFDC81A6 +248000,u,7BD4A41A10AEF6B65DD887648EBF280928C43F12080F19189D530CD71A5E74B04E6F911329F8445FE1BF744632DE8261EAFE0F5FE67BE0E4 +249000,k,E3E4D599FCE9B98F57734062638C75D7013C180A0F605616F28E60FAF5F5B5B5D560BC7027A135C54B9731616FCD0DBE13666ADF36D2EF82 +249000,u,13914F98CAD2A45DD3314930BFF5809FF39719B653DBD61F7F447F7D593ABF13A774F78ACB1CED2489BEAD4555EF8AE03396C0C204958DCA +250000,k,33616E7506819313F263F339E5113A04E4932F006B866E0FF4E4D85897434F69B918BFDE694F4CE0E1A6C46B6CFAE7CEBAF00D7326857983 +250000,u,9D9DA6A3F61EA0C5F71718D1ED740A50868161CE6291F64BBDB1E5ACCDD93F27A0D43AD83B6F01F7C62C874C603C49240CB1F1E9B15FB9A8 +251000,k,F61A6A89932835C6E724A250C2DDBFDA9B5D470CF88BC7F3080EE070C328890CD4DE78CB51078F73BBE654369229FFC990C46811E7EC9A36 +251000,u,22D4CF0F2EFAA5443EEEB327C97BDD185D7CD03480983D0F0C1C5390CBD2CAFC115FEC24881F6F399BC2DF07553EA76CAFD92EBE69672FA2 +252000,k,AFCD1DB051C0393D0F94633B3D857CFC6228A56AA3967769ADE9570AA7C99D5A02C760E5498C45FA80AA88FEFAEA415EEF0EB70C8F664E0E +252000,u,8841ED37DCF7B482CD81AA5E74341D26B30C64ED46D22F98C188FE455B2AB7E9019FDA34930451BDAC3D3AF73FAD4BC6B7D885B6FCF0EFD9 +253000,k,034DFEF5070B757F25B70F5DBE89171E1B500492840FBB257D6DE9BBAA211B759391101F6E4F709F39D1096E4B8397A11B1EF7CBBD5B7A10 +253000,u,ED6D6C60C45455C1EEA8A2006569BF4ECD7DB8F4F0742908231E2F483679BCB14733A536B6DC1F8CD2A1C89B0CE68FF6057AA72DBEB36DA9 +254000,k,471844AB1CC00D7BCD886950BC656FE67D4D282468A5E39185A6DF343DFA8950B34BD55AF8DF5D85D01DADB07A6BA72194D0466327113387 +254000,u,49EC989C382E92CD2EBF07F60B491A14BEF841FE979C50EBF641FC1E97770EAFC7425DE7E597DBC190488E305BE5F2C24CF12CDEC50FA937 +255000,k,E741AA24B85C9E410AA7ACE9FA92E01A8ED9BEAAB33B1B267CD01BB1BE87566B0818390D3029C6D7B1B1803472A8C6BA04782750A65E27EE +255000,u,AB5C942DA95B4D421569F7A10FB24A9956C349A83CADFAA7742D5F19323E4EBE0AE1526581DC2CF8D9A2051AB2C6B7364507286A9C8AF6BB +256000,k,1054492DF81EBF5A7FDEC2966CA5D4F31D967913C8C825060CD4CDE23FA48B929D2BFA8803891E4C7F0616ADFF0AFCBD1DEE6436317E025B +256000,u,D1C75464B7F22352B4665C0CCFD9873AD75D03BA42473E453F8B9C205E223909458E5CA96972FB2CE989E471A8AA4CE97E4205C7CDBE8660 +257000,k,564527A8A65AE568E77B1E29DB94781FE0FB0A8895315189DEE7F8E0F09E3E47CA16951D9642EBE0BF873F48E3E33DF8009ECF6139543132 +257000,u,174068818DAF44E45392433953871AED89B4D28806CE567BDC02E9018E5E372032EE40276FAFC219EF5475286944945794D0F079FE62A773 +258000,k,A9D6246DDF5C7F703220D1DE89E9A8E2A4184ADFD6215ABC972A3325AA1B4918D07380C50AE7E6667D356BA5EE651B798A96A3BD4623BBA1 +258000,u,4C5BF125022157B955696B4CFE56A95CA99C5C3A02D1645809A9F19A626925B919B9711C4F81FC27096A88E20D90AB9E716D17870C55E3ED +259000,k,8A6F19C6F0108BF557A0FB23380848A617EA06C05B0C37FB3D6B8A5038D993156AF0F7176DEECC998BCEE48F91BBEA173CEFD38085D3A4E2 +259000,u,7F445EC5F069061D4C08E28F5BB9F341074C0ADE579958D111BACF1C35672B26C89724B93CE4F64925572942CAFCB95544EF8F61AE5F3905 +260000,k,0AE0209080AD2E8829747D0077F01A6EC2C6DFA7938688D91F58D28DB348E151E9EC2723B666BC146241162E53729CA8EAB3EC9DD72DD570 +260000,u,E8FD288979F70931339967913775E191A6B40743A86171D03CF21253723A408E714260FE2E6A9AEACE71D4A25FA78990E8BD8FD50FB280D5 +261000,k,58FFB1B1B1BC1CFD170822ABAEA7B56E96CDB5604BE35D15B3B1874804F4F841AFF813B76A5276D2E99253E697674271ADB521A9FFEB5CC9 +261000,u,837A947F96D0E4F9B189174D4D85910D3C3F3412D5057D32F1017893FE333CEB5526B821E882FFCD3A55C2C23AA3962682AFADBDA863E957 +262000,k,57B62BD7D1287DD18D15DBF8FDCD0FED41D32177ACD851AB6853637A93D018F30D83E5D9ECE9E7D6E2774049400922B3E7CEA31F002C01E0 +262000,u,AECB1AFAC0CB17F068FC1994332DD93F3E8DED16F85F061C49FD3135685C53F0F96F68D7FDD15D05E496FFC2999CD4D6F2F64935089B28DE +263000,k,A81AE0989291CB7EE7EF1D3D5EC6D013E864CE7FA3D9B3D41FD4C820DF671AD57DBE00B3B2B6068EA6CD6EABDE15E6DCDE3F8108EC839A00 +263000,u,1DBE477510F2939789FA49331C29A844B6BCE83267D9D7AD06C29C5DF9D9DB432D5C52CA487567A242A24B223B80DBA062420AB56D3AF230 +264000,k,EFC3269D87C355A0BE9994F24F8CF83CD7AB3637C4F397DB98AF6B3FDA0367516FEFA297697AEF19FFA67C9CA5DCF9871540851B65FEAD7B +264000,u,A9F32D6150B7C1B98FCF9FD0760309C56521A111905BBC4EBAA5F498B3B23614BD1B85911393015E46D5F7261F2A8D4BCAF90F70C04653B1 +265000,k,43CDA9BD9B7046851F337170E96E82B188F6C4EFDAE3B64C85574326B7F0991EA61C9A69052E8B84E84B4020B0CA9460811B98AAEC8C570C +265000,u,D80415F8FF6F0DBA3C12316B3C599691632732B3DAB133D57037EEF52AF4C5D88D557DD028FA4EA5001B45287F4FE2FCFEA95CE8DBBC2164 +266000,k,B4074982BE400892AE98E113FA5446B26DE02FF51571601D807AAE69F3652F48B439DBC90805BC09BB4D51A678530FF6B27DD683A75AB80A +266000,u,A87D3AB40A92B1C7AE439C9F7F2775E6C594E68AE98E4FD9280BBC9999FE52C264ED12551C959114A311666B5840D57059A2A11B056249F2 +267000,k,40689707A8022087CEEB6DB313000A1C943518BF43E49122F80533A261C8EA76F0839DDE4E5348F521F86D2859E2A5DCFA9B1741A92FE9B1 +267000,u,AB942CD89D9A9DB9E93526619FF5428CE9505E8EF65BE39917992F4E67ED10F2EFA3D3A577CD16D440FFAFF12F5BE07B167C31DD8A54EE81 +268000,k,2C8139CB6C3950B1B18F72B4A6FFC6869EA5A35B3E945B9CCFEDFFCFF0890A2AF894DAD79346F4EDABB1831AA7635175D712D1766873DEB2 +268000,u,56A19D1B54867331558CDB4E02EB20DF3E7B7A3D1D04E7B38239767BC76D03C0CCA806A74E1935DEF3F0381686E308ADFD96BDD7BC6AFBA7 +269000,k,173E83C0D3E5D4FACC7B4E86BF16669D8B081CD28E889D0597B45EC5B1BC1CB0673FBCD3AA394B9A0CF074F12753A565762722D817099657 +269000,u,2B20B4CB163480DB36F9B9CDBB9F287A86D4D5D55101FF98A53F05FF6E8D5D1306C5BA9CB7873B4F41411594EA1ED67897EDC576441E7660 +270000,k,F3727364D0A32BF395247E73B423C071D2E73F164DE59FCB71857000AFE2A859D81C5CB268B972C8A5AFEEFDE5579784E108BA4EA0DAE8B4 +270000,u,A411B5BBDF7836C4938995E87EF65DF0D9F8A83F1930EC65C46D09CA01751F709C8385D0E9F307F7C16E984BAA011CA89327A38AE4959A74 +271000,k,F1AEE52030FB66D2D94E8AC6304260E1B9D3B6CBF8C600F09B3324A339FFAA3748A95FFF7E8545D8E0E210EEDED139A2A9A7756A35A5933A +271000,u,B8EFC773EDD9ED0F6C0321EF134F94D837D6749F490CCAA273057B8786960045BF89F1B918600B35E59A2E9597D40A5DAF750CC125506010 +272000,k,266F84E9F3CB6B3C8C88F09C91F9C0192D6D2A3BCE53FB9EC17314B9A20A5316C4BBCC0F69C8E804F946F013E76E87873152BD6F80E9BD6E +272000,u,0973F5B68EB59F0263C0F685365AADB92396618D4BEC956779B2CCEA45C0A28136C9A4954E52F277D362ADE5D8694CA9DA15230967637C94 +273000,k,91093D1A343E1CC84E95E2FC7ACA04BEC4C5A2713004B896ED28F5B5C46CBCA3E58A495543E556A0EEADCF8E1A974832979128373FECD50A +273000,u,9A1793A786FCB86BCDFC37A237580F6895ECADAD18D93F1C80F109E872A5FC2EF98129405D2186FB0228AFE4353C6DB2A6583D9A20524F43 +274000,k,2E5C3C94F226ACAF98BE40AF87FF70600EE8A5C135BCEFF076139D55D68A8F7A997FE1157D3346CBC286CE57A9827D22835438A55A969FA6 +274000,u,E2AFA6CBC037B00808AD914D551F1A9BCDE696BAA25BEB7B2000418ACD8E17D9A813AB18A01350AE0486AC43BF322C286339751531125385 +275000,k,7973E9926EC760F343AC02664825C4C75B95025FF27EA7DB775D179E9881E29A1461E92C76A86BC6BB9ED69EC9B37EC6C11C2AB0A4F337EC +275000,u,91F964B9B345A56B2ED839BBEE61741D489754FCCA55B43490BFA198E02E83D1A621F500926A93829F007609ECB5C0D27A08020D35AECE0A +276000,k,0B73BDC786DE3E69C234FC128C9E2487A9A4304CB39E6ED900D3D55D4C861993F7AB2C9F4794C87C1A8B7B760D9A4733FB768CEE54D25C98 +276000,u,EA6FB326FD58692D380CD8590CC81D99C33A79F00FC8FF8B7E02225299EE4E86AA87ABA98D755D7352A2199B01532BA3F0A923F081C860F3 +277000,k,90CD54604369B7994C13764D0E2088DDC99673BEBF82ACEAFD97768D903514206993908256A60687FEE87CD20552BC4B2ADB8DF6BB2AF3CB +277000,u,AF2B2CC0C2F574F0FB492D940EB1C500664C16C6C123BE8960F0E2AE58163A9A1C057552D8C4A19DFD121CF7B2E535E36EFDC2B20A5E04CD +278000,k,51C857DE264F550F14E6D19C53B57E4A2EA07D6ECD56DCE6F94DBD8AF3A99A1183DC16A2C8A3B8AA8AA3E3DC2213EB86AE9A17D7DBBE22A5 +278000,u,EBDE768C260D88F507BAF07527DD0C1DC1EC7743A7DE5BE98E9F241E5D55A3E37218C0DD52DCF9E1F8AF59DBCCA23B3F0A621E9E962B55E5 +279000,k,885AE0AF25FB938AF35FC81DB22D515271712058B0E704DA94FF950F63BF776B6131B4FE81ECFB2CF4EB2DE718DB97EA67860E05F40ACAC1 +279000,u,86C0EB310EA33CD208C770F6031A4D22B828489D35910F3B679136796515DA363DB3E958988BEE40134FE28A6BEAD3062064CB3E765DD5B5 +280000,k,9AC7CA869616FBC2D1255CEF954FC067E1E458FDB1D34304A529DCA1666AEA89DE410CB3043E5F83A91EEA4F1AB1C6AD7EF3FBAE32ECB052 +280000,u,0D5685E417BBE75DF9E6B0A634CBA274D932810E2D91F797C0EC00F43F2F247C4136F78D30182DE4021EE857B415F14505BEC23ADE4523D9 +281000,k,1BD5486042BD076531D8D244206E54ACBBD3CFB65BC316EFF82097DEE90B05D30D902300F4F66E87DC61FE5A069D7D66876687AF3FB1A8F5 +281000,u,CC32261429F6C1C033E23D90B4721AE99470F9AA5D73DF1A6E4D846B37E4941BC29B60654B016427C9C5E23043E50796E71D333BFAF916C6 +282000,k,A0239F0C7541F456003D91A38D449EADCD9D471D4D1110D83999B96C1DEA6DDDF3CCD34DEDB3A01001C278B0DFCFBE6E585CF3C71ACC7D77 +282000,u,FB0F5534D20CD71F827C14730824F45BE3FFDB0F17DBB7F113EFFE4622983B440CD38E9DE999D1CF964EB34F52C5D80C4DDE122ECA99C406 +283000,k,DE1BE11073F0542BD09EDAE876D85AF75C9E80235DFD1ECF42ED54720B8B4C3E2C5E56AAABF277E0CE2EC57E4A83EB4B496D65EA858EF22D +283000,u,02CF62CB1D310283ED63E6C6C95D28B75ED7B1ABE896B1BC440001B9CDFAF7D1C08F6855E61A8CC7438EC650745D0F8DC0A61F7966E2A2FA +284000,k,2373A5713F69B023F20303B8DB28B4FD6EE26B7F60A6EC1244D1D345D54A575F18A6AE89846962B714270A670ACD36CAA28A9FB76A658086 +284000,u,DD366CAAF2D8F47568AFC1ADC0FC19E1A448DF424255340B0A323696002153068362120D2A4498C17BD6CB012715AB7E7BF56E462B421955 +285000,k,DFA5636D71C154858E326BB379C8B5E82A69C90E692313D1E28DC8B6E210CD2E22A56EACAE89758409913A7A5DE3A9C529127BA5A941F619 +285000,u,796A2C908B3599D95AC420224FB86A95F3118774844493699174580857210A61508D166DEA910936F511CE8149048CED0B30AC2CBD87097B +286000,k,296DFE8E92EC9B1E4CAD714DD3D4DBA9F8EDB5330029BF87191B9F49223EDDF924627306E24607D6AC6DA12515AAC8513529D60EA8BC4805 +286000,u,E610776CC18A72E3E27F66BD681E741E9034ECBF5FCAB0BC05658DB06C58F104CE265EF6D248C441D2E7C0EBCC21257747DA79A1053C1A45 +287000,k,D77AA99C3A43AE8A6B16F4347193FED06A70466BE6087AF91A827565B8211A667FBD1C858B8C91601F76347374A1B3D2D8A8AE56A04505D1 +287000,u,909A73011BC725136EA0089CAC6337DFF24200B5CA43B3F0FB652203209EEEC85636F633504E6B684E4899AD9780597B4A5F7F9097DB003E +288000,k,C3380BBA6764BBFCEDC57AA99449F0BB5ED40AE1CC75125BEE8435EA70F8FEE4F691F990F1CC243CA95E9653D6EAB1FB04887BCD549A0314 +288000,u,B1BEBDD29B1087ACA5B29C6F64B57D5687E271DF0BE67C6F17520F6D7C242CD628CD8C0B429BFE5D170214334C225532E9D7BB4EBB15AB4A +289000,k,9DA0D61DB95F3171F2D6B157F71C7EBF522C4D4ABBCAA4FF45F3D832D75298880B9CF9B242A1C710C9B71F555EC8ECF992F140A3559E3CF5 +289000,u,1393FBB4A5D4AEC947520155AC41257DFFCC332095346CA0EA7BE0A0AAA0EFF1D30BDC10F0205E8F3E0E9EDE308EE96A7DB89A9987D3F7F5 +290000,k,3D3BFBD92ECA2A326E293E374CE94B6E4EF8FF0E86FD947C55B0CD79D169B7597E19D64A15DFA73A7F2F0AF1D62B6A036C4FF9A6211CEFBE +290000,u,0875AF52032DC3E147DC5ECB477CD6E9E85909D0E7E17E20D54B8D6F22741AF015EC581D3EA77BE6B4838FA921EF845979DB0ADE3D4648B6 +291000,k,180E676E4547BF468F292149E61229F286B097C30BBB0800838FC917A9A1B5B3824568EBB590257A84E0C132CC04436D5B099F819E282951 +291000,u,EBE31616840A1400067954BD7D14DD82DF08A7E6BBF4F24258DDFFBC102A29980F2BA199E361AD6609B859BE893ABAAF9039FD1DC230125D +292000,k,69F034E1E7A52D53D41CAEBA836D951BF3B22365039D46E12FFC3E189189C9DFBEE1324F9E03C87435D7DD33EB0DE47CDD337FA34914AF1E +292000,u,CBDC094A49C6FA635E40C6E8DDE9D04B50CB04A0525E2389C67F0A4B55D53F0F8EA963B833A9204C6892CB4BCA9BAC6A98DAF0B6F876A328 +293000,k,55490754516F52DF9AB25D772DEFA9DABFE74978F3863A78CE9E60FD1598BB730153B64AD9B08CA9662F50CFCCA25518A188C181F54516CB +293000,u,969891FB77F424A5539386B74DA63C01B62C43A4FCEA1CD341C6DCC78C2D80F85D7C3808B9074AD3E6DA7CC9B13BD3F784F66E5EEABA88EB +294000,k,CB20FE95F500B8E9BA779780E9C1ED0D6545969A95274E6A74FEC888A62558854C06EFE24C2650F0959984C5CE24EAB8A6C14F08A78AD678 +294000,u,C05EB1B40E149ED1E92146CE9627703A26016E320C70FEEA50105E4C91FFFA6D5948AD94F22D410CE257CE8CBF0CB0FFE8C00D305E255839 +295000,k,2EC5D359D04E085657FFD229584309547538F976E42CEF2449BEB8A0ECAC1019EAA6BAAA4708CEAE5129CB033CE6978BE0B8AE8FE28D441C +295000,u,5575AFD5FDE13BD9DBA428FCEC6C9118D1BFDA50FBAAC74C4CACE57B92D037EA520023D0C9ADB9BBCDD2065F01D4BA5D3964DA7F6A7EFB9F +296000,k,2485EE669961BB26F5175411E26A50E92249C8BD1F837B11FFF158362F7626701FE52C9F48F035AF639A295A0301E82595578A785D0B20D8 +296000,u,BEC8FEB126216BAB42004AA2F75B7AD2C562F3D4E01460FC3B79F2FCC27329C63894714ABC0E4EC816F6A7AE248AFA482EFEE3ED2C61C145 +297000,k,D4CAA09CD2EEFD025B11E2F21E3F93E8669D1E3C29C5D9DAAEE838BCDF7CEFA97D67FEFF09F5B6C72C699887107D42EEDD76F4B4694DA375 +297000,u,677F5DA67C72C6C8B79C6BEBE0B1FF754A21AC33BED10E64DA8E9039867500D472AC029830F947AA6BA30968132D044E6D201ECD38FB7236 +298000,k,6A4FBA937AB22270B4E375212671ECD7778FFDFB1FFC2D81AA3B98C4B0C171BDDB24E9BFA086605DB9CDF262304B3B39515F6BDE59543DFD +298000,u,CA5E3638BD4F58D67A348CB469A0C2E4494C2BA01560A9203EE1E0E9F921A0E859BD69708B766BF163CD08AE888C56D2592F0C4741BDC7A5 +299000,k,E2E8D17210CEEFB60353E29A819ED00C2804F52FB2F3F8FCD446BFFA6E2467D04ADEE60762AA812392D9675F3A8563770880C1DEEB2C0013 +299000,u,2984FD017E8A59401EE8FAE10C8D0D395B42C83A2D3983ECC24AA0CD8CDDE40661CC448BBE8E83BD50641BEED539F9E1E183F434AE96B328 +300000,k,39AC758C14C41D112CECED83D16E24136DDE6A99F91C352A39CD8C192145F600A2C3B5D9864193C32D95AF3044A85847015B7A76727C61D2 +300000,u,F7B13D4B8492AB4215AD4F7F0806D83FF23DACCF482C482063F835020B3F1706790F10D521D0835BD71240B842AF03FF5505DCA48832B303 +301000,k,0D53F4430E069B1C98784B19D4D067106120082757FEA311C62F7B56563BE7F1510C0C0AD8E0C035495E3A86ADFEB567DE27897EE628DAEE +301000,u,2E49100BB9C607000A86DE953707E2C567B1DE6FBBD348ABECBAF0CF3CC05B1943A7219AE102645C401DB2A99568334504B5445173C40CD4 +302000,k,92BFEA234CE96A990B6E4D7C4AD563AFC12B175BC3463B615B2BEBF8C9A7051591441B77239B715C2E5B7157DA0FB934D7200F5D79EF889C +302000,u,19CF9CDEF6DECC61B59C8ECFF391E6F9FDFBDE7E3240DFE0E117A749E360EEFA71FE6CCCDEA38959BC8310703F8052D2D906DF3F039F979A +303000,k,7168FC09B82F6F69EF687155F7195EEB55F1E0E42D72FF7F46D5CFEEE73038A7448A31FA8B41F6312B2E22C7696A4B2DD4B064CE72C43227 +303000,u,5791214DC52145F980CE3D5DC8DAA9B62E4DFC75FFD76814CF294A2398DE0A0022A63D1B66AF79027D69D88D8797C5948ECE56230E0C41E8 +304000,k,C2B12F5BDF73BAF1000173CCCA768F49AEF491EF8142A11730F39C46BEEF0CA1342F03CADE7D832DBC2C5CACBCBECFF089F52FFBCD42F018 +304000,u,3E2F73A0557ACC36B78B6DE256E1D4BB30B3E66B86BC2F9CDBF37A9BD932CBEC528114A61372D8208565691737ADA1786177E8D8994EDBE1 +305000,k,747A9FE73BF975DAE18D9BBAD24F647F1B8F99866BDFE5699341A5A5D1BA150924B1EE6A94DFD65DF139BEB3A59C0C8803A4D0BCC532E0DF +305000,u,359CC5C74E1BF5D64154D7234A91000765A6848A8169B6DB8D534046AA4B7AA64D77DC5A488FEAA35D6AC0BE2064EF68E8B7D27AA502C09D +306000,k,00850383721A12D275B3928E6ED1EBFF24AFC0B25D11FEF9F1EA2CF4D9AC03C5B435B9FA350E3B30B6AC6E484139B6CCAB54D67156A6CFA1 +306000,u,A26BDE24EA7AB5AF0997C7F17DF054FFF36E38941AACFE3B3D095BCFBA4C959773360FE7FEA302FC4026B4F103E8C325D06CA8518AEBE96E +307000,k,5FEBC5C1700FEE09AF0FCEBEDE52C75A1307C71AECDFE22C295B29E252CF047AEB12E3DEA875925BFF20ED49DD5E9EBA2F71F752D4CC5553 +307000,u,107C51964BECEB7CA5BC63B56C4CBB1F48FAEA4C85C27961F7AA44EB77D3D876CAEF7AAC76EB7980BF2BE37AB1DEECABDC9DAEE7C6543F8E +308000,k,074911B31CBA9A3990C7B8CD6CF06C550029DA34767C75C11904DDBDB68113D83E366AEF58653F5F0E8BB0BABF881DF024D639FE691E553B +308000,u,DC83A4998AF1913F3CBF3D5F89D810301FD1D563AAA6A9845A321330BE36C98EC904A341505DCFC23F9A72BA3D03414A8608079BB150CA02 +309000,k,CB3AAEDE05F71FF701F81F470A0567C391EF860189C9FBC5546BC279AE8E90AEF820154E8E0264F75F0F5B57EB2DB5AB0F878E771684525D +309000,u,C406901CA84767E0A9CA0D730C23E838AF903442263E77C4F838433039A869F80CA93A300F0A0CC1DD1DCE1423D1A96C0303FFB86A846CD6 +310000,k,A33D368DC15E12C323FF38DAAFA82D4EA63BE292CBFC14A167A9206A88C51D231629E32FB2DAF98CB93C5352ADC1E07B802F4D820698D758 +310000,u,A22E7D4C2CB9667A371E666773A360F87E99E2F8377FAD9519F2EC408CEB413BC66D9F7A2B5A6A063A57EE575BE2B0C1E78B601FDDA35141 +311000,k,6A53A491A0718FCB260D28FA4663F2564F393C77CE970E88244528DA5C50B8A450E69D1D54E884890556F8EAB3FC98D46B3DC790B420B159 +311000,u,089D5902698D5297EAC22361DA5C4A8829CEFD13CB96B670036E427F500611F5564962FF853E6D0741B5B6F500514B23DD621C54D6870028 +312000,k,9AD4F69333609E40542EF49C65F672578F1B04EF5594C204CCE68037B95BA1CD2F52680776CB417AD712CE4269662668DD4066485C3B13BD +312000,u,54C47BBF3B43944B9EFDD33EDE0F9366C95B41F73C3DC3CDE76A0437DE70946B7C323173D93F373E439ECE78EF7D22007FC4D7D2F181A4C1 +313000,k,384B40636F152EA8164106D510CA18B6652A312C6C0F09061C3C3385DED9B438B7DB099CA78C66FE9BF15AF2D013F0E598B58FE56623DE28 +313000,u,804925B372B3387E14F249C1904758D5899A951EEFCA5020085B32EEFB9A73F2C959018F05E9BD6AC86B351D0DF6B29752678A5D7FFEC807 +314000,k,054FFB2341B86DDEE4713634A46CBC8BFC193AD07BCA69A347C2A4EBED3E96060D87CF9C3F552FF26BA2207A07D0F8BE662D933048CB5861 +314000,u,E94058356E2E31AB82381734EC59EE1A73F07E7C932D42A2DB2D3A191B65AFEA643077CF4D0B0D5579E0FA82B53C49F1C5BD2B1FA31E1904 +315000,k,F8876B2AA10F66B820FC7E70C3D1643E86C3C2F9FCBD69D925CA9AB2955AE4FF9D6FCD75C97068EDA7910BDF166B940234B5394C4FD8E0D1 +315000,u,D684988B8B6C7DD88D7AEEE440143F9E509E14C67C3CA5F127552DF830E47917596875475E595A56DE7ED04681F3BB10BEE49F91DFFA3C9E +316000,k,41D2DE99302A641740707DE7303C6EE1DCA1B6074446B499A2B4B4CB094BCF31825B26BF45E32057B064FC2FC4491A3167BB04CCE4D043C0 +316000,u,48BCF292BF09580A206BB19143757DA77FFC7953357D7EC0613D0CB09135450BBEFD36A1F781C51A60850DBF101D5CB8D5344FCD510580E5 +317000,k,DD5B87BBFBD3072F47B8E711EBBAA5EB7BE9ACE5529F9904A201A7B96BE5E396D0D8CBCCBB84B7EC9373C48D948B50CB6FF39C51501D56CD +317000,u,8BB922FC1171E88617A365418C03B6B0D59A48F87D2115D85D3AA96E9F07EBC4B7ABCFBD1D3F569FEE6314B6B85C2B6423BCF2AD394AF1A2 +318000,k,76CEB1C7798236DE65ACBEB114801142F1B1FE3D71C2AFA33C7D216D878FEAA515E911BA2D81877437E56E6A9155CB72ACD7DD05202EAE56 +318000,u,FECE0CF0E7BF671B5FA441140159C3E9D9965619829B62B5C57AA6AF494F8AB5EE55CE7876AD544B8F7089191E269A4FC5A084CF092ABC58 +319000,k,D99C4E08A8BB75F40705947DA69A668F7477C4C4B714349C58ED34D6252B9E819E2F1DE627D43AC2BB8D802E7D224ADB5D32F6231830A11E +319000,u,E0BC92A21161A49B1135459B274E1D5E0F776CA28BD467B47851A002179812DD2D4C7DED92F1B996A14A992E554C1EA46BDABDEC3FD7A51E +320000,k,EDCA1DAD776BD23F4B95EC464AF499B3899D6DD0E6DB312CB42C4D482FBC915C632C6DA97F8D069DB770F1B342329850108E9D03550A69A0 +320000,u,2C782215C445169E20B415A7E5FA1F49F67ABB609895EBB4FFF716399BD5D513762BFD660FFCF30A9DA0119A665CCC0601B3F1543F525CAB +321000,k,A44C36895F621B66748DCFD3F9854C54C1F0FC6106024D3DD1C8DBDB6E5BAE86A822EDB88BBD8A7C03760489EDED400B1F78462F646E1859 +321000,u,A5625ADB2C593B8827EB3FBDBD27EFD9C31184D7570533B82BE09B7E0D37247C6BBFE1EA22B0FE090C3774DA59A5E9CD7C385FFAD57873F9 +322000,k,1ECB1DC633B2C5298C2579C36715158344FCAC04F3ECF41F6F7A2AA095440328FBF775F0F66758FFD1380DA16406C377E1F02A040CECF927 +322000,u,1448234596BFAF00B52FCBC73D1B8286B9B5114740DB8E47BC8B90F4D4B6A3DF3EE9BB4EA207306D6A20CDF339875761FDE4769066A61F99 +323000,k,87545989893BA9DEF3219DFBF4A96F45F83760C7D30F136D41E7D690E7F30430A7673C535682B54CB3F1042A5A97FC91DA526B65FC70EB3A +323000,u,39211752A7498AF2D789E0B3709189EDCB08D027FC39E43D43C2F0AC69D3A51ADD299D685BCF36E24E64CA5A72A66CB42E86C59879BCF00B +324000,k,DF8BAA5777D789AFE180E0D6A6B5887AACE4FF8230A82D432368C202836D2B8A9E4FF41607ED05B47F9199A54D826693C82B3EE51F8D3C5C +324000,u,A20471B6FCF1C9620C617089E1F3AA5A5AA99F3A511B2884A6AAE65BF2EB9FDEB1AC85043D6F8D4C0EBBFC16AB7399FB79A1A75D45F9E942 +325000,k,3DA014CC164DE686061FBE082136760049E48FFC7BF96CE15B785E69F9C28E0076970ED21B270C9DF34E02EC12752CFCAFB3A0F803B13C3B +325000,u,776794B10AA87F88AEE32C168FDFFFC273A065C10BCD504F025105C88F8022092E18983FE38E57F0ED4E2F5E5BF2DB210B089D61EBDDFC35 +326000,k,06D9D1081A21806142D871203C9AA9D30DCD1DD2EC1C7BDC339ACD017B64F408D36252E2F80FA7B786995F9EA813A9761B71797D48C0032D +326000,u,1F6C59EBCC2BA02BBFE799355F83AAC90625FF886EED2DB9EA89EB83224677738071DE0934EE6D80E49860F6145496B653F4311E01E19C17 +327000,k,CBADF96C5B4C1094F01157664ED6711E60989FEDCB29F5DA36D1E9B40654D8AC033D6C3A17FC970F289CFA82D63C0FD2A6265F5B6D4D6053 +327000,u,ABCD4F7A658BB548C32EDA5B4D4969DC6E3283C4C38604BE6A86A914742F08576D606857E41A78D1A4E4093E32A403B17943EEE8B7C91B1D +328000,k,E14CBE9B3DF7A33B537C0AC0D2DE7CB1301E955B9CA5930829496A703B878297B89AB3F495BA67C7C590EA270249C765C5CBD2F8955201D8 +328000,u,F4E2393699778A551A5F1B701C20E62E13AA2513B9BE7F72C3C798CE42E03FB61AE8026457D5497AA7662E8EBCEBB44DD6C0B7762F00657B +329000,k,0C9E2089E640022CBE6FD3AEB2DC3F9783BAEE142093A18427223CF7BC2A86CD32A711952FABBA0D90530D5A5F949811002300092DAD0A18 +329000,u,5E159F616F57CEA24A9536CE4F7FB47C00A369C0060796E6CFB3E827EB671B5F420EE31C966F3CB9935F9E84DAED0CBD0A3A1372B65A97D1 +330000,k,68776718CF844DFB05A349C87EF7E0F55C350CFDE730139000B5BCAE570DCE1B355807F32C618DB394727467FC43CB9627BE6BAE0672F5DE +330000,u,AD1D02D898A5F3AD7E8B7353D8BA9C7DB478C6A86129CE9B606067C205EA5ADC7061A85DCED0681169797172428AD18C9CE18886741B73DD +331000,k,EC947E20BA25C8DEED0076491357286D2AC4DD5C1510F965C4E217CE348D4ADC270FCED7362D37D39D20784BB777939C60AB546909416751 +331000,u,D9F1CF15A9AE861E380A7014EB873343662A7CCD96183E0BC7DD2CFF24595108C09B58492C056CDE289298963AF2C5628C2C26CBAC7D5D88 +332000,k,40880A9731E22D44DF092DAC839C2266A80CE48C89EB53FFABA0AAC61FE6FF3ACC2558A40529CFFF4AE93569626B71EB1506949106E16519 +332000,u,3B8A72F9666F8C3C71CCF273EB07D5583E65CBB3AAFF348FC0912D467B44F3AB068157E4D50240CD5292203C4FCAF87B752BE7BB3A330D26 +333000,k,AC181E29F0BBF69C4BEC1C0EC606A437939E33B8EB489DA93EED67A8285686412000C55F6F78D9E5185B519754ABC6B0C1E0BFD47BE8D53C +333000,u,2540842C62CFF44684AFE1408341E073FF75885906FE779D075D1CD707BBD9D2F734852BEB72F17FBC9F6E5CE83BFD91CABE6C88D4CCB4FF +334000,k,92DB1008B56F81D2676A50192CB984AD6FF007104449F977D83A02F0B0714ED8D975394860B947998D6CDAD93762ACD811D0E4E1B4937FDE +334000,u,F28F2EDB6A4C759E7B73CBACF5EB86D4A44DFD3DAC1FB38C6E8F7F139B4C6BE8354274609F38E55EF441C9C2D5BE9EC30D647351B5F09B40 +335000,k,C6FE939FFD7DC387543C6A9A910B156BBCD3EB3D288EE1F6B0B4A3ACD372B8D0B8BE3BE4E2550A202E94DBB23075B0C3AB6CDAAC2648B1B4 +335000,u,B46D22A5BDF561C8ABE080FF58201BAB373CF6B5F044605C3FC627A9A48BB60AFF5A6A871F8546002CA7E002F1B3D16CFB6B97980CAE1F9B +336000,k,34B04C57DDCD6F5FD09B20D7648E2AA70C459CFB8EF06AD7CD797FF22E048B40F0B7FFD28994CB69CAE04BF92E0D0BDEC3AB48FCB75785E1 +336000,u,771A840F6D976FCECBF1713404851EEB71F40E14A996192804C92772A64EA88F7031E6D486A3E921BA17D0CF8BECAA6F09B271EBE4900324 +337000,k,896A90484A9C89697CF4B881402E4DC3D3F385A20F51BD55FF45DCF3AC41328C9888D8D21573D4C86AA9B334F380481519C1DF19D5E8B3D5 +337000,u,80D2C4CC57F088379CF08D0F1B373BD68FD7527B9E5F8948F49AB938FE83F65470EE118EE8883FC147D6E141E79D2917A593A055948889DB +338000,k,995841D2EE2F7AE33286C558C37944E01EBAAD19EDAD5459DD4639CBACB0186D78D1AC77E409625A14D092927589B9B01720199AB0D7E0AB +338000,u,49F8EC164BB6046446F0EAC0F9C626B2119D6AAA6EDEFBE9E68A702B8703555D206C33925C1BA97A13AF63AAB258567080ED784AD955182A +339000,k,854FC8DFD1CD1A7003A325B73353AF864BA567116C6D97E649F9568F9D1B559C893740AFA18328F0EAA19332796EDB335ABA8F5053E0F24F +339000,u,8C0F9359D1799593C37885307FF52825D087726CCF4A8FA777B8EF79F617357C0C78440F4553CF256A193647DBF6A427814337E4B3B1FBD0 +340000,k,1ED3D06DEF22F4473DBDF15B6D937D5E63AA15F4572C081461182391BF274A4DD45CF2C36B5DB7C4556130DDDA34BD6043DD9F3066A73E12 +340000,u,4FB9A7DDE444FCD01259F5250E3876802D5A0D9BB0A4A2559434065DC6ACC44FC440764C9E3254EBB39A94A71E630EFBD655E6F2A91AD4DD +341000,k,963FF78E32AAC504353EBC64454D05ADE9D91D44AD9DE768AF06764A965BAF63CF9D7251733C8223DBC96E6A6B1E6D6131069CB9438428E0 +341000,u,FEEE6F59456BA33AD8388D024AC29524F39B5B14A7EB58B7EBE09B1ED9A4151A3FC3B8172E6B9288752745ABB91D4020709CF6364F5BA104 +342000,k,82F85E6918D760FEA796C95F5EF15E1E679185F286953B680BFE3F70DD076E80C397B03C7D3E6665530949C992626F4BF38BDDD999EB9550 +342000,u,1244F5EDA9D41B93C493BE796B4F5A8EAE6C5052167D30FD549916C1C17DC3368B61DC365D59A768C6DFFAD4E22E28C1FE67E0E6DC5F3964 +343000,k,18D5DD999DFF0304FA1CF760A7CFC8AEEE73184CE82F277C7AA9CFC9A9FFCDB4591FFB4CAAF554B9232B1F2A2112A1334F28745E3D8AE721 +343000,u,7CF8FCF40BC8E89BCF2A2ABF84C4A07D9E2B60DEA98FC4EE3A87B36AAA13E6CEBFFCFC75BCAAB537BB87FAC167B57D166BE7E4621EB119F8 +344000,k,B24C1C82373C207308D163BFF5FE800ACB67565D4285567F31156B2F5BEE23C63C76282B6C57E5976BDBC2C722A26AEF4BB979011B11998B +344000,u,B26F4AEB085A72C93C6319F0DD2AA9AFCB4AE3ACFFCF0E761835D1F380CB9767C1D1E6AEEE3968B42173B503861110272CEB8DE9866222FA +345000,k,6745379C954BEB7D414B4F17B34CD644091B006CF45870DEB03EE893F71701BEA81A09B68E0B779C515DCA1AC53DF271E4023945BFF1B4CC +345000,u,E970B9ADA641FC7273ECF4941ADB17E3983B51FBB1B399BDA5671D1EA978D3A9E30E3D995B79236ECD3279CF5B0A45A427A0E4826E7DEC6E +346000,k,0C31CB4AF233A0081284B0C3EBEEA504E8C1E8D62B05154F112472B4271F824B762EB7347CFEEB20FD79630A89CF1942C336A00F8DE0E707 +346000,u,8B30003870ECB00CFB8508992C7BD85EA4450A4750F31E2C6F525BBF6B59C4449551F9BE02AB50F99315ABFADC57BD401B9A7FCB3DC7A013 +347000,k,09266A9577C879BA7C6BE761856E32B609058FCE2ECFE4F348A8D5BB0D5A36E353BC0B84860B043A4AB2B1285FBDE524678FDA2253F69276 +347000,u,68C36881DE37E0C11B5AC2168EEB270DAD251EA627D95EADDDB151E877518F69C44C4079E7DE0F8CDC07C0492FACAEBB8CA2C17120F14992 +348000,k,6498488FFC2DF9790AD9BDC622297593700EAF3E4CDAEC5049C4067EEA1647A61BAEAA92DAC251FF04E7BF46D297EA5C99C235246027051C +348000,u,061F0549F48A3491715FE29DA3CD62CFACB01C2A2393CF71F0BA4AEF85027E0688B06D977A971DF50658E3A50F6A753E5434B06982AA1134 +349000,k,C4FF7CD83F15FEBC6E6B2FC8675B33ADA6BC81F1D0EB3DF3EBF8CC393A4CF872FD3440E7A0B18AE8C0BA46BB65EE31045CF7B02AA0A5D1DB +349000,u,BB25CED40889CC0829B924245E11F6BC27E5830B85462CD1C96B4C771D38B9EA88C7E8A42F90EDB4E107D31EE8B66D4640961CFACC23C13C +350000,k,07EEFFE1109B768D716DB2D92528F58979DD7E0B898013F9CF727CD8AB0A42A4886932CF6E81859CC07FDDF29537DFAC392CDCE4523C5586 +350000,u,0FA1E1AC0941518CD411B250A30A50C0991C3531E7FD03F65774686C8E9D9C31EE4C1AA73D2267032F520D7E7AA00EE23779E3A616EB1368 +351000,k,36F50F3D666EC75FC82DE07B10529AC243A0470CE02424259FCD8B8FC8D81600784719B2C94843CCEFA11E455AEE274838E747A0F11FAB7C +351000,u,5B08E14124247F39E9F2EE3DFF7470FE1CDEE57C6CD7EE569F3966312BC755D2A91050042C122489743BCF39D9C5E1C9EA492FEB6456ECB0 +352000,k,B69C2710D459317D55AA5AE93F344D8FF404E4AAD74E25B57F75502EB539848582170BDDBEE16BFA03D40E4513953463C4336053EE2AFB9D +352000,u,1E0488E22E3098103E457EC28C9AD9C13AC9A2F21C4E3A5ED59F537E1B256DD882BABE1896D979F9D48CA0AC2B02A07267F2A4660E97C941 +353000,k,0AD06F6DB2711290EB217F25D2583AC4EB849CD514D90D52D8A3CCE8B26295A34AA234869A12452B62397C60B931878755C8C17B6EF87248 +353000,u,7636BBE48F4C17763D7A7AFCBDA58E3E40B3FAF1D5F498F70F48C129C6DF3308BD7AFC8BFDE1E36C0DA1190B5A8C5E081FB63CCDE8646D56 +354000,k,3C45DFAAE84FD60E0BF4B467A1C022E85CAC941934F0C032F8F2645ADB0A467C38411A3C35FDF84735FB58BD3D91BC02DBC0725CED6138F8 +354000,u,7F8CE58A832074ECEF090DB31FC8C4EA0E2479E023418A97C9B55E7AB734E061766F3FAA5EA42427EE03B96D80D5181665621672BBE704F4 +355000,k,2F1BF7970EB07A20E9A41E10EC116D01BCE8CFC0A162E2C074493353F64F685A5EF6379864B455635B936654D78F61685B077BB454C37C9E +355000,u,B7D727EB02A9AF02FC5DD9C868D96398D5488F7DE8C2C9C63777319D72E5E88B8BFB8E4A1C5C63BA9BCD1EC2959403A927E0B5AF30F9A82C +356000,k,83352FE37F1E88490857E705BEE5FB10B7189B73894613D140672B07B6199005A0BA210DC45CEB1D36BDD674EC03E7CC8B30A4F397345F84 +356000,u,466809F8247885CFA7910506C58B1033B60AA86B0F1F44851A62B0F6CD107EF8AEBFDCBC5B991A0A7F79E6D46F6266B8C5763D30C09C8491 +357000,k,D07C21AA4FAAA38BAD357AD8AC4CC5A2C1C69F6B60F82ED4D93583665347EF4A725B7BD8AC43067F36FA017AEB63CACB75247F30376E64E2 +357000,u,ED1103A2F95AD245401C29085F1034C6557617758B0E6B65AFA113699176322DE6EE6C73E4BE991A9AEFD23BD75D11CB12FFD3C98D91BB0D +358000,k,ED0E04A7CD83966093F5FA1EB98BF3512F38E336B7D002551187B4B92F92EE0F066CDF3E6B25A6748C943EEA51BD114306D4040818542271 +358000,u,A799C27D93ABE811A0AD4B1050983E2AF5320613E02A65C5FBCD5D9BDB0BE09D5EA9BAEF1DF19C0225C58188B44ADE04E11B5B192DEFAE4E +359000,k,176932FE8F083D6B1A7DDC5B2FC9CA1E7F4155CC0E9B630A3BEA6C0169B8FC99979AC55FFF48665732CC3E222347502916029165F5679252 +359000,u,05666DAF2A57A2AE20ABDC50719BBFA6003336A268E19F8D206AEA57731290E8AB356CEFA26D57A705943F16278B1DE28E77DE46DAA60DEF +360000,k,189338BBD5AA1A37FD17EAE57B27C019B9CE50AE1C6071E665866158843C77C2855C3D87174FDDC508E893176042763CF1AAEC5C41E2F892 +360000,u,001F0BF83E008A20F61463C4F02EC7DDF9C3F41050795B5C66D6FC742E8408509CE34A2710BCDCE5FCD2B87BAF19B488410C1BEE422E5D76 +361000,k,0BD0199C566EDA6676240417BD3DF5D5DD504125A0DF5F1F5FA63BA508385749E9C8E9209EAD4D0F958A4135F625185563165BB958F45CF4 +361000,u,8EA8B4BE0A2852C0DBD6F81F92ACEC8E8A22FBFB05F57E54E9E1C7C68F837C13D919D67200D6251015D8F35771ECE6C58A2716C7B741DA59 +362000,k,E476ACFFC2F5F8C327F8E95F915E77EEA1E396E418C26AF47C8617E2A156253C7C15702EE1B4F9DD92DAFB8B1255D6D9C9756F449AB78CA7 +362000,u,4F0CCBFD49436363561E8C2755D50937052BCEEFEE420CE59C25BDF5DD64C89D060DC2A38FE03AC265680D4C98695C594F420274A83BDB5C +363000,k,49D171AFDA0F57288E160E19232B348C49BA72F4CEF09A2AF4FD208EE69D2E8E149C050AD36DC1C28C9619B5BEFAA0260B3B0535E323FB35 +363000,u,8B230BA52BDDA46E5A48DC878037AE04907CCDF00D3881AB45661C491BD2957E21AD98E37AA75AF006EF93C4A7B9155330EE3BAACB6E30A9 +364000,k,5B5AD421567D2F250B942425E69A928624CAD35E302E943B9E471BA804BB824101FA451072851658E62B5F2F7ABF1CBE487C8636BEA9A0E3 +364000,u,A5C0253F6E7FA76235C005357AC9038B6016C17788E730024E4AAD28BE8E3C60B4D4E3E156EBAB0E73B40A53A2DE29388D9E9F13509229F9 +365000,k,A889EC192393A30EAE4EF11B0CFFBEC683B53C0EE327A85955D9A70D86A779CB074479DE44175424C3770F5DA79D75B9A3CAD9BDCE18CB1B +365000,u,0C098D54DE6BB07A12827B34D568AF69EEA03B59FC80CB93CC7981C98471D3441D6954B3E140DA3EA2654444505292BA65766AFE7D10AF50 +366000,k,511A52DCBF2CDFE610406A038E580AE3AB230D6B3BAF6CB546363A87FA5EC6F0E4B61DA0FC345B69CD3893D75C0D50B59A7F28B4B43E67D9 +366000,u,E7628D044E227FDE5FB96D3A94F120FC58B32623C793483DE12280819FD2A2128672C84345A34F8A60A5172673ABCFBE4C4EB18BF9AC59B8 +367000,k,7377DBDED547C36FCBED03FDC9F6A4067D2CC83673EC1446C446D39F5C41C8C91B7A473DE44117D6EF00735619C9B2B36C7862223D44DD9F +367000,u,963AE38869DFD6FF24B3887A53950F0151BC6EE3758F816D590AF6FF699F8D49E99353DB4102317D5B5EEE21AAEE8687DDF594AF4124EFB2 +368000,k,75189259F407F4201EF561B0DD4E7EE764051369B60074015FF9DDCACAEEE5DF16F8F94D29888E6256657A332D05AEEB5A14AD667474370A +368000,u,60F31B7EB8A042487EEB25DD4C03DDD1FDB3282A847E8F6217E81EFE9BC0EC368BA2D9C2C1429F0D6421468F751A0DB58574D1E9575236F2 +369000,k,52F700BF24E6A7B45DD7DCB7F32BAD64750E2A2429D1B67273DD9C75B3D01EDE7F2B0FD002D6E37B19BC6B0DF5A1EADDAE11FF05AFC7E1ED +369000,u,B9286E1E88465F561E05E81758FDCC079CBB07199D0125A188142FE19AF09D6BC82037A411333C7E8834D923A21864A5F9715DF7F2867F41 +370000,k,71BC01EFC80A4144E2A62BFE4BD8B6E0A004DA6AE048D2167F413A7BEF9ABB317A3AAA3C394C9F6BABEF3ABF32B340FE2D5ADD36255038D4 +370000,u,573B83C1004FC97341F5E584F64C4178BAEB03F70863D745DB2E0D9891E6FCF53700A764AA06CF2F628E634D0C34C9CA61D7849FA5BFDE47 +371000,k,8F97BC0A954B5B7BDF77ADFB8A9DADFD88F42E8B5FA4C22880C80AA4CA1B8E458C09D96A30B88E9E265892CCF2589F0132619A9838F2BB0B +371000,u,BE134EE2DE792B26C6B9ED3F28F5A8A1B7575DFC065844D0EA33B005D48C659498CE87E88565CA6B76B60FFBBFD663F6069B995EA3EBF686 +372000,k,0859FFAF1EBFD5A474E0C445F84C6F89465E1410EAF71EAFA9BE7532EE0C92EBD3BC27DF67F02023A5C42394F2028A963DDFDF16D9887C59 +372000,u,E22D94A6D864FDB6CF90313641CE9B05B49384A99B34846C9E1DEE5385EDD20E4254DECDF6207401F2C0E9DEEDBCE57E180600845F16F3A2 +373000,k,465F77ACBEB7806D5544F09A7C8EDC244EE3360977F2C5EA084ECD178B6F8C5D224C9CFEB14ACB51384E2E184836A9BAD0E278B4432770C3 +373000,u,58BB259A75A68434B89AB30DA83831A500B7C6502A63A9A9FC19237315F54A5862BF7AF55A48AAD0F97DBA9BA4F67723DF094406F57417C9 +374000,k,70172C111A7007122731353C02933E62A403A9A7F8AC9E9585571E2ADB14F57B6115E66CEEE913E696B52CBB65C125543511B33250172FC6 +374000,u,BB31CEBD2BFD712F43DCBB050CC04F5FDE4630664D88CFB0BA7417F2F350EC47FCD41F05AD56200B2F17636B0F622E9150911D2B7F222EEC +375000,k,56B2C4B0B3E71E4EC010C01393272661F05CCC25682B62EBB16182032150CED58020A33FA8F12D3E9249CA64E06F4851DC724883C192AD87 +375000,u,7A7125878B7AEE40CD538AF54C93C1431AA3F3394777D717E28872912DC43E395307F1D32050D2E12D14CE4F81A45A220CBEF3668756DFA5 +376000,k,3A01B45017D0E6F36AB3880199264EE971A1939B0C15B7709633F8564C99569D1C16A15E01D59079FB7871A05917B468B77AF87EDE417C1F +376000,u,CD995BD1C4259F16CF833F42BDB3986DCEF4217972B635BE844E170E431830830F6ED8C71B17E65A75AA3C0C31CCDD43C326EA5EDE5AC323 +377000,k,E5A6B2415C5150CC1DC6FF3BF2361D2FC19DD2C53B0D9880D49BEA95E865823F7C6B598844D5D6863B89999D18E9F4B0D5D1DBE615209E5A +377000,u,62DCC86E207B0A146B7737B305D9EA3E966B91F096698CF49A4348DB190FB841B226AC84FA74392E32AF2F2A559A949C55D5F6C4DCAFAC1F +378000,k,C632C6F1E9BD1B65AE8F8152DD79D8520BF8909A590EB89BD57972CF81D1759DB54C4B89796FE959110C6F2BF430A7CD86968C9ACF30DD7C +378000,u,0D11BF226F217AFF0B48E3784A70305DEF689EE568F98024728CDB6F8D7AF3F498B1BCF3A2010A611732BDA71D087F45EBBF988EEDDB4B04 +379000,k,F46C04B52C2BAB07CF6C8DFE8197D14ED164B6D880F1232E324598E4EA2385270B4FB60A47BA2167C5C8CF5691337F170B410FBB5AD50F7D +379000,u,3EFB5DDB9E32D31986E826F6F5962703205EB7BB84E76AF57A6EE73FB137A1A7BF3DC2DF0A4F2000193E6599B0DD2E329BCF26EA81179DC2 +380000,k,860D1AACF895F1BB7C6C98E2DF253A4EEDCD371B0FFCA1BD3053414B7445931272816E30514A81B7E66C58CC7E72C18B349EF5B462BEBCF6 +380000,u,4E05BB2AEC4DEC50EF6E0E47D51429689FE012EF23C8D36F313D91C5B4BC2A1526F7108E42D7E0D51913A33EC2062AEDC2658AA05FD2DC28 +381000,k,948F740D5F8514A1CB6801616992CA450E36D3EA444AAC930F41E8D4EC22E0BA4140F897F80C55B43E9DD65F3E262324B83D08AF917DD284 +381000,u,423D49665ECB88F8955542F2AA274ACA2AB9901C8B6C9E7EAC915B5732AA72065CDF600261EC799D36FDFA5DF610416DECB70368E03ECE3F +382000,k,211F783A509EFBA6A28654218EE594D3C5F06EB1A9DEAEF36401E321C82AEEED7FD6ECC408ED7269CBFF4FF79D06C7017C3F9CEF9CCE2CB2 +382000,u,B3CF6BBA93880DE754D8E4591C7195EC5CBBCE28A13F30B000909D747CB09D7379121EFF9D10A4677B55E42FDC7FAC968D1F38721E0D2B07 +383000,k,9E209987F700FA2C479F19B798BABC19118A400C01C613CE94B2612C1EB66C28D03DC30E01E6113FF634A5644529058479B8730A81F69AB6 +383000,u,E3F2E393D9ED91EB7242BAA4D5718462076D1EC179384B6A9EFDE7A708EE92F9F9B0D7A8F507A8B70F45FB829A9400F41576EFD8AEF4F903 +384000,k,2765A276B784A19D06B8FF2ABAADA6CCE6D2F3BC26B8C63CB37DA84F81C2F95FC8EADD6D947F808389C2FE76AD068CE0A49BD2FFE64E890B +384000,u,87D4F85CDE3FB3EC75747BF2C2BF7B15D8DE99486669AFE3DEB316D544E9FF79DDAF9CC078C757178BCF5D49DA7A22983FEEA351CA9BA546 +385000,k,847A2C868C880406CC32375BA42BB2EC355EBB43B0FE8FBB8A56EE841B133C6A55D78C09CC0BAE5E708232B091E05EA6115EF4E2A0C7E1C6 +385000,u,49F170D6E47B352491A7A219950E59459C2B22790E5CCAA8B5AFD42842D38B474BD75929B6D9053C41C122A3E7248E53640251F3A67AB9AC +386000,k,1443D8D290C2D5EB13FC01FA8BC6F476E9FFD1D77FD10AE3182A50AD9941AE5AF3883EACF2917D9553A48D2BC9EEB2FAAEB087D45D5C989D +386000,u,B5CC2B62706D0E00D1D7C8800ACAFCD08E0D6E3CD803AC40460689AEA124828331F7F840D297BEB54DA01DADF5224C6D11590EE714808293 +387000,k,C0E5E552B4BEB9AC62CCB2650F92FCEB842132462287CAC0F544641E61A4984D3BE2907D5209C1DF1DC32B89953129A0A7F069E844181C67 +387000,u,B20DFB1B5C13C33DC81C2BEA3FCA9A6007ABB2ED9B7F709AE5DE4A2A844699BAE6D52E04C6FE530B8E2534BAFF5D8273E7EAB392D8D9593A +388000,k,68411AA0353DB2AA46CF9BA36128F82592BF8CA721DD4EDBDFA65707978976918E76A3C90B4FF743A4A846DDE42EE23A73DFEE6743A2D626 +388000,u,52B4390D5E87F516CDDC418C26261CE33D59AFB579BBB6A3C324597A86AFB0E69D91471A1BC1F283806BCD860FC7A7D26578CD3000DA2D2A +389000,k,49586C5223DC1AD23EDB9BFC9B585FD5B24822481B4D6780E8C77932B7DF5B82054E9BBA246F21D70E38C387BA50B7AD20FC1EA57FEDC138 +389000,u,1AFA4394E94E0BA293B36C85C6FC96AD229087244609795FF64DF052878132D866E4F5475DF0A40960A1C322A6B117A6AC0AF337D59D54A3 +390000,k,9ECC6554ADCF89E8716FE8626633BC6AAD5835B4051D67822B3069C9D1DE1ADF5B7B94124C8F967A06DE024DCED80D8DE81735764F03AFEB +390000,u,319F8546DD3E35AE50553ED49852A84DD085AAC0BDCB8963B073791110ADED2844037CE6E216071D92C51C84C4851B5AF2B7668AF07F0388 +391000,k,F28E91CFD71B3DC743DA7D39138F2098ECA6C4EA408920652458BBD30FC7445EAE0EE6E8F4F0920797270312DD6B275AE7C5F8E0467CA26E +391000,u,A9987B5E588A0CDD9BF9A1E1123683EA5B4730A8FF256E71C02A007849A502A0D37FA420BF2AC30858A6BCB1CD7AE5B5D39AC3503BE7EF84 +392000,k,6C61ABBE6494314E2D8BF1F8043DA3B18401CBE8E641DE7C19174CC6CB440251B9351C6D0039808A1578276A696E099E4A1DE63F8A2E029B +392000,u,AC37AECF93942F248FCF44E0E183805F01510A771B1FB083B5FAAC40593EAC7C1B7F8D8B0919ED3951881AD51F7603FA9F9DB9B14AF85BC4 +393000,k,095092566A0EC763EF5EE40C1E0CCE9D7D72C90EDCE35DCAF0263DF476C836EA29BCA806447C8FD8441716A36AF2AE18547737FAF49F9D42 +393000,u,0F189E0FA8DE42F0747399A54B39DB62825AF456F61810458B63094DF850262EC8B2518EBC67F1D8F38F548B00A3D91EC5B2449D5EBB88ED +394000,k,B8CC76B52697B468A20743788B840C1FDDAB6C576EB2687EC65409E651513FA2C907404076B205DDCA12E17D73142B891EBB32A672A7D8CD +394000,u,5F6BD95B74E13A20124BF0389C9DB5B9698A46622B1FD948F93C1A3F19E96C39CBE4592AD43A0B93430A683B1C96338D82E30B6E63EB7F3B +395000,k,96CC713E913BFB9B66CB6AB55C3EE6B174BE1E038814EC30F9667FDD04485712986D56AEDC4BDA7FEEBD3102C8EF66FF06CB11C2188C5441 +395000,u,51349BD878B74413308E604D698B195D49C9A912A68277F63F9E9618D269FD911B99D16613F36188A4252472EE21A9419F8BD2D1E03B72FE +396000,k,B034B2BCC3E2DAF8B64A6851EC96B54DD5731110A3BBCB7D83B4B746B257F01851CE39207E9C1FF407C53C4B40DC9B311692A9D48801B018 +396000,u,ABFF412A9468679DFFC176BC6DFD30FD278C68BD19551959E7C51EC338D69B1CA714608253BDAF00AFAE25BE88994585C10C42C8CCEC2146 +397000,k,322BFB2FB04830499947FBBE4C61CCD3D0722D28B6ECB746BCC7EC1BC07E9F055268E1A0ACE34E507A16E6A8C1F39A4CAE71A13E9354C17C +397000,u,3CD0A4FE5E23760B9D79A26B06CB0FF3DB30C76FA27BD652BC0F4B4AD35B0EF7CBCC729892639C4DDFDE610790C17AAA53876889C9167423 +398000,k,AC803357E29D5948F01F326BAC8948BEEAE66BA81EA397D03F2352D71003FD5850D8BC5CBFCB4C086B74B9A8C690C63E1CE4DB5569096B7C +398000,u,3E254FF49CF2563F33334A4036B20B44838080D44CE3EAA59B56D815452B2ED9556D392086587085441E49398625C552AAA6B509A2E49D0F +399000,k,4D352E9184C9526E59CBC62B06B61B79C3C4ED0341C62BBB6B88E8FE3B51F4856817BC1ACF5FA1AE568577EC8C5931BF0E2F034151D3A7A2 +399000,u,A9389504CD351A95471E63D72B03ED78DED8CA19D944F1464A78B90A8CED009934FCE6AC02F7D1EF2F695CEB6E1A0D89BF44FC999621C8D5 +400000,k,822AE5BFE694872E266098113D861F71274602A15068B0829F7B19A0778D407BDB8AAA8FDDFB9E434EC76D5D2328625D1FE1CAC21C1BB051 +400000,u,423F22256B29666620C6C791AE8FB92350623BEFE4AC1F9C9E2BA604B6E2CFB069F974D14D89FB4C5D99C0F20F2B41BC5B47979E95BF04DB +401000,k,0FC0033E0EA36C380E58D2CFF5D1B360E6F37E90F1417F82DCCD45E970A5DC2105D86F3E035F3C9C573DFDBA69AA0074E2E72AE808B32063 +401000,u,947922AC9F9D022D239B7D630650DE389BE7B44B79B911EC8EC78BFAE43E782BFDB9D23BA46C0C0A57102FCB7AE3D0D804E2A71142474814 +402000,k,AE1B23D24B9D54F54A7FAE27AE07E34F8978A7E10199A73CDB865C1D334F8B6BB532BB7E09ECE4EE862ED5DB8124165D520DF15A5B81E35E +402000,u,2A0CF3467B865F3540743B1D5CE159F482AF3E308EBE191FC0A74D32EC2244D8A491CCCB7B7E43D781CA9B4FF5A38195E0311E3BD1E5A453 +403000,k,FCEB2E00A164FF90741396C520B8451D908057F4F41C2F85D7C6075D19C9EB9AA104BAD14B36FCCD49CE39F5193869E6268DBF4BFBD2FDBE +403000,u,BEDB6684F07CA25CC38264D0C46A9B4E2548B25AD5C054E858810A83BE74954F3C21930E5A328DFF75A69CF3BBD83A0F77D1261F5971FB36 +404000,k,670FAC158B76AA2B07DBF8792429A208B8265A7EE254FB83FE777F34DA7C2703DFECBD32921CF1856197CABA5B3CC14CEDCFEAB3464FC135 +404000,u,63C7CBA44358CFA9F69D568577FABA4D616F3C7C6781B0F62C53D8D21E930CBED6F4D2A6FA326E4D8BB7CC0FA257F1F67C8377135638D119 +405000,k,950E1B366AC217FBB0E08E71360B6E7E200152D8D5832184A46D07D97BEEF003B89D2E2D806B40C04F9C0D7B554D717A7F0496874DF896A4 +405000,u,0B86B6365EBA6B72F21263BA0F9F805AC988A18EDF527AEE23764E5AC1FFCCD8F747FC44093B0D60BC065C72051B5815E14111F70F5754F3 +406000,k,7F5E17544EA91A01E5856D2AB7C4C6322806DC9204EECDC270154F1D18924199F165134BFD716A845046D8DA91B5376B89FFFDDB92761429 +406000,u,14B55F86A83E9B073CD8AD7F2E9279A71B083FB482A77D439267F395D68829D4A5A30C3AE694153B470907DCEFA3C63007CE5967CABD4DD2 +407000,k,19199A6721BA91F28DE3AC6C2212F37791D0BB95410CC4A3C654973C70DC2003D14F0AC7121726B0E56AA4F9F509BDD23C92C0053DD4EF3B +407000,u,86F261E4F00B072E58B9E16A7872E3D8322AEE9A43D79CB76003CD656729D59CB1F630F67D25B9AA4FE8CAA8A8AC5620FD7E7DB767617EEF +408000,k,9A48E3898E36D8701A0C1E2A1F5530DAE69070FCA30934514E685A35DB78A023A7DC23F359E475799C9ABC2BDB07C2DB130C4B3DDCE88100 +408000,u,482CD0D1C31E8722A7EA901BC00A5E067F595B028C4A77E7C333891A270DE9AE00530C34CFBB7C4715BDFD996EB556648299804AA5BD3AFE +409000,k,0AB2B827A701F49B16BF995C6AEC7C4CD5F59AC7B749EFEA489D1B8CD06F038B00A4DC693C42DAA023744A850A85DC2383F68FB7A362AAC0 +409000,u,6039F3DEE96C8BC3783ABA97F36CF61254112FB28812AB66D965FAF217BF56E51FEBE99A7B9A209DABEEAFE798A6510EBAD719FB4FAB30E4 +410000,k,C5345BC7E4823032081B2C3168A3B809718107BE5621A63E52A087376B6B09E2A32CC0E8872B6BD7F41BBCB8498828D4E0CF0D3DE4886E9D +410000,u,ABBA2FDB51FAE7BB77138273F4B97365BC319AFEC50A873EC21979D977C95366C181C9DB31DEB105EE179EBE1940938893CDBBB13154CF0A +411000,k,E51A12DC60DD6E5F3373DAEE01003D5D85F50BEDBAB1676BDFDF08489BD2D782934108DFA50C1C2E9F7174D5CEE2F30BD35EBF8BAE141A9E +411000,u,CFD08A0B4296E9353879234842EF29914189FAEF41D38470403F90281672F22A4F4D68C9805D30C9D6BCB6E89DFDE7A9A64CA1BF311E8756 +412000,k,1ECDAD807EE85CFE1D4AF8C3942F85BD5AC266150B324DABCD905F24FDE9AD6F0D4278FE42AB2D57E58BABD7ABFB9516992F35F2F332DCE2 +412000,u,22474B3ADC54E7414CC586D5402E745582D33E7307EFF947390A1DBC7B698200A4F7978F7C8101EE9A8B50713226F53E93423DF23780D311 +413000,k,11514B1BF89E9AD350CE0BF35DE814F1C05AE31638D31D253976C64255F58E1DF6BFE825C4CDEC6CCFCA393E48893FE3F46FE21BB24673CA +413000,u,B0C1711264C97204B35CDD2AAD704442FB850B58CBD1C6C08B83FF350442AE72E45E0FF64509EC4850EEF61404CCB4C83351572D91A85C4C +414000,k,87556FAEE3DFD45A9E7DEAADF1BAF9281E322BEBB0531B8F76FBBDB3C999AE7243B544073ED6280F5E3FFA9814DD0FD45B15E8BB08B3155D +414000,u,AA22549303E6D50DB9F874ED852DF9AA74E5684AFD0C7EBD97DDB15B6E4C423ED67DBA512786FAC93CF2B7024CF569F37AC99073A77EF7D5 +415000,k,5A51975FDC9D4B5ECB0985D41FA2DB0D41EEDE2E1052DF4526DCAC125BAD1F6C8DBE3B7318E30A49B75C18EA66E10E3AB72F61949DC8B44D +415000,u,E89386E9F2347AA117DE007748B09DC8EBE6813926BBD4A533A64F3147D898766FBEFCE73AC7464D222566B532A54FCCD2F5A5A97F3420AC +416000,k,C683C7BF46D4C1EDECC42D9C90C90066819430A04547188F4A4940815B245AE86440EEFABBF61454782B8772F9BC281F37C3275498FA6BC7 +416000,u,BEDBA0EF149BF2AE3048290424A29CB43E8725BA30B9AB1C83FF60215DD7A8A086BD986508722B22D33E87B144C7E4D87C8EF13F6AB62539 +417000,k,16D2D98112A5B461B4946299214AF3EB5E9500F2F16E643C7290C8C65314728ADB210B6C6685F5DFE91DF12681DE6B1C46CE974C0CCA849F +417000,u,87B9306B65A6AD24D9558436DEB4CB9546F0C4766ACD06DA9B53327904CA26D8AB3CFE847619F7816F7F7737F82DCC90CECA7C7691E40C58 +418000,k,768F23C6A02E3FCB1104FA21DAD99D759D17947B14FD7176317112251D78D1C828CB3825EC000482A2430AFBFBC9F59B680E888ADF1A5071 +418000,u,4F22955D380B561F65E89018E1634FA3335AFD1DB7753209FC8F71866FCD48109AF1BCC74347D318803E3187FD009C4349D8E2C7B23AC8FC +419000,k,5D42DB5F014BCE09053E0B8EF1C2A340E23AE66DE8A874951E8266B33668C2D2D39F93BAA59F0FE727DED408B651881D554766AF7D562199 +419000,u,0864857F618851E9C51D9CEE4F1773C344D61912EAC9CA3E99472F31EFDD96838E2EEAEFBBBC434ABB987A57845BCA01CA55D8D9260F7964 +420000,k,A1E3E16CE91F2BD224AAE4B8496144FD97656C47FEC5DBB1CB51FFECEBBF9896F8CACDE7D7EB602FA8C04679DE26AFBA9219700ADDEA5C9C +420000,u,8C08F5B72D169DECA44BA183218189F59F3BCD81756D120ED135CF0FDDD0AD49E679877D482FD3E4E022DC5AB7471F1124BF0BC0D91E9FD4 +421000,k,C106E691E415D12AE35187F96F244904CA43AD42F30DC4528A9F4EB4B26D137E3018B2B94F770D8C3232EBBE72F272437B0D9F7384B09038 +421000,u,AC10BA86982674B43DFBEB797DC42E03960928FB16DBAC6250C6DF827C7E78CFCC97FA069805CD434533C3AAAC4B123BF501D08C8FF56253 +422000,k,6BD48142EE7D42DB6CDE1E55063D0BF1C65667AE081E6340E3F71ADBDAA89D49861580CBF256CBB437522FF8AF2956DB67B08B0164A96FCE +422000,u,A13ED143A028577BBA4CBF27EF37F76DAA3EE62B02D567F4D21E46E072E5D4E66DAEA5696DBA49C7CEED86BF2554F5C50D138E6D07E62487 +423000,k,1DB6532062DD531B3D258C32B8549FA2DF099E8971524F39760CAEDE8CA8658BFDB780EABC16E33AD8E411FF19E2D2B5E0016A811E289503 +423000,u,22ABFD0D16C57A795ADEAE337CD199875ECF445848EC5C3282C9C853DB2F84530DFE664EA9E000689FD5FFA1B74C82EC5AAEF2797D3F2767 +424000,k,2A5DB3C579A155CE23853237D28B783922E6F7827C6084F3B5AACCBE9E9B95AB758902FBD5CDDBC8FE0F82C92A44AF1237301B6FCB6E1F45 +424000,u,C4E9E9F674BD163409E166F495B074E0F7F1EDB552045A704C4B3B3B492BCC6B3CFBF3AC0A17BF1EC91C76955B2B8B93C3E70807ED11BC11 +425000,k,CE19A3C4EF390452B81DF4FCDFD384FD769C7A320DE69DA99A2CC89B156A89066FC4EE14331C87D6463D6CDB78534A80AF8983504CD9FAAA +425000,u,DA4886E1F69AE081D7CE77EF5F466B9948E13DE7BB7D1DF7D0921DF93CBD75611AD74371DE460892782FC67468A7EBEBD1E170809885CAA2 +426000,k,09B6937187F8A5F8913F0D97A39C493BA7855CDA66C390CF8BB8A1B4F3D23FEBE433185E4002E5B32D54BD5C199C757505900B5108D63FFD +426000,u,D4BC975BD85150E7818ABE6B1CC33EA485B9599C81DAF7A793B0574D6AA94CA0DBFF60534D99DE984FC62DB5FB1929BC88A9F84738BD8C4D +427000,k,E62C39359209C5FE98D0F6567BA50F5332A608EF0B37894EEA0FA4497515BC9F34F510D10FCB559BAC5DF1412C18E6DDC5C26DDF3BF9A801 +427000,u,D0F294BBB4A7D5CECD4CEA2EB2B01338D8DCA7E8E902769615DE66FAE8FE1A3F517B358724913C51CEB05C99D9CE79BC7DD9BB8AB104E6F1 +428000,k,0B6FDCFE48170F1165318EB8A8807AC6B09648411512039C78214B5E1C41AA23532A7F0E7B8D5875F5EA97557E1A211D876DE74E114B2DE1 +428000,u,5C51811F79F57C96E92608D36904367582D2973ABC3965BE24B12F060E5F6711E1E421AEAB12816553AA84B67E0654F44F6694B4F3429487 +429000,k,672F5D807F6194BDFDB43D025B45F99BEEDA3FF75FC1921CBEE5886F334F60BD97190EE42FFB0DD386A072E3F162F9D21D848BF4CB08E2D9 +429000,u,9B7B29E2FA176FF5EAA0C5941D1891DCA8FD1E6F0E7363F4D3ACFBE9A68FD6FD1463E0E996D12F0736ACA4CD0697D4A54EA699B118B29343 +430000,k,E5328484DC3A7DA176A94EAC322C99A5256C4B489870B944E17DEEC8212D000984B3D3C26E4405122949A4BFC822AF6640120260031D95D0 +430000,u,23860508000E0D0547AF18C0BE88BBB091978ADD9560E5F8E90D57E46035CFD546870EDCFFF85C58F0242C51EF0E46A3E68D96B31E7E5D0C +431000,k,6A2E53BC4C90F85AAA3BF23FEC1716FC2985DE84E482FFA360C29A839CA617FF0E735A93B073A7D93966663FF3AFB489B8EB1D2415D19D8E +431000,u,B44F2DA77943ED6A4F8F7850C9072BE339F45F55DDFB5CBC14085C455FEB39FD0DABDA693AC854837C1428727CBDB2B589DCE56F15C265E3 +432000,k,87ACB6D2E2401141603C652A216597AF718CB8C07713071580D2D09067CC1E463A85551C0758F202B7FDFDE6636CAC6800B9B7851B4455EA +432000,u,63E2E12C57933B79229A4F3FDE62EB25FE5FABE503A218EFAC208371CE6DD8D41CC98092987A90FF238A1834F52938621C43A8E55739CB37 +433000,k,1C7F34EA08D3B229CEEAA6394C78A9E7A7009EFCC10DC3E4B69A79D442D4EBB7C27E67C2041FDE9705CB87CCAACCA0DD7EB30307AA121561 +433000,u,44B79D64CA217AE3E01E985C7756333AA3CB7AE485BCADEF3003AE7E0B16B0C7D87F0A05ECBEEB91B267005874D88225EEBCCF6ED55A00F2 +434000,k,4E62B222B948BBBFA86FB79C9BF0722AA6451666DC4D35D7AEEBCA822CCD0C8FCC93F1AC4AE775BA9E5E3CCCA30DE845005B8C35B68EE6AB +434000,u,036EF9B1CEB3DFF7D4D55BE85847FFAE4005AA0AD307A9E19515A23A0FD0D558F1FFDAEB8E4C477BEBE474FF249DF68EFA4F2303683093BD +435000,k,E0E70D55F886FDADB07AAC645A7C7DE72514F66C30AF8FADFA1FD5AAC14FDCF320FD8C9467AC2E40D3CD1E640E9CABDB2B37081CB7531E53 +435000,u,3C50ECC0EA33BE06434788C0F79439EC38EB7C715F4B2E5E8276A5958E3C1492D1AF24961379D669B5A7C42776728B9A1721F0EB3F3B0A18 +436000,k,4B5BBEB79CED3FA87F58382F7A17FB476A29966781612838E17811FB74865069A535621064B07D1C6CC505E5658F77F7722D5605D02A9A07 +436000,u,640798F53B4BDB195E0E3E574DEB590FC0A69C4892A5EC1092919FDAE0FCF433F4CBE88551D3CB3716F631671278BE0C6BEC4173B028909B +437000,k,8CAD83D7806CBB0B3EEC35EAABBE70E484A360AE0DAD7CF04865E61EF6E2ED33B362F556C3E57D9B2F622B05C4FB6263C980ACE43882F55B +437000,u,1F6386327777021E2807E4CCB790859B977F05C897644B03568F9A386B547AE2D321FA7739811A9D1F7214487AD15D2460DD15F5DE3BE448 +438000,k,FC9A6BC10F118FD258C676F9E32835D4F2D218E7CC23C489E0DED481814C9EDFA8588B5A88C34499A462394C6BCD377719B93D3E8B4E192E +438000,u,9246A01325F92AA116B44BE2E6E2DFEA4768FE2BD8E0CE214E8D032704E42F6A1BC6240E6D806095FDE1860DA0F9FD03622F6327859352CB +439000,k,57944D7F7C204569DD1C21423CE2554C035EABA0AADE926310A3CD5E00691652916A6CAB1F7CD58F9DD81312054BDA296862D123AC4D181A +439000,u,F87DDA6D78FD4737D923F9254AB0F2E492A68BA55EA51B2E8AC0A7FCF8DE4036E3BB7A3419E423E28F783CECAED011B210A4F4C99C572589 +440000,k,53B1961FE79DD1E9E177C080B6399104A9F5D4306DB5BA1175D531D061ED2E8A1A81F7DF9E5B7B5AD312AE2CBE75317F4136E89F94C2E718 +440000,u,A2C30F58397B780EDB21FA9B0F8CE7F1191496C8B91FB44B24718964B999E8A5485A478C95D22BD35C1623A11B2731E8C56EB218A238CEAB +441000,k,E521C630ED4F02401B6BCB22B8441B3EA595F204A0D5275565952E2E49E6E71E9C34569A6CAE42DF1E25B6BE8E83AFCAF231A502D7DD299B +441000,u,4DEF66050A4D5CC825F69E563C1CD9B7404C05A1535591D4FBDB728E42D6BA874798FB81935F1323DE2B741D471D540088668A88C0FC0F39 +442000,k,BFCA2D9DA552B5AD1A5867F31425782480B720597A7F13F725DDECB35AC785E0404A9EA8E36C6E615E93A369FD6A2C3F5C4D4F07D1EE3953 +442000,u,6AA9317461D786980C9F9120BB011157BD460A89D2AD54BEC000AC201074CEEE5DF7CDA22E0441319E5E74310CDB83C8C60800C7B5992ACA +443000,k,9298292A135A36C3AD7256635581878161B5051F173124F2DCBF8C92839FCF848DBC999EB171BEBFC8E4D9754690F5F7710E6A43BFED5228 +443000,u,AE336DE4034FCB53D250EC85BB41CD5B78CD056A10EBE7D6118B6AE6D67CAEC304C519DF18D21930F6373EF58CA6553E22C4FBC93A4F29C5 +444000,k,C1E681CEB4E75B072C694CA4B9E5D8FA1895E8CD8AD3BCAF61029077B3E01D4B843FAF9A993DD1A50360CF69A6B311586FA6D27C388EDC20 +444000,u,1828E3352E9E0AF86F41D70310268F051F57B28AF4A270E88CF64C723B6CE2364656EDFE06176ECF86208DF9AC8360BE8E27866701DACF70 +445000,k,9B564D2BBE0699A896CB20CA98A3DE2AD102CFD8F52CF0B4E995A9D32467ACCB838BAE4D457BB140D7B289FE544EF6FFE43C5D727837FF26 +445000,u,00D1AC1B7A67EC75F14DADBC34AAB797F8AD6F8ABDE4C91F9B71511DFE084353C6F42D3D34B0B10EBE80A079B0C17C4A1CF65892A776F793 +446000,k,2DF63A39E0AE7B06942BE2CB68B125834B102A65177D8FD2122D16955E1D7B416B29487DD19FB7BE1860D090DD0FA84E7344EC5F5FB2F2C6 +446000,u,F6351DC998A896430C1DF1F260D1BAAD75BE9DAC7A6C8165F2E0F8401AF14A0A7C37F84388F4A8284CB09691F0C59B319D0CACDFEBB89C2D +447000,k,61FDDA21117A446D96F8B9E29AADA07E59346511D31DD9B1EE55E49A30AD1733090DBE0142561550F1B1DC4F6FADEA8671513D94AB677A88 +447000,u,A04B19022E63898EBBB5486478AA9F4BE9BBB5AB7107F3A5D6A85DCAD8D6D3392692B1772154736A71FD043C0882741DEA1123CCC0C78438 +448000,k,106839CA9B41BC35279AA0863BF8B261A87FFE9B098B2D80780BFE7CC671385A26FC486463137AB4F28A67ED60F9F4C276949234CA848962 +448000,u,A2BCA5D2773A11F3AC0FC9ACBA6278A8F811D205A7545A06D42EA36D86F1239510B2AD5F113DA33A8438585C63D1FD7FCE0DB16CE658B95C +449000,k,05F00C891C9316FD62F79C9E5CFF9C99F007FA7E14F092FA71359B7799795BA2FC17B65266D25551FA14FF33E6453CE841953740FE9082B2 +449000,u,3CB0D52CA2BEA0BE361CA7B64894A361CB0581E0103AC9578F060A067314BE0B7B7B7D88B4EE4B25009D2A889B186BD84840BD1E29E26FC4 +450000,k,7B3C00737C8234BA43C76C6B9EDA1DA23068CAF89CB3356BC9EB55109A7FC48F497086401C52DFEED1B16000B81BE6B6829B99361AB255C1 +450000,u,EC813DDFAA79FF0F51E36BE1ABDDF92354E2FCCB4CB27CAE72012F541A6ADEB916FF636930532F3B495D7650095B35EFA3AC6DC7A16D4682 +451000,k,98D4500886AF8D13109CFA8169DBFA3A2B5D6B8CF62142CBB757040CE6D2C3C424468C8550B4EDDF8B7E463848A21408299E142A1F94DFCB +451000,u,8C203B35A4C77B9710EF2537F2EA66104C7AD7606BA4292208ADAEB4855CE73E40D5A7950D23CFD1CF0B70FC79B71A08C1A20E85821DAF1E +452000,k,7957BA5DC3F000AAA6F70A353E8E465D6196A886CB65EBB8A8CC9AF0674F1CAB0D56992FAA031E79A1A621F1F46912D1C4B6DFF7A9A198FB +452000,u,CF51143AB9CF0639648723C36E383C2DD847262A4E9845D21F10DA80FF168669DCB248C3A78A662F3643060E08DD5CBB2D4A85207F886288 +453000,k,663E8219403CB8EA2B83FD6C886FF5697975D44ABC9484912504A9CD9D59EA56400975016008E7AD2C454964DD20D697906DC274994839AE +453000,u,98D6D396CB8839FF6A3A938D44325AC32A70B4D0082E4A4EF015234103C168E20CDAC675EFB7D3DD598D11C1D625A0275F357A4B1C3E6E33 +454000,k,F3DBD660437E5C2CC9D3ADEEA4EB22E60523E2017238ADE263719C1BC5FBDB2793783F7C90BA5E861E119BDD1EF38A9B0F414EE70B6DED99 +454000,u,D01FEF6D4BA56BA60D3AC374D501F79D6CCBFA130C16C2ADCDE445D9724A704AF55E076827116DA98F5D80155C06BD3FD97FB8FDCCA99862 +455000,k,D203686BCD6322EF4A59004ADB24F3E47389E605FA3B263EF22636A44F2AB23C702A06888C96EF868E19BB2B48236E7E5FF7CB0A56059A0E +455000,u,365A4DD3DAE4ADAD466642EEA8A2545EDF7194CC475106FF999839A0C1C0E04C93E693C3236CFB95E8E93FE0B51B0A48515A6380310470FC +456000,k,D6F8488B747DD02A808E83D759D59D4F022D60AEBF5BF8BE1C4B635690D901054A541EA4727D42AC2A5FD76DE225611204C1E1BA5FAA1A72 +456000,u,904895B82A089C40602DA1ABF6069C00F29297EBE1FCDDC67975336A7654C3157364224A6FC3EDFDEA1FBBFEF8DB776E244779417DD0BAC9 +457000,k,F788EE6E3ADB7262A206E7E269472FE1AA7E7BC6A4A5075B934F85462F1BDC8D3E37D6FDBACE584BEABD4266451FECCF607DACDD31FE09F0 +457000,u,BBA543C6C6CDA359B8458946F0E03E31D3DD18D1B9C65B89A7E5D54760F494CB56965BE23756672452A497F0066C191AC6369B501E9947D6 +458000,k,1927EC3663D20F36C9393A94EE23D3E99C017B76076D012E510C28B84443FC8B07E4BE924C7682ADA3E95527A2A603575EBBBBBF37DCC511 +458000,u,43C5FF9D03470D231277EC5BE975144C0ADADF1423024F91821CF807624889F4956960C5A907562643930D2BCA5575273516342AA83772FA +459000,k,98D017B6B56D206485D6D9B2AE65882DE394F7692BA86C0E68B4562251D169CA3FB5922E9122BCD4BAD1A8FCBF58D8B4625888D36FA3A203 +459000,u,4AB43A205BF7A8C1E53FDA7AA14E34EF2B506B015D6F7EC15973F323ACE6384367F3C8EF86A8CF3A50E1E545EC6582FCDF76DC821A3192F8 +460000,k,022E3586468BA5D486147632E8E36297BEAA52D08A29B37D5ED9105F7ABD51B7D7300970FF65B378F91C5C2A11907F9AA1EC6750A77A7F9F +460000,u,88985C777F82E76FBDFC9A977EB88EABC40B54C507A668BE87D5D2DAE529889240307990D04677996AF72C1742F7D0C5BC13905D60F0C638 +461000,k,0F659E84B6F207CB4FD8CA495E8676D88E8D6C41D6283416CDF1698B99527A48A28B15534C50A5FBCDFEF42A6B258D2195415A4986CDDA49 +461000,u,C30ECA600C7D7D5AC31B28AF8FEF107D18D505CC10613771CB9C0B72A7CE96F6CE0086E6F153EE171F332E75E9B998CDD1249985F3F5A571 +462000,k,7AB47C7C3A549958C6132A6C8384A1943E8AA22885BA50AFB527B830679C588803889218B831BC5FDE6578AF6424E96FD845724D2320341F +462000,u,A16F00FA1A5490F6413F082C6DCBEBC50901B76E5E13574BD001A229700F389F5BA97A7323B77FE0B5CD2013EAFFFE065ABFA9D2005DB073 +463000,k,E67E98EFBE2AD79EF2CFB612064950B668A1A21366436CEA1135982F0A66032043C787FFB4EC41E58FC5EF7091E998F4E25FED4BC36DBBB3 +463000,u,6E7FFF04851BEEC3C93041CB043241BD26A7F900CA3A115ADED2438CA11CB01B6E22C77BD176A744406FDBC321666295334572074DB72AAE +464000,k,0ED9246691ECC68002B26553695B6754B53CB217E09B9501F74D1248F2539229EB129FFCF4D95AE3D64937E160633D7BD10024D35492B384 +464000,u,4AA2436C3D05E29EEF196D35EA5A422F23B207BD6575F07F6111967DB16A00659C4546743D029C8C43DFB608DBAB186DDC36D92BD599FAA8 +465000,k,37F2B169AC3EB61BDD132197A379E1F6ED51F43C11BA6DD82D1AB03E4A2EB0B94172F8922C16F19207F3062EDE18E91B46E7DD7406E045E5 +465000,u,E9A3C0BF62FBE87C951207070AA31016B022AC2011AC6C18D9D0FF9A892242AAB8E4BB914F848789D2C7F62E4CFC99B9A72AE2AF17BD8BA7 +466000,k,AA0625DC8DC66EA7ACB8705A650107DAFB6E9183405791829D6D30DC2CA6212B9D2A71B3E29157E650796E4200064C17B4B2BA4F7587F908 +466000,u,D4AFD5A19CA2CA8A6331C1594EBA6936BFEDE8EB959A7B5F859C7CD6F8A29ED8DA7CB0164BC2A0AB8AE1BD16F7CC1CE233F731AE17B3167D +467000,k,F0F6FA611E9C3BD298F1A839F641AFB3AE566949A5DD681FD4338C37DD386F77349586A95F05AC008DE66F0973310E20B3853D69D518A39F +467000,u,7CB7D04171A615DF7CC774B7ADCDAD8E37EB928B3E2B02BFD7174DFBAA771BB36E53771DDF779B769760407F8E8A31A069BEC0F979C9951B +468000,k,481C3AA559EC0CB2EA211AE571B878D6B86533DFB3BDE90E97445C51E9E7E669F564FD6F0F8FAAA1E74CA58646E1A6255ED9E0D5A0F32041 +468000,u,C2561B171342C8FAEE092F36EE72D29555A87279BF6E1EC0FA0EE05C08800ED69A4E0E19A5BDC5F0858CA4D4E79A925A9596517070B86CB8 +469000,k,F00749C129D40E6A5805E79848DA17DC7E9FCE808FD3001C2347AE9CAB8FF27269AA35B2A5821032D3849FACE20F33A17912B47B980F418F +469000,u,168A014EABFE152EF3F667F7AA770EB8AAFEAA95BDD08F7C7947833FE9D8133D58E2265976C0C3E5C30A6D9A57593B44DC000FC10850465D +470000,k,6B33B4B570323DBE7D52B58CAB7A78C0A5730317D29A431E9FB6F58E96E8D536DC231EB1FC8BEC5081FB4CFB18E38BA4D79CB9E228B74F26 +470000,u,B49CB4ED7C2A06C03D33AD07FA330CE55D8D9CEDD69BF0DFBA66F5CFE76DF61EC5307E572078E57740221D49D992C82BBE09BA148B1D749A +471000,k,309D9AA30F67B36506AABDA49C5CC8AAC9AC089C28568303523F7D0B8328A78E95ADCA00B79EB5D94BFCCDA99176E35BC411C77D099CE5A4 +471000,u,18C292F726C67537C24CBDA65A9E1F17896C3CEB91F861FC48E57DBBECB64117C533195BFEC371FCA3B2E25B5C8A72C95899031907434B6A +472000,k,3B45C20B15521D5CADAA060F1DD0143AB98D9253FE8EB472F9291B508947F40975458264095E8D4B3414153AF52E00779CF448F497F47FE9 +472000,u,6EF50E14CC2F7F862FFCA62270BC84C9A6D883D74D63057A8A01E3A9DAA0192A49885D71C78480E6285ED184BFFCBD31569DE89FECEDB346 +473000,k,FAA9D87239DAF6AD737AA8302F0D9DEB0490D38E2F417F81779AAB9869F8C9AD4017DC8A8670B85DD72244610D33A9B1C4EFBB595F8328B9 +473000,u,7143E99EABCE0FF3F348D6E13F86107E54059023F4D7BB3909EB39DD32B16980DDBA077E17E217C278C81E0C75CBD6FDB549A5CB5AC6F9DD +474000,k,321E5689B8782347F762068C087054F517A60E847BA4564BC7ABDDFF155B7BBA35C1A32E8CB7642EE6C819A49965D242427C547EEE2DBD96 +474000,u,EB799533EC4A8D802C774CD9B0AB55A9C4FDA36185E19F6149952334C6828402635FBC90AC30788A96F7CA13F0858E2B55395D471B5D7D74 +475000,k,C3D2DF4E769C3C1359F1CFC12E0DE4AD1AD818021061FFA6599E4BE43C8B0D5A1672BFC5D9BC61B53F39EC2E50C3BA1883A94B3EE065F64C +475000,u,F3A608E8C7B9244693351471E82ADFF53EB2377B39B5D5F25E54D2E87FCD7C1E97011ABC3DE557DEE08A2187D0AACD6E2805C382218F24DB +476000,k,FD731022398249B0A8EFE72EAF80125FEE1A46E984A377D13D307F8AA2A564D3D5D933AB4257C0EB8BB8F1645EF81E455802FBA66969D6EA +476000,u,6BF9C87AA214DFB6815C0F73493425982F60E551F3711690DA645F59135435AE75B75A3F89550AFC90AFDA1B8AA0E6C284D691EB47BC360E +477000,k,E1103CF1B30A54E52C61F6C43F9BFD4368E43AC8D0D957FB8EF23308681355726A32C18D607CCBEABCA5725FCF6B7A326FC3374BC30721BE +477000,u,0BD9D2C03437B4F13810274000AF3FF51F86089EAAA79309686DECACDD8E18274FBEA24D74189520A0BECBD78C044B40434C726584C7EFB1 +478000,k,626ADE3CA7AF881FDC209367BE9C97DE2438C4485B844B8EDD55A08EBEE62223CD20BFBFD369425051A1F28F3E36DC8B7C7B98CFBD657CFC +478000,u,8E9063095FAE92B879B8EA5A514A58C268D920A681323E255C6D58B1995B16B98A50CC4E20B725D61464ABA2746C4BE846B6C8BBFF2328E5 +479000,k,975EE5A6DFA1DF549892B92D04F03BC51A4007BC4E6A2E8E8EC3992F89AE1A62BED673684C74BD89B0B42E14D06D1D0525A8F4E195764B26 +479000,u,A8B7F1C2CE4A36AD7A5872F39EB94CB019350FEDB70762AAD338D8B009DB7B7FD0C83B98BC70E39D634F96FCFDD54C70E7E74A6ADD1F2E36 +480000,k,49BC67180C6B86989499FD565BB8D977CB57FF820139590CC479102B6B84C507C195608EB3698654218DF447A7CB196D3C2744D8F3AB1293 +480000,u,3E8C43DA54CEAA025F533BD12C656A3B2AED40720C73B445516073DEA774DF1649DCF366A837001E63104AB8B97392E8E825B773B9B3D0D4 +481000,k,EAA7996B7F27A0FC75172B9016533BCF616D1514E222E8A20037826BBF5089030715041281AA26D37E7F3A66CAC6BDB6C787665B94FF598D +481000,u,368234B2E9172230A87E54B88D980F61D3AC7B86B400723DC53437F61A95A4E3B4EB91356B6E132927189C932721775053FBE01EA3AA3864 +482000,k,A1BF6382B9BBE5387AB0D2E8E4CB6F77BC7CC20B941A8C6964CE39B1796DB0D17045FAAA7E2BEFD3C2738928426821DC4028C58200B19779 +482000,u,47F869837BFAA4D452E8D4C53F47E41BDFAC3198EB853400979A7214C5F8BEB09B32CC551ACAC2DEB614C959304A318B84692B20BE657B9A +483000,k,2FAFD54E0967289D1413C7D23372E82CF388D0217A2386C5FCCB2298B0264BF40031985DC46BDB77748CA0920672E574C9C84E5F45001D17 +483000,u,6D307D085AB589173BF86B164AC4B2312C2C9AEBF381EA435B26ECFAFB634366B317A3C1C7C9A7E74DA485220B1B7DD3C06E6CC846102F5C +484000,k,1CCE2EF00812215CD844F7878D2DD6B8A40F2BE02EED2D67550EAF53D266FB7820D3A32A90744481A20DCD1D70B7B8D7B6776C34E0F089E2 +484000,u,4EDBE64F3A0DE899C6DF5B78840BC53C5EA8A3A1E4FCFC0D44CA987839DB2D23AD8EB2CAA235BFAE1E120C5C7D4CC62EFA62D266635552AD +485000,k,EF0A612A337C83589E962F1CB1A6145AC4082DF786F30342F4EBF2BA907D2EB592BC05EED88E661C843A2B60DD51A1346738E40C943289C8 +485000,u,3907E1F7D936C364F28BB2A0A3FB95BFFC76BC075F52AC283366A8D193AB8869AD61EDC3F36EDFA51940FE09E85C398901CA29615E843514 +486000,k,C034DBCE20C12E9C9BA8B16FB58BF210C297498DE5E1CB472774685804E29C25D655BDCCBAF170D9D2A9EBF78CB31E5EEC3474642F8BE7C9 +486000,u,FFD6CCF5C3578A75CD54622A22498B4C270659416A9869388B21C1BCFD31A431B53F364F7244773CACEAB839EE23F82301ECB562AE3A162D +487000,k,4B5C5C66FDD216FACBEF8631A5E3E0D62EB4DB2456545E7D740ED41E69E7CFA9FCFE2FE5E2799366A61A9239389274D9CE0C0ED4F27CD79A +487000,u,2E27F1AEFFAA8E9078D929FCAE42455084694B56D9411FC8491B592566B7F690A807242A23B1F5AB2292B5C71A7642EB94F2AC7C4337839E +488000,k,A0727E3AAE00527D369073A9740ADD43ECC34C8FD1DB110FF4AC6908A255849DFEFF5F6586E874A0EB2C0FF8913641E53AE8BC6BE01D5DE6 +488000,u,73EDD6D2E5638904C806662AF4AB0BEE3FCB011189CDDACCDA3815D54513160FD26B9BB1BDEEF2F88CA922F04B3084CB24B68C390AA5E214 +489000,k,44E98A1CAC2AE3DD69BE318A9D0B95D3647EB842F7661C28902B274FC03376748DAFEFB319F5E86E8438CA04BDA34F69F30E4530580835E9 +489000,u,23A85910E7DBD57BD028D833E46022E0E97EA94629E2A1F9A558297F61C1BB9082B18C8782132C0FDD3A8E5422AEF8BD1C5F0BEE8F0D1CDF +490000,k,2E63D6C56088F88D0D8A2F0D7547F90273128159C0B6BEC0FFE3CE718690A42919018B6838FA72D0F84B7932043D2C98EAAC2AF9E8199B24 +490000,u,866894788F2C3DFABFF5A3D4A3D1A171989C6575A9462B8E688EE831DFA53427FD0E630F9423E3F542792D161390DC7386043D98C5AA9A92 +491000,k,73B4B9F3A45329FCAEAA7BADC161E5BD6AB280AD527323008053B515B326AF40BBB98F2E9A029E25071D822A5201E10C19E9398581F4E8AB +491000,u,1C7F18CAB149EF33CB0E281BACBBF96666264D929D88C7FB89089093D802AADC2F63BEBC30D5CAAB77496CF9592BD10E9F17E54079CFC30A +492000,k,F93B3F40FE721A250A68142563D61F5FC3F7B7FF9E97A4684EDC82A9ADFF3FDF361EAD032D4A6EC330A9A8B3EA7BA917D03B52A53E6A8534 +492000,u,191CE27BF053470BB9C5AB8C9D21F97B862EADACA553CFA0672771515144DF7605243266E5180181E998A57C2CAD1056686F61D23272BF01 +493000,k,CA56F843B873363707AADA4CE2EFA15223CBBB3FBA3D5F2365D75E69DD020CE000E9F0E056953413163F93C03BB2D2154CECD13F2153C30D +493000,u,17FA30BE1ABFCB7135BC2D0675D94D75250A7783E836C97E29F77D0F5E351292476023002FA757B5D760D8794AA8EEBB66E377B08081920D +494000,k,052AFC3639A1A234582CE3ED42A8A45EF31B55D50EA23A1BC7A7FC0C836E665A11244011EF58CD2303ACBA1777E60976FC9512DF79876748 +494000,u,B82FC4DC539BB6B1D9BA56A8273C2777AFE9543B847FACD55B47D318B98E4E74514BC1036803915588D8C3563F2816E0ED13AEB34EB05871 +495000,k,64AB2F751C0CAC7074981D198ACC0844DFA417BBC49BB8330E15A67B5866C4B0EC56B14469849380C39043BCF415C060EDAA438F63F667B3 +495000,u,4D5191F70A5F7A2F8DBA16D4230078894FC0085DBBA249F1530BF893D4C557150096BC293B523EFE33C49B5758AF0305DE7C2D9CCE7F20E0 +496000,k,D20DF0290DC6456F06F86373D6219050C433968E8665D05F9BE4ECD4BD644A9077608FC71921B937671877BE6424B25CA5233553FFC65F60 +496000,u,E83F64B4E85B93FBB9C769CD4CEEF3C67A15ECE3216B3928A6591357A835D5B40087FCD0EDE0151A6D854E6646DD5165F2BAF9D53A461784 +497000,k,C4314B91A02D6811127DA9E63D05C312717D20E59712D14690F3EBF7ABC497812CED1F358613DD0A60208022D9A43625FFD62097F56EA3EC +497000,u,4608EE684666EC3C60340FA50B09606E66E44A0AEE029A44016923E8258ED31A511B0062990EC291C759450835FEB2495E74CF6B9607B113 +498000,k,50324BB0436023C7211C070C15B30C35979DAAA3A8B04CBD2FA428625CFE67747BA7C0080C401B70D1E90D490FC6C25F590BAF1C546BF31E +498000,u,373C7662195545524CBE9EBC0933C90D056DB5AEF5C90D0F5701B1478B6D27A45F6C36953C0DE8455686D920F10765070DF3BC43AE0A6988 +499000,k,8891F46FAD09554F8F9D0CB6EC99E8D6FFCC2642D35AE1BBDD84CD3383E1D91665B0752A9DF3315C84CACDDFB242789719AEC25FC42DFD7B +499000,u,0B729F3749B09572F70A6B648A9DD605B183D7E670D648D7489B3402CC6BDC0BD9B58EF36B01752D80FCE0AC0233255E39B2269102916901 +500000,k,6716809869A3939A2017CD86073A70FFCB79D9FC9AE7DDAAFF05F1E33A2A568CCFF5A8C1210044B6E5E855B0B6BF155C20D9217F5972908F +500000,u,D66687D53D623FF7A8B0AC538CDDDE740C1A68EA2CFBB7B56327D7B3C7740902C4A9B8D1B7EEF158230A613006406529030F7E75682A024B +501000,k,B5342982D9D4B666809DB7CDC6C065F8427DDC1D8D976D45764DCA5466E58B375CEFC7DA5833149DCD8B167DA42317F383FBC280027A04B2 +501000,u,0F2FD63C0250F87B77AC677E93418DC52198E0C2B61BEADC76FC17C24690996007E63958FCA5E66089390996E0B1B9C3DF84C57244BB1CB3 +502000,k,23B4DE7F82353EE5371ED6EAC45BC0A5B4EAD4EED933F6CB0A5F5781F9D21510244AC794ED59AC4BBF81CC7AC636897763226832111C6FCE +502000,u,87B798DAC603DDAFBC0B3C825DE4376B7DFACA87267AF36797C9F2158742DDA2DA1422FCA2963381FDFAE68D4A6258D4C5A09728614654A0 +503000,k,5BE6936813A4128ACBB8548366FDE2972579716A504D4349EC12E2EA77C24E2BAD795B2CF48FF9994CD4C74A4390BB6E5FEA67D219E00B0A +503000,u,2F5CBD020EAB8F63AAFC71908097CBA88F1657AE3BB382BC77AFE32502741BC23262B512CA66FFE9E649A8DD09C96B82CA04D8688D7AF7F3 +504000,k,19AF96C02C40861CEBCE5D5982A39FA42743100BD8C5129510DD3C4FC75EE5F548C7A27608D9027AB831636C2985040480326D8813612DA2 +504000,u,87F1A95563386CB27E195C20AB5E6182B9D590DE7E4682B597AF1E8FFB321902DC274EBBA0ADB1A79C45E46A3B43D2724FE32357C370E43F +505000,k,7D89CCDE5545FF26A1314889E04166B8CBEB5D40AABDF04D3D873314EC4B0CC673A3A788C88CC1595F95C7080FFD820B5A007DB90F09BE0F +505000,u,5E6B35890650AE8E398C5304A2F59B8079B500CB0FE3F2882A73D8143FC80889E7DC4C37F96050A0C531D51493481D8BB1BA046160A34F86 +506000,k,D3C96496DE1E13E0C29C25E6D89ED9D460094EF5CC9190515C264CD492DA11C376B9550E848751C73AF49C8EE7424068F96E1A60F9496E66 +506000,u,53AE0838F043090350CA20A627E3BCF5EDAA363D479E5537A9B90396D117B5B16F6500773F3FDFF1A9C1179836A6AAD8862A4B2C1F87D4E8 +507000,k,760C8BB326C74AC60A5154B211DA9935C1A0A380A338EBF62773957D25920B7274BBC3D4365B6C1EFCA450B16734370FB1045C4E0CEDD967 +507000,u,F681C6ADB0540DA4175D69AA785B358130CA4B55B558FAB7ED88689AC4B0DF53DA7506755F08C00E2F2B45043158D8F633694A1349F3A2E5 +508000,k,0659EE43A55A94E47A8931B396064FA5F1984368D5670B6D008C32C90D116020ACA79CF8EEA091ACCD453DB35887E47E0D3C71D01FC184C9 +508000,u,39C0F5A8BFE7F97D7C4CF42B5E036D7211B9A58FD93F7CE139FC2AC8A145BF4A2EF250AAAB284E48F42C897F84D5CE21BAA868F3B8EE07DE +509000,k,D1C246C72E1C1A59F4B343EDA2DC0179AB77BC58B51B24EA33AC62B012F4D003012E42D3752BFD6FEE8E2F2CDD02AEF728964843DC4232E4 +509000,u,BB1BD1FB6D5509D7860D6A5423019128E96FE76F0B2BB6C9FB6FB6D606AA08E47990DD267BB5E098148AF0BDD547A430E329978B6BA161DE +510000,k,65EE334B40CEC408167D90F802992B1B072F253114D7851A8FC94D830D9F1D3A208BBE2BB0892B5CCC6651B5BB95E2F16C93CB5FA9998A6F +510000,u,7665972A508756EE5A601D0A25CB6EFD10D500C21BDE920EB7A89AAC82CF86A6E9170A586FA8B07651ED962AE1DEDD6289863AF043857404 +511000,k,3A1086E705F6699328F38F1D4B2CDDF1C03746E264F579383D56AC3DC9203D52DA5A7C54264CDC293ABA23EACF850719B00FF093918010CD +511000,u,1E171C6EE540668827B71FEABD0949AF135EB72F44E1A97EC43E801D64655CBB15E05DFCC69EE9B55D24A92637663E937BE4B598F95B0EBD +512000,k,974D298DD07DE0FF2617DC95B58077D589E51BE17B73B5E989D0B982F548B9B65F6D3674D4BB44970C72C55E78A2AF38C2E3EF3F7FA44B59 +512000,u,DD43D73C743F772193D04F7D605511A6FC6472109E95DF15F1C2D8E53B9385E518D368384A49FD653A380FFB003BABD1B8E5004FD78AAB13 +513000,k,0D63D2F72ACC7D248D0FA93C26DCDF62C25344E6CE2B41B38BEC553A4FC554950BF6C8C355254A4F925C4F976407DB48F7B7EA8989BB4377 +513000,u,9E26092865B43B46F60BDEB537DB0234008CB483E507C24AF5FA8015540EC5E90AB4A677C6D030979E00E8A9BAFCAFF26B2253265F548ED7 +514000,k,6ECDB4B8B78AFAEDA54D007A2E7D6BA53A4C36AAEFEC429C700B38671133D43D242A29A0F7685418F0D040CD246BD95C240E139701A348AC +514000,u,379AB972D5C10D20E3E3E3E3F1D57A34A63E126663BA330FD13A1E478AF138AB5383F6A46D3687A217C69FE0F676B7BE5B351CA83B858F40 +515000,k,CA7E0F154DAE0202546D41E1432FBC3DEB307F195D647E5FC52BBA675999192BCE09F3BD624D73863A6421B5C622E75F970140E9D95576DD +515000,u,180392F33A0845DEFD3957D5D731B577913B7939A357F03930F918CACE108443D96CEF76067196BE26D647630C52E99A73C8A67B6EC66605 +516000,k,094AC2079B472267312411BF67049730DB270F306E6E93B23EE396144F0C4A854D59E482DF57FEACFF913FA94E51B034DC25EA9D6B1ECF6B +516000,u,8CA78F1E0884287DB0F151983F8214C767BEF83549DC123D36792E695E9C8737BD7551DE11B8CA9CBB166E6525A611B20E17F16FCD339F7B +517000,k,51A61835A7D024DD4E9E85E79DA712192800CC5BFC0F9D07742F0113DD2D7382D680AB5AEFF0464887403B525A3009DC8233A780EAE981A9 +517000,u,28A55EC474AAFC76673C675AF9F9C1368B486D17C9FD2627F4BD672A872BD509343021D868DAD7608056507F06E50D606425C8ECCEE973AA +518000,k,1228397EB433D0A4AC08FA06CEE44543270D9C3ED5518015BD7FA2C430C0F227AA582EB9D717969968C3BD073B8D00FB2C2153AE75BD82DE +518000,u,25DA17421BAD6136D8745C70DD5A6E07A7CD3F1C8E69CD9254FFAD21E1B49AD01221B20BFE91A6FDC1984213BE74CD43BB5694D5D3184710 +519000,k,E209437B47E78F7ED2CAD4AAE60E599C0548D69CA7AA156945C3FB4738EDC03D39A9945857E0298AFFAEBDE5F0E449AD2B4D5B6A134E02B0 +519000,u,3095D997E3990DD0978102D5A95FD62AC50D68492650D002E77550AEB8A6529628808178A614E83370107F082E5E88FB7E683A20C0DAC2D3 +520000,k,121047A588D1DAC8F64DDFDF1F39B7FEA8F304B31AB472BC0B9A3B997F16B5EEE72AFBE4FBD0B5D57870C29A49FB9FA8C59F88B65DB671D6 +520000,u,DF9CB4F99FAD45D93F9E5C2CEEC18A27704153410CABABC651A99DD08E8BA1AFFA00D726FD1814516A5CF88FE49AE7016CC4BD2906602D03 +521000,k,8170B06872951B0C4BC92DB6A9D310720B8786C971F9AF013EE4A7AF7CBAFCA9EEAB3C3173F4550B228D6C202551F296A1CB1F4D6CC3813E +521000,u,5E72CD81382891B32391E7728168250BC40377FED5F11E314CFDB1C383AFDAB3B7394678BE2FF92F6BB16875408FF0D0554815ED1A7AE6DA +522000,k,C76B45122C1DCFC88DE764BC2CF9A30BE6FF6BFC9082ABD77F3E97A3CADF51F66AB92AB9FAF51B96523BD0286FD1FA8F64CBFEA2B5918C6C +522000,u,67C342C060BCC31E8C03308BE328EAAC70FA2F1045FE83EA39874570C26C99B3937F685CB94698BDFED5F852C1BDAAA4E483F2A33109A603 +523000,k,B35408FC6C7A23EB4DB1AC5D516AAB9AFC24D6F6AC8C6EC3FF91F7F8AB0367348B992FA18E5588F5C86DC2C55EA637BEABA06217D341F598 +523000,u,4A7BCE48C1F49A8FC53E07B27C511C334D5B7C749C100EF52F795857264A0F9DDBA47CB4BA654B3509BE01EF3BE2CD6B803E7E2A1761D804 +524000,k,2B5160ABD48348A274C56046F6BCF1442A84485284568508C2BAD824499999BCCBEB3A9C68AE9BDF7E0364A1BAB9212F16B412A07DC713B8 +524000,u,02114291AE5F44EFF450E776D1932B56663FEE98B7E21AC2EA6C19BFBBB0D82FC11C1758442FF932CC7ACABE9B6490EE190210399058E2D7 +525000,k,F32B0D19C81C551C595C78E841E7E9C61693C5A39B420080991AF829479016C180E23609683E9C2C38E255FFA9284BEDF1CC1CAF4869595B +525000,u,EBE40D476BCF280617B763C06DE89DED9D88FEECDB342C9229C958E3B9006D193869C01FE77E1C8F44468BF5FC2209B12C0D8B198EFA6563 +526000,k,14EE2E22EABF253C6957B62DF68B2B2C35C3A6BD0753401C741579EF62775E456C40CCB4D5C9D339274A14240C880BE58418C36ABF1721BC +526000,u,74B06D464BED4AF20FE49735DA2F4F1AE32E9F8ECEBD9EE6785142D52C7CC8153D406107C4DA9BC488419469AFC75A828D5963006F5B8033 +527000,k,AC4B373E46D122BE3C2373835155DC0E5AEB160B4F0578065865ABA4CD84085642C4E7FD487924F6B3D3ED88A5C30F1F5CF4483455A91DDC +527000,u,ACD1984C51BC980862F4F862534A55CA3B2635FBE101DFBB08242AA380CCF44D476283C2353043F4D06A6A3961E3E31EC032170AAA046835 +528000,k,898E677A98A39493B24132980C48631853EB08E6260C083FB337072F6D90CED391B2721F3682F992CFA16CA3D7DDE6E1E75F3D51F4E8CAB0 +528000,u,F9C22E6E5C6ADA1A96D7EE507B3F8E2D128EEC43AD3ACC1147F94478F2F3E142A277F9CE4AE499B8360366EA9FB7784845C7524C5C3CCE03 +529000,k,0B6DE3FE6DD43B3C05BEAD4601E2F7D3FF746224ED9EE98C9406A23095B04AE405A5A22DD73F035C5F9A931888A899D0DFDD8C37729D1ED5 +529000,u,D01A8FAADDFAA105F4FD95DD65070485A7221510582395461AF092087BE0DD4ABF96A142B6B81DE4A858F37A763D5B3B15DFC2F1D68B58EC +530000,k,A9E0FF26C506D898F613B20D31619B127924774885377BA72CEF7FB0D2695DB331D94DE1B05280AEEE9DE958C65011936A29A41CF0E64A77 +530000,u,69136137798DA08E04FB18814B8616FE389D937532A76C363D42D1405E639AA1AFFFD9EFE116AA0C518C38E3A7C22E77DA55345E807C988F +531000,k,3FDD651F4F810D168E4531809D32F9E88E2929FBB8FA98A46AC8547459FB3EB8845B3DCC3458AC77D934B1325332521902F6B0A91F9C5326 +531000,u,42B5663E2CAB013AFA7B0D676216789DC35DC5640EC18E835F6E6347A506156138A9070F7825F5F982F58140D806143973F9D08B07DC81E7 +532000,k,9D36189CE323A8D08E2D3C170EEC7051A281B4442854A1274C9A70E213D560A988E03EDD77AB3509FA7D7E418CCEC2CE1A152E80C4C4F96E +532000,u,EDECF423CB48E195BA79AB30F3F42CB2B067CD2EDC810080DCA1A15C6B5E08D9BB5444B7831DEF7A0EE9A76902173361B1ADF43706EA3968 +533000,k,F8F474C2EE1F3633353B01BA7092643E5D6CD307992E6AB3FB76F5BBD7CD6AAE0063951AA97785E4D3D7D66FF660DE43E350A5665D02DC13 +533000,u,6A6EBEFD7CB523FE88737D6B3310ECB12E3FC05F4A2A526B7FBD09D16782A10FF344E38C318242652DE7876B0CF26D17D5C6C1E2761CF78D +534000,k,13C7660816B2B809E3AE1E4932CBE60672BF9E48307B75803ECC8B308574E443568507B4762902FDBE02C766DCDE068D593D6C728CDDA0FD +534000,u,D40D4A7AA8195E3096225D95B2991D0AA870049F4DB454F507CBF6DE90CE665A6953F9020CC4AE10000BC2628ABEA37094AD6FCA87B9A17A +535000,k,2C2E29FBD10FC4A000848C2343E68ECF372699D4A71AB57E1F018334A8FBA07F8483A056D8AEE80B1AF069395B343DA933B0D83A0CFA3CCB +535000,u,532A23240C74147F830471ADAA468720D1A5B4F0F0DB47849233A6A1FA0190D62631FC7EB2A9DD8E1D6682564A876692E8FD4A45A8C18C5F +536000,k,9C415193AF6D9C5732FD6D43892A405AEE199E44165B50E91C2D1ABAE9CBDBEE7B2EE5CB65965D6111C96B71A587560BD72ADAC2A7D640DD +536000,u,52D954FDFD59CD5B86789CB0436B135763FD962D0E0A2B4DA7C67B08CDC74F3A1BD9255767F311EF50D8D8066F0D564F0B5B816991B891B5 +537000,k,4BB6735B20104CD2E267E58BCCD0C094B63765B7619E5D5444CF5207127F03FCE5C381FB908F26687392BCCEB8A2E2EA35176D0469DA3E7C +537000,u,E05526894C548F1B1FB862814192C702AD309D6F4DF4CDCF833C133147428B34E3005E50A708838F1FC997E9493792FA8DC229E8867574D3 +538000,k,F572C2C0935F033C9D061FE3F55441C349CE35F7B7571971749595A5E03BCD792DE702D31CAF7384C81C5A7CE93FED9B2B9DFC620A34F66A +538000,u,47840CC422D0608EAD7ED729EF9391F13207D46D0A80D61DC7471200B648EE7DB0F6373EA8116EBDB95724451097079F1B05CE443E0B733A +539000,k,DB6D94279F8F086F887EF3C4353ED746DF968599B41CB8FFDF4FF6CC34752C274F8B2D4B28E243CB20D989FBD2F281FCFE9312656E809956 +539000,u,FAD52405E42E15F6B9086BBC70B334EC862A715107EAB3BD96D900CA62407005D4996C1FBB94D29840A0D9D2F0E51A1D357674215DBCA1A4 +540000,k,7609B088CB9A0C05628A1F9E94FF590E0CB538A9DCE6B7D5C4D0A60CC182310BDAEC17A07BF9723FAE218BD39C321917464A2D76DFD48245 +540000,u,1F34252501D884C645C98710B1A4EDDB4881DB3920C8EBB1ADE5134D922E80A06BB0D6F039B6B8D51629135101C64C208C277982CD8C545E +541000,k,D952B5A47223A0314BD0195E24AEAD6B6FE753FB2615C90EE5B76827A8104C284D48C95A095AB1F60E1ADAA39DF22282FD952D8801217D11 +541000,u,542DE4DA9DAEB3E3ECDA63B8F0979A585098E80AEB3E653BFA12AF46B959BB62532CA563D23618EEF0DAAF7A9C8BB199BC678CC97E852D9D +542000,k,ADD7C57479866A1F741303102D866EA9C3D0D856EC0929BDF8ED278F9900BA7D165C9887E7817485D6DEFC1704310A06B32A2A60642EC346 +542000,u,60ABF5FCC5F6B846F51146B040563185F7E987CCA46AEA1CFE18C9235CA488A5468858B5938718BBE609386AE1C066888E37771649D9A592 +543000,k,0684936D20C498F4324AD19422E1E03873003F79723F457E0649DFA4D66E50823C466D3C552FA7D6656D2981C635FBDBD637E66CDF170645 +543000,u,38DEBB5A39430F5F17309C8DC7FC59302BF033961E8760AD97123D7800FB0ADE11679EBD53104B54706CC5B2B76626B7BA56C8D58BA7EDC7 +544000,k,7D45B7A3B4AEDEC3F4B18953D7005C58276D5DFB5A5B12FC4461495E6520D93F10F4F1AD482792F168F6598704747C4B1FEF5160A2C6114C +544000,u,844BD3BE05AEC66DCBE0E5600D7F4DA94FF6428E4DF9FC14943E4544C52573715C76F03F2FB0247D920EE3359EE0A166FA2C0871695E1836 +545000,k,4CAA226A9EFF7AEB091711985AC8B904B30AE18CE303BAE893C69263E9FCD279246D14563B41B441FBF171D11BDDC245C79967E2D1A7BA09 +545000,u,E01D9566A30168495790B9961EE791E93A80535C8D543DFF597DE929D0E49849533178E485451C532F8F3A44601261AA88F7FC83D5D6958F +546000,k,C9E78D217EBA712AFA49D45032D751C1CA2AD827987708293F3ED9FF2390D8A984E991C603F1EB3722609E89CE6EF315A87247E1D87E4F63 +546000,u,B2C2CF8D7359D260AF573A5E3D3BC4CD1AA59F93B6C63616D02791EEAA481BC5FF97CAF55B40074CD01D398F0D057975BF3B70BD0DEF5D4C +547000,k,F21FCFEEE4700075FE936733C4E803AA6B27EB379E9F4BACD1DCFC67C8E3C53552F237358D8FCB9301278A903BD1FDE96931BC76E54AA1F5 +547000,u,25D5301C1557088A4CB7BEA2B82A06DC4A581E1E873B994C2BB13FF8BC59389B51182576B9B104150388A003496B5EBF4BDF924BC28412D4 +548000,k,ABBE7B8D3979113143E9D9FD02828810954D82E41CC3E8C4D304D644E9E17CECE95F09CD9647AF4261203967D05852F4C14CB9DFEF6413A8 +548000,u,C2261B5117F374E435785DF8D8A5C99FD42DAD6135F2630825E121E8F201C964786BC200AC60B478574E02AF6320BF260EAFD24F13139A61 +549000,k,AA55A6E206C0843CFC8F299A9B91A965848BD77BD0EF308AACD4DDFE4C52867FDB7BBFEF7D1271E2B16CB395300732948741300FCDBD8B06 +549000,u,AFC412B2E339EE7965CBDC9F8BEDDF8F7FFE2DDFAE57D5F3827CEDEF1E6F734646805E80DA854093725B1DA319FCCB9DE19323D6A06C4F6F +550000,k,F95A7F31CD009F93495604A60BC0B628CE950D5D33D2BB922454B8FDBB864EA637944099CC68039922BD5D410299FC2725E4AA6A8C9BBD00 +550000,u,6C491DB7D76FB883BCF739BDF6DEA45261CFF21A40EFA0DDCBE19EB3997E01DA5E5C9E1101768A2EDEAD9C5B098C9C24C142AAFBE5B756B1 +551000,k,550606785C2971D11BAFFCB5AE62D7EA8055069AE91B5B8BB2D323403C7175DAC8D393B7D09B375300BC059ABE1D3499D56822FF5048E0B9 +551000,u,9A8C932D10ECD96315FF22E0DA7ED9C0E834D18D3FBA3EA50155321C1A68F2779924AA1039A10FF8143D83FE9978D2C98844F08237612726 +552000,k,E3DD4F6E77B39DF3BC1D7E9A31255390660EF2C4ADA6203681FFEC8AFDACF0A155EC23454891F6030B7E846069A90539AA56434768CA98C9 +552000,u,73183AC9CEF871C4E4628C04C5861EA29E1088107EF72C26730D63021A0C5684C9A5B3B0FADC29F4986074DCF07C8D6591153650CFAEA9EA +553000,k,851F75A967E2B79CCAF3CE15C706655B0DF84EEEA0D82494958B85549F82C0989FCE8E4B755A6BD17D27DC00EB25CBF1A046A7AE88826ED6 +553000,u,694AFEE333E9E4E9EC7CD1936EFC1336A3A19D14A899BBDF83B51A813D0F783A90CB0445E832D8ABF2E616CA088CC5DBDB4104D9B4D4080E +554000,k,837734F9438243DCB9511C81A6615F185C79FDF0CFC14ADC2B363AE269347B5FDC306BDF91F9E02D9FE7C66DB8C9F7A1FE0CAD1DD509742D +554000,u,F640C1F67A7CC792C75FEE1B0FD000D35FDD60F672F899E27305B5AA68A7A4A3C7CE907F0DA96D43FD202854B58D88619BB1627C0217E866 +555000,k,D1DBBBC9BCC328289AA2BF9D2646A3A921519A10F2103CC16A719D6014F951238C81596A8B35ACDFE5B0F347408C7CA58650F3CE0E11E84C +555000,u,4DBE129FBA97A9D2D56C1C9E6C864809A7B219231DA0D16E6E6F0F9AEA359AF27A23100602BD52CD4B193E1D6AF9DCE347D52B73DFB97DCB +556000,k,0ED26A84D7E24C33A83A7D73C1852FFF0BCD963138F4063B68EBFD1E74D34EE2034E6F6C7378F8E53C4E95526A986C96A5F5413FD9143D2A +556000,u,7308DE66C809001A97B207DA2DAB7E9EA43252280EAD349733D68685D103C828EEC277DA6D00A953EBD539080F1CAA3DB948E86F0FD168E3 +557000,k,48570AE95387A338D6F0F9372134EBD3117AC151620B3E65DFECBF3C9A4B2916D8931B3A451B31488DD6C8FF99AF4E509EEB459ECB1CEFCB +557000,u,D992E54C3A2901B2405A3D8803D773E63E57B68BD954DA01DA4DCAE513D327D4820285A69114929D50590D26C2B33759C0A68D0857C75860 +558000,k,FBA104A5165A4B960EADC73B0619F7CCAB3DA04D8F7222A6CBB2426D0E2B2AA9F43E3D838DE8D8B534A7C8548581AD482CDCD263D82562BB +558000,u,1D213BC210169EA62764B7461C7E62670C49C90A98A9E21D918A0E0EDB28B174B08C1222DF639F7858F9B5E250B28A141C84AE266DDD5B74 +559000,k,B97D15036871308BC3C2117302F2E02A1B7AB8F118561EBBE590A4945B3F2106667D234D6A597BAE3D9115D6818D7142C4452E6847AE6EAC +559000,u,1474934F928FCCC9245A798F5F2E7DA20943A18F1C75A6ED65F23575890B8A2BB2E9991982C480CBEF941F14FE4E77629F434EB653F614BE +560000,k,C956CB3F5B4E3F2A02F371BF58F7C0E1A38BA83C3B60FA81A3E0364AF28F8A222A7C69796961F7CB984E604FACF834FDFB0315122754E894 +560000,u,BC5933E94C7B30E118E7CED2A2B29CB06EAFF7190261100D845EF4268550DF93E1F721496A0F60680CA7F0F3AFB233AB63E1E348E0C13BEB +561000,k,4B64D0B1E250BB3855684A0F68D5292F8B0880876EB0721424F12E63253FC0C2A718DB48B50E8673E5E05BE446737FBCA0CA834C510FB611 +561000,u,79BF69274B8E1EA87125A39D8FDA9225A3526A37ACE4BD602F62A70C56A91E841FA7A0D0EF5C188B84191B5486B93B111A5FEEAE48CFC4BB +562000,k,324F3C4D900BF13803792A2F632AE705FD0EC3BE1A9934FDE250588331A6E4CACFD93175CF8ED6DE7CA2FC89C574EE4C2FB7B8BF6478EC9D +562000,u,07853A7DCD0078A6226A21C4C271C9254F58BED65021B9FDF3A4DBC4E7A340D6E389C50343CE2B0A44E7079D5BFB4ABDECD3CDD207035C19 +563000,k,8E7AB696F89624B47C6689E05022BAF0D6EE851062BE859EA51FC4EF1CF56435A261DCAF9F24377B5A1C9628B839A8643853BCE8BB55439E +563000,u,266D71F4BDFCA0DFF9CF02DB0B0FEEE593D6F19CC2858BB53CC68A0A5B3BDAED2DE35B2ADA6A0426FE9A4AB3C676C3EF0863A42ACCAC8096 +564000,k,F31921BF88E5702E5DAF65599573C29591A5B7FC37CED304BFAAF2625CCDB1205C659DC09AD3D520CF42160FA2C37B3FB594655DBA537D6E +564000,u,AA733D4082749DD3BCB1BCC9661A5D840A64523AD19C2AE84B5207C032362C8417DAE686A7D3F3A800C595FB9DF64B141FB5C85F38D10322 +565000,k,AC3B851504D27C63E4BF56F8E39891A357FF131663774AEF198415E1E4461F970EA5A9641CDF7194EC7C9078BCDEE8512B138DB12278EE36 +565000,u,4C324CD1522248590BACEBE93EF8C54492F5A4004DBE888F68AD143D10EAA22DB286DE3961B76B0F247A7A2C849E3D1F714F463896B76E26 +566000,k,4E63BCDF3F70C17DF8AB09808AE69843F4BACD0254D329BFDDDBC3506390C8DC5FE162455CFC5D5DE2BE4F6944035A4A1C3C974A64329559 +566000,u,29211EB0D45CC6BDE28CB6DB7B48BE32DB150559B7A8C6B4632C9A27AFA85FE47A10F7DB0EB42712F636E8F1CC54ED83066EEEBDEB73217F +567000,k,44B98AEDA39ACE8A3514AFB16EDE979F7912746C6D17DF34BC8B7C824BAE17BBA70C5E11F8297B8C59E4754D06ADDB8D6CA979EC6B732D2E +567000,u,E6616627FE0E40FF2613F0A5B6764339574BFA33CE5B5DE3366C5171D2D920E46087E73214705E0F81460CBBE5734903FF1F8D316DE3953D +568000,k,6963D6EF41934CA7A639CF56FF941F18BBFCD708F417CD6CF0AA5ABF61B1EC46DE808BEE480B5A51BE8CC9CD2F25DCAC1E01D9C1A1C18FF8 +568000,u,88DA684448F2C4B4D63D5841B9DB7543CC7E17BDA6E1EC23CDC998DB4603B04EBB7CE8D9830F056F2C75369CB0E76837D8E2EA53F777BF52 +569000,k,9A78930A73883D2C1C4B59D3B9A8FAB1D2A0889E98221518DBBA098572AA209810335B3AE8D16353551A941CB08F171EEFFD882A8B27D428 +569000,u,2D932549AEF49604A9C1364F8398D359C8943F7D1023489E425252BEAFDF9F3440F4F4C4C89EB0F5EB2681FA799548E60B3680D9669FB3BC +570000,k,35D8051B4B1A9714C82F70B9956B30AD120137C8F582FF756AB7225FB5F876F4E8A2F070FF9396EECCA4DBD1798256180387528764E37B4A +570000,u,24B846F2ABC83DF91A00ACAD4750625A792024A2A36CE3E9F4F7CB8F76AE8EFD9E75982C02151887FC5434C7E85987A4BE7A4AF6279B9AC5 +571000,k,386144AF2BFB8CB704C5804DBB2EF5D9CB4660C6BC18892083932C2ABE336127E3E5CDEBA216EC8CE642BC2B164494D9FE5BF59C075508DD +571000,u,EBC4D16711901BC40D88BCDF5FEAA8DB68B8558135FB610D2140EC0C7B9FC9A3E88765EE13DE466A2DF285F8A361F48BEA2B65D22617F367 +572000,k,5D7797922149B7C1A84FDC0065F465FE03AC9D28541DB88DBC8A45C10B8B0196E48CB229B4B3D552A9FE7E9A7A90B5A551F371E056ECDA61 +572000,u,93C9E1D3ADD51C42DF3653093B238A2E69108B590CFAC1783A7B27340015FE772B3844DB887EE37475D5750672FA8545FAC17662AD2CC239 +573000,k,867B66F28EFB54AE106A625DA67DA352B649A307374C803BD8AA2716A1465AF9BA74C97386775E99F82F3E6B264F72F8FEBDB2DE37234C56 +573000,u,A85362D000AB131046F3377A3C65AD96A1B3BDAD733F176254299D0309183697A9B3C705D828FD6AD538DAEC7C0E8D6675676399FC53ABBB +574000,k,CBECDA46414949B9B65BCF7DEB7DC7E6936330A7D2A819F0A3167ACA8451510E9549A6502223CFC2D55E7137E2BAB34B98AC882904D4EB78 +574000,u,7358E2D1FAD07A053293D61F79C867F1FB43714E78412AC7DC878C22C2DE8134B49D945987AC4060F01363EBB2D678E25C0830E7B1483EB5 +575000,k,38E0A1D225F2B895B5BED6E2DAECFB369912DE63024B77572B6492C31A74D2EBAAECBE5829F80389F46BE713F8993E181514AFD89F140728 +575000,u,C4790DBF2A88666F696357702828C748E0655C7EC0E9F8D32EA2A17D5ED163EBB112611282E4C8B47B4A9DD4F651AE2E0CB84D9E3F483375 +576000,k,117F6CEE30236392E47FD2D96FFA759E0AA97BC22A02B1707C11D86B1B39F07D2A2F23ABB08F95466E8181305BA707189AE7DD72736B7541 +576000,u,8265369DEF55F87DFCC4A0D0E813BB22AA19FEA8A5DB3E61768EDEEC9699FE74754492FC002D0B63768EA5975D02502E5F83B2ADBFE7E5EB +577000,k,179813565F9971F95148A9543D0323A24A761ED6FC4759368809EEC788281243ACA5E32CBC6E34A459191DF6D97A5D8EDCF72090A7846DF7 +577000,u,8CC3DEE95A32E1D8236541C1475EC256D3243660884DEE6C05C0A18BD262C7F05F4A4E31D0027DEDB1A378D9633C7ABECEAFE5F6BD193E60 +578000,k,903D733D31981F3749FC5744D87FA86E8AB84B82216E28849E224C18306EDA758FA7D412EFFE03BCA08128A04B8AD8E6ABC5DBCB56A4D46B +578000,u,026A475086BB5C3390B993C13CBA8AE1A455FACADE369BC3BDA5D7581076981207CBEF187D03A5F908D0668EA504C010993A3E31E2B0B804 +579000,k,95A2604FD5922F3A440DC414814FF0E7DD3E920978C72956C586AA56FC93701B1AB4F9702A477C30BB10BA4D6120B8EF737A945606260952 +579000,u,4A60ACBC408198EC60175430F10E98B8DB9051E29D02D8F1FE4A345426F2A87BBC2981BE3E2C6C1887233EB817D8617F06A701563752328F +580000,k,F4A5B570DE958736B3EC30AAF6F70DE577E0646FECAADBA993898634CEA97564A4ADF8F5B96DF12FC7229C3BF70B567EAF0649FC7EAE1808 +580000,u,3C74B50862336F2615DECE2B38164CDEDDCCF9CFACADBAEB3C8D74876AF6E2281C41F6F8FE27968E694087FD0C451BE2A36A093555EAEC64 +581000,k,9D3E2E60EAE746B81F6E4B533A84864A6EB28CF0F0C776BC78012384EB3A87549C123D496267DCD5A0EB6ECC6D2046A79A9EDC85529EBC34 +581000,u,F9DB25E1D77BB726EDC33D5BCBECF0318F025115BA44220DE502B26A0196B6CD05E9D753F60A5D7B70ED122809F3FC1376614A67D9C317FD +582000,k,A04571E101001C41345F6D73CDD0750B5EB5596FD5B2AA3E8F15071EA4E1A7035B367A0038EBE9AFA569A21D3E65530D215EEC82F624FDFC +582000,u,A68A35B39DF53A46500708B291546F601BCCD54E878AEF24F4A607C695A3D11E225A13F2790D4B023D4A872D9F9A10C16BB4E7239F7091C6 +583000,k,FDE3A8424BDD686F13BFFED082115A2B3C93645B13B1306925ED9E457DA612E8728972BC2CF9D5BAAA4BC2FD579E064E12E42945BA4A9081 +583000,u,801BEB4AAEE0CD513466AFD91A2763B9ABC5D0D0C880C89C3F53D7ED5C917EBD4B1770FDE5246319AAABB7AC9C838CF555CDEF909CD5D902 +584000,k,9EEC33E92F588AB630997953D2A31F0B3B30B145ABC669349DC9911CA2D23E14055A59ED1760B1146988954ED075D22EC760DA2BF8ECCCEB +584000,u,E9BF32EC4D4C48DF54705739759369C2DE6B93ED22B0B4682F8F5FADE3F5E93DF699FC8D0DAA84BD00BF9219E78F88BE0CB14108EA13A6F3 +585000,k,B55E18BABF6FA0409C5BCFE1634CDA03BA95F67F21EB27934FB60E0E351A322A5E98FE4EAEAF179792D8B1750478A8F71D6DE787FA35274E +585000,u,8F96DC13EAC2C018A5F29802D563931572B5F127EA0D1131400F1F3CCAF07AD7F1277F16854551D5D3472C25B652CF09F2EFD75B497041A6 +586000,k,8A1D3BC5FA54B4307CF4E87ECB3EFCEC77D786418BE6FE96F0AFA50AFF9760B57D7FBF1B57C3C3C5C836484560C7DCA95D4067278D840E2C +586000,u,A2D6765E7A8861A9069F20971DA7DE0796807D103DE0E3F2D00FF6CF99C56B7A06A6C3DDE2DFC7FBD62E84F7CE3237CCC3D927E96F196493 +587000,k,B908F0EA7A901E962F0513DBCD6FC8C7A568BA4C0797B660ACA123D3D0E49A0FAF709862010E617C1A84DF64E5179E5E48734145D57D5281 +587000,u,650E377C0291C876388C7F9121A3ED2AD413F1F0A5BC3B70052AB017894F5324821E402A46E70376CAD719395ECF8D38C65CA79B46598398 +588000,k,66A99E74CBBC8B8BCBD0B08C864D7F73C8994C492352FA40966E85AB6310D39EDEC9C0BFD00B34CE06C66A9A98FF6723FFE03EC837B9B44B +588000,u,9FF0B4AADC6300F66C0FF2B593C9F0376B12AC38643F9024777FC1627ED015B21FD8969CBDBA7EB70320BFA0EAAA2EA1221510EECB9239A7 +589000,k,3056AFBCAFA809C003695BA9FC5087F530E4EB52500357AE7506F1C9CE888513A87DBF1F512BEA19A96AF968D06F5697193B289479054246 +589000,u,956C9B3204B863CF879EA3C70D83B0781AA125CF63CC82907265E4E7F01B0E075D483702DA223C936F61BE98CA4B6D47601867A43EC9CCC5 +590000,k,50D2E9FCEA6534335A18BC08F953D927D03F0075A68A4618C40E75E5DD3855BE5F458D9D2B2FBDC4E2EF15B09DFC4287CDF6628705CC4963 +590000,u,7B50AB542385071D3B6FBA57BC29976E628330DC7FC73055EAFFB168187E3117265E8E7716B3C0BC3BAF2B28B84F78030DC7C55A0C66270B +591000,k,FCDEB810470FFDA461AFFBD78173FF6394DADC78D10A0F72743E08AC55545668339E0EBF84948C55041268F8175A0357BA93FE57A8CCFB1B +591000,u,FEF7FA1470C158002ECF0E4612B18BC60A95557B94EE5833CE2B3876028EA67A96B4E9F8D31B3E432DA5E1310F6C5D9D7489BD2097AD574E +592000,k,5E78C71A8963AD8D2ED1E94632D7B41931E67F81D298B14DFE212AD0A0FB0BC90BB43F0A6324765F2FA3E032FDF3006B093AC7A3B1B2E3E9 +592000,u,A0599E963818EE6185FDCA13134E45B982E92F73D8FDE58D31BED699D6382FA3998D328DFC50EC9DCC4F1CA5012AA75355409078A4AF4EFB +593000,k,AC0F4709CA1E7F43C983DBF3177EF475009E229B084F6C7A0814FD4AF40C3A2105705EAEC08E5802B4CBD8FB17F64F6ECB3E2BFE694E8F98 +593000,u,479E3DF07C6FA9396436019497320BE9BB0C3ED7BC4025FFA7C19D77CBD1C9CCFA554B7D7DE3C666042F6711CB3DA7CEBE1A5B3CDF6D126E +594000,k,9800A570F103405667ED786C562F342D2778C9D510D589266EA53C77C76D75551771412E178DD705A4BBF7191379DF7F8CBFC787CCB10FC1 +594000,u,03791566FD7667BDBF57284D25D80B6E4498EFF3F1687BCDD2C332C03DAD185B11B037D7E22A14842F747CAFCC40F45F4E1C0CF8BBC2E8A1 +595000,k,CFBE8854BBD40B2FB50E879F25AC8C7B05D7C49D2874E6E61E232F16F161DD6336A18550DB02DEA7780DB0A8F6AE025768B27FBE86AC6227 +595000,u,68FB62317F1748E0C8D18A448758D966428370A18DCEBBD5FC0DEDBA91C5C2BF0071813444F4855FA717E0C5177AE2634365A98B6C20D734 +596000,k,6154CE541F8CD2720814D4EF3BB9E0EEF858AF8973AD4922D8BB0C14866F089A87D571B9B1770192D70DD721623E66D624BBD37E29200A51 +596000,u,A93F05948F784AC4EEB5864884521D0E1D347A2B8F54875A32636259250591FD7B6DD20BEA7FDAE78CC1B8D41943FFAE28EC70DAE9163925 +597000,k,7B3A4CE7FA818C160C199733497A983F393E37635FD289DCD3DA93E010D37B466276F26A9E7EF2C8375EE9181376EEDCA5EE20800303F9F5 +597000,u,277A20D9659EEF69DDCC80CCB697E8ACCC0CDB608CEC960C7D3DA579CA092F7B4AFCC693AC641DF5DD6F92F1A5B5E690F57451C4C96A8DDC +598000,k,1D2298A906DF1EAE45B537409AEDDAA5F675C79229A7B7654FAA92E8FD90571E64008395C83411DDF995DD2272CE19BB93E0980848836318 +598000,u,280BB69D9F424DDE44B37CCE24637828489DEE35C61BDDD55816B0F3FEE1AC71C208172D8B8F33B11BCD321402D24A6EFA2E51420D18A846 +599000,k,226EB6FFC3A4AE15BC64A497F72188FDFE5D0B9FE35531AC3FE4282808E276561B518CDCB8509339DD4FD6F778A0854DD4BC116561B7EE9F +599000,u,7460FE196BC26C05C369A814E7074359F59FEB2671996B5B926A54E51325168ED08FABD960C362BF947A0AF475A9FB94DE3356A6AFA55AC1 +600000,k,76416C18106B720EA498BCE60FBDC2E7E9A155D98260BEB490B9F848FA7C3F008F374B8268F5B2EEBFF0700070242FDAF780AC7603D4D02B +600000,u,961F7CCD23D31CCC20635FCF67FBD8665D3A86BBFA639F657145AD8B5B1635DD5D0D0369B85B373E7EB0828BDC85FFBBF0CF40B61A8878B8 +601000,k,C80AF8A4A69CE64D638EB8FD9B3F024767CCABE86D43CD70FC2B50EEC79E148F7811DA1791119DAE521F125F1870CB2808174284F865824C +601000,u,EB538ECC60DA627F08A91B840FD5588506C51F0B569355206E9C3E601B6EAB041F5663A3FBB429524F819445F6902C614BE43990BE45CA8A +602000,k,C71BD7F191F0B94723827A96D6F09B75D83B389107BAC75964334D9BE1CCCF1C86984BB00FC44A602739BB1B05EEC6B5B700AC7F13C26E90 +602000,u,787883D86D23D74462C1714583D9765E9DE1B455B59613D661C0DE3952A9E85C7AAF3C08D0DFA7A23C44CE58C45C376A590C7C509696A45B +603000,k,11A3B4BABCC1C20F76A3789AD2C3E2A9592CB4A819AE326C8AC547DB86C02C28021F1D69264B297D921ADDC16D08DCB10B62E15F7DDD35B8 +603000,u,BA0E2A799A2A216EF0FFF02738E019665F8591645A487AAEA345EB7DBDDDD0EDD21F21834B48E922D642986D3470D17488F35D18AC823189 +604000,k,A8546738EC87B0C10AA68C37C5A46C095EAA656244F90E7D22504C4355B6BEA68F4C1EAE52CD4D27185B3C4CF56384955A1D45BCCC89A75B +604000,u,3AA72214185A5AC2EBBDE39ED33F753F6DCCE55FBE26370FD39E67FF830BD87592F2A521F0A2392B0D4BAC4CB8729D283885120278F04550 +605000,k,D4FA233B6377B0657312B13247A49E46F29A9BB7F4C570AA62A2D343158174BE96FBAF974B5E44E682B211E129BF9BB45987270956641F12 +605000,u,41F6864660527F99E1E541399B55384CE602DE9554C8B8DD3CB856F6A66746E4D392B2F79E9A8EAE54A251E35DC8D662D684C1FD661AE3B9 +606000,k,C0CF03DC869B5A90AB75B3FF977C7C239FBF0F5DD74B8CA49864FD30188E1D05112C5D09683A2C86A94BC72FB08E1C1A98AC1608DFAC2401 +606000,u,82388156981B3D464E85A848EAA55016A0F83E91CEBE322B18AB350E62327241871D5D8B2BE3371CA32838D8B37D4DB6C8A26D913B4C4F9C +607000,k,7EE570BC7F385159B237FD091640E0B87C4601CAEFE8FAE37D4A9051175CA4FA80DDF3AA6C41EDE82408F2575B3C8569815E2A5AD7287404 +607000,u,C96C4B314B72299AFAE71A12080747C95CD840F962E413B470ED675135E02E045A76B3804ECAC1873B318BA87B1CF04730CD981DA5903D1A +608000,k,7BD7A5A23A6FBC19A368BD752E3A7CE559319C70E0319757B16D5014EBB1524D7E61D8D2A1CD77CAD6572D570E75CFCF61DAAF2D9FE957D1 +608000,u,76D3EF73CFF96A96F7793FA6F8D69643F5AAD44A4C1C2862FA46A54B7465A512E461E73532E581C76D073DD675DBF541C53130606299E61D +609000,k,86F47C4FD6185B62B790FA8144B867EAE453358B2D96668E3606CA66DD7215DB98BCFFBAA0796B4E23E5C1CBD6F3C3EF8B83E61CA795F20D +609000,u,A2D067A694B80FA6C580C230421DDCEC4F896B475CD78FB2C75784EA90F08D08C98BC3BC75B769A9848B2DD87FB9FA91EB337DB012B7C0EA +610000,k,5F8F1DB99C775C7FB182A131382486739593459A0AFCC6C4273906BAA21C6E5384C0AB9EE2584F7D21DD58FB29AD57D007CB9EAA0D254130 +610000,u,901C738395E82BEBC7596F440C3A6A1D5689DCFE395B9386CFE0905355651F87D62078960732597F2389C57DC1F1ED16F643E35147BE3684 +611000,k,34DE12C86DBE55AA9AF2D6E0C6D06B471208D95A83CCA3FC72590CBEF6B3DE077D0BE8BC08788E7CD386607628C483264972439068901642 +611000,u,13D5F46ADC50AEC4261A5FF92A776F605ADF57CCD5B9D62AE0211C80BA852C05438955828711BE597D0919310B02DDC21DCE6B041BCB66C8 +612000,k,8F2EAEBB52619166BA44D1BA2FEC18D9CF40A89A4772F3C5875032F91E78BCB38810B9DAAF4756C0AD06318CD792A31F404D23F5A1FAE46D +612000,u,3214A6BEAFA2FE4512AA0720D7FCA2C5BDB13B83A01CA06E5B1A096B1221E768B215CAA8FE45F85895768DB2BFDB4B055EAABF06BE3989BE +613000,k,A46496B43BA994C2F4630939644F62B2B6690EBC60DC2007B93D5F2C9582D3DFCEBA6F9C052C098A1A67E13C1F5ABFADED3E807706C97ADF +613000,u,2D8D99C454A396BD68DBF04E595DB53C3E6CFB573D5383F58AD438A49F56190ED693931A95A4A8BFB26D10CB5B1AFEBAC60C3DE98A86128A +614000,k,1A7306D71DA505ECF91CB766D3F0B9460709818203504CF64D9FF03C52536EE218A42A71B992FCEC364EAB4942D691E355CC9D0B59CF0BC1 +614000,u,83D4FF8C0A5A73E499BBA7B8B1212104645666FECE77E1D0F8A4478C71D352724DB837EF75E59662CA2AB601FF82E955E60346BECFC4135C +615000,k,A5E824B5A2C463A1662A2F18C03CCA21F76DC349BF68587BACE5D1919CA6BB1246EDA38F15887ADEC480E93052CB837608D88507175BD2EF +615000,u,BCA7F23170A65052FA2ED27B0C78C78CCACAB8DD209C5A611AA7DCB2A8413A47C3DC36721F096EC73F7CEF7C171EA477C357677A6508BBE8 +616000,k,E14E0A45935D35AC74820462B2152DBBEE56E7835BDA80E1A353090752CC1BB6ACC3CAA3A4A41B06BDDF2557C233FCBC5EB1E54FD0081D44 +616000,u,6D6087A65C8820A59AB871600385B76EF5F7B1F8A18711C589160696ECC1F0CA915E923A02C4F8ECC28151C4B28111680B60E21201F629C2 +617000,k,9FEE550156DD2953099954AA2884D9E7218D14C5E7827DDADD015F0BA8DA8C1C7C7F742685EBBD8E0BA2421CAB6E0BF9BD914C78EC8E0589 +617000,u,F4CABB16EF41D867175707EF00E0023B67A44C370DDC76D38473DB9193E96734E18F033573C3E604095E1564EB8795946CABD415ED6A8096 +618000,k,02BC14DC3BE43425D6A00060D00036927107D587B2B8BF6F142D8AF5CD4A19ACFD61DE980FD013A25671F26E4A8293211739E0C8528E5E9F +618000,u,03FCD997FAA0CD9DCC3C40479C2DAEFEBBE34DD7221478D332FBC4CBDF323DE1DD3E06012B18E337D8B31A99ED43BAE60B2924DC9594E4F0 +619000,k,CA63E4CA007ABB76D80CFBF2DA8410760B639736BD61332D65AD0852C48C53EC766E69F8EBC4E805A1F2D370FF25624C739CBE7680E1EAA6 +619000,u,9DC57D874318953A37928231F3C21DFC3256C1E253CE6B7A6163212BE5776893F3A8699363714443F283FE3C65D241CCD27EC91C22E31AA9 +620000,k,C27C98A41E05A970451F0C2854510140F6BE7E1341DCCA06268D794DCC4490F9E69C7F037FDA66B74C015B207304EFAEECF62DFDB237E5D4 +620000,u,86EB8EAC62622AE4DA2FF11640FB002627D0C5809585CE4C83538E6DB07AD6D14B74A908688D8D3C521A0095A524E3CEC90639CEB3633979 +621000,k,31BD6918DF1C208450085FD0B6EDBF02288A79E7B229448D6AC63B8C1356ECB4E54CE64F74870FF25AB1060F9DAB72E941509697C19E5317 +621000,u,C465A33C7AFCA1EBEB2CBA6FA0EDA85A66DE6C7C6E79EFC231408B7D2391A96393B22151C591A3197DD0D4C6DAE5CF1D3F1E8DA2AB6A7DA3 +622000,k,F5DC0199AA699593F3FA0A1D2DCFE3C459580AF21448269E98B798642683A805739C174D176F3BAFC0C4BFD5CEE3895727DBA207EF45D4B9 +622000,u,3E7EA6D8262F66768D09633DB80A3EE3D37CFC8B932CED738BBCC7A41E23CFA696D48723F0A2FC31C07EB88BBC247D83B2E21A38731402F1 +623000,k,D74280D6FB08D7BFD2112F40A161B9A0082994C34CFBBC0DB8E15F58FCC1A43EFB71AFFB04E0E811623D536E0CC725903AF7C175CE94E872 +623000,u,97D631406A9B8BDD8397A262E50A3CC000F472690F55799B4A7A82A3D2AF97224CBE0CE4554CEA4CC35623ABF7EE03043708438AEDA01469 +624000,k,D7EF700D02E33A0539B1A257C65E53972B2EAAB9F97B268D726D4AC728667C771C6C8CA36D92594D0D39B99DD193DA4B3AD9483DA24DDB3C +624000,u,C3648BCCF833094E8BAA3FB4B409474016695B9FAF8974FF931FD41714808CAF9F35C7683A48B4104977ACDBFF3A8E021667F6A93316EA23 +625000,k,E8292BF290CB393C40D64A2666EC5D3E6B6213EF56E651F29C3E8F201054689FDBF47137F080C8BF8E1A56A2FDD63B129DC088408D21C33D +625000,u,C40A56BDCE702E10427E4E406BD3A555EFAADA449019BE046181EFD2F3DAF9AB973E6C30B510E4E75CAB07CBA190B9B11181F285FA66548A +626000,k,07F57F76DAD24CA2E10F1DA824E73DA33F3DFD8B933672B671A7D9B488549992AC31B1F48F08A6F51D848941541B3F9E316C38E21C15B88B +626000,u,3E9530FA7D2F40CF4AAF1C5966F44522D33E02A82F940858FA72BDABF21A93066C3E87ADC355BE903D52DE45C25866BE4AC85335EC3CB918 +627000,k,AB33C8F696660AFC4F9B18B53939C6DBF16279623EB45F3A4948FDA0C40C5DF54CA8CA5ADCE25F63F3755BC634FAFC96B607D893AAE245A2 +627000,u,30F9D131F13FF60A35276A0269A91B3E079BC1EC2F6099D8A2BFB55BC8868320E6E171C91F8588C09613BE04099D1B84958381A9FC31A0E1 +628000,k,1DAE674334A33F8BD02A9F969FCDAD2C755937B5300AF24D05D18F61E4FBC4056B868EC03BEE907D86E07FBA7185A766F5F10761D58E4037 +628000,u,499ABE54FB45DBC51BEEC245A87059D41606B9D6FFC32764882686FFC5CAF04FBD6C990F0CBFCC00859DE481D65739E3DF2E16B3FCDB9618 +629000,k,AAABF0C78BD9E0415D3849410FF6452439B2AA3493910C2DB1E10FF33ECC7D6DF20857B4C2AC8FC1E43D2278C62FA38EBCAD272936D86548 +629000,u,BC733CDDACD72401DFC1F3FAEE1706881E37BB233C29ABBD68145A4BA81CADAC405E60F67C194CB04D4900766E901C976953D341A9434A81 +630000,k,1D79354857A9E9724D14A646917D30827FE210CC11313E846AFDF3EB9EEE48FBA54FF2BE71207ADECB624A698281919E3941A30D9C944007 +630000,u,96007AF236F45D516D3D94550F8C5FFF5EE6071174E60948BFBC994FEEC61E69D53F52F2BE7170E0FF2F4F73FEB7EB538E3D49D08AE02D9A +631000,k,2840F1485C7214289BD2E51126319599752A1112679BFBCD1AF803700024BC45CABB3AE27E101C28418B8D872768698630B0BB0B3837E6D8 +631000,u,AEB8F826BE3DC15D3AE78CA8FFE0816E271C2B102C52AC63538D1B9F18D83A0E8079CD5CB3D520629E23BEE818FB876E521B417CFBCA7C50 +632000,k,9F3BE1E29274DC266FDE718E5B5F1E0FED408F2CF55008F7416459801CDF76B27CACA25437C98AAB8C3444D6437567F4AB515B30941BD28E +632000,u,6A21C59DF08286ADAA6A8AB5DDBEE5982503D2CCA2E04DB52D027E92F71FB4394A5BABFB7782BFD87129BD70EF7E7BC4242FE1B6A3E6D289 +633000,k,AF360FE22DAC25931590F0AF5C16E392AE94D6C4DD4499FF5E76F6E08F47C66F6E2244525DA213330D3DA3A623E78B6050FDE59F13A4A44A +633000,u,6394892F3AE7596BBA585A70BC08188F9A28334BF029104490F1B9917094326407ED0B211B156384E40C581F20698B8A6912988FA81AE053 +634000,k,09CB1DC60CDBCCFF1EC7291AE4413782B7436F1D4883835108E001014E23FF7CDEACC61ADCE2B42FE17597AB591B7F00F7689E3A055C7749 +634000,u,E35C085BCC768CED23491C271B4C34874E9C90D1B62F9C681F3D138782B82902898DE4A6CC6B82F2B8C464AC981640A222FDE4840B092E8B +635000,k,210DFD4C5258992E4BE4D6ACE789E9E0F5111634632F17E4B23BF692F0F4509AF0682C857535F3BC82FDF34418C43ADEF1AB6CA46CD90BE0 +635000,u,9E553D9AF24E3145E558634DE373A2523A527002C51C2E3B21AB68F8C3F1D60DB92A86FF7278E04BCEFFC740EE00B523CE883E35636C3618 +636000,k,8BBF4FC39D92E8320B012C911A833E54BF7F3161FA29FCB54ECD438AEB0101B906BA3ADA400A1211541AAE22798CA46F79763D2D42290004 +636000,u,921D8E24D5CD2C7E431A1FB542384B12FE4FC71632EB9BB8D6D60B49FE76DD11E6BBA9881D024188C2BEF5CA1D6CB79D5AB2C481D3200851 +637000,k,B98B9D85F04E145A5073FA5A98D2CF842F859A554829892C2038BC6E4E161BF786599E7D2B6D1CFC899C97F872F12FBF137DBF54B1EDBA9C +637000,u,723863CE95E99CE15772DC0D5171602021157377AC532D97F2189ED2529B8C0D48B1C2B41A53FEB910A29DB213C794CB7231928E6B964E31 +638000,k,5732072DD8FE8E1ABE05A0B978D3B06EEF902B09E8962D45277AD938EC64FB7163A129EDADFDE1CC6A567406A754AE795391E12A096CA5B5 +638000,u,FC6BFDB2A61937CE07677687BB7CE67C5A2681ED3DD200FEBD3E87D36E28E67959C52C4281903D6813A532D6CA05AB8CA7C93D140E03AFF7 +639000,k,F39F18D277130A6967DEBEEBE9E33CD3DC54DA41796490548032C89C08D269B212842D88039E70457CB5137913F01B5B43C83A695260BF5B +639000,u,B05791BD2F367DA4BDE8939CA99F27C65151AB7D1D33FD55F1DB86001F0782AE966C265346781777EDD340351AB38A1F61C47F48F220FAFA +640000,k,B30157E9CB69633B8A43C18C31969B8DC5183631990F223AA706B49A7F4A9867D2E7D0D7DE9BF305EFA6FA3045C395E6DD3543F93E87D54F +640000,u,5C68FE37B94159DFF06B024762A4A3A5F845E9D7244A4C7A901D8ACD2ED4C7C38EB28F22663CB67EB38A1E058C68B9AEBED242F607EFDDBE +641000,k,3DB5DC7BF388972F1250622E901131B967FCD3A5A99CC5A2B7296A4421D525436FB58D33A2D42284BF66F298C1CADE00557804D7F1348590 +641000,u,8F327CFF6699C26D33FCB92F5FE58435CE6D898E44582C107B69ABF19E06838D8C7C9ABC1C9D0405238923B57DDA03EFCF661A0F048268E3 +642000,k,AD12E097E0FA69B75440F550C769233667C51DB7EFD74328F7AEF0EE94055C70719383719B889B89AD493F44E0389A74C58BFC8B17FF7E35 +642000,u,26339578B57B5D41C392B4E7BB3D733F1D2BF4675EB5DFEA7EF6D3FD26ECD125B1397F676E0A361258B3C27D46DB6A3D2A8FC573BEC499E7 +643000,k,8957B1C73F15E9B5D7BFE166BE64AF56D8F815338AB7E8CB459B0F744CCD5E15A1133F3E32A58D8C20A7B85127F0EF767AA405771B4F68A4 +643000,u,CF763013FA2944D61E3179E754E3187F1AB389BE7E32E75AD161E3F20EC9DA57F1EE9A5A560D2E58F6D0B164CC40D6CF7453EBA382DC0675 +644000,k,E6FEFD987B1BAD7B586F8338AE952FD80BCAB0B1772E284B8267B2A5B228A57F3C60E5FE3AD1A0A7DA570521006F0561CEEB011F85CA46DF +644000,u,F6A46CCC6328BBB95832D7134720FA4F066563838330D5843EF45F8666B12D5207A6F41F4BD6C75AE07A541C12952A135F9757BFF2897DBF +645000,k,D19E9EF651DDD3A13D2DDE2182378F06643CF6FA12AEF02F90512366A8924BCE47BD74218A071732F1804A7EB132F99F04AC57B1EDF16498 +645000,u,2AF4AE9185A0DA727B35355FB5AB9B729010DE60D2ADE603494FA374D6495A256C165A2820C2DCEAE1919C3CD12E35396ADB8761D89873F7 +646000,k,49B7118453CCA98A128DF339DC9D227C18B420090F975EF5A35D90A76F0D3E82D5B545A4C2B87BFB71280A7A4CE6A47D782C892513AA5700 +646000,u,8182C73B750FF7CEC3038BC0A06B9FAF558D9AB0B1CD2BE0AD880FFAEF02FAA8E2A76A20162C2442E5C451C04BE12C9B64DBC0BA5E501A26 +647000,k,012D5955C831C547329526240A791D905FE45373A4B4267E0A45F91364375F7D9D02A71F15FC624F052F36FBA1B4CEE2A8E345A421A1D476 +647000,u,BF70FF1FC5587BE585F5DFEDCF3BDF0A54D5132BD4C48C87B06B06BB9D99BE0B975FA186020345C4C389F5D685E181E6375FB3E29912977A +648000,k,2EDF1F9E50740783B897802BE52087AA76C3113FEB881D8125C3822A083A2AF64A5C62EE134F649A30E7ABBDE5AB7906D5513410BE7221D0 +648000,u,96C713E13EB276BD6E48F70F57C05738B7C3251739D06069BEC7780F2B1CE75C1A89B189224B146A3A602DD7ABEA139BA68C30ACCE7B96E0 +649000,k,FE67FF42BB8E647B1C14F3A132F1E84D5C890551BF277AFA07EE90F3179CFCC5C30D64B717246D0890EC7BACED18321F6EF1B93D4006C67D +649000,u,282429C729CDC9D2B6025C8683C9BBFCFAC9AE394D0BC382DA1EA72E0F2F91BDDEE320FC74319330D386A845253469D8F65220AAD12F0267 +650000,k,3FA406DD0EB57BEA14F6393A5BDA771017579AFD559F533A1EA7B7387B1EEF79298A21228976E9071FBC2954D790DD1E4D15D5DD4C286236 +650000,u,24E2AB5AFAE51B1403969DEC09DF9BEF92605022B2B8F84363D622E239CE7755601C65B66A90DEB9435B33ACAE0D41B7118B4D1E2BFE1CBE +651000,k,8F342A49329CF12B1E4CFED71B6400009F8EA694182EBC98C03AAB2BAA0375DBBDDC42D56F654673A5AC63A73DD193E37D4B35CC0354EAB6 +651000,u,0C0C2A23DEC542028429FD6775D7E833D1BB7235E709A42260E333BAEA3693F3D12AF1666649E142776D0DFD60EEF865EEB621C6352BE2E9 +652000,k,F86A61FEA64E539A164D3E305622635528969B735D555DAC3669B08345277B08BC1857B3EDCB95292C8224290E17C3CC69AD4EF9FC947EDF +652000,u,42609B5DA6DBAF3EB2181BE8C1331C126AAFF7DA0F25EDF79C224A478177B19F465800B277FC77A521DEE30CA537AB2E141CD94D248C9CE5 +653000,k,56AEF682E293290FB8D4558C67D4B4FA301033749D2BBF62B8E3D6D533177AC4114072E8DC8BA32306EB25B911E0522C389EE0427DD92465 +653000,u,2A6C86E5A18A35391D4848C0A4A7D721468B81E3F4858C2970E73DF27823A8EBD4691CBD16944C4FDA9ACD268004552AEC5969A9F8646DA7 +654000,k,E926A1DD64847D12D5EF83FA6AB1498F517AC26BEA3B291F26ECA63ACF7447E8AD66B4CFBC34C0E10382756BA41881D48677816CE02C4DC1 +654000,u,6D4FE5FD3378F315712DA4F6DE9D3B95D2EB362D88105950816274D282AC1862650034EE8CF707128C60D19632D9B8BAB6BF2392BFA12575 +655000,k,2AA8FAC69FAB7261B2E88DBD52CED984FF835EE4AC2F7FD69F0203D1E1D43C9F368AAC6821A81F1696240D94D3280145FB5F3956D121E233 +655000,u,8007D31EB4D2D7AA08030F6C733688F0F4B5BC43E31DB63C78629A8B1A6AFB10A0C91441F16A746D6DBB01A0046E06E1908F6B1D1FB0739A +656000,k,2CFCF1FA38B3B6853177F2B136A70B7B369FD0DDD110C3FDDAB27F1E6F18518B29ACDA4E2C142C5E6113BD1D9CB6B895EBD9EC9C2AA43085 +656000,u,128B3D45DC5A9B869E927658D87C864DE0FF4C4F4A89E18C41F8587C3B3B743DF3C994EF6DE2C7C0E692F66F9179F015AD70BEF75E64A826 +657000,k,B70115D8B2665F04CA2E5F1C6B87FBB1CA5AF2ECD9DF8CE9FF61FB8D362317C1EDCD0CD77C35B389636B064ACE3AA3CAE3299277A53772FE +657000,u,AC71CC903163B3A6445B1CD803D37E037C776562E05FB4FC313FFD3A0994A4B6FDC77E36B85B7EE9A1C72AAB1BDF85EDE6D5EF1A4C04B32C +658000,k,4737D330F114F8460F9AC03458D32B803BD52E904F536FDCFD1E03130012D4A9433580122B494912822F482A16E30F2ABB3B77C154D23F25 +658000,u,437CBFD46B5FE492AB68B0D7CDA3E8C63C35EC5D38EB6B6B9D74B8FF5475D372FD4BA0D7A0E2ED6AAD874AE432C1806498C74AD391B44598 +659000,k,384E3E4643FC588A39F306AB88D3DE4F3924F8622D7881EE26FE5F1D0877C25FEE84C75DEF7C64071E41626FDFF77B1723401E541731B741 +659000,u,829D565D5D75A7DF48B3E23DDB4C718C222F23CD77A7F31889DDDE04C3BCC3134C13B4C8B219B659F60914FFADE8C2632834D416CC045C69 +660000,k,23752415DCB20E81B7429709D179C6425C8E3CE919424A5B51436C71F4970773577616769DB93A9076E8B025EF54CA281DB397ABF865870E +660000,u,5883FFD1C4C7B7441FA01AC359EC7EC60AE55ED6C33B3B97D810AB1717D2C57403B2374F17A6C9B75E8B7F6D1D53FA41F48EC097B883FE86 +661000,k,57A4FC8972A571D835902871427CE4C8BCA026C5B4A9D90AB397BBEA611AEC0FAEE66ECEEB19215F5642851EAB06D89E1B2124C77B80D6EB +661000,u,708B6EA5FAE29C42A168E6B1FE59E1AFE57EC52E1466A7A2442263A2649B9C0BFF343D98B2999093350DBC1B7AAA279133333EBC759BD96C +662000,k,09FD39616F018A09C251D475A4B5E7A2B51504FC60F580F04725D4F7268E1A9B815BA3FA734BD332DCB1D1DAF37162370422FED8ECE0DF99 +662000,u,DA13E183C602D4AF21E5D8AAB6C6E16778CC3D67093F007B39C3BF9B7187F3D02C190CE10430CA05A3924CD4B7D29FF02DFB67B82D046FAE +663000,k,1E1C896F77CC55D7AF776525D0DFA0701B1868CC351E90E7B0E50196B9F1607C1334716D7F8528950FC713FCCF02675B512128AD8C541BAD +663000,u,77E86427F1297B03E5DFB567FDD6B0FF6AAA79ACC5DBF0944A437AFD9F130B92A21C363C183D02FD1CC256E1D543957A7C83B473410A36F9 +664000,k,1CED94F1AFBF38432637A2137506696167EA38339603239060EB6410207907B86CC0185C3AD930D0B56EB1A6874B1CC810E8F45DFC56F3BE +664000,u,F9E176ED74EF9294627692092198ED0B9AF63DD2FE641ED40F38D2613B8C7958729F4CC0374C33B0C7E3F441A258AA4A6FB86C03FFFC8F3E +665000,k,C3A393D7ACE38462D0C0B9CF3415EBDEA78862D7EC972188BD783E2E3B92A71065C5CEF5126F57CBFCBE0B09B7BAECE006655EAA861C42C8 +665000,u,B54D6C17A9BEBAD12EF83F3362ED91F862AC1335013CC09145EC823D23C70121594AE494FD8F7D4D2E82582B3B24B55C78F129DBC4C021F3 +666000,k,4E1DD91100B321B23CCCA30DA5FD6417DFE6438EA1B975781693A818F2CF02043E4C7FCCA69120416397CBF630F8CD39C25E078A3CE72997 +666000,u,613DD43E3DEE6B035CD9411F58221BD9752485E192F7E7871C698738257F212DAE427E954B7AEEF0638484DE2F67C78A2C7871840B5690F7 +667000,k,88AF44BF7C6A7F4143AE883A182247934C6FC0F3CEB74FFE763153C9CCF099CD5EBF4AC7E92AFFD2D52899D770154020A096A38CA8B65EBC +667000,u,DCAAABBF7183F4201DE7D14DFC9838EEDAC857AD6C1D381BFE36BF2270A86EE76DF18D42D98A18E394D4C4800103029A90ACFA18AABDE19E +668000,k,C9840F1616C7FA446B9614138BA7CC0CBA93D860F8339E8F0806CBD849312DB340E2C47662B3C573FE47285304CC611767C6CAA6A11F4EA4 +668000,u,A5E591FE6CF8587BDAE6CBFB5ACCEF5398440C8D25756EC7D2503786803749FA54EC2C64D3ACEF4B7098FE9FD9FC036F5670D8F3F99AAD71 +669000,k,D73D4938856E206FE7F515174B29C80447D98B69E90DB34D6269DA73660C7377895945C77CF82964779655918DE9525C50402A6810B83296 +669000,u,B7075A478FB7BE8C76C40CD30CC27E3FDF990D04F64E533AA566BBA8EF62FB1ACE9448E6DB85C8AC86513251C4F6A9B0D85FEFC30002FD32 +670000,k,D87F91DC14DFEF3FD88A88E247554F8C2FBD3AF8325DA4520D8A19EFE0953B78FCD37A39E21D1B6E079D34FB200CFE494346335D81A1E689 +670000,u,673B31FDEC37899DAB7D07A8DF6FCE3521FDF6DA907BD3C4CBCFBA9A15EB2545D197C8D2B464482C05ACFD2C9E14911BBAB8EBE7B136F601 +671000,k,9429963D25CF1AF814FDA7863D943F92135CE73542A8106F3FD5844B4F6C05712090337AA946CF86FA488574FC6425B717EB12F4E58BF337 +671000,u,AC68F1EF6F6D63FC3A3198EB28498094834658B01AE4E60934D5450087A7165C6901E95B59C689B80EE9BAB48783DF91529E9629CED07EE2 +672000,k,3EB126E80B46F6A70B139D97664BE254E3AEBE695658D6EEF10BFDA8A860FDBA6528B69063FBE91BE2DCE89D4EAF827C1B0C423D139577DC +672000,u,FC73E4DDA3910A0EE7F6198C1543C7C92F045ABABAC41C174D3703904FAC53D3F1044DD1AD1C4AE644D51BEAD16BA014040FCBDA0B923C59 +673000,k,E03F12D91BB6FF5D656140DB187C2A4223CD18DF9B2F41E7375A233D33E1D0672AA9988237D9FF43BFF55FC985BE172DE82184E3E3DDD0C2 +673000,u,CD45A7DCFD92054ABEEF3E17147C72FF9C4FEB6212FDC175078A4E010F842809DC4921C67B06338C3C25C878231423BAD21F1BB66D307FD4 +674000,k,33155DCF2BE0788E09AE6EE6CBBF976FFDAC43A34F1E21D130CCB814DC16DAAE83B71220C6D77E9AA550C30D3EF4C70BDAB96F51AEEC0A79 +674000,u,3C02D9ED28BE68394C977D00676B91996088EFF147390387C4A5B5CF478E0372D7168280BE591AD17B3E7A8C534B405C528923DF48476180 +675000,k,1349F36CF99D6DDAD5BDC80681D159DE54BDB4F3E2F4B5669B4F6D95A9240101443E871433C7B33F67F32464E78881CEF8ED594605F95DD1 +675000,u,FCB84FE7E5076ACBDF6C9D43B30F336D0045ED9F9B987A8BE74BA4ECD2424B1DB84BC44BBE74AFADF24033478CB4D7E743D970087185CDBD +676000,k,9A7FF6C9FF4053A694D043F5614A874FC09D3735093C1EE83200E8E9DC0A2AE45471265E9F7AB5C0464FF233BA7817D618A7AEB1E4FEC0CB +676000,u,B7E92D8081AC9297055658D315E22DC2509796E03297E195DDE7A6DB56BDAF6F1B039787D71C9C02D2398A384BDA77C7DBECAEB38F472DEA +677000,k,6EE559C000B6D7686774451E59C63F02545EA462FBBC37209890066881E31CA3F319590ECB278738629EA7FD24A1465D1AFFED6B8DF6CEF1 +677000,u,5A9BAAB63CFC86AB299A4DECB380FFBE75A8294C3DE757D8BF7F31FE098D2A3702F93CE4AA1BC296B072136393DA4B3C7411B05BBB0B906F +678000,k,14446E78923C79C4B311C648F6DCD640E2CFB5A015607FB5A21B069910B192CD952238C906CEEE9190F73274271BF5EFD10455877C4887B4 +678000,u,01E78F45E5D29C7D1FF9ED060F69CC20E62D038703071B165A944509CEA1310D11CD42F4516E80BE66707D753CED9E24DDB2B89D85136EC7 +679000,k,5E3F72B6530F33EF888E545CDC500A1CD777A5C98C70EE5396807E597A234641F320694B10078BF7FD6900890FA6903B6E705E461D43BC3A +679000,u,8AA9F9C272FBE79FFED517E03B9B0725E11BD09597E241BE1C6DCEB5EBCE1A0551072BC286E0F3F1D54972B9466AF929AA460FFDA40E1B4A +680000,k,93406EE19C5AEED2B71CFB3AA297A96B5D1EF17B570F3104660B7655713196CD2F329A5B80A6714968B114953CD0A3E8FB50B8BC56C2DF35 +680000,u,35454FA1CA2D9D9A42911DA28E631633A517AA22A34AA4C6E9FF0E16FE23DAFF91E759EA58F166AB3FC8B6BCE8D0B79EB655CFF8C314C1EE +681000,k,35978A68FC50007BE00B2ACF568D6D6E6BF3B79DFF30DE86B29304F0ED7302213A203F3BA229C8843013141FFEDCBED95ACF90AC21FF1810 +681000,u,7F315FA767F831D2B7B5C04F7E79978ABA6D85F2BF33074D57EFAE91BBC9AF10740F36C9AB3E5F1B1E1C64D9A9F817C17F38C4D263F01031 +682000,k,6E69D0C786D74591DC45390FC0FDEE7D1E954B144DA8035000C44A899D20CE5F574E554606FEB992DC59B50A95067602DCB437BAA4B5FCCE +682000,u,45410330D2B18D577CB21A70162CD46FDEF6FCB4491D3B4C103F975F065C331CB475F3A848AE2C3C450B74426084698BB24186D288B76763 +683000,k,96DA2B85C2F2D1C5DFC3D30295695FE4868B69BA9BF1FA04169BC7C232D1D642148238A4BFB0068F930C1A9F91C44ABC05DC8573F2A8D084 +683000,u,E87CCAEFC3F50F41C1E4CC8AFE178822983D810FF1D6698076E29080433C6A386B3B9689B84219E04AFBF1F6AB47CFBE814AA99CE6B126DC +684000,k,CE3A380657FA005E0824FA70BE059AB9D4FF4A7E409692E36B6A07966161B0ADFA1121ED88C8C47982A34E85E74AE203CA393BFCC8177586 +684000,u,D1D2E7211C8476B2D12314967206196701CB4B4EA09F72E542C8B291868B707DD8DF4ADAAF37D8505A7A3AE953508E073DFA925134A43D3C +685000,k,6B6B3A2B61CA241A5AFA63CED0002BB88752D98D1D6691CED95AB71B0C87D73004B8DF73C0F3F8C69B091E710CB5197FCF07812B959B9C4E +685000,u,6624AC6BC1A6B9A5B62F79488FEB48526D2DADBF504867C8295316D6A0313240AAC481E5AEB67E0B63F9B0DFC245B8B2EB449C4AFD36B744 +686000,k,F406268752369A3FA5AE719D83C412774BFD9BDE9E27A8CD5D0AD160DE669957E343F91CC0D01B63DBDAF3234C0BB06EF1E4ABB79B0001A7 +686000,u,CD703EA46E44EB84AEE1D166BFB9E06E612B7D7BC0B99533DB057150DCA0E2DCE8544FBF50583C18C973F083A13C0C660A858DC079BB14AF +687000,k,03AE3182ED3C830C3994C8CA3B7D0337724D27C2115B23C109FF9C58F03331B26590432B395E47334A75026280BBF04C853885A84AE1F7FB +687000,u,559CDDE2A4B8DEA2816034E802F5A13F9D4EF296E9E1A13C7633953763A693A244A6480B9633FA7F5D9990A0D637B34A6E5FE0FEE73053F4 +688000,k,4967A913033F9BA1A4DE08653519D7A1DE7E9D6C3AD147A8C1EDE718D9AD0D54AB6D8C63CB01F2E8E5F8B90ABDFA44407A17B58DCA3CA0E5 +688000,u,446E1C554BF8A59D2D3FA9EC2F7E63263C0B988E04B35537ABA7419AC968328B9E11868502B06B53D37BB8A012BA933627AF879F9B26217C +689000,k,41CB4D589F54698F781B5360C253EE484B39413293F000E98DE2F28307901B13B9DAEF5CE2F194B76235B0DADBA87FFFCDF0C5749563E5E7 +689000,u,6F524216695EF1AA30B5BC670A072E55D6E089A9F90A6DFD1C9159E5099FEB6E5F8F96209288D3123A42438AFDDBBCA084ECB832AAA44F35 +690000,k,73C5A844832284D3DCB933A1C121E9D01ECC61405BA837BBCDABC8172AF56344D8FBEC70379C24F84A34EC0C51BA7A71D13B2402B1F580E5 +690000,u,A2FC5418DDF200A2339F2CCEF9174BCCB51DB815EDFFCB2F914BBBDBBE0D2675B88ACA7CCC512367ACA8813391C594BF52ADEF279E4C8846 +691000,k,5C68B922E62EBD707F1A1AAB3B70BF0F739CEBF2595603C51624CAED2D7CADF7BD27B051A72C718687769C1A35C98B3C945941C7D221157D +691000,u,3CA1B8FA3811C7982AB7B982A768D707E6FF621A70973EAD1DAD5973B3F06C6429C2CF1E5CF7735E640885B094F144E6CAF0F747F975C11D +692000,k,03DB562E34548098E6000BB5E160533B87A9B275C5442A5C4C51E6BD1D33BA332035154E023FBD7B97F016AF0FDAECD9C011784EADC99C5D +692000,u,A72567F7047AD0147E17E51122059A100CEBDCC0E1E54EA6F7901F51A27FB8F3FAD3270FC1CF696314A56E0A7326D5BA93FE3072929949BD +693000,k,8B41736EAFA6F9482A19DB508D7064F45EFB8376D538D2A566D2DDF0F5A05298DA0E466653EB04163C81A650F1318D33144624416BB0A988 +693000,u,27FD0DF4DAEEC257C24C4FCFB8909667E98985A24CCF8AB5226500BFF7E642B1C626CD030D37A857506531253758ADFF2D8B4EC065C29927 +694000,k,A2E5707FD3D7539E689AB3B259DEADB1A8C184FA013B431A21347BC8E53AC93FEA0F1627E60D04E3E7B567C66A1530BD09F6F540CA83CDE0 +694000,u,AB06387B0C101322D18E083069AF792E1F219C3B38AE80E20E258D94110298ABC3B4391F2E10B94A088B175CB8C0716BB3BB4E362A2BDAB2 +695000,k,CCA41C2384197C25E7EBDE7C553E9DF3117CC3E8CA69038EF2BFF2D2047F9618AB0DFBFAA168CE2A20E4B4760809F0B6F0128F6EF315E01A +695000,u,752740411944DFD2BBE83CE23AA4BA586D7DF881CF83A992746320A93FE7C8805D3245ACABA26BD063DDA61A7A0A74775C8B2DA6F4E90C11 +696000,k,39E61FFB342065544F9D5B539A8DFDF86EA3F54ED5152FBFB14664F32ED329C36845CF8DC5C49503E4372F1D6BA0585FBD1A50F214445BAD +696000,u,3FDAB54F3A9D0BB8A4566A4C0E8DEC96D55E45EA9B30116A39E3794FC889508B7BCD36C27EDDC7130A6BA0E78039E391471E1DEE6A12B996 +697000,k,4ECD413799A2DC988BB6B7DA2B3ADCB2DF4168860BC8D1D657E6DC9FD5D78DD80653FFBABF037D21FA523112CCB32AFB0019F08D89D343C8 +697000,u,8B4800C22BD6A2D35DD37ABE201ECCA97AD84D24E30B03F91B33BC423C7DEFB65D1624507F82F152CAF4183DA9C1B95479FE5D524CD2C1F1 +698000,k,E6B10E3736A6B9DEF9959C141CC7B1158E4C3AEBBB9D0CF9C8C8E5F8B3B9A8A385BBACAA229DCDB7381940141192F50A29892871C42FF045 +698000,u,1D5791EEDCFBF2697DB99298ED4938459C1E31024D95CE1DD8584BCECE6892B9BFED4E0896D5EE76823901DB7557905179F13E3ED617D3B9 +699000,k,D6F7599D4690CF64AC44C8DF46A0A29DB683540D09BAA8B33877B4368E01B563249E8452259B72D707B981D9DDDE07E368AB955B3B3C6EB8 +699000,u,8419F5C2D65A1F0274D7F1535CA9B4BD7071CC2E8F8D97FF5B222DE4B168203684C84E4506D8129589B5EE8E37FBF86D520061CD8D7E77DF +700000,k,50FF60FD67E70E4D6EE1F4C7769DB7CBD0430F897DA5FB55702779B814680EF0A306F514DF476FB2093DFECA1DE76A16ABF0B13B10347BF0 +700000,u,7A72699B55C49146F43E1AF732C49DBA7AB263745B861D90A1FA16BD2C680267371117CA6869AC16BFA94300F53A5D47C059DBBB36A7E256 +701000,k,4F77B70B712387575EF47DFC3F62AD9CFEA0CC6CAC2004191B48EB36C982FE8644CE4053CA8D383655A749FB230C9B2E54E4186A0418F6B9 +701000,u,07EFA30F51DC614711EB9AAF4E2BF917823BFD79B2BD25AC1F0F167E56A364ACF82AA3D1298530AAD735405A7E47DEA51D4F168393F56339 +702000,k,E6115880E5633A783FED11CD6E345E808D3B35D4EECE004F5D51891F0B875AC795353B8BFFDC0452FC42D96E1B5A8A0AB3AE0F4DD83B6159 +702000,u,F672DFEB3AA94604AE3B02B0087918F8AE93B086DD1C5033B7BEE286A9091631B76299549797D1D2FBDCC28CFCE6F7E13B3336A7EEBBD24F +703000,k,9A336DCC504FCEF22EB72CA156F9D6C14C5661C1645B11E2048ED6E219B9C730E36F5CA4885FE2339B56ED83ECC73D15500D65EB1C06DF4D +703000,u,D00CE375F8F375BFFE949009814D142A70E8ABCF4E5D795E7600C3CC9F375C51FBC3F2CCA746ACC11319479C423BFFA88A7C9A3D22E72B8E +704000,k,75A6782D9DB311D4358B038139B4F4271FD5B9572D759CC708476DE82BF719E13848D86301B692C95E07ECD32DE563993325BF0D4ABAA5C5 +704000,u,874BF1A1719A6AB094596C807F3A6E18A898E60EE367E0F39DAA73BEF4DD59B9C09191B733DEF6A84FFB602B7488588FFE9D31D8B049A986 +705000,k,745DAED4CBEEE0648269E325EB979B4F866DBC87F0C8851D4E8CEFBB82D2E9CABFFE5F54722678DF18BD6C5EB99A746C2D8B97FE455DDBD2 +705000,u,3CEAE4D02B9BEB5EC77B03797B918B8D0986287360D07E7EDE7CDE1A642C6747A6A06C3BC2BAD1A84147530FB5AB4D4F7FE32FF37148FA8F +706000,k,089DAAAAFA4EF192652E35AC8073458BC1FAC623330DD5F2AE7197D2E06DC0CA0B147DFB671BED87A58E29A081AF7FD5EFEFF79E886FE47B +706000,u,5E69DE7DCE0EA38E655B227979F113FC9CC38317E2BF5AC63A42BCB0EAA038B8D2EA1299AE752E2397A00C09318229C46FEA5D4CF0DF01B2 +707000,k,EF740809CDFCF6C7C74F9F1E05201D05DBB236DED8D04E0712D2982D7004C26BB02FD334DF82E2164DC859520F02DD3DF4E328DF9B2DBBD9 +707000,u,63EC62581BAC13C2A566238A3DF8D3B55DE381A923687E0EBED08D53CA2459E2FDF5F4067BBA1E9B69FA2949E6F83980E5BE927AB53A1C36 +708000,k,8F1C912171103C4B4D5B525B8F358E469187BF9E3F7055D32D31A3BAE9377A5C7D1FD2E7C67FEEC3B37B7456EE552B5F2C3436EBF0FEAD0F +708000,u,32324CCAFC8413DF9A5567F34014486EFF8908798E215B4A9E1A858E9B0D2846D107A01803C8CF0194061899CE44A7D3308D667D57D02987 +709000,k,583023944EA95580EB7F7B21C68398C068556ABC4FA91263BA900A508F56188673CF0DF9487E520AC402B51C3E87FF34D90F05DEFD58C2FA +709000,u,C42F0FDA6250795A5C8D1D1A615B1174BF46D622EB8568BB156C70FA9CC46F396286FD2445FE83825115E5AFC1C5FD18652FF1A8B1258F88 +710000,k,1AE1DA07C41F1360718DF986AAB5512191A3F672AA5A94801C4D2BA9B4639CD9DB9A65B653C17F0C644A76E2E14937E6B7C1D9E44F8E1DCB +710000,u,3156211201733862763A2D02D54C7E1C6132DFBE849E119AEC044EB0D364D9AC52CCA46E6901864929B2E85201BAC4F8FD5BD28F40B7DAA0 +711000,k,1C1AA0E1A15FF2459657066DE5EA6829090CC3F04B94D0323EB6A0D3F110095C2BDF66D59C9CBE381C37C636BA725D855CC677773D3906FF +711000,u,FEB32EDAF1C7C344620B47BBED06689105A376961DA0A0D5F38376278540500E9AF348A7411AD842B69401CEC94EAF14F75CFACDBB7C3FDD +712000,k,E7BB1453CEA5BFA9A14854082FDA06F62C29C67F4878548D4AA7624DA4AD06BA10CEA53BE76D3086063FDEB95E35535F6304631314CD1EBD +712000,u,33CB8571405B996D6DAFF5D9E99EE60B91720F985E46C4636F96B7947172EDE5A1E150E53A6CAD515B131A7D815292AA755373C5FDCF0EA9 +713000,k,058294A3A58FA222C60851B229A7DD555BEF99DA936FA4B553E141D2718D679F0DE543973F51E3570AD96E53EE2EDC736555EEF8B245848D +713000,u,85A6DFC90AD54890F0005F50B51F7BB7D27A0AB2E49C8B5A033FBE05BD64D4745DC58E9684DE2E903830535B13BCD92A84870DDB66AA914E +714000,k,361C89879742FE18731F67FBD574024B14398C8A8FE8255C05F7F858EC986CBE5AF95E3B782CF10688D16B9A2C0983214BC548AF49738710 +714000,u,F20F88C55029825B0A75AC2F52BB697122C3F96DEF9FE583BC593522E531428EE76247FE44F549C007BC3022E2544E4D2410572BCA57DB30 +715000,k,8AC4F447F25C2510FB72D0D2DAD0F788E2606B5BC43737757FC1F07A8A76271093236C6E1E369383A065D31A3079D743C4A74CC9512D1017 +715000,u,EC37CBDBD311AC7A6C5F9026FA715D0343E1150B7473E8E98026EBD2E01B7B469B3F1312521EA4D9EF1DB94BF4C4FA18B110C7AA1A967EB5 +716000,k,4BD844C6512F7A418B55F81592C3D4BBC71F87793AA785D9AA1ABEC92DDEDE96625B13A69533987F0BE3BFC19A51E26ADB86279BDFE118F7 +716000,u,C83F76DE759FB26793077D001DFEB932F0189CCE072064C35C9712E068B9525BE59E08F7E6F7FCC921AE8A7F485E8FA945448A1F05750255 +717000,k,4842FADA079FF3435CC97F50DB80C36C15C89FB2F9FAD9106F887F876CED7ED164FF2347354DD4E8B1B767613E1042CEC37256B043D035A1 +717000,u,28EFC3D63DDA807EFF9B2B805E73F91588C59667D9878BDE02E309C80170DF6A6AF709D51F21CD655D039D7C74501A5B27484ED61922FF1C +718000,k,E5F8152186FB40511DF5CFEA4DE9D0F6A9721AFD4898A95C629F4A6CF918704D8FD817120808F018C3250D060E7637E7BEE08450D8C495BF +718000,u,0206352E26176DBE62E51C85628B9EDE89B2E178A5D9596E540075264621F5A1464C040484834735E4028A240522FD81D048FB46506E1B25 +719000,k,2997F6A3683F7E8DFEA7F088045668DAFFDA27959D7CC2568698AE4322B750F96CA8A0204604D4F100708F9E65CCAA9CCA91E21A193E95F7 +719000,u,286C8883B42613FAF57D9BDF7B4A4497EBE4FE5A50FC48B7B966656A228907E259AFD0BA66A441314DE2726D7E09AF32C39C8B68C44CF83E +720000,k,9299697A7700170BE7E32818EE13F991BAC1F979D87D07B5652ACDF2016BDA3D9229D2CFE31856B39E84C1622C6F816232040A99E13D408D +720000,u,5CE2F39C089517CB001B27D95D18370AA838B590FE705B5DEB63078E59123DB9BE36560B136A2C3DACD1A30972F80A5BB04E19BC8C41B0B9 +721000,k,FB387E6DEB54C3E1D94EBBEC0039894F5F3DF35728198BA55C6F7ACFAEBDABBA43F37650264FE87B9C5BD62F479F94117958A1630667F0A8 +721000,u,42B3C361BBA1B1DF542FC547172B5BD507DB28BDC6713D30455FCCAA4C28A82E6CDC812F7810051246CEEEE13D8D09D4EFEE2BFBAEBE39FA +722000,k,F04BBD3F9621B4386500698638491720F9C613B4A5A9AB6B569931020E93A932F60F662999D2D067092B9E31F3BCB3FFB174B09A8A16F759 +722000,u,2E9C4374D466AB3F41B2B09F4933A836013AE661E340D1F3183A520C5C7D42631D8EDCB2FFF19F66D33A8461135C77F11A742FDC0EEE541C +723000,k,C3D97C31B080AB337E899CC86C3D29449CB45A8082028AD07DE50704A2668B51DDC67A1E1654D42E91F0764D322EC83B3DD649384E1FBCCF +723000,u,7D6294235CE271E8DF3C32538B291A8FE0E4EABF7B6259C30E65850847BEC2E56CBED29407388940E6D962D6AE5AFD2AB000BA52D7030FB9 +724000,k,CCB2D3F10C7E9426F6DFB131E1042CAC896140A3635F8E36036FF8635C33D34FF8B1E479F9C239838DCFC4F6D4C2004D7A7C5F3D2EB0CCB5 +724000,u,CA6D67FAF57661442CD6CFE9FCF0FF014B1B999DC2156D09DC6895D7699B2797198CC9B4F974F333BDFEDF4DAFE3ADF7414B5BE8AB6B7606 +725000,k,053AAB67EDEC7E875187340A9EF3B55F7EBAB475586DF0AD6FE5BFD058A5542121BFCBEE7C61601EABB6A765847120CEA0D2B50007DA0A4D +725000,u,22B2740BF9F780317764BAC4FD65A7BE74D9013C7CB5843730FCD0371B58BAF519B00A84F3E321F0F2B9A9E62057CF718F5083D8D0FCF007 +726000,k,121A72FF24321DB2A17F54D506B01D43A9F62CF8C8D2D96D6EDA8C63DA4DB389BF61D28F4A6565CC212407EC71E18B981003AFD1B1E2DFD2 +726000,u,E8F7C381BDCC79560D4F54F8F12E28E8C0A228A07E63F16C925711454E5E3287DBB566CFA7AC8387A24858729878B43547FD891FFF520F0B +727000,k,40CDD5BFA3F17EB2BC3B15CD9FE0E39677DADF81C7A9905BAA2C251AFFABBBB39A9E30A7CD1512B8567E2F2EF2222A3E9C7BFB8049D16156 +727000,u,07C5E9728701C55E3F8C5B9F550AC7AC3CEA0E0C4EF8AC9C041C3F637F09F79205E0D14E2D999BDD83BB04E76E6FD58B6A715F4962FD4AE7 +728000,k,6A6D7DF6F9E754FB524012C35ECEC66A44782EEA7C600484D3FB1A387BBC2BB41734EF822EF9EED1B6016CCF2ED00F4F82CD7EF69ADE3CB1 +728000,u,5903BE054D74D2C8DF620218E25357169691810387B581FAFA47C56E69B18A51EB0DCD92566ECE110C359B1E6ED972252D5C6DA249721D90 +729000,k,84F9F62CDAA79C64344ABF3C84B58631372A93A59A616466888B259F6CB52AA3B88AB302E6D88185A3EB63D2BFCEBF038141F44F06982328 +729000,u,E04DDED1CB4EBBC2FC9AC6FC4D91597F6F2F8E9584347CBE0806D804B427C19E2D773602021BBD922EF52F68B5A58B71BDB9AEB6482920FE +730000,k,A98EE4499E9793AA94BAC61EFEE0ECEC8568FC0C5DE58F579B8E1E7369C8B8DA876BA2F8950FFA70A6F28AC2D9929627490BCE39D15CB803 +730000,u,A09E21391DEEC643CB142F6AED18A8B912B64D0517A2E89ACAB62C5829773293C119CFBE8074C382DF1A6A84B28C38778DE1BC4DFA698B5C +731000,k,7409FBFB320504506BE642E3B76770848BBB189B66D63073D70C5B5C6F02578352B08958CAF68DC2B0593F0EC955C80EBA88F076B6B61611 +731000,u,C6A98242DE40C7330EAB894ECC5113918732C6A60E5D3AA2D8A300AD98FBC263F1BAFB26FC9D0BF4B9B40DEF0F34D7C96D2918AE2DD18986 +732000,k,423BF4CDD84779ABC43B5069E356CBD3AEF963D8745DC82E7A7057944781C32FDAF6D78A058F559EC8E2E6E35B4590090C193D6DDB8CB206 +732000,u,559D85E22F3E51F01B1E7A55F8D35BE988510264A726CF047F63956ED446C3CA691E36DB58D91252EEC5F0F6DCCDC312D4F572C2F3E2FC7E +733000,k,B873EE1FCCBD9521C9ADE4DC49E4697EE2BD66FFFBDC803BDBC8E006B53435EAD634EAC0A671CB689CF85AE21419886FD76E19B72FCBA1A0 +733000,u,6A0BDE63771BCF47C9A4719120AD4B44FC09A95CA37116CF2889596F42E85B8D253E0BB0E488D7844AAACF281C7F6668209D7DB9B6E3E929 +734000,k,C54879267AACBFD4643AD4E319C7E24DEF3CBBE1710FAF460C7D6F8A89770B98EE887A8B500F60CF3276D8A885AE3E3D62FFCA1B83FBFC86 +734000,u,C0B42F65782F1378EF0EFC185356655C45EAA3DD282BC733065E68336F674AE81F7536BCD27AB4DEC26B4C339E720C1DC8AE153B67FF2B76 +735000,k,62A0FD98371E0F8A4B8FB40AA71FF497D4507AE95D5AA213B582E9BF9218FE9C8FCD8AF6C2C87C2331C4AFD3EA41C4C8FF49A2A544AB4C7B +735000,u,0B22ABA28160283824AF51476ECE5BC13E57CC37649EE584728D54ECA5FED2BBE2C3A727A6F08B774131400F067B53E2813E1626BA976FE5 +736000,k,C6A2F9DFEEC7FCB87A969E4AD59D125C596BDC37B529A608C5DF8EC43F5D3E64B9C531C86C71145E754FF10634B80360AB32F020414EC2C2 +736000,u,9C0265558E52A90DC5D87998B2A313BAEC85DA5773108198E09CFD8A0C950FBC588F0CF949A4D182356122070016D5F165A919D762A85793 +737000,k,21AD4822CF10332A02A72FBE1116BD96A3B652DAC0B74760C5C380E28975225EA60A9F8A2BC6893857D76AC12DB5EF4B5D35F7E50135F013 +737000,u,3DB03680748EA5EA554ED909ACFAFF235B2B735B3C977DEEF94FB6F98857E44FA152D1596A6B8D8B2C44DEA13C5CE6268CEDCC24C0FAB107 +738000,k,A383A82A69D6C5A73D7BE1F9D9F2ECA732E8560811CFE45817AD85CB01B9E8691B95903A6A48C343AEFC752C81696E40CBB97306E4FC8273 +738000,u,CFC67DF606B76C9DDD11135FB6A01657C055BE6859ADCC14151DD74540B66C580E7F13FC9C557A15E440A94C434978B18031F3DEDBCA7CC5 +739000,k,49B4E0E7245C9FB59ECC82C355AC4E93D14F2A2F61D799E3D05F9D9B7E69F3305513C585B73691F483331AED5B2883A7B3D3AE10526CAA80 +739000,u,AEA2D4625C02F45F66DAAB00F7C78381AE2158EACE63BD1A0738327238F337E9EE7F90EBE037CF67FE0836D5408FD47C5FAAB59664F42631 +740000,k,A45B58A801DC362FA145A7FE142DBE64F2DBF3ECD825438381B1CB42CE268AC03C0AAD04F68BE4EC41A5524A8D6D3CF6FF8697EB82813476 +740000,u,7FFCB4D940C3E8C481930DB0FACDC911BD86B299FFB1B7030FDFEB5F021D56136288C8FA0BF314C5604BC48099B006F744C2AD53C72FBAE0 +741000,k,7ED709416FFBCEA40CC05F60EF7DB7942F319EC75CCF973179539760CD44971A8F1F0037DC6CB913BB0CF67FAE8E8947286BCDDD041505C0 +741000,u,661939EED39BA52D1C8CE2BED96E5778E2EA4E65CB9AE9FB33A178A18A9454615D48CB87229597117383F1B6C242103CB16B689DBC243C8F +742000,k,B82D2C5CC2B6DC9DF986B27BF69CADD2AC7BB192B150FF6ADAED87B505C21682AC2050864EF4EAF1303CE6443129C699EA33885520F69EFB +742000,u,B92D65B88625225C86682235ADDD5BCC73C36B8F10E9C6836CFFE96E18EBE87C2B4AD80B912C1B897AF8871427277C41C1A8EB46BDE5E6CC +743000,k,B2E84AD73CC748A337E5E5827F3EB8E955F23C81A57A6A2BEC8E7276F72D9410D0FD4660C7BE1154E75A3626EF74F161F259AB8E6EFEA49C +743000,u,3E81609E8162967B8DB207E278EB62C1C2C4449266FDF0761BD9CF82C95BFC259AEA0ABDFF35327372DB9A4967DFD5ED461FE5FE063CD0FB +744000,k,FECB47D0984DE786EDE1B269461212B4B9CA97510B3DA554AE1DB17622BD3C79954791538565BEFBF0189881449277987ED961C096354FA8 +744000,u,FCF90FB5C7E8EAFA5454D0E51C9034BE7E7DF16F589A8B594CF618DFBF695DB0326EF5719F911F6A3FDB5B4685B915CFC372C34C83900E3C +745000,k,C2813F7318C7524834C820934411D8CD057D283CCCC4F33B7A71F85FD065B49355751E9A67A03599EF8243CECA64839A1CE1E03ACF9AFC46 +745000,u,843C0A3D6A2FE04A798F703A6F08A5349477135C23422E28C5AFF2F5053C3C1F278283B7191A3A33F7235C29EBC38DAE2D597AB19F8BD21A +746000,k,10C2C562DB892FFBD25E1CA64BD1CA91D388004610A9FAC66FE0EC03410291970A8088FE054AA8117D6233CBF6C22B0802B4729C1674209B +746000,u,46C374CFFFD15D00BB1F6503CFB7524C588D07B648BD35324F00A3DA9B6DEE0CB36AD5420ED58BAC31E8A305B39B01A8002AEE5D2A25A8AA +747000,k,B3C136A8C792D8A5707AB8E0AB2B451390A8476B9C9C3B7D7F6CFF4792845C07D260BD2D3641F331F01522584BDF83FD342EA678E1D71251 +747000,u,9E81A3E969022B5087413C7E14599882E5D88FEAB067A10CB945BCBFCC3D3A27CE1EB7DDA0E8B8AD45615D227A7860B1B5DF18776CAAC019 +748000,k,A1C4D4B8E27D5D58CD940267B25CF9AAA0E0A29BFA0D630C771AB56EF8067CA162F98A1F73D4B8A3A552165D941C82D4D89080CF4644FB40 +748000,u,3492DD3FAF5BB9D9064D053E66F89AE1493FCCED2A516908B4F6626B4CACFE1335B9CC642065FB8F6711E10E43B58B88E16F14A774697229 +749000,k,C1F8FD5E5D65746AE9A2870247D87E06F33DE9D4F77B75F74921A37E6EAA46C9C1DDC39B2E4181163AE4BA324A79897976DA3108E8E6CC5F +749000,u,1D4D588DDA3AC630456514251EE35BC1BCCE1BA6A930D6B49CFA38FA0B410683A9D27391E46659ABB42DCF8DE014459C99E46B3A3248BFD6 +750000,k,EE5B6516EFBD3C15E1C794616680E5BD5530F73D2DB9DFF260E5AB82F760FDA4D7435C3C007A5CE29F3508979F909FDE1598BEAB97D5EE4E +750000,u,6AA97027495866E9F99887788C7431920AC7ECB29929BEEF117EF6C461A24FBFD6DDADA9653513FC814645804F0C947B7C2D52DD3AFA454A +751000,k,BAFA267985286C12695961D514706FA62164D5BDCAC895122291AE806A2F8C848F4AE4F494E3C5B2C9B8AB9A0481AE735DB9C28581D64D9F +751000,u,8D48FD90D92F2C0B797E6DB32474470F097A3DD1B4758D26BE1755B14430AEDBE70846343469AEBFE42FFA23DF4B0F8E7A95F0F7D77C5804 +752000,k,779106FD283586DC89CFCDD43EE203B6C726EA6D9CB97BDD040AD9B2CE661540E1F16A2D0102307C13F76A460BDB978D37889E4783C04AD5 +752000,u,D52311D589F589F6351CF3D5CEF32B78364F94CB1B3A2750DC518005128F16533BA2E80E521483C53F74DC4A989CA2D1FA6EF1B6657EEDE6 +753000,k,9B53BE6CEC9FCC90B0133213D17A11B719B4EABEE0A097A3775FF3D56EF94669F14DE26235C792A734987050A0678754BA1D157CB81DDAF5 +753000,u,1BD8C3D1B609B590AE7E08FCE4B8C57BD3F6106CC1087B2A00BFB7390613D5E3E7A89C793E0A98AEBD3DD1603B2FDBFC04105E6B48D1A00B +754000,k,6A762233B81CA07DDA28695E45E7C96CA26023DDBBCC0461B8C659EF7C5E7D0C6BAF20BF8CD411B6C6F93C12E3FAD2E76170559E091FF000 +754000,u,60C6A35ECCB291E65C6AA2717E9D804DED4D3EE136F0833D0559241305048C82BF5CBF429045B72F6B8ABA6E62F454C4F7147017F5081D8F +755000,k,56C8408DB569EFFE37C7FB43557CA32F3712A20E84F94460AD5A2A470FC22479E1AB2E4AB92BF36E1D3F692C5224C522B6C56159897D9143 +755000,u,3010A973BB30287B609E9DCEC16F25982DF152EF24A84842B534BD070F181F131057EFDC64ED0181B195AEB849EDD8E2E8B156D2305C8D09 +756000,k,92C0733493A1AB36BD7C21B0716F1C66E84CFDF90C9DA99B99CA323064748EBF0B9B0416C8B6616156F36CF1A7E4E90297D3E9904B6B7E97 +756000,u,5DA0F6E6D3E68D7646D8C2B801C03BA4CB84FEEE0811FAD5338A6873DB9754FF0423074B35B228BEA927D3630F5ACE925973B6F0B51E3898 +757000,k,EC0CFEF6F664D30ABA972A21F1D82AB6CFFAC43A5E9B84EEDFD1F91088068A960FE4BE9048BE90FD7B76BE4F1EDAE3E75B64DCE3F4D261E7 +757000,u,2124B281E6A776C0448CC4F3D375EFAA6E61BAF57749FE861E6D339B3DE260E5F2E7B81861643BD40C5FE2C0A5C48EE3E4B6053B007AC9C5 +758000,k,0FF5CFD4CA6412679D98E1DC1312FF48B7410FCA26FDE1A3B99FA731287516A0D2203DDC5A5962D0DDEADD36811C54EE60557FF48EF92554 +758000,u,3F56BEC3976E7A8F12094B953FC54E88E51262F6DCE4FA0E7731F5A33BE62CC8E53E074B1F2A6C7A7D6E9EDC446E4DC88309C63EFA3B712A +759000,k,BE8DCA4C23022044C53209B97C1A9177E3F1ED7333C3C4C0ECF0E6C28129A2E7CEC44C53C121A0A3C4F0C0700D067565E2F4F96BB84F3BB7 +759000,u,4EC9C1C1F61B51A56524A5D46CEA36EAD4013B011E2CFA0A75B6DAC0656AA8CEAE465DE6F0E8DD726AB0C5A9108EA154C98BEA30A4410FFC +760000,k,8150D6B8772911945E039A875C7FA1B34782933B76C8E170571221A24A9879EA9426C69AD8E742B2DF234A722A89DA12B2967715C27F5FFE +760000,u,E13CD828DB9008B9BB09C8ACAA304522569253596EC3761FB984FE0ADA6A9BB23F612B6CE9CC5AD1A057E3567FCDC6EBDF3202E041CC1A10 +761000,k,B61991ACD9A897C6818953BD86645BE52A5EBBE935D761B7F6CDA923DF02608656C14BBEF33040F580FA8A8241281319080977C91D2F8A43 +761000,u,0E63854E9967FE02872ACD317A25EA533BEE8A5A87A7979C8C3327448566994FC1BAE28FA52B9B30AFAAF0FBFEB7F730DB264D21E237F3CA +762000,k,DEE9BF81CE9412621D9AF6BF5167E6F3BE45604499EA6AB6CCD37C1FAAF41746F00CEF5AEE6F2281B1FA3E3F51B5EE1B0A9EA3740E93A9A8 +762000,u,D2AD398989AF754D4EDC39E737273F0A23B46EF46C2AA2157972DAF14A18792766F422B851861D85C1F88500A6293C1F5CF3823E63A75F57 +763000,k,47EBE65DEBD389270707C28D020A23C39A25F08096C204741DC5742E4291C6FEF5AF587454E0498DB22F913FCA7858F238B47D9313807CE1 +763000,u,5C550001A73A4D668031D5E485914DD8C7EDBC05FA0F5490CB5DC066080E4C99DDA7669B6DE79EE71D99F7D5D68288844CDA8C54BFC0EBFC +764000,k,9C001CF8110B3D914C8FF78A2A6195CC3043D2003590D5E0FA6252DADC3E4750F05CD478866328DB016B74334037B5D1F64FD4EAB06891EE +764000,u,875ED4675AD284810AD9804D997703FD9E07069311BC1DA8802297B5034A67D27E045E74C9610EFFBF8465BC186A1CF7EBF903075C152C0F +765000,k,4841643783D4B5689CFEB83381382171464BB0007D1C28A83DFA79F68D32287552D7E322923520E588084BCF6277AB8EEF3BDE6B1DF91A8A +765000,u,E9EB0BF040732F72FEF446AE62E5DB79C3CD9439E653FB7964939270E4A1C1BCE6A5D1E6972AC1840177F8618E0537FE96A85FC41AD8D99A +766000,k,15AB43A4AB3A721835DAEB26DA277DA8D86ADB5022A4B3F33815C0A0CAD7EF4B72C613A6D22E91B2EB87FB8BAD02F53990634C29D81BFA7C +766000,u,E81095CF431767B29802FFA756477E99F38A24E743F7E02F2D0275CF86D490B24E0C6509069B0E47B6382F5773BFF513DFF72E0780878472 +767000,k,A724E16B08AD6425D65EEECF05BD37DC3F104F02B29157A8B9249C3DC0578042903DF62DB41A3648C83198533F0F4A3F3419A40584FF33BF +767000,u,F081A2336706F6FE7292B255A7D3A2704B6A203DFB85966692BF8A8EEF0EC820B3F6BD4DE0FCD58F8956A79B5199860DD894E313CE9D4B0C +768000,k,52DF5439F69070D863ACAC37DF5E80611037EACF8FFA92E60369076690F5670A7AA4027AC0DA359F67D16E3C1AE6A8889D2F296FDB491D0C +768000,u,F95F147392D00104B5C4BFDACD6F3298BC8579D75420B6934B81B5BE53126DF37276D8B2423B775A8ADC584FBF1611C8AE0B68053BC48DCD +769000,k,71ADE4FF4648A0C510B3F195CFCFCE1634DECF06B560A27AAAD27FDC3EE8DA8ECFD073A99792E2B289414D6B53954AF687750B342622E984 +769000,u,E466EFB0F71E584F8B345F44BF85747E77DF19475C409ED32206A8083BB88C7E50B5D8F02F3E65FFC9A66E1F3597A03F73CF47616843778D +770000,k,1D3FFD502EA4507434FA40CCE4CB50FE1AEAA63831AE51C343007307551B58DC1C87D44ADE79D1444FFC7D2A256A9515C35A2FC43215179F +770000,u,66BE027FDDFA2A8C4FABC89C0D81A7CD79649EC1AB98ED4B9B9C845411B85F590A68502A68B5994916D466EE46AB606FB8C7771A1DA6C925 +771000,k,6DB31243FF11479C05C5653F5F2433E65035D634AB5C12CE432D86BCCD4D02DC058F6C89930507604E20149EFD6FABED4DD6E5E7061D33B3 +771000,u,F777EB2C86F9E0D8CD23FB0191D57AC11D3A4F7B0E8D66EDD1801776DEB4572A59324D4573E0361C27DB48EB292E110F7CF54D900A2E6064 +772000,k,79680696EF1E20C1D071676C1F13B11D30E343E3E4D41071189898F60A4BFEF8D0D007FF38C8BB80767336629FDD3B30DA3A84CB4EE01073 +772000,u,4698FCF3D78A0238540CFDB46136379AE26D3944C37D79A1668B3D57B9186C2C71B6AB3CB3720C1AF5C771F79CC730C70F36F4AF09CA4197 +773000,k,F08FB731A74FA323CFA32CE9A4C842BD16B6FF109BAAEDA2C97FE0AC8C1CB5DB18E454F3E5E352EC126E09D2A973D554669AFE7FD2C5904F +773000,u,73E0AF4CCA5A3D7DE4B267D666D5A3176086B8A2DC492DAC898E6E4BF0AA83F307FB629C5ABD72B6E5F3178828661BCE4890F3FCDD2FF5A3 +774000,k,B226F8149AB96176F851489CF5E116A074110A57B885E5A5440BE56991B516B3064043408E35516AF08851E16594086A681818992F55C9BD +774000,u,32AFC011E1333CEF79DBE948DF24457E68C507A7289E5AAB46232CC66CA735106789A87A18A91488691DE8A2116A33DC5C535E1A44B9ACBA +775000,k,066F1242E56A21712B8A70F31836DB6D27EA2238A0E75D052234E836816AFB1637EC795AB93BF0343F1769E50D965C3DC4F1DE5F4456B6E7 +775000,u,97E9B342E2813159BBDB44E3A14641CD23C43072219E4AE59B92DCCC23FAAAF5C5455B0C6EEC5D36679DF15A69A3CC783E72017918F7D9D6 +776000,k,04439EFCE8D0C5052C3BD8F2AA0E2EA138C81F63364CBEAB4CAF31D609ED6A199E42817C0EF8F286CB2D465C463D330005D21A814A08F340 +776000,u,CB48C06A41DAC8ABAA9F40C20FAA6E3555956F63F5904438ACE0111698C8D4C4CC150F07FBD54207A97CDE8FCF29E17BBF2FE232380207F0 +777000,k,752E310BC8FF31CC6309429838B6B5F34F7BC9AB8978CE406EB5C29FF72867DA5146647409E68498587FEDF5EA5208AC20E2E9D54387162E +777000,u,F84976C4A2F783F19C87BFD90BC6731D04F29E292FDE1AEA13905F1D04351EE916DE8A67517656EC89F66B1C57D2046D7E8C78BC9405B59C +778000,k,9F24343D970367C01D13054631D65F47BACCC7F45E3F5E35E581AB214E1004638FDB95DADFB5BDFEFB22A580A3AF86569BDC4A2CCB332BB1 +778000,u,06724E76AC1017A8EA417F134FE54FFA8FE660A175B777FB2D44ACB61BA77A4A04A980B9BA85937532FD39C528EE7D0F9B789573A3218657 +779000,k,FE6F8A9AE3BF2012983E04BE202A2928D89DF542E8E56953837C52F2510346A060F8B02001854CFB1CF1EC7875404BDAFE86B9311AB87974 +779000,u,82F0D17BF5BF55F3616AA0F24E5ADE64757A82585147B674D3D5D38DE1C54F0B19E2E2006A7FAF773C43BF94F2D8B32EA1B0FDC692DE3A80 +780000,k,A576F6CD97740F5B28C29D6B800EC4D69DCB6FABF5590CAA27D0FF0BF14102E0F20C982E8FCA9FBBDA623C06FCB48A382903EA92CAB9276D +780000,u,CA53BA715C592BCFF196F9FFC022EC910B55778652C54FC6E9E7C2B6D59D8291B9FABB7E3D8945588A679A49AB6CAA1CF5DE7A35A53AC7F5 +781000,k,CF8FB7495821CED8D65C25E6BE0A7FDADBA876D1ABDAD3C3752B0A68FF360A68D50987635083F30B6DF6ADFA0A95543E4CB06305C2085D2D +781000,u,14200B0EC10146DAAF1DB95905F7B24C14CA9FAD6F7181A57C64ECDBCE50A05418F8A7029799CE2EB52D1CC4BD1EAC6193A295D6481D092E +782000,k,34187C69F90B18C070847B2CF6AF8C11B4E168BE02E1699D7605F4B22EB362D48AA68966E215ACB7B1EF1A83F563877782CCE8F54F6A61CD +782000,u,F2513F53DFCAE52A6865955689199CB9B21FF66A3B19A3D06702F4D5F4CC2027A36AC672C4CD0FE631A35961181051AA99C9394728CA8B07 +783000,k,EA1E0F2616D682127D0CB29C210240BEDABA11A9EE8E17C6FE09ABD45625B779B6A52746A7F0BBE8AAE8B6DAC928BA64187A9C7E654DD28B +783000,u,8D9474D1091A6F8214A77CBA382C0AA1814910386563A6D675B7B53324224963B06E64555F037DB9E58AC8AF6E673CAC7CC12767163C0257 +784000,k,AD658A90FC792E818AEB8FBA17556CB2638C0B7E5C319E9678BB884D63DBFCBD86D57BE30B7EA19AE4C3669C0148AD84D02C7E06982D0829 +784000,u,098E814F553A5F70445270722ACE41FD8E199C4345979B890A70A70E81A6911C454FF585D4D335D24C57C175CB5DB22DF3956E617A5FB3A5 +785000,k,0EA8FC91A08256C47E11F3F6B5ED64582E87B6F4916C990A1FE77CC0A489618A0BECA05A096C8E9B665C55FDD2629C814FC93F64D7910A6E +785000,u,3B5A3C75A0CF1F0E354E47C8EC2A3685E1EC96FCDE3D52D8E346875F67ADFE042A2CFEB714769357D69E1AF21FF030796821E373A4F4AD64 +786000,k,9287778FCB20638FA70F200692A073A3947D4C8A26D20A531D5E2A6EEB36367840E7A4EBC41E6293F4BF406A026F5C057AAD6F0E077B7E96 +786000,u,A9B14D8039017DBD9529002630E3167B9E2616B1788C8AB467036333D24CD2B22CD0A322C445C2D17D26F7F8FFE12425D39F9D74665B5E0E +787000,k,EA3B8B7001F7984ECD82252AC85B03A306F36F4162DCD93175330B4C6968BD9AF21558E1FF6D204E3699B7B2655C2A10E5F8CF4B5476776D +787000,u,6AB6AF33E10B21F2C4BCCC488926CD6D1964AE66F753E5B4BA9BE191FBCC66E4FD96F4C840E2688056D2B41D37627DFA95E84D038624CF0F +788000,k,227B0BEE81F3302B9E8BA1041C2FB923CA91D5274A817896E32A23C65A3AE8B269DF1452FE5F01626A699D60653C963D12BE8363B419472D +788000,u,EDA881813D16C72BDD19E44F91709EFC5A8F6A0E5D37A26589D74E25EFC0B5712AD7B8647B3572D35AEC1E588DF87E9D3D4566911F1499BA +789000,k,A1EC9553FD7DCC8376437800ECB5EE98141D995840BB6B9DFE6E0A36692809D309C685EC8A98A88B61BBA3E39D339D12F716E5D6B9A72947 +789000,u,EFB62A555ED6F4A552AB3973E644343F28A994B9E66AFE51D9C386C9F5BB3E075954CE364D516C0C32637F1908FE6D7367CAC395690C960C +790000,k,B3B8CA162B3A502D1DB19456B2EE3F2C1B16B8E9EEDFEAA165DF2A3410881E109FC248B9A077126927B794E293C3EB1CDD92B3D4F8D192E3 +790000,u,F2736799AA670CD819563837F43ED9B34996A6EE13D08C161339D624C41012DB170547D4E8C3873A2F576714D81B0D0B50BA0F137D8D22DD +791000,k,DC29012BB0882681B14C1A9BC997050F4019F0AFDF8B70B450A6AB401923A7DB1CE501B547D885F7BC5FE05B6935DDA6B8988FA0147448C0 +791000,u,EF4E89F8044941E1689D407FCC44E2927C1C523CF56057163D81676C099D9C9ED615CDE0A0785F66C4BD263BA66DA14C4BC797DCC254D2CA +792000,k,D8D5391418FDA24E1305AF1C8D2761026C5B4A1C6268734A1026C8D3DF041A73AB746CC98608FF432FAEAD47EC2C855AF4BD1265274B9483 +792000,u,2F258E4BAAFF580C287D8244D962B1A2856DCE2985A56921498443B6CCEC5ADA71E837CBB3BED7C977FA5127EE36B86F366E6345542044F6 +793000,k,AE28BF8D30C2268C95042F45DC7E81C7318FBB765CB0649AAFD31921814E512D9257F3E49C5A4BCA7A292971D8FB967120951E8C119A9562 +793000,u,F200CA0654D9C705738710B24E8233CF2FAD2335903A8C33FBC433039681DBDC2AE37535E62582B302E8BB66A4D248F811B95A8EB8056C45 +794000,k,BAC15D161495AE11CD592782026023DDB46E430AEA2E95D32857D792AAB756C349F5BA9E83EB88C87EAFABB5282548C76BACF7BF18613B88 +794000,u,1539D659AF5943B839E27B8A8CB370FEAF5BDD59C012052D40514B0D538440F9EE8761C9E23248D08C70CCC49268258A9DC9AD2EB7FEBFD9 +795000,k,4E24486A316E3A71377762490F2666E77F99763758573303AE8018E7DA637ECB5CDC78F9B37B9D249DAC16824A4B5F5EE5C02331ADEEA481 +795000,u,A9E2FD65D5D5E707BB1EED8FB39FE44A7567E12461A9BB3E8D7AC9521F3CFE453083F624D25E179E5CD27BECFECA328DFB573BCF207D0D8A +796000,k,FACBB1C996CDEB3FBED6DB716868533CF55E2BFFE355D508E789ADDB6D71419C410D6EE847EF293F5D78F14321706C796DA54B553327AC43 +796000,u,80A46F47CFF8F34A68865E336EC8FB747DB0F5C8E0A398ACEF936890A8D541069FCC8BA3EFCECD70448CFAC67BFA7F56147ADED3BE97C83F +797000,k,84FC00B93B825459159BA7ABA2A4CD620E291CE1ABB970431742A0F6138682DC5EDEB464382AD9D8A3130FC47C93F864E032EA96094B1D15 +797000,u,4378EE04EA275BD5525AC89E960CAD7C6814C3DB78A380FCC2DD68643EE79F27FB1C71600624E658DE260DC4C056EF976F58397B235990FA +798000,k,C2EC5ECB16D9B45936E1A9563D7E62A9421C816D0E2289849DBEA68BE5AAD7402209D3B1F8E09BCBA51EE8898CE272E5A1D40D05D5D7AE28 +798000,u,E3CF0F926CF3D0C4DE9722FD2472A90F106CF82AA0934D44723233A59F25040D1C39D544076D816AB7ECDB1AB8F018A72DFB0F3BF78606B5 +799000,k,F636A16202602A1917A8675F0BB5590829CCE8663A5915441BC8F7DC0635F3866D062E034BC7BC7EC9E993CE511FCA1F2EF8434AC7A1DCCF +799000,u,0BF49AA7FE22EA5A253E0B2C12FDB88ECD56E0A2058B40353479E9735C14338CE119067CD8B531E4D75855E724E9D554F9A03492A752E67A +800000,k,AEDA04386FDECCC6ED2C8B48FE81824F153677DCBE19951C577518C42A600523F61A14CF247E36A39B242A0EA338D013A2A6755243A24C87 +800000,u,71839BD2177C7626FFBBC488DE73B8E252C33EDE4E9C702720B88C44B73DB9D0F94B0DF17936260CC75BBA3F5FB9C296D35706F445B86DCC +801000,k,5DE7E7E74F1D9F85706EE78BDECC3A780465797213F1BED99791F3AA76193DC32BD2EFAD4428CB07420322AD43635981AC97B6BC853B30F3 +801000,u,92FBE44E21AD47EE6F6041D07A4AC36FACD795588A67A8E94339BFDEB7DD7F16B0FA5CF869B03F767EBB074C86F47E3DA99B483809876F7F +802000,k,660ABB608D7C880F99A7BB87CF9019ED2F28E541419542FD85FC74C345DE6484B6EE3C2A1D7C8F855F6913A8860BF1F8CEC7B5AAEF79C371 +802000,u,617F231D1EE95232349EDCAB3587B26CFFEF504C849000C03BEEB6F2FC7834CA16BEF6EAFBD97755E1E32B83E3552EAB7EBE1404A5A704C3 +803000,k,3A8F08A5DAB0A0A42B28C8E67B65660655D58EF8416159D8BDF974A97878209B8BD3965E4ECDCEF8A1DD716B1752E0AB2C2BBCA483E34F71 +803000,u,68F36AA0F69903596D0923818012563DE17AA0516DF1119548EB150B7019C5E2CB1B442DC61694F079C633B80352CC4A1812EAB3CB6270F7 +804000,k,7B09CF11D2108B2CA216B798418523FB27844B9A688DDCED1B9F91D84BC1BFCE3E50919DC182444EAC3FEE2CBD87F8E9A97E8F72A0B2884B +804000,u,432C3F2F021BEEE9D57CC4F669DDC1A167368D0677D01BD0B7F6BD9F2CDD29C3310AB517FAE198A80CD7B4B8D5B13EBE2E405B1BF645389C +805000,k,30A8E1286A709A11C245929F4BD73BC3A754C36A2B8B9B6BC6BF5D468B88A075511379DFC8684782CCEDDD2DDC2C8A8F0D3A92DE703FB070 +805000,u,D9129D022927559157DA09A1DDABF0DE1D82E6E22A6E224FB225083B70D11ED564A3FB09621E53B1B1C618F729EA3845C927338E6F79FFAE +806000,k,A9869BD81509071DEDAEB14F6CF82820A0C35F9C427A7191D1EA137088F696373D4B9852475F57447AB82A8A8675B056299B20BA9CD31206 +806000,u,D3948CA286295581E701EC048F3BB0623462E4C1FB01FE58F29905FF1AC692D671A8C9EC08A47F876E3B54921475428864D60D8EC2909135 +807000,k,B2A537BD67AEF72841CB2608A1B7B72B14C0234140D1F1E1E3FDDE48FFC35197A2178F7FAE3CD4B1EE818C529B48DF9B1E7E25A81251E11A +807000,u,251D09487686E7AC5CE766CF3347F6885F9740F85751E78BD27F00E1157B899C52FCB09F833BE96E8DFDF03BDD0DCDA76E0897C2DE8FF45E +808000,k,C7520FE0B682AA6E4ADC075060FEB99C7F9353A246EB8D4A1A8B781235ECB2BD70808A3D014E6BEACC0148747AD9F1953C4C8C87E9DE2B2D +808000,u,63E11C8ED64F48137F5D11147F803F68C72B5C215E348C7A5F46379B496F880C99765E664FD652A7E5C9E68DCD0B53E72EB2928BFF585A71 +809000,k,657F70637EF3E1FAC4962FD14A8E557174112D78A941FABEE2AE9ECA46DCC39AA58F2F5C755D8DE935EB5E4EC65605EBF43F4FECA2B1B10E +809000,u,C10F63AB69C74DE84277CB01853ED18C949CFB569198A843A37D9188E5AD2AEE790542C225AC830F31588B78C73A30EFAC9A02919A49B808 +810000,k,ECD2DDED03550298B3ACC34980BD6684C3C62E8EB7B813908933ECC94138ACFAF9CEB30254F711C2FFF394DBB047B0748DD62A751AD90EA3 +810000,u,2B343576166FE36418EC8702667CA48C8E3ABD6D4890EC6582D96C248C6C80346A25556DAD82BD1649127F38F4D87589848F7698AFBCDB89 +811000,k,9146DDB8DDCD006C3EEFA55BFA4D7DD30777BA7FC5ABF0A6DF3CE5FF0023A4CFB6463E868D1D735E2D19C7FE53ACB71624BA284AB67B1425 +811000,u,45795763EB408C3B4D8659ACD28286BE615273F26F50364BE1EEA406C1F68E2A79EB21388E12677F4910717B5EA37403A3FA3BFF10A846C0 +812000,k,352AFDD8DDD22B60363636834CA17CF476AC6E9F02673C74676355AB4A3D59D01EEDE5A3EA3EC1F16A22436CD852A0E8941AAE36D5FB871E +812000,u,788F2FE7E52AF3AAE239092D318E88F67C585671F0C85D7D5F02991DE93D8AA913DE00279BEDC3A5BB8C774AC2F1B72765C89C1474CD8FBB +813000,k,966F2C628965D537ABE2DE6AEA6837D4F61DF70B0E18D71358646EE25F4DBB7A65EF19700DE1B55F19A361BB117A351EA87555686AB0F1D8 +813000,u,CA14A89065E8FC4EABBFCCE45F168350DD34C27F352096E8AF9D5680F9E7DFB830EDEFA1A4100B0D070C4171619D3C2D00AEC3228FEED180 +814000,k,278D48E12BC2E240CA85096C674022879F8372D3900F358AAB85F413E82C06124B03B27661303790BCEB731E5D9DC1D779D9CAE02D8C5390 +814000,u,7F35A465CEE043A9360FC2FC3EECA8CD5697AAE2F82FA82274480739811BD7C8511B4E2785A1A5D93F983304229307512202F763C1F7D169 +815000,k,41876BAD6FD16BD96449D3BEE2AC5816483D2777D20F4658E02F506882489030DFE73199E374D9D6C823DA68B7FA356757CB99F6BD89ADD8 +815000,u,891FBCA54F30D46487FA2A018ED8DE2964B0FD47145291E478B768141D565E78EDE791FBD1B573212978AB12ADF7CCE4BEAE9258A2ED4023 +816000,k,5DF40CA2D394ED068B8355842963EC5698930D3A1B96EFFE48CD94B433F9ADED0551C3D6A248BBDF3BADFE6A608EF6CF01311E3F2A4FCCAB +816000,u,14409612BEDFEA837DB94BBF80CE659478F0DAAC8476CFEB5B77F06BF770C62BE95506122B3547E99AB310DE0D6D8AC80572C0F924D90555 +817000,k,197E43CB9F11F2F813AA60CCE8E3CD8666F60D0AC60CAC5207AE50E067D275BB4BF91ABF00644A0EA80BE150C0965B799496129DBBE9C762 +817000,u,2DA85BE648CA993A6C0864EAB595BDC2C136EEB4CB6F7B010438C7EC09C445EFB5CAC410A7D9642A371970807308A27B72464A830CF976DB +818000,k,45D90348631B5BCAC2C6F22A460F0757E88FF3F837164082860BEE6C8816CD26F3D0FB0534554C1C9073263585D5B50D4D8188CADC95C106 +818000,u,77509F245654325D7435E02FDC4576DB76D9908227526040E54DA22FDD4995C240C5DEF8D0A2092DC0FC71637B48C9EDF575E531A11C2B71 +819000,k,1A1C88088BCBEAA9869D9A1F107EFEDA54BB88D08C397C9AF88771C8ACBA77EBCF2F897AFB47077B9817C2135E88673B7EF22FE126C0DCE3 +819000,u,F0DA028901D52DC5E5E504A5D87105EB42E55D0CC5EE8489DE2956C032F1DA0871FC73F63F68089C814C6202ED6B5BEA4095F3984CCDBE83 +820000,k,5C68D327D1FEB9035D00E344914FBC180E3440E5556C9C6F352B119F750A917CBF2300C9D29818B9A23F32694C8A0E6CFE27108C168F2FF1 +820000,u,3439725A012B6AA806E81DF252987BA88DF6AE2A7A901E62AD18F489E95F7FA1AABAD0058C64E21D5BC1EB3C9AA50C38F32DCCAD675CE2EE +821000,k,A35D59C7DEFA62F7493B7F441B10F63CA2715B741CB3716CB6BC6F7AC15690FFBBD3A37874BA4955C7F335B813AADFCA5EB85D1CD8EDA423 +821000,u,7258AE9999D221A22B1EB68B97C83E55FA147923088936EC6F7B8E81003AC30812C6FCC047A9524A35AEEC6525D994050507A8CF0934AF93 +822000,k,7FF8BE9EC6E25B318FF06424C534B9729121A95E0C45D1EA2934DE62D6D93717E29B5E0FB82D027152655715AEB49CE1BD68182F274FCCD0 +822000,u,1A97709A9EEF7B52E4866749A086AE23DE8D4AB29967D70BC904F58A544FE375D654D1CC3B6340CEBEAA3F9EA69B27E51847DCCB0DFC9B23 +823000,k,FD1514176FBF5DF2F2A20485DECAEB95697F9A977105F9E8B76218D0B31AE82040A356AC8657889B018DE354C5A4EA213130726068E54615 +823000,u,891EEFDA706F90FA6FB26AF0981A7364E8D26508A3E3BC336A7DECADAF8078F4120ADEE65A0DADFC3BE56D9E3F44408F9158921EE62F97E9 +824000,k,3064531B53A38C53999ED6D8F7F092305843133ACEB8B00BA9568289DDB489D69F4E1B9E64F3DA12F96D1D89A301A606DA52A5AAAB786495 +824000,u,89496425139DC612F567FD0A57710193B04F425D5285A12EBB15797DF968F62246E5119E1D0F0735551DB6DA3DA8B1F4D39DE19EA1BF6FDA +825000,k,712A0CB59E60A4F47B65ACE46C78BEE24D35480EFC3AEFDCCCAFFA9880280A74853ED9C042977ECFE9EFC21D050332E992A9A8E54A2DBD2A +825000,u,FCC29AA1C551CD8E0B028A744AE30E4559527B6763F9FE8A8746F8B838195C21219DAA26863F1A89EBC51A5056F8CA13D184170DC1DAF710 +826000,k,B6BF96655F5181BE7EB64B449206C07905634DFC9BED238ACBEDFD97B27EBB9A17B86BD9EBF98CA269A827AD02C0A9DDB8A7174A8B138C49 +826000,u,1B92202B15CB89141BF0EB5B64046F576FE2BA4F307AA532F1E5B3378FE13512EB59FC6515DCCD3922E6C2CC832335DBFF603373CE1864E1 +827000,k,58F2D3CD76569B5793BF82B749FD7EE8C5D704CA9DECD3C283EF2435BD18CF194261380AE2AE77A90AD15A4B286D895F1DD18497530A11EA +827000,u,E352E38BC441FC77D112E781328FBF6CD6495792FD38869B89EDED8B1B514127E4BC2321FD609D0C60FAFF7B0D30291ED5495F25F03A8514 +828000,k,607471EFE2860BD3D518CA33492136E64EC8476A932297A4BDE8CEF8443F61C76166EE7C043F084AE95DF61AD6998859ECA4925C349BF38B +828000,u,5249D37F8D54AF419A70FA637ADB0254077F63D758A6610C2F9DAA5A8D4A65BBC42AF408AB86B6A3AC8B5CB4EF09D78C2C6F672DF5B7CC88 +829000,k,12708BF937885DC379757F7AB164D49E1564ACAE20C0D6943D81DD5DAB166C0AED38891B6BBEC5882B834CFEEDA2A2A256C30025B6CA7EA3 +829000,u,F938A62C6C0133A2AA1CF83372545F2146424867502E87F3692F4A0FED7F4ACC265497796A83CF222E592D9C8D84B56BC697124C7BD64A40 +830000,k,07C99C060D9CAE0B946185601A33938627897E6460C6C54E2D9481A41D5E22778B28C2CB15B559D53BBA7E879A18D3E927CD7528BFC3D4F8 +830000,u,1729C1F267230D94DA42D053FB57BBADDA9A2DEBA7055F2C2AFE134811C7E1274C9F8E84186CD917F4C84A2D5669B145B15A07D6D5A638B0 +831000,k,2E43BC193C63E241DCF5BB7362D9B25A93E18264A942802C862A4CBF9D3EBD49AF8FB6A61668B4B45637AE4913B08021614C6F3B3C1C677E +831000,u,80FD2093241FE4D5B444F08306A5D755A863CCFE36E051C82F39083C9A71C5DC95C36551F7DFC1ED091EE90409B078A7DC07407F70AF77C1 +832000,k,B7B8A828745F89C372EC0941D1FB5E036775E61B35F27589FF481751F373878ABE07C80B54893429F7F016748C517AC1B22E6D6C45836A69 +832000,u,2262E014E64A65517617DD70E4AA8DF64705645CBFA9E7E6F6FE4B86FBAC050A1166AC550D1F78C8C06BC17E1F7C82534EC64AE8555BD51D +833000,k,C8E7621FF378350B43F51C140ED48A98620141365094346A5321131B3BC0035A4F29103C227B3FF726839959BE356796D1A2C3748C37342E +833000,u,138DB7E09F8C993B9F5A2C57AE65FF461D75BDBB755657E6778498DC27EB9B5B83C4644050F4FCFC9A4CC62F2A2725C62F5D1DF885AD17D1 +834000,k,7AE179636E51CA78F24A8A633F92EDD7D24F35568D4CE1AB60ACC8FC8FFF9707D55909A676A17BD8AE39252DAE9BE90C9EBBD4D13D48BDCE +834000,u,640F897667BE01EE8FBB74CF66BB0698FDACA025BE7B34FA8AFDFD601053595352E12553E5E6F50F47BA9E169FBCB7AAED7DC2E126C7EAAA +835000,k,3CD7FE13713EB1A04EE8431E55EFBF819C4AB8CD82D635EA445DE9D6D34881D5F9D21C72F77D571E29BE5F3ABF0AAB23E373887C8CD40826 +835000,u,F4758DF69CC0E6258CC85FBBE02EDD5B959FB25CF8425C2179787AE964F5F0D60E44AA4AC2218D692104A5E74FDF75F2C1FFE56C1EBAEE5D +836000,k,98707ABD8FDA956FC09BC34641F79EECD7C4C0CDACA4F815511C593A09BD56A7C0CFE893D6922C14CD2241F1201849234746952993CB2E67 +836000,u,4F8B2EC406ED4382351643DF02B93FF3A224CA7ECB99485857BAD89582E81D07C8E82925BA491B393D7C9E0270CC5021110E9E0D6AB75A35 +837000,k,22FA641C6546B3429934AF6FE1F3BF7A76B7C24CC823C41A94A18200A80F50A64C124BB5370B7A242D0466ED0C2A1D147ED458485A32E502 +837000,u,C08B721C7F080C6CCDAD41F1C8F99994E897B8CB0B9E8A68572C1B5323F3ABB2B89858B2B51201D9095551FDCA4B41799CB8A3C59F604F3B +838000,k,14BA3C48C6EE3F536BBD1BE62EF64405579CF677591E60D082A6A66627EBCEE3129ADA3489A3F324C64FB8B0097F3A595F22AAB831D3E557 +838000,u,711D388123C6A4F45C8B9B8A3F7C78892BCE05A2CD4275B35B39E3E7AB72FBF7D842E4143266737B1FF3E7562BA1FD491C8C16873F231561 +839000,k,34547146A4271079FCD5FA38C2319631B67F98C765A483406F0D421B940FAED1AB8E0EA3F612538DFFC7A08A138A6AF22DE83A2BCEA84093 +839000,u,1BF929E87160C02B0D531C4AD0352ECA71271306D9294ECF7C18D8DFDD2082616DBF9B17AE9F0F51063BC37E8C060A5BD97F3A8E7437407C +840000,k,D4DA95AADDBD45B4FD0F1F5C093EE9A6D789DA1F15F8587F9C3B3BD190D2CC8039285DFF8B8158868478C51C1E42C2FADB3C9C824B54B9A1 +840000,u,8F24206185FC0B029B4B4EC4EC32C339B6DCEF8D74E80D758F4C0E66C56D80E454AEDC22E98D02FC18AF47C8912C1E79A7CF20835CCE3F41 +841000,k,EEC128F4911D9C79442DCE05467A1C2B853A98D7C13B9673D3018E210E278CFA343614AD85568A5E481A84034CE4529B4215FDCADF167DEE +841000,u,DADC903F4409F7395A03A7D708E290B75412723C63A66C33C964C702C203E1B4A50DB8EEC5D04D65FBA8472328BAB056373A07BEFF63D95C +842000,k,2AA16AAA5FEC4EA54DFE68C3462243BB6257968DC061505EC66016ABEA52E62B71C0FA009BE11829D4242AB97AC02E45108E94AB00A43B9F +842000,u,CE35D130FF0C67F05BE80F76DFA344803F48A383D29FF4F5F462838EDFF0C1F44746E6FC9D81FABE3D27C821D74913A459EC171EAD977FC7 +843000,k,AA0FE1BD154E334C9BF97A1DB8A56AD81E0F994850B1F67465F5C1778C33F56A819A649BB3D35E2B03A5368CC4BF01D80B6240860E8C58F9 +843000,u,5BA287650B4C663CDD32F01CED9DFADB4B4088F70E71402091E828423924DA2E252946E1752A8FAE0C27BB14E22D94A08AFD34A3098530FF +844000,k,666D2C5B6CFF1E6141F42BF3195DB7D464A4A1663AB121F82B6AE31A70B4C1637C2D71F21E51357CDC97A524E44B6C910826B81FE065B823 +844000,u,61F9DF273815C4E0F7E224FCB046B0CD3F36603275718D3C6CE0B24E21922FCE86D0753BC18514836D949939533175D9F56201A71DA5B92D +845000,k,2843D5796A6AACD6D61F9EE1047B5E3533843ADA550B7AB8FE05F885D045B151098CD9F6A54EC2CC30C9A1E29EFE4BA8BB4EBB3FD2B74ADA +845000,u,C5B80F41C2C6B51A35142417CD65E281F84572DA88C0CD26B422CE283D0FB51F16DE9BB3A260D6D04B3130BF99717D4124F95DD78F67EB87 +846000,k,BEEB05D790D4D9A268F095ECF74362096A3EE20192E722D7BFB2ACE48FED778D173160E375108FE611054EFC50C3A222AB56EC9097C469CE +846000,u,3F5657C219324ABCE01927B8650FA0077C6CFD1A5AE5242C86F9A4E139803D6317FCCE88723B5F22A375C028B0734F7AA9B7A2B531010BEC +847000,k,D1C3C22D2FED32F6D31328B0F4759DB25951954A8629083C02B85535789594E81EA23EF1A5F03B4A5CFCCB67A0B6AA30DD6240BEC4D10C75 +847000,u,87BC5868F1F7D086445F8FD6B98561C52ADDE5B5F2E2E7F41B163C1AB0423BB5F6836A2A1A459A50B62816CC176077CE15E669F10D0DD008 +848000,k,8731C1E753C4D8258B2CF18A8524F7FACC03D10900F82BA47C0A756FB28AD242D5C5124DBF374DFAF1AAAEEA44BA91C53B4BA7FCF5D5AE2C +848000,u,E1D0B85C33ED80E51441F0FFBE39BDC05B1C48AEC485D78AF2106A1174598AD0CD9B8BC98385B9FDED09D5104889E5932A12444EF62CC25C +849000,k,02ADAF777790555DA76E6B2D4726442FE66CC5DEA9563E57D290E7BA32779A50DDBFAFC54CCCC839BEE1E3049EEC6E08986231143640AD2F +849000,u,42BDBB166EFF95750BEB9F2FA88359D8DDD9B30B7F9E2F0F7514DE36419858B5E9DDEF3C23ACAD7F7E90C80F94731313CC8AF3DA5DD7725B +850000,k,32AAA9D394A6C8253AE2719C7C8906FF1B912C9CBC8859821956B5FECD7292AE141A0813F20C4139EF38BF5462FBCEDDFD197D9F3C6A9C42 +850000,u,0A25F827B9B5779BB509818C14FBA08F54DAEFE2D6638B8CE3DC5EA35E9493B480739ACEACB8FEBCE98DD78C1B81E980C85889FC90C17E11 +851000,k,660CCCF2E9E380395F3E13DE07DB11DF8734FA7EA183E22FF22D5D71150205FCED5C1572E44CE4606A6EA698C6155B210B8438D6D3DCE7FA +851000,u,21F08AC8077B3C0ECD47E2045EB69B0D78EF4F9FFB284E701CC95C4495CDBF0ED630B9A6BEF0B27571B841997631FF681F83B8515C0F59DE +852000,k,D8C5CF3405C5B39163047B19D678881A8F175412FE19336D8607B5021EE5D8F6E482B3CD0916F56C7F3BAF2449D61443A564ABFFDB558AEE +852000,u,D71DA7BD55EE3ABF33B3B6D95D243FB185982C56648DEBED422932CD9646DA24BE30A1F2F669BFAB9326EFCC9C11ABD038F6DD52EFBF1E66 +853000,k,B68213C7365838FA75C8176978FE447899AEC26B69865F1F6FA5535DDF773B064417919A7E272C2E4215D34B43DF358AA018B79DD0CDE3B2 +853000,u,A66533A513EA66B3D1C757E6FD8449523AF478464181CF1CADCA1DD6EC5960BF5F1C51C4438C08E5F1230107CFC198F792765E874D7DDA00 +854000,k,F56F162D21F32834F2EF665D4FAD38D45FC417742AFCF18DD382ABE74892F8B388FB0E464D6E0DFDE424929808479E1DF274B325349EA9C9 +854000,u,38BBCE1B7B3925D2A71460A8AC86350E26829C9CA40A3CE3FB58A65487A4669244AA73F5BE06DF22CD71F1240F56D5644689A268FD82DAB4 +855000,k,B26FC486C32B40616F07E0A30487D35B12F24DCF961350DDEA1C7C00EA135D24A7B641F327DAF87C56515A859839EAA777C0FD2427776E62 +855000,u,705E46C4032E07DD7068423D6D8F32B842F114DBEB76B894059B3EB43C8E7EF2C10B36C943F63E06A4A2A00C82E219309C487717F7C08AAA +856000,k,6D0DCC2D04E558512D0079897BD9E4862BFCB868FFBDEC316ACAC51264559305DEB2C90F5AB4842308D86928F6B9522E90963BEB371B222B +856000,u,E7D0E1A29A170C775A06FBCF9D7515BB8DDCD3D0DBF1BA8280001D3928483529F730AFF1EC37ABA1FCB89D2A7549BE1206CF4113775CBDB0 +857000,k,8FE784F2BB8A6EB6B5002DE2BC792B2401665E760D2687C1735FC655C0720F76326C0BE00424852B1C91EFE0E69362DBE4C38F3312721D28 +857000,u,BD0B3E7F50D6C4FBE2BB1FF2609CE8A864060316130CB35B094FF337C6288DF98588DBD4F8BF0E8D09FEC73983F6DD3ABA4C2832BFAC93AF +858000,k,2FC885D34C536699E10457E3452F26060C967A872465CB9A9BBE8CEDE726E8C30B5F4B775E39321F4B7EFEF60098653573DF1375FC3D614C +858000,u,BB7BC55F1B73F8FAE13051CD3B146679DA950596869EDF610363A34C3DD03A1D259F0F5B86CF661100B77EB66AB157C35EDBE7077C412209 +859000,k,0ABB5F58B75C9A2BD2B6E82DF10F133651B028E3DE42A2855A81659A5D1D338F0713289B6F47F06B7C5A901122BC842D528766CD01CDED9F +859000,u,D6349F814791C715ACCA99EEDD2E84730C5504FFD14DBD172E1D64CB587232184A413742AD23A03E568CC9F2882D68BC5351C0422FA33735 +860000,k,1A45A5F713C14A4667C3B2F61747229F9D905CA8EB4A360A15D2E44D909579702AC0820DEB4F25E8DAF1C5BFDA8ED569775C5022F01DE05C +860000,u,5FAB440DF23D553D32C2514DBC0D0CE89AAB71BBF4D7AF3C0921DF68D605667E9FCB50F5FA440AF9BAF90B2E0E0A2B9A489375CEEBEA23E4 +861000,k,8ECB1A5CBE58E302EBA370DEA55DA5F888C0687DB9055F88CF0DFC43EDEEDC9D7109397801FF61A77BF15A24FF2D7D7FF8AE1A5FE1E326BF +861000,u,5E2129EB1F6EB24BBC2F8E3898781926A9BF7664A54FD868EE3D35301E9147AD7407F94135CA1B2505BB1A2FB91164DCABE3097A2C66F4C6 +862000,k,9B4C21423AFF12CDC21DC0A700B86F181C69CA1AC4DF6E51510957936BC4CA339FCBB7315A02C3C72B9D2E6D2232BE14F24E56C25849E7D8 +862000,u,525921A998B7AEB73AC96F294FB2C2844856387272B3562AC4989B4923657AC6CA04312438AF54EB673F3C171B9E2DEC8DF12506674233E0 +863000,k,8680FD368B76A7AFD3FF71CA405800568CB8C910C204B67CD7262F1A7988745DBB33556ECAF53C97BF83CC21EB20C7977CF79512CC97204C +863000,u,F7AC68D2075BE6C139E03705B19037B8DBF33BCB9A2A55402DAFCB7D0BCBB57F05FC682E026495F5E1A7697CBD238EB8A5BF6465D5E8E37A +864000,k,6A87D09FAD0EE60D48466B2D61AE5E45A061CFD96DC22BF6B6B8807CA27879C3F7A7A0C0A55665AC8B92B990B7C7E416665DAB85B08427C1 +864000,u,3BC0CEA4446B071C81C52C44098721ED6377924DCBE897F8AE6A9E03B6979469099720FC0D1E330DB465BCF4FB48413972EC5C4D44EEB320 +865000,k,BF45B6B9F1CAADAC7D6158F5468C935932338A57B8CFAA08019904ADDE980A2C8CEADBD4FADFA2D009C73208BDFF0B906DDC60F31354B156 +865000,u,2F29362F12D3D5FF00FC3F942F4C76E3CCF8D864E8FB27B934C62665D7FEB25EE8D4DC3ABC3EB1126094306D6458061732BBA7E4542F6D34 +866000,k,E8C06B1369C7E0293459B53C632EC2853A36893A37A8AB4AED7921E8824FB64A69689F8753B5BB56790706F5B11EE60C732374E4F20F6F7B +866000,u,204455634FB1AF69289E66C21C24345C417A5AF3618DE02FFC1D32A98697FD72F9AEC759C708989823D1FE4AA02D94AA980AC749B758A18A +867000,k,53624892221D3852C59C97FAC9B35041972BA041201E577019B15BE31A395084E44A3F7ECCA5A6BDBA53B497D796197091EFED42AC756EBE +867000,u,4A071B39BAF8F644A761D2D93FEC19DF2FE7E5BED6F374797417116F9BD146C2202E971CD1D653DD959D2DA7BA91EB07F7C213D6964E715E +868000,k,80A74E90202E2AAA53EA2FC7091034E995A4E4349E24556DE50E64F09E9CEC941872B812A0C69F3E77FE6F091AC6A5DE11B80F8020620388 +868000,u,8E3900AD435FBA88B0C0397F9BED450ECB71182F19FE76E34875B7D6CF854BDC0F403A071E9E15BC76E064E87F5C90D779FA12228667B0F9 +869000,k,9EB30D2203F225CB71DE194ACC5E41B109E77EF16D3BC67F871C8301A566C7975D5096E88C14891BB19836E82407EBA594A33B6AEB77866E +869000,u,3A8CAE16574FE5D13F6BEFF6E465495AAE10DD8EC1EE7DFE011EEE3136F0A91A1F4A7509B8C8F1EB225E5BECC8644EF6EE11BC3167C2BD2F +870000,k,12B1E3B94297CAEDB733F9E38225F378A44CAD22777704D54B21C698E5B22B322E2479C5D3B98C643C3FD3B30489E89F671C67B6E432B0E5 +870000,u,35AF8CBBEF7B9F0EBC5DCEFE8E26634BBAB3B17C205B090E988D890687502934B8EB33F502E759C63232D6BAD026B9A4AF44C2C9BF881B4F +871000,k,413B45B2C4085BEB32C2F145CD3185C5C7A258358D455FE9757754F2BD4358DE208210AAD411473FD5F4AC09D2BEB1659473AE5BF0BA8CF4 +871000,u,9C6FAF2234F3295B9ECC80C59B416A052AC9CC4CA78D222F1462C4234EDC0C0642A9C3788360BE9AC0B7CBD88AD273D6F25EF82FAB02B8C4 +872000,k,8B5606CC5A0952BD26CF06EF04431A33633BDB6621C6125837A178369E25E04B0F169D00E4CB2FA420E339B5A73C7DD6547DE31BC419B24C +872000,u,C77E2745A5D4C07B1AEB431D4506CA2196F97B83E25DCF4556890DFCE3174619933BBEE519EB40E079C7AC61D52A500FDACCD18CE2C4767A +873000,k,E103933A76F72C6DB885B84D1B277E98142296511E463BFF366567850299996BF39F928D9649DD9774FC6C54F4A45C4DF4A2B9153CCFC708 +873000,u,0040F3198F2400417464E490A2F9A7544232809721DF6D490228E2870F784790934608EE83F2F68954E3CBDCB73E70A8229F06767B409B5B +874000,k,3E7AB1EA5F903D700904F6592F5089A5951D31AF35E25A6AFA224A8FE106088CC551D993FE4A16D0D47C05B5BD3EBDCA136A03702A5E0339 +874000,u,5774D696A03358288A6A2A8FC129D90987010AC88F25260A5031422290398F1489978DBEC0C1E936D49DE6D662BD3E73D8B2082AB0550D02 +875000,k,575C8C9BB945AC874797D79CA8229E3A554212B493C4631DE38C4FFC8240240ACF646BA9DA4DD966E04F57E8AD7457EFD502453A0815FBB9 +875000,u,F0F0A8460ACCC0FF2B4595CB19FC019656CA5B728254FE3D86D2A9AD7B42E7C4EE8941D8F0182955C48C360BCD755204A57BDD2FD221423B +876000,k,4A68DA8B554F0AD38C4F728B6ACE8152836F1C412E1F0E1956CDE8102C6E09BC9BB8BA19E87762732A2887BF37DB63101117472019E1D342 +876000,u,2D79EA590DB0BC2971D1072DE61EE7B1F79A065F9447E095EDEAC476380925891913773731C29CDEBE99ACFC78B2B6E571FAC9561A339046 +877000,k,9DCA2138FB5C054733F5E88E2E3A9B4F6B5F93C58A4C615C5CB488D4CEEC197A58007C6860BDE0D1C4F9A4F9A1EB4DBA5C046D75B5A54DE1 +877000,u,9C0E48EDB9B03BE9A154FA2F24DA6FCE28778CFBCAC84C5E6E73542154E0D753E82049942D6A06BB1042E610DBA3DBB81DEF8DFDC7ABEABD +878000,k,915C9B539CDBFB36EA51AF5EBF0F2B4CB0D405C49B23858216C7F6BE1393A5C1208A6E759A6F3B329746884D5BE3C461212D18F5016ABBC4 +878000,u,C41335ACA00739C9FE045F34996D0BEBCAA888B45AC591716F531E1E9A57FD4D99E0F478035CDF7A8C3AB0DE63E9088A9124689CC86429C8 +879000,k,2FA7193941FA8D163568C7341BE11A29BB8A9B0B73B8AAD7C0A036FED5992A4BB97294593276A8D3C6F869B47B930DB72A058CEFD1C0B371 +879000,u,36FC4334830B327965D6B16F70834CE50419A15F91F2D8841B7247732EF5BDBBBA74D17C336BFF8CE6E6C7EA0298CD5BFD07D8EC8578277B +880000,k,CE6014B9223ECEAADA9D9EE297BE53644DC203EBDE3D4DCB8ADFB3DEA0FB9D0CDB31C0FC13BC4C8D85222758F1716A4581FCE2C1365B8536 +880000,u,BC4B1D47B6AA487F7C691C4DCBC29237259F3DB991ECD5707DEDE170FCEC2736ED13505C91788003734D302290D2D7369D31D535CA8F721D +881000,k,137A1C96113BA2E8CF78AF1107CB0C589E7F0A3A6F65170CA2982BC2B577059EAC97DA8467B9BA566975A7F597BE95AC89B87574E4DEC113 +881000,u,552193A75F485414430B66AD29B63A0E87B4F0302290622B7691FB3E2C0BE68C86CE90ACBF9B4D077CFA04B66D8C02F0BE81E77988D0395A +882000,k,4D230518ECDD96BB2C7F739F0E9600F58BC1DE4E65220F829BC76A8AB73B229DCCB3226DB487B8B44FF64A545750DD441230E1CC3979B41C +882000,u,527F5771A50FF0FEEBCDA8EECDAE76AA1AB422664B92F005DDD3688B86E0BCE066E5512E355701F1B1BA86924AB2EBD31029E1ED2F237395 +883000,k,1D97670551ED7FA3510F19C7F00B8AEF95020DE776A8067E267F57801E839D34AAAC078EE68415156567B2223FD28200D4AFAAF3C9B135C9 +883000,u,185D84A9B7B8DB58D17FFF17E44EE73636AB8CA31374A39BE9F8A443AE45B674222E4A64EE7E4A3AAAACB3DDB612491F42707ABA2AD1A440 +884000,k,D2E5C02DEFB4F18A8F1207730FDEE44E4BAEBA95DF88302C3AEDEB2E37926C12CB66E5552F7F1A0144CA2D833B6462327DA88E2E0A5D1B24 +884000,u,396F0D5D6CD10343E5DD90C595422EC75C9FEEFCF303D347F54F2C9CE2F4A40B67A0F920D3F79BCA7CDB5DE26B13A0A5EB40403054667BB5 +885000,k,67168E14C1670D6378A7A2DC4060419AE1E539AB4C0B76E8B8369038293A6DDC184D7CCB65F6CB866DCED6D6F3B83BA595CEE087A162551A +885000,u,23B5C1EE6194B193487458003611D261E58DEDA53D4D568C0AF49AE7D27C311DDF281C34D5AE7EEC8B43C3F596C326A51A551759B905EECB +886000,k,CF55FB355B48E4875A43481A1CD010445A7722D66ECC784B30966D40CB15B22D81A70AF90E657B7BD100B931C6DE989B7F35119BA3BE761C +886000,u,8D29DB8BFD67C46918353F258F678FAB553D351324CEDDA59C36B605DE3DF1E8A18920334ECC80410498617160BC471AE9795E2B422E6490 +887000,k,2314C39B526DC99653883C521EF6E47001E2C2828F1C81BB8C3333228F25104C32C82563BCF3B9B23C8F71E385FC01411F7DBDEBD4ABE861 +887000,u,933AA226845BC8105FE288DC782BFE71DF74EF378178675CAB8B796B27ED50128223B30D5A36088C0624D94E93EF5BB668F32379FE86FFD2 +888000,k,7E1B338C358524CDB014018C2787A537299FE89976105E0ABF325CA8B4DAB0691F286D1993EDE44314F37AB19E062048F43F05D6DCE3619F +888000,u,260E26E030D8E5DA29A9D6FCA933CFC831129D39454F986FB36B2B4F12936BE29C9801B28A03154002272552D1CDBF3084C8FFD44C7DEAFC +889000,k,7C4A25510803D0078EE32FF6CC1E52565B874C6232DBFD513CE39BEDABE1DEBE54CCA916DF7A10EF45D363AC4ACB6B139579C513174C492C +889000,u,FC55DADD29FC9DC8065180F8C04E73DD02A8664C63312AE370B9BF88723BA50977664CF5D6CA032DB4DC962707B8A7D499B933BEDC8DA98D +890000,k,23D63F3ED458D51C8CB23AC9FEF67AE338D1FC8A80FFA0B3538CD612431F8925494F69725A2B2306310AD4633B579BD72710078DDAB71301 +890000,u,B5F68495517AF7DD36F72044E11392F39CB36B85342EF7F9AF4C34CB7D5119110A71F68C950FB0F20908019EB63476C93918397D0AB787C4 +891000,k,58A069A1F334B802B1497CE2F210CC49098CCC84D866F4059FCE5D2727F44144AF36C21C1150208531984AE484098CB4AF03248515FCBC94 +891000,u,DE3C6EF1F9C3F5D9A58B7BEAB6A583F1FC44D0CE4E892DB4F992AC98DCB288646F5FA39308FD8A606BDFA8B76D3CAB5F58A437C3BB684D28 +892000,k,F8E070071A56C4581F2F5B1597CCFBBA3DC88BB4DAE98949DD5FBB8B1A2CF92730A367F6B3BBEC9BB3B5A6CBD911EA43E8B363F96AEDBB2F +892000,u,99F9B0E3D08D4B30A012988F0E2323D7E5B2C34CC549588FAF9A2F2EE61A8E02DF8BDBF54CFA085559028B505B912B4B57612E858E2E2880 +893000,k,8CBCF3A926DED4E474262EED98B47F8FC7FFED52B850135BFEED2E7768959DCAADDDCE0F5FB989A80415B53483719A598293A6A8C7335D33 +893000,u,16BF2C7A281E8AA3A736F5909525C297F29F63C1331162E8A9B9271AEB643B019E34970240BB5018AFBC3844372AE1C7CE3E4F7F93160471 +894000,k,CC6162257CDDE7F9DA90476400B461FFBB9A84E44C5CD24A25482A9F9DC60947665CA8F86D0EBA3D0C9FA6D67FA2650A898163F62E0F1607 +894000,u,FFE26A30E7F2FEB70F027FB6B8A0FCDF667556AD3CAE353442FE7DFA525D99C71DFA38A29D81E64BFBE4574C60E7A979096168A9FFD39A8F +895000,k,D9669E0CDF997231ECA19C4991E03532930C80CC57170FE06A4610ADC4FA4D5A7676FB542AC99C69B284A25C8A59B2FC3E19F1CADD142296 +895000,u,E97ECD46A34EFFE7E13F39066ACADF06B9A5CA19151D1362481F6F14F393FB16556506B4844EB46A6BE1F6C1E8262A8F186DE3739FBD224E +896000,k,F7754A1915D8C435F80C67E3796164D66C77176FABB9132C63FB45B4DDD2353A9674F83BDF9257215116E86EE511A10C1CD79C3F795703E9 +896000,u,5469F53AC24A25617A3BE2A35E44B1F767E610F19ABE1537411B9D6BAED56EAC5A59CD98B0173E6879CD26964D56F3E85FF91037BB91BC29 +897000,k,158EC689C5336D2660145CB2199E8987F788BE2CEB0BA9E00387D08BE2C3D789E306DF0E694F5F981BAA618552D4A3B835603413803B3E61 +897000,u,63F8F17777E3C92E7D00AE35EA2707510D09E9E6368BD87BB1F93D953BFD7FD4A3D99AB7327DB5527CD07683589804C251EFD408C8388CBA +898000,k,FC3A7B0A234019F209621D6B80C30DC32AEDC9B92409B90C1B919C7C38791D12B48A250F1E10F1D72F07EC07F1B48E8DD93D795D4D90482F +898000,u,75ACAF8B35036CE8DAF8654E4F9429B2CC18A74F3D3FC3C217963EF94B7DF83A9F909F8F80BB27C31C5C3B4EE5B5EB7290D6306CA1AAC4C1 +899000,k,EFCEEF84E2A680B18874656594E9CF637931C489E3CF2700BB16E033789BFB8DBED3E8E6156E3FFB46CD22F5C22570B5E5AE5BF0E37EE574 +899000,u,E2C97EB4FFDF5EA19AA86D46E12D4FE7583126D4B1A584B481FF03CB11057FBEA7B495B3D3DACBABA2F2945992F23E5863D42FF60DE29D47 +900000,k,35F06381FB88C454B9542A143E47DF2FB182B195D28953DFA8438EE154079FA13217BAB462C5EC3FFA5092EFBA55D980D6E59CE158788362 +900000,u,680C924E52BE61AC067D8A0109A0371943A6F3003B10940D29711CC4C14200A021334ACC207A20699418B0BD226C413C311BA532DC1FFCAD +901000,k,25C9DFF139F4245F87231E4DA7EE3982178E140C59038548C36085CF47446C2506B7B85316F547571A00AF258EEA376E2A141A45D96F66B3 +901000,u,8CFF804BE3596D5F6ED5F7C0D5A0756AA41C9CD114EAAF92FFBF4C8725DF2F71A6123C5FA542BE59203F55C77399436AEFB89A169BC6ADD7 +902000,k,AC48100424655647D1A9350FD201ED06B3AB0D52A0E940C649230328020DEC52C7EA5649CF96D6C3F9A20D0A7C2AFE7278C60EE13327B5CD +902000,u,CA0C697FA0225DC44FF9687E2435261202D7241985609D1E9D63A1600860E336FDFDA52A717C6974F48D8B99BF5FFE7B08160E2681F698FB +903000,k,D5C60C4F72365C6AF389630C04C28086D3550911200972EF8F1B9669391F8F360D29AA57E7D09596C379A494D96F92B02E84AFFF9769683E +903000,u,65930602D330EF72862D8B32AA040EAEA28F213CEA23161261D970B93350B38C0B47FE0F111978ED5ABFA10DD2D39EBC8485676BA4698E56 +904000,k,DCAD87C3AA2FE5CBF9A8F8C469425173D40E88971D0B7EF38B9BC0DD8B2254B0FBDD87576149F83468319582B97E0EED268615E8E9993F86 +904000,u,917FD4D5D6CBBAAF56592C89728E913898A8E7E51DBC2B6543D9941FC5E28B3BF221AEF623666FCF7AA3F479528683DDA06A423B7FFB66C3 +905000,k,D89EFA0E522C0ECEBDEBF50E483B7108BA907CBB39927D9EF44209960449C304B47358858BBA42E800D2B44B2C0871E71981DB47E2C46DC7 +905000,u,75B31C13EE0A78EFCB6C738949A33673837747435A4CD93DBE98A912AF067B414FEF28BE8EB74B8EB35797C72687B7C126919330B227B2C8 +906000,k,EA47E7CB97F077E3A55C8DC3B102F2DDD105C230EB1B2055EFC4A805855DEF7A86225639E4C408EC8E9070BBD7924863D65D740A265D6E36 +906000,u,51AC04FD1F1A66E6EA147E31D734513D704276B0A5E6A0E395B817B2782BB2CF62499F012874B30934DD8DB3E0DAB81EDFB6A86BE1CB8EA9 +907000,k,F2CEA67853C4702679B5A3E14C43BFADE28F0EDD9FFDFFB136AA197894852C8E3FD7920F85C45C20299C77C7E278590B324489986376AB57 +907000,u,CBA0C1D80019C53974FC07676709C9C2C5C2B800772F9784A39C10F9991903F63BC8B9024766741DC6E53F25A8078605BF58301428EDFCC2 +908000,k,29274FC85ADB4A13E425328F5979966A21F0E596BC176290B5C77C393954D1BDAE0250B76A8169875C66F5439E011D80395B260120D7C615 +908000,u,485478E07EF3D25979358B8EBC90FBE92D6EDC3A934BAC40E942F54B24CB3E6552C395B498F43E85676A83D639C6489CE427A2D7306E4D89 +909000,k,2142CFFACA26C26298B25C29A638DD2172A5FD78618A4D24D211484827A6553989DADD7068F6FBD5CD2C03C09FC2FD0DADB98AAA679252F8 +909000,u,FB830A840C5EB5A712FDE3D1471B5E75BA35FBF41A199A5CD3533B1833776D255628C913E980E649AF07CBCC924A9F3254D651F2682BCCEF +910000,k,26FE10BD922AEC4CB5806D45FE9E065C4ED9D455B459CCA9F21140CE8283515E992020BA98D7A176EF341DC018B75A1CF03DD97226C6451E +910000,u,D68FACE884AB5DEC02274AFA2D1380B16AC9097221381A001B42C96574279970F6AEDA6415C485E8B1E500D904A6819C4A5EFB84EC5944E2 +911000,k,7182BABCADBA12F4FF461F6DE4EB86495192D3FD4F3D0CFB8C1C6C9C53B75A2F49D4BE62264B7040D6E9A97448F4AA83E00CE09963FB2425 +911000,u,7903A6392068B620685EED218D08EE59D87EE3FCEA41BA9778C0B9A96EA373B7E1CBDB1C95AF0C0EBE675638D9280ABF1957251219813F4F +912000,k,52692D35E75EB71D68BF150FEB411BDBA3D6D4EA460C475CA9FF23B29AB344A7B7A147D353ECACC18791689CC023786DB2C9DFE623709B6B +912000,u,3E98B901C6BFA7355B273D02D2CB1BF8682365E3E3A47028AD69597F69F980B63600A1DE64A3F47CAF8D10BE628668316CDC14467401914E +913000,k,641453D074D5E8E19D6CD79E3E4FC9BA1EF6CD6398EB1033D26D1D005EAA3F5807894944E90CB87B2CBE60458FBB0B42A4F852593D966683 +913000,u,EFE9BD61F45C2D736B951F3FA2991F1A77E93A83A3C5DD77ACE47D3E9682C0745D31E96A6B46EB1DE17D98167446AA2B80EA56D9C097E13B +914000,k,9ED25AB014C6C98AB02A5693112EE5401599D3DEB64F1308D5689415A52415F7FEE3E86EDB91677ADE85DF87B5B9EBCEBE995623710E91EE +914000,u,DB52DCDF60DCA36A66D0AF201F146D8798B40497AEBC18BE29A6F7FE4344E1A33E999C8AA058E398BD358F6ECC87C982B7B2C97F5DC60E51 +915000,k,C8EA6B9608EAE0ECE7BAC4259C18B5E50E366952CC1C43DBCD55155F291EFFC8F8475F03C5168D1847893A7D7FEFFCD7A04670B54C476663 +915000,u,1A089B59E6F86B5284D4182C6D43A94AA9F5568BF3C2B3C521B745E0C37E1E380DA88B1E2A77FC126AE3C5F1E489577E7A4423309F8A4F79 +916000,k,8367453DABD3E45A4310626DEB9E82C766C93E0B0CC3085D468A03D9C0CB6B83FC825F2A37D6B18371A59189456AAB699FFB04DCFBED4FCE +916000,u,69978DDD85640A28D2F9CAB55FB9E6C082F70E47F3E31F49EB00EE63A7E7CD57EC7C92E6FBC0E9ED2D0FA44951C2B9963EDDBF607A9ABFA2 +917000,k,47AC4907CEDDFA3596B51FAC0476E8D3D83DCCE9D4B3AFA2A9F2465CDDCC7DEFA901D62589FC156E674EFFDB59CF1F08B9A2E89B5C2D5E5E +917000,u,9DEBD4BF8C58495512D15D818E9CD8853D2F2255F4132A9B917410480B110C560495452D7D40521297491FB3F716CA955893115497C12F5B +918000,k,4A0B9B3E8F5BC46C7B315E1AC6693E9D3EB62AA3D93985C9854B24CEC61C3DD93AF763750F15E14141540ED1B0A11F6F004512EB8672206D +918000,u,F08C324E24AB1FEE225A737EE46FC9B3EB90B59E0822E8A669A7882C0F82AA6FC5D66D34D6EB1F3CA804DD1CBED15239F7DC6566FE76D938 +919000,k,94B96689AA2367D50173A950B2DE0DE92B1DDEFEA21E4C7989BB274439F3B9D3C119856E8BF1EC604BC545F6DA9043C9CF8E793CCCFE2134 +919000,u,59E4C62966EC85A975E68C212D6704E2959BF46647BC12050D4882D346029C35714AE91E54ED7E84DECD5237BEB9A12A0F364DD42E72A438 +920000,k,3CEA765B6DD108979C49CBF03525287751A17865B7DD68EC4419DA70895422124A70A81BCCC4C280238F445FCC06854E29A0912598511F19 +920000,u,4DC17D104004970960035EF0D0B4175417E27040D2B3B262C158A4803F982388EF1E2101D4AC09FF181A507A5266C38DE20773BBEA70A0F2 +921000,k,306A716C0CFB0B951239BA9A450B97A5C3553EC902FDB91D74565CD6FD6E0814BC43820F1E8655CC5A52B9B2CAD243273FEA930FD3566C86 +921000,u,117F05FCB0C2FF5BEACE77D99C6CC6185AE26DD231B152F59E7FBAAD8C8F2BA43341A5B902E4110D80E331DEE0A55EB5BF2DAEAE96D5940C +922000,k,5C439E26938C8C11EBF04109B5E2E3FBC28BB1FA1ACBCAD2B98098D52E94DCB8AFC9AAD64D2711EFA13A98146EBBCBDE88171BF3A6BF706A +922000,u,0E8B14986A163473936844758D42381A6320CEC629D2A9A5C364E06AB70F40D42D4DDA09E9AE597012D479C88653302BC1264AC68F658E6D +923000,k,37ACA295F4093EA12C0EC9610B08D14718122DFCDA809E71500B76A33A29C1743641FA6CC2EF802E5DBC9F83C834258A01A7B93DF5FFE39F +923000,u,495742EC624C84AF3A2A39831FDF916AAB629C6676C2DA9441D08A8219BED57A6D86A9FFB4BBED773526DB776FE832A427EB1897A5D82458 +924000,k,D5AA53A519A61FE4A4A37DE8564A02DF3028013D7A0276D477C9D11062EB2586846A509EE06F18D00DE2680DE5C8D2952B0F20DD2E075BFD +924000,u,EAA606EC548C791AC69204C1B6E130C3A3FDC9821B1B3ADDAD65344F5B4C4A4B0F292DC88710F3E12C16431E913FFBCF3FB9A748A683B3B5 +925000,k,AE70F4C9651BA06312F06173DBE2E75040C2FC4C7970E6AA7B49D02E752F6720215B25D506ACC801DBBBD1C8179FC31796B8D3601DFBD7E2 +925000,u,45E55523524E6775EF43BB6CED770493FC65C948B211E9EB0BBD9D86D325049C923DFF529E841274D3B2F45693FB824B1104224BD4DC41B4 +926000,k,ADA309A5E2E2EE3840040A1CC0CE19F30B0BD40068C410E897A8B7763F31830FB3F3E75158536D15B5D458C15A80018BD4A0915F7C6E5331 +926000,u,6DBE61F75FCFDF12985B47FC4D1CE6729EC7462671DCF2A94B4BA72A3847C3B87C23904E5245734AA11CC7C3B14F25479291267E52C90C9D +927000,k,73C4801DDCA60AAA32046F759C5159343BBD3CBE1E16A312379338FFB401157881C3B0F905A501F35BAEEDDB419EC5288B540E15AFBB8267 +927000,u,9133A432927D98E1AD5BADC04CA6AB0932A0353EF33BF519D0975824D489D6F84A146AE3E6A717B8CD967D0F24B9709ABA978EBB14CBA921 +928000,k,775FD7C35EFE7DFEA26B48E234FBDFB409C4BD77B84BA7599232E36D55A5B94CC61E601EE06E94AC0B477E84A64F43E47316503053C7E7CF +928000,u,48BD762B781A665F6208D49FD5106C06994A8756876ABB9C2AC098FAB45DF76538CF0F99D8E7759FCC53E14DF448AF51170E424F3D6952FF +929000,k,4E67830BD48E6AC29C8F0DB04B849BCF763DD7EF8250C711038F56C9525EA18A028C1CA76E5CAE8200198248B75CE22D248D2028CB497F89 +929000,u,DCFA65CB29C2F6714BA0AA8133512674C433B0ED5E9CC767DD598BCF51095397C4516C544392D5C91E05C710ECE8E556DE2589107BAF4BFB +930000,k,D4EB87F28D675A466A85C27CBF774E4A8939AB6F3E5D1C6C2C07B01BA55D4BCD62A4AC3ED186ECDA68764A28F7C2960C2301A66923E60097 +930000,u,9F2BCD41FCCBE642B26C3BCC467E7006EE956FD8126465DF1CEBA9677EF7417E55EF79D8C3970AEE93DBC70D0C14506C4F16992727FA4D6B +931000,k,CE3340313E997E1CAB7A2E3E07D8FBC92115200A575863E2820C2DED5AEDB766CA96A0AA82FADA12EFF078BCEE2C9CE65FA29046C59F1AF5 +931000,u,63F4DA62635422A871BA34D77495FF601988C8DAA41C97A8681F7300502189BE38B26728D5BD795EDAF96DB2F01178F752FE777BB10719E5 +932000,k,C4785D3743ADFF70C3B71B724E792C071400C4D4DAF4BF79A82BF7D0A6D830BE9961AAD74276511FC62EDA42B68007089A535EF5878B7CE1 +932000,u,5C0B668759FE6148A04F7C16AB67A940510BED3621E46D5AE193C716916F05F438EB83997E1A48DA59E7E0189BE4463EC8FDE93A39901D12 +933000,k,02E10CF45287A6E218CAEBEC55B9EC59FABDE7B57BF96CC6418ED59C27F04A24AB5CC9B2D607754F66BA8F3ED0EAB1BE6ED0C6C1CD26D502 +933000,u,EE5810BA4A17B04AC84C81F0FBB135252B8856BCC6242C793BE2EB4F9E77D0EFBF7F84AD60F4B01E87C1E93EC4EC68C7970019DF4C8BC39F +934000,k,3DC2813E1B7C357AC3AFCE1235B83AA44D122D217B78AFE17CDA9E8358411FF35E1CAFAB2F8B9F50802F2F3CF271BFA3C585CF1C64E7B71F +934000,u,F2FF413AE6E9B7814F4AE598CD9D75420E9D6EA83989E9A797D749230DD3AC66B6B9E2F137BFF19B37D488D32DDE6AA908C66D61347718AB +935000,k,06D90B2E26D87920BFEA6BE82480C262EB96003240CC8874420E9B2E6C5AEACC7B8BFE6BF150A043AE5B736901A9569603D86DE008EBAAAC +935000,u,DAFA24499D3B9203878C4AAF18C6AEC2ABD4FD24A24CB27ABCB3201C6AB46B2B12FDB7286FF6B93BBAB15F90EAA209376B9EBB1392355105 +936000,k,D82A20381DD71CE02BB161E2B1036DD0ADC64294E47B4C43B63AC91EC660B0C81B5A77287225D4F1BB93E1E749865CD454314A85600C02C9 +936000,u,054AFC6F429C6723C2BC41A1F557543E56EDCA126D7175F2CAC1F635525FC2394822370C83589E28E9F143CE97DC971EEA5ED269779A8D89 +937000,k,54AF7474BE16A9B3FA33A454865066DE8B258FF52B36A630D72229D93548A51B2DED71A7D0AD3526797C8B4A0AC82F9F271B0E0504FD1562 +937000,u,04B685AE0C7C3F90A8EAE0B8198BF2CCF51A88EABD8F3767F5B9FC2DC811B0EDE9F5CE86C5C68021B472D8A3B105BA360EE72475C33A96D2 +938000,k,A496C1FE3BFF066BCC9FCE7A311B6809DBB8B39B769353018F9FE87C83152ECA3C98CE0A0C622F3E2A2FE6F54894B2DC54E174D837DB1834 +938000,u,B9EBBF7CC9CF80F6A69556953AAAD7742BAAF779403EEB6F128D118BCFF80FAD603DE9636FB68BE832A4B03337BDF8C5254DF69C34DADC4C +939000,k,F1484382F0D9B0F4C68489A53A6AB79577D91F6446AF865C60F36A63AE2952A5D3B46E9A204D79E914FEB81EA7E0136DA740344E78E7DDC7 +939000,u,5E121C7400F8D0547523B6F4127115ED528887419813A218E20BB8A4158F771B6F3A7F75059463441CABBB83057285B5A7001D681FC0A684 +940000,k,3FC339A5F9916CFD303AF3C612518883D8B9345FE1761714F90CE724A330B596CA934DF7729B5AEF103B3A3E9FE608B9FBFCB368E68328C5 +940000,u,85CEAFB7B0DA29AB2BDE88D5374CADE0A9FA405547CE66698C14C0127FA86359577F6EC0FA1F342866A8A0CA216D89640AAD18BDDD5CE194 +941000,k,693871CCDAB55BCA9FB3EE7A06BD8C53DBD6BB3602C2919C2F3C7FAA20AA22682B390EDC7F9928EBA0D24D3AE426511ABD4120ABE7223C9E +941000,u,774F651483E08B102F01A2ABAC0E60BC196CC42C611135EE8783D8B08F5908D3A6FFB4A3C9AAC169E490E36352B921BF60D5DC2F7080BA07 +942000,k,AA81176E8D15ED002E5CB5FAF1B51CC2417242DBC88E0BDAA769759E81A162528D7E524B667A261F7A854DE9EED846A705FEB097F68CC7D3 +942000,u,5339886590E94D59F52329E641840F3FF8D4532D1C8BBA48D2BC933F892BA527AF4318A0AD9BF7396DFB6EC0B5EDDF0AC561BEC5CF6CF701 +943000,k,87FED504E3AC41F3B2B00CB99D199F1816FB4FBB6D86CC83572DFE24715B629B513EEA61E8C6CDEA77057A635536DB87EDDE5CB1628DFE15 +943000,u,D86DD96EBA52A478E7148FDABC3B2F61C92295AADBABF873021B320E116E2F23CFDD5263C6B4CF63628B7073C339189FFCEB6D6215B7B4CE +944000,k,7895CA4D99ADC19BE75A5919263D0D740B602076B83F21BD456B5EF185066B038E233B51427D3366066A3E4EA828C97EB82E42ABB2D20B04 +944000,u,351CEF7B32D473624851A10AE5F4436D3C7AF157735960FDCC25B638501D00167B0876AA76E7706D24785B9E3E7FC9DDE6E1D36F34A76153 +945000,k,30B70056DF39888BA765C7158833155F3E15FEE4CE7EE5ECAE02ED4BAC7A7028181EEF10B8E1B79A55D1F56E544C2543D79B9FD864B44ADE +945000,u,CF87C5EDA37A56C46FAC613BCA65B01B67352756CD35FA6403CF89B728552D08C90927B50A02634636C57B21D15036068CA0D5C5B9792E46 +946000,k,C1A4277521706C5BF4F5FFA5E5F54AB71432F9AA2A82BD3E36FA6CCD911EA3FDB52B6CE3E58F1A710194B733B23F1AA2DBE2F59A172B5FB7 +946000,u,6C5254E82EBAC9BDB8FFCADC103C7786D2AF4403323B5EA9A64F9FE8684299A8F304B9FCC99506B37219B6CAEF100A8D6765F565DAF08D74 +947000,k,27BCE769F161BF4BD96E964890583756D45DDEEDDB070ED15B51444C50BF53A9AA23FFB39A4FA2C99C22B1362E6882AD5E17FAAD212DF0C7 +947000,u,8DEE7AF2593A81C43432CE29F4762A4546449D6C06329F010A25E35951B82323ECAE2463F60F7C8CB23801D73958D19BCAC0368F5491B117 +948000,k,17652260E408B02CF101D2A44FDCDE0A620BF40469F165C2C3479EC5C7881311A9E4536A8429962B5A636CD6E79AC2139435E44C2078B22E +948000,u,9A9D2F6288A4E5D951C41BCB0199292A30693BFD8383CCA96BB508A88E9FD5BE05FBC04ED680A1F15DF55B7BBDAAC1D19CD1A83B5C726FB3 +949000,k,0B82084CB84B9BB6E6B6EB4C65DAF3AF98AB25DDE310C30786EEB1DC31958BEF9EB577A5F68E285D4A4D1F94EADA1A0E4D9BB266E23B370A +949000,u,88C2EA133A6E13A59BFE79C856299FD882F97523682C6F682E5845A56FEACE2A5B13148B05F5FBFDF6DF6BBB7D7566F46446106B87E17354 +950000,k,1FF3AE5485C23F1424AECFC1E2F52BE9A70E3C7E3FC92A98E14F7D216B4E721E4FD03E10D76CB058A56486CD92DA09CA6023703F895351EC +950000,u,6B35A9B1D071993B08D50AE8C01E9BE9936BFB6A7C551CCEF4DEF9ED434E37E46EE4865088B647C413C0E818EC132194ED9EC4EDFB7A592D +951000,k,D89B930D7FBAEF5517D9A8FC5498D36A09E978D0244583990EA35AD025CF74F58AD6A093AECBCF3EF6330C7FE65DBA29E0E2B4CA85B67837 +951000,u,C7057EE36157CD7DD9A42B2D366CC611204CD7F9BFEB6DBA3A182A3B19779FEAE897846EEDEFCFEE9069D4604C9C292605201B490773BD63 +952000,k,270151EA33E14690CD26B54CDC90693CE979B8927C892B7AD139041C9469868FDAB755ED4030F23AECF443CA6F217AD6D14C7A1A2F3115BD +952000,u,B6C3E4F1BA3CED11C6746FB71ECA5F01679178CB21203300E354A39DEB340D6FA070056BC1DF5469ED8F59B6C16197113DF1A558A815D89F +953000,k,ADDB534E8857C5B326CD4DC69F4D63276AC41390AEE529248AEC4A7540235380638399563E760AC452F652831AFAB0AD7C2868401B72C047 +953000,u,8706779C9D762012054497C90E6CC72D85E29DE2CC683F99E4FB551FF1867C05FF62B8F43E08B08BAEB9CA3F6BB610F241A7578ABDEBA413 +954000,k,40DE18FF480A6865951036F36E7CB3C03F9C89E3B7C6BE37A84F4CA0F2EF25D384C1FD129EB897CCABCC6670C484D5C546404F9C2E3256AC +954000,u,D60B3097B348F2E8235307AD0F934EFC1ED562886D82F2712652ACF700BAE94DEB01EC190F50D1B077A348B4D06C7892B28423A303EA37D1 +955000,k,8E369D2EE211F6552AD1783BEB9C412D0F5187E2E1692C99F29D3E2C3F5BCC1E58A58A1BB1A28237826B41769D2D952E86B6F7A76D67B209 +955000,u,2F142EFAD23C6E46FA9815D7B6C440C2E043D3D6645932B80AD0058238203E03EF40C46DDD0CCB551953A8AA60049F6A3989665D26470F59 +956000,k,00B85903B0C272D3E73368F444DAE472014B0DE40230DD8A7CADC7C4112FCA2F17E484831A4062C32C55B64E0F615329BA6320F87462B957 +956000,u,37229928B2DDC501407DF9FCA65ED66AA7CF4F553E4179339332B656AD3A0234E22E6187A6AFFC70512DE563F074E917EA42674AF7D63FF6 +957000,k,CF911E69BA8A7E7124B4372418B7F92F07E68F89196183E74064D5868B100E8C9F617D5BA9E6CB147C1C711E1C8C675889AEA5A4DE8D0DAD +957000,u,AA8DA27B0CDE2BAD70F5E4D364A7912BD64C209BF1C4AFCECD95EED5A018B55B572C91F787335E07C227963E100075EC43D857AD6F4208B7 +958000,k,84AFBB840B22581F0AD02A57093CE7A5EDCB75FC85A6554D598A6A6A596CEA3A7064C1D310B03588EE235D3D649F15C211F3BF5F5AAE8053 +958000,u,C083656931A65584B3E2024BFCC5F853A9DEE05153E948F5E61B23A543901941332FD67F0C8A93A22E387071E84BDFED82E8DA9AC1097B45 +959000,k,495230AC1E1C7FC2F0CBFE48B384FC45101B46977E6CB9E4CD72922B3C41B4EDC701BE08E8CF3282ABFE6D2CB70CAB70E547D399FB8629D0 +959000,u,EB99EBCF76D18ACAA4A4C918A4879106565BE84638D451CA8D6BDE4F8E3ECD11284C3177548A879066256AC22D643BDF235FA21690EFEC03 +960000,k,4B1CDD49E6DBD43E154EBD99A244A07B557DF91345B8D084B2EA800377595F165249BD9D40BB1988800F44A1030103C20478BA41754C7CD1 +960000,u,62F55DCE72547E02457732F687DAFED4529C52F8034C6D0F77FB6187BCB85D0E3BF8ACF5DE146BFF75E6FBE70824F1A23937A79083A409F5 +961000,k,4C7BF7114D53D96B33B2CB4BFD3AD4AD6DBE2DDB0A91DF27472C795F12C59A593953EAC89E42779A8F11E2BD77397ABF3A1A101DED29A02D +961000,u,566ABA28C84C41E2005E58EE6DB8EA3FA2946DC718BCF787ED802F27A9304AACB6F82745EE3EEF6CB548CA8B5E43A92839790C7CFBE94025 +962000,k,95803B54DE48763A7EEA3D837305DB8202E02F93B029B9D36A4DD6CDD68BE43C2F936A6C9B5BC1547858074B1C76A8E42C9E895AD6AE227D +962000,u,D7994C707E9C1127EF5B902A782EDB4C77C92C8B135B84FC76F28909F9046AD001732868FA00D7E78E9C2E8DCA1EE6FA1255D9F1E248090B +963000,k,D0B7BFADC371C47E4C94CF77A604C65419B918E3C9958E0AFA08384641EF6BE7685BC7997940C754EF0365C1B148AA0D3036F65B0FE50359 +963000,u,54C86E99289E619101158EDA38B49F09310CE9282526F5A0CAADF24E111C2564AB2E40CAA66074E886EDF9467ED06025400889A14D7C3848 +964000,k,03256F5F9833ED1E4F7429A354CE2D6427A771B8B274273DB1930F7CB63A33F08673BF80EB12BE7CCC6ED2213BB36970E740FC4FCB6B4F3F +964000,u,1DBAF14BF35F58BD88670C9E5A41DC9D68C380F874A65F7688E5CC1E607625BEF49968A12EA67D45FB2CE4A39D34FFFA24FC9076B23F4498 +965000,k,80B568E0871B83111479230DFC21B2FE1C46F7D202C94D60DFE4B5DCAD837C6EEB577834E0D96A754F62334561A70DD57884CD61BFFFEDA1 +965000,u,3C90FAC2FBEF3C6ACF8CE18161809E107BEF6884154A4C06AE0ACCAA141258F4DC13A49A699919BA6718CD9D4E59CC734EE447506F1CCD29 +966000,k,48F8A9CA67E40C505D946F0E4A85578CEF7A6B355E89B373397FBC9165C97B7EBA32505E1CE4B7253DDB9B504297C5CC4D0E3E6963A543B3 +966000,u,D8426599285414724D9A57829D2F99ACAC73C533DD53F059CBB82F1E7AE0A40C4EDE433688002CBF0DC44F9990EB097283C0DE040176C7CE +967000,k,DB9CF7EA6B1746C9573D231DEFE7A24518296C66EA0C69CCA558515285CE5A3912E5FBA915951ED6A3464CD84DBCADA6DBD1778A439B5A27 +967000,u,DF1A3A6F08C9BE44703FCDEC5F3AA4D1E79CE7F8A9226F3792457412513AF465956611F88A1007FE63AED9F67BF806BA95FA08FA6EBFD0E4 +968000,k,5193BAB52D2C36D3C1DECE426C4168F0B01A8BCA32D5B7DE95633244155E48A5BCC664223A4A9A47993086A42D5C3E9D24D6493914FEAFE4 +968000,u,AB0A30A1FCE5B3C06F5BB4F764F74128A49B5B770E8E9007161CED8474388B3B98AA13287D37EF011D9B0BB708484C8E6451D232DA5E6FB5 +969000,k,E88AB78D35FCCAC5C4CC071190D709111F4AEE2481AC3F4CDFAEB85363E2F8DDE749324858134B7D6C73F6DAA759414E3C448DA89E3839B5 +969000,u,1EA50A61E01136C4EE7510F76328D077F900BBC4C94DFC86785B9895B12C496788C9D5A6BE8CD2E36898C18691E11390B6133F42119C0417 +970000,k,5AEB8E5E5C78642691F40348A8CAF2E6D995E99591E6AEC6489821BA3941FEA3A5AABED1767FD1F1D9A05EB4A3C7A311B3FFAC82C1E17926 +970000,u,37D854C4E28538A415AAA181C31AC8FD2B5D9C4298F7AE9994A19818623342DFC39C77C439E10C9FCF39AE02E7B63F30B122081E15441F56 +971000,k,1C924490E80F8C62A6533B5A8A2E5340808CF2941F490E3A476AEA07F98BBD3ACD8CF67D748560EEA5250EEBA54A8DEA7168C58A9E2C8C65 +971000,u,8CCF97021A282CE6D0A387BDE807F03FE51B8EFF55A2BE504D63BE0EF03A479B828D1159B5AAF617A2C1776DB73846BDB8C5EAA1EB7DF0C0 +972000,k,83723A56C3893E83DAFB4BDA67C74A5A328F1DF27DA32C01998772404C9ABCAAD47B02FD6399E45562D315AE6076D1C15F42CAF7E22F98CC +972000,u,968E6C90DCF89C7566D6CD5D41A0B11AC180FE1300CC6C49ED171222240339404B4D3B79ACBD2911B0BDFE8B536CF03D2325B8C6CB51AD76 +973000,k,6FDBAA6FC9513B4D5B04456074888DCC3918872A2BE686841E9F64071652E1FD2068F3C87D1D891419C853EDBA98202E338838A9E61F1F55 +973000,u,8CDEE9D0801E6EEF0FA0B8E4A2662E8ABD128169BD075CBBA6C7FC94F1AAB70997E33806B0B7583F5CE7C4FF39E9D7050502872DD9AF336F +974000,k,2A4CB5AB4BAE7680F9F72F1C7782E1CBB4F15CD45979E336ED3FC4D2F7FD7CD2160E053180A9931EA5AC54E8C03789B87D03FCDB2E4AF46E +974000,u,3FE0FF91128CBD7A692866EA186DF6815A8CB82D09390E75A37F8FCED08A4972E2B51306548E7481AB0EB7CE2E17E92DA45F8B93316EB5E3 +975000,k,A5755DF3409757A4677D0E1B33A41EC42F62C2ADC3771220D59B50246879451A024415E5682D20EA37279C0CF22ED211BC7BD4F7A8507334 +975000,u,03CDFC805932CC640FDF8EA51BDA001E72B339326F355B67E2F98B733DFD67595C1829C4D468DFC4CE38F4C961F43D5B04FB49CBD4F10566 +976000,k,41DD9BDE908BC8075A0946DF56ECDD54BD3A30543239905CEC5DFB94C0DD4C6160A701B61FE85B8BBF9C6E708D22205EB555E4F747A25A2A +976000,u,D75CCE5028E90EDF13822B752E1C73114F945E6DF9AA1962389D45E2F9EC6C1ECD8FE32E6C34034C32C0E41A959D8B9A1E09459AE9435992 +977000,k,4135C6D6BA490B7285B1995E7532093E3C35C80909E82333B09BFAEA11A7922461C173F752745FF94F6725806509FF5591BE81C07A089B23 +977000,u,B94CDAA2B9B20F8BB46068508E30133DE7D79F6DFD77D98DE1670C487AFEFDA4D48665E0C6F7E19609FC6219D55A054B221354164D0F1567 +978000,k,04A4E023F0C419BBC61B29E90930E81F0F5A8835972497EBE6A060BF90F4162D25C36BFBCD4983C81BA0BBD8CA2A9B5AF18AB36F5453202A +978000,u,6FBF0C588D81309503F99DF941EA91D76C39BA09BC4C93868F27137644A5A620FE141A307CD1D539016BB7405A6BD88CFF7BCEF989125EFA +979000,k,013D586D2FBC7162C57B66454F1E2B7346BE9D8E0732B0F0FE60DCF47E9753780AA92816998B95910DAECACF819104BBFE6F517A0101317A +979000,u,301F17BD7F46BFED8C6E4ECD6F0EDBEDCCBA974FCEBA5C11544613FDC7B3B95CEB6C5187255D4494CF2FE6CCBB8B18FBA9B0369540D00C16 +980000,k,6873A2CD21EEBCEC4A2C0F264402C64AE09AB38C097AB218902433FF7BC4F98928239373B3ABC209117A7F8DD6AD186CB8DE52C69887B6E4 +980000,u,5824B2C6068CE915B757F708CF66E80AB956AF691CD1BBB8ED47975FD4F4C182CE9BD83775D1086EF080DA7236BF4DB3EA4920AB0F42C8D4 +981000,k,217D4B8E53C26DC67AF3A7A0756C1D17FEC0C06394DEB9AEDCAFE764AB1BD32D878AFCF099271B2C754A979C669F0DB065CF56D8DEC69BA7 +981000,u,B7226559D90F5C3A7091EC40FCCFCA2CFE2842A072BD77F52B16ED8F1B5395745797B2559D0100E68D5867E78A31FACDDCE7C98F4C14BD2C +982000,k,8D40EE053B744DA7B294BF91A3A61F96E1ACAA8606C65499E03BADF8CF9599760F23462EE59C2D6EC78AC3CD04A0F536E7A8954B486B10C7 +982000,u,40D3EEEFBCDD987D15D2EE279A47036E258C7A5118A65B1DE1E7D3AD484A1507E2DB0F275E6B75179288EC862142A6866FA894ED88A7855A +983000,k,79110927EE5683DB993351E55C4C15C515600821D6AE8410F9B1A6CEA80C05AF59141A016873B66A5D779398CA960A3117417506B2D11AD5 +983000,u,091DF62AB81A99F61295ACE526408CB6631593EDAB89668868CB3A5E58D7D9E673589347066230BDCB66E7C1441D883F1A77CB879F8FA44A +984000,k,9E975BEB30B2CED0F1995723E2F4D3BE8FD5B9B876A6820F9CC2AFB0C6667F8C5E4071598AF2AB20EBA5B767B81A0B37F7FBF211C36D4FC9 +984000,u,85A32751D1E43B9E64E62808C9A4700888151B7B017D27780DE37AE2EF997F551C52052427F96265E98B87CDF0636C9FB6FC09F6B98ED1CE +985000,k,56277A871868B30B0B2618C32D6130F5BBBA178A65112006D6D273DB91AE43023378938899373499723806821BAA60CE038FBE9C3B9BEB5B +985000,u,0A221B5DF32CA890769D6C2C8CC03EB8B8B4226404FE15DDD7E765DEF31FF6A0CC80869A4D51AA23A3AC5D370993BBF745C42B5850937A87 +986000,k,E9A6A064FDB7FF16F14CD775DCBCC6330E96B1D3D90393A8E996DE3B670A0F4FD4A658AB944E5972B36AB50FC21AE929211F040C01BDA4C5 +986000,u,60DD5CE5C481E62F1E9639D2121BFE0A2359C288842C5C03A60026635E790F90B72BC0315E2DAFB2EA591A5E25C13C6625F05A77876DCF1E +987000,k,D48B2E5105CA0E349A0AB48CE17938C6B9F09B7507471213C429E706BAAEEB3B484EF7E104D03990791FBEC8461BE8F38BE4E5B1964BC782 +987000,u,7E8B0C9E332FB381B85D57D13AD90F60E40AE4136E8DCE5309E6492502A9A9A4242F220867C670C0BC94C404029A2AE3F6A2B4061EA85447 +988000,k,86CBBD6ED3DB22700825162BA321CAC9D218B5172342EDFD58C835637CF83DC3E6588807376169F3875AC5890E6D38539E491FE75347A1BC +988000,u,8E9182769107ED1FBDD0696034143C83E5124E748BA0D6ACEA380DC237569948E3894450C6F8D1398E2FB18384237B16E3B156C2E8BD5EEB +989000,k,B6057D084971A1D17164F439580AE883933F278EDD145A5D12BAC104BA8E07D65615B7D3BD6BE265C36B3979494E9C1FB3AAB45E3DFE4257 +989000,u,2CB2719B12D20ADAE4F94A0586199996E5634BB40715A3E5E8952BEEE00D204053944667E296DB20DED66A1F094BCD9A7E34DE636D781570 +990000,k,AD15F461527A0E395FE3C32B2A780DCCF463D934F821CCDDBE410B04014AA3F69BD0DEE62D1A6E761DD8616FB1929D345F57F084B9F6E5FA +990000,u,99153864A9D7149B05F2F6987120E45F698B2808803839D5185B7E1A4D89F9C453398CAFEC7B0E1EF38017F477F491DE6FC6EDCB654EA4B7 +991000,k,8DEDA5B2E44D7979A4A71C963673702A890000BA28C5F581D90CD13223B0B8F8C449F078A339A20263162F951421139E10E8A3A3060FB032 +991000,u,0EA043A50EB051B77C97225BFE4999ECAE840B3CC65D0DDC6A1060E3D9CE9FFB097B9698C8AC21ED4F05AFC73FC9CF0F2515B569A75408E2 +992000,k,DFD6E351C5518B395BA97F78F006F2AD6E19DB0FA94BFA4992D75F2C410C609562F3573D4E50B22D23DF36DB2080529F1BC210356F07B0AA +992000,u,36B26BA66786E803DC56E4C317050F05CB11FBB3DEDA3C57BF3647C1D696F9110F5AF2FAEC5321EA2394A8CAA44618E48EBA1C049D918E1C +993000,k,3B5560675AD3DA4E8E55F8C6201DB63E846016D39ECB60BBBE399268FC473534AD2DE0E7F144BBD937A2C67B09E0B5A052A7CFA6B89CB7E2 +993000,u,36C716CA897F18FC751976CBBD02B1849BBB146C90C3BFAAF42767BCEED3B2D357138478D740CDA099F44C614192245E607746FBC6758054 +994000,k,09907D439AC73CB54940C5FE410E17FC66E9A5ECB5D8A49B1DB02E273241A99AE6489BB92F2F36D505484B91E11CB073E2FD505C578E6148 +994000,u,48BAC58FD3C7828CE17C5F16C07EC17420EE98F6A4D17E8D79E682E4E5E68D29654079BCDE1DEA8424D7847D290C808BCCDB38C7107F3E28 +995000,k,938954101E808977B6D527AF43384AC8DD28D9F3F81A59F737C34B2DB376F04FEA5ECC92D9D4701EC9B04B897CD5B0F8529171D524A5EB9D +995000,u,4C4D580F3B2DEA6CB405A46D8B83004B2C963986867448FE051D3924C4824C6533A29B97BF2CA737237B65042F5415DEB231E984F8B5B11E +996000,k,5F57132734294AD302B6B9A328DBFAB2AF456EE9F6770F349D1DDACAEF2D9AC6D0141E2CCAACD4D083A992410008CFCF8F6EE323E7071A29 +996000,u,F3BD6CF6D077CAAADD30E477D19F27A7776C3A521999CE9EA193C27FA26C6DEB1A1DF6A38FDCAA1079027AA7096FF1AA6BDC6524E4AAFD8C +997000,k,A8A78BE35BF22AFA2A24006048CC8658EE91F7D9D50AB6F97685A3BC2AC1071C642B7C9383A2CEF8FEC6E69FD421AEC5F894B574582CDF05 +997000,u,25CAE41B5ED53C507DFE3BA42D4F160642F410F2AF76CDB8639A4317F0C00B3D19B04112EFEA0BC7904A497E4DACE843EDAA0549A060FDBF +998000,k,C0D55D77778B87FA7F6E3D41753E184E4511220A170AB6D609065B38A4B51A71C1E65528C9CC452889B6CD99F17CFEC874F4908E105C36A9 +998000,u,86080CC763AC1F55BB79464F01934CEDDF5C7E9941E305A18F45911E5B612B7B1EBC1235E59006CAF821645AB9F3208F11982ED7E6A51FF0 +999000,k,663E3B9CAF0E75A520C87C4B56F0F8067DD82815551D5B4F83D08DB0467D8DE9593F991C4DDB1DCD1DE1173A8A1CFA6D669B2CE613CC4178 +999000,u,20620AC8719AF4B4867A9F25B1A422B23A6E57A24575F37E22F102031DEBEBABD3BE2E3590B4823223B010AFC8C4475FC688276A2B0FC80A +1000000,k,077F453681CACA3693198420BBE515CAE0002472519B3E67661A7E89CAB94695C8F4BCD66E61B9B9C946DA8D524DE3D69BD9D9D66B997E37 +1000000,u,2587A975FD303F32E750307485ABE285467CA36AB22C682E952E65EC7582752F97EAB484574021A8F2EB3BB7FF98CD12DB7184F9E035B178 diff --git a/test/jdk/sun/security/ec/xec/XECIterative.java b/test/jdk/sun/security/ec/xec/XECIterative.java new file mode 100644 index 00000000000..05ad0f57129 --- /dev/null +++ b/test/jdk/sun/security/ec/xec/XECIterative.java @@ -0,0 +1,137 @@ +/* + * 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 + * @bug 8171277 + * @summary XEC curve operations iterative test vectors + * @library /test/lib + * @build jdk.test.lib.Convert + * @modules jdk.crypto.ec/sun.security.ec + * @run main XECIterative 0 10000 + * @run main XECIterative 10000 20000 + * @run main XECIterative 20000 30000 + * @run main XECIterative 30000 40000 + * @run main XECIterative 40000 50000 + * @run main XECIterative 50000 60000 + * @run main XECIterative 60000 70000 + * @run main XECIterative 70000 80000 + * @run main XECIterative 80000 90000 + * @run main XECIterative 90000 100000 + */ + +import sun.security.ec.*; + +import java.io.*; +import java.util.*; +import jdk.test.lib.Convert; + +/* + * This test is derived from the iterative test in RFC 7748. To produce the + * test vectors, the implementation ran for 1,000,000 iterations and saved + * values of k and u at periodic checkpoints. The RFC includes the correct + * value of k after 1,000,000 iterations, and this value was used to ensure + * that the test vectors are correct. This test has multiple @run tags so that + * no single run takes too long. + */ + +public class XECIterative { + + private static class KU { + + public byte[] k; + public byte[] u; + + } + + public static void main(String[] args) throws IOException { + + long start = Long.parseLong(args[0]); + long end = Long.parseLong(args[1]); + + XECIterative m = new XECIterative(); + + m.runIterativeTest("X25519", start, end); + m.runIterativeTest("X448", start, end); + + } + + private void runIterativeTest(String opName, long start, long end) + throws IOException { + + XECParameters settings = XECParameters.getByName(opName).get(); + XECOperations ops = new XECOperations(settings); + + File vectorFile = new File(System.getProperty("test.src", "."), + opName + ".iter"); + + Map<Long, KU> testIters = new HashMap<Long, KU>(); + BufferedReader in = new BufferedReader(new FileReader(vectorFile)); + String line; + while ((line = in.readLine()) != null) { + StringTokenizer tok = new StringTokenizer(line, ","); + long iter = Long.parseLong(tok.nextToken()); + String kOrU = tok.nextToken(); + byte[] value = Convert.hexStringToByteArray(tok.nextToken()); + KU entry = testIters.get(iter); + if (entry == null) { + entry = new KU(); + testIters.put(iter, entry); + } + if (kOrU.equals("k")) { + entry.k = value; + } else { + entry.u = value; + } + } + + KU startEntry = testIters.get(start); + byte[] k = startEntry.k.clone(); + byte[] u = startEntry.u.clone(); + + for (long i = start; i <= end; i++) { + KU curEntry; + if (i % 1000 == 0 && (curEntry = testIters.get(i)) != null) { + if (!Arrays.equals(k, curEntry.k)) { + throw new RuntimeException("At iter " + i + ": expected k: " + + Convert.byteArrayToHexString(curEntry.k) + + ", computed k: " + Convert.byteArrayToHexString(k)); + } + if (!Arrays.equals(u, curEntry.u)) { + throw new RuntimeException("At iter " + i + ": expected u: " + + Convert.byteArrayToHexString(curEntry.u) + + ", computed u: " + Convert.byteArrayToHexString(u)); + } + System.out.println(opName + " checkpoint passed at " + i); + } + + byte[] k_copy = Arrays.copyOf(k, k.length); + byte[] u_out = ops.encodedPointMultiply(k, u); + u = k_copy; + k = u_out; + } + } + +} + + diff --git a/test/jdk/sun/security/util/math/BigIntegerModuloP.java b/test/jdk/sun/security/util/math/BigIntegerModuloP.java new file mode 100644 index 00000000000..ec2f975dbd1 --- /dev/null +++ b/test/jdk/sun/security/util/math/BigIntegerModuloP.java @@ -0,0 +1,273 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import sun.security.util.math.*; + +import java.math.BigInteger; +import java.nio.ByteBuffer; + +/** + * Arithmetic in the field of integers modulo a prime value implemented using + * BigInteger. This implementation is very versatile, but it is slow and none + * of the operations are value-independent. This class is intended for use in + * testing and prototyping, and production code should probably use a more + * specialized arithmetic implementation. + */ + +public class BigIntegerModuloP implements IntegerFieldModuloP { + + private final BigInteger p; + + public BigIntegerModuloP(BigInteger p) { + this.p = p; + } + + @Override + public BigInteger getSize() { + return p; + } + + @Override + public ImmutableElement get0() { + return new ImmutableElement(BigInteger.ZERO); + } + @Override + public ImmutableElement get1() { + return new ImmutableElement(BigInteger.ONE); + } + @Override + public ImmutableElement getElement(BigInteger v) { + return new ImmutableElement(v); + } + @Override + public ImmutableElement getElement(byte[] v, int offset, int length, + byte highByte) { + byte[] bigIntIn = new byte[length + 1]; + System.arraycopy(v, offset, bigIntIn, 0, length); + bigIntIn[length] = highByte; + reverse(bigIntIn); + return new ImmutableElement(new BigInteger(1, bigIntIn).mod(getSize())); + } + @Override + public SmallValue getSmallValue(int i) { + return new SmallElement(i); + } + + private abstract class Element implements IntegerModuloP { + + protected BigInteger v; + + protected Element(BigInteger v) { + this.v = v; + } + + protected Element(boolean v) { + this.v = BigInteger.valueOf(v ? 1 : 0); + } + + private BigInteger getModulus() { + return getField().getSize(); + } + + @Override + public IntegerFieldModuloP getField() { + return BigIntegerModuloP.this; + } + + @Override + public BigInteger asBigInteger() { + return v; + } + + @Override + public MutableElement mutable() { + return new MutableElement(v); + } + + @Override + public ImmutableElement fixed() { + return new ImmutableElement(v); + } + + @Override + public ImmutableElement add(IntegerModuloP b) { + return new ImmutableElement( + v.add(b.asBigInteger()).mod(getModulus())); + } + + @Override + public ImmutableElement additiveInverse() { + return new ImmutableElement(v.negate().mod(getModulus())); + } + + @Override + public ImmutableElement multiply(IntegerModuloP b) { + return new ImmutableElement( + v.multiply(b.asBigInteger()).mod(getModulus())); + } + + @Override + public void addModPowerTwo(IntegerModuloP arg, byte[] result) { + BigInteger biThis = asBigInteger(); + BigInteger biArg = arg.asBigInteger(); + bigIntAsByteArray(biThis.add(biArg), result); + } + + private void bigIntAsByteArray(BigInteger arg, byte[] result) { + byte[] bytes = arg.toByteArray(); + // bytes is backwards and possibly too big + // Copy the low-order bytes into result in reverse + int sourceIndex = bytes.length - 1; + for (int i = 0; i < result.length; i++) { + if (sourceIndex >= 0) { + result[i] = bytes[sourceIndex--]; + } else { + result[i] = 0; + } + } + } + + @Override + public void asByteArray(byte[] result) { + bigIntAsByteArray(v, result); + } + } + + private class ImmutableElement extends Element + implements ImmutableIntegerModuloP { + + private ImmutableElement(BigInteger v) { + super(v); + } + } + + private class MutableElement extends Element + implements MutableIntegerModuloP { + + private MutableElement(BigInteger v) { + super(v); + } + + @Override + public void conditionalSwapWith(MutableIntegerModuloP b, int swap) { + if (swap == 1) { + BigInteger temp = v; + v = b.asBigInteger(); + ((Element) b).v = temp; + } + } + + @Override + public MutableElement setValue(IntegerModuloP v) { + this.v = ((Element) v).v; + + return this; + } + + @Override + public MutableElement setValue(byte[] arr, int offset, int length, + byte highByte) { + byte[] bigIntIn = new byte[length + 1]; + System.arraycopy(arr, offset, bigIntIn, 0, length); + bigIntIn[length] = highByte; + reverse(bigIntIn); + v = new BigInteger(bigIntIn).mod(getSize()); + + return this; + } + + @Override + public MutableElement setValue(ByteBuffer buf, int length, + byte highByte) { + byte[] bigIntIn = new byte[length + 1]; + buf.get(bigIntIn, 0, length); + bigIntIn[length] = highByte; + reverse(bigIntIn); + v = new BigInteger(bigIntIn).mod(getSize()); + + return this; + } + + @Override + public MutableElement setSquare() { + v = v.multiply(v).mod(getSize()); + return this; + } + + @Override + public MutableElement setProduct(IntegerModuloP b) { + Element other = (Element) b; + v = v.multiply(other.v).mod(getSize()); + return this; + } + + @Override + public MutableElement setProduct(SmallValue value) { + BigInteger bigIntValue = ((SmallElement) value).asBigInteger(); + v = v.multiply(bigIntValue).mod(getSize()); + return this; + } + + @Override + public MutableElement setSum(IntegerModuloP b) { + Element other = (Element) b; + v = v.add(other.v).mod(getSize()); + return this; + } + + @Override + public MutableElement setDifference(IntegerModuloP b) { + Element other = (Element) b; + v = v.subtract(other.v).mod(getSize()); + return this; + } + + } + + private class SmallElement extends ImmutableElement implements SmallValue { + + public SmallElement(int v) { + super(BigInteger.valueOf(v).mod(getSize())); + } + } + + private static void swap(byte[] arr, int i, int j) { + byte tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } + + private static void reverse(byte [] arr) { + int i = 0; + int j = arr.length - 1; + + while (i < j) { + swap(arr, i, j); + i++; + j--; + } + } + +} diff --git a/test/jdk/sun/security/util/math/TestIntegerModuloP.java b/test/jdk/sun/security/util/math/TestIntegerModuloP.java new file mode 100644 index 00000000000..167888e2a0d --- /dev/null +++ b/test/jdk/sun/security/util/math/TestIntegerModuloP.java @@ -0,0 +1,377 @@ +/* + * 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 + * @bug 8181594 + * @summary Test proper operation of integer field arithmetic + * @modules java.base/sun.security.util java.base/sun.security.util.math java.base/sun.security.util.math.intpoly + * @build BigIntegerModuloP + * @run main TestIntegerModuloP sun.security.util.math.intpoly.IntegerPolynomial25519 32 0 + * @run main TestIntegerModuloP sun.security.util.math.intpoly.IntegerPolynomial448 56 1 + * @run main TestIntegerModuloP sun.security.util.math.intpoly.IntegerPolynomial1305 16 2 + */ + +import sun.security.util.math.*; +import java.util.function.*; + +import java.util.*; +import java.math.*; +import java.nio.*; + +public class TestIntegerModuloP { + + static BigInteger TWO = BigInteger.valueOf(2); + + // The test has a list of functions, and it selects randomly from that list + + // The function types + interface ElemFunction extends BiFunction + <MutableIntegerModuloP, IntegerModuloP, IntegerModuloP> { } + interface ElemArrayFunction extends BiFunction + <MutableIntegerModuloP, IntegerModuloP, byte[]> { } + interface TriConsumer <T, U, V> { + void accept(T t, U u, V v); + } + interface ElemSetFunction extends TriConsumer + <MutableIntegerModuloP, IntegerModuloP, byte[]> { } + + // The lists of functions. Multiple lists are needed because the test + // respects the limitations of the arithmetic implementations. + static final List<ElemFunction> ADD_FUNCTIONS = new ArrayList<>(); + static final List<ElemFunction> MULT_FUNCTIONS = new ArrayList<>(); + static final List<ElemArrayFunction> ARRAY_FUNCTIONS = new ArrayList<>(); + static final List<ElemSetFunction> SET_FUNCTIONS = new ArrayList<>(); + + static void setUpFunctions(IntegerFieldModuloP field, int length) { + + ADD_FUNCTIONS.clear(); + MULT_FUNCTIONS.clear(); + SET_FUNCTIONS.clear(); + ARRAY_FUNCTIONS.clear(); + + byte highByte = (byte) + (field.getSize().bitLength() > length * 8 ? 1 : 0); + + // add functions are (im)mutable add/subtract + ADD_FUNCTIONS.add(IntegerModuloP::add); + ADD_FUNCTIONS.add(IntegerModuloP::subtract); + ADD_FUNCTIONS.add(MutableIntegerModuloP::setSum); + ADD_FUNCTIONS.add(MutableIntegerModuloP::setDifference); + // also include functions that return the first/second argument + ADD_FUNCTIONS.add((a, b) -> a); + ADD_FUNCTIONS.add((a, b) -> b); + + // mult functions are (im)mutable multiply and square + MULT_FUNCTIONS.add(IntegerModuloP::multiply); + MULT_FUNCTIONS.add((a, b) -> a.square()); + MULT_FUNCTIONS.add((a, b) -> b.square()); + MULT_FUNCTIONS.add(MutableIntegerModuloP::setProduct); + MULT_FUNCTIONS.add((a, b) -> a.setSquare()); + // also test multiplication by a small value + MULT_FUNCTIONS.add((a, b) -> a.setProduct(b.getField().getSmallValue( + b.asBigInteger().mod(BigInteger.valueOf(262144)).intValue()))); + + // set functions are setValue with various argument types + SET_FUNCTIONS.add((a, b, c) -> a.setValue(b)); + SET_FUNCTIONS.add((a, b, c) -> + a.setValue(c, 0, c.length, (byte) 0)); + SET_FUNCTIONS.add((a, b, c) -> + a.setValue(ByteBuffer.wrap(c, 0, c.length).order(ByteOrder.LITTLE_ENDIAN), + c.length, highByte)); + + // array functions return the (possibly modified) value as byte array + ARRAY_FUNCTIONS.add((a, b ) -> a.asByteArray(length)); + ARRAY_FUNCTIONS.add((a, b) -> a.addModPowerTwo(b, length)); + } + + public static void main(String[] args) { + + String className = args[0]; + final int length = Integer.parseInt(args[1]); + int seed = Integer.parseInt(args[2]); + + Class<IntegerFieldModuloP> fieldBaseClass = IntegerFieldModuloP.class; + try { + Class<? extends IntegerFieldModuloP> clazz = + Class.forName(className).asSubclass(fieldBaseClass); + IntegerFieldModuloP field = + clazz.getDeclaredConstructor().newInstance(); + + setUpFunctions(field, length); + + runFieldTest(field, length, seed); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + System.out.println("All tests passed"); + } + + + static void assertEqual(IntegerModuloP e1, IntegerModuloP e2) { + + if (!e1.asBigInteger().equals(e2.asBigInteger())) { + throw new RuntimeException("values not equal: " + + e1.asBigInteger() + " != " + e2.asBigInteger()); + } + } + + // A class that holds pairs of actual/expected values, and allows + // computation on these pairs. + static class TestPair<T extends IntegerModuloP> { + private final T test; + private final T baseline; + + public TestPair(T test, T baseline) { + this.test = test; + this.baseline = baseline; + } + + public T getTest() { + return test; + } + public T getBaseline() { + return baseline; + } + + private void assertEqual() { + TestIntegerModuloP.assertEqual(test, baseline); + } + + public TestPair<MutableIntegerModuloP> mutable() { + return new TestPair<>(test.mutable(), baseline.mutable()); + } + + public + <R extends IntegerModuloP, X extends IntegerModuloP> + TestPair<X> apply(BiFunction<T, R, X> func, TestPair<R> right) { + X testResult = func.apply(test, right.test); + X baselineResult = func.apply(baseline, right.baseline); + return new TestPair(testResult, baselineResult); + } + + public + <U extends IntegerModuloP, V> + void apply(TriConsumer<T, U, V> func, TestPair<U> right, V argV) { + func.accept(test, right.test, argV); + func.accept(baseline, right.baseline, argV); + } + + public + <R extends IntegerModuloP> + void applyAndCheckArray(BiFunction<T, R, byte[]> func, + TestPair<R> right) { + byte[] testResult = func.apply(test, right.test); + byte[] baselineResult = func.apply(baseline, right.baseline); + if (!Arrays.equals(testResult, baselineResult)) { + throw new RuntimeException("Array values do not match: " + + byteArrayToHexString(testResult) + " != " + + byteArrayToHexString(baselineResult)); + } + } + + } + + static String byteArrayToHexString(byte[] arr) { + StringBuilder result = new StringBuilder(); + for (int i = 0; i < arr.length; ++i) { + byte curVal = arr[i]; + result.append(Character.forDigit(curVal >> 4 & 0xF, 16)); + result.append(Character.forDigit(curVal & 0xF, 16)); + } + return result.toString(); + } + + static TestPair<IntegerModuloP> + applyAndCheck(ElemFunction func, TestPair<MutableIntegerModuloP> left, + TestPair<IntegerModuloP> right) { + + TestPair<IntegerModuloP> result = left.apply(func, right); + result.assertEqual(); + left.assertEqual(); + right.assertEqual(); + + return result; + } + + static void + setAndCheck(ElemSetFunction func, TestPair<MutableIntegerModuloP> left, + TestPair<IntegerModuloP> right, byte[] argV) { + + left.apply(func, right, argV); + left.assertEqual(); + right.assertEqual(); + } + + static TestPair<MutableIntegerModuloP> + applyAndCheckMutable(ElemFunction func, + TestPair<MutableIntegerModuloP> left, + TestPair<IntegerModuloP> right) { + + TestPair<IntegerModuloP> result = applyAndCheck(func, left, right); + + TestPair<MutableIntegerModuloP> mutableResult = result.mutable(); + mutableResult.assertEqual(); + result.assertEqual(); + left.assertEqual(); + right.assertEqual(); + + return mutableResult; + } + + static void + cswapAndCheck(int swap, TestPair<MutableIntegerModuloP> left, + TestPair<MutableIntegerModuloP> right) { + + left.getTest().conditionalSwapWith(right.getTest(), swap); + left.getBaseline().conditionalSwapWith(right.getBaseline(), swap); + + left.assertEqual(); + right.assertEqual(); + + } + + // Request arithmetic that should overflow, and ensure that overflow is + // detected. + static void runOverflowTest(TestPair<IntegerModuloP> elem) { + + TestPair<MutableIntegerModuloP> mutableElem = elem.mutable(); + + try { + for (int i = 0; i < 1000; i++) { + applyAndCheck(MutableIntegerModuloP::setSum, mutableElem, elem); + } + applyAndCheck(MutableIntegerModuloP::setProduct, mutableElem, elem); + } catch (ArithmeticException ex) { + // this is expected + } + + mutableElem = elem.mutable(); + try { + for (int i = 0; i < 1000; i++) { + elem = applyAndCheck(IntegerModuloP::add, + mutableElem, elem); + } + applyAndCheck(IntegerModuloP::multiply, mutableElem, elem); + } catch (ArithmeticException ex) { + // this is expected + } + } + + // Run a large number of random operations and ensure that + // results are correct + static void runOperationsTest(Random random, int length, + TestPair<IntegerModuloP> elem, + TestPair<IntegerModuloP> right) { + + TestPair<MutableIntegerModuloP> left = elem.mutable(); + + for (int i = 0; i < 10000; i++) { + + ElemFunction addFunc1 = + ADD_FUNCTIONS.get(random.nextInt(ADD_FUNCTIONS.size())); + TestPair<MutableIntegerModuloP> result1 = + applyAndCheckMutable(addFunc1, left, right); + + // left could have been modified, so turn it back into a summand + applyAndCheckMutable((a, b) -> a.setSquare(), left, right); + + ElemFunction addFunc2 = + ADD_FUNCTIONS.get(random.nextInt(ADD_FUNCTIONS.size())); + TestPair<IntegerModuloP> result2 = + applyAndCheck(addFunc2, left, right); + + ElemFunction multFunc2 = + MULT_FUNCTIONS.get(random.nextInt(MULT_FUNCTIONS.size())); + TestPair<MutableIntegerModuloP> multResult = + applyAndCheckMutable(multFunc2, result1, result2); + + int swap = random.nextInt(2); + cswapAndCheck(swap, left, multResult); + + ElemSetFunction setFunc = + SET_FUNCTIONS.get(random.nextInt(SET_FUNCTIONS.size())); + byte[] valueArr = new byte[length]; + random.nextBytes(valueArr); + setAndCheck(setFunc, result1, result2, valueArr); + + // left could have been modified, so to turn it back into a summand + applyAndCheckMutable((a, b) -> a.setSquare(), left, right); + + ElemArrayFunction arrayFunc = + ARRAY_FUNCTIONS.get(random.nextInt(ARRAY_FUNCTIONS.size())); + left.applyAndCheckArray(arrayFunc, right); + } + } + + // Run all the tests for a given field + static void runFieldTest(IntegerFieldModuloP testField, + int length, int seed) { + System.out.println("Testing: " + testField.getClass().getSimpleName()); + + Random random = new Random(seed); + + IntegerFieldModuloP baselineField = + new BigIntegerModuloP(testField.getSize()); + + int numBits = testField.getSize().bitLength(); + BigInteger r = + new BigInteger(numBits, random).mod(testField.getSize()); + TestPair<IntegerModuloP> rand = + new TestPair(testField.getElement(r), baselineField.getElement(r)); + + runOverflowTest(rand); + + // check combinations of operations for different kinds of elements + List<TestPair<IntegerModuloP>> testElements = new ArrayList<>(); + testElements.add(rand); + testElements.add(new TestPair(testField.get0(), baselineField.get0())); + testElements.add(new TestPair(testField.get1(), baselineField.get1())); + byte[] testArr = {121, 37, -100, -5, 76, 33}; + testElements.add(new TestPair(testField.getElement(testArr), + baselineField.getElement(testArr))); + + testArr = new byte[length]; + random.nextBytes(testArr); + testElements.add(new TestPair(testField.getElement(testArr), + baselineField.getElement(testArr))); + + random.nextBytes(testArr); + byte highByte = (byte) (numBits > length * 8 ? 1 : 0); + testElements.add( + new TestPair( + testField.getElement(testArr, 0, testArr.length, highByte), + baselineField.getElement(testArr, 0, testArr.length, highByte) + ) + ); + + for (int i = 0; i < testElements.size(); i++) { + for (int j = 0; j < testElements.size(); j++) { + runOperationsTest(random, length, testElements.get(i), + testElements.get(j)); + } + } + } +} + diff --git a/test/langtools/TEST.groups b/test/langtools/TEST.groups index 2c2d9815a57..8c54260ff90 100644 --- a/test/langtools/TEST.groups +++ b/test/langtools/TEST.groups @@ -38,6 +38,7 @@ tier1 = \ -jdk/jshell/ToolBasicTest.java \ -jdk/jshell/ToolLocaleMessageTest.java \ -jdk/jshell/ToolReloadTest.java \ + -jdk/jshell/UserInputTest.java \ -jdk/jshell/UserJdiUserRemoteTest.java # (Almost) no langtools tests are tier 2. @@ -53,6 +54,7 @@ tier2 = \ jdk/jshell/ToolBasicTest.java \ jdk/jshell/ToolLocaleMessageTest.java \ jdk/jshell/ToolReloadTest.java \ + jdk/jshell/UserInputTest.java \ jdk/jshell/UserJdiUserRemoteTest.java # No langtools tests are tier 3 either. diff --git a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java index 918af79c91b..4f6700927a3 100644 --- a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java +++ b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -35,6 +35,7 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting ExecutionControlTestBase Compiler * @run testng FailOverDirectExecutionControlTest + * @key intermittent */ import java.nio.file.Path; diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java index e838252f540..0cc828a01d3 100644 --- a/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java +++ b/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -29,6 +29,7 @@ * jdk.jshell/jdk.jshell.spi * @build KullaTesting ExecutionControlTestBase DyingRemoteAgent * @run testng FailOverExecutionControlDyingLaunchTest + * @key intermittent */ import org.testng.annotations.Test; diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java index fc40f886c1e..8c0131df288 100644 --- a/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java +++ b/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -29,6 +29,7 @@ * jdk.jshell/jdk.jshell.spi * @build KullaTesting ExecutionControlTestBase * @run testng FailOverExecutionControlHangingListenTest + * @key intermittent */ import java.net.InetAddress; diff --git a/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java index d305577a70c..6f1c86b950c 100644 --- a/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -28,6 +28,7 @@ * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution * @build HangingRemoteAgent * @run testng JdiHangingListenExecutionControlTest + * @key intermittent */ import org.testng.annotations.Test; diff --git a/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java b/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java index 41cfe6c019c..af9dce89bcf 100644 --- a/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -28,6 +28,7 @@ * @modules jdk.jshell/jdk.jshell.execution * @build KullaTesting ExecutionControlTestBase * @run testng JdiLaunchingExecutionControlTest + * @key intermittent */ diff --git a/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java b/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java index 7003eb7a006..700ec077e34 100644 --- a/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -28,6 +28,7 @@ * @modules jdk.jshell/jdk.jshell.execution * @build KullaTesting ExecutionControlTestBase * @run testng JdiListeningExecutionControlTest + * @key intermittent */ diff --git a/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java b/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java index 14daf2bcd82..241774d639e 100644 --- a/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -28,6 +28,7 @@ * @modules jdk.jshell/jdk.jshell.execution * @build KullaTesting ExecutionControlTestBase * @run testng JdiListeningLocalhostExecutionControlTest + * @key intermittent */ diff --git a/test/langtools/jdk/jshell/ToolBasicTest.java b/test/langtools/jdk/jshell/ToolBasicTest.java index 096c3c02024..37dce8268ec 100644 --- a/test/langtools/jdk/jshell/ToolBasicTest.java +++ b/test/langtools/jdk/jshell/ToolBasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405 8174796 8174797 8175304 8167554 8180508 8166232 8196133 + * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405 8174796 8174797 8175304 8167554 8180508 8166232 8196133 8199912 * @summary Tests for Basic tests for REPL tool * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -33,12 +33,15 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler * @run testng/timeout=600 ToolBasicTest + * @key intermittent */ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; +import java.net.InetAddress; +import java.net.InetSocketAddress; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -52,6 +55,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.sun.net.httpserver.HttpServer; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; @@ -491,6 +495,49 @@ public class ToolBasicTest extends ReplToolTesting { } } + public void testOpenLocalFileUrl() { + Compiler compiler = new Compiler(); + Path path = compiler.getPath("testOpen.repl"); + compiler.writeToFile(path, "int a = 10;int b = 20;int c = a + b;\n"); + for (String s : new String[]{"/o", "/open"}) { + test( + (a) -> assertCommand(a, s + " " + path.toUri(), ""), + (a) -> assertCommand(a, "a", "a ==> 10"), + (a) -> assertCommand(a, "b", "b ==> 20"), + (a) -> assertCommand(a, "c", "c ==> 30") + ); + } + } + + public void testOpenFileOverHttp() throws IOException { + var script = "int a = 10;int b = 20;int c = a + b;"; + + var localhostAddress = new InetSocketAddress(InetAddress.getLocalHost().getHostAddress(), 0); + var httpServer = HttpServer.create(localhostAddress, 0); + try { + httpServer.createContext("/script", exchange -> { + exchange.sendResponseHeaders(200, script.length()); + try (var output = exchange.getResponseBody()) { + output.write(script.getBytes()); + } + }); + httpServer.setExecutor(null); + httpServer.start(); + + var urlAddress = "http:/" + httpServer.getAddress().toString() + "/script"; + for (String s : new String[]{"/o", "/open"}) { + test( + (a) -> assertCommand(a, s + " " + urlAddress, ""), + (a) -> assertCommand(a, "a", "a ==> 10"), + (a) -> assertCommand(a, "b", "b ==> 20"), + (a) -> assertCommand(a, "c", "c ==> 30") + ); + } + } finally { + httpServer.stop(0); + } + } + public void testOpenResource() { test( (a) -> assertCommand(a, "/open PRINTING", ""), diff --git a/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java b/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java index 56cce3f02ca..02c725cffa4 100644 --- a/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java +++ b/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -27,6 +27,7 @@ * @summary Tests for Aux channel, custom remote agents, custom JDI implementations. * @build KullaTesting ExecutionControlTestBase MyExecutionControl MyRemoteExecutionControl MyExecutionControlProvider * @run testng UserJdiUserRemoteTest + * @key intermittent */ import java.io.ByteArrayOutputStream; import org.testng.annotations.Test; diff --git a/test/langtools/tools/javac/options/release/ReleaseOptionCurrent.java b/test/langtools/tools/javac/options/release/ReleaseOptionCurrent.java new file mode 100644 index 00000000000..76b20d21ca6 --- /dev/null +++ b/test/langtools/tools/javac/options/release/ReleaseOptionCurrent.java @@ -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 + * @bug 8202387 + * @summary Verify that javac can handle --release <current> + * @modules jdk.compiler/com.sun.tools.javac.code + */ + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +import com.sun.tools.javac.code.Source; + +public class ReleaseOptionCurrent { + public static void main(String... args) throws IOException { + new ReleaseOptionCurrent().run(); + } + + void run() throws IOException { + String lineSep = System.getProperty("line.separator"); + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { + Iterable<? extends JavaFileObject> input = + fm.getJavaFileObjects(System.getProperty("test.src") + "/ReleaseOption.java"); + List<String> options = Arrays.asList("--release", Source.DEFAULT.name); + + boolean result = compiler.getTask(null, fm, null, options, null, input).call(); + if (!result) { + throw new AssertionError("Compilation failed unexpectedly."); + } + } + } +} diff --git a/test/langtools/tools/javac/preview/PreviewOptionTest.java b/test/langtools/tools/javac/preview/PreviewOptionTest.java index 80db6ba595c..fe880738ad5 100644 --- a/test/langtools/tools/javac/preview/PreviewOptionTest.java +++ b/test/langtools/tools/javac/preview/PreviewOptionTest.java @@ -54,8 +54,8 @@ public class PreviewOptionTest { .filter(s -> s.compareTo(Source.MIN) >= 0) .collect(Collectors.toList()); - versionsToTest.stream().forEach(this::testWithSourceFlag); - versionsToTest.stream().forEach(this::testWithReleaseFlag); + versionsToTest.forEach(this::testWithSourceFlag); + versionsToTest.forEach(this::testWithReleaseFlag); if (errors > 0) throw new Exception(errors + " errors occurred"); @@ -70,9 +70,7 @@ public class PreviewOptionTest { } void testWithReleaseFlag(Source release) { - //Todo: the condition below should say "release != Source.DEFAULT", but we can't do that - //since --release 11 is not supported yet. - testInternal(null, release, true); + testInternal(null, release, release != Source.DEFAULT); } void testInternal(Source source, Source release, boolean shouldFail) { diff --git a/test/lib/jdk/test/lib/Convert.java b/test/lib/jdk/test/lib/Convert.java new file mode 100644 index 00000000000..ac5235476ee --- /dev/null +++ b/test/lib/jdk/test/lib/Convert.java @@ -0,0 +1,85 @@ +/* + * 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. + */ + +package jdk.test.lib; + +import java.math.BigInteger; + +/** + * Utility class containing conversions between strings, arrays, and numeric + * values. + */ + +public class Convert { + + // Convert from a byte array to a hexadecimal representation as a string. + public static String byteArrayToHexString(byte[] arr) { + StringBuilder result = new StringBuilder(); + for (int i = 0; i < arr.length; ++i) { + byte curVal = arr[i]; + result.append(Character.forDigit(curVal >> 4 & 0xF, 16)); + result.append(Character.forDigit(curVal & 0xF, 16)); + } + return result.toString(); + } + + // Expand a single byte to a byte array + public static byte[] byteToByteArray(byte v, int length) { + byte[] result = new byte[length]; + result[0] = v; + return result; + } + + // Convert a hexadecimal string to a byte array + public static byte[] hexStringToByteArray(String str) { + byte[] result = new byte[str.length() / 2]; + for (int i = 0; i < result.length; i++) { + result[i] = (byte) Character.digit(str.charAt(2 * i), 16); + result[i] <<= 4; + result[i] += Character.digit(str.charAt(2 * i + 1), 16); + } + return result; + } + + /* + * Convert a hexadecimal string to the corresponding little-ending number + * as a BigInteger. The clearHighBit argument determines whether the most + * significant bit of the highest byte should be set to 0 in the result. + */ + public static + BigInteger hexStringToBigInteger(boolean clearHighBit, String str) { + BigInteger result = BigInteger.ZERO; + for (int i = 0; i < str.length() / 2; i++) { + int curVal = Character.digit(str.charAt(2 * i), 16); + curVal <<= 4; + curVal += Character.digit(str.charAt(2 * i + 1), 16); + if (clearHighBit && i == str.length() / 2 - 1) { + curVal &= 0x7F; + } + result = result.add(BigInteger.valueOf(curVal).shiftLeft(8 * i)); + } + return result; + } +} + + diff --git a/test/nashorn/script/basic/JDK-8200716.js b/test/nashorn/script/basic/JDK-8200716.js new file mode 100644 index 00000000000..5bb2fade3f7 --- /dev/null +++ b/test/nashorn/script/basic/JDK-8200716.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +/** + * JDK-8200716: Object propertyIsEnumerable buggy behavior on short integer-string key + * + * @test + * @run + */ + + +var o = ({ '1': 1 }); +Assert.assertTrue(o.propertyIsEnumerable('1')); + +Object.defineProperty(o, '1', { enumerable: false, value: 1 }); +Assert.assertFalse(o.propertyIsEnumerable('1')); + +Object.defineProperty(o, '1', { enumerable: true, value: 1 }); +Assert.assertTrue(o.propertyIsEnumerable('1'));